@promptctl/cc-candybar 1.109.0 → 1.110.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +91 -91
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -12,58 +12,58 @@ import{createRequire as e}from"node:module";import t from"node:process";import{j
12
12
  `+t+`}`}}return i.pop(),a=t,s}function p(e){if(e.length===0)return d(e,!0);let t=String.fromCodePoint(e.codePointAt(0));if(!n.isIdStartChar(t))return d(e,!0);for(let r=t.length;r<e.length;r++)if(!n.isIdContinueChar(String.fromCodePoint(e.codePointAt(r))))return d(e,!0);return e}function m(e){if(i.indexOf(e)>=0)throw TypeError(`Converting circular structure to JSON5`);i.push(e);let t=a;a+=c;let n=[];for(let t=0;t<e.length;t++){let r=u(String(t),e);n.push(r===void 0?`null`:r)}let r;if(n.length===0)r=`[]`;else if(c===``)r=`[`+n.join(`,`)+`]`;else{let e=`,
13
13
  `+a,i=n.join(e);r=`[
14
14
  `+a+i+`,
15
- `+t+`]`}return i.pop(),a=t,r}}})),et=ge(me(((e,t)=>{t.exports={parse:Qe(),stringify:$e()}}))(),1);function tt({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}const nt=tt();function rt(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(`›`)?e:e.replace(nt,``)}const it=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],at=[12288,12288,65281,65376,65504,65510],ot=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],st=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ct=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],lt=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let i=Math.floor((n+r)/2),a=i*2;if(t<e[a])r=i-1;else if(t>e[a+1])n=i+1;else return!0}return!1},ut=it[0],dt=it.at(-1),ft=at[0],pt=at.at(-1);ot[0],ot.at(-1),st[0],st.at(-1);const mt=ct[0],ht=ct.at(-1),gt=19968,[_t,vt]=yt(ct);function yt(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];if(gt>=i&&gt<=a)return[i,a];a-i>n-t&&(t=i,n=a)}return[t,n]}const bt=e=>e<ut||e>dt?!1:lt(it,e),xt=e=>e<ft||e>pt?!1:lt(at,e),St=e=>e>=_t&&e<=vt?!0:e<mt||e>ht?!1:lt(ct,e);function Ct(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function wt(e,{ambiguousAsWide:t=!1}={}){return Ct(e),xt(e)||St(e)||t&&bt(e)?2:1}const Tt=new Intl.Segmenter,Et=RegExp(`[^\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]`,`v`),Dt=RegExp(`\\p{Spacing_Mark}`,`v`),Ot=RegExp(`^\\p{RGI_Emoji}$`,`v`),kt=/^[\d#*]\u20E3$/,At=/\p{Extended_Pictographic}/gu;function jt(e){if(e.length>50)return!1;if(kt.test(e))return!0;if(e.includes(`‍`)){let t=e.match(At);return t!==null&&t.length>=2}return!1}function Mt(e){let t=e.search(Et);return t===-1?void 0:e.slice(t)}function Nt(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function Pt(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}function j(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function Ft(e){return Nt(e)||Pt(e)||j(e)}function M(e,t){let n=[];for(let t of e)Et.test(t)&&n.push(t.codePointAt(0));if(n.length===0)return;let r=0;for(let e=0;e<n.length;e++){let i=n[e];if(!Ft(i)){if(r===0)return;for(let i=e;i<n.length;i++)r+=wt(n[i],t);return r}if(Nt(i)&&Pt(n[e+1])){r+=2,e+=j(n[e+2])?2:1;continue}r+=wt(i,t)}return r}function It(e,t){let n=0,r=!0;for(let i of e){if(r){r=!1;continue}(Dt.test(i)||i>=`＀`&&i<=`￯`)&&(n+=wt(i.codePointAt(0),t))}return n}function Lt(e,t={}){if(typeof e!=`string`||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t,i=e;if(!r&&(i.includes(`\x1B`)||i.includes(`›`))&&(i=rt(i)),i.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(i))return i.length;let a=0,o={ambiguousAsWide:!n};for(let{segment:e}of Tt.segment(i)){let t=Mt(e);if(t===void 0)continue;if(Ot.test(e)||jt(e)){a+=2;continue}let n=M(t,o);if(n!==void 0){a+=n;continue}let r=t.codePointAt(0);a+=wt(r,o),a+=It(t,o)}return a}const Rt=new Map;function zt(e){if(e.length===0)return 0;if(e.length<=64){let t=Rt.get(e);if(t!==void 0)return t}let t=Lt(e);return e.length<=64&&(Rt.size>=4096&&Rt.clear(),Rt.set(e,t)),t}function Bt(e){return e}function Vt(e){return e}function Ht(e){return e>0?Math.floor(e):0}function Ut(e,t){if(t<=0)return[``,e];if(t>=zt(e))return[e,``];let n=0,r=0;for(let i of e){let e=zt(i);if(n+e>t)break;n+=e,r+=i.length}let i=e.slice(0,r),a=e.slice(r);return n<t?[i+` `.repeat(t-n),a]:[i,a]}function Wt(e,t){if(t<=0||e.length===0)return[e];let n=[],r=Vt(0);for(;r<e.length;){let i=Zt(e,r,t);n.push(e.slice(r,i)),r=i}return n}let Gt;function Kt(e){return Gt??=new Intl.Segmenter(void 0,{granularity:`grapheme`}),Array.from(Gt.segment(e),e=>e.segment)}function qt(e,t){return Yt(Kt(e),t).join(``)}function Jt(e,t){return Yt(Kt(e).reverse(),t).reverse().join(``)}function Yt(e,t){let n=0,r=0;for(let i of e){let e=zt(i);if(n+e>t)break;n+=e,r++}return e.slice(0,r)}function Xt(e,t,n){let r=0,i=t;for(;i<e.length;){let t=e.codePointAt(i),a=String.fromCodePoint(t),o=zt(a);if(r+o>n)break;r+=o,i=Vt(i+a.length)}return i}function Zt(e,t,n){return Vt(Math.max(Xt(e,t,n),Qt(e,t)))}function Qt(e,t){return t>=e.length?Vt(e.length):Vt(t+(e.codePointAt(t)>65535?2:1))}var $t=class{name;dark;vars;constructor(e,t,n){this.name=e,this.dark=t,this.vars=new Map(n)}get(e){return this.vars.get(e)}};function en(e){return e.toString(16).padStart(2,`0`)}function tn(e){return Number.isInteger(e)&&e>=0&&e<=255}function nn(e,t){if(!tn(t))throw RangeError(`ColorRgba.${e} must be an integer in [0, 255]; got ${t}`)}var N=class e{red;green;blue;alpha;constructor(e,t,n,r=1){if(this.red=e,this.green=t,this.blue=n,this.alpha=r,nn(`red`,e),nn(`green`,t),nn(`blue`,n),!Number.isFinite(r)||r<0||r>1)throw RangeError(`ColorRgba.alpha must be a finite number in [0, 1]; got ${r}`)}get hex(){let e=`#`+en(this.red)+en(this.green)+en(this.blue);return this.alpha===1?e:e+en(Math.round(this.alpha*255))}get rgb(){return this.alpha===1?`rgb(${this.red},${this.green},${this.blue})`:`rgba(${this.red},${this.green},${this.blue},${this.alpha})`}get normalized(){return[this.red/255,this.green/255,this.blue/255,this.alpha]}compositeOver(t){if(this.alpha===1)return this;let n=this.alpha;return new e(Math.round(t.red+(this.red-t.red)*n),Math.round(t.green+(this.green-t.green)*n),Math.round(t.blue+(this.blue-t.blue)*n),1)}};const rn=new N(0,0,0);function an(e){let t=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(e.red)+.7152*t(e.green)+.0722*t(e.blue)}function on(e,t){return sn(an(e),an(t))}function sn(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function cn(e,t,n){return e.size>=4096&&e.clear(),e.set(t,n),n}function ln(e,t){let n=e.red-t.red,r=e.green-t.green,i=e.blue-t.blue;return n*n+r*r+i*i}var un=class{colors;firstIndex;matchCache=new Map;readableCache=new Map;constructor(e,t=0){this.colors=e,this.firstIndex=t}get(e){return this.colors[e-this.firstIndex]}luminanceCache;luminances(){return this.luminanceCache??=this.colors.map(an),this.luminanceCache}get size(){return this.colors.length}match(e){let t=`${e.red},${e.green},${e.blue},${e.alpha}`,n=this.matchCache.get(t);if(n!==void 0)return n;let r=0,i=1/0;for(let t=0;t<this.colors.length;t++){let n=this.colors[t],a=ln(n,e);a<i&&(i=a,r=t)}return cn(this.matchCache,t,this.firstIndex+r)}matchReadable(e,t,n){let r=`${e.red},${e.green},${e.blue}|${t.red},${t.green},${t.blue}|${n}`,i=this.readableCache.get(r);if(i!==void 0)return i;let a=an(t),o=0,s=!1,c=-1/0;for(let t=0;t<this.colors.length;t++){let r=this.colors[t],i=this.luminances()[t],l=sn(i,a),u=l>=n,d=u?-ln(r,e):l;(u&&!s||u===s&&d>c)&&(o=t,s=u,c=d)}return cn(this.readableCache,r,this.firstIndex+o)}matchWhere(e,t){let n=this.colors.map(t=>ln(t,e)),r=[...n.keys()].sort((e,t)=>n[e]-n[t]).find(e=>t(this.colors[e],this.firstIndex+e));return r===void 0?void 0:this.firstIndex+r}},P;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.STANDARD=1]=`STANDARD`,e[e.EIGHT_BIT=2]=`EIGHT_BIT`,e[e.TRUECOLOR=3]=`TRUECOLOR`,e[e.WINDOWS=4]=`WINDOWS`})(P||={});const dn={truecolor:P.TRUECOLOR,256:P.EIGHT_BIT,ansi:P.STANDARD,none:null,0:null,false:null,1:P.STANDARD,true:P.STANDARD,2:P.EIGHT_BIT,3:P.TRUECOLOR,"iTerm.app":P.TRUECOLOR,Apple_Terminal:P.EIGHT_BIT,vscode:P.TRUECOLOR,Tabby:P.TRUECOLOR,"xterm-kitty":P.TRUECOLOR,"xterm-ghostty":P.TRUECOLOR,wezterm:P.TRUECOLOR,alacritty:P.TRUECOLOR,foot:P.TRUECOLOR,contour:P.TRUECOLOR};function fn(e={}){let t=mn(e).NO_COLOR;if(t!==void 0&&t!==``)return null;let n=pn(mn(e));return n===void 0?F(e):n}function pn(e){let t=e.FORCE_COLOR;if(t===void 0||t===``)return;let n=dn[t];return n===void 0?P.STANDARD:n}function mn(e){return e.env??(typeof process<`u`?process.env:{})}function F(e){let t=mn(e);if(!(e.isTTY??(typeof process<`u`?process.stdout?.isTTY??!1:!1)))return null;let n=t.TERM??``;if(n===`dumb`||n===`unknown`)return null;let r=t.COLORTERM;if(r===`truecolor`||r===`24bit`)return P.TRUECOLOR;let i=dn[n];if(i!==void 0)return i;let a=t.TERM_PROGRAM;if(a!==void 0){let e=dn[a];if(e!==void 0)return e}return/-256(color)?$/i.test(n)?P.EIGHT_BIT:/-truecolor$/i.test(n)?P.TRUECOLOR:(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n),P.STANDARD)}function hn(e,t){return e===`auto`?{colorSystem:fn(t),hyperlinks:(pn(mn(t??{}))??null)!==null||F(t??{})!==null}:{colorSystem:typeof e==`string`?gn(e):e,hyperlinks:!0}}function gn(e,t){if(e===`auto`)return fn(t);if(Object.hasOwn(dn,e))return dn[e];throw new _n(`Unknown color depth spec: ${JSON.stringify(e)} (expected "auto", "truecolor", "256", "ansi", or "none")`)}var _n=class extends Error{constructor(e){super(e),this.name=`ColorParseError`}};const vn=new Map;var yn=class e{name;type;number;value;downgradeCache=new Map;constructor(e,t,n,r){this.name=e,this.type=t,this.number=n,this.value=r}get isDefault(){return this.type===P.DEFAULT}get fixedValue(){switch(this.type){case P.TRUECOLOR:return this.value;case P.EIGHT_BIT:return this.number<16?void 0:Nn.get(this.number);case P.DEFAULT:case P.STANDARD:case P.WINDOWS:return}}get isSystemDefined(){return this.type===P.STANDARD||this.type===P.WINDOWS}getAnsiCodes(e=!0){switch(this.type){case P.DEFAULT:return[e?`39`:`49`];case P.STANDARD:{let t=this.number;return e?t<8?[`${30+t}`]:[`${90+t-8}`]:t<8?[`${40+t}`]:[`${100+t-8}`]}case P.EIGHT_BIT:return[e?`38`:`48`,`5`,`${this.number}`];case P.TRUECOLOR:{let t=this.value;return[e?`38`:`48`,`2`,`${t.red}`,`${t.green}`,`${t.blue}`]}case P.WINDOWS:{let t=this.number;return e?t<8?[`${30+t}`]:[`${90+t-8}`]:t<8?[`${40+t}`]:[`${100+t-8}`]}}}flattenAlpha(t){if(this.type!==P.TRUECOLOR||!this.value)return this;let n=this.value.compositeOver(t);return n===this.value?this:e.fromRgba(n)}downgrade(e){if(this.type===P.DEFAULT||this.type<=e)return this;let t=this.downgradeCache.get(e);if(t)return t;let n=this.performDowngrade(e);return this.downgradeCache.set(e,n),n}getTruecolor(e,t=!0){switch(this.type){case P.TRUECOLOR:return this.value;case P.EIGHT_BIT:return this.number<16?(e??Fn).ansiColors.get(this.number):Nn.get(this.number);case P.STANDARD:return(e??Fn).ansiColors.get(this.number);case P.DEFAULT:{let n=e??Fn;return t?n.foregroundColor:n.backgroundColor}case P.WINDOWS:return(e??Fn).ansiColors.get(this.number)}}static default(){return new e(`default`,P.DEFAULT)}static fromAnsi(t){let n=t<16?P.STANDARD:P.EIGHT_BIT;return new e(`color(${t})`,n,t)}static fromRgba(t){return new e(t.hex,P.TRUECOLOR,void 0,t)}static fromRgb(t,n,r){return e.fromRgba(new N(t,n,r))}static parse(e){let t=e.toLowerCase().trim(),n=vn.get(t);if(n)return n;let r=Cn(t);return vn.set(t,r),r}performDowngrade(t){let n=this.getTruecolor();switch(t){case P.EIGHT_BIT:{let t=Pn.match(n);return e.fromAnsi(t)}case P.STANDARD:{let t=Mn.match(n);return new e(`color(${t})`,P.STANDARD,t)}case P.WINDOWS:case P.TRUECOLOR:return this;case P.DEFAULT:return e.default()}}};const bn=/^#([0-9a-f]{6})$/,xn=/^#([0-9a-f]{8})$/,Sn=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,I=/^color\((\d+)\)$/;function Cn(e){if(e===`default`||e===``)return yn.default();let t=L[e];if(t!==void 0)return new yn(e,t<16?P.STANDARD:P.EIGHT_BIT,t);let n=xn.exec(e);if(n)return new yn(e,P.TRUECOLOR,void 0,En(n[1]));let r=bn.exec(e);if(r)return new yn(e,P.TRUECOLOR,void 0,Tn(r[1]));let i=Sn.exec(e);if(i){let t=wn(e,i[1],`red`),n=wn(e,i[2],`green`),r=wn(e,i[3],`blue`);return new yn(e,P.TRUECOLOR,void 0,new N(t,n,r))}let a=I.exec(e);if(a){let t=wn(e,a[1],`number`);return new yn(e,t<16?P.STANDARD:P.EIGHT_BIT,t)}throw new _n(`Failed to parse color: "${e}"`)}function wn(e,t,n){let r=parseInt(t,10);if(!tn(r))throw new _n(`ColorSpec "${e}": ${n} ${t} is out of range (0-255)`);return r}function Tn(e){return new N(parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16))}function En(e){return new N(parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),parseInt(e.slice(6,8),16)/255)}function Dn(e,t,n=.5){return new N(Math.round(e.red+(t.red-e.red)*n),Math.round(e.green+(t.green-e.green)*n),Math.round(e.blue+(t.blue-e.blue)*n),e.alpha+(t.alpha-e.alpha)*n)}var On=class{backgroundColor;foregroundColor;ansiColors;palette;constructor(e,t,n,r){this.backgroundColor=e,this.foregroundColor=t,this.ansiColors=n,this.palette=r}};function kn(){return[new N(0,0,0),new N(128,0,0),new N(0,128,0),new N(128,128,0),new N(0,0,128),new N(128,0,128),new N(0,128,128),new N(192,192,192),new N(128,128,128),new N(255,0,0),new N(0,255,0),new N(255,255,0),new N(0,0,255),new N(255,0,255),new N(0,255,255),new N(255,255,255)]}function An(){let e=kn(),t=[0,95,135,175,215,255];for(let n=0;n<6;n++)for(let r=0;r<6;r++)for(let i=0;i<6;i++)e.push(new N(t[n],t[r],t[i]));for(let t=0;t<24;t++){let n=8+10*t;e.push(new N(n,n,n))}return e}function jn(){return[new N(0,0,0),new N(0,0,128),new N(0,128,0),new N(0,128,128),new N(128,0,0),new N(128,0,128),new N(128,128,0),new N(192,192,192),new N(128,128,128),new N(0,0,255),new N(0,255,0),new N(0,255,255),new N(255,0,0),new N(255,0,255),new N(255,255,0),new N(255,255,255)]}const Mn=new un(kn()),Nn=new un(An()),Pn=new un(An().slice(16),16);new un(jn());const Fn=new On(new N(0,0,0),new N(255,255,255),Mn,new $t(`default`,!0,new Map));function In(e){let t=Object.entries(e).filter(([e])=>e.includes(`grey`)).map(([e,t])=>[e.replace(`grey`,`gray`),t]);return{...e,...Object.fromEntries(t)}}const L=In({black:0,red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,white:7,bright_black:8,bright_red:9,bright_green:10,bright_yellow:11,bright_blue:12,bright_magenta:13,bright_cyan:14,bright_white:15,grey0:16,navy_blue:17,dark_blue:18,blue3:19,blue2:20,blue1:21,dark_green:22,deep_sky_blue4:23,deep_sky_blue5:24,deep_sky_blue6:25,dodger_blue3:26,dodger_blue2:27,green4:28,spring_green4:29,turquoise4:30,deep_sky_blue3:31,deep_sky_blue7:32,dodger_blue1:33,green3:34,spring_green3:35,dark_cyan:36,light_sea_green:37,deep_sky_blue2:38,deep_sky_blue1:39,green5:40,spring_green5:41,spring_green2:42,cyan3:43,dark_turquoise:44,turquoise2:45,green1:46,spring_green6:47,spring_green1:48,medium_spring_green:49,cyan2:50,cyan1:51,dark_red:52,deep_pink4:53,purple4:54,purple5:55,purple3:56,blue_violet:57,orange4:58,grey37:59,medium_purple4:60,slate_blue3:61,slate_blue4:62,royal_blue1:63,chartreuse4:64,dark_sea_green4:65,pale_turquoise4:66,steel_blue:67,steel_blue3:68,cornflower_blue:69,chartreuse3:70,dark_sea_green5:71,cadet_blue:72,cadet_blue2:73,sky_blue3:74,steel_blue1:75,chartreuse5:76,pale_green3:77,sea_green3:78,aquamarine3:79,medium_turquoise:80,steel_blue2:81,chartreuse2:82,sea_green2:83,sea_green1:84,sea_green4:85,aquamarine1:86,dark_slate_gray2:87,dark_red2:88,deep_pink5:89,dark_magenta:90,dark_magenta2:91,dark_violet:92,purple2:93,orange5:94,light_pink4:95,plum4:96,medium_purple3:97,medium_purple5:98,slate_blue1:99,yellow4:100,wheat4:101,grey53:102,light_slate_grey:103,medium_purple:104,light_slate_blue:105,yellow5:106,dark_olive_green3:107,dark_sea_green:108,light_sky_blue3:109,light_sky_blue4:110,sky_blue2:111,chartreuse6:112,dark_olive_green4:113,pale_green4:114,dark_sea_green3:115,dark_slate_gray3:116,sky_blue1:117,chartreuse1:118,light_green:119,light_green2:120,pale_green1:121,aquamarine2:122,dark_slate_gray1:123,red3:124,deep_pink6:125,medium_violet_red:126,magenta3:127,dark_violet2:128,purple:129,dark_orange3:130,indian_red:131,hot_pink3:132,medium_orchid3:133,medium_orchid:134,medium_purple2:135,dark_goldenrod:136,light_salmon3:137,rosy_brown:138,grey63:139,medium_purple6:140,medium_purple1:141,gold3:142,dark_khaki:143,navajo_white3:144,grey69:145,light_steel_blue3:146,light_steel_blue:147,yellow3:148,dark_olive_green5:149,dark_sea_green6:150,dark_sea_green2:151,light_cyan3:152,light_sky_blue1:153,green_yellow:154,dark_olive_green2:155,pale_green2:156,dark_sea_green7:157,dark_sea_green1:158,pale_turquoise1:159,red4:160,deep_pink3:161,deep_pink8:162,magenta4:163,magenta5:164,magenta2:165,dark_orange4:166,indian_red2:167,hot_pink4:168,hot_pink2:169,orchid:170,medium_orchid1:171,orange3:172,light_salmon4:173,light_pink3:174,pink3:175,plum3:176,violet:177,gold4:178,light_goldenrod3:179,tan:180,misty_rose3:181,thistle3:182,plum2:183,yellow6:184,khaki3:185,light_goldenrod2:186,light_yellow3:187,grey84:188,light_steel_blue1:189,yellow2:190,dark_olive_green1:191,dark_olive_green6:192,dark_sea_green8:193,honeydew2:194,light_cyan1:195,red1:196,deep_pink2:197,deep_pink1:198,deep_pink9:199,magenta6:200,magenta1:201,orange_red1:202,indian_red1:203,indian_red3:204,hot_pink5:205,hot_pink:206,medium_orchid2:207,dark_orange:208,salmon1:209,light_coral:210,pale_violet_red1:211,orchid2:212,orchid1:213,orange1:214,sandy_brown:215,light_salmon1:216,light_pink1:217,pink1:218,plum1:219,gold1:220,light_goldenrod4:221,light_goldenrod5:222,navajo_white1:223,misty_rose1:224,thistle1:225,yellow1:226,light_goldenrod1:227,khaki1:228,wheat1:229,cornsilk1:230,grey100:231,grey3:232,grey7:233,grey11:234,grey15:235,grey19:236,grey23:237,grey27:238,grey30:239,grey35:240,grey39:241,grey42:242,grey46:243,grey50:244,grey54:245,grey58:246,grey62:247,grey66:248,grey70:249,grey74:250,grey78:251,grey82:252,grey85:253,grey89:254,grey93:255}),Ln=[`default`,...Object.keys(L)];var Rn;const zn=[`l`,`c`,`h`,`alpha`],Bn=Object.freeze({hueShift:0,chromaScale:1,lightnessScale:1,lightnessShift:0});Object.freeze({hueShift:0,chromaScale:1,lightnessScale:-1,lightnessShift:1});function Vn(e){return e.hueShift%360==0&&e.chromaScale===1&&e.lightnessScale===1&&e.lightnessShift===0}function Hn(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Un(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function R(e){return e<0?0:e>1?1:e}const Wn=1e-4,Gn=1e-7,Kn=(e,t)=>e<Gn?0:t,qn=(e,t,n)=>e*(1-n)+t*n,Jn=e=>{let t=e%360;return t<0?t+360:t};function Yn(e,t,n){return e>=-Wn&&e<=1+Wn&&t>=-Wn&&t<=1+Wn&&n>=-Wn&&n<=1+Wn}var Xn=class{l;c;h;alpha;constructor(e,t,n,r=1){if(this.l=e,this.c=t,this.h=n,this.alpha=r,!Number.isFinite(e))throw RangeError(`Oklch.l must be finite; got ${e}`);if(!Number.isFinite(t))throw RangeError(`Oklch.c must be finite; got ${t}`);if(!Number.isFinite(n))throw RangeError(`Oklch.h must be finite; got ${n}`);if(!Number.isFinite(r)||r<0||r>1)throw RangeError(`Oklch.alpha must be a finite number in [0,1]; got ${r}`)}static fromRgba(e){let[t,n,r,i]=e.normalized,a=Hn(t),o=Hn(n),s=Hn(r),c=.4122214708*a+.5363325363*o+.0514459929*s,l=.2119034982*a+.6806995451*o+.1073969566*s,u=.0883024619*a+.2817188376*o+.6299787005*s,d=Math.cbrt(c),f=Math.cbrt(l),p=Math.cbrt(u),m=.2104542553*d+.793617785*f-.0040720468*p,h=1.9779984951*d-2.428592205*f+.4505937099*p,g=.0259040371*d+.7827717662*f-.808675766*p,_=Math.sqrt(h*h+g*g),v=Jn(180/Math.PI*Math.atan2(g,h));return new Rn(m,_,Kn(_,v),i)}toRgba(){let e=R(this.l),t=Math.max(0,this.c),n=this.findInGamutChroma(e,t,this.h),{r,g:i,b:a}=this.toLinearRgb(e,n,this.h);return new N(Math.round(R(Un(r))*255),Math.round(R(Un(i))*255),Math.round(R(Un(a))*255),this.alpha)}applyKey(e){if(Vn(e))return this;let t=R(this.l*e.lightnessScale+e.lightnessShift),n=Math.max(0,this.c*e.chromaScale),r=Jn(this.h+e.hueShift);return new Rn(t,n,Kn(n,r),this.alpha)}mix(e,t){if(!(t>=0&&t<=1))throw RangeError(`Oklch.mix: t must be in [0, 1]; got ${t}`);return this.#e(e,t,t,t,t)}mixAxes(e,t){for(let e of zn){let n=t[e];if(!(n>=0&&n<=1))throw RangeError(`Oklch.mixAxes: ${e} weight must be in [0, 1]; got ${n}`)}return this.#e(e,t.l,t.c,t.h,t.alpha)}#e(e,t,n,r,i){let a=this.c>=Gn,o=e.c>=Gn,s=Jn(a?this.h:o?e.h:0),c=Jn(o?e.h:s),l=c-s,u=l<-180?s-360:s,d=l>180?c-360:c,f=qn(this.c,e.c,n);return new Rn(qn(this.l,e.l,t),f,Kn(f,Jn(qn(u,d,r))),qn(this.alpha,e.alpha,i))}deltaE(e){let t=this.h*Math.PI/180,n=e.h*Math.PI/180;return Math.hypot(this.l-e.l,this.c*Math.cos(t)-e.c*Math.cos(n),this.c*Math.sin(t)-e.c*Math.sin(n))}toLinearRgb(e,t,n){let r=Math.PI/180*n,i=t*Math.cos(r),a=t*Math.sin(r),o=e+.3963377774*i+.2158037573*a,s=e-.1055613458*i-.0638541728*a,c=e-.0894841775*i-1.291485548*a,l=o*o*o,u=s*s*s,d=c*c*c;return{r:4.0767416621*l-3.3077115913*u+.2309699292*d,g:-1.2684380046*l+2.6097574011*u-.3413193965*d,b:-.0041960863*l-.7034186147*u+1.707614701*d}}findInGamutChroma(e,t,n){let r=this.toLinearRgb(e,t,n);if(Yn(r.r,r.g,r.b))return t;let i=0,a=t;for(let t=0;t<24;t++){let t=(i+a)/2,r=this.toLinearRgb(e,t,n);Yn(r.r,r.g,r.b)?i=t:a=t}return i}};Rn=Xn;var Zn=class extends Error{ref;constructor(e,t){super(`color reference ${JSON.stringify(e)} did not resolve — ${t}`),this.ref=e,this.name=`ColorRefError`}};const Qn=/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/;function $n(e){let t=e.trim();if(!Qn.test(t))throw new Zn(e,`expected #RRGGBB or #RRGGBBAA`);let n=t.slice(1);return t.length>7?En(n):Tn(n)}function er(e,t){let n=t.trim();if(n.startsWith(`#`))return $n(n);let r=e.get(n);if(r===void 0)throw new Zn(t,`no such variable in palette ${JSON.stringify(e.name)}`+tr(e,n));return r}function tr(e,t){let n=t.split(`-`),r=[...e.vars.keys()].filter(e=>n.some(t=>t!==``&&e.includes(t))).slice(0,8);return r.length===0?``:`; did you mean: ${r.join(`, `)}`}function nr(e){let t=e.red/255,n=e.green/255,r=e.blue/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s=i-a;if(s===0)return{h:0,s:0,l:o};let c=s/(o>.5?2-i-a:i+a),l;return l=i===t?(n-r)/s%6:i===n?(r-t)/s+2:(t-n)/s+4,l=(l*60+360)%360,{h:l,s:c,l:o}}function rr(e){let t=Math.round(e);return t<0?0:t>255?255:t}function ir(e){let{h:t,s:n,l:r}=e;if(n===0){let e=rr(r*255);return new N(e,e,e)}let i=(1-Math.abs(2*r-1))*n,a=t/60,o=i*(1-Math.abs(a%2-1)),s=0,c=0,l=0;a<1?[s,c,l]=[i,o,0]:a<2?[s,c,l]=[o,i,0]:a<3?[s,c,l]=[0,i,o]:a<4?[s,c,l]=[0,o,i]:a<5?[s,c,l]=[o,0,i]:[s,c,l]=[i,0,o];let u=r-i/2;return new N(rr((s+u)*255),rr((c+u)*255),rr((l+u)*255))}function ar(e){return e<0?0:e>1?1:e}function or(e,t){let n=nr(e);return n.l=ar(n.l-.1*t),ir(n)}function sr(e,t=rn){return an(dr(e,t))>.179?new N(0,0,0):new N(255,255,255)}function cr(e,t,n=4.5,r=P.TRUECOLOR,i=rn){let a=dr(t,i),o=pr(e,a,n),s=fr[r];if(s===void 0)return o;let c=ur(a,r,i);return on(ur(o,r,i),c)>=n?o:s.get(s.matchReadable(o,c,n))}function lr(e,t,n,r=rn){let i=dr(e,r),a=e=>ur(e,t,r);if(n(a(i),a))return i;let o=fr[t],s=o?.matchWhere(i,e=>n(e,a));return s===void 0?void 0:o.get(s)}function ur(e,t,n=rn){let r=dr(e,n),i=fr[t];return i===void 0?r:i.get(i.match(r))}function dr(e,t){if(t.alpha!==1)throw RangeError(`a contrast substrate is the opaque surface under a translucent background; got ${t.hex}`);return e.compositeOver(t)}const fr={[P.EIGHT_BIT]:Pn,[P.STANDARD]:Mn};function pr(e,t,n){let r=e.compositeOver(t);if(on(r,t)>=n)return r;let i=Xn.fromRgba(r),a=an(t)>.179?0:1;if(on(new Xn(a,i.c,i.h,i.alpha).toRgba(),t)<n)return sr(t);let o=i.l,s=a;for(let e=0;e<20;e++){let e=(o+s)/2;on(new Xn(e,i.c,i.h,i.alpha).toRgba(),t)>=n?s=e:o=e}return new Xn(s,i.c,i.h,i.alpha).toRgba()}const mr={name:`atom-one-dark`,dark:!0,ansi:{black:`#282C34`,red:`#E06C75`,green:`#98C379`,yellow:`#E5C07B`,blue:`#61AFEF`,magenta:`#C678DD`,cyan:`#56B6C2`,white:`#DCDFE4`,brightBlack:`#5D677A`,brightRed:`#E06C75`,brightGreen:`#98C379`,brightYellow:`#E5C07B`,brightBlue:`#61AFEF`,brightMagenta:`#C678DD`,brightCyan:`#56B6C2`,brightWhite:`#DCDFE4`},vars:{accent:`#A378C2`,"accent-darken-1":`#8E65AD`,"accent-darken-2":`#7A5299`,"accent-darken-3":`#674085`,"accent-lighten-1":`#B78BD6`,"accent-lighten-2":`#CC9FEC`,"accent-lighten-3":`#E2B3FF`,"accent-muted":`#4C425E`,background:`#282C34`,"background-darken-1":`#181C23`,"background-darken-2":`#050A14`,"background-darken-3":`#000000`,"background-lighten-1":`#383C44`,"background-lighten-2":`#494D56`,"background-lighten-3":`#5B5F68`,"block-cursor-background":`#61AFEF`,"block-cursor-blurred-background":`#61AFEF4C`,"block-cursor-blurred-foreground":`#ABB2BF`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#61AFEF`,"border-blurred":`#353B47`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#ABB2BF`,error:`#EF6262`,"error-darken-1":`#D84D50`,"error-darken-2":`#C1373E`,"error-darken-3":`#AA1F2E`,"error-lighten-1":`#FF7674`,"error-lighten-2":`#FF8B87`,"error-lighten-3":`#FFA09B`,"error-muted":`#643C41`,"footer-background":`#4F5666`,"footer-description-background":`#00000000`,"footer-description-foreground":`#ABB2BF`,"footer-foreground":`#ABB2BF`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#A378C2`,foreground:`#ABB2BF`,"foreground-darken-1":`#979DAA`,"foreground-darken-2":`#838A96`,"foreground-darken-3":`#707783`,"foreground-disabled":`#ABB2BF60`,"foreground-lighten-1":`#BFC6D3`,"foreground-lighten-2":`#D4DBE8`,"foreground-lighten-3":`#E9F0FE`,"foreground-muted":`#ABB2BF99`,"input-cursor-background":`#ABB2BF`,"input-cursor-foreground":`#282C34`,"input-selection-background":`#77C3FF66`,"link-background":`#00000000`,"link-background-hover":`#61AFEF`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#61AFEF`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#61AFEF`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#61AFEF`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#ABB2BF`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#ABB2BF`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#ABB2BF99`,panel:`#4F5666`,"panel-darken-1":`#3D4453`,"panel-darken-2":`#2C3342`,"panel-darken-3":`#1C2331`,"panel-lighten-1":`#616878`,"panel-lighten-2":`#737A8B`,"panel-lighten-3":`#868E9F`,primary:`#61AFEF`,"primary-background":`#4F5B6A`,"primary-background-darken-1":`#3F4D5D`,"primary-background-darken-2":`#303F50`,"primary-background-darken-3":`#303F50`,"primary-background-lighten-1":`#5E6A77`,"primary-background-lighten-2":`#6E7884`,"primary-background-lighten-3":`#7D8791`,"primary-darken-1":`#489BD9`,"primary-darken-2":`#2C87C4`,"primary-darken-3":`#0074AF`,"primary-lighten-1":`#77C3FF`,"primary-lighten-2":`#8ED8FF`,"primary-lighten-3":`#A4EDFF`,"primary-muted":`#39536C`,scrollbar:`#355674`,"scrollbar-active":`#61AFEF`,"scrollbar-background":`#181C23`,"scrollbar-background-active":`#181C23`,"scrollbar-background-hover":`#181C23`,"scrollbar-corner-color":`#181C23`,"scrollbar-hover":`#3C6589`,secondary:`#C678DD`,"secondary-background":`#5B5567`,"secondary-background-darken-1":`#4D465A`,"secondary-background-darken-2":`#3F374D`,"secondary-background-darken-3":`#3F374D`,"secondary-background-lighten-1":`#6A6475`,"secondary-background-lighten-2":`#787382`,"secondary-background-lighten-3":`#87828F`,"secondary-darken-1":`#B064C7`,"secondary-darken-2":`#9B50B3`,"secondary-darken-3":`#873D9E`,"secondary-lighten-1":`#DB8CF2`,"secondary-lighten-2":`#F1A0FF`,"secondary-lighten-3":`#FFB5FF`,"secondary-muted":`#574266`,success:`#62F062`,"success-darken-1":`#48DA4D`,"success-darken-2":`#29C438`,"success-darken-3":`#00AF22`,"success-lighten-1":`#7AFF76`,"success-lighten-2":`#91FF8A`,"success-lighten-3":`#A8FF9F`,"success-muted":`#396641`,surface:`#3B414D`,"surface-active":`#484E5B`,"surface-darken-1":`#2A303B`,"surface-darken-2":`#1A202B`,"surface-darken-3":`#09101B`,"surface-lighten-1":`#4C525E`,"surface-lighten-2":`#5E6471`,"surface-lighten-3":`#707684`,text:`#FFFFFFDD`,"text-accent":`#C2A5D6`,"text-disabled":`#FFFFFF60`,"text-error":`#F59797`,"text-muted":`#FFFFFF99`,"text-primary":`#96CAF4`,"text-secondary":`#D9A5E8`,"text-success":`#97F597`,"text-warning":`#E9CC92`,warning:`#DDB25B`,"warning-darken-1":`#C79D47`,"warning-darken-2":`#B28A34`,"warning-darken-3":`#9C7721`,"warning-lighten-1":`#F4C66E`,"warning-lighten-2":`#FFDB82`,"warning-lighten-3":`#FFF096`,"warning-muted":`#5E543F`}},hr={name:`atom-one-light`,dark:!1,ansi:{black:`#383A42`,red:`#E45649`,green:`#50A14F`,yellow:`#C18401`,blue:`#0184BC`,magenta:`#A626A4`,cyan:`#0997B3`,white:`#BABABA`,brightBlack:`#4F525E`,brightRed:`#E06C75`,brightGreen:`#98C379`,brightYellow:`#D8B36E`,brightBlue:`#61AFEF`,brightMagenta:`#C678DD`,brightCyan:`#56B6C2`,brightWhite:`#FFFFFF`},vars:{accent:`#BE9232`,"accent-darken-1":`#A97E1D`,"accent-darken-2":`#936B01`,"accent-darken-3":`#7E5900`,"accent-lighten-1":`#D5A545`,"accent-lighten-2":`#EBB959`,"accent-lighten-3":`#FFCE6C`,"accent-muted":`#E8DABE`,background:`#FAFAFA`,"background-darken-1":`#E4E4E4`,"background-darken-2":`#CFCFCF`,"background-darken-3":`#BABABA`,"background-lighten-1":`#FFFFFF`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#4078F2`,"block-cursor-blurred-background":`#4078F24C`,"block-cursor-blurred-foreground":`#383A42`,"block-cursor-foreground":`#000000DD`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#4078F2`,"border-blurred":`#D8D8D8`,"button-color-foreground":`#000000DD`,"button-foreground":`#383A42`,error:`#F13F3F`,"error-darken-1":`#D9232D`,"error-darken-2":`#C1001D`,"error-darken-3":`#A9000D`,"error-lighten-1":`#FF5650`,"error-lighten-2":`#FF6C62`,"error-lighten-3":`#FF8275`,"error-muted":`#F7C1C1`,"footer-background":`#CCCCCC`,"footer-description-background":`#00000000`,"footer-description-foreground":`#383A42`,"footer-foreground":`#383A42`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#BF9232`,foreground:`#383A42`,"foreground-darken-1":`#272931`,"foreground-darken-2":`#181A21`,"foreground-darken-3":`#040612`,"foreground-disabled":`#383A4260`,"foreground-lighten-1":`#494B53`,"foreground-lighten-2":`#5A5C65`,"foreground-lighten-3":`#6D6F78`,"foreground-muted":`#383A4299`,"input-cursor-background":`#383A42`,"input-cursor-foreground":`#FAFAFA`,"input-selection-background":`#5C8AFF66`,"link-background":`#00000000`,"link-background-hover":`#4078F2`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#4078F2`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#4078F2`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#4078F2`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#383A42`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#383A42`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#383A4299`,panel:`#CCCCCC`,"panel-darken-1":`#B7B7B7`,"panel-darken-2":`#A3A3A3`,"panel-darken-3":`#8F8F8F`,"panel-lighten-1":`#E1E1E1`,"panel-lighten-2":`#F6F6F6`,"panel-lighten-3":`#FFFFFF`,primary:`#4078F2`,"primary-background":`#4078F2`,"primary-background-darken-1":`#1865DC`,"primary-background-darken-2":`#0053C6`,"primary-background-darken-3":`#0043B1`,"primary-background-lighten-1":`#5C8AFF`,"primary-background-lighten-2":`#759EFF`,"primary-background-lighten-3":`#8DB2FF`,"primary-darken-1":`#1865DC`,"primary-darken-2":`#0053C6`,"primary-darken-3":`#0043B1`,"primary-lighten-1":`#5C8AFF`,"primary-lighten-2":`#759EFF`,"primary-lighten-3":`#8DB2FF`,"primary-muted":`#C2D3F7`,scrollbar:`#A2B8E9`,"scrollbar-active":`#4078F2`,"scrollbar-background":`#E4E4E4`,"scrollbar-background-active":`#E4E4E4`,"scrollbar-background-hover":`#E4E4E4`,"scrollbar-corner-color":`#E4E4E4`,"scrollbar-hover":`#92AEEB`,secondary:`#A626A4`,"secondary-background":`#A626A4`,"secondary-background-darken-1":`#90008F`,"secondary-background-darken-2":`#7B007C`,"secondary-background-darken-3":`#670069`,"secondary-background-lighten-1":`#BB3EB8`,"secondary-background-lighten-2":`#D154CD`,"secondary-background-lighten-3":`#E769E2`,"secondary-darken-1":`#90008F`,"secondary-darken-2":`#7B007C`,"secondary-darken-3":`#670069`,"secondary-lighten-1":`#BB3EB8`,"secondary-lighten-2":`#D154CD`,"secondary-lighten-3":`#E769E2`,"secondary-muted":`#E0BAE0`,success:`#6BF23F`,"success-darken-1":`#52DC25`,"success-darken-2":`#36C600`,"success-darken-3":`#05B100`,"success-lighten-1":`#83FF55`,"success-lighten-2":`#9BFF6B`,"success-lighten-3":`#B2FF80`,"success-muted":`#CFF7C1`,surface:`#E0E0E0`,"surface-active":`#F1F1F1`,"surface-darken-1":`#CACACA`,"surface-darken-2":`#B6B6B6`,"surface-darken-3":`#A2A2A2`,"surface-lighten-1":`#F5F5F5`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#7E6021`,"text-disabled":`#00000060`,"text-error":`#9F2929`,"text-muted":`#00000099`,"text-primary":`#2A4F9F`,"text-secondary":`#6D196C`,"text-success":`#479F29`,"text-warning":`#8E8F24`,warning:`#D7D938`,"warning-darken-1":`#C1C41C`,"warning-darken-2":`#ABAF00`,"warning-darken-3":`#969B00`,"warning-lighten-1":`#EEEE4E`,"warning-lighten-2":`#FFFF64`,"warning-lighten-3":`#FFFF79`,"warning-muted":`#EFF0BF`}},gr={name:`catppuccin-frappe`,dark:!0,ansi:{black:`#51576D`,red:`#E78284`,green:`#A6D189`,yellow:`#E5C890`,blue:`#8CAAEE`,magenta:`#F4B8E4`,cyan:`#81C8BE`,white:`#B5BFE2`,brightBlack:`#626880`,brightRed:`#EDA0A2`,brightGreen:`#B9DBA2`,brightYellow:`#ECD7AE`,brightBlue:`#ADC2F3`,brightMagenta:`#F38ED8`,brightCyan:`#98D2CA`,brightWhite:`#A5ADCE`},vars:{accent:`#F4B8E4`,"accent-darken-1":`#DEA3CE`,"accent-darken-2":`#C98FBA`,"accent-darken-3":`#B47BA5`,"accent-lighten-1":`#FFCCF9`,"accent-lighten-2":`#FFE2FF`,"accent-lighten-3":`#FFF7FF`,"accent-muted":`#6A5B75`,background:`#303446`,"background-darken-1":`#1F2435`,"background-darken-2":`#101424`,"background-darken-3":`#000016`,"background-lighten-1":`#404457`,"background-lighten-2":`#525669`,"background-lighten-3":`#64687C`,"block-cursor-background":`#CA9EE6`,"block-cursor-blurred-background":`#CA9EE64C`,"block-cursor-blurred-foreground":`#C6D0F5`,"block-cursor-foreground":`#292C3C`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#BABBF1`,"border-blurred":`#838BA7`,"button-color-foreground":`#303446`,"button-foreground":`#C6D0F5`,error:`#E68284`,"error-darken-1":`#D06E71`,"error-darken-2":`#BA5A5E`,"error-darken-3":`#A4474C`,"error-lighten-1":`#FD9697`,"error-lighten-2":`#FFAAAB`,"error-lighten-3":`#FFBFBF`,"error-muted":`#664B58`,"footer-background":`#51576D`,"footer-description-background":`#00000000`,"footer-description-foreground":`#C6D0F5`,"footer-foreground":`#C6D0F5`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#F4B8E4`,foreground:`#C6D0F5`,"foreground-darken-1":`#B1BBDF`,"foreground-darken-2":`#9CA7CA`,"foreground-darken-3":`#8993B5`,"foreground-disabled":`#C6D0F560`,"foreground-lighten-1":`#DBE5FF`,"foreground-lighten-2":`#F0FAFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#C6D0F599`,"input-cursor-background":`#F2D5CF`,"input-cursor-foreground":`#232634`,"input-selection-background":`#949CBB4C`,"link-background":`#00000000`,"link-background-hover":`#CA9EE6`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#CA9EE6`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#CA9EE6`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#CA9EE6`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#C6D0F5`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#C6D0F5`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#C6D0F599`,panel:`#51576D`,"panel-darken-1":`#3F455A`,"panel-darken-2":`#2E3448`,"panel-darken-3":`#1D2437`,"panel-lighten-1":`#63697F`,"panel-lighten-2":`#767B93`,"panel-lighten-3":`#898FA7`,primary:`#CA9EE6`,"primary-background":`#625F76`,"primary-background-darken-1":`#54516A`,"primary-background-darken-2":`#47435E`,"primary-background-darken-3":`#47435E`,"primary-background-lighten-1":`#706D82`,"primary-background-lighten-2":`#7E7B8E`,"primary-background-lighten-3":`#8C899A`,"primary-darken-1":`#B58AD0`,"primary-darken-2":`#A076BB`,"primary-darken-3":`#8C63A7`,"primary-lighten-1":`#DFB2FB`,"primary-lighten-2":`#F4C7FF`,"primary-lighten-3":`#FFDCFF`,"primary-muted":`#5E5376`,scrollbar:`#63547B`,"scrollbar-active":`#CA9EE6`,"scrollbar-background":`#1F2435`,"scrollbar-background-active":`#1F2435`,"scrollbar-background-hover":`#1F2435`,"scrollbar-corner-color":`#1F2435`,"scrollbar-hover":`#74618D`,secondary:`#EE9F76`,"secondary-background":`#666067`,"secondary-background-darken-1":`#59525A`,"secondary-background-darken-2":`#4C444D`,"secondary-background-darken-3":`#4C444D`,"secondary-background-lighten-1":`#746E75`,"secondary-background-lighten-2":`#817C82`,"secondary-background-lighten-3":`#8F8A8F`,"secondary-darken-1":`#D88B63`,"secondary-darken-2":`#C27750`,"secondary-darken-3":`#AC643E`,"secondary-lighten-1":`#FFB389`,"secondary-lighten-2":`#FFC89D`,"secondary-lighten-3":`#FFDDB1`,"secondary-muted":`#695454`,success:`#A6D189`,"success-darken-1":`#91BC75`,"success-darken-2":`#7DA762`,"success-darken-3":`#6A9350`,"success-lighten-1":`#BAE69C`,"success-lighten-2":`#CFFBB1`,"success-lighten-3":`#E5FFC5`,"success-muted":`#53635A`,surface:`#414559`,"surface-active":`#4F5267`,"surface-darken-1":`#303447`,"surface-darken-2":`#1F2436`,"surface-darken-3":`#101526`,"surface-lighten-1":`#52566B`,"surface-lighten-2":`#64687E`,"surface-lighten-3":`#777B91`,text:`#FFFFFFDD`,"text-accent":`#F7D0ED`,"text-disabled":`#FFFFFF60`,"text-error":`#EFACAD`,"text-muted":`#FFFFFF99`,"text-primary":`#DCBEEE`,"text-secondary":`#F4BFA4`,"text-success":`#C4E0B1`,"text-warning":`#EDDAB5`,warning:`#E4C890`,"warning-darken-1":`#CFB37C`,"warning-darken-2":`#BA9F69`,"warning-darken-3":`#A58B56`,"warning-lighten-1":`#FADCA4`,"warning-lighten-2":`#FFF2B8`,"warning-lighten-3":`#FFFFCD`,"warning-muted":`#66605C`}},_r={name:`catppuccin-latte`,dark:!1,ansi:{black:`#BCC0CC`,red:`#D20F39`,green:`#40A02B`,yellow:`#DF8E1D`,blue:`#1E66F5`,magenta:`#EA76CB`,cyan:`#179299`,white:`#5C5F77`,brightBlack:`#ACB0BE`,brightRed:`#E7103F`,brightGreen:`#46B02F`,brightYellow:`#E49931`,brightBlue:`#3878F6`,brightMagenta:`#EF95D7`,brightCyan:`#19A1A8`,brightWhite:`#6C6F85`},vars:{accent:`#FD640B`,"accent-darken-1":`#E54F00`,"accent-darken-2":`#CC3900`,"accent-darken-3":`#B42200`,"accent-lighten-1":`#FF7825`,"accent-lighten-2":`#FF8D3A`,"accent-lighten-3":`#FFA24F`,"accent-muted":`#F3C6AE`,background:`#EFF1F5`,"background-darken-1":`#D9DBDF`,"background-darken-2":`#C4C6CA`,"background-darken-3":`#B0B2B5`,"background-lighten-1":`#FFFFFF`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#8839EF`,"block-cursor-blurred-background":`#8839EF4C`,"block-cursor-blurred-foreground":`#4C4F69`,"block-cursor-foreground":`#000000DD`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#8839EF`,"border-blurred":`#DEE1E7`,"button-color-foreground":`#EFF1F5`,"button-foreground":`#4C4F69`,error:`#D10F39`,"error-darken-1":`#BA0028`,"error-darken-2":`#A20019`,"error-darken-3":`#8A0008`,"error-lighten-1":`#EA324A`,"error-lighten-2":`#FF4B5B`,"error-lighten-3":`#FF626E`,"error-muted":`#E6ADBC`,"footer-background":`#CCD0DA`,"footer-description-background":`#00000000`,"footer-description-foreground":`#4C4F69`,"footer-foreground":`#4C4F69`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FE640B`,foreground:`#4C4F69`,"foreground-darken-1":`#3A3D56`,"foreground-darken-2":`#292D45`,"foreground-darken-3":`#191D34`,"foreground-disabled":`#4C4F6960`,"foreground-lighten-1":`#5E607B`,"foreground-lighten-2":`#70738F`,"foreground-lighten-3":`#8386A2`,"foreground-muted":`#4C4F6999`,"input-cursor-background":`#4C4F69`,"input-cursor-foreground":`#EFF1F5`,"input-selection-background":`#9E4DFF66`,"link-background":`#00000000`,"link-background-hover":`#8839EF`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#8839EF`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#8839EF`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#8839EF`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#4C4F69`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#4C4F69`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#4C4F6999`,panel:`#CCD0DA`,"panel-darken-1":`#B7BBC5`,"panel-darken-2":`#A3A6B0`,"panel-darken-3":`#8F939C`,"panel-lighten-1":`#E1E5EF`,"panel-lighten-2":`#F6FAFF`,"panel-lighten-3":`#FFFFFF`,primary:`#8839EF`,"primary-background":`#8839EF`,"primary-background-darken-1":`#7122D9`,"primary-background-darken-2":`#5901C3`,"primary-background-darken-3":`#4000AE`,"primary-background-lighten-1":`#9E4DFF`,"primary-background-lighten-2":`#B562FF`,"primary-background-lighten-3":`#CC76FF`,"primary-darken-1":`#7122D9`,"primary-darken-2":`#5901C3`,"primary-darken-3":`#4000AE`,"primary-lighten-1":`#9E4DFF`,"primary-lighten-2":`#B562FF`,"primary-lighten-3":`#CC76FF`,"primary-muted":`#D0B9F3`,scrollbar:`#B89AE5`,"scrollbar-active":`#8839EF`,"scrollbar-background":`#D9DBDF`,"scrollbar-background-active":`#D9DBDF`,"scrollbar-background-hover":`#D9DBDF`,"scrollbar-corner-color":`#D9DBDF`,"scrollbar-hover":`#B08AE7`,secondary:`#DB8A78`,"secondary-background":`#DB8A78`,"secondary-background-darken-1":`#C57665`,"secondary-background-darken-2":`#B06353`,"secondary-background-darken-3":`#9A5041`,"secondary-background-lighten-1":`#F29D8B`,"secondary-background-lighten-2":`#FFB29E`,"secondary-background-lighten-3":`#FFC7B3`,"secondary-darken-1":`#C57665`,"secondary-darken-2":`#B06353`,"secondary-darken-3":`#9A5041`,"secondary-lighten-1":`#F29D8B`,"secondary-lighten-2":`#FFB29E`,"secondary-lighten-3":`#FFC7B3`,"secondary-muted":`#E9D2CF`,success:`#40A02B`,"success-darken-1":`#278B14`,"success-darken-2":`#007800`,"success-darken-3":`#006400`,"success-lighten-1":`#56B43F`,"success-lighten-2":`#6BC952`,"success-lighten-3":`#81DE66`,"success-muted":`#BAD8B8`,surface:`#E6E9EF`,"surface-active":`#F7FAFF`,"surface-darken-1":`#D0D3D9`,"surface-darken-2":`#BCBFC4`,"surface-darken-3":`#A7AAB0`,"surface-lighten-1":`#FBFEFF`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#A74207`,"text-disabled":`#00000060`,"text-error":`#8A0925`,"text-muted":`#00000099`,"text-primary":`#59259D`,"text-secondary":`#915B4F`,"text-success":`#2A691C`,"text-warning":`#935D13`,warning:`#DE8E1D`,"warning-darken-1":`#C77A00`,"warning-darken-2":`#B06700`,"warning-darken-3":`#9A5500`,"warning-lighten-1":`#F6A134`,"warning-lighten-2":`#FFB648`,"warning-lighten-3":`#FFCA5D`,"warning-muted":`#EAD3B4`}},vr={name:`catppuccin-macchiato`,dark:!0,ansi:{black:`#494D64`,red:`#ED8796`,green:`#A6DA95`,yellow:`#EED49F`,blue:`#8AADF4`,magenta:`#F5BDE6`,cyan:`#8BD5CA`,white:`#B8C0E0`,brightBlack:`#5B6078`,brightRed:`#F2A7B2`,brightGreen:`#BDE3B0`,brightYellow:`#F4E3C1`,brightBlue:`#ADC5F7`,brightMagenta:`#F493DA`,brightCyan:`#A5DED6`,brightWhite:`#A5ADCB`},vars:{accent:`#F5BDE6`,"accent-darken-1":`#DFA8D0`,"accent-darken-2":`#CA94BC`,"accent-darken-3":`#B580A7`,"accent-lighten-1":`#FFD1FB`,"accent-lighten-2":`#FFE7FF`,"accent-lighten-3":`#FFFCFF`,"accent-muted":`#62546D`,background:`#24273A`,"background-darken-1":`#141729`,"background-darken-2":`#00021A`,"background-darken-3":`#000007`,"background-lighten-1":`#34374B`,"background-lighten-2":`#45485C`,"background-lighten-3":`#57596F`,"block-cursor-background":`#C6A0F6`,"block-cursor-blurred-background":`#C6A0F64C`,"block-cursor-blurred-foreground":`#CAD3F5`,"block-cursor-foreground":`#1E2030`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#B7BDF8`,"border-blurred":`#737994`,"button-color-foreground":`#24273A`,"button-foreground":`#CAD3F5`,error:`#ED8796`,"error-darken-1":`#D67382`,"error-darken-2":`#C05F6F`,"error-darken-3":`#AB4C5D`,"error-lighten-1":`#FF9BA9`,"error-lighten-2":`#FFAFBE`,"error-lighten-3":`#FFC4D3`,"error-muted":`#604355`,"footer-background":`#494D64`,"footer-description-background":`#00000000`,"footer-description-foreground":`#CAD3F5`,"footer-foreground":`#CAD3F5`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#F5BDE6`,foreground:`#CAD3F5`,"foreground-darken-1":`#B5BEDF`,"foreground-darken-2":`#A0A9CA`,"foreground-darken-3":`#8C95B5`,"foreground-disabled":`#CAD3F560`,"foreground-lighten-1":`#DFE8FF`,"foreground-lighten-2":`#F4FDFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#CAD3F599`,"input-cursor-background":`#F4DBD6`,"input-cursor-foreground":`#181926`,"input-selection-background":`#838BA74C`,"link-background":`#00000000`,"link-background-hover":`#C6A0F6`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#C6A0F6`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#C6A0F6`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#C6A0F6`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#CAD3F5`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#CAD3F5`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#CAD3F599`,panel:`#494D64`,"panel-darken-1":`#373B51`,"panel-darken-2":`#262B40`,"panel-darken-3":`#161C2F`,"panel-lighten-1":`#5A5E76`,"panel-lighten-2":`#6D7189`,"panel-lighten-3":`#80849D`,primary:`#C6A0F6`,"primary-background":`#59566F`,"primary-background-darken-1":`#4A4762`,"primary-background-darken-2":`#3C3956`,"primary-background-darken-3":`#3C3956`,"primary-background-lighten-1":`#67657C`,"primary-background-lighten-2":`#767488`,"primary-background-lighten-3":`#858395`,"primary-darken-1":`#B08CE0`,"primary-darken-2":`#9C78CB`,"primary-darken-3":`#8865B6`,"primary-lighten-1":`#DBB4FF`,"primary-lighten-2":`#F1C9FF`,"primary-lighten-3":`#FFDEFF`,"primary-muted":`#544B72`,scrollbar:`#5B4D7B`,"scrollbar-active":`#C6A0F6`,"scrollbar-background":`#141729`,"scrollbar-background-active":`#141729`,"scrollbar-background-hover":`#141729`,"scrollbar-corner-color":`#141729`,"scrollbar-hover":`#6D5B8F`,secondary:`#F4A97F`,"secondary-background":`#5F5760`,"secondary-background-darken-1":`#514852`,"secondary-background-darken-2":`#433A44`,"secondary-background-darken-3":`#433A44`,"secondary-background-lighten-1":`#6D666E`,"secondary-background-lighten-2":`#7B757C`,"secondary-background-lighten-3":`#89838A`,"secondary-darken-1":`#DE946B`,"secondary-darken-2":`#C88159`,"secondary-darken-3":`#B26E47`,"secondary-lighten-1":`#FFBD92`,"secondary-lighten-2":`#FFD2A6`,"secondary-lighten-3":`#FFE7BB`,"secondary-muted":`#624E4E`,success:`#A6DA95`,"success-darken-1":`#91C481`,"success-darken-2":`#7DB06E`,"success-darken-3":`#6A9C5B`,"success-lighten-1":`#BAEFA9`,"success-lighten-2":`#CFFFBD`,"success-lighten-3":`#E5FFD2`,"success-muted":`#4B5C55`,surface:`#363A4F`,"surface-active":`#43475D`,"surface-darken-1":`#25293D`,"surface-darken-2":`#151A2D`,"surface-darken-3":`#03061D`,"surface-lighten-1":`#474B60`,"surface-lighten-2":`#595C73`,"surface-lighten-3":`#6B6F86`,text:`#FFFFFFDD`,"text-accent":`#F8D3EE`,"text-disabled":`#FFFFFF60`,"text-error":`#F3AFB9`,"text-muted":`#FFFFFF99`,"text-primary":`#D9C0F9`,"text-secondary":`#F8C6AA`,"text-success":`#C4E6B9`,"text-warning":`#F3E2BF`,warning:`#EED49F`,"warning-darken-1":`#D8BF8B`,"warning-darken-2":`#C3AA77`,"warning-darken-3":`#AE9664`,"warning-lighten-1":`#FFE9B3`,"warning-lighten-2":`#FFFEC7`,"warning-lighten-3":`#FFFFDD`,"warning-muted":`#605A58`}},yr={name:`catppuccin-mocha`,dark:!0,ansi:{black:`#45475A`,red:`#F38BA8`,green:`#A6E3A1`,yellow:`#F9E2AF`,blue:`#89B4FA`,magenta:`#F5C2E7`,cyan:`#94E2D5`,white:`#BAC2DE`,brightBlack:`#585B70`,brightRed:`#F7AEC2`,brightGreen:`#C2ECBF`,brightYellow:`#FCD682`,brightBlue:`#AECCFC`,brightMagenta:`#F398DA`,brightCyan:`#B1EAE1`,brightWhite:`#A6ADC8`},vars:{accent:`#F9B387`,"accent-darken-1":`#E39E73`,"accent-darken-2":`#CD8A60`,"accent-darken-3":`#B7774E`,"accent-lighten-1":`#FFC79A`,"accent-lighten-2":`#FFDCAE`,"accent-lighten-3":`#FFF2C3`,"accent-muted":`#5B4642`,background:`#181825`,"background-darken-1":`#040216`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#272735`,"background-lighten-2":`#373746`,"background-lighten-3":`#484857`,"block-cursor-background":`#F5C2E7`,"block-cursor-blurred-background":`#F5C2E74C`,"block-cursor-blurred-foreground":`#CDD6F4`,"block-cursor-foreground":`#1E1E2E`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#B4BEFE`,"border-blurred":`#585B70`,"button-color-foreground":`#181825`,"button-foreground":`#CDD6F4`,error:`#F28FAD`,"error-darken-1":`#DB7A99`,"error-darken-2":`#C66785`,"error-darken-3":`#B05372`,"error-lighten-1":`#FFA3C1`,"error-lighten-2":`#FFB8D6`,"error-lighten-3":`#FFCDEB`,"error-muted":`#593B4D`,"footer-background":`#45475A`,"footer-description-background":`#00000000`,"footer-description-foreground":`#CDD6F4`,"footer-foreground":`#CDD6F4`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FAB387`,foreground:`#CDD6F4`,"foreground-darken-1":`#B8C1DE`,"foreground-darken-2":`#A3ACC9`,"foreground-darken-3":`#8F98B4`,"foreground-disabled":`#CDD6F460`,"foreground-lighten-1":`#E2EBFF`,"foreground-lighten-2":`#F7FFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#CDD6F499`,"input-cursor-background":`#F5E0DC`,"input-cursor-foreground":`#11111B`,"input-selection-background":`#9399B24C`,"link-background":`#00000000`,"link-background-hover":`#F5C2E7`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#F5C2E7`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#F5C2E7`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#F5C2E7`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#CDD6F4`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#CDD6F4`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#CDD6F499`,panel:`#45475A`,"panel-darken-1":`#333648`,"panel-darken-2":`#232637`,"panel-darken-3":`#131627`,"panel-lighten-1":`#56586C`,"panel-lighten-2":`#696A7F`,"panel-lighten-3":`#7B7D92`,primary:`#F5C2E7`,"primary-background":`#564F5E`,"primary-background-darken-1":`#474050`,"primary-background-darken-2":`#393142`,"primary-background-darken-3":`#393142`,"primary-background-lighten-1":`#655F6C`,"primary-background-lighten-2":`#746E7A`,"primary-background-lighten-3":`#837E88`,"primary-darken-1":`#DFADD1`,"primary-darken-2":`#CA99BD`,"primary-darken-3":`#B585A8`,"primary-lighten-1":`#FFD6FC`,"primary-lighten-2":`#FFECFF`,"primary-lighten-3":`#FFFFFF`,"primary-muted":`#5A4B5F`,scrollbar:`#644E69`,"scrollbar-active":`#F5C2E7`,"scrollbar-background":`#040216`,"scrollbar-background-active":`#040216`,"scrollbar-background-hover":`#040216`,"scrollbar-corner-color":`#040216`,"scrollbar-hover":`#7C627E`,secondary:`#CBA6F7`,"secondary-background":`#504C60`,"secondary-background-darken-1":`#413C52`,"secondary-background-darken-2":`#322D44`,"secondary-background-darken-3":`#322D44`,"secondary-background-lighten-1":`#605C6E`,"secondary-background-lighten-2":`#6F6C7C`,"secondary-background-lighten-3":`#7E7B8A`,"secondary-darken-1":`#B592E1`,"secondary-darken-2":`#A17ECC`,"secondary-darken-3":`#8C6BB7`,"secondary-lighten-1":`#E0BAFF`,"secondary-lighten-2":`#F6CFFF`,"secondary-lighten-3":`#FFE4FF`,"secondary-muted":`#4D4264`,success:`#ABE9B3`,"success-darken-1":`#96D39E`,"success-darken-2":`#82BE8B`,"success-darken-3":`#6EAA77`,"success-lighten-1":`#BFFEC7`,"success-lighten-2":`#D5FFDC`,"success-lighten-3":`#EAFFF2`,"success-muted":`#44564F`,surface:`#313244`,"surface-active":`#3E3F51`,"surface-darken-1":`#202233`,"surface-darken-2":`#111223`,"surface-darken-3":`#000014`,"surface-lighten-1":`#414255`,"surface-lighten-2":`#535467`,"surface-lighten-3":`#65667A`,text:`#FFFFFFDD`,"text-accent":`#FBCCAF`,"text-disabled":`#FFFFFF60`,"text-error":`#F6B5C8`,"text-muted":`#FFFFFF99`,"text-primary":`#F8D6EF`,"text-secondary":`#DCC4F9`,"text-success":`#C7F0CC`,"text-warning":`#FBECCA`,warning:`#FAE3B0`,"warning-darken-1":`#E4CD9B`,"warning-darken-2":`#CEB988`,"warning-darken-3":`#B9A574`,"warning-lighten-1":`#FFF8C4`,"warning-lighten-2":`#FFFFD9`,"warning-lighten-3":`#FFFFEF`,"warning-muted":`#5B544E`}},br=Object.fromEntries([`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`].map((e,t)=>[e,Mn.get(t).hex])),xr={black:`#1A1A1A`,red:`#F4005F`,green:`#98E024`,yellow:`#FD971F`,blue:`#9D65FF`,magenta:`#F4005F`,cyan:`#58D1EB`,white:`#C4C5B5`,brightBlack:`#625E4C`,brightRed:`#F4005F`,brightGreen:`#98E024`,brightYellow:`#E0D561`,brightBlue:`#9D65FF`,brightMagenta:`#F4005F`,brightCyan:`#58D1EB`,brightWhite:`#F6F6EF`},Sr={"atom-one-dark":mr,"atom-one-light":hr,"catppuccin-frappe":gr,"catppuccin-latte":_r,"catppuccin-macchiato":vr,"catppuccin-mocha":yr,cyberpunk:{name:`cyberpunk`,dark:!0,ansi:xr,vars:{background:`#070714`,"background-darken-1":`#03030A`,"background-darken-2":`#000003`,"background-darken-3":`#000000`,"background-lighten-1":`#11111E`,"background-lighten-2":`#1A1A2B`,"background-lighten-3":`#25253A`,foreground:`#E2E2FF`,"foreground-darken-1":`#CACAE4`,"foreground-darken-2":`#B3B3CC`,"foreground-darken-3":`#9C9CB5`,"foreground-disabled":`#E2E2FF60`,"foreground-lighten-1":`#EEEEFF`,"foreground-lighten-2":`#F6F6FF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#E2E2FF99`,primary:`#00E5FFD9`,"primary-darken-1":`#00CCE6D9`,"primary-darken-2":`#00B2CCD9`,"primary-darken-3":`#0099B3D9`,"primary-lighten-1":`#1AF0FFD9`,"primary-lighten-2":`#33F5FFD9`,"primary-lighten-3":`#4DFAFFD9`,"primary-muted":`#054A5BF4`,"primary-background":`#0A3340`,"primary-background-darken-1":`#072833`,"primary-background-darken-2":`#051E27`,"primary-background-darken-3":`#051E27`,"primary-background-lighten-1":`#0F404F`,"primary-background-lighten-2":`#154E5F`,"primary-background-lighten-3":`#1A5C6F`,secondary:`#FF1E8ECC`,"secondary-darken-1":`#E60A76CC`,"secondary-darken-2":`#CC005FCC`,"secondary-darken-3":`#B20048CC`,"secondary-lighten-1":`#FF3CA2CC`,"secondary-lighten-2":`#FF5AB6CC`,"secondary-lighten-3":`#FF78CACC`,"secondary-muted":`#510E39EF`,"secondary-background":`#3A0A28`,"secondary-background-darken-1":`#2E071F`,"secondary-background-darken-2":`#220517`,"secondary-background-darken-3":`#220517`,"secondary-background-lighten-1":`#470D33`,"secondary-background-lighten-2":`#54103F`,"secondary-background-lighten-3":`#61134B`,accent:`#EEFF00CC`,"accent-darken-1":`#D6E600CC`,"accent-darken-2":`#BECC00CC`,"accent-darken-3":`#A5B200CC`,"accent-lighten-1":`#FFFF26CC`,"accent-lighten-2":`#FFFF4DCC`,"accent-lighten-3":`#FFFF73CC`,"accent-muted":`#4C510EEF`,success:`#39FF14BF`,"success-darken-1":`#23E60ABF`,"success-darken-2":`#0FCC00BF`,"success-darken-3":`#00B200BF`,"success-lighten-1":`#4DFF32BF`,"success-lighten-2":`#69FF5ABF`,"success-lighten-3":`#87FF82BF`,"success-muted":`#164D14F0`,warning:`#FF6E00CC`,"warning-darken-1":`#E65800CC`,"warning-darken-2":`#CC4300CC`,"warning-darken-3":`#B23000CC`,"warning-lighten-1":`#FF8C26CC`,"warning-lighten-2":`#FFA54DCC`,"warning-lighten-3":`#FFBE73CC`,"warning-muted":`#51260EEF`,error:`#FF1133BF`,"error-darken-1":`#E6051EBF`,"error-darken-2":`#CC000CBF`,"error-darken-3":`#B20000BF`,"error-lighten-1":`#FF3758BF`,"error-lighten-2":`#FF5A78BF`,"error-lighten-3":`#FF7D96BF`,"error-muted":`#510A1DF0`,surface:`#0F0F22`,"surface-active":`#161630`,"surface-darken-1":`#08081A`,"surface-darken-2":`#040411`,"surface-darken-3":`#020209`,"surface-lighten-1":`#17172E`,"surface-lighten-2":`#1F1F3C`,"surface-lighten-3":`#28284A`,panel:`#0C0C1E`,"panel-darken-1":`#060614`,"panel-darken-2":`#03030C`,"panel-darken-3":`#010108`,"panel-lighten-1":`#14142C`,"panel-lighten-2":`#1C1C3A`,"panel-lighten-3":`#242448`,scrollbar:`#151535`,"scrollbar-active":`#00E5FFD9`,"scrollbar-background":`#040412`,"scrollbar-background-active":`#040412`,"scrollbar-background-hover":`#040412`,"scrollbar-corner-color":`#040412`,"scrollbar-hover":`#1F1F48`,"block-cursor-background":`#00E5FF`,"block-cursor-blurred-background":`#00E5FF4C`,"block-cursor-blurred-foreground":`#E2E2FF`,"block-cursor-foreground":`#070714`,"block-hover-background":`#00E5FF19`,boost:`#00E5FF0A`,"boost-darken-1":`#00CCE60A`,"boost-darken-2":`#00B2CC0A`,"boost-darken-3":`#0099B30A`,"boost-lighten-1":`#00E5FF0A`,"boost-lighten-2":`#00E5FF0A`,"boost-lighten-3":`#00E5FF0A`,border:`#00E5FFD9`,"border-blurred":`#1A1A35`,"button-color-foreground":`#070714`,"button-foreground":`#E2E2FF`,"footer-background":`#0C0C1E`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E2E2FF`,"footer-foreground":`#E2E2FF`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#00E5FFD9`,"input-cursor-background":`#E2E2FF`,"input-cursor-foreground":`#070714`,"input-selection-background":`#00E5FF40`,"link-background":`#00000000`,"link-background-hover":`#00E5FFD9`,"link-color":`#E2E2FFDD`,"link-color-hover":`#070714`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#00E5FFD9`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#00E5FFD9`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#FF1E8ECC`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E2E2FF`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E2E2FF`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#E2E2FF99`,text:`#E2E2FFDD`,"text-accent":`#F4FF66CC`,"text-disabled":`#E2E2FF60`,"text-error":`#FF6677BF`,"text-muted":`#E2E2FF99`,"text-primary":`#66F0FFD9`,"text-secondary":`#FF80B0CC`,"text-success":`#80FF55BF`,"text-warning":`#FFB055CC`}},default:{name:`default`,dark:!0,ansi:br,vars:{accent:`#006FB8`,"accent-darken-1":`#005CA3`,"accent-darken-2":`#004B8F`,"accent-darken-3":`#003A7B`,"accent-lighten-1":`#3081CC`,"accent-lighten-2":`#4C95E2`,"accent-lighten-3":`#64A8F7`,"accent-muted":`#002137`,background:`#000000`,"background-darken-1":`#000000`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#161616`,"background-lighten-2":`#252525`,"background-lighten-3":`#353535`,"block-cursor-background":`#006FB8`,"block-cursor-blurred-background":`#006FB84C`,"block-cursor-blurred-foreground":`#FFFFFF`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#006FB8`,"border-blurred":`#191919`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#FFFFFF`,error:`#7F0000`,"error-darken-1":`#6A0000`,"error-darken-2":`#560000`,"error-darken-3":`#450000`,"error-lighten-1":`#961E12`,"error-lighten-2":`#AD3423`,"error-lighten-3":`#C44934`,"error-muted":`#260000`,"footer-background":`#242E35`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FFFFFF`,"footer-foreground":`#FFFFFF`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#006FB8`,foreground:`#FFFFFF`,"foreground-darken-1":`#E9E9E9`,"foreground-darken-2":`#D4D4D4`,"foreground-darken-3":`#BFBFBF`,"foreground-disabled":`#FFFFFF60`,"foreground-lighten-1":`#FFFFFF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#FFFFFF99`,"input-cursor-background":`#FFFFFF`,"input-cursor-foreground":`#000000`,"input-selection-background":`#3081CC66`,"link-background":`#00000000`,"link-background-hover":`#006FB8`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#006FB8`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#006FB8`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#006FB8`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#FFFFFF`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#FFFFFF`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#FFFFFF99`,panel:`#242E35`,"panel-darken-1":`#141E24`,"panel-darken-2":`#000D15`,"panel-darken-3":`#000000`,"panel-lighten-1":`#343E45`,"panel-lighten-2":`#454F57`,"panel-lighten-3":`#566169`,primary:`#006FB8`,"primary-background":`#26333D`,"primary-background-darken-1":`#13212C`,"primary-background-darken-2":`#00101B`,"primary-background-darken-3":`#00101B`,"primary-background-lighten-1":`#39454E`,"primary-background-lighten-2":`#4C575F`,"primary-background-lighten-3":`#5F6970`,"primary-darken-1":`#005CA3`,"primary-darken-2":`#004B8F`,"primary-darken-3":`#003A7B`,"primary-lighten-1":`#3081CC`,"primary-lighten-2":`#4C95E2`,"primary-lighten-3":`#64A8F7`,"primary-muted":`#002137`,scrollbar:`#002C49`,"scrollbar-active":`#006FB8`,"scrollbar-background":`#000000`,"scrollbar-background-active":`#000000`,"scrollbar-background-hover":`#000000`,"scrollbar-corner-color":`#000000`,"scrollbar-hover":`#00375C`,secondary:`#762671`,"secondary-background":`#342A33`,"secondary-background-darken-1":`#221721`,"secondary-background-darken-2":`#110510`,"secondary-background-darken-3":`#110510`,"secondary-background-lighten-1":`#463D45`,"secondary-background-lighten-2":`#585057`,"secondary-background-lighten-3":`#6A6269`,"secondary-darken-1":`#620F5E`,"secondary-darken-2":`#4E004C`,"secondary-darken-3":`#3B003A`,"secondary-lighten-1":`#8A3984`,"secondary-lighten-2":`#9E4C97`,"secondary-lighten-3":`#B360AB`,"secondary-muted":`#230B21`,success:`#008000`,"success-darken-1":`#006C00`,"success-darken-2":`#005900`,"success-darken-3":`#004600`,"success-lighten-1":`#29931C`,"success-lighten-2":`#42A832`,"success-lighten-3":`#58BD46`,"success-muted":`#002600`,surface:`#1E1E1E`,"surface-active":`#2A2A2A`,"surface-darken-1":`#0D0D0D`,"surface-darken-2":`#000000`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2D2D2D`,"surface-lighten-2":`#3E3E3E`,"surface-lighten-3":`#4F4F4F`,text:`#FFFFFFDD`,"text-accent":`#569FD0`,"text-disabled":`#FFFFFF60`,"text-error":`#AB5656`,"text-muted":`#FFFFFF99`,"text-primary":`#569FD0`,"text-secondary":`#A46FA1`,"text-success":`#56AB56`,"text-warning":`#ABAB56`,warning:`#7F8000`,"warning-darken-1":`#6B6D00`,"warning-darken-2":`#575A00`,"warning-darken-3":`#454900`,"warning-lighten-1":`#94931E`,"warning-lighten-2":`#A9A734`,"warning-lighten-3":`#BFBB48`,"warning-muted":`#262600`}},dracula:{name:`dracula`,dark:!0,ansi:{black:`#21222C`,red:`#FF5555`,green:`#50FA7B`,yellow:`#F1FA8C`,blue:`#BD93F9`,magenta:`#FF79C6`,cyan:`#8BE9FD`,white:`#F8F8F2`,brightBlack:`#6272A4`,brightRed:`#FF6E6E`,brightGreen:`#69FF94`,brightYellow:`#FFFFA5`,brightBlue:`#D6ACFF`,brightMagenta:`#FF92DF`,brightCyan:`#A4FFFF`,brightWhite:`#FFFFFF`},vars:{accent:`#FF79C6`,"accent-darken-1":`#E864B1`,"accent-darken-2":`#D24F9D`,"accent-darken-3":`#BC3989`,"accent-lighten-1":`#FF8DDA`,"accent-lighten-2":`#FFA3F0`,"accent-lighten-3":`#FFB8FF`,"accent-muted":`#684161`,background:`#282A36`,"background-darken-1":`#181A25`,"background-darken-2":`#050716`,"background-darken-3":`#000000`,"background-lighten-1":`#383A46`,"background-lighten-2":`#494B58`,"background-lighten-3":`#5B5D6A`,"block-cursor-background":`#BD93F9`,"block-cursor-blurred-background":`#BD93F94C`,"block-cursor-blurred-foreground":`#F8F8F2`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#BD93F9`,"border-blurred":`#252835`,"button-color-foreground":`#282A36`,"button-foreground":`#F8F8F2`,error:`#FE5555`,"error-darken-1":`#E63E43`,"error-darken-2":`#CE2332`,"error-darken-3":`#B70022`,"error-lighten-1":`#FF6A67`,"error-lighten-2":`#FF807A`,"error-lighten-3":`#FF958D`,"error-muted":`#68363F`,"footer-background":`#313442`,"footer-description-background":`#00000000`,"footer-description-foreground":`#F8F8F2`,"footer-foreground":`#F8F8F2`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FF79C6`,foreground:`#F8F8F2`,"foreground-darken-1":`#E2E2DC`,"foreground-darken-2":`#CDCDC7`,"foreground-darken-3":`#B8B8B3`,"foreground-disabled":`#F8F8F260`,"foreground-lighten-1":`#FFFFFF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#F8F8F299`,"input-cursor-background":`#F8F8F2`,"input-cursor-foreground":`#282A36`,"input-selection-background":`#D2A7FF66`,"link-background":`#00000000`,"link-background-hover":`#BD93F9`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#BD93F9`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#BD93F9`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#BD93F9`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#F8F8F2`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#F8F8F2`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#F8F8F299`,panel:`#313442`,"panel-darken-1":`#202431`,"panel-darken-2":`#111421`,"panel-darken-3":`#000012`,"panel-lighten-1":`#414453`,"panel-lighten-2":`#535665`,"panel-lighten-3":`#656878`,primary:`#BD93F9`,"primary-background":`#5A566C`,"primary-background-darken-1":`#4C475F`,"primary-background-darken-2":`#3E3953`,"primary-background-darken-3":`#3E3953`,"primary-background-lighten-1":`#696579`,"primary-background-lighten-2":`#777486`,"primary-background-lighten-3":`#868393`,"primary-darken-1":`#A77FE3`,"primary-darken-2":`#936CCE`,"primary-darken-3":`#7E59B9`,"primary-lighten-1":`#D2A7FF`,"primary-lighten-2":`#E8BBFF`,"primary-lighten-3":`#FED0FF`,"primary-muted":`#544970`,scrollbar:`#5A4A79`,"scrollbar-active":`#BD93F9`,"scrollbar-background":`#181A25`,"scrollbar-background-active":`#181A25`,"scrollbar-background-hover":`#181A25`,"scrollbar-corner-color":`#181A25`,"scrollbar-hover":`#6A568F`,secondary:`#6272A4`,"secondary-background":`#4F5261`,"secondary-background-darken-1":`#3F4353`,"secondary-background-darken-2":`#303446`,"secondary-background-darken-3":`#303446`,"secondary-background-lighten-1":`#5E616F`,"secondary-background-lighten-2":`#6E707D`,"secondary-background-lighten-3":`#7D808B`,"secondary-darken-1":`#4E5F90`,"secondary-darken-2":`#3B4D7C`,"secondary-darken-3":`#283C69`,"secondary-lighten-1":`#7584B8`,"secondary-lighten-2":`#8998CD`,"secondary-lighten-3":`#9DACE2`,"secondary-muted":`#393F57`,success:`#50FA7B`,"success-darken-1":`#2FE467`,"success-darken-2":`#00CE53`,"success-darken-3":`#00B83F`,"success-lighten-1":`#6AFF8F`,"success-lighten-2":`#83FFA3`,"success-lighten-3":`#9BFFB8`,"success-muted":`#34684A`,surface:`#2B2E3B`,"surface-active":`#383B48`,"surface-darken-1":`#1B1E2A`,"surface-darken-2":`#0A0D1B`,"surface-darken-3":`#000009`,"surface-lighten-1":`#3B3E4C`,"surface-lighten-2":`#4C4F5D`,"surface-lighten-3":`#5E6170`,text:`#FFFFFFDD`,"text-accent":`#FFA6D9`,"text-disabled":`#FFFFFF60`,"text-error":`#FF8E8E`,"text-muted":`#FFFFFF99`,"text-primary":`#D3B7FB`,"text-secondary":`#97A1C2`,"text-success":`#8BFBA7`,"text-warning":`#FFD09D`,warning:`#FEB86C`,"warning-darken-1":`#E8A358`,"warning-darken-2":`#D18F45`,"warning-darken-3":`#BB7C33`,"warning-lighten-1":`#FFCC7F`,"warning-lighten-2":`#FFE193`,"warning-lighten-3":`#FFF7A7`,"warning-muted":`#685446`}},flexoki:{name:`flexoki`,dark:!0,ansi:{black:`#100F0F`,red:`#D14D41`,green:`#879A39`,yellow:`#D0A215`,blue:`#4385BE`,magenta:`#CE5D97`,cyan:`#3AA99F`,white:`#878580`,brightBlack:`#575653`,brightRed:`#AF3029`,brightGreen:`#66800B`,brightYellow:`#AD8301`,brightBlue:`#205EA6`,brightMagenta:`#A02F6F`,brightCyan:`#24837B`,brightWhite:`#CECDC3`},vars:{accent:`#9B76C8`,"accent-darken-1":`#8663B3`,"accent-darken-2":`#72509E`,"accent-darken-3":`#5F3E8B`,"accent-lighten-1":`#AF89DD`,"accent-lighten-2":`#C49DF2`,"accent-lighten-3":`#D9B1FF`,"accent-muted":`#392D46`,background:`#100F0F`,"background-darken-1":`#000000`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#1F1F1F`,"background-lighten-2":`#2F2E2E`,"background-lighten-3":`#403F3F`,"block-cursor-background":`#205EA6`,"block-cursor-blurred-background":`#205EA64C`,"block-cursor-blurred-foreground":`#FFFCF0`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#205EA6`,"border-blurred":`#171614`,"button-color-foreground":`#FFFCF0`,"button-foreground":`#FFFCF0`,error:`#AE3029`,"error-darken-1":`#981818`,"error-darken-2":`#810007`,"error-darken-3":`#6B0000`,"error-lighten-1":`#C64539`,"error-lighten-2":`#DD594B`,"error-lighten-3":`#F46D5D`,"error-muted":`#3F1816`,"footer-background":`#282726`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FFFCF0`,"footer-foreground":`#FFFCF0`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#9B76C8`,foreground:`#FFFCF0`,"foreground-darken-1":`#E9E6DA`,"foreground-darken-2":`#D4D1C5`,"foreground-darken-3":`#BFBCB1`,"foreground-disabled":`#FFFCF060`,"foreground-lighten-1":`#FFFFFF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#FFFCF099`,"input-cursor-background":`#FFFCF0`,"input-cursor-foreground":`#5E409D`,"input-selection-background":`#6F6E6959`,"link-background":`#00000000`,"link-background-hover":`#205EA6`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#205EA6`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#205EA6`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#205EA6`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#FFFCF0`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#FFFCF0`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#FFFCF099`,panel:`#282726`,"panel-darken-1":`#181716`,"panel-darken-2":`#040200`,"panel-darken-3":`#000000`,"panel-lighten-1":`#383736`,"panel-lighten-2":`#494846`,"panel-lighten-3":`#5A5958`,primary:`#205EA6`,"primary-background":`#353C45`,"primary-background-darken-1":`#232B35`,"primary-background-darken-2":`#121A25`,"primary-background-darken-3":`#121A25`,"primary-background-lighten-1":`#474D56`,"primary-background-lighten-2":`#595E66`,"primary-background-lighten-3":`#6A6F76`,"primary-darken-1":`#004C91`,"primary-darken-2":`#003B7E`,"primary-darken-3":`#002B6B`,"primary-lighten-1":`#3C70BA`,"primary-lighten-2":`#5383CF`,"primary-lighten-3":`#6996E4`,"primary-muted":`#14263C`,scrollbar:`#0C2542`,"scrollbar-active":`#205EA6`,"scrollbar-background":`#000000`,"scrollbar-background-active":`#000000`,"scrollbar-background-hover":`#000000`,"scrollbar-corner-color":`#000000`,"scrollbar-hover":`#102F53`,secondary:`#24837B`,"secondary-background":`#364140`,"secondary-background-darken-1":`#24302F`,"secondary-background-darken-2":`#13201F`,"secondary-background-darken-3":`#13201F`,"secondary-background-lighten-1":`#485251`,"secondary-background-lighten-2":`#596262`,"secondary-background-lighten-3":`#6B7373`,"secondary-darken-1":`#006F68`,"secondary-darken-2":`#005D56`,"secondary-darken-3":`#004A44`,"secondary-lighten-1":`#3C968E`,"secondary-lighten-2":`#52AAA1`,"secondary-lighten-3":`#67BFB6`,"secondary-muted":`#16312F`,success:`#65800B`,"success-darken-1":`#526D00`,"success-darken-2":`#3E5A00`,"success-darken-3":`#2D4800`,"success-lighten-1":`#7A9324`,"success-lighten-2":`#8EA738`,"success-lighten-3":`#A3BB4C`,"success-muted":`#29300D`,surface:`#1C1B1A`,"surface-active":`#282726`,"surface-darken-1":`#0A0806`,"surface-darken-2":`#000000`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2B2A29`,"surface-lighten-2":`#3B3A39`,"surface-lighten-3":`#4D4B4A`,text:`#FFFFFFDD`,"text-accent":`#BDA4DA`,"text-disabled":`#FFFFFF60`,"text-error":`#CA7671`,"text-muted":`#FFFFFF99`,"text-primary":`#6B94C4`,"text-secondary":`#6EADA7`,"text-success":`#9AAB5D`,"text-warning":`#C8AD57`,warning:`#AC8301`,"warning-darken-1":`#977000`,"warning-darken-2":`#815D00`,"warning-darken-3":`#6C4C00`,"warning-lighten-1":`#C39621`,"warning-lighten-2":`#D9AA37`,"warning-lighten-3":`#F0BE4B`,"warning-muted":`#3F310A`}},gruvbox:{name:`gruvbox`,dark:!0,ansi:{black:`#282828`,red:`#CC241D`,green:`#98971A`,yellow:`#D79921`,blue:`#458588`,magenta:`#B16286`,cyan:`#689D6A`,white:`#A89984`,brightBlack:`#928374`,brightRed:`#FB4934`,brightGreen:`#B8BB26`,brightYellow:`#FABD2F`,brightBlue:`#83A598`,brightMagenta:`#D3869B`,brightCyan:`#8EC07C`,brightWhite:`#EBDBB2`},vars:{accent:`#F9BD2F`,"accent-darken-1":`#E2A811`,"accent-darken-2":`#CB9400`,"accent-darken-3":`#B48100`,"accent-lighten-1":`#FFD146`,"accent-lighten-2":`#FFE65B`,"accent-lighten-3":`#FFFC70`,"accent-muted":`#67542A`,background:`#282828`,"background-darken-1":`#181818`,"background-darken-2":`#040404`,"background-darken-3":`#000000`,"background-lighten-1":`#383838`,"background-lighten-2":`#494949`,"background-lighten-3":`#5A5A5A`,"block-cursor-background":`#85A598`,"block-cursor-blurred-background":`#85A5984C`,"block-cursor-blurred-foreground":`#FBF1C7`,"block-cursor-foreground":`#FBF1C7`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#85A598`,"border-blurred":`#363230`,"button-color-foreground":`#282828`,"button-foreground":`#FBF1C7`,error:`#FA4934`,"error-darken-1":`#E23022`,"error-darken-2":`#C90D10`,"error-darken-3":`#B10000`,"error-lighten-1":`#FF5F45`,"error-lighten-2":`#FF7558`,"error-lighten-3":`#FF8B6B`,"error-muted":`#67312B`,"footer-background":`#504945`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FBF1C7`,"footer-foreground":`#FBF1C7`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FABD2F`,foreground:`#FBF1C7`,"foreground-darken-1":`#E5DBB2`,"foreground-darken-2":`#D0C69E`,"foreground-darken-3":`#BBB28A`,"foreground-disabled":`#FBF1C760`,"foreground-lighten-1":`#FFFFDC`,"foreground-lighten-2":`#FFFFF1`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#FBF1C799`,"input-cursor-background":`#FBF1C7`,"input-cursor-foreground":`#282828`,"input-selection-background":`#689D6A40`,"link-background":`#00000000`,"link-background-hover":`#85A598`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#85A598`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#85A598`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#85A598`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#FBF1C7`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#FBF1C7`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#FBF1C799`,panel:`#504945`,"panel-darken-1":`#3E3834`,"panel-darken-2":`#2E2724`,"panel-darken-3":`#1E1815`,"panel-lighten-1":`#615A56`,"panel-lighten-2":`#746C68`,"panel-lighten-3":`#877F7B`,primary:`#85A598`,"primary-background":`#535755`,"primary-background-darken-1":`#444846`,"primary-background-darken-2":`#353A38`,"primary-background-darken-3":`#353A38`,"primary-background-lighten-1":`#626664`,"primary-background-lighten-2":`#717573`,"primary-background-lighten-3":`#808382`,"primary-darken-1":`#719184`,"primary-darken-2":`#5F7D71`,"primary-darken-3":`#4C6A5F`,"primary-lighten-1":`#98B9AB`,"primary-lighten-2":`#ACCEC0`,"primary-lighten-3":`#C1E3D5`,"primary-muted":`#434D49`,scrollbar:`#43504B`,"scrollbar-active":`#85A598`,"scrollbar-background":`#181818`,"scrollbar-background-active":`#181818`,"scrollbar-background-hover":`#181818`,"scrollbar-corner-color":`#181818`,"scrollbar-hover":`#4E5E58`,secondary:`#A89A85`,"secondary-background":`#585653`,"secondary-background-darken-1":`#494744`,"secondary-background-darken-2":`#3B3935`,"secondary-background-darken-3":`#3B3935`,"secondary-background-lighten-1":`#676562`,"secondary-background-lighten-2":`#757471`,"secondary-background-lighten-3":`#848380`,"secondary-darken-1":`#938671`,"secondary-darken-2":`#80735F`,"secondary-darken-3":`#6D604D`,"secondary-lighten-1":`#BCAE98`,"secondary-lighten-2":`#D1C2AC`,"secondary-lighten-3":`#E6D7C1`,"secondary-muted":`#4E4A43`,success:`#B7BB26`,"success-darken-1":`#A2A601`,"success-darken-2":`#8C9300`,"success-darken-3":`#777F00`,"success-lighten-1":`#CDCF3D`,"success-lighten-2":`#E4E453`,"success-lighten-3":`#FAFA68`,"success-muted":`#535427`,surface:`#3C3836`,"surface-active":`#494543`,"surface-darken-1":`#2B2725`,"surface-darken-2":`#1C1816`,"surface-darken-3":`#0A0300`,"surface-lighten-1":`#4D4846`,"surface-lighten-2":`#5F5A58`,"surface-lighten-3":`#716C6A`,text:`#FFFFFFDD`,"text-accent":`#FBD375`,"text-disabled":`#FFFFFF60`,"text-error":`#FC8679`,"text-muted":`#FFFFFF99`,"text-primary":`#AEC3BB`,"text-secondary":`#C5BCAE`,"text-success":`#D0D26F`,"text-warning":`#FEAB67`,warning:`#FD8019`,"warning-darken-1":`#E56C00`,"warning-darken-2":`#CD5800`,"warning-darken-3":`#B54500`,"warning-lighten-1":`#FF9430`,"warning-lighten-2":`#FFA845`,"warning-lighten-3":`#FFBD5A`,"warning-muted":`#684223`}},monokai:{name:`monokai`,dark:!0,ansi:{black:`#333333`,red:`#C4265E`,green:`#86B42B`,yellow:`#B3B42B`,blue:`#6A7EC8`,magenta:`#8C6BC8`,cyan:`#56ADBC`,white:`#E3E3DD`,brightBlack:`#666666`,brightRed:`#F92672`,brightGreen:`#A6E22E`,brightYellow:`#E2E22E`,brightBlue:`#819AFF`,brightMagenta:`#AE81FF`,brightCyan:`#66D9EF`,brightWhite:`#F8F8F2`},vars:{accent:`#66D9EF`,"accent-darken-1":`#4DC3D9`,"accent-darken-2":`#31AFC4`,"accent-darken-3":`#009BB0`,"accent-lighten-1":`#7DEEFF`,"accent-lighten-2":`#94FFFF`,"accent-lighten-3":`#AAFFFF`,"accent-muted":`#395D5F`,background:`#272822`,"background-darken-1":`#171812`,"background-darken-2":`#020400`,"background-darken-3":`#000000`,"background-lighten-1":`#373831`,"background-lighten-2":`#484942`,"background-lighten-3":`#595A54`,"block-cursor-background":`#AE81FF`,"block-cursor-blurred-background":`#AE81FF4C`,"block-cursor-blurred-foreground":`#D6D6D6`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#AE81FF`,"border-blurred":`#282828`,"button-color-foreground":`#272822`,"button-foreground":`#D6D6D6`,error:`#F82672`,"error-darken-1":`#E1005F`,"error-darken-2":`#C9004E`,"error-darken-3":`#B1003D`,"error-lighten-1":`#FF4484`,"error-lighten-2":`#FF5D98`,"error-lighten-3":`#FF75AC`,"error-muted":`#66273A`,"footer-background":`#3E3D32`,"footer-description-background":`#00000000`,"footer-description-foreground":`#D6D6D6`,"footer-foreground":`#D6D6D6`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#66D9EF`,foreground:`#D6D6D6`,"foreground-darken-1":`#C1C1C1`,"foreground-darken-2":`#ACACAC`,"foreground-darken-3":`#989898`,"foreground-disabled":`#D6D6D660`,"foreground-lighten-1":`#EBEBEB`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#797979`,"input-cursor-background":`#D6D6D6`,"input-cursor-foreground":`#272822`,"input-selection-background":`#575B6190`,"link-background":`#00000000`,"link-background-hover":`#AE81FF`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#AE81FF`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#AE81FF`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#AE81FF`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#D6D6D6`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#D6D6D6`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#797979`,panel:`#3E3D32`,"panel-darken-1":`#2D2C22`,"panel-darken-2":`#1D1C12`,"panel-darken-3":`#0D0B00`,"panel-lighten-1":`#4F4E42`,"panel-lighten-2":`#616054`,"panel-lighten-3":`#737266`,primary:`#AE81FF`,"primary-background":`#58535F`,"primary-background-darken-1":`#494451`,"primary-background-darken-2":`#3B3543`,"primary-background-darken-3":`#3B3543`,"primary-background-lighten-1":`#67626D`,"primary-background-lighten-2":`#75717B`,"primary-background-lighten-3":`#848089`,"primary-darken-1":`#986DE9`,"primary-darken-2":`#835AD3`,"primary-darken-3":`#6E48BE`,"primary-lighten-1":`#C394FF`,"primary-lighten-2":`#D9A9FF`,"primary-lighten-3":`#EFBDFF`,"primary-muted":`#4F4264`,scrollbar:`#534270`,"scrollbar-active":`#AE81FF`,"scrollbar-background":`#171812`,"scrollbar-background-active":`#171812`,"scrollbar-background-hover":`#171812`,"scrollbar-corner-color":`#171812`,"scrollbar-hover":`#624C88`,secondary:`#F82672`,"secondary-background":`#61474D`,"secondary-background-darken-1":`#53373D`,"secondary-background-darken-2":`#46272E`,"secondary-background-darken-3":`#46272E`,"secondary-background-lighten-1":`#6F575D`,"secondary-background-lighten-2":`#7D676C`,"secondary-background-lighten-3":`#8B787C`,"secondary-darken-1":`#E1005F`,"secondary-darken-2":`#C9004E`,"secondary-darken-3":`#B1003D`,"secondary-lighten-1":`#FF4484`,"secondary-lighten-2":`#FF5D98`,"secondary-lighten-3":`#FF75AC`,"secondary-muted":`#66273A`,success:`#A5E22E`,"success-darken-1":`#90CC09`,"success-darken-2":`#7AB700`,"success-darken-3":`#64A300`,"success-lighten-1":`#BBF746`,"success-lighten-2":`#D2FF5D`,"success-lighten-3":`#E8FF72`,"success-muted":`#4D5F25`,surface:`#2E2E2E`,"surface-active":`#3B3B3B`,"surface-darken-1":`#1E1E1E`,"surface-darken-2":`#0D0D0D`,"surface-darken-3":`#000000`,"surface-lighten-1":`#3E3E3E`,"surface-lighten-2":`#4F4F4F`,"surface-lighten-3":`#616161`,text:`#FFFFFFDD`,"text-accent":`#9AE5F4`,"text-disabled":`#FFFFFF60`,"text-error":`#FB6FA1`,"text-muted":`#FFFFFF99`,"text-primary":`#C9ABFF`,"text-secondary":`#FB6FA1`,"text-success":`#C4EB75`,"text-warning":`#FDBA6B`,warning:`#FC971F`,"warning-darken-1":`#E58300`,"warning-darken-2":`#CD6F00`,"warning-darken-3":`#B65D00`,"warning-lighten-1":`#FFAB36`,"warning-lighten-2":`#FFBF4C`,"warning-lighten-3":`#FFD460`,"warning-muted":`#674921`}},nord:{name:`nord`,dark:!0,ansi:{black:`#3B4252`,red:`#BF616A`,green:`#A3BE8C`,yellow:`#EBCB8B`,blue:`#81A1C1`,magenta:`#B48EAD`,cyan:`#88C0D0`,white:`#E5E9F0`,brightBlack:`#596377`,brightRed:`#BF616A`,brightGreen:`#A3BE8C`,brightYellow:`#EBCB8B`,brightBlue:`#81A1C1`,brightMagenta:`#B48EAD`,brightCyan:`#8FBCBB`,brightWhite:`#ECEFF4`},vars:{accent:`#B48EAD`,"accent-darken-1":`#9F7A98`,"accent-darken-2":`#8B6785`,"accent-darken-3":`#785572`,"accent-lighten-1":`#C8A1C1`,"accent-lighten-2":`#DDB6D6`,"accent-lighten-3":`#F3CAEB`,"accent-muted":`#564F60`,background:`#2E3440`,"background-darken-1":`#1E242F`,"background-darken-2":`#0E141F`,"background-darken-3":`#000010`,"background-lighten-1":`#3E4451`,"background-lighten-2":`#505663`,"background-lighten-3":`#626875`,"block-cursor-background":`#88C0D0`,"block-cursor-blurred-background":`#88C0D04C`,"block-cursor-blurred-foreground":`#D8DEE9`,"block-cursor-foreground":`#2E3440`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#88C0D0`,"border-blurred":`#353C4C`,"button-color-foreground":`#2E3440`,"button-foreground":`#D8DEE9`,error:`#BE616A`,"error-darken-1":`#A94D57`,"error-darken-2":`#933A46`,"error-darken-3":`#7E2735`,"error-lighten-1":`#D4747C`,"error-lighten-2":`#EB8890`,"error-lighten-3":`#FF9CA3`,"error-muted":`#59414C`,"footer-background":`#434C5E`,"footer-description-background":`#00000000`,"footer-description-foreground":`#D8DEE9`,"footer-foreground":`#D8DEE9`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#88C0D0`,foreground:`#D8DEE9`,"foreground-darken-1":`#C3C9D3`,"foreground-darken-2":`#AEB4BF`,"foreground-darken-3":`#9AA0AA`,"foreground-disabled":`#D8DEE960`,"foreground-lighten-1":`#EDF3FE`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#D8DEE999`,"input-cursor-background":`#D8DEE9`,"input-cursor-foreground":`#2E3440`,"input-selection-background":`#81A1C159`,"link-background":`#00000000`,"link-background-hover":`#88C0D0`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#88C0D0`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#88C0D0`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#88C0D0`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#D8DEE9`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#D8DEE9`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#D8DEE999`,panel:`#434C5E`,"panel-darken-1":`#313A4C`,"panel-darken-2":`#212A3A`,"panel-darken-3":`#111B2A`,"panel-lighten-1":`#545D70`,"panel-lighten-2":`#677083`,"panel-lighten-3":`#798396`,primary:`#88C0D0`,"primary-background":`#58646E`,"primary-background-darken-1":`#495661`,"primary-background-darken-2":`#3B4955`,"primary-background-darken-3":`#3B4955`,"primary-background-lighten-1":`#67717B`,"primary-background-lighten-2":`#757F88`,"primary-background-lighten-3":`#848D94`,"primary-darken-1":`#73ABBB`,"primary-darken-2":`#5F97A6`,"primary-darken-3":`#4B8393`,"primary-lighten-1":`#9CD4E5`,"primary-lighten-2":`#B1EAFA`,"primary-lighten-3":`#C6FFFF`,"primary-muted":`#495E6B`,scrollbar:`#48626F`,"scrollbar-active":`#88C0D0`,"scrollbar-background":`#1E242F`,"scrollbar-background-active":`#1E242F`,"scrollbar-background-hover":`#1E242F`,"scrollbar-corner-color":`#1E242F`,"scrollbar-hover":`#53727F`,secondary:`#81A1C1`,"secondary-background":`#57606C`,"secondary-background-darken-1":`#48525F`,"secondary-background-darken-2":`#3A4453`,"secondary-background-darken-3":`#3A4453`,"secondary-background-lighten-1":`#666E79`,"secondary-background-lighten-2":`#757C86`,"secondary-background-lighten-3":`#838A93`,"secondary-darken-1":`#6D8DAC`,"secondary-darken-2":`#597A98`,"secondary-darken-3":`#466784`,"secondary-lighten-1":`#95B5D5`,"secondary-lighten-2":`#A9C9EB`,"secondary-lighten-3":`#BEDEFF`,"secondary-muted":`#465466`,success:`#A3BE8C`,"success-darken-1":`#8FA978`,"success-darken-2":`#7B9565`,"success-darken-3":`#688253`,"success-lighten-1":`#B7D29F`,"success-lighten-2":`#CCE8B4`,"success-lighten-3":`#E1FDC8`,"success-muted":`#515D56`,surface:`#3B4252`,"surface-active":`#484F60`,"surface-darken-1":`#2A3140`,"surface-darken-2":`#1A212F`,"surface-darken-3":`#0A1120`,"surface-lighten-1":`#4C5364`,"surface-lighten-2":`#5E6576`,"surface-lighten-3":`#707889`,text:`#FFFFFFDD`,"text-accent":`#CDB4C8`,"text-disabled":`#FFFFFF60`,"text-error":`#D4969C`,"text-muted":`#FFFFFF99`,"text-primary":`#B0D5DF`,"text-secondary":`#ABC0D6`,"text-success":`#C2D4B3`,"text-warning":`#F1DCB2`,warning:`#EACB8B`,"warning-darken-1":`#D5B677`,"warning-darken-2":`#BFA264`,"warning-darken-3":`#AA8E51`,"warning-lighten-1":`#FFE09E`,"warning-lighten-2":`#FFF5B3`,"warning-lighten-3":`#FFFFC8`,"warning-muted":`#666156`}},"rose-pine":{name:`rose-pine`,dark:!0,ansi:{black:`#26233A`,red:`#EB6F92`,green:`#31748F`,yellow:`#F6C177`,blue:`#9CCFD8`,magenta:`#C4A7E7`,cyan:`#EBBCBA`,white:`#E0DEF4`,brightBlack:`#6E6A86`,brightRed:`#EB6F92`,brightGreen:`#31748F`,brightYellow:`#F6C177`,brightBlue:`#9CCFD8`,brightMagenta:`#C4A7E7`,brightCyan:`#EBBCBA`,brightWhite:`#E0DEF4`},vars:{accent:`#EBBCBA`,"accent-darken-1":`#D5A7A5`,"accent-darken-2":`#C09391`,"accent-darken-3":`#AB807E`,"accent-lighten-1":`#FFD0CE`,"accent-lighten-2":`#FFE5E3`,"accent-lighten-3":`#FFFBF9`,"accent-muted":`#584851`,background:`#191724`,"background-darken-1":`#060015`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#282634`,"background-lighten-2":`#383644`,"background-lighten-3":`#4A4756`,"block-cursor-background":`#C4A7E7`,"block-cursor-blurred-background":`#C4A7E74C`,"block-cursor-blurred-foreground":`#E0DEF4`,"block-cursor-foreground":`#191724`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#524F67`,"border-blurred":`#6E6A86`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#E0DEF4`,error:`#EA6F92`,"error-darken-1":`#D45A7E`,"error-darken-2":`#BE466B`,"error-darken-3":`#A83159`,"error-lighten-1":`#FF83A5`,"error-lighten-2":`#FF98BA`,"error-lighten-3":`#FFADCE`,"error-muted":`#583145`,"footer-background":`#26233A`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E0DEF4`,"footer-foreground":`#E0DEF4`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#EBBCBA`,foreground:`#E0DEF4`,"foreground-darken-1":`#CAC9DE`,"foreground-darken-2":`#B6B4C9`,"foreground-darken-3":`#A2A0B4`,"foreground-disabled":`#E0DEF460`,"foreground-lighten-1":`#F5F3FF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#E0DEF499`,"input-cursor-background":`#F4EDE8`,"input-cursor-foreground":`#191724`,"input-selection-background":`#403D52`,"link-background":`#00000000`,"link-background-hover":`#C4A7E7`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#C4A7E7`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#C4A7E7`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#C4A7E7`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E0DEF4`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E0DEF4`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#E0DEF499`,panel:`#26233A`,"panel-darken-1":`#161329`,"panel-darken-2":`#04001A`,"panel-darken-3":`#000008`,"panel-lighten-1":`#36324B`,"panel-lighten-2":`#47435D`,"panel-lighten-3":`#59556F`,primary:`#C4A7E7`,"primary-background":`#504B5D`,"primary-background-darken-1":`#413B4F`,"primary-background-darken-2":`#322C41`,"primary-background-darken-3":`#322C41`,"primary-background-lighten-1":`#605B6B`,"primary-background-lighten-2":`#6F6B7A`,"primary-background-lighten-3":`#7E7B88`,"primary-darken-1":`#AF93D1`,"primary-darken-2":`#9A7FBC`,"primary-darken-3":`#866CA8`,"primary-lighten-1":`#D9BBFC`,"primary-lighten-2":`#EED0FF`,"primary-lighten-3":`#FFE5FF`,"primary-muted":`#4C425E`,scrollbar:`#524269`,"scrollbar-active":`#C4A7E7`,"scrollbar-background":`#060015`,"scrollbar-background-active":`#060015`,"scrollbar-background-hover":`#060015`,"scrollbar-corner-color":`#060015`,"scrollbar-hover":`#65537E`,secondary:`#31748F`,"secondary-background":`#3E4452`,"secondary-background-darken-1":`#2D3443`,"secondary-background-darken-2":`#1C2434`,"secondary-background-darken-3":`#1C2434`,"secondary-background-lighten-1":`#4F5561`,"secondary-background-lighten-2":`#606570`,"secondary-background-lighten-3":`#717680`,"secondary-darken-1":`#17617B`,"secondary-darken-2":`#004F68`,"secondary-darken-3":`#003E56`,"secondary-lighten-1":`#4687A2`,"secondary-lighten-2":`#5B9AB7`,"secondary-lighten-3":`#70AECB`,"secondary-muted":`#203244`,success:`#9CCFD8`,"success-darken-1":`#87BAC3`,"success-darken-2":`#73A5AE`,"success-darken-3":`#60929A`,"success-lighten-1":`#B0E4ED`,"success-lighten-2":`#C5F9FF`,"success-lighten-3":`#DAFFFF`,"success-muted":`#404E5A`,surface:`#1F1D2E`,"surface-active":`#2B293B`,"surface-darken-1":`#100B1E`,"surface-darken-2":`#00000E`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2F2C3E`,"surface-lighten-2":`#3F3D4F`,"surface-lighten-3":`#514E61`,text:`#FFFFFFDD`,"text-accent":`#F1D2D1`,"text-disabled":`#FFFFFF60`,"text-error":`#F19FB7`,"text-muted":`#FFFFFF99`,"text-primary":`#D8C4EF`,"text-secondary":`#77A3B5`,"text-success":`#BDDFE5`,"text-warning":`#F9D6A5`,warning:`#F5C177`,"warning-darken-1":`#DFAC63`,"warning-darken-2":`#C99850`,"warning-darken-3":`#B3853E`,"warning-lighten-1":`#FFD58A`,"warning-lighten-2":`#FFEB9E`,"warning-lighten-3":`#FFFFB3`,"warning-muted":`#5B4A3C`}},"rose-pine-dawn":{name:`rose-pine-dawn`,dark:!1,ansi:{black:`#F2E9E1`,red:`#B4637A`,green:`#286983`,yellow:`#EA9D34`,blue:`#56949F`,magenta:`#907AA9`,cyan:`#D7827E`,white:`#575279`,brightBlack:`#9893A5`,brightRed:`#B4637A`,brightGreen:`#286983`,brightYellow:`#EA9D34`,brightBlue:`#56949F`,brightMagenta:`#907AA9`,brightCyan:`#D7827E`,brightWhite:`#575279`},vars:{accent:`#D6827E`,"accent-darken-1":`#C16E6B`,"accent-darken-2":`#AB5B58`,"accent-darken-3":`#964847`,"accent-lighten-1":`#ED9591`,"accent-lighten-2":`#FFAAA5`,"accent-lighten-3":`#FFBEB9`,"accent-muted":`#EFD1CB`,background:`#FAF4ED`,"background-darken-1":`#E4DED7`,"background-darken-2":`#CFC9C2`,"background-darken-3":`#BAB5AE`,"background-lighten-1":`#FFFFFF`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#575279`,"block-cursor-blurred-background":`#907AA94C`,"block-cursor-blurred-foreground":`#575279`,"block-cursor-foreground":`#FAF4ED`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#CECACD`,"border-blurred":`#9893A5`,"button-color-foreground":`#000000DD`,"button-foreground":`#575279`,error:`#B4637A`,"error-darken-1":`#9E5067`,"error-darken-2":`#8A3D55`,"error-darken-3":`#752A43`,"error-lighten-1":`#C9768D`,"error-lighten-2":`#DF8AA0`,"error-lighten-3":`#F59EB5`,"error-muted":`#E5C8CA`,"footer-background":`#F2E9E1`,"footer-description-background":`#00000000`,"footer-description-foreground":`#575279`,"footer-foreground":`#575279`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#D7827E`,foreground:`#575279`,"foreground-darken-1":`#444066`,"foreground-darken-2":`#332F53`,"foreground-darken-3":`#222042`,"foreground-disabled":`#57527960`,"foreground-lighten-1":`#69648C`,"foreground-lighten-2":`#7C76A0`,"foreground-lighten-3":`#9089B4`,"foreground-muted":`#57527999`,"input-cursor-background":`#575279`,"input-cursor-foreground":`#FAF4ED`,"input-selection-background":`#DFDAD9`,"link-background":`#00000000`,"link-background-hover":`#907AA9`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#907AA9`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#907AA9`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#907AA9`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#575279`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#575279`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#57527999`,panel:`#F2E9E1`,"panel-darken-1":`#DCD3CB`,"panel-darken-2":`#C7BFB7`,"panel-darken-3":`#B3AAA3`,"panel-lighten-1":`#FFFEF6`,"panel-lighten-2":`#FFFFFF`,"panel-lighten-3":`#FFFFFF`,primary:`#907AA9`,"primary-background":`#907AA9`,"primary-background-darken-1":`#7C6795`,"primary-background-darken-2":`#695481`,"primary-background-darken-3":`#56436E`,"primary-background-lighten-1":`#A48DBD`,"primary-background-lighten-2":`#B8A1D2`,"primary-background-lighten-3":`#CDB5E7`,"primary-darken-1":`#7C6795`,"primary-darken-2":`#695481`,"primary-darken-3":`#56436E`,"primary-lighten-1":`#A48DBD`,"primary-lighten-2":`#B8A1D2`,"primary-lighten-3":`#CDB5E7`,"primary-muted":`#DACFD8`,scrollbar:`#C2B6C4`,"scrollbar-active":`#907AA9`,"scrollbar-background":`#E4DED7`,"scrollbar-background-active":`#E4DED7`,"scrollbar-background-hover":`#E4DED7`,"scrollbar-corner-color":`#E4DED7`,"scrollbar-hover":`#BAACC0`,secondary:`#286983`,"secondary-background":`#286983`,"secondary-background-darken-1":`#0A566F`,"secondary-background-darken-2":`#00455D`,"secondary-background-darken-3":`#00344B`,"secondary-background-lighten-1":`#3E7B96`,"secondary-background-lighten-2":`#538FAA`,"secondary-background-lighten-3":`#67A2BE`,"secondary-darken-1":`#0A566F`,"secondary-darken-2":`#00455D`,"secondary-darken-3":`#00344B`,"secondary-lighten-1":`#3E7B96`,"secondary-lighten-2":`#538FAA`,"secondary-lighten-3":`#67A2BE`,"secondary-muted":`#BBCACD`,success:`#56949F`,"success-darken-1":`#41808B`,"success-darken-2":`#2D6D78`,"success-darken-3":`#155B65`,"success-lighten-1":`#6AA7B3`,"success-lighten-2":`#7EBCC7`,"success-lighten-3":`#92D1DC`,"success-muted":`#C8D7D5`,surface:`#FFFAF3`,"surface-active":`#FFFFFF`,"surface-darken-1":`#E9E4DD`,"surface-darken-2":`#D4CFC8`,"surface-darken-3":`#BFBAB4`,"surface-lighten-1":`#FFFFFF`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#8D5553`,"text-disabled":`#00000060`,"text-error":`#764150`,"text-muted":`#00000099`,"text-primary":`#5F506F`,"text-secondary":`#1A4556`,"text-success":`#386168`,"text-warning":`#9A6722`,warning:`#E99D34`,"warning-darken-1":`#D2891D`,"warning-darken-2":`#BC7600`,"warning-darken-3":`#A56300`,"warning-lighten-1":`#FFB148`,"warning-lighten-2":`#FFC55C`,"warning-lighten-3":`#FFDA70`,"warning-muted":`#F5D9B5`}},"rose-pine-moon":{name:`rose-pine-moon`,dark:!0,ansi:{black:`#393552`,red:`#EB6F92`,green:`#3E8FB0`,yellow:`#F6C177`,blue:`#9CCFD8`,magenta:`#C4A7E7`,cyan:`#EA9A97`,white:`#E0DEF4`,brightBlack:`#6E6A86`,brightRed:`#EB6F92`,brightGreen:`#3E8FB0`,brightYellow:`#F6C177`,brightBlue:`#9CCFD8`,brightMagenta:`#C4A7E7`,brightCyan:`#EA9A97`,brightWhite:`#E0DEF4`},vars:{accent:`#EA9A97`,"accent-darken-1":`#D48683`,"accent-darken-2":`#BE7270`,"accent-darken-3":`#A95F5E`,"accent-lighten-1":`#FFAEAA`,"accent-lighten-2":`#FFC3BF`,"accent-lighten-3":`#FFD8D4`,"accent-muted":`#5E4553`,background:`#232136`,"background-darken-1":`#131125`,"background-darken-2":`#000017`,"background-darken-3":`#000001`,"background-lighten-1":`#333046`,"background-lighten-2":`#444158`,"background-lighten-3":`#56526A`,"block-cursor-background":`#C4A7E7`,"block-cursor-blurred-background":`#C4A7E74C`,"block-cursor-blurred-foreground":`#E0DEF4`,"block-cursor-foreground":`#232136`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#56526E`,"border-blurred":`#6E6A86`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#E0DEF4`,error:`#EA6F92`,"error-darken-1":`#D45A7E`,"error-darken-2":`#BE466B`,"error-darken-3":`#A83159`,"error-lighten-1":`#FF83A5`,"error-lighten-2":`#FF98BA`,"error-lighten-3":`#FFADCE`,"error-muted":`#5F3851`,"footer-background":`#393552`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E0DEF4`,"footer-foreground":`#E0DEF4`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#EA9A97`,foreground:`#E0DEF4`,"foreground-darken-1":`#CAC9DE`,"foreground-darken-2":`#B6B4C9`,"foreground-darken-3":`#A2A0B4`,"foreground-disabled":`#E0DEF460`,"foreground-lighten-1":`#F5F3FF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#E0DEF499`,"input-cursor-background":`#F4EDE8`,"input-cursor-foreground":`#232136`,"input-selection-background":`#44415A`,"link-background":`#00000000`,"link-background-hover":`#C4A7E7`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#C4A7E7`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#C4A7E7`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#C4A7E7`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E0DEF4`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E0DEF4`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#E0DEF499`,panel:`#393552`,"panel-darken-1":`#282440`,"panel-darken-2":`#17152F`,"panel-darken-3":`#080020`,"panel-lighten-1":`#4A4564`,"panel-lighten-2":`#5C5776`,"panel-lighten-3":`#6F6989`,primary:`#C4A7E7`,"primary-background":`#58536A`,"primary-background-darken-1":`#49445D`,"primary-background-darken-2":`#3B3550`,"primary-background-darken-3":`#3B3550`,"primary-background-lighten-1":`#676277`,"primary-background-lighten-2":`#757184`,"primary-background-lighten-3":`#848091`,"primary-darken-1":`#AF93D1`,"primary-darken-2":`#9A7FBC`,"primary-darken-3":`#866CA8`,"primary-lighten-1":`#D9BBFC`,"primary-lighten-2":`#EED0FF`,"primary-lighten-3":`#FFE5FF`,"primary-muted":`#53496B`,scrollbar:`#594D72`,"scrollbar-active":`#C4A7E7`,"scrollbar-background":`#131125`,"scrollbar-background-active":`#131125`,"scrollbar-background-hover":`#131125`,"scrollbar-corner-color":`#131125`,"scrollbar-hover":`#6B5C86`,secondary:`#3E8FB0`,"secondary-background":`#474F63`,"secondary-background-darken-1":`#374055`,"secondary-background-darken-2":`#273148`,"secondary-background-darken-3":`#273148`,"secondary-background-lighten-1":`#575F71`,"secondary-background-lighten-2":`#676E7E`,"secondary-background-lighten-3":`#787E8C`,"secondary-darken-1":`#237B9B`,"secondary-darken-2":`#006888`,"secondary-darken-3":`#005674`,"secondary-lighten-1":`#54A2C4`,"secondary-lighten-2":`#6AB7D9`,"secondary-lighten-3":`#80CBEE`,"secondary-muted":`#2B425A`,success:`#9CCFD8`,"success-darken-1":`#87BAC3`,"success-darken-2":`#73A5AE`,"success-darken-3":`#60929A`,"success-lighten-1":`#B0E4ED`,"success-lighten-2":`#C5F9FF`,"success-lighten-3":`#DAFFFF`,"success-muted":`#475566`,surface:`#2A273F`,"surface-active":`#37334C`,"surface-darken-1":`#19172E`,"surface-darken-2":`#0A021E`,"surface-darken-3":`#00000F`,"surface-lighten-1":`#3A3750`,"surface-lighten-2":`#4C4862`,"surface-lighten-3":`#5E5975`,text:`#FFFFFFDD`,"text-accent":`#F1BCBA`,"text-disabled":`#FFFFFF60`,"text-error":`#F19FB7`,"text-muted":`#FFFFFF99`,"text-primary":`#D8C4EF`,"text-secondary":`#7FB5CA`,"text-success":`#BDDFE5`,"text-warning":`#F9D6A5`,warning:`#F5C177`,"warning-darken-1":`#DFAC63`,"warning-darken-2":`#C99850`,"warning-darken-3":`#B3853E`,"warning-lighten-1":`#FFD58A`,"warning-lighten-2":`#FFEB9E`,"warning-lighten-3":`#FFFFB3`,"warning-muted":`#625149`}},"solarized-dark":{name:`solarized-dark`,dark:!0,ansi:{black:`#073642`,red:`#DC322F`,green:`#859900`,yellow:`#B58900`,blue:`#268BD2`,magenta:`#D33682`,cyan:`#2AA198`,white:`#EEE8D5`,brightBlack:`#335E69`,brightRed:`#CB4B16`,brightGreen:`#586E75`,brightYellow:`#657B83`,brightBlue:`#839496`,brightMagenta:`#6C71C4`,brightCyan:`#93A1A1`,brightWhite:`#FDF6E3`},vars:{accent:`#6C71C4`,"accent-darken-1":`#575EAF`,"accent-darken-2":`#424C9A`,"accent-darken-3":`#2D3B87`,"accent-lighten-1":`#8083D9`,"accent-lighten-2":`#9597EE`,"accent-lighten-3":`#AAABFF`,"accent-muted":`#204060`,background:`#002B36`,"background-darken-1":`#001B25`,"background-darken-2":`#000A17`,"background-darken-3":`#000000`,"background-lighten-1":`#143B46`,"background-lighten-2":`#274C58`,"background-lighten-3":`#3A5E6A`,"block-cursor-background":`#268BD2`,"block-cursor-blurred-background":`#268BD24C`,"block-cursor-blurred-foreground":`#839496`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#268BD2`,"border-blurred":`#00303C`,"button-color-foreground":`#FDF6E3`,"button-foreground":`#839496`,error:`#DB322F`,"error-darken-1":`#C3121E`,"error-darken-2":`#AB000D`,"error-darken-3":`#940000`,"error-lighten-1":`#F44940`,"error-lighten-2":`#FF6052`,"error-lighten-3":`#FF7564`,"error-muted":`#422D33`,"footer-background":`#268BD2`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FDF6E3`,"footer-foreground":`#839496`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FDF6E3`,foreground:`#839496`,"foreground-darken-1":`#6F8082`,"foreground-darken-2":`#5D6D6F`,"foreground-darken-3":`#4B5B5D`,"foreground-disabled":`#83949660`,"foreground-lighten-1":`#96A7A9`,"foreground-lighten-2":`#AABCBE`,"foreground-lighten-3":`#BED0D3`,"foreground-muted":`#83949699`,"input-cursor-background":`#839496`,"input-cursor-foreground":`#002B36`,"input-selection-background":`#073642`,"link-background":`#00000000`,"link-background-hover":`#268BD2`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#268BD2`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#268BD2`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#268BD2`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#839496`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#839496`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#83949699`,panel:`#073642`,"panel-darken-1":`#002531`,"panel-darken-2":`#001721`,"panel-darken-3":`#000112`,"panel-lighten-1":`#1D4653`,"panel-lighten-2":`#305865`,"panel-lighten-3":`#436A78`,primary:`#268BD2`,"primary-background":`#2A5667`,"primary-background-darken-1":`#17475A`,"primary-background-darken-2":`#05394D`,"primary-background-darken-3":`#05394D`,"primary-background-lighten-1":`#3D6575`,"primary-background-lighten-2":`#507482`,"primary-background-lighten-3":`#62838F`,"primary-darken-1":`#0077BD`,"primary-darken-2":`#0065A8`,"primary-darken-3":`#005394`,"primary-lighten-1":`#459EE7`,"primary-lighten-2":`#5FB2FD`,"primary-lighten-3":`#77C7FF`,"primary-muted":`#0B4764`,scrollbar:`#0F476A`,"scrollbar-active":`#268BD2`,"scrollbar-background":`#001B25`,"scrollbar-background-active":`#001B25`,"scrollbar-background-hover":`#001B25`,"scrollbar-corner-color":`#001B25`,"scrollbar-hover":`#13537B`,secondary:`#2AA198`,"secondary-background":`#2B5960`,"secondary-background-darken-1":`#184A52`,"secondary-background-darken-2":`#063C44`,"secondary-background-darken-3":`#063C44`,"secondary-background-lighten-1":`#3E676E`,"secondary-background-lighten-2":`#50767C`,"secondary-background-lighten-3":`#63858A`,"secondary-darken-1":`#008C84`,"secondary-darken-2":`#007971`,"secondary-darken-3":`#00665F`,"secondary-lighten-1":`#44B5AB`,"secondary-lighten-2":`#5BCAC0`,"secondary-lighten-3":`#72DFD5`,"secondary-muted":`#0C4E53`,success:`#849900`,"success-darken-1":`#708500`,"success-darken-2":`#5B7200`,"success-darken-3":`#485F00`,"success-lighten-1":`#99AC22`,"success-lighten-2":`#AFC139`,"success-lighten-3":`#C4D64E`,"success-muted":`#274C25`,surface:`#073642`,"surface-active":`#19434F`,"surface-darken-1":`#002531`,"surface-darken-2":`#001721`,"surface-darken-3":`#000112`,"surface-lighten-1":`#1D4653`,"surface-lighten-2":`#305865`,"surface-lighten-3":`#436A78`,text:`#FFFFFFDD`,"text-accent":`#9DA1D8`,"text-disabled":`#FFFFFF60`,"text-error":`#E77775`,"text-muted":`#FFFFFF99`,"text-primary":`#6FB2E1`,"text-secondary":`#72C0BB`,"text-success":`#AEBB56`,"text-warning":`#DC8865`,warning:`#CA4B16`,"warning-darken-1":`#B33600`,"warning-darken-2":`#9C2000`,"warning-darken-3":`#850100`,"warning-lighten-1":`#E25F29`,"warning-lighten-2":`#FA733C`,"warning-lighten-3":`#FF874E`,"warning-muted":`#3C342C`}},"solarized-light":{name:`solarized-light`,dark:!1,ansi:{black:`#073642`,red:`#DC322F`,green:`#859900`,yellow:`#B58900`,blue:`#268BD2`,magenta:`#D33682`,cyan:`#2AA198`,white:`#BBB5A2`,brightBlack:`#002B36`,brightRed:`#CB4B16`,brightGreen:`#586E75`,brightYellow:`#657B83`,brightBlue:`#839496`,brightMagenta:`#6C71C4`,brightCyan:`#93A1A1`,brightWhite:`#FDF6E3`},vars:{accent:`#6C71C4`,"accent-darken-1":`#575EAF`,"accent-darken-2":`#424C9A`,"accent-darken-3":`#2D3B87`,"accent-lighten-1":`#8083D9`,"accent-lighten-2":`#9597EE`,"accent-lighten-3":`#AAABFF`,"accent-muted":`#D1CED9`,background:`#FDF6E3`,"background-darken-1":`#E7E0CD`,"background-darken-2":`#D2CBB9`,"background-darken-3":`#BDB6A4`,"background-lighten-1":`#FFFFF8`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#268BD2`,"block-cursor-blurred-background":`#268BD24C`,"block-cursor-blurred-foreground":`#586E75`,"block-cursor-foreground":`#000000DD`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#268BD2`,"border-blurred":`#E6E0CE`,"button-color-foreground":`#FDF6E3`,"button-foreground":`#586E75`,error:`#DB322F`,"error-darken-1":`#C3121E`,"error-darken-2":`#AB000D`,"error-darken-3":`#940000`,"error-lighten-1":`#F44940`,"error-lighten-2":`#FF6052`,"error-lighten-3":`#FF7564`,"error-muted":`#F3BBAD`,"footer-background":`#268BD2`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FDF6E3`,"footer-foreground":`#586E75`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FDF6E3`,foreground:`#586E75`,"foreground-darken-1":`#465B62`,"foreground-darken-2":`#344950`,"foreground-darken-3":`#23383F`,"foreground-disabled":`#586E7560`,"foreground-lighten-1":`#6A8088`,"foreground-lighten-2":`#7D949B`,"foreground-lighten-3":`#91A8AF`,"foreground-muted":`#586E7599`,"input-cursor-background":`#586E75`,"input-cursor-foreground":`#FDF6E3`,"input-selection-background":`#459EE766`,"link-background":`#00000000`,"link-background-hover":`#268BD2`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#268BD2`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#268BD2`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#268BD2`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#586E75`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#586E75`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#586E7599`,panel:`#EEE8D5`,"panel-darken-1":`#D8D2C0`,"panel-darken-2":`#C3BEAB`,"panel-darken-3":`#AFA997`,"panel-lighten-1":`#FFFDEA`,"panel-lighten-2":`#FFFFFF`,"panel-lighten-3":`#FFFFFF`,primary:`#268BD2`,"primary-background":`#268BD2`,"primary-background-darken-1":`#0077BD`,"primary-background-darken-2":`#0065A8`,"primary-background-darken-3":`#005394`,"primary-background-lighten-1":`#459EE7`,"primary-background-lighten-2":`#5FB2FD`,"primary-background-lighten-3":`#77C7FF`,"primary-darken-1":`#0077BD`,"primary-darken-2":`#0065A8`,"primary-darken-3":`#005394`,"primary-lighten-1":`#459EE7`,"primary-lighten-2":`#5FB2FD`,"primary-lighten-3":`#77C7FF`,"primary-muted":`#BCD5DD`,scrollbar:`#99BECF`,"scrollbar-active":`#268BD2`,"scrollbar-background":`#E7E0CD`,"scrollbar-background-active":`#E7E0CD`,"scrollbar-background-hover":`#E7E0CD`,"scrollbar-corner-color":`#E7E0CD`,"scrollbar-hover":`#86B5CF`,secondary:`#2AA198`,"secondary-background":`#2AA198`,"secondary-background-darken-1":`#008C84`,"secondary-background-darken-2":`#007971`,"secondary-background-darken-3":`#00665F`,"secondary-background-lighten-1":`#44B5AB`,"secondary-background-lighten-2":`#5BCAC0`,"secondary-background-lighten-3":`#72DFD5`,"secondary-darken-1":`#008C84`,"secondary-darken-2":`#007971`,"secondary-darken-3":`#00665F`,"secondary-lighten-1":`#44B5AB`,"secondary-lighten-2":`#5BCAC0`,"secondary-lighten-3":`#72DFD5`,"secondary-muted":`#BDDCCC`,success:`#849900`,"success-darken-1":`#708500`,"success-darken-2":`#5B7200`,"success-darken-3":`#485F00`,"success-lighten-1":`#99AC22`,"success-lighten-2":`#AFC139`,"success-lighten-3":`#C4D64E`,"success-muted":`#D9DA9E`,surface:`#EEE8D5`,"surface-active":`#FFF9E5`,"surface-darken-1":`#D8D2C0`,"surface-darken-2":`#C3BEAB`,"surface-darken-3":`#AFA997`,"surface-lighten-1":`#FFFDEA`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#474A81`,"text-disabled":`#00000060`,"text-error":`#91211F`,"text-muted":`#00000099`,"text-primary":`#195B8A`,"text-secondary":`#1B6A64`,"text-success":`#576400`,"text-warning":`#85310E`,warning:`#CA4B16`,"warning-darken-1":`#B33600`,"warning-darken-2":`#9C2000`,"warning-darken-3":`#850100`,"warning-lighten-1":`#E25F29`,"warning-lighten-2":`#FA733C`,"warning-lighten-3":`#FF874E`,"warning-muted":`#EEC2A5`}},"svg-export":{name:`svg-export`,dark:!0,ansi:{black:`#4B4E55`,red:`#CC555A`,green:`#98A84B`,yellow:`#D0B344`,blue:`#608AB1`,magenta:`#98729F`,cyan:`#68A0B3`,white:`#C5C8C6`,brightBlack:`#9A9B99`,brightRed:`#FF2627`,brightGreen:`#00823D`,brightYellow:`#D08442`,brightBlue:`#1984E9`,brightMagenta:`#FF2C7A`,brightCyan:`#398280`,brightWhite:`#FDFDC5`},vars:{accent:`#56B6C2`,"accent-darken-1":`#3EA1AD`,"accent-darken-2":`#238D99`,"accent-darken-3":`#007A85`,"accent-lighten-1":`#6CCAD6`,"accent-lighten-2":`#81DFEC`,"accent-lighten-3":`#97F5FF`,"accent-muted":`#365356`,background:`#292929`,"background-darken-1":`#191919`,"background-darken-2":`#050505`,"background-darken-3":`#000000`,"background-lighten-1":`#393939`,"background-lighten-2":`#4A4A4A`,"background-lighten-3":`#5C5C5C`,"block-cursor-background":`#61AFEF`,"block-cursor-blurred-background":`#61AFEF4C`,"block-cursor-blurred-foreground":`#C5C8C6`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#61AFEF`,"border-blurred":`#191919`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#C5C8C6`,error:`#CB555A`,"error-darken-1":`#B54048`,"error-darken-2":`#9F2C37`,"error-darken-3":`#891427`,"error-lighten-1":`#E2686C`,"error-lighten-2":`#F97D7F`,"error-lighten-3":`#FF9192`,"error-muted":`#593637`,"footer-background":`#2C343A`,"footer-description-background":`#00000000`,"footer-description-foreground":`#C5C8C6`,"footer-foreground":`#C5C8C6`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#56B6C2`,foreground:`#C5C8C6`,"foreground-darken-1":`#B0B3B1`,"foreground-darken-2":`#9C9F9D`,"foreground-darken-3":`#888B89`,"foreground-disabled":`#C5C8C660`,"foreground-lighten-1":`#D9DCDA`,"foreground-lighten-2":`#EFF2F0`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#C5C8C699`,"input-cursor-background":`#C5C8C6`,"input-cursor-foreground":`#292929`,"input-selection-background":`#77C3FF66`,"link-background":`#00000000`,"link-background-hover":`#61AFEF`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#61AFEF`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#61AFEF`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#61AFEF`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#C5C8C6`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#C5C8C6`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#C5C8C699`,panel:`#2C343A`,"panel-darken-1":`#1C2429`,"panel-darken-2":`#0C141A`,"panel-darken-3":`#000007`,"panel-lighten-1":`#3C444B`,"panel-lighten-2":`#4D565C`,"panel-lighten-3":`#5F686F`,primary:`#61AFEF`,"primary-background":`#4F5A61`,"primary-background-darken-1":`#404B53`,"primary-background-darken-2":`#313D46`,"primary-background-darken-3":`#313D46`,"primary-background-lighten-1":`#5F686F`,"primary-background-lighten-2":`#6E777D`,"primary-background-lighten-3":`#7E858B`,"primary-darken-1":`#489BD9`,"primary-darken-2":`#2C87C4`,"primary-darken-3":`#0074AF`,"primary-lighten-1":`#77C3FF`,"primary-lighten-2":`#8ED8FF`,"primary-lighten-3":`#A4EDFF`,"primary-muted":`#395164`,scrollbar:`#35556E`,"scrollbar-active":`#61AFEF`,"scrollbar-background":`#191919`,"scrollbar-background-active":`#191919`,"scrollbar-background-hover":`#191919`,"scrollbar-corner-color":`#191919`,"scrollbar-hover":`#3D6484`,secondary:`#C678DD`,"secondary-background":`#5C5260`,"secondary-background-darken-1":`#4E4352`,"secondary-background-darken-2":`#403444`,"secondary-background-darken-3":`#403444`,"secondary-background-lighten-1":`#6A616E`,"secondary-background-lighten-2":`#79707C`,"secondary-background-lighten-3":`#87808A`,"secondary-darken-1":`#B064C7`,"secondary-darken-2":`#9B50B3`,"secondary-darken-3":`#873D9E`,"secondary-lighten-1":`#DB8CF2`,"secondary-lighten-2":`#F1A0FF`,"secondary-lighten-3":`#FFB5FF`,"secondary-muted":`#58405F`,success:`#98C379`,"success-darken-1":`#83AE65`,"success-darken-2":`#709A53`,"success-darken-3":`#5C8641`,"success-lighten-1":`#ACD78C`,"success-lighten-2":`#C1EDA0`,"success-lighten-3":`#D6FFB4`,"success-muted":`#4A5741`,surface:`#1E1E1E`,"surface-active":`#2A2A2A`,"surface-darken-1":`#0D0D0D`,"surface-darken-2":`#000000`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2D2D2D`,"surface-lighten-2":`#3E3E3E`,"surface-lighten-3":`#4F4F4F`,text:`#FFFFFFDD`,"text-accent":`#8FCED6`,"text-disabled":`#FFFFFF60`,"text-error":`#DD8E92`,"text-muted":`#FFFFFF99`,"text-primary":`#96CAF4`,"text-secondary":`#D9A5E8`,"text-success":`#BBD7A6`,"text-warning":`#EDD5A7`,warning:`#E4C07B`,"warning-darken-1":`#CFAB67`,"warning-darken-2":`#B99754`,"warning-darken-3":`#A48442`,"warning-lighten-1":`#FBD48E`,"warning-lighten-2":`#FFE9A2`,"warning-lighten-3":`#FFFFB7`,"warning-muted":`#615641`}},"textual-ansi":{name:`textual-ansi`,dark:!0,ansi:br,vars:{accent:`#0000FF`,"accent-darken-1":`#0000FF`,"accent-darken-2":`#0000FF`,"accent-darken-3":`#0000FF`,"accent-lighten-1":`#0000FF`,"accent-lighten-2":`#0000FF`,"accent-lighten-3":`#0000FF`,"accent-muted":`#0178D4`,background:`#121212`,"background-darken-1":`#121212`,"background-darken-2":`#121212`,"background-darken-3":`#121212`,"background-lighten-1":`#121212`,"background-lighten-2":`#121212`,"background-lighten-3":`#121212`,"block-cursor-background":`#000080`,"block-cursor-blurred-background":`#0000804C`,"block-cursor-blurred-foreground":`#E0E0E0`,"block-cursor-foreground":`#E0E0E0`,"block-hover-background":`#00000019`,boost:`#0178D4`,"boost-darken-1":`#0178D4`,"boost-darken-2":`#0178D4`,"boost-darken-3":`#0178D4`,"boost-lighten-1":`#0178D4`,"boost-lighten-2":`#0178D4`,"boost-lighten-3":`#0178D4`,border:`#0000FF`,"border-blurred":`#000080`,"button-color-foreground":`#E0E0E0`,"button-foreground":`#E0E0E0`,error:`#800000`,"error-darken-1":`#800000`,"error-darken-2":`#800000`,"error-darken-3":`#800000`,"error-lighten-1":`#800000`,"error-lighten-2":`#800000`,"error-lighten-3":`#800000`,"error-muted":`#0178D4`,"footer-background":`#121212`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E0E0E0`,"footer-foreground":`#E0E0E0`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#0000FF`,foreground:`#E0E0E0`,"foreground-darken-1":`#E0E0E0`,"foreground-darken-2":`#E0E0E0`,"foreground-darken-3":`#E0E0E0`,"foreground-disabled":`#00000060`,"foreground-lighten-1":`#E0E0E0`,"foreground-lighten-2":`#E0E0E0`,"foreground-lighten-3":`#E0E0E0`,"foreground-muted":`#00000099`,"input-cursor-background":`#121212`,"input-cursor-foreground":`#E0E0E0`,"input-selection-background":`#000080`,"link-background":`#00000000`,"link-background-hover":`#000080`,"link-color":`#E0E0E0`,"link-color-hover":`#0178D4`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#000080`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#000080`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#000080`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E0E0E0`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E0E0E0`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#00000099`,panel:`#121212`,"panel-darken-1":`#121212`,"panel-darken-2":`#121212`,"panel-darken-3":`#121212`,"panel-lighten-1":`#121212`,"panel-lighten-2":`#121212`,"panel-lighten-3":`#121212`,primary:`#000080`,"primary-background":`#000080`,"primary-background-darken-1":`#000080`,"primary-background-darken-2":`#000080`,"primary-background-darken-3":`#000080`,"primary-background-lighten-1":`#000080`,"primary-background-lighten-2":`#000080`,"primary-background-lighten-3":`#000080`,"primary-darken-1":`#000080`,"primary-darken-2":`#000080`,"primary-darken-3":`#000080`,"primary-lighten-1":`#000080`,"primary-lighten-2":`#000080`,"primary-lighten-3":`#000080`,"primary-muted":`#0178D4`,scrollbar:`#000080`,"scrollbar-active":`#000080`,"scrollbar-background":`#121212`,"scrollbar-background-active":`#121212`,"scrollbar-background-hover":`#121212`,"scrollbar-corner-color":`#E0E0E0`,"scrollbar-hover":`#000040`,secondary:`#008080`,"secondary-background":`#008080`,"secondary-background-darken-1":`#008080`,"secondary-background-darken-2":`#008080`,"secondary-background-darken-3":`#008080`,"secondary-background-lighten-1":`#008080`,"secondary-background-lighten-2":`#008080`,"secondary-background-lighten-3":`#008080`,"secondary-darken-1":`#008080`,"secondary-darken-2":`#008080`,"secondary-darken-3":`#008080`,"secondary-lighten-1":`#008080`,"secondary-lighten-2":`#008080`,"secondary-lighten-3":`#008080`,"secondary-muted":`#0178D4`,success:`#008000`,"success-darken-1":`#008000`,"success-darken-2":`#008000`,"success-darken-3":`#008000`,"success-lighten-1":`#008000`,"success-lighten-2":`#008000`,"success-lighten-3":`#008000`,"success-muted":`#0178D4`,surface:`#121212`,"surface-active":`#131313`,"surface-darken-1":`#121212`,"surface-darken-2":`#121212`,"surface-darken-3":`#121212`,"surface-lighten-1":`#121212`,"surface-lighten-2":`#121212`,"surface-lighten-3":`#121212`,text:`#E0E0E0`,"text-accent":`#5656FF`,"text-disabled":`#E0E0E0`,"text-error":`#AB5656`,"text-muted":`#E0E0E0`,"text-primary":`#5656AB`,"text-secondary":`#56ABAB`,"text-success":`#56AB56`,"text-warning":`#ABAB56`,warning:`#808000`,"warning-darken-1":`#808000`,"warning-darken-2":`#808000`,"warning-darken-3":`#808000`,"warning-lighten-1":`#808000`,"warning-lighten-2":`#808000`,"warning-lighten-3":`#808000`,"warning-muted":`#0178D4`}},"textual-dark":{name:`textual-dark`,dark:!0,ansi:xr,vars:{accent:`#FEA62B`,"accent-darken-1":`#E7920D`,"accent-darken-2":`#CF7E00`,"accent-darken-3":`#B86B00`,"accent-lighten-1":`#FFBA41`,"accent-lighten-2":`#FFCF56`,"accent-lighten-3":`#FFE46B`,"accent-muted":`#593E19`,background:`#121212`,"background-darken-1":`#000000`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#212121`,"background-lighten-2":`#313131`,"background-lighten-3":`#414141`,"block-cursor-background":`#0178D4`,"block-cursor-blurred-background":`#0178D44C`,"block-cursor-blurred-foreground":`#E0E0E0`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#0178D4`,"border-blurred":`#191919`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#E0E0E0`,error:`#B93C5B`,"error-darken-1":`#A32549`,"error-darken-2":`#8D0638`,"error-darken-3":`#780028`,"error-lighten-1":`#D0506D`,"error-lighten-2":`#E76580`,"error-lighten-3":`#FE7993`,"error-muted":`#441E27`,"footer-background":`#242F38`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E0E0E0`,"footer-foreground":`#E0E0E0`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FFA62B`,foreground:`#E0E0E0`,"foreground-darken-1":`#CACACA`,"foreground-darken-2":`#B6B6B6`,"foreground-darken-3":`#A2A2A2`,"foreground-disabled":`#E0E0E060`,"foreground-lighten-1":`#F5F5F5`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#E0E0E099`,"input-cursor-background":`#E0E0E0`,"input-cursor-foreground":`#121212`,"input-selection-background":`#368AE966`,"link-background":`#00000000`,"link-background-hover":`#0178D4`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#0178D4`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#0178D4`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#0178D4`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E0E0E0`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E0E0E0`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#E0E0E099`,panel:`#242F38`,"panel-darken-1":`#141F27`,"panel-darken-2":`#000F18`,"panel-darken-3":`#000003`,"panel-lighten-1":`#343F49`,"panel-lighten-2":`#45505A`,"panel-lighten-3":`#57626D`,primary:`#0178D4`,"primary-background":`#33424E`,"primary-background-darken-1":`#21313E`,"primary-background-darken-2":`#0F212F`,"primary-background-darken-3":`#0F212F`,"primary-background-lighten-1":`#45525D`,"primary-background-lighten-2":`#57636D`,"primary-background-lighten-3":`#69747D`,"primary-darken-1":`#0065BE`,"primary-darken-2":`#0053AA`,"primary-darken-3":`#004295`,"primary-lighten-1":`#368AE9`,"primary-lighten-2":`#539EFF`,"primary-lighten-3":`#6DB2FF`,"primary-muted":`#0C304C`,scrollbar:`#003054`,"scrollbar-active":`#0178D4`,"scrollbar-background":`#000000`,"scrollbar-background-active":`#000000`,"scrollbar-background-hover":`#000000`,"scrollbar-corner-color":`#000000`,"scrollbar-hover":`#003C6A`,secondary:`#004578`,"secondary-background":`#333B42`,"secondary-background-darken-1":`#212A31`,"secondary-background-darken-2":`#0F1921`,"secondary-background-darken-3":`#0F1921`,"secondary-background-lighten-1":`#454C52`,"secondary-background-lighten-2":`#575E63`,"secondary-background-lighten-3":`#696F74`,"secondary-darken-1":`#003465`,"secondary-darken-2":`#002452`,"secondary-darken-3":`#001541`,"secondary-lighten-1":`#23568B`,"secondary-lighten-2":`#3B689F`,"secondary-lighten-3":`#507BB3`,"secondary-muted":`#0C2130`,success:`#4EBF71`,"success-darken-1":`#36AA5E`,"success-darken-2":`#18954B`,"success-darken-3":`#008139`,"success-lighten-1":`#64D484`,"success-lighten-2":`#7AE998`,"success-lighten-3":`#8FFFAC`,"success-muted":`#24452E`,surface:`#1E1E1E`,"surface-active":`#2A2A2A`,"surface-darken-1":`#0D0D0D`,"surface-darken-2":`#000000`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2D2D2D`,"surface-lighten-2":`#3E3E3E`,"surface-lighten-3":`#4F4F4F`,text:`#FFFFFFDD`,"text-accent":`#FFC473`,"text-disabled":`#FFFFFF60`,"text-error":`#D17E92`,"text-muted":`#FFFFFF99`,"text-primary":`#57A5E2`,"text-secondary":`#5684A5`,"text-success":`#8AD4A1`,"text-warning":`#FFC473`,warning:`#FEA62B`,"warning-darken-1":`#E7920D`,"warning-darken-2":`#CF7E00`,"warning-darken-3":`#B86B00`,"warning-lighten-1":`#FFBA41`,"warning-lighten-2":`#FFCF56`,"warning-lighten-3":`#FFE46B`,"warning-muted":`#593E19`}},"textual-light":{name:`textual-light`,dark:!1,ansi:{black:`#000000`,red:`#AA3731`,green:`#448C27`,yellow:`#CB9000`,blue:`#325CC0`,magenta:`#7A3E9D`,cyan:`#0083B2`,white:`#F7F7F7`,brightBlack:`#777777`,brightRed:`#F05050`,brightGreen:`#60CB00`,brightYellow:`#FFBC5D`,brightBlue:`#007ACC`,brightMagenta:`#E64CE6`,brightCyan:`#00AACB`,brightWhite:`#F7F7F7`},vars:{accent:`#FEA62B`,"accent-darken-1":`#E7920D`,"accent-darken-2":`#CF7E00`,"accent-darken-3":`#B86B00`,"accent-lighten-1":`#FFBA41`,"accent-lighten-2":`#FFCF56`,"accent-lighten-3":`#FFE46B`,"accent-muted":`#E9CEA9`,background:`#E0E0E0`,"background-darken-1":`#CACACA`,"background-darken-2":`#B6B6B6`,"background-darken-3":`#A2A2A2`,"background-lighten-1":`#F5F5F5`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#004578`,"block-cursor-blurred-background":`#0045784C`,"block-cursor-blurred-foreground":`#1F1F1F`,"block-cursor-foreground":`#000000DD`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#004578`,"border-blurred":`#D0D1D0`,"button-color-foreground":`#000000DD`,"button-foreground":`#1F1F1F`,error:`#B93C5B`,"error-darken-1":`#A32549`,"error-darken-2":`#8D0638`,"error-darken-3":`#780028`,"error-lighten-1":`#D0506D`,"error-lighten-2":`#E76580`,"error-lighten-3":`#FE7993`,"error-muted":`#D4AEB8`,"footer-background":`#D0D0D0`,"footer-description-background":`#00000000`,"footer-description-foreground":`#1F1F1F`,"footer-foreground":`#1F1F1F`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#0178D4`,foreground:`#1F1F1F`,"foreground-darken-1":`#0E0E0E`,"foreground-darken-2":`#000000`,"foreground-darken-3":`#000000`,"foreground-disabled":`#1F1F1F60`,"foreground-lighten-1":`#2E2E2E`,"foreground-lighten-2":`#3F3F3F`,"foreground-lighten-3":`#505050`,"foreground-muted":`#1F1F1F99`,"input-cursor-background":`#1F1F1F`,"input-cursor-foreground":`#E0E0E0`,"input-selection-background":`#23568B66`,"link-background":`#00000000`,"link-background-hover":`#004578`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#004578`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#004578`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#004578`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#1F1F1F`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#1F1F1F`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#1F1F1F99`,panel:`#D0D0D0`,"panel-darken-1":`#BBBBBB`,"panel-darken-2":`#A6A6A6`,"panel-darken-3":`#939393`,"panel-lighten-1":`#E5E5E5`,"panel-lighten-2":`#FAFAFA`,"panel-lighten-3":`#FFFFFF`,primary:`#004578`,"primary-background":`#004578`,"primary-background-darken-1":`#003465`,"primary-background-darken-2":`#002452`,"primary-background-darken-3":`#001541`,"primary-background-lighten-1":`#23568B`,"primary-background-lighten-2":`#3B689F`,"primary-background-lighten-3":`#507BB3`,"primary-darken-1":`#003465`,"primary-darken-2":`#002452`,"primary-darken-3":`#001541`,"primary-lighten-1":`#23568B`,"primary-lighten-2":`#3B689F`,"primary-lighten-3":`#507BB3`,"primary-muted":`#9CB1C0`,scrollbar:`#7994A9`,"scrollbar-active":`#004578`,"scrollbar-background":`#CACACA`,"scrollbar-background-active":`#CACACA`,"scrollbar-background-hover":`#CACACA`,"scrollbar-corner-color":`#CACACA`,"scrollbar-hover":`#6587A1`,secondary:`#0178D4`,"secondary-background":`#0178D4`,"secondary-background-darken-1":`#0065BE`,"secondary-background-darken-2":`#0053AA`,"secondary-background-darken-3":`#004295`,"secondary-background-lighten-1":`#368AE9`,"secondary-background-lighten-2":`#539EFF`,"secondary-background-lighten-3":`#6DB2FF`,"secondary-darken-1":`#0065BE`,"secondary-darken-2":`#0053AA`,"secondary-darken-3":`#004295`,"secondary-lighten-1":`#368AE9`,"secondary-lighten-2":`#539EFF`,"secondary-lighten-3":`#6DB2FF`,"secondary-muted":`#9DC0DC`,success:`#4EBF71`,"success-darken-1":`#36AA5E`,"success-darken-2":`#18954B`,"success-darken-3":`#008139`,"success-lighten-1":`#64D484`,"success-lighten-2":`#7AE998`,"success-lighten-3":`#8FFFAC`,"success-muted":`#B4D6BE`,surface:`#D8D8D8`,"surface-active":`#E8E8E8`,"surface-darken-1":`#C3C3C3`,"surface-darken-2":`#AEAEAE`,"surface-darken-3":`#9A9A9A`,"surface-lighten-1":`#EDEDED`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#A86D1C`,"text-disabled":`#00000060`,"text-error":`#7A273C`,"text-muted":`#00000099`,"text-primary":`#002D4F`,"text-secondary":`#004F8B`,"text-success":`#337E4A`,"text-warning":`#A86D1C`,warning:`#FEA62B`,"warning-darken-1":`#E7920D`,"warning-darken-2":`#CF7E00`,"warning-darken-3":`#B86B00`,"warning-lighten-1":`#FFBA41`,"warning-lighten-2":`#FFCF56`,"warning-lighten-3":`#FFE46B`,"warning-muted":`#E9CEA9`}},"tokyo-night":{name:`tokyo-night`,dark:!0,ansi:{black:`#15161E`,red:`#F7768E`,green:`#9ECE6A`,yellow:`#E0AF68`,blue:`#7AA2F7`,magenta:`#BB9AF7`,cyan:`#7DCFFF`,white:`#A9B1D6`,brightBlack:`#414868`,brightRed:`#F7768E`,brightGreen:`#9ECE6A`,brightYellow:`#E0AF68`,brightBlue:`#7AA2F7`,brightMagenta:`#BB9AF7`,brightCyan:`#7DCFFF`,brightWhite:`#C0CAF5`},vars:{accent:`#FE9E64`,"accent-darken-1":`#E78A51`,"accent-darken-2":`#D0763E`,"accent-darken-3":`#BA632C`,"accent-lighten-1":`#FFB277`,"accent-lighten-2":`#FFC78A`,"accent-lighten-3":`#FFDC9E`,"accent-muted":`#5E4238`,background:`#1A1B26`,"background-darken-1":`#070817`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#292A36`,"background-lighten-2":`#3A3A47`,"background-lighten-3":`#4B4B58`,"block-cursor-background":`#BB9AF7`,"block-cursor-blurred-background":`#BB9AF74C`,"block-cursor-blurred-foreground":`#A9B1D6`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#BB9AF7`,"border-blurred":`#1E2235`,"button-color-foreground":`#24283B`,"button-foreground":`#A9B1D6`,error:`#F6768E`,"error-darken-1":`#E0617A`,"error-darken-2":`#C94D68`,"error-darken-3":`#B33856`,"error-lighten-1":`#FF8AA1`,"error-lighten-2":`#FF9FB5`,"error-lighten-3":`#FFB4CA`,"error-muted":`#5C3645`,"footer-background":`#414868`,"footer-description-background":`#00000000`,"footer-description-foreground":`#A9B1D6`,"footer-foreground":`#A9B1D6`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FF9E64`,foreground:`#A9B1D6`,"foreground-darken-1":`#949CC1`,"foreground-darken-2":`#8189AC`,"foreground-darken-3":`#6D7698`,"foreground-disabled":`#A9B1D660`,"foreground-lighten-1":`#BDC5EB`,"foreground-lighten-2":`#D2DAFF`,"foreground-lighten-3":`#E7EFFF`,"foreground-muted":`#A9B1D699`,"input-cursor-background":`#A9B1D6`,"input-cursor-foreground":`#1A1B26`,"input-selection-background":`#D0AEFF66`,"link-background":`#00000000`,"link-background-hover":`#BB9AF7`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#BB9AF7`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#BB9AF7`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#BB9AF7`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#A9B1D6`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#A9B1D6`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#A9B1D699`,panel:`#414868`,"panel-darken-1":`#2F3755`,"panel-darken-2":`#1E2744`,"panel-darken-3":`#0C1733`,"panel-lighten-1":`#53597A`,"panel-lighten-2":`#656B8E`,"panel-lighten-3":`#787EA1`,primary:`#BB9AF7`,"primary-background":`#504D60`,"primary-background-darken-1":`#413D52`,"primary-background-darken-2":`#322E45`,"primary-background-darken-3":`#322E45`,"primary-background-lighten-1":`#605D6E`,"primary-background-lighten-2":`#6F6C7C`,"primary-background-lighten-3":`#7E7C8A`,"primary-darken-1":`#A686E1`,"primary-darken-2":`#9173CC`,"primary-darken-3":`#7D60B7`,"primary-lighten-1":`#D0AEFF`,"primary-lighten-2":`#E5C2FF`,"primary-lighten-3":`#FBD7FF`,"primary-muted":`#4A4164`,scrollbar:`#4F4270`,"scrollbar-active":`#BB9AF7`,"scrollbar-background":`#070817`,"scrollbar-background-active":`#070817`,"scrollbar-background-hover":`#070817`,"scrollbar-corner-color":`#070817`,"scrollbar-hover":`#615187`,secondary:`#7AA2F7`,"secondary-background":`#484E60`,"secondary-background-darken-1":`#383E52`,"secondary-background-darken-2":`#282F45`,"secondary-background-darken-3":`#282F45`,"secondary-background-lighten-1":`#585D6E`,"secondary-background-lighten-2":`#686D7C`,"secondary-background-lighten-3":`#787D8A`,"secondary-darken-1":`#648EE1`,"secondary-darken-2":`#4D7BCC`,"secondary-darken-3":`#3468B7`,"secondary-lighten-1":`#8FB6FF`,"secondary-lighten-2":`#A5CAFF`,"secondary-lighten-3":`#BBDFFF`,"secondary-muted":`#364364`,success:`#9ECE6A`,"success-darken-1":`#89B956`,"success-darken-2":`#75A443`,"success-darken-3":`#619030`,"success-lighten-1":`#B2E37D`,"success-lighten-2":`#C8F891`,"success-lighten-3":`#DDFFA6`,"success-muted":`#41503A`,surface:`#24283B`,"surface-active":`#313448`,"surface-darken-1":`#14182A`,"surface-darken-2":`#00031B`,"surface-darken-3":`#000009`,"surface-lighten-1":`#34384C`,"surface-lighten-2":`#45495E`,"surface-lighten-3":`#575A70`,text:`#FFFFFFDD`,"text-accent":`#FFBE98`,"text-disabled":`#FFFFFF60`,"text-error":`#F9A4B4`,"text-muted":`#FFFFFF99`,"text-primary":`#D2BCF9`,"text-secondary":`#A7C1F9`,"text-success":`#BEDE9C`,"text-warning":`#EACA9B`,warning:`#DFAF68`,"warning-darken-1":`#C99A55`,"warning-darken-2":`#B48742`,"warning-darken-3":`#9E7430`,"warning-lighten-1":`#F6C37B`,"warning-lighten-2":`#FFD88F`,"warning-lighten-3":`#FFEDA3`,"warning-muted":`#554739`}}},Cr=Object.freeze(Object.keys(Sr).sort()),wr=new Map;function Tr(){return Cr}function Er(e){if(!Dr(e))return null;let t=wr.get(e);if(t!==void 0)return t;let n=Or(Sr[e]);return wr.set(e,n),n}function Dr(e){return Object.hasOwn(Sr,e)}function Or(e){let t=new Map;for(let[n,r]of Object.entries(e.vars))t.set(n,Ar(r,e.name,n));return new $t(e.name,e.dark,t)}const kr=/^[0-9a-fA-F]+$/;function Ar(e,t,n){let r=e.startsWith(`#`)?e.slice(1):e;if(r.length!==6&&r.length!==8||!kr.test(r))throw Error(`Theme ${t}: var ${n} has invalid hex ${JSON.stringify(e)} (expected #RRGGBB or #RRGGBBAA)`);return r.length===6?Tn(r):En(r)}const jr=new Set([`error`,`success`,`warning`]);function Mr(e){let t=e.indexOf(`-`);return t===-1?e:e.slice(0,t)}function Nr(e){return jr.has(Mr(e))}function Pr(e,t,n){if(Vn(t))return new $t(n??e.name,e.dark,e.vars);let r={...t,hueShift:0},i=new Map;for(let[n,a]of e.vars){let e=Nr(n)?r:t;i.set(n,Xn.fromRgba(a).applyKey(e).toRgba())}let a=i.get(`background`);if(a===void 0)throw Error(`transposePalette: palette "${e.name}" has no "background" var; cannot derive the dark flag without a background color.`);let o=Xn.fromRgba(a).l<.5;return new $t(n??e.name,o,i)}const Fr={linear:e=>e,step:()=>0},Ir=Object.keys(Fr);function Lr(e){if(!Object.hasOwn(Fr,e))throw RangeError(`unknown ramp easing ${JSON.stringify(e)}; expected one of `+Ir.map(e=>JSON.stringify(e)).join(`, `));return e}var Rr=class{easing;stops;constructor(e,t){if(this.easing=e,this.stops=t,t.length===0)throw RangeError(`a ColorRamp needs at least one stop`);for(let[e,n]of t.entries()){if(!Number.isFinite(n.at))throw RangeError(`ColorRamp stop ${e} has a non-finite position ${n.at}`);let r=t[e-1];if(r!==void 0&&n.at<r.at)throw RangeError(`ColorRamp stops must be in ascending position order; stop ${e} at ${n.at} follows stop ${e-1} at ${r.at}`)}}at(e){if(!Number.isFinite(e))throw RangeError(`ColorRamp.at needs a finite value, got ${e}`);let t=this.stops,n=-1;for(;n+1<t.length&&t[n+1].at<=e;)n++;if(n<0)return t[0].color;let r=t[n];if(n===t.length-1)return r.color;let i=t[n+1],a=Fr[this.easing]((e-r.at)/(i.at-r.at));return a<=0?r.color:a>=1?i.color:Xn.fromRgba(r.color).mix(Xn.fromRgba(i.color),a).toRgba()}};function zr(e,t){return{owner:e.owner,row:e.row,col:e.col+t,inner:e.inner&&zr(e.inner,t)}}const Br=[`bold`,`dim`,`italic`,`underline`,`blink`,`blink2`,`reverse`,`conceal`,`strike`,`underline2`,`frame`,`encircle`,`overline`],Vr={bold:1,dim:2,italic:3,underline:4,blink:5,blink2:6,reverse:7,conceal:8,strike:9,underline2:21,frame:51,encircle:52,overline:53},Hr={b:`bold`,d:`dim`,i:`italic`,u:`underline`,s:`strike`,r:`reverse`,o:`overline`,uu:`underline2`};var Ur=class extends Error{constructor(e,t){super(e,t),this.name=`StyleSyntaxError`}};const Wr=new Map;var z=class e{color;bgcolor;bold;dim;italic;underline;blink;blink2;reverse;conceal;strike;underline2;frame;encircle;overline;link;meta;anchor;constructor(e={}){this.color=ei(e.color),this.bgcolor=ei(e.bgcolor),this.bold=e.bold,this.dim=e.dim,this.italic=e.italic,this.underline=e.underline,this.blink=e.blink,this.blink2=e.blink2,this.reverse=e.reverse,this.conceal=e.conceal,this.strike=e.strike,this.underline2=e.underline2,this.frame=e.frame,this.encircle=e.encircle,this.overline=e.overline,this.link=e.link,this.meta=e.meta,this.anchor=e.anchor}get isNull(){return this.color===void 0&&this.bgcolor===void 0&&this.bold===void 0&&this.dim===void 0&&this.italic===void 0&&this.underline===void 0&&this.blink===void 0&&this.blink2===void 0&&this.reverse===void 0&&this.conceal===void 0&&this.strike===void 0&&this.underline2===void 0&&this.frame===void 0&&this.encircle===void 0&&this.overline===void 0&&this.link===void 0&&this.meta===void 0&&this.anchor===void 0}get transparentBackground(){return this.bgcolor===void 0||this.bgcolor.isDefault}get backgroundStyle(){return new e({bgcolor:this.bgcolor})}with(t){return new e({...this,...t})}get withoutColor(){return this.with({color:void 0,bgcolor:void 0})}withLink(e){return this.with({link:e})}clearMetaAndLinks(){return this.with({link:void 0,meta:void 0})}withAnchor(e){return this.with({anchor:e})}shiftedBy(e){return this.anchor?this.withAnchor(zr(this.anchor,e)):this}add(t){return!t||t.isNull?this:this.isNull?t:new e({color:t.color??this.color,bgcolor:t.bgcolor??this.bgcolor,bold:t.bold??this.bold,dim:t.dim??this.dim,italic:t.italic??this.italic,underline:t.underline??this.underline,blink:t.blink??this.blink,blink2:t.blink2??this.blink2,reverse:t.reverse??this.reverse,conceal:t.conceal??this.conceal,strike:t.strike??this.strike,underline2:t.underline2??this.underline2,frame:t.frame??this.frame,encircle:t.encircle??this.encircle,overline:t.overline??this.overline,link:t.link??this.link,meta:t.meta&&this.meta?{...this.meta,...t.meta}:t.meta??this.meta,anchor:t.anchor??this.anchor})}equals(e){return this===e?!0:this.color?.name===e.color?.name&&this.bgcolor?.name===e.bgcolor?.name&&this.bold===e.bold&&this.dim===e.dim&&this.italic===e.italic&&this.underline===e.underline&&this.blink===e.blink&&this.blink2===e.blink2&&this.reverse===e.reverse&&this.conceal===e.conceal&&this.strike===e.strike&&this.underline2===e.underline2&&this.frame===e.frame&&this.encircle===e.encircle&&this.overline===e.overline&&this.link===e.link&&ri(this.anchor,e.anchor)}drawnColors(e){let t=rn,n=this.bgcolor?.flattenAlpha(t),r=n?.getTruecolor(void 0,!1)??t,i=this.color?.flattenAlpha(r),a=t=>e===void 0?t:t.downgrade(e);return{color:i===void 0?void 0:a(i),bgcolor:n===void 0?void 0:a(n)}}toSgrCodes(e){if(this.isNull)return``;let t=this.drawnColors(e);return[...Br.filter(e=>this[e]===!0).map(e=>`${Vr[e]}`),...t.color?.getAnsiCodes(!0)??[],...t.bgcolor?.getAnsiCodes(!1)??[]].join(`;`)}toString(){if(this.isNull)return`none`;let e=[];for(let t of Br)this[t]===!1&&e.push(`not ${t}`);for(let t of Br)this[t]===!0&&e.push(t);return this.color&&e.push(this.color.name),this.bgcolor&&e.push(`on ${this.bgcolor.name}`),this.link&&e.push(`link ${this.link}`),e.join(` `)||`none`}static null(){return Gr}static fromColor(t,n){return new e({color:t,bgcolor:n})}static fromMeta(t){return new e({meta:t})}static pickFirst(...e){for(let t of e)if(t!==void 0)return t;throw Error(`All arguments are undefined`)}static combine(e){let t=Gr;for(let n of e)n&&(t=t.add(n));return t}static chain(...t){return e.combine(t)}static normalize(e){return e.trim().replace(/\s+/g,` `)}static parse(t){let n=e.normalize(t);if(n===``||n===`none`)return Gr;let r=Wr.get(n);if(r)return r;let i=$r(n);return Wr.set(n,i),i}};const Gr=new z,Kr=/^[a-z][a-z0-9._-]*$/;var qr=class{styles;constructor(e={},t){if(this.styles=new Map,t?.inherit!==!1)for(let[e,t]of Object.entries(ti))this.styles.set(e,t);for(let[t,n]of Object.entries(e)){if(!Kr.test(t))throw Error(`Invalid style name: "${t}" (must be lowercase, start with letter, contain only letters, digits, ".", "-", "_")`);this.styles.set(t,z.parse(n))}}get(e){return this.styles.get(e)}resolve(e){return e instanceof z?e:this.styles.get(e)??z.parse(e)}has(e){return this.styles.has(e)}};const Jr=new Set(Br),Yr=[`not`,`on`,`link`,...Br,...Ln];function Xr(e,t){let n=[],r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i];for(let o=1;o<=t.length;o++){let s=i>1&&o>1&&e[i-1]===t[o-2]&&e[i-2]===t[o-1];a[o]=Math.min(r[o]+1,a[o-1]+1,r[o-1]+Number(e[i-1]!==t[o-1]),s?n[o-2]+1:1/0)}[n,r]=[r,a]}return r[t.length]}function Zr(e,t){let n=e.toLowerCase(),r=Math.max(1,Math.floor(n.length/3)),i=t.filter(e=>Math.abs(e.length-n.length)<=r).map(e=>({name:e,distance:Xr(n,e)})),a=Math.min(r,...i.map(e=>e.distance)),o=i.filter(e=>e.distance===a).map(e=>`"${e.name}"`).sort();return o.length===0?``:` (did you mean ${o.join(` or `)}?)`}function Qr(e,t,n){try{return yn.parse(e)}catch(r){throw new Ur(`${t} "${e}"${Zr(e,n)}: ${String(r)}`,{cause:r})}}function $r(e){let t=e.split(/\s+/),n={},r=0;for(;r<t.length;){let e=t[r];if(e===`not`){r++;let e=t[r];if(!e)throw new Ur(`Expected attribute after "not" in style definition`);let i=Hr[e]??e;if(!Jr.has(i))throw new Ur(`Invalid attribute: "${e}"${Zr(e,Br)}`);n[i]=!1,r++;continue}if(e===`on`){r++;let e=t[r];if(!e)throw new Ur(`Expected color after "on" in style definition`);n.bgcolor=Qr(e,`Invalid background color`,Ln),r++;continue}if(e===`link`){r++;let e=t[r];e&&(n.link=e),r++;continue}let i=Hr[e]??e;if(Jr.has(i)){n[i]=!0,r++;continue}n.color=Qr(e,`Invalid style definition`,Yr),r++}return new z(n)}function ei(e){if(e!==void 0)return e instanceof yn?e:yn.parse(e)}const ti={none:Gr,reset:new z({color:yn.default(),bgcolor:yn.default(),bold:!1,dim:!1,italic:!1,underline:!1,blink:!1,blink2:!1,reverse:!1,conceal:!1,strike:!1,underline2:!1,frame:!1,encircle:!1,overline:!1}),bold:new z({bold:!0}),dim:new z({dim:!0}),italic:new z({italic:!0}),underline:new z({underline:!0}),blink:new z({blink:!0}),blink2:new z({blink2:!0}),reverse:new z({reverse:!0}),conceal:new z({conceal:!0}),strike:new z({strike:!0}),underline2:new z({underline2:!0}),frame:new z({frame:!0}),encircle:new z({encircle:!0}),overline:new z({overline:!0}),"table.header":new z({bold:!0}),"table.footer":new z({bold:!0}),"table.cell":Gr,"table.title":new z({italic:!0}),"table.caption":new z({italic:!0,dim:!0}),"repr.str":z.parse(`green`),"repr.number":z.parse(`cyan`),"repr.bool":z.parse(`italic bright_magenta`),"repr.none":z.parse(`italic magenta`),"repr.url":z.parse(`not italic underline bright_blue`),"repr.uuid":z.parse(`bright_yellow`),"repr.error":z.parse(`bold red`),"repr.indent":z.parse(`dim green`),"repr.attrib_name":z.parse(`yellow`),"repr.attrib_value":z.parse(`magenta`),"repr.attrib_equal":z.parse(`bold`),"repr.tag_start":z.parse(`bold`),"repr.tag_name":z.parse(`bright_magenta`),"repr.tag_contents":z.parse(`default`),"repr.tag_end":z.parse(`bold`),"log.time":z.parse(`cyan dim`),"log.message":Gr,"log.path":z.parse(`dim`),"log.line_no":z.parse(`cyan`),"log.level":Gr,"rule.line":z.parse(`green`),"rule.text":z.parse(`bold`),"json.brace":z.parse(`bold`),"json.bool_true":z.parse(`italic bright_green`),"json.bool_false":z.parse(`italic bright_red`),"json.key":z.parse(`bold blue`),"json.null":z.parse(`italic magenta`),"json.number":z.parse(`bold not italic cyan`),"json.str":z.parse(`not bold not italic green`),"markdown.h1":z.parse(`bold underline`),"markdown.h2":z.parse(`bold`),"markdown.h3":z.parse(`bold dim`),"markdown.h4":z.parse(`bold dim italic`),"markdown.code":z.parse(`cyan on grey11`),"markdown.hr":z.parse(`yellow`),"markdown.link":z.parse(`bright_blue`),"markdown.link_url":z.parse(`blue`),"progress.description":Gr,"progress.percentage":z.parse(`cyan`),"progress.remaining":z.parse(`cyan`),"progress.elapsed":z.parse(`cyan`),"progress.spinner":z.parse(`green`),"progress.download":z.parse(`green`),"progress.filesize":z.parse(`green`),"progress.filesize.total":z.parse(`green`),"progress.data.speed":z.parse(`red`),"bar.back":z.parse(`grey23`),"bar.complete":z.parse(`magenta`),"bar.finished":z.parse(`green`),"bar.pulse":z.parse(`magenta`),"scrollbar.thumb":Gr,"scrollbar.track":z.parse(`grey37`),tree:Gr,"tree.guide":Gr,"status.spinner":z.parse(`green`),"status.message":Gr,prompt:z.parse(`bold`),"prompt.choices":z.parse(`magenta`),"prompt.default":z.parse(`cyan`),"inspect.attr":z.parse(`yellow italic`),"inspect.attr.dunder":z.parse(`yellow italic dim`),"inspect.callable":z.parse(`bold magenta`),"inspect.error":z.parse(`bold red`),"inspect.help":z.parse(`cyan`),"inspect.doc":z.parse(`dim`),"inspect.value.border":z.parse(`green`),"traceback.border":z.parse(`red`),"traceback.text":z.parse(`red`),"traceback.title":z.parse(`bold red`),"traceback.exc_type":z.parse(`bold bright_red`),"traceback.exc_value":Gr,"traceback.offset":z.parse(`bold bright_red`),"scope.border":z.parse(`blue`),"scope.key":z.parse(`italic`),"scope.key.special":z.parse(`dim italic`),pretty:Gr,"iso8601.date":z.parse(`cyan`),"iso8601.time":z.parse(`cyan`),"iso8601.timezone":z.parse(`bright_blue`)},ni=new qr;function ri(e,t){return e===t?!0:!e||!t?!1:e.owner===t.owner&&e.row===t.row&&e.col===t.col&&ri(e.inner,t.inner)}var ii;(function(e){e.BELL=`bell`,e.CARRIAGE_RETURN=`carriage_return`,e.HOME=`home`,e.CLEAR=`clear`,e.SHOW_CURSOR=`show_cursor`,e.HIDE_CURSOR=`hide_cursor`,e.ENABLE_ALT_SCREEN=`enable_alt_screen`,e.DISABLE_ALT_SCREEN=`disable_alt_screen`,e.CURSOR_UP=`cursor_up`,e.CURSOR_DOWN=`cursor_down`,e.CURSOR_FORWARD=`cursor_forward`,e.CURSOR_BACKWARD=`cursor_backward`,e.CURSOR_MOVE_TO_COLUMN=`cursor_move_to_column`,e.CURSOR_MOVE_TO=`cursor_move_to`,e.ERASE_IN_LINE=`erase_in_line`,e.SET_WINDOW_TITLE=`set_window_title`})(ii||={});var B=class e{text;style;control;constructor(e,t,n){this.text=e,this.style=t,this.control=n}get cellLength(){return this.control?0:zt(this.text)}get hasText(){return this.text.length>0}get isControl(){return this.control!==void 0}splitCells(t){let n=this.cellLength;if(t>=n)return[this,new e(``)];if(t<=0)return[new e(``),this];let[r,i]=Ut(this.text,t);return[new e(r,this.style),new e(i,this.style?.shiftedBy(n-zt(i)))]}static _line;static line(){return e._line??=new e(`
16
- `)}static anchorLines(t,n,r=0){return t.map((t,i)=>{let a=r+i,o=0;return t.map(t=>{if(t.isControl)return t;let r=t.style??z.null(),i=new e(t.text,r.withAnchor({owner:n,row:a,col:o,inner:r.anchor}));return o+=t.cellLength,i})})}static anchorAt(e,t,n){if(!Number.isInteger(t)||t<0)return;let r=0;for(let i of e[n]??[]){let e=r+i.cellLength;if(t<e){let e=i.style?.anchor;return e&&zr(e,t-r)}r=e}}static*applyStyle(t,n,r){if(!n&&!r){yield*t;return}for(let i of t){if(i.isControl){yield i;continue}let t=i.style;n&&(t=n.add(t)),r&&(t=t?t.add(r):r),yield new e(i.text,t,i.control)}}static*filterControl(e,t){for(let n of e)n.isControl===t&&(yield n)}static splitLines(t){let n=[],r=[];for(let i of t){if(i.isControl){r.push(i);continue}let t=i.text;if(!t.includes(`
15
+ `+t+`]`}return i.pop(),a=t,r}}})),et=ge(me(((e,t)=>{t.exports={parse:Qe(),stringify:$e()}}))(),1);function tt({onlyFirst:e=!1}={}){return RegExp(`(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]`,e?void 0:`g`)}const nt=tt();function rt(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return!e.includes(`\x1B`)&&!e.includes(`›`)?e:e.replace(nt,``)}const it=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],at=[12288,12288,65281,65376,65504,65510],ot=[8361,8361,65377,65470,65474,65479,65482,65487,65490,65495,65498,65500,65512,65518],st=[32,126,162,163,165,166,172,172,175,175,10214,10221,10629,10630],ct=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141],lt=(e,t)=>{let n=0,r=Math.floor(e.length/2)-1;for(;n<=r;){let i=Math.floor((n+r)/2),a=i*2;if(t<e[a])r=i-1;else if(t>e[a+1])n=i+1;else return!0}return!1},ut=it[0],dt=it.at(-1),ft=at[0],pt=at.at(-1);ot[0],ot.at(-1),st[0],st.at(-1);const mt=ct[0],ht=ct.at(-1),gt=19968,[_t,vt]=yt(ct);function yt(e){let t=e[0],n=e[1];for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];if(gt>=i&&gt<=a)return[i,a];a-i>n-t&&(t=i,n=a)}return[t,n]}const bt=e=>e<ut||e>dt?!1:lt(it,e),xt=e=>e<ft||e>pt?!1:lt(at,e),St=e=>e>=_t&&e<=vt?!0:e<mt||e>ht?!1:lt(ct,e);function Ct(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function wt(e,{ambiguousAsWide:t=!1}={}){return Ct(e),xt(e)||St(e)||t&&bt(e)?2:1}const Tt=new Intl.Segmenter,Et=RegExp(`[^\\p{Default_Ignorable_Code_Point}\\p{Control}\\p{Format}\\p{Nonspacing_Mark}\\p{Enclosing_Mark}\\p{Surrogate}]`,`v`),Dt=RegExp(`\\p{Spacing_Mark}`,`v`),Ot=RegExp(`^\\p{RGI_Emoji}$`,`v`),kt=/^[\d#*]\u20E3$/,At=/\p{Extended_Pictographic}/gu;function jt(e){if(e.length>50)return!1;if(kt.test(e))return!0;if(e.includes(`‍`)){let t=e.match(At);return t!==null&&t.length>=2}return!1}function Mt(e){let t=e.search(Et);return t===-1?void 0:e.slice(t)}function Nt(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function Pt(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}function j(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function Ft(e){return Nt(e)||Pt(e)||j(e)}function M(e,t){let n=[];for(let t of e)Et.test(t)&&n.push(t.codePointAt(0));if(n.length===0)return;let r=0;for(let e=0;e<n.length;e++){let i=n[e];if(!Ft(i)){if(r===0)return;for(let i=e;i<n.length;i++)r+=wt(n[i],t);return r}if(Nt(i)&&Pt(n[e+1])){r+=2,e+=j(n[e+2])?2:1;continue}r+=wt(i,t)}return r}function It(e,t){let n=0,r=!0;for(let i of e){if(r){r=!1;continue}(Dt.test(i)||i>=`＀`&&i<=`￯`)&&(n+=wt(i.codePointAt(0),t))}return n}function Lt(e,t={}){if(typeof e!=`string`||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=t,i=e;if(!r&&(i.includes(`\x1B`)||i.includes(`›`))&&(i=rt(i)),i.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(i))return i.length;let a=0,o={ambiguousAsWide:!n};for(let{segment:e}of Tt.segment(i)){let t=Mt(e);if(t===void 0)continue;if(Ot.test(e)||jt(e)){a+=2;continue}let n=M(t,o);if(n!==void 0){a+=n;continue}let r=t.codePointAt(0);a+=wt(r,o),a+=It(t,o)}return a}const Rt=new Map;function N(e){if(e.length===0)return 0;if(e.length<=64){let t=Rt.get(e);if(t!==void 0)return t}let t=Lt(e);return e.length<=64&&(Rt.size>=4096&&Rt.clear(),Rt.set(e,t)),t}function zt(e){return e}function Bt(e){return e}function P(e){return e>0?Math.floor(e):0}function Vt(e,t){if(t<=0)return[``,e];if(t>=N(e))return[e,``];let n=0,r=0;for(let i of e){let e=N(i);if(n+e>t)break;n+=e,r+=i.length}let i=e.slice(0,r),a=e.slice(r);return n<t?[i+` `.repeat(t-n),a]:[i,a]}function Ht(e,t){if(t<=0||e.length===0)return[e];let n=[],r=Bt(0);for(;r<e.length;){let i=Yt(e,r,t);n.push(e.slice(r,i)),r=i}return n}let Ut;function Wt(e){return Ut??=new Intl.Segmenter(void 0,{granularity:`grapheme`}),Array.from(Ut.segment(e),e=>e.segment)}function Gt(e,t){return qt(Wt(e),t).join(``)}function Kt(e,t){return qt(Wt(e).reverse(),t).reverse().join(``)}function qt(e,t){let n=0,r=0;for(let i of e){let e=N(i);if(n+e>t)break;n+=e,r++}return e.slice(0,r)}function Jt(e,t,n){let r=0,i=t;for(;i<e.length;){let t=e.codePointAt(i),a=String.fromCodePoint(t),o=N(a);if(r+o>n)break;r+=o,i=Bt(i+a.length)}return i}function Yt(e,t,n){return Bt(Math.max(Jt(e,t,n),Xt(e,t)))}function Xt(e,t){return t>=e.length?Bt(e.length):Bt(t+(e.codePointAt(t)>65535?2:1))}var Zt=class{name;dark;vars;constructor(e,t,n){this.name=e,this.dark=t,this.vars=new Map(n)}get(e){return this.vars.get(e)}};function Qt(e){return e.toString(16).padStart(2,`0`)}function $t(e){return Number.isInteger(e)&&e>=0&&e<=255}function en(e,t){if(!$t(t))throw RangeError(`ColorRgba.${e} must be an integer in [0, 255]; got ${t}`)}var F=class e{red;green;blue;alpha;constructor(e,t,n,r=1){if(this.red=e,this.green=t,this.blue=n,this.alpha=r,en(`red`,e),en(`green`,t),en(`blue`,n),!Number.isFinite(r)||r<0||r>1)throw RangeError(`ColorRgba.alpha must be a finite number in [0, 1]; got ${r}`)}get hex(){let e=`#`+Qt(this.red)+Qt(this.green)+Qt(this.blue);return this.alpha===1?e:e+Qt(Math.round(this.alpha*255))}get rgb(){return this.alpha===1?`rgb(${this.red},${this.green},${this.blue})`:`rgba(${this.red},${this.green},${this.blue},${this.alpha})`}get normalized(){return[this.red/255,this.green/255,this.blue/255,this.alpha]}compositeOver(t){if(this.alpha===1)return this;let n=this.alpha;return new e(Math.round(t.red+(this.red-t.red)*n),Math.round(t.green+(this.green-t.green)*n),Math.round(t.blue+(this.blue-t.blue)*n),1)}};const tn=new F(0,0,0);function nn(e){let t=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*t(e.red)+.7152*t(e.green)+.0722*t(e.blue)}function rn(e,t){return an(nn(e),nn(t))}function an(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function on(e,t,n){return e.size>=4096&&e.clear(),e.set(t,n),n}function sn(e,t){let n=e.red-t.red,r=e.green-t.green,i=e.blue-t.blue;return n*n+r*r+i*i}var cn=class{colors;firstIndex;matchCache=new Map;readableCache=new Map;constructor(e,t=0){this.colors=e,this.firstIndex=t}get(e){return this.colors[e-this.firstIndex]}luminanceCache;luminances(){return this.luminanceCache??=this.colors.map(nn),this.luminanceCache}get size(){return this.colors.length}match(e){let t=`${e.red},${e.green},${e.blue},${e.alpha}`,n=this.matchCache.get(t);if(n!==void 0)return n;let r=0,i=1/0;for(let t=0;t<this.colors.length;t++){let n=this.colors[t],a=sn(n,e);a<i&&(i=a,r=t)}return on(this.matchCache,t,this.firstIndex+r)}matchReadable(e,t,n){let r=`${e.red},${e.green},${e.blue}|${t.red},${t.green},${t.blue}|${n}`,i=this.readableCache.get(r);if(i!==void 0)return i;let a=nn(t),o=0,s=!1,c=-1/0;for(let t=0;t<this.colors.length;t++){let r=this.colors[t],i=this.luminances()[t],l=an(i,a),u=l>=n,d=u?-sn(r,e):l;(u&&!s||u===s&&d>c)&&(o=t,s=u,c=d)}return on(this.readableCache,r,this.firstIndex+o)}matchWhere(e,t){let n=this.colors.map(t=>sn(t,e)),r=[...n.keys()].sort((e,t)=>n[e]-n[t]).find(e=>t(this.colors[e],this.firstIndex+e));return r===void 0?void 0:this.firstIndex+r}},I;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.STANDARD=1]=`STANDARD`,e[e.EIGHT_BIT=2]=`EIGHT_BIT`,e[e.TRUECOLOR=3]=`TRUECOLOR`,e[e.WINDOWS=4]=`WINDOWS`})(I||={});const ln={truecolor:I.TRUECOLOR,256:I.EIGHT_BIT,ansi:I.STANDARD,none:null,0:null,false:null,1:I.STANDARD,true:I.STANDARD,2:I.EIGHT_BIT,3:I.TRUECOLOR,"iTerm.app":I.TRUECOLOR,Apple_Terminal:I.EIGHT_BIT,vscode:I.TRUECOLOR,Tabby:I.TRUECOLOR,"xterm-kitty":I.TRUECOLOR,"xterm-ghostty":I.TRUECOLOR,wezterm:I.TRUECOLOR,alacritty:I.TRUECOLOR,foot:I.TRUECOLOR,contour:I.TRUECOLOR};function un(e={}){let t=fn(e).NO_COLOR;if(t!==void 0&&t!==``)return null;let n=dn(fn(e));return n===void 0?L(e):n}function dn(e){let t=e.FORCE_COLOR;if(t===void 0||t===``)return;let n=ln[t];return n===void 0?I.STANDARD:n}function fn(e){return e.env??(typeof process<`u`?process.env:{})}function L(e){let t=fn(e);if(!(e.isTTY??(typeof process<`u`?process.stdout?.isTTY??!1:!1)))return null;let n=t.TERM??``;if(n===`dumb`||n===`unknown`)return null;let r=t.COLORTERM;if(r===`truecolor`||r===`24bit`)return I.TRUECOLOR;let i=ln[n];if(i!==void 0)return i;let a=t.TERM_PROGRAM;if(a!==void 0){let e=ln[a];if(e!==void 0)return e}return/-256(color)?$/i.test(n)?I.EIGHT_BIT:/-truecolor$/i.test(n)?I.TRUECOLOR:(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(n),I.STANDARD)}function pn(e,t){return e===`auto`?{colorSystem:un(t),hyperlinks:(dn(fn(t??{}))??null)!==null||L(t??{})!==null}:{colorSystem:typeof e==`string`?mn(e):e,hyperlinks:!0}}function mn(e,t){if(e===`auto`)return un(t);if(Object.hasOwn(ln,e))return ln[e];throw new hn(`Unknown color depth spec: ${JSON.stringify(e)} (expected "auto", "truecolor", "256", "ansi", or "none")`)}var hn=class extends Error{constructor(e){super(e),this.name=`ColorParseError`}};const gn=new Map;var _n=class e{name;type;number;value;downgradeCache=new Map;constructor(e,t,n,r){this.name=e,this.type=t,this.number=n,this.value=r}get isDefault(){return this.type===I.DEFAULT}get fixedValue(){switch(this.type){case I.TRUECOLOR:return this.value;case I.EIGHT_BIT:return this.number<16?void 0:jn.get(this.number);case I.DEFAULT:case I.STANDARD:case I.WINDOWS:return}}get isSystemDefined(){return this.type===I.STANDARD||this.type===I.WINDOWS}getAnsiCodes(e=!0){switch(this.type){case I.DEFAULT:return[e?`39`:`49`];case I.STANDARD:{let t=this.number;return e?t<8?[`${30+t}`]:[`${90+t-8}`]:t<8?[`${40+t}`]:[`${100+t-8}`]}case I.EIGHT_BIT:return[e?`38`:`48`,`5`,`${this.number}`];case I.TRUECOLOR:{let t=this.value;return[e?`38`:`48`,`2`,`${t.red}`,`${t.green}`,`${t.blue}`]}case I.WINDOWS:{let t=this.number;return e?t<8?[`${30+t}`]:[`${90+t-8}`]:t<8?[`${40+t}`]:[`${100+t-8}`]}}}flattenAlpha(t){if(this.type!==I.TRUECOLOR||!this.value)return this;let n=this.value.compositeOver(t);return n===this.value?this:e.fromRgba(n)}downgrade(e){if(this.type===I.DEFAULT||this.type<=e)return this;let t=this.downgradeCache.get(e);if(t)return t;let n=this.performDowngrade(e);return this.downgradeCache.set(e,n),n}getTruecolor(e,t=!0){switch(this.type){case I.TRUECOLOR:return this.value;case I.EIGHT_BIT:return this.number<16?(e??Nn).ansiColors.get(this.number):jn.get(this.number);case I.STANDARD:return(e??Nn).ansiColors.get(this.number);case I.DEFAULT:{let n=e??Nn;return t?n.foregroundColor:n.backgroundColor}case I.WINDOWS:return(e??Nn).ansiColors.get(this.number)}}static default(){return new e(`default`,I.DEFAULT)}static fromAnsi(t){let n=t<16?I.STANDARD:I.EIGHT_BIT;return new e(`color(${t})`,n,t)}static fromRgba(t){return new e(t.hex,I.TRUECOLOR,void 0,t)}static fromRgb(t,n,r){return e.fromRgba(new F(t,n,r))}static parse(e){let t=e.toLowerCase().trim(),n=gn.get(t);if(n)return n;let r=xn(t);return gn.set(t,r),r}performDowngrade(t){let n=this.getTruecolor();switch(t){case I.EIGHT_BIT:{let t=Mn.match(n);return e.fromAnsi(t)}case I.STANDARD:{let t=An.match(n);return new e(`color(${t})`,I.STANDARD,t)}case I.WINDOWS:case I.TRUECOLOR:return this;case I.DEFAULT:return e.default()}}};const vn=/^#([0-9a-f]{6})$/,yn=/^#([0-9a-f]{8})$/,bn=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/,R=/^color\((\d+)\)$/;function xn(e){if(e===`default`||e===``)return _n.default();let t=z[e];if(t!==void 0)return new _n(e,t<16?I.STANDARD:I.EIGHT_BIT,t);let n=yn.exec(e);if(n)return new _n(e,I.TRUECOLOR,void 0,wn(n[1]));let r=vn.exec(e);if(r)return new _n(e,I.TRUECOLOR,void 0,Cn(r[1]));let i=bn.exec(e);if(i){let t=Sn(e,i[1],`red`),n=Sn(e,i[2],`green`),r=Sn(e,i[3],`blue`);return new _n(e,I.TRUECOLOR,void 0,new F(t,n,r))}let a=R.exec(e);if(a){let t=Sn(e,a[1],`number`);return new _n(e,t<16?I.STANDARD:I.EIGHT_BIT,t)}throw new hn(`Failed to parse color: "${e}"`)}function Sn(e,t,n){let r=parseInt(t,10);if(!$t(r))throw new hn(`ColorSpec "${e}": ${n} ${t} is out of range (0-255)`);return r}function Cn(e){return new F(parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16))}function wn(e){return new F(parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),parseInt(e.slice(6,8),16)/255)}function Tn(e,t,n=.5){return new F(Math.round(e.red+(t.red-e.red)*n),Math.round(e.green+(t.green-e.green)*n),Math.round(e.blue+(t.blue-e.blue)*n),e.alpha+(t.alpha-e.alpha)*n)}var En=class{backgroundColor;foregroundColor;ansiColors;palette;constructor(e,t,n,r){this.backgroundColor=e,this.foregroundColor=t,this.ansiColors=n,this.palette=r}};function Dn(){return[new F(0,0,0),new F(128,0,0),new F(0,128,0),new F(128,128,0),new F(0,0,128),new F(128,0,128),new F(0,128,128),new F(192,192,192),new F(128,128,128),new F(255,0,0),new F(0,255,0),new F(255,255,0),new F(0,0,255),new F(255,0,255),new F(0,255,255),new F(255,255,255)]}function On(){let e=Dn(),t=[0,95,135,175,215,255];for(let n=0;n<6;n++)for(let r=0;r<6;r++)for(let i=0;i<6;i++)e.push(new F(t[n],t[r],t[i]));for(let t=0;t<24;t++){let n=8+10*t;e.push(new F(n,n,n))}return e}function kn(){return[new F(0,0,0),new F(0,0,128),new F(0,128,0),new F(0,128,128),new F(128,0,0),new F(128,0,128),new F(128,128,0),new F(192,192,192),new F(128,128,128),new F(0,0,255),new F(0,255,0),new F(0,255,255),new F(255,0,0),new F(255,0,255),new F(255,255,0),new F(255,255,255)]}const An=new cn(Dn()),jn=new cn(On()),Mn=new cn(On().slice(16),16);new cn(kn());const Nn=new En(new F(0,0,0),new F(255,255,255),An,new Zt(`default`,!0,new Map));function Pn(e){let t=Object.entries(e).filter(([e])=>e.includes(`grey`)).map(([e,t])=>[e.replace(`grey`,`gray`),t]);return{...e,...Object.fromEntries(t)}}const z=Pn({black:0,red:1,green:2,yellow:3,blue:4,magenta:5,cyan:6,white:7,bright_black:8,bright_red:9,bright_green:10,bright_yellow:11,bright_blue:12,bright_magenta:13,bright_cyan:14,bright_white:15,grey0:16,navy_blue:17,dark_blue:18,blue3:19,blue2:20,blue1:21,dark_green:22,deep_sky_blue4:23,deep_sky_blue5:24,deep_sky_blue6:25,dodger_blue3:26,dodger_blue2:27,green4:28,spring_green4:29,turquoise4:30,deep_sky_blue3:31,deep_sky_blue7:32,dodger_blue1:33,green3:34,spring_green3:35,dark_cyan:36,light_sea_green:37,deep_sky_blue2:38,deep_sky_blue1:39,green5:40,spring_green5:41,spring_green2:42,cyan3:43,dark_turquoise:44,turquoise2:45,green1:46,spring_green6:47,spring_green1:48,medium_spring_green:49,cyan2:50,cyan1:51,dark_red:52,deep_pink4:53,purple4:54,purple5:55,purple3:56,blue_violet:57,orange4:58,grey37:59,medium_purple4:60,slate_blue3:61,slate_blue4:62,royal_blue1:63,chartreuse4:64,dark_sea_green4:65,pale_turquoise4:66,steel_blue:67,steel_blue3:68,cornflower_blue:69,chartreuse3:70,dark_sea_green5:71,cadet_blue:72,cadet_blue2:73,sky_blue3:74,steel_blue1:75,chartreuse5:76,pale_green3:77,sea_green3:78,aquamarine3:79,medium_turquoise:80,steel_blue2:81,chartreuse2:82,sea_green2:83,sea_green1:84,sea_green4:85,aquamarine1:86,dark_slate_gray2:87,dark_red2:88,deep_pink5:89,dark_magenta:90,dark_magenta2:91,dark_violet:92,purple2:93,orange5:94,light_pink4:95,plum4:96,medium_purple3:97,medium_purple5:98,slate_blue1:99,yellow4:100,wheat4:101,grey53:102,light_slate_grey:103,medium_purple:104,light_slate_blue:105,yellow5:106,dark_olive_green3:107,dark_sea_green:108,light_sky_blue3:109,light_sky_blue4:110,sky_blue2:111,chartreuse6:112,dark_olive_green4:113,pale_green4:114,dark_sea_green3:115,dark_slate_gray3:116,sky_blue1:117,chartreuse1:118,light_green:119,light_green2:120,pale_green1:121,aquamarine2:122,dark_slate_gray1:123,red3:124,deep_pink6:125,medium_violet_red:126,magenta3:127,dark_violet2:128,purple:129,dark_orange3:130,indian_red:131,hot_pink3:132,medium_orchid3:133,medium_orchid:134,medium_purple2:135,dark_goldenrod:136,light_salmon3:137,rosy_brown:138,grey63:139,medium_purple6:140,medium_purple1:141,gold3:142,dark_khaki:143,navajo_white3:144,grey69:145,light_steel_blue3:146,light_steel_blue:147,yellow3:148,dark_olive_green5:149,dark_sea_green6:150,dark_sea_green2:151,light_cyan3:152,light_sky_blue1:153,green_yellow:154,dark_olive_green2:155,pale_green2:156,dark_sea_green7:157,dark_sea_green1:158,pale_turquoise1:159,red4:160,deep_pink3:161,deep_pink8:162,magenta4:163,magenta5:164,magenta2:165,dark_orange4:166,indian_red2:167,hot_pink4:168,hot_pink2:169,orchid:170,medium_orchid1:171,orange3:172,light_salmon4:173,light_pink3:174,pink3:175,plum3:176,violet:177,gold4:178,light_goldenrod3:179,tan:180,misty_rose3:181,thistle3:182,plum2:183,yellow6:184,khaki3:185,light_goldenrod2:186,light_yellow3:187,grey84:188,light_steel_blue1:189,yellow2:190,dark_olive_green1:191,dark_olive_green6:192,dark_sea_green8:193,honeydew2:194,light_cyan1:195,red1:196,deep_pink2:197,deep_pink1:198,deep_pink9:199,magenta6:200,magenta1:201,orange_red1:202,indian_red1:203,indian_red3:204,hot_pink5:205,hot_pink:206,medium_orchid2:207,dark_orange:208,salmon1:209,light_coral:210,pale_violet_red1:211,orchid2:212,orchid1:213,orange1:214,sandy_brown:215,light_salmon1:216,light_pink1:217,pink1:218,plum1:219,gold1:220,light_goldenrod4:221,light_goldenrod5:222,navajo_white1:223,misty_rose1:224,thistle1:225,yellow1:226,light_goldenrod1:227,khaki1:228,wheat1:229,cornsilk1:230,grey100:231,grey3:232,grey7:233,grey11:234,grey15:235,grey19:236,grey23:237,grey27:238,grey30:239,grey35:240,grey39:241,grey42:242,grey46:243,grey50:244,grey54:245,grey58:246,grey62:247,grey66:248,grey70:249,grey74:250,grey78:251,grey82:252,grey85:253,grey89:254,grey93:255}),Fn=[`default`,...Object.keys(z)];var In;const Ln=[`l`,`c`,`h`,`alpha`],Rn=Object.freeze({hueShift:0,chromaScale:1,lightnessScale:1,lightnessShift:0});Object.freeze({hueShift:0,chromaScale:1,lightnessScale:-1,lightnessShift:1});function zn(e){return e.hueShift%360==0&&e.chromaScale===1&&e.lightnessScale===1&&e.lightnessShift===0}function Bn(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function Vn(e){return e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055}function B(e){return e<0?0:e>1?1:e}const Hn=1e-4,Un=1e-7,Wn=(e,t)=>e<Un?0:t,Gn=(e,t,n)=>e*(1-n)+t*n,Kn=e=>{let t=e%360;return t<0?t+360:t};function qn(e,t,n){return e>=-Hn&&e<=1+Hn&&t>=-Hn&&t<=1+Hn&&n>=-Hn&&n<=1+Hn}var Jn=class{l;c;h;alpha;constructor(e,t,n,r=1){if(this.l=e,this.c=t,this.h=n,this.alpha=r,!Number.isFinite(e))throw RangeError(`Oklch.l must be finite; got ${e}`);if(!Number.isFinite(t))throw RangeError(`Oklch.c must be finite; got ${t}`);if(!Number.isFinite(n))throw RangeError(`Oklch.h must be finite; got ${n}`);if(!Number.isFinite(r)||r<0||r>1)throw RangeError(`Oklch.alpha must be a finite number in [0,1]; got ${r}`)}static fromRgba(e){let[t,n,r,i]=e.normalized,a=Bn(t),o=Bn(n),s=Bn(r),c=.4122214708*a+.5363325363*o+.0514459929*s,l=.2119034982*a+.6806995451*o+.1073969566*s,u=.0883024619*a+.2817188376*o+.6299787005*s,d=Math.cbrt(c),f=Math.cbrt(l),p=Math.cbrt(u),m=.2104542553*d+.793617785*f-.0040720468*p,h=1.9779984951*d-2.428592205*f+.4505937099*p,g=.0259040371*d+.7827717662*f-.808675766*p,_=Math.sqrt(h*h+g*g),v=Kn(180/Math.PI*Math.atan2(g,h));return new In(m,_,Wn(_,v),i)}toRgba(){let e=B(this.l),t=Math.max(0,this.c),n=this.findInGamutChroma(e,t,this.h),{r,g:i,b:a}=this.toLinearRgb(e,n,this.h);return new F(Math.round(B(Vn(r))*255),Math.round(B(Vn(i))*255),Math.round(B(Vn(a))*255),this.alpha)}applyKey(e){if(zn(e))return this;let t=B(this.l*e.lightnessScale+e.lightnessShift),n=Math.max(0,this.c*e.chromaScale),r=Kn(this.h+e.hueShift);return new In(t,n,Wn(n,r),this.alpha)}mix(e,t){if(!(t>=0&&t<=1))throw RangeError(`Oklch.mix: t must be in [0, 1]; got ${t}`);return this.#e(e,t,t,t,t)}mixAxes(e,t){for(let e of Ln){let n=t[e];if(!(n>=0&&n<=1))throw RangeError(`Oklch.mixAxes: ${e} weight must be in [0, 1]; got ${n}`)}return this.#e(e,t.l,t.c,t.h,t.alpha)}#e(e,t,n,r,i){let a=this.c>=Un,o=e.c>=Un,s=Kn(a?this.h:o?e.h:0),c=Kn(o?e.h:s),l=c-s,u=l<-180?s-360:s,d=l>180?c-360:c,f=Gn(this.c,e.c,n);return new In(Gn(this.l,e.l,t),f,Wn(f,Kn(Gn(u,d,r))),Gn(this.alpha,e.alpha,i))}deltaE(e){let t=this.h*Math.PI/180,n=e.h*Math.PI/180;return Math.hypot(this.l-e.l,this.c*Math.cos(t)-e.c*Math.cos(n),this.c*Math.sin(t)-e.c*Math.sin(n))}toLinearRgb(e,t,n){let r=Math.PI/180*n,i=t*Math.cos(r),a=t*Math.sin(r),o=e+.3963377774*i+.2158037573*a,s=e-.1055613458*i-.0638541728*a,c=e-.0894841775*i-1.291485548*a,l=o*o*o,u=s*s*s,d=c*c*c;return{r:4.0767416621*l-3.3077115913*u+.2309699292*d,g:-1.2684380046*l+2.6097574011*u-.3413193965*d,b:-.0041960863*l-.7034186147*u+1.707614701*d}}findInGamutChroma(e,t,n){let r=this.toLinearRgb(e,t,n);if(qn(r.r,r.g,r.b))return t;let i=0,a=t;for(let t=0;t<24;t++){let t=(i+a)/2,r=this.toLinearRgb(e,t,n);qn(r.r,r.g,r.b)?i=t:a=t}return i}};In=Jn;var Yn=class extends Error{ref;constructor(e,t){super(`color reference ${JSON.stringify(e)} did not resolve — ${t}`),this.ref=e,this.name=`ColorRefError`}};const Xn=/^#[0-9a-fA-F]{6}([0-9a-fA-F]{2})?$/;function Zn(e){let t=e.trim();if(!Xn.test(t))throw new Yn(e,`expected #RRGGBB or #RRGGBBAA`);let n=t.slice(1);return t.length>7?wn(n):Cn(n)}function Qn(e,t){let n=t.trim();if(n.startsWith(`#`))return Zn(n);let r=e.get(n);if(r===void 0)throw new Yn(t,`no such variable in palette ${JSON.stringify(e.name)}`+$n(e,n));return r}function $n(e,t){let n=t.split(`-`),r=[...e.vars.keys()].filter(e=>n.some(t=>t!==``&&e.includes(t))).slice(0,8);return r.length===0?``:`; did you mean: ${r.join(`, `)}`}function er(e){let t=e.red/255,n=e.green/255,r=e.blue/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2,s=i-a;if(s===0)return{h:0,s:0,l:o};let c=s/(o>.5?2-i-a:i+a),l;return l=i===t?(n-r)/s%6:i===n?(r-t)/s+2:(t-n)/s+4,l=(l*60+360)%360,{h:l,s:c,l:o}}function tr(e){let t=Math.round(e);return t<0?0:t>255?255:t}function nr(e){let{h:t,s:n,l:r}=e;if(n===0){let e=tr(r*255);return new F(e,e,e)}let i=(1-Math.abs(2*r-1))*n,a=t/60,o=i*(1-Math.abs(a%2-1)),s=0,c=0,l=0;a<1?[s,c,l]=[i,o,0]:a<2?[s,c,l]=[o,i,0]:a<3?[s,c,l]=[0,i,o]:a<4?[s,c,l]=[0,o,i]:a<5?[s,c,l]=[o,0,i]:[s,c,l]=[i,0,o];let u=r-i/2;return new F(tr((s+u)*255),tr((c+u)*255),tr((l+u)*255))}function rr(e){return e<0?0:e>1?1:e}function ir(e,t){let n=er(e);return n.l=rr(n.l-.1*t),nr(n)}function ar(e,t=tn){return nn(lr(e,t))>.179?new F(0,0,0):new F(255,255,255)}function or(e,t,n=4.5,r=I.TRUECOLOR,i=tn){let a=lr(t,i),o=dr(e,a,n),s=ur[r];if(s===void 0)return o;let c=cr(a,r,i);return rn(cr(o,r,i),c)>=n?o:s.get(s.matchReadable(o,c,n))}function sr(e,t,n,r=tn){let i=lr(e,r),a=e=>cr(e,t,r);if(n(a(i),a))return i;let o=ur[t],s=o?.matchWhere(i,e=>n(e,a));return s===void 0?void 0:o.get(s)}function cr(e,t,n=tn){let r=lr(e,n),i=ur[t];return i===void 0?r:i.get(i.match(r))}function lr(e,t){if(t.alpha!==1)throw RangeError(`a contrast substrate is the opaque surface under a translucent background; got ${t.hex}`);return e.compositeOver(t)}const ur={[I.EIGHT_BIT]:Mn,[I.STANDARD]:An};function dr(e,t,n){let r=e.compositeOver(t);if(rn(r,t)>=n)return r;let i=Jn.fromRgba(r),a=nn(t)>.179?0:1;if(rn(new Jn(a,i.c,i.h,i.alpha).toRgba(),t)<n)return ar(t);let o=i.l,s=a;for(let e=0;e<20;e++){let e=(o+s)/2;rn(new Jn(e,i.c,i.h,i.alpha).toRgba(),t)>=n?s=e:o=e}return new Jn(s,i.c,i.h,i.alpha).toRgba()}const fr={name:`atom-one-dark`,dark:!0,ansi:{black:`#282C34`,red:`#E06C75`,green:`#98C379`,yellow:`#E5C07B`,blue:`#61AFEF`,magenta:`#C678DD`,cyan:`#56B6C2`,white:`#DCDFE4`,brightBlack:`#5D677A`,brightRed:`#E06C75`,brightGreen:`#98C379`,brightYellow:`#E5C07B`,brightBlue:`#61AFEF`,brightMagenta:`#C678DD`,brightCyan:`#56B6C2`,brightWhite:`#DCDFE4`},vars:{accent:`#A378C2`,"accent-darken-1":`#8E65AD`,"accent-darken-2":`#7A5299`,"accent-darken-3":`#674085`,"accent-lighten-1":`#B78BD6`,"accent-lighten-2":`#CC9FEC`,"accent-lighten-3":`#E2B3FF`,"accent-muted":`#4C425E`,background:`#282C34`,"background-darken-1":`#181C23`,"background-darken-2":`#050A14`,"background-darken-3":`#000000`,"background-lighten-1":`#383C44`,"background-lighten-2":`#494D56`,"background-lighten-3":`#5B5F68`,"block-cursor-background":`#61AFEF`,"block-cursor-blurred-background":`#61AFEF4C`,"block-cursor-blurred-foreground":`#ABB2BF`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#61AFEF`,"border-blurred":`#353B47`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#ABB2BF`,error:`#EF6262`,"error-darken-1":`#D84D50`,"error-darken-2":`#C1373E`,"error-darken-3":`#AA1F2E`,"error-lighten-1":`#FF7674`,"error-lighten-2":`#FF8B87`,"error-lighten-3":`#FFA09B`,"error-muted":`#643C41`,"footer-background":`#4F5666`,"footer-description-background":`#00000000`,"footer-description-foreground":`#ABB2BF`,"footer-foreground":`#ABB2BF`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#A378C2`,foreground:`#ABB2BF`,"foreground-darken-1":`#979DAA`,"foreground-darken-2":`#838A96`,"foreground-darken-3":`#707783`,"foreground-disabled":`#ABB2BF60`,"foreground-lighten-1":`#BFC6D3`,"foreground-lighten-2":`#D4DBE8`,"foreground-lighten-3":`#E9F0FE`,"foreground-muted":`#ABB2BF99`,"input-cursor-background":`#ABB2BF`,"input-cursor-foreground":`#282C34`,"input-selection-background":`#77C3FF66`,"link-background":`#00000000`,"link-background-hover":`#61AFEF`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#61AFEF`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#61AFEF`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#61AFEF`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#ABB2BF`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#ABB2BF`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#ABB2BF99`,panel:`#4F5666`,"panel-darken-1":`#3D4453`,"panel-darken-2":`#2C3342`,"panel-darken-3":`#1C2331`,"panel-lighten-1":`#616878`,"panel-lighten-2":`#737A8B`,"panel-lighten-3":`#868E9F`,primary:`#61AFEF`,"primary-background":`#4F5B6A`,"primary-background-darken-1":`#3F4D5D`,"primary-background-darken-2":`#303F50`,"primary-background-darken-3":`#303F50`,"primary-background-lighten-1":`#5E6A77`,"primary-background-lighten-2":`#6E7884`,"primary-background-lighten-3":`#7D8791`,"primary-darken-1":`#489BD9`,"primary-darken-2":`#2C87C4`,"primary-darken-3":`#0074AF`,"primary-lighten-1":`#77C3FF`,"primary-lighten-2":`#8ED8FF`,"primary-lighten-3":`#A4EDFF`,"primary-muted":`#39536C`,scrollbar:`#355674`,"scrollbar-active":`#61AFEF`,"scrollbar-background":`#181C23`,"scrollbar-background-active":`#181C23`,"scrollbar-background-hover":`#181C23`,"scrollbar-corner-color":`#181C23`,"scrollbar-hover":`#3C6589`,secondary:`#C678DD`,"secondary-background":`#5B5567`,"secondary-background-darken-1":`#4D465A`,"secondary-background-darken-2":`#3F374D`,"secondary-background-darken-3":`#3F374D`,"secondary-background-lighten-1":`#6A6475`,"secondary-background-lighten-2":`#787382`,"secondary-background-lighten-3":`#87828F`,"secondary-darken-1":`#B064C7`,"secondary-darken-2":`#9B50B3`,"secondary-darken-3":`#873D9E`,"secondary-lighten-1":`#DB8CF2`,"secondary-lighten-2":`#F1A0FF`,"secondary-lighten-3":`#FFB5FF`,"secondary-muted":`#574266`,success:`#62F062`,"success-darken-1":`#48DA4D`,"success-darken-2":`#29C438`,"success-darken-3":`#00AF22`,"success-lighten-1":`#7AFF76`,"success-lighten-2":`#91FF8A`,"success-lighten-3":`#A8FF9F`,"success-muted":`#396641`,surface:`#3B414D`,"surface-active":`#484E5B`,"surface-darken-1":`#2A303B`,"surface-darken-2":`#1A202B`,"surface-darken-3":`#09101B`,"surface-lighten-1":`#4C525E`,"surface-lighten-2":`#5E6471`,"surface-lighten-3":`#707684`,text:`#FFFFFFDD`,"text-accent":`#C2A5D6`,"text-disabled":`#FFFFFF60`,"text-error":`#F59797`,"text-muted":`#FFFFFF99`,"text-primary":`#96CAF4`,"text-secondary":`#D9A5E8`,"text-success":`#97F597`,"text-warning":`#E9CC92`,warning:`#DDB25B`,"warning-darken-1":`#C79D47`,"warning-darken-2":`#B28A34`,"warning-darken-3":`#9C7721`,"warning-lighten-1":`#F4C66E`,"warning-lighten-2":`#FFDB82`,"warning-lighten-3":`#FFF096`,"warning-muted":`#5E543F`}},pr={name:`atom-one-light`,dark:!1,ansi:{black:`#383A42`,red:`#E45649`,green:`#50A14F`,yellow:`#C18401`,blue:`#0184BC`,magenta:`#A626A4`,cyan:`#0997B3`,white:`#BABABA`,brightBlack:`#4F525E`,brightRed:`#E06C75`,brightGreen:`#98C379`,brightYellow:`#D8B36E`,brightBlue:`#61AFEF`,brightMagenta:`#C678DD`,brightCyan:`#56B6C2`,brightWhite:`#FFFFFF`},vars:{accent:`#BE9232`,"accent-darken-1":`#A97E1D`,"accent-darken-2":`#936B01`,"accent-darken-3":`#7E5900`,"accent-lighten-1":`#D5A545`,"accent-lighten-2":`#EBB959`,"accent-lighten-3":`#FFCE6C`,"accent-muted":`#E8DABE`,background:`#FAFAFA`,"background-darken-1":`#E4E4E4`,"background-darken-2":`#CFCFCF`,"background-darken-3":`#BABABA`,"background-lighten-1":`#FFFFFF`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#4078F2`,"block-cursor-blurred-background":`#4078F24C`,"block-cursor-blurred-foreground":`#383A42`,"block-cursor-foreground":`#000000DD`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#4078F2`,"border-blurred":`#D8D8D8`,"button-color-foreground":`#000000DD`,"button-foreground":`#383A42`,error:`#F13F3F`,"error-darken-1":`#D9232D`,"error-darken-2":`#C1001D`,"error-darken-3":`#A9000D`,"error-lighten-1":`#FF5650`,"error-lighten-2":`#FF6C62`,"error-lighten-3":`#FF8275`,"error-muted":`#F7C1C1`,"footer-background":`#CCCCCC`,"footer-description-background":`#00000000`,"footer-description-foreground":`#383A42`,"footer-foreground":`#383A42`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#BF9232`,foreground:`#383A42`,"foreground-darken-1":`#272931`,"foreground-darken-2":`#181A21`,"foreground-darken-3":`#040612`,"foreground-disabled":`#383A4260`,"foreground-lighten-1":`#494B53`,"foreground-lighten-2":`#5A5C65`,"foreground-lighten-3":`#6D6F78`,"foreground-muted":`#383A4299`,"input-cursor-background":`#383A42`,"input-cursor-foreground":`#FAFAFA`,"input-selection-background":`#5C8AFF66`,"link-background":`#00000000`,"link-background-hover":`#4078F2`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#4078F2`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#4078F2`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#4078F2`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#383A42`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#383A42`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#383A4299`,panel:`#CCCCCC`,"panel-darken-1":`#B7B7B7`,"panel-darken-2":`#A3A3A3`,"panel-darken-3":`#8F8F8F`,"panel-lighten-1":`#E1E1E1`,"panel-lighten-2":`#F6F6F6`,"panel-lighten-3":`#FFFFFF`,primary:`#4078F2`,"primary-background":`#4078F2`,"primary-background-darken-1":`#1865DC`,"primary-background-darken-2":`#0053C6`,"primary-background-darken-3":`#0043B1`,"primary-background-lighten-1":`#5C8AFF`,"primary-background-lighten-2":`#759EFF`,"primary-background-lighten-3":`#8DB2FF`,"primary-darken-1":`#1865DC`,"primary-darken-2":`#0053C6`,"primary-darken-3":`#0043B1`,"primary-lighten-1":`#5C8AFF`,"primary-lighten-2":`#759EFF`,"primary-lighten-3":`#8DB2FF`,"primary-muted":`#C2D3F7`,scrollbar:`#A2B8E9`,"scrollbar-active":`#4078F2`,"scrollbar-background":`#E4E4E4`,"scrollbar-background-active":`#E4E4E4`,"scrollbar-background-hover":`#E4E4E4`,"scrollbar-corner-color":`#E4E4E4`,"scrollbar-hover":`#92AEEB`,secondary:`#A626A4`,"secondary-background":`#A626A4`,"secondary-background-darken-1":`#90008F`,"secondary-background-darken-2":`#7B007C`,"secondary-background-darken-3":`#670069`,"secondary-background-lighten-1":`#BB3EB8`,"secondary-background-lighten-2":`#D154CD`,"secondary-background-lighten-3":`#E769E2`,"secondary-darken-1":`#90008F`,"secondary-darken-2":`#7B007C`,"secondary-darken-3":`#670069`,"secondary-lighten-1":`#BB3EB8`,"secondary-lighten-2":`#D154CD`,"secondary-lighten-3":`#E769E2`,"secondary-muted":`#E0BAE0`,success:`#6BF23F`,"success-darken-1":`#52DC25`,"success-darken-2":`#36C600`,"success-darken-3":`#05B100`,"success-lighten-1":`#83FF55`,"success-lighten-2":`#9BFF6B`,"success-lighten-3":`#B2FF80`,"success-muted":`#CFF7C1`,surface:`#E0E0E0`,"surface-active":`#F1F1F1`,"surface-darken-1":`#CACACA`,"surface-darken-2":`#B6B6B6`,"surface-darken-3":`#A2A2A2`,"surface-lighten-1":`#F5F5F5`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#7E6021`,"text-disabled":`#00000060`,"text-error":`#9F2929`,"text-muted":`#00000099`,"text-primary":`#2A4F9F`,"text-secondary":`#6D196C`,"text-success":`#479F29`,"text-warning":`#8E8F24`,warning:`#D7D938`,"warning-darken-1":`#C1C41C`,"warning-darken-2":`#ABAF00`,"warning-darken-3":`#969B00`,"warning-lighten-1":`#EEEE4E`,"warning-lighten-2":`#FFFF64`,"warning-lighten-3":`#FFFF79`,"warning-muted":`#EFF0BF`}},mr={name:`catppuccin-frappe`,dark:!0,ansi:{black:`#51576D`,red:`#E78284`,green:`#A6D189`,yellow:`#E5C890`,blue:`#8CAAEE`,magenta:`#F4B8E4`,cyan:`#81C8BE`,white:`#B5BFE2`,brightBlack:`#626880`,brightRed:`#EDA0A2`,brightGreen:`#B9DBA2`,brightYellow:`#ECD7AE`,brightBlue:`#ADC2F3`,brightMagenta:`#F38ED8`,brightCyan:`#98D2CA`,brightWhite:`#A5ADCE`},vars:{accent:`#F4B8E4`,"accent-darken-1":`#DEA3CE`,"accent-darken-2":`#C98FBA`,"accent-darken-3":`#B47BA5`,"accent-lighten-1":`#FFCCF9`,"accent-lighten-2":`#FFE2FF`,"accent-lighten-3":`#FFF7FF`,"accent-muted":`#6A5B75`,background:`#303446`,"background-darken-1":`#1F2435`,"background-darken-2":`#101424`,"background-darken-3":`#000016`,"background-lighten-1":`#404457`,"background-lighten-2":`#525669`,"background-lighten-3":`#64687C`,"block-cursor-background":`#CA9EE6`,"block-cursor-blurred-background":`#CA9EE64C`,"block-cursor-blurred-foreground":`#C6D0F5`,"block-cursor-foreground":`#292C3C`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#BABBF1`,"border-blurred":`#838BA7`,"button-color-foreground":`#303446`,"button-foreground":`#C6D0F5`,error:`#E68284`,"error-darken-1":`#D06E71`,"error-darken-2":`#BA5A5E`,"error-darken-3":`#A4474C`,"error-lighten-1":`#FD9697`,"error-lighten-2":`#FFAAAB`,"error-lighten-3":`#FFBFBF`,"error-muted":`#664B58`,"footer-background":`#51576D`,"footer-description-background":`#00000000`,"footer-description-foreground":`#C6D0F5`,"footer-foreground":`#C6D0F5`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#F4B8E4`,foreground:`#C6D0F5`,"foreground-darken-1":`#B1BBDF`,"foreground-darken-2":`#9CA7CA`,"foreground-darken-3":`#8993B5`,"foreground-disabled":`#C6D0F560`,"foreground-lighten-1":`#DBE5FF`,"foreground-lighten-2":`#F0FAFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#C6D0F599`,"input-cursor-background":`#F2D5CF`,"input-cursor-foreground":`#232634`,"input-selection-background":`#949CBB4C`,"link-background":`#00000000`,"link-background-hover":`#CA9EE6`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#CA9EE6`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#CA9EE6`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#CA9EE6`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#C6D0F5`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#C6D0F5`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#C6D0F599`,panel:`#51576D`,"panel-darken-1":`#3F455A`,"panel-darken-2":`#2E3448`,"panel-darken-3":`#1D2437`,"panel-lighten-1":`#63697F`,"panel-lighten-2":`#767B93`,"panel-lighten-3":`#898FA7`,primary:`#CA9EE6`,"primary-background":`#625F76`,"primary-background-darken-1":`#54516A`,"primary-background-darken-2":`#47435E`,"primary-background-darken-3":`#47435E`,"primary-background-lighten-1":`#706D82`,"primary-background-lighten-2":`#7E7B8E`,"primary-background-lighten-3":`#8C899A`,"primary-darken-1":`#B58AD0`,"primary-darken-2":`#A076BB`,"primary-darken-3":`#8C63A7`,"primary-lighten-1":`#DFB2FB`,"primary-lighten-2":`#F4C7FF`,"primary-lighten-3":`#FFDCFF`,"primary-muted":`#5E5376`,scrollbar:`#63547B`,"scrollbar-active":`#CA9EE6`,"scrollbar-background":`#1F2435`,"scrollbar-background-active":`#1F2435`,"scrollbar-background-hover":`#1F2435`,"scrollbar-corner-color":`#1F2435`,"scrollbar-hover":`#74618D`,secondary:`#EE9F76`,"secondary-background":`#666067`,"secondary-background-darken-1":`#59525A`,"secondary-background-darken-2":`#4C444D`,"secondary-background-darken-3":`#4C444D`,"secondary-background-lighten-1":`#746E75`,"secondary-background-lighten-2":`#817C82`,"secondary-background-lighten-3":`#8F8A8F`,"secondary-darken-1":`#D88B63`,"secondary-darken-2":`#C27750`,"secondary-darken-3":`#AC643E`,"secondary-lighten-1":`#FFB389`,"secondary-lighten-2":`#FFC89D`,"secondary-lighten-3":`#FFDDB1`,"secondary-muted":`#695454`,success:`#A6D189`,"success-darken-1":`#91BC75`,"success-darken-2":`#7DA762`,"success-darken-3":`#6A9350`,"success-lighten-1":`#BAE69C`,"success-lighten-2":`#CFFBB1`,"success-lighten-3":`#E5FFC5`,"success-muted":`#53635A`,surface:`#414559`,"surface-active":`#4F5267`,"surface-darken-1":`#303447`,"surface-darken-2":`#1F2436`,"surface-darken-3":`#101526`,"surface-lighten-1":`#52566B`,"surface-lighten-2":`#64687E`,"surface-lighten-3":`#777B91`,text:`#FFFFFFDD`,"text-accent":`#F7D0ED`,"text-disabled":`#FFFFFF60`,"text-error":`#EFACAD`,"text-muted":`#FFFFFF99`,"text-primary":`#DCBEEE`,"text-secondary":`#F4BFA4`,"text-success":`#C4E0B1`,"text-warning":`#EDDAB5`,warning:`#E4C890`,"warning-darken-1":`#CFB37C`,"warning-darken-2":`#BA9F69`,"warning-darken-3":`#A58B56`,"warning-lighten-1":`#FADCA4`,"warning-lighten-2":`#FFF2B8`,"warning-lighten-3":`#FFFFCD`,"warning-muted":`#66605C`}},hr={name:`catppuccin-latte`,dark:!1,ansi:{black:`#BCC0CC`,red:`#D20F39`,green:`#40A02B`,yellow:`#DF8E1D`,blue:`#1E66F5`,magenta:`#EA76CB`,cyan:`#179299`,white:`#5C5F77`,brightBlack:`#ACB0BE`,brightRed:`#E7103F`,brightGreen:`#46B02F`,brightYellow:`#E49931`,brightBlue:`#3878F6`,brightMagenta:`#EF95D7`,brightCyan:`#19A1A8`,brightWhite:`#6C6F85`},vars:{accent:`#FD640B`,"accent-darken-1":`#E54F00`,"accent-darken-2":`#CC3900`,"accent-darken-3":`#B42200`,"accent-lighten-1":`#FF7825`,"accent-lighten-2":`#FF8D3A`,"accent-lighten-3":`#FFA24F`,"accent-muted":`#F3C6AE`,background:`#EFF1F5`,"background-darken-1":`#D9DBDF`,"background-darken-2":`#C4C6CA`,"background-darken-3":`#B0B2B5`,"background-lighten-1":`#FFFFFF`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#8839EF`,"block-cursor-blurred-background":`#8839EF4C`,"block-cursor-blurred-foreground":`#4C4F69`,"block-cursor-foreground":`#000000DD`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#8839EF`,"border-blurred":`#DEE1E7`,"button-color-foreground":`#EFF1F5`,"button-foreground":`#4C4F69`,error:`#D10F39`,"error-darken-1":`#BA0028`,"error-darken-2":`#A20019`,"error-darken-3":`#8A0008`,"error-lighten-1":`#EA324A`,"error-lighten-2":`#FF4B5B`,"error-lighten-3":`#FF626E`,"error-muted":`#E6ADBC`,"footer-background":`#CCD0DA`,"footer-description-background":`#00000000`,"footer-description-foreground":`#4C4F69`,"footer-foreground":`#4C4F69`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FE640B`,foreground:`#4C4F69`,"foreground-darken-1":`#3A3D56`,"foreground-darken-2":`#292D45`,"foreground-darken-3":`#191D34`,"foreground-disabled":`#4C4F6960`,"foreground-lighten-1":`#5E607B`,"foreground-lighten-2":`#70738F`,"foreground-lighten-3":`#8386A2`,"foreground-muted":`#4C4F6999`,"input-cursor-background":`#4C4F69`,"input-cursor-foreground":`#EFF1F5`,"input-selection-background":`#9E4DFF66`,"link-background":`#00000000`,"link-background-hover":`#8839EF`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#8839EF`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#8839EF`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#8839EF`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#4C4F69`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#4C4F69`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#4C4F6999`,panel:`#CCD0DA`,"panel-darken-1":`#B7BBC5`,"panel-darken-2":`#A3A6B0`,"panel-darken-3":`#8F939C`,"panel-lighten-1":`#E1E5EF`,"panel-lighten-2":`#F6FAFF`,"panel-lighten-3":`#FFFFFF`,primary:`#8839EF`,"primary-background":`#8839EF`,"primary-background-darken-1":`#7122D9`,"primary-background-darken-2":`#5901C3`,"primary-background-darken-3":`#4000AE`,"primary-background-lighten-1":`#9E4DFF`,"primary-background-lighten-2":`#B562FF`,"primary-background-lighten-3":`#CC76FF`,"primary-darken-1":`#7122D9`,"primary-darken-2":`#5901C3`,"primary-darken-3":`#4000AE`,"primary-lighten-1":`#9E4DFF`,"primary-lighten-2":`#B562FF`,"primary-lighten-3":`#CC76FF`,"primary-muted":`#D0B9F3`,scrollbar:`#B89AE5`,"scrollbar-active":`#8839EF`,"scrollbar-background":`#D9DBDF`,"scrollbar-background-active":`#D9DBDF`,"scrollbar-background-hover":`#D9DBDF`,"scrollbar-corner-color":`#D9DBDF`,"scrollbar-hover":`#B08AE7`,secondary:`#DB8A78`,"secondary-background":`#DB8A78`,"secondary-background-darken-1":`#C57665`,"secondary-background-darken-2":`#B06353`,"secondary-background-darken-3":`#9A5041`,"secondary-background-lighten-1":`#F29D8B`,"secondary-background-lighten-2":`#FFB29E`,"secondary-background-lighten-3":`#FFC7B3`,"secondary-darken-1":`#C57665`,"secondary-darken-2":`#B06353`,"secondary-darken-3":`#9A5041`,"secondary-lighten-1":`#F29D8B`,"secondary-lighten-2":`#FFB29E`,"secondary-lighten-3":`#FFC7B3`,"secondary-muted":`#E9D2CF`,success:`#40A02B`,"success-darken-1":`#278B14`,"success-darken-2":`#007800`,"success-darken-3":`#006400`,"success-lighten-1":`#56B43F`,"success-lighten-2":`#6BC952`,"success-lighten-3":`#81DE66`,"success-muted":`#BAD8B8`,surface:`#E6E9EF`,"surface-active":`#F7FAFF`,"surface-darken-1":`#D0D3D9`,"surface-darken-2":`#BCBFC4`,"surface-darken-3":`#A7AAB0`,"surface-lighten-1":`#FBFEFF`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#A74207`,"text-disabled":`#00000060`,"text-error":`#8A0925`,"text-muted":`#00000099`,"text-primary":`#59259D`,"text-secondary":`#915B4F`,"text-success":`#2A691C`,"text-warning":`#935D13`,warning:`#DE8E1D`,"warning-darken-1":`#C77A00`,"warning-darken-2":`#B06700`,"warning-darken-3":`#9A5500`,"warning-lighten-1":`#F6A134`,"warning-lighten-2":`#FFB648`,"warning-lighten-3":`#FFCA5D`,"warning-muted":`#EAD3B4`}},gr={name:`catppuccin-macchiato`,dark:!0,ansi:{black:`#494D64`,red:`#ED8796`,green:`#A6DA95`,yellow:`#EED49F`,blue:`#8AADF4`,magenta:`#F5BDE6`,cyan:`#8BD5CA`,white:`#B8C0E0`,brightBlack:`#5B6078`,brightRed:`#F2A7B2`,brightGreen:`#BDE3B0`,brightYellow:`#F4E3C1`,brightBlue:`#ADC5F7`,brightMagenta:`#F493DA`,brightCyan:`#A5DED6`,brightWhite:`#A5ADCB`},vars:{accent:`#F5BDE6`,"accent-darken-1":`#DFA8D0`,"accent-darken-2":`#CA94BC`,"accent-darken-3":`#B580A7`,"accent-lighten-1":`#FFD1FB`,"accent-lighten-2":`#FFE7FF`,"accent-lighten-3":`#FFFCFF`,"accent-muted":`#62546D`,background:`#24273A`,"background-darken-1":`#141729`,"background-darken-2":`#00021A`,"background-darken-3":`#000007`,"background-lighten-1":`#34374B`,"background-lighten-2":`#45485C`,"background-lighten-3":`#57596F`,"block-cursor-background":`#C6A0F6`,"block-cursor-blurred-background":`#C6A0F64C`,"block-cursor-blurred-foreground":`#CAD3F5`,"block-cursor-foreground":`#1E2030`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#B7BDF8`,"border-blurred":`#737994`,"button-color-foreground":`#24273A`,"button-foreground":`#CAD3F5`,error:`#ED8796`,"error-darken-1":`#D67382`,"error-darken-2":`#C05F6F`,"error-darken-3":`#AB4C5D`,"error-lighten-1":`#FF9BA9`,"error-lighten-2":`#FFAFBE`,"error-lighten-3":`#FFC4D3`,"error-muted":`#604355`,"footer-background":`#494D64`,"footer-description-background":`#00000000`,"footer-description-foreground":`#CAD3F5`,"footer-foreground":`#CAD3F5`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#F5BDE6`,foreground:`#CAD3F5`,"foreground-darken-1":`#B5BEDF`,"foreground-darken-2":`#A0A9CA`,"foreground-darken-3":`#8C95B5`,"foreground-disabled":`#CAD3F560`,"foreground-lighten-1":`#DFE8FF`,"foreground-lighten-2":`#F4FDFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#CAD3F599`,"input-cursor-background":`#F4DBD6`,"input-cursor-foreground":`#181926`,"input-selection-background":`#838BA74C`,"link-background":`#00000000`,"link-background-hover":`#C6A0F6`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#C6A0F6`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#C6A0F6`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#C6A0F6`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#CAD3F5`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#CAD3F5`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#CAD3F599`,panel:`#494D64`,"panel-darken-1":`#373B51`,"panel-darken-2":`#262B40`,"panel-darken-3":`#161C2F`,"panel-lighten-1":`#5A5E76`,"panel-lighten-2":`#6D7189`,"panel-lighten-3":`#80849D`,primary:`#C6A0F6`,"primary-background":`#59566F`,"primary-background-darken-1":`#4A4762`,"primary-background-darken-2":`#3C3956`,"primary-background-darken-3":`#3C3956`,"primary-background-lighten-1":`#67657C`,"primary-background-lighten-2":`#767488`,"primary-background-lighten-3":`#858395`,"primary-darken-1":`#B08CE0`,"primary-darken-2":`#9C78CB`,"primary-darken-3":`#8865B6`,"primary-lighten-1":`#DBB4FF`,"primary-lighten-2":`#F1C9FF`,"primary-lighten-3":`#FFDEFF`,"primary-muted":`#544B72`,scrollbar:`#5B4D7B`,"scrollbar-active":`#C6A0F6`,"scrollbar-background":`#141729`,"scrollbar-background-active":`#141729`,"scrollbar-background-hover":`#141729`,"scrollbar-corner-color":`#141729`,"scrollbar-hover":`#6D5B8F`,secondary:`#F4A97F`,"secondary-background":`#5F5760`,"secondary-background-darken-1":`#514852`,"secondary-background-darken-2":`#433A44`,"secondary-background-darken-3":`#433A44`,"secondary-background-lighten-1":`#6D666E`,"secondary-background-lighten-2":`#7B757C`,"secondary-background-lighten-3":`#89838A`,"secondary-darken-1":`#DE946B`,"secondary-darken-2":`#C88159`,"secondary-darken-3":`#B26E47`,"secondary-lighten-1":`#FFBD92`,"secondary-lighten-2":`#FFD2A6`,"secondary-lighten-3":`#FFE7BB`,"secondary-muted":`#624E4E`,success:`#A6DA95`,"success-darken-1":`#91C481`,"success-darken-2":`#7DB06E`,"success-darken-3":`#6A9C5B`,"success-lighten-1":`#BAEFA9`,"success-lighten-2":`#CFFFBD`,"success-lighten-3":`#E5FFD2`,"success-muted":`#4B5C55`,surface:`#363A4F`,"surface-active":`#43475D`,"surface-darken-1":`#25293D`,"surface-darken-2":`#151A2D`,"surface-darken-3":`#03061D`,"surface-lighten-1":`#474B60`,"surface-lighten-2":`#595C73`,"surface-lighten-3":`#6B6F86`,text:`#FFFFFFDD`,"text-accent":`#F8D3EE`,"text-disabled":`#FFFFFF60`,"text-error":`#F3AFB9`,"text-muted":`#FFFFFF99`,"text-primary":`#D9C0F9`,"text-secondary":`#F8C6AA`,"text-success":`#C4E6B9`,"text-warning":`#F3E2BF`,warning:`#EED49F`,"warning-darken-1":`#D8BF8B`,"warning-darken-2":`#C3AA77`,"warning-darken-3":`#AE9664`,"warning-lighten-1":`#FFE9B3`,"warning-lighten-2":`#FFFEC7`,"warning-lighten-3":`#FFFFDD`,"warning-muted":`#605A58`}},_r={name:`catppuccin-mocha`,dark:!0,ansi:{black:`#45475A`,red:`#F38BA8`,green:`#A6E3A1`,yellow:`#F9E2AF`,blue:`#89B4FA`,magenta:`#F5C2E7`,cyan:`#94E2D5`,white:`#BAC2DE`,brightBlack:`#585B70`,brightRed:`#F7AEC2`,brightGreen:`#C2ECBF`,brightYellow:`#FCD682`,brightBlue:`#AECCFC`,brightMagenta:`#F398DA`,brightCyan:`#B1EAE1`,brightWhite:`#A6ADC8`},vars:{accent:`#F9B387`,"accent-darken-1":`#E39E73`,"accent-darken-2":`#CD8A60`,"accent-darken-3":`#B7774E`,"accent-lighten-1":`#FFC79A`,"accent-lighten-2":`#FFDCAE`,"accent-lighten-3":`#FFF2C3`,"accent-muted":`#5B4642`,background:`#181825`,"background-darken-1":`#040216`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#272735`,"background-lighten-2":`#373746`,"background-lighten-3":`#484857`,"block-cursor-background":`#F5C2E7`,"block-cursor-blurred-background":`#F5C2E74C`,"block-cursor-blurred-foreground":`#CDD6F4`,"block-cursor-foreground":`#1E1E2E`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#B4BEFE`,"border-blurred":`#585B70`,"button-color-foreground":`#181825`,"button-foreground":`#CDD6F4`,error:`#F28FAD`,"error-darken-1":`#DB7A99`,"error-darken-2":`#C66785`,"error-darken-3":`#B05372`,"error-lighten-1":`#FFA3C1`,"error-lighten-2":`#FFB8D6`,"error-lighten-3":`#FFCDEB`,"error-muted":`#593B4D`,"footer-background":`#45475A`,"footer-description-background":`#00000000`,"footer-description-foreground":`#CDD6F4`,"footer-foreground":`#CDD6F4`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FAB387`,foreground:`#CDD6F4`,"foreground-darken-1":`#B8C1DE`,"foreground-darken-2":`#A3ACC9`,"foreground-darken-3":`#8F98B4`,"foreground-disabled":`#CDD6F460`,"foreground-lighten-1":`#E2EBFF`,"foreground-lighten-2":`#F7FFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#CDD6F499`,"input-cursor-background":`#F5E0DC`,"input-cursor-foreground":`#11111B`,"input-selection-background":`#9399B24C`,"link-background":`#00000000`,"link-background-hover":`#F5C2E7`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#F5C2E7`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#F5C2E7`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#F5C2E7`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#CDD6F4`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#CDD6F4`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#CDD6F499`,panel:`#45475A`,"panel-darken-1":`#333648`,"panel-darken-2":`#232637`,"panel-darken-3":`#131627`,"panel-lighten-1":`#56586C`,"panel-lighten-2":`#696A7F`,"panel-lighten-3":`#7B7D92`,primary:`#F5C2E7`,"primary-background":`#564F5E`,"primary-background-darken-1":`#474050`,"primary-background-darken-2":`#393142`,"primary-background-darken-3":`#393142`,"primary-background-lighten-1":`#655F6C`,"primary-background-lighten-2":`#746E7A`,"primary-background-lighten-3":`#837E88`,"primary-darken-1":`#DFADD1`,"primary-darken-2":`#CA99BD`,"primary-darken-3":`#B585A8`,"primary-lighten-1":`#FFD6FC`,"primary-lighten-2":`#FFECFF`,"primary-lighten-3":`#FFFFFF`,"primary-muted":`#5A4B5F`,scrollbar:`#644E69`,"scrollbar-active":`#F5C2E7`,"scrollbar-background":`#040216`,"scrollbar-background-active":`#040216`,"scrollbar-background-hover":`#040216`,"scrollbar-corner-color":`#040216`,"scrollbar-hover":`#7C627E`,secondary:`#CBA6F7`,"secondary-background":`#504C60`,"secondary-background-darken-1":`#413C52`,"secondary-background-darken-2":`#322D44`,"secondary-background-darken-3":`#322D44`,"secondary-background-lighten-1":`#605C6E`,"secondary-background-lighten-2":`#6F6C7C`,"secondary-background-lighten-3":`#7E7B8A`,"secondary-darken-1":`#B592E1`,"secondary-darken-2":`#A17ECC`,"secondary-darken-3":`#8C6BB7`,"secondary-lighten-1":`#E0BAFF`,"secondary-lighten-2":`#F6CFFF`,"secondary-lighten-3":`#FFE4FF`,"secondary-muted":`#4D4264`,success:`#ABE9B3`,"success-darken-1":`#96D39E`,"success-darken-2":`#82BE8B`,"success-darken-3":`#6EAA77`,"success-lighten-1":`#BFFEC7`,"success-lighten-2":`#D5FFDC`,"success-lighten-3":`#EAFFF2`,"success-muted":`#44564F`,surface:`#313244`,"surface-active":`#3E3F51`,"surface-darken-1":`#202233`,"surface-darken-2":`#111223`,"surface-darken-3":`#000014`,"surface-lighten-1":`#414255`,"surface-lighten-2":`#535467`,"surface-lighten-3":`#65667A`,text:`#FFFFFFDD`,"text-accent":`#FBCCAF`,"text-disabled":`#FFFFFF60`,"text-error":`#F6B5C8`,"text-muted":`#FFFFFF99`,"text-primary":`#F8D6EF`,"text-secondary":`#DCC4F9`,"text-success":`#C7F0CC`,"text-warning":`#FBECCA`,warning:`#FAE3B0`,"warning-darken-1":`#E4CD9B`,"warning-darken-2":`#CEB988`,"warning-darken-3":`#B9A574`,"warning-lighten-1":`#FFF8C4`,"warning-lighten-2":`#FFFFD9`,"warning-lighten-3":`#FFFFEF`,"warning-muted":`#5B544E`}},vr=Object.fromEntries([`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`].map((e,t)=>[e,An.get(t).hex])),yr={black:`#1A1A1A`,red:`#F4005F`,green:`#98E024`,yellow:`#FD971F`,blue:`#9D65FF`,magenta:`#F4005F`,cyan:`#58D1EB`,white:`#C4C5B5`,brightBlack:`#625E4C`,brightRed:`#F4005F`,brightGreen:`#98E024`,brightYellow:`#E0D561`,brightBlue:`#9D65FF`,brightMagenta:`#F4005F`,brightCyan:`#58D1EB`,brightWhite:`#F6F6EF`},br={"atom-one-dark":fr,"atom-one-light":pr,"catppuccin-frappe":mr,"catppuccin-latte":hr,"catppuccin-macchiato":gr,"catppuccin-mocha":_r,cyberpunk:{name:`cyberpunk`,dark:!0,ansi:yr,vars:{background:`#070714`,"background-darken-1":`#03030A`,"background-darken-2":`#000003`,"background-darken-3":`#000000`,"background-lighten-1":`#11111E`,"background-lighten-2":`#1A1A2B`,"background-lighten-3":`#25253A`,foreground:`#E2E2FF`,"foreground-darken-1":`#CACAE4`,"foreground-darken-2":`#B3B3CC`,"foreground-darken-3":`#9C9CB5`,"foreground-disabled":`#E2E2FF60`,"foreground-lighten-1":`#EEEEFF`,"foreground-lighten-2":`#F6F6FF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#E2E2FF99`,primary:`#00E5FFD9`,"primary-darken-1":`#00CCE6D9`,"primary-darken-2":`#00B2CCD9`,"primary-darken-3":`#0099B3D9`,"primary-lighten-1":`#1AF0FFD9`,"primary-lighten-2":`#33F5FFD9`,"primary-lighten-3":`#4DFAFFD9`,"primary-muted":`#054A5BF4`,"primary-background":`#0A3340`,"primary-background-darken-1":`#072833`,"primary-background-darken-2":`#051E27`,"primary-background-darken-3":`#051E27`,"primary-background-lighten-1":`#0F404F`,"primary-background-lighten-2":`#154E5F`,"primary-background-lighten-3":`#1A5C6F`,secondary:`#FF1E8ECC`,"secondary-darken-1":`#E60A76CC`,"secondary-darken-2":`#CC005FCC`,"secondary-darken-3":`#B20048CC`,"secondary-lighten-1":`#FF3CA2CC`,"secondary-lighten-2":`#FF5AB6CC`,"secondary-lighten-3":`#FF78CACC`,"secondary-muted":`#510E39EF`,"secondary-background":`#3A0A28`,"secondary-background-darken-1":`#2E071F`,"secondary-background-darken-2":`#220517`,"secondary-background-darken-3":`#220517`,"secondary-background-lighten-1":`#470D33`,"secondary-background-lighten-2":`#54103F`,"secondary-background-lighten-3":`#61134B`,accent:`#EEFF00CC`,"accent-darken-1":`#D6E600CC`,"accent-darken-2":`#BECC00CC`,"accent-darken-3":`#A5B200CC`,"accent-lighten-1":`#FFFF26CC`,"accent-lighten-2":`#FFFF4DCC`,"accent-lighten-3":`#FFFF73CC`,"accent-muted":`#4C510EEF`,success:`#39FF14BF`,"success-darken-1":`#23E60ABF`,"success-darken-2":`#0FCC00BF`,"success-darken-3":`#00B200BF`,"success-lighten-1":`#4DFF32BF`,"success-lighten-2":`#69FF5ABF`,"success-lighten-3":`#87FF82BF`,"success-muted":`#164D14F0`,warning:`#FF6E00CC`,"warning-darken-1":`#E65800CC`,"warning-darken-2":`#CC4300CC`,"warning-darken-3":`#B23000CC`,"warning-lighten-1":`#FF8C26CC`,"warning-lighten-2":`#FFA54DCC`,"warning-lighten-3":`#FFBE73CC`,"warning-muted":`#51260EEF`,error:`#FF1133BF`,"error-darken-1":`#E6051EBF`,"error-darken-2":`#CC000CBF`,"error-darken-3":`#B20000BF`,"error-lighten-1":`#FF3758BF`,"error-lighten-2":`#FF5A78BF`,"error-lighten-3":`#FF7D96BF`,"error-muted":`#510A1DF0`,surface:`#0F0F22`,"surface-active":`#161630`,"surface-darken-1":`#08081A`,"surface-darken-2":`#040411`,"surface-darken-3":`#020209`,"surface-lighten-1":`#17172E`,"surface-lighten-2":`#1F1F3C`,"surface-lighten-3":`#28284A`,panel:`#0C0C1E`,"panel-darken-1":`#060614`,"panel-darken-2":`#03030C`,"panel-darken-3":`#010108`,"panel-lighten-1":`#14142C`,"panel-lighten-2":`#1C1C3A`,"panel-lighten-3":`#242448`,scrollbar:`#151535`,"scrollbar-active":`#00E5FFD9`,"scrollbar-background":`#040412`,"scrollbar-background-active":`#040412`,"scrollbar-background-hover":`#040412`,"scrollbar-corner-color":`#040412`,"scrollbar-hover":`#1F1F48`,"block-cursor-background":`#00E5FF`,"block-cursor-blurred-background":`#00E5FF4C`,"block-cursor-blurred-foreground":`#E2E2FF`,"block-cursor-foreground":`#070714`,"block-hover-background":`#00E5FF19`,boost:`#00E5FF0A`,"boost-darken-1":`#00CCE60A`,"boost-darken-2":`#00B2CC0A`,"boost-darken-3":`#0099B30A`,"boost-lighten-1":`#00E5FF0A`,"boost-lighten-2":`#00E5FF0A`,"boost-lighten-3":`#00E5FF0A`,border:`#00E5FFD9`,"border-blurred":`#1A1A35`,"button-color-foreground":`#070714`,"button-foreground":`#E2E2FF`,"footer-background":`#0C0C1E`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E2E2FF`,"footer-foreground":`#E2E2FF`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#00E5FFD9`,"input-cursor-background":`#E2E2FF`,"input-cursor-foreground":`#070714`,"input-selection-background":`#00E5FF40`,"link-background":`#00000000`,"link-background-hover":`#00E5FFD9`,"link-color":`#E2E2FFDD`,"link-color-hover":`#070714`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#00E5FFD9`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#00E5FFD9`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#FF1E8ECC`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E2E2FF`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E2E2FF`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#E2E2FF99`,text:`#E2E2FFDD`,"text-accent":`#F4FF66CC`,"text-disabled":`#E2E2FF60`,"text-error":`#FF6677BF`,"text-muted":`#E2E2FF99`,"text-primary":`#66F0FFD9`,"text-secondary":`#FF80B0CC`,"text-success":`#80FF55BF`,"text-warning":`#FFB055CC`}},default:{name:`default`,dark:!0,ansi:vr,vars:{accent:`#006FB8`,"accent-darken-1":`#005CA3`,"accent-darken-2":`#004B8F`,"accent-darken-3":`#003A7B`,"accent-lighten-1":`#3081CC`,"accent-lighten-2":`#4C95E2`,"accent-lighten-3":`#64A8F7`,"accent-muted":`#002137`,background:`#000000`,"background-darken-1":`#000000`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#161616`,"background-lighten-2":`#252525`,"background-lighten-3":`#353535`,"block-cursor-background":`#006FB8`,"block-cursor-blurred-background":`#006FB84C`,"block-cursor-blurred-foreground":`#FFFFFF`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#006FB8`,"border-blurred":`#191919`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#FFFFFF`,error:`#7F0000`,"error-darken-1":`#6A0000`,"error-darken-2":`#560000`,"error-darken-3":`#450000`,"error-lighten-1":`#961E12`,"error-lighten-2":`#AD3423`,"error-lighten-3":`#C44934`,"error-muted":`#260000`,"footer-background":`#242E35`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FFFFFF`,"footer-foreground":`#FFFFFF`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#006FB8`,foreground:`#FFFFFF`,"foreground-darken-1":`#E9E9E9`,"foreground-darken-2":`#D4D4D4`,"foreground-darken-3":`#BFBFBF`,"foreground-disabled":`#FFFFFF60`,"foreground-lighten-1":`#FFFFFF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#FFFFFF99`,"input-cursor-background":`#FFFFFF`,"input-cursor-foreground":`#000000`,"input-selection-background":`#3081CC66`,"link-background":`#00000000`,"link-background-hover":`#006FB8`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#006FB8`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#006FB8`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#006FB8`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#FFFFFF`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#FFFFFF`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#FFFFFF99`,panel:`#242E35`,"panel-darken-1":`#141E24`,"panel-darken-2":`#000D15`,"panel-darken-3":`#000000`,"panel-lighten-1":`#343E45`,"panel-lighten-2":`#454F57`,"panel-lighten-3":`#566169`,primary:`#006FB8`,"primary-background":`#26333D`,"primary-background-darken-1":`#13212C`,"primary-background-darken-2":`#00101B`,"primary-background-darken-3":`#00101B`,"primary-background-lighten-1":`#39454E`,"primary-background-lighten-2":`#4C575F`,"primary-background-lighten-3":`#5F6970`,"primary-darken-1":`#005CA3`,"primary-darken-2":`#004B8F`,"primary-darken-3":`#003A7B`,"primary-lighten-1":`#3081CC`,"primary-lighten-2":`#4C95E2`,"primary-lighten-3":`#64A8F7`,"primary-muted":`#002137`,scrollbar:`#002C49`,"scrollbar-active":`#006FB8`,"scrollbar-background":`#000000`,"scrollbar-background-active":`#000000`,"scrollbar-background-hover":`#000000`,"scrollbar-corner-color":`#000000`,"scrollbar-hover":`#00375C`,secondary:`#762671`,"secondary-background":`#342A33`,"secondary-background-darken-1":`#221721`,"secondary-background-darken-2":`#110510`,"secondary-background-darken-3":`#110510`,"secondary-background-lighten-1":`#463D45`,"secondary-background-lighten-2":`#585057`,"secondary-background-lighten-3":`#6A6269`,"secondary-darken-1":`#620F5E`,"secondary-darken-2":`#4E004C`,"secondary-darken-3":`#3B003A`,"secondary-lighten-1":`#8A3984`,"secondary-lighten-2":`#9E4C97`,"secondary-lighten-3":`#B360AB`,"secondary-muted":`#230B21`,success:`#008000`,"success-darken-1":`#006C00`,"success-darken-2":`#005900`,"success-darken-3":`#004600`,"success-lighten-1":`#29931C`,"success-lighten-2":`#42A832`,"success-lighten-3":`#58BD46`,"success-muted":`#002600`,surface:`#1E1E1E`,"surface-active":`#2A2A2A`,"surface-darken-1":`#0D0D0D`,"surface-darken-2":`#000000`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2D2D2D`,"surface-lighten-2":`#3E3E3E`,"surface-lighten-3":`#4F4F4F`,text:`#FFFFFFDD`,"text-accent":`#569FD0`,"text-disabled":`#FFFFFF60`,"text-error":`#AB5656`,"text-muted":`#FFFFFF99`,"text-primary":`#569FD0`,"text-secondary":`#A46FA1`,"text-success":`#56AB56`,"text-warning":`#ABAB56`,warning:`#7F8000`,"warning-darken-1":`#6B6D00`,"warning-darken-2":`#575A00`,"warning-darken-3":`#454900`,"warning-lighten-1":`#94931E`,"warning-lighten-2":`#A9A734`,"warning-lighten-3":`#BFBB48`,"warning-muted":`#262600`}},dracula:{name:`dracula`,dark:!0,ansi:{black:`#21222C`,red:`#FF5555`,green:`#50FA7B`,yellow:`#F1FA8C`,blue:`#BD93F9`,magenta:`#FF79C6`,cyan:`#8BE9FD`,white:`#F8F8F2`,brightBlack:`#6272A4`,brightRed:`#FF6E6E`,brightGreen:`#69FF94`,brightYellow:`#FFFFA5`,brightBlue:`#D6ACFF`,brightMagenta:`#FF92DF`,brightCyan:`#A4FFFF`,brightWhite:`#FFFFFF`},vars:{accent:`#FF79C6`,"accent-darken-1":`#E864B1`,"accent-darken-2":`#D24F9D`,"accent-darken-3":`#BC3989`,"accent-lighten-1":`#FF8DDA`,"accent-lighten-2":`#FFA3F0`,"accent-lighten-3":`#FFB8FF`,"accent-muted":`#684161`,background:`#282A36`,"background-darken-1":`#181A25`,"background-darken-2":`#050716`,"background-darken-3":`#000000`,"background-lighten-1":`#383A46`,"background-lighten-2":`#494B58`,"background-lighten-3":`#5B5D6A`,"block-cursor-background":`#BD93F9`,"block-cursor-blurred-background":`#BD93F94C`,"block-cursor-blurred-foreground":`#F8F8F2`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#BD93F9`,"border-blurred":`#252835`,"button-color-foreground":`#282A36`,"button-foreground":`#F8F8F2`,error:`#FE5555`,"error-darken-1":`#E63E43`,"error-darken-2":`#CE2332`,"error-darken-3":`#B70022`,"error-lighten-1":`#FF6A67`,"error-lighten-2":`#FF807A`,"error-lighten-3":`#FF958D`,"error-muted":`#68363F`,"footer-background":`#313442`,"footer-description-background":`#00000000`,"footer-description-foreground":`#F8F8F2`,"footer-foreground":`#F8F8F2`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FF79C6`,foreground:`#F8F8F2`,"foreground-darken-1":`#E2E2DC`,"foreground-darken-2":`#CDCDC7`,"foreground-darken-3":`#B8B8B3`,"foreground-disabled":`#F8F8F260`,"foreground-lighten-1":`#FFFFFF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#F8F8F299`,"input-cursor-background":`#F8F8F2`,"input-cursor-foreground":`#282A36`,"input-selection-background":`#D2A7FF66`,"link-background":`#00000000`,"link-background-hover":`#BD93F9`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#BD93F9`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#BD93F9`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#BD93F9`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#F8F8F2`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#F8F8F2`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#F8F8F299`,panel:`#313442`,"panel-darken-1":`#202431`,"panel-darken-2":`#111421`,"panel-darken-3":`#000012`,"panel-lighten-1":`#414453`,"panel-lighten-2":`#535665`,"panel-lighten-3":`#656878`,primary:`#BD93F9`,"primary-background":`#5A566C`,"primary-background-darken-1":`#4C475F`,"primary-background-darken-2":`#3E3953`,"primary-background-darken-3":`#3E3953`,"primary-background-lighten-1":`#696579`,"primary-background-lighten-2":`#777486`,"primary-background-lighten-3":`#868393`,"primary-darken-1":`#A77FE3`,"primary-darken-2":`#936CCE`,"primary-darken-3":`#7E59B9`,"primary-lighten-1":`#D2A7FF`,"primary-lighten-2":`#E8BBFF`,"primary-lighten-3":`#FED0FF`,"primary-muted":`#544970`,scrollbar:`#5A4A79`,"scrollbar-active":`#BD93F9`,"scrollbar-background":`#181A25`,"scrollbar-background-active":`#181A25`,"scrollbar-background-hover":`#181A25`,"scrollbar-corner-color":`#181A25`,"scrollbar-hover":`#6A568F`,secondary:`#6272A4`,"secondary-background":`#4F5261`,"secondary-background-darken-1":`#3F4353`,"secondary-background-darken-2":`#303446`,"secondary-background-darken-3":`#303446`,"secondary-background-lighten-1":`#5E616F`,"secondary-background-lighten-2":`#6E707D`,"secondary-background-lighten-3":`#7D808B`,"secondary-darken-1":`#4E5F90`,"secondary-darken-2":`#3B4D7C`,"secondary-darken-3":`#283C69`,"secondary-lighten-1":`#7584B8`,"secondary-lighten-2":`#8998CD`,"secondary-lighten-3":`#9DACE2`,"secondary-muted":`#393F57`,success:`#50FA7B`,"success-darken-1":`#2FE467`,"success-darken-2":`#00CE53`,"success-darken-3":`#00B83F`,"success-lighten-1":`#6AFF8F`,"success-lighten-2":`#83FFA3`,"success-lighten-3":`#9BFFB8`,"success-muted":`#34684A`,surface:`#2B2E3B`,"surface-active":`#383B48`,"surface-darken-1":`#1B1E2A`,"surface-darken-2":`#0A0D1B`,"surface-darken-3":`#000009`,"surface-lighten-1":`#3B3E4C`,"surface-lighten-2":`#4C4F5D`,"surface-lighten-3":`#5E6170`,text:`#FFFFFFDD`,"text-accent":`#FFA6D9`,"text-disabled":`#FFFFFF60`,"text-error":`#FF8E8E`,"text-muted":`#FFFFFF99`,"text-primary":`#D3B7FB`,"text-secondary":`#97A1C2`,"text-success":`#8BFBA7`,"text-warning":`#FFD09D`,warning:`#FEB86C`,"warning-darken-1":`#E8A358`,"warning-darken-2":`#D18F45`,"warning-darken-3":`#BB7C33`,"warning-lighten-1":`#FFCC7F`,"warning-lighten-2":`#FFE193`,"warning-lighten-3":`#FFF7A7`,"warning-muted":`#685446`}},flexoki:{name:`flexoki`,dark:!0,ansi:{black:`#100F0F`,red:`#D14D41`,green:`#879A39`,yellow:`#D0A215`,blue:`#4385BE`,magenta:`#CE5D97`,cyan:`#3AA99F`,white:`#878580`,brightBlack:`#575653`,brightRed:`#AF3029`,brightGreen:`#66800B`,brightYellow:`#AD8301`,brightBlue:`#205EA6`,brightMagenta:`#A02F6F`,brightCyan:`#24837B`,brightWhite:`#CECDC3`},vars:{accent:`#9B76C8`,"accent-darken-1":`#8663B3`,"accent-darken-2":`#72509E`,"accent-darken-3":`#5F3E8B`,"accent-lighten-1":`#AF89DD`,"accent-lighten-2":`#C49DF2`,"accent-lighten-3":`#D9B1FF`,"accent-muted":`#392D46`,background:`#100F0F`,"background-darken-1":`#000000`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#1F1F1F`,"background-lighten-2":`#2F2E2E`,"background-lighten-3":`#403F3F`,"block-cursor-background":`#205EA6`,"block-cursor-blurred-background":`#205EA64C`,"block-cursor-blurred-foreground":`#FFFCF0`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#205EA6`,"border-blurred":`#171614`,"button-color-foreground":`#FFFCF0`,"button-foreground":`#FFFCF0`,error:`#AE3029`,"error-darken-1":`#981818`,"error-darken-2":`#810007`,"error-darken-3":`#6B0000`,"error-lighten-1":`#C64539`,"error-lighten-2":`#DD594B`,"error-lighten-3":`#F46D5D`,"error-muted":`#3F1816`,"footer-background":`#282726`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FFFCF0`,"footer-foreground":`#FFFCF0`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#9B76C8`,foreground:`#FFFCF0`,"foreground-darken-1":`#E9E6DA`,"foreground-darken-2":`#D4D1C5`,"foreground-darken-3":`#BFBCB1`,"foreground-disabled":`#FFFCF060`,"foreground-lighten-1":`#FFFFFF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#FFFCF099`,"input-cursor-background":`#FFFCF0`,"input-cursor-foreground":`#5E409D`,"input-selection-background":`#6F6E6959`,"link-background":`#00000000`,"link-background-hover":`#205EA6`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#205EA6`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#205EA6`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#205EA6`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#FFFCF0`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#FFFCF0`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#FFFCF099`,panel:`#282726`,"panel-darken-1":`#181716`,"panel-darken-2":`#040200`,"panel-darken-3":`#000000`,"panel-lighten-1":`#383736`,"panel-lighten-2":`#494846`,"panel-lighten-3":`#5A5958`,primary:`#205EA6`,"primary-background":`#353C45`,"primary-background-darken-1":`#232B35`,"primary-background-darken-2":`#121A25`,"primary-background-darken-3":`#121A25`,"primary-background-lighten-1":`#474D56`,"primary-background-lighten-2":`#595E66`,"primary-background-lighten-3":`#6A6F76`,"primary-darken-1":`#004C91`,"primary-darken-2":`#003B7E`,"primary-darken-3":`#002B6B`,"primary-lighten-1":`#3C70BA`,"primary-lighten-2":`#5383CF`,"primary-lighten-3":`#6996E4`,"primary-muted":`#14263C`,scrollbar:`#0C2542`,"scrollbar-active":`#205EA6`,"scrollbar-background":`#000000`,"scrollbar-background-active":`#000000`,"scrollbar-background-hover":`#000000`,"scrollbar-corner-color":`#000000`,"scrollbar-hover":`#102F53`,secondary:`#24837B`,"secondary-background":`#364140`,"secondary-background-darken-1":`#24302F`,"secondary-background-darken-2":`#13201F`,"secondary-background-darken-3":`#13201F`,"secondary-background-lighten-1":`#485251`,"secondary-background-lighten-2":`#596262`,"secondary-background-lighten-3":`#6B7373`,"secondary-darken-1":`#006F68`,"secondary-darken-2":`#005D56`,"secondary-darken-3":`#004A44`,"secondary-lighten-1":`#3C968E`,"secondary-lighten-2":`#52AAA1`,"secondary-lighten-3":`#67BFB6`,"secondary-muted":`#16312F`,success:`#65800B`,"success-darken-1":`#526D00`,"success-darken-2":`#3E5A00`,"success-darken-3":`#2D4800`,"success-lighten-1":`#7A9324`,"success-lighten-2":`#8EA738`,"success-lighten-3":`#A3BB4C`,"success-muted":`#29300D`,surface:`#1C1B1A`,"surface-active":`#282726`,"surface-darken-1":`#0A0806`,"surface-darken-2":`#000000`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2B2A29`,"surface-lighten-2":`#3B3A39`,"surface-lighten-3":`#4D4B4A`,text:`#FFFFFFDD`,"text-accent":`#BDA4DA`,"text-disabled":`#FFFFFF60`,"text-error":`#CA7671`,"text-muted":`#FFFFFF99`,"text-primary":`#6B94C4`,"text-secondary":`#6EADA7`,"text-success":`#9AAB5D`,"text-warning":`#C8AD57`,warning:`#AC8301`,"warning-darken-1":`#977000`,"warning-darken-2":`#815D00`,"warning-darken-3":`#6C4C00`,"warning-lighten-1":`#C39621`,"warning-lighten-2":`#D9AA37`,"warning-lighten-3":`#F0BE4B`,"warning-muted":`#3F310A`}},gruvbox:{name:`gruvbox`,dark:!0,ansi:{black:`#282828`,red:`#CC241D`,green:`#98971A`,yellow:`#D79921`,blue:`#458588`,magenta:`#B16286`,cyan:`#689D6A`,white:`#A89984`,brightBlack:`#928374`,brightRed:`#FB4934`,brightGreen:`#B8BB26`,brightYellow:`#FABD2F`,brightBlue:`#83A598`,brightMagenta:`#D3869B`,brightCyan:`#8EC07C`,brightWhite:`#EBDBB2`},vars:{accent:`#F9BD2F`,"accent-darken-1":`#E2A811`,"accent-darken-2":`#CB9400`,"accent-darken-3":`#B48100`,"accent-lighten-1":`#FFD146`,"accent-lighten-2":`#FFE65B`,"accent-lighten-3":`#FFFC70`,"accent-muted":`#67542A`,background:`#282828`,"background-darken-1":`#181818`,"background-darken-2":`#040404`,"background-darken-3":`#000000`,"background-lighten-1":`#383838`,"background-lighten-2":`#494949`,"background-lighten-3":`#5A5A5A`,"block-cursor-background":`#85A598`,"block-cursor-blurred-background":`#85A5984C`,"block-cursor-blurred-foreground":`#FBF1C7`,"block-cursor-foreground":`#FBF1C7`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#85A598`,"border-blurred":`#363230`,"button-color-foreground":`#282828`,"button-foreground":`#FBF1C7`,error:`#FA4934`,"error-darken-1":`#E23022`,"error-darken-2":`#C90D10`,"error-darken-3":`#B10000`,"error-lighten-1":`#FF5F45`,"error-lighten-2":`#FF7558`,"error-lighten-3":`#FF8B6B`,"error-muted":`#67312B`,"footer-background":`#504945`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FBF1C7`,"footer-foreground":`#FBF1C7`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FABD2F`,foreground:`#FBF1C7`,"foreground-darken-1":`#E5DBB2`,"foreground-darken-2":`#D0C69E`,"foreground-darken-3":`#BBB28A`,"foreground-disabled":`#FBF1C760`,"foreground-lighten-1":`#FFFFDC`,"foreground-lighten-2":`#FFFFF1`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#FBF1C799`,"input-cursor-background":`#FBF1C7`,"input-cursor-foreground":`#282828`,"input-selection-background":`#689D6A40`,"link-background":`#00000000`,"link-background-hover":`#85A598`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#85A598`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#85A598`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#85A598`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#FBF1C7`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#FBF1C7`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#FBF1C799`,panel:`#504945`,"panel-darken-1":`#3E3834`,"panel-darken-2":`#2E2724`,"panel-darken-3":`#1E1815`,"panel-lighten-1":`#615A56`,"panel-lighten-2":`#746C68`,"panel-lighten-3":`#877F7B`,primary:`#85A598`,"primary-background":`#535755`,"primary-background-darken-1":`#444846`,"primary-background-darken-2":`#353A38`,"primary-background-darken-3":`#353A38`,"primary-background-lighten-1":`#626664`,"primary-background-lighten-2":`#717573`,"primary-background-lighten-3":`#808382`,"primary-darken-1":`#719184`,"primary-darken-2":`#5F7D71`,"primary-darken-3":`#4C6A5F`,"primary-lighten-1":`#98B9AB`,"primary-lighten-2":`#ACCEC0`,"primary-lighten-3":`#C1E3D5`,"primary-muted":`#434D49`,scrollbar:`#43504B`,"scrollbar-active":`#85A598`,"scrollbar-background":`#181818`,"scrollbar-background-active":`#181818`,"scrollbar-background-hover":`#181818`,"scrollbar-corner-color":`#181818`,"scrollbar-hover":`#4E5E58`,secondary:`#A89A85`,"secondary-background":`#585653`,"secondary-background-darken-1":`#494744`,"secondary-background-darken-2":`#3B3935`,"secondary-background-darken-3":`#3B3935`,"secondary-background-lighten-1":`#676562`,"secondary-background-lighten-2":`#757471`,"secondary-background-lighten-3":`#848380`,"secondary-darken-1":`#938671`,"secondary-darken-2":`#80735F`,"secondary-darken-3":`#6D604D`,"secondary-lighten-1":`#BCAE98`,"secondary-lighten-2":`#D1C2AC`,"secondary-lighten-3":`#E6D7C1`,"secondary-muted":`#4E4A43`,success:`#B7BB26`,"success-darken-1":`#A2A601`,"success-darken-2":`#8C9300`,"success-darken-3":`#777F00`,"success-lighten-1":`#CDCF3D`,"success-lighten-2":`#E4E453`,"success-lighten-3":`#FAFA68`,"success-muted":`#535427`,surface:`#3C3836`,"surface-active":`#494543`,"surface-darken-1":`#2B2725`,"surface-darken-2":`#1C1816`,"surface-darken-3":`#0A0300`,"surface-lighten-1":`#4D4846`,"surface-lighten-2":`#5F5A58`,"surface-lighten-3":`#716C6A`,text:`#FFFFFFDD`,"text-accent":`#FBD375`,"text-disabled":`#FFFFFF60`,"text-error":`#FC8679`,"text-muted":`#FFFFFF99`,"text-primary":`#AEC3BB`,"text-secondary":`#C5BCAE`,"text-success":`#D0D26F`,"text-warning":`#FEAB67`,warning:`#FD8019`,"warning-darken-1":`#E56C00`,"warning-darken-2":`#CD5800`,"warning-darken-3":`#B54500`,"warning-lighten-1":`#FF9430`,"warning-lighten-2":`#FFA845`,"warning-lighten-3":`#FFBD5A`,"warning-muted":`#684223`}},monokai:{name:`monokai`,dark:!0,ansi:{black:`#333333`,red:`#C4265E`,green:`#86B42B`,yellow:`#B3B42B`,blue:`#6A7EC8`,magenta:`#8C6BC8`,cyan:`#56ADBC`,white:`#E3E3DD`,brightBlack:`#666666`,brightRed:`#F92672`,brightGreen:`#A6E22E`,brightYellow:`#E2E22E`,brightBlue:`#819AFF`,brightMagenta:`#AE81FF`,brightCyan:`#66D9EF`,brightWhite:`#F8F8F2`},vars:{accent:`#66D9EF`,"accent-darken-1":`#4DC3D9`,"accent-darken-2":`#31AFC4`,"accent-darken-3":`#009BB0`,"accent-lighten-1":`#7DEEFF`,"accent-lighten-2":`#94FFFF`,"accent-lighten-3":`#AAFFFF`,"accent-muted":`#395D5F`,background:`#272822`,"background-darken-1":`#171812`,"background-darken-2":`#020400`,"background-darken-3":`#000000`,"background-lighten-1":`#373831`,"background-lighten-2":`#484942`,"background-lighten-3":`#595A54`,"block-cursor-background":`#AE81FF`,"block-cursor-blurred-background":`#AE81FF4C`,"block-cursor-blurred-foreground":`#D6D6D6`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#AE81FF`,"border-blurred":`#282828`,"button-color-foreground":`#272822`,"button-foreground":`#D6D6D6`,error:`#F82672`,"error-darken-1":`#E1005F`,"error-darken-2":`#C9004E`,"error-darken-3":`#B1003D`,"error-lighten-1":`#FF4484`,"error-lighten-2":`#FF5D98`,"error-lighten-3":`#FF75AC`,"error-muted":`#66273A`,"footer-background":`#3E3D32`,"footer-description-background":`#00000000`,"footer-description-foreground":`#D6D6D6`,"footer-foreground":`#D6D6D6`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#66D9EF`,foreground:`#D6D6D6`,"foreground-darken-1":`#C1C1C1`,"foreground-darken-2":`#ACACAC`,"foreground-darken-3":`#989898`,"foreground-disabled":`#D6D6D660`,"foreground-lighten-1":`#EBEBEB`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#797979`,"input-cursor-background":`#D6D6D6`,"input-cursor-foreground":`#272822`,"input-selection-background":`#575B6190`,"link-background":`#00000000`,"link-background-hover":`#AE81FF`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#AE81FF`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#AE81FF`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#AE81FF`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#D6D6D6`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#D6D6D6`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#797979`,panel:`#3E3D32`,"panel-darken-1":`#2D2C22`,"panel-darken-2":`#1D1C12`,"panel-darken-3":`#0D0B00`,"panel-lighten-1":`#4F4E42`,"panel-lighten-2":`#616054`,"panel-lighten-3":`#737266`,primary:`#AE81FF`,"primary-background":`#58535F`,"primary-background-darken-1":`#494451`,"primary-background-darken-2":`#3B3543`,"primary-background-darken-3":`#3B3543`,"primary-background-lighten-1":`#67626D`,"primary-background-lighten-2":`#75717B`,"primary-background-lighten-3":`#848089`,"primary-darken-1":`#986DE9`,"primary-darken-2":`#835AD3`,"primary-darken-3":`#6E48BE`,"primary-lighten-1":`#C394FF`,"primary-lighten-2":`#D9A9FF`,"primary-lighten-3":`#EFBDFF`,"primary-muted":`#4F4264`,scrollbar:`#534270`,"scrollbar-active":`#AE81FF`,"scrollbar-background":`#171812`,"scrollbar-background-active":`#171812`,"scrollbar-background-hover":`#171812`,"scrollbar-corner-color":`#171812`,"scrollbar-hover":`#624C88`,secondary:`#F82672`,"secondary-background":`#61474D`,"secondary-background-darken-1":`#53373D`,"secondary-background-darken-2":`#46272E`,"secondary-background-darken-3":`#46272E`,"secondary-background-lighten-1":`#6F575D`,"secondary-background-lighten-2":`#7D676C`,"secondary-background-lighten-3":`#8B787C`,"secondary-darken-1":`#E1005F`,"secondary-darken-2":`#C9004E`,"secondary-darken-3":`#B1003D`,"secondary-lighten-1":`#FF4484`,"secondary-lighten-2":`#FF5D98`,"secondary-lighten-3":`#FF75AC`,"secondary-muted":`#66273A`,success:`#A5E22E`,"success-darken-1":`#90CC09`,"success-darken-2":`#7AB700`,"success-darken-3":`#64A300`,"success-lighten-1":`#BBF746`,"success-lighten-2":`#D2FF5D`,"success-lighten-3":`#E8FF72`,"success-muted":`#4D5F25`,surface:`#2E2E2E`,"surface-active":`#3B3B3B`,"surface-darken-1":`#1E1E1E`,"surface-darken-2":`#0D0D0D`,"surface-darken-3":`#000000`,"surface-lighten-1":`#3E3E3E`,"surface-lighten-2":`#4F4F4F`,"surface-lighten-3":`#616161`,text:`#FFFFFFDD`,"text-accent":`#9AE5F4`,"text-disabled":`#FFFFFF60`,"text-error":`#FB6FA1`,"text-muted":`#FFFFFF99`,"text-primary":`#C9ABFF`,"text-secondary":`#FB6FA1`,"text-success":`#C4EB75`,"text-warning":`#FDBA6B`,warning:`#FC971F`,"warning-darken-1":`#E58300`,"warning-darken-2":`#CD6F00`,"warning-darken-3":`#B65D00`,"warning-lighten-1":`#FFAB36`,"warning-lighten-2":`#FFBF4C`,"warning-lighten-3":`#FFD460`,"warning-muted":`#674921`}},nord:{name:`nord`,dark:!0,ansi:{black:`#3B4252`,red:`#BF616A`,green:`#A3BE8C`,yellow:`#EBCB8B`,blue:`#81A1C1`,magenta:`#B48EAD`,cyan:`#88C0D0`,white:`#E5E9F0`,brightBlack:`#596377`,brightRed:`#BF616A`,brightGreen:`#A3BE8C`,brightYellow:`#EBCB8B`,brightBlue:`#81A1C1`,brightMagenta:`#B48EAD`,brightCyan:`#8FBCBB`,brightWhite:`#ECEFF4`},vars:{accent:`#B48EAD`,"accent-darken-1":`#9F7A98`,"accent-darken-2":`#8B6785`,"accent-darken-3":`#785572`,"accent-lighten-1":`#C8A1C1`,"accent-lighten-2":`#DDB6D6`,"accent-lighten-3":`#F3CAEB`,"accent-muted":`#564F60`,background:`#2E3440`,"background-darken-1":`#1E242F`,"background-darken-2":`#0E141F`,"background-darken-3":`#000010`,"background-lighten-1":`#3E4451`,"background-lighten-2":`#505663`,"background-lighten-3":`#626875`,"block-cursor-background":`#88C0D0`,"block-cursor-blurred-background":`#88C0D04C`,"block-cursor-blurred-foreground":`#D8DEE9`,"block-cursor-foreground":`#2E3440`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#88C0D0`,"border-blurred":`#353C4C`,"button-color-foreground":`#2E3440`,"button-foreground":`#D8DEE9`,error:`#BE616A`,"error-darken-1":`#A94D57`,"error-darken-2":`#933A46`,"error-darken-3":`#7E2735`,"error-lighten-1":`#D4747C`,"error-lighten-2":`#EB8890`,"error-lighten-3":`#FF9CA3`,"error-muted":`#59414C`,"footer-background":`#434C5E`,"footer-description-background":`#00000000`,"footer-description-foreground":`#D8DEE9`,"footer-foreground":`#D8DEE9`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#88C0D0`,foreground:`#D8DEE9`,"foreground-darken-1":`#C3C9D3`,"foreground-darken-2":`#AEB4BF`,"foreground-darken-3":`#9AA0AA`,"foreground-disabled":`#D8DEE960`,"foreground-lighten-1":`#EDF3FE`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#D8DEE999`,"input-cursor-background":`#D8DEE9`,"input-cursor-foreground":`#2E3440`,"input-selection-background":`#81A1C159`,"link-background":`#00000000`,"link-background-hover":`#88C0D0`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#88C0D0`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#88C0D0`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#88C0D0`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#D8DEE9`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#D8DEE9`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#D8DEE999`,panel:`#434C5E`,"panel-darken-1":`#313A4C`,"panel-darken-2":`#212A3A`,"panel-darken-3":`#111B2A`,"panel-lighten-1":`#545D70`,"panel-lighten-2":`#677083`,"panel-lighten-3":`#798396`,primary:`#88C0D0`,"primary-background":`#58646E`,"primary-background-darken-1":`#495661`,"primary-background-darken-2":`#3B4955`,"primary-background-darken-3":`#3B4955`,"primary-background-lighten-1":`#67717B`,"primary-background-lighten-2":`#757F88`,"primary-background-lighten-3":`#848D94`,"primary-darken-1":`#73ABBB`,"primary-darken-2":`#5F97A6`,"primary-darken-3":`#4B8393`,"primary-lighten-1":`#9CD4E5`,"primary-lighten-2":`#B1EAFA`,"primary-lighten-3":`#C6FFFF`,"primary-muted":`#495E6B`,scrollbar:`#48626F`,"scrollbar-active":`#88C0D0`,"scrollbar-background":`#1E242F`,"scrollbar-background-active":`#1E242F`,"scrollbar-background-hover":`#1E242F`,"scrollbar-corner-color":`#1E242F`,"scrollbar-hover":`#53727F`,secondary:`#81A1C1`,"secondary-background":`#57606C`,"secondary-background-darken-1":`#48525F`,"secondary-background-darken-2":`#3A4453`,"secondary-background-darken-3":`#3A4453`,"secondary-background-lighten-1":`#666E79`,"secondary-background-lighten-2":`#757C86`,"secondary-background-lighten-3":`#838A93`,"secondary-darken-1":`#6D8DAC`,"secondary-darken-2":`#597A98`,"secondary-darken-3":`#466784`,"secondary-lighten-1":`#95B5D5`,"secondary-lighten-2":`#A9C9EB`,"secondary-lighten-3":`#BEDEFF`,"secondary-muted":`#465466`,success:`#A3BE8C`,"success-darken-1":`#8FA978`,"success-darken-2":`#7B9565`,"success-darken-3":`#688253`,"success-lighten-1":`#B7D29F`,"success-lighten-2":`#CCE8B4`,"success-lighten-3":`#E1FDC8`,"success-muted":`#515D56`,surface:`#3B4252`,"surface-active":`#484F60`,"surface-darken-1":`#2A3140`,"surface-darken-2":`#1A212F`,"surface-darken-3":`#0A1120`,"surface-lighten-1":`#4C5364`,"surface-lighten-2":`#5E6576`,"surface-lighten-3":`#707889`,text:`#FFFFFFDD`,"text-accent":`#CDB4C8`,"text-disabled":`#FFFFFF60`,"text-error":`#D4969C`,"text-muted":`#FFFFFF99`,"text-primary":`#B0D5DF`,"text-secondary":`#ABC0D6`,"text-success":`#C2D4B3`,"text-warning":`#F1DCB2`,warning:`#EACB8B`,"warning-darken-1":`#D5B677`,"warning-darken-2":`#BFA264`,"warning-darken-3":`#AA8E51`,"warning-lighten-1":`#FFE09E`,"warning-lighten-2":`#FFF5B3`,"warning-lighten-3":`#FFFFC8`,"warning-muted":`#666156`}},"rose-pine":{name:`rose-pine`,dark:!0,ansi:{black:`#26233A`,red:`#EB6F92`,green:`#31748F`,yellow:`#F6C177`,blue:`#9CCFD8`,magenta:`#C4A7E7`,cyan:`#EBBCBA`,white:`#E0DEF4`,brightBlack:`#6E6A86`,brightRed:`#EB6F92`,brightGreen:`#31748F`,brightYellow:`#F6C177`,brightBlue:`#9CCFD8`,brightMagenta:`#C4A7E7`,brightCyan:`#EBBCBA`,brightWhite:`#E0DEF4`},vars:{accent:`#EBBCBA`,"accent-darken-1":`#D5A7A5`,"accent-darken-2":`#C09391`,"accent-darken-3":`#AB807E`,"accent-lighten-1":`#FFD0CE`,"accent-lighten-2":`#FFE5E3`,"accent-lighten-3":`#FFFBF9`,"accent-muted":`#584851`,background:`#191724`,"background-darken-1":`#060015`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#282634`,"background-lighten-2":`#383644`,"background-lighten-3":`#4A4756`,"block-cursor-background":`#C4A7E7`,"block-cursor-blurred-background":`#C4A7E74C`,"block-cursor-blurred-foreground":`#E0DEF4`,"block-cursor-foreground":`#191724`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#524F67`,"border-blurred":`#6E6A86`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#E0DEF4`,error:`#EA6F92`,"error-darken-1":`#D45A7E`,"error-darken-2":`#BE466B`,"error-darken-3":`#A83159`,"error-lighten-1":`#FF83A5`,"error-lighten-2":`#FF98BA`,"error-lighten-3":`#FFADCE`,"error-muted":`#583145`,"footer-background":`#26233A`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E0DEF4`,"footer-foreground":`#E0DEF4`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#EBBCBA`,foreground:`#E0DEF4`,"foreground-darken-1":`#CAC9DE`,"foreground-darken-2":`#B6B4C9`,"foreground-darken-3":`#A2A0B4`,"foreground-disabled":`#E0DEF460`,"foreground-lighten-1":`#F5F3FF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#E0DEF499`,"input-cursor-background":`#F4EDE8`,"input-cursor-foreground":`#191724`,"input-selection-background":`#403D52`,"link-background":`#00000000`,"link-background-hover":`#C4A7E7`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#C4A7E7`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#C4A7E7`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#C4A7E7`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E0DEF4`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E0DEF4`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#E0DEF499`,panel:`#26233A`,"panel-darken-1":`#161329`,"panel-darken-2":`#04001A`,"panel-darken-3":`#000008`,"panel-lighten-1":`#36324B`,"panel-lighten-2":`#47435D`,"panel-lighten-3":`#59556F`,primary:`#C4A7E7`,"primary-background":`#504B5D`,"primary-background-darken-1":`#413B4F`,"primary-background-darken-2":`#322C41`,"primary-background-darken-3":`#322C41`,"primary-background-lighten-1":`#605B6B`,"primary-background-lighten-2":`#6F6B7A`,"primary-background-lighten-3":`#7E7B88`,"primary-darken-1":`#AF93D1`,"primary-darken-2":`#9A7FBC`,"primary-darken-3":`#866CA8`,"primary-lighten-1":`#D9BBFC`,"primary-lighten-2":`#EED0FF`,"primary-lighten-3":`#FFE5FF`,"primary-muted":`#4C425E`,scrollbar:`#524269`,"scrollbar-active":`#C4A7E7`,"scrollbar-background":`#060015`,"scrollbar-background-active":`#060015`,"scrollbar-background-hover":`#060015`,"scrollbar-corner-color":`#060015`,"scrollbar-hover":`#65537E`,secondary:`#31748F`,"secondary-background":`#3E4452`,"secondary-background-darken-1":`#2D3443`,"secondary-background-darken-2":`#1C2434`,"secondary-background-darken-3":`#1C2434`,"secondary-background-lighten-1":`#4F5561`,"secondary-background-lighten-2":`#606570`,"secondary-background-lighten-3":`#717680`,"secondary-darken-1":`#17617B`,"secondary-darken-2":`#004F68`,"secondary-darken-3":`#003E56`,"secondary-lighten-1":`#4687A2`,"secondary-lighten-2":`#5B9AB7`,"secondary-lighten-3":`#70AECB`,"secondary-muted":`#203244`,success:`#9CCFD8`,"success-darken-1":`#87BAC3`,"success-darken-2":`#73A5AE`,"success-darken-3":`#60929A`,"success-lighten-1":`#B0E4ED`,"success-lighten-2":`#C5F9FF`,"success-lighten-3":`#DAFFFF`,"success-muted":`#404E5A`,surface:`#1F1D2E`,"surface-active":`#2B293B`,"surface-darken-1":`#100B1E`,"surface-darken-2":`#00000E`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2F2C3E`,"surface-lighten-2":`#3F3D4F`,"surface-lighten-3":`#514E61`,text:`#FFFFFFDD`,"text-accent":`#F1D2D1`,"text-disabled":`#FFFFFF60`,"text-error":`#F19FB7`,"text-muted":`#FFFFFF99`,"text-primary":`#D8C4EF`,"text-secondary":`#77A3B5`,"text-success":`#BDDFE5`,"text-warning":`#F9D6A5`,warning:`#F5C177`,"warning-darken-1":`#DFAC63`,"warning-darken-2":`#C99850`,"warning-darken-3":`#B3853E`,"warning-lighten-1":`#FFD58A`,"warning-lighten-2":`#FFEB9E`,"warning-lighten-3":`#FFFFB3`,"warning-muted":`#5B4A3C`}},"rose-pine-dawn":{name:`rose-pine-dawn`,dark:!1,ansi:{black:`#F2E9E1`,red:`#B4637A`,green:`#286983`,yellow:`#EA9D34`,blue:`#56949F`,magenta:`#907AA9`,cyan:`#D7827E`,white:`#575279`,brightBlack:`#9893A5`,brightRed:`#B4637A`,brightGreen:`#286983`,brightYellow:`#EA9D34`,brightBlue:`#56949F`,brightMagenta:`#907AA9`,brightCyan:`#D7827E`,brightWhite:`#575279`},vars:{accent:`#D6827E`,"accent-darken-1":`#C16E6B`,"accent-darken-2":`#AB5B58`,"accent-darken-3":`#964847`,"accent-lighten-1":`#ED9591`,"accent-lighten-2":`#FFAAA5`,"accent-lighten-3":`#FFBEB9`,"accent-muted":`#EFD1CB`,background:`#FAF4ED`,"background-darken-1":`#E4DED7`,"background-darken-2":`#CFC9C2`,"background-darken-3":`#BAB5AE`,"background-lighten-1":`#FFFFFF`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#575279`,"block-cursor-blurred-background":`#907AA94C`,"block-cursor-blurred-foreground":`#575279`,"block-cursor-foreground":`#FAF4ED`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#CECACD`,"border-blurred":`#9893A5`,"button-color-foreground":`#000000DD`,"button-foreground":`#575279`,error:`#B4637A`,"error-darken-1":`#9E5067`,"error-darken-2":`#8A3D55`,"error-darken-3":`#752A43`,"error-lighten-1":`#C9768D`,"error-lighten-2":`#DF8AA0`,"error-lighten-3":`#F59EB5`,"error-muted":`#E5C8CA`,"footer-background":`#F2E9E1`,"footer-description-background":`#00000000`,"footer-description-foreground":`#575279`,"footer-foreground":`#575279`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#D7827E`,foreground:`#575279`,"foreground-darken-1":`#444066`,"foreground-darken-2":`#332F53`,"foreground-darken-3":`#222042`,"foreground-disabled":`#57527960`,"foreground-lighten-1":`#69648C`,"foreground-lighten-2":`#7C76A0`,"foreground-lighten-3":`#9089B4`,"foreground-muted":`#57527999`,"input-cursor-background":`#575279`,"input-cursor-foreground":`#FAF4ED`,"input-selection-background":`#DFDAD9`,"link-background":`#00000000`,"link-background-hover":`#907AA9`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#907AA9`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#907AA9`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#907AA9`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#575279`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#575279`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#57527999`,panel:`#F2E9E1`,"panel-darken-1":`#DCD3CB`,"panel-darken-2":`#C7BFB7`,"panel-darken-3":`#B3AAA3`,"panel-lighten-1":`#FFFEF6`,"panel-lighten-2":`#FFFFFF`,"panel-lighten-3":`#FFFFFF`,primary:`#907AA9`,"primary-background":`#907AA9`,"primary-background-darken-1":`#7C6795`,"primary-background-darken-2":`#695481`,"primary-background-darken-3":`#56436E`,"primary-background-lighten-1":`#A48DBD`,"primary-background-lighten-2":`#B8A1D2`,"primary-background-lighten-3":`#CDB5E7`,"primary-darken-1":`#7C6795`,"primary-darken-2":`#695481`,"primary-darken-3":`#56436E`,"primary-lighten-1":`#A48DBD`,"primary-lighten-2":`#B8A1D2`,"primary-lighten-3":`#CDB5E7`,"primary-muted":`#DACFD8`,scrollbar:`#C2B6C4`,"scrollbar-active":`#907AA9`,"scrollbar-background":`#E4DED7`,"scrollbar-background-active":`#E4DED7`,"scrollbar-background-hover":`#E4DED7`,"scrollbar-corner-color":`#E4DED7`,"scrollbar-hover":`#BAACC0`,secondary:`#286983`,"secondary-background":`#286983`,"secondary-background-darken-1":`#0A566F`,"secondary-background-darken-2":`#00455D`,"secondary-background-darken-3":`#00344B`,"secondary-background-lighten-1":`#3E7B96`,"secondary-background-lighten-2":`#538FAA`,"secondary-background-lighten-3":`#67A2BE`,"secondary-darken-1":`#0A566F`,"secondary-darken-2":`#00455D`,"secondary-darken-3":`#00344B`,"secondary-lighten-1":`#3E7B96`,"secondary-lighten-2":`#538FAA`,"secondary-lighten-3":`#67A2BE`,"secondary-muted":`#BBCACD`,success:`#56949F`,"success-darken-1":`#41808B`,"success-darken-2":`#2D6D78`,"success-darken-3":`#155B65`,"success-lighten-1":`#6AA7B3`,"success-lighten-2":`#7EBCC7`,"success-lighten-3":`#92D1DC`,"success-muted":`#C8D7D5`,surface:`#FFFAF3`,"surface-active":`#FFFFFF`,"surface-darken-1":`#E9E4DD`,"surface-darken-2":`#D4CFC8`,"surface-darken-3":`#BFBAB4`,"surface-lighten-1":`#FFFFFF`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#8D5553`,"text-disabled":`#00000060`,"text-error":`#764150`,"text-muted":`#00000099`,"text-primary":`#5F506F`,"text-secondary":`#1A4556`,"text-success":`#386168`,"text-warning":`#9A6722`,warning:`#E99D34`,"warning-darken-1":`#D2891D`,"warning-darken-2":`#BC7600`,"warning-darken-3":`#A56300`,"warning-lighten-1":`#FFB148`,"warning-lighten-2":`#FFC55C`,"warning-lighten-3":`#FFDA70`,"warning-muted":`#F5D9B5`}},"rose-pine-moon":{name:`rose-pine-moon`,dark:!0,ansi:{black:`#393552`,red:`#EB6F92`,green:`#3E8FB0`,yellow:`#F6C177`,blue:`#9CCFD8`,magenta:`#C4A7E7`,cyan:`#EA9A97`,white:`#E0DEF4`,brightBlack:`#6E6A86`,brightRed:`#EB6F92`,brightGreen:`#3E8FB0`,brightYellow:`#F6C177`,brightBlue:`#9CCFD8`,brightMagenta:`#C4A7E7`,brightCyan:`#EA9A97`,brightWhite:`#E0DEF4`},vars:{accent:`#EA9A97`,"accent-darken-1":`#D48683`,"accent-darken-2":`#BE7270`,"accent-darken-3":`#A95F5E`,"accent-lighten-1":`#FFAEAA`,"accent-lighten-2":`#FFC3BF`,"accent-lighten-3":`#FFD8D4`,"accent-muted":`#5E4553`,background:`#232136`,"background-darken-1":`#131125`,"background-darken-2":`#000017`,"background-darken-3":`#000001`,"background-lighten-1":`#333046`,"background-lighten-2":`#444158`,"background-lighten-3":`#56526A`,"block-cursor-background":`#C4A7E7`,"block-cursor-blurred-background":`#C4A7E74C`,"block-cursor-blurred-foreground":`#E0DEF4`,"block-cursor-foreground":`#232136`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#56526E`,"border-blurred":`#6E6A86`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#E0DEF4`,error:`#EA6F92`,"error-darken-1":`#D45A7E`,"error-darken-2":`#BE466B`,"error-darken-3":`#A83159`,"error-lighten-1":`#FF83A5`,"error-lighten-2":`#FF98BA`,"error-lighten-3":`#FFADCE`,"error-muted":`#5F3851`,"footer-background":`#393552`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E0DEF4`,"footer-foreground":`#E0DEF4`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#EA9A97`,foreground:`#E0DEF4`,"foreground-darken-1":`#CAC9DE`,"foreground-darken-2":`#B6B4C9`,"foreground-darken-3":`#A2A0B4`,"foreground-disabled":`#E0DEF460`,"foreground-lighten-1":`#F5F3FF`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#E0DEF499`,"input-cursor-background":`#F4EDE8`,"input-cursor-foreground":`#232136`,"input-selection-background":`#44415A`,"link-background":`#00000000`,"link-background-hover":`#C4A7E7`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#C4A7E7`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#C4A7E7`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#C4A7E7`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E0DEF4`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E0DEF4`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#E0DEF499`,panel:`#393552`,"panel-darken-1":`#282440`,"panel-darken-2":`#17152F`,"panel-darken-3":`#080020`,"panel-lighten-1":`#4A4564`,"panel-lighten-2":`#5C5776`,"panel-lighten-3":`#6F6989`,primary:`#C4A7E7`,"primary-background":`#58536A`,"primary-background-darken-1":`#49445D`,"primary-background-darken-2":`#3B3550`,"primary-background-darken-3":`#3B3550`,"primary-background-lighten-1":`#676277`,"primary-background-lighten-2":`#757184`,"primary-background-lighten-3":`#848091`,"primary-darken-1":`#AF93D1`,"primary-darken-2":`#9A7FBC`,"primary-darken-3":`#866CA8`,"primary-lighten-1":`#D9BBFC`,"primary-lighten-2":`#EED0FF`,"primary-lighten-3":`#FFE5FF`,"primary-muted":`#53496B`,scrollbar:`#594D72`,"scrollbar-active":`#C4A7E7`,"scrollbar-background":`#131125`,"scrollbar-background-active":`#131125`,"scrollbar-background-hover":`#131125`,"scrollbar-corner-color":`#131125`,"scrollbar-hover":`#6B5C86`,secondary:`#3E8FB0`,"secondary-background":`#474F63`,"secondary-background-darken-1":`#374055`,"secondary-background-darken-2":`#273148`,"secondary-background-darken-3":`#273148`,"secondary-background-lighten-1":`#575F71`,"secondary-background-lighten-2":`#676E7E`,"secondary-background-lighten-3":`#787E8C`,"secondary-darken-1":`#237B9B`,"secondary-darken-2":`#006888`,"secondary-darken-3":`#005674`,"secondary-lighten-1":`#54A2C4`,"secondary-lighten-2":`#6AB7D9`,"secondary-lighten-3":`#80CBEE`,"secondary-muted":`#2B425A`,success:`#9CCFD8`,"success-darken-1":`#87BAC3`,"success-darken-2":`#73A5AE`,"success-darken-3":`#60929A`,"success-lighten-1":`#B0E4ED`,"success-lighten-2":`#C5F9FF`,"success-lighten-3":`#DAFFFF`,"success-muted":`#475566`,surface:`#2A273F`,"surface-active":`#37334C`,"surface-darken-1":`#19172E`,"surface-darken-2":`#0A021E`,"surface-darken-3":`#00000F`,"surface-lighten-1":`#3A3750`,"surface-lighten-2":`#4C4862`,"surface-lighten-3":`#5E5975`,text:`#FFFFFFDD`,"text-accent":`#F1BCBA`,"text-disabled":`#FFFFFF60`,"text-error":`#F19FB7`,"text-muted":`#FFFFFF99`,"text-primary":`#D8C4EF`,"text-secondary":`#7FB5CA`,"text-success":`#BDDFE5`,"text-warning":`#F9D6A5`,warning:`#F5C177`,"warning-darken-1":`#DFAC63`,"warning-darken-2":`#C99850`,"warning-darken-3":`#B3853E`,"warning-lighten-1":`#FFD58A`,"warning-lighten-2":`#FFEB9E`,"warning-lighten-3":`#FFFFB3`,"warning-muted":`#625149`}},"solarized-dark":{name:`solarized-dark`,dark:!0,ansi:{black:`#073642`,red:`#DC322F`,green:`#859900`,yellow:`#B58900`,blue:`#268BD2`,magenta:`#D33682`,cyan:`#2AA198`,white:`#EEE8D5`,brightBlack:`#335E69`,brightRed:`#CB4B16`,brightGreen:`#586E75`,brightYellow:`#657B83`,brightBlue:`#839496`,brightMagenta:`#6C71C4`,brightCyan:`#93A1A1`,brightWhite:`#FDF6E3`},vars:{accent:`#6C71C4`,"accent-darken-1":`#575EAF`,"accent-darken-2":`#424C9A`,"accent-darken-3":`#2D3B87`,"accent-lighten-1":`#8083D9`,"accent-lighten-2":`#9597EE`,"accent-lighten-3":`#AAABFF`,"accent-muted":`#204060`,background:`#002B36`,"background-darken-1":`#001B25`,"background-darken-2":`#000A17`,"background-darken-3":`#000000`,"background-lighten-1":`#143B46`,"background-lighten-2":`#274C58`,"background-lighten-3":`#3A5E6A`,"block-cursor-background":`#268BD2`,"block-cursor-blurred-background":`#268BD24C`,"block-cursor-blurred-foreground":`#839496`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#268BD2`,"border-blurred":`#00303C`,"button-color-foreground":`#FDF6E3`,"button-foreground":`#839496`,error:`#DB322F`,"error-darken-1":`#C3121E`,"error-darken-2":`#AB000D`,"error-darken-3":`#940000`,"error-lighten-1":`#F44940`,"error-lighten-2":`#FF6052`,"error-lighten-3":`#FF7564`,"error-muted":`#422D33`,"footer-background":`#268BD2`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FDF6E3`,"footer-foreground":`#839496`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FDF6E3`,foreground:`#839496`,"foreground-darken-1":`#6F8082`,"foreground-darken-2":`#5D6D6F`,"foreground-darken-3":`#4B5B5D`,"foreground-disabled":`#83949660`,"foreground-lighten-1":`#96A7A9`,"foreground-lighten-2":`#AABCBE`,"foreground-lighten-3":`#BED0D3`,"foreground-muted":`#83949699`,"input-cursor-background":`#839496`,"input-cursor-foreground":`#002B36`,"input-selection-background":`#073642`,"link-background":`#00000000`,"link-background-hover":`#268BD2`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#268BD2`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#268BD2`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#268BD2`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#839496`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#839496`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#83949699`,panel:`#073642`,"panel-darken-1":`#002531`,"panel-darken-2":`#001721`,"panel-darken-3":`#000112`,"panel-lighten-1":`#1D4653`,"panel-lighten-2":`#305865`,"panel-lighten-3":`#436A78`,primary:`#268BD2`,"primary-background":`#2A5667`,"primary-background-darken-1":`#17475A`,"primary-background-darken-2":`#05394D`,"primary-background-darken-3":`#05394D`,"primary-background-lighten-1":`#3D6575`,"primary-background-lighten-2":`#507482`,"primary-background-lighten-3":`#62838F`,"primary-darken-1":`#0077BD`,"primary-darken-2":`#0065A8`,"primary-darken-3":`#005394`,"primary-lighten-1":`#459EE7`,"primary-lighten-2":`#5FB2FD`,"primary-lighten-3":`#77C7FF`,"primary-muted":`#0B4764`,scrollbar:`#0F476A`,"scrollbar-active":`#268BD2`,"scrollbar-background":`#001B25`,"scrollbar-background-active":`#001B25`,"scrollbar-background-hover":`#001B25`,"scrollbar-corner-color":`#001B25`,"scrollbar-hover":`#13537B`,secondary:`#2AA198`,"secondary-background":`#2B5960`,"secondary-background-darken-1":`#184A52`,"secondary-background-darken-2":`#063C44`,"secondary-background-darken-3":`#063C44`,"secondary-background-lighten-1":`#3E676E`,"secondary-background-lighten-2":`#50767C`,"secondary-background-lighten-3":`#63858A`,"secondary-darken-1":`#008C84`,"secondary-darken-2":`#007971`,"secondary-darken-3":`#00665F`,"secondary-lighten-1":`#44B5AB`,"secondary-lighten-2":`#5BCAC0`,"secondary-lighten-3":`#72DFD5`,"secondary-muted":`#0C4E53`,success:`#849900`,"success-darken-1":`#708500`,"success-darken-2":`#5B7200`,"success-darken-3":`#485F00`,"success-lighten-1":`#99AC22`,"success-lighten-2":`#AFC139`,"success-lighten-3":`#C4D64E`,"success-muted":`#274C25`,surface:`#073642`,"surface-active":`#19434F`,"surface-darken-1":`#002531`,"surface-darken-2":`#001721`,"surface-darken-3":`#000112`,"surface-lighten-1":`#1D4653`,"surface-lighten-2":`#305865`,"surface-lighten-3":`#436A78`,text:`#FFFFFFDD`,"text-accent":`#9DA1D8`,"text-disabled":`#FFFFFF60`,"text-error":`#E77775`,"text-muted":`#FFFFFF99`,"text-primary":`#6FB2E1`,"text-secondary":`#72C0BB`,"text-success":`#AEBB56`,"text-warning":`#DC8865`,warning:`#CA4B16`,"warning-darken-1":`#B33600`,"warning-darken-2":`#9C2000`,"warning-darken-3":`#850100`,"warning-lighten-1":`#E25F29`,"warning-lighten-2":`#FA733C`,"warning-lighten-3":`#FF874E`,"warning-muted":`#3C342C`}},"solarized-light":{name:`solarized-light`,dark:!1,ansi:{black:`#073642`,red:`#DC322F`,green:`#859900`,yellow:`#B58900`,blue:`#268BD2`,magenta:`#D33682`,cyan:`#2AA198`,white:`#BBB5A2`,brightBlack:`#002B36`,brightRed:`#CB4B16`,brightGreen:`#586E75`,brightYellow:`#657B83`,brightBlue:`#839496`,brightMagenta:`#6C71C4`,brightCyan:`#93A1A1`,brightWhite:`#FDF6E3`},vars:{accent:`#6C71C4`,"accent-darken-1":`#575EAF`,"accent-darken-2":`#424C9A`,"accent-darken-3":`#2D3B87`,"accent-lighten-1":`#8083D9`,"accent-lighten-2":`#9597EE`,"accent-lighten-3":`#AAABFF`,"accent-muted":`#D1CED9`,background:`#FDF6E3`,"background-darken-1":`#E7E0CD`,"background-darken-2":`#D2CBB9`,"background-darken-3":`#BDB6A4`,"background-lighten-1":`#FFFFF8`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#268BD2`,"block-cursor-blurred-background":`#268BD24C`,"block-cursor-blurred-foreground":`#586E75`,"block-cursor-foreground":`#000000DD`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#268BD2`,"border-blurred":`#E6E0CE`,"button-color-foreground":`#FDF6E3`,"button-foreground":`#586E75`,error:`#DB322F`,"error-darken-1":`#C3121E`,"error-darken-2":`#AB000D`,"error-darken-3":`#940000`,"error-lighten-1":`#F44940`,"error-lighten-2":`#FF6052`,"error-lighten-3":`#FF7564`,"error-muted":`#F3BBAD`,"footer-background":`#268BD2`,"footer-description-background":`#00000000`,"footer-description-foreground":`#FDF6E3`,"footer-foreground":`#586E75`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FDF6E3`,foreground:`#586E75`,"foreground-darken-1":`#465B62`,"foreground-darken-2":`#344950`,"foreground-darken-3":`#23383F`,"foreground-disabled":`#586E7560`,"foreground-lighten-1":`#6A8088`,"foreground-lighten-2":`#7D949B`,"foreground-lighten-3":`#91A8AF`,"foreground-muted":`#586E7599`,"input-cursor-background":`#586E75`,"input-cursor-foreground":`#FDF6E3`,"input-selection-background":`#459EE766`,"link-background":`#00000000`,"link-background-hover":`#268BD2`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#268BD2`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#268BD2`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#268BD2`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#586E75`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#586E75`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#586E7599`,panel:`#EEE8D5`,"panel-darken-1":`#D8D2C0`,"panel-darken-2":`#C3BEAB`,"panel-darken-3":`#AFA997`,"panel-lighten-1":`#FFFDEA`,"panel-lighten-2":`#FFFFFF`,"panel-lighten-3":`#FFFFFF`,primary:`#268BD2`,"primary-background":`#268BD2`,"primary-background-darken-1":`#0077BD`,"primary-background-darken-2":`#0065A8`,"primary-background-darken-3":`#005394`,"primary-background-lighten-1":`#459EE7`,"primary-background-lighten-2":`#5FB2FD`,"primary-background-lighten-3":`#77C7FF`,"primary-darken-1":`#0077BD`,"primary-darken-2":`#0065A8`,"primary-darken-3":`#005394`,"primary-lighten-1":`#459EE7`,"primary-lighten-2":`#5FB2FD`,"primary-lighten-3":`#77C7FF`,"primary-muted":`#BCD5DD`,scrollbar:`#99BECF`,"scrollbar-active":`#268BD2`,"scrollbar-background":`#E7E0CD`,"scrollbar-background-active":`#E7E0CD`,"scrollbar-background-hover":`#E7E0CD`,"scrollbar-corner-color":`#E7E0CD`,"scrollbar-hover":`#86B5CF`,secondary:`#2AA198`,"secondary-background":`#2AA198`,"secondary-background-darken-1":`#008C84`,"secondary-background-darken-2":`#007971`,"secondary-background-darken-3":`#00665F`,"secondary-background-lighten-1":`#44B5AB`,"secondary-background-lighten-2":`#5BCAC0`,"secondary-background-lighten-3":`#72DFD5`,"secondary-darken-1":`#008C84`,"secondary-darken-2":`#007971`,"secondary-darken-3":`#00665F`,"secondary-lighten-1":`#44B5AB`,"secondary-lighten-2":`#5BCAC0`,"secondary-lighten-3":`#72DFD5`,"secondary-muted":`#BDDCCC`,success:`#849900`,"success-darken-1":`#708500`,"success-darken-2":`#5B7200`,"success-darken-3":`#485F00`,"success-lighten-1":`#99AC22`,"success-lighten-2":`#AFC139`,"success-lighten-3":`#C4D64E`,"success-muted":`#D9DA9E`,surface:`#EEE8D5`,"surface-active":`#FFF9E5`,"surface-darken-1":`#D8D2C0`,"surface-darken-2":`#C3BEAB`,"surface-darken-3":`#AFA997`,"surface-lighten-1":`#FFFDEA`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#474A81`,"text-disabled":`#00000060`,"text-error":`#91211F`,"text-muted":`#00000099`,"text-primary":`#195B8A`,"text-secondary":`#1B6A64`,"text-success":`#576400`,"text-warning":`#85310E`,warning:`#CA4B16`,"warning-darken-1":`#B33600`,"warning-darken-2":`#9C2000`,"warning-darken-3":`#850100`,"warning-lighten-1":`#E25F29`,"warning-lighten-2":`#FA733C`,"warning-lighten-3":`#FF874E`,"warning-muted":`#EEC2A5`}},"svg-export":{name:`svg-export`,dark:!0,ansi:{black:`#4B4E55`,red:`#CC555A`,green:`#98A84B`,yellow:`#D0B344`,blue:`#608AB1`,magenta:`#98729F`,cyan:`#68A0B3`,white:`#C5C8C6`,brightBlack:`#9A9B99`,brightRed:`#FF2627`,brightGreen:`#00823D`,brightYellow:`#D08442`,brightBlue:`#1984E9`,brightMagenta:`#FF2C7A`,brightCyan:`#398280`,brightWhite:`#FDFDC5`},vars:{accent:`#56B6C2`,"accent-darken-1":`#3EA1AD`,"accent-darken-2":`#238D99`,"accent-darken-3":`#007A85`,"accent-lighten-1":`#6CCAD6`,"accent-lighten-2":`#81DFEC`,"accent-lighten-3":`#97F5FF`,"accent-muted":`#365356`,background:`#292929`,"background-darken-1":`#191919`,"background-darken-2":`#050505`,"background-darken-3":`#000000`,"background-lighten-1":`#393939`,"background-lighten-2":`#4A4A4A`,"background-lighten-3":`#5C5C5C`,"block-cursor-background":`#61AFEF`,"block-cursor-blurred-background":`#61AFEF4C`,"block-cursor-blurred-foreground":`#C5C8C6`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#61AFEF`,"border-blurred":`#191919`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#C5C8C6`,error:`#CB555A`,"error-darken-1":`#B54048`,"error-darken-2":`#9F2C37`,"error-darken-3":`#891427`,"error-lighten-1":`#E2686C`,"error-lighten-2":`#F97D7F`,"error-lighten-3":`#FF9192`,"error-muted":`#593637`,"footer-background":`#2C343A`,"footer-description-background":`#00000000`,"footer-description-foreground":`#C5C8C6`,"footer-foreground":`#C5C8C6`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#56B6C2`,foreground:`#C5C8C6`,"foreground-darken-1":`#B0B3B1`,"foreground-darken-2":`#9C9F9D`,"foreground-darken-3":`#888B89`,"foreground-disabled":`#C5C8C660`,"foreground-lighten-1":`#D9DCDA`,"foreground-lighten-2":`#EFF2F0`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#C5C8C699`,"input-cursor-background":`#C5C8C6`,"input-cursor-foreground":`#292929`,"input-selection-background":`#77C3FF66`,"link-background":`#00000000`,"link-background-hover":`#61AFEF`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#61AFEF`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#61AFEF`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#61AFEF`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#C5C8C6`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#C5C8C6`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#C5C8C699`,panel:`#2C343A`,"panel-darken-1":`#1C2429`,"panel-darken-2":`#0C141A`,"panel-darken-3":`#000007`,"panel-lighten-1":`#3C444B`,"panel-lighten-2":`#4D565C`,"panel-lighten-3":`#5F686F`,primary:`#61AFEF`,"primary-background":`#4F5A61`,"primary-background-darken-1":`#404B53`,"primary-background-darken-2":`#313D46`,"primary-background-darken-3":`#313D46`,"primary-background-lighten-1":`#5F686F`,"primary-background-lighten-2":`#6E777D`,"primary-background-lighten-3":`#7E858B`,"primary-darken-1":`#489BD9`,"primary-darken-2":`#2C87C4`,"primary-darken-3":`#0074AF`,"primary-lighten-1":`#77C3FF`,"primary-lighten-2":`#8ED8FF`,"primary-lighten-3":`#A4EDFF`,"primary-muted":`#395164`,scrollbar:`#35556E`,"scrollbar-active":`#61AFEF`,"scrollbar-background":`#191919`,"scrollbar-background-active":`#191919`,"scrollbar-background-hover":`#191919`,"scrollbar-corner-color":`#191919`,"scrollbar-hover":`#3D6484`,secondary:`#C678DD`,"secondary-background":`#5C5260`,"secondary-background-darken-1":`#4E4352`,"secondary-background-darken-2":`#403444`,"secondary-background-darken-3":`#403444`,"secondary-background-lighten-1":`#6A616E`,"secondary-background-lighten-2":`#79707C`,"secondary-background-lighten-3":`#87808A`,"secondary-darken-1":`#B064C7`,"secondary-darken-2":`#9B50B3`,"secondary-darken-3":`#873D9E`,"secondary-lighten-1":`#DB8CF2`,"secondary-lighten-2":`#F1A0FF`,"secondary-lighten-3":`#FFB5FF`,"secondary-muted":`#58405F`,success:`#98C379`,"success-darken-1":`#83AE65`,"success-darken-2":`#709A53`,"success-darken-3":`#5C8641`,"success-lighten-1":`#ACD78C`,"success-lighten-2":`#C1EDA0`,"success-lighten-3":`#D6FFB4`,"success-muted":`#4A5741`,surface:`#1E1E1E`,"surface-active":`#2A2A2A`,"surface-darken-1":`#0D0D0D`,"surface-darken-2":`#000000`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2D2D2D`,"surface-lighten-2":`#3E3E3E`,"surface-lighten-3":`#4F4F4F`,text:`#FFFFFFDD`,"text-accent":`#8FCED6`,"text-disabled":`#FFFFFF60`,"text-error":`#DD8E92`,"text-muted":`#FFFFFF99`,"text-primary":`#96CAF4`,"text-secondary":`#D9A5E8`,"text-success":`#BBD7A6`,"text-warning":`#EDD5A7`,warning:`#E4C07B`,"warning-darken-1":`#CFAB67`,"warning-darken-2":`#B99754`,"warning-darken-3":`#A48442`,"warning-lighten-1":`#FBD48E`,"warning-lighten-2":`#FFE9A2`,"warning-lighten-3":`#FFFFB7`,"warning-muted":`#615641`}},"textual-ansi":{name:`textual-ansi`,dark:!0,ansi:vr,vars:{accent:`#0000FF`,"accent-darken-1":`#0000FF`,"accent-darken-2":`#0000FF`,"accent-darken-3":`#0000FF`,"accent-lighten-1":`#0000FF`,"accent-lighten-2":`#0000FF`,"accent-lighten-3":`#0000FF`,"accent-muted":`#0178D4`,background:`#121212`,"background-darken-1":`#121212`,"background-darken-2":`#121212`,"background-darken-3":`#121212`,"background-lighten-1":`#121212`,"background-lighten-2":`#121212`,"background-lighten-3":`#121212`,"block-cursor-background":`#000080`,"block-cursor-blurred-background":`#0000804C`,"block-cursor-blurred-foreground":`#E0E0E0`,"block-cursor-foreground":`#E0E0E0`,"block-hover-background":`#00000019`,boost:`#0178D4`,"boost-darken-1":`#0178D4`,"boost-darken-2":`#0178D4`,"boost-darken-3":`#0178D4`,"boost-lighten-1":`#0178D4`,"boost-lighten-2":`#0178D4`,"boost-lighten-3":`#0178D4`,border:`#0000FF`,"border-blurred":`#000080`,"button-color-foreground":`#E0E0E0`,"button-foreground":`#E0E0E0`,error:`#800000`,"error-darken-1":`#800000`,"error-darken-2":`#800000`,"error-darken-3":`#800000`,"error-lighten-1":`#800000`,"error-lighten-2":`#800000`,"error-lighten-3":`#800000`,"error-muted":`#0178D4`,"footer-background":`#121212`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E0E0E0`,"footer-foreground":`#E0E0E0`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#0000FF`,foreground:`#E0E0E0`,"foreground-darken-1":`#E0E0E0`,"foreground-darken-2":`#E0E0E0`,"foreground-darken-3":`#E0E0E0`,"foreground-disabled":`#00000060`,"foreground-lighten-1":`#E0E0E0`,"foreground-lighten-2":`#E0E0E0`,"foreground-lighten-3":`#E0E0E0`,"foreground-muted":`#00000099`,"input-cursor-background":`#121212`,"input-cursor-foreground":`#E0E0E0`,"input-selection-background":`#000080`,"link-background":`#00000000`,"link-background-hover":`#000080`,"link-color":`#E0E0E0`,"link-color-hover":`#0178D4`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#000080`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#000080`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#000080`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E0E0E0`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E0E0E0`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#00000099`,panel:`#121212`,"panel-darken-1":`#121212`,"panel-darken-2":`#121212`,"panel-darken-3":`#121212`,"panel-lighten-1":`#121212`,"panel-lighten-2":`#121212`,"panel-lighten-3":`#121212`,primary:`#000080`,"primary-background":`#000080`,"primary-background-darken-1":`#000080`,"primary-background-darken-2":`#000080`,"primary-background-darken-3":`#000080`,"primary-background-lighten-1":`#000080`,"primary-background-lighten-2":`#000080`,"primary-background-lighten-3":`#000080`,"primary-darken-1":`#000080`,"primary-darken-2":`#000080`,"primary-darken-3":`#000080`,"primary-lighten-1":`#000080`,"primary-lighten-2":`#000080`,"primary-lighten-3":`#000080`,"primary-muted":`#0178D4`,scrollbar:`#000080`,"scrollbar-active":`#000080`,"scrollbar-background":`#121212`,"scrollbar-background-active":`#121212`,"scrollbar-background-hover":`#121212`,"scrollbar-corner-color":`#E0E0E0`,"scrollbar-hover":`#000040`,secondary:`#008080`,"secondary-background":`#008080`,"secondary-background-darken-1":`#008080`,"secondary-background-darken-2":`#008080`,"secondary-background-darken-3":`#008080`,"secondary-background-lighten-1":`#008080`,"secondary-background-lighten-2":`#008080`,"secondary-background-lighten-3":`#008080`,"secondary-darken-1":`#008080`,"secondary-darken-2":`#008080`,"secondary-darken-3":`#008080`,"secondary-lighten-1":`#008080`,"secondary-lighten-2":`#008080`,"secondary-lighten-3":`#008080`,"secondary-muted":`#0178D4`,success:`#008000`,"success-darken-1":`#008000`,"success-darken-2":`#008000`,"success-darken-3":`#008000`,"success-lighten-1":`#008000`,"success-lighten-2":`#008000`,"success-lighten-3":`#008000`,"success-muted":`#0178D4`,surface:`#121212`,"surface-active":`#131313`,"surface-darken-1":`#121212`,"surface-darken-2":`#121212`,"surface-darken-3":`#121212`,"surface-lighten-1":`#121212`,"surface-lighten-2":`#121212`,"surface-lighten-3":`#121212`,text:`#E0E0E0`,"text-accent":`#5656FF`,"text-disabled":`#E0E0E0`,"text-error":`#AB5656`,"text-muted":`#E0E0E0`,"text-primary":`#5656AB`,"text-secondary":`#56ABAB`,"text-success":`#56AB56`,"text-warning":`#ABAB56`,warning:`#808000`,"warning-darken-1":`#808000`,"warning-darken-2":`#808000`,"warning-darken-3":`#808000`,"warning-lighten-1":`#808000`,"warning-lighten-2":`#808000`,"warning-lighten-3":`#808000`,"warning-muted":`#0178D4`}},"textual-dark":{name:`textual-dark`,dark:!0,ansi:yr,vars:{accent:`#FEA62B`,"accent-darken-1":`#E7920D`,"accent-darken-2":`#CF7E00`,"accent-darken-3":`#B86B00`,"accent-lighten-1":`#FFBA41`,"accent-lighten-2":`#FFCF56`,"accent-lighten-3":`#FFE46B`,"accent-muted":`#593E19`,background:`#121212`,"background-darken-1":`#000000`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#212121`,"background-lighten-2":`#313131`,"background-lighten-3":`#414141`,"block-cursor-background":`#0178D4`,"block-cursor-blurred-background":`#0178D44C`,"block-cursor-blurred-foreground":`#E0E0E0`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#0178D4`,"border-blurred":`#191919`,"button-color-foreground":`#FFFFFFDD`,"button-foreground":`#E0E0E0`,error:`#B93C5B`,"error-darken-1":`#A32549`,"error-darken-2":`#8D0638`,"error-darken-3":`#780028`,"error-lighten-1":`#D0506D`,"error-lighten-2":`#E76580`,"error-lighten-3":`#FE7993`,"error-muted":`#441E27`,"footer-background":`#242F38`,"footer-description-background":`#00000000`,"footer-description-foreground":`#E0E0E0`,"footer-foreground":`#E0E0E0`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FFA62B`,foreground:`#E0E0E0`,"foreground-darken-1":`#CACACA`,"foreground-darken-2":`#B6B6B6`,"foreground-darken-3":`#A2A2A2`,"foreground-disabled":`#E0E0E060`,"foreground-lighten-1":`#F5F5F5`,"foreground-lighten-2":`#FFFFFF`,"foreground-lighten-3":`#FFFFFF`,"foreground-muted":`#E0E0E099`,"input-cursor-background":`#E0E0E0`,"input-cursor-foreground":`#121212`,"input-selection-background":`#368AE966`,"link-background":`#00000000`,"link-background-hover":`#0178D4`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#0178D4`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#0178D4`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#0178D4`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#E0E0E0`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#E0E0E0`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#E0E0E099`,panel:`#242F38`,"panel-darken-1":`#141F27`,"panel-darken-2":`#000F18`,"panel-darken-3":`#000003`,"panel-lighten-1":`#343F49`,"panel-lighten-2":`#45505A`,"panel-lighten-3":`#57626D`,primary:`#0178D4`,"primary-background":`#33424E`,"primary-background-darken-1":`#21313E`,"primary-background-darken-2":`#0F212F`,"primary-background-darken-3":`#0F212F`,"primary-background-lighten-1":`#45525D`,"primary-background-lighten-2":`#57636D`,"primary-background-lighten-3":`#69747D`,"primary-darken-1":`#0065BE`,"primary-darken-2":`#0053AA`,"primary-darken-3":`#004295`,"primary-lighten-1":`#368AE9`,"primary-lighten-2":`#539EFF`,"primary-lighten-3":`#6DB2FF`,"primary-muted":`#0C304C`,scrollbar:`#003054`,"scrollbar-active":`#0178D4`,"scrollbar-background":`#000000`,"scrollbar-background-active":`#000000`,"scrollbar-background-hover":`#000000`,"scrollbar-corner-color":`#000000`,"scrollbar-hover":`#003C6A`,secondary:`#004578`,"secondary-background":`#333B42`,"secondary-background-darken-1":`#212A31`,"secondary-background-darken-2":`#0F1921`,"secondary-background-darken-3":`#0F1921`,"secondary-background-lighten-1":`#454C52`,"secondary-background-lighten-2":`#575E63`,"secondary-background-lighten-3":`#696F74`,"secondary-darken-1":`#003465`,"secondary-darken-2":`#002452`,"secondary-darken-3":`#001541`,"secondary-lighten-1":`#23568B`,"secondary-lighten-2":`#3B689F`,"secondary-lighten-3":`#507BB3`,"secondary-muted":`#0C2130`,success:`#4EBF71`,"success-darken-1":`#36AA5E`,"success-darken-2":`#18954B`,"success-darken-3":`#008139`,"success-lighten-1":`#64D484`,"success-lighten-2":`#7AE998`,"success-lighten-3":`#8FFFAC`,"success-muted":`#24452E`,surface:`#1E1E1E`,"surface-active":`#2A2A2A`,"surface-darken-1":`#0D0D0D`,"surface-darken-2":`#000000`,"surface-darken-3":`#000000`,"surface-lighten-1":`#2D2D2D`,"surface-lighten-2":`#3E3E3E`,"surface-lighten-3":`#4F4F4F`,text:`#FFFFFFDD`,"text-accent":`#FFC473`,"text-disabled":`#FFFFFF60`,"text-error":`#D17E92`,"text-muted":`#FFFFFF99`,"text-primary":`#57A5E2`,"text-secondary":`#5684A5`,"text-success":`#8AD4A1`,"text-warning":`#FFC473`,warning:`#FEA62B`,"warning-darken-1":`#E7920D`,"warning-darken-2":`#CF7E00`,"warning-darken-3":`#B86B00`,"warning-lighten-1":`#FFBA41`,"warning-lighten-2":`#FFCF56`,"warning-lighten-3":`#FFE46B`,"warning-muted":`#593E19`}},"textual-light":{name:`textual-light`,dark:!1,ansi:{black:`#000000`,red:`#AA3731`,green:`#448C27`,yellow:`#CB9000`,blue:`#325CC0`,magenta:`#7A3E9D`,cyan:`#0083B2`,white:`#F7F7F7`,brightBlack:`#777777`,brightRed:`#F05050`,brightGreen:`#60CB00`,brightYellow:`#FFBC5D`,brightBlue:`#007ACC`,brightMagenta:`#E64CE6`,brightCyan:`#00AACB`,brightWhite:`#F7F7F7`},vars:{accent:`#FEA62B`,"accent-darken-1":`#E7920D`,"accent-darken-2":`#CF7E00`,"accent-darken-3":`#B86B00`,"accent-lighten-1":`#FFBA41`,"accent-lighten-2":`#FFCF56`,"accent-lighten-3":`#FFE46B`,"accent-muted":`#E9CEA9`,background:`#E0E0E0`,"background-darken-1":`#CACACA`,"background-darken-2":`#B6B6B6`,"background-darken-3":`#A2A2A2`,"background-lighten-1":`#F5F5F5`,"background-lighten-2":`#FFFFFF`,"background-lighten-3":`#FFFFFF`,"block-cursor-background":`#004578`,"block-cursor-blurred-background":`#0045784C`,"block-cursor-blurred-foreground":`#1F1F1F`,"block-cursor-foreground":`#000000DD`,"block-hover-background":`#00000019`,boost:`#0000000A`,"boost-darken-1":`#0000000A`,"boost-darken-2":`#0000000A`,"boost-darken-3":`#0000000A`,"boost-lighten-1":`#1616160A`,"boost-lighten-2":`#2525250A`,"boost-lighten-3":`#3535350A`,border:`#004578`,"border-blurred":`#D0D1D0`,"button-color-foreground":`#000000DD`,"button-foreground":`#1F1F1F`,error:`#B93C5B`,"error-darken-1":`#A32549`,"error-darken-2":`#8D0638`,"error-darken-3":`#780028`,"error-lighten-1":`#D0506D`,"error-lighten-2":`#E76580`,"error-lighten-3":`#FE7993`,"error-muted":`#D4AEB8`,"footer-background":`#D0D0D0`,"footer-description-background":`#00000000`,"footer-description-foreground":`#1F1F1F`,"footer-foreground":`#1F1F1F`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#0178D4`,foreground:`#1F1F1F`,"foreground-darken-1":`#0E0E0E`,"foreground-darken-2":`#000000`,"foreground-darken-3":`#000000`,"foreground-disabled":`#1F1F1F60`,"foreground-lighten-1":`#2E2E2E`,"foreground-lighten-2":`#3F3F3F`,"foreground-lighten-3":`#505050`,"foreground-muted":`#1F1F1F99`,"input-cursor-background":`#1F1F1F`,"input-cursor-foreground":`#E0E0E0`,"input-selection-background":`#23568B66`,"link-background":`#00000000`,"link-background-hover":`#004578`,"link-color":`#000000DD`,"link-color-hover":`#000000DD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#004578`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#004578`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#004578`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#1F1F1F`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#1F1F1F`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#1F1F1F99`,panel:`#D0D0D0`,"panel-darken-1":`#BBBBBB`,"panel-darken-2":`#A6A6A6`,"panel-darken-3":`#939393`,"panel-lighten-1":`#E5E5E5`,"panel-lighten-2":`#FAFAFA`,"panel-lighten-3":`#FFFFFF`,primary:`#004578`,"primary-background":`#004578`,"primary-background-darken-1":`#003465`,"primary-background-darken-2":`#002452`,"primary-background-darken-3":`#001541`,"primary-background-lighten-1":`#23568B`,"primary-background-lighten-2":`#3B689F`,"primary-background-lighten-3":`#507BB3`,"primary-darken-1":`#003465`,"primary-darken-2":`#002452`,"primary-darken-3":`#001541`,"primary-lighten-1":`#23568B`,"primary-lighten-2":`#3B689F`,"primary-lighten-3":`#507BB3`,"primary-muted":`#9CB1C0`,scrollbar:`#7994A9`,"scrollbar-active":`#004578`,"scrollbar-background":`#CACACA`,"scrollbar-background-active":`#CACACA`,"scrollbar-background-hover":`#CACACA`,"scrollbar-corner-color":`#CACACA`,"scrollbar-hover":`#6587A1`,secondary:`#0178D4`,"secondary-background":`#0178D4`,"secondary-background-darken-1":`#0065BE`,"secondary-background-darken-2":`#0053AA`,"secondary-background-darken-3":`#004295`,"secondary-background-lighten-1":`#368AE9`,"secondary-background-lighten-2":`#539EFF`,"secondary-background-lighten-3":`#6DB2FF`,"secondary-darken-1":`#0065BE`,"secondary-darken-2":`#0053AA`,"secondary-darken-3":`#004295`,"secondary-lighten-1":`#368AE9`,"secondary-lighten-2":`#539EFF`,"secondary-lighten-3":`#6DB2FF`,"secondary-muted":`#9DC0DC`,success:`#4EBF71`,"success-darken-1":`#36AA5E`,"success-darken-2":`#18954B`,"success-darken-3":`#008139`,"success-lighten-1":`#64D484`,"success-lighten-2":`#7AE998`,"success-lighten-3":`#8FFFAC`,"success-muted":`#B4D6BE`,surface:`#D8D8D8`,"surface-active":`#E8E8E8`,"surface-darken-1":`#C3C3C3`,"surface-darken-2":`#AEAEAE`,"surface-darken-3":`#9A9A9A`,"surface-lighten-1":`#EDEDED`,"surface-lighten-2":`#FFFFFF`,"surface-lighten-3":`#FFFFFF`,text:`#000000DD`,"text-accent":`#A86D1C`,"text-disabled":`#00000060`,"text-error":`#7A273C`,"text-muted":`#00000099`,"text-primary":`#002D4F`,"text-secondary":`#004F8B`,"text-success":`#337E4A`,"text-warning":`#A86D1C`,warning:`#FEA62B`,"warning-darken-1":`#E7920D`,"warning-darken-2":`#CF7E00`,"warning-darken-3":`#B86B00`,"warning-lighten-1":`#FFBA41`,"warning-lighten-2":`#FFCF56`,"warning-lighten-3":`#FFE46B`,"warning-muted":`#E9CEA9`}},"tokyo-night":{name:`tokyo-night`,dark:!0,ansi:{black:`#15161E`,red:`#F7768E`,green:`#9ECE6A`,yellow:`#E0AF68`,blue:`#7AA2F7`,magenta:`#BB9AF7`,cyan:`#7DCFFF`,white:`#A9B1D6`,brightBlack:`#414868`,brightRed:`#F7768E`,brightGreen:`#9ECE6A`,brightYellow:`#E0AF68`,brightBlue:`#7AA2F7`,brightMagenta:`#BB9AF7`,brightCyan:`#7DCFFF`,brightWhite:`#C0CAF5`},vars:{accent:`#FE9E64`,"accent-darken-1":`#E78A51`,"accent-darken-2":`#D0763E`,"accent-darken-3":`#BA632C`,"accent-lighten-1":`#FFB277`,"accent-lighten-2":`#FFC78A`,"accent-lighten-3":`#FFDC9E`,"accent-muted":`#5E4238`,background:`#1A1B26`,"background-darken-1":`#070817`,"background-darken-2":`#000000`,"background-darken-3":`#000000`,"background-lighten-1":`#292A36`,"background-lighten-2":`#3A3A47`,"background-lighten-3":`#4B4B58`,"block-cursor-background":`#BB9AF7`,"block-cursor-blurred-background":`#BB9AF74C`,"block-cursor-blurred-foreground":`#A9B1D6`,"block-cursor-foreground":`#FFFFFFDD`,"block-hover-background":`#FFFFFF19`,boost:`#FFFFFF0A`,"boost-darken-1":`#E9E9E90A`,"boost-darken-2":`#D4D4D40A`,"boost-darken-3":`#BFBFBF0A`,"boost-lighten-1":`#FFFFFF0A`,"boost-lighten-2":`#FFFFFF0A`,"boost-lighten-3":`#FFFFFF0A`,border:`#BB9AF7`,"border-blurred":`#1E2235`,"button-color-foreground":`#24283B`,"button-foreground":`#A9B1D6`,error:`#F6768E`,"error-darken-1":`#E0617A`,"error-darken-2":`#C94D68`,"error-darken-3":`#B33856`,"error-lighten-1":`#FF8AA1`,"error-lighten-2":`#FF9FB5`,"error-lighten-3":`#FFB4CA`,"error-muted":`#5C3645`,"footer-background":`#414868`,"footer-description-background":`#00000000`,"footer-description-foreground":`#A9B1D6`,"footer-foreground":`#A9B1D6`,"footer-item-background":`#00000000`,"footer-key-background":`#00000000`,"footer-key-foreground":`#FF9E64`,foreground:`#A9B1D6`,"foreground-darken-1":`#949CC1`,"foreground-darken-2":`#8189AC`,"foreground-darken-3":`#6D7698`,"foreground-disabled":`#A9B1D660`,"foreground-lighten-1":`#BDC5EB`,"foreground-lighten-2":`#D2DAFF`,"foreground-lighten-3":`#E7EFFF`,"foreground-muted":`#A9B1D699`,"input-cursor-background":`#A9B1D6`,"input-cursor-foreground":`#1A1B26`,"input-selection-background":`#D0AEFF66`,"link-background":`#00000000`,"link-background-hover":`#BB9AF7`,"link-color":`#FFFFFFDD`,"link-color-hover":`#FFFFFFDD`,"markdown-h1-background":`#00000000`,"markdown-h1-color":`#BB9AF7`,"markdown-h2-background":`#00000000`,"markdown-h2-color":`#BB9AF7`,"markdown-h3-background":`#00000000`,"markdown-h3-color":`#BB9AF7`,"markdown-h4-background":`#00000000`,"markdown-h4-color":`#A9B1D6`,"markdown-h5-background":`#00000000`,"markdown-h5-color":`#A9B1D6`,"markdown-h6-background":`#00000000`,"markdown-h6-color":`#A9B1D699`,panel:`#414868`,"panel-darken-1":`#2F3755`,"panel-darken-2":`#1E2744`,"panel-darken-3":`#0C1733`,"panel-lighten-1":`#53597A`,"panel-lighten-2":`#656B8E`,"panel-lighten-3":`#787EA1`,primary:`#BB9AF7`,"primary-background":`#504D60`,"primary-background-darken-1":`#413D52`,"primary-background-darken-2":`#322E45`,"primary-background-darken-3":`#322E45`,"primary-background-lighten-1":`#605D6E`,"primary-background-lighten-2":`#6F6C7C`,"primary-background-lighten-3":`#7E7C8A`,"primary-darken-1":`#A686E1`,"primary-darken-2":`#9173CC`,"primary-darken-3":`#7D60B7`,"primary-lighten-1":`#D0AEFF`,"primary-lighten-2":`#E5C2FF`,"primary-lighten-3":`#FBD7FF`,"primary-muted":`#4A4164`,scrollbar:`#4F4270`,"scrollbar-active":`#BB9AF7`,"scrollbar-background":`#070817`,"scrollbar-background-active":`#070817`,"scrollbar-background-hover":`#070817`,"scrollbar-corner-color":`#070817`,"scrollbar-hover":`#615187`,secondary:`#7AA2F7`,"secondary-background":`#484E60`,"secondary-background-darken-1":`#383E52`,"secondary-background-darken-2":`#282F45`,"secondary-background-darken-3":`#282F45`,"secondary-background-lighten-1":`#585D6E`,"secondary-background-lighten-2":`#686D7C`,"secondary-background-lighten-3":`#787D8A`,"secondary-darken-1":`#648EE1`,"secondary-darken-2":`#4D7BCC`,"secondary-darken-3":`#3468B7`,"secondary-lighten-1":`#8FB6FF`,"secondary-lighten-2":`#A5CAFF`,"secondary-lighten-3":`#BBDFFF`,"secondary-muted":`#364364`,success:`#9ECE6A`,"success-darken-1":`#89B956`,"success-darken-2":`#75A443`,"success-darken-3":`#619030`,"success-lighten-1":`#B2E37D`,"success-lighten-2":`#C8F891`,"success-lighten-3":`#DDFFA6`,"success-muted":`#41503A`,surface:`#24283B`,"surface-active":`#313448`,"surface-darken-1":`#14182A`,"surface-darken-2":`#00031B`,"surface-darken-3":`#000009`,"surface-lighten-1":`#34384C`,"surface-lighten-2":`#45495E`,"surface-lighten-3":`#575A70`,text:`#FFFFFFDD`,"text-accent":`#FFBE98`,"text-disabled":`#FFFFFF60`,"text-error":`#F9A4B4`,"text-muted":`#FFFFFF99`,"text-primary":`#D2BCF9`,"text-secondary":`#A7C1F9`,"text-success":`#BEDE9C`,"text-warning":`#EACA9B`,warning:`#DFAF68`,"warning-darken-1":`#C99A55`,"warning-darken-2":`#B48742`,"warning-darken-3":`#9E7430`,"warning-lighten-1":`#F6C37B`,"warning-lighten-2":`#FFD88F`,"warning-lighten-3":`#FFEDA3`,"warning-muted":`#554739`}}},xr=Object.freeze(Object.keys(br).sort()),Sr=new Map;function Cr(){return xr}function wr(e){if(!Tr(e))return null;let t=Sr.get(e);if(t!==void 0)return t;let n=Er(br[e]);return Sr.set(e,n),n}function Tr(e){return Object.hasOwn(br,e)}function Er(e){let t=new Map;for(let[n,r]of Object.entries(e.vars))t.set(n,Or(r,e.name,n));return new Zt(e.name,e.dark,t)}const Dr=/^[0-9a-fA-F]+$/;function Or(e,t,n){let r=e.startsWith(`#`)?e.slice(1):e;if(r.length!==6&&r.length!==8||!Dr.test(r))throw Error(`Theme ${t}: var ${n} has invalid hex ${JSON.stringify(e)} (expected #RRGGBB or #RRGGBBAA)`);return r.length===6?Cn(r):wn(r)}const kr=new Set([`error`,`success`,`warning`]);function Ar(e){let t=e.indexOf(`-`);return t===-1?e:e.slice(0,t)}function jr(e){return kr.has(Ar(e))}function Mr(e,t,n){if(zn(t))return new Zt(n??e.name,e.dark,e.vars);let r={...t,hueShift:0},i=new Map;for(let[n,a]of e.vars){let e=jr(n)?r:t;i.set(n,Jn.fromRgba(a).applyKey(e).toRgba())}let a=i.get(`background`);if(a===void 0)throw Error(`transposePalette: palette "${e.name}" has no "background" var; cannot derive the dark flag without a background color.`);let o=Jn.fromRgba(a).l<.5;return new Zt(n??e.name,o,i)}const Nr={linear:e=>e,step:()=>0},Pr=Object.keys(Nr);function Fr(e){if(!Object.hasOwn(Nr,e))throw RangeError(`unknown ramp easing ${JSON.stringify(e)}; expected one of `+Pr.map(e=>JSON.stringify(e)).join(`, `));return e}var Ir=class{easing;stops;constructor(e,t){if(this.easing=e,this.stops=t,t.length===0)throw RangeError(`a ColorRamp needs at least one stop`);for(let[e,n]of t.entries()){if(!Number.isFinite(n.at))throw RangeError(`ColorRamp stop ${e} has a non-finite position ${n.at}`);let r=t[e-1];if(r!==void 0&&n.at<r.at)throw RangeError(`ColorRamp stops must be in ascending position order; stop ${e} at ${n.at} follows stop ${e-1} at ${r.at}`)}}at(e){if(!Number.isFinite(e))throw RangeError(`ColorRamp.at needs a finite value, got ${e}`);let t=this.stops,n=-1;for(;n+1<t.length&&t[n+1].at<=e;)n++;if(n<0)return t[0].color;let r=t[n];if(n===t.length-1)return r.color;let i=t[n+1],a=Nr[this.easing]((e-r.at)/(i.at-r.at));return a<=0?r.color:a>=1?i.color:Jn.fromRgba(r.color).mix(Jn.fromRgba(i.color),a).toRgba()}};function Lr(e,t){return{owner:e.owner,row:e.row,col:e.col+t,inner:e.inner&&Lr(e.inner,t)}}const Rr=[`bold`,`dim`,`italic`,`underline`,`blink`,`blink2`,`reverse`,`conceal`,`strike`,`underline2`,`frame`,`encircle`,`overline`],zr={bold:1,dim:2,italic:3,underline:4,blink:5,blink2:6,reverse:7,conceal:8,strike:9,underline2:21,frame:51,encircle:52,overline:53},Br={b:`bold`,d:`dim`,i:`italic`,u:`underline`,s:`strike`,r:`reverse`,o:`overline`,uu:`underline2`};var Vr=class extends Error{constructor(e,t){super(e,t),this.name=`StyleSyntaxError`}};const Hr=new Map;var V=class e{color;bgcolor;bold;dim;italic;underline;blink;blink2;reverse;conceal;strike;underline2;frame;encircle;overline;link;meta;anchor;constructor(e={}){this.color=Qr(e.color),this.bgcolor=Qr(e.bgcolor),this.bold=e.bold,this.dim=e.dim,this.italic=e.italic,this.underline=e.underline,this.blink=e.blink,this.blink2=e.blink2,this.reverse=e.reverse,this.conceal=e.conceal,this.strike=e.strike,this.underline2=e.underline2,this.frame=e.frame,this.encircle=e.encircle,this.overline=e.overline,this.link=e.link,this.meta=e.meta,this.anchor=e.anchor}get isNull(){return this.color===void 0&&this.bgcolor===void 0&&this.bold===void 0&&this.dim===void 0&&this.italic===void 0&&this.underline===void 0&&this.blink===void 0&&this.blink2===void 0&&this.reverse===void 0&&this.conceal===void 0&&this.strike===void 0&&this.underline2===void 0&&this.frame===void 0&&this.encircle===void 0&&this.overline===void 0&&this.link===void 0&&this.meta===void 0&&this.anchor===void 0}get transparentBackground(){return this.bgcolor===void 0||this.bgcolor.isDefault}get backgroundStyle(){return new e({bgcolor:this.bgcolor})}with(t){return new e({...this,...t})}get withoutColor(){return this.with({color:void 0,bgcolor:void 0})}withLink(e){return this.with({link:e})}clearMetaAndLinks(){return this.with({link:void 0,meta:void 0})}withAnchor(e){return this.with({anchor:e})}shiftedBy(e){return this.anchor?this.withAnchor(Lr(this.anchor,e)):this}add(t){return!t||t.isNull?this:this.isNull?t:new e({color:t.color??this.color,bgcolor:t.bgcolor??this.bgcolor,bold:t.bold??this.bold,dim:t.dim??this.dim,italic:t.italic??this.italic,underline:t.underline??this.underline,blink:t.blink??this.blink,blink2:t.blink2??this.blink2,reverse:t.reverse??this.reverse,conceal:t.conceal??this.conceal,strike:t.strike??this.strike,underline2:t.underline2??this.underline2,frame:t.frame??this.frame,encircle:t.encircle??this.encircle,overline:t.overline??this.overline,link:t.link??this.link,meta:t.meta&&this.meta?{...this.meta,...t.meta}:t.meta??this.meta,anchor:t.anchor??this.anchor})}equals(e){return this===e?!0:this.color?.name===e.color?.name&&this.bgcolor?.name===e.bgcolor?.name&&this.bold===e.bold&&this.dim===e.dim&&this.italic===e.italic&&this.underline===e.underline&&this.blink===e.blink&&this.blink2===e.blink2&&this.reverse===e.reverse&&this.conceal===e.conceal&&this.strike===e.strike&&this.underline2===e.underline2&&this.frame===e.frame&&this.encircle===e.encircle&&this.overline===e.overline&&this.link===e.link&&ti(this.anchor,e.anchor)}drawnColors(e){let t=tn,n=this.bgcolor?.flattenAlpha(t),r=n?.getTruecolor(void 0,!1)??t,i=this.color?.flattenAlpha(r),a=t=>e===void 0?t:t.downgrade(e);return{color:i===void 0?void 0:a(i),bgcolor:n===void 0?void 0:a(n)}}toSgrCodes(e){if(this.isNull)return``;let t=this.drawnColors(e);return[...Rr.filter(e=>this[e]===!0).map(e=>`${zr[e]}`),...t.color?.getAnsiCodes(!0)??[],...t.bgcolor?.getAnsiCodes(!1)??[]].join(`;`)}toString(){if(this.isNull)return`none`;let e=[];for(let t of Rr)this[t]===!1&&e.push(`not ${t}`);for(let t of Rr)this[t]===!0&&e.push(t);return this.color&&e.push(this.color.name),this.bgcolor&&e.push(`on ${this.bgcolor.name}`),this.link&&e.push(`link ${this.link}`),e.join(` `)||`none`}static null(){return Ur}static fromColor(t,n){return new e({color:t,bgcolor:n})}static fromMeta(t){return new e({meta:t})}static pickFirst(...e){for(let t of e)if(t!==void 0)return t;throw Error(`All arguments are undefined`)}static combine(e){let t=Ur;for(let n of e)n&&(t=t.add(n));return t}static chain(...t){return e.combine(t)}static normalize(e){return e.trim().replace(/\s+/g,` `)}static parse(t){let n=e.normalize(t);if(n===``||n===`none`)return Ur;let r=Hr.get(n);if(r)return r;let i=Zr(n);return Hr.set(n,i),i}};const Ur=new V,Wr=/^[a-z][a-z0-9._-]*$/;var Gr=class{styles;constructor(e={},t){if(this.styles=new Map,t?.inherit!==!1)for(let[e,t]of Object.entries($r))this.styles.set(e,t);for(let[t,n]of Object.entries(e)){if(!Wr.test(t))throw Error(`Invalid style name: "${t}" (must be lowercase, start with letter, contain only letters, digits, ".", "-", "_")`);this.styles.set(t,V.parse(n))}}get(e){return this.styles.get(e)}resolve(e){return e instanceof V?e:this.styles.get(e)??V.parse(e)}has(e){return this.styles.has(e)}};const Kr=new Set(Rr),qr=[`not`,`on`,`link`,...Rr,...Fn];function Jr(e,t){let n=[],r=Array.from({length:t.length+1},(e,t)=>t);for(let i=1;i<=e.length;i++){let a=[i];for(let o=1;o<=t.length;o++){let s=i>1&&o>1&&e[i-1]===t[o-2]&&e[i-2]===t[o-1];a[o]=Math.min(r[o]+1,a[o-1]+1,r[o-1]+Number(e[i-1]!==t[o-1]),s?n[o-2]+1:1/0)}[n,r]=[r,a]}return r[t.length]}function Yr(e,t){let n=e.toLowerCase(),r=Math.max(1,Math.floor(n.length/3)),i=t.filter(e=>Math.abs(e.length-n.length)<=r).map(e=>({name:e,distance:Jr(n,e)})),a=Math.min(r,...i.map(e=>e.distance)),o=i.filter(e=>e.distance===a).map(e=>`"${e.name}"`).sort();return o.length===0?``:` (did you mean ${o.join(` or `)}?)`}function Xr(e,t,n){try{return _n.parse(e)}catch(r){throw new Vr(`${t} "${e}"${Yr(e,n)}: ${String(r)}`,{cause:r})}}function Zr(e){let t=e.split(/\s+/),n={},r=0;for(;r<t.length;){let e=t[r];if(e===`not`){r++;let e=t[r];if(!e)throw new Vr(`Expected attribute after "not" in style definition`);let i=Br[e]??e;if(!Kr.has(i))throw new Vr(`Invalid attribute: "${e}"${Yr(e,Rr)}`);n[i]=!1,r++;continue}if(e===`on`){r++;let e=t[r];if(!e)throw new Vr(`Expected color after "on" in style definition`);n.bgcolor=Xr(e,`Invalid background color`,Fn),r++;continue}if(e===`link`){r++;let e=t[r];e&&(n.link=e),r++;continue}let i=Br[e]??e;if(Kr.has(i)){n[i]=!0,r++;continue}n.color=Xr(e,`Invalid style definition`,qr),r++}return new V(n)}function Qr(e){if(e!==void 0)return e instanceof _n?e:_n.parse(e)}const $r={none:Ur,reset:new V({color:_n.default(),bgcolor:_n.default(),bold:!1,dim:!1,italic:!1,underline:!1,blink:!1,blink2:!1,reverse:!1,conceal:!1,strike:!1,underline2:!1,frame:!1,encircle:!1,overline:!1}),bold:new V({bold:!0}),dim:new V({dim:!0}),italic:new V({italic:!0}),underline:new V({underline:!0}),blink:new V({blink:!0}),blink2:new V({blink2:!0}),reverse:new V({reverse:!0}),conceal:new V({conceal:!0}),strike:new V({strike:!0}),underline2:new V({underline2:!0}),frame:new V({frame:!0}),encircle:new V({encircle:!0}),overline:new V({overline:!0}),"table.header":new V({bold:!0}),"table.footer":new V({bold:!0}),"table.cell":Ur,"table.title":new V({italic:!0}),"table.caption":new V({italic:!0,dim:!0}),"repr.str":V.parse(`green`),"repr.number":V.parse(`cyan`),"repr.bool":V.parse(`italic bright_magenta`),"repr.none":V.parse(`italic magenta`),"repr.url":V.parse(`not italic underline bright_blue`),"repr.uuid":V.parse(`bright_yellow`),"repr.error":V.parse(`bold red`),"repr.indent":V.parse(`dim green`),"repr.attrib_name":V.parse(`yellow`),"repr.attrib_value":V.parse(`magenta`),"repr.attrib_equal":V.parse(`bold`),"repr.tag_start":V.parse(`bold`),"repr.tag_name":V.parse(`bright_magenta`),"repr.tag_contents":V.parse(`default`),"repr.tag_end":V.parse(`bold`),"log.time":V.parse(`cyan dim`),"log.message":Ur,"log.path":V.parse(`dim`),"log.line_no":V.parse(`cyan`),"log.level":Ur,"rule.line":V.parse(`green`),"rule.text":V.parse(`bold`),"json.brace":V.parse(`bold`),"json.bool_true":V.parse(`italic bright_green`),"json.bool_false":V.parse(`italic bright_red`),"json.key":V.parse(`bold blue`),"json.null":V.parse(`italic magenta`),"json.number":V.parse(`bold not italic cyan`),"json.str":V.parse(`not bold not italic green`),"markdown.h1":V.parse(`bold underline`),"markdown.h2":V.parse(`bold`),"markdown.h3":V.parse(`bold dim`),"markdown.h4":V.parse(`bold dim italic`),"markdown.code":V.parse(`cyan on grey11`),"markdown.hr":V.parse(`yellow`),"markdown.link":V.parse(`bright_blue`),"markdown.link_url":V.parse(`blue`),"progress.description":Ur,"progress.percentage":V.parse(`cyan`),"progress.remaining":V.parse(`cyan`),"progress.elapsed":V.parse(`cyan`),"progress.spinner":V.parse(`green`),"progress.download":V.parse(`green`),"progress.filesize":V.parse(`green`),"progress.filesize.total":V.parse(`green`),"progress.data.speed":V.parse(`red`),"bar.back":V.parse(`grey23`),"bar.complete":V.parse(`magenta`),"bar.finished":V.parse(`green`),"bar.pulse":V.parse(`magenta`),"scrollbar.thumb":Ur,"scrollbar.track":V.parse(`grey37`),tree:Ur,"tree.guide":Ur,"status.spinner":V.parse(`green`),"status.message":Ur,prompt:V.parse(`bold`),"prompt.choices":V.parse(`magenta`),"prompt.default":V.parse(`cyan`),"inspect.attr":V.parse(`yellow italic`),"inspect.attr.dunder":V.parse(`yellow italic dim`),"inspect.callable":V.parse(`bold magenta`),"inspect.error":V.parse(`bold red`),"inspect.help":V.parse(`cyan`),"inspect.doc":V.parse(`dim`),"inspect.value.border":V.parse(`green`),"traceback.border":V.parse(`red`),"traceback.text":V.parse(`red`),"traceback.title":V.parse(`bold red`),"traceback.exc_type":V.parse(`bold bright_red`),"traceback.exc_value":Ur,"traceback.offset":V.parse(`bold bright_red`),"scope.border":V.parse(`blue`),"scope.key":V.parse(`italic`),"scope.key.special":V.parse(`dim italic`),pretty:Ur,"iso8601.date":V.parse(`cyan`),"iso8601.time":V.parse(`cyan`),"iso8601.timezone":V.parse(`bright_blue`)},ei=new Gr;function ti(e,t){return e===t?!0:!e||!t?!1:e.owner===t.owner&&e.row===t.row&&e.col===t.col&&ti(e.inner,t.inner)}var ni;(function(e){e.BELL=`bell`,e.CARRIAGE_RETURN=`carriage_return`,e.HOME=`home`,e.CLEAR=`clear`,e.SHOW_CURSOR=`show_cursor`,e.HIDE_CURSOR=`hide_cursor`,e.ENABLE_ALT_SCREEN=`enable_alt_screen`,e.DISABLE_ALT_SCREEN=`disable_alt_screen`,e.CURSOR_UP=`cursor_up`,e.CURSOR_DOWN=`cursor_down`,e.CURSOR_FORWARD=`cursor_forward`,e.CURSOR_BACKWARD=`cursor_backward`,e.CURSOR_MOVE_TO_COLUMN=`cursor_move_to_column`,e.CURSOR_MOVE_TO=`cursor_move_to`,e.ERASE_IN_LINE=`erase_in_line`,e.SET_WINDOW_TITLE=`set_window_title`})(ni||={});var H=class e{text;style;control;constructor(e,t,n){this.text=e,this.style=t,this.control=n}get cellLength(){return this.control?0:N(this.text)}get hasText(){return this.text.length>0}get isControl(){return this.control!==void 0}splitCells(t){let n=this.cellLength;if(t>=n)return[this,new e(``)];if(t<=0)return[new e(``),this];let[r,i]=Vt(this.text,t);return[new e(r,this.style),new e(i,this.style?.shiftedBy(n-N(i)))]}static _line;static line(){return e._line??=new e(`
16
+ `)}static anchorLines(t,n,r=0){return t.map((t,i)=>{let a=r+i,o=0;return t.map(t=>{if(t.isControl)return t;let r=t.style??V.null(),i=new e(t.text,r.withAnchor({owner:n,row:a,col:o,inner:r.anchor}));return o+=t.cellLength,i})})}static anchorAt(e,t,n){if(!Number.isInteger(t)||t<0)return;let r=0;for(let i of e[n]??[]){let e=r+i.cellLength;if(t<e){let e=i.style?.anchor;return e&&Lr(e,t-r)}r=e}}static*applyStyle(t,n,r){if(!n&&!r){yield*t;return}for(let i of t){if(i.isControl){yield i;continue}let t=i.style;n&&(t=n.add(t)),r&&(t=t?t.add(r):r),yield new e(i.text,t,i.control)}}static*filterControl(e,t){for(let n of e)n.isControl===t&&(yield n)}static splitLines(t){let n=[],r=[];for(let i of t){if(i.isControl){r.push(i);continue}let t=i.text;if(!t.includes(`
17
17
  `)){r.push(i);continue}let a=t.split(`
18
- `);for(let t=0;t<a.length;t++){t>0&&(n.push(r),r=[]);let o=a[t];o.length>0&&r.push(new e(o,i.style))}}return r.length>0&&n.push(r),n}static adjustLineLength(t,n,r,i=!0){let a=e.getLineLength(t);if(a===n)return t;if(a<n)return i?[...t,new e(` `.repeat(n-a),r)]:t;let o=[],s=n;for(let e of t){if(e.isControl){o.push(e);continue}let t=e.cellLength;if(t<=s)o.push(e),s-=t;else{let[t]=e.splitCells(Bt(s));o.push(t),s=0;break}}return o}static*cropLines(t,n){let r=Math.max(0,n),i=0;for(let n of t){if(n.isControl){yield n;continue}let t=n.text.split(`
19
- `);for(let e=0;e<t.length;e++){e>0&&(i=0);let[n]=Ut(t[e],Bt(r-i));i+=zt(n),t[e]=n}let a=t.join(`
20
- `);yield a===n.text?n:new e(a,n.style)}}static splitAndCropLines(t,n){return e.splitLines(t).map(t=>e.adjustLineLength(t,n))}static getLineLength(e){let t=0;for(let n of e)n.isControl||(t+=n.cellLength);return t}static getShape(t){if(t.length===0)return[0,0];let n=0;for(let r of t){let t=e.getLineLength(r);t>n&&(n=t)}return[n,t.length]}static*mergeHorizontal(t,n=0){let r=0;for(let e of t)e.lines.length>r&&(r=e.lines.length);let i=n>0?[new e(` `.repeat(n))]:[];for(let n=0;n<r;n++){for(let r=0;r<t.length;r++){r>0&&(yield*i);let a=t[r];yield*e.adjustLineLength(a.lines[n]??[],a.width)}yield e.line()}}static*simplify(t){let n;for(let r of t){if(!n){n=r;continue}ai(n.style,r.style)&&!r.isControl&&!n.isControl?n=new e(n.text+r.text,n.style):(yield n,n=r)}n&&(yield n)}static*stripLinks(t){for(let n of t)n.style?.link?yield new e(n.text,n.style.clearMetaAndLinks(),n.control):yield n}static*stripStyles(t){for(let n of t)yield new e(n.text,void 0,n.control)}static*removeColor(t){for(let n of t)n.style?yield new e(n.text,n.style.withoutColor,n.control):yield n}static divide(e,t){if(t.length===0)return[e];let n=[],r=0,i=0,a=e[r];for(let o of t){let t=[];for(;a&&i+a.cellLength<=o;)a.isControl?t.push(a):(t.push(a),i+=a.cellLength),r++,a=e[r];if(a&&!a.isControl&&i<o){let e=Bt(o-i),[n,r]=a.splitCells(e);n.hasText&&t.push(n),i+=n.cellLength,a=r}n.push(t)}let o=[];for(a?.hasText&&o.push(a),r++;r<e.length;)o.push(e[r]),r++;return o.length>0&&n.push(o),n}static alignTop(t,n,r,i){let a=t.map(t=>e.adjustLineLength(t,n,i)),o=[new e(` `.repeat(n),i)];for(;a.length<r;)a.push([...o]);return a.slice(0,r)}static alignBottom(t,n,r,i){let a=t.map(t=>e.adjustLineLength(t,n,i)),o=[new e(` `.repeat(n),i)],s=Math.max(0,r-a.length),c=[];for(let e=0;e<s;e++)c.push([...o]);return c.push(...a),c.slice(0,r)}static alignMiddle(t,n,r,i){let a=t.map(t=>e.adjustLineLength(t,n,i)),o=[new e(` `.repeat(n),i)],s=Math.max(0,Math.floor((r-a.length)/2)),c=[];for(let e=0;e<s;e++)c.push([...o]);for(c.push(...a);c.length<r;)c.push([...o]);return c.slice(0,r)}static setShape(t,n,r,i){let a=t.map(t=>e.adjustLineLength(t,n,i)),o=[new e(` `.repeat(n),i)];for(;a.length<r;)a.push([...o]);return a.slice(0,r)}};function ai(e,t){return e===t?!0:!e||!t?!1:e.equals(t)}const oi=/^[\x00-\x7F]*$/;function si(e,t,n,r=String){return e.asciiOnly===!0&&!oi.test(r(t))?n:t}function ci(e,t){return(e.theme??ni).resolve(t)}function li(e){return{...e,maxWidth:Ht(e.maxWidth)}}function ui(e){return{...e,onDraw:void 0}}function di(e,t){let n=li(e);if(Number.isFinite(n.maxWidth))return n;let r=t.measure(ui(n)).maximum;if(!Number.isFinite(r))throw RangeError(`maxWidth is unbounded and this renderable has no natural width to fall back on: its content does not implement measure(), or something inside it asked for an unbounded width of its own. Render it at a finite width, or give the content a measure() that reports a finite maximum.`);return{...n,maxWidth:Ht(r)}}function*fi(e){let t=/\s*\S+\s*/y;for(let n=t.exec(e);n!==null;n=t.exec(e))yield n[0]}function pi(e,t){let n=Wt(e,t);return zt(n[0])>t?[``,...n]:n}function mi(e,t,n){if(t<=0)return[];let r=[],i=e=>{e>0&&r.push(Bt(e))},a=0,o=0;for(let r of fi(e)){let e=zt(r.trimEnd());if(t-a>=e)a+=zt(r);else if(n.fold&&e>t){let e=pi(r,t),n=o;for(let t=0;t<e.length;t+=1){i(n);let r=e[t];t===e.length-1?a=zt(r):n+=zt(r)}}else i(o),a=zt(r);o+=zt(r)}return r}const hi=`\\x1b\\x07\\x9c`,gi=RegExp(`[${hi}]`,`g`);function _i(e){return e.replace(gi,``)}const vi=new TextEncoder;function yi(e){let t=2166136261;for(let n of vi.encode(e))t^=n,t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function bi(e){let t=_i(e);return`\x1b]8;id=${yi(t)};${t}\x1b\\`}const xi=RegExp(`\\x1b\\]8;([^;${hi}]*);([^${hi}]*)(?:\\x1b\\\\|\\x07|\\x9c)`);new RegExp(xi.source,`g`);const Si=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g;function Ci(e){return e.replace(Si,``)}const wi=/\s+$/;function Ti(e){return e.map(e=>e.text).join(``)}function Ei(e){return zt(wi.exec(Ti(e))?.[0]??``)}function Di(e){let t=e.link;if(!t)return e;let n=_i(t);return n===t?e:e.withLink(n)}function Oi(e){return e instanceof z?Di(e.anchor?e.withAnchor(void 0):e):e}function ki(e){return e instanceof z?e.isNull:e===``}function Ai(e,t){return Di(t instanceof z?t:ji(e,t))}function ji(e,t){try{return ci(e,t)}catch(n){if(!(n instanceof Ur))throw n;return e.onStyleError?.(n,t),Gr}}var Mi=class e{start;end;style;constructor(e,t,n){this.start=e,this.end=t,this.style=n}get hasLength(){return this.end>this.start}toString(){return`Span(${this.start}, ${this.end})`}split(t){return t<=this.start||t>=this.end?[this,void 0]:[new e(this.start,t,this.style),new e(t,this.end,this.style)]}move(t){return new e(this.start+t,this.end+t,this.style)}rightCrop(t){return t>=this.end?this:new e(this.start,Math.min(this.end,t),this.style)}extend(t){return new e(this.start,this.end+t,this.style)}},V=class e{_text;_spans;_style;_justify;_overflow;_end;_tabSize;_noWrap;constructor(e,t){this._text=e?Ci(e):``,this._spans=[],this._style=Oi(t?.style??Gr),this._justify=t?.justify,this._overflow=t?.overflow,this._end=t?.end??`
21
- `,this._tabSize=t?.tabSize??8,this._noWrap=t?.noWrap??!1}get plain(){return this._text}set plain(e){let t=Ci(e);this._text=t;let n=t.length;this._spans=this._spans.map(e=>e.end>n?new Mi(e.start,Math.min(e.end,n),e.style):e).filter(e=>e.start<n)}get length(){return this._text.length}get cellLength(){return zt(this._text)}get hasContent(){return this._text.length>0}get style(){return this._style}set style(e){this._style=Oi(e)}get justify(){return this._justify}set justify(e){this._justify=e}get overflow(){return this._overflow}set overflow(e){this._overflow=e}get end(){return this._end}set end(e){this._end=e}get noWrap(){return this._noWrap}set noWrap(e){this._noWrap=e}get spans(){return this._spans}resolvedStyle(e){return Ai(e,this._style)}edgeStyle(e,t){let n=this.resolvedStyle(t);if(this._text.length===0)return n;let r=e===`left`?0:this._text.length-1,i=n;for(let e of this._spans)e.start<=r&&r<e.end&&(i=i.add(Ai(t,e.style)));return i}append(t,n){if(t instanceof e){if(n!==void 0)throw Error(`Style argument must not be provided when appending RichText`);let e=this._text.length;this._text+=t._text,this._addSpan(e,this._text.length,t._style);for(let n of t._spans)this._spans.push(n.move(e));return this}let r=Ci(t),i=this._text.length;return this._text+=r,this._addSpan(i,this._text.length,n??``),this}contains(t){let n=t instanceof e?t._text:t;return this._text.includes(n)}at(t){let n=t<0?this._text.length+t:t;return this._text[n]===void 0?new e(``):this.slice(n,n+1)}slice(e,t){let n=this._text,r=n.length,i=e??0,a=t??r,o=i<0?Math.max(0,r+i):Math.min(i,r),s=a<0?Math.max(0,r+a):Math.min(a,r);if(o>=s)return this.blankCopy();let c=n.slice(o,s),l=this.blankCopy(c);for(let e of this._spans){let t=Math.max(e.start,o)-o,n=Math.min(e.end,s)-o;t<n&&l._spans.push(new Mi(t,n,e.style))}return l}_addSpan(e,t,n){let r=Oi(n);ki(r)||this._spans.push(new Mi(e,t,r))}stylize(e,t,n){let r=this._text.length,i=t===void 0?0:t<0?r+t:t,a=n===void 0?r:n<0?r+n:n;if(i>=a||i>=r||a<=0)return this;let o=Math.max(0,i),s=Math.min(r,a);return this._addSpan(o,s,e),this}highlightRegex(e,t){let n=this._text,r=0,i=e.flags.includes(`g`)?e.flags:e.flags+`g`,a=new RegExp(e.source,i),o;for(;(o=a.exec(n))!==null;){if(o[0].length===0){a.lastIndex++;continue}if(o.groups){let e=0;for(let[t,n]of Object.entries(o.groups))if(n!==void 0){let r=o[0].indexOf(n,e);if(r>=0){let i=o.index+r;this._addSpan(i,i+n.length,t),e=r+n.length}}r++;continue}this._addSpan(o.index,o.index+o[0].length,t??``),r++}return r}highlightWords(e,t,n){let r=n?.caseSensitive!==!1,i=0;for(let n of e){if(n.length===0)continue;let e=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),a=r?`g`:`gi`,o=RegExp(`\\b${e}\\b`,a),s;for(;(s=o.exec(this._text))!==null;)this._addSpan(s.index,s.index+s[0].length,t),i++}return i}copy(){let t=new e(this._text,{style:this._style,justify:this._justify,overflow:this._overflow,end:this._end,tabSize:this._tabSize,noWrap:this._noWrap});return t._spans=this._spans.slice(),t}blankCopy(t){return new e(t??``,{style:this._style,justify:this._justify,overflow:this._overflow,end:this._end,tabSize:this._tabSize,noWrap:this._noWrap})}split(e){let t=e??`
22
- `,n=this._text,r=[],i=0;for(;;){let e=n.indexOf(t,i);if(e===-1){r.push(this.slice(i));break}r.push(this.slice(i,e)),i=e+t.length}return r}divide(e){if(e.length===0)return[this.copy()];let t=[],n=0;for(let r of e)t.push(this.slice(n,r)),n=r;return t.push(this.slice(n)),t}rstrip(){let e=this._text.replace(/\s+$/,``);return e.length<this._text.length&&(this.plain=e),this}pad(e,t){let n=(t??` `).repeat(e);return this._spans=this._spans.map(t=>t.move(e)),this._text=n+this._text+n,this}padLeft(e,t){let n=t??` `;return this._spans=this._spans.map(t=>t.move(e)),this._text=n.repeat(e)+this._text,this}padRight(e,t){let n=t??` `;return this._text+=n.repeat(e),this}setLength(e){return this._text.length<e?this._text+=` `.repeat(e-this._text.length):this._text.length>e&&(this.plain=this._text.slice(0,e)),this}extendStyle(e){let t=this._text.length;return this._text+=` `.repeat(e),this._spans=this._spans.map(n=>n.end===t?n.extend(e):n),this}truncate(e,t){if(this.cellLength<=e)return this;let n=t?.mode??`right`,r=Ht(e),i=qt(t?.marker??`…`,r),a=Bt(r-zt(i));if(n===`right`)return this._cropRightTo(a),i&&(this._text+=i),this;if(n===`left`)return this._cropLeftTo(a),i&&(this._spans=this._spans.map(e=>e.move(i.length)),this._text=i+this._text),this;let o=Bt(Math.floor(a/2)),s=Bt(a-o),c=qt(this._text,o).length,l=this._text.length-Jt(this._text,s).length,u=this._text.slice(0,c),d=this._text.slice(l),f=c,p=l,m=i.length-(p-f),h=[];for(let e of this._spans)e.end<=f?h.push(e):e.start>=p?h.push(e.move(m)):(e.start<f&&h.push(new Mi(e.start,f,e.style)),e.end>p&&h.push(new Mi(p+m,e.end+m,e.style)));return this._text=u+i+d,this._spans=h,this}_cropRightTo(e){this.plain=qt(this._text,e)}_cropLeftTo(e){let t=this._text.length-Jt(this._text,e).length,n=-t;this._spans=this._spans.map(e=>{if(!(e.end<=t))return new Mi(Math.max(0,e.start+n),e.end+n,e.style)}).filter(e=>e!==void 0),this._text=this._text.slice(t)}align(e,t){let n=this.cellLength;if(n>=t)return this;let r=t-n;switch(e){case`left`:this.padRight(r);break;case`right`:this.padLeft(r);break;case`center`:{let e=Math.floor(r/2),t=r-e;this.padLeft(e),this.padRight(t);break}}return this}removeSuffix(e){return this._text.endsWith(e)&&(this.plain=this._text.slice(0,-e.length)),this}appendTokens(e){for(let[t,n]of e)this.append(t,n);return this}static assemble(t,n){let r=new e(``,{style:n?.style});for(let n of t)if(typeof n==`string`)r.append(n);else if(n instanceof e)r.append(n);else{let[e,t]=n;r.append(e,t)}return r}static styled(t,n){let r=new e(t);return r.stylize(n),r}static fromFragments(t,n){let r=new e(``,{end:n?.end??``});for(let e of t)r.append(e);return r}*render(e){let t=this._expandTabs(this._text),n=this.resolvedStyle(e),r=this._buildSegments(t,n,e),i=B.splitLines(r),a=Ht(di(e,this).maxWidth),o=this._overflow??e.overflow??`fold`,s=this._noWrap||(e.noWrap??!1),c=o===`ignore`?Ht(1/0):a,l=s?Ht(1/0):c,u=o===`ignore`?void 0:this._justify??e.justify,d=si(e,`…`,`.`),f=t.endsWith(`
23
- `);for(let e=0;e<i.length;e+=1){let t=i[e],r=e<i.length-1||f,s=mi(Ti(t),l,{fold:o===`fold`}),p=B.divide(t,s),m=this._justifyLines(p.map(e=>[...this._fitLine(e,c,o,d)]),a,n,u);for(let e=0;e<m.length;e+=1)yield*m[e],(e<m.length-1||r)&&(yield B.line())}this._end&&(yield new B(this._end))}measure(e){let t=this._expandTabs(this._text).split(`
24
- `),n=0,r=0;for(let e of t){let t=zt(e);n=Math.max(n,t);let i=e.split(/\s+/);for(let e of i)e.length>0&&(r=Math.max(r,zt(e)))}let i=Ht(e.maxWidth);return{minimum:Math.min(r,i),maximum:Math.min(n,i)}}_expandTabs(e){return e.includes(` `)?e.replace(/\t/g,` `.repeat(this._tabSize)):e}_buildSegments(e,t,n){let r=t=>Math.max(0,Math.min(t,e.length)),i=new Set([0,e.length]);for(let e of this._spans)i.add(r(e.start)),i.add(r(e.end));let a=[...i].sort((e,t)=>e-t),o=new Map(a.map((e,t)=>[e,t])),s=a.slice(0,-1).map(()=>t);for(let e of this._spans){let t=r(e.end),i=Ai(n,e.style),c=o.get(r(e.start));for(let e=c;a[e]<t;e++)s[e]=s[e].add(i)}return s.map((t,n)=>new B(e.slice(a[n],a[n+1]),t.isNull?void 0:t))}_justifyLines(e,t,n,r){return r===`full`?e.map((r,i)=>i===e.length-1?r:this._fillLine(r,t,n)):e.map(e=>[...this._justifyLine(e,t,r)])}*_justifyLine(e,t,n){switch(n){case`center`:case`right`:{let r=B.adjustLineLength(e,B.getLineLength(e)-Ei(e),void 0,!1),i=Math.max(t-B.getLineLength(r),0),a=n===`center`?Math.floor(i/2):i;a>0&&(yield new B(` `.repeat(a))),yield*r;let o=i-a;o>0&&(yield new B(` `.repeat(o)));break}case`left`:yield*B.adjustLineLength(e,Math.max(t,B.getLineLength(e)));break;default:yield*e;break}}_fillLine(e,t,n){let r=Ti(e),i=r.split(` `);r.endsWith(` `)&&i.pop();let a=i.length-1,o=Array(a).fill(1),s=i.reduce((e,t)=>e+zt(t),0)+a;for(let e=0;s<t&&a>0;e=(e+1)%a)o[a-1-e]+=1,s+=1;let c=[],l=0;for(let e=0;e<i.length;e+=1)l+=zt(i[e]),c.push(l),l+=1,e<a&&c.push(l);let u=B.divide(e,c),d=(e,t)=>e.filter(e=>e.hasText).at(t)?.style??n,f=[];for(let e=0;e<i.length;e+=1)if(f.push(...u[e*2]),e<a){let t=d(u[e*2],-1),r=d(u[e*2+2],0),i=t.equals(r)?t:n;f.push(new B(` `.repeat(o[e]),i.isNull?void 0:i))}return f}*_fitLine(e,t,n,r){let i=B.getLineLength(e);if(i-Ei(e)<=t){yield*B.adjustLineLength(e,Math.min(i,t),void 0,!1);return}if(n===`ellipsis`&&t>0){yield*B.adjustLineLength(e,t-1,void 0,!1),yield new B(r);return}yield*B.adjustLineLength(e,t,void 0,!1)}},H=class{items;joiner;constructor(e,t){this.items=e,this.joiner=t}*render(e){let t=this.items;if(t.length!==0){yield*this.joiner.join(null,t[0]).render(e);for(let n=0;n<t.length;n++){let r=t[n];yield*r.render(e);let i=n+1<t.length?t[n+1]:null;yield*this.joiner.join(r,i).render(e)}yield B.line()}}};const Ni={*render(e){}};function Pi(e){return{render:e}}function Fi(e){return new z({color:e.bgcolor})}function Ii(e){return e!==void 0&&!e.isDefault?e:void 0}function Li(e){return new z({bgcolor:e}).drawnColors().bgcolor}function*Ri(e,t){e!==``&&(yield new B(e,new z({color:Li(t)})))}function zi(e,t){let{color:n,bgcolor:r}=e.drawnColors(t??P.TRUECOLOR);if(n===void 0||r===void 0)return!1;let i=n.fixedValue,a=r.fixedValue;return i!==void 0&&a!==void 0?Xn.fromRgba(i).deltaE(Xn.fromRgba(a))<.04:n.number===r.number}const Bi=Object.freeze({glyph:``,divider:``,lead:``,tail:``}),Vi=Object.freeze({glyph:`>`,divider:`>`,lead:``,tail:`>`}),Hi=({glyph:e,divider:t,lead:n,tail:r})=>e+t+n+r;var Ui=class{_glyphs;constructor(e=Bi){this._glyphs=e}join(e,t){let n=this._glyphs;return Pi(function*(r){let{glyph:i,divider:a,lead:o,tail:s}=si(r,n,Vi,Hi),c=e?.edgeStyle(`right`,r),l=Ii(c?.bgcolor),u=Ii(t?.edgeStyle(`left`,r).bgcolor);if(l===void 0){u!==void 0&&(yield*Ri(o,u));return}if(u===void 0){yield*Ri(s,l);return}let d=new z({color:Li(l),bgcolor:u});yield zi(d,r.colorSystem)?new B(a,new z({color:c?.color,bgcolor:l})):new B(i,d)})}};const Wi={left:`(`,right:`)`},Gi=({left:e,right:t})=>e+t;var Ki=class{_caps;_separator;constructor(e){this._caps={left:e?.left??``,right:e?.right??``},this._separator=e?.separator??` `}*_emit(e,t,n){let r=si(n,this._caps,Wi,Gi),i=si(n,this._separator,` `);if(!(e===null&&t===null)){if(e===null){yield new B(r.left,Fi(t.edgeStyle(`left`,n)));return}if(t===null){yield new B(r.right,Fi(e.edgeStyle(`right`,n)));return}yield new B(r.right,Fi(e.edgeStyle(`right`,n))),i.length>0&&(yield new B(i)),yield new B(r.left,Fi(t.edgeStyle(`left`,n)))}}join(e,t){return Pi(n=>this._emit(e,t,n))}},qi=class{_separator;_style;constructor(e){this._separator=e?.separator??` | `,this._style=e?.style??z.parse(`dim`)}join(e,t){if(e===null||t===null)return Ni;let n=this._separator,r=this._style;return Pi(e=>[new B(si(e,n,` | `),r)])}};function Ji(e,t){if(e.isControl||e.text.length===0)return;let n=e.style;return!n||n.isNull?{text:e.text,sgrCodes:``,link:void 0}:{text:e.text,sgrCodes:t.colorSystem===null?``:n.toSgrCodes(t.colorSystem),link:t.hyperlinks?n.link:void 0}}function Yi(e,t){let n=[];for(let r of e){let e=Ji(r,t);e&&n.push(e)}if(n.length===0)return``;let r=[],i=0;for(;i<n.length;){let e=n[i].sgrCodes,t=i+1;for(;t<n.length&&n[t].sgrCodes===e;)t++;e.length>0&&r.push(`\x1b[${e}m`);let a=i;for(;a<t;){let e=n[a].link,i=a+1;for(;i<t&&n[i].link===e;)i++;if(e){r.push(bi(e));for(let e=a;e<i;e++)r.push(n[e].text);r.push(`\x1B]8;;\x1B\\`)}else for(let e=a;e<i;e++)r.push(n[e].text);a=i}e.length>0&&r.push(`\x1B[0m`),i=t}return r.join(``)}function Xi(e,t){let n=t?.width??80,r={};t?.env!==void 0&&(r.env=t.env),t?.isTTY!==void 0&&(r.isTTY=t.isTTY);let i=t?.colorSystem,a=hn(i===void 0?P.TRUECOLOR:i,r),o={colorSystem:t?.noColor?null:a.colorSystem,hyperlinks:t?.hyperlinks??a.hyperlinks},s={maxWidth:n,isTerminal:!1,asciiOnly:t?.asciiOnly??!1,onStyleError:t?.onStyleError,colorSystem:o.colorSystem};return Yi(e.render(s),o)}function Zi(e,t){let n=[...e.render(t)],r=0;for(let e of n)r+=e.cellLength;return{segments:n,width:r}}const Qi={segments:[],width:0},$i={left:()=>0,justify:()=>0,center:e=>Math.floor(e/2),right:e=>e};function ea(e,t){return $i[e](t)}function ta(e,t,n,r){let i=Math.max(0,r-1),a=e===`justify`&&!t&&i>0&&n>0?n:0,o=i>0?Math.floor(a/i):0,s=a-o*i;return Array.from({length:i},(e,t)=>o+ +(t<s))}var na=class{items;joiner;gap;align;constructor(e,t){this.items=e,this.joiner=t?.joiner,this.gap=t?.gap??0,this.align=t?.align??`left`}*render(e){let t=this.items;if(t.length===0)return;let n=Math.max(1,e.maxWidth),r=this.gap,i=this.joiner,a=t.map(t=>Zi(t,e)),o=n=>i?Zi(i.join(null,t[n]),e):Qi,s=n=>i?Zi(i.join(t[n],null),e):Qi,c=(n,r)=>i?Zi(i.join(t[n],t[r]),e):Qi,l=[],u=null,d=r>0?{segments:[new B(` `.repeat(r))],width:r}:Qi;for(let e=0;e<t.length;e++){let t=a[e];if(u===null){let n=o(e),r=s(e),i=n.width>0?[n,t]:[t],a=[i.length-1];u={blocks:i,width:n.width+t.width,lastIndex:e,itemBlockIndices:a},u.endCap=r;continue}let i=u.lastIndex,f=c(i,e),p=s(e),m=(r>0?r:0)+f.width+(r>0?r:0)+t.width;if(u.width+m+p.width<=n)r>0&&u.blocks.push(d),f.width>0&&u.blocks.push(f),r>0&&u.blocks.push(d),u.blocks.push(t),u.itemBlockIndices.push(u.blocks.length-1),u.width+=m,u.lastIndex=e,u.endCap=p;else{let n=u.endCap;n.width>0&&u.blocks.push(n),u.width+=n.width,l.push(u);let r=o(e),i=s(e),a=r.width>0?[r,t]:[t],c=[a.length-1];u={blocks:a,width:r.width+t.width,lastIndex:e,itemBlockIndices:c},u.endCap=i}}let f=u;{let e=f.endCap;e.width>0&&f.blocks.push(e),f.width+=e.width,l.push(f)}let p=this.align;for(let e=0;e<l.length;e++){let t=l[e],r=e===l.length-1,i=Math.max(0,n-t.width),a=ea(p,i),o=ta(p,r,i,t.itemBlockIndices.length),s=new Map;t.itemBlockIndices.forEach((e,t)=>s.set(e,t)),a>0&&(yield new B(` `.repeat(a)));for(let e=0;e<t.blocks.length;e++){let n=s.get(e);if(n!==void 0&&n>0){let e=o[n-1];e>0&&(yield new B(` `.repeat(e)))}yield*t.blocks[e].segments}yield B.line()}}measure(e){let t=this.items;if(t.length===0)return{minimum:0,maximum:0};let n=0,r=0;for(let i=0;i<t.length;i++){let a=Zi(t[i],e).width,o=this.joiner?Zi(this.joiner.join(null,t[i]),e).width:0,s=this.joiner?Zi(this.joiner.join(t[i],null),e).width:0;n=Math.max(n,a+o+s),r+=a,i>0&&(r+=this.gap*2,this.joiner&&(r+=Zi(this.joiner.join(t[i-1],t[i]),e).width))}return this.joiner&&(r+=Zi(this.joiner.join(null,t[0]),e).width,r+=Zi(this.joiner.join(t[t.length-1],null),e).width),{minimum:n,maximum:r}}};const ra=[`primary`,`secondary`,`accent`],ia={accent:[`secondary`,`accent`],duo:[`primary`,`secondary`],mono:[`primary`]},aa=`accent`,oa=[0,.5,1],sa=e=>e.flatMap(e=>oa.map(t=>({hue:e,tone:t}))),ca=sa(ra.filter(e=>Object.values(ia).some(t=>t.includes(e)))),la=e=>{let t=0,n=.5;for(let r=e;r>0;r>>=1,n/=2)t+=n*(r&1);return t},ua=[`van-der-corput`,`golden-angle`,`ends-interleaved`,`monotonic`,`uniform`],da=e=>typeof e==`string`&&ua.includes(e),fa={"van-der-corput":la,"golden-angle":e=>e*.6180339887498949%1,"ends-interleaved":(e,t)=>((e%2==0?e/2:t-1-(e-1)/2)+.5)/t,monotonic:(e,t)=>(e+.5)/t,uniform:()=>.5},pa=e=>fa[e??`van-der-corput`];function ma(e){let t=0,n=1;for(let{index:r,count:i,distribution:a}of e)t+=a(r,i)*n,n*=.37;return t%1}const ha=(e,t)=>Math.floor(e*t),ga=(e,t)=>Math.round(e*t)%t;function _a(e,t,n){let r=e[n(t===void 0?0:t.distribution(t.index,t.count),e.length)];if(r===void 0)throw Error(`vocabularySelect: empty vocabulary`);return r}function va(e,t){let n=t.findIndex(e=>e.axis===`cell`),r=n===-1?t:t.slice(0,n);return{hue:_a(e,r.at(-1),ha),tone:_a(oa,t[r.length],ga)}}function ya(e,t){let n=e.get(t);if(n===void 0)throw Error(`palette "${e.name}" has no "${t}" role; decoration needs it`);return n}function ba(e,t){let n=xa.get(e);n===void 0&&(n=new Map,xa.set(e,n));let r=`${t.hue}|${t.tone}`,i=n.get(r);if(i!==void 0)return i;let a=Xn.fromRgba(ya(e,t.hue)),o=Xn.fromRgba(ya(e,`surface`)),s=(e,t)=>e.mixAxes(a,{l:t,c:.8,h:1,alpha:0}),c=s(o.mixAxes(Xn.fromRgba(ya(e,`background`)),{l:.5,c:0,h:0,alpha:0}),0).mixAxes(s(o,.35),{l:t.tone,c:t.tone,h:t.tone,alpha:0}).toRgba();return n.set(r,c),c}const xa=new WeakMap,Sa=(e,t,n)=>ba(e,va(t,n)),Ca=2.2;function wa(e,t,n){let r=Ta(e,t,n);if(`refused`in r)throw Error(r.refused);return r.state}function Ta(e,t,n){let r=Ea.get(e);r===void 0&&(r=new Map,Ea.set(e,r));let i=`${t}|${n}`,a=r.get(i);if(a!==void 0)return a;let o=Da(e,t,n);return r.set(i,o),o}const Ea=new WeakMap;function Da(e,t,n){let r=ca.map(t=>ur(ba(e,t),P.TRUECOLOR)),i=Dn(ya(e,`surface`),ya(e,t),.92),a=ya(e,`foreground`),o=r.reduce((e,t)=>cr(e,t,Ca),a),s=[...Array.from({length:13},(e,t)=>Dn(i,a,t/12)),o].find(e=>r.every(t=>on(ur(e,P.TRUECOLOR),t)>=Ca));if(s===void 0)return{refused:`palette "${e.name}": "${t}" cannot clear the ${Ca} state floor even beyond foreground`};let c=lr(s,n,(e,t)=>r.every(n=>on(e,t(n))>=Ca));return c===void 0?{refused:`palette "${e.name}": "${t}" cannot clear the ${Ca} state floor on the colours drawn at depth ${P[n]}`}:{state:c}}const Oa=4.5;function ka(e,t,n){let r=Aa.get(e);r===void 0&&(r=new Map,Aa.set(e,r));let i=`${t.hex}|${n}`,a=r.get(i);if(a!==void 0)return a;let o=sr(t),s=cr([`background`,`foreground`].map(t=>ya(e,t)).reduce((e,t)=>on(o,t)<on(o,e)?t:e),t,Oa,n);return r.set(i,s),s}const Aa=new WeakMap,ja={base:.42,perDepth:.14,cap:.75},Ma={floor:.12,span:.8};function Na(e,t){return ra[(ra.indexOf(e)+t)%ra.length]}const Pa={triggerPlane:.1,nestedPlane:.035,nestedTriggerPlane:.08};function Fa(e,t,n){let r=`${t.hue}|${t.depth}|${n}`,i=Va.get(e);i===void 0&&(i=new Map,Va.set(e,i));let a=i.get(r);if(a!==void 0)return a;let o=wa(e,Na(t.hue,t.depth),n),s=Ba(e,t,o,n),c=lr(La(e,t).plane,n,(e,t)=>s.every(([n,r])=>Ia(e,t(n))>=r));if(c===void 0)throw Error(`palette "${e.name}": the ${t.hue} band at depth ${t.depth} cannot keep its floors on the colours drawn at depth ${P[n]}`);let l={state:o,plane:c};return i.set(r,l),l}const Ia=(e,t)=>Xn.fromRgba(e).deltaE(Xn.fromRgba(t));function La(e,t){let n=`${t.hue}|${t.depth}`,r=Ra.get(e);r===void 0&&(r=new Map,Ra.set(e,r));let i=r.get(n);if(i!==void 0)return i;let a=za(e,t);return r.set(n,a),a}const Ra=new WeakMap;function za(e,t){let n=wa(e,Na(t.hue,t.depth),P.TRUECOLOR),r=Math.min(ja.cap,ja.base+ja.perDepth*t.depth);return{state:n,plane:Dn(n,ya(e,`background`),r)}}function Ba(e,t,n,r){let{hue:i,depth:a}=t,o=t=>La(e,{hue:i,depth:t}).state,s=t=>La(e,{hue:i,depth:t}).plane,c=e=>ur(e,P.TRUECOLOR),l=s(a),u=(e,t)=>Ia(c(l),c(t))>=e?e:0,d=Na(i,a+1),f=Ta(e,d,r),p=Ta(e,d,P.TRUECOLOR);return[[n,u(Pa.triggerPlane,o(a))],...`state`in f&&`state`in p?[[f.state,u(Pa.nestedTriggerPlane,p.state)]]:[],...a>0?[[Fa(e,{hue:i,depth:a-1},r).plane,u(Pa.nestedPlane,s(a-1))]]:[]]}const Va=new WeakMap;function Ha(e,t,n,r){let i=Fa(e,t,r),a=La(e,t),o=lr(Dn(a.plane,a.state,Ma.floor+Ma.span*ma(n)),r,(e,t)=>e.hex!==t(i.plane).hex&&e.hex!==t(i.state).hex);if(o===void 0)throw Error(`palette "${e.name}": a ${t.hue} band item at depth ${t.depth} is drawn as its plane or its trigger at depth ${P[r]}, and nothing that depth draws is neither`);return o}const Ua=e=>({kind:`bar`,variation:e,address:[]}),Wa=(e,t)=>({...e,address:[...e.address,t]}),Ga=e=>({kind:`band`,band:e,address:[]});function Ka(e,t,n){switch(t.kind){case`bar`:return{tint:Sa(e,t.variation,t.address),disclosure:{hue:aa,depth:0}};case`band`:return{tint:Ha(e,t.band,t.address,n),disclosure:{hue:t.band.hue,depth:t.band.depth+1}}}}const qa=new Map([[`dark`,`textual-dark`],[`light`,`textual-light`]]);function Ja(e){let t=typeof e==`string`?qa.get(e):void 0;return t===void 0?``:` — "${e}" was retired; write "${t}", the same palette`}const Ya=`textual-dark`;function Xa(e,t,n,r,i){let a=t===null?null:i(t);return e??a??n??r}function Za(){return Tr()}function Qa(){return[`bar`,...Za()]}let $a;function eo(e){return $a??=new Set(Qa()),$a.has(e)}function to(e,t,n,r,i){let a=e=>Object.prototype.hasOwnProperty.call(i,e)?e:null;return Xa(e===void 0?null:a(e),t,a(n??r),r,a)}const no=[`style`,`palette`];function ro(e){return e!==void 0&&e.includes(`{{`)}function io(e,t,n,r,i){let a=ro(n)?{kind:`expression`,source:n}:i(n??r.name);return Xa(e===void 0?null:i(e),t,a,r,i)}function ao(e,t){return e.kind===`decided`?e:t(e.source)}const oo=`none`;function so(e,t){let n=t[e];return n===void 0?null:{kind:`decided`,name:e,value:n}}function co(e,t){return so(e,t)??so(`none`,t)??{kind:`decided`,name:`none`,value:Bn}}function lo(e,t,n,r){return io(e,t,n,co(oo,r),e=>so(e,r))}const uo=[`powerline`,`capsule`,`plain`];function fo(e){return uo.includes(e)}function po(e,t,n){return Xa(e,t,n,`powerline`,e=>fo(e)?e:null)}const mo=[`unicode`,`ascii`],ho=`unicode`,go=[`truecolor`,`256`,`ansi`,`none`];function _o(e){return gn(e)??P.DEFAULT}const vo=Object.keys(ia);function yo(e){return vo.includes(e)}function bo(e,t,n){return Xa(e,t,n,`accent`,e=>yo(e)?e:null)}const xo=`true`,So=`false`,Co=[xo,So],wo={min:0,max:16};function To(e){return e===`true`?!0:e===`false`?!1:null}function Eo(e){if(!/^\d+$/.test(e))return null;let t=Number(e);return t>=wo.min&&t<=wo.max?t:null}function Do(e,t,n){return Xa(e,t,n,!0,To)}function Oo(e,t,n){return Xa(e,t,n,!0,To)}function ko(e,t,n){return Xa(e,t,n,1,Eo)}var Ao=class extends Error{constructor(e,t){super(`${e} (at offset ${t})`),this.reason=e,this.offset=t,this.name=`Json5EditError`}};const jo=/[A-Za-z_$\p{L}]/u,Mo=/[A-Za-z0-9_$\u200C\u200D\p{L}\p{N}]/u,No=/[A-Za-z0-9_$.+\-\p{L}\p{N}]/u,Po=/[\t\n\v\f\r \u00A0\uFEFF\u2028\u2029\p{Zs}]/u;var Fo=class{pos=0;constructor(e){this.text=e}peek(){return this.text[this.pos]??``}fail(e){throw new Ao(e,this.pos)}skipTrivia(){for(;;){let e=this.peek();if(e===``)return;if(Po.test(e))this.pos++;else if(e===`/`&&this.text[this.pos+1]===`/`){let e=this.text.indexOf(`
25
- `,this.pos);this.pos=e===-1?this.text.length:e}else if(e===`/`&&this.text[this.pos+1]===`*`){let e=this.text.indexOf(`*/`,this.pos+2);e===-1&&this.fail(`unterminated block comment`),this.pos=e+2}else return}}expect(e){this.peek()!==e&&this.fail(`expected "${e}"`),this.pos++}value(){this.skipTrivia();let e=this.peek();if(e===`{`)return this.object();if(e===`[`)return this.array();if(e===`"`||e===`'`){let e=this.stringSpan();return{kind:`string`,span:e,value:this.decode(e)}}e===``&&this.fail(`unexpected end of input`);let t=this.pos;for(;this.pos<this.text.length&&No.test(this.peek());)this.pos++;this.pos===t&&this.fail(`unexpected character "${e}"`);let n={start:t,end:this.pos},r=this.decode(n);return r===null?{kind:`null`,span:n}:typeof r==`boolean`?{kind:`boolean`,span:n,value:r}:typeof r==`number`?{kind:`number`,span:n,value:r}:this.fail(`unexpected word "${this.text.slice(t,this.pos)}"`)}decode(e){try{return et.default.parse(this.text.slice(e.start,e.end))}catch(t){throw new Ao(t.message,e.start)}}stringSpan(){let e=this.pos,t=this.peek();for(this.pos++;;){let n=this.peek();if(n===``&&this.fail(`unterminated string`),n===`\\`){let e=this.text.startsWith(`\r
18
+ `);for(let t=0;t<a.length;t++){t>0&&(n.push(r),r=[]);let o=a[t];o.length>0&&r.push(new e(o,i.style))}}return r.length>0&&n.push(r),n}static adjustLineLength(t,n,r,i=!0){let a=e.getLineLength(t);if(a===n)return t;if(a<n)return i?[...t,new e(` `.repeat(n-a),r)]:t;let o=[],s=n;for(let e of t){if(e.isControl){o.push(e);continue}let t=e.cellLength;if(t<=s)o.push(e),s-=t;else{let[t]=e.splitCells(zt(s));o.push(t),s=0;break}}return o}static*cropLines(t,n){let r=Math.max(0,n),i=0;for(let n of t){if(n.isControl){yield n;continue}let t=n.text.split(`
19
+ `);for(let e=0;e<t.length;e++){e>0&&(i=0);let[n]=Vt(t[e],zt(r-i));i+=N(n),t[e]=n}let a=t.join(`
20
+ `);yield a===n.text?n:new e(a,n.style)}}static splitAndCropLines(t,n){return e.splitLines(t).map(t=>e.adjustLineLength(t,n))}static getLineLength(e){let t=0;for(let n of e)n.isControl||(t+=n.cellLength);return t}static getShape(t){if(t.length===0)return[0,0];let n=0;for(let r of t){let t=e.getLineLength(r);t>n&&(n=t)}return[n,t.length]}static*mergeHorizontal(t,n=0){let r=0;for(let e of t)e.lines.length>r&&(r=e.lines.length);let i=n>0?[new e(` `.repeat(n))]:[];for(let n=0;n<r;n++){for(let r=0;r<t.length;r++){r>0&&(yield*i);let a=t[r];yield*e.adjustLineLength(a.lines[n]??[],a.width)}yield e.line()}}static*simplify(t){let n;for(let r of t){if(!n){n=r;continue}ri(n.style,r.style)&&!r.isControl&&!n.isControl?n=new e(n.text+r.text,n.style):(yield n,n=r)}n&&(yield n)}static*stripLinks(t){for(let n of t)n.style?.link?yield new e(n.text,n.style.clearMetaAndLinks(),n.control):yield n}static*stripStyles(t){for(let n of t)yield new e(n.text,void 0,n.control)}static*removeColor(t){for(let n of t)n.style?yield new e(n.text,n.style.withoutColor,n.control):yield n}static divide(e,t){if(t.length===0)return[e];let n=[],r=0,i=0,a=e[r];for(let o of t){let t=[];for(;a&&i+a.cellLength<=o;)a.isControl?t.push(a):(t.push(a),i+=a.cellLength),r++,a=e[r];if(a&&!a.isControl&&i<o){let e=zt(o-i),[n,r]=a.splitCells(e);n.hasText&&t.push(n),i+=n.cellLength,a=r}n.push(t)}let o=[];for(a?.hasText&&o.push(a),r++;r<e.length;)o.push(e[r]),r++;return o.length>0&&n.push(o),n}static alignTop(t,n,r,i){let a=t.map(t=>e.adjustLineLength(t,n,i)),o=[new e(` `.repeat(n),i)];for(;a.length<r;)a.push([...o]);return a.slice(0,r)}static alignBottom(t,n,r,i){let a=t.map(t=>e.adjustLineLength(t,n,i)),o=[new e(` `.repeat(n),i)],s=Math.max(0,r-a.length),c=[];for(let e=0;e<s;e++)c.push([...o]);return c.push(...a),c.slice(0,r)}static alignMiddle(t,n,r,i){let a=t.map(t=>e.adjustLineLength(t,n,i)),o=[new e(` `.repeat(n),i)],s=Math.max(0,Math.floor((r-a.length)/2)),c=[];for(let e=0;e<s;e++)c.push([...o]);for(c.push(...a);c.length<r;)c.push([...o]);return c.slice(0,r)}static setShape(t,n,r,i){let a=t.map(t=>e.adjustLineLength(t,n,i)),o=[new e(` `.repeat(n),i)];for(;a.length<r;)a.push([...o]);return a.slice(0,r)}};function ri(e,t){return e===t?!0:!e||!t?!1:e.equals(t)}const ii=/^[\x00-\x7F]*$/;function ai(e,t,n,r=String){return e.asciiOnly===!0&&!ii.test(r(t))?n:t}function oi(e,t){return(e.theme??ei).resolve(t)}function si(e){return{...e,maxWidth:P(e.maxWidth)}}function ci(e){return{...e,onDraw:void 0}}function li(e,t){let n=si(e);if(Number.isFinite(n.maxWidth))return n;let r=t.measure(ci(n)).maximum;if(!Number.isFinite(r))throw RangeError(`maxWidth is unbounded and this renderable has no natural width to fall back on: its content does not implement measure(), or something inside it asked for an unbounded width of its own. Render it at a finite width, or give the content a measure() that reports a finite maximum.`);return{...n,maxWidth:P(r)}}function*ui(e){let t=/\s*\S+\s*/y;for(let n=t.exec(e);n!==null;n=t.exec(e))yield n[0]}function di(e,t){let n=Ht(e,t);return N(n[0])>t?[``,...n]:n}function fi(e,t,n){if(t<=0)return[];let r=[],i=e=>{e>0&&r.push(zt(e))},a=0,o=0;for(let r of ui(e)){let e=N(r.trimEnd());if(t-a>=e)a+=N(r);else if(n.fold&&e>t){let e=di(r,t),n=o;for(let t=0;t<e.length;t+=1){i(n);let r=e[t];t===e.length-1?a=N(r):n+=N(r)}}else i(o),a=N(r);o+=N(r)}return r}const pi=`\\x1b\\x07\\x9c`,mi=RegExp(`[${pi}]`,`g`);function hi(e){return e.replace(mi,``)}const gi=new TextEncoder;function _i(e){let t=2166136261;for(let n of gi.encode(e))t^=n,t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function vi(e){let t=hi(e);return`\x1b]8;id=${_i(t)};${t}\x1b\\`}const yi=RegExp(`\\x1b\\]8;([^;${pi}]*);([^${pi}]*)(?:\\x1b\\\\|\\x07|\\x9c)`);new RegExp(yi.source,`g`);const bi=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g;function xi(e){return e.replace(bi,``)}const Si=/\s+$/;function Ci(e){return e.map(e=>e.text).join(``)}function wi(e){return N(Si.exec(Ci(e))?.[0]??``)}function Ti(e){let t=e.link;if(!t)return e;let n=hi(t);return n===t?e:e.withLink(n)}function Ei(e){return e instanceof V?Ti(e.anchor?e.withAnchor(void 0):e):e}function Di(e){return e instanceof V?e.isNull:e===``}function Oi(e,t){return Ti(t instanceof V?t:ki(e,t))}function ki(e,t){try{return oi(e,t)}catch(n){if(!(n instanceof Vr))throw n;return e.onStyleError?.(n,t),Ur}}var Ai=class e{start;end;style;constructor(e,t,n){this.start=e,this.end=t,this.style=n}get hasLength(){return this.end>this.start}toString(){return`Span(${this.start}, ${this.end})`}split(t){return t<=this.start||t>=this.end?[this,void 0]:[new e(this.start,t,this.style),new e(t,this.end,this.style)]}move(t){return new e(this.start+t,this.end+t,this.style)}rightCrop(t){return t>=this.end?this:new e(this.start,Math.min(this.end,t),this.style)}extend(t){return new e(this.start,this.end+t,this.style)}},U=class e{_text;_spans;_style;_justify;_overflow;_end;_tabSize;_noWrap;constructor(e,t){this._text=e?xi(e):``,this._spans=[],this._style=Ei(t?.style??Ur),this._justify=t?.justify,this._overflow=t?.overflow,this._end=t?.end??`
21
+ `,this._tabSize=t?.tabSize??8,this._noWrap=t?.noWrap??!1}get plain(){return this._text}set plain(e){let t=xi(e);this._text=t;let n=t.length;this._spans=this._spans.map(e=>e.end>n?new Ai(e.start,Math.min(e.end,n),e.style):e).filter(e=>e.start<n)}get length(){return this._text.length}get cellLength(){return N(this._text)}get hasContent(){return this._text.length>0}get style(){return this._style}set style(e){this._style=Ei(e)}get justify(){return this._justify}set justify(e){this._justify=e}get overflow(){return this._overflow}set overflow(e){this._overflow=e}get end(){return this._end}set end(e){this._end=e}get noWrap(){return this._noWrap}set noWrap(e){this._noWrap=e}get spans(){return this._spans}resolvedStyle(e){return Oi(e,this._style)}edgeStyle(e,t){let n=this.resolvedStyle(t);if(this._text.length===0)return n;let r=e===`left`?0:this._text.length-1,i=n;for(let e of this._spans)e.start<=r&&r<e.end&&(i=i.add(Oi(t,e.style)));return i}append(t,n){if(t instanceof e){if(n!==void 0)throw Error(`Style argument must not be provided when appending RichText`);let e=this._text.length;this._text+=t._text,this._addSpan(e,this._text.length,t._style);for(let n of t._spans)this._spans.push(n.move(e));return this}let r=xi(t),i=this._text.length;return this._text+=r,this._addSpan(i,this._text.length,n??``),this}contains(t){let n=t instanceof e?t._text:t;return this._text.includes(n)}at(t){let n=t<0?this._text.length+t:t;return this._text[n]===void 0?new e(``):this.slice(n,n+1)}slice(e,t){let n=this._text,r=n.length,i=e??0,a=t??r,o=i<0?Math.max(0,r+i):Math.min(i,r),s=a<0?Math.max(0,r+a):Math.min(a,r);if(o>=s)return this.blankCopy();let c=n.slice(o,s),l=this.blankCopy(c);for(let e of this._spans){let t=Math.max(e.start,o)-o,n=Math.min(e.end,s)-o;t<n&&l._spans.push(new Ai(t,n,e.style))}return l}_addSpan(e,t,n){let r=Ei(n);Di(r)||this._spans.push(new Ai(e,t,r))}stylize(e,t,n){let r=this._text.length,i=t===void 0?0:t<0?r+t:t,a=n===void 0?r:n<0?r+n:n;if(i>=a||i>=r||a<=0)return this;let o=Math.max(0,i),s=Math.min(r,a);return this._addSpan(o,s,e),this}highlightRegex(e,t){let n=this._text,r=0,i=e.flags.includes(`g`)?e.flags:e.flags+`g`,a=new RegExp(e.source,i),o;for(;(o=a.exec(n))!==null;){if(o[0].length===0){a.lastIndex++;continue}if(o.groups){let e=0;for(let[t,n]of Object.entries(o.groups))if(n!==void 0){let r=o[0].indexOf(n,e);if(r>=0){let i=o.index+r;this._addSpan(i,i+n.length,t),e=r+n.length}}r++;continue}this._addSpan(o.index,o.index+o[0].length,t??``),r++}return r}highlightWords(e,t,n){let r=n?.caseSensitive!==!1,i=0;for(let n of e){if(n.length===0)continue;let e=n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),a=r?`g`:`gi`,o=RegExp(`\\b${e}\\b`,a),s;for(;(s=o.exec(this._text))!==null;)this._addSpan(s.index,s.index+s[0].length,t),i++}return i}copy(){let t=new e(this._text,{style:this._style,justify:this._justify,overflow:this._overflow,end:this._end,tabSize:this._tabSize,noWrap:this._noWrap});return t._spans=this._spans.slice(),t}blankCopy(t){return new e(t??``,{style:this._style,justify:this._justify,overflow:this._overflow,end:this._end,tabSize:this._tabSize,noWrap:this._noWrap})}split(e){let t=e??`
22
+ `,n=this._text,r=[],i=0;for(;;){let e=n.indexOf(t,i);if(e===-1){r.push(this.slice(i));break}r.push(this.slice(i,e)),i=e+t.length}return r}divide(e){if(e.length===0)return[this.copy()];let t=[],n=0;for(let r of e)t.push(this.slice(n,r)),n=r;return t.push(this.slice(n)),t}rstrip(){let e=this._text.replace(/\s+$/,``);return e.length<this._text.length&&(this.plain=e),this}pad(e,t){let n=(t??` `).repeat(e);return this._spans=this._spans.map(t=>t.move(e)),this._text=n+this._text+n,this}padLeft(e,t){let n=t??` `;return this._spans=this._spans.map(t=>t.move(e)),this._text=n.repeat(e)+this._text,this}padRight(e,t){let n=t??` `;return this._text+=n.repeat(e),this}setLength(e){return this._text.length<e?this._text+=` `.repeat(e-this._text.length):this._text.length>e&&(this.plain=this._text.slice(0,e)),this}extendStyle(e){let t=this._text.length;return this._text+=` `.repeat(e),this._spans=this._spans.map(n=>n.end===t?n.extend(e):n),this}truncate(e,t){if(this.cellLength<=e)return this;let n=t?.mode??`right`,r=P(e),i=Gt(t?.marker??`…`,r),a=zt(r-N(i));if(n===`right`)return this._cropRightTo(a),i&&(this._text+=i),this;if(n===`left`)return this._cropLeftTo(a),i&&(this._spans=this._spans.map(e=>e.move(i.length)),this._text=i+this._text),this;let o=zt(Math.floor(a/2)),s=zt(a-o),c=Gt(this._text,o).length,l=this._text.length-Kt(this._text,s).length,u=this._text.slice(0,c),d=this._text.slice(l),f=c,p=l,m=i.length-(p-f),h=[];for(let e of this._spans)e.end<=f?h.push(e):e.start>=p?h.push(e.move(m)):(e.start<f&&h.push(new Ai(e.start,f,e.style)),e.end>p&&h.push(new Ai(p+m,e.end+m,e.style)));return this._text=u+i+d,this._spans=h,this}_cropRightTo(e){this.plain=Gt(this._text,e)}_cropLeftTo(e){let t=this._text.length-Kt(this._text,e).length,n=-t;this._spans=this._spans.map(e=>{if(!(e.end<=t))return new Ai(Math.max(0,e.start+n),e.end+n,e.style)}).filter(e=>e!==void 0),this._text=this._text.slice(t)}align(e,t){let n=this.cellLength;if(n>=t)return this;let r=t-n;switch(e){case`left`:this.padRight(r);break;case`right`:this.padLeft(r);break;case`center`:{let e=Math.floor(r/2),t=r-e;this.padLeft(e),this.padRight(t);break}}return this}removeSuffix(e){return this._text.endsWith(e)&&(this.plain=this._text.slice(0,-e.length)),this}appendTokens(e){for(let[t,n]of e)this.append(t,n);return this}static assemble(t,n){let r=new e(``,{style:n?.style});for(let n of t)if(typeof n==`string`)r.append(n);else if(n instanceof e)r.append(n);else{let[e,t]=n;r.append(e,t)}return r}static styled(t,n){let r=new e(t);return r.stylize(n),r}static fromFragments(t,n){let r=new e(``,{end:n?.end??``});for(let e of t)r.append(e);return r}*render(e){let t=this._expandTabs(this._text),n=this.resolvedStyle(e),r=this._buildSegments(t,n,e),i=H.splitLines(r),a=P(li(e,this).maxWidth),o=this._overflow??e.overflow??`fold`,s=this._noWrap||(e.noWrap??!1),c=o===`ignore`?P(1/0):a,l=s?P(1/0):c,u=o===`ignore`?void 0:this._justify??e.justify,d=ai(e,`…`,`.`),f=t.endsWith(`
23
+ `);for(let e=0;e<i.length;e+=1){let t=i[e],r=e<i.length-1||f,s=fi(Ci(t),l,{fold:o===`fold`}),p=H.divide(t,s),m=this._justifyLines(p.map(e=>[...this._fitLine(e,c,o,d)]),a,n,u);for(let e=0;e<m.length;e+=1)yield*m[e],(e<m.length-1||r)&&(yield H.line())}this._end&&(yield new H(this._end))}measure(e){let t=this._expandTabs(this._text).split(`
24
+ `),n=0,r=0;for(let e of t){let t=N(e);n=Math.max(n,t);let i=e.split(/\s+/);for(let e of i)e.length>0&&(r=Math.max(r,N(e)))}let i=P(e.maxWidth);return{minimum:Math.min(r,i),maximum:Math.min(n,i)}}_expandTabs(e){return e.includes(` `)?e.replace(/\t/g,` `.repeat(this._tabSize)):e}_buildSegments(e,t,n){let r=t=>Math.max(0,Math.min(t,e.length)),i=new Set([0,e.length]);for(let e of this._spans)i.add(r(e.start)),i.add(r(e.end));let a=[...i].sort((e,t)=>e-t),o=new Map(a.map((e,t)=>[e,t])),s=a.slice(0,-1).map(()=>t);for(let e of this._spans){let t=r(e.end),i=Oi(n,e.style),c=o.get(r(e.start));for(let e=c;a[e]<t;e++)s[e]=s[e].add(i)}return s.map((t,n)=>new H(e.slice(a[n],a[n+1]),t.isNull?void 0:t))}_justifyLines(e,t,n,r){return r===`full`?e.map((r,i)=>i===e.length-1?r:this._fillLine(r,t,n)):e.map(e=>[...this._justifyLine(e,t,r)])}*_justifyLine(e,t,n){switch(n){case`center`:case`right`:{let r=H.adjustLineLength(e,H.getLineLength(e)-wi(e),void 0,!1),i=Math.max(t-H.getLineLength(r),0),a=n===`center`?Math.floor(i/2):i;a>0&&(yield new H(` `.repeat(a))),yield*r;let o=i-a;o>0&&(yield new H(` `.repeat(o)));break}case`left`:yield*H.adjustLineLength(e,Math.max(t,H.getLineLength(e)));break;default:yield*e;break}}_fillLine(e,t,n){let r=Ci(e),i=r.split(` `);r.endsWith(` `)&&i.pop();let a=i.length-1,o=Array(a).fill(1),s=i.reduce((e,t)=>e+N(t),0)+a;for(let e=0;s<t&&a>0;e=(e+1)%a)o[a-1-e]+=1,s+=1;let c=[],l=0;for(let e=0;e<i.length;e+=1)l+=N(i[e]),c.push(l),l+=1,e<a&&c.push(l);let u=H.divide(e,c),d=(e,t)=>e.filter(e=>e.hasText).at(t)?.style??n,f=[];for(let e=0;e<i.length;e+=1)if(f.push(...u[e*2]),e<a){let t=d(u[e*2],-1),r=d(u[e*2+2],0),i=t.equals(r)?t:n;f.push(new H(` `.repeat(o[e]),i.isNull?void 0:i))}return f}*_fitLine(e,t,n,r){let i=H.getLineLength(e);if(i-wi(e)<=t){yield*H.adjustLineLength(e,Math.min(i,t),void 0,!1);return}if(n===`ellipsis`&&t>0){yield*H.adjustLineLength(e,t-1,void 0,!1),yield new H(r);return}yield*H.adjustLineLength(e,t,void 0,!1)}},W=class{items;joiner;constructor(e,t){this.items=e,this.joiner=t}*render(e){let t=this.items;if(t.length!==0){yield*this.joiner.join(null,t[0]).render(e);for(let n=0;n<t.length;n++){let r=t[n];yield*r.render(e);let i=n+1<t.length?t[n+1]:null;yield*this.joiner.join(r,i).render(e)}yield H.line()}}};const ji={*render(e){}};function Mi(e){return{render:e}}function Ni(e){return new V({color:e.bgcolor})}function Pi(e){return e!==void 0&&!e.isDefault?e:void 0}function Fi(e){return new V({bgcolor:e}).drawnColors().bgcolor}function*Ii(e,t){e!==``&&(yield new H(e,new V({color:Fi(t)})))}function Li(e,t){let{color:n,bgcolor:r}=e.drawnColors(t??I.TRUECOLOR);if(n===void 0||r===void 0)return!1;let i=n.fixedValue,a=r.fixedValue;return i!==void 0&&a!==void 0?Jn.fromRgba(i).deltaE(Jn.fromRgba(a))<.04:n.number===r.number}const Ri=Object.freeze({glyph:``,divider:``,lead:``,tail:``}),zi=Object.freeze({glyph:`>`,divider:`>`,lead:``,tail:`>`}),Bi=({glyph:e,divider:t,lead:n,tail:r})=>e+t+n+r;var Vi=class{_glyphs;constructor(e=Ri){this._glyphs=e}join(e,t){let n=this._glyphs;return Mi(function*(r){let{glyph:i,divider:a,lead:o,tail:s}=ai(r,n,zi,Bi),c=e?.edgeStyle(`right`,r),l=Pi(c?.bgcolor),u=Pi(t?.edgeStyle(`left`,r).bgcolor);if(l===void 0){u!==void 0&&(yield*Ii(o,u));return}if(u===void 0){yield*Ii(s,l);return}let d=new V({color:Fi(l),bgcolor:u});yield Li(d,r.colorSystem)?new H(a,new V({color:c?.color,bgcolor:l})):new H(i,d)})}};const Hi={left:`(`,right:`)`},Ui=({left:e,right:t})=>e+t;var Wi=class{_caps;_separator;constructor(e){this._caps={left:e?.left??``,right:e?.right??``},this._separator=e?.separator??` `}*_emit(e,t,n){let r=ai(n,this._caps,Hi,Ui),i=ai(n,this._separator,` `);if(!(e===null&&t===null)){if(e===null){yield new H(r.left,Ni(t.edgeStyle(`left`,n)));return}if(t===null){yield new H(r.right,Ni(e.edgeStyle(`right`,n)));return}yield new H(r.right,Ni(e.edgeStyle(`right`,n))),i.length>0&&(yield new H(i)),yield new H(r.left,Ni(t.edgeStyle(`left`,n)))}}join(e,t){return Mi(n=>this._emit(e,t,n))}},Gi=class{_separator;_style;constructor(e){this._separator=e?.separator??` | `,this._style=e?.style??V.parse(`dim`)}join(e,t){if(e===null||t===null)return ji;let n=this._separator,r=this._style;return Mi(e=>[new H(ai(e,n,` | `),r)])}};function Ki(e,t){if(e.isControl||e.text.length===0)return;let n=e.style;return!n||n.isNull?{text:e.text,sgrCodes:``,link:void 0}:{text:e.text,sgrCodes:t.colorSystem===null?``:n.toSgrCodes(t.colorSystem),link:t.hyperlinks?n.link:void 0}}function qi(e,t){let n=[];for(let r of e){let e=Ki(r,t);e&&n.push(e)}if(n.length===0)return``;let r=[],i=0;for(;i<n.length;){let e=n[i].sgrCodes,t=i+1;for(;t<n.length&&n[t].sgrCodes===e;)t++;e.length>0&&r.push(`\x1b[${e}m`);let a=i;for(;a<t;){let e=n[a].link,i=a+1;for(;i<t&&n[i].link===e;)i++;if(e){r.push(vi(e));for(let e=a;e<i;e++)r.push(n[e].text);r.push(`\x1B]8;;\x1B\\`)}else for(let e=a;e<i;e++)r.push(n[e].text);a=i}e.length>0&&r.push(`\x1B[0m`),i=t}return r.join(``)}function Ji(e,t){let n=t?.width??80,r={};t?.env!==void 0&&(r.env=t.env),t?.isTTY!==void 0&&(r.isTTY=t.isTTY);let i=t?.colorSystem,a=pn(i===void 0?I.TRUECOLOR:i,r),o={colorSystem:t?.noColor?null:a.colorSystem,hyperlinks:t?.hyperlinks??a.hyperlinks},s={maxWidth:n,isTerminal:!1,asciiOnly:t?.asciiOnly??!1,onStyleError:t?.onStyleError,colorSystem:o.colorSystem};return qi(e.render(s),o)}function Yi(e,t){let n=[...e.render(t)],r=0;for(let e of n)r+=e.cellLength;return{segments:n,width:r}}const Xi={segments:[],width:0},Zi={left:()=>0,justify:()=>0,center:e=>Math.floor(e/2),right:e=>e};function Qi(e,t){return Zi[e](t)}function $i(e,t,n,r){let i=Math.max(0,r-1),a=e===`justify`&&!t&&i>0&&n>0?n:0,o=i>0?Math.floor(a/i):0,s=a-o*i;return Array.from({length:i},(e,t)=>o+ +(t<s))}var ea=class{items;joiner;gap;align;constructor(e,t){this.items=e,this.joiner=t?.joiner,this.gap=t?.gap??0,this.align=t?.align??`left`}*render(e){let t=this.items;if(t.length===0)return;let n=Math.max(1,e.maxWidth),r=this.gap,i=this.joiner,a=t.map(t=>Yi(t,e)),o=n=>i?Yi(i.join(null,t[n]),e):Xi,s=n=>i?Yi(i.join(t[n],null),e):Xi,c=(n,r)=>i?Yi(i.join(t[n],t[r]),e):Xi,l=[],u=null,d=r>0?{segments:[new H(` `.repeat(r))],width:r}:Xi;for(let e=0;e<t.length;e++){let t=a[e];if(u===null){let n=o(e),r=s(e),i=n.width>0?[n,t]:[t],a=[i.length-1];u={blocks:i,width:n.width+t.width,lastIndex:e,itemBlockIndices:a},u.endCap=r;continue}let i=u.lastIndex,f=c(i,e),p=s(e),m=(r>0?r:0)+f.width+(r>0?r:0)+t.width;if(u.width+m+p.width<=n)r>0&&u.blocks.push(d),f.width>0&&u.blocks.push(f),r>0&&u.blocks.push(d),u.blocks.push(t),u.itemBlockIndices.push(u.blocks.length-1),u.width+=m,u.lastIndex=e,u.endCap=p;else{let n=u.endCap;n.width>0&&u.blocks.push(n),u.width+=n.width,l.push(u);let r=o(e),i=s(e),a=r.width>0?[r,t]:[t],c=[a.length-1];u={blocks:a,width:r.width+t.width,lastIndex:e,itemBlockIndices:c},u.endCap=i}}let f=u;{let e=f.endCap;e.width>0&&f.blocks.push(e),f.width+=e.width,l.push(f)}let p=this.align;for(let e=0;e<l.length;e++){let t=l[e],r=e===l.length-1,i=Math.max(0,n-t.width),a=Qi(p,i),o=$i(p,r,i,t.itemBlockIndices.length),s=new Map;t.itemBlockIndices.forEach((e,t)=>s.set(e,t)),a>0&&(yield new H(` `.repeat(a)));for(let e=0;e<t.blocks.length;e++){let n=s.get(e);if(n!==void 0&&n>0){let e=o[n-1];e>0&&(yield new H(` `.repeat(e)))}yield*t.blocks[e].segments}yield H.line()}}measure(e){let t=this.items;if(t.length===0)return{minimum:0,maximum:0};let n=0,r=0;for(let i=0;i<t.length;i++){let a=Yi(t[i],e).width,o=this.joiner?Yi(this.joiner.join(null,t[i]),e).width:0,s=this.joiner?Yi(this.joiner.join(t[i],null),e).width:0;n=Math.max(n,a+o+s),r+=a,i>0&&(r+=this.gap*2,this.joiner&&(r+=Yi(this.joiner.join(t[i-1],t[i]),e).width))}return this.joiner&&(r+=Yi(this.joiner.join(null,t[0]),e).width,r+=Yi(this.joiner.join(t[t.length-1],null),e).width),{minimum:n,maximum:r}}};const ta=[`primary`,`secondary`,`accent`],na={accent:[`secondary`,`accent`],duo:[`primary`,`secondary`],mono:[`primary`]},ra=`accent`,ia=[0,.5,1],aa=e=>e.flatMap(e=>ia.map(t=>({hue:e,tone:t}))),oa=aa(ta.filter(e=>Object.values(na).some(t=>t.includes(e)))),sa=e=>{let t=0,n=.5;for(let r=e;r>0;r>>=1,n/=2)t+=n*(r&1);return t},ca=[`van-der-corput`,`golden-angle`,`ends-interleaved`,`monotonic`,`uniform`],la=e=>typeof e==`string`&&ca.includes(e),ua={"van-der-corput":sa,"golden-angle":e=>e*.6180339887498949%1,"ends-interleaved":(e,t)=>((e%2==0?e/2:t-1-(e-1)/2)+.5)/t,monotonic:(e,t)=>(e+.5)/t,uniform:()=>.5},da=e=>ua[e??`van-der-corput`];function fa(e){let t=0,n=1;for(let{index:r,count:i,distribution:a}of e)t+=a(r,i)*n,n*=.37;return t%1}const pa=(e,t)=>Math.floor(e*t),ma=(e,t)=>Math.round(e*t)%t;function ha(e,t,n){let r=e[n(t===void 0?0:t.distribution(t.index,t.count),e.length)];if(r===void 0)throw Error(`vocabularySelect: empty vocabulary`);return r}function ga(e,t){let n=t.findIndex(e=>e.axis===`cell`),r=n===-1?t:t.slice(0,n);return{hue:ha(e,r.at(-1),pa),tone:ha(ia,t[r.length],ma)}}function _a(e,t){let n=e.get(t);if(n===void 0)throw Error(`palette "${e.name}" has no "${t}" role; decoration needs it`);return n}function va(e,t){let n=ya.get(e);n===void 0&&(n=new Map,ya.set(e,n));let r=`${t.hue}|${t.tone}`,i=n.get(r);if(i!==void 0)return i;let a=Jn.fromRgba(_a(e,t.hue)),o=Jn.fromRgba(_a(e,`surface`)),s=(e,t)=>e.mixAxes(a,{l:t,c:.8,h:1,alpha:0}),c=s(o.mixAxes(Jn.fromRgba(_a(e,`background`)),{l:.5,c:0,h:0,alpha:0}),0).mixAxes(s(o,.35),{l:t.tone,c:t.tone,h:t.tone,alpha:0}).toRgba();return n.set(r,c),c}const ya=new WeakMap,ba=(e,t,n)=>va(e,ga(t,n)),xa=2.2;function Sa(e,t,n){let r=Ca(e,t,n);if(`refused`in r)throw Error(r.refused);return r.state}function Ca(e,t,n){let r=wa.get(e);r===void 0&&(r=new Map,wa.set(e,r));let i=`${t}|${n}`,a=r.get(i);if(a!==void 0)return a;let o=Ta(e,t,n);return r.set(i,o),o}const wa=new WeakMap;function Ta(e,t,n){let r=oa.map(t=>cr(va(e,t),I.TRUECOLOR)),i=Tn(_a(e,`surface`),_a(e,t),.92),a=_a(e,`foreground`),o=r.reduce((e,t)=>or(e,t,xa),a),s=[...Array.from({length:13},(e,t)=>Tn(i,a,t/12)),o].find(e=>r.every(t=>rn(cr(e,I.TRUECOLOR),t)>=xa));if(s===void 0)return{refused:`palette "${e.name}": "${t}" cannot clear the ${xa} state floor even beyond foreground`};let c=sr(s,n,(e,t)=>r.every(n=>rn(e,t(n))>=xa));return c===void 0?{refused:`palette "${e.name}": "${t}" cannot clear the ${xa} state floor on the colours drawn at depth ${I[n]}`}:{state:c}}const Ea=4.5;function Da(e,t,n){let r=Oa.get(e);r===void 0&&(r=new Map,Oa.set(e,r));let i=`${t.hex}|${n}`,a=r.get(i);if(a!==void 0)return a;let o=ar(t),s=or([`background`,`foreground`].map(t=>_a(e,t)).reduce((e,t)=>rn(o,t)<rn(o,e)?t:e),t,Ea,n);return r.set(i,s),s}const Oa=new WeakMap,ka={base:.42,perDepth:.14,cap:.75},Aa={floor:.12,span:.8};function ja(e,t){return ta[(ta.indexOf(e)+t)%ta.length]}const Ma={triggerPlane:.1,nestedPlane:.035,nestedTriggerPlane:.08};function Na(e,t,n){let r=`${t.hue}|${t.depth}|${n}`,i=za.get(e);i===void 0&&(i=new Map,za.set(e,i));let a=i.get(r);if(a!==void 0)return a;let o=Sa(e,ja(t.hue,t.depth),n),s=Ra(e,t,o,n),c=sr(Fa(e,t).plane,n,(e,t)=>s.every(([n,r])=>Pa(e,t(n))>=r));if(c===void 0)throw Error(`palette "${e.name}": the ${t.hue} band at depth ${t.depth} cannot keep its floors on the colours drawn at depth ${I[n]}`);let l={state:o,plane:c};return i.set(r,l),l}const Pa=(e,t)=>Jn.fromRgba(e).deltaE(Jn.fromRgba(t));function Fa(e,t){let n=`${t.hue}|${t.depth}`,r=Ia.get(e);r===void 0&&(r=new Map,Ia.set(e,r));let i=r.get(n);if(i!==void 0)return i;let a=La(e,t);return r.set(n,a),a}const Ia=new WeakMap;function La(e,t){let n=Sa(e,ja(t.hue,t.depth),I.TRUECOLOR),r=Math.min(ka.cap,ka.base+ka.perDepth*t.depth);return{state:n,plane:Tn(n,_a(e,`background`),r)}}function Ra(e,t,n,r){let{hue:i,depth:a}=t,o=t=>Fa(e,{hue:i,depth:t}).state,s=t=>Fa(e,{hue:i,depth:t}).plane,c=e=>cr(e,I.TRUECOLOR),l=s(a),u=(e,t)=>Pa(c(l),c(t))>=e?e:0,d=ja(i,a+1),f=Ca(e,d,r),p=Ca(e,d,I.TRUECOLOR);return[[n,u(Ma.triggerPlane,o(a))],...`state`in f&&`state`in p?[[f.state,u(Ma.nestedTriggerPlane,p.state)]]:[],...a>0?[[Na(e,{hue:i,depth:a-1},r).plane,u(Ma.nestedPlane,s(a-1))]]:[]]}const za=new WeakMap;function Ba(e,t,n,r){let i=Na(e,t,r),a=Fa(e,t),o=sr(Tn(a.plane,a.state,Aa.floor+Aa.span*fa(n)),r,(e,t)=>e.hex!==t(i.plane).hex&&e.hex!==t(i.state).hex);if(o===void 0)throw Error(`palette "${e.name}": a ${t.hue} band item at depth ${t.depth} is drawn as its plane or its trigger at depth ${I[r]}, and nothing that depth draws is neither`);return o}const Va=e=>({kind:`bar`,variation:e,address:[]}),Ha=(e,t)=>({...e,address:[...e.address,t]}),Ua=e=>({kind:`band`,band:e,address:[]});function Wa(e,t,n){switch(t.kind){case`bar`:return{tint:ba(e,t.variation,t.address),disclosure:{hue:ra,depth:0}};case`band`:return{tint:Ba(e,t.band,t.address,n),disclosure:{hue:t.band.hue,depth:t.band.depth+1}}}}const Ga=new Map([[`dark`,`textual-dark`],[`light`,`textual-light`]]);function Ka(e){let t=typeof e==`string`?Ga.get(e):void 0;return t===void 0?``:` — "${e}" was retired; write "${t}", the same palette`}const qa=`textual-dark`;function Ja(e,t,n,r,i){let a=t===null?null:i(t);return e??a??n??r}function Ya(){return Cr()}function Xa(){return[`bar`,...Ya()]}let Za;function Qa(e){return Za??=new Set(Xa()),Za.has(e)}function $a(e,t,n,r,i){let a=e=>Object.prototype.hasOwnProperty.call(i,e)?e:null;return Ja(e===void 0?null:a(e),t,a(n??r),r,a)}const eo=[`style`,`palette`];function to(e){return e!==void 0&&e.includes(`{{`)}function no(e,t,n,r,i){let a=to(n)?{kind:`expression`,source:n}:i(n??r.name);return Ja(e===void 0?null:i(e),t,a,r,i)}function ro(e,t){return e.kind===`decided`?e:t(e.source)}const io=`none`;function ao(e,t){let n=t[e];return n===void 0?null:{kind:`decided`,name:e,value:n}}function oo(e,t){return ao(e,t)??ao(`none`,t)??{kind:`decided`,name:`none`,value:Rn}}function so(e,t,n,r){return no(e,t,n,oo(io,r),e=>ao(e,r))}const co=[`powerline`,`capsule`,`plain`];function lo(e){return co.includes(e)}function uo(e,t,n){return Ja(e,t,n,`powerline`,e=>lo(e)?e:null)}const fo=[`unicode`,`ascii`],po=`unicode`,mo=[`truecolor`,`256`,`ansi`,`none`];function ho(e){return mn(e)??I.DEFAULT}const go=Object.keys(na);function _o(e){return go.includes(e)}function vo(e,t,n){return Ja(e,t,n,`accent`,e=>_o(e)?e:null)}const yo=`true`,bo=`false`,xo=[yo,bo],So={min:0,max:16};function Co(e){return e===`true`?!0:e===`false`?!1:null}function wo(e){if(!/^\d+$/.test(e))return null;let t=Number(e);return t>=So.min&&t<=So.max?t:null}function To(e,t,n){return Ja(e,t,n,!0,Co)}function Eo(e,t,n){return Ja(e,t,n,!0,Co)}function Do(e,t,n){return Ja(e,t,n,1,wo)}var Oo=class extends Error{constructor(e,t){super(`${e} (at offset ${t})`),this.reason=e,this.offset=t,this.name=`Json5EditError`}};const ko=/[A-Za-z_$\p{L}]/u,Ao=/[A-Za-z0-9_$\u200C\u200D\p{L}\p{N}]/u,jo=/[A-Za-z0-9_$.+\-\p{L}\p{N}]/u,Mo=/[\t\n\v\f\r \u00A0\uFEFF\u2028\u2029\p{Zs}]/u;var No=class{pos=0;constructor(e){this.text=e}peek(){return this.text[this.pos]??``}fail(e){throw new Oo(e,this.pos)}skipTrivia(){for(;;){let e=this.peek();if(e===``)return;if(Mo.test(e))this.pos++;else if(e===`/`&&this.text[this.pos+1]===`/`){let e=this.text.indexOf(`
25
+ `,this.pos);this.pos=e===-1?this.text.length:e}else if(e===`/`&&this.text[this.pos+1]===`*`){let e=this.text.indexOf(`*/`,this.pos+2);e===-1&&this.fail(`unterminated block comment`),this.pos=e+2}else return}}expect(e){this.peek()!==e&&this.fail(`expected "${e}"`),this.pos++}value(){this.skipTrivia();let e=this.peek();if(e===`{`)return this.object();if(e===`[`)return this.array();if(e===`"`||e===`'`){let e=this.stringSpan();return{kind:`string`,span:e,value:this.decode(e)}}e===``&&this.fail(`unexpected end of input`);let t=this.pos;for(;this.pos<this.text.length&&jo.test(this.peek());)this.pos++;this.pos===t&&this.fail(`unexpected character "${e}"`);let n={start:t,end:this.pos},r=this.decode(n);return r===null?{kind:`null`,span:n}:typeof r==`boolean`?{kind:`boolean`,span:n,value:r}:typeof r==`number`?{kind:`number`,span:n,value:r}:this.fail(`unexpected word "${this.text.slice(t,this.pos)}"`)}decode(e){try{return et.default.parse(this.text.slice(e.start,e.end))}catch(t){throw new Oo(t.message,e.start)}}stringSpan(){let e=this.pos,t=this.peek();for(this.pos++;;){let n=this.peek();if(n===``&&this.fail(`unterminated string`),n===`\\`){let e=this.text.startsWith(`\r
26
26
  `,this.pos+1);this.pos+=e?3:2;continue}if(this.pos++,n===t)return{start:e,end:this.pos};n===`
27
- `&&this.fail(`unterminated string`)}}key(){let e=this.peek();if(e===`"`||e===`'`){let e=this.stringSpan();return{key:this.decode(e),span:e}}let t=this.pos;for(jo.test(e)||this.fail(`expected an object key`);this.pos<this.text.length&&Mo.test(this.peek());)this.pos++;return{key:this.text.slice(t,this.pos),span:{start:t,end:this.pos}}}object(){let e=this.pos;this.expect(`{`);let t=[];for(;this.skipTrivia(),this.peek()!==`}`;){let{key:e,span:n}=this.key();if(t.some(t=>t.key===e))throw new Ao(`duplicate key "${e}"`,n.start);this.skipTrivia(),this.expect(`:`);let r=this.value();if(t.push({key:e,keySpan:n,value:r,span:{start:n.start,end:r.span.end}}),this.skipTrivia(),this.peek()===`,`){this.pos++;continue}this.peek()!==`}`&&this.fail(`expected "," or "}"`)}return this.expect(`}`),{kind:`object`,span:{start:e,end:this.pos},entries:t}}array(){let e=this.pos;this.expect(`[`);let t=[];for(;this.skipTrivia(),this.peek()!==`]`;){if(t.push(this.value()),this.skipTrivia(),this.peek()===`,`){this.pos++;continue}this.peek()!==`]`&&this.fail(`expected "," or "]"`)}return this.expect(`]`),{kind:`array`,span:{start:e,end:this.pos},elements:t}}};function Io(e){let t=new Fo(e),n=t.value();return t.skipTrivia(),t.pos!==e.length&&t.fail(`trailing content after the document`),n}function Lo(e,t){return e.kind===`object`?e.entries.find(e=>e.key===t):void 0}function Ro(e,t){let n=e;for(let e of t)n=n===void 0?void 0:Lo(n,e)?.value;return n}function zo(e,t){return e.slice(t.span.start,t.span.end)}function Bo(e,t){let n=$o(e,t.span.start),r=Vo(t),i=e=>r.some(t=>t.start<e&&e<t.end),a=t.span.start;return zo(e,t).split(`
27
+ `&&this.fail(`unterminated string`)}}key(){let e=this.peek();if(e===`"`||e===`'`){let e=this.stringSpan();return{key:this.decode(e),span:e}}let t=this.pos;for(ko.test(e)||this.fail(`expected an object key`);this.pos<this.text.length&&Ao.test(this.peek());)this.pos++;return{key:this.text.slice(t,this.pos),span:{start:t,end:this.pos}}}object(){let e=this.pos;this.expect(`{`);let t=[];for(;this.skipTrivia(),this.peek()!==`}`;){let{key:e,span:n}=this.key();if(t.some(t=>t.key===e))throw new Oo(`duplicate key "${e}"`,n.start);this.skipTrivia(),this.expect(`:`);let r=this.value();if(t.push({key:e,keySpan:n,value:r,span:{start:n.start,end:r.span.end}}),this.skipTrivia(),this.peek()===`,`){this.pos++;continue}this.peek()!==`}`&&this.fail(`expected "," or "}"`)}return this.expect(`}`),{kind:`object`,span:{start:e,end:this.pos},entries:t}}array(){let e=this.pos;this.expect(`[`);let t=[];for(;this.skipTrivia(),this.peek()!==`]`;){if(t.push(this.value()),this.skipTrivia(),this.peek()===`,`){this.pos++;continue}this.peek()!==`]`&&this.fail(`expected "," or "]"`)}return this.expect(`]`),{kind:`array`,span:{start:e,end:this.pos},elements:t}}};function Po(e){let t=new No(e),n=t.value();return t.skipTrivia(),t.pos!==e.length&&t.fail(`trailing content after the document`),n}function Fo(e,t){return e.kind===`object`?e.entries.find(e=>e.key===t):void 0}function Io(e,t){let n=e;for(let e of t)n=n===void 0?void 0:Fo(n,e)?.value;return n}function Lo(e,t){return e.slice(t.span.start,t.span.end)}function Ro(e,t){let n=Zo(e,t.span.start),r=zo(t),i=e=>r.some(t=>t.start<e&&e<t.end),a=t.span.start;return Lo(e,t).split(`
28
28
  `).map((e,t)=>{let r=a;return a+=e.length+1,(t>0&&!i(r-1)&&e.startsWith(n)?e.slice(n.length):e).replace(/\r$/,``)}).join(`
29
- `)}function Vo(e){switch(e.kind){case`object`:return e.entries.flatMap(e=>[e.keySpan,...Vo(e.value)]);case`array`:return e.elements.flatMap(Vo);case`string`:return[e.span];default:return[]}}const Ho=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function Uo(e){return Ho.test(e)?e:JSON.stringify(e)}const Wo={key:Uo,trailingComma:`,`,parse:e=>et.default.parse(e)},Go={key:e=>JSON.stringify(e),trailingComma:``,parse:e=>JSON.parse(e)};function Ko(e){if(Array.isArray(e))return e.length===0?`[]`:`[\n${e.map(e=>` ${Jo(Ko(e),` `,`
29
+ `)}function zo(e){switch(e.kind){case`object`:return e.entries.flatMap(e=>[e.keySpan,...zo(e.value)]);case`array`:return e.elements.flatMap(zo);case`string`:return[e.span];default:return[]}}const Bo=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function Vo(e){return Bo.test(e)?e:JSON.stringify(e)}const Ho={key:Vo,trailingComma:`,`,parse:e=>et.default.parse(e)},Uo={key:e=>JSON.stringify(e),trailingComma:``,parse:e=>JSON.parse(e)};function Wo(e){if(Array.isArray(e))return e.length===0?`[]`:`[\n${e.map(e=>` ${Ko(Wo(e),` `,`
30
30
  `)},`).join(`
31
- `)}\n]`;if(typeof e==`object`&&e){let t=Object.entries(e).filter(([,e])=>e!==void 0);return t.length===0?`{}`:`{\n${t.map(([e,t])=>` ${Uo(e)}: ${Jo(Ko(t),` `,`
31
+ `)}\n]`;if(typeof e==`object`&&e){let t=Object.entries(e).filter(([,e])=>e!==void 0);return t.length===0?`{}`:`{\n${t.map(([e,t])=>` ${Vo(e)}: ${Ko(Wo(t),` `,`
32
32
  `)},`).join(`
33
- `)}\n}`}return JSON.stringify(e)}function qo(e){return e.includes(`\r
33
+ `)}\n}`}return JSON.stringify(e)}function Go(e){return e.includes(`\r
34
34
  `)?`\r
35
35
  `:`
36
- `}function Jo(e,t,n){return e.split(`
37
- `).join(`${n}${t}`)}function Yo(e,t,n){let[r,...i]=e,a=i.length===0?t:`{\n ${Jo(Yo(i,t,n),` `,`
38
- `)}${n.trailingComma}\n}`;return`${n.key(r)}: ${a}`}function Xo(e,t,n,r){return e.slice(0,t)+r+e.slice(n)}function Zo(e,t){return e.lastIndexOf(`
39
- `,t-1)+1}function Qo(e){return/^[ \t]*$/.test(e)}function $o(e,t){let n=Zo(e,t);return/^[ \t]*/.exec(e.slice(n))[0]}function es(e,t){return Qo(e.slice(Zo(e,t),t))}const ts=/(?:\/\/[^\n]*?)?(\r\n|\n|$)/y;function ns(e,t){let n=t;for(;n<e.length&&(e[n]===` `||e[n]===` `);)n++;let r=e[n]===`,`?n+1:-1;for(r!==-1&&(n=r);n<e.length&&(e[n]===` `||e[n]===` `);)n++;ts.lastIndex=n;let i=ts.exec(e);if(i===null)return{commaEnd:r,line:null};let a=n+i[0].length;return{commaEnd:r,line:{at:a-i[1].length,next:a}}}function rs(e,t){let{commaEnd:n,line:r}=ns(e,t.end);if(es(e,t.start)&&r!==null)return Xo(e,Zo(e,t.start),r.next,``);if(n!==-1){let r=n;for(;r<e.length&&e[r]===` `;)r++;return Xo(e,t.start,r,``)}let i=t.start;for(;i>0&&(e[i-1]===` `||e[i-1]===` `);)i--;return e[i-1]===`,`?Xo(e,i-1,t.end,``):Xo(e,t.start,t.end,``)}function is(e,t,n,r,i){let a=n.commaEnd!==-1,o=a?e:Xo(e,t.end,t.end,`,`),s=n.line.at+ +!a,c=qo(e);return Xo(o,s,s,`${c}${i}${Jo(r,i,c)}${a?`,`:``}`)}function as(e,t,n,r){let i=t.kind===`object`?t.entries:t.elements,a=i[i.length-1],o=$o(e,t.span.start);if(a===void 0){let i=o+` `,a=qo(e);return Xo(e,t.span.start+1,t.span.end-1,`${a}${i}${Jo(n,i,a)}${r.trailingComma}${a}${o}`)}let{commaEnd:s,line:c}=ns(e,a.span.end);if(es(e,a.span.start)&&c!==null){let t=e.slice(Zo(e,a.span.start),a.span.start);return is(e,a.span,{commaEnd:s,line:c},n,t)}let l=s===-1?a.span.end:s;return Xo(e,l,l,`${s===-1?`, `:` `}${n}${s===-1?``:`,`}`)}function os(e,t,n,r){if(t.length===0)throw new Ao(`setValue needs a non-empty path`,0);if(/^\s*$/.test(e)){let i=qo(e);return`{${i} ${Jo(Yo(t,n,r),` `,i)}${r.trailingComma}${i}}${i}`}return ss(e,Io(e),t,n,r)}function ss(e,t,n,r,i){let a=t;for(let t=0;t<n.length;t++){if(a.kind!==`object`)throw new Ao(`cannot set ${n.join(`.`)}: ${n.slice(0,t).join(`.`)||`the document`} is not an object`,a.span.start);let o=Lo(a,n[t]);if(o===void 0)return as(e,a,Yo(n.slice(t),r,i),i);if(t===n.length-1){let t=$o(e,o.keySpan.start);return Xo(e,o.value.span.start,o.value.span.end,Jo(r,t,qo(e)))}a=o.value}throw new Ao(`unreachable: path exhausted`,0)}function cs(e,t,n=0){if(t.length===0)throw new Ao(`deleteValue needs a non-empty path`,0);if(/^\s*$/.test(e))return e;let r=t.slice(0,-1),i=Ro(Io(e),r),a=i===void 0?void 0:Lo(i,t[t.length-1]);if(a===void 0||i?.kind!==`object`)return e;let o=rs(e,a.span);return r.length>n&&i.entries.length===1?cs(o,r,n):o}const ls=[`h`,`v`,`children`];function us(e){if(e.kind===`string`)return e.value;if(e.kind!==`object`)return;let t=Lo(e,`seg`)?.value,n=Lo(e,`kind`)?.value,r=Lo(e,`name`)?.value,i=t?.kind===`string`?t.value:n?.kind===`string`&&n.value===`segment`&&r?.kind===`string`?r.value:void 0;if(i===void 0)return;let a=Lo(e,`id`)?.value;return a?.kind===`string`?a.value:i}function ds(e){return e.kind===`object`?ls.map(t=>Lo(e,t)?.value).filter(e=>e?.kind===`array`):[]}function fs(e){let t=Lo(e,`rows`)?.value;return t?.kind===`object`?t.entries:null}function ps(e){if(e.kind!==`object`)return!0;let t=fs(e);return t===null||t.length>0||e.entries.some(e=>e.key!==`rows`)}function*ms(e,t){yield{node:e,bareAt:t};for(let t of ds(e))for(let e of t.elements)yield*ms(e,null);for(let n of fs(e)??[])yield*ms(n.value,t===null?null:[...t,`rows`,n.key])}function hs(e,t){for(let{node:n}of ms(e,null))if(us(n)===t)return!0;return!1}function gs(e,t,n){let r=Ro(Io(e),t);if(r===void 0)return null;for(let{node:i,bareAt:a}of ms(r,t))if(us(i)===n)return a===null?{text:e,ref:i}:gs(os(e,a,`{ h: [${zo(e,i)}] }`,Wo),t,n);return null}function _s(e,t,n){let r=gs(e,t,n);return r===null?null:rs(r.text,r.ref.span)}function vs(e,t,n,r,i){let a=gs(e,t,r);if(a===null)return null;let{text:o,ref:s}=a,c=n.id===void 0?JSON.stringify(n.seg):`{ seg: ${JSON.stringify(n.seg)}, id: ${JSON.stringify(n.id)} }`,{commaEnd:l,line:u}=ns(o,s.span.end);if(es(o,s.span.start)&&u!==null){let e=o.slice(Zo(o,s.span.start),s.span.start);return i===`after`?is(o,s.span,{commaEnd:l,line:u},c,e):Xo(o,s.span.start,s.span.start,`${c},${qo(o)}${e}`)}let d=zo(o,s),f=i===`before`?`${c}, ${d}`:`${d}, ${c}`;return Xo(o,s.span.start,s.span.end,f)}function ys(e,t,n,r,i){let a=gs(e,t,n);if(a===null)return null;let{text:o,ref:s}=a,c=`{ ${Uo(r)}: ${i} }`;return s.kind===`string`?Xo(o,s.span.start,s.span.end,`{ seg: ${JSON.stringify(s.value)}, settings: ${c} }`):Lo(s,`settings`)===void 0?ss(o,s,[`settings`],c,Wo):ss(o,s,[`settings`,r],i,Wo)}var bs=class extends Error{file;issues;warnings;constructor(e,t,n=[]){super(ws(e,t)),this.name=`ConfigError`,this.file=e,this.issues=t,this.warnings=n}};function U(e,t){let n=0,r;for(let i of t){if(i===``||/^\d+$/.test(i))continue;let t=xs(e,n,i);if(t===-1)return r===void 0?void 0:Ss(e,r);n=t,r=t}return r===void 0?void 0:Ss(e,r)}function xs(e,t,n){let r=n.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`),i=RegExp(`(?:["']${r}["']|\\b${r}\\b)\\s*:`,`g`);i.lastIndex=t;let a=i.exec(e);return a?a.index:-1}function Ss(e,t){let n=1;for(let r=0;r<t&&r<e.length;r++)e.charCodeAt(r)===10&&n++;return n}function Cs(e,t){try{return Io(t),null}catch(n){if(!(n instanceof Ao))throw n;return`${e}:${Ss(t,n.offset)}: ${n.reason} — the settings menu cannot edit this file until it is fixed`}}function ws(e,t){if(t.length===0)return`${e}: invalid config (no details)`;let n=[`Invalid config in ${e} (${t.length} issue${t.length===1?``:`s`}):`];for(let e of t){let t=[];e.line!==void 0&&t.push(`line ${e.line}${e.col===void 0?``:`:${e.col}`}`),e.path&&t.push(e.path);let r=t.length>0?`[${t.join(` • `)}] `:``;n.push(` ${r}${e.message}`)}return n.join(`
40
- `)}const Ts=[`vertical`,`horizontal`],Es={vertical:`row`,horizontal:`cell`};function Ds(e){return e.id??e.name}function Os(e){return[...js(e)].flatMap(e=>e.kind===`segment`?[Ds(e)]:[])}function ks(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function As(e,t){return e.opens===void 0?e:{...e,opens:{...e.opens,body:t(e.opens.body)}}}function*js(e){yield e;for(let t of Fs(e))yield*js(t)}const Ms=(e,t)=>`${e}.children[${t}]`,Ns=e=>`${e}.opens.body`;function*Ps(e,t){if(yield[e,t],e.kind===`container`)for(let[n,r]of e.children.entries())yield*Ps(r,Ms(t,n));else e.opens!==void 0&&(yield*Ps(e.opens.body,Ns(t)))}function Fs(e){return e.kind===`container`?e.children:e.opens===void 0?[]:[e.opens.body]}function Is(e){return e===void 0||`text`in e?`text`:`regex`in e?`regex`:`json`}const Ls=[`ttl`,`watch_file`,`depends_on`,`key`,`never`];function Rs(e){return e.kind!==`literal`&&e.kind!==`input`&&e.kind!==`env`&&e.kind!==`state`}const zs=[`branch`,`sha`,`dirty`,`ahead`,`behind`,`stash`],Bs=[`file`,`shell`,`git`],Vs=`theme`;function Hs(e){return{...e.settings,[Vs]:{label:Vs,domain:`theme`,default:e.palette??`bar`}}}function Us(e){let t=e?.domain;return typeof t==`object`&&`min`in t?t:void 0}function Ws(e,t){return Object.entries(e).flatMap(([n,r])=>{let i=Us(r)?.atLeast;if(i===void 0)return[];let a=t[n],o=t[i];return a>=o?[]:[{setting:n,message:`"${n}" (${a}) is below "${i}" (${o}) — ${r.label} must be at least ${e[i].label}`}]})}function Gs(e,t){let{domain:n}=e;return n===`bool`?typeof t==`boolean`:n===`theme`?typeof t==`string`&&eo(t):`min`in n?typeof t==`number`&&Number.isInteger(t)&&t>=n.min&&t<=n.max:typeof t==`string`&&n.includes(t)}function Ks(e){return String(e)}function qs(e,t){let{domain:n}=e,r=n===`bool`?t===`true`?!0:t===`false`?!1:t:typeof n==`object`&&`min`in n&&/^-?\d+$/.test(t)?Number(t):t;return Gs(e,r)?r:void 0}function Js(e){let{domain:t}=e;return t===`bool`?`true or false`:t===`theme`?`"bar" (the bar's own theme) or an installed theme name`:`min`in t?`an integer from ${t.min} to ${t.max}`:`one of ${t.map(e=>JSON.stringify(e)).join(`, `)}`}const Ys=[`left`,`center`,`right`],Xs=[`right`,`left`,`middle`];function Zs(e,t,n,r){let i=n[r];return typeof i==`string`?i:(e.issues.push({path:`${t}.${r}`,message:`${t}.${r} must be a string, got ${W(i)}`,line:U(e.source,[...t.split(`.`),r])}),null)}function Qs(e,t,n,r){let i=n.default;if(i!==void 0){if(!(r===`string`&&typeof i==`string`||r===`number`&&typeof i==`number`||r===`boolean`&&typeof i==`boolean`)){e.issues.push({path:`${t}.default`,message:`default must be a ${r}, got ${W(i)}`,line:U(e.source,[...t.split(`.`),`default`])});return}return i}}function $s(e,t,n,r){let i=n[r];if(i!==void 0){if(typeof i!=`string`){e.issues.push({path:`${t}.${r}`,message:`${t}.${r} must be a string, got ${W(i)}`,line:U(e.source,[...t.split(`.`),r])});return}return i}}function ec(e,t,n){let r=$s(e,t,n,`palette`);if(r!==void 0){if(!e.allowedPalettes.has(r)){e.issues.push({path:`${t}.palette`,message:`Unknown palette "${r}"${Ja(r)}. Expected one of: ${[...e.allowedPalettes].sort().join(`, `)}`,line:U(e.source,[...t.split(`.`),`palette`])});return}return r}}function tc(e,t,n,r,i){let a=n[r];if(a!==void 0){if(typeof a!=`string`||!i.includes(a)){e.issues.push({path:`${t}.${r}`,message:`${t}.${r} must be one of: ${i.join(`, `)}; got ${G(a)}`,line:U(e.source,[...t.split(`.`),r])});return}return a}}function nc(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function W(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e}function G(e){return typeof e==`string`?JSON.stringify(e):e===void 0?`undefined`:String(e)}function rc(e,t,n,r){if(!nc(r))return e.issues.push({path:n,message:`${n} must be an object, got ${W(r)}`,line:U(e.source,n.split(`.`))}),null;let i=Object.entries(t.removed??{}).filter(([e])=>r[e]!==void 0);for(let[t,r]of i)sc(e,`${n}.${t}`,`${n}.${t} was removed: ${r}`);return oc(e,n,r,t.noun,new Set(Object.keys(t.fields)),new Set(i.map(([e])=>`${n}.${e}`))),ic(e,t.fields,n,r)}function ic(e,t,n,r){let i=t,a={},o=!0;for(let[t,s]of Object.entries(i)){let i=s.parse(e,n,t,r);i===void 0?s.required&&(o=!1):a[t]=i}return o?a:null}const ac=new Set;function oc(e,t,n,r,i,a=ac){for(let o of Object.keys(n))!i.has(o)&&!a.has(`${t}.${o}`)&&e.issues.push({path:`${t}.${o}`,message:`Unknown ${r} "${o}". Expected one of: ${[...i].join(`, `)}`,line:U(e.source,[...t.split(`.`),o])})}function sc(e,t,n){return e.issues.push({path:t,message:n,line:U(e.source,t.split(`.`))}),null}function cc(e,t,n,r){if(!nc(r))return e.issues.push({path:n,message:`${t.noun} must be an object, got ${W(r)}`,line:U(e.source,n.split(`.`))}),null;let i=t.arms,a=Object.keys(i),o=Object.keys(r).filter(e=>e in i),s=Object.keys(r).filter(e=>!(e in i));for(let r of s)e.issues.push({path:`${n}.${r}`,message:`Unknown ${t.noun} key "${r}". Expected exactly one of: ${a.join(`, `)}`,line:U(e.source,[...n.split(`.`),r])});if(o.length===0)return e.issues.push({path:n,message:`${t.noun} must declare exactly one of: ${a.join(`, `)}`,line:U(e.source,n.split(`.`))}),null;if(o.length>1)return e.issues.push({path:n,message:`${t.noun} must declare exactly one of: ${a.join(`, `)} (found: ${o.join(`, `)})`,line:U(e.source,n.split(`.`))}),null;let c=o[0];return i[c].parse(e,`${n}.${c}`,r[c])}function lc(e,t,n,r){if(!nc(r))return e.issues.push({path:n,message:`${n} must be an object, got ${W(r)}`,line:U(e.source,n.split(`.`))}),null;let i=r[t.tag];if(typeof i!=`string`)return e.issues.push({path:`${n}.${t.tag}`,message:`${n}.${t.tag} must be a string, got ${W(i)}`,line:U(e.source,n.split(`.`))}),null;let a=t.arms;if(!(i in a))return e.issues.push({path:`${n}.${t.tag}`,message:`Unknown ${t.noun} "${i}". Expected one of: ${Object.keys(a).join(`, `)}`,line:U(e.source,[...n.split(`.`),t.tag])}),null;let o=a[i],s=e.issues.length,c=o.parse(e,n,r),l=new Set(e.issues.slice(s).map(e=>e.path));return oc(e,n,r,`${i} ${t.memberNoun} key`,o.keys,l),c}function uc(e,t,n){return{json:wc(Sc(n),e,t),keys:new Set([e,...Object.keys(n)])}}function dc(e){return(...t)=>e()(...t)}function fc(e,...t){return(n,r,i)=>{let a=e(n,r,i);if(a===null)return null;for(let e of t){if(e.ok(a))continue;let{field:t,message:i}=e.issue(a),o=t===``?r:`${r}.${t}`;return n.issues.push({path:o,message:i,line:U(n.source,o.split(`.`))}),null}return a}}function pc(){return{required:!1,json:{type:`string`},parse:(e,t,n,r)=>$s(e,t,r,n)}}function mc(){return{required:!1,json:{type:`boolean`},parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0){if(typeof i!=`boolean`){e.issues.push({path:`${t}.${n}`,message:`${n} must be a boolean, got ${W(i)}`,line:U(e.source,[n])});return}return i}}}}function hc(e){let{min:t,max:n}=e;return{required:!1,json:{type:`integer`,minimum:t,maximum:n},parse:(e,r,i,a)=>{let o=a[i];if(o!==void 0){if(typeof o!=`number`||!Number.isInteger(o)||o<t||o>n){e.issues.push({path:`${r}.${i}`,message:`${i} must be an integer between ${t} and ${n}, got ${G(o)}`,line:U(e.source,[i])});return}return o}}}}function gc(e={}){let{min:t}=e;return{required:!1,json:{type:`number`,...t!==void 0&&{minimum:t}},parse:(e,n,r,i)=>{let a=i[r];if(a!==void 0){if(typeof a!=`number`||!Number.isFinite(a)||t!==void 0&&a<t){let i=t===void 0?`a finite number`:`a finite number >= ${t}`;e.issues.push({path:`${n}.${r}`,message:`${r} must be ${i}, got ${G(a)}`,line:U(e.source,[r])});return}return a}}}}function _c(){return{required:!1,json:{type:`string`},parse:(e,t,n,r)=>ec(e,t,r)}}function vc(){return{required:!0,json:{type:`string`},parse:(e,t,n,r)=>Zs(e,t,r,n)??void 0}}function yc(e,t){return d(t)?null:`${e} must be an absolute path (\`~\` and relative paths are not expanded), got ${JSON.stringify(t)}`}function bc(){return{required:!0,json:{type:`string`,pattern:`^/`},parse:(e,t,n,r)=>{let i=Zs(e,t,r,n);if(i===null)return;let a=yc(`${t}.${n}`,i);return a===null?i:sc(e,`${t}.${n}`,a)??void 0}}}function xc(e){return{required:!1,json:{enum:[...e]},parse:(t,n,r,i)=>tc(t,n,i,r,e)}}function Sc(e,t={closed:!0}){let n=e,r={},i=[];for(let[e,t]of Object.entries(n))r[e]=t.json,t.required&&i.push(e);return{type:`object`,properties:r,...i.length>0&&{required:i},...t.closed&&{additionalProperties:!1}}}function Cc(e){return Sc(e.fields)}function wc(e,t,n){let r=e,i={[t]:{const:n},...r.properties},a=[t,...r.required??[]];return{...r,properties:i,required:a}}function Tc(e){let t=e.arms;return{anyOf:Object.values(t).map(e=>e.json)}}function Ec(e){let t=e.arms;return{anyOf:Object.entries(t).map(([e,t])=>({type:`object`,properties:{[e]:t.json},required:[e],additionalProperties:!1}))}}const Dc=/^[A-Za-z_][A-Za-z0-9_]*$/;function Oc(e){return`#${e+1}`}const kc={rows:{}};function Ac(e){return`rows`in e}function jc(e){return Object.fromEntries(e.map((e,t)=>[Oc(t),e]))}function Mc(e){if(e.kind===`container`&&e.direction===`vertical`){let{kind:t,direction:n,children:r,...i}=e;return{...i,rows:jc(r)}}let{when:t,...n}=e;return{...t!==void 0&&{when:t},rows:jc([n])}}function Nc(e){let{rows:t,...n}=e;return{kind:`container`,direction:`vertical`,children:Object.values(t),...n}}function Pc(e){return Ac(e)?Nc(e):e}function*Fc(e,t){if(!Ac(e)){yield*Ps(e,t);return}yield[Nc(e),t];for(let[n,r]of Object.entries(e.rows))yield*Ps(r,`${t}.rows.${n}`)}function Ic(e,t){return Ac(e)?{...t,...e,rows:{...t.rows,...e.rows}}:Mc(e)}function Lc(e){if(!Ac(e))return!0;let{rows:t,...n}=e;return Object.values(n).some(e=>e!==void 0)||Object.keys(t).length>0}function Rc(e,t){return{globals:{...t.globals,...e.globals??{}},variables:{...t.variables,...e.variables??{}},segments:Vc(t.segments,zc(t.segments,e.segments??{})),root:Ic(e.root??kc,t.root),actions:{...t.actions,...e.actions??{}},styles:{...t.styles,...e.styles??{}},presets:Vc(t.presets,Bc(t.presets,e.presets??{})),editGlobals:{...t.editGlobals,...e.editGlobals??{}},helpers:{...t.helpers,...e.helpers??{}}}}function zc(e,t){return Object.fromEntries(Object.entries(t).map(([t,n])=>[t,n.settings===void 0?n:{...n,settings:{...e[t]?.settings,...n.settings}}]))}function Bc(e,t){return Object.fromEntries(Object.entries(t).map(([t,n])=>[t,n.globals===void 0?n:{...n,globals:{...e[t]?.globals,...n.globals}}]))}function Vc(e,t){return{...e,...Object.fromEntries(Object.entries(t).map(([t,n])=>[t,{...e[t],...n}]))}}const Hc=`closed`,Uc=`🍫`;function Wc(e,t,n){if(t===0)return`${e} needs a display (the clickable text)`;if(t!==1&&t!==n)return`${e} cycles ${n} members; bind one display per member (${n}) or one static display, got ${t}`}function Gc(e,t,n,r){let i=Wc(e,t.length,n);if(i!==void 0)throw Error(i);return t.length===1?t[0]:t[r]}function Kc(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}function qc(e,t,n,r,i){return{kind:`segment`,name:e,opens:{ref:t,body:n,placement:r},...i!==void 0&&{when:i}}}function Jc(e,...t){return`{{ and ${[e,...t].map(Yc).join(` `)} }}`}function Yc(e){return`(eq .${e.variable} "${Kc(e.member)}")`}function Xc(e,t,n){return`{{ ${Zc(e,t,n)} }}`}function Zc(e,t,n){return`action "${e}" "${Kc(t)}" "${Kc(n)}"`}function Qc(e,t){return{kind:`state`,key:e,default:t}}function $c(e,t){return{set:e,cycle:[Hc,t]}}const el={required:!1,json:{enum:[...go]},parse:(e,t,n,r)=>{if(r[n]===`auto`){e.issues.push({path:`${t}.${n}`,message:`${t}.${n}: "auto" is not supported — the render daemon runs detached, so terminal detection would read the daemon's environment, not your terminal's. Pick an explicit depth: ${go.join(`, `)}`,line:U(e.source,[...t.split(`.`),n])});return}return tc(e,t,r,n,go)}},tl={required:!1,json:{type:`string`},parse:(e,t,n,r)=>{let i=$s(e,t,r,n);return ro(i)?i:ec(e,t,r)}},nl=/^[^\r\n]*\S[^\r\n]*$/u,rl=RegExp(`^(?:✖|✕)[\\uFE0E\\uFE0F]?$`,`u`),il={required:!1,json:{type:`string`,pattern:nl.source,not:{pattern:rl.source}},parse:(e,t,n,r)=>{let i=$s(e,t,r,n);if(i===void 0||nl.test(i)&&!rl.test(i))return i;e.issues.push({path:`${t}.${n}`,message:`${t}.${n}: must be one line of visible text other than a close glyph ("✖", "✕") — the settings menu needs a glyph to click`,line:U(e.source,[...t.split(`.`),n])})}};function al(e){return{spec:xc(e),domain:{from:e}}}function ol(){return{spec:mc(),domain:`bool`}}function sl(e){return{spec:e,domain:`text`}}const cl={default_empty_value:sl(pc()),default_separator:sl(pc()),palette:{spec:tl,domain:{from:`themes`}},style:{spec:pc(),domain:{from:`styles`}},preset:{spec:pc(),domain:{from:`presets`}},endcaps:al(uo),variation:al(vo),autoWrap:ol(),padding:{spec:hc(wo),domain:{...wo,step:1}},charset:al(mo),updateNotice:ol(),colorCompatibility:{spec:el,domain:{from:go}},menuGlyph:sl(il)},ll=Object.fromEntries(Object.entries(cl).map(([e,t])=>[e,t.spec]));function ul(e){return cl[e].domain}function dl(e,t){return{required:!1,json:{not:{},description:`not allowed here — ${e}`},parse:(e,n,r,i)=>{i[r]!==void 0&&e.issues.push({path:`${n}.${r}`,message:t(`${n}.${r}`),line:U(e.source,[...n.split(`.`),r])})}}}function fl(e){return dl(`${e} cannot select a preset`,t=>`${t}: ${e} cannot select a preset. Which preset is active is resolved once, as session pick over globals.preset over "default"; a fragment naming another would be a second authority over that. Set the default arrangement in the top-level globals.preset instead.`)}function pl(e){return dl(`${e} cannot change the settings menu glyph`,t=>`${t}: ${e} cannot change the settings menu glyph — one menu is shared by every preset. Set it in the top-level globals.menuGlyph instead.`)}function ml(e,t){return{...e,json:{...e.json,not:{pattern:`\\{\\{`}},parse:(n,r,i,a)=>{let o=a[i];if(typeof o==`string`&&ro(o)){n.issues.push({path:`${r}.${i}`,message:`${r}.${i}: a rule is not allowed here — ${t} is decided later than any rule could be settled, so it names a value. Write the rule in globals.${i} (or a preset's globals.${i}) instead.`,line:U(n.source,[...r.split(`.`),i])});return}return e.parse(n,r,i,a)}}}const hl={default_bg:"nothing reads it — a segment with no `bg:` wears the decoration tint of its place in the bar. Delete the key, and author `bg:` on the segments that need a fixed colour.",default_fg:"nothing reads it — a segment with no `fg:` wears text chosen for contrast against its background. Delete the key, and author `fg:` on the segments that need a fixed colour.",default_truncate_marker:'nothing reads it — a segment clipped to its `width:` always ends in "…". Delete the key.',look:`it was renamed "style" — write the same name as style: "<name>"`,progression:`it was renamed "variation", and its values with it: accent (was secondary-accent), duo (was primary-secondary), mono (was primary)`},gl={noun:`globals key`,fields:ll,removed:hl},_l={preset:fl(`a preset`),menuGlyph:pl(`a preset`)},vl={noun:`preset globals key`,fields:{...ll,..._l},removed:hl};function yl(e){return El(e)&&!(e in _l)}const bl={noun:`editGlobals key`,removed:hl,fields:{...ll,preset:fl(`the editGlobals fragment`),menuGlyph:pl(`the editGlobals fragment`),palette:ml(ll.palette,`the editGlobals fragment`),style:ml(ll.style,`the editGlobals fragment`)}};function xl(e,t,n){return n===void 0?{}:rc(e,gl,t,n)??{}}function Sl(e,t,n){return rc(e,vl,t,n)??{}}function Cl(){return Cc(vl)}function wl(e,t,n){return rc(e,bl,t,n)??{}}const Tl=new Set(Object.keys(ll));function El(e){return Tl.has(e)}function Dl(){return[...Tl]}const Ol={padding:1};function kl(e){let t=new Map;for(let[n,r]of Object.entries(Ol)){let i=e[n];t.set(n,typeof i==`number`?i:r)}return t}function Al(e,t,n,r){return n.cache===void 0?(Bs.includes(r)&&e.issues.push({path:`${t}.cache`,message:`${r} variables must declare a cache policy (one of: ${Ls.join(`, `)})`,line:U(e.source,t.split(`.`))}),null):Fl(e,`${t}.cache`,n.cache)}function jl(e,t,n){if(n.cache!==void 0)return Fl(e,`${t}.cache`,n.cache)??void 0}function Ml(e){return{required:!0,json:Rl(),parse:(t,n,r,i)=>Al(t,n,i,e)??void 0}}function Nl(){return{required:!1,json:Rl(),parse:(e,t,n,r)=>jl(e,t,r)}}const Pl={noun:`cache`,arms:{ttl:{json:{type:`string`},parse:(e,t,n)=>typeof n==`string`&&Bl(n)?{ttl:n}:sc(e,t,`cache.ttl must be a duration string like "5s", "100ms", "2m", "1h"; got ${G(n)}`)},watch_file:{json:{type:`string`,pattern:`^/`},parse:(e,t,n)=>{if(typeof n!=`string`)return sc(e,t,`cache.watch_file must be a path string, got ${G(n)}`);let r=yc(`cache.watch_file`,n);return r===null?{watch_file:n}:sc(e,t,r)}},depends_on:{json:{type:`array`,items:{type:`string`}},parse:(e,t,n)=>Array.isArray(n)&&n.every(e=>typeof e==`string`)?{depends_on:n}:sc(e,t,`cache.depends_on must be an array of variable-name strings, got ${G(n)}`)},key:{json:{type:`string`},parse:(e,t,n)=>typeof n==`string`&&n!==``?{key:n}:sc(e,t,`cache.key must be a non-empty template string, got ${G(n)}`)},never:{json:{const:!0},parse:(e,t,n)=>n===!0?{never:!0}:sc(e,t,`cache.never must be the literal boolean true, got ${G(n)}`)}}};function Fl(e,t,n){return cc(e,Pl,t,n)}const Il={noun:`time-variable cache`,arms:{ttl:Pl.arms.ttl}};function Ll(){return{required:!1,json:Ec(Il),parse:(e,t,n,r)=>r.cache===void 0?void 0:cc(e,Il,`${t}.cache`,r.cache)??void 0}}function Rl(){return Ec(Pl)}const zl=/^(\d+(?:\.\d+)?)(ms|s|m|h)$/;function Bl(e){return zl.test(e)}function Vl(e,t,n){if(n===void 0)return{};if(!nc(n))return e.issues.push({path:t,message:`${t} must be an object, got ${W(n)}`,line:U(e.source,t.split(`.`))}),{};let r={};for(let[i,a]of Object.entries(n)){let n=lc(e,lu,`${t}.${i}`,a);n!==null&&(r[i]=n)}return r}function Hl(){return{required:!0,json:{type:[`string`,`number`,`boolean`]},parse:(e,t,n,r)=>{let i=r.value;if(typeof i!=`string`&&typeof i!=`number`&&typeof i!=`boolean`){e.issues.push({path:`${t}.value`,message:`literal value must be string|number|boolean, got ${W(i)}`,line:U(e.source,t.split(`.`))});return}return i}}}function Ul(){return{required:!0,json:{enum:[...zs]},parse:(e,t,n,r)=>{let i=r.field;if(typeof i!=`string`||!zs.includes(i)){e.issues.push({path:`${t}.field`,message:`git field must be one of: ${zs.join(`, `)}, got ${JSON.stringify(i)}`,line:U(e.source,[...t.split(`.`),`field`])});return}return i}}}function Wl(){return{required:!1,json:{type:[`string`,`number`,`boolean`]},parse:(e,t,n,r)=>{let i=r.type;return Qs(e,t,r,i===`number`||i===`boolean`||i===`string`?i:`string`)}}}const Gl={noun:`parse`,arms:{text:{json:{const:!0},parse:(e,t,n)=>n===!0?{text:!0}:sc(e,t,`parse.text must be the literal boolean true, got ${G(n)}`)},regex:{json:{type:`string`},parse:(e,t,n)=>typeof n==`string`?Kl(e,t,n):sc(e,t,`parse.regex must be a pattern string, got ${G(n)}`)},json:{json:{const:!0},parse:(e,t,n)=>n===!0?{json:!0}:sc(e,t,`parse.json must be the literal boolean true, got ${G(n)}`)}}};function Kl(e,t,n){let r;try{new RegExp(n),r=RegExp(`${n}|`).exec(``).length-1}catch(n){return sc(e,t,`parse.regex is not a valid regular expression: ${n.message}`)}return r>=1?{regex:n}:sc(e,t,`parse.regex must contain a capture group — its group 1 is the value; got ${JSON.stringify(n)}`)}function ql(){return{required:!1,json:Ec(Gl),parse:(e,t,n,r)=>(r.regex!==void 0&&e.issues.push({path:`${t}.regex`,message:`${t}.regex was retired; the regex is the parse step's regex arm now: parse: { regex: ${JSON.stringify(r.regex)} }`,line:U(e.source,[...t.split(`.`),`regex`])}),r.parse===void 0?void 0:cc(e,Gl,`${t}.parse`,r.parse)??void 0)}}function Jl(){return{required:!1,json:{type:[`string`,`number`,`boolean`,`array`,`object`],description:`The value published when the source fails: a string under the text/regex parse arms, any non-null JSON value under the json arm`},parse:(e,t,n,r)=>nc(r.parse)&&`json`in r.parse?Yl(e,t,r.default):$s(e,t,r,`default`)}}function Yl(e,t,n){if(n!==void 0)return Xl(n)?n:sc(e,`${t}.default`,`${t}.default must be a JSON value (a json-parsed source's document), got ${G(n)}`)??void 0}function Xl(e){return e!==null&&Zl(e)}function Zl(e){if(e===null)return!0;switch(typeof e){case`string`:case`boolean`:return!0;case`number`:return Number.isFinite(e);case`object`:{if(Array.isArray(e))return e.every(Zl);let t=Object.getPrototypeOf(e);return(t===Object.prototype||t===null)&&Object.values(e).every(Zl)}default:return!1}}const Ql={value:Hl(),default:pc()},$l={path:vc(),type:xc([`string`,`number`,`boolean`]),default:Wl()},eu={name:vc(),default:pc()},tu={path:bc(),readMode:xc([`whole`,`first-line`]),parse:ql(),cache:Ml(`file`),default:Jl()},nu={command:vc(),parse:ql(),cache:Ml(`shell`),default:Jl()},ru={template:vc(),cache:Nl(),default:pc()},iu={layout:vc(),cache:Ll(),default:pc()},au={field:Ul(),cache:Ml(`git`),default:pc()},ou={key:vc(),default:pc()},su=`kind`;function cu(e,t){return{...uc(su,e,t),parse:(n,r,i)=>{let a=ic(n,t,r,i);return a===null?null:{kind:e,...a}}}}const lu={tag:su,noun:`source kind`,memberNoun:`variable`,arms:{literal:cu(`literal`,Ql),input:cu(`input`,$l),env:cu(`env`,eu),file:cu(`file`,tu),shell:cu(`shell`,nu),template:cu(`template`,ru),time:cu(`time`,iu),git:cu(`git`,au),state:cu(`state`,ou)}};function uu(){return Tc(lu)}function du(){return{type:`object`,additionalProperties:uu()}}const fu=[`location`,`git`,`model-context`,`cost-limits`,`activity`,`session-tools`],pu=[...fu,`other`],mu={location:`location`,git:`git`,"model-context":`model & context`,"cost-limits":`cost & limits`,activity:`activity`,"session-tools":`session tools`,other:`other`};function hu(e){return e.replace(/[^A-Za-z0-9]+/g,`_`)}const gu=`groups.`,_u=`menus.`,vu=`edit.`,K=`candybar.`,yu=[gu,_u,vu,K];function bu(e){return yu.some(t=>e.startsWith(t))}function xu(e){let t=hu(e);return yu.find(e=>t.startsWith(hu(e)))}function Su(e,t,n,r){for(let i of[`variables`,`actions`,`segments`])for(let a of Object.keys(t[i]??{}))a.startsWith(n)&&e.issues.push({path:`${i}.${a}`,message:`"${a}" is in the reserved "${n}" namespace (synthesized by ${r}) — rename it`,line:U(e.source,[`root`])})}const Cu=new Map([[`gitTaculous`,`gitaculous`],[`git`,`gitaculous`],[`settings.menu`,`candybar.menu`]]);function wu(e){let t=Cu.get(e);return t===void 0?``:` (the built-in segment "${e}" was renamed to "${t}" — update this reference)`}const Tu=/^[A-Za-z_][A-Za-z0-9_]*$/,Eu={pattern:Tu.source},Du={anyOf:[{type:`boolean`},{type:`string`},{type:`integer`}]},Ou={type:`object`,additionalProperties:!1,required:[`label`,`domain`,`default`],properties:{label:{type:`string`,pattern:`^[^\\n\\r]+$`},domain:{anyOf:[{const:`bool`},{type:`array`,items:{type:`string`,pattern:`^[^/\\n\\r]+$`},minItems:1,uniqueItems:!0},{type:`object`,additionalProperties:!1,required:[`min`,`max`],properties:{min:{type:`integer`},max:{type:`integer`},step:{type:`integer`,minimum:1},atLeast:{type:`string`,...Eu}}}]},default:Du}},ku=[`label`,`domain`,`default`],Au=[`min`,`max`,`step`,`atLeast`];function ju(e,t,n){e.issues.push({path:t,message:n,line:U(e.source,t.split(`.`))})}function Mu(e,t,n){if(n===`bool`)return`bool`;if(Array.isArray(n)){let r=n.filter(e=>typeof e==`string`);if(n.length===0||r.length!==n.length)return ju(e,t,`a list domain must be a non-empty list of words, got ${JSON.stringify(n)}`);if(new Set(r).size!==r.length)return ju(e,t,`a list domain names each word once, got ${JSON.stringify(n)}`);let i=r.filter(e=>e===``||e.includes(`/`)||/[\n\r]/.test(e));return i.length>0?ju(e,t,`a list domain's words must be non-empty, slash-free, and newline-free — configure mode writes each on the set-state wire — got ${JSON.stringify(i)}`):r}if(nc(n)){let{min:r,max:i,step:a=1,atLeast:o}=n;return Object.keys(n).filter(e=>!Au.includes(e)).length===0&&Number.isInteger(r)&&Number.isInteger(i)&&r<=i&&Number.isInteger(a)&&a>=1&&(o===void 0||typeof o==`string`)?{min:r,max:i,step:a,...o!==void 0&&{atLeast:o}}:ju(e,t,`a range domain is { min, max, step?, atLeast? } with integers min ≤ max, a whole step ≥ 1, and atLeast naming another range setting, got ${JSON.stringify(n)}`)}return ju(e,t,`domain must be "bool", a list of words, or { min, max }, got ${G(n)}`)}function Nu(e,t,n){if(!nc(n))return ju(e,t,`${t} must be { label, domain, default }, got ${W(n)}`);for(let r of Object.keys(n))ku.includes(r)||ju(e,`${t}.${r}`,`Unknown setting key "${r}". Expected one of: ${ku.join(`, `)}`);let{label:r}=n,i=typeof r==`string`&&r.length>0&&!/[\n\r]/.test(r);i||ju(e,`${t}.label`,`a setting needs a one-line, non-empty "label" — the name its control shows, spliced into a synthesized template string — got ${G(r)}`);let a=Mu(e,`${t}.domain`,n.domain);if(!i||a===void 0)return;let o={label:r,domain:a,default:n.default};return!Pu(n.default)||!Gs(o,n.default)?ju(e,`${t}.default`,`default must be ${Js(o)}, got ${G(n.default)}`):o}function Pu(e){return typeof e==`boolean`||typeof e==`string`||typeof e==`number`}function Fu(){return{required:!1,json:{type:`object`,propertyNames:{...Eu,not:{const:Vs}},additionalProperties:Ou},parse:(e,t,n,r)=>{let i=r[n];if(i===void 0)return;let a=`${t}.${n}`;if(!nc(i))return ju(e,a,`${a} must be an object of name → { label, domain, default }, got ${W(i)}`);let o=Object.create(null);for(let[t,n]of Object.entries(i)){if(!Tu.test(t)){ju(e,`${a}.${t}`,`setting name "${t}" is read as .settings.${t} in a template, so it must be an identifier (letters, digits, _; not starting with a digit)`);continue}if(t===`theme`){ju(e,`${a}.${t}`,`setting "${Vs}" is one every placement already has — its default for this segment is segments.<name>.palette, and a placement sets its own with settings: { ${Vs}: "<theme>" }`);continue}let r=Nu(e,`${a}.${t}`,n);r!==void 0&&(o[t]=r)}return o}}}function Iu(){return{required:!1,json:{type:`string`,minLength:1,pattern:`^[^:/]+$`},parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0)return typeof i==`string`&&i.length>0&&!/[:/]/.test(i)?i:ju(e,`${t}.${n}`,`a placement "id" must be a non-empty string without "/" or ":", got ${G(i)}`)}}}function Lu(){return{required:!1,json:{type:`object`,propertyNames:Eu,additionalProperties:Du},parse:(e,t,n,r)=>{let i=r[n];if(i===void 0)return;let a=`${t}.${n}`;if(!nc(i))return ju(e,a,`a placement's "settings" must be an object of setting name → value, got ${W(i)}`);let o=Object.create(null);for(let[t,n]of Object.entries(i))Pu(n)?o[t]=n:ju(e,`${a}.${t}`,`setting "${t}" must be a boolean, a word, or a number, got ${W(n)}`);return o}}}function Ru(e){return new Set(Object.keys(e.segments).filter(e=>!bu(e)))}function zu(e,t,n){if(t===void 0)return{};if(!nc(t))return e.issues.push({path:`segments`,message:`segments must be an object, got ${W(t)}`,line:U(e.source,[`segments`])}),{};let r={};for(let[i,a]of Object.entries(t)){let t=rc(e,n.has(i)?Gu:Wu,`segments.${i}`,a);t!==null&&(r[i]=t)}return r}function Bu(){return{required:!0,json:{type:`string`},parse:(e,t,n,r)=>r[n]===void 0?sc(e,`${t}.${n}`,`${t} declares no template — only a segment the bundled default declares may omit it (inheriting the bundled template); a segment of your own needs its own${wu(t.slice(9))}`)??void 0:Zs(e,t,r,n)??void 0}}function Vu(){return{required:!1,json:{anyOf:[{const:`auto`},{const:`fill`},{type:`integer`,minimum:1}]},parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0){if(i===`auto`)return`auto`;if(i===`fill`)return`fill`;if(typeof i==`number`&&Number.isInteger(i)&&i>0)return i;e.issues.push({path:`${t}.${n}`,message:`width must be "auto", "fill", or a positive integer, got ${G(i)}`,line:U(e.source,[...t.split(`.`),n])})}}}}function Hu(){return{required:!1,json:du(),parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0)return Vl(e,`${t}.${n}`,i)}}}const Uu={template:Bu(),description:pc(),group:xc(fu),width:Vu(),justify:xc(Ys),truncate:xc(Xs),bg:pc(),fg:pc(),when:pc(),palette:_c(),vars:Hu(),settings:Fu()},Wu={noun:`segment key`,fields:Uu},Gu={noun:`segment key`,fields:{...Uu,template:pc()}},Ku=`#/definitions/LayoutNode`,qu={kind:`container`,direction:`vertical`,children:[]};function Ju(e){return{required:!0,json:{const:e},parse:()=>e}}function Yu(){return{required:!0,json:{type:`string`},parse:(e,t,n,r)=>{let i=r[n];return typeof i==`string`&&i.length>0?i:(e.issues.push({path:`${t}.${n}`,message:`a segment node must have a non-empty "name" (a segment name), got ${G(i)}`,line:U(e.source,[`root`])}),``)}}}function Xu(){return{required:!0,json:{enum:[...Ts]},parse:(e,t,n,r)=>{let i=r[n];return typeof i==`string`&&Ts.includes(i)?i:(e.issues.push({path:`${t}.${n}`,message:`a container "direction" must be one of: ${Ts.join(`, `)} (got ${JSON.stringify(i)})`,line:U(e.source,[`root`])}),`vertical`)}}}function Zu(e){return{required:!0,json:{type:`array`,items:{$ref:Ku}},parse:(t,n,r,i)=>{let a=i[r];return Array.isArray(a)?a.map((i,a)=>e(t,`${n}.${r}[${a}]`,i)):(t.issues.push({path:`${n}.${r}`,message:`a container must have a "children" array of layout nodes, got ${W(a)}`,line:U(t.source,[`root`])}),[])}}}const Qu={noun:`layout-node key`,fields:{kind:Ju(`segment`),name:Yu(),when:pc(),id:Iu(),settings:Lu()}},$u=()=>xc(ua),ed={noun:`layout-node key`,fields:{kind:Ju(`container`),direction:Xu(),children:Zu(dc(()=>ad)),when:pc(),distribution:$u()}};function td(){return{required:!0,json:{type:`string`},parse:(e,t,n,r)=>{let i=r[n];return typeof i==`string`&&i.length>0?i:(e.issues.push({path:`${t}.${n}`,message:`a "seg" node must have a non-empty segment name, got ${G(i)}`,line:U(e.source,[`root`])}),``)}}}const nd={noun:`layout-node key`,fields:{seg:td(),when:pc(),id:Iu(),settings:Lu()}},rd={noun:`layout-node key`,fields:{h:Zu(dc(()=>ad)),when:pc(),distribution:$u()}},id={noun:`layout-node key`,fields:{v:Zu(dc(()=>ad)),when:pc(),distribution:$u()}},ad=(e,t,n)=>{if(typeof n==`string`)return n.length===0?(e.issues.push({path:t,message:`a bare-string layout node must be a non-empty segment name`,line:U(e.source,[`root`])}),qu):{kind:`segment`,name:n};if(!nc(n))return e.issues.push({path:t,message:`a layout node must be a string (segment name) or an object with "kind" / "seg" / "h" / "v", got ${W(n)}`,line:U(e.source,[`root`])}),qu;if(n.kind===`container`)return rc(e,ed,t,n)??qu;if(n.kind===`segment`)return rc(e,Qu,t,n)??qu;if(n.kind===`cells`)return e.issues.push({path:t,message:`kind: "cells" is no longer supported — use the h-arm spelling instead:
36
+ `}function Ko(e,t,n){return e.split(`
37
+ `).join(`${n}${t}`)}function qo(e,t,n){let[r,...i]=e,a=i.length===0?t:`{\n ${Ko(qo(i,t,n),` `,`
38
+ `)}${n.trailingComma}\n}`;return`${n.key(r)}: ${a}`}function Jo(e,t,n,r){return e.slice(0,t)+r+e.slice(n)}function Yo(e,t){return e.lastIndexOf(`
39
+ `,t-1)+1}function Xo(e){return/^[ \t]*$/.test(e)}function Zo(e,t){let n=Yo(e,t);return/^[ \t]*/.exec(e.slice(n))[0]}function Qo(e,t){return Xo(e.slice(Yo(e,t),t))}const $o=/(?:\/\/[^\n]*?)?(\r\n|\n|$)/y;function es(e,t){let n=t;for(;n<e.length&&(e[n]===` `||e[n]===` `);)n++;let r=e[n]===`,`?n+1:-1;for(r!==-1&&(n=r);n<e.length&&(e[n]===` `||e[n]===` `);)n++;$o.lastIndex=n;let i=$o.exec(e);if(i===null)return{commaEnd:r,line:null};let a=n+i[0].length;return{commaEnd:r,line:{at:a-i[1].length,next:a}}}function ts(e,t){let{commaEnd:n,line:r}=es(e,t.end);if(Qo(e,t.start)&&r!==null)return Jo(e,Yo(e,t.start),r.next,``);if(n!==-1){let r=n;for(;r<e.length&&e[r]===` `;)r++;return Jo(e,t.start,r,``)}let i=t.start;for(;i>0&&(e[i-1]===` `||e[i-1]===` `);)i--;return e[i-1]===`,`?Jo(e,i-1,t.end,``):Jo(e,t.start,t.end,``)}function ns(e,t,n,r,i){let a=n.commaEnd!==-1,o=a?e:Jo(e,t.end,t.end,`,`),s=n.line.at+ +!a,c=Go(e);return Jo(o,s,s,`${c}${i}${Ko(r,i,c)}${a?`,`:``}`)}function rs(e,t,n,r){let i=t.kind===`object`?t.entries:t.elements,a=i[i.length-1],o=Zo(e,t.span.start);if(a===void 0){let i=o+` `,a=Go(e);return Jo(e,t.span.start+1,t.span.end-1,`${a}${i}${Ko(n,i,a)}${r.trailingComma}${a}${o}`)}let{commaEnd:s,line:c}=es(e,a.span.end);if(Qo(e,a.span.start)&&c!==null){let t=e.slice(Yo(e,a.span.start),a.span.start);return ns(e,a.span,{commaEnd:s,line:c},n,t)}let l=s===-1?a.span.end:s;return Jo(e,l,l,`${s===-1?`, `:` `}${n}${s===-1?``:`,`}`)}function is(e,t,n,r){if(t.length===0)throw new Oo(`setValue needs a non-empty path`,0);if(/^\s*$/.test(e)){let i=Go(e);return`{${i} ${Ko(qo(t,n,r),` `,i)}${r.trailingComma}${i}}${i}`}return as(e,Po(e),t,n,r)}function as(e,t,n,r,i){let a=t;for(let t=0;t<n.length;t++){if(a.kind!==`object`)throw new Oo(`cannot set ${n.join(`.`)}: ${n.slice(0,t).join(`.`)||`the document`} is not an object`,a.span.start);let o=Fo(a,n[t]);if(o===void 0)return rs(e,a,qo(n.slice(t),r,i),i);if(t===n.length-1){let t=Zo(e,o.keySpan.start);return Jo(e,o.value.span.start,o.value.span.end,Ko(r,t,Go(e)))}a=o.value}throw new Oo(`unreachable: path exhausted`,0)}function os(e,t,n=0){if(t.length===0)throw new Oo(`deleteValue needs a non-empty path`,0);if(/^\s*$/.test(e))return e;let r=t.slice(0,-1),i=Io(Po(e),r),a=i===void 0?void 0:Fo(i,t[t.length-1]);if(a===void 0||i?.kind!==`object`)return e;let o=ts(e,a.span);return r.length>n&&i.entries.length===1?os(o,r,n):o}const ss=[`h`,`v`,`children`];function cs(e){if(e.kind===`string`)return e.value;if(e.kind!==`object`)return;let t=Fo(e,`seg`)?.value,n=Fo(e,`kind`)?.value,r=Fo(e,`name`)?.value,i=t?.kind===`string`?t.value:n?.kind===`string`&&n.value===`segment`&&r?.kind===`string`?r.value:void 0;if(i===void 0)return;let a=Fo(e,`id`)?.value;return a?.kind===`string`?a.value:i}function ls(e){return e.kind===`object`?ss.map(t=>Fo(e,t)?.value).filter(e=>e?.kind===`array`):[]}function us(e){let t=Fo(e,`rows`)?.value;return t?.kind===`object`?t.entries:null}function ds(e){if(e.kind!==`object`)return!0;let t=us(e);return t===null||t.length>0||e.entries.some(e=>e.key!==`rows`)}function*fs(e,t){yield{node:e,bareAt:t};for(let t of ls(e))for(let e of t.elements)yield*fs(e,null);for(let n of us(e)??[])yield*fs(n.value,t===null?null:[...t,`rows`,n.key])}function ps(e,t){for(let{node:n}of fs(e,null))if(cs(n)===t)return!0;return!1}function ms(e,t,n){let r=Io(Po(e),t);if(r===void 0)return null;for(let{node:i,bareAt:a}of fs(r,t))if(cs(i)===n)return a===null?{text:e,ref:i}:ms(is(e,a,`{ h: [${Lo(e,i)}] }`,Ho),t,n);return null}function hs(e,t,n){let r=ms(e,t,n);return r===null?null:ts(r.text,r.ref.span)}function gs(e,t,n,r,i){let a=ms(e,t,r);if(a===null)return null;let{text:o,ref:s}=a,c=n.id===void 0?JSON.stringify(n.seg):`{ seg: ${JSON.stringify(n.seg)}, id: ${JSON.stringify(n.id)} }`,{commaEnd:l,line:u}=es(o,s.span.end);if(Qo(o,s.span.start)&&u!==null){let e=o.slice(Yo(o,s.span.start),s.span.start);return i===`after`?ns(o,s.span,{commaEnd:l,line:u},c,e):Jo(o,s.span.start,s.span.start,`${c},${Go(o)}${e}`)}let d=Lo(o,s),f=i===`before`?`${c}, ${d}`:`${d}, ${c}`;return Jo(o,s.span.start,s.span.end,f)}function _s(e,t,n,r,i){let a=ms(e,t,n);if(a===null)return null;let{text:o,ref:s}=a,c=`{ ${Vo(r)}: ${i} }`;return s.kind===`string`?Jo(o,s.span.start,s.span.end,`{ seg: ${JSON.stringify(s.value)}, settings: ${c} }`):Fo(s,`settings`)===void 0?as(o,s,[`settings`],c,Ho):as(o,s,[`settings`,r],i,Ho)}var vs=class extends Error{file;issues;warnings;constructor(e,t,n=[]){super(Ss(e,t)),this.name=`ConfigError`,this.file=e,this.issues=t,this.warnings=n}};function G(e,t){let n=0,r;for(let i of t){if(i===``||/^\d+$/.test(i))continue;let t=ys(e,n,i);if(t===-1)return r===void 0?void 0:bs(e,r);n=t,r=t}return r===void 0?void 0:bs(e,r)}function ys(e,t,n){let r=n.replace(/[\\^$.*+?()[\]{}|]/g,`\\$&`),i=RegExp(`(?:["']${r}["']|\\b${r}\\b)\\s*:`,`g`);i.lastIndex=t;let a=i.exec(e);return a?a.index:-1}function bs(e,t){let n=1;for(let r=0;r<t&&r<e.length;r++)e.charCodeAt(r)===10&&n++;return n}function xs(e,t){try{return Po(t),null}catch(n){if(!(n instanceof Oo))throw n;return`${e}:${bs(t,n.offset)}: ${n.reason} — the settings menu cannot edit this file until it is fixed`}}function Ss(e,t){if(t.length===0)return`${e}: invalid config (no details)`;let n=[`Invalid config in ${e} (${t.length} issue${t.length===1?``:`s`}):`];for(let e of t){let t=[];e.line!==void 0&&t.push(`line ${e.line}${e.col===void 0?``:`:${e.col}`}`),e.path&&t.push(e.path);let r=t.length>0?`[${t.join(` • `)}] `:``;n.push(` ${r}${e.message}`)}return n.join(`
40
+ `)}const Cs=[`vertical`,`horizontal`],ws={vertical:`row`,horizontal:`cell`};function Ts(e){return e.id??e.name}function Es(e){return[...ks(e)].flatMap(e=>e.kind===`segment`?[Ts(e)]:[])}function Ds(e,t){if(!t.has(e))return e;let n=2;for(;t.has(`${e}-${n}`);)n++;return`${e}-${n}`}function Os(e,t){return e.opens===void 0?e:{...e,opens:{...e.opens,body:t(e.opens.body)}}}function*ks(e){yield e;for(let t of Ns(e))yield*ks(t)}const As=(e,t)=>`${e}.children[${t}]`,js=e=>`${e}.opens.body`;function*Ms(e,t){if(yield[e,t],e.kind===`container`)for(let[n,r]of e.children.entries())yield*Ms(r,As(t,n));else e.opens!==void 0&&(yield*Ms(e.opens.body,js(t)))}function Ns(e){return e.kind===`container`?e.children:e.opens===void 0?[]:[e.opens.body]}function Ps(e){return e===void 0||`text`in e?`text`:`regex`in e?`regex`:`json`}const Fs=[`ttl`,`watch_file`,`depends_on`,`key`,`never`];function Is(e){return e.kind!==`literal`&&e.kind!==`input`&&e.kind!==`env`&&e.kind!==`state`}const Ls=[`branch`,`sha`,`dirty`,`ahead`,`behind`,`stash`],Rs=[`file`,`shell`,`git`],zs=`theme`;function Bs(e){return{...e.settings,[zs]:{label:zs,domain:`theme`,default:e.palette??`bar`}}}function Vs(e){let t=e?.domain;return typeof t==`object`&&`min`in t?t:void 0}function Hs(e,t){return Object.entries(e).flatMap(([n,r])=>{let i=Vs(r)?.atLeast;if(i===void 0)return[];let a=t[n],o=t[i];return a>=o?[]:[{setting:n,message:`"${n}" (${a}) is below "${i}" (${o}) — ${r.label} must be at least ${e[i].label}`}]})}function Us(e,t){let{domain:n}=e;return n===`bool`?typeof t==`boolean`:n===`theme`?typeof t==`string`&&Qa(t):`min`in n?typeof t==`number`&&Number.isInteger(t)&&t>=n.min&&t<=n.max:typeof t==`string`&&n.includes(t)}function Ws(e){return String(e)}function Gs(e,t){let{domain:n}=e,r=n===`bool`?t===`true`?!0:t===`false`?!1:t:typeof n==`object`&&`min`in n&&/^-?\d+$/.test(t)?Number(t):t;return Us(e,r)?r:void 0}function Ks(e){let{domain:t}=e;return t===`bool`?`true or false`:t===`theme`?`"bar" (the bar's own theme) or an installed theme name`:`min`in t?`an integer from ${t.min} to ${t.max}`:`one of ${t.map(e=>JSON.stringify(e)).join(`, `)}`}const qs=[`left`,`center`,`right`],Js=[`right`,`left`,`middle`];function Ys(e,t,n,r){let i=n[r];return typeof i==`string`?i:(e.issues.push({path:`${t}.${r}`,message:`${t}.${r} must be a string, got ${tc(i)}`,line:G(e.source,[...t.split(`.`),r])}),null)}function Xs(e,t,n,r){let i=n.default;if(i!==void 0){if(!(r===`string`&&typeof i==`string`||r===`number`&&typeof i==`number`||r===`boolean`&&typeof i==`boolean`)){e.issues.push({path:`${t}.default`,message:`default must be a ${r}, got ${tc(i)}`,line:G(e.source,[...t.split(`.`),`default`])});return}return i}}function Zs(e,t,n,r){let i=n[r];if(i!==void 0){if(typeof i!=`string`){e.issues.push({path:`${t}.${r}`,message:`${t}.${r} must be a string, got ${tc(i)}`,line:G(e.source,[...t.split(`.`),r])});return}return i}}function Qs(e,t,n){let r=Zs(e,t,n,`palette`);if(r!==void 0){if(!e.allowedPalettes.has(r)){e.issues.push({path:`${t}.palette`,message:`Unknown palette "${r}"${Ka(r)}. Expected one of: ${[...e.allowedPalettes].sort().join(`, `)}`,line:G(e.source,[...t.split(`.`),`palette`])});return}return r}}function $s(e,t,n,r,i){let a=n[r];if(a!==void 0){if(typeof a!=`string`||!i.includes(a)){e.issues.push({path:`${t}.${r}`,message:`${t}.${r} must be one of: ${i.join(`, `)}; got ${K(a)}`,line:G(e.source,[...t.split(`.`),r])});return}return a}}function ec(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function tc(e){return e===null?`null`:Array.isArray(e)?`array`:typeof e}function K(e){return typeof e==`string`?JSON.stringify(e):e===void 0?`undefined`:String(e)}function nc(e,t,n,r){if(!ec(r))return e.issues.push({path:n,message:`${n} must be an object, got ${tc(r)}`,line:G(e.source,n.split(`.`))}),null;let i=Object.entries(t.removed??{}).filter(([e])=>r[e]!==void 0);for(let[t,r]of i)oc(e,`${n}.${t}`,`${n}.${t} was removed: ${r}`);return ac(e,n,r,t.noun,new Set(Object.keys(t.fields)),new Set(i.map(([e])=>`${n}.${e}`))),rc(e,t.fields,n,r)}function rc(e,t,n,r){let i=t,a={},o=!0;for(let[t,s]of Object.entries(i)){let i=s.parse(e,n,t,r);i===void 0?s.required&&(o=!1):a[t]=i}return o?a:null}const ic=new Set;function ac(e,t,n,r,i,a=ic){for(let o of Object.keys(n))!i.has(o)&&!a.has(`${t}.${o}`)&&e.issues.push({path:`${t}.${o}`,message:`Unknown ${r} "${o}". Expected one of: ${[...i].join(`, `)}`,line:G(e.source,[...t.split(`.`),o])})}function oc(e,t,n){return e.issues.push({path:t,message:n,line:G(e.source,t.split(`.`))}),null}function sc(e,t,n,r){if(!ec(r))return e.issues.push({path:n,message:`${t.noun} must be an object, got ${tc(r)}`,line:G(e.source,n.split(`.`))}),null;let i=t.arms,a=Object.keys(i),o=Object.keys(r).filter(e=>e in i),s=Object.keys(r).filter(e=>!(e in i));for(let r of s)e.issues.push({path:`${n}.${r}`,message:`Unknown ${t.noun} key "${r}". Expected exactly one of: ${a.join(`, `)}`,line:G(e.source,[...n.split(`.`),r])});if(o.length===0)return e.issues.push({path:n,message:`${t.noun} must declare exactly one of: ${a.join(`, `)}`,line:G(e.source,n.split(`.`))}),null;if(o.length>1)return e.issues.push({path:n,message:`${t.noun} must declare exactly one of: ${a.join(`, `)} (found: ${o.join(`, `)})`,line:G(e.source,n.split(`.`))}),null;let c=o[0];return i[c].parse(e,`${n}.${c}`,r[c])}function cc(e,t,n,r){if(!ec(r))return e.issues.push({path:n,message:`${n} must be an object, got ${tc(r)}`,line:G(e.source,n.split(`.`))}),null;let i=r[t.tag];if(typeof i!=`string`)return e.issues.push({path:`${n}.${t.tag}`,message:`${n}.${t.tag} must be a string, got ${tc(i)}`,line:G(e.source,n.split(`.`))}),null;let a=t.arms;if(!(i in a))return e.issues.push({path:`${n}.${t.tag}`,message:`Unknown ${t.noun} "${i}". Expected one of: ${Object.keys(a).join(`, `)}`,line:G(e.source,[...n.split(`.`),t.tag])}),null;let o=a[i],s=e.issues.length,c=o.parse(e,n,r),l=new Set(e.issues.slice(s).map(e=>e.path));return ac(e,n,r,`${i} ${t.memberNoun} key`,o.keys,l),c}function lc(e,t,n){return{json:Cc(xc(n),e,t),keys:new Set([e,...Object.keys(n)])}}function uc(e){return(...t)=>e()(...t)}function dc(e,...t){return(n,r,i)=>{let a=e(n,r,i);if(a===null)return null;for(let e of t){if(e.ok(a))continue;let{field:t,message:i}=e.issue(a),o=t===``?r:`${r}.${t}`;return n.issues.push({path:o,message:i,line:G(n.source,o.split(`.`))}),null}return a}}function fc(){return{required:!1,json:{type:`string`},parse:(e,t,n,r)=>Zs(e,t,r,n)}}function pc(){return{required:!1,json:{type:`boolean`},parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0){if(typeof i!=`boolean`){e.issues.push({path:`${t}.${n}`,message:`${n} must be a boolean, got ${tc(i)}`,line:G(e.source,[n])});return}return i}}}}function mc(e){let{min:t,max:n}=e;return{required:!1,json:{type:`integer`,minimum:t,maximum:n},parse:(e,r,i,a)=>{let o=a[i];if(o!==void 0){if(typeof o!=`number`||!Number.isInteger(o)||o<t||o>n){e.issues.push({path:`${r}.${i}`,message:`${i} must be an integer between ${t} and ${n}, got ${K(o)}`,line:G(e.source,[i])});return}return o}}}}function hc(e={}){let{min:t}=e;return{required:!1,json:{type:`number`,...t!==void 0&&{minimum:t}},parse:(e,n,r,i)=>{let a=i[r];if(a!==void 0){if(typeof a!=`number`||!Number.isFinite(a)||t!==void 0&&a<t){let i=t===void 0?`a finite number`:`a finite number >= ${t}`;e.issues.push({path:`${n}.${r}`,message:`${r} must be ${i}, got ${K(a)}`,line:G(e.source,[r])});return}return a}}}}function gc(){return{required:!1,json:{type:`string`},parse:(e,t,n,r)=>Qs(e,t,r)}}function _c(){return{required:!0,json:{type:`string`},parse:(e,t,n,r)=>Ys(e,t,r,n)??void 0}}function vc(e,t){return d(t)?null:`${e} must be an absolute path (\`~\` and relative paths are not expanded), got ${JSON.stringify(t)}`}function yc(){return{required:!0,json:{type:`string`,pattern:`^/`},parse:(e,t,n,r)=>{let i=Ys(e,t,r,n);if(i===null)return;let a=vc(`${t}.${n}`,i);return a===null?i:oc(e,`${t}.${n}`,a)??void 0}}}function bc(e){return{required:!1,json:{enum:[...e]},parse:(t,n,r,i)=>$s(t,n,i,r,e)}}function xc(e,t={closed:!0}){let n=e,r={},i=[];for(let[e,t]of Object.entries(n))r[e]=t.json,t.required&&i.push(e);return{type:`object`,properties:r,...i.length>0&&{required:i},...t.closed&&{additionalProperties:!1}}}function Sc(e){return xc(e.fields)}function Cc(e,t,n){let r=e,i={[t]:{const:n},...r.properties},a=[t,...r.required??[]];return{...r,properties:i,required:a}}function wc(e){let t=e.arms;return{anyOf:Object.values(t).map(e=>e.json)}}function Tc(e){let t=e.arms;return{anyOf:Object.entries(t).map(([e,t])=>({type:`object`,properties:{[e]:t.json},required:[e],additionalProperties:!1}))}}const Ec=/^[A-Za-z_][A-Za-z0-9_]*$/;function Dc(e){return`#${e+1}`}const Oc={rows:{}};function kc(e){return`rows`in e}function Ac(e){return Object.fromEntries(e.map((e,t)=>[Dc(t),e]))}function jc(e){if(e.kind===`container`&&e.direction===`vertical`){let{kind:t,direction:n,children:r,...i}=e;return{...i,rows:Ac(r)}}let{when:t,...n}=e;return{...t!==void 0&&{when:t},rows:Ac([n])}}function Mc(e){let{rows:t,...n}=e;return{kind:`container`,direction:`vertical`,children:Object.values(t),...n}}function Nc(e){return kc(e)?Mc(e):e}function*Pc(e,t){if(!kc(e)){yield*Ms(e,t);return}yield[Mc(e),t];for(let[n,r]of Object.entries(e.rows))yield*Ms(r,`${t}.rows.${n}`)}function Fc(e,t){return kc(e)?{...t,...e,rows:{...t.rows,...e.rows}}:jc(e)}function Ic(e){if(!kc(e))return!0;let{rows:t,...n}=e;return Object.values(n).some(e=>e!==void 0)||Object.keys(t).length>0}function Lc(e,t){return{globals:{...t.globals,...e.globals??{}},variables:{...t.variables,...e.variables??{}},segments:Bc(t.segments,Rc(t.segments,e.segments??{})),root:Fc(e.root??Oc,t.root),actions:{...t.actions,...e.actions??{}},styles:{...t.styles,...e.styles??{}},presets:Bc(t.presets,zc(t.presets,e.presets??{})),editGlobals:{...t.editGlobals,...e.editGlobals??{}},helpers:{...t.helpers,...e.helpers??{}}}}function Rc(e,t){return Object.fromEntries(Object.entries(t).map(([t,n])=>[t,n.settings===void 0?n:{...n,settings:{...e[t]?.settings,...n.settings}}]))}function zc(e,t){return Object.fromEntries(Object.entries(t).map(([t,n])=>[t,n.globals===void 0?n:{...n,globals:{...e[t]?.globals,...n.globals}}]))}function Bc(e,t){return{...e,...Object.fromEntries(Object.entries(t).map(([t,n])=>[t,{...e[t],...n}]))}}const Vc=`closed`,Hc=`🍫`;function Uc(e,t,n){if(t===0)return`${e} needs a display (the clickable text)`;if(t!==1&&t!==n)return`${e} cycles ${n} members; bind one display per member (${n}) or one static display, got ${t}`}function Wc(e,t,n,r){let i=Uc(e,t.length,n);if(i!==void 0)throw Error(i);return t.length===1?t[0]:t[r]}function Gc(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}function Kc(e,t,n,r,i){return{kind:`segment`,name:e,opens:{ref:t,body:n,placement:r},...i!==void 0&&{when:i}}}function qc(e,...t){return`{{ and ${[e,...t].map(Jc).join(` `)} }}`}function Jc(e){return`(eq .${e.variable} "${Gc(e.member)}")`}function Yc(e,t,n){return`{{ ${Xc(e,Zc(t),Zc(n))} }}`}function Xc(e,t,n){return`action "${e}" ${t} ${n}`}function Zc(e){return`"${Gc(e)}"`}function Qc(e,t){return{kind:`state`,key:e,default:t}}function $c(e,t){return{set:e,cycle:[Vc,t]}}const el={required:!1,json:{enum:[...mo]},parse:(e,t,n,r)=>{if(r[n]===`auto`){e.issues.push({path:`${t}.${n}`,message:`${t}.${n}: "auto" is not supported — the render daemon runs detached, so terminal detection would read the daemon's environment, not your terminal's. Pick an explicit depth: ${mo.join(`, `)}`,line:G(e.source,[...t.split(`.`),n])});return}return $s(e,t,r,n,mo)}},tl={required:!1,json:{type:`string`},parse:(e,t,n,r)=>{let i=Zs(e,t,r,n);return to(i)?i:Qs(e,t,r)}},nl=/^[^\r\n]*\S[^\r\n]*$/u,rl=RegExp(`^(?:✖|✕)[\\uFE0E\\uFE0F]?$`,`u`),il={required:!1,json:{type:`string`,pattern:nl.source,not:{pattern:rl.source}},parse:(e,t,n,r)=>{let i=Zs(e,t,r,n);if(i===void 0||nl.test(i)&&!rl.test(i))return i;e.issues.push({path:`${t}.${n}`,message:`${t}.${n}: must be one line of visible text other than a close glyph ("✖", "✕") — the settings menu needs a glyph to click`,line:G(e.source,[...t.split(`.`),n])})}};function al(e){return{spec:bc(e),domain:{from:e}}}function ol(){return{spec:pc(),domain:`bool`}}function sl(e){return{spec:e,domain:`text`}}const cl={default_empty_value:sl(fc()),default_separator:sl(fc()),palette:{spec:tl,domain:{from:`themes`}},style:{spec:fc(),domain:{from:`styles`}},preset:{spec:fc(),domain:{from:`presets`}},endcaps:al(co),variation:al(go),autoWrap:ol(),padding:{spec:mc(So),domain:{...So,step:1}},charset:al(fo),updateNotice:ol(),colorCompatibility:{spec:el,domain:{from:mo}},menuGlyph:sl(il)},ll=Object.fromEntries(Object.entries(cl).map(([e,t])=>[e,t.spec]));function ul(e){return cl[e].domain}function dl(e,t){return{required:!1,json:{not:{},description:`not allowed here — ${e}`},parse:(e,n,r,i)=>{i[r]!==void 0&&e.issues.push({path:`${n}.${r}`,message:t(`${n}.${r}`),line:G(e.source,[...n.split(`.`),r])})}}}function fl(e){return dl(`${e} cannot select a preset`,t=>`${t}: ${e} cannot select a preset. Which preset is active is resolved once, as session pick over globals.preset over "default"; a fragment naming another would be a second authority over that. Set the default arrangement in the top-level globals.preset instead.`)}function pl(e){return dl(`${e} cannot change the settings menu glyph`,t=>`${t}: ${e} cannot change the settings menu glyph — one menu is shared by every preset. Set it in the top-level globals.menuGlyph instead.`)}function ml(e,t){return{...e,json:{...e.json,not:{pattern:`\\{\\{`}},parse:(n,r,i,a)=>{let o=a[i];if(typeof o==`string`&&to(o)){n.issues.push({path:`${r}.${i}`,message:`${r}.${i}: a rule is not allowed here — ${t} is decided later than any rule could be settled, so it names a value. Write the rule in globals.${i} (or a preset's globals.${i}) instead.`,line:G(n.source,[...r.split(`.`),i])});return}return e.parse(n,r,i,a)}}}const hl={default_bg:"nothing reads it — a segment with no `bg:` wears the decoration tint of its place in the bar. Delete the key, and author `bg:` on the segments that need a fixed colour.",default_fg:"nothing reads it — a segment with no `fg:` wears text chosen for contrast against its background. Delete the key, and author `fg:` on the segments that need a fixed colour.",default_truncate_marker:'nothing reads it — a segment clipped to its `width:` always ends in "…". Delete the key.',look:`it was renamed "style" — write the same name as style: "<name>"`,progression:`it was renamed "variation", and its values with it: accent (was secondary-accent), duo (was primary-secondary), mono (was primary)`},gl={noun:`globals key`,fields:ll,removed:hl},_l={preset:fl(`a preset`),menuGlyph:pl(`a preset`)},vl={noun:`preset globals key`,fields:{...ll,..._l},removed:hl};function yl(e){return El(e)&&!(e in _l)}const bl={noun:`editGlobals key`,removed:hl,fields:{...ll,preset:fl(`the editGlobals fragment`),menuGlyph:pl(`the editGlobals fragment`),palette:ml(ll.palette,`the editGlobals fragment`),style:ml(ll.style,`the editGlobals fragment`)}};function xl(e,t,n){return n===void 0?{}:nc(e,gl,t,n)??{}}function Sl(e,t,n){return nc(e,vl,t,n)??{}}function Cl(){return Sc(vl)}function wl(e,t,n){return nc(e,bl,t,n)??{}}const Tl=new Set(Object.keys(ll));function El(e){return Tl.has(e)}function Dl(){return[...Tl]}const Ol={padding:1};function kl(e){let t=new Map;for(let[n,r]of Object.entries(Ol)){let i=e[n];t.set(n,typeof i==`number`?i:r)}return t}function Al(e,t,n,r){return n.cache===void 0?(Rs.includes(r)&&e.issues.push({path:`${t}.cache`,message:`${r} variables must declare a cache policy (one of: ${Fs.join(`, `)})`,line:G(e.source,t.split(`.`))}),null):Fl(e,`${t}.cache`,n.cache)}function jl(e,t,n){if(n.cache!==void 0)return Fl(e,`${t}.cache`,n.cache)??void 0}function Ml(e){return{required:!0,json:Rl(),parse:(t,n,r,i)=>Al(t,n,i,e)??void 0}}function Nl(){return{required:!1,json:Rl(),parse:(e,t,n,r)=>jl(e,t,r)}}const Pl={noun:`cache`,arms:{ttl:{json:{type:`string`},parse:(e,t,n)=>typeof n==`string`&&Bl(n)?{ttl:n}:oc(e,t,`cache.ttl must be a duration string like "5s", "100ms", "2m", "1h"; got ${K(n)}`)},watch_file:{json:{type:`string`,pattern:`^/`},parse:(e,t,n)=>{if(typeof n!=`string`)return oc(e,t,`cache.watch_file must be a path string, got ${K(n)}`);let r=vc(`cache.watch_file`,n);return r===null?{watch_file:n}:oc(e,t,r)}},depends_on:{json:{type:`array`,items:{type:`string`}},parse:(e,t,n)=>Array.isArray(n)&&n.every(e=>typeof e==`string`)?{depends_on:n}:oc(e,t,`cache.depends_on must be an array of variable-name strings, got ${K(n)}`)},key:{json:{type:`string`},parse:(e,t,n)=>typeof n==`string`&&n!==``?{key:n}:oc(e,t,`cache.key must be a non-empty template string, got ${K(n)}`)},never:{json:{const:!0},parse:(e,t,n)=>n===!0?{never:!0}:oc(e,t,`cache.never must be the literal boolean true, got ${K(n)}`)}}};function Fl(e,t,n){return sc(e,Pl,t,n)}const Il={noun:`time-variable cache`,arms:{ttl:Pl.arms.ttl}};function Ll(){return{required:!1,json:Tc(Il),parse:(e,t,n,r)=>r.cache===void 0?void 0:sc(e,Il,`${t}.cache`,r.cache)??void 0}}function Rl(){return Tc(Pl)}const zl=/^(\d+(?:\.\d+)?)(ms|s|m|h)$/;function Bl(e){return zl.test(e)}function Vl(e,t,n){if(n===void 0)return{};if(!ec(n))return e.issues.push({path:t,message:`${t} must be an object, got ${tc(n)}`,line:G(e.source,t.split(`.`))}),{};let r={};for(let[i,a]of Object.entries(n)){let n=cc(e,lu,`${t}.${i}`,a);n!==null&&(r[i]=n)}return r}function Hl(){return{required:!0,json:{type:[`string`,`number`,`boolean`]},parse:(e,t,n,r)=>{let i=r.value;if(typeof i!=`string`&&typeof i!=`number`&&typeof i!=`boolean`){e.issues.push({path:`${t}.value`,message:`literal value must be string|number|boolean, got ${tc(i)}`,line:G(e.source,t.split(`.`))});return}return i}}}function Ul(){return{required:!0,json:{enum:[...Ls]},parse:(e,t,n,r)=>{let i=r.field;if(typeof i!=`string`||!Ls.includes(i)){e.issues.push({path:`${t}.field`,message:`git field must be one of: ${Ls.join(`, `)}, got ${JSON.stringify(i)}`,line:G(e.source,[...t.split(`.`),`field`])});return}return i}}}function Wl(){return{required:!1,json:{type:[`string`,`number`,`boolean`]},parse:(e,t,n,r)=>{let i=r.type;return Xs(e,t,r,i===`number`||i===`boolean`||i===`string`?i:`string`)}}}const Gl={noun:`parse`,arms:{text:{json:{const:!0},parse:(e,t,n)=>n===!0?{text:!0}:oc(e,t,`parse.text must be the literal boolean true, got ${K(n)}`)},regex:{json:{type:`string`},parse:(e,t,n)=>typeof n==`string`?Kl(e,t,n):oc(e,t,`parse.regex must be a pattern string, got ${K(n)}`)},json:{json:{const:!0},parse:(e,t,n)=>n===!0?{json:!0}:oc(e,t,`parse.json must be the literal boolean true, got ${K(n)}`)}}};function Kl(e,t,n){let r;try{new RegExp(n),r=RegExp(`${n}|`).exec(``).length-1}catch(n){return oc(e,t,`parse.regex is not a valid regular expression: ${n.message}`)}return r>=1?{regex:n}:oc(e,t,`parse.regex must contain a capture group — its group 1 is the value; got ${JSON.stringify(n)}`)}function ql(){return{required:!1,json:Tc(Gl),parse:(e,t,n,r)=>(r.regex!==void 0&&e.issues.push({path:`${t}.regex`,message:`${t}.regex was retired; the regex is the parse step's regex arm now: parse: { regex: ${JSON.stringify(r.regex)} }`,line:G(e.source,[...t.split(`.`),`regex`])}),r.parse===void 0?void 0:sc(e,Gl,`${t}.parse`,r.parse)??void 0)}}function Jl(){return{required:!1,json:{type:[`string`,`number`,`boolean`,`array`,`object`],description:`The value published when the source fails: a string under the text/regex parse arms, any non-null JSON value under the json arm`},parse:(e,t,n,r)=>ec(r.parse)&&`json`in r.parse?Yl(e,t,r.default):Zs(e,t,r,`default`)}}function Yl(e,t,n){if(n!==void 0)return Xl(n)?n:oc(e,`${t}.default`,`${t}.default must be a JSON value (a json-parsed source's document), got ${K(n)}`)??void 0}function Xl(e){return e!==null&&Zl(e)}function Zl(e){if(e===null)return!0;switch(typeof e){case`string`:case`boolean`:return!0;case`number`:return Number.isFinite(e);case`object`:{if(Array.isArray(e))return e.every(Zl);let t=Object.getPrototypeOf(e);return(t===Object.prototype||t===null)&&Object.values(e).every(Zl)}default:return!1}}const Ql={value:Hl(),default:fc()},$l={path:_c(),type:bc([`string`,`number`,`boolean`]),default:Wl()},eu={name:_c(),default:fc()},tu={path:yc(),readMode:bc([`whole`,`first-line`]),parse:ql(),cache:Ml(`file`),default:Jl()},nu={command:_c(),parse:ql(),cache:Ml(`shell`),default:Jl()},ru={template:_c(),cache:Nl(),default:fc()},iu={layout:_c(),cache:Ll(),default:fc()},au={field:Ul(),cache:Ml(`git`),default:fc()},ou={key:_c(),default:fc()},su=`kind`;function cu(e,t){return{...lc(su,e,t),parse:(n,r,i)=>{let a=rc(n,t,r,i);return a===null?null:{kind:e,...a}}}}const lu={tag:su,noun:`source kind`,memberNoun:`variable`,arms:{literal:cu(`literal`,Ql),input:cu(`input`,$l),env:cu(`env`,eu),file:cu(`file`,tu),shell:cu(`shell`,nu),template:cu(`template`,ru),time:cu(`time`,iu),git:cu(`git`,au),state:cu(`state`,ou)}};function uu(){return wc(lu)}function du(){return{type:`object`,additionalProperties:uu()}}const fu=[`location`,`git`,`model-context`,`cost-limits`,`activity`,`session-tools`],pu=[...fu,`other`],mu={location:`location`,git:`git`,"model-context":`model & context`,"cost-limits":`cost & limits`,activity:`activity`,"session-tools":`session tools`,other:`other`};function hu(e){return e.replace(/[^A-Za-z0-9]+/g,`_`)}const gu=`groups.`,_u=`menus.`,vu=`edit.`,yu=`candybar.`,bu=[gu,_u,vu,yu];function xu(e){return bu.some(t=>e.startsWith(t))}function Su(e){let t=hu(e);return bu.find(e=>t.startsWith(hu(e)))}function Cu(e,t,n,r){for(let i of[`variables`,`actions`,`segments`])for(let a of Object.keys(t[i]??{}))a.startsWith(n)&&e.issues.push({path:`${i}.${a}`,message:`"${a}" is in the reserved "${n}" namespace (synthesized by ${r}) — rename it`,line:G(e.source,[`root`])})}const wu=new Map([[`gitTaculous`,`gitaculous`],[`git`,`gitaculous`],[`settings.menu`,`candybar.menu`]]);function Tu(e){let t=wu.get(e);return t===void 0?``:` (the built-in segment "${e}" was renamed to "${t}" — update this reference)`}const Eu=/^[A-Za-z_][A-Za-z0-9_]*$/,Du={pattern:Eu.source},Ou={anyOf:[{type:`boolean`},{type:`string`},{type:`integer`}]},ku={type:`object`,additionalProperties:!1,required:[`label`,`domain`,`default`],properties:{label:{type:`string`,pattern:`^[^\\n\\r]+$`},domain:{anyOf:[{const:`bool`},{type:`array`,items:{type:`string`,pattern:`^[^/\\n\\r]+$`},minItems:1,uniqueItems:!0},{type:`object`,additionalProperties:!1,required:[`min`,`max`],properties:{min:{type:`integer`},max:{type:`integer`},step:{type:`integer`,minimum:1},atLeast:{type:`string`,...Du}}}]},default:Ou}},Au=[`label`,`domain`,`default`],ju=[`min`,`max`,`step`,`atLeast`];function Mu(e,t,n){e.issues.push({path:t,message:n,line:G(e.source,t.split(`.`))})}function Nu(e,t,n){if(n===`bool`)return`bool`;if(Array.isArray(n)){let r=n.filter(e=>typeof e==`string`);if(n.length===0||r.length!==n.length)return Mu(e,t,`a list domain must be a non-empty list of words, got ${JSON.stringify(n)}`);if(new Set(r).size!==r.length)return Mu(e,t,`a list domain names each word once, got ${JSON.stringify(n)}`);let i=r.filter(e=>e===``||e.includes(`/`)||/[\n\r]/.test(e));return i.length>0?Mu(e,t,`a list domain's words must be non-empty, slash-free, and newline-free — configure mode writes each on the set-state wire — got ${JSON.stringify(i)}`):r}if(ec(n)){let{min:r,max:i,step:a=1,atLeast:o}=n;return Object.keys(n).filter(e=>!ju.includes(e)).length===0&&Number.isInteger(r)&&Number.isInteger(i)&&r<=i&&Number.isInteger(a)&&a>=1&&(o===void 0||typeof o==`string`)?{min:r,max:i,step:a,...o!==void 0&&{atLeast:o}}:Mu(e,t,`a range domain is { min, max, step?, atLeast? } with integers min ≤ max, a whole step ≥ 1, and atLeast naming another range setting, got ${JSON.stringify(n)}`)}return Mu(e,t,`domain must be "bool", a list of words, or { min, max }, got ${K(n)}`)}function Pu(e,t,n){if(!ec(n))return Mu(e,t,`${t} must be { label, domain, default }, got ${tc(n)}`);for(let r of Object.keys(n))Au.includes(r)||Mu(e,`${t}.${r}`,`Unknown setting key "${r}". Expected one of: ${Au.join(`, `)}`);let{label:r}=n,i=typeof r==`string`&&r.length>0&&!/[\n\r]/.test(r);i||Mu(e,`${t}.label`,`a setting needs a one-line, non-empty "label" — the name its control shows, spliced into a synthesized template string — got ${K(r)}`);let a=Nu(e,`${t}.domain`,n.domain);if(!i||a===void 0)return;let o={label:r,domain:a,default:n.default};return!Fu(n.default)||!Us(o,n.default)?Mu(e,`${t}.default`,`default must be ${Ks(o)}, got ${K(n.default)}`):o}function Fu(e){return typeof e==`boolean`||typeof e==`string`||typeof e==`number`}function Iu(){return{required:!1,json:{type:`object`,propertyNames:{...Du,not:{const:zs}},additionalProperties:ku},parse:(e,t,n,r)=>{let i=r[n];if(i===void 0)return;let a=`${t}.${n}`;if(!ec(i))return Mu(e,a,`${a} must be an object of name → { label, domain, default }, got ${tc(i)}`);let o=Object.create(null);for(let[t,n]of Object.entries(i)){if(!Eu.test(t)){Mu(e,`${a}.${t}`,`setting name "${t}" is read as .settings.${t} in a template, so it must be an identifier (letters, digits, _; not starting with a digit)`);continue}if(t===`theme`){Mu(e,`${a}.${t}`,`setting "${zs}" is one every placement already has — its default for this segment is segments.<name>.palette, and a placement sets its own with settings: { ${zs}: "<theme>" }`);continue}let r=Pu(e,`${a}.${t}`,n);r!==void 0&&(o[t]=r)}return o}}}function Lu(){return{required:!1,json:{type:`string`,minLength:1,pattern:`^[^:/]+$`},parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0)return typeof i==`string`&&i.length>0&&!/[:/]/.test(i)?i:Mu(e,`${t}.${n}`,`a placement "id" must be a non-empty string without "/" or ":", got ${K(i)}`)}}}function Ru(){return{required:!1,json:{type:`object`,propertyNames:Du,additionalProperties:Ou},parse:(e,t,n,r)=>{let i=r[n];if(i===void 0)return;let a=`${t}.${n}`;if(!ec(i))return Mu(e,a,`a placement's "settings" must be an object of setting name → value, got ${tc(i)}`);let o=Object.create(null);for(let[t,n]of Object.entries(i))Fu(n)?o[t]=n:Mu(e,`${a}.${t}`,`setting "${t}" must be a boolean, a word, or a number, got ${tc(n)}`);return o}}}function zu(e){return new Set(Object.keys(e.segments).filter(e=>!xu(e)))}function Bu(e,t,n){if(t===void 0)return{};if(!ec(t))return e.issues.push({path:`segments`,message:`segments must be an object, got ${tc(t)}`,line:G(e.source,[`segments`])}),{};let r={};for(let[i,a]of Object.entries(t)){let t=nc(e,n.has(i)?Ku:Gu,`segments.${i}`,a);t!==null&&(r[i]=t)}return r}function Vu(){return{required:!0,json:{type:`string`},parse:(e,t,n,r)=>r[n]===void 0?oc(e,`${t}.${n}`,`${t} declares no template — only a segment the bundled default declares may omit it (inheriting the bundled template); a segment of your own needs its own${Tu(t.slice(9))}`)??void 0:Ys(e,t,r,n)??void 0}}function Hu(){return{required:!1,json:{anyOf:[{const:`auto`},{const:`fill`},{type:`integer`,minimum:1}]},parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0){if(i===`auto`)return`auto`;if(i===`fill`)return`fill`;if(typeof i==`number`&&Number.isInteger(i)&&i>0)return i;e.issues.push({path:`${t}.${n}`,message:`width must be "auto", "fill", or a positive integer, got ${K(i)}`,line:G(e.source,[...t.split(`.`),n])})}}}}function Uu(){return{required:!1,json:du(),parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0)return Vl(e,`${t}.${n}`,i)}}}const Wu={template:Vu(),description:fc(),group:bc(fu),width:Hu(),justify:bc(qs),truncate:bc(Js),bg:fc(),fg:fc(),when:fc(),palette:gc(),vars:Uu(),settings:Iu()},Gu={noun:`segment key`,fields:Wu},Ku={noun:`segment key`,fields:{...Wu,template:fc()}},qu=`#/definitions/LayoutNode`,Ju={kind:`container`,direction:`vertical`,children:[]};function Yu(e){return{required:!0,json:{const:e},parse:()=>e}}function Xu(){return{required:!0,json:{type:`string`},parse:(e,t,n,r)=>{let i=r[n];return typeof i==`string`&&i.length>0?i:(e.issues.push({path:`${t}.${n}`,message:`a segment node must have a non-empty "name" (a segment name), got ${K(i)}`,line:G(e.source,[`root`])}),``)}}}function Zu(){return{required:!0,json:{enum:[...Cs]},parse:(e,t,n,r)=>{let i=r[n];return typeof i==`string`&&Cs.includes(i)?i:(e.issues.push({path:`${t}.${n}`,message:`a container "direction" must be one of: ${Cs.join(`, `)} (got ${JSON.stringify(i)})`,line:G(e.source,[`root`])}),`vertical`)}}}function Qu(e){return{required:!0,json:{type:`array`,items:{$ref:qu}},parse:(t,n,r,i)=>{let a=i[r];return Array.isArray(a)?a.map((i,a)=>e(t,`${n}.${r}[${a}]`,i)):(t.issues.push({path:`${n}.${r}`,message:`a container must have a "children" array of layout nodes, got ${tc(a)}`,line:G(t.source,[`root`])}),[])}}}const $u={noun:`layout-node key`,fields:{kind:Yu(`segment`),name:Xu(),when:fc(),id:Lu(),settings:Ru()}},ed=()=>bc(ca),td={noun:`layout-node key`,fields:{kind:Yu(`container`),direction:Zu(),children:Qu(uc(()=>od)),when:fc(),distribution:ed()}};function nd(){return{required:!0,json:{type:`string`},parse:(e,t,n,r)=>{let i=r[n];return typeof i==`string`&&i.length>0?i:(e.issues.push({path:`${t}.${n}`,message:`a "seg" node must have a non-empty segment name, got ${K(i)}`,line:G(e.source,[`root`])}),``)}}}const rd={noun:`layout-node key`,fields:{seg:nd(),when:fc(),id:Lu(),settings:Ru()}},id={noun:`layout-node key`,fields:{h:Qu(uc(()=>od)),when:fc(),distribution:ed()}},ad={noun:`layout-node key`,fields:{v:Qu(uc(()=>od)),when:fc(),distribution:ed()}},od=(e,t,n)=>{if(typeof n==`string`)return n.length===0?(e.issues.push({path:t,message:`a bare-string layout node must be a non-empty segment name`,line:G(e.source,[`root`])}),Ju):{kind:`segment`,name:n};if(!ec(n))return e.issues.push({path:t,message:`a layout node must be a string (segment name) or an object with "kind" / "seg" / "h" / "v", got ${tc(n)}`,line:G(e.source,[`root`])}),Ju;if(n.kind===`container`)return nc(e,td,t,n)??Ju;if(n.kind===`segment`)return nc(e,$u,t,n)??Ju;if(n.kind===`cells`)return e.issues.push({path:t,message:`kind: "cells" is no longer supported — use the h-arm spelling instead:
41
41
  Old: { kind: "cells", segments: ["seg1", "seg2"] }
42
- New: { h: ["seg1", "seg2"] }`,line:U(e.source,[`root`])}),qu;if(n.kind===`group`){let r=rc(e,fd,t,n);return r===null?qu:(e.groups.push({name:r.name,label:r.label,...r.open!==void 0&&{open:r.open},...r.direction!==void 0&&{direction:r.direction},...r.key!==void 0&&{key:r.key},...r.bg!==void 0&&{bg:r.bg},...r.fg!==void 0&&{fg:r.fg},...r.when!==void 0&&{when:r.when},path:t}),md(r))}let r=`h`in n,i=`v`in n,a=`seg`in n;if(+!!r+ +!!i+ +!!a>1){let r=[`seg`,`h`,`v`].filter(e=>e in n);return e.issues.push({path:t,message:`a layout node may have exactly one of "seg", "h", or "v" — got ${r.map(e=>`"${e}"`).join(` and `)} together`,line:U(e.source,[`root`])}),qu}if(a){let r=rc(e,nd,t,n);return r===null?qu:{kind:`segment`,name:r.seg,...r.when!==void 0&&{when:r.when},...r.id!==void 0&&{id:r.id},...r.settings!==void 0&&{settings:r.settings}}}if(r){let r=rc(e,rd,t,n);return r===null?qu:{kind:`container`,direction:`horizontal`,children:r.h,...r.when!==void 0&&{when:r.when},...r.distribution!==void 0&&{distribution:r.distribution}}}if(i){let r=rc(e,id,t,n);return r===null?qu:{kind:`container`,direction:`vertical`,children:r.v,...r.when!==void 0&&{when:r.when},...r.distribution!==void 0&&{distribution:r.distribution}}}return e.issues.push({path:`${t}.kind`,message:`a layout node "kind" must be "container", "segment", or "group", or use the terse A-grammar: a bare string, or an object with "seg", "h", or "v" (got ${JSON.stringify(n.kind)})`,line:U(e.source,[`root`])}),qu};function od(){return{required:!0,json:{type:`object`,propertyNames:{pattern:Dc.source},additionalProperties:{$ref:Ku}},parse:(e,t,n,r)=>{let i=r[n];if(!nc(i))return e.issues.push({path:`${t}.${n}`,message:`"rows" must be an object of row name → layout node, got ${W(i)}`,line:U(e.source,[...t.split(`.`),n])}),{};let a={};for(let[r,o]of Object.entries(i)){if(!Dc.test(r)){e.issues.push({path:`${t}.${n}.${r}`,message:`row name "${r}" must be an identifier (letters, digits, _; not starting with a digit) — it names the row in the config file and merges by name over the bundled default's rows`,line:U(e.source,[...t.split(`.`),n,r])});continue}a[r]=ad(e,`${t}.${n}.${r}`,o)}return a}}}const sd={noun:`root key`,fields:{rows:od(),when:pc(),distribution:$u()}};function cd(e,t,n){return nc(n)&&`rows`in n?rc(e,sd,t,n)??{rows:{}}:ad(e,t,n)}function ld(){return{required:!0,json:{type:`string`,pattern:Dc.source},parse:(e,t,n,r)=>{let i=r[n];if(typeof i!=`string`||!Dc.test(i)||i===`closed`){e.issues.push({path:`${t}.${n}`,message:`a group "name" must be an identifier (letters, digits, _; not starting with a digit) and not the reserved "${Hc}", got ${G(i)}`,line:U(e.source,[`root`])});return}return i}}}function ud(){return{required:!1,json:{type:`string`,minLength:1},parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0){if(typeof i!=`string`||i===``||i.includes(`/`)){e.issues.push({path:`${t}.${n}`,message:`a group "key" must be a non-empty, slash-free SessionState key, got ${G(i)}`,line:U(e.source,[`root`])});return}return i}}}}function dd(){return{required:!0,json:{type:`string`,pattern:`^[^\\n\\r]*$`},parse:(e,t,n,r)=>{let i=Zs(e,t,r,n);if(i!==null){if(/[\n\r]/.test(i)){e.issues.push({path:`${t}.${n}`,message:`${t}.${n}: group label must not contain newlines`,line:U(e.source,[...t.split(`.`),n])});return}return i}}}}const fd={noun:`layout-node key`,fields:{kind:Ju(`group`),name:ld(),label:dd(),open:mc(),direction:xc(Ts),key:ud(),bg:pc(),fg:pc(),when:pc(),distribution:$u(),children:Zu(dc(()=>ad))}};function pd(e){return e.key??`groups.`+e.name}function md(e){let t=gu+e.name;return qc(t,{variable:t,key:pd(e),member:e.name},{kind:`container`,direction:e.direction??`vertical`,children:e.children,...e.distribution!==void 0&&{distribution:e.distribution}},`drop`,e.when)}function hd(e,t,n){e.issues.push({path:t,message:n,line:U(e.source,[`root`])})}function gd(e,t){Su(e,t,gu,`group nodes`);let n=e.groups;if(n.length===0)return;let r=new Set;for(let t of n)r.has(t.name)&&hd(e,t.path,`duplicate group name "${t.name}" — group names must be unique (they name the synthesized state var, action, and toggle segment)`),r.add(t.name);for(let t of n)for(let r of n)t!==r&&t.path.startsWith(`${r.path}.`)&&pd(t)===pd(r)&&hd(e,t.path,`group "${t.name}" shares key "${pd(t)}" with its ancestor group "${r.name}" — a shared key holds ONE open group, so an ancestor and a descendant cannot share one. Sibling accordions share a key; nested groups use distinct keys.`);let i=new Map;for(let t of n){let n=pd(t);if(i.has(n)||i.set(n,Hc),t.open===!0){let r=i.get(n);r!==`closed`&&hd(e,t.path,`groups "${r}" and "${t.name}" share key "${n}" and both declare open: true — a shared key holds one open group; pick one`),i.set(n,t.name)}}let a={},o={},s={};for(let e of n){let t=gu+e.name,r=pd(e),c=n.filter(t=>t!==e&&e.path.startsWith(t.path+`.`)).length,l=` `.repeat(c);a[t]=Qc(r,i.get(r)),o[t]=$c(r,e.name),s[t]={template:Xc(t,`${l}${e.label} ▸`,`${l}${e.label} ▾`),...e.bg!==void 0&&{bg:e.bg},...e.fg!==void 0&&{fg:e.fg}}}t.variables={...t.variables??{},...a},t.actions={...t.actions??{},...o},t.segments={...t.segments??{},...s}}var _d=class extends Error{name=`TemplateError`;kind=`EvalError`;pos;source;constructor(e,t,n={}){super(e,{cause:n.cause}),this.pos=t,this.source=n.source}get sourceSnippet(){return this.source?Ed(this.source,this.pos):``}toString(){let e=`${this.name}: ${this.message}\n at line ${this.pos.line}, column ${this.pos.column}`,t=this.sourceSnippet;return t?`${e}\n\n${t}`:e}},vd=class extends _d{name=`ParseError`;kind=`ParseError`;expected;found;constructor(e,t,n={}){super(e,t,n),this.expected=n.expected,this.found=n.found}},yd=class extends _d{name=`EvalError`;kind=`EvalError`},bd=class extends yd{name=`FuncNotFoundError`;kind=`FuncNotFoundError`;funcName;suggestions;constructor(e,t,n={}){let r=Dd(e,n.available??[]),i=r.length===0?``:` (did you mean: ${r.join(`, `)}?)`;super(`function ${JSON.stringify(e)} is not registered${i}`,t,n),this.funcName=e,this.suggestions=r}},xd=class extends yd{name=`ArgCountError`;kind=`ArgCountError`;funcName;accepted;got;constructor(e,t,n,r,i={}){let a=t.minimum===t.maximum?`${t.minimum}`:`at least ${t.minimum}`;super(`wrong number of args for ${e}: want ${a} got ${n}`,r,i),this.funcName=e,this.accepted=t,this.got=n}},Sd=class extends yd{name=`TypeMismatchError`;kind=`TypeMismatchError`;funcName;argIndex;expected;receivedSummary;constructor(e,t,n,r,i,a={}){super(`function ${JSON.stringify(e)} arg ${t}: expected ${n}, but a ${r} flowed in. Pass it through \`unstyled\` (or your engine's flatten function) to convert.`,i,a),this.funcName=e,this.argIndex=t,this.expected=n,this.receivedSummary=r}},Cd=class extends Sd{constructor(e,t,n,r,i={}){super(e,t,`integer`,String(n),r,i),this.message=Number.isInteger(Number(n))?`integer out of range: ${String(n)}`:`expected integer; found ${String(n)}`}},wd=class extends yd{name=`MissingFieldError`;kind=`MissingFieldError`;path;constructor(e,t,n={}){super(`field "${e.join(`.`)}" not found on receiver`,t,n),this.path=e}},Td=class extends yd{name=`FailError`;kind=`FailError`;constructor(e,t={line:0,column:0,offset:0},n={}){super(e,t,n)}};function Ed(e,t){let n=e.split(`
42
+ New: { h: ["seg1", "seg2"] }`,line:G(e.source,[`root`])}),Ju;if(n.kind===`group`){let r=nc(e,pd,t,n);return r===null?Ju:(e.groups.push({name:r.name,label:r.label,...r.open!==void 0&&{open:r.open},...r.direction!==void 0&&{direction:r.direction},...r.key!==void 0&&{key:r.key},...r.bg!==void 0&&{bg:r.bg},...r.fg!==void 0&&{fg:r.fg},...r.when!==void 0&&{when:r.when},path:t}),hd(r))}let r=`h`in n,i=`v`in n,a=`seg`in n;if(+!!r+ +!!i+ +!!a>1){let r=[`seg`,`h`,`v`].filter(e=>e in n);return e.issues.push({path:t,message:`a layout node may have exactly one of "seg", "h", or "v" — got ${r.map(e=>`"${e}"`).join(` and `)} together`,line:G(e.source,[`root`])}),Ju}if(a){let r=nc(e,rd,t,n);return r===null?Ju:{kind:`segment`,name:r.seg,...r.when!==void 0&&{when:r.when},...r.id!==void 0&&{id:r.id},...r.settings!==void 0&&{settings:r.settings}}}if(r){let r=nc(e,id,t,n);return r===null?Ju:{kind:`container`,direction:`horizontal`,children:r.h,...r.when!==void 0&&{when:r.when},...r.distribution!==void 0&&{distribution:r.distribution}}}if(i){let r=nc(e,ad,t,n);return r===null?Ju:{kind:`container`,direction:`vertical`,children:r.v,...r.when!==void 0&&{when:r.when},...r.distribution!==void 0&&{distribution:r.distribution}}}return e.issues.push({path:`${t}.kind`,message:`a layout node "kind" must be "container", "segment", or "group", or use the terse A-grammar: a bare string, or an object with "seg", "h", or "v" (got ${JSON.stringify(n.kind)})`,line:G(e.source,[`root`])}),Ju};function sd(){return{required:!0,json:{type:`object`,propertyNames:{pattern:Ec.source},additionalProperties:{$ref:qu}},parse:(e,t,n,r)=>{let i=r[n];if(!ec(i))return e.issues.push({path:`${t}.${n}`,message:`"rows" must be an object of row name → layout node, got ${tc(i)}`,line:G(e.source,[...t.split(`.`),n])}),{};let a={};for(let[r,o]of Object.entries(i)){if(!Ec.test(r)){e.issues.push({path:`${t}.${n}.${r}`,message:`row name "${r}" must be an identifier (letters, digits, _; not starting with a digit) — it names the row in the config file and merges by name over the bundled default's rows`,line:G(e.source,[...t.split(`.`),n,r])});continue}a[r]=od(e,`${t}.${n}.${r}`,o)}return a}}}const cd={noun:`root key`,fields:{rows:sd(),when:fc(),distribution:ed()}};function ld(e,t,n){return ec(n)&&`rows`in n?nc(e,cd,t,n)??{rows:{}}:od(e,t,n)}function ud(){return{required:!0,json:{type:`string`,pattern:Ec.source},parse:(e,t,n,r)=>{let i=r[n];if(typeof i!=`string`||!Ec.test(i)||i===`closed`){e.issues.push({path:`${t}.${n}`,message:`a group "name" must be an identifier (letters, digits, _; not starting with a digit) and not the reserved "${Vc}", got ${K(i)}`,line:G(e.source,[`root`])});return}return i}}}function dd(){return{required:!1,json:{type:`string`,minLength:1},parse:(e,t,n,r)=>{let i=r[n];if(i!==void 0){if(typeof i!=`string`||i===``||i.includes(`/`)){e.issues.push({path:`${t}.${n}`,message:`a group "key" must be a non-empty, slash-free SessionState key, got ${K(i)}`,line:G(e.source,[`root`])});return}return i}}}}function fd(){return{required:!0,json:{type:`string`,pattern:`^[^\\n\\r]*$`},parse:(e,t,n,r)=>{let i=Ys(e,t,r,n);if(i!==null){if(/[\n\r]/.test(i)){e.issues.push({path:`${t}.${n}`,message:`${t}.${n}: group label must not contain newlines`,line:G(e.source,[...t.split(`.`),n])});return}return i}}}}const pd={noun:`layout-node key`,fields:{kind:Yu(`group`),name:ud(),label:fd(),open:pc(),direction:bc(Cs),key:dd(),bg:fc(),fg:fc(),when:fc(),distribution:ed(),children:Qu(uc(()=>od))}};function md(e){return e.key??`groups.`+e.name}function hd(e){let t=gu+e.name;return Kc(t,{variable:t,key:md(e),member:e.name},{kind:`container`,direction:e.direction??`vertical`,children:e.children,...e.distribution!==void 0&&{distribution:e.distribution}},`drop`,e.when)}function gd(e,t,n){e.issues.push({path:t,message:n,line:G(e.source,[`root`])})}function _d(e,t){Cu(e,t,gu,`group nodes`);let n=e.groups;if(n.length===0)return;let r=new Set;for(let t of n)r.has(t.name)&&gd(e,t.path,`duplicate group name "${t.name}" — group names must be unique (they name the synthesized state var, action, and toggle segment)`),r.add(t.name);for(let t of n)for(let r of n)t!==r&&t.path.startsWith(`${r.path}.`)&&md(t)===md(r)&&gd(e,t.path,`group "${t.name}" shares key "${md(t)}" with its ancestor group "${r.name}" — a shared key holds ONE open group, so an ancestor and a descendant cannot share one. Sibling accordions share a key; nested groups use distinct keys.`);let i=new Map;for(let t of n){let n=md(t);if(i.has(n)||i.set(n,Vc),t.open===!0){let r=i.get(n);r!==`closed`&&gd(e,t.path,`groups "${r}" and "${t.name}" share key "${n}" and both declare open: true — a shared key holds one open group; pick one`),i.set(n,t.name)}}let a={},o={},s={};for(let e of n){let t=gu+e.name,r=md(e),c=n.filter(t=>t!==e&&e.path.startsWith(t.path+`.`)).length,l=` `.repeat(c);a[t]=Qc(r,i.get(r)),o[t]=$c(r,e.name),s[t]={template:Yc(t,`${l}${e.label} ▸`,`${l}${e.label} ▾`),...e.bg!==void 0&&{bg:e.bg},...e.fg!==void 0&&{fg:e.fg}}}t.variables={...t.variables??{},...a},t.actions={...t.actions??{},...o},t.segments={...t.segments??{},...s}}var vd=class extends Error{name=`TemplateError`;kind=`EvalError`;pos;source;constructor(e,t,n={}){super(e,{cause:n.cause}),this.pos=t,this.source=n.source}get sourceSnippet(){return this.source?Dd(this.source,this.pos):``}toString(){let e=`${this.name}: ${this.message}\n at line ${this.pos.line}, column ${this.pos.column}`,t=this.sourceSnippet;return t?`${e}\n\n${t}`:e}},yd=class extends vd{name=`ParseError`;kind=`ParseError`;expected;found;constructor(e,t,n={}){super(e,t,n),this.expected=n.expected,this.found=n.found}},bd=class extends vd{name=`EvalError`;kind=`EvalError`},xd=class extends bd{name=`FuncNotFoundError`;kind=`FuncNotFoundError`;funcName;suggestions;constructor(e,t,n={}){let r=Od(e,n.available??[]),i=r.length===0?``:` (did you mean: ${r.join(`, `)}?)`;super(`function ${JSON.stringify(e)} is not registered${i}`,t,n),this.funcName=e,this.suggestions=r}},Sd=class extends bd{name=`ArgCountError`;kind=`ArgCountError`;funcName;accepted;got;constructor(e,t,n,r,i={}){let a=t.minimum===t.maximum?`${t.minimum}`:`at least ${t.minimum}`;super(`wrong number of args for ${e}: want ${a} got ${n}`,r,i),this.funcName=e,this.accepted=t,this.got=n}},Cd=class extends bd{name=`TypeMismatchError`;kind=`TypeMismatchError`;funcName;argIndex;expected;receivedSummary;constructor(e,t,n,r,i,a={}){super(`function ${JSON.stringify(e)} arg ${t}: expected ${n}, but a ${r} flowed in. Pass it through \`unstyled\` (or your engine's flatten function) to convert.`,i,a),this.funcName=e,this.argIndex=t,this.expected=n,this.receivedSummary=r}},wd=class extends Cd{constructor(e,t,n,r,i={}){super(e,t,`integer`,String(n),r,i),this.message=Number.isInteger(Number(n))?`integer out of range: ${String(n)}`:`expected integer; found ${String(n)}`}},Td=class extends bd{name=`MissingFieldError`;kind=`MissingFieldError`;path;constructor(e,t,n={}){super(`field "${e.join(`.`)}" not found on receiver`,t,n),this.path=e}},Ed=class extends bd{name=`FailError`;kind=`FailError`;constructor(e,t={line:0,column:0,offset:0},n={}){super(e,t,n)}};function Dd(e,t){let n=e.split(`
43
43
  `),r=t.line-1,i=[];if(r-1>=0&&r-1<n.length&&i.push({num:r,text:n[r-1]??``}),r>=0&&r<n.length&&i.push({num:r+1,text:n[r]??``}),r+1<n.length&&i.push({num:r+2,text:n[r+1]??``}),i.length===0)return``;let a=String(i[i.length-1]?.num??1).length,o=[];for(let e of i)if(o.push(` ${String(e.num).padStart(a,` `)} | ${e.text}`),e.num===t.line){let e=` ${` `.repeat(a)} | `,n=` `.repeat(Math.max(0,t.column-1));o.push(`${e}${n}^`)}return o.join(`
44
- `)}function Dd(e,t){if(t.length===0)return[];let n=t.map(t=>({name:t,dist:Od(e,t)})).sort((e,t)=>e.dist-t.dist),r=Math.max(2,Math.floor(e.length/2));return n.filter(e=>e.dist<=r).slice(0,3).map(e=>e.name)}function Od(e,t){if(e===t)return 0;let n=e.length,r=t.length;if(n===0)return r;if(r===0)return n;let i=Array(r+1),a=Array(r+1);for(let e=0;e<=r;e++)i[e]=e;for(let o=1;o<=n;o++){a[0]=o;for(let n=1;n<=r;n++){let r=e[o-1]===t[n-1]?0:1;a[n]=Math.min((a[n-1]??0)+1,(i[n]??0)+1,(i[n-1]??0)+r)}for(let e=0;e<=r;e++)i[e]=a[e]??0}return i[r]??0}function kd(e){throw Error(`unhandled node kind: ${JSON.stringify(e)}`)}const Ad=new Map([[`if`,`If`],[`else`,`Else`],[`end`,`End`],[`range`,`Range`],[`with`,`With`],[`break`,`Break`],[`continue`,`Continue`],[`define`,`Define`],[`template`,`Template`],[`block`,`Block`],[`true`,`Bool`],[`false`,`Bool`],[`nil`,`Nil`]]),jd={left:`{{`,right:`}}`};var Md=class{src;leftDelim;rightDelim;offset=0;line=1;column=1;mode=`text`;pending;constructor(e,t=jd){this.src=e,this.leftDelim=t.left,this.rightDelim=t.right}pos(){return{line:this.line,column:this.column,offset:this.offset}}err(e,t,n={}){return new vd(e,t,{...n,source:this.src})}next(){if(this.pending){let e=this.pending;return this.pending=void 0,e}return this.read()}peek(){return this.pending||=this.read(),this.pending}read(){switch(this.mode){case`text`:return this.readText();case`action`:return this.readAction();case`done`:return this.makeToken(`EOF`,``,this.pos())}}readText(){if(this.offset>=this.src.length)return this.mode=`done`,this.makeToken(`EOF`,``,this.pos());let e=this.pos(),t=this.offset;for(;t<this.src.length&&!this.src.startsWith(this.leftDelim,t);)t+=1;let n=t<this.src.length&&this.src[t+this.leftDelim.length]===`-`,r=t;if(n)for(;r>this.offset&&Nd(this.src[r-1]??``);)--r;if(r>this.offset){let t=this.src.slice(this.offset,r);return this.advanceTo(r),this.makeToken(`Text`,t,e)}return this.advanceTo(t),this.emitLeftDelim(n)}emitLeftDelim(e){let t=this.pos();if(this.advanceBy(this.leftDelim.length),e)for(this.advanceBy(1);Nd(this.src[this.offset]??``);)this.advanceBy(1);return this.mode=`action`,this.src.startsWith(`/*`,this.offset)?this.readComment(t,e):this.makeToken(`LeftDelim`,e?`${this.leftDelim}-`:this.leftDelim,t,e?{trimLeft:!0}:{})}readComment(e,t){this.advanceBy(2);let n=this.offset,r=this.src.indexOf(`*/`,this.offset);if(r===-1)throw this.err(`unclosed comment`,e,{expected:`*/${this.rightDelim}`,found:`end of input`});this.advanceTo(r);let i=this.src.slice(n,r).trim();for(this.advanceBy(2);Nd(this.src[this.offset]??``);)this.advanceBy(1);let a=!1;if(this.src[this.offset]===`-`&&(a=!0,this.advanceBy(1)),!this.src.startsWith(this.rightDelim,this.offset))throw this.err(`expected \`${this.rightDelim}\` to close comment`,this.pos(),{expected:this.rightDelim,found:this.src[this.offset]??`end of input`});if(this.advanceBy(this.rightDelim.length),a)for(;Nd(this.src[this.offset]??``);)this.advanceBy(1);return this.mode=`text`,this.makeToken(`Comment`,i,e,{...t?{trimLeft:!0}:{},...a?{trimRight:!0}:{}})}readAction(){if(this.skipActionSpaces(),this.src.startsWith(`-${this.rightDelim}`,this.offset)){let e=this.pos();for(this.advanceBy(1+this.rightDelim.length),this.mode=`text`;Nd(this.src[this.offset]??``);)this.advanceBy(1);return this.makeToken(`RightDelim`,`-${this.rightDelim}`,e,{trimRight:!0})}if(this.src.startsWith(this.rightDelim,this.offset)){let e=this.pos();return this.advanceBy(this.rightDelim.length),this.mode=`text`,this.makeToken(`RightDelim`,this.rightDelim,e)}if(this.offset>=this.src.length)throw this.err(`unclosed action`,this.pos(),{expected:this.rightDelim,found:`end of input`});let e=this.src[this.offset],t=this.pos();switch(e){case`(`:return this.advanceBy(1),this.makeToken(`LeftParen`,`(`,t);case`)`:return this.advanceBy(1),this.makeToken(`RightParen`,`)`,t);case`|`:return this.advanceBy(1),this.makeToken(`Pipe`,`|`,t);case`,`:return this.advanceBy(1),this.makeToken(`Comma`,`,`,t);case`:`:if(this.src[this.offset+1]===`=`)return this.advanceBy(2),this.makeToken(`Declare`,`:=`,t);throw this.err("expected `:=`",t,{expected:`:=`,found:`:`});case`=`:return this.advanceBy(1),this.makeToken(`Assign`,`=`,t);case`"`:return this.readQuotedString(t);case"`":return this.readRawString(t);case`'`:return this.readChar(t)}if(e===`$`)return this.readVariable(t);if(e!==void 0&&(Fd(e)||Pd(e)&&Fd(this.src[this.offset+1]??``)||e===`.`&&Fd(this.src[this.offset+1]??``)))return this.readNumber(t);if(e===`.`)return this.readDotOrField(t);if(e!==void 0&&Bd(e))return this.readIdentifier(t);throw this.err(`unexpected character ${JSON.stringify(e)}`,t,{found:e??`end of input`})}readQuotedString(e){let t=this.offset;for(this.advanceBy(1);this.offset<this.src.length;){let n=this.src[this.offset];if(n===`\\`){this.advanceBy(1),this.offset<this.src.length&&this.advanceBy(1);continue}if(n===`
44
+ `)}function Od(e,t){if(t.length===0)return[];let n=t.map(t=>({name:t,dist:kd(e,t)})).sort((e,t)=>e.dist-t.dist),r=Math.max(2,Math.floor(e.length/2));return n.filter(e=>e.dist<=r).slice(0,3).map(e=>e.name)}function kd(e,t){if(e===t)return 0;let n=e.length,r=t.length;if(n===0)return r;if(r===0)return n;let i=Array(r+1),a=Array(r+1);for(let e=0;e<=r;e++)i[e]=e;for(let o=1;o<=n;o++){a[0]=o;for(let n=1;n<=r;n++){let r=e[o-1]===t[n-1]?0:1;a[n]=Math.min((a[n-1]??0)+1,(i[n]??0)+1,(i[n-1]??0)+r)}for(let e=0;e<=r;e++)i[e]=a[e]??0}return i[r]??0}function Ad(e){throw Error(`unhandled node kind: ${JSON.stringify(e)}`)}const jd=new Map([[`if`,`If`],[`else`,`Else`],[`end`,`End`],[`range`,`Range`],[`with`,`With`],[`break`,`Break`],[`continue`,`Continue`],[`define`,`Define`],[`template`,`Template`],[`block`,`Block`],[`true`,`Bool`],[`false`,`Bool`],[`nil`,`Nil`]]),Md={left:`{{`,right:`}}`};var Nd=class{src;leftDelim;rightDelim;offset=0;line=1;column=1;mode=`text`;pending;constructor(e,t=Md){this.src=e,this.leftDelim=t.left,this.rightDelim=t.right}pos(){return{line:this.line,column:this.column,offset:this.offset}}err(e,t,n={}){return new yd(e,t,{...n,source:this.src})}next(){if(this.pending){let e=this.pending;return this.pending=void 0,e}return this.read()}peek(){return this.pending||=this.read(),this.pending}read(){switch(this.mode){case`text`:return this.readText();case`action`:return this.readAction();case`done`:return this.makeToken(`EOF`,``,this.pos())}}readText(){if(this.offset>=this.src.length)return this.mode=`done`,this.makeToken(`EOF`,``,this.pos());let e=this.pos(),t=this.offset;for(;t<this.src.length&&!this.src.startsWith(this.leftDelim,t);)t+=1;let n=t<this.src.length&&this.src[t+this.leftDelim.length]===`-`,r=t;if(n)for(;r>this.offset&&Pd(this.src[r-1]??``);)--r;if(r>this.offset){let t=this.src.slice(this.offset,r);return this.advanceTo(r),this.makeToken(`Text`,t,e)}return this.advanceTo(t),this.emitLeftDelim(n)}emitLeftDelim(e){let t=this.pos();if(this.advanceBy(this.leftDelim.length),e)for(this.advanceBy(1);Pd(this.src[this.offset]??``);)this.advanceBy(1);return this.mode=`action`,this.src.startsWith(`/*`,this.offset)?this.readComment(t,e):this.makeToken(`LeftDelim`,e?`${this.leftDelim}-`:this.leftDelim,t,e?{trimLeft:!0}:{})}readComment(e,t){this.advanceBy(2);let n=this.offset,r=this.src.indexOf(`*/`,this.offset);if(r===-1)throw this.err(`unclosed comment`,e,{expected:`*/${this.rightDelim}`,found:`end of input`});this.advanceTo(r);let i=this.src.slice(n,r).trim();for(this.advanceBy(2);Pd(this.src[this.offset]??``);)this.advanceBy(1);let a=!1;if(this.src[this.offset]===`-`&&(a=!0,this.advanceBy(1)),!this.src.startsWith(this.rightDelim,this.offset))throw this.err(`expected \`${this.rightDelim}\` to close comment`,this.pos(),{expected:this.rightDelim,found:this.src[this.offset]??`end of input`});if(this.advanceBy(this.rightDelim.length),a)for(;Pd(this.src[this.offset]??``);)this.advanceBy(1);return this.mode=`text`,this.makeToken(`Comment`,i,e,{...t?{trimLeft:!0}:{},...a?{trimRight:!0}:{}})}readAction(){if(this.skipActionSpaces(),this.src.startsWith(`-${this.rightDelim}`,this.offset)){let e=this.pos();for(this.advanceBy(1+this.rightDelim.length),this.mode=`text`;Pd(this.src[this.offset]??``);)this.advanceBy(1);return this.makeToken(`RightDelim`,`-${this.rightDelim}`,e,{trimRight:!0})}if(this.src.startsWith(this.rightDelim,this.offset)){let e=this.pos();return this.advanceBy(this.rightDelim.length),this.mode=`text`,this.makeToken(`RightDelim`,this.rightDelim,e)}if(this.offset>=this.src.length)throw this.err(`unclosed action`,this.pos(),{expected:this.rightDelim,found:`end of input`});let e=this.src[this.offset],t=this.pos();switch(e){case`(`:return this.advanceBy(1),this.makeToken(`LeftParen`,`(`,t);case`)`:return this.advanceBy(1),this.makeToken(`RightParen`,`)`,t);case`|`:return this.advanceBy(1),this.makeToken(`Pipe`,`|`,t);case`,`:return this.advanceBy(1),this.makeToken(`Comma`,`,`,t);case`:`:if(this.src[this.offset+1]===`=`)return this.advanceBy(2),this.makeToken(`Declare`,`:=`,t);throw this.err("expected `:=`",t,{expected:`:=`,found:`:`});case`=`:return this.advanceBy(1),this.makeToken(`Assign`,`=`,t);case`"`:return this.readQuotedString(t);case"`":return this.readRawString(t);case`'`:return this.readChar(t)}if(e===`$`)return this.readVariable(t);if(e!==void 0&&(Id(e)||Fd(e)&&Id(this.src[this.offset+1]??``)||e===`.`&&Id(this.src[this.offset+1]??``)))return this.readNumber(t);if(e===`.`)return this.readDotOrField(t);if(e!==void 0&&Vd(e))return this.readIdentifier(t);throw this.err(`unexpected character ${JSON.stringify(e)}`,t,{found:e??`end of input`})}readQuotedString(e){let t=this.offset;for(this.advanceBy(1);this.offset<this.src.length;){let n=this.src[this.offset];if(n===`\\`){this.advanceBy(1),this.offset<this.src.length&&this.advanceBy(1);continue}if(n===`
45
45
  `)throw this.err(`newline in interpreted string`,e,{found:`\\n`});if(n===`"`)return this.advanceBy(1),this.makeToken(`String`,this.src.slice(t,this.offset),e);this.advanceBy(1)}throw this.err(`unterminated string literal`,e,{expected:`"`,found:`end of input`})}readRawString(e){let t=this.offset;for(this.advanceBy(1);this.offset<this.src.length;){if(this.src[this.offset]==="`")return this.advanceBy(1),this.makeToken(`String`,this.src.slice(t,this.offset),e);this.advanceBy(1)}throw this.err(`unterminated raw string literal`,e,{expected:"`",found:`end of input`})}readChar(e){let t=this.offset;for(this.advanceBy(1);this.offset<this.src.length;){let n=this.src[this.offset];if(n===`\\`){this.advanceBy(1),this.offset<this.src.length&&this.advanceBy(1);continue}if(n===`
46
- `)throw this.err(`newline in rune literal`,e,{found:`\\n`});if(n===`'`)return this.advanceBy(1),this.makeToken(`Char`,this.src.slice(t,this.offset),e);this.advanceBy(1)}throw this.err(`unterminated rune literal`,e,{expected:`'`,found:`end of input`})}readNumber(e){let t=this.offset;if(Pd(this.src[this.offset]??``)&&this.advanceBy(1),this.src[this.offset]===`0`&&this.offset+1<this.src.length){let n=this.src[this.offset+1];if(n===`x`||n===`X`){for(this.advanceBy(2);Id(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);if(this.src[this.offset]===`.`||this.src[this.offset]===`p`||this.src[this.offset]===`P`)for(;this.isHexFloatTail(this.src[this.offset]??``);)this.advanceBy(1);return this.finishNumber(t,e)}if(n===`o`||n===`O`){for(this.advanceBy(2);Ld(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);return this.finishNumber(t,e)}if(n===`b`||n===`B`){for(this.advanceBy(2);Rd(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);return this.finishNumber(t,e)}}for(;Fd(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);if(this.src[this.offset]===`.`)for(this.advanceBy(1);Fd(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);if(this.src[this.offset]===`e`||this.src[this.offset]===`E`)for(this.advanceBy(1),Pd(this.src[this.offset]??``)&&this.advanceBy(1);Fd(this.src[this.offset]??``);)this.advanceBy(1);return this.src[this.offset]===`i`&&this.advanceBy(1),this.finishNumber(t,e)}isHexFloatTail(e){return Id(e)||e===`.`||e===`p`||e===`P`||e===`+`||e===`-`||e===`_`}finishNumber(e,t){if(this.offset===e)throw this.err(`expected number`,t,{expected:`digit`});return this.makeToken(`Number`,this.src.slice(e,this.offset),t)}readVariable(e){let t=this.offset;for(this.advanceBy(1);Vd(this.src[this.offset]??``);)this.advanceBy(1);for(;this.src[this.offset]===`.`&&Bd(this.src[this.offset+1]??``);)for(this.advanceBy(1);Vd(this.src[this.offset]??``);)this.advanceBy(1);return this.makeToken(`Variable`,this.src.slice(t,this.offset),e)}readDotOrField(e){let t=this.offset;if(this.advanceBy(1),!Bd(this.src[this.offset]??``))return this.makeToken(`Dot`,`.`,e);for(;Vd(this.src[this.offset]??``);)this.advanceBy(1);for(;this.src[this.offset]===`.`&&Bd(this.src[this.offset+1]??``);)for(this.advanceBy(1);Vd(this.src[this.offset]??``);)this.advanceBy(1);return this.makeToken(`Field`,this.src.slice(t,this.offset),e)}readIdentifier(e){let t=this.offset;for(;Vd(this.src[this.offset]??``);)this.advanceBy(1);let n=this.src.slice(t,this.offset),r=Ad.get(n);return r?this.makeToken(r,n,e):this.makeToken(`Identifier`,n,e)}skipActionSpaces(){for(;this.offset<this.src.length;){let e=this.src[this.offset];if(e===` `||e===` `||e===`\r`||e===`
46
+ `)throw this.err(`newline in rune literal`,e,{found:`\\n`});if(n===`'`)return this.advanceBy(1),this.makeToken(`Char`,this.src.slice(t,this.offset),e);this.advanceBy(1)}throw this.err(`unterminated rune literal`,e,{expected:`'`,found:`end of input`})}readNumber(e){let t=this.offset;if(Fd(this.src[this.offset]??``)&&this.advanceBy(1),this.src[this.offset]===`0`&&this.offset+1<this.src.length){let n=this.src[this.offset+1];if(n===`x`||n===`X`){for(this.advanceBy(2);Ld(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);if(this.src[this.offset]===`.`||this.src[this.offset]===`p`||this.src[this.offset]===`P`)for(;this.isHexFloatTail(this.src[this.offset]??``);)this.advanceBy(1);return this.finishNumber(t,e)}if(n===`o`||n===`O`){for(this.advanceBy(2);Rd(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);return this.finishNumber(t,e)}if(n===`b`||n===`B`){for(this.advanceBy(2);zd(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);return this.finishNumber(t,e)}}for(;Id(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);if(this.src[this.offset]===`.`)for(this.advanceBy(1);Id(this.src[this.offset]??``)||this.src[this.offset]===`_`;)this.advanceBy(1);if(this.src[this.offset]===`e`||this.src[this.offset]===`E`)for(this.advanceBy(1),Fd(this.src[this.offset]??``)&&this.advanceBy(1);Id(this.src[this.offset]??``);)this.advanceBy(1);return this.src[this.offset]===`i`&&this.advanceBy(1),this.finishNumber(t,e)}isHexFloatTail(e){return Ld(e)||e===`.`||e===`p`||e===`P`||e===`+`||e===`-`||e===`_`}finishNumber(e,t){if(this.offset===e)throw this.err(`expected number`,t,{expected:`digit`});return this.makeToken(`Number`,this.src.slice(e,this.offset),t)}readVariable(e){let t=this.offset;for(this.advanceBy(1);Hd(this.src[this.offset]??``);)this.advanceBy(1);for(;this.src[this.offset]===`.`&&Vd(this.src[this.offset+1]??``);)for(this.advanceBy(1);Hd(this.src[this.offset]??``);)this.advanceBy(1);return this.makeToken(`Variable`,this.src.slice(t,this.offset),e)}readDotOrField(e){let t=this.offset;if(this.advanceBy(1),!Vd(this.src[this.offset]??``))return this.makeToken(`Dot`,`.`,e);for(;Hd(this.src[this.offset]??``);)this.advanceBy(1);for(;this.src[this.offset]===`.`&&Vd(this.src[this.offset+1]??``);)for(this.advanceBy(1);Hd(this.src[this.offset]??``);)this.advanceBy(1);return this.makeToken(`Field`,this.src.slice(t,this.offset),e)}readIdentifier(e){let t=this.offset;for(;Hd(this.src[this.offset]??``);)this.advanceBy(1);let n=this.src.slice(t,this.offset),r=jd.get(n);return r?this.makeToken(r,n,e):this.makeToken(`Identifier`,n,e)}skipActionSpaces(){for(;this.offset<this.src.length;){let e=this.src[this.offset];if(e===` `||e===` `||e===`\r`||e===`
47
47
  `)this.advanceBy(1);else return}}advanceBy(e){for(let t=0;t<e;t++){let e=this.src[this.offset];this.offset+=1,e===`
48
- `?(this.line+=1,this.column=1):this.column+=1}}advanceTo(e){for(;this.offset<e;)this.advanceBy(1)}makeToken(e,t,n,r={}){return Object.freeze({type:e,value:t,pos:n,...r.trimLeft===void 0?{}:{trimLeft:r.trimLeft},...r.trimRight===void 0?{}:{trimRight:r.trimRight}})}};function Nd(e){return e===` `||e===` `||e===`\r`||e===`
49
- `}function Pd(e){return e===`+`||e===`-`}function Fd(e){return e>=`0`&&e<=`9`}function Id(e){return Fd(e)||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`}function Ld(e){return e>=`0`&&e<=`7`}function Rd(e){return e===`0`||e===`1`}function zd(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`}function Bd(e){return zd(e)||e===`_`}function Vd(e){return Bd(e)||Fd(e)}let Hd,Ud;function Wd(e,t){return Ud(e,t)}var Gd=class e{static EMPTY=new e(new Map,void 0);#e;#t;constructor(e,t){this.#e=e,this.#t=t}static{Hd=(t,n)=>new e(t,n),Ud=(e,t)=>e.#e.get(t)??(e.#t&&Ud(e.#t,t))}has(e){return Ud(this,e)!==void 0}};function Kd(e,t,n=Gd.EMPTY){return new qd(e,t,n).parseTemplate()}var qd=class{lex;buf=[];defines=new Map;inherit;source;rangeDepth=0;constructor(e,t,n){this.source=e,this.inherit=n,this.lex=t?new Md(e,t):new Md(e)}peek(e=0){for(;this.buf.length<=e;)this.buf.push(this.lex.next());return this.buf[e]}next(){return this.buf.length>0?this.buf.shift():this.lex.next()}expect(e,t){let n=this.next();if(n.type!==e)throw this.errAt(n,`expected ${t}`,{expected:t,found:Xd(n)});return n}errAt(e,t,n={}){return new vd(t,e.pos,{...n,source:this.source})}parseTemplate(){let e=this.parseList();if(this.peek().type!==`EOF`){let e=this.peek(),t=this.peek(1);if(e.type===`LeftDelim`&&(t.type===`Else`||t.type===`End`)){let n=t.type===`Else`?`else`:`end`;throw this.errAt(e,`unexpected \`{{${n}}}\` outside of \`if\`, \`range\`, \`with\`, or \`block\``,{found:`{{${n}}}`})}throw this.errAt(e,`unexpected ${Xd(e)}`,{found:Xd(e)})}return{root:e,defines:Hd(this.defines,this.inherit),ownDefines:this.defines,source:this.source}}parseList(){let e=this.peek().pos,t=[];for(;;){let n=this.peek();if(n.type===`EOF`)break;if(n.type===`Text`){this.next(),t.push({type:`Text`,pos:n.pos,text:n.value});continue}if(n.type===`Comment`){this.next();let e=Yd(n);t.push({type:`Comment`,pos:n.pos,text:n.value,trim:e});continue}if(n.type===`LeftDelim`){let n=this.peek(1).type;if(n===`Else`||n===`End`)return Jd(e,t);let r=this.parseAction();r!==null&&t.push(r);continue}throw this.errAt(n,`unexpected ${Xd(n)} at top level`,{found:Xd(n)})}return Jd(e,t)}parseAction(){let e=this.expect(`LeftDelim`,"`{{`"),t=e.trimLeft===!0,n=this.peek();switch(n.type){case`If`:return this.next(),this.parseBranch(`If`,e.pos,t);case`Range`:return this.next(),this.parseBranch(`Range`,e.pos,t);case`With`:return this.next(),this.parseBranch(`With`,e.pos,t);case`Break`:return this.next(),this.parseBreakOrContinue(`Break`,e.pos,t);case`Continue`:return this.next(),this.parseBreakOrContinue(`Continue`,e.pos,t);case`Template`:return this.next(),this.parseTemplateInvocation(e.pos,t);case`Block`:return this.next(),this.parseBlock(e.pos,t);case`Define`:return this.next(),this.parseDefine(e.pos,t),null;case`RightDelim`:throw this.errAt(n,`empty action`,{expected:`pipeline`});default:{let n=this.parsePipeline(),r=this.expect(`RightDelim`,"`}}`");return{type:`Action`,pos:e.pos,pipe:n,trim:{trimLeft:t,trimRight:r.trimRight===!0}}}}}parseBranch(e,t,n){let r=this.parsePipeline();this.expect(`RightDelim`,"`}}`"),e===`Range`&&(this.rangeDepth+=1);let i=this.parseList();e===`Range`&&--this.rangeDepth;let a=this.parseElsePart(),o={trimLeft:n,trimRight:a.endConsumed?a.endRight:this.consumeEnd()},s=a.list?{pipe:r,list:i,elseList:a.list,trim:o}:{pipe:r,list:i,trim:o};switch(e){case`If`:return{type:`If`,pos:t,...s};case`Range`:return{type:`Range`,pos:t,...s};case`With`:return{type:`With`,pos:t,...s}}}parseBreakOrContinue(e,t,n){if(this.rangeDepth===0)throw new vd(`{{${e===`Break`?`break`:`continue`}}} outside of {{range}}`,t,{source:this.source});let r={trimLeft:n,trimRight:this.expect(`RightDelim`,"`}}`").trimRight===!0};return e===`Break`?{type:`Break`,pos:t,trim:r}:{type:`Continue`,pos:t,trim:r}}parseElsePart(){if(this.peek().type!==`LeftDelim`||this.peek(1).type!==`Else`)return{list:void 0,endRight:!1,endConsumed:!1};let e=this.next();if(this.next(),this.peek().type===`If`){this.next();let t=this.parseBranch(`If`,e.pos,e.trimLeft===!0);return{list:{type:`List`,pos:e.pos,nodes:[t]},endRight:t.trim.trimRight,endConsumed:!0}}return this.expect(`RightDelim`,"`}}`"),{list:this.parseList(),endRight:!1,endConsumed:!1}}consumeEnd(){return this.expect(`LeftDelim`,"`{{end}}`"),this.expect(`End`,"`end`"),this.expect(`RightDelim`,"`}}`").trimRight===!0}parseTemplateInvocation(e,t){let n=this.parseQuotedName(),r=this.peek().type===`RightDelim`?void 0:this.parsePipeline(),i={trimLeft:t,trimRight:this.expect(`RightDelim`,"`}}`").trimRight===!0};return r?{type:`Template`,pos:e,name:n,pipe:r,trim:i}:{type:`Template`,pos:e,name:n,trim:i}}parseBlock(e,t){let n=this.parseQuotedName(),r=this.peek().type===`RightDelim`?void 0:this.parsePipeline();this.expect(`RightDelim`,"`}}`");let i=this.rangeDepth;this.rangeDepth=0;let a=this.parseList();this.rangeDepth=i;let o={trimLeft:t,trimRight:this.consumeEnd()};return!this.defines.has(n)&&!this.inherit.has(n)&&this.defines.set(n,{list:a,source:this.source}),r?{type:`Block`,pos:e,name:n,pipe:r,list:a,trim:o}:{type:`Block`,pos:e,name:n,list:a,trim:o}}parseDefine(e,t){let n=this.parseQuotedName();this.expect(`RightDelim`,"`}}`");let r=this.rangeDepth;this.rangeDepth=0;let i=this.parseList();if(this.rangeDepth=r,this.consumeEnd(),this.defines.has(n)||this.inherit.has(n))throw new vd(`redefinition of template ${JSON.stringify(n)}`,i.pos,{source:this.source});this.defines.set(n,{list:i,source:this.source})}parseQuotedName(){let e=this.next();if(e.type!==`String`)throw this.errAt(e,`expected template name (quoted string)`,{expected:`string`,found:Xd(e)});return af(e.value,e.pos,this.source)}parsePipeline(){let e=this.peek().pos,t=this.tryParseDecls(),n=[this.parseCommand()];for(;this.peek().type===`Pipe`;){this.next();let e=this.peek();if(!Zd(e.type))throw this.errAt(e,"missing command after `|`",{expected:`command`,found:Xd(e)});n.push(this.parseCommand())}return{type:`Pipe`,pos:e,decls:t?.vars??[],isAssign:t?.isAssign??!1,cmds:n}}tryParseDecls(){if(this.peek().type!==`Variable`)return;let e=1;for(;this.peek(e).type===`Comma`;){if(this.peek(e+1).type!==`Variable`)return;e+=2}let t=this.peek(e).type;if(t!==`Declare`&&t!==`Assign`)return;let n=[Qd(this.next())];for(;this.peek().type===`Comma`;)this.next(),n.push(Qd(this.expect(`Variable`,`$variable`)));return{vars:n,isAssign:this.next().type===`Assign`}}parseCommand(){let e=this.peek().pos,t=[this.parsePrimary()];for(;Zd(this.peek().type);)t.push(this.parsePrimary());return{type:`Command`,pos:e,args:t}}parsePrimary(){let e=this.next();switch(e.type){case`Dot`:return{type:`Dot`,pos:e.pos};case`Field`:return{type:`Field`,pos:e.pos,idents:e.value.slice(1).split(`.`)};case`Variable`:return Qd(e);case`Identifier`:return{type:`Identifier`,pos:e.pos,ident:e.value};case`String`:return{type:`String`,pos:e.pos,raw:e.value,value:af(e.value,e.pos,this.source)};case`Number`:return ef(e);case`Char`:return tf(e,this.source);case`Bool`:return{type:`Bool`,pos:e.pos,value:e.value===`true`};case`Nil`:return{type:`Nil`,pos:e.pos};case`LeftParen`:return this.parseChainOrPipe(e.pos);default:throw this.errAt(e,`expected command argument, found ${Xd(e)}`,{expected:`command argument`,found:Xd(e)})}}parseChainOrPipe(e){let t=this.parsePipeline(),n=this.expect(`RightParen`,"`)`"),r=[],i=n.pos.offset+1,a=this.peek();return a.type===`Field`&&a.pos.offset===i&&(this.next(),r.push(...a.value.slice(1).split(`.`))),r.length===0?t:{type:`Chain`,pos:e,node:t,fields:r}}};function Jd(e,t){return{type:`List`,pos:e,nodes:t}}function Yd(e){return{trimLeft:e.trimLeft===!0,trimRight:e.trimRight===!0}}function Xd(e){return e.type===`EOF`?`end of input`:e.value||e.type}function Zd(e){switch(e){case`Dot`:case`Field`:case`Variable`:case`Identifier`:case`String`:case`Number`:case`Char`:case`Bool`:case`Nil`:case`LeftParen`:return!0;default:return!1}}function Qd(e){return{type:`Variable`,pos:e.pos,idents:$d(e.value)}}function $d(e){let t=e.indexOf(`.`);return t===-1?[e]:[e.slice(0,t),...e.slice(t+1).split(`.`)]}function ef(e){let t=e.value,n=t.replace(/_/g,``),r=n.toLowerCase().endsWith(`i`),i=r?n.slice(0,-1):n,a=!r&&(i.includes(`.`)||!i.startsWith(`0x`)&&!i.startsWith(`0X`)&&/[eE]/.test(i)||(i.startsWith(`0x`)||i.startsWith(`0X`))&&/[pP]/.test(i)),o=!r&&!a,s={type:`Number`,pos:e.pos,text:t,isInt:o,isUint:!1,isFloat:a,isComplex:r};if(o){let e=nf(i);return{...s,intValue:e}}if(a){let e=rf(i);return{...s,floatValue:e}}let c=rf(i);return{...s,complexValue:[0,c]}}function tf(e,t){let n=of(e.value,e.pos,t);return{type:`Number`,pos:e.pos,text:e.value,isInt:!0,isUint:!1,isFloat:!1,isComplex:!1,intValue:BigInt(n)}}function nf(e){let t=1n,n=e;return n.startsWith(`+`)?n=n.slice(1):n.startsWith(`-`)&&(t=-1n,n=n.slice(1)),t*BigInt(n)}function rf(e){return Number(e)}function af(e,t,n){if(e.startsWith("`"))return e.slice(1,-1);let r=``;for(let i=1;i<e.length-1;i++){let a=e[i];if(a!==`\\`){r+=a;continue}let o=e[++i];switch(o){case`n`:r+=`
50
- `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`\\`:r+=`\\`;break;case`"`:r+=`"`;break;case`'`:r+=`'`;break;case`a`:r+=`\x07`;break;case`b`:r+=`\b`;break;case`f`:r+=`\f`;break;case`v`:r+=`\v`;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:{let t=o+(e[i+1]??``)+(e[i+2]??``);i+=2,r+=String.fromCodePoint(Number.parseInt(t,8));break}case`x`:{let t=(e[i+1]??``)+(e[i+2]??``);i+=2,r+=String.fromCodePoint(Number.parseInt(t,16));break}case`u`:{let t=e.slice(i+1,i+5);i+=4,r+=String.fromCodePoint(Number.parseInt(t,16));break}case`U`:{let t=e.slice(i+1,i+9);i+=8,r+=String.fromCodePoint(Number.parseInt(t,16));break}default:throw new vd(`bad escape sequence \\${o}`,t,{expected:`valid escape sequence`,found:`\\${o}`,source:n})}}return r}function of(e,t,n){let r=af(`"${e.slice(1,-1).replace(/"/g,`\\"`)}"`,t,n);if(r.length===0)throw new vd(`empty rune literal`,t,{source:n});return r.codePointAt(0)??0}function sf(e,t){if(t(e)!==!1)for(let n of cf(e))sf(n,t)}function cf(e){switch(e.type){case`Text`:case`Comment`:case`Dot`:case`Nil`:case`Bool`:case`Number`:case`String`:case`Identifier`:case`Field`:case`Variable`:case`Break`:case`Continue`:return[];case`List`:return e.nodes;case`Chain`:return[e.node];case`Command`:return e.args;case`Pipe`:return[...e.decls,...e.cmds];case`Action`:return[e.pipe];case`If`:case`Range`:case`With`:return e.elseList?[e.pipe,e.list,e.elseList]:[e.pipe,e.list];case`Template`:return e.pipe?[e.pipe]:[];case`Block`:return e.pipe?[e.pipe,e.list]:[e.list];default:return kd(e)}}const lf=Symbol(`go-template-js.MISSING`);function uf(e,t){if(e==null)return lf;if(e instanceof Map)return e.has(t)?e.get(t):lf;if(Array.isArray(e))return lf;if(typeof e==`object`){let n=e;return t in n?n[t]:lf}return lf}function df(e,t){let n=e;for(let e of t){if(n===lf)return lf;n=uf(n,e)}return n}function ff(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||e===void 0||t===void 0||typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length?e.every((e,n)=>ff(e,t[n])):!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!ff(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>ff(e[n],t[n])):!1}return!1}const pf=new WeakSet;function mf(e){return pf.add(e),e}function hf(e){return pf.has(e)}function gf(e){return e==null||e===!1?!1:typeof e==`number`?e!==0&&!Number.isNaN(e):typeof e==`bigint`?e!==0n:typeof e==`string`||Array.isArray(e)?e.length>0:e instanceof Map||e instanceof Set?e.size>0:typeof e==`object`?Object.keys(e).length>0:!!e}function _f(e,t){return{eq:{fn:(e,...t)=>t.some(t=>bf(e,t)),argTypes:[`comparable`,`comparable`],arity:{kind:`variadic`}},ne:{fn:(e,t)=>!bf(e,t),argTypes:[`comparable`,`comparable`],arity:{kind:`exact`}},lt:{fn:(e,t)=>xf(e,t)<0,argTypes:[`ordered`,`ordered`],arity:{kind:`exact`}},le:{fn:(e,t)=>xf(e,t)<=0,argTypes:[`ordered`,`ordered`],arity:{kind:`exact`}},gt:{fn:(e,t)=>xf(e,t)>0,argTypes:[`ordered`,`ordered`],arity:{kind:`exact`}},ge:{fn:(e,t)=>xf(e,t)>=0,argTypes:[`ordered`,`ordered`],arity:{kind:`exact`}},len:{fn:e=>Sf(e),argTypes:[`sized`],arity:{kind:`exact`}},index:{fn:(e,...t)=>{let n=e;for(let e of t)n=Cf(n,e);return n},argTypes:[`collection`,`index-key`],arity:{kind:`variadic`}},slice:{fn:(e,...t)=>Tf(e,t),argTypes:[`sliceable`,`int`],arity:{kind:`variadic`}},print:{fn:(...t)=>Of(t,e),argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},println:{fn:(...t)=>`${Of(t,e)}\n`,argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},printf:{fn:(n,...r)=>Lf(n,r,e,t),argTypes:[`string`,`stringifiable`],arity:{kind:`variadic`},returnType:`string`},toString:{fn:n=>Bf(n,e,t),argTypes:[`value`],arity:{kind:`exact`},returnType:`string`},toStrings:{fn:n=>n.map(n=>Bf(n,e,t)),argTypes:[`list`],arity:{kind:`exact`}},call:{fn:(e,...t)=>e(...t),argTypes:[`callable`,`value`],arity:{kind:`variadic`}},html:{fn:(...t)=>jf(Of(t,e)),argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},js:{fn:(...t)=>Pf(Of(t,e)),argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},urlquery:{fn:(...t)=>If(Of(t,e)),argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},not:{fn:e=>!gf(e),argTypes:[`truthy`],arity:{kind:`exact`}}}}function vf(){return{and:mf({argTypes:[`truthy`,`truthy`],arity:{kind:`variadic`},fn:(...e)=>{let t=!0;for(let n of e)if(t=n(),!gf(t))return t;return t}}),or:mf({argTypes:[`truthy`,`truthy`],arity:{kind:`variadic`},fn:(...e)=>{let t=!1;for(let n of e)if(t=n(),gf(t))return t;return t}})}}function yf(e,t){return{..._f(e,t),...vf()}}function bf(e,t){return typeof e==`number`&&typeof t==`bigint`?BigInt(e)===t:typeof e==`bigint`&&typeof t==`number`?e===BigInt(t):ff(e,t)}function xf(e,t){if(typeof e==`bigint`&&typeof t==`bigint`)return e===t?0:e<t?-1:1;if(typeof e==`bigint`||typeof t==`bigint`){let n=typeof e==`bigint`?e:BigInt(Math.trunc(Number(e))),r=typeof t==`bigint`?t:BigInt(Math.trunc(Number(t)));return n===r?0:n<r?-1:1}let n=e,r=t;return n===r?0:n<r?-1:1}function Sf(e){return typeof e==`string`||Array.isArray(e)?e.length:e instanceof Map||e instanceof Set?e.size:Object.keys(e).length}function Cf(e,t){if(Array.isArray(e)||typeof e==`string`){let n=wf(t,e.length);if(n===e.length)throw Error(`index out of range: ${n}`);return e[n]}if(e instanceof Map)return e.get(t);if(typeof e==`object`&&e){if(typeof t!=`string`)throw Error(`index: object index must be string, got ${Ef(t)}`);return e[t]}throw Error(`index: cannot index ${Ef(e)}`)}function wf(e,t){let n=typeof e==`bigint`?Number(e):e;if(typeof n!=`number`||!Number.isInteger(n))throw Error(`cannot index slice/array with type ${Df(e)}`);if(n<0||n>t)throw Error(`index out of range: ${String(e)}`);return n}function Tf(e,t){if(t.length>3)throw Error(`too many slice indexes: ${t.length}`);if(typeof e==`string`&&t.length>2)throw Error(`cannot 3-index slice a string`);let n=e.length,r=[0,n,n];t.forEach((e,t)=>{r[t]=wf(e,n)});let[i,a,o]=r;if(i>a)throw Error(`invalid slice index: ${i} > ${a}`);if(a>o)throw Error(`invalid slice index: ${a} > ${o}`);return e.slice(i,a)}function Ef(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:e instanceof Map?`Map`:typeof e}function Df(e){return e==null?`<nil>`:typeof e==`string`?`string`:typeof e==`boolean`?`bool`:typeof e==`bigint`?`int64`:typeof e==`number`?Number.isInteger(e)?`int`:`float64`:Array.isArray(e)?`[]interface {}`:e instanceof Map||typeof e==`object`?`map[string]interface {}`:typeof e}function Of(e,t){let n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=typeof a==`string`;i>0&&!r&&!o&&(n+=` `),n+=kf(a,t),r=o}return n}function kf(e,t){return e==null?`<nil>`:typeof e==`string`?e:t(e)}const Af={"\0":`�`,'"':`&#34;`,"'":`&#39;`,"&":`&amp;`,"<":`&lt;`,">":`&gt;`};function jf(e){return e.replace(/[\0"'&<>]/g,e=>Af[e]??e)}const Mf={"\\":`\\\\`,"'":`\\'`,'"':`\\"`,"<":`\\u003C`,">":`\\u003E`,"&":`\\u0026`,"=":`\\u003D`},Nf=/^[\p{L}\p{M}\p{N}\p{P}\p{S}]$/u;function Pf(e){let t=``;for(let n of e){let e=Mf[n];if(e!==void 0){t+=e;continue}let r=n.codePointAt(0);if(r<32||r>=128&&!Nf.test(n)){t+=`\\u${r.toString(16).toUpperCase().padStart(4,`0`)}`;continue}t+=n}return t}const Ff=new TextEncoder;function If(e){let t=``,n=Ff.encode(e);for(let e of n)e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===45||e===46||e===95||e===126?t+=String.fromCharCode(e):e===32?t+=`+`:t+=`%${e.toString(16).toUpperCase().padStart(2,`0`)}`;return t}function Lf(e,t,n,r){let i=``,a=0,o=0;for(;o<e.length;){let s=e[o];if(s!==`%`){i+=s,o+=1;continue}if(e[o+1]===`%`){i+=`%`,o+=2;continue}let c=o+1;for(;c<e.length&&`+-# 0`.includes(e[c]??``);)c+=1;for(;c<e.length&&e[c]!==void 0&&/[0-9]/.test(e[c]);)c+=1;if(e[c]===`.`)for(c+=1;c<e.length&&e[c]!==void 0&&/[0-9]/.test(e[c]);)c+=1;let l=e[c],u=e.slice(o+1,c),d=t[a++];i+=Rf(l??``,u,d,n,r),o=c+1}return i}function Rf(e,t,n,r,i){switch(e){case`s`:return typeof n==`string`?zf(t,n):zf(t,kf(n,r));case`d`:return typeof n!=`number`&&typeof n!=`bigint`?`%!${e}(${Df(n)}=${kf(n,r)})`:zf(t,String(typeof n==`bigint`?n:Math.trunc(n)));case`v`:return zf(t,Bf(n,r,i));case`q`:return zf(t,JSON.stringify(kf(n,r)));case`f`:{if(typeof n!=`number`&&typeof n!=`bigint`)return`%!${e}(${Df(n)}=${kf(n,r)})`;let i=t.includes(`.`)?Number(t.split(`.`)[1]):6;return zf(t,Number(n).toFixed(i))}case`t`:return zf(t,gf(n)?`true`:`false`);case`x`:if(typeof n==`string`){let e=new TextEncoder().encode(n),r=``;for(let t of e)r+=t.toString(16).padStart(2,`0`);return zf(t,r)}return typeof n!=`number`&&typeof n!=`bigint`?`%!${e}(${Df(n)}=${kf(n,r)})`:typeof n==`bigint`?zf(t,n.toString(16)):zf(t,Math.trunc(n).toString(16));default:return`%!${e}(${Df(n)}=${kf(n,r)})`}}function zf(e,t){let n=e.match(/^([+\-# 0]*)/)?.[1]??``,r=e.slice(n.length).match(/^(\d+)/);if(!r)return t;let i=Number(r[1]);if(t.length>=i)return t;let a=` `.repeat(i-t.length);return n.includes(`-`)?t+a:a+t}function Bf(e,t,n){return e==null?`<nil>`:typeof e==`string`?e:n(e)?t(e):Array.isArray(e)?`[${e.map(e=>Bf(e,t,n)).join(` `)}]`:e instanceof Map?Vf([...e.entries()],t,n):Hf(e)?Vf(Object.entries(e),t,n):String(e)}function Vf(e,t,n){let r=e=>Bf(e,t,n),i=e=>typeof e==`number`||typeof e==`bigint`,a=([e],[t])=>{if(i(e)&&i(t))return e<t?-1:+(e>t);if(i(e)!==i(t))return i(e)?-1:1;let[n,a]=[r(e),r(t)];return n<a?-1:+(n>a)};return`map[${[...e].sort(a).map(([e,t])=>`${r(e)}:${r(t)}`).join(` `)}]`}function Hf(e){if(typeof e!=`object`||!e||Array.isArray(e)||e instanceof Map||e instanceof Set)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Uf(e){return{dot:e,root:e,parent:void 0,vars:new Map}}function Wf(e,t){return{dot:t,root:e.root,parent:e,vars:new Map}}function Gf(e,t){let n=e;for(;n!==void 0;){if(n.vars.has(t))return{found:!0,value:n.vars.get(t)};n=n.parent}return{found:!1}}function Kf(e,t,n){e.vars.set(t,n)}const qf=[`string`,`int`,`truncating-int`,`float`,`bool`,`T`,`ordered`,`list`,`dict`,`sized`,`comparable`,`stringifiable`,`liftable`,`callable`,`collection`,`index-key`,`sliceable`,`truthy`,`reflective`,`value`,`serializable`],Jf=new Set([`default`,`zero`,`error`]);function Yf(e){if(e===void 0)return`default`;if(Jf.has(e))return e;throw Error(`EngineConfig.missingKey: expected "default" | "zero" | "error", got ${Xf(e)}`)}function Xf(e){return typeof e==`string`?JSON.stringify(e):e===null?`null`:e===void 0?`undefined`:typeof e==`bigint`?`${e}n`:typeof e==`number`||typeof e==`boolean`?String(e):typeof e==`symbol`?e.toString():typeof e==`function`?`[Function]`:`[${typeof e}]`}function Zf(e){if(e!==void 0){if(typeof e!=`object`||!e)throw Error(`EngineConfig.delims: expected { left, right } object, got ${Xf(e)}`);if(typeof e.left!=`string`||e.left.length===0)throw Error(`EngineConfig.delims.left: expected non-empty string, got ${Xf(e.left)}`);if(typeof e.right!=`string`||e.right.length===0)throw Error(`EngineConfig.delims.right: expected non-empty string, got ${Xf(e.right)}`);return{left:e.left,right:e.right}}}function Qf(e){switch(e.kind){case`exact`:return!1;case`variadic`:return!0;case`alternating`:return!0}}function $f(e){let t=new Set(qf);for(let[n,r]of Object.entries(e)){if(r.argTypes.forEach((e,r)=>{if(!t.has(e))throw Error(`EngineConfig.funcs.${n}: argTypes[${r}] is ${JSON.stringify(e)}, which is not an ArgType; declare one of ${qf.join(`, `)}`)}),Qf(r.arity)&&r.argTypes.length===0)throw Error(`EngineConfig.funcs.${n}: arity ${JSON.stringify(r.arity.kind)} needs at least one declared argType (it reads its repeating slot from the end of argTypes); declare the slots the Go signature has, or use { kind: "exact" }`);if(r.arity.kind===`alternating`&&(!Number.isSafeInteger(r.arity.minimum)||r.arity.minimum<0))throw Error(`EngineConfig.funcs.${n}: arity "alternating" needs a non-negative integer minimum, got ${String(r.arity.minimum)}; the gate rejects every count below it, so a negative or non-finite minimum would disable the lower bound`)}return e}const ep=Object.freeze({kind:`break`}),tp=Object.freeze({kind:`continue`}),np={kind:`none`};let rp;(class e{source;_evaluate;_defines;_referencedFunctions;_referencedCalls;constructor(e,t,n,r,i){this.source=e,this._evaluate=t,this._defines=n,this._referencedFunctions=r,this._referencedCalls=i}static{rp=(t,n,r,i,a)=>new e(t,n,r,i,a)}defines(){return this._defines}evaluate(e){return this._evaluate(e)}referencedFunctions(){return this._referencedFunctions}referencedCalls(){return this._referencedCalls}});function ip(e){let t=new Set,n=e=>{sf(e,e=>{e.type===`Identifier`&&t.add(e.ident)})};n(e.root);for(let t of e.ownDefines.values())n(t.list);return t}const ap={kind:`dynamic`};function op(e){switch(e.type){case`String`:return{kind:`literal`,value:e.value};case`Bool`:return{kind:`literal`,value:e.value};case`Nil`:return{kind:`literal`,value:null};case`Number`:{let t=Dp(e);return typeof t==`number`||typeof t==`bigint`?{kind:`literal`,value:t}:ap}case`Pipe`:{if(e.decls.length!==0||e.cmds.length!==1)return ap;let t=e.cmds[0];if(t===void 0)return ap;let n=t.args[0];return n===void 0||n.type!==`Identifier`?ap:{kind:`call`,name:n.ident,args:t.args.slice(1).map(op)}}default:return ap}}function sp(e){let t=[],n=e=>{sf(e,e=>{if(e.type!==`Command`)return;let n=e.args[0];if(n===void 0||n.type!==`Identifier`)return;let r=e.args.slice(1).map(op);t.push({name:n.ident,args:r.map(e=>e.kind===`literal`&&typeof e.value==`string`?e.value:null),argExprs:r})})};n(e.root);for(let t of e.ownDefines.values())n(t.list);return t}var cp=class{fromString;toString;isT;funcs;missingKey;delims;constructor(e){this.fromString=e.fromString;let t=Object.hasOwn(e,`toString`)?e.toString:void 0;this.toString=t??gp,this.isT=e.isT??lp,this.missingKey=Yf(e.missingKey),this.delims=Zf(e.delims),this.funcs=$f({...yf(this.toString,this.isT),...e.funcs??{}})}parse(e,t){let n=Kd(e,this.delims,t);return rp(n.source,e=>this.evalParsed(n,e),n.defines,ip(n),sp(n))}compile(e){let t=this.parse(e);return e=>t.evaluate(e)}evaluate(e,t){return e.evaluate(t)}evalParsed(e,t){let n=[],r=Uf(t),i={out:n,defines:e.defines,source:e.source};return this.evalList(e.root,r,i),n}evalList(e,t,n){for(let r of e.nodes)this.evalNode(r,t,n)}evalNode(e,t,n){switch(e.type){case`Text`:n.out.push(this.fromString(e.text));return;case`Comment`:return;case`Action`:{let r=this.evalAction(e,t,n);e.pipe.decls.length===0&&this.emitFromValue(r,n);return}case`List`:this.evalList(e,t,n);return;case`If`:this.evalIf(e,t,n);return;case`Range`:this.evalRange(e,t,n);return;case`With`:this.evalWith(e,t,n);return;case`Break`:throw ep;case`Continue`:throw tp;case`Template`:this.evalTemplateInvoke(e,t,n);return;case`Block`:this.evalBlock(e,t,n);return;case`Pipe`:case`Command`:case`Identifier`:case`Field`:case`Variable`:case`Chain`:case`Dot`:case`Nil`:case`Bool`:case`Number`:case`String`:throw new yd(`unexpected ${e.type} at statement position`,e.pos,{source:n.source});default:kd(e)}}evalIf(e,t,n){gf(this.evalPipe(e.pipe,t,n))?this.evalList(e.list,t,n):e.elseList&&this.evalList(e.elseList,t,n)}evalWith(e,t,n){let r=this.evalPipe(e.pipe,t,n);if(gf(r)){let i=Wf(t,r);this.evalList(e.list,i,n)}else e.elseList&&this.evalList(e.elseList,t,n)}evalRange(e,t,n){let r=this.evalPipeWithoutDecls(e.pipe,t,n),i=e.pipe.decls,a=wp(r);try{if(a.length===0){e.elseList&&this.evalList(e.elseList,t,n);return}for(let[r,o]of a){let a=Wf(t,o);if(i.length===1)Kf(a,i[0]?.idents[0]??`$`,o);else if(i.length>=2){let e=i[0]?.idents[0]??`$`,t=i[1]?.idents[0]??`$`;Kf(a,e,r),Kf(a,t,o)}try{this.evalList(e.list,a,n)}catch(e){if(e===tp)continue;throw e}}}catch(e){if(e===ep)return;throw e}}evalTemplateInvoke(e,t,n){let r=Wd(n.defines,e.name);if(!r)throw new yd(`template ${JSON.stringify(e.name)} is not defined`,e.pos,{source:n.source});let i=Wf(t,e.pipe?this.evalPipe(e.pipe,t,n):t.dot);this.evalList(r.list,i,{out:n.out,defines:n.defines,source:r.source})}evalBlock(e,t,n){let r=Wf(t,e.pipe?this.evalPipe(e.pipe,t,n):t.dot),i=Wd(n.defines,e.name)??{list:e.list,source:n.source};this.evalList(i.list,r,{out:n.out,defines:n.defines,source:i.source})}evalAction(e,t,n){return this.evalPipe(e.pipe,t,n)}evalPipe(e,t,n){if(e.cmds.length===0)throw new yd(`empty pipeline`,e.pos,{source:n.source});let r=this.evalCommand(e.cmds[0],t,n,np);for(let i=1;i<e.cmds.length;i++){let a=e.cmds[i];r=this.evalCommand(a,t,n,{kind:`value`,value:r})}if(e.decls.length>0)for(let n of e.decls)Kf(t,n.idents[0]??`$`,r);return r}evalPipeWithoutDecls(e,t,n){let r={type:`Pipe`,pos:e.pos,decls:[],isAssign:!1,cmds:e.cmds};return this.evalPipe(r,t,n)}evalCommand(e,t,n,r){if(e.args.length===0)throw new yd(`empty command`,e.pos,{source:n.source});let i=e.args[0];if(i.type!==`Identifier`){if(e.args.length>1)throw new yd(`cannot apply arguments to a ${i.type} primary; only functions take arguments`,e.pos,{source:n.source});return this.evalPrimary(i,t,n)}let a=this.funcs[i.ident];if(!a)throw new bd(i.ident,i.pos,{source:n.source,available:Object.keys(this.funcs)});let o=e.args.slice(1),s=hf(a),c=o.map(e=>s?()=>this.evalPrimary(e,t,n):this.evalPrimary(e,t,n));if(r.kind===`value`){let e=r.value;c.push(s?()=>e:e)}return this.invoke(i.ident,a,c,e.pos,n)}invoke(e,t,n,r,i){dp(e,t,n,r,i.source,this.toString,this.fromString,this.isT);try{return t.fn(...n)}catch(t){throw t instanceof Sd?new Sd(t.funcName,t.argIndex,t.expected,t.receivedSummary,r,{source:i.source}):t instanceof Td?new Td(t.message,r,{source:i.source}):t instanceof _d?t:new yd(`error calling ${e}: ${Sp(t)}`,r,{source:i.source,cause:t})}}evalPrimary(e,t,n){switch(e.type){case`Dot`:return t.dot;case`Nil`:return null;case`Bool`:return e.value;case`Number`:return Dp(e);case`String`:return e.value;case`Field`:return this.resolveFieldChain(t.dot,e.idents,e.pos,n);case`Variable`:return this.resolveVariable(e.idents,t,e.pos,n);case`Identifier`:{let t=this.funcs[e.ident];if(!t)throw new bd(e.ident,e.pos,{source:n.source,available:Object.keys(this.funcs)});return this.invoke(e.ident,t,[],e.pos,n)}case`Chain`:return this.resolveFieldChain(this.evalPrimary(e.node,t,n),e.fields,e.pos,n);case`Pipe`:return this.evalPipe(e,t,n);default:throw new yd(`cannot evaluate ${e.type} as a value`,e.pos,{source:n.source})}}resolveFieldChain(e,t,n,r){let i=df(e,t);if(i!==lf)return i;if(this.missingKey===`error`)throw new wd(t,n,{source:r.source})}resolveVariable(e,t,n,r){let i=e[0]??`$`;if(i===`$`){let i=e.slice(1);return i.length===0?t.root:this.resolveFieldChain(t.root,i,n,r)}let a=Gf(t,i);if(!a.found)throw new yd(`undefined variable ${i}`,n,{source:r.source});let o=e.slice(1);return o.length===0?a.value:this.resolveFieldChain(a.value,o,n,r)}emitFromValue(e,t){if(e==null){t.out.push(this.fromString(`<no value>`));return}if(typeof e==`string`){t.out.push(this.fromString(e));return}if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`){t.out.push(this.fromString(String(e)));return}if(this.isT(e)){t.out.push(e);return}t.out.push(this.fromString(Bf(e,this.toString,this.isT)))}};const lp=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Map);function up(e){return new cp(e)}function dp(e,t,n,r,i,a=gp,o=hp,s=lp){let{argTypes:c,arity:l}=t,u=fp(c,l);if(n.length<u.minimum||n.length>u.maximum)throw new xd(e,u,n.length,r,{source:i});let d=pp(c,l),f=-1,p=-1;for(let t=0;t<n.length;t++){let c=d(t),l=n[t];if(!mp(c,l,a,s))throw(c===`int`||c===`truncating-int`)&&(typeof l==`number`||typeof l==`bigint`)?new Cd(e,t+1,l,r,{source:i}):new Sd(e,t+1,xp(c),Cp(l),r,{source:i});if(c===`liftable`&&typeof l==`string`&&(n[t]=o(l)),c===`truncating-int`?n[t]=Math.trunc(Number(l)):(c===`int`||c===`float`)&&(n[t]=Number(l)),c===`ordered`){if(f===-1)f=t;else if(!vp(n[f],l))throw new Sd(e,t+1,`${xp(`ordered`)} of the same kind as ${Cp(n[f])}`,Cp(l),r,{source:i})}if(c===`comparable`){if(p===-1)p=t;else if(!yp(n[p],l))throw new Sd(e,t+1,`${xp(`comparable`)} of the same kind as ${Cp(n[p])}`,Cp(l),r,{source:i})}}}function fp(e,t){switch(t.kind){case`exact`:return{minimum:e.length,maximum:e.length};case`variadic`:return{minimum:e.length-1,maximum:1/0};case`alternating`:return{minimum:t.minimum,maximum:1/0}}}function pp(e,t){let n=e.length;switch(t.kind){case`exact`:return t=>e[t];case`variadic`:return t=>e[Math.min(t,n-1)];case`alternating`:return t=>e[t%n]}}function mp(e,t,n,r){switch(e){case`truthy`:case`reflective`:case`value`:return!0;case`string`:return typeof t==`string`;case`int`:return typeof t==`number`&&Number.isSafeInteger(t)||typeof t==`bigint`&&Number.isSafeInteger(Number(t));case`truncating-int`:return typeof t==`number`&&Number.isFinite(t)||typeof t==`bigint`&&Number.isSafeInteger(Number(t));case`float`:return typeof t==`number`||typeof t==`bigint`&&Number.isFinite(Number(t));case`bool`:return typeof t==`boolean`;case`ordered`:return typeof t==`string`||typeof t==`number`||typeof t==`bigint`||typeof t==`boolean`;case`T`:return r(t);case`list`:return Array.isArray(t);case`dict`:return Hf(t);case`sized`:return typeof t==`string`||Array.isArray(t)||t instanceof Map||t instanceof Set||Hf(t);case`comparable`:return t==null||typeof t==`string`||typeof t==`number`||typeof t==`bigint`||typeof t==`boolean`||Array.isArray(t)||t instanceof Map||t instanceof Set||Hf(t);case`callable`:return typeof t==`function`;case`collection`:return typeof t==`string`||Array.isArray(t)||t instanceof Map||Hf(t);case`index-key`:return typeof t==`string`||typeof t==`number`||typeof t==`bigint`;case`sliceable`:return typeof t==`string`||Array.isArray(t);case`stringifiable`:if(typeof t==`string`)return!0;try{return n(t),!0}catch{return!1}case`liftable`:return typeof t==`string`||r(t);case`serializable`:return _p(t);default:throw Error(`invalid ArgType: ${String(e)}`)}}function hp(e){return e}function gp(e){if(typeof e==`string`)return e;if(e==null)return`<nil>`;if(typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`)return String(e);throw new Sd(`<engine.toString>`,1,`string (or a consumer-supplied toString that flattens T)`,Cp(e),{line:0,column:0,offset:0})}function _p(e){try{return JSON.stringify(e)!==void 0}catch{return!1}}function vp(e,t){return typeof e==typeof t||typeof e==`number`&&typeof t==`bigint`||typeof e==`bigint`&&typeof t==`number`}function yp(e,t){let n=bp(e),r=bp(t);return n===`nil`||r===`nil`?!0:n===r}function bp(e){return e==null?`nil`:typeof e==`string`?`string`:typeof e==`number`||typeof e==`bigint`?`number`:typeof e==`boolean`?`boolean`:Array.isArray(e)?`array`:e instanceof Map?`map`:e instanceof Set?`set`:`object`}function xp(e){switch(e){case`int`:return`integer (safe-integer number or bigint)`;case`truncating-int`:return`integer (finite number, truncated toward zero, or safe-integer bigint)`;case`float`:return`float (number, including NaN/Infinity, or finite-convertible bigint)`;case`T`:return`T (consumer-defined fragment)`;case`ordered`:return`orderable primitive`;case`list`:return`list`;case`dict`:return`dict (plain object)`;case`sized`:return`sized value (string, list, map, set, or dict)`;case`comparable`:return`comparable value (orderable primitive, nil, list, dict, Map, or Set)`;case`stringifiable`:return`stringifiable value (string or convertible via the engine's toString)`;case`liftable`:return`liftable value (T or string, the latter lifted via the engine's fromString)`;case`callable`:return`callable (function value)`;case`collection`:return`collection (string, array, Map, or dict)`;case`index-key`:return`index key (number, bigint, or string)`;case`sliceable`:return`sliceable value (string or array)`;case`serializable`:return`JSON-serializable value`;case`truthy`:case`reflective`:case`value`:case`string`:case`bool`:return e;default:throw Error(`invalid ArgType: ${String(e)}`)}}function Sp(e){return e instanceof Error?e.message:String(e)}function Cp(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:e instanceof Map?`Map`:typeof e}function wp(e){return e==null?[]:Array.isArray(e)?e.map((e,t)=>[t,e]):typeof e==`string`?[...e].map((e,t)=>[t,e]):e instanceof Map?Tp([...e.entries()]):e instanceof Set?[...e.values()].map((e,t)=>[t,e]):typeof e==`object`?Tp(Object.entries(e)):[]}function Tp(e){return[...e].sort((e,t)=>Ep(e[0],t[0]))}function Ep(e,t){if((typeof e==`number`||typeof e==`bigint`)&&(typeof t==`number`||typeof t==`bigint`)){let n=typeof e==`bigint`?Number(e):e,r=typeof t==`bigint`?Number(t):t;return n===r?0:n<r?-1:1}let n=String(e),r=String(t);return n===r?0:n<r?-1:1}function Dp(e){if(e.intValue!==void 0){let t=e.intValue;return t>=BigInt(-(2**53-1))&&t<=BigInt(2**53-1)?Number(t):t}if(e.floatValue!==void 0)return e.floatValue;if(e.complexValue!==void 0)return e.complexValue;throw Error(`internal: NumberNode has none of intValue/floatValue/complexValue — parser invariant violated`)}function Op(e){if(!/^[+-]?\d+$/.test(e))return 0;let t=Number.parseInt(e,10);return Number.isSafeInteger(t)?t:0}function kp(e){if(typeof e==`number`)return e;if(typeof e==`bigint`)return Number(e);if(typeof e==`string`){let t=Number.parseFloat(e);return Number.isNaN(t)?0:t}return typeof e==`boolean`?+!!e:0}function Ap(e){if(e===``)return null;let t=1,n=e;return n[0]===`+`?n=n.slice(1):n[0]===`-`&&(t=-1,n=n.slice(1)),n===``?null:/^0x[0-9a-fA-F]+$/i.test(n)?{sign:t,digits:n.slice(2),base:16}:/^0b[01]+$/i.test(n)?{sign:t,digits:n.slice(2),base:2}:/^0o[0-7]+$/i.test(n)?{sign:t,digits:n.slice(2),base:8}:n===`0`?{sign:t,digits:`0`,base:10}:n[0]===`0`?/^0[0-7]+$/.test(n)?{sign:t,digits:n.slice(1),base:8}:null:/^[0-9]+$/.test(n)?{sign:t,digits:n,base:10}:null}function jp(e){if(typeof e==`number`){let t=Math.trunc(e);return Number.isSafeInteger(t)?t:0}if(typeof e==`bigint`){let t=Number(e);return Number.isSafeInteger(t)?t:0}if(typeof e==`string`){let t=Ap(e);if(t===null)return 0;let n=t.sign*Number.parseInt(t.digits,t.base);return Number.isSafeInteger(n)?n:0}return typeof e==`boolean`?+!!e:0}function Mp(e){if(typeof e==`bigint`)return e;if(typeof e==`number`)return BigInt(Math.trunc(e));if(typeof e==`string`){let t=Ap(e);if(t===null)return 0n;let n=t.base===16?`0x`:t.base===2?`0b`:t.base===8?`0o`:``,r=BigInt(n+t.digits);return t.sign===-1?-r:r}return typeof e==`boolean`&&e?1n:0n}function Np(e){if(!/^[+-]?[0-7]+$/.test(e))return 0;let t=e[0]===`-`?-1:1,n=e[0]===`+`||e[0]===`-`?e.slice(1):e,r=t*Number.parseInt(n,8);return Number.isSafeInteger(r)?r:0}function Pp(e){return JSON.stringify(e)??`null`}function Fp(){return{atoi:{fn:e=>Op(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`int`},int:{fn:e=>jp(e),argTypes:[`value`],arity:{kind:`exact`},returnType:`int`},int64:{fn:e=>Mp(e),argTypes:[`value`],arity:{kind:`exact`}},float64:{fn:e=>kp(e),argTypes:[`value`],arity:{kind:`exact`},returnType:`float`},toDecimal:{fn:e=>Np(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`int`},toRawJson:{fn:e=>Pp(e),argTypes:[`serializable`],arity:{kind:`exact`},returnType:`string`}}}const Ip={h:36e11,m:6e10,s:1e9,ms:1e6,us:1e3,µs:1e3,ns:1};function Lp(e){if(e===`0`)return 0;let t=!1,n=e;if(n.startsWith(`-`)?(t=!0,n=n.slice(1)):n.startsWith(`+`)&&(n=n.slice(1)),!n)return NaN;let r=0,i=/^(\d+(?:\.\d+)?)(ns|µs|us|ms|[smh])/;for(;n.length>0;){let e=i.exec(n);if(!e)return NaN;let t=parseFloat(e[1]??`0`),a=e[2];r+=t*Ip[a],n=n.slice(e[0].length)}return t?-r:r}function Rp(e){if(e===0)return`0s`;let t=!1,n=e;n<0&&(t=!0,n=-n);let r;return r=n<Ip.us?`${Math.floor(n)}ns`:n<Ip.ms?zp(n,Ip.us,3,`µs`):n<Ip.s?zp(n,Ip.ms,6,`ms`):Bp(n),t?`-${r}`:r}function zp(e,t,n,r){let i=Math.floor(e/t),a=Math.round(e%t);return a===0?`${i}${r}`:`${i}.${String(a).padStart(n,`0`).replace(/0+$/,``)}${r}`}function Bp(e){let t=Math.floor(e/Ip.h);e-=t*Ip.h;let n=Math.floor(e/Ip.m);e-=n*Ip.m;let r=Math.floor(e/Ip.s),i=e-r*Ip.s,a=i===0?`${r}s`:`${r}.${String(Math.round(i)).padStart(9,`0`).replace(/0+$/,``)}s`;return t>0?`${t}h${n}m${a}`:n>0?`${n}m${a}`:a}function Vp(e){return e*Ip.s}function Hp(e){if(e instanceof Date)return e;if(typeof e==`bigint`)return new Date(Number(e)*1e3);if(typeof e==`number`)return new Date(e*1e3);if(typeof e==`string`){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t;throw Error(`sprig: cannot parse date value ${JSON.stringify(e)}`)}throw Error(`sprig: unsupported date type: ${typeof e}`)}function Up(e,t){let n=t().getTime()-Hp(e).getTime();return Rp(Math.round(n/1e3)*1e9)}const Wp=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Gp=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Kp=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],qp=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Jp(e){return e<10?`0${e}`:String(e)}function Yp(e){return e<10?`00${e}`:e<100?`0${e}`:String(e)}function Xp(e){return e<10?` ${e}`:String(e)}function Zp(e){let t=e>=0?`+`:`-`,n=Math.abs(e);return`${t}${Jp(Math.floor(n/60))}${Jp(n%60)}`}function Qp(e){let t=e>=0?`+`:`-`,n=Math.abs(e);return`${t}${Jp(Math.floor(n/60))}:${Jp(n%60)}`}function $p(e){return`${e>=0?`+`:`-`}${Jp(Math.floor(Math.abs(e)/60))}`}function em(e){return e===0?`Z`:Zp(e)}function tm(e){return e===0?`Z`:Qp(e)}function nm(e){return e===0?`Z`:$p(e)}function rm(e,t,n){let r=e*1e6,i=String(r).padStart(9,`0`).slice(0,t);return n?i.replace(/0+$/,``):i}const im=[[`.000000000`,e=>`.${rm(e.ms,9,!1)}`],[`.999999999`,e=>{let t=rm(e.ms,9,!0);return t?`.${t}`:``}],[`.000000`,e=>`.${rm(e.ms,6,!1)}`],[`.999999`,e=>{let t=rm(e.ms,6,!0);return t?`.${t}`:``}],[`.000`,e=>`.${Yp(e.ms)}`],[`.999`,e=>{let t=Yp(e.ms).replace(/0+$/,``);return t?`.${t}`:``}],[`January`,e=>Wp[e.month-1]??`January`],[`Monday`,e=>Kp[e.weekday]??`Monday`],[`Z07:00`,e=>tm(e.offsetMinutes)],[`-07:00`,e=>Qp(e.offsetMinutes)],[`Z0700`,e=>em(e.offsetMinutes)],[`-0700`,e=>Zp(e.offsetMinutes)],[`2006`,e=>String(e.year)],[`Jan`,e=>Gp[e.month-1]??`Jan`],[`Mon`,e=>qp[e.weekday]??`Mon`],[`MST`,e=>e.tzAbbr],[`-07`,e=>$p(e.offsetMinutes)],[`Z07`,e=>nm(e.offsetMinutes)],[`15`,e=>Jp(e.hour)],[`01`,e=>Jp(e.month)],[`02`,e=>Jp(e.day)],[`_2`,e=>Xp(e.day)],[`03`,e=>Jp(e.hour12)],[`04`,e=>Jp(e.minute)],[`05`,e=>Jp(e.second)],[`06`,e=>Jp(e.year%100)],[`PM`,e=>e.hour>=12?`PM`:`AM`],[`pm`,e=>e.hour>=12?`pm`:`am`],[`1`,e=>String(e.month)],[`2`,e=>String(e.day)],[`3`,e=>String(e.hour12)],[`4`,e=>String(e.minute)],[`5`,e=>String(e.second)]];function am(e,t){let n=``,r=0;for(;r<e.length;){let i=!1;for(let[a,o]of im)if(e.startsWith(a,r)){n+=o(t),r+=a.length,i=!0;break}i||(n+=e[r++])}return n}const om={year:`numeric`,month:`2-digit`,day:`2-digit`,weekday:`long`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1};function sm(e){let t=new Map;for(let n of e)t.set(n.type,n.value);return t}const cm=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function lm(e,t){let n;try{new Intl.DateTimeFormat(`en-US`,{timeZone:t}),n=t}catch{n=`UTC`}let r=sm(new Intl.DateTimeFormat(`en-US`,{...om,timeZone:n}).formatToParts(e)),i=parseInt(r.get(`hour`)??`0`,10)%24,a=sm(new Intl.DateTimeFormat(`en-US`,{timeZone:n,timeZoneName:`short`}).formatToParts(e)).get(`timeZoneName`)??n,o=um(sm(new Intl.DateTimeFormat(`en-US`,{timeZone:n,timeZoneName:`shortOffset`}).formatToParts(e)).get(`timeZoneName`)??`GMT`),s=cm.indexOf(r.get(`weekday`)??`Sunday`);return{year:parseInt(r.get(`year`)??`2000`,10),month:parseInt(r.get(`month`)??`1`,10),day:parseInt(r.get(`day`)??`1`,10),weekday:s===-1?0:s,hour:i,hour12:i%12||12,minute:parseInt(r.get(`minute`)??`0`,10),second:parseInt(r.get(`second`)??`0`,10),ms:e.getUTCMilliseconds(),tzAbbr:a,offsetMinutes:o}}function um(e){if(e===`GMT`||e===`UTC`)return 0;let t=e.match(/^GMT([+-])(\d{1,2})(?::(\d{2}))?$/);if(!t)return 0;let n=t[1]===`+`?1:-1,r=parseInt(t[2]??`0`,10),i=parseInt(t[3]??`0`,10);return n*(r*60+i)}function dm(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function fm(e,t){return am(e,lm(Hp(t),dm()))}function pm(e,t,n){return am(e,lm(Hp(t),n))}function mm(e,t){let n=Hp(t),r=Lp(e);return Number.isNaN(r)?n:new Date(n.getTime()+r/1e6)}function hm(e){if(typeof e==`string`){let t=parseInt(e,10);return Number.isNaN(t)?`0s`:Rp(Vp(t))}return typeof e==`bigint`?Rp(Vp(Number(e))):typeof e==`number`?Rp(Vp(e)):`0s`}const gm=36e11*24*365,_m=36e11*24*30,vm=36e11*24,ym=36e11,bm=6e10,xm=1e9;function Sm(e){let t=Lp(String(e));if(Number.isNaN(t))return`0s`;let n=Math.abs(t);return n>gm?`${Math.floor(n/gm)}y`:n>_m?`${Math.floor(n/_m)}mo`:n>vm?`${Math.floor(n/vm)}d`:n>ym?`${Math.floor(n/ym)}h`:n>bm?`${Math.floor(n/bm)}m`:n>xm?`${Math.floor(n/xm)}s`:`0s`}function Cm(e){let t=lm(Hp(e),dm());return`${t.year}-${String(t.month).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`}function wm(e,t){let n=lm(Hp(e),t);return`${n.year}-${String(n.month).padStart(2,`0`)}-${String(n.day).padStart(2,`0`)}`}function Tm(e){return e()}const Em=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Dm=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function Om(){return{year:2e3,month:1,day:1,hour:0,minute:0,second:0,ms:0,offsetMinutes:0,isPM:!1,hour12:!1}}function km(e,t,n){return[e.slice(t,t+n),t+n]}function Am(e,t,n,r){let i=t;for(;i<e.length&&i-t<r&&e.charCodeAt(i)>=48&&e.charCodeAt(i)<=57;)i++;if(i-t<n)throw Error(`sprig toDate: expected ${n}-${r} digits at pos ${t}`);return[parseInt(e.slice(t,i),10),i]}function jm(e,t){for(let[n,r]of Em.entries())if(e.startsWith(r,t))return[n+1,t+r.length];throw Error(`sprig toDate: expected month name at pos ${t}`)}function Mm(e,t){for(let[n,r]of Dm.entries())if(e.startsWith(r,t))return[n+1,t+r.length];throw Error(`sprig toDate: expected short month name at pos ${t}`)}function Nm(e,t){for(let n of[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`])if(e.startsWith(n,t))return t+n.length;throw Error(`sprig toDate: expected weekday name at pos ${t}`)}function Pm(e,t){for(let n of[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`])if(e.startsWith(n,t))return t+n.length;throw Error(`sprig toDate: expected short weekday name at pos ${t}`)}function Fm(e,t){if(e[t]===` `){let[n,r]=Am(e,t+1,1,1);return[n,r]}return Am(e,t,1,2)}function Im(e,t,n){let r=e[t]===`+`?1:e[t]===`-`?-1:0;if(r===0)throw Error(`sprig toDate: expected +/- at pos ${t}`);let i=t+1,[a,o]=Am(e,i,2,2);i=o;let s=0;if(n&&e[i]===`:`){let[t,n]=Am(e,i+1,2,2);s=t,i=n}else if(!n){let[t,n]=Am(e,i,2,2);s=t,i=n}return[r*(a*60+s),i]}function Lm(e,t,n,r){if(e[t]===`Z`)return[0,t+1];if(r){let n=e[t]===`+`?1:e[t]===`-`?-1:0;if(n===0)throw Error(`sprig toDate: expected Z or +/- at pos ${t}`);let[r,i]=Am(e,t+1,2,2);return[n*r*60,i]}return Im(e,t,n)}function Rm(e,t){let n=t;for(;n<e.length&&e.charCodeAt(n)>=65&&e.charCodeAt(n)<=90;)n++;if(n===t)throw Error(`sprig toDate: expected timezone abbreviation at pos ${t}`);return n}function zm(e,t,n){let[r,i]=km(e,t,n),a=parseInt(r.padEnd(9,`0`),10);return[Math.round(a/1e6),i]}function Bm(e,t,n,r){let i={...r};switch(e){case`January`:{let[e,r]=jm(t,n);return i.month=e,[r,i]}case`Monday`:return[Nm(t,n),i];case`Jan`:{let[e,r]=Mm(t,n);return i.month=e,[r,i]}case`Mon`:return[Pm(t,n),i];case`2006`:{let[e,r]=Am(t,n,4,4);return i.year=e,[r,i]}case`06`:{let[e,r]=Am(t,n,2,2);return i.year=e<70?2e3+e:1900+e,[r,i]}case`01`:{let[e,r]=Am(t,n,2,2);return i.month=e,[r,i]}case`1`:{let[e,r]=Am(t,n,1,2);return i.month=e,[r,i]}case`_2`:{let[e,r]=Fm(t,n);return i.day=e,[r,i]}case`02`:{let[e,r]=Am(t,n,2,2);return i.day=e,[r,i]}case`2`:{let[e,r]=Am(t,n,1,2);return i.day=e,[r,i]}case`15`:{let[e,r]=Am(t,n,2,2);return i.hour=e,[r,i]}case`03`:{let[e,r]=Am(t,n,2,2);return i.hour=e,i.hour12=!0,[r,i]}case`3`:{let[e,r]=Am(t,n,1,2);return i.hour=e,i.hour12=!0,[r,i]}case`04`:{let[e,r]=Am(t,n,2,2);return i.minute=e,[r,i]}case`4`:{let[e,r]=Am(t,n,1,2);return i.minute=e,[r,i]}case`05`:{let[e,r]=Am(t,n,2,2);return i.second=e,[r,i]}case`5`:{let[e,r]=Am(t,n,1,2);return i.second=e,[r,i]}case`PM`:case`pm`:{let e=t.slice(n,n+2).toLowerCase();if(e!==`am`&&e!==`pm`)throw Error(`sprig toDate: expected AM/PM at pos ${n}, got ${JSON.stringify(t.slice(n,n+2))}`);return i.isPM=e===`pm`,i.hour12=!0,[n+2,i]}case`MST`:return[Rm(t,n),i];case`-0700`:{let[e,r]=Im(t,n,!1);return i.offsetMinutes=e,[r,i]}case`-07:00`:{let[e,r]=Im(t,n,!0);return i.offsetMinutes=e,[r,i]}case`-07`:{let e=t[n]===`+`?1:t[n]===`-`?-1:0;if(e===0)throw Error(`sprig toDate: expected +/- at pos ${n}`);let[r,a]=Am(t,n+1,2,2);return i.offsetMinutes=e*r*60,[a,i]}case`Z0700`:{let[e,r]=Lm(t,n,!1,!1);return i.offsetMinutes=e,[r,i]}case`Z07:00`:{let[e,r]=Lm(t,n,!0,!1);return i.offsetMinutes=e,[r,i]}case`Z07`:{let[e,r]=Lm(t,n,!1,!0);return i.offsetMinutes=e,[r,i]}case`.000000000`:{if(t[n]!==`.`)throw Error(`sprig toDate: expected . at pos ${n}`);let[e,r]=zm(t,n+1,9);return i.ms=e,[r,i]}case`.999999999`:{if(t[n]!==`.`)return[n,i];let e=n+1,r=e;for(;r<t.length&&t.charCodeAt(r)>=48&&t.charCodeAt(r)<=57;)r++;let a=t.slice(e,r).padEnd(9,`0`);return i.ms=Math.round(parseInt(a,10)/1e6),[r,i]}case`.000000`:{if(t[n]!==`.`)throw Error(`sprig toDate: expected . at pos ${n}`);let[e,r]=zm(t,n+1,6);return i.ms=e,[r,i]}case`.999999`:{if(t[n]!==`.`)return[n,i];let e=n+1,r=e;for(;r<t.length&&t.charCodeAt(r)>=48&&t.charCodeAt(r)<=57;)r++;let a=t.slice(e,r).padEnd(9,`0`);return i.ms=Math.round(parseInt(a,10)/1e6),[r,i]}case`.000`:{if(t[n]!==`.`)throw Error(`sprig toDate: expected . at pos ${n}`);let[e,r]=zm(t,n+1,3);return i.ms=e,[r,i]}case`.999`:{if(t[n]!==`.`)return[n,i];let e=n+1,r=e;for(;r<t.length&&t.charCodeAt(r)>=48&&t.charCodeAt(r)<=57;)r++;let a=t.slice(e,r).padEnd(3,`0`);return i.ms=parseInt(a,10),[r,i]}}throw Error(`sprig toDate: unhandled token ${e}`)}const Vm=`.000000000,.999999999,.000000,.999999,.000,.999,January,Monday,Z07:00,-07:00,Z0700,-0700,2006,Jan,Mon,MST,-07,Z07,15,01,02,_2,03,04,05,06,PM,pm,1,2,3,4,5`.split(`,`);function Hm(e,t){let n=0,r=0,i=Om();for(;n<e.length;){let a=!1;for(let o of Vm)if(e.startsWith(o,n)){let[e,s]=Bm(o,t,r,i);r=e,i=s,n+=o.length,a=!0;break}if(!a){let i=e.charAt(n);if(t[r]!==i)throw Error(`sprig toDate: expected ${JSON.stringify(i)} at pos ${r}, got ${JSON.stringify(t[r])}`);n++,r++}}if(r!==t.length)throw Error(`sprig toDate: extra characters at pos ${r}: ${JSON.stringify(t.slice(r))}`);if(i.hour12){let e=i.hour%12;i.hour=i.isPM?e+12:e}let a=Date.UTC(i.year,i.month-1,i.day,i.hour,i.minute,i.second,i.ms)-i.offsetMinutes*60*1e3;return new Date(a)}function Um(e,t){return Hm(e,t)}function Wm(e){return String(Math.floor(Hp(e).getTime()/1e3))}function Gm(e=()=>new Date){return{now:{fn:()=>Tm(e),argTypes:[],arity:{kind:`exact`}},date:{fn:(e,t)=>fm(e,t),argTypes:[`string`,`value`],arity:{kind:`exact`}},dateInZone:{fn:(e,t,n)=>pm(e,t,n),argTypes:[`string`,`value`,`string`],arity:{kind:`exact`}},dateModify:{fn:(e,t)=>mm(e,t),argTypes:[`string`,`value`],arity:{kind:`exact`}},htmlDate:{fn:e=>Cm(e),argTypes:[`value`],arity:{kind:`exact`}},htmlDateInZone:{fn:(e,t)=>wm(e,t),argTypes:[`value`,`string`],arity:{kind:`exact`}},duration:{fn:e=>hm(e),argTypes:[`value`],arity:{kind:`exact`}},durationRound:{fn:e=>Sm(e),argTypes:[`value`],arity:{kind:`exact`}},toDate:{fn:(e,t)=>Um(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},ago:{fn:t=>Up(t,e),argTypes:[`value`],arity:{kind:`exact`}},unixEpoch:{fn:e=>Wm(e),argTypes:[`value`],arity:{kind:`exact`}}}}function Km(e){return e==null||e===!1?!0:typeof e==`number`?e===0||Number.isNaN(e):typeof e==`bigint`?e===0n:typeof e==`string`||Array.isArray(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:typeof e==`object`?Object.keys(e).length===0:!1}function qm(...e){for(let t of e)if(!Km(t))return t}function Jm(e,t){return Km(t)?e:t}function Ym(e){return JSON.parse(e)}function Xm(e,t,n){return gf(n)?e:t}function Zm(e){return JSON.stringify(e)??`null`}function Qm(e){return JSON.stringify(e,null,2)??`null`}function $m(){return{default:{fn:(e,t)=>Jm(e,t),argTypes:[`value`,`truthy`],arity:{kind:`variadic`}},empty:{fn:e=>Km(e),argTypes:[`truthy`],arity:{kind:`exact`}},coalesce:{fn:(...e)=>qm(...e),argTypes:[`truthy`],arity:{kind:`variadic`}},ternary:{fn:(e,t,n)=>Xm(e,t,n),argTypes:[`value`,`value`,`truthy`],arity:{kind:`exact`}},fromJson:{fn:e=>Ym(e),argTypes:[`string`],arity:{kind:`exact`}},toJson:{fn:e=>Zm(e),argTypes:[`serializable`],arity:{kind:`exact`},returnType:`string`},toPrettyJson:{fn:e=>Qm(e),argTypes:[`serializable`],arity:{kind:`exact`},returnType:`string`}}}function eh(...e){let t={};for(let n=0;n<e.length;n+=2)t[e[n]]=e[n+1];return t}function th(e){if(e.kind!==`call`||e.name!==`dict`||e.args.length%2!=0)return null;let t=[];for(let[n,r]of e.args.entries()){if(r.kind!==`literal`||n%2==0&&typeof r.value!=`string`)return null;t.push(r.value)}return eh(...t)}function nh(e,t){return e[t]}function rh(e,t){return t in e}function ih(e){return Object.keys(e)}function ah(e,...t){let n={...e};for(let e of t)for(let[t,r]of Object.entries(e))t in n||(n[t]=r);return n}function oh(e,...t){let n={...e};for(let e of t)Object.assign(n,e);return n}function sh(e,...t){let n=new Set(t),r={};for(let[t,i]of Object.entries(e))n.has(t)||(r[t]=i);return r}function ch(e,...t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function lh(e,...t){let n=[];for(let r of t)e in r&&n.push(r[e]);return n}function uh(e,t,n){return e[t]=n,e}function dh(e,t){return delete e[t],e}function fh(e){return Object.values(e)}function ph(){return{dict:{fn:(...e)=>eh(...e),argTypes:[`string`,`value`],arity:{kind:`alternating`,minimum:0}},get:{fn:(e,t)=>nh(e,t),argTypes:[`dict`,`string`],arity:{kind:`exact`}},set:{fn:(e,t,n)=>uh(e,t,n),argTypes:[`dict`,`string`,`value`],arity:{kind:`exact`}},unset:{fn:(e,t)=>dh(e,t),argTypes:[`dict`,`string`],arity:{kind:`exact`}},keys:{fn:e=>ih(e),argTypes:[`dict`],arity:{kind:`variadic`}},values:{fn:e=>fh(e),argTypes:[`dict`],arity:{kind:`exact`}},pluck:{fn:(e,...t)=>lh(e,...t),argTypes:[`string`,`dict`],arity:{kind:`variadic`}},pick:{fn:(e,...t)=>ch(e,...t),argTypes:[`dict`,`string`],arity:{kind:`variadic`}},omit:{fn:(e,...t)=>sh(e,...t),argTypes:[`dict`,`string`],arity:{kind:`variadic`}},hasKey:{fn:(e,t)=>rh(e,t),argTypes:[`dict`,`string`],arity:{kind:`exact`}},merge:{fn:(e,...t)=>ah(e,...t),argTypes:[`dict`,`dict`],arity:{kind:`variadic`}},mergeOverwrite:{fn:(e,...t)=>oh(e,...t),argTypes:[`dict`,`dict`],arity:{kind:`variadic`}}}}new TextEncoder,new Map(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`).map((e,t)=>[e,t])),new TextDecoder,new TextEncoder,new TextDecoder,new TextEncoder;function mh(...e){for(let t of e)if(Km(t))return!1;return!0}function hh(...e){for(let t of e)if(!Km(t))return!0;return!1}function gh(e,t){return[...e,t]}function _h(e,t){let n=Math.max(1,e),r=[];for(let e=0;e<t.length;e+=n)r.push(t.slice(e,e+n));return r}function vh(e){return e.filter(e=>!Km(e))}function yh(...e){let t=[];for(let n of e)t.push(...n);return t}const bh={line:0,column:0,offset:0};function xh(e,t,n,r){return new Sd(e,t,n,r,bh)}function Sh(...e){if(e.length<3)throw xh(`dig`,0,`at least 3 arguments (...keys, default, dict)`,`${e.length} argument${e.length===1?``:`s`}`);let t=e[e.length-1],n=e[e.length-2],r=e.slice(0,-2);if(!wh(t))throw xh(`dig`,e.length-1,`dict`,Th(t));for(let e=0;e<r.length;e++)if(typeof r[e]!=`string`)throw xh(`dig`,e,`string`,Th(r[e]));return Ch(t,n,r,e.length)}function Ch(e,t,n,r){let i=n[0];if(!Object.hasOwn(e,i))return t;let a=e[i];if(n.length===1)return a;if(!wh(a))throw xh(`dig`,r-1,`dict at intermediate key`,Th(a));return Ch(a,t,n.slice(1),r)}function wh(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Map)&&!(e instanceof Set)}function Th(e){return e===null?`null`:Array.isArray(e)?`array`:e instanceof Map?`Map`:e instanceof Set?`Set`:typeof e}function Eh(e){return e[0]}function Dh(e,t){return t.some(t=>ff(t,e))}function Oh(e){return e.slice(0,-1)}function kh(e){return e[e.length-1]}function Ah(e){return Array.isArray(e)||typeof e==`string`?e.length:e instanceof Map||e instanceof Set?e.size:Object.keys(e).length}function jh(...e){return e}function Mh(e,t){return[t,...e]}function Nh(e){return e.slice(1)}function Ph(e){return[...e].reverse()}function Fh(e,t,n){let r=t===void 0?0:t,i=n===void 0?e.length:n;return e.slice(r,i)}function Ih(e){let t=[];for(let n of e)n!=null&&t.push(String(n));return t.sort()}function Lh(e){let t=[];for(let n of e)t.some(e=>ff(e,n))||t.push(n);return t}function Rh(e,...t){return e.filter(e=>!t.some(t=>ff(t,e)))}function zh(){return{list:{fn:(...e)=>jh(...e),argTypes:[`value`],arity:{kind:`variadic`}},first:{fn:e=>Eh(e),argTypes:[`list`],arity:{kind:`exact`}},last:{fn:e=>kh(e),argTypes:[`list`],arity:{kind:`exact`}},rest:{fn:e=>Nh(e),argTypes:[`list`],arity:{kind:`exact`}},initial:{fn:e=>Oh(e),argTypes:[`list`],arity:{kind:`exact`}},len:{fn:e=>Ah(e),argTypes:[`sized`],arity:{kind:`exact`}},reverse:{fn:e=>Ph(e),argTypes:[`list`],arity:{kind:`exact`}},uniq:{fn:e=>Lh(e),argTypes:[`list`],arity:{kind:`exact`}},without:{fn:(e,...t)=>Rh(e,...t),argTypes:[`list`,`value`],arity:{kind:`variadic`}},has:{fn:(e,t)=>Dh(e,t),argTypes:[`value`,`list`],arity:{kind:`exact`}},compact:{fn:e=>vh(e),argTypes:[`list`],arity:{kind:`exact`}},slice:{fn:(e,t,n)=>Fh(e,t,n),argTypes:[`list`,`truncating-int`],arity:{kind:`variadic`}},concat:{fn:(...e)=>yh(...e),argTypes:[`list`],arity:{kind:`variadic`}},chunk:{fn:(e,t)=>_h(e,t),argTypes:[`int`,`list`],arity:{kind:`exact`}},prepend:{fn:(e,t)=>Mh(e,t),argTypes:[`list`,`value`],arity:{kind:`exact`}},append:{fn:(e,t)=>gh(e,t),argTypes:[`list`,`value`],arity:{kind:`exact`}},sortAlpha:{fn:e=>Ih(e),argTypes:[`list`],arity:{kind:`exact`},returnType:`list`},push:{fn:(e,t)=>gh(e,t),argTypes:[`list`,`value`],arity:{kind:`exact`}},tuple:{fn:(...e)=>jh(...e),argTypes:[`value`],arity:{kind:`variadic`}},dig:{fn:(...e)=>Sh(...e),argTypes:[`value`],arity:{kind:`variadic`}},all:{fn:(...e)=>mh(...e),argTypes:[`truthy`],arity:{kind:`variadic`},returnType:`bool`},any:{fn:(...e)=>hh(...e),argTypes:[`truthy`],arity:{kind:`variadic`},returnType:`bool`}}}function Bh(...e){return e.reduce((e,t)=>e+t,0)}function Vh(e){return e+1}function Hh(e){return e+1}function Uh(...e){return e.reduce((e,t)=>e+t,0)}function Wh(e){return Math.ceil(e)}function Gh(e,t){return Math.trunc(e/t)}function Kh(e,...t){return t.reduce((e,t)=>e/t,e)}function qh(e){return Math.floor(e)}function Jh(...e){return e.reduce((e,t)=>t>e?t:e,-1/0)}function Yh(...e){return e.reduce((e,t)=>Math.max(e,t),-1/0)}function Xh(...e){return e.reduce((e,t)=>t<e?t:e,1/0)}function Zh(...e){return e.reduce((e,t)=>Math.min(e,t),1/0)}function Qh(e,t){return e%t}function $h(...e){return e.reduce((e,t)=>e*t,1)}function eg(...e){return e.reduce((e,t)=>e*t,1)}function tg(e,t=0){let n=10**t;return Math.sign(e)*Math.round(Math.abs(e)*n)/n}function ng(e,t,n){let r=[];if(t<e){if(n>=0)return r;for(let i=e;i>t;i+=n)r.push(i);return r}if(n<=0)return r;for(let i=e;i<t;i+=n)r.push(i);return r}function rg(...e){let t=1;switch(e.length){case 0:return``;case 1:{let n=e[0];return n<1&&(t=-1),ng(1,n+t,t).join(` `)}case 2:{let t=e[0],n=e[1],r=n<t?-1:1;return ng(t,n+r,r).join(` `)}case 3:{let n=e[0],r=e[1],i=e[2];return i<n&&(t=-1,r>0)?``:ng(n,i+t,r).join(` `)}default:return``}}function ig(e,t){return e-t}function ag(e,...t){return t.reduce((e,t)=>e-t,e)}function og(e){return ng(0,e,e<0?-1:1)}function sg(){return{add:{fn:(...e)=>Bh(...e),argTypes:[`truncating-int`],arity:{kind:`variadic`}},sub:{fn:(e,t)=>ig(e,t),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`exact`}},mul:{fn:(...e)=>$h(...e),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`variadic`}},div:{fn:(e,t)=>Gh(e,t),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`exact`}},mod:{fn:(e,t)=>Qh(e,t),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`exact`}},min:{fn:(...e)=>Xh(...e),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`variadic`}},max:{fn:(...e)=>Jh(...e),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`variadic`}},floor:{fn:e=>qh(e),argTypes:[`float`],arity:{kind:`exact`}},ceil:{fn:e=>Wh(e),argTypes:[`float`],arity:{kind:`exact`}},round:{fn:(e,t)=>tg(e,t),argTypes:[`float`,`int`,`float`],arity:{kind:`variadic`}},addf:{fn:(...e)=>Uh(...e),argTypes:[`float`],arity:{kind:`variadic`}},subf:{fn:(e,...t)=>ag(e,...t),argTypes:[`float`,`float`],arity:{kind:`variadic`}},mulf:{fn:(...e)=>eg(...e),argTypes:[`float`,`float`],arity:{kind:`variadic`}},divf:{fn:(e,...t)=>Kh(e,...t),argTypes:[`float`,`float`],arity:{kind:`variadic`}},add1:{fn:e=>Vh(e),argTypes:[`truncating-int`],arity:{kind:`exact`}},add1f:{fn:e=>Hh(e),argTypes:[`float`],arity:{kind:`exact`}},maxf:{fn:(...e)=>Yh(...e),argTypes:[`float`,`float`],arity:{kind:`variadic`}},minf:{fn:(...e)=>Zh(...e),argTypes:[`float`,`float`],arity:{kind:`variadic`}},biggest:{fn:(...e)=>Jh(...e),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`variadic`}},seq:{fn:(...e)=>rg(...e),argTypes:[`int`],arity:{kind:`variadic`},returnType:`string`},until:{fn:e=>og(e),argTypes:[`int`],arity:{kind:`exact`},returnType:`list`},untilStep:{fn:(e,t,n)=>ng(e,t,n),argTypes:[`int`,`int`,`int`],arity:{kind:`exact`},returnType:`list`}}}Array.from({length:95},(e,t)=>String.fromCharCode(t+32)).join(``);function cg(e){return Array.from(e)}function lg(e,t){return e===``?cg(t):t.split(e)}function ug(e,t){let n=cg(t);return n.length<=e||e<4?t:`${n.slice(0,e-3).join(``)}...`}function dg(e,t,n){let r=cg(n);return t<7||r.length<t||e<0||e>r.length-t+1?n:`...${r.slice(e,e+t-6).join(``)}...`}const q={Invalid:0,Number:1,UpperCase:2,Alphabet:3,Connector:4,Punct:5,Other:6},fg=/^[-_\s]$/,pg=/^\p{P}$/u,mg=/^\p{L}$/u,hg=/^\p{Lu}$/u,gg=/^\p{N}$/u;function _g(e){return e!==void 0&&fg.test(e)}function vg(e){return e!==void 0&&mg.test(e)}function yg(e){return e!==void 0&&hg.test(e)}function bg(e){return e!==void 0&&gg.test(e)}function xg(e){return e!==void 0&&pg.test(e)}function Sg(e,t){if(t>=e.length)return{word:{wt:q.Invalid,text:``},next:t};let n=e[t],r=t+1;if(_g(n)){for(;r<e.length&&_g(e[r]);)r++;return{word:{wt:q.Connector,text:e.slice(t,r).join(``)},next:r}}if(xg(n)){for(;r<e.length&&xg(e[r]);)r++;return{word:{wt:q.Punct,text:e.slice(t,r).join(``)},next:r}}if(yg(n)){if(r>=e.length)return{word:{wt:q.UpperCase,text:n},next:r};if(yg(e[r])){let n=r;for(;n<e.length&&yg(e[n]);)n++;return n<e.length&&vg(e[n])?{word:{wt:q.UpperCase,text:e.slice(t,n-1).join(``)},next:n-1}:{word:{wt:q.UpperCase,text:e.slice(t,n).join(``)},next:n}}if(vg(e[r])){let n=r+1;for(;n<e.length&&vg(e[n])&&!yg(e[n]);)n++;return{word:{wt:q.UpperCase,text:e.slice(t,n).join(``)},next:n}}return{word:{wt:q.UpperCase,text:n},next:r}}if(vg(n)){for(;r<e.length&&vg(e[r])&&!yg(e[r]);)r++;return{word:{wt:q.Alphabet,text:e.slice(t,r).join(``)},next:r}}if(bg(n)){for(;r<e.length&&bg(e[r]);)r++;return{word:{wt:q.Number,text:e.slice(t,r).join(``)},next:r}}for(;r<e.length&&!_g(e[r])&&!vg(e[r])&&!bg(e[r])&&!xg(e[r]);)r++;return{word:{wt:q.Other,text:e.slice(t,r).join(``)},next:r}}function Cg(e,t,n){if(t.wt!==q.UpperCase&&t.wt!==q.Connector){e.push(t.text);return}for(let r of t.text)_g(r)?e.push(n):yg(r)?e.push(r.toLowerCase()):e.push(r)}function wg(e,t){if(e.length===0)return``;let n=cg(e),r=[],{word:i,next:a}=Sg(n,0);for(;a<n.length;){i.wt!==q.Connector&&Cg(r,i,t);let e=i,o=i;if({word:i,next:a}=Sg(n,a),e.wt===q.Number){for(;i.wt===q.Alphabet||i.wt===q.Number;)Cg(r,i,t),{word:i,next:a}=Sg(n,a);i.wt!==q.Invalid&&i.wt!==q.Punct&&i.wt!==q.Connector&&r.push(t);continue}if(e.wt===q.Connector){Cg(r,o,t);continue}if(e.wt===q.Punct)continue;if(i.wt!==q.Number){i.wt!==q.Connector&&i.wt!==q.Punct&&r.push(t);continue}if(a>=n.length)continue;let s=i;if({word:i,next:a}=Sg(n,a),i.wt!==q.Alphabet){Cg(r,s,t),i.wt!==q.Connector&&i.wt!==q.Punct&&r.push(t);continue}for(r.push(t),Cg(r,s,t);i.wt===q.Alphabet||i.wt===q.Number;)Cg(r,i,t),{word:i,next:a}=Sg(n,a);i.wt!==q.Invalid&&i.wt!==q.Connector&&i.wt!==q.Punct&&r.push(t)}return Cg(r,i,t),r.join(``).toLowerCase()}function Tg(e){if(e.length===0)return``;let t=cg(e),n=[],r=0,i=``;for(;r<t.length;){if(i=t[r],r++,!_g(i)){i=i.toUpperCase();break}n.push(i)}if(r>=t.length)return t.length>0&&n.push(i),n.join(``);for(;r<t.length;){let e=i;if(i=t[r],r++,_g(i)&&_g(e)){n.push(e);continue}_g(e)?i=i.toUpperCase():(i=i.toLowerCase(),n.push(e))}return n.push(i),n.join(``)}function Eg(e){return Tg(e)}function Dg(...e){return e.join(` `)}function Og(e,t){return t.includes(e)}function kg(e,t){return t.startsWith(e)}function Ag(e,t){return t.endsWith(e)}function jg(e,t){let n=` `.repeat(Math.max(0,e));return t.split(`
48
+ `?(this.line+=1,this.column=1):this.column+=1}}advanceTo(e){for(;this.offset<e;)this.advanceBy(1)}makeToken(e,t,n,r={}){return Object.freeze({type:e,value:t,pos:n,...r.trimLeft===void 0?{}:{trimLeft:r.trimLeft},...r.trimRight===void 0?{}:{trimRight:r.trimRight}})}};function Pd(e){return e===` `||e===` `||e===`\r`||e===`
49
+ `}function Fd(e){return e===`+`||e===`-`}function Id(e){return e>=`0`&&e<=`9`}function Ld(e){return Id(e)||e>=`a`&&e<=`f`||e>=`A`&&e<=`F`}function Rd(e){return e>=`0`&&e<=`7`}function zd(e){return e===`0`||e===`1`}function Bd(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`}function Vd(e){return Bd(e)||e===`_`}function Hd(e){return Vd(e)||Id(e)}let Ud,Wd;function Gd(e,t){return Wd(e,t)}var Kd=class e{static EMPTY=new e(new Map,void 0);#e;#t;constructor(e,t){this.#e=e,this.#t=t}static{Ud=(t,n)=>new e(t,n),Wd=(e,t)=>e.#e.get(t)??(e.#t&&Wd(e.#t,t))}has(e){return Wd(this,e)!==void 0}};function qd(e,t,n=Kd.EMPTY){return new Jd(e,t,n).parseTemplate()}var Jd=class{lex;buf=[];defines=new Map;inherit;source;rangeDepth=0;constructor(e,t,n){this.source=e,this.inherit=n,this.lex=t?new Nd(e,t):new Nd(e)}peek(e=0){for(;this.buf.length<=e;)this.buf.push(this.lex.next());return this.buf[e]}next(){return this.buf.length>0?this.buf.shift():this.lex.next()}expect(e,t){let n=this.next();if(n.type!==e)throw this.errAt(n,`expected ${t}`,{expected:t,found:Zd(n)});return n}errAt(e,t,n={}){return new yd(t,e.pos,{...n,source:this.source})}parseTemplate(){let e=this.parseList();if(this.peek().type!==`EOF`){let e=this.peek(),t=this.peek(1);if(e.type===`LeftDelim`&&(t.type===`Else`||t.type===`End`)){let n=t.type===`Else`?`else`:`end`;throw this.errAt(e,`unexpected \`{{${n}}}\` outside of \`if\`, \`range\`, \`with\`, or \`block\``,{found:`{{${n}}}`})}throw this.errAt(e,`unexpected ${Zd(e)}`,{found:Zd(e)})}return{root:e,defines:Ud(this.defines,this.inherit),ownDefines:this.defines,source:this.source}}parseList(){let e=this.peek().pos,t=[];for(;;){let n=this.peek();if(n.type===`EOF`)break;if(n.type===`Text`){this.next(),t.push({type:`Text`,pos:n.pos,text:n.value});continue}if(n.type===`Comment`){this.next();let e=Xd(n);t.push({type:`Comment`,pos:n.pos,text:n.value,trim:e});continue}if(n.type===`LeftDelim`){let n=this.peek(1).type;if(n===`Else`||n===`End`)return Yd(e,t);let r=this.parseAction();r!==null&&t.push(r);continue}throw this.errAt(n,`unexpected ${Zd(n)} at top level`,{found:Zd(n)})}return Yd(e,t)}parseAction(){let e=this.expect(`LeftDelim`,"`{{`"),t=e.trimLeft===!0,n=this.peek();switch(n.type){case`If`:return this.next(),this.parseBranch(`If`,e.pos,t);case`Range`:return this.next(),this.parseBranch(`Range`,e.pos,t);case`With`:return this.next(),this.parseBranch(`With`,e.pos,t);case`Break`:return this.next(),this.parseBreakOrContinue(`Break`,e.pos,t);case`Continue`:return this.next(),this.parseBreakOrContinue(`Continue`,e.pos,t);case`Template`:return this.next(),this.parseTemplateInvocation(e.pos,t);case`Block`:return this.next(),this.parseBlock(e.pos,t);case`Define`:return this.next(),this.parseDefine(e.pos,t),null;case`RightDelim`:throw this.errAt(n,`empty action`,{expected:`pipeline`});default:{let n=this.parsePipeline(),r=this.expect(`RightDelim`,"`}}`");return{type:`Action`,pos:e.pos,pipe:n,trim:{trimLeft:t,trimRight:r.trimRight===!0}}}}}parseBranch(e,t,n){let r=this.parsePipeline();this.expect(`RightDelim`,"`}}`"),e===`Range`&&(this.rangeDepth+=1);let i=this.parseList();e===`Range`&&--this.rangeDepth;let a=this.parseElsePart(),o={trimLeft:n,trimRight:a.endConsumed?a.endRight:this.consumeEnd()},s=a.list?{pipe:r,list:i,elseList:a.list,trim:o}:{pipe:r,list:i,trim:o};switch(e){case`If`:return{type:`If`,pos:t,...s};case`Range`:return{type:`Range`,pos:t,...s};case`With`:return{type:`With`,pos:t,...s}}}parseBreakOrContinue(e,t,n){if(this.rangeDepth===0)throw new yd(`{{${e===`Break`?`break`:`continue`}}} outside of {{range}}`,t,{source:this.source});let r={trimLeft:n,trimRight:this.expect(`RightDelim`,"`}}`").trimRight===!0};return e===`Break`?{type:`Break`,pos:t,trim:r}:{type:`Continue`,pos:t,trim:r}}parseElsePart(){if(this.peek().type!==`LeftDelim`||this.peek(1).type!==`Else`)return{list:void 0,endRight:!1,endConsumed:!1};let e=this.next();if(this.next(),this.peek().type===`If`){this.next();let t=this.parseBranch(`If`,e.pos,e.trimLeft===!0);return{list:{type:`List`,pos:e.pos,nodes:[t]},endRight:t.trim.trimRight,endConsumed:!0}}return this.expect(`RightDelim`,"`}}`"),{list:this.parseList(),endRight:!1,endConsumed:!1}}consumeEnd(){return this.expect(`LeftDelim`,"`{{end}}`"),this.expect(`End`,"`end`"),this.expect(`RightDelim`,"`}}`").trimRight===!0}parseTemplateInvocation(e,t){let n=this.parseQuotedName(),r=this.peek().type===`RightDelim`?void 0:this.parsePipeline(),i={trimLeft:t,trimRight:this.expect(`RightDelim`,"`}}`").trimRight===!0};return r?{type:`Template`,pos:e,name:n,pipe:r,trim:i}:{type:`Template`,pos:e,name:n,trim:i}}parseBlock(e,t){let n=this.parseQuotedName(),r=this.peek().type===`RightDelim`?void 0:this.parsePipeline();this.expect(`RightDelim`,"`}}`");let i=this.rangeDepth;this.rangeDepth=0;let a=this.parseList();this.rangeDepth=i;let o={trimLeft:t,trimRight:this.consumeEnd()};return!this.defines.has(n)&&!this.inherit.has(n)&&this.defines.set(n,{list:a,source:this.source}),r?{type:`Block`,pos:e,name:n,pipe:r,list:a,trim:o}:{type:`Block`,pos:e,name:n,list:a,trim:o}}parseDefine(e,t){let n=this.parseQuotedName();this.expect(`RightDelim`,"`}}`");let r=this.rangeDepth;this.rangeDepth=0;let i=this.parseList();if(this.rangeDepth=r,this.consumeEnd(),this.defines.has(n)||this.inherit.has(n))throw new yd(`redefinition of template ${JSON.stringify(n)}`,i.pos,{source:this.source});this.defines.set(n,{list:i,source:this.source})}parseQuotedName(){let e=this.next();if(e.type!==`String`)throw this.errAt(e,`expected template name (quoted string)`,{expected:`string`,found:Zd(e)});return of(e.value,e.pos,this.source)}parsePipeline(){let e=this.peek().pos,t=this.tryParseDecls(),n=[this.parseCommand()];for(;this.peek().type===`Pipe`;){this.next();let e=this.peek();if(!Qd(e.type))throw this.errAt(e,"missing command after `|`",{expected:`command`,found:Zd(e)});n.push(this.parseCommand())}return{type:`Pipe`,pos:e,decls:t?.vars??[],isAssign:t?.isAssign??!1,cmds:n}}tryParseDecls(){if(this.peek().type!==`Variable`)return;let e=1;for(;this.peek(e).type===`Comma`;){if(this.peek(e+1).type!==`Variable`)return;e+=2}let t=this.peek(e).type;if(t!==`Declare`&&t!==`Assign`)return;let n=[$d(this.next())];for(;this.peek().type===`Comma`;)this.next(),n.push($d(this.expect(`Variable`,`$variable`)));return{vars:n,isAssign:this.next().type===`Assign`}}parseCommand(){let e=this.peek().pos,t=[this.parsePrimary()];for(;Qd(this.peek().type);)t.push(this.parsePrimary());return{type:`Command`,pos:e,args:t}}parsePrimary(){let e=this.next();switch(e.type){case`Dot`:return{type:`Dot`,pos:e.pos};case`Field`:return{type:`Field`,pos:e.pos,idents:e.value.slice(1).split(`.`)};case`Variable`:return $d(e);case`Identifier`:return{type:`Identifier`,pos:e.pos,ident:e.value};case`String`:return{type:`String`,pos:e.pos,raw:e.value,value:of(e.value,e.pos,this.source)};case`Number`:return tf(e);case`Char`:return nf(e,this.source);case`Bool`:return{type:`Bool`,pos:e.pos,value:e.value===`true`};case`Nil`:return{type:`Nil`,pos:e.pos};case`LeftParen`:return this.parseChainOrPipe(e.pos);default:throw this.errAt(e,`expected command argument, found ${Zd(e)}`,{expected:`command argument`,found:Zd(e)})}}parseChainOrPipe(e){let t=this.parsePipeline(),n=this.expect(`RightParen`,"`)`"),r=[],i=n.pos.offset+1,a=this.peek();return a.type===`Field`&&a.pos.offset===i&&(this.next(),r.push(...a.value.slice(1).split(`.`))),r.length===0?t:{type:`Chain`,pos:e,node:t,fields:r}}};function Yd(e,t){return{type:`List`,pos:e,nodes:t}}function Xd(e){return{trimLeft:e.trimLeft===!0,trimRight:e.trimRight===!0}}function Zd(e){return e.type===`EOF`?`end of input`:e.value||e.type}function Qd(e){switch(e){case`Dot`:case`Field`:case`Variable`:case`Identifier`:case`String`:case`Number`:case`Char`:case`Bool`:case`Nil`:case`LeftParen`:return!0;default:return!1}}function $d(e){return{type:`Variable`,pos:e.pos,idents:ef(e.value)}}function ef(e){let t=e.indexOf(`.`);return t===-1?[e]:[e.slice(0,t),...e.slice(t+1).split(`.`)]}function tf(e){let t=e.value,n=t.replace(/_/g,``),r=n.toLowerCase().endsWith(`i`),i=r?n.slice(0,-1):n,a=!r&&(i.includes(`.`)||!i.startsWith(`0x`)&&!i.startsWith(`0X`)&&/[eE]/.test(i)||(i.startsWith(`0x`)||i.startsWith(`0X`))&&/[pP]/.test(i)),o=!r&&!a,s={type:`Number`,pos:e.pos,text:t,isInt:o,isUint:!1,isFloat:a,isComplex:r};if(o){let e=rf(i);return{...s,intValue:e}}if(a){let e=af(i);return{...s,floatValue:e}}let c=af(i);return{...s,complexValue:[0,c]}}function nf(e,t){let n=sf(e.value,e.pos,t);return{type:`Number`,pos:e.pos,text:e.value,isInt:!0,isUint:!1,isFloat:!1,isComplex:!1,intValue:BigInt(n)}}function rf(e){let t=1n,n=e;return n.startsWith(`+`)?n=n.slice(1):n.startsWith(`-`)&&(t=-1n,n=n.slice(1)),t*BigInt(n)}function af(e){return Number(e)}function of(e,t,n){if(e.startsWith("`"))return e.slice(1,-1);let r=``;for(let i=1;i<e.length-1;i++){let a=e[i];if(a!==`\\`){r+=a;continue}let o=e[++i];switch(o){case`n`:r+=`
50
+ `;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`\\`:r+=`\\`;break;case`"`:r+=`"`;break;case`'`:r+=`'`;break;case`a`:r+=`\x07`;break;case`b`:r+=`\b`;break;case`f`:r+=`\f`;break;case`v`:r+=`\v`;break;case`0`:case`1`:case`2`:case`3`:case`4`:case`5`:case`6`:case`7`:{let t=o+(e[i+1]??``)+(e[i+2]??``);i+=2,r+=String.fromCodePoint(Number.parseInt(t,8));break}case`x`:{let t=(e[i+1]??``)+(e[i+2]??``);i+=2,r+=String.fromCodePoint(Number.parseInt(t,16));break}case`u`:{let t=e.slice(i+1,i+5);i+=4,r+=String.fromCodePoint(Number.parseInt(t,16));break}case`U`:{let t=e.slice(i+1,i+9);i+=8,r+=String.fromCodePoint(Number.parseInt(t,16));break}default:throw new yd(`bad escape sequence \\${o}`,t,{expected:`valid escape sequence`,found:`\\${o}`,source:n})}}return r}function sf(e,t,n){let r=of(`"${e.slice(1,-1).replace(/"/g,`\\"`)}"`,t,n);if(r.length===0)throw new yd(`empty rune literal`,t,{source:n});return r.codePointAt(0)??0}function cf(e,t){if(t(e)!==!1)for(let n of lf(e))cf(n,t)}function lf(e){switch(e.type){case`Text`:case`Comment`:case`Dot`:case`Nil`:case`Bool`:case`Number`:case`String`:case`Identifier`:case`Field`:case`Variable`:case`Break`:case`Continue`:return[];case`List`:return e.nodes;case`Chain`:return[e.node];case`Command`:return e.args;case`Pipe`:return[...e.decls,...e.cmds];case`Action`:return[e.pipe];case`If`:case`Range`:case`With`:return e.elseList?[e.pipe,e.list,e.elseList]:[e.pipe,e.list];case`Template`:return e.pipe?[e.pipe]:[];case`Block`:return e.pipe?[e.pipe,e.list]:[e.list];default:return Ad(e)}}const uf=Symbol(`go-template-js.MISSING`);function df(e,t){if(e==null)return uf;if(e instanceof Map)return e.has(t)?e.get(t):uf;if(Array.isArray(e))return uf;if(typeof e==`object`){let n=e;return t in n?n[t]:uf}return uf}function ff(e,t){let n=e;for(let e of t){if(n===uf)return uf;n=df(n,e)}return n}function pf(e,t){if(Object.is(e,t))return!0;if(e===null||t===null||e===void 0||t===void 0||typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length?e.every((e,n)=>pf(e,t[n])):!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!pf(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(typeof e==`object`&&typeof t==`object`){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length?n.every(n=>pf(e[n],t[n])):!1}return!1}const mf=new WeakSet;function hf(e){return mf.add(e),e}function gf(e){return mf.has(e)}function _f(e){return e==null||e===!1?!1:typeof e==`number`?e!==0&&!Number.isNaN(e):typeof e==`bigint`?e!==0n:typeof e==`string`||Array.isArray(e)?e.length>0:e instanceof Map||e instanceof Set?e.size>0:typeof e==`object`?Object.keys(e).length>0:!!e}function vf(e,t){return{eq:{fn:(e,...t)=>t.some(t=>xf(e,t)),argTypes:[`comparable`,`comparable`],arity:{kind:`variadic`}},ne:{fn:(e,t)=>!xf(e,t),argTypes:[`comparable`,`comparable`],arity:{kind:`exact`}},lt:{fn:(e,t)=>Sf(e,t)<0,argTypes:[`ordered`,`ordered`],arity:{kind:`exact`}},le:{fn:(e,t)=>Sf(e,t)<=0,argTypes:[`ordered`,`ordered`],arity:{kind:`exact`}},gt:{fn:(e,t)=>Sf(e,t)>0,argTypes:[`ordered`,`ordered`],arity:{kind:`exact`}},ge:{fn:(e,t)=>Sf(e,t)>=0,argTypes:[`ordered`,`ordered`],arity:{kind:`exact`}},len:{fn:e=>Cf(e),argTypes:[`sized`],arity:{kind:`exact`}},index:{fn:(e,...t)=>{let n=e;for(let e of t)n=wf(n,e);return n},argTypes:[`collection`,`index-key`],arity:{kind:`variadic`}},slice:{fn:(e,...t)=>Ef(e,t),argTypes:[`sliceable`,`int`],arity:{kind:`variadic`}},print:{fn:(...t)=>kf(t,e),argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},println:{fn:(...t)=>`${kf(t,e)}\n`,argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},printf:{fn:(n,...r)=>Rf(n,r,e,t),argTypes:[`string`,`stringifiable`],arity:{kind:`variadic`},returnType:`string`},toString:{fn:n=>Vf(n,e,t),argTypes:[`value`],arity:{kind:`exact`},returnType:`string`},toStrings:{fn:n=>n.map(n=>Vf(n,e,t)),argTypes:[`list`],arity:{kind:`exact`}},call:{fn:(e,...t)=>e(...t),argTypes:[`callable`,`value`],arity:{kind:`variadic`}},html:{fn:(...t)=>Mf(kf(t,e)),argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},js:{fn:(...t)=>Ff(kf(t,e)),argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},urlquery:{fn:(...t)=>Lf(kf(t,e)),argTypes:[`stringifiable`],arity:{kind:`variadic`},returnType:`string`},not:{fn:e=>!_f(e),argTypes:[`truthy`],arity:{kind:`exact`}}}}function yf(){return{and:hf({argTypes:[`truthy`,`truthy`],arity:{kind:`variadic`},fn:(...e)=>{let t=!0;for(let n of e)if(t=n(),!_f(t))return t;return t}}),or:hf({argTypes:[`truthy`,`truthy`],arity:{kind:`variadic`},fn:(...e)=>{let t=!1;for(let n of e)if(t=n(),_f(t))return t;return t}})}}function bf(e,t){return{...vf(e,t),...yf()}}function xf(e,t){return typeof e==`number`&&typeof t==`bigint`?BigInt(e)===t:typeof e==`bigint`&&typeof t==`number`?e===BigInt(t):pf(e,t)}function Sf(e,t){if(typeof e==`bigint`&&typeof t==`bigint`)return e===t?0:e<t?-1:1;if(typeof e==`bigint`||typeof t==`bigint`){let n=typeof e==`bigint`?e:BigInt(Math.trunc(Number(e))),r=typeof t==`bigint`?t:BigInt(Math.trunc(Number(t)));return n===r?0:n<r?-1:1}let n=e,r=t;return n===r?0:n<r?-1:1}function Cf(e){return typeof e==`string`||Array.isArray(e)?e.length:e instanceof Map||e instanceof Set?e.size:Object.keys(e).length}function wf(e,t){if(Array.isArray(e)||typeof e==`string`){let n=Tf(t,e.length);if(n===e.length)throw Error(`index out of range: ${n}`);return e[n]}if(e instanceof Map)return e.get(t);if(typeof e==`object`&&e){if(typeof t!=`string`)throw Error(`index: object index must be string, got ${Df(t)}`);return e[t]}throw Error(`index: cannot index ${Df(e)}`)}function Tf(e,t){let n=typeof e==`bigint`?Number(e):e;if(typeof n!=`number`||!Number.isInteger(n))throw Error(`cannot index slice/array with type ${Of(e)}`);if(n<0||n>t)throw Error(`index out of range: ${String(e)}`);return n}function Ef(e,t){if(t.length>3)throw Error(`too many slice indexes: ${t.length}`);if(typeof e==`string`&&t.length>2)throw Error(`cannot 3-index slice a string`);let n=e.length,r=[0,n,n];t.forEach((e,t)=>{r[t]=Tf(e,n)});let[i,a,o]=r;if(i>a)throw Error(`invalid slice index: ${i} > ${a}`);if(a>o)throw Error(`invalid slice index: ${a} > ${o}`);return e.slice(i,a)}function Df(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:e instanceof Map?`Map`:typeof e}function Of(e){return e==null?`<nil>`:typeof e==`string`?`string`:typeof e==`boolean`?`bool`:typeof e==`bigint`?`int64`:typeof e==`number`?Number.isInteger(e)?`int`:`float64`:Array.isArray(e)?`[]interface {}`:e instanceof Map||typeof e==`object`?`map[string]interface {}`:typeof e}function kf(e,t){let n=``,r=!1;for(let i=0;i<e.length;i++){let a=e[i],o=typeof a==`string`;i>0&&!r&&!o&&(n+=` `),n+=Af(a,t),r=o}return n}function Af(e,t){return e==null?`<nil>`:typeof e==`string`?e:t(e)}const jf={"\0":`�`,'"':`&#34;`,"'":`&#39;`,"&":`&amp;`,"<":`&lt;`,">":`&gt;`};function Mf(e){return e.replace(/[\0"'&<>]/g,e=>jf[e]??e)}const Nf={"\\":`\\\\`,"'":`\\'`,'"':`\\"`,"<":`\\u003C`,">":`\\u003E`,"&":`\\u0026`,"=":`\\u003D`},Pf=/^[\p{L}\p{M}\p{N}\p{P}\p{S}]$/u;function Ff(e){let t=``;for(let n of e){let e=Nf[n];if(e!==void 0){t+=e;continue}let r=n.codePointAt(0);if(r<32||r>=128&&!Pf.test(n)){t+=`\\u${r.toString(16).toUpperCase().padStart(4,`0`)}`;continue}t+=n}return t}const If=new TextEncoder;function Lf(e){let t=``,n=If.encode(e);for(let e of n)e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===45||e===46||e===95||e===126?t+=String.fromCharCode(e):e===32?t+=`+`:t+=`%${e.toString(16).toUpperCase().padStart(2,`0`)}`;return t}function Rf(e,t,n,r){let i=``,a=0,o=0;for(;o<e.length;){let s=e[o];if(s!==`%`){i+=s,o+=1;continue}if(e[o+1]===`%`){i+=`%`,o+=2;continue}let c=o+1;for(;c<e.length&&`+-# 0`.includes(e[c]??``);)c+=1;for(;c<e.length&&e[c]!==void 0&&/[0-9]/.test(e[c]);)c+=1;if(e[c]===`.`)for(c+=1;c<e.length&&e[c]!==void 0&&/[0-9]/.test(e[c]);)c+=1;let l=e[c],u=e.slice(o+1,c),d=t[a++];i+=zf(l??``,u,d,n,r),o=c+1}return i}function zf(e,t,n,r,i){switch(e){case`s`:return typeof n==`string`?Bf(t,n):Bf(t,Af(n,r));case`d`:return typeof n!=`number`&&typeof n!=`bigint`?`%!${e}(${Of(n)}=${Af(n,r)})`:Bf(t,String(typeof n==`bigint`?n:Math.trunc(n)));case`v`:return Bf(t,Vf(n,r,i));case`q`:return Bf(t,JSON.stringify(Af(n,r)));case`f`:{if(typeof n!=`number`&&typeof n!=`bigint`)return`%!${e}(${Of(n)}=${Af(n,r)})`;let i=t.includes(`.`)?Number(t.split(`.`)[1]):6;return Bf(t,Number(n).toFixed(i))}case`t`:return Bf(t,_f(n)?`true`:`false`);case`x`:if(typeof n==`string`){let e=new TextEncoder().encode(n),r=``;for(let t of e)r+=t.toString(16).padStart(2,`0`);return Bf(t,r)}return typeof n!=`number`&&typeof n!=`bigint`?`%!${e}(${Of(n)}=${Af(n,r)})`:typeof n==`bigint`?Bf(t,n.toString(16)):Bf(t,Math.trunc(n).toString(16));default:return`%!${e}(${Of(n)}=${Af(n,r)})`}}function Bf(e,t){let n=e.match(/^([+\-# 0]*)/)?.[1]??``,r=e.slice(n.length).match(/^(\d+)/);if(!r)return t;let i=Number(r[1]);if(t.length>=i)return t;let a=` `.repeat(i-t.length);return n.includes(`-`)?t+a:a+t}function Vf(e,t,n){return e==null?`<nil>`:typeof e==`string`?e:n(e)?t(e):Array.isArray(e)?`[${e.map(e=>Vf(e,t,n)).join(` `)}]`:e instanceof Map?Hf([...e.entries()],t,n):Uf(e)?Hf(Object.entries(e),t,n):String(e)}function Hf(e,t,n){let r=e=>Vf(e,t,n),i=e=>typeof e==`number`||typeof e==`bigint`,a=([e],[t])=>{if(i(e)&&i(t))return e<t?-1:+(e>t);if(i(e)!==i(t))return i(e)?-1:1;let[n,a]=[r(e),r(t)];return n<a?-1:+(n>a)};return`map[${[...e].sort(a).map(([e,t])=>`${r(e)}:${r(t)}`).join(` `)}]`}function Uf(e){if(typeof e!=`object`||!e||Array.isArray(e)||e instanceof Map||e instanceof Set)return!1;let t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Wf(e){return{dot:e,root:e,parent:void 0,vars:new Map}}function Gf(e,t){return{dot:t,root:e.root,parent:e,vars:new Map}}function Kf(e,t){let n=e;for(;n!==void 0;){if(n.vars.has(t))return{found:!0,value:n.vars.get(t)};n=n.parent}return{found:!1}}function qf(e,t,n){e.vars.set(t,n)}const Jf=[`string`,`int`,`truncating-int`,`float`,`bool`,`T`,`ordered`,`list`,`dict`,`sized`,`comparable`,`stringifiable`,`liftable`,`callable`,`collection`,`index-key`,`sliceable`,`truthy`,`reflective`,`value`,`serializable`],Yf=new Set([`default`,`zero`,`error`]);function Xf(e){if(e===void 0)return`default`;if(Yf.has(e))return e;throw Error(`EngineConfig.missingKey: expected "default" | "zero" | "error", got ${Zf(e)}`)}function Zf(e){return typeof e==`string`?JSON.stringify(e):e===null?`null`:e===void 0?`undefined`:typeof e==`bigint`?`${e}n`:typeof e==`number`||typeof e==`boolean`?String(e):typeof e==`symbol`?e.toString():typeof e==`function`?`[Function]`:`[${typeof e}]`}function Qf(e){if(e!==void 0){if(typeof e!=`object`||!e)throw Error(`EngineConfig.delims: expected { left, right } object, got ${Zf(e)}`);if(typeof e.left!=`string`||e.left.length===0)throw Error(`EngineConfig.delims.left: expected non-empty string, got ${Zf(e.left)}`);if(typeof e.right!=`string`||e.right.length===0)throw Error(`EngineConfig.delims.right: expected non-empty string, got ${Zf(e.right)}`);return{left:e.left,right:e.right}}}function $f(e){switch(e.kind){case`exact`:return!1;case`variadic`:return!0;case`alternating`:return!0}}function ep(e){let t=new Set(Jf);for(let[n,r]of Object.entries(e)){if(r.argTypes.forEach((e,r)=>{if(!t.has(e))throw Error(`EngineConfig.funcs.${n}: argTypes[${r}] is ${JSON.stringify(e)}, which is not an ArgType; declare one of ${Jf.join(`, `)}`)}),$f(r.arity)&&r.argTypes.length===0)throw Error(`EngineConfig.funcs.${n}: arity ${JSON.stringify(r.arity.kind)} needs at least one declared argType (it reads its repeating slot from the end of argTypes); declare the slots the Go signature has, or use { kind: "exact" }`);if(r.arity.kind===`alternating`&&(!Number.isSafeInteger(r.arity.minimum)||r.arity.minimum<0))throw Error(`EngineConfig.funcs.${n}: arity "alternating" needs a non-negative integer minimum, got ${String(r.arity.minimum)}; the gate rejects every count below it, so a negative or non-finite minimum would disable the lower bound`)}return e}const tp=Object.freeze({kind:`break`}),np=Object.freeze({kind:`continue`}),rp={kind:`none`};let ip;(class e{source;_evaluate;_defines;_referencedFunctions;_referencedCalls;constructor(e,t,n,r,i){this.source=e,this._evaluate=t,this._defines=n,this._referencedFunctions=r,this._referencedCalls=i}static{ip=(t,n,r,i,a)=>new e(t,n,r,i,a)}defines(){return this._defines}evaluate(e){return this._evaluate(e)}referencedFunctions(){return this._referencedFunctions}referencedCalls(){return this._referencedCalls}});function ap(e){let t=new Set,n=e=>{cf(e,e=>{e.type===`Identifier`&&t.add(e.ident)})};n(e.root);for(let t of e.ownDefines.values())n(t.list);return t}const op={kind:`dynamic`};function sp(e){switch(e.type){case`String`:return{kind:`literal`,value:e.value};case`Bool`:return{kind:`literal`,value:e.value};case`Nil`:return{kind:`literal`,value:null};case`Number`:{let t=Op(e);return typeof t==`number`||typeof t==`bigint`?{kind:`literal`,value:t}:op}case`Pipe`:{if(e.decls.length!==0||e.cmds.length!==1)return op;let t=e.cmds[0];if(t===void 0)return op;let n=t.args[0];return n===void 0||n.type!==`Identifier`?op:{kind:`call`,name:n.ident,args:t.args.slice(1).map(sp)}}default:return op}}function cp(e){let t=[],n=e=>{cf(e,e=>{if(e.type!==`Command`)return;let n=e.args[0];if(n===void 0||n.type!==`Identifier`)return;let r=e.args.slice(1).map(sp);t.push({name:n.ident,args:r.map(e=>e.kind===`literal`&&typeof e.value==`string`?e.value:null),argExprs:r})})};n(e.root);for(let t of e.ownDefines.values())n(t.list);return t}var lp=class{fromString;toString;isT;funcs;missingKey;delims;constructor(e){this.fromString=e.fromString;let t=Object.hasOwn(e,`toString`)?e.toString:void 0;this.toString=t??_p,this.isT=e.isT??up,this.missingKey=Xf(e.missingKey),this.delims=Qf(e.delims),this.funcs=ep({...bf(this.toString,this.isT),...e.funcs??{}})}parse(e,t){let n=qd(e,this.delims,t);return ip(n.source,e=>this.evalParsed(n,e),n.defines,ap(n),cp(n))}compile(e){let t=this.parse(e);return e=>t.evaluate(e)}evaluate(e,t){return e.evaluate(t)}evalParsed(e,t){let n=[],r=Wf(t),i={out:n,defines:e.defines,source:e.source};return this.evalList(e.root,r,i),n}evalList(e,t,n){for(let r of e.nodes)this.evalNode(r,t,n)}evalNode(e,t,n){switch(e.type){case`Text`:n.out.push(this.fromString(e.text));return;case`Comment`:return;case`Action`:{let r=this.evalAction(e,t,n);e.pipe.decls.length===0&&this.emitFromValue(r,n);return}case`List`:this.evalList(e,t,n);return;case`If`:this.evalIf(e,t,n);return;case`Range`:this.evalRange(e,t,n);return;case`With`:this.evalWith(e,t,n);return;case`Break`:throw tp;case`Continue`:throw np;case`Template`:this.evalTemplateInvoke(e,t,n);return;case`Block`:this.evalBlock(e,t,n);return;case`Pipe`:case`Command`:case`Identifier`:case`Field`:case`Variable`:case`Chain`:case`Dot`:case`Nil`:case`Bool`:case`Number`:case`String`:throw new bd(`unexpected ${e.type} at statement position`,e.pos,{source:n.source});default:Ad(e)}}evalIf(e,t,n){_f(this.evalPipe(e.pipe,t,n))?this.evalList(e.list,t,n):e.elseList&&this.evalList(e.elseList,t,n)}evalWith(e,t,n){let r=this.evalPipe(e.pipe,t,n);if(_f(r)){let i=Gf(t,r);this.evalList(e.list,i,n)}else e.elseList&&this.evalList(e.elseList,t,n)}evalRange(e,t,n){let r=this.evalPipeWithoutDecls(e.pipe,t,n),i=e.pipe.decls,a=Tp(r);try{if(a.length===0){e.elseList&&this.evalList(e.elseList,t,n);return}for(let[r,o]of a){let a=Gf(t,o);if(i.length===1)qf(a,i[0]?.idents[0]??`$`,o);else if(i.length>=2){let e=i[0]?.idents[0]??`$`,t=i[1]?.idents[0]??`$`;qf(a,e,r),qf(a,t,o)}try{this.evalList(e.list,a,n)}catch(e){if(e===np)continue;throw e}}}catch(e){if(e===tp)return;throw e}}evalTemplateInvoke(e,t,n){let r=Gd(n.defines,e.name);if(!r)throw new bd(`template ${JSON.stringify(e.name)} is not defined`,e.pos,{source:n.source});let i=Gf(t,e.pipe?this.evalPipe(e.pipe,t,n):t.dot);this.evalList(r.list,i,{out:n.out,defines:n.defines,source:r.source})}evalBlock(e,t,n){let r=Gf(t,e.pipe?this.evalPipe(e.pipe,t,n):t.dot),i=Gd(n.defines,e.name)??{list:e.list,source:n.source};this.evalList(i.list,r,{out:n.out,defines:n.defines,source:i.source})}evalAction(e,t,n){return this.evalPipe(e.pipe,t,n)}evalPipe(e,t,n){if(e.cmds.length===0)throw new bd(`empty pipeline`,e.pos,{source:n.source});let r=this.evalCommand(e.cmds[0],t,n,rp);for(let i=1;i<e.cmds.length;i++){let a=e.cmds[i];r=this.evalCommand(a,t,n,{kind:`value`,value:r})}if(e.decls.length>0)for(let n of e.decls)qf(t,n.idents[0]??`$`,r);return r}evalPipeWithoutDecls(e,t,n){let r={type:`Pipe`,pos:e.pos,decls:[],isAssign:!1,cmds:e.cmds};return this.evalPipe(r,t,n)}evalCommand(e,t,n,r){if(e.args.length===0)throw new bd(`empty command`,e.pos,{source:n.source});let i=e.args[0];if(i.type!==`Identifier`){if(e.args.length>1)throw new bd(`cannot apply arguments to a ${i.type} primary; only functions take arguments`,e.pos,{source:n.source});return this.evalPrimary(i,t,n)}let a=this.funcs[i.ident];if(!a)throw new xd(i.ident,i.pos,{source:n.source,available:Object.keys(this.funcs)});let o=e.args.slice(1),s=gf(a),c=o.map(e=>s?()=>this.evalPrimary(e,t,n):this.evalPrimary(e,t,n));if(r.kind===`value`){let e=r.value;c.push(s?()=>e:e)}return this.invoke(i.ident,a,c,e.pos,n)}invoke(e,t,n,r,i){fp(e,t,n,r,i.source,this.toString,this.fromString,this.isT);try{return t.fn(...n)}catch(t){throw t instanceof Cd?new Cd(t.funcName,t.argIndex,t.expected,t.receivedSummary,r,{source:i.source}):t instanceof Ed?new Ed(t.message,r,{source:i.source}):t instanceof vd?t:new bd(`error calling ${e}: ${Cp(t)}`,r,{source:i.source,cause:t})}}evalPrimary(e,t,n){switch(e.type){case`Dot`:return t.dot;case`Nil`:return null;case`Bool`:return e.value;case`Number`:return Op(e);case`String`:return e.value;case`Field`:return this.resolveFieldChain(t.dot,e.idents,e.pos,n);case`Variable`:return this.resolveVariable(e.idents,t,e.pos,n);case`Identifier`:{let t=this.funcs[e.ident];if(!t)throw new xd(e.ident,e.pos,{source:n.source,available:Object.keys(this.funcs)});return this.invoke(e.ident,t,[],e.pos,n)}case`Chain`:return this.resolveFieldChain(this.evalPrimary(e.node,t,n),e.fields,e.pos,n);case`Pipe`:return this.evalPipe(e,t,n);default:throw new bd(`cannot evaluate ${e.type} as a value`,e.pos,{source:n.source})}}resolveFieldChain(e,t,n,r){let i=ff(e,t);if(i!==uf)return i;if(this.missingKey===`error`)throw new Td(t,n,{source:r.source})}resolveVariable(e,t,n,r){let i=e[0]??`$`;if(i===`$`){let i=e.slice(1);return i.length===0?t.root:this.resolveFieldChain(t.root,i,n,r)}let a=Kf(t,i);if(!a.found)throw new bd(`undefined variable ${i}`,n,{source:r.source});let o=e.slice(1);return o.length===0?a.value:this.resolveFieldChain(a.value,o,n,r)}emitFromValue(e,t){if(e==null){t.out.push(this.fromString(`<no value>`));return}if(typeof e==`string`){t.out.push(this.fromString(e));return}if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`){t.out.push(this.fromString(String(e)));return}if(this.isT(e)){t.out.push(e);return}t.out.push(this.fromString(Vf(e,this.toString,this.isT)))}};const up=e=>typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Map);function dp(e){return new lp(e)}function fp(e,t,n,r,i,a=_p,o=gp,s=up){let{argTypes:c,arity:l}=t,u=pp(c,l);if(n.length<u.minimum||n.length>u.maximum)throw new Sd(e,u,n.length,r,{source:i});let d=mp(c,l),f=-1,p=-1;for(let t=0;t<n.length;t++){let c=d(t),l=n[t];if(!hp(c,l,a,s))throw(c===`int`||c===`truncating-int`)&&(typeof l==`number`||typeof l==`bigint`)?new wd(e,t+1,l,r,{source:i}):new Cd(e,t+1,Sp(c),wp(l),r,{source:i});if(c===`liftable`&&typeof l==`string`&&(n[t]=o(l)),c===`truncating-int`?n[t]=Math.trunc(Number(l)):(c===`int`||c===`float`)&&(n[t]=Number(l)),c===`ordered`){if(f===-1)f=t;else if(!yp(n[f],l))throw new Cd(e,t+1,`${Sp(`ordered`)} of the same kind as ${wp(n[f])}`,wp(l),r,{source:i})}if(c===`comparable`){if(p===-1)p=t;else if(!bp(n[p],l))throw new Cd(e,t+1,`${Sp(`comparable`)} of the same kind as ${wp(n[p])}`,wp(l),r,{source:i})}}}function pp(e,t){switch(t.kind){case`exact`:return{minimum:e.length,maximum:e.length};case`variadic`:return{minimum:e.length-1,maximum:1/0};case`alternating`:return{minimum:t.minimum,maximum:1/0}}}function mp(e,t){let n=e.length;switch(t.kind){case`exact`:return t=>e[t];case`variadic`:return t=>e[Math.min(t,n-1)];case`alternating`:return t=>e[t%n]}}function hp(e,t,n,r){switch(e){case`truthy`:case`reflective`:case`value`:return!0;case`string`:return typeof t==`string`;case`int`:return typeof t==`number`&&Number.isSafeInteger(t)||typeof t==`bigint`&&Number.isSafeInteger(Number(t));case`truncating-int`:return typeof t==`number`&&Number.isFinite(t)||typeof t==`bigint`&&Number.isSafeInteger(Number(t));case`float`:return typeof t==`number`||typeof t==`bigint`&&Number.isFinite(Number(t));case`bool`:return typeof t==`boolean`;case`ordered`:return typeof t==`string`||typeof t==`number`||typeof t==`bigint`||typeof t==`boolean`;case`T`:return r(t);case`list`:return Array.isArray(t);case`dict`:return Uf(t);case`sized`:return typeof t==`string`||Array.isArray(t)||t instanceof Map||t instanceof Set||Uf(t);case`comparable`:return t==null||typeof t==`string`||typeof t==`number`||typeof t==`bigint`||typeof t==`boolean`||Array.isArray(t)||t instanceof Map||t instanceof Set||Uf(t);case`callable`:return typeof t==`function`;case`collection`:return typeof t==`string`||Array.isArray(t)||t instanceof Map||Uf(t);case`index-key`:return typeof t==`string`||typeof t==`number`||typeof t==`bigint`;case`sliceable`:return typeof t==`string`||Array.isArray(t);case`stringifiable`:if(typeof t==`string`)return!0;try{return n(t),!0}catch{return!1}case`liftable`:return typeof t==`string`||r(t);case`serializable`:return vp(t);default:throw Error(`invalid ArgType: ${String(e)}`)}}function gp(e){return e}function _p(e){if(typeof e==`string`)return e;if(e==null)return`<nil>`;if(typeof e==`number`||typeof e==`bigint`||typeof e==`boolean`)return String(e);throw new Cd(`<engine.toString>`,1,`string (or a consumer-supplied toString that flattens T)`,wp(e),{line:0,column:0,offset:0})}function vp(e){try{return JSON.stringify(e)!==void 0}catch{return!1}}function yp(e,t){return typeof e==typeof t||typeof e==`number`&&typeof t==`bigint`||typeof e==`bigint`&&typeof t==`number`}function bp(e,t){let n=xp(e),r=xp(t);return n===`nil`||r===`nil`?!0:n===r}function xp(e){return e==null?`nil`:typeof e==`string`?`string`:typeof e==`number`||typeof e==`bigint`?`number`:typeof e==`boolean`?`boolean`:Array.isArray(e)?`array`:e instanceof Map?`map`:e instanceof Set?`set`:`object`}function Sp(e){switch(e){case`int`:return`integer (safe-integer number or bigint)`;case`truncating-int`:return`integer (finite number, truncated toward zero, or safe-integer bigint)`;case`float`:return`float (number, including NaN/Infinity, or finite-convertible bigint)`;case`T`:return`T (consumer-defined fragment)`;case`ordered`:return`orderable primitive`;case`list`:return`list`;case`dict`:return`dict (plain object)`;case`sized`:return`sized value (string, list, map, set, or dict)`;case`comparable`:return`comparable value (orderable primitive, nil, list, dict, Map, or Set)`;case`stringifiable`:return`stringifiable value (string or convertible via the engine's toString)`;case`liftable`:return`liftable value (T or string, the latter lifted via the engine's fromString)`;case`callable`:return`callable (function value)`;case`collection`:return`collection (string, array, Map, or dict)`;case`index-key`:return`index key (number, bigint, or string)`;case`sliceable`:return`sliceable value (string or array)`;case`serializable`:return`JSON-serializable value`;case`truthy`:case`reflective`:case`value`:case`string`:case`bool`:return e;default:throw Error(`invalid ArgType: ${String(e)}`)}}function Cp(e){return e instanceof Error?e.message:String(e)}function wp(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:e instanceof Map?`Map`:typeof e}function Tp(e){return e==null?[]:Array.isArray(e)?e.map((e,t)=>[t,e]):typeof e==`string`?[...e].map((e,t)=>[t,e]):e instanceof Map?Ep([...e.entries()]):e instanceof Set?[...e.values()].map((e,t)=>[t,e]):typeof e==`object`?Ep(Object.entries(e)):[]}function Ep(e){return[...e].sort((e,t)=>Dp(e[0],t[0]))}function Dp(e,t){if((typeof e==`number`||typeof e==`bigint`)&&(typeof t==`number`||typeof t==`bigint`)){let n=typeof e==`bigint`?Number(e):e,r=typeof t==`bigint`?Number(t):t;return n===r?0:n<r?-1:1}let n=String(e),r=String(t);return n===r?0:n<r?-1:1}function Op(e){if(e.intValue!==void 0){let t=e.intValue;return t>=BigInt(-(2**53-1))&&t<=BigInt(2**53-1)?Number(t):t}if(e.floatValue!==void 0)return e.floatValue;if(e.complexValue!==void 0)return e.complexValue;throw Error(`internal: NumberNode has none of intValue/floatValue/complexValue — parser invariant violated`)}function kp(e){if(!/^[+-]?\d+$/.test(e))return 0;let t=Number.parseInt(e,10);return Number.isSafeInteger(t)?t:0}function Ap(e){if(typeof e==`number`)return e;if(typeof e==`bigint`)return Number(e);if(typeof e==`string`){let t=Number.parseFloat(e);return Number.isNaN(t)?0:t}return typeof e==`boolean`?+!!e:0}function jp(e){if(e===``)return null;let t=1,n=e;return n[0]===`+`?n=n.slice(1):n[0]===`-`&&(t=-1,n=n.slice(1)),n===``?null:/^0x[0-9a-fA-F]+$/i.test(n)?{sign:t,digits:n.slice(2),base:16}:/^0b[01]+$/i.test(n)?{sign:t,digits:n.slice(2),base:2}:/^0o[0-7]+$/i.test(n)?{sign:t,digits:n.slice(2),base:8}:n===`0`?{sign:t,digits:`0`,base:10}:n[0]===`0`?/^0[0-7]+$/.test(n)?{sign:t,digits:n.slice(1),base:8}:null:/^[0-9]+$/.test(n)?{sign:t,digits:n,base:10}:null}function Mp(e){if(typeof e==`number`){let t=Math.trunc(e);return Number.isSafeInteger(t)?t:0}if(typeof e==`bigint`){let t=Number(e);return Number.isSafeInteger(t)?t:0}if(typeof e==`string`){let t=jp(e);if(t===null)return 0;let n=t.sign*Number.parseInt(t.digits,t.base);return Number.isSafeInteger(n)?n:0}return typeof e==`boolean`?+!!e:0}function Np(e){if(typeof e==`bigint`)return e;if(typeof e==`number`)return BigInt(Math.trunc(e));if(typeof e==`string`){let t=jp(e);if(t===null)return 0n;let n=t.base===16?`0x`:t.base===2?`0b`:t.base===8?`0o`:``,r=BigInt(n+t.digits);return t.sign===-1?-r:r}return typeof e==`boolean`&&e?1n:0n}function Pp(e){if(!/^[+-]?[0-7]+$/.test(e))return 0;let t=e[0]===`-`?-1:1,n=e[0]===`+`||e[0]===`-`?e.slice(1):e,r=t*Number.parseInt(n,8);return Number.isSafeInteger(r)?r:0}function Fp(e){return JSON.stringify(e)??`null`}function Ip(){return{atoi:{fn:e=>kp(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`int`},int:{fn:e=>Mp(e),argTypes:[`value`],arity:{kind:`exact`},returnType:`int`},int64:{fn:e=>Np(e),argTypes:[`value`],arity:{kind:`exact`}},float64:{fn:e=>Ap(e),argTypes:[`value`],arity:{kind:`exact`},returnType:`float`},toDecimal:{fn:e=>Pp(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`int`},toRawJson:{fn:e=>Fp(e),argTypes:[`serializable`],arity:{kind:`exact`},returnType:`string`}}}const Lp={h:36e11,m:6e10,s:1e9,ms:1e6,us:1e3,µs:1e3,ns:1};function Rp(e){if(e===`0`)return 0;let t=!1,n=e;if(n.startsWith(`-`)?(t=!0,n=n.slice(1)):n.startsWith(`+`)&&(n=n.slice(1)),!n)return NaN;let r=0,i=/^(\d+(?:\.\d+)?)(ns|µs|us|ms|[smh])/;for(;n.length>0;){let e=i.exec(n);if(!e)return NaN;let t=parseFloat(e[1]??`0`),a=e[2];r+=t*Lp[a],n=n.slice(e[0].length)}return t?-r:r}function zp(e){if(e===0)return`0s`;let t=!1,n=e;n<0&&(t=!0,n=-n);let r;return r=n<Lp.us?`${Math.floor(n)}ns`:n<Lp.ms?Bp(n,Lp.us,3,`µs`):n<Lp.s?Bp(n,Lp.ms,6,`ms`):Vp(n),t?`-${r}`:r}function Bp(e,t,n,r){let i=Math.floor(e/t),a=Math.round(e%t);return a===0?`${i}${r}`:`${i}.${String(a).padStart(n,`0`).replace(/0+$/,``)}${r}`}function Vp(e){let t=Math.floor(e/Lp.h);e-=t*Lp.h;let n=Math.floor(e/Lp.m);e-=n*Lp.m;let r=Math.floor(e/Lp.s),i=e-r*Lp.s,a=i===0?`${r}s`:`${r}.${String(Math.round(i)).padStart(9,`0`).replace(/0+$/,``)}s`;return t>0?`${t}h${n}m${a}`:n>0?`${n}m${a}`:a}function Hp(e){return e*Lp.s}function Up(e){if(e instanceof Date)return e;if(typeof e==`bigint`)return new Date(Number(e)*1e3);if(typeof e==`number`)return new Date(e*1e3);if(typeof e==`string`){let t=new Date(e);if(!Number.isNaN(t.getTime()))return t;throw Error(`sprig: cannot parse date value ${JSON.stringify(e)}`)}throw Error(`sprig: unsupported date type: ${typeof e}`)}function Wp(e,t){let n=t().getTime()-Up(e).getTime();return zp(Math.round(n/1e3)*1e9)}const Gp=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Kp=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],qp=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],Jp=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function Yp(e){return e<10?`0${e}`:String(e)}function Xp(e){return e<10?`00${e}`:e<100?`0${e}`:String(e)}function Zp(e){return e<10?` ${e}`:String(e)}function Qp(e){let t=e>=0?`+`:`-`,n=Math.abs(e);return`${t}${Yp(Math.floor(n/60))}${Yp(n%60)}`}function $p(e){let t=e>=0?`+`:`-`,n=Math.abs(e);return`${t}${Yp(Math.floor(n/60))}:${Yp(n%60)}`}function em(e){return`${e>=0?`+`:`-`}${Yp(Math.floor(Math.abs(e)/60))}`}function tm(e){return e===0?`Z`:Qp(e)}function nm(e){return e===0?`Z`:$p(e)}function rm(e){return e===0?`Z`:em(e)}function im(e,t,n){let r=e*1e6,i=String(r).padStart(9,`0`).slice(0,t);return n?i.replace(/0+$/,``):i}const am=[[`.000000000`,e=>`.${im(e.ms,9,!1)}`],[`.999999999`,e=>{let t=im(e.ms,9,!0);return t?`.${t}`:``}],[`.000000`,e=>`.${im(e.ms,6,!1)}`],[`.999999`,e=>{let t=im(e.ms,6,!0);return t?`.${t}`:``}],[`.000`,e=>`.${Xp(e.ms)}`],[`.999`,e=>{let t=Xp(e.ms).replace(/0+$/,``);return t?`.${t}`:``}],[`January`,e=>Gp[e.month-1]??`January`],[`Monday`,e=>qp[e.weekday]??`Monday`],[`Z07:00`,e=>nm(e.offsetMinutes)],[`-07:00`,e=>$p(e.offsetMinutes)],[`Z0700`,e=>tm(e.offsetMinutes)],[`-0700`,e=>Qp(e.offsetMinutes)],[`2006`,e=>String(e.year)],[`Jan`,e=>Kp[e.month-1]??`Jan`],[`Mon`,e=>Jp[e.weekday]??`Mon`],[`MST`,e=>e.tzAbbr],[`-07`,e=>em(e.offsetMinutes)],[`Z07`,e=>rm(e.offsetMinutes)],[`15`,e=>Yp(e.hour)],[`01`,e=>Yp(e.month)],[`02`,e=>Yp(e.day)],[`_2`,e=>Zp(e.day)],[`03`,e=>Yp(e.hour12)],[`04`,e=>Yp(e.minute)],[`05`,e=>Yp(e.second)],[`06`,e=>Yp(e.year%100)],[`PM`,e=>e.hour>=12?`PM`:`AM`],[`pm`,e=>e.hour>=12?`pm`:`am`],[`1`,e=>String(e.month)],[`2`,e=>String(e.day)],[`3`,e=>String(e.hour12)],[`4`,e=>String(e.minute)],[`5`,e=>String(e.second)]];function om(e,t){let n=``,r=0;for(;r<e.length;){let i=!1;for(let[a,o]of am)if(e.startsWith(a,r)){n+=o(t),r+=a.length,i=!0;break}i||(n+=e[r++])}return n}const sm={year:`numeric`,month:`2-digit`,day:`2-digit`,weekday:`long`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1};function cm(e){let t=new Map;for(let n of e)t.set(n.type,n.value);return t}const lm=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function um(e,t){let n;try{new Intl.DateTimeFormat(`en-US`,{timeZone:t}),n=t}catch{n=`UTC`}let r=cm(new Intl.DateTimeFormat(`en-US`,{...sm,timeZone:n}).formatToParts(e)),i=parseInt(r.get(`hour`)??`0`,10)%24,a=cm(new Intl.DateTimeFormat(`en-US`,{timeZone:n,timeZoneName:`short`}).formatToParts(e)).get(`timeZoneName`)??n,o=dm(cm(new Intl.DateTimeFormat(`en-US`,{timeZone:n,timeZoneName:`shortOffset`}).formatToParts(e)).get(`timeZoneName`)??`GMT`),s=lm.indexOf(r.get(`weekday`)??`Sunday`);return{year:parseInt(r.get(`year`)??`2000`,10),month:parseInt(r.get(`month`)??`1`,10),day:parseInt(r.get(`day`)??`1`,10),weekday:s===-1?0:s,hour:i,hour12:i%12||12,minute:parseInt(r.get(`minute`)??`0`,10),second:parseInt(r.get(`second`)??`0`,10),ms:e.getUTCMilliseconds(),tzAbbr:a,offsetMinutes:o}}function dm(e){if(e===`GMT`||e===`UTC`)return 0;let t=e.match(/^GMT([+-])(\d{1,2})(?::(\d{2}))?$/);if(!t)return 0;let n=t[1]===`+`?1:-1,r=parseInt(t[2]??`0`,10),i=parseInt(t[3]??`0`,10);return n*(r*60+i)}function fm(){return Intl.DateTimeFormat().resolvedOptions().timeZone}function pm(e,t){return om(e,um(Up(t),fm()))}function mm(e,t,n){return om(e,um(Up(t),n))}function hm(e,t){let n=Up(t),r=Rp(e);return Number.isNaN(r)?n:new Date(n.getTime()+r/1e6)}function gm(e){if(typeof e==`string`){let t=parseInt(e,10);return Number.isNaN(t)?`0s`:zp(Hp(t))}return typeof e==`bigint`?zp(Hp(Number(e))):typeof e==`number`?zp(Hp(e)):`0s`}const _m=36e11*24*365,vm=36e11*24*30,ym=36e11*24,bm=36e11,xm=6e10,Sm=1e9;function Cm(e){let t=Rp(String(e));if(Number.isNaN(t))return`0s`;let n=Math.abs(t);return n>_m?`${Math.floor(n/_m)}y`:n>vm?`${Math.floor(n/vm)}mo`:n>ym?`${Math.floor(n/ym)}d`:n>bm?`${Math.floor(n/bm)}h`:n>xm?`${Math.floor(n/xm)}m`:n>Sm?`${Math.floor(n/Sm)}s`:`0s`}function wm(e){let t=um(Up(e),fm());return`${t.year}-${String(t.month).padStart(2,`0`)}-${String(t.day).padStart(2,`0`)}`}function Tm(e,t){let n=um(Up(e),t);return`${n.year}-${String(n.month).padStart(2,`0`)}-${String(n.day).padStart(2,`0`)}`}function Em(e){return e()}const Dm=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Om=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function km(){return{year:2e3,month:1,day:1,hour:0,minute:0,second:0,ms:0,offsetMinutes:0,isPM:!1,hour12:!1}}function Am(e,t,n){return[e.slice(t,t+n),t+n]}function jm(e,t,n,r){let i=t;for(;i<e.length&&i-t<r&&e.charCodeAt(i)>=48&&e.charCodeAt(i)<=57;)i++;if(i-t<n)throw Error(`sprig toDate: expected ${n}-${r} digits at pos ${t}`);return[parseInt(e.slice(t,i),10),i]}function Mm(e,t){for(let[n,r]of Dm.entries())if(e.startsWith(r,t))return[n+1,t+r.length];throw Error(`sprig toDate: expected month name at pos ${t}`)}function Nm(e,t){for(let[n,r]of Om.entries())if(e.startsWith(r,t))return[n+1,t+r.length];throw Error(`sprig toDate: expected short month name at pos ${t}`)}function Pm(e,t){for(let n of[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`])if(e.startsWith(n,t))return t+n.length;throw Error(`sprig toDate: expected weekday name at pos ${t}`)}function Fm(e,t){for(let n of[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`])if(e.startsWith(n,t))return t+n.length;throw Error(`sprig toDate: expected short weekday name at pos ${t}`)}function Im(e,t){if(e[t]===` `){let[n,r]=jm(e,t+1,1,1);return[n,r]}return jm(e,t,1,2)}function Lm(e,t,n){let r=e[t]===`+`?1:e[t]===`-`?-1:0;if(r===0)throw Error(`sprig toDate: expected +/- at pos ${t}`);let i=t+1,[a,o]=jm(e,i,2,2);i=o;let s=0;if(n&&e[i]===`:`){let[t,n]=jm(e,i+1,2,2);s=t,i=n}else if(!n){let[t,n]=jm(e,i,2,2);s=t,i=n}return[r*(a*60+s),i]}function Rm(e,t,n,r){if(e[t]===`Z`)return[0,t+1];if(r){let n=e[t]===`+`?1:e[t]===`-`?-1:0;if(n===0)throw Error(`sprig toDate: expected Z or +/- at pos ${t}`);let[r,i]=jm(e,t+1,2,2);return[n*r*60,i]}return Lm(e,t,n)}function zm(e,t){let n=t;for(;n<e.length&&e.charCodeAt(n)>=65&&e.charCodeAt(n)<=90;)n++;if(n===t)throw Error(`sprig toDate: expected timezone abbreviation at pos ${t}`);return n}function Bm(e,t,n){let[r,i]=Am(e,t,n),a=parseInt(r.padEnd(9,`0`),10);return[Math.round(a/1e6),i]}function Vm(e,t,n,r){let i={...r};switch(e){case`January`:{let[e,r]=Mm(t,n);return i.month=e,[r,i]}case`Monday`:return[Pm(t,n),i];case`Jan`:{let[e,r]=Nm(t,n);return i.month=e,[r,i]}case`Mon`:return[Fm(t,n),i];case`2006`:{let[e,r]=jm(t,n,4,4);return i.year=e,[r,i]}case`06`:{let[e,r]=jm(t,n,2,2);return i.year=e<70?2e3+e:1900+e,[r,i]}case`01`:{let[e,r]=jm(t,n,2,2);return i.month=e,[r,i]}case`1`:{let[e,r]=jm(t,n,1,2);return i.month=e,[r,i]}case`_2`:{let[e,r]=Im(t,n);return i.day=e,[r,i]}case`02`:{let[e,r]=jm(t,n,2,2);return i.day=e,[r,i]}case`2`:{let[e,r]=jm(t,n,1,2);return i.day=e,[r,i]}case`15`:{let[e,r]=jm(t,n,2,2);return i.hour=e,[r,i]}case`03`:{let[e,r]=jm(t,n,2,2);return i.hour=e,i.hour12=!0,[r,i]}case`3`:{let[e,r]=jm(t,n,1,2);return i.hour=e,i.hour12=!0,[r,i]}case`04`:{let[e,r]=jm(t,n,2,2);return i.minute=e,[r,i]}case`4`:{let[e,r]=jm(t,n,1,2);return i.minute=e,[r,i]}case`05`:{let[e,r]=jm(t,n,2,2);return i.second=e,[r,i]}case`5`:{let[e,r]=jm(t,n,1,2);return i.second=e,[r,i]}case`PM`:case`pm`:{let e=t.slice(n,n+2).toLowerCase();if(e!==`am`&&e!==`pm`)throw Error(`sprig toDate: expected AM/PM at pos ${n}, got ${JSON.stringify(t.slice(n,n+2))}`);return i.isPM=e===`pm`,i.hour12=!0,[n+2,i]}case`MST`:return[zm(t,n),i];case`-0700`:{let[e,r]=Lm(t,n,!1);return i.offsetMinutes=e,[r,i]}case`-07:00`:{let[e,r]=Lm(t,n,!0);return i.offsetMinutes=e,[r,i]}case`-07`:{let e=t[n]===`+`?1:t[n]===`-`?-1:0;if(e===0)throw Error(`sprig toDate: expected +/- at pos ${n}`);let[r,a]=jm(t,n+1,2,2);return i.offsetMinutes=e*r*60,[a,i]}case`Z0700`:{let[e,r]=Rm(t,n,!1,!1);return i.offsetMinutes=e,[r,i]}case`Z07:00`:{let[e,r]=Rm(t,n,!0,!1);return i.offsetMinutes=e,[r,i]}case`Z07`:{let[e,r]=Rm(t,n,!1,!0);return i.offsetMinutes=e,[r,i]}case`.000000000`:{if(t[n]!==`.`)throw Error(`sprig toDate: expected . at pos ${n}`);let[e,r]=Bm(t,n+1,9);return i.ms=e,[r,i]}case`.999999999`:{if(t[n]!==`.`)return[n,i];let e=n+1,r=e;for(;r<t.length&&t.charCodeAt(r)>=48&&t.charCodeAt(r)<=57;)r++;let a=t.slice(e,r).padEnd(9,`0`);return i.ms=Math.round(parseInt(a,10)/1e6),[r,i]}case`.000000`:{if(t[n]!==`.`)throw Error(`sprig toDate: expected . at pos ${n}`);let[e,r]=Bm(t,n+1,6);return i.ms=e,[r,i]}case`.999999`:{if(t[n]!==`.`)return[n,i];let e=n+1,r=e;for(;r<t.length&&t.charCodeAt(r)>=48&&t.charCodeAt(r)<=57;)r++;let a=t.slice(e,r).padEnd(9,`0`);return i.ms=Math.round(parseInt(a,10)/1e6),[r,i]}case`.000`:{if(t[n]!==`.`)throw Error(`sprig toDate: expected . at pos ${n}`);let[e,r]=Bm(t,n+1,3);return i.ms=e,[r,i]}case`.999`:{if(t[n]!==`.`)return[n,i];let e=n+1,r=e;for(;r<t.length&&t.charCodeAt(r)>=48&&t.charCodeAt(r)<=57;)r++;let a=t.slice(e,r).padEnd(3,`0`);return i.ms=parseInt(a,10),[r,i]}}throw Error(`sprig toDate: unhandled token ${e}`)}const Hm=`.000000000,.999999999,.000000,.999999,.000,.999,January,Monday,Z07:00,-07:00,Z0700,-0700,2006,Jan,Mon,MST,-07,Z07,15,01,02,_2,03,04,05,06,PM,pm,1,2,3,4,5`.split(`,`);function Um(e,t){let n=0,r=0,i=km();for(;n<e.length;){let a=!1;for(let o of Hm)if(e.startsWith(o,n)){let[e,s]=Vm(o,t,r,i);r=e,i=s,n+=o.length,a=!0;break}if(!a){let i=e.charAt(n);if(t[r]!==i)throw Error(`sprig toDate: expected ${JSON.stringify(i)} at pos ${r}, got ${JSON.stringify(t[r])}`);n++,r++}}if(r!==t.length)throw Error(`sprig toDate: extra characters at pos ${r}: ${JSON.stringify(t.slice(r))}`);if(i.hour12){let e=i.hour%12;i.hour=i.isPM?e+12:e}let a=Date.UTC(i.year,i.month-1,i.day,i.hour,i.minute,i.second,i.ms)-i.offsetMinutes*60*1e3;return new Date(a)}function Wm(e,t){return Um(e,t)}function Gm(e){return String(Math.floor(Up(e).getTime()/1e3))}function Km(e=()=>new Date){return{now:{fn:()=>Em(e),argTypes:[],arity:{kind:`exact`}},date:{fn:(e,t)=>pm(e,t),argTypes:[`string`,`value`],arity:{kind:`exact`}},dateInZone:{fn:(e,t,n)=>mm(e,t,n),argTypes:[`string`,`value`,`string`],arity:{kind:`exact`}},dateModify:{fn:(e,t)=>hm(e,t),argTypes:[`string`,`value`],arity:{kind:`exact`}},htmlDate:{fn:e=>wm(e),argTypes:[`value`],arity:{kind:`exact`}},htmlDateInZone:{fn:(e,t)=>Tm(e,t),argTypes:[`value`,`string`],arity:{kind:`exact`}},duration:{fn:e=>gm(e),argTypes:[`value`],arity:{kind:`exact`}},durationRound:{fn:e=>Cm(e),argTypes:[`value`],arity:{kind:`exact`}},toDate:{fn:(e,t)=>Wm(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},ago:{fn:t=>Wp(t,e),argTypes:[`value`],arity:{kind:`exact`}},unixEpoch:{fn:e=>Gm(e),argTypes:[`value`],arity:{kind:`exact`}}}}function qm(e){return e==null||e===!1?!0:typeof e==`number`?e===0||Number.isNaN(e):typeof e==`bigint`?e===0n:typeof e==`string`||Array.isArray(e)?e.length===0:e instanceof Map||e instanceof Set?e.size===0:typeof e==`object`?Object.keys(e).length===0:!1}function Jm(...e){for(let t of e)if(!qm(t))return t}function Ym(e,t){return qm(t)?e:t}function Xm(e){return JSON.parse(e)}function Zm(e,t,n){return _f(n)?e:t}function Qm(e){return JSON.stringify(e)??`null`}function $m(e){return JSON.stringify(e,null,2)??`null`}function eh(){return{default:{fn:(e,t)=>Ym(e,t),argTypes:[`value`,`truthy`],arity:{kind:`variadic`}},empty:{fn:e=>qm(e),argTypes:[`truthy`],arity:{kind:`exact`}},coalesce:{fn:(...e)=>Jm(...e),argTypes:[`truthy`],arity:{kind:`variadic`}},ternary:{fn:(e,t,n)=>Zm(e,t,n),argTypes:[`value`,`value`,`truthy`],arity:{kind:`exact`}},fromJson:{fn:e=>Xm(e),argTypes:[`string`],arity:{kind:`exact`}},toJson:{fn:e=>Qm(e),argTypes:[`serializable`],arity:{kind:`exact`},returnType:`string`},toPrettyJson:{fn:e=>$m(e),argTypes:[`serializable`],arity:{kind:`exact`},returnType:`string`}}}function th(...e){let t={};for(let n=0;n<e.length;n+=2)t[e[n]]=e[n+1];return t}function nh(e){if(e.kind!==`call`||e.name!==`dict`||e.args.length%2!=0)return null;let t=[];for(let[n,r]of e.args.entries()){if(r.kind!==`literal`||n%2==0&&typeof r.value!=`string`)return null;t.push(r.value)}return th(...t)}function rh(e,t){return e[t]}function ih(e,t){return t in e}function ah(e){return Object.keys(e)}function oh(e,...t){let n={...e};for(let e of t)for(let[t,r]of Object.entries(e))t in n||(n[t]=r);return n}function sh(e,...t){let n={...e};for(let e of t)Object.assign(n,e);return n}function ch(e,...t){let n=new Set(t),r={};for(let[t,i]of Object.entries(e))n.has(t)||(r[t]=i);return r}function lh(e,...t){let n={};for(let r of t)r in e&&(n[r]=e[r]);return n}function uh(e,...t){let n=[];for(let r of t)e in r&&n.push(r[e]);return n}function dh(e,t,n){return e[t]=n,e}function fh(e,t){return delete e[t],e}function ph(e){return Object.values(e)}function mh(){return{dict:{fn:(...e)=>th(...e),argTypes:[`string`,`value`],arity:{kind:`alternating`,minimum:0}},get:{fn:(e,t)=>rh(e,t),argTypes:[`dict`,`string`],arity:{kind:`exact`}},set:{fn:(e,t,n)=>dh(e,t,n),argTypes:[`dict`,`string`,`value`],arity:{kind:`exact`}},unset:{fn:(e,t)=>fh(e,t),argTypes:[`dict`,`string`],arity:{kind:`exact`}},keys:{fn:e=>ah(e),argTypes:[`dict`],arity:{kind:`variadic`}},values:{fn:e=>ph(e),argTypes:[`dict`],arity:{kind:`exact`}},pluck:{fn:(e,...t)=>uh(e,...t),argTypes:[`string`,`dict`],arity:{kind:`variadic`}},pick:{fn:(e,...t)=>lh(e,...t),argTypes:[`dict`,`string`],arity:{kind:`variadic`}},omit:{fn:(e,...t)=>ch(e,...t),argTypes:[`dict`,`string`],arity:{kind:`variadic`}},hasKey:{fn:(e,t)=>ih(e,t),argTypes:[`dict`,`string`],arity:{kind:`exact`}},merge:{fn:(e,...t)=>oh(e,...t),argTypes:[`dict`,`dict`],arity:{kind:`variadic`}},mergeOverwrite:{fn:(e,...t)=>sh(e,...t),argTypes:[`dict`,`dict`],arity:{kind:`variadic`}}}}new TextEncoder,new Map(Array.from(`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`).map((e,t)=>[e,t])),new TextDecoder,new TextEncoder,new TextDecoder,new TextEncoder;function hh(...e){for(let t of e)if(qm(t))return!1;return!0}function gh(...e){for(let t of e)if(!qm(t))return!0;return!1}function _h(e,t){return[...e,t]}function vh(e,t){let n=Math.max(1,e),r=[];for(let e=0;e<t.length;e+=n)r.push(t.slice(e,e+n));return r}function yh(e){return e.filter(e=>!qm(e))}function bh(...e){let t=[];for(let n of e)t.push(...n);return t}const xh={line:0,column:0,offset:0};function Sh(e,t,n,r){return new Cd(e,t,n,r,xh)}function Ch(...e){if(e.length<3)throw Sh(`dig`,0,`at least 3 arguments (...keys, default, dict)`,`${e.length} argument${e.length===1?``:`s`}`);let t=e[e.length-1],n=e[e.length-2],r=e.slice(0,-2);if(!Th(t))throw Sh(`dig`,e.length-1,`dict`,Eh(t));for(let e=0;e<r.length;e++)if(typeof r[e]!=`string`)throw Sh(`dig`,e,`string`,Eh(r[e]));return wh(t,n,r,e.length)}function wh(e,t,n,r){let i=n[0];if(!Object.hasOwn(e,i))return t;let a=e[i];if(n.length===1)return a;if(!Th(a))throw Sh(`dig`,r-1,`dict at intermediate key`,Eh(a));return wh(a,t,n.slice(1),r)}function Th(e){return typeof e==`object`&&!!e&&!Array.isArray(e)&&!(e instanceof Map)&&!(e instanceof Set)}function Eh(e){return e===null?`null`:Array.isArray(e)?`array`:e instanceof Map?`Map`:e instanceof Set?`Set`:typeof e}function Dh(e){return e[0]}function Oh(e,t){return t.some(t=>pf(t,e))}function kh(e){return e.slice(0,-1)}function Ah(e){return e[e.length-1]}function jh(e){return Array.isArray(e)||typeof e==`string`?e.length:e instanceof Map||e instanceof Set?e.size:Object.keys(e).length}function Mh(...e){return e}function Nh(e,t){return[t,...e]}function Ph(e){return e.slice(1)}function Fh(e){return[...e].reverse()}function Ih(e,t,n){let r=t===void 0?0:t,i=n===void 0?e.length:n;return e.slice(r,i)}function Lh(e){let t=[];for(let n of e)n!=null&&t.push(String(n));return t.sort()}function Rh(e){let t=[];for(let n of e)t.some(e=>pf(e,n))||t.push(n);return t}function zh(e,...t){return e.filter(e=>!t.some(t=>pf(t,e)))}function Bh(){return{list:{fn:(...e)=>Mh(...e),argTypes:[`value`],arity:{kind:`variadic`}},first:{fn:e=>Dh(e),argTypes:[`list`],arity:{kind:`exact`}},last:{fn:e=>Ah(e),argTypes:[`list`],arity:{kind:`exact`}},rest:{fn:e=>Ph(e),argTypes:[`list`],arity:{kind:`exact`}},initial:{fn:e=>kh(e),argTypes:[`list`],arity:{kind:`exact`}},len:{fn:e=>jh(e),argTypes:[`sized`],arity:{kind:`exact`}},reverse:{fn:e=>Fh(e),argTypes:[`list`],arity:{kind:`exact`}},uniq:{fn:e=>Rh(e),argTypes:[`list`],arity:{kind:`exact`}},without:{fn:(e,...t)=>zh(e,...t),argTypes:[`list`,`value`],arity:{kind:`variadic`}},has:{fn:(e,t)=>Oh(e,t),argTypes:[`value`,`list`],arity:{kind:`exact`}},compact:{fn:e=>yh(e),argTypes:[`list`],arity:{kind:`exact`}},slice:{fn:(e,t,n)=>Ih(e,t,n),argTypes:[`list`,`truncating-int`],arity:{kind:`variadic`}},concat:{fn:(...e)=>bh(...e),argTypes:[`list`],arity:{kind:`variadic`}},chunk:{fn:(e,t)=>vh(e,t),argTypes:[`int`,`list`],arity:{kind:`exact`}},prepend:{fn:(e,t)=>Nh(e,t),argTypes:[`list`,`value`],arity:{kind:`exact`}},append:{fn:(e,t)=>_h(e,t),argTypes:[`list`,`value`],arity:{kind:`exact`}},sortAlpha:{fn:e=>Lh(e),argTypes:[`list`],arity:{kind:`exact`},returnType:`list`},push:{fn:(e,t)=>_h(e,t),argTypes:[`list`,`value`],arity:{kind:`exact`}},tuple:{fn:(...e)=>Mh(...e),argTypes:[`value`],arity:{kind:`variadic`}},dig:{fn:(...e)=>Ch(...e),argTypes:[`value`],arity:{kind:`variadic`}},all:{fn:(...e)=>hh(...e),argTypes:[`truthy`],arity:{kind:`variadic`},returnType:`bool`},any:{fn:(...e)=>gh(...e),argTypes:[`truthy`],arity:{kind:`variadic`},returnType:`bool`}}}function Vh(...e){return e.reduce((e,t)=>e+t,0)}function Hh(e){return e+1}function Uh(e){return e+1}function Wh(...e){return e.reduce((e,t)=>e+t,0)}function Gh(e){return Math.ceil(e)}function Kh(e,t){return Math.trunc(e/t)}function qh(e,...t){return t.reduce((e,t)=>e/t,e)}function Jh(e){return Math.floor(e)}function Yh(...e){return e.reduce((e,t)=>t>e?t:e,-1/0)}function Xh(...e){return e.reduce((e,t)=>Math.max(e,t),-1/0)}function Zh(...e){return e.reduce((e,t)=>t<e?t:e,1/0)}function Qh(...e){return e.reduce((e,t)=>Math.min(e,t),1/0)}function $h(e,t){return e%t}function eg(...e){return e.reduce((e,t)=>e*t,1)}function tg(...e){return e.reduce((e,t)=>e*t,1)}function ng(e,t=0){let n=10**t;return Math.sign(e)*Math.round(Math.abs(e)*n)/n}function rg(e,t,n){let r=[];if(t<e){if(n>=0)return r;for(let i=e;i>t;i+=n)r.push(i);return r}if(n<=0)return r;for(let i=e;i<t;i+=n)r.push(i);return r}function ig(...e){let t=1;switch(e.length){case 0:return``;case 1:{let n=e[0];return n<1&&(t=-1),rg(1,n+t,t).join(` `)}case 2:{let t=e[0],n=e[1],r=n<t?-1:1;return rg(t,n+r,r).join(` `)}case 3:{let n=e[0],r=e[1],i=e[2];return i<n&&(t=-1,r>0)?``:rg(n,i+t,r).join(` `)}default:return``}}function ag(e,t){return e-t}function og(e,...t){return t.reduce((e,t)=>e-t,e)}function sg(e){return rg(0,e,e<0?-1:1)}function cg(){return{add:{fn:(...e)=>Vh(...e),argTypes:[`truncating-int`],arity:{kind:`variadic`}},sub:{fn:(e,t)=>ag(e,t),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`exact`}},mul:{fn:(...e)=>eg(...e),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`variadic`}},div:{fn:(e,t)=>Kh(e,t),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`exact`}},mod:{fn:(e,t)=>$h(e,t),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`exact`}},min:{fn:(...e)=>Zh(...e),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`variadic`}},max:{fn:(...e)=>Yh(...e),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`variadic`}},floor:{fn:e=>Jh(e),argTypes:[`float`],arity:{kind:`exact`}},ceil:{fn:e=>Gh(e),argTypes:[`float`],arity:{kind:`exact`}},round:{fn:(e,t)=>ng(e,t),argTypes:[`float`,`int`,`float`],arity:{kind:`variadic`}},addf:{fn:(...e)=>Wh(...e),argTypes:[`float`],arity:{kind:`variadic`}},subf:{fn:(e,...t)=>og(e,...t),argTypes:[`float`,`float`],arity:{kind:`variadic`}},mulf:{fn:(...e)=>tg(...e),argTypes:[`float`,`float`],arity:{kind:`variadic`}},divf:{fn:(e,...t)=>qh(e,...t),argTypes:[`float`,`float`],arity:{kind:`variadic`}},add1:{fn:e=>Hh(e),argTypes:[`truncating-int`],arity:{kind:`exact`}},add1f:{fn:e=>Uh(e),argTypes:[`float`],arity:{kind:`exact`}},maxf:{fn:(...e)=>Xh(...e),argTypes:[`float`,`float`],arity:{kind:`variadic`}},minf:{fn:(...e)=>Qh(...e),argTypes:[`float`,`float`],arity:{kind:`variadic`}},biggest:{fn:(...e)=>Yh(...e),argTypes:[`truncating-int`,`truncating-int`],arity:{kind:`variadic`}},seq:{fn:(...e)=>ig(...e),argTypes:[`int`],arity:{kind:`variadic`},returnType:`string`},until:{fn:e=>sg(e),argTypes:[`int`],arity:{kind:`exact`},returnType:`list`},untilStep:{fn:(e,t,n)=>rg(e,t,n),argTypes:[`int`,`int`,`int`],arity:{kind:`exact`},returnType:`list`}}}Array.from({length:95},(e,t)=>String.fromCharCode(t+32)).join(``);function lg(e){return Array.from(e)}function ug(e,t){return e===``?lg(t):t.split(e)}function dg(e,t){let n=lg(t);return n.length<=e||e<4?t:`${n.slice(0,e-3).join(``)}...`}function fg(e,t,n){let r=lg(n);return t<7||r.length<t||e<0||e>r.length-t+1?n:`...${r.slice(e,e+t-6).join(``)}...`}const q={Invalid:0,Number:1,UpperCase:2,Alphabet:3,Connector:4,Punct:5,Other:6},pg=/^[-_\s]$/,mg=/^\p{P}$/u,hg=/^\p{L}$/u,gg=/^\p{Lu}$/u,_g=/^\p{N}$/u;function vg(e){return e!==void 0&&pg.test(e)}function yg(e){return e!==void 0&&hg.test(e)}function bg(e){return e!==void 0&&gg.test(e)}function xg(e){return e!==void 0&&_g.test(e)}function Sg(e){return e!==void 0&&mg.test(e)}function Cg(e,t){if(t>=e.length)return{word:{wt:q.Invalid,text:``},next:t};let n=e[t],r=t+1;if(vg(n)){for(;r<e.length&&vg(e[r]);)r++;return{word:{wt:q.Connector,text:e.slice(t,r).join(``)},next:r}}if(Sg(n)){for(;r<e.length&&Sg(e[r]);)r++;return{word:{wt:q.Punct,text:e.slice(t,r).join(``)},next:r}}if(bg(n)){if(r>=e.length)return{word:{wt:q.UpperCase,text:n},next:r};if(bg(e[r])){let n=r;for(;n<e.length&&bg(e[n]);)n++;return n<e.length&&yg(e[n])?{word:{wt:q.UpperCase,text:e.slice(t,n-1).join(``)},next:n-1}:{word:{wt:q.UpperCase,text:e.slice(t,n).join(``)},next:n}}if(yg(e[r])){let n=r+1;for(;n<e.length&&yg(e[n])&&!bg(e[n]);)n++;return{word:{wt:q.UpperCase,text:e.slice(t,n).join(``)},next:n}}return{word:{wt:q.UpperCase,text:n},next:r}}if(yg(n)){for(;r<e.length&&yg(e[r])&&!bg(e[r]);)r++;return{word:{wt:q.Alphabet,text:e.slice(t,r).join(``)},next:r}}if(xg(n)){for(;r<e.length&&xg(e[r]);)r++;return{word:{wt:q.Number,text:e.slice(t,r).join(``)},next:r}}for(;r<e.length&&!vg(e[r])&&!yg(e[r])&&!xg(e[r])&&!Sg(e[r]);)r++;return{word:{wt:q.Other,text:e.slice(t,r).join(``)},next:r}}function wg(e,t,n){if(t.wt!==q.UpperCase&&t.wt!==q.Connector){e.push(t.text);return}for(let r of t.text)vg(r)?e.push(n):bg(r)?e.push(r.toLowerCase()):e.push(r)}function Tg(e,t){if(e.length===0)return``;let n=lg(e),r=[],{word:i,next:a}=Cg(n,0);for(;a<n.length;){i.wt!==q.Connector&&wg(r,i,t);let e=i,o=i;if({word:i,next:a}=Cg(n,a),e.wt===q.Number){for(;i.wt===q.Alphabet||i.wt===q.Number;)wg(r,i,t),{word:i,next:a}=Cg(n,a);i.wt!==q.Invalid&&i.wt!==q.Punct&&i.wt!==q.Connector&&r.push(t);continue}if(e.wt===q.Connector){wg(r,o,t);continue}if(e.wt===q.Punct)continue;if(i.wt!==q.Number){i.wt!==q.Connector&&i.wt!==q.Punct&&r.push(t);continue}if(a>=n.length)continue;let s=i;if({word:i,next:a}=Cg(n,a),i.wt!==q.Alphabet){wg(r,s,t),i.wt!==q.Connector&&i.wt!==q.Punct&&r.push(t);continue}for(r.push(t),wg(r,s,t);i.wt===q.Alphabet||i.wt===q.Number;)wg(r,i,t),{word:i,next:a}=Cg(n,a);i.wt!==q.Invalid&&i.wt!==q.Connector&&i.wt!==q.Punct&&r.push(t)}return wg(r,i,t),r.join(``).toLowerCase()}function Eg(e){if(e.length===0)return``;let t=lg(e),n=[],r=0,i=``;for(;r<t.length;){if(i=t[r],r++,!vg(i)){i=i.toUpperCase();break}n.push(i)}if(r>=t.length)return t.length>0&&n.push(i),n.join(``);for(;r<t.length;){let e=i;if(i=t[r],r++,vg(i)&&vg(e)){n.push(e);continue}vg(e)?i=i.toUpperCase():(i=i.toLowerCase(),n.push(e))}return n.push(i),n.join(``)}function Dg(e){return Eg(e)}function Og(...e){return e.join(` `)}function kg(e,t){return t.includes(e)}function Ag(e,t){return t.startsWith(e)}function jg(e,t){return t.endsWith(e)}function Mg(e,t){let n=` `.repeat(Math.max(0,e));return t.split(`
51
51
  `).map(e=>n+e).join(`
52
- `)}function Mg(e){let t=new TextEncoder;return e.split(/\s+/).filter(e=>e.length>0).map(e=>String.fromCharCode(...t.encode(e).slice(0,1))).join(``)}function Ng(e,t){let n=[];for(let e of t){if(typeof e==`object`&&e)throw xh(`join`,2,`list of strings/primitives`,`list element of type ${Pg(e)}`);n.push(String(e))}return n.join(e)}function Pg(e){return Array.isArray(e)?`array`:e instanceof Map?`Map`:e instanceof Set?`Set`:`object`}function Fg(e){return wg(e,`-`)}function Ig(e){return e.toLowerCase()}function Lg(e,t){return`\n${jg(e,t)}`}function Rg(e){return e.replace(/\s+/g,``)}function zg(e,t,n){return n===1?e:t}function Bg(...e){return e.map(e=>`"${e}"`).join(` `)}function Vg(e){return e.replace(/[\\.+*?()|[\]{}^$]/g,`\\$&`)}function Hg(e,t){return t.repeat(Math.max(0,e))}function Ug(e,t,n){return lg(e,n).join(t)}function Wg(e){return wg(e,`_`)}function Gg(e,t){let n=lg(e,t),r={};for(let e=0;e<n.length;e++)r[`_${e}`]=n[e];return r}function Kg(e,t){return lg(e,t)}function qg(e,t,n){let r=Jg(n,e,t),i={};for(let e=0;e<r.length;e++)i[`_${e}`]=r[e]??``;return i}function Jg(e,t,n){if(n===0)return[];let r=lg(t,e);if(n<0||r.length<=n)return r;let i=r.slice(0,n-1),a=r.slice(n-1).join(t);return[...i,a]}function Yg(...e){return e.map(e=>`'${e}'`).join(` `)}function Xg(e,t,n){let r=cg(n),i=t<0||t>r.length?r.length:t,a=Math.min(Math.max(0,e),i);return r.slice(a,i).join(``)}function Zg(e){let t=``;for(let n of e)Qg(n)?t+=n.toLowerCase():$g(n)?t+=n.toUpperCase():t+=n;return t}function Qg(e){return e!==e.toLowerCase()&&e===e.toUpperCase()}function $g(e){return e!==e.toUpperCase()&&e===e.toLowerCase()}function e_(e){return e.replace(/\b([a-zA-Z])/g,e=>e.toUpperCase())}function t_(e){return e.trim()}function n_(e,t){if(e.length===0)return t;let n=new Set(cg(e)),r=cg(t),i=0;for(;i<r.length&&n.has(r[i]);)i+=1;let a=r.length;for(;a>i&&n.has(r[a-1]);)--a;return r.slice(i,a).join(``)}function r_(e,t){return t.startsWith(e)?t.slice(e.length):t}function i_(e,t){return t.endsWith(e)?t.slice(0,t.length-e.length):t}function a_(e,t){let n=cg(t);if(e<0){let r=-e;return r>=n.length?t:n.slice(n.length-r).join(``)}return e>=n.length?t:n.slice(0,e).join(``)}function o_(e){return e.replace(/\b([A-Z])/g,e=>e.toLowerCase())}function s_(e){return e.toUpperCase()}function c_(e,t){return l_(e,`
53
- `,t)}function l_(e,t,n){if(e<=0)return n;let r=[];for(let t of n.split(`
54
- `)){let n=``;for(let i of t.split(/\s+/))i.length!==0&&(n.length===0?n=i:n.length+1+i.length<=e?n+=` ${i}`:(r.push(n),n=i));n.length>0&&r.push(n)}return r.join(t)}function u_(e,t,n){return l_(e,t,n)}function d_(){return{abbrev:{fn:(e,t)=>ug(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},abbrevboth:{fn:(e,t,n)=>dg(e,t,n),argTypes:[`int`,`int`,`string`],arity:{kind:`exact`}},camelcase:{fn:e=>Eg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},cat:{fn:(...e)=>Dg(...e),argTypes:[`string`],arity:{kind:`variadic`}},contains:{fn:(e,t)=>Og(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},hasPrefix:{fn:(e,t)=>kg(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},hasSuffix:{fn:(e,t)=>Ag(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},indent:{fn:(e,t)=>jg(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},initials:{fn:e=>Mg(e),argTypes:[`string`],arity:{kind:`exact`}},join:{fn:(e,t)=>Ng(e,t),argTypes:[`string`,`list`],arity:{kind:`exact`}},kebabcase:{fn:e=>Fg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},lower:{fn:e=>Ig(e),argTypes:[`string`],arity:{kind:`exact`}},nindent:{fn:(e,t)=>Lg(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},nospace:{fn:e=>Rg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},plural:{fn:(e,t,n)=>zg(e,t,n),argTypes:[`string`,`string`,`int`],arity:{kind:`exact`},returnType:`string`},quote:{fn:(...e)=>Bg(...e),argTypes:[`string`],arity:{kind:`variadic`}},regexQuoteMeta:{fn:e=>Vg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},repeat:{fn:(e,t)=>Hg(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},replace:{fn:(e,t,n)=>Ug(e,t,n),argTypes:[`string`,`string`,`string`],arity:{kind:`exact`}},snakecase:{fn:e=>Wg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},split:{fn:(e,t)=>Gg(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},splitList:{fn:(e,t)=>Kg(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},splitn:{fn:(e,t,n)=>qg(e,t,n),argTypes:[`string`,`int`,`string`],arity:{kind:`exact`},returnType:`dict`},squote:{fn:(...e)=>Yg(...e),argTypes:[`string`],arity:{kind:`variadic`}},substr:{fn:(e,t,n)=>Xg(e,t,n),argTypes:[`int`,`int`,`string`],arity:{kind:`exact`}},swapcase:{fn:e=>Zg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},title:{fn:e=>e_(e),argTypes:[`string`],arity:{kind:`exact`}},trim:{fn:e=>t_(e),argTypes:[`string`],arity:{kind:`exact`}},trimAll:{fn:(e,t)=>n_(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},trimPrefix:{fn:(e,t)=>r_(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},trimSuffix:{fn:(e,t)=>i_(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},trunc:{fn:(e,t)=>a_(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},untitle:{fn:e=>o_(e),argTypes:[`string`],arity:{kind:`exact`}},upper:{fn:e=>s_(e),argTypes:[`string`],arity:{kind:`exact`}},wrap:{fn:(e,t)=>c_(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},wrapWith:{fn:(e,t,n)=>u_(e,t,n),argTypes:[`int`,`string`,`string`],arity:{kind:`exact`}}}}function f_(e){return e}function p_(e,t,n){return n===void 0?_u+hu(e)+`.`+hu(t):m_(n)}function m_(e){return _u+hu(e)}function h_(e,t){return e+`.`+t}function g_(e){return e+`.page`}const __=[`closeOnPick`,`paged`,`key`,`distribution`],v_=e=>__.includes(e),y_=`"closeOnPick" (bool, default false), "paged" (bool, default true), "key" (string, accordion grouping), "distribution" (one of ${ua.map(e=>`"${e}"`).join(`, `)}; default "van-der-corput")`;function b_(e){for(let t of Object.keys(e))if(!v_(t))throw Error(`unknown {{ menu }} option "${t}" — the options dict takes ${y_}`);let t=(t,n)=>{let r=e[t];if(r===void 0)return n;if(typeof r!=`boolean`)throw Error(`{{ menu }} option "${t}" must be a boolean, got ${JSON.stringify(r)} (e.g. (dict "${t}" ${String(!n)}))`);return r},n=e.key;if(n!==void 0&&typeof n!=`string`)throw Error(`{{ menu }} option "key" must be a string naming the accordion group, got ${JSON.stringify(n)}`);if(n===``)throw Error(`{{ menu }} has an empty accordion key — a shared key must be a non-empty name (or omit "key" for an independent menu)`);let r=e.distribution;if(r!==void 0&&!da(r))throw Error(`{{ menu }} option "distribution" must be one of: ${ua.join(`, `)}; got ${JSON.stringify(r)}`);return{closeOnPick:t(`closeOnPick`,!1),paged:t(`paged`,!0),key:n,distribution:pa(r)}}const x_=`default`,S_={};function C_(e){return[...new Set([x_,...Object.keys(e)])]}function w_(e,t,n){return to(void 0,e,t,x_,n)}function T_(e,t){let n={[x_]:S_,...e}[t];if(n===void 0)throw Error(`Preset "${t}" is not declared in this config — effectivePresetName collapses unknown names to "${x_}", which always resolves; a miss here means a raw name reached this function without going through that resolution`);return n}function E_(e,t){let n=T_(e.presets,t).root??kc;return{node:Nc(Ic(n,e.root)),path:Lc(n)?`presets.${t}.root`:`root`}}function D_(e,t){return{...e.globals,...T_(e.presets,t).globals}}const O_=`menu`,k_=`a menu binds its trigger text the way a cycle action binds a display — write {{ menu "applyTheme" "▸" "▾" }} (one per state) or {{ menu "insertHere" "+" }} (one static display for both), with the rare knobs in ONE trailing dict: {{ menu "applyTheme" "▸" "▾" (dict "closeOnPick" true "paged" false "key" "pickers") }} (defaults: closeOnPick false, paged true, no key). The renderer no longer appends ▸/▾ of its own (candybar-settings-ui-aok.4), and the older positional tail ("pageAction" closeOnPick paged "key") was removed — the page cursor is synthesized from the menu's identity`,A_=e=>e.kind===`call`&&e.name===`dict`,j_=e=>e.kind===`literal`&&typeof e.value!=`object`,M_=e=>Wc(``,e,2)===void 0;function N_(e){let t=e=>({kind:`issue`,message:e}),[n,...r]=e.argExprs;if(n===void 0)return t(`with no arguments — it takes an apply-action name and its trigger text (e.g. {{ menu "applyTheme" "▸" "▾" }})`);if(n.kind!==`literal`||typeof n.value!=`string`)return t(`whose apply action is not a string literal — a menu's identity is its apply-action name, which must be a literal so it can be gated at load (e.g. {{ menu "applyTheme" "▸" "▾" }})`);let i=r[r.length-1],a=i!==void 0&&A_(i)?i:void 0,o=a===void 0?r:r.slice(0,-1);if(o.some(A_))return t(`whose options (dict …) is not its last argument — ${k_}`);if(i!==void 0&&a===void 0&&!j_(i)&&M_(o.length-1))return t(`whose last argument is neither a literal nor a literal (dict …) — the renderer tells a display from the options dict by the value it evaluates to, so this call could be read as ${o.length} displays or as ${o.length-1} plus options, and both are legal. Make the options explicit as a trailing (dict …) — {{ menu "${n.value}" (printf "…") (printf "…") (dict) }} binds dynamic displays unambiguously — or bind the trigger text as literals`);let s=Wc(`whose trigger`,o.length,2);if(s!==void 0)return t(`${s} — ${k_}`);let c=a===void 0?{}:th(a);if(c===null)return t(`whose options (dict …) is not fully literal — every option value must be a literal so the menu can be gated at load (a dynamic entry like (dict "key" .x) cannot)`);let l;try{l=b_(c)}catch(e){return t(`with invalid options — ${e.message}`)}let u=l.key;if(u!==void 0){let e=xu(u);if(e!==void 0)return t(`whose accordion key "${u}" lands in the reserved "${e}" namespace — a key is collapsed to an identifier (${JSON.stringify(u)} becomes "${m_(u)}"), so it would share one open-state key with the synthesized accordion that owns that namespace instead of grouping only your own menus. Name the group without the reserved prefix`)}return{kind:`ok`,apply:n.value,options:l}}function P_(e){let t=up({fromString:e=>e});try{return t.parse(e).referencedCalls().filter(e=>e.name===O_).map(N_)}catch{return`parse-failed`}}function F_(e){let t=up({fromString:e=>e});try{return t.parse(e).referencedFunctions().has(O_)}catch{return!1}}function I_(e,t,n){e.issues.push({path:t,message:n,line:U(e.source,[`root`])})}function L_(e,t){Su(e,t,_u,`{{ menu }} helpers`);for(let[n,r]of Object.entries(t.helpers??{}))F_(r)&&e.issues.push({path:`helpers.${n}`,message:`helper "${n}" uses {{ menu }}, but a menu must live directly in a segment template — its identity is derived from the segment it sits in, which a shared helper does not have. Inline the {{ menu }} call into each segment that needs it.`,line:U(e.source,[`helpers`,n])});let n=t.segments??{};for(let[t,r]of Object.entries(n))for(let n of[`bg`,`fg`,`when`]){let i=r[n];typeof i==`string`&&F_(i)&&I_(e,`segments.${t}.${n}`,`segment "${t}" uses {{ menu }} in its "${n}" — a menu is only valid in a segment's "template" (its placement is published only there; "${n}" needs a ${n===`when`?`predicate`:`color`}). Move the {{ menu }} into the template.`)}if(t.root!==void 0)for(let n of js(Pc(t.root)))typeof n.when==`string`&&F_(n.when)&&I_(e,`root`,`a layout node's "when" predicate uses {{ menu }} — a menu is only valid in a segment's "template", not a node predicate. Move it into a segment.`);for(let[t,{template:r}]of Object.entries(n)){if(r===void 0||!F_(r))continue;let n=P_(r);if(n!==`parse-failed`)for(let r of n){let n=r.kind===`issue`?r.message:R_(r.apply);n!==void 0&&I_(e,`segments.${t}`,`segment "${t}" has a {{ menu }} ${n}.`)}}}function R_(e){if(e===``)return`with an empty apply-action name — an empty member aliases the absent-state sentinel ("") so the menu would render open before any click. Name the apply action`;if(f_(e)===`closed`)return`whose apply action is named "${Hc}", which collides with the menu's closed-state sentinel and leaves it unopenable. Rename the action`}function z_(e,t){let n={},r={},i=new Map,a=new Set,o=(e,n)=>{let r=`segments.${e}`;a.has(`${r}\0${n}`)||(a.add(`${r}\0${n}`),t.push({path:r,message:n}))};for(let t of C_(e.presets)){let a=new Map,s=new Map;for(let c of js(E_(e,t).node)){if(c.kind!==`segment`)continue;let t=e.segments[c.name];if(t===void 0)continue;i.has(c.name)||i.set(c.name,P_(t.template));let l=i.get(c.name);if(l===`parse-failed`)continue;let u=Ds(c);for(let[e,t]of l.entries()){if(t.kind===`issue`||R_(t.apply)!==void 0)continue;let{apply:i,options:l}=t,d=f_(i),f=p_(u,i,l.key),p=g_(f),m=l.key===void 0?`ind ${u} ${i}`:`key ${l.key}`,h=[f,p].find(e=>{let t=a.get(e);return t!==void 0&&t!==m});if(h!==void 0){o(c.name,`two {{ menu }} disclosures normalize to the same state key ("${h}") but were declared differently — distinct names that differ only by non-alphanumeric characters (e.g. "a-b" vs "a_b") collapse to one key and would silently share open-state. Rename so they don't collide.`);continue}a.set(f,m),a.set(p,m);let g=h_(f,d),_=`${c.name}\0${e}`,v=s.get(g);if(v!==void 0&&v!==_){o(c.name,`two {{ menu }} disclosures resolve to the same identity ("${g}") — ${l.key===void 0?`a segment cannot contain two menus over the same apply action "${i}"`:`menus sharing key "${l.key}" must have distinct apply actions`}.`);continue}s.set(g,_),r[g]=$c(f,d),n[f]=Qc(f,Hc),n[p]={kind:`state`,key:p,default:`0`},r[p]={set:p,int:!0}}}}return{...e,variables:{...e.variables,...n},actions:{...e.actions,...r}}}const B_=up({fromString:e=>e}),V_=`edit.mode`,H_=`edit.configure`,U_=`edit.toggle`,W_=`edit.unconfigure`,G_=[U_,W_],K_=`arrange`,q_=`${vu}draft.`;function J_(e,t){return`${e}:${t}`}const Y_={variable:V_,key:V_,member:K_},X_=Jc(Y_);function Z_(e){try{return B_.parse(e).referencedCalls().some(e=>e.name===`action`&&e.args[0]===`edit.toggle`)}catch{return!1}}function Q_(e){if(Object.values(e.actions??{}).some(e=>`do`in e&&e.do.includes(`edit.toggle`)))return!0;for(let t of Object.values(e.segments??{}))for(let e of[t.template,t.bg,t.fg])if(typeof e==`string`&&Z_(e))return!0;return!1}function $_(e,t){if(Su(e,t,vu,`edit mode`),!Q_(t))return;let{variables:n,actions:r}=ev();t.variables={...t.variables??{},...n},t.actions={...t.actions??{},...r}}function ev(){return{variables:{[V_]:Qc(V_,Hc),[H_]:Qc(H_,Hc)},actions:{[U_]:$c(V_,K_),[W_]:{set:H_,to:Hc}}}}const tv=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`[^`]*`/g;function*nv(e){let t=e.indexOf(`{{`);for(;t!==-1;){let n=``,r=t+2;for(;r<e.length&&!e.startsWith(`}}`,r);){if(e.startsWith(`/*`,r)){let t=e.indexOf(`*/`,r+2);r=t===-1?e.length:t+2;continue}let t=r,i=e[r];if(r+=1,i===`"`||i===`'`||i==="`"){for(;r<e.length&&e[r]!==i;)r+=e[r]===`\\`&&i!=="`"?2:1;r+=1}n+=e.slice(t,r)}if(r>=e.length)return;yield n,t=e.indexOf(`{{`,r+2)}}const rv=`[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*`,iv=RegExp(`^(?:(\\$)(?:\\.(${rv}))?|\\.(${rv})?)(?=[\\s)]|$)`);function av(e,t,n){let r=iv.exec(e.trimStart());if(r===null)return null;let[i,a]=r[1]===void 0?[t,r[3]]:[n,r[2]];return i===null?null:a===void 0?i:`${i}${a}.`}const ov=/^(\w+)\b\s*([\s\S]*)$/;function*sv(e,t){let n=[t];for(let r of nv(e)){let e=r.replace(/^-(?=\s)/,``).trim(),[,i=``,a=``]=ov.exec(e)??[],o=n[n.length-1],s=n.length>1?n[n.length-2]:o;if(i===`end`){n.length>1&&n.pop();continue}if(i===`else`){yield{code:e,dot:s};let r=/^with\b([\s\S]*)$/.exec(a);n[n.length-1]=r===null?s:av(r[1],s,t);continue}yield{code:e,dot:o},i===`if`&&n.push(o),i===`with`&&n.push(av(a,o,t)),(i===`range`||i===`define`||i===`block`)&&n.push(null)}}const cv=/(?<![.$])\btemplate\s+$/;function*lv(e,t,n){let r=0;for(let i of[...e.matchAll(tv)]){let a=i.index+i[0].length;cv.test(e.slice(r,i.index))&&(yield{name:i[0].slice(1,-1),at:av(e.slice(a),t,n)}),r=a}}function*uv(e,t){let n=new Set;function*r(e,i,a,o){for(let{code:s,dot:c}of[...sv(e,i)]){yield{code:s,dot:c,root:i,via:a};for(let e of[...lv(s,c,i)]){let i=Object.hasOwn(t,e.name)?t[e.name]:void 0,a=`${e.name}\0${e.at??`\0`}`;i===void 0||o.has(e.name)||n.has(a)||(n.add(a),yield*r(i,e.at,e.name,new Set([...o,e.name])))}}}yield*r(e,``,null,new Set)}const dv=RegExp(`(?<![A-Za-z0-9_)$])(\\$?)\\.(${rv})`,`g`);function*fv({code:e,dot:t,root:n}){let r=e.replace(tv,``);for(let e of[...r.matchAll(dv)]){let r=e[1]===`$`?n:t;r!==null&&(yield`${r}${e[2]}`)}}function pv(e,t){let n=new Map;for(let r of uv(e,t))for(let e of fv(r))n.has(e)||n.set(e,r.via);return n}const mv=/(?<![.$])\b(action|picker|menu|carousel)\s+$/,hv={action:1,picker:2,menu:1,carousel:1};function*gv(e){let t=0,n=0,r=`action`;for(let i of[...e.matchAll(tv)]){let a=mv.exec(e.slice(t,i.index));a!==null&&(n=hv[a[1]],r=a[1]===`action`?`action`:`options`),n>0&&(yield{name:i[0].slice(1,-1),site:r},n--),t=i.index+i[0].length}}function _v(e,t){let n=new Map;for(let{code:r,via:i}of uv(e,t))for(let{name:e,site:t}of gv(r)){let r=`${e}\0${i??`\0`}`;n.has(r)||n.set(r,{name:e,site:t,via:i})}return[...n.values()]}function vv(e,t){if(t.names.has(e))return!0;let n=`${e}.`;for(let e of t.names)if(e.startsWith(n))return!0;for(let n of t.documents)if(e.startsWith(`${n}.`))return!0;return!1}function yv(e){let t=new Set,n=new Set,r=(e,r)=>{t.add(e),bv(r)&&n.add(e)};for(let[t,n]of Object.entries(e.variables))r(t,n);for(let[t,n]of Object.entries(e.segments))for(let[e,i]of Object.entries(n.vars??{}))r(`${t}.${e}`,i);return{names:t,documents:n,helpers:e.helpers}}function bv(e){return(e.kind===`shell`||e.kind===`file`)&&Is(e.parse)===`json`}var xv=me((e=>{function t(e){var t=[...arguments].slice(1);throw Error(typeof e==`number`?`[MobX] minified error nr: `+e+(t.length?` `+t.map(String).join(`,`):``)+`. Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts`:`[MobX] `+e)}function n(){return typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:nn}function r(){ln||t(`Proxy not available`)}function i(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function a(e){return typeof e==`function`}function o(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function s(e){return typeof e==`object`&&!!e}function c(e){if(!s(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n.toString()===un}function l(e){var t=e?.constructor;return!!t&&(t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`)}function u(e,t,n){an(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function d(e,t,n){an(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function f(e,t){var n=`isMobX`+e;return t.prototype[n]=!0,function(e){return s(e)&&!0===e[n]}}function p(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function m(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}function h(e){return e===null?null:typeof e==`object`?``+e:e}function g(e,t){return on.hasOwnProperty.call(e,t)}function _(e,t){return!!(e&t)}function v(e,t,n){return n?e|=t:e&=~t,e}function y(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n){if(te())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&E(i,n.prototype),i}function x(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,ne(r.key),r)}}function S(e,t,n){return t&&x(e.prototype,t),n&&x(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function C(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if(typeof e==`string`)return y(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
55
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(){return(w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ee(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,E(e,t)}function te(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(te=function(){return!!e})()}function E(e,t){return(E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ne(e){var t=function(e){if(typeof e!=`object`||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,`string`);if(typeof n!=`object`)return n;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e);return typeof t==`symbol`?t:t+``}function D(e){var t=typeof Map==`function`?new Map:void 0;return(D=function(e){function n(){return b(e,arguments,T(this).constructor)}if(e===null||!function(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),E(n,e)})(e)}function O(e){return Object.assign((function(t,n){if(ie(n))return e.t(t,n);re(t,n,e)}),e)}function re(e,t,n){g(e,mn)||u(e,mn,w({},e[mn])),function(e){return e.i===`override`}(n)||(e[mn][t]=n)}function ie(e){return typeof e==`object`&&typeof e.kind==`string`}function ae(e,t,n){t===void 0&&(t=P),n===void 0&&(n=P);var r=new hn(e);return t!==P&&lt(r,t),n!==P&&ut(r,n),r}function oe(e,t,n){return yt(e)?e:Array.isArray(e)?En.array(e,{name:n}):c(e)?En.object(e,void 0,{name:n}):p(e)?En.map(e,{name:n}):m(e)?En.set(e,{name:n}):typeof e!=`function`||ot(e)||gt(e)?e:l(e)?ir(e):Qn(n,e)}function se(e){return e}function ce(e,t){return{i:e,u:t,o:le,s:ue,t:de}}function le(e,t,n,r){var i;return(i=this.u)!=null&&i.bound?this.s(e,t,n,!1)===null?0:1:r===e.h?this.s(e,t,n,!1)===null?0:2:ot(n.value)?1:(an(r,t,fe(e,this,t,n,!1)),2)}function ue(e,t,n,r){var i=fe(e,this,t,n);return e.l(t,i,r)}function de(e,n){var r,i=n.kind,a=n.name,o=n.addInitializer,s=this,c=function(e){var t;return je(s.u?.name??a.toString(),e,(t=s.u?.autoAction)!=null&&t)};return i==`field`?function(e){var t,n=e;return ot(n)||(n=c(n)),(t=s.u)!=null&&t.bound&&((n=n.bind(this)).isMobxAction=!0),n}:i==`method`?(ot(e)||(e=c(e)),(r=this.u)!=null&&r.bound&&o((function(){var e=this[a].bind(this);e.isMobxAction=!0,this[a]=e})),e):void t(`Cannot apply '`+s.i+`' to '`+String(a)+`' (kind: `+i+`):
56
- '`+s.i+`' can only be used on properties with a function value.`)}function fe(e,t,n,r,i){var a,o,s;i===void 0&&(i=R.safeDescriptors);var c=r.value;return(a=t.u)!=null&&a.bound&&(c=c.bind(e.v??e.h)),{value:je(t.u?.name??n.toString(),c,(o=t.u?.autoAction)!=null&&o,(s=t.u)!=null&&s.bound?e.v??e.h:void 0),configurable:!i||e.p,enumerable:!1,writable:!i}}function pe(e,t){return{i:e,u:t,o:me,s:he,t:ge}}function me(e,t,n,r){var i;return r===e.h?this.s(e,t,n,!1)===null?0:2:(i=this.u)!=null&&i.bound&&(!g(e.h,t)||!gt(e.h[t]))&&this.s(e,t,n,!1)===null?0:gt(n.value)?1:(an(r,t,k(e,0,0,n,!1,!1)),2)}function he(e,t,n,r){var i=k(e,0,0,n,this.u?.bound);return e.l(t,i,r)}function ge(e,t){var n,r=t.name,i=t.addInitializer;return gt(e)||(e=ir(e)),(n=this.u)!=null&&n.bound&&i((function(){var e=this[r].bind(this);e.isMobXFlow=!0,this[r]=e})),e}function k(e,t,n,r,i,a){a===void 0&&(a=R.safeDescriptors);var o=r.value;return gt(o)||(o=ir(o)),i&&((o=o.bind(e.v??e.h)).isMobXFlow=!0),{value:o,configurable:!a||e.p,enumerable:!1,writable:!a}}function _e(e,t){return{i:e,u:t,o:ve,s:ye,t:be}}function ve(e,t,n){return this.s(e,t,n,!1)===null?0:1}function ye(e,t,n,r){return e.m(t,w({},this.u,{get:n.get,set:n.set}),r)}function be(e,t){var n=this,r=t.name;return(0,t.addInitializer)((function(){var t=Bt(this)[F],i=w({},n.u,{get:e,context:this});i.name||=`ObservableObject.`+r.toString(),t.j.set(r,new In(i))})),function(){return this[F].O(r)}}function xe(e,t){return{i:e,u:t,o:Se,s:Ce,t:we}}function Se(e,t,n){return this.s(e,t,n,!1)===null?0:1}function Ce(e,t,n,r){return e.g(t,n.value,this.u?.enhancer??oe,r)}function we(e,t){function n(e,t){var n=Bt(e)[F],i=new Pn(t,r.u?.enhancer??oe,`ObservableObject.`+a.toString(),!1);n.j.set(a,i),o.add(e)}var r=this,i=t.kind,a=t.name,o=new WeakSet;if(i==`accessor`)return{get:function(){return o.has(this)||n(this,e.get.call(this)),this[F].O(a)},set:function(e){return o.has(this)||n(this,e),this[F].S(a,e)},init:function(e){return o.has(this)||n(this,e),e}}}function Te(e){return{i:`true`,u:e,o:Ee,s:De,t:Oe}}function Ee(e,t,n,r){var i,a,o;if(n.get)return kn.o(e,t,n,r);if(n.set){var s=ot(n.set)?n.set:je(t.toString(),n.set);return r===e.h?e.l(t,{configurable:!R.safeDescriptors||e.p,set:s})===null?0:2:(an(r,t,{configurable:!0,set:s}),2)}if(r!==e.h&&typeof n.value==`function`)return l(n.value)?((o=this.u)!=null&&o.autoBind?ir.bound:ir).o(e,t,n,r):((a=this.u)!=null&&a.autoBind?Qn.bound:Qn).o(e,t,n,r);var c=!1===this.u?.deep?En.ref:En;return typeof n.value==`function`&&(i=this.u)!=null&&i.autoBind&&(n.value=n.value.bind(e.v??e.h)),c.o(e,t,n,r)}function De(e,t,n,r){var i;return n.get?kn.s(e,t,n,r):n.set?e.l(t,{configurable:!R.safeDescriptors||e.p,set:je(t.toString(),n.set)},r):(typeof n.value==`function`&&(i=this.u)!=null&&i.autoBind&&(n.value=n.value.bind(e.v??e.h)),(!1===this.u?.deep?En.ref:En).s(e,t,n,r))}function Oe(){t(`'`+this.i+`' cannot be used as a decorator`)}function ke(e){return e||bn}function A(e){return!0===e.deep?oe:!1===e.deep?se:(t=e.defaultDecorator)&&(n=(r=t.u)?.enhancer)!=null?n:oe;var t,n,r}function Ae(e,t,n){return ie(t)?xn.t(e,t):o(t)?void re(e,t,xn):yt(e)?e:c(e)?En.object(e,t,n):Array.isArray(e)?En.array(e,t):p(e)?En.map(e,t):m(e)?En.set(e,t):typeof e==`object`&&e?e:En.box(e,t)}function je(e,t,n,r){function i(){return Me(0,n,t,r||this,arguments)}return n===void 0&&(n=!1),i.isMobxAction=!0,i.toString=function(){return t.toString()},Mn&&(Nn.value=e,an(i,`name`,Nn)),i}function Me(e,t,n,r,i){var a=Ne(0,t);try{return n.apply(r,i)}catch(e){throw a._=e,e}finally{Pe(a)}}function Ne(e,t){var n=R.trackingDerivation,r=!t||!n;Ze();var i=R.allowStateChanges;r&&(Ue(),i=Ie(!0));var a={A:r,k:n,M:i,V:Ge(!0),R:!1,N:0,T:jn++,C:An};return An=a.T,a}function Pe(e){An!==e.T&&t(30),An=e.C,e._!==void 0&&(R.suppressReactionErrors=!0),Le(e.M),Ke(e.V),Qe(),e.A&&We(e.k),R.suppressReactionErrors=!1}function Fe(e,t){var n=Ie(e);try{return t()}finally{Le(n)}}function Ie(e){var t=R.allowStateChanges;return R.allowStateChanges=e,t}function Le(e){R.allowStateChanges=e}function Re(e){return e instanceof zn}function ze(e){switch(e.I){case L.L:return!1;case L.P:case L.K:return!0;case L.B:for(var t=Ge(!0),n=Ue(),r=e.D,i=r.length,a=0;a<i;a++){var o=r[a];if(Rn(o)){if(R.disableErrorBoundaries)o.get();else try{o.get()}catch{return We(n),Ke(t),!0}if(e.I===L.K)return We(n),Ke(t),!0}}return qe(e),We(n),Ke(t),!1}}function Be(e,t,n){var r=Ge(!0);qe(e),e.W=Array(e.q===0?100:e.D.length),e.G=0,e.q=++R.runId;var i,a=R.trackingDerivation;if(R.trackingDerivation=e,R.inBatch++,!0===R.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new zn(e)}return R.inBatch--,R.trackingDerivation=a,function(e){for(var t=e.D,n=e.D=e.W,r=L.L,i=0,a=e.G,o=0;o<a;o++){var s=n[o];s.diffValue===0&&(s.diffValue=1,i!==o&&(n[i]=s),i++),s.I>r&&(r=s.I)}for(n.length=i,e.W=null,a=t.length;a--;){var c=t[a];c.diffValue===0&&Ye(c,e),c.diffValue=0}for(;i--;){var l=n[i];l.diffValue===1&&(l.diffValue=0,Je(l,e))}r!==L.L&&(e.I=r,e.H())}(e),Ke(r),i}function Ve(e){var t=e.D;e.D=[];for(var n=t.length;n--;)Ye(t[n],e);e.I=L.P}function He(e){var t=Ue();try{return e()}finally{We(t)}}function Ue(){var e=R.trackingDerivation;return R.trackingDerivation=null,e}function We(e){R.trackingDerivation=e}function Ge(e){var t=R.allowStateReads;return R.allowStateReads=e,t}function Ke(e){R.allowStateReads=e}function qe(e){if(e.I!==L.L){e.I=L.L;for(var t=e.D,n=t.length;n--;)t[n].U=L.L}}function Je(e,t){e.F.add(t),e.U>t.I&&(e.U=t.I)}function Ye(e,t){e.F.delete(t),e.F.size===0&&Xe(e)}function Xe(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,R.pendingUnobservations.push(e))}function Ze(){R.inBatch++}function Qe(){if(--R.inBatch==0){tt();for(var e=R.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.F.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof In&&n.X())}R.pendingUnobservations=[]}}function $e(e){var t=R.trackingDerivation;return t===null?(e.F.size===0&&R.inBatch>0&&Xe(e),!1):(t.q!==e.$&&(e.$=t.q,t.W[t.G++]=e,!e.isBeingObserved&&R.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function et(e){e.U!==L.K&&(e.U=L.K,e.F.forEach((function(e){e.I===L.L&&e.H(),e.I=L.K})))}function tt(){R.inBatch>0||R.isRunningReactions||Gn(nt)}function nt(){R.isRunningReactions=!0;for(var e=R.pendingReactions,t=0;e.length>0;){++t==100&&(console.error(`[mobx] cycle in reaction: `+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].J()}R.isRunningReactions=!1}function rt(){return console.warn(`[mobx.spy] Is a no-op in production builds`),function(){}}function it(e){return function(t,n){return a(t)?je(t.name||`<unnamed action>`,t,e):a(n)?je(t,n,e):ie(n)?(e?Yn:qn).t(t,n):o(n)?re(t,n,e?Yn:qn):o(t)?O(ce(e?`autoAction`:`action`,{name:t,autoAction:e})):void 0}}function at(e){return Me(0,!1,e,this,void 0)}function ot(e){return a(e)&&!0===e.isMobxAction}function st(e,t){function n(){e(i)}var r;t===void 0&&(t=cn);var i,a=t?.name??`Autorun`;if(t.scheduler||t.delay){var o=ct(t),s=!1;i=new Wn(a,(function(){s||(s=!0,o((function(){s=!1,i.isDisposed||i.track(n)})))}),t.onError,t.requiresObservable)}else i=new Wn(a,(function(){this.track(n)}),t.onError,t.requiresObservable);return(r=t)!=null&&(r=r.signal)!=null&&r.aborted||i.Y(),i.Z(t?.signal)}function ct(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:$n}function lt(e,t,n){return dt(`onBO`,e,t,n)}function ut(e,t,n){return dt(`onBUO`,e,t,n)}function dt(e,t,n,r){var i=typeof r==`function`?Jt(t,n):Jt(t),o=a(r)?r:n,s=e+`L`;return i[s]?i[s].add(o):i[s]=new Set([o]),function(){var e=i[s];e&&(e.delete(o),e.size===0&&delete i[s])}}function ft(e,t,n,r){var i=pn(t);return Zt((function(){var t=Bt(e,r)[F];fn(i).forEach((function(e){t.s(e,i[e],!n||!(e in n)||n[e])}))})),e}function pt(e){var t,n={name:e.tt};return e.D&&e.D.length>0&&(n.dependencies=(t=e.D,Array.from(new Set(t))).map(pt)),n}function mt(e){var t={name:e.tt};return function(e){return e.F&&e.F.size>0}(e)&&(t.observers=Array.from(function(e){return e.F}(e)).map(mt)),t}function ht(e){a(e.cancel)&&e.cancel()}function gt(e){return!0===e?.isMobXFlow}function _t(e,t){return t===void 0?Rn(e):!1===Ht(e)||!e[F].j.has(t)?!1:Rn(Jt(e,t))}function vt(e,t){return!!e&&(t===void 0?Ht(e)||!!e[F]||gn(e)||Kn(e)||Rn(e):!!Ht(e)&&e[F].j.has(t))}function yt(e){return vt(e)}function bt(e){return Ht(e)?e[F].nt():_r(e)||br(e)?Array.from(e.keys()):Lt(e)?e.map((function(e,t){return t})):void t(5)}function xt(e,n){return Ht(e)?e[F].it(n):_r(e)||br(e)?e.has(n):Lt(e)?n>=0&&n<e.length:void t(10)}function St(e){if(Ht(e))return e[F].rt();t(38)}function Ct(e,t,n){return e.set(t,n),n}function wt(e,t){t===void 0&&(t=void 0),Ze();try{return e.apply(t)}finally{Qe()}}function Tt(e,t,n){var r;if(typeof n.timeout==`number`){var i=Error(`WHEN_TIMEOUT`);r=setTimeout((function(){if(!o[F].isDisposed){if(o(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name=`When`;var a=je(`When-effect`,t),o=st((function(t){Fe(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())}),n);return o}function Et(e,t){var n,r,i;if(t!=null&&(n=t.signal)!=null&&n.aborted)return Object.assign(Promise.reject(Error(`WHEN_ABORTED`)),{cancel:function(){return null}});var a=new Promise((function(n,a){var o,s=Tt(e,n,w({},t,{onError:a}));r=function(){s(),a(Error(`WHEN_CANCELLED`))},i=function(){s(),a(Error(`WHEN_ABORTED`))},t==null||(o=t.signal)==null||o.addEventListener==null||o.addEventListener(`abort`,i)})).finally((function(){var e;return t==null||(e=t.signal)==null||e.removeEventListener==null?void 0:e.removeEventListener(`abort`,i)}));return a.cancel=r,a}function Dt(e){return e[F]}function Ot(e){return e.et!==void 0&&e.et.length>0}function kt(e,t){var n=e.et||=[];return n.push(t),i((function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)}))}function At(e,n){var r=Ue();try{for(var i=[].concat(e.et||[]),a=0,o=i.length;a<o&&((n=i[a](n))&&!n.type&&t(14),n);a++);return n}finally{We(r)}}function jt(e){return e.ut!==void 0&&e.ut.length>0}function Mt(e,t){var n=e.ut||=[];return n.push(t),i((function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)}))}function Nt(e,t){var n=Ue(),r=e.ut;if(r){for(var i=0,a=(r=r.slice()).length;i<a;i++)r[i](t);We(n)}}function Pt(e,t,n,i){return n===void 0&&(n=`ObservableArray`),i===void 0&&(i=!1),r(),Zt((function(){var r=new lr(n,t,i,!1);d(r.j,F,r);var a=new Proxy(r.j,cr);return r.v=a,e&&e.length&&r.ot(0,0,e),a}))}function j(e,t){typeof Array.prototype[e]==`function`&&(ur[e]=t(e))}function Ft(e){return function(){var t=this[F];t.st.reportObserved();var n=t.ft(t.j);return n[e].apply(n,arguments)}}function M(e){return function(t,n){var r=this,i=this[F];return i.st.reportObserved(),i.ft(i.j)[e]((function(e,i){return t.call(n,e,i,r)}))}}function It(e){return function(){var t=this,n=this[F];n.st.reportObserved();var r=n.ft(n.j),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}function Lt(e){return s(e)&&pr(e[F])}function Rt(e){return e[Symbol.toStringTag]=`MapIterator`,en(e)}function zt(e){return e[Symbol.toStringTag]=`SetIterator`,en(e)}function Bt(e,t){if(g(e,F))return e;var n=t?.name??`ObservableObject`;return u(e,F,new Sr(e,new Map,String(n),function(e){return e?e.defaultDecorator??Te(e):void 0}(t))),e}function Vt(e){return xr[e]||(xr[e]={get:function(){return this[F].O(e)},set:function(t){return this[F].S(e,t)}})}function Ht(e){return!!s(e)&&Cr(e[F])}function Ut(e,t,n){var r;(r=e.h[mn])==null||delete r[n]}function Wt(e){return{enumerable:!1,configurable:!0,get:function(){return this[F].ct(e)},set:function(t){this[F].ht(e,t)}}}function Gt(e){an(Or.prototype,``+e,Wt(e))}function Kt(e){if(e>Er){for(var t=Er;t<e+100;t++)Gt(t);Er=e}}function qt(e,t,n){return new Or(e,t,n)}function Jt(e,n){if(typeof e==`object`&&e){if(Lt(e))return n!==void 0&&t(23),e[F].st;if(br(e))return e.st;if(_r(e)){if(n===void 0)return e.lt;var r=e.vt.get(n)||e.dt.get(n);return r||t(25,n,Xt(e)),r}if(Ht(e)){if(!n)return t(26);var i=e[F].j.get(n);return i||t(27,n,Xt(e)),i}if(gn(e)||Rn(e)||Kn(e))return e}else if(a(e)&&Kn(e[F]))return e[F];t(28)}function Yt(e,n){return e||t(29),n===void 0?gn(e)||Rn(e)||Kn(e)||_r(e)||br(e)?e:e[F]?e[F]:void t(24,e):Yt(Jt(e,n))}function Xt(e,t){var n;if(t!==void 0)n=Jt(e,t);else{if(ot(e))return e.name;n=Ht(e)||_r(e)||br(e)?Yt(e):Jt(e)}return n.tt}function Zt(e){var t=Ue(),n=Ie(!0);Ze();try{return e()}finally{Qe(),Le(n),We(t)}}function Qt(e,t,n){return n===void 0&&(n=-1),function e(t,n,r,i,o){if(t===n)return t!==0||1/t==1/n;if(t==null||n==null)return!1;if(t!=t)return n!=n;var s=typeof t;if(s!==`function`&&s!==`object`&&typeof n!=`object`)return!1;var c=kr.call(t);if(c!==kr.call(n))return!1;switch(c){case`[object RegExp]`:case`[object String]`:return``+t==``+n;case`[object Number]`:return+t==+t?+t==0?1/t==1/n:+t==+n:+n!=+n;case`[object Date]`:case`[object Boolean]`:return+t==+n;case`[object Symbol]`:return typeof Symbol<`u`&&Symbol.valueOf.call(t)===Symbol.valueOf.call(n);case`[object Map]`:case`[object Set]`:r>=0&&r++}t=$t(t),n=$t(n);var l=c===`[object Array]`;if(!l){if(typeof t!=`object`||typeof n!=`object`)return!1;var u=t.constructor,d=n.constructor;if(u!==d&&!(a(u)&&u instanceof u&&a(d)&&d instanceof d)&&`constructor`in t&&`constructor`in n)return!1}if(r===0)return!1;r<0&&(r=-1),o||=[];for(var f=(i||=[]).length;f--;)if(i[f]===t)return o[f]===n;if(i.push(t),o.push(n),l){if((f=t.length)!==n.length)return!1;for(;f--;)if(!e(t[f],n[f],r-1,i,o))return!1}else{var p=Object.keys(t),m=p.length;if(Object.keys(n).length!==m)return!1;for(var h=0;h<m;h++){var _=p[h];if(!g(n,_)||!e(t[_],n[_],r-1,i,o))return!1}}return i.pop(),o.pop(),!0}(e,t,n)}function $t(e){return Lt(e)?e.slice():p(e)||_r(e)||m(e)||br(e)?Array.from(e.entries()):e}function en(e){return e[Symbol.iterator]=tn,Object.assign(Object.create(Ar),e)}function tn(){return this}Object.defineProperty(e,`__esModule`,{value:!0});var nn={},N=Object.assign,rn=Object.getOwnPropertyDescriptor,an=Object.defineProperty,on=Object.prototype,sn=[];Object.freeze(sn);var cn={};Object.freeze(cn);var ln=typeof Proxy<`u`,un=Object.toString(),P=function(){},dn=Object.getOwnPropertySymbols!==void 0,fn=typeof Reflect<`u`&&Reflect.ownKeys?Reflect.ownKeys:dn?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,pn=Object.getOwnPropertyDescriptors||function(e){var t={};return fn(e).forEach((function(n){t[n]=rn(e,n)})),t},mn=Symbol(`mobx-stored-annotations`),F=Symbol(`mobx administration`),hn=function(){function e(e){e===void 0&&(e=`Atom`),this.tt=void 0,this.bt=0,this.F=new Set,this.$=0,this.U=L.P,this.onBOL=void 0,this.onBUOL=void 0,this.tt=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return $e(this)},t.reportChanged=function(){Ze(),et(this),Qe()},t.toString=function(){return this.tt},S(e,[{key:`isBeingObserved`,get:function(){return _(this.bt,e.pt)},set:function(t){this.bt=v(this.bt,e.pt,t)}},{key:`isPendingUnobservation`,get:function(){return _(this.bt,e.yt)},set:function(t){this.bt=v(this.bt,e.yt,t)}},{key:`diffValue`,get:function(){return+!!_(this.bt,e.wt)},set:function(t){this.bt=v(this.bt,e.wt,t===1)}}])}();hn.pt=1,hn.yt=2,hn.wt=4;var gn=f(`Atom`,hn),_n={identity:function(e,t){return e===t},structural:function(e,t){return Qt(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e==1/t:e!=e&&t!=t},shallow:function(e,t){return Qt(e,t,1)}},vn=O({i:`override`,o:function(){return 0},s:function(){t(`'`+this.i+`' can only be used with 'makeObservable'`)},t:function(){console.warn(`'`+this.i+`' cannot be used with decorators - this is a no-op`)}}),yn=Te(),bn={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(bn);var xn=xe(`observable`),Sn=xe(`observable.ref`,{enhancer:se}),I=xe(`observable.shallow`,{enhancer:function(e,t,n){return e==null||Ht(e)||Lt(e)||_r(e)||br(e)?e:Array.isArray(e)?En.array(e,{name:n,deep:!1}):c(e)?En.object(e,void 0,{name:n,deep:!1}):p(e)?En.map(e,{name:n,deep:!1}):m(e)?En.set(e,{name:n,deep:!1}):void 0}}),Cn=xe(`observable.struct`,{enhancer:function(e,t){return Qt(e,t)?t:e}}),wn=O(xn);N(Ae,wn);var Tn,En=N(Ae,{box:function(e,t){var n=ke(t);return new Pn(e,A(n),n.name,!0,n.equals)},array:function(e,t){var n=ke(t);return(!1===R.useProxies||!1===n.proxy?qt:Pt)(e,A(n),n.name)},map:function(e,t){var n=ke(t);return new gr(e,A(n),n.name)},set:function(e,t){var n=ke(t);return new yr(e,A(n),n.name)},object:function(e,t,n){return Zt((function(){return ft(!1===R.useProxies||!1===n?.proxy?Bt({},n):function(e,t){var n;return r(),(n=(e=Bt(e,t))[F]).v??(n.v=new Proxy(e,ar))}({},n),e,t)}))},ref:O(Sn),shallow:O(I),deep:wn,struct:O(Cn)}),Dn=_e(`computed`),On=_e(`computed.struct`,{equals:_n.structural}),kn=function(e,t){if(ie(t))return Dn.t(e,t);if(o(t))return re(e,t,Dn);if(c(e))return O(_e(`computed`,e));var n=c(t)?t:{};return n.get=e,n.name||=e.name||``,new In(n)};Object.assign(kn,Dn),kn.struct=O(On);var An=0,jn=1,Mn=(Tn=rn((function(){}),`name`)?.configurable)!=null&&Tn,Nn={value:`action`,configurable:!0,writable:!1,enumerable:!1},Pn=function(e){function t(t,n,r,i,a){var o;return r===void 0&&(r=`ObservableValue`),a===void 0&&(a=_n.default),(o=e.call(this,r)||this).enhancer=void 0,o.tt=void 0,o.equals=void 0,o.jt=!1,o.et=void 0,o.ut=void 0,o.Ot=void 0,o.dehancer=void 0,o.enhancer=n,o.tt=r,o.equals=a,o.Ot=n(t,void 0,r),o}ee(t,e);var n=t.prototype;return n.dehanceValue=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.set=function(e){(e=this.xt(e))!==R.UNCHANGED&&this.gt(e)},n.xt=function(e){if(Ot(this)){var t=At(this,{object:this,type:sr,newValue:e});if(!t)return R.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.Ot,this.tt),this.equals(this.Ot,e)?R.UNCHANGED:e},n.gt=function(e){var t=this.Ot;this.Ot=e,this.reportChanged(),jt(this)&&Nt(this,{type:sr,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.Ot)},n.St=function(e){return kt(this,e)},n._t=function(e,t){return t&&e({observableKind:`value`,debugObjectName:this.tt,object:this,type:sr,newValue:this.Ot,oldValue:void 0}),Mt(this,e)},n.raw=function(){return this.Ot},n.toJSON=function(){return this.get()},n.toString=function(){return this.tt+`[`+this.Ot+`]`},n.valueOf=function(){return h(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(hn),Fn=f(`ObservableValue`,Pn),In=function(){function e(e){this.I=L.P,this.D=[],this.W=null,this.F=new Set,this.q=0,this.$=0,this.U=L.L,this.G=0,this.Ot=new zn(null),this.tt=void 0,this.At=void 0,this.bt=0,this.derivation=void 0,this.kt=void 0,this.Mt=Ln.NONE,this.Et=void 0,this.Vt=void 0,this.Rt=void 0,this.Nt=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||t(31),this.derivation=e.get,this.tt=e.name||`ComputedValue`,e.set&&(this.kt=je(`ComputedValue-setter`,e.set)),this.Vt=e.equals||(e.compareStructural||e.struct?_n.structural:_n.default),this.Et=e.context,this.Rt=e.requiresReaction,this.Nt=!!e.keepAlive}var n=e.prototype;return n.H=function(){(function(e){e.U===L.L&&(e.U=L.B,e.F.forEach((function(e){e.I===L.L&&(e.I=L.B,e.H())})))})(this)},n.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},n.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},n.get=function(){if(this.isComputing&&t(32,this.tt,this.derivation),R.inBatch!==0||this.F.size!==0||this.Nt){if($e(this),ze(this)){var e=R.trackingContext;this.Nt&&!e&&(R.trackingContext=this),this.trackAndCompute()&&function(e){e.U!==L.K&&(e.U=L.K,e.F.forEach((function(t){t.I===L.B?t.I=L.K:t.I===L.L&&(e.U=L.L)})))}(this),R.trackingContext=e}}else ze(this)&&(this.Tt(),Ze(),this.Ot=this.Ct(!1),Qe());var n=this.Ot;if(Re(n))throw n.cause;return n},n.set=function(e){if(this.kt){this.isRunningSetter&&t(33,this.tt),this.isRunningSetter=!0;try{this.kt.call(this.Et,e)}finally{this.isRunningSetter=!1}}else t(34,this.tt)},n.trackAndCompute=function(){var e=this.Ot,t=this.I===L.P,n=this.Ct(!0),r=t||Re(e)||Re(n)||!this.Vt(e,n);return r&&(this.Ot=n),r},n.Ct=function(e){this.isComputing=!0;var t,n=Ie(!1);if(e)t=Be(this,this.derivation,this.Et);else if(!0===R.disableErrorBoundaries)t=this.derivation.call(this.Et);else try{t=this.derivation.call(this.Et)}catch(e){t=new zn(e)}return Le(n),this.isComputing=!1,t},n.X=function(){this.Nt||(Ve(this),this.Ot=void 0)},n._t=function(e,t){var n=this,r=!0,i=void 0;return st((function(){var a=n.get();if(!r||t){var o=Ue();e({observableKind:`computed`,debugObjectName:n.tt,type:sr,object:n,newValue:a,oldValue:i}),We(o)}r=!1,i=a}))},n.Tt=function(){},n.toString=function(){return this.tt+`[`+this.derivation.toString()+`]`},n.valueOf=function(){return h(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},S(e,[{key:`isComputing`,get:function(){return _(this.bt,e.It)},set:function(t){this.bt=v(this.bt,e.It,t)}},{key:`isRunningSetter`,get:function(){return _(this.bt,e.Lt)},set:function(t){this.bt=v(this.bt,e.Lt,t)}},{key:`isBeingObserved`,get:function(){return _(this.bt,e.pt)},set:function(t){this.bt=v(this.bt,e.pt,t)}},{key:`isPendingUnobservation`,get:function(){return _(this.bt,e.yt)},set:function(t){this.bt=v(this.bt,e.yt,t)}},{key:`diffValue`,get:function(){return+!!_(this.bt,e.wt)},set:function(t){this.bt=v(this.bt,e.wt,t===1)}}])}();In.It=1,In.Lt=2,In.pt=4,In.yt=8,In.wt=16;var L,Ln,Rn=f(`ComputedValue`,In);(function(e){e[e.P=-1]=`NOT_TRACKING_`,e[e.L=0]=`UP_TO_DATE_`,e[e.B=1]=`POSSIBLY_STALE_`,e[e.K=2]=`STALE_`})(L||={}),function(e){e[e.NONE=0]=`NONE`,e[e.LOG=1]=`LOG`,e[e.BREAK=2]=`BREAK`}(Ln||={});var zn=function(e){this.cause=void 0,this.cause=e},Bn=[`mobxGuid`,`spyListeners`,`enforceActions`,`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`allowStateReads`,`disableErrorBoundaries`,`runId`,`UNCHANGED`,`useProxies`],Vn=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Hn=!0,Un=!1,R=function(){var e=n();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Hn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Vn().version&&(Hn=!1),Hn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Vn):(setTimeout((function(){Un||t(35)}),1),new Vn)}(),Wn=function(){function e(e,t,n,r){e===void 0&&(e=`Reaction`),this.tt=void 0,this.Pt=void 0,this.Kt=void 0,this.Bt=void 0,this.D=[],this.W=[],this.I=L.P,this.q=0,this.G=0,this.bt=0,this.Mt=Ln.NONE,this.tt=e,this.Pt=t,this.Kt=n,this.Bt=r}var t=e.prototype;return t.H=function(){this.Y()},t.Y=function(){this.isScheduled||(this.isScheduled=!0,R.pendingReactions.push(this),tt())},t.J=function(){if(!this.isDisposed){Ze(),this.isScheduled=!1;var e=R.trackingContext;if(R.trackingContext=this,ze(this)){this.isTrackPending=!0;try{this.Pt()}catch(e){this.Dt(e)}}R.trackingContext=e,Qe()}},t.track=function(e){if(!this.isDisposed){Ze(),this.isRunning=!0;var t=R.trackingContext;R.trackingContext=this;var n=Be(this,e,void 0);R.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ve(this),Re(n)&&this.Dt(n.cause),Qe()}},t.Dt=function(e){var t=this;if(this.Kt)this.Kt(e,this);else{if(R.disableErrorBoundaries)throw e;R.suppressReactionErrors||console.error(`[mobx] uncaught error in '`+this+`'`,e),R.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Ze(),Ve(this),Qe()))},t.Z=function(e){var t=this,n=function n(){t.dispose(),e==null||e.removeEventListener==null||e.removeEventListener(`abort`,n)};return e==null||e.addEventListener==null||e.addEventListener(`abort`,n),n[F]=this,`dispose`in Symbol&&typeof Symbol.dispose==`symbol`&&(n[Symbol.dispose]=n),n},t.toString=function(){return`Reaction[`+this.tt+`]`},t.trace=function(){},S(e,[{key:`isDisposed`,get:function(){return _(this.bt,e.Wt)},set:function(t){this.bt=v(this.bt,e.Wt,t)}},{key:`isScheduled`,get:function(){return _(this.bt,e.qt)},set:function(t){this.bt=v(this.bt,e.qt,t)}},{key:`isTrackPending`,get:function(){return _(this.bt,e.Gt)},set:function(t){this.bt=v(this.bt,e.Gt,t)}},{key:`isRunning`,get:function(){return _(this.bt,e.Ht)},set:function(t){this.bt=v(this.bt,e.Ht,t)}},{key:`diffValue`,get:function(){return+!!_(this.bt,e.wt)},set:function(t){this.bt=v(this.bt,e.wt,t===1)}}])}();Wn.Wt=1,Wn.qt=2,Wn.Gt=4,Wn.Ht=8,Wn.wt=16;var Gn=function(e){return e()},Kn=f(`Reaction`,Wn),qn=ce(`action`),Jn=ce(`action.bound`,{bound:!0}),Yn=ce(`autoAction`,{autoAction:!0}),Xn=ce(`autoAction.bound`,{autoAction:!0,bound:!0}),Zn=it(!1);Object.assign(Zn,qn);var Qn=it(!0);Object.assign(Qn,Yn),Zn.bound=O(Jn),Qn.bound=O(Xn);var $n=function(e){return e()},er=0,tr=function(e){function t(){var n;return n=e.call(this,`FLOW_CANCELLED`)||this,Object.setPrototypeOf(n,(this instanceof t?this.constructor:void 0).prototype),n.name=`FlowCancellationError`,n}return ee(t,e),t.prototype.toString=function(){return`Error: `+this.message},t}(D(Error)),nr=pe(`flow`),rr=pe(`flow.bound`,{bound:!0}),ir=Object.assign((function(e,t){if(ie(t))return nr.t(e,t);if(o(t))return re(e,t,nr);var n=e,r=n.name||`<unnamed flow>`,i=function(){var e,t=this,i=arguments,o=++er,s=Zn(r+` - runid: `+o+` - init`,n).apply(t,i),c=void 0,l=new Promise((function(t,n){function i(e){var t;c=void 0;try{t=Zn(r+` - runid: `+o+` - yield `+ d++,s.next).call(s,e)}catch(e){return n(e)}u(t)}function l(e){var t;c=void 0;try{t=Zn(r+` - runid: `+o+` - yield `+ d++,s.throw).call(s,e)}catch(e){return n(e)}u(t)}function u(e){if(!a(e?.then))return e.done?t(e.value):(c=Promise.resolve(e.value)).then(i,l);e.then(u,n)}var d=0;e=n,i(void 0)}));return l.cancel=Zn(r+` - runid: `+o+` - cancel`,(function(){try{c&&ht(c);var t=s.return(void 0),n=Promise.resolve(t.value);n.then(P,P),ht(n),e(new tr)}catch(t){e(t)}})),l};return i.isMobXFlow=!0,i}),nr);ir.bound=O(rr);var ar={has:function(e,t){return Dt(e).it(t)},get:function(e,t){return Dt(e).ct(t)},set:function(e,t,n){var r;return!!o(t)&&((r=Dt(e).ht(t,n,!0))==null||r)},deleteProperty:function(e,t){var n;return!!o(t)&&((n=Dt(e).Ut(t,!0))==null||n)},defineProperty:function(e,t,n){var r;return(r=Dt(e).l(t,n))==null||r},ownKeys:function(e){return Dt(e).rt()},preventExtensions:function(){t(13)}},or=Symbol(`mobx-keys`),sr=`update`,cr={get:function(e,t){var n=e[F];return t===F?n:t===`length`?n.Ft():typeof t!=`string`||isNaN(t)?g(ur,t)?ur[t]:e[t]:n.ct(parseInt(t))},set:function(e,t,n){var r=e[F];return t===`length`&&r.Xt(n),typeof t==`symbol`||isNaN(t)?e[t]=n:r.ht(parseInt(t),n),!0},preventExtensions:function(){t(15)}},lr=function(){function e(e,t,n,r){e===void 0&&(e=`ObservableArray`),this.zt=void 0,this.$t=void 0,this.st=void 0,this.j=[],this.et=void 0,this.ut=void 0,this.Jt=void 0,this.dehancer=void 0,this.v=void 0,this.Yt=0,this.zt=n,this.$t=r,this.st=new hn(e),this.Jt=function(e,n){return t(e,n,`ObservableArray[..]`)}}var n=e.prototype;return n.Qt=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.ft=function(e){return this.dehancer!==void 0&&e.length>0?e.map(this.dehancer):e},n.St=function(e){return kt(this,e)},n._t=function(e,t){return t===void 0&&(t=!1),t&&e({observableKind:`array`,object:this.v,debugObjectName:this.st.tt,type:`splice`,index:0,added:this.j.slice(),addedCount:this.j.length,removed:[],removedCount:0}),Mt(this,e)},n.Ft=function(){return this.st.reportObserved(),this.j.length},n.Xt=function(e){(typeof e!=`number`||isNaN(e)||e<0)&&t(`Out of range: `+e);var n=this.j.length;if(e!==n)if(e>n){for(var r=Array(e-n),i=0;i<e-n;i++)r[i]=void 0;this.ot(n,0,r)}else this.ot(e,n-e)},n.Zt=function(e,n){e!==this.Yt&&t(16),this.Yt+=n,this.$t&&n>0&&Kt(e+n+1)},n.ot=function(e,t,n){var r=this,i=this.j.length;if(e===void 0?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=arguments.length===1?i-e:t==null?0:Math.max(0,Math.min(t,i-e)),n===void 0&&(n=sn),Ot(this)){var a=At(this,{object:this.v,type:`splice`,index:e,removedCount:t,added:n});if(!a)return sn;t=a.removedCount,n=a.added}if(n=n.length===0?n:n.map((function(e){return r.Jt(e,void 0)})),this.$t){var o=n.length-t;this.Zt(i,o)}var s=this.tn(e,t,n);return t===0&&n.length===0||this.nn(e,n,s),this.ft(s)},n.tn=function(e,t,n){var r;if(n.length<1e4)return(r=this.j).splice.apply(r,[e,t].concat(n));var i=this.j.slice(e,e+t),a=this.j.slice(e+t);this.j.length+=n.length-t;for(var o=0;o<n.length;o++)this.j[e+o]=n[o];for(var s=0;s<a.length;s++)this.j[e+n.length+s]=a[s];return i},n.in=function(e,t,n){var r=!this.zt&&!1,i=jt(this),a=i||r?{observableKind:`array`,object:this.v,type:sr,debugObjectName:this.st.tt,index:e,newValue:t,oldValue:n}:null;this.st.reportChanged(),i&&Nt(this,a)},n.nn=function(e,t,n){var r=!this.zt&&!1,i=jt(this),a=i||r?{observableKind:`array`,object:this.v,debugObjectName:this.st.tt,type:`splice`,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.st.reportChanged(),i&&Nt(this,a)},n.ct=function(e){if(!(this.$t&&e>=this.j.length))return this.st.reportObserved(),this.Qt(this.j[e]);console.warn(`[mobx] Out of bounds read: `+e)},n.ht=function(e,n){var r=this.j;if(this.$t&&e>r.length&&t(17,e,r.length),e<r.length){var i=r[e];if(Ot(this)){var a=At(this,{type:sr,object:this.v,index:e,newValue:n});if(!a)return;n=a.newValue}(n=this.Jt(n,i))!==i&&(r[e]=n,this.in(e,n,i))}else{for(var o=Array(e+1-r.length),s=0;s<o.length-1;s++)o[s]=void 0;o[o.length-1]=n,this.ot(r.length,0,o)}},e}(),ur={clear:function(){return this.splice(0)},replace:function(e){var t=this[F];return t.ot(0,t.j.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){var n=[...arguments].slice(2),r=this[F];switch(arguments.length){case 0:return[];case 1:return r.ot(e);case 2:return r.ot(e,t)}return r.ot(e,t,n)},spliceWithArray:function(e,t,n){return this[F].ot(e,t,n)},push:function(){for(var e=this[F],t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.ot(e.j.length,0,n),e.j.length},pop:function(){return this.splice(Math.max(this[F].j.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[F],t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.ot(0,0,n),e.j.length},reverse:function(){return R.trackingDerivation&&t(37,`reverse`),this.replace(this.slice().reverse()),this},sort:function(){R.trackingDerivation&&t(37,`sort`);var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[F],n=t.ft(t.j).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};j(`at`,Ft),j(`concat`,Ft),j(`flat`,Ft),j(`includes`,Ft),j(`indexOf`,Ft),j(`join`,Ft),j(`lastIndexOf`,Ft),j(`slice`,Ft),j(`toString`,Ft),j(`toLocaleString`,Ft),j(`toSorted`,Ft),j(`toSpliced`,Ft),j(`with`,Ft),j(`every`,M),j(`filter`,M),j(`find`,M),j(`findIndex`,M),j(`findLast`,M),j(`findLastIndex`,M),j(`flatMap`,M),j(`forEach`,M),j(`map`,M),j(`some`,M),j(`toReversed`,M),j(`reduce`,It),j(`reduceRight`,It);var dr,fr,pr=f(`ObservableArrayAdministration`,lr),mr={},hr=`add`,gr=function(){function e(e,n,r){var i=this;n===void 0&&(n=oe),r===void 0&&(r=`ObservableMap`),this.Jt=void 0,this.tt=void 0,this[F]=mr,this.vt=void 0,this.dt=void 0,this.lt=void 0,this.et=void 0,this.ut=void 0,this.dehancer=void 0,this.Jt=n,this.tt=r,a(Map)||t(18),Zt((function(){i.lt=ae(`ObservableMap.keys()`),i.vt=new Map,i.dt=new Map,e&&i.merge(e)}))}var n=e.prototype;return n.it=function(e){return this.vt.has(e)},n.has=function(e){var t=this;if(!R.trackingDerivation)return this.it(e);var n=this.dt.get(e);if(!n){var r=n=new Pn(this.it(e),se,`ObservableMap.key?`,!1);this.dt.set(e,r),ut(r,(function(){return t.dt.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.it(e);if(Ot(this)){var r=At(this,{type:n?sr:hr,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.rn(e,t):this.en(e,t),this},n.delete=function(e){var t=this;if(Ot(this)&&!At(this,{type:`delete`,object:this,name:e}))return!1;if(this.it(e)){var n=jt(this),r=n?{observableKind:`map`,debugObjectName:this.tt,type:`delete`,object:this,oldValue:this.vt.get(e).Ot,name:e}:null;return wt((function(){var n;t.lt.reportChanged(),(n=t.dt.get(e))==null||n.gt(!1),t.vt.get(e).gt(void 0),t.vt.delete(e)})),n&&Nt(this,r),!0}return!1},n.rn=function(e,t){var n=this.vt.get(e);if((t=n.xt(t))!==R.UNCHANGED){var r=jt(this),i=r?{observableKind:`map`,debugObjectName:this.tt,type:sr,object:this,oldValue:n.Ot,name:e,newValue:t}:null;n.gt(t),r&&Nt(this,i)}},n.en=function(e,t){var n=this;wt((function(){var r,i=new Pn(t,n.Jt,`ObservableMap.key`,!1);n.vt.set(e,i),t=i.Ot,(r=n.dt.get(e))==null||r.gt(!0),n.lt.reportChanged()}));var r=jt(this);r&&Nt(this,r?{observableKind:`map`,debugObjectName:this.tt,type:hr,object:this,name:e,newValue:t}:null)},n.get=function(e){return this.has(e)?this.Qt(this.vt.get(e).get()):this.Qt(void 0)},n.Qt=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.keys=function(){return this.lt.reportObserved(),this.vt.keys()},n.values=function(){var e=this,t=this.keys();return Rt({next:function(){var n=t.next(),r=n.done;return{done:r,value:r?void 0:e.get(n.value)}}})},n.entries=function(){var e=this,t=this.keys();return Rt({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[Symbol.iterator]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=C(this);!(n=r()).done;){var i=n.value;e.call(t,i[1],i[0],this)}},n.merge=function(e){var n=this;return _r(e)&&(e=new Map(e)),wt((function(){var r,i;c(e)?function(e){var t=Object.keys(e);if(!dn)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return on.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(t){return n.set(t,e[t])})):Array.isArray(e)?e.forEach((function(e){return n.set(e[0],e[1])})):p(e)?(r=Object.getPrototypeOf(e),i=Object.getPrototypeOf(r),Object.getPrototypeOf(i)!==null&&t(19,e),e.forEach((function(e,t){return n.set(t,e)}))):e!=null&&t(20,e)})),this},n.clear=function(){var e=this;wt((function(){He((function(){for(var t,n=C(e.keys());!(t=n()).done;)e.delete(t.value)}))}))},n.replace=function(e){var n=this;return wt((function(){for(var r,i=function(e){if(p(e)||_r(e))return e;if(Array.isArray(e))return new Map(e);if(c(e)){var n=new Map;for(var r in e)n.set(r,e[r]);return n}return t(21,e)}(e),a=new Map,o=!1,s=C(n.vt.keys());!(r=s()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))o=!0;else{var u=n.vt.get(l);a.set(l,u)}}for(var d,f=C(i.entries());!(d=f()).done;){var m=d.value,h=m[0],g=m[1],_=n.vt.has(h);if(n.set(h,g),n.vt.has(h)){var v=n.vt.get(h);a.set(h,v),_||(o=!0)}}if(!o)if(n.vt.size!==a.size)n.lt.reportChanged();else for(var y=n.vt.keys(),b=a.keys(),x=y.next(),S=b.next();!x.done;){if(x.value!==S.value){n.lt.reportChanged();break}x=y.next(),S=b.next()}n.vt=a})),this},n.toString=function(){return`[object ObservableMap]`},n.toJSON=function(){return Array.from(this)},n._t=function(e){return Mt(this,e)},n.St=function(e){return kt(this,e)},S(e,[{key:`size`,get:function(){return this.lt.reportObserved(),this.vt.size}},{key:Symbol.toStringTag,get:function(){return`Map`}}])}(),_r=f(`ObservableMap`,gr),vr={},yr=function(){function e(e,n,r){var i=this;n===void 0&&(n=oe),r===void 0&&(r=`ObservableSet`),this.tt=void 0,this[F]=vr,this.vt=new Set,this.st=void 0,this.ut=void 0,this.et=void 0,this.dehancer=void 0,this.Jt=void 0,this.tt=r,a(Set)||t(22),this.Jt=function(e,t){return n(e,t,r)},Zt((function(){i.st=ae(i.tt),e&&i.replace(e)}))}var n=e.prototype;return n.Qt=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.clear=function(){var e=this;wt((function(){He((function(){for(var t,n=C(e.vt.values());!(t=n()).done;)e.delete(t.value)}))}))},n.forEach=function(e,t){for(var n,r=C(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(Ot(this)){var n=At(this,{type:hr,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){wt((function(){t.vt.add(t.Jt(e,void 0)),t.st.reportChanged()}));var r=jt(this);r&&Nt(this,r?{observableKind:`set`,debugObjectName:this.tt,type:hr,object:this,newValue:e}:null)}return this},n.delete=function(e){var t=this;if(Ot(this)&&!At(this,{type:`delete`,object:this,oldValue:e}))return!1;if(this.has(e)){var n=jt(this),r=n?{observableKind:`set`,debugObjectName:this.tt,type:`delete`,object:this,oldValue:e}:null;return wt((function(){t.st.reportChanged(),t.vt.delete(e)})),n&&Nt(this,r),!0}return!1},n.has=function(e){return this.st.reportObserved(),this.vt.has(this.Qt(e))},n.entries=function(){var e=this.values();return zt({next:function(){var t=e.next(),n=t.value,r=t.done;return r?{value:void 0,done:r}:{value:[n,n],done:r}}})},n.keys=function(){return this.values()},n.values=function(){this.st.reportObserved();var e=this,t=this.vt.values();return zt({next:function(){var n=t.next(),r=n.done;return r?{value:void 0,done:r}:{value:e.Qt(n.value),done:r}}})},n.intersection=function(e){return m(e)&&!br(e)?e.intersection(this):new Set(this).intersection(e)},n.union=function(e){return m(e)&&!br(e)?e.union(this):new Set(this).union(e)},n.difference=function(e){return new Set(this).difference(e)},n.symmetricDifference=function(e){return m(e)&&!br(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},n.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},n.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},n.isDisjointFrom=function(e){return m(e)&&!br(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},n.replace=function(e){var n=this;return br(e)&&(e=new Set(e)),wt((function(){Array.isArray(e)||m(e)?(n.clear(),e.forEach((function(e){return n.add(e)}))):e!=null&&t(`Cannot initialize set from `+e)})),this},n._t=function(e){return Mt(this,e)},n.St=function(e){return kt(this,e)},n.toJSON=function(){return Array.from(this)},n.toString=function(){return`[object ObservableSet]`},n[Symbol.iterator]=function(){return this.values()},S(e,[{key:`size`,get:function(){return this.st.reportObserved(),this.vt.size}},{key:Symbol.toStringTag,get:function(){return`Set`}}])}(),br=f(`ObservableSet`,yr),xr=Object.create(null),Sr=function(){function e(e,t,n,r){t===void 0&&(t=new Map),r===void 0&&(r=yn),this.h=void 0,this.j=void 0,this.tt=void 0,this.un=void 0,this.lt=void 0,this.ut=void 0,this.et=void 0,this.v=void 0,this.p=void 0,this.on=void 0,this.sn=void 0,this.h=e,this.j=t,this.tt=n,this.un=r,this.lt=new hn(`ObservableObject.keys`),this.p=c(this.h)}var n=e.prototype;return n.O=function(e){return this.j.get(e).get()},n.S=function(e,t){var n=this.j.get(e);if(n instanceof In)return n.set(t),!0;if(Ot(this)){var r=At(this,{type:sr,object:this.v||this.h,name:e,newValue:t});if(!r)return null;t=r.newValue}if((t=n.xt(t))!==R.UNCHANGED){var i=jt(this),a=i?{type:sr,observableKind:`object`,debugObjectName:this.tt,object:this.v||this.h,oldValue:n.Ot,name:e,newValue:t}:null;n.gt(t),i&&Nt(this,a)}return!0},n.ct=function(e){return R.trackingDerivation&&!g(this.h,e)&&this.it(e),this.h[e]},n.ht=function(e,t,n){return n===void 0&&(n=!1),g(this.h,e)?this.j.has(e)?this.S(e,t):n?Reflect.set(this.h,e,t):(this.h[e]=t,!0):this.s(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.un,n)},n.it=function(e){if(!R.trackingDerivation)return e in this.h;this.sn||=new Map;var t=this.sn.get(e);return t||(t=new Pn(e in this.h,se,`ObservableObject.key?`,!1),this.sn.set(e,t)),t.get()},n.o=function(e,n){if(!0===n&&(n=this.un),!1!==n){if(!(e in this.h)){var r;if((r=this.h[mn])!=null&&r[e])return;t(1,n.i,this.tt+`.`+e.toString())}for(var i=this.h;i&&i!==on;){var a=rn(i,e);if(a){var o=n.o(this,e,a,i);if(o===0)return;if(o===1)break}i=Object.getPrototypeOf(i)}Ut(this,0,e)}},n.s=function(e,t,n,r){if(r===void 0&&(r=!1),!0===n&&(n=this.un),!1===n)return this.l(e,t,r);var i=n.s(this,e,t,r);return i&&Ut(this,0,e),i},n.l=function(e,t,n){n===void 0&&(n=!1);try{Ze();var r=this.Ut(e);if(!r)return r;if(Ot(this)){var i=At(this,{object:this.v||this.h,name:e,type:hr,newValue:t.value});if(!i)return null;var a=i.newValue;t.value!==a&&(t=w({},t,{value:a}))}if(n){if(!Reflect.defineProperty(this.h,e,t))return!1}else an(this.h,e,t);this.fn(e,t.value)}finally{Qe()}return!0},n.g=function(e,t,n,r){r===void 0&&(r=!1);try{Ze();var i=this.Ut(e);if(!i)return i;if(Ot(this)){var a=At(this,{object:this.v||this.h,name:e,type:hr,newValue:t});if(!a)return null;t=a.newValue}var o=Vt(e),s={configurable:!R.safeDescriptors||this.p,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.h,e,s))return!1}else an(this.h,e,s);var c=new Pn(t,n,`ObservableObject.key`,!1);this.j.set(e,c),this.fn(e,c.Ot)}finally{Qe()}return!0},n.m=function(e,t,n){n===void 0&&(n=!1);try{Ze();var r=this.Ut(e);if(!r)return r;if(Ot(this)&&!At(this,{object:this.v||this.h,name:e,type:hr,newValue:void 0}))return null;t.name||=`ObservableObject.key`,t.context=this.v||this.h;var i=Vt(e),a={configurable:!R.safeDescriptors||this.p,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.h,e,a))return!1}else an(this.h,e,a);this.j.set(e,new In(t)),this.fn(e,void 0)}finally{Qe()}return!0},n.Ut=function(e,t){if(t===void 0&&(t=!1),!g(this.h,e))return!0;if(Ot(this)&&!At(this,{object:this.v||this.h,name:e,type:`remove`}))return null;try{var n;Ze();var r=jt(this),i=this.j.get(e),a=void 0;if(!i&&r&&(a=rn(this.h,e)?.value),t){if(!Reflect.deleteProperty(this.h,e))return!1}else delete this.h[e];i&&(this.j.delete(e),i instanceof Pn&&(a=i.Ot),et(i)),this.lt.reportChanged(),(n=this.sn)==null||(n=n.get(e))==null||n.set(e in this.h),r&&r&&Nt(this,{type:`remove`,observableKind:`object`,object:this.v||this.h,debugObjectName:this.tt,oldValue:a,name:e})}finally{Qe()}return!0},n._t=function(e){return Mt(this,e)},n.St=function(e){return kt(this,e)},n.fn=function(e,t){var n,r=jt(this);r&&r&&Nt(this,r?{type:hr,observableKind:`object`,debugObjectName:this.tt,object:this.v||this.h,name:e,newValue:t}:null),(n=this.sn)==null||(n=n.get(e))==null||n.set(!0),this.lt.reportChanged()},n.rt=function(){return this.lt.reportObserved(),fn(this.h)},n.nt=function(){return this.lt.reportObserved(),Object.keys(this.h)},e}(),Cr=f(`ObservableObjectAdministration`,Sr),wr=Wt(0),Tr=function(){var e=!1,t={};return Object.defineProperty(t,`0`,{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),Er=0,Dr=function(){};dr=Dr,fr=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(dr.prototype,fr):dr.prototype.__proto__===void 0?dr.prototype=fr:dr.prototype.__proto__=fr;var Or=function(e){function t(t,n,r,i){var a;return r===void 0&&(r=`ObservableArray`),i===void 0&&(i=!1),a=e.call(this)||this,Zt((function(){var e=new lr(r,n,i,!0);e.v=a,d(a,F,e),t&&t.length&&a.spliceWithArray(0,0,t),Tr&&Object.defineProperty(a,`0`,wr)})),a}ee(t,e);var n=t.prototype;return n.concat=function(){this[F].st.reportObserved();var e=[...arguments];return Array.prototype.concat.apply(this.slice(),e.map((function(e){return Lt(e)?e.slice():e})))},n[Symbol.iterator]=function(){var e=this,t=0;return en({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},S(t,[{key:`length`,get:function(){return this[F].Ft()},set:function(e){this[F].Xt(e)}},{key:Symbol.toStringTag,get:function(){return`Array`}}])}(Dr);Object.entries(ur).forEach((function(e){var t=e[0];t!==`concat`&&u(Or.prototype,t,e[1])})),Kt(1e3);var kr=on.toString,Ar=n().Iterator?.prototype||{};[`Symbol`,`Map`,`Set`].forEach((function(e){n()[e]===void 0&&t(`MobX requires global '`+e+`' to be available or polyfilled`)})),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__==`object`&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:rt,extras:{getDebugName:Xt},$mobx:F}),e.$mobx=F,e.FlowCancellationError=tr,e.ObservableMap=gr,e.ObservableSet=yr,e.Reaction=Wn,e._allowStateChanges=Fe,e._allowStateChangesInsideComputed=at,e._allowStateReadsEnd=Ke,e._allowStateReadsStart=Ge,e._autoAction=Qn,e._endAction=Pe,e._getAdministration=Yt,e._getGlobalState=function(){return R},e._interceptReads=function(e,t,n){var r;return _r(e)||Lt(e)||Fn(e)?r=Yt(e):Ht(e)&&(r=Yt(e,t)),r.dehancer=typeof t==`function`?t:n,function(){r.dehancer=void 0}},e._isComputingDerivation=function(){return R.trackingDerivation!==null},e._resetGlobalState=function(){var e=new Vn;for(var t in e)Bn.indexOf(t)===-1&&(R[t]=e[t]);R.allowStateChanges=!R.enforceActions},e._startAction=Ne,e.action=Zn,e.autorun=st,e.comparer=_n,e.computed=kn,e.configure=function(e){!0===e.isolateGlobalState&&function(){if((R.pendingReactions.length||R.inBatch||R.isRunningReactions)&&t(36),Un=!0,Hn){var e=n();--e.__mobxInstanceCount==0&&(e.__mobxGlobals=void 0),R=new Vn}}();var r,i,a=e.useProxies,o=e.enforceActions;if(a!==void 0&&(R.useProxies=a===`always`||a!==`never`&&typeof Proxy<`u`),a===`ifavailable`&&(R.verifyProxies=!0),o!==void 0){var s=o===`always`?`always`:o===`observed`;R.enforceActions=s,R.allowStateChanges=!0!==s&&s!==`always`}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach((function(t){t in e&&(R[t]=!!e[t])})),R.allowStateReads=!R.observableRequiresReaction,e.reactionScheduler&&(r=e.reactionScheduler,i=Gn,Gn=function(e){return r((function(){return i(e)}))})},e.createAtom=ae,e.defineProperty=function(e,n,r){if(Ht(e))return e[F].l(n,r);t(39)},e.entries=function(e){return Ht(e)?bt(e).map((function(t){return[t,e[t]]})):_r(e)?bt(e).map((function(t){return[t,e.get(t)]})):br(e)?Array.from(e.entries()):Lt(e)?e.map((function(e,t){return[t,e]})):void t(7)},e.extendObservable=ft,e.flow=ir,e.flowResult=function(e){return e},e.get=function(e,n){if(xt(e,n))return Ht(e)?e[F].ct(n):_r(e)?e.get(n):Lt(e)?e[n]:void t(11)},e.getAtom=Jt,e.getDebugName=Xt,e.getDependencyTree=function(e,t){return pt(Jt(e,t))},e.getObserverTree=function(e,t){return mt(Jt(e,t))},e.has=xt,e.intercept=function(e,t,n){return a(n)?function(e,t,n){return Yt(e,t).St(n)}(e,t,n):function(e,t){return Yt(e).St(t)}(e,t)},e.isAction=ot,e.isBoxedObservable=Fn,e.isComputed=function(e){return _t(e)},e.isComputedProp=function(e,t){return _t(e,t)},e.isFlow=gt,e.isFlowCancellationError=function(e){return e instanceof tr},e.isObservable=yt,e.isObservableArray=Lt,e.isObservableMap=_r,e.isObservableObject=Ht,e.isObservableProp=function(e,t){return vt(e,t)},e.isObservableSet=br,e.keys=bt,e.makeAutoObservable=function(e,t,n){return c(e)?ft(e,e,t,n):(Zt((function(){var r=Bt(e,n)[F];if(!e[or]){var i=Object.getPrototypeOf(e),a=new Set([].concat(fn(e),fn(i)));a.delete(`constructor`),a.delete(F),u(i,or,a)}e[or].forEach((function(e){return r.o(e,!t||!(e in t)||t[e])}))})),e)},e.makeObservable=function(e,t,n){return Zt((function(){var r=Bt(e,n)[F];t??=function(e){return g(e,mn)||u(e,mn,w({},e[mn])),e[mn]}(e),fn(t).forEach((function(e){return r.o(e,t[e])}))})),e},e.observable=En,e.observe=function(e,t,n,r){return a(n)?function(e,t,n,r){return Yt(e,t)._t(n,r)}(e,t,n,r):function(e,t,n){return Yt(e)._t(t,n)}(e,t,n)},e.onBecomeObserved=lt,e.onBecomeUnobserved=ut,e.onReactionError=function(e){return R.globalReactionErrorHandlers.push(e),function(){var t=R.globalReactionErrorHandlers.indexOf(e);t>=0&&R.globalReactionErrorHandlers.splice(t,1)}},e.override=vn,e.ownKeys=St,e.reaction=function(e,t,n){function r(){if(p=!1,!h.isDisposed){var t=!1,r=s;h.track((function(){var n=Fe(!1,(function(){return e(h)}));t=f||!m(s,n),s=n})),(f&&n.fireImmediately||!f&&t)&&l(s,r,h),f=!1}}var i;n===void 0&&(n=cn);var a,o,s,c=n.name??`Reaction`,l=Zn(c,n.onError?(a=n.onError,o=t,function(){try{return o.apply(this,arguments)}catch(e){a.call(this,e)}}):t),u=!n.scheduler&&!n.delay,d=ct(n),f=!0,p=!1,m=n.compareStructural?_n.structural:n.equals||_n.default,h=new Wn(c,(function(){f||u?r():p||(p=!0,d(r))}),n.onError,n.requiresObservable);return(i=n)!=null&&(i=i.signal)!=null&&i.aborted||h.Y(),h.Z(n?.signal)},e.remove=function(e,n){Ht(e)?e[F].Ut(n):_r(e)||br(e)?e.delete(n):Lt(e)?(typeof n!=`number`&&(n=parseInt(n,10)),e.splice(n,1)):t(9)},e.runInAction=at,e.set=function e(n,r,i){if(arguments.length!==2||br(n))Ht(n)?n[F].ht(r,i):_r(n)?n.set(r,i):br(n)?n.add(r):Lt(n)?(typeof r!=`number`&&(r=parseInt(r,10)),r<0&&t(`Invalid index: '`+r+`'`),Ze(),r>=n.length&&(n.length=r+1),n[r]=i,Qe()):t(8);else{Ze();var a=r;try{for(var o in a)e(n,o,a[o])}finally{Qe()}}},e.spy=rt,e.toJS=function(e){return function e(t,n){if(typeof t!=`object`||!t||t instanceof Date||!yt(t))return t;if(Fn(t)||Rn(t))return e(t.get(),n);if(n.has(t))return n.get(t);if(Lt(t)){var r=Ct(n,t,Array(t.length));return t.forEach((function(t,i){r[i]=e(t,n)})),r}if(br(t)){var i=Ct(n,t,new Set);return t.forEach((function(t){i.add(e(t,n))})),i}if(_r(t)){var a=Ct(n,t,new Map);return t.forEach((function(t,r){a.set(r,e(t,n))})),a}var o=Ct(n,t,{});return St(t).forEach((function(r){on.propertyIsEnumerable.call(t,r)&&(o[r]=e(t[r],n))})),o}(e,new Map)},e.trace=function(){},e.transaction=wt,e.untracked=He,e.values=function(e){return Ht(e)?bt(e).map((function(t){return e[t]})):_r(e)?bt(e).map((function(t){return e.get(t)})):br(e)?Array.from(e.values()):Lt(e)?e.slice():void t(6)},e.when=function(e,t,n){return arguments.length===1||t&&typeof t==`object`?Et(e,t):Tt(e,t,n||{})}})),Sv=me((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t={0:`Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'`,1:function(e,t){return`Cannot apply '`+e+`' to '`+t.toString()+`': Field not found.`},5:`'keys()' can only be used on observable objects, arrays, sets and maps`,6:`'values()' can only be used on observable objects, arrays, sets and maps`,7:`'entries()' can only be used on observable objects, arrays and maps`,8:`'set()' can only be used on observable objects, arrays and maps`,9:`'remove()' can only be used on observable objects, arrays and maps`,10:`'has()' can only be used on observable objects, arrays and maps`,11:`'get()' can only be used on observable objects, arrays and maps`,12:`Invalid annotation`,13:`Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)`,14:`Intercept handlers should return nothing or a change object`,15:`Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)`,16:`Modification exception: the internal structure of an observable array was changed.`,17:function(e,t){return`[mobx.array] Index out of bounds, `+e+` is larger than `+t},18:`mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js`,19:function(e){return`Cannot initialize from classes that inherit from Map: `+e.constructor.name},20:function(e){return`Cannot initialize map from `+e},21:function(e){return`Cannot convert to map from '`+e+`'`},22:`mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js`,23:`It is not possible to get index atoms from arrays`,24:function(e){return`Cannot obtain administration from `+e},25:function(e,t){return`the entry '`+e+`' does not exist in the observable map '`+t+`'`},26:`please specify a property`,27:function(e,t){return`no observable property '`+e.toString()+`' found on the observable object '`+t+`'`},28:function(e){return`Cannot obtain atom from `+e},29:`Expecting some object`,30:`invalid action stack. did you forget to finish an action?`,31:`missing option for computed: get`,32:function(e,t){return`Cycle detected in computation `+e+`: `+t},33:function(e){return`The setter of computed value '`+e+`' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?`},34:function(e){return`[ComputedValue '`+e+`'] It is not possible to assign a new value to a computed value.`},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:`isolateGlobalState should be called before MobX is running any reactions`,37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:`'ownKeys()' can only be used on observable objects`,39:`'defineProperty()' can only be used on observable objects`};function n(e){var n=[...arguments].slice(1),r=typeof e==`string`?e:t[e];throw typeof r==`function`&&(r=r.apply(null,n)),Error(`[MobX] `+r)}var r={};function i(){return typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:r}var a=Object.assign,o=Object.getOwnPropertyDescriptor,s=Object.defineProperty,c=Object.prototype,l=[];Object.freeze(l);var u={};Object.freeze(u);var d=typeof Proxy<`u`,f=Object.toString();function p(){d||n("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function m(e){I.verifyProxies&&n(`MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to `+e)}function h(){return++I.mobxGuid}function g(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var _=function(){};function v(e){return typeof e==`function`}function y(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function b(e){return typeof e==`object`&&!!e}function x(e){if(!b(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n.toString()===f}function S(e){var t=e?.constructor;return t?t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`:!1}function C(e,t,n){s(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function w(e,t,n){s(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function T(e,t){var n=`isMobX`+e;return t.prototype[n]=!0,function(e){return b(e)&&e[n]===!0}}function ee(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function te(e){return Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(e)))===null}function E(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}var ne=Object.getOwnPropertySymbols!==void 0;function D(e){var t=Object.keys(e);if(!ne)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return c.propertyIsEnumerable.call(e,t)})):t}var O=typeof Reflect<`u`&&Reflect.ownKeys?Reflect.ownKeys:ne?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function re(e){return typeof e==`string`?e:typeof e==`symbol`?e.toString():new String(e).toString()}function ie(e){return e===null?null:typeof e==`object`?``+e:e}function ae(e,t){return c.hasOwnProperty.call(e,t)}var oe=Object.getOwnPropertyDescriptors||function(e){var t={};return O(e).forEach(function(n){t[n]=o(e,n)}),t};function se(e,t){return!!(e&t)}function ce(e,t,n){return n?e|=t:e&=~t,e}function le(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ue(e,t,n){if(_e())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&ve(i,n.prototype),i}function de(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,be(r.key),r)}}function fe(e,t,n){return t&&de(e.prototype,t),n&&de(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function pe(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=xe(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
52
+ `)}function Ng(e){let t=new TextEncoder;return e.split(/\s+/).filter(e=>e.length>0).map(e=>String.fromCharCode(...t.encode(e).slice(0,1))).join(``)}function Pg(e,t){let n=[];for(let e of t){if(typeof e==`object`&&e)throw Sh(`join`,2,`list of strings/primitives`,`list element of type ${Fg(e)}`);n.push(String(e))}return n.join(e)}function Fg(e){return Array.isArray(e)?`array`:e instanceof Map?`Map`:e instanceof Set?`Set`:`object`}function Ig(e){return Tg(e,`-`)}function Lg(e){return e.toLowerCase()}function Rg(e,t){return`\n${Mg(e,t)}`}function zg(e){return e.replace(/\s+/g,``)}function Bg(e,t,n){return n===1?e:t}function Vg(...e){return e.map(e=>`"${e}"`).join(` `)}function Hg(e){return e.replace(/[\\.+*?()|[\]{}^$]/g,`\\$&`)}function Ug(e,t){return t.repeat(Math.max(0,e))}function Wg(e,t,n){return ug(e,n).join(t)}function Gg(e){return Tg(e,`_`)}function Kg(e,t){let n=ug(e,t),r={};for(let e=0;e<n.length;e++)r[`_${e}`]=n[e];return r}function qg(e,t){return ug(e,t)}function Jg(e,t,n){let r=Yg(n,e,t),i={};for(let e=0;e<r.length;e++)i[`_${e}`]=r[e]??``;return i}function Yg(e,t,n){if(n===0)return[];let r=ug(t,e);if(n<0||r.length<=n)return r;let i=r.slice(0,n-1),a=r.slice(n-1).join(t);return[...i,a]}function Xg(...e){return e.map(e=>`'${e}'`).join(` `)}function Zg(e,t,n){let r=lg(n),i=t<0||t>r.length?r.length:t,a=Math.min(Math.max(0,e),i);return r.slice(a,i).join(``)}function Qg(e){let t=``;for(let n of e)$g(n)?t+=n.toLowerCase():e_(n)?t+=n.toUpperCase():t+=n;return t}function $g(e){return e!==e.toLowerCase()&&e===e.toUpperCase()}function e_(e){return e!==e.toUpperCase()&&e===e.toLowerCase()}function t_(e){return e.replace(/\b([a-zA-Z])/g,e=>e.toUpperCase())}function n_(e){return e.trim()}function r_(e,t){if(e.length===0)return t;let n=new Set(lg(e)),r=lg(t),i=0;for(;i<r.length&&n.has(r[i]);)i+=1;let a=r.length;for(;a>i&&n.has(r[a-1]);)--a;return r.slice(i,a).join(``)}function i_(e,t){return t.startsWith(e)?t.slice(e.length):t}function a_(e,t){return t.endsWith(e)?t.slice(0,t.length-e.length):t}function o_(e,t){let n=lg(t);if(e<0){let r=-e;return r>=n.length?t:n.slice(n.length-r).join(``)}return e>=n.length?t:n.slice(0,e).join(``)}function s_(e){return e.replace(/\b([A-Z])/g,e=>e.toLowerCase())}function c_(e){return e.toUpperCase()}function l_(e,t){return u_(e,`
53
+ `,t)}function u_(e,t,n){if(e<=0)return n;let r=[];for(let t of n.split(`
54
+ `)){let n=``;for(let i of t.split(/\s+/))i.length!==0&&(n.length===0?n=i:n.length+1+i.length<=e?n+=` ${i}`:(r.push(n),n=i));n.length>0&&r.push(n)}return r.join(t)}function d_(e,t,n){return u_(e,t,n)}function f_(){return{abbrev:{fn:(e,t)=>dg(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},abbrevboth:{fn:(e,t,n)=>fg(e,t,n),argTypes:[`int`,`int`,`string`],arity:{kind:`exact`}},camelcase:{fn:e=>Dg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},cat:{fn:(...e)=>Og(...e),argTypes:[`string`],arity:{kind:`variadic`}},contains:{fn:(e,t)=>kg(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},hasPrefix:{fn:(e,t)=>Ag(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},hasSuffix:{fn:(e,t)=>jg(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},indent:{fn:(e,t)=>Mg(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},initials:{fn:e=>Ng(e),argTypes:[`string`],arity:{kind:`exact`}},join:{fn:(e,t)=>Pg(e,t),argTypes:[`string`,`list`],arity:{kind:`exact`}},kebabcase:{fn:e=>Ig(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},lower:{fn:e=>Lg(e),argTypes:[`string`],arity:{kind:`exact`}},nindent:{fn:(e,t)=>Rg(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},nospace:{fn:e=>zg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},plural:{fn:(e,t,n)=>Bg(e,t,n),argTypes:[`string`,`string`,`int`],arity:{kind:`exact`},returnType:`string`},quote:{fn:(...e)=>Vg(...e),argTypes:[`string`],arity:{kind:`variadic`}},regexQuoteMeta:{fn:e=>Hg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},repeat:{fn:(e,t)=>Ug(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},replace:{fn:(e,t,n)=>Wg(e,t,n),argTypes:[`string`,`string`,`string`],arity:{kind:`exact`}},snakecase:{fn:e=>Gg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},split:{fn:(e,t)=>Kg(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},splitList:{fn:(e,t)=>qg(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},splitn:{fn:(e,t,n)=>Jg(e,t,n),argTypes:[`string`,`int`,`string`],arity:{kind:`exact`},returnType:`dict`},squote:{fn:(...e)=>Xg(...e),argTypes:[`string`],arity:{kind:`variadic`}},substr:{fn:(e,t,n)=>Zg(e,t,n),argTypes:[`int`,`int`,`string`],arity:{kind:`exact`}},swapcase:{fn:e=>Qg(e),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},title:{fn:e=>t_(e),argTypes:[`string`],arity:{kind:`exact`}},trim:{fn:e=>n_(e),argTypes:[`string`],arity:{kind:`exact`}},trimAll:{fn:(e,t)=>r_(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},trimPrefix:{fn:(e,t)=>i_(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},trimSuffix:{fn:(e,t)=>a_(e,t),argTypes:[`string`,`string`],arity:{kind:`exact`}},trunc:{fn:(e,t)=>o_(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},untitle:{fn:e=>s_(e),argTypes:[`string`],arity:{kind:`exact`}},upper:{fn:e=>c_(e),argTypes:[`string`],arity:{kind:`exact`}},wrap:{fn:(e,t)=>l_(e,t),argTypes:[`int`,`string`],arity:{kind:`exact`}},wrapWith:{fn:(e,t,n)=>d_(e,t,n),argTypes:[`int`,`string`,`string`],arity:{kind:`exact`}}}}function p_(e){return e}function m_(e,t,n){return n===void 0?_u+hu(e)+`.`+hu(t):h_(n)}function h_(e){return _u+hu(e)}function g_(e,t){return e+`.`+t}function __(e){return e+`.page`}const v_=[`closeOnPick`,`paged`,`key`,`distribution`],y_=e=>v_.includes(e),b_=`"closeOnPick" (bool, default false), "paged" (bool, default true), "key" (string, accordion grouping), "distribution" (one of ${ca.map(e=>`"${e}"`).join(`, `)}; default "van-der-corput")`;function x_(e){for(let t of Object.keys(e))if(!y_(t))throw Error(`unknown {{ menu }} option "${t}" — the options dict takes ${b_}`);let t=(t,n)=>{let r=e[t];if(r===void 0)return n;if(typeof r!=`boolean`)throw Error(`{{ menu }} option "${t}" must be a boolean, got ${JSON.stringify(r)} (e.g. (dict "${t}" ${String(!n)}))`);return r},n=e.key;if(n!==void 0&&typeof n!=`string`)throw Error(`{{ menu }} option "key" must be a string naming the accordion group, got ${JSON.stringify(n)}`);if(n===``)throw Error(`{{ menu }} has an empty accordion key — a shared key must be a non-empty name (or omit "key" for an independent menu)`);let r=e.distribution;if(r!==void 0&&!la(r))throw Error(`{{ menu }} option "distribution" must be one of: ${ca.join(`, `)}; got ${JSON.stringify(r)}`);return{closeOnPick:t(`closeOnPick`,!1),paged:t(`paged`,!0),key:n,distribution:da(r)}}const S_=`default`,C_={};function w_(e){return[...new Set([S_,...Object.keys(e)])]}function T_(e,t,n){return $a(void 0,e,t,S_,n)}function E_(e,t){let n={[S_]:C_,...e}[t];if(n===void 0)throw Error(`Preset "${t}" is not declared in this config — effectivePresetName collapses unknown names to "${S_}", which always resolves; a miss here means a raw name reached this function without going through that resolution`);return n}function D_(e,t){let n=E_(e.presets,t).root??Oc;return{node:Mc(Fc(n,e.root)),path:Ic(n)?`presets.${t}.root`:`root`}}function O_(e,t){return{...e.globals,...E_(e.presets,t).globals}}const k_=`menu`,A_=`a menu binds its trigger text the way a cycle action binds a display — write {{ menu "applyTheme" "▸" "▾" }} (one per state) or {{ menu "insertHere" "+" }} (one static display for both), with the rare knobs in ONE trailing dict: {{ menu "applyTheme" "▸" "▾" (dict "closeOnPick" true "paged" false "key" "pickers") }} (defaults: closeOnPick false, paged true, no key). The renderer no longer appends ▸/▾ of its own (candybar-settings-ui-aok.4), and the older positional tail ("pageAction" closeOnPick paged "key") was removed — the page cursor is synthesized from the menu's identity`,j_=e=>e.kind===`call`&&e.name===`dict`,M_=e=>e.kind===`literal`&&typeof e.value!=`object`,N_=e=>Uc(``,e,2)===void 0;function P_(e){let t=e=>({kind:`issue`,message:e}),[n,...r]=e.argExprs;if(n===void 0)return t(`with no arguments — it takes an apply-action name and its trigger text (e.g. {{ menu "applyTheme" "▸" "▾" }})`);if(n.kind!==`literal`||typeof n.value!=`string`)return t(`whose apply action is not a string literal — a menu's identity is its apply-action name, which must be a literal so it can be gated at load (e.g. {{ menu "applyTheme" "▸" "▾" }})`);let i=r[r.length-1],a=i!==void 0&&j_(i)?i:void 0,o=a===void 0?r:r.slice(0,-1);if(o.some(j_))return t(`whose options (dict …) is not its last argument — ${A_}`);if(i!==void 0&&a===void 0&&!M_(i)&&N_(o.length-1))return t(`whose last argument is neither a literal nor a literal (dict …) — the renderer tells a display from the options dict by the value it evaluates to, so this call could be read as ${o.length} displays or as ${o.length-1} plus options, and both are legal. Make the options explicit as a trailing (dict …) — {{ menu "${n.value}" (printf "…") (printf "…") (dict) }} binds dynamic displays unambiguously — or bind the trigger text as literals`);let s=Uc(`whose trigger`,o.length,2);if(s!==void 0)return t(`${s} — ${A_}`);let c=a===void 0?{}:nh(a);if(c===null)return t(`whose options (dict …) is not fully literal — every option value must be a literal so the menu can be gated at load (a dynamic entry like (dict "key" .x) cannot)`);let l;try{l=x_(c)}catch(e){return t(`with invalid options — ${e.message}`)}let u=l.key;if(u!==void 0){let e=Su(u);if(e!==void 0)return t(`whose accordion key "${u}" lands in the reserved "${e}" namespace — a key is collapsed to an identifier (${JSON.stringify(u)} becomes "${h_(u)}"), so it would share one open-state key with the synthesized accordion that owns that namespace instead of grouping only your own menus. Name the group without the reserved prefix`)}return{kind:`ok`,apply:n.value,options:l}}function F_(e){let t=dp({fromString:e=>e});try{return t.parse(e).referencedCalls().filter(e=>e.name===k_).map(P_)}catch{return`parse-failed`}}function I_(e){let t=dp({fromString:e=>e});try{return t.parse(e).referencedFunctions().has(k_)}catch{return!1}}function L_(e,t,n){e.issues.push({path:t,message:n,line:G(e.source,[`root`])})}function R_(e,t){Cu(e,t,_u,`{{ menu }} helpers`);for(let[n,r]of Object.entries(t.helpers??{}))I_(r)&&e.issues.push({path:`helpers.${n}`,message:`helper "${n}" uses {{ menu }}, but a menu must live directly in a segment template — its identity is derived from the segment it sits in, which a shared helper does not have. Inline the {{ menu }} call into each segment that needs it.`,line:G(e.source,[`helpers`,n])});let n=t.segments??{};for(let[t,r]of Object.entries(n))for(let n of[`bg`,`fg`,`when`]){let i=r[n];typeof i==`string`&&I_(i)&&L_(e,`segments.${t}.${n}`,`segment "${t}" uses {{ menu }} in its "${n}" — a menu is only valid in a segment's "template" (its placement is published only there; "${n}" needs a ${n===`when`?`predicate`:`color`}). Move the {{ menu }} into the template.`)}if(t.root!==void 0)for(let n of ks(Nc(t.root)))typeof n.when==`string`&&I_(n.when)&&L_(e,`root`,`a layout node's "when" predicate uses {{ menu }} — a menu is only valid in a segment's "template", not a node predicate. Move it into a segment.`);for(let[t,{template:r}]of Object.entries(n)){if(r===void 0||!I_(r))continue;let n=F_(r);if(n!==`parse-failed`)for(let r of n){let n=r.kind===`issue`?r.message:z_(r.apply);n!==void 0&&L_(e,`segments.${t}`,`segment "${t}" has a {{ menu }} ${n}.`)}}}function z_(e){if(e===``)return`with an empty apply-action name — an empty member aliases the absent-state sentinel ("") so the menu would render open before any click. Name the apply action`;if(p_(e)===`closed`)return`whose apply action is named "${Vc}", which collides with the menu's closed-state sentinel and leaves it unopenable. Rename the action`}function B_(e,t){let n={},r={},i=new Map,a=new Set,o=(e,n)=>{let r=`segments.${e}`;a.has(`${r}\0${n}`)||(a.add(`${r}\0${n}`),t.push({path:r,message:n}))};for(let t of w_(e.presets)){let a=new Map,s=new Map;for(let c of ks(D_(e,t).node)){if(c.kind!==`segment`)continue;let t=e.segments[c.name];if(t===void 0)continue;i.has(c.name)||i.set(c.name,F_(t.template));let l=i.get(c.name);if(l===`parse-failed`)continue;let u=Ts(c);for(let[e,t]of l.entries()){if(t.kind===`issue`||z_(t.apply)!==void 0)continue;let{apply:i,options:l}=t,d=p_(i),f=m_(u,i,l.key),p=__(f),m=l.key===void 0?`ind ${u} ${i}`:`key ${l.key}`,h=[f,p].find(e=>{let t=a.get(e);return t!==void 0&&t!==m});if(h!==void 0){o(c.name,`two {{ menu }} disclosures normalize to the same state key ("${h}") but were declared differently — distinct names that differ only by non-alphanumeric characters (e.g. "a-b" vs "a_b") collapse to one key and would silently share open-state. Rename so they don't collide.`);continue}a.set(f,m),a.set(p,m);let g=g_(f,d),_=`${c.name}\0${e}`,v=s.get(g);if(v!==void 0&&v!==_){o(c.name,`two {{ menu }} disclosures resolve to the same identity ("${g}") — ${l.key===void 0?`a segment cannot contain two menus over the same apply action "${i}"`:`menus sharing key "${l.key}" must have distinct apply actions`}.`);continue}s.set(g,_),r[g]=$c(f,d),n[f]=Qc(f,Vc),n[p]={kind:`state`,key:p,default:`0`},r[p]={set:p,int:!0}}}}return{...e,variables:{...e.variables,...n},actions:{...e.actions,...r}}}const V_=dp({fromString:e=>e}),H_=`edit.mode`,U_=`edit.configure`,W_=`edit.toggle`,G_=`edit.unconfigure`,K_=[W_,G_],q_=`arrange`,J_=`${vu}draft.`;function Y_(e,t){return`${e}:${t}`}const X_={variable:H_,key:H_,member:q_},Z_=qc(X_);function Q_(e){try{return V_.parse(e).referencedCalls().some(e=>e.name===`action`&&e.args[0]===`edit.toggle`)}catch{return!1}}function $_(e){if(Object.values(e.actions??{}).some(e=>`do`in e&&e.do.includes(`edit.toggle`)))return!0;for(let t of Object.values(e.segments??{}))for(let e of[t.template,t.bg,t.fg])if(typeof e==`string`&&Q_(e))return!0;return!1}function ev(e,t){if(Cu(e,t,vu,`edit mode`),!$_(t))return;let{variables:n,actions:r}=tv();t.variables={...t.variables??{},...n},t.actions={...t.actions??{},...r}}function tv(){return{variables:{[H_]:Qc(H_,Vc),[U_]:Qc(U_,Vc)},actions:{[W_]:$c(H_,q_),[G_]:{set:U_,to:Vc}}}}const nv=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`[^`]*`/g;function*rv(e){let t=e.indexOf(`{{`);for(;t!==-1;){let n=``,r=t+2;for(;r<e.length&&!e.startsWith(`}}`,r);){if(e.startsWith(`/*`,r)){let t=e.indexOf(`*/`,r+2);r=t===-1?e.length:t+2;continue}let t=r,i=e[r];if(r+=1,i===`"`||i===`'`||i==="`"){for(;r<e.length&&e[r]!==i;)r+=e[r]===`\\`&&i!=="`"?2:1;r+=1}n+=e.slice(t,r)}if(r>=e.length)return;yield n,t=e.indexOf(`{{`,r+2)}}const iv=`[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*`,av=RegExp(`^(?:(\\$)(?:\\.(${iv}))?|\\.(${iv})?)(?=[\\s)]|$)`);function ov(e,t,n){let r=av.exec(e.trimStart());if(r===null)return null;let[i,a]=r[1]===void 0?[t,r[3]]:[n,r[2]];return i===null?null:a===void 0?i:`${i}${a}.`}const sv=/^(\w+)\b\s*([\s\S]*)$/;function*cv(e,t){let n=[t];for(let r of rv(e)){let e=r.replace(/^-(?=\s)/,``).trim(),[,i=``,a=``]=sv.exec(e)??[],o=n[n.length-1],s=n.length>1?n[n.length-2]:o;if(i===`end`){n.length>1&&n.pop();continue}if(i===`else`){yield{code:e,dot:s};let r=/^with\b([\s\S]*)$/.exec(a);n[n.length-1]=r===null?s:ov(r[1],s,t);continue}yield{code:e,dot:o},i===`if`&&n.push(o),i===`with`&&n.push(ov(a,o,t)),(i===`range`||i===`define`||i===`block`)&&n.push(null)}}const lv=/(?<![.$])\btemplate\s+$/;function*uv(e,t,n){let r=0;for(let i of[...e.matchAll(nv)]){let a=i.index+i[0].length;lv.test(e.slice(r,i.index))&&(yield{name:i[0].slice(1,-1),at:ov(e.slice(a),t,n)}),r=a}}function*dv(e,t){let n=new Set;function*r(e,i,a,o){for(let{code:s,dot:c}of[...cv(e,i)]){yield{code:s,dot:c,root:i,via:a};for(let e of[...uv(s,c,i)]){let i=Object.hasOwn(t,e.name)?t[e.name]:void 0,a=`${e.name}\0${e.at??`\0`}`;i===void 0||o.has(e.name)||n.has(a)||(n.add(a),yield*r(i,e.at,e.name,new Set([...o,e.name])))}}}yield*r(e,``,null,new Set)}const fv=RegExp(`(?<![A-Za-z0-9_)$])(\\$?)\\.(${iv})`,`g`);function*pv({code:e,dot:t,root:n}){let r=e.replace(nv,``);for(let e of[...r.matchAll(fv)]){let r=e[1]===`$`?n:t;r!==null&&(yield`${r}${e[2]}`)}}function mv(e,t){let n=new Map;for(let r of dv(e,t))for(let e of pv(r))n.has(e)||n.set(e,r.via);return n}const hv=/(?<![.$])\b(action|picker|menu|carousel)\s+$/,gv={action:1,picker:2,menu:1,carousel:1};function*_v(e){let t=0,n=0,r=`action`;for(let i of[...e.matchAll(nv)]){let a=hv.exec(e.slice(t,i.index));a!==null&&(n=gv[a[1]],r=a[1]===`action`?`action`:`options`),n>0&&(yield{name:i[0].slice(1,-1),site:r},n--),t=i.index+i[0].length}}function vv(e,t){let n=new Map;for(let{code:r,via:i}of dv(e,t))for(let{name:e,site:t}of _v(r)){let r=`${e}\0${i??`\0`}`;n.has(r)||n.set(r,{name:e,site:t,via:i})}return[...n.values()]}function yv(e,t){if(t.names.has(e))return!0;let n=`${e}.`;for(let e of t.names)if(e.startsWith(n))return!0;for(let n of t.documents)if(e.startsWith(`${n}.`))return!0;return!1}function bv(e){let t=new Set,n=new Set,r=(e,r)=>{t.add(e),xv(r)&&n.add(e)};for(let[t,n]of Object.entries(e.variables))r(t,n);for(let[t,n]of Object.entries(e.segments))for(let[e,i]of Object.entries(n.vars??{}))r(`${t}.${e}`,i);return{names:t,documents:n,helpers:e.helpers}}function xv(e){return(e.kind===`shell`||e.kind===`file`)&&Ps(e.parse)===`json`}var Sv=me((e=>{function t(e){var t=[...arguments].slice(1);throw Error(typeof e==`number`?`[MobX] minified error nr: `+e+(t.length?` `+t.map(String).join(`,`):``)+`. Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts`:`[MobX] `+e)}function n(){return typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:en}function r(){sn||t(`Proxy not available`)}function i(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function a(e){return typeof e==`function`}function o(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function s(e){return typeof e==`object`&&!!e}function c(e){if(!s(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n.toString()===cn}function l(e){var t=e?.constructor;return!!t&&(t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`)}function u(e,t,n){nn(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function d(e,t,n){nn(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function f(e,t){var n=`isMobX`+e;return t.prototype[n]=!0,function(e){return s(e)&&!0===e[n]}}function p(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function m(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}function h(e){return e===null?null:typeof e==`object`?``+e:e}function g(e,t){return rn.hasOwnProperty.call(e,t)}function _(e,t){return!!(e&t)}function v(e,t,n){return n?e|=t:e&=~t,e}function y(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t,n){if(te())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&E(i,n.prototype),i}function x(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,ne(r.key),r)}}function S(e,t,n){return t&&x(e.prototype,t),n&&x(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function C(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=function(e,t){if(e){if(typeof e==`string`)return y(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
55
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w(){return(w=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(null,arguments)}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ee(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,E(e,t)}function te(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch{}return(te=function(){return!!e})()}function E(e,t){return(E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function ne(e){var t=function(e){if(typeof e!=`object`||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,`string`);if(typeof n!=`object`)return n;throw TypeError(`@@toPrimitive must return a primitive value.`)}return String(e)}(e);return typeof t==`symbol`?t:t+``}function D(e){var t=typeof Map==`function`?new Map:void 0;return(D=function(e){function n(){return b(e,arguments,T(this).constructor)}if(e===null||!function(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),E(n,e)})(e)}function O(e){return Object.assign((function(t,n){if(ie(n))return e.t(t,n);re(t,n,e)}),e)}function re(e,t,n){g(e,fn)||u(e,fn,w({},e[fn])),function(e){return e.i===`override`}(n)||(e[fn][t]=n)}function ie(e){return typeof e==`object`&&typeof e.kind==`string`}function ae(e,t,n){t===void 0&&(t=I),n===void 0&&(n=I);var r=new pn(e);return t!==I&&lt(r,t),n!==I&&ut(r,n),r}function oe(e,t,n){return yt(e)?e:Array.isArray(e)?wn.array(e,{name:n}):c(e)?wn.object(e,void 0,{name:n}):p(e)?wn.map(e,{name:n}):m(e)?wn.set(e,{name:n}):typeof e!=`function`||ot(e)||gt(e)?e:l(e)?nr(e):Xn(n,e)}function se(e){return e}function ce(e,t){return{i:e,u:t,o:le,s:ue,t:de}}function le(e,t,n,r){var i;return(i=this.u)!=null&&i.bound?this.s(e,t,n,!1)===null?0:1:r===e.h?this.s(e,t,n,!1)===null?0:2:ot(n.value)?1:(nn(r,t,fe(e,this,t,n,!1)),2)}function ue(e,t,n,r){var i=fe(e,this,t,n);return e.l(t,i,r)}function de(e,n){var r,i=n.kind,a=n.name,o=n.addInitializer,s=this,c=function(e){var t;return je(s.u?.name??a.toString(),e,(t=s.u?.autoAction)!=null&&t)};return i==`field`?function(e){var t,n=e;return ot(n)||(n=c(n)),(t=s.u)!=null&&t.bound&&((n=n.bind(this)).isMobxAction=!0),n}:i==`method`?(ot(e)||(e=c(e)),(r=this.u)!=null&&r.bound&&o((function(){var e=this[a].bind(this);e.isMobxAction=!0,this[a]=e})),e):void t(`Cannot apply '`+s.i+`' to '`+String(a)+`' (kind: `+i+`):
56
+ '`+s.i+`' can only be used on properties with a function value.`)}function fe(e,t,n,r,i){var a,o,s;i===void 0&&(i=B.safeDescriptors);var c=r.value;return(a=t.u)!=null&&a.bound&&(c=c.bind(e.v??e.h)),{value:je(t.u?.name??n.toString(),c,(o=t.u?.autoAction)!=null&&o,(s=t.u)!=null&&s.bound?e.v??e.h:void 0),configurable:!i||e.p,enumerable:!1,writable:!i}}function pe(e,t){return{i:e,u:t,o:me,s:he,t:ge}}function me(e,t,n,r){var i;return r===e.h?this.s(e,t,n,!1)===null?0:2:(i=this.u)!=null&&i.bound&&(!g(e.h,t)||!gt(e.h[t]))&&this.s(e,t,n,!1)===null?0:gt(n.value)?1:(nn(r,t,k(e,0,0,n,!1,!1)),2)}function he(e,t,n,r){var i=k(e,0,0,n,this.u?.bound);return e.l(t,i,r)}function ge(e,t){var n,r=t.name,i=t.addInitializer;return gt(e)||(e=nr(e)),(n=this.u)!=null&&n.bound&&i((function(){var e=this[r].bind(this);e.isMobXFlow=!0,this[r]=e})),e}function k(e,t,n,r,i,a){a===void 0&&(a=B.safeDescriptors);var o=r.value;return gt(o)||(o=nr(o)),i&&((o=o.bind(e.v??e.h)).isMobXFlow=!0),{value:o,configurable:!a||e.p,enumerable:!1,writable:!a}}function _e(e,t){return{i:e,u:t,o:ve,s:ye,t:be}}function ve(e,t,n){return this.s(e,t,n,!1)===null?0:1}function ye(e,t,n,r){return e.m(t,w({},this.u,{get:n.get,set:n.set}),r)}function be(e,t){var n=this,r=t.name;return(0,t.addInitializer)((function(){var t=zt(this)[L],i=w({},n.u,{get:e,context:this});i.name||=`ObservableObject.`+r.toString(),t.j.set(r,new Pn(i))})),function(){return this[L].O(r)}}function xe(e,t){return{i:e,u:t,o:Se,s:Ce,t:we}}function Se(e,t,n){return this.s(e,t,n,!1)===null?0:1}function Ce(e,t,n,r){return e.g(t,n.value,this.u?.enhancer??oe,r)}function we(e,t){function n(e,t){var n=zt(e)[L],i=new Mn(t,r.u?.enhancer??oe,`ObservableObject.`+a.toString(),!1);n.j.set(a,i),o.add(e)}var r=this,i=t.kind,a=t.name,o=new WeakSet;if(i==`accessor`)return{get:function(){return o.has(this)||n(this,e.get.call(this)),this[L].O(a)},set:function(e){return o.has(this)||n(this,e),this[L].S(a,e)},init:function(e){return o.has(this)||n(this,e),e}}}function Te(e){return{i:`true`,u:e,o:Ee,s:De,t:Oe}}function Ee(e,t,n,r){var i,a,o;if(n.get)return Dn.o(e,t,n,r);if(n.set){var s=ot(n.set)?n.set:je(t.toString(),n.set);return r===e.h?e.l(t,{configurable:!B.safeDescriptors||e.p,set:s})===null?0:2:(nn(r,t,{configurable:!0,set:s}),2)}if(r!==e.h&&typeof n.value==`function`)return l(n.value)?((o=this.u)!=null&&o.autoBind?nr.bound:nr).o(e,t,n,r):((a=this.u)!=null&&a.autoBind?Xn.bound:Xn).o(e,t,n,r);var c=!1===this.u?.deep?wn.ref:wn;return typeof n.value==`function`&&(i=this.u)!=null&&i.autoBind&&(n.value=n.value.bind(e.v??e.h)),c.o(e,t,n,r)}function De(e,t,n,r){var i;return n.get?Dn.s(e,t,n,r):n.set?e.l(t,{configurable:!B.safeDescriptors||e.p,set:je(t.toString(),n.set)},r):(typeof n.value==`function`&&(i=this.u)!=null&&i.autoBind&&(n.value=n.value.bind(e.v??e.h)),(!1===this.u?.deep?wn.ref:wn).s(e,t,n,r))}function Oe(){t(`'`+this.i+`' cannot be used as a decorator`)}function ke(e){return e||vn}function A(e){return!0===e.deep?oe:!1===e.deep?se:(t=e.defaultDecorator)&&(n=(r=t.u)?.enhancer)!=null?n:oe;var t,n,r}function Ae(e,t,n){return ie(t)?yn.t(e,t):o(t)?void re(e,t,yn):yt(e)?e:c(e)?wn.object(e,t,n):Array.isArray(e)?wn.array(e,t):p(e)?wn.map(e,t):m(e)?wn.set(e,t):typeof e==`object`&&e?e:wn.box(e,t)}function je(e,t,n,r){function i(){return Me(0,n,t,r||this,arguments)}return n===void 0&&(n=!1),i.isMobxAction=!0,i.toString=function(){return t.toString()},An&&(jn.value=e,nn(i,`name`,jn)),i}function Me(e,t,n,r,i){var a=Ne(0,t);try{return n.apply(r,i)}catch(e){throw a._=e,e}finally{Pe(a)}}function Ne(e,t){var n=B.trackingDerivation,r=!t||!n;Ze();var i=B.allowStateChanges;r&&(Ue(),i=Ie(!0));var a={A:r,k:n,M:i,V:Ge(!0),R:!1,N:0,T:kn++,C:On};return On=a.T,a}function Pe(e){On!==e.T&&t(30),On=e.C,e._!==void 0&&(B.suppressReactionErrors=!0),Le(e.M),Ke(e.V),Qe(),e.A&&We(e.k),B.suppressReactionErrors=!1}function Fe(e,t){var n=Ie(e);try{return t()}finally{Le(n)}}function Ie(e){var t=B.allowStateChanges;return B.allowStateChanges=e,t}function Le(e){B.allowStateChanges=e}function Re(e){return e instanceof Ln}function ze(e){switch(e.I){case z.L:return!1;case z.P:case z.K:return!0;case z.B:for(var t=Ge(!0),n=Ue(),r=e.D,i=r.length,a=0;a<i;a++){var o=r[a];if(In(o)){if(B.disableErrorBoundaries)o.get();else try{o.get()}catch{return We(n),Ke(t),!0}if(e.I===z.K)return We(n),Ke(t),!0}}return qe(e),We(n),Ke(t),!1}}function Be(e,t,n){var r=Ge(!0);qe(e),e.W=Array(e.q===0?100:e.D.length),e.G=0,e.q=++B.runId;var i,a=B.trackingDerivation;if(B.trackingDerivation=e,B.inBatch++,!0===B.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new Ln(e)}return B.inBatch--,B.trackingDerivation=a,function(e){for(var t=e.D,n=e.D=e.W,r=z.L,i=0,a=e.G,o=0;o<a;o++){var s=n[o];s.diffValue===0&&(s.diffValue=1,i!==o&&(n[i]=s),i++),s.I>r&&(r=s.I)}for(n.length=i,e.W=null,a=t.length;a--;){var c=t[a];c.diffValue===0&&Ye(c,e),c.diffValue=0}for(;i--;){var l=n[i];l.diffValue===1&&(l.diffValue=0,Je(l,e))}r!==z.L&&(e.I=r,e.H())}(e),Ke(r),i}function Ve(e){var t=e.D;e.D=[];for(var n=t.length;n--;)Ye(t[n],e);e.I=z.P}function He(e){var t=Ue();try{return e()}finally{We(t)}}function Ue(){var e=B.trackingDerivation;return B.trackingDerivation=null,e}function We(e){B.trackingDerivation=e}function Ge(e){var t=B.allowStateReads;return B.allowStateReads=e,t}function Ke(e){B.allowStateReads=e}function qe(e){if(e.I!==z.L){e.I=z.L;for(var t=e.D,n=t.length;n--;)t[n].U=z.L}}function Je(e,t){e.F.add(t),e.U>t.I&&(e.U=t.I)}function Ye(e,t){e.F.delete(t),e.F.size===0&&Xe(e)}function Xe(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,B.pendingUnobservations.push(e))}function Ze(){B.inBatch++}function Qe(){if(--B.inBatch==0){tt();for(var e=B.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.F.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof Pn&&n.X())}B.pendingUnobservations=[]}}function $e(e){var t=B.trackingDerivation;return t===null?(e.F.size===0&&B.inBatch>0&&Xe(e),!1):(t.q!==e.$&&(e.$=t.q,t.W[t.G++]=e,!e.isBeingObserved&&B.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function et(e){e.U!==z.K&&(e.U=z.K,e.F.forEach((function(e){e.I===z.L&&e.H(),e.I=z.K})))}function tt(){B.inBatch>0||B.isRunningReactions||Un(nt)}function nt(){B.isRunningReactions=!0;for(var e=B.pendingReactions,t=0;e.length>0;){++t==100&&(console.error(`[mobx] cycle in reaction: `+e[0]),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].J()}B.isRunningReactions=!1}function rt(){return console.warn(`[mobx.spy] Is a no-op in production builds`),function(){}}function it(e){return function(t,n){return a(t)?je(t.name||`<unnamed action>`,t,e):a(n)?je(t,n,e):ie(n)?(e?qn:Gn).t(t,n):o(n)?re(t,n,e?qn:Gn):o(t)?O(ce(e?`autoAction`:`action`,{name:t,autoAction:e})):void 0}}function at(e){return Me(0,!1,e,this,void 0)}function ot(e){return a(e)&&!0===e.isMobxAction}function st(e,t){function n(){e(i)}var r;t===void 0&&(t=on);var i,a=t?.name??`Autorun`;if(t.scheduler||t.delay){var o=ct(t),s=!1;i=new Hn(a,(function(){s||(s=!0,o((function(){s=!1,i.isDisposed||i.track(n)})))}),t.onError,t.requiresObservable)}else i=new Hn(a,(function(){this.track(n)}),t.onError,t.requiresObservable);return(r=t)!=null&&(r=r.signal)!=null&&r.aborted||i.Y(),i.Z(t?.signal)}function ct(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Zn}function lt(e,t,n){return dt(`onBO`,e,t,n)}function ut(e,t,n){return dt(`onBUO`,e,t,n)}function dt(e,t,n,r){var i=typeof r==`function`?Kt(t,n):Kt(t),o=a(r)?r:n,s=e+`L`;return i[s]?i[s].add(o):i[s]=new Set([o]),function(){var e=i[s];e&&(e.delete(o),e.size===0&&delete i[s])}}function ft(e,t,n,r){var i=dn(t);return Yt((function(){var t=zt(e,r)[L];un(i).forEach((function(e){t.s(e,i[e],!n||!(e in n)||n[e])}))})),e}function pt(e){var t,n={name:e.tt};return e.D&&e.D.length>0&&(n.dependencies=(t=e.D,Array.from(new Set(t))).map(pt)),n}function mt(e){var t={name:e.tt};return function(e){return e.F&&e.F.size>0}(e)&&(t.observers=Array.from(function(e){return e.F}(e)).map(mt)),t}function ht(e){a(e.cancel)&&e.cancel()}function gt(e){return!0===e?.isMobXFlow}function _t(e,t){return t===void 0?In(e):!1===P(e)||!e[L].j.has(t)?!1:In(Kt(e,t))}function vt(e,t){return!!e&&(t===void 0?P(e)||!!e[L]||mn(e)||Wn(e)||In(e):!!P(e)&&e[L].j.has(t))}function yt(e){return vt(e)}function bt(e){return P(e)?e[L].nt():hr(e)||vr(e)?Array.from(e.keys()):Lt(e)?e.map((function(e,t){return t})):void t(5)}function xt(e,n){return P(e)?e[L].it(n):hr(e)||vr(e)?e.has(n):Lt(e)?n>=0&&n<e.length:void t(10)}function St(e){if(P(e))return e[L].rt();t(38)}function Ct(e,t,n){return e.set(t,n),n}function wt(e,t){t===void 0&&(t=void 0),Ze();try{return e.apply(t)}finally{Qe()}}function Tt(e,t,n){var r;if(typeof n.timeout==`number`){var i=Error(`WHEN_TIMEOUT`);r=setTimeout((function(){if(!o[L].isDisposed){if(o(),!n.onError)throw i;n.onError(i)}}),n.timeout)}n.name=`When`;var a=je(`When-effect`,t),o=st((function(t){Fe(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())}),n);return o}function Et(e,t){var n,r,i;if(t!=null&&(n=t.signal)!=null&&n.aborted)return Object.assign(Promise.reject(Error(`WHEN_ABORTED`)),{cancel:function(){return null}});var a=new Promise((function(n,a){var o,s=Tt(e,n,w({},t,{onError:a}));r=function(){s(),a(Error(`WHEN_CANCELLED`))},i=function(){s(),a(Error(`WHEN_ABORTED`))},t==null||(o=t.signal)==null||o.addEventListener==null||o.addEventListener(`abort`,i)})).finally((function(){var e;return t==null||(e=t.signal)==null||e.removeEventListener==null?void 0:e.removeEventListener(`abort`,i)}));return a.cancel=r,a}function Dt(e){return e[L]}function Ot(e){return e.et!==void 0&&e.et.length>0}function kt(e,t){var n=e.et||=[];return n.push(t),i((function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)}))}function At(e,n){var r=Ue();try{for(var i=[].concat(e.et||[]),a=0,o=i.length;a<o&&((n=i[a](n))&&!n.type&&t(14),n);a++);return n}finally{We(r)}}function jt(e){return e.ut!==void 0&&e.ut.length>0}function Mt(e,t){var n=e.ut||=[];return n.push(t),i((function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)}))}function Nt(e,t){var n=Ue(),r=e.ut;if(r){for(var i=0,a=(r=r.slice()).length;i<a;i++)r[i](t);We(n)}}function Pt(e,t,n,i){return n===void 0&&(n=`ObservableArray`),i===void 0&&(i=!1),r(),Yt((function(){var r=new sr(n,t,i,!1);d(r.j,L,r);var a=new Proxy(r.j,or);return r.v=a,e&&e.length&&r.ot(0,0,e),a}))}function j(e,t){typeof Array.prototype[e]==`function`&&(cr[e]=t(e))}function Ft(e){return function(){var t=this[L];t.st.reportObserved();var n=t.ft(t.j);return n[e].apply(n,arguments)}}function M(e){return function(t,n){var r=this,i=this[L];return i.st.reportObserved(),i.ft(i.j)[e]((function(e,i){return t.call(n,e,i,r)}))}}function It(e){return function(){var t=this,n=this[L];n.st.reportObserved();var r=n.ft(n.j),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}function Lt(e){return s(e)&&dr(e[L])}function Rt(e){return e[Symbol.toStringTag]=`MapIterator`,Qt(e)}function N(e){return e[Symbol.toStringTag]=`SetIterator`,Qt(e)}function zt(e,t){if(g(e,L))return e;var n=t?.name??`ObservableObject`;return u(e,L,new br(e,new Map,String(n),function(e){return e?e.defaultDecorator??Te(e):void 0}(t))),e}function Bt(e){return yr[e]||(yr[e]={get:function(){return this[L].O(e)},set:function(t){return this[L].S(e,t)}})}function P(e){return!!s(e)&&xr(e[L])}function Vt(e,t,n){var r;(r=e.h[fn])==null||delete r[n]}function Ht(e){return{enumerable:!1,configurable:!0,get:function(){return this[L].ct(e)},set:function(t){this[L].ht(e,t)}}}function Ut(e){nn(Er.prototype,``+e,Ht(e))}function Wt(e){if(e>wr){for(var t=wr;t<e+100;t++)Ut(t);wr=e}}function Gt(e,t,n){return new Er(e,t,n)}function Kt(e,n){if(typeof e==`object`&&e){if(Lt(e))return n!==void 0&&t(23),e[L].st;if(vr(e))return e.st;if(hr(e)){if(n===void 0)return e.lt;var r=e.vt.get(n)||e.dt.get(n);return r||t(25,n,Jt(e)),r}if(P(e)){if(!n)return t(26);var i=e[L].j.get(n);return i||t(27,n,Jt(e)),i}if(mn(e)||In(e)||Wn(e))return e}else if(a(e)&&Wn(e[L]))return e[L];t(28)}function qt(e,n){return e||t(29),n===void 0?mn(e)||In(e)||Wn(e)||hr(e)||vr(e)?e:e[L]?e[L]:void t(24,e):qt(Kt(e,n))}function Jt(e,t){var n;if(t!==void 0)n=Kt(e,t);else{if(ot(e))return e.name;n=P(e)||hr(e)||vr(e)?qt(e):Kt(e)}return n.tt}function Yt(e){var t=Ue(),n=Ie(!0);Ze();try{return e()}finally{Qe(),Le(n),We(t)}}function Xt(e,t,n){return n===void 0&&(n=-1),function e(t,n,r,i,o){if(t===n)return t!==0||1/t==1/n;if(t==null||n==null)return!1;if(t!=t)return n!=n;var s=typeof t;if(s!==`function`&&s!==`object`&&typeof n!=`object`)return!1;var c=Dr.call(t);if(c!==Dr.call(n))return!1;switch(c){case`[object RegExp]`:case`[object String]`:return``+t==``+n;case`[object Number]`:return+t==+t?+t==0?1/t==1/n:+t==+n:+n!=+n;case`[object Date]`:case`[object Boolean]`:return+t==+n;case`[object Symbol]`:return typeof Symbol<`u`&&Symbol.valueOf.call(t)===Symbol.valueOf.call(n);case`[object Map]`:case`[object Set]`:r>=0&&r++}t=Zt(t),n=Zt(n);var l=c===`[object Array]`;if(!l){if(typeof t!=`object`||typeof n!=`object`)return!1;var u=t.constructor,d=n.constructor;if(u!==d&&!(a(u)&&u instanceof u&&a(d)&&d instanceof d)&&`constructor`in t&&`constructor`in n)return!1}if(r===0)return!1;r<0&&(r=-1),o||=[];for(var f=(i||=[]).length;f--;)if(i[f]===t)return o[f]===n;if(i.push(t),o.push(n),l){if((f=t.length)!==n.length)return!1;for(;f--;)if(!e(t[f],n[f],r-1,i,o))return!1}else{var p=Object.keys(t),m=p.length;if(Object.keys(n).length!==m)return!1;for(var h=0;h<m;h++){var _=p[h];if(!g(n,_)||!e(t[_],n[_],r-1,i,o))return!1}}return i.pop(),o.pop(),!0}(e,t,n)}function Zt(e){return Lt(e)?e.slice():p(e)||hr(e)||m(e)||vr(e)?Array.from(e.entries()):e}function Qt(e){return e[Symbol.iterator]=$t,Object.assign(Object.create(Or),e)}function $t(){return this}Object.defineProperty(e,`__esModule`,{value:!0});var en={},F=Object.assign,tn=Object.getOwnPropertyDescriptor,nn=Object.defineProperty,rn=Object.prototype,an=[];Object.freeze(an);var on={};Object.freeze(on);var sn=typeof Proxy<`u`,cn=Object.toString(),I=function(){},ln=Object.getOwnPropertySymbols!==void 0,un=typeof Reflect<`u`&&Reflect.ownKeys?Reflect.ownKeys:ln?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames,dn=Object.getOwnPropertyDescriptors||function(e){var t={};return un(e).forEach((function(n){t[n]=tn(e,n)})),t},fn=Symbol(`mobx-stored-annotations`),L=Symbol(`mobx administration`),pn=function(){function e(e){e===void 0&&(e=`Atom`),this.tt=void 0,this.bt=0,this.F=new Set,this.$=0,this.U=z.P,this.onBOL=void 0,this.onBUOL=void 0,this.tt=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},t.reportObserved=function(){return $e(this)},t.reportChanged=function(){Ze(),et(this),Qe()},t.toString=function(){return this.tt},S(e,[{key:`isBeingObserved`,get:function(){return _(this.bt,e.pt)},set:function(t){this.bt=v(this.bt,e.pt,t)}},{key:`isPendingUnobservation`,get:function(){return _(this.bt,e.yt)},set:function(t){this.bt=v(this.bt,e.yt,t)}},{key:`diffValue`,get:function(){return+!!_(this.bt,e.wt)},set:function(t){this.bt=v(this.bt,e.wt,t===1)}}])}();pn.pt=1,pn.yt=2,pn.wt=4;var mn=f(`Atom`,pn),hn={identity:function(e,t){return e===t},structural:function(e,t){return Xt(e,t)},default:function(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e==1/t:e!=e&&t!=t},shallow:function(e,t){return Xt(e,t,1)}},gn=O({i:`override`,o:function(){return 0},s:function(){t(`'`+this.i+`' can only be used with 'makeObservable'`)},t:function(){console.warn(`'`+this.i+`' cannot be used with decorators - this is a no-op`)}}),_n=Te(),vn={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(vn);var yn=xe(`observable`),bn=xe(`observable.ref`,{enhancer:se}),R=xe(`observable.shallow`,{enhancer:function(e,t,n){return e==null||P(e)||Lt(e)||hr(e)||vr(e)?e:Array.isArray(e)?wn.array(e,{name:n,deep:!1}):c(e)?wn.object(e,void 0,{name:n,deep:!1}):p(e)?wn.map(e,{name:n,deep:!1}):m(e)?wn.set(e,{name:n,deep:!1}):void 0}}),xn=xe(`observable.struct`,{enhancer:function(e,t){return Xt(e,t)?t:e}}),Sn=O(yn);F(Ae,Sn);var Cn,wn=F(Ae,{box:function(e,t){var n=ke(t);return new Mn(e,A(n),n.name,!0,n.equals)},array:function(e,t){var n=ke(t);return(!1===B.useProxies||!1===n.proxy?Gt:Pt)(e,A(n),n.name)},map:function(e,t){var n=ke(t);return new mr(e,A(n),n.name)},set:function(e,t){var n=ke(t);return new _r(e,A(n),n.name)},object:function(e,t,n){return Yt((function(){return ft(!1===B.useProxies||!1===n?.proxy?zt({},n):function(e,t){var n;return r(),(n=(e=zt(e,t))[L]).v??(n.v=new Proxy(e,rr))}({},n),e,t)}))},ref:O(bn),shallow:O(R),deep:Sn,struct:O(xn)}),Tn=_e(`computed`),En=_e(`computed.struct`,{equals:hn.structural}),Dn=function(e,t){if(ie(t))return Tn.t(e,t);if(o(t))return re(e,t,Tn);if(c(e))return O(_e(`computed`,e));var n=c(t)?t:{};return n.get=e,n.name||=e.name||``,new Pn(n)};Object.assign(Dn,Tn),Dn.struct=O(En);var On=0,kn=1,An=(Cn=tn((function(){}),`name`)?.configurable)!=null&&Cn,jn={value:`action`,configurable:!0,writable:!1,enumerable:!1},Mn=function(e){function t(t,n,r,i,a){var o;return r===void 0&&(r=`ObservableValue`),a===void 0&&(a=hn.default),(o=e.call(this,r)||this).enhancer=void 0,o.tt=void 0,o.equals=void 0,o.jt=!1,o.et=void 0,o.ut=void 0,o.Ot=void 0,o.dehancer=void 0,o.enhancer=n,o.tt=r,o.equals=a,o.Ot=n(t,void 0,r),o}ee(t,e);var n=t.prototype;return n.dehanceValue=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.set=function(e){(e=this.xt(e))!==B.UNCHANGED&&this.gt(e)},n.xt=function(e){if(Ot(this)){var t=At(this,{object:this,type:ar,newValue:e});if(!t)return B.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.Ot,this.tt),this.equals(this.Ot,e)?B.UNCHANGED:e},n.gt=function(e){var t=this.Ot;this.Ot=e,this.reportChanged(),jt(this)&&Nt(this,{type:ar,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.Ot)},n.St=function(e){return kt(this,e)},n._t=function(e,t){return t&&e({observableKind:`value`,debugObjectName:this.tt,object:this,type:ar,newValue:this.Ot,oldValue:void 0}),Mt(this,e)},n.raw=function(){return this.Ot},n.toJSON=function(){return this.get()},n.toString=function(){return this.tt+`[`+this.Ot+`]`},n.valueOf=function(){return h(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(pn),Nn=f(`ObservableValue`,Mn),Pn=function(){function e(e){this.I=z.P,this.D=[],this.W=null,this.F=new Set,this.q=0,this.$=0,this.U=z.L,this.G=0,this.Ot=new Ln(null),this.tt=void 0,this.At=void 0,this.bt=0,this.derivation=void 0,this.kt=void 0,this.Mt=Fn.NONE,this.Et=void 0,this.Vt=void 0,this.Rt=void 0,this.Nt=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||t(31),this.derivation=e.get,this.tt=e.name||`ComputedValue`,e.set&&(this.kt=je(`ComputedValue-setter`,e.set)),this.Vt=e.equals||(e.compareStructural||e.struct?hn.structural:hn.default),this.Et=e.context,this.Rt=e.requiresReaction,this.Nt=!!e.keepAlive}var n=e.prototype;return n.H=function(){(function(e){e.U===z.L&&(e.U=z.B,e.F.forEach((function(e){e.I===z.L&&(e.I=z.B,e.H())})))})(this)},n.onBO=function(){this.onBOL&&this.onBOL.forEach((function(e){return e()}))},n.onBUO=function(){this.onBUOL&&this.onBUOL.forEach((function(e){return e()}))},n.get=function(){if(this.isComputing&&t(32,this.tt,this.derivation),B.inBatch!==0||this.F.size!==0||this.Nt){if($e(this),ze(this)){var e=B.trackingContext;this.Nt&&!e&&(B.trackingContext=this),this.trackAndCompute()&&function(e){e.U!==z.K&&(e.U=z.K,e.F.forEach((function(t){t.I===z.B?t.I=z.K:t.I===z.L&&(e.U=z.L)})))}(this),B.trackingContext=e}}else ze(this)&&(this.Tt(),Ze(),this.Ot=this.Ct(!1),Qe());var n=this.Ot;if(Re(n))throw n.cause;return n},n.set=function(e){if(this.kt){this.isRunningSetter&&t(33,this.tt),this.isRunningSetter=!0;try{this.kt.call(this.Et,e)}finally{this.isRunningSetter=!1}}else t(34,this.tt)},n.trackAndCompute=function(){var e=this.Ot,t=this.I===z.P,n=this.Ct(!0),r=t||Re(e)||Re(n)||!this.Vt(e,n);return r&&(this.Ot=n),r},n.Ct=function(e){this.isComputing=!0;var t,n=Ie(!1);if(e)t=Be(this,this.derivation,this.Et);else if(!0===B.disableErrorBoundaries)t=this.derivation.call(this.Et);else try{t=this.derivation.call(this.Et)}catch(e){t=new Ln(e)}return Le(n),this.isComputing=!1,t},n.X=function(){this.Nt||(Ve(this),this.Ot=void 0)},n._t=function(e,t){var n=this,r=!0,i=void 0;return st((function(){var a=n.get();if(!r||t){var o=Ue();e({observableKind:`computed`,debugObjectName:n.tt,type:ar,object:n,newValue:a,oldValue:i}),We(o)}r=!1,i=a}))},n.Tt=function(){},n.toString=function(){return this.tt+`[`+this.derivation.toString()+`]`},n.valueOf=function(){return h(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},S(e,[{key:`isComputing`,get:function(){return _(this.bt,e.It)},set:function(t){this.bt=v(this.bt,e.It,t)}},{key:`isRunningSetter`,get:function(){return _(this.bt,e.Lt)},set:function(t){this.bt=v(this.bt,e.Lt,t)}},{key:`isBeingObserved`,get:function(){return _(this.bt,e.pt)},set:function(t){this.bt=v(this.bt,e.pt,t)}},{key:`isPendingUnobservation`,get:function(){return _(this.bt,e.yt)},set:function(t){this.bt=v(this.bt,e.yt,t)}},{key:`diffValue`,get:function(){return+!!_(this.bt,e.wt)},set:function(t){this.bt=v(this.bt,e.wt,t===1)}}])}();Pn.It=1,Pn.Lt=2,Pn.pt=4,Pn.yt=8,Pn.wt=16;var z,Fn,In=f(`ComputedValue`,Pn);(function(e){e[e.P=-1]=`NOT_TRACKING_`,e[e.L=0]=`UP_TO_DATE_`,e[e.B=1]=`POSSIBLY_STALE_`,e[e.K=2]=`STALE_`})(z||={}),function(e){e[e.NONE=0]=`NONE`,e[e.LOG=1]=`LOG`,e[e.BREAK=2]=`BREAK`}(Fn||={});var Ln=function(e){this.cause=void 0,this.cause=e},Rn=[`mobxGuid`,`spyListeners`,`enforceActions`,`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`allowStateReads`,`disableErrorBoundaries`,`runId`,`UNCHANGED`,`useProxies`],zn=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},Bn=!0,Vn=!1,B=function(){var e=n();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Bn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new zn().version&&(Bn=!1),Bn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new zn):(setTimeout((function(){Vn||t(35)}),1),new zn)}(),Hn=function(){function e(e,t,n,r){e===void 0&&(e=`Reaction`),this.tt=void 0,this.Pt=void 0,this.Kt=void 0,this.Bt=void 0,this.D=[],this.W=[],this.I=z.P,this.q=0,this.G=0,this.bt=0,this.Mt=Fn.NONE,this.tt=e,this.Pt=t,this.Kt=n,this.Bt=r}var t=e.prototype;return t.H=function(){this.Y()},t.Y=function(){this.isScheduled||(this.isScheduled=!0,B.pendingReactions.push(this),tt())},t.J=function(){if(!this.isDisposed){Ze(),this.isScheduled=!1;var e=B.trackingContext;if(B.trackingContext=this,ze(this)){this.isTrackPending=!0;try{this.Pt()}catch(e){this.Dt(e)}}B.trackingContext=e,Qe()}},t.track=function(e){if(!this.isDisposed){Ze(),this.isRunning=!0;var t=B.trackingContext;B.trackingContext=this;var n=Be(this,e,void 0);B.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ve(this),Re(n)&&this.Dt(n.cause),Qe()}},t.Dt=function(e){var t=this;if(this.Kt)this.Kt(e,this);else{if(B.disableErrorBoundaries)throw e;B.suppressReactionErrors||console.error(`[mobx] uncaught error in '`+this+`'`,e),B.globalReactionErrorHandlers.forEach((function(n){return n(e,t)}))}},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Ze(),Ve(this),Qe()))},t.Z=function(e){var t=this,n=function n(){t.dispose(),e==null||e.removeEventListener==null||e.removeEventListener(`abort`,n)};return e==null||e.addEventListener==null||e.addEventListener(`abort`,n),n[L]=this,`dispose`in Symbol&&typeof Symbol.dispose==`symbol`&&(n[Symbol.dispose]=n),n},t.toString=function(){return`Reaction[`+this.tt+`]`},t.trace=function(){},S(e,[{key:`isDisposed`,get:function(){return _(this.bt,e.Wt)},set:function(t){this.bt=v(this.bt,e.Wt,t)}},{key:`isScheduled`,get:function(){return _(this.bt,e.qt)},set:function(t){this.bt=v(this.bt,e.qt,t)}},{key:`isTrackPending`,get:function(){return _(this.bt,e.Gt)},set:function(t){this.bt=v(this.bt,e.Gt,t)}},{key:`isRunning`,get:function(){return _(this.bt,e.Ht)},set:function(t){this.bt=v(this.bt,e.Ht,t)}},{key:`diffValue`,get:function(){return+!!_(this.bt,e.wt)},set:function(t){this.bt=v(this.bt,e.wt,t===1)}}])}();Hn.Wt=1,Hn.qt=2,Hn.Gt=4,Hn.Ht=8,Hn.wt=16;var Un=function(e){return e()},Wn=f(`Reaction`,Hn),Gn=ce(`action`),Kn=ce(`action.bound`,{bound:!0}),qn=ce(`autoAction`,{autoAction:!0}),Jn=ce(`autoAction.bound`,{autoAction:!0,bound:!0}),Yn=it(!1);Object.assign(Yn,Gn);var Xn=it(!0);Object.assign(Xn,qn),Yn.bound=O(Kn),Xn.bound=O(Jn);var Zn=function(e){return e()},Qn=0,$n=function(e){function t(){var n;return n=e.call(this,`FLOW_CANCELLED`)||this,Object.setPrototypeOf(n,(this instanceof t?this.constructor:void 0).prototype),n.name=`FlowCancellationError`,n}return ee(t,e),t.prototype.toString=function(){return`Error: `+this.message},t}(D(Error)),er=pe(`flow`),tr=pe(`flow.bound`,{bound:!0}),nr=Object.assign((function(e,t){if(ie(t))return er.t(e,t);if(o(t))return re(e,t,er);var n=e,r=n.name||`<unnamed flow>`,i=function(){var e,t=this,i=arguments,o=++Qn,s=Yn(r+` - runid: `+o+` - init`,n).apply(t,i),c=void 0,l=new Promise((function(t,n){function i(e){var t;c=void 0;try{t=Yn(r+` - runid: `+o+` - yield `+ d++,s.next).call(s,e)}catch(e){return n(e)}u(t)}function l(e){var t;c=void 0;try{t=Yn(r+` - runid: `+o+` - yield `+ d++,s.throw).call(s,e)}catch(e){return n(e)}u(t)}function u(e){if(!a(e?.then))return e.done?t(e.value):(c=Promise.resolve(e.value)).then(i,l);e.then(u,n)}var d=0;e=n,i(void 0)}));return l.cancel=Yn(r+` - runid: `+o+` - cancel`,(function(){try{c&&ht(c);var t=s.return(void 0),n=Promise.resolve(t.value);n.then(I,I),ht(n),e(new $n)}catch(t){e(t)}})),l};return i.isMobXFlow=!0,i}),er);nr.bound=O(tr);var rr={has:function(e,t){return Dt(e).it(t)},get:function(e,t){return Dt(e).ct(t)},set:function(e,t,n){var r;return!!o(t)&&((r=Dt(e).ht(t,n,!0))==null||r)},deleteProperty:function(e,t){var n;return!!o(t)&&((n=Dt(e).Ut(t,!0))==null||n)},defineProperty:function(e,t,n){var r;return(r=Dt(e).l(t,n))==null||r},ownKeys:function(e){return Dt(e).rt()},preventExtensions:function(){t(13)}},ir=Symbol(`mobx-keys`),ar=`update`,or={get:function(e,t){var n=e[L];return t===L?n:t===`length`?n.Ft():typeof t!=`string`||isNaN(t)?g(cr,t)?cr[t]:e[t]:n.ct(parseInt(t))},set:function(e,t,n){var r=e[L];return t===`length`&&r.Xt(n),typeof t==`symbol`||isNaN(t)?e[t]=n:r.ht(parseInt(t),n),!0},preventExtensions:function(){t(15)}},sr=function(){function e(e,t,n,r){e===void 0&&(e=`ObservableArray`),this.zt=void 0,this.$t=void 0,this.st=void 0,this.j=[],this.et=void 0,this.ut=void 0,this.Jt=void 0,this.dehancer=void 0,this.v=void 0,this.Yt=0,this.zt=n,this.$t=r,this.st=new pn(e),this.Jt=function(e,n){return t(e,n,`ObservableArray[..]`)}}var n=e.prototype;return n.Qt=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.ft=function(e){return this.dehancer!==void 0&&e.length>0?e.map(this.dehancer):e},n.St=function(e){return kt(this,e)},n._t=function(e,t){return t===void 0&&(t=!1),t&&e({observableKind:`array`,object:this.v,debugObjectName:this.st.tt,type:`splice`,index:0,added:this.j.slice(),addedCount:this.j.length,removed:[],removedCount:0}),Mt(this,e)},n.Ft=function(){return this.st.reportObserved(),this.j.length},n.Xt=function(e){(typeof e!=`number`||isNaN(e)||e<0)&&t(`Out of range: `+e);var n=this.j.length;if(e!==n)if(e>n){for(var r=Array(e-n),i=0;i<e-n;i++)r[i]=void 0;this.ot(n,0,r)}else this.ot(e,n-e)},n.Zt=function(e,n){e!==this.Yt&&t(16),this.Yt+=n,this.$t&&n>0&&Wt(e+n+1)},n.ot=function(e,t,n){var r=this,i=this.j.length;if(e===void 0?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=arguments.length===1?i-e:t==null?0:Math.max(0,Math.min(t,i-e)),n===void 0&&(n=an),Ot(this)){var a=At(this,{object:this.v,type:`splice`,index:e,removedCount:t,added:n});if(!a)return an;t=a.removedCount,n=a.added}if(n=n.length===0?n:n.map((function(e){return r.Jt(e,void 0)})),this.$t){var o=n.length-t;this.Zt(i,o)}var s=this.tn(e,t,n);return t===0&&n.length===0||this.nn(e,n,s),this.ft(s)},n.tn=function(e,t,n){var r;if(n.length<1e4)return(r=this.j).splice.apply(r,[e,t].concat(n));var i=this.j.slice(e,e+t),a=this.j.slice(e+t);this.j.length+=n.length-t;for(var o=0;o<n.length;o++)this.j[e+o]=n[o];for(var s=0;s<a.length;s++)this.j[e+n.length+s]=a[s];return i},n.in=function(e,t,n){var r=!this.zt&&!1,i=jt(this),a=i||r?{observableKind:`array`,object:this.v,type:ar,debugObjectName:this.st.tt,index:e,newValue:t,oldValue:n}:null;this.st.reportChanged(),i&&Nt(this,a)},n.nn=function(e,t,n){var r=!this.zt&&!1,i=jt(this),a=i||r?{observableKind:`array`,object:this.v,debugObjectName:this.st.tt,type:`splice`,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.st.reportChanged(),i&&Nt(this,a)},n.ct=function(e){if(!(this.$t&&e>=this.j.length))return this.st.reportObserved(),this.Qt(this.j[e]);console.warn(`[mobx] Out of bounds read: `+e)},n.ht=function(e,n){var r=this.j;if(this.$t&&e>r.length&&t(17,e,r.length),e<r.length){var i=r[e];if(Ot(this)){var a=At(this,{type:ar,object:this.v,index:e,newValue:n});if(!a)return;n=a.newValue}(n=this.Jt(n,i))!==i&&(r[e]=n,this.in(e,n,i))}else{for(var o=Array(e+1-r.length),s=0;s<o.length-1;s++)o[s]=void 0;o[o.length-1]=n,this.ot(r.length,0,o)}},e}(),cr={clear:function(){return this.splice(0)},replace:function(e){var t=this[L];return t.ot(0,t.j.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){var n=[...arguments].slice(2),r=this[L];switch(arguments.length){case 0:return[];case 1:return r.ot(e);case 2:return r.ot(e,t)}return r.ot(e,t,n)},spliceWithArray:function(e,t,n){return this[L].ot(e,t,n)},push:function(){for(var e=this[L],t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.ot(e.j.length,0,n),e.j.length},pop:function(){return this.splice(Math.max(this[L].j.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var e=this[L],t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.ot(0,0,n),e.j.length},reverse:function(){return B.trackingDerivation&&t(37,`reverse`),this.replace(this.slice().reverse()),this},sort:function(){B.trackingDerivation&&t(37,`sort`);var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[L],n=t.ft(t.j).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};j(`at`,Ft),j(`concat`,Ft),j(`flat`,Ft),j(`includes`,Ft),j(`indexOf`,Ft),j(`join`,Ft),j(`lastIndexOf`,Ft),j(`slice`,Ft),j(`toString`,Ft),j(`toLocaleString`,Ft),j(`toSorted`,Ft),j(`toSpliced`,Ft),j(`with`,Ft),j(`every`,M),j(`filter`,M),j(`find`,M),j(`findIndex`,M),j(`findLast`,M),j(`findLastIndex`,M),j(`flatMap`,M),j(`forEach`,M),j(`map`,M),j(`some`,M),j(`toReversed`,M),j(`reduce`,It),j(`reduceRight`,It);var lr,ur,dr=f(`ObservableArrayAdministration`,sr),fr={},pr=`add`,mr=function(){function e(e,n,r){var i=this;n===void 0&&(n=oe),r===void 0&&(r=`ObservableMap`),this.Jt=void 0,this.tt=void 0,this[L]=fr,this.vt=void 0,this.dt=void 0,this.lt=void 0,this.et=void 0,this.ut=void 0,this.dehancer=void 0,this.Jt=n,this.tt=r,a(Map)||t(18),Yt((function(){i.lt=ae(`ObservableMap.keys()`),i.vt=new Map,i.dt=new Map,e&&i.merge(e)}))}var n=e.prototype;return n.it=function(e){return this.vt.has(e)},n.has=function(e){var t=this;if(!B.trackingDerivation)return this.it(e);var n=this.dt.get(e);if(!n){var r=n=new Mn(this.it(e),se,`ObservableMap.key?`,!1);this.dt.set(e,r),ut(r,(function(){return t.dt.delete(e)}))}return n.get()},n.set=function(e,t){var n=this.it(e);if(Ot(this)){var r=At(this,{type:n?ar:pr,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.rn(e,t):this.en(e,t),this},n.delete=function(e){var t=this;if(Ot(this)&&!At(this,{type:`delete`,object:this,name:e}))return!1;if(this.it(e)){var n=jt(this),r=n?{observableKind:`map`,debugObjectName:this.tt,type:`delete`,object:this,oldValue:this.vt.get(e).Ot,name:e}:null;return wt((function(){var n;t.lt.reportChanged(),(n=t.dt.get(e))==null||n.gt(!1),t.vt.get(e).gt(void 0),t.vt.delete(e)})),n&&Nt(this,r),!0}return!1},n.rn=function(e,t){var n=this.vt.get(e);if((t=n.xt(t))!==B.UNCHANGED){var r=jt(this),i=r?{observableKind:`map`,debugObjectName:this.tt,type:ar,object:this,oldValue:n.Ot,name:e,newValue:t}:null;n.gt(t),r&&Nt(this,i)}},n.en=function(e,t){var n=this;wt((function(){var r,i=new Mn(t,n.Jt,`ObservableMap.key`,!1);n.vt.set(e,i),t=i.Ot,(r=n.dt.get(e))==null||r.gt(!0),n.lt.reportChanged()}));var r=jt(this);r&&Nt(this,r?{observableKind:`map`,debugObjectName:this.tt,type:pr,object:this,name:e,newValue:t}:null)},n.get=function(e){return this.has(e)?this.Qt(this.vt.get(e).get()):this.Qt(void 0)},n.Qt=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.keys=function(){return this.lt.reportObserved(),this.vt.keys()},n.values=function(){var e=this,t=this.keys();return Rt({next:function(){var n=t.next(),r=n.done;return{done:r,value:r?void 0:e.get(n.value)}}})},n.entries=function(){var e=this,t=this.keys();return Rt({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},n[Symbol.iterator]=function(){return this.entries()},n.forEach=function(e,t){for(var n,r=C(this);!(n=r()).done;){var i=n.value;e.call(t,i[1],i[0],this)}},n.merge=function(e){var n=this;return hr(e)&&(e=new Map(e)),wt((function(){var r,i;c(e)?function(e){var t=Object.keys(e);if(!ln)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter((function(t){return rn.propertyIsEnumerable.call(e,t)}))):t}(e).forEach((function(t){return n.set(t,e[t])})):Array.isArray(e)?e.forEach((function(e){return n.set(e[0],e[1])})):p(e)?(r=Object.getPrototypeOf(e),i=Object.getPrototypeOf(r),Object.getPrototypeOf(i)!==null&&t(19,e),e.forEach((function(e,t){return n.set(t,e)}))):e!=null&&t(20,e)})),this},n.clear=function(){var e=this;wt((function(){He((function(){for(var t,n=C(e.keys());!(t=n()).done;)e.delete(t.value)}))}))},n.replace=function(e){var n=this;return wt((function(){for(var r,i=function(e){if(p(e)||hr(e))return e;if(Array.isArray(e))return new Map(e);if(c(e)){var n=new Map;for(var r in e)n.set(r,e[r]);return n}return t(21,e)}(e),a=new Map,o=!1,s=C(n.vt.keys());!(r=s()).done;){var l=r.value;if(!i.has(l))if(n.delete(l))o=!0;else{var u=n.vt.get(l);a.set(l,u)}}for(var d,f=C(i.entries());!(d=f()).done;){var m=d.value,h=m[0],g=m[1],_=n.vt.has(h);if(n.set(h,g),n.vt.has(h)){var v=n.vt.get(h);a.set(h,v),_||(o=!0)}}if(!o)if(n.vt.size!==a.size)n.lt.reportChanged();else for(var y=n.vt.keys(),b=a.keys(),x=y.next(),S=b.next();!x.done;){if(x.value!==S.value){n.lt.reportChanged();break}x=y.next(),S=b.next()}n.vt=a})),this},n.toString=function(){return`[object ObservableMap]`},n.toJSON=function(){return Array.from(this)},n._t=function(e){return Mt(this,e)},n.St=function(e){return kt(this,e)},S(e,[{key:`size`,get:function(){return this.lt.reportObserved(),this.vt.size}},{key:Symbol.toStringTag,get:function(){return`Map`}}])}(),hr=f(`ObservableMap`,mr),gr={},_r=function(){function e(e,n,r){var i=this;n===void 0&&(n=oe),r===void 0&&(r=`ObservableSet`),this.tt=void 0,this[L]=gr,this.vt=new Set,this.st=void 0,this.ut=void 0,this.et=void 0,this.dehancer=void 0,this.Jt=void 0,this.tt=r,a(Set)||t(22),this.Jt=function(e,t){return n(e,t,r)},Yt((function(){i.st=ae(i.tt),e&&i.replace(e)}))}var n=e.prototype;return n.Qt=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.clear=function(){var e=this;wt((function(){He((function(){for(var t,n=C(e.vt.values());!(t=n()).done;)e.delete(t.value)}))}))},n.forEach=function(e,t){for(var n,r=C(this);!(n=r()).done;){var i=n.value;e.call(t,i,i,this)}},n.add=function(e){var t=this;if(Ot(this)){var n=At(this,{type:pr,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){wt((function(){t.vt.add(t.Jt(e,void 0)),t.st.reportChanged()}));var r=jt(this);r&&Nt(this,r?{observableKind:`set`,debugObjectName:this.tt,type:pr,object:this,newValue:e}:null)}return this},n.delete=function(e){var t=this;if(Ot(this)&&!At(this,{type:`delete`,object:this,oldValue:e}))return!1;if(this.has(e)){var n=jt(this),r=n?{observableKind:`set`,debugObjectName:this.tt,type:`delete`,object:this,oldValue:e}:null;return wt((function(){t.st.reportChanged(),t.vt.delete(e)})),n&&Nt(this,r),!0}return!1},n.has=function(e){return this.st.reportObserved(),this.vt.has(this.Qt(e))},n.entries=function(){var e=this.values();return N({next:function(){var t=e.next(),n=t.value,r=t.done;return r?{value:void 0,done:r}:{value:[n,n],done:r}}})},n.keys=function(){return this.values()},n.values=function(){this.st.reportObserved();var e=this,t=this.vt.values();return N({next:function(){var n=t.next(),r=n.done;return r?{value:void 0,done:r}:{value:e.Qt(n.value),done:r}}})},n.intersection=function(e){return m(e)&&!vr(e)?e.intersection(this):new Set(this).intersection(e)},n.union=function(e){return m(e)&&!vr(e)?e.union(this):new Set(this).union(e)},n.difference=function(e){return new Set(this).difference(e)},n.symmetricDifference=function(e){return m(e)&&!vr(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},n.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},n.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},n.isDisjointFrom=function(e){return m(e)&&!vr(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},n.replace=function(e){var n=this;return vr(e)&&(e=new Set(e)),wt((function(){Array.isArray(e)||m(e)?(n.clear(),e.forEach((function(e){return n.add(e)}))):e!=null&&t(`Cannot initialize set from `+e)})),this},n._t=function(e){return Mt(this,e)},n.St=function(e){return kt(this,e)},n.toJSON=function(){return Array.from(this)},n.toString=function(){return`[object ObservableSet]`},n[Symbol.iterator]=function(){return this.values()},S(e,[{key:`size`,get:function(){return this.st.reportObserved(),this.vt.size}},{key:Symbol.toStringTag,get:function(){return`Set`}}])}(),vr=f(`ObservableSet`,_r),yr=Object.create(null),br=function(){function e(e,t,n,r){t===void 0&&(t=new Map),r===void 0&&(r=_n),this.h=void 0,this.j=void 0,this.tt=void 0,this.un=void 0,this.lt=void 0,this.ut=void 0,this.et=void 0,this.v=void 0,this.p=void 0,this.on=void 0,this.sn=void 0,this.h=e,this.j=t,this.tt=n,this.un=r,this.lt=new pn(`ObservableObject.keys`),this.p=c(this.h)}var n=e.prototype;return n.O=function(e){return this.j.get(e).get()},n.S=function(e,t){var n=this.j.get(e);if(n instanceof Pn)return n.set(t),!0;if(Ot(this)){var r=At(this,{type:ar,object:this.v||this.h,name:e,newValue:t});if(!r)return null;t=r.newValue}if((t=n.xt(t))!==B.UNCHANGED){var i=jt(this),a=i?{type:ar,observableKind:`object`,debugObjectName:this.tt,object:this.v||this.h,oldValue:n.Ot,name:e,newValue:t}:null;n.gt(t),i&&Nt(this,a)}return!0},n.ct=function(e){return B.trackingDerivation&&!g(this.h,e)&&this.it(e),this.h[e]},n.ht=function(e,t,n){return n===void 0&&(n=!1),g(this.h,e)?this.j.has(e)?this.S(e,t):n?Reflect.set(this.h,e,t):(this.h[e]=t,!0):this.s(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.un,n)},n.it=function(e){if(!B.trackingDerivation)return e in this.h;this.sn||=new Map;var t=this.sn.get(e);return t||(t=new Mn(e in this.h,se,`ObservableObject.key?`,!1),this.sn.set(e,t)),t.get()},n.o=function(e,n){if(!0===n&&(n=this.un),!1!==n){if(!(e in this.h)){var r;if((r=this.h[fn])!=null&&r[e])return;t(1,n.i,this.tt+`.`+e.toString())}for(var i=this.h;i&&i!==rn;){var a=tn(i,e);if(a){var o=n.o(this,e,a,i);if(o===0)return;if(o===1)break}i=Object.getPrototypeOf(i)}Vt(this,0,e)}},n.s=function(e,t,n,r){if(r===void 0&&(r=!1),!0===n&&(n=this.un),!1===n)return this.l(e,t,r);var i=n.s(this,e,t,r);return i&&Vt(this,0,e),i},n.l=function(e,t,n){n===void 0&&(n=!1);try{Ze();var r=this.Ut(e);if(!r)return r;if(Ot(this)){var i=At(this,{object:this.v||this.h,name:e,type:pr,newValue:t.value});if(!i)return null;var a=i.newValue;t.value!==a&&(t=w({},t,{value:a}))}if(n){if(!Reflect.defineProperty(this.h,e,t))return!1}else nn(this.h,e,t);this.fn(e,t.value)}finally{Qe()}return!0},n.g=function(e,t,n,r){r===void 0&&(r=!1);try{Ze();var i=this.Ut(e);if(!i)return i;if(Ot(this)){var a=At(this,{object:this.v||this.h,name:e,type:pr,newValue:t});if(!a)return null;t=a.newValue}var o=Bt(e),s={configurable:!B.safeDescriptors||this.p,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.h,e,s))return!1}else nn(this.h,e,s);var c=new Mn(t,n,`ObservableObject.key`,!1);this.j.set(e,c),this.fn(e,c.Ot)}finally{Qe()}return!0},n.m=function(e,t,n){n===void 0&&(n=!1);try{Ze();var r=this.Ut(e);if(!r)return r;if(Ot(this)&&!At(this,{object:this.v||this.h,name:e,type:pr,newValue:void 0}))return null;t.name||=`ObservableObject.key`,t.context=this.v||this.h;var i=Bt(e),a={configurable:!B.safeDescriptors||this.p,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.h,e,a))return!1}else nn(this.h,e,a);this.j.set(e,new Pn(t)),this.fn(e,void 0)}finally{Qe()}return!0},n.Ut=function(e,t){if(t===void 0&&(t=!1),!g(this.h,e))return!0;if(Ot(this)&&!At(this,{object:this.v||this.h,name:e,type:`remove`}))return null;try{var n;Ze();var r=jt(this),i=this.j.get(e),a=void 0;if(!i&&r&&(a=tn(this.h,e)?.value),t){if(!Reflect.deleteProperty(this.h,e))return!1}else delete this.h[e];i&&(this.j.delete(e),i instanceof Mn&&(a=i.Ot),et(i)),this.lt.reportChanged(),(n=this.sn)==null||(n=n.get(e))==null||n.set(e in this.h),r&&r&&Nt(this,{type:`remove`,observableKind:`object`,object:this.v||this.h,debugObjectName:this.tt,oldValue:a,name:e})}finally{Qe()}return!0},n._t=function(e){return Mt(this,e)},n.St=function(e){return kt(this,e)},n.fn=function(e,t){var n,r=jt(this);r&&r&&Nt(this,r?{type:pr,observableKind:`object`,debugObjectName:this.tt,object:this.v||this.h,name:e,newValue:t}:null),(n=this.sn)==null||(n=n.get(e))==null||n.set(!0),this.lt.reportChanged()},n.rt=function(){return this.lt.reportObserved(),un(this.h)},n.nt=function(){return this.lt.reportObserved(),Object.keys(this.h)},e}(),xr=f(`ObservableObjectAdministration`,br),Sr=Ht(0),Cr=function(){var e=!1,t={};return Object.defineProperty(t,`0`,{set:function(){e=!0}}),Object.create(t)[0]=1,!1===e}(),wr=0,Tr=function(){};lr=Tr,ur=Array.prototype,Object.setPrototypeOf?Object.setPrototypeOf(lr.prototype,ur):lr.prototype.__proto__===void 0?lr.prototype=ur:lr.prototype.__proto__=ur;var Er=function(e){function t(t,n,r,i){var a;return r===void 0&&(r=`ObservableArray`),i===void 0&&(i=!1),a=e.call(this)||this,Yt((function(){var e=new sr(r,n,i,!0);e.v=a,d(a,L,e),t&&t.length&&a.spliceWithArray(0,0,t),Cr&&Object.defineProperty(a,`0`,Sr)})),a}ee(t,e);var n=t.prototype;return n.concat=function(){this[L].st.reportObserved();var e=[...arguments];return Array.prototype.concat.apply(this.slice(),e.map((function(e){return Lt(e)?e.slice():e})))},n[Symbol.iterator]=function(){var e=this,t=0;return Qt({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},S(t,[{key:`length`,get:function(){return this[L].Ft()},set:function(e){this[L].Xt(e)}},{key:Symbol.toStringTag,get:function(){return`Array`}}])}(Tr);Object.entries(cr).forEach((function(e){var t=e[0];t!==`concat`&&u(Er.prototype,t,e[1])})),Wt(1e3);var Dr=rn.toString,Or=n().Iterator?.prototype||{};[`Symbol`,`Map`,`Set`].forEach((function(e){n()[e]===void 0&&t(`MobX requires global '`+e+`' to be available or polyfilled`)})),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__==`object`&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:rt,extras:{getDebugName:Jt},$mobx:L}),e.$mobx=L,e.FlowCancellationError=$n,e.ObservableMap=mr,e.ObservableSet=_r,e.Reaction=Hn,e._allowStateChanges=Fe,e._allowStateChangesInsideComputed=at,e._allowStateReadsEnd=Ke,e._allowStateReadsStart=Ge,e._autoAction=Xn,e._endAction=Pe,e._getAdministration=qt,e._getGlobalState=function(){return B},e._interceptReads=function(e,t,n){var r;return hr(e)||Lt(e)||Nn(e)?r=qt(e):P(e)&&(r=qt(e,t)),r.dehancer=typeof t==`function`?t:n,function(){r.dehancer=void 0}},e._isComputingDerivation=function(){return B.trackingDerivation!==null},e._resetGlobalState=function(){var e=new zn;for(var t in e)Rn.indexOf(t)===-1&&(B[t]=e[t]);B.allowStateChanges=!B.enforceActions},e._startAction=Ne,e.action=Yn,e.autorun=st,e.comparer=hn,e.computed=Dn,e.configure=function(e){!0===e.isolateGlobalState&&function(){if((B.pendingReactions.length||B.inBatch||B.isRunningReactions)&&t(36),Vn=!0,Bn){var e=n();--e.__mobxInstanceCount==0&&(e.__mobxGlobals=void 0),B=new zn}}();var r,i,a=e.useProxies,o=e.enforceActions;if(a!==void 0&&(B.useProxies=a===`always`||a!==`never`&&typeof Proxy<`u`),a===`ifavailable`&&(B.verifyProxies=!0),o!==void 0){var s=o===`always`?`always`:o===`observed`;B.enforceActions=s,B.allowStateChanges=!0!==s&&s!==`always`}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach((function(t){t in e&&(B[t]=!!e[t])})),B.allowStateReads=!B.observableRequiresReaction,e.reactionScheduler&&(r=e.reactionScheduler,i=Un,Un=function(e){return r((function(){return i(e)}))})},e.createAtom=ae,e.defineProperty=function(e,n,r){if(P(e))return e[L].l(n,r);t(39)},e.entries=function(e){return P(e)?bt(e).map((function(t){return[t,e[t]]})):hr(e)?bt(e).map((function(t){return[t,e.get(t)]})):vr(e)?Array.from(e.entries()):Lt(e)?e.map((function(e,t){return[t,e]})):void t(7)},e.extendObservable=ft,e.flow=nr,e.flowResult=function(e){return e},e.get=function(e,n){if(xt(e,n))return P(e)?e[L].ct(n):hr(e)?e.get(n):Lt(e)?e[n]:void t(11)},e.getAtom=Kt,e.getDebugName=Jt,e.getDependencyTree=function(e,t){return pt(Kt(e,t))},e.getObserverTree=function(e,t){return mt(Kt(e,t))},e.has=xt,e.intercept=function(e,t,n){return a(n)?function(e,t,n){return qt(e,t).St(n)}(e,t,n):function(e,t){return qt(e).St(t)}(e,t)},e.isAction=ot,e.isBoxedObservable=Nn,e.isComputed=function(e){return _t(e)},e.isComputedProp=function(e,t){return _t(e,t)},e.isFlow=gt,e.isFlowCancellationError=function(e){return e instanceof $n},e.isObservable=yt,e.isObservableArray=Lt,e.isObservableMap=hr,e.isObservableObject=P,e.isObservableProp=function(e,t){return vt(e,t)},e.isObservableSet=vr,e.keys=bt,e.makeAutoObservable=function(e,t,n){return c(e)?ft(e,e,t,n):(Yt((function(){var r=zt(e,n)[L];if(!e[ir]){var i=Object.getPrototypeOf(e),a=new Set([].concat(un(e),un(i)));a.delete(`constructor`),a.delete(L),u(i,ir,a)}e[ir].forEach((function(e){return r.o(e,!t||!(e in t)||t[e])}))})),e)},e.makeObservable=function(e,t,n){return Yt((function(){var r=zt(e,n)[L];t??=function(e){return g(e,fn)||u(e,fn,w({},e[fn])),e[fn]}(e),un(t).forEach((function(e){return r.o(e,t[e])}))})),e},e.observable=wn,e.observe=function(e,t,n,r){return a(n)?function(e,t,n,r){return qt(e,t)._t(n,r)}(e,t,n,r):function(e,t,n){return qt(e)._t(t,n)}(e,t,n)},e.onBecomeObserved=lt,e.onBecomeUnobserved=ut,e.onReactionError=function(e){return B.globalReactionErrorHandlers.push(e),function(){var t=B.globalReactionErrorHandlers.indexOf(e);t>=0&&B.globalReactionErrorHandlers.splice(t,1)}},e.override=gn,e.ownKeys=St,e.reaction=function(e,t,n){function r(){if(p=!1,!h.isDisposed){var t=!1,r=s;h.track((function(){var n=Fe(!1,(function(){return e(h)}));t=f||!m(s,n),s=n})),(f&&n.fireImmediately||!f&&t)&&l(s,r,h),f=!1}}var i;n===void 0&&(n=on);var a,o,s,c=n.name??`Reaction`,l=Yn(c,n.onError?(a=n.onError,o=t,function(){try{return o.apply(this,arguments)}catch(e){a.call(this,e)}}):t),u=!n.scheduler&&!n.delay,d=ct(n),f=!0,p=!1,m=n.compareStructural?hn.structural:n.equals||hn.default,h=new Hn(c,(function(){f||u?r():p||(p=!0,d(r))}),n.onError,n.requiresObservable);return(i=n)!=null&&(i=i.signal)!=null&&i.aborted||h.Y(),h.Z(n?.signal)},e.remove=function(e,n){P(e)?e[L].Ut(n):hr(e)||vr(e)?e.delete(n):Lt(e)?(typeof n!=`number`&&(n=parseInt(n,10)),e.splice(n,1)):t(9)},e.runInAction=at,e.set=function e(n,r,i){if(arguments.length!==2||vr(n))P(n)?n[L].ht(r,i):hr(n)?n.set(r,i):vr(n)?n.add(r):Lt(n)?(typeof r!=`number`&&(r=parseInt(r,10)),r<0&&t(`Invalid index: '`+r+`'`),Ze(),r>=n.length&&(n.length=r+1),n[r]=i,Qe()):t(8);else{Ze();var a=r;try{for(var o in a)e(n,o,a[o])}finally{Qe()}}},e.spy=rt,e.toJS=function(e){return function e(t,n){if(typeof t!=`object`||!t||t instanceof Date||!yt(t))return t;if(Nn(t)||In(t))return e(t.get(),n);if(n.has(t))return n.get(t);if(Lt(t)){var r=Ct(n,t,Array(t.length));return t.forEach((function(t,i){r[i]=e(t,n)})),r}if(vr(t)){var i=Ct(n,t,new Set);return t.forEach((function(t){i.add(e(t,n))})),i}if(hr(t)){var a=Ct(n,t,new Map);return t.forEach((function(t,r){a.set(r,e(t,n))})),a}var o=Ct(n,t,{});return St(t).forEach((function(r){rn.propertyIsEnumerable.call(t,r)&&(o[r]=e(t[r],n))})),o}(e,new Map)},e.trace=function(){},e.transaction=wt,e.untracked=He,e.values=function(e){return P(e)?bt(e).map((function(t){return e[t]})):hr(e)?bt(e).map((function(t){return e.get(t)})):vr(e)?Array.from(e.values()):Lt(e)?e.slice():void t(6)},e.when=function(e,t,n){return arguments.length===1||t&&typeof t==`object`?Et(e,t):Tt(e,t,n||{})}})),Cv=me((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var t={0:`Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'`,1:function(e,t){return`Cannot apply '`+e+`' to '`+t.toString()+`': Field not found.`},5:`'keys()' can only be used on observable objects, arrays, sets and maps`,6:`'values()' can only be used on observable objects, arrays, sets and maps`,7:`'entries()' can only be used on observable objects, arrays and maps`,8:`'set()' can only be used on observable objects, arrays and maps`,9:`'remove()' can only be used on observable objects, arrays and maps`,10:`'has()' can only be used on observable objects, arrays and maps`,11:`'get()' can only be used on observable objects, arrays and maps`,12:`Invalid annotation`,13:`Dynamic observable objects cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)`,14:`Intercept handlers should return nothing or a change object`,15:`Observable arrays cannot be frozen. If you're passing observables to 3rd party component/function that calls Object.freeze, pass copy instead: toJS(observable)`,16:`Modification exception: the internal structure of an observable array was changed.`,17:function(e,t){return`[mobx.array] Index out of bounds, `+e+` is larger than `+t},18:`mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js`,19:function(e){return`Cannot initialize from classes that inherit from Map: `+e.constructor.name},20:function(e){return`Cannot initialize map from `+e},21:function(e){return`Cannot convert to map from '`+e+`'`},22:`mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js`,23:`It is not possible to get index atoms from arrays`,24:function(e){return`Cannot obtain administration from `+e},25:function(e,t){return`the entry '`+e+`' does not exist in the observable map '`+t+`'`},26:`please specify a property`,27:function(e,t){return`no observable property '`+e.toString()+`' found on the observable object '`+t+`'`},28:function(e){return`Cannot obtain atom from `+e},29:`Expecting some object`,30:`invalid action stack. did you forget to finish an action?`,31:`missing option for computed: get`,32:function(e,t){return`Cycle detected in computation `+e+`: `+t},33:function(e){return`The setter of computed value '`+e+`' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?`},34:function(e){return`[ComputedValue '`+e+`'] It is not possible to assign a new value to a computed value.`},35:"There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`",36:`isolateGlobalState should be called before MobX is running any reactions`,37:function(e){return"[mobx] `observableArray."+e+"()` mutates the array in-place, which is not allowed inside a derivation. Use `array.slice()."+e+"()` instead"},38:`'ownKeys()' can only be used on observable objects`,39:`'defineProperty()' can only be used on observable objects`};function n(e){var n=[...arguments].slice(1),r=typeof e==`string`?e:t[e];throw typeof r==`function`&&(r=r.apply(null,n)),Error(`[MobX] `+r)}var r={};function i(){return typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:r}var a=Object.assign,o=Object.getOwnPropertyDescriptor,s=Object.defineProperty,c=Object.prototype,l=[];Object.freeze(l);var u={};Object.freeze(u);var d=typeof Proxy<`u`,f=Object.toString();function p(){d||n("`Proxy` objects are not available in the current environment. Please configure MobX to enable a fallback implementation.`")}function m(e){R.verifyProxies&&n(`MobX is currently configured to be able to run in ES5 mode, but in ES5 MobX won't be able to `+e)}function h(){return++R.mobxGuid}function g(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var _=function(){};function v(e){return typeof e==`function`}function y(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function b(e){return typeof e==`object`&&!!e}function x(e){if(!b(e))return!1;var t=Object.getPrototypeOf(e);if(t==null)return!0;var n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n.toString()===f}function S(e){var t=e?.constructor;return t?t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`:!1}function C(e,t,n){s(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function w(e,t,n){s(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function T(e,t){var n=`isMobX`+e;return t.prototype[n]=!0,function(e){return b(e)&&e[n]===!0}}function ee(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function te(e){return Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(e)))===null}function E(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}var ne=Object.getOwnPropertySymbols!==void 0;function D(e){var t=Object.keys(e);if(!ne)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(t){return c.propertyIsEnumerable.call(e,t)})):t}var O=typeof Reflect<`u`&&Reflect.ownKeys?Reflect.ownKeys:ne?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function re(e){return typeof e==`string`?e:typeof e==`symbol`?e.toString():new String(e).toString()}function ie(e){return e===null?null:typeof e==`object`?``+e:e}function ae(e,t){return c.hasOwnProperty.call(e,t)}var oe=Object.getOwnPropertyDescriptors||function(e){var t={};return O(e).forEach(function(n){t[n]=o(e,n)}),t};function se(e,t){return!!(e&t)}function ce(e,t,n){return n?e|=t:e&=~t,e}function le(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ue(e,t,n){if(_e())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var i=new(e.bind.apply(e,r));return n&&ve(i,n.prototype),i}function de(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,be(r.key),r)}}function fe(e,t,n){return t&&de(e.prototype,t),n&&de(e,n),Object.defineProperty(e,`prototype`,{writable:!1}),e}function pe(e,t){var n=typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=xe(e))||t&&e&&typeof e.length==`number`){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw TypeError(`Invalid attempt to iterate non-iterable instance.
57
57
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function me(){return me=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},me.apply(null,arguments)}function he(e){return he=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},he(e)}function ge(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ve(e,t)}function k(e){try{return Function.toString.call(e).indexOf(`[native code]`)!==-1}catch{return typeof e==`function`}}function _e(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_e=function(){return!!e})()}function ve(e,t){return ve=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},ve(e,t)}function ye(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function be(e){var t=ye(e,`string`);return typeof t==`symbol`?t:t+``}function xe(e,t){if(e){if(typeof e==`string`)return le(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?le(e,t):void 0}}function Se(e){var t=typeof Map==`function`?new Map:void 0;return Se=function(e){if(e===null||!k(e))return e;if(typeof e!=`function`)throw TypeError(`Super expression must either be null or a function`);if(t!==void 0){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return ue(e,arguments,he(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ve(n,e)},Se(e)}var Ce=Symbol(`mobx-stored-annotations`);function we(e){function t(t,n){if(Oe(n))return e.decorate_20223_(t,n);Te(t,n,e)}return Object.assign(t,e)}function Te(e,t,r){ae(e,Ce)||C(e,Ce,me({},e[Ce])),We(r)&&!ae(e[Ce],t)&&n(`'`+(e.constructor.name+`.prototype.`+t.toString())+`' is decorated with 'override', but no such decorated member was found on prototype.`),Ee(e,r,t),We(r)||(e[Ce][t]=r)}function Ee(e,t,r){if(!We(t)&&ae(e[Ce],r)){var i=e.constructor.name+`.prototype.`+r.toString(),a=e[Ce][r].annotationType_,o=t.annotationType_;n(`Cannot apply '@`+o+`' to '`+i+`':`+(`
58
58
  The field is already decorated with '@`+a+`'.`)+`
59
59
  Re-decorating fields is not allowed.
60
- Use '@override' decorator for methods overridden by subclass.`)}}function De(e){return ae(e,Ce)||C(e,Ce,me({},e[Ce])),e[Ce]}function Oe(e){return typeof e==`object`&&typeof e.kind==`string`}function ke(e,t){t.includes(e.kind)||n(`The decorator applied to '`+String(e.name)+`' cannot be used on a `+e.kind+` element`)}var A=Symbol(`mobx administration`),Ae=function(){function e(e){e===void 0&&(e=`Atom@`+h()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=N.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return Nn(this)},t.reportChanged=function(){jn(),Pn(this),Mn()},t.toString=function(){return this.name_},fe(e,[{key:`isBeingObserved`,get:function(){return se(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ce(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return se(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ce(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!se(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=ce(this.flags_,e.diffValueMask_,t===1)}}])}();Ae.isBeingObservedMask_=1,Ae.isPendingUnobservationMask_=2,Ae.diffValueMask_=4;var je=T(`Atom`,Ae);function Me(e,t,n){t===void 0&&(t=_),n===void 0&&(n=_);var r=new Ae(e);return t!==_&&vr(r,t),n!==_&&yr(r,n),r}function Ne(e,t){return e===t}function Pe(e,t){return ya(e,t)}function Fe(e,t){return ya(e,t,1)}function Ie(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Le={identity:Ne,structural:Pe,default:Ie,shallow:Fe};function Re(e,t,n){return qr(e)?e:Array.isArray(e)?M.array(e,{name:n}):x(e)?M.object(e,void 0,{name:n}):ee(e)?M.map(e,{name:n}):E(e)?M.set(e,{name:n}):typeof e==`function`&&!ur(e)&&!zr(e)?S(e)?Ir(e):cr(n,e):e}function ze(e,t,r){if(e==null||ta(e)||Li(e)||Hi(e)||qi(e))return e;if(Array.isArray(e))return M.array(e,{name:r,deep:!1});if(x(e))return M.object(e,void 0,{name:r,deep:!1});if(ee(e))return M.map(e,{name:r,deep:!1});if(E(e))return M.set(e,{name:r,deep:!1});n(`The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets`)}function Be(e){return e}function Ve(e,t){return qr(e)&&n(`observable.struct should not be used with observable values`),ya(e,t)?t:e}var He=`override`,Ue=we({annotationType_:He,make_:Ge,extend_:Ke,decorate_20223_:qe});function We(e){return e.annotationType_===He}function Ge(e,t){return e.isPlainObject_&&n(`Cannot apply '`+this.annotationType_+`' to '`+e.name_+`.`+t.toString()+`':`+(`
61
- '`+this.annotationType_+`' cannot be used on plain objects.`)),ae(e.appliedAnnotations_,t)||n(`'`+e.name_+`.`+t.toString()+`' is annotated with '`+this.annotationType_+`', but no such annotated member was found on prototype.`),0}function Ke(e,t,r,i){n(`'`+this.annotationType_+`' can only be used with 'makeObservable'`)}function qe(e,t){console.warn(`'`+this.annotationType_+`' cannot be used with decorators - this is a no-op`)}function Je(e,t){return{annotationType_:e,options_:t,make_:Ye,extend_:Xe,decorate_20223_:Ze}}function Ye(e,t,n,r){var i;return(i=this.options_)!=null&&i.bound?this.extend_(e,t,n,!1)===null?0:1:r===e.target_?this.extend_(e,t,n,!1)===null?0:2:ur(n.value)?1:(s(r,t,$e(e,this,t,n,!1)),2)}function Xe(e,t,n,r){var i=$e(e,this,t,n);return e.defineProperty_(t,i,r)}function Ze(e,t){ke(t,[`method`,`field`]);var r=t.kind,i=t.name,a=t.addInitializer,o=this,s=function(e){return Gt(o.options_?.name??i.toString(),e,o.options_?.autoAction??!1)};if(r==`field`)return function(e){var t,n=e;return ur(n)||(n=s(n)),(t=o.options_)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n};if(r==`method`){var c;return ur(e)||(e=s(e)),(c=this.options_)!=null&&c.bound&&a(function(){var e=this,t=e[i].bind(e);t.isMobxAction=!0,e[i]=t}),e}n(`Cannot apply '`+o.annotationType_+`' to '`+String(i)+`' (kind: `+r+`):`+(`
60
+ Use '@override' decorator for methods overridden by subclass.`)}}function De(e){return ae(e,Ce)||C(e,Ce,me({},e[Ce])),e[Ce]}function Oe(e){return typeof e==`object`&&typeof e.kind==`string`}function ke(e,t){t.includes(e.kind)||n(`The decorator applied to '`+String(e.name)+`' cannot be used on a `+e.kind+` element`)}var A=Symbol(`mobx administration`),Ae=function(){function e(e){e===void 0&&(e=`Atom@`+h()),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=F.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.reportObserved=function(){return jn(this)},t.reportChanged=function(){kn(),Mn(this),An()},t.toString=function(){return this.name_},fe(e,[{key:`isBeingObserved`,get:function(){return se(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ce(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return se(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ce(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!se(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=ce(this.flags_,e.diffValueMask_,t===1)}}])}();Ae.isBeingObservedMask_=1,Ae.isPendingUnobservationMask_=2,Ae.diffValueMask_=4;var je=T(`Atom`,Ae);function Me(e,t,n){t===void 0&&(t=_),n===void 0&&(n=_);var r=new Ae(e);return t!==_&&gr(r,t),n!==_&&_r(r,n),r}function Ne(e,t){return e===t}function Pe(e,t){return _a(e,t)}function Fe(e,t){return _a(e,t,1)}function Ie(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e==1/t:e!==e&&t!==t}var Le={identity:Ne,structural:Pe,default:Ie,shallow:Fe};function Re(e,t,n){return Gr(e)?e:Array.isArray(e)?M.array(e,{name:n}):x(e)?M.object(e,void 0,{name:n}):ee(e)?M.map(e,{name:n}):E(e)?M.set(e,{name:n}):typeof e==`function`&&!cr(e)&&!Lr(e)?S(e)?Pr(e):or(n,e):e}function ze(e,t,r){if(e==null||$i(e)||Fi(e)||Bi(e)||Gi(e))return e;if(Array.isArray(e))return M.array(e,{name:r,deep:!1});if(x(e))return M.object(e,void 0,{name:r,deep:!1});if(ee(e))return M.map(e,{name:r,deep:!1});if(E(e))return M.set(e,{name:r,deep:!1});n(`The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets`)}function Be(e){return e}function Ve(e,t){return Gr(e)&&n(`observable.struct should not be used with observable values`),_a(e,t)?t:e}var He=`override`,Ue=we({annotationType_:He,make_:Ge,extend_:Ke,decorate_20223_:qe});function We(e){return e.annotationType_===He}function Ge(e,t){return e.isPlainObject_&&n(`Cannot apply '`+this.annotationType_+`' to '`+e.name_+`.`+t.toString()+`':`+(`
61
+ '`+this.annotationType_+`' cannot be used on plain objects.`)),ae(e.appliedAnnotations_,t)||n(`'`+e.name_+`.`+t.toString()+`' is annotated with '`+this.annotationType_+`', but no such annotated member was found on prototype.`),0}function Ke(e,t,r,i){n(`'`+this.annotationType_+`' can only be used with 'makeObservable'`)}function qe(e,t){console.warn(`'`+this.annotationType_+`' cannot be used with decorators - this is a no-op`)}function Je(e,t){return{annotationType_:e,options_:t,make_:Ye,extend_:Xe,decorate_20223_:Ze}}function Ye(e,t,n,r){var i;return(i=this.options_)!=null&&i.bound?this.extend_(e,t,n,!1)===null?0:1:r===e.target_?this.extend_(e,t,n,!1)===null?0:2:cr(n.value)?1:(s(r,t,$e(e,this,t,n,!1)),2)}function Xe(e,t,n,r){var i=$e(e,this,t,n);return e.defineProperty_(t,i,r)}function Ze(e,t){ke(t,[`method`,`field`]);var r=t.kind,i=t.name,a=t.addInitializer,o=this,s=function(e){return Ut(o.options_?.name??i.toString(),e,o.options_?.autoAction??!1)};if(r==`field`)return function(e){var t,n=e;return cr(n)||(n=s(n)),(t=o.options_)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n};if(r==`method`){var c;return cr(e)||(e=s(e)),(c=this.options_)!=null&&c.bound&&a(function(){var e=this,t=e[i].bind(e);t.isMobxAction=!0,e[i]=t}),e}n(`Cannot apply '`+o.annotationType_+`' to '`+String(i)+`' (kind: `+r+`):`+(`
62
62
  '`+o.annotationType_+`' can only be used on properties with a function value.`))}function Qe(e,t,r,i){var a=t.annotationType_,o=i.value;v(o)||n(`Cannot apply '`+a+`' to '`+e.name_+`.`+r.toString()+`':`+(`
63
- '`+a+`' can only be used on properties with a function value.`))}function $e(e,t,n,r,i){var a,o;i===void 0&&(i=I.safeDescriptors),Qe(e,t,n,r);var s=r.value;return(a=t.options_)!=null&&a.bound&&(s=s.bind(e.proxy_??e.target_)),{value:Gt(t.options_?.name??n.toString(),s,t.options_?.autoAction??!1,(o=t.options_)!=null&&o.bound?e.proxy_??e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function et(e,t){return{annotationType_:e,options_:t,make_:tt,extend_:nt,decorate_20223_:rt}}function tt(e,t,n,r){var i;return r===e.target_?this.extend_(e,t,n,!1)===null?0:2:(i=this.options_)!=null&&i.bound&&(!ae(e.target_,t)||!zr(e.target_[t]))&&this.extend_(e,t,n,!1)===null?0:zr(n.value)?1:(s(r,t,at(e,this,t,n,!1,!1)),2)}function nt(e,t,n,r){var i=at(e,this,t,n,this.options_?.bound);return e.defineProperty_(t,i,r)}function rt(e,t){var n;ke(t,[`method`]);var r=t.name,i=t.addInitializer;return zr(e)||(e=Ir(e)),(n=this.options_)!=null&&n.bound&&i(function(){var e=this,t=e[r].bind(e);t.isMobXFlow=!0,e[r]=t}),e}function it(e,t,r,i){var a=t.annotationType_,o=i.value;v(o)||n(`Cannot apply '`+a+`' to '`+e.name_+`.`+r.toString()+`':`+(`
64
- '`+a+`' can only be used on properties with a generator function value.`))}function at(e,t,n,r,i,a){a===void 0&&(a=I.safeDescriptors),it(e,t,n,r);var o=r.value;return zr(o)||(o=Ir(o)),i&&(o=o.bind(e.proxy_??e.target_),o.isMobXFlow=!0),{value:o,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function ot(e,t){return{annotationType_:e,options_:t,make_:st,extend_:ct,decorate_20223_:lt}}function st(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function ct(e,t,n,r){return ut(e,this,t,n),e.defineComputedProperty_(t,me({},this.options_,{get:n.get,set:n.set}),r)}function lt(e,t){ke(t,[`getter`]);var n=this,r=t.name,i=t.addInitializer;return i(function(){var t=Qi(this)[A],i=me({},n.options_,{get:e,context:this});i.name||=t.name_+`.`+r.toString(),t.values_.set(r,new tn(i))}),function(){return this[A].getObservablePropValue_(r)}}function ut(e,t,r,i){var a=t.annotationType_;i.get||n(`Cannot apply '`+a+`' to '`+e.name_+`.`+r.toString()+`':`+(`
65
- '`+a+`' can only be used on getter(+setter) properties.`))}function dt(e,t){return{annotationType_:e,options_:t,make_:ft,extend_:pt,decorate_20223_:mt}}function ft(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function pt(e,t,n,r){return ht(e,this,t,n),e.defineObservableProperty_(t,n.value,this.options_?.enhancer??Re,r)}function mt(e,t){if(t.kind===`field`)throw n("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");ke(t,[`accessor`]);var r=this,i=t.kind,a=t.name,o=new WeakSet;function s(e,t){var n=Qi(e)[A],i=new $t(t,r.options_?.enhancer??Re,n.name_+`.`+a.toString(),!1);n.values_.set(a,i),o.add(e)}if(i==`accessor`)return{get:function(){return o.has(this)||s(this,e.get.call(this)),this[A].getObservablePropValue_(a)},set:function(e){return o.has(this)||s(this,e),this[A].setObservablePropValue_(a,e)},init:function(e){return o.has(this)||s(this,e),e}}}function ht(e,t,r,i){var a=t.annotationType_;`value`in i||n(`Cannot apply '`+a+`' to '`+e.name_+`.`+r.toString()+`':`+(`
66
- '`+a+`' cannot be used on getter/setter properties`))}var gt=`true`,_t=vt();function vt(e){return{annotationType_:gt,options_:e,make_:yt,extend_:bt,decorate_20223_:xt}}function yt(e,t,n,r){var i;if(n.get)return Bt.make_(e,t,n,r);if(n.set){var a=ur(n.set)?n.set:Gt(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:I.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(s(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value==`function`){var o;if(S(n.value)){var c;return((c=this.options_)!=null&&c.autoBind?Ir.bound:Ir).make_(e,t,n,r)}return((o=this.options_)!=null&&o.autoBind?cr.bound:cr).make_(e,t,n,r)}var l=this.options_?.deep===!1?M.ref:M;return typeof n.value==`function`&&(i=this.options_)!=null&&i.autoBind&&(n.value=n.value.bind(e.proxy_??e.target_)),l.make_(e,t,n,r)}function bt(e,t,n,r){var i;return n.get?Bt.extend_(e,t,n,r):n.set?e.defineProperty_(t,{configurable:I.safeDescriptors?e.isPlainObject_:!0,set:Gt(t.toString(),n.set)},r):(typeof n.value==`function`&&(i=this.options_)!=null&&i.autoBind&&(n.value=n.value.bind(e.proxy_??e.target_)),(this.options_?.deep===!1?M.ref:M).extend_(e,t,n,r))}function xt(e,t){n(`'`+this.annotationType_+`' cannot be used as a decorator`)}var St=`observable`,Ct=`observable.ref`,wt=`observable.shallow`,Tt=`observable.struct`,Et={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Et);function Dt(e){return e||Et}var Ot=dt(St),kt=dt(Ct,{enhancer:Be}),At=dt(wt,{enhancer:ze}),jt=dt(Tt,{enhancer:Ve}),Mt=we(Ot);function Nt(e){return e.deep===!0?Re:e.deep===!1?Be:j(e.defaultDecorator)}function Pt(e){return e?e.defaultDecorator??vt(e):void 0}function j(e){return e?e.options_?.enhancer??Re:Re}function Ft(e,t,n){if(Oe(t))return Ot.decorate_20223_(e,t);if(y(t)){Te(e,t,Ot);return}return qr(e)?e:x(e)?M.object(e,t,n):Array.isArray(e)?M.array(e,t):ee(e)?M.map(e,t):E(e)?M.set(e,t):typeof e==`object`&&e?e:M.box(e,t)}a(Ft,Mt);var M=a(Ft,{box:function(e,t){var n=Dt(t);return new $t(e,Nt(n),n.name,!0,n.equals)},array:function(e,t){var n=Dt(t);return(I.useProxies===!1||n.proxy===!1?pa:Mi)(e,Nt(n),n.name)},map:function(e,t){var n=Dt(t);return new Vi(e,Nt(n),n.name)},set:function(e,t){var n=Dt(t);return new Ki(e,Nt(n),n.name)},object:function(e,t,n){return _a(function(){return Tr(I.useProxies===!1||n?.proxy===!1?Qi({},n):_i({},n),e,t)})},ref:we(kt),shallow:we(At),deep:Mt,struct:we(jt)}),It=`computed`,Lt=`computed.struct`,Rt=ot(It),zt=ot(Lt,{equals:Le.structural}),Bt=function(e,t){if(Oe(t))return Rt.decorate_20223_(e,t);if(y(t))return Te(e,t,Rt);if(x(e))return we(ot(It,e));v(e)||n("First argument to `computed` should be an expression."),v(t)&&n("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=x(t)?t:{};return r.get=e,r.name||=e.name||``,new tn(r)};Object.assign(Bt,Rt),Bt.struct=we(zt);var Vt=0,Ht=1,Ut=o(function(){},`name`)?.configurable??!1,Wt={value:`action`,configurable:!0,writable:!1,enumerable:!1};function Gt(e,t,r,i){r===void 0&&(r=!1),v(t)||n("`action` can only be invoked on functions"),(typeof e!=`string`||!e)&&n(`actions should have valid names, got: '`+e+`'`);function a(){return Kt(e,r,t,i||this,arguments)}return a.isMobxAction=!0,a.toString=function(){return t.toString()},Ut&&(Wt.value=e,s(a,`name`,Wt)),a}function Kt(e,t,n,r,i){var a=qt(e,t,r,i);try{return n.apply(r,i)}catch(e){throw a.error_=e,e}finally{Jt(a)}}function qt(e,t,n,r){var i=Gn()&&!!e,a=0;i&&(a=Date.now(),qn({type:Zn,name:e,object:n,arguments:r?Array.from(r):l}));var o=I.trackingDerivation,s=!t||!o;jn();var c=I.allowStateChanges;s&&(F(),c=Xt(!0));var u=gn(!0),d={runAsAction_:s,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:u,notifySpy_:i,startTime_:a,actionId_:Ht++,parentActionId_:Vt};return Vt=d.actionId_,d}function Jt(e){Vt!==e.actionId_&&n(30),Vt=e.parentActionId_,e.error_!==void 0&&(I.suppressReactionErrors=!0),Zt(e.prevAllowStateChanges_),_n(e.prevAllowStateReads_),Mn(),e.runAsAction_&&hn(e.prevDerivation_),e.notifySpy_&&Yn({time:Date.now()-e.startTime_}),I.suppressReactionErrors=!1}function Yt(e,t){var n=Xt(e);try{return t()}finally{Zt(n)}}function Xt(e){var t=I.allowStateChanges;return I.allowStateChanges=e,t}function Zt(e){I.allowStateChanges=e}var Qt=`create`,$t=function(e){function t(t,n,r,i,a){var o;return r===void 0&&(r=`ObservableValue@`+h()),i===void 0&&(i=!0),a===void 0&&(a=Le.default),o=e.call(this,r)||this,o.enhancer=void 0,o.name_=void 0,o.equals=void 0,o.hasUnreportedChange_=!1,o.interceptors_=void 0,o.changeListeners_=void 0,o.value_=void 0,o.dehancer=void 0,o.enhancer=n,o.name_=r,o.equals=a,o.value_=n(t,void 0,r),i&&Gn()&&Kn({type:Qt,object:o,observableKind:`value`,debugObjectName:o.name_,newValue:``+o.value_?.toString()}),o}ge(t,e);var n=t.prototype;return n.dehanceValue=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.set=function(e){var t=this.value_;if(e=this.prepareNewValue_(e),e!==I.UNCHANGED){var n=Gn();n&&qn({type:Oi,object:this,observableKind:`value`,debugObjectName:this.name_,newValue:e,oldValue:t}),this.setNewValue_(e),n&&Yn()}},n.prepareNewValue_=function(e){if(ln(this),vi(this)){var t=bi(this,{object:this,type:Oi,newValue:e});if(!t)return I.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?I.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),xi(this)&&Ci(this,{type:Oi,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return yi(this,e)},n.observe_=function(e,t){return t&&e({observableKind:`value`,debugObjectName:this.name_,object:this,type:Oi,newValue:this.value_,oldValue:void 0}),Si(this,e)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+`[`+this.value_+`]`},n.valueOf=function(){return ie(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Ae),en=T(`ObservableValue`,$t),tn=function(){function e(e){this.dependenciesState_=N.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=N.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new an(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=rn.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||n(31),this.derivation=e.get,this.name_=e.name||`ComputedValue@`+h(),e.set&&(this.setter_=Gt(this.name_+`-setter`,e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?Le.structural:Le.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){In(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.get=function(){if(this.isComputing&&n(32,this.name_,this.derivation),I.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)sn(this)&&(this.warnAboutUntrackedRead_(),jn(),this.value_=this.computeValue_(!1),Mn());else if(Nn(this),sn(this)){var e=I.trackingContext;this.keepAlive_&&!e&&(I.trackingContext=this),this.trackAndCompute()&&Fn(this),I.trackingContext=e}var t=this.value_;if(on(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&n(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else n(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===N.NOT_TRACKING_,n=this.computeValue_(!0),r=t||on(e)||on(n)||!this.equals_(e,n);return r&&(this.value_=n,Gn()&&Kn({observableKind:`computed`,debugObjectName:this.name_,object:this.scope_,type:`update`,oldValue:e,newValue:n})),r},t.computeValue_=function(e){this.isComputing=!0;var t=Xt(!1),n;if(e)n=P(this,this.derivation,this.scope_);else if(I.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(e){n=new an(e)}return Zt(t),this.isComputing=!1,n},t.suspend_=function(){this.keepAlive_||(pn(this),this.value_=void 0,this.isTracing_!==rn.NONE&&console.log(`[mobx.trace] Computed value '`+this.name_+`' was suspended and it will recompute on the next access.`))},t.observe_=function(e,t){var n=this,r=!0,i=void 0;return dr(function(){var a=n.get();if(!r||t){var o=F();e({observableKind:`computed`,debugObjectName:n.name_,type:Oi,object:n,newValue:a,oldValue:i}),hn(o)}r=!1,i=a})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==rn.NONE&&console.log(`[mobx.trace] Computed value '`+this.name_+`' is being read outside a reactive context. Doing a full recompute.`),(typeof this.requiresReaction_==`boolean`?this.requiresReaction_:I.computedRequiresReaction)&&console.warn(`[mobx] Computed value '`+this.name_+`' is being read outside a reactive context. Doing a full recompute.`)},t.toString=function(){return this.name_+`[`+this.derivation.toString()+`]`},t.valueOf=function(){return ie(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},fe(e,[{key:`isComputing`,get:function(){return se(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=ce(this.flags_,e.isComputingMask_,t)}},{key:`isRunningSetter`,get:function(){return se(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=ce(this.flags_,e.isRunningSetterMask_,t)}},{key:`isBeingObserved`,get:function(){return se(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ce(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return se(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ce(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!se(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=ce(this.flags_,e.diffValueMask_,t===1)}}])}();tn.isComputingMask_=1,tn.isRunningSetterMask_=2,tn.isBeingObservedMask_=4,tn.isPendingUnobservationMask_=8,tn.diffValueMask_=16;var nn=T(`ComputedValue`,tn),N;(function(e){e[e.NOT_TRACKING_=-1]=`NOT_TRACKING_`,e[e.UP_TO_DATE_=0]=`UP_TO_DATE_`,e[e.POSSIBLY_STALE_=1]=`POSSIBLY_STALE_`,e[e.STALE_=2]=`STALE_`})(N||={});var rn;(function(e){e[e.NONE=0]=`NONE`,e[e.LOG=1]=`LOG`,e[e.BREAK=2]=`BREAK`})(rn||={});var an=function(e){this.cause=void 0,this.cause=e};function on(e){return e instanceof an}function sn(e){switch(e.dependenciesState_){case N.UP_TO_DATE_:return!1;case N.NOT_TRACKING_:case N.STALE_:return!0;case N.POSSIBLY_STALE_:for(var t=gn(!0),n=F(),r=e.observing_,i=r.length,a=0;a<i;a++){var o=r[a];if(nn(o)){if(I.disableErrorBoundaries)o.get();else try{o.get()}catch{return hn(n),_n(t),!0}if(e.dependenciesState_===N.STALE_)return hn(n),_n(t),!0}}return vn(e),hn(n),_n(t),!1}}function cn(){return I.trackingDerivation!==null}function ln(e){var t=e.observers_.size>0;!I.allowStateChanges&&(t||I.enforceActions===`always`)&&console.warn(`[MobX] `+(I.enforceActions?`Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: `:`Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: `)+e.name_)}function un(e){!I.allowStateReads&&I.observableRequiresReaction&&console.warn(`[mobx] Observable '`+e.name_+`' being read outside a reactive context.`)}function P(e,t,n){var r=gn(!0);vn(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++I.runId;var i=I.trackingDerivation;I.trackingDerivation=e,I.inBatch++;var a;if(I.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(e){a=new an(e)}return I.inBatch--,I.trackingDerivation=i,fn(e),dn(e),_n(r),a}function dn(e){e.observing_.length===0&&(typeof e.requiresObservable_==`boolean`?e.requiresObservable_:I.reactionRequiresObservable)&&console.warn(`[mobx] Derivation '`+e.name_+`' is created/updated without reading any observable value.`)}function fn(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=N.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,o=0;o<a;o++){var s=n[o];s.diffValue===0&&(s.diffValue=1,i!==o&&(n[i]=s),i++),s.dependenciesState_>r&&(r=s.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){var c=t[a];c.diffValue===0&&kn(c,e),c.diffValue=0}for(;i--;){var l=n[i];l.diffValue===1&&(l.diffValue=0,On(l,e))}r!==N.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function pn(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)kn(t[n],e);e.dependenciesState_=N.NOT_TRACKING_}function mn(e){var t=F();try{return e()}finally{hn(t)}}function F(){var e=I.trackingDerivation;return I.trackingDerivation=null,e}function hn(e){I.trackingDerivation=e}function gn(e){var t=I.allowStateReads;return I.allowStateReads=e,t}function _n(e){I.allowStateReads=e}function vn(e){if(e.dependenciesState_!==N.UP_TO_DATE_){e.dependenciesState_=N.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=N.UP_TO_DATE_}}var yn=[`mobxGuid`,`spyListeners`,`enforceActions`,`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`allowStateReads`,`disableErrorBoundaries`,`runId`,`UNCHANGED`,`useProxies`],bn=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},xn=!0,Sn=!1,I=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(xn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new bn().version&&(xn=!1),xn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new bn):(setTimeout(function(){Sn||n(35)},1),new bn)}();function Cn(){if((I.pendingReactions.length||I.inBatch||I.isRunningReactions)&&n(36),Sn=!0,xn){var e=i();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),I=new bn}}function wn(){return I}function Tn(){var e=new bn;for(var t in e)yn.indexOf(t)===-1&&(I[t]=e[t]);I.allowStateChanges=!I.enforceActions}function En(e){return e.observers_&&e.observers_.size>0}function Dn(e){return e.observers_}function On(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function kn(e,t){e.observers_.delete(t),e.observers_.size===0&&An(e)}function An(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,I.pendingUnobservations.push(e))}function jn(){I.inBatch++}function Mn(){if(--I.inBatch===0){Hn();for(var e=I.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof tn&&n.suspend_())}I.pendingUnobservations=[]}}function Nn(e){un(e);var t=I.trackingDerivation;return t===null?(e.observers_.size===0&&I.inBatch>0&&An(e),!1):(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&I.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function Pn(e){e.lowestObserverState_!==N.STALE_&&(e.lowestObserverState_=N.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===N.UP_TO_DATE_&&(t.isTracing_!==rn.NONE&&L(t,e),t.onBecomeStale_()),t.dependenciesState_=N.STALE_}))}function Fn(e){e.lowestObserverState_!==N.STALE_&&(e.lowestObserverState_=N.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===N.POSSIBLY_STALE_?(t.dependenciesState_=N.STALE_,t.isTracing_!==rn.NONE&&L(t,e)):t.dependenciesState_===N.UP_TO_DATE_&&(e.lowestObserverState_=N.UP_TO_DATE_)}))}function In(e){e.lowestObserverState_===N.UP_TO_DATE_&&(e.lowestObserverState_=N.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===N.UP_TO_DATE_&&(e.dependenciesState_=N.POSSIBLY_STALE_,e.onBecomeStale_())}))}function L(e,t){if(console.log(`[mobx.trace] '`+e.name_+`' is invalidated due to a change in: '`+t.name_+`'`),e.isTracing_===rn.BREAK){var n=[];Ln(Er(e),n,1),Function(`debugger;
63
+ '`+a+`' can only be used on properties with a function value.`))}function $e(e,t,n,r,i){var a,o;i===void 0&&(i=R.safeDescriptors),Qe(e,t,n,r);var s=r.value;return(a=t.options_)!=null&&a.bound&&(s=s.bind(e.proxy_??e.target_)),{value:Ut(t.options_?.name??n.toString(),s,t.options_?.autoAction??!1,(o=t.options_)!=null&&o.bound?e.proxy_??e.target_:void 0),configurable:i?e.isPlainObject_:!0,enumerable:!1,writable:!i}}function et(e,t){return{annotationType_:e,options_:t,make_:tt,extend_:nt,decorate_20223_:rt}}function tt(e,t,n,r){var i;return r===e.target_?this.extend_(e,t,n,!1)===null?0:2:(i=this.options_)!=null&&i.bound&&(!ae(e.target_,t)||!Lr(e.target_[t]))&&this.extend_(e,t,n,!1)===null?0:Lr(n.value)?1:(s(r,t,at(e,this,t,n,!1,!1)),2)}function nt(e,t,n,r){var i=at(e,this,t,n,this.options_?.bound);return e.defineProperty_(t,i,r)}function rt(e,t){var n;ke(t,[`method`]);var r=t.name,i=t.addInitializer;return Lr(e)||(e=Pr(e)),(n=this.options_)!=null&&n.bound&&i(function(){var e=this,t=e[r].bind(e);t.isMobXFlow=!0,e[r]=t}),e}function it(e,t,r,i){var a=t.annotationType_,o=i.value;v(o)||n(`Cannot apply '`+a+`' to '`+e.name_+`.`+r.toString()+`':`+(`
64
+ '`+a+`' can only be used on properties with a generator function value.`))}function at(e,t,n,r,i,a){a===void 0&&(a=R.safeDescriptors),it(e,t,n,r);var o=r.value;return Lr(o)||(o=Pr(o)),i&&(o=o.bind(e.proxy_??e.target_),o.isMobXFlow=!0),{value:o,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function ot(e,t){return{annotationType_:e,options_:t,make_:st,extend_:ct,decorate_20223_:lt}}function st(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function ct(e,t,n,r){return ut(e,this,t,n),e.defineComputedProperty_(t,me({},this.options_,{get:n.get,set:n.set}),r)}function lt(e,t){ke(t,[`getter`]);var n=this,r=t.name,i=t.addInitializer;return i(function(){var t=Xi(this)[A],i=me({},n.options_,{get:e,context:this});i.name||=t.name_+`.`+r.toString(),t.values_.set(r,new $t(i))}),function(){return this[A].getObservablePropValue_(r)}}function ut(e,t,r,i){var a=t.annotationType_;i.get||n(`Cannot apply '`+a+`' to '`+e.name_+`.`+r.toString()+`':`+(`
65
+ '`+a+`' can only be used on getter(+setter) properties.`))}function dt(e,t){return{annotationType_:e,options_:t,make_:ft,extend_:pt,decorate_20223_:mt}}function ft(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function pt(e,t,n,r){return ht(e,this,t,n),e.defineObservableProperty_(t,n.value,this.options_?.enhancer??Re,r)}function mt(e,t){if(t.kind===`field`)throw n("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");ke(t,[`accessor`]);var r=this,i=t.kind,a=t.name,o=new WeakSet;function s(e,t){var n=Xi(e)[A],i=new Zt(t,r.options_?.enhancer??Re,n.name_+`.`+a.toString(),!1);n.values_.set(a,i),o.add(e)}if(i==`accessor`)return{get:function(){return o.has(this)||s(this,e.get.call(this)),this[A].getObservablePropValue_(a)},set:function(e){return o.has(this)||s(this,e),this[A].setObservablePropValue_(a,e)},init:function(e){return o.has(this)||s(this,e),e}}}function ht(e,t,r,i){var a=t.annotationType_;`value`in i||n(`Cannot apply '`+a+`' to '`+e.name_+`.`+r.toString()+`':`+(`
66
+ '`+a+`' cannot be used on getter/setter properties`))}var gt=`true`,_t=vt();function vt(e){return{annotationType_:gt,options_:e,make_:yt,extend_:bt,decorate_20223_:xt}}function yt(e,t,n,r){var i;if(n.get)return zt.make_(e,t,n,r);if(n.set){var a=cr(n.set)?n.set:Ut(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:R.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(s(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value==`function`){var o;if(S(n.value)){var c;return((c=this.options_)!=null&&c.autoBind?Pr.bound:Pr).make_(e,t,n,r)}return((o=this.options_)!=null&&o.autoBind?or.bound:or).make_(e,t,n,r)}var l=this.options_?.deep===!1?M.ref:M;return typeof n.value==`function`&&(i=this.options_)!=null&&i.autoBind&&(n.value=n.value.bind(e.proxy_??e.target_)),l.make_(e,t,n,r)}function bt(e,t,n,r){var i;return n.get?zt.extend_(e,t,n,r):n.set?e.defineProperty_(t,{configurable:R.safeDescriptors?e.isPlainObject_:!0,set:Ut(t.toString(),n.set)},r):(typeof n.value==`function`&&(i=this.options_)!=null&&i.autoBind&&(n.value=n.value.bind(e.proxy_??e.target_)),(this.options_?.deep===!1?M.ref:M).extend_(e,t,n,r))}function xt(e,t){n(`'`+this.annotationType_+`' cannot be used as a decorator`)}var St=`observable`,Ct=`observable.ref`,wt=`observable.shallow`,Tt=`observable.struct`,Et={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Et);function Dt(e){return e||Et}var Ot=dt(St),kt=dt(Ct,{enhancer:Be}),At=dt(wt,{enhancer:ze}),jt=dt(Tt,{enhancer:Ve}),Mt=we(Ot);function Nt(e){return e.deep===!0?Re:e.deep===!1?Be:j(e.defaultDecorator)}function Pt(e){return e?e.defaultDecorator??vt(e):void 0}function j(e){return e?e.options_?.enhancer??Re:Re}function Ft(e,t,n){if(Oe(t))return Ot.decorate_20223_(e,t);if(y(t)){Te(e,t,Ot);return}return Gr(e)?e:x(e)?M.object(e,t,n):Array.isArray(e)?M.array(e,t):ee(e)?M.map(e,t):E(e)?M.set(e,t):typeof e==`object`&&e?e:M.box(e,t)}a(Ft,Mt);var M=a(Ft,{box:function(e,t){var n=Dt(t);return new Zt(e,Nt(n),n.name,!0,n.equals)},array:function(e,t){var n=Dt(t);return(R.useProxies===!1||n.proxy===!1?da:Ai)(e,Nt(n),n.name)},map:function(e,t){var n=Dt(t);return new zi(e,Nt(n),n.name)},set:function(e,t){var n=Dt(t);return new Wi(e,Nt(n),n.name)},object:function(e,t,n){return ha(function(){return Cr(R.useProxies===!1||n?.proxy===!1?Xi({},n):hi({},n),e,t)})},ref:we(kt),shallow:we(At),deep:Mt,struct:we(jt)}),It=`computed`,Lt=`computed.struct`,Rt=ot(It),N=ot(Lt,{equals:Le.structural}),zt=function(e,t){if(Oe(t))return Rt.decorate_20223_(e,t);if(y(t))return Te(e,t,Rt);if(x(e))return we(ot(It,e));v(e)||n("First argument to `computed` should be an expression."),v(t)&&n("A setter as second argument is no longer supported, use `{ set: fn }` option instead");var r=x(t)?t:{};return r.get=e,r.name||=e.name||``,new $t(r)};Object.assign(zt,Rt),zt.struct=we(N);var Bt=0,P=1,Vt=o(function(){},`name`)?.configurable??!1,Ht={value:`action`,configurable:!0,writable:!1,enumerable:!1};function Ut(e,t,r,i){r===void 0&&(r=!1),v(t)||n("`action` can only be invoked on functions"),(typeof e!=`string`||!e)&&n(`actions should have valid names, got: '`+e+`'`);function a(){return Wt(e,r,t,i||this,arguments)}return a.isMobxAction=!0,a.toString=function(){return t.toString()},Vt&&(Ht.value=e,s(a,`name`,Ht)),a}function Wt(e,t,n,r,i){var a=Gt(e,t,r,i);try{return n.apply(r,i)}catch(e){throw a.error_=e,e}finally{Kt(a)}}function Gt(e,t,n,r){var i=Un()&&!!e,a=0;i&&(a=Date.now(),Gn({type:Yn,name:e,object:n,arguments:r?Array.from(r):l}));var o=R.trackingDerivation,s=!t||!o;kn();var c=R.allowStateChanges;s&&(L(),c=Jt(!0));var u=mn(!0),d={runAsAction_:s,prevDerivation_:o,prevAllowStateChanges_:c,prevAllowStateReads_:u,notifySpy_:i,startTime_:a,actionId_:P++,parentActionId_:Bt};return Bt=d.actionId_,d}function Kt(e){Bt!==e.actionId_&&n(30),Bt=e.parentActionId_,e.error_!==void 0&&(R.suppressReactionErrors=!0),Yt(e.prevAllowStateChanges_),hn(e.prevAllowStateReads_),An(),e.runAsAction_&&pn(e.prevDerivation_),e.notifySpy_&&qn({time:Date.now()-e.startTime_}),R.suppressReactionErrors=!1}function qt(e,t){var n=Jt(e);try{return t()}finally{Yt(n)}}function Jt(e){var t=R.allowStateChanges;return R.allowStateChanges=e,t}function Yt(e){R.allowStateChanges=e}var Xt=`create`,Zt=function(e){function t(t,n,r,i,a){var o;return r===void 0&&(r=`ObservableValue@`+h()),i===void 0&&(i=!0),a===void 0&&(a=Le.default),o=e.call(this,r)||this,o.enhancer=void 0,o.name_=void 0,o.equals=void 0,o.hasUnreportedChange_=!1,o.interceptors_=void 0,o.changeListeners_=void 0,o.value_=void 0,o.dehancer=void 0,o.enhancer=n,o.name_=r,o.equals=a,o.value_=n(t,void 0,r),i&&Un()&&Wn({type:Xt,object:o,observableKind:`value`,debugObjectName:o.name_,newValue:``+o.value_?.toString()}),o}ge(t,e);var n=t.prototype;return n.dehanceValue=function(e){return this.dehancer===void 0?e:this.dehancer(e)},n.set=function(e){var t=this.value_;if(e=this.prepareNewValue_(e),e!==R.UNCHANGED){var n=Un();n&&Gn({type:Ei,object:this,observableKind:`value`,debugObjectName:this.name_,newValue:e,oldValue:t}),this.setNewValue_(e),n&&qn()}},n.prepareNewValue_=function(e){if(sn(this),gi(this)){var t=vi(this,{object:this,type:Ei,newValue:e});if(!t)return R.UNCHANGED;e=t.newValue}return e=this.enhancer(e,this.value_,this.name_),this.equals(this.value_,e)?R.UNCHANGED:e},n.setNewValue_=function(e){var t=this.value_;this.value_=e,this.reportChanged(),yi(this)&&xi(this,{type:Ei,object:this,newValue:e,oldValue:t})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(e){return _i(this,e)},n.observe_=function(e,t){return t&&e({observableKind:`value`,debugObjectName:this.name_,object:this,type:Ei,newValue:this.value_,oldValue:void 0}),bi(this,e)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+`[`+this.value_+`]`},n.valueOf=function(){return ie(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Ae),Qt=T(`ObservableValue`,Zt),$t=function(){function e(e){this.dependenciesState_=F.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=F.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new nn(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=tn.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,e.get||n(31),this.derivation=e.get,this.name_=e.name||`ComputedValue@`+h(),e.set&&(this.setter_=Ut(this.name_+`-setter`,e.set)),this.equals_=e.equals||(e.compareStructural||e.struct?Le.structural:Le.default),this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){Pn(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(e){return e()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(e){return e()})},t.get=function(){if(this.isComputing&&n(32,this.name_,this.derivation),R.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)an(this)&&(this.warnAboutUntrackedRead_(),kn(),this.value_=this.computeValue_(!1),An());else if(jn(this),an(this)){var e=R.trackingContext;this.keepAlive_&&!e&&(R.trackingContext=this),this.trackAndCompute()&&Nn(this),R.trackingContext=e}var t=this.value_;if(rn(t))throw t.cause;return t},t.set=function(e){if(this.setter_){this.isRunningSetter&&n(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,e)}finally{this.isRunningSetter=!1}}else n(34,this.name_)},t.trackAndCompute=function(){var e=this.value_,t=this.dependenciesState_===F.NOT_TRACKING_,n=this.computeValue_(!0),r=t||rn(e)||rn(n)||!this.equals_(e,n);return r&&(this.value_=n,Un()&&Wn({observableKind:`computed`,debugObjectName:this.name_,object:this.scope_,type:`update`,oldValue:e,newValue:n})),r},t.computeValue_=function(e){this.isComputing=!0;var t=Jt(!1),n;if(e)n=I(this,this.derivation,this.scope_);else if(R.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(e){n=new nn(e)}return Yt(t),this.isComputing=!1,n},t.suspend_=function(){this.keepAlive_||(dn(this),this.value_=void 0,this.isTracing_!==tn.NONE&&console.log(`[mobx.trace] Computed value '`+this.name_+`' was suspended and it will recompute on the next access.`))},t.observe_=function(e,t){var n=this,r=!0,i=void 0;return lr(function(){var a=n.get();if(!r||t){var o=L();e({observableKind:`computed`,debugObjectName:n.name_,type:Ei,object:n,newValue:a,oldValue:i}),pn(o)}r=!1,i=a})},t.warnAboutUntrackedRead_=function(){this.isTracing_!==tn.NONE&&console.log(`[mobx.trace] Computed value '`+this.name_+`' is being read outside a reactive context. Doing a full recompute.`),(typeof this.requiresReaction_==`boolean`?this.requiresReaction_:R.computedRequiresReaction)&&console.warn(`[mobx] Computed value '`+this.name_+`' is being read outside a reactive context. Doing a full recompute.`)},t.toString=function(){return this.name_+`[`+this.derivation.toString()+`]`},t.valueOf=function(){return ie(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},fe(e,[{key:`isComputing`,get:function(){return se(this.flags_,e.isComputingMask_)},set:function(t){this.flags_=ce(this.flags_,e.isComputingMask_,t)}},{key:`isRunningSetter`,get:function(){return se(this.flags_,e.isRunningSetterMask_)},set:function(t){this.flags_=ce(this.flags_,e.isRunningSetterMask_,t)}},{key:`isBeingObserved`,get:function(){return se(this.flags_,e.isBeingObservedMask_)},set:function(t){this.flags_=ce(this.flags_,e.isBeingObservedMask_,t)}},{key:`isPendingUnobservation`,get:function(){return se(this.flags_,e.isPendingUnobservationMask_)},set:function(t){this.flags_=ce(this.flags_,e.isPendingUnobservationMask_,t)}},{key:`diffValue`,get:function(){return+!!se(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=ce(this.flags_,e.diffValueMask_,t===1)}}])}();$t.isComputingMask_=1,$t.isRunningSetterMask_=2,$t.isBeingObservedMask_=4,$t.isPendingUnobservationMask_=8,$t.diffValueMask_=16;var en=T(`ComputedValue`,$t),F;(function(e){e[e.NOT_TRACKING_=-1]=`NOT_TRACKING_`,e[e.UP_TO_DATE_=0]=`UP_TO_DATE_`,e[e.POSSIBLY_STALE_=1]=`POSSIBLY_STALE_`,e[e.STALE_=2]=`STALE_`})(F||={});var tn;(function(e){e[e.NONE=0]=`NONE`,e[e.LOG=1]=`LOG`,e[e.BREAK=2]=`BREAK`})(tn||={});var nn=function(e){this.cause=void 0,this.cause=e};function rn(e){return e instanceof nn}function an(e){switch(e.dependenciesState_){case F.UP_TO_DATE_:return!1;case F.NOT_TRACKING_:case F.STALE_:return!0;case F.POSSIBLY_STALE_:for(var t=mn(!0),n=L(),r=e.observing_,i=r.length,a=0;a<i;a++){var o=r[a];if(en(o)){if(R.disableErrorBoundaries)o.get();else try{o.get()}catch{return pn(n),hn(t),!0}if(e.dependenciesState_===F.STALE_)return pn(n),hn(t),!0}}return gn(e),pn(n),hn(t),!1}}function on(){return R.trackingDerivation!==null}function sn(e){var t=e.observers_.size>0;!R.allowStateChanges&&(t||R.enforceActions===`always`)&&console.warn(`[MobX] `+(R.enforceActions?`Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: `:`Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: `)+e.name_)}function cn(e){!R.allowStateReads&&R.observableRequiresReaction&&console.warn(`[mobx] Observable '`+e.name_+`' being read outside a reactive context.`)}function I(e,t,n){var r=mn(!0);gn(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++R.runId;var i=R.trackingDerivation;R.trackingDerivation=e,R.inBatch++;var a;if(R.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(e){a=new nn(e)}return R.inBatch--,R.trackingDerivation=i,un(e),ln(e),hn(r),a}function ln(e){e.observing_.length===0&&(typeof e.requiresObservable_==`boolean`?e.requiresObservable_:R.reactionRequiresObservable)&&console.warn(`[mobx] Derivation '`+e.name_+`' is created/updated without reading any observable value.`)}function un(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=F.UP_TO_DATE_,i=0,a=e.unboundDepsCount_,o=0;o<a;o++){var s=n[o];s.diffValue===0&&(s.diffValue=1,i!==o&&(n[i]=s),i++),s.dependenciesState_>r&&(r=s.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){var c=t[a];c.diffValue===0&&Dn(c,e),c.diffValue=0}for(;i--;){var l=n[i];l.diffValue===1&&(l.diffValue=0,En(l,e))}r!==F.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function dn(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Dn(t[n],e);e.dependenciesState_=F.NOT_TRACKING_}function fn(e){var t=L();try{return e()}finally{pn(t)}}function L(){var e=R.trackingDerivation;return R.trackingDerivation=null,e}function pn(e){R.trackingDerivation=e}function mn(e){var t=R.allowStateReads;return R.allowStateReads=e,t}function hn(e){R.allowStateReads=e}function gn(e){if(e.dependenciesState_!==F.UP_TO_DATE_){e.dependenciesState_=F.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=F.UP_TO_DATE_}}var _n=[`mobxGuid`,`spyListeners`,`enforceActions`,`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`allowStateReads`,`disableErrorBoundaries`,`runId`,`UNCHANGED`,`useProxies`],vn=function(){this.version=6,this.UNCHANGED={},this.trackingDerivation=null,this.trackingContext=null,this.runId=0,this.mobxGuid=0,this.inBatch=0,this.pendingUnobservations=[],this.pendingReactions=[],this.isRunningReactions=!1,this.allowStateChanges=!1,this.allowStateReads=!0,this.enforceActions=!0,this.spyListeners=[],this.globalReactionErrorHandlers=[],this.computedRequiresReaction=!1,this.reactionRequiresObservable=!1,this.observableRequiresReaction=!1,this.disableErrorBoundaries=!1,this.suppressReactionErrors=!1,this.useProxies=!0,this.verifyProxies=!1,this.safeDescriptors=!0},yn=!0,bn=!1,R=function(){var e=i();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(yn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new vn().version&&(yn=!1),yn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new vn):(setTimeout(function(){bn||n(35)},1),new vn)}();function xn(){if((R.pendingReactions.length||R.inBatch||R.isRunningReactions)&&n(36),bn=!0,yn){var e=i();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),R=new vn}}function Sn(){return R}function Cn(){var e=new vn;for(var t in e)_n.indexOf(t)===-1&&(R[t]=e[t]);R.allowStateChanges=!R.enforceActions}function wn(e){return e.observers_&&e.observers_.size>0}function Tn(e){return e.observers_}function En(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Dn(e,t){e.observers_.delete(t),e.observers_.size===0&&On(e)}function On(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,R.pendingUnobservations.push(e))}function kn(){R.inBatch++}function An(){if(--R.inBatch===0){Bn();for(var e=R.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof $t&&n.suspend_())}R.pendingUnobservations=[]}}function jn(e){cn(e);var t=R.trackingDerivation;return t===null?(e.observers_.size===0&&R.inBatch>0&&On(e),!1):(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&R.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function Mn(e){e.lowestObserverState_!==F.STALE_&&(e.lowestObserverState_=F.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===F.UP_TO_DATE_&&(t.isTracing_!==tn.NONE&&z(t,e),t.onBecomeStale_()),t.dependenciesState_=F.STALE_}))}function Nn(e){e.lowestObserverState_!==F.STALE_&&(e.lowestObserverState_=F.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===F.POSSIBLY_STALE_?(t.dependenciesState_=F.STALE_,t.isTracing_!==tn.NONE&&z(t,e)):t.dependenciesState_===F.UP_TO_DATE_&&(e.lowestObserverState_=F.UP_TO_DATE_)}))}function Pn(e){e.lowestObserverState_===F.UP_TO_DATE_&&(e.lowestObserverState_=F.POSSIBLY_STALE_,e.observers_.forEach(function(e){e.dependenciesState_===F.UP_TO_DATE_&&(e.dependenciesState_=F.POSSIBLY_STALE_,e.onBecomeStale_())}))}function z(e,t){if(console.log(`[mobx.trace] '`+e.name_+`' is invalidated due to a change in: '`+t.name_+`'`),e.isTracing_===tn.BREAK){var n=[];Fn(wr(e),n,1),Function(`debugger;
67
67
  /*
68
68
  Tracing '`+e.name_+`'
69
69
 
@@ -71,30 +71,30 @@ You are entering this break point because derivation '`+e.name_+`' is being trac
71
71
  Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
72
72
  The stackframe you are looking for is at least ~6-8 stack-frames up.
73
73
 
74
- `+(e instanceof tn?e.derivation.toString().replace(/[*]\//g,`/`):``)+`
74
+ `+(e instanceof $t?e.derivation.toString().replace(/[*]\//g,`/`):``)+`
75
75
 
76
76
  The dependencies for this derivation are:
77
77
 
78
78
  `+n.join(`
79
79
  `)+`
80
80
  */
81
- `)()}}function Ln(e,t,n){if(t.length>=1e3){t.push(`(and many more)`);return}t.push(``+` `.repeat(n-1)+e.name),e.dependencies&&e.dependencies.forEach(function(e){return Ln(e,t,n+1)})}var Rn=function(){function e(e,t,n,r){e===void 0&&(e=`Reaction@`+h()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=N.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=rn.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,I.pendingReactions.push(this),Hn())},t.runReaction_=function(){if(!this.isDisposed){jn(),this.isScheduled=!1;var e=I.trackingContext;if(I.trackingContext=this,sn(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&Gn()&&Kn({name:this.name_,type:`scheduled-reaction`})}catch(e){this.reportExceptionInDerivation_(e)}}I.trackingContext=e,Mn()}},t.track=function(e){if(!this.isDisposed){jn();var t=Gn(),n;t&&(n=Date.now(),qn({name:this.name_,type:`reaction`})),this.isRunning=!0;var r=I.trackingContext;I.trackingContext=this;var i=P(this,e,void 0);I.trackingContext=r,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&pn(this),on(i)&&this.reportExceptionInDerivation_(i.cause),t&&Yn({time:Date.now()-n}),Mn()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_){this.errorHandler_(e,this);return}if(I.disableErrorBoundaries)throw e;var n=`[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '`+this+`'`;I.suppressReactionErrors?console.warn(`[mobx] (error in reaction '`+this.name_+`' suppressed, fix error of causing action below)`):console.error(n,e),Gn()&&Kn({type:`error`,name:this.name_,message:n,error:``+e}),I.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(jn(),pn(this),Mn()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),e==null||e.removeEventListener==null||e.removeEventListener(`abort`,n)};return e==null||e.addEventListener==null||e.addEventListener(`abort`,n),n[A]=this,`dispose`in Symbol&&typeof Symbol.dispose==`symbol`&&(n[Symbol.dispose]=n),n},t.toString=function(){return`Reaction[`+this.name_+`]`},t.trace=function(e){e===void 0&&(e=!1),li(this,e)},fe(e,[{key:`isDisposed`,get:function(){return se(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=ce(this.flags_,e.isDisposedMask_,t)}},{key:`isScheduled`,get:function(){return se(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=ce(this.flags_,e.isScheduledMask_,t)}},{key:`isTrackPending`,get:function(){return se(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=ce(this.flags_,e.isTrackPendingMask_,t)}},{key:`isRunning`,get:function(){return se(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=ce(this.flags_,e.isRunningMask_,t)}},{key:`diffValue`,get:function(){return+!!se(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=ce(this.flags_,e.diffValueMask_,t===1)}}])}();Rn.isDisposedMask_=1,Rn.isScheduledMask_=2,Rn.isTrackPendingMask_=4,Rn.isRunningMask_=8,Rn.diffValueMask_=16;function zn(e){return I.globalReactionErrorHandlers.push(e),function(){var t=I.globalReactionErrorHandlers.indexOf(e);t>=0&&I.globalReactionErrorHandlers.splice(t,1)}}var Bn=100,Vn=function(e){return e()};function Hn(){I.inBatch>0||I.isRunningReactions||Vn(Un)}function Un(){I.isRunningReactions=!0;for(var e=I.pendingReactions,t=0;e.length>0;){++t===Bn&&(console.error(`Reaction doesn't converge to a stable state after `+Bn+` iterations.`+(` Probably there is a cycle in the reactive function: `+e[0])),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}I.isRunningReactions=!1}var R=T(`Reaction`,Rn);function Wn(e){var t=Vn;Vn=function(n){return e(function(){return t(n)})}}function Gn(){return!!I.spyListeners.length}function Kn(e){if(I.spyListeners.length)for(var t=I.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function qn(e){Kn(me({},e,{spyReportStart:!0}))}var Jn={type:`report-end`,spyReportEnd:!0};function Yn(e){Kn(e?me({},e,{type:`report-end`,spyReportEnd:!0}):Jn)}function Xn(e){return I.spyListeners.push(e),g(function(){I.spyListeners=I.spyListeners.filter(function(t){return t!==e})})}var Zn=`action`,Qn=`action.bound`,$n=`autoAction`,er=`autoAction.bound`,tr=`<unnamed action>`,nr=Je(Zn),rr=Je(Qn,{bound:!0}),ir=Je($n,{autoAction:!0}),ar=Je(er,{autoAction:!0,bound:!0});function or(e){return function(t,r){if(v(t))return Gt(t.name||tr,t,e);if(v(r))return Gt(t,r,e);if(Oe(r))return(e?ir:nr).decorate_20223_(t,r);if(y(r))return Te(t,r,e?ir:nr);if(y(t))return we(Je(e?$n:Zn,{name:t,autoAction:e}));n("Invalid arguments for `action`")}}var sr=or(!1);Object.assign(sr,nr);var cr=or(!0);Object.assign(cr,ir),sr.bound=we(rr),cr.bound=we(ar);function lr(e){return Kt(e.name||tr,!1,e,this,void 0)}function ur(e){return v(e)&&e.isMobxAction===!0}function dr(e,t){var r;t===void 0&&(t=u),v(e)||n(`Autorun expects a function as first argument`),ur(e)&&n(`Autorun does not accept actions since actions are untrackable`);var i=t?.name??(e.name||`Autorun@`+h()),a=!t.scheduler&&!t.delay,o;if(a)o=new Rn(i,function(){this.track(l)},t.onError,t.requiresObservable);else{var s=pr(t),c=!1;o=new Rn(i,function(){c||(c=!0,s(function(){c=!1,o.isDisposed||o.track(l)}))},t.onError,t.requiresObservable)}function l(){e(o)}return(r=t)!=null&&(r=r.signal)!=null&&r.aborted||o.schedule_(),o.getDisposer_(t?.signal)}var fr=function(e){return e()};function pr(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:fr}function mr(e,t,r){var i;r===void 0&&(r=u),(!v(e)||!v(t))&&n(`First and second argument to reaction should be functions`),x(r)||n(`Third argument of reactions should be an object`);var a=r.name??`Reaction@`+h(),o=sr(a,r.onError?hr(r.onError,t):t),s=!r.scheduler&&!r.delay,c=pr(r),l=!0,d=!1,f,p=r.compareStructural?Le.structural:r.equals||Le.default,m=new Rn(a,function(){l||s?g():d||(d=!0,c(g))},r.onError,r.requiresObservable);function g(){if(d=!1,!m.isDisposed){var t=!1,n=f;m.track(function(){var n=Yt(!1,function(){return e(m)});t=l||!p(f,n),f=n}),(l&&r.fireImmediately||!l&&t)&&o(f,n,m),l=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||m.schedule_(),m.getDisposer_(r?.signal)}function hr(e,t){return function(){try{return t.apply(this,arguments)}catch(t){e.call(this,t)}}}var gr=`onBO`,_r=`onBUO`;function vr(e,t,n){return br(gr,e,t,n)}function yr(e,t,n){return br(_r,e,t,n)}function br(e,t,n,r){var i=typeof r==`function`?ma(t,n):ma(t),a=v(r)?r:n,o=e+`L`;return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),e.size===0&&delete i[o])}}var xr=`never`,Sr=`always`,Cr=`observed`;function wr(e){e.isolateGlobalState===!0&&Cn();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(I.useProxies=t===Sr?!0:t===xr?!1:typeof Proxy<`u`),t===`ifavailable`&&(I.verifyProxies=!0),n!==void 0){var r=n===Sr?Sr:n===Cr;I.enforceActions=r,I.allowStateChanges=!(r===!0||r===Sr)}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(function(t){t in e&&(I[t]=!!e[t])}),I.allowStateReads=!I.observableRequiresReaction,I.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&Wn(e.reactionScheduler)}function Tr(e,t,r,i){arguments.length>4&&n(`'extendObservable' expected 2-4 arguments`),typeof e!=`object`&&n(`'extendObservable' expects an object as first argument`),Hi(e)&&n(`'extendObservable' should not be used on maps, use map.merge instead`),x(t)||n(`'extendObservable' only accepts plain objects as second argument`),(qr(t)||qr(r))&&n(`Extending an object with another observable (object) is not supported`);var a=oe(t);return _a(function(){var t=Qi(e,i)[A];O(a).forEach(function(e){t.extend_(e,a[e],r&&e in r?r[e]:!0)})}),e}function Er(e,t){return Dr(ma(e,t))}function Dr(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Ar(e.observing_).map(Dr)),t}function Or(e,t){return kr(ma(e,t))}function kr(e){var t={name:e.name_};return En(e)&&(t.observers=Array.from(Dn(e)).map(kr)),t}function Ar(e){return Array.from(new Set(e))}var jr=0,Mr=function(e){function t(){var n=e.call(this,`FLOW_CANCELLED`)||this;return Object.setPrototypeOf(n,(this instanceof t?this.constructor:void 0).prototype),n.name=`FlowCancellationError`,n}ge(t,e);var n=t.prototype;return n.toString=function(){return`Error: `+this.message},t}(Se(Error));function Nr(e){return e instanceof Mr}var Pr=et(`flow`),Fr=et(`flow.bound`,{bound:!0}),Ir=Object.assign(function(e,t){if(Oe(t))return Pr.decorate_20223_(e,t);if(y(t))return Te(e,t,Pr);arguments.length!==1&&n(`Flow expects single argument with generator function`);var r=e,i=r.name||`<unnamed flow>`,a=function(){var e=this,t=arguments,n=++jr,a=sr(i+` - runid: `+n+` - init`,r).apply(e,t),o,s=void 0,c=new Promise(function(e,t){var r=0;o=t;function c(e){s=void 0;var o;try{o=sr(i+` - runid: `+n+` - yield `+ r++,a.next).call(a,e)}catch(e){return t(e)}u(o)}function l(e){s=void 0;var o;try{o=sr(i+` - runid: `+n+` - yield `+ r++,a.throw).call(a,e)}catch(e){return t(e)}u(o)}function u(n){if(v(n?.then)){n.then(u,t);return}return n.done?e(n.value):(s=Promise.resolve(n.value),s.then(c,l))}c(void 0)});return c.cancel=sr(i+` - runid: `+n+` - cancel`,function(){try{s&&Lr(s);var e=a.return(void 0),t=Promise.resolve(e.value);t.then(_,_),Lr(t),o(new Mr)}catch(e){o(e)}}),c};return a.isMobXFlow=!0,a},Pr);Ir.bound=we(Fr);function Lr(e){v(e.cancel)&&e.cancel()}function Rr(e){return e}function zr(e){return e?.isMobXFlow===!0}function Br(e,t,r){var i;if(Hi(e)||Li(e)||en(e))i=ha(e);else if(ta(e)){if(!y(t))return n(`InterceptReads can only be used with a specific property, not with an object in general`);i=ha(e,t)}else return n(`Expected observable map, object or array as first array`);return i.dehancer===void 0?(i.dehancer=typeof t==`function`?t:r,function(){i.dehancer=void 0}):n(`An intercept reader was already established`)}function Vr(e,t,n){return v(n)?Ur(e,t,n):Hr(e,t)}function Hr(e,t){return ha(e).intercept_(t)}function Ur(e,t,n){return ha(e,t).intercept_(n)}function Wr(e,t){return t===void 0?nn(e):ta(e)===!1||!e[A].values_.has(t)?!1:nn(ma(e,t))}function z(e){return arguments.length>1?n(`isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property`):Wr(e)}function Gr(e,t){return y(t)?Wr(e,t):n(`isComputed expected a property name as second argument`)}function Kr(e,t){return e?t===void 0?ta(e)||!!e[A]||je(e)||R(e)||nn(e):Hi(e)||Li(e)?n(`isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.`):ta(e)?e[A].values_.has(t):!1:!1}function qr(e){return arguments.length!==1&&n(`isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property`),Kr(e)}function Jr(e,t){return y(t)?Kr(e,t):n(`expected a property name as second argument`)}function Yr(e){if(ta(e))return e[A].keys_();if(Hi(e)||qi(e))return Array.from(e.keys());if(Li(e))return e.map(function(e,t){return t});n(5)}function Xr(e){if(ta(e))return Yr(e).map(function(t){return e[t]});if(Hi(e))return Yr(e).map(function(t){return e.get(t)});if(qi(e))return Array.from(e.values());if(Li(e))return e.slice();n(6)}function Zr(e){if(ta(e))return Yr(e).map(function(t){return[t,e[t]]});if(Hi(e))return Yr(e).map(function(t){return[t,e.get(t)]});if(qi(e))return Array.from(e.entries());if(Li(e))return e.map(function(e,t){return[t,e]});n(7)}function Qr(e,t,r){if(arguments.length===2&&!qi(e)){jn();var i=t;try{for(var a in i)Qr(e,a,i[a])}finally{Mn()}return}ta(e)?e[A].set_(t,r):Hi(e)?e.set(t,r):qi(e)?e.add(t):Li(e)?(typeof t!=`number`&&(t=parseInt(t,10)),t<0&&n(`Invalid index: '`+t+`'`),jn(),t>=e.length&&(e.length=t+1),e[t]=r,Mn()):n(8)}function $r(e,t){ta(e)?e[A].delete_(t):Hi(e)||qi(e)?e.delete(t):Li(e)?(typeof t!=`number`&&(t=parseInt(t,10)),e.splice(t,1)):n(9)}function ei(e,t){if(ta(e))return e[A].has_(t);if(Hi(e)||qi(e))return e.has(t);if(Li(e))return t>=0&&t<e.length;n(10)}function ti(e,t){if(ei(e,t)){if(ta(e))return e[A].get_(t);if(Hi(e))return e.get(t);if(Li(e))return e[t];n(11)}}function ni(e,t,r){if(ta(e))return e[A].defineProperty_(t,r);n(39)}function ri(e){if(ta(e))return e[A].ownKeys_();n(38)}function ii(e,t,n,r){return v(n)?ai(e,t,n,r):B(e,t,n)}function B(e,t,n){return ha(e).observe_(t,n)}function ai(e,t,n,r){return ha(e,t).observe_(n,r)}function oi(e,t,n){return e.set(t,n),n}function si(e,t){if(typeof e!=`object`||!e||e instanceof Date||!qr(e))return e;if(en(e)||nn(e))return si(e.get(),t);if(t.has(e))return t.get(e);if(Li(e)){var n=oi(t,e,Array(e.length));return e.forEach(function(e,r){n[r]=si(e,t)}),n}if(qi(e)){var r=oi(t,e,new Set);return e.forEach(function(e){r.add(si(e,t))}),r}if(Hi(e)){var i=oi(t,e,new Map);return e.forEach(function(e,n){i.set(n,si(e,t))}),i}else{var a=oi(t,e,{});return ri(e).forEach(function(n){c.propertyIsEnumerable.call(e,n)&&(a[n]=si(e[n],t))}),a}}function ci(e,t){return t&&n(`toJS no longer supports options`),si(e,new Map)}function li(){var e=!1,t=[...arguments];typeof t[t.length-1]==`boolean`&&(e=t.pop());var r=ui(t);if(!r)return n(`'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly`);r.isTracing_===rn.NONE&&console.log(`[mobx.trace] '`+r.name_+`' tracing enabled`),r.isTracing_=e?rn.BREAK:rn.LOG}function ui(e){switch(e.length){case 0:return I.trackingDerivation;case 1:return ma(e[0]);case 2:return ma(e[0],e[1])}}function di(e,t){t===void 0&&(t=void 0),jn();try{return e.apply(t)}finally{Mn()}}function fi(e,t,n){return arguments.length===1||t&&typeof t==`object`?mi(e,t):pi(e,t,n||{})}function pi(e,t,n){var r;if(typeof n.timeout==`number`){var i=Error(`WHEN_TIMEOUT`);r=setTimeout(function(){if(!o[A].isDisposed)if(o(),n.onError)n.onError(i);else throw i},n.timeout)}n.name=n.name||`When@`+h();var a=Gt(n.name+`-effect`,t),o=dr(function(t){Yt(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())},n);return o}function mi(e,t){var r;if(t&&t.onError)return n(`the options 'onError' and 'promise' cannot be combined`);if(t!=null&&(r=t.signal)!=null&&r.aborted)return Object.assign(Promise.reject(Error(`WHEN_ABORTED`)),{cancel:function(){return null}});var i,a,o=new Promise(function(n,r){var o,s=pi(e,n,me({},t,{onError:r}));i=function(){s(),r(Error(`WHEN_CANCELLED`))},a=function(){s(),r(Error(`WHEN_ABORTED`))},t==null||(o=t.signal)==null||o.addEventListener==null||o.addEventListener(`abort`,a)}).finally(function(){var e;return t==null||(e=t.signal)==null||e.removeEventListener==null?void 0:e.removeEventListener(`abort`,a)});return o.cancel=i,o}function hi(e){return e[A]}var gi={has:function(e,t){return I.trackingDerivation&&m(`detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.`),hi(e).has_(t)},get:function(e,t){return hi(e).get_(t)},set:function(e,t,n){return y(t)?(hi(e).values_.has(t)||m(`add a new observable property through direct assignment. Use 'set' from 'mobx' instead.`),hi(e).set_(t,n,!0)??!0):!1},deleteProperty:function(e,t){return m(`delete properties from an observable object. Use 'remove' from 'mobx' instead.`),y(t)?hi(e).delete_(t,!0)??!0:!1},defineProperty:function(e,t,n){return m(`define property on an observable object. Use 'defineProperty' from 'mobx' instead.`),hi(e).defineProperty_(t,n)??!0},ownKeys:function(e){return I.trackingDerivation&&m(`iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.`),hi(e).ownKeys_()},preventExtensions:function(e){n(13)}};function _i(e,t){var n;return p(),e=Qi(e,t),(n=e[A]).proxy_??(n.proxy_=new Proxy(e,gi))}function vi(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function yi(e,t){var n=e.interceptors_||=[];return n.push(t),g(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function bi(e,t){var r=F();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a<o&&(t=i[a](t),t&&!t.type&&n(14),t);a++);return t}finally{hn(r)}}function xi(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Si(e,t){var n=e.changeListeners_||=[];return n.push(t),g(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function Ci(e,t){var n=F(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,a=r.length;i<a;i++)r[i](t);hn(n)}}function wi(e,t,r){return _a(function(){var i=Qi(e,r)[A];t&&e[Ce]&&n(`makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.`),t??=De(e),O(t).forEach(function(e){return i.make_(e,t[e])})}),e}var Ti=Symbol(`mobx-keys`);function Ei(e,t,r){return!x(e)&&!x(Object.getPrototypeOf(e))&&n(`'makeAutoObservable' can only be used for classes that don't have a superclass`),ta(e)&&n(`makeAutoObservable can only be used on objects not already made observable`),x(e)?Tr(e,e,t,r):(_a(function(){var n=Qi(e,r)[A];if(!e[Ti]){var i=Object.getPrototypeOf(e),a=new Set([].concat(O(e),O(i)));a.delete(`constructor`),a.delete(A),C(i,Ti,a)}e[Ti].forEach(function(e){return n.make_(e,t&&e in t?t[e]:!0)})}),e)}var Di=`splice`,Oi=`update`,ki=1e4,Ai={get:function(e,t){var n=e[A];return t===A?n:t===`length`?n.getArrayLength_():typeof t==`string`&&!isNaN(t)?n.get_(parseInt(t)):ae(V,t)?V[t]:e[t]},set:function(e,t,n){var r=e[A];return t===`length`&&r.setArrayLength_(n),typeof t==`symbol`||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){n(15)}},ji=function(){function e(e,t,n,r){e===void 0&&(e=`ObservableArray@`+h()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.legacyMode_=r,this.atom_=new Ae(e),this.enhancer_=function(n,r){return t(n,r,e+`[..]`)}}var t=e.prototype;return t.dehanceValue_=function(e){return this.dehancer===void 0?e:this.dehancer(e)},t.dehanceValues_=function(e){return this.dehancer!==void 0&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return yi(this,e)},t.observe_=function(e,t){return t===void 0&&(t=!1),t&&e({observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:`splice`,index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Si(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){(typeof e!=`number`||isNaN(e)||e<0)&&n(`Out of range: `+e);var t=this.values_.length;if(e!==t)if(e>t){for(var r=Array(e-t),i=0;i<e-t;i++)r[i]=void 0;this.spliceWithArray_(t,0,r)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&n(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&fa(e+t+1)},t.spliceWithArray_=function(e,t,n){var r=this;ln(this.atom_);var i=this.values_.length;if(e===void 0?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=arguments.length===1?i-e:t==null?0:Math.max(0,Math.min(t,i-e)),n===void 0&&(n=l),vi(this)){var a=bi(this,{object:this.proxy_,type:Di,index:e,removedCount:t,added:n});if(!a)return l;t=a.removedCount,n=a.added}if(n=n.length===0?n:n.map(function(e){return r.enhancer_(e,void 0)}),this.legacyMode_||!0){var o=n.length-t;this.updateArrayLength_(i,o)}var s=this.spliceItemsIntoValues_(e,t,n);return(t!==0||n.length!==0)&&this.notifyArraySplice_(e,n,s),this.dehanceValues_(s)},t.spliceItemsIntoValues_=function(e,t,n){if(n.length<ki){var r;return(r=this.values_).splice.apply(r,[e,t].concat(n))}else{var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var o=0;o<n.length;o++)this.values_[e+o]=n[o];for(var s=0;s<a.length;s++)this.values_[e+n.length+s]=a[s];return i}},t.notifyArrayChildUpdate_=function(e,t,n){var r=!this.owned_&&Gn(),i=xi(this),a=i||r?{observableKind:`array`,object:this.proxy_,type:Oi,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;r&&qn(a),this.atom_.reportChanged(),i&&Ci(this,a),r&&Yn()},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&Gn(),i=xi(this),a=i||r?{observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:Di,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&qn(a),this.atom_.reportChanged(),i&&Ci(this,a),r&&Yn()},t.get_=function(e){if(this.legacyMode_&&e>=this.values_.length){console.warn(`[mobx.array] Attempt to read an array index (`+e+`) that is out of bounds (`+this.values_.length+`). Please check length first. Out of bound indices will not be tracked by MobX`);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e])},t.set_=function(e,t){var r=this.values_;if(this.legacyMode_&&e>r.length&&n(17,e,r.length),e<r.length){ln(this.atom_);var i=r[e];if(vi(this)){var a=bi(this,{type:Oi,object:this.proxy_,index:e,newValue:t});if(!a)return;t=a.newValue}t=this.enhancer_(t,i),t!==i&&(r[e]=t,this.notifyArrayChildUpdate_(e,t,i))}else{for(var o=Array(e+1-r.length),s=0;s<o.length-1;s++)o[s]=void 0;o[o.length-1]=t,this.spliceWithArray_(r.length,0,o)}},e}();function Mi(e,t,n,r){return n===void 0&&(n=`ObservableArray@`+h()),r===void 0&&(r=!1),p(),_a(function(){var i=new ji(n,t,r,!1);w(i.values_,A,i);var a=new Proxy(i.values_,Ai);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var V={clear:function(){return this.splice(0)},replace:function(e){var t=this[A];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){var n=[...arguments].slice(2),r=this[A];switch(arguments.length){case 0:return[];case 1:return r.spliceWithArray_(e);case 2:return r.spliceWithArray_(e,t)}return r.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,n){return this[A].spliceWithArray_(e,t,n)},push:function(){var e=this[A],t=[...arguments];return e.spliceWithArray_(e.values_.length,0,t),e.values_.length},pop:function(){return this.splice(Math.max(this[A].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){var e=this[A],t=[...arguments];return e.spliceWithArray_(0,0,t),e.values_.length},reverse:function(){return I.trackingDerivation&&n(37,`reverse`),this.replace(this.slice().reverse()),this},sort:function(){I.trackingDerivation&&n(37,`sort`);var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[A],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1?(this.splice(n,1),!0):!1}};H(`at`,Ni),H(`concat`,Ni),H(`flat`,Ni),H(`includes`,Ni),H(`indexOf`,Ni),H(`join`,Ni),H(`lastIndexOf`,Ni),H(`slice`,Ni),H(`toString`,Ni),H(`toLocaleString`,Ni),H(`toSorted`,Ni),H(`toSpliced`,Ni),H(`with`,Ni),H(`every`,Pi),H(`filter`,Pi),H(`find`,Pi),H(`findIndex`,Pi),H(`findLast`,Pi),H(`findLastIndex`,Pi),H(`flatMap`,Pi),H(`forEach`,Pi),H(`map`,Pi),H(`some`,Pi),H(`toReversed`,Pi),H(`reduce`,Fi),H(`reduceRight`,Fi);function H(e,t){typeof Array.prototype[e]==`function`&&(V[e]=t(e))}function Ni(e){return function(){var t=this[A];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Pi(e){return function(t,n){var r=this,i=this[A];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(n,e,i,r)})}}function Fi(e){return function(){var t=this,n=this[A];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}var Ii=T(`ObservableArrayAdministration`,ji);function Li(e){return b(e)&&Ii(e[A])}var Ri={},zi=`add`,Bi=`delete`,Vi=function(){function e(e,t,r){var i=this;t===void 0&&(t=Re),r===void 0&&(r=`ObservableMap@`+h()),this.enhancer_=void 0,this.name_=void 0,this[A]=Ri,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=r,v(Map)||n(18),_a(function(){i.keysAtom_=Me(i.name_+`.keys()`),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!I.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new $t(this.has_(e),Be,this.name_+`.`+re(e)+`?`,!1);this.hasMap_.set(e,r),yr(r,function(){return t.hasMap_.delete(e)})}return n.get()},t.set=function(e,t){var n=this.has_(e);if(vi(this)){var r=bi(this,{type:n?Oi:zi,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(ln(this.keysAtom_),vi(this)&&!bi(this,{type:Bi,object:this,name:e}))return!1;if(this.has_(e)){var n=Gn(),r=xi(this),i=r||n?{observableKind:`map`,debugObjectName:this.name_,type:Bi,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return n&&qn(i),di(function(){var n;t.keysAtom_.reportChanged(),(n=t.hasMap_.get(e))==null||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),r&&Ci(this,i),n&&Yn(),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==I.UNCHANGED){var r=Gn(),i=xi(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:Oi,object:this,oldValue:n.value_,name:e,newValue:t}:null;r&&qn(a),n.setNewValue_(t),i&&Ci(this,a),r&&Yn()}},t.addValue_=function(e,t){var n=this;ln(this.keysAtom_),di(function(){var r,i=new $t(t,n.enhancer_,n.name_+`.`+re(e),!1);n.data_.set(e,i),t=i.value_,(r=n.hasMap_.get(e))==null||r.setNewValue_(!0),n.keysAtom_.reportChanged()});var r=Gn(),i=xi(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:zi,object:this,name:e,newValue:t}:null;r&&qn(a),i&&Ci(this,a),r&&Yn()},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return this.dehancer===void 0?e:this.dehancer(e)},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return Ui({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return Ui({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var n=pe(this),r;!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Hi(e)&&(e=new Map(e)),di(function(){x(e)?D(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],r=e[1];return t.set(n,r)}):ee(e)?(te(e)||n(19,e),e.forEach(function(e,n){return t.set(n,e)})):e!=null&&n(20,e)}),this},t.clear=function(){var e=this;di(function(){mn(function(){for(var t=pe(e.keys()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.replace=function(e){var t=this;return di(function(){for(var n=Wi(e),r=new Map,i=!1,a=pe(t.data_.keys()),o;!(o=a()).done;){var s=o.value;if(!n.has(s))if(t.delete(s))i=!0;else{var c=t.data_.get(s);r.set(s,c)}}for(var l=pe(n.entries()),u;!(u=l()).done;){var d=u.value,f=d[0],p=d[1],m=t.data_.has(f);if(t.set(f,p),t.data_.has(f)){var h=t.data_.get(f);r.set(f,h),m||(i=!0)}}if(!i)if(t.data_.size!==r.size)t.keysAtom_.reportChanged();else for(var g=t.data_.keys(),_=r.keys(),v=g.next(),y=_.next();!v.done;){if(v.value!==y.value){t.keysAtom_.reportChanged();break}v=g.next(),y=_.next()}t.data_=r}),this},t.toString=function(){return`[object ObservableMap]`},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return t===!0&&n("`observe` doesn't support fireImmediately=true in combination with maps."),Si(this,e)},t.intercept_=function(e){return yi(this,e)},fe(e,[{key:`size`,get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Map`}}])}(),Hi=T(`ObservableMap`,Vi);function Ui(e){return e[Symbol.toStringTag]=`MapIterator`,Ca(e)}function Wi(e){if(ee(e)||Hi(e))return e;if(Array.isArray(e))return new Map(e);if(x(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return n(21,e)}var Gi={},Ki=function(){function e(e,t,r){var i=this;t===void 0&&(t=Re),r===void 0&&(r=`ObservableSet@`+h()),this.name_=void 0,this[A]=Gi,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||n(22),this.enhancer_=function(e,n){return t(e,n,r)},_a(function(){i.atom_=Me(i.name_),e&&i.replace(e)})}var t=e.prototype;return t.dehanceValue_=function(e){return this.dehancer===void 0?e:this.dehancer(e)},t.clear=function(){var e=this;di(function(){mn(function(){for(var t=pe(e.data_.values()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.forEach=function(e,t){for(var n=pe(this),r;!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(ln(this.atom_),vi(this)){var n=bi(this,{type:zi,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){di(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var r=Gn(),i=xi(this),a=i||r?{observableKind:`set`,debugObjectName:this.name_,type:zi,object:this,newValue:e}:null;r&&qn(a),i&&Ci(this,a),r&&Yn()}return this},t.delete=function(e){var t=this;if(vi(this)&&!bi(this,{type:Bi,object:this,oldValue:e}))return!1;if(this.has(e)){var n=Gn(),r=xi(this),i=r||n?{observableKind:`set`,debugObjectName:this.name_,type:Bi,object:this,oldValue:e}:null;return n&&qn(i),di(function(){t.atom_.reportChanged(),t.data_.delete(e)}),r&&Ci(this,i),n&&Yn(),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=this.values();return Ji({next:function(){var t=e.next(),n=t.value,r=t.done;return r?{value:void 0,done:r}:{value:[n,n],done:r}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return Ji({next:function(){var n=t.next(),r=n.value,i=n.done;return i?{value:void 0,done:i}:{value:e.dehanceValue_(r),done:i}}})},t.intersection=function(e){return E(e)&&!qi(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return E(e)&&!qi(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return E(e)&&!qi(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},t.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},t.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},t.isDisjointFrom=function(e){return E(e)&&!qi(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return qi(e)&&(e=new Set(e)),di(function(){Array.isArray(e)||E(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):e!=null&&n(`Cannot initialize set from `+e)}),this},t.observe_=function(e,t){return t===!0&&n("`observe` doesn't support fireImmediately=true in combination with sets."),Si(this,e)},t.intercept_=function(e){return yi(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return`[object ObservableSet]`},t[Symbol.iterator]=function(){return this.values()},fe(e,[{key:`size`,get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Set`}}])}(),qi=T(`ObservableSet`,Ki);function Ji(e){return e[Symbol.toStringTag]=`SetIterator`,Ca(e)}var Yi=Object.create(null),Xi=`remove`,Zi=function(){function e(e,t,r,i){t===void 0&&(t=new Map),i===void 0&&(i=_t),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=e,this.values_=t,this.name_=r,this.defaultAnnotation_=i,this.keysAtom_=new Ae(this.name_+`.keys`),this.isPlainObject_=x(this.target_),Ta(this.defaultAnnotation_)||n(`defaultAnnotation must be valid annotation`),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var n=this.values_.get(e);if(n instanceof tn)return n.set(t),!0;if(vi(this)){var r=bi(this,{type:Oi,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if(t=n.prepareNewValue_(t),t!==I.UNCHANGED){var i=xi(this),a=Gn(),o=i||a?{type:Oi,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;a&&qn(o),n.setNewValue_(t),i&&Ci(this,o),a&&Yn()}return!0},t.get_=function(e){return I.trackingDerivation&&!ae(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return n===void 0&&(n=!1),ae(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!I.trackingDerivation)return e in this.target_;this.pendingKeys_||=new Map;var t=this.pendingKeys_.get(e);return t||(t=new $t(e in this.target_,Be,this.name_+`.`+re(e)+`?`,!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(t===!0&&(t=this.defaultAnnotation_),t!==!1){if(ra(this,t,e),!(e in this.target_)){var r;if((r=this.target_[Ce])!=null&&r[e])return;n(1,t.annotationType_,this.name_+`.`+e.toString())}for(var i=this.target_;i&&i!==c;){var a=o(i,e);if(a){var s=t.make_(this,e,a,i);if(s===0)return;if(s===1)break}i=Object.getPrototypeOf(i)}na(this,t,e)}},t.extend_=function(e,t,n,r){if(r===void 0&&(r=!1),n===!0&&(n=this.defaultAnnotation_),n===!1)return this.defineProperty_(e,t,r);ra(this,n,e);var i=n.extend_(this,e,t,r);return i&&na(this,n,e),i},t.defineProperty_=function(e,t,n){n===void 0&&(n=!1),ln(this.keysAtom_);try{jn();var r=this.delete_(e);if(!r)return r;if(vi(this)){var i=bi(this,{object:this.proxy_||this.target_,name:e,type:zi,newValue:t.value});if(!i)return null;var a=i.newValue;t.value!==a&&(t=me({},t,{value:a}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else s(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{Mn()}return!0},t.defineObservableProperty_=function(e,t,n,r){r===void 0&&(r=!1),ln(this.keysAtom_);try{jn();var i=this.delete_(e);if(!i)return i;if(vi(this)){var a=bi(this,{object:this.proxy_||this.target_,name:e,type:zi,newValue:t});if(!a)return null;t=a.newValue}var o=ea(e),c={configurable:I.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.target_,e,c))return!1}else s(this.target_,e,c);var l=new $t(t,n,this.name_+`.`+e.toString(),!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{Mn()}return!0},t.defineComputedProperty_=function(e,t,n){n===void 0&&(n=!1),ln(this.keysAtom_);try{jn();var r=this.delete_(e);if(!r)return r;if(vi(this)&&!bi(this,{object:this.proxy_||this.target_,name:e,type:zi,newValue:void 0}))return null;t.name||=this.name_+`.`+e.toString(),t.context=this.proxy_||this.target_;var i=ea(e),a={configurable:I.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,a))return!1}else s(this.target_,e,a);this.values_.set(e,new tn(t)),this.notifyPropertyAddition_(e,void 0)}finally{Mn()}return!0},t.delete_=function(e,t){if(t===void 0&&(t=!1),ln(this.keysAtom_),!ae(this.target_,e))return!0;if(vi(this)&&!bi(this,{object:this.proxy_||this.target_,name:e,type:Xi}))return null;try{var n;jn();var r=xi(this),i=Gn(),a=this.values_.get(e),s=void 0;if(!a&&(r||i)&&(s=o(this.target_,e)?.value),t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(delete this.appliedAnnotations_[e],a&&(this.values_.delete(e),a instanceof $t&&(s=a.value_),Pn(a)),this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r||i){var c={type:Xi,observableKind:`object`,object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:s,name:e};i&&qn(c),r&&Ci(this,c),i&&Yn()}}finally{Mn()}return!0},t.observe_=function(e,t){return t===!0&&n("`observe` doesn't support the fire immediately property for observable objects."),Si(this,e)},t.intercept_=function(e){return yi(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r=xi(this),i=Gn();if(r||i){var a=r||i?{type:zi,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;i&&qn(a),r&&Ci(this,a),i&&Yn()}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),O(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Qi(e,t){if(t&&ta(e)&&n(`Options can't be provided for already observable objects.`),ae(e,A))return ha(e)instanceof Zi||n(`Cannot convert '`+ga(e)+`' into observable object:
81
+ `)()}}function Fn(e,t,n){if(t.length>=1e3){t.push(`(and many more)`);return}t.push(``+` `.repeat(n-1)+e.name),e.dependencies&&e.dependencies.forEach(function(e){return Fn(e,t,n+1)})}var In=function(){function e(e,t,n,r){e===void 0&&(e=`Reaction@`+h()),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=F.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=tn.NONE,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,R.pendingReactions.push(this),Bn())},t.runReaction_=function(){if(!this.isDisposed){kn(),this.isScheduled=!1;var e=R.trackingContext;if(R.trackingContext=this,an(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&Un()&&Wn({name:this.name_,type:`scheduled-reaction`})}catch(e){this.reportExceptionInDerivation_(e)}}R.trackingContext=e,An()}},t.track=function(e){if(!this.isDisposed){kn();var t=Un(),n;t&&(n=Date.now(),Gn({name:this.name_,type:`reaction`})),this.isRunning=!0;var r=R.trackingContext;R.trackingContext=this;var i=I(this,e,void 0);R.trackingContext=r,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&dn(this),rn(i)&&this.reportExceptionInDerivation_(i.cause),t&&qn({time:Date.now()-n}),An()}},t.reportExceptionInDerivation_=function(e){var t=this;if(this.errorHandler_){this.errorHandler_(e,this);return}if(R.disableErrorBoundaries)throw e;var n=`[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '`+this+`'`;R.suppressReactionErrors?console.warn(`[mobx] (error in reaction '`+this.name_+`' suppressed, fix error of causing action below)`):console.error(n,e),Un()&&Wn({type:`error`,name:this.name_,message:n,error:``+e}),R.globalReactionErrorHandlers.forEach(function(n){return n(e,t)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(kn(),dn(this),An()))},t.getDisposer_=function(e){var t=this,n=function n(){t.dispose(),e==null||e.removeEventListener==null||e.removeEventListener(`abort`,n)};return e==null||e.addEventListener==null||e.addEventListener(`abort`,n),n[A]=this,`dispose`in Symbol&&typeof Symbol.dispose==`symbol`&&(n[Symbol.dispose]=n),n},t.toString=function(){return`Reaction[`+this.name_+`]`},t.trace=function(e){e===void 0&&(e=!1),si(this,e)},fe(e,[{key:`isDisposed`,get:function(){return se(this.flags_,e.isDisposedMask_)},set:function(t){this.flags_=ce(this.flags_,e.isDisposedMask_,t)}},{key:`isScheduled`,get:function(){return se(this.flags_,e.isScheduledMask_)},set:function(t){this.flags_=ce(this.flags_,e.isScheduledMask_,t)}},{key:`isTrackPending`,get:function(){return se(this.flags_,e.isTrackPendingMask_)},set:function(t){this.flags_=ce(this.flags_,e.isTrackPendingMask_,t)}},{key:`isRunning`,get:function(){return se(this.flags_,e.isRunningMask_)},set:function(t){this.flags_=ce(this.flags_,e.isRunningMask_,t)}},{key:`diffValue`,get:function(){return+!!se(this.flags_,e.diffValueMask_)},set:function(t){this.flags_=ce(this.flags_,e.diffValueMask_,t===1)}}])}();In.isDisposedMask_=1,In.isScheduledMask_=2,In.isTrackPendingMask_=4,In.isRunningMask_=8,In.diffValueMask_=16;function Ln(e){return R.globalReactionErrorHandlers.push(e),function(){var t=R.globalReactionErrorHandlers.indexOf(e);t>=0&&R.globalReactionErrorHandlers.splice(t,1)}}var Rn=100,zn=function(e){return e()};function Bn(){R.inBatch>0||R.isRunningReactions||zn(Vn)}function Vn(){R.isRunningReactions=!0;for(var e=R.pendingReactions,t=0;e.length>0;){++t===Rn&&(console.error(`Reaction doesn't converge to a stable state after `+Rn+` iterations.`+(` Probably there is a cycle in the reactive function: `+e[0])),e.splice(0));for(var n=e.splice(0),r=0,i=n.length;r<i;r++)n[r].runReaction_()}R.isRunningReactions=!1}var B=T(`Reaction`,In);function Hn(e){var t=zn;zn=function(n){return e(function(){return t(n)})}}function Un(){return!!R.spyListeners.length}function Wn(e){if(R.spyListeners.length)for(var t=R.spyListeners,n=0,r=t.length;n<r;n++)t[n](e)}function Gn(e){Wn(me({},e,{spyReportStart:!0}))}var Kn={type:`report-end`,spyReportEnd:!0};function qn(e){Wn(e?me({},e,{type:`report-end`,spyReportEnd:!0}):Kn)}function Jn(e){return R.spyListeners.push(e),g(function(){R.spyListeners=R.spyListeners.filter(function(t){return t!==e})})}var Yn=`action`,Xn=`action.bound`,Zn=`autoAction`,Qn=`autoAction.bound`,$n=`<unnamed action>`,er=Je(Yn),tr=Je(Xn,{bound:!0}),nr=Je(Zn,{autoAction:!0}),rr=Je(Qn,{autoAction:!0,bound:!0});function ir(e){return function(t,r){if(v(t))return Ut(t.name||$n,t,e);if(v(r))return Ut(t,r,e);if(Oe(r))return(e?nr:er).decorate_20223_(t,r);if(y(r))return Te(t,r,e?nr:er);if(y(t))return we(Je(e?Zn:Yn,{name:t,autoAction:e}));n("Invalid arguments for `action`")}}var ar=ir(!1);Object.assign(ar,er);var or=ir(!0);Object.assign(or,nr),ar.bound=we(tr),or.bound=we(rr);function sr(e){return Wt(e.name||$n,!1,e,this,void 0)}function cr(e){return v(e)&&e.isMobxAction===!0}function lr(e,t){var r;t===void 0&&(t=u),v(e)||n(`Autorun expects a function as first argument`),cr(e)&&n(`Autorun does not accept actions since actions are untrackable`);var i=t?.name??(e.name||`Autorun@`+h()),a=!t.scheduler&&!t.delay,o;if(a)o=new In(i,function(){this.track(l)},t.onError,t.requiresObservable);else{var s=dr(t),c=!1;o=new In(i,function(){c||(c=!0,s(function(){c=!1,o.isDisposed||o.track(l)}))},t.onError,t.requiresObservable)}function l(){e(o)}return(r=t)!=null&&(r=r.signal)!=null&&r.aborted||o.schedule_(),o.getDisposer_(t?.signal)}var ur=function(e){return e()};function dr(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:ur}function fr(e,t,r){var i;r===void 0&&(r=u),(!v(e)||!v(t))&&n(`First and second argument to reaction should be functions`),x(r)||n(`Third argument of reactions should be an object`);var a=r.name??`Reaction@`+h(),o=ar(a,r.onError?pr(r.onError,t):t),s=!r.scheduler&&!r.delay,c=dr(r),l=!0,d=!1,f,p=r.compareStructural?Le.structural:r.equals||Le.default,m=new In(a,function(){l||s?g():d||(d=!0,c(g))},r.onError,r.requiresObservable);function g(){if(d=!1,!m.isDisposed){var t=!1,n=f;m.track(function(){var n=qt(!1,function(){return e(m)});t=l||!p(f,n),f=n}),(l&&r.fireImmediately||!l&&t)&&o(f,n,m),l=!1}}return(i=r)!=null&&(i=i.signal)!=null&&i.aborted||m.schedule_(),m.getDisposer_(r?.signal)}function pr(e,t){return function(){try{return t.apply(this,arguments)}catch(t){e.call(this,t)}}}var mr=`onBO`,hr=`onBUO`;function gr(e,t,n){return vr(mr,e,t,n)}function _r(e,t,n){return vr(hr,e,t,n)}function vr(e,t,n,r){var i=typeof r==`function`?fa(t,n):fa(t),a=v(r)?r:n,o=e+`L`;return i[o]?i[o].add(a):i[o]=new Set([a]),function(){var e=i[o];e&&(e.delete(a),e.size===0&&delete i[o])}}var yr=`never`,br=`always`,xr=`observed`;function Sr(e){e.isolateGlobalState===!0&&xn();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(R.useProxies=t===br?!0:t===yr?!1:typeof Proxy<`u`),t===`ifavailable`&&(R.verifyProxies=!0),n!==void 0){var r=n===br?br:n===xr;R.enforceActions=r,R.allowStateChanges=!(r===!0||r===br)}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(function(t){t in e&&(R[t]=!!e[t])}),R.allowStateReads=!R.observableRequiresReaction,R.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&Hn(e.reactionScheduler)}function Cr(e,t,r,i){arguments.length>4&&n(`'extendObservable' expected 2-4 arguments`),typeof e!=`object`&&n(`'extendObservable' expects an object as first argument`),Bi(e)&&n(`'extendObservable' should not be used on maps, use map.merge instead`),x(t)||n(`'extendObservable' only accepts plain objects as second argument`),(Gr(t)||Gr(r))&&n(`Extending an object with another observable (object) is not supported`);var a=oe(t);return ha(function(){var t=Xi(e,i)[A];O(a).forEach(function(e){t.extend_(e,a[e],r&&e in r?r[e]:!0)})}),e}function wr(e,t){return Tr(fa(e,t))}function Tr(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Or(e.observing_).map(Tr)),t}function Er(e,t){return Dr(fa(e,t))}function Dr(e){var t={name:e.name_};return wn(e)&&(t.observers=Array.from(Tn(e)).map(Dr)),t}function Or(e){return Array.from(new Set(e))}var kr=0,Ar=function(e){function t(){var n=e.call(this,`FLOW_CANCELLED`)||this;return Object.setPrototypeOf(n,(this instanceof t?this.constructor:void 0).prototype),n.name=`FlowCancellationError`,n}ge(t,e);var n=t.prototype;return n.toString=function(){return`Error: `+this.message},t}(Se(Error));function jr(e){return e instanceof Ar}var Mr=et(`flow`),Nr=et(`flow.bound`,{bound:!0}),Pr=Object.assign(function(e,t){if(Oe(t))return Mr.decorate_20223_(e,t);if(y(t))return Te(e,t,Mr);arguments.length!==1&&n(`Flow expects single argument with generator function`);var r=e,i=r.name||`<unnamed flow>`,a=function(){var e=this,t=arguments,n=++kr,a=ar(i+` - runid: `+n+` - init`,r).apply(e,t),o,s=void 0,c=new Promise(function(e,t){var r=0;o=t;function c(e){s=void 0;var o;try{o=ar(i+` - runid: `+n+` - yield `+ r++,a.next).call(a,e)}catch(e){return t(e)}u(o)}function l(e){s=void 0;var o;try{o=ar(i+` - runid: `+n+` - yield `+ r++,a.throw).call(a,e)}catch(e){return t(e)}u(o)}function u(n){if(v(n?.then)){n.then(u,t);return}return n.done?e(n.value):(s=Promise.resolve(n.value),s.then(c,l))}c(void 0)});return c.cancel=ar(i+` - runid: `+n+` - cancel`,function(){try{s&&Fr(s);var e=a.return(void 0),t=Promise.resolve(e.value);t.then(_,_),Fr(t),o(new Ar)}catch(e){o(e)}}),c};return a.isMobXFlow=!0,a},Mr);Pr.bound=we(Nr);function Fr(e){v(e.cancel)&&e.cancel()}function Ir(e){return e}function Lr(e){return e?.isMobXFlow===!0}function Rr(e,t,r){var i;if(Bi(e)||Fi(e)||Qt(e))i=pa(e);else if($i(e)){if(!y(t))return n(`InterceptReads can only be used with a specific property, not with an object in general`);i=pa(e,t)}else return n(`Expected observable map, object or array as first array`);return i.dehancer===void 0?(i.dehancer=typeof t==`function`?t:r,function(){i.dehancer=void 0}):n(`An intercept reader was already established`)}function zr(e,t,n){return v(n)?Vr(e,t,n):Br(e,t)}function Br(e,t){return pa(e).intercept_(t)}function Vr(e,t,n){return pa(e,t).intercept_(n)}function Hr(e,t){return t===void 0?en(e):$i(e)===!1||!e[A].values_.has(t)?!1:en(fa(e,t))}function V(e){return arguments.length>1?n(`isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property`):Hr(e)}function Ur(e,t){return y(t)?Hr(e,t):n(`isComputed expected a property name as second argument`)}function Wr(e,t){return e?t===void 0?$i(e)||!!e[A]||je(e)||B(e)||en(e):Bi(e)||Fi(e)?n(`isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.`):$i(e)?e[A].values_.has(t):!1:!1}function Gr(e){return arguments.length!==1&&n(`isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property`),Wr(e)}function Kr(e,t){return y(t)?Wr(e,t):n(`expected a property name as second argument`)}function qr(e){if($i(e))return e[A].keys_();if(Bi(e)||Gi(e))return Array.from(e.keys());if(Fi(e))return e.map(function(e,t){return t});n(5)}function Jr(e){if($i(e))return qr(e).map(function(t){return e[t]});if(Bi(e))return qr(e).map(function(t){return e.get(t)});if(Gi(e))return Array.from(e.values());if(Fi(e))return e.slice();n(6)}function Yr(e){if($i(e))return qr(e).map(function(t){return[t,e[t]]});if(Bi(e))return qr(e).map(function(t){return[t,e.get(t)]});if(Gi(e))return Array.from(e.entries());if(Fi(e))return e.map(function(e,t){return[t,e]});n(7)}function Xr(e,t,r){if(arguments.length===2&&!Gi(e)){kn();var i=t;try{for(var a in i)Xr(e,a,i[a])}finally{An()}return}$i(e)?e[A].set_(t,r):Bi(e)?e.set(t,r):Gi(e)?e.add(t):Fi(e)?(typeof t!=`number`&&(t=parseInt(t,10)),t<0&&n(`Invalid index: '`+t+`'`),kn(),t>=e.length&&(e.length=t+1),e[t]=r,An()):n(8)}function Zr(e,t){$i(e)?e[A].delete_(t):Bi(e)||Gi(e)?e.delete(t):Fi(e)?(typeof t!=`number`&&(t=parseInt(t,10)),e.splice(t,1)):n(9)}function Qr(e,t){if($i(e))return e[A].has_(t);if(Bi(e)||Gi(e))return e.has(t);if(Fi(e))return t>=0&&t<e.length;n(10)}function $r(e,t){if(Qr(e,t)){if($i(e))return e[A].get_(t);if(Bi(e))return e.get(t);if(Fi(e))return e[t];n(11)}}function ei(e,t,r){if($i(e))return e[A].defineProperty_(t,r);n(39)}function ti(e){if($i(e))return e[A].ownKeys_();n(38)}function ni(e,t,n,r){return v(n)?ri(e,t,n,r):H(e,t,n)}function H(e,t,n){return pa(e).observe_(t,n)}function ri(e,t,n,r){return pa(e,t).observe_(n,r)}function ii(e,t,n){return e.set(t,n),n}function ai(e,t){if(typeof e!=`object`||!e||e instanceof Date||!Gr(e))return e;if(Qt(e)||en(e))return ai(e.get(),t);if(t.has(e))return t.get(e);if(Fi(e)){var n=ii(t,e,Array(e.length));return e.forEach(function(e,r){n[r]=ai(e,t)}),n}if(Gi(e)){var r=ii(t,e,new Set);return e.forEach(function(e){r.add(ai(e,t))}),r}if(Bi(e)){var i=ii(t,e,new Map);return e.forEach(function(e,n){i.set(n,ai(e,t))}),i}else{var a=ii(t,e,{});return ti(e).forEach(function(n){c.propertyIsEnumerable.call(e,n)&&(a[n]=ai(e[n],t))}),a}}function oi(e,t){return t&&n(`toJS no longer supports options`),ai(e,new Map)}function si(){var e=!1,t=[...arguments];typeof t[t.length-1]==`boolean`&&(e=t.pop());var r=ci(t);if(!r)return n(`'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly`);r.isTracing_===tn.NONE&&console.log(`[mobx.trace] '`+r.name_+`' tracing enabled`),r.isTracing_=e?tn.BREAK:tn.LOG}function ci(e){switch(e.length){case 0:return R.trackingDerivation;case 1:return fa(e[0]);case 2:return fa(e[0],e[1])}}function li(e,t){t===void 0&&(t=void 0),kn();try{return e.apply(t)}finally{An()}}function ui(e,t,n){return arguments.length===1||t&&typeof t==`object`?fi(e,t):di(e,t,n||{})}function di(e,t,n){var r;if(typeof n.timeout==`number`){var i=Error(`WHEN_TIMEOUT`);r=setTimeout(function(){if(!o[A].isDisposed)if(o(),n.onError)n.onError(i);else throw i},n.timeout)}n.name=n.name||`When@`+h();var a=Ut(n.name+`-effect`,t),o=lr(function(t){qt(!1,e)&&(t.dispose(),r&&clearTimeout(r),a())},n);return o}function fi(e,t){var r;if(t&&t.onError)return n(`the options 'onError' and 'promise' cannot be combined`);if(t!=null&&(r=t.signal)!=null&&r.aborted)return Object.assign(Promise.reject(Error(`WHEN_ABORTED`)),{cancel:function(){return null}});var i,a,o=new Promise(function(n,r){var o,s=di(e,n,me({},t,{onError:r}));i=function(){s(),r(Error(`WHEN_CANCELLED`))},a=function(){s(),r(Error(`WHEN_ABORTED`))},t==null||(o=t.signal)==null||o.addEventListener==null||o.addEventListener(`abort`,a)}).finally(function(){var e;return t==null||(e=t.signal)==null||e.removeEventListener==null?void 0:e.removeEventListener(`abort`,a)});return o.cancel=i,o}function pi(e){return e[A]}var mi={has:function(e,t){return R.trackingDerivation&&m(`detect new properties using the 'in' operator. Use 'has' from 'mobx' instead.`),pi(e).has_(t)},get:function(e,t){return pi(e).get_(t)},set:function(e,t,n){return y(t)?(pi(e).values_.has(t)||m(`add a new observable property through direct assignment. Use 'set' from 'mobx' instead.`),pi(e).set_(t,n,!0)??!0):!1},deleteProperty:function(e,t){return m(`delete properties from an observable object. Use 'remove' from 'mobx' instead.`),y(t)?pi(e).delete_(t,!0)??!0:!1},defineProperty:function(e,t,n){return m(`define property on an observable object. Use 'defineProperty' from 'mobx' instead.`),pi(e).defineProperty_(t,n)??!0},ownKeys:function(e){return R.trackingDerivation&&m(`iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead.`),pi(e).ownKeys_()},preventExtensions:function(e){n(13)}};function hi(e,t){var n;return p(),e=Xi(e,t),(n=e[A]).proxy_??(n.proxy_=new Proxy(e,mi))}function gi(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function _i(e,t){var n=e.interceptors_||=[];return n.push(t),g(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function vi(e,t){var r=L();try{for(var i=[].concat(e.interceptors_||[]),a=0,o=i.length;a<o&&(t=i[a](t),t&&!t.type&&n(14),t);a++);return t}finally{pn(r)}}function yi(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function bi(e,t){var n=e.changeListeners_||=[];return n.push(t),g(function(){var e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function xi(e,t){var n=L(),r=e.changeListeners_;if(r){r=r.slice();for(var i=0,a=r.length;i<a;i++)r[i](t);pn(n)}}function Si(e,t,r){return ha(function(){var i=Xi(e,r)[A];t&&e[Ce]&&n(`makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported.`),t??=De(e),O(t).forEach(function(e){return i.make_(e,t[e])})}),e}var Ci=Symbol(`mobx-keys`);function wi(e,t,r){return!x(e)&&!x(Object.getPrototypeOf(e))&&n(`'makeAutoObservable' can only be used for classes that don't have a superclass`),$i(e)&&n(`makeAutoObservable can only be used on objects not already made observable`),x(e)?Cr(e,e,t,r):(ha(function(){var n=Xi(e,r)[A];if(!e[Ci]){var i=Object.getPrototypeOf(e),a=new Set([].concat(O(e),O(i)));a.delete(`constructor`),a.delete(A),C(i,Ci,a)}e[Ci].forEach(function(e){return n.make_(e,t&&e in t?t[e]:!0)})}),e)}var Ti=`splice`,Ei=`update`,Di=1e4,Oi={get:function(e,t){var n=e[A];return t===A?n:t===`length`?n.getArrayLength_():typeof t==`string`&&!isNaN(t)?n.get_(parseInt(t)):ae(U,t)?U[t]:e[t]},set:function(e,t,n){var r=e[A];return t===`length`&&r.setArrayLength_(n),typeof t==`symbol`||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions:function(){n(15)}},ki=function(){function e(e,t,n,r){e===void 0&&(e=`ObservableArray@`+h()),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=n,this.legacyMode_=r,this.atom_=new Ae(e),this.enhancer_=function(n,r){return t(n,r,e+`[..]`)}}var t=e.prototype;return t.dehanceValue_=function(e){return this.dehancer===void 0?e:this.dehancer(e)},t.dehanceValues_=function(e){return this.dehancer!==void 0&&e.length>0?e.map(this.dehancer):e},t.intercept_=function(e){return _i(this,e)},t.observe_=function(e,t){return t===void 0&&(t=!1),t&&e({observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:`splice`,index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),bi(this,e)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(e){(typeof e!=`number`||isNaN(e)||e<0)&&n(`Out of range: `+e);var t=this.values_.length;if(e!==t)if(e>t){for(var r=Array(e-t),i=0;i<e-t;i++)r[i]=void 0;this.spliceWithArray_(t,0,r)}else this.spliceWithArray_(e,t-e)},t.updateArrayLength_=function(e,t){e!==this.lastKnownLength_&&n(16),this.lastKnownLength_+=t,this.legacyMode_&&t>0&&ua(e+t+1)},t.spliceWithArray_=function(e,t,n){var r=this;sn(this.atom_);var i=this.values_.length;if(e===void 0?e=0:e>i?e=i:e<0&&(e=Math.max(0,i+e)),t=arguments.length===1?i-e:t==null?0:Math.max(0,Math.min(t,i-e)),n===void 0&&(n=l),gi(this)){var a=vi(this,{object:this.proxy_,type:Ti,index:e,removedCount:t,added:n});if(!a)return l;t=a.removedCount,n=a.added}if(n=n.length===0?n:n.map(function(e){return r.enhancer_(e,void 0)}),this.legacyMode_||!0){var o=n.length-t;this.updateArrayLength_(i,o)}var s=this.spliceItemsIntoValues_(e,t,n);return(t!==0||n.length!==0)&&this.notifyArraySplice_(e,n,s),this.dehanceValues_(s)},t.spliceItemsIntoValues_=function(e,t,n){if(n.length<Di){var r;return(r=this.values_).splice.apply(r,[e,t].concat(n))}else{var i=this.values_.slice(e,e+t),a=this.values_.slice(e+t);this.values_.length+=n.length-t;for(var o=0;o<n.length;o++)this.values_[e+o]=n[o];for(var s=0;s<a.length;s++)this.values_[e+n.length+s]=a[s];return i}},t.notifyArrayChildUpdate_=function(e,t,n){var r=!this.owned_&&Un(),i=yi(this),a=i||r?{observableKind:`array`,object:this.proxy_,type:Ei,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;r&&Gn(a),this.atom_.reportChanged(),i&&xi(this,a),r&&qn()},t.notifyArraySplice_=function(e,t,n){var r=!this.owned_&&Un(),i=yi(this),a=i||r?{observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:Ti,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Gn(a),this.atom_.reportChanged(),i&&xi(this,a),r&&qn()},t.get_=function(e){if(this.legacyMode_&&e>=this.values_.length){console.warn(`[mobx.array] Attempt to read an array index (`+e+`) that is out of bounds (`+this.values_.length+`). Please check length first. Out of bound indices will not be tracked by MobX`);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e])},t.set_=function(e,t){var r=this.values_;if(this.legacyMode_&&e>r.length&&n(17,e,r.length),e<r.length){sn(this.atom_);var i=r[e];if(gi(this)){var a=vi(this,{type:Ei,object:this.proxy_,index:e,newValue:t});if(!a)return;t=a.newValue}t=this.enhancer_(t,i),t!==i&&(r[e]=t,this.notifyArrayChildUpdate_(e,t,i))}else{for(var o=Array(e+1-r.length),s=0;s<o.length-1;s++)o[s]=void 0;o[o.length-1]=t,this.spliceWithArray_(r.length,0,o)}},e}();function Ai(e,t,n,r){return n===void 0&&(n=`ObservableArray@`+h()),r===void 0&&(r=!1),p(),ha(function(){var i=new ki(n,t,r,!1);w(i.values_,A,i);var a=new Proxy(i.values_,Oi);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var U={clear:function(){return this.splice(0)},replace:function(e){var t=this[A];return t.spliceWithArray_(0,t.values_.length,e)},toJSON:function(){return this.slice()},splice:function(e,t){var n=[...arguments].slice(2),r=this[A];switch(arguments.length){case 0:return[];case 1:return r.spliceWithArray_(e);case 2:return r.spliceWithArray_(e,t)}return r.spliceWithArray_(e,t,n)},spliceWithArray:function(e,t,n){return this[A].spliceWithArray_(e,t,n)},push:function(){var e=this[A],t=[...arguments];return e.spliceWithArray_(e.values_.length,0,t),e.values_.length},pop:function(){return this.splice(Math.max(this[A].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){var e=this[A],t=[...arguments];return e.spliceWithArray_(0,0,t),e.values_.length},reverse:function(){return R.trackingDerivation&&n(37,`reverse`),this.replace(this.slice().reverse()),this},sort:function(){R.trackingDerivation&&n(37,`sort`);var e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove:function(e){var t=this[A],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1?(this.splice(n,1),!0):!1}};W(`at`,ji),W(`concat`,ji),W(`flat`,ji),W(`includes`,ji),W(`indexOf`,ji),W(`join`,ji),W(`lastIndexOf`,ji),W(`slice`,ji),W(`toString`,ji),W(`toLocaleString`,ji),W(`toSorted`,ji),W(`toSpliced`,ji),W(`with`,ji),W(`every`,Mi),W(`filter`,Mi),W(`find`,Mi),W(`findIndex`,Mi),W(`findLast`,Mi),W(`findLastIndex`,Mi),W(`flatMap`,Mi),W(`forEach`,Mi),W(`map`,Mi),W(`some`,Mi),W(`toReversed`,Mi),W(`reduce`,Ni),W(`reduceRight`,Ni);function W(e,t){typeof Array.prototype[e]==`function`&&(U[e]=t(e))}function ji(e){return function(){var t=this[A];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Mi(e){return function(t,n){var r=this,i=this[A];return i.atom_.reportObserved(),i.dehanceValues_(i.values_)[e](function(e,i){return t.call(n,e,i,r)})}}function Ni(e){return function(){var t=this,n=this[A];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),i=arguments[0];return arguments[0]=function(e,n,r){return i(e,n,r,t)},r[e].apply(r,arguments)}}var Pi=T(`ObservableArrayAdministration`,ki);function Fi(e){return b(e)&&Pi(e[A])}var Ii={},Li=`add`,Ri=`delete`,zi=function(){function e(e,t,r){var i=this;t===void 0&&(t=Re),r===void 0&&(r=`ObservableMap@`+h()),this.enhancer_=void 0,this.name_=void 0,this[A]=Ii,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=r,v(Map)||n(18),ha(function(){i.keysAtom_=Me(i.name_+`.keys()`),i.data_=new Map,i.hasMap_=new Map,e&&i.merge(e)})}var t=e.prototype;return t.has_=function(e){return this.data_.has(e)},t.has=function(e){var t=this;if(!R.trackingDerivation)return this.has_(e);var n=this.hasMap_.get(e);if(!n){var r=n=new Zt(this.has_(e),Be,this.name_+`.`+re(e)+`?`,!1);this.hasMap_.set(e,r),_r(r,function(){return t.hasMap_.delete(e)})}return n.get()},t.set=function(e,t){var n=this.has_(e);if(gi(this)){var r=vi(this,{type:n?Ei:Li,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this},t.delete=function(e){var t=this;if(sn(this.keysAtom_),gi(this)&&!vi(this,{type:Ri,object:this,name:e}))return!1;if(this.has_(e)){var n=Un(),r=yi(this),i=r||n?{observableKind:`map`,debugObjectName:this.name_,type:Ri,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return n&&Gn(i),li(function(){var n;t.keysAtom_.reportChanged(),(n=t.hasMap_.get(e))==null||n.setNewValue_(!1),t.data_.get(e).setNewValue_(void 0),t.data_.delete(e)}),r&&xi(this,i),n&&qn(),!0}return!1},t.updateValue_=function(e,t){var n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==R.UNCHANGED){var r=Un(),i=yi(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:Ei,object:this,oldValue:n.value_,name:e,newValue:t}:null;r&&Gn(a),n.setNewValue_(t),i&&xi(this,a),r&&qn()}},t.addValue_=function(e,t){var n=this;sn(this.keysAtom_),li(function(){var r,i=new Zt(t,n.enhancer_,n.name_+`.`+re(e),!1);n.data_.set(e,i),t=i.value_,(r=n.hasMap_.get(e))==null||r.setNewValue_(!0),n.keysAtom_.reportChanged()});var r=Un(),i=yi(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:Li,object:this,name:e,newValue:t}:null;r&&Gn(a),i&&xi(this,a),r&&qn()},t.get=function(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(e){return this.dehancer===void 0?e:this.dehancer(e)},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var e=this,t=this.keys();return Vi({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:e.get(i)}}})},t.entries=function(){var e=this,t=this.keys();return Vi({next:function(){var n=t.next(),r=n.done,i=n.value;return{done:r,value:r?void 0:[i,e.get(i)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(e,t){for(var n=pe(this),r;!(r=n()).done;){var i=r.value,a=i[0],o=i[1];e.call(t,o,a,this)}},t.merge=function(e){var t=this;return Bi(e)&&(e=new Map(e)),li(function(){x(e)?D(e).forEach(function(n){return t.set(n,e[n])}):Array.isArray(e)?e.forEach(function(e){var n=e[0],r=e[1];return t.set(n,r)}):ee(e)?(te(e)||n(19,e),e.forEach(function(e,n){return t.set(n,e)})):e!=null&&n(20,e)}),this},t.clear=function(){var e=this;li(function(){fn(function(){for(var t=pe(e.keys()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.replace=function(e){var t=this;return li(function(){for(var n=Hi(e),r=new Map,i=!1,a=pe(t.data_.keys()),o;!(o=a()).done;){var s=o.value;if(!n.has(s))if(t.delete(s))i=!0;else{var c=t.data_.get(s);r.set(s,c)}}for(var l=pe(n.entries()),u;!(u=l()).done;){var d=u.value,f=d[0],p=d[1],m=t.data_.has(f);if(t.set(f,p),t.data_.has(f)){var h=t.data_.get(f);r.set(f,h),m||(i=!0)}}if(!i)if(t.data_.size!==r.size)t.keysAtom_.reportChanged();else for(var g=t.data_.keys(),_=r.keys(),v=g.next(),y=_.next();!v.done;){if(v.value!==y.value){t.keysAtom_.reportChanged();break}v=g.next(),y=_.next()}t.data_=r}),this},t.toString=function(){return`[object ObservableMap]`},t.toJSON=function(){return Array.from(this)},t.observe_=function(e,t){return t===!0&&n("`observe` doesn't support fireImmediately=true in combination with maps."),bi(this,e)},t.intercept_=function(e){return _i(this,e)},fe(e,[{key:`size`,get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Map`}}])}(),Bi=T(`ObservableMap`,zi);function Vi(e){return e[Symbol.toStringTag]=`MapIterator`,xa(e)}function Hi(e){if(ee(e)||Bi(e))return e;if(Array.isArray(e))return new Map(e);if(x(e)){var t=new Map;for(var r in e)t.set(r,e[r]);return t}else return n(21,e)}var Ui={},Wi=function(){function e(e,t,r){var i=this;t===void 0&&(t=Re),r===void 0&&(r=`ObservableSet@`+h()),this.name_=void 0,this[A]=Ui,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,v(Set)||n(22),this.enhancer_=function(e,n){return t(e,n,r)},ha(function(){i.atom_=Me(i.name_),e&&i.replace(e)})}var t=e.prototype;return t.dehanceValue_=function(e){return this.dehancer===void 0?e:this.dehancer(e)},t.clear=function(){var e=this;li(function(){fn(function(){for(var t=pe(e.data_.values()),n;!(n=t()).done;){var r=n.value;e.delete(r)}})})},t.forEach=function(e,t){for(var n=pe(this),r;!(r=n()).done;){var i=r.value;e.call(t,i,i,this)}},t.add=function(e){var t=this;if(sn(this.atom_),gi(this)){var n=vi(this,{type:Li,object:this,newValue:e});if(!n)return this;e=n.newValue}if(!this.has(e)){li(function(){t.data_.add(t.enhancer_(e,void 0)),t.atom_.reportChanged()});var r=Un(),i=yi(this),a=i||r?{observableKind:`set`,debugObjectName:this.name_,type:Li,object:this,newValue:e}:null;r&&Gn(a),i&&xi(this,a),r&&qn()}return this},t.delete=function(e){var t=this;if(gi(this)&&!vi(this,{type:Ri,object:this,oldValue:e}))return!1;if(this.has(e)){var n=Un(),r=yi(this),i=r||n?{observableKind:`set`,debugObjectName:this.name_,type:Ri,object:this,oldValue:e}:null;return n&&Gn(i),li(function(){t.atom_.reportChanged(),t.data_.delete(e)}),r&&xi(this,i),n&&qn(),!0}return!1},t.has=function(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))},t.entries=function(){var e=this.values();return Ki({next:function(){var t=e.next(),n=t.value,r=t.done;return r?{value:void 0,done:r}:{value:[n,n],done:r}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var e=this,t=this.data_.values();return Ki({next:function(){var n=t.next(),r=n.value,i=n.done;return i?{value:void 0,done:i}:{value:e.dehanceValue_(r),done:i}}})},t.intersection=function(e){return E(e)&&!Gi(e)?e.intersection(this):new Set(this).intersection(e)},t.union=function(e){return E(e)&&!Gi(e)?e.union(this):new Set(this).union(e)},t.difference=function(e){return new Set(this).difference(e)},t.symmetricDifference=function(e){return E(e)&&!Gi(e)?e.symmetricDifference(this):new Set(this).symmetricDifference(e)},t.isSubsetOf=function(e){return new Set(this).isSubsetOf(e)},t.isSupersetOf=function(e){return new Set(this).isSupersetOf(e)},t.isDisjointFrom=function(e){return E(e)&&!Gi(e)?e.isDisjointFrom(this):new Set(this).isDisjointFrom(e)},t.replace=function(e){var t=this;return Gi(e)&&(e=new Set(e)),li(function(){Array.isArray(e)||E(e)?(t.clear(),e.forEach(function(e){return t.add(e)})):e!=null&&n(`Cannot initialize set from `+e)}),this},t.observe_=function(e,t){return t===!0&&n("`observe` doesn't support fireImmediately=true in combination with sets."),bi(this,e)},t.intercept_=function(e){return _i(this,e)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return`[object ObservableSet]`},t[Symbol.iterator]=function(){return this.values()},fe(e,[{key:`size`,get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return`Set`}}])}(),Gi=T(`ObservableSet`,Wi);function Ki(e){return e[Symbol.toStringTag]=`SetIterator`,xa(e)}var qi=Object.create(null),Ji=`remove`,Yi=function(){function e(e,t,r,i){t===void 0&&(t=new Map),i===void 0&&(i=_t),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=e,this.values_=t,this.name_=r,this.defaultAnnotation_=i,this.keysAtom_=new Ae(this.name_+`.keys`),this.isPlainObject_=x(this.target_),Ca(this.defaultAnnotation_)||n(`defaultAnnotation must be valid annotation`),this.appliedAnnotations_={}}var t=e.prototype;return t.getObservablePropValue_=function(e){return this.values_.get(e).get()},t.setObservablePropValue_=function(e,t){var n=this.values_.get(e);if(n instanceof $t)return n.set(t),!0;if(gi(this)){var r=vi(this,{type:Ei,object:this.proxy_||this.target_,name:e,newValue:t});if(!r)return null;t=r.newValue}if(t=n.prepareNewValue_(t),t!==R.UNCHANGED){var i=yi(this),a=Un(),o=i||a?{type:Ei,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;a&&Gn(o),n.setNewValue_(t),i&&xi(this,o),a&&qn()}return!0},t.get_=function(e){return R.trackingDerivation&&!ae(this.target_,e)&&this.has_(e),this.target_[e]},t.set_=function(e,t,n){return n===void 0&&(n=!1),ae(this.target_,e)?this.values_.has(e)?this.setObservablePropValue_(e,t):n?Reflect.set(this.target_,e,t):(this.target_[e]=t,!0):this.extend_(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,n)},t.has_=function(e){if(!R.trackingDerivation)return e in this.target_;this.pendingKeys_||=new Map;var t=this.pendingKeys_.get(e);return t||(t=new Zt(e in this.target_,Be,this.name_+`.`+re(e)+`?`,!1),this.pendingKeys_.set(e,t)),t.get()},t.make_=function(e,t){if(t===!0&&(t=this.defaultAnnotation_),t!==!1){if(ta(this,t,e),!(e in this.target_)){var r;if((r=this.target_[Ce])!=null&&r[e])return;n(1,t.annotationType_,this.name_+`.`+e.toString())}for(var i=this.target_;i&&i!==c;){var a=o(i,e);if(a){var s=t.make_(this,e,a,i);if(s===0)return;if(s===1)break}i=Object.getPrototypeOf(i)}ea(this,t,e)}},t.extend_=function(e,t,n,r){if(r===void 0&&(r=!1),n===!0&&(n=this.defaultAnnotation_),n===!1)return this.defineProperty_(e,t,r);ta(this,n,e);var i=n.extend_(this,e,t,r);return i&&ea(this,n,e),i},t.defineProperty_=function(e,t,n){n===void 0&&(n=!1),sn(this.keysAtom_);try{kn();var r=this.delete_(e);if(!r)return r;if(gi(this)){var i=vi(this,{object:this.proxy_||this.target_,name:e,type:Li,newValue:t.value});if(!i)return null;var a=i.newValue;t.value!==a&&(t=me({},t,{value:a}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else s(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{An()}return!0},t.defineObservableProperty_=function(e,t,n,r){r===void 0&&(r=!1),sn(this.keysAtom_);try{kn();var i=this.delete_(e);if(!i)return i;if(gi(this)){var a=vi(this,{object:this.proxy_||this.target_,name:e,type:Li,newValue:t});if(!a)return null;t=a.newValue}var o=Qi(e),c={configurable:R.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.target_,e,c))return!1}else s(this.target_,e,c);var l=new Zt(t,n,this.name_+`.`+e.toString(),!1);this.values_.set(e,l),this.notifyPropertyAddition_(e,l.value_)}finally{An()}return!0},t.defineComputedProperty_=function(e,t,n){n===void 0&&(n=!1),sn(this.keysAtom_);try{kn();var r=this.delete_(e);if(!r)return r;if(gi(this)&&!vi(this,{object:this.proxy_||this.target_,name:e,type:Li,newValue:void 0}))return null;t.name||=this.name_+`.`+e.toString(),t.context=this.proxy_||this.target_;var i=Qi(e),a={configurable:R.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,a))return!1}else s(this.target_,e,a);this.values_.set(e,new $t(t)),this.notifyPropertyAddition_(e,void 0)}finally{An()}return!0},t.delete_=function(e,t){if(t===void 0&&(t=!1),sn(this.keysAtom_),!ae(this.target_,e))return!0;if(gi(this)&&!vi(this,{object:this.proxy_||this.target_,name:e,type:Ji}))return null;try{var n;kn();var r=yi(this),i=Un(),a=this.values_.get(e),s=void 0;if(!a&&(r||i)&&(s=o(this.target_,e)?.value),t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(delete this.appliedAnnotations_[e],a&&(this.values_.delete(e),a instanceof Zt&&(s=a.value_),Mn(a)),this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r||i){var c={type:Ji,observableKind:`object`,object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:s,name:e};i&&Gn(c),r&&xi(this,c),i&&qn()}}finally{An()}return!0},t.observe_=function(e,t){return t===!0&&n("`observe` doesn't support the fire immediately property for observable objects."),bi(this,e)},t.intercept_=function(e){return _i(this,e)},t.notifyPropertyAddition_=function(e,t){var n,r=yi(this),i=Un();if(r||i){var a=r||i?{type:Li,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;i&&Gn(a),r&&xi(this,a),i&&qn()}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),O(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Xi(e,t){if(t&&$i(e)&&n(`Options can't be provided for already observable objects.`),ae(e,A))return pa(e)instanceof Yi||n(`Cannot convert '`+ma(e)+`' into observable object:
82
82
  The target is already observable of different type.
83
- Extending builtins is not supported.`),e;Object.isExtensible(e)||n(`Cannot make the designated object observable; it is not extensible`);var r=t?.name??(x(e)?`ObservableObject`:e.constructor.name)+`@`+h();return C(e,A,new Zi(e,new Map,String(r),Pt(t))),e}var $i=T(`ObservableObjectAdministration`,Zi);function ea(e){return Yi[e]||(Yi[e]={get:function(){return this[A].getObservablePropValue_(e)},set:function(t){return this[A].setObservablePropValue_(e,t)}})}function ta(e){return b(e)?$i(e[A]):!1}function na(e,t,n){var r;e.appliedAnnotations_[n]=t,(r=e.target_[Ce])==null||delete r[n]}function ra(e,t,r){if(Ta(t)||n(`Cannot annotate '`+e.name_+`.`+r.toString()+`': Invalid annotation.`),!We(t)&&ae(e.appliedAnnotations_,r)){var i=e.name_+`.`+r.toString(),a=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;n(`Cannot apply '`+o+`' to '`+i+`':`+(`
83
+ Extending builtins is not supported.`),e;Object.isExtensible(e)||n(`Cannot make the designated object observable; it is not extensible`);var r=t?.name??(x(e)?`ObservableObject`:e.constructor.name)+`@`+h();return C(e,A,new Yi(e,new Map,String(r),Pt(t))),e}var Zi=T(`ObservableObjectAdministration`,Yi);function Qi(e){return qi[e]||(qi[e]={get:function(){return this[A].getObservablePropValue_(e)},set:function(t){return this[A].setObservablePropValue_(e,t)}})}function $i(e){return b(e)?Zi(e[A]):!1}function ea(e,t,n){var r;e.appliedAnnotations_[n]=t,(r=e.target_[Ce])==null||delete r[n]}function ta(e,t,r){if(Ca(t)||n(`Cannot annotate '`+e.name_+`.`+r.toString()+`': Invalid annotation.`),!We(t)&&ae(e.appliedAnnotations_,r)){var i=e.name_+`.`+r.toString(),a=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;n(`Cannot apply '`+o+`' to '`+i+`':`+(`
84
84
  The field is already annotated with '`+a+`'.`)+`
85
85
  Re-annotating fields is not allowed.
86
- Use 'override' annotation for methods overridden by subclass.`)}}var ia=ua(0),aa=function(){var e=!1,t={};return Object.defineProperty(t,`0`,{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),oa=0,sa=function(){};function ca(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__===void 0?e.prototype=t:e.prototype.__proto__=t}ca(sa,Array.prototype);var la=function(e){function t(t,n,r,i){var a;return r===void 0&&(r=`ObservableArray@`+h()),i===void 0&&(i=!1),a=e.call(this)||this,_a(function(){var e=new ji(r,n,i,!0);e.proxy_=a,w(a,A,e),t&&t.length&&a.spliceWithArray(0,0,t),aa&&Object.defineProperty(a,`0`,ia)}),a}ge(t,e);var n=t.prototype;return n.concat=function(){this[A].atom_.reportObserved();var e=[...arguments];return Array.prototype.concat.apply(this.slice(),e.map(function(e){return Li(e)?e.slice():e}))},n[Symbol.iterator]=function(){var e=this,t=0;return Ca({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},fe(t,[{key:`length`,get:function(){return this[A].getArrayLength_()},set:function(e){this[A].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return`Array`}}])}(sa);Object.entries(V).forEach(function(e){var t=e[0],n=e[1];t!==`concat`&&C(la.prototype,t,n)});function ua(e){return{enumerable:!1,configurable:!0,get:function(){return this[A].get_(e)},set:function(t){this[A].set_(e,t)}}}function da(e){s(la.prototype,``+e,ua(e))}function fa(e){if(e>oa){for(var t=oa;t<e+100;t++)da(t);oa=e}}fa(1e3);function pa(e,t,n){return new la(e,t,n)}function ma(e,t){if(typeof e==`object`&&e){if(Li(e))return t!==void 0&&n(23),e[A].atom_;if(qi(e))return e.atom_;if(Hi(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||n(25,t,ga(e)),r}if(ta(e)){if(!t)return n(26);var i=e[A].values_.get(t);return i||n(27,t,ga(e)),i}if(je(e)||nn(e)||R(e))return e}else if(v(e)&&R(e[A]))return e[A];n(28)}function ha(e,t){if(e||n(29),t!==void 0)return ha(ma(e,t));if(je(e)||nn(e)||R(e)||Hi(e)||qi(e))return e;if(e[A])return e[A];n(24,e)}function ga(e,t){var n;if(t!==void 0)n=ma(e,t);else if(ur(e))return e.name;else n=ta(e)||Hi(e)||qi(e)?ha(e):ma(e);return n.name_}function _a(e){var t=F(),n=Xt(!0);jn();try{return e()}finally{Mn(),Zt(n),hn(t)}}var va=c.toString;function ya(e,t,n){return n===void 0&&(n=-1),ba(e,t,n)}function ba(e,t,n,r,i){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var a=typeof e;if(a!==`function`&&a!==`object`&&typeof t!=`object`)return!1;var o=va.call(e);if(o!==va.call(t))return!1;switch(o){case`[object RegExp]`:case`[object String]`:return``+e==``+t;case`[object Number]`:return+e==+e?+e==0?1/e==1/t:+e==+t:+t!=+t;case`[object Date]`:case`[object Boolean]`:return+e==+t;case`[object Symbol]`:return typeof Symbol<`u`&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case`[object Map]`:case`[object Set]`:n>=0&&n++;break}e=xa(e),t=xa(t);var s=o===`[object Array]`;if(!s){if(typeof e!=`object`||typeof t!=`object`)return!1;var c=e.constructor,l=t.constructor;if(c!==l&&!(v(c)&&c instanceof c&&v(l)&&l instanceof l)&&`constructor`in e&&`constructor`in t)return!1}if(n===0)return!1;n<0&&(n=-1),r||=[],i||=[];for(var u=r.length;u--;)if(r[u]===e)return i[u]===t;if(r.push(e),i.push(t),s){if(u=e.length,u!==t.length)return!1;for(;u--;)if(!ba(e[u],t[u],n-1,r,i))return!1}else{var d=Object.keys(e),f=d.length;if(Object.keys(t).length!==f)return!1;for(var p=0;p<f;p++){var m=d[p];if(!(ae(t,m)&&ba(e[m],t[m],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function xa(e){return Li(e)?e.slice():ee(e)||Hi(e)||E(e)||qi(e)?Array.from(e.entries()):e}var Sa=i().Iterator?.prototype||{};function Ca(e){return e[Symbol.iterator]=wa,Object.assign(Object.create(Sa),e)}function wa(){return this}function Ta(e){return e instanceof Object&&typeof e.annotationType_==`string`&&v(e.make_)&&v(e.extend_)}[`Symbol`,`Map`,`Set`].forEach(function(e){i()[e]===void 0&&n(`MobX requires global '`+e+`' to be available or polyfilled`)}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__==`object`&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Xn,extras:{getDebugName:ga},$mobx:A}),e.$mobx=A,e.FlowCancellationError=Mr,e.ObservableMap=Vi,e.ObservableSet=Ki,e.Reaction=Rn,e._allowStateChanges=Yt,e._allowStateChangesInsideComputed=lr,e._allowStateReadsEnd=_n,e._allowStateReadsStart=gn,e._autoAction=cr,e._endAction=Jt,e._getAdministration=ha,e._getGlobalState=wn,e._interceptReads=Br,e._isComputingDerivation=cn,e._resetGlobalState=Tn,e._startAction=qt,e.action=sr,e.autorun=dr,e.comparer=Le,e.computed=Bt,e.configure=wr,e.createAtom=Me,e.defineProperty=ni,e.entries=Zr,e.extendObservable=Tr,e.flow=Ir,e.flowResult=Rr,e.get=ti,e.getAtom=ma,e.getDebugName=ga,e.getDependencyTree=Er,e.getObserverTree=Or,e.has=ei,e.intercept=Vr,e.isAction=ur,e.isBoxedObservable=en,e.isComputed=z,e.isComputedProp=Gr,e.isFlow=zr,e.isFlowCancellationError=Nr,e.isObservable=qr,e.isObservableArray=Li,e.isObservableMap=Hi,e.isObservableObject=ta,e.isObservableProp=Jr,e.isObservableSet=qi,e.keys=Yr,e.makeAutoObservable=Ei,e.makeObservable=wi,e.observable=M,e.observe=ii,e.onBecomeObserved=vr,e.onBecomeUnobserved=yr,e.onReactionError=zn,e.override=Ue,e.ownKeys=ri,e.reaction=mr,e.remove=$r,e.runInAction=lr,e.set=Qr,e.spy=Xn,e.toJS=ci,e.trace=li,e.transaction=di,e.untracked=mn,e.values=Xr,e.when=fi})),Cv=me(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=xv():t.exports=Sv()}))();function wv(e){if(Array.isArray(e))return Object.freeze(e.map(wv));if(typeof e==`object`&&e){let t=Object.create(null),n=Object.entries(e).sort(([e],[t])=>e<t?-1:+(e>t));for(let[e,r]of n)t[e]=wv(r);return Object.freeze(t)}return e}function Tv(e){let t=typeof e;if(t===`string`||t===`number`||t===`boolean`)return t;throw TypeError(`Variable values must be string|number|boolean (got ${t})`)}function Ev(e){return typeof e==`string`?e:String(e)}function Dv(e){if(typeof e==`number`)return e;if(typeof e==`boolean`)return+!!e;let t=e.trim();if(t===``)throw TypeError(`Cannot cast empty string to number`);let n=Number(t);if(!Number.isFinite(n))throw TypeError(`Cannot cast ${JSON.stringify(e)} to number`);return n}function Ov(e){if(typeof e==`boolean`)return e;if(typeof e==`number`){if(e===0||e===1)return e===1;throw TypeError(`Cannot cast number ${e} to bool (only 0 and 1 are accepted)`)}if(e===`true`)return!0;if(e===`false`)return!1;throw TypeError(`Cannot cast ${JSON.stringify(e)} to bool (expected "true" or "false")`)}function kv(e,t){if(!(e instanceof V))throw TypeError(`template function expected a RichText fragment, got ${typeof e==`object`?Object.prototype.toString.call(e):typeof e}`);let n=e.copy();return n.style=Av(e.style).add(t),n}function Av(e){if(e instanceof z)return e;try{return z.parse(e)}catch(t){throw t instanceof Ur?TypeError(`template function cannot style a fragment whose base style "${e}" is not a style definition: a style name resolves only against the theme of a render`,{cause:t}):t}}function jv(e){return{fn:(t=>kv(t,e)),argTypes:[`liftable`],arity:{kind:`exact`},returnType:`T`}}function Mv(e){return{fn:((t,n)=>kv(n,new z({[e]:yn.parse(t)}))),argTypes:[`string`,`liftable`],arity:{kind:`exact`},returnType:`T`}}function Nv(e,t){return new z({[e]:t})}function Pv(){let e={};for(let t of Br)e[t]=jv(Nv(t,!0)),e[`not_${t}`]=jv(Nv(t,!1));for(let[t,n]of Object.entries(Hr))e[t]=jv(Nv(n,!0));return e}const Fv={fn:((e,t)=>kv(t,z.parse(e))),argTypes:[`string`,`liftable`],arity:{kind:`exact`},returnType:`T`},Iv={fn:((e,t)=>kv(t,new z({link:e}))),argTypes:[`string`,`liftable`],arity:{kind:`exact`},returnType:`T`};function Lv(){return{fg:Mv(`color`),bg:Mv(`bgcolor`),...Pv(),link:Iv,style:Fv}}function Rv(e,t){if(!Qn.test(e.trim()))throw TypeError(`${t} expected a color (#RRGGBB or #RRGGBBAA), got ${JSON.stringify(e)} — to use a palette name here, wrap it: ${t} (color ${JSON.stringify(e)}) …`);return $n(e)}function zv(e,t){return{fn:t,argTypes:e,arity:{kind:`exact`},returnType:`string`}}function Bv(e,t,n,r){let i=r===void 0||e>=r.min&&e<=r.max;if(!Number.isFinite(e)||!i){let i=r===void 0?`a finite number`:`within ${r.min}..${r.max} (${r.note})`;throw RangeError(`${t}'s ${n} must be ${i}, got ${e}`)}return e}const Vv=zv([`string`,`int`],((e,t)=>or(Rv(e,`darken`),t).hex)),Hv=zv([`string`,`int`],((e,t)=>or(Rv(e,`lighten`),-t).hex)),Uv={min:0,max:100,note:`0 = from, 100 = toward`},Wv=zv([`string`,`string`,`float`],((e,t,n)=>Dn(Rv(e,`mix`),Rv(t,`mix`),Bv(n,`mix`,`percentage`,Uv)/100).hex)),Gv={min:1,max:21,note:`4.5 = AA body text, 3 = AA large text`},Kv=zv([`string`],(e=>sr(Rv(e,`contrastOn`)).hex)),qv=e=>zv([`string`,`string`,`float`],((t,n,r)=>cr(Rv(t,`readableOn`),Rv(n,`readableOn`),Bv(r,`readableOn`,`ratio`,Gv),e()).hex)),Jv={hueShift:`shiftHue`,chromaScale:`scaleChroma`,lightnessScale:`scaleLightness`,lightnessShift:`shiftLightness`};function Yv(){let e={};for(let[t,n]of Object.entries(Jv)){let r=t;e[n]=zv([`string`,`float`],((e,t)=>{let i={...Bn,[r]:Bv(t,n,`amount`)};return Xn.fromRgba(Rv(e,n)).applyKey(i).toRgba().hex}))}return e}function Xv(e=()=>P.TRUECOLOR){return{darken:Vv,lighten:Hv,mix:Wv,contrastOn:Kv,readableOn:qv(e),...Yv()}}function Zv(e,t){if(e.length%2!=0)throw RangeError(`ramp's last stop (position ${String(e[e.length-1])}) has no color — stops are <position> <color> pairs`);let n=[];for(let r=0;r<e.length;r+=2)n.push({at:e[r],color:er(t,e[r+1])});return n}function Qv(e){return{color:{fn:(t=>er(e(),t).hex),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},ramp:{fn:((t,n,...r)=>new Rr(Lr(n),Zv(r,e())).at(t).hex),argTypes:[`float`,`string`],arity:{kind:`alternating`,minimum:4},returnType:`string`}}}function $v(e){return{...Lv(),...Xv(e)}}new z({color:`red`,dim:!0});const ey=/^(?:(?:global|apac|au|eu|us|us-east-\d|us-west-\d|eu-west-\d|eu-central-\d)\.)?(?:anthropic\.|azure_ai\/|bedrock\/|vertex_ai\/)?claude-(?:(?<family>opus|sonnet|haiku)-(?<newMajor>\d+)(?:-(?<newMinor>\d))?|(?<oldMajor>\d+)(?:-(?<oldMinor>\d))?-(?<oldFamily>opus|sonnet|haiku))(?:[-@]\d{8})?(?:-v\d+:\d+)?(?:-latest)?$/i,ty=/^(?<family>opus|sonnet|haiku)\s+(?<major>\d+)(?:\.(?<minor>\d))?$/i;function ny(e){if(!e)return`Claude`;let t=e.trim().replace(/\s*\([^)]*\)\s*$/,``).replace(/\s*\[[^\]]*\]\s*$/,``).trim(),n=t.match(ey);if(n?.groups){let{family:e,newMajor:t,newMinor:r,oldMajor:i,oldMinor:a,oldFamily:o}=n.groups,s=e||o,c=t||i,l=r||a;if(s&&c)return`${s.charAt(0).toUpperCase()+s.slice(1).toLowerCase()} ${l?`${c}.${l}`:c}`}let r=t.match(ty);if(r?.groups){let e=r.groups.family,t=r.groups.major,n=r.groups.minor;return`${e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()} ${n?`${t}.${n}`:t}`}return t||e}function ry(e){let t=e.match(ty);if(!t?.groups)return e;let n=t.groups.family,r=t.groups.major,i=t.groups.minor;return`${n.charAt(0).toUpperCase()}${i?`${r}.${i}`:r}`}function iy(e){let t=e.split(`/`),n=t.length-1;return t.map((e,t)=>{if(t===n)return e;let r=e.match(/^\.*./);return r?r[0]:e}).join(`/`)}function ay(e){return e.toLocaleString()}function oy(e){if(e.length===0)throw Error(`a cascade needs at least one stop, e.g. "0:calm"`);let t=[];for(let[n,r]of e.entries()){let e=r.indexOf(`:`),i=e<0?NaN:Number(r.slice(0,e));if(!Number.isFinite(i))throw Error(`cascade stop ${n} ("${r}") must be "<position>:<result>", e.g. "80:hot" — the position must be a number`);let a=t[n-1];if(a!==void 0&&i<a.at)throw Error(`cascade stops must be in ascending position order; stop ${n} at ${i} follows stop ${n-1} at ${a.at}`);t.push({at:i,text:r.slice(e+1)})}return t}function sy(e,t){if(!Number.isFinite(e))throw Error(`a cascade needs a finite value, got ${e}`);let n=-1;for(;n+1<t.length&&t[n+1].at<=e;)n++;return(n<0?t[0]:t[n]).text}const cy=[`▁`,`▂`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],ly=cy.length;function uy(e,t){let n=t===void 0?e:t<=0?[]:e.slice(-t);if(n.length===0)return``;let r=n[0],i=n[0];for(let e of n)e<r&&(r=e),e>i&&(i=e);let a=i-r,o=``;for(let e of n){let t=a===0?0:Math.round((e-r)/a*(ly-1));o+=cy[t]}return o}function dy(e){let t=[];for(let n of e.split(`,`)){let e=n.trim();if(e===``)continue;let r=Number(e);if(!Number.isFinite(r))throw TypeError(`sparkline: non-numeric series element ${JSON.stringify(n)}`);t.push(r)}return t}function fy(e,t,n){if(n.length!==0)throw Error(`${e}: takes at most ${t.length} optional argument${t.length===1?``:`s`} (${t.join(`, `)}), got ${t.length+n.length}`)}const py=Za(),my=[...uo];function hy(){return{basename:{fn:e=>l(e),argTypes:[`string`],arity:{kind:`exact`}},dirname:{fn:e=>u(e),argTypes:[`string`],arity:{kind:`exact`}},abbreviatePath:{fn:e=>iy(e),argTypes:[`string`],arity:{kind:`exact`}},int:{fn:e=>Math.trunc(Dv(e)),argTypes:[`value`],arity:{kind:`exact`}},string:{fn:e=>Ev(e),argTypes:[`value`],arity:{kind:`exact`}},bool:{fn:e=>Ov(e),argTypes:[`value`],arity:{kind:`exact`}},urlEncode:{fn:e=>encodeURIComponent(e),argTypes:[`string`],arity:{kind:`exact`}},themes:{fn:()=>py,argTypes:[],arity:{kind:`exact`}},endcaps:{fn:()=>my,argTypes:[],arity:{kind:`exact`}},sparkline:{fn:(e,t,...n)=>(fy(`sparkline`,[`width`],n),uy(dy(e),t)),argTypes:[`string`,`int`],arity:{kind:`variadic`}},cascade:{fn:(e,...t)=>sy(e,oy(t)),argTypes:[`float`,`string`],arity:{kind:`variadic`}}}}function gy(e=()=>new Date){return{minutesUntilReset:{fn:t=>Math.round(Math.max(0,t*1e3-e().getTime())/6e4),argTypes:[`int`],arity:{kind:`exact`}},formatInteger:{fn:e=>ay(e),argTypes:[`int`],arity:{kind:`exact`}},round:{fn:e=>Math.round(e),argTypes:[`float`],arity:{kind:`exact`}},formatModelName:{fn:e=>ny(e),argTypes:[`string`],arity:{kind:`exact`}},shortenModelName:{fn:e=>ry(e),argTypes:[`string`],arity:{kind:`exact`}}}}function _y(e,t=()=>new Date,n){return up({fromString:e=>new V(e),toString:e=>e.plain,isT:e=>e instanceof V,clock:t,missingKey:`error`,funcs:{...$m(),...d_(),...zh(),...sg(),...Gm(t),...Fp(),...ph(),...$v(n),...hy(),...gy(t),...e??{}}})}function vy(e){return yy(e,new Set(e.names()),``)}function yy(e,t,n){return new Proxy(Object.create(null),{has(e,r){if(typeof r!=`string`)return!1;let i=n?`${n}.${r}`:r;if(t.has(i))return!0;let a=`${i}.`;for(let e of t)if(e.startsWith(a))return!0;return!1},get(r,i){if(typeof i!=`string`)return;let a=n?`${n}.${i}`:i;if(t.has(a))return e.getKind(a)===`document`?xy(a,e.readDocument(a)):e.read(a);let o=`${a}.`;for(let n of t)if(n.startsWith(o))return yy(e,t,a)}})}function by(e,t){return new Proxy(e,{has:(e,t)=>t===`settings`||Reflect.has(e,t),get:(e,n)=>n===`settings`?t:Reflect.get(e,n)})}function xy(e,t){switch(t.kind){case`ok`:return t.value;case`absent`:throw Error(`variable "${e}" has no value yet: its source has not completed a scan`);case`failed`:throw Error(`variable "${e}": ${t.reason}`)}}function J(e){return{kind:`ok`,value:e}}const Y={kind:`absent`};function X(e){return{kind:`failed`,reason:e}}function Sy(e,t){return e?.kind===`ok`?e.value:t}function Cy(e,t,n){return t.ok?J(t.stdout):t.reason===`non-zero`&&n===`absent`||t.reason===`non-zero`&&n===t.exitCode?Y:X(`${e}: ${[t.reason,t.exitCode==null?null:`exit ${t.exitCode}`,t.error??wy(t.stderr)].filter(Boolean).join(`, `)}`)}function wy(e){return e.trim().split(`
87
- `,1)[0]??``}function Ty(e,t){if(e.kind!==`ok`)return e;let n=t(e.value);return n===null?Y:J(n)}function Ey(e){if(e.kind!==`ok`)return e;let t=e.value.trim();return t?J(t):Y}const Dy=/^[A-Za-z]:[\\/]/;function Oy(e){let t=e.trim();if(Dy.test(t))return null;let n=t.match(/^(?:[^@/]+@)?(\[[^\]]+\]):(.*)$/)??t.match(/^(?:[^@/:]+@)?([^/:]+):(?!\/\/)(.*)$/),r=n?`ssh://${n[1]}/${n[2].replace(/^\/+/,``)}`:t,i;try{i=new URL(r)}catch{return null}return{scheme:i.protocol.replace(/:$/,``),host:i.hostname.toLowerCase(),port:i.port,path:i.pathname.replace(/^\/+/,``).replace(/\/+$/,``)}}function ky(e){return Oy(e)?.host||null}function Ay(e){let t=ky(e);return t?t===`github.com`||t.endsWith(`.github.com`)?`github`:/(^|\.)gitlab\./.test(t)?`gitlab`:null:null}function jy(e){let t=new Map;for(let n of e.split(`
88
- `)){let e=n.match(/^remote\.(.+)\.url\s+(\S.*)$/);if(!e)continue;let r=t.get(e[1])??[];r.push(e[2].trim()),t.set(e[1],r)}return[...t].map(([e,t])=>({name:e,urls:t}))}function My(e){return e.urls.find(e=>Ly(e)!==null)??e.urls[0]??null}function Ny(e){return e.find(e=>e.name===`origin`)??e[0]??null}function Py(e){let t=Ny(e);return t?My(t):null}function Fy(e){let t=Ny(e);return t?t.urls.find(e=>Ay(e)!==null)??My(t):null}function Iy(e){let t=(Oy(e)?.path??e.replace(/[\\/]+$/,``)).split(`/`);return(t[t.length-1]??``).replace(/\.git$/,``)||null}function Ly(e){let t=Oy(e);if(!t)return null;let n=t.scheme===`https`?{scheme:`https`,port:t.port}:t.scheme===`http`?{scheme:`http`,port:t.port}:t.scheme===`ssh`||t.scheme===`git`?{scheme:`https`,port:``}:null;if(!n||!t.host)return null;let r=t.path.replace(/\.git$/,``);if(!r)return null;let i=n.port?`${t.host}:${n.port}`:t.host;return`${n.scheme}://${i}/${r}`}function Ry(e){let t=Py(e);return t===null?null:Ly(t)}function zy(e,t,n,r){return t.ok?r(t.stdout):t.reason===`spawn-error`&&/ENOENT/i.test(t.error??``)||t.reason===`non-zero`&&n.test(t.stderr)?Y:X(`${e}: ${[t.reason,t.exitCode==null?null:`exit ${t.exitCode}`,t.error??wy(t.stderr)].filter(Boolean).join(`, `)}`)}function By(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Vy(e){let t=`detached`,n=Y,r=Y,i=Y,a=0,o=0,s=0,c=0;for(let l of e.split(`
89
- `)){if(!l)continue;if(l.startsWith(`# `)){let e=l.slice(2);if(e.startsWith(`branch.oid `)){let t=e.slice(11).trim();n=t===`(initial)`?Y:J(t)}else if(e.startsWith(`branch.head `)){let n=e.slice(12).trim();t=n===`(detached)`?`detached`:n}else if(e.startsWith(`branch.upstream `))r=J(e.slice(16).trim());else if(e.startsWith(`branch.ab `)){let t=e.slice(10).trim().match(/^\+(\d+)\s+-(\d+)$/);t&&(i=J({ahead:parseInt(t[1],10),behind:parseInt(t[2],10)}))}continue}let e=l[0];if(e===`1`||e===`2`){let e=l.slice(2,4);e[0]!==`.`&&a++,e[1]!==`.`&&o++}else e===`u`?c++:e===`?`&&s++}let l=`clean`;return c>0?l=`conflicts`:(a||o||s)&&(l=`dirty`),{branch:t,status:l,aheadBehind:i,oid:n,upstream:r,workingTree:{staged:a,unstaged:o,untracked:s,conflicts:c}}}function Hy(e){let t;try{t=JSON.parse(e)}catch(e){return X(`gh pr view: unparseable JSON (${e instanceof Error?e.message:String(e)})`)}if(!By(t))return X(`gh pr view: JSON is not an object`);let{number:n,state:r,url:i}=t;return typeof n!=`number`||typeof r!=`string`||typeof i!=`string`?X(`gh pr view: missing number/state/url`):r.toUpperCase()===`OPEN`?J({number:n,state:r,url:i}):Y}function Uy(e){let t;try{t=JSON.parse(e)}catch(e){return X(`glab mr view: unparseable JSON (${e instanceof Error?e.message:String(e)})`)}if(!By(t))return X(`glab mr view: JSON is not an object`);let n=t.iid,r=t.state,i=t.web_url;return typeof n!=`number`||typeof r!=`string`||typeof i!=`string`?X(`glab mr view: missing iid/state/web_url`):r.toLowerCase()===`opened`?J({number:n,state:r,url:i}):Y}function Wy(e){try{let t=r.statSync(e);return{key:`${t.dev}:${t.ino}`,stamp:`${t.mtimeMs}:${t.size}`}}catch{return null}}var Gy=class{isGitRepo(e){try{return r.existsSync(c.join(e,`.git`))}catch{return!1}}async execGitAsync(e,t){return De({bin:`git`,args:[...e],cwd:t.cwd,env:{...process.env,GIT_OPTIONAL_LOCKS:`0`},timeoutMs:t.timeout,category:`git`})}async resolveEffectiveGitDir(e,t){return this.isWorktree(e)?J(e):t&&this.isGitRepo(t)?J(t):this.isGitRepo(e)?J(e):this.findGitRoot(e)}async findGitRoot(e){let t=c.resolve(e);for(;;){if(this.isGitRepo(t))return J(t);let e=c.dirname(t);if(e===t)return Y;t=e}}async getGitInfo(e,t={},n){try{return await this.computeGitInfo(e,t,n)}catch(e){return X(`git: ${e instanceof Error?e.message:String(e)}`)}}async computeGitInfo(e,t={},n){let r,i=this.isWorktree(e);if(i)r=e;else if(n&&this.isGitRepo(n))r=n;else if(this.isGitRepo(e))r=e;else{let t=await this.findGitRoot(e);if(t.kind!==`ok`)return t;r=t.value}let a=await this.getCoreAsync(r);if(a.kind!==`ok`)return a;let o={branch:a.value.branch,status:a.value.status,aheadBehind:a.value.aheadBehind};t.showWorkingTree&&(o.workingTree=a.value.workingTree),t.showSha&&(o.sha=Ty(a.value.oid,e=>e.slice(0,7))),t.showUpstream&&(o.upstream=a.value.upstream),t.showTag&&(o.tag=await this.getNearestTagAsync(r)),t.showTimeSinceCommit&&(o.timeSinceCommit=await this.timeSinceCommit(r,a.value.oid)),t.showStashCount&&(o.stashCount=this.getStashCount(r));let s=t.showRepoName||t.showRepoUrl?await this.getRemotesAsync(r):void 0;return s!==void 0&&t.showRepoName&&(o.repoName=Ty(s,e=>this.repoNameFrom(e,r)),o.isWorktree=i),s!==void 0&&t.showRepoUrl&&(o.repoUrl=Ty(s,Ry)),t.showOperation&&(o.operation=this.getOngoingOperation(r)),J(o)}resolveGitDir(e){let t=c.join(e,`.git`);try{if(r.existsSync(t)&&r.statSync(t).isFile()){let n=r.readFileSync(t,`utf-8`).match(/^gitdir:\s*(.+)$/m);if(n?.[1])return c.resolve(e,n[1].trim())}}catch{}return t}getOngoingOperation(e){try{let t=this.resolveGitDir(e);return r.existsSync(c.join(t,`MERGE_HEAD`))?J(`MERGE`):r.existsSync(c.join(t,`CHERRY_PICK_HEAD`))?J(`CHERRY-PICK`):r.existsSync(c.join(t,`REVERT_HEAD`))?J(`REVERT`):r.existsSync(c.join(t,`BISECT_LOG`))?J(`BISECT`):r.existsSync(c.join(t,`rebase-merge`))||r.existsSync(c.join(t,`rebase-apply`))?J(`REBASE`):Y}catch(e){return X(`git operation probe: ${e instanceof Error?e.message:String(e)}`)}}async getNearestTagAsync(e){return Ey(Cy(`git describe --tags`,await this.execGitAsync([`describe`,`--tags`,`--abbrev=0`],{cwd:e,timeout:2e3}),`absent`))}async timeSinceCommit(e,t){return t.kind===`ok`?Ty(await this.commitTimestampMs(e,t.value),e=>Math.floor((Date.now()-e)/1e3)):t}commitTimes=new Map;async commitTimestampMs(e,t){let n=this.commitTimes.get(t);if(n!==void 0)return this.commitTimes.delete(t),this.commitTimes.set(t,n),n;let r=this.readCommitTimestampMs(e,t);for(this.commitTimes.set(t,r),r.then(e=>{e.kind!==`ok`&&this.commitTimes.get(t)===r&&this.commitTimes.delete(t)},()=>{this.commitTimes.get(t)===r&&this.commitTimes.delete(t)});this.commitTimes.size>256;){let e=this.commitTimes.keys().next().value;if(e===void 0)break;this.commitTimes.delete(e)}return r}async readCommitTimestampMs(e,t){let n=Ey(Cy(`git log -1`,await this.execGitAsync([`log`,`-1`,`--format=%ct`,t,`--`],{cwd:e,timeout:2e3}),`absent`));if(n.kind!==`ok`)return n;let r=parseInt(n.value,10)*1e3;return Number.isNaN(r)?X(`git log -1: unparseable timestamp "${n.value}"`):J(r)}resolveCommonGitDir(e){let t=this.resolveGitDir(e);try{let e=r.readFileSync(c.join(t,`commondir`),`utf-8`).trim();if(e)return c.resolve(t,e)}catch{}return t}getStashCount(e){let t=c.join(this.resolveCommonGitDir(e),`logs`,`refs`,`stash`),n;try{n=r.readFileSync(t,`utf-8`)}catch(e){return e.code===`ENOENT`?J(0):X(`git stash reflog ${t}: ${e instanceof Error?e.message:String(e)}`)}let i=n.trim();return J(i?i.split(`
90
- `).length:0)}async getRemotesAsync(e){let t=Wy(c.join(this.resolveCommonGitDir(e),`config`));if(t===null)return this.readRemotes(e);let{key:n,stamp:r}=t,i=this.remotesByConfig.get(n);if(i!==void 0&&i.stamp===r)return this.remotesByConfig.delete(n),this.remotesByConfig.set(n,i),i.remotes;let a=this.readRemotes(e);for(this.remotesByConfig.set(n,{stamp:r,remotes:a}),a.then(e=>{let t=this.remotesByConfig.get(n);e.kind!==`ok`&&t?.remotes===a&&this.remotesByConfig.delete(n)},()=>{this.remotesByConfig.get(n)?.remotes===a&&this.remotesByConfig.delete(n)});this.remotesByConfig.size>256;){let e=this.remotesByConfig.keys().next().value;if(e===void 0)break;this.remotesByConfig.delete(e)}return a}remotesByConfig=new Map;async readRemotes(e){let t=Cy(`git config --get-regexp remote url`,await this.execGitAsync([`config`,`--local`,`--get-regexp`,`^remote\\..*\\.url$`],{cwd:e,timeout:2e3}),1);return t.kind===`failed`?t:J(t.kind===`ok`?jy(t.value):[])}repoNameFrom(e,t){let n=Py(e);return(n===null?null:Iy(n))??c.basename(t)}async getRepoRemoteUrl(e){let t=await this.getRemotesAsync(e);if(t.kind!==`ok`)return t;let n=Fy(t.value);return n===null?Y:J(n)}async execForgeAsync(e,t,n){return De({bin:e,args:[...t],cwd:n.cwd,env:{...process.env},timeoutMs:n.timeout,category:`forge`})}async resolvePullRequest(e,t){let n=Ay(t);return n===`github`?zy(`gh pr view`,await this.execForgeAsync(`gh`,[`pr`,`view`,`--json`,`number,state,url`],{cwd:e,timeout:5e3}),/no (open )?pull requests? found/i,Hy):n===`gitlab`?zy(`glab mr view`,await this.execForgeAsync(`glab`,[`mr`,`view`,`--output`,`json`],{cwd:e,timeout:5e3}),/no (open )?merge requests? (found|available)/i,Uy):Y}isWorktree(e){try{let t=c.join(e,`.git`);return!!(r.existsSync(t)&&r.statSync(t).isFile())}catch{return!1}}async getCoreAsync(e){k(`[GIT-EXEC] Running git status --porcelain=v2 in ${e}`);let t=Cy(`git status --porcelain=v2 --branch`,await this.execGitAsync([`status`,`--porcelain=v2`,`--branch`],{cwd:e,timeout:2e3}),`failed`);return t.kind===`ok`?J(Vy(t.value)):t}};const Ky=(e,t)=>k(t);var qy=class{slots=new Map;maxWatchers;counters;logger;closed=!1;constructor(e={}){this.maxWatchers=e.maxWatchers??128,this.counters=e.counters,this.logger=e.logger??Ky}acquire(e,t,n){if(this.closed)return{release:()=>{}};let r=this.slots.get(e);if(r)return r.refcount++,r.onInvalidate=n,r.lastTouched=Date.now(),this.slots.delete(e),this.slots.set(e,r),this.makeHandle(e);let i={key:e,watchers:[],refcount:1,debounceTimer:null,onInvalidate:n,targets:t,lastTouched:Date.now()};return this.openWatchers(i),this.slots.set(e,i),this.counters&&this.counters.watchersOpened++,this.evictIfNeeded(),this.makeHandle(e)}makeHandle(e){let t=!1;return{release:()=>{if(t)return;t=!0;let n=this.slots.get(e);n&&(n.refcount=Math.max(0,n.refcount-1),n.refcount===0&&(this.closeSlot(n),this.slots.delete(e)))}}}openWatchers(e){let t=()=>{e.debounceTimer||(e.debounceTimer=setTimeout(()=>{e.debounceTimer=null;try{e.onInvalidate()}catch(e){this.logger(`warn`,`watcher invalidate threw: ${e.message}`)}},50),e.debounceTimer.unref())};for(let n of e.targets.files)try{let i=r.watch(n,{persistent:!1},t);i.on(`error`,e=>{this.logger(`warn`,`watcher error ${n}: ${e.message}`)}),e.watchers.push(i)}catch(e){this.logger(`warn`,`watch failed ${n}: ${e.message}`)}for(let n of e.targets.dirs)try{let i=n.filenames?new Set(n.filenames):null,a=r.watch(n.path,{persistent:!1},(e,n)=>{i&&(!n||!i.has(n))||t()});a.on(`error`,e=>{this.logger(`warn`,`watcher error ${n.path}: ${e.message}`)}),e.watchers.push(a)}catch(e){this.logger(`warn`,`watch failed ${n.path}: ${e.message}`)}}closeSlot(e){e.debounceTimer&&=(clearTimeout(e.debounceTimer),null);for(let t of e.watchers)try{t.close()}catch{}e.watchers=[],this.counters&&this.counters.watchersClosed++}evictIfNeeded(){for(;this.slots.size>this.maxWatchers;){let e=this.slots.keys().next().value;if(e===void 0)break;let t=this.slots.get(e);this.closeSlot(t),this.slots.delete(e),this.counters&&this.counters.watchersEvicted++;try{t.onInvalidate()}catch{}this.logger(`info`,`watcher LRU evict ${e}`)}}size(){return this.slots.size}closeAll(){this.closed=!0;for(let e of this.slots.values())this.closeSlot(e);this.slots.clear()}},Jy=class{running=new Set;again=new Set;run(e,t){return this.again.add(e),this.running.has(e)?{kind:`queued`}:(this.running.add(e),{kind:`started`,done:this.loop(e,t)})}async loop(e,t){try{do this.again.delete(e),await t();while(this.again.has(e))}finally{this.running.delete(e),this.again.delete(e)}}clear(){this.running.clear(),this.again.clear()}get size(){return this.running.size}};const Yy=(e,t)=>k(t),Xy={showSha:!0,showStashCount:!0};function Zy(e){let t=Object.keys(e).sort(),n={};for(let r of t)n[r]=e[r];return JSON.stringify(n)}function Qy(e){let t=t=>{try{return r.statSync(c.join(e,t)).mtimeMs}catch{return 0}};return{head:t(`HEAD`),index:t(`index`)}}function $y(e,t){return e.head!==t.head||e.index!==t.index}function eb(e){let t=[],n=c.join(e,`refs/heads`);try{r.statSync(n).isDirectory()&&t.push({path:n})}catch{}return{files:[c.join(e,`HEAD`),c.join(e,`index`)],dirs:t}}var tb=class extends Gy{entries=new Map;subscribersByRepo=new Map;fetchInFlight=new Map;resolutions=new Map;prCache=new Map;prFetchInFlight=new Map;refreshes=new Jy;hits=0;misses=0;invalidations=0;inner;ttlMs;maxEntries;watchers;ownsWatchers;logger;sanityTimer=null;constructor(e={}){super(),this.inner=e.inner??new Gy,this.ttlMs=e.ttlMs??3e4,this.maxEntries=e.maxEntries??64,this.logger=e.logger??Yy,e.watchers?(this.watchers=e.watchers,this.ownsWatchers=!1):(this.watchers=new qy({logger:this.logger}),this.ownsWatchers=!0);let t=e.sanityIntervalMs??3e5;t>0&&(this.sanityTimer=setInterval(()=>this.runSanityCheck(),t),this.sanityTimer.unref())}getWatcherRegistry(){return this.watchers}getStats(){return{size:this.entries.size,hits:this.hits,misses:this.misses,invalidations:this.invalidations,watchers:this.watchers.size()}}resolveEffectiveGitDir(e,t){let n=`${e}|${t??``}`,r=Date.now(),i=this.resolutions.get(n);if(i&&r-i.computedAt<this.ttlMs)return this.resolutions.delete(n),this.resolutions.set(n,i),i.dir;let a=this.inner.resolveEffectiveGitDir(e,t);return this.resolutions.set(n,{dir:a,computedAt:r}),a.catch(()=>{this.resolutions.get(n)?.dir===a&&this.resolutions.delete(n)}),this.evictResolutionsIfNeeded(),a}evictResolutionsIfNeeded(){for(;this.resolutions.size>this.maxEntries;){let e=this.resolutions.keys().next().value;if(e===void 0)break;this.resolutions.delete(e)}}async getGitInfo(e,t={},n){let r=await this.resolveEffectiveGitDir(e,n);return r.kind===`ok`?this.getGitInfoForRoot(r.value,t):r}getGitInfoForRoot(e,t){let n=`${e}|${Zy(t)}`,r=Date.now(),i=this.entries.get(n);if(i&&r-i.computedAt<this.ttlMs)return this.entries.delete(n),this.entries.set(n,i),this.hits++,Promise.resolve(J(i.info));let a=this.fetchInFlight.get(n);if(a)return a;let o=this.doFetch(e,n,t,r).finally(()=>{this.fetchInFlight.delete(n)});return this.fetchInFlight.set(n,o),o}async doFetch(e,t,n,r){this.misses++;let i=this.inner.resolveGitDir(e),a=Qy(i),o=await this.inner.getGitInfo(e,n);if(o.kind!==`ok`)return o;let s=o.value;n.showPullRequest&&(s.pullRequest=await this.getPullRequestCached(e,s.branch)),this.dropEntry(t);let c=this.watchers.acquire(`git:${e}`,eb(i),()=>this.invalidateRepo(e));return this.entries.set(t,{info:s,computedAt:r,mtime:a,watcher:c,repoRoot:e}),this.evictIfNeeded(),o}async getPullRequestCached(e,t){let n=await this.inner.getRepoRemoteUrl(e);if(n.kind===`failed`)return n;if(n.kind===`absent`)return Y;let r=n.value,i=`${e}|${t}|${r}`,a=Date.now(),o=this.prCache.get(i);if(o){let e=o.pr.kind===`failed`?45e3:3e5;if(a-o.computedAt<e)return this.prCache.delete(i),this.prCache.set(i,o),o.pr}let s=this.prFetchInFlight.get(i);if(s)return s;let c=this.inner.resolvePullRequest(e,r).then(e=>(this.prCache.set(i,{pr:e,computedAt:Date.now()}),this.evictPrIfNeeded(),e)).finally(()=>{this.prFetchInFlight.delete(i)});return this.prFetchInFlight.set(i,c),c}evictPrIfNeeded(){for(;this.prCache.size>this.maxEntries;){let e=this.prCache.keys().next().value;if(e===void 0)break;this.prCache.delete(e)}}deliverable(e,t){return e.kind===`failed`?(this.logger(`warn`,`git fetch failed (${t}): ${e.reason}`),null):e.kind===`ok`?e.value:null}subscribe(e,t){let n=!1,r=null;return{firstDelivery:(async()=>{let i=await this.resolveEffectiveGitDir(e);if(n)return;if(i.kind!==`ok`){i.kind===`failed`&&this.logger(`warn`,`git resolve failed (subscribe ${e}): ${i.reason}`),this.safeInvoke(t,null);return}let a=i.value,o=this.subscribersByRepo.get(a);if(!o){let t=this.inner.resolveGitDir(a),n=this.watchers.acquire(`git:${a}`,eb(t),()=>this.invalidateRepo(a));o={workingDir:e,repoRoot:a,callbacks:new Set,watcher:n},this.subscribersByRepo.set(a,o)}o.callbacks.add(t),r={repoRoot:a,entry:o};let s=await this.getGitInfoForRoot(a,{...Xy});n||this.safeInvoke(t,this.deliverable(s,a))})(),unsubscribe:()=>{if(n=!0,!r)return;let{repoRoot:e,entry:i}=r;i.callbacks.delete(t),i.callbacks.size===0&&(i.watcher.release(),this.subscribersByRepo.delete(e))}}}invalidateRepo(e){let t=0;for(let[n,r]of this.entries)r.repoRoot===e&&(r.watcher.release(),this.entries.delete(n),t++);t>0&&(this.invalidations+=t,this.logger(`info`,`gitCache invalidate ${e} dropped=${t}`)),this.refreshSubscribers(e)}refreshSubscribers(e){let t=this.subscribersByRepo.get(e);!t||t.callbacks.size===0||this.refreshes.run(e,()=>this.refreshOnce(e))}async refreshOnce(e){let t=this.subscribersByRepo.get(e);if(!t||t.callbacks.size===0)return;let n=await this.getGitInfoForRoot(e,{...Xy}),r=this.deliverable(n,e),i=this.subscribersByRepo.get(e);if(!(!i||i.callbacks.size===0))for(let e of[...i.callbacks])i.callbacks.has(e)&&this.safeInvoke(e,r)}safeInvoke(e,t){try{e(t)}catch(e){this.logger(`warn`,`git subscriber threw: ${e.message??String(e)}`)}}dropEntry(e){let t=this.entries.get(e);t&&(t.watcher.release(),this.entries.delete(e))}evictIfNeeded(){for(;this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.dropEntry(e),this.logger(`info`,`gitCache evict ${e}`)}}runSanityCheck(){let e=new Map;for(let t of this.entries.values()){let n=e.get(t.repoRoot);n||(n=Qy(this.inner.resolveGitDir(t.repoRoot)),e.set(t.repoRoot,n)),$y(t.mtime,n)&&this.invalidateRepo(t.repoRoot)}}runSanityCheckNow(){this.runSanityCheck()}close(){this.sanityTimer&&=(clearInterval(this.sanityTimer),null);for(let e of this.entries.values())e.watcher.release();this.entries.clear();for(let e of this.subscribersByRepo.values())e.callbacks.clear(),e.watcher.release();this.subscribersByRepo.clear(),this.refreshes.clear(),this.fetchInFlight.clear(),this.prCache.clear(),this.prFetchInFlight.clear(),this.resolutions.clear(),this.ownsWatchers&&this.watchers.closeAll()}};const nb=/\r\n|\r|\n/g,rb=e=>J(e.replace(nb,` `).trim());function ib(e){return t=>{let n=e.exec(t)?.[1];return n===void 0?X(`regex no-match`):J(n.replace(nb,` `))}}const ab=e=>{try{return J(JSON.parse(e))}catch(e){return X(`JSON parse failed: ${e.message}`)}};function ob(e,t){return t.kind!==`ttl`||t.durationMs>=500?t:(k(`declareShell "${e}": ttl ${t.durationMs}ms below floor 500ms; clamping`),{kind:`ttl`,durationMs:500})}function sb(e){let t=/^(\d+(?:\.\d+)?)(ms|s|m|h)$/.exec(e);if(!t)throw RangeError(`Invalid duration: "${e}"`);let n=parseFloat(t[1]);switch(t[2]){case`ms`:return n;case`s`:return n*1e3;case`m`:return n*6e4;case`h`:return n*36e5;default:throw RangeError(`Unexpected duration unit: "${t[2]}"`)}}const cb=`session.id`;function lb(e,t,n){return{where:`output of "${e}" in ${t}`,read:async()=>{let r=await De({bin:`/bin/sh`,args:[`-c`,e],cwd:t,category:`user-shell`,signal:n});if(!r.ok&&r.reason===`aborted`)throw n.reason;return r.ok?J(r.stdout):X(`shell "${e}" ${r.exitCode===null?[r.reason,r.error].filter(e=>e!==void 0).join(`: `):`exited with code ${r.exitCode}`} in ${t}`)}}}function ub(e,t,n){return{where:`"${e}"`,read:async()=>{try{let r=await S(e,{encoding:`utf8`,signal:n});return J(t===`first-line`?r.split(/\r?\n/)[0]??``:r)}catch{if(n.aborted)throw n.reason;return X(`file unreadable: ${e}`)}}}}function db(e,t,n){if(e.kind!==`ok`)return e;let r=t(e.value);return r.kind===`failed`?X(`${r.reason} in ${n}`):r}const fb=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],pb=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],mb=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],hb=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function gb(e,t){let n=[[`2006`,e=>String(e.getFullYear())],[`January`,e=>fb[e.getMonth()]],[`Monday`,e=>mb[e.getDay()]],[`Jan`,e=>pb[e.getMonth()]],[`Mon`,e=>hb[e.getDay()]],[`15`,e=>String(e.getHours()).padStart(2,`0`)],[`06`,e=>String(e.getFullYear()%100).padStart(2,`0`)],[`01`,e=>String(e.getMonth()+1).padStart(2,`0`)],[`02`,e=>String(e.getDate()).padStart(2,`0`)],[`04`,e=>String(e.getMinutes()).padStart(2,`0`)],[`05`,e=>String(e.getSeconds()).padStart(2,`0`)],[`PM`,e=>e.getHours()<12?`AM`:`PM`],[`pm`,e=>e.getHours()<12?`am`:`pm`],[`1`,e=>String(e.getMonth()+1)],[`2`,e=>String(e.getDate())],[`3`,e=>String(e.getHours()%12||12)],[`4`,e=>String(e.getMinutes())],[`5`,e=>String(e.getSeconds())]],r=``,i=0;for(;i<e.length;){let a=!1;for(let[o,s]of n)if(e.startsWith(o,i)){r+=s(t),i+=o.length,a=!0;break}a||(r+=e[i],i++)}return r}const _b={branch:`string`,sha:`string`,dirty:`boolean`,ahead:`number`,behind:`number`,stash:`number`};function vb(e,t,n,r){if(e===null){if(n!==void 0)return n;let e=_b[t];try{return Sb(r,e)}catch{return Cb(e)}}switch(t){case`branch`:return e.branch===`detached`?``:e.branch;case`sha`:return Sy(e.sha,``);case`dirty`:return e.status!==`clean`;case`ahead`:return Sy(e.aheadBehind,{ahead:0,behind:0}).ahead;case`behind`:return Sy(e.aheadBehind,{ahead:0,behind:0}).behind;case`stash`:return Sy(e.stashCount,0)}}var yb=class{watchers=new Map;subscribe(e,t){let n=this.watchers.get(e);if(!n){let t=new Set,r;try{r=s(e,()=>{for(let e of t)e()})}catch{return()=>{}}n={watcher:r,callbacks:t},this.watchers.set(e,n)}return n.callbacks.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){let n=this.watchers.get(e);n&&(n.callbacks.delete(t),n.callbacks.size===0&&(n.watcher.close(),this.watchers.delete(e)))}dispose(){for(let{watcher:e}of this.watchers.values())e.close();this.watchers.clear()}size(){return this.watchers.size}},bb=class{buckets=new Map;subscribe(e,t){let n=this.buckets.get(e);if(!n){let t=new Set;n={timer:ee(()=>{for(let e of t)e()},e),callbacks:t},this.buckets.set(e,n)}return n.callbacks.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){let n=this.buckets.get(e);n&&(n.callbacks.delete(t),n.callbacks.size===0&&(T(n.timer),this.buckets.delete(e)))}dispose(){for(let{timer:e}of this.buckets.values())T(e);this.buckets.clear()}bucketCount(){return this.buckets.size}};function xb(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function Sb(e,t){if(typeof e!=`string`&&typeof e!=`number`&&typeof e!=`boolean`)throw TypeError(`Expected string|number|boolean from payload, got ${typeof e}`);return t===`string`?Ev(e):t===`number`?Dv(e):Ov(e)}function Cb(e){return e===`number`?0:e===`boolean`?!1:``}var wb=class{inputMetas=new Map;lastErrors=new Map;watchMgr=new yb;ttlMgr=new bb;gitSubscriptions=new Map;cleanups=[];inFlight=new Map;reads=new Jy;abort=new AbortController;drawn=Cv.observable.box(P.TRUECOLOR);drawnAt=()=>this.drawn.get();engine=_y(void 0,void 0,this.drawnAt);gitProvider;ownsGitProvider;sessionState;constructor(e,t=``,n,r){this.store=e,this.defaultEmptyValue=t,n?(this.gitProvider=n,this.ownsGitProvider=!1):(this.gitProvider=new tb({sanityIntervalMs:0}),this.ownsGitProvider=!0),this.sessionState=r}get variableStore(){return this.store}declareLiteral(e,t){this.store.defineBox(e,Tv(t),t)}declareInput(e,t,n,r){let i=r===void 0?this.defaultFor(n):r;this.store.defineBox(e,n,i),this.inputMetas.set(e,{path:t,varDefault:r})}declareEnv(e,t,n){let r=process.env[t];if(r!==void 0){this.store.defineBox(e,`string`,r);return}let i=n===void 0?typeof this.defaultEmptyValue==`string`?this.defaultEmptyValue:``:n;this.store.defineBox(e,`string`,i),this.recordError(e,`env var "${t}" is not set`)}declareShell(e,t,n){this.declareSource(e,lb(t,n.cwd,this.abort.signal),ob(e,n.cache),n.parse)}declareFile(e,t,n){this.declareSource(e,ub(t,n.readMode??`whole`,this.abort.signal),n.cache,n.parse)}declareSource(e,t,n,r){let i=this.publisherFor(e,r,t.where),a=()=>this.runSource(e,t,i);a(),this.registerCachePolicy(e,n,a)}publisherFor(e,t,n){switch(t.kind){case`text`:return this.scalarPublisher(e,rb,t.default,n);case`regex`:return this.scalarPublisher(e,ib(t.regex),t.default,n);case`json`:return this.documentPublisher(e,t.default,n)}}scalarPublisher(e,t,n,r){let i=this.stringInitial(n);return this.store.defineBox(e,`string`,i),n=>{let a=db(n,t,r);this.noteOutcome(e,a),this.store.setBox(e,Sy(a,i))}}documentPublisher(e,t,n){let r=t===void 0?Y:J(t);return this.store.defineDocument(e,r),i=>{let a=db(i,ab,n);this.noteOutcome(e,a),this.store.setDocument(e,a.kind===`ok`||t===void 0?a:r)}}runSource(e,t,n){let r=this.reads.run(e,()=>t.read().then(n,e=>{if(e!==this.abort.signal.reason)throw e}));r.kind===`started`&&this.track(e,r.done)}track(e,t){let n=t.finally(()=>{this.inFlight.get(e)===n&&this.inFlight.delete(e)});this.inFlight.set(e,n)}async settled(e){let t=Date.now()+e;for(;this.inFlight.size>0;){let e=t-Date.now();if(e<=0)break;let n,r=await Promise.race([Promise.all(this.inFlight.values()).then(()=>`settled`),new Promise(t=>{n=setTimeout(()=>t(`deadline`),e)})]);if(clearTimeout(n),r===`deadline`)break}return[...this.inFlight.keys()]}declareTemplate(e,t,n={}){let r=this.engine.parse(t);this.store.defineComputed(e,`string`,t=>{let i=vy(this.store);try{let t=r.evaluate(i).map(e=>e.plain).join(``);return this.lastErrors.delete(e),t}catch(t){let r=t instanceof Error?t.message:String(t);if(this.recordError(e,r),n.varDefault===void 0)throw Error(`variable "${e}": ${r}`);return n.varDefault}});try{this.store.read(e)}catch{}}declareTime(e,t){let n=t.ttlMs??1e3;this.store.defineBox(e,`string`,(e=>{try{return gb(t.format,e)}catch{return this.stringInitial(t.varDefault)}})(new Date));let r=this.ttlMgr.subscribe(n,()=>{try{this.store.setBox(e,gb(t.format,new Date)),this.lastErrors.delete(e)}catch(n){this.applyFallback(e,`string`,t.varDefault,n instanceof Error?n.message:String(n))}});this.cleanups.push(r)}declareGit(e,t){let n=_b[t.field],r=t.varDefault===void 0?Cb(n):Sb(t.varDefault,n);this.store.defineBox(e,n,r);let i=this.gitSubscriptions.get(t.cwd);if(!i){let e=new Map,n=this.gitProvider.subscribe(t.cwd,t=>{this.store.runInAction(()=>{for(let[n,r]of e)for(let{name:e,varDefault:i}of r)this.store.setBox(e,vb(t,n,i,this.defaultEmptyValue))})});i={fieldSubs:e,firstDelivery:n.firstDelivery,unsubscribe:n.unsubscribe},this.gitSubscriptions.set(t.cwd,i)}let a=i.fieldSubs.get(t.field);a||(a=[],i.fieldSubs.set(t.field,a)),a.push({name:e,varDefault:t.varDefault}),this.track(e,i.firstDelivery)}declareState(e,t){if(!this.sessionState)throw Error(`declareState("${e}"): SourceRegistry was constructed without a SessionState — state-kind variables require a SessionState (the daemon provides one; tests must supply one)`);let n=this.sessionState,r=t.varDefault??this.stringInitial(void 0);this.store.defineComputed(e,`string`,e=>{let i=e(cb);if(typeof i!=`string`||!i)return r;let a=n.get(i,t.key);return a===null?r:a})}applyInput(e){this.store.runInAction(()=>{for(let[t,n]of this.inputMetas){let r=xb(e,n.path),i=this.store.getType(t);if(r!==void 0)try{this.store.setBox(t,Sb(r,i)),this.lastErrors.delete(t)}catch(e){this.applyFallback(t,i,n.varDefault,e instanceof Error?e.message:String(e))}else this.applyFallback(t,i,n.varDefault,`input path "${n.path}" not found in payload`)}})}drawAt(e){this.store.runInAction(()=>this.drawn.set(e))}getLastError(e){return this.lastErrors.get(e)}dispose(){this.abort.abort();for(let e of this.cleanups)e();this.cleanups.length=0;for(let e of this.gitSubscriptions.values())e.unsubscribe();this.gitSubscriptions.clear(),this.reads.clear(),this.watchMgr.dispose(),this.ttlMgr.dispose(),this.ownsGitProvider&&this.gitProvider.close()}registerCachePolicy(e,t,n){switch(t.kind){case`never`:break;case`ttl`:{let e=this.ttlMgr.subscribe(t.durationMs,n);this.cleanups.push(e);break}case`watch_file`:{let e=this.watchMgr.subscribe(t.path,n);this.cleanups.push(e);break}case`key`:{let e=this.engine.parse(t.template),r=(0,Cv.reaction)(()=>{let t=vy(this.store);try{return e.evaluate(t).map(e=>e.plain).join(``)}catch{return``}},n);this.cleanups.push(r);break}case`depends_on`:{let e=(0,Cv.reaction)(()=>t.varNames.map(e=>this.store.changeKey(e)).join(`,`),n);this.cleanups.push(e);break}}}applyFallback(e,t,n,r){if(this.recordError(e,r),n!==void 0){this.store.setBox(e,n);return}try{this.store.setBox(e,Sb(this.defaultEmptyValue,t))}catch{this.store.setBox(e,Cb(t))}}defaultFor(e){try{return Sb(this.defaultEmptyValue,e)}catch{return Cb(e)}}stringInitial(e){return e===void 0?typeof this.defaultEmptyValue==`string`?this.defaultEmptyValue:``:e}recordError(e,t){this.lastErrors.set(e,{timestamp:Date.now(),message:t})}noteOutcome(e,t){t.kind===`ok`?this.lastErrors.delete(e):this.recordError(e,t.kind===`failed`?t.reason:`no value`)}};const Tb={project_dir:{kind:`input`,path:`workspace.project_dir`,default:``},[cb]:{kind:`input`,path:`session_id`,default:``},transcript_path:{kind:`input`,path:`transcript_path`,default:``},resume_command:{kind:`input`,path:`resumeCommand`,default:``},config_path:{kind:`input`,path:`configPath`,default:``},"theme.effective":{kind:`input`,path:`theme.effective`,default:``},"style.effective":{kind:`input`,path:`style.effective`,default:``},"preset.effective":{kind:`input`,path:`preset.effective`,default:``},"preset.customized":{kind:`input`,path:`preset.customized`,type:`boolean`,default:!1},"preset.bundled":{kind:`input`,path:`preset.bundled`,type:`boolean`,default:!0},"endcaps.effective":{kind:`input`,path:`endcaps.effective`,default:``},"variation.effective":{kind:`input`,path:`variation.effective`,default:``},"charset.effective":{kind:`input`,path:`charset.effective`,default:``},"colorCompatibility.effective":{kind:`input`,path:`colorCompatibility.effective`,default:``},"autoWrap.effective":{kind:`input`,path:`autoWrap.effective`,type:`boolean`,default:!0},"padding.effective":{kind:`input`,path:`padding.effective`,type:`number`,default:1},"updateNotice.effective":{kind:`input`,path:`updateNotice.effective`,type:`boolean`,default:!0},"term.cols":{kind:`input`,path:`term.cols`,type:`number`,default:80},"git.repoUrl":{kind:`input`,path:`git.repoUrl`,default:``}},Eb={theme:{configKey:`palette`,sessionKey:`theme`,effectiveVar:`theme.effective`,label:`🎨`},preset:{configKey:`preset`,sessionKey:`preset`,effectiveVar:`preset.effective`,label:`▦`},style:{configKey:`style`,sessionKey:`style`,effectiveVar:`style.effective`,label:`◐`},endcaps:{configKey:`endcaps`,sessionKey:`endcaps`,effectiveVar:`endcaps.effective`,label:`✦`},variation:{configKey:`variation`,sessionKey:`variation`,effectiveVar:`variation.effective`,label:`🎼`},autoWrap:{configKey:`autoWrap`,sessionKey:`autoWrap`,effectiveVar:`autoWrap.effective`,label:`wrap`},padding:{configKey:`padding`,sessionKey:`padding`,effectiveVar:`padding.effective`,label:`padding`},updateNotice:{configKey:`updateNotice`,sessionKey:`updateNotice`,effectiveVar:`updateNotice.effective`,label:`update notice`}},Db=Object.values(Eb),Ob=[{configKey:`charset`,effectiveVar:`charset.effective`},{configKey:`colorCompatibility`,effectiveVar:`colorCompatibility.effective`}],kb=new Set(Ob.map(e=>e.configKey)),Ab=new Map([...Db,...Ob].map(e=>[e.configKey,e.effectiveVar])),jb=new Map(Db.map(e=>[e.sessionKey,e.effectiveVar])),Mb=new Map(Object.keys(Eb).map(e=>[Eb[e].sessionKey,e]));function Nb(e,t,n){let r=new Set,i=e=>{for(let t of pv(e??``,n).keys())r.add(t)};for(let t of Object.values(e.segments))i(t.template),i(t.bg),i(t.fg),i(t.when);for(let e of t)for(let t of js(e))i(t.when),t.kind===`segment`&&(i(t.lead),i(t.trail));for(let t of Object.values(e.variables))t.kind===`template`&&i(t.template),t.kind===`state`&&r.add(cb);for(let t of Object.values(e.actions)){r.add(cb),`copy`in t&&i(t.copy),`open`in t&&i(t.open);let e=`set`in t?jb.get(t.set):void 0,n=`persist`in t?Ab.get(t.persist):void 0;e!==void 0&&r.add(e),n!==void 0&&r.add(n)}return r}function Pb(e,t,n){let r=yv({...n,variables:{...n.variables,...e.variables},segments:{...n.segments,...e.segments}}),i={};for(let a of Nb(e,t,n.helpers)){if(vv(a,r))continue;let e=Tb[a];if(e===void 0)throw Error(`synthesized chrome reads ".${a}", which it does not declare and PAYLOAD_INPUTS does not supply`);i[a]=e}return i}const Fb=new Map,Ib=new Map;function Lb(e){let t=zb(e);if(t===null)throw Error(`Palette "${e}" did not resolve in the theme registry — allowed names and the registry are inconsistent`);return t}function Rb(e,t){return e===`bar`?t:Lb(e)}function zb(e){let t=Fb.get(e);if(t!==void 0)return t;let n=Er(e);return n===null?null:(Fb.set(e,n),n)}function Bb(e,t){let n=`${e.name} ${t.hueShift} ${t.chromaScale} ${t.lightnessScale} ${t.lightnessShift}`,r=Ib.get(n);if(r!==void 0)return r;let i=Pr(e,t);return Ib.set(n,i),i}function Vb(e){let t=zb(e);return t===null?null:{kind:`decided`,name:e,value:t}}function Hb(e,t,n){let r=Vb(e);return r===null?(n(`${t} rendered "${Ya}": "${e}" names no installed theme${Ja(e)}`),Wb()):r}function Ub(e,t,n){return io(e,t,n,Wb(),Vb)}function Wb(){return Vb(Ya)}function Gb(e){return ao(Ub(void 0,null,e),Wb).value}const Kb=new Map;function qb(e,t,n){Kb.set(e,{permanent:!0,resolve:t,paletteOf:n})}qb(`themes`,()=>Za(),e=>Lb(e));const Jb=`placementThemes`;qb(Jb,Qa,(e,t)=>Rb(e,t.palette)),qb(`endcaps`,()=>uo),qb(`variations`,()=>vo),qb(`charsets`,()=>mo),qb(`colorCompatibilities`,()=>go);function Yb(e){return new Map([[`styles`,{members:Object.keys(e.styles),paletteOf:(t,n)=>Bb(n.basePalette,e.styles[t])}],[`presets`,{members:C_(e.presets)}]])}function Xb(e){return[...new Set([...Kb.keys(),...e.keys()])]}function Zb(e,t){if(typeof e!=`string`)return{members:e};let n=t.get(e);if(n)return n;let r=Kb.get(e);if(r)return{members:r.resolve(),paletteOf:r.paletteOf};throw Error(`unknown option domain "${e}" (have: ${Xb(t).join(`, `)})`)}function Qb(e){return{label:e.label,domain:$b(e.domain)}}function $b(e){return e===`theme`?{from:Jb}:e===`bool`||`min`in e?e:{from:e}}function ex(e,t,n,r){let i=Kc(e.label),{domain:a}=e;if(a===`bool`)return{kind:`inline`,template:`{{ action "${r}" "☑ ${i}" "☐ ${i}" }}`,actions:{[r]:{set:t,cycle:[...Co]}}};if(`from`in a)return{kind:`ring`,template:`{{ carousel "${r}" }}`,actions:{[r]:{set:t,from:a.from}}};let o=e=>({set:t,min:a.min,max:a.max,by:e});return{kind:`inline`,template:`{{ action "${r}.down" "◀" }} {{ "${i}" }} {{ .${n} }} {{ action "${r}.up" "▶" }}`,actions:{[`${r}.down`]:o(-a.step),[`${r}.up`]:o(a.step)}}}const tx=/^segments\.([^.]+)\.palette$/,nx=/^presets\.(.+)\.root$/,rx=/^presets\.(.+)\.globals\.([^.]+)$/;function ix(e){return`presets.${e}.root`}function ax(e,t){return`presets.${e}.globals.${t}`}function ox(e){if(El(e))return{scope:`globals`,field:e};let t=tx.exec(e);if(t)return{scope:`segment-palette`,segment:t[1]};let n=rx.exec(e);if(n&&yl(n[2]))return{scope:`preset-globals`,preset:n[1],field:n[2]};let r=nx.exec(e);return r?{scope:`preset-root`,preset:r[1]}:null}function sx(e){switch(e.scope){case`globals`:return[`globals`,e.field];case`preset-globals`:return[`presets`,e.preset,`globals`,e.field];case`segment-palette`:return[`segments`,e.segment,`palette`]}}const cx=`open`;function lx(e,t,n,r){let i={variable:e,key:e,member:cx};return r.variables[e]=Qc(e,Hc),r.actions[e]=$c(e,cx),r.segments[e]={template:Xc(e,`(?)`,`✕`),...ux(n)},qc(e,i,{kind:`container`,direction:`horizontal`,children:t.map((t,n)=>{let i=`${e}.${n}`;return r.segments[i]={template:t},{kind:`segment`,name:i}})},`drop`)}function ux(e){let[t,...n]=e;return t===void 0?{}:{when:Jc(t,...n)}}const dx=`none`;var fx=class extends Error{constructor(e,t,n){super(`Invalid ${t} color ${JSON.stringify(e)}: ${n}`),this.name=`ColorSpecError`}};function px(e,t,n,r,i){let{palette:a,tint:o}=e,s=mx(n,i),c=s!==dx,l=c?s===void 0?o:hx(a,s,`bg`):hx(a,`background`,`bg`);e.bg=l;let u=mx(r,i),d=u===void 0?c?ka(a,l,t):void 0:hx(a,u,`fg`);return new z({...c&&{bgcolor:yn.fromRgba(l)},...d!==void 0&&{color:yn.fromRgba(d)}})}function mx(e,t){if(e!==void 0)return e.evaluate(t).map(e=>e.plain).join(``)}function hx(e,t,n){try{return er(e,t)}catch(e){throw e instanceof Zn?new fx(t,n,e.message):e}}const gx={help:[`-h`,`--help`],version:[`-V`,`--version`]},_x=[`✚ inserts`,`✖ removes`,`⚙️ configures`,`↺ resets layout`],vx=`
86
+ Use 'override' annotation for methods overridden by subclass.`)}}var na=ca(0),ra=function(){var e=!1,t={};return Object.defineProperty(t,`0`,{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),ia=0,aa=function(){};function oa(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__===void 0?e.prototype=t:e.prototype.__proto__=t}oa(aa,Array.prototype);var sa=function(e){function t(t,n,r,i){var a;return r===void 0&&(r=`ObservableArray@`+h()),i===void 0&&(i=!1),a=e.call(this)||this,ha(function(){var e=new ki(r,n,i,!0);e.proxy_=a,w(a,A,e),t&&t.length&&a.spliceWithArray(0,0,t),ra&&Object.defineProperty(a,`0`,na)}),a}ge(t,e);var n=t.prototype;return n.concat=function(){this[A].atom_.reportObserved();var e=[...arguments];return Array.prototype.concat.apply(this.slice(),e.map(function(e){return Fi(e)?e.slice():e}))},n[Symbol.iterator]=function(){var e=this,t=0;return xa({next:function(){return t<e.length?{value:e[t++],done:!1}:{done:!0,value:void 0}}})},fe(t,[{key:`length`,get:function(){return this[A].getArrayLength_()},set:function(e){this[A].setArrayLength_(e)}},{key:Symbol.toStringTag,get:function(){return`Array`}}])}(aa);Object.entries(U).forEach(function(e){var t=e[0],n=e[1];t!==`concat`&&C(sa.prototype,t,n)});function ca(e){return{enumerable:!1,configurable:!0,get:function(){return this[A].get_(e)},set:function(t){this[A].set_(e,t)}}}function la(e){s(sa.prototype,``+e,ca(e))}function ua(e){if(e>ia){for(var t=ia;t<e+100;t++)la(t);ia=e}}ua(1e3);function da(e,t,n){return new sa(e,t,n)}function fa(e,t){if(typeof e==`object`&&e){if(Fi(e))return t!==void 0&&n(23),e[A].atom_;if(Gi(e))return e.atom_;if(Bi(e)){if(t===void 0)return e.keysAtom_;var r=e.data_.get(t)||e.hasMap_.get(t);return r||n(25,t,ma(e)),r}if($i(e)){if(!t)return n(26);var i=e[A].values_.get(t);return i||n(27,t,ma(e)),i}if(je(e)||en(e)||B(e))return e}else if(v(e)&&B(e[A]))return e[A];n(28)}function pa(e,t){if(e||n(29),t!==void 0)return pa(fa(e,t));if(je(e)||en(e)||B(e)||Bi(e)||Gi(e))return e;if(e[A])return e[A];n(24,e)}function ma(e,t){var n;if(t!==void 0)n=fa(e,t);else if(cr(e))return e.name;else n=$i(e)||Bi(e)||Gi(e)?pa(e):fa(e);return n.name_}function ha(e){var t=L(),n=Jt(!0);kn();try{return e()}finally{An(),Yt(n),pn(t)}}var ga=c.toString;function _a(e,t,n){return n===void 0&&(n=-1),va(e,t,n)}function va(e,t,n,r,i){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var a=typeof e;if(a!==`function`&&a!==`object`&&typeof t!=`object`)return!1;var o=ga.call(e);if(o!==ga.call(t))return!1;switch(o){case`[object RegExp]`:case`[object String]`:return``+e==``+t;case`[object Number]`:return+e==+e?+e==0?1/e==1/t:+e==+t:+t!=+t;case`[object Date]`:case`[object Boolean]`:return+e==+t;case`[object Symbol]`:return typeof Symbol<`u`&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case`[object Map]`:case`[object Set]`:n>=0&&n++;break}e=ya(e),t=ya(t);var s=o===`[object Array]`;if(!s){if(typeof e!=`object`||typeof t!=`object`)return!1;var c=e.constructor,l=t.constructor;if(c!==l&&!(v(c)&&c instanceof c&&v(l)&&l instanceof l)&&`constructor`in e&&`constructor`in t)return!1}if(n===0)return!1;n<0&&(n=-1),r||=[],i||=[];for(var u=r.length;u--;)if(r[u]===e)return i[u]===t;if(r.push(e),i.push(t),s){if(u=e.length,u!==t.length)return!1;for(;u--;)if(!va(e[u],t[u],n-1,r,i))return!1}else{var d=Object.keys(e),f=d.length;if(Object.keys(t).length!==f)return!1;for(var p=0;p<f;p++){var m=d[p];if(!(ae(t,m)&&va(e[m],t[m],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function ya(e){return Fi(e)?e.slice():ee(e)||Bi(e)||E(e)||Gi(e)?Array.from(e.entries()):e}var ba=i().Iterator?.prototype||{};function xa(e){return e[Symbol.iterator]=Sa,Object.assign(Object.create(ba),e)}function Sa(){return this}function Ca(e){return e instanceof Object&&typeof e.annotationType_==`string`&&v(e.make_)&&v(e.extend_)}[`Symbol`,`Map`,`Set`].forEach(function(e){i()[e]===void 0&&n(`MobX requires global '`+e+`' to be available or polyfilled`)}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__==`object`&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Jn,extras:{getDebugName:ma},$mobx:A}),e.$mobx=A,e.FlowCancellationError=Ar,e.ObservableMap=zi,e.ObservableSet=Wi,e.Reaction=In,e._allowStateChanges=qt,e._allowStateChangesInsideComputed=sr,e._allowStateReadsEnd=hn,e._allowStateReadsStart=mn,e._autoAction=or,e._endAction=Kt,e._getAdministration=pa,e._getGlobalState=Sn,e._interceptReads=Rr,e._isComputingDerivation=on,e._resetGlobalState=Cn,e._startAction=Gt,e.action=ar,e.autorun=lr,e.comparer=Le,e.computed=zt,e.configure=Sr,e.createAtom=Me,e.defineProperty=ei,e.entries=Yr,e.extendObservable=Cr,e.flow=Pr,e.flowResult=Ir,e.get=$r,e.getAtom=fa,e.getDebugName=ma,e.getDependencyTree=wr,e.getObserverTree=Er,e.has=Qr,e.intercept=zr,e.isAction=cr,e.isBoxedObservable=Qt,e.isComputed=V,e.isComputedProp=Ur,e.isFlow=Lr,e.isFlowCancellationError=jr,e.isObservable=Gr,e.isObservableArray=Fi,e.isObservableMap=Bi,e.isObservableObject=$i,e.isObservableProp=Kr,e.isObservableSet=Gi,e.keys=qr,e.makeAutoObservable=wi,e.makeObservable=Si,e.observable=M,e.observe=ni,e.onBecomeObserved=gr,e.onBecomeUnobserved=_r,e.onReactionError=Ln,e.override=Ue,e.ownKeys=ti,e.reaction=fr,e.remove=Zr,e.runInAction=sr,e.set=Xr,e.spy=Jn,e.toJS=oi,e.trace=si,e.transaction=li,e.untracked=fn,e.values=Jr,e.when=ui})),wv=me(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Sv():t.exports=Cv()}))();function Tv(e){if(Array.isArray(e))return Object.freeze(e.map(Tv));if(typeof e==`object`&&e){let t=Object.create(null),n=Object.entries(e).sort(([e],[t])=>e<t?-1:+(e>t));for(let[e,r]of n)t[e]=Tv(r);return Object.freeze(t)}return e}function Ev(e){let t=typeof e;if(t===`string`||t===`number`||t===`boolean`)return t;throw TypeError(`Variable values must be string|number|boolean (got ${t})`)}function Dv(e){return typeof e==`string`?e:String(e)}function Ov(e){if(typeof e==`number`)return e;if(typeof e==`boolean`)return+!!e;let t=e.trim();if(t===``)throw TypeError(`Cannot cast empty string to number`);let n=Number(t);if(!Number.isFinite(n))throw TypeError(`Cannot cast ${JSON.stringify(e)} to number`);return n}function kv(e){if(typeof e==`boolean`)return e;if(typeof e==`number`){if(e===0||e===1)return e===1;throw TypeError(`Cannot cast number ${e} to bool (only 0 and 1 are accepted)`)}if(e===`true`)return!0;if(e===`false`)return!1;throw TypeError(`Cannot cast ${JSON.stringify(e)} to bool (expected "true" or "false")`)}function Av(e,t){if(!(e instanceof U))throw TypeError(`template function expected a RichText fragment, got ${typeof e==`object`?Object.prototype.toString.call(e):typeof e}`);let n=e.copy();return n.style=jv(e.style).add(t),n}function jv(e){if(e instanceof V)return e;try{return V.parse(e)}catch(t){throw t instanceof Vr?TypeError(`template function cannot style a fragment whose base style "${e}" is not a style definition: a style name resolves only against the theme of a render`,{cause:t}):t}}function Mv(e){return{fn:(t=>Av(t,e)),argTypes:[`liftable`],arity:{kind:`exact`},returnType:`T`}}function Nv(e){return{fn:((t,n)=>Av(n,new V({[e]:_n.parse(t)}))),argTypes:[`string`,`liftable`],arity:{kind:`exact`},returnType:`T`}}function Pv(e,t){return new V({[e]:t})}function Fv(){let e={};for(let t of Rr)e[t]=Mv(Pv(t,!0)),e[`not_${t}`]=Mv(Pv(t,!1));for(let[t,n]of Object.entries(Br))e[t]=Mv(Pv(n,!0));return e}const Iv={fn:((e,t)=>Av(t,V.parse(e))),argTypes:[`string`,`liftable`],arity:{kind:`exact`},returnType:`T`},Lv={fn:((e,t)=>Av(t,new V({link:e}))),argTypes:[`string`,`liftable`],arity:{kind:`exact`},returnType:`T`};function Rv(){return{fg:Nv(`color`),bg:Nv(`bgcolor`),...Fv(),link:Lv,style:Iv}}function zv(e,t){if(!Xn.test(e.trim()))throw TypeError(`${t} expected a color (#RRGGBB or #RRGGBBAA), got ${JSON.stringify(e)} — to use a palette name here, wrap it: ${t} (color ${JSON.stringify(e)}) …`);return Zn(e)}function Bv(e,t){return{fn:t,argTypes:e,arity:{kind:`exact`},returnType:`string`}}function Vv(e,t,n,r){let i=r===void 0||e>=r.min&&e<=r.max;if(!Number.isFinite(e)||!i){let i=r===void 0?`a finite number`:`within ${r.min}..${r.max} (${r.note})`;throw RangeError(`${t}'s ${n} must be ${i}, got ${e}`)}return e}const Hv=Bv([`string`,`int`],((e,t)=>ir(zv(e,`darken`),t).hex)),Uv=Bv([`string`,`int`],((e,t)=>ir(zv(e,`lighten`),-t).hex)),Wv={min:0,max:100,note:`0 = from, 100 = toward`},Gv=Bv([`string`,`string`,`float`],((e,t,n)=>Tn(zv(e,`mix`),zv(t,`mix`),Vv(n,`mix`,`percentage`,Wv)/100).hex)),Kv={min:1,max:21,note:`4.5 = AA body text, 3 = AA large text`},qv=Bv([`string`],(e=>ar(zv(e,`contrastOn`)).hex)),Jv=e=>Bv([`string`,`string`,`float`],((t,n,r)=>or(zv(t,`readableOn`),zv(n,`readableOn`),Vv(r,`readableOn`,`ratio`,Kv),e()).hex)),Yv={hueShift:`shiftHue`,chromaScale:`scaleChroma`,lightnessScale:`scaleLightness`,lightnessShift:`shiftLightness`};function Xv(){let e={};for(let[t,n]of Object.entries(Yv)){let r=t;e[n]=Bv([`string`,`float`],((e,t)=>{let i={...Rn,[r]:Vv(t,n,`amount`)};return Jn.fromRgba(zv(e,n)).applyKey(i).toRgba().hex}))}return e}function Zv(e=()=>I.TRUECOLOR){return{darken:Hv,lighten:Uv,mix:Gv,contrastOn:qv,readableOn:Jv(e),...Xv()}}function Qv(e,t){if(e.length%2!=0)throw RangeError(`ramp's last stop (position ${String(e[e.length-1])}) has no color — stops are <position> <color> pairs`);let n=[];for(let r=0;r<e.length;r+=2)n.push({at:e[r],color:Qn(t,e[r+1])});return n}function $v(e){return{color:{fn:(t=>Qn(e(),t).hex),argTypes:[`string`],arity:{kind:`exact`},returnType:`string`},ramp:{fn:((t,n,...r)=>new Ir(Fr(n),Qv(r,e())).at(t).hex),argTypes:[`float`,`string`],arity:{kind:`alternating`,minimum:4},returnType:`string`}}}function ey(e){return{...Rv(),...Zv(e)}}new V({color:`red`,dim:!0});const ty=/^(?:(?:global|apac|au|eu|us|us-east-\d|us-west-\d|eu-west-\d|eu-central-\d)\.)?(?:anthropic\.|azure_ai\/|bedrock\/|vertex_ai\/)?claude-(?:(?<family>opus|sonnet|haiku)-(?<newMajor>\d+)(?:-(?<newMinor>\d))?|(?<oldMajor>\d+)(?:-(?<oldMinor>\d))?-(?<oldFamily>opus|sonnet|haiku))(?:[-@]\d{8})?(?:-v\d+:\d+)?(?:-latest)?$/i,ny=/^(?<family>opus|sonnet|haiku)\s+(?<major>\d+)(?:\.(?<minor>\d))?$/i;function ry(e){if(!e)return`Claude`;let t=e.trim().replace(/\s*\([^)]*\)\s*$/,``).replace(/\s*\[[^\]]*\]\s*$/,``).trim(),n=t.match(ty);if(n?.groups){let{family:e,newMajor:t,newMinor:r,oldMajor:i,oldMinor:a,oldFamily:o}=n.groups,s=e||o,c=t||i,l=r||a;if(s&&c)return`${s.charAt(0).toUpperCase()+s.slice(1).toLowerCase()} ${l?`${c}.${l}`:c}`}let r=t.match(ny);if(r?.groups){let e=r.groups.family,t=r.groups.major,n=r.groups.minor;return`${e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()} ${n?`${t}.${n}`:t}`}return t||e}function iy(e){let t=e.match(ny);if(!t?.groups)return e;let n=t.groups.family,r=t.groups.major,i=t.groups.minor;return`${n.charAt(0).toUpperCase()}${i?`${r}.${i}`:r}`}function ay(e){let t=e.split(`/`),n=t.length-1;return t.map((e,t)=>{if(t===n)return e;let r=e.match(/^\.*./);return r?r[0]:e}).join(`/`)}function oy(e){return e.toLocaleString()}function sy(e){if(e.length===0)throw Error(`a cascade needs at least one stop, e.g. "0:calm"`);let t=[];for(let[n,r]of e.entries()){let e=r.indexOf(`:`),i=e<0?NaN:Number(r.slice(0,e));if(!Number.isFinite(i))throw Error(`cascade stop ${n} ("${r}") must be "<position>:<result>", e.g. "80:hot" — the position must be a number`);let a=t[n-1];if(a!==void 0&&i<a.at)throw Error(`cascade stops must be in ascending position order; stop ${n} at ${i} follows stop ${n-1} at ${a.at}`);t.push({at:i,text:r.slice(e+1)})}return t}function cy(e,t){if(!Number.isFinite(e))throw Error(`a cascade needs a finite value, got ${e}`);let n=-1;for(;n+1<t.length&&t[n+1].at<=e;)n++;return(n<0?t[0]:t[n]).text}const ly=[`▁`,`▂`,`▃`,`▄`,`▅`,`▆`,`▇`,`█`],uy=ly.length;function dy(e,t){let n=t===void 0?e:t<=0?[]:e.slice(-t);if(n.length===0)return``;let r=n[0],i=n[0];for(let e of n)e<r&&(r=e),e>i&&(i=e);let a=i-r,o=``;for(let e of n){let t=a===0?0:Math.round((e-r)/a*(uy-1));o+=ly[t]}return o}function fy(e){let t=[];for(let n of e.split(`,`)){let e=n.trim();if(e===``)continue;let r=Number(e);if(!Number.isFinite(r))throw TypeError(`sparkline: non-numeric series element ${JSON.stringify(n)}`);t.push(r)}return t}function py(e,t,n){if(n.length!==0)throw Error(`${e}: takes at most ${t.length} optional argument${t.length===1?``:`s`} (${t.join(`, `)}), got ${t.length+n.length}`)}const my=Ya(),hy=[...co];function gy(){return{basename:{fn:e=>l(e),argTypes:[`string`],arity:{kind:`exact`}},dirname:{fn:e=>u(e),argTypes:[`string`],arity:{kind:`exact`}},abbreviatePath:{fn:e=>ay(e),argTypes:[`string`],arity:{kind:`exact`}},int:{fn:e=>Math.trunc(Ov(e)),argTypes:[`value`],arity:{kind:`exact`}},string:{fn:e=>Dv(e),argTypes:[`value`],arity:{kind:`exact`}},bool:{fn:e=>kv(e),argTypes:[`value`],arity:{kind:`exact`}},urlEncode:{fn:e=>encodeURIComponent(e),argTypes:[`string`],arity:{kind:`exact`}},themes:{fn:()=>my,argTypes:[],arity:{kind:`exact`}},endcaps:{fn:()=>hy,argTypes:[],arity:{kind:`exact`}},sparkline:{fn:(e,t,...n)=>(py(`sparkline`,[`width`],n),dy(fy(e),t)),argTypes:[`string`,`int`],arity:{kind:`variadic`}},cascade:{fn:(e,...t)=>cy(e,sy(t)),argTypes:[`float`,`string`],arity:{kind:`variadic`}}}}function _y(e=()=>new Date){return{minutesUntilReset:{fn:t=>Math.round(Math.max(0,t*1e3-e().getTime())/6e4),argTypes:[`int`],arity:{kind:`exact`}},formatInteger:{fn:e=>oy(e),argTypes:[`int`],arity:{kind:`exact`}},round:{fn:e=>Math.round(e),argTypes:[`float`],arity:{kind:`exact`}},formatModelName:{fn:e=>ry(e),argTypes:[`string`],arity:{kind:`exact`}},shortenModelName:{fn:e=>iy(e),argTypes:[`string`],arity:{kind:`exact`}}}}function vy(e,t=()=>new Date,n){return dp({fromString:e=>new U(e),toString:e=>e.plain,isT:e=>e instanceof U,clock:t,missingKey:`error`,funcs:{...eh(),...f_(),...Bh(),...cg(),...Km(t),...Ip(),...mh(),...ey(n),...gy(),..._y(t),...e??{}}})}function yy(e){return by(e,new Set(e.names()),``)}function by(e,t,n){return new Proxy(Object.create(null),{has(e,r){if(typeof r!=`string`)return!1;let i=n?`${n}.${r}`:r;if(t.has(i))return!0;let a=`${i}.`;for(let e of t)if(e.startsWith(a))return!0;return!1},get(r,i){if(typeof i!=`string`)return;let a=n?`${n}.${i}`:i;if(t.has(a))return e.getKind(a)===`document`?Sy(a,e.readDocument(a)):e.read(a);let o=`${a}.`;for(let n of t)if(n.startsWith(o))return by(e,t,a)}})}function xy(e,t){return new Proxy(e,{has:(e,t)=>t===`settings`||Reflect.has(e,t),get:(e,n)=>n===`settings`?t:Reflect.get(e,n)})}function Sy(e,t){switch(t.kind){case`ok`:return t.value;case`absent`:throw Error(`variable "${e}" has no value yet: its source has not completed a scan`);case`failed`:throw Error(`variable "${e}": ${t.reason}`)}}function J(e){return{kind:`ok`,value:e}}const Y={kind:`absent`};function X(e){return{kind:`failed`,reason:e}}function Cy(e,t){return e?.kind===`ok`?e.value:t}function wy(e,t,n){return t.ok?J(t.stdout):t.reason===`non-zero`&&n===`absent`||t.reason===`non-zero`&&n===t.exitCode?Y:X(`${e}: ${[t.reason,t.exitCode==null?null:`exit ${t.exitCode}`,t.error??Ty(t.stderr)].filter(Boolean).join(`, `)}`)}function Ty(e){return e.trim().split(`
87
+ `,1)[0]??``}function Ey(e,t){if(e.kind!==`ok`)return e;let n=t(e.value);return n===null?Y:J(n)}function Dy(e){if(e.kind!==`ok`)return e;let t=e.value.trim();return t?J(t):Y}const Oy=/^[A-Za-z]:[\\/]/;function ky(e){let t=e.trim();if(Oy.test(t))return null;let n=t.match(/^(?:[^@/]+@)?(\[[^\]]+\]):(.*)$/)??t.match(/^(?:[^@/:]+@)?([^/:]+):(?!\/\/)(.*)$/),r=n?`ssh://${n[1]}/${n[2].replace(/^\/+/,``)}`:t,i;try{i=new URL(r)}catch{return null}return{scheme:i.protocol.replace(/:$/,``),host:i.hostname.toLowerCase(),port:i.port,path:i.pathname.replace(/^\/+/,``).replace(/\/+$/,``)}}function Ay(e){return ky(e)?.host||null}function jy(e){let t=Ay(e);return t?t===`github.com`||t.endsWith(`.github.com`)?`github`:/(^|\.)gitlab\./.test(t)?`gitlab`:null:null}function My(e){let t=new Map;for(let n of e.split(`
88
+ `)){let e=n.match(/^remote\.(.+)\.url\s+(\S.*)$/);if(!e)continue;let r=t.get(e[1])??[];r.push(e[2].trim()),t.set(e[1],r)}return[...t].map(([e,t])=>({name:e,urls:t}))}function Ny(e){return e.urls.find(e=>Ry(e)!==null)??e.urls[0]??null}function Py(e){return e.find(e=>e.name===`origin`)??e[0]??null}function Fy(e){let t=Py(e);return t?Ny(t):null}function Iy(e){let t=Py(e);return t?t.urls.find(e=>jy(e)!==null)??Ny(t):null}function Ly(e){let t=(ky(e)?.path??e.replace(/[\\/]+$/,``)).split(`/`);return(t[t.length-1]??``).replace(/\.git$/,``)||null}function Ry(e){let t=ky(e);if(!t)return null;let n=t.scheme===`https`?{scheme:`https`,port:t.port}:t.scheme===`http`?{scheme:`http`,port:t.port}:t.scheme===`ssh`||t.scheme===`git`?{scheme:`https`,port:``}:null;if(!n||!t.host)return null;let r=t.path.replace(/\.git$/,``);if(!r)return null;let i=n.port?`${t.host}:${n.port}`:t.host;return`${n.scheme}://${i}/${r}`}function zy(e){let t=Fy(e);return t===null?null:Ry(t)}function By(e,t,n,r){return t.ok?r(t.stdout):t.reason===`spawn-error`&&/ENOENT/i.test(t.error??``)||t.reason===`non-zero`&&n.test(t.stderr)?Y:X(`${e}: ${[t.reason,t.exitCode==null?null:`exit ${t.exitCode}`,t.error??Ty(t.stderr)].filter(Boolean).join(`, `)}`)}function Vy(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Hy(e){let t=`detached`,n=Y,r=Y,i=Y,a=0,o=0,s=0,c=0;for(let l of e.split(`
89
+ `)){if(!l)continue;if(l.startsWith(`# `)){let e=l.slice(2);if(e.startsWith(`branch.oid `)){let t=e.slice(11).trim();n=t===`(initial)`?Y:J(t)}else if(e.startsWith(`branch.head `)){let n=e.slice(12).trim();t=n===`(detached)`?`detached`:n}else if(e.startsWith(`branch.upstream `))r=J(e.slice(16).trim());else if(e.startsWith(`branch.ab `)){let t=e.slice(10).trim().match(/^\+(\d+)\s+-(\d+)$/);t&&(i=J({ahead:parseInt(t[1],10),behind:parseInt(t[2],10)}))}continue}let e=l[0];if(e===`1`||e===`2`){let e=l.slice(2,4);e[0]!==`.`&&a++,e[1]!==`.`&&o++}else e===`u`?c++:e===`?`&&s++}let l=`clean`;return c>0?l=`conflicts`:(a||o||s)&&(l=`dirty`),{branch:t,status:l,aheadBehind:i,oid:n,upstream:r,workingTree:{staged:a,unstaged:o,untracked:s,conflicts:c}}}function Uy(e){let t;try{t=JSON.parse(e)}catch(e){return X(`gh pr view: unparseable JSON (${e instanceof Error?e.message:String(e)})`)}if(!Vy(t))return X(`gh pr view: JSON is not an object`);let{number:n,state:r,url:i}=t;return typeof n!=`number`||typeof r!=`string`||typeof i!=`string`?X(`gh pr view: missing number/state/url`):r.toUpperCase()===`OPEN`?J({number:n,state:r,url:i}):Y}function Wy(e){let t;try{t=JSON.parse(e)}catch(e){return X(`glab mr view: unparseable JSON (${e instanceof Error?e.message:String(e)})`)}if(!Vy(t))return X(`glab mr view: JSON is not an object`);let n=t.iid,r=t.state,i=t.web_url;return typeof n!=`number`||typeof r!=`string`||typeof i!=`string`?X(`glab mr view: missing iid/state/web_url`):r.toLowerCase()===`opened`?J({number:n,state:r,url:i}):Y}function Gy(e){try{let t=r.statSync(e);return{key:`${t.dev}:${t.ino}`,stamp:`${t.mtimeMs}:${t.size}`}}catch{return null}}var Ky=class{isGitRepo(e){try{return r.existsSync(c.join(e,`.git`))}catch{return!1}}async execGitAsync(e,t){return De({bin:`git`,args:[...e],cwd:t.cwd,env:{...process.env,GIT_OPTIONAL_LOCKS:`0`},timeoutMs:t.timeout,category:`git`})}async resolveEffectiveGitDir(e,t){return this.isWorktree(e)?J(e):t&&this.isGitRepo(t)?J(t):this.isGitRepo(e)?J(e):this.findGitRoot(e)}async findGitRoot(e){let t=c.resolve(e);for(;;){if(this.isGitRepo(t))return J(t);let e=c.dirname(t);if(e===t)return Y;t=e}}async getGitInfo(e,t={},n){try{return await this.computeGitInfo(e,t,n)}catch(e){return X(`git: ${e instanceof Error?e.message:String(e)}`)}}async computeGitInfo(e,t={},n){let r,i=this.isWorktree(e);if(i)r=e;else if(n&&this.isGitRepo(n))r=n;else if(this.isGitRepo(e))r=e;else{let t=await this.findGitRoot(e);if(t.kind!==`ok`)return t;r=t.value}let a=await this.getCoreAsync(r);if(a.kind!==`ok`)return a;let o={branch:a.value.branch,status:a.value.status,aheadBehind:a.value.aheadBehind};t.showWorkingTree&&(o.workingTree=a.value.workingTree),t.showSha&&(o.sha=Ey(a.value.oid,e=>e.slice(0,7))),t.showUpstream&&(o.upstream=a.value.upstream),t.showTag&&(o.tag=await this.getNearestTagAsync(r)),t.showTimeSinceCommit&&(o.timeSinceCommit=await this.timeSinceCommit(r,a.value.oid)),t.showStashCount&&(o.stashCount=this.getStashCount(r));let s=t.showRepoName||t.showRepoUrl?await this.getRemotesAsync(r):void 0;return s!==void 0&&t.showRepoName&&(o.repoName=Ey(s,e=>this.repoNameFrom(e,r)),o.isWorktree=i),s!==void 0&&t.showRepoUrl&&(o.repoUrl=Ey(s,zy)),t.showOperation&&(o.operation=this.getOngoingOperation(r)),J(o)}resolveGitDir(e){let t=c.join(e,`.git`);try{if(r.existsSync(t)&&r.statSync(t).isFile()){let n=r.readFileSync(t,`utf-8`).match(/^gitdir:\s*(.+)$/m);if(n?.[1])return c.resolve(e,n[1].trim())}}catch{}return t}getOngoingOperation(e){try{let t=this.resolveGitDir(e);return r.existsSync(c.join(t,`MERGE_HEAD`))?J(`MERGE`):r.existsSync(c.join(t,`CHERRY_PICK_HEAD`))?J(`CHERRY-PICK`):r.existsSync(c.join(t,`REVERT_HEAD`))?J(`REVERT`):r.existsSync(c.join(t,`BISECT_LOG`))?J(`BISECT`):r.existsSync(c.join(t,`rebase-merge`))||r.existsSync(c.join(t,`rebase-apply`))?J(`REBASE`):Y}catch(e){return X(`git operation probe: ${e instanceof Error?e.message:String(e)}`)}}async getNearestTagAsync(e){return Dy(wy(`git describe --tags`,await this.execGitAsync([`describe`,`--tags`,`--abbrev=0`],{cwd:e,timeout:2e3}),`absent`))}async timeSinceCommit(e,t){return t.kind===`ok`?Ey(await this.commitTimestampMs(e,t.value),e=>Math.floor((Date.now()-e)/1e3)):t}commitTimes=new Map;async commitTimestampMs(e,t){let n=this.commitTimes.get(t);if(n!==void 0)return this.commitTimes.delete(t),this.commitTimes.set(t,n),n;let r=this.readCommitTimestampMs(e,t);for(this.commitTimes.set(t,r),r.then(e=>{e.kind!==`ok`&&this.commitTimes.get(t)===r&&this.commitTimes.delete(t)},()=>{this.commitTimes.get(t)===r&&this.commitTimes.delete(t)});this.commitTimes.size>256;){let e=this.commitTimes.keys().next().value;if(e===void 0)break;this.commitTimes.delete(e)}return r}async readCommitTimestampMs(e,t){let n=Dy(wy(`git log -1`,await this.execGitAsync([`log`,`-1`,`--format=%ct`,t,`--`],{cwd:e,timeout:2e3}),`absent`));if(n.kind!==`ok`)return n;let r=parseInt(n.value,10)*1e3;return Number.isNaN(r)?X(`git log -1: unparseable timestamp "${n.value}"`):J(r)}resolveCommonGitDir(e){let t=this.resolveGitDir(e);try{let e=r.readFileSync(c.join(t,`commondir`),`utf-8`).trim();if(e)return c.resolve(t,e)}catch{}return t}getStashCount(e){let t=c.join(this.resolveCommonGitDir(e),`logs`,`refs`,`stash`),n;try{n=r.readFileSync(t,`utf-8`)}catch(e){return e.code===`ENOENT`?J(0):X(`git stash reflog ${t}: ${e instanceof Error?e.message:String(e)}`)}let i=n.trim();return J(i?i.split(`
90
+ `).length:0)}async getRemotesAsync(e){let t=Gy(c.join(this.resolveCommonGitDir(e),`config`));if(t===null)return this.readRemotes(e);let{key:n,stamp:r}=t,i=this.remotesByConfig.get(n);if(i!==void 0&&i.stamp===r)return this.remotesByConfig.delete(n),this.remotesByConfig.set(n,i),i.remotes;let a=this.readRemotes(e);for(this.remotesByConfig.set(n,{stamp:r,remotes:a}),a.then(e=>{let t=this.remotesByConfig.get(n);e.kind!==`ok`&&t?.remotes===a&&this.remotesByConfig.delete(n)},()=>{this.remotesByConfig.get(n)?.remotes===a&&this.remotesByConfig.delete(n)});this.remotesByConfig.size>256;){let e=this.remotesByConfig.keys().next().value;if(e===void 0)break;this.remotesByConfig.delete(e)}return a}remotesByConfig=new Map;async readRemotes(e){let t=wy(`git config --get-regexp remote url`,await this.execGitAsync([`config`,`--local`,`--get-regexp`,`^remote\\..*\\.url$`],{cwd:e,timeout:2e3}),1);return t.kind===`failed`?t:J(t.kind===`ok`?My(t.value):[])}repoNameFrom(e,t){let n=Fy(e);return(n===null?null:Ly(n))??c.basename(t)}async getRepoRemoteUrl(e){let t=await this.getRemotesAsync(e);if(t.kind!==`ok`)return t;let n=Iy(t.value);return n===null?Y:J(n)}async execForgeAsync(e,t,n){return De({bin:e,args:[...t],cwd:n.cwd,env:{...process.env},timeoutMs:n.timeout,category:`forge`})}async resolvePullRequest(e,t){let n=jy(t);return n===`github`?By(`gh pr view`,await this.execForgeAsync(`gh`,[`pr`,`view`,`--json`,`number,state,url`],{cwd:e,timeout:5e3}),/no (open )?pull requests? found/i,Uy):n===`gitlab`?By(`glab mr view`,await this.execForgeAsync(`glab`,[`mr`,`view`,`--output`,`json`],{cwd:e,timeout:5e3}),/no (open )?merge requests? (found|available)/i,Wy):Y}isWorktree(e){try{let t=c.join(e,`.git`);return!!(r.existsSync(t)&&r.statSync(t).isFile())}catch{return!1}}async getCoreAsync(e){k(`[GIT-EXEC] Running git status --porcelain=v2 in ${e}`);let t=wy(`git status --porcelain=v2 --branch`,await this.execGitAsync([`status`,`--porcelain=v2`,`--branch`],{cwd:e,timeout:2e3}),`failed`);return t.kind===`ok`?J(Hy(t.value)):t}};const qy=(e,t)=>k(t);var Jy=class{slots=new Map;maxWatchers;counters;logger;closed=!1;constructor(e={}){this.maxWatchers=e.maxWatchers??128,this.counters=e.counters,this.logger=e.logger??qy}acquire(e,t,n){if(this.closed)return{release:()=>{}};let r=this.slots.get(e);if(r)return r.refcount++,r.onInvalidate=n,r.lastTouched=Date.now(),this.slots.delete(e),this.slots.set(e,r),this.makeHandle(e);let i={key:e,watchers:[],refcount:1,debounceTimer:null,onInvalidate:n,targets:t,lastTouched:Date.now()};return this.openWatchers(i),this.slots.set(e,i),this.counters&&this.counters.watchersOpened++,this.evictIfNeeded(),this.makeHandle(e)}makeHandle(e){let t=!1;return{release:()=>{if(t)return;t=!0;let n=this.slots.get(e);n&&(n.refcount=Math.max(0,n.refcount-1),n.refcount===0&&(this.closeSlot(n),this.slots.delete(e)))}}}openWatchers(e){let t=()=>{e.debounceTimer||(e.debounceTimer=setTimeout(()=>{e.debounceTimer=null;try{e.onInvalidate()}catch(e){this.logger(`warn`,`watcher invalidate threw: ${e.message}`)}},50),e.debounceTimer.unref())};for(let n of e.targets.files)try{let i=r.watch(n,{persistent:!1},t);i.on(`error`,e=>{this.logger(`warn`,`watcher error ${n}: ${e.message}`)}),e.watchers.push(i)}catch(e){this.logger(`warn`,`watch failed ${n}: ${e.message}`)}for(let n of e.targets.dirs)try{let i=n.filenames?new Set(n.filenames):null,a=r.watch(n.path,{persistent:!1},(e,n)=>{i&&(!n||!i.has(n))||t()});a.on(`error`,e=>{this.logger(`warn`,`watcher error ${n.path}: ${e.message}`)}),e.watchers.push(a)}catch(e){this.logger(`warn`,`watch failed ${n.path}: ${e.message}`)}}closeSlot(e){e.debounceTimer&&=(clearTimeout(e.debounceTimer),null);for(let t of e.watchers)try{t.close()}catch{}e.watchers=[],this.counters&&this.counters.watchersClosed++}evictIfNeeded(){for(;this.slots.size>this.maxWatchers;){let e=this.slots.keys().next().value;if(e===void 0)break;let t=this.slots.get(e);this.closeSlot(t),this.slots.delete(e),this.counters&&this.counters.watchersEvicted++;try{t.onInvalidate()}catch{}this.logger(`info`,`watcher LRU evict ${e}`)}}size(){return this.slots.size}closeAll(){this.closed=!0;for(let e of this.slots.values())this.closeSlot(e);this.slots.clear()}},Yy=class{running=new Set;again=new Set;run(e,t){return this.again.add(e),this.running.has(e)?{kind:`queued`}:(this.running.add(e),{kind:`started`,done:this.loop(e,t)})}async loop(e,t){try{do this.again.delete(e),await t();while(this.again.has(e))}finally{this.running.delete(e),this.again.delete(e)}}clear(){this.running.clear(),this.again.clear()}get size(){return this.running.size}};const Xy=(e,t)=>k(t),Zy={showSha:!0,showStashCount:!0};function Qy(e){let t=Object.keys(e).sort(),n={};for(let r of t)n[r]=e[r];return JSON.stringify(n)}function $y(e){let t=t=>{try{return r.statSync(c.join(e,t)).mtimeMs}catch{return 0}};return{head:t(`HEAD`),index:t(`index`)}}function eb(e,t){return e.head!==t.head||e.index!==t.index}function tb(e){let t=[],n=c.join(e,`refs/heads`);try{r.statSync(n).isDirectory()&&t.push({path:n})}catch{}return{files:[c.join(e,`HEAD`),c.join(e,`index`)],dirs:t}}var nb=class extends Ky{entries=new Map;subscribersByRepo=new Map;fetchInFlight=new Map;resolutions=new Map;prCache=new Map;prFetchInFlight=new Map;refreshes=new Yy;hits=0;misses=0;invalidations=0;inner;ttlMs;maxEntries;watchers;ownsWatchers;logger;sanityTimer=null;constructor(e={}){super(),this.inner=e.inner??new Ky,this.ttlMs=e.ttlMs??3e4,this.maxEntries=e.maxEntries??64,this.logger=e.logger??Xy,e.watchers?(this.watchers=e.watchers,this.ownsWatchers=!1):(this.watchers=new Jy({logger:this.logger}),this.ownsWatchers=!0);let t=e.sanityIntervalMs??3e5;t>0&&(this.sanityTimer=setInterval(()=>this.runSanityCheck(),t),this.sanityTimer.unref())}getWatcherRegistry(){return this.watchers}getStats(){return{size:this.entries.size,hits:this.hits,misses:this.misses,invalidations:this.invalidations,watchers:this.watchers.size()}}resolveEffectiveGitDir(e,t){let n=`${e}|${t??``}`,r=Date.now(),i=this.resolutions.get(n);if(i&&r-i.computedAt<this.ttlMs)return this.resolutions.delete(n),this.resolutions.set(n,i),i.dir;let a=this.inner.resolveEffectiveGitDir(e,t);return this.resolutions.set(n,{dir:a,computedAt:r}),a.catch(()=>{this.resolutions.get(n)?.dir===a&&this.resolutions.delete(n)}),this.evictResolutionsIfNeeded(),a}evictResolutionsIfNeeded(){for(;this.resolutions.size>this.maxEntries;){let e=this.resolutions.keys().next().value;if(e===void 0)break;this.resolutions.delete(e)}}async getGitInfo(e,t={},n){let r=await this.resolveEffectiveGitDir(e,n);return r.kind===`ok`?this.getGitInfoForRoot(r.value,t):r}getGitInfoForRoot(e,t){let n=`${e}|${Qy(t)}`,r=Date.now(),i=this.entries.get(n);if(i&&r-i.computedAt<this.ttlMs)return this.entries.delete(n),this.entries.set(n,i),this.hits++,Promise.resolve(J(i.info));let a=this.fetchInFlight.get(n);if(a)return a;let o=this.doFetch(e,n,t,r).finally(()=>{this.fetchInFlight.delete(n)});return this.fetchInFlight.set(n,o),o}async doFetch(e,t,n,r){this.misses++;let i=this.inner.resolveGitDir(e),a=$y(i),o=await this.inner.getGitInfo(e,n);if(o.kind!==`ok`)return o;let s=o.value;n.showPullRequest&&(s.pullRequest=await this.getPullRequestCached(e,s.branch)),this.dropEntry(t);let c=this.watchers.acquire(`git:${e}`,tb(i),()=>this.invalidateRepo(e));return this.entries.set(t,{info:s,computedAt:r,mtime:a,watcher:c,repoRoot:e}),this.evictIfNeeded(),o}async getPullRequestCached(e,t){let n=await this.inner.getRepoRemoteUrl(e);if(n.kind===`failed`)return n;if(n.kind===`absent`)return Y;let r=n.value,i=`${e}|${t}|${r}`,a=Date.now(),o=this.prCache.get(i);if(o){let e=o.pr.kind===`failed`?45e3:3e5;if(a-o.computedAt<e)return this.prCache.delete(i),this.prCache.set(i,o),o.pr}let s=this.prFetchInFlight.get(i);if(s)return s;let c=this.inner.resolvePullRequest(e,r).then(e=>(this.prCache.set(i,{pr:e,computedAt:Date.now()}),this.evictPrIfNeeded(),e)).finally(()=>{this.prFetchInFlight.delete(i)});return this.prFetchInFlight.set(i,c),c}evictPrIfNeeded(){for(;this.prCache.size>this.maxEntries;){let e=this.prCache.keys().next().value;if(e===void 0)break;this.prCache.delete(e)}}deliverable(e,t){return e.kind===`failed`?(this.logger(`warn`,`git fetch failed (${t}): ${e.reason}`),null):e.kind===`ok`?e.value:null}subscribe(e,t){let n=!1,r=null;return{firstDelivery:(async()=>{let i=await this.resolveEffectiveGitDir(e);if(n)return;if(i.kind!==`ok`){i.kind===`failed`&&this.logger(`warn`,`git resolve failed (subscribe ${e}): ${i.reason}`),this.safeInvoke(t,null);return}let a=i.value,o=this.subscribersByRepo.get(a);if(!o){let t=this.inner.resolveGitDir(a),n=this.watchers.acquire(`git:${a}`,tb(t),()=>this.invalidateRepo(a));o={workingDir:e,repoRoot:a,callbacks:new Set,watcher:n},this.subscribersByRepo.set(a,o)}o.callbacks.add(t),r={repoRoot:a,entry:o};let s=await this.getGitInfoForRoot(a,{...Zy});n||this.safeInvoke(t,this.deliverable(s,a))})(),unsubscribe:()=>{if(n=!0,!r)return;let{repoRoot:e,entry:i}=r;i.callbacks.delete(t),i.callbacks.size===0&&(i.watcher.release(),this.subscribersByRepo.delete(e))}}}invalidateRepo(e){let t=0;for(let[n,r]of this.entries)r.repoRoot===e&&(r.watcher.release(),this.entries.delete(n),t++);t>0&&(this.invalidations+=t,this.logger(`info`,`gitCache invalidate ${e} dropped=${t}`)),this.refreshSubscribers(e)}refreshSubscribers(e){let t=this.subscribersByRepo.get(e);!t||t.callbacks.size===0||this.refreshes.run(e,()=>this.refreshOnce(e))}async refreshOnce(e){let t=this.subscribersByRepo.get(e);if(!t||t.callbacks.size===0)return;let n=await this.getGitInfoForRoot(e,{...Zy}),r=this.deliverable(n,e),i=this.subscribersByRepo.get(e);if(!(!i||i.callbacks.size===0))for(let e of[...i.callbacks])i.callbacks.has(e)&&this.safeInvoke(e,r)}safeInvoke(e,t){try{e(t)}catch(e){this.logger(`warn`,`git subscriber threw: ${e.message??String(e)}`)}}dropEntry(e){let t=this.entries.get(e);t&&(t.watcher.release(),this.entries.delete(e))}evictIfNeeded(){for(;this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.dropEntry(e),this.logger(`info`,`gitCache evict ${e}`)}}runSanityCheck(){let e=new Map;for(let t of this.entries.values()){let n=e.get(t.repoRoot);n||(n=$y(this.inner.resolveGitDir(t.repoRoot)),e.set(t.repoRoot,n)),eb(t.mtime,n)&&this.invalidateRepo(t.repoRoot)}}runSanityCheckNow(){this.runSanityCheck()}close(){this.sanityTimer&&=(clearInterval(this.sanityTimer),null);for(let e of this.entries.values())e.watcher.release();this.entries.clear();for(let e of this.subscribersByRepo.values())e.callbacks.clear(),e.watcher.release();this.subscribersByRepo.clear(),this.refreshes.clear(),this.fetchInFlight.clear(),this.prCache.clear(),this.prFetchInFlight.clear(),this.resolutions.clear(),this.ownsWatchers&&this.watchers.closeAll()}};const rb=/\r\n|\r|\n/g,ib=e=>J(e.replace(rb,` `).trim());function ab(e){return t=>{let n=e.exec(t)?.[1];return n===void 0?X(`regex no-match`):J(n.replace(rb,` `))}}const ob=e=>{try{return J(JSON.parse(e))}catch(e){return X(`JSON parse failed: ${e.message}`)}};function sb(e,t){return t.kind!==`ttl`||t.durationMs>=500?t:(k(`declareShell "${e}": ttl ${t.durationMs}ms below floor 500ms; clamping`),{kind:`ttl`,durationMs:500})}function cb(e){let t=/^(\d+(?:\.\d+)?)(ms|s|m|h)$/.exec(e);if(!t)throw RangeError(`Invalid duration: "${e}"`);let n=parseFloat(t[1]);switch(t[2]){case`ms`:return n;case`s`:return n*1e3;case`m`:return n*6e4;case`h`:return n*36e5;default:throw RangeError(`Unexpected duration unit: "${t[2]}"`)}}const lb=`session.id`;function ub(e,t,n){return{where:`output of "${e}" in ${t}`,read:async()=>{let r=await De({bin:`/bin/sh`,args:[`-c`,e],cwd:t,category:`user-shell`,signal:n});if(!r.ok&&r.reason===`aborted`)throw n.reason;return r.ok?J(r.stdout):X(`shell "${e}" ${r.exitCode===null?[r.reason,r.error].filter(e=>e!==void 0).join(`: `):`exited with code ${r.exitCode}`} in ${t}`)}}}function db(e,t,n){return{where:`"${e}"`,read:async()=>{try{let r=await S(e,{encoding:`utf8`,signal:n});return J(t===`first-line`?r.split(/\r?\n/)[0]??``:r)}catch{if(n.aborted)throw n.reason;return X(`file unreadable: ${e}`)}}}}function fb(e,t,n){if(e.kind!==`ok`)return e;let r=t(e.value);return r.kind===`failed`?X(`${r.reason} in ${n}`):r}const pb=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],mb=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],hb=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],gb=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`];function _b(e,t){let n=[[`2006`,e=>String(e.getFullYear())],[`January`,e=>pb[e.getMonth()]],[`Monday`,e=>hb[e.getDay()]],[`Jan`,e=>mb[e.getMonth()]],[`Mon`,e=>gb[e.getDay()]],[`15`,e=>String(e.getHours()).padStart(2,`0`)],[`06`,e=>String(e.getFullYear()%100).padStart(2,`0`)],[`01`,e=>String(e.getMonth()+1).padStart(2,`0`)],[`02`,e=>String(e.getDate()).padStart(2,`0`)],[`04`,e=>String(e.getMinutes()).padStart(2,`0`)],[`05`,e=>String(e.getSeconds()).padStart(2,`0`)],[`PM`,e=>e.getHours()<12?`AM`:`PM`],[`pm`,e=>e.getHours()<12?`am`:`pm`],[`1`,e=>String(e.getMonth()+1)],[`2`,e=>String(e.getDate())],[`3`,e=>String(e.getHours()%12||12)],[`4`,e=>String(e.getMinutes())],[`5`,e=>String(e.getSeconds())]],r=``,i=0;for(;i<e.length;){let a=!1;for(let[o,s]of n)if(e.startsWith(o,i)){r+=s(t),i+=o.length,a=!0;break}a||(r+=e[i],i++)}return r}const vb={branch:`string`,sha:`string`,dirty:`boolean`,ahead:`number`,behind:`number`,stash:`number`};function yb(e,t,n,r){if(e===null){if(n!==void 0)return n;let e=vb[t];try{return Cb(r,e)}catch{return wb(e)}}switch(t){case`branch`:return e.branch===`detached`?``:e.branch;case`sha`:return Cy(e.sha,``);case`dirty`:return e.status!==`clean`;case`ahead`:return Cy(e.aheadBehind,{ahead:0,behind:0}).ahead;case`behind`:return Cy(e.aheadBehind,{ahead:0,behind:0}).behind;case`stash`:return Cy(e.stashCount,0)}}var bb=class{watchers=new Map;subscribe(e,t){let n=this.watchers.get(e);if(!n){let t=new Set,r;try{r=s(e,()=>{for(let e of t)e()})}catch{return()=>{}}n={watcher:r,callbacks:t},this.watchers.set(e,n)}return n.callbacks.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){let n=this.watchers.get(e);n&&(n.callbacks.delete(t),n.callbacks.size===0&&(n.watcher.close(),this.watchers.delete(e)))}dispose(){for(let{watcher:e}of this.watchers.values())e.close();this.watchers.clear()}size(){return this.watchers.size}},xb=class{buckets=new Map;subscribe(e,t){let n=this.buckets.get(e);if(!n){let t=new Set;n={timer:ee(()=>{for(let e of t)e()},e),callbacks:t},this.buckets.set(e,n)}return n.callbacks.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){let n=this.buckets.get(e);n&&(n.callbacks.delete(t),n.callbacks.size===0&&(T(n.timer),this.buckets.delete(e)))}dispose(){for(let{timer:e}of this.buckets.values())T(e);this.buckets.clear()}bucketCount(){return this.buckets.size}};function Sb(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n)return;n=n[e]}return n}function Cb(e,t){if(typeof e!=`string`&&typeof e!=`number`&&typeof e!=`boolean`)throw TypeError(`Expected string|number|boolean from payload, got ${typeof e}`);return t===`string`?Dv(e):t===`number`?Ov(e):kv(e)}function wb(e){return e===`number`?0:e===`boolean`?!1:``}var Tb=class{inputMetas=new Map;lastErrors=new Map;watchMgr=new bb;ttlMgr=new xb;gitSubscriptions=new Map;cleanups=[];inFlight=new Map;reads=new Yy;abort=new AbortController;drawn=wv.observable.box(I.TRUECOLOR);drawnAt=()=>this.drawn.get();engine=vy(void 0,void 0,this.drawnAt);gitProvider;ownsGitProvider;sessionState;constructor(e,t=``,n,r){this.store=e,this.defaultEmptyValue=t,n?(this.gitProvider=n,this.ownsGitProvider=!1):(this.gitProvider=new nb({sanityIntervalMs:0}),this.ownsGitProvider=!0),this.sessionState=r}get variableStore(){return this.store}declareLiteral(e,t){this.store.defineBox(e,Ev(t),t)}declareInput(e,t,n,r){let i=r===void 0?this.defaultFor(n):r;this.store.defineBox(e,n,i),this.inputMetas.set(e,{path:t,varDefault:r})}declareEnv(e,t,n){let r=process.env[t];if(r!==void 0){this.store.defineBox(e,`string`,r);return}let i=n===void 0?typeof this.defaultEmptyValue==`string`?this.defaultEmptyValue:``:n;this.store.defineBox(e,`string`,i),this.recordError(e,`env var "${t}" is not set`)}declareShell(e,t,n){this.declareSource(e,ub(t,n.cwd,this.abort.signal),sb(e,n.cache),n.parse)}declareFile(e,t,n){this.declareSource(e,db(t,n.readMode??`whole`,this.abort.signal),n.cache,n.parse)}declareSource(e,t,n,r){let i=this.publisherFor(e,r,t.where),a=()=>this.runSource(e,t,i);a(),this.registerCachePolicy(e,n,a)}publisherFor(e,t,n){switch(t.kind){case`text`:return this.scalarPublisher(e,ib,t.default,n);case`regex`:return this.scalarPublisher(e,ab(t.regex),t.default,n);case`json`:return this.documentPublisher(e,t.default,n)}}scalarPublisher(e,t,n,r){let i=this.stringInitial(n);return this.store.defineBox(e,`string`,i),n=>{let a=fb(n,t,r);this.noteOutcome(e,a),this.store.setBox(e,Cy(a,i))}}documentPublisher(e,t,n){let r=t===void 0?Y:J(t);return this.store.defineDocument(e,r),i=>{let a=fb(i,ob,n);this.noteOutcome(e,a),this.store.setDocument(e,a.kind===`ok`||t===void 0?a:r)}}runSource(e,t,n){let r=this.reads.run(e,()=>t.read().then(n,e=>{if(e!==this.abort.signal.reason)throw e}));r.kind===`started`&&this.track(e,r.done)}track(e,t){let n=t.finally(()=>{this.inFlight.get(e)===n&&this.inFlight.delete(e)});this.inFlight.set(e,n)}async settled(e){let t=Date.now()+e;for(;this.inFlight.size>0;){let e=t-Date.now();if(e<=0)break;let n,r=await Promise.race([Promise.all(this.inFlight.values()).then(()=>`settled`),new Promise(t=>{n=setTimeout(()=>t(`deadline`),e)})]);if(clearTimeout(n),r===`deadline`)break}return[...this.inFlight.keys()]}declareTemplate(e,t,n={}){let r=this.engine.parse(t);this.store.defineComputed(e,`string`,t=>{let i=yy(this.store);try{let t=r.evaluate(i).map(e=>e.plain).join(``);return this.lastErrors.delete(e),t}catch(t){let r=t instanceof Error?t.message:String(t);if(this.recordError(e,r),n.varDefault===void 0)throw Error(`variable "${e}": ${r}`);return n.varDefault}});try{this.store.read(e)}catch{}}declareTime(e,t){let n=t.ttlMs??1e3;this.store.defineBox(e,`string`,(e=>{try{return _b(t.format,e)}catch{return this.stringInitial(t.varDefault)}})(new Date));let r=this.ttlMgr.subscribe(n,()=>{try{this.store.setBox(e,_b(t.format,new Date)),this.lastErrors.delete(e)}catch(n){this.applyFallback(e,`string`,t.varDefault,n instanceof Error?n.message:String(n))}});this.cleanups.push(r)}declareGit(e,t){let n=vb[t.field],r=t.varDefault===void 0?wb(n):Cb(t.varDefault,n);this.store.defineBox(e,n,r);let i=this.gitSubscriptions.get(t.cwd);if(!i){let e=new Map,n=this.gitProvider.subscribe(t.cwd,t=>{this.store.runInAction(()=>{for(let[n,r]of e)for(let{name:e,varDefault:i}of r)this.store.setBox(e,yb(t,n,i,this.defaultEmptyValue))})});i={fieldSubs:e,firstDelivery:n.firstDelivery,unsubscribe:n.unsubscribe},this.gitSubscriptions.set(t.cwd,i)}let a=i.fieldSubs.get(t.field);a||(a=[],i.fieldSubs.set(t.field,a)),a.push({name:e,varDefault:t.varDefault}),this.track(e,i.firstDelivery)}declareState(e,t){if(!this.sessionState)throw Error(`declareState("${e}"): SourceRegistry was constructed without a SessionState — state-kind variables require a SessionState (the daemon provides one; tests must supply one)`);let n=this.sessionState,r=t.varDefault??this.stringInitial(void 0);this.store.defineComputed(e,`string`,e=>{let i=e(lb);if(typeof i!=`string`||!i)return r;let a=n.get(i,t.key);return a===null?r:a})}applyInput(e){this.store.runInAction(()=>{for(let[t,n]of this.inputMetas){let r=Sb(e,n.path),i=this.store.getType(t);if(r!==void 0)try{this.store.setBox(t,Cb(r,i)),this.lastErrors.delete(t)}catch(e){this.applyFallback(t,i,n.varDefault,e instanceof Error?e.message:String(e))}else this.applyFallback(t,i,n.varDefault,`input path "${n.path}" not found in payload`)}})}drawAt(e){this.store.runInAction(()=>this.drawn.set(e))}getLastError(e){return this.lastErrors.get(e)}dispose(){this.abort.abort();for(let e of this.cleanups)e();this.cleanups.length=0;for(let e of this.gitSubscriptions.values())e.unsubscribe();this.gitSubscriptions.clear(),this.reads.clear(),this.watchMgr.dispose(),this.ttlMgr.dispose(),this.ownsGitProvider&&this.gitProvider.close()}registerCachePolicy(e,t,n){switch(t.kind){case`never`:break;case`ttl`:{let e=this.ttlMgr.subscribe(t.durationMs,n);this.cleanups.push(e);break}case`watch_file`:{let e=this.watchMgr.subscribe(t.path,n);this.cleanups.push(e);break}case`key`:{let e=this.engine.parse(t.template),r=(0,wv.reaction)(()=>{let t=yy(this.store);try{return e.evaluate(t).map(e=>e.plain).join(``)}catch{return``}},n);this.cleanups.push(r);break}case`depends_on`:{let e=(0,wv.reaction)(()=>t.varNames.map(e=>this.store.changeKey(e)).join(`,`),n);this.cleanups.push(e);break}}}applyFallback(e,t,n,r){if(this.recordError(e,r),n!==void 0){this.store.setBox(e,n);return}try{this.store.setBox(e,Cb(this.defaultEmptyValue,t))}catch{this.store.setBox(e,wb(t))}}defaultFor(e){try{return Cb(this.defaultEmptyValue,e)}catch{return wb(e)}}stringInitial(e){return e===void 0?typeof this.defaultEmptyValue==`string`?this.defaultEmptyValue:``:e}recordError(e,t){this.lastErrors.set(e,{timestamp:Date.now(),message:t})}noteOutcome(e,t){t.kind===`ok`?this.lastErrors.delete(e):this.recordError(e,t.kind===`failed`?t.reason:`no value`)}};const Eb={project_dir:{kind:`input`,path:`workspace.project_dir`,default:``},[lb]:{kind:`input`,path:`session_id`,default:``},transcript_path:{kind:`input`,path:`transcript_path`,default:``},resume_command:{kind:`input`,path:`resumeCommand`,default:``},config_path:{kind:`input`,path:`configPath`,default:``},"theme.effective":{kind:`input`,path:`theme.effective`,default:``},"style.effective":{kind:`input`,path:`style.effective`,default:``},"preset.effective":{kind:`input`,path:`preset.effective`,default:``},"preset.customized":{kind:`input`,path:`preset.customized`,type:`boolean`,default:!1},"preset.bundled":{kind:`input`,path:`preset.bundled`,type:`boolean`,default:!0},"endcaps.effective":{kind:`input`,path:`endcaps.effective`,default:``},"variation.effective":{kind:`input`,path:`variation.effective`,default:``},"charset.effective":{kind:`input`,path:`charset.effective`,default:``},"colorCompatibility.effective":{kind:`input`,path:`colorCompatibility.effective`,default:``},"autoWrap.effective":{kind:`input`,path:`autoWrap.effective`,type:`boolean`,default:!0},"padding.effective":{kind:`input`,path:`padding.effective`,type:`number`,default:1},"updateNotice.effective":{kind:`input`,path:`updateNotice.effective`,type:`boolean`,default:!0},"term.cols":{kind:`input`,path:`term.cols`,type:`number`,default:80},"git.repoUrl":{kind:`input`,path:`git.repoUrl`,default:``}},Db={theme:{configKey:`palette`,sessionKey:`theme`,effectiveVar:`theme.effective`,label:`🎨`},preset:{configKey:`preset`,sessionKey:`preset`,effectiveVar:`preset.effective`,label:`▦`},style:{configKey:`style`,sessionKey:`style`,effectiveVar:`style.effective`,label:`◐`},endcaps:{configKey:`endcaps`,sessionKey:`endcaps`,effectiveVar:`endcaps.effective`,label:`✦`},variation:{configKey:`variation`,sessionKey:`variation`,effectiveVar:`variation.effective`,label:`🎼`},autoWrap:{configKey:`autoWrap`,sessionKey:`autoWrap`,effectiveVar:`autoWrap.effective`,label:`wrap`},padding:{configKey:`padding`,sessionKey:`padding`,effectiveVar:`padding.effective`,label:`padding`},updateNotice:{configKey:`updateNotice`,sessionKey:`updateNotice`,effectiveVar:`updateNotice.effective`,label:`update notice`}},Ob=Object.values(Db),kb=[{configKey:`charset`,effectiveVar:`charset.effective`},{configKey:`colorCompatibility`,effectiveVar:`colorCompatibility.effective`}],Ab=new Set(kb.map(e=>e.configKey)),jb=new Map([...Ob,...kb].map(e=>[e.configKey,e.effectiveVar])),Mb=new Map(Ob.map(e=>[e.sessionKey,e.effectiveVar]));function Nb(e){return Object.fromEntries(Object.keys(Db).map(t=>[t,e(t)]))}const Pb=new Map(Object.keys(Db).map(e=>[Db[e].sessionKey,e]));function Fb(e,t,n){let r=new Set,i=e=>{for(let t of mv(e??``,n).keys())r.add(t)};for(let t of Object.values(e.segments))i(t.template),i(t.bg),i(t.fg),i(t.when);for(let e of t)for(let t of ks(e))i(t.when),t.kind===`segment`&&(i(t.lead),i(t.trail));for(let t of Object.values(e.variables))t.kind===`template`&&i(t.template),t.kind===`state`&&r.add(lb);for(let t of Object.values(e.actions)){r.add(lb),`copy`in t&&i(t.copy),`open`in t&&i(t.open);let e=`set`in t?Mb.get(t.set):void 0,n=`persist`in t?jb.get(t.persist):void 0;e!==void 0&&r.add(e),n!==void 0&&r.add(n)}return r}function Ib(e,t,n){let r=bv({...n,variables:{...n.variables,...e.variables},segments:{...n.segments,...e.segments}}),i={};for(let a of Fb(e,t,n.helpers)){if(yv(a,r))continue;let e=Eb[a];if(e===void 0)throw Error(`synthesized chrome reads ".${a}", which it does not declare and PAYLOAD_INPUTS does not supply`);i[a]=e}return i}const Lb=new Map,Rb=new Map;function zb(e){let t=Vb(e);if(t===null)throw Error(`Palette "${e}" did not resolve in the theme registry — allowed names and the registry are inconsistent`);return t}function Bb(e,t){return e===`bar`?t:zb(e)}function Vb(e){let t=Lb.get(e);if(t!==void 0)return t;let n=wr(e);return n===null?null:(Lb.set(e,n),n)}function Hb(e,t){let n=`${e.name} ${t.hueShift} ${t.chromaScale} ${t.lightnessScale} ${t.lightnessShift}`,r=Rb.get(n);if(r!==void 0)return r;let i=Mr(e,t);return Rb.set(n,i),i}function Ub(e){let t=Vb(e);return t===null?null:{kind:`decided`,name:e,value:t}}function Wb(e,t,n){let r=Ub(e);return r===null?(n(`${t} rendered "${qa}": "${e}" names no installed theme${Ka(e)}`),Kb()):r}function Gb(e,t,n){return no(e,t,n,Kb(),Ub)}function Kb(){return Ub(qa)}function qb(e){return ro(Gb(void 0,null,e),Kb).value}const Jb=new Map;function Yb(e,t,n){Jb.set(e,{permanent:!0,resolve:t,paletteOf:n})}Yb(`themes`,()=>Ya(),e=>zb(e));const Xb=`placementThemes`;Yb(Xb,Xa,(e,t)=>Bb(e,t.palette)),Yb(`endcaps`,()=>co),Yb(`variations`,()=>go),Yb(`charsets`,()=>fo),Yb(`colorCompatibilities`,()=>mo);function Zb(e){return new Map([[`styles`,{members:Object.keys(e.styles),paletteOf:(t,n)=>Hb(n.basePalette,e.styles[t])}],[`presets`,{members:w_(e.presets)}]])}function Qb(e){return[...new Set([...Jb.keys(),...e.keys()])]}function $b(e,t){if(typeof e!=`string`)return{members:e};let n=t.get(e);if(n)return n;let r=Jb.get(e);if(r)return{members:r.resolve(),paletteOf:r.paletteOf};throw Error(`unknown option domain "${e}" (have: ${Qb(t).join(`, `)})`)}function ex(e){return{label:e.label,domain:tx(e.domain)}}function tx(e){return e===`theme`?{from:Xb}:e===`bool`||`min`in e?e:{from:e}}function nx(e,t,n,r){let i=Gc(e.label),{domain:a}=e;if(a===`bool`)return{kind:`inline`,template:`{{ action "${r}" "☑ ${i}" "☐ ${i}" }}`,actions:{[r]:{set:t,cycle:[...xo]}}};if(`from`in a)return{kind:`ring`,template:`{{ carousel "${r}" }}`,actions:{[r]:{set:t,from:a.from}}};let o=e=>({set:t,min:a.min,max:a.max,by:e});return{kind:`inline`,template:`{{ action "${r}.down" "◀" }} {{ "${i}" }} {{ .${n} }} {{ action "${r}.up" "▶" }}`,actions:{[`${r}.down`]:o(-a.step),[`${r}.up`]:o(a.step)}}}const rx=/^segments\.([^.]+)\.palette$/,ix=/^presets\.(.+)\.root$/,ax=/^presets\.(.+)\.globals\.([^.]+)$/;function ox(e){return`presets.${e}.root`}function sx(e,t){return`presets.${e}.globals.${t}`}function cx(e){if(El(e))return{scope:`globals`,field:e};let t=rx.exec(e);if(t)return{scope:`segment-palette`,segment:t[1]};let n=ax.exec(e);if(n&&yl(n[2]))return{scope:`preset-globals`,preset:n[1],field:n[2]};let r=ix.exec(e);return r?{scope:`preset-root`,preset:r[1]}:null}function lx(e){switch(e.scope){case`globals`:return[`globals`,e.field];case`preset-globals`:return[`presets`,e.preset,`globals`,e.field];case`segment-palette`:return[`segments`,e.segment,`palette`]}}const ux=`open`;function dx(e,t,n,r){let i={variable:e,key:e,member:ux};return r.variables[e]=Qc(e,Vc),r.actions[e]=$c(e,ux),r.segments[e]={template:Yc(e,`(?)`,`✕`),...fx(n)},Kc(e,i,{kind:`container`,direction:`horizontal`,children:t.map((t,n)=>{let i=`${e}.${n}`;return r.segments[i]={template:t},{kind:`segment`,name:i}})},`drop`)}function fx(e){let[t,...n]=e;return t===void 0?{}:{when:qc(t,...n)}}const px=`none`;var mx=class extends Error{constructor(e,t,n){super(`Invalid ${t} color ${JSON.stringify(e)}: ${n}`),this.name=`ColorSpecError`}};function hx(e,t,n,r,i){let{palette:a,tint:o}=e,s=gx(n,i),c=s!==px,l=c?s===void 0?o:_x(a,s,`bg`):_x(a,`background`,`bg`);e.bg=l;let u=gx(r,i),d=u===void 0?c?Da(a,l,t):void 0:_x(a,u,`fg`);return new V({...c&&{bgcolor:_n.fromRgba(l)},...d!==void 0&&{color:_n.fromRgba(d)}})}function gx(e,t){if(e!==void 0)return e.evaluate(t).map(e=>e.plain).join(``)}function _x(e,t,n){try{return Qn(e,t)}catch(e){throw e instanceof Yn?new mx(t,n,e.message):e}}const vx={help:[`-h`,`--help`],version:[`-V`,`--version`]},yx=[`✚ inserts`,`✖ removes`,`⚙️ configures`,`↺ resets layout`],bx=`
91
91
  cc-candybar - Beautiful powerline statusline for Claude Code
92
92
 
93
93
  Usage: cc-candybar [options]
94
94
 
95
95
  Standalone Commands:
96
- ${gx.help.join(`, `).padEnd(25)}Show this help
97
- ${gx.version.join(`, `).padEnd(25)}Print the version of this runtime (cc-candybar <version>)
96
+ ${vx.help.join(`, `).padEnd(25)}Show this help
97
+ ${vx.version.join(`, `).padEnd(25)}Print the version of this runtime (cc-candybar <version>)
98
98
 
99
99
  Debugging:
100
100
  CC_CANDYBAR_DEBUG=1 Enable debug logging for troubleshooting
@@ -107,7 +107,7 @@ Configuration:
107
107
 
108
108
  Every bar carries a settings menu, whatever your config says — no config
109
109
  needed, and writing your own \`root\` cannot delete it. Click
110
- it on the bar (${Uc} by default; globals.menuGlyph changes it) for
110
+ it on the bar (${Hc} by default; globals.menuGlyph changes it) for
111
111
  preset switching and five tabs: ⚡ session (quick actions and commands),
112
112
  🎨 look (theme/style/variation/endcaps), 📐 layout (new preset, edit mode,
113
113
  wrap, padding), ⚙ config (update notice) and
@@ -117,7 +117,7 @@ Configuration:
117
117
  failed row's [fix] to repair it (the same checks \`cc-candybar doctor\` runs).
118
118
 
119
119
  Anywhere the bar shows (?), clicking it reveals these same instructions
120
- in place. In edit mode: ${_x.join(`, `)}.
120
+ in place. In edit mode: ${yx.join(`, `)}.
121
121
 
122
122
  Subcommands:
123
123
  install One-shot setup: stages the runtime (native render
@@ -155,26 +155,26 @@ Config tooling:
155
155
  config [--json] The effective merged config. (All three query the
156
156
  running daemon; none spawn one.)
157
157
 
158
- `,yx=`readableOn (mix (color "foreground") (bgOf) 60) (bgOf) 3`,bx={socket:`TMUX`,pane:`TMUX_PANE`,truecolor:`CLAUDE_CODE_TMUX_TRUECOLOR`};function xx(e){let t=e[bx.socket]??``,n=e[bx.pane]??``;if(t===``||n===``)return null;let r=e[bx.truecolor]??``;return{socket:t.split(`,`)[0],pane:n,truecolor:r===``?null:r}}const Sx=bx.truecolor,Cx=[{name:`tmuxTruecolor`,label:`tmux truecolor`,probe:({tmux:e,claudeSettings:t})=>{switch(e.kind){case`unreported`:return{ok:!1,reason:"the client reported no tmux facts — re-run `cc-candybar install` to stage a current client"};case`outside`:return{ok:!0};case`inside`:{if(e.termfeatures.kind===`failed`)return{ok:!1,reason:`tmux could not be asked: ${e.termfeatures.reason}`};if(!e.termfeatures.value.includes(`RGB`)||e.hint.truecolor!==null)return{ok:!0};let n=t.env[Sx];return typeof n==`string`&&n!==``?{ok:!1,reason:`${Sx} is set in ${t.path} — restart Claude Code to apply`}:{ok:!1,reason:`Claude Code renders the bar in 256 colours inside tmux`,fix:{kind:`claude-settings-env`,name:Sx,value:`1`}}}}}}];function wx(e){return Cx.map(t=>({check:t,verdict:t.probe(e)}))}function Tx(e){return Cx.find(t=>t.name===e)}const Ex=`${K}doctor.`;function Dx(e){let t=`${Ex}${e}.`;return{verdict:`${t}verdict`,reason:`${t}reason`,fixable:`${t}fixable`}}function Ox(e){return e.flatMap(({check:e,verdict:t})=>{let n=Dx(e.name);return t.ok?[{key:n.verdict,value:`ok`},{key:n.reason,value:``},{key:n.fixable,value:So}]:[{key:n.verdict,value:`failed`},{key:n.reason,value:t.reason},{key:n.fixable,value:t.fix===void 0?So:xo}]})}const kx={copySession:{copy:`{{ .session.id }}`},copyResume:{copy:`{{ .resume_command }}`},openProject:{open:`{{ .project_dir }}`},openTranscript:{open:`{{ .transcript_path }}`},openConfig:{open:`{{ .config_path }}`}};function Ax(e){let t=t=>`${e}${t}`;return{template:`{{ action "${t(`copySession`)}" "⎘ id" }}{{ if ne .resume_command "" }} {{ action "${t(`copyResume`)}" "⎘ resume" }}{{ end }} {{ action "${t(`openProject`)}" "↗ proj" }} {{ action "${t(`openTranscript`)}" "↗ log" }}{{ if ne .git.repoUrl "" }} {{ link .git.repoUrl "↗ repo" }}{{ end }}{{ if ne .config_path "" }} {{ action "${t(`openConfig`)}" "↗ config" }}{{ end }}`,actions:Object.fromEntries(Object.entries(kx).map(([t,n])=>[`${e}${t}`,n]))}}const jx=`armed`,Mx=`disarmed`,Nx=`.armed`,Px=e=>e.endsWith(Nx);function Fx(e,t,n){let r=`${e}${Nx}`,i=`${e}.arm`,a=`${e}.disarm`,o=`(eq .${e} "${jx}")`;return{template:`{{ if ${o} }}{{ action "${e}" "${t.confirm}" }} {{ action "${a}" "✕" }}{{ else }}{{ action "${i}" "${t.arm}" }}{{ end }}`,actions:{[i]:{set:r,to:jx},[a]:{set:r,to:Mx},[e]:{do:[a,...n]}},armed:o,variables:{[e]:{kind:`state`,key:r,default:Mx}},disarm:a}}const Ix=RegExp(`^/[^\\s\\x00-\\x1f\\x7f-\\x9f/][^\\x00-\\x1f\\x7f-\\x9f]*$`);function Lx(e){return typeof e==`string`&&Ix.test(e)?{kind:`line`,line:e}:{kind:`refused`,reason:`a slash command is "/" then its name, e.g. "/compact" or "/model opus", on one line with no control characters, got ${JSON.stringify(e)}`}}function Rx(e){let t=Lx(e);if(t.kind===`refused`)throw Error(t.reason);return t.line}const zx=[`/compact`,`/model`],Bx=`/clear`;function Vx(e){let t=t=>`${e}${t.slice(1)}`,n=`${e}clear.slash`,r=Fx(`${e}clear`,{arm:Bx,confirm:`${Bx} ✓ confirm`},[n]);return{template:zx.map(e=>`{{ action "${t(e)}" "${e}" }} `).join(``)+r.template,actions:{...Object.fromEntries(zx.map(e=>[t(e),{slash:Rx(e)}])),...r.actions,[n]:{slash:Rx(Bx)}},variables:r.variables,disarm:r.disarm}}const Hx=`${K}menu`,Ux=`open`,Wx=`${K}edit`,Gx=`${K}toolbar`,Kx=Ax(K),qx=`${K}commands`,Jx=Vx(`${qx}.`),Yx=`${K}tab`,Xx=[{member:`session`,label:`⚡ session`},{member:`look`,label:`🎨 look`},{member:`layout`,label:`📐 layout`},{member:`config`,label:`⚙ config`},{member:`tools`,label:`🧰 tools`}],Zx=e=>`${Yx}.${e}`,Qx=e=>`${Zx(e)}.toggle`,$x=e=>({variable:Yx,key:Yx,member:e}),eS=`${K}save`,tS=`${K}unsaved`,nS=`${K}preset.save`,rS=`${K}preset.delete`,iS=`${K}resetAll`,aS=`${Hx}.toggle`,oS={variable:Hx,key:Hx,member:Ux},sS=`${K}undo`,cS=`${K}back`,lS=`${cS}.step`,uS=`${K}navigation.back`,dS=cS,fS={template:`{{ if gt .${uS} 0 }}{{ action "${cS}" "◁" }}{{ else }}{{ fg (${yx}) "◁" }}{{ end }}`},pS=`${K}redo`,mS=`${K}resettable`,hS=`${K}doctor`,gS=`${hS}.run`,_S=e=>`${hS}.fix.${e}`,vS=e=>`${hS}.${e}`,yS=`${K}pickers`,bS=[{template:`{{ themePreview }}`}],xS={template:`{{ layoutPreview }}`},SS={preset:[xS,{when:`{{ not .preset.bundled }}`,template:`{{ action "${rS}" (printf "🗑 delete %s" .${Eb.preset.effectiveVar}) }}`}],theme:bS,style:bS,variation:[xS]},CS=e=>`${K}${e}`,wS=e=>`${K}apply.${e}`,TS=e=>`${K}reset.${e}`,ES=e=>`${K}carousel.${e}`,DS=(e,t)=>`${ES(e)}.${t}`,OS=Object.keys(Eb).map(e=>{let t=Eb[e],n=ul(t.configKey);if(n===`text`)throw Error(`settings menu: globals.${t.configKey} is free text, which no control can change — list it in UNCONTROLLED_GLOBALS instead of SETTINGS`);let r=ex({label:t.label,domain:n},t.sessionKey,t.effectiveVar,wS(e));return{...t,name:e,control:r,beneath:SS[e]??[]}}),kS={preset:`door`,theme:`look`,style:`look`,variation:`look`,endcaps:`look`,autoWrap:`layout`,padding:`layout`,updateNotice:`config`},AS=e=>OS.filter(t=>kS[t.name]===e).map(VS);new Set(OS.flatMap(e=>[e.sessionKey,e.configKey]));const jS=Fx(iS,{arm:`⟲`,confirm:`⟲ reset all?`},OS.map(e=>TS(e.name))),MS=(e,t,n)=>({count:e,path:t,body:n,shown:`(gt .${e} 0)`}),NS=[MS(tS,`unsaved`,`{{ action "${eS}" (printf "💾 save %d" .${tS}) }}`),MS(`${K}history.undo`,`history.undo`,`{{ action "${sS}" "↶" }}`),MS(`${K}history.redo`,`history.redo`,`{{ action "${pS}" "↷" }}`),{count:mS,path:`resettable`,body:jS.template,shown:`(or (gt .${mS} 0) ${jS.armed})`}],PS={when:`{{ or ${NS.map(e=>e.shown).join(` `)} }}`,template:`{{ $sep := "" }}`+NS.map(e=>`{{ if ${e.shown} }}{{ $sep }}${e.body}{{ $sep = " " }}{{ end }}`).join(``)},FS=[{step:jS,place:`door`},{step:Jx,place:`session`}],IS=e=>e.map(e=>e.step.disarm),LS=IS(FS),RS=IS(FS.filter(e=>e.place!==`door`)),zS=m_(yS),BS=e=>({variable:zS,key:zS,member:f_(wS(e))});function VS(e){let t=CS(e.name);return e.control.kind===`inline`?{kind:`segment`,name:t}:qc(t,BS(e.name),{kind:`container`,direction:`vertical`,children:[{kind:`segment`,name:ES(e.name)},...e.beneath.map((t,n)=>({kind:`segment`,name:DS(e.name,n)}))]},`drop`)}function HS(e){return e===Hx}function US(e){let t={kind:`segment`,name:Hx};if(e.kind===`container`&&e.direction===`vertical`){let[n,...r]=e.children;return e.when===void 0&&n!==void 0?{...e,children:[US(n),...r]}:{kind:`container`,direction:`vertical`,children:[t,e]}}return e.kind===`container`&&e.when===void 0?{...e,children:[t,...e.children]}:{kind:`container`,direction:`horizontal`,children:[t,e]}}function WS(e){return GS(e)>0?e:US(e)}function GS(e){let t=0;for(let n of js(e))n.kind===`segment`&&HS(n.name)&&(t+=1);return t}function KS(e,t=!1){let n=t||e.when!==void 0;return e.kind===`segment`?n&&HS(e.name)||e.opens!==void 0&&KS(e.opens.body,!0):e.children.some(e=>KS(e,n))}const qS={session:{direction:`vertical`,segments:[Gx,qx]},look:{direction:`horizontal`,segments:[]},layout:{direction:`horizontal`,segments:[nS,Wx]},config:{direction:`horizontal`,segments:[]},tools:{direction:`vertical`,segments:[hS,...Cx.map(e=>vS(e.name))]}},JS=e=>({kind:`container`,direction:qS[e].direction,children:[...qS[e].segments.map(e=>({kind:`segment`,name:e})),...AS(e)]});function YS(e){return e.kind===`segment`?HS(e.name)?qc(e.name,oS,ZS,`above`):e:$S(e)}function XS(){return{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:dS},...AS(`door`),{kind:`segment`,name:eS}]},{kind:`container`,direction:`horizontal`,children:Xx.map(({member:e})=>qc(Zx(e),$x(e),JS(e),`drop`))}]}}const ZS=XS();function QS(e){let t=new Map;for(let e of js(ZS))e.kind===`segment`&&e.opens!==void 0&&t.set(e.opens.ref.key,e.opens.ref.variable);return[...t].map(([t,n])=>{let r=e.variables[n];if(r?.kind!==`state`||r.default===void 0)throw Error(`settings menu: the door folds "${t}", but "${n}" is not a state variable the menu declares with a default`);let i=`${Hx}.fold.${hu(t)}`;return e.actions[i]={set:t,to:r.default},i})}function $S(e){return{...e,children:e.children.map(e=>YS(e))}}function eC(e){let t={variables:{[Hx]:Qc(Hx,Hc)},actions:{[aS]:$c(Hx,Ux),[gS]:{doctor:`run`},[Wx]:{do:[...G_]},...Kx.actions,...Jx.actions,[eS]:{save:!0},[sS]:{undo:!0},[lS]:{back:!0},[cS]:{do:[lS,...LS]},[pS]:{redo:!0},[nS]:{preset:`save`},[rS]:{preset:`delete`,name:`{{ .${Eb.preset.effectiveVar} }}`}},segments:{[Hx]:{template:`{{ $door := ${Zc(Hx,e,`✖`)} }}{{ if ${Yc(oS)} }}{{ fg (color "error") $door }}{{ else }}{{ $door }}{{ end }}`},[Gx]:{template:Kx.template},[qx]:{template:Jx.template},[dS]:fS,[eS]:PS,[nS]:{template:`{{ action "${nS}" "+ preset" }}`},[hS]:{template:`{{ action "${gS}" "🩺 doctor" }}`},[Wx]:{template:`{{ action "${Wx}" "✎ arrange" "✎ done" }}`}}};t.variables[uS]={kind:`input`,path:`navigation.back`,type:`number`,default:0};for(let e of NS)t.variables[e.count]={kind:`input`,path:e.path,type:`number`,default:0};t.variables[Yx]=Qc(Yx,`session`);for(let{member:e,label:n}of Xx)t.actions[Qx(e)]=$c(Yx,e),t.actions[Zx(e)]={do:[Qx(e),...RS]},t.segments[Zx(e)]={template:Xc(Zx(e),n,`▾ ${n}`)};return Object.assign(t.variables,Jx.variables,jS.variables),nC(t),tC(t),t.actions[Hx]={do:[aS,...LS,...QS(t)]},t}function tC(e){for(let t of Cx){let n=Dx(t.name),r=_S(t.name);for(let t of Object.values(n))e.variables[t]={kind:`state`,key:t,default:``};e.actions[r]={doctor:`fix`,check:t.name},e.segments[vS(t.name)]={when:`{{ ne .${n.verdict} "" }}`,template:`{{ if eq .${n.verdict} "ok" }}✓ ${t.label}{{ else }}✗ ${t.label} — {{ .${n.reason} }}{{ if eq .${n.fixable} "${xo}" }} {{ action "${r}" "[fix]" }}{{ end }}{{ end }}`}}}function nC(e){for(let t of OS){Object.assign(e.actions,t.control.actions);let n=TS(t.name);e.actions[n]={reset:t.configKey};let r=`{{ action "${n}" "↺" }}`;if(t.control.kind===`inline`){e.segments[CS(t.name)]={template:`${t.control.template} ${r}`};continue}let i=BS(t.name),a=h_(i.key,i.member);e.variables[i.key]=Qc(i.key,Hc),e.actions[a]=$c(i.key,i.member),e.segments[CS(t.name)]={template:`${t.label} {{ .${t.effectiveVar} }} ${Xc(a,`▸`,`▾`)} `+r},e.segments[ES(t.name)]={template:t.control.template},t.beneath.forEach((n,r)=>{e.segments[DS(t.name,r)]=n})}Object.assign(e.actions,jS.actions)}function rC(e){let{variables:t,actions:n}=ev();Object.assign(e.variables,t),Object.assign(e.actions,n)}function iC(e){let t=eC(e.globals.menuGlyph??`🍫`);rC(t);let n={...e.presets},r=[];for(let t of C_(e.presets)){let{node:i}=E_(e,t),a=YS(WS(i));r.push(a),n[t]={...T_(e.presets,t),root:a}}let i=Pb(t,r,e);return{...e,variables:{...i,...e.variables,...t.variables},actions:{...e.actions,...t.actions},segments:{...e.segments,...t.segments},presets:n}}const aC=`${vu}live`,oC=[`☐ live`,`☑ live`],sC=`${vu}done`,cC=`${vu}cancel`,lC=`${vu}rewind`,uC=`${vu}changes`,dC=`(gt .${uC} 0)`,fC=`(or ${dC} (gt .${tS} 0))`,pC={variable:aC,key:aC,member:`open`};function mC(e){return`${vu}configuring.p${e}`}function hC(e){return`and ${Yc(Y_)} (not ${Yc(pC)}) (ne .${mC(e)} "true")`}function gC(e){return{kind:`template`,template:`{{ or ${e.map(e=>`(eq .${H_} "${Kc(e)}")`).join(` `)} false }}`}}function _C(e,t,n){return`{{ if ${hC(e)} }}${t}{{ else }}${n}{{ end }}`}const vC=`{{ and ${Yc(Y_)} .preset.customized }}`,yC=bu,bC=`${vu}addable`;function xC(e){return new Map([[bC,{members:Object.keys(e.segments).filter(e=>!yC(e)),library:{groups:pu.map(e=>({id:e,label:mu[e]})),entry:t=>{let n=e.segments[t];return{group:n.group??`other`,...n.description!==void 0&&{description:n.description}}}}}]])}function SC(e,t,n){return n.segments[e]={template:t,when:X_,bg:dx},{kind:`segment`,name:e}}function CC(e,t,n){let r=`${vu}${e.presetIdent}.remove.${t}`;return e.artifacts.actions[r]={persist:e.rootKey,removeSegment:n},`{{ fg (${`readableOn (color "error") (bgOf) ${Oa}`}) (action "${r}" "✖") }}`}function wC(e){return`{{ if ${Yc(Y_)} }}${e}{{ end }}`}function TC(e,t){return e.reduce((e,t)=>`{{ if and ${Yc(Y_)} ${Yc(t)} }}true{{ else }}${e}{{ end }}`,t)}function EC(e){return e.flatMap(e=>[...js(e)].flatMap(e=>e.kind===`segment`&&e.opens?.ref.key===`edit.configure`?[e.opens.ref]:[]))}function DC(e,t,n){return`${q_}${e}.${t}.${n}`}function OC(e,t,n,r){let i=Ds(n),a=`${vu}${e.presetIdent}`,o=J_(e.presetIdent,i);e.configured.push(o);let s=`${a}.configure.${t}`;e.artifacts.actions[s]={set:H_,to:o};let c={},l=Object.entries(r).map(([r,o])=>{let s=DC(e.presetIdent,i,r),l=`${q_}p${e.presetIdent}.d${t}.${r}`;e.artifacts.variables[l]={kind:`state`,key:s,default:Ks(n.settings?.[r]??o.default)},c[r]={id:i,key:s,variable:l};let u=`${a}.setting.${t}.${r}`,d=ex(Qb(o),s,l,u);return Object.assign(e.artifacts.actions,d.actions),e.artifacts.segments[u]={template:d.kind===`ring`?`{{ "${Kc(o.label)}" }} ${d.template}`:d.template},{kind:`segment`,name:u}});return{term:`{{ action "${s}" "⚙️" }}`,ref:{variable:H_,key:H_,member:o},body:{kind:`container`,direction:`vertical`,children:l},drafts:c}}const kC=`${vu}label:`;function AC(e){if(e.startsWith(kC)){let t=e.slice(kC.length);return t.slice(t.indexOf(`:`)+1)}return e.startsWith(`edit.`)?void 0:e}function jC(e,t,n,r){let{artifacts:i}=n,a=Ds(e),o=`${kC}${a}:${e.name}`;i.segments[o]={template:`{{ "${Kc(a)}" }}`,...t.palette!==void 0&&{palette:t.palette}};let s=e.settings?.[Vs];return{...qc(o,r.ref,r.body,`drop`,TC([r.ref],`{{ ${hC(n.presetIdent)} }}`)),...s!==void 0&&{settings:{theme:s}},drafts:{[Vs]:r.drafts[Vs]}}}function MC(e,t,n,r){let{presetIdent:i,artifacts:a}=e,o=`${vu}${i}.insert.${t}`,s=`${vu}${i}.insertSeg.${t}`;a.actions[o]={persist:e.rootKey,insertSegmentFrom:bC,anchor:n,relation:r};let c=f_(o),l=p_(s,o,void 0),u=g_(l),d=h_(l,c);return a.variables[l]=Qc(l,Hc),a.variables[u]={kind:`state`,key:u,default:`0`},a.actions[d]=$c(l,c),a.actions[u]={set:u,int:!0},{host:s,template:`{{ $m := menu "${o}" "✚" "✕" }}{{ if ${Yc({variable:l,key:l,member:c})} }}{{ $m }}{{ else }}{{ fg (${`readableOn (color "success") (bgOf) ${Oa}`}) $m }}{{ end }}`}}function NC(e,t){let n=[],r=e.children.findIndex(e=>e.kind===`segment`&&!yC(e.name)),i=e=>NC(e,t);for(let[a,o]of e.children.entries()){if(o.kind===`container`){n.push(i(o));continue}let s=As(o,i);if(yC(o.name)){n.push(s);continue}let c=Ds(o),l=a===r?[MC(t,String(t.posCounter.n++),c,`before`)]:[],u=String(t.posCounter.n++),d=MC(t,u,c,`after`),f=CC(t,u,c),p=t.segments[o.name],m=OC(t,u,o,Hs(p)),h=wC(f),g=wC(m.term),_={kind:`container`,direction:`horizontal`,children:[...l.map(e=>SC(e.host,e.template,t.artifacts)),{...jC(o,p,t,m),lead:h,trail:g},{...s,when:_C(t.presetIdent,`false`,o.when??`true`),lead:h,trail:g,drafts:m.drafts},SC(d.host,d.template,t.artifacts)]};n.push(e.direction===`vertical`?{kind:`container`,direction:`horizontal`,children:[_]}:_)}return{...e,children:n,...e.when!==void 0&&{when:TC(EC(n),_C(t.presetIdent,`true`,e.when))}}}function PC(e,t,n,r,i,a,o){let s=`${vu}${t}.resetLayout`,c=`${vu}${t}.customized`;return r.actions[s]={reset:n},r.segments[c]={template:`{{ action "${s}" "↺ reset layout" }}`,when:vC},{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[...i,{kind:`segment`,name:c},a]},FC(e,o)]}}function FC(e,t){if(e.kind===`segment`)return{kind:`container`,direction:`horizontal`,children:[e,t]};let n=e.children.at(-1);return e.direction===`vertical`&&n!==void 0&&(n.kind===`segment`||n.when===void 0)?{...e,children:[...e.children.slice(0,-1),FC(n,t)]}:{...e,children:[...e.children,t]}}function IC(e,t,n,r,i,a){let{node:o}=E_(e,t),s={presetIdent:hu(t),rootKey:ix(t),segments:e.segments,artifacts:n,posCounter:{n:0},configured:[]},c=NC(o,s);return n.variables[mC(s.presetIdent)]=gC(s.configured),PC(c,s.presetIdent,s.rootKey,n,r,i,a)}function LC(e){let t={variables:{},actions:{},segments:{}},n=lx(`${vu}help`,_x,[Y_],t);t.variables[aC]=Qc(aC,Hc),t.actions[aC]=$c(aC,pC.member),t.segments[aC]={template:Xc(aC,...oC),when:X_};let r={kind:`segment`,name:aC},i=n;t.variables[uC]={kind:`input`,path:`history.sinceEdit`,type:`number`,default:0},t.actions[sC]={do:[eS,...G_]},t.segments[sC]={template:`{{ if ${fC} }}{{ action "${sC}" "✓ save" }}{{ else }}{{ action "${sC}" "✓ done" }}{{ end }}`,when:X_},t.actions[lC]={rewind:!0},t.actions[cC]={do:[lC,...G_]},t.segments[cC]={template:`{{ action "${cC}" "↩ cancel" }}`,when:`{{ and ${Yc(Y_)} ${dC} }}`};let a=[{kind:`segment`,name:sC},{kind:`segment`,name:cC}],o={...e.presets},s=[];for(let n of C_(e.presets)){let c=IC(e,n,t,a,r,i);s.push(c),o[n]={...T_(e.presets,n),root:c}}let c=Pb(t,s,e);return{...e,variables:{...c,...e.variables,...t.variables},actions:{...e.actions,...t.actions},segments:{...e.segments,...t.segments},presets:o}}const RC=[`set`,`persist`,`copy`,`open`,`reset`,`undo`,`redo`,`back`,`rewind`,`save`,`preset`,`doctor`,`ceiling`,`slash`,`do`];function zC(e){return e.ceiling===`set`?[`set`,e.to]:[`clear`]}function BC(e){return`from`in e||`int`in e||`insertSegmentFrom`in e}function VC(e,t){if(t===void 0)return{};if(!nc(t))return Z(e,`actions`,`actions must be an object, got ${W(t)}`),{};let n=Object.create(null);for(let[r,i]of Object.entries(t)){let t=HC(e,`actions.${r}`,i);t!==null&&(n[r]=t)}return n}function Z(e,t,n){e.issues.push({path:t,message:n,line:U(e.source,t.split(`.`))})}function HC(e,t,n){if(!nc(n))return Z(e,t,`${t} must be an action object, got ${W(n)}`),null;if(`persistWhen`in n)return Z(e,t,`${t}.persistWhen was removed: declare the \`set\` alone — a session pick is a draft until a \`{ save: true }\` action writes every unsaved setting to the config file`),null;let r=RC.filter(e=>e in n);return r.length===1?UC[r[0]](e,t,n):(Z(e,t,`action must declare exactly one of: ${RC.join(`, `)}${r.length>1?` (found: ${r.join(`, `)})`:``}`),null)}const UC={set:(e,t,n)=>xw(e,t,n,`set`,_w),persist:(e,t,n)=>xw(e,t,n,`persist`,vw),copy:WC(`copy`),open:WC(`open`),reset:GC,undo:qC(`undo`),redo:qC(`redo`),back:qC(`back`),rewind:qC(`rewind`),save:qC(`save`),preset:JC,doctor:YC,ceiling:XC,slash:ZC,do:QC};function WC(e){return(t,n,r)=>{for(let i of Object.keys(r))i!==e&&Z(t,`${n}.${i}`,`Unknown key "${i}" on a ${e} action. Expected only: ${e}`);let i=Zs(t,n,r,e);return i===null?null:{[e]:i}}}function GC(e,t,n){for(let r of Object.keys(n))r!==`reset`&&Z(e,`${t}.${r}`,`Unknown key "${r}" on a reset action. Expected only: reset`);let r=$C(e,t,`reset`,n,`reset key must be non-empty (the config globals field to clear)`,e=>`reset key "${e}" contains "/" — keys must be slash-free`);return r===null?null:{reset:r}}const KC={undo:`it steps the session's settings history`,redo:`it steps the session's settings history`,back:`it steps the session's navigation history`,rewind:`it steps the session's settings history back to where edit mode opened`,save:`it saves the session's unsaved settings`};function qC(e){return(t,n,r)=>{for(let i of Object.keys(r))i!==e&&Z(t,`${n}.${i}`,`Unknown key "${i}" on a ${e} action. Expected only: ${e}`);return r[e]===!0?{[e]:!0}:(Z(t,`${n}.${e}`,`${e} must be the literal true (it takes no key — ${KC[e]}), got ${G(r[e])}`),null)}}function JC(e,t,n){let r=n.preset,i=r===`save`?[`preset`]:[`preset`,`name`];for(let r of Object.keys(n))i.includes(r)||Z(e,`${t}.${r}`,`Unknown key "${r}" on a preset action. Expected only: ${i.join(`, `)}`);if(r!==`save`&&r!==`delete`)return Z(e,`${t}.preset`,`preset must be "save" or "delete", got ${G(r)}`),null;if(r===`save`)return{preset:`save`};let a=Zs(e,t,n,`name`);return a===null?null:{preset:`delete`,name:a}}function YC(e,t,n){let r=n.doctor,i=r===`run`?[`doctor`]:[`doctor`,`check`];for(let r of Object.keys(n))i.includes(r)||Z(e,`${t}.${r}`,`Unknown key "${r}" on a doctor action. Expected only: ${i.join(`, `)}`);if(r!==`run`&&r!==`fix`)return Z(e,`${t}.doctor`,`doctor must be "run" or "fix", got ${G(r)}`),null;if(r===`run`)return{doctor:`run`};let a=n.check;return typeof a!=`string`||Tx(a)===void 0?(Z(e,`${t}.check`,`doctor fix must name a check (have: ${Cx.map(e=>e.name).join(`, `)}), got ${G(a)}`),null):{doctor:`fix`,check:a}}function XC(e,t,n){let r=n.ceiling,i=r===`clear`?[`ceiling`]:[`ceiling`,`to`];for(let r of Object.keys(n))i.includes(r)||Z(e,`${t}.${r}`,`Unknown key "${r}" on a ceiling action. Expected only: ${i.join(`, `)}`);if(r===`clear`)return{ceiling:`clear`};if(r!==`set`)return Z(e,`${t}.ceiling`,`ceiling must be "set" or "clear", got ${G(r)}`),null;let a=n.to;return typeof a!=`string`||a.trim()===``?(Z(e,`${t}.to`,`ceiling set needs \`to\`: a memento ceiling value such as "+100_000", "400000" or "off", got ${G(a)}`),null):{ceiling:`set`,to:a}}function ZC(e,t,n){for(let r of Object.keys(n))r!==`slash`&&Z(e,`${t}.${r}`,`Unknown key "${r}" on a slash action. Expected only: slash`);let r=Lx(n.slash);return r.kind===`refused`?(Z(e,`${t}.slash`,r.reason),null):{slash:r.line}}function QC(e,t,n){for(let r of Object.keys(n))r!==`do`&&Z(e,`${t}.${r}`,`Unknown key "${r}" on a do action. Expected only: do`);let r=n.do;return!Array.isArray(r)||r.length<2||r.some(e=>typeof e!=`string`||e===``)?(Z(e,`${t}.do`,`do must list at least two action names (the first is the click's face, the rest ride along in the same click), got ${G(r)}`),null):{do:r}}function $C(e,t,n,r,i,a){let o=Zs(e,t,r,n);if(o===null)return null;let s=`${t}.${n}`;return o===``?(Z(e,s,i),null):o.includes(`/`)?(Z(e,s,a(o)),null):o}const ew={set:`the SessionState key to write`,persist:`the config globals field to write`};function tw(e,t,n,r){let i=ew[r],a=$C(e,t,r,n,`${r} key must be non-empty (${i})`,e=>`${r} key "${e}" contains "/" — keys must be slash-free`);return a===null?null:{[r]:a}}function nw(e){return e===`set`?`set-state`:`set-config`}const rw={to:Sw(`set`)},iw={to:Sw(`persist`)},aw={from:Cw(`set`)},ow={from:Cw(`persist`)},sw={min:Ow(),max:Ow(),by:Ow()},cw={int:Tw()},lw={cycle:ww(`set`)},uw={cycle:ww(`persist`)},dw={removeSegment:Ew(`removeSegment`)},fw={insertSegment:Ew(`insertSegment`),anchor:Ew(`anchor`),relation:Dw()},pw={insertSegmentFrom:Cw(`persist`),anchor:Ew(`anchor`),relation:Dw()},mw={ok:e=>e.min<e.max,issue:e=>({field:`min`,message:`min (${e.min}) must be less than max (${e.max})`})},hw={ok:e=>e.by!==0,issue:()=>({field:`by`,message:`by must be a non-zero integer (the per-click increment; negative steps down)`})};function gw(e,t,n=[],r){let i=Object.keys(t),a=r??i,o=[e],s=(e,n,r)=>ic(e,t,n,r),c=Sc(t);return{detect:a,allowed:[...o,...i],label:i.join(`/`),json:{type:`object`,properties:{...Object.fromEntries(o.map(e=>[e,{type:`string`}])),...c.properties},required:[...o,...c.required??[]],additionalProperties:!1},parse:n.length?fc(s,...n):s}}const _w=[gw(`set`,rw),gw(`set`,aw),gw(`set`,sw,[mw,hw]),gw(`set`,cw),gw(`set`,lw)],vw=[gw(`persist`,iw),gw(`persist`,ow),gw(`persist`,sw,[mw,hw]),gw(`persist`,uw),gw(`persist`,dw),gw(`persist`,fw,[],[`insertSegment`]),gw(`persist`,pw,[],[`insertSegmentFrom`])];function yw(e){let t=[`"to" (a literal value)`,`"from" (an option domain — a registered domain name like "themes"/"endcaps"/"styles", or an inline array of literal values)`,`"min"/"max"/"by" (a bounded step)`];return e===`set`&&t.push(`"int" (an unbounded integer cursor)`),t.push(`"cycle" (an enumerated domain stepped in order)`),e===`persist`&&t.push(`"removeSegment" (remove a named segment from the layout)`,`"insertSegment"/"anchor"/"relation" (insert a named segment before/after an existing one)`,`"insertSegmentFrom"/"anchor"/"relation" (insert a segment PICKED from an option domain before/after an existing one)`),t}function bw(e){let t=yw(e),n=t[t.length-1];return`a ${e} action declares exactly one value source: ${t.length===1?n:`${t.slice(0,-1).join(`, `)}, or ${n}`}`}function xw(e,t,n,r,i){let a=tw(e,t,n,r),o=i.filter(e=>e.detect.some(e=>e in n));if(o.length!==1)return Z(e,t,`${bw(r)}${o.length>1?` — found: ${o.map(e=>e.label).join(`, `)}`:``}`),null;let s=o[0];for(let i of Object.keys(n))s.allowed.includes(i)||Z(e,`${t}.${i}`,`Unknown key "${i}" on this ${r} action. Expected one of: ${s.allowed.join(`, `)}`);let c=s.parse(e,t,n);return a===null||c===null?null:{...a,...c}}function Sw(e){let t=nw(e);return{required:!0,json:{type:`string`},parse:(n,r,i,a)=>$C(n,r,i,a,`${e} value must be non-empty — an empty value cannot be delivered on the ${t} wire`,t=>`${e} value "${t}" contains "/" — ${e} values must be slash-free`)??void 0}}function Cw(e){let t=nw(e);return{required:!0,json:{anyOf:[{type:`string`,minLength:1},{type:`array`,items:{type:`string`,minLength:1},minItems:1,uniqueItems:!0}]},parse:(n,r,i,a)=>{let o=a[i],s=`${r}.${i}`;if(typeof o==`string`){if(o===``){Z(n,s,`${i} must be a non-empty domain name`);return}return o}if(Array.isArray(o)&&o.every(e=>typeof e==`string`)){let r=o;if(r.length===0){Z(n,s,`${i} must name a domain (a non-empty string) or declare an inline domain (a non-empty array of values)`);return}if(r.some(e=>e===``)){Z(n,s,`${i} array members must be non-empty — an empty value cannot be delivered on the ${t} wire`);return}let a=r.filter(e=>e.includes(`/`));if(a.length>0){Z(n,s,`${i} array member(s) ${a.map(e=>`"${e}"`).join(`, `)} contain "/" — ${e} values must be slash-free`);return}if(new Set(r).size!==r.length){Z(n,s,`${i} array members must be unique — a duplicated value would render the same picker option twice`);return}return r}Z(n,s,`${i} must be a domain name (a string) or an inline domain (an array of strings), got ${G(o)}`)}}}function ww(e){let t=nw(e);return{required:!0,json:{type:`array`,items:{type:`string`,minLength:1},minItems:2,uniqueItems:!0},parse:(n,r,i,a)=>{let o=a[i],s=`${r}.${i}`;if(!Array.isArray(o)||o.some(e=>typeof e!=`string`)){Z(n,s,`cycle must be an array of strings (the enumerated values a click steps through), got ${W(o)}`);return}let c=o;if(c.length<2){Z(n,s,`cycle needs at least two members (one member has no successor — use a literal "to")`);return}let l=c.some(e=>e===``),u=c.filter(e=>e.includes(`/`));if(l){Z(n,s,`cycle members must be non-empty — an empty value cannot be delivered on the ${t} wire`);return}if(u.length>0){Z(n,s,`cycle member(s) ${u.map(e=>`"${e}"`).join(`, `)} contain "/" — ${e} values must be slash-free`);return}if(new Set(c).size!==c.length){Z(n,s,`cycle members must be unique — the successor of a duplicated member is ambiguous`);return}return c}}}function Tw(){return{required:!0,json:{const:!0},parse:(e,t,n,r)=>{if(r[n]!==!0){Z(e,`${t}.${n}`,`int must be the literal true (declares the key an unbounded integer cursor — a paged picker's page key), got ${G(r[n])}`);return}return!0}}}function Ew(e){return{required:!0,json:{type:`string`},parse:(t,n,r,i)=>{let a=Zs(t,n,i,r);if(a===null)return;let o=`${n}.${r}`;if(a===``){Z(t,o,`${e} must be non-empty (a segment name)`);return}if(a.includes(`/`)||a.includes(`:`)){Z(t,o,`${e} "${a}" contains "/" or ":" — segment names in a layout op must be free of both (the click wire's own delimiter and layout-ops.ts's op-token delimiter)`);return}return a}}}function Dw(){return{required:!0,json:{enum:[`before`,`after`]},parse:(e,t,n,r)=>{let i=r[n];if(i!==`before`&&i!==`after`){Z(e,`${t}.${n}`,`relation must be "before" or "after", got ${G(i)}`);return}return i}}}function Ow(){return{required:!0,json:{type:`integer`},parse:(e,t,n,r)=>{let i=r[n];if(typeof i!=`number`||!Number.isInteger(i)){Z(e,`${t}.${n}`,`${n} must be an integer, got ${G(i)}`);return}return i}}}function kw(e,t,n){return`${e}: "${t}" is an endcaps shape, not a style — endcaps were renamed from "style" to "endcaps"; write ${n}: "${t}"`}const Aw={noun:`style key`,fields:{hueShift:gc(),chromaScale:gc({min:0}),lightnessScale:gc(),lightnessShift:gc()}};function jw(e,t){if(!nc(t))return e.issues.push({path:`styles`,message:`styles must be an object mapping style names to adaptation objects, got ${W(t)}`,line:U(e.source,[`styles`])}),{};let n={};for(let[r,i]of Object.entries(t)){if(r===``||r.includes(`/`)){e.issues.push({path:`styles.${r}`,message:`style name ${JSON.stringify(r)} must be non-empty and slash-free — a style picker writes the name on the set-state wire, which rejects empty values and splits on "/"`,line:U(e.source,[`styles`,r])});continue}if(fo(r)){e.issues.push({path:`styles.${r}`,message:kw(`styles.${r}`,r,`globals.endcaps`),line:U(e.source,[`styles`,r])});continue}let t=rc(e,Aw,`styles.${r}`,i);t!==null&&(n[r]={...Bn,...t})}return n}const Mw={noun:`preset key`,fields:{root:{required:!1,json:{$ref:`#/definitions/RootFragment`},parse:(e,t,n,r)=>r[n]===void 0?void 0:cd(e,`${t}.${n}`,r[n])},globals:{required:!1,json:Cl(),parse:(e,t,n,r)=>r[n]===void 0?void 0:Sl(e,`${t}.${n}`,r[n])}}};function Nw(e,t){if(!nc(t))return e.issues.push({path:`presets`,message:`presets must be an object mapping preset names to config fragments, got ${W(t)}`,line:U(e.source,[`presets`])}),{};let n={};for(let[r,i]of Object.entries(t)){if(r===``||r.includes(`/`)||/[\n\r]/.test(r)){e.issues.push({path:`presets.${r}`,message:`preset name ${JSON.stringify(r)} must be non-empty, slash-free, and newline-free — a preset picker writes the name on the set-state wire (which rejects empty values and splits on "/"), and edit mode splices it into a synthesized template string`,line:U(e.source,[`presets`,r])});continue}let t=rc(e,Mw,`presets.${r}`,i);t!==null&&(n[r]=t)}return n}function Pw(e,t){if(t===void 0)return{};if(!nc(t))return e.issues.push({path:`helpers`,message:`helpers must be an object, got ${W(t)}`,line:U(e.source,[`helpers`])}),{};let n=Object.create(null);for(let[r,i]of Object.entries(t)){if(typeof i!=`string`){e.issues.push({path:`helpers.${r}`,message:`helpers.${r} must be a string template body, got ${G(i)}`,line:U(e.source,[`helpers`,r])});continue}n[r]=i}return n}const Fw=new Map([[`session.budget.amount`,{segment:`session`,setting:`budget`}],[`session.budget.warningThreshold`,{segment:`session`,setting:`warnAt`}],[`today.budget.amount`,{segment:`today`,setting:`budget`}],[`today.budget.warningThreshold`,{segment:`today`,setting:`warnAt`}],[`block.budget.heatThreshold`,{segment:`block`,setting:`warnAt`}],[`block.budget.warningThreshold`,{segment:`block`,setting:`errorAt`}],[`weekly.budget.heatThreshold`,{segment:`weekly`,setting:`warnAt`}],[`weekly.budget.warningThreshold`,{segment:`weekly`,setting:`errorAt`}],[`burn.eta.errorMinutes`,{segment:`burnrate`,setting:`errorWithin`}],[`burn.eta.warnMinutes`,{segment:`burnrate`,setting:`warnWithin`}]]);function Iw(e){return`it became the "${e.setting}" setting of each "${e.segment}" placement — set it on the placement where a row places "${e.segment}" ({ seg: "${e.segment}", settings: { ${e.setting}: <value> } }), or redeclare segments.${e.segment}.settings.${e.setting} with the default every placement should start from`}function Lw(e){let t=Fw.get(e);return t===void 0?void 0:`variables.${e} is no longer read: ${Iw(t)}`}function Rw(e){let t=Fw.get(e);return t===void 0?``:` — ".${e}" is no longer a variable: ${Iw(t)}; a "${t.segment}" template reads it as ".settings.${t.setting}"`}function zw(e,t){let n=new Map;for(let e of Object.keys(t)){let t=hu(e),r=n.get(t);r?r.push(e):n.set(t,[e])}for(let[t,r]of n)r.length<2||e.issues.push({path:`presets`,message:`preset names ${r.map(e=>JSON.stringify(e)).join(` and `)} both collapse to the same synthesis identifier "${t}" — edit mode's synthesized reset affordance would silently steal one preset's action for the other. Rename one.`,line:U(e.source,[`presets`])})}function Bw(e,t,n){let r=[[[`globals`],t.globals.style],[[`editGlobals`],t.editGlobals.style],...Object.entries(t.presets).map(([e,t])=>[[`presets`,e,`globals`],t.globals?.style])];for(let[n,i]of r){if(i===void 0||ro(i)||Object.prototype.hasOwnProperty.call(t.styles,i))continue;let r=`${n.join(`.`)}.style`;e.issues.push({path:r,message:fo(i)?kw(r,i,`${n.join(`.`)}.endcaps`):`${r} "${i}" does not match any declared style (have: ${Object.keys(t.styles).join(`, `)})`,line:U(e.source,[...n,`style`])})}t.globals.preset!==void 0&&!Object.prototype.hasOwnProperty.call(t.presets,t.globals.preset)&&e.issues.push({path:`globals.preset`,message:`globals.preset "${t.globals.preset}" does not match any declared preset (have: ${Object.keys(t.presets).join(`, `)})`,line:U(e.source,[`globals`,`preset`])}),zw(e,t.presets);let i=Yb(t);for(let[n,r]of Object.entries(t.actions))`set`in r&&kb.has(r.set)&&e.issues.push({path:`actions.${n}.set`,message:`actions.${n} sets "${r.set}", which has no session pick — globals.${r.set} is set in the config file only, so a click would change nothing; write it with { persist: "${r.set}", … } instead`,line:U(e.source,[`actions`,n,`set`])}),!(!(`set`in r)||!(`from`in r)||typeof r.from!=`string`)&&(Xb(i).includes(r.from)||e.issues.push({path:`actions.${n}.from`,message:`actions.${n} from: references unknown option domain "${r.from}" (have: ${Xb(i).join(`, `)})`,line:U(e.source,[`actions`,n,`from`])}));for(let[n,r]of Object.entries(t.actions))`do`in r&&r.do.forEach((i,a)=>{let o=Object.prototype.hasOwnProperty.call(t.actions,i)?t.actions[i]:void 0,s=o===void 0?`references unknown action "${i}"`:`do`in o?`"${i}" is itself a do action — list its members here instead`:r.do.indexOf(i)===a?a>0&&BC(o)?`"${i}" takes its value from the template (from/int/insertSegmentFrom), so it can only be the first member — only the first is bound the region's display`:void 0:`"${i}" is listed twice — each member fires once per click`;s!==void 0&&e.issues.push({path:`actions.${n}.do`,message:`actions.${n} do: ${s}`,line:U(e.source,[`actions`,n,`do`])})});for(let[n,r]of Object.entries(t.actions)){let i=`persist`in r?r.persist:`reset`in r?r.reset:null;if(i===null)continue;let a=`persist`in r?`persist`:`reset`,o=ox(i);if(o===null){e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" is not a config globals field (have: ${Dl().join(`, `)}), a "segments.<name>.palette" target, a "presets.<name>.globals.<field>" target, or a "presets.<name>.root" target`,line:U(e.source,[`actions`,n,a])});continue}let s=Vw.filter(e=>e in r);if(o.scope!==`preset-root`&&s.length>0){e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" is not a "presets.<name>.root" target — ${s.map(e=>`"${e}"`).join(`/`)} is a tree op and applies only to one`,line:U(e.source,[`actions`,n,a])});continue}if(o.scope===`preset-root`){Hw(e,t,n,a,i,o.preset,r);continue}if(o.scope===`preset-globals`&&!C_(t.presets).includes(o.preset)){e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" names preset "${o.preset}" which is not declared (have: ${C_(t.presets).join(`, `)})`,line:U(e.source,[`actions`,n,a])});continue}if(o.scope===`segment-palette`){if(!Object.prototype.hasOwnProperty.call(t.segments,o.segment)){e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" names segment "${o.segment}" which is not declared (have segments: ${Object.keys(t.segments).join(`, `)})${wu(o.segment)}`,line:U(e.source,[`actions`,n,a])});continue}`min`in r&&e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" is a segment palette target and cannot use a bounded stepper (min/max/by) — use "to", "from", or "cycle" instead`,line:U(e.source,[`actions`,n,a])})}}let a=yv(t);for(let t of a.names)t!==`settings`&&!t.startsWith(Uw)||e.issues.push({path:`variables`,message:`variable "${t}" is named under "settings", which a segment's templates read as its placement's own settings (.settings.<name>) — rename it`,line:U(e.source,[`variables`,t])});let o=(t,n,r)=>{GS(t)>1&&e.issues.push({path:n,message:`${n} places the global settings menu anchor "${Hx}" ${GS(t)} times — it may appear at most once per layout (it is one disclosure, and one state key holds one open state). Remove all but the placement you want; removing every placement puts the menu at its default position.`,line:r}),KS(t)&&e.issues.push({path:n,message:`${n} places the global settings menu anchor "${Hx}" under a \`when\` or inside a disclosure body — the menu is visible under every condition, so its placement may not be gated. Move it to an ungated position, or remove it to put the menu at its default position.`,line:r}),s(t)&&e.issues.push({path:n,message:`${n} sets "distribution" on a container inside a bar cell — everything inside a cell wears that cell's hue and tone, so it would place nothing. Set it on the row whose children are the cells (the horizontal container) or on the root, which places the rows.`,line:r});let i=new Map;for(let e of js(t)){if(e.kind!==`segment`)continue;let t=Ds(e);i.set(t,[...i.get(t)??[],e])}for(let[t,a]of i){if(a.length<2)continue;let o=a[1].name,s=ks(o,new Set(i.keys()));e.issues.push({path:n,message:`${n} has ${a.length} placements with the id "${t}" — an id names one placement (its settings, its menus' open state, and edit mode all address it), so give each its own: { seg: "${o}", id: "${s}" }. A placement without an "id" takes its segment's name.`,line:r})}};function s(e,t=!1){return e.kind===`segment`?!1:t&&e.distribution!==void 0||e.children.some(n=>s(n,t||Es[e.direction]===`cell`))}let c=(n,r)=>{for(let[i,o]of Fc(n,r)){let n=U(e.source,o.split(`.`));if(i.when!==void 0&&(tT(e,`${o}.when`,i.when,a,{line:n}),eT(e,`${o}.when`,i.when,n)),i.kind===`segment`){if(HS(i.name)){(i.id!==void 0||i.settings!==void 0)&&e.issues.push({path:o,message:`${r} gives the global settings menu anchor "${Hx}" an id or settings — the anchor only marks where the menu goes, so place it as the bare name "${Hx}"`,line:n});continue}Object.prototype.hasOwnProperty.call(t.segments,i.name)||e.issues.push({path:o,message:`${r} entry "${i.name}" does not match any declared segment${wu(i.name)}`,line:n}),Zw(e,t,i,o,n)}}};n.root!==void 0&&c(n.root,`root`);for(let[e,t]of Object.entries(n.presets??{}))t.root!==void 0&&c(t.root,`presets.${e}.root`);let l=new Map([[`root`,Nc(t.root)]]);for(let e of C_(t.presets)){let{node:n,path:r}=E_(t,e);l.set(r,n)}for(let[t,n]of l)o(n,t,U(e.source,t.split(`.`)));for(let[n,r]of Object.entries(t.variables)){Qw(e,`variables.${n}`,r,a);let t=Lw(n);t!==void 0&&e.issues.push({path:`variables.${n}`,message:t,line:U(e.source,[`variables`,n])})}for(let[n,r]of Object.entries(t.segments)){if(r.vars)for(let[t,i]of Object.entries(r.vars))Qw(e,`segments.${n}.vars.${t}`,i,a,n);let i=Hs(r);Gw(e,n,i);let o=Ww(a,i);for(let a of[`template`,`bg`,`fg`,`when`]){let s=r[a];if(typeof s==`string`){tT(e,`segments.${n}.${a}`,s,o,{segCtx:n,settings:i});for(let{name:r,site:i,via:o}of _v(s,t.helpers)){if(Object.prototype.hasOwnProperty.call(t.actions,r))continue;let s=i===`options`?` (in a picker, menu or carousel)`:``;if(o!==null){nT(e,o,`Template references unknown action "${r}"${s}`);continue}e.issues.push({path:`segments.${n}.${a}`,message:`${a} references unknown action "${r}"${s}`,line:U(e.source,[`segments`,n,a])})}}}}for(let[n,r]of Object.entries(t.variables))$w(e,`variables.${n}`,r,a);for(let[n,r]of Object.entries(t.segments))if(r.vars)for(let[t,i]of Object.entries(r.vars))$w(e,`segments.${n}.vars.${t}`,i,a,n)}const Vw=[`removeSegment`,`insertSegment`,`insertSegmentFrom`];function Hw(e,t,n,r,i,a,o){let s=`actions.${n}.${r}`,c=U(e.source,[`actions`,n,r]);if(!C_(t.presets).includes(a)){e.issues.push({path:s,message:`actions.${n}: "${i}" names preset "${a}" which is not declared (have: ${C_(t.presets).join(`, `)})`,line:c});return}if(r===`reset`)return;let l=`removeSegment`in o,u=`insertSegment`in o,d=`insertSegmentFrom`in o;if(!l&&!u&&!d){e.issues.push({path:s,message:`actions.${n}: "${i}" is a "presets.<name>.root" target and can only be paired with "removeSegment", "insertSegment", or "insertSegmentFrom" (not "to"/"from"/"cycle"/bounded — those have no meaning as a tree op)`,line:c});return}let f=(r,i)=>{Object.prototype.hasOwnProperty.call(t.segments,i)||e.issues.push({path:s,message:`actions.${n}: ${r} "${i}" is not a declared segment (have: ${Object.keys(t.segments).join(`, `)})${wu(i)}`,line:c})},p=new Set(Os(E_(t,a).node)),m=(r,i)=>{!Cu.has(i)||p.has(i)||Object.prototype.hasOwnProperty.call(t.segments,i)||e.issues.push({path:s,message:`actions.${n}: ${r} "${i}" names no placement${wu(i)}`,line:c})};`removeSegment`in o&&m(`removeSegment`,o.removeSegment),`insertSegment`in o&&f(`insertSegment`,o.insertSegment),(`insertSegment`in o||`insertSegmentFrom`in o)&&m(`anchor`,o.anchor)}const Uw=`settings.`;function Ww(e,t){return{...e,names:new Set([...e.names,...Object.keys(t).map(e=>Uw+e)])}}function Gw(e,t,n){let r=e=>`segments.${t}.settings.${e}`,i=(n,i)=>{e.issues.push({path:r(n),message:`${r(n)}: ${i}`,line:U(e.source,[`segments`,t,`settings`,n])})},a=Jw(n);for(let{setting:e,message:t}of a)i(e,t);if(!(a.length>0))for(let{setting:e,message:t}of Ws(n,qw(n)))i(e,`the defaults do not stand together: ${t}`)}function Kw(e){return Jw(e).length>0||Ws(e,qw(e)).length>0}function qw(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.default]))}function Jw(e){let t=t=>Us(Yw(e,t))?.atLeast;return Object.keys(e).flatMap(n=>{let r=t(n);if(r===void 0)return[];if(r===n||Us(Yw(e,r))===void 0)return[{setting:n,message:`atLeast "${r}" must name another range setting of this segment (its range settings: ${Xw(e,n).join(`, `)||`none`})`}];let i=[n];for(let e=r;e!==void 0;e=t(e)){if(e===n)return i.every(e=>n<=e)?[{setting:n,message:`atLeast closes a cycle (${[...i,n].join(` ≥ `)}) — every setting on it could only ever equal the rest`}]:[];if(i.includes(e))return[];i.push(e)}return[]})}function Yw(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Xw(e,t){return Object.entries(e).filter(([e,n])=>e!==t&&Us(n)!==void 0).map(([e])=>e)}function Zw(e,t,n,r,i){let a=Object.prototype.hasOwnProperty.call(t.segments,n.name)?t.segments[n.name]:void 0;if(a===void 0)return;let o=Hs(a),s=`${r}: placement "${Ds(n)}" of segment "${n.name}"`;for(let[t,a]of Object.entries(n.settings??{})){let c=Object.prototype.hasOwnProperty.call(o,t)?o[t]:void 0,l=c===void 0?`sets "${t}", which segment "${n.name}" does not declare (it has: ${Object.keys(o).join(`, `)})`:Gs(c,a)?void 0:`sets "${t}" to ${JSON.stringify(a)}${c.domain===`theme`?Ja(a):``}, but it must be ${Js(c)}`;l!==void 0&&e.issues.push({path:r,message:`${s} ${l}`,line:i})}let c=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,n.settings?.[e]??t.default]));if(!(!Object.entries(c).every(([e,t])=>Gs(o[e],t))||Kw(o)))for(let{message:t}of Ws(o,c))e.issues.push({path:r,message:`${s}: ${t}`,line:i})}function Qw(e,t,n,r,i){n.kind===`template`&&tT(e,`${t}.template`,n.template,r,{segCtx:i}),Rs(n)&&n.cache&&`key`in n.cache&&tT(e,`${t}.cache.key`,n.cache.key,r,{segCtx:i})}function $w(e,t,n,r,i){if(Rs(n)&&n.cache&&`depends_on`in n.cache)for(let a=0;a<n.cache.depends_on.length;a++){let o=n.cache.depends_on[a];if(r.names.has(o))continue;let s=i===void 0?void 0:`${i}.${o}`,c=s!==void 0&&r.names.has(s)?` (segment-local vars are namespaced — write "${s}")`:``;e.issues.push({path:`${t}.cache.depends_on[${a}]`,message:`cache.depends_on references unknown variable "${o}"${c}`,line:U(e.source,[...t.split(`.`),`cache`,`depends_on`])})}}function eT(e,t,n,r){try{B_.parse(n)}catch(n){e.issues.push({path:t,message:`Template parse error in ${t}: ${n.message}`,line:r})}}function tT(e,t,n,r,i){for(let[a,o]of pv(n,r.helpers)){if(vv(a,r))continue;if(a.startsWith(Uw)){let n=o===null?``:` through helper "${o}"`,r=a.slice(9),s=i?.segCtx===void 0||i.settings===void 0?`Template reads ".${a}"${n}, but only a segment's own templates have settings — call it from a segment that declares "${r}"`:`Template reads ".${a}"${n}, but segment "${i.segCtx}" has no setting "${r}" (it has: ${Object.keys(i.settings).join(`, `)}) — declare it under segments.${i.segCtx}.settings`;e.issues.push({path:t,message:s,line:i?.line??U(e.source,t.split(`.`))});continue}if(o!==null){nT(e,o,`Template references unknown variable ".${a}"${Rw(a)}`);continue}let n=i?.segCtx===void 0?void 0:`${i.segCtx}.${a}`,s=n!==void 0&&vv(n,r)?` (segment-local vars are namespaced — write ".${n}")`:Rw(a);e.issues.push({path:t,message:`Template references unknown variable ".${a}"${s}`,line:i?.line??U(e.source,t.split(`.`))})}}function nT(e,t,n){let r=`helpers.${t}`;e.issues.some(e=>e.path===r&&e.message===n)||e.issues.push({path:r,message:n,line:U(e.source,[`helpers`,t])})}function rT(e,t){let{graph:n,nodeInfo:r}=iT(t),i=new Map,a=[];for(let e of n.keys())i.set(e,0);for(let e of n.keys())if(i.get(e)===0&&o(e))return;function o(t){i.set(t,1),a.push(t);for(let s of n.get(t)??[]){let t=i.get(s);if(t===1){let t=a.indexOf(s),n=[...a.slice(t),s],i=n[0],o=r.get(i);return e.issues.push({path:o?.declarationPath??`variables.${i}`,message:`Dependency cycle: ${n.join(` → `)}`,line:U(e.source,o?.linePathParts??[`variables`,i])}),!0}if(t===0&&o(s))return!0}return i.set(t,2),a.pop(),!1}}function iT(e){let t=new Set(Object.keys(e.variables)),n=new Map;for(let t of Object.keys(e.variables))n.set(t,{declarationPath:`variables.${t}`,linePathParts:[`variables`,t]});for(let[r,i]of Object.entries(e.segments))if(i.vars)for(let e of Object.keys(i.vars)){let i=`${r}.${e}`;t.add(i),n.set(i,{declarationPath:`segments.${r}.vars.${e}`,linePathParts:[`segments`,r,`vars`,e]})}let r=new Map;for(let e of t)r.set(e,new Set);let i=(n,i)=>{for(let a of pv(i,e.helpers).keys()){if(t.has(a)){r.get(n).add(a);continue}let e=a.split(`.`)[0];e!==a&&t.has(e)&&r.get(n).add(e)}},a=(e,n)=>{if(n.kind===`template`&&i(e,n.template),Rs(n)&&(n.cache&&`key`in n.cache&&i(e,n.cache.key),n.cache&&`depends_on`in n.cache))for(let i of n.cache.depends_on)t.has(i)&&r.get(e).add(i)};for(let[t,n]of Object.entries(e.variables))a(t,n);for(let[t,n]of Object.entries(e.segments))if(n.vars)for(let[e,r]of Object.entries(n.vars))a(`${t}.${e}`,r);return{graph:r,nodeInfo:n}}const aT=[`json5`,`json`];function oT(e){try{return r.statSync(e,{throwIfNoEntry:!1})===void 0?`absent`:`present`}catch(t){return{path:e,error:t.message}}}function sT(e){return e===`~`||e.startsWith(`~/`)||e.startsWith(`~\\`)?m.homedir()+e.slice(1):e}function cT(e,t,n){if(n!==void 0)return[n];let r=t??process.cwd();return[...new Set([...e?aT.map(t=>c.join(e,`.cc-candybar.${t}`)):[],...aT.map(e=>c.join(r,`.cc-candybar.${e}`)),...aT.map(e=>`${lT()}.${e}`)])]}function lT(){let e=process.env.XDG_CONFIG_HOME??c.join(m.homedir(),`.config`);return c.join(e,`cc-candybar`,`config`)}function uT(e,t,n){let r=[];for(let i of cT(e,t,n)){let e=oT(i);if(e===`present`)return{kind:`file`,path:i,unchecked:r};e!==`absent`&&r.push(e)}if(n===void 0)return{kind:`default`,unchecked:r};let[i]=r;return i===void 0?{kind:`missing`,path:n}:{kind:`unreadable`,...i}}function dT(e,t,n){let r=uT(e,t,n);return r.kind===`default`?`${lT()}.${aT[0]}`:r.path}function fT(e){return pT(e).join(`
159
- `)||null}function pT(e){switch(e.kind){case`file`:case`default`:return e.unchecked.map(e=>`Config location could not be checked: ${e.path} — ${e.error}`);case`missing`:return[`Config file not found: ${e.path} — rendering the bundled default until it appears`];case`unreadable`:return[`Config file could not be read: ${e.path} — ${e.error} — rendering the bundled default until it can be`]}}function mT(e,t){let n=cT(e,t).filter(e=>oT(e)===`present`),r=new Map;for(let e of n){let t=c.dirname(e),n=c.basename(e).replace(/\.(json5|json)$/,``),i=c.join(t,n);r.has(i)||r.set(i,[]),r.get(i).push(e)}let i=[...r.values()].filter(e=>e.length>1);return i.length===0?null:`config-extension collision: ${i.map(e=>{let[t,...n]=e;return`${t} shadows ${n.join(`, `)}`}).join(`; `)} — remove the duplicate`}function hT(e,t,n){return e===null?{..._T,config:Rc(_T.raw,t)}:gT(e,r.readFileSync(e,`utf-8`),t,n)}function gT(e,t,n,r){let i={source:t,...bT(e,t,r,Ru(n))};return{...i,config:Rc(i.raw,n)}}const _T={raw:{},source:``,warnings:[]};function vT({config:e,raw:t,source:n},r=`<config>`,i=new Set(Za())){let a=[],o={source:n,issues:a,allowedPalettes:i,groups:[]};if(Bw(o,e,t),rT(o,e),a.length>0)throw new bs(r,a);let s=z_(e,a);if(a.length>0)throw new bs(r,a);return LC(iC(s))}function yT(e,t,n=new Set(Za()),r=xT){return bT(e,t,n,r).raw}function bT(e,t,n,r){let i=ST(e,t),a=Cs(e,t),o=a===null?[]:[a],s=[],c={source:t,issues:s,allowedPalettes:n??new Set(Za()),groups:[]};if(!nc(i))throw new bs(e,[{path:``,message:`Config root must be an object, got ${W(i)}`}],o);let l=CT(c,i,r);if(s.length>0)throw new bs(e,s,o);return{raw:l,warnings:o}}const xT=new Set;function ST(e,t){try{return et.default.parse(t)}catch(t){let n=t;throw new bs(e,[{path:``,message:`JSON5 syntax error: ${n.message}`,line:n.lineNumber,col:n.columnNumber}])}}function CT(e,t,n){for(let n of Object.keys(t))wT.has(n)||e.issues.push({path:n,message:`Unknown top-level key "${n}". Expected one of: ${[...wT].join(`, `)}`,line:U(e.source,[n])});let r={};return t.globals!==void 0&&(r.globals=xl(e,`globals`,t.globals)),t.variables!==void 0&&(r.variables=Vl(e,`variables`,t.variables)),t.segments!==void 0&&(r.segments=zu(e,t.segments,n)),t.layout!==void 0&&e.issues.push({path:`layout`,message:`"layout" is no longer supported — use "root" with the A-grammar instead.
158
+ `,xx=`readableOn (mix (color "foreground") (bgOf) 60) (bgOf) 3`,Sx={socket:`TMUX`,pane:`TMUX_PANE`,truecolor:`CLAUDE_CODE_TMUX_TRUECOLOR`};function Cx(e){let t=e[Sx.socket]??``,n=e[Sx.pane]??``;if(t===``||n===``)return null;let r=e[Sx.truecolor]??``;return{socket:t.split(`,`)[0],pane:n,truecolor:r===``?null:r}}const wx=Sx.truecolor,Tx=[{name:`tmuxTruecolor`,label:`tmux truecolor`,probe:({tmux:e,claudeSettings:t})=>{switch(e.kind){case`unreported`:return{ok:!1,reason:"the client reported no tmux facts — re-run `cc-candybar install` to stage a current client"};case`outside`:return{ok:!0};case`inside`:{if(e.termfeatures.kind===`failed`)return{ok:!1,reason:`tmux could not be asked: ${e.termfeatures.reason}`};if(!e.termfeatures.value.includes(`RGB`)||e.hint.truecolor!==null)return{ok:!0};let n=t.env[wx];return typeof n==`string`&&n!==``?{ok:!1,reason:`${wx} is set in ${t.path} — restart Claude Code to apply`}:{ok:!1,reason:`Claude Code renders the bar in 256 colours inside tmux`,fix:{kind:`claude-settings-env`,name:wx,value:`1`}}}}}}];function Ex(e){return Tx.map(t=>({check:t,verdict:t.probe(e)}))}function Dx(e){return Tx.find(t=>t.name===e)}const Ox=`${yu}doctor.`;function kx(e){let t=`${Ox}${e}.`;return{verdict:`${t}verdict`,reason:`${t}reason`,fixable:`${t}fixable`}}function Ax(e){return e.flatMap(({check:e,verdict:t})=>{let n=kx(e.name);return t.ok?[{key:n.verdict,value:`ok`},{key:n.reason,value:``},{key:n.fixable,value:bo}]:[{key:n.verdict,value:`failed`},{key:n.reason,value:t.reason},{key:n.fixable,value:t.fix===void 0?bo:yo}]})}const jx={copySession:{copy:`{{ .session.id }}`},copyResume:{copy:`{{ .resume_command }}`},openProject:{open:`{{ .project_dir }}`},openTranscript:{open:`{{ .transcript_path }}`},openConfig:{open:`{{ .config_path }}`}};function Mx(e){let t=t=>`${e}${t}`;return{template:`{{ action "${t(`copySession`)}" "⎘ id" }}{{ if ne .resume_command "" }} {{ action "${t(`copyResume`)}" "⎘ resume" }}{{ end }} {{ action "${t(`openProject`)}" "↗ proj" }} {{ action "${t(`openTranscript`)}" "↗ log" }}{{ if ne .git.repoUrl "" }} {{ link .git.repoUrl "↗ repo" }}{{ end }}{{ if ne .config_path "" }} {{ action "${t(`openConfig`)}" "↗ config" }}{{ end }}`,actions:Object.fromEntries(Object.entries(jx).map(([t,n])=>[`${e}${t}`,n]))}}const Nx=`armed`,Px=`disarmed`,Fx=`.armed`,Ix=e=>e.endsWith(Fx);function Lx(e,t,n){let r=`${e}${Fx}`,i=`${e}.arm`,a=`${e}.disarm`,o=`(eq .${e} "${Nx}")`;return{template:`{{ if ${o} }}{{ action "${e}" "${t.confirm}" }} {{ action "${a}" "✕" }}{{ else }}{{ action "${i}" "${t.arm}" }}{{ end }}`,actions:{[i]:{set:r,to:Nx},[a]:{set:r,to:Px},[e]:{do:[a,...n]}},armed:o,variables:{[e]:{kind:`state`,key:r,default:Px}},disarm:a}}const Rx=RegExp(`^/[^\\s\\x00-\\x1f\\x7f-\\x9f/][^\\x00-\\x1f\\x7f-\\x9f]*$`);function zx(e){return typeof e==`string`&&Rx.test(e)?{kind:`line`,line:e}:{kind:`refused`,reason:`a slash command is "/" then its name, e.g. "/compact" or "/model opus", on one line with no control characters, got ${JSON.stringify(e)}`}}function Bx(e){let t=zx(e);if(t.kind===`refused`)throw Error(t.reason);return t.line}const Vx=[`/compact`,`/model`],Hx=`/clear`;function Ux(e){let t=t=>`${e}${t.slice(1)}`,n=`${e}clear.slash`,r=Lx(`${e}clear`,{arm:Hx,confirm:`${Hx} ✓ confirm`},[n]);return{template:Vx.map(e=>`{{ action "${t(e)}" "${e}" }} `).join(``)+r.template,actions:{...Object.fromEntries(Vx.map(e=>[t(e),{slash:Bx(e)}])),...r.actions,[n]:{slash:Bx(Hx)}},variables:r.variables,disarm:r.disarm}}const Wx=`${yu}menu`,Gx=`open`,Kx=`${yu}edit`,qx=`${yu}toolbar`,Jx=Mx(yu),Yx=`${yu}commands`,Xx=Ux(`${Yx}.`),Zx=`${yu}tab`,Qx=[{member:`session`,label:`⚡ session`},{member:`look`,label:`🎨 look`},{member:`layout`,label:`📐 layout`},{member:`config`,label:`⚙ config`},{member:`tools`,label:`🧰 tools`}],$x=e=>`${Zx}.${e}`,eS=e=>`${$x(e)}.toggle`,tS=e=>({variable:Zx,key:Zx,member:e}),nS=`${yu}save`,rS=`${yu}preset.save`,iS=`${yu}preset.delete`,aS=`${yu}resetAll`,oS=`${Wx}.toggle`,sS={variable:Wx,key:Wx,member:Gx},cS=`${yu}undo`,lS=`${yu}back`,uS=`${lS}.step`,dS=`${yu}navigation.back`,fS=lS,pS={template:`{{ if gt .${dS} 0 }}{{ action "${lS}" "◁" }}{{ else }}{{ fg (${xx}) "◁" }}{{ end }}`},mS=`${yu}redo`,hS=`${yu}doctor`,gS=`${hS}.run`,_S=e=>`${hS}.fix.${e}`,vS=e=>`${hS}.${e}`,yS=`${yu}pickers`,bS=[{template:`{{ themePreview }}`}],xS={template:`{{ layoutPreview }}`},SS={preset:[xS,{when:`{{ not .preset.bundled }}`,template:`{{ action "${iS}" (printf "🗑 delete %s" .${Db.preset.effectiveVar}) }}`}],theme:bS,style:bS,variation:[xS]},CS=e=>`${yu}${e}`,wS=e=>`${yu}apply.${e}`,TS=e=>`${yu}reset.${e}`,ES=e=>`${yu}carousel.${e}`,DS=(e,t)=>`${ES(e)}.${t}`,OS=e=>`${yu}resettable.${e}`,kS=e=>e.length===0?`false`:`(or ${e.map(e=>`.${OS(e)}`).join(` `)})`,AS=Object.keys(Db).map(e=>{let t=Db[e],n=ul(t.configKey);if(n===`text`)throw Error(`settings menu: globals.${t.configKey} is free text, which no control can change — list it in UNCONTROLLED_GLOBALS instead of SETTINGS`);let r=nx({label:t.label,domain:n},t.sessionKey,t.effectiveVar,wS(e));return{...t,name:e,control:r,beneath:SS[e]??[]}}),jS={preset:`door`,theme:`look`,style:`look`,variation:`look`,endcaps:`look`,autoWrap:`layout`,padding:`layout`,updateNotice:`config`},MS=e=>AS.filter(t=>jS[t.name]===e),NS=e=>MS(e).map(qS);new Set(AS.flatMap(e=>[e.sessionKey,e.configKey]));const PS=Lx(aS,{arm:`⟲`,confirm:`⟲ reset all?`},AS.map(e=>TS(e.name))),FS=[`unsaved`,`history.undo`,`history.redo`],IS=e=>`${yu}${e}`,LS=IS(`unsaved`),RS=(e,t)=>({body:t,shown:`(gt .${IS(e)} 0)`}),zS=[RS(`unsaved`,`{{ action "${nS}" (printf "💾 save %d" .${LS}) }}`),RS(`history.undo`,`{{ action "${cS}" "↶" }}`),RS(`history.redo`,`{{ action "${mS}" "↷" }}`),{body:PS.template,shown:`(or ${kS(AS.map(e=>e.name))} ${PS.armed})`}],BS={when:`{{ or ${zS.map(e=>e.shown).join(` `)} }}`,template:`{{ $sep := "" }}`+zS.map(e=>`{{ if ${e.shown} }}{{ $sep }}${e.body}{{ $sep = " " }}{{ end }}`).join(``)},VS=[{step:PS,place:`door`},{step:Xx,place:`session`}],HS=e=>e.map(e=>e.step.disarm),US=HS(VS),WS=HS(VS.filter(e=>e.place!==`door`)),GS=h_(yS),KS=e=>({variable:GS,key:GS,member:p_(wS(e))});function qS(e){let t=CS(e.name);return e.control.kind===`inline`?{kind:`segment`,name:t}:Kc(t,KS(e.name),{kind:`container`,direction:`vertical`,children:[{kind:`segment`,name:ES(e.name)},...e.beneath.map((t,n)=>({kind:`segment`,name:DS(e.name,n)}))]},`drop`)}function JS(e){return e===Wx}function YS(e){let t={kind:`segment`,name:Wx};if(e.kind===`container`&&e.direction===`vertical`){let[n,...r]=e.children;return e.when===void 0&&n!==void 0?{...e,children:[YS(n),...r]}:{kind:`container`,direction:`vertical`,children:[t,e]}}return e.kind===`container`&&e.when===void 0?{...e,children:[t,...e.children]}:{kind:`container`,direction:`horizontal`,children:[t,e]}}function XS(e){return ZS(e)>0?e:YS(e)}function ZS(e){let t=0;for(let n of ks(e))n.kind===`segment`&&JS(n.name)&&(t+=1);return t}function QS(e,t=!1){let n=t||e.when!==void 0;return e.kind===`segment`?n&&JS(e.name)||e.opens!==void 0&&QS(e.opens.body,!0):e.children.some(e=>QS(e,n))}const $S={session:{direction:`vertical`,segments:[qx,Yx]},look:{direction:`horizontal`,segments:[]},layout:{direction:`horizontal`,segments:[rS,Kx]},config:{direction:`horizontal`,segments:[]},tools:{direction:`vertical`,segments:[hS,...Tx.map(e=>vS(e.name))]}},eC=e=>({kind:`container`,direction:$S[e].direction,children:[...$S[e].segments.map(e=>({kind:`segment`,name:e})),...NS(e)]});function tC(e){return e.kind===`segment`?JS(e.name)?Kc(e.name,sS,rC,`above`):e:aC(e)}function nC(){return{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:fS},...NS(`door`),{kind:`segment`,name:nS}]},{kind:`container`,direction:`horizontal`,children:Qx.map(({member:e})=>Kc($x(e),tS(e),eC(e),`drop`))}]}}const rC=nC();function iC(e){let t=new Map;for(let e of ks(rC))e.kind===`segment`&&e.opens!==void 0&&t.set(e.opens.ref.key,e.opens.ref.variable);return[...t].map(([t,n])=>{let r=e.variables[n];if(r?.kind!==`state`||r.default===void 0)throw Error(`settings menu: the door folds "${t}", but "${n}" is not a state variable the menu declares with a default`);let i=`${Wx}.fold.${hu(t)}`;return e.actions[i]={set:t,to:r.default},i})}function aC(e){return{...e,children:e.children.map(e=>tC(e))}}function oC(e){let t={variables:{[Wx]:Qc(Wx,Vc)},actions:{[oS]:$c(Wx,Gx),[gS]:{doctor:`run`},[Kx]:{do:[...K_]},...Jx.actions,...Xx.actions,[nS]:{save:!0},[cS]:{undo:!0},[uS]:{back:!0},[lS]:{do:[uS,...US]},[mS]:{redo:!0},[rS]:{preset:`save`},[iS]:{preset:`delete`,name:`{{ .${Db.preset.effectiveVar} }}`}},segments:{[Wx]:{template:`{{ $door := ${Xc(Wx,Zc(e),Zc(`✖`))} }}{{ if ${Jc(sS)} }}{{ fg (color "error") $door }}{{ else }}{{ $door }}{{ end }}`},[qx]:{template:Jx.template},[Yx]:{template:Xx.template},[fS]:pS,[nS]:BS,[rS]:{template:`{{ action "${rS}" "+ preset" }}`},[hS]:{template:`{{ action "${gS}" "🩺 doctor" }}`},[Kx]:{template:`{{ action "${Kx}" "✎ arrange" "✎ done" }}`}}};t.variables[dS]={kind:`input`,path:`navigation.back`,type:`number`,default:0};for(let e of FS)t.variables[IS(e)]={kind:`input`,path:e,type:`number`,default:0};t.variables[Zx]=Qc(Zx,`session`);for(let{member:e,label:n}of Qx){t.actions[eS(e)]=$c(Zx,e),t.actions[$x(e)]={do:[eS(e),...WS]};let r=kS(MS(e).map(e=>e.name)),i=`(ternary ${Zc(` •`)} "" ${r})`,a=e=>`(print ${Zc(e)} ${i})`;t.segments[$x(e)]={template:`{{ ${Xc($x(e),a(n),a(`▾ ${n}`))} }}`}}return Object.assign(t.variables,Xx.variables,PS.variables),cC(t),sC(t),t.actions[Wx]={do:[oS,...US,...iC(t)]},t}function sC(e){for(let t of Tx){let n=kx(t.name),r=_S(t.name);for(let t of Object.values(n))e.variables[t]={kind:`state`,key:t,default:``};e.actions[r]={doctor:`fix`,check:t.name},e.segments[vS(t.name)]={when:`{{ ne .${n.verdict} "" }}`,template:`{{ if eq .${n.verdict} "ok" }}✓ ${t.label}{{ else }}✗ ${t.label} — {{ .${n.reason} }}{{ if eq .${n.fixable} "${yo}" }} {{ action "${r}" "[fix]" }}{{ end }}{{ end }}`}}}function cC(e){for(let t of AS){Object.assign(e.actions,t.control.actions);let n=TS(t.name);e.actions[n]={reset:t.configKey},e.variables[OS(t.name)]={kind:`input`,path:`resettable.${t.name}`,type:`boolean`,default:!1};let r=`{{ if .${OS(t.name)} }} {{ action "${n}" "↺" }}{{ end }}`;if(t.control.kind===`inline`){e.segments[CS(t.name)]={template:`${t.control.template}${r}`};continue}let i=KS(t.name),a=g_(i.key,i.member);e.variables[i.key]=Qc(i.key,Vc),e.actions[a]=$c(i.key,i.member),e.segments[CS(t.name)]={template:`${t.label} {{ .${t.effectiveVar} }} `+Yc(a,`▸`,`▾`)+r},e.segments[ES(t.name)]={template:t.control.template},t.beneath.forEach((n,r)=>{e.segments[DS(t.name,r)]=n})}Object.assign(e.actions,PS.actions)}function lC(e){let{variables:t,actions:n}=tv();Object.assign(e.variables,t),Object.assign(e.actions,n)}function uC(e){let t=oC(e.globals.menuGlyph??`🍫`);lC(t);let n={...e.presets},r=[];for(let t of w_(e.presets)){let{node:i}=D_(e,t),a=tC(XS(i));r.push(a),n[t]={...E_(e.presets,t),root:a}}let i=Ib(t,r,e);return{...e,variables:{...i,...e.variables,...t.variables},actions:{...e.actions,...t.actions},segments:{...e.segments,...t.segments},presets:n}}const dC=`${vu}live`,fC=[`☐ live`,`☑ live`],pC=`${vu}done`,mC=`${vu}cancel`,hC=`${vu}rewind`,gC=`${vu}changes`,_C=`(gt .${gC} 0)`,vC=`(or ${_C} (gt .${LS} 0))`,yC={variable:dC,key:dC,member:`open`};function bC(e){return`${vu}configuring.p${e}`}function xC(e){return`and ${Jc(X_)} (not ${Jc(yC)}) (ne .${bC(e)} "true")`}function SC(e){return{kind:`template`,template:`{{ or ${e.map(e=>`(eq .${U_} "${Gc(e)}")`).join(` `)} false }}`}}function CC(e,t,n){return`{{ if ${xC(e)} }}${t}{{ else }}${n}{{ end }}`}const wC=`{{ and ${Jc(X_)} .preset.customized }}`,TC=xu,EC=`${vu}addable`;function DC(e){return new Map([[EC,{members:Object.keys(e.segments).filter(e=>!TC(e)),library:{groups:pu.map(e=>({id:e,label:mu[e]})),entry:t=>{let n=e.segments[t];return{group:n.group??`other`,...n.description!==void 0&&{description:n.description}}}}}]])}function OC(e,t,n){return n.segments[e]={template:t,when:Z_,bg:px},{kind:`segment`,name:e}}function kC(e,t,n){let r=`${vu}${e.presetIdent}.remove.${t}`;return e.artifacts.actions[r]={persist:e.rootKey,removeSegment:n},`{{ fg (${`readableOn (color "error") (bgOf) ${Ea}`}) (action "${r}" "✖") }}`}function AC(e){return`{{ if ${Jc(X_)} }}${e}{{ end }}`}function jC(e,t){return e.reduce((e,t)=>`{{ if and ${Jc(X_)} ${Jc(t)} }}true{{ else }}${e}{{ end }}`,t)}function MC(e){return e.flatMap(e=>[...ks(e)].flatMap(e=>e.kind===`segment`&&e.opens?.ref.key===`edit.configure`?[e.opens.ref]:[]))}function NC(e,t,n){return`${J_}${e}.${t}.${n}`}function PC(e,t,n,r){let i=Ts(n),a=`${vu}${e.presetIdent}`,o=Y_(e.presetIdent,i);e.configured.push(o);let s=`${a}.configure.${t}`;e.artifacts.actions[s]={set:U_,to:o};let c={},l=Object.entries(r).map(([r,o])=>{let s=NC(e.presetIdent,i,r),l=`${J_}p${e.presetIdent}.d${t}.${r}`;e.artifacts.variables[l]={kind:`state`,key:s,default:Ws(n.settings?.[r]??o.default)},c[r]={id:i,key:s,variable:l};let u=`${a}.setting.${t}.${r}`,d=nx(ex(o),s,l,u);return Object.assign(e.artifacts.actions,d.actions),e.artifacts.segments[u]={template:d.kind===`ring`?`{{ "${Gc(o.label)}" }} ${d.template}`:d.template},{kind:`segment`,name:u}});return{term:`{{ action "${s}" "⚙️" }}`,ref:{variable:U_,key:U_,member:o},body:{kind:`container`,direction:`vertical`,children:l},drafts:c}}const FC=`${vu}label:`;function IC(e){if(e.startsWith(FC)){let t=e.slice(FC.length);return t.slice(t.indexOf(`:`)+1)}return e.startsWith(`edit.`)?void 0:e}function LC(e,t,n,r){let{artifacts:i}=n,a=Ts(e),o=`${FC}${a}:${e.name}`;i.segments[o]={template:`{{ "${Gc(a)}" }}`,...t.palette!==void 0&&{palette:t.palette}};let s=e.settings?.[zs];return{...Kc(o,r.ref,r.body,`drop`,jC([r.ref],`{{ ${xC(n.presetIdent)} }}`)),...s!==void 0&&{settings:{theme:s}},drafts:{[zs]:r.drafts[zs]}}}function RC(e,t,n,r){let{presetIdent:i,artifacts:a}=e,o=`${vu}${i}.insert.${t}`,s=`${vu}${i}.insertSeg.${t}`;a.actions[o]={persist:e.rootKey,insertSegmentFrom:EC,anchor:n,relation:r};let c=p_(o),l=m_(s,o,void 0),u=__(l),d=g_(l,c);return a.variables[l]=Qc(l,Vc),a.variables[u]={kind:`state`,key:u,default:`0`},a.actions[d]=$c(l,c),a.actions[u]={set:u,int:!0},{host:s,template:`{{ $m := menu "${o}" "✚" "✕" }}{{ if ${Jc({variable:l,key:l,member:c})} }}{{ $m }}{{ else }}{{ fg (${`readableOn (color "success") (bgOf) ${Ea}`}) $m }}{{ end }}`}}function zC(e,t){let n=[],r=e.children.findIndex(e=>e.kind===`segment`&&!TC(e.name)),i=e=>zC(e,t);for(let[a,o]of e.children.entries()){if(o.kind===`container`){n.push(i(o));continue}let s=Os(o,i);if(TC(o.name)){n.push(s);continue}let c=Ts(o),l=a===r?[RC(t,String(t.posCounter.n++),c,`before`)]:[],u=String(t.posCounter.n++),d=RC(t,u,c,`after`),f=kC(t,u,c),p=t.segments[o.name],m=PC(t,u,o,Bs(p)),h=AC(f),g=AC(m.term),_={kind:`container`,direction:`horizontal`,children:[...l.map(e=>OC(e.host,e.template,t.artifacts)),{...LC(o,p,t,m),lead:h,trail:g},{...s,when:CC(t.presetIdent,`false`,o.when??`true`),lead:h,trail:g,drafts:m.drafts},OC(d.host,d.template,t.artifacts)]};n.push(e.direction===`vertical`?{kind:`container`,direction:`horizontal`,children:[_]}:_)}return{...e,children:n,...e.when!==void 0&&{when:jC(MC(n),CC(t.presetIdent,`true`,e.when))}}}function BC(e,t,n,r,i,a,o){let s=`${vu}${t}.resetLayout`,c=`${vu}${t}.customized`;return r.actions[s]={reset:n},r.segments[c]={template:`{{ action "${s}" "↺ reset layout" }}`,when:wC},{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[...i,{kind:`segment`,name:c},a]},VC(e,o)]}}function VC(e,t){if(e.kind===`segment`)return{kind:`container`,direction:`horizontal`,children:[e,t]};let n=e.children.at(-1);return e.direction===`vertical`&&n!==void 0&&(n.kind===`segment`||n.when===void 0)?{...e,children:[...e.children.slice(0,-1),VC(n,t)]}:{...e,children:[...e.children,t]}}function HC(e,t,n,r,i,a){let{node:o}=D_(e,t),s={presetIdent:hu(t),rootKey:ox(t),segments:e.segments,artifacts:n,posCounter:{n:0},configured:[]},c=zC(o,s);return n.variables[bC(s.presetIdent)]=SC(s.configured),BC(c,s.presetIdent,s.rootKey,n,r,i,a)}function UC(e){let t={variables:{},actions:{},segments:{}},n=dx(`${vu}help`,yx,[X_],t);t.variables[dC]=Qc(dC,Vc),t.actions[dC]=$c(dC,yC.member),t.segments[dC]={template:Yc(dC,...fC),when:Z_};let r={kind:`segment`,name:dC},i=n;t.variables[gC]={kind:`input`,path:`history.sinceEdit`,type:`number`,default:0},t.actions[pC]={do:[nS,...K_]},t.segments[pC]={template:`{{ if ${vC} }}{{ action "${pC}" "✓ save" }}{{ else }}{{ action "${pC}" "✓ done" }}{{ end }}`,when:Z_},t.actions[hC]={rewind:!0},t.actions[mC]={do:[hC,...K_]},t.segments[mC]={template:`{{ action "${mC}" "↩ cancel" }}`,when:`{{ and ${Jc(X_)} ${_C} }}`};let a=[{kind:`segment`,name:pC},{kind:`segment`,name:mC}],o={...e.presets},s=[];for(let n of w_(e.presets)){let c=HC(e,n,t,a,r,i);s.push(c),o[n]={...E_(e.presets,n),root:c}}let c=Ib(t,s,e);return{...e,variables:{...c,...e.variables,...t.variables},actions:{...e.actions,...t.actions},segments:{...e.segments,...t.segments},presets:o}}const WC=[`set`,`persist`,`copy`,`open`,`reset`,`undo`,`redo`,`back`,`rewind`,`save`,`preset`,`doctor`,`ceiling`,`slash`,`do`];function GC(e){return e.ceiling===`set`?[`set`,e.to]:[`clear`]}function KC(e){return`from`in e||`int`in e||`insertSegmentFrom`in e}function qC(e,t){if(t===void 0)return{};if(!ec(t))return Z(e,`actions`,`actions must be an object, got ${tc(t)}`),{};let n=Object.create(null);for(let[r,i]of Object.entries(t)){let t=JC(e,`actions.${r}`,i);t!==null&&(n[r]=t)}return n}function Z(e,t,n){e.issues.push({path:t,message:n,line:G(e.source,t.split(`.`))})}function JC(e,t,n){if(!ec(n))return Z(e,t,`${t} must be an action object, got ${tc(n)}`),null;if(`persistWhen`in n)return Z(e,t,`${t}.persistWhen was removed: declare the \`set\` alone — a session pick is a draft until a \`{ save: true }\` action writes every unsaved setting to the config file`),null;let r=WC.filter(e=>e in n);return r.length===1?YC[r[0]](e,t,n):(Z(e,t,`action must declare exactly one of: ${WC.join(`, `)}${r.length>1?` (found: ${r.join(`, `)})`:``}`),null)}const YC={set:(e,t,n)=>Dw(e,t,n,`set`,Cw),persist:(e,t,n)=>Dw(e,t,n,`persist`,ww),copy:XC(`copy`),open:XC(`open`),reset:ZC,undo:$C(`undo`),redo:$C(`redo`),back:$C(`back`),rewind:$C(`rewind`),save:$C(`save`),preset:ew,doctor:tw,ceiling:nw,slash:rw,do:iw};function XC(e){return(t,n,r)=>{for(let i of Object.keys(r))i!==e&&Z(t,`${n}.${i}`,`Unknown key "${i}" on a ${e} action. Expected only: ${e}`);let i=Ys(t,n,r,e);return i===null?null:{[e]:i}}}function ZC(e,t,n){for(let r of Object.keys(n))r!==`reset`&&Z(e,`${t}.${r}`,`Unknown key "${r}" on a reset action. Expected only: reset`);let r=aw(e,t,`reset`,n,`reset key must be non-empty (the config globals field to clear)`,e=>`reset key "${e}" contains "/" — keys must be slash-free`);return r===null?null:{reset:r}}const QC={undo:`it steps the session's settings history`,redo:`it steps the session's settings history`,back:`it steps the session's navigation history`,rewind:`it steps the session's settings history back to where edit mode opened`,save:`it saves the session's unsaved settings`};function $C(e){return(t,n,r)=>{for(let i of Object.keys(r))i!==e&&Z(t,`${n}.${i}`,`Unknown key "${i}" on a ${e} action. Expected only: ${e}`);return r[e]===!0?{[e]:!0}:(Z(t,`${n}.${e}`,`${e} must be the literal true (it takes no key — ${QC[e]}), got ${K(r[e])}`),null)}}function ew(e,t,n){let r=n.preset,i=r===`save`?[`preset`]:[`preset`,`name`];for(let r of Object.keys(n))i.includes(r)||Z(e,`${t}.${r}`,`Unknown key "${r}" on a preset action. Expected only: ${i.join(`, `)}`);if(r!==`save`&&r!==`delete`)return Z(e,`${t}.preset`,`preset must be "save" or "delete", got ${K(r)}`),null;if(r===`save`)return{preset:`save`};let a=Ys(e,t,n,`name`);return a===null?null:{preset:`delete`,name:a}}function tw(e,t,n){let r=n.doctor,i=r===`run`?[`doctor`]:[`doctor`,`check`];for(let r of Object.keys(n))i.includes(r)||Z(e,`${t}.${r}`,`Unknown key "${r}" on a doctor action. Expected only: ${i.join(`, `)}`);if(r!==`run`&&r!==`fix`)return Z(e,`${t}.doctor`,`doctor must be "run" or "fix", got ${K(r)}`),null;if(r===`run`)return{doctor:`run`};let a=n.check;return typeof a!=`string`||Dx(a)===void 0?(Z(e,`${t}.check`,`doctor fix must name a check (have: ${Tx.map(e=>e.name).join(`, `)}), got ${K(a)}`),null):{doctor:`fix`,check:a}}function nw(e,t,n){let r=n.ceiling,i=r===`clear`?[`ceiling`]:[`ceiling`,`to`];for(let r of Object.keys(n))i.includes(r)||Z(e,`${t}.${r}`,`Unknown key "${r}" on a ceiling action. Expected only: ${i.join(`, `)}`);if(r===`clear`)return{ceiling:`clear`};if(r!==`set`)return Z(e,`${t}.ceiling`,`ceiling must be "set" or "clear", got ${K(r)}`),null;let a=n.to;return typeof a!=`string`||a.trim()===``?(Z(e,`${t}.to`,`ceiling set needs \`to\`: a memento ceiling value such as "+100_000", "400000" or "off", got ${K(a)}`),null):{ceiling:`set`,to:a}}function rw(e,t,n){for(let r of Object.keys(n))r!==`slash`&&Z(e,`${t}.${r}`,`Unknown key "${r}" on a slash action. Expected only: slash`);let r=zx(n.slash);return r.kind===`refused`?(Z(e,`${t}.slash`,r.reason),null):{slash:r.line}}function iw(e,t,n){for(let r of Object.keys(n))r!==`do`&&Z(e,`${t}.${r}`,`Unknown key "${r}" on a do action. Expected only: do`);let r=n.do;return!Array.isArray(r)||r.length<2||r.some(e=>typeof e!=`string`||e===``)?(Z(e,`${t}.do`,`do must list at least two action names (the first is the click's face, the rest ride along in the same click), got ${K(r)}`),null):{do:r}}function aw(e,t,n,r,i,a){let o=Ys(e,t,r,n);if(o===null)return null;let s=`${t}.${n}`;return o===``?(Z(e,s,i),null):o.includes(`/`)?(Z(e,s,a(o)),null):o}const ow={set:`the SessionState key to write`,persist:`the config globals field to write`};function sw(e,t,n,r){let i=ow[r],a=aw(e,t,r,n,`${r} key must be non-empty (${i})`,e=>`${r} key "${e}" contains "/" — keys must be slash-free`);return a===null?null:{[r]:a}}function cw(e){return e===`set`?`set-state`:`set-config`}const lw={to:Ow(`set`)},uw={to:Ow(`persist`)},dw={from:kw(`set`)},fw={from:kw(`persist`)},pw={min:Pw(),max:Pw(),by:Pw()},mw={int:jw()},hw={cycle:Aw(`set`)},gw={cycle:Aw(`persist`)},_w={removeSegment:Mw(`removeSegment`)},vw={insertSegment:Mw(`insertSegment`),anchor:Mw(`anchor`),relation:Nw()},yw={insertSegmentFrom:kw(`persist`),anchor:Mw(`anchor`),relation:Nw()},bw={ok:e=>e.min<e.max,issue:e=>({field:`min`,message:`min (${e.min}) must be less than max (${e.max})`})},xw={ok:e=>e.by!==0,issue:()=>({field:`by`,message:`by must be a non-zero integer (the per-click increment; negative steps down)`})};function Sw(e,t,n=[],r){let i=Object.keys(t),a=r??i,o=[e],s=(e,n,r)=>rc(e,t,n,r),c=xc(t);return{detect:a,allowed:[...o,...i],label:i.join(`/`),json:{type:`object`,properties:{...Object.fromEntries(o.map(e=>[e,{type:`string`}])),...c.properties},required:[...o,...c.required??[]],additionalProperties:!1},parse:n.length?dc(s,...n):s}}const Cw=[Sw(`set`,lw),Sw(`set`,dw),Sw(`set`,pw,[bw,xw]),Sw(`set`,mw),Sw(`set`,hw)],ww=[Sw(`persist`,uw),Sw(`persist`,fw),Sw(`persist`,pw,[bw,xw]),Sw(`persist`,gw),Sw(`persist`,_w),Sw(`persist`,vw,[],[`insertSegment`]),Sw(`persist`,yw,[],[`insertSegmentFrom`])];function Tw(e){let t=[`"to" (a literal value)`,`"from" (an option domain — a registered domain name like "themes"/"endcaps"/"styles", or an inline array of literal values)`,`"min"/"max"/"by" (a bounded step)`];return e===`set`&&t.push(`"int" (an unbounded integer cursor)`),t.push(`"cycle" (an enumerated domain stepped in order)`),e===`persist`&&t.push(`"removeSegment" (remove a named segment from the layout)`,`"insertSegment"/"anchor"/"relation" (insert a named segment before/after an existing one)`,`"insertSegmentFrom"/"anchor"/"relation" (insert a segment PICKED from an option domain before/after an existing one)`),t}function Ew(e){let t=Tw(e),n=t[t.length-1];return`a ${e} action declares exactly one value source: ${t.length===1?n:`${t.slice(0,-1).join(`, `)}, or ${n}`}`}function Dw(e,t,n,r,i){let a=sw(e,t,n,r),o=i.filter(e=>e.detect.some(e=>e in n));if(o.length!==1)return Z(e,t,`${Ew(r)}${o.length>1?` — found: ${o.map(e=>e.label).join(`, `)}`:``}`),null;let s=o[0];for(let i of Object.keys(n))s.allowed.includes(i)||Z(e,`${t}.${i}`,`Unknown key "${i}" on this ${r} action. Expected one of: ${s.allowed.join(`, `)}`);let c=s.parse(e,t,n);return a===null||c===null?null:{...a,...c}}function Ow(e){let t=cw(e);return{required:!0,json:{type:`string`},parse:(n,r,i,a)=>aw(n,r,i,a,`${e} value must be non-empty — an empty value cannot be delivered on the ${t} wire`,t=>`${e} value "${t}" contains "/" — ${e} values must be slash-free`)??void 0}}function kw(e){let t=cw(e);return{required:!0,json:{anyOf:[{type:`string`,minLength:1},{type:`array`,items:{type:`string`,minLength:1},minItems:1,uniqueItems:!0}]},parse:(n,r,i,a)=>{let o=a[i],s=`${r}.${i}`;if(typeof o==`string`){if(o===``){Z(n,s,`${i} must be a non-empty domain name`);return}return o}if(Array.isArray(o)&&o.every(e=>typeof e==`string`)){let r=o;if(r.length===0){Z(n,s,`${i} must name a domain (a non-empty string) or declare an inline domain (a non-empty array of values)`);return}if(r.some(e=>e===``)){Z(n,s,`${i} array members must be non-empty — an empty value cannot be delivered on the ${t} wire`);return}let a=r.filter(e=>e.includes(`/`));if(a.length>0){Z(n,s,`${i} array member(s) ${a.map(e=>`"${e}"`).join(`, `)} contain "/" — ${e} values must be slash-free`);return}if(new Set(r).size!==r.length){Z(n,s,`${i} array members must be unique — a duplicated value would render the same picker option twice`);return}return r}Z(n,s,`${i} must be a domain name (a string) or an inline domain (an array of strings), got ${K(o)}`)}}}function Aw(e){let t=cw(e);return{required:!0,json:{type:`array`,items:{type:`string`,minLength:1},minItems:2,uniqueItems:!0},parse:(n,r,i,a)=>{let o=a[i],s=`${r}.${i}`;if(!Array.isArray(o)||o.some(e=>typeof e!=`string`)){Z(n,s,`cycle must be an array of strings (the enumerated values a click steps through), got ${tc(o)}`);return}let c=o;if(c.length<2){Z(n,s,`cycle needs at least two members (one member has no successor — use a literal "to")`);return}let l=c.some(e=>e===``),u=c.filter(e=>e.includes(`/`));if(l){Z(n,s,`cycle members must be non-empty — an empty value cannot be delivered on the ${t} wire`);return}if(u.length>0){Z(n,s,`cycle member(s) ${u.map(e=>`"${e}"`).join(`, `)} contain "/" — ${e} values must be slash-free`);return}if(new Set(c).size!==c.length){Z(n,s,`cycle members must be unique — the successor of a duplicated member is ambiguous`);return}return c}}}function jw(){return{required:!0,json:{const:!0},parse:(e,t,n,r)=>{if(r[n]!==!0){Z(e,`${t}.${n}`,`int must be the literal true (declares the key an unbounded integer cursor — a paged picker's page key), got ${K(r[n])}`);return}return!0}}}function Mw(e){return{required:!0,json:{type:`string`},parse:(t,n,r,i)=>{let a=Ys(t,n,i,r);if(a===null)return;let o=`${n}.${r}`;if(a===``){Z(t,o,`${e} must be non-empty (a segment name)`);return}if(a.includes(`/`)||a.includes(`:`)){Z(t,o,`${e} "${a}" contains "/" or ":" — segment names in a layout op must be free of both (the click wire's own delimiter and layout-ops.ts's op-token delimiter)`);return}return a}}}function Nw(){return{required:!0,json:{enum:[`before`,`after`]},parse:(e,t,n,r)=>{let i=r[n];if(i!==`before`&&i!==`after`){Z(e,`${t}.${n}`,`relation must be "before" or "after", got ${K(i)}`);return}return i}}}function Pw(){return{required:!0,json:{type:`integer`},parse:(e,t,n,r)=>{let i=r[n];if(typeof i!=`number`||!Number.isInteger(i)){Z(e,`${t}.${n}`,`${n} must be an integer, got ${K(i)}`);return}return i}}}function Fw(e,t,n){return`${e}: "${t}" is an endcaps shape, not a style — endcaps were renamed from "style" to "endcaps"; write ${n}: "${t}"`}const Iw={noun:`style key`,fields:{hueShift:hc(),chromaScale:hc({min:0}),lightnessScale:hc(),lightnessShift:hc()}};function Lw(e,t){if(!ec(t))return e.issues.push({path:`styles`,message:`styles must be an object mapping style names to adaptation objects, got ${tc(t)}`,line:G(e.source,[`styles`])}),{};let n={};for(let[r,i]of Object.entries(t)){if(r===``||r.includes(`/`)){e.issues.push({path:`styles.${r}`,message:`style name ${JSON.stringify(r)} must be non-empty and slash-free — a style picker writes the name on the set-state wire, which rejects empty values and splits on "/"`,line:G(e.source,[`styles`,r])});continue}if(lo(r)){e.issues.push({path:`styles.${r}`,message:Fw(`styles.${r}`,r,`globals.endcaps`),line:G(e.source,[`styles`,r])});continue}let t=nc(e,Iw,`styles.${r}`,i);t!==null&&(n[r]={...Rn,...t})}return n}const Rw={noun:`preset key`,fields:{root:{required:!1,json:{$ref:`#/definitions/RootFragment`},parse:(e,t,n,r)=>r[n]===void 0?void 0:ld(e,`${t}.${n}`,r[n])},globals:{required:!1,json:Cl(),parse:(e,t,n,r)=>r[n]===void 0?void 0:Sl(e,`${t}.${n}`,r[n])}}};function zw(e,t){if(!ec(t))return e.issues.push({path:`presets`,message:`presets must be an object mapping preset names to config fragments, got ${tc(t)}`,line:G(e.source,[`presets`])}),{};let n={};for(let[r,i]of Object.entries(t)){if(r===``||r.includes(`/`)||/[\n\r]/.test(r)){e.issues.push({path:`presets.${r}`,message:`preset name ${JSON.stringify(r)} must be non-empty, slash-free, and newline-free — a preset picker writes the name on the set-state wire (which rejects empty values and splits on "/"), and edit mode splices it into a synthesized template string`,line:G(e.source,[`presets`,r])});continue}let t=nc(e,Rw,`presets.${r}`,i);t!==null&&(n[r]=t)}return n}function Bw(e,t){if(t===void 0)return{};if(!ec(t))return e.issues.push({path:`helpers`,message:`helpers must be an object, got ${tc(t)}`,line:G(e.source,[`helpers`])}),{};let n=Object.create(null);for(let[r,i]of Object.entries(t)){if(typeof i!=`string`){e.issues.push({path:`helpers.${r}`,message:`helpers.${r} must be a string template body, got ${K(i)}`,line:G(e.source,[`helpers`,r])});continue}n[r]=i}return n}const Vw=new Map([[`session.budget.amount`,{segment:`session`,setting:`budget`}],[`session.budget.warningThreshold`,{segment:`session`,setting:`warnAt`}],[`today.budget.amount`,{segment:`today`,setting:`budget`}],[`today.budget.warningThreshold`,{segment:`today`,setting:`warnAt`}],[`block.budget.heatThreshold`,{segment:`block`,setting:`warnAt`}],[`block.budget.warningThreshold`,{segment:`block`,setting:`errorAt`}],[`weekly.budget.heatThreshold`,{segment:`weekly`,setting:`warnAt`}],[`weekly.budget.warningThreshold`,{segment:`weekly`,setting:`errorAt`}],[`burn.eta.errorMinutes`,{segment:`burnrate`,setting:`errorWithin`}],[`burn.eta.warnMinutes`,{segment:`burnrate`,setting:`warnWithin`}]]);function Hw(e){return`it became the "${e.setting}" setting of each "${e.segment}" placement — set it on the placement where a row places "${e.segment}" ({ seg: "${e.segment}", settings: { ${e.setting}: <value> } }), or redeclare segments.${e.segment}.settings.${e.setting} with the default every placement should start from`}function Uw(e){let t=Vw.get(e);return t===void 0?void 0:`variables.${e} is no longer read: ${Hw(t)}`}function Ww(e){let t=Vw.get(e);return t===void 0?``:` — ".${e}" is no longer a variable: ${Hw(t)}; a "${t.segment}" template reads it as ".settings.${t.setting}"`}function Gw(e,t){let n=new Map;for(let e of Object.keys(t)){let t=hu(e),r=n.get(t);r?r.push(e):n.set(t,[e])}for(let[t,r]of n)r.length<2||e.issues.push({path:`presets`,message:`preset names ${r.map(e=>JSON.stringify(e)).join(` and `)} both collapse to the same synthesis identifier "${t}" — edit mode's synthesized reset affordance would silently steal one preset's action for the other. Rename one.`,line:G(e.source,[`presets`])})}function Kw(e,t,n){let r=[[[`globals`],t.globals.style],[[`editGlobals`],t.editGlobals.style],...Object.entries(t.presets).map(([e,t])=>[[`presets`,e,`globals`],t.globals?.style])];for(let[n,i]of r){if(i===void 0||to(i)||Object.prototype.hasOwnProperty.call(t.styles,i))continue;let r=`${n.join(`.`)}.style`;e.issues.push({path:r,message:lo(i)?Fw(r,i,`${n.join(`.`)}.endcaps`):`${r} "${i}" does not match any declared style (have: ${Object.keys(t.styles).join(`, `)})`,line:G(e.source,[...n,`style`])})}t.globals.preset!==void 0&&!Object.prototype.hasOwnProperty.call(t.presets,t.globals.preset)&&e.issues.push({path:`globals.preset`,message:`globals.preset "${t.globals.preset}" does not match any declared preset (have: ${Object.keys(t.presets).join(`, `)})`,line:G(e.source,[`globals`,`preset`])}),Gw(e,t.presets);let i=Zb(t);for(let[n,r]of Object.entries(t.actions))`set`in r&&Ab.has(r.set)&&e.issues.push({path:`actions.${n}.set`,message:`actions.${n} sets "${r.set}", which has no session pick — globals.${r.set} is set in the config file only, so a click would change nothing; write it with { persist: "${r.set}", … } instead`,line:G(e.source,[`actions`,n,`set`])}),!(!(`set`in r)||!(`from`in r)||typeof r.from!=`string`)&&(Qb(i).includes(r.from)||e.issues.push({path:`actions.${n}.from`,message:`actions.${n} from: references unknown option domain "${r.from}" (have: ${Qb(i).join(`, `)})`,line:G(e.source,[`actions`,n,`from`])}));for(let[n,r]of Object.entries(t.actions))`do`in r&&r.do.forEach((i,a)=>{let o=Object.prototype.hasOwnProperty.call(t.actions,i)?t.actions[i]:void 0,s=o===void 0?`references unknown action "${i}"`:`do`in o?`"${i}" is itself a do action — list its members here instead`:r.do.indexOf(i)===a?a>0&&KC(o)?`"${i}" takes its value from the template (from/int/insertSegmentFrom), so it can only be the first member — only the first is bound the region's display`:void 0:`"${i}" is listed twice — each member fires once per click`;s!==void 0&&e.issues.push({path:`actions.${n}.do`,message:`actions.${n} do: ${s}`,line:G(e.source,[`actions`,n,`do`])})});for(let[n,r]of Object.entries(t.actions)){let i=`persist`in r?r.persist:`reset`in r?r.reset:null;if(i===null)continue;let a=`persist`in r?`persist`:`reset`,o=cx(i);if(o===null){e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" is not a config globals field (have: ${Dl().join(`, `)}), a "segments.<name>.palette" target, a "presets.<name>.globals.<field>" target, or a "presets.<name>.root" target`,line:G(e.source,[`actions`,n,a])});continue}let s=qw.filter(e=>e in r);if(o.scope!==`preset-root`&&s.length>0){e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" is not a "presets.<name>.root" target — ${s.map(e=>`"${e}"`).join(`/`)} is a tree op and applies only to one`,line:G(e.source,[`actions`,n,a])});continue}if(o.scope===`preset-root`){Jw(e,t,n,a,i,o.preset,r);continue}if(o.scope===`preset-globals`&&!w_(t.presets).includes(o.preset)){e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" names preset "${o.preset}" which is not declared (have: ${w_(t.presets).join(`, `)})`,line:G(e.source,[`actions`,n,a])});continue}if(o.scope===`segment-palette`){if(!Object.prototype.hasOwnProperty.call(t.segments,o.segment)){e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" names segment "${o.segment}" which is not declared (have segments: ${Object.keys(t.segments).join(`, `)})${Tu(o.segment)}`,line:G(e.source,[`actions`,n,a])});continue}`min`in r&&e.issues.push({path:`actions.${n}.${a}`,message:`actions.${n}: "${i}" is a segment palette target and cannot use a bounded stepper (min/max/by) — use "to", "from", or "cycle" instead`,line:G(e.source,[`actions`,n,a])})}}let a=bv(t);for(let t of a.names)t!==`settings`&&!t.startsWith(Yw)||e.issues.push({path:`variables`,message:`variable "${t}" is named under "settings", which a segment's templates read as its placement's own settings (.settings.<name>) — rename it`,line:G(e.source,[`variables`,t])});let o=(t,n,r)=>{ZS(t)>1&&e.issues.push({path:n,message:`${n} places the global settings menu anchor "${Wx}" ${ZS(t)} times — it may appear at most once per layout (it is one disclosure, and one state key holds one open state). Remove all but the placement you want; removing every placement puts the menu at its default position.`,line:r}),QS(t)&&e.issues.push({path:n,message:`${n} places the global settings menu anchor "${Wx}" under a \`when\` or inside a disclosure body — the menu is visible under every condition, so its placement may not be gated. Move it to an ungated position, or remove it to put the menu at its default position.`,line:r}),s(t)&&e.issues.push({path:n,message:`${n} sets "distribution" on a container inside a bar cell — everything inside a cell wears that cell's hue and tone, so it would place nothing. Set it on the row whose children are the cells (the horizontal container) or on the root, which places the rows.`,line:r});let i=new Map;for(let e of ks(t)){if(e.kind!==`segment`)continue;let t=Ts(e);i.set(t,[...i.get(t)??[],e])}for(let[t,a]of i){if(a.length<2)continue;let o=a[1].name,s=Ds(o,new Set(i.keys()));e.issues.push({path:n,message:`${n} has ${a.length} placements with the id "${t}" — an id names one placement (its settings, its menus' open state, and edit mode all address it), so give each its own: { seg: "${o}", id: "${s}" }. A placement without an "id" takes its segment's name.`,line:r})}};function s(e,t=!1){return e.kind===`segment`?!1:t&&e.distribution!==void 0||e.children.some(n=>s(n,t||ws[e.direction]===`cell`))}let c=(n,r)=>{for(let[i,o]of Pc(n,r)){let n=G(e.source,o.split(`.`));if(i.when!==void 0&&(sT(e,`${o}.when`,i.when,a,{line:n}),oT(e,`${o}.when`,i.when,n)),i.kind===`segment`){if(JS(i.name)){(i.id!==void 0||i.settings!==void 0)&&e.issues.push({path:o,message:`${r} gives the global settings menu anchor "${Wx}" an id or settings — the anchor only marks where the menu goes, so place it as the bare name "${Wx}"`,line:n});continue}Object.prototype.hasOwnProperty.call(t.segments,i.name)||e.issues.push({path:o,message:`${r} entry "${i.name}" does not match any declared segment${Tu(i.name)}`,line:n}),rT(e,t,i,o,n)}}};n.root!==void 0&&c(n.root,`root`);for(let[e,t]of Object.entries(n.presets??{}))t.root!==void 0&&c(t.root,`presets.${e}.root`);let l=new Map([[`root`,Mc(t.root)]]);for(let e of w_(t.presets)){let{node:n,path:r}=D_(t,e);l.set(r,n)}for(let[t,n]of l)o(n,t,G(e.source,t.split(`.`)));for(let[n,r]of Object.entries(t.variables)){iT(e,`variables.${n}`,r,a);let t=Uw(n);t!==void 0&&e.issues.push({path:`variables.${n}`,message:t,line:G(e.source,[`variables`,n])})}for(let[n,r]of Object.entries(t.segments)){if(r.vars)for(let[t,i]of Object.entries(r.vars))iT(e,`segments.${n}.vars.${t}`,i,a,n);let i=Bs(r);Zw(e,n,i);let o=Xw(a,i);for(let a of[`template`,`bg`,`fg`,`when`]){let s=r[a];if(typeof s==`string`){sT(e,`segments.${n}.${a}`,s,o,{segCtx:n,settings:i});for(let{name:r,site:i,via:o}of vv(s,t.helpers)){if(Object.prototype.hasOwnProperty.call(t.actions,r))continue;let s=i===`options`?` (in a picker, menu or carousel)`:``;if(o!==null){cT(e,o,`Template references unknown action "${r}"${s}`);continue}e.issues.push({path:`segments.${n}.${a}`,message:`${a} references unknown action "${r}"${s}`,line:G(e.source,[`segments`,n,a])})}}}}for(let[n,r]of Object.entries(t.variables))aT(e,`variables.${n}`,r,a);for(let[n,r]of Object.entries(t.segments))if(r.vars)for(let[t,i]of Object.entries(r.vars))aT(e,`segments.${n}.vars.${t}`,i,a,n)}const qw=[`removeSegment`,`insertSegment`,`insertSegmentFrom`];function Jw(e,t,n,r,i,a,o){let s=`actions.${n}.${r}`,c=G(e.source,[`actions`,n,r]);if(!w_(t.presets).includes(a)){e.issues.push({path:s,message:`actions.${n}: "${i}" names preset "${a}" which is not declared (have: ${w_(t.presets).join(`, `)})`,line:c});return}if(r===`reset`)return;let l=`removeSegment`in o,u=`insertSegment`in o,d=`insertSegmentFrom`in o;if(!l&&!u&&!d){e.issues.push({path:s,message:`actions.${n}: "${i}" is a "presets.<name>.root" target and can only be paired with "removeSegment", "insertSegment", or "insertSegmentFrom" (not "to"/"from"/"cycle"/bounded — those have no meaning as a tree op)`,line:c});return}let f=(r,i)=>{Object.prototype.hasOwnProperty.call(t.segments,i)||e.issues.push({path:s,message:`actions.${n}: ${r} "${i}" is not a declared segment (have: ${Object.keys(t.segments).join(`, `)})${Tu(i)}`,line:c})},p=new Set(Es(D_(t,a).node)),m=(r,i)=>{!wu.has(i)||p.has(i)||Object.prototype.hasOwnProperty.call(t.segments,i)||e.issues.push({path:s,message:`actions.${n}: ${r} "${i}" names no placement${Tu(i)}`,line:c})};`removeSegment`in o&&m(`removeSegment`,o.removeSegment),`insertSegment`in o&&f(`insertSegment`,o.insertSegment),(`insertSegment`in o||`insertSegmentFrom`in o)&&m(`anchor`,o.anchor)}const Yw=`settings.`;function Xw(e,t){return{...e,names:new Set([...e.names,...Object.keys(t).map(e=>Yw+e)])}}function Zw(e,t,n){let r=e=>`segments.${t}.settings.${e}`,i=(n,i)=>{e.issues.push({path:r(n),message:`${r(n)}: ${i}`,line:G(e.source,[`segments`,t,`settings`,n])})},a=eT(n);for(let{setting:e,message:t}of a)i(e,t);if(!(a.length>0))for(let{setting:e,message:t}of Hs(n,$w(n)))i(e,`the defaults do not stand together: ${t}`)}function Qw(e){return eT(e).length>0||Hs(e,$w(e)).length>0}function $w(e){return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.default]))}function eT(e){let t=t=>Vs(tT(e,t))?.atLeast;return Object.keys(e).flatMap(n=>{let r=t(n);if(r===void 0)return[];if(r===n||Vs(tT(e,r))===void 0)return[{setting:n,message:`atLeast "${r}" must name another range setting of this segment (its range settings: ${nT(e,n).join(`, `)||`none`})`}];let i=[n];for(let e=r;e!==void 0;e=t(e)){if(e===n)return i.every(e=>n<=e)?[{setting:n,message:`atLeast closes a cycle (${[...i,n].join(` ≥ `)}) — every setting on it could only ever equal the rest`}]:[];if(i.includes(e))return[];i.push(e)}return[]})}function tT(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function nT(e,t){return Object.entries(e).filter(([e,n])=>e!==t&&Vs(n)!==void 0).map(([e])=>e)}function rT(e,t,n,r,i){let a=Object.prototype.hasOwnProperty.call(t.segments,n.name)?t.segments[n.name]:void 0;if(a===void 0)return;let o=Bs(a),s=`${r}: placement "${Ts(n)}" of segment "${n.name}"`;for(let[t,a]of Object.entries(n.settings??{})){let c=Object.prototype.hasOwnProperty.call(o,t)?o[t]:void 0,l=c===void 0?`sets "${t}", which segment "${n.name}" does not declare (it has: ${Object.keys(o).join(`, `)})`:Us(c,a)?void 0:`sets "${t}" to ${JSON.stringify(a)}${c.domain===`theme`?Ka(a):``}, but it must be ${Ks(c)}`;l!==void 0&&e.issues.push({path:r,message:`${s} ${l}`,line:i})}let c=Object.fromEntries(Object.entries(o).map(([e,t])=>[e,n.settings?.[e]??t.default]));if(!(!Object.entries(c).every(([e,t])=>Us(o[e],t))||Qw(o)))for(let{message:t}of Hs(o,c))e.issues.push({path:r,message:`${s}: ${t}`,line:i})}function iT(e,t,n,r,i){n.kind===`template`&&sT(e,`${t}.template`,n.template,r,{segCtx:i}),Is(n)&&n.cache&&`key`in n.cache&&sT(e,`${t}.cache.key`,n.cache.key,r,{segCtx:i})}function aT(e,t,n,r,i){if(Is(n)&&n.cache&&`depends_on`in n.cache)for(let a=0;a<n.cache.depends_on.length;a++){let o=n.cache.depends_on[a];if(r.names.has(o))continue;let s=i===void 0?void 0:`${i}.${o}`,c=s!==void 0&&r.names.has(s)?` (segment-local vars are namespaced — write "${s}")`:``;e.issues.push({path:`${t}.cache.depends_on[${a}]`,message:`cache.depends_on references unknown variable "${o}"${c}`,line:G(e.source,[...t.split(`.`),`cache`,`depends_on`])})}}function oT(e,t,n,r){try{V_.parse(n)}catch(n){e.issues.push({path:t,message:`Template parse error in ${t}: ${n.message}`,line:r})}}function sT(e,t,n,r,i){for(let[a,o]of mv(n,r.helpers)){if(yv(a,r))continue;if(a.startsWith(Yw)){let n=o===null?``:` through helper "${o}"`,r=a.slice(9),s=i?.segCtx===void 0||i.settings===void 0?`Template reads ".${a}"${n}, but only a segment's own templates have settings — call it from a segment that declares "${r}"`:`Template reads ".${a}"${n}, but segment "${i.segCtx}" has no setting "${r}" (it has: ${Object.keys(i.settings).join(`, `)}) — declare it under segments.${i.segCtx}.settings`;e.issues.push({path:t,message:s,line:i?.line??G(e.source,t.split(`.`))});continue}if(o!==null){cT(e,o,`Template references unknown variable ".${a}"${Ww(a)}`);continue}let n=i?.segCtx===void 0?void 0:`${i.segCtx}.${a}`,s=n!==void 0&&yv(n,r)?` (segment-local vars are namespaced — write ".${n}")`:Ww(a);e.issues.push({path:t,message:`Template references unknown variable ".${a}"${s}`,line:i?.line??G(e.source,t.split(`.`))})}}function cT(e,t,n){let r=`helpers.${t}`;e.issues.some(e=>e.path===r&&e.message===n)||e.issues.push({path:r,message:n,line:G(e.source,[`helpers`,t])})}function lT(e,t){let{graph:n,nodeInfo:r}=uT(t),i=new Map,a=[];for(let e of n.keys())i.set(e,0);for(let e of n.keys())if(i.get(e)===0&&o(e))return;function o(t){i.set(t,1),a.push(t);for(let s of n.get(t)??[]){let t=i.get(s);if(t===1){let t=a.indexOf(s),n=[...a.slice(t),s],i=n[0],o=r.get(i);return e.issues.push({path:o?.declarationPath??`variables.${i}`,message:`Dependency cycle: ${n.join(` → `)}`,line:G(e.source,o?.linePathParts??[`variables`,i])}),!0}if(t===0&&o(s))return!0}return i.set(t,2),a.pop(),!1}}function uT(e){let t=new Set(Object.keys(e.variables)),n=new Map;for(let t of Object.keys(e.variables))n.set(t,{declarationPath:`variables.${t}`,linePathParts:[`variables`,t]});for(let[r,i]of Object.entries(e.segments))if(i.vars)for(let e of Object.keys(i.vars)){let i=`${r}.${e}`;t.add(i),n.set(i,{declarationPath:`segments.${r}.vars.${e}`,linePathParts:[`segments`,r,`vars`,e]})}let r=new Map;for(let e of t)r.set(e,new Set);let i=(n,i)=>{for(let a of mv(i,e.helpers).keys()){if(t.has(a)){r.get(n).add(a);continue}let e=a.split(`.`)[0];e!==a&&t.has(e)&&r.get(n).add(e)}},a=(e,n)=>{if(n.kind===`template`&&i(e,n.template),Is(n)&&(n.cache&&`key`in n.cache&&i(e,n.cache.key),n.cache&&`depends_on`in n.cache))for(let i of n.cache.depends_on)t.has(i)&&r.get(e).add(i)};for(let[t,n]of Object.entries(e.variables))a(t,n);for(let[t,n]of Object.entries(e.segments))if(n.vars)for(let[e,r]of Object.entries(n.vars))a(`${t}.${e}`,r);return{graph:r,nodeInfo:n}}const dT=[`json5`,`json`];function fT(e){try{return r.statSync(e,{throwIfNoEntry:!1})===void 0?`absent`:`present`}catch(t){return{path:e,error:t.message}}}function pT(e){return e===`~`||e.startsWith(`~/`)||e.startsWith(`~\\`)?m.homedir()+e.slice(1):e}function mT(e,t,n){if(n!==void 0)return[n];let r=t??process.cwd();return[...new Set([...e?dT.map(t=>c.join(e,`.cc-candybar.${t}`)):[],...dT.map(e=>c.join(r,`.cc-candybar.${e}`)),...dT.map(e=>`${hT()}.${e}`)])]}function hT(){let e=process.env.XDG_CONFIG_HOME??c.join(m.homedir(),`.config`);return c.join(e,`cc-candybar`,`config`)}function gT(e,t,n){let r=[];for(let i of mT(e,t,n)){let e=fT(i);if(e===`present`)return{kind:`file`,path:i,unchecked:r};e!==`absent`&&r.push(e)}if(n===void 0)return{kind:`default`,unchecked:r};let[i]=r;return i===void 0?{kind:`missing`,path:n}:{kind:`unreadable`,...i}}function _T(e,t,n){let r=gT(e,t,n);return r.kind===`default`?`${hT()}.${dT[0]}`:r.path}function vT(e){return yT(e).join(`
159
+ `)||null}function yT(e){switch(e.kind){case`file`:case`default`:return e.unchecked.map(e=>`Config location could not be checked: ${e.path} — ${e.error}`);case`missing`:return[`Config file not found: ${e.path} — rendering the bundled default until it appears`];case`unreadable`:return[`Config file could not be read: ${e.path} — ${e.error} — rendering the bundled default until it can be`]}}function bT(e,t){let n=mT(e,t).filter(e=>fT(e)===`present`),r=new Map;for(let e of n){let t=c.dirname(e),n=c.basename(e).replace(/\.(json5|json)$/,``),i=c.join(t,n);r.has(i)||r.set(i,[]),r.get(i).push(e)}let i=[...r.values()].filter(e=>e.length>1);return i.length===0?null:`config-extension collision: ${i.map(e=>{let[t,...n]=e;return`${t} shadows ${n.join(`, `)}`}).join(`; `)} — remove the duplicate`}function xT(e,t,n){return e===null?{...CT,config:Lc(CT.raw,t)}:ST(e,r.readFileSync(e,`utf-8`),t,n)}function ST(e,t,n,r){let i={source:t,...ET(e,t,r,zu(n))};return{...i,config:Lc(i.raw,n)}}const CT={raw:{},source:``,warnings:[]};function wT({config:e,raw:t,source:n},r=`<config>`,i=new Set(Ya())){let a=[],o={source:n,issues:a,allowedPalettes:i,groups:[]};if(Kw(o,e,t),lT(o,e),a.length>0)throw new vs(r,a);let s=B_(e,a);if(a.length>0)throw new vs(r,a);return UC(uC(s))}function TT(e,t,n=new Set(Ya()),r=DT){return ET(e,t,n,r).raw}function ET(e,t,n,r){let i=OT(e,t),a=xs(e,t),o=a===null?[]:[a],s=[],c={source:t,issues:s,allowedPalettes:n??new Set(Ya()),groups:[]};if(!ec(i))throw new vs(e,[{path:``,message:`Config root must be an object, got ${tc(i)}`}],o);let l=kT(c,i,r);if(s.length>0)throw new vs(e,s,o);return{raw:l,warnings:o}}const DT=new Set;function OT(e,t){try{return et.default.parse(t)}catch(t){let n=t;throw new vs(e,[{path:``,message:`JSON5 syntax error: ${n.message}`,line:n.lineNumber,col:n.columnNumber}])}}function kT(e,t,n){for(let n of Object.keys(t))AT.has(n)||e.issues.push({path:n,message:`Unknown top-level key "${n}". Expected one of: ${[...AT].join(`, `)}`,line:G(e.source,[n])});let r={};return t.globals!==void 0&&(r.globals=xl(e,`globals`,t.globals)),t.variables!==void 0&&(r.variables=Vl(e,`variables`,t.variables)),t.segments!==void 0&&(r.segments=Bu(e,t.segments,n)),t.layout!==void 0&&e.issues.push({path:`layout`,message:`"layout" is no longer supported — use "root" with the A-grammar instead.
160
160
  Replace: layout: [["seg1", "seg2"], ["seg3"]]
161
161
  With: root: { v: [{ h: ["seg1", "seg2"] }, "seg3"] }
162
- Single-row example: root: { h: ["seg1", "seg2"] }`,line:U(e.source,[`layout`])}),t.root!==void 0&&(r.root=cd(e,`root`,t.root)),t.actions!==void 0&&(r.actions=VC(e,t.actions)),t.looks!==void 0&&e.issues.push({path:`looks`,message:`"looks" was renamed "styles" — move the block under styles: { … } (and globals.look to globals.style)`,line:U(e.source,[`looks`])}),t.styles!==void 0&&(r.styles=jw(e,t.styles)),t.presets!==void 0&&(r.presets=Nw(e,t.presets)),t.editGlobals!==void 0&&(r.editGlobals=wl(e,`editGlobals`,t.editGlobals)),t.helpers!==void 0&&(r.helpers=Pw(e,t.helpers)),gd(e,r),L_(e,r),$_(e,r),Su(e,r,K,`the global settings menu`),r}const wT=new Set([`globals`,`variables`,`segments`,`layout`,`looks`,`root`,`actions`,`styles`,`presets`,`editGlobals`,`helpers`]);function TT(e){let t=jT(e.termCols),n=jT(e.termRows),r=MT(e.ssh),i=kT(e.tmux),a=OT(e.configEnv),o=DT(e.claudeConfigDir),s=ET(e.mementoEnv);return{...t!==void 0&&{termCols:t},...n!==void 0&&{termRows:n},...r!==void 0&&{ssh:r},...i!==void 0&&{tmux:i},...a!==void 0&&{configEnv:a},...o!==void 0&&{claudeConfigDir:o},...s!==void 0&&{mementoEnv:s}}}function ET(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n=Je.filter(e=>t[e]!==void 0);return n.every(e=>DT(t[e])!==void 0)?Object.fromEntries(n.map(e=>[e,t[e]])):void 0}function DT(e){return typeof e==`string`&&c.isAbsolute(e)?e:void 0}function OT(e){return typeof e==`string`&&e!==``?sT(e):void 0}function kT(e){if(e===null)return null;if(typeof e!=`object`)return;let{socket:t,pane:n,truecolor:r}=e;if(!(typeof t!=`string`||t===``)&&!(typeof n!=`string`||n===``)&&!(r!==null&&(typeof r!=`string`||r===``)))return{socket:t,pane:n,truecolor:r}}const AT=1e4;function jT(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.floor(e);if(!(t<=0))return t>AT?AT:t}function MT(e){return typeof e==`boolean`?e:void 0}var NT=class extends Error{constructor(e){super(e),this.name=`ProtocolError`}};function PT(e){let t=Buffer.from(JSON.stringify(e),`utf8`),n=Buffer.alloc(4);return n.writeUInt32BE(t.length,0),Buffer.concat([n,t])}function FT(e,t){let n=Buffer.alloc(0);return function(r){for(n=Buffer.concat([n,r]);n.length>=4;){let r=n.readUInt32BE(0);if(r>16777216){t(new NT(`frame too large: ${r}`));return}if(n.length<4+r)return;let i=n.subarray(4,4+r);n=n.subarray(4+r);try{e(JSON.parse(i.toString(`utf8`)))}catch(e){let n=new NT(e instanceof Error?e.message:String(e));e instanceof Error&&(n.cause=e),t(n);return}}}}function IT(e,t,n){return new Promise((r,i)=>{let a=!1,o=t=>{if(!a){a=!0,clearTimeout(s),e.removeAllListeners();try{t()}catch{}}},s=setTimeout(()=>{o(()=>{e.destroy(),i(Error(`TIMEOUT`))})},n),c=FT(e=>o(()=>r(e)),e=>o(()=>i(e)));e.on(`data`,c),e.on(`error`,e=>o(()=>i(e))),e.on(`close`,()=>o(()=>i(Error(`socket closed before response`)))),e.write(PT(t))})}async function LT(e,t,n){let r=null;try{r=await HT(Fe(),t.connectMs);let i=await IT(r,{v:3,...e},t.budgetMs);return BT(e.kind,i,n)}catch(e){return VT(e)}finally{r&&r.destroy()}}function RT(e,t){return typeof e==`string`?e:t}function zT(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0?e:0}function BT(e,t,n){let r=t;if(r.ok===!0){let r=n(t);return r===void 0?{kind:`permanent`,cause:`malformed_response`,message:`ok response without payload for "${e}" request`}:{kind:`ok`,value:r}}let i=RT(r.error,`(no error message)`);switch(r.code){case`VERSION_MISMATCH`:return{kind:`permanent`,cause:`version_mismatch`,clientV:3,daemonV:zT(r.daemonV)};case`TIMEOUT`:return{kind:`transient`,cause:`timeout`,message:i};case`BAD_REQUEST`:return{kind:`permanent`,cause:`bad_request`,message:i};case`RENDER_FAILED`:return{kind:`permanent`,cause:`render_failed`,message:i};default:return{kind:`permanent`,cause:`malformed_response`,message:`unknown error code: ${String(r.code)}`}}}function VT(e){if(e instanceof NT||e instanceof SyntaxError)return{kind:`permanent`,cause:`malformed_response`,message:e instanceof Error?e.message:String(e)};let t=e instanceof Error?e.message:String(e);return t===`CONNECT_TIMEOUT`||t===`TIMEOUT`?{kind:`transient`,cause:`timeout`,message:t}:t.includes(`ECONNREFUSED`)||t.includes(`ENOENT`)||t.includes(`ENOTSOCK`)?{kind:`transient`,cause:`unreachable`,message:t}:{kind:`transient`,cause:`io_error`,message:t}}function HT(e,t){return new Promise((n,r)=>{let i=b.createConnection({path:e}),a=setTimeout(()=>{i.destroy(),r(Error(`CONNECT_TIMEOUT`))},t);i.once(`connect`,()=>{clearTimeout(a),n(i)}),i.once(`error`,e=>{clearTimeout(a),r(e)})})}function UT(e){if(e.kind===`transient`)return`daemon unavailable (${e.cause}: ${e.message})\nHint: daemon may not be running. Run \`cc-candybar\` once to spawn it.`;switch(e.cause){case`version_mismatch`:{let t=e.daemonV===0?`unknown`:`v${e.daemonV}`;return`daemon protocol mismatch (client v${e.clientV} ≠ daemon ${t})`}case`bad_request`:case`render_failed`:case`malformed_response`:return`daemon error (${e.cause}): ${e.message}`}}const WT={connectMs:50,budgetMs:150},GT={connectMs:50,budgetMs:200};function KT(e){let t=e.output;return typeof t==`string`?t:void 0}function qT(e,t,n,r){return LT({kind:`render`,hookData:e,args:t,cwd:n,...r},WT,KT)}function JT(e,t){return LT({kind:`click`,verb:e,value:t},GT,KT)}let YT=null;function XT(e){if(YT!==null)return YT;r.mkdirSync(c.dirname(e),{recursive:!0});try{YT=r.statSync(e).size}catch{YT=0}return YT}function ZT(e){for(let t=2;t>=1;t--){let n=`${e}.${t}`,i=`${e}.${t+1}`;try{r.renameSync(n,i)}catch{}}try{r.renameSync(e,`${e}.1`)}catch{}YT=0}function Q(e,t){let n=`${new Date().toISOString()} [${e}] ${t}\n`;try{let e=qe(),t=XT(e);r.appendFileSync(e,n),YT=t+Buffer.byteLength(n,`utf8`),YT>=5242880&&ZT(e)}catch(e){YT=null;try{process.stderr.write(`${n}cc-candybar: daemon.log unwritable: ${e.message}\n`)}catch{}}}function QT(e){let t=[];for(let n of e){let e=n.read();if(e.kind===`text`)return`# memory report from: ${n.name}\n${e.text}`;t.push(`# ${n.name}: unavailable — ${e.reason}`)}return[`# memory report: no probe answered`,...t.length>0?t:[`# no probe is known for this platform`]].join(`
163
- `)}function $T(e,t){return e===`darwin`?[eE(`footprint`,[`-p`,String(t)]),eE(`vmmap`,[`--summary`,String(t)])]:e===`linux`?[tE(`/proc/self/smaps_rollup`),tE(`/proc/self/status`)]:[]}function eE(e,t){return{name:`${e} ${t.join(` `)}`,read:()=>{let n=Oe({bin:e,args:[...t],timeoutMs:5e3,category:`limits.memory-report`});return n.ok?n.stdout.trim().length>0?{kind:`text`,text:n.stdout}:{kind:`unavailable`,reason:`exited 0 but printed nothing`}:{kind:`unavailable`,reason:`${n.reason}${n.error===void 0?``:`: ${n.error}`}${nE(n.stderr)}`}}}}function tE(e){return{name:e,read:()=>{try{let t=r.readFileSync(e,`utf8`);return t.trim().length>0?{kind:`text`,text:t}:{kind:`unavailable`,reason:`empty file`}}catch(e){return{kind:`unavailable`,reason:e.message}}}}}function nE(e){let t=e.split(`
164
- `).map(e=>e.trim()).find(e=>e.length>0);return t===void 0?``:` (${t})`}const rE=`CC_CANDYBAR_RSS_LIMIT_MB`;function iE(e){let t=e[rE];if(t===void 0)return 512;let n=/^\d+$/.test(t)?Number(t):NaN;if(!Number.isSafeInteger(n)||n<=0)throw Error(`${rE} must be a positive integer (MB), got ${JSON.stringify(t)}`);return n}function aE(e){return iE(e)*2}const oE=1024*1024;function sE(e){return iE(e)*oE}const cE={memoryReport:{prefix:`memory-`,suffix:`.txt`},heapSnapshot:{prefix:`heap-`,suffix:`.heapsnapshot`}};function lE(e,t,n){let{prefix:r,suffix:i}=cE[t];return c.join(e,`${r}${n}${i}`)}function uE(e){for(let t of Object.keys(cE)){let{prefix:n,suffix:r}=cE[t];if(e.startsWith(n)&&e.endsWith(r))return t}return null}function dE(e){let t=e.rssLimitBytes??512*oE,n=e.snapshotsKeep??3,r=!1;function i(){if(r)return!0;let{rss:i,heapTotal:a}=e.memoryBytes();if(i<=t)return!1;r=!0,e.log(`warn`,`RSS ${i} > limit ${t} (v8 heap ${a}); recording memory then shutting down`);let o=`${new Date(e.now()).toISOString().replace(/[:.]/g,`-`)}-${e.pid}`;return fE(e.log,`memory report`,()=>{let t=lE(e.snapshotDir,`memoryReport`,o);e.writeMemoryReport(t,e.captureMemoryReport()),e.log(`info`,`memory report written: ${t}`)}),fE(e.log,`heap snapshot`,()=>{let t=lE(e.snapshotDir,`heapSnapshot`,o);e.log(`info`,`heap snapshot written: ${e.writeHeapSnapshot(t)}`)}),fE(e.log,`artifact rotation`,()=>{mE(e.listArtifacts(),n,e.removeFile)}),e.shutdown(0),!0}function a(){let{rss:n,heapTotal:r}=e.memoryBytes();return n>t*.75?`rss ${n} approaching limit ${t} (v8 heap ${r})`:null}function o(e=6e4){let t=setInterval(()=>{i()},e);return t.unref(),{disarm:()=>clearInterval(t)}}return{checkRss:i,describeNextRestart:a,arm:o}}function fE(e,t,n){try{n()}catch(n){e(`warn`,`${t} failed: ${n.message}`)}}function pE(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=uE(t);if(n===null)return t;let{prefix:r,suffix:i}=cE[n];return t.slice(r.length,t.length-i.length)}function mE(e,t,n){let r=new Map;for(let t of e){let e=pE(t),n=r.get(e);n===void 0?r.set(e,[t]):n.push(t)}let i=[...r.keys()].sort((e,t)=>t.localeCompare(e));for(let e of i.slice(t))for(let t of r.get(e)??[])try{n(t)}catch{}}function hE(e,t,n={}){let i=Pe();return{now:()=>Date.now(),pid:process.pid,snapshotDir:i,log:Q,memoryBytes:()=>{let e=process.memoryUsage();return{rss:e.rss,heapTotal:e.heapTotal}},captureMemoryReport:()=>QT($T(process.platform,process.pid)),writeMemoryReport:(e,t)=>r.writeFileSync(e,t,{mode:384}),writeHeapSnapshot:e=>te.writeHeapSnapshot(e),listArtifacts:()=>{try{return r.readdirSync(i).filter(e=>uE(e)!==null).map(e=>c.join(i,e))}catch{return[]}},removeFile:e=>r.unlinkSync(e),shutdown:t,startedAtMs:e,...n}}function gE(e={}){if(ME()!==null)return;let n=e.spawn??NE,r=kE();if(r.kind===`contended`){let e=vE();e!==null&&e>2e3&&(t.stderr.write(`cc-candybar: spawn-lock held ${e}ms (likely crashed holder) — spawning unlocked\n`),_E(n));return}if(r.kind===`error`){t.stderr.write(`cc-candybar: spawn-lock unavailable (${r.reason}) — spawning unlocked\n`),_E(n);return}try{_E(n)}finally{jE()}}function _E(e){TE()&&yE(e)}function vE(){try{let e=r.statSync(Ue());return Date.now()-e.mtimeMs}catch{return null}}function yE(e){try{e()||t.stderr.write(`cc-candybar: daemon spawn returned false (unable to resolve script path?)
165
- `)}catch(e){t.stderr.write(`cc-candybar: daemon spawn failed: ${e.message}\n`)}}function bE(e,t){return e===null?{kind:`allow`}:e<-1e4?{kind:`allow-future-garbage`,futureMs:-e}:e<t?{kind:`deny`}:{kind:`allow`}}function xE(e){return Math.min(3e3*2**Math.min(Math.max(e,0),5),6e4)}function SE(e){try{let t=r.readFileSync(e,`utf8`).trim(),n=Number(t);return!Number.isInteger(n)||n<0?0:Math.min(n,5)}catch{return 0}}function CE(e,n){try{r.mkdirSync(c.dirname(e),{recursive:!0}),r.writeFileSync(e,String(n),{mode:384})}catch(e){t.stderr.write(`cc-candybar: could not record spawn.backoff: ${e.message}\n`)}}function wE(){try{r.unlinkSync(Ge())}catch(e){e.code!==`ENOENT`&&t.stderr.write(`cc-candybar: could not reset spawn.backoff: ${e.message}\n`)}}function TE(){let e=We(),n=Ge(),r=SE(n),i=bE(EE(e),xE(r));return i.kind===`deny`?!1:(i.kind===`allow-future-garbage`&&t.stderr.write(`cc-candybar: spawn.cooldown mtime is ${i.futureMs}ms in the future — ignoring and spawning\n`),DE(e),CE(n,Math.min(r+1,5)),!0)}function EE(e){try{return Date.now()-r.statSync(e).mtimeMs}catch{return null}}function DE(e){try{r.mkdirSync(c.dirname(e),{recursive:!0}),r.writeFileSync(e,`${t.pid} ${Date.now()}\n`,{mode:384})}catch(e){t.stderr.write(`cc-candybar: could not record spawn.cooldown: ${e.message}\n`)}}let OE=null;function kE(){let e=Ue();for(let n=0;n<2;n++){try{let n=r.openSync(e,`wx`,384);try{r.writeSync(n,JSON.stringify({pid:t.pid,ts:Date.now()}))}catch{}return OE={fd:n,path:e},{kind:`held`}}catch(t){let n=t.code;if(n!==`EEXIST`)return{kind:`error`,reason:`openSync(${e}): ${n??t.message}`}}if(!AE(e))return{kind:`contended`};try{r.unlinkSync(e)}catch(e){if(e.code!==`ENOENT`)return{kind:`error`,reason:`unlink stale spawn.lock: ${e.message}`}}}return{kind:`contended`}}function AE(e){try{let t=r.statSync(e);return Date.now()-t.mtimeMs>1e4}catch{return!0}}function jE(){if(!OE)return;let{fd:e,path:t}=OE;OE=null;try{r.closeSync(e)}catch{}try{r.unlinkSync(t)}catch{}}function ME(){try{return r.mkdirSync(Pe(),{recursive:!0}),null}catch(e){return`mkdir ${Pe()}: ${e.message}`}}function NE(){let e=t.execPath,n=t.argv[1];return n?ke({bin:e,args:[`--max-old-space-size=${aE(t.env)}`,n,`daemon`],category:`daemon-spawn`}).ok:!1}const PE=`cc-candybar`,FE=`dispatch`,IE=`set-state`,LE=`step-state`,RE=`copy`,zE=`open-vscode`,BE=`toolbar-toggle`,VE=`show-config-error`,HE=`show-config-warning`,UE=`set-config`,WE=`step-config`,GE=`save`,KE=`save-preset`,qE=`delete-preset`,JE=`reset-config`,YE=`apply-layout-op`,XE=`undo`,ZE=`redo`,QE=`back`,$E=`rewind`,eD=`apply-update`,tD=`doctor-run`,nD=`doctor-fix`,rD=`ceiling`,iD=`slash`;function aD(e){return e.map(encodeURIComponent).join(`/`)}function oD(e){return e.length===0?[]:e.split(`/`).map(decodeURIComponent)}function sD(e){return`${PE}://${FE}/${e.map(e=>`e=${encodeURIComponent(`${e.verb}/${aD(e.args)}`)}`).join(`&`)}`}function cD(e){return new ne(e).getAll(`e`).map(fD)}const lD=new Set([IE,JE]);function uD(e){return e.reduce((e,t)=>{let n=e.at(-1),r=n&&dD(n,t);return r?[...e.slice(0,-1),r]:[...e,t]},[])}function dD(e,t){if(e.verb!==t.verb||!lD.has(e.verb))return;let[n,r]=[fD(e.value),fD(t.value)];return n.verb===r.verb?{verb:e.verb,value:`${n.verb}/${n.value}/${r.value}`}:void 0}function fD(e){let t=e.indexOf(`/`);return t===-1?{verb:e,value:``}:{verb:e.slice(0,t),value:e.slice(t+1)}}const pD=`1.109.0`,mD=/^[A-Za-z0-9_./,:@%+-][A-Za-z0-9_./,:@%+=-]*$/;function hD(e){return`'${e.replaceAll(`'`,`'\\''`)}'`}function gD(e){return mD.test(e)?e:hD(e)}function _D(e,t){let n=(e.CLAUDE_CONFIG_DIR??``).split(`,`)[0].trim();return n===``?void 0:c.resolve(t,n)}function vD(e){return e??c.join(m.homedir(),`.claude`)}function yD(e){return c.join(e,`settings.json`)}function bD(e){return c.join(e,`plugins`,`installed_plugins.json`)}function xD(e){return r.existsSync(e)?r.readFileSync(e,`utf8`):``}function SD(e){let t;try{let n=xD(e);if(/^\s*$/.test(n))return{};t=Go.parse(n)}catch(t){throw Error(`cannot read ${e}: ${CD(t)}`,{cause:t})}if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`cannot read ${e}: not a JSON object`);return t}const CD=e=>e instanceof Error?e.message:String(e),wD=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;function TD(e){let t=wD.exec(e);return t?{kind:`ok`,value:[Number(t[1]),Number(t[2]),Number(t[3])]}:{kind:`failed`,reason:`"${e}" is not a release version (expected MAJOR.MINOR.PATCH)`}}function ED(e){return e.join(`.`)}function DD([e,t,n],[r,i,a]){return e-r||t-i||n-a}const OD=`@promptctl/cc-candybar`;async function kD(e,t,n){let r=`${n}/-/package/${encodeURIComponent(e)}/dist-tags`;try{let e=await t(r,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return X(`registry responded ${e.status} for ${r}`);let n=await e.json();return typeof n.latest==`string`?TD(n.latest):Y}catch(e){return X(e instanceof Error?e.message:String(e))}}function AD(e,t){let n=TD(e);if(n.kind===`failed`)return{kind:`unchecked`,installed:e,reason:n.reason};switch(t.kind){case`failed`:return{kind:`unchecked`,installed:e,reason:t.reason};case`absent`:return{kind:`unchecked`,installed:e,reason:"the registry lists no `latest` dist-tag"};case`ok`:{let e=DD(n.value,t.value);return e<0?{kind:`stale`,installed:n.value,latest:t.value}:e>0?{kind:`ahead`,installed:n.value,latest:t.value}:{kind:`current`,installed:n.value}}}}function jD(e,t){switch(t.kind){case`current`:return{stream:`stdout`,text:`✓ cc-candybar ${ED(t.installed)} is the latest release.\n`};case`ahead`:return{stream:`stdout`,text:`cc-candybar ${ED(t.installed)} is newer than the registry's latest release (${ED(t.latest)}): an unpublished build.\n`};case`stale`:{let n=ED(t.latest);return{stream:`stderr`,text:`⚠ cc-candybar ${ED(t.installed)} was staged, but the latest release is ${n}.\n pnpm's release-age gate (minimumReleaseAge) and its dlx cache can both\n resolve \`@latest\` to an older release without saying so.\n To install ${n} now, name it explicitly:\n pnpm dlx ${e}@${n} install\n`}}case`unchecked`:return{stream:`stderr`,text:`⚠ Could not check for a cc-candybar release newer than ${t.installed} (${t.reason}); the registry check was skipped.\n`}}}const MD=`CCCandybarURLHandler`,ND=[],PD={"darwin-arm64":`@promptctl/cc-candybar-darwin-arm64`,"darwin-x64":`@promptctl/cc-candybar-darwin-x64`,"linux-x64":`@promptctl/cc-candybar-linux-x64`,"linux-arm64":`@promptctl/cc-candybar-linux-arm64`};function FD(e,t){return[e,...t].map(gD).join(` `)}function ID(){return c.join(m.homedir(),`Applications`,`${MD}.app`)}function LD(){if(process.platform!==`darwin`)throw Error(`URL handler installation requires macOS (found platform: ${process.platform}).`)}function RD(){if(process.platform===`darwin`)return c.join(m.homedir(),`Library`,`Application Support`,`CCCandybar`);let e=process.env.XDG_DATA_HOME??c.join(m.homedir(),`.local`,`share`);return c.join(e,`cc-candybar`)}function zD(){return c.join(RD(),`bin`,`cc-candybar`)}function BD(){return c.join(RD(),`dist`,`index.mjs`)}function VD(e,t){return[`on open location L`,`\tdo shell script "'${e.replace(/"/g,`\\"`)}' '${t.replace(/"/g,`\\"`)}' url-handle " & quoted form of L`,`end open location`].join(`
166
- `)}function HD(e){if(!e)throw Error(`install: process.argv[1] not set`);return e.endsWith(`.mjs`)||e.endsWith(`.js`)?e:c.resolve(c.dirname(e),`..`,`dist`,`index.mjs`)}function UD(t){let n=PD[`${process.platform}-${process.arch}`];if(n){let r=e(t);try{return{kind:`native`,sourcePath:r.resolve(`${n}/bin/cc-candybar`)}}catch{}}return{kind:`node-shim`,sourcePath:c.resolve(c.dirname(t),`..`,`bin`,`cc-candybar`)}}function WD(e,t){c.resolve(e)!==c.resolve(t)&&r.copyFileSync(e,t)}function GD(e){let t=r.openSync(e,`r`);try{let n=Buffer.alloc(2),i=r.readSync(t,n,0,2,0);if(i<2)throw Error(`install: staged render entry at ${e} is truncated (${i} byte(s)). Re-run: pnpm dlx ${OD}@latest install`);return n.toString(`latin1`)===`#!`?`node-shim`:`native`}finally{r.closeSync(t)}}function KD(){let e=HD(process.argv[1]);if(!r.existsSync(e))throw Error(`install: bundled dist not found at ${e}. Reinstall the package.`);let t=UD(e);if(!r.existsSync(t.sourcePath))throw Error(`install: render entry not found at ${t.sourcePath}. Reinstall the package.`);r.mkdirSync(c.dirname(BD()),{recursive:!0}),r.mkdirSync(c.dirname(zD()),{recursive:!0}),WD(e,BD()),WD(t.sourcePath,zD()),r.chmodSync(zD(),493),r.rmSync(c.join(RD(),`url-handler.mjs`),{force:!0});let n=GD(zD());return process.stdout.write(`Staged cc-candybar v${pD} runtime at ${RD()}\n`+(n===`native`?` render entry: native binary (${process.platform}-${process.arch})\n`:` render entry: node shim (no native binary for ${process.platform}-${process.arch}; renders are correct but pay node startup)\n`)),{binPath:zD(),distPath:BD(),entryKind:n}}function qD(){return[{key:`CFBundleIdentifier`,xml:`<string>com.cccandybar.url-handler</string>`},{key:`CFBundleURLTypes`,xml:[`<array>`,` <dict>`,` <key>CFBundleURLName</key>`,` <string>Claude Powerline Click Action</string>`,` <key>CFBundleURLSchemes</key>`,` <array>`,` <string>${PE}</string>`,` </array>`,` </dict>`,`</array>`].join(`
167
- `)}]}function JD(e){let t=ID();r.mkdirSync(c.dirname(t),{recursive:!0}),r.existsSync(t)&&r.rmSync(t,{recursive:!0,force:!0}),process.stdout.write(`Building ${t}\n`);let n=Oe({bin:`/usr/bin/osacompile`,args:[`-o`,t,`-e`,VD(process.execPath,e)],category:`install.osacompile`});if(!n.ok)throw process.stderr.write(n.stderr),Error(`osacompile failed (${n.reason})`);let i=c.join(t,`Contents`,`Info.plist`);for(let{key:e}of qD())Oe({bin:`/usr/bin/plutil`,args:[`-remove`,e,i],category:`install.plutil`});for(let{key:e,xml:t}of qD()){let n=Oe({bin:`/usr/bin/plutil`,args:[`-insert`,e,`-xml`,t,i],category:`install.plutil`});if(!n.ok)throw process.stderr.write(n.stderr),Error(`plutil -insert ${e} failed (${n.reason})`)}process.stdout.write(`Registering ${PE}:// with Launch Services\n`);let a=Oe({bin:`/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister`,args:[`-f`,t],category:`install.lsregister`});if(!a.ok)throw process.stderr.write(a.stderr),Error(`lsregister failed (${a.reason})`);process.stdout.write(`✓ ${MD}.app installed and registered.\n`),process.stdout.write(` Test: open '${PE}://hello-world' && pbpaste\n`)}function YD(){LD(),JD(KD().distPath)}function XD(e,t=PE){let n=`${t}://`;if(!e.startsWith(n))throw Error(`expected ${n} scheme, got: ${e}`);let r=e.slice(n.length),i=r.indexOf(`/`);return i===-1?{verb:RE,value:r}:{verb:decodeURIComponent(r.slice(0,i)),value:r.slice(i+1)}}async function ZD(e){e||(process.stderr.write(`url-handle: missing URL argument.
168
- `),process.exit(1));let t;try{t=XD(e)}catch(e){process.stderr.write(`url-handle: ${e instanceof Error?e.message:String(e)}\n`),process.exit(1)}let n=await JT(t.verb,t.value);n.kind===`ok`&&process.exit(0),n.kind===`transient`&&(gE(),process.stderr.write(`url-handle: daemon unavailable (${n.cause}: ${n.message})\n`),process.exit(1)),process.stderr.write(QD(n)+`
169
- `),process.exit(1)}function QD(e){switch(e.cause){case`version_mismatch`:return`url-handle: daemon rejected click (version mismatch: client v${e.clientV} ≠ daemon v${e.daemonV})`;case`bad_request`:return`url-handle: daemon rejected click (bad request: ${e.message})`;case`render_failed`:return`url-handle: daemon rejected click (handler failed: ${e.message})`;case`malformed_response`:return`url-handle: daemon rejected click (malformed response: ${e.message})`}}function $D(){return`✓ install complete.
162
+ Single-row example: root: { h: ["seg1", "seg2"] }`,line:G(e.source,[`layout`])}),t.root!==void 0&&(r.root=ld(e,`root`,t.root)),t.actions!==void 0&&(r.actions=qC(e,t.actions)),t.looks!==void 0&&e.issues.push({path:`looks`,message:`"looks" was renamed "styles" — move the block under styles: { … } (and globals.look to globals.style)`,line:G(e.source,[`looks`])}),t.styles!==void 0&&(r.styles=Lw(e,t.styles)),t.presets!==void 0&&(r.presets=zw(e,t.presets)),t.editGlobals!==void 0&&(r.editGlobals=wl(e,`editGlobals`,t.editGlobals)),t.helpers!==void 0&&(r.helpers=Bw(e,t.helpers)),_d(e,r),R_(e,r),ev(e,r),Cu(e,r,yu,`the global settings menu`),r}const AT=new Set([`globals`,`variables`,`segments`,`layout`,`looks`,`root`,`actions`,`styles`,`presets`,`editGlobals`,`helpers`]);function jT(e){let t=LT(e.termCols),n=LT(e.termRows),r=RT(e.ssh),i=FT(e.tmux),a=PT(e.configEnv),o=NT(e.claudeConfigDir),s=MT(e.mementoEnv);return{...t!==void 0&&{termCols:t},...n!==void 0&&{termRows:n},...r!==void 0&&{ssh:r},...i!==void 0&&{tmux:i},...a!==void 0&&{configEnv:a},...o!==void 0&&{claudeConfigDir:o},...s!==void 0&&{mementoEnv:s}}}function MT(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n=Je.filter(e=>t[e]!==void 0);return n.every(e=>NT(t[e])!==void 0)?Object.fromEntries(n.map(e=>[e,t[e]])):void 0}function NT(e){return typeof e==`string`&&c.isAbsolute(e)?e:void 0}function PT(e){return typeof e==`string`&&e!==``?pT(e):void 0}function FT(e){if(e===null)return null;if(typeof e!=`object`)return;let{socket:t,pane:n,truecolor:r}=e;if(!(typeof t!=`string`||t===``)&&!(typeof n!=`string`||n===``)&&!(r!==null&&(typeof r!=`string`||r===``)))return{socket:t,pane:n,truecolor:r}}const IT=1e4;function LT(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.floor(e);if(!(t<=0))return t>IT?IT:t}function RT(e){return typeof e==`boolean`?e:void 0}var zT=class extends Error{constructor(e){super(e),this.name=`ProtocolError`}};function BT(e){let t=Buffer.from(JSON.stringify(e),`utf8`),n=Buffer.alloc(4);return n.writeUInt32BE(t.length,0),Buffer.concat([n,t])}function VT(e,t){let n=Buffer.alloc(0);return function(r){for(n=Buffer.concat([n,r]);n.length>=4;){let r=n.readUInt32BE(0);if(r>16777216){t(new zT(`frame too large: ${r}`));return}if(n.length<4+r)return;let i=n.subarray(4,4+r);n=n.subarray(4+r);try{e(JSON.parse(i.toString(`utf8`)))}catch(e){let n=new zT(e instanceof Error?e.message:String(e));e instanceof Error&&(n.cause=e),t(n);return}}}}function HT(e,t,n){return new Promise((r,i)=>{let a=!1,o=t=>{if(!a){a=!0,clearTimeout(s),e.removeAllListeners();try{t()}catch{}}},s=setTimeout(()=>{o(()=>{e.destroy(),i(Error(`TIMEOUT`))})},n),c=VT(e=>o(()=>r(e)),e=>o(()=>i(e)));e.on(`data`,c),e.on(`error`,e=>o(()=>i(e))),e.on(`close`,()=>o(()=>i(Error(`socket closed before response`)))),e.write(BT(t))})}async function UT(e,t,n){let r=null;try{r=await JT(Fe(),t.connectMs);let i=await HT(r,{v:3,...e},t.budgetMs);return KT(e.kind,i,n)}catch(e){return qT(e)}finally{r&&r.destroy()}}function WT(e,t){return typeof e==`string`?e:t}function GT(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0?e:0}function KT(e,t,n){let r=t;if(r.ok===!0){let r=n(t);return r===void 0?{kind:`permanent`,cause:`malformed_response`,message:`ok response without payload for "${e}" request`}:{kind:`ok`,value:r}}let i=WT(r.error,`(no error message)`);switch(r.code){case`VERSION_MISMATCH`:return{kind:`permanent`,cause:`version_mismatch`,clientV:3,daemonV:GT(r.daemonV)};case`TIMEOUT`:return{kind:`transient`,cause:`timeout`,message:i};case`BAD_REQUEST`:return{kind:`permanent`,cause:`bad_request`,message:i};case`RENDER_FAILED`:return{kind:`permanent`,cause:`render_failed`,message:i};default:return{kind:`permanent`,cause:`malformed_response`,message:`unknown error code: ${String(r.code)}`}}}function qT(e){if(e instanceof zT||e instanceof SyntaxError)return{kind:`permanent`,cause:`malformed_response`,message:e instanceof Error?e.message:String(e)};let t=e instanceof Error?e.message:String(e);return t===`CONNECT_TIMEOUT`||t===`TIMEOUT`?{kind:`transient`,cause:`timeout`,message:t}:t.includes(`ECONNREFUSED`)||t.includes(`ENOENT`)||t.includes(`ENOTSOCK`)?{kind:`transient`,cause:`unreachable`,message:t}:{kind:`transient`,cause:`io_error`,message:t}}function JT(e,t){return new Promise((n,r)=>{let i=b.createConnection({path:e}),a=setTimeout(()=>{i.destroy(),r(Error(`CONNECT_TIMEOUT`))},t);i.once(`connect`,()=>{clearTimeout(a),n(i)}),i.once(`error`,e=>{clearTimeout(a),r(e)})})}function YT(e){if(e.kind===`transient`)return`daemon unavailable (${e.cause}: ${e.message})\nHint: daemon may not be running. Run \`cc-candybar\` once to spawn it.`;switch(e.cause){case`version_mismatch`:{let t=e.daemonV===0?`unknown`:`v${e.daemonV}`;return`daemon protocol mismatch (client v${e.clientV} ≠ daemon ${t})`}case`bad_request`:case`render_failed`:case`malformed_response`:return`daemon error (${e.cause}): ${e.message}`}}const XT={connectMs:50,budgetMs:150},ZT={connectMs:50,budgetMs:200};function QT(e){let t=e.output;return typeof t==`string`?t:void 0}function $T(e,t,n,r){return UT({kind:`render`,hookData:e,args:t,cwd:n,...r},XT,QT)}function eE(e,t){return UT({kind:`click`,verb:e,value:t},ZT,QT)}let tE=null;function nE(e){if(tE!==null)return tE;r.mkdirSync(c.dirname(e),{recursive:!0});try{tE=r.statSync(e).size}catch{tE=0}return tE}function rE(e){for(let t=2;t>=1;t--){let n=`${e}.${t}`,i=`${e}.${t+1}`;try{r.renameSync(n,i)}catch{}}try{r.renameSync(e,`${e}.1`)}catch{}tE=0}function Q(e,t){let n=`${new Date().toISOString()} [${e}] ${t}\n`;try{let e=qe(),t=nE(e);r.appendFileSync(e,n),tE=t+Buffer.byteLength(n,`utf8`),tE>=5242880&&rE(e)}catch(e){tE=null;try{process.stderr.write(`${n}cc-candybar: daemon.log unwritable: ${e.message}\n`)}catch{}}}function iE(e){let t=[];for(let n of e){let e=n.read();if(e.kind===`text`)return`# memory report from: ${n.name}\n${e.text}`;t.push(`# ${n.name}: unavailable — ${e.reason}`)}return[`# memory report: no probe answered`,...t.length>0?t:[`# no probe is known for this platform`]].join(`
163
+ `)}function aE(e,t){return e===`darwin`?[oE(`footprint`,[`-p`,String(t)]),oE(`vmmap`,[`--summary`,String(t)])]:e===`linux`?[sE(`/proc/self/smaps_rollup`),sE(`/proc/self/status`)]:[]}function oE(e,t){return{name:`${e} ${t.join(` `)}`,read:()=>{let n=Oe({bin:e,args:[...t],timeoutMs:5e3,category:`limits.memory-report`});return n.ok?n.stdout.trim().length>0?{kind:`text`,text:n.stdout}:{kind:`unavailable`,reason:`exited 0 but printed nothing`}:{kind:`unavailable`,reason:`${n.reason}${n.error===void 0?``:`: ${n.error}`}${cE(n.stderr)}`}}}}function sE(e){return{name:e,read:()=>{try{let t=r.readFileSync(e,`utf8`);return t.trim().length>0?{kind:`text`,text:t}:{kind:`unavailable`,reason:`empty file`}}catch(e){return{kind:`unavailable`,reason:e.message}}}}}function cE(e){let t=e.split(`
164
+ `).map(e=>e.trim()).find(e=>e.length>0);return t===void 0?``:` (${t})`}const lE=`CC_CANDYBAR_RSS_LIMIT_MB`;function uE(e){let t=e[lE];if(t===void 0)return 512;let n=/^\d+$/.test(t)?Number(t):NaN;if(!Number.isSafeInteger(n)||n<=0)throw Error(`${lE} must be a positive integer (MB), got ${JSON.stringify(t)}`);return n}function dE(e){return uE(e)*2}const fE=1024*1024;function pE(e){return uE(e)*fE}const mE={memoryReport:{prefix:`memory-`,suffix:`.txt`},heapSnapshot:{prefix:`heap-`,suffix:`.heapsnapshot`}};function hE(e,t,n){let{prefix:r,suffix:i}=mE[t];return c.join(e,`${r}${n}${i}`)}function gE(e){for(let t of Object.keys(mE)){let{prefix:n,suffix:r}=mE[t];if(e.startsWith(n)&&e.endsWith(r))return t}return null}function _E(e){let t=e.rssLimitBytes??512*fE,n=e.snapshotsKeep??3,r=!1;function i(){if(r)return!0;let{rss:i,heapTotal:a}=e.memoryBytes();if(i<=t)return!1;r=!0,e.log(`warn`,`RSS ${i} > limit ${t} (v8 heap ${a}); recording memory then shutting down`);let o=`${new Date(e.now()).toISOString().replace(/[:.]/g,`-`)}-${e.pid}`;return vE(e.log,`memory report`,()=>{let t=hE(e.snapshotDir,`memoryReport`,o);e.writeMemoryReport(t,e.captureMemoryReport()),e.log(`info`,`memory report written: ${t}`)}),vE(e.log,`heap snapshot`,()=>{let t=hE(e.snapshotDir,`heapSnapshot`,o);e.log(`info`,`heap snapshot written: ${e.writeHeapSnapshot(t)}`)}),vE(e.log,`artifact rotation`,()=>{bE(e.listArtifacts(),n,e.removeFile)}),e.shutdown(0),!0}function a(){let{rss:n,heapTotal:r}=e.memoryBytes();return n>t*.75?`rss ${n} approaching limit ${t} (v8 heap ${r})`:null}function o(e=6e4){let t=setInterval(()=>{i()},e);return t.unref(),{disarm:()=>clearInterval(t)}}return{checkRss:i,describeNextRestart:a,arm:o}}function vE(e,t,n){try{n()}catch(n){e(`warn`,`${t} failed: ${n.message}`)}}function yE(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=gE(t);if(n===null)return t;let{prefix:r,suffix:i}=mE[n];return t.slice(r.length,t.length-i.length)}function bE(e,t,n){let r=new Map;for(let t of e){let e=yE(t),n=r.get(e);n===void 0?r.set(e,[t]):n.push(t)}let i=[...r.keys()].sort((e,t)=>t.localeCompare(e));for(let e of i.slice(t))for(let t of r.get(e)??[])try{n(t)}catch{}}function xE(e,t,n={}){let i=Pe();return{now:()=>Date.now(),pid:process.pid,snapshotDir:i,log:Q,memoryBytes:()=>{let e=process.memoryUsage();return{rss:e.rss,heapTotal:e.heapTotal}},captureMemoryReport:()=>iE(aE(process.platform,process.pid)),writeMemoryReport:(e,t)=>r.writeFileSync(e,t,{mode:384}),writeHeapSnapshot:e=>te.writeHeapSnapshot(e),listArtifacts:()=>{try{return r.readdirSync(i).filter(e=>gE(e)!==null).map(e=>c.join(i,e))}catch{return[]}},removeFile:e=>r.unlinkSync(e),shutdown:t,startedAtMs:e,...n}}function SE(e={}){if(RE()!==null)return;let n=e.spawn??zE,r=FE();if(r.kind===`contended`){let e=wE();e!==null&&e>2e3&&(t.stderr.write(`cc-candybar: spawn-lock held ${e}ms (likely crashed holder) — spawning unlocked\n`),CE(n));return}if(r.kind===`error`){t.stderr.write(`cc-candybar: spawn-lock unavailable (${r.reason}) — spawning unlocked\n`),CE(n);return}try{CE(n)}finally{LE()}}function CE(e){jE()&&TE(e)}function wE(){try{let e=r.statSync(Ue());return Date.now()-e.mtimeMs}catch{return null}}function TE(e){try{e()||t.stderr.write(`cc-candybar: daemon spawn returned false (unable to resolve script path?)
165
+ `)}catch(e){t.stderr.write(`cc-candybar: daemon spawn failed: ${e.message}\n`)}}function EE(e,t){return e===null?{kind:`allow`}:e<-1e4?{kind:`allow-future-garbage`,futureMs:-e}:e<t?{kind:`deny`}:{kind:`allow`}}function DE(e){return Math.min(3e3*2**Math.min(Math.max(e,0),5),6e4)}function OE(e){try{let t=r.readFileSync(e,`utf8`).trim(),n=Number(t);return!Number.isInteger(n)||n<0?0:Math.min(n,5)}catch{return 0}}function kE(e,n){try{r.mkdirSync(c.dirname(e),{recursive:!0}),r.writeFileSync(e,String(n),{mode:384})}catch(e){t.stderr.write(`cc-candybar: could not record spawn.backoff: ${e.message}\n`)}}function AE(){try{r.unlinkSync(Ge())}catch(e){e.code!==`ENOENT`&&t.stderr.write(`cc-candybar: could not reset spawn.backoff: ${e.message}\n`)}}function jE(){let e=We(),n=Ge(),r=OE(n),i=EE(ME(e),DE(r));return i.kind===`deny`?!1:(i.kind===`allow-future-garbage`&&t.stderr.write(`cc-candybar: spawn.cooldown mtime is ${i.futureMs}ms in the future — ignoring and spawning\n`),NE(e),kE(n,Math.min(r+1,5)),!0)}function ME(e){try{return Date.now()-r.statSync(e).mtimeMs}catch{return null}}function NE(e){try{r.mkdirSync(c.dirname(e),{recursive:!0}),r.writeFileSync(e,`${t.pid} ${Date.now()}\n`,{mode:384})}catch(e){t.stderr.write(`cc-candybar: could not record spawn.cooldown: ${e.message}\n`)}}let PE=null;function FE(){let e=Ue();for(let n=0;n<2;n++){try{let n=r.openSync(e,`wx`,384);try{r.writeSync(n,JSON.stringify({pid:t.pid,ts:Date.now()}))}catch{}return PE={fd:n,path:e},{kind:`held`}}catch(t){let n=t.code;if(n!==`EEXIST`)return{kind:`error`,reason:`openSync(${e}): ${n??t.message}`}}if(!IE(e))return{kind:`contended`};try{r.unlinkSync(e)}catch(e){if(e.code!==`ENOENT`)return{kind:`error`,reason:`unlink stale spawn.lock: ${e.message}`}}}return{kind:`contended`}}function IE(e){try{let t=r.statSync(e);return Date.now()-t.mtimeMs>1e4}catch{return!0}}function LE(){if(!PE)return;let{fd:e,path:t}=PE;PE=null;try{r.closeSync(e)}catch{}try{r.unlinkSync(t)}catch{}}function RE(){try{return r.mkdirSync(Pe(),{recursive:!0}),null}catch(e){return`mkdir ${Pe()}: ${e.message}`}}function zE(){let e=t.execPath,n=t.argv[1];return n?ke({bin:e,args:[`--max-old-space-size=${dE(t.env)}`,n,`daemon`],category:`daemon-spawn`}).ok:!1}const BE=`cc-candybar`,VE=`dispatch`,HE=`set-state`,UE=`step-state`,WE=`copy`,GE=`open-vscode`,KE=`toolbar-toggle`,qE=`show-config-error`,JE=`show-config-warning`,YE=`set-config`,XE=`step-config`,ZE=`save`,QE=`save-preset`,$E=`delete-preset`,eD=`reset-config`,tD=`apply-layout-op`,nD=`undo`,rD=`redo`,iD=`back`,aD=`rewind`,oD=`apply-update`,sD=`doctor-run`,cD=`doctor-fix`,lD=`ceiling`,uD=`slash`;function dD(e){return e.map(encodeURIComponent).join(`/`)}function fD(e){return e.length===0?[]:e.split(`/`).map(decodeURIComponent)}function pD(e){return`${BE}://${VE}/${e.map(e=>`e=${encodeURIComponent(`${e.verb}/${dD(e.args)}`)}`).join(`&`)}`}function mD(e){return new ne(e).getAll(`e`).map(vD)}const hD=new Set([HE,eD]);function gD(e){return e.reduce((e,t)=>{let n=e.at(-1),r=n&&_D(n,t);return r?[...e.slice(0,-1),r]:[...e,t]},[])}function _D(e,t){if(e.verb!==t.verb||!hD.has(e.verb))return;let[n,r]=[vD(e.value),vD(t.value)];return n.verb===r.verb?{verb:e.verb,value:`${n.verb}/${n.value}/${r.value}`}:void 0}function vD(e){let t=e.indexOf(`/`);return t===-1?{verb:e,value:``}:{verb:e.slice(0,t),value:e.slice(t+1)}}const yD=`1.110.0`,bD=/^[A-Za-z0-9_./,:@%+-][A-Za-z0-9_./,:@%+=-]*$/;function xD(e){return`'${e.replaceAll(`'`,`'\\''`)}'`}function SD(e){return bD.test(e)?e:xD(e)}function CD(e,t){let n=(e.CLAUDE_CONFIG_DIR??``).split(`,`)[0].trim();return n===``?void 0:c.resolve(t,n)}function wD(e){return e??c.join(m.homedir(),`.claude`)}function TD(e){return c.join(e,`settings.json`)}function ED(e){return c.join(e,`plugins`,`installed_plugins.json`)}function DD(e){return r.existsSync(e)?r.readFileSync(e,`utf8`):``}function OD(e){let t;try{let n=DD(e);if(/^\s*$/.test(n))return{};t=Uo.parse(n)}catch(t){throw Error(`cannot read ${e}: ${kD(t)}`,{cause:t})}if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`cannot read ${e}: not a JSON object`);return t}const kD=e=>e instanceof Error?e.message:String(e),AD=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/;function jD(e){let t=AD.exec(e);return t?{kind:`ok`,value:[Number(t[1]),Number(t[2]),Number(t[3])]}:{kind:`failed`,reason:`"${e}" is not a release version (expected MAJOR.MINOR.PATCH)`}}function MD(e){return e.join(`.`)}function ND([e,t,n],[r,i,a]){return e-r||t-i||n-a}const PD=`@promptctl/cc-candybar`;async function FD(e,t,n){let r=`${n}/-/package/${encodeURIComponent(e)}/dist-tags`;try{let e=await t(r,{signal:AbortSignal.timeout(5e3)});if(!e.ok)return X(`registry responded ${e.status} for ${r}`);let n=await e.json();return typeof n.latest==`string`?jD(n.latest):Y}catch(e){return X(e instanceof Error?e.message:String(e))}}function ID(e,t){let n=jD(e);if(n.kind===`failed`)return{kind:`unchecked`,installed:e,reason:n.reason};switch(t.kind){case`failed`:return{kind:`unchecked`,installed:e,reason:t.reason};case`absent`:return{kind:`unchecked`,installed:e,reason:"the registry lists no `latest` dist-tag"};case`ok`:{let e=ND(n.value,t.value);return e<0?{kind:`stale`,installed:n.value,latest:t.value}:e>0?{kind:`ahead`,installed:n.value,latest:t.value}:{kind:`current`,installed:n.value}}}}function LD(e,t){switch(t.kind){case`current`:return{stream:`stdout`,text:`✓ cc-candybar ${MD(t.installed)} is the latest release.\n`};case`ahead`:return{stream:`stdout`,text:`cc-candybar ${MD(t.installed)} is newer than the registry's latest release (${MD(t.latest)}): an unpublished build.\n`};case`stale`:{let n=MD(t.latest);return{stream:`stderr`,text:`⚠ cc-candybar ${MD(t.installed)} was staged, but the latest release is ${n}.\n pnpm's release-age gate (minimumReleaseAge) and its dlx cache can both\n resolve \`@latest\` to an older release without saying so.\n To install ${n} now, name it explicitly:\n pnpm dlx ${e}@${n} install\n`}}case`unchecked`:return{stream:`stderr`,text:`⚠ Could not check for a cc-candybar release newer than ${t.installed} (${t.reason}); the registry check was skipped.\n`}}}const RD=`CCCandybarURLHandler`,zD=[],BD={"darwin-arm64":`@promptctl/cc-candybar-darwin-arm64`,"darwin-x64":`@promptctl/cc-candybar-darwin-x64`,"linux-x64":`@promptctl/cc-candybar-linux-x64`,"linux-arm64":`@promptctl/cc-candybar-linux-arm64`};function VD(e,t){return[e,...t].map(SD).join(` `)}function HD(){return c.join(m.homedir(),`Applications`,`${RD}.app`)}function UD(){if(process.platform!==`darwin`)throw Error(`URL handler installation requires macOS (found platform: ${process.platform}).`)}function WD(){if(process.platform===`darwin`)return c.join(m.homedir(),`Library`,`Application Support`,`CCCandybar`);let e=process.env.XDG_DATA_HOME??c.join(m.homedir(),`.local`,`share`);return c.join(e,`cc-candybar`)}function GD(){return c.join(WD(),`bin`,`cc-candybar`)}function KD(){return c.join(WD(),`dist`,`index.mjs`)}function qD(e,t){return[`on open location L`,`\tdo shell script "'${e.replace(/"/g,`\\"`)}' '${t.replace(/"/g,`\\"`)}' url-handle " & quoted form of L`,`end open location`].join(`
166
+ `)}function JD(e){if(!e)throw Error(`install: process.argv[1] not set`);return e.endsWith(`.mjs`)||e.endsWith(`.js`)?e:c.resolve(c.dirname(e),`..`,`dist`,`index.mjs`)}function YD(t){let n=BD[`${process.platform}-${process.arch}`];if(n){let r=e(t);try{return{kind:`native`,sourcePath:r.resolve(`${n}/bin/cc-candybar`)}}catch{}}return{kind:`node-shim`,sourcePath:c.resolve(c.dirname(t),`..`,`bin`,`cc-candybar`)}}function XD(e,t){c.resolve(e)!==c.resolve(t)&&r.copyFileSync(e,t)}function ZD(e){let t=r.openSync(e,`r`);try{let n=Buffer.alloc(2),i=r.readSync(t,n,0,2,0);if(i<2)throw Error(`install: staged render entry at ${e} is truncated (${i} byte(s)). Re-run: pnpm dlx ${PD}@latest install`);return n.toString(`latin1`)===`#!`?`node-shim`:`native`}finally{r.closeSync(t)}}function QD(){let e=JD(process.argv[1]);if(!r.existsSync(e))throw Error(`install: bundled dist not found at ${e}. Reinstall the package.`);let t=YD(e);if(!r.existsSync(t.sourcePath))throw Error(`install: render entry not found at ${t.sourcePath}. Reinstall the package.`);r.mkdirSync(c.dirname(KD()),{recursive:!0}),r.mkdirSync(c.dirname(GD()),{recursive:!0}),XD(e,KD()),XD(t.sourcePath,GD()),r.chmodSync(GD(),493),r.rmSync(c.join(WD(),`url-handler.mjs`),{force:!0});let n=ZD(GD());return process.stdout.write(`Staged cc-candybar v${yD} runtime at ${WD()}\n`+(n===`native`?` render entry: native binary (${process.platform}-${process.arch})\n`:` render entry: node shim (no native binary for ${process.platform}-${process.arch}; renders are correct but pay node startup)\n`)),{binPath:GD(),distPath:KD(),entryKind:n}}function $D(){return[{key:`CFBundleIdentifier`,xml:`<string>com.cccandybar.url-handler</string>`},{key:`CFBundleURLTypes`,xml:[`<array>`,` <dict>`,` <key>CFBundleURLName</key>`,` <string>Claude Powerline Click Action</string>`,` <key>CFBundleURLSchemes</key>`,` <array>`,` <string>${BE}</string>`,` </array>`,` </dict>`,`</array>`].join(`
167
+ `)}]}function eO(e){let t=HD();r.mkdirSync(c.dirname(t),{recursive:!0}),r.existsSync(t)&&r.rmSync(t,{recursive:!0,force:!0}),process.stdout.write(`Building ${t}\n`);let n=Oe({bin:`/usr/bin/osacompile`,args:[`-o`,t,`-e`,qD(process.execPath,e)],category:`install.osacompile`});if(!n.ok)throw process.stderr.write(n.stderr),Error(`osacompile failed (${n.reason})`);let i=c.join(t,`Contents`,`Info.plist`);for(let{key:e}of $D())Oe({bin:`/usr/bin/plutil`,args:[`-remove`,e,i],category:`install.plutil`});for(let{key:e,xml:t}of $D()){let n=Oe({bin:`/usr/bin/plutil`,args:[`-insert`,e,`-xml`,t,i],category:`install.plutil`});if(!n.ok)throw process.stderr.write(n.stderr),Error(`plutil -insert ${e} failed (${n.reason})`)}process.stdout.write(`Registering ${BE}:// with Launch Services\n`);let a=Oe({bin:`/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister`,args:[`-f`,t],category:`install.lsregister`});if(!a.ok)throw process.stderr.write(a.stderr),Error(`lsregister failed (${a.reason})`);process.stdout.write(`✓ ${RD}.app installed and registered.\n`),process.stdout.write(` Test: open '${BE}://hello-world' && pbpaste\n`)}function tO(){UD(),eO(QD().distPath)}function nO(e,t=BE){let n=`${t}://`;if(!e.startsWith(n))throw Error(`expected ${n} scheme, got: ${e}`);let r=e.slice(n.length),i=r.indexOf(`/`);return i===-1?{verb:WE,value:r}:{verb:decodeURIComponent(r.slice(0,i)),value:r.slice(i+1)}}async function rO(e){e||(process.stderr.write(`url-handle: missing URL argument.
168
+ `),process.exit(1));let t;try{t=nO(e)}catch(e){process.stderr.write(`url-handle: ${e instanceof Error?e.message:String(e)}\n`),process.exit(1)}let n=await eE(t.verb,t.value);n.kind===`ok`&&process.exit(0),n.kind===`transient`&&(SE(),process.stderr.write(`url-handle: daemon unavailable (${n.cause}: ${n.message})\n`),process.exit(1)),process.stderr.write(iO(n)+`
169
+ `),process.exit(1)}function iO(e){switch(e.cause){case`version_mismatch`:return`url-handle: daemon rejected click (version mismatch: client v${e.clientV} ≠ daemon v${e.daemonV})`;case`bad_request`:return`url-handle: daemon rejected click (bad request: ${e.message})`;case`render_failed`:return`url-handle: daemon rejected click (handler failed: ${e.message})`;case`malformed_response`:return`url-handle: daemon rejected click (malformed response: ${e.message})`}}function aO(){return`✓ install complete.
170
170
  Restart Claude Code to pick up the new statusline.
171
- Tip: every bar carries a settings menu — click it (${Uc} by\n default) for quick actions, preset switching, edit mode, and clickable\n theme/style/variation/endcaps/wrap/padding controls.\n`}async function eO(e){let t=e.includes(`--force`),n=e.filter(e=>e!==`--force`),r=n.length>0?n:[...ND],i=KD();process.platform===`darwin`?JD(i.distPath):process.stdout.write(`Skipping URL handler (cmd-click verbs are macOS-only).
172
- `),tO(i.binPath,r,t),process.stdout.write($D());let a=jD(OD,AD(pD,await kD(OD,fetch,`https://registry.npmjs.org`)));process[a.stream].write(a.text)}function tO(e,t,n,i){let a=i??yD(vD(_D(process.env,process.cwd())));r.mkdirSync(c.dirname(a),{recursive:!0});let o={};if(r.existsSync(a))try{o=JSON.parse(r.readFileSync(a,`utf-8`))}catch(e){throw Error(`Could not parse ${a}: ${e instanceof Error?e.message:String(e)}`)}let s=o.statusLine?.command,l=[e,gD(e),hD(e)],u=typeof s==`string`&&(s.startsWith(`pnpm dlx @promptctl/cc-candybar@`)||l.some(e=>s===e||s.startsWith(`${e} `)));if(s&&!u&&!n){process.stderr.write(`Skipping settings.json update: existing statusLine.command appears customized.\n Current: ${s}\n To overwrite, re-run with --force.\n`);return}o.statusLine={type:`command`,command:FD(e,t)},Ae(a,JSON.stringify(o,null,2)),process.stdout.write(`Updated ${a}\n`)}function nO(e,t){return e.kind===`owned`?t(e.pid,e.startTime)?{kind:`attach-and-exit`,reason:`live owner pid=${e.pid} holds the socket`}:{kind:`reclaim`,reason:`owner pid=${e.pid} is gone or recycled`}:e.kind===`absent`?{kind:`reclaim`,reason:`no lease — stale socket, no live owner`}:{kind:`reclaim`,reason:`unreadable lease (${e.detail}) — cannot prove a live owner`}}function rO(e){let t;try{t=r.readFileSync(e,`utf8`)}catch(e){return e.code===`ENOENT`?{kind:`absent`}:{kind:`unreadable`,detail:`read failed: ${e.message}`}}let n;try{n=JSON.parse(t)}catch(e){return{kind:`unreadable`,detail:`bad JSON: ${e.message}`}}let i=n,a=i?.pid;if(typeof a!=`number`||!Number.isInteger(a)||a<=0)return{kind:`unreadable`,detail:`no valid pid (got ${JSON.stringify(a)})`};let o=i?.startTime;return o!=null&&typeof o!=`string`?{kind:`unreadable`,detail:`invalid startTime (got ${JSON.stringify(o)})`}:{kind:`owned`,pid:a,startTime:o??null}}function iO(e,n){let i=`${e}.${t.pid}.tmp`;try{return r.writeFileSync(i,JSON.stringify(n),{mode:384}),r.renameSync(i,e),null}catch(e){let t=e.message;try{r.unlinkSync(i)}catch(e){if(e.code!==`ENOENT`)return`${t}; also failed to remove temp ${i}: ${e.message}`}return t}}function aO(e,t){let n=rO(e);if(n.kind===`owned`&&n.pid===t)try{r.unlinkSync(e)}catch{}}function oO(e){try{let t=r.statSync(e);return{kind:`present`,identity:{dev:t.dev,ino:t.ino}}}catch(e){return e.code===`ENOENT`?{kind:`absent`}:{kind:`unreadable`,detail:e.message}}}function sO(e,t,n,r){let i=cO(e,t);return i===null?r.kind===`owned`?r.pid===n?{kind:`owned`}:{kind:`displaced`,reason:`lease reassigned (names pid=${r.pid}, we are pid=${n}) — a reclaimer overwrote it`}:{kind:`displaced`,reason:`lease not held (${r.kind}) — no longer the socket owner`}:{kind:`displaced`,reason:i}}function cO(e,t){return t.kind===`present`?t.identity.dev===e.dev&&t.identity.ino===e.ino?null:`socket replaced (bound dev=${e.dev} ino=${e.ino}, now dev=${t.identity.dev} ino=${t.identity.ino})`:t.kind===`absent`?`socket path gone (ENOENT) — unlinked by a reclaimer`:`socket path unreadable (${t.detail}) — cannot prove ownership`}function lO(e){let t=!1;function n(){let n=sO(e.bound,e.readIdentity(),e.myPid,e.readLease());return n.kind===`displaced`&&!t&&(t=!0,e.log(`warn`,`ownership self-check: ${n.reason}; shutting down`),e.shutdown(0)),n}function r(t=e.intervalMs??5e3){let r=setInterval(()=>{n().kind===`displaced`&&clearInterval(r)},t);return r.unref(),{disarm:()=>clearInterval(r)}}return{check:n,arm:r}}function uO(e,t=Oe){let n=t({bin:`ps`,args:[`-o`,`lstart=`,`-p`,String(e)],category:`process-fingerprint`,timeoutMs:2e3,env:{...process.env,LC_ALL:`C`,TZ:`UTC`}});if(n.ok){let e=n.stdout.trim();return e.length>0?{kind:`start`,token:e}:{kind:`unavailable`,detail:`ps produced no start-time`}}return{kind:`unavailable`,detail:n.reason===`spawn-error`?n.error??`ps spawn failed`:`ps ${n.reason} (exit ${n.exitCode})`}}function dO(e,t,n){if(t===null)return n.pidAlive(e);let r=n.readStartTime(e);switch(r.kind){case`start`:return r.token===t;case`unavailable`:return n.pidAlive(e)}}function fO(e,t=uO){let n=t(e);return n.kind===`start`?n.token:null}const pO=`CC_CANDYBAR_PARENT_PID`;function mO(e){let t=e[pO];if(t===void 0)return{kind:`outlives-nobody`};let n=Number.parseInt(t,10);if(!Number.isInteger(n)||n<=0)throw Error(`${pO} must be a positive integer pid, got ${JSON.stringify(t)}`);return{kind:`anchored`,pid:n}}function hO(e){if(e.anchor.kind===`outlives-nobody`)return{disarm:()=>{}};let{pid:t}=e.anchor,n=setInterval(()=>{e.isAlive(t)||e.onOrphaned(`spawner pid ${t} gone`)},e.intervalMs??250);return n.unref(),{disarm:()=>clearInterval(n)}}function gO(e){try{return t.kill(e,0),!0}catch(e){return e.code===`EPERM`}}function _O(){let e=Number(process.env.CC_CANDYBAR_DAEMON_CEILING??``);return Number.isInteger(e)&&e>0?e:16}function vO(e,t,n){return e?t>=n?{allow:!1,reason:`${t} live isolated daemons registered >= ceiling ${n}`}:{allow:!0,reason:`${t} live isolated daemons registered < ceiling ${n}`}:{allow:!0,reason:`canonical production socket — exempt (bind() already caps it to one)`}}function yO(e){try{return r.readdirSync(e).filter(e=>e.endsWith(`.json`)).map(t=>c.join(e,t))}catch{return[]}}function bO(e){let t;try{t=r.readFileSync(e,`utf8`)}catch{return null}try{let e=JSON.parse(t),n=e?.pid;return typeof n!=`number`||!Number.isInteger(n)||n<=0?null:{pid:n,startTime:typeof e?.startTime==`string`?e.startTime:null}}catch{return null}}function xO(e,t,n){let r=0;for(let i of e)t(i.identity.pid,i.identity.startTime)?r++:n(i.path);return r}function SO(e){if(!e.isolated)return{decision:vO(!1,0,e.ceiling),registryPath:null};e.ensureDirSafe(e.registryDir);let t=[];for(let n of e.listFiles(e.registryDir)){let r=e.readEntry(n);r!==null&&r.pid!==e.pid&&t.push({path:n,identity:r})}let n=vO(!0,xO(t,e.isSameLiveProcess,e.removeFile),e.ceiling);if(!n.allow)return{decision:n,registryPath:null};let r=c.join(e.registryDir,`pid-${e.pid}.json`);return e.writeEntry(r,{pid:e.pid,startTime:e.startTime}),{decision:n,registryPath:r}}function CO(e,t,n,r){let i=n(e);if(i!==null&&i.pid===t)try{r(e)}catch{}}function wO(e,t={}){return{isolated:!!process.env.CC_CANDYBAR_SOCKET,registryDir:He(),ceiling:_O(),pid:process.pid,startTime:e,isSameLiveProcess:(e,t)=>dO(e,t,{readStartTime:uO,pidAlive:gO}),listFiles:yO,readEntry:bO,removeFile:e=>{try{r.unlinkSync(e)}catch{}},writeEntry:(e,t)=>{let n=`${e}.${t.pid}.tmp`;try{r.writeFileSync(n,JSON.stringify(t),{mode:384}),r.renameSync(n,e)}catch(e){try{r.unlinkSync(n)}catch(e){e.code}throw e}},ensureDirSafe:process.env.CC_CANDYBAR_DAEMON_REGISTRY_DIR?Ie:e=>{Ie(c.dirname(e)),Ie(e)},...t}}function TO(e){return e<32||e===127||e>=128&&e<=159}function EO(e){let t=``;for(let n of e)t+=TO(n.codePointAt(0)??0)?` `:n;return t.replace(/\s+/g,` `).trim()}function DO(e,t){let n=EO(e),r=``,i=0;for(let e of n){if(i===t)return r.replace(/.$/u,`…`);r+=e,i++}return r}const OO=`\x1B[38;2;255;255;255m`,kO=`\x1B[48;2;200;40;40m`;function AO(e){let t=/;2;(\d+);(\d+);(\d+)m$/.exec(e);if(t===null)throw Error(`diagnostic-style: not a 24-bit SGR: ${e}`);return`#`+t.slice(1,4).map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}const jO={fg:AO(OO),bg:AO(kO)},MO={fg:AO(`\x1B[38;2;0;0;0m`),bg:AO(`\x1B[48;2;220;160;40m`)},NO={unicode:Bi,ascii:{glyph:`>`,divider:`|`,lead:`<`,tail:`>`}},PO={unicode:{},ascii:{left:`(`,right:`)`}};function FO(e,t,n){switch(e){case`capsule`:return new Ki(PO[t]);case`plain`:return new qi(n===void 0?{}:{separator:n});case`powerline`:return new Ui(NO[t]);default:return e}}const IO=new Map;function LO(e){let t=JSON.stringify([e.endcaps,e.charset,e.separator??null]),n=IO.get(t);if(n!==void 0)return n;let r=FO(e.endcaps,e.charset,e.separator),i=e=>new V(`x`,{end:``,overflow:`ignore`,style:new z({bgcolor:e})}),a=e=>new V(Xi(new H(e,r),{colorSystem:null}).replace(/\n$/,``)).cellLength,o=a([i(`#101010`)]),s={chrome:o-1,seam:a([i(`#101010`),i(`#202020`)])-o-1};return IO.set(t,s),s}function RO(e){return LO(e).chrome}function zO(e){return LO(e).seam}function BO(e,t){if(e.length===0)return``;let n=FO(t.endcaps,t.charset,t.separator),r=t.colorCompatibility,i=t.wrap&&Number.isFinite(t.width)?Xi(new na([...e],{joiner:n}),{width:t.width,colorSystem:r}):Xi(new H([...e],n),{colorSystem:r});if(!i.endsWith(`
173
- `))throw Error(`renderStripCells: rich-js strip output did not end its last line`);return i.slice(0,-1)}function VO(e){return Math.min(20,e??20)}const HO={heading:`ERROR`,glyph:`⚠`,colors:jO},UO={heading:`WARNING`,glyph:`⚠`,colors:MO},WO={heading:`UPDATE`,glyph:`⬆`,colors:MO};function GO(e,t){return{text:EO(e),link:t}}function KO(e,t,n){let[r,...i]=[qO(e,HO,VE),t,qO(n,UO,HE)].flat();return r===void 0?null:{channels:[r,...i]}}function qO(e,t,n){let r=sD([{verb:n,args:[e]}]),[i,...a]=e.split(/\r\n|\r|\n/).map(e=>GO(e,r)).filter(e=>e.text!==``).map(e=>[e]);return i===void 0?[]:[{severity:t,message:e,lines:[i,...a]}]}function JO(e){return e.channels.map(e=>`${e.severity.heading}\n${e.message}\n`).join(`
174
- `)}function YO(e,t,n,r){if(t===null)return e;let i=XO(r),a=t.channels.flatMap(e=>ZO(e,i)),o=n.failedConfigFile!==null||a.length>r.rowCap,s=a.slice(0,r.rowCap-Number(o)),c=o?[QO(t,n,a.length-s.length,i)]:[],l=[...s,...c].join(`
175
- `);return e?`${l}\n${e}`:l}function XO(e){return{endcaps:`plain`,separator:``,width:e.width,wrap:!0,padding:0,charset:`unicode`,colorCompatibility:e.colorCompatibility}}function ZO(e,t){let n=new z({bgcolor:e.severity.colors.bg,color:e.severity.colors.fg}),r=Bt(Math.max(2,t.width-1)),i=(e,t)=>new V(`${e} `,{style:t,end:``,overflow:`ignore`});return e.lines.flatMap((a,o)=>BO([i(o===0?e.severity.glyph:` `,n.withLink(a[0].link)),...a.flatMap(e=>{let t=n.withLink(e.link);return e.text.split(` `).flatMap(e=>Wt(e,r)).map(e=>i(e,t))})],t).split(`
176
- `))}function QO(e,t,n,r){let{colors:i}=e.channels[0].severity,{fullText:a,failedConfigFile:o}=t,s=new z({bgcolor:i.bg,color:i.fg}),c=(e,t)=>new V(e,{style:t,end:``,overflow:`ignore`}),l=n>0?[c(`${n} more rows · `,s),a.kind===`file`?c(`open full text`,s.withLink(O(a.path).href)):c(`full text unavailable: ${EO(a.reason)}`,s)]:[],u=o===null?[]:[c(`${l.length>0?` · `:``}open `,s),c(EO(o),s.withLink(O(o).href))],d=[c(`↳ `,s),...l,...u.slice(0,-1)],f=d.reduce((e,t)=>e+t.cellLength,0),p=u.slice(-1).map(e=>e.truncate(Math.max(1,r.width-f),{mode:`middle`})),m=V.fromFragments([...d,...p]).truncate(r.width);return m.overflow=`ignore`,BO([m],r)}const $O=e=>!e.startsWith(`.`)&&!e.endsWith(`~`);function ek(e,t){return t.isSymbolicLink()?Buffer.from(r.readlinkSync(e)):r.readFileSync(e)}function tk(e,t){return r.readdirSync(t).filter($O).sort().flatMap(n=>{let i=c.join(t,n),a=r.lstatSync(i,{throwIfNoEntry:!1});return a===void 0?[]:a.isDirectory()?tk(e,i):[[c.relative(e,i).split(c.sep).join(`/`),ek(i,a)]]})}function nk(e){let t=re.createHash(`sha256`);for(let[n,r]of tk(e,e))t.update(n).update(`\0`).update(r).update(`\0`);return t.digest(`hex`)}const rk=e=>e.slice(0,7);function ik(e){return c.dirname(c.dirname(e))}function ak(){return{version:pD,digest:`e73a40913ff538a2c221f2f1a654f51e3b4666d7af6d8faf5712c92fc2136721`}}function ok(e){let t=JSON.parse(r.readFileSync(c.join(e,`package.json`),`utf8`)),n=typeof t==`object`&&t?t.version:void 0;if(typeof n!=`string`)throw Error(`${c.join(e,`package.json`)} has no version string`);return n}function sk(e,t){try{let n=ik(D(e)),i=c.join(n,`src`);if(!r.existsSync(i))return{kind:`not-source-checkout`};let a=t(),o=nk(i);return o===a.digest?{kind:`current`,root:n,stamp:a}:{kind:`stale`,root:n,source:{version:ok(n),digest:o},running:a}}catch(e){return{kind:`unchecked`,reason:e.message}}}var $=class extends Error{constructor(e){super(e),this.name=`BadVerbArgs`}};function ck(e){return e.op===`remove`?`remove:${e.target}`:`insert:${e.segment}:${e.anchor}:${e.relation}`}function lk(e){let t=e.split(`:`);return t[0]===`remove`&&t.length===2&&t[1]?{op:`remove`,target:t[1]}:t[0]===`insert`&&t.length===4&&t[1]&&t[2]&&(t[3]===`before`||t[3]===`after`)?{op:`insert`,segment:t[1],anchor:t[2],relation:t[3]}:null}function uk(e,t,n){let r=ks(e,new Set(n.map(Os).filter(e=>e.includes(t)).flat()));return r===e?{seg:e}:{seg:e,id:r}}const dk=/^-?\d+$/;function fk(e,t,n=`set-state`){let r=e.filter(e=>e.includes(`/`));if(r.length>0)throw Error(`makeAllowListValidator(${t}): values contain "/" — the ${n} wire shape splits values on "/" so slash-bearing options cannot be addressed. Offending values: ${r.join(`, `)}`);if(e.includes(``))throw Error(`makeAllowListValidator(${t}): empty string is not a writable option — the validator rejects empty input before the allow-list check, so an "" in the allowed list could be rendered but never delivered. Remove "" from the allowed list.`);let i=new Set(e),a=[...e];return e=>e?i.has(e)?{ok:!0,value:e}:{ok:!1,reason:`unknown ${t} "${e}" (have: ${a.join(`, `)})`}:{ok:!1,reason:`${t} value is required`}}function pk(e){return t=>{if(!t)return{ok:!1,reason:`${e} value is required`};if(!dk.test(t))return{ok:!1,reason:`${e} must be an integer, got "${t}"`};let n=t[0]===`-`,r=(n?t.slice(1):t).replace(/^0+/,``);return r===``?{ok:!0,value:`0`}:{ok:!0,value:n?`-${r}`:r}}}function mk(e,t,n){return r=>r?dk.test(r)?{ok:!0,value:String(Math.max(e,Math.min(t,parseInt(r,10))))}:{ok:!1,reason:`${n} must be an integer, got "${r}"`}:{ok:!1,reason:`${n} value is required`}}function hk(e,t,n=`state`){let r=t.filter(e=>e.kind===`range`),i=t.some(e=>e.kind===`int`),a=t.flatMap(e=>e.kind===`allow-list`?e.allowed:[]);if(r.length===0&&!i)return{kind:`allow-list`,allowed:[...new Set(a)]};let o=a.filter(e=>!dk.test(e));if(o.length>0)throw Error(`${n} action table: key "${e}" is an integer spec (a paged cursor or a bounded value) but a click writes non-integer value(s) to it (${o.join(`, `)}). A ${n} key has one key shape — point that click at a distinct key, or write an integer.`);if(i&&r.length>0)throw Error(`${n} action table: key "${e}" is declared as both a paged cursor (int) and a bounded value (range) — a ${n} key has one key shape. Use distinct keys.`);if(r.length>0){let t=Math.min(...r.map(e=>e.min)),i=Math.max(...r.map(e=>e.max)),o=a.filter(e=>{let n=parseInt(e,10);return n<t||n>i});if(o.length>0)throw Error(`${n} action table: key "${e}" is a bounded range [${t},${i}] but a click writes out-of-range value(s) to it (${o.join(`, `)}). The range gate would clamp them, storing a different value than the click renders — write an in-range integer, or point that click at a distinct key.`);return{kind:`range`,min:t,max:i}}return{kind:`int`}}function gk(e){return e===`config`?`set-config`:`set-state`}function _k(e,t,n){return t.kind===`int`?pk(`menu page "${e}"`):t.kind===`range`?mk(t.min,t.max,`${n} stepper "${e}"`):fk(t.allowed,`${n} "${e}"`,gk(n))}function vk(e,t=`state`){let n=new Map;for(let{key:t,spec:r}of e){let e=n.get(t);e?e.push(r):n.set(t,[r])}return[...n].map(([e,n])=>({key:e,spec:hk(e,n,t)}))}function yk(e,t=`state`){let n=new Map(Object.entries(e).map(([e,t])=>[e,{validator:t,permanent:!0}]));function r(){let e=[];for(let[t,r]of n)r.permanent&&e.push(t);return e}return{register(e,i){if(!e)throw Error(`register: key is required`);if(e.includes(`/`))throw Error(`register: key "${e}" contains "/" — the wire shape splits on "/" so a slash-bearing key cannot be addressed. Use a slash-free key.`);let a=n.get(e);if(a){if(a.permanent)throw Error(`register: key "${e}" is a built-in ${t} key and cannot be re-claimed (built-in keys: ${[...r()].join(`, `)})`);let n=hk(e,[...a.specs,i],t);a.specs.push(i),a.merged=n,a.validator=_k(e,n,t)}else{let r=hk(e,[i],t);n.set(e,{permanent:!1,specs:[i],merged:r,validator:_k(e,r,t)})}let o=!0;return()=>{if(!o)return;o=!1;let r=n.get(e);if(!r||r.permanent)return;let a=r.specs.indexOf(i);a>=0&&r.specs.splice(a,1),r.specs.length===0?n.delete(e):(r.merged=hk(e,r.specs,t),r.validator=_k(e,r.merged,t))}},validate(e,r){let i=n.get(e);return i?i.validator(r):{ok:!1,reason:`unknown ${t} key "${e}" (have: ${[...n.keys()].join(`, `)})`}},listKeys(){return[...n.keys()]},listBaselineKeys(){return r()},rangeParamsFor(e){let t=n.get(e);if(!t||t.permanent||t.merged.kind!==`range`)return null;let{min:r,max:i}=t.merged;return{min:r,max:i}}}}const bk=yk({},`config`);function xk(){return bk.listKeys()}function Sk(e,t){return bk.validate(e,t)}function Ck(e){return bk.rangeParamsFor(e)}function wk(e,t){return`persist`in e?`to`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:[e.to]}}]:`from`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:Zb(e.from,t).members}}]:`cycle`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:e.cycle}}]:`removeSegment`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:[ck({op:`remove`,target:e.removeSegment})]}}]:`insertSegment`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:[ck({op:`insert`,segment:e.insertSegment,anchor:e.anchor,relation:e.relation})]}}]:`insertSegmentFrom`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:Zb(e.insertSegmentFrom,t).members.map(t=>ck({op:`insert`,segment:t,anchor:e.anchor,relation:e.relation}))}}]:[{key:e.persist,spec:{kind:`range`,min:e.min,max:e.max}}]:[]}function Tk(e,t){let n=kl(e).get(t);return n===void 0?null:String(n)}function Ek(e){let t=new Set;for(let n of Object.values(e.actions)){`reset`in n&&t.add(n.reset);let e=`persist`in n?ox(n.persist):null;e?.scope===`preset-root`&&t.add(ix(e.preset))}return[...t].map(e=>({key:e,spec:{kind:`allow-list`,allowed:[]}}))}function Dk(e){let t=new Map([...Yb(e),...xC(e)]);return[...Ek(e),...Object.values(e.actions).flatMap(e=>wk(e,t))]}function Ok(e){return vk(Dk(e),`config`)}function kk(e,t){return bk.register(e,t)}const Ak=Array.from({length:10},(e,t)=>(t+1)*1e5),jk=Ak[0],Mk=Ak[Ak.length-1];function Nk(e){let t;try{t=SD(e)}catch(e){return X(e instanceof Error?e.message:String(e))}let n=t.autoCompactWindow;return n===void 0?J(`auto`):typeof n==`number`&&Number.isInteger(n)&&n>=jk&&n<=Mk?J(n):X(`${e}: autoCompactWindow is ${JSON.stringify(n)}, not a window /autocompact accepts (${jk}–${Mk} tokens)`)}function Pk(e,t){let n=Math.min(t??Mk,Mk),r=e===`auto`?n:Math.min(e,n);return{window:e===`auto`?0:e,applied:e===`auto`?0:r,lower:Ak.filter(e=>e<r).at(-1)??0,higher:Ak.find(e=>e>r&&e<=n)??0}}const Fk=Vx(`commands.`),Ik=`trimPrefix "/" (trimPrefix .project_dir .current_dir)`,Lk=`{{ \$dir := .current_dir }}{{ if and (ne .home "") (or (eq .home .current_dir) (hasPrefix (printf "%s/" .home) .current_dir)) }}{{ \$dir = printf "~%s" (trimPrefix .home .current_dir) }}{{ else }}{{ if or (eq .project_dir .current_dir) (hasPrefix (printf "%s/" .project_dir) .current_dir) }}{{ $dir = ternary (${Ik}) (basename .project_dir) (ne (${Ik}) "") }}{{ end }}{{ end }}{{ abbreviatePath \$dir }}`,Rk=`{{ ${yx} }}`,zk={min:0,max:100,step:5},Bk={warnAt:{label:`warning at %`,domain:zk,default:50},errorAt:{label:`error at %`,domain:{...zk,atLeast:`warnAt`},default:80}};function Vk(e){return{budget:{label:`budget $`,domain:{min:0,max:1e4,step:5},default:e},warnAt:{label:`warning at %`,domain:zk,default:80}}}const Hk={globals:{palette:`tokyo-night`},variables:{...Fk.variables,...Tb,current_dir:{kind:`input`,path:`workspace.current_dir`,default:`?`},"model.display_name":{kind:`input`,path:`model.display_name`,default:``},version:{kind:`input`,path:`version`,default:``},home:{kind:`input`,path:`home`,default:``},"tmux.session":{kind:`input`,path:`tmux.session`,default:``},"host.name":{kind:`input`,path:`host.name`,default:``},"host.user":{kind:`input`,path:`host.user`,default:``},"host.ssh":{kind:`input`,path:`host.ssh`,type:`boolean`,default:!1},"git.repoName":{kind:`input`,path:`git.repoName`,default:``},"git.branch":{kind:`input`,path:`git.branch`,default:``},"git.sha":{kind:`input`,path:`git.sha`,default:``},"git.ahead":{kind:`input`,path:`git.ahead`,type:`number`,default:0},"git.behind":{kind:`input`,path:`git.behind`,type:`number`,default:0},"git.staged":{kind:`input`,path:`git.staged`,type:`number`,default:0},"git.unstaged":{kind:`input`,path:`git.unstaged`,type:`number`,default:0},"git.untracked":{kind:`input`,path:`git.untracked`,type:`number`,default:0},"git.conflicts":{kind:`input`,path:`git.conflicts`,type:`number`,default:0},"git.upstream":{kind:`input`,path:`git.upstream`,default:``},"git.stash":{kind:`input`,path:`git.stash`,type:`number`,default:0},"git.status":{kind:`input`,path:`git.status`,default:`clean`},"git.operation":{kind:`input`,path:`git.operation`,default:``},"git.timeSinceCommit":{kind:`input`,path:`git.timeSinceCommit`,type:`number`,default:0},"git.color.branch":{kind:`literal`,value:`primary`},"git.color.staged":{kind:`literal`,value:`success`},"git.color.unstaged":{kind:`literal`,value:`warning`},"git.color.untracked":{kind:`literal`,value:`accent`},"git.color.conflicts":{kind:`literal`,value:`error`},"git.color.ahead":{kind:`literal`,value:`success`},"git.color.behind":{kind:`literal`,value:`warning`},"git.color.stash":{kind:`literal`,value:`accent`},"git.detail":{kind:`state`,key:`git-detail`,default:`collapsed`},"git.prNumber":{kind:`input`,path:`git.prNumber`,type:`number`,default:0},"git.prState":{kind:`input`,path:`git.prState`,default:``},"git.prUrl":{kind:`input`,path:`git.prUrl`,default:``},"git.prError":{kind:`input`,path:`git.prError`,default:``},"cache.expiresAt":{kind:`input`,path:`cache.expiresAt`,type:`number`,default:0},"session.cost":{kind:`input`,path:`session.cost`,type:`number`,default:0},"session.tokens":{kind:`input`,path:`session.tokens`,type:`number`,default:0},"today.cost":{kind:`input`,path:`today.cost`,type:`number`,default:0},"today.tokens":{kind:`input`,path:`today.tokens`,type:`number`,default:0},"block.nativeUtilization":{kind:`input`,path:`block.nativeUtilization`,type:`number`,default:0},"block.resetsAt":{kind:`input`,path:`block.resetsAt`,type:`number`,default:0},"weekly.percentage":{kind:`input`,path:`weekly.percentage`,type:`number`,default:0},"weekly.resetsAt":{kind:`input`,path:`weekly.resetsAt`,type:`number`,default:0},"burn.costPerHour":{kind:`input`,path:`burn.costPerHour`,type:`number`,default:-1},"block.etaMinutes":{kind:`input`,path:`block.etaMinutes`,type:`number`,default:-1},"weekly.etaMinutes":{kind:`input`,path:`weekly.etaMinutes`,type:`number`,default:-1},"speed.input":{kind:`input`,path:`speed.input`,type:`number`,default:-1},"speed.output":{kind:`input`,path:`speed.output`,type:`number`,default:-1},"speed.total":{kind:`input`,path:`speed.total`,type:`number`,default:-1},"speed.history":{kind:`input`,path:`speed.history`,type:`string`,default:``},"context.totalTokens":{kind:`input`,path:`context.totalTokens`,type:`number`,default:0},"context.contextLeft":{kind:`input`,path:`context.contextLeft`,type:`number`,default:100},"memento.ceiling":{kind:`input`,path:`memento.ceiling`,type:`number`,default:-1},"memento.off":{kind:`input`,path:`memento.off`,type:`boolean`,default:!1},"memento.session":{kind:`input`,path:`memento.session`,default:``},"memento.error":{kind:`input`,path:`memento.error`,default:``},"autocompact.window":{kind:`input`,path:`autocompact.window`,type:`number`,default:-1},...Object.fromEntries([`applied`,`lower`,`higher`].map(e=>[`autocompact.${e}`,{kind:`input`,path:`autocompact.${e}`,type:`number`,default:0}])),"autocompact.error":{kind:`input`,path:`autocompact.error`,default:``},"metrics.lastResponseTime":{kind:`input`,path:`metrics.lastResponseTime`,type:`number`,default:0},"metrics.responseTime":{kind:`input`,path:`metrics.responseTime`,type:`number`,default:0},"metrics.sessionDuration":{kind:`input`,path:`metrics.sessionDuration`,type:`number`,default:0},"metrics.messageCount":{kind:`input`,path:`metrics.messageCount`,type:`number`,default:0},"metrics.linesAdded":{kind:`input`,path:`metrics.linesAdded`,type:`number`,default:0},"metrics.linesRemoved":{kind:`input`,path:`metrics.linesRemoved`,type:`number`,default:0},"activity.command":{kind:`input`,path:`activity.command`,type:`string`,default:``},"activity.todo.total":{kind:`input`,path:`activity.todo.total`,type:`number`,default:0},"activity.todo.completed":{kind:`input`,path:`activity.todo.completed`,type:`number`,default:0},"activity.todo.position":{kind:`input`,path:`activity.todo.position`,type:`number`,default:0},"activity.todo.active":{kind:`input`,path:`activity.todo.active`,type:`string`,default:``},"activity.tool.running":{kind:`input`,path:`activity.tool.running`,type:`string`,default:``},"activity.tool.done":{kind:`input`,path:`activity.tool.done`,type:`string`,default:``}},segments:{directory:{group:`location`,description:"The current directory, shortened fish-style — `~` under home, project-relative inside the project.",template:Lk},model:{group:`model-context`,description:`The active model's display name.`,template:`✱ {{ formatModelName .model.display_name }}`,when:`{{ ne .model.display_name "" }}`},sessionId:{group:`session-tools`,description:`The session id, truncated to 8 characters.`,template:`⌗{{ trunc 8 .session.id }}`,when:`{{ ne .session.id "" }}`},version:{group:`model-context`,description:`The Claude Code version reported in the hook payload.`,template:`◈ v{{ .version }}`,when:`{{ ne .version "" }}`},tmux:{group:`location`,description:`The tmux session name; hidden when not inside tmux.`,template:`tmux:{{ .tmux.session | default "none" }}`,when:`{{ ne .tmux.session "" }}`},host:{group:`location`,description:`user@host on a warning background, shown only over SSH.`,template:`⇄ {{ .host.user | default "?" }}@{{ .host.name | default "?" }}`,bg:`warning`,when:`{{ .host.ssh }}`},gitaculous:{group:`git`,description:`The git state: a summary (branch, ahead/behind, S/U/? flags) that the arrow at its right edge expands to every fact — repo, in-progress operation, sha, upstream ±, stash count, time since the last commit.`,template:`{{ if eq .git.detail "expanded" }}{{ template "gitExpanded" . }}{{ else }}{{ template "gitCollapsed" . }}{{ end }} {{ action "gitDetail" "▸" "◂" }}`,fg:Rk,when:`{{ ne .git.branch "" }}`,settings:{aheadBehind:{label:`ahead/behind`,domain:`bool`,default:!0},flags:{label:`dirty flags`,domain:`bool`,default:!0},operation:{label:`operation`,domain:`bool`,default:!0},repo:{label:`repo name`,domain:`bool`,default:!0},sha:{label:`commit hash`,domain:`bool`,default:!0},stash:{label:`stash`,domain:`bool`,default:!0},upstream:{label:`upstream`,domain:`bool`,default:!0},age:{label:`time since commit`,domain:`bool`,default:!0}}},gitPr:{group:`git`,description:"The pull request open for this branch, as a link; `⚠ PR` when the forge lookup failed.",template:`{{ if ne .git.prUrl "" }}{{ link .git.prUrl (printf "⇆ #%v" .git.prNumber) }}{{ else }}⚠ PR{{ end }}`,when:`{{ or (ne .git.prUrl "") (ne .git.prError "") }}`},toolbar:{group:`session-tools`,description:`Quick actions: copy the session id, and open the project, transcript or repo.`,template:Ax(``).template},commands:{group:`session-tools`,description:`Type /compact, /model or /clear into this session; /clear asks for a second click.`,template:Fk.template},themeSwitcher:{group:`session-tools`,description:"`◀ <theme> ▶`: the theme the bar is wearing; ◀ and ▶ switch this session to the previous or next theme, wrapping at the ends.",template:`{{ carousel "stepTheme" 0 }}`},session:{group:`cost-limits`,description:`This session's cost and token total, with a budget warning once a budget is configured.`,template:`§ {{ template "formatCost" .session.cost }} ({{ template "formatTokens" .session.tokens }}){{ template "budgetStatus" (dict "cost" .session.cost "budget" .settings.budget "warn" .settings.warnAt) }}`,settings:Vk(0)},today:{group:`cost-limits`,description:`Today's cost and tokens across every session, with a budget warning once a budget is configured.`,template:`☉ {{ template "formatCost" .today.cost }} ({{ template "formatTokens" .today.tokens }}){{ template "budgetStatus" (dict "cost" .today.cost "budget" .settings.budget "warn" .settings.warnAt) }}`,settings:Vk(50)},block:{group:`cost-limits`,description:`The 5-hour rate-limit block: percent used and time to reset, heating to warning then error.`,template:`◱ {{ round .block.nativeUtilization }}% ({{ template "formatResetCountdown" .block.resetsAt }})`,bg:`{{ ramp (round .block.nativeUtilization) "step" 0 (tint) .settings.warnAt "warning" .settings.errorAt "error" }}`,settings:Bk,when:`{{ gt .block.resetsAt 0 }}`},weekly:{group:`cost-limits`,description:`The weekly rate-limit quota: percent used and time to reset, heating to warning then error.`,template:`◑ {{ round .weekly.percentage }}% ({{ template "formatResetCountdown" .weekly.resetsAt }})`,bg:`{{ ramp (round .weekly.percentage) "step" 0 (tint) .settings.warnAt "warning" .settings.errorAt "error" }}`,settings:Bk,when:`{{ gt .weekly.resetsAt 0 }}`},burnrate:{group:`cost-limits`,description:`Spend per hour, with the projected time to the 5-hour and weekly limits.`,template:`⚡ {{ template "formatRate" .burn.costPerHour }} · {{ template "formatEta" .block.etaMinutes }} to 5h · {{ template "formatEta" .weekly.etaMinutes }} to wk`,bg:`{{ ramp .block.etaMinutes "step" -1 (tint) 0 "error" .settings.errorWithin "warning" .settings.warnWithin (tint) }}`,settings:{errorWithin:{label:`error within (min)`,domain:{min:0,max:300,step:5},default:30},warnWithin:{label:`warning within (min)`,domain:{min:0,max:300,step:5,atLeast:`errorWithin`},default:60}},when:`{{ or (gt .block.resetsAt 0) (gt .weekly.resetsAt 0) }}`},speed:{group:`activity`,description:`Token throughput for the latest exchange: output, input, and total.`,template:`⇅ out {{ template "formatSpeed" .speed.output }} · in {{ template "formatSpeed" .speed.input }} · tot {{ template "formatSpeed" .speed.total }}`,when:`{{ gt .session.tokens 0 }}`},tokenSparkline:{group:`activity`,description:`A sparkline of recent token throughput.`,template:`⚡ {{ sparkline .speed.history 24 }}`,when:`{{ ne .speed.history "" }}`},cacheTimer:{group:`activity`,description:"Minutes until the prompt cache expires, or `cold` once it has.",template:`◴ {{ if le (minutesUntilReset .cache.expiresAt) 0 }}cold{{ else }}{{ minutesUntilReset .cache.expiresAt }}m{{ end }}`,fg:`{{ readableOn (color (cascade (minutesUntilReset .cache.expiresAt) "0:error" "9:warning" "21:foreground")) (bgOf) ${Oa} }}`,when:`{{ gt .cache.expiresAt 0 }}`},context:{group:`model-context`,description:`Context used, in tokens and percent remaining, heating as it fills.`,template:`◔ {{ formatInteger .context.totalTokens }} ({{ .context.contextLeft }}%)`,bg:`{{ ramp .context.contextLeft "step" 0 "error" 21 "warning" 41 (tint) }}`,when:`{{ gt .context.totalTokens 0 }}`},ceiling:{group:`model-context`,description:`The memento plugin's context ceiling for this session: − and + move it by 100K, ∞ lifts it, ↺ drops this session's own setting.`,template:`{{ if ne .memento.error "" }}⌈ ⚠ {{ .memento.error }} {{ action "ceiling.clear" "↺" }}{{ else }}⌈ {{ if .memento.off }}off{{ else }}{{ template "formatTokenCount" .memento.ceiling }} {{ action "ceiling.lower" "−" }} {{ action "ceiling.raise" "+" }} {{ action "ceiling.off" "∞" }}{{ end }}{{ if ne .memento.session "" }} {{ action "ceiling.clear" "↺" }}{{ end }}{{ end }}`,bg:`{{ if ne .memento.error "" }}{{ color "error" }}{{ else }}{{ tint }}{{ end }}`,when:`{{ or (ge .memento.ceiling 0) (ne .memento.error "") }}`},autocompact:{group:`model-context`,description:`Claude Code's auto-compact window: − and + move it by 100K, ↺ returns it to auto. Clicks type /autocompact into this session.`,template:`{{ if ne .autocompact.error "" }}⇲ ⚠ {{ .autocompact.error }}{{ else }}⇲ {{ if eq .autocompact.window 0 }}auto{{ else }}{{ template "formatTokenCount" .autocompact.applied }}{{ end }}{{ if gt .autocompact.lower 0 }} {{ action (printf "autocompact.%d" .autocompact.lower) "−" }}{{ end }}{{ if gt .autocompact.higher 0 }} {{ action (printf "autocompact.%d" .autocompact.higher) "+" }}{{ end }}{{ if gt .autocompact.window 0 }} {{ action "autocompact.auto" "↺" }}{{ end }}{{ end }}`,bg:`{{ if ne .autocompact.error "" }}{{ color "error" }}{{ else }}{{ tint }}{{ end }}`,when:`{{ or (ge .autocompact.window 0) (ne .autocompact.error "") }}`},metrics:{group:`activity`,description:`Response times, session duration, message count, and lines added/removed.`,template:`{{ if .metrics.lastResponseTime }} Δ {{ template "formatResponseTime" .metrics.lastResponseTime }}{{ end }}{{ if .metrics.responseTime }} ⧖ {{ template "formatResponseTime" .metrics.responseTime }}{{ end }}{{ if .metrics.sessionDuration }} ⧗ {{ template "formatDuration" .metrics.sessionDuration }}{{ end }}{{ if .metrics.messageCount }} ◆ {{ .metrics.messageCount }}{{ end }}{{ if .metrics.linesAdded }} + {{ .metrics.linesAdded }}{{ end }}{{ if .metrics.linesRemoved }} - {{ .metrics.linesRemoved }}{{ end }} `,when:`{{ or (gt .metrics.lastResponseTime 0.0) (gt .metrics.responseTime 0.0) (gt .metrics.sessionDuration 0.0) (gt .metrics.messageCount 0) (gt .metrics.linesAdded 0) (gt .metrics.linesRemoved 0) }}`},activity:{group:`activity`,description:`What Claude is doing: the slash command that opened the turn, the in-progress todo, and the tools in flight.`,template:`{{ if .activity.command }} ⌘ {{ .activity.command }}{{ end }}{{ if .activity.todo.total }}{{ if .activity.todo.active }} ☐ {{ .activity.todo.position }}/{{ .activity.todo.total }} {{ abbrev 32 .activity.todo.active }}{{ else }} ☑ {{ .activity.todo.completed }}/{{ .activity.todo.total }}{{ end }}{{ end }}{{ if .activity.tool.running }} ⟳ {{ template "formatToolTally" .activity.tool.running }}{{ end }}{{ if .activity.tool.done }} ✓ {{ template "formatToolTally" .activity.tool.done }}{{ end }} `,when:`{{ or (ne .activity.command "") (gt .activity.todo.total 0) (ne .activity.tool.running "") (ne .activity.tool.done "") }}`}},root:{rows:{identity:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`host`},{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`}]},status:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`model`},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`context`},{kind:`segment`,name:`ceiling`},{kind:`segment`,name:`autocompact`}]},{kind:`segment`,name:`cacheTimer`},{kind:`segment`,name:`block`},{kind:`segment`,name:`weekly`},{kind:`segment`,name:`activity`}]}}},actions:{...Ax(``).actions,...Fk.actions,copyDir:{copy:`{{ .current_dir }}`},stepTheme:{set:`theme`,from:`themes`},gitDetail:{set:`git-detail`,cycle:[`collapsed`,`expanded`]},"ceiling.raise":{ceiling:`set`,to:`+100_000`},"ceiling.lower":{ceiling:`set`,to:`-100_000`},"ceiling.off":{ceiling:`set`,to:`off`},"ceiling.clear":{ceiling:`clear`},"autocompact.auto":{slash:Rx(`/autocompact auto`)},...Object.fromEntries(Ak.map(e=>[`autocompact.${e}`,{slash:Rx(`/autocompact ${e}`)}]))},styles:{none:{hueShift:0,chromaScale:1,lightnessScale:1,lightnessShift:0},vivid:{hueShift:0,chromaScale:1.35,lightnessScale:1,lightnessShift:0},muted:{hueShift:0,chromaScale:.55,lightnessScale:1,lightnessShift:0},dim:{hueShift:0,chromaScale:1,lightnessScale:.85,lightnessShift:0},bright:{hueShift:0,chromaScale:1,lightnessScale:1,lightnessShift:.08},inverted:{hueShift:0,chromaScale:1,lightnessScale:-1,lightnessShift:1}},presets:{default:{},compact:{root:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`},{kind:`segment`,name:`context`}]},globals:{padding:0}},verbose:{root:{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`},{kind:`segment`,name:`gitPr`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`model`},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`context`},{kind:`segment`,name:`ceiling`},{kind:`segment`,name:`autocompact`}]},{kind:`segment`,name:`cacheTimer`},{kind:`segment`,name:`block`},{kind:`segment`,name:`weekly`},{kind:`segment`,name:`burnrate`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`speed`},{kind:`segment`,name:`tokenSparkline`}]}]}},zen:{root:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`directory`},{kind:`segment`,name:`context`}]},globals:{endcaps:`plain`,style:`dim`}},git:{root:{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`host`},{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`},{kind:`segment`,name:`gitPr`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`model`},{kind:`segment`,name:`context`},{kind:`segment`,name:`activity`}]}]}},usage:{root:{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`model`},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`context`},{kind:`segment`,name:`ceiling`},{kind:`segment`,name:`autocompact`}]},{kind:`segment`,name:`cacheTimer`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`block`},{kind:`segment`,name:`weekly`},{kind:`segment`,name:`burnrate`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`session`},{kind:`segment`,name:`today`},{kind:`segment`,name:`speed`},{kind:`segment`,name:`tokenSparkline`}]}]}},dense:{root:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`host`},{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`},{kind:`segment`,name:`model`},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`context`},{kind:`segment`,name:`ceiling`},{kind:`segment`,name:`autocompact`}]},{kind:`segment`,name:`cacheTimer`},{kind:`segment`,name:`block`},{kind:`segment`,name:`weekly`},{kind:`segment`,name:`session`},{kind:`segment`,name:`activity`}]},globals:{padding:0}}},editGlobals:{endcaps:`plain`,default_separator:` | `},helpers:{gitPaint:`{{ fg (readableOn (color .color) (bgOf) ${Oa}) .text }}`,gitCollapsed:`{{ template "gitBranch" . }}{{ template "gitAheadBehind" . }}{{ template "gitFlags" . }}`,gitExpanded:`(git){{ template "gitRepo" . }}{{ template "gitOperation" . }}{{ template "gitSha" . }}{{ template "gitFlags" . }} {{ template "gitBranch" . }}{{ template "gitUpstream" . }}{{ template "gitStash" . }}{{ template "gitAge" . }}`,gitBranch:`⎇ {{ template "gitPaint" (dict "color" .git.color.branch "text" .git.branch) }}`,gitRepo:`{{ if and .settings.repo (ne .git.repoName "") }} {{ .git.repoName }}{{ end }}`,gitOperation:`{{ if and .settings.operation (ne .git.operation "") }} [{{ .git.operation }}]{{ end }}`,gitSha:`{{ if and .settings.sha (ne .git.sha "") }} {{ .git.sha }}{{ end }}`,gitFlags:`{{ if and .settings.flags (or (gt .git.staged 0) (gt .git.unstaged 0) (gt .git.untracked 0) (gt .git.conflicts 0)) }} {{ if gt .git.staged 0 }}{{ template "gitPaint" (dict "color" .git.color.staged "text" "S") }}{{ end }}{{ if gt .git.unstaged 0 }}{{ template "gitPaint" (dict "color" .git.color.unstaged "text" "U") }}{{ end }}{{ if gt .git.untracked 0 }}{{ template "gitPaint" (dict "color" .git.color.untracked "text" "?") }}{{ end }}{{ if gt .git.conflicts 0 }}{{ template "gitPaint" (dict "color" .git.color.conflicts "text" (printf "!%v" .git.conflicts)) }}{{ end }}{{ end }}`,gitAheadBehind:`{{ if and .settings.aheadBehind (or (gt .git.ahead 0) (gt .git.behind 0)) }} {{ if gt .git.ahead 0 }}{{ template "gitPaint" (dict "color" .git.color.ahead "text" (printf "+%v" .git.ahead)) }}{{ end }}{{ if and (gt .git.ahead 0) (gt .git.behind 0) }}/{{ end }}{{ if gt .git.behind 0 }}{{ template "gitPaint" (dict "color" .git.color.behind "text" (printf "-%v" .git.behind)) }}{{ end }}{{ end }}`,gitUpstream:`{{ if and .settings.upstream (ne .git.upstream "") }} [{{ .git.upstream }}{{ template "gitAheadBehind" . }}]{{ end }}`,gitStash:`{{ if and .settings.stash (gt .git.stash 0) }} {{ template "gitPaint" (dict "color" .git.color.stash "text" (printf "(%v stashed)" .git.stash)) }}{{ end }}`,gitAge:`{{ if and .settings.age (gt .git.timeSinceCommit 0) }} ◷ {{ template "formatTimeSince" .git.timeSinceCommit }}{{ end }}`,formatCost:'{{ if lt . 0.01 }}<$0.01{{ else }}${{ printf "%.2f" . }}{{ end }}',formatTokenCount:`{{ if ge . 1000000 }}{{ printf "%.1f" (divf . 1000000) }}M{{ else if ge . 1000 }}{{ printf "%.1f" (divf . 1000) }}K{{ else }}{{ . }}{{ end }}`,formatTokens:`{{ template "formatTokenCount" . }} tokens`,formatToolTally:`{{ $names := splitList "," . }}{{ range $i, $pair := $names }}{{ if lt $i 2 }}{{ if $i }} {{ end }}{{ $kv := splitList ":" $pair }}{{ index $kv 0 }}{{ if ne (index $kv 1) "1" }}×{{ index $kv 1 }}{{ end }}{{ end }}{{ end }}{{ if gt (len $names) 2 }} +{{ sub (len $names) 2 }}{{ end }}`,formatRate:`{{ if lt . 0 }}—/hr{{ else }}{{ template "formatCost" . }}/hr{{ end }}`,formatEta:`{{ if lt . 0 }}—{{ else }}{{ template "formatLongTimeRemaining" . }}{{ end }}`,formatSpeed:`{{ if lt . 0 }}—{{ else }}{{ template "formatTokenCount" (round .) }}/s{{ end }}`,formatTokenBreakdown:`{{ $first := true }}{{ if gt .input 0 }}{{ template "formatTokenCount" .input }} in{{ $first = false }}{{ end }}{{ if gt .output 0 }}{{ if not $first }} + {{ end }}{{ template "formatTokenCount" .output }} out{{ $first = false }}{{ end }}{{ if or (gt .cacheCreation 0) (gt .cacheRead 0) }}{{ if not $first }} + {{ end }}{{ template "formatTokenCount" (add .cacheCreation .cacheRead) }} cached{{ $first = false }}{{ end }}{{ if $first }}0 tokens{{ end }}`,budgetStatus:`{{ if or (le .budget 0) (lt .cost 0) }}{{ else }}{{ $pct := minf 100 (mulf (divf .cost .budget) 100) }}{{ $p := printf "%.0f%%" $pct }}{{ if ge $pct .warn }} !{{ $p }}{{ else }}{{ if ge $pct 50 }} +{{ $p }}{{ else }} {{ $p }}{{ end }}{{ end }}{{ end }}`,formatTimeSince:`{{ if lt . 60 }}{{ . }}s{{ else if lt . 3600 }}{{ div . 60 }}m{{ else if lt . 86400 }}{{ div . 3600 }}h{{ else if lt . 604800 }}{{ div . 86400 }}d{{ else }}{{ div . 604800 }}w{{ end }}`,formatDuration:`{{ if lt . 60 }}{{ printf "%.0f" . }}s{{ else if lt . 3600 }}{{ printf "%.0f" (divf . 60) }}m{{ else if lt . 86400 }}{{ printf "%.1f" (divf . 3600) }}h{{ else }}{{ printf "%.1f" (divf . 86400) }}d{{ end }}`,formatResponseTime:`{{ if lt . 60 }}{{ printf "%.1f" . }}s{{ else }}{{ printf "%.1f" (divf . 60) }}m{{ end }}`,formatLongTimeRemaining:`{{ if ge . 1440 }}{{ $d := div . 1440 }}{{ $h := div (mod . 1440) 60 }}{{ if gt $h 0 }}{{ $d }}d {{ $h }}h{{ else }}{{ $d }}d{{ end }}{{ else if ge . 60 }}{{ $h := div . 60 }}{{ $m := mod . 60 }}{{ if gt $m 0 }}{{ $h }}h {{ $m }}m{{ else }}{{ $h }}h{{ end }}{{ else }}{{ . }}m{{ end }}`,formatResetCountdown:`{{ template "formatLongTimeRemaining" (add 1 (minutesUntilReset .)) }}`}},Uk=new Set([Hk.globals.palette,...Object.values(Hk.segments).map(e=>e.palette)].filter(e=>e!==void 0)),Wk=Rc(yT(`<default>`,JSON.stringify(Hk),Uk),Hk),Gk=C_(Wk.presets);function Kk(e){return Gk.includes(e)}function qk(e){if(!e)return 0;try{return o(e).mtimeMs}catch{return 0}}const Jk=new class{slots;head=null;tail=null;constructor(e){this.slots=e}async run(e){await this.acquire();try{return await e()}finally{this.release()}}async acquire(){if(this.slots>0){this.slots--;return}await new Promise(e=>{let t={wake:e,next:null};this.tail?this.tail.next=t:this.head=t,this.tail=t})}release(){let e=this.head;if(!e){this.slots++;return}this.head=e.next,this.head||(this.tail=null),e.wake()}}(8);function Yk(e){return((...t)=>Jk.run(()=>e(...t)))}const Xk=Yk(C),Zk=Yk(S),Qk=Yk(w);async function $k(e,t){return Jk.run(async()=>{let n=null;try{n=await x(e,`r`);let{size:r,mtimeMs:i,ino:a}=await n.stat(),o=t!==void 0&&(a!==t.ino||r<t.offset),s=o||t===void 0?0:t.offset;if(s>=r)return J({buf:Buffer.alloc(0),start:s,size:r,mtimeMs:i,ino:a,reset:o});let c=Buffer.alloc(r-s),l=0;for(;l<c.length;){let{bytesRead:e}=await n.read(c,l,c.length-l,s+l);if(e===0)break;l+=e}return J({buf:l===c.length?c:c.subarray(0,l),start:s,size:r,mtimeMs:i,ino:a,reset:o})}catch(t){return t.code===`ENOENT`?Y:X(`readAppended ${e}: ${t instanceof Error?t.message:String(t)}`)}finally{await n?.close().catch(e=>{k(`transcript-fs: close failed: ${e instanceof Error?e.message:String(e)}`)})}})}async function eA(e,t){return Jk.run(async()=>{let n=null;try{n=await x(e,`r`);let{size:r}=await n.stat(),i=Math.max(0,r-t),a=Buffer.alloc(r-i),o=0;for(;o<a.length;){let{bytesRead:e}=await n.read(a,o,a.length-o,i+o);if(e===0)break;o+=e}return J({buf:o===a.length?a:a.subarray(0,o),fromStart:i===0})}catch(t){return t.code===`ENOENT`?Y:X(`readTail ${e}: ${t instanceof Error?t.message:String(t)}`)}finally{await n?.close().catch(e=>{k(`transcript-fs: close failed: ${e instanceof Error?e.message:String(e)}`)})}})}const tA=/"(?:cache_read_input_tokens|cache_creation_input_tokens)":[1-9]/;function nA(e){let t;try{t=JSON.parse(e)}catch{return null}let n=t.message?.usage;if(!((n?.cache_read_input_tokens??0)>0||(n?.cache_creation_input_tokens??0)>0))return null;let r=t.timestamp==null?NaN:Date.parse(t.timestamp);return Number.isNaN(r)?null:r}async function rA(e){let t=await iA(e);return t.kind===`ok`?J(Math.floor((t.value+36e5)/1e3)):t}async function iA(e){for(let t of[65536,1048576]){let n=await eA(e,t);if(n.kind!==`ok`)return n;let r=aA(n.value.buf,n.value.fromStart);if(r!=null)return J(r);if(n.value.fromStart)return Y}return Y}function aA(e,t){let n=e.toString(`utf8`).split(`
177
- `),r=+!t;for(let e=n.length-1;e>=r;e--){let t=n[e];if(!t||!tA.test(t))continue;let r=nA(t);if(r!=null)return r}return null}function oA(e,t){return{...e,claudeConfigDir:vD(t.claudeConfigDir),env:t.mementoEnv}}const sA=c.join(`lib`,`ceiling_config.py`),cA=c.join(`skills`,`ceiling`,`bin`,`ceiling`);function lA(e,t){let n=typeof e==`object`&&e?e.plugins:void 0;if(typeof n!=`object`||!n)throw Error(`${t} has no "plugins" object`);return Object.entries(n).filter(([e])=>e.split(`@`)[0]===`memento`).flatMap(([e,n])=>{if(!Array.isArray(n))throw Error(`${t}: "${e}" is not a list of installs`);return n.map(n=>{let{scope:r,installPath:i,projectPath:a}=n??{};if(typeof r!=`string`||typeof i!=`string`)throw Error(`${t}: an install of "${e}" has no scope/path`);return typeof a==`string`?{key:e,scope:r,installPath:i,projectPath:a}:{key:e,scope:r,installPath:i}})})}function uA(e,t){let n=!0;for(let i of e){if(!r.existsSync(i))continue;let e;try{e=JSON.parse(r.readFileSync(i,`utf8`))?.enabledPlugins?.[t]}catch(e){return X(`memento lookup: ${i}: ${e.message}`)}typeof e==`boolean`&&(n=e)}return J(n)}function dA(e,t){if(!r.existsSync(e))return Y;let n;try{n=lA(JSON.parse(r.readFileSync(e,`utf8`)),e)}catch(e){return X(`memento lookup: ${e.message}`)}let i=n.find(e=>e.projectPath===t)??n.find(e=>e.scope===`user`);if(i===void 0)return Y;let a=uA([c.join(c.dirname(c.dirname(e)),`settings.json`),c.join(t,`.claude`,`settings.json`),c.join(t,`.claude`,`settings.local.json`)],i.key);if(a.kind!==`ok`)return a;if(!a.value)return Y;let o=[sA,cA].filter(e=>!r.existsSync(c.join(i.installPath,e)));return o.length===0?J(i.installPath):X(`memento at ${i.installPath} has no ${o.join(` or `)} — upgrade the plugin`)}function fA(e,t=process.env){let n=new Set([`CLAUDE_PROJECT_DIR`,`CLAUDE_CODE_SESSION_ID`,...e.env===void 0?[]:Je]);return{...Object.fromEntries(Object.entries(t).filter(([e])=>!n.has(e))),...e.env,CLAUDE_CODE_SESSION_ID:e.sessionId,CLAUDE_PROJECT_DIR:e.projectDir||e.cwd}}function pA(e){return e.stderr.trim()||e.error||`${e.reason}${e.exitCode===null?``:` (exit ${e.exitCode})`}`}function mA(e){let t;try{t=JSON.parse(e)}catch{return X(`memento read: not JSON: ${e.trim()}`)}let{ceiling:n,session:r}=t??{},i=n===`off`||typeof n==`number`&&n>=0?n:void 0;return i!==void 0&&(r===null||typeof r==`string`)?J({ceiling:i,session:r}):X(`memento read: unexpected answer: ${e.trim()}`)}async function hA(e,t){let n=await De({bin:`python3`,args:[`-c`,`
171
+ Tip: every bar carries a settings menu — click it (${Hc} by\n default) for quick actions, preset switching, edit mode, and clickable\n theme/style/variation/endcaps/wrap/padding controls.\n`}async function oO(e){let t=e.includes(`--force`),n=e.filter(e=>e!==`--force`),r=n.length>0?n:[...zD],i=QD();process.platform===`darwin`?eO(i.distPath):process.stdout.write(`Skipping URL handler (cmd-click verbs are macOS-only).
172
+ `),sO(i.binPath,r,t),process.stdout.write(aO());let a=LD(PD,ID(yD,await FD(PD,fetch,`https://registry.npmjs.org`)));process[a.stream].write(a.text)}function sO(e,t,n,i){let a=i??TD(wD(CD(process.env,process.cwd())));r.mkdirSync(c.dirname(a),{recursive:!0});let o={};if(r.existsSync(a))try{o=JSON.parse(r.readFileSync(a,`utf-8`))}catch(e){throw Error(`Could not parse ${a}: ${e instanceof Error?e.message:String(e)}`)}let s=o.statusLine?.command,l=[e,SD(e),xD(e)],u=typeof s==`string`&&(s.startsWith(`pnpm dlx @promptctl/cc-candybar@`)||l.some(e=>s===e||s.startsWith(`${e} `)));if(s&&!u&&!n){process.stderr.write(`Skipping settings.json update: existing statusLine.command appears customized.\n Current: ${s}\n To overwrite, re-run with --force.\n`);return}o.statusLine={type:`command`,command:VD(e,t)},Ae(a,JSON.stringify(o,null,2)),process.stdout.write(`Updated ${a}\n`)}function cO(e,t){return e.kind===`owned`?t(e.pid,e.startTime)?{kind:`attach-and-exit`,reason:`live owner pid=${e.pid} holds the socket`}:{kind:`reclaim`,reason:`owner pid=${e.pid} is gone or recycled`}:e.kind===`absent`?{kind:`reclaim`,reason:`no lease — stale socket, no live owner`}:{kind:`reclaim`,reason:`unreadable lease (${e.detail}) — cannot prove a live owner`}}function lO(e){let t;try{t=r.readFileSync(e,`utf8`)}catch(e){return e.code===`ENOENT`?{kind:`absent`}:{kind:`unreadable`,detail:`read failed: ${e.message}`}}let n;try{n=JSON.parse(t)}catch(e){return{kind:`unreadable`,detail:`bad JSON: ${e.message}`}}let i=n,a=i?.pid;if(typeof a!=`number`||!Number.isInteger(a)||a<=0)return{kind:`unreadable`,detail:`no valid pid (got ${JSON.stringify(a)})`};let o=i?.startTime;return o!=null&&typeof o!=`string`?{kind:`unreadable`,detail:`invalid startTime (got ${JSON.stringify(o)})`}:{kind:`owned`,pid:a,startTime:o??null}}function uO(e,n){let i=`${e}.${t.pid}.tmp`;try{return r.writeFileSync(i,JSON.stringify(n),{mode:384}),r.renameSync(i,e),null}catch(e){let t=e.message;try{r.unlinkSync(i)}catch(e){if(e.code!==`ENOENT`)return`${t}; also failed to remove temp ${i}: ${e.message}`}return t}}function dO(e,t){let n=lO(e);if(n.kind===`owned`&&n.pid===t)try{r.unlinkSync(e)}catch{}}function fO(e){try{let t=r.statSync(e);return{kind:`present`,identity:{dev:t.dev,ino:t.ino}}}catch(e){return e.code===`ENOENT`?{kind:`absent`}:{kind:`unreadable`,detail:e.message}}}function pO(e,t,n,r){let i=mO(e,t);return i===null?r.kind===`owned`?r.pid===n?{kind:`owned`}:{kind:`displaced`,reason:`lease reassigned (names pid=${r.pid}, we are pid=${n}) — a reclaimer overwrote it`}:{kind:`displaced`,reason:`lease not held (${r.kind}) — no longer the socket owner`}:{kind:`displaced`,reason:i}}function mO(e,t){return t.kind===`present`?t.identity.dev===e.dev&&t.identity.ino===e.ino?null:`socket replaced (bound dev=${e.dev} ino=${e.ino}, now dev=${t.identity.dev} ino=${t.identity.ino})`:t.kind===`absent`?`socket path gone (ENOENT) — unlinked by a reclaimer`:`socket path unreadable (${t.detail}) — cannot prove ownership`}function hO(e){let t=!1;function n(){let n=pO(e.bound,e.readIdentity(),e.myPid,e.readLease());return n.kind===`displaced`&&!t&&(t=!0,e.log(`warn`,`ownership self-check: ${n.reason}; shutting down`),e.shutdown(0)),n}function r(t=e.intervalMs??5e3){let r=setInterval(()=>{n().kind===`displaced`&&clearInterval(r)},t);return r.unref(),{disarm:()=>clearInterval(r)}}return{check:n,arm:r}}function gO(e,t=Oe){let n=t({bin:`ps`,args:[`-o`,`lstart=`,`-p`,String(e)],category:`process-fingerprint`,timeoutMs:2e3,env:{...process.env,LC_ALL:`C`,TZ:`UTC`}});if(n.ok){let e=n.stdout.trim();return e.length>0?{kind:`start`,token:e}:{kind:`unavailable`,detail:`ps produced no start-time`}}return{kind:`unavailable`,detail:n.reason===`spawn-error`?n.error??`ps spawn failed`:`ps ${n.reason} (exit ${n.exitCode})`}}function _O(e,t,n){if(t===null)return n.pidAlive(e);let r=n.readStartTime(e);switch(r.kind){case`start`:return r.token===t;case`unavailable`:return n.pidAlive(e)}}function vO(e,t=gO){let n=t(e);return n.kind===`start`?n.token:null}const yO=`CC_CANDYBAR_PARENT_PID`;function bO(e){let t=e[yO];if(t===void 0)return{kind:`outlives-nobody`};let n=Number.parseInt(t,10);if(!Number.isInteger(n)||n<=0)throw Error(`${yO} must be a positive integer pid, got ${JSON.stringify(t)}`);return{kind:`anchored`,pid:n}}function xO(e){if(e.anchor.kind===`outlives-nobody`)return{disarm:()=>{}};let{pid:t}=e.anchor,n=setInterval(()=>{e.isAlive(t)||e.onOrphaned(`spawner pid ${t} gone`)},e.intervalMs??250);return n.unref(),{disarm:()=>clearInterval(n)}}function SO(e){try{return t.kill(e,0),!0}catch(e){return e.code===`EPERM`}}function CO(){let e=Number(process.env.CC_CANDYBAR_DAEMON_CEILING??``);return Number.isInteger(e)&&e>0?e:16}function wO(e,t,n){return e?t>=n?{allow:!1,reason:`${t} live isolated daemons registered >= ceiling ${n}`}:{allow:!0,reason:`${t} live isolated daemons registered < ceiling ${n}`}:{allow:!0,reason:`canonical production socket — exempt (bind() already caps it to one)`}}function TO(e){try{return r.readdirSync(e).filter(e=>e.endsWith(`.json`)).map(t=>c.join(e,t))}catch{return[]}}function EO(e){let t;try{t=r.readFileSync(e,`utf8`)}catch{return null}try{let e=JSON.parse(t),n=e?.pid;return typeof n!=`number`||!Number.isInteger(n)||n<=0?null:{pid:n,startTime:typeof e?.startTime==`string`?e.startTime:null}}catch{return null}}function DO(e,t,n){let r=0;for(let i of e)t(i.identity.pid,i.identity.startTime)?r++:n(i.path);return r}function OO(e){if(!e.isolated)return{decision:wO(!1,0,e.ceiling),registryPath:null};e.ensureDirSafe(e.registryDir);let t=[];for(let n of e.listFiles(e.registryDir)){let r=e.readEntry(n);r!==null&&r.pid!==e.pid&&t.push({path:n,identity:r})}let n=wO(!0,DO(t,e.isSameLiveProcess,e.removeFile),e.ceiling);if(!n.allow)return{decision:n,registryPath:null};let r=c.join(e.registryDir,`pid-${e.pid}.json`);return e.writeEntry(r,{pid:e.pid,startTime:e.startTime}),{decision:n,registryPath:r}}function kO(e,t,n,r){let i=n(e);if(i!==null&&i.pid===t)try{r(e)}catch{}}function AO(e,t={}){return{isolated:!!process.env.CC_CANDYBAR_SOCKET,registryDir:He(),ceiling:CO(),pid:process.pid,startTime:e,isSameLiveProcess:(e,t)=>_O(e,t,{readStartTime:gO,pidAlive:SO}),listFiles:TO,readEntry:EO,removeFile:e=>{try{r.unlinkSync(e)}catch{}},writeEntry:(e,t)=>{let n=`${e}.${t.pid}.tmp`;try{r.writeFileSync(n,JSON.stringify(t),{mode:384}),r.renameSync(n,e)}catch(e){try{r.unlinkSync(n)}catch(e){e.code}throw e}},ensureDirSafe:process.env.CC_CANDYBAR_DAEMON_REGISTRY_DIR?Ie:e=>{Ie(c.dirname(e)),Ie(e)},...t}}function jO(e){return e<32||e===127||e>=128&&e<=159}function MO(e){let t=``;for(let n of e)t+=jO(n.codePointAt(0)??0)?` `:n;return t.replace(/\s+/g,` `).trim()}function NO(e,t){let n=MO(e),r=``,i=0;for(let e of n){if(i===t)return r.replace(/.$/u,`…`);r+=e,i++}return r}const PO=`\x1B[38;2;255;255;255m`,FO=`\x1B[48;2;200;40;40m`;function IO(e){let t=/;2;(\d+);(\d+);(\d+)m$/.exec(e);if(t===null)throw Error(`diagnostic-style: not a 24-bit SGR: ${e}`);return`#`+t.slice(1,4).map(e=>Number(e).toString(16).padStart(2,`0`)).join(``)}const LO={fg:IO(PO),bg:IO(FO)},RO={fg:IO(`\x1B[38;2;0;0;0m`),bg:IO(`\x1B[48;2;220;160;40m`)},zO={unicode:Ri,ascii:{glyph:`>`,divider:`|`,lead:`<`,tail:`>`}},BO={unicode:{},ascii:{left:`(`,right:`)`}};function VO(e,t,n){switch(e){case`capsule`:return new Wi(BO[t]);case`plain`:return new Gi(n===void 0?{}:{separator:n});case`powerline`:return new Vi(zO[t]);default:return e}}const HO=new Map;function UO(e){let t=JSON.stringify([e.endcaps,e.charset,e.separator??null]),n=HO.get(t);if(n!==void 0)return n;let r=VO(e.endcaps,e.charset,e.separator),i=e=>new U(`x`,{end:``,overflow:`ignore`,style:new V({bgcolor:e})}),a=e=>new U(Ji(new W(e,r),{colorSystem:null}).replace(/\n$/,``)).cellLength,o=a([i(`#101010`)]),s={chrome:o-1,seam:a([i(`#101010`),i(`#202020`)])-o-1};return HO.set(t,s),s}function WO(e){return UO(e).chrome}function GO(e){return UO(e).seam}function KO(e,t){if(e.length===0)return``;let n=VO(t.endcaps,t.charset,t.separator),r=t.colorCompatibility,i=t.wrap&&Number.isFinite(t.width)?Ji(new ea([...e],{joiner:n}),{width:t.width,colorSystem:r}):Ji(new W([...e],n),{colorSystem:r});if(!i.endsWith(`
173
+ `))throw Error(`renderStripCells: rich-js strip output did not end its last line`);return i.slice(0,-1)}function qO(e){return Math.min(20,e??20)}const JO={heading:`ERROR`,glyph:`⚠`,colors:LO},YO={heading:`WARNING`,glyph:`⚠`,colors:RO},XO={heading:`UPDATE`,glyph:`⬆`,colors:RO};function ZO(e,t){return{text:MO(e),link:t}}function QO(e,t,n){let[r,...i]=[$O(e,JO,qE),t,$O(n,YO,JE)].flat();return r===void 0?null:{channels:[r,...i]}}function $O(e,t,n){let r=pD([{verb:n,args:[e]}]),[i,...a]=e.split(/\r\n|\r|\n/).map(e=>ZO(e,r)).filter(e=>e.text!==``).map(e=>[e]);return i===void 0?[]:[{severity:t,message:e,lines:[i,...a]}]}function ek(e){return e.channels.map(e=>`${e.severity.heading}\n${e.message}\n`).join(`
174
+ `)}function tk(e,t,n,r){if(t===null)return e;let i=nk(r),a=t.channels.flatMap(e=>rk(e,i)),o=n.failedConfigFile!==null||a.length>r.rowCap,s=a.slice(0,r.rowCap-Number(o)),c=o?[ik(t,n,a.length-s.length,i)]:[],l=[...s,...c].join(`
175
+ `);return e?`${l}\n${e}`:l}function nk(e){return{endcaps:`plain`,separator:``,width:e.width,wrap:!0,padding:0,charset:`unicode`,colorCompatibility:e.colorCompatibility}}function rk(e,t){let n=new V({bgcolor:e.severity.colors.bg,color:e.severity.colors.fg}),r=zt(Math.max(2,t.width-1)),i=(e,t)=>new U(`${e} `,{style:t,end:``,overflow:`ignore`});return e.lines.flatMap((a,o)=>KO([i(o===0?e.severity.glyph:` `,n.withLink(a[0].link)),...a.flatMap(e=>{let t=n.withLink(e.link);return e.text.split(` `).flatMap(e=>Ht(e,r)).map(e=>i(e,t))})],t).split(`
176
+ `))}function ik(e,t,n,r){let{colors:i}=e.channels[0].severity,{fullText:a,failedConfigFile:o}=t,s=new V({bgcolor:i.bg,color:i.fg}),c=(e,t)=>new U(e,{style:t,end:``,overflow:`ignore`}),l=n>0?[c(`${n} more rows · `,s),a.kind===`file`?c(`open full text`,s.withLink(O(a.path).href)):c(`full text unavailable: ${MO(a.reason)}`,s)]:[],u=o===null?[]:[c(`${l.length>0?` · `:``}open `,s),c(MO(o),s.withLink(O(o).href))],d=[c(`↳ `,s),...l,...u.slice(0,-1)],f=d.reduce((e,t)=>e+t.cellLength,0),p=u.slice(-1).map(e=>e.truncate(Math.max(1,r.width-f),{mode:`middle`})),m=U.fromFragments([...d,...p]).truncate(r.width);return m.overflow=`ignore`,KO([m],r)}const ak=e=>!e.startsWith(`.`)&&!e.endsWith(`~`);function ok(e,t){return t.isSymbolicLink()?Buffer.from(r.readlinkSync(e)):r.readFileSync(e)}function sk(e,t){return r.readdirSync(t).filter(ak).sort().flatMap(n=>{let i=c.join(t,n),a=r.lstatSync(i,{throwIfNoEntry:!1});return a===void 0?[]:a.isDirectory()?sk(e,i):[[c.relative(e,i).split(c.sep).join(`/`),ok(i,a)]]})}function ck(e){let t=re.createHash(`sha256`);for(let[n,r]of sk(e,e))t.update(n).update(`\0`).update(r).update(`\0`);return t.digest(`hex`)}const lk=e=>e.slice(0,7);function uk(e){return c.dirname(c.dirname(e))}function dk(){return{version:yD,digest:`fabe2a77772a22c6af8464e9211e7b445fd6df3d311e128ceb3f61e97b6de5be`}}function fk(e){let t=JSON.parse(r.readFileSync(c.join(e,`package.json`),`utf8`)),n=typeof t==`object`&&t?t.version:void 0;if(typeof n!=`string`)throw Error(`${c.join(e,`package.json`)} has no version string`);return n}function pk(e,t){try{let n=uk(D(e)),i=c.join(n,`src`);if(!r.existsSync(i))return{kind:`not-source-checkout`};let a=t(),o=ck(i);return o===a.digest?{kind:`current`,root:n,stamp:a}:{kind:`stale`,root:n,source:{version:fk(n),digest:o},running:a}}catch(e){return{kind:`unchecked`,reason:e.message}}}var $=class extends Error{constructor(e){super(e),this.name=`BadVerbArgs`}};function mk(e){return e.op===`remove`?`remove:${e.target}`:`insert:${e.segment}:${e.anchor}:${e.relation}`}function hk(e){let t=e.split(`:`);return t[0]===`remove`&&t.length===2&&t[1]?{op:`remove`,target:t[1]}:t[0]===`insert`&&t.length===4&&t[1]&&t[2]&&(t[3]===`before`||t[3]===`after`)?{op:`insert`,segment:t[1],anchor:t[2],relation:t[3]}:null}function gk(e,t,n){let r=Ds(e,new Set(n.map(Es).filter(e=>e.includes(t)).flat()));return r===e?{seg:e}:{seg:e,id:r}}const _k=/^-?\d+$/;function vk(e,t,n=`set-state`){let r=e.filter(e=>e.includes(`/`));if(r.length>0)throw Error(`makeAllowListValidator(${t}): values contain "/" — the ${n} wire shape splits values on "/" so slash-bearing options cannot be addressed. Offending values: ${r.join(`, `)}`);if(e.includes(``))throw Error(`makeAllowListValidator(${t}): empty string is not a writable option — the validator rejects empty input before the allow-list check, so an "" in the allowed list could be rendered but never delivered. Remove "" from the allowed list.`);let i=new Set(e),a=[...e];return e=>e?i.has(e)?{ok:!0,value:e}:{ok:!1,reason:`unknown ${t} "${e}" (have: ${a.join(`, `)})`}:{ok:!1,reason:`${t} value is required`}}function yk(e){return t=>{if(!t)return{ok:!1,reason:`${e} value is required`};if(!_k.test(t))return{ok:!1,reason:`${e} must be an integer, got "${t}"`};let n=t[0]===`-`,r=(n?t.slice(1):t).replace(/^0+/,``);return r===``?{ok:!0,value:`0`}:{ok:!0,value:n?`-${r}`:r}}}function bk(e,t,n){return r=>r?_k.test(r)?{ok:!0,value:String(Math.max(e,Math.min(t,parseInt(r,10))))}:{ok:!1,reason:`${n} must be an integer, got "${r}"`}:{ok:!1,reason:`${n} value is required`}}function xk(e,t,n=`state`){let r=t.filter(e=>e.kind===`range`),i=t.some(e=>e.kind===`int`),a=t.flatMap(e=>e.kind===`allow-list`?e.allowed:[]);if(r.length===0&&!i)return{kind:`allow-list`,allowed:[...new Set(a)]};let o=a.filter(e=>!_k.test(e));if(o.length>0)throw Error(`${n} action table: key "${e}" is an integer spec (a paged cursor or a bounded value) but a click writes non-integer value(s) to it (${o.join(`, `)}). A ${n} key has one key shape — point that click at a distinct key, or write an integer.`);if(i&&r.length>0)throw Error(`${n} action table: key "${e}" is declared as both a paged cursor (int) and a bounded value (range) — a ${n} key has one key shape. Use distinct keys.`);if(r.length>0){let t=Math.min(...r.map(e=>e.min)),i=Math.max(...r.map(e=>e.max)),o=a.filter(e=>{let n=parseInt(e,10);return n<t||n>i});if(o.length>0)throw Error(`${n} action table: key "${e}" is a bounded range [${t},${i}] but a click writes out-of-range value(s) to it (${o.join(`, `)}). The range gate would clamp them, storing a different value than the click renders — write an in-range integer, or point that click at a distinct key.`);return{kind:`range`,min:t,max:i}}return{kind:`int`}}function Sk(e){return e===`config`?`set-config`:`set-state`}function Ck(e,t,n){return t.kind===`int`?yk(`menu page "${e}"`):t.kind===`range`?bk(t.min,t.max,`${n} stepper "${e}"`):vk(t.allowed,`${n} "${e}"`,Sk(n))}function wk(e,t=`state`){let n=new Map;for(let{key:t,spec:r}of e){let e=n.get(t);e?e.push(r):n.set(t,[r])}return[...n].map(([e,n])=>({key:e,spec:xk(e,n,t)}))}function Tk(e,t,n,r){let i=new Map(Object.entries(e)),a=new Map,o=new Set(t.map(e=>e.key));for(let{key:e,spec:t}of n)if(o.has(e)&&t.kind!==`allow-list`)throw Error(`${r} gate: key "${e}" is written by the daemon's own links as one of a list of values, and cannot be declared as ${t.kind===`int`?`a paged cursor (int)`:`a bounded value (range)`}. Use a distinct key.`);let s=[...t.map(({key:e,allowed:t})=>({key:e,spec:{kind:`allow-list`,allowed:t}})),...n];for(let{key:t,spec:n}of wk(s,r)){if(!t)throw Error(`${r} gate: key is required`);if(t.includes(`/`))throw Error(`${r} gate: key "${t}" contains "/" — the wire shape splits on "/" so a slash-bearing key cannot be addressed. Use a slash-free key.`);if(Object.hasOwn(e,t))throw Error(`${r} gate: key "${t}" is a built-in ${r} key and cannot be re-claimed (built-in keys: ${Object.keys(e).join(`, `)})`);i.set(t,Ck(t,n,r)),n.kind===`range`&&a.set(t,{min:n.min,max:n.max})}return{validate(e,t){let n=i.get(e);return n?n(t):{ok:!1,reason:`unknown ${r} key "${e}" (have: ${[...i.keys()].join(`, `)})`}},listKeys:()=>[...i.keys()],rangeParamsFor:e=>a.get(e)??null}}function Ek(e,t,n){let r=[],i=0,a=new WeakMap;return{register(n,a){let o={key:n,allowed:a};Tk(e,[o],[],t),r.push(o),i++;let s=!0;return()=>{s&&(s=!1,r.splice(r.indexOf(o),1),i++)}},gateFor(o){let s=a.get(o);if(s?.epoch===i)return s.gate;let c=Tk(e,r,n(o),t);return a.set(o,{epoch:i,gate:c}),c}}}const Dk=Ek({},`config`,Pk);function Ok(e,t){return Dk.register(e,t)}function kk(e){return Dk.gateFor(e)}function Ak(e,t){return`persist`in e?`to`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:[e.to]}}]:`from`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:$b(e.from,t).members}}]:`cycle`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:e.cycle}}]:`removeSegment`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:[mk({op:`remove`,target:e.removeSegment})]}}]:`insertSegment`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:[mk({op:`insert`,segment:e.insertSegment,anchor:e.anchor,relation:e.relation})]}}]:`insertSegmentFrom`in e?[{key:e.persist,spec:{kind:`allow-list`,allowed:$b(e.insertSegmentFrom,t).members.map(t=>mk({op:`insert`,segment:t,anchor:e.anchor,relation:e.relation}))}}]:[{key:e.persist,spec:{kind:`range`,min:e.min,max:e.max}}]:[]}function jk(e,t){let n=kl(e).get(t);return n===void 0?null:String(n)}function Mk(e){let t=new Set;for(let n of Object.values(e.actions)){`reset`in n&&t.add(n.reset);let e=`persist`in n?cx(n.persist):null;e?.scope===`preset-root`&&t.add(ox(e.preset))}return[...t].map(e=>({key:e,spec:{kind:`allow-list`,allowed:[]}}))}function Nk(e){let t=new Map([...Zb(e),...DC(e)]);return[...Mk(e),...Object.values(e.actions).flatMap(e=>Ak(e,t))]}function Pk(e){return wk(Nk(e),`config`)}const Fk=Array.from({length:10},(e,t)=>(t+1)*1e5),Ik=Fk[0],Lk=Fk[Fk.length-1];function Rk(e){let t;try{t=OD(e)}catch(e){return X(e instanceof Error?e.message:String(e))}let n=t.autoCompactWindow;return n===void 0?J(`auto`):typeof n==`number`&&Number.isInteger(n)&&n>=Ik&&n<=Lk?J(n):X(`${e}: autoCompactWindow is ${JSON.stringify(n)}, not a window /autocompact accepts (${Ik}–${Lk} tokens)`)}function zk(e,t){let n=Math.min(t??Lk,Lk),r=e===`auto`?n:Math.min(e,n);return{window:e===`auto`?0:e,applied:e===`auto`?0:r,lower:Fk.filter(e=>e<r).at(-1)??0,higher:Fk.find(e=>e>r&&e<=n)??0}}const Bk=Ux(`commands.`),Vk=`trimPrefix "/" (trimPrefix .project_dir .current_dir)`,Hk=`{{ \$dir := .current_dir }}{{ if and (ne .home "") (or (eq .home .current_dir) (hasPrefix (printf "%s/" .home) .current_dir)) }}{{ \$dir = printf "~%s" (trimPrefix .home .current_dir) }}{{ else }}{{ if or (eq .project_dir .current_dir) (hasPrefix (printf "%s/" .project_dir) .current_dir) }}{{ $dir = ternary (${Vk}) (basename .project_dir) (ne (${Vk}) "") }}{{ end }}{{ end }}{{ abbreviatePath \$dir }}`,Uk=`{{ ${xx} }}`,Wk={min:0,max:100,step:5},Gk={warnAt:{label:`warning at %`,domain:Wk,default:50},errorAt:{label:`error at %`,domain:{...Wk,atLeast:`warnAt`},default:80}};function Kk(e){return{budget:{label:`budget $`,domain:{min:0,max:1e4,step:5},default:e},warnAt:{label:`warning at %`,domain:Wk,default:80}}}const qk={globals:{palette:`tokyo-night`},variables:{...Bk.variables,...Eb,current_dir:{kind:`input`,path:`workspace.current_dir`,default:`?`},"model.display_name":{kind:`input`,path:`model.display_name`,default:``},version:{kind:`input`,path:`version`,default:``},home:{kind:`input`,path:`home`,default:``},"tmux.session":{kind:`input`,path:`tmux.session`,default:``},"host.name":{kind:`input`,path:`host.name`,default:``},"host.user":{kind:`input`,path:`host.user`,default:``},"host.ssh":{kind:`input`,path:`host.ssh`,type:`boolean`,default:!1},"git.repoName":{kind:`input`,path:`git.repoName`,default:``},"git.branch":{kind:`input`,path:`git.branch`,default:``},"git.sha":{kind:`input`,path:`git.sha`,default:``},"git.ahead":{kind:`input`,path:`git.ahead`,type:`number`,default:0},"git.behind":{kind:`input`,path:`git.behind`,type:`number`,default:0},"git.staged":{kind:`input`,path:`git.staged`,type:`number`,default:0},"git.unstaged":{kind:`input`,path:`git.unstaged`,type:`number`,default:0},"git.untracked":{kind:`input`,path:`git.untracked`,type:`number`,default:0},"git.conflicts":{kind:`input`,path:`git.conflicts`,type:`number`,default:0},"git.upstream":{kind:`input`,path:`git.upstream`,default:``},"git.stash":{kind:`input`,path:`git.stash`,type:`number`,default:0},"git.status":{kind:`input`,path:`git.status`,default:`clean`},"git.operation":{kind:`input`,path:`git.operation`,default:``},"git.timeSinceCommit":{kind:`input`,path:`git.timeSinceCommit`,type:`number`,default:0},"git.color.branch":{kind:`literal`,value:`primary`},"git.color.staged":{kind:`literal`,value:`success`},"git.color.unstaged":{kind:`literal`,value:`warning`},"git.color.untracked":{kind:`literal`,value:`accent`},"git.color.conflicts":{kind:`literal`,value:`error`},"git.color.ahead":{kind:`literal`,value:`success`},"git.color.behind":{kind:`literal`,value:`warning`},"git.color.stash":{kind:`literal`,value:`accent`},"git.detail":{kind:`state`,key:`git-detail`,default:`collapsed`},"git.prNumber":{kind:`input`,path:`git.prNumber`,type:`number`,default:0},"git.prState":{kind:`input`,path:`git.prState`,default:``},"git.prUrl":{kind:`input`,path:`git.prUrl`,default:``},"git.prError":{kind:`input`,path:`git.prError`,default:``},"cache.expiresAt":{kind:`input`,path:`cache.expiresAt`,type:`number`,default:0},"session.cost":{kind:`input`,path:`session.cost`,type:`number`,default:0},"session.tokens":{kind:`input`,path:`session.tokens`,type:`number`,default:0},"today.cost":{kind:`input`,path:`today.cost`,type:`number`,default:0},"today.tokens":{kind:`input`,path:`today.tokens`,type:`number`,default:0},"block.nativeUtilization":{kind:`input`,path:`block.nativeUtilization`,type:`number`,default:0},"block.resetsAt":{kind:`input`,path:`block.resetsAt`,type:`number`,default:0},"weekly.percentage":{kind:`input`,path:`weekly.percentage`,type:`number`,default:0},"weekly.resetsAt":{kind:`input`,path:`weekly.resetsAt`,type:`number`,default:0},"burn.costPerHour":{kind:`input`,path:`burn.costPerHour`,type:`number`,default:-1},"block.etaMinutes":{kind:`input`,path:`block.etaMinutes`,type:`number`,default:-1},"weekly.etaMinutes":{kind:`input`,path:`weekly.etaMinutes`,type:`number`,default:-1},"speed.input":{kind:`input`,path:`speed.input`,type:`number`,default:-1},"speed.output":{kind:`input`,path:`speed.output`,type:`number`,default:-1},"speed.total":{kind:`input`,path:`speed.total`,type:`number`,default:-1},"speed.history":{kind:`input`,path:`speed.history`,type:`string`,default:``},"context.totalTokens":{kind:`input`,path:`context.totalTokens`,type:`number`,default:0},"context.contextLeft":{kind:`input`,path:`context.contextLeft`,type:`number`,default:100},"memento.ceiling":{kind:`input`,path:`memento.ceiling`,type:`number`,default:-1},"memento.off":{kind:`input`,path:`memento.off`,type:`boolean`,default:!1},"memento.session":{kind:`input`,path:`memento.session`,default:``},"memento.error":{kind:`input`,path:`memento.error`,default:``},"autocompact.window":{kind:`input`,path:`autocompact.window`,type:`number`,default:-1},...Object.fromEntries([`applied`,`lower`,`higher`].map(e=>[`autocompact.${e}`,{kind:`input`,path:`autocompact.${e}`,type:`number`,default:0}])),"autocompact.error":{kind:`input`,path:`autocompact.error`,default:``},"metrics.lastResponseTime":{kind:`input`,path:`metrics.lastResponseTime`,type:`number`,default:0},"metrics.responseTime":{kind:`input`,path:`metrics.responseTime`,type:`number`,default:0},"metrics.sessionDuration":{kind:`input`,path:`metrics.sessionDuration`,type:`number`,default:0},"metrics.messageCount":{kind:`input`,path:`metrics.messageCount`,type:`number`,default:0},"metrics.linesAdded":{kind:`input`,path:`metrics.linesAdded`,type:`number`,default:0},"metrics.linesRemoved":{kind:`input`,path:`metrics.linesRemoved`,type:`number`,default:0},"activity.command":{kind:`input`,path:`activity.command`,type:`string`,default:``},"activity.todo.total":{kind:`input`,path:`activity.todo.total`,type:`number`,default:0},"activity.todo.completed":{kind:`input`,path:`activity.todo.completed`,type:`number`,default:0},"activity.todo.position":{kind:`input`,path:`activity.todo.position`,type:`number`,default:0},"activity.todo.active":{kind:`input`,path:`activity.todo.active`,type:`string`,default:``},"activity.tool.running":{kind:`input`,path:`activity.tool.running`,type:`string`,default:``},"activity.tool.done":{kind:`input`,path:`activity.tool.done`,type:`string`,default:``}},segments:{directory:{group:`location`,description:"The current directory, shortened fish-style — `~` under home, project-relative inside the project.",template:Hk},model:{group:`model-context`,description:`The active model's display name.`,template:`✱ {{ formatModelName .model.display_name }}`,when:`{{ ne .model.display_name "" }}`},sessionId:{group:`session-tools`,description:`The session id, truncated to 8 characters.`,template:`⌗{{ trunc 8 .session.id }}`,when:`{{ ne .session.id "" }}`},version:{group:`model-context`,description:`The Claude Code version reported in the hook payload.`,template:`◈ v{{ .version }}`,when:`{{ ne .version "" }}`},tmux:{group:`location`,description:`The tmux session name; hidden when not inside tmux.`,template:`tmux:{{ .tmux.session | default "none" }}`,when:`{{ ne .tmux.session "" }}`},host:{group:`location`,description:`user@host on a warning background, shown only over SSH.`,template:`⇄ {{ .host.user | default "?" }}@{{ .host.name | default "?" }}`,bg:`warning`,when:`{{ .host.ssh }}`},gitaculous:{group:`git`,description:`The git state: a summary (branch, ahead/behind, S/U/? flags) that the arrow at its right edge expands to every fact — repo, in-progress operation, sha, upstream ±, stash count, time since the last commit.`,template:`{{ if eq .git.detail "expanded" }}{{ template "gitExpanded" . }}{{ else }}{{ template "gitCollapsed" . }}{{ end }} {{ action "gitDetail" "▸" "◂" }}`,fg:Uk,when:`{{ ne .git.branch "" }}`,settings:{aheadBehind:{label:`ahead/behind`,domain:`bool`,default:!0},flags:{label:`dirty flags`,domain:`bool`,default:!0},operation:{label:`operation`,domain:`bool`,default:!0},repo:{label:`repo name`,domain:`bool`,default:!0},sha:{label:`commit hash`,domain:`bool`,default:!0},stash:{label:`stash`,domain:`bool`,default:!0},upstream:{label:`upstream`,domain:`bool`,default:!0},age:{label:`time since commit`,domain:`bool`,default:!0}}},gitPr:{group:`git`,description:"The pull request open for this branch, as a link; `⚠ PR` when the forge lookup failed.",template:`{{ if ne .git.prUrl "" }}{{ link .git.prUrl (printf "⇆ #%v" .git.prNumber) }}{{ else }}⚠ PR{{ end }}`,when:`{{ or (ne .git.prUrl "") (ne .git.prError "") }}`},toolbar:{group:`session-tools`,description:`Quick actions: copy the session id, and open the project, transcript or repo.`,template:Mx(``).template},commands:{group:`session-tools`,description:`Type /compact, /model or /clear into this session; /clear asks for a second click.`,template:Bk.template},themeSwitcher:{group:`session-tools`,description:"`◀ <theme> ▶`: the theme the bar is wearing; ◀ and ▶ switch this session to the previous or next theme, wrapping at the ends.",template:`{{ carousel "stepTheme" 0 }}`},session:{group:`cost-limits`,description:`This session's cost and token total, with a budget warning once a budget is configured.`,template:`§ {{ template "formatCost" .session.cost }} ({{ template "formatTokens" .session.tokens }}){{ template "budgetStatus" (dict "cost" .session.cost "budget" .settings.budget "warn" .settings.warnAt) }}`,settings:Kk(0)},today:{group:`cost-limits`,description:`Today's cost and tokens across every session, with a budget warning once a budget is configured.`,template:`☉ {{ template "formatCost" .today.cost }} ({{ template "formatTokens" .today.tokens }}){{ template "budgetStatus" (dict "cost" .today.cost "budget" .settings.budget "warn" .settings.warnAt) }}`,settings:Kk(50)},block:{group:`cost-limits`,description:`The 5-hour rate-limit block: percent used and time to reset, heating to warning then error.`,template:`◱ {{ round .block.nativeUtilization }}% ({{ template "formatResetCountdown" .block.resetsAt }})`,bg:`{{ ramp (round .block.nativeUtilization) "step" 0 (tint) .settings.warnAt "warning" .settings.errorAt "error" }}`,settings:Gk,when:`{{ gt .block.resetsAt 0 }}`},weekly:{group:`cost-limits`,description:`The weekly rate-limit quota: percent used and time to reset, heating to warning then error.`,template:`◑ {{ round .weekly.percentage }}% ({{ template "formatResetCountdown" .weekly.resetsAt }})`,bg:`{{ ramp (round .weekly.percentage) "step" 0 (tint) .settings.warnAt "warning" .settings.errorAt "error" }}`,settings:Gk,when:`{{ gt .weekly.resetsAt 0 }}`},burnrate:{group:`cost-limits`,description:`Spend per hour, with the projected time to the 5-hour and weekly limits.`,template:`⚡ {{ template "formatRate" .burn.costPerHour }} · {{ template "formatEta" .block.etaMinutes }} to 5h · {{ template "formatEta" .weekly.etaMinutes }} to wk`,bg:`{{ ramp .block.etaMinutes "step" -1 (tint) 0 "error" .settings.errorWithin "warning" .settings.warnWithin (tint) }}`,settings:{errorWithin:{label:`error within (min)`,domain:{min:0,max:300,step:5},default:30},warnWithin:{label:`warning within (min)`,domain:{min:0,max:300,step:5,atLeast:`errorWithin`},default:60}},when:`{{ or (gt .block.resetsAt 0) (gt .weekly.resetsAt 0) }}`},speed:{group:`activity`,description:`Token throughput for the latest exchange: output, input, and total.`,template:`⇅ out {{ template "formatSpeed" .speed.output }} · in {{ template "formatSpeed" .speed.input }} · tot {{ template "formatSpeed" .speed.total }}`,when:`{{ gt .session.tokens 0 }}`},tokenSparkline:{group:`activity`,description:`A sparkline of recent token throughput.`,template:`⚡ {{ sparkline .speed.history 24 }}`,when:`{{ ne .speed.history "" }}`},cacheTimer:{group:`activity`,description:"Minutes until the prompt cache expires, or `cold` once it has.",template:`◴ {{ if le (minutesUntilReset .cache.expiresAt) 0 }}cold{{ else }}{{ minutesUntilReset .cache.expiresAt }}m{{ end }}`,fg:`{{ readableOn (color (cascade (minutesUntilReset .cache.expiresAt) "0:error" "9:warning" "21:foreground")) (bgOf) ${Ea} }}`,when:`{{ gt .cache.expiresAt 0 }}`},context:{group:`model-context`,description:`Context used, in tokens and percent remaining, heating as it fills.`,template:`◔ {{ formatInteger .context.totalTokens }} ({{ .context.contextLeft }}%)`,bg:`{{ ramp .context.contextLeft "step" 0 "error" 21 "warning" 41 (tint) }}`,when:`{{ gt .context.totalTokens 0 }}`},ceiling:{group:`model-context`,description:`The memento plugin's context ceiling for this session: − and + move it by 100K, ∞ lifts it, ↺ drops this session's own setting.`,template:`{{ if ne .memento.error "" }}⌈ ⚠ {{ .memento.error }} {{ action "ceiling.clear" "↺" }}{{ else }}⌈ {{ if .memento.off }}off{{ else }}{{ template "formatTokenCount" .memento.ceiling }} {{ action "ceiling.lower" "−" }} {{ action "ceiling.raise" "+" }} {{ action "ceiling.off" "∞" }}{{ end }}{{ if ne .memento.session "" }} {{ action "ceiling.clear" "↺" }}{{ end }}{{ end }}`,bg:`{{ if ne .memento.error "" }}{{ color "error" }}{{ else }}{{ tint }}{{ end }}`,when:`{{ or (ge .memento.ceiling 0) (ne .memento.error "") }}`},autocompact:{group:`model-context`,description:`Claude Code's auto-compact window: − and + move it by 100K, ↺ returns it to auto. Clicks type /autocompact into this session.`,template:`{{ if ne .autocompact.error "" }}⇲ ⚠ {{ .autocompact.error }}{{ else }}⇲ {{ if eq .autocompact.window 0 }}auto{{ else }}{{ template "formatTokenCount" .autocompact.applied }}{{ end }}{{ if gt .autocompact.lower 0 }} {{ action (printf "autocompact.%d" .autocompact.lower) "−" }}{{ end }}{{ if gt .autocompact.higher 0 }} {{ action (printf "autocompact.%d" .autocompact.higher) "+" }}{{ end }}{{ if gt .autocompact.window 0 }} {{ action "autocompact.auto" "↺" }}{{ end }}{{ end }}`,bg:`{{ if ne .autocompact.error "" }}{{ color "error" }}{{ else }}{{ tint }}{{ end }}`,when:`{{ or (ge .autocompact.window 0) (ne .autocompact.error "") }}`},metrics:{group:`activity`,description:`Response times, session duration, message count, and lines added/removed.`,template:`{{ if .metrics.lastResponseTime }} Δ {{ template "formatResponseTime" .metrics.lastResponseTime }}{{ end }}{{ if .metrics.responseTime }} ⧖ {{ template "formatResponseTime" .metrics.responseTime }}{{ end }}{{ if .metrics.sessionDuration }} ⧗ {{ template "formatDuration" .metrics.sessionDuration }}{{ end }}{{ if .metrics.messageCount }} ◆ {{ .metrics.messageCount }}{{ end }}{{ if .metrics.linesAdded }} + {{ .metrics.linesAdded }}{{ end }}{{ if .metrics.linesRemoved }} - {{ .metrics.linesRemoved }}{{ end }} `,when:`{{ or (gt .metrics.lastResponseTime 0.0) (gt .metrics.responseTime 0.0) (gt .metrics.sessionDuration 0.0) (gt .metrics.messageCount 0) (gt .metrics.linesAdded 0) (gt .metrics.linesRemoved 0) }}`},activity:{group:`activity`,description:`What Claude is doing: the slash command that opened the turn, the in-progress todo, and the tools in flight.`,template:`{{ if .activity.command }} ⌘ {{ .activity.command }}{{ end }}{{ if .activity.todo.total }}{{ if .activity.todo.active }} ☐ {{ .activity.todo.position }}/{{ .activity.todo.total }} {{ abbrev 32 .activity.todo.active }}{{ else }} ☑ {{ .activity.todo.completed }}/{{ .activity.todo.total }}{{ end }}{{ end }}{{ if .activity.tool.running }} ⟳ {{ template "formatToolTally" .activity.tool.running }}{{ end }}{{ if .activity.tool.done }} ✓ {{ template "formatToolTally" .activity.tool.done }}{{ end }} `,when:`{{ or (ne .activity.command "") (gt .activity.todo.total 0) (ne .activity.tool.running "") (ne .activity.tool.done "") }}`}},root:{rows:{identity:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`host`},{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`}]},status:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`model`},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`context`},{kind:`segment`,name:`ceiling`},{kind:`segment`,name:`autocompact`}]},{kind:`segment`,name:`cacheTimer`},{kind:`segment`,name:`block`},{kind:`segment`,name:`weekly`},{kind:`segment`,name:`activity`}]}}},actions:{...Mx(``).actions,...Bk.actions,copyDir:{copy:`{{ .current_dir }}`},stepTheme:{set:`theme`,from:`themes`},gitDetail:{set:`git-detail`,cycle:[`collapsed`,`expanded`]},"ceiling.raise":{ceiling:`set`,to:`+100_000`},"ceiling.lower":{ceiling:`set`,to:`-100_000`},"ceiling.off":{ceiling:`set`,to:`off`},"ceiling.clear":{ceiling:`clear`},"autocompact.auto":{slash:Bx(`/autocompact auto`)},...Object.fromEntries(Fk.map(e=>[`autocompact.${e}`,{slash:Bx(`/autocompact ${e}`)}]))},styles:{none:{hueShift:0,chromaScale:1,lightnessScale:1,lightnessShift:0},vivid:{hueShift:0,chromaScale:1.35,lightnessScale:1,lightnessShift:0},muted:{hueShift:0,chromaScale:.55,lightnessScale:1,lightnessShift:0},dim:{hueShift:0,chromaScale:1,lightnessScale:.85,lightnessShift:0},bright:{hueShift:0,chromaScale:1,lightnessScale:1,lightnessShift:.08},inverted:{hueShift:0,chromaScale:1,lightnessScale:-1,lightnessShift:1}},presets:{default:{},compact:{root:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`},{kind:`segment`,name:`context`}]},globals:{padding:0}},verbose:{root:{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`},{kind:`segment`,name:`gitPr`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`model`},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`context`},{kind:`segment`,name:`ceiling`},{kind:`segment`,name:`autocompact`}]},{kind:`segment`,name:`cacheTimer`},{kind:`segment`,name:`block`},{kind:`segment`,name:`weekly`},{kind:`segment`,name:`burnrate`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`speed`},{kind:`segment`,name:`tokenSparkline`}]}]}},zen:{root:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`directory`},{kind:`segment`,name:`context`}]},globals:{endcaps:`plain`,style:`dim`}},git:{root:{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`host`},{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`},{kind:`segment`,name:`gitPr`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`model`},{kind:`segment`,name:`context`},{kind:`segment`,name:`activity`}]}]}},usage:{root:{kind:`container`,direction:`vertical`,children:[{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`model`},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`context`},{kind:`segment`,name:`ceiling`},{kind:`segment`,name:`autocompact`}]},{kind:`segment`,name:`cacheTimer`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`block`},{kind:`segment`,name:`weekly`},{kind:`segment`,name:`burnrate`}]},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`session`},{kind:`segment`,name:`today`},{kind:`segment`,name:`speed`},{kind:`segment`,name:`tokenSparkline`}]}]}},dense:{root:{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`host`},{kind:`segment`,name:`directory`},{kind:`segment`,name:`gitaculous`},{kind:`segment`,name:`model`},{kind:`container`,direction:`horizontal`,children:[{kind:`segment`,name:`context`},{kind:`segment`,name:`ceiling`},{kind:`segment`,name:`autocompact`}]},{kind:`segment`,name:`cacheTimer`},{kind:`segment`,name:`block`},{kind:`segment`,name:`weekly`},{kind:`segment`,name:`session`},{kind:`segment`,name:`activity`}]},globals:{padding:0}}},editGlobals:{endcaps:`plain`,default_separator:` | `},helpers:{gitPaint:`{{ fg (readableOn (color .color) (bgOf) ${Ea}) .text }}`,gitCollapsed:`{{ template "gitBranch" . }}{{ template "gitAheadBehind" . }}{{ template "gitFlags" . }}`,gitExpanded:`(git){{ template "gitRepo" . }}{{ template "gitOperation" . }}{{ template "gitSha" . }}{{ template "gitFlags" . }} {{ template "gitBranch" . }}{{ template "gitUpstream" . }}{{ template "gitStash" . }}{{ template "gitAge" . }}`,gitBranch:`⎇ {{ template "gitPaint" (dict "color" .git.color.branch "text" .git.branch) }}`,gitRepo:`{{ if and .settings.repo (ne .git.repoName "") }} {{ .git.repoName }}{{ end }}`,gitOperation:`{{ if and .settings.operation (ne .git.operation "") }} [{{ .git.operation }}]{{ end }}`,gitSha:`{{ if and .settings.sha (ne .git.sha "") }} {{ .git.sha }}{{ end }}`,gitFlags:`{{ if and .settings.flags (or (gt .git.staged 0) (gt .git.unstaged 0) (gt .git.untracked 0) (gt .git.conflicts 0)) }} {{ if gt .git.staged 0 }}{{ template "gitPaint" (dict "color" .git.color.staged "text" "S") }}{{ end }}{{ if gt .git.unstaged 0 }}{{ template "gitPaint" (dict "color" .git.color.unstaged "text" "U") }}{{ end }}{{ if gt .git.untracked 0 }}{{ template "gitPaint" (dict "color" .git.color.untracked "text" "?") }}{{ end }}{{ if gt .git.conflicts 0 }}{{ template "gitPaint" (dict "color" .git.color.conflicts "text" (printf "!%v" .git.conflicts)) }}{{ end }}{{ end }}`,gitAheadBehind:`{{ if and .settings.aheadBehind (or (gt .git.ahead 0) (gt .git.behind 0)) }} {{ if gt .git.ahead 0 }}{{ template "gitPaint" (dict "color" .git.color.ahead "text" (printf "+%v" .git.ahead)) }}{{ end }}{{ if and (gt .git.ahead 0) (gt .git.behind 0) }}/{{ end }}{{ if gt .git.behind 0 }}{{ template "gitPaint" (dict "color" .git.color.behind "text" (printf "-%v" .git.behind)) }}{{ end }}{{ end }}`,gitUpstream:`{{ if and .settings.upstream (ne .git.upstream "") }} [{{ .git.upstream }}{{ template "gitAheadBehind" . }}]{{ end }}`,gitStash:`{{ if and .settings.stash (gt .git.stash 0) }} {{ template "gitPaint" (dict "color" .git.color.stash "text" (printf "(%v stashed)" .git.stash)) }}{{ end }}`,gitAge:`{{ if and .settings.age (gt .git.timeSinceCommit 0) }} ◷ {{ template "formatTimeSince" .git.timeSinceCommit }}{{ end }}`,formatCost:'{{ if lt . 0.01 }}<$0.01{{ else }}${{ printf "%.2f" . }}{{ end }}',formatTokenCount:`{{ if ge . 1000000 }}{{ printf "%.1f" (divf . 1000000) }}M{{ else if ge . 1000 }}{{ printf "%.1f" (divf . 1000) }}K{{ else }}{{ . }}{{ end }}`,formatTokens:`{{ template "formatTokenCount" . }} tokens`,formatToolTally:`{{ $names := splitList "," . }}{{ range $i, $pair := $names }}{{ if lt $i 2 }}{{ if $i }} {{ end }}{{ $kv := splitList ":" $pair }}{{ index $kv 0 }}{{ if ne (index $kv 1) "1" }}×{{ index $kv 1 }}{{ end }}{{ end }}{{ end }}{{ if gt (len $names) 2 }} +{{ sub (len $names) 2 }}{{ end }}`,formatRate:`{{ if lt . 0 }}—/hr{{ else }}{{ template "formatCost" . }}/hr{{ end }}`,formatEta:`{{ if lt . 0 }}—{{ else }}{{ template "formatLongTimeRemaining" . }}{{ end }}`,formatSpeed:`{{ if lt . 0 }}—{{ else }}{{ template "formatTokenCount" (round .) }}/s{{ end }}`,formatTokenBreakdown:`{{ $first := true }}{{ if gt .input 0 }}{{ template "formatTokenCount" .input }} in{{ $first = false }}{{ end }}{{ if gt .output 0 }}{{ if not $first }} + {{ end }}{{ template "formatTokenCount" .output }} out{{ $first = false }}{{ end }}{{ if or (gt .cacheCreation 0) (gt .cacheRead 0) }}{{ if not $first }} + {{ end }}{{ template "formatTokenCount" (add .cacheCreation .cacheRead) }} cached{{ $first = false }}{{ end }}{{ if $first }}0 tokens{{ end }}`,budgetStatus:`{{ if or (le .budget 0) (lt .cost 0) }}{{ else }}{{ $pct := minf 100 (mulf (divf .cost .budget) 100) }}{{ $p := printf "%.0f%%" $pct }}{{ if ge $pct .warn }} !{{ $p }}{{ else }}{{ if ge $pct 50 }} +{{ $p }}{{ else }} {{ $p }}{{ end }}{{ end }}{{ end }}`,formatTimeSince:`{{ if lt . 60 }}{{ . }}s{{ else if lt . 3600 }}{{ div . 60 }}m{{ else if lt . 86400 }}{{ div . 3600 }}h{{ else if lt . 604800 }}{{ div . 86400 }}d{{ else }}{{ div . 604800 }}w{{ end }}`,formatDuration:`{{ if lt . 60 }}{{ printf "%.0f" . }}s{{ else if lt . 3600 }}{{ printf "%.0f" (divf . 60) }}m{{ else if lt . 86400 }}{{ printf "%.1f" (divf . 3600) }}h{{ else }}{{ printf "%.1f" (divf . 86400) }}d{{ end }}`,formatResponseTime:`{{ if lt . 60 }}{{ printf "%.1f" . }}s{{ else }}{{ printf "%.1f" (divf . 60) }}m{{ end }}`,formatLongTimeRemaining:`{{ if ge . 1440 }}{{ $d := div . 1440 }}{{ $h := div (mod . 1440) 60 }}{{ if gt $h 0 }}{{ $d }}d {{ $h }}h{{ else }}{{ $d }}d{{ end }}{{ else if ge . 60 }}{{ $h := div . 60 }}{{ $m := mod . 60 }}{{ if gt $m 0 }}{{ $h }}h {{ $m }}m{{ else }}{{ $h }}h{{ end }}{{ else }}{{ . }}m{{ end }}`,formatResetCountdown:`{{ template "formatLongTimeRemaining" (add 1 (minutesUntilReset .)) }}`}},Jk=new Set([qk.globals.palette,...Object.values(qk.segments).map(e=>e.palette)].filter(e=>e!==void 0)),Yk=Lc(TT(`<default>`,JSON.stringify(qk),Jk),qk),Xk=w_(Yk.presets);function Zk(e){return Xk.includes(e)}function Qk(e){if(!e)return 0;try{return o(e).mtimeMs}catch{return 0}}const $k=new class{slots;head=null;tail=null;constructor(e){this.slots=e}async run(e){await this.acquire();try{return await e()}finally{this.release()}}async acquire(){if(this.slots>0){this.slots--;return}await new Promise(e=>{let t={wake:e,next:null};this.tail?this.tail.next=t:this.head=t,this.tail=t})}release(){let e=this.head;if(!e){this.slots++;return}this.head=e.next,this.head||(this.tail=null),e.wake()}}(8);function eA(e){return((...t)=>$k.run(()=>e(...t)))}const tA=eA(C),nA=eA(S),rA=eA(w);async function iA(e,t){return $k.run(async()=>{let n=null;try{n=await x(e,`r`);let{size:r,mtimeMs:i,ino:a}=await n.stat(),o=t!==void 0&&(a!==t.ino||r<t.offset),s=o||t===void 0?0:t.offset;if(s>=r)return J({buf:Buffer.alloc(0),start:s,size:r,mtimeMs:i,ino:a,reset:o});let c=Buffer.alloc(r-s),l=0;for(;l<c.length;){let{bytesRead:e}=await n.read(c,l,c.length-l,s+l);if(e===0)break;l+=e}return J({buf:l===c.length?c:c.subarray(0,l),start:s,size:r,mtimeMs:i,ino:a,reset:o})}catch(t){return t.code===`ENOENT`?Y:X(`readAppended ${e}: ${t instanceof Error?t.message:String(t)}`)}finally{await n?.close().catch(e=>{k(`transcript-fs: close failed: ${e instanceof Error?e.message:String(e)}`)})}})}async function aA(e,t){return $k.run(async()=>{let n=null;try{n=await x(e,`r`);let{size:r}=await n.stat(),i=Math.max(0,r-t),a=Buffer.alloc(r-i),o=0;for(;o<a.length;){let{bytesRead:e}=await n.read(a,o,a.length-o,i+o);if(e===0)break;o+=e}return J({buf:o===a.length?a:a.subarray(0,o),fromStart:i===0})}catch(t){return t.code===`ENOENT`?Y:X(`readTail ${e}: ${t instanceof Error?t.message:String(t)}`)}finally{await n?.close().catch(e=>{k(`transcript-fs: close failed: ${e instanceof Error?e.message:String(e)}`)})}})}const oA=/"(?:cache_read_input_tokens|cache_creation_input_tokens)":[1-9]/;function sA(e){let t;try{t=JSON.parse(e)}catch{return null}let n=t.message?.usage;if(!((n?.cache_read_input_tokens??0)>0||(n?.cache_creation_input_tokens??0)>0))return null;let r=t.timestamp==null?NaN:Date.parse(t.timestamp);return Number.isNaN(r)?null:r}async function cA(e){let t=await lA(e);return t.kind===`ok`?J(Math.floor((t.value+36e5)/1e3)):t}async function lA(e){for(let t of[65536,1048576]){let n=await aA(e,t);if(n.kind!==`ok`)return n;let r=uA(n.value.buf,n.value.fromStart);if(r!=null)return J(r);if(n.value.fromStart)return Y}return Y}function uA(e,t){let n=e.toString(`utf8`).split(`
177
+ `),r=+!t;for(let e=n.length-1;e>=r;e--){let t=n[e];if(!t||!oA.test(t))continue;let r=sA(t);if(r!=null)return r}return null}function dA(e,t){return{...e,claudeConfigDir:wD(t.claudeConfigDir),env:t.mementoEnv}}const fA=c.join(`lib`,`ceiling_config.py`),pA=c.join(`skills`,`ceiling`,`bin`,`ceiling`);function mA(e,t){let n=typeof e==`object`&&e?e.plugins:void 0;if(typeof n!=`object`||!n)throw Error(`${t} has no "plugins" object`);return Object.entries(n).filter(([e])=>e.split(`@`)[0]===`memento`).flatMap(([e,n])=>{if(!Array.isArray(n))throw Error(`${t}: "${e}" is not a list of installs`);return n.map(n=>{let{scope:r,installPath:i,projectPath:a}=n??{};if(typeof r!=`string`||typeof i!=`string`)throw Error(`${t}: an install of "${e}" has no scope/path`);return typeof a==`string`?{key:e,scope:r,installPath:i,projectPath:a}:{key:e,scope:r,installPath:i}})})}function hA(e,t){let n=!0;for(let i of e){if(!r.existsSync(i))continue;let e;try{e=JSON.parse(r.readFileSync(i,`utf8`))?.enabledPlugins?.[t]}catch(e){return X(`memento lookup: ${i}: ${e.message}`)}typeof e==`boolean`&&(n=e)}return J(n)}function gA(e,t){if(!r.existsSync(e))return Y;let n;try{n=mA(JSON.parse(r.readFileSync(e,`utf8`)),e)}catch(e){return X(`memento lookup: ${e.message}`)}let i=n.find(e=>e.projectPath===t)??n.find(e=>e.scope===`user`);if(i===void 0)return Y;let a=hA([c.join(c.dirname(c.dirname(e)),`settings.json`),c.join(t,`.claude`,`settings.json`),c.join(t,`.claude`,`settings.local.json`)],i.key);if(a.kind!==`ok`)return a;if(!a.value)return Y;let o=[fA,pA].filter(e=>!r.existsSync(c.join(i.installPath,e)));return o.length===0?J(i.installPath):X(`memento at ${i.installPath} has no ${o.join(` or `)} — upgrade the plugin`)}function _A(e,t=process.env){let n=new Set([`CLAUDE_PROJECT_DIR`,`CLAUDE_CODE_SESSION_ID`,...e.env===void 0?[]:Je]);return{...Object.fromEntries(Object.entries(t).filter(([e])=>!n.has(e))),...e.env,CLAUDE_CODE_SESSION_ID:e.sessionId,CLAUDE_PROJECT_DIR:e.projectDir||e.cwd}}function vA(e){return e.stderr.trim()||e.error||`${e.reason}${e.exitCode===null?``:` (exit ${e.exitCode})`}`}function yA(e){let t;try{t=JSON.parse(e)}catch{return X(`memento read: not JSON: ${e.trim()}`)}let{ceiling:n,session:r}=t??{},i=n===`off`||typeof n==`number`&&n>=0?n:void 0;return i!==void 0&&(r===null||typeof r==`string`)?J({ceiling:i,session:r}):X(`memento read: unexpected answer: ${e.trim()}`)}async function bA(e,t){let n=await De({bin:`python3`,args:[`-c`,`
178
178
  import json, math, sys
179
179
  sys.path.insert(0, sys.argv[1])
180
180
  from ceiling_config import CONFIG_NAME, anchored, ceiling_in, in_force, session_directory
@@ -183,38 +183,38 @@ ceiling = in_force(directory, anchored(sys.argv[3]))
183
183
  layer = ceiling_in(directory / CONFIG_NAME)
184
184
  print(json.dumps({"ceiling": "off" if ceiling == math.inf else ceiling,
185
185
  "session": layer.text if layer else None}))
186
- `,c.join(e,`lib`),t.sessionId,t.cwd],env:fA(t),timeoutMs:3e3,category:`memento.read`});return n.ok?mA(n.stdout):X(pA(n))}function gA(e,t,n){let r=Oe({bin:c.join(e,cA),args:n.kind===`set`?[`set`,`session`,n.to]:[`clear`,`session`],env:fA(t),timeoutMs:5e3,category:`memento.move`});if(!r.ok)throw Error(pA(r))}function _A(){return{locate:e=>dA(bD(e.claudeConfigDir),e.projectDir),read:hA,move:gA}}function vA(e,t,n){let r=n===void 0?``:`CLAUDE_CONFIG_DIR=${gD(n)} `,i=e.added_dirs.map(e=>` --add-dir ${gD(e)}`).join(``);return`cd ${gD(e.project_dir)} && ${r}claude --resume ${gD(t)}${i}`}function yA(e,t,n){let r=w_(t(`preset`),e.globals.preset,e.presets),i=D_(e,r),a=t(`edit.mode`)===`arrange`?e.editGlobals:{};return{preset:r,presetCustomized:n(r),theme:Ub(a.palette,t(`theme`),i.palette),style:lo(a.style,t(`style`),i.style,e.styles),endcaps:po(a.endcaps,t(`endcaps`),i.endcaps),variation:bo(a.variation,t(`variation`),i.variation),separator:a.default_separator??i.default_separator,autoWrap:Do(a.autoWrap,t(`autoWrap`),i.autoWrap),padding:ko(a.padding,t(`padding`),i.padding),charset:a.charset??i.charset??`unicode`,updateNotice:Oo(a.updateNotice,t(`updateNotice`),i.updateNotice),colorCompatibility:a.colorCompatibility??i.colorCompatibility??`truecolor`}}function bA(e,t){return{endcaps:e.endcaps,separator:e.separator,colorCompatibility:e.colorCompatibility,wrap:e.autoWrap,padding:e.padding,charset:e.charset,width:t}}function xA(e){return{theme:e.theme,style:e.style,preset:e.preset,variation:e.variation}}function SA(e){return{preset:{effective:e.preset,customized:e.presetCustomized,bundled:Kk(e.preset)},endcaps:{effective:e.endcaps},variation:{effective:e.variation},charset:{effective:e.charset},colorCompatibility:{effective:e.colorCompatibility},autoWrap:{effective:e.autoWrap},padding:{effective:e.padding},updateNotice:{effective:e.updateNotice}}}const CA=10*1e3;function wA(e,t,n,r){let i=n-(t*1e3-r);if(i<3e5||e<=0)return;let a=e/i,o=(100-e)/a;return Math.max(0,Math.round(o/6e4))}function TA(e,t){if(!(t<60))return e*3600/t}function EA(e,t,n,r){let i=r-t;if(i<50||i>CA)return;let a=n-e;if(!(a<=0))return a*1e3/i}function DA(e){let{prev:t,cur:n}=e;if(t===void 0)return;let r=EA(t.input,t.atMs,n.input,n.atMs),i=EA(t.output,t.atMs,n.output,n.atMs),a=EA(t.total,t.atMs,n.total,n.atMs);if(!(r===void 0&&i===void 0&&a===void 0))return{...r!==void 0&&{input:r},...i!==void 0&&{output:i},...a!==void 0&&{total:a}}}function OA(e){let{samples:t}=e,n=[];for(let e=1;e<t.length;e++){let r=t[e-1],i=t[e],a=i.atMs-r.atMs;if(a<50||a>CA)continue;let o=EA(r.total,r.atMs,i.total,i.atMs);n.push(o??0)}if(n.length!==0)return n.join(`,`)}function kA(e){let t=e.indexOf(`.`);return t<0?e:e.slice(0,t)}function AA(e){let t=[],n=(e,n)=>{try{let e=n();return e===``?void 0:e}catch(n){t.push(`host.${e}: ${String(n)}`);return}},r=n(`name`,()=>kA(m.hostname())),i=n(`user`,()=>m.userInfo().username);return{host:{...r!==void 0&&{name:r},...i!==void 0&&{user:i},...e.ssh!==void 0&&{ssh:e.ssh}},failures:t}}function jA(e,t){let n=new Map;for(let[t,r]of Object.entries(e.variables))n.set(t,r);for(let[t,r]of Object.entries(e.segments))if(r.vars)for(let[e,i]of Object.entries(r.vars))n.set(`${t}.${e}`,i);let r=[],i=new Set,a=t=>pv(t,e.helpers).keys(),o=D_(e,t);for(let e of no){let t=o[e];if(ro(t))for(let e of a(t))r.push(e)}for(let n of js(E_(e,t).node)){if(n.when)for(let e of a(n.when))r.push(e);if(n.kind!==`segment`)continue;let t=e.segments[n.name];if(t){for(let e of[t.template,t.when,t.bg,t.fg])if(e)for(let t of a(e))r.push(t)}}let s=new Set;for(;r.length>0;){let e=r.pop();for(let t of NA(n,e)){if(i.has(t))continue;i.add(t);let e=n.get(t);if(e){if(e.kind===`input`)s.add(e.path);else if(e.kind===`template`)for(let t of a(e.template))r.push(t)}}}return s}function MA(e){let t=new Map;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=jA(e,n);return t.set(n,i),i}}function NA(e,t){let n=t;for(;n.length>0;){if(e.has(n))return[n];let t=n.lastIndexOf(`.`);if(t<0)break;n=n.slice(0,t)}let r=`${t}.`,i=[];for(let t of e.keys())t.startsWith(r)&&i.push(t);return i}function PA(e,t){for(let n of e)if(n===t||n.startsWith(t+`.`))return!0;return!1}function FA(e){let t=t=>e.has(t),n=t(`git.staged`)||t(`git.unstaged`)||t(`git.untracked`)||t(`git.conflicts`);return{...t(`git.sha`)&&{showSha:!0},...n&&{showWorkingTree:!0},...t(`git.stash`)&&{showStashCount:!0},...t(`git.upstream`)&&{showUpstream:!0},...t(`git.repoName`)&&{showRepoName:!0},...t(`git.repoUrl`)&&{showRepoUrl:!0},...t(`git.operation`)&&{showOperation:!0},...t(`git.timeSinceCommit`)&&{showTimeSinceCommit:!0},...(t(`git.prNumber`)||t(`git.prState`)||t(`git.prUrl`)||t(`git.prError`))&&{showPullRequest:!0}}}async function IA(e,t,n,r,i,a,{configPath:o,...s}){let c=e=>PA(r,e),l=(t.clock??(()=>new Date))().getTime(),u=(e,t,n)=>t?n().catch(t=>X(`${e}: ${String(t)}`)):Promise.resolve(Y),[d,f,p,m,h,g,_,v,y,b,x]=await Promise.all([u(`git`,c(`git`),()=>t.gitProvider.getGitInfo(n??e.workspace?.current_dir,FA(r),e.workspace?.project_dir)),u(`session`,c(`session.cost`)||c(`session.tokens`)||c(`burn`),()=>t.usageStore.getUsageInfo(e.session_id,e)),u(`today`,c(`today`),()=>t.usageStore.getTodayInfo(e,a.claudeConfigDir)),u(`context`,c(`context`)||c(`autocompact`),()=>t.contextProvider.getContextInfo(e)),u(`metrics`,c(`metrics`)||c(`burn`),()=>t.metricsProvider.getMetricsInfo(e.session_id,e)),u(`activity`,c(`activity`),()=>t.activityProvider.getActivityInfo(e.session_id,e)),u(`tmux`,c(`tmux`),()=>t.tmuxService.getSessionId()),u(`cache`,c(`cache`),()=>rA(e.transcript_path)),u(`speed`,c(`speed`),()=>t.usageStore.observeSpeed(e.session_id,e.transcript_path,l)),u(`memento`,c(`memento`),()=>t.mementoProvider.getCeiling(oA({sessionId:e.session_id,projectDir:e.workspace?.project_dir??``,cwd:n??e.workspace?.current_dir??``},a))),u(`autocompact`,c(`autocompact`),()=>Promise.resolve(t.autoCompact(yD(vD(a.claudeConfigDir)))))]),S=[],C=e=>{if(e.kind===`failed`){S.push(e.reason);return}return e.kind===`ok`?e.value:void 0},w=WA(d);S.push(...w.failures);let T=AA(a);S.push(...T.failures);let ee=C(f),te=C(p),E=C(m),ne=C(h),D=C(g),O=C(_),re=C(v),ie=zA(b);b.kind===`failed`&&S.push(`memento: ${b.reason}`);let ae=LA(x,E?.maxTokens);x.kind===`failed`&&S.push(`autocompact: ${x.reason}`);for(let e of S)t.log(`warn`,`provider fetch failed: ${e}`);let oe=e.rate_limits?.five_hour,se=e.rate_limits?.seven_day,ce=oe?wA(oe.used_percentage,oe.resets_at,18e6,l):void 0,le=se?wA(se.used_percentage,se.resets_at,6048e5,l):void 0,ue=ee?.session.cost,de=ne?.sessionDuration,fe=c(`burn`)&&ue!=null&&de!=null?TA(ue,de):void 0,pe=C(y),me=pe===void 0?void 0:DA(pe),he=pe===void 0?void 0:OA(pe),ge=me!==void 0||he!==void 0?{...me,...he!==void 0&&{history:he}}:void 0,k=UA(process.env.HOME??process.env.USERPROFILE),_e=e.workspace?{...e.workspace,current_dir:UA(e.workspace.current_dir)??``,project_dir:UA(e.workspace.project_dir)??``,added_dirs:(e.workspace.added_dirs??[]).map(e=>UA(e)??e)}:e.workspace,ve=ee===void 0?void 0:HA({cost:ee.session.cost,tokens:ee.session.tokens}),ye=te===void 0?void 0:{cost:te.cost,tokens:te.tokens},be=ne===void 0?void 0:HA({lastResponseTime:ne.lastResponseTime,responseTime:ne.responseTime,sessionDuration:ne.sessionDuration,messageCount:ne.messageCount,linesAdded:ne.linesAdded,linesRemoved:ne.linesRemoved}),xe=D===void 0?void 0:BA(D);return{...e,..._e!==void 0&&{workspace:_e},...k!==void 0&&{home:k},...w.git!==void 0&&{git:w.git},...O!==void 0&&{tmux:{session:O}},host:T.host,...SA(i),history:t.history(e.session_id),navigation:{back:t.navigation(e.session_id)},...s,...o!==null&&{configPath:o},resumeCommand:vA(_e,e.session_id,a.claudeConfigDir),...ve!==void 0&&{session:ve},...ye!==void 0&&{today:ye},...fe!==void 0&&{burn:{costPerHour:fe}},...ge!==void 0&&{speed:ge},...c(`block`)&&oe!==void 0&&{block:{nativeUtilization:oe.used_percentage,resetsAt:oe.resets_at,...ce!==void 0&&{etaMinutes:ce}}},...se!==void 0&&{weekly:{percentage:se.used_percentage,resetsAt:se.resets_at,...le!==void 0&&{etaMinutes:le}}},...re!==void 0&&{cache:{expiresAt:re}},...E!==void 0&&{context:{totalTokens:E.totalTokens,contextLeft:E.contextLeftPercentage}},...be!==void 0&&{metrics:be},...xe!==void 0&&{activity:xe},...ie!==void 0&&{memento:ie},...ae!==void 0&&{autocompact:ae}}}function LA(e,t){switch(e.kind){case`absent`:return;case`failed`:return{error:e.reason};case`ok`:return Pk(e.value,t)}}const RA=e=>e.trim().split(`
187
- `).at(-1).trim();function zA(e){switch(e.kind){case`absent`:return;case`failed`:return{error:RA(e.reason)};case`ok`:{let{ceiling:t,session:n}=e.value;return{ceiling:t===`off`?0:t,off:t===`off`,session:n??``}}}}function BA(e){let t=e.todos.findIndex(e=>e.active),n=e.todos.length===0?void 0:{total:e.todos.length,completed:e.todos.filter(e=>e.done).length,...t>=0&&{position:t+1,active:e.todos[t].text}},r=VA(e.running),i=VA(e.done),a=r===void 0&&i===void 0?void 0:{...r!==void 0&&{running:r},...i!==void 0&&{done:i}};if(!(e.command===null&&n===void 0&&a===void 0))return{...e.command!==null&&{command:e.command},...n!==void 0&&{todo:n},...a!==void 0&&{tool:a}}}function VA(e){return e.length===0?void 0:e.map(e=>`${e.name}:${e.count}`).join(`,`)}function HA(e){let t={},n=!1;for(let r of Object.keys(e)){let i=e[r];i!=null&&(t[r]=i,n=!0)}return n?t:void 0}function UA(e){return e===void 0||e.length===0||c.sep!==`\\`?e:e.replace(/\\/g,`/`)}function WA(e){if(e.kind===`absent`)return{failures:[]};if(e.kind===`failed`)return{failures:[e.reason]};let t=e.value,n=[],r=(e,t)=>{if(!(t===void 0||t.kind===`absent`)){if(t.kind===`failed`){n.push(`git.${e}: ${t.reason}`);return}return t.value}},i=r(`aheadBehind`,t.aheadBehind),a=r(`sha`,t.sha),o=r(`operation`,t.operation),s=r(`timeSinceCommit`,t.timeSinceCommit),c=r(`stash`,t.stashCount),l=r(`upstream`,t.upstream),u=r(`repoName`,t.repoName),d=r(`repoUrl`,t.repoUrl),f=t.pullRequest,p={};return f?.kind===`ok`?(p.prNumber=f.value.number,p.prState=f.value.state,p.prUrl=f.value.url):f?.kind===`failed`&&(n.push(`git.pr: ${f.reason}`),p.prError=f.reason),{git:{branch:t.branch,status:t.status,...i!==void 0&&{ahead:i.ahead,behind:i.behind},...t.workingTree!==void 0&&{staged:t.workingTree.staged,unstaged:t.workingTree.unstaged,untracked:t.workingTree.untracked,conflicts:t.workingTree.conflicts},...a!==void 0&&{sha:a},...o!==void 0&&{operation:o},...s!==void 0&&{timeSinceCommit:s},...c!==void 0&&{stash:c},...l!==void 0&&{upstream:l},...u!==void 0&&{repoName:u},...d!==void 0&&{repoUrl:d},...p},failures:n}}const GA={theme:e=>e.theme.kind===`decided`?e.theme.name:null,preset:e=>e.preset,style:e=>e.style.kind===`decided`?e.style.name:null,endcaps:e=>e.endcaps,variation:e=>e.variation,autoWrap:e=>e.autoWrap?xo:So,padding:e=>String(e.padding),updateNotice:e=>e.updateNotice?xo:So},KA=Object.entries(Eb),qA=new Set(Db.map(e=>e.sessionKey)),JA=()=>!1;function YA(e,t){return yA(e,e=>qA.has(e)?t(e):null,JA)}function XA(e,t,n,r){return e.flatMap(([e,i])=>{let a=GA[e](t);return a===null||a===GA[e](n(e))?[]:[{...i,value:a,target:r(i)}]})}function ZA(e,t,n){return GA[n](YA(e,t))}function QA(e,t){let n=YA(e,t),r=yA(e,()=>null,JA),i=yA(e,e=>e===Eb.preset.sessionKey?n.preset:null,JA);return XA(KA,n,e=>e===`preset`?r:i,t=>$A(e,n.preset,t.configKey))}function $A(e,t,n){return n in(T_(e.presets,t).globals??{})?ax(t,n):n}function ej(e,t,n){let r=w_(t(Eb.preset.sessionKey),e.globals.preset,e.presets),i=ox(n);return{key:i?.scope===`globals`?$A(e,r,i.field):n,globals:D_(e,r)}}function tj(e,t){let{preset:n}=YA(e,t);return ij(e,n).flatMap(({id:e,setting:r,key:i,decl:a,saved:o})=>{let s=t(i),c=s===null?void 0:qs(a,s);return c===void 0||Ks(c)===Ks(o)?[]:[{preset:n,id:e,setting:r,key:i,value:c}]})}function nj(e,t,n){let r=new Map(n.map(e=>[e.key,e.value]));return C_(e.presets).flatMap(n=>{let i=ij(e,n);return[...new Set(i.filter(e=>r.has(e.key)).map(e=>e.id))].flatMap(e=>{let n=i.filter(t=>t.id===e);return Ws(Object.fromEntries(n.map(e=>[e.setting,e.decl])),Object.fromEntries(n.map(e=>{let n=r.get(e.key)??t(e.key),i=n===null?void 0:qs(e.decl,n);return[e.setting,i??e.saved]}))).map(({message:t})=>`placement "${e}": ${t}`)})})}const rj=new WeakMap;function ij(e,t){let n=rj.get(e)??new Map;rj.set(e,n);let r=n.get(t);if(r!==void 0)return r;let i=[...js(E_(e,t).node)].flatMap(t=>t.kind!==`segment`||t.drafts===void 0?[]:Object.entries(t.drafts).map(([n,{id:r,key:i}])=>{let a=Hs(e.segments[t.name])[n];return{id:r,setting:n,key:i,decl:a,saved:t.settings?.[n]??a.default}})),a=[...new Map(i.map(e=>[e.key,e])).values()];return n.set(t,a),a}function aj(e,t){let n=YA(e,t),r=yA(e,e=>e===Eb.preset.sessionKey?n.preset:null,JA);return{from:n.preset,globals:T_(e.presets,n.preset).globals??{},picks:XA(KA.filter(([e])=>e!==`preset`),n,()=>r,e=>e.configKey),placements:tj(e,t)}}function oj(e){return{sessionKeys:Db.filter(t=>t.configKey===e).map(e=>e.sessionKey),fileKeys:[e,...yl(e)?Gk.map(t=>ax(t,e)):[]]}}function sj(e){return new Set(Db.map(e=>e.configKey).filter(t=>oj(t).fileKeys.some(t=>uj(e,lj(t)))))}function cj(e,t,n){let r=QA(e,n);return{unsaved:r.length+tj(e,n).length,resettable:new Set([...r.map(e=>e.configKey),...t]).size}}function lj(e){let t=ox(e);if(t===null||t.scope===`preset-root`)throw Error(`reset layer "${e}" is not a value path`);return sx(t)}function uj(e,t){let[n,...r]=t;return n===void 0?e!==void 0:typeof e==`object`&&!!e&&uj(e[n],r)}const dj=Za(),fj=new Set(dj),pj=new Set(uo),mj=e=>e?fj.has(e)?{ok:!0,value:e}:{ok:!1,reason:`unknown theme "${e}" (have: ${dj.join(`, `)})`}:{ok:!1,reason:`theme name is required`},hj=e=>e?pj.has(e)?{ok:!0,value:e}:{ok:!1,reason:`unknown endcaps "${e}" (have: ${uo.join(`, `)})`}:{ok:!1,reason:`endcaps name is required`},gj=new Set([`1`,`true`]),_j=new Set([`0`,`false`]),vj=yk({endcaps:hj,theme:mj,"toolbar-expanded":e=>gj.has(e)?{ok:!0,value:`1`}:_j.has(e)?{ok:!0,value:``}:{ok:!1,reason:`expected boolean-ish (1, 0, true, false), got "${e}"`}});function yj(){return vj.listKeys()}function bj(e,t){return vj.register(e,t)}function xj(e,t){return vj.validate(e,t)}function Sj(e){return vj.rangeParamsFor(e)}function Cj(e,t){return`set`in e?`to`in e?[{key:e.set,spec:{kind:`allow-list`,allowed:[e.to]}}]:`from`in e?[{key:e.set,spec:{kind:`allow-list`,allowed:Zb(e.from,t).members}}]:`int`in e?[{key:e.set,spec:{kind:`int`}}]:`cycle`in e?[{key:e.set,spec:{kind:`allow-list`,allowed:e.cycle}}]:[{key:e.set,spec:{kind:`range`,min:e.min,max:e.max}}]:[]}function wj(e){let t=new Set(vj.listBaselineKeys());return e.filter(e=>e.spec.kind!==`allow-list`||!t.has(e.key))}function Tj(e,t,n){let r=Mb.get(n);if(r!==void 0)return ZA(e,t,r);let i=Object.values(e.variables).find(e=>e.kind===`state`&&e.key===n);return i?.kind===`state`?i.default??null:null}function Ej(e){let t=Yb(e);return wj(Object.values(e.actions).flatMap(e=>Cj(e,t)))}function Dj(e){return vk(Ej(e))}const Oj=`update.dismissed`,kj=`updateNotice`,Aj=Eb.updateNotice.sessionKey;function jj(e){return e.kind===`source`?e.newer.digest:ED(e.newer)}const Mj=e=>`${e.version} [${rk(e.digest)}]`;function Nj(e){switch(e.kind){case`source`:return{headline:`Newer source`,newer:Mj(e.newer),running:Mj(e.running),act:`rebuild`,busy:`rebuilding…`,command:{bin:`pnpm`,args:[`build`],cwd:e.root}};case`release`:return{headline:`Newer release`,newer:ED(e.newer),running:ED(e.running),act:`upgrade`,busy:`upgrading…`,command:{bin:`pnpm`,args:[`dlx`,`${OD}@${ED(e.newer)}`,`install`]}}}}const Pj={kind:`idle`},Fj={kind:`running`};function Ij(e,t,n){if(e===null)return[];let r=jj(e);if(!n.enabled||n.dismissed===r)return[];let i=Nj(e),a=`${i.headline}: ${i.newer}. You're on ${i.running}.`,o=t.kind===`failed`&&t.identity===r?[`${i.act} failed: ${t.reason}`]:[],s=[a,...o].join(`
188
- `),c=sD([{verb:HE,args:[s]}]),l=t.kind===`running`?GO(`[${i.busy}]`,c):GO(`[${i.act}]`,sD([{verb:eD,args:[n.sessionId]}]));return[{severity:WO,message:s,lines:[[GO(a,c),l,GO(`[dismiss]`,sD([{verb:IE,args:[n.sessionId,Oj,r]}])),GO(`[disable]`,sD([{verb:UE,args:[n.sessionId,kj,`false`]},{verb:IE,args:[n.sessionId,Aj,`false`]}]))],...o.map(e=>[GO(e,c)])]}]}function Lj(e,t){return e.kind===`stale`?{kind:`source`,root:e.root,newer:e.source,running:e.running}:e.kind===`not-source-checkout`&&t!==null&&t.kind===`stale`?{kind:`release`,newer:t.latest,running:t.installed}:null}function Rj(e){switch(e.kind){case`current`:return[`info`,`build: current ${Mj(e.stamp)}`];case`stale`:return[`info`,`build: stale — source ${Mj(e.source)}, running ${Mj(e.running)}`];case`not-source-checkout`:return[`info`,`build: not a source checkout`];case`unchecked`:return[`warn`,`build: unchecked: ${e.reason}`]}}function zj(e){switch(e.kind){case`current`:return[`info`,`release: current ${ED(e.installed)}`];case`stale`:return[`info`,`release: stale — latest ${ED(e.latest)}, running ${ED(e.installed)}`];case`ahead`:return[`info`,`release: ahead — running ${ED(e.installed)}, latest ${ED(e.latest)}`];case`unchecked`:return[`warn`,`release: unchecked: ${e.reason}`]}}function Bj(e){let t=null;return([n,r])=>{r!==t&&(t=r,e(n,r))}}const Vj=e=>e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e!==``).at(-1);function Hj(e){let t=e.exitCode===null?``:` (exit ${e.exitCode})`,n=Vj(e.stderr)??e.error??Vj(e.stdout)??`no output`;return`${e.reason}${t}: ${n}`}function Uj(e){let{entryUrl:t,intervalMs:n,releaseIntervalMs:r,registryUrl:i,fetchImpl:a,onApplied:o,log:s}=e,c={kind:`unchecked`,reason:`not sampled yet`},l=null,u=Pj,d=null,f=Bj(s),p=Bj(s),m=()=>Lj(c,l);function h(){let e=m(),t=e===null?null:jj(e);(d===null?null:d.identity)!==t&&(d?.dispose(),d=t===null?null:{identity:t,dispose:bj(Oj,{kind:`allow-list`,allowed:[t]})})}function g(){c=sk(t,ak),f(Rj(c)),h()}async function _(){l=AD(pD,await kD(OD,a,i)),p(zj(l)),h()}return{arm(){kk(kj,{kind:`allow-list`,allowed:[`false`]}),bj(Aj,{kind:`allow-list`,allowed:[`false`]}),g(),setInterval(g,n).unref(),c.kind===`not-source-checkout`&&(_(),setInterval(()=>void _(),r).unref())},notice:e=>Ij(m(),u,e),act(){let e=m();if(e===null)throw new $(`apply-update: nothing newer is known to apply`);let t=Nj(e);if(u.kind===`running`)throw new $(`apply-update: already ${t.busy}`);u=Fj,s(`info`,`apply-update: ${t.act} — ${t.command.bin} ${t.command.args?.join(` `)??``}`),De({...t.command,category:`update.apply`,timeoutMs:6e5}).then(n=>{if(n.ok){u=Pj,s(`info`,`apply-update: ${t.act} succeeded`),g(),o();return}let r=Hj(n);u={kind:`failed`,identity:jj(e),reason:r},s(`error`,`apply-update: ${t.act} failed: ${r}`)})}}}var Wj=class{static CACHE_DIR=Ne();static USAGE_CACHE_DIR=c.join(this.CACHE_DIR,`usage`);static LOCKS_DIR=c.join(this.CACHE_DIR,`locks`);static isLocked(e){let t=c.join(this.LOCKS_DIR,e);if(!r.existsSync(t))return!1;try{let n=r.readFileSync(t,`utf-8`),i=parseInt(n.trim(),10);if(isNaN(i))return k(`Invalid PID in lock file ${e}, removing stale lock`),r.unlinkSync(t),!1;try{return process.kill(i,0),!0}catch(n){return n.code===`ESRCH`?(k(`Removing stale lock file ${e} for dead process ${i}`),r.unlinkSync(t),!1):(k(`Error checking process ${i} for lock ${e}:`,n),!0)}}catch(t){return k(`Error reading lock file ${e}:`,t),!0}}static async acquireLock(e,t=5e3){await this.ensureCacheDirectories();let n=c.join(this.LOCKS_DIR,e),i=Date.now(),a=String(process.pid);for(;Date.now()-i<t;)try{return await r.promises.writeFile(n,a,{flag:`wx`}),k(`Lock acquired for ${e}`),!0}catch(e){if(e.code===`EEXIST`)await oe(50);else throw e}return k(`Failed to acquire lock for ${e} within ${t}ms`),!1}static async releaseLock(e){let t=c.join(this.LOCKS_DIR,e);try{await r.promises.unlink(t),k(`Lock released for ${e}`)}catch(t){t.code!==`ENOENT`&&k(`Error releasing lock for ${e}:`,t)}}static async ensureCacheDirectories(){try{await Promise.all([r.promises.mkdir(this.CACHE_DIR,{recursive:!0}),r.promises.mkdir(this.USAGE_CACHE_DIR,{recursive:!0}),r.promises.mkdir(this.LOCKS_DIR,{recursive:!0})])}catch(e){k(`Failed to create cache directories:`,e)}}static createProjectHash(e){return ie(`md5`).update(e).digest(`hex`).substring(0,8)}static async getUsageCache(e,t){await this.ensureCacheDirectories();let n=c.join(this.USAGE_CACHE_DIR,`${e}.json`),i=`${e}.usage.lock`;for(let a=0;a<3;a++){if(this.isLocked(i)){k(`Cache for ${e} is locked, waiting...`),await oe(75);continue}try{let i=await r.promises.readFile(n,`utf-8`),a=JSON.parse(i);return!t||a.timestamp>=t?(k(`[CACHE-HIT] ${e} disk cache: found`),this.deserializeDates(a.data)):(k(`${e} cache outdated: cache=${a.timestamp}, latest=${t}`),null)}catch(t){if(t.code===`ENOENT`)return k(`No shared ${e} usage cache found`),null;k(`Attempt ${a+1} failed to read ${e} cache: ${t.message}. Retrying...`),await oe(75)}}return k(`Failed to read ${e} cache after 3 attempts.`),null}static deserializeDates(e){return Array.isArray(e)?e.map(e=>({...e,timestamp:new Date(e.timestamp)})):e}static async setUsageCache(e,t,n){let i=`${e}.usage.lock`;if(!await this.acquireLock(i)){k(`Could not acquire lock to set usage cache for ${e}`);return}try{await this.ensureCacheDirectories();let i=c.join(this.USAGE_CACHE_DIR,`${e}.json`),a=JSON.stringify({data:t,timestamp:n||Date.now()});await r.promises.writeFile(i,a,`utf-8`),k(`[CACHE-SET] ${e} disk cache stored`)}catch(t){k(`Failed to save ${e} usage cache:`,t)}finally{await this.releaseLock(i)}}};const Gj={"claude-haiku-4-5-20251001":{name:`Claude Haiku 4.5`,input:1,output:5,cache_write_5m:1.25,cache_write_1h:2,cache_read:.1},"claude-haiku-4-5":{name:`Claude Haiku 4.5`,input:1,output:5,cache_write_5m:1.25,cache_write_1h:2,cache_read:.1},"claude-opus-4-20250514":{name:`Claude Opus 4`,input:15,output:75,cache_write_5m:18.75,cache_write_1h:30,cache_read:1.5},"claude-opus-4-1":{name:`Claude Opus 4.1`,input:15,output:75,cache_write_5m:18.75,cache_write_1h:30,cache_read:1.5},"claude-opus-4-1-20250805":{name:`Claude Opus 4.1`,input:15,output:75,cache_write_5m:18.75,cache_write_1h:30,cache_read:1.5},"claude-sonnet-4-20250514":{name:`Claude Sonnet 4`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3},"claude-4-opus-20250514":{name:`Claude 4 Opus`,input:15,output:75,cache_write_5m:18.75,cache_write_1h:30,cache_read:1.5},"claude-4-sonnet-20250514":{name:`Claude 4 Sonnet`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3},"claude-sonnet-4-5":{name:`Claude Sonnet 4.5`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3},"claude-sonnet-4-5-20250929":{name:`Claude Sonnet 4.5`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3},"claude-opus-4-5":{name:`Claude Opus 4.5`,input:5,output:25,cache_write_5m:6.25,cache_write_1h:10,cache_read:.5},"claude-opus-4-5-20251101":{name:`Claude Opus 4.5`,input:5,output:25,cache_write_5m:6.25,cache_write_1h:10,cache_read:.5},"claude-opus-4-6":{name:`Claude Opus 4.6`,input:5,output:25,cache_write_5m:6.25,cache_write_1h:10,cache_read:.5},"claude-opus-4-6-20260205":{name:`Claude Opus 4.6`,input:5,output:25,cache_write_5m:6.25,cache_write_1h:10,cache_read:.5},"claude-sonnet-4-6":{name:`Claude Sonnet 4.6`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3}};var Kj=class{static executionCache=null;static modelPricingCache=new Map;static GITHUB_PRICING_URL=`https://raw.githubusercontent.com/promptctl/cc-candybar/main/pricing.json`;static async loadDiskCache(){let e=Date.now()-1440*60*1e3;return await Wj.getUsageCache(`pricing`,e)}static async saveDiskCache(e){await Wj.setUsageCache(`pricing`,e)}static async fetchPricingData(){return new Promise(e=>{let t=new E(this.GITHUB_PRICING_URL),n=ae({hostname:t.hostname,path:t.pathname,headers:{"User-Agent":`cc-candybar`,"Cache-Control":`no-cache`},timeout:5e3},t=>{if(t.statusCode!==200){k(`HTTP ${t.statusCode}: ${t.statusMessage}`),e(null);return}let r=``,i=0;t.on(`data`,t=>{if(i+=t.length,i>1048576){k(`Response too large`),n.destroy(),e(null);return}r+=t}),t.on(`end`,()=>{try{let t=JSON.parse(r),n=t._meta,i={};for(let[e,n]of Object.entries(t))e!==`_meta`&&(i[e]=n);this.validatePricingData(i)?(k(`Fetched fresh pricing from GitHub for ${Object.keys(i).length} models`),k(`Pricing last updated: ${n?.updated||`unknown`}`),e(i)):(k(`Invalid pricing data structure`),e(null))}catch(t){k(`Failed to parse JSON:`,t),e(null)}}),t.on(`error`,t=>{k(`Response error:`,t),e(null)})});n.on(`error`,t=>{k(`Request error:`,t),e(null)}),n.on(`timeout`,()=>{k(`Request timeout`),n.destroy(),e(null)}),n.end()})}static async getCurrentPricing(){if(this.executionCache!==null)return k(`[CACHE-HIT] Pricing execution cache: ${Object.keys(this.executionCache).length} models`),this.executionCache;let e=await this.loadDiskCache();if(e)return k(`[CACHE-HIT] Pricing disk cache: ${Object.keys(e).length} models`),this.executionCache=e,k(`[CACHE-SET] Pricing execution cache stored: ${Object.keys(e).length} models`),e;let t=await this.fetchPricingData();return t?(await this.saveDiskCache(t),k(`[CACHE-SET] Pricing disk cache stored: ${Object.keys(t).length} models`),this.executionCache=t,k(`[CACHE-SET] Pricing execution cache stored: ${Object.keys(t).length} models`),t):(k(`[CACHE-FALLBACK] Using offline pricing data: ${Object.keys(Gj).length} models`),this.executionCache=Gj,k(`[CACHE-SET] Pricing execution cache stored: ${Object.keys(Gj).length} models`),Gj)}static validatePricingData(e){if(!e||typeof e!=`object`)return!1;for(let[,t]of Object.entries(e)){if(!t||typeof t!=`object`)return!1;let e=t;if(typeof e.input!=`number`||typeof e.output!=`number`||typeof e.cache_read!=`number`)return!1}return!0}static async getModelPricing(e){if(this.modelPricingCache.has(e))return k(`[CACHE-HIT] Model pricing cache: ${e}`),this.modelPricingCache.get(e);let t=await this.getCurrentPricing(),n;return n=t[e]?t[e]:this.fuzzyMatchModel(e,t),this.modelPricingCache.set(e,n),k(`[CACHE-SET] Model pricing cache: ${e}`),n}static fuzzyMatchModel(e,t){let n=e.toLowerCase();for(let[e,r]of Object.entries(t))if(e.toLowerCase()===n)return r;for(let{pattern:e,fallback:r}of[{pattern:[`opus-4-6`,`claude-opus-4-6`],fallback:`claude-opus-4-6-20260205`},{pattern:[`opus-4-5`,`claude-opus-4-5`],fallback:`claude-opus-4-5-20251101`},{pattern:[`opus-4-1`,`claude-opus-4-1`],fallback:`claude-opus-4-1-20250805`},{pattern:[`opus-4`,`claude-opus-4`],fallback:`claude-opus-4-20250514`},{pattern:[`sonnet-4-6`,`sonnet-4.6`,`claude-sonnet-4-6`],fallback:`claude-sonnet-4-6`},{pattern:[`sonnet-4.5`,`4-5-sonnet`,`sonnet-4-5`],fallback:`claude-sonnet-4-5-20250929`},{pattern:[`sonnet-4`,`claude-sonnet-4`],fallback:`claude-sonnet-4-20250514`},{pattern:[`haiku-4.5`,`4-5-haiku`,`haiku-4-5`],fallback:`claude-haiku-4-5-20251001`},{pattern:[`haiku`],fallback:`claude-haiku-4-5-20251001`},{pattern:[`opus`],fallback:`claude-opus-4-20250514`},{pattern:[`sonnet`],fallback:`claude-sonnet-4-5-20250929`}])if(e.some(e=>n.includes(e))&&t[r])return t[r];return t[`claude-sonnet-4-5-20250929`]||{name:`${e} (Unknown Model)`,input:3,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3,output:15}}static async calculateCostForEntry(e){let t=e.message?.usage;if(!t)return 0;let n=this.extractModelId(e),r=await this.getModelPricing(n),i=t.input_tokens||0,a=t.output_tokens||0,o=t.cache_creation_input_tokens||0,s=t.cache_read_input_tokens||0,c=i/1e6*r.input,l=a/1e6*r.output,u=s/1e6*r.cache_read,d=o/1e6*r.cache_write_5m;return c+l+d+u}static extractModelId(e){if(e.model&&typeof e.model==`string`)return e.model;let t=e.message;if(t?.model){let e=t.model;if(typeof e==`string`)return e;let n=e;return(typeof n?.id==`string`?n.id:null)||`claude-sonnet-4-5-20250929`}return e.model_id&&typeof e.model_id==`string`?e.model_id:`claude-sonnet-4-5-20250929`}};const qj=/<command-name>\s*([^<\s][^<]*?)\s*<\/command-name>/;function Jj(e){if(typeof e==`string`)return qj.exec(e)?.[1]}function Yj(e){let t=e?.todos;if(!Array.isArray(t))return;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let{content:t,activeForm:r,status:i}=e,a=i===`in_progress`,o=a&&typeof r==`string`?r:t;typeof o==`string`&&n.push({text:o,active:a,done:i===`completed`})}return n}function Xj(e){let t=e.message?.content,n=e.type===`user`,r=[],i=[],a,o;if(typeof t==`string`)o=t;else if(Array.isArray(t))for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;switch(t.type){case`tool_use`:{let{id:e,name:n}=t;if(typeof e!=`string`||typeof n!=`string`)break;r.push({id:e,name:n}),n===`TodoWrite`&&(a=Yj(t.input)??a);break}case`tool_result`:{let e=t.tool_use_id;typeof e==`string`&&i.push(e);break}case`text`:o??=t.text;break;default:break}}let s=n?Jj(o):void 0;if(!(r.length===0&&i.length===0&&a===void 0&&s===void 0))return{...r.length>0&&{started:r},...i.length>0&&{finished:i},...a!==void 0&&{todos:a},...s!==void 0&&{command:s}}}function Zj(e){if(e!==void 0)return[e];let t=h();return[f(t,`.config`,`claude`),f(t,`.claude`)].filter(e=>a(e))}async function Qj(e){let t=[];for(let n of e){let e=f(n,`projects`);if(a(e))try{let n=await Xk(e,{withFileTypes:!0});for(let r of n)if(r.isDirectory()){let n=f(e,r.name);t.push(n)}}catch(t){k(`Failed to read projects directory ${e}:`,t)}}return t}async function $j(e,t,n){let r=[],i=f(t,e,`subagents`);try{let t=(await Xk(i)).filter(e=>e.startsWith(`agent-`)&&e.endsWith(`.jsonl`));for(let a of t){let t=f(i,a);if(n?.has(t)){r.push(t);continue}try{let n=(await Zk(t,`utf-8`)).split(`
189
- `)[0];n&&JSON.parse(n).sessionId===e&&r.push(t)}catch{k(`Failed to check agent file ${t}`)}}}catch(e){k(`Failed to read subagents directory ${i}:`,e)}return r}function eM(e){let t=e.type||e.message?.role||e.message?.type,n=e.type===`user`&&e.message?.firstContentType===`tool_result`;return t===`user`&&!n}const tM=new Map;async function nM(e){try{let t=await Qk(e),n=t.size,r=tM.get(e);if(r&&r.mtime===t.mtimeMs&&r.size===n)return k(`[parse-cache] hit ${e}`),tM.delete(e),tM.set(e,r),r.entries;let i;return n>1048576?(k(`Using streaming parser for large file ${e} (${Math.round(n/1024)}KB)`),i=await sM(e)):i=await aM(e),k(`Parsed ${i.length} entries from ${e}`),n>5242880?i:(tM.delete(e),tM.size>=16&&tM.delete(tM.keys().next().value),tM.set(e,{mtime:t.mtimeMs,size:n,entries:i}),i)}catch(t){if(t.code===`ENOENT`)return k(`Transcript not present yet: ${e}`),[];throw t}}function rM(e){if(!e.timestamp)return null;let t=e.message,n=t?.usage,r=t?.content,i=Array.isArray(r)&&typeof r[0]==`object`&&r[0]?r[0]:void 0;return{timestamp:new Date(e.timestamp),type:typeof e.type==`string`?e.type:void 0,message:t?{id:typeof t.id==`string`?t.id:void 0,model:typeof t.model==`string`?t.model:void 0,usage:n,role:typeof t.role==`string`?t.role:void 0,type:typeof t.type==`string`?t.type:void 0,firstContentType:typeof i?.type==`string`?i.type:void 0}:void 0,costUSD:typeof e.costUSD==`number`?e.costUSD:void 0,isSidechain:e.isSidechain===!0,activity:Xj(e),raw:{model:typeof e.model==`string`?e.model:void 0,message:t?{id:typeof t.id==`string`?t.id:void 0,model:typeof t.model==`string`?t.model:void 0,usage:n}:void 0,requestId:typeof e.requestId==`string`?e.requestId:void 0}}}function iM(e){let t=[];for(let n of e.split(`
190
- `))if(n.trim())try{let e=rM(JSON.parse(n));e&&t.push(e)}catch(e){k(`Failed to parse JSONL line: ${e}`);continue}return t}async function aM(e){return iM(await Zk(e,`utf-8`))}async function oM(e,t){let n=await $k(e,t===void 0?void 0:{offset:t.offset,ino:t.ino});if(n.kind!==`ok`)return n;let{buf:r,start:i,mtimeMs:a,ino:o,reset:s}=n.value,c=r.lastIndexOf(10);return J(c<0?{entries:[],cursor:{offset:i,mtimeMs:a,ino:o},reset:s}:{entries:iM(r.subarray(0,c+1).toString(`utf-8`)),cursor:{offset:i+c+1,mtimeMs:a,ino:o},reset:s})}async function sM(e){return new Promise((t,n)=>{let r=[],a=i(e,{encoding:`utf8`}),o=se({input:a,crlfDelay:1/0});o.on(`line`,e=>{let t=e.trim();if(t)try{let e=rM(JSON.parse(t));e&&r.push(e)}catch(e){k(`Failed to parse JSONL line: ${e}`)}}),o.on(`close`,()=>{t(r)}),o.on(`error`,t=>{k(`Streaming parser error for ${e}:`,t),n(t)}),a.on(`error`,t=>{k(`File stream error for ${e}:`,t),n(t)})})}var cM=class{inflight=new Map;run(e,t){return this.inflight.get(e)??this.start(e,t)}start(e,t){let n=t();this.inflight.set(e,n);let r=()=>{this.inflight.get(e)===n&&this.inflight.delete(e)};return n.then(r,r),n}get size(){return this.inflight.size}};function lM(e,t){let n=e?e.input+e.cacheCreation+e.cacheRead:0,r=e?e.output:0;return{input:n,output:r,total:n+r,atMs:t}}const uM=new Map,dM={cost:0,input:0,output:0,cacheCreation:0,cacheRead:0},fM={cost:null,calculatedCost:null,officialCost:null,tokens:null,tokenBreakdown:null};function pM(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function mM(){let e=new Date;return e.setHours(0,0,0,0),e.setDate(e.getDate()-1),e.getTime()}function hM(){return{input:0,output:0,cacheCreation:0,cacheRead:0}}async function gM(e,t,n,r){let i=pM(new Date(mM())),a=e&&!t?e:void 0,o=a?.entries??0,s=a?.cost??0,c=a?{...a.breakdown}:hM(),l=new Map;if(a)for(let[e,t]of a.days)e>=i&&l.set(e,{...t});for(let e of n){let t=e.message?.usage;if(!t)continue;o++;let n=e.costUSD??await Kj.calculateCostForEntry(e.raw);s+=n,c.input+=t.input_tokens||0,c.output+=t.output_tokens||0,c.cacheCreation+=t.cache_creation_input_tokens||0,c.cacheRead+=t.cache_read_input_tokens||0;let r=pM(new Date(e.timestamp));if(r<i)continue;let a=l.get(r)??{...dM};a.cost+=n,a.input+=t.input_tokens||0,a.output+=t.output_tokens||0,a.cacheCreation+=t.cache_creation_input_tokens||0,a.cacheRead+=t.cache_read_input_tokens||0,l.set(r,a)}return{cursor:r,entries:o,cost:s,breakdown:c,days:l}}function _M(e){let t=0,n=0,r=hM(),i=new Map;for(let a of e.values()){t+=a.entries,n+=a.cost,r.input+=a.breakdown.input,r.output+=a.breakdown.output,r.cacheCreation+=a.breakdown.cacheCreation,r.cacheRead+=a.breakdown.cacheRead;for(let[e,t]of a.days){let n=i.get(e)??{...dM};n.cost+=t.cost,n.input+=t.input,n.output+=t.output,n.cacheCreation+=t.cacheCreation,n.cacheRead+=t.cacheRead,i.set(e,n)}}if(t===0)return{sessionInfo:fM,days:i};let a=r.input+r.output+r.cacheCreation+r.cacheRead;return{sessionInfo:{cost:n,calculatedCost:n,officialCost:null,tokens:a,tokenBreakdown:r},days:i}}async function vM(e,t,n){let r=0,i=async()=>{for(;r<e.length;){let t=e[r++];await n(t)}},a=Math.min(t,e.length);await Promise.all(Array.from({length:a},i))}var yM=class{entries=new Map;flight=new cM;seeded=new Map;seededDay=``;speedRings=new Map;speedFlight=new cM;maxEntries;staleAgeMs;hits=0;misses=0;sweeps=0;seeds=0;sweepTimer=null;constructor(e={}){this.maxEntries=e.maxEntries??256,this.staleAgeMs=e.staleAgeMs??864e5;let t=e.sweepIntervalMs??3e5;t>0&&(this.sweepTimer=setInterval(()=>this.sweepStale(),t),this.sweepTimer.unref())}getStats(){return{size:this.entries.size,hits:this.hits,misses:this.misses,sweeps:this.sweeps,seeds:this.seeds}}async getUsageInfo(e,t){let n=await this.ingest(e,t?.transcript_path);if(n.kind===`failed`)return n;let r=n.kind===`ok`?n.value.sessionInfo:fM,i=t?.cost?.total_cost_usd??null;return J({session:{...r,cost:i??r.cost,officialCost:i}})}async getTodayInfo(e,t){let n=pM(new Date),r=Zj(t);try{await this.ensureSeeded(n,r)}catch(e){return X(`usage seed: ${e instanceof Error?e.message:String(e)}`)}let i=await this.ingest(e?.session_id??``,e?.transcript_path);if(i.kind===`failed`)return i;let a=r.map(e=>f(e,`projects`)+p),o={...dM},s=!1;for(let[t,r]of this.entries){let i=r.transcriptPath??``,c=t===e?.session_id||a.some(e=>i.startsWith(e))?r.days:uM;s||=c.has(n);let l=c.get(n)??dM;o.cost+=l.cost,o.input+=l.input,o.output+=l.output,o.cacheCreation+=l.cacheCreation,o.cacheRead+=l.cacheRead}return s?J({cost:o.cost,tokens:o.input+o.output+o.cacheCreation+o.cacheRead,tokenBreakdown:{input:o.input,output:o.output,cacheCreation:o.cacheCreation,cacheRead:o.cacheRead},date:n}):Y}async observeSpeed(e,t,n){let r=qk(t);return this.speedFlight.run(`${e}:${r}`,async()=>{let i=await this.ingest(e,t,r);if(i.kind===`failed`)return i;let a=lM(i.kind===`ok`?i.value.sessionInfo.tokenBreakdown:null,n),o=this.speedRings.get(e)??[],s;for(let e of o)e.atMs<a.atMs&&(s===void 0||e.atMs>s.atMs)&&(s=e);return o.push(a),o.sort((e,t)=>e.atMs-t.atMs),o.length>64&&o.shift(),this.speedRings.set(e,o),J({...s!==void 0&&{prev:s},cur:a,samples:[...o]})})}async ingest(e,t,n){if(!e)return Y;let r=n??qk(t),i=this.entries.get(e);if(i&&r!==0&&i.transcriptMtime===r)return i.lastSeenAt=Date.now(),this.entries.delete(e),this.entries.set(e,i),this.hits++,J(i);if(!t)return i?J(i):Y;this.misses++;let a;try{a=await this.flight.run(`${e}:${r}`,()=>this.refold(e,t,this.entries.get(e)))}catch(t){return X(`usage refold (${e}): ${t instanceof Error?t.message:String(t)}`)}if(a.kind!==`ok`)return a;let o={files:a.value.files,sessionInfo:a.value.sessionInfo,days:a.value.days,transcriptMtime:a.value.mainMtime,transcriptPath:t,lastSeenAt:Date.now()};return this.entries.delete(e),this.entries.set(e,o),this.evictIfNeeded(),J(o)}async refold(e,t,n){let r=await $j(e,u(t),n===void 0?void 0:new Set(n.files.keys())),i=new Map,a=0;for(let e of[t,...r]){let r=n?.files.get(e),o=await oM(e,r?.cursor);if(o.kind===`failed`)return o;if(o.kind===`absent`){r&&i.set(e,r);continue}let{entries:s,cursor:c,reset:l}=o.value;i.set(e,await gM(r,l,s,c)),e===t&&(a=c.mtimeMs)}return J({files:i,..._M(i),mainMtime:a})}ensureSeeded(e,t){this.seededDay!==e&&(this.seeded.clear(),this.seededDay=e);let n=t.join(`\0`),r=this.seeded.get(n);if(r)return r;let i=this.seed(t);return this.seeded.set(n,i),i.catch(()=>{this.seeded.get(n)===i&&this.seeded.delete(n)}),i}async seed(e){let t=mM(),n=await Qj(e),r=[];for(let e of n){let n;try{n=await Xk(e)}catch{continue}for(let i of n){if(!i.endsWith(`.jsonl`))continue;let n=f(e,i),a;try{a=(await Qk(n)).mtimeMs}catch{continue}a<t||r.push({sessionId:i.slice(0,-6),path:n,mtime:a})}}await vM(r,8,async e=>{let t=await this.ingest(e.sessionId,e.path,e.mtime);t.kind===`failed`&&Q(`warn`,`usageStore seed: ${t.reason}`)}),this.seeds++,Q(`info`,`usageStore seed sessions=${r.length} dirs=${e.join(`,`)}`)}sweepStale(){let e=Date.now(),t=0;for(let[n,r]of this.entries)e-r.lastSeenAt>this.staleAgeMs&&(this.entries.delete(n),this.speedRings.delete(n),t++);return t>0&&(this.sweeps++,Q(`info`,`usageStore sweep dropped=${t}`)),t}evictIfNeeded(){for(;this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e),this.speedRings.delete(e),Q(`info`,`usageStore evict ${e}`)}}close(){this.sweepTimer&&=(clearInterval(this.sweepTimer),null),this.entries.clear(),this.seeded.clear(),this.speedRings.clear()}};function bM(e,t){return e===void 0?!0:e.evaluate(t).map(e=>e.plain).join(``)!==`false`}function xM(e,t){let n=V.fromFragments(e);return n.end=``,n.overflow=`ignore`,t!==void 0&&!t.isNull&&(n.style=t),n}function SM(e,t,n){e.cellLength>t?e.truncate(t,{mode:n.truncate,marker:`…`}):e.cellLength<t&&e.align(n.justify,t)}function CM({lead:e,text:t,trail:n}){return[...e===void 0?[]:[e],t,...n===void 0?[]:[n]]}function wM(e){let t=CM(e);if(t.length===1)return e.text;let n=xM(t);return n.style=e.text.style,n}function TM(e,t){let{width:n,justify:r,truncate:i,baseStyle:a,padding:o,lead:s=[],trail:c=[]}=t;if(e.length===0)return[];let l=xM(e,a).pad(o),u=new V(` `.repeat(o)),d={...s.length>0&&{lead:xM([u,...s],a)},...c.length>0&&{trail:xM([...c,u],a)}};if(n===`auto`)return[{text:l,...d}];let f={justify:r,truncate:i};return n===`fill`?[{text:l,fill:f,...d}]:(SM(l,n,f),[{text:l,...d}])}const EM=RegExp(`\\x1b\\[[0-9;]*m|${xi.source}`,`g`);function DM(e){return zt(e.replace(EM,``))}function OM(e,t){let n=e.map(wM),r=[];if(e.forEach(({fill:e},t)=>{e!==void 0&&r.push({at:t,how:e})}),r.length===0||!Number.isFinite(t.width))return n;let i=BO(n,t).split(`
191
- `);if(i.length>1)return n;let a=Math.max(0,t.width-DM(i[0]??``)),o=Math.floor(a/r.length),s=a-o*r.length;return r.forEach(({at:t,how:i},a)=>{let c=o+(a===r.length-1?s:0),{text:l}=e[t];SM(l,l.cellLength+c,i),n[t]=wM(e[t])}),n}function kM(e,t){let n=[],r=[],i=()=>{if(!r.length)return;let e=AM(r,t);e.plain.length>0&&n.push(e),r=[]};for(let a of e)if(MM(a.style).link){i();let e=AM([a],t);e.plain.length>0&&n.push(e)}else r.push(a);return i(),n}function AM(e,t){let n=t!==void 0&&!t.isNull?e.map(e=>jM(e,t)):e,r=V.fromFragments(n);return r.end=``,r.overflow=`ignore`,n.length===1?r.style=n[0].style:t!==void 0&&!t.isNull&&(r.style=t),r}function jM(e,t){let n=e.copy();return n.style=t.add(MM(e.style)),n}function MM(e){return e instanceof z?e:z.parse(e)}function NM(e,t,n,r){let i=new Map,a=Object.entries(t);for(let[t,o]of[...a.filter(([,e])=>!(`do`in e)),...a.filter(([,e])=>`do`in e)])i.set(t,PM(e,t,o,n,r,i));return i}function PM(e,t,n,r,i,a){if(`set`in n){let e=r.get(n.set)??n.set;if(`to`in n)return{kind:`set-literal`,key:n.set,value:n.to,stateVar:e};if(`from`in n){let t=Zb(n.from,i);return{kind:`set-option`,key:n.set,stateVar:e,options:[...t.members],paletteOf:t.paletteOf,library:t.library}}return`int`in n?{kind:`set-int`,key:n.set,stateVar:e}:`cycle`in n?{kind:`set-cycle`,key:n.set,stateVar:e,members:n.cycle}:{kind:`set-bounded`,key:n.set,by:n.by}}if(`persist`in n){let e=Ab.get(n.persist)??n.persist;if(`to`in n)return{kind:`persist-literal`,key:n.persist,value:n.to,stateVar:e};if(`from`in n){let t=Zb(n.from,i);return{kind:`persist-option`,key:n.persist,stateVar:e,options:[...t.members],paletteOf:t.paletteOf,library:t.library}}if(`cycle`in n)return{kind:`persist-cycle`,key:n.persist,stateVar:e,members:n.cycle};if(`removeSegment`in n)return{kind:`layout-op`,key:n.persist,op:{op:`remove`,target:n.removeSegment}};if(`insertSegment`in n)return{kind:`layout-op`,key:n.persist,op:{op:`insert`,segment:n.insertSegment,anchor:n.anchor,relation:n.relation}};if(`insertSegmentFrom`in n){let e=Zb(n.insertSegmentFrom,i);return{kind:`layout-op-option`,key:n.persist,anchor:n.anchor,relation:n.relation,options:[...e.members],paletteOf:e.paletteOf,library:e.library}}return{kind:`persist-bounded`,key:n.persist,by:n.by}}if(`copy`in n)return{kind:`copy`,text:IM(e,n.copy,t)};if(`open`in n)return{kind:`open`,target:IM(e,n.open,t)};if(`reset`in n)return{kind:`reset`,key:n.reset};if(`doctor`in n)return n.doctor===`run`?{kind:`doctor-run`}:{kind:`doctor-fix`,check:n.check};if(`ceiling`in n)return{kind:`ceiling`,args:zC(n)};if(`slash`in n)return{kind:`slash`,line:n.slash};if(`undo`in n)return{kind:`undo`};if(`redo`in n)return{kind:`redo`};if(`back`in n)return{kind:`back`};if(`rewind`in n)return{kind:`rewind`};if(`save`in n)return{kind:`save`};if(`preset`in n)return n.preset===`save`?{kind:`preset-save`}:{kind:`preset-delete`,name:IM(e,n.name,t)};let[o,...s]=n.do.map(e=>{let n=a.get(e);if(n===void 0)throw Error(`action "${t}" fires "${e}", which is not declared in this config`);return n});return{kind:`do`,head:o,rest:s}}function FM(e){return e.kind===`do`?FM(e.head):e}function IM(e,t,n){try{return e(t)}catch(e){throw Error(`Template parse error in actions.${n}: ${e.message}`,{cause:e})}}function LM(e,t){return e.has(t)?Ev(e.read(t)):``}function RM(e,t){return e.evaluate(t).map(e=>e.plain).join(``)}function zM(e,t,n,r){let i=new V(e,{style:z.combine([r,new z({link:t,bold:n})])});return i.overflow=`ignore`,i.end=``,i}function BM(e,t){return Math.max(e.members.indexOf(LM(t,e.stateVar)),0)}function VM(e,t,n,r,i){switch(e.kind){case`set-literal`:{let t=LM(r,e.stateVar);return{effects:[{verb:IE,args:[i,e.key,e.value]}],active:t===e.value}}case`set-option`:{let a=n??t,o=LM(r,e.stateVar);return{effects:[{verb:IE,args:[i,e.key,a]}],active:o===a}}case`set-int`:{let a=n??t,o=LM(r,e.stateVar);return{effects:[{verb:IE,args:[i,e.key,a]}],active:o===a}}case`set-cycle`:{let t=e.members[(BM(e,r)+1)%e.members.length];return{effects:[{verb:IE,args:[i,e.key,t]}],active:!1}}case`set-bounded`:return{effects:[{verb:LE,args:[i,e.key,String(e.by)]}],active:!1};case`copy`:return{effects:[{verb:RE,args:[RM(e.text,vy(r))]}],active:!1};case`open`:return{effects:[{verb:zE,args:[RM(e.target,vy(r))]}],active:!1};case`persist-literal`:{let t=LM(r,e.stateVar);return{effects:[{verb:UE,args:[i,e.key,e.value]}],active:t===e.value}}case`persist-option`:{let a=n??t,o=LM(r,e.stateVar);return{effects:[{verb:UE,args:[i,e.key,a]}],active:o===a}}case`persist-cycle`:{let t=e.members[(BM(e,r)+1)%e.members.length];return{effects:[{verb:UE,args:[i,e.key,t]}],active:!1}}case`persist-bounded`:return{effects:[{verb:WE,args:[i,e.key,String(e.by)]}],active:!1};case`reset`:return{effects:[{verb:JE,args:[i,e.key]}],active:!1};case`undo`:return{effects:[{verb:XE,args:[i]}],active:!1};case`redo`:return{effects:[{verb:ZE,args:[i]}],active:!1};case`back`:return{effects:[{verb:QE,args:[i]}],active:!1};case`rewind`:return{effects:[{verb:$E,args:[i]}],active:!1};case`save`:return{effects:[{verb:GE,args:[i]}],active:!1};case`preset-save`:return{effects:[{verb:KE,args:[i]}],active:!1};case`preset-delete`:return{effects:[{verb:qE,args:[i,RM(e.name,vy(r))]}],active:!1};case`doctor-run`:return{effects:[{verb:tD,args:[i]}],active:!1};case`doctor-fix`:return{effects:[{verb:nD,args:[i,e.check]}],active:!1};case`ceiling`:return{effects:[{verb:rD,args:[i,...e.args]}],active:!1};case`slash`:return{effects:[{verb:iD,args:[i,e.line]}],active:!1};case`layout-op`:return{effects:[{verb:YE,args:[i,e.key,ck(e.op)]}],active:!1};case`do`:{let a=VM(e.head,t,n,r,i);return{effects:[...a.effects,...e.rest.flatMap(e=>VM(e,t,void 0,r,i).effects)],active:a.active}}case`layout-op-option`:{let r={op:`insert`,segment:n??t,anchor:e.anchor,relation:e.relation};return{effects:[{verb:YE,args:[i,e.key,ck(r)]}],active:!1}}}}function HM(e,t,n,r){if(n.length===0)throw Error(`action "${e}" needs a display (the clickable text)`);if(t.kind===`set-cycle`||t.kind===`persist-cycle`)return{display:Gc(`action "${e}"`,n,t.members.length,BM(t,r)),boundValue:void 0};if(n.length>2)throw Error(`action "${e}" takes a display and an optional bound value, got ${n.length} arguments (per-state displays are a cycle action's form)`);return{display:n[0],boundValue:n[1]}}function UM(e,t,n){let r=n.compiled.get(e);if(!r)throw Error(`action "${e}" is not declared in this config`);let i=n.store,{display:a,boundValue:o}=HM(e,FM(r),t,i),{effects:s,active:c}=VM(r,a,o,i,LM(i,`session.id`));return zM(a,sD(s),c)}function WM(e){return{action:{fn:(t,...n)=>UM(t,n,e),argTypes:[`string`,`string`],arity:{kind:`variadic`},returnType:`T`}}}function GM(e,t){return zM(`✕`,sD([{verb:IE,args:[LM(e,`session.id`),t,Hc]}]),!1)}function KM(e,t,n){return new z({bgcolor:yn.fromRgba(t),color:yn.fromRgba(ka(e,t,n))})}function qM(e,t,n){return new z({color:yn.fromRgba(cr(ya(e,`warning`),t,Oa,n))})}function JM(e,t,n){return z.combine([KM(e,t,n),qM(e,t,n)])}function YM(e,t,n){return KM(e.palette,Ha(e.palette,e.disclosure,[t],n),n)}function XM(e,t,n,r,i){return r===void 0?n=>YM(e,{...n,distribution:t},i):(e,t)=>ZM(r(t,n),i)}function ZM(e,t){let n=ya(e,`background`);return new z({bgcolor:yn.fromRgba(n),color:yn.fromRgba(cr(ya(e,`primary`),n,4.5,t))})}function QM(e,t,n){let r=t.map(t=>({label:t.label,indices:e.flatMap((e,n)=>e.group===t.id?[n]:[])})).filter(e=>e.indices.length>0);if(r.reduce((e,t)=>e+t.indices.length,0)!==e.length){let n=new Set(t.map(e=>e.id)),r=e.flatMap((e,t)=>n.has(e.group)?[]:[`#${t} (group "${e.group}")`]);throw Error(`library: ${r.join(`, `)} name a group the domain does not list (${[...n].join(`, `)})`)}return n?r.flatMap(e=>$M(e.indices,8).map(t=>[{label:e.label,indices:t}])):[r]}function $M(e,t){return Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))}function eN(e,t){return new V(e).truncate(t,{marker:`…`}).plain}function tN(e){return{current:null,drawnAt:e}}function nN(e,t,n,r,i,a){let o={segName:t,placementId:n,palette:r,disclosure:i,tint:a,bg:void 0,drops:[]};return e.current=o,o}function rN(e,t){let n=e.current;if(n===null)throw Error(`${t} is only available inside a segment's templates — there is no active segment here. Segment-scoped functions cannot be used in variable declarations or layout-node "when" predicates, which are evaluated outside any segment.`);return n}function iN(e){return new V(e).cellLength}function aN(e){return Math.max(1,e.width-e.chromeCols-2*e.padding)}function oN(e){return Math.max(1,aN(e)-(iN(`✕`)+2*e.padding+e.seamCols))}function sN(e,t,n){if(!Number.isFinite(t))return e.length>0?[e.map((e,t)=>t)]:[];let r=Math.max(1,t-n),i=[],a=[],o=0;for(let t=0;t<e.length;t++){let n=e[t];a.length===0?(a=[t],o=n):o+1+n<=r?(a.push(t),o+=1+n):(i.push(a),a=[t],o=n)}return a.length>0&&i.push(a),i}function cN(e,t){let n=iN(`✕`)+1,r=iN(`←`)+1+iN(`→`)+1,i=sN(e,t,n);return(i.length>1?sN(e,t,n+r):i).map(e=>[{label:``,indices:e}])}function lN(e,t){let n=[];for(let t of e)n.length>0&&n.push(new V(` `)),n.push(t);let r=V.fromFragments(n);return r.overflow=t?`ignore`:void 0,r.end=``,r}function uN(e,t,n,r){let i=e.compiled.get(t);if(!i||i.kind!==n)throw Error(`picker references action "${t}" which must be ${r}, got ${i?`a ${i.kind} action`:`no such action`}`);return i}function dN(e,t,n){let r=e.compiled.get(t),i=r&&FM(r);if(!i||i.kind!==`set-option`&&i.kind!==`persist-option`&&i.kind!==`layout-op-option`)throw Error(`${n} references action "${t}" which must be a set-option, persist-option, or layout-op-option action ({ set, from }, { persist, from }, or { persist, insertSegmentFrom, anchor, relation }), got ${i?`a ${i.kind} action`:`no such action`}`);return i}function fN(e,t,n,r,i,a,o,s){let c=dN(a,e,`picker`),l=a.compiled.get(e),u=a.store,d=LM(u,`session.id`),f=`stateVar`in c?LM(u,c.stateVar):void 0,p=i?aN(a):1/0,m=c.library&&{groups:c.library.groups,entries:c.options.map(c.library.entry)},h=m===void 0?cN(c.options.map(iN),p):QM(m.entries,m.groups,i),g=parseInt(LM(u,t.stateVar),10),_=Number.isInteger(g)?Math.max(0,Math.min(g,h.length-1)):0,v=h[_]??[],y=e=>sD([{verb:IE,args:[d,t.key,String(e)]}]),b=n.flatMap(([e,t])=>[e,t]),x=sD([{verb:IE,args:[d,...b]}]),S=r?[{verb:IE,args:[d,...b]}]:[],C=e=>sD([...VM(l,e,e,u,d).effects,...S]),w=(e,t)=>{let n=c.options[e];return zM(t,C(n),n===f,o({index:e,count:c.options.length},n))},T=[zM(`✕`,x,!1,s)];_>0&&T.push(zM(`←`,y(_-1),!1));let ee=_<h.length-1?[zM(`→`,y(_+1),!1)]:[];if(m===void 0){let e=v.flatMap(e=>e.indices);return[lN([...T,...e.map(e=>w(e,c.options[e])),...ee],i)]}let te=new z({bold:!0}),E=h.length>1?` ${_+1}/${h.length}`:``,ne=v.length===1?[new V(`${v[0].label}${E}`,{style:te})]:[],D=[lN([...T,...ne,...ee],i)];for(let e of v){v.length>1&&D.push(lN([new V(e.label,{style:te})],i));let t=Math.max(...e.indices.map(e=>iN(c.options[e])));for(let n of e.indices){let e=c.options[n],r=m.entries[n].description,a=r===void 0?void 0:EO(r),o=` `.repeat(t-iN(e)+2),s=a===void 0?e:`${e}${o}${a}`;D.push(lN([w(n,eN(s,p))],i))}}return D}function pN(e,t){return{picker:{fn:(n,r,i,a,...o)=>{fy(`picker "${n}"`,[`closeOnPick`,`paged`],o);let s=uN(e,r,`set-int`,`an int action ({ set, int: true })`),c=dN(e,n,`picker`);if(c.library!==void 0)throw Error(`{{ picker "${n}" … }} ranges a catalogue domain, which lays out as one row per member; a catalogue renders in a {{ menu }} body`);let l=rN(t,`{{ picker }}`);if(l.bg===void 0)throw Error(`{{ picker }} is not available while segments.${l.segName}'s own "bg:" is being evaluated — a picker is drawn on that background`);let[u]=fN(n,{key:s.key,stateVar:s.stateVar},[[s.key,`-1`]],i===!0,a===!0,e,XM(l,pa(void 0),e,c.paletteOf,t.drawnAt()),qM(l.palette,l.bg,t.drawnAt()));return u},argTypes:[`string`,`string`,`bool`],arity:{kind:`variadic`},returnType:`T`}}}function mN(e,t,n,r,i){let a=Math.min(Math.floor((t-1)/2),i),o=n,s=0;for(;s<a;){let t=o+iN(e(-(s+1)))+1+iN(e(s+1))+1;if(t>r)break;o=t,s+=1}return s}function hN(e,t,n,r,i){if(!(`stateVar`in t))throw Error(`carousel references action "${e}", which inserts a segment and holds no current value to centre on — a carousel needs a { set, from } or { persist, from } action`);let a=n.store;if(!a.has(t.stateVar))throw Error(`carousel references action "${e}", whose key "${t.stateVar}" no variable reads back, so there is no current value to centre on — declare { kind: "state", key: "${t.stateVar}" } among the variables`);let o=n.compiled.get(e),s=LM(a,`session.id`),{options:c}=t,l=c.length,u=LM(a,t.stateVar),d=Math.max(c.indexOf(u),0),f=e=>((d+e)%l+l)%l,p=e=>c[f(e)],m=new Map,h=e=>{let t=m.get(e);if(t!==void 0)return t;let n=sD(VM(o,p(e),p(e),a,s).effects);return m.set(e,n),n},g=e=>zM(p(e),h(e),p(e)===u,r({index:f(e),count:l},p(e))),_=mN(p,l,iN(`◀`)+1+iN(p(0))+1+iN(`▶`),oN(n),i),v=e=>Array.from({length:_},(t,n)=>g(e*(n+1)));return lN([...v(-1).reverse(),zM(`◀`,h(-1),!1),g(0),zM(`▶`,h(1),!1),...v(1)],!0)}function gN(e,t){return{carousel:{fn:(n,r,...i)=>{if(fy(`carousel "${n}"`,[`neighbours`],i),r!==void 0&&r<0)throw Error(`carousel "${n}": neighbours must be a whole number ≥ 0 (0 shows only ◀ CURRENT ▶), got ${String(r)}`);let a=r??1/0,o=dN(e,n,`carousel`);return hN(n,o,e,XM(rN(t,`{{ carousel }}`),pa(void 0),e,o.paletteOf,t.drawnAt()),a)},argTypes:[`string`,`int`],arity:{kind:`variadic`},returnType:`T`}}}const _N=[`~/code`,`main`,`opus`,`42%`,`5m`,`$1.20`];function vN(e,t,n){let r=Fa(e,{hue:aa,depth:0},n);return[sa(t).map((t,n)=>({text:_N[n%_N.length],colour:ba(e,t)})),[{text:`▾ open`,colour:r.state},{text:`menu`,colour:r.plane}],[{text:`warn`,colour:ya(e,`warning`)},{text:`error`,colour:ya(e,`error`)}]]}function yN(e,t,n,r){let i=vN(e,t,n).flatMap((t,r)=>t.map(({text:t,colour:i},a)=>({gap:r>0&&a===0?` `:``,cell:new V(` ${t} `,{style:KM(e,i,n)})}))),a=[],o=0;for(let{gap:e,cell:t}of i){if(o+=e.length+t.cellLength,o>r)break;e!==``&&a.push(new V(e)),a.push(t)}let s=V.fromFragments(a);return s.overflow=`ignore`,s.end=``,s}function bN(e,t){return{themePreview:{fn:()=>yN(e.palette,e.variation,t.drawnAt(),oN(e)),argTypes:[],arity:{kind:`exact`},returnType:`T`}}}const xN=e=>e.slice(e.lastIndexOf(`.`)+1),SN=(e,t)=>{let n=new V(xN(e));return n.truncate(t,{marker:`…`}),n.plain};function CN(e,t){let n=e.map(e=>e.map(({name:e})=>iN(xN(e)))),r=e=>n.every(n=>n.reduce((t,n)=>t+Math.min(n,e)+2,0)<=t),i=Math.max(1,...n.flat());for(;i>1&&!r(i);)--i;return i}function wN(e,t,n,r){let i=CN(e,r),a=e.map(e=>{let a=[],o=0;for(let{name:s,address:c,palette:l}of e){let e=new V(` ${SN(s,i)} `,{style:KM(l,Ka(l,{kind:`bar`,variation:t,address:c},n).tint,n)});if(o+=e.cellLength,o>r)break;a.push(e)}return a}),o=V.fromFragments(a.flatMap((e,t)=>t===0?e:[new V(`
192
- `),...e]));return o.overflow=`ignore`,o.end=``,o}function TN(e,t){return{layoutPreview:{fn:()=>wN(e.layout(),e.variation,t.drawnAt(),oN(e)),argTypes:[],arity:{kind:`exact`},returnType:`T`}}}function EN(e,t,n,r){let i=rN(r.activeSegment,`{{ menu }}`),a=r.action,o=p_(i.placementId,e,n.key),s=g_(o),c=f_(e),l=LM(a.store,o)===c,u=LM(a.store,`session.id`),d=l?Hc:c,f=zM(Gc(`{{ menu "${e}" }}`,t,2,+!!l),sD([{verb:IE,args:[u,o,d,s,`0`]}]),!1);return i.drops.push(...l?fN(e,{key:s,stateVar:s},[[o,Hc],[s,`0`]],n.closeOnPick,n.paged,a,XM(i,n.distribution,a,dN(a,e,`menu`).paletteOf,r.activeSegment.drawnAt()),qM(i.palette,Fa(i.palette,i.disclosure,r.activeSegment.drawnAt()).plane,r.activeSegment.drawnAt())):[]),f}const DN=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function ON(e,t){let n=t[t.length-1],r=DN(n)?n:void 0,i=r===void 0?t:t.slice(0,-1),a=i.findIndex(e=>typeof e!=`string`);if(a!==-1)throw Error(`{{ menu "${e}" }} display #${a+1} is not text (${JSON.stringify(i[a])}) — a menu binds its trigger text, then an optional trailing (dict …) of options`);return{displays:i,options:b_(r??{})}}function kN(e){return{menu:{fn:(t,...n)=>{let{displays:r,options:i}=ON(t,n);return EN(t,r,i,e)},argTypes:[`string`,`value`],arity:{kind:`variadic`},returnType:`T`}}}function AN(e){let{value:t,max:n,width:r,filled:i,empty:a,colourAt:o}=e,s=jN(t,n,r),c=[];for(let e=0;e<r;e++){let t=e<s,l=t&&o!==void 0?o(e*n/r):void 0;c.push(new V(t?i:a,{style:l===void 0?void 0:new z({color:l})}))}let l=V.fromFragments(c);return l.end=``,l.overflow=`ignore`,l}function jN(e,t,n){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?0:Math.min(n,Math.max(0,Math.round(e/t*n)))}function MN(e){let t={fn:(()=>{let t=rN(e,`{{ bgOf }}`);if(t.bg===void 0)throw Error(`{{ bgOf }} is not available while segments.${t.segName}'s own "bg:" is being evaluated — the background is what that template computes. Reach for a palette color there instead, e.g. bg: '{{ darken (color "surface") 1 }}'.`);return t.bg.hex}),argTypes:[],arity:{kind:`exact`},returnType:`string`},n={fn:(()=>rN(e,`{{ tint }}`).tint.hex),argTypes:[],arity:{kind:`exact`},returnType:`string`},r=Qv(()=>rN(e,`{{ color }} / {{ ramp }} / {{ gauge }}`).palette),i={fn:((e,t,n,i,a,o,...s)=>{let c=o===void 0?void 0:[o,...NN(s)];return AN({value:e,max:t,width:n,filled:i,empty:a,colourAt:c===void 0?void 0:e=>String(r.ramp.fn(e,...c))})}),argTypes:[`float`,`float`,`int`,`string`,`string`,`string`],arity:{kind:`variadic`},returnType:`T`};return{...r,bgOf:t,tint:n,gauge:i}}function NN(e){return e.flatMap(e=>{let t=e.indexOf(`:`),n=t<0?NaN:Number(e.slice(0,t));if(!Number.isFinite(n))throw Error(`{{ gauge }} stop "${e}" must be "<position>:<colour>", e.g. "80:error" or "80:#ff0000"`);return[n,e.slice(t+1)]})}function PN(e){let t=[],n=[];for(let r of e){if(!r.contains(`
186
+ `,c.join(e,`lib`),t.sessionId,t.cwd],env:_A(t),timeoutMs:3e3,category:`memento.read`});return n.ok?yA(n.stdout):X(vA(n))}function xA(e,t,n){let r=Oe({bin:c.join(e,pA),args:n.kind===`set`?[`set`,`session`,n.to]:[`clear`,`session`],env:_A(t),timeoutMs:5e3,category:`memento.move`});if(!r.ok)throw Error(vA(r))}function SA(){return{locate:e=>gA(ED(e.claudeConfigDir),e.projectDir),read:bA,move:xA}}function CA(e,t,n){let r=n===void 0?``:`CLAUDE_CONFIG_DIR=${SD(n)} `,i=e.added_dirs.map(e=>` --add-dir ${SD(e)}`).join(``);return`cd ${SD(e.project_dir)} && ${r}claude --resume ${SD(t)}${i}`}function wA(e,t,n){let r=T_(t(`preset`),e.globals.preset,e.presets),i=O_(e,r),a=t(`edit.mode`)===`arrange`?e.editGlobals:{};return{preset:r,presetCustomized:n(r),theme:Gb(a.palette,t(`theme`),i.palette),style:so(a.style,t(`style`),i.style,e.styles),endcaps:uo(a.endcaps,t(`endcaps`),i.endcaps),variation:vo(a.variation,t(`variation`),i.variation),separator:a.default_separator??i.default_separator,autoWrap:To(a.autoWrap,t(`autoWrap`),i.autoWrap),padding:Do(a.padding,t(`padding`),i.padding),charset:a.charset??i.charset??`unicode`,updateNotice:Eo(a.updateNotice,t(`updateNotice`),i.updateNotice),colorCompatibility:a.colorCompatibility??i.colorCompatibility??`truecolor`}}function TA(e,t){return{endcaps:e.endcaps,separator:e.separator,colorCompatibility:e.colorCompatibility,wrap:e.autoWrap,padding:e.padding,charset:e.charset,width:t}}function EA(e){return{theme:e.theme,style:e.style,preset:e.preset,variation:e.variation}}function DA(e){return{preset:{effective:e.preset,customized:e.presetCustomized,bundled:Zk(e.preset)},endcaps:{effective:e.endcaps},variation:{effective:e.variation},charset:{effective:e.charset},colorCompatibility:{effective:e.colorCompatibility},autoWrap:{effective:e.autoWrap},padding:{effective:e.padding},updateNotice:{effective:e.updateNotice}}}const OA=10*1e3;function kA(e,t,n,r){let i=n-(t*1e3-r);if(i<3e5||e<=0)return;let a=e/i,o=(100-e)/a;return Math.max(0,Math.round(o/6e4))}function AA(e,t){if(!(t<60))return e*3600/t}function jA(e,t,n,r){let i=r-t;if(i<50||i>OA)return;let a=n-e;if(!(a<=0))return a*1e3/i}function MA(e){let{prev:t,cur:n}=e;if(t===void 0)return;let r=jA(t.input,t.atMs,n.input,n.atMs),i=jA(t.output,t.atMs,n.output,n.atMs),a=jA(t.total,t.atMs,n.total,n.atMs);if(!(r===void 0&&i===void 0&&a===void 0))return{...r!==void 0&&{input:r},...i!==void 0&&{output:i},...a!==void 0&&{total:a}}}function NA(e){let{samples:t}=e,n=[];for(let e=1;e<t.length;e++){let r=t[e-1],i=t[e],a=i.atMs-r.atMs;if(a<50||a>OA)continue;let o=jA(r.total,r.atMs,i.total,i.atMs);n.push(o??0)}if(n.length!==0)return n.join(`,`)}function PA(e){let t=e.indexOf(`.`);return t<0?e:e.slice(0,t)}function FA(e){let t=[],n=(e,n)=>{try{let e=n();return e===``?void 0:e}catch(n){t.push(`host.${e}: ${String(n)}`);return}},r=n(`name`,()=>PA(m.hostname())),i=n(`user`,()=>m.userInfo().username);return{host:{...r!==void 0&&{name:r},...i!==void 0&&{user:i},...e.ssh!==void 0&&{ssh:e.ssh}},failures:t}}function IA(e,t){let n=new Map;for(let[t,r]of Object.entries(e.variables))n.set(t,r);for(let[t,r]of Object.entries(e.segments))if(r.vars)for(let[e,i]of Object.entries(r.vars))n.set(`${t}.${e}`,i);let r=[],i=new Set,a=t=>mv(t,e.helpers).keys(),o=O_(e,t);for(let e of eo){let t=o[e];if(to(t))for(let e of a(t))r.push(e)}for(let n of ks(D_(e,t).node)){if(n.when)for(let e of a(n.when))r.push(e);if(n.kind!==`segment`)continue;let t=e.segments[n.name];if(t){for(let e of[t.template,t.when,t.bg,t.fg])if(e)for(let t of a(e))r.push(t)}}let s=new Set;for(;r.length>0;){let e=r.pop();for(let t of RA(n,e)){if(i.has(t))continue;i.add(t);let e=n.get(t);if(e){if(e.kind===`input`)s.add(e.path);else if(e.kind===`template`)for(let t of a(e.template))r.push(t)}}}return s}function LA(e){let t=new Map;return n=>{let r=t.get(n);if(r!==void 0)return r;let i=IA(e,n);return t.set(n,i),i}}function RA(e,t){let n=t;for(;n.length>0;){if(e.has(n))return[n];let t=n.lastIndexOf(`.`);if(t<0)break;n=n.slice(0,t)}let r=`${t}.`,i=[];for(let t of e.keys())t.startsWith(r)&&i.push(t);return i}function zA(e,t){for(let n of e)if(n===t||n.startsWith(t+`.`))return!0;return!1}function BA(e){let t=t=>e.has(t),n=t(`git.staged`)||t(`git.unstaged`)||t(`git.untracked`)||t(`git.conflicts`);return{...t(`git.sha`)&&{showSha:!0},...n&&{showWorkingTree:!0},...t(`git.stash`)&&{showStashCount:!0},...t(`git.upstream`)&&{showUpstream:!0},...t(`git.repoName`)&&{showRepoName:!0},...t(`git.repoUrl`)&&{showRepoUrl:!0},...t(`git.operation`)&&{showOperation:!0},...t(`git.timeSinceCommit`)&&{showTimeSinceCommit:!0},...(t(`git.prNumber`)||t(`git.prState`)||t(`git.prUrl`)||t(`git.prError`))&&{showPullRequest:!0}}}async function VA(e,t,n,r,i,a,{configPath:o,...s}){let c=e=>zA(r,e),l=(t.clock??(()=>new Date))().getTime(),u=(e,t,n)=>t?n().catch(t=>X(`${e}: ${String(t)}`)):Promise.resolve(Y),[d,f,p,m,h,g,_,v,y,b,x]=await Promise.all([u(`git`,c(`git`),()=>t.gitProvider.getGitInfo(n??e.workspace?.current_dir,BA(r),e.workspace?.project_dir)),u(`session`,c(`session.cost`)||c(`session.tokens`)||c(`burn`),()=>t.usageStore.getUsageInfo(e.session_id,e)),u(`today`,c(`today`),()=>t.usageStore.getTodayInfo(e,a.claudeConfigDir)),u(`context`,c(`context`)||c(`autocompact`),()=>t.contextProvider.getContextInfo(e)),u(`metrics`,c(`metrics`)||c(`burn`),()=>t.metricsProvider.getMetricsInfo(e.session_id,e)),u(`activity`,c(`activity`),()=>t.activityProvider.getActivityInfo(e.session_id,e)),u(`tmux`,c(`tmux`),()=>t.tmuxService.getSessionId()),u(`cache`,c(`cache`),()=>cA(e.transcript_path)),u(`speed`,c(`speed`),()=>t.usageStore.observeSpeed(e.session_id,e.transcript_path,l)),u(`memento`,c(`memento`),()=>t.mementoProvider.getCeiling(dA({sessionId:e.session_id,projectDir:e.workspace?.project_dir??``,cwd:n??e.workspace?.current_dir??``},a))),u(`autocompact`,c(`autocompact`),()=>Promise.resolve(t.autoCompact(TD(wD(a.claudeConfigDir)))))]),S=[],C=e=>{if(e.kind===`failed`){S.push(e.reason);return}return e.kind===`ok`?e.value:void 0},w=YA(d);S.push(...w.failures);let T=FA(a);S.push(...T.failures);let ee=C(f),te=C(p),E=C(m),ne=C(h),D=C(g),O=C(_),re=C(v),ie=WA(b);b.kind===`failed`&&S.push(`memento: ${b.reason}`);let ae=HA(x,E?.maxTokens);x.kind===`failed`&&S.push(`autocompact: ${x.reason}`);for(let e of S)t.log(`warn`,`provider fetch failed: ${e}`);let oe=e.rate_limits?.five_hour,se=e.rate_limits?.seven_day,ce=oe?kA(oe.used_percentage,oe.resets_at,18e6,l):void 0,le=se?kA(se.used_percentage,se.resets_at,6048e5,l):void 0,ue=ee?.session.cost,de=ne?.sessionDuration,fe=c(`burn`)&&ue!=null&&de!=null?AA(ue,de):void 0,pe=C(y),me=pe===void 0?void 0:MA(pe),he=pe===void 0?void 0:NA(pe),ge=me!==void 0||he!==void 0?{...me,...he!==void 0&&{history:he}}:void 0,k=JA(process.env.HOME??process.env.USERPROFILE),_e=e.workspace?{...e.workspace,current_dir:JA(e.workspace.current_dir)??``,project_dir:JA(e.workspace.project_dir)??``,added_dirs:(e.workspace.added_dirs??[]).map(e=>JA(e)??e)}:e.workspace,ve=ee===void 0?void 0:qA({cost:ee.session.cost,tokens:ee.session.tokens}),ye=te===void 0?void 0:{cost:te.cost,tokens:te.tokens},be=ne===void 0?void 0:qA({lastResponseTime:ne.lastResponseTime,responseTime:ne.responseTime,sessionDuration:ne.sessionDuration,messageCount:ne.messageCount,linesAdded:ne.linesAdded,linesRemoved:ne.linesRemoved}),xe=D===void 0?void 0:GA(D);return{...e,..._e!==void 0&&{workspace:_e},...k!==void 0&&{home:k},...w.git!==void 0&&{git:w.git},...O!==void 0&&{tmux:{session:O}},host:T.host,...DA(i),history:t.history(e.session_id),navigation:{back:t.navigation(e.session_id)},...s,...o!==null&&{configPath:o},resumeCommand:CA(_e,e.session_id,a.claudeConfigDir),...ve!==void 0&&{session:ve},...ye!==void 0&&{today:ye},...fe!==void 0&&{burn:{costPerHour:fe}},...ge!==void 0&&{speed:ge},...c(`block`)&&oe!==void 0&&{block:{nativeUtilization:oe.used_percentage,resetsAt:oe.resets_at,...ce!==void 0&&{etaMinutes:ce}}},...se!==void 0&&{weekly:{percentage:se.used_percentage,resetsAt:se.resets_at,...le!==void 0&&{etaMinutes:le}}},...re!==void 0&&{cache:{expiresAt:re}},...E!==void 0&&{context:{totalTokens:E.totalTokens,contextLeft:E.contextLeftPercentage}},...be!==void 0&&{metrics:be},...xe!==void 0&&{activity:xe},...ie!==void 0&&{memento:ie},...ae!==void 0&&{autocompact:ae}}}function HA(e,t){switch(e.kind){case`absent`:return;case`failed`:return{error:e.reason};case`ok`:return zk(e.value,t)}}const UA=e=>e.trim().split(`
187
+ `).at(-1).trim();function WA(e){switch(e.kind){case`absent`:return;case`failed`:return{error:UA(e.reason)};case`ok`:{let{ceiling:t,session:n}=e.value;return{ceiling:t===`off`?0:t,off:t===`off`,session:n??``}}}}function GA(e){let t=e.todos.findIndex(e=>e.active),n=e.todos.length===0?void 0:{total:e.todos.length,completed:e.todos.filter(e=>e.done).length,...t>=0&&{position:t+1,active:e.todos[t].text}},r=KA(e.running),i=KA(e.done),a=r===void 0&&i===void 0?void 0:{...r!==void 0&&{running:r},...i!==void 0&&{done:i}};if(!(e.command===null&&n===void 0&&a===void 0))return{...e.command!==null&&{command:e.command},...n!==void 0&&{todo:n},...a!==void 0&&{tool:a}}}function KA(e){return e.length===0?void 0:e.map(e=>`${e.name}:${e.count}`).join(`,`)}function qA(e){let t={},n=!1;for(let r of Object.keys(e)){let i=e[r];i!=null&&(t[r]=i,n=!0)}return n?t:void 0}function JA(e){return e===void 0||e.length===0||c.sep!==`\\`?e:e.replace(/\\/g,`/`)}function YA(e){if(e.kind===`absent`)return{failures:[]};if(e.kind===`failed`)return{failures:[e.reason]};let t=e.value,n=[],r=(e,t)=>{if(!(t===void 0||t.kind===`absent`)){if(t.kind===`failed`){n.push(`git.${e}: ${t.reason}`);return}return t.value}},i=r(`aheadBehind`,t.aheadBehind),a=r(`sha`,t.sha),o=r(`operation`,t.operation),s=r(`timeSinceCommit`,t.timeSinceCommit),c=r(`stash`,t.stashCount),l=r(`upstream`,t.upstream),u=r(`repoName`,t.repoName),d=r(`repoUrl`,t.repoUrl),f=t.pullRequest,p={};return f?.kind===`ok`?(p.prNumber=f.value.number,p.prState=f.value.state,p.prUrl=f.value.url):f?.kind===`failed`&&(n.push(`git.pr: ${f.reason}`),p.prError=f.reason),{git:{branch:t.branch,status:t.status,...i!==void 0&&{ahead:i.ahead,behind:i.behind},...t.workingTree!==void 0&&{staged:t.workingTree.staged,unstaged:t.workingTree.unstaged,untracked:t.workingTree.untracked,conflicts:t.workingTree.conflicts},...a!==void 0&&{sha:a},...o!==void 0&&{operation:o},...s!==void 0&&{timeSinceCommit:s},...c!==void 0&&{stash:c},...l!==void 0&&{upstream:l},...u!==void 0&&{repoName:u},...d!==void 0&&{repoUrl:d},...p},failures:n}}const XA={theme:e=>e.theme.kind===`decided`?e.theme.name:null,preset:e=>e.preset,style:e=>e.style.kind===`decided`?e.style.name:null,endcaps:e=>e.endcaps,variation:e=>e.variation,autoWrap:e=>e.autoWrap?yo:bo,padding:e=>String(e.padding),updateNotice:e=>e.updateNotice?yo:bo},ZA=Object.entries(Db),QA=new Set(Ob.map(e=>e.sessionKey)),$A=()=>!1;function ej(e,t){return wA(e,e=>QA.has(e)?t(e):null,$A)}function tj(e,t,n,r){return e.flatMap(([e,i])=>{let a=XA[e](t);return a===null||a===XA[e](n(e))?[]:[{...i,value:a,target:r(i)}]})}function nj(e,t,n){return XA[n](ej(e,t))}function rj(e,t){let n=ej(e,t),r=wA(e,()=>null,$A),i=wA(e,e=>e===Db.preset.sessionKey?n.preset:null,$A);return tj(ZA,n,e=>e===`preset`?r:i,t=>ij(e,n.preset,t.configKey))}function ij(e,t,n){return n in(E_(e.presets,t).globals??{})?sx(t,n):n}function aj(e,t,n){let r=T_(t(Db.preset.sessionKey),e.globals.preset,e.presets),i=cx(n);return{key:i?.scope===`globals`?ij(e,r,i.field):n,globals:O_(e,r)}}function oj(e,t){let{preset:n}=ej(e,t);return lj(e,n).flatMap(({id:e,setting:r,key:i,decl:a,saved:o})=>{let s=t(i),c=s===null?void 0:Gs(a,s);return c===void 0||Ws(c)===Ws(o)?[]:[{preset:n,id:e,setting:r,key:i,value:c}]})}function sj(e,t,n){let r=new Map(n.map(e=>[e.key,e.value]));return w_(e.presets).flatMap(n=>{let i=lj(e,n);return[...new Set(i.filter(e=>r.has(e.key)).map(e=>e.id))].flatMap(e=>{let n=i.filter(t=>t.id===e);return Hs(Object.fromEntries(n.map(e=>[e.setting,e.decl])),Object.fromEntries(n.map(e=>{let n=r.get(e.key)??t(e.key),i=n===null?void 0:Gs(e.decl,n);return[e.setting,i??e.saved]}))).map(({message:t})=>`placement "${e}": ${t}`)})})}const cj=new WeakMap;function lj(e,t){let n=cj.get(e)??new Map;cj.set(e,n);let r=n.get(t);if(r!==void 0)return r;let i=[...ks(D_(e,t).node)].flatMap(t=>t.kind!==`segment`||t.drafts===void 0?[]:Object.entries(t.drafts).map(([n,{id:r,key:i}])=>{let a=Bs(e.segments[t.name])[n];return{id:r,setting:n,key:i,decl:a,saved:t.settings?.[n]??a.default}})),a=[...new Map(i.map(e=>[e.key,e])).values()];return n.set(t,a),a}function uj(e,t){let n=ej(e,t),r=wA(e,e=>e===Db.preset.sessionKey?n.preset:null,$A);return{from:n.preset,globals:E_(e.presets,n.preset).globals??{},picks:tj(ZA.filter(([e])=>e!==`preset`),n,()=>r,e=>e.configKey),placements:oj(e,t)}}function dj(e){return{sessionKeys:Ob.filter(t=>t.configKey===e).map(e=>e.sessionKey),fileKeys:[e,...yl(e)?Xk.map(t=>sx(t,e)):[]]}}function fj(e){return new Set(Ob.map(e=>e.configKey).filter(t=>dj(t).fileKeys.some(t=>hj(e,mj(t)))))}function pj(e,t,n){let r=rj(e,n),i=new Set(r.map(e=>e.configKey)),a=Nb(e=>i.has(Db[e].configKey)||t.has(Db[e].configKey));return{unsaved:r.length+oj(e,n).length,resettable:a}}function mj(e){let t=cx(e);if(t===null||t.scope===`preset-root`)throw Error(`reset layer "${e}" is not a value path`);return lx(t)}function hj(e,t){let[n,...r]=t;return n===void 0?e!==void 0:typeof e==`object`&&!!e&&hj(e[n],r)}const gj=Ya(),_j=new Set(gj),vj=new Set(co),yj=e=>e?_j.has(e)?{ok:!0,value:e}:{ok:!1,reason:`unknown theme "${e}" (have: ${gj.join(`, `)})`}:{ok:!1,reason:`theme name is required`},bj=e=>e?vj.has(e)?{ok:!0,value:e}:{ok:!1,reason:`unknown endcaps "${e}" (have: ${co.join(`, `)})`}:{ok:!1,reason:`endcaps name is required`},xj=new Set([`1`,`true`]),Sj=new Set([`0`,`false`]),Cj={endcaps:bj,theme:yj,"toolbar-expanded":e=>xj.has(e)?{ok:!0,value:`1`}:Sj.has(e)?{ok:!0,value:``}:{ok:!1,reason:`expected boolean-ish (1, 0, true, false), got "${e}"`}},wj=Ek(Cj,`state`,jj);function Tj(e,t){return wj.register(e,t)}function Ej(e){return wj.gateFor(e)}function Dj(e,t){return`set`in e?`to`in e?[{key:e.set,spec:{kind:`allow-list`,allowed:[e.to]}}]:`from`in e?[{key:e.set,spec:{kind:`allow-list`,allowed:$b(e.from,t).members}}]:`int`in e?[{key:e.set,spec:{kind:`int`}}]:`cycle`in e?[{key:e.set,spec:{kind:`allow-list`,allowed:e.cycle}}]:[{key:e.set,spec:{kind:`range`,min:e.min,max:e.max}}]:[]}function Oj(e){return e.filter(e=>e.spec.kind!==`allow-list`||!Object.hasOwn(Cj,e.key))}function kj(e,t,n){let r=Pb.get(n);if(r!==void 0)return nj(e,t,r);let i=Object.values(e.variables).find(e=>e.kind===`state`&&e.key===n);return i?.kind===`state`?i.default??null:null}function Aj(e){let t=Zb(e);return Oj(Object.values(e.actions).flatMap(e=>Dj(e,t)))}function jj(e){return wk(Aj(e))}const Mj=`update.dismissed`,Nj=`updateNotice`,Pj=Db.updateNotice.sessionKey;function Fj(e){return e.kind===`source`?e.newer.digest:MD(e.newer)}const Ij=e=>`${e.version} [${lk(e.digest)}]`;function Lj(e){switch(e.kind){case`source`:return{headline:`Newer source`,newer:Ij(e.newer),running:Ij(e.running),act:`rebuild`,busy:`rebuilding…`,command:{bin:`pnpm`,args:[`build`],cwd:e.root}};case`release`:return{headline:`Newer release`,newer:MD(e.newer),running:MD(e.running),act:`upgrade`,busy:`upgrading…`,command:{bin:`pnpm`,args:[`dlx`,`${PD}@${MD(e.newer)}`,`install`]}}}}const Rj={kind:`idle`},zj={kind:`running`};function Bj(e,t,n){if(e===null)return[];let r=Fj(e);if(!n.enabled||n.dismissed===r)return[];let i=Lj(e),a=`${i.headline}: ${i.newer}. You're on ${i.running}.`,o=t.kind===`failed`&&t.identity===r?[`${i.act} failed: ${t.reason}`]:[],s=[a,...o].join(`
188
+ `),c=pD([{verb:JE,args:[s]}]),l=t.kind===`running`?ZO(`[${i.busy}]`,c):ZO(`[${i.act}]`,pD([{verb:oD,args:[n.sessionId]}]));return[{severity:XO,message:s,lines:[[ZO(a,c),l,ZO(`[dismiss]`,pD([{verb:HE,args:[n.sessionId,Mj,r]}])),ZO(`[disable]`,pD([{verb:YE,args:[n.sessionId,Nj,`false`]},{verb:HE,args:[n.sessionId,Pj,`false`]}]))],...o.map(e=>[ZO(e,c)])]}]}function Vj(e,t){return e.kind===`stale`?{kind:`source`,root:e.root,newer:e.source,running:e.running}:e.kind===`not-source-checkout`&&t!==null&&t.kind===`stale`?{kind:`release`,newer:t.latest,running:t.installed}:null}function Hj(e){switch(e.kind){case`current`:return[`info`,`build: current ${Ij(e.stamp)}`];case`stale`:return[`info`,`build: stale — source ${Ij(e.source)}, running ${Ij(e.running)}`];case`not-source-checkout`:return[`info`,`build: not a source checkout`];case`unchecked`:return[`warn`,`build: unchecked: ${e.reason}`]}}function Uj(e){switch(e.kind){case`current`:return[`info`,`release: current ${MD(e.installed)}`];case`stale`:return[`info`,`release: stale — latest ${MD(e.latest)}, running ${MD(e.installed)}`];case`ahead`:return[`info`,`release: ahead — running ${MD(e.installed)}, latest ${MD(e.latest)}`];case`unchecked`:return[`warn`,`release: unchecked: ${e.reason}`]}}function Wj(e){let t=null;return([n,r])=>{r!==t&&(t=r,e(n,r))}}const Gj=e=>e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e!==``).at(-1);function Kj(e){let t=e.exitCode===null?``:` (exit ${e.exitCode})`,n=Gj(e.stderr)??e.error??Gj(e.stdout)??`no output`;return`${e.reason}${t}: ${n}`}function qj(){let e=[Ok(Nj,[`false`]),Tj(Pj,[`false`]),Tj(Mj,[])];return()=>e.forEach(e=>e())}function Jj(e){let{entryUrl:t,intervalMs:n,releaseIntervalMs:r,registryUrl:i,fetchImpl:a,onApplied:o,log:s}=e,c={kind:`unchecked`,reason:`not sampled yet`},l=null,u=Rj,d=null,f=Wj(s),p=Wj(s),m=()=>Vj(c,l);function h(){let e=m(),t=e===null?null:Fj(e);(d===null?null:d.identity)!==t&&(d?.dispose(),d=t===null?null:{identity:t,dispose:Tj(Mj,[t])})}function g(){c=pk(t,dk),f(Hj(c)),h()}async function _(){l=ID(yD,await FD(PD,a,i)),p(Uj(l)),h()}return{arm(){qj(),g(),setInterval(g,n).unref(),c.kind===`not-source-checkout`&&(_(),setInterval(()=>void _(),r).unref())},notice:e=>Bj(m(),u,e),act(){let e=m();if(e===null)throw new $(`apply-update: nothing newer is known to apply`);let t=Lj(e);if(u.kind===`running`)throw new $(`apply-update: already ${t.busy}`);u=zj,s(`info`,`apply-update: ${t.act} — ${t.command.bin} ${t.command.args?.join(` `)??``}`),De({...t.command,category:`update.apply`,timeoutMs:6e5}).then(n=>{if(n.ok){u=Rj,s(`info`,`apply-update: ${t.act} succeeded`),g(),o();return}let r=Kj(n);u={kind:`failed`,identity:Fj(e),reason:r},s(`error`,`apply-update: ${t.act} failed: ${r}`)})}}}var Yj=class{static CACHE_DIR=Ne();static USAGE_CACHE_DIR=c.join(this.CACHE_DIR,`usage`);static LOCKS_DIR=c.join(this.CACHE_DIR,`locks`);static isLocked(e){let t=c.join(this.LOCKS_DIR,e);if(!r.existsSync(t))return!1;try{let n=r.readFileSync(t,`utf-8`),i=parseInt(n.trim(),10);if(isNaN(i))return k(`Invalid PID in lock file ${e}, removing stale lock`),r.unlinkSync(t),!1;try{return process.kill(i,0),!0}catch(n){return n.code===`ESRCH`?(k(`Removing stale lock file ${e} for dead process ${i}`),r.unlinkSync(t),!1):(k(`Error checking process ${i} for lock ${e}:`,n),!0)}}catch(t){return k(`Error reading lock file ${e}:`,t),!0}}static async acquireLock(e,t=5e3){await this.ensureCacheDirectories();let n=c.join(this.LOCKS_DIR,e),i=Date.now(),a=String(process.pid);for(;Date.now()-i<t;)try{return await r.promises.writeFile(n,a,{flag:`wx`}),k(`Lock acquired for ${e}`),!0}catch(e){if(e.code===`EEXIST`)await oe(50);else throw e}return k(`Failed to acquire lock for ${e} within ${t}ms`),!1}static async releaseLock(e){let t=c.join(this.LOCKS_DIR,e);try{await r.promises.unlink(t),k(`Lock released for ${e}`)}catch(t){t.code!==`ENOENT`&&k(`Error releasing lock for ${e}:`,t)}}static async ensureCacheDirectories(){try{await Promise.all([r.promises.mkdir(this.CACHE_DIR,{recursive:!0}),r.promises.mkdir(this.USAGE_CACHE_DIR,{recursive:!0}),r.promises.mkdir(this.LOCKS_DIR,{recursive:!0})])}catch(e){k(`Failed to create cache directories:`,e)}}static createProjectHash(e){return ie(`md5`).update(e).digest(`hex`).substring(0,8)}static async getUsageCache(e,t){await this.ensureCacheDirectories();let n=c.join(this.USAGE_CACHE_DIR,`${e}.json`),i=`${e}.usage.lock`;for(let a=0;a<3;a++){if(this.isLocked(i)){k(`Cache for ${e} is locked, waiting...`),await oe(75);continue}try{let i=await r.promises.readFile(n,`utf-8`),a=JSON.parse(i);return!t||a.timestamp>=t?(k(`[CACHE-HIT] ${e} disk cache: found`),this.deserializeDates(a.data)):(k(`${e} cache outdated: cache=${a.timestamp}, latest=${t}`),null)}catch(t){if(t.code===`ENOENT`)return k(`No shared ${e} usage cache found`),null;k(`Attempt ${a+1} failed to read ${e} cache: ${t.message}. Retrying...`),await oe(75)}}return k(`Failed to read ${e} cache after 3 attempts.`),null}static deserializeDates(e){return Array.isArray(e)?e.map(e=>({...e,timestamp:new Date(e.timestamp)})):e}static async setUsageCache(e,t,n){let i=`${e}.usage.lock`;if(!await this.acquireLock(i)){k(`Could not acquire lock to set usage cache for ${e}`);return}try{await this.ensureCacheDirectories();let i=c.join(this.USAGE_CACHE_DIR,`${e}.json`),a=JSON.stringify({data:t,timestamp:n||Date.now()});await r.promises.writeFile(i,a,`utf-8`),k(`[CACHE-SET] ${e} disk cache stored`)}catch(t){k(`Failed to save ${e} usage cache:`,t)}finally{await this.releaseLock(i)}}};const Xj={"claude-haiku-4-5-20251001":{name:`Claude Haiku 4.5`,input:1,output:5,cache_write_5m:1.25,cache_write_1h:2,cache_read:.1},"claude-haiku-4-5":{name:`Claude Haiku 4.5`,input:1,output:5,cache_write_5m:1.25,cache_write_1h:2,cache_read:.1},"claude-opus-4-20250514":{name:`Claude Opus 4`,input:15,output:75,cache_write_5m:18.75,cache_write_1h:30,cache_read:1.5},"claude-opus-4-1":{name:`Claude Opus 4.1`,input:15,output:75,cache_write_5m:18.75,cache_write_1h:30,cache_read:1.5},"claude-opus-4-1-20250805":{name:`Claude Opus 4.1`,input:15,output:75,cache_write_5m:18.75,cache_write_1h:30,cache_read:1.5},"claude-sonnet-4-20250514":{name:`Claude Sonnet 4`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3},"claude-4-opus-20250514":{name:`Claude 4 Opus`,input:15,output:75,cache_write_5m:18.75,cache_write_1h:30,cache_read:1.5},"claude-4-sonnet-20250514":{name:`Claude 4 Sonnet`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3},"claude-sonnet-4-5":{name:`Claude Sonnet 4.5`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3},"claude-sonnet-4-5-20250929":{name:`Claude Sonnet 4.5`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3},"claude-opus-4-5":{name:`Claude Opus 4.5`,input:5,output:25,cache_write_5m:6.25,cache_write_1h:10,cache_read:.5},"claude-opus-4-5-20251101":{name:`Claude Opus 4.5`,input:5,output:25,cache_write_5m:6.25,cache_write_1h:10,cache_read:.5},"claude-opus-4-6":{name:`Claude Opus 4.6`,input:5,output:25,cache_write_5m:6.25,cache_write_1h:10,cache_read:.5},"claude-opus-4-6-20260205":{name:`Claude Opus 4.6`,input:5,output:25,cache_write_5m:6.25,cache_write_1h:10,cache_read:.5},"claude-sonnet-4-6":{name:`Claude Sonnet 4.6`,input:3,output:15,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3}};var Zj=class{static executionCache=null;static modelPricingCache=new Map;static GITHUB_PRICING_URL=`https://raw.githubusercontent.com/promptctl/cc-candybar/main/pricing.json`;static async loadDiskCache(){let e=Date.now()-1440*60*1e3;return await Yj.getUsageCache(`pricing`,e)}static async saveDiskCache(e){await Yj.setUsageCache(`pricing`,e)}static async fetchPricingData(){return new Promise(e=>{let t=new E(this.GITHUB_PRICING_URL),n=ae({hostname:t.hostname,path:t.pathname,headers:{"User-Agent":`cc-candybar`,"Cache-Control":`no-cache`},timeout:5e3},t=>{if(t.statusCode!==200){k(`HTTP ${t.statusCode}: ${t.statusMessage}`),e(null);return}let r=``,i=0;t.on(`data`,t=>{if(i+=t.length,i>1048576){k(`Response too large`),n.destroy(),e(null);return}r+=t}),t.on(`end`,()=>{try{let t=JSON.parse(r),n=t._meta,i={};for(let[e,n]of Object.entries(t))e!==`_meta`&&(i[e]=n);this.validatePricingData(i)?(k(`Fetched fresh pricing from GitHub for ${Object.keys(i).length} models`),k(`Pricing last updated: ${n?.updated||`unknown`}`),e(i)):(k(`Invalid pricing data structure`),e(null))}catch(t){k(`Failed to parse JSON:`,t),e(null)}}),t.on(`error`,t=>{k(`Response error:`,t),e(null)})});n.on(`error`,t=>{k(`Request error:`,t),e(null)}),n.on(`timeout`,()=>{k(`Request timeout`),n.destroy(),e(null)}),n.end()})}static async getCurrentPricing(){if(this.executionCache!==null)return k(`[CACHE-HIT] Pricing execution cache: ${Object.keys(this.executionCache).length} models`),this.executionCache;let e=await this.loadDiskCache();if(e)return k(`[CACHE-HIT] Pricing disk cache: ${Object.keys(e).length} models`),this.executionCache=e,k(`[CACHE-SET] Pricing execution cache stored: ${Object.keys(e).length} models`),e;let t=await this.fetchPricingData();return t?(await this.saveDiskCache(t),k(`[CACHE-SET] Pricing disk cache stored: ${Object.keys(t).length} models`),this.executionCache=t,k(`[CACHE-SET] Pricing execution cache stored: ${Object.keys(t).length} models`),t):(k(`[CACHE-FALLBACK] Using offline pricing data: ${Object.keys(Xj).length} models`),this.executionCache=Xj,k(`[CACHE-SET] Pricing execution cache stored: ${Object.keys(Xj).length} models`),Xj)}static validatePricingData(e){if(!e||typeof e!=`object`)return!1;for(let[,t]of Object.entries(e)){if(!t||typeof t!=`object`)return!1;let e=t;if(typeof e.input!=`number`||typeof e.output!=`number`||typeof e.cache_read!=`number`)return!1}return!0}static async getModelPricing(e){if(this.modelPricingCache.has(e))return k(`[CACHE-HIT] Model pricing cache: ${e}`),this.modelPricingCache.get(e);let t=await this.getCurrentPricing(),n;return n=t[e]?t[e]:this.fuzzyMatchModel(e,t),this.modelPricingCache.set(e,n),k(`[CACHE-SET] Model pricing cache: ${e}`),n}static fuzzyMatchModel(e,t){let n=e.toLowerCase();for(let[e,r]of Object.entries(t))if(e.toLowerCase()===n)return r;for(let{pattern:e,fallback:r}of[{pattern:[`opus-4-6`,`claude-opus-4-6`],fallback:`claude-opus-4-6-20260205`},{pattern:[`opus-4-5`,`claude-opus-4-5`],fallback:`claude-opus-4-5-20251101`},{pattern:[`opus-4-1`,`claude-opus-4-1`],fallback:`claude-opus-4-1-20250805`},{pattern:[`opus-4`,`claude-opus-4`],fallback:`claude-opus-4-20250514`},{pattern:[`sonnet-4-6`,`sonnet-4.6`,`claude-sonnet-4-6`],fallback:`claude-sonnet-4-6`},{pattern:[`sonnet-4.5`,`4-5-sonnet`,`sonnet-4-5`],fallback:`claude-sonnet-4-5-20250929`},{pattern:[`sonnet-4`,`claude-sonnet-4`],fallback:`claude-sonnet-4-20250514`},{pattern:[`haiku-4.5`,`4-5-haiku`,`haiku-4-5`],fallback:`claude-haiku-4-5-20251001`},{pattern:[`haiku`],fallback:`claude-haiku-4-5-20251001`},{pattern:[`opus`],fallback:`claude-opus-4-20250514`},{pattern:[`sonnet`],fallback:`claude-sonnet-4-5-20250929`}])if(e.some(e=>n.includes(e))&&t[r])return t[r];return t[`claude-sonnet-4-5-20250929`]||{name:`${e} (Unknown Model)`,input:3,cache_write_5m:3.75,cache_write_1h:6,cache_read:.3,output:15}}static async calculateCostForEntry(e){let t=e.message?.usage;if(!t)return 0;let n=this.extractModelId(e),r=await this.getModelPricing(n),i=t.input_tokens||0,a=t.output_tokens||0,o=t.cache_creation_input_tokens||0,s=t.cache_read_input_tokens||0,c=i/1e6*r.input,l=a/1e6*r.output,u=s/1e6*r.cache_read,d=o/1e6*r.cache_write_5m;return c+l+d+u}static extractModelId(e){if(e.model&&typeof e.model==`string`)return e.model;let t=e.message;if(t?.model){let e=t.model;if(typeof e==`string`)return e;let n=e;return(typeof n?.id==`string`?n.id:null)||`claude-sonnet-4-5-20250929`}return e.model_id&&typeof e.model_id==`string`?e.model_id:`claude-sonnet-4-5-20250929`}};const Qj=/<command-name>\s*([^<\s][^<]*?)\s*<\/command-name>/;function $j(e){if(typeof e==`string`)return Qj.exec(e)?.[1]}function eM(e){let t=e?.todos;if(!Array.isArray(t))return;let n=[];for(let e of t){if(typeof e!=`object`||!e)continue;let{content:t,activeForm:r,status:i}=e,a=i===`in_progress`,o=a&&typeof r==`string`?r:t;typeof o==`string`&&n.push({text:o,active:a,done:i===`completed`})}return n}function tM(e){let t=e.message?.content,n=e.type===`user`,r=[],i=[],a,o;if(typeof t==`string`)o=t;else if(Array.isArray(t))for(let e of t){if(typeof e!=`object`||!e)continue;let t=e;switch(t.type){case`tool_use`:{let{id:e,name:n}=t;if(typeof e!=`string`||typeof n!=`string`)break;r.push({id:e,name:n}),n===`TodoWrite`&&(a=eM(t.input)??a);break}case`tool_result`:{let e=t.tool_use_id;typeof e==`string`&&i.push(e);break}case`text`:o??=t.text;break;default:break}}let s=n?$j(o):void 0;if(!(r.length===0&&i.length===0&&a===void 0&&s===void 0))return{...r.length>0&&{started:r},...i.length>0&&{finished:i},...a!==void 0&&{todos:a},...s!==void 0&&{command:s}}}function nM(e){if(e!==void 0)return[e];let t=h();return[f(t,`.config`,`claude`),f(t,`.claude`)].filter(e=>a(e))}async function rM(e){let t=[];for(let n of e){let e=f(n,`projects`);if(a(e))try{let n=await tA(e,{withFileTypes:!0});for(let r of n)if(r.isDirectory()){let n=f(e,r.name);t.push(n)}}catch(t){k(`Failed to read projects directory ${e}:`,t)}}return t}async function iM(e,t,n){let r=[],i=f(t,e,`subagents`);try{let t=(await tA(i)).filter(e=>e.startsWith(`agent-`)&&e.endsWith(`.jsonl`));for(let a of t){let t=f(i,a);if(n?.has(t)){r.push(t);continue}try{let n=(await nA(t,`utf-8`)).split(`
189
+ `)[0];n&&JSON.parse(n).sessionId===e&&r.push(t)}catch{k(`Failed to check agent file ${t}`)}}}catch(e){k(`Failed to read subagents directory ${i}:`,e)}return r}function aM(e){let t=e.type||e.message?.role||e.message?.type,n=e.type===`user`&&e.message?.firstContentType===`tool_result`;return t===`user`&&!n}const oM=new Map;async function sM(e){try{let t=await rA(e),n=t.size,r=oM.get(e);if(r&&r.mtime===t.mtimeMs&&r.size===n)return k(`[parse-cache] hit ${e}`),oM.delete(e),oM.set(e,r),r.entries;let i;return n>1048576?(k(`Using streaming parser for large file ${e} (${Math.round(n/1024)}KB)`),i=await fM(e)):i=await uM(e),k(`Parsed ${i.length} entries from ${e}`),n>5242880?i:(oM.delete(e),oM.size>=16&&oM.delete(oM.keys().next().value),oM.set(e,{mtime:t.mtimeMs,size:n,entries:i}),i)}catch(t){if(t.code===`ENOENT`)return k(`Transcript not present yet: ${e}`),[];throw t}}function cM(e){if(!e.timestamp)return null;let t=e.message,n=t?.usage,r=t?.content,i=Array.isArray(r)&&typeof r[0]==`object`&&r[0]?r[0]:void 0;return{timestamp:new Date(e.timestamp),type:typeof e.type==`string`?e.type:void 0,message:t?{id:typeof t.id==`string`?t.id:void 0,model:typeof t.model==`string`?t.model:void 0,usage:n,role:typeof t.role==`string`?t.role:void 0,type:typeof t.type==`string`?t.type:void 0,firstContentType:typeof i?.type==`string`?i.type:void 0}:void 0,costUSD:typeof e.costUSD==`number`?e.costUSD:void 0,isSidechain:e.isSidechain===!0,activity:tM(e),raw:{model:typeof e.model==`string`?e.model:void 0,message:t?{id:typeof t.id==`string`?t.id:void 0,model:typeof t.model==`string`?t.model:void 0,usage:n}:void 0,requestId:typeof e.requestId==`string`?e.requestId:void 0}}}function lM(e){let t=[];for(let n of e.split(`
190
+ `))if(n.trim())try{let e=cM(JSON.parse(n));e&&t.push(e)}catch(e){k(`Failed to parse JSONL line: ${e}`);continue}return t}async function uM(e){return lM(await nA(e,`utf-8`))}async function dM(e,t){let n=await iA(e,t===void 0?void 0:{offset:t.offset,ino:t.ino});if(n.kind!==`ok`)return n;let{buf:r,start:i,mtimeMs:a,ino:o,reset:s}=n.value,c=r.lastIndexOf(10);return J(c<0?{entries:[],cursor:{offset:i,mtimeMs:a,ino:o},reset:s}:{entries:lM(r.subarray(0,c+1).toString(`utf-8`)),cursor:{offset:i+c+1,mtimeMs:a,ino:o},reset:s})}async function fM(e){return new Promise((t,n)=>{let r=[],a=i(e,{encoding:`utf8`}),o=se({input:a,crlfDelay:1/0});o.on(`line`,e=>{let t=e.trim();if(t)try{let e=cM(JSON.parse(t));e&&r.push(e)}catch(e){k(`Failed to parse JSONL line: ${e}`)}}),o.on(`close`,()=>{t(r)}),o.on(`error`,t=>{k(`Streaming parser error for ${e}:`,t),n(t)}),a.on(`error`,t=>{k(`File stream error for ${e}:`,t),n(t)})})}var pM=class{inflight=new Map;run(e,t){return this.inflight.get(e)??this.start(e,t)}start(e,t){let n=t();this.inflight.set(e,n);let r=()=>{this.inflight.get(e)===n&&this.inflight.delete(e)};return n.then(r,r),n}get size(){return this.inflight.size}};function mM(e,t){let n=e?e.input+e.cacheCreation+e.cacheRead:0,r=e?e.output:0;return{input:n,output:r,total:n+r,atMs:t}}const hM=new Map,gM={cost:0,input:0,output:0,cacheCreation:0,cacheRead:0},_M={cost:null,calculatedCost:null,officialCost:null,tokens:null,tokenBreakdown:null};function vM(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function yM(){let e=new Date;return e.setHours(0,0,0,0),e.setDate(e.getDate()-1),e.getTime()}function bM(){return{input:0,output:0,cacheCreation:0,cacheRead:0}}async function xM(e,t,n,r){let i=vM(new Date(yM())),a=e&&!t?e:void 0,o=a?.entries??0,s=a?.cost??0,c=a?{...a.breakdown}:bM(),l=new Map;if(a)for(let[e,t]of a.days)e>=i&&l.set(e,{...t});for(let e of n){let t=e.message?.usage;if(!t)continue;o++;let n=e.costUSD??await Zj.calculateCostForEntry(e.raw);s+=n,c.input+=t.input_tokens||0,c.output+=t.output_tokens||0,c.cacheCreation+=t.cache_creation_input_tokens||0,c.cacheRead+=t.cache_read_input_tokens||0;let r=vM(new Date(e.timestamp));if(r<i)continue;let a=l.get(r)??{...gM};a.cost+=n,a.input+=t.input_tokens||0,a.output+=t.output_tokens||0,a.cacheCreation+=t.cache_creation_input_tokens||0,a.cacheRead+=t.cache_read_input_tokens||0,l.set(r,a)}return{cursor:r,entries:o,cost:s,breakdown:c,days:l}}function SM(e){let t=0,n=0,r=bM(),i=new Map;for(let a of e.values()){t+=a.entries,n+=a.cost,r.input+=a.breakdown.input,r.output+=a.breakdown.output,r.cacheCreation+=a.breakdown.cacheCreation,r.cacheRead+=a.breakdown.cacheRead;for(let[e,t]of a.days){let n=i.get(e)??{...gM};n.cost+=t.cost,n.input+=t.input,n.output+=t.output,n.cacheCreation+=t.cacheCreation,n.cacheRead+=t.cacheRead,i.set(e,n)}}if(t===0)return{sessionInfo:_M,days:i};let a=r.input+r.output+r.cacheCreation+r.cacheRead;return{sessionInfo:{cost:n,calculatedCost:n,officialCost:null,tokens:a,tokenBreakdown:r},days:i}}async function CM(e,t,n){let r=0,i=async()=>{for(;r<e.length;){let t=e[r++];await n(t)}},a=Math.min(t,e.length);await Promise.all(Array.from({length:a},i))}var wM=class{entries=new Map;flight=new pM;seeded=new Map;seededDay=``;speedRings=new Map;speedFlight=new pM;maxEntries;staleAgeMs;hits=0;misses=0;sweeps=0;seeds=0;sweepTimer=null;constructor(e={}){this.maxEntries=e.maxEntries??256,this.staleAgeMs=e.staleAgeMs??864e5;let t=e.sweepIntervalMs??3e5;t>0&&(this.sweepTimer=setInterval(()=>this.sweepStale(),t),this.sweepTimer.unref())}getStats(){return{size:this.entries.size,hits:this.hits,misses:this.misses,sweeps:this.sweeps,seeds:this.seeds}}async getUsageInfo(e,t){let n=await this.ingest(e,t?.transcript_path);if(n.kind===`failed`)return n;let r=n.kind===`ok`?n.value.sessionInfo:_M,i=t?.cost?.total_cost_usd??null;return J({session:{...r,cost:i??r.cost,officialCost:i}})}async getTodayInfo(e,t){let n=vM(new Date),r=nM(t);try{await this.ensureSeeded(n,r)}catch(e){return X(`usage seed: ${e instanceof Error?e.message:String(e)}`)}let i=await this.ingest(e?.session_id??``,e?.transcript_path);if(i.kind===`failed`)return i;let a=r.map(e=>f(e,`projects`)+p),o={...gM},s=!1;for(let[t,r]of this.entries){let i=r.transcriptPath??``,c=t===e?.session_id||a.some(e=>i.startsWith(e))?r.days:hM;s||=c.has(n);let l=c.get(n)??gM;o.cost+=l.cost,o.input+=l.input,o.output+=l.output,o.cacheCreation+=l.cacheCreation,o.cacheRead+=l.cacheRead}return s?J({cost:o.cost,tokens:o.input+o.output+o.cacheCreation+o.cacheRead,tokenBreakdown:{input:o.input,output:o.output,cacheCreation:o.cacheCreation,cacheRead:o.cacheRead},date:n}):Y}async observeSpeed(e,t,n){let r=Qk(t);return this.speedFlight.run(`${e}:${r}`,async()=>{let i=await this.ingest(e,t,r);if(i.kind===`failed`)return i;let a=mM(i.kind===`ok`?i.value.sessionInfo.tokenBreakdown:null,n),o=this.speedRings.get(e)??[],s;for(let e of o)e.atMs<a.atMs&&(s===void 0||e.atMs>s.atMs)&&(s=e);return o.push(a),o.sort((e,t)=>e.atMs-t.atMs),o.length>64&&o.shift(),this.speedRings.set(e,o),J({...s!==void 0&&{prev:s},cur:a,samples:[...o]})})}async ingest(e,t,n){if(!e)return Y;let r=n??Qk(t),i=this.entries.get(e);if(i&&r!==0&&i.transcriptMtime===r)return i.lastSeenAt=Date.now(),this.entries.delete(e),this.entries.set(e,i),this.hits++,J(i);if(!t)return i?J(i):Y;this.misses++;let a;try{a=await this.flight.run(`${e}:${r}`,()=>this.refold(e,t,this.entries.get(e)))}catch(t){return X(`usage refold (${e}): ${t instanceof Error?t.message:String(t)}`)}if(a.kind!==`ok`)return a;let o={files:a.value.files,sessionInfo:a.value.sessionInfo,days:a.value.days,transcriptMtime:a.value.mainMtime,transcriptPath:t,lastSeenAt:Date.now()};return this.entries.delete(e),this.entries.set(e,o),this.evictIfNeeded(),J(o)}async refold(e,t,n){let r=await iM(e,u(t),n===void 0?void 0:new Set(n.files.keys())),i=new Map,a=0;for(let e of[t,...r]){let r=n?.files.get(e),o=await dM(e,r?.cursor);if(o.kind===`failed`)return o;if(o.kind===`absent`){r&&i.set(e,r);continue}let{entries:s,cursor:c,reset:l}=o.value;i.set(e,await xM(r,l,s,c)),e===t&&(a=c.mtimeMs)}return J({files:i,...SM(i),mainMtime:a})}ensureSeeded(e,t){this.seededDay!==e&&(this.seeded.clear(),this.seededDay=e);let n=t.join(`\0`),r=this.seeded.get(n);if(r)return r;let i=this.seed(t);return this.seeded.set(n,i),i.catch(()=>{this.seeded.get(n)===i&&this.seeded.delete(n)}),i}async seed(e){let t=yM(),n=await rM(e),r=[];for(let e of n){let n;try{n=await tA(e)}catch{continue}for(let i of n){if(!i.endsWith(`.jsonl`))continue;let n=f(e,i),a;try{a=(await rA(n)).mtimeMs}catch{continue}a<t||r.push({sessionId:i.slice(0,-6),path:n,mtime:a})}}await CM(r,8,async e=>{let t=await this.ingest(e.sessionId,e.path,e.mtime);t.kind===`failed`&&Q(`warn`,`usageStore seed: ${t.reason}`)}),this.seeds++,Q(`info`,`usageStore seed sessions=${r.length} dirs=${e.join(`,`)}`)}sweepStale(){let e=Date.now(),t=0;for(let[n,r]of this.entries)e-r.lastSeenAt>this.staleAgeMs&&(this.entries.delete(n),this.speedRings.delete(n),t++);return t>0&&(this.sweeps++,Q(`info`,`usageStore sweep dropped=${t}`)),t}evictIfNeeded(){for(;this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e),this.speedRings.delete(e),Q(`info`,`usageStore evict ${e}`)}}close(){this.sweepTimer&&=(clearInterval(this.sweepTimer),null),this.entries.clear(),this.seeded.clear(),this.speedRings.clear()}};function TM(e,t){return e===void 0?!0:e.evaluate(t).map(e=>e.plain).join(``)!==`false`}function EM(e,t){let n=U.fromFragments(e);return n.end=``,n.overflow=`ignore`,t!==void 0&&!t.isNull&&(n.style=t),n}function DM(e,t,n){e.cellLength>t?e.truncate(t,{mode:n.truncate,marker:`…`}):e.cellLength<t&&e.align(n.justify,t)}function OM({lead:e,text:t,trail:n}){return[...e===void 0?[]:[e],t,...n===void 0?[]:[n]]}function kM(e){let t=OM(e);if(t.length===1)return e.text;let n=EM(t);return n.style=e.text.style,n}function AM(e,t){let{width:n,justify:r,truncate:i,baseStyle:a,padding:o,lead:s=[],trail:c=[]}=t;if(e.length===0)return[];let l=EM(e,a).pad(o),u=new U(` `.repeat(o)),d={...s.length>0&&{lead:EM([u,...s],a)},...c.length>0&&{trail:EM([...c,u],a)}};if(n===`auto`)return[{text:l,...d}];let f={justify:r,truncate:i};return n===`fill`?[{text:l,fill:f,...d}]:(DM(l,n,f),[{text:l,...d}])}const jM=RegExp(`\\x1b\\[[0-9;]*m|${yi.source}`,`g`);function MM(e){return N(e.replace(jM,``))}function NM(e,t){let n=e.map(kM),r=[];if(e.forEach(({fill:e},t)=>{e!==void 0&&r.push({at:t,how:e})}),r.length===0||!Number.isFinite(t.width))return n;let i=KO(n,t).split(`
191
+ `);if(i.length>1)return n;let a=Math.max(0,t.width-MM(i[0]??``)),o=Math.floor(a/r.length),s=a-o*r.length;return r.forEach(({at:t,how:i},a)=>{let c=o+(a===r.length-1?s:0),{text:l}=e[t];DM(l,l.cellLength+c,i),n[t]=kM(e[t])}),n}function PM(e,t){let n=[],r=[],i=()=>{if(!r.length)return;let e=FM(r,t);e.plain.length>0&&n.push(e),r=[]};for(let a of e)if(LM(a.style).link){i();let e=FM([a],t);e.plain.length>0&&n.push(e)}else r.push(a);return i(),n}function FM(e,t){let n=t!==void 0&&!t.isNull?e.map(e=>IM(e,t)):e,r=U.fromFragments(n);return r.end=``,r.overflow=`ignore`,n.length===1?r.style=n[0].style:t!==void 0&&!t.isNull&&(r.style=t),r}function IM(e,t){let n=e.copy();return n.style=t.add(LM(e.style)),n}function LM(e){return e instanceof V?e:V.parse(e)}function RM(e,t,n,r){let i=new Map,a=Object.entries(t);for(let[t,o]of[...a.filter(([,e])=>!(`do`in e)),...a.filter(([,e])=>`do`in e)])i.set(t,zM(e,t,o,n,r,i));return i}function zM(e,t,n,r,i,a){if(`set`in n){let e=r.get(n.set)??n.set;if(`to`in n)return{kind:`set-literal`,key:n.set,value:n.to,stateVar:e};if(`from`in n){let t=$b(n.from,i);return{kind:`set-option`,key:n.set,stateVar:e,options:[...t.members],paletteOf:t.paletteOf,library:t.library}}return`int`in n?{kind:`set-int`,key:n.set,stateVar:e}:`cycle`in n?{kind:`set-cycle`,key:n.set,stateVar:e,members:n.cycle}:{kind:`set-bounded`,key:n.set,by:n.by}}if(`persist`in n){let e=jb.get(n.persist)??n.persist;if(`to`in n)return{kind:`persist-literal`,key:n.persist,value:n.to,stateVar:e};if(`from`in n){let t=$b(n.from,i);return{kind:`persist-option`,key:n.persist,stateVar:e,options:[...t.members],paletteOf:t.paletteOf,library:t.library}}if(`cycle`in n)return{kind:`persist-cycle`,key:n.persist,stateVar:e,members:n.cycle};if(`removeSegment`in n)return{kind:`layout-op`,key:n.persist,op:{op:`remove`,target:n.removeSegment}};if(`insertSegment`in n)return{kind:`layout-op`,key:n.persist,op:{op:`insert`,segment:n.insertSegment,anchor:n.anchor,relation:n.relation}};if(`insertSegmentFrom`in n){let e=$b(n.insertSegmentFrom,i);return{kind:`layout-op-option`,key:n.persist,anchor:n.anchor,relation:n.relation,options:[...e.members],paletteOf:e.paletteOf,library:e.library}}return{kind:`persist-bounded`,key:n.persist,by:n.by}}if(`copy`in n)return{kind:`copy`,text:VM(e,n.copy,t)};if(`open`in n)return{kind:`open`,target:VM(e,n.open,t)};if(`reset`in n)return{kind:`reset`,key:n.reset};if(`doctor`in n)return n.doctor===`run`?{kind:`doctor-run`}:{kind:`doctor-fix`,check:n.check};if(`ceiling`in n)return{kind:`ceiling`,args:GC(n)};if(`slash`in n)return{kind:`slash`,line:n.slash};if(`undo`in n)return{kind:`undo`};if(`redo`in n)return{kind:`redo`};if(`back`in n)return{kind:`back`};if(`rewind`in n)return{kind:`rewind`};if(`save`in n)return{kind:`save`};if(`preset`in n)return n.preset===`save`?{kind:`preset-save`}:{kind:`preset-delete`,name:VM(e,n.name,t)};let[o,...s]=n.do.map(e=>{let n=a.get(e);if(n===void 0)throw Error(`action "${t}" fires "${e}", which is not declared in this config`);return n});return{kind:`do`,head:o,rest:s}}function BM(e){return e.kind===`do`?BM(e.head):e}function VM(e,t,n){try{return e(t)}catch(e){throw Error(`Template parse error in actions.${n}: ${e.message}`,{cause:e})}}function HM(e,t){return e.has(t)?Dv(e.read(t)):``}function UM(e,t){return e.evaluate(t).map(e=>e.plain).join(``)}function WM(e,t,n,r){let i=new U(e,{style:V.combine([r,new V({link:t,bold:n})])});return i.overflow=`ignore`,i.end=``,i}function GM(e,t){return Math.max(e.members.indexOf(HM(t,e.stateVar)),0)}function KM(e,t,n,r,i){switch(e.kind){case`set-literal`:{let t=HM(r,e.stateVar);return{effects:[{verb:HE,args:[i,e.key,e.value]}],active:t===e.value}}case`set-option`:{let a=n??t,o=HM(r,e.stateVar);return{effects:[{verb:HE,args:[i,e.key,a]}],active:o===a}}case`set-int`:{let a=n??t,o=HM(r,e.stateVar);return{effects:[{verb:HE,args:[i,e.key,a]}],active:o===a}}case`set-cycle`:{let t=e.members[(GM(e,r)+1)%e.members.length];return{effects:[{verb:HE,args:[i,e.key,t]}],active:!1}}case`set-bounded`:return{effects:[{verb:UE,args:[i,e.key,String(e.by)]}],active:!1};case`copy`:return{effects:[{verb:WE,args:[UM(e.text,yy(r))]}],active:!1};case`open`:return{effects:[{verb:GE,args:[UM(e.target,yy(r))]}],active:!1};case`persist-literal`:{let t=HM(r,e.stateVar);return{effects:[{verb:YE,args:[i,e.key,e.value]}],active:t===e.value}}case`persist-option`:{let a=n??t,o=HM(r,e.stateVar);return{effects:[{verb:YE,args:[i,e.key,a]}],active:o===a}}case`persist-cycle`:{let t=e.members[(GM(e,r)+1)%e.members.length];return{effects:[{verb:YE,args:[i,e.key,t]}],active:!1}}case`persist-bounded`:return{effects:[{verb:XE,args:[i,e.key,String(e.by)]}],active:!1};case`reset`:return{effects:[{verb:eD,args:[i,e.key]}],active:!1};case`undo`:return{effects:[{verb:nD,args:[i]}],active:!1};case`redo`:return{effects:[{verb:rD,args:[i]}],active:!1};case`back`:return{effects:[{verb:iD,args:[i]}],active:!1};case`rewind`:return{effects:[{verb:aD,args:[i]}],active:!1};case`save`:return{effects:[{verb:ZE,args:[i]}],active:!1};case`preset-save`:return{effects:[{verb:QE,args:[i]}],active:!1};case`preset-delete`:return{effects:[{verb:$E,args:[i,UM(e.name,yy(r))]}],active:!1};case`doctor-run`:return{effects:[{verb:sD,args:[i]}],active:!1};case`doctor-fix`:return{effects:[{verb:cD,args:[i,e.check]}],active:!1};case`ceiling`:return{effects:[{verb:lD,args:[i,...e.args]}],active:!1};case`slash`:return{effects:[{verb:uD,args:[i,e.line]}],active:!1};case`layout-op`:return{effects:[{verb:tD,args:[i,e.key,mk(e.op)]}],active:!1};case`do`:{let a=KM(e.head,t,n,r,i);return{effects:[...a.effects,...e.rest.flatMap(e=>KM(e,t,void 0,r,i).effects)],active:a.active}}case`layout-op-option`:{let r={op:`insert`,segment:n??t,anchor:e.anchor,relation:e.relation};return{effects:[{verb:tD,args:[i,e.key,mk(r)]}],active:!1}}}}function qM(e,t,n,r){if(n.length===0)throw Error(`action "${e}" needs a display (the clickable text)`);if(t.kind===`set-cycle`||t.kind===`persist-cycle`)return{display:Wc(`action "${e}"`,n,t.members.length,GM(t,r)),boundValue:void 0};if(n.length>2)throw Error(`action "${e}" takes a display and an optional bound value, got ${n.length} arguments (per-state displays are a cycle action's form)`);return{display:n[0],boundValue:n[1]}}function JM(e,t,n){let r=n.compiled.get(e);if(!r)throw Error(`action "${e}" is not declared in this config`);let i=n.store,{display:a,boundValue:o}=qM(e,BM(r),t,i),{effects:s,active:c}=KM(r,a,o,i,HM(i,`session.id`));return WM(a,pD(s),c)}function YM(e){return{action:{fn:(t,...n)=>JM(t,n,e),argTypes:[`string`,`string`],arity:{kind:`variadic`},returnType:`T`}}}function XM(e,t){return WM(`✕`,pD([{verb:HE,args:[HM(e,`session.id`),t,Vc]}]),!1)}function ZM(e,t,n){return new V({bgcolor:_n.fromRgba(t),color:_n.fromRgba(Da(e,t,n))})}function QM(e,t,n){return new V({color:_n.fromRgba(or(_a(e,`warning`),t,Ea,n))})}function $M(e,t,n){return V.combine([ZM(e,t,n),QM(e,t,n)])}function eN(e,t,n){return ZM(e.palette,Ba(e.palette,e.disclosure,[t],n),n)}function tN(e,t,n,r,i){return r===void 0?n=>eN(e,{...n,distribution:t},i):(e,t)=>nN(r(t,n),i)}function nN(e,t){let n=_a(e,`background`);return new V({bgcolor:_n.fromRgba(n),color:_n.fromRgba(or(_a(e,`primary`),n,4.5,t))})}function rN(e,t,n){let r=t.map(t=>({label:t.label,indices:e.flatMap((e,n)=>e.group===t.id?[n]:[])})).filter(e=>e.indices.length>0);if(r.reduce((e,t)=>e+t.indices.length,0)!==e.length){let n=new Set(t.map(e=>e.id)),r=e.flatMap((e,t)=>n.has(e.group)?[]:[`#${t} (group "${e.group}")`]);throw Error(`library: ${r.join(`, `)} name a group the domain does not list (${[...n].join(`, `)})`)}return n?r.flatMap(e=>iN(e.indices,8).map(t=>[{label:e.label,indices:t}])):[r]}function iN(e,t){return Array.from({length:Math.ceil(e.length/t)},(n,r)=>e.slice(r*t,(r+1)*t))}function aN(e,t){return new U(e).truncate(t,{marker:`…`}).plain}function oN(e){return{current:null,drawnAt:e}}function sN(e,t,n,r,i,a){let o={segName:t,placementId:n,palette:r,disclosure:i,tint:a,bg:void 0,drops:[]};return e.current=o,o}function cN(e,t){let n=e.current;if(n===null)throw Error(`${t} is only available inside a segment's templates — there is no active segment here. Segment-scoped functions cannot be used in variable declarations or layout-node "when" predicates, which are evaluated outside any segment.`);return n}function lN(e){return new U(e).cellLength}function uN(e){return Math.max(1,e.width-e.chromeCols-2*e.padding)}function dN(e){return Math.max(1,uN(e)-(lN(`✕`)+2*e.padding+e.seamCols))}function fN(e,t,n){if(!Number.isFinite(t))return e.length>0?[e.map((e,t)=>t)]:[];let r=Math.max(1,t-n),i=[],a=[],o=0;for(let t=0;t<e.length;t++){let n=e[t];a.length===0?(a=[t],o=n):o+1+n<=r?(a.push(t),o+=1+n):(i.push(a),a=[t],o=n)}return a.length>0&&i.push(a),i}function pN(e,t){let n=lN(`✕`)+1,r=lN(`←`)+1+lN(`→`)+1,i=fN(e,t,n);return(i.length>1?fN(e,t,n+r):i).map(e=>[{label:``,indices:e}])}function mN(e,t){let n=[];for(let t of e)n.length>0&&n.push(new U(` `)),n.push(t);let r=U.fromFragments(n);return r.overflow=t?`ignore`:void 0,r.end=``,r}function hN(e,t,n,r){let i=e.compiled.get(t);if(!i||i.kind!==n)throw Error(`picker references action "${t}" which must be ${r}, got ${i?`a ${i.kind} action`:`no such action`}`);return i}function gN(e,t,n){let r=e.compiled.get(t),i=r&&BM(r);if(!i||i.kind!==`set-option`&&i.kind!==`persist-option`&&i.kind!==`layout-op-option`)throw Error(`${n} references action "${t}" which must be a set-option, persist-option, or layout-op-option action ({ set, from }, { persist, from }, or { persist, insertSegmentFrom, anchor, relation }), got ${i?`a ${i.kind} action`:`no such action`}`);return i}function _N(e,t,n,r,i,a,o,s){let c=gN(a,e,`picker`),l=a.compiled.get(e),u=a.store,d=HM(u,`session.id`),f=`stateVar`in c?HM(u,c.stateVar):void 0,p=i?uN(a):1/0,m=c.library&&{groups:c.library.groups,entries:c.options.map(c.library.entry)},h=m===void 0?pN(c.options.map(lN),p):rN(m.entries,m.groups,i),g=parseInt(HM(u,t.stateVar),10),_=Number.isInteger(g)?Math.max(0,Math.min(g,h.length-1)):0,v=h[_]??[],y=e=>pD([{verb:HE,args:[d,t.key,String(e)]}]),b=n.flatMap(([e,t])=>[e,t]),x=pD([{verb:HE,args:[d,...b]}]),S=r?[{verb:HE,args:[d,...b]}]:[],C=e=>pD([...KM(l,e,e,u,d).effects,...S]),w=(e,t)=>{let n=c.options[e];return WM(t,C(n),n===f,o({index:e,count:c.options.length},n))},T=[WM(`✕`,x,!1,s)];_>0&&T.push(WM(`←`,y(_-1),!1));let ee=_<h.length-1?[WM(`→`,y(_+1),!1)]:[];if(m===void 0){let e=v.flatMap(e=>e.indices);return[mN([...T,...e.map(e=>w(e,c.options[e])),...ee],i)]}let te=new V({bold:!0}),E=h.length>1?` ${_+1}/${h.length}`:``,ne=v.length===1?[new U(`${v[0].label}${E}`,{style:te})]:[],D=[mN([...T,...ne,...ee],i)];for(let e of v){v.length>1&&D.push(mN([new U(e.label,{style:te})],i));let t=Math.max(...e.indices.map(e=>lN(c.options[e])));for(let n of e.indices){let e=c.options[n],r=m.entries[n].description,a=r===void 0?void 0:MO(r),o=` `.repeat(t-lN(e)+2),s=a===void 0?e:`${e}${o}${a}`;D.push(mN([w(n,aN(s,p))],i))}}return D}function vN(e,t){return{picker:{fn:(n,r,i,a,...o)=>{py(`picker "${n}"`,[`closeOnPick`,`paged`],o);let s=hN(e,r,`set-int`,`an int action ({ set, int: true })`),c=gN(e,n,`picker`);if(c.library!==void 0)throw Error(`{{ picker "${n}" … }} ranges a catalogue domain, which lays out as one row per member; a catalogue renders in a {{ menu }} body`);let l=cN(t,`{{ picker }}`);if(l.bg===void 0)throw Error(`{{ picker }} is not available while segments.${l.segName}'s own "bg:" is being evaluated — a picker is drawn on that background`);let[u]=_N(n,{key:s.key,stateVar:s.stateVar},[[s.key,`-1`]],i===!0,a===!0,e,tN(l,da(void 0),e,c.paletteOf,t.drawnAt()),QM(l.palette,l.bg,t.drawnAt()));return u},argTypes:[`string`,`string`,`bool`],arity:{kind:`variadic`},returnType:`T`}}}function yN(e,t,n,r,i){let a=Math.min(Math.floor((t-1)/2),i),o=n,s=0;for(;s<a;){let t=o+lN(e(-(s+1)))+1+lN(e(s+1))+1;if(t>r)break;o=t,s+=1}return s}function bN(e,t,n,r,i){if(!(`stateVar`in t))throw Error(`carousel references action "${e}", which inserts a segment and holds no current value to centre on — a carousel needs a { set, from } or { persist, from } action`);let a=n.store;if(!a.has(t.stateVar))throw Error(`carousel references action "${e}", whose key "${t.stateVar}" no variable reads back, so there is no current value to centre on — declare { kind: "state", key: "${t.stateVar}" } among the variables`);let o=n.compiled.get(e),s=HM(a,`session.id`),{options:c}=t,l=c.length,u=HM(a,t.stateVar),d=Math.max(c.indexOf(u),0),f=e=>((d+e)%l+l)%l,p=e=>c[f(e)],m=new Map,h=e=>{let t=m.get(e);if(t!==void 0)return t;let n=pD(KM(o,p(e),p(e),a,s).effects);return m.set(e,n),n},g=e=>WM(p(e),h(e),p(e)===u,r({index:f(e),count:l},p(e))),_=yN(p,l,lN(`◀`)+1+lN(p(0))+1+lN(`▶`),dN(n),i),v=e=>Array.from({length:_},(t,n)=>g(e*(n+1)));return mN([...v(-1).reverse(),WM(`◀`,h(-1),!1),g(0),WM(`▶`,h(1),!1),...v(1)],!0)}function xN(e,t){return{carousel:{fn:(n,r,...i)=>{if(py(`carousel "${n}"`,[`neighbours`],i),r!==void 0&&r<0)throw Error(`carousel "${n}": neighbours must be a whole number ≥ 0 (0 shows only ◀ CURRENT ▶), got ${String(r)}`);let a=r??1/0,o=gN(e,n,`carousel`);return bN(n,o,e,tN(cN(t,`{{ carousel }}`),da(void 0),e,o.paletteOf,t.drawnAt()),a)},argTypes:[`string`,`int`],arity:{kind:`variadic`},returnType:`T`}}}const SN=[`~/code`,`main`,`opus`,`42%`,`5m`,`$1.20`];function CN(e,t,n){let r=Na(e,{hue:ra,depth:0},n);return[aa(t).map((t,n)=>({text:SN[n%SN.length],colour:va(e,t)})),[{text:`▾ open`,colour:r.state},{text:`menu`,colour:r.plane}],[{text:`warn`,colour:_a(e,`warning`)},{text:`error`,colour:_a(e,`error`)}]]}function wN(e,t,n,r){let i=CN(e,t,n).flatMap((t,r)=>t.map(({text:t,colour:i},a)=>({gap:r>0&&a===0?` `:``,cell:new U(` ${t} `,{style:ZM(e,i,n)})}))),a=[],o=0;for(let{gap:e,cell:t}of i){if(o+=e.length+t.cellLength,o>r)break;e!==``&&a.push(new U(e)),a.push(t)}let s=U.fromFragments(a);return s.overflow=`ignore`,s.end=``,s}function TN(e,t){return{themePreview:{fn:()=>wN(e.palette,e.variation,t.drawnAt(),dN(e)),argTypes:[],arity:{kind:`exact`},returnType:`T`}}}const EN=e=>e.slice(e.lastIndexOf(`.`)+1),DN=(e,t)=>{let n=new U(EN(e));return n.truncate(t,{marker:`…`}),n.plain};function ON(e,t){let n=e.map(e=>e.map(({name:e})=>lN(EN(e)))),r=e=>n.every(n=>n.reduce((t,n)=>t+Math.min(n,e)+2,0)<=t),i=Math.max(1,...n.flat());for(;i>1&&!r(i);)--i;return i}function kN(e,t,n,r){let i=ON(e,r),a=e.map(e=>{let a=[],o=0;for(let{name:s,address:c,palette:l}of e){let e=new U(` ${DN(s,i)} `,{style:ZM(l,Wa(l,{kind:`bar`,variation:t,address:c},n).tint,n)});if(o+=e.cellLength,o>r)break;a.push(e)}return a}),o=U.fromFragments(a.flatMap((e,t)=>t===0?e:[new U(`
192
+ `),...e]));return o.overflow=`ignore`,o.end=``,o}function AN(e,t){return{layoutPreview:{fn:()=>kN(e.layout(),e.variation,t.drawnAt(),dN(e)),argTypes:[],arity:{kind:`exact`},returnType:`T`}}}function jN(e,t,n,r){let i=cN(r.activeSegment,`{{ menu }}`),a=r.action,o=m_(i.placementId,e,n.key),s=__(o),c=p_(e),l=HM(a.store,o)===c,u=HM(a.store,`session.id`),d=l?Vc:c,f=WM(Wc(`{{ menu "${e}" }}`,t,2,+!!l),pD([{verb:HE,args:[u,o,d,s,`0`]}]),!1);return i.drops.push(...l?_N(e,{key:s,stateVar:s},[[o,Vc],[s,`0`]],n.closeOnPick,n.paged,a,tN(i,n.distribution,a,gN(a,e,`menu`).paletteOf,r.activeSegment.drawnAt()),QM(i.palette,Na(i.palette,i.disclosure,r.activeSegment.drawnAt()).plane,r.activeSegment.drawnAt())):[]),f}const MN=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function NN(e,t){let n=t[t.length-1],r=MN(n)?n:void 0,i=r===void 0?t:t.slice(0,-1),a=i.findIndex(e=>typeof e!=`string`);if(a!==-1)throw Error(`{{ menu "${e}" }} display #${a+1} is not text (${JSON.stringify(i[a])}) — a menu binds its trigger text, then an optional trailing (dict …) of options`);return{displays:i,options:x_(r??{})}}function PN(e){return{menu:{fn:(t,...n)=>{let{displays:r,options:i}=NN(t,n);return jN(t,r,i,e)},argTypes:[`string`,`value`],arity:{kind:`variadic`},returnType:`T`}}}function FN(e){let{value:t,max:n,width:r,filled:i,empty:a,colourAt:o}=e,s=IN(t,n,r),c=[];for(let e=0;e<r;e++){let t=e<s,l=t&&o!==void 0?o(e*n/r):void 0;c.push(new U(t?i:a,{style:l===void 0?void 0:new V({color:l})}))}let l=U.fromFragments(c);return l.end=``,l.overflow=`ignore`,l}function IN(e,t,n){return!Number.isFinite(e)||!Number.isFinite(t)||t<=0?0:Math.min(n,Math.max(0,Math.round(e/t*n)))}function LN(e){let t={fn:(()=>{let t=cN(e,`{{ bgOf }}`);if(t.bg===void 0)throw Error(`{{ bgOf }} is not available while segments.${t.segName}'s own "bg:" is being evaluated — the background is what that template computes. Reach for a palette color there instead, e.g. bg: '{{ darken (color "surface") 1 }}'.`);return t.bg.hex}),argTypes:[],arity:{kind:`exact`},returnType:`string`},n={fn:(()=>cN(e,`{{ tint }}`).tint.hex),argTypes:[],arity:{kind:`exact`},returnType:`string`},r=$v(()=>cN(e,`{{ color }} / {{ ramp }} / {{ gauge }}`).palette),i={fn:((e,t,n,i,a,o,...s)=>{let c=o===void 0?void 0:[o,...RN(s)];return FN({value:e,max:t,width:n,filled:i,empty:a,colourAt:c===void 0?void 0:e=>String(r.ramp.fn(e,...c))})}),argTypes:[`float`,`float`,`int`,`string`,`string`,`string`],arity:{kind:`variadic`},returnType:`T`};return{...r,bgOf:t,tint:n,gauge:i}}function RN(e){return e.flatMap(e=>{let t=e.indexOf(`:`),n=t<0?NaN:Number(e.slice(0,t));if(!Number.isFinite(n))throw Error(`{{ gauge }} stop "${e}" must be "<position>:<colour>", e.g. "80:error" or "80:#ff0000"`);return[n,e.slice(t+1)]})}function zN(e){let t=[],n=[];for(let r of e){if(!r.contains(`
193
193
  `)){n.push(r);continue}let e=r.split(`
194
- `);n.push(e[0]);for(let r=1;r<e.length;r++)t.push(n),n=[e[r]]}return t.push(n),t}function FN(e,t){let n=t.flatMap(e=>e.filter(e=>e.place===`above`)),r=t.map(e=>e.filter(e=>e.place===`flow`));return[...n,...IN(e,r)]}function IN(e,t){switch(e){case`vertical`:return t.flatMap(e=>e);case`horizontal`:return t.reduce((e,t)=>Math.max(e,t.length),0)===0?[]:[{cells:t.flatMap(e=>e[0]?.cells??[]),band:`own`,place:`flow`},...t.flatMap(e=>e.slice(1))]}}function LN(e,t){let n=(e,r)=>t(e)?e.kind===`segment`?[{cells:[{name:e.name,address:r,settings:e.settings}],band:`own`,place:`flow`}]:FN(e.direction,e.children.map((t,i)=>n(t,[...r,RN(e,i)]))):[];return n(e,[]).map(e=>[...e.cells])}function RN(e,t){return{index:t,count:e.children.length,distribution:e.distribution,axis:Es[e.direction]}}const zN={compile(e,t){return{kind:`container`,direction:e.direction,when:t.when,distribution:pa(e.distribution),children:e.children.map((e,n)=>t.compileChild(e,Ms(t.path,n)))}},render(e,t){return FN(e.direction,e.children.map((n,r)=>t.renderChild(n,t.visible,RN(e,r))))}},BN={drop:e=>e.place,above:()=>`above`},VN={drop:(e,t)=>({lead:t(),stays:e}),above:e=>({lead:e.slice(0,1).flatMap(e=>e.cells),stays:e.slice(1)})},HN={compile(e,t){return{kind:`segment`,when:t.when,name:e.name,id:Ds(e),settings:t.placementSettings(e),...e.opens!==void 0&&{opens:{open:t.parse(Jc(e.opens.ref),`opens`),body:t.compileChild(e.opens.body,Ns(t.path)),key:e.opens.ref.key,placement:e.opens.placement}},...e.lead!==void 0&&{lead:t.parse(e.lead,`lead`)},...e.trail!==void 0&&{trail:t.parse(e.trail,`trail`)}}},render(e,t){let n=t.lookupSegment(e.name);if(!n)throw Error(`Layout segment "${e.name}" has no matching segment`);let{seg:r,compiled:i}=n;if(!t.visible)return[];let a=by(t.scope,e.settings);try{if(!bM(i.when,a))return[];let n=Rb(e.settings.theme,t.palette),o=e.opens!==void 0&&bM(e.opens.open,t.scope),{styles:s,fragments:c,lead:l,trail:u,drops:d,open:f}=t.evaluateSegment(e,a,n,t.region,{bg:i.bg,fg:i.fg,body:i.template,lead:e.lead,trail:e.trail},o),p=f?s.trigger:s.closed,m={width:r.width??`auto`,justify:r.justify??`left`,truncate:r.truncate??`right`,baseStyle:p,padding:t.padding},h=e.opens,g=h===void 0?[]:t.renderBody(h.body,o,s.disclosure).map(e=>({...e,place:BN[h.placement](e)})),_=PN(kM(c,p)).map((e,t)=>({cells:TM(e,{...m,lead:t===0?kM(l,p):[],trail:t===0?kM(u,p):[]}),band:`own`,place:`flow`})),v=d.map(e=>({cells:TM(kM([e],s.band),{...m,baseStyle:s.band}),band:`deeper`,place:`flow`})),y=(e,t,n)=>TM(kM([e],t),{...m,width:`auto`,baseStyle:t,padding:n}),b=g.findIndex(e=>e.band===`own`),{lead:x,stays:S}=h!==void 0&&b!==-1?VN[h.placement](_,()=>y(t.closeDisclosure(h.key),s.close,t.padding)):{lead:[],stays:_},C=x.flatMap(e=>y(new V(` `.repeat(CM(e).reduce((e,t)=>e+t.cellLength,0))),s.trigger,0)),w=(e,t)=>e.band===`own`?t===b?x:C:[],T=g.map((e,t)=>({cells:[...w(e,t),...e.cells],band:`deeper`,place:e.place})),ee=[...S,...v];return t.perSegmentSink!==void 0&&t.perSegmentSink.set(e.id,[...ee.flatMap(e=>e.cells),...g.flatMap(w)].flatMap(CM)),[...ee,...T]}catch(n){let r=n.message??String(n);t.onSegmentError?.(e.id,r);let i=r.replace(/\s*\n\s*/g,` `);return[{cells:TM([new V(`⚠ ${e.id}: ${i}`,{end:``})],{width:`auto`,justify:`left`,truncate:`right`,padding:0,lead:UN(e.lead,e,a,t),trail:UN(e.trail,e,a,t)}),band:`own`,place:`flow`}]}}};function UN(e,t,n,r){if(e===void 0)return[];try{return r.evaluateSegment(t,n,r.palette,r.region,{bg:void 0,fg:void 0,body:e,lead:void 0,trail:void 0},!1).fragments}catch(e){return r.onSegmentError?.(t.id,e.message??String(e)),[]}}const WN={container:zN,segment:HN};function GN(e){return WN[e]}function KN(e){if(`ttl`in e)return{kind:`ttl`,durationMs:sb(e.ttl)};if(`watch_file`in e)return{kind:`watch_file`,path:e.watch_file};if(`depends_on`in e)return{kind:`depends_on`,varNames:e.depends_on};if(`key`in e)return{kind:`key`,template:e.key};if(`never`in e)return{kind:`never`};throw Error(`Unknown CacheDecl discriminator — loader invariant violated: ${JSON.stringify(e)}`)}function qN(e,t){switch(Is(e)){case`json`:return{kind:`json`,default:t};case`regex`:return{kind:`regex`,regex:new RegExp(e.regex),default:t};case`text`:return{kind:`text`,default:t}}}function JN(e,t,n,r){switch(n.kind){case`literal`:e.declareLiteral(t,n.value);break;case`input`:e.declareInput(t,n.path,n.type??`string`,n.default);break;case`env`:e.declareEnv(t,n.name,n.default);break;case`file`:e.declareFile(t,n.path,{readMode:n.readMode,cache:KN(n.cache),parse:qN(n.parse,n.default)});break;case`shell`:e.declareShell(t,n.command,{cwd:r,cache:KN(n.cache),parse:qN(n.parse,n.default)});break;case`template`:e.declareTemplate(t,n.template,{varDefault:n.default});break;case`time`:e.declareTime(t,{format:n.layout,ttlMs:n.cache?sb(n.cache.ttl):void 0,varDefault:n.default});break;case`git`:e.declareGit(t,{field:n.field,cwd:r,varDefault:n.default});break;case`state`:e.declareState(t,{key:n.key,...n.default!==void 0&&{varDefault:n.default}});break}}function YN(e,t){let n=Gd.EMPTY;for(let[r,i]of Object.entries(t))try{n=e.parse(`{{ define "${r}" }}${i}{{ end }}`,n).defines()}catch(e){throw Error(`Template parse error in helpers.${r}: ${e.message}`,{cause:e})}return n}const XN=e=>bo(void 0,null,e.globals.variation);function ZN(e,t,n){let r=n.cwd,i=Gb(e.globals.palette),a={store:t.variableStore,compiled:new Map,chromeCols:RO({endcaps:`powerline`,charset:ho}),width:80,basePalette:i,palette:i,variation:ia[XN(e)],padding:1,seamCols:zO({endcaps:`powerline`,charset:ho}),layout:()=>[]},o=tN(t.drawnAt),s={action:a,activeSegment:o},c=Object.keys(e.styles),l=C_(e.presets),u=new Map([...Yb(e),...xC(e)]),d=_y({...WM(a),...pN(a,o),...gN(a,o),...bN(a,o),...TN(a,o),...kN(s),...MN(o),styles:{fn:()=>c,argTypes:[],arity:{kind:`exact`}},presets:{fn:()=>l,argTypes:[],arity:{kind:`exact`}}},n.clock,t.drawnAt),f=YN(d,e.helpers),p=e=>d.parse(e,f),m=new Map,h=e=>{let t=m.get(e);if(t!==void 0)return t;let n=p(e);return m.set(e,n),n},g=new Map;for(let[t,n]of jb)n in e.variables&&g.set(t,n);for(let[t,n]of Object.entries(e.variables))n.kind===`state`&&!g.has(n.key)&&g.set(n.key,t);for(let[t,n]of Object.entries(e.segments))if(n.vars)for(let[e,r]of Object.entries(n.vars))r.kind===`state`&&!g.has(r.key)&&g.set(r.key,`${t}.${e}`);a.compiled=NM(p,e.actions,g,u);let _=[];for(let[n,i]of Object.entries(e.variables))try{JN(t,n,i,r)}catch(e){_.push(`Variable "${n}": ${e.message??String(e)}`)}for(let[n,i]of Object.entries(e.segments))if(i.vars)for(let[e,a]of Object.entries(i.vars))try{JN(t,`${n}.${e}`,a,r)}catch(t){_.push(`Variable "${n}.${e}": ${t.message??String(t)}`)}let v=Object.create(null);for(let[t,n]of Object.entries(e.segments)){let e=(e,n,r=p)=>{try{return r(e)}catch(e){throw Error(`Template parse error in segments.${t}.${n}: ${e.message}`,{cause:e})}};v[t]={when:n.when===void 0?void 0:e(n.when,`when`,h),template:e(n.template,`template`),bg:n.bg===void 0?void 0:e(n.bg,`bg`),fg:n.fg===void 0?void 0:e(n.fg,`fg`)}}let y=(e,t,n)=>{try{return h(e)}catch(e){throw Error(`Template parse error in ${t}.${n}: ${e.message}`,{cause:e})}},b=t.variableStore,x=t=>{let n=Hs(e.segments[t.name]),r=Object.create(null);for(let[e,i]of Object.entries(n)){let n=t.settings?.[e]??i.default,a=t.drafts?.[e];Object.defineProperty(r,e,{enumerable:!0,get:a===void 0?()=>n:()=>qs(i,String(b.read(a.variable)))??n})}return Object.freeze(r)},S=(e,t)=>{let n={path:t,when:e.when===void 0?void 0:y(e.when,t,`when`),parse:(e,n)=>y(e,t,n),compileChild:S,placementSettings:x};return GN(e.kind).compile(e,n)},C=new Map;for(let t of l){let{node:n,path:r}=E_(e,t);C.set(t,S(n,r))}let w=new Map(no.map(e=>[e,new Map])),T=[[`globals`,e.globals],...Object.entries(e.presets).map(([e,t])=>[`presets.${e}.globals`,t.globals??{}])];for(let[e,t]of T)for(let n of no){let r=t[n];if(!ro(r))continue;let i=`${e}.${n}`,a=w.get(n),o=a.get(r);a.set(r,o===void 0?{where:i,template:QN(p,i,r)}:{where:`${o.where}, ${i}`,template:o.template})}return{segments:v,roots:C,activeSegment:o,menuRuntime:s,globalExpressions:w,loadWarnings:_}}function QN(e,t,n){try{return e(n)}catch(e){throw Error(`${t} is not a valid template: ${e instanceof Error?e.message:String(e)}`)}}function $N(e,t,n){let r=e.globalExpressions.get(t).get(n);if(r===void 0)throw Error(`the ${t} rule ${JSON.stringify(n)} reached the render but no compiled template exists — registerDslConfig and the resolution disagree about isExpression`);return r}function eP(e,t){return e.template.evaluate(t).map(e=>e.plain).join(``)}function tP(e,t){return e.kind===`decided`?e.name:t}function nP(e,t,n,r,i,a,o,s){let{perSegmentSink:c,onSegmentError:l,onRenderWarning:u}=o??{};r.drawAt(_o(a.colorCompatibility));let{preset:d=x_}=s??{},f=D_(e,d),p=ia[s?.variation??bo(void 0,null,f.variation)];t.menuRuntime.action.variation=p;let m=s?.style??co(`none`,e.styles),h=s?.theme??Ub(void 0,null,f.palette),g=(e,t)=>({...i,term:{cols:a.width},theme:{effective:e},style:{effective:t}});r.applyInput(g(tP(h,Ya),tP(m,oo))),t.menuRuntime.action.chromeCols=RO(a),t.menuRuntime.action.padding=a.padding,t.menuRuntime.action.width=a.width,t.menuRuntime.action.seamCols=zO(a);let _=vy(n),v=ao(h,e=>{let n=$N(t,`palette`,e);return Hb(eP(n,_),n.where,e=>u?.(e))}),y=ao(m,n=>co(eP($N(t,`style`,n),_),e.styles));(v!==h||y!==m)&&r.applyInput(g(v.name,y.name));let b=v.value;t.menuRuntime.action.basePalette=b;let x=Bb(b,y.value);t.menuRuntime.action.palette=x,c?.clear();let S=n=>{let r=e.segments[n],i=t.segments[n];return r!==void 0&&i!==void 0?{seg:r,compiled:i}:void 0},C=(e,n,i,a,o,s)=>{try{let c=r.drawnAt(),{tint:l,disclosure:u}=Ka(i,a,c),d=nN(t.activeSegment,e.name,e.id,i,u,l),f=px(d,c,o.bg,o.fg,n),p=()=>Fa(i,u,c).state;s&&(d.bg=p());let m=o.body.evaluate(n),h=d.drops.length>0||s;h&&(d.bg=p());let g=o.lead?.evaluate(n)??[],_=o.trail?.evaluate(n)??[];return{styles:{closed:f,get trigger(){return KM(i,p(),c)},get band(){return KM(i,Fa(i,u,c).plane,c)},get close(){return JM(i,p(),c)},disclosure:u},fragments:m,lead:g,trail:_,drops:d.drops,open:h}}finally{t.activeSegment.current=null}},w=(e,t,r)=>{let i=t&&bM(e.when,_),o={scope:_,palette:x,visible:i,padding:a.padding,region:r,perSegmentSink:c,onSegmentError:l,evaluateSegment:C,lookupSegment:S,renderChild:(e,t,n)=>w(e,t,Wa(r,n)),renderBody:(e,t,n)=>w(e,i&&t,Ga(n)),closeDisclosure:e=>GM(n,e)};return GN(e.kind).render(e,o)},T=t.roots.get(d);if(T===void 0)throw Error(`Preset "${d}" has no compiled layout — registerDslConfig compiles one per declared preset and effectivePresetName collapses unknown names to "${x_}"; a miss here is merge/policy drift (have: ${[...t.roots.keys()].join(`, `)})`);let ee=e=>{if(!bM(e.when,_))return!1;if(e.kind===`container`)return!0;if(AC(e.name)===void 0)return!1;try{return bM(t.segments[e.name].when,by(_,e.settings))}catch{return!0}};return t.menuRuntime.action.layout=()=>LN(T,ee).map(e=>e.flatMap(({name:e,address:t,settings:n})=>{let r=AC(e);return r===void 0?[]:[{name:r,address:t,palette:Rb(n.theme,x)}]})),w(T,!0,Ua(p)).map(e=>BO(OM(e.cells,a),a)).join(`
195
- `)}var rP=class{kind=`box`;cell;lastChangedAt;constructor(e,t,n){this.name=e,this.type=t,lP(e,t,n,`initial value`),this.cell=Cv.observable.box(n,{deep:!1}),this.lastChangedAt=Date.now()}read(){return this.cell.get()}set(e){lP(this.name,this.type,e,`set value`),!Object.is(this.cell.get(),e)&&(this.cell.set(e),this.lastChangedAt=Date.now())}lastUpdatedMs(){return this.lastChangedAt}},iP=class{kind=`computed`;cell;constructor(e,t,n){this.name=e,this.type=t,this.cell=(0,Cv.computed)(()=>{let e=n();return lP(this.name,this.type,e,`computed result`),e},{keepAlive:!0})}read(){return this.cell.get()}lastUpdatedMs(){return null}},aP=class{kind=`document`;cell;lastChangedAt;constructor(e,t){this.name=e,this.cell=Cv.observable.box(cP(t),{deep:!1}),this.lastChangedAt=Date.now()}read(){return this.cell.get()}set(e){let t=cP(e);sP(this.cell.get(),t)||(this.cell.set(t),this.lastChangedAt=Date.now())}lastUpdatedMs(){return this.lastChangedAt}};function oP(e){return JSON.stringify(e)}function sP(e,t){return oP(e)===oP(t)}function cP(e){return e.kind===`ok`?{kind:`ok`,value:wv(e.value)}:e}function lP(e,t,n,r){let i=Tv(n);if(i!==t)throw TypeError(`Variable "${e}": ${r} type ${i} does not match declared type ${t}`)}var uP=class{nodes=new Map;defineBox(e,t,n){this.assertNotDefined(e),this.nodes.set(e,new rP(e,t,n))}defineDocument(e,t){this.assertNotDefined(e),this.nodes.set(e,new aP(e,t))}defineComputed(e,t,n){this.assertNotDefined(e);let r=e=>this.read(e);this.nodes.set(e,new iP(e,t,()=>n(r)))}read(e){return this.requireVar(e).read()}readDocument(e){let t=this.requireNode(e);if(t.kind!==`document`)throw TypeError(`Variable "${e}" is a ${t.kind}, not a document`);return t.read()}setDocument(e,t){let n=this.requireNode(e);if(n.kind!==`document`)throw TypeError(`Variable "${e}" is a ${n.kind}, not a document (use defineDocument to create one)`);(0,Cv.runInAction)(()=>n.set(t))}setBox(e,t){let n=this.requireNode(e);if(n.kind!==`box`)throw TypeError(`Variable "${e}" is a ${n.kind}, not a box (use defineBox to create a settable variable)`);(0,Cv.runInAction)(()=>n.set(t))}runInAction(e){(0,Cv.runInAction)(e)}has(e){return this.nodes.has(e)}getType(e){return this.requireVar(e).type}getKind(e){return this.requireNode(e).kind}changeKey(e){let t=this.requireNode(e);if(t.kind===`document`)return oP(t.read());try{return String(t.read())}catch(e){return`failed:${e instanceof Error?e.message:String(e)}`}}getNode(e){let t=this.requireNode(e);return t.kind===`document`?{name:t.name,kind:t.kind,read:()=>t.read(),lastUpdatedMs:()=>t.lastUpdatedMs()}:{name:t.name,type:t.type,kind:t.kind,read:()=>t.read(),lastUpdatedMs:()=>t.lastUpdatedMs()}}names(){return[...this.nodes.keys()]}requireNode(e){let t=this.nodes.get(e);if(!t)throw ReferenceError(`Unknown variable "${e}"`);return t}requireVar(e){let t=this.requireNode(e);if(t.kind===`document`)throw TypeError(`Variable "${e}" is a document; read its fields by path (.${e}.<field>)`);return t}assertNotDefined(e){if(this.nodes.has(e))throw Error(`Variable "${e}" is already declared`)}};function dP(e,t,n){return e+`\0`+t+`\0`+(n??``)}function fP(e,t){return new Set(C_(e.presets).filter(n=>E_(e,n).path===`root`?t.root!==void 0:t.presets?.[n]?.root!==void 0))}function pP(e){let t=c.basename(e),n=c.dirname(e);for(;!r.existsSync(n);)t=c.basename(n),n=c.dirname(n);return{dir:n,name:t}}function mP(e,t){let n=new Map;for(let t of cT(e.projectDir,e.cwd,e.configFile)){let{dir:e,name:r}=pP(t);n.has(e)||n.set(e,new Set),n.get(e).add(r)}return{files:t===null?[]:[t],dirs:[...n.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({path:e,filenames:[...t].sort()}))}}function hP(e){return e.filter(Boolean).join(`
196
- `)||null}var gP=class{entries=new Map;deps;maxEntries;observers;constructor(e,t={}){this.deps=e,this.maxEntries=t.maxEntries??256,this.observers=t.observers??{}}getOrCreate(e,t,n){let r=dP(e,t,n),i=this.entries.get(r);if(i)return this.entries.delete(r),this.entries.set(r,i),i;let a=this.loadFromDisk(e,t,n),o={projectDir:e,cwd:t,configFile:n,configFilePath:null,lastError:a.error,lastWarning:a.warning,state:a.state??this.buildState(t,null,[]),watcher:null,watcherKey:null};if(this.entries.set(r,o),this.entries.size>this.maxEntries){let e=this.entries.entries().next().value;if(e!==void 0){let[t,n]=e;n.state.registry.dispose(),n.state.validatorDisposers.forEach(e=>e()),n.watcher?.release(),this.entries.delete(t)}}return this.refreshWatcher(o,a.resolvedPath),this.observers.onReload?.(o),o}reload(e,t,n){this.reloadInto(this.getOrCreate(e,t,n))}reloadInto(e){let t=this.loadFromDisk(e.projectDir,e.cwd,e.configFile);e.lastWarning=t.warning,e.lastError=t.error,t.state!==null&&(e.state.registry.dispose(),e.state.validatorDisposers.forEach(e=>e()),e.state=t.state),this.refreshWatcher(e,t.resolvedPath),this.observers.onReload?.(e)}loadFromDisk(e,t,n){let r=uT(e,t,n),i=r.kind===`file`?r.path:null,a=[mT(e,t),fT(r)],o;try{o=this.buildState(t,i,a)}catch(e){return e instanceof bs&&a.push(...e.warnings),{resolvedPath:i,warning:hP(a),state:null,error:e instanceof bs||e instanceof Error?e.message:String(e)}}return{resolvedPath:i,warning:hP(a),state:o,error:null}}buildState(e,t,n){let r=hT(t,Wk),{config:i,raw:a}=r;n.push(...r.warnings);let o=vT(r,t??`<default>`),s=new uP,c=new wb(s,o.globals.default_empty_value??``,this.deps.gitService,this.deps.sessionState),l,u=[];try{l=ZN(o,c,{cwd:e}),n.push(...l.loadWarnings);for(let{key:e,spec:t}of Dj(o))u.push(bj(e,t));for(let{key:e,spec:t}of Ok(o))u.push(kk(e,t))}catch(e){for(let e of u)e();throw c.dispose(),e}return{config:o,store:s,registry:c,compiled:l,neededInputPaths:MA(o),lastRenderCellsBySegment:new Map,validatorDisposers:u,authoredRoots:fP(i,a),fileHeldSettings:sj(a)}}refreshWatcher(e,t){e.configFilePath=t;let n=mP(e,t),r=`config:${e.projectDir}:${e.cwd}:${e.configFile??``}:${JSON.stringify(n)}`;e.watcher!==null&&e.watcherKey===r||(e.watcher?.release(),e.watcherKey=r,e.watcher=this.deps.watchers.acquire(r,n,()=>this.onConfigChanged(e)))}onConfigChanged(e){Q(`info`,`config change detected for entry projectDir=${e.projectDir} cwd=${e.cwd}`),this.reloadInto(e)}get size(){return this.entries.size}firstState(){return this.entries.values().next().value?.state??null}};const _P=16384;var vP=class{startedAt=new Date;requestsTotal=0;requestsErrored=0;requestsTimedOut=0;inFlight=0;watchersOpened=0;watchersClosed=0;watchersEvicted=0;subprocessTotal=0;subprocessInFlight=0;subprocessCount=new Map;subprocessHistogram=new Map;subprocessHistogramRotator=new Map;rollingTimestamps=[];rollingHead=0;launchStats={onStart:e=>{this.subprocessTotal++,this.subprocessInFlight++,this.subprocessCount.set(e,(this.subprocessCount.get(e)??0)+1),this.recordRollingNow()},onEnd:(e,t)=>{this.subprocessInFlight=Math.max(0,this.subprocessInFlight-1),this.recordDuration(e,t)}};recordRollingNow(){let e=Date.now();if(this.rollingTimestamps.length<_P){this.rollingTimestamps.push(e);return}this.rollingTimestamps[this.rollingHead]=e,this.rollingHead=(this.rollingHead+1)%_P}recordDuration(e,t){let n=this.subprocessHistogram.get(e);if(n||(n=[],this.subprocessHistogram.set(e,n)),n.length<16){n.push(t);return}let r=(this.subprocessHistogramRotator.get(e)??0)%16;n[r]=t,this.subprocessHistogramRotator.set(e,r+1)}snapshotSubprocesses(){let e=Date.now()-6e4,t=0;for(let n of this.rollingTimestamps)n>=e&&t++;let n={};for(let[e,t]of this.subprocessCount)t>0&&(n[e]=t);let r={},i={};for(let[e,t]of this.subprocessHistogram){if(t.length===0)continue;let n=[...t].sort((e,t)=>e-t),a=Math.floor(n.length*.5),o=Math.min(n.length-1,Math.floor(n.length*.99)),s=n[a],c=n[o];s!==void 0&&(r[e]=s),c!==void 0&&(i[e]=c)}return{total:this.subprocessTotal,inFlight:this.subprocessInFlight,lastMinute:t,byCategory:n,p50DurationMs:r,p99DurationMs:i}}snapshot(e){let t=process.memoryUsage();return{pid:process.pid,version:pD,protocolVersion:3,startedAt:this.startedAt.toISOString(),uptimeSec:Math.floor((Date.now()-this.startedAt.getTime())/1e3),rssBytes:t.rss,heapUsedBytes:t.heapUsed,heapTotalBytes:t.heapTotal,externalBytes:t.external,arrayBuffersBytes:t.arrayBuffers,requests:{total:this.requestsTotal,errored:this.requestsErrored,timedOut:this.requestsTimedOut,inFlight:this.inFlight},gitCache:e.gitCache,usageCache:e.usageCache,renderCache:{size:e.renderCacheSize},watchers:{active:e.watchersActive,opened:this.watchersOpened,closed:this.watchersClosed,evicted:this.watchersEvicted},subprocesses:this.snapshotSubprocesses(),nextRestartReason:e.nextRestartReason??null}}};function yP(e,t,n){let r=(r,i,a)=>{let o=i.filter(t).map(t=>({key:t,before:e.get(r,t)}));a();for(let{key:t,before:i}of o)n(r,t,i,e.get(r,t))};return{get:(t,n)=>e.get(t,n),set:(t,n,i)=>r(t,[n],()=>e.set(t,n,i)),setBatch:(t,n)=>r(t,n.map(e=>e.key),()=>e.setBatch(t,n)),clear:(t,n)=>r(t,[n],()=>e.clear(t,n))}}const bP={load:()=>({}),save:()=>{},flush:()=>{}};function xP(e){let t=new Map;for(let[n,r]of Object.entries(e))t.set(n,new Map(Object.entries(r)));return t}var SP=class{sessions;storage;atom=(0,Cv.createAtom)(`SessionState`);constructor(e=bP,t=256){this.maxSessions=t,this.storage=e,this.sessions=new Map,this.hydrateFromStorage()}useStorage(e){this.storage=e,this.hydrateFromStorage()}hydrateFromStorage(){this.sessions=xP(this.storage.load()),this.evictOldest(),this.persist()}get(e,t){this.atom.reportObserved();let n=this.sessions.get(e);return n?(this.touch(e,n),n.get(t)??null):null}set(e,t,n){this.setBatch(e,[{key:t,value:n}])}setBatch(e,t){t.length!==0&&(0,Cv.runInAction)(()=>{let n=this.sessions.get(e)??new Map;for(let{key:e,value:r}of t)n.set(e,r);this.touch(e,n),this.evictOldest(),this.persist(),this.atom.reportChanged()})}clear(e,t){(0,Cv.runInAction)(()=>{let n=this.sessions.get(e);n&&(n.delete(t),n.size===0?this.sessions.delete(e):this.touch(e,n)),this.persist(),this.atom.reportChanged()})}prune(e){(0,Cv.runInAction)(()=>{for(let t of this.sessions.keys())e.has(t)||this.sessions.delete(t);this.persist(),this.atom.reportChanged()})}touch(e,t){this.sessions.delete(e),this.sessions.set(e,t)}evictOldest(){let e=this.sessions.size-this.maxSessions;if(!(e<=0)){for(let t of this.sessions.keys())if(this.sessions.delete(t),--e===0)break}}flush(){this.storage.flush()}persist(){this.storage.save(this.serialize())}serialize(){let e=Object.create(null);for(let[t,n]of this.sessions)e[t]=Object.fromEntries(n);return e}};const CP=(e,t)=>k(t);function wP(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;for(let t of Object.values(e)){if(typeof t!=`object`||!t||Array.isArray(t))return!1;for(let e of Object.values(t))if(typeof e!=`string`)return!1}return!0}var TP=class{timer=null;pending=null;constructor(e,t=500,n=CP){this.filePath=e,this.debounceMs=t,this.logger=n}load(){let e;try{e=r.readFileSync(this.filePath,`utf8`)}catch(e){let t=e.code;return t!==`ENOENT`&&this.logger(`warn`,`session-state read failed (${t}); starting empty`),{}}try{let t=JSON.parse(e);return wP(t)?t:(this.logger(`warn`,`session-state load: unexpected shape, starting empty`),{})}catch{return this.logger(`warn`,`session-state load: corrupt JSON, starting empty`),{}}}save(e){this.pending=e,!this.timer&&(this.timer=setTimeout(()=>this.flush(),this.debounceMs),this.timer.unref())}flush(){if(this.timer&&=(clearTimeout(this.timer),null),this.pending===null)return;let e=this.pending;try{r.mkdirSync(c.dirname(this.filePath),{recursive:!0});let t=`${this.filePath}.tmp`;r.writeFileSync(t,JSON.stringify(e),{mode:384}),r.chmodSync(t,384),r.renameSync(t,this.filePath),this.pending=null}catch(e){this.logger(`warn`,`session-state save failed: ${e.message}`)}}};const EP={default_empty_value:`string`,default_separator:`string`,palette:`string`,style:`string`,preset:`string`,endcaps:`string`,variation:`string`,autoWrap:`boolean`,padding:`number`,charset:`string`,updateNotice:`boolean`,colorCompatibility:`string`,menuGlyph:`string`},DP=new Set([`1`,`true`]),OP=new Set([`0`,`false`,``]);function kP(e,t){let n=eF(e),r=n.scope===`segment-palette`?`string`:EP[n.field];if(r===`string`)return JSON.stringify(t);if(r===`number`){let n=Number(t);if(!Number.isFinite(n))throw Error(`persistValueText: "${e}" expects a number, got "${t}"`);return String(n)}if(DP.has(t))return`true`;if(OP.has(t))return`false`;throw Error(`persistValueText: "${e}" expects boolean-ish (1, 0, true, false), got "${t}"`)}function AP(e){try{return r.readFileSync(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return null;throw e}}function jP(e,t,n){try{if(t===null){r.rmSync(e,{force:!0});return}r.mkdirSync(c.dirname(e),{recursive:!0}),Ae(e,t)}catch(t){let r=`config write failed (${e}): ${t.message}`;throw n(`error`,r),Error(r)}}function MP(e){return/^\s*$/.test(e)?null:Io(e)}function NP(e,t){return e!==null&&Ro(e,t)!==void 0}function PP(e){if(e.kind===`segment`)return e.when===void 0?e.name:{seg:e.name,when:e.when};if(e.kind===`container`){let{kind:t,direction:n,children:r,...i}=e;return{[n===`horizontal`?`h`:`v`]:r.map(PP),...i}}return e}function FP(e){if(!Ac(e))return PP(e);let{rows:t,...n}=e;return{rows:Object.fromEntries(Object.entries(t).map(([e,t])=>[e,PP(t)])),...n}}const IP=Hk,LP=IP.segments,RP=IP.presets,zP=IP.root;function BP(e,t,n,r){if(!NP(e,t)&&n===void 0)throw new $(`cannot edit ${r}: neither the config file nor the bundled default declares ${t.join(`.`)}`)}function VP(e,t){let n=sx(t);return t.scope===`segment-palette`&&BP(e,[`segments`,t.segment],LP[t.segment],n.join(`.`)),n}function HP(e){return Io(Ko(e))}function UP(){return Object.entries(zP.rows).map(([e,t])=>{let n=PP(t);return{path:[`root`],fragment:HP({rows:{[e]:n}}),unit:{path:[`root`,`rows`,e],value:n}}})}function WP(e,t){let n=e===null?void 0:Ro(e,t);return n===void 0?null:{path:t,fragment:n,unit:null}}function GP(e,t){if(t===void 0)return null;let n=FP(t);return{path:e,fragment:HP(n),unit:{path:e,value:n}}}function KP(e,t){let n=[`presets`,t],r=[...n,`root`],i=RP[t];BP(e,n,i,r.join(`.`));let a=WP(e,r)??GP(r,i?.root);return a!==null&&ps(a.fragment)?a:null}function qP(e,t){let n=fs(t.fragment);return n===null?new Map([[`#`,{path:t.path,unit:t.unit,node:t.fragment}]]):new Map([...e,...n.map(e=>[e.key,{path:[...t.path,`rows`,e.key],unit:t.unit,node:e.value}])])}function JP(e,t){return[...UP(),WP(e,[`root`]),KP(e,t)].filter(e=>e!==null).reduce(qP,new Map)}function YP(e,t,n){for(let{node:r,...i}of JP(e,t).values())if(hs(r,n))return i;throw new $(`${XP(e,t).join(`.`)} holds no placement "${n}" — the bar you clicked is stale (it reloads on the next render), or the action names a placement the layout never held`)}function XP(e,t){return KP(e,t)?.path??[`root`]}function ZP(e,t){return t.scope===`preset-root`?XP(e,t.preset):sx(t)}function QP(e,{unit:t}){return t===null?e:os(e,t.path,Ko(t.value),Wo)}function $P(e){let t=ox(e);if(t===null)throw Error(`"${e}" is not a valid persist target`);return t}function eF(e){let t=$P(e);if(t.scope===`preset-root`)throw Error(`"${e}" names a layout, not a value`);return t}function tF(e,t,n,r){nF(t,r),jP(t,r,e.logger),e.record(t,n,r)}function nF(e,t){try{return vT(gT(e,t,Wk),e)}catch(e){throw e instanceof bs?new $(`refused: the config file would not load after this click — ${e.message}`):e}}function rF(e,t){let n=eF(t),r=MP(AP(e)??``),i=r===null?void 0:Ro(r,sx(n));return i!==void 0&&`value`in i?i.value:void 0}function iF(e,t,n){aF(e,t,n,[])}function aF(e,t,n,r){let i=AP(t);tF(e,t,i,oF(n.reduce((e,[t,n])=>os(e,VP(MP(e),eF(t)),kP(t,n),Wo),i??``),t,r,e=>e))}function oF(e,t,n,r){return n.reduce((e,{preset:n,id:i,setting:a,value:o})=>{let s=r(e,n,i),c=YP(MP(s),n,i),l=ys(QP(s,c),c.path,i,a,Ko(o));if(l===null)throw new $(`${c.path.join(`.`)} in ${t} has no placement "${i}" — the bar you clicked is stale (it reloads on the next render)`);return l},e)}function sF(e,t,n){let r=MP(e),i=[`presets`,t,`root`];for(let[a,{path:o,unit:s,node:c}]of JP(r,t)){if(!hs(c,n))continue;if(i.every((e,t)=>o[t]===e))return e;let l=s===null?Bo(e,c):Ko(s.value);if(a!==`#`)return os(e,[...i,`rows`,a],l,Wo);if(KP(r,t)!==null)throw new $(`cannot give preset "${t}" its own copy of ${o.join(`.`)}: it already stages rows of its own over that tree`);return os(e,i,l,Wo)}return e}function cF(e,t){return cs(e,t,t[0]===`presets`&&t.length>2&&!Kk(t[1])?2:0)}function lF(e,t,n){let r=n.map($P),i=AP(t);if(i===null)return;let a=r.reduce((e,t)=>cF(e,ZP(MP(e),t)),i);a!==i&&tF(e,t,i,a)}function uF(e){let t=e===null?void 0:Ro(e,[`presets`]),n=new Set([...Gk,...t?.kind===`object`?t.entries.map(e=>e.key):[]].map(hu));return Array.from({length:n.size+1},(e,t)=>`custom-${t+1}`).find(e=>!n.has(hu(e)))}function dF(e,t,n,r,i,a){let o=AP(t),s=MP(o??``),c=uF(s),l=[`presets`,c],u=KP(s,n),d=[...u===null?[]:[[[...l,`root`],u.unit===null?Bo(o??``,u.fragment):Ko(u.unit.value)]],...Object.keys(r).length===0?[]:[[[...l,`globals`],Ko(r)]]],f=i.map(([e,t])=>{let n=ax(c,e);return[VP(s,eF(n)),kP(n,t)]});return tF(e,t,o,oF([...d,...f].reduce((e,[t,n])=>os(e,t,n,Wo),os(o??``,l,`{}`,Wo)),t,a.map(e=>({...e,preset:c})),sF)),c}function fF(e,t,n){if(Kk(n))throw new $(`cannot delete preset "${n}": it is bundled — reset its settings instead`);let r=[`presets`,n],i=AP(t),a=MP(i??``);if(i===null||a===null||Ro(a,r)===void 0)throw new $(`cannot delete preset "${n}": ${t} declares no ${r.join(`.`)} — the bar you clicked is stale; it reloads on the next render`);let o=Ro(a,[`globals`,`preset`]);tF(e,t,i,[r,...o?.kind===`string`&&o.value===n?[[`globals`,`preset`]]:[]].reduce((e,t)=>cF(e,t),i))}function pF(e,t,n,r){let i=$P(n);if(i.scope!==`preset-root`)throw Error(`"${n}" is not a "presets.<name>.root" target`);let a=AP(t),o=r.op===`remove`?r.target:r.anchor,s=YP(MP(a??``),i.preset,o),c=QP(a??``,s),{after:l,placed:u}=mF(c,s.path,r,()=>{let e=nF(t,c);return C_(e.presets).map(t=>E_(e,t).node)});if(l===null)throw new $(`${s.path.join(`.`)} in ${t} has no placement "${o}" — the bar you clicked is stale (it reloads on the next render), or the action names a placement the layout never held`);return tF(e,t,a,l),u}function mF(e,t,n,r){switch(n.op){case`remove`:return{after:_s(e,t,n.target),placed:null};case`insert`:{let i=uk(n.segment,n.anchor,r());return{after:vs(e,t,i,n.anchor,n.relation),placed:i}}}}const hF={load:()=>({}),save:()=>{}},gF=new Set(Db.map(e=>e.sessionKey)),_F=e=>gF.has(e)||e.startsWith(q_),vF=8*1024*1024,yF={past:[],future:[]},bF=e=>e.kind===`session`?`session:${e.key}`:`file:${e.file}`;var xF=class{state=new Map;constructor(e,t,n=hF){this.sessionState=e,this.logger=t,this.storage=n,this.state=new Map(Object.entries(n.load()))}useStorage(e){this.storage=e,this.state=new Map(Object.entries(e.load()))}depth(e){let{past:t,future:n,savepoint:r}=this.state.get(e)??yF;return{undo:t.length,redo:n.length,sinceEdit:r?.net.length??0}}history(e){return this.state.get(e)??yF}begin(){let e=new Map,t=(t,n)=>{let r=e.get(t)??new Map,i=r.get(bF(n));r.set(bF(n),i===void 0?n:{...n,before:i.before}),e.set(t,r)},n=new Map;return{sessionState:yP(this.sessionState,e=>_F(e)||e===`edit.mode`,(e,r,i,a)=>{if(r===`edit.mode`){let t=n.get(e);n.set(e,{before:t===void 0?i:t.before,after:a});return}t(e,{kind:`session`,key:r,before:i,after:a})}),file:(e,n,r,i)=>t(e,{kind:`file`,file:n,before:r,after:i}),commit:()=>{let t=new Map(e),r=new Map(n);e.clear(),n.clear();for(let e of new Set([...t.keys(),...r.keys()])){let n=[...t.get(e)?.values()??[]].filter(e=>e.before!==e.after),i=this.history(e),a=n.length===0?i:kF(i,n),o=r.get(e),s=o===void 0?a:NF(a,o);s!==i&&this.put(e,s)}}}}undo(e){let t=this.history(e),n=t.past.at(-1);if(n===void 0)throw new $(`undo: nothing to undo`);return this.apply(e,n,`before`,`undo`,jF(t,n)),n}rewind(e){let t=this.history(e),{savepoint:n}=t;if(n===void 0)throw new $(`rewind: edit mode has no savepoint — nothing to cancel`);let r=n.net.filter(t=>this.read(e,t)!==t.after),i=new Set(r.map(bF)),a=n.net.filter(e=>!i.has(bF(e))),o=wF(PF(MF(t,n),i));if(this.apply(e,a,`before`,`rewind`,{past:o,future:[],savepoint:{at:o.length,net:[],below:[]}}),r.length>0)throw new $(`rewind: ${r.map(IF).join(`, `)} changed since edit mode opened — kept as it is; everything else edit mode changed was put back`);return a}redo(e){let t=this.history(e),{past:n,future:r}=t,i=r.at(-1);if(i===void 0)throw new $(`redo: nothing to redo`);let a=[...n,i],o=wF(a);return this.apply(e,i,`after`,`redo`,{past:o,future:r.slice(0,-1),...EF(t.savepoint,a.length-o.length,i)}),i}apply(e,t,n,r,i){let a=n===`before`?`after`:`before`,o=t.filter(t=>this.read(e,t)!==t[a]);if(o.length>0){let t=new Set(o.map(bF)),{past:n,future:i,savepoint:a}=this.history(e);throw this.put(e,{past:PF(n,t),future:PF(i,t),...a!==void 0&&{savepoint:{at:PF([...n,...[...i].reverse()].slice(0,a.at),t).length,net:a.net.filter(e=>!t.has(bF(e))),below:PF(a.below,t)}}}),new $(`${r}: ${o.map(IF).join(`, `)} changed since that edit — refusing to overwrite it; this session's undo history no longer steps it`)}let s=[];try{for(let r of t)this.write(e,r,r[n]),s.push(r);this.put(e,i)}catch(t){try{for(let t of s.reverse())this.write(e,t,t[a])}catch(e){throw Error(`${t.message}; and putting the step back failed, so it is half-applied: ${e.message}`)}throw t}}read(e,t){return t.kind===`session`?this.sessionState.get(e,t.key):AP(t.file)}write(e,t,n){t.kind===`file`?jP(t.file,n,this.logger):n===null?this.sessionState.clear(e,t.key):this.sessionState.set(e,t.key,n)}put(e,t){let n=new Map(this.state);for(n.delete(e),(t.past.length>0||t.future.length>0||t.savepoint!==void 0)&&n.set(e,t);n.size>32||SF(n)>vF;){let[e,t]=n.entries().next().value;n.size>1?n.delete(e):t.past.length+t.future.length>0?n.set(e,CF(t)):(this.logger(`warn`,`settings-history: edit mode's changes for session ${e} exceed ${vF} bytes; cancel is no longer available`),n.delete(e))}this.storage.save(Object.fromEntries(n)),this.state=n}};function SF(e){let t=0;for(let{past:n,future:r,savepoint:i}of e.values())for(let e of[...n,...r,...i===void 0?[]:[i.net,...i.below]])for(let n of e)t+=(n.before?.length??0)+(n.after?.length??0);return t}function CF({past:e,future:t,savepoint:n}){return e.length>0?{past:e.slice(1),future:t,...EF(n,1,[])}:{past:e,future:t.slice(1),...EF(n,0,[])}}function wF(e){return e.slice(-50)}const TF=e=>e===Y_.member;function EF(e,t,n){return e===void 0?{}:{savepoint:{at:Math.max(0,e.at-t),net:DF(e.net,n),below:e.below}}}function DF(e,t){let n=new Map(e.map(e=>[bF(e),e]));for(let e of t){let t=n.get(bF(e));n.set(bF(e),t===void 0?e:{...t,after:e.after})}return[...n.values()].filter(e=>e.before!==e.after)}const OF=e=>e.map(e=>({...e,before:e.after,after:e.before}));function kF(e,t){let n=[...e.past,t],r=wF(n),{savepoint:i}=e,a=i===void 0?0:Math.max(0,i.at-e.past.length);return{past:r,future:[],...EF(i&&{at:Math.min(i.at,e.past.length),net:i.net,below:[...AF(e.future,a),...i.below]},n.length-r.length,t)}}function AF(e,t){let n=Math.min(t,e.length);return e.slice(e.length-n).reverse()}function jF(e,t){return{past:e.past.slice(0,-1),future:wF([...e.future,t]),...EF(e.savepoint,0,OF(t))}}function MF(e,t){let{past:n,future:r}=e,i=n.slice(0,t.at);return[...i,...AF(r,t.at-i.length),...t.below]}function NF(e,t){if(TF(t.after)&&!TF(t.before))return{...e,savepoint:{at:e.past.length,net:[],below:[]}};if(!TF(t.after)&&TF(t.before)){let{past:t,future:n}=e;return{past:t,future:n}}return e}function PF(e,t){return e.map(e=>e.filter(e=>!t.has(bF(e)))).filter(e=>e.length>0)}function FF(e){return e.map(IF).join(`, `)}function IF(e){return e.kind===`session`?`session setting "${e.key}"`:e.file}function LF(e){if(typeof e!=`object`||!e)return!1;let t=e,n=e=>e===null||typeof e==`string`;return(t.kind===`session`&&typeof t.key==`string`||t.kind===`file`&&typeof t.file==`string`)&&n(t.before)&&n(t.after)}function RF(e){return Array.isArray(e)&&e.every(e=>Array.isArray(e)&&e.every(LF))}function zF(e){if(typeof e!=`object`||!e)return!1;let t=e;return Number.isInteger(t.at)&&t.at>=0&&Array.isArray(t.net)&&t.net.every(LF)&&RF(t.below)}function BF(e){if(typeof e!=`object`||!e)return!1;let t=e;return RF(t.past)&&RF(t.future)&&(t.savepoint===void 0||zF(t.savepoint))}function VF(e,t){return{load:()=>{let n;try{n=r.readFileSync(e,`utf8`)}catch(e){let n=e.code;return n!==`ENOENT`&&t(`warn`,`settings-history read failed (${n}); starting empty`),{}}try{let e=JSON.parse(n);if(typeof e==`object`&&e&&!Array.isArray(e)&&Object.values(e).every(BF))return e}catch{}return t(`warn`,`settings-history load: unexpected shape, starting empty`),{}},save:n=>{try{r.mkdirSync(c.dirname(e),{recursive:!0}),Ae(e,JSON.stringify(n),384)}catch(e){let n=`settings-history write failed — the change landed but is not undoable: ${e.message}`;throw t(`error`,n),Error(n)}}}}const HF=e=>!_F(e)&&!Px(e)&&e!==`update.dismissed`;var UF=class{past=new Map;depth(e,t){return this.restorable(e,t).length}restorable(e,t){let n=new Map,r=r=>n.has(r)?n.get(r):t.get(e,r),i=[];for(let t of[...this.past.get(e)??[]].reverse())if(t.every(e=>r(e.key)===e.after&&(e.before===null||xj(e.key,e.before).ok))){i.unshift(t);for(let e of t)n.set(e.key,e.before)}return i}begin(e){let t=new Map;return{sessionState:yP(e,HF,(e,n,r,i)=>{let a=t.get(e)??new Map,o=a.get(n);a.set(n,{key:n,before:o?o.before:r,after:i}),t.set(e,a)}),commit:()=>{for(let[e,n]of t){let t=[...n.values()].filter(e=>e.before!==e.after);t.length>0&&this.push(e,t)}t.clear()}}}back(e,t){let n=this.past.get(e)??[],r=this.restorable(e,t),i=r.at(-1),a=n.length-r.length;if(i===void 0)throw this.put(e,r),new $(`back: nothing to go back to${a>0?` (${a} step(s) over a view since gone, discarded)`:``}`);return(0,Cv.runInAction)(()=>{let n=i.flatMap(({key:e,before:t})=>t===null?[]:[{key:e,value:t}]);n.length>0&&t.setBatch(e,n);for(let{key:n,before:r}of i)r===null&&t.clear(e,n)}),this.put(e,r.slice(0,-1)),{step:i,discarded:a}}push(e,t){let n=this.past.get(e)??[];this.put(e,[...n,t].slice(-20))}put(e,t){for(this.past.delete(e),t.length>0&&this.past.set(e,t);this.past.size>32;)this.past.delete(this.past.keys().next().value)}};function WF(e,t,n,r){let i=Oe({bin:`tmux`,args:[`-S`,e.socket,...n],timeoutMs:2e3,category:t,stdinInput:r});if(i.ok)return{kind:`ok`,stdout:i.stdout};if(i.reason===`rate-limited`)return{kind:`rate-limited`,reason:i.error??`rate-limited`};let a=i.error??[i.reason,i.stderr.trim()].filter(e=>e!==``).join(`: `);return{kind:`failed`,reason:`tmux ${n[0]} failed (${a})`}}function GF(e){let t=WF(e,`doctor.tmux`,[`display`,`-p`,`-t`,e.pane,`#{client_termfeatures}`]);return t.kind===`ok`?{kind:`ok`,value:t.stdout.trim().split(`,`).filter(e=>e!==``)}:{kind:`failed`,reason:t.reason}}function KF(){return{probeTmux:GF}}function qF(e){let t=SD(e).env;if(t===void 0)return{path:e,env:{}};if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`cannot read ${e}: \`env\` is not an object`);return{path:e,env:t}}function JF(e,t){return t===void 0?{kind:`unreported`}:t===null?{kind:`outside`}:{kind:`inside`,hint:t,termfeatures:e.probeTmux(t)}}function YF(e,t){return{tmux:JF(e,t.tmux),claudeSettings:qF(yD(vD(t.claudeConfigDir)))}}function XF(e,t){let n=t.claudeSettings.path;switch(e.kind){case`claude-settings-env`:{let i=os(xD(n),[`env`,e.name],JSON.stringify(e.value),Go);return r.mkdirSync(c.dirname(n),{recursive:!0}),Ae(n,i),{...t,claudeSettings:qF(n)}}default:return e.kind}}const ZF=/^─{20,}/,QF=/^❯(\s|$)/,$F=/›\s*stashed$/;function eI(e){if(e.inMode)return{kind:`in-mode`};let t=e.screen.map(e=>e.trimEnd()),n=t.flatMap((e,t)=>ZF.test(e)?[t]:[]).at(-2);return n===void 0||!QF.test(t[n+1]??``)?{kind:`no-prompt`}:$F.test(t[n-1]??``)?{kind:`stashed`}:{kind:`ready`}}const tI={"in-mode":`the Claude Code pane is in tmux copy mode — leave it (q) and click again`,stashed:`Claude Code is holding a stashed prompt (ctrl+s) — restore or send it, then click again`,"no-prompt":`Claude Code is not at its prompt (a dialog or picker is open) — close it and click again`};function nI(e,t,n){if(t===void 0)return{kind:`refused`,reason:`this session's statusline client reports no tmux facts (it predates this daemon) — rebuild or reinstall cc-candybar`};if(t===null)return{kind:`refused`,reason:`this Claude Code is not running inside tmux — the bar can only type into a tmux pane`};let r=eI(e.read(t));if(r.kind!==`ready`)return{kind:`refused`,reason:tI[r.kind]};let i=e.type(t,n);return i.kind===`typed`?{kind:`typed`,pane:t.pane}:i}const rI=`cc-candybar-slash`;function iI(e,t,n,r){let i=WF(e,t,n,r);if(i.kind===`failed`)throw Error(i.reason);return i}function aI(e){let t=iI(e,`claude-input.read`,[`display`,`-p`,`-t`,e.pane,`#{pane_in_mode}`,`;`,`capture-pane`,`-p`,`-t`,e.pane]);if(t.kind===`rate-limited`)throw Error(t.reason);let[n=``,...r]=t.stdout.split(`
197
- `);return{inMode:n!==`0`,screen:r}}function oI(e,t){let n=iI(e,`claude-input.type`,[`load-buffer`,`-b`,rI,`-`,`;`,`send-keys`,`-t`,e.pane,`C-s`,`;`,`paste-buffer`,`-p`,`-d`,`-b`,rI,`-t`,e.pane,`;`,`send-keys`,`-t`,e.pane,`Enter`],t);return n.kind===`ok`?{kind:`typed`}:{kind:`refused`,reason:`cc-candybar typed a command moments ago — click again in a second (${n.reason})`}}function sI(){return{read:aI,type:oI}}function cI(e){if(!e)throw new $(`session id is required`);if(e.includes(`/`)||e.includes(`..`))throw new $(`invalid session id "${e}"`);return e}function lI(e){return uI(()=>decodeURIComponent(e))}function uI(e){try{return e()}catch(e){throw e instanceof URIError?new $(`malformed wire encoding: ${e.message}`):e}}function dI(e,t){let n=Oe({bin:`/usr/bin/pbcopy`,stdinInput:e,category:`click.pbcopy`});if(!n.ok){if(n.reason===`rate-limited`){t.dlog(`warn`,`click.pbcopy rate-limited: ${n.error??``}`);return}throw Error(`pbcopy failed (${n.reason}, exit ${n.exitCode??`null`})`)}}const fI=(e,t)=>dI(lI(e),t),pI=(e,t)=>{let n=Oe({bin:`/usr/bin/open`,args:[`-a`,`Visual Studio Code`,lI(e)],category:`click.open`});if(!n.ok){if(n.reason===`rate-limited`){t.dlog(`warn`,`click.open rate-limited: ${n.error??``}`);return}throw Error(`open -a "Visual Studio Code" failed (${n.reason}, exit ${n.exitCode??`null`})`)}},mI=(e,t)=>dI(lI(e),t),hI=(e,t)=>dI(lI(e),t),gI=(e,t)=>{let n=cI(lI(e));t.navigating.get(n,`toolbar-expanded`)?t.navigating.clear(n,`toolbar-expanded`):t.navigating.set(n,`toolbar-expanded`,`1`)},_I=(e,t)=>{let[n=``,...r]=uI(()=>oD(e)),i=cI(n);if(r.length===0)throw new $(`set-state: <key>/<value> is required (have keys: ${yj().join(`, `)})`);if(r.length%2!=0)throw new $(`set-state: expected even-count <key>/<value> pairs, got ${r.length} segment(s) after session id (have keys: ${yj().join(`, `)})`);let a=[];for(let e=0;e<r.length;e+=2){let t=r[e],n=r[e+1];if(!t)throw new $(`set-state: empty key at pair ${e/2+1} (expected <sessionId>/<key>/<value>[/<key>/<value>...] segments)`);let i=xj(t,n);if(!i.ok)throw new $(`set-state: pair ${e/2+1}: ${i.reason}`);a.push({key:t,value:i.value})}xI(t,i,`set-state`,a),t.navigating.setBatch(i,a);let o=a.map(e=>`${e.key}=${e.value}`).join(` `);t.dlog(`info`,`set-state: ${o} (session=${i})`)},vI=/^-?\d+$/;function yI(e,t,n,r){let i=e+t;return i>r?e===r?n:r:i<n?e===n?r:n:i}const bI=(e,t)=>{let[n=``,r=``,i=``]=uI(()=>oD(e)),a=cI(n);if(!r)throw new $(`step-state: <key> is required (shape: <sessionId>/<key>/<by>)`);if(!vI.test(i))throw new $(`step-state: delta must be an integer, got "${i}"`);let o=parseInt(i,10),s=Sj(r);if(!s)throw new $(`step-state: key "${r}" is not a bounded (range) state key (have keys: ${yj().join(`, `)})`);let c=t.sessionState.get(a,r),l=c&&vI.test(c)?SI(s,parseInt(c,10)):CI(`step-state`,r,s,Tj(t.configFor(DI(t,a)),e=>t.sessionState.get(a,e),r)),u=yI(l,o,s.min,s.max),d=xj(r,String(u));if(!d.ok)throw new $(`step-state: ${d.reason}`);xI(t,a,`step-state`,[{key:r,value:d.value}]),t.navigating.set(a,r,d.value),t.dlog(`info`,`step-state: ${r} ${l}→${d.value} (by ${o}, session=${a})`)};function xI(e,t,n,r){let i=r.filter(e=>e.key.startsWith(q_));if(i.length===0)return;let a=nj(e.configFor(DI(e,t)),n=>e.sessionState.get(t,n),i);if(a.length>0)throw new $(`${n}: refused — ${a.join(`; `)}`)}function SI(e,t){return Math.max(e.min,Math.min(e.max,t))}function CI(e,t,n,r){if(r===null)return n.min;if(!vI.test(r))throw new $(`${e}: "${t}" shows ${JSON.stringify(r)} before any click, not an integer to step`);return SI(n,parseInt(r,10))}const wI=`render-origin`;function TI(e){return JSON.stringify(e)}function EI(e){let t;try{t=JSON.parse(e)}catch{throw new $(`render origin is not JSON: ${e}`)}if(typeof t!=`object`||!t)throw new $(`render origin is not an object: ${e}`);let{projectDir:n,cwd:r,configFile:i}=t;if(typeof n!=`string`||typeof r!=`string`||i!==null&&typeof i!=`string`)throw new $(`render origin has the wrong shape: ${e}`);return{projectDir:n,cwd:r,configFile:i}}function DI(e,t){let n=e.sessionState.get(t,wI);if(n===null)throw new $(`session ${t} has not rendered yet — no config to act on`);return EI(n)}function OI(e,t,n){let r=e.sessionState.get(t,wI);if(r===null)return;let i=EI(r),a=kI(i);n.some(e=>e.kind===`file`&&e.file===a)&&e.reloadConfig(i)}function kI(e){return dT(e.projectDir,e.cwd,e.configFile??void 0)}function AI(e,t){return{record:(n,r,i)=>e.journal.file(t,n,r,i),logger:e.dlog}}const jI=(e,t)=>{let[n=``,r=``,i=``]=uI(()=>oD(e)),a=cI(n);if(!r)throw new $(`set-config: <key>/<value> is required (have keys: ${xk().join(`, `)})`);let o=Sk(r,i);if(!o.ok)throw new $(`set-config: ${o.reason}`);let s=DI(t,a),c=kI(s),l=ej(t.configFor(s),e=>t.sessionState.get(a,e),r);iF(AI(t,a),c,[[l.key,o.value]]),t.reloadConfig(s),t.dlog(`info`,`set-config: ${l.key}=${o.value} → ${c} (session=${a})`)},MI=(e,t)=>{let[n=``,r=``,i=``]=uI(()=>oD(e)),a=cI(n);if(!r)throw new $(`step-config: <key> is required (shape: <sessionId>/<key>/<by>)`);if(!vI.test(i))throw new $(`step-config: delta must be an integer, got "${i}"`);let o=parseInt(i,10),s=Ck(r);if(!s)throw new $(`step-config: key "${r}" is not a bounded (range) config key (have keys: ${xk().join(`, `)})`);let c=DI(t,a),l=kI(c),u=ej(t.configFor(c),e=>t.sessionState.get(a,e),r),d=rF(l,u.key),f=typeof d==`number`?SI(s,d):CI(`step-config`,r,s,Tk(u.globals,r)),p=yI(f,o,s.min,s.max),m=Sk(r,String(p));if(!m.ok)throw new $(`step-config: ${m.reason}`);iF(AI(t,a),l,[[u.key,m.value]]),t.reloadConfig(c),t.dlog(`info`,`step-config: ${u.key} ${f}→${m.value} (by ${o}) → ${l} (session=${a})`)},NI=(e,t)=>{let[n=``]=uI(()=>oD(e)),r=cI(n),i=DI(t,r),a=t.configFor(i),o=e=>t.sessionState.get(r,e),s=QA(a,o),c=tj(a,o);if(s.length+c.length===0){t.dlog(`info`,`save: nothing unsaved (session=${r})`);return}let l=s.map(e=>{let t=xj(e.sessionKey,e.value);if(!t.ok)throw new $(`save: ${t.reason}`);return[e.target,t.value]});FI(`save`,c);let u=kI(i);aF(AI(t,r),u,l,c),t.reloadConfig(i);for(let e of[...s.map(e=>e.sessionKey),...c.map(e=>e.key)])t.sessionState.clear(r,e);t.dlog(`info`,`save: ${[...l.map(([e,t])=>`${e}=${t}`),...c.map(PI)].join(` `)} → ${u} (session=${r})`)},PI=e=>`${e.preset}/${e.id}.settings.${e.setting}=${Ks(e.value)}`;function FI(e,t){for(let n of t){let t=xj(n.key,Ks(n.value));if(!t.ok)throw new $(`${e}: ${t.reason}`)}}const II=(e,t)=>{let[n=``]=uI(()=>oD(e)),r=cI(n),i=DI(t,r),a=aj(t.configFor(i),e=>t.sessionState.get(r,e)),o=a.picks.map(e=>{let t=xj(e.sessionKey,e.value);if(!t.ok)throw new $(`save-preset: ${t.reason}`);return[e.configKey,t.value]});FI(`save-preset`,a.placements);let s=kI(i),c=dF(AI(t,r),s,a.from,a.globals,o,a.placements);t.reloadConfig(i);for(let e of[...Db.map(e=>e.sessionKey),...a.placements.map(e=>e.key)])t.sessionState.clear(r,e);t.sessionState.set(r,Eb.preset.sessionKey,c),t.dlog(`info`,`save-preset: ${[`${c} from=${a.from}`,...o.map(([e,t])=>`${e}=${t}`),...a.placements.map(PI)].join(` `)} → ${s} (session=${r})`)},LI=(e,t)=>{let[n=``,r=``]=uI(()=>oD(e)),i=cI(n);if(!r)throw new $(`delete-preset: <name> is required (shape: <sessionId>/<name>)`);let a=DI(t,i),o=kI(a);fF(AI(t,i),o,r),t.reloadConfig(a);let s=Eb.preset.sessionKey;t.sessionState.get(i,s)===r&&t.sessionState.clear(i,s),t.dlog(`info`,`delete-preset: ${r} ← ${o} (session=${i})`)},RI=(e,t)=>{let[n=``,...r]=uI(()=>oD(e)),i=cI(n),a=xk(),o=r.length===0?[``]:r.filter(e=>!a.includes(e));if(o.length>0)throw new $(`reset-config: unknown config key "${o.join(`", "`)}" (have: ${a.join(`, `)})`);let s=DI(t,i),c=kI(s),l=r.map(oj),u=l.flatMap(e=>e.fileKeys),d=l.flatMap(e=>e.sessionKeys);lF(AI(t,i),c,u),t.reloadConfig(s);for(let e of d)t.sessionState.clear(i,e);t.dlog(`info`,`reset-config: ${[...u,...d.map(e=>`session:${e}`)].join(` `)} ← ${c} (session=${i})`)};function zI(e,t){let n=(e,t)=>[...js(E_(e,t).node)].filter(e=>e.kind===`segment`),r=new Set(C_(t.presets).flatMap(e=>n(t,e).map(t=>J_(hu(e),Ds(t)))));return C_(e.presets).flatMap(t=>n(e,t).map(e=>({member:J_(hu(t),Ds(e)),node:e})).filter(({member:e})=>!r.has(e)))}function BI(e,t){return e.flatMap(({member:e,node:n})=>[...Object.values(n.drafts??{}).map(e=>e.key),...e===t?[H_]:[]])}const VI=(e,t)=>{let[n=``,r=``,i=``]=uI(()=>oD(e)),a=cI(n);if(!r)throw new $(`apply-layout-op: <key>/<op> is required (have: ${xk().join(`, `)})`);let o=Sk(r,i);if(!o.ok)throw new $(`apply-layout-op: ${o.reason}`);let s=lk(o.value);if(s===null)throw new $(`apply-layout-op: "${o.value}" is not a layout op token`);let c=DI(t,a),l=kI(c),u=t.configFor(c),d=pF(AI(t,a),l,r,s);t.reloadConfig(c);let f=BI(zI(u,t.configFor(c)),t.sessionState.get(a,H_)).filter(e=>t.sessionState.get(a,e)!==null);for(let e of f)t.sessionState.clear(a,e);t.dlog(`info`,`apply-layout-op: ${r} ${o.value} → ${l} placed=${JSON.stringify(d)} released=${JSON.stringify(f)} (session=${a})`)},HI=(e,t)=>{let[n=``]=uI(()=>oD(e)),r=cI(n);t.journal.commit();let i=t.history.undo(r);OI(t,r,i),t.dlog(`info`,`undo: restored ${FF(i)} (session=${r})`)},UI=(e,t)=>{let n=cI(lI(e)),{step:r,discarded:i}=t.navigation.back(n,t.sessionState),a=r.map(e=>`${e.key}=${e.before??`∅`}`).join(` `);t.dlog(`info`,`back: ${a} discarded=${i} (session=${n})`)},WI=(e,t)=>{let n=cI(lI(e));t.journal.commit();let r=t.history.rewind(n);OI(t,n,r),t.dlog(`info`,`rewind: put back ${FF(r)||`nothing`} as edit mode found it (session=${n})`)},GI=(e,t)=>{let[n=``]=uI(()=>oD(e)),r=cI(n);t.journal.commit();let i=t.history.redo(r);OI(t,r,i),t.dlog(`info`,`redo: re-applied ${FF(i)} (session=${r})`)},KI=(e,t)=>{cI(lI(e)),t.applyUpdate()},qI=`client-hints`;function JI(e,t){let n=e.sessionState.get(t,qI);if(n===null)throw new $(`session ${t} has not rendered yet — no client facts are recorded for it`);let r;try{r=JSON.parse(n)}catch{throw new $(`client hints record is not JSON: ${n}`)}if(typeof r!=`object`||!r)throw new $(`client hints record is not an object: ${n}`);return TT(r)}function YI(e,t,n){let r=wx(n);e.sessionState.setBatch(t,Ox(r)),e.dlog(`info`,`doctor: ${r.map(e=>`${e.check.name}=${e.verdict.ok?`ok`:`failed`}`).join(` `)} (session=${t})`)}const XI=(e,t)=>{let n=cI(lI(e));YI(t,n,YF(t.doctor,JI(t,n)))},ZI=(e,t)=>{let[n=``,r=``]=uI(()=>oD(e)),i=cI(n),a=Tx(r);if(a===void 0)throw new $(`doctor-fix: unknown check "${r}"`);let o=YF(t.doctor,JI(t,i)),s=a.probe(o);if(s.ok||s.fix===void 0)throw new $(`doctor-fix: ${a.label} — ${s.ok?`nothing to fix`:s.reason}`);let c=XF(s.fix,o);t.dlog(`info`,`doctor-fix: ${a.name} → ${s.fix.kind} ${s.fix.name}=${s.fix.value} (session=${i})`),YI(t,i,c)},QI=(e,t)=>{let[n=``,...r]=uI(()=>oD(e)),i=cI(n),a=DI(t,i),o=Object.values(t.configFor(a).actions).filter(e=>`ceiling`in e).find(e=>{let t=zC(e);return t.length===r.length&&t.every((e,t)=>e===r[t])});if(o===void 0)throw new $(`ceiling: "${r.join(` `)}" is not a move this config declares`);let s=o.ceiling===`set`?{kind:`set`,to:o.to}:{kind:`clear`},c=oA({sessionId:i,projectDir:a.projectDir,cwd:a.cwd},JI(t,i));t.memento.move(c,s),t.dlog(`info`,`ceiling: ${r.join(` `)} (session=${i} claudeConfigDir=${c.claudeConfigDir})`)},$I=(e,t)=>{let[n=``,r=``]=uI(()=>oD(e)),i=cI(n),a=Object.values(t.configFor(DI(t,i)).actions).filter(e=>`slash`in e),o=a.find(e=>e.slash===r);if(o===void 0)throw new $(`${JSON.stringify(r)} is not a command this config declares (it declares: ${[...new Set(a.map(e=>e.slash))].join(`, `)||`none`})`);let s=nI(t.claudeInput,JI(t,i).tmux,o.slash);if(s.kind===`refused`)throw t.dlog(`warn`,`slash: ${r} refused — ${s.reason} (session=${i})`),new $(`${r} was not typed: ${s.reason}`);t.dlog(`info`,`slash: typed ${r} into ${s.pane} (session=${i})`)},eL=`config-override`,tL=new Map([[RE,fI],[`load-config`,(e,t)=>{let n=e.indexOf(`/`);if(n===-1)throw new $(`load-config: expected <sessionId>/<path> (missing separator)`);let r=cI(uI(()=>decodeURIComponent(e.slice(0,n)))),i=uI(()=>decodeURIComponent(e.slice(n+1))).trim();if(i!==``){if(!i.startsWith(`/`))throw new $(`load-config: path must be absolute, got "${i}"`);if(!/\.(json5?|json)$/.test(i))throw new $(`load-config: path must end with .json5 or .json, got "${i}"`)}i===``?(t.sessionState.clear(r,eL),t.dlog(`info`,`load-config: override cleared (session=${r})`)):(t.sessionState.set(r,eL,i),t.dlog(`info`,`load-config: ${i} (session=${r})`))}],[zE,pI],[IE,_I],[LE,bI],[UE,jI],[WE,MI],[JE,RI],[GE,NI],[KE,II],[qE,LI],[YE,VI],[XE,HI],[ZE,GI],[QE,UI],[$E,WI],[VE,mI],[HE,hI],[BE,gI],[eD,KI],[tD,XI],[nD,ZI],[rD,QI],[iD,$I]]),nL=new Set([IE,LE,UE,WE,JE,GE,KE,qE,YE,XE,ZE,QE,$E,BE,eD,tD,nD,rD,iD]),rL=(e,t)=>{let n=[],r=!1,i=null;for(let{verb:a,value:o}of uD(cD(e))){if(!i&&nL.has(a)){let e=oD(o);e.length>0&&e[0]&&(i=e[0])}let e=tL.get(a);if(!e){n.push(`unknown effect verb "${a}"`);continue}try{e(o,t)}catch(e){e instanceof $||(r=!0),n.push(`${a}: ${e instanceof Error?e.message:String(e)}`)}}if(n.length>0){i&&t.sessionState.set(i,`click.error`,n.join(`
198
- `));let e=`dispatch: ${n.join(`; `)}`;throw r?Error(e):new $(e)}};function iL(e){return(t,n)=>{let r=n.history.begin(),i=n.navigation.begin(r.sessionState),a=[];try{e(t,{...n,sessionState:r.sessionState,journal:r,navigating:i.sessionState})}catch(e){a.push(e)}i.commit();try{r.commit()}catch(e){a.push(e)}if(a.length===1)throw a[0];if(a.length>1)throw Error(a.map(e=>String(e.message??e)).join(`; `))}}const aL=new Map([...tL,[FE,rL]].map(([e,t])=>[e,iL(t)]));Object.freeze([...aL.keys()]);const oL=new Set([`hook_event_name`,`session_id`,`session_name`,`transcript_path`,`cwd`,`model`,`workspace`,`version`,`output_style`,`cost`,`context_window`,`exceeds_200k_tokens`,`effort`,`thinking`,`rate_limits`,`vim`,`agent`,`worktree`]),sL=[[`session_id`,`string`],[`transcript_path`,`string`],[`cwd`,`string`],[`model`,`object`],[`model.id`,`string`],[`model.display_name`,`string`],[`workspace`,`object`],[`workspace.current_dir`,`string`],[`workspace.project_dir`,`string`]],cL=[[`workspace.added_dirs`,`string-list`]];function lL(e){let t={missingRequired:[],typeMismatches:[],unknownTopLevelFields:[]},n=typeof e==`object`&&e&&!Array.isArray(e)?e:{};for(let[e,r]of sL){let i=fL(n,e);if(i==null)t.missingRequired.push(e);else{let n=uL(i);n!==r&&t.typeMismatches.push({path:e,expected:r,got:n})}}for(let[e,r]of cL){let i=fL(n,e),a=i===void 0?r:dL(i);a!==r&&t.typeMismatches.push({path:e,expected:r,got:a})}for(let e of Object.keys(n))oL.has(e)||t.unknownTopLevelFields.push(e);return{data:e,report:t}}function uL(e){return Array.isArray(e)?`array`:typeof e==`string`&&!e.isWellFormed()?`ill-formed string`:typeof e}function dL(e){return Array.isArray(e)&&e.every(e=>uL(e)===`string`)?`string-list`:uL(e)}function fL(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n||Array.isArray(n))return;n=n[e]}return n}function pL(e,t){switch(e){case`vars`:return{what:e,vars:mL(t)};case`segments`:return{what:e,segments:yL(t)};case`config`:return{what:e,config:CL(t)}}}function mL(e){if(e===null)return[];let{store:t,registry:n,config:r}=e,i=_L(r),a=t.names().sort(),o=[];for(let e of a){let r=t.getNode(e),a=n.getLastError(e);o.push({name:e,source:i.get(e)??null,...hL(r),lastError:a===void 0?null:{timestampMs:a.timestamp,message:a.message},ageMs:gL(r.lastUpdatedMs())})}return o}function hL(e){if(e.kind!==`document`)try{return{type:e.type,value:e.read()}}catch(t){return{type:e.type,value:t instanceof Error?t.message:String(t)}}let t=e.read();switch(t.kind){case`ok`:return{type:`document`,value:JSON.stringify(t.value)};case`absent`:return{type:`document`,value:`(not yet scanned)`};case`failed`:return{type:`document`,value:t.reason}}}function gL(e){return e===null?null:Math.max(0,Date.now()-e)}function _L(e){let t=new Map;for(let[n,r]of Object.entries(e.variables))t.set(n,vL(r));for(let[n,r]of Object.entries(e.segments))if(r.vars)for(let[e,i]of Object.entries(r.vars))t.set(`${n}.${e}`,vL(i));return t}function vL(e){return e.kind}function yL(e){if(e===null)return[];let{store:t,config:n,lastRenderBySegment:r}=e,i=new Set(t.names()),a=xL(n),o=bL(n),s=[];for(let e of a){let t=n.segments[e];t&&s.push({name:e,description:t.description??null,template:t.template,referencedVars:SL(t.template,n.helpers,i),placements:(o.get(e)??[]).map(e=>({id:e,lastRender:r.get(e)??null}))})}return s}function bL(e){let t=new Map;for(let n of C_(e.presets))for(let r of js(E_(e,n).node)){if(r.kind!==`segment`)continue;let e=t.get(r.name)??[],n=Ds(r);e.includes(n)||t.set(r.name,[...e,n])}return t}function xL(e){let t=[],n=new Set;for(let r of js(Nc(e.root)))r.kind===`segment`&&e.segments[r.name]&&!n.has(r.name)&&(t.push(r.name),n.add(r.name));for(let r of Object.keys(e.segments))n.has(r)||(t.push(r),n.add(r));return t}function SL(e,t,n){let r=new Set;for(let i of pv(e,t).keys()){if(n.has(i)){r.add(i);continue}let e=i.split(`.`);for(;e.length>1;){e.pop();let t=e.join(`.`);if(n.has(t)){r.add(t);break}}}return Array.from(r).sort()}function CL(e){return e===null?null:e.config}const wL=[`vars`,`segments`,`config`];function TL(e){return typeof e==`string`&&wL.includes(e)}function EL(e){return Math.max(1,e-2)}var DL=class{thresholds={LOW:50,MEDIUM:80};getContextUsageThresholds(){return this.thresholds}ratioPercentages(e,t){let n=Math.min(100,Math.max(0,Math.round(e/t*100)));return{percentage:n,contextLeftPercentage:Math.max(0,100-n)}}calculateContextFromHookData(e){let t=e.context_window;if(!t?.current_usage)return k(`No current_usage in hook data, falling back to transcript parsing`),null;let n=t.current_usage,r=t.context_window_size,i=(n.input_tokens||0)+(n.cache_creation_input_tokens||0)+(n.cache_read_input_tokens||0);k(`Native current_usage: input=${n.input_tokens}, cache_create=${n.cache_creation_input_tokens}, cache_read=${n.cache_read_input_tokens}, total=${i} (limit: ${r})`);let a=this.ratioPercentages(i,r);return{totalTokens:i,maxTokens:r,percentage:t.used_percentage==null?a.percentage:Math.round(t.used_percentage),contextLeftPercentage:t.remaining_percentage==null?a.contextLeftPercentage:Math.round(t.remaining_percentage)}}async calculateContextTokensFromTranscript(e,t){try{k(`Calculating context tokens from transcript: ${e}`);let n=await nM(e);if(n.length===0)return k(`No entries in transcript`),Y;let r=null;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t&&t.message?.usage?.input_tokens&&t.isSidechain!==!0){r=t,k(`Context segment: Found most recent entry at ${t.timestamp.toISOString()}, stopping search`);break}}if(r?.message?.usage){let e=r.message.usage,n=(e.input_tokens||0)+(e.cache_read_input_tokens||0)+(e.cache_creation_input_tokens||0);return k(`Most recent main chain context: ${n} tokens (limit: ${t})`),J({totalTokens:n,maxTokens:t,...this.ratioPercentages(n,t)})}return k(`No main chain entries with usage data found`),Y}catch(e){return X(`context transcript: ${e instanceof Error?e.message:String(e)}`)}}async getContextInfo(e){let t=this.calculateContextFromHookData(e);if(t)return J(t);let n=e.context_window?.context_window_size??2e5;return this.calculateContextTokensFromTranscript(e.transcript_path,n)}},OL=class{states=new Map;constructor(e,t,n=256){this.empty=e,this.step=t,this.maxSessions=n}async read(e,t){let n=this.states.get(e),r=qk(t);if(n&&r!==0&&n.cursor.mtimeMs===r)return this.touch(e,n),{kind:`ok`,value:n.value};let i=await oM(t,n?.cursor);if(i.kind===`failed`)return i;if(i.kind===`absent`)return{kind:`ok`,value:n?.value??this.empty};let{entries:a,cursor:o,reset:s}=i.value,c=s||n===void 0?this.empty:n.value;for(let e of a)c=this.step(c,e);for(this.touch(e,{cursor:o,value:c});this.states.size>this.maxSessions;){let e=this.states.keys().next().value;if(e===void 0)break;this.states.delete(e)}return{kind:`ok`,value:c}}touch(e,t){this.states.delete(e),this.states.set(e,t)}};const kL={messageCount:0,recent:[]};function AL(e,t){if(t.isSidechain)return e;let n=[...e.recent,t];return{messageCount:e.messageCount+ +!!eM(t),recent:n.length>20?n.slice(-20):n}}function jL(e){let t=null,n=null;for(let r of e){let e=r.type||r.message?.role||r.message?.type;if(eM(r))t=r.timestamp;else if(e===`assistant`&&t){let e=(r.timestamp.getTime()-t.getTime())/1e3;e>.1&&e<300&&(n=e)}}return n}var ML=class{fold=new OL(kL,AL);async getMetricsInfo(e,t){if(k(`Getting metrics from hook data for session: ${e}`),!t.cost)return Y;let n=await this.fold.read(e,t.transcript_path);return n.kind===`failed`?X(`metrics (${e}): ${n.reason}`):J({responseTime:t.cost.total_api_duration_ms/1e3,lastResponseTime:jL(n.value.recent),sessionDuration:t.cost.total_duration_ms/1e3,messageCount:n.value.messageCount,linesAdded:t.cost.total_lines_added,linesRemoved:t.cost.total_lines_removed})}};const NL={command:null,todos:[],pending:[],done:[]};function PL(e,t){let n=e.findIndex(e=>e.name===t);return n<0?[...e,{name:t,count:1}]:e.map((e,t)=>t===n?{name:e.name,count:e.count+1}:e)}function FL(e,t){if(t.isSidechain)return e;let n=eM(t)?{...e,command:t.activity?.command??null,pending:[],done:[]}:e,r=t.activity;if(r===void 0)return n;let i=n.pending,a=n.done;r.started!==void 0&&(i=[...i,...r.started]);for(let e of r.finished??[]){let t=i.findIndex(t=>t.id===e);t<0||(a=PL(a,i[t].name),i=[...i.slice(0,t),...i.slice(t+1)])}return{...n,pending:i,done:a,todos:r.todos??n.todos}}function IL(e){return{command:e.command,todos:e.todos,running:e.pending.reduce((e,t)=>PL(e,t.name),[]),done:e.done}}var LL=class{fold=new OL(NL,FL);async getActivityInfo(e,t){let n=await this.fold.read(e,t.transcript_path);return n.kind===`failed`?X(`activity (${e}): ${n.reason}`):J(IL(n.value))}};const RL=new Map;function zL(e){if(!e)return``;let t=e.indexOf(`,`);return t<0?e:e.slice(0,t)}var BL=class{async getSessionId(){if(!process.env.TMUX_PANE)return Y;let e=zL(process.env.TMUX),t=RL.get(e);if(t!==void 0)return t;k(`Getting tmux session ID, TMUX_PANE: ${process.env.TMUX_PANE}`);let n=await De({bin:`tmux`,args:[`display-message`,`-p`,`#S`],timeoutMs:1e3,category:`tmux`}),r=n.ok?n.stdout.trim()?J(n.stdout.trim()):Y:X(`tmux display-message: ${n.reason}`);return RL.set(e,r),r}isInTmux(){return!!process.env.TMUX_PANE}};const VL=e=>JSON.stringify([e.sessionId,e.projectDir,e.cwd,e.claudeConfigDir,e.env===void 0?null:Je.map(t=>e.env?.[t]??null)]);var HL=class{readings=new Map;inFlight=new Map;constructor(e,t=Date.now){this.edge=e,this.now=t}getCeiling(e){let t=VL(e),n=this.readings.get(t);if(n&&this.now()-n.at<1e4)return Promise.resolve(n.outcome);let r=this.inFlight.get(t)??this.fetch(t,e);return n?Promise.resolve(n.outcome):r}fetch(e,t){let n=this.edge.locate(t),r=(n.kind===`ok`?this.edge.read(n.value,t):Promise.resolve(n)).then(t=>{if(this.inFlight.get(e)!==r)return t;for(this.readings.delete(e),this.readings.set(e,{outcome:t,at:this.now()});this.readings.size>64;)this.readings.delete(this.readings.keys().next().value);return t}).finally(()=>{this.inFlight.get(e)===r&&this.inFlight.delete(e)});return this.inFlight.set(e,r),r}move(e,t){let n=this.edge.locate(e);if(n.kind!==`ok`)throw Error(n.kind===`failed`?n.reason:`memento is not installed or not enabled for this project`);let r=VL(e);try{this.edge.move(n.value,e,t)}finally{this.readings.delete(r),this.inFlight.delete(r),this.fetch(r,e)}}},UL=class{written=new Map;constructor(e){this.dir=e}pathFor(e){return c.join(this.dir,`${encodeURIComponent(e)}.txt`)}sync(e,t){let n=this.pathFor(e);if(t===(this.written.get(e)??null))return null;try{return t===null?(r.rmSync(n,{force:!0}),this.written.delete(e)):(r.mkdirSync(this.dir,{recursive:!0,mode:448}),r.writeFileSync(n,t,{mode:384}),this.written.set(e,t)),null}catch(e){return`${n}: ${e.message}`}}reset(){this.written.clear();try{return r.rmSync(this.dir,{recursive:!0,force:!0}),null}catch(e){return`${this.dir}: ${e.message}`}}};const WL=new vP;Te(WL.launchStats);const GL=new qy({counters:WL,logger:Q}),KL=new tb({watchers:GL,logger:Q}),qL=new yM,JL=new SP,YL=new xF(JL,Q),XL=new UF,ZL=new UL(Ke()),QL=new DL,$L=new ML,eR=new LL,tR=new BL,nR=new HL(_A()),rR=new gP({gitService:KL,sessionState:JL,watchers:GL},{observers:{onReload:e=>Q(`info`,`config loaded projectDir=${e.projectDir} cwd=${e.cwd} file=${e.configFilePath??`<bundled default>`} error=${e.lastError===null?`none`:JSON.stringify(e.lastError)} warning=${e.lastWarning===null?`none`:JSON.stringify(e.lastWarning)}`)}}),iR=60*1e3;function aR(){let e=import.meta.url,n=[];e.startsWith(`file://`)&&n.push(D(e)),t.argv[1]&&n.push(t.argv[1]);let i=new Map;for(let e of n)try{i.set(e,r.statSync(e).mtimeMs)}catch{}let a=null,o=()=>{for(let[e,t]of i)try{if(r.statSync(e).mtimeMs!==t){Q(`info`,`binary mtime changed (${e}); shutting down`),a&&clearInterval(a),xR(0);return}}catch(e){Q(`warn`,`bin stat failed: ${e.message}`)}};return{arm(){i.size!==0&&(a=setInterval(o,iR),a.unref())},checkNow:o}}const oR=aR(),sR=Uj({entryUrl:import.meta.url,intervalMs:iR,releaseIntervalMs:216e5,registryUrl:t.env.CC_CANDYBAR_REGISTRY_URL??`https://registry.npmjs.org`,fetchImpl:fetch,onApplied:()=>oR.checkNow(),log:Q});let cR=null,lR=null,uR=0;function dR(){t.on(`uncaughtException`,e=>{Q(`error`,`uncaughtException: ${e.stack||e.message}`),xR(1)}),t.on(`unhandledRejection`,e=>{Q(`error`,`unhandledRejection: ${String(e)}`),xR(1)});for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])t.on(e,()=>{Q(`info`,`received ${e}, shutting down`),xR(0)});try{uR=sE(t.env)}catch(e){Q(`error`,`refusing to boot: ${e.message}`),xR(1);return}cR=fO(t.pid);let e=SO(wO(cR));if(!e.decision.allow){Q(`warn`,`fork-bomb breaker: ${e.decision.reason}; refusing to boot`),xR(1);return}lR=e.registryPath,r.mkdirSync(Pe(),{recursive:!0}),Le(Fe()),JL.useStorage(new TP(Be(),500,Q)),YL.useStorage(VF(Ve(),Q)),hO({anchor:mO(t.env),isAlive:gO,onOrphaned:e=>{Q(`info`,`parent watchdog: ${e}; shutting down`),xR(0)}}),fR(b.createServer({allowHalfOpen:!1},e=>{SR(e)}),Fe(),!1)}function fR(e,n,r){e.removeAllListeners(`error`),e.removeAllListeners(`listening`),e.once(`error`,i=>{if(i.code!==`EADDRINUSE`){Q(`error`,`server error: ${i.message}`),xR(1);return}if(r){Q(`info`,`lost rebind race; another daemon is alive — exiting`),t.exit(0);return}pR(e,n)}),e.listen(n,()=>mR(n))}function pR(e,n){let i=nO(rO(Re(n)),(e,t)=>dO(e,t,{readStartTime:uO,pidAlive:gO}));if(i.kind===`attach-and-exit`){Q(`info`,`EADDRINUSE: ${i.reason} — exiting`),t.exit(0);return}Q(`warn`,`EADDRINUSE: ${i.reason} — unlinking stale socket and rebinding`);try{r.unlinkSync(n)}catch(e){if(e.code!==`ENOENT`){Q(`error`,`cannot unlink stale socket ${n}: ${e.message}`),xR(1);return}}fR(e,n,!0)}function mR(e){let n=oO(e);if(n.kind!==`present`){Q(`warn`,`no ownable socket at bind callback (${n.kind}); exiting`),xR(0);return}vR(e);try{r.chmodSync(e,384)}catch(e){Q(`warn`,`chmod socket failed: ${e.message}`)}Q(`info`,`daemon up: pid=${t.pid} v=3 sock=${e} heapCap=${Math.round(te.getHeapStatistics().heap_size_limit/1048576)}MB rssLimit=${Math.round(uR/1048576)}MB`),wE();let i=ZL.reset();i!==null&&Q(`warn`,`diagnostic dump wipe failed: ${i}`),oR.arm(),sR.arm(),_R(),hR(e,n.identity)}function hR(e,n){lO({bound:n,myPid:t.pid,readIdentity:()=>oO(e),readLease:()=>rO(Re(e)),shutdown:e=>xR(e),log:Q}).arm()}let gR=null;function _R(){gR=dE(hE(WL.startedAt.getTime(),e=>xR(e),{rssLimitBytes:uR})),gR.arm()}function vR(e){let n=iO(Re(e),{pid:t.pid,version:3,binPath:t.argv[1],startTime:cR});n!==null&&Q(`warn`,`lease write failed: ${n}`)}let yR=0,bR=!1;function xR(e){if(!bR){bR=!0,setTimeout(()=>t.kill(t.pid,`SIGKILL`),500);try{KL.close()}catch(e){Q(`warn`,`gitService close failed: ${e.message}`)}try{qL.close()}catch(e){Q(`warn`,`usageStore close failed: ${e.message}`)}try{GL.closeAll()}catch(e){Q(`warn`,`watcherRegistry close failed: ${e.message}`)}try{JL.flush()}catch(e){Q(`warn`,`sessionState flush failed: ${e.message}`)}aO(ze(),t.pid),lR!==null&&CO(lR,t.pid,bO,e=>r.unlinkSync(e)),t.exit(e)}}function SR(e){yR++,WL.inFlight=yR;let t=!1,n=(n,r)=>{if(t){r!==null&&Q(`warn`,`exit-after-flush dropped: an earlier responder settled this socket`);return}t=!0;let i=r===null?void 0:()=>xR(r);try{e.end(PT(n),i)}catch(e){Q(`warn`,`response write failed: ${e.message}`),i?.()}},r=setTimeout(()=>{WL.requestsTimedOut++,n({ok:!1,error:`request exceeded 200ms`,code:`TIMEOUT`,daemonV:3},null)},200),i=FT(e=>{wR(e).then(e=>n(e.resp,e.exitAfterFlush)).catch(e=>{Q(`error`,`handler threw: ${e?.stack||e}`),n({ok:!1,error:String(e?.message||e),code:`RENDER_FAILED`,daemonV:3},null)})},e=>{Q(`warn`,`frame parse failed: ${e.message}`),n({ok:!1,error:e.message,code:`BAD_REQUEST`,daemonV:3},null)});e.on(`data`,i),e.on(`error`,e=>{Q(`warn`,`socket error: ${e.message}`)}),e.on(`close`,()=>{clearTimeout(r),yR=Math.max(0,yR-1),WL.inFlight=yR})}const CR=e=>({resp:e,exitAfterFlush:null});async function wR(e){if(!e||typeof e!=`object`||typeof e.v!=`number`)return CR({ok:!1,error:`malformed request`,code:`BAD_REQUEST`,daemonV:3});if(e.v!==3)return e.v>3?Q(`info`,`version mismatch: client=${e.v} > daemon=3; binary likely upgraded — exiting after the response flushes`):Q(`info`,`version mismatch: client=${e.v} < daemon=3; client is stale — staying up`),{resp:{ok:!1,error:`protocol v${e.v} not supported (daemon at v3)`,code:`VERSION_MISMATCH`,daemonV:3},exitAfterFlush:e.v>3?0:null};if(e.kind===`shutdown`)return{resp:{ok:!0,output:``},exitAfterFlush:0};if(e.kind===`stats`)return CR({ok:!0,stats:WL.snapshot({gitCache:KL.getStats(),usageCache:qL.getStats(),renderCacheSize:rR.size,watchersActive:GL.size(),nextRestartReason:gR?.describeNextRestart()??null})});if(e.kind===`render`){WL.requestsTotal++;let t=Date.now();try{let{report:n}=lL(e.hookData);for(let e of n.unknownTopLevelFields)Q(`info`,`schema: unknown field '${e}' — Anthropic may have added it`);let r=[];for(let e of n.missingRequired)r.push(`missing required field '${e}'`);for(let{path:e,expected:t,got:i}of n.typeMismatches)r.push(`field '${e}' expected ${t}, got ${i}`);if(e.cwd===``&&r.push(`request 'cwd' is empty`),r.length>0)return WL.requestsErrored++,Q(`warn`,`BAD_REQUEST: ${r.join(`; `)}`),CR({ok:!1,error:`malformed hookData: ${r.join(`; `)}`,code:`BAD_REQUEST`,daemonV:3});let i=e.hookData.workspace.project_dir,{configFile:a,unknownFlagsError:o}=TR(e.args),s=e.hookData.session_id,c=TT(e),l=JSON.stringify(c);JL.get(s,`client-hints`)!==l&&JL.set(s,qI,l);let u=JL.get(s,`config-override`)??a??c.configEnv,d=rR.getOrCreate(i,e.cwd,u),f=TI({projectDir:i,cwd:e.cwd,configFile:u??null});JL.get(s,`render-origin`)!==f&&JL.set(s,wI,f);let p=c.termCols,m=EL(p??120),h=VO(c.termRows),{authoredRoots:g}=d.state,_=t=>JL.get(e.hookData.session_id,t),v=yA(d.state.config,_,e=>g.has(e)),y=await IA(e.hookData,AR,e.cwd,d.state.neededInputPaths(v.preset),v,c,{...cj(d.state.config,d.state.fileHeldSettings,_),configPath:d.configFilePath}),b=[],x=bA(v,m),S=nP(d.state.config,d.state.compiled,d.state.store,d.state.registry,y,x,{perSegmentSink:d.state.lastRenderCellsBySegment,onRenderWarning:e=>b.push(e)},xA(v)),C=JL.get(e.hookData.session_id,`click.error`);C&&JL.clear(e.hookData.session_id,`click.error`);let w=[o,d.lastError,C].filter(Boolean).join(`
199
- `),T=sR.notice({sessionId:s,dismissed:JL.get(s,Oj),enabled:v.updateNotice}),ee=d.lastError===null?null:d.configFilePath,te=KO(w,T,[d.lastWarning??``,...b].filter(Boolean).join(`
200
- `)),E=ZL.sync(s,te===null?null:JO(te));E!==null&&Q(`warn`,`diagnostic dump failed: ${E}`);let ne=YO(S,te,{fullText:E===null?{kind:`file`,path:ZL.pathFor(s)}:{kind:`unavailable`,reason:E},failedConfigFile:ee},{width:m,rowCap:h,colorCompatibility:v.colorCompatibility}),D=Date.now()-t,O=KL.getStats(),re=qL.getStats();return Q(`info`,`render sid=${e.hookData.session_id??`?`} took=${D}ms termCols=${p??`?`} termRows=${c.termRows??`?`} width=${m} git=${O.size}/${O.hits}h/${O.misses}m usage=${re.size}/${re.hits}h/${re.misses}m err=${w?`Y`:`N`} upd=${T.length} warn=${d.lastWarning?`Y`:`N`}`),CR({ok:!0,output:ne+`
201
- `})}catch(e){throw WL.requestsErrored++,e}}if(e.kind===`click`)return CR(await jR(e.verb,e.value));if(e.kind===`debug`){if(!TL(e.what))return CR({ok:!1,error:`unknown debug 'what': ${String(e.what)} (have: ${wL.join(`, `)})`,code:`BAD_REQUEST`,daemonV:3});let t=rR.firstState(),n=t===null?null:{store:t.store,registry:t.registry,config:t.config,compiled:t.compiled,lastRenderBySegment:e.what===`segments`?kR(t.lastRenderCellsBySegment,t.config.globals.charset??`unicode`,t.config.globals.colorCompatibility??`truecolor`):OR};return CR({ok:!0,debug:pL(e.what,n)})}return CR({ok:!1,error:`unknown kind`,code:`BAD_REQUEST`,daemonV:3})}function TR(e){let{values:t,tokens:n}=v({args:e.slice(1),options:{config:{type:`string`}},strict:!1,tokens:!0,allowPositionals:!0}),r=[...new Set((n??[]).filter(e=>e.kind===`option`&&e.name!==`config`).map(e=>`--${e.name}`))];return{configFile:OT(t.config),unknownFlagsError:r.length>0?`Unknown flags: ${r.join(`, `)}`:null}}const ER={sessionState:JL,dlog:Q,applyUpdate:()=>sR.act(),doctor:KF(),memento:nR,claudeInput:sI(),history:YL,navigation:XL,configFor:e=>rR.getOrCreate(e.projectDir,e.cwd,e.configFile??void 0).state.config,reloadConfig:e=>rR.reload(e.projectDir,e.cwd,e.configFile??void 0)};ER.reloadConfig;const DR={endcaps:`powerline`,colorCompatibility:`truecolor`,wrap:!0,padding:1,charset:ho,width:1/0},OR=new Map;function kR(e,t,n){let r=new Map;for(let[i,a]of e)r.set(i,BO(a,{...DR,charset:t,colorCompatibility:n}));return r}const AR={gitProvider:KL,usageStore:qL,contextProvider:QL,metricsProvider:$L,activityProvider:eR,tmuxService:tR,mementoProvider:nR,autoCompact:Nk,log:Q,clock:()=>new Date,history:e=>YL.depth(e),navigation:e=>XL.depth(e,JL)};function jR(e,t){let n=aL.get(e);if(!n)return{ok:!1,error:`unknown click verb: ${e}`,code:`BAD_REQUEST`,daemonV:3};try{return n(t,ER),{ok:!0,output:``}}catch(e){let t=e instanceof $?`BAD_REQUEST`:`RENDER_FAILED`;return{ok:!1,error:String(e instanceof Error?e.message:e),code:t,daemonV:3}}}const MR={connectMs:200,budgetMs:500};async function NR(e){let n=e.includes(`--json`),r=await PR();if(r.kind!==`ok`&&(t.stderr.write(`daemon-stats: ${UT(r)}\n`),t.exit(1)),n){t.stdout.write(JSON.stringify(r.value,null,2)+`
202
- `);return}t.stdout.write(RR(r.value))}function PR(){return LT({kind:`stats`},MR,e=>`stats`in e?e.stats:void 0)}function FR(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function IR(e,t){let n=e+t;return n===0?`n/a`:`${(e/n*100).toFixed(1)}%`}function LR(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m${e%60}s`:`${Math.floor(e/3600)}h${Math.floor(e%3600/60)}m`}function RR(e){let t=[];t.push(`cc-candybar daemon stats`),t.push(``),t.push(`process`),t.push(` pid ${e.pid}`),t.push(` version ${e.version}`),t.push(` protocol ${e.protocolVersion}`),t.push(` startedAt ${e.startedAt}`),t.push(` uptime ${LR(e.uptimeSec)}`),t.push(` rss ${FR(e.rssBytes)}`),t.push(` heapUsed ${FR(e.heapUsedBytes)}`),t.push(` heapTotal ${FR(e.heapTotalBytes)}`),t.push(` external ${FR(e.externalBytes)}`),t.push(` arrayBuffers ${FR(e.arrayBuffersBytes)}`),t.push(``),t.push(`requests`),t.push(` total ${e.requests.total}`),t.push(` errored ${e.requests.errored}`),t.push(` timedOut ${e.requests.timedOut}`),t.push(` inFlight ${e.requests.inFlight}`),t.push(``),t.push(`gitCache`),t.push(` size ${e.gitCache.size}`),t.push(` hit rate ${IR(e.gitCache.hits,e.gitCache.misses)} (${e.gitCache.hits} / ${e.gitCache.hits+e.gitCache.misses})`),t.push(` invalidations ${e.gitCache.invalidations}`),t.push(``),t.push(`usageCache`),t.push(` size ${e.usageCache.size}`),t.push(` hit rate ${IR(e.usageCache.hits,e.usageCache.misses)} (${e.usageCache.hits} / ${e.usageCache.hits+e.usageCache.misses})`),t.push(` sweeps ${e.usageCache.sweeps}`),t.push(``),t.push(`renderCache`),t.push(` size ${e.renderCache.size}`),t.push(`watchers`),t.push(` active ${e.watchers.active}`),t.push(` opened ${e.watchers.opened}`),t.push(` closed ${e.watchers.closed}`),t.push(` evicted ${e.watchers.evicted}`),t.push(``),t.push(`subprocesses`),t.push(` total ${e.subprocesses.total}`),t.push(` inFlight ${e.subprocesses.inFlight}`),t.push(` lastMinute ${e.subprocesses.lastMinute}`);let n=Object.entries(e.subprocesses.byCategory),r=n.reduce((e,[t])=>Math.max(e,t.length),13);for(let[i,a]of n){let n=e.subprocesses.p50DurationMs[i],o=e.subprocesses.p99DurationMs[i],s=n!==void 0&&o!==void 0?` (p50 ${n}ms · p99 ${o}ms)`:``;t.push(` ${i.padEnd(r)} ${a}${s}`)}return e.nextRestartReason&&(t.push(``),t.push(`nextRestart ${e.nextRestartReason}`)),t.join(`
194
+ `);n.push(e[0]);for(let r=1;r<e.length;r++)t.push(n),n=[e[r]]}return t.push(n),t}function BN(e,t){let n=t.flatMap(e=>e.filter(e=>e.place===`above`)),r=t.map(e=>e.filter(e=>e.place===`flow`));return[...n,...VN(e,r)]}function VN(e,t){switch(e){case`vertical`:return t.flatMap(e=>e);case`horizontal`:return t.reduce((e,t)=>Math.max(e,t.length),0)===0?[]:[{cells:t.flatMap(e=>e[0]?.cells??[]),band:`own`,place:`flow`},...t.flatMap(e=>e.slice(1))]}}function HN(e,t){let n=(e,r)=>t(e)?e.kind===`segment`?[{cells:[{name:e.name,address:r,settings:e.settings}],band:`own`,place:`flow`}]:BN(e.direction,e.children.map((t,i)=>n(t,[...r,UN(e,i)]))):[];return n(e,[]).map(e=>[...e.cells])}function UN(e,t){return{index:t,count:e.children.length,distribution:e.distribution,axis:ws[e.direction]}}const WN={compile(e,t){return{kind:`container`,direction:e.direction,when:t.when,distribution:da(e.distribution),children:e.children.map((e,n)=>t.compileChild(e,As(t.path,n)))}},render(e,t){return BN(e.direction,e.children.map((n,r)=>t.renderChild(n,t.visible,UN(e,r))))}},GN={drop:e=>e.place,above:()=>`above`},KN={drop:(e,t)=>({lead:t(),stays:e}),above:e=>({lead:e.slice(0,1).flatMap(e=>e.cells),stays:e.slice(1)})},qN={compile(e,t){return{kind:`segment`,when:t.when,name:e.name,id:Ts(e),settings:t.placementSettings(e),...e.opens!==void 0&&{opens:{open:t.parse(qc(e.opens.ref),`opens`),body:t.compileChild(e.opens.body,js(t.path)),key:e.opens.ref.key,placement:e.opens.placement}},...e.lead!==void 0&&{lead:t.parse(e.lead,`lead`)},...e.trail!==void 0&&{trail:t.parse(e.trail,`trail`)}}},render(e,t){let n=t.lookupSegment(e.name);if(!n)throw Error(`Layout segment "${e.name}" has no matching segment`);let{seg:r,compiled:i}=n;if(!t.visible)return[];let a=xy(t.scope,e.settings);try{if(!TM(i.when,a))return[];let n=Bb(e.settings.theme,t.palette),o=e.opens!==void 0&&TM(e.opens.open,t.scope),{styles:s,fragments:c,lead:l,trail:u,drops:d,open:f}=t.evaluateSegment(e,a,n,t.region,{bg:i.bg,fg:i.fg,body:i.template,lead:e.lead,trail:e.trail},o),p=f?s.trigger:s.closed,m={width:r.width??`auto`,justify:r.justify??`left`,truncate:r.truncate??`right`,baseStyle:p,padding:t.padding},h=e.opens,g=h===void 0?[]:t.renderBody(h.body,o,s.disclosure).map(e=>({...e,place:GN[h.placement](e)})),_=zN(PM(c,p)).map((e,t)=>({cells:AM(e,{...m,lead:t===0?PM(l,p):[],trail:t===0?PM(u,p):[]}),band:`own`,place:`flow`})),v=d.map(e=>({cells:AM(PM([e],s.band),{...m,baseStyle:s.band}),band:`deeper`,place:`flow`})),y=(e,t,n)=>AM(PM([e],t),{...m,width:`auto`,baseStyle:t,padding:n}),b=g.findIndex(e=>e.band===`own`),{lead:x,stays:S}=h!==void 0&&b!==-1?KN[h.placement](_,()=>y(t.closeDisclosure(h.key),s.close,t.padding)):{lead:[],stays:_},C=x.flatMap(e=>y(new U(` `.repeat(OM(e).reduce((e,t)=>e+t.cellLength,0))),s.trigger,0)),w=(e,t)=>e.band===`own`?t===b?x:C:[],T=g.map((e,t)=>({cells:[...w(e,t),...e.cells],band:`deeper`,place:e.place})),ee=[...S,...v];return t.perSegmentSink!==void 0&&t.perSegmentSink.set(e.id,[...ee.flatMap(e=>e.cells),...g.flatMap(w)].flatMap(OM)),[...ee,...T]}catch(n){let r=n.message??String(n);t.onSegmentError?.(e.id,r);let i=r.replace(/\s*\n\s*/g,` `);return[{cells:AM([new U(`⚠ ${e.id}: ${i}`,{end:``})],{width:`auto`,justify:`left`,truncate:`right`,padding:0,lead:JN(e.lead,e,a,t),trail:JN(e.trail,e,a,t)}),band:`own`,place:`flow`}]}}};function JN(e,t,n,r){if(e===void 0)return[];try{return r.evaluateSegment(t,n,r.palette,r.region,{bg:void 0,fg:void 0,body:e,lead:void 0,trail:void 0},!1).fragments}catch(e){return r.onSegmentError?.(t.id,e.message??String(e)),[]}}const YN={container:WN,segment:qN};function XN(e){return YN[e]}function ZN(e){if(`ttl`in e)return{kind:`ttl`,durationMs:cb(e.ttl)};if(`watch_file`in e)return{kind:`watch_file`,path:e.watch_file};if(`depends_on`in e)return{kind:`depends_on`,varNames:e.depends_on};if(`key`in e)return{kind:`key`,template:e.key};if(`never`in e)return{kind:`never`};throw Error(`Unknown CacheDecl discriminator — loader invariant violated: ${JSON.stringify(e)}`)}function QN(e,t){switch(Ps(e)){case`json`:return{kind:`json`,default:t};case`regex`:return{kind:`regex`,regex:new RegExp(e.regex),default:t};case`text`:return{kind:`text`,default:t}}}function $N(e,t,n,r){switch(n.kind){case`literal`:e.declareLiteral(t,n.value);break;case`input`:e.declareInput(t,n.path,n.type??`string`,n.default);break;case`env`:e.declareEnv(t,n.name,n.default);break;case`file`:e.declareFile(t,n.path,{readMode:n.readMode,cache:ZN(n.cache),parse:QN(n.parse,n.default)});break;case`shell`:e.declareShell(t,n.command,{cwd:r,cache:ZN(n.cache),parse:QN(n.parse,n.default)});break;case`template`:e.declareTemplate(t,n.template,{varDefault:n.default});break;case`time`:e.declareTime(t,{format:n.layout,ttlMs:n.cache?cb(n.cache.ttl):void 0,varDefault:n.default});break;case`git`:e.declareGit(t,{field:n.field,cwd:r,varDefault:n.default});break;case`state`:e.declareState(t,{key:n.key,...n.default!==void 0&&{varDefault:n.default}});break}}function eP(e,t){let n=Kd.EMPTY;for(let[r,i]of Object.entries(t))try{n=e.parse(`{{ define "${r}" }}${i}{{ end }}`,n).defines()}catch(e){throw Error(`Template parse error in helpers.${r}: ${e.message}`,{cause:e})}return n}const tP=e=>vo(void 0,null,e.globals.variation);function nP(e,t,n){let r=n.cwd,i=qb(e.globals.palette),a={store:t.variableStore,compiled:new Map,chromeCols:WO({endcaps:`powerline`,charset:po}),width:80,basePalette:i,palette:i,variation:na[tP(e)],padding:1,seamCols:GO({endcaps:`powerline`,charset:po}),layout:()=>[]},o=oN(t.drawnAt),s={action:a,activeSegment:o},c=Object.keys(e.styles),l=w_(e.presets),u=new Map([...Zb(e),...DC(e)]),d=vy({...YM(a),...vN(a,o),...xN(a,o),...TN(a,o),...AN(a,o),...PN(s),...LN(o),styles:{fn:()=>c,argTypes:[],arity:{kind:`exact`}},presets:{fn:()=>l,argTypes:[],arity:{kind:`exact`}}},n.clock,t.drawnAt),f=eP(d,e.helpers),p=e=>d.parse(e,f),m=new Map,h=e=>{let t=m.get(e);if(t!==void 0)return t;let n=p(e);return m.set(e,n),n},g=new Map;for(let[t,n]of Mb)n in e.variables&&g.set(t,n);for(let[t,n]of Object.entries(e.variables))n.kind===`state`&&!g.has(n.key)&&g.set(n.key,t);for(let[t,n]of Object.entries(e.segments))if(n.vars)for(let[e,r]of Object.entries(n.vars))r.kind===`state`&&!g.has(r.key)&&g.set(r.key,`${t}.${e}`);a.compiled=RM(p,e.actions,g,u);let _=[];for(let[n,i]of Object.entries(e.variables))try{$N(t,n,i,r)}catch(e){_.push(`Variable "${n}": ${e.message??String(e)}`)}for(let[n,i]of Object.entries(e.segments))if(i.vars)for(let[e,a]of Object.entries(i.vars))try{$N(t,`${n}.${e}`,a,r)}catch(t){_.push(`Variable "${n}.${e}": ${t.message??String(t)}`)}let v=Object.create(null);for(let[t,n]of Object.entries(e.segments)){let e=(e,n,r=p)=>{try{return r(e)}catch(e){throw Error(`Template parse error in segments.${t}.${n}: ${e.message}`,{cause:e})}};v[t]={when:n.when===void 0?void 0:e(n.when,`when`,h),template:e(n.template,`template`),bg:n.bg===void 0?void 0:e(n.bg,`bg`),fg:n.fg===void 0?void 0:e(n.fg,`fg`)}}let y=(e,t,n)=>{try{return h(e)}catch(e){throw Error(`Template parse error in ${t}.${n}: ${e.message}`,{cause:e})}},b=t.variableStore,x=t=>{let n=Bs(e.segments[t.name]),r=Object.create(null);for(let[e,i]of Object.entries(n)){let n=t.settings?.[e]??i.default,a=t.drafts?.[e];Object.defineProperty(r,e,{enumerable:!0,get:a===void 0?()=>n:()=>Gs(i,String(b.read(a.variable)))??n})}return Object.freeze(r)},S=(e,t)=>{let n={path:t,when:e.when===void 0?void 0:y(e.when,t,`when`),parse:(e,n)=>y(e,t,n),compileChild:S,placementSettings:x};return XN(e.kind).compile(e,n)},C=new Map;for(let t of l){let{node:n,path:r}=D_(e,t);C.set(t,S(n,r))}let w=new Map(eo.map(e=>[e,new Map])),T=[[`globals`,e.globals],...Object.entries(e.presets).map(([e,t])=>[`presets.${e}.globals`,t.globals??{}])];for(let[e,t]of T)for(let n of eo){let r=t[n];if(!to(r))continue;let i=`${e}.${n}`,a=w.get(n),o=a.get(r);a.set(r,o===void 0?{where:i,template:rP(p,i,r)}:{where:`${o.where}, ${i}`,template:o.template})}return{segments:v,roots:C,activeSegment:o,menuRuntime:s,globalExpressions:w,loadWarnings:_}}function rP(e,t,n){try{return e(n)}catch(e){throw Error(`${t} is not a valid template: ${e instanceof Error?e.message:String(e)}`)}}function iP(e,t,n){let r=e.globalExpressions.get(t).get(n);if(r===void 0)throw Error(`the ${t} rule ${JSON.stringify(n)} reached the render but no compiled template exists — registerDslConfig and the resolution disagree about isExpression`);return r}function aP(e,t){return e.template.evaluate(t).map(e=>e.plain).join(``)}function oP(e,t){return e.kind===`decided`?e.name:t}function sP(e,t,n,r,i,a,o,s){let{perSegmentSink:c,onSegmentError:l,onRenderWarning:u}=o??{};r.drawAt(ho(a.colorCompatibility));let{preset:d=S_}=s??{},f=O_(e,d),p=na[s?.variation??vo(void 0,null,f.variation)];t.menuRuntime.action.variation=p;let m=s?.style??oo(`none`,e.styles),h=s?.theme??Gb(void 0,null,f.palette),g=(e,t)=>({...i,term:{cols:a.width},theme:{effective:e},style:{effective:t}});r.applyInput(g(oP(h,qa),oP(m,io))),t.menuRuntime.action.chromeCols=WO(a),t.menuRuntime.action.padding=a.padding,t.menuRuntime.action.width=a.width,t.menuRuntime.action.seamCols=GO(a);let _=yy(n),v=ro(h,e=>{let n=iP(t,`palette`,e);return Wb(aP(n,_),n.where,e=>u?.(e))}),y=ro(m,n=>oo(aP(iP(t,`style`,n),_),e.styles));(v!==h||y!==m)&&r.applyInput(g(v.name,y.name));let b=v.value;t.menuRuntime.action.basePalette=b;let x=Hb(b,y.value);t.menuRuntime.action.palette=x,c?.clear();let S=n=>{let r=e.segments[n],i=t.segments[n];return r!==void 0&&i!==void 0?{seg:r,compiled:i}:void 0},C=(e,n,i,a,o,s)=>{try{let c=r.drawnAt(),{tint:l,disclosure:u}=Wa(i,a,c),d=sN(t.activeSegment,e.name,e.id,i,u,l),f=hx(d,c,o.bg,o.fg,n),p=()=>Na(i,u,c).state;s&&(d.bg=p());let m=o.body.evaluate(n),h=d.drops.length>0||s;h&&(d.bg=p());let g=o.lead?.evaluate(n)??[],_=o.trail?.evaluate(n)??[];return{styles:{closed:f,get trigger(){return ZM(i,p(),c)},get band(){return ZM(i,Na(i,u,c).plane,c)},get close(){return $M(i,p(),c)},disclosure:u},fragments:m,lead:g,trail:_,drops:d.drops,open:h}}finally{t.activeSegment.current=null}},w=(e,t,r)=>{let i=t&&TM(e.when,_),o={scope:_,palette:x,visible:i,padding:a.padding,region:r,perSegmentSink:c,onSegmentError:l,evaluateSegment:C,lookupSegment:S,renderChild:(e,t,n)=>w(e,t,Ha(r,n)),renderBody:(e,t,n)=>w(e,i&&t,Ua(n)),closeDisclosure:e=>XM(n,e)};return XN(e.kind).render(e,o)},T=t.roots.get(d);if(T===void 0)throw Error(`Preset "${d}" has no compiled layout — registerDslConfig compiles one per declared preset and effectivePresetName collapses unknown names to "${S_}"; a miss here is merge/policy drift (have: ${[...t.roots.keys()].join(`, `)})`);let ee=e=>{if(!TM(e.when,_))return!1;if(e.kind===`container`)return!0;if(IC(e.name)===void 0)return!1;try{return TM(t.segments[e.name].when,xy(_,e.settings))}catch{return!0}};return t.menuRuntime.action.layout=()=>HN(T,ee).map(e=>e.flatMap(({name:e,address:t,settings:n})=>{let r=IC(e);return r===void 0?[]:[{name:r,address:t,palette:Bb(n.theme,x)}]})),w(T,!0,Va(p)).map(e=>KO(NM(e.cells,a),a)).join(`
195
+ `)}var cP=class{kind=`box`;cell;lastChangedAt;constructor(e,t,n){this.name=e,this.type=t,mP(e,t,n,`initial value`),this.cell=wv.observable.box(n,{deep:!1}),this.lastChangedAt=Date.now()}read(){return this.cell.get()}set(e){mP(this.name,this.type,e,`set value`),!Object.is(this.cell.get(),e)&&(this.cell.set(e),this.lastChangedAt=Date.now())}lastUpdatedMs(){return this.lastChangedAt}},lP=class{kind=`computed`;cell;constructor(e,t,n){this.name=e,this.type=t,this.cell=(0,wv.computed)(()=>{let e=n();return mP(this.name,this.type,e,`computed result`),e},{keepAlive:!0})}read(){return this.cell.get()}lastUpdatedMs(){return null}},uP=class{kind=`document`;cell;lastChangedAt;constructor(e,t){this.name=e,this.cell=wv.observable.box(pP(t),{deep:!1}),this.lastChangedAt=Date.now()}read(){return this.cell.get()}set(e){let t=pP(e);fP(this.cell.get(),t)||(this.cell.set(t),this.lastChangedAt=Date.now())}lastUpdatedMs(){return this.lastChangedAt}};function dP(e){return JSON.stringify(e)}function fP(e,t){return dP(e)===dP(t)}function pP(e){return e.kind===`ok`?{kind:`ok`,value:Tv(e.value)}:e}function mP(e,t,n,r){let i=Ev(n);if(i!==t)throw TypeError(`Variable "${e}": ${r} type ${i} does not match declared type ${t}`)}var hP=class{nodes=new Map;defineBox(e,t,n){this.assertNotDefined(e),this.nodes.set(e,new cP(e,t,n))}defineDocument(e,t){this.assertNotDefined(e),this.nodes.set(e,new uP(e,t))}defineComputed(e,t,n){this.assertNotDefined(e);let r=e=>this.read(e);this.nodes.set(e,new lP(e,t,()=>n(r)))}read(e){return this.requireVar(e).read()}readDocument(e){let t=this.requireNode(e);if(t.kind!==`document`)throw TypeError(`Variable "${e}" is a ${t.kind}, not a document`);return t.read()}setDocument(e,t){let n=this.requireNode(e);if(n.kind!==`document`)throw TypeError(`Variable "${e}" is a ${n.kind}, not a document (use defineDocument to create one)`);(0,wv.runInAction)(()=>n.set(t))}setBox(e,t){let n=this.requireNode(e);if(n.kind!==`box`)throw TypeError(`Variable "${e}" is a ${n.kind}, not a box (use defineBox to create a settable variable)`);(0,wv.runInAction)(()=>n.set(t))}runInAction(e){(0,wv.runInAction)(e)}has(e){return this.nodes.has(e)}getType(e){return this.requireVar(e).type}getKind(e){return this.requireNode(e).kind}changeKey(e){let t=this.requireNode(e);if(t.kind===`document`)return dP(t.read());try{return String(t.read())}catch(e){return`failed:${e instanceof Error?e.message:String(e)}`}}getNode(e){let t=this.requireNode(e);return t.kind===`document`?{name:t.name,kind:t.kind,read:()=>t.read(),lastUpdatedMs:()=>t.lastUpdatedMs()}:{name:t.name,type:t.type,kind:t.kind,read:()=>t.read(),lastUpdatedMs:()=>t.lastUpdatedMs()}}names(){return[...this.nodes.keys()]}requireNode(e){let t=this.nodes.get(e);if(!t)throw ReferenceError(`Unknown variable "${e}"`);return t}requireVar(e){let t=this.requireNode(e);if(t.kind===`document`)throw TypeError(`Variable "${e}" is a document; read its fields by path (.${e}.<field>)`);return t}assertNotDefined(e){if(this.nodes.has(e))throw Error(`Variable "${e}" is already declared`)}};function gP(e,t,n){return e+`\0`+t+`\0`+(n??``)}function _P(e,t){return new Set(w_(e.presets).filter(n=>D_(e,n).path===`root`?t.root!==void 0:t.presets?.[n]?.root!==void 0))}function vP(e){let t=c.basename(e),n=c.dirname(e);for(;!r.existsSync(n);)t=c.basename(n),n=c.dirname(n);return{dir:n,name:t}}function yP(e,t){let n=new Map;for(let t of mT(e.projectDir,e.cwd,e.configFile)){let{dir:e,name:r}=vP(t);n.has(e)||n.set(e,new Set),n.get(e).add(r)}return{files:t===null?[]:[t],dirs:[...n.entries()].sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({path:e,filenames:[...t].sort()}))}}function bP(e){return e.filter(Boolean).join(`
196
+ `)||null}var xP=class{entries=new Map;deps;maxEntries;observers;constructor(e,t={}){this.deps=e,this.maxEntries=t.maxEntries??256,this.observers=t.observers??{}}getOrCreate(e,t,n){let r=gP(e,t,n),i=this.entries.get(r);if(i)return this.entries.delete(r),this.entries.set(r,i),i;let a=this.loadFromDisk(e,t,n),o={projectDir:e,cwd:t,configFile:n,configFilePath:null,lastError:a.error,lastWarning:a.warning,state:a.state??this.buildState(t,null,[]),watcher:null,watcherKey:null};if(this.entries.set(r,o),this.entries.size>this.maxEntries){let e=this.entries.entries().next().value;if(e!==void 0){let[t,n]=e;n.state.registry.dispose(),n.watcher?.release(),this.entries.delete(t)}}return this.refreshWatcher(o,a.resolvedPath),this.observers.onReload?.(o),o}reload(e,t,n){this.reloadInto(this.getOrCreate(e,t,n))}reloadInto(e){let t=this.loadFromDisk(e.projectDir,e.cwd,e.configFile);e.lastWarning=t.warning,e.lastError=t.error,t.state!==null&&(e.state.registry.dispose(),e.state=t.state),this.refreshWatcher(e,t.resolvedPath),this.observers.onReload?.(e)}loadFromDisk(e,t,n){let r=gT(e,t,n),i=r.kind===`file`?r.path:null,a=[bT(e,t),vT(r)],o;try{o=this.buildState(t,i,a)}catch(e){return e instanceof vs&&a.push(...e.warnings),{resolvedPath:i,warning:bP(a),state:null,error:e instanceof vs||e instanceof Error?e.message:String(e)}}return{resolvedPath:i,warning:bP(a),state:o,error:null}}buildState(e,t,n){let r=xT(t,Yk),{config:i,raw:a}=r;n.push(...r.warnings);let o=wT(r,t??`<default>`),s=new hP,c=new Tb(s,o.globals.default_empty_value??``,this.deps.gitService,this.deps.sessionState),l;try{l=nP(o,c,{cwd:e}),n.push(...l.loadWarnings),Ej(o),kk(o)}catch(e){throw c.dispose(),e}return{config:o,store:s,registry:c,compiled:l,neededInputPaths:LA(o),lastRenderCellsBySegment:new Map,authoredRoots:_P(i,a),fileHeldSettings:fj(a)}}refreshWatcher(e,t){e.configFilePath=t;let n=yP(e,t),r=`config:${e.projectDir}:${e.cwd}:${e.configFile??``}:${JSON.stringify(n)}`;e.watcher!==null&&e.watcherKey===r||(e.watcher?.release(),e.watcherKey=r,e.watcher=this.deps.watchers.acquire(r,n,()=>this.onConfigChanged(e)))}onConfigChanged(e){Q(`info`,`config change detected for entry projectDir=${e.projectDir} cwd=${e.cwd}`),this.reloadInto(e)}get size(){return this.entries.size}firstState(){return this.entries.values().next().value?.state??null}};const SP=16384;var CP=class{startedAt=new Date;requestsTotal=0;requestsErrored=0;requestsTimedOut=0;inFlight=0;watchersOpened=0;watchersClosed=0;watchersEvicted=0;subprocessTotal=0;subprocessInFlight=0;subprocessCount=new Map;subprocessHistogram=new Map;subprocessHistogramRotator=new Map;rollingTimestamps=[];rollingHead=0;launchStats={onStart:e=>{this.subprocessTotal++,this.subprocessInFlight++,this.subprocessCount.set(e,(this.subprocessCount.get(e)??0)+1),this.recordRollingNow()},onEnd:(e,t)=>{this.subprocessInFlight=Math.max(0,this.subprocessInFlight-1),this.recordDuration(e,t)}};recordRollingNow(){let e=Date.now();if(this.rollingTimestamps.length<SP){this.rollingTimestamps.push(e);return}this.rollingTimestamps[this.rollingHead]=e,this.rollingHead=(this.rollingHead+1)%SP}recordDuration(e,t){let n=this.subprocessHistogram.get(e);if(n||(n=[],this.subprocessHistogram.set(e,n)),n.length<16){n.push(t);return}let r=(this.subprocessHistogramRotator.get(e)??0)%16;n[r]=t,this.subprocessHistogramRotator.set(e,r+1)}snapshotSubprocesses(){let e=Date.now()-6e4,t=0;for(let n of this.rollingTimestamps)n>=e&&t++;let n={};for(let[e,t]of this.subprocessCount)t>0&&(n[e]=t);let r={},i={};for(let[e,t]of this.subprocessHistogram){if(t.length===0)continue;let n=[...t].sort((e,t)=>e-t),a=Math.floor(n.length*.5),o=Math.min(n.length-1,Math.floor(n.length*.99)),s=n[a],c=n[o];s!==void 0&&(r[e]=s),c!==void 0&&(i[e]=c)}return{total:this.subprocessTotal,inFlight:this.subprocessInFlight,lastMinute:t,byCategory:n,p50DurationMs:r,p99DurationMs:i}}snapshot(e){let t=process.memoryUsage();return{pid:process.pid,version:yD,protocolVersion:3,startedAt:this.startedAt.toISOString(),uptimeSec:Math.floor((Date.now()-this.startedAt.getTime())/1e3),rssBytes:t.rss,heapUsedBytes:t.heapUsed,heapTotalBytes:t.heapTotal,externalBytes:t.external,arrayBuffersBytes:t.arrayBuffers,requests:{total:this.requestsTotal,errored:this.requestsErrored,timedOut:this.requestsTimedOut,inFlight:this.inFlight},gitCache:e.gitCache,usageCache:e.usageCache,renderCache:{size:e.renderCacheSize},watchers:{active:e.watchersActive,opened:this.watchersOpened,closed:this.watchersClosed,evicted:this.watchersEvicted},subprocesses:this.snapshotSubprocesses(),nextRestartReason:e.nextRestartReason??null}}};function wP(e,t,n){let r=(r,i,a)=>{let o=i.filter(t).map(t=>({key:t,before:e.get(r,t)}));a();for(let{key:t,before:i}of o)n(r,t,i,e.get(r,t))};return{get:(t,n)=>e.get(t,n),set:(t,n,i)=>r(t,[n],()=>e.set(t,n,i)),setBatch:(t,n)=>r(t,n.map(e=>e.key),()=>e.setBatch(t,n)),clear:(t,n)=>r(t,[n],()=>e.clear(t,n))}}const TP={load:()=>({}),save:()=>{},flush:()=>{}};function EP(e){let t=new Map;for(let[n,r]of Object.entries(e))t.set(n,new Map(Object.entries(r)));return t}var DP=class{sessions;storage;atom=(0,wv.createAtom)(`SessionState`);constructor(e=TP,t=256){this.maxSessions=t,this.storage=e,this.sessions=new Map,this.hydrateFromStorage()}useStorage(e){this.storage=e,this.hydrateFromStorage()}hydrateFromStorage(){this.sessions=EP(this.storage.load()),this.evictOldest(),this.persist()}get(e,t){this.atom.reportObserved();let n=this.sessions.get(e);return n?(this.touch(e,n),n.get(t)??null):null}set(e,t,n){this.setBatch(e,[{key:t,value:n}])}setBatch(e,t){t.length!==0&&(0,wv.runInAction)(()=>{let n=this.sessions.get(e)??new Map;for(let{key:e,value:r}of t)n.set(e,r);this.touch(e,n),this.evictOldest(),this.persist(),this.atom.reportChanged()})}clear(e,t){(0,wv.runInAction)(()=>{let n=this.sessions.get(e);n&&(n.delete(t),n.size===0?this.sessions.delete(e):this.touch(e,n)),this.persist(),this.atom.reportChanged()})}prune(e){(0,wv.runInAction)(()=>{for(let t of this.sessions.keys())e.has(t)||this.sessions.delete(t);this.persist(),this.atom.reportChanged()})}touch(e,t){this.sessions.delete(e),this.sessions.set(e,t)}evictOldest(){let e=this.sessions.size-this.maxSessions;if(!(e<=0)){for(let t of this.sessions.keys())if(this.sessions.delete(t),--e===0)break}}flush(){this.storage.flush()}persist(){this.storage.save(this.serialize())}serialize(){let e=Object.create(null);for(let[t,n]of this.sessions)e[t]=Object.fromEntries(n);return e}};const OP=(e,t)=>k(t);function kP(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;for(let t of Object.values(e)){if(typeof t!=`object`||!t||Array.isArray(t))return!1;for(let e of Object.values(t))if(typeof e!=`string`)return!1}return!0}var AP=class{timer=null;pending=null;constructor(e,t=500,n=OP){this.filePath=e,this.debounceMs=t,this.logger=n}load(){let e;try{e=r.readFileSync(this.filePath,`utf8`)}catch(e){let t=e.code;return t!==`ENOENT`&&this.logger(`warn`,`session-state read failed (${t}); starting empty`),{}}try{let t=JSON.parse(e);return kP(t)?t:(this.logger(`warn`,`session-state load: unexpected shape, starting empty`),{})}catch{return this.logger(`warn`,`session-state load: corrupt JSON, starting empty`),{}}}save(e){this.pending=e,!this.timer&&(this.timer=setTimeout(()=>this.flush(),this.debounceMs),this.timer.unref())}flush(){if(this.timer&&=(clearTimeout(this.timer),null),this.pending===null)return;let e=this.pending;try{r.mkdirSync(c.dirname(this.filePath),{recursive:!0});let t=`${this.filePath}.tmp`;r.writeFileSync(t,JSON.stringify(e),{mode:384}),r.chmodSync(t,384),r.renameSync(t,this.filePath),this.pending=null}catch(e){this.logger(`warn`,`session-state save failed: ${e.message}`)}}};const jP={default_empty_value:`string`,default_separator:`string`,palette:`string`,style:`string`,preset:`string`,endcaps:`string`,variation:`string`,autoWrap:`boolean`,padding:`number`,charset:`string`,updateNotice:`boolean`,colorCompatibility:`string`,menuGlyph:`string`},MP=new Set([`1`,`true`]),NP=new Set([`0`,`false`,``]);function PP(e,t){let n=aF(e),r=n.scope===`segment-palette`?`string`:jP[n.field];if(r===`string`)return JSON.stringify(t);if(r===`number`){let n=Number(t);if(!Number.isFinite(n))throw Error(`persistValueText: "${e}" expects a number, got "${t}"`);return String(n)}if(MP.has(t))return`true`;if(NP.has(t))return`false`;throw Error(`persistValueText: "${e}" expects boolean-ish (1, 0, true, false), got "${t}"`)}function FP(e){try{return r.readFileSync(e,`utf8`)}catch(e){if(e.code===`ENOENT`)return null;throw e}}function IP(e,t,n){try{if(t===null){r.rmSync(e,{force:!0});return}r.mkdirSync(c.dirname(e),{recursive:!0}),Ae(e,t)}catch(t){let r=`config write failed (${e}): ${t.message}`;throw n(`error`,r),Error(r)}}function LP(e){return/^\s*$/.test(e)?null:Po(e)}function RP(e,t){return e!==null&&Io(e,t)!==void 0}function zP(e){if(e.kind===`segment`)return e.when===void 0?e.name:{seg:e.name,when:e.when};if(e.kind===`container`){let{kind:t,direction:n,children:r,...i}=e;return{[n===`horizontal`?`h`:`v`]:r.map(zP),...i}}return e}function BP(e){if(!kc(e))return zP(e);let{rows:t,...n}=e;return{rows:Object.fromEntries(Object.entries(t).map(([e,t])=>[e,zP(t)])),...n}}const VP=qk,HP=VP.segments,UP=VP.presets,WP=VP.root;function GP(e,t,n,r){if(!RP(e,t)&&n===void 0)throw new $(`cannot edit ${r}: neither the config file nor the bundled default declares ${t.join(`.`)}`)}function KP(e,t){let n=lx(t);return t.scope===`segment-palette`&&GP(e,[`segments`,t.segment],HP[t.segment],n.join(`.`)),n}function qP(e){return Po(Wo(e))}function JP(){return Object.entries(WP.rows).map(([e,t])=>{let n=zP(t);return{path:[`root`],fragment:qP({rows:{[e]:n}}),unit:{path:[`root`,`rows`,e],value:n}}})}function YP(e,t){let n=e===null?void 0:Io(e,t);return n===void 0?null:{path:t,fragment:n,unit:null}}function XP(e,t){if(t===void 0)return null;let n=BP(t);return{path:e,fragment:qP(n),unit:{path:e,value:n}}}function ZP(e,t){let n=[`presets`,t],r=[...n,`root`],i=UP[t];GP(e,n,i,r.join(`.`));let a=YP(e,r)??XP(r,i?.root);return a!==null&&ds(a.fragment)?a:null}function QP(e,t){let n=us(t.fragment);return n===null?new Map([[`#`,{path:t.path,unit:t.unit,node:t.fragment}]]):new Map([...e,...n.map(e=>[e.key,{path:[...t.path,`rows`,e.key],unit:t.unit,node:e.value}])])}function $P(e,t){return[...JP(),YP(e,[`root`]),ZP(e,t)].filter(e=>e!==null).reduce(QP,new Map)}function eF(e,t,n){for(let{node:r,...i}of $P(e,t).values())if(ps(r,n))return i;throw new $(`${tF(e,t).join(`.`)} holds no placement "${n}" — the bar you clicked is stale (it reloads on the next render), or the action names a placement the layout never held`)}function tF(e,t){return ZP(e,t)?.path??[`root`]}function nF(e,t){return t.scope===`preset-root`?tF(e,t.preset):lx(t)}function rF(e,{unit:t}){return t===null?e:is(e,t.path,Wo(t.value),Ho)}function iF(e){let t=cx(e);if(t===null)throw Error(`"${e}" is not a valid persist target`);return t}function aF(e){let t=iF(e);if(t.scope===`preset-root`)throw Error(`"${e}" names a layout, not a value`);return t}function oF(e,t,n,r){sF(t,r),IP(t,r,e.logger),e.record(t,n,r)}function sF(e,t){try{return wT(ST(e,t,Yk),e)}catch(e){throw e instanceof vs?new $(`refused: the config file would not load after this click — ${e.message}`):e}}function cF(e,t){let n=aF(t),r=LP(FP(e)??``),i=r===null?void 0:Io(r,lx(n));return i!==void 0&&`value`in i?i.value:void 0}function lF(e,t,n){uF(e,t,n,[])}function uF(e,t,n,r){let i=FP(t);oF(e,t,i,dF(n.reduce((e,[t,n])=>is(e,KP(LP(e),aF(t)),PP(t,n),Ho),i??``),t,r,e=>e))}function dF(e,t,n,r){return n.reduce((e,{preset:n,id:i,setting:a,value:o})=>{let s=r(e,n,i),c=eF(LP(s),n,i),l=_s(rF(s,c),c.path,i,a,Wo(o));if(l===null)throw new $(`${c.path.join(`.`)} in ${t} has no placement "${i}" — the bar you clicked is stale (it reloads on the next render)`);return l},e)}function fF(e,t,n){let r=LP(e),i=[`presets`,t,`root`];for(let[a,{path:o,unit:s,node:c}]of $P(r,t)){if(!ps(c,n))continue;if(i.every((e,t)=>o[t]===e))return e;let l=s===null?Ro(e,c):Wo(s.value);if(a!==`#`)return is(e,[...i,`rows`,a],l,Ho);if(ZP(r,t)!==null)throw new $(`cannot give preset "${t}" its own copy of ${o.join(`.`)}: it already stages rows of its own over that tree`);return is(e,i,l,Ho)}return e}function pF(e,t){return os(e,t,t[0]===`presets`&&t.length>2&&!Zk(t[1])?2:0)}function mF(e,t,n){let r=n.map(iF),i=FP(t);if(i===null)return;let a=r.reduce((e,t)=>pF(e,nF(LP(e),t)),i);a!==i&&oF(e,t,i,a)}function hF(e){let t=e===null?void 0:Io(e,[`presets`]),n=new Set([...Xk,...t?.kind===`object`?t.entries.map(e=>e.key):[]].map(hu));return Array.from({length:n.size+1},(e,t)=>`custom-${t+1}`).find(e=>!n.has(hu(e)))}function gF(e,t,n,r,i,a){let o=FP(t),s=LP(o??``),c=hF(s),l=[`presets`,c],u=ZP(s,n),d=[...u===null?[]:[[[...l,`root`],u.unit===null?Ro(o??``,u.fragment):Wo(u.unit.value)]],...Object.keys(r).length===0?[]:[[[...l,`globals`],Wo(r)]]],f=i.map(([e,t])=>{let n=sx(c,e);return[KP(s,aF(n)),PP(n,t)]});return oF(e,t,o,dF([...d,...f].reduce((e,[t,n])=>is(e,t,n,Ho),is(o??``,l,`{}`,Ho)),t,a.map(e=>({...e,preset:c})),fF)),c}function _F(e,t,n){if(Zk(n))throw new $(`cannot delete preset "${n}": it is bundled — reset its settings instead`);let r=[`presets`,n],i=FP(t),a=LP(i??``);if(i===null||a===null||Io(a,r)===void 0)throw new $(`cannot delete preset "${n}": ${t} declares no ${r.join(`.`)} — the bar you clicked is stale; it reloads on the next render`);let o=Io(a,[`globals`,`preset`]);oF(e,t,i,[r,...o?.kind===`string`&&o.value===n?[[`globals`,`preset`]]:[]].reduce((e,t)=>pF(e,t),i))}function vF(e,t,n,r){let i=iF(n);if(i.scope!==`preset-root`)throw Error(`"${n}" is not a "presets.<name>.root" target`);let a=FP(t),o=r.op===`remove`?r.target:r.anchor,s=eF(LP(a??``),i.preset,o),c=rF(a??``,s),{after:l,placed:u}=yF(c,s.path,r,()=>{let e=sF(t,c);return w_(e.presets).map(t=>D_(e,t).node)});if(l===null)throw new $(`${s.path.join(`.`)} in ${t} has no placement "${o}" — the bar you clicked is stale (it reloads on the next render), or the action names a placement the layout never held`);return oF(e,t,a,l),u}function yF(e,t,n,r){switch(n.op){case`remove`:return{after:hs(e,t,n.target),placed:null};case`insert`:{let i=gk(n.segment,n.anchor,r());return{after:gs(e,t,i,n.anchor,n.relation),placed:i}}}}const bF={load:()=>({}),save:()=>{}},xF=new Set(Ob.map(e=>e.sessionKey)),SF=e=>xF.has(e)||e.startsWith(J_),CF=8*1024*1024,wF={past:[],future:[]},TF=e=>e.kind===`session`?`session:${e.key}`:`file:${e.file}`;var EF=class{state=new Map;constructor(e,t,n=bF){this.sessionState=e,this.logger=t,this.storage=n,this.state=new Map(Object.entries(n.load()))}useStorage(e){this.storage=e,this.state=new Map(Object.entries(e.load()))}depth(e){let{past:t,future:n,savepoint:r}=this.state.get(e)??wF;return{undo:t.length,redo:n.length,sinceEdit:r?.net.length??0}}history(e){return this.state.get(e)??wF}begin(){let e=new Map,t=(t,n)=>{let r=e.get(t)??new Map,i=r.get(TF(n));r.set(TF(n),i===void 0?n:{...n,before:i.before}),e.set(t,r)},n=new Map;return{sessionState:wP(this.sessionState,e=>SF(e)||e===`edit.mode`,(e,r,i,a)=>{if(r===`edit.mode`){let t=n.get(e);n.set(e,{before:t===void 0?i:t.before,after:a});return}t(e,{kind:`session`,key:r,before:i,after:a})}),file:(e,n,r,i)=>t(e,{kind:`file`,file:n,before:r,after:i}),commit:()=>{let t=new Map(e),r=new Map(n);e.clear(),n.clear();for(let e of new Set([...t.keys(),...r.keys()])){let n=[...t.get(e)?.values()??[]].filter(e=>e.before!==e.after),i=this.history(e),a=n.length===0?i:PF(i,n),o=r.get(e),s=o===void 0?a:RF(a,o);s!==i&&this.put(e,s)}}}}undo(e){let t=this.history(e),n=t.past.at(-1);if(n===void 0)throw new $(`undo: nothing to undo`);return this.apply(e,n,`before`,`undo`,IF(t,n)),n}rewind(e){let t=this.history(e),{savepoint:n}=t;if(n===void 0)throw new $(`rewind: edit mode has no savepoint — nothing to cancel`);let r=n.net.filter(t=>this.read(e,t)!==t.after),i=new Set(r.map(TF)),a=n.net.filter(e=>!i.has(TF(e))),o=kF(zF(LF(t,n),i));if(this.apply(e,a,`before`,`rewind`,{past:o,future:[],savepoint:{at:o.length,net:[],below:[]}}),r.length>0)throw new $(`rewind: ${r.map(VF).join(`, `)} changed since edit mode opened — kept as it is; everything else edit mode changed was put back`);return a}redo(e){let t=this.history(e),{past:n,future:r}=t,i=r.at(-1);if(i===void 0)throw new $(`redo: nothing to redo`);let a=[...n,i],o=kF(a);return this.apply(e,i,`after`,`redo`,{past:o,future:r.slice(0,-1),...jF(t.savepoint,a.length-o.length,i)}),i}apply(e,t,n,r,i){let a=n===`before`?`after`:`before`,o=t.filter(t=>this.read(e,t)!==t[a]);if(o.length>0){let t=new Set(o.map(TF)),{past:n,future:i,savepoint:a}=this.history(e);throw this.put(e,{past:zF(n,t),future:zF(i,t),...a!==void 0&&{savepoint:{at:zF([...n,...[...i].reverse()].slice(0,a.at),t).length,net:a.net.filter(e=>!t.has(TF(e))),below:zF(a.below,t)}}}),new $(`${r}: ${o.map(VF).join(`, `)} changed since that edit — refusing to overwrite it; this session's undo history no longer steps it`)}let s=[];try{for(let r of t)this.write(e,r,r[n]),s.push(r);this.put(e,i)}catch(t){try{for(let t of s.reverse())this.write(e,t,t[a])}catch(e){throw Error(`${t.message}; and putting the step back failed, so it is half-applied: ${e.message}`)}throw t}}read(e,t){return t.kind===`session`?this.sessionState.get(e,t.key):FP(t.file)}write(e,t,n){t.kind===`file`?IP(t.file,n,this.logger):n===null?this.sessionState.clear(e,t.key):this.sessionState.set(e,t.key,n)}put(e,t){let n=new Map(this.state);for(n.delete(e),(t.past.length>0||t.future.length>0||t.savepoint!==void 0)&&n.set(e,t);n.size>32||DF(n)>CF;){let[e,t]=n.entries().next().value;n.size>1?n.delete(e):t.past.length+t.future.length>0?n.set(e,OF(t)):(this.logger(`warn`,`settings-history: edit mode's changes for session ${e} exceed ${CF} bytes; cancel is no longer available`),n.delete(e))}this.storage.save(Object.fromEntries(n)),this.state=n}};function DF(e){let t=0;for(let{past:n,future:r,savepoint:i}of e.values())for(let e of[...n,...r,...i===void 0?[]:[i.net,...i.below]])for(let n of e)t+=(n.before?.length??0)+(n.after?.length??0);return t}function OF({past:e,future:t,savepoint:n}){return e.length>0?{past:e.slice(1),future:t,...jF(n,1,[])}:{past:e,future:t.slice(1),...jF(n,0,[])}}function kF(e){return e.slice(-50)}const AF=e=>e===X_.member;function jF(e,t,n){return e===void 0?{}:{savepoint:{at:Math.max(0,e.at-t),net:MF(e.net,n),below:e.below}}}function MF(e,t){let n=new Map(e.map(e=>[TF(e),e]));for(let e of t){let t=n.get(TF(e));n.set(TF(e),t===void 0?e:{...t,after:e.after})}return[...n.values()].filter(e=>e.before!==e.after)}const NF=e=>e.map(e=>({...e,before:e.after,after:e.before}));function PF(e,t){let n=[...e.past,t],r=kF(n),{savepoint:i}=e,a=i===void 0?0:Math.max(0,i.at-e.past.length);return{past:r,future:[],...jF(i&&{at:Math.min(i.at,e.past.length),net:i.net,below:[...FF(e.future,a),...i.below]},n.length-r.length,t)}}function FF(e,t){let n=Math.min(t,e.length);return e.slice(e.length-n).reverse()}function IF(e,t){return{past:e.past.slice(0,-1),future:kF([...e.future,t]),...jF(e.savepoint,0,NF(t))}}function LF(e,t){let{past:n,future:r}=e,i=n.slice(0,t.at);return[...i,...FF(r,t.at-i.length),...t.below]}function RF(e,t){if(AF(t.after)&&!AF(t.before))return{...e,savepoint:{at:e.past.length,net:[],below:[]}};if(!AF(t.after)&&AF(t.before)){let{past:t,future:n}=e;return{past:t,future:n}}return e}function zF(e,t){return e.map(e=>e.filter(e=>!t.has(TF(e)))).filter(e=>e.length>0)}function BF(e){return e.map(VF).join(`, `)}function VF(e){return e.kind===`session`?`session setting "${e.key}"`:e.file}function HF(e){if(typeof e!=`object`||!e)return!1;let t=e,n=e=>e===null||typeof e==`string`;return(t.kind===`session`&&typeof t.key==`string`||t.kind===`file`&&typeof t.file==`string`)&&n(t.before)&&n(t.after)}function UF(e){return Array.isArray(e)&&e.every(e=>Array.isArray(e)&&e.every(HF))}function WF(e){if(typeof e!=`object`||!e)return!1;let t=e;return Number.isInteger(t.at)&&t.at>=0&&Array.isArray(t.net)&&t.net.every(HF)&&UF(t.below)}function GF(e){if(typeof e!=`object`||!e)return!1;let t=e;return UF(t.past)&&UF(t.future)&&(t.savepoint===void 0||WF(t.savepoint))}function KF(e,t){return{load:()=>{let n;try{n=r.readFileSync(e,`utf8`)}catch(e){let n=e.code;return n!==`ENOENT`&&t(`warn`,`settings-history read failed (${n}); starting empty`),{}}try{let e=JSON.parse(n);if(typeof e==`object`&&e&&!Array.isArray(e)&&Object.values(e).every(GF))return e}catch{}return t(`warn`,`settings-history load: unexpected shape, starting empty`),{}},save:n=>{try{r.mkdirSync(c.dirname(e),{recursive:!0}),Ae(e,JSON.stringify(n),384)}catch(e){let n=`settings-history write failed — the change landed but is not undoable: ${e.message}`;throw t(`error`,n),Error(n)}}}}const qF=e=>!SF(e)&&!Ix(e)&&e!==`update.dismissed`;var JF=class{past=new Map;depth(e,t,n){return this.restorable(e,t,n).length}restorable(e,t,n){let r=new Map,i=n=>r.has(n)?r.get(n):t.get(e,n),a=[];for(let t of[...this.past.get(e)??[]].reverse())if(t.every(e=>i(e.key)===e.after&&(e.before===null||n.validate(e.key,e.before).ok))){a.unshift(t);for(let e of t)r.set(e.key,e.before)}return a}begin(e){let t=new Map;return{sessionState:wP(e,qF,(e,n,r,i)=>{let a=t.get(e)??new Map,o=a.get(n);a.set(n,{key:n,before:o?o.before:r,after:i}),t.set(e,a)}),commit:()=>{for(let[e,n]of t){let t=[...n.values()].filter(e=>e.before!==e.after);t.length>0&&this.push(e,t)}t.clear()}}}back(e,t,n){let r=this.past.get(e)??[],i=this.restorable(e,t,n),a=i.at(-1),o=r.length-i.length;if(a===void 0)throw this.put(e,i),new $(`back: nothing to go back to${o>0?` (${o} step(s) over a view since gone, discarded)`:``}`);return(0,wv.runInAction)(()=>{let n=a.flatMap(({key:e,before:t})=>t===null?[]:[{key:e,value:t}]);n.length>0&&t.setBatch(e,n);for(let{key:n,before:r}of a)r===null&&t.clear(e,n)}),this.put(e,i.slice(0,-1)),{step:a,discarded:o}}push(e,t){let n=this.past.get(e)??[];this.put(e,[...n,t].slice(-20))}put(e,t){for(this.past.delete(e),t.length>0&&this.past.set(e,t);this.past.size>32;)this.past.delete(this.past.keys().next().value)}};function YF(e,t,n,r){let i=Oe({bin:`tmux`,args:[`-S`,e.socket,...n],timeoutMs:2e3,category:t,stdinInput:r});if(i.ok)return{kind:`ok`,stdout:i.stdout};if(i.reason===`rate-limited`)return{kind:`rate-limited`,reason:i.error??`rate-limited`};let a=i.error??[i.reason,i.stderr.trim()].filter(e=>e!==``).join(`: `);return{kind:`failed`,reason:`tmux ${n[0]} failed (${a})`}}function XF(e){let t=YF(e,`doctor.tmux`,[`display`,`-p`,`-t`,e.pane,`#{client_termfeatures}`]);return t.kind===`ok`?{kind:`ok`,value:t.stdout.trim().split(`,`).filter(e=>e!==``)}:{kind:`failed`,reason:t.reason}}function ZF(){return{probeTmux:XF}}function QF(e){let t=OD(e).env;if(t===void 0)return{path:e,env:{}};if(typeof t!=`object`||!t||Array.isArray(t))throw Error(`cannot read ${e}: \`env\` is not an object`);return{path:e,env:t}}function $F(e,t){return t===void 0?{kind:`unreported`}:t===null?{kind:`outside`}:{kind:`inside`,hint:t,termfeatures:e.probeTmux(t)}}function eI(e,t){return{tmux:$F(e,t.tmux),claudeSettings:QF(TD(wD(t.claudeConfigDir)))}}function tI(e,t){let n=t.claudeSettings.path;switch(e.kind){case`claude-settings-env`:{let i=is(DD(n),[`env`,e.name],JSON.stringify(e.value),Uo);return r.mkdirSync(c.dirname(n),{recursive:!0}),Ae(n,i),{...t,claudeSettings:QF(n)}}default:return e.kind}}const nI=/^─{20,}/,rI=/^❯(\s|$)/,iI=/›\s*stashed$/;function aI(e){if(e.inMode)return{kind:`in-mode`};let t=e.screen.map(e=>e.trimEnd()),n=t.flatMap((e,t)=>nI.test(e)?[t]:[]).at(-2);return n===void 0||!rI.test(t[n+1]??``)?{kind:`no-prompt`}:iI.test(t[n-1]??``)?{kind:`stashed`}:{kind:`ready`}}const oI={"in-mode":`the Claude Code pane is in tmux copy mode — leave it (q) and click again`,stashed:`Claude Code is holding a stashed prompt (ctrl+s) — restore or send it, then click again`,"no-prompt":`Claude Code is not at its prompt (a dialog or picker is open) — close it and click again`};function sI(e,t,n){if(t===void 0)return{kind:`refused`,reason:`this session's statusline client reports no tmux facts (it predates this daemon) — rebuild or reinstall cc-candybar`};if(t===null)return{kind:`refused`,reason:`this Claude Code is not running inside tmux — the bar can only type into a tmux pane`};let r=aI(e.read(t));if(r.kind!==`ready`)return{kind:`refused`,reason:oI[r.kind]};let i=e.type(t,n);return i.kind===`typed`?{kind:`typed`,pane:t.pane}:i}const cI=`cc-candybar-slash`;function lI(e,t,n,r){let i=YF(e,t,n,r);if(i.kind===`failed`)throw Error(i.reason);return i}function uI(e){let t=lI(e,`claude-input.read`,[`display`,`-p`,`-t`,e.pane,`#{pane_in_mode}`,`;`,`capture-pane`,`-p`,`-t`,e.pane]);if(t.kind===`rate-limited`)throw Error(t.reason);let[n=``,...r]=t.stdout.split(`
197
+ `);return{inMode:n!==`0`,screen:r}}function dI(e,t){let n=lI(e,`claude-input.type`,[`load-buffer`,`-b`,cI,`-`,`;`,`send-keys`,`-t`,e.pane,`C-s`,`;`,`paste-buffer`,`-p`,`-d`,`-b`,cI,`-t`,e.pane,`;`,`send-keys`,`-t`,e.pane,`Enter`],t);return n.kind===`ok`?{kind:`typed`}:{kind:`refused`,reason:`cc-candybar typed a command moments ago — click again in a second (${n.reason})`}}function fI(){return{read:uI,type:dI}}function pI(e){if(!e)throw new $(`session id is required`);if(e.includes(`/`)||e.includes(`..`))throw new $(`invalid session id "${e}"`);return e}function mI(e){return hI(()=>decodeURIComponent(e))}function hI(e){try{return e()}catch(e){throw e instanceof URIError?new $(`malformed wire encoding: ${e.message}`):e}}function gI(e,t){let n=Oe({bin:`/usr/bin/pbcopy`,stdinInput:e,category:`click.pbcopy`});if(!n.ok){if(n.reason===`rate-limited`){t.dlog(`warn`,`click.pbcopy rate-limited: ${n.error??``}`);return}throw Error(`pbcopy failed (${n.reason}, exit ${n.exitCode??`null`})`)}}const _I=(e,t)=>gI(mI(e),t),vI=(e,t)=>{let n=Oe({bin:`/usr/bin/open`,args:[`-a`,`Visual Studio Code`,mI(e)],category:`click.open`});if(!n.ok){if(n.reason===`rate-limited`){t.dlog(`warn`,`click.open rate-limited: ${n.error??``}`);return}throw Error(`open -a "Visual Studio Code" failed (${n.reason}, exit ${n.exitCode??`null`})`)}},yI=(e,t)=>gI(mI(e),t),bI=(e,t)=>gI(mI(e),t),xI=(e,t)=>{let n=pI(mI(e));t.navigating.get(n,`toolbar-expanded`)?t.navigating.clear(n,`toolbar-expanded`):t.navigating.set(n,`toolbar-expanded`,`1`)},SI=(e,t)=>{let[n=``,...r]=hI(()=>fD(e)),i=pI(n),a=Ej(PI(t,i));if(r.length===0)throw new $(`set-state: <key>/<value> is required (have keys: ${a.listKeys().join(`, `)})`);if(r.length%2!=0)throw new $(`set-state: expected even-count <key>/<value> pairs, got ${r.length} segment(s) after session id (have keys: ${a.listKeys().join(`, `)})`);let o=[];for(let e=0;e<r.length;e+=2){let t=r[e],n=r[e+1];if(!t)throw new $(`set-state: empty key at pair ${e/2+1} (expected <sessionId>/<key>/<value>[/<key>/<value>...] segments)`);let i=a.validate(t,n);if(!i.ok)throw new $(`set-state: pair ${e/2+1}: ${i.reason}`);o.push({key:t,value:i.value})}EI(t,i,`set-state`,o),t.navigating.setBatch(i,o);let s=o.map(e=>`${e.key}=${e.value}`).join(` `);t.dlog(`info`,`set-state: ${s} (session=${i})`)},CI=/^-?\d+$/;function wI(e,t,n,r){let i=e+t;return i>r?e===r?n:r:i<n?e===n?r:n:i}const TI=(e,t)=>{let[n=``,r=``,i=``]=hI(()=>fD(e)),a=pI(n);if(!r)throw new $(`step-state: <key> is required (shape: <sessionId>/<key>/<by>)`);if(!CI.test(i))throw new $(`step-state: delta must be an integer, got "${i}"`);let o=parseInt(i,10),s=PI(t,a),c=Ej(s),l=c.rangeParamsFor(r);if(!l)throw new $(`step-state: key "${r}" is not a bounded (range) state key (have keys: ${c.listKeys().join(`, `)})`);let u=t.sessionState.get(a,r),d=u&&CI.test(u)?DI(l,parseInt(u,10)):OI(`step-state`,r,l,kj(s,e=>t.sessionState.get(a,e),r)),f=wI(d,o,l.min,l.max),p=c.validate(r,String(f));if(!p.ok)throw new $(`step-state: ${p.reason}`);EI(t,a,`step-state`,[{key:r,value:p.value}]),t.navigating.set(a,r,p.value),t.dlog(`info`,`step-state: ${r} ${d}→${p.value} (by ${o}, session=${a})`)};function EI(e,t,n,r){let i=r.filter(e=>e.key.startsWith(J_));if(i.length===0)return;let a=sj(PI(e,t),n=>e.sessionState.get(t,n),i);if(a.length>0)throw new $(`${n}: refused — ${a.join(`; `)}`)}function DI(e,t){return Math.max(e.min,Math.min(e.max,t))}function OI(e,t,n,r){if(r===null)return n.min;if(!CI.test(r))throw new $(`${e}: "${t}" shows ${JSON.stringify(r)} before any click, not an integer to step`);return DI(n,parseInt(r,10))}const kI=`render-origin`;function AI(e){return JSON.stringify(e)}function jI(e){let t;try{t=JSON.parse(e)}catch{throw new $(`render origin is not JSON: ${e}`)}if(typeof t!=`object`||!t)throw new $(`render origin is not an object: ${e}`);let{projectDir:n,cwd:r,configFile:i}=t;if(typeof n!=`string`||typeof r!=`string`||i!==null&&typeof i!=`string`)throw new $(`render origin has the wrong shape: ${e}`);return{projectDir:n,cwd:r,configFile:i}}function MI(e,t){let n=e.sessionState.get(t,kI);if(n===null)throw new $(`session ${t} has not rendered yet — no config to act on`);return jI(n)}function NI(e,t,n){let r=e.sessionState.get(t,kI);if(r===null)return;let i=jI(r),a=FI(i);n.some(e=>e.kind===`file`&&e.file===a)&&e.reloadConfig(i)}function PI(e,t){return e.configFor(MI(e,t))}function FI(e){return _T(e.projectDir,e.cwd,e.configFile??void 0)}function II(e,t){return{record:(n,r,i)=>e.journal.file(t,n,r,i),logger:e.dlog}}const LI=(e,t)=>{let[n=``,r=``,i=``]=hI(()=>fD(e)),a=pI(n),o=MI(t,a),s=t.configFor(o),c=kk(s);if(!r)throw new $(`set-config: <key>/<value> is required (have keys: ${c.listKeys().join(`, `)})`);let l=c.validate(r,i);if(!l.ok)throw new $(`set-config: ${l.reason}`);let u=FI(o),d=aj(s,e=>t.sessionState.get(a,e),r);lF(II(t,a),u,[[d.key,l.value]]),t.reloadConfig(o),t.dlog(`info`,`set-config: ${d.key}=${l.value} → ${u} (session=${a})`)},RI=(e,t)=>{let[n=``,r=``,i=``]=hI(()=>fD(e)),a=pI(n);if(!r)throw new $(`step-config: <key> is required (shape: <sessionId>/<key>/<by>)`);if(!CI.test(i))throw new $(`step-config: delta must be an integer, got "${i}"`);let o=parseInt(i,10),s=MI(t,a),c=t.configFor(s),l=kk(c),u=l.rangeParamsFor(r);if(!u)throw new $(`step-config: key "${r}" is not a bounded (range) config key (have keys: ${l.listKeys().join(`, `)})`);let d=FI(s),f=aj(c,e=>t.sessionState.get(a,e),r),p=cF(d,f.key),m=typeof p==`number`?DI(u,p):OI(`step-config`,r,u,jk(f.globals,r)),h=wI(m,o,u.min,u.max),g=l.validate(r,String(h));if(!g.ok)throw new $(`step-config: ${g.reason}`);lF(II(t,a),d,[[f.key,g.value]]),t.reloadConfig(s),t.dlog(`info`,`step-config: ${f.key} ${m}→${g.value} (by ${o}) → ${d} (session=${a})`)},zI=(e,t)=>{let[n=``]=hI(()=>fD(e)),r=pI(n),i=MI(t,r),a=t.configFor(i),o=e=>t.sessionState.get(r,e),s=rj(a,o),c=oj(a,o);if(s.length+c.length===0){t.dlog(`info`,`save: nothing unsaved (session=${r})`);return}let l=Ej(a),u=s.map(e=>{let t=l.validate(e.sessionKey,e.value);if(!t.ok)throw new $(`save: ${t.reason}`);return[e.target,t.value]});VI(`save`,l,c);let d=FI(i);uF(II(t,r),d,u,c),t.reloadConfig(i);for(let e of[...s.map(e=>e.sessionKey),...c.map(e=>e.key)])t.sessionState.clear(r,e);t.dlog(`info`,`save: ${[...u.map(([e,t])=>`${e}=${t}`),...c.map(BI)].join(` `)} → ${d} (session=${r})`)},BI=e=>`${e.preset}/${e.id}.settings.${e.setting}=${Ws(e.value)}`;function VI(e,t,n){for(let r of n){let n=t.validate(r.key,Ws(r.value));if(!n.ok)throw new $(`${e}: ${n.reason}`)}}const HI=(e,t)=>{let[n=``]=hI(()=>fD(e)),r=pI(n),i=MI(t,r),a=t.configFor(i),o=uj(a,e=>t.sessionState.get(r,e)),s=Ej(a),c=o.picks.map(e=>{let t=s.validate(e.sessionKey,e.value);if(!t.ok)throw new $(`save-preset: ${t.reason}`);return[e.configKey,t.value]});VI(`save-preset`,s,o.placements);let l=FI(i),u=gF(II(t,r),l,o.from,o.globals,c,o.placements);t.reloadConfig(i);for(let e of[...Ob.map(e=>e.sessionKey),...o.placements.map(e=>e.key)])t.sessionState.clear(r,e);t.sessionState.set(r,Db.preset.sessionKey,u),t.dlog(`info`,`save-preset: ${[`${u} from=${o.from}`,...c.map(([e,t])=>`${e}=${t}`),...o.placements.map(BI)].join(` `)} → ${l} (session=${r})`)},UI=(e,t)=>{let[n=``,r=``]=hI(()=>fD(e)),i=pI(n);if(!r)throw new $(`delete-preset: <name> is required (shape: <sessionId>/<name>)`);let a=MI(t,i),o=FI(a);_F(II(t,i),o,r),t.reloadConfig(a);let s=Db.preset.sessionKey;t.sessionState.get(i,s)===r&&t.sessionState.clear(i,s),t.dlog(`info`,`delete-preset: ${r} ← ${o} (session=${i})`)},WI=(e,t)=>{let[n=``,...r]=hI(()=>fD(e)),i=pI(n),a=MI(t,i),o=kk(t.configFor(a)).listKeys(),s=r.length===0?[``]:r.filter(e=>!o.includes(e));if(s.length>0)throw new $(`reset-config: unknown config key "${s.join(`", "`)}" (have: ${o.join(`, `)})`);let c=FI(a),l=r.map(dj),u=l.flatMap(e=>e.fileKeys),d=l.flatMap(e=>e.sessionKeys);mF(II(t,i),c,u),t.reloadConfig(a);for(let e of d)t.sessionState.clear(i,e);t.dlog(`info`,`reset-config: ${[...u,...d.map(e=>`session:${e}`)].join(` `)} ← ${c} (session=${i})`)};function GI(e,t){let n=(e,t)=>[...ks(D_(e,t).node)].filter(e=>e.kind===`segment`),r=new Set(w_(t.presets).flatMap(e=>n(t,e).map(t=>Y_(hu(e),Ts(t)))));return w_(e.presets).flatMap(t=>n(e,t).map(e=>({member:Y_(hu(t),Ts(e)),node:e})).filter(({member:e})=>!r.has(e)))}function KI(e,t){return e.flatMap(({member:e,node:n})=>[...Object.values(n.drafts??{}).map(e=>e.key),...e===t?[U_]:[]])}const qI=(e,t)=>{let[n=``,r=``,i=``]=hI(()=>fD(e)),a=pI(n),o=MI(t,a),s=t.configFor(o),c=kk(s);if(!r)throw new $(`apply-layout-op: <key>/<op> is required (have: ${c.listKeys().join(`, `)})`);let l=c.validate(r,i);if(!l.ok)throw new $(`apply-layout-op: ${l.reason}`);let u=hk(l.value);if(u===null)throw new $(`apply-layout-op: "${l.value}" is not a layout op token`);let d=FI(o),f=vF(II(t,a),d,r,u);t.reloadConfig(o);let p=KI(GI(s,t.configFor(o)),t.sessionState.get(a,U_)).filter(e=>t.sessionState.get(a,e)!==null);for(let e of p)t.sessionState.clear(a,e);t.dlog(`info`,`apply-layout-op: ${r} ${l.value} → ${d} placed=${JSON.stringify(f)} released=${JSON.stringify(p)} (session=${a})`)},JI=(e,t)=>{let[n=``]=hI(()=>fD(e)),r=pI(n);t.journal.commit();let i=t.history.undo(r);NI(t,r,i),t.dlog(`info`,`undo: restored ${BF(i)} (session=${r})`)},YI=(e,t)=>{let n=pI(mI(e)),{step:r,discarded:i}=t.navigation.back(n,t.sessionState,Ej(PI(t,n))),a=r.map(e=>`${e.key}=${e.before??`∅`}`).join(` `);t.dlog(`info`,`back: ${a} discarded=${i} (session=${n})`)},XI=(e,t)=>{let n=pI(mI(e));t.journal.commit();let r=t.history.rewind(n);NI(t,n,r),t.dlog(`info`,`rewind: put back ${BF(r)||`nothing`} as edit mode found it (session=${n})`)},ZI=(e,t)=>{let[n=``]=hI(()=>fD(e)),r=pI(n);t.journal.commit();let i=t.history.redo(r);NI(t,r,i),t.dlog(`info`,`redo: re-applied ${BF(i)} (session=${r})`)},QI=(e,t)=>{pI(mI(e)),t.applyUpdate()},$I=`client-hints`;function eL(e,t){let n=e.sessionState.get(t,$I);if(n===null)throw new $(`session ${t} has not rendered yet — no client facts are recorded for it`);let r;try{r=JSON.parse(n)}catch{throw new $(`client hints record is not JSON: ${n}`)}if(typeof r!=`object`||!r)throw new $(`client hints record is not an object: ${n}`);return jT(r)}function tL(e,t,n){let r=Ex(n);e.sessionState.setBatch(t,Ax(r)),e.dlog(`info`,`doctor: ${r.map(e=>`${e.check.name}=${e.verdict.ok?`ok`:`failed`}`).join(` `)} (session=${t})`)}const nL=(e,t)=>{let n=pI(mI(e));tL(t,n,eI(t.doctor,eL(t,n)))},rL=(e,t)=>{let[n=``,r=``]=hI(()=>fD(e)),i=pI(n),a=Dx(r);if(a===void 0)throw new $(`doctor-fix: unknown check "${r}"`);let o=eI(t.doctor,eL(t,i)),s=a.probe(o);if(s.ok||s.fix===void 0)throw new $(`doctor-fix: ${a.label} — ${s.ok?`nothing to fix`:s.reason}`);let c=tI(s.fix,o);t.dlog(`info`,`doctor-fix: ${a.name} → ${s.fix.kind} ${s.fix.name}=${s.fix.value} (session=${i})`),tL(t,i,c)},iL=(e,t)=>{let[n=``,...r]=hI(()=>fD(e)),i=pI(n),a=MI(t,i),o=Object.values(t.configFor(a).actions).filter(e=>`ceiling`in e).find(e=>{let t=GC(e);return t.length===r.length&&t.every((e,t)=>e===r[t])});if(o===void 0)throw new $(`ceiling: "${r.join(` `)}" is not a move this config declares`);let s=o.ceiling===`set`?{kind:`set`,to:o.to}:{kind:`clear`},c=dA({sessionId:i,projectDir:a.projectDir,cwd:a.cwd},eL(t,i));t.memento.move(c,s),t.dlog(`info`,`ceiling: ${r.join(` `)} (session=${i} claudeConfigDir=${c.claudeConfigDir})`)},aL=(e,t)=>{let[n=``,r=``]=hI(()=>fD(e)),i=pI(n),a=Object.values(t.configFor(MI(t,i)).actions).filter(e=>`slash`in e),o=a.find(e=>e.slash===r);if(o===void 0)throw new $(`${JSON.stringify(r)} is not a command this config declares (it declares: ${[...new Set(a.map(e=>e.slash))].join(`, `)||`none`})`);let s=sI(t.claudeInput,eL(t,i).tmux,o.slash);if(s.kind===`refused`)throw t.dlog(`warn`,`slash: ${r} refused — ${s.reason} (session=${i})`),new $(`${r} was not typed: ${s.reason}`);t.dlog(`info`,`slash: typed ${r} into ${s.pane} (session=${i})`)},oL=`config-override`,sL=new Map([[WE,_I],[`load-config`,(e,t)=>{let n=e.indexOf(`/`);if(n===-1)throw new $(`load-config: expected <sessionId>/<path> (missing separator)`);let r=pI(hI(()=>decodeURIComponent(e.slice(0,n)))),i=hI(()=>decodeURIComponent(e.slice(n+1))).trim();if(i!==``){if(!i.startsWith(`/`))throw new $(`load-config: path must be absolute, got "${i}"`);if(!/\.(json5?|json)$/.test(i))throw new $(`load-config: path must end with .json5 or .json, got "${i}"`)}i===``?(t.sessionState.clear(r,oL),t.dlog(`info`,`load-config: override cleared (session=${r})`)):(t.sessionState.set(r,oL,i),t.dlog(`info`,`load-config: ${i} (session=${r})`))}],[GE,vI],[HE,SI],[UE,TI],[YE,LI],[XE,RI],[eD,WI],[ZE,zI],[QE,HI],[$E,UI],[tD,qI],[nD,JI],[rD,ZI],[iD,YI],[aD,XI],[qE,yI],[JE,bI],[KE,xI],[oD,QI],[sD,nL],[cD,rL],[lD,iL],[uD,aL]]),cL=new Set([HE,UE,YE,XE,eD,ZE,QE,$E,tD,nD,rD,iD,aD,KE,oD,sD,cD,lD,uD]),lL=(e,t)=>{let n=[],r=!1,i=null;for(let{verb:a,value:o}of gD(mD(e))){if(!i&&cL.has(a)){let e=fD(o);e.length>0&&e[0]&&(i=e[0])}let e=sL.get(a);if(!e){n.push(`unknown effect verb "${a}"`);continue}try{e(o,t)}catch(e){e instanceof $||(r=!0),n.push(`${a}: ${e instanceof Error?e.message:String(e)}`)}}if(n.length>0){i&&t.sessionState.set(i,`click.error`,n.join(`
198
+ `));let e=`dispatch: ${n.join(`; `)}`;throw r?Error(e):new $(e)}};function uL(e){return(t,n)=>{let r=n.history.begin(),i=n.navigation.begin(r.sessionState),a=[];try{e(t,{...n,sessionState:r.sessionState,journal:r,navigating:i.sessionState})}catch(e){a.push(e)}i.commit();try{r.commit()}catch(e){a.push(e)}if(a.length===1)throw a[0];if(a.length>1)throw Error(a.map(e=>String(e.message??e)).join(`; `))}}const dL=new Map([...sL,[VE,lL]].map(([e,t])=>[e,uL(t)]));Object.freeze([...dL.keys()]);const fL=new Set([`hook_event_name`,`session_id`,`session_name`,`transcript_path`,`cwd`,`model`,`workspace`,`version`,`output_style`,`cost`,`context_window`,`exceeds_200k_tokens`,`effort`,`thinking`,`rate_limits`,`vim`,`agent`,`worktree`]),pL=[[`session_id`,`string`],[`transcript_path`,`string`],[`cwd`,`string`],[`model`,`object`],[`model.id`,`string`],[`model.display_name`,`string`],[`workspace`,`object`],[`workspace.current_dir`,`string`],[`workspace.project_dir`,`string`]],mL=[[`workspace.added_dirs`,`string-list`]];function hL(e){let t={missingRequired:[],typeMismatches:[],unknownTopLevelFields:[]},n=typeof e==`object`&&e&&!Array.isArray(e)?e:{};for(let[e,r]of pL){let i=vL(n,e);if(i==null)t.missingRequired.push(e);else{let n=gL(i);n!==r&&t.typeMismatches.push({path:e,expected:r,got:n})}}for(let[e,r]of mL){let i=vL(n,e),a=i===void 0?r:_L(i);a!==r&&t.typeMismatches.push({path:e,expected:r,got:a})}for(let e of Object.keys(n))fL.has(e)||t.unknownTopLevelFields.push(e);return{data:e,report:t}}function gL(e){return Array.isArray(e)?`array`:typeof e==`string`&&!e.isWellFormed()?`ill-formed string`:typeof e}function _L(e){return Array.isArray(e)&&e.every(e=>gL(e)===`string`)?`string-list`:gL(e)}function vL(e,t){let n=e;for(let e of t.split(`.`)){if(typeof n!=`object`||!n||Array.isArray(n))return;n=n[e]}return n}function yL(e,t){switch(e){case`vars`:return{what:e,vars:bL(t)};case`segments`:return{what:e,segments:TL(t)};case`config`:return{what:e,config:kL(t)}}}function bL(e){if(e===null)return[];let{store:t,registry:n,config:r}=e,i=CL(r),a=t.names().sort(),o=[];for(let e of a){let r=t.getNode(e),a=n.getLastError(e);o.push({name:e,source:i.get(e)??null,...xL(r),lastError:a===void 0?null:{timestampMs:a.timestamp,message:a.message},ageMs:SL(r.lastUpdatedMs())})}return o}function xL(e){if(e.kind!==`document`)try{return{type:e.type,value:e.read()}}catch(t){return{type:e.type,value:t instanceof Error?t.message:String(t)}}let t=e.read();switch(t.kind){case`ok`:return{type:`document`,value:JSON.stringify(t.value)};case`absent`:return{type:`document`,value:`(not yet scanned)`};case`failed`:return{type:`document`,value:t.reason}}}function SL(e){return e===null?null:Math.max(0,Date.now()-e)}function CL(e){let t=new Map;for(let[n,r]of Object.entries(e.variables))t.set(n,wL(r));for(let[n,r]of Object.entries(e.segments))if(r.vars)for(let[e,i]of Object.entries(r.vars))t.set(`${n}.${e}`,wL(i));return t}function wL(e){return e.kind}function TL(e){if(e===null)return[];let{store:t,config:n,lastRenderBySegment:r}=e,i=new Set(t.names()),a=DL(n),o=EL(n),s=[];for(let e of a){let t=n.segments[e];t&&s.push({name:e,description:t.description??null,template:t.template,referencedVars:OL(t.template,n.helpers,i),placements:(o.get(e)??[]).map(e=>({id:e,lastRender:r.get(e)??null}))})}return s}function EL(e){let t=new Map;for(let n of w_(e.presets))for(let r of ks(D_(e,n).node)){if(r.kind!==`segment`)continue;let e=t.get(r.name)??[],n=Ts(r);e.includes(n)||t.set(r.name,[...e,n])}return t}function DL(e){let t=[],n=new Set;for(let r of ks(Mc(e.root)))r.kind===`segment`&&e.segments[r.name]&&!n.has(r.name)&&(t.push(r.name),n.add(r.name));for(let r of Object.keys(e.segments))n.has(r)||(t.push(r),n.add(r));return t}function OL(e,t,n){let r=new Set;for(let i of mv(e,t).keys()){if(n.has(i)){r.add(i);continue}let e=i.split(`.`);for(;e.length>1;){e.pop();let t=e.join(`.`);if(n.has(t)){r.add(t);break}}}return Array.from(r).sort()}function kL(e){return e===null?null:e.config}const AL=[`vars`,`segments`,`config`];function jL(e){return typeof e==`string`&&AL.includes(e)}function ML(e){return Math.max(1,e-2)}var NL=class{thresholds={LOW:50,MEDIUM:80};getContextUsageThresholds(){return this.thresholds}ratioPercentages(e,t){let n=Math.min(100,Math.max(0,Math.round(e/t*100)));return{percentage:n,contextLeftPercentage:Math.max(0,100-n)}}calculateContextFromHookData(e){let t=e.context_window;if(!t?.current_usage)return k(`No current_usage in hook data, falling back to transcript parsing`),null;let n=t.current_usage,r=t.context_window_size,i=(n.input_tokens||0)+(n.cache_creation_input_tokens||0)+(n.cache_read_input_tokens||0);k(`Native current_usage: input=${n.input_tokens}, cache_create=${n.cache_creation_input_tokens}, cache_read=${n.cache_read_input_tokens}, total=${i} (limit: ${r})`);let a=this.ratioPercentages(i,r);return{totalTokens:i,maxTokens:r,percentage:t.used_percentage==null?a.percentage:Math.round(t.used_percentage),contextLeftPercentage:t.remaining_percentage==null?a.contextLeftPercentage:Math.round(t.remaining_percentage)}}async calculateContextTokensFromTranscript(e,t){try{k(`Calculating context tokens from transcript: ${e}`);let n=await sM(e);if(n.length===0)return k(`No entries in transcript`),Y;let r=null;for(let e=n.length-1;e>=0;e--){let t=n[e];if(t&&t.message?.usage?.input_tokens&&t.isSidechain!==!0){r=t,k(`Context segment: Found most recent entry at ${t.timestamp.toISOString()}, stopping search`);break}}if(r?.message?.usage){let e=r.message.usage,n=(e.input_tokens||0)+(e.cache_read_input_tokens||0)+(e.cache_creation_input_tokens||0);return k(`Most recent main chain context: ${n} tokens (limit: ${t})`),J({totalTokens:n,maxTokens:t,...this.ratioPercentages(n,t)})}return k(`No main chain entries with usage data found`),Y}catch(e){return X(`context transcript: ${e instanceof Error?e.message:String(e)}`)}}async getContextInfo(e){let t=this.calculateContextFromHookData(e);if(t)return J(t);let n=e.context_window?.context_window_size??2e5;return this.calculateContextTokensFromTranscript(e.transcript_path,n)}},PL=class{states=new Map;constructor(e,t,n=256){this.empty=e,this.step=t,this.maxSessions=n}async read(e,t){let n=this.states.get(e),r=Qk(t);if(n&&r!==0&&n.cursor.mtimeMs===r)return this.touch(e,n),{kind:`ok`,value:n.value};let i=await dM(t,n?.cursor);if(i.kind===`failed`)return i;if(i.kind===`absent`)return{kind:`ok`,value:n?.value??this.empty};let{entries:a,cursor:o,reset:s}=i.value,c=s||n===void 0?this.empty:n.value;for(let e of a)c=this.step(c,e);for(this.touch(e,{cursor:o,value:c});this.states.size>this.maxSessions;){let e=this.states.keys().next().value;if(e===void 0)break;this.states.delete(e)}return{kind:`ok`,value:c}}touch(e,t){this.states.delete(e),this.states.set(e,t)}};const FL={messageCount:0,recent:[]};function IL(e,t){if(t.isSidechain)return e;let n=[...e.recent,t];return{messageCount:e.messageCount+ +!!aM(t),recent:n.length>20?n.slice(-20):n}}function LL(e){let t=null,n=null;for(let r of e){let e=r.type||r.message?.role||r.message?.type;if(aM(r))t=r.timestamp;else if(e===`assistant`&&t){let e=(r.timestamp.getTime()-t.getTime())/1e3;e>.1&&e<300&&(n=e)}}return n}var RL=class{fold=new PL(FL,IL);async getMetricsInfo(e,t){if(k(`Getting metrics from hook data for session: ${e}`),!t.cost)return Y;let n=await this.fold.read(e,t.transcript_path);return n.kind===`failed`?X(`metrics (${e}): ${n.reason}`):J({responseTime:t.cost.total_api_duration_ms/1e3,lastResponseTime:LL(n.value.recent),sessionDuration:t.cost.total_duration_ms/1e3,messageCount:n.value.messageCount,linesAdded:t.cost.total_lines_added,linesRemoved:t.cost.total_lines_removed})}};const zL={command:null,todos:[],pending:[],done:[]};function BL(e,t){let n=e.findIndex(e=>e.name===t);return n<0?[...e,{name:t,count:1}]:e.map((e,t)=>t===n?{name:e.name,count:e.count+1}:e)}function VL(e,t){if(t.isSidechain)return e;let n=aM(t)?{...e,command:t.activity?.command??null,pending:[],done:[]}:e,r=t.activity;if(r===void 0)return n;let i=n.pending,a=n.done;r.started!==void 0&&(i=[...i,...r.started]);for(let e of r.finished??[]){let t=i.findIndex(t=>t.id===e);t<0||(a=BL(a,i[t].name),i=[...i.slice(0,t),...i.slice(t+1)])}return{...n,pending:i,done:a,todos:r.todos??n.todos}}function HL(e){return{command:e.command,todos:e.todos,running:e.pending.reduce((e,t)=>BL(e,t.name),[]),done:e.done}}var UL=class{fold=new PL(zL,VL);async getActivityInfo(e,t){let n=await this.fold.read(e,t.transcript_path);return n.kind===`failed`?X(`activity (${e}): ${n.reason}`):J(HL(n.value))}};const WL=new Map;function GL(e){if(!e)return``;let t=e.indexOf(`,`);return t<0?e:e.slice(0,t)}var KL=class{async getSessionId(){if(!process.env.TMUX_PANE)return Y;let e=GL(process.env.TMUX),t=WL.get(e);if(t!==void 0)return t;k(`Getting tmux session ID, TMUX_PANE: ${process.env.TMUX_PANE}`);let n=await De({bin:`tmux`,args:[`display-message`,`-p`,`#S`],timeoutMs:1e3,category:`tmux`}),r=n.ok?n.stdout.trim()?J(n.stdout.trim()):Y:X(`tmux display-message: ${n.reason}`);return WL.set(e,r),r}isInTmux(){return!!process.env.TMUX_PANE}};const qL=e=>JSON.stringify([e.sessionId,e.projectDir,e.cwd,e.claudeConfigDir,e.env===void 0?null:Je.map(t=>e.env?.[t]??null)]);var JL=class{readings=new Map;inFlight=new Map;constructor(e,t=Date.now){this.edge=e,this.now=t}getCeiling(e){let t=qL(e),n=this.readings.get(t);if(n&&this.now()-n.at<1e4)return Promise.resolve(n.outcome);let r=this.inFlight.get(t)??this.fetch(t,e);return n?Promise.resolve(n.outcome):r}fetch(e,t){let n=this.edge.locate(t),r=(n.kind===`ok`?this.edge.read(n.value,t):Promise.resolve(n)).then(t=>{if(this.inFlight.get(e)!==r)return t;for(this.readings.delete(e),this.readings.set(e,{outcome:t,at:this.now()});this.readings.size>64;)this.readings.delete(this.readings.keys().next().value);return t}).finally(()=>{this.inFlight.get(e)===r&&this.inFlight.delete(e)});return this.inFlight.set(e,r),r}move(e,t){let n=this.edge.locate(e);if(n.kind!==`ok`)throw Error(n.kind===`failed`?n.reason:`memento is not installed or not enabled for this project`);let r=qL(e);try{this.edge.move(n.value,e,t)}finally{this.readings.delete(r),this.inFlight.delete(r),this.fetch(r,e)}}},YL=class{written=new Map;constructor(e){this.dir=e}pathFor(e){return c.join(this.dir,`${encodeURIComponent(e)}.txt`)}sync(e,t){let n=this.pathFor(e);if(t===(this.written.get(e)??null))return null;try{return t===null?(r.rmSync(n,{force:!0}),this.written.delete(e)):(r.mkdirSync(this.dir,{recursive:!0,mode:448}),r.writeFileSync(n,t,{mode:384}),this.written.set(e,t)),null}catch(e){return`${n}: ${e.message}`}}reset(){this.written.clear();try{return r.rmSync(this.dir,{recursive:!0,force:!0}),null}catch(e){return`${this.dir}: ${e.message}`}}};const XL=new CP;Te(XL.launchStats);const ZL=new Jy({counters:XL,logger:Q}),QL=new nb({watchers:ZL,logger:Q}),$L=new wM,eR=new DP,tR=new EF(eR,Q),nR=new JF,rR=new YL(Ke()),iR=new NL,aR=new RL,oR=new UL,sR=new KL,cR=new JL(SA()),lR=new xP({gitService:QL,sessionState:eR,watchers:ZL},{observers:{onReload:e=>Q(`info`,`config loaded projectDir=${e.projectDir} cwd=${e.cwd} file=${e.configFilePath??`<bundled default>`} error=${e.lastError===null?`none`:JSON.stringify(e.lastError)} warning=${e.lastWarning===null?`none`:JSON.stringify(e.lastWarning)}`)}}),uR=60*1e3;function dR(){let e=import.meta.url,n=[];e.startsWith(`file://`)&&n.push(D(e)),t.argv[1]&&n.push(t.argv[1]);let i=new Map;for(let e of n)try{i.set(e,r.statSync(e).mtimeMs)}catch{}let a=null,o=()=>{for(let[e,t]of i)try{if(r.statSync(e).mtimeMs!==t){Q(`info`,`binary mtime changed (${e}); shutting down`),a&&clearInterval(a),DR(0);return}}catch(e){Q(`warn`,`bin stat failed: ${e.message}`)}};return{arm(){i.size!==0&&(a=setInterval(o,uR),a.unref())},checkNow:o}}const fR=dR(),pR=Jj({entryUrl:import.meta.url,intervalMs:uR,releaseIntervalMs:216e5,registryUrl:t.env.CC_CANDYBAR_REGISTRY_URL??`https://registry.npmjs.org`,fetchImpl:fetch,onApplied:()=>fR.checkNow(),log:Q});let mR=null,hR=null,gR=0;function _R(){t.on(`uncaughtException`,e=>{Q(`error`,`uncaughtException: ${e.stack||e.message}`),DR(1)}),t.on(`unhandledRejection`,e=>{Q(`error`,`unhandledRejection: ${String(e)}`),DR(1)});for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])t.on(e,()=>{Q(`info`,`received ${e}, shutting down`),DR(0)});try{gR=pE(t.env)}catch(e){Q(`error`,`refusing to boot: ${e.message}`),DR(1);return}mR=vO(t.pid);let e=OO(AO(mR));if(!e.decision.allow){Q(`warn`,`fork-bomb breaker: ${e.decision.reason}; refusing to boot`),DR(1);return}hR=e.registryPath,r.mkdirSync(Pe(),{recursive:!0}),Le(Fe()),eR.useStorage(new AP(Be(),500,Q)),tR.useStorage(KF(Ve(),Q)),xO({anchor:bO(t.env),isAlive:SO,onOrphaned:e=>{Q(`info`,`parent watchdog: ${e}; shutting down`),DR(0)}}),vR(b.createServer({allowHalfOpen:!1},e=>{OR(e)}),Fe(),!1)}function vR(e,n,r){e.removeAllListeners(`error`),e.removeAllListeners(`listening`),e.once(`error`,i=>{if(i.code!==`EADDRINUSE`){Q(`error`,`server error: ${i.message}`),DR(1);return}if(r){Q(`info`,`lost rebind race; another daemon is alive — exiting`),t.exit(0);return}yR(e,n)}),e.listen(n,()=>bR(n))}function yR(e,n){let i=cO(lO(Re(n)),(e,t)=>_O(e,t,{readStartTime:gO,pidAlive:SO}));if(i.kind===`attach-and-exit`){Q(`info`,`EADDRINUSE: ${i.reason} — exiting`),t.exit(0);return}Q(`warn`,`EADDRINUSE: ${i.reason} — unlinking stale socket and rebinding`);try{r.unlinkSync(n)}catch(e){if(e.code!==`ENOENT`){Q(`error`,`cannot unlink stale socket ${n}: ${e.message}`),DR(1);return}}vR(e,n,!0)}function bR(e){let n=fO(e);if(n.kind!==`present`){Q(`warn`,`no ownable socket at bind callback (${n.kind}); exiting`),DR(0);return}wR(e);try{r.chmodSync(e,384)}catch(e){Q(`warn`,`chmod socket failed: ${e.message}`)}Q(`info`,`daemon up: pid=${t.pid} v=3 sock=${e} heapCap=${Math.round(te.getHeapStatistics().heap_size_limit/1048576)}MB rssLimit=${Math.round(gR/1048576)}MB`),AE();let i=rR.reset();i!==null&&Q(`warn`,`diagnostic dump wipe failed: ${i}`),fR.arm(),pR.arm(),CR(),xR(e,n.identity)}function xR(e,n){hO({bound:n,myPid:t.pid,readIdentity:()=>fO(e),readLease:()=>lO(Re(e)),shutdown:e=>DR(e),log:Q}).arm()}let SR=null;function CR(){SR=_E(xE(XL.startedAt.getTime(),e=>DR(e),{rssLimitBytes:gR})),SR.arm()}function wR(e){let n=uO(Re(e),{pid:t.pid,version:3,binPath:t.argv[1],startTime:mR});n!==null&&Q(`warn`,`lease write failed: ${n}`)}let TR=0,ER=!1;function DR(e){if(!ER){ER=!0,setTimeout(()=>t.kill(t.pid,`SIGKILL`),500);try{QL.close()}catch(e){Q(`warn`,`gitService close failed: ${e.message}`)}try{$L.close()}catch(e){Q(`warn`,`usageStore close failed: ${e.message}`)}try{ZL.closeAll()}catch(e){Q(`warn`,`watcherRegistry close failed: ${e.message}`)}try{eR.flush()}catch(e){Q(`warn`,`sessionState flush failed: ${e.message}`)}dO(ze(),t.pid),hR!==null&&kO(hR,t.pid,EO,e=>r.unlinkSync(e)),t.exit(e)}}function OR(e){TR++,XL.inFlight=TR;let t=!1,n=(n,r)=>{if(t){r!==null&&Q(`warn`,`exit-after-flush dropped: an earlier responder settled this socket`);return}t=!0;let i=r===null?void 0:()=>DR(r);try{e.end(BT(n),i)}catch(e){Q(`warn`,`response write failed: ${e.message}`),i?.()}},r=setTimeout(()=>{XL.requestsTimedOut++,n({ok:!1,error:`request exceeded 200ms`,code:`TIMEOUT`,daemonV:3},null)},200),i=VT(e=>{AR(e).then(e=>n(e.resp,e.exitAfterFlush)).catch(e=>{Q(`error`,`handler threw: ${e?.stack||e}`),n({ok:!1,error:String(e?.message||e),code:`RENDER_FAILED`,daemonV:3},null)})},e=>{Q(`warn`,`frame parse failed: ${e.message}`),n({ok:!1,error:e.message,code:`BAD_REQUEST`,daemonV:3},null)});e.on(`data`,i),e.on(`error`,e=>{Q(`warn`,`socket error: ${e.message}`)}),e.on(`close`,()=>{clearTimeout(r),TR=Math.max(0,TR-1),XL.inFlight=TR})}const kR=e=>({resp:e,exitAfterFlush:null});async function AR(e){if(!e||typeof e!=`object`||typeof e.v!=`number`)return kR({ok:!1,error:`malformed request`,code:`BAD_REQUEST`,daemonV:3});if(e.v!==3)return e.v>3?Q(`info`,`version mismatch: client=${e.v} > daemon=3; binary likely upgraded — exiting after the response flushes`):Q(`info`,`version mismatch: client=${e.v} < daemon=3; client is stale — staying up`),{resp:{ok:!1,error:`protocol v${e.v} not supported (daemon at v3)`,code:`VERSION_MISMATCH`,daemonV:3},exitAfterFlush:e.v>3?0:null};if(e.kind===`shutdown`)return{resp:{ok:!0,output:``},exitAfterFlush:0};if(e.kind===`stats`)return kR({ok:!0,stats:XL.snapshot({gitCache:QL.getStats(),usageCache:$L.getStats(),renderCacheSize:lR.size,watchersActive:ZL.size(),nextRestartReason:SR?.describeNextRestart()??null})});if(e.kind===`render`){XL.requestsTotal++;let t=Date.now();try{let{report:n}=hL(e.hookData);for(let e of n.unknownTopLevelFields)Q(`info`,`schema: unknown field '${e}' — Anthropic may have added it`);let r=[];for(let e of n.missingRequired)r.push(`missing required field '${e}'`);for(let{path:e,expected:t,got:i}of n.typeMismatches)r.push(`field '${e}' expected ${t}, got ${i}`);if(e.cwd===``&&r.push(`request 'cwd' is empty`),r.length>0)return XL.requestsErrored++,Q(`warn`,`BAD_REQUEST: ${r.join(`; `)}`),kR({ok:!1,error:`malformed hookData: ${r.join(`; `)}`,code:`BAD_REQUEST`,daemonV:3});let i=e.hookData.workspace.project_dir,{configFile:a,unknownFlagsError:o}=jR(e.args),s=e.hookData.session_id,c=jT(e),l=JSON.stringify(c);eR.get(s,`client-hints`)!==l&&eR.set(s,$I,l);let u=eR.get(s,`config-override`)??a??c.configEnv,d=lR.getOrCreate(i,e.cwd,u),f=AI({projectDir:i,cwd:e.cwd,configFile:u??null});eR.get(s,`render-origin`)!==f&&eR.set(s,kI,f);let p=c.termCols,m=ML(p??120),h=qO(c.termRows),{authoredRoots:g}=d.state,_=t=>eR.get(e.hookData.session_id,t),v=wA(d.state.config,_,e=>g.has(e)),y=await VA(e.hookData,{...IR,navigation:e=>nR.depth(e,eR,Ej(d.state.config))},e.cwd,d.state.neededInputPaths(v.preset),v,c,{...pj(d.state.config,d.state.fileHeldSettings,_),configPath:d.configFilePath}),b=[],x=TA(v,m),S=sP(d.state.config,d.state.compiled,d.state.store,d.state.registry,y,x,{perSegmentSink:d.state.lastRenderCellsBySegment,onRenderWarning:e=>b.push(e)},EA(v)),C=eR.get(e.hookData.session_id,`click.error`);C&&eR.clear(e.hookData.session_id,`click.error`);let w=[o,d.lastError,C].filter(Boolean).join(`
199
+ `),T=pR.notice({sessionId:s,dismissed:eR.get(s,Mj),enabled:v.updateNotice}),ee=d.lastError===null?null:d.configFilePath,te=QO(w,T,[d.lastWarning??``,...b].filter(Boolean).join(`
200
+ `)),E=rR.sync(s,te===null?null:ek(te));E!==null&&Q(`warn`,`diagnostic dump failed: ${E}`);let ne=tk(S,te,{fullText:E===null?{kind:`file`,path:rR.pathFor(s)}:{kind:`unavailable`,reason:E},failedConfigFile:ee},{width:m,rowCap:h,colorCompatibility:v.colorCompatibility}),D=Date.now()-t,O=QL.getStats(),re=$L.getStats();return Q(`info`,`render sid=${e.hookData.session_id??`?`} took=${D}ms termCols=${p??`?`} termRows=${c.termRows??`?`} width=${m} git=${O.size}/${O.hits}h/${O.misses}m usage=${re.size}/${re.hits}h/${re.misses}m err=${w?`Y`:`N`} upd=${T.length} warn=${d.lastWarning?`Y`:`N`}`),kR({ok:!0,output:ne+`
201
+ `})}catch(e){throw XL.requestsErrored++,e}}if(e.kind===`click`)return kR(await LR(e.verb,e.value));if(e.kind===`debug`){if(!jL(e.what))return kR({ok:!1,error:`unknown debug 'what': ${String(e.what)} (have: ${AL.join(`, `)})`,code:`BAD_REQUEST`,daemonV:3});let t=lR.firstState(),n=t===null?null:{store:t.store,registry:t.registry,config:t.config,compiled:t.compiled,lastRenderBySegment:e.what===`segments`?FR(t.lastRenderCellsBySegment,t.config.globals.charset??`unicode`,t.config.globals.colorCompatibility??`truecolor`):PR};return kR({ok:!0,debug:yL(e.what,n)})}return kR({ok:!1,error:`unknown kind`,code:`BAD_REQUEST`,daemonV:3})}function jR(e){let{values:t,tokens:n}=v({args:e.slice(1),options:{config:{type:`string`}},strict:!1,tokens:!0,allowPositionals:!0}),r=[...new Set((n??[]).filter(e=>e.kind===`option`&&e.name!==`config`).map(e=>`--${e.name}`))];return{configFile:PT(t.config),unknownFlagsError:r.length>0?`Unknown flags: ${r.join(`, `)}`:null}}const MR={sessionState:eR,dlog:Q,applyUpdate:()=>pR.act(),doctor:ZF(),memento:cR,claudeInput:fI(),history:tR,navigation:nR,configFor:e=>lR.getOrCreate(e.projectDir,e.cwd,e.configFile??void 0).state.config,reloadConfig:e=>lR.reload(e.projectDir,e.cwd,e.configFile??void 0)};MR.reloadConfig;const NR={endcaps:`powerline`,colorCompatibility:`truecolor`,wrap:!0,padding:1,charset:po,width:1/0},PR=new Map;function FR(e,t,n){let r=new Map;for(let[i,a]of e)r.set(i,KO(a,{...NR,charset:t,colorCompatibility:n}));return r}const IR={gitProvider:QL,usageStore:$L,contextProvider:iR,metricsProvider:aR,activityProvider:oR,tmuxService:sR,mementoProvider:cR,autoCompact:Rk,log:Q,clock:()=>new Date,history:e=>tR.depth(e)};function LR(e,t){let n=dL.get(e);if(!n)return{ok:!1,error:`unknown click verb: ${e}`,code:`BAD_REQUEST`,daemonV:3};try{return n(t,MR),{ok:!0,output:``}}catch(e){let t=e instanceof $?`BAD_REQUEST`:`RENDER_FAILED`;return{ok:!1,error:String(e instanceof Error?e.message:e),code:t,daemonV:3}}}const RR={connectMs:200,budgetMs:500};async function zR(e){let n=e.includes(`--json`),r=await BR();if(r.kind!==`ok`&&(t.stderr.write(`daemon-stats: ${YT(r)}\n`),t.exit(1)),n){t.stdout.write(JSON.stringify(r.value,null,2)+`
202
+ `);return}t.stdout.write(WR(r.value))}function BR(){return UT({kind:`stats`},RR,e=>`stats`in e?e.stats:void 0)}function VR(e){return e<1024?`${e}B`:e<1024*1024?`${(e/1024).toFixed(1)}KB`:`${(e/1024/1024).toFixed(1)}MB`}function HR(e,t){let n=e+t;return n===0?`n/a`:`${(e/n*100).toFixed(1)}%`}function UR(e){return e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m${e%60}s`:`${Math.floor(e/3600)}h${Math.floor(e%3600/60)}m`}function WR(e){let t=[];t.push(`cc-candybar daemon stats`),t.push(``),t.push(`process`),t.push(` pid ${e.pid}`),t.push(` version ${e.version}`),t.push(` protocol ${e.protocolVersion}`),t.push(` startedAt ${e.startedAt}`),t.push(` uptime ${UR(e.uptimeSec)}`),t.push(` rss ${VR(e.rssBytes)}`),t.push(` heapUsed ${VR(e.heapUsedBytes)}`),t.push(` heapTotal ${VR(e.heapTotalBytes)}`),t.push(` external ${VR(e.externalBytes)}`),t.push(` arrayBuffers ${VR(e.arrayBuffersBytes)}`),t.push(``),t.push(`requests`),t.push(` total ${e.requests.total}`),t.push(` errored ${e.requests.errored}`),t.push(` timedOut ${e.requests.timedOut}`),t.push(` inFlight ${e.requests.inFlight}`),t.push(``),t.push(`gitCache`),t.push(` size ${e.gitCache.size}`),t.push(` hit rate ${HR(e.gitCache.hits,e.gitCache.misses)} (${e.gitCache.hits} / ${e.gitCache.hits+e.gitCache.misses})`),t.push(` invalidations ${e.gitCache.invalidations}`),t.push(``),t.push(`usageCache`),t.push(` size ${e.usageCache.size}`),t.push(` hit rate ${HR(e.usageCache.hits,e.usageCache.misses)} (${e.usageCache.hits} / ${e.usageCache.hits+e.usageCache.misses})`),t.push(` sweeps ${e.usageCache.sweeps}`),t.push(``),t.push(`renderCache`),t.push(` size ${e.renderCache.size}`),t.push(`watchers`),t.push(` active ${e.watchers.active}`),t.push(` opened ${e.watchers.opened}`),t.push(` closed ${e.watchers.closed}`),t.push(` evicted ${e.watchers.evicted}`),t.push(``),t.push(`subprocesses`),t.push(` total ${e.subprocesses.total}`),t.push(` inFlight ${e.subprocesses.inFlight}`),t.push(` lastMinute ${e.subprocesses.lastMinute}`);let n=Object.entries(e.subprocesses.byCategory),r=n.reduce((e,[t])=>Math.max(e,t.length),13);for(let[i,a]of n){let n=e.subprocesses.p50DurationMs[i],o=e.subprocesses.p99DurationMs[i],s=n!==void 0&&o!==void 0?` (p50 ${n}ms · p99 ${o}ms)`:``;t.push(` ${i.padEnd(r)} ${a}${s}`)}return e.nextRestartReason&&(t.push(``),t.push(`nextRestart ${e.nextRestartReason}`)),t.join(`
203
203
  `)+`
204
- `}const zR={connectMs:200,budgetMs:500};async function BR(e,n){let r=n.includes(`--json`),i=await VR(e);if(i.kind!==`ok`&&(t.stderr.write(`${e}: ${UT(i)}\n`),t.exit(1)),r){t.stdout.write(JSON.stringify(i.value,null,2)+`
205
- `);return}t.stdout.write(HR(i.value))}function VR(e){return LT({kind:`debug`,what:e},zR,e=>`debug`in e?e.debug:void 0)}function HR(e){switch(e.what){case`vars`:return UR(e.vars);case`segments`:return WR(e.segments);case`config`:return GR(e.config);default:return e}}function UR(e){if(e.length===0)return`no variables (DSL not active)
206
- `;let t=[`variables (${e.length})`,``],n=e.reduce((e,t)=>Math.max(e,t.name.length),4),r=e.reduce((e,t)=>Math.max(e,(t.source??`—`).length),6),i=e.reduce((e,t)=>Math.max(e,t.type.length),4);for(let a of e){let e=a.ageMs===null?``:` ${qR(a.ageMs)}`,o=a.lastError?` ✗ ${a.lastError.message}`:``;t.push(` ${a.name.padEnd(n)} ${(a.source??`—`).padEnd(r)} ${a.type.padEnd(i)} ${KR(a.value)}${e}${o}`)}return t.join(`
204
+ `}const GR={connectMs:200,budgetMs:500};async function KR(e,n){let r=n.includes(`--json`),i=await qR(e);if(i.kind!==`ok`&&(t.stderr.write(`${e}: ${YT(i)}\n`),t.exit(1)),r){t.stdout.write(JSON.stringify(i.value,null,2)+`
205
+ `);return}t.stdout.write(JR(i.value))}function qR(e){return UT({kind:`debug`,what:e},GR,e=>`debug`in e?e.debug:void 0)}function JR(e){switch(e.what){case`vars`:return YR(e.vars);case`segments`:return XR(e.segments);case`config`:return ZR(e.config);default:return e}}function YR(e){if(e.length===0)return`no variables (DSL not active)
206
+ `;let t=[`variables (${e.length})`,``],n=e.reduce((e,t)=>Math.max(e,t.name.length),4),r=e.reduce((e,t)=>Math.max(e,(t.source??`—`).length),6),i=e.reduce((e,t)=>Math.max(e,t.type.length),4);for(let a of e){let e=a.ageMs===null?``:` ${$R(a.ageMs)}`,o=a.lastError?` ✗ ${a.lastError.message}`:``;t.push(` ${a.name.padEnd(n)} ${(a.source??`—`).padEnd(r)} ${a.type.padEnd(i)} ${QR(a.value)}${e}${o}`)}return t.join(`
207
207
  `)+`
208
- `}function WR(e){if(e.length===0)return`no segments (DSL not active)
208
+ `}function XR(e){if(e.length===0)return`no segments (DSL not active)
209
209
  `;let t=[`segments (${e.length})`,``];for(let n of e){t.push(` ${n.name}`),n.description!==null&&t.push(` shows ${n.description}`),t.push(` template ${n.template}`),n.referencedVars.length>0&&t.push(` vars ${n.referencedVars.join(`, `)}`);for(let{id:e,lastRender:r}of n.placements)r!==null&&t.push(` last ${e}: ${r}`)}return t.join(`
210
210
  `)+`
211
- `}function GR(e){return e===null?`config: DSL not active
211
+ `}function ZR(e){return e===null?`config: DSL not active
212
212
  `:JSON.stringify(e,null,2)+`
213
- `}function KR(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?t.slice(0,57)+`…`:t}function qR(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m`}function JR(){let e=XR();return e===null?null:r.readFileSync(e,`utf-8`)}function YR(){let e;try{e=JR()}catch(e){t.stderr.write(`schema: cannot read bundled schema: ${e instanceof Error?e.message:String(e)}\n`),t.exit(2)}e===null&&(t.stderr.write("schema: bundled schema not found (expected schema/cc-candybar.schema.json). Run `pnpm gen:schema` from a source checkout.\n"),t.exit(2)),t.stdout.write(e),t.exit(0)}function XR(){let e=c.join(`schema`,`cc-candybar.schema.json`),n=t.argv[1];if(n===void 0)return null;let i=c.dirname(c.resolve(n));for(;;){let t=c.join(i,e);if(r.existsSync(t))return t;let n=c.dirname(i);if(n===i)return null;i=n}}function ZR(e){let t=e.CC_CANDYBAR_CONFIG??``;return t===``?void 0:t}const QR=5e3;function $R(e){let t=`/home/tester`,n=Math.floor(Date.now()/1e3),r=`test0a1b-2c3d-4e5f-6a7b-8c9d0e1f2a3b`,i={current_dir:`${t}/code/cc-candybar/src`,project_dir:`${t}/code/cc-candybar`,added_dirs:[]};return{hook_event_name:`Status`,session_id:r,version:`1.15.0`,home:t,cwd:`${t}/code/cc-candybar/src`,transcript_path:`${t}/.claude/projects/x/test.jsonl`,model:{id:`claude-opus-4-8`,display_name:`Opus 4.8`},workspace:i,git:{repoName:`cc-candybar`,repoUrl:`https://github.com/promptctl/cc-candybar`,branch:`main`,sha:`abc1234`,ahead:2,behind:1,staged:3,unstaged:2,untracked:1,conflicts:0,upstream:`origin/main`,stash:1,status:`dirty`,operation:`rebase`,timeSinceCommit:780},session:{cost:.39,tokens:241400},today:{cost:12.5,tokens:34e5},context:{totalTokens:48487,contextLeft:24},metrics:{lastResponseTime:8.2,responseTime:4.2,sessionDuration:930,messageCount:8,linesAdded:512,linesRemoved:88},block:{nativeUtilization:63,resetsAt:n+2*3600},weekly:{percentage:21,resetsAt:n+5*86400},cache:{expiresAt:n+900},tmux:{session:`work`},host:{name:`tester-box`,user:`tester`,ssh:!0},autocompact:Pk(4e5,1e6),...SA(e),history:{undo:1,redo:1,sinceEdit:1},navigation:{back:1},unsaved:1,resettable:1,resumeCommand:vA(i,r,void 0),configPath:`${t}/.config/cc-candybar/config.json5`}}function ez(e,t){let n=uT(e,e),r=fT(n);return r!==null&&t.push(r),n.kind===`file`?n.path:null}async function tz(e,n=t.cwd()){let i=[],a=e===void 0?ez(n,i):c.resolve(sT(e));if(e!==void 0&&a!==null){let e;try{e=r.statSync(a,{throwIfNoEntry:!1})}catch(e){return{kind:`unreadable`,path:a,message:e instanceof Error?e.message:String(e)}}if(e!==void 0&&!e.isFile())return{kind:`unreadable`,path:a,message:`not a file`}}let o=mT(n,n);o!==null&&i.push(o);try{return{kind:`clean`,configPath:a,warnings:i,rendered:await iz(a,n,i)}}catch(e){let t=e;return a!==null&&typeof t==`object`&&t&&typeof t.code==`string`&&t.path===a&&typeof t.message==`string`?{kind:`unreadable`,path:a,message:t.message}:(e instanceof bs&&i.push(...e.warnings),{kind:`fatal`,configPath:a,message:e instanceof bs||e instanceof Error?e.message:String(e),warnings:i})}}async function nz(e,t,n){let r=hT(e,Wk);n.push(...r.warnings);let i=vT(r,e??`<default>`),a=new uP,o=new wb(a,i.globals.default_empty_value??``,void 0,new SP);try{let e=ZN(i,o,{cwd:t});n.push(...e.loadWarnings);let r=await o.settled(QR);return r.length>0&&n.push(`source${r.length===1?``:`s`} still running after ${QR} ms, rendered with fallback values: ${r.join(`, `)}`),{config:i,compiled:e,store:a,registry:o}}catch(e){throw o.dispose(),e}}function rz({config:e,compiled:t,store:n,registry:r},i,a){let o=new Map;return{rendered:nP(e,t,n,r,$R(i),bA(i,a),{onSegmentError:(e,t)=>o.set(`segment "${e}"`,t),onRenderWarning:e=>o.set(`theme rule`,e)},xA(i)),failures:o}}async function iz(e,t,n){let r=await nz(e,t,n),{config:i}=r;try{Dj(i);let e=yA(i,()=>null,()=>!1),t=e=>rz(r,e,200),n=t(e),a=t({...e,presetCustomized:!0}),o=[...[...n.failures].map(([e,t])=>`${e}: ${t}`),...[...a.failures].filter(([e])=>!n.failures.has(e)).map(([e,t])=>`${e}: ${t} (under .preset.customized = true)`)];if(o.length>0)throw Error(`config renders with ${o.length} render error${o.length===1?``:`s`} (the daemon would show them on the bar):\n`+o.map(e=>` ${e}`).join(`
214
- `));return n.rendered}finally{r.registry.dispose()}}function az(e){return e.map(e=>`warning: ${e}\n`).join(``)}function oz(e,t=!1){switch(e.kind){case`clean`:return{stdout:`✓ ${e.configPath??`bundled default (no config file found)`}: config OK${e.warnings.length>0?` (${e.warnings.length} warning${e.warnings.length===1?``:`s`})`:``}\n`+(t?`${e.rendered}\n`:``),stderr:az(e.warnings),code:0};case`fatal`:return{stdout:``,stderr:az(e.warnings)+`✗ ${e.configPath??`<default>`}\n${e.message}\n`,code:1};case`unreadable`:return{stdout:``,stderr:`check: cannot read ${e.path}: ${e.message}\n`,code:2}}}const sz=`--render`,cz=`Usage: cc-candybar check [${sz}] [config-file]\n`;function lz(e){let t=e.filter(e=>e.startsWith(`--`)),n=e.filter(e=>!e.startsWith(`--`)),r=t.filter(e=>e!==sz);return r.length>0?{kind:`usage`,message:`check: unknown option ${r.join(` `)}\n${cz}`}:n.length>1||n[0]===``?{kind:`usage`,message:`check: expected at most one non-empty path\n${cz}`}:{kind:`run`,target:n[0],render:t.includes(sz)}}async function uz(e){let n=lz(e),r=n.kind===`usage`?{stdout:``,stderr:n.message,code:2}:oz(await tz(n.target??ZR(t.env)),n.render);t.stdout.write(r.stdout),t.stderr.write(r.stderr),t.exit(r.code)}const dz=`${kO}${OO}`;function fz(e){return`${dz}⚠ cc-candybar: ${pz(e)}\n`}function pz(e){switch(e.cause){case`version_mismatch`:{let t=e.daemonV===0?`unknown`:`v${e.daemonV}`;return`protocol mismatch (client v${e.clientV} ≠ daemon ${t})`}case`bad_request`:return`daemon rejected request: ${DO(e.message,60)}`;case`render_failed`:return`render failed: ${DO(e.message,60)}`;case`malformed_response`:return`malformed daemon response: ${DO(e.message,60)}`}}function mz(e){switch(e.kind){case`ok`:return{output:e.value,kick:!1,debug:null};case`transient`:return{output:`
215
- `,kick:!0,debug:`daemon unavailable (transient: ${e.cause}: ${e.message}) — kicking daemon`};case`permanent`:return{output:fz(e),kick:!1,debug:`daemon refused request (permanent: ${e.cause}) — not kicking`}}}function hz(e,t){if(e!==void 0&&/^\+?\d+$/.test(e)){let t=Number(e);if(t>0&&t<=4294967295)return t}if(t&&t>0)return t}const gz=` (fix: click the settings menu (${Uc} by default) › 🧰 tools › 🩺 doctor, then [fix] on the bar)`;function _z({check:e,verdict:t}){return t.ok?`✓ ${e.label}\n`:`✗ ${e.label} — ${t.reason}${t.fix===void 0?``:gz}\n`}function vz(e,t,n){let r;try{r=YF(e,{tmux:xx(t),claudeConfigDir:_D(t,n)})}catch(e){return{stdout:``,stderr:`doctor: ${e instanceof Error?e.message:String(e)}\n`,code:2}}let i=wx(r);return{stdout:i.map(_z).join(``),stderr:``,code:+!i.every(e=>e.verdict.ok)}}function yz(e){e.length>0&&(t.stderr.write(`doctor: takes no arguments
213
+ `}function QR(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?t.slice(0,57)+`…`:t}function $R(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m`}function ez(){let e=nz();return e===null?null:r.readFileSync(e,`utf-8`)}function tz(){let e;try{e=ez()}catch(e){t.stderr.write(`schema: cannot read bundled schema: ${e instanceof Error?e.message:String(e)}\n`),t.exit(2)}e===null&&(t.stderr.write("schema: bundled schema not found (expected schema/cc-candybar.schema.json). Run `pnpm gen:schema` from a source checkout.\n"),t.exit(2)),t.stdout.write(e),t.exit(0)}function nz(){let e=c.join(`schema`,`cc-candybar.schema.json`),n=t.argv[1];if(n===void 0)return null;let i=c.dirname(c.resolve(n));for(;;){let t=c.join(i,e);if(r.existsSync(t))return t;let n=c.dirname(i);if(n===i)return null;i=n}}function rz(e){let t=e.CC_CANDYBAR_CONFIG??``;return t===``?void 0:t}const iz=5e3;function az(e){let t=`/home/tester`,n=Math.floor(Date.now()/1e3),r=`test0a1b-2c3d-4e5f-6a7b-8c9d0e1f2a3b`,i={current_dir:`${t}/code/cc-candybar/src`,project_dir:`${t}/code/cc-candybar`,added_dirs:[]};return{hook_event_name:`Status`,session_id:r,version:`1.15.0`,home:t,cwd:`${t}/code/cc-candybar/src`,transcript_path:`${t}/.claude/projects/x/test.jsonl`,model:{id:`claude-opus-4-8`,display_name:`Opus 4.8`},workspace:i,git:{repoName:`cc-candybar`,repoUrl:`https://github.com/promptctl/cc-candybar`,branch:`main`,sha:`abc1234`,ahead:2,behind:1,staged:3,unstaged:2,untracked:1,conflicts:0,upstream:`origin/main`,stash:1,status:`dirty`,operation:`rebase`,timeSinceCommit:780},session:{cost:.39,tokens:241400},today:{cost:12.5,tokens:34e5},context:{totalTokens:48487,contextLeft:24},metrics:{lastResponseTime:8.2,responseTime:4.2,sessionDuration:930,messageCount:8,linesAdded:512,linesRemoved:88},block:{nativeUtilization:63,resetsAt:n+2*3600},weekly:{percentage:21,resetsAt:n+5*86400},cache:{expiresAt:n+900},tmux:{session:`work`},host:{name:`tester-box`,user:`tester`,ssh:!0},autocompact:zk(4e5,1e6),...DA(e),history:{undo:1,redo:1,sinceEdit:1},navigation:{back:1},unsaved:1,resettable:Nb(()=>!0),resumeCommand:CA(i,r,void 0),configPath:`${t}/.config/cc-candybar/config.json5`}}function oz(e,t){let n=gT(e,e),r=vT(n);return r!==null&&t.push(r),n.kind===`file`?n.path:null}async function sz(e,n=t.cwd()){let i=[],a=e===void 0?oz(n,i):c.resolve(pT(e));if(e!==void 0&&a!==null){let e;try{e=r.statSync(a,{throwIfNoEntry:!1})}catch(e){return{kind:`unreadable`,path:a,message:e instanceof Error?e.message:String(e)}}if(e!==void 0&&!e.isFile())return{kind:`unreadable`,path:a,message:`not a file`}}let o=bT(n,n);o!==null&&i.push(o);try{return{kind:`clean`,configPath:a,warnings:i,rendered:await uz(a,n,i)}}catch(e){let t=e;return a!==null&&typeof t==`object`&&t&&typeof t.code==`string`&&t.path===a&&typeof t.message==`string`?{kind:`unreadable`,path:a,message:t.message}:(e instanceof vs&&i.push(...e.warnings),{kind:`fatal`,configPath:a,message:e instanceof vs||e instanceof Error?e.message:String(e),warnings:i})}}async function cz(e,t,n){let r=xT(e,Yk);n.push(...r.warnings);let i=wT(r,e??`<default>`),a=new hP,o=new Tb(a,i.globals.default_empty_value??``,void 0,new DP);try{let e=nP(i,o,{cwd:t});n.push(...e.loadWarnings);let r=await o.settled(iz);return r.length>0&&n.push(`source${r.length===1?``:`s`} still running after ${iz} ms, rendered with fallback values: ${r.join(`, `)}`),{config:i,compiled:e,store:a,registry:o}}catch(e){throw o.dispose(),e}}function lz({config:e,compiled:t,store:n,registry:r},i,a){let o=new Map;return{rendered:sP(e,t,n,r,az(i),TA(i,a),{onSegmentError:(e,t)=>o.set(`segment "${e}"`,t),onRenderWarning:e=>o.set(`theme rule`,e)},EA(i)),failures:o}}async function uz(e,t,n){let r=await cz(e,t,n),{config:i}=r;try{let e=qj();try{Ej(i),kk(i)}finally{e()}let t=wA(i,()=>null,()=>!1),n=e=>lz(r,e,200),a=n(t),o=n({...t,presetCustomized:!0}),s=[...[...a.failures].map(([e,t])=>`${e}: ${t}`),...[...o.failures].filter(([e])=>!a.failures.has(e)).map(([e,t])=>`${e}: ${t} (under .preset.customized = true)`)];if(s.length>0)throw Error(`config renders with ${s.length} render error${s.length===1?``:`s`} (the daemon would show them on the bar):\n`+s.map(e=>` ${e}`).join(`
214
+ `));return a.rendered}finally{r.registry.dispose()}}function dz(e){return e.map(e=>`warning: ${e}\n`).join(``)}function fz(e,t=!1){switch(e.kind){case`clean`:return{stdout:`✓ ${e.configPath??`bundled default (no config file found)`}: config OK${e.warnings.length>0?` (${e.warnings.length} warning${e.warnings.length===1?``:`s`})`:``}\n`+(t?`${e.rendered}\n`:``),stderr:dz(e.warnings),code:0};case`fatal`:return{stdout:``,stderr:dz(e.warnings)+`✗ ${e.configPath??`<default>`}\n${e.message}\n`,code:1};case`unreadable`:return{stdout:``,stderr:`check: cannot read ${e.path}: ${e.message}\n`,code:2}}}const pz=`--render`,mz=`Usage: cc-candybar check [${pz}] [config-file]\n`;function hz(e){let t=e.filter(e=>e.startsWith(`--`)),n=e.filter(e=>!e.startsWith(`--`)),r=t.filter(e=>e!==pz);return r.length>0?{kind:`usage`,message:`check: unknown option ${r.join(` `)}\n${mz}`}:n.length>1||n[0]===``?{kind:`usage`,message:`check: expected at most one non-empty path\n${mz}`}:{kind:`run`,target:n[0],render:t.includes(pz)}}async function gz(e){let n=hz(e),r=n.kind===`usage`?{stdout:``,stderr:n.message,code:2}:fz(await sz(n.target??rz(t.env)),n.render);t.stdout.write(r.stdout),t.stderr.write(r.stderr),t.exit(r.code)}const _z=`${FO}${PO}`;function vz(e){return`${_z}⚠ cc-candybar: ${yz(e)}\n`}function yz(e){switch(e.cause){case`version_mismatch`:{let t=e.daemonV===0?`unknown`:`v${e.daemonV}`;return`protocol mismatch (client v${e.clientV} ≠ daemon ${t})`}case`bad_request`:return`daemon rejected request: ${NO(e.message,60)}`;case`render_failed`:return`render failed: ${NO(e.message,60)}`;case`malformed_response`:return`malformed daemon response: ${NO(e.message,60)}`}}function bz(e){switch(e.kind){case`ok`:return{output:e.value,kick:!1,debug:null};case`transient`:return{output:`
215
+ `,kick:!0,debug:`daemon unavailable (transient: ${e.cause}: ${e.message}) — kicking daemon`};case`permanent`:return{output:vz(e),kick:!1,debug:`daemon refused request (permanent: ${e.cause}) — not kicking`}}}function xz(e,t){if(e!==void 0&&/^\+?\d+$/.test(e)){let t=Number(e);if(t>0&&t<=4294967295)return t}if(t&&t>0)return t}const Sz=` (fix: click the settings menu (${Hc} by default) › 🧰 tools › 🩺 doctor, then [fix] on the bar)`;function Cz({check:e,verdict:t}){return t.ok?`✓ ${e.label}\n`:`✗ ${e.label} — ${t.reason}${t.fix===void 0?``:Sz}\n`}function wz(e,t,n){let r;try{r=eI(e,{tmux:Cx(t),claudeConfigDir:CD(t,n)})}catch(e){return{stdout:``,stderr:`doctor: ${e instanceof Error?e.message:String(e)}\n`,code:2}}let i=Ex(r);return{stdout:i.map(Cz).join(``),stderr:``,code:+!i.every(e=>e.verdict.ok)}}function Tz(e){e.length>0&&(t.stderr.write(`doctor: takes no arguments
216
216
  Usage: cc-candybar doctor
217
- `),t.exit(2));let n=vz(KF(),t.env,t.cwd());t.stdout.write(n.stdout),t.stderr.write(n.stderr),t.exit(n.code)}function bz(){return hz(t.env.COLUMNS,t.stderr.columns)}function xz(){return hz(t.env.LINES,t.stderr.rows)}const Sz=[`SSH_CONNECTION`,`SSH_CLIENT`,`SSH_TTY`],Cz=e=>e.some(e=>t.argv.includes(e));function wz(){return Sz.some(e=>(t.env[e]??``)!==``)}function Tz(){console.log(vx)}async function Ez(){try{Cz(gx.help)&&(Tz(),t.exit(0)),Cz(gx.version)&&(console.log(`cc-candybar ${pD}`),t.exit(0));let e=t.argv[2];if(e===`install`&&(await eO(t.argv.slice(3)),t.exit(0)),e===`install-url-handler`&&(YD(),t.exit(0)),e===`url-handle`){await ZD(t.argv[3]);return}if(e===`daemon`){dR();return}if(e===`daemon-stats`&&(await NR(t.argv.slice(3)),t.exit(0)),e===`check`||e===`lint`){await uz(t.argv.slice(3));return}if(e===`schema`){YR();return}if(e===`doctor`){yz(t.argv.slice(3));return}TL(e)&&(await BR(e,t.argv.slice(3)),t.exit(0)),t.stdin.isTTY===!0&&(console.error(`Error: This tool requires input from Claude Code
217
+ `),t.exit(2));let n=wz(ZF(),t.env,t.cwd());t.stdout.write(n.stdout),t.stderr.write(n.stderr),t.exit(n.code)}function Ez(){return xz(t.env.COLUMNS,t.stderr.columns)}function Dz(){return xz(t.env.LINES,t.stderr.rows)}const Oz=[`SSH_CONNECTION`,`SSH_CLIENT`,`SSH_TTY`],kz=e=>e.some(e=>t.argv.includes(e));function Az(){return Oz.some(e=>(t.env[e]??``)!==``)}function jz(){console.log(bx)}async function Mz(){try{kz(vx.help)&&(jz(),t.exit(0)),kz(vx.version)&&(console.log(`cc-candybar ${yD}`),t.exit(0));let e=t.argv[2];if(e===`install`&&(await oO(t.argv.slice(3)),t.exit(0)),e===`install-url-handler`&&(tO(),t.exit(0)),e===`url-handle`){await rO(t.argv[3]);return}if(e===`daemon`){_R();return}if(e===`daemon-stats`&&(await zR(t.argv.slice(3)),t.exit(0)),e===`check`||e===`lint`){await gz(t.argv.slice(3));return}if(e===`schema`){tz();return}if(e===`doctor`){Tz(t.argv.slice(3));return}jL(e)&&(await KR(e,t.argv.slice(3)),t.exit(0)),t.stdin.isTTY===!0&&(console.error(`Error: This tool requires input from Claude Code
218
218
 
219
219
  cc-candybar is designed to be used as a Claude Code statusLine command.
220
220
  It reads hook data from stdin and outputs formatted statusline.
@@ -230,4 +230,4 @@ Add to ~/.claude/settings.json:
230
230
  Run with --help for more options.
231
231
 
232
232
  To test output manually:
233
- echo '{"session_id":"test-session","workspace":{"project_dir":"/path/to/project"},"model":{"id":"claude-sonnet-4-5","display_name":"Claude"}}' | cc-candybar --style=powerline`),t.exit(1)),k(`Working directory: ${t.cwd()}`),k(`Process args:`,t.argv);let r=await n(t.stdin);k(`Received hook data:`,JSON.stringify(r,null,2)),r||(console.error(`Error: No input data received from stdin`),Tz(),t.exit(1));let i=mz(await qT(r,t.argv,t.cwd(),{termCols:bz(),termRows:xz(),ssh:wz(),tmux:xx(t.env),configEnv:ZR(t.env),claudeConfigDir:_D(t.env,t.cwd()),mementoEnv:Ye(t.env,t.cwd())}));i.debug!==null&&k(i.debug),i.kick&&gE(),t.stdout.write(i.output),t.exit(0)}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`Error generating statusline:`,n),t.exit(1)}}Ez();export{};
233
+ echo '{"session_id":"test-session","workspace":{"project_dir":"/path/to/project"},"model":{"id":"claude-sonnet-4-5","display_name":"Claude"}}' | cc-candybar --style=powerline`),t.exit(1)),k(`Working directory: ${t.cwd()}`),k(`Process args:`,t.argv);let r=await n(t.stdin);k(`Received hook data:`,JSON.stringify(r,null,2)),r||(console.error(`Error: No input data received from stdin`),jz(),t.exit(1));let i=bz(await $T(r,t.argv,t.cwd(),{termCols:Ez(),termRows:Dz(),ssh:Az(),tmux:Cx(t.env),configEnv:rz(t.env),claudeConfigDir:CD(t.env,t.cwd()),mementoEnv:Ye(t.env,t.cwd())}));i.debug!==null&&k(i.debug),i.kick&&SE(),t.stdout.write(i.output),t.exit(0)}catch(e){let n=e instanceof Error?e.message:String(e);console.error(`Error generating statusline:`,n),t.exit(1)}}Mz();export{};