@promptctl/cc-candybar 1.152.0 → 1.152.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +22 -22
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import{createRequire as e}from"node:module";import t from"node:process";import{URL as n,URLSearchParams as r,fileURLToPath as i,pathToFileURL as a}from"node:url";import{json as o}from"node:stream/consumers";import s,{basename as c,dirname as l,isAbsolute as u,join as d,sep as f}from"node:path";import p,{closeSync as m,constants as h,existsSync as g,fstatSync as _,openSync as v,readSync as y,realpathSync as b,statSync as ee,watch as x}from"node:fs";import S,{homedir as te}from"node:os";import{spawn as ne,spawnSync as re}from"node:child_process";import{inspect as ie,parseArgs as ae,types as oe}from"node:util";import C from"node:net";import w from"node:v8";import{open as se,readFile as T,readdir as ce,stat as le}from"node:fs/promises";import ue,{createHash as de,randomUUID as fe}from"node:crypto";import{clearInterval as pe,setImmediate as me,setInterval as he}from"node:timers";import{get as ge}from"node:https";import{setTimeout as _e}from"node:timers/promises";import{WriteStream as ve}from"node:tty";import{createInterface as ye}from"node:readline";var be=Object.create,xe=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,Ce=Object.getOwnPropertyNames,we=Object.getPrototypeOf,Te=Object.prototype.hasOwnProperty,Ee=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),De=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=Ce(t),a=0,o=i.length,s;a<o;a++)s=i[a],!Te.call(e,s)&&s!==n&&xe(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=Se(t,s))||r.enumerable});return e},Oe=(e,t,n)=>(n=e==null?{}:be(we(e)),De(t||!e||!e.__esModule?xe(n,`default`,{value:e,enumerable:!0}):n,e));function E(e,...t){process.env.CC_CANDYBAR_DEBUG&&console.error(`[DEBUG] ${e}`,...t)}const ke=(e,t)=>E(t),Ae=`cc-extra`;function je(e){return s.join(s.dirname(e),Ae,`src`,`bun-attach.js`)}function Me(e){return s.join(s.dirname(e),`bun-graph.js`)}function Ne(e,t){return oe.isNativeError(e)?e.code===`ENOENT`&&t!==void 0&&!g(t)?`working directory does not exist: ${t}`:e.message:String(e)}const Pe={"click.pbcopy":1e3,"click.open":1e3,"doctor.tmux":1e3,"doctor.font":1e3,"doctor.process":1e3,"claude-input.type":1e3},Fe=new Map;function Ie(e){let t=Pe[e];if(t===void 0)return{allowed:!0};let n=Fe.get(e);if(n===void 0)return{allowed:!0};let r=Date.now()-n;return r>=t?{allowed:!0}:{allowed:!1,minIntervalMs:t,sinceLastMs:r}}function Le(e){Fe.set(e,Date.now())}function Re(e){return e.env??process.env}function ze(e,t,n){return{ok:!1,reason:`rate-limited`,stdout:``,stderr:``,exitCode:null,signal:null,error:`rate-limited: ${e} min interval ${t}ms, last start ${n}ms ago`}}let Be=null;function Ve(e){Be=e}function He(e,t){try{process.kill(-e,t)}catch(e){if(e.code!==`ESRCH`)throw e}}async function Ue(e){if(e.signal?.aborted)return{ok:!1,reason:`aborted`,stdout:``,stderr:``,exitCode:null,signal:null};let t=Ie(e.category);if(!t.allowed)return ze(e.category,t.minIntervalMs,t.sinceLastMs);Le(e.category);let n=Date.now();return Be?.onStart(e.category),new Promise(t=>{let r;try{r=ne(e.bin,e.args??[],{cwd:e.cwd,env:Re(e),stdio:[`pipe`,`pipe`,`pipe`],detached:!0})}catch(r){Be?.onEnd(e.category,Date.now()-n),t({ok:!1,reason:`spawn-error`,stdout:``,stderr:``,exitCode:null,signal:null,error:Ne(r,e.cwd)});return}let i=``,a=``,o=!1,s=null,c=null,l=null,u=()=>m(`aborted`),d=t=>{o||(o=!0,s&&clearTimeout(s),c&&clearTimeout(c),e.signal?.removeEventListener(`abort`,u),Be?.onEnd(e.category,Date.now()-n),t())},f=e=>d(()=>t(e)),p=(e,t)=>{try{He(e,t)}catch(e){f({ok:!1,reason:`signal-refused`,stdout:i,stderr:a,exitCode:null,signal:null,error:e instanceof Error?e.message:String(e)})}},m=t=>{l=t,s&&clearTimeout(s),e.signal?.removeEventListener(`abort`,u);let n=r.pid;n!==void 0&&(c=setTimeout(()=>p(n,`SIGKILL`),250),p(n,`SIGTERM`))};r.stdout?.on(`data`,e=>{i+=e.toString(`utf8`)}),r.stderr?.on(`data`,e=>{a+=e.toString(`utf8`)}),r.on(`error`,t=>{f({ok:!1,reason:`spawn-error`,stdout:i,stderr:a,exitCode:null,signal:null,error:Ne(t,e.cwd)})}),r.on(`close`,(e,t)=>{if(l!==null){f({ok:!1,reason:l,stdout:i,stderr:a,exitCode:e,signal:t});return}if(e===0){f({ok:!0,stdout:i,stderr:a,exitCode:e});return}f({ok:!1,reason:t?`signal`:`non-zero`,stdout:i,stderr:a,exitCode:e,signal:t})}),e.timeoutMs&&e.timeoutMs>0&&(s=setTimeout(()=>m(`timeout`),e.timeoutMs)),e.signal?.addEventListener(`abort`,u,{once:!0}),e.stdinInput!==void 0&&r.stdin?r.stdin.end(e.stdinInput):r.stdin&&r.stdin.end()})}function We(e){let t=Ie(e.category);if(!t.allowed)return ze(e.category,t.minIntervalMs,t.sinceLastMs);Le(e.category);let n=Date.now();Be?.onStart(e.category);let r=[`pipe`,`pipe`,`pipe`];try{let t=re(e.bin,e.args??[],{cwd:e.cwd,env:Re(e),input:e.stdinInput,timeout:e.timeoutMs&&e.timeoutMs>0?e.timeoutMs:void 0,stdio:r,encoding:`utf8`});Be?.onEnd(e.category,Date.now()-n);let i=typeof t.stdout==`string`?t.stdout:``,a=typeof t.stderr==`string`?t.stderr:``;if(t.error)return{ok:!1,reason:t.error.code===`ETIMEDOUT`?`timeout`:`spawn-error`,stdout:i,stderr:a,exitCode:null,signal:t.signal??null,error:Ne(t.error,e.cwd)};if(t.status===0)return{ok:!0,stdout:i,stderr:a,exitCode:t.status};let o=e.timeoutMs!==void 0&&e.timeoutMs>0;return{ok:!1,reason:t.signal?o&&t.signal===`SIGTERM`?`timeout`:`signal`:`non-zero`,stdout:i,stderr:a,exitCode:t.status,signal:t.signal??null}}catch(t){return Be?.onEnd(e.category,Date.now()-n),{ok:!1,reason:`spawn-error`,stdout:``,stderr:``,exitCode:null,signal:null,error:Ne(t,e.cwd)}}}function Ge(e){let t=Ie(e.category);if(!t.allowed)return ze(e.category,t.minIntervalMs,t.sinceLastMs);Le(e.category);let n=Date.now();Be?.onStart(e.category);let r=Ke(e);return Be?.onEnd(e.category,Date.now()-n),r}function Ke(e){let t;try{t=ne(e.bin,e.args??[],{cwd:e.cwd,env:Re(e),detached:!0,stdio:`ignore`})}catch(t){return{ok:!1,reason:`spawn-error`,stdout:``,stderr:``,exitCode:null,signal:null,error:Ne(t,e.cwd)}}return t.once(`error`,()=>{}),t.pid===void 0?{ok:!1,reason:`spawn-error`,stdout:``,stderr:``,exitCode:null,signal:null,error:`spawn(${e.bin}): no pid (binary not found or unexecutable)`}:(t.unref(),{ok:!0,stdout:``,stderr:``,exitCode:null})}function qe(e,t,n){let r=Je(e);p.mkdirSync(s.dirname(r),{recursive:!0});let i=`${r}.tmp`,a=n??p.statSync(r,{throwIfNoEntry:!1})?.mode;try{p.writeFileSync(i,t,a===void 0?{}:{mode:a}),p.renameSync(i,r)}catch(e){throw p.rmSync(i,{force:!0}),e}}function Je(e){let t=e;for(let e=0;e<Ye;e++){let e;try{e=p.lstatSync(t)}catch(e){if(e.code===`ENOENT`)return t;throw e}if(!e.isSymbolicLink())return t;t=s.resolve(p.realpathSync(s.dirname(t)),p.readlinkSync(t))}throw Error(`${e}: more than ${Ye} symbolic links`)}const Ye=40;function Xe(e,t){let n=e[t];return n&&n.length>0?n:void 0}function Ze(e=process.env){let t=Xe(e,`XDG_STATE_HOME`)??s.join(S.homedir(),`.local`,`state`);return s.join(t,`cc-candybar`)}function Qe(){let e=Xe(process.env,`XDG_CACHE_HOME`)??s.join(S.homedir(),`.cache`);return s.join(e,`cc-candybar`)}function $e(){return Ze()}function et(){return process.env.CC_CANDYBAR_SOCKET||tt()}function tt(){let e=S.userInfo().uid;return s.join(`/tmp`,`cc-candybar-${e}`,`socket`)}function nt(e){p.mkdirSync(e,{recursive:!0,mode:448});let t=p.lstatSync(e);if(t.isSymbolicLink())throw Error(`directory is a symlink: ${e}`);if(!t.isDirectory())throw Error(`not a directory: ${e}`);let n=S.userInfo().uid;if(typeof n==`number`&&t.uid!==n)throw Error(`directory is not owned by uid ${n}: ${e} (owner uid=${t.uid})`);if(t.mode&63)throw Error(`directory has unsafe permissions: ${e} (mode=${(t.mode&511).toString(8)}, expected 0700)`)}function rt(e){nt(s.dirname(e));for(let t of[e,it(e)])try{if(p.lstatSync(t).isSymbolicLink())throw Error(`path is a symlink: ${t}`)}catch(e){if(e.code!==`ENOENT`)throw e}}function it(e){return`${e}.lease`}function at(){return it(et())}function ot(){return s.join(Ze(),`session-state.json`)}function st(){return s.join(Ze(),`settings-history.json`)}function ct(){let e=process.env.CC_CANDYBAR_DAEMON_REGISTRY_DIR;if(e)return e;let t=S.userInfo().uid;return s.join(`/tmp`,`cc-candybar-${t}`,`daemons`)}function lt(){return s.join(Ze(),`spawn.lock`)}function ut(){return s.join(Ze(),`spawn.cooldown`)}function dt(){return s.join(Ze(),`spawn.backoff`)}function ft(){return s.join(Ze(),`diagnostics`)}function pt(e=process.env){return s.join(Ze(e),`daemon.log`)}const D=[`MEMENTO_CONFIG_HOME`,`XDG_CONFIG_HOME`];function mt(e,t){return Object.fromEntries(D.flatMap(n=>{let r=e[n]??``;return r===``?[]:[[n,s.resolve(t,r)]]}))}const ht=[`TERM_PROGRAM`,`TERM_PROGRAM_VERSION`,`TERM`,`ITERM_PROFILE`,`XDG_CONFIG_HOME`];function gt(e){return Object.fromEntries(ht.flatMap(t=>{let n=e[t]??``;return n===``?[]:[[t,n]]}))}const _t=[`native`,`node`,`frames`];function O(e,t){return{kind:e,bundle:t,source:null}}const vt=Object.keys({termCols:!0,termRows:!0,ssh:!0,tmux:!0,configEnv:!0,claudeConfigDir:!0,mementoEnv:!0,terminalEnv:!0,client:!0});function yt(e){let t=kt(e.termCols),n=kt(e.termRows),r=At(e.ssh),i=Dt(e.tmux),a=Et(e.configEnv),o=Et(e.claudeConfigDir),s=wt(e.mementoEnv),c=Tt(e.terminalEnv),l=Lt(e.client);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},...c!==void 0&&{terminalEnv:c},...l!==void 0&&{client:l}}}function bt(e,t){return vt.filter(n=>e[n]!==void 0&&t[n]===void 0).map(t=>({hint:t,sent:e[t]}))}function xt(e){return e.length===0?null:`Client hints refused: ${e.map(({hint:e,sent:t})=>`${e}=${JSON.stringify(t)}`).join(`, `)} — is the statusline client older than the daemon? Reinstall it (\`cc-candybar install\`, or \`just install-rust\` in a checkout).`}const St={unknown:e=>`Unknown flags: ${e}`,"no-value":e=>`${e} names no file — the bar renders with no ${e}`,positional:e=>`Unexpected arguments: ${e}`};function Ct(e){let t=Object.keys(St).flatMap(t=>{let n=e.filter(e=>e.why===t).map(e=>e.arg);return n.length===0?[]:[St[t](n.join(`, `))]});return t.length===0?null:t.join(`
3
- `)}function wt(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n=D.filter(e=>t[e]!==void 0);return n.every(e=>Et(t[e])!==void 0)?Object.fromEntries(n.map(e=>[e,t[e]])):void 0}function Tt(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n=ht.filter(e=>t[e]!==void 0);return n.every(e=>typeof t[e]==`string`&&t[e]!==``)?Object.fromEntries(n.map(e=>[e,t[e]])):void 0}function Et(e){return typeof e==`string`&&s.isAbsolute(e)?e:void 0}function Dt(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 Ot=1e4;function kt(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.floor(e);if(!(t<=0))return t>Ot?Ot:t}function At(e){return typeof e==`boolean`?e:void 0}function jt(e){return typeof e==`string`&&e!==``&&e.length<=64?e:null}var Mt=class extends Error{constructor(e){super(e),this.name=`ProtocolError`}};function Nt(e){return Pt(JSON.stringify(e))}function Pt(e){let t=Buffer.from(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 Mt(`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 Mt(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(Nt(t))})}function Lt(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let{kind:t,bundle:n,source:r}=e,i=Et(n);return _t.includes(t)&&i!==void 0&&(r===null||typeof r==`string`&&r!==``)?{kind:t,bundle:i,source:r}:void 0}async function Rt(e,t,n){let r=null;try{r=await Ut(et(),t.connectMs);let i=await It(r,{v:3,...e},t.budgetMs);return Vt(e.kind,i,n)}catch(e){return Ht(e)}finally{r&&r.destroy()}}function zt(e,t){return typeof e==`string`?e:t}function Bt(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0?e:0}function Vt(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=zt(r.error,`(no error message)`);switch(r.code){case`VERSION_MISMATCH`:return{kind:`permanent`,cause:`version_mismatch`,clientV:3,daemonV:Bt(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};case`SWITCHED_OFF`:return{kind:`permanent`,cause:`switched_off`,message:i};default:return{kind:`permanent`,cause:`malformed_response`,message:`unknown error code: ${String(r.code)}`}}}function Ht(e){if(e instanceof Mt||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 Ut(e,t){return new Promise((n,r)=>{let i=C.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 Wt(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`switched_off`:case`malformed_response`:return`daemon error (${e.cause}): ${e.message}`}}const Gt=`1.152.0`,k={connectMs:50,budgetMs:150},Kt={connectMs:50,budgetMs:200};function qt(e){let t=e.output;return typeof t==`string`?t:void 0}function Jt(e){return Vt(`render`,e,qt)}function Yt(e,t,n,r){return Rt({kind:`render`,hookData:e,args:t,cwd:n,...r},k,qt)}function Xt(e,t){return Rt({kind:`pane-session`,socket:e,pane:t},Kt,e=>`paneSession`in e?e.paneSession:void 0)}function Zt(e,t){return Rt({kind:`click`,verb:e,value:t,clientVersion:Gt},Kt,qt)}let A=null;function Qt(e){if(A!==null)return A;p.mkdirSync(s.dirname(e),{recursive:!0});try{A=p.statSync(e).size}catch{A=0}return A}function $t(e){for(let t=2;t>=1;t--){let n=`${e}.${t}`,r=`${e}.${t+1}`;try{p.renameSync(n,r)}catch{}}try{p.renameSync(e,`${e}.1`)}catch{}A=0}function j(e,t){let n=`${new Date().toISOString()} [${e}] ${t}\n`;try{let e=pt(),t=Qt(e);p.appendFileSync(e,n),A=t+Buffer.byteLength(n,`utf8`),A>=5242880&&$t(e)}catch(e){A=null;try{process.stderr.write(`${n}cc-candybar: daemon.log unwritable: ${e.message}\n`)}catch{}}}const en=5e3;function tn(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(`
3
+ `)}function wt(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n=D.filter(e=>t[e]!==void 0);return n.every(e=>Et(t[e])!==void 0)?Object.fromEntries(n.map(e=>[e,t[e]])):void 0}function Tt(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let t=e,n=ht.filter(e=>t[e]!==void 0);return n.every(e=>typeof t[e]==`string`&&t[e]!==``)?Object.fromEntries(n.map(e=>[e,t[e]])):void 0}function Et(e){return typeof e==`string`&&s.isAbsolute(e)?e:void 0}function Dt(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 Ot=1e4;function kt(e){if(typeof e!=`number`||!Number.isFinite(e))return;let t=Math.floor(e);if(!(t<=0))return t>Ot?Ot:t}function At(e){return typeof e==`boolean`?e:void 0}function jt(e){return typeof e==`string`&&e!==``&&e.length<=64?e:null}var Mt=class extends Error{constructor(e){super(e),this.name=`ProtocolError`}};function Nt(e){return Pt(JSON.stringify(e))}function Pt(e){let t=Buffer.from(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 Mt(`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 Mt(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(Nt(t))})}function Lt(e){if(typeof e!=`object`||!e||Array.isArray(e))return;let{kind:t,bundle:n,source:r}=e,i=Et(n);return _t.includes(t)&&i!==void 0&&(r===null||typeof r==`string`&&r!==``)?{kind:t,bundle:i,source:r}:void 0}async function Rt(e,t,n){let r=null;try{r=await Ut(et(),t.connectMs);let i=await It(r,{v:3,...e},t.budgetMs);return Vt(e.kind,i,n)}catch(e){return Ht(e)}finally{r&&r.destroy()}}function zt(e,t){return typeof e==`string`?e:t}function Bt(e){return typeof e==`number`&&Number.isInteger(e)&&e>=0?e:0}function Vt(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=zt(r.error,`(no error message)`);switch(r.code){case`VERSION_MISMATCH`:return{kind:`permanent`,cause:`version_mismatch`,clientV:3,daemonV:Bt(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};case`SWITCHED_OFF`:return{kind:`permanent`,cause:`switched_off`,message:i};default:return{kind:`permanent`,cause:`malformed_response`,message:`unknown error code: ${String(r.code)}`}}}function Ht(e){if(e instanceof Mt||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 Ut(e,t){return new Promise((n,r)=>{let i=C.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 Wt(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`switched_off`:case`malformed_response`:return`daemon error (${e.cause}): ${e.message}`}}const Gt=`1.152.1`,k={connectMs:50,budgetMs:150},Kt={connectMs:50,budgetMs:200};function qt(e){let t=e.output;return typeof t==`string`?t:void 0}function Jt(e){return Vt(`render`,e,qt)}function Yt(e,t,n,r){return Rt({kind:`render`,hookData:e,args:t,cwd:n,...r},k,qt)}function Xt(e,t){return Rt({kind:`pane-session`,socket:e,pane:t},Kt,e=>`paneSession`in e?e.paneSession:void 0)}function Zt(e,t){return Rt({kind:`click`,verb:e,value:t,clientVersion:Gt},Kt,qt)}let A=null;function Qt(e){if(A!==null)return A;p.mkdirSync(s.dirname(e),{recursive:!0});try{A=p.statSync(e).size}catch{A=0}return A}function $t(e){for(let t=2;t>=1;t--){let n=`${e}.${t}`,r=`${e}.${t+1}`;try{p.renameSync(n,r)}catch{}}try{p.renameSync(e,`${e}.1`)}catch{}A=0}function j(e,t){let n=`${new Date().toISOString()} [${e}] ${t}\n`;try{let e=pt(),t=Qt(e);p.appendFileSync(e,n),A=t+Buffer.byteLength(n,`utf8`),A>=5242880&&$t(e)}catch(e){A=null;try{process.stderr.write(`${n}cc-candybar: daemon.log unwritable: ${e.message}\n`)}catch{}}}const en=5e3;function tn(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(`
4
4
  `)}const nn=`/usr/bin/footprint`;function rn(e,t){return e===`darwin`?[cn(nn,[`-p`,String(t)]),cn(`/usr/bin/vmmap`,[`--summary`,String(t)])]:e===`linux`?[ln(`/proc/self/smaps_rollup`),ln(`/proc/self/status`)]:[]}function an(e,t){return e===`darwin`?on(t,e=>Ue({bin:nn,args:e,timeoutMs:en,category:`limits.charge`})):async e=>({kind:`charged`,measure:`rss`,bytes:e})}function on(e,t){return async n=>{let r=await t([`-p`,String(e),`--noCategories`,`-f`,`bytes`]);if(!r.ok)return{kind:`stand-in`,bytes:n,unread:`footprint ${r.reason}${r.error===void 0?``:`: ${r.error}`}${un(r.stderr)}`};let i=sn(r.stdout);return i===null?{kind:`stand-in`,bytes:n,unread:`footprint printed no phys_footprint line`}:{kind:`charged`,measure:`phys_footprint`,bytes:i}}}function sn(e){let t=/^\s*phys_footprint:\s+(\d+) B\s*$/m.exec(e);return t===null?null:Number(t[1])}function cn(e,t){return{name:`${e} ${t.join(` `)}`,read:()=>{let n=We({bin:e,args:[...t],timeoutMs:en,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}`}${un(n.stderr)}`}}}}function ln(e){return{name:e,read:()=>{try{let t=p.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 un(e){let t=e.split(`
5
5
  `).map(e=>e.trim()).find(e=>e.length>0);return t===void 0?``:` (${t})`}const dn=`CC_CANDYBAR_RSS_LIMIT_MB`;function fn(e){let t=e[dn];if(t===void 0)return 512;let n=/^\d+$/.test(t)?Number(t):NaN;if(!Number.isSafeInteger(n)||n<=0)throw Error(`${dn} must be a positive integer (MB), got ${JSON.stringify(t)}`);return n}function pn(e){return fn(e)*2}const mn=1024*1024,hn=e=>Math.round(e/mn);function gn(e){return fn(e)*mn}const _n={memoryReport:{prefix:`memory-`,suffix:`.txt`},heapSnapshot:{prefix:`heap-`,suffix:`.heapsnapshot`}};function vn(e,t){return e>t}function yn(e,t){return e>t*.75}function bn(e,t,n){let{prefix:r,suffix:i}=_n[t];return s.join(e,`${r}${n}${i}`)}function xn(e){for(let t of Object.keys(_n)){let{prefix:n,suffix:r}=_n[t];if(e.startsWith(n)&&e.endsWith(r))return t}return null}function Sn(e){let t=e.limitBytes??512*mn,n=e.snapshotsKeep??3,r=!1,i={kind:`unmeasured`},a=null;function o(){return a??=s().finally(()=>{a=null}),a}async function s(){if(r)return!0;let{rss:a,heapTotal:o}=e.memoryBytes(),s=await e.memoryCharge(a),c={kind:`measured`,charge:s,rss:a,heapTotal:o};if(i=c,e.log(`info`,`memory ${Tn(c,t)}`),s.bytes<=t)return!1;r=!0,e.log(`warn`,`${Cn(s)} > limit ${hn(t)} MB (rss ${hn(a)} MB, v8 heap ${hn(o)} MB); recording memory then shutting down`);let l=`${new Date(e.now()).toISOString().replace(/[:.]/g,`-`)}-${e.pid}`;return En(e.log,`memory report`,()=>{let t=bn(e.snapshotDir,`memoryReport`,l);e.writeMemoryReport(t,e.captureMemoryReport()),e.log(`info`,`memory report written: ${t}`)}),En(e.log,`heap snapshot`,()=>{let t=bn(e.snapshotDir,`heapSnapshot`,l);e.log(`info`,`heap snapshot written: ${e.writeHeapSnapshot(t)}`)}),En(e.log,`artifact rotation`,()=>{for(let{artifacts:t}of M(e.listArtifacts()).slice(n))for(let n of Object.values(t))En(e.log,`evicting ${n}`,()=>e.removeFile(n))}),e.shutdown(0),!0}function c(){return i.kind===`measured`&&yn(i.charge.bytes,t)?`${Cn(i.charge)} approaching limit ${hn(t)} MB (v8 heap ${hn(i.heapTotal)} MB)`:null}function l(){let n;try{n={kind:`ok`,value:M(e.listArtifacts())}}catch(e){n={kind:`failed`,reason:e.message}}return{pid:e.pid,memory:i,limit:t,postMortems:n}}function u(t=6e4){let n,r=!0,i=async()=>{try{if(await o())return}catch(t){e.log(`warn`,`memory check failed: ${t.message}`)}r&&(n=setTimeout(()=>void i(),t),n.unref())};return i(),{disarm:()=>{r=!1,clearTimeout(n)}}}return{check:o,describeNextRestart:c,serving:l,arm:u}}function Cn(e){return e.kind===`charged`?`${e.measure} ${hn(e.bytes)} MB`:`rss ${hn(e.bytes)} MB (standing in: ${e.unread})`}function wn(e){return e.kind===`charged`?e.measure:`rss-stand-in`}function Tn({charge:e,rss:t,heapTotal:n},r){let i=e.kind===`stand-in`?` unread=${JSON.stringify(e.unread)}`:``;return`measure=${wn(e)} charge=${hn(e.bytes)}MB rss=${hn(t)}MB heap=${hn(n)}MB limit=${hn(r)}MB${i}`}function En(e,t,n){try{n()}catch(n){e(`warn`,`${t} failed: ${n.message}`)}}function M(e){let t=new Map;for(let n of e){let e=s.basename(n),r=xn(e);if(r===null)continue;let{prefix:i,suffix:a}=_n[r],o=e.slice(i.length,e.length-a.length);t.set(o,{...t.get(o),[r]:n})}let n=Object.keys(_n);return[...t].sort(([e],[t])=>vn(e,t)?-1:1).map(([e,t])=>({identity:e,artifacts:Object.fromEntries(n.flatMap(e=>t[e]===void 0?[]:[[e,t[e]]]))}))}function Dn(e,t,n={}){let r=$e();return{now:()=>Date.now(),pid:process.pid,snapshotDir:r,log:j,memoryBytes:()=>{let e=process.memoryUsage();return{rss:e.rss,heapTotal:e.heapTotal}},memoryCharge:an(process.platform,process.pid),captureMemoryReport:()=>tn(rn(process.platform,process.pid)),writeMemoryReport:(e,t)=>p.writeFileSync(e,t,{mode:384}),writeHeapSnapshot:e=>w.writeHeapSnapshot(e),listArtifacts:()=>{let e;try{e=p.readdirSync(r)}catch(e){if(e.code===`ENOENT`)return[];throw e}return e.filter(e=>xn(e)!==null).map(e=>s.join(r,e))},removeFile:e=>p.unlinkSync(e),shutdown:t,startedAtMs:e,...n}}function On(e={}){if(Wn()!==null)return;let n=e.spawn??Gn,r=Vn();if(r.kind===`contended`){let e=An();e!==null&&e>2e3&&(t.stderr.write(`cc-candybar: spawn-lock held ${e}ms (likely crashed holder) — spawning unlocked\n`),kn(n));return}if(r.kind===`error`){t.stderr.write(`cc-candybar: spawn-lock unavailable (${r.reason}) — spawning unlocked\n`),kn(n);return}try{kn(n)}finally{Un()}}function kn(e){Ln()&&jn(e)}function An(){try{let e=p.statSync(lt());return Date.now()-e.mtimeMs}catch{return null}}function jn(e){try{e()||t.stderr.write(`cc-candybar: daemon spawn returned false (unable to resolve script path?)
6
6
  `)}catch(e){t.stderr.write(`cc-candybar: daemon spawn failed: ${e.message}\n`)}}function Mn(e,t){return e===null?{kind:`allow`}:e<-1e4?{kind:`allow-future-garbage`,futureMs:-e}:e<t?{kind:`deny`}:{kind:`allow`}}function Nn(e){return Math.min(3e3*2**Math.min(Math.max(e,0),5),6e4)}function Pn(e){try{let t=p.readFileSync(e,`utf8`).trim(),n=Number(t);return!Number.isInteger(n)||n<0?0:Math.min(n,5)}catch{return 0}}function Fn(e,n){try{p.mkdirSync(s.dirname(e),{recursive:!0}),p.writeFileSync(e,String(n),{mode:384})}catch(e){t.stderr.write(`cc-candybar: could not record spawn.backoff: ${e.message}\n`)}}function In(){try{p.unlinkSync(dt())}catch(e){e.code!==`ENOENT`&&t.stderr.write(`cc-candybar: could not reset spawn.backoff: ${e.message}\n`)}}function Ln(){let e=ut(),n=dt(),r=Pn(n),i=Mn(Rn(e),Nn(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`),zn(e),Fn(n,Math.min(r+1,5)),!0)}function Rn(e){try{return Date.now()-p.statSync(e).mtimeMs}catch{return null}}function zn(e){try{p.mkdirSync(s.dirname(e),{recursive:!0}),p.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 Bn=null;function Vn(){let e=lt();for(let n=0;n<2;n++){try{let n=p.openSync(e,`wx`,384);try{p.writeSync(n,JSON.stringify({pid:t.pid,ts:Date.now()}))}catch{}return Bn={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(!Hn(e))return{kind:`contended`};try{p.unlinkSync(e)}catch(e){if(e.code!==`ENOENT`)return{kind:`error`,reason:`unlink stale spawn.lock: ${e.message}`}}}return{kind:`contended`}}function Hn(e){try{let t=p.statSync(e);return Date.now()-t.mtimeMs>1e4}catch{return!0}}function Un(){if(!Bn)return;let{fd:e,path:t}=Bn;Bn=null;try{p.closeSync(e)}catch{}try{p.unlinkSync(t)}catch{}}function Wn(){try{return p.mkdirSync($e(),{recursive:!0}),null}catch(e){return`mkdir ${$e()}: ${e.message}`}}function Gn(){let e=t.execPath,n=t.argv[1];return n?Ge({bin:e,args:[`--max-old-space-size=${pn(t.env)}`,n,`daemon`],category:`daemon-spawn`}).ok:!1}const Kn=`cc-candybar`,qn=`dispatch`,Jn=`set-state`,Yn=`step-state`,Xn=`copy`,Zn=`open-vscode`,Qn=`toolbar-toggle`,$n=`show-config-error`,er=`show-config-warning`,tr=`set-config`,nr=`step-config`,rr=`save`,ir=`save-preset`,ar=`save-theme-default`,or=`delete-preset`,sr=`reset-config`,cr=`apply-layout-op`,lr=`undo`,ur=`redo`,dr=`back`,fr=`rewind`,pr=`apply-update`,mr=`doctor-run`,hr=`doctor-fix`,gr=`doctor-mark`,_r=`doctor-probe`,vr=`ceiling`,yr=`slash`;function br(e){return e.map(encodeURIComponent).join(`/`)}function xr(e){return e.length===0?[]:e.split(`/`).map(decodeURIComponent)}function Sr(e){return`${Kn}://${qn}/${e.map(e=>`e=${encodeURIComponent(`${e.verb}/${br(e.args)}`)}`).join(`&`)}`}function Cr(e){return new r(e).getAll(`e`).map(Dr)}const wr=new Set([Jn,sr]);function Tr(e){return e.reduce((e,t)=>{let n=e.at(-1),r=n&&Er(n,t);return r?[...e.slice(0,-1),r]:[...e,t]},[])}function Er(e,t){if(e.verb!==t.verb||!wr.has(e.verb))return;let[n,r]=[Dr(e.value),Dr(t.value)];return n.verb===r.verb?{verb:e.verb,value:`${n.verb}/${n.value}/${r.value}`}:void 0}function Dr(e){let t=e.indexOf(`/`);return t===-1?{verb:e,value:``}:{verb:e.slice(0,t),value:e.slice(t+1)}}const Or=`closed`,kr=`🍫`;function Ar(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 jr(e,t,n,r){let i=Ar(e,t.length,n);if(i!==void 0)throw Error(i);return t.length===1?t[0]:t[r]}function Mr(e){return e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}function Nr(e,t,n,r,i){return{kind:`segment`,name:e,opens:{ref:t,body:n,placement:r},...i!==void 0&&{when:i}}}function Pr(e,...t){return`{{ and ${[e,...t].map(Fr).join(` `)} }}`}function Fr(e){return`(eq .${e.variable} "${Mr(e.member)}")`}function Ir(e,t,n){return`{{ ${Lr(e,Rr(t),Rr(n))} }}`}function Lr(e,t,n){return`action "${e}" ${t} ${n}`}function Rr(e){return`"${Mr(e)}"`}function zr(e,t){return{kind:`state`,key:e,default:t}}function Br(e,t){return{set:e,cycle:[Or,t]}}const Vr=/^[A-Za-z0-9_./,:@%+-][A-Za-z0-9_./,:@%+=-]*$/;function Hr(e){return`'${e.replaceAll(`'`,`'\\''`)}'`}function Ur(e){return Vr.test(e)?e:Hr(e)}var Wr=Ee(((e,t)=>{t.exports.Space_Separator=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,t.exports.ID_Start=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,t.exports.ID_Continue=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/})),Gr=Ee(((e,t)=>{let n=Wr();t.exports={isSpaceSeparator(e){return typeof e==`string`&&n.Space_Separator.test(e)},isIdStartChar(e){return typeof e==`string`&&(e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e===`$`||e===`_`||n.ID_Start.test(e))},isIdContinueChar(e){return typeof e==`string`&&(e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e>=`0`&&e<=`9`||e===`$`||e===`_`||e===`‌`||e===`‍`||n.ID_Continue.test(e))},isDigit(e){return typeof e==`string`&&/[0-9]/.test(e)},isHexDigit(e){return typeof e==`string`&&/[0-9A-Fa-f]/.test(e)}}})),Kr=Ee(((e,t)=>{let n=Gr(),r,i,a,o,s,c,l,u,d;t.exports=function(e,t){r=String(e),i=`start`,a=[],o=0,s=1,c=0,l=void 0,u=void 0,d=void 0;do l=v(),ie[i]();while(l.type!==`eof`);return typeof t==`function`?f({"":d},``,t):d};function f(e,t,n){let r=e[t];if(typeof r==`object`&&r)if(Array.isArray(r))for(let e=0;e<r.length;e++){let t=String(e),i=f(r,t,n);i===void 0?delete r[t]:Object.defineProperty(r,t,{value:i,writable:!0,enumerable:!0,configurable:!0})}else for(let e in r){let t=f(r,e,n);t===void 0?delete r[e]:Object.defineProperty(r,e,{value:t,writable:!0,enumerable:!0,configurable:!0})}return n.call(e,t,r)}let p,m,h,g,_;function v(){for(p=`default`,m=``,h=!1,g=1;;){_=y();let e=ee[p]();if(e)return e}}function y(){if(r[o])return String.fromCodePoint(r.codePointAt(o))}function b(){let e=y();return e===`
@@ -57,7 +57,7 @@ import{createRequire as e}from"node:module";import t from"node:process";import{U
57
57
  `)}function Vv(e,t,n,r){if(t===null)return e;let i=Wv(r),a=Uv(t,i),o=n.failedConfigFile!==null||a.length>r.rowCap,s=a.slice(0,r.rowCap-Number(o)),c=o?[Kv(t,n,a.length-s.length,i)]:[],l=[...s,...c].join(`
58
58
  `);return e?`${l}\n${e}`:l}function Hv(e,t){return Uv(e,Wv(t)).join(`
59
59
  `)}function Uv(e,t){return e.channels.flatMap(e=>Gv(e,t))}function Wv(e){return{endcaps:`plain`,separator:``,width:e.width,wrap:!0,padding:0,colorCompatibility:e.colorCompatibility}}function Gv(e,t){let n=new H({bgcolor:e.severity.colors.bg,color:e.severity.colors.fg}),r=Mo(Math.max(2,t.width-1)),i=(e,t)=>new G(`${e} `,{style:t,end:``,overflow:`ignore`});return e.lines.flatMap((a,o)=>jv([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=>Lo(e,r)).map(e=>i(e,t))})],t).split(`
60
- `))}function Kv(e,t,n,r){let{colors:i}=e.channels[0].severity,{fullText:o,failedConfigFile:s}=t,c=new H({bgcolor:i.bg,color:i.fg}),l=(e,t)=>new G(e,{style:t,end:``,overflow:`ignore`}),u=n>0?[l(`${n} more rows · `,c),o.kind===`file`?l(`open full text`,c.withLink(a(o.path).href)):l(`full text unavailable: ${Q_(o.reason)}`,c)]:[],d=s===null?[]:[l(`${u.length>0?` · `:``}open `,c),l(Q_(s),c.withLink(a(s).href))],f=[l(`↳ `,c),...u,...d.slice(0,-1)],p=f.reduce((e,t)=>e+t.cellLength,0),m=d.slice(-1).map(e=>e.truncate(Math.max(1,r.width-p),{mode:`middle`})),h=G.fromFragments([...f,...m]).truncate(r.width);return h.overflow=`ignore`,jv([h],r)}const qv=e=>!e.startsWith(`.`)&&!e.endsWith(`~`);function Jv(e,t){return t.isSymbolicLink()?Buffer.from(p.readlinkSync(e)):p.readFileSync(e)}function Yv(e,t,n=qv){return p.readdirSync(t).filter(n).sort().flatMap(n=>{let r=s.join(t,n),i=p.lstatSync(r,{throwIfNoEntry:!1});return i===void 0?[]:i.isDirectory()?Yv(e,r):[[s.relative(e,r).split(s.sep).join(`/`),Jv(r,i)]]})}function Xv(e){let t=ue.createHash(`sha256`);for(let[n,r]of e)t.update(n).update(`\0`).update(r).update(`\0`);return t.digest(`hex`)}function Zv(e){return Xv(Yv(e,e))}const Qv=[`Cargo.toml`,`Cargo.lock`,`src`];function $v(e){return Xv(Yv(e,e,e=>Qv.includes(e)))}const ey=e=>e.slice(0,7);function ty(e){let t=s.dirname(s.dirname(e));return p.existsSync(s.join(t,`src`))?t:null}function ny(){let e=ry();if(e===null)throw Error("this bundle carries no source digest (build via `pnpm build`, which stamps it)");return{version:Gt,digest:e}}function ry(){return`918356c079174da2fce879239ea9698accaa5566af4666a8f4300f0365fe614b`}function iy(e){let t=JSON.parse(p.readFileSync(s.join(e,`package.json`),`utf8`)),n=typeof t==`object`&&t?t.version:void 0;if(typeof n!=`string`)throw Error(`${s.join(e,`package.json`)} has no version string`);return n}function ay(e,t){try{let n=ty(i(e));if(n===null)return{kind:`not-source-checkout`};let r=t(),a=Zv(s.join(n,`src`));return a===r.digest?{kind:`current`,root:n,stamp:r}:{kind:`stale`,root:n,source:{version:iy(n),digest:a},running:r}}catch(e){return{kind:`unchecked`,reason:e.message}}}var J=class extends Error{constructor(e){super(e),this.name=`BadVerbArgs`}};const oy=new Map;function sy(e){let t=ly(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 cy(e,t){return e===`bar`?t:sy(e)}function ly(e){let t=oy.get(e);if(t!==void 0)return t;let n=qc(e);return n===null?null:(oy.set(e,n),n)}function uy(e,t){return dy(e,`${t.hueShift} ${t.chromaScale} ${t.lightnessScale} ${t.lightnessShift}`,()=>al(e,t))}const dy=Zp();function fy(e){let t=ly(e);return t===null?null:{kind:`decided`,name:e,value:t}}function py(e,t,n){let r=fy(e);return r===null?(n(Eh(t,`palette`,`"${e}" names no installed theme${ch(e)}`)),hy()):r}function my(e,t,n){return vh(e,t,n,hy(),fy)}function hy(){return{kind:`decided`,name:lh,value:sy(lh)}}const gy=/^[A-Za-z_][A-Za-z0-9_]*$/;function _y(e){return`#${e+1}`}const vy={rows:{}};function yy(e){return`rows`in e}function by(e){return Object.fromEntries(e.map((e,t)=>[_y(t),e]))}function xy(e){if(e.kind===`container`&&e.direction===`vertical`){let{kind:t,direction:n,children:r,...i}=e;return{...i,rows:by(r)}}let{when:t,...n}=e;return{...t!==void 0&&{when:t},rows:by([n])}}function Sy(e){let{rows:t,...n}=e;return{kind:`container`,direction:`vertical`,children:Object.values(t),...n}}function Cy(e){return yy(e)?Sy(e):e}function*wy(e,t){if(!yy(e)){yield*eg(e,t);return}yield[Sy(e),t];for(let[n,r]of Object.entries(e.rows))yield*eg(r,`${t}.rows.${n}`)}function Ty(e,t){return yy(e)?{...t,...e,rows:{...t.rows,...e.rows}}:xy(e)}function Ey(e){if(!yy(e))return!0;let{rows:t,...n}=e;return Object.values(n).some(e=>e!==void 0)||Object.keys(t).length>0}const Dy=`default`,Oy={};function ky(e){return[...new Set([Dy,...Object.keys(e)])]}function Ay(e,t,n){return hh(void 0,e,t,Dy,n)}function jy(e,t){let n={[Dy]:Oy,...e}[t];if(n===void 0)throw Error(`Preset "${t}" is not declared in this config — effectivePresetName collapses unknown names to "${Dy}", which always resolves; a miss here means a raw name reached this function without going through that resolution`);return n}function My(e,t){let n=jy(e.presets,t).root??vy;return{node:Sy(Ty(n,e.root)),path:Ey(n)?`presets.${t}.root`:`root`}}function Ny(e,t){return{...e.globals,...jy(e.presets,t).globals}}const Py=new Map;function Fy(e,t,n){Py.set(e,{permanent:!0,resolve:t,paletteOf:n})}Fy(`themes`,()=>dh(),e=>sy(e));const Iy=`placementThemes`;Fy(Iy,fh,(e,t)=>cy(e,t.palette));for(let{name:e,members:t}of F_)Fy(e,()=>t);function Ly(e){return new Map([[`styles`,{members:Object.keys(e.styles),paletteOf:(t,n)=>uy(n.basePalette,e.styles[t])}],[`presets`,{members:ky(e.presets)}]])}function Ry(e){return[...new Set([...Py.keys(),...e.keys()])]}function zy(e,t){if(typeof e!=`string`)return{members:e};let n=t.get(e);if(n)return n;let r=Py.get(e);if(r)return{members:r.resolve(),paletteOf:r.paletteOf};throw Error(Vy(e,t))}const By=new Map([[`looks`,`styles`],[`progressions`,`variations`]]);function Vy(e,t){let n=By.get(e);return`unknown option domain "${e}"${n===void 0?``:` — it was renamed "${n}"; write from: "${n}"`} (have: ${Ry(t).join(`, `)})`}const Hy=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`[^`]*`/g;function*Uy(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 Wy=`[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*`,Gy=RegExp(`^(?:(\\$)(?:\\.(${Wy}))?|\\.(${Wy})?)(?=[\\s)]|$)`);function Ky(e,t,n){let r=Gy.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 qy=/^(\w+)\b\s*([\s\S]*)$/;function*Jy(e,t){let n=[t];for(let r of Uy(e)){let e=r.replace(/^-(?=\s)/,``).trim(),[,i=``,a=``]=qy.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:Ky(r[1],s,t);continue}yield{code:e,dot:o},i===`if`&&n.push(o),i===`with`&&n.push(Ky(a,o,t)),(i===`range`||i===`define`||i===`block`)&&n.push(null)}}const Yy=/(?<![.$])\btemplate\s+$/;function*Xy(e,t,n){let r=0;for(let i of[...e.matchAll(Hy)]){let a=i.index+i[0].length;Yy.test(e.slice(r,i.index))&&(yield{name:i[0].slice(1,-1),at:Ky(e.slice(a),t,n)}),r=a}}function*Zy(e,t){let n=new Set;function*r(e,i,a,o){for(let{code:s,dot:c}of[...Jy(e,i)]){yield{code:s,dot:c,root:i,via:a};for(let e of[...Xy(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 Qy=RegExp(`(?<![A-Za-z0-9_)$])(\\$?)\\.(${Wy})`,`g`);function*$y({code:e,dot:t,root:n}){let r=e.replace(Hy,``);for(let e of[...r.matchAll(Qy)]){let r=e[1]===`$`?n:t;r!==null&&(yield`${r}${e[2]}`)}}function eb(e,t){let n=new Map;for(let r of Zy(e,t))for(let e of $y(r))n.has(e)||n.set(e,r.via);return n}const tb=/(?<![.$])\b(action|picker|menu|carousel|swatches|swatch|themePreview)\s+$/,nb={action:1,picker:2,menu:1,carousel:2,swatch:1,swatches:2,themePreview:1};function*rb(e){let t=0,n=0,r=0,i=`action`;for(let a of[...e.matchAll(Hy)]){let o=e.slice(t,a.index),s=tb.exec(o);if(s!==null)n=nb[s[1]],r=0,i=s[1]===`action`?`action`:`options`;else for(let e of o)e===`(`&&r++,e===`)`&&r--,(r<0||e===`|`&&r===0)&&(n=0);n>0&&r===0&&(yield{name:a[0].slice(1,-1),site:i},n--),t=a.index+a[0].length}}function ib(e,t){let n=new Map;for(let{code:r,via:i}of Zy(e,t))for(let{name:e,site:t}of rb(r)){let r=`${e}\0${i??`\0`}`;n.has(r)||n.set(r,{name:e,site:t,via:i})}return[...n.values()]}function ab(e,t){return new Set([...ob(e,t)].filter(e=>Object.hasOwn(t,e)))}function ob(e,t){let n=new Set;for(let{code:r,dot:i,root:a}of Zy(e,t))for(let{name:e}of Xy(r,i,a))n.add(e);return n}function sb(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 cb(e){let t=new Set,n=new Set,r=(e,r)=>{t.add(e),lb(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 lb(e){return e.kind===`dropped`||(e.kind===`shell`||e.kind===`file`)&&ng(e.parse)===`json`}function ub(e){let t=s.basename(e),n=s.dirname(e);for(;;){let r=db(n);if(r!==null)return{dir:r,name:t,leaf:n===s.dirname(e)};t=s.basename(n),n=s.dirname(n)}}function db(e){try{return p.statSync(e).isDirectory()?p.realpathSync(e):null}catch{return null}}var fb=Ee((e=>{function t(e,...t){throw Error(`[MobX] minified error nr: ${e}${t.length?` `+t.map(String).join(`,`):``}. See mobx.js.org/errors`)}function n(e){let t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function r(e){return typeof e==`function`}function i(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function a(e){return typeof e==`object`&&!!e}function o(e){if(!a(e))return!1;let t=Object.getPrototypeOf(e);if(t==null)return!0;let n=p(t,`constructor`)&&t.constructor;return typeof n==`function`&&n.toString()===Ht}function s(e){let t=e?.constructor;return!!t&&(t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`)}function c(e,t,n){Rt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function l(e,t){let n=`isMobX`+e;return t.prototype[n]=!0,function(e){return a(e)&&!0===e[n]}}function u(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function d(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}function f(e){return e===null?null:typeof e==`object`?``+e:e}function p(e,t){return zt.hasOwnProperty.call(e,t)}function m(e,t){return!!(e&t)}function h(e,t,n){return n?e|=t:e&=~t,e}function g(e,t=Ut,n=Ut){let r=new Kt(e);return t!==Ut&&(r.onBOL=new Set([t])),n!==Ut&&(r.onBUOL=new Set([n])),r}function _(e,t){return jt(e,t)}function v(e,t,n){return e===null||typeof e!=`object`&&typeof e!=`function`||nt(e)?e:Array.isArray(e)?cn.array(e,{name:n}):o(e)?cn.object(e,void 0,{name:n}):u(e)?cn.map(e,{name:n}):d(e)?cn.set(e,{name:n}):typeof e!=`function`||Ge(e)||$e(e)?e:s(e)?Kn(e):Rn(n,e)}function y(e){return e}function b(e,t){return{t:e,i:t,o:ee,u:x}}function ee(e,t,n,r){var i;return(i=this.i)!=null&&i.bound?this.u(e,t,n,!1)===null?0:1:r===e.h?this.u(e,t,n,!1)===null?0:2:Ge(n.value)?1:(Rt(r,t,te(e,this,t,n,!1)),2)}function x(e,t,n,r){let i=te(e,this,t,n);return e.l(t,i,r)}function S(e,n,r){let{kind:i,name:a,addInitializer:o}=r,s=e,c=e=>{var t;return be(s.i?.name??a.toString(),e,(t=s.i?.autoAction)!=null&&t)};return i==`field`?function(e){var t;let n=e;return Ge(n)||(n=c(n)),(t=s.i)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n}:i==`method`?(Ge(n)||(n=c(n)),(l=s.i)!=null&&l.bound&&o(function(){let e=this,t=e[a].bind(e);t.isMobxAction=!0,e[a]=t}),n):void t(43,s.t,String(a),i);var l}function te(e,t,n,r,i=M.safeDescriptors){var a,o,s;let{value:c}=r;return(a=t.i)!=null&&a.bound&&(c=c.bind(e.v??e.h)),{value:be(t.i?.name??n.toString(),c,(o=t.i?.autoAction)!=null&&o,(s=t.i)!=null&&s.bound?e.v??e.h:void 0),configurable:!i||e.p,enumerable:!1,writable:!i}}function ne(e,t){return{t:e,i:t,o:re,u:ie}}function re(e,t,n,r){var i;return r===e.h?this.u(e,t,n,!1)===null?0:2:(i=this.i)!=null&&i.bound&&(!p(e.h,t)||!$e(e.h[t]))&&this.u(e,t,n,!1)===null?0:$e(n.value)?1:(Rt(r,t,oe(e,0,0,n,!1,!1)),2)}function ie(e,t,n,r){let i=oe(e,0,0,n,this.i?.bound);return e.l(t,i,r)}function ae(e,t,n){var r;let{name:i,addInitializer:a}=n;return $e(t)||(t=Kn(t)),(r=e.i)!=null&&r.bound&&a(function(){let e=this,t=e[i].bind(e);t.isMobXFlow=!0,e[i]=t}),t}function oe(e,t,n,r,i,a=M.safeDescriptors){let{value:o}=r;return $e(o)||(o=Kn(o)),i&&(o=o.bind(e.v??e.h),o.isMobXFlow=!0),{value:o,configurable:!a||e.p,enumerable:!1,writable:!a}}function C(e,t){return{t:e,i:t,o:w,u:se}}function w(e,t,n){return this.u(e,t,n,!1)===null?0:1}function se(e,t,n,r){return e.m(t,It({},this.i,{get:n.get,set:n.set}),r)}function T(e,t,n){function r(e){let n=It({},i.i,{get:t,context:e});return n.name||=`ObservableObject.${a.toString()}`,new bn(n)}let i=e,{name:a,addInitializer:o}=n,s;return o(function(){let e=wt(this)[k],n=this,i=e.j.get(a);i instanceof bn&&i.derivation!==t&&e.j.delete(a),(e.O??=new Map).set(a,()=>r(n))}),function(){let e=this[k],n=e.j.get(a);if(n instanceof bn&&n.derivation!==t){let e=s?.get(this);return e||(e=r(this),(s??=new WeakMap).set(this,e)),e.get()}return e._(a)}}function ce(e,t){return{t:e,i:t,o:le,u:ue}}function le(e,t,n){return this.u(e,t,n,!1)===null?0:1}function ue(e,t,n,r){return e.S(t,n.value,this.i?.A??v,r)}function de(e,t,n){function r(e,t){let n=wt(e)[k];return(n.V??=new Map).set(o,()=>new vn(t,i.i?.A??v,`ObservableObject.${o.toString()}`,!1)),n}let i=e,{kind:a,name:o}=n;if(a===`accessor`)return{get(){return(this[k]??r(this,t.get.call(this)))._(o)},set(e){return(this[k]??r(this,e)).M(o,e)},init(e){return r(this,e),e}}}function fe(e){return{t:Xt,i:e,o:pe,u:me}}function pe(e,t,n,r){var i,a,o;if(n.get)return fn.o(e,t,n,r);if(n.set){let i=Ge(n.set)?n.set:be(t.toString(),n.set);return r===e.h?e.l(t,{configurable:!M.safeDescriptors||e.p,set:i})===null?0:2:(Rt(r,t,{configurable:!0,set:i}),2)}if(r!==e.h&&typeof n.value==`function`)return s(n.value)?((o=this.i)!=null&&o.autoBind?qn:Kn).o(e,t,n,r):((a=this.i)!=null&&a.autoBind?Bn:Rn).o(e,t,n,r);let c=!1===this.i?.deep?rn:cn;return typeof n.value==`function`&&(i=this.i)!=null&&i.autoBind&&(n.value=n.value.bind(e.v??e.h)),c.o(e,t,n,r)}function me(e,t,n,r){var i;return n.get?fn.u(e,t,n,r):n.set?e.l(t,{configurable:!M.safeDescriptors||e.p,set:be(t.toString(),n.set)},r):(typeof n.value==`function`&&(i=this.i)!=null&&i.autoBind&&(n.value=n.value.bind(e.v??e.h)),(!1===this.i?.deep?rn:cn).u(e,t,n,r))}function he(e,t){return It(function(n,r){if(r&&typeof r.kind==`string`)return t(e,n,r)},e)}function ge(e){return e||Qt}function _e(e){return he(e,de)}function ve(e){return!0===e.deep?v:!1===e.deep?y:(t=e.defaultDecorator)&&(n=(r=t.i)?.A)!=null?n:v;var t,n,r}function ye(e){return he(e,T)}function be(e,t,n=!1,r){function i(){return xe(0,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=()=>t.toString(),gn&&(_n.value=e,Rt(i,`name`,_n)),i}function xe(e,t,n,r,i){let a=Se(0,t);try{return n.apply(r,i)}catch(e){throw a.N=e,e}finally{Ce(a)}}function Se(e,t){let n=M.trackingDerivation,r=!t||!n;Fe();let i=M.allowStateChanges;r&&ke();let a={R:r,k:n,C:i,I:M.allowStateReads,P:!1,T:0,B:hn++,D:mn};return mn=a.B,a}function Ce(e){mn!==e.B&&t(30),mn=e.D,e.N!==void 0&&(M.suppressReactionErrors=!0),Ie(),e.R&&Ae(e.k),M.suppressReactionErrors=!1}function we(e,t){let n=function(e){let t=M.allowStateChanges;return M.allowStateChanges=e,t}(e);try{return t()}finally{(function(e){M.allowStateChanges=e})(n)}}function Te(e){return e instanceof Sn}function Ee(e){switch(e.K){case 0:return!1;case-1:case 2:return!0;case 1:{let t=ke(),n=e.L,r=n.length;for(let i=0;i<r;i++){let r=n[i];if(xn(r)){if(M.disableErrorBoundaries)r.get();else try{r.get()}catch{return Ae(t),!0}if(e.K===2)return Ae(t),!0}}return je(e),Ae(t),!1}}}function De(e,t,n){je(e),e.$=Array(e.U===0?100:e.L.length),e.W=0,e.U=++M.runId;let r=M.trackingDerivation,i;if(M.trackingDerivation=e,M.inBatch++,!0===M.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new Sn(e)}return M.inBatch--,M.trackingDerivation=r,function(e){let t=e.L,n=e.L=e.$,r=0,i=0,a=e.W;for(let e=0;e<a;e++){let t=n[e];t.diffValue===0&&(t.diffValue=1,i!==e&&(n[i]=t),i++),t.K>r&&(r=t.K)}for(n.length=i,e.$=null,a=t.length;a--;){let n=t[a];n.diffValue===0&&Ne(n,e),n.diffValue=0}for(;i--;){let t=n[i];t.diffValue===1&&(t.diffValue=0,Me(t,e))}r!==0&&(e.K=r,e.q())}(e),i}function Oe(e){let t=e.L;e.L=[];let n=t.length;for(;n--;)Ne(t[n],e);e.K=-1}function E(e){let t=ke();try{return e()}finally{Ae(t)}}function ke(){let e=M.trackingDerivation;return M.trackingDerivation=null,e}function Ae(e){M.trackingDerivation=e}function je(e){if(e.K===0)return;e.K=0;let t=e.L,n=t.length;for(;n--;)t[n].F=0}function Me(e,t){(e.H??=new Set).add(t),e.F>t.K&&(e.F=t.K)}function Ne(e,t){let n=e.H;n&&(n.delete(t),n.size===0&&Pe(e))}function Pe(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,M.pendingUnobservations.push(e))}function Fe(){M.inBatch++}function Ie(){--M.inBatch===0&&(Be(),!M.isRunningUnobservations&&M.pendingUnobservations.length>0&&function(){M.isRunningUnobservations=!0;try{let e=M.pendingUnobservations;for(let t=0;t<e.length;t++){let n=e[t];n.isPendingUnobservation=!1,n.H&&n.H.size!==0||(n.H=null,n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof bn&&n.G())}M.pendingUnobservations=[]}finally{M.isRunningUnobservations=!1}}())}function Le(e){var t;e.isBeingObserved||(e.isBeingObserved=!0,e.onBO(),(t=e.L)==null||t.forEach(Le))}function Re(e){let t=M.trackingDerivation;return t===null?((!e.H||e.H.size===0)&&M.inBatch>0&&Pe(e),!1):(t.U!==e.J&&(e.J=t.U,t.$[t.W++]=e,!e.isBeingObserved&&M.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function ze(e){var t;e.F!==2&&(e.F=2,(t=e.H)==null||t.forEach(e=>{e.K===0&&e.q(),e.K=2}))}function Be(){M.inBatch>0||M.isRunningReactions||kn(Ve)}function Ve(){M.isRunningReactions=!0;let e=M.pendingReactions,t=0;for(;e.length>0;){++t===On&&(console.error(`[mobx] cycle in reaction: ${e[0]}`),e.splice(0));let n=e.splice(0);for(let e=0,t=n.length;e<t;e++)n[e].X()}M.isRunningReactions=!1}function He(e){return he(e,S)}function Ue(e){return function(t,n){return n&&typeof n.kind==`string`?S(e?Fn:Nn,t,n):r(t)?be(t.name||`<unnamed action>`,t,e):r(n)?be(t,n,e):i(t)?He(b(e?Mn:jn,{name:t,autoAction:e})):void 0}}function We(e){return xe(0,!1,e,this,void 0)}function Ge(e){return r(e)&&!0===e.isMobxAction}function Ke(e,t=Vt){function n(){e(a)}var r;let i=t?.name??`Autorun`,a;if(t.scheduler||t.delay){let e=qe(t),r=!1;a=new Dn(i,()=>{r||(r=!0,e(()=>{r=!1,a.isDisposed||a.track(n)}))},t.onError,t.requiresObservable)}else a=new Dn(i,function(){this.track(n)},t.onError,t.requiresObservable);return t!=null&&(r=t.signal)!=null&&r.aborted||a.Y(),a.Z(t?.signal)}function qe(e){return e.scheduler?e.scheduler:e.delay?t=>setTimeout(t,e.delay):Vn}function Je(e,t,n,i){let a=typeof i==`function`?Dt(t,n):Dt(t),o=r(i)?i:n,s=`${e}L`;return a[s]?a[s].add(o):a[s]=new Set([o]),function(){let e=a[s];e&&(e.delete(o),e.size===0&&delete a[s])}}function Ye(e,t,n,r){let i=Gt(t);return At(()=>{let t=wt(e,r)[k];Wt(i).forEach(e=>{t.u(e,i[e],!n||!(e in n)||n[e])})}),e}function Xe(e){let t={name:e.tt};var n;return e.L&&e.L.length>0&&(t.dependencies=(n=e.L,Array.from(new Set(n))).map(Xe)),t}function Ze(e){let t={name:e.tt};return function(e){return!!e.H&&e.H.size>0}(e)&&(t.observers=Array.from(function(e){return e.H??new Set}(e),Ze)),t}function Qe(e){r(e.cancel)&&e.cancel()}function $e(e){return!0===e?.isMobXFlow}function et(e,t){var n;if(t===void 0)return xn(e);if(!1===Et(e))return!1;let r=e[k];return(n=r.O)!=null&&n.has(t)?!0:r.j.has(t)?xn(Dt(e,t)):!1}function tt(e,t){if(!e)return!1;if(t!==void 0){if(Et(e)){var n,r;let i=e[k];return i.j.has(t)||!((n=i.O)==null||!n.has(t))||!((r=i.V)==null||!r.has(t))}return!1}return Et(e)||!!e[k]||qt(e)||An(e)||xn(e)}function nt(e){return tt(e)}function rt(e){return Et(e)?e[k].nt():ar(e)||cr(e)?Array.from(e.keys()):xt(e)?e.map((e,t)=>t):void t(5)}function it(e,n){return Et(e)?e[k].et(n):ar(e)||cr(e)?e.has(n):xt(e)?n>=0&&n<e.length:void t(10)}function at(e){if(Et(e))return e[k].it();t(38)}function ot(e,t,n){if(xn(e)){let r,i=!0;return Ke(()=>{let a=e.get();if(!i||n){let n=ke();t({observableKind:`computed`,debugObjectName:e.tt,type:Zn,object:e,newValue:a,oldValue:r}),Ae(n)}i=!1,r=a})}return n&&t({observableKind:`value`,debugObjectName:e.tt,object:e,type:Zn,newValue:e.rt,oldValue:void 0}),ht(e,t)}function st(e,t,n){return e.set(t,n),n}function ct(e,t){if(typeof e!=`object`||!e||e instanceof Date||!nt(e))return e;if(yn(e)||xn(e))return ct(e.get(),t);if(t.has(e))return t.get(e);if(xt(e)){let n=st(t,e,Array(e.length));return e.forEach((e,r)=>{n[r]=ct(e,t)}),n}if(cr(e)){let n=st(t,e,new Set);return e.forEach(e=>{n.add(ct(e,t))}),n}if(ar(e)){let n=st(t,e,new Map);return e.forEach((e,r)=>{n.set(r,ct(e,t))}),n}{let n=st(t,e,{});return at(e).forEach(r=>{zt.propertyIsEnumerable.call(e,r)&&(n[r]=ct(e[r],t))}),n}}function lt(e,t){Fe();try{return e.apply(t)}finally{Ie()}}function ut(e,t,n){let r;if(typeof n.timeout==`number`){let e=Error(`WHEN_TIMEOUT`);r=setTimeout(()=>{if(!a[k].isDisposed){if(a(),!n.onError)throw e;n.onError(e)}},n.timeout)}n.name=`When`;let i=be(`When-effect`,t);var a=Ke(t=>{we(!1,e)&&(t.dispose(),r&&clearTimeout(r),i())},n);return a}function dt(e){return e[k]}function ft(e){return e.st!==void 0&&e.st.length>0}function pt(e,t){let r=e.st;return r?r.push(t):r=e.st=[t],n(()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)})}function D(e,n){let r=ke();try{let r=[...e.st||[]];for(let e=0,i=r.length;e<i&&((n=r[e](n))&&!n.type&&t(14),n);e++);return n}finally{Ae(r)}}function mt(e){return e.ot!==void 0&&e.ot.length>0}function ht(e,t){let r=e.ot;return r?r.push(t):r=e.ot=[t],n(()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)})}function gt(e,t){let n=ke(),r=e.ot;if(r){r=r.slice();for(let e=0,n=r.length;e<n;e++)r[e](t);Ae(n)}}function _t(e,n,r){if(!0===r&&(r=e.ut),!1===r)return;n in e.h||t(1,r.t,`${e.tt}.${n.toString()}`);let i=e.h;for(;i&&i!==zt;){let t=Lt(i,n);if(t){let a=r.o(e,n,t,i);if(a===0)return;if(a===1)break}i=Object.getPrototypeOf(i)}}function O(e,t){typeof Array.prototype[e]==`function`&&(er[e]=t(e))}function vt(e){return function(){let t=this[k];t.ct.reportObserved();let n=t.ht(t.j);return n[e].apply(n,arguments)}}function yt(e){return function(t,n){let r=this[k];return r.ct.reportObserved(),r.ht(r.j)[e]((e,r)=>t.call(n,e,r,this))}}function bt(e){return function(){let t=this[k];t.ct.reportObserved();let n=t.ht(t.j),r=arguments[0];return arguments[0]=(e,t,n)=>r(e,t,n,this),n[e].apply(n,arguments)}}function xt(e){return a(e)&&tr(e[k])}function St(e){return e[Symbol.toStringTag]=`MapIterator`,Pt(e)}function Ct(e){return e[Symbol.toStringTag]=`SetIterator`,Pt(e)}function wt(e,t){if(p(e,k))return e;let n=t?.name??`ObservableObject`;return c(e,k,new dr(e,new Map,String(n),function(e){return e?e.defaultDecorator??function(e){let t=!1!==e.deep,n=!!e.autoBind,r=!t|(n?2:0);return A[r]??(A[r]=fe({deep:t,autoBind:n}))}(e):void 0}(t))),e}function Tt(e){return lr[e]||(lr[e]={get(){return this[k]._(e)},set(t){return this[k].M(e,t)}})}function Et(e){return!!a(e)&&fr(e[k])}function Dt(e,n){if(typeof e==`object`&&e){if(xt(e))return n!==void 0&&t(23),e[k].ct;if(cr(e))return e.ct;if(ar(e)){if(n===void 0)return e.lt;let r=e.ft.get(n)||e.dt.get(n);return r||t(25,n,kt(e)),r}if(Et(e)){if(!n)return t(26);let r=e[k],i=r.j.get(n)??r.vt(n)??r.bt(n);return i||t(27,n,kt(e)),i}if(qt(e)||xn(e)||An(e))return e}else if(r(e)&&An(e[k]))return e[k];t(28)}function Ot(e,n){return e||t(29),n===void 0?qt(e)||xn(e)||An(e)||ar(e)||cr(e)?e:e[k]?e[k]:void t(24,e):Ot(Dt(e,n))}function kt(e,t){let n;if(t!==void 0)n=Dt(e,t);else{if(Ge(e))return e.name;n=Et(e)||ar(e)||cr(e)?Ot(e):Dt(e)}return n.tt}function At(e){let t=ke();Fe();try{return e()}finally{Ie(),Ae(t)}}function jt(e,t,n=-1){return Mt(e,t,n)}function Mt(e,t,n,i,a){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return!1;if(e!=e)return t!=t;let o=typeof e;if(o!==`function`&&o!==`object`&&typeof t!=`object`)return!1;let s=pr.call(e);if(s!==pr.call(t))return!1;switch(s){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++}e=Nt(e),t=Nt(t);let c=s===`[object Array]`;if(!c){if(typeof e!=`object`||typeof t!=`object`)return!1;let n=e.constructor,i=t.constructor;if(n!==i&&!(r(n)&&n instanceof n&&r(i)&&i instanceof i)&&`constructor`in e&&`constructor`in t)return!1}if(n===0)return!1;n<0&&(n=-1),a||=[];let l=(i||=[]).length;for(;l--;)if(i[l]===e)return a[l]===t;if(i.push(e),a.push(t),c){if(l=e.length,l!==t.length)return!1;for(;l--;)if(!Mt(e[l],t[l],n-1,i,a))return!1}else{let r=Object.keys(e),o=r.length;if(Object.keys(t).length!==o)return!1;for(let s=0;s<o;s++){let o=r[s];if(!p(t,o)||!Mt(e[o],t[o],n-1,i,a))return!1}}return i.pop(),a.pop(),!0}function Nt(e){return xt(e)?e.slice():u(e)||ar(e)||d(e)||cr(e)?Array.from(e.entries()):e}function Pt(e){return e[Symbol.iterator]=Ft,It(Object.create(mr),e)}function Ft(){return this}Object.defineProperty(e,`__esModule`,{value:!0});let It=Object.assign,Lt=Object.getOwnPropertyDescriptor,Rt=Object.defineProperty,zt=Object.prototype,Bt=[];Object.freeze(Bt);let Vt={};Object.freeze(Vt);let Ht=Object.toString(),Ut=()=>{},Wt=Reflect.ownKeys,Gt=Object.getOwnPropertyDescriptors,k=Symbol(`mobx administration`);var Kt=class{constructor(e=`Atom`){this.tt=void 0,this.yt=0,this.H=null,this.J=0,this.F=-1,this.onBOL=void 0,this.onBUOL=void 0,this.tt=e}get isBeingObserved(){return m(this.yt,1)}set isBeingObserved(e){this.yt=h(this.yt,1,e)}get isPendingUnobservation(){return m(this.yt,2)}set isPendingUnobservation(e){this.yt=h(this.yt,2,e)}get diffValue(){return+!!m(this.yt,4)}set diffValue(e){this.yt=h(this.yt,4,e===1)}onBO(){this.onBOL&&this.onBOL.forEach(e=>e())}onBUO(){this.onBUOL&&this.onBUOL.forEach(e=>e())}reportObserved(){return Re(this)}reportChanged(){Fe(),ze(this),Ie()}toString(){return this.tt}};let qt=l(`Atom`,Kt),Jt=Object.is,Yt={t:`override`,o:function(){return 0},u:function(){t(44,this.t)}},Xt=`true`,Zt=fe(),A=[Zt],Qt={deep:!0,name:void 0,defaultDecorator:void 0};Object.freeze(Qt);let $t=ce(`observable`),j=ce(`observable.ref`,{A:y}),en=ce(`observable.shallow`,{A:function(e,t,n){return e==null||Et(e)||xt(e)||ar(e)||cr(e)?e:Array.isArray(e)?cn.array(e,{name:n,deep:!1}):o(e)?cn.object(e,void 0,{name:n,deep:!1}):u(e)?cn.map(e,{name:n,deep:!1}):d(e)?cn.set(e,{name:n,deep:!1}):void 0}}),tn=ce(`observable.struct`,{A:function(e,t){return jt(e,t)?t:e}}),nn={box(e,t){let n=ge(t);return new vn(e,ve(n),n.name,!0,n.equals)},array(e,t){let n=ge(t);return function(e,t,n=`ObservableArray`,r=!1){return At(()=>{let i=new $n(n,t,r);Rt(i.j,k,{enumerable:!1,writable:!1,configurable:!0,value:i});let a=new Proxy(i.j,Qn);return i.v=a,e&&e.length&&i.wt(0,0,e),a})}(e,ve(n),n.name)},map(e,t){let n=ge(t);return new ir(e,ve(n),n.name)},set(e,t){let n=ge(t);return new sr(e,ve(n),n.name)},object:(e,t,n)=>At(()=>Ye(function(e,t){var n;return(n=(e=wt(e,t))[k]).v??(n.v=new Proxy(e,Jn))}({},n),e,t))},rn=_e(j),an=_e(en),on=_e($t),sn=_e(tn);var cn=It(function(e,t,n){return t&&typeof t.kind==`string`?de($t,e,t):nt(e)?e:o(e)?cn.object(e,t,n):Array.isArray(e)?cn.array(e,t):u(e)?cn.map(e,t):d(e)?cn.set(e,t):typeof e==`object`&&e?e:cn.box(e,t)},$t,nn);let ln=`computed`,un=C(ln),dn=ye(C(`computed.struct`,{equals:_})),fn=function(e,t){if(t&&typeof t.kind==`string`)return T(un,e,t);if(o(e))return ye(C(ln,e));let n=o(t)?t:{};return n.get=e,n.name||=e.name||``,new bn(n)};var pn;It(fn,un);let mn=0,hn=1,gn=(pn=Lt(()=>{},`name`)?.configurable)!=null&&pn,_n={value:`action`,configurable:!0,writable:!1,enumerable:!1};var vn=class extends Kt{constructor(e,t,n=`ObservableValue`,r=!0,i=Jt){super(n),this.A=void 0,this.tt=void 0,this.xt=void 0,this.gt=!1,this.st=void 0,this.ot=void 0,this.rt=void 0,this.dehancer=void 0,this.A=t,this.tt=n,this.xt=i,this.rt=t(e,void 0,n)}dehanceValue(e){return this.dehancer===void 0?e:this.dehancer(e)}set(e){(e=this.jt(e))!==M.UNCHANGED&&this.Ot(e)}jt(e){if(ft(this)){let t=D(this,{object:this,type:Zn,newValue:e});if(!t)return M.UNCHANGED;e=t.newValue}return e=this.A(e,this.rt,this.tt),this.xt(this.rt,e)?M.UNCHANGED:e}Ot(e){let t=this.rt;this.rt=e,this.reportChanged(),mt(this)&&gt(this,{type:Zn,object:this,newValue:e,oldValue:t})}get(){return this.reportObserved(),this.dehanceValue(this.rt)}raw(){return this.rt}toJSON(){return this.get()}toString(){return`${this.tt}[${this.rt}]`}valueOf(){return f(this.get())}[Symbol.toPrimitive](){return this.valueOf()}};let yn=l(`ObservableValue`,vn);var bn=class{constructor(e){this.K=-1,this.L=[],this.$=null,this.H=null,this.U=0,this.J=0,this.F=0,this.W=0,this.rt=new Sn(null),this.tt=void 0,this._t=void 0,this.yt=0,this.derivation=void 0,this.St=void 0,this.At=void 0,this.xt=void 0,this.Vt=void 0,this.Mt=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.St=be(`ComputedValue-setter`,e.set)),this.xt=e.equals||Jt,this.At=e.context,this.Vt=e.requiresReaction,this.Mt=!!e.keepAlive}q(){(function(e){var t;e.F===0&&(e.F=1,(t=e.H)==null||t.forEach(e=>{e.K===0&&(e.K=1,e.q())}))})(this)}onBO(){this.onBOL&&this.onBOL.forEach(e=>e())}onBUO(){this.onBUOL&&this.onBUOL.forEach(e=>e())}get isComputing(){return m(this.yt,1)}set isComputing(e){this.yt=h(this.yt,1,e)}get isRunningSetter(){return m(this.yt,2)}set isRunningSetter(e){this.yt=h(this.yt,2,e)}get isBeingObserved(){return m(this.yt,4)}set isBeingObserved(e){this.yt=h(this.yt,4,e)}get isPendingUnobservation(){return m(this.yt,8)}set isPendingUnobservation(e){this.yt=h(this.yt,8,e)}get diffValue(){return+!!m(this.yt,16)}set diffValue(e){this.yt=h(this.yt,16,e===1)}get(){if(this.isComputing&&t(32,this.tt,this.derivation),M.inBatch!==0||this.H&&this.H.size!==0||this.Mt){let e=this.isBeingObserved;if(Re(this),Ee(this)){let e=M.trackingContext;e||!this.Mt&&!this.isBeingObserved||(M.trackingContext=this),this.trackAndCompute()&&function(e){var t;e.F!==2&&(e.F=2,(t=e.H)==null||t.forEach(t=>{t.K===1?t.K=2:t.K===0&&(e.F=0)}))}(this),M.trackingContext=e}else !e&&this.isBeingObserved&&this.L.forEach(Le)}else Ee(this)&&(this.Nt(),Fe(),this.rt=this.Rt(!1),Ie());let e=this.rt;if(Te(e))throw e.cause;return e}set(e){if(this.St){this.isRunningSetter&&t(33,this.tt),this.isRunningSetter=!0;try{this.St.call(this.At,e)}finally{this.isRunningSetter=!1}}else t(34,this.tt)}trackAndCompute(){let e=this.rt,t=this.K===-1,n=this.Rt(!0),r=t||Te(e)||Te(n)||!this.xt(e,n);return r&&(this.rt=n),r}Rt(e){let t;if(this.isComputing=!0,e)t=De(this,this.derivation,this.At);else if(!0===M.disableErrorBoundaries)t=this.derivation.call(this.At);else try{t=this.derivation.call(this.At)}catch(e){t=new Sn(e)}return this.isComputing=!1,t}G(){this.Mt||(Oe(this),this.rt=void 0)}Nt(){}toString(){return`${this.tt}[${this.derivation.toString()}]`}valueOf(){return f(this.get())}[Symbol.toPrimitive](){return this.valueOf()}};let xn=l(`ComputedValue`,bn);var Sn=class{constructor(e){this.cause=void 0,this.cause=e}};let Cn=[`mobxGuid`,`spyListeners`,`enforceActions`,`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`allowStateReads`,`disableErrorBoundaries`,`runId`,`UNCHANGED`];var wn=class{constructor(){this.version=7,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.isRunningUnobservations=!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.safeDescriptors=!0}};let Tn=!0,En=!1,M=function(){let e=globalThis;return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Tn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==7&&(Tn=!1),Tn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new wn):(setTimeout(()=>{En||t(35)},1),new wn)}();var Dn=class{constructor(e=`Reaction`,t,n,r){this.tt=void 0,this.Et=void 0,this.kt=void 0,this.Ct=void 0,this.L=[],this.$=[],this.K=-1,this.U=0,this.W=0,this.yt=0,this.It=void 0,this.tt=e,this.Et=t,this.kt=n,this.Ct=r}get isDisposed(){return m(this.yt,1)}set isDisposed(e){this.yt=h(this.yt,1,e)}get isScheduled(){return m(this.yt,2)}set isScheduled(e){this.yt=h(this.yt,2,e)}get isTrackPending(){return m(this.yt,4)}set isTrackPending(e){this.yt=h(this.yt,4,e)}get isRunning(){return m(this.yt,8)}set isRunning(e){this.yt=h(this.yt,8,e)}get diffValue(){return+!!m(this.yt,16)}set diffValue(e){this.yt=h(this.yt,16,e===1)}q(){this.Y()}Y(){this.isScheduled||(this.isScheduled=!0,M.pendingReactions.push(this),Be())}X(){if(!this.isDisposed){Fe(),this.isScheduled=!1;let e=M.trackingContext;if(M.trackingContext=this,Ee(this)){this.isTrackPending=!0;try{this.Et()}catch(e){this.Pt(e)}}M.trackingContext=e,Ie()}}track(e){if(this.isDisposed)return;Fe(),this.isRunning=!0;let t=M.trackingContext;M.trackingContext=this;let n=De(this,e,void 0);M.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Oe(this),Te(n)&&this.Pt(n.cause),Ie()}Pt(e){if(this.kt)this.kt(e,this);else{if(M.disableErrorBoundaries)throw e;M.suppressReactionErrors||console.error(`[mobx] uncaught error in '${this}'`,e),M.globalReactionErrorHandlers.forEach(t=>t(e,this))}}dispose(){var e;this.isDisposed||(this.isDisposed=!0,(e=this.It)==null||e.call(this),this.isRunning||(Fe(),Oe(this),Ie()))}Z(e){let t=()=>this.dispose();return e!=null&&e.addEventListener&&!this.isDisposed&&(e.addEventListener(`abort`,t),this.It=()=>e.removeEventListener==null?void 0:e.removeEventListener(`abort`,t)),t[k]=this,`dispose`in Symbol&&typeof Symbol.dispose==`symbol`&&(t[Symbol.dispose]=t),t}toString(){return`Reaction[${this.tt}]`}};let On=100,kn=e=>e(),An=l(`Reaction`,Dn),jn=`action`,Mn=`autoAction`,Nn=b(jn),Pn=b(`action.bound`,{bound:!0}),Fn=b(Mn,{autoAction:!0}),In=b(`autoAction.bound`,{autoAction:!0,bound:!0}),Ln=Ue(!1);It(Ln,Nn);let Rn=Ue(!0);It(Rn,Fn);let zn=He(Pn),Bn=He(In),Vn=e=>e(),Hn=`always`;var Un=class extends Error{constructor(){super(`FLOW_CANCELLED`),Object.setPrototypeOf(this,new.target.prototype),this.name=`FlowCancellationError`}toString(){return`Error: ${this.message}`}};let Wn=ne(`flow`),Gn=ne(`flow.bound`,{bound:!0}),Kn=It(function(e,t){if(t&&typeof t.kind==`string`)return ae(Wn,e,t);let n=e,i=n.name||`flow`,a=function(){let e=arguments,t=Ln(i,n).apply(this,e),a,o,s=new Promise(function(e,n){function s(e){let r;o=void 0;try{r=Ln(i,t.next).call(t,e)}catch(e){return n(e)}l(r)}function c(e){let r;o=void 0;try{r=Ln(i,t.throw).call(t,e)}catch(e){return n(e)}l(r)}function l(t){if(!r(t?.then))return t.done?e(t.value):(o=Promise.resolve(t.value),o.then(s,c));t.then(l,n)}a=n,s(void 0)});return s.cancel=Ln(i,function(){try{o&&Qe(o);let e=t.return(void 0),n=Promise.resolve(e.value);n.then(Ut,Ut),Qe(n),a(new Un)}catch(e){a(e)}}),s};return a.isMobXFlow=!0,a},Wn),qn=he(Gn,ae),Jn={has:(e,t)=>dt(e).et(t),get:(e,t)=>dt(e).Tt(t),set(e,t,n){var r;return!!i(t)&&((r=dt(e).Bt(t,n,!0))==null||r)},deleteProperty(e,t){var n;return!!i(t)&&((n=dt(e).Dt(t,!0))==null||n)},defineProperty(e,t,n){var r;return(r=dt(e).l(t,n))==null||r},ownKeys:e=>dt(e).it(),preventExtensions(e){t(13)}},Yn=Symbol(`mobx-keys`),Xn=`splice`,Zn=`update`,Qn={get(e,t){let n=e[k];return t===k?n:t===`length`?n.Kt():typeof t!=`string`||isNaN(t)?p(er,t)?er[t]:e[t]:n.Tt(parseInt(t))},set(e,t,n){let r=e[k];return t===`length`?r.Lt(n):typeof t==`symbol`||isNaN(t)?e[t]=n:r.Bt(parseInt(t),n),!0},preventExtensions(){t(15)}};var $n=class{constructor(e=`ObservableArray`,t,n){this.$t=void 0,this.ct=void 0,this.j=[],this.st=void 0,this.ot=void 0,this.A=void 0,this.dehancer=void 0,this.v=void 0,this.Ut=0,this.$t=n,this.ct=new Kt(e),this.A=(e,n)=>t(e,n,`ObservableArray[..]`)}Wt(e){return this.dehancer===void 0?e:this.dehancer(e)}ht(e){return this.dehancer!==void 0&&e.length>0?e.map(this.dehancer):e}Kt(){return this.ct.reportObserved(),this.j.length}Lt(e){(!Number.isInteger(e)||e<0)&&t(40,e);let n=this.j.length;if(e!==n)if(e>n){let t=Array.from({length:e-n});this.wt(n,0,t)}else this.wt(e,n-e)}zt(e,n){e!==this.Ut&&t(16),this.Ut+=n}wt(e,t,n){let r=this.j.length;if(e===void 0?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=arguments.length===1?r-e:t==null?0:Math.max(0,Math.min(t,r-e)),n===void 0&&(n=Bt),ft(this)){let r=D(this,{object:this.v,type:Xn,index:e,removedCount:t,added:n});if(!r)return Bt;t=r.removedCount,n=r.added}n=n.length===0?n:n.map(e=>this.A(e,void 0));let i=this.qt(e,t,n);return t===0&&n.length===0||this.Ft(e,n,i),this.ht(i)}qt(e,t,n){if(n.length<1e4)return this.j.splice(e,t,...n);{let r=this.j.slice(e,e+t),i=this.j.slice(e+t);this.j.length+=n.length-t;for(let t=0;t<n.length;t++)this.j[e+t]=n[t];for(let t=0;t<i.length;t++)this.j[e+n.length+t]=i[t];return r}}Ht(e,t,n){let r=mt(this),i=r?{observableKind:`array`,object:this.v,type:Zn,debugObjectName:this.ct.tt,index:e,newValue:t,oldValue:n}:null;this.ct.reportChanged(),r&&gt(this,i)}Ft(e,t,n){let r=mt(this),i=r?{observableKind:`array`,object:this.v,debugObjectName:this.ct.tt,type:Xn,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.ct.reportChanged(),r&&gt(this,i)}Tt(e){return this.ct.reportObserved(),this.Wt(this.j[e])}Bt(e,t){let n=this.j;if(e<n.length){let r=n[e];if(ft(this)){let n=D(this,{type:Zn,object:this.v,index:e,newValue:t});if(!n)return;t=n.newValue}(t=this.A(t,r))!==r&&(n[e]=t,this.Ht(e,t,r))}else{let r=Array.from({length:e+1-n.length});r[r.length-1]=t,this.wt(n.length,0,r)}}},er={clear(){return this.splice(0)},replace(e){let t=this[k];return t.wt(0,t.j.length,e)},toJSON(){return this.slice()},splice(e,t,...n){let r=this[k];switch(arguments.length){case 0:return[];case 1:return r.wt(e);case 2:return r.wt(e,t)}return r.wt(e,t,n)},spliceWithArray(e,t,n){return this[k].wt(e,t,n)},push(...e){let t=this[k];return t.wt(t.j.length,0,e),t.j.length},pop(){return this.splice(Math.max(this[k].j.length-1,0),1)[0]},shift(){return this.splice(0,1)[0]},unshift(...e){let t=this[k];return t.wt(0,0,e),t.j.length},reverse(){return M.trackingDerivation&&t(37,`reverse`),this.replace(this.slice().reverse()),this},sort(){M.trackingDerivation&&t(37,`sort`);let e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove(e){let t=this[k],n=t.ht(t.j).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};O(`at`,vt),O(`concat`,vt),O(`flat`,vt),O(`includes`,vt),O(`indexOf`,vt),O(`join`,vt),O(`lastIndexOf`,vt),O(`slice`,vt),O(`toString`,vt),O(`toLocaleString`,vt),O(`toSorted`,vt),O(`toSpliced`,vt),O(`with`,vt),O(`every`,yt),O(`filter`,yt),O(`find`,yt),O(`findIndex`,yt),O(`findLast`,yt),O(`findLastIndex`,yt),O(`flatMap`,yt),O(`forEach`,yt),O(`map`,yt),O(`some`,yt),O(`toReversed`,yt),O(`reduce`,bt),O(`reduceRight`,bt);let tr=l(`ObservableArrayAdministration`,$n),nr={},rr=`delete`;var ir=class{constructor(e,t=v,n=`ObservableMap`){this.A=void 0,this.tt=void 0,this[k]=nr,this.ft=void 0,this.dt=void 0,this.lt=void 0,this.st=void 0,this.ot=void 0,this.dehancer=void 0,this.A=t,this.tt=n,At(()=>{this.lt=g(`ObservableMap.keys()`),this.ft=new Map,this.dt=new Map,e&&this.merge(e)})}et(e){return this.ft.has(e)}has(e){if(!M.trackingDerivation)return this.et(e);let t=this.dt.get(e);if(!t){let n=t=new vn(this.et(e),y,`ObservableMap.key?`,!1);this.dt.set(e,n),n.onBUOL=new Set([()=>this.dt.delete(e)])}return t.get()}set(e,t){let n=this.et(e);if(ft(this)){let r=D(this,{type:n?Zn:`add`,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.Gt(e,t):this.Jt(e,t),this}delete(e){if(ft(this)&&!D(this,{type:rr,object:this,name:e}))return!1;if(this.et(e)){let t=mt(this),n=t?{observableKind:`map`,debugObjectName:this.tt,type:rr,object:this,oldValue:this.ft.get(e).rt,name:e}:null;return lt(()=>{var t;this.lt.reportChanged(),(t=this.dt.get(e))==null||t.Ot(!1),this.ft.get(e).Ot(void 0),this.ft.delete(e)}),t&&gt(this,n),!0}return!1}Gt(e,t){let n=this.ft.get(e);if((t=n.jt(t))!==M.UNCHANGED){let r=mt(this),i=r?{observableKind:`map`,debugObjectName:this.tt,type:Zn,object:this,oldValue:n.rt,name:e,newValue:t}:null;n.Ot(t),r&&gt(this,i)}}Jt(e,t){lt(()=>{var n;let r=new vn(t,this.A,`ObservableMap.key`,!1);this.ft.set(e,r),t=r.rt,(n=this.dt.get(e))==null||n.Ot(!0),this.lt.reportChanged()});let n=mt(this);n&&gt(this,n?{observableKind:`map`,debugObjectName:this.tt,type:`add`,object:this,name:e,newValue:t}:null)}get(e){return this.has(e)?this.Wt(this.ft.get(e).get()):this.Wt(void 0)}getOrInsert(e,t){return this.has(e)||this.set(e,t),this.get(e)}getOrInsertComputed(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)}Wt(e){return this.dehancer===void 0?e:this.dehancer(e)}keys(){return this.lt.reportObserved(),this.ft.keys()}values(){let e=this,t=this.keys();return St({next(){let{done:n,value:r}=t.next();return{done:n,value:n?void 0:e.get(r)}}})}entries(){let e=this,t=this.keys();return St({next(){let{done:n,value:r}=t.next();return{done:n,value:n?void 0:[r,e.get(r)]}}})}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[n,r]of this)e.call(t,r,n,this)}merge(e){return ar(e)&&(e=new Map(e)),lt(()=>{o(e)?function(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);return n.length?[...t,...n.filter(t=>zt.propertyIsEnumerable.call(e,t))]:t}(e).forEach(t=>this.set(t,e[t])):Array.isArray(e)?e.forEach(([e,t])=>this.set(e,t)):u(e)?(function(e){return Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(e)))===null}(e)||t(19,e),e.forEach((e,t)=>this.set(t,e))):e!=null&&t(20,e)}),this}clear(){lt(()=>{E(()=>{for(let e of this.keys())this.delete(e)})})}replace(e){return lt(()=>{let n=function(e){if(u(e)||ar(e))return e;if(Array.isArray(e))return new Map(e);if(o(e)){let t=new Map;for(let n in e)t.set(n,e[n]);return t}return t(21,e)}(e),r=new Map,i=!1;for(let e of this.ft.keys())if(!n.has(e))if(this.delete(e))i=!0;else{let t=this.ft.get(e);r.set(e,t)}for(let[e,t]of n.entries()){let n=this.ft.has(e);if(this.set(e,t),this.ft.has(e)){let t=this.ft.get(e);r.set(e,t),n||(i=!0)}}if(!i)if(this.ft.size!==r.size)this.lt.reportChanged();else{let e=this.ft.keys(),t=r.keys(),n=e.next(),i=t.next();for(;!n.done;){if(n.value!==i.value){this.lt.reportChanged();break}n=e.next(),i=t.next()}}this.ft=r}),this}get size(){return this.lt.reportObserved(),this.ft.size}toString(){return`[object ObservableMap]`}toJSON(){return Array.from(this)}get[Symbol.toStringTag](){return`Map`}},ar=l(`ObservableMap`,ir);let or={};var sr=class{constructor(e,t=v,n=`ObservableSet`){this.tt=void 0,this[k]=or,this.ft=new Set,this.ct=void 0,this.ot=void 0,this.st=void 0,this.dehancer=void 0,this.A=void 0,this.tt=n,this.A=(e,r)=>t(e,r,n),At(()=>{this.ct=g(this.tt),e&&this.replace(e)})}Wt(e){return this.dehancer===void 0?e:this.dehancer(e)}clear(){lt(()=>{E(()=>{for(let e of this.ft.values())this.delete(e)})})}forEach(e,t){for(let n of this)e.call(t,n,n,this)}get size(){return this.ct.reportObserved(),this.ft.size}add(e){if(ft(this)){let t=D(this,{type:`add`,object:this,newValue:e});if(!t)return this;e=t.newValue}if(!this.has(e)){lt(()=>{e=this.A(e,void 0),this.ft.add(e),this.ct.reportChanged()});let t=mt(this);t&&gt(this,t?{observableKind:`set`,debugObjectName:this.tt,type:`add`,object:this,newValue:e}:null)}return this}delete(e){if(ft(this)&&!D(this,{type:rr,object:this,oldValue:e}))return!1;if(this.has(e)){let t=mt(this),n=t?{observableKind:`set`,debugObjectName:this.tt,type:rr,object:this,oldValue:e}:null;return lt(()=>{this.ct.reportChanged(),this.ft.delete(e)}),t&&gt(this,n),!0}return!1}has(e){return this.ct.reportObserved(),this.ft.has(this.Wt(e))}entries(){let e=this.values();return Ct({next(){let{value:t,done:n}=e.next();return n?{value:void 0,done:n}:{value:[t,t],done:n}}})}keys(){return this.values()}values(){this.ct.reportObserved();let e=this,t=this.ft.values();return Ct({next(){let{value:n,done:r}=t.next();return r?{value:void 0,done:r}:{value:e.Wt(n),done:r}}})}intersection(e){return new Set(this).intersection(e)}union(e){return new Set(this).union(e)}difference(e){return new Set(this).difference(e)}symmetricDifference(e){return new Set(this).symmetricDifference(e)}isSubsetOf(e){return new Set(this).isSubsetOf(e)}isSupersetOf(e){return new Set(this).isSupersetOf(e)}isDisjointFrom(e){return new Set(this).isDisjointFrom(e)}replace(e){return cr(e)&&(e=new Set(e)),Array.isArray(e)||d(e)?lt(()=>{let t=d(e)?e:new Set(e);if(t.size!==0)if(this.ft.size!==0){for(let e of this.ft.values())t.has(this.Wt(e))||this.delete(e);t.forEach(e=>this.add(e))}else t.forEach(e=>this.add(e));else this.clear()}):e!=null&&t(41,e),this}toJSON(){return Array.from(this)}toString(){return`[object ObservableSet]`}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return`Set`}},cr=l(`ObservableSet`,sr);let lr=Object.create(null),ur=`remove`;var dr=class{constructor(e,t=new Map,n,r=Zt){this.h=void 0,this.j=void 0,this.tt=void 0,this.ut=void 0,this.lt=void 0,this.ot=void 0,this.st=void 0,this.v=void 0,this.p=void 0,this.Xt=void 0,this.Qt=void 0,this.O=void 0,this.V=void 0,this.h=e,this.j=t,this.tt=n,this.ut=r,this.lt=new Kt(`ObservableObject.keys`),this.p=o(this.h)}_(e){return(this.j.get(e)??this.vt(e)??this.bt(e)).get()}vt(e){let t=this.O?.get(e);if(!t)return;this.O.delete(e),this.O.size===0&&(this.O=void 0);let n=t();return this.j.set(e,n),n}bt(e){let t=this.V?.get(e);if(!t)return;this.V.delete(e),this.V.size===0&&(this.V=void 0);let n=t();return this.j.set(e,n),n}M(e,t){let n=this.j.get(e)??this.vt(e)??this.bt(e);if(n instanceof bn)return n.set(t),!0;if(ft(this)){let n=D(this,{type:Zn,object:this.v||this.h,name:e,newValue:t});if(!n)return null;t=n.newValue}if((t=n.jt(t))!==M.UNCHANGED){let r=mt(this),i=r?{type:Zn,observableKind:`object`,debugObjectName:this.tt,object:this.v||this.h,oldValue:n.rt,name:e,newValue:t}:null;n.Ot(t),r&&gt(this,i)}return!0}Tt(e){return M.trackingDerivation&&!p(this.h,e)&&this.et(e),this.h[e]}Bt(e,t,n=!1){return p(this.h,e)?this.j.has(e)?this.M(e,t):n?Reflect.set(this.h,e,t):(this.h[e]=t,!0):this.u(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.ut,n)}et(e){if(!M.trackingDerivation)return e in this.h;this.Qt||=new Map;let t=this.Qt.get(e);return t||(t=new vn(e in this.h,y,`ObservableObject.key?`,!1),this.Qt.set(e,t)),t.get()}u(e,t,n,r=!1){return!0===n&&(n=this.ut),!1===n?this.l(e,t,r):n.u(this,e,t,r)}l(e,t,n=!1){try{Fe();let r=this.Dt(e);if(!r)return r;if(ft(this)){let n=D(this,{object:this.v||this.h,name:e,type:`add`,newValue:t.value});if(!n)return null;let{newValue:r}=n;t.value!==r&&(t=It({},t,{value:r}))}if(n){if(!Reflect.defineProperty(this.h,e,t))return!1}else Rt(this.h,e,t);this.Yt(e,t.value)}finally{Ie()}return!0}S(e,t,n,r=!1){try{Fe();let i=this.Dt(e);if(!i)return i;if(ft(this)){let n=D(this,{object:this.v||this.h,name:e,type:`add`,newValue:t});if(!n)return null;t=n.newValue}let a=Tt(e),o={configurable:!M.safeDescriptors||this.p,enumerable:!0,get:a.get,set:a.set};if(r){if(!Reflect.defineProperty(this.h,e,o))return!1}else Rt(this.h,e,o);let s=new vn(t,n,`ObservableObject.key`,!1);this.j.set(e,s),this.Yt(e,s.rt)}finally{Ie()}return!0}m(e,t,n=!1){try{Fe();let r=this.Dt(e);if(!r)return r;if(ft(this)&&!D(this,{object:this.v||this.h,name:e,type:`add`,newValue:void 0}))return null;t.name||=`ObservableObject.key`,t.context=this.v||this.h;let i=Tt(e),a={configurable:!M.safeDescriptors||this.p,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.h,e,a))return!1}else Rt(this.h,e,a);this.j.set(e,new bn(t)),this.Yt(e,void 0)}finally{Ie()}return!0}Dt(e,t=!1){if(!p(this.h,e))return!0;if(ft(this)&&!D(this,{object:this.v||this.h,name:e,type:ur}))return null;try{var n;Fe();let r=mt(this),i=this.j.get(e),a;if(i||!r||(a=Lt(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 vn&&(a=i.rt),ze(i)),this.lt.reportChanged(),(n=this.Qt)==null||(n=n.get(e))==null||n.set(e in this.h),r&&r&&gt(this,{type:ur,observableKind:`object`,object:this.v||this.h,debugObjectName:this.tt,oldValue:a,name:e})}finally{Ie()}return!0}Yt(e,t){var n;let r=mt(this);r&&r&&gt(this,r?{type:`add`,observableKind:`object`,debugObjectName:this.tt,object:this.v||this.h,name:e,newValue:t}:null),(n=this.Qt)==null||(n=n.get(e))==null||n.set(!0),this.lt.reportChanged()}it(){return this.lt.reportObserved(),Wt(this.h)}nt(){return this.lt.reportObserved(),Object.keys(this.h)}};let fr=l(`ObservableObjectAdministration`,dr),pr=zt.toString,mr=globalThis.Iterator?.prototype||{};e.$mobx=k,e.FlowCancellationError=Un,e.ObservableMap=ir,e.ObservableSet=sr,e.Reaction=Dn,e._allowStateChanges=we,e._allowStateChangesInsideComputed=We,e._allowStateReadsEnd=function(e){M.allowStateReads=e},e._allowStateReadsStart=function(e){let t=M.allowStateReads;return M.allowStateReads=e,t},e._autoAction=Rn,e._autoActionBound=Bn,e._endAction=Ce,e._getAdministration=Ot,e._getGlobalState=function(){return M},e._interceptReads=function(e,t,n){let r;return ar(e)||xt(e)||yn(e)?r=Ot(e):Et(e)&&(r=Ot(e,t)),r.dehancer=typeof t==`function`?t:n,()=>{r.dehancer=void 0}},e._isComputingDerivation=function(){return M.trackingDerivation!==null},e._resetGlobalState=function(){let e=new wn;for(let t in e)Cn.indexOf(t)===-1&&(M[t]=e[t]);M.allowStateChanges=!M.enforceActions},e._startAction=Se,e.action=Ln,e.actionBound=zn,e.autorun=Ke,e.compareDefault=Jt,e.compareIdentity=function(e,t){return e===t},e.compareShallow=function(e,t){return jt(e,t,1)},e.compareStructural=_,e.computed=fn,e.computedStruct=dn,e.configure=function(e){!0===e.isolateGlobalState&&function(){if((M.pendingReactions.length||M.inBatch||M.isRunningReactions)&&t(36),En=!0,Tn){let e=globalThis;--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),M=new wn}}();let{enforceActions:n}=e;if(n!==void 0){let e=n===Hn?Hn:n===`observed`;M.enforceActions=e,M.allowStateChanges=!0!==e&&e!==Hn}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(t=>{t in e&&(M[t]=!!e[t])}),M.allowStateReads=!M.observableRequiresReaction,e.reactionScheduler&&function(e){let t=kn;kn=n=>e(()=>t(n))}(e.reactionScheduler)},e.createAtom=g,e.defineProperty=function(e,n,r){if(Et(e))return e[k].l(n,r);t(39)},e.entries=function(e){return Et(e)?rt(e).map(t=>[t,e[t]]):ar(e)?rt(e).map(t=>[t,e.get(t)]):cr(e)?Array.from(e.entries()):xt(e)?e.map((e,t)=>[t,e]):void t(7)},e.extendObservable=Ye,e.flow=Kn,e.flowBound=qn,e.flowResult=function(e){return e},e.get=function(e,n){if(it(e,n))return Et(e)?e[k].Tt(n):ar(e)?e.get(n):xt(e)?e[n]:void t(11)},e.getAtom=Dt,e.getDebugName=kt,e.getDependencyTree=function(e,t){return Xe(Dt(e,t))},e.getObserverTree=function(e,t){return Ze(Dt(e,t))},e.has=it,e.intercept=function(e,t,n){return r(n)?function(e,t,n){return pt(Ot(e,t),n)}(e,t,n):function(e,t){return pt(Ot(e),t)}(e,t)},e.isAction=Ge,e.isBoxedObservable=yn,e.isComputed=function(e){return et(e)},e.isComputedProp=function(e,t){return et(e,t)},e.isFlow=$e,e.isFlowCancellationError=function(e){return e instanceof Un},e.isObservable=nt,e.isObservableArray=xt,e.isObservableMap=ar,e.isObservableObject=Et,e.isObservableProp=function(e,t){return tt(e,t)},e.isObservableSet=cr,e.keys=rt,e.makeAutoObservable=function(e,t,n){return o(e)?Ye(e,e,t,n):(At(()=>{let r=wt(e,n)[k];if(!e[Yn]){let t=Object.getPrototypeOf(e),n=new Set([...Wt(e),...Wt(t)]);n.delete(`constructor`),n.delete(k),c(t,Yn,n)}e[Yn].forEach(e=>_t(r,e,!t||!(e in t)||t[e]))}),e)},e.makeObservable=function(e,t,n){return At(()=>{let r=wt(e,n)[k];Wt(t).forEach(e=>_t(r,e,t[e]))}),e},e.observable=cn,e.observableDeep=on,e.observableRef=rn,e.observableShallow=an,e.observableStruct=sn,e.observe=function(e,t,n,i){return r(n)?function(e,t,n,r){return ot(Ot(e,t),n,r)}(e,t,n,i):function(e,t,n){let r=Ot(e);if(xt(e))n&&t({observableKind:`array`,object:r.v,debugObjectName:r.ct.tt,type:`splice`,index:0,added:r.j.slice(),addedCount:r.j.length,removed:[],removedCount:0});else if(!ar(e)&&!cr(e)&&!Et(e))return ot(r,t,n);return ht(r,t)}(e,t,n)},e.onBecomeObserved=function(e,t,n){return Je(`onBO`,e,t,n)},e.onBecomeUnobserved=function(e,t,n){return Je(`onBUO`,e,t,n)},e.onReactionError=function(e){return M.globalReactionErrorHandlers.push(e),()=>{let t=M.globalReactionErrorHandlers.indexOf(e);t>=0&&M.globalReactionErrorHandlers.splice(t,1)}},e.override=Yt,e.ownKeys=at,e.reaction=function(e,t,n=Vt){function r(){if(p=!1,h.isDisposed)return;let t=!1,r=d;h.track(()=>{let n=we(!1,()=>e(h));t=f||!m(d,n),d=n}),(f&&n.fireImmediately||!f&&t)&&o(d,r,h),f=!1}var i;let a=n.name??`Reaction`,o=Ln(a,n.onError?(s=n.onError,c=t,function(){try{return c.apply(this,arguments)}catch(e){s.call(this,e)}}):t);var s,c;let l=!n.scheduler&&!n.delay,u=qe(n),d,f=!0,p=!1,m=n.equals||Jt,h=new Dn(a,()=>{f||l?r():p||(p=!0,u(r))},n.onError,n.requiresObservable);return n!=null&&(i=n.signal)!=null&&i.aborted||h.Y(),h.Z(n?.signal)},e.remove=function(e,n){Et(e)?e[k].Dt(n):ar(e)||cr(e)?e.delete(n):xt(e)?(typeof n!=`number`&&(n=parseInt(n,10)),e.splice(n,1)):t(9)},e.runInAction=We,e.set=function e(n,r,i){if(arguments.length===2&&!cr(n)){Fe();let t=r;try{for(let r in t)e(n,r,t[r])}finally{Ie()}return}Et(n)?n[k].Bt(r,i):ar(n)?n.set(r,i):cr(n)?n.add(r):xt(n)?(typeof r!=`number`&&(r=parseInt(r,10)),r<0&&t(42,r),Fe(),r>=n.length&&(n.length=r+1),n[r]=i,Ie()):t(8)},e.spy=function(){return console.warn(`[mobx.spy] Is a no-op in production builds`),function(){}},e.toJS=function(e){return ct(e,new Map)},e.transaction=lt,e.untracked=E,e.values=function(e){return Et(e)?rt(e).map(t=>e[t]):ar(e)?rt(e).map(t=>e.get(t)):cr(e)?Array.from(e.values()):xt(e)?e.slice():void t(6)},e.when=function(e,t,n){return arguments.length===1||t&&typeof t==`object`?function(e,t){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)return It(Promise.reject(Error(`WHEN_ABORTED`)),{cancel:()=>null});let r,i,a=new Promise((n,a)=>{var o;let s=ut(e,n,It({},t,{onError:a}));r=()=>{s(),a(Error(`WHEN_CANCELLED`))},i=()=>{s(),a(Error(`WHEN_ABORTED`))},t==null||(o=t.signal)==null||o.addEventListener==null||o.addEventListener(`abort`,i)}).finally(()=>{var e;return t==null||(e=t.signal)==null||e.removeEventListener==null?void 0:e.removeEventListener(`abort`,i)});return a.cancel=r,a}(e,t):ut(e,t,n||{})}})),pb=Ee((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t={0:`Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'`,1(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.`,19(e){return`Cannot initialize from classes that inherit from Map: `+e.constructor.name},20(e){return`Cannot initialize map from `+e},21(e){return`Cannot convert to map from '${e}'`},23:`It is not possible to get index atoms from arrays`,24(e){return`Cannot obtain administration from `+e},25(e,t){return`the entry '${e}' does not exist in the observable map '${t}'`},26:`please specify a property`,27(e,t){return`no observable property '${e.toString()}' found on the observable object '${t}'`},28(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(e,t){return`Cycle detected in computation ${e}: ${t}`},33(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(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(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`,40(e){return`Out of range: `+e},41(e){return`Cannot initialize set from `+e},42(e){return`Invalid index: '${e}'`},43(e,t,n){return`Cannot apply '${e}' to '${t}' (kind: ${n}):\n'${e}' can only be used on properties with a function value.`},44(e){return`'${e}' can only be used with 'makeObservable'`}};function n(e,...n){{let r=typeof e==`string`?e:t[e];throw typeof r==`function`&&(r=r.apply(null,n)),Error(`[MobX] ${r}`)}}let r=Object.assign,i=Object.getOwnPropertyDescriptor,a=Object.defineProperty,o=Object.prototype,s=[];Object.freeze(s);let c={};Object.freeze(c);let l=Object.toString();function u(){return++A.mobxGuid}function d(e){let t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}let f=()=>{};function p(e){return typeof e==`function`}function m(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function h(e){return typeof e==`object`&&!!e}function g(e){if(!h(e))return!1;let t=Object.getPrototypeOf(e);if(t==null)return!0;let n=ae(t,`constructor`)&&t.constructor;return typeof n==`function`&&n.toString()===l}function _(e){let t=e?.constructor;return t?t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`:!1}function v(e,t,n){a(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function y(e,t,n){a(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function b(e,t){let n=`isMobX`+e;return t.prototype[n]=!0,function(e){return h(e)&&e[n]===!0}}function ee(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function x(e){return Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(e)))===null}function S(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}function te(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);return n.length?[...t,...n.filter(t=>o.propertyIsEnumerable.call(e,t))]:t}let ne=Reflect.ownKeys;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 o.hasOwnProperty.call(e,t)}let oe=Object.getOwnPropertyDescriptors;function C(e,t){return!!(e&t)}function w(e,t,n){return n?e|=t:e&=~t,e}function se(e,t){t.includes(e.kind)||n(`The decorator applied to '${String(e.name)}' cannot be used on a ${e.kind} element`)}let T=Symbol(`mobx administration`);var ce=class{constructor(e=`Atom@`+u()){this.name_=void 0,this.flags_=0,this.observers_=null,this.lastAccessedBy_=0,this.lowestObserverState_=-1,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}get isBeingObserved(){return C(this.flags_,1)}set isBeingObserved(e){this.flags_=w(this.flags_,1,e)}get isPendingUnobservation(){return C(this.flags_,2)}set isPendingUnobservation(e){this.flags_=w(this.flags_,2,e)}get diffValue(){return+!!C(this.flags_,4)}set diffValue(e){this.flags_=w(this.flags_,4,e===1)}onBO(){this.onBOL&&this.onBOL.forEach(e=>e())}onBUO(){this.onBUOL&&this.onBUOL.forEach(e=>e())}reportObserved(){return un(this)}reportChanged(){on(),dn(this),sn()}toString(){return this.name_}};let le=b(`Atom`,ce);function ue(e,t=f,n=f){let r=new ce(e);return t!==f&&(r.onBOL=new Set([t])),n!==f&&(r.onBUOL=new Set([n])),r}function de(e,t){return e===t}function fe(e,t){return P(e,t)}function pe(e,t){return P(e,t,1)}let me=Object.is;function he(e,t,n){return e===null||typeof e!=`object`&&typeof e!=`function`||Sr(e)?e:Array.isArray(e)?D.array(e,{name:n}):g(e)?D.object(e,void 0,{name:n}):ee(e)?D.map(e,{name:n}):S(e)?D.set(e,{name:n}):typeof e==`function`&&!Bn(e)&&!pr(e)?_(e)?lr(e):In(n,e):e}function ge(e,t,r){if(e==null||Ai(e)||pi(e)||_i(e)||Si(e))return e;if(Array.isArray(e))return D.array(e,{name:r,deep:!1});if(g(e))return D.object(e,void 0,{name:r,deep:!1});if(ee(e))return D.map(e,{name:r,deep:!1});if(S(e))return D.set(e,{name:r,deep:!1});n(`The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets`)}function _e(e){return e}function ve(e,t){return Sr(e)&&n(`observable.struct should not be used with observable values`),P(e,t)?t:e}let ye=`override`,be={annotationType_:ye,make_:Se,extend_:Ce};function xe(e){return e.annotationType_===ye}function Se(e,t){return e.isPlainObject_&&n(`Cannot apply '${this.annotationType_}' to '${e.name_}.${t.toString()}':\n'${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 Ce(e,t,r,i){n(44,this.annotationType_)}function we(e,t){return{annotationType_:e,options_:t,make_:Te,extend_:Ee}}function Te(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:Bn(n.value)?1:(a(r,t,E(e,this,t,n,!1)),2)}function Ee(e,t,n,r){let i=E(e,this,t,n);return e.defineProperty_(t,i,r)}function De(e,t,r){se(r,[`method`,`field`]);let{kind:i,name:a,addInitializer:o}=r,s=e,c=e=>St(s.options_?.name??a.toString(),e,s.options_?.autoAction??!1);if(i==`field`)return function(e){var t;let n=e;return Bn(n)||(n=c(n)),(t=s.options_)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n};if(i==`method`){var l;return Bn(t)||(t=c(t)),(l=s.options_)!=null&&l.bound&&o(function(){let e=this,t=e[a].bind(e);t.isMobxAction=!0,e[a]=t}),t}n(43,s.annotationType_,String(a),i)}function Oe(e,{annotationType_:t},r,{value:i}){p(i)||n(`Cannot apply '${t}' to '${e.name_}.${r.toString()}':\n'${t}' can only be used on properties with a function value.`)}function E(e,t,n,r,i=A.safeDescriptors){var a,o;Oe(e,t,n,r);let{value:s}=r;return(a=t.options_)!=null&&a.bound&&(s=s.bind(e.proxy_??e.target_)),{value:St(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 ke(e,t){return{annotationType_:e,options_:t,make_:Ae,extend_:je}}function Ae(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)||!pr(e.target_[t]))&&this.extend_(e,t,n,!1)===null?0:pr(n.value)?1:(a(r,t,Pe(e,this,t,n,!1,!1)),2)}function je(e,t,n,r){let i=Pe(e,this,t,n,this.options_?.bound);return e.defineProperty_(t,i,r)}function Me(e,t,n){var r;se(n,[`method`]);let{name:i,addInitializer:a}=n;return pr(t)||(t=lr(t)),(r=e.options_)!=null&&r.bound&&a(function(){let e=this,t=e[i].bind(e);t.isMobXFlow=!0,e[i]=t}),t}function Ne(e,{annotationType_:t},r,{value:i}){p(i)||n(`Cannot apply '${t}' to '${e.name_}.${r.toString()}':\n'${t}' can only be used on properties with a generator function value.`)}function Pe(e,t,n,r,i,a=A.safeDescriptors){Ne(e,t,n,r);let{value:o}=r;return pr(o)||(o=lr(o)),i&&(o=o.bind(e.proxy_??e.target_),o.isMobXFlow=!0),{value:o,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function Fe(e,t){return{annotationType_:e,options_:t,make_:Ie,extend_:Le}}function Ie(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Le(e,t,n,i){return ze(e,this,t,n),e.defineComputedProperty_(t,r({},this.options_,{get:n.get,set:n.set}),i)}function Re(e,t,n){se(n,[`getter`]);let i=e,{name:a,addInitializer:o}=n,s;function c(e,n){let o=r({},i.options_,{get:t,context:e});return o.name||=`${n.name_}.${a.toString()}`,new jt(o)}return o(function(){let e=Di(this)[T],n=this,r=e.values_.get(a);r instanceof jt&&r.derivation!==t&&e.values_.delete(a),(e.lazyComputedKeys_??=new Map).set(a,()=>c(n,e))}),function(){let e=this[T],n=e.values_.get(a);if(n instanceof jt&&n.derivation!==t){let t=s?.get(this);return t||(t=c(this,e),(s??=new WeakMap).set(this,t)),t.get()}return e.getObservablePropValue_(a)}}function ze(e,{annotationType_:t},r,{get:i}){i||n(`Cannot apply '${t}' to '${e.name_}.${r.toString()}':\n'${t}' can only be used on getter(+setter) properties.`)}function Be(e,t){return{annotationType_:e,options_:t,make_:Ve,extend_:He}}function Ve(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function He(e,t,n,r){return We(e,this,t,n),e.defineObservableProperty_(t,n.value,this.options_?.enhancer_??he,r)}function Ue(e,t,r){if(r.kind===`field`)throw n(`Please use \`@observable accessor ${String(r.name)}\` instead of \`@observable ${String(r.name)}\``);se(r,[`accessor`]);let i=e,{kind:a,name:o}=r;if(a!==`accessor`)return;function s(e,t){let n=Di(e)[T];return(n.lazyObservableKeys_??=new Map).set(o,()=>new kt(t,i.options_?.enhancer_??he,`${n.name_}.${o.toString()}`,!1)),n}return{get(){return(this[T]??s(this,t.get.call(this))).getObservablePropValue_(o)},set(e){return(this[T]??s(this,e)).setObservablePropValue_(o,e)},init(e){return s(this,e),e}}}function We(e,{annotationType_:t},r,i){`value`in i||n(`Cannot apply '${t}' to '${e.name_}.${r.toString()}':\n'${t}' cannot be used on getter/setter properties`)}let Ge=Ke();function Ke(e){return{annotationType_:`true`,options_:e,make_:Ye,extend_:Xe}}let qe=[Ge];function Je(e){let t=e.deep!==!1,n=!!e.autoBind,r=!t|(n?2:0);return qe[r]??(qe[r]=Ke({deep:t,autoBind:n}))}function Ye(e,t,n,r){var i;if(n.get)return O.make_(e,t,n,r);if(n.set){let i=Bn(n.set)?n.set:St(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:A.safeDescriptors?e.isPlainObject_:!0,set:i})===null?0:2:(a(r,t,{configurable:!0,set:i}),2)}if(r!==e.target_&&typeof n.value==`function`){var o;if(_(n.value)){var s;return((s=this.options_)!=null&&s.autoBind?ur:lr).make_(e,t,n,r)}return((o=this.options_)!=null&&o.autoBind?Rn:In).make_(e,t,n,r)}let c=this.options_?.deep===!1?ut:D;return typeof n.value==`function`&&(i=this.options_)!=null&&i.autoBind&&(n.value=n.value.bind(e.proxy_??e.target_)),c.make_(e,t,n,r)}function Xe(e,t,n,r){var i;return n.get?O.extend_(e,t,n,r):n.set?e.defineProperty_(t,{configurable:A.safeDescriptors?e.isPlainObject_:!0,set:St(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?ut:D).extend_(e,t,n,r))}function Ze(e,t){return r(function(r,i){if(i&&typeof i.kind==`string`)return t(e,r,i);n(`Invalid arguments for \`${e.annotationType_}\``)},e)}let Qe={deep:!0,name:void 0,defaultDecorator:void 0};Object.freeze(Qe);function $e(e){return e||Qe}let et=Be(`observable`),tt=Be(`observable.ref`,{enhancer_:_e}),nt=Be(`observable.shallow`,{enhancer_:ge}),rt=Be(`observable.struct`,{enhancer_:ve});function it(e){return Ze(e,Ue)}function at(e){return e.deep===!0?he:e.deep===!1?_e:st(e.defaultDecorator)}function ot(e){return e?e.defaultDecorator??Je(e):void 0}function st(e){return e?e.options_?.enhancer_??he:he}function ct(e,t,n){return t&&typeof t.kind==`string`?Ue(et,e,t):Sr(e)?e:g(e)?D.object(e,t,n):Array.isArray(e)?D.array(e,t):ee(e)?D.map(e,t):S(e)?D.set(e,t):typeof e==`object`&&e?e:D.box(e,t)}let lt={box(e,t){let n=$e(t);return new kt(e,at(n),n.name,!0,n.equals)},array(e,t){let n=$e(t);return si(e,at(n),n.name)},map(e,t){let n=$e(t);return new gi(e,at(n),n.name)},set(e,t){let n=$e(t);return new xi(e,at(n),n.name)},object(e,t,n){return Ii(()=>Zn(Kr({},n),e,t))}},ut=it(tt),dt=it(nt),ft=it(et),pt=it(rt);var D=r(ct,et,lt);let mt=`computed`;function ht(e){return Ze(e,Re)}let gt=Fe(mt),_t=ht(Fe(`computed.struct`,{equals:fe})),O=function(e,t){if(t&&typeof t.kind==`string`)return Re(gt,e,t);if(g(e))return ht(Fe(mt,e));p(e)||n("First argument to `computed` should be an expression."),p(t)&&n("A setter as second argument is no longer supported, use `{ set: fn }` option instead");let r=g(t)?t:{};return r.get=e,r.name||=e.name||``,new jt(r)};r(O,gt);let vt=0,yt=1,bt=i(()=>{},`name`)?.configurable??!1,xt={value:`action`,configurable:!0,writable:!1,enumerable:!1};function St(e,t,r=!1,i){p(t)||n("`action` can only be invoked on functions"),(typeof e!=`string`||!e)&&n(`actions should have valid names, got: '${e}'`);function o(){return Ct(e,r,t,i||this,arguments)}return o.isMobxAction=!0,o.toString=()=>t.toString(),bt&&(xt.value=e,a(o,`name`,xt)),o}function Ct(e,t,n,r,i){let a=wt(e,t,r,i);try{return n.apply(r,i)}catch(e){throw a.error_=e,e}finally{Tt(a)}}function wt(e,t,n,r){let i=xn()&&!!e,a=0;i&&(a=Date.now(),Cn({type:M,name:e,object:n,arguments:r?Array.from(r):s}));let o=A.trackingDerivation,c=!t||!o;on();let l=A.allowStateChanges;c&&(Wt(),l=Dt(!0));let u=A.allowStateReads;k(!0);let d={runAsAction_:c,prevDerivation_:o,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:i,startTime_:a,actionId_:yt++,parentActionId_:vt};return vt=d.actionId_,d}function Tt(e){vt!==e.actionId_&&n(30),vt=e.parentActionId_,e.error_!==void 0&&(A.suppressReactionErrors=!0),Ot(e.prevAllowStateChanges_),Kt(e.prevAllowStateReads_),sn(),e.runAsAction_&&Gt(e.prevDerivation_),e.notifySpy_&&Tn({time:Date.now()-e.startTime_}),A.suppressReactionErrors=!1}function Et(e,t){let n=Dt(e);try{return t()}finally{Ot(n)}}function Dt(e){let t=A.allowStateChanges;return A.allowStateChanges=e,t}function Ot(e){A.allowStateChanges=e}var kt=class extends ce{constructor(e,t,n=`ObservableValue@`+u(),r=!0,i=me){super(n),this.enhancer_=void 0,this.name_=void 0,this.equals_=void 0,this.hasUnreportedChange_=!1,this.interceptors_=void 0,this.changeListeners_=void 0,this.value_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,this.equals_=i,this.value_=t(e,void 0,n),r&&xn()&&Sn({type:`create`,object:this,observableKind:`value`,debugObjectName:this.name_,newValue:this.value_})}dehanceValue(e){return this.dehancer===void 0?e:this.dehancer(e)}set(e){let t=this.value_;if(e=this.prepareNewValue_(e),e!==A.UNCHANGED){let n=xn();n&&Cn({type:ii,object:this,observableKind:`value`,debugObjectName:this.name_,newValue:e,oldValue:t}),this.setNewValue_(e),n&&Tn()}}prepareNewValue_(e){if(Lt(this),qr(this)){let t=Yr(this,{object:this,type:ii,newValue:e});if(!t)return A.UNCHANGED;e=t.newValue}return e=this.enhancer_(e,this.value_,this.name_),this.equals_(this.value_,e)?A.UNCHANGED:e}setNewValue_(e){let t=this.value_;this.value_=e,this.reportChanged(),Xr(this)&&Qr(this,{type:ii,object:this,newValue:e,oldValue:t})}get(){return this.reportObserved(),this.dehanceValue(this.value_)}raw(){return this.value_}toJSON(){return this.get()}toString(){return`${this.name_}[${this.value_}]`}valueOf(){return ie(this.get())}[Symbol.toPrimitive](){return this.valueOf()}};let At=b(`ObservableValue`,kt);var jt=class{constructor(e){this.dependenciesState_=-1,this.observing_=[],this.newObserving_=null,this.observers_=null,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=0,this.unboundDepsCount_=0,this.value_=new Nt(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,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@`+u(),e.set&&(this.setter_=St(this.name_+`-setter`,e.set)),this.equals_=e.equals||me,this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}onBecomeStale_(){pn(this)}onBO(){this.onBOL&&this.onBOL.forEach(e=>e())}onBUO(){this.onBUOL&&this.onBUOL.forEach(e=>e())}get isComputing(){return C(this.flags_,1)}set isComputing(e){this.flags_=w(this.flags_,1,e)}get isRunningSetter(){return C(this.flags_,2)}set isRunningSetter(e){this.flags_=w(this.flags_,2,e)}get isBeingObserved(){return C(this.flags_,4)}set isBeingObserved(e){this.flags_=w(this.flags_,4,e)}get isPendingUnobservation(){return C(this.flags_,8)}set isPendingUnobservation(e){this.flags_=w(this.flags_,8,e)}get diffValue(){return+!!C(this.flags_,16)}set diffValue(e){this.flags_=w(this.flags_,16,e===1)}get(){if(this.isComputing&&n(32,this.name_,this.derivation),A.inBatch===0&&(!this.observers_||this.observers_.size===0)&&!this.keepAlive_)Ft(this)&&(this.warnAboutUntrackedRead_(),on(),this.value_=this.computeValue_(!1),sn());else{let e=this.isBeingObserved;if(un(this),Ft(this)){let e=A.trackingContext;!e&&(this.keepAlive_||this.isBeingObserved)&&(A.trackingContext=this),this.trackAndCompute()&&fn(this),A.trackingContext=e}else !e&&this.isBeingObserved&&this.observing_.forEach(ln)}let e=this.value_;if(Pt(e))throw e.cause;return e}set(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_)}trackAndCompute(){let e=this.value_,t=this.dependenciesState_===-1,n=this.computeValue_(!0),r=t||Pt(e)||Pt(n)||!this.equals_(e,n);return r&&(this.value_=n,xn()&&Sn({observableKind:`computed`,debugObjectName:this.name_,object:this.scope_,type:`update`,oldValue:e,newValue:n})),r}computeValue_(e){this.isComputing=!0;let t=Dt(!1),n;if(e)n=zt(this,this.derivation,this.scope_);else if(A.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(e){n=new Nt(e)}return Ot(t),this.isComputing=!1,n}suspend_(){this.keepAlive_||(Ht(this),this.value_=void 0)}warnAboutUntrackedRead_(){(typeof this.requiresReaction_==`boolean`?this.requiresReaction_:A.computedRequiresReaction)&&console.warn(`[mobx] Computed value '${this.name_}' is being read outside a reactive context. Doing a full recompute.`)}toString(){return`${this.name_}[${this.derivation.toString()}]`}valueOf(){return ie(this.get())}[Symbol.toPrimitive](){return this.valueOf()}};let Mt=b(`ComputedValue`,jt);var Nt=class{constructor(e){this.cause=void 0,this.cause=e}};function Pt(e){return e instanceof Nt}function Ft(e){switch(e.dependenciesState_){case 0:return!1;case-1:case 2:return!0;case 1:{let t=k(!0),n=Wt(),r=e.observing_,i=r.length;for(let a=0;a<i;a++){let i=r[a];if(Mt(i)){if(A.disableErrorBoundaries)i.get();else try{i.get()}catch{return Gt(n),Kt(t),!0}if(e.dependenciesState_===2)return Gt(n),Kt(t),!0}}return qt(e),Gt(n),Kt(t),!1}}}function It(){return A.trackingDerivation!==null}function Lt(e){let t=!!e.observers_&&e.observers_.size>0;!A.allowStateChanges&&(t||A.enforceActions===`always`)&&console.warn(`[MobX] `+(A.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 Rt(e){!A.allowStateReads&&A.observableRequiresReaction&&console.warn(`[mobx] Observable '${e.name_}' being read outside a reactive context.`)}function zt(e,t,n){let r=k(!0);qt(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++A.runId;let i=A.trackingDerivation;A.trackingDerivation=e,A.inBatch++;let a;if(A.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(e){a=new Nt(e)}return A.inBatch--,A.trackingDerivation=i,Vt(e),Bt(e),Kt(r),a}function Bt(e){e.observing_.length===0&&(typeof e.requiresObservable_==`boolean`?e.requiresObservable_:A.reactionRequiresObservable)&&console.warn(`[mobx] Derivation '${e.name_}' is created/updated without reading any observable value.`)}function Vt(e){let t=e.observing_,n=e.observing_=e.newObserving_,r=0,i=0,a=e.unboundDepsCount_;for(let e=0;e<a;e++){let t=n[e];t.diffValue===0&&(t.diffValue=1,i!==e&&(n[i]=t),i++),t.dependenciesState_>r&&(r=t.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){let n=t[a];n.diffValue===0&&rn(n,e),n.diffValue=0}for(;i--;){let t=n[i];t.diffValue===1&&(t.diffValue=0,nn(t,e))}r!==0&&(e.dependenciesState_=r,e.onBecomeStale_())}function Ht(e){let t=e.observing_;e.observing_=[];let n=t.length;for(;n--;)rn(t[n],e);e.dependenciesState_=-1}function Ut(e){let t=Wt();try{return e()}finally{Gt(t)}}function Wt(){let e=A.trackingDerivation;return A.trackingDerivation=null,e}function Gt(e){A.trackingDerivation=e}function k(e){let t=A.allowStateReads;return A.allowStateReads=e,t}function Kt(e){A.allowStateReads=e}function qt(e){if(e.dependenciesState_===0)return;e.dependenciesState_=0;let t=e.observing_,n=t.length;for(;n--;)t[n].lowestObserverState_=0}let Jt=[`mobxGuid`,`spyListeners`,`enforceActions`,`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`allowStateReads`,`disableErrorBoundaries`,`runId`,`UNCHANGED`];var Yt=class{constructor(){this.version=7,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.isRunningUnobservations=!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.safeDescriptors=!0}};let Xt=!0,Zt=!1,A=function(){let e=globalThis;return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Xt=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==7&&(Xt=!1),Xt?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Yt):(setTimeout(()=>{Zt||n(35)},1),new Yt)}();function Qt(){if((A.pendingReactions.length||A.inBatch||A.isRunningReactions)&&n(36),Zt=!0,Xt){let e=globalThis;--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),A=new Yt}}function $t(){return A}function j(){let e=new Yt;for(let t in e)Jt.indexOf(t)===-1&&(A[t]=e[t]);A.allowStateChanges=!A.enforceActions}function en(e){return!!e.observers_&&e.observers_.size>0}function tn(e){return e.observers_??new Set}function nn(e,t){(e.observers_??=new Set).add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function rn(e,t){let n=e.observers_;n&&(n.delete(t),n.size===0&&an(e))}function an(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,A.pendingUnobservations.push(e))}function on(){A.inBatch++}function sn(){--A.inBatch===0&&(_n(),!A.isRunningUnobservations&&A.pendingUnobservations.length>0&&cn())}function cn(){A.isRunningUnobservations=!0;try{let e=A.pendingUnobservations;for(let t=0;t<e.length;t++){let n=e[t];n.isPendingUnobservation=!1,(!n.observers_||n.observers_.size===0)&&(n.observers_=null,n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof jt&&n.suspend_())}A.pendingUnobservations=[]}finally{A.isRunningUnobservations=!1}}function ln(e){var t;e.isBeingObserved||(e.isBeingObserved=!0,e.onBO(),(t=e.observing_)==null||t.forEach(ln))}function un(e){Rt(e);let t=A.trackingDerivation;return t===null?((!e.observers_||e.observers_.size===0)&&A.inBatch>0&&an(e),!1):(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&A.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function dn(e){var t;e.lowestObserverState_!==2&&(e.lowestObserverState_=2,(t=e.observers_)==null||t.forEach(e=>{e.dependenciesState_===0&&e.onBecomeStale_(),e.dependenciesState_=2}))}function fn(e){var t;e.lowestObserverState_!==2&&(e.lowestObserverState_=2,(t=e.observers_)==null||t.forEach(t=>{t.dependenciesState_===1?t.dependenciesState_=2:t.dependenciesState_===0&&(e.lowestObserverState_=0)}))}function pn(e){var t;e.lowestObserverState_===0&&(e.lowestObserverState_=1,(t=e.observers_)==null||t.forEach(e=>{e.dependenciesState_===0&&(e.dependenciesState_=1,e.onBecomeStale_())}))}var mn=class{constructor(e=`Reaction@`+u(),t,n,r){this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=-1,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.removeAbortListener_=void 0,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}get isDisposed(){return C(this.flags_,1)}set isDisposed(e){this.flags_=w(this.flags_,1,e)}get isScheduled(){return C(this.flags_,2)}set isScheduled(e){this.flags_=w(this.flags_,2,e)}get isTrackPending(){return C(this.flags_,4)}set isTrackPending(e){this.flags_=w(this.flags_,4,e)}get isRunning(){return C(this.flags_,8)}set isRunning(e){this.flags_=w(this.flags_,8,e)}get diffValue(){return+!!C(this.flags_,16)}set diffValue(e){this.flags_=w(this.flags_,16,e===1)}onBecomeStale_(){this.schedule_()}schedule_(){this.isScheduled||(this.isScheduled=!0,A.pendingReactions.push(this),_n())}runReaction_(){if(!this.isDisposed){on(),this.isScheduled=!1;let e=A.trackingContext;if(A.trackingContext=this,Ft(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&xn()&&Sn({name:this.name_,type:`scheduled-reaction`})}catch(e){this.reportExceptionInDerivation_(e)}}A.trackingContext=e,sn()}}track(e){if(this.isDisposed)return;on();let t=xn(),n;t&&(n=Date.now(),Cn({name:this.name_,type:`reaction`})),this.isRunning=!0;let r=A.trackingContext;A.trackingContext=this;let i=zt(this,e,void 0);A.trackingContext=r,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ht(this),Pt(i)&&this.reportExceptionInDerivation_(i.cause),t&&Tn({time:Date.now()-n}),sn()}reportExceptionInDerivation_(e){if(this.errorHandler_){this.errorHandler_(e,this);return}if(A.disableErrorBoundaries)throw e;let t=`[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '${this}'`;A.suppressReactionErrors?console.warn(`[mobx] (error in reaction '${this.name_}' suppressed, fix error of causing action below)`):console.error(t,e),xn()&&Sn({type:`error`,name:this.name_,message:t,error:``+e}),A.globalReactionErrorHandlers.forEach(t=>t(e,this))}dispose(){if(!this.isDisposed){var e;this.isDisposed=!0,(e=this.removeAbortListener_)==null||e.call(this),this.isRunning||(on(),Ht(this),sn())}}getDisposer_(e){let t=()=>this.dispose();return e!=null&&e.addEventListener&&!this.isDisposed&&(e.addEventListener(`abort`,t),this.removeAbortListener_=()=>e.removeEventListener==null?void 0:e.removeEventListener(`abort`,t)),t[T]=this,`dispose`in Symbol&&typeof Symbol.dispose==`symbol`&&(t[Symbol.dispose]=t),t}toString(){return`Reaction[${this.name_}]`}};function hn(e){return A.globalReactionErrorHandlers.push(e),()=>{let t=A.globalReactionErrorHandlers.indexOf(e);t>=0&&A.globalReactionErrorHandlers.splice(t,1)}}let gn=e=>e();function _n(){A.inBatch>0||A.isRunningReactions||gn(vn)}function vn(){A.isRunningReactions=!0;let e=A.pendingReactions,t=0;for(;e.length>0;){++t===100&&(console.error(`Reaction doesn't converge to a stable state after 100 iterations. Probably there is a cycle in the reactive function: ${e[0]}`),e.splice(0));let n=e.splice(0);for(let e=0,t=n.length;e<t;e++)n[e].runReaction_()}A.isRunningReactions=!1}let yn=b(`Reaction`,mn);function bn(e){let t=gn;gn=n=>e(()=>t(n))}function xn(){return!!A.spyListeners.length}function Sn(e){if(!A.spyListeners.length)return;let t=A.spyListeners;for(let n=0,r=t.length;n<r;n++)t[n](e)}function Cn(e){Sn(r({},e,{spyReportStart:!0}))}let wn={type:`report-end`,spyReportEnd:!0};function Tn(e){Sn(e?r({},e,{type:`report-end`,spyReportEnd:!0}):wn)}function En(e){return A.spyListeners.push(e),d(()=>{A.spyListeners=A.spyListeners.filter(t=>t!==e)})}let M=`action`,Dn=`autoAction`,On=`<unnamed action>`,kn=we(M),An=we(`action.bound`,{bound:!0}),jn=we(Dn,{autoAction:!0}),Mn=we(`autoAction.bound`,{autoAction:!0,bound:!0});function Nn(e){return Ze(e,De)}function Pn(e){return function(t,r){if(r&&typeof r.kind==`string`)return De(e?jn:kn,t,r);if(p(t))return St(t.name||On,t,e);if(p(r))return St(t,r,e);if(m(t))return Nn(we(e?Dn:M,{name:t,autoAction:e}));n("Invalid arguments for `action`")}}let Fn=Pn(!1);r(Fn,kn);let In=Pn(!0);r(In,jn);let Ln=Nn(An),Rn=Nn(Mn);function zn(e){return Ct(e.name||On,!1,e,this,void 0)}function Bn(e){return p(e)&&e.isMobxAction===!0}function Vn(e,t=c){var r;p(e)||n(`Autorun expects a function as first argument`),Bn(e)&&n(`Autorun does not accept actions since actions are untrackable`);let i=t?.name??(e.name||`Autorun@`+u()),a=!t.scheduler&&!t.delay,o;if(a)o=new mn(i,function(){this.track(s)},t.onError,t.requiresObservable);else{let e=Un(t),n=!1;o=new mn(i,()=>{n||(n=!0,e(()=>{n=!1,o.isDisposed||o.track(s)}))},t.onError,t.requiresObservable)}function s(){e(o)}return t!=null&&(r=t.signal)!=null&&r.aborted||o.schedule_(),o.getDisposer_(t?.signal)}let Hn=e=>e();function Un(e){return e.scheduler?e.scheduler:e.delay?t=>setTimeout(t,e.delay):Hn}function Wn(e,t,r=c){var i;(!p(e)||!p(t))&&n(`First and second argument to reaction should be functions`),g(r)||n(`Third argument of reactions should be an object`);let a=r.name??`Reaction@`+u(),o=Fn(a,r.onError?Gn(r.onError,t):t),s=!r.scheduler&&!r.delay,l=Un(r),d=!0,f=!1,m,h=r.equals||me,_=new mn(a,()=>{d||s?v():f||(f=!0,l(v))},r.onError,r.requiresObservable);function v(){if(f=!1,_.isDisposed)return;let t=!1,n=m;_.track(()=>{let n=Et(!1,()=>e(_));t=d||!h(m,n),m=n}),(d&&r.fireImmediately||!d&&t)&&o(m,n,_),d=!1}return r!=null&&(i=r.signal)!=null&&i.aborted||_.schedule_(),_.getDisposer_(r?.signal)}function Gn(e,t){return function(){try{return t.apply(this,arguments)}catch(t){e.call(this,t)}}}function Kn(e,t,n){return Jn(`onBO`,e,t,n)}function qn(e,t,n){return Jn(`onBUO`,e,t,n)}function Jn(e,t,n,r){let i=typeof r==`function`?Ni(t,n):Ni(t),a=p(r)?r:n,o=`${e}L`;return i[o]?i[o].add(a):i[o]=new Set([a]),function(){let e=i[o];e&&(e.delete(a),e.size===0&&delete i[o])}}let Yn=`always`;function Xn(e){e.isolateGlobalState===!0&&Qt();let{enforceActions:t}=e;if(t!==void 0){let e=t===Yn?Yn:t===`observed`;A.enforceActions=e,A.allowStateChanges=!(e===!0||e===Yn)}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(t=>{t in e&&(A[t]=!!e[t])}),A.allowStateReads=!A.observableRequiresReaction,A.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&bn(e.reactionScheduler)}function Zn(e,t,r,i){arguments.length>4&&n(`'extendObservable' expected 2-4 arguments`),typeof e!=`object`&&n(`'extendObservable' expects an object as first argument`),_i(e)&&n(`'extendObservable' should not be used on maps, use map.merge instead`),g(t)||n(`'extendObservable' only accepts plain objects as second argument`),(Sr(t)||Sr(r))&&n(`Extending an object with another observable (object) is not supported`);let a=oe(t);return Ii(()=>{let t=Di(e,i)[T];ne(a).forEach(e=>{t.extend_(e,a[e],r&&e in r?r[e]:!0)})}),e}function Qn(e,t){return $n(Ni(e,t))}function $n(e){let t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=nr(e.observing_).map($n)),t}function er(e,t){return tr(Ni(e,t))}function tr(e){let t={name:e.name_};return en(e)&&(t.observers=Array.from(tn(e),tr)),t}function nr(e){return Array.from(new Set(e))}let rr=0;var ir=class extends Error{constructor(){super(`FLOW_CANCELLED`),Object.setPrototypeOf(this,new.target.prototype),this.name=`FlowCancellationError`}toString(){return`Error: ${this.message}`}};function ar(e){return e instanceof ir}function or(e){return Ze(e,Me)}let sr=ke(`flow`),cr=ke(`flow.bound`,{bound:!0}),lr=r(function(e,t){if(t&&typeof t.kind==`string`)return Me(sr,e,t);arguments.length!==1&&n(`Flow expects single argument with generator function`);let r=e,i=r.name||`<unnamed flow>`,a=function(){let e=this,t=arguments,n=++rr,a=Fn(`${i} - runid: ${n} - init`,r).apply(e,t),o,s,c=new Promise(function(e,t){let r=0;o=t;function c(e){s=void 0;let o;try{o=Fn(`${i} - runid: ${n} - yield ${r++}`,a.next).call(a,e)}catch(e){return t(e)}u(o)}function l(e){s=void 0;let o;try{o=Fn(`${i} - runid: ${n} - yield ${r++}`,a.throw).call(a,e)}catch(e){return t(e)}u(o)}function u(n){if(p(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=Fn(`${i} - runid: ${n} - cancel`,function(){try{s&&dr(s);let e=a.return(void 0),t=Promise.resolve(e.value);t.then(f,f),dr(t),o(new ir)}catch(e){o(e)}}),c};return a.isMobXFlow=!0,a},sr),ur=or(cr);function dr(e){p(e.cancel)&&e.cancel()}function fr(e){return e}function pr(e){return e?.isMobXFlow===!0}function mr(e,t,r){let i;if(_i(e)||pi(e)||At(e))i=Pi(e);else if(Ai(e)){if(!m(t))return n(`InterceptReads can only be used with a specific property, not with an object in general`);i=Pi(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,()=>{i.dehancer=void 0}):n(`An intercept reader was already established`)}function hr(e,t,n){return p(n)?_r(e,t,n):gr(e,t)}function gr(e,t){return Jr(Pi(e),t)}function _r(e,t,n){return Jr(Pi(e,t),n)}function vr(e,t){var n;if(t===void 0)return Mt(e);if(Ai(e)===!1)return!1;let r=e[T];return(n=r.lazyComputedKeys_)!=null&&n.has(t)?!0:r.values_.has(t)?Mt(Ni(e,t)):!1}function yr(e){return arguments.length>1?n(`isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property`):vr(e)}function br(e,t){return m(t)?vr(e,t):n(`isComputed expected a property name as second argument`)}function xr(e,t){if(!e)return!1;if(t!==void 0){if(_i(e)||pi(e))return n(`isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.`);if(Ai(e)){var r,i;let n=e[T];return n.values_.has(t)||!!((r=n.lazyComputedKeys_)!=null&&r.has(t))||!!((i=n.lazyObservableKeys_)!=null&&i.has(t))}return!1}return Ai(e)||!!e[T]||le(e)||yn(e)||Mt(e)}function Sr(e){return arguments.length!==1&&n(`isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property`),xr(e)}function Cr(e,t){return m(t)?xr(e,t):n(`expected a property name as second argument`)}function wr(e){if(Ai(e))return e[T].keys_();if(_i(e)||Si(e))return Array.from(e.keys());if(pi(e))return e.map((e,t)=>t);n(5)}function Tr(e){if(Ai(e))return wr(e).map(t=>e[t]);if(_i(e))return wr(e).map(t=>e.get(t));if(Si(e))return Array.from(e.values());if(pi(e))return e.slice();n(6)}function Er(e){if(Ai(e))return wr(e).map(t=>[t,e[t]]);if(_i(e))return wr(e).map(t=>[t,e.get(t)]);if(Si(e))return Array.from(e.entries());if(pi(e))return e.map((e,t)=>[t,e]);n(7)}function Dr(e,t,r){if(arguments.length===2&&!Si(e)){on();let n=t;try{for(let t in n)Dr(e,t,n[t])}finally{sn()}return}Ai(e)?e[T].set_(t,r):_i(e)?e.set(t,r):Si(e)?e.add(t):pi(e)?(typeof t!=`number`&&(t=parseInt(t,10)),t<0&&n(42,t),on(),t>=e.length&&(e.length=t+1),e[t]=r,sn()):n(8)}function Or(e,t){Ai(e)?e[T].delete_(t):_i(e)||Si(e)?e.delete(t):pi(e)?(typeof t!=`number`&&(t=parseInt(t,10)),e.splice(t,1)):n(9)}function kr(e,t){if(Ai(e))return e[T].has_(t);if(_i(e)||Si(e))return e.has(t);if(pi(e))return t>=0&&t<e.length;n(10)}function Ar(e,t){if(kr(e,t)){if(Ai(e))return e[T].get_(t);if(_i(e))return e.get(t);if(pi(e))return e[t];n(11)}}function jr(e,t,r){if(Ai(e))return e[T].defineProperty_(t,r);n(39)}function Mr(e){if(Ai(e))return e[T].ownKeys_();n(38)}function Nr(e,t,n,r){return p(n)?Fr(e,t,n,r):Pr(e,t,n)}function Pr(e,t,r){let i=Pi(e);if(pi(e))r&&t({observableKind:`array`,object:i.proxy_,debugObjectName:i.atom_.name_,type:`splice`,index:0,added:i.values_.slice(),addedCount:i.values_.length,removed:[],removedCount:0});else if(_i(e))r===!0&&n("`observe` doesn't support fireImmediately=true in combination with maps.");else if(Si(e))r===!0&&n("`observe` doesn't support fireImmediately=true in combination with sets.");else if(Ai(e))r===!0&&n("`observe` doesn't support the fire immediately property for observable objects.");else return Ir(i,t,r);return Zr(i,t)}function Fr(e,t,n,r){return Ir(Pi(e,t),n,r)}function Ir(e,t,n){if(Mt(e)){let r=!0,i;return Vn(()=>{let a=e.get();if(!r||n){let n=Wt();t({observableKind:`computed`,debugObjectName:e.name_,type:ii,object:e,newValue:a,oldValue:i}),Gt(n)}r=!1,i=a})}return n&&t({observableKind:`value`,debugObjectName:e.name_,object:e,type:ii,newValue:e.value_,oldValue:void 0}),Zr(e,t)}function Lr(e,t,n){return e.set(t,n),n}function Rr(e,t){if(typeof e!=`object`||!e||e instanceof Date||!Sr(e))return e;if(At(e)||Mt(e))return Rr(e.get(),t);if(t.has(e))return t.get(e);if(pi(e)){let n=Lr(t,e,Array(e.length));return e.forEach((e,r)=>{n[r]=Rr(e,t)}),n}if(Si(e)){let n=Lr(t,e,new Set);return e.forEach(e=>{n.add(Rr(e,t))}),n}if(_i(e)){let n=Lr(t,e,new Map);return e.forEach((e,r)=>{n.set(r,Rr(e,t))}),n}else{let n=Lr(t,e,{});return Mr(e).forEach(r=>{o.propertyIsEnumerable.call(e,r)&&(n[r]=Rr(e[r],t))}),n}}function zr(e,t){return t&&n(`toJS no longer supports options`),Rr(e,new Map)}function Br(e,t=void 0){on();try{return e.apply(t)}finally{sn()}}function Vr(e,t,n){return arguments.length===1||t&&typeof t==`object`?Ur(e,t):Hr(e,t,n||{})}function Hr(e,t,n){let r;if(typeof n.timeout==`number`){let e=Error(`WHEN_TIMEOUT`);r=setTimeout(()=>{if(!a[T].isDisposed)if(a(),n.onError)n.onError(e);else throw e},n.timeout)}n.name=n.name||`When@`+u();let i=St(n.name+`-effect`,t);var a=Vn(t=>{Et(!1,e)&&(t.dispose(),r&&clearTimeout(r),i())},n);return a}function Ur(e,t){var i;if(t&&t.onError)return n(`the options 'onError' and 'promise' cannot be combined`);if(t!=null&&(i=t.signal)!=null&&i.aborted)return r(Promise.reject(Error(`WHEN_ABORTED`)),{cancel:()=>null});let a,o,s=new Promise((n,i)=>{var s;let c=Hr(e,n,r({},t,{onError:i}));a=()=>{c(),i(Error(`WHEN_CANCELLED`))},o=()=>{c(),i(Error(`WHEN_ABORTED`))},t==null||(s=t.signal)==null||s.addEventListener==null||s.addEventListener(`abort`,o)}).finally(()=>{var e;return t==null||(e=t.signal)==null||e.removeEventListener==null?void 0:e.removeEventListener(`abort`,o)});return s.cancel=a,s}function Wr(e){return e[T]}let Gr={has(e,t){return Wr(e).has_(t)},get(e,t){return Wr(e).get_(t)},set(e,t,n){return m(t)?Wr(e).set_(t,n,!0)??!0:!1},deleteProperty(e,t){return m(t)?Wr(e).delete_(t,!0)??!0:!1},defineProperty(e,t,n){return Wr(e).defineProperty_(t,n)??!0},ownKeys(e){return Wr(e).ownKeys_()},preventExtensions(e){n(13)}};function Kr(e,t){var n;return e=Di(e,t),(n=e[T]).proxy_??(n.proxy_=new Proxy(e,Gr))}function qr(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Jr(e,t){let n=e.interceptors_;return n?n.push(t):n=e.interceptors_=[t],d(()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function Yr(e,t){let r=Wt();try{let r=[...e.interceptors_||[]];for(let e=0,i=r.length;e<i&&(t=r[e](t),t&&!t.type&&n(14),t);e++);return t}finally{Gt(r)}}function Xr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Zr(e,t){let n=e.changeListeners_;return n?n.push(t):n=e.changeListeners_=[t],d(()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function Qr(e,t){let n=Wt(),r=e.changeListeners_;if(r){r=r.slice();for(let e=0,n=r.length;e<n;e++)r[e](t);Gt(n)}}function $r(e,t,n){return Ii(()=>{let r=Di(e,n)[T];ne(t).forEach(e=>ni(r,e,t[e]))}),e}let ei=Symbol(`mobx-keys`);function ti(e,t,r){return!g(e)&&!g(Object.getPrototypeOf(e))&&n(`'makeAutoObservable' can only be used for classes that don't have a superclass`),Ai(e)&&n(`makeAutoObservable can only be used on objects not already made observable`),g(e)?Zn(e,e,t,r):(Ii(()=>{let n=Di(e,r)[T];if(!e[ei]){let t=Object.getPrototypeOf(e),n=new Set([...ne(e),...ne(t)]);n.delete(`constructor`),n.delete(T),v(t,ei,n)}e[ei].forEach(e=>ni(n,e,t&&e in t?t[e]:!0))}),e)}function ni(e,t,r){if(r===!0&&(r=e.defaultAnnotation_),r===!1)return;Mi(e,r,t),t in e.target_||n(1,r.annotationType_,`${e.name_}.${t.toString()}`);let a=e.target_;for(;a&&a!==o;){let n=i(a,t);if(n){let i=r.make_(e,t,n,a);if(i===0)return;if(i===1)break}a=Object.getPrototypeOf(a)}ji(e,r,t)}let ri=`splice`,ii=`update`,ai={get(e,t){let n=e[T];return t===T?n:t===`length`?n.getArrayLength_():typeof t==`string`&&!isNaN(t)?n.get_(parseInt(t)):ae(ci,t)?ci[t]:e[t]},set(e,t,n){let r=e[T];return t===`length`?r.setArrayLength_(n):typeof t==`symbol`||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions(){n(15)}};var oi=class{constructor(e=`ObservableArray@`+u(),t,n){this.owned_=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.atom_=new ce(e),this.enhancer_=(n,r)=>t(n,r,e+`[..]`)}dehanceValue_(e){return this.dehancer===void 0?e:this.dehancer(e)}dehanceValues_(e){return this.dehancer!==void 0&&e.length>0?e.map(this.dehancer):e}getArrayLength_(){return this.atom_.reportObserved(),this.values_.length}setArrayLength_(e){(!Number.isInteger(e)||e<0)&&n(40,e);let t=this.values_.length;if(e!==t)if(e>t){let n=Array.from({length:e-t});this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)}updateArrayLength_(e,t){e!==this.lastKnownLength_&&n(16),this.lastKnownLength_+=t}spliceWithArray_(e,t,n){Lt(this.atom_);let r=this.values_.length;if(e===void 0?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=arguments.length===1?r-e:t==null?0:Math.max(0,Math.min(t,r-e)),n===void 0&&(n=s),qr(this)){let r=Yr(this,{object:this.proxy_,type:ri,index:e,removedCount:t,added:n});if(!r)return s;t=r.removedCount,n=r.added}n=n.length===0?n:n.map(e=>this.enhancer_(e,void 0));{let e=n.length-t;this.updateArrayLength_(r,e)}let i=this.spliceItemsIntoValues_(e,t,n);return(t!==0||n.length!==0)&&this.notifyArraySplice_(e,n,i),this.dehanceValues_(i)}spliceItemsIntoValues_(e,t,n){if(n.length<1e4)return this.values_.splice(e,t,...n);{let r=this.values_.slice(e,e+t),i=this.values_.slice(e+t);this.values_.length+=n.length-t;for(let t=0;t<n.length;t++)this.values_[e+t]=n[t];for(let t=0;t<i.length;t++)this.values_[e+n.length+t]=i[t];return r}}notifyArrayChildUpdate_(e,t,n){let r=!this.owned_&&xn(),i=Xr(this),a=i||r?{observableKind:`array`,object:this.proxy_,type:ii,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;r&&Cn(a),this.atom_.reportChanged(),i&&Qr(this,a),r&&Tn()}notifyArraySplice_(e,t,n){let r=!this.owned_&&xn(),i=Xr(this),a=i||r?{observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:ri,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Cn(a),this.atom_.reportChanged(),i&&Qr(this,a),r&&Tn()}get_(e){return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e])}set_(e,t){let n=this.values_;if(e<n.length){Lt(this.atom_);let r=n[e];if(qr(this)){let n=Yr(this,{type:ii,object:this.proxy_,index:e,newValue:t});if(!n)return;t=n.newValue}t=this.enhancer_(t,r),t!==r&&(n[e]=t,this.notifyArrayChildUpdate_(e,t,r))}else{let r=Array.from({length:e+1-n.length});r[r.length-1]=t,this.spliceWithArray_(n.length,0,r)}}};function si(e,t,n=`ObservableArray@`+u(),r=!1){return Ii(()=>{let i=new oi(n,t,r);y(i.values_,T,i);let a=new Proxy(i.values_,ai);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var ci={clear(){return this.splice(0)},replace(e){let t=this[T];return t.spliceWithArray_(0,t.values_.length,e)},toJSON(){return this.slice()},splice(e,t,...n){let r=this[T];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(e,t,n){return this[T].spliceWithArray_(e,t,n)},push(...e){let t=this[T];return t.spliceWithArray_(t.values_.length,0,e),t.values_.length},pop(){return this.splice(Math.max(this[T].values_.length-1,0),1)[0]},shift(){return this.splice(0,1)[0]},unshift(...e){let t=this[T];return t.spliceWithArray_(0,0,e),t.values_.length},reverse(){return A.trackingDerivation&&n(37,`reverse`),this.replace(this.slice().reverse()),this},sort(){A.trackingDerivation&&n(37,`sort`);let e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove(e){let t=this[T],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1?(this.splice(n,1),!0):!1}};N(`at`,li),N(`concat`,li),N(`flat`,li),N(`includes`,li),N(`indexOf`,li),N(`join`,li),N(`lastIndexOf`,li),N(`slice`,li),N(`toString`,li),N(`toLocaleString`,li),N(`toSorted`,li),N(`toSpliced`,li),N(`with`,li),N(`every`,ui),N(`filter`,ui),N(`find`,ui),N(`findIndex`,ui),N(`findLast`,ui),N(`findLastIndex`,ui),N(`flatMap`,ui),N(`forEach`,ui),N(`map`,ui),N(`some`,ui),N(`toReversed`,ui),N(`reduce`,di),N(`reduceRight`,di);function N(e,t){typeof Array.prototype[e]==`function`&&(ci[e]=t(e))}function li(e){return function(){let t=this[T];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function ui(e){return function(t,n){let r=this[T];return r.atom_.reportObserved(),r.dehanceValues_(r.values_)[e]((e,r)=>t.call(n,e,r,this))}}function di(e){return function(){let t=this[T];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_),r=arguments[0];return arguments[0]=(e,t,n)=>r(e,t,n,this),n[e].apply(n,arguments)}}let fi=b(`ObservableArrayAdministration`,oi);function pi(e){return h(e)&&fi(e[T])}let mi={},hi=`delete`;var gi=class{constructor(e,t=he,n=`ObservableMap@`+u()){this.enhancer_=void 0,this.name_=void 0,this[T]=mi,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_=n,Ii(()=>{this.keysAtom_=ue(`${this.name_}.keys()`),this.data_=new Map,this.hasMap_=new Map,e&&this.merge(e)})}has_(e){return this.data_.has(e)}has(e){if(!A.trackingDerivation)return this.has_(e);let t=this.hasMap_.get(e);if(!t){let n=t=new kt(this.has_(e),_e,`${this.name_}.${re(e)}?`,!1);this.hasMap_.set(e,n),n.onBUOL=new Set([()=>this.hasMap_.delete(e)])}return t.get()}set(e,t){let n=this.has_(e);if(qr(this)){let r=Yr(this,{type:n?ii:`add`,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this}delete(e){if(Lt(this.keysAtom_),qr(this)&&!Yr(this,{type:hi,object:this,name:e}))return!1;if(this.has_(e)){let t=xn(),n=Xr(this),r=n||t?{observableKind:`map`,debugObjectName:this.name_,type:hi,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return t&&Cn(r),Br(()=>{var t;this.keysAtom_.reportChanged(),(t=this.hasMap_.get(e))==null||t.setNewValue_(!1),this.data_.get(e).setNewValue_(void 0),this.data_.delete(e)}),n&&Qr(this,r),t&&Tn(),!0}return!1}updateValue_(e,t){let n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==A.UNCHANGED){let r=xn(),i=Xr(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:ii,object:this,oldValue:n.value_,name:e,newValue:t}:null;r&&Cn(a),n.setNewValue_(t),i&&Qr(this,a),r&&Tn()}}addValue_(e,t){Lt(this.keysAtom_),Br(()=>{var n;let r=new kt(t,this.enhancer_,`${this.name_}.${re(e)}`,!1);this.data_.set(e,r),t=r.value_,(n=this.hasMap_.get(e))==null||n.setNewValue_(!0),this.keysAtom_.reportChanged()});let n=xn(),r=Xr(this),i=r||n?{observableKind:`map`,debugObjectName:this.name_,type:`add`,object:this,name:e,newValue:t}:null;n&&Cn(i),r&&Qr(this,i),n&&Tn()}get(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)}getOrInsert(e,t){return this.has(e)||this.set(e,t),this.get(e)}getOrInsertComputed(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)}dehanceValue_(e){return this.dehancer===void 0?e:this.dehancer(e)}keys(){return this.keysAtom_.reportObserved(),this.data_.keys()}values(){let e=this,t=this.keys();return vi({next(){let{done:n,value:r}=t.next();return{done:n,value:n?void 0:e.get(r)}}})}entries(){let e=this,t=this.keys();return vi({next(){let{done:n,value:r}=t.next();return{done:n,value:n?void 0:[r,e.get(r)]}}})}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[n,r]of this)e.call(t,r,n,this)}merge(e){return _i(e)&&(e=new Map(e)),Br(()=>{g(e)?te(e).forEach(t=>this.set(t,e[t])):Array.isArray(e)?e.forEach(([e,t])=>this.set(e,t)):ee(e)?(x(e)||n(19,e),e.forEach((e,t)=>this.set(t,e))):e!=null&&n(20,e)}),this}clear(){Br(()=>{Ut(()=>{for(let e of this.keys())this.delete(e)})})}replace(e){return Br(()=>{let t=yi(e),n=new Map,r=!1;for(let e of this.data_.keys())if(!t.has(e))if(this.delete(e))r=!0;else{let t=this.data_.get(e);n.set(e,t)}for(let[e,i]of t.entries()){let t=this.data_.has(e);if(this.set(e,i),this.data_.has(e)){let i=this.data_.get(e);n.set(e,i),t||(r=!0)}}if(!r)if(this.data_.size!==n.size)this.keysAtom_.reportChanged();else{let e=this.data_.keys(),t=n.keys(),r=e.next(),i=t.next();for(;!r.done;){if(r.value!==i.value){this.keysAtom_.reportChanged();break}r=e.next(),i=t.next()}}this.data_=n}),this}get size(){return this.keysAtom_.reportObserved(),this.data_.size}toString(){return`[object ObservableMap]`}toJSON(){return Array.from(this)}get[Symbol.toStringTag](){return`Map`}},_i=b(`ObservableMap`,gi);function vi(e){return e[Symbol.toStringTag]=`MapIterator`,zi(e)}function yi(e){if(ee(e)||_i(e))return e;if(Array.isArray(e))return new Map(e);if(g(e)){let t=new Map;for(let n in e)t.set(n,e[n]);return t}else return n(21,e)}let bi={};var xi=class{constructor(e,t=he,n=`ObservableSet@`+u()){this.name_=void 0,this[T]=bi,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_=n,this.enhancer_=(e,r)=>t(e,r,n),Ii(()=>{this.atom_=ue(this.name_),e&&this.replace(e)})}dehanceValue_(e){return this.dehancer===void 0?e:this.dehancer(e)}clear(){Br(()=>{Ut(()=>{for(let e of this.data_.values())this.delete(e)})})}forEach(e,t){for(let n of this)e.call(t,n,n,this)}get size(){return this.atom_.reportObserved(),this.data_.size}add(e){if(Lt(this.atom_),qr(this)){let t=Yr(this,{type:`add`,object:this,newValue:e});if(!t)return this;e=t.newValue}if(!this.has(e)){Br(()=>{e=this.enhancer_(e,void 0),this.data_.add(e),this.atom_.reportChanged()});let t=xn(),n=Xr(this),r=n||t?{observableKind:`set`,debugObjectName:this.name_,type:`add`,object:this,newValue:e}:null;t&&Cn(r),n&&Qr(this,r),t&&Tn()}return this}delete(e){if(qr(this)&&!Yr(this,{type:hi,object:this,oldValue:e}))return!1;if(this.has(e)){let t=xn(),n=Xr(this),r=n||t?{observableKind:`set`,debugObjectName:this.name_,type:hi,object:this,oldValue:e}:null;return t&&Cn(r),Br(()=>{this.atom_.reportChanged(),this.data_.delete(e)}),n&&Qr(this,r),t&&Tn(),!0}return!1}has(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))}entries(){let e=this.values();return Ci({next(){let{value:t,done:n}=e.next();return n?{value:void 0,done:n}:{value:[t,t],done:n}}})}keys(){return this.values()}values(){this.atom_.reportObserved();let e=this,t=this.data_.values();return Ci({next(){let{value:n,done:r}=t.next();return r?{value:void 0,done:r}:{value:e.dehanceValue_(n),done:r}}})}intersection(e){return new Set(this).intersection(e)}union(e){return new Set(this).union(e)}difference(e){return new Set(this).difference(e)}symmetricDifference(e){return new Set(this).symmetricDifference(e)}isSubsetOf(e){return new Set(this).isSubsetOf(e)}isSupersetOf(e){return new Set(this).isSupersetOf(e)}isDisjointFrom(e){return new Set(this).isDisjointFrom(e)}replace(e){return Si(e)&&(e=new Set(e)),Array.isArray(e)||S(e)?Br(()=>{let t=S(e)?e:new Set(e);if(t.size===0){this.clear();return}if(this.data_.size===0){t.forEach(e=>this.add(e));return}for(let e of this.data_.values())t.has(this.dehanceValue_(e))||this.delete(e);t.forEach(e=>this.add(e))}):e!=null&&n(41,e),this}toJSON(){return Array.from(this)}toString(){return`[object ObservableSet]`}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return`Set`}},Si=b(`ObservableSet`,xi);function Ci(e){return e[Symbol.toStringTag]=`SetIterator`,zi(e)}let wi=Object.create(null),Ti=`remove`;var Ei=class{constructor(e,t=new Map,r,i=Ge){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.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=r,this.defaultAnnotation_=i,this.keysAtom_=new ce(`${this.name_}.keys`),this.isPlainObject_=g(this.target_),Vi(this.defaultAnnotation_)||n(`defaultAnnotation must be valid annotation`),this.appliedAnnotations_={}}getObservablePropValue_(e){return(this.values_.get(e)??this.materializeLazyComputed_(e)??this.materializeLazyObservable_(e)).get()}materializeLazyComputed_(e){let t=this.lazyComputedKeys_?.get(e);if(!t)return;this.lazyComputedKeys_.delete(e),this.lazyComputedKeys_.size===0&&(this.lazyComputedKeys_=void 0);let n=t();return this.values_.set(e,n),n}materializeLazyObservable_(e){let t=this.lazyObservableKeys_?.get(e);if(!t)return;this.lazyObservableKeys_.delete(e),this.lazyObservableKeys_.size===0&&(this.lazyObservableKeys_=void 0);let n=t();return this.values_.set(e,n),n}setObservablePropValue_(e,t){let n=this.values_.get(e)??this.materializeLazyComputed_(e)??this.materializeLazyObservable_(e);if(n instanceof jt)return n.set(t),!0;if(qr(this)){let n=Yr(this,{type:ii,object:this.proxy_||this.target_,name:e,newValue:t});if(!n)return null;t=n.newValue}if(t=n.prepareNewValue_(t),t!==A.UNCHANGED){let r=Xr(this),i=xn(),a=r||i?{type:ii,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;i&&Cn(a),n.setNewValue_(t),r&&Qr(this,a),i&&Tn()}return!0}get_(e){return A.trackingDerivation&&!ae(this.target_,e)&&this.has_(e),this.target_[e]}set_(e,t,n=!1){return 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)}has_(e){if(!A.trackingDerivation)return e in this.target_;this.pendingKeys_||=new Map;let t=this.pendingKeys_.get(e);return t||(t=new kt(e in this.target_,_e,`${this.name_}.${re(e)}?`,!1),this.pendingKeys_.set(e,t)),t.get()}extend_(e,t,n,r=!1){if(n===!0&&(n=this.defaultAnnotation_),n===!1)return this.defineProperty_(e,t,r);Mi(this,n,e);let i=n.extend_(this,e,t,r);return i&&ji(this,n,e),i}defineProperty_(e,t,n=!1){Lt(this.keysAtom_);try{on();let i=this.delete_(e);if(!i)return i;if(qr(this)){let n=Yr(this,{object:this.proxy_||this.target_,name:e,type:`add`,newValue:t.value});if(!n)return null;let{newValue:i}=n;t.value!==i&&(t=r({},t,{value:i}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else a(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{sn()}return!0}defineObservableProperty_(e,t,n,r=!1){Lt(this.keysAtom_);try{on();let i=this.delete_(e);if(!i)return i;if(qr(this)){let n=Yr(this,{object:this.proxy_||this.target_,name:e,type:`add`,newValue:t});if(!n)return null;t=n.newValue}let o=ki(e),s={configurable:A.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else a(this.target_,e,s);let c=new kt(t,n,`${this.name_}.${e.toString()}`,!1);this.values_.set(e,c),this.notifyPropertyAddition_(e,c.value_)}finally{sn()}return!0}defineComputedProperty_(e,t,n=!1){Lt(this.keysAtom_);try{on();let r=this.delete_(e);if(!r)return r;if(qr(this)&&!Yr(this,{object:this.proxy_||this.target_,name:e,type:`add`,newValue:void 0}))return null;t.name||=`${this.name_}.${e.toString()}`,t.context=this.proxy_||this.target_;let i=ki(e),o={configurable:A.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,o))return!1}else a(this.target_,e,o);this.values_.set(e,new jt(t)),this.notifyPropertyAddition_(e,void 0)}finally{sn()}return!0}delete_(e,t=!1){if(Lt(this.keysAtom_),!ae(this.target_,e))return!0;if(qr(this)&&!Yr(this,{object:this.proxy_||this.target_,name:e,type:Ti}))return null;try{var n;on();let r=Xr(this),a=xn(),o=this.values_.get(e),s;if(!o&&(r||a)&&(s=i(this.target_,e)?.value),t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(delete this.appliedAnnotations_[e],o&&(this.values_.delete(e),o instanceof kt&&(s=o.value_),dn(o)),this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r||a){let t={type:Ti,observableKind:`object`,object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:s,name:e};a&&Cn(t),r&&Qr(this,t),a&&Tn()}}finally{sn()}return!0}notifyPropertyAddition_(e,t){var n;let r=Xr(this),i=xn();if(r||i){let n=r||i?{type:`add`,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;i&&Cn(n),r&&Qr(this,n),i&&Tn()}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()}ownKeys_(){return this.keysAtom_.reportObserved(),ne(this.target_)}keys_(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)}};function Di(e,t){if(t&&Ai(e)&&n(`Options can't be provided for already observable objects.`),ae(e,T))return Pi(e)instanceof Ei||n(`Cannot convert '${Fi(e)}' into observable object:\nThe target is already observable of different type.\nExtending builtins is not supported.`),e;Object.isExtensible(e)||n(`Cannot make the designated object observable; it is not extensible`);let r=t?.name??`${g(e)?`ObservableObject`:e.constructor.name}@${u()}`;return v(e,T,new Ei(e,new Map,String(r),ot(t))),e}let Oi=b(`ObservableObjectAdministration`,Ei);function ki(e){return wi[e]||(wi[e]={get(){return this[T].getObservablePropValue_(e)},set(t){return this[T].setObservablePropValue_(e,t)}})}function Ai(e){return h(e)?Oi(e[T]):!1}function ji(e,t,n){e.appliedAnnotations_[n]=t}function Mi(e,t,r){if(Vi(t)||n(`Cannot annotate '${e.name_}.${r.toString()}': Invalid annotation.`),!xe(t)&&ae(e.appliedAnnotations_,r)){let i=`${e.name_}.${r.toString()}`,a=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;n(`Cannot apply '${o}' to '${i}':\nThe field is already annotated with '${a}'.\nRe-annotating fields is not allowed.\nUse 'override' annotation for methods overridden by subclass.`)}}function Ni(e,t){if(typeof e==`object`&&e){if(pi(e))return t!==void 0&&n(23),e[T].atom_;if(Si(e))return e.atom_;if(_i(e)){if(t===void 0)return e.keysAtom_;let r=e.data_.get(t)||e.hasMap_.get(t);return r||n(25,t,Fi(e)),r}if(Ai(e)){if(!t)return n(26);let r=e[T],i=r.values_.get(t)??r.materializeLazyComputed_(t)??r.materializeLazyObservable_(t);return i||n(27,t,Fi(e)),i}if(le(e)||Mt(e)||yn(e))return e}else if(p(e)&&yn(e[T]))return e[T];n(28)}function Pi(e,t){if(e||n(29),t!==void 0)return Pi(Ni(e,t));if(le(e)||Mt(e)||yn(e)||_i(e)||Si(e))return e;if(e[T])return e[T];n(24,e)}function Fi(e,t){let n;if(t!==void 0)n=Ni(e,t);else if(Bn(e))return e.name;else n=Ai(e)||_i(e)||Si(e)?Pi(e):Ni(e);return n.name_}function Ii(e){let t=Wt(),n=Dt(!0);on();try{return e()}finally{sn(),Ot(n),Gt(t)}}let Li=o.toString;function P(e,t,n=-1){return F(e,t,n)}function F(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;let a=typeof e;if(a!==`function`&&a!==`object`&&typeof t!=`object`)return!1;let o=Li.call(e);if(o!==Li.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=I(e),t=I(t);let s=o===`[object Array]`;if(!s){if(typeof e!=`object`||typeof t!=`object`)return!1;let n=e.constructor,r=t.constructor;if(n!==r&&!(p(n)&&n instanceof n&&p(r)&&r instanceof r)&&`constructor`in e&&`constructor`in t)return!1}if(n===0)return!1;n<0&&(n=-1),r||=[],i||=[];let c=r.length;for(;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),s){if(c=e.length,c!==t.length)return!1;for(;c--;)if(!F(e[c],t[c],n-1,r,i))return!1}else{let a=Object.keys(e),o=a.length;if(Object.keys(t).length!==o)return!1;for(let s=0;s<o;s++){let o=a[s];if(!(ae(t,o)&&F(e[o],t[o],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function I(e){return pi(e)?e.slice():ee(e)||_i(e)||S(e)||Si(e)?Array.from(e.entries()):e}let Ri=globalThis.Iterator?.prototype||{};function zi(e){return e[Symbol.iterator]=Bi,r(Object.create(Ri),e)}function Bi(){return this}function Vi(e){return e instanceof Object&&typeof e.annotationType_==`string`&&p(e.make_)&&p(e.extend_)}{let e=globalThis;[`Symbol`,`Map`,`Set`,`Proxy`].forEach(t=>{e[t]===void 0&&n(`MobX requires global '${t}' to be available or polyfilled`)})}typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__==`object`&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:En,extras:{getDebugName:Fi},$mobx:T}),e.$mobx=T,e.FlowCancellationError=ir,e.ObservableMap=gi,e.ObservableSet=xi,e.Reaction=mn,e._allowStateChanges=Et,e._allowStateChangesInsideComputed=zn,e._allowStateReadsEnd=Kt,e._allowStateReadsStart=k,e._autoAction=In,e._autoActionBound=Rn,e._endAction=Tt,e._getAdministration=Pi,e._getGlobalState=$t,e._interceptReads=mr,e._isComputingDerivation=It,e._resetGlobalState=j,e._startAction=wt,e.action=Fn,e.actionBound=Ln,e.autorun=Vn,e.compareDefault=me,e.compareIdentity=de,e.compareShallow=pe,e.compareStructural=fe,e.computed=O,e.computedStruct=_t,e.configure=Xn,e.createAtom=ue,e.defineProperty=jr,e.entries=Er,e.extendObservable=Zn,e.flow=lr,e.flowBound=ur,e.flowResult=fr,e.get=Ar,e.getAtom=Ni,e.getDebugName=Fi,e.getDependencyTree=Qn,e.getObserverTree=er,e.has=kr,e.intercept=hr,e.isAction=Bn,e.isBoxedObservable=At,e.isComputed=yr,e.isComputedProp=br,e.isFlow=pr,e.isFlowCancellationError=ar,e.isObservable=Sr,e.isObservableArray=pi,e.isObservableMap=_i,e.isObservableObject=Ai,e.isObservableProp=Cr,e.isObservableSet=Si,e.keys=wr,e.makeAutoObservable=ti,e.makeObservable=$r,e.observable=D,e.observableDeep=ft,e.observableRef=ut,e.observableShallow=dt,e.observableStruct=pt,e.observe=Nr,e.onBecomeObserved=Kn,e.onBecomeUnobserved=qn,e.onReactionError=hn,e.override=be,e.ownKeys=Mr,e.reaction=Wn,e.remove=Or,e.runInAction=zn,e.set=Dr,e.spy=En,e.toJS=zr,e.transaction=Br,e.untracked=Ut,e.values=Tr,e.when=Vr})),mb=Ee(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=fb():t.exports=pb()}))();function hb(e){if(Array.isArray(e))return Object.freeze(e.map(hb));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]=hb(r);return Object.freeze(t)}return e}function gb(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 _b(e){return typeof e==`string`?e:String(e)}function vb(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 yb(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")`)}var bb=class extends Error{constructor(e,t){super(t),this.variable=e}};function xb(e){return e instanceof bb||e instanceof Error&&e.cause!==void 0&&xb(e.cause)}var Sb=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?jb(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}},Cb=class extends Sb{name=`ParseError`;kind=`ParseError`;expected;found;constructor(e,t,n={}){super(e,t,n),this.expected=n.expected,this.found=n.found}},wb=class extends Sb{name=`EvalError`;kind=`EvalError`},Tb=class extends wb{name=`FuncNotFoundError`;kind=`FuncNotFoundError`;funcName;suggestions;constructor(e,t,n={}){let r=Mb(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}},Eb=class extends wb{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}},Db=class extends wb{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}},Ob=class extends Db{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)}`}},kb=class extends wb{name=`MissingFieldError`;kind=`MissingFieldError`;path;constructor(e,t,n={}){super(`field "${e.join(`.`)}" not found on receiver`,t,n),this.path=e}},Ab=class extends wb{name=`FailError`;kind=`FailError`;constructor(e,t={line:0,column:0,offset:0},n={}){super(e,t,n)}};function jb(e,t){let n=e.split(`
60
+ `))}function Kv(e,t,n,r){let{colors:i}=e.channels[0].severity,{fullText:o,failedConfigFile:s}=t,c=new H({bgcolor:i.bg,color:i.fg}),l=(e,t)=>new G(e,{style:t,end:``,overflow:`ignore`}),u=n>0?[l(`${n} more rows · `,c),o.kind===`file`?l(`open full text`,c.withLink(a(o.path).href)):l(`full text unavailable: ${Q_(o.reason)}`,c)]:[],d=s===null?[]:[l(`${u.length>0?` · `:``}open `,c),l(Q_(s),c.withLink(a(s).href))],f=[l(`↳ `,c),...u,...d.slice(0,-1)],p=f.reduce((e,t)=>e+t.cellLength,0),m=d.slice(-1).map(e=>e.truncate(Math.max(1,r.width-p),{mode:`middle`})),h=G.fromFragments([...f,...m]).truncate(r.width);return h.overflow=`ignore`,jv([h],r)}const qv=e=>!e.startsWith(`.`)&&!e.endsWith(`~`);function Jv(e,t){return t.isSymbolicLink()?Buffer.from(p.readlinkSync(e)):p.readFileSync(e)}function Yv(e,t,n=qv){return p.readdirSync(t).filter(n).sort().flatMap(n=>{let r=s.join(t,n),i=p.lstatSync(r,{throwIfNoEntry:!1});return i===void 0?[]:i.isDirectory()?Yv(e,r):[[s.relative(e,r).split(s.sep).join(`/`),Jv(r,i)]]})}function Xv(e){let t=ue.createHash(`sha256`);for(let[n,r]of e)t.update(n).update(`\0`).update(r).update(`\0`);return t.digest(`hex`)}function Zv(e){return Xv(Yv(e,e))}const Qv=[`Cargo.toml`,`Cargo.lock`,`src`];function $v(e){return Xv(Yv(e,e,e=>Qv.includes(e)))}const ey=e=>e.slice(0,7);function ty(e){let t=s.dirname(s.dirname(e));return p.existsSync(s.join(t,`src`))?t:null}function ny(){let e=ry();if(e===null)throw Error("this bundle carries no source digest (build via `pnpm build`, which stamps it)");return{version:Gt,digest:e}}function ry(){return`5f0576ff4c04be7f95251c28e55573f8976488d43611c44fa9400575e2b13fca`}function iy(e){let t=JSON.parse(p.readFileSync(s.join(e,`package.json`),`utf8`)),n=typeof t==`object`&&t?t.version:void 0;if(typeof n!=`string`)throw Error(`${s.join(e,`package.json`)} has no version string`);return n}function ay(e,t){try{let n=ty(i(e));if(n===null)return{kind:`not-source-checkout`};let r=t(),a=Zv(s.join(n,`src`));return a===r.digest?{kind:`current`,root:n,stamp:r}:{kind:`stale`,root:n,source:{version:iy(n),digest:a},running:r}}catch(e){return{kind:`unchecked`,reason:e.message}}}var J=class extends Error{constructor(e){super(e),this.name=`BadVerbArgs`}};const oy=new Map;function sy(e){let t=ly(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 cy(e,t){return e===`bar`?t:sy(e)}function ly(e){let t=oy.get(e);if(t!==void 0)return t;let n=qc(e);return n===null?null:(oy.set(e,n),n)}function uy(e,t){return dy(e,`${t.hueShift} ${t.chromaScale} ${t.lightnessScale} ${t.lightnessShift}`,()=>al(e,t))}const dy=Zp();function fy(e){let t=ly(e);return t===null?null:{kind:`decided`,name:e,value:t}}function py(e,t,n){let r=fy(e);return r===null?(n(Eh(t,`palette`,`"${e}" names no installed theme${ch(e)}`)),hy()):r}function my(e,t,n){return vh(e,t,n,hy(),fy)}function hy(){return{kind:`decided`,name:lh,value:sy(lh)}}const gy=/^[A-Za-z_][A-Za-z0-9_]*$/;function _y(e){return`#${e+1}`}const vy={rows:{}};function yy(e){return`rows`in e}function by(e){return Object.fromEntries(e.map((e,t)=>[_y(t),e]))}function xy(e){if(e.kind===`container`&&e.direction===`vertical`){let{kind:t,direction:n,children:r,...i}=e;return{...i,rows:by(r)}}let{when:t,...n}=e;return{...t!==void 0&&{when:t},rows:by([n])}}function Sy(e){let{rows:t,...n}=e;return{kind:`container`,direction:`vertical`,children:Object.values(t),...n}}function Cy(e){return yy(e)?Sy(e):e}function*wy(e,t){if(!yy(e)){yield*eg(e,t);return}yield[Sy(e),t];for(let[n,r]of Object.entries(e.rows))yield*eg(r,`${t}.rows.${n}`)}function Ty(e,t){return yy(e)?{...t,...e,rows:{...t.rows,...e.rows}}:xy(e)}function Ey(e){if(!yy(e))return!0;let{rows:t,...n}=e;return Object.values(n).some(e=>e!==void 0)||Object.keys(t).length>0}const Dy=`default`,Oy={};function ky(e){return[...new Set([Dy,...Object.keys(e)])]}function Ay(e,t,n){return hh(void 0,e,t,Dy,n)}function jy(e,t){let n={[Dy]:Oy,...e}[t];if(n===void 0)throw Error(`Preset "${t}" is not declared in this config — effectivePresetName collapses unknown names to "${Dy}", which always resolves; a miss here means a raw name reached this function without going through that resolution`);return n}function My(e,t){let n=jy(e.presets,t).root??vy;return{node:Sy(Ty(n,e.root)),path:Ey(n)?`presets.${t}.root`:`root`}}function Ny(e,t){return{...e.globals,...jy(e.presets,t).globals}}const Py=new Map;function Fy(e,t,n){Py.set(e,{permanent:!0,resolve:t,paletteOf:n})}Fy(`themes`,()=>dh(),e=>sy(e));const Iy=`placementThemes`;Fy(Iy,fh,(e,t)=>cy(e,t.palette));for(let{name:e,members:t}of F_)Fy(e,()=>t);function Ly(e){return new Map([[`styles`,{members:Object.keys(e.styles),paletteOf:(t,n)=>uy(n.basePalette,e.styles[t])}],[`presets`,{members:ky(e.presets)}]])}function Ry(e){return[...new Set([...Py.keys(),...e.keys()])]}function zy(e,t){if(typeof e!=`string`)return{members:e};let n=t.get(e);if(n)return n;let r=Py.get(e);if(r)return{members:r.resolve(),paletteOf:r.paletteOf};throw Error(Vy(e,t))}const By=new Map([[`looks`,`styles`],[`progressions`,`variations`]]);function Vy(e,t){let n=By.get(e);return`unknown option domain "${e}"${n===void 0?``:` — it was renamed "${n}"; write from: "${n}"`} (have: ${Ry(t).join(`, `)})`}const Hy=/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|`[^`]*`/g;function*Uy(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 Wy=`[A-Za-z_]\\w*(?:\\.[A-Za-z_]\\w*)*`,Gy=RegExp(`^(?:(\\$)(?:\\.(${Wy}))?|\\.(${Wy})?)(?=[\\s)]|$)`);function Ky(e,t,n){let r=Gy.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 qy=/^(\w+)\b\s*([\s\S]*)$/;function*Jy(e,t){let n=[t];for(let r of Uy(e)){let e=r.replace(/^-(?=\s)/,``).trim(),[,i=``,a=``]=qy.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:Ky(r[1],s,t);continue}yield{code:e,dot:o},i===`if`&&n.push(o),i===`with`&&n.push(Ky(a,o,t)),(i===`range`||i===`define`||i===`block`)&&n.push(null)}}const Yy=/(?<![.$])\btemplate\s+$/;function*Xy(e,t,n){let r=0;for(let i of[...e.matchAll(Hy)]){let a=i.index+i[0].length;Yy.test(e.slice(r,i.index))&&(yield{name:i[0].slice(1,-1),at:Ky(e.slice(a),t,n)}),r=a}}function*Zy(e,t){let n=new Set;function*r(e,i,a,o){for(let{code:s,dot:c}of[...Jy(e,i)]){yield{code:s,dot:c,root:i,via:a};for(let e of[...Xy(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 Qy=RegExp(`(?<![A-Za-z0-9_)$])(\\$?)\\.(${Wy})`,`g`);function*$y({code:e,dot:t,root:n}){let r=e.replace(Hy,``);for(let e of[...r.matchAll(Qy)]){let r=e[1]===`$`?n:t;r!==null&&(yield`${r}${e[2]}`)}}function eb(e,t){let n=new Map;for(let r of Zy(e,t))for(let e of $y(r))n.has(e)||n.set(e,r.via);return n}const tb=/(?<![.$])\b(action|picker|menu|carousel|swatches|swatch|themePreview)\s+$/,nb={action:1,picker:2,menu:1,carousel:2,swatch:1,swatches:2,themePreview:1};function*rb(e){let t=0,n=0,r=0,i=`action`;for(let a of[...e.matchAll(Hy)]){let o=e.slice(t,a.index),s=tb.exec(o);if(s!==null)n=nb[s[1]],r=0,i=s[1]===`action`?`action`:`options`;else for(let e of o)e===`(`&&r++,e===`)`&&r--,(r<0||e===`|`&&r===0)&&(n=0);n>0&&r===0&&(yield{name:a[0].slice(1,-1),site:i},n--),t=a.index+a[0].length}}function ib(e,t){let n=new Map;for(let{code:r,via:i}of Zy(e,t))for(let{name:e,site:t}of rb(r)){let r=`${e}\0${i??`\0`}`;n.has(r)||n.set(r,{name:e,site:t,via:i})}return[...n.values()]}function ab(e,t){return new Set([...ob(e,t)].filter(e=>Object.hasOwn(t,e)))}function ob(e,t){let n=new Set;for(let{code:r,dot:i,root:a}of Zy(e,t))for(let{name:e}of Xy(r,i,a))n.add(e);return n}function sb(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 cb(e){let t=new Set,n=new Set,r=(e,r)=>{t.add(e),lb(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 lb(e){return e.kind===`dropped`||(e.kind===`shell`||e.kind===`file`)&&ng(e.parse)===`json`}function ub(e){let t=s.basename(e),n=s.dirname(e);for(;;){let r=db(n);if(r!==null)return{dir:r,name:t,leaf:n===s.dirname(e)};t=s.basename(n),n=s.dirname(n)}}function db(e){try{return p.statSync(e).isDirectory()?p.realpathSync(e):null}catch{return null}}var fb=Ee((e=>{function t(e,...t){throw Error(`[MobX] minified error nr: ${e}${t.length?` `+t.map(String).join(`,`):``}. See mobx.js.org/errors`)}function n(e){let t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}function r(e){return typeof e==`function`}function i(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function a(e){return typeof e==`object`&&!!e}function o(e){if(!a(e))return!1;let t=Object.getPrototypeOf(e);if(t==null)return!0;let n=p(t,`constructor`)&&t.constructor;return typeof n==`function`&&n.toString()===Ht}function s(e){let t=e?.constructor;return!!t&&(t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`)}function c(e,t,n){Rt(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function l(e,t){let n=`isMobX`+e;return t.prototype[n]=!0,function(e){return a(e)&&!0===e[n]}}function u(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function d(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}function f(e){return e===null?null:typeof e==`object`?``+e:e}function p(e,t){return zt.hasOwnProperty.call(e,t)}function m(e,t){return!!(e&t)}function h(e,t,n){return n?e|=t:e&=~t,e}function g(e,t=Ut,n=Ut){let r=new Kt(e);return t!==Ut&&(r.onBOL=new Set([t])),n!==Ut&&(r.onBUOL=new Set([n])),r}function _(e,t){return jt(e,t)}function v(e,t,n){return e===null||typeof e!=`object`&&typeof e!=`function`||nt(e)?e:Array.isArray(e)?cn.array(e,{name:n}):o(e)?cn.object(e,void 0,{name:n}):u(e)?cn.map(e,{name:n}):d(e)?cn.set(e,{name:n}):typeof e!=`function`||Ge(e)||$e(e)?e:s(e)?Kn(e):Rn(n,e)}function y(e){return e}function b(e,t){return{t:e,i:t,o:ee,u:x}}function ee(e,t,n,r){var i;return(i=this.i)!=null&&i.bound?this.u(e,t,n,!1)===null?0:1:r===e.h?this.u(e,t,n,!1)===null?0:2:Ge(n.value)?1:(Rt(r,t,te(e,this,t,n,!1)),2)}function x(e,t,n,r){let i=te(e,this,t,n);return e.l(t,i,r)}function S(e,n,r){let{kind:i,name:a,addInitializer:o}=r,s=e,c=e=>{var t;return be(s.i?.name??a.toString(),e,(t=s.i?.autoAction)!=null&&t)};return i==`field`?function(e){var t;let n=e;return Ge(n)||(n=c(n)),(t=s.i)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n}:i==`method`?(Ge(n)||(n=c(n)),(l=s.i)!=null&&l.bound&&o(function(){let e=this,t=e[a].bind(e);t.isMobxAction=!0,e[a]=t}),n):void t(43,s.t,String(a),i);var l}function te(e,t,n,r,i=M.safeDescriptors){var a,o,s;let{value:c}=r;return(a=t.i)!=null&&a.bound&&(c=c.bind(e.v??e.h)),{value:be(t.i?.name??n.toString(),c,(o=t.i?.autoAction)!=null&&o,(s=t.i)!=null&&s.bound?e.v??e.h:void 0),configurable:!i||e.p,enumerable:!1,writable:!i}}function ne(e,t){return{t:e,i:t,o:re,u:ie}}function re(e,t,n,r){var i;return r===e.h?this.u(e,t,n,!1)===null?0:2:(i=this.i)!=null&&i.bound&&(!p(e.h,t)||!$e(e.h[t]))&&this.u(e,t,n,!1)===null?0:$e(n.value)?1:(Rt(r,t,oe(e,0,0,n,!1,!1)),2)}function ie(e,t,n,r){let i=oe(e,0,0,n,this.i?.bound);return e.l(t,i,r)}function ae(e,t,n){var r;let{name:i,addInitializer:a}=n;return $e(t)||(t=Kn(t)),(r=e.i)!=null&&r.bound&&a(function(){let e=this,t=e[i].bind(e);t.isMobXFlow=!0,e[i]=t}),t}function oe(e,t,n,r,i,a=M.safeDescriptors){let{value:o}=r;return $e(o)||(o=Kn(o)),i&&(o=o.bind(e.v??e.h),o.isMobXFlow=!0),{value:o,configurable:!a||e.p,enumerable:!1,writable:!a}}function C(e,t){return{t:e,i:t,o:w,u:se}}function w(e,t,n){return this.u(e,t,n,!1)===null?0:1}function se(e,t,n,r){return e.m(t,It({},this.i,{get:n.get,set:n.set}),r)}function T(e,t,n){function r(e){let n=It({},i.i,{get:t,context:e});return n.name||=`ObservableObject.${a.toString()}`,new bn(n)}let i=e,{name:a,addInitializer:o}=n,s;return o(function(){let e=wt(this)[k],n=this,i=e.j.get(a);i instanceof bn&&i.derivation!==t&&e.j.delete(a),(e.O??=new Map).set(a,()=>r(n))}),function(){let e=this[k],n=e.j.get(a);if(n instanceof bn&&n.derivation!==t){let e=s?.get(this);return e||(e=r(this),(s??=new WeakMap).set(this,e)),e.get()}return e._(a)}}function ce(e,t){return{t:e,i:t,o:le,u:ue}}function le(e,t,n){return this.u(e,t,n,!1)===null?0:1}function ue(e,t,n,r){return e.S(t,n.value,this.i?.A??v,r)}function de(e,t,n){function r(e,t){let n=wt(e)[k];return(n.V??=new Map).set(o,()=>new vn(t,i.i?.A??v,`ObservableObject.${o.toString()}`,!1)),n}let i=e,{kind:a,name:o}=n;if(a===`accessor`)return{get(){return(this[k]??r(this,t.get.call(this)))._(o)},set(e){return(this[k]??r(this,e)).M(o,e)},init(e){return r(this,e),e}}}function fe(e){return{t:Xt,i:e,o:pe,u:me}}function pe(e,t,n,r){var i,a,o;if(n.get)return fn.o(e,t,n,r);if(n.set){let i=Ge(n.set)?n.set:be(t.toString(),n.set);return r===e.h?e.l(t,{configurable:!M.safeDescriptors||e.p,set:i})===null?0:2:(Rt(r,t,{configurable:!0,set:i}),2)}if(r!==e.h&&typeof n.value==`function`)return s(n.value)?((o=this.i)!=null&&o.autoBind?qn:Kn).o(e,t,n,r):((a=this.i)!=null&&a.autoBind?Bn:Rn).o(e,t,n,r);let c=!1===this.i?.deep?rn:cn;return typeof n.value==`function`&&(i=this.i)!=null&&i.autoBind&&(n.value=n.value.bind(e.v??e.h)),c.o(e,t,n,r)}function me(e,t,n,r){var i;return n.get?fn.u(e,t,n,r):n.set?e.l(t,{configurable:!M.safeDescriptors||e.p,set:be(t.toString(),n.set)},r):(typeof n.value==`function`&&(i=this.i)!=null&&i.autoBind&&(n.value=n.value.bind(e.v??e.h)),(!1===this.i?.deep?rn:cn).u(e,t,n,r))}function he(e,t){return It(function(n,r){if(r&&typeof r.kind==`string`)return t(e,n,r)},e)}function ge(e){return e||Qt}function _e(e){return he(e,de)}function ve(e){return!0===e.deep?v:!1===e.deep?y:(t=e.defaultDecorator)&&(n=(r=t.i)?.A)!=null?n:v;var t,n,r}function ye(e){return he(e,T)}function be(e,t,n=!1,r){function i(){return xe(0,n,t,r||this,arguments)}return i.isMobxAction=!0,i.toString=()=>t.toString(),gn&&(_n.value=e,Rt(i,`name`,_n)),i}function xe(e,t,n,r,i){let a=Se(0,t);try{return n.apply(r,i)}catch(e){throw a.N=e,e}finally{Ce(a)}}function Se(e,t){let n=M.trackingDerivation,r=!t||!n;Fe();let i=M.allowStateChanges;r&&ke();let a={R:r,k:n,C:i,I:M.allowStateReads,P:!1,T:0,B:hn++,D:mn};return mn=a.B,a}function Ce(e){mn!==e.B&&t(30),mn=e.D,e.N!==void 0&&(M.suppressReactionErrors=!0),Ie(),e.R&&Ae(e.k),M.suppressReactionErrors=!1}function we(e,t){let n=function(e){let t=M.allowStateChanges;return M.allowStateChanges=e,t}(e);try{return t()}finally{(function(e){M.allowStateChanges=e})(n)}}function Te(e){return e instanceof Sn}function Ee(e){switch(e.K){case 0:return!1;case-1:case 2:return!0;case 1:{let t=ke(),n=e.L,r=n.length;for(let i=0;i<r;i++){let r=n[i];if(xn(r)){if(M.disableErrorBoundaries)r.get();else try{r.get()}catch{return Ae(t),!0}if(e.K===2)return Ae(t),!0}}return je(e),Ae(t),!1}}}function De(e,t,n){je(e),e.$=Array(e.U===0?100:e.L.length),e.W=0,e.U=++M.runId;let r=M.trackingDerivation,i;if(M.trackingDerivation=e,M.inBatch++,!0===M.disableErrorBoundaries)i=t.call(n);else try{i=t.call(n)}catch(e){i=new Sn(e)}return M.inBatch--,M.trackingDerivation=r,function(e){let t=e.L,n=e.L=e.$,r=0,i=0,a=e.W;for(let e=0;e<a;e++){let t=n[e];t.diffValue===0&&(t.diffValue=1,i!==e&&(n[i]=t),i++),t.K>r&&(r=t.K)}for(n.length=i,e.$=null,a=t.length;a--;){let n=t[a];n.diffValue===0&&Ne(n,e),n.diffValue=0}for(;i--;){let t=n[i];t.diffValue===1&&(t.diffValue=0,Me(t,e))}r!==0&&(e.K=r,e.q())}(e),i}function Oe(e){let t=e.L;e.L=[];let n=t.length;for(;n--;)Ne(t[n],e);e.K=-1}function E(e){let t=ke();try{return e()}finally{Ae(t)}}function ke(){let e=M.trackingDerivation;return M.trackingDerivation=null,e}function Ae(e){M.trackingDerivation=e}function je(e){if(e.K===0)return;e.K=0;let t=e.L,n=t.length;for(;n--;)t[n].F=0}function Me(e,t){(e.H??=new Set).add(t),e.F>t.K&&(e.F=t.K)}function Ne(e,t){let n=e.H;n&&(n.delete(t),n.size===0&&Pe(e))}function Pe(e){!1===e.isPendingUnobservation&&(e.isPendingUnobservation=!0,M.pendingUnobservations.push(e))}function Fe(){M.inBatch++}function Ie(){--M.inBatch===0&&(Be(),!M.isRunningUnobservations&&M.pendingUnobservations.length>0&&function(){M.isRunningUnobservations=!0;try{let e=M.pendingUnobservations;for(let t=0;t<e.length;t++){let n=e[t];n.isPendingUnobservation=!1,n.H&&n.H.size!==0||(n.H=null,n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof bn&&n.G())}M.pendingUnobservations=[]}finally{M.isRunningUnobservations=!1}}())}function Le(e){var t;e.isBeingObserved||(e.isBeingObserved=!0,e.onBO(),(t=e.L)==null||t.forEach(Le))}function Re(e){let t=M.trackingDerivation;return t===null?((!e.H||e.H.size===0)&&M.inBatch>0&&Pe(e),!1):(t.U!==e.J&&(e.J=t.U,t.$[t.W++]=e,!e.isBeingObserved&&M.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function ze(e){var t;e.F!==2&&(e.F=2,(t=e.H)==null||t.forEach(e=>{e.K===0&&e.q(),e.K=2}))}function Be(){M.inBatch>0||M.isRunningReactions||kn(Ve)}function Ve(){M.isRunningReactions=!0;let e=M.pendingReactions,t=0;for(;e.length>0;){++t===On&&(console.error(`[mobx] cycle in reaction: ${e[0]}`),e.splice(0));let n=e.splice(0);for(let e=0,t=n.length;e<t;e++)n[e].X()}M.isRunningReactions=!1}function He(e){return he(e,S)}function Ue(e){return function(t,n){return n&&typeof n.kind==`string`?S(e?Fn:Nn,t,n):r(t)?be(t.name||`<unnamed action>`,t,e):r(n)?be(t,n,e):i(t)?He(b(e?Mn:jn,{name:t,autoAction:e})):void 0}}function We(e){return xe(0,!1,e,this,void 0)}function Ge(e){return r(e)&&!0===e.isMobxAction}function Ke(e,t=Vt){function n(){e(a)}var r;let i=t?.name??`Autorun`,a;if(t.scheduler||t.delay){let e=qe(t),r=!1;a=new Dn(i,()=>{r||(r=!0,e(()=>{r=!1,a.isDisposed||a.track(n)}))},t.onError,t.requiresObservable)}else a=new Dn(i,function(){this.track(n)},t.onError,t.requiresObservable);return t!=null&&(r=t.signal)!=null&&r.aborted||a.Y(),a.Z(t?.signal)}function qe(e){return e.scheduler?e.scheduler:e.delay?t=>setTimeout(t,e.delay):Vn}function Je(e,t,n,i){let a=typeof i==`function`?Dt(t,n):Dt(t),o=r(i)?i:n,s=`${e}L`;return a[s]?a[s].add(o):a[s]=new Set([o]),function(){let e=a[s];e&&(e.delete(o),e.size===0&&delete a[s])}}function Ye(e,t,n,r){let i=Gt(t);return At(()=>{let t=wt(e,r)[k];Wt(i).forEach(e=>{t.u(e,i[e],!n||!(e in n)||n[e])})}),e}function Xe(e){let t={name:e.tt};var n;return e.L&&e.L.length>0&&(t.dependencies=(n=e.L,Array.from(new Set(n))).map(Xe)),t}function Ze(e){let t={name:e.tt};return function(e){return!!e.H&&e.H.size>0}(e)&&(t.observers=Array.from(function(e){return e.H??new Set}(e),Ze)),t}function Qe(e){r(e.cancel)&&e.cancel()}function $e(e){return!0===e?.isMobXFlow}function et(e,t){var n;if(t===void 0)return xn(e);if(!1===Et(e))return!1;let r=e[k];return(n=r.O)!=null&&n.has(t)?!0:r.j.has(t)?xn(Dt(e,t)):!1}function tt(e,t){if(!e)return!1;if(t!==void 0){if(Et(e)){var n,r;let i=e[k];return i.j.has(t)||!((n=i.O)==null||!n.has(t))||!((r=i.V)==null||!r.has(t))}return!1}return Et(e)||!!e[k]||qt(e)||An(e)||xn(e)}function nt(e){return tt(e)}function rt(e){return Et(e)?e[k].nt():ar(e)||cr(e)?Array.from(e.keys()):xt(e)?e.map((e,t)=>t):void t(5)}function it(e,n){return Et(e)?e[k].et(n):ar(e)||cr(e)?e.has(n):xt(e)?n>=0&&n<e.length:void t(10)}function at(e){if(Et(e))return e[k].it();t(38)}function ot(e,t,n){if(xn(e)){let r,i=!0;return Ke(()=>{let a=e.get();if(!i||n){let n=ke();t({observableKind:`computed`,debugObjectName:e.tt,type:Zn,object:e,newValue:a,oldValue:r}),Ae(n)}i=!1,r=a})}return n&&t({observableKind:`value`,debugObjectName:e.tt,object:e,type:Zn,newValue:e.rt,oldValue:void 0}),ht(e,t)}function st(e,t,n){return e.set(t,n),n}function ct(e,t){if(typeof e!=`object`||!e||e instanceof Date||!nt(e))return e;if(yn(e)||xn(e))return ct(e.get(),t);if(t.has(e))return t.get(e);if(xt(e)){let n=st(t,e,Array(e.length));return e.forEach((e,r)=>{n[r]=ct(e,t)}),n}if(cr(e)){let n=st(t,e,new Set);return e.forEach(e=>{n.add(ct(e,t))}),n}if(ar(e)){let n=st(t,e,new Map);return e.forEach((e,r)=>{n.set(r,ct(e,t))}),n}{let n=st(t,e,{});return at(e).forEach(r=>{zt.propertyIsEnumerable.call(e,r)&&(n[r]=ct(e[r],t))}),n}}function lt(e,t){Fe();try{return e.apply(t)}finally{Ie()}}function ut(e,t,n){let r;if(typeof n.timeout==`number`){let e=Error(`WHEN_TIMEOUT`);r=setTimeout(()=>{if(!a[k].isDisposed){if(a(),!n.onError)throw e;n.onError(e)}},n.timeout)}n.name=`When`;let i=be(`When-effect`,t);var a=Ke(t=>{we(!1,e)&&(t.dispose(),r&&clearTimeout(r),i())},n);return a}function dt(e){return e[k]}function ft(e){return e.st!==void 0&&e.st.length>0}function pt(e,t){let r=e.st;return r?r.push(t):r=e.st=[t],n(()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)})}function D(e,n){let r=ke();try{let r=[...e.st||[]];for(let e=0,i=r.length;e<i&&((n=r[e](n))&&!n.type&&t(14),n);e++);return n}finally{Ae(r)}}function mt(e){return e.ot!==void 0&&e.ot.length>0}function ht(e,t){let r=e.ot;return r?r.push(t):r=e.ot=[t],n(()=>{let e=r.indexOf(t);e!==-1&&r.splice(e,1)})}function gt(e,t){let n=ke(),r=e.ot;if(r){r=r.slice();for(let e=0,n=r.length;e<n;e++)r[e](t);Ae(n)}}function _t(e,n,r){if(!0===r&&(r=e.ut),!1===r)return;n in e.h||t(1,r.t,`${e.tt}.${n.toString()}`);let i=e.h;for(;i&&i!==zt;){let t=Lt(i,n);if(t){let a=r.o(e,n,t,i);if(a===0)return;if(a===1)break}i=Object.getPrototypeOf(i)}}function O(e,t){typeof Array.prototype[e]==`function`&&(er[e]=t(e))}function vt(e){return function(){let t=this[k];t.ct.reportObserved();let n=t.ht(t.j);return n[e].apply(n,arguments)}}function yt(e){return function(t,n){let r=this[k];return r.ct.reportObserved(),r.ht(r.j)[e]((e,r)=>t.call(n,e,r,this))}}function bt(e){return function(){let t=this[k];t.ct.reportObserved();let n=t.ht(t.j),r=arguments[0];return arguments[0]=(e,t,n)=>r(e,t,n,this),n[e].apply(n,arguments)}}function xt(e){return a(e)&&tr(e[k])}function St(e){return e[Symbol.toStringTag]=`MapIterator`,Pt(e)}function Ct(e){return e[Symbol.toStringTag]=`SetIterator`,Pt(e)}function wt(e,t){if(p(e,k))return e;let n=t?.name??`ObservableObject`;return c(e,k,new dr(e,new Map,String(n),function(e){return e?e.defaultDecorator??function(e){let t=!1!==e.deep,n=!!e.autoBind,r=!t|(n?2:0);return A[r]??(A[r]=fe({deep:t,autoBind:n}))}(e):void 0}(t))),e}function Tt(e){return lr[e]||(lr[e]={get(){return this[k]._(e)},set(t){return this[k].M(e,t)}})}function Et(e){return!!a(e)&&fr(e[k])}function Dt(e,n){if(typeof e==`object`&&e){if(xt(e))return n!==void 0&&t(23),e[k].ct;if(cr(e))return e.ct;if(ar(e)){if(n===void 0)return e.lt;let r=e.ft.get(n)||e.dt.get(n);return r||t(25,n,kt(e)),r}if(Et(e)){if(!n)return t(26);let r=e[k],i=r.j.get(n)??r.vt(n)??r.bt(n);return i||t(27,n,kt(e)),i}if(qt(e)||xn(e)||An(e))return e}else if(r(e)&&An(e[k]))return e[k];t(28)}function Ot(e,n){return e||t(29),n===void 0?qt(e)||xn(e)||An(e)||ar(e)||cr(e)?e:e[k]?e[k]:void t(24,e):Ot(Dt(e,n))}function kt(e,t){let n;if(t!==void 0)n=Dt(e,t);else{if(Ge(e))return e.name;n=Et(e)||ar(e)||cr(e)?Ot(e):Dt(e)}return n.tt}function At(e){let t=ke();Fe();try{return e()}finally{Ie(),Ae(t)}}function jt(e,t,n=-1){return Mt(e,t,n)}function Mt(e,t,n,i,a){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return!1;if(e!=e)return t!=t;let o=typeof e;if(o!==`function`&&o!==`object`&&typeof t!=`object`)return!1;let s=pr.call(e);if(s!==pr.call(t))return!1;switch(s){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++}e=Nt(e),t=Nt(t);let c=s===`[object Array]`;if(!c){if(typeof e!=`object`||typeof t!=`object`)return!1;let n=e.constructor,i=t.constructor;if(n!==i&&!(r(n)&&n instanceof n&&r(i)&&i instanceof i)&&`constructor`in e&&`constructor`in t)return!1}if(n===0)return!1;n<0&&(n=-1),a||=[];let l=(i||=[]).length;for(;l--;)if(i[l]===e)return a[l]===t;if(i.push(e),a.push(t),c){if(l=e.length,l!==t.length)return!1;for(;l--;)if(!Mt(e[l],t[l],n-1,i,a))return!1}else{let r=Object.keys(e),o=r.length;if(Object.keys(t).length!==o)return!1;for(let s=0;s<o;s++){let o=r[s];if(!p(t,o)||!Mt(e[o],t[o],n-1,i,a))return!1}}return i.pop(),a.pop(),!0}function Nt(e){return xt(e)?e.slice():u(e)||ar(e)||d(e)||cr(e)?Array.from(e.entries()):e}function Pt(e){return e[Symbol.iterator]=Ft,It(Object.create(mr),e)}function Ft(){return this}Object.defineProperty(e,`__esModule`,{value:!0});let It=Object.assign,Lt=Object.getOwnPropertyDescriptor,Rt=Object.defineProperty,zt=Object.prototype,Bt=[];Object.freeze(Bt);let Vt={};Object.freeze(Vt);let Ht=Object.toString(),Ut=()=>{},Wt=Reflect.ownKeys,Gt=Object.getOwnPropertyDescriptors,k=Symbol(`mobx administration`);var Kt=class{constructor(e=`Atom`){this.tt=void 0,this.yt=0,this.H=null,this.J=0,this.F=-1,this.onBOL=void 0,this.onBUOL=void 0,this.tt=e}get isBeingObserved(){return m(this.yt,1)}set isBeingObserved(e){this.yt=h(this.yt,1,e)}get isPendingUnobservation(){return m(this.yt,2)}set isPendingUnobservation(e){this.yt=h(this.yt,2,e)}get diffValue(){return+!!m(this.yt,4)}set diffValue(e){this.yt=h(this.yt,4,e===1)}onBO(){this.onBOL&&this.onBOL.forEach(e=>e())}onBUO(){this.onBUOL&&this.onBUOL.forEach(e=>e())}reportObserved(){return Re(this)}reportChanged(){Fe(),ze(this),Ie()}toString(){return this.tt}};let qt=l(`Atom`,Kt),Jt=Object.is,Yt={t:`override`,o:function(){return 0},u:function(){t(44,this.t)}},Xt=`true`,Zt=fe(),A=[Zt],Qt={deep:!0,name:void 0,defaultDecorator:void 0};Object.freeze(Qt);let $t=ce(`observable`),j=ce(`observable.ref`,{A:y}),en=ce(`observable.shallow`,{A:function(e,t,n){return e==null||Et(e)||xt(e)||ar(e)||cr(e)?e:Array.isArray(e)?cn.array(e,{name:n,deep:!1}):o(e)?cn.object(e,void 0,{name:n,deep:!1}):u(e)?cn.map(e,{name:n,deep:!1}):d(e)?cn.set(e,{name:n,deep:!1}):void 0}}),tn=ce(`observable.struct`,{A:function(e,t){return jt(e,t)?t:e}}),nn={box(e,t){let n=ge(t);return new vn(e,ve(n),n.name,!0,n.equals)},array(e,t){let n=ge(t);return function(e,t,n=`ObservableArray`,r=!1){return At(()=>{let i=new $n(n,t,r);Rt(i.j,k,{enumerable:!1,writable:!1,configurable:!0,value:i});let a=new Proxy(i.j,Qn);return i.v=a,e&&e.length&&i.wt(0,0,e),a})}(e,ve(n),n.name)},map(e,t){let n=ge(t);return new ir(e,ve(n),n.name)},set(e,t){let n=ge(t);return new sr(e,ve(n),n.name)},object:(e,t,n)=>At(()=>Ye(function(e,t){var n;return(n=(e=wt(e,t))[k]).v??(n.v=new Proxy(e,Jn))}({},n),e,t))},rn=_e(j),an=_e(en),on=_e($t),sn=_e(tn);var cn=It(function(e,t,n){return t&&typeof t.kind==`string`?de($t,e,t):nt(e)?e:o(e)?cn.object(e,t,n):Array.isArray(e)?cn.array(e,t):u(e)?cn.map(e,t):d(e)?cn.set(e,t):typeof e==`object`&&e?e:cn.box(e,t)},$t,nn);let ln=`computed`,un=C(ln),dn=ye(C(`computed.struct`,{equals:_})),fn=function(e,t){if(t&&typeof t.kind==`string`)return T(un,e,t);if(o(e))return ye(C(ln,e));let n=o(t)?t:{};return n.get=e,n.name||=e.name||``,new bn(n)};var pn;It(fn,un);let mn=0,hn=1,gn=(pn=Lt(()=>{},`name`)?.configurable)!=null&&pn,_n={value:`action`,configurable:!0,writable:!1,enumerable:!1};var vn=class extends Kt{constructor(e,t,n=`ObservableValue`,r=!0,i=Jt){super(n),this.A=void 0,this.tt=void 0,this.xt=void 0,this.gt=!1,this.st=void 0,this.ot=void 0,this.rt=void 0,this.dehancer=void 0,this.A=t,this.tt=n,this.xt=i,this.rt=t(e,void 0,n)}dehanceValue(e){return this.dehancer===void 0?e:this.dehancer(e)}set(e){(e=this.jt(e))!==M.UNCHANGED&&this.Ot(e)}jt(e){if(ft(this)){let t=D(this,{object:this,type:Zn,newValue:e});if(!t)return M.UNCHANGED;e=t.newValue}return e=this.A(e,this.rt,this.tt),this.xt(this.rt,e)?M.UNCHANGED:e}Ot(e){let t=this.rt;this.rt=e,this.reportChanged(),mt(this)&&gt(this,{type:Zn,object:this,newValue:e,oldValue:t})}get(){return this.reportObserved(),this.dehanceValue(this.rt)}raw(){return this.rt}toJSON(){return this.get()}toString(){return`${this.tt}[${this.rt}]`}valueOf(){return f(this.get())}[Symbol.toPrimitive](){return this.valueOf()}};let yn=l(`ObservableValue`,vn);var bn=class{constructor(e){this.K=-1,this.L=[],this.$=null,this.H=null,this.U=0,this.J=0,this.F=0,this.W=0,this.rt=new Sn(null),this.tt=void 0,this._t=void 0,this.yt=0,this.derivation=void 0,this.St=void 0,this.At=void 0,this.xt=void 0,this.Vt=void 0,this.Mt=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.St=be(`ComputedValue-setter`,e.set)),this.xt=e.equals||Jt,this.At=e.context,this.Vt=e.requiresReaction,this.Mt=!!e.keepAlive}q(){(function(e){var t;e.F===0&&(e.F=1,(t=e.H)==null||t.forEach(e=>{e.K===0&&(e.K=1,e.q())}))})(this)}onBO(){this.onBOL&&this.onBOL.forEach(e=>e())}onBUO(){this.onBUOL&&this.onBUOL.forEach(e=>e())}get isComputing(){return m(this.yt,1)}set isComputing(e){this.yt=h(this.yt,1,e)}get isRunningSetter(){return m(this.yt,2)}set isRunningSetter(e){this.yt=h(this.yt,2,e)}get isBeingObserved(){return m(this.yt,4)}set isBeingObserved(e){this.yt=h(this.yt,4,e)}get isPendingUnobservation(){return m(this.yt,8)}set isPendingUnobservation(e){this.yt=h(this.yt,8,e)}get diffValue(){return+!!m(this.yt,16)}set diffValue(e){this.yt=h(this.yt,16,e===1)}get(){if(this.isComputing&&t(32,this.tt,this.derivation),M.inBatch!==0||this.H&&this.H.size!==0||this.Mt){let e=this.isBeingObserved;if(Re(this),Ee(this)){let e=M.trackingContext;e||!this.Mt&&!this.isBeingObserved||(M.trackingContext=this),this.trackAndCompute()&&function(e){var t;e.F!==2&&(e.F=2,(t=e.H)==null||t.forEach(t=>{t.K===1?t.K=2:t.K===0&&(e.F=0)}))}(this),M.trackingContext=e}else !e&&this.isBeingObserved&&this.L.forEach(Le)}else Ee(this)&&(this.Nt(),Fe(),this.rt=this.Rt(!1),Ie());let e=this.rt;if(Te(e))throw e.cause;return e}set(e){if(this.St){this.isRunningSetter&&t(33,this.tt),this.isRunningSetter=!0;try{this.St.call(this.At,e)}finally{this.isRunningSetter=!1}}else t(34,this.tt)}trackAndCompute(){let e=this.rt,t=this.K===-1,n=this.Rt(!0),r=t||Te(e)||Te(n)||!this.xt(e,n);return r&&(this.rt=n),r}Rt(e){let t;if(this.isComputing=!0,e)t=De(this,this.derivation,this.At);else if(!0===M.disableErrorBoundaries)t=this.derivation.call(this.At);else try{t=this.derivation.call(this.At)}catch(e){t=new Sn(e)}return this.isComputing=!1,t}G(){this.Mt||(Oe(this),this.rt=void 0)}Nt(){}toString(){return`${this.tt}[${this.derivation.toString()}]`}valueOf(){return f(this.get())}[Symbol.toPrimitive](){return this.valueOf()}};let xn=l(`ComputedValue`,bn);var Sn=class{constructor(e){this.cause=void 0,this.cause=e}};let Cn=[`mobxGuid`,`spyListeners`,`enforceActions`,`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`allowStateReads`,`disableErrorBoundaries`,`runId`,`UNCHANGED`];var wn=class{constructor(){this.version=7,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.isRunningUnobservations=!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.safeDescriptors=!0}};let Tn=!0,En=!1,M=function(){let e=globalThis;return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Tn=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==7&&(Tn=!1),Tn?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new wn):(setTimeout(()=>{En||t(35)},1),new wn)}();var Dn=class{constructor(e=`Reaction`,t,n,r){this.tt=void 0,this.Et=void 0,this.kt=void 0,this.Ct=void 0,this.L=[],this.$=[],this.K=-1,this.U=0,this.W=0,this.yt=0,this.It=void 0,this.tt=e,this.Et=t,this.kt=n,this.Ct=r}get isDisposed(){return m(this.yt,1)}set isDisposed(e){this.yt=h(this.yt,1,e)}get isScheduled(){return m(this.yt,2)}set isScheduled(e){this.yt=h(this.yt,2,e)}get isTrackPending(){return m(this.yt,4)}set isTrackPending(e){this.yt=h(this.yt,4,e)}get isRunning(){return m(this.yt,8)}set isRunning(e){this.yt=h(this.yt,8,e)}get diffValue(){return+!!m(this.yt,16)}set diffValue(e){this.yt=h(this.yt,16,e===1)}q(){this.Y()}Y(){this.isScheduled||(this.isScheduled=!0,M.pendingReactions.push(this),Be())}X(){if(!this.isDisposed){Fe(),this.isScheduled=!1;let e=M.trackingContext;if(M.trackingContext=this,Ee(this)){this.isTrackPending=!0;try{this.Et()}catch(e){this.Pt(e)}}M.trackingContext=e,Ie()}}track(e){if(this.isDisposed)return;Fe(),this.isRunning=!0;let t=M.trackingContext;M.trackingContext=this;let n=De(this,e,void 0);M.trackingContext=t,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Oe(this),Te(n)&&this.Pt(n.cause),Ie()}Pt(e){if(this.kt)this.kt(e,this);else{if(M.disableErrorBoundaries)throw e;M.suppressReactionErrors||console.error(`[mobx] uncaught error in '${this}'`,e),M.globalReactionErrorHandlers.forEach(t=>t(e,this))}}dispose(){var e;this.isDisposed||(this.isDisposed=!0,(e=this.It)==null||e.call(this),this.isRunning||(Fe(),Oe(this),Ie()))}Z(e){let t=()=>this.dispose();return e!=null&&e.addEventListener&&!this.isDisposed&&(e.addEventListener(`abort`,t),this.It=()=>e.removeEventListener==null?void 0:e.removeEventListener(`abort`,t)),t[k]=this,`dispose`in Symbol&&typeof Symbol.dispose==`symbol`&&(t[Symbol.dispose]=t),t}toString(){return`Reaction[${this.tt}]`}};let On=100,kn=e=>e(),An=l(`Reaction`,Dn),jn=`action`,Mn=`autoAction`,Nn=b(jn),Pn=b(`action.bound`,{bound:!0}),Fn=b(Mn,{autoAction:!0}),In=b(`autoAction.bound`,{autoAction:!0,bound:!0}),Ln=Ue(!1);It(Ln,Nn);let Rn=Ue(!0);It(Rn,Fn);let zn=He(Pn),Bn=He(In),Vn=e=>e(),Hn=`always`;var Un=class extends Error{constructor(){super(`FLOW_CANCELLED`),Object.setPrototypeOf(this,new.target.prototype),this.name=`FlowCancellationError`}toString(){return`Error: ${this.message}`}};let Wn=ne(`flow`),Gn=ne(`flow.bound`,{bound:!0}),Kn=It(function(e,t){if(t&&typeof t.kind==`string`)return ae(Wn,e,t);let n=e,i=n.name||`flow`,a=function(){let e=arguments,t=Ln(i,n).apply(this,e),a,o,s=new Promise(function(e,n){function s(e){let r;o=void 0;try{r=Ln(i,t.next).call(t,e)}catch(e){return n(e)}l(r)}function c(e){let r;o=void 0;try{r=Ln(i,t.throw).call(t,e)}catch(e){return n(e)}l(r)}function l(t){if(!r(t?.then))return t.done?e(t.value):(o=Promise.resolve(t.value),o.then(s,c));t.then(l,n)}a=n,s(void 0)});return s.cancel=Ln(i,function(){try{o&&Qe(o);let e=t.return(void 0),n=Promise.resolve(e.value);n.then(Ut,Ut),Qe(n),a(new Un)}catch(e){a(e)}}),s};return a.isMobXFlow=!0,a},Wn),qn=he(Gn,ae),Jn={has:(e,t)=>dt(e).et(t),get:(e,t)=>dt(e).Tt(t),set(e,t,n){var r;return!!i(t)&&((r=dt(e).Bt(t,n,!0))==null||r)},deleteProperty(e,t){var n;return!!i(t)&&((n=dt(e).Dt(t,!0))==null||n)},defineProperty(e,t,n){var r;return(r=dt(e).l(t,n))==null||r},ownKeys:e=>dt(e).it(),preventExtensions(e){t(13)}},Yn=Symbol(`mobx-keys`),Xn=`splice`,Zn=`update`,Qn={get(e,t){let n=e[k];return t===k?n:t===`length`?n.Kt():typeof t!=`string`||isNaN(t)?p(er,t)?er[t]:e[t]:n.Tt(parseInt(t))},set(e,t,n){let r=e[k];return t===`length`?r.Lt(n):typeof t==`symbol`||isNaN(t)?e[t]=n:r.Bt(parseInt(t),n),!0},preventExtensions(){t(15)}};var $n=class{constructor(e=`ObservableArray`,t,n){this.$t=void 0,this.ct=void 0,this.j=[],this.st=void 0,this.ot=void 0,this.A=void 0,this.dehancer=void 0,this.v=void 0,this.Ut=0,this.$t=n,this.ct=new Kt(e),this.A=(e,n)=>t(e,n,`ObservableArray[..]`)}Wt(e){return this.dehancer===void 0?e:this.dehancer(e)}ht(e){return this.dehancer!==void 0&&e.length>0?e.map(this.dehancer):e}Kt(){return this.ct.reportObserved(),this.j.length}Lt(e){(!Number.isInteger(e)||e<0)&&t(40,e);let n=this.j.length;if(e!==n)if(e>n){let t=Array.from({length:e-n});this.wt(n,0,t)}else this.wt(e,n-e)}zt(e,n){e!==this.Ut&&t(16),this.Ut+=n}wt(e,t,n){let r=this.j.length;if(e===void 0?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=arguments.length===1?r-e:t==null?0:Math.max(0,Math.min(t,r-e)),n===void 0&&(n=Bt),ft(this)){let r=D(this,{object:this.v,type:Xn,index:e,removedCount:t,added:n});if(!r)return Bt;t=r.removedCount,n=r.added}n=n.length===0?n:n.map(e=>this.A(e,void 0));let i=this.qt(e,t,n);return t===0&&n.length===0||this.Ft(e,n,i),this.ht(i)}qt(e,t,n){if(n.length<1e4)return this.j.splice(e,t,...n);{let r=this.j.slice(e,e+t),i=this.j.slice(e+t);this.j.length+=n.length-t;for(let t=0;t<n.length;t++)this.j[e+t]=n[t];for(let t=0;t<i.length;t++)this.j[e+n.length+t]=i[t];return r}}Ht(e,t,n){let r=mt(this),i=r?{observableKind:`array`,object:this.v,type:Zn,debugObjectName:this.ct.tt,index:e,newValue:t,oldValue:n}:null;this.ct.reportChanged(),r&&gt(this,i)}Ft(e,t,n){let r=mt(this),i=r?{observableKind:`array`,object:this.v,debugObjectName:this.ct.tt,type:Xn,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;this.ct.reportChanged(),r&&gt(this,i)}Tt(e){return this.ct.reportObserved(),this.Wt(this.j[e])}Bt(e,t){let n=this.j;if(e<n.length){let r=n[e];if(ft(this)){let n=D(this,{type:Zn,object:this.v,index:e,newValue:t});if(!n)return;t=n.newValue}(t=this.A(t,r))!==r&&(n[e]=t,this.Ht(e,t,r))}else{let r=Array.from({length:e+1-n.length});r[r.length-1]=t,this.wt(n.length,0,r)}}},er={clear(){return this.splice(0)},replace(e){let t=this[k];return t.wt(0,t.j.length,e)},toJSON(){return this.slice()},splice(e,t,...n){let r=this[k];switch(arguments.length){case 0:return[];case 1:return r.wt(e);case 2:return r.wt(e,t)}return r.wt(e,t,n)},spliceWithArray(e,t,n){return this[k].wt(e,t,n)},push(...e){let t=this[k];return t.wt(t.j.length,0,e),t.j.length},pop(){return this.splice(Math.max(this[k].j.length-1,0),1)[0]},shift(){return this.splice(0,1)[0]},unshift(...e){let t=this[k];return t.wt(0,0,e),t.j.length},reverse(){return M.trackingDerivation&&t(37,`reverse`),this.replace(this.slice().reverse()),this},sort(){M.trackingDerivation&&t(37,`sort`);let e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove(e){let t=this[k],n=t.ht(t.j).indexOf(e);return n>-1&&(this.splice(n,1),!0)}};O(`at`,vt),O(`concat`,vt),O(`flat`,vt),O(`includes`,vt),O(`indexOf`,vt),O(`join`,vt),O(`lastIndexOf`,vt),O(`slice`,vt),O(`toString`,vt),O(`toLocaleString`,vt),O(`toSorted`,vt),O(`toSpliced`,vt),O(`with`,vt),O(`every`,yt),O(`filter`,yt),O(`find`,yt),O(`findIndex`,yt),O(`findLast`,yt),O(`findLastIndex`,yt),O(`flatMap`,yt),O(`forEach`,yt),O(`map`,yt),O(`some`,yt),O(`toReversed`,yt),O(`reduce`,bt),O(`reduceRight`,bt);let tr=l(`ObservableArrayAdministration`,$n),nr={},rr=`delete`;var ir=class{constructor(e,t=v,n=`ObservableMap`){this.A=void 0,this.tt=void 0,this[k]=nr,this.ft=void 0,this.dt=void 0,this.lt=void 0,this.st=void 0,this.ot=void 0,this.dehancer=void 0,this.A=t,this.tt=n,At(()=>{this.lt=g(`ObservableMap.keys()`),this.ft=new Map,this.dt=new Map,e&&this.merge(e)})}et(e){return this.ft.has(e)}has(e){if(!M.trackingDerivation)return this.et(e);let t=this.dt.get(e);if(!t){let n=t=new vn(this.et(e),y,`ObservableMap.key?`,!1);this.dt.set(e,n),n.onBUOL=new Set([()=>this.dt.delete(e)])}return t.get()}set(e,t){let n=this.et(e);if(ft(this)){let r=D(this,{type:n?Zn:`add`,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.Gt(e,t):this.Jt(e,t),this}delete(e){if(ft(this)&&!D(this,{type:rr,object:this,name:e}))return!1;if(this.et(e)){let t=mt(this),n=t?{observableKind:`map`,debugObjectName:this.tt,type:rr,object:this,oldValue:this.ft.get(e).rt,name:e}:null;return lt(()=>{var t;this.lt.reportChanged(),(t=this.dt.get(e))==null||t.Ot(!1),this.ft.get(e).Ot(void 0),this.ft.delete(e)}),t&&gt(this,n),!0}return!1}Gt(e,t){let n=this.ft.get(e);if((t=n.jt(t))!==M.UNCHANGED){let r=mt(this),i=r?{observableKind:`map`,debugObjectName:this.tt,type:Zn,object:this,oldValue:n.rt,name:e,newValue:t}:null;n.Ot(t),r&&gt(this,i)}}Jt(e,t){lt(()=>{var n;let r=new vn(t,this.A,`ObservableMap.key`,!1);this.ft.set(e,r),t=r.rt,(n=this.dt.get(e))==null||n.Ot(!0),this.lt.reportChanged()});let n=mt(this);n&&gt(this,n?{observableKind:`map`,debugObjectName:this.tt,type:`add`,object:this,name:e,newValue:t}:null)}get(e){return this.has(e)?this.Wt(this.ft.get(e).get()):this.Wt(void 0)}getOrInsert(e,t){return this.has(e)||this.set(e,t),this.get(e)}getOrInsertComputed(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)}Wt(e){return this.dehancer===void 0?e:this.dehancer(e)}keys(){return this.lt.reportObserved(),this.ft.keys()}values(){let e=this,t=this.keys();return St({next(){let{done:n,value:r}=t.next();return{done:n,value:n?void 0:e.get(r)}}})}entries(){let e=this,t=this.keys();return St({next(){let{done:n,value:r}=t.next();return{done:n,value:n?void 0:[r,e.get(r)]}}})}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[n,r]of this)e.call(t,r,n,this)}merge(e){return ar(e)&&(e=new Map(e)),lt(()=>{o(e)?function(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);return n.length?[...t,...n.filter(t=>zt.propertyIsEnumerable.call(e,t))]:t}(e).forEach(t=>this.set(t,e[t])):Array.isArray(e)?e.forEach(([e,t])=>this.set(e,t)):u(e)?(function(e){return Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(e)))===null}(e)||t(19,e),e.forEach((e,t)=>this.set(t,e))):e!=null&&t(20,e)}),this}clear(){lt(()=>{E(()=>{for(let e of this.keys())this.delete(e)})})}replace(e){return lt(()=>{let n=function(e){if(u(e)||ar(e))return e;if(Array.isArray(e))return new Map(e);if(o(e)){let t=new Map;for(let n in e)t.set(n,e[n]);return t}return t(21,e)}(e),r=new Map,i=!1;for(let e of this.ft.keys())if(!n.has(e))if(this.delete(e))i=!0;else{let t=this.ft.get(e);r.set(e,t)}for(let[e,t]of n.entries()){let n=this.ft.has(e);if(this.set(e,t),this.ft.has(e)){let t=this.ft.get(e);r.set(e,t),n||(i=!0)}}if(!i)if(this.ft.size!==r.size)this.lt.reportChanged();else{let e=this.ft.keys(),t=r.keys(),n=e.next(),i=t.next();for(;!n.done;){if(n.value!==i.value){this.lt.reportChanged();break}n=e.next(),i=t.next()}}this.ft=r}),this}get size(){return this.lt.reportObserved(),this.ft.size}toString(){return`[object ObservableMap]`}toJSON(){return Array.from(this)}get[Symbol.toStringTag](){return`Map`}},ar=l(`ObservableMap`,ir);let or={};var sr=class{constructor(e,t=v,n=`ObservableSet`){this.tt=void 0,this[k]=or,this.ft=new Set,this.ct=void 0,this.ot=void 0,this.st=void 0,this.dehancer=void 0,this.A=void 0,this.tt=n,this.A=(e,r)=>t(e,r,n),At(()=>{this.ct=g(this.tt),e&&this.replace(e)})}Wt(e){return this.dehancer===void 0?e:this.dehancer(e)}clear(){lt(()=>{E(()=>{for(let e of this.ft.values())this.delete(e)})})}forEach(e,t){for(let n of this)e.call(t,n,n,this)}get size(){return this.ct.reportObserved(),this.ft.size}add(e){if(ft(this)){let t=D(this,{type:`add`,object:this,newValue:e});if(!t)return this;e=t.newValue}if(!this.has(e)){lt(()=>{e=this.A(e,void 0),this.ft.add(e),this.ct.reportChanged()});let t=mt(this);t&&gt(this,t?{observableKind:`set`,debugObjectName:this.tt,type:`add`,object:this,newValue:e}:null)}return this}delete(e){if(ft(this)&&!D(this,{type:rr,object:this,oldValue:e}))return!1;if(this.has(e)){let t=mt(this),n=t?{observableKind:`set`,debugObjectName:this.tt,type:rr,object:this,oldValue:e}:null;return lt(()=>{this.ct.reportChanged(),this.ft.delete(e)}),t&&gt(this,n),!0}return!1}has(e){return this.ct.reportObserved(),this.ft.has(this.Wt(e))}entries(){let e=this.values();return Ct({next(){let{value:t,done:n}=e.next();return n?{value:void 0,done:n}:{value:[t,t],done:n}}})}keys(){return this.values()}values(){this.ct.reportObserved();let e=this,t=this.ft.values();return Ct({next(){let{value:n,done:r}=t.next();return r?{value:void 0,done:r}:{value:e.Wt(n),done:r}}})}intersection(e){return new Set(this).intersection(e)}union(e){return new Set(this).union(e)}difference(e){return new Set(this).difference(e)}symmetricDifference(e){return new Set(this).symmetricDifference(e)}isSubsetOf(e){return new Set(this).isSubsetOf(e)}isSupersetOf(e){return new Set(this).isSupersetOf(e)}isDisjointFrom(e){return new Set(this).isDisjointFrom(e)}replace(e){return cr(e)&&(e=new Set(e)),Array.isArray(e)||d(e)?lt(()=>{let t=d(e)?e:new Set(e);if(t.size!==0)if(this.ft.size!==0){for(let e of this.ft.values())t.has(this.Wt(e))||this.delete(e);t.forEach(e=>this.add(e))}else t.forEach(e=>this.add(e));else this.clear()}):e!=null&&t(41,e),this}toJSON(){return Array.from(this)}toString(){return`[object ObservableSet]`}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return`Set`}},cr=l(`ObservableSet`,sr);let lr=Object.create(null),ur=`remove`;var dr=class{constructor(e,t=new Map,n,r=Zt){this.h=void 0,this.j=void 0,this.tt=void 0,this.ut=void 0,this.lt=void 0,this.ot=void 0,this.st=void 0,this.v=void 0,this.p=void 0,this.Xt=void 0,this.Qt=void 0,this.O=void 0,this.V=void 0,this.h=e,this.j=t,this.tt=n,this.ut=r,this.lt=new Kt(`ObservableObject.keys`),this.p=o(this.h)}_(e){return(this.j.get(e)??this.vt(e)??this.bt(e)).get()}vt(e){let t=this.O?.get(e);if(!t)return;this.O.delete(e),this.O.size===0&&(this.O=void 0);let n=t();return this.j.set(e,n),n}bt(e){let t=this.V?.get(e);if(!t)return;this.V.delete(e),this.V.size===0&&(this.V=void 0);let n=t();return this.j.set(e,n),n}M(e,t){let n=this.j.get(e)??this.vt(e)??this.bt(e);if(n instanceof bn)return n.set(t),!0;if(ft(this)){let n=D(this,{type:Zn,object:this.v||this.h,name:e,newValue:t});if(!n)return null;t=n.newValue}if((t=n.jt(t))!==M.UNCHANGED){let r=mt(this),i=r?{type:Zn,observableKind:`object`,debugObjectName:this.tt,object:this.v||this.h,oldValue:n.rt,name:e,newValue:t}:null;n.Ot(t),r&&gt(this,i)}return!0}Tt(e){return M.trackingDerivation&&!p(this.h,e)&&this.et(e),this.h[e]}Bt(e,t,n=!1){return p(this.h,e)?this.j.has(e)?this.M(e,t):n?Reflect.set(this.h,e,t):(this.h[e]=t,!0):this.u(e,{value:t,enumerable:!0,writable:!0,configurable:!0},this.ut,n)}et(e){if(!M.trackingDerivation)return e in this.h;this.Qt||=new Map;let t=this.Qt.get(e);return t||(t=new vn(e in this.h,y,`ObservableObject.key?`,!1),this.Qt.set(e,t)),t.get()}u(e,t,n,r=!1){return!0===n&&(n=this.ut),!1===n?this.l(e,t,r):n.u(this,e,t,r)}l(e,t,n=!1){try{Fe();let r=this.Dt(e);if(!r)return r;if(ft(this)){let n=D(this,{object:this.v||this.h,name:e,type:`add`,newValue:t.value});if(!n)return null;let{newValue:r}=n;t.value!==r&&(t=It({},t,{value:r}))}if(n){if(!Reflect.defineProperty(this.h,e,t))return!1}else Rt(this.h,e,t);this.Yt(e,t.value)}finally{Ie()}return!0}S(e,t,n,r=!1){try{Fe();let i=this.Dt(e);if(!i)return i;if(ft(this)){let n=D(this,{object:this.v||this.h,name:e,type:`add`,newValue:t});if(!n)return null;t=n.newValue}let a=Tt(e),o={configurable:!M.safeDescriptors||this.p,enumerable:!0,get:a.get,set:a.set};if(r){if(!Reflect.defineProperty(this.h,e,o))return!1}else Rt(this.h,e,o);let s=new vn(t,n,`ObservableObject.key`,!1);this.j.set(e,s),this.Yt(e,s.rt)}finally{Ie()}return!0}m(e,t,n=!1){try{Fe();let r=this.Dt(e);if(!r)return r;if(ft(this)&&!D(this,{object:this.v||this.h,name:e,type:`add`,newValue:void 0}))return null;t.name||=`ObservableObject.key`,t.context=this.v||this.h;let i=Tt(e),a={configurable:!M.safeDescriptors||this.p,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.h,e,a))return!1}else Rt(this.h,e,a);this.j.set(e,new bn(t)),this.Yt(e,void 0)}finally{Ie()}return!0}Dt(e,t=!1){if(!p(this.h,e))return!0;if(ft(this)&&!D(this,{object:this.v||this.h,name:e,type:ur}))return null;try{var n;Fe();let r=mt(this),i=this.j.get(e),a;if(i||!r||(a=Lt(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 vn&&(a=i.rt),ze(i)),this.lt.reportChanged(),(n=this.Qt)==null||(n=n.get(e))==null||n.set(e in this.h),r&&r&&gt(this,{type:ur,observableKind:`object`,object:this.v||this.h,debugObjectName:this.tt,oldValue:a,name:e})}finally{Ie()}return!0}Yt(e,t){var n;let r=mt(this);r&&r&&gt(this,r?{type:`add`,observableKind:`object`,debugObjectName:this.tt,object:this.v||this.h,name:e,newValue:t}:null),(n=this.Qt)==null||(n=n.get(e))==null||n.set(!0),this.lt.reportChanged()}it(){return this.lt.reportObserved(),Wt(this.h)}nt(){return this.lt.reportObserved(),Object.keys(this.h)}};let fr=l(`ObservableObjectAdministration`,dr),pr=zt.toString,mr=globalThis.Iterator?.prototype||{};e.$mobx=k,e.FlowCancellationError=Un,e.ObservableMap=ir,e.ObservableSet=sr,e.Reaction=Dn,e._allowStateChanges=we,e._allowStateChangesInsideComputed=We,e._allowStateReadsEnd=function(e){M.allowStateReads=e},e._allowStateReadsStart=function(e){let t=M.allowStateReads;return M.allowStateReads=e,t},e._autoAction=Rn,e._autoActionBound=Bn,e._endAction=Ce,e._getAdministration=Ot,e._getGlobalState=function(){return M},e._interceptReads=function(e,t,n){let r;return ar(e)||xt(e)||yn(e)?r=Ot(e):Et(e)&&(r=Ot(e,t)),r.dehancer=typeof t==`function`?t:n,()=>{r.dehancer=void 0}},e._isComputingDerivation=function(){return M.trackingDerivation!==null},e._resetGlobalState=function(){let e=new wn;for(let t in e)Cn.indexOf(t)===-1&&(M[t]=e[t]);M.allowStateChanges=!M.enforceActions},e._startAction=Se,e.action=Ln,e.actionBound=zn,e.autorun=Ke,e.compareDefault=Jt,e.compareIdentity=function(e,t){return e===t},e.compareShallow=function(e,t){return jt(e,t,1)},e.compareStructural=_,e.computed=fn,e.computedStruct=dn,e.configure=function(e){!0===e.isolateGlobalState&&function(){if((M.pendingReactions.length||M.inBatch||M.isRunningReactions)&&t(36),En=!0,Tn){let e=globalThis;--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),M=new wn}}();let{enforceActions:n}=e;if(n!==void 0){let e=n===Hn?Hn:n===`observed`;M.enforceActions=e,M.allowStateChanges=!0!==e&&e!==Hn}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(t=>{t in e&&(M[t]=!!e[t])}),M.allowStateReads=!M.observableRequiresReaction,e.reactionScheduler&&function(e){let t=kn;kn=n=>e(()=>t(n))}(e.reactionScheduler)},e.createAtom=g,e.defineProperty=function(e,n,r){if(Et(e))return e[k].l(n,r);t(39)},e.entries=function(e){return Et(e)?rt(e).map(t=>[t,e[t]]):ar(e)?rt(e).map(t=>[t,e.get(t)]):cr(e)?Array.from(e.entries()):xt(e)?e.map((e,t)=>[t,e]):void t(7)},e.extendObservable=Ye,e.flow=Kn,e.flowBound=qn,e.flowResult=function(e){return e},e.get=function(e,n){if(it(e,n))return Et(e)?e[k].Tt(n):ar(e)?e.get(n):xt(e)?e[n]:void t(11)},e.getAtom=Dt,e.getDebugName=kt,e.getDependencyTree=function(e,t){return Xe(Dt(e,t))},e.getObserverTree=function(e,t){return Ze(Dt(e,t))},e.has=it,e.intercept=function(e,t,n){return r(n)?function(e,t,n){return pt(Ot(e,t),n)}(e,t,n):function(e,t){return pt(Ot(e),t)}(e,t)},e.isAction=Ge,e.isBoxedObservable=yn,e.isComputed=function(e){return et(e)},e.isComputedProp=function(e,t){return et(e,t)},e.isFlow=$e,e.isFlowCancellationError=function(e){return e instanceof Un},e.isObservable=nt,e.isObservableArray=xt,e.isObservableMap=ar,e.isObservableObject=Et,e.isObservableProp=function(e,t){return tt(e,t)},e.isObservableSet=cr,e.keys=rt,e.makeAutoObservable=function(e,t,n){return o(e)?Ye(e,e,t,n):(At(()=>{let r=wt(e,n)[k];if(!e[Yn]){let t=Object.getPrototypeOf(e),n=new Set([...Wt(e),...Wt(t)]);n.delete(`constructor`),n.delete(k),c(t,Yn,n)}e[Yn].forEach(e=>_t(r,e,!t||!(e in t)||t[e]))}),e)},e.makeObservable=function(e,t,n){return At(()=>{let r=wt(e,n)[k];Wt(t).forEach(e=>_t(r,e,t[e]))}),e},e.observable=cn,e.observableDeep=on,e.observableRef=rn,e.observableShallow=an,e.observableStruct=sn,e.observe=function(e,t,n,i){return r(n)?function(e,t,n,r){return ot(Ot(e,t),n,r)}(e,t,n,i):function(e,t,n){let r=Ot(e);if(xt(e))n&&t({observableKind:`array`,object:r.v,debugObjectName:r.ct.tt,type:`splice`,index:0,added:r.j.slice(),addedCount:r.j.length,removed:[],removedCount:0});else if(!ar(e)&&!cr(e)&&!Et(e))return ot(r,t,n);return ht(r,t)}(e,t,n)},e.onBecomeObserved=function(e,t,n){return Je(`onBO`,e,t,n)},e.onBecomeUnobserved=function(e,t,n){return Je(`onBUO`,e,t,n)},e.onReactionError=function(e){return M.globalReactionErrorHandlers.push(e),()=>{let t=M.globalReactionErrorHandlers.indexOf(e);t>=0&&M.globalReactionErrorHandlers.splice(t,1)}},e.override=Yt,e.ownKeys=at,e.reaction=function(e,t,n=Vt){function r(){if(p=!1,h.isDisposed)return;let t=!1,r=d;h.track(()=>{let n=we(!1,()=>e(h));t=f||!m(d,n),d=n}),(f&&n.fireImmediately||!f&&t)&&o(d,r,h),f=!1}var i;let a=n.name??`Reaction`,o=Ln(a,n.onError?(s=n.onError,c=t,function(){try{return c.apply(this,arguments)}catch(e){s.call(this,e)}}):t);var s,c;let l=!n.scheduler&&!n.delay,u=qe(n),d,f=!0,p=!1,m=n.equals||Jt,h=new Dn(a,()=>{f||l?r():p||(p=!0,u(r))},n.onError,n.requiresObservable);return n!=null&&(i=n.signal)!=null&&i.aborted||h.Y(),h.Z(n?.signal)},e.remove=function(e,n){Et(e)?e[k].Dt(n):ar(e)||cr(e)?e.delete(n):xt(e)?(typeof n!=`number`&&(n=parseInt(n,10)),e.splice(n,1)):t(9)},e.runInAction=We,e.set=function e(n,r,i){if(arguments.length===2&&!cr(n)){Fe();let t=r;try{for(let r in t)e(n,r,t[r])}finally{Ie()}return}Et(n)?n[k].Bt(r,i):ar(n)?n.set(r,i):cr(n)?n.add(r):xt(n)?(typeof r!=`number`&&(r=parseInt(r,10)),r<0&&t(42,r),Fe(),r>=n.length&&(n.length=r+1),n[r]=i,Ie()):t(8)},e.spy=function(){return console.warn(`[mobx.spy] Is a no-op in production builds`),function(){}},e.toJS=function(e){return ct(e,new Map)},e.transaction=lt,e.untracked=E,e.values=function(e){return Et(e)?rt(e).map(t=>e[t]):ar(e)?rt(e).map(t=>e.get(t)):cr(e)?Array.from(e.values()):xt(e)?e.slice():void t(6)},e.when=function(e,t,n){return arguments.length===1||t&&typeof t==`object`?function(e,t){var n;if(t!=null&&(n=t.signal)!=null&&n.aborted)return It(Promise.reject(Error(`WHEN_ABORTED`)),{cancel:()=>null});let r,i,a=new Promise((n,a)=>{var o;let s=ut(e,n,It({},t,{onError:a}));r=()=>{s(),a(Error(`WHEN_CANCELLED`))},i=()=>{s(),a(Error(`WHEN_ABORTED`))},t==null||(o=t.signal)==null||o.addEventListener==null||o.addEventListener(`abort`,i)}).finally(()=>{var e;return t==null||(e=t.signal)==null||e.removeEventListener==null?void 0:e.removeEventListener(`abort`,i)});return a.cancel=r,a}(e,t):ut(e,t,n||{})}})),pb=Ee((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t={0:`Invalid value for configuration 'enforceActions', expected 'never', 'always' or 'observed'`,1(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.`,19(e){return`Cannot initialize from classes that inherit from Map: `+e.constructor.name},20(e){return`Cannot initialize map from `+e},21(e){return`Cannot convert to map from '${e}'`},23:`It is not possible to get index atoms from arrays`,24(e){return`Cannot obtain administration from `+e},25(e,t){return`the entry '${e}' does not exist in the observable map '${t}'`},26:`please specify a property`,27(e,t){return`no observable property '${e.toString()}' found on the observable object '${t}'`},28(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(e,t){return`Cycle detected in computation ${e}: ${t}`},33(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(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(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`,40(e){return`Out of range: `+e},41(e){return`Cannot initialize set from `+e},42(e){return`Invalid index: '${e}'`},43(e,t,n){return`Cannot apply '${e}' to '${t}' (kind: ${n}):\n'${e}' can only be used on properties with a function value.`},44(e){return`'${e}' can only be used with 'makeObservable'`}};function n(e,...n){{let r=typeof e==`string`?e:t[e];throw typeof r==`function`&&(r=r.apply(null,n)),Error(`[MobX] ${r}`)}}let r=Object.assign,i=Object.getOwnPropertyDescriptor,a=Object.defineProperty,o=Object.prototype,s=[];Object.freeze(s);let c={};Object.freeze(c);let l=Object.toString();function u(){return++A.mobxGuid}function d(e){let t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}let f=()=>{};function p(e){return typeof e==`function`}function m(e){switch(typeof e){case`string`:case`symbol`:case`number`:return!0}return!1}function h(e){return typeof e==`object`&&!!e}function g(e){if(!h(e))return!1;let t=Object.getPrototypeOf(e);if(t==null)return!0;let n=ae(t,`constructor`)&&t.constructor;return typeof n==`function`&&n.toString()===l}function _(e){let t=e?.constructor;return t?t.name===`GeneratorFunction`||t.displayName===`GeneratorFunction`:!1}function v(e,t,n){a(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function y(e,t,n){a(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function b(e,t){let n=`isMobX`+e;return t.prototype[n]=!0,function(e){return h(e)&&e[n]===!0}}function ee(e){return e!=null&&Object.prototype.toString.call(e)===`[object Map]`}function x(e){return Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(e)))===null}function S(e){return e!=null&&Object.prototype.toString.call(e)===`[object Set]`}function te(e){let t=Object.keys(e),n=Object.getOwnPropertySymbols(e);return n.length?[...t,...n.filter(t=>o.propertyIsEnumerable.call(e,t))]:t}let ne=Reflect.ownKeys;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 o.hasOwnProperty.call(e,t)}let oe=Object.getOwnPropertyDescriptors;function C(e,t){return!!(e&t)}function w(e,t,n){return n?e|=t:e&=~t,e}function se(e,t){t.includes(e.kind)||n(`The decorator applied to '${String(e.name)}' cannot be used on a ${e.kind} element`)}let T=Symbol(`mobx administration`);var ce=class{constructor(e=`Atom@`+u()){this.name_=void 0,this.flags_=0,this.observers_=null,this.lastAccessedBy_=0,this.lowestObserverState_=-1,this.onBOL=void 0,this.onBUOL=void 0,this.name_=e}get isBeingObserved(){return C(this.flags_,1)}set isBeingObserved(e){this.flags_=w(this.flags_,1,e)}get isPendingUnobservation(){return C(this.flags_,2)}set isPendingUnobservation(e){this.flags_=w(this.flags_,2,e)}get diffValue(){return+!!C(this.flags_,4)}set diffValue(e){this.flags_=w(this.flags_,4,e===1)}onBO(){this.onBOL&&this.onBOL.forEach(e=>e())}onBUO(){this.onBUOL&&this.onBUOL.forEach(e=>e())}reportObserved(){return un(this)}reportChanged(){on(),dn(this),sn()}toString(){return this.name_}};let le=b(`Atom`,ce);function ue(e,t=f,n=f){let r=new ce(e);return t!==f&&(r.onBOL=new Set([t])),n!==f&&(r.onBUOL=new Set([n])),r}function de(e,t){return e===t}function fe(e,t){return P(e,t)}function pe(e,t){return P(e,t,1)}let me=Object.is;function he(e,t,n){return e===null||typeof e!=`object`&&typeof e!=`function`||Sr(e)?e:Array.isArray(e)?D.array(e,{name:n}):g(e)?D.object(e,void 0,{name:n}):ee(e)?D.map(e,{name:n}):S(e)?D.set(e,{name:n}):typeof e==`function`&&!Bn(e)&&!pr(e)?_(e)?lr(e):In(n,e):e}function ge(e,t,r){if(e==null||Ai(e)||pi(e)||_i(e)||Si(e))return e;if(Array.isArray(e))return D.array(e,{name:r,deep:!1});if(g(e))return D.object(e,void 0,{name:r,deep:!1});if(ee(e))return D.map(e,{name:r,deep:!1});if(S(e))return D.set(e,{name:r,deep:!1});n(`The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets`)}function _e(e){return e}function ve(e,t){return Sr(e)&&n(`observable.struct should not be used with observable values`),P(e,t)?t:e}let ye=`override`,be={annotationType_:ye,make_:Se,extend_:Ce};function xe(e){return e.annotationType_===ye}function Se(e,t){return e.isPlainObject_&&n(`Cannot apply '${this.annotationType_}' to '${e.name_}.${t.toString()}':\n'${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 Ce(e,t,r,i){n(44,this.annotationType_)}function we(e,t){return{annotationType_:e,options_:t,make_:Te,extend_:Ee}}function Te(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:Bn(n.value)?1:(a(r,t,E(e,this,t,n,!1)),2)}function Ee(e,t,n,r){let i=E(e,this,t,n);return e.defineProperty_(t,i,r)}function De(e,t,r){se(r,[`method`,`field`]);let{kind:i,name:a,addInitializer:o}=r,s=e,c=e=>St(s.options_?.name??a.toString(),e,s.options_?.autoAction??!1);if(i==`field`)return function(e){var t;let n=e;return Bn(n)||(n=c(n)),(t=s.options_)!=null&&t.bound&&(n=n.bind(this),n.isMobxAction=!0),n};if(i==`method`){var l;return Bn(t)||(t=c(t)),(l=s.options_)!=null&&l.bound&&o(function(){let e=this,t=e[a].bind(e);t.isMobxAction=!0,e[a]=t}),t}n(43,s.annotationType_,String(a),i)}function Oe(e,{annotationType_:t},r,{value:i}){p(i)||n(`Cannot apply '${t}' to '${e.name_}.${r.toString()}':\n'${t}' can only be used on properties with a function value.`)}function E(e,t,n,r,i=A.safeDescriptors){var a,o;Oe(e,t,n,r);let{value:s}=r;return(a=t.options_)!=null&&a.bound&&(s=s.bind(e.proxy_??e.target_)),{value:St(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 ke(e,t){return{annotationType_:e,options_:t,make_:Ae,extend_:je}}function Ae(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)||!pr(e.target_[t]))&&this.extend_(e,t,n,!1)===null?0:pr(n.value)?1:(a(r,t,Pe(e,this,t,n,!1,!1)),2)}function je(e,t,n,r){let i=Pe(e,this,t,n,this.options_?.bound);return e.defineProperty_(t,i,r)}function Me(e,t,n){var r;se(n,[`method`]);let{name:i,addInitializer:a}=n;return pr(t)||(t=lr(t)),(r=e.options_)!=null&&r.bound&&a(function(){let e=this,t=e[i].bind(e);t.isMobXFlow=!0,e[i]=t}),t}function Ne(e,{annotationType_:t},r,{value:i}){p(i)||n(`Cannot apply '${t}' to '${e.name_}.${r.toString()}':\n'${t}' can only be used on properties with a generator function value.`)}function Pe(e,t,n,r,i,a=A.safeDescriptors){Ne(e,t,n,r);let{value:o}=r;return pr(o)||(o=lr(o)),i&&(o=o.bind(e.proxy_??e.target_),o.isMobXFlow=!0),{value:o,configurable:a?e.isPlainObject_:!0,enumerable:!1,writable:!a}}function Fe(e,t){return{annotationType_:e,options_:t,make_:Ie,extend_:Le}}function Ie(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Le(e,t,n,i){return ze(e,this,t,n),e.defineComputedProperty_(t,r({},this.options_,{get:n.get,set:n.set}),i)}function Re(e,t,n){se(n,[`getter`]);let i=e,{name:a,addInitializer:o}=n,s;function c(e,n){let o=r({},i.options_,{get:t,context:e});return o.name||=`${n.name_}.${a.toString()}`,new jt(o)}return o(function(){let e=Di(this)[T],n=this,r=e.values_.get(a);r instanceof jt&&r.derivation!==t&&e.values_.delete(a),(e.lazyComputedKeys_??=new Map).set(a,()=>c(n,e))}),function(){let e=this[T],n=e.values_.get(a);if(n instanceof jt&&n.derivation!==t){let t=s?.get(this);return t||(t=c(this,e),(s??=new WeakMap).set(this,t)),t.get()}return e.getObservablePropValue_(a)}}function ze(e,{annotationType_:t},r,{get:i}){i||n(`Cannot apply '${t}' to '${e.name_}.${r.toString()}':\n'${t}' can only be used on getter(+setter) properties.`)}function Be(e,t){return{annotationType_:e,options_:t,make_:Ve,extend_:He}}function Ve(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function He(e,t,n,r){return We(e,this,t,n),e.defineObservableProperty_(t,n.value,this.options_?.enhancer_??he,r)}function Ue(e,t,r){if(r.kind===`field`)throw n(`Please use \`@observable accessor ${String(r.name)}\` instead of \`@observable ${String(r.name)}\``);se(r,[`accessor`]);let i=e,{kind:a,name:o}=r;if(a!==`accessor`)return;function s(e,t){let n=Di(e)[T];return(n.lazyObservableKeys_??=new Map).set(o,()=>new kt(t,i.options_?.enhancer_??he,`${n.name_}.${o.toString()}`,!1)),n}return{get(){return(this[T]??s(this,t.get.call(this))).getObservablePropValue_(o)},set(e){return(this[T]??s(this,e)).setObservablePropValue_(o,e)},init(e){return s(this,e),e}}}function We(e,{annotationType_:t},r,i){`value`in i||n(`Cannot apply '${t}' to '${e.name_}.${r.toString()}':\n'${t}' cannot be used on getter/setter properties`)}let Ge=Ke();function Ke(e){return{annotationType_:`true`,options_:e,make_:Ye,extend_:Xe}}let qe=[Ge];function Je(e){let t=e.deep!==!1,n=!!e.autoBind,r=!t|(n?2:0);return qe[r]??(qe[r]=Ke({deep:t,autoBind:n}))}function Ye(e,t,n,r){var i;if(n.get)return O.make_(e,t,n,r);if(n.set){let i=Bn(n.set)?n.set:St(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:A.safeDescriptors?e.isPlainObject_:!0,set:i})===null?0:2:(a(r,t,{configurable:!0,set:i}),2)}if(r!==e.target_&&typeof n.value==`function`){var o;if(_(n.value)){var s;return((s=this.options_)!=null&&s.autoBind?ur:lr).make_(e,t,n,r)}return((o=this.options_)!=null&&o.autoBind?Rn:In).make_(e,t,n,r)}let c=this.options_?.deep===!1?ut:D;return typeof n.value==`function`&&(i=this.options_)!=null&&i.autoBind&&(n.value=n.value.bind(e.proxy_??e.target_)),c.make_(e,t,n,r)}function Xe(e,t,n,r){var i;return n.get?O.extend_(e,t,n,r):n.set?e.defineProperty_(t,{configurable:A.safeDescriptors?e.isPlainObject_:!0,set:St(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?ut:D).extend_(e,t,n,r))}function Ze(e,t){return r(function(r,i){if(i&&typeof i.kind==`string`)return t(e,r,i);n(`Invalid arguments for \`${e.annotationType_}\``)},e)}let Qe={deep:!0,name:void 0,defaultDecorator:void 0};Object.freeze(Qe);function $e(e){return e||Qe}let et=Be(`observable`),tt=Be(`observable.ref`,{enhancer_:_e}),nt=Be(`observable.shallow`,{enhancer_:ge}),rt=Be(`observable.struct`,{enhancer_:ve});function it(e){return Ze(e,Ue)}function at(e){return e.deep===!0?he:e.deep===!1?_e:st(e.defaultDecorator)}function ot(e){return e?e.defaultDecorator??Je(e):void 0}function st(e){return e?e.options_?.enhancer_??he:he}function ct(e,t,n){return t&&typeof t.kind==`string`?Ue(et,e,t):Sr(e)?e:g(e)?D.object(e,t,n):Array.isArray(e)?D.array(e,t):ee(e)?D.map(e,t):S(e)?D.set(e,t):typeof e==`object`&&e?e:D.box(e,t)}let lt={box(e,t){let n=$e(t);return new kt(e,at(n),n.name,!0,n.equals)},array(e,t){let n=$e(t);return si(e,at(n),n.name)},map(e,t){let n=$e(t);return new gi(e,at(n),n.name)},set(e,t){let n=$e(t);return new xi(e,at(n),n.name)},object(e,t,n){return Ii(()=>Zn(Kr({},n),e,t))}},ut=it(tt),dt=it(nt),ft=it(et),pt=it(rt);var D=r(ct,et,lt);let mt=`computed`;function ht(e){return Ze(e,Re)}let gt=Fe(mt),_t=ht(Fe(`computed.struct`,{equals:fe})),O=function(e,t){if(t&&typeof t.kind==`string`)return Re(gt,e,t);if(g(e))return ht(Fe(mt,e));p(e)||n("First argument to `computed` should be an expression."),p(t)&&n("A setter as second argument is no longer supported, use `{ set: fn }` option instead");let r=g(t)?t:{};return r.get=e,r.name||=e.name||``,new jt(r)};r(O,gt);let vt=0,yt=1,bt=i(()=>{},`name`)?.configurable??!1,xt={value:`action`,configurable:!0,writable:!1,enumerable:!1};function St(e,t,r=!1,i){p(t)||n("`action` can only be invoked on functions"),(typeof e!=`string`||!e)&&n(`actions should have valid names, got: '${e}'`);function o(){return Ct(e,r,t,i||this,arguments)}return o.isMobxAction=!0,o.toString=()=>t.toString(),bt&&(xt.value=e,a(o,`name`,xt)),o}function Ct(e,t,n,r,i){let a=wt(e,t,r,i);try{return n.apply(r,i)}catch(e){throw a.error_=e,e}finally{Tt(a)}}function wt(e,t,n,r){let i=xn()&&!!e,a=0;i&&(a=Date.now(),Cn({type:M,name:e,object:n,arguments:r?Array.from(r):s}));let o=A.trackingDerivation,c=!t||!o;on();let l=A.allowStateChanges;c&&(Wt(),l=Dt(!0));let u=A.allowStateReads;k(!0);let d={runAsAction_:c,prevDerivation_:o,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:i,startTime_:a,actionId_:yt++,parentActionId_:vt};return vt=d.actionId_,d}function Tt(e){vt!==e.actionId_&&n(30),vt=e.parentActionId_,e.error_!==void 0&&(A.suppressReactionErrors=!0),Ot(e.prevAllowStateChanges_),Kt(e.prevAllowStateReads_),sn(),e.runAsAction_&&Gt(e.prevDerivation_),e.notifySpy_&&Tn({time:Date.now()-e.startTime_}),A.suppressReactionErrors=!1}function Et(e,t){let n=Dt(e);try{return t()}finally{Ot(n)}}function Dt(e){let t=A.allowStateChanges;return A.allowStateChanges=e,t}function Ot(e){A.allowStateChanges=e}var kt=class extends ce{constructor(e,t,n=`ObservableValue@`+u(),r=!0,i=me){super(n),this.enhancer_=void 0,this.name_=void 0,this.equals_=void 0,this.hasUnreportedChange_=!1,this.interceptors_=void 0,this.changeListeners_=void 0,this.value_=void 0,this.dehancer=void 0,this.enhancer_=t,this.name_=n,this.equals_=i,this.value_=t(e,void 0,n),r&&xn()&&Sn({type:`create`,object:this,observableKind:`value`,debugObjectName:this.name_,newValue:this.value_})}dehanceValue(e){return this.dehancer===void 0?e:this.dehancer(e)}set(e){let t=this.value_;if(e=this.prepareNewValue_(e),e!==A.UNCHANGED){let n=xn();n&&Cn({type:ii,object:this,observableKind:`value`,debugObjectName:this.name_,newValue:e,oldValue:t}),this.setNewValue_(e),n&&Tn()}}prepareNewValue_(e){if(Lt(this),qr(this)){let t=Yr(this,{object:this,type:ii,newValue:e});if(!t)return A.UNCHANGED;e=t.newValue}return e=this.enhancer_(e,this.value_,this.name_),this.equals_(this.value_,e)?A.UNCHANGED:e}setNewValue_(e){let t=this.value_;this.value_=e,this.reportChanged(),Xr(this)&&Qr(this,{type:ii,object:this,newValue:e,oldValue:t})}get(){return this.reportObserved(),this.dehanceValue(this.value_)}raw(){return this.value_}toJSON(){return this.get()}toString(){return`${this.name_}[${this.value_}]`}valueOf(){return ie(this.get())}[Symbol.toPrimitive](){return this.valueOf()}};let At=b(`ObservableValue`,kt);var jt=class{constructor(e){this.dependenciesState_=-1,this.observing_=[],this.newObserving_=null,this.observers_=null,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=0,this.unboundDepsCount_=0,this.value_=new Nt(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,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@`+u(),e.set&&(this.setter_=St(this.name_+`-setter`,e.set)),this.equals_=e.equals||me,this.scope_=e.context,this.requiresReaction_=e.requiresReaction,this.keepAlive_=!!e.keepAlive}onBecomeStale_(){pn(this)}onBO(){this.onBOL&&this.onBOL.forEach(e=>e())}onBUO(){this.onBUOL&&this.onBUOL.forEach(e=>e())}get isComputing(){return C(this.flags_,1)}set isComputing(e){this.flags_=w(this.flags_,1,e)}get isRunningSetter(){return C(this.flags_,2)}set isRunningSetter(e){this.flags_=w(this.flags_,2,e)}get isBeingObserved(){return C(this.flags_,4)}set isBeingObserved(e){this.flags_=w(this.flags_,4,e)}get isPendingUnobservation(){return C(this.flags_,8)}set isPendingUnobservation(e){this.flags_=w(this.flags_,8,e)}get diffValue(){return+!!C(this.flags_,16)}set diffValue(e){this.flags_=w(this.flags_,16,e===1)}get(){if(this.isComputing&&n(32,this.name_,this.derivation),A.inBatch===0&&(!this.observers_||this.observers_.size===0)&&!this.keepAlive_)Ft(this)&&(this.warnAboutUntrackedRead_(),on(),this.value_=this.computeValue_(!1),sn());else{let e=this.isBeingObserved;if(un(this),Ft(this)){let e=A.trackingContext;!e&&(this.keepAlive_||this.isBeingObserved)&&(A.trackingContext=this),this.trackAndCompute()&&fn(this),A.trackingContext=e}else !e&&this.isBeingObserved&&this.observing_.forEach(ln)}let e=this.value_;if(Pt(e))throw e.cause;return e}set(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_)}trackAndCompute(){let e=this.value_,t=this.dependenciesState_===-1,n=this.computeValue_(!0),r=t||Pt(e)||Pt(n)||!this.equals_(e,n);return r&&(this.value_=n,xn()&&Sn({observableKind:`computed`,debugObjectName:this.name_,object:this.scope_,type:`update`,oldValue:e,newValue:n})),r}computeValue_(e){this.isComputing=!0;let t=Dt(!1),n;if(e)n=zt(this,this.derivation,this.scope_);else if(A.disableErrorBoundaries===!0)n=this.derivation.call(this.scope_);else try{n=this.derivation.call(this.scope_)}catch(e){n=new Nt(e)}return Ot(t),this.isComputing=!1,n}suspend_(){this.keepAlive_||(Ht(this),this.value_=void 0)}warnAboutUntrackedRead_(){(typeof this.requiresReaction_==`boolean`?this.requiresReaction_:A.computedRequiresReaction)&&console.warn(`[mobx] Computed value '${this.name_}' is being read outside a reactive context. Doing a full recompute.`)}toString(){return`${this.name_}[${this.derivation.toString()}]`}valueOf(){return ie(this.get())}[Symbol.toPrimitive](){return this.valueOf()}};let Mt=b(`ComputedValue`,jt);var Nt=class{constructor(e){this.cause=void 0,this.cause=e}};function Pt(e){return e instanceof Nt}function Ft(e){switch(e.dependenciesState_){case 0:return!1;case-1:case 2:return!0;case 1:{let t=k(!0),n=Wt(),r=e.observing_,i=r.length;for(let a=0;a<i;a++){let i=r[a];if(Mt(i)){if(A.disableErrorBoundaries)i.get();else try{i.get()}catch{return Gt(n),Kt(t),!0}if(e.dependenciesState_===2)return Gt(n),Kt(t),!0}}return qt(e),Gt(n),Kt(t),!1}}}function It(){return A.trackingDerivation!==null}function Lt(e){let t=!!e.observers_&&e.observers_.size>0;!A.allowStateChanges&&(t||A.enforceActions===`always`)&&console.warn(`[MobX] `+(A.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 Rt(e){!A.allowStateReads&&A.observableRequiresReaction&&console.warn(`[mobx] Observable '${e.name_}' being read outside a reactive context.`)}function zt(e,t,n){let r=k(!0);qt(e),e.newObserving_=Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++A.runId;let i=A.trackingDerivation;A.trackingDerivation=e,A.inBatch++;let a;if(A.disableErrorBoundaries===!0)a=t.call(n);else try{a=t.call(n)}catch(e){a=new Nt(e)}return A.inBatch--,A.trackingDerivation=i,Vt(e),Bt(e),Kt(r),a}function Bt(e){e.observing_.length===0&&(typeof e.requiresObservable_==`boolean`?e.requiresObservable_:A.reactionRequiresObservable)&&console.warn(`[mobx] Derivation '${e.name_}' is created/updated without reading any observable value.`)}function Vt(e){let t=e.observing_,n=e.observing_=e.newObserving_,r=0,i=0,a=e.unboundDepsCount_;for(let e=0;e<a;e++){let t=n[e];t.diffValue===0&&(t.diffValue=1,i!==e&&(n[i]=t),i++),t.dependenciesState_>r&&(r=t.dependenciesState_)}for(n.length=i,e.newObserving_=null,a=t.length;a--;){let n=t[a];n.diffValue===0&&rn(n,e),n.diffValue=0}for(;i--;){let t=n[i];t.diffValue===1&&(t.diffValue=0,nn(t,e))}r!==0&&(e.dependenciesState_=r,e.onBecomeStale_())}function Ht(e){let t=e.observing_;e.observing_=[];let n=t.length;for(;n--;)rn(t[n],e);e.dependenciesState_=-1}function Ut(e){let t=Wt();try{return e()}finally{Gt(t)}}function Wt(){let e=A.trackingDerivation;return A.trackingDerivation=null,e}function Gt(e){A.trackingDerivation=e}function k(e){let t=A.allowStateReads;return A.allowStateReads=e,t}function Kt(e){A.allowStateReads=e}function qt(e){if(e.dependenciesState_===0)return;e.dependenciesState_=0;let t=e.observing_,n=t.length;for(;n--;)t[n].lowestObserverState_=0}let Jt=[`mobxGuid`,`spyListeners`,`enforceActions`,`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`allowStateReads`,`disableErrorBoundaries`,`runId`,`UNCHANGED`];var Yt=class{constructor(){this.version=7,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.isRunningUnobservations=!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.safeDescriptors=!0}};let Xt=!0,Zt=!1,A=function(){let e=globalThis;return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Xt=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==7&&(Xt=!1),Xt?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Yt):(setTimeout(()=>{Zt||n(35)},1),new Yt)}();function Qt(){if((A.pendingReactions.length||A.inBatch||A.isRunningReactions)&&n(36),Zt=!0,Xt){let e=globalThis;--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),A=new Yt}}function $t(){return A}function j(){let e=new Yt;for(let t in e)Jt.indexOf(t)===-1&&(A[t]=e[t]);A.allowStateChanges=!A.enforceActions}function en(e){return!!e.observers_&&e.observers_.size>0}function tn(e){return e.observers_??new Set}function nn(e,t){(e.observers_??=new Set).add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function rn(e,t){let n=e.observers_;n&&(n.delete(t),n.size===0&&an(e))}function an(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,A.pendingUnobservations.push(e))}function on(){A.inBatch++}function sn(){--A.inBatch===0&&(_n(),!A.isRunningUnobservations&&A.pendingUnobservations.length>0&&cn())}function cn(){A.isRunningUnobservations=!0;try{let e=A.pendingUnobservations;for(let t=0;t<e.length;t++){let n=e[t];n.isPendingUnobservation=!1,(!n.observers_||n.observers_.size===0)&&(n.observers_=null,n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof jt&&n.suspend_())}A.pendingUnobservations=[]}finally{A.isRunningUnobservations=!1}}function ln(e){var t;e.isBeingObserved||(e.isBeingObserved=!0,e.onBO(),(t=e.observing_)==null||t.forEach(ln))}function un(e){Rt(e);let t=A.trackingDerivation;return t===null?((!e.observers_||e.observers_.size===0)&&A.inBatch>0&&an(e),!1):(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&A.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved)}function dn(e){var t;e.lowestObserverState_!==2&&(e.lowestObserverState_=2,(t=e.observers_)==null||t.forEach(e=>{e.dependenciesState_===0&&e.onBecomeStale_(),e.dependenciesState_=2}))}function fn(e){var t;e.lowestObserverState_!==2&&(e.lowestObserverState_=2,(t=e.observers_)==null||t.forEach(t=>{t.dependenciesState_===1?t.dependenciesState_=2:t.dependenciesState_===0&&(e.lowestObserverState_=0)}))}function pn(e){var t;e.lowestObserverState_===0&&(e.lowestObserverState_=1,(t=e.observers_)==null||t.forEach(e=>{e.dependenciesState_===0&&(e.dependenciesState_=1,e.onBecomeStale_())}))}var mn=class{constructor(e=`Reaction@`+u(),t,n,r){this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=-1,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.removeAbortListener_=void 0,this.name_=e,this.onInvalidate_=t,this.errorHandler_=n,this.requiresObservable_=r}get isDisposed(){return C(this.flags_,1)}set isDisposed(e){this.flags_=w(this.flags_,1,e)}get isScheduled(){return C(this.flags_,2)}set isScheduled(e){this.flags_=w(this.flags_,2,e)}get isTrackPending(){return C(this.flags_,4)}set isTrackPending(e){this.flags_=w(this.flags_,4,e)}get isRunning(){return C(this.flags_,8)}set isRunning(e){this.flags_=w(this.flags_,8,e)}get diffValue(){return+!!C(this.flags_,16)}set diffValue(e){this.flags_=w(this.flags_,16,e===1)}onBecomeStale_(){this.schedule_()}schedule_(){this.isScheduled||(this.isScheduled=!0,A.pendingReactions.push(this),_n())}runReaction_(){if(!this.isDisposed){on(),this.isScheduled=!1;let e=A.trackingContext;if(A.trackingContext=this,Ft(this)){this.isTrackPending=!0;try{this.onInvalidate_(),this.isTrackPending&&xn()&&Sn({name:this.name_,type:`scheduled-reaction`})}catch(e){this.reportExceptionInDerivation_(e)}}A.trackingContext=e,sn()}}track(e){if(this.isDisposed)return;on();let t=xn(),n;t&&(n=Date.now(),Cn({name:this.name_,type:`reaction`})),this.isRunning=!0;let r=A.trackingContext;A.trackingContext=this;let i=zt(this,e,void 0);A.trackingContext=r,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ht(this),Pt(i)&&this.reportExceptionInDerivation_(i.cause),t&&Tn({time:Date.now()-n}),sn()}reportExceptionInDerivation_(e){if(this.errorHandler_){this.errorHandler_(e,this);return}if(A.disableErrorBoundaries)throw e;let t=`[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '${this}'`;A.suppressReactionErrors?console.warn(`[mobx] (error in reaction '${this.name_}' suppressed, fix error of causing action below)`):console.error(t,e),xn()&&Sn({type:`error`,name:this.name_,message:t,error:``+e}),A.globalReactionErrorHandlers.forEach(t=>t(e,this))}dispose(){if(!this.isDisposed){var e;this.isDisposed=!0,(e=this.removeAbortListener_)==null||e.call(this),this.isRunning||(on(),Ht(this),sn())}}getDisposer_(e){let t=()=>this.dispose();return e!=null&&e.addEventListener&&!this.isDisposed&&(e.addEventListener(`abort`,t),this.removeAbortListener_=()=>e.removeEventListener==null?void 0:e.removeEventListener(`abort`,t)),t[T]=this,`dispose`in Symbol&&typeof Symbol.dispose==`symbol`&&(t[Symbol.dispose]=t),t}toString(){return`Reaction[${this.name_}]`}};function hn(e){return A.globalReactionErrorHandlers.push(e),()=>{let t=A.globalReactionErrorHandlers.indexOf(e);t>=0&&A.globalReactionErrorHandlers.splice(t,1)}}let gn=e=>e();function _n(){A.inBatch>0||A.isRunningReactions||gn(vn)}function vn(){A.isRunningReactions=!0;let e=A.pendingReactions,t=0;for(;e.length>0;){++t===100&&(console.error(`Reaction doesn't converge to a stable state after 100 iterations. Probably there is a cycle in the reactive function: ${e[0]}`),e.splice(0));let n=e.splice(0);for(let e=0,t=n.length;e<t;e++)n[e].runReaction_()}A.isRunningReactions=!1}let yn=b(`Reaction`,mn);function bn(e){let t=gn;gn=n=>e(()=>t(n))}function xn(){return!!A.spyListeners.length}function Sn(e){if(!A.spyListeners.length)return;let t=A.spyListeners;for(let n=0,r=t.length;n<r;n++)t[n](e)}function Cn(e){Sn(r({},e,{spyReportStart:!0}))}let wn={type:`report-end`,spyReportEnd:!0};function Tn(e){Sn(e?r({},e,{type:`report-end`,spyReportEnd:!0}):wn)}function En(e){return A.spyListeners.push(e),d(()=>{A.spyListeners=A.spyListeners.filter(t=>t!==e)})}let M=`action`,Dn=`autoAction`,On=`<unnamed action>`,kn=we(M),An=we(`action.bound`,{bound:!0}),jn=we(Dn,{autoAction:!0}),Mn=we(`autoAction.bound`,{autoAction:!0,bound:!0});function Nn(e){return Ze(e,De)}function Pn(e){return function(t,r){if(r&&typeof r.kind==`string`)return De(e?jn:kn,t,r);if(p(t))return St(t.name||On,t,e);if(p(r))return St(t,r,e);if(m(t))return Nn(we(e?Dn:M,{name:t,autoAction:e}));n("Invalid arguments for `action`")}}let Fn=Pn(!1);r(Fn,kn);let In=Pn(!0);r(In,jn);let Ln=Nn(An),Rn=Nn(Mn);function zn(e){return Ct(e.name||On,!1,e,this,void 0)}function Bn(e){return p(e)&&e.isMobxAction===!0}function Vn(e,t=c){var r;p(e)||n(`Autorun expects a function as first argument`),Bn(e)&&n(`Autorun does not accept actions since actions are untrackable`);let i=t?.name??(e.name||`Autorun@`+u()),a=!t.scheduler&&!t.delay,o;if(a)o=new mn(i,function(){this.track(s)},t.onError,t.requiresObservable);else{let e=Un(t),n=!1;o=new mn(i,()=>{n||(n=!0,e(()=>{n=!1,o.isDisposed||o.track(s)}))},t.onError,t.requiresObservable)}function s(){e(o)}return t!=null&&(r=t.signal)!=null&&r.aborted||o.schedule_(),o.getDisposer_(t?.signal)}let Hn=e=>e();function Un(e){return e.scheduler?e.scheduler:e.delay?t=>setTimeout(t,e.delay):Hn}function Wn(e,t,r=c){var i;(!p(e)||!p(t))&&n(`First and second argument to reaction should be functions`),g(r)||n(`Third argument of reactions should be an object`);let a=r.name??`Reaction@`+u(),o=Fn(a,r.onError?Gn(r.onError,t):t),s=!r.scheduler&&!r.delay,l=Un(r),d=!0,f=!1,m,h=r.equals||me,_=new mn(a,()=>{d||s?v():f||(f=!0,l(v))},r.onError,r.requiresObservable);function v(){if(f=!1,_.isDisposed)return;let t=!1,n=m;_.track(()=>{let n=Et(!1,()=>e(_));t=d||!h(m,n),m=n}),(d&&r.fireImmediately||!d&&t)&&o(m,n,_),d=!1}return r!=null&&(i=r.signal)!=null&&i.aborted||_.schedule_(),_.getDisposer_(r?.signal)}function Gn(e,t){return function(){try{return t.apply(this,arguments)}catch(t){e.call(this,t)}}}function Kn(e,t,n){return Jn(`onBO`,e,t,n)}function qn(e,t,n){return Jn(`onBUO`,e,t,n)}function Jn(e,t,n,r){let i=typeof r==`function`?Ni(t,n):Ni(t),a=p(r)?r:n,o=`${e}L`;return i[o]?i[o].add(a):i[o]=new Set([a]),function(){let e=i[o];e&&(e.delete(a),e.size===0&&delete i[o])}}let Yn=`always`;function Xn(e){e.isolateGlobalState===!0&&Qt();let{enforceActions:t}=e;if(t!==void 0){let e=t===Yn?Yn:t===`observed`;A.enforceActions=e,A.allowStateChanges=!(e===!0||e===Yn)}[`computedRequiresReaction`,`reactionRequiresObservable`,`observableRequiresReaction`,`disableErrorBoundaries`,`safeDescriptors`].forEach(t=>{t in e&&(A[t]=!!e[t])}),A.allowStateReads=!A.observableRequiresReaction,A.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&bn(e.reactionScheduler)}function Zn(e,t,r,i){arguments.length>4&&n(`'extendObservable' expected 2-4 arguments`),typeof e!=`object`&&n(`'extendObservable' expects an object as first argument`),_i(e)&&n(`'extendObservable' should not be used on maps, use map.merge instead`),g(t)||n(`'extendObservable' only accepts plain objects as second argument`),(Sr(t)||Sr(r))&&n(`Extending an object with another observable (object) is not supported`);let a=oe(t);return Ii(()=>{let t=Di(e,i)[T];ne(a).forEach(e=>{t.extend_(e,a[e],r&&e in r?r[e]:!0)})}),e}function Qn(e,t){return $n(Ni(e,t))}function $n(e){let t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=nr(e.observing_).map($n)),t}function er(e,t){return tr(Ni(e,t))}function tr(e){let t={name:e.name_};return en(e)&&(t.observers=Array.from(tn(e),tr)),t}function nr(e){return Array.from(new Set(e))}let rr=0;var ir=class extends Error{constructor(){super(`FLOW_CANCELLED`),Object.setPrototypeOf(this,new.target.prototype),this.name=`FlowCancellationError`}toString(){return`Error: ${this.message}`}};function ar(e){return e instanceof ir}function or(e){return Ze(e,Me)}let sr=ke(`flow`),cr=ke(`flow.bound`,{bound:!0}),lr=r(function(e,t){if(t&&typeof t.kind==`string`)return Me(sr,e,t);arguments.length!==1&&n(`Flow expects single argument with generator function`);let r=e,i=r.name||`<unnamed flow>`,a=function(){let e=this,t=arguments,n=++rr,a=Fn(`${i} - runid: ${n} - init`,r).apply(e,t),o,s,c=new Promise(function(e,t){let r=0;o=t;function c(e){s=void 0;let o;try{o=Fn(`${i} - runid: ${n} - yield ${r++}`,a.next).call(a,e)}catch(e){return t(e)}u(o)}function l(e){s=void 0;let o;try{o=Fn(`${i} - runid: ${n} - yield ${r++}`,a.throw).call(a,e)}catch(e){return t(e)}u(o)}function u(n){if(p(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=Fn(`${i} - runid: ${n} - cancel`,function(){try{s&&dr(s);let e=a.return(void 0),t=Promise.resolve(e.value);t.then(f,f),dr(t),o(new ir)}catch(e){o(e)}}),c};return a.isMobXFlow=!0,a},sr),ur=or(cr);function dr(e){p(e.cancel)&&e.cancel()}function fr(e){return e}function pr(e){return e?.isMobXFlow===!0}function mr(e,t,r){let i;if(_i(e)||pi(e)||At(e))i=Pi(e);else if(Ai(e)){if(!m(t))return n(`InterceptReads can only be used with a specific property, not with an object in general`);i=Pi(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,()=>{i.dehancer=void 0}):n(`An intercept reader was already established`)}function hr(e,t,n){return p(n)?_r(e,t,n):gr(e,t)}function gr(e,t){return Jr(Pi(e),t)}function _r(e,t,n){return Jr(Pi(e,t),n)}function vr(e,t){var n;if(t===void 0)return Mt(e);if(Ai(e)===!1)return!1;let r=e[T];return(n=r.lazyComputedKeys_)!=null&&n.has(t)?!0:r.values_.has(t)?Mt(Ni(e,t)):!1}function yr(e){return arguments.length>1?n(`isComputed expects only 1 argument. Use isComputedProp to inspect the observability of a property`):vr(e)}function br(e,t){return m(t)?vr(e,t):n(`isComputed expected a property name as second argument`)}function xr(e,t){if(!e)return!1;if(t!==void 0){if(_i(e)||pi(e))return n(`isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead.`);if(Ai(e)){var r,i;let n=e[T];return n.values_.has(t)||!!((r=n.lazyComputedKeys_)!=null&&r.has(t))||!!((i=n.lazyObservableKeys_)!=null&&i.has(t))}return!1}return Ai(e)||!!e[T]||le(e)||yn(e)||Mt(e)}function Sr(e){return arguments.length!==1&&n(`isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property`),xr(e)}function Cr(e,t){return m(t)?xr(e,t):n(`expected a property name as second argument`)}function wr(e){if(Ai(e))return e[T].keys_();if(_i(e)||Si(e))return Array.from(e.keys());if(pi(e))return e.map((e,t)=>t);n(5)}function Tr(e){if(Ai(e))return wr(e).map(t=>e[t]);if(_i(e))return wr(e).map(t=>e.get(t));if(Si(e))return Array.from(e.values());if(pi(e))return e.slice();n(6)}function Er(e){if(Ai(e))return wr(e).map(t=>[t,e[t]]);if(_i(e))return wr(e).map(t=>[t,e.get(t)]);if(Si(e))return Array.from(e.entries());if(pi(e))return e.map((e,t)=>[t,e]);n(7)}function Dr(e,t,r){if(arguments.length===2&&!Si(e)){on();let n=t;try{for(let t in n)Dr(e,t,n[t])}finally{sn()}return}Ai(e)?e[T].set_(t,r):_i(e)?e.set(t,r):Si(e)?e.add(t):pi(e)?(typeof t!=`number`&&(t=parseInt(t,10)),t<0&&n(42,t),on(),t>=e.length&&(e.length=t+1),e[t]=r,sn()):n(8)}function Or(e,t){Ai(e)?e[T].delete_(t):_i(e)||Si(e)?e.delete(t):pi(e)?(typeof t!=`number`&&(t=parseInt(t,10)),e.splice(t,1)):n(9)}function kr(e,t){if(Ai(e))return e[T].has_(t);if(_i(e)||Si(e))return e.has(t);if(pi(e))return t>=0&&t<e.length;n(10)}function Ar(e,t){if(kr(e,t)){if(Ai(e))return e[T].get_(t);if(_i(e))return e.get(t);if(pi(e))return e[t];n(11)}}function jr(e,t,r){if(Ai(e))return e[T].defineProperty_(t,r);n(39)}function Mr(e){if(Ai(e))return e[T].ownKeys_();n(38)}function Nr(e,t,n,r){return p(n)?Fr(e,t,n,r):Pr(e,t,n)}function Pr(e,t,r){let i=Pi(e);if(pi(e))r&&t({observableKind:`array`,object:i.proxy_,debugObjectName:i.atom_.name_,type:`splice`,index:0,added:i.values_.slice(),addedCount:i.values_.length,removed:[],removedCount:0});else if(_i(e))r===!0&&n("`observe` doesn't support fireImmediately=true in combination with maps.");else if(Si(e))r===!0&&n("`observe` doesn't support fireImmediately=true in combination with sets.");else if(Ai(e))r===!0&&n("`observe` doesn't support the fire immediately property for observable objects.");else return Ir(i,t,r);return Zr(i,t)}function Fr(e,t,n,r){return Ir(Pi(e,t),n,r)}function Ir(e,t,n){if(Mt(e)){let r=!0,i;return Vn(()=>{let a=e.get();if(!r||n){let n=Wt();t({observableKind:`computed`,debugObjectName:e.name_,type:ii,object:e,newValue:a,oldValue:i}),Gt(n)}r=!1,i=a})}return n&&t({observableKind:`value`,debugObjectName:e.name_,object:e,type:ii,newValue:e.value_,oldValue:void 0}),Zr(e,t)}function Lr(e,t,n){return e.set(t,n),n}function Rr(e,t){if(typeof e!=`object`||!e||e instanceof Date||!Sr(e))return e;if(At(e)||Mt(e))return Rr(e.get(),t);if(t.has(e))return t.get(e);if(pi(e)){let n=Lr(t,e,Array(e.length));return e.forEach((e,r)=>{n[r]=Rr(e,t)}),n}if(Si(e)){let n=Lr(t,e,new Set);return e.forEach(e=>{n.add(Rr(e,t))}),n}if(_i(e)){let n=Lr(t,e,new Map);return e.forEach((e,r)=>{n.set(r,Rr(e,t))}),n}else{let n=Lr(t,e,{});return Mr(e).forEach(r=>{o.propertyIsEnumerable.call(e,r)&&(n[r]=Rr(e[r],t))}),n}}function zr(e,t){return t&&n(`toJS no longer supports options`),Rr(e,new Map)}function Br(e,t=void 0){on();try{return e.apply(t)}finally{sn()}}function Vr(e,t,n){return arguments.length===1||t&&typeof t==`object`?Ur(e,t):Hr(e,t,n||{})}function Hr(e,t,n){let r;if(typeof n.timeout==`number`){let e=Error(`WHEN_TIMEOUT`);r=setTimeout(()=>{if(!a[T].isDisposed)if(a(),n.onError)n.onError(e);else throw e},n.timeout)}n.name=n.name||`When@`+u();let i=St(n.name+`-effect`,t);var a=Vn(t=>{Et(!1,e)&&(t.dispose(),r&&clearTimeout(r),i())},n);return a}function Ur(e,t){var i;if(t&&t.onError)return n(`the options 'onError' and 'promise' cannot be combined`);if(t!=null&&(i=t.signal)!=null&&i.aborted)return r(Promise.reject(Error(`WHEN_ABORTED`)),{cancel:()=>null});let a,o,s=new Promise((n,i)=>{var s;let c=Hr(e,n,r({},t,{onError:i}));a=()=>{c(),i(Error(`WHEN_CANCELLED`))},o=()=>{c(),i(Error(`WHEN_ABORTED`))},t==null||(s=t.signal)==null||s.addEventListener==null||s.addEventListener(`abort`,o)}).finally(()=>{var e;return t==null||(e=t.signal)==null||e.removeEventListener==null?void 0:e.removeEventListener(`abort`,o)});return s.cancel=a,s}function Wr(e){return e[T]}let Gr={has(e,t){return Wr(e).has_(t)},get(e,t){return Wr(e).get_(t)},set(e,t,n){return m(t)?Wr(e).set_(t,n,!0)??!0:!1},deleteProperty(e,t){return m(t)?Wr(e).delete_(t,!0)??!0:!1},defineProperty(e,t,n){return Wr(e).defineProperty_(t,n)??!0},ownKeys(e){return Wr(e).ownKeys_()},preventExtensions(e){n(13)}};function Kr(e,t){var n;return e=Di(e,t),(n=e[T]).proxy_??(n.proxy_=new Proxy(e,Gr))}function qr(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Jr(e,t){let n=e.interceptors_;return n?n.push(t):n=e.interceptors_=[t],d(()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function Yr(e,t){let r=Wt();try{let r=[...e.interceptors_||[]];for(let e=0,i=r.length;e<i&&(t=r[e](t),t&&!t.type&&n(14),t);e++);return t}finally{Gt(r)}}function Xr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Zr(e,t){let n=e.changeListeners_;return n?n.push(t):n=e.changeListeners_=[t],d(()=>{let e=n.indexOf(t);e!==-1&&n.splice(e,1)})}function Qr(e,t){let n=Wt(),r=e.changeListeners_;if(r){r=r.slice();for(let e=0,n=r.length;e<n;e++)r[e](t);Gt(n)}}function $r(e,t,n){return Ii(()=>{let r=Di(e,n)[T];ne(t).forEach(e=>ni(r,e,t[e]))}),e}let ei=Symbol(`mobx-keys`);function ti(e,t,r){return!g(e)&&!g(Object.getPrototypeOf(e))&&n(`'makeAutoObservable' can only be used for classes that don't have a superclass`),Ai(e)&&n(`makeAutoObservable can only be used on objects not already made observable`),g(e)?Zn(e,e,t,r):(Ii(()=>{let n=Di(e,r)[T];if(!e[ei]){let t=Object.getPrototypeOf(e),n=new Set([...ne(e),...ne(t)]);n.delete(`constructor`),n.delete(T),v(t,ei,n)}e[ei].forEach(e=>ni(n,e,t&&e in t?t[e]:!0))}),e)}function ni(e,t,r){if(r===!0&&(r=e.defaultAnnotation_),r===!1)return;Mi(e,r,t),t in e.target_||n(1,r.annotationType_,`${e.name_}.${t.toString()}`);let a=e.target_;for(;a&&a!==o;){let n=i(a,t);if(n){let i=r.make_(e,t,n,a);if(i===0)return;if(i===1)break}a=Object.getPrototypeOf(a)}ji(e,r,t)}let ri=`splice`,ii=`update`,ai={get(e,t){let n=e[T];return t===T?n:t===`length`?n.getArrayLength_():typeof t==`string`&&!isNaN(t)?n.get_(parseInt(t)):ae(ci,t)?ci[t]:e[t]},set(e,t,n){let r=e[T];return t===`length`?r.setArrayLength_(n):typeof t==`symbol`||isNaN(t)?e[t]=n:r.set_(parseInt(t),n),!0},preventExtensions(){n(15)}};var oi=class{constructor(e=`ObservableArray@`+u(),t,n){this.owned_=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.atom_=new ce(e),this.enhancer_=(n,r)=>t(n,r,e+`[..]`)}dehanceValue_(e){return this.dehancer===void 0?e:this.dehancer(e)}dehanceValues_(e){return this.dehancer!==void 0&&e.length>0?e.map(this.dehancer):e}getArrayLength_(){return this.atom_.reportObserved(),this.values_.length}setArrayLength_(e){(!Number.isInteger(e)||e<0)&&n(40,e);let t=this.values_.length;if(e!==t)if(e>t){let n=Array.from({length:e-t});this.spliceWithArray_(t,0,n)}else this.spliceWithArray_(e,t-e)}updateArrayLength_(e,t){e!==this.lastKnownLength_&&n(16),this.lastKnownLength_+=t}spliceWithArray_(e,t,n){Lt(this.atom_);let r=this.values_.length;if(e===void 0?e=0:e>r?e=r:e<0&&(e=Math.max(0,r+e)),t=arguments.length===1?r-e:t==null?0:Math.max(0,Math.min(t,r-e)),n===void 0&&(n=s),qr(this)){let r=Yr(this,{object:this.proxy_,type:ri,index:e,removedCount:t,added:n});if(!r)return s;t=r.removedCount,n=r.added}n=n.length===0?n:n.map(e=>this.enhancer_(e,void 0));{let e=n.length-t;this.updateArrayLength_(r,e)}let i=this.spliceItemsIntoValues_(e,t,n);return(t!==0||n.length!==0)&&this.notifyArraySplice_(e,n,i),this.dehanceValues_(i)}spliceItemsIntoValues_(e,t,n){if(n.length<1e4)return this.values_.splice(e,t,...n);{let r=this.values_.slice(e,e+t),i=this.values_.slice(e+t);this.values_.length+=n.length-t;for(let t=0;t<n.length;t++)this.values_[e+t]=n[t];for(let t=0;t<i.length;t++)this.values_[e+n.length+t]=i[t];return r}}notifyArrayChildUpdate_(e,t,n){let r=!this.owned_&&xn(),i=Xr(this),a=i||r?{observableKind:`array`,object:this.proxy_,type:ii,debugObjectName:this.atom_.name_,index:e,newValue:t,oldValue:n}:null;r&&Cn(a),this.atom_.reportChanged(),i&&Qr(this,a),r&&Tn()}notifyArraySplice_(e,t,n){let r=!this.owned_&&xn(),i=Xr(this),a=i||r?{observableKind:`array`,object:this.proxy_,debugObjectName:this.atom_.name_,type:ri,index:e,removed:n,added:t,removedCount:n.length,addedCount:t.length}:null;r&&Cn(a),this.atom_.reportChanged(),i&&Qr(this,a),r&&Tn()}get_(e){return this.atom_.reportObserved(),this.dehanceValue_(this.values_[e])}set_(e,t){let n=this.values_;if(e<n.length){Lt(this.atom_);let r=n[e];if(qr(this)){let n=Yr(this,{type:ii,object:this.proxy_,index:e,newValue:t});if(!n)return;t=n.newValue}t=this.enhancer_(t,r),t!==r&&(n[e]=t,this.notifyArrayChildUpdate_(e,t,r))}else{let r=Array.from({length:e+1-n.length});r[r.length-1]=t,this.spliceWithArray_(n.length,0,r)}}};function si(e,t,n=`ObservableArray@`+u(),r=!1){return Ii(()=>{let i=new oi(n,t,r);y(i.values_,T,i);let a=new Proxy(i.values_,ai);return i.proxy_=a,e&&e.length&&i.spliceWithArray_(0,0,e),a})}var ci={clear(){return this.splice(0)},replace(e){let t=this[T];return t.spliceWithArray_(0,t.values_.length,e)},toJSON(){return this.slice()},splice(e,t,...n){let r=this[T];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(e,t,n){return this[T].spliceWithArray_(e,t,n)},push(...e){let t=this[T];return t.spliceWithArray_(t.values_.length,0,e),t.values_.length},pop(){return this.splice(Math.max(this[T].values_.length-1,0),1)[0]},shift(){return this.splice(0,1)[0]},unshift(...e){let t=this[T];return t.spliceWithArray_(0,0,e),t.values_.length},reverse(){return A.trackingDerivation&&n(37,`reverse`),this.replace(this.slice().reverse()),this},sort(){A.trackingDerivation&&n(37,`sort`);let e=this.slice();return e.sort.apply(e,arguments),this.replace(e),this},remove(e){let t=this[T],n=t.dehanceValues_(t.values_).indexOf(e);return n>-1?(this.splice(n,1),!0):!1}};N(`at`,li),N(`concat`,li),N(`flat`,li),N(`includes`,li),N(`indexOf`,li),N(`join`,li),N(`lastIndexOf`,li),N(`slice`,li),N(`toString`,li),N(`toLocaleString`,li),N(`toSorted`,li),N(`toSpliced`,li),N(`with`,li),N(`every`,ui),N(`filter`,ui),N(`find`,ui),N(`findIndex`,ui),N(`findLast`,ui),N(`findLastIndex`,ui),N(`flatMap`,ui),N(`forEach`,ui),N(`map`,ui),N(`some`,ui),N(`toReversed`,ui),N(`reduce`,di),N(`reduceRight`,di);function N(e,t){typeof Array.prototype[e]==`function`&&(ci[e]=t(e))}function li(e){return function(){let t=this[T];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function ui(e){return function(t,n){let r=this[T];return r.atom_.reportObserved(),r.dehanceValues_(r.values_)[e]((e,r)=>t.call(n,e,r,this))}}function di(e){return function(){let t=this[T];t.atom_.reportObserved();let n=t.dehanceValues_(t.values_),r=arguments[0];return arguments[0]=(e,t,n)=>r(e,t,n,this),n[e].apply(n,arguments)}}let fi=b(`ObservableArrayAdministration`,oi);function pi(e){return h(e)&&fi(e[T])}let mi={},hi=`delete`;var gi=class{constructor(e,t=he,n=`ObservableMap@`+u()){this.enhancer_=void 0,this.name_=void 0,this[T]=mi,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_=n,Ii(()=>{this.keysAtom_=ue(`${this.name_}.keys()`),this.data_=new Map,this.hasMap_=new Map,e&&this.merge(e)})}has_(e){return this.data_.has(e)}has(e){if(!A.trackingDerivation)return this.has_(e);let t=this.hasMap_.get(e);if(!t){let n=t=new kt(this.has_(e),_e,`${this.name_}.${re(e)}?`,!1);this.hasMap_.set(e,n),n.onBUOL=new Set([()=>this.hasMap_.delete(e)])}return t.get()}set(e,t){let n=this.has_(e);if(qr(this)){let r=Yr(this,{type:n?ii:`add`,object:this,newValue:t,name:e});if(!r)return this;t=r.newValue}return n?this.updateValue_(e,t):this.addValue_(e,t),this}delete(e){if(Lt(this.keysAtom_),qr(this)&&!Yr(this,{type:hi,object:this,name:e}))return!1;if(this.has_(e)){let t=xn(),n=Xr(this),r=n||t?{observableKind:`map`,debugObjectName:this.name_,type:hi,object:this,oldValue:this.data_.get(e).value_,name:e}:null;return t&&Cn(r),Br(()=>{var t;this.keysAtom_.reportChanged(),(t=this.hasMap_.get(e))==null||t.setNewValue_(!1),this.data_.get(e).setNewValue_(void 0),this.data_.delete(e)}),n&&Qr(this,r),t&&Tn(),!0}return!1}updateValue_(e,t){let n=this.data_.get(e);if(t=n.prepareNewValue_(t),t!==A.UNCHANGED){let r=xn(),i=Xr(this),a=i||r?{observableKind:`map`,debugObjectName:this.name_,type:ii,object:this,oldValue:n.value_,name:e,newValue:t}:null;r&&Cn(a),n.setNewValue_(t),i&&Qr(this,a),r&&Tn()}}addValue_(e,t){Lt(this.keysAtom_),Br(()=>{var n;let r=new kt(t,this.enhancer_,`${this.name_}.${re(e)}`,!1);this.data_.set(e,r),t=r.value_,(n=this.hasMap_.get(e))==null||n.setNewValue_(!0),this.keysAtom_.reportChanged()});let n=xn(),r=Xr(this),i=r||n?{observableKind:`map`,debugObjectName:this.name_,type:`add`,object:this,name:e,newValue:t}:null;n&&Cn(i),r&&Qr(this,i),n&&Tn()}get(e){return this.has(e)?this.dehanceValue_(this.data_.get(e).get()):this.dehanceValue_(void 0)}getOrInsert(e,t){return this.has(e)||this.set(e,t),this.get(e)}getOrInsertComputed(e,t){return this.has(e)||this.set(e,t(e)),this.get(e)}dehanceValue_(e){return this.dehancer===void 0?e:this.dehancer(e)}keys(){return this.keysAtom_.reportObserved(),this.data_.keys()}values(){let e=this,t=this.keys();return vi({next(){let{done:n,value:r}=t.next();return{done:n,value:n?void 0:e.get(r)}}})}entries(){let e=this,t=this.keys();return vi({next(){let{done:n,value:r}=t.next();return{done:n,value:n?void 0:[r,e.get(r)]}}})}[Symbol.iterator](){return this.entries()}forEach(e,t){for(let[n,r]of this)e.call(t,r,n,this)}merge(e){return _i(e)&&(e=new Map(e)),Br(()=>{g(e)?te(e).forEach(t=>this.set(t,e[t])):Array.isArray(e)?e.forEach(([e,t])=>this.set(e,t)):ee(e)?(x(e)||n(19,e),e.forEach((e,t)=>this.set(t,e))):e!=null&&n(20,e)}),this}clear(){Br(()=>{Ut(()=>{for(let e of this.keys())this.delete(e)})})}replace(e){return Br(()=>{let t=yi(e),n=new Map,r=!1;for(let e of this.data_.keys())if(!t.has(e))if(this.delete(e))r=!0;else{let t=this.data_.get(e);n.set(e,t)}for(let[e,i]of t.entries()){let t=this.data_.has(e);if(this.set(e,i),this.data_.has(e)){let i=this.data_.get(e);n.set(e,i),t||(r=!0)}}if(!r)if(this.data_.size!==n.size)this.keysAtom_.reportChanged();else{let e=this.data_.keys(),t=n.keys(),r=e.next(),i=t.next();for(;!r.done;){if(r.value!==i.value){this.keysAtom_.reportChanged();break}r=e.next(),i=t.next()}}this.data_=n}),this}get size(){return this.keysAtom_.reportObserved(),this.data_.size}toString(){return`[object ObservableMap]`}toJSON(){return Array.from(this)}get[Symbol.toStringTag](){return`Map`}},_i=b(`ObservableMap`,gi);function vi(e){return e[Symbol.toStringTag]=`MapIterator`,zi(e)}function yi(e){if(ee(e)||_i(e))return e;if(Array.isArray(e))return new Map(e);if(g(e)){let t=new Map;for(let n in e)t.set(n,e[n]);return t}else return n(21,e)}let bi={};var xi=class{constructor(e,t=he,n=`ObservableSet@`+u()){this.name_=void 0,this[T]=bi,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_=n,this.enhancer_=(e,r)=>t(e,r,n),Ii(()=>{this.atom_=ue(this.name_),e&&this.replace(e)})}dehanceValue_(e){return this.dehancer===void 0?e:this.dehancer(e)}clear(){Br(()=>{Ut(()=>{for(let e of this.data_.values())this.delete(e)})})}forEach(e,t){for(let n of this)e.call(t,n,n,this)}get size(){return this.atom_.reportObserved(),this.data_.size}add(e){if(Lt(this.atom_),qr(this)){let t=Yr(this,{type:`add`,object:this,newValue:e});if(!t)return this;e=t.newValue}if(!this.has(e)){Br(()=>{e=this.enhancer_(e,void 0),this.data_.add(e),this.atom_.reportChanged()});let t=xn(),n=Xr(this),r=n||t?{observableKind:`set`,debugObjectName:this.name_,type:`add`,object:this,newValue:e}:null;t&&Cn(r),n&&Qr(this,r),t&&Tn()}return this}delete(e){if(qr(this)&&!Yr(this,{type:hi,object:this,oldValue:e}))return!1;if(this.has(e)){let t=xn(),n=Xr(this),r=n||t?{observableKind:`set`,debugObjectName:this.name_,type:hi,object:this,oldValue:e}:null;return t&&Cn(r),Br(()=>{this.atom_.reportChanged(),this.data_.delete(e)}),n&&Qr(this,r),t&&Tn(),!0}return!1}has(e){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(e))}entries(){let e=this.values();return Ci({next(){let{value:t,done:n}=e.next();return n?{value:void 0,done:n}:{value:[t,t],done:n}}})}keys(){return this.values()}values(){this.atom_.reportObserved();let e=this,t=this.data_.values();return Ci({next(){let{value:n,done:r}=t.next();return r?{value:void 0,done:r}:{value:e.dehanceValue_(n),done:r}}})}intersection(e){return new Set(this).intersection(e)}union(e){return new Set(this).union(e)}difference(e){return new Set(this).difference(e)}symmetricDifference(e){return new Set(this).symmetricDifference(e)}isSubsetOf(e){return new Set(this).isSubsetOf(e)}isSupersetOf(e){return new Set(this).isSupersetOf(e)}isDisjointFrom(e){return new Set(this).isDisjointFrom(e)}replace(e){return Si(e)&&(e=new Set(e)),Array.isArray(e)||S(e)?Br(()=>{let t=S(e)?e:new Set(e);if(t.size===0){this.clear();return}if(this.data_.size===0){t.forEach(e=>this.add(e));return}for(let e of this.data_.values())t.has(this.dehanceValue_(e))||this.delete(e);t.forEach(e=>this.add(e))}):e!=null&&n(41,e),this}toJSON(){return Array.from(this)}toString(){return`[object ObservableSet]`}[Symbol.iterator](){return this.values()}get[Symbol.toStringTag](){return`Set`}},Si=b(`ObservableSet`,xi);function Ci(e){return e[Symbol.toStringTag]=`SetIterator`,zi(e)}let wi=Object.create(null),Ti=`remove`;var Ei=class{constructor(e,t=new Map,r,i=Ge){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.lazyComputedKeys_=void 0,this.lazyObservableKeys_=void 0,this.target_=e,this.values_=t,this.name_=r,this.defaultAnnotation_=i,this.keysAtom_=new ce(`${this.name_}.keys`),this.isPlainObject_=g(this.target_),Vi(this.defaultAnnotation_)||n(`defaultAnnotation must be valid annotation`),this.appliedAnnotations_={}}getObservablePropValue_(e){return(this.values_.get(e)??this.materializeLazyComputed_(e)??this.materializeLazyObservable_(e)).get()}materializeLazyComputed_(e){let t=this.lazyComputedKeys_?.get(e);if(!t)return;this.lazyComputedKeys_.delete(e),this.lazyComputedKeys_.size===0&&(this.lazyComputedKeys_=void 0);let n=t();return this.values_.set(e,n),n}materializeLazyObservable_(e){let t=this.lazyObservableKeys_?.get(e);if(!t)return;this.lazyObservableKeys_.delete(e),this.lazyObservableKeys_.size===0&&(this.lazyObservableKeys_=void 0);let n=t();return this.values_.set(e,n),n}setObservablePropValue_(e,t){let n=this.values_.get(e)??this.materializeLazyComputed_(e)??this.materializeLazyObservable_(e);if(n instanceof jt)return n.set(t),!0;if(qr(this)){let n=Yr(this,{type:ii,object:this.proxy_||this.target_,name:e,newValue:t});if(!n)return null;t=n.newValue}if(t=n.prepareNewValue_(t),t!==A.UNCHANGED){let r=Xr(this),i=xn(),a=r||i?{type:ii,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:n.value_,name:e,newValue:t}:null;i&&Cn(a),n.setNewValue_(t),r&&Qr(this,a),i&&Tn()}return!0}get_(e){return A.trackingDerivation&&!ae(this.target_,e)&&this.has_(e),this.target_[e]}set_(e,t,n=!1){return 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)}has_(e){if(!A.trackingDerivation)return e in this.target_;this.pendingKeys_||=new Map;let t=this.pendingKeys_.get(e);return t||(t=new kt(e in this.target_,_e,`${this.name_}.${re(e)}?`,!1),this.pendingKeys_.set(e,t)),t.get()}extend_(e,t,n,r=!1){if(n===!0&&(n=this.defaultAnnotation_),n===!1)return this.defineProperty_(e,t,r);Mi(this,n,e);let i=n.extend_(this,e,t,r);return i&&ji(this,n,e),i}defineProperty_(e,t,n=!1){Lt(this.keysAtom_);try{on();let i=this.delete_(e);if(!i)return i;if(qr(this)){let n=Yr(this,{object:this.proxy_||this.target_,name:e,type:`add`,newValue:t.value});if(!n)return null;let{newValue:i}=n;t.value!==i&&(t=r({},t,{value:i}))}if(n){if(!Reflect.defineProperty(this.target_,e,t))return!1}else a(this.target_,e,t);this.notifyPropertyAddition_(e,t.value)}finally{sn()}return!0}defineObservableProperty_(e,t,n,r=!1){Lt(this.keysAtom_);try{on();let i=this.delete_(e);if(!i)return i;if(qr(this)){let n=Yr(this,{object:this.proxy_||this.target_,name:e,type:`add`,newValue:t});if(!n)return null;t=n.newValue}let o=ki(e),s={configurable:A.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:o.get,set:o.set};if(r){if(!Reflect.defineProperty(this.target_,e,s))return!1}else a(this.target_,e,s);let c=new kt(t,n,`${this.name_}.${e.toString()}`,!1);this.values_.set(e,c),this.notifyPropertyAddition_(e,c.value_)}finally{sn()}return!0}defineComputedProperty_(e,t,n=!1){Lt(this.keysAtom_);try{on();let r=this.delete_(e);if(!r)return r;if(qr(this)&&!Yr(this,{object:this.proxy_||this.target_,name:e,type:`add`,newValue:void 0}))return null;t.name||=`${this.name_}.${e.toString()}`,t.context=this.proxy_||this.target_;let i=ki(e),o={configurable:A.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:i.get,set:i.set};if(n){if(!Reflect.defineProperty(this.target_,e,o))return!1}else a(this.target_,e,o);this.values_.set(e,new jt(t)),this.notifyPropertyAddition_(e,void 0)}finally{sn()}return!0}delete_(e,t=!1){if(Lt(this.keysAtom_),!ae(this.target_,e))return!0;if(qr(this)&&!Yr(this,{object:this.proxy_||this.target_,name:e,type:Ti}))return null;try{var n;on();let r=Xr(this),a=xn(),o=this.values_.get(e),s;if(!o&&(r||a)&&(s=i(this.target_,e)?.value),t){if(!Reflect.deleteProperty(this.target_,e))return!1}else delete this.target_[e];if(delete this.appliedAnnotations_[e],o&&(this.values_.delete(e),o instanceof kt&&(s=o.value_),dn(o)),this.keysAtom_.reportChanged(),(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(e in this.target_),r||a){let t={type:Ti,observableKind:`object`,object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:s,name:e};a&&Cn(t),r&&Qr(this,t),a&&Tn()}}finally{sn()}return!0}notifyPropertyAddition_(e,t){var n;let r=Xr(this),i=xn();if(r||i){let n=r||i?{type:`add`,observableKind:`object`,debugObjectName:this.name_,object:this.proxy_||this.target_,name:e,newValue:t}:null;i&&Cn(n),r&&Qr(this,n),i&&Tn()}(n=this.pendingKeys_)==null||(n=n.get(e))==null||n.set(!0),this.keysAtom_.reportChanged()}ownKeys_(){return this.keysAtom_.reportObserved(),ne(this.target_)}keys_(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)}};function Di(e,t){if(t&&Ai(e)&&n(`Options can't be provided for already observable objects.`),ae(e,T))return Pi(e)instanceof Ei||n(`Cannot convert '${Fi(e)}' into observable object:\nThe target is already observable of different type.\nExtending builtins is not supported.`),e;Object.isExtensible(e)||n(`Cannot make the designated object observable; it is not extensible`);let r=t?.name??`${g(e)?`ObservableObject`:e.constructor.name}@${u()}`;return v(e,T,new Ei(e,new Map,String(r),ot(t))),e}let Oi=b(`ObservableObjectAdministration`,Ei);function ki(e){return wi[e]||(wi[e]={get(){return this[T].getObservablePropValue_(e)},set(t){return this[T].setObservablePropValue_(e,t)}})}function Ai(e){return h(e)?Oi(e[T]):!1}function ji(e,t,n){e.appliedAnnotations_[n]=t}function Mi(e,t,r){if(Vi(t)||n(`Cannot annotate '${e.name_}.${r.toString()}': Invalid annotation.`),!xe(t)&&ae(e.appliedAnnotations_,r)){let i=`${e.name_}.${r.toString()}`,a=e.appliedAnnotations_[r].annotationType_,o=t.annotationType_;n(`Cannot apply '${o}' to '${i}':\nThe field is already annotated with '${a}'.\nRe-annotating fields is not allowed.\nUse 'override' annotation for methods overridden by subclass.`)}}function Ni(e,t){if(typeof e==`object`&&e){if(pi(e))return t!==void 0&&n(23),e[T].atom_;if(Si(e))return e.atom_;if(_i(e)){if(t===void 0)return e.keysAtom_;let r=e.data_.get(t)||e.hasMap_.get(t);return r||n(25,t,Fi(e)),r}if(Ai(e)){if(!t)return n(26);let r=e[T],i=r.values_.get(t)??r.materializeLazyComputed_(t)??r.materializeLazyObservable_(t);return i||n(27,t,Fi(e)),i}if(le(e)||Mt(e)||yn(e))return e}else if(p(e)&&yn(e[T]))return e[T];n(28)}function Pi(e,t){if(e||n(29),t!==void 0)return Pi(Ni(e,t));if(le(e)||Mt(e)||yn(e)||_i(e)||Si(e))return e;if(e[T])return e[T];n(24,e)}function Fi(e,t){let n;if(t!==void 0)n=Ni(e,t);else if(Bn(e))return e.name;else n=Ai(e)||_i(e)||Si(e)?Pi(e):Ni(e);return n.name_}function Ii(e){let t=Wt(),n=Dt(!0);on();try{return e()}finally{sn(),Ot(n),Gt(t)}}let Li=o.toString;function P(e,t,n=-1){return F(e,t,n)}function F(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;let a=typeof e;if(a!==`function`&&a!==`object`&&typeof t!=`object`)return!1;let o=Li.call(e);if(o!==Li.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=I(e),t=I(t);let s=o===`[object Array]`;if(!s){if(typeof e!=`object`||typeof t!=`object`)return!1;let n=e.constructor,r=t.constructor;if(n!==r&&!(p(n)&&n instanceof n&&p(r)&&r instanceof r)&&`constructor`in e&&`constructor`in t)return!1}if(n===0)return!1;n<0&&(n=-1),r||=[],i||=[];let c=r.length;for(;c--;)if(r[c]===e)return i[c]===t;if(r.push(e),i.push(t),s){if(c=e.length,c!==t.length)return!1;for(;c--;)if(!F(e[c],t[c],n-1,r,i))return!1}else{let a=Object.keys(e),o=a.length;if(Object.keys(t).length!==o)return!1;for(let s=0;s<o;s++){let o=a[s];if(!(ae(t,o)&&F(e[o],t[o],n-1,r,i)))return!1}}return r.pop(),i.pop(),!0}function I(e){return pi(e)?e.slice():ee(e)||_i(e)||S(e)||Si(e)?Array.from(e.entries()):e}let Ri=globalThis.Iterator?.prototype||{};function zi(e){return e[Symbol.iterator]=Bi,r(Object.create(Ri),e)}function Bi(){return this}function Vi(e){return e instanceof Object&&typeof e.annotationType_==`string`&&p(e.make_)&&p(e.extend_)}{let e=globalThis;[`Symbol`,`Map`,`Set`,`Proxy`].forEach(t=>{e[t]===void 0&&n(`MobX requires global '${t}' to be available or polyfilled`)})}typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__==`object`&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:En,extras:{getDebugName:Fi},$mobx:T}),e.$mobx=T,e.FlowCancellationError=ir,e.ObservableMap=gi,e.ObservableSet=xi,e.Reaction=mn,e._allowStateChanges=Et,e._allowStateChangesInsideComputed=zn,e._allowStateReadsEnd=Kt,e._allowStateReadsStart=k,e._autoAction=In,e._autoActionBound=Rn,e._endAction=Tt,e._getAdministration=Pi,e._getGlobalState=$t,e._interceptReads=mr,e._isComputingDerivation=It,e._resetGlobalState=j,e._startAction=wt,e.action=Fn,e.actionBound=Ln,e.autorun=Vn,e.compareDefault=me,e.compareIdentity=de,e.compareShallow=pe,e.compareStructural=fe,e.computed=O,e.computedStruct=_t,e.configure=Xn,e.createAtom=ue,e.defineProperty=jr,e.entries=Er,e.extendObservable=Zn,e.flow=lr,e.flowBound=ur,e.flowResult=fr,e.get=Ar,e.getAtom=Ni,e.getDebugName=Fi,e.getDependencyTree=Qn,e.getObserverTree=er,e.has=kr,e.intercept=hr,e.isAction=Bn,e.isBoxedObservable=At,e.isComputed=yr,e.isComputedProp=br,e.isFlow=pr,e.isFlowCancellationError=ar,e.isObservable=Sr,e.isObservableArray=pi,e.isObservableMap=_i,e.isObservableObject=Ai,e.isObservableProp=Cr,e.isObservableSet=Si,e.keys=wr,e.makeAutoObservable=ti,e.makeObservable=$r,e.observable=D,e.observableDeep=ft,e.observableRef=ut,e.observableShallow=dt,e.observableStruct=pt,e.observe=Nr,e.onBecomeObserved=Kn,e.onBecomeUnobserved=qn,e.onReactionError=hn,e.override=be,e.ownKeys=Mr,e.reaction=Wn,e.remove=Or,e.runInAction=zn,e.set=Dr,e.spy=En,e.toJS=zr,e.transaction=Br,e.untracked=Ut,e.values=Tr,e.when=Vr})),mb=Ee(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=fb():t.exports=pb()}))();function hb(e){if(Array.isArray(e))return Object.freeze(e.map(hb));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]=hb(r);return Object.freeze(t)}return e}function gb(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 _b(e){return typeof e==`string`?e:String(e)}function vb(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 yb(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")`)}var bb=class extends Error{constructor(e,t){super(t),this.variable=e}};function xb(e){return e instanceof bb||e instanceof Error&&e.cause!==void 0&&xb(e.cause)}var Sb=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?jb(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}},Cb=class extends Sb{name=`ParseError`;kind=`ParseError`;expected;found;constructor(e,t,n={}){super(e,t,n),this.expected=n.expected,this.found=n.found}},wb=class extends Sb{name=`EvalError`;kind=`EvalError`},Tb=class extends wb{name=`FuncNotFoundError`;kind=`FuncNotFoundError`;funcName;suggestions;constructor(e,t,n={}){let r=Mb(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}},Eb=class extends wb{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}},Db=class extends wb{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}},Ob=class extends Db{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)}`}},kb=class extends wb{name=`MissingFieldError`;kind=`MissingFieldError`;path;constructor(e,t,n={}){super(`field "${e.join(`.`)}" not found on receiver`,t,n),this.path=e}},Ab=class extends wb{name=`FailError`;kind=`FailError`;constructor(e,t={line:0,column:0,offset:0},n={}){super(e,t,n)}};function jb(e,t){let n=e.split(`
61
61
  `),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(`
62
62
  `)}function Mb(e,t){if(t.length===0)return[];let n=t.map(t=>({name:t,dist:Nb(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 Nb(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 Pb(e){throw Error(`unhandled node kind: ${JSON.stringify(e)}`)}const Fb=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`]]),Ib={left:`{{`,right:`}}`};var Lb=class{src;leftDelim;rightDelim;offset=0;line=1;column=1;mode=`text`;pending;constructor(e,t=Ib){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 Cb(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&&Rb(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);Rb(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);Rb(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(;Rb(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`;Rb(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&&(Bb(e)||zb(e)&&Bb(this.src[this.offset+1]??``)||e===`.`&&Bb(this.src[this.offset+1]??``)))return this.readNumber(t);if(e===`.`)return this.readDotOrField(t);if(e!==void 0&&Gb(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===`
63
63
  `)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===`
@@ -491,31 +491,31 @@ function run(argv) {
491
491
  `);return{inMode:n!==`0`,screen:r}}function $X(e,t,n){return[`load-buffer`,`-b`,t,`-`,`;`,...n.length===0?[]:[`send-keys`,`-t`,e,...n,`;`],`paste-buffer`,`-p`,`-d`,`-b`,t,`-t`,e,`;`,`send-keys`,`-t`,e,`Enter`]}function eZ(e,t){let n=ZX(e,`claude-input.type`,$X(e.pane,`cc-candybar-slash`,[`C-s`]),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 tZ(){return{read:QX,type:eZ}}function nZ(e){if(!e)throw new J(`session id is required`);if(e.includes(`/`)||e.includes(`..`))throw new J(`invalid session id "${e}"`);return e}function rZ(e){return iZ(()=>decodeURIComponent(e))}function iZ(e){try{return e()}catch(e){throw e instanceof URIError?new J(`malformed wire encoding: ${e.message}`):e}}function aZ(e,t){let n=We({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 oZ=(e,t)=>aZ(rZ(e),t),sZ=(e,t)=>{let n=We({bin:`/usr/bin/open`,args:[`-a`,`Visual Studio Code`,rZ(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`})`)}},cZ=(e,t)=>aZ(rZ(e),t),lZ=(e,t)=>aZ(rZ(e),t),uZ=(e,t)=>{let n=nZ(rZ(e));t.navigating.get(n,`toolbar-expanded`)?t.navigating.clear(n,`toolbar-expanded`):t.navigating.set(n,`toolbar-expanded`,`1`)},dZ=(e,t)=>{let[n=``,...r]=iZ(()=>xr(e)),i=nZ(n),a=gV(TZ(t,i));if(r.length===0)throw new J(`set-state: <key>/<value> is required (have keys: ${a.listKeys().join(`, `)})`);if(r.length%2!=0)throw new J(`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 J(`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 J(`set-state: pair ${e/2+1}: ${i.reason}`);o.push({key:t,value:i.value})}hZ(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})`)},fZ=/^-?\d+$/;function pZ(e,t,n,r){let i=e+t;return i>r?e===r?n:r:i<n?e===n?r:n:i}const mZ=(e,t)=>{let[n=``,r=``,i=``]=iZ(()=>xr(e)),a=nZ(n);if(!r)throw new J(`step-state: <key> is required (shape: <sessionId>/<key>/<by>)`);if(!fZ.test(i))throw new J(`step-state: delta must be an integer, got "${i}"`);let o=parseInt(i,10),s=TZ(t,a),c=gV(s),l=c.rangeParamsFor(r);if(!l)throw new J(`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&&fZ.test(u)?gZ(l,parseInt(u,10)):_Z(`step-state`,r,l,yV(s,e=>t.sessionState.get(a,e),r)),f=pZ(d,o,l.min,l.max),p=c.validate(r,String(f));if(!p.ok)throw new J(`step-state: ${p.reason}`);hZ(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 hZ(e,t,n,r){let i=r.filter(e=>e.key.startsWith(iA));if(i.length===0)return;let a=YB(TZ(e,t),n=>e.sessionState.get(t,n),i);if(a.length>0)throw new J(`${n}: refused — ${a.join(`; `)}`)}function gZ(e,t){return Math.max(e.min,Math.min(e.max,t))}function _Z(e,t,n,r){if(r===null)return n.min;if(!fZ.test(r))throw new J(`${e}: "${t}" shows ${JSON.stringify(r)} before any click, not an integer to step`);return gZ(n,parseInt(r,10))}const vZ=`render-origin`;function yZ(e,t,n){return{...e,configFile:t.get(n,`config-override`)??e.configFile}}function bZ(e){return JSON.stringify(e)}function xZ(e){let t;try{t=JSON.parse(e)}catch{throw new J(`render origin is not JSON: ${e}`)}if(typeof t!=`object`||!t)throw new J(`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 J(`render origin has the wrong shape: ${e}`);return{projectDir:n,cwd:r,configFile:i}}function SZ(e,t){let n=CZ(e,t);if(n===null)throw new J(`session ${t} has not rendered yet — no config to act on`);return n}function CZ(e,t){let n=e.sessionState.get(t,vZ);return n===null?null:yZ(xZ(n),e.sessionState,t)}function wZ(e,t,n){let r=CZ(e,t);if(r===null)return;let{path:i}=EZ(r);n.some(e=>e.kind===`file`&&e.file===i)&&e.reloadConfig(r)}function TZ(e,t){return e.configFor(SZ(e,t))}function EZ(e){return Kz(e.projectDir,e.cwd,e.configFile??void 0)}function DZ(e,t){return{record:(n,r,i)=>e.journal.file(t,n,r,i),logger:e.dlog}}const OZ=(e,t)=>{let[n=``,r=``,i=``]=iZ(()=>xr(e)),a=nZ(n),o=SZ(t,a),s=t.configFor(o),c=OF(s);if(!r)throw new J(`set-config: <key>/<value> is required (have keys: ${c.listKeys().join(`, `)})`);let l=c.validate(r,i);if(!l.ok)throw new J(`set-config: ${l.reason}`);let u=EZ(o),d=qB(s,e=>t.sessionState.get(a,e),r);Nq(DZ(t,a),u,[[d.key,l.value]]),t.reloadConfig(o),t.dlog(`info`,`set-config: ${d.key}=${l.value} → ${u.path} (session=${a})`)},kZ=(e,t)=>{let[n=``,r=``,i=``]=iZ(()=>xr(e)),a=nZ(n);if(!r)throw new J(`step-config: <key> is required (shape: <sessionId>/<key>/<by>)`);if(!fZ.test(i))throw new J(`step-config: delta must be an integer, got "${i}"`);let o=parseInt(i,10),s=SZ(t,a),c=t.configFor(s),l=OF(c),u=l.rangeParamsFor(r);if(!u)throw new J(`step-config: key "${r}" is not a bounded (range) config key (have keys: ${l.listKeys().join(`, `)})`);let d=EZ(s),f=qB(c,e=>t.sessionState.get(a,e),r),p=Mq(d.path,f.key),m=typeof p==`number`?gZ(u,p):_Z(`step-config`,r,u,AF(f.globals,r)),h=pZ(m,o,u.min,u.max),g=l.validate(r,String(h));if(!g.ok)throw new J(`step-config: ${g.reason}`);Nq(DZ(t,a),d,[[f.key,g.value]]),t.reloadConfig(s),t.dlog(`info`,`step-config: ${f.key} ${m}→${g.value} (by ${o}) → ${d.path} (session=${a})`)},AZ=(e,t)=>{let[n=``]=iZ(()=>xr(e)),r=nZ(n),i=SZ(t,r),a=t.configFor(i),o=e=>t.sessionState.get(r,e),s=GB(a,o),c=JB(a,o);if(s.length+c.length===0){t.dlog(`info`,`save: nothing unsaved (session=${r})`);return}let l=gV(a),u=s.map(e=>{let t=l.validate(e.sessionKey,e.value);if(!t.ok)throw new J(`save: ${t.reason}`);return[e.target,t.value]});MZ(`save`,l,c);let d=EZ(i);Pq(DZ(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(jZ)].join(` `)} → ${d.path} (session=${r})`)},jZ=e=>`${e.preset}/${e.id}.settings.${e.setting}=${gg(e.value)}`;function MZ(e,t,n){for(let r of n){let n=t.validate(r.key,gg(r.value));if(!n.ok)throw new J(`${e}: ${n.reason}`)}}const NZ=(e,t)=>{let[n=``]=iZ(()=>xr(e)),r=nZ(n),i=SZ(t,r),a=t.configFor(i),o=QB(a,e=>t.sessionState.get(r,e)),s=gV(a),c=o.picks.map(e=>{let t=s.validate(e.sessionKey,e.value);if(!t.ok)throw new J(`save-preset: ${t.reason}`);return[e.configKey,t.value]});MZ(`save-preset`,s,o.placements);let l=EZ(i),u=Vq(DZ(t,r),l,o.from,o.globals,c,o.placements);t.reloadConfig(i);for(let e of[...U_.map(e=>e.sessionKey),...o.placements.map(e=>e.key)])t.sessionState.clear(r,e);t.sessionState.set(r,V_.preset.sessionKey,u),t.dlog(`info`,`save-preset: ${[`${u} from=${o.from}`,...c.map(([e,t])=>`${e}=${t}`),...o.placements.map(jZ)].join(` `)} → ${l.path} (session=${r})`)},PZ=(e,t)=>{let[n=``]=iZ(()=>xr(e)),r=nZ(n),i=SZ(t,r),a=eV(t.configFor(i),e=>t.sessionState.get(r,e));if(a.kind===`rule`)throw new J(`save-theme-default: the theme is chosen by a rule (globals.palette), so there is no name to save as a theme's default — pick one in the menu first`);let o=EZ(i);Hq(DZ(t,r),o,a.theme,a.look),t.reloadConfig(i);let s=new Set(GB(t.configFor(i),e=>t.sessionState.get(r,e)).map(e=>e.sessionKey)),c=P_.map(e=>V_[e].sessionKey).filter(e=>!s.has(e));for(let e of c)t.sessionState.clear(r,e);t.dlog(`info`,`save-theme-default: ${a.theme} ${P_.map(e=>`${e}=${a.look[e]}`).join(` `)} → ${o.path} (session=${r})`)},FZ=(e,t)=>{let[n=``,r=``]=iZ(()=>xr(e)),i=nZ(n);if(!r)throw new J(`delete-preset: <name> is required (shape: <sessionId>/<name>)`);let a=SZ(t,i),o=EZ(a);Uq(DZ(t,i),o,r),t.reloadConfig(a);let s=V_.preset.sessionKey;t.sessionState.get(i,s)===r&&t.sessionState.clear(i,s),t.dlog(`info`,`delete-preset: ${r} ← ${o.path} (session=${i})`)},IZ=(e,t)=>{let[n=``,...r]=iZ(()=>xr(e)),i=nZ(n),a=SZ(t,i),o=OF(t.configFor(a)).listKeys(),s=r.length===0?[``]:r.filter(e=>!o.includes(e));if(s.length>0)throw new J(`reset-config: unknown config key "${s.join(`", "`)}" (have: ${o.join(`, `)})`);let c=EZ(a),l=r.map(tV),u=l.flatMap(e=>e.fileKeys),d=l.flatMap(e=>e.sessionKeys);Rq(DZ(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.path} (session=${i})`)};function LZ(e,t){let n=(e,t)=>[...Zh(My(e,t).node)].filter(e=>e.kind===`segment`),r=new Set(ky(t.presets).flatMap(e=>n(t,e).map(t=>aA(UO(e),qh(t)))));return ky(e.presets).flatMap(t=>n(e,t).map(e=>({member:aA(UO(t),qh(e)),node:e})).filter(({member:e})=>!r.has(e)))}function RZ(e,t){return e.flatMap(({member:e,node:n})=>[...Object.values(n.drafts??{}).map(e=>e.key),...e===t?[$k]:[]])}const zZ=(e,t)=>{let[n=``,r=``,i=``]=iZ(()=>xr(e)),a=nZ(n),o=SZ(t,a),s=t.configFor(o),c=OF(s);if(!r)throw new J(`apply-layout-op: <key>/<op> is required (have: ${c.listKeys().join(`, `)})`);let l=c.validate(r,i);if(!l.ok)throw new J(`apply-layout-op: ${l.reason}`);let u=mF(l.value);if(u===null)throw new J(`apply-layout-op: "${l.value}" is not a layout op token`);let d=EZ(o),f=Wq(DZ(t,a),d,r,u);t.reloadConfig(o);let p=RZ(LZ(s,t.configFor(o)),t.sessionState.get(a,$k)).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.path} placed=${JSON.stringify(f)} released=${JSON.stringify(p)} (session=${a})`)},BZ=(e,t)=>{let[n=``]=iZ(()=>xr(e)),r=nZ(n);t.journal.commit();let i=t.history.undo(r);wZ(t,r,i),t.dlog(`info`,`undo: restored ${fJ(i)} (session=${r})`)},VZ=(e,t)=>{let n=nZ(rZ(e)),{step:r,discarded:i}=t.navigation.back(n,t.sessionState,gV(TZ(t,n))),a=r.map(e=>`${e.key}=${e.before??`∅`}`).join(` `);t.dlog(`info`,`back: ${a} discarded=${i} (session=${n})`)},HZ=(e,t)=>{let n=nZ(rZ(e));t.journal.commit();let r=t.history.rewind(n);wZ(t,n,r),t.dlog(`info`,`rewind: put back ${fJ(r)||`nothing`} as edit mode found it (session=${n})`)},UZ=(e,t)=>{let[n=``]=iZ(()=>xr(e)),r=nZ(n);t.journal.commit();let i=t.history.redo(r);wZ(t,r,i),t.dlog(`info`,`redo: re-applied ${fJ(i)} (session=${r})`)},WZ=(e,t)=>{nZ(rZ(e)),t.applyUpdate()},GZ=`client-hints`;function KZ(e,t){let n=e.sessionState.get(t,GZ);if(n===null)throw new J(`session ${t} has not rendered yet — no client facts are recorded for it`);let r;try{r=JSON.parse(n)}catch{throw new J(`client hints record is not JSON: ${n}`)}if(typeof r!=`object`||!r)throw new J(`client hints record is not an object: ${n}`);return yt(r)}function qZ(e,t,n){let r=pM(n);e.sessionState.setBatch(t,AM(r)),e.dlog(`info`,`doctor: ${r.map(e=>`${e.check.name}=${e.verdict.ok?`ok`:`failed(${1+(e.verdict.more?.length??0)})`}`).join(` `)} ${OM(n.nerdFont,n.marks)} ${yM(n.terminal,n.clicked)} ${bM(n.terminal,n.width)} ${xM(n.install)} ${SM(n.daemon)} ${CM(n.data)} ${DM(n.transcripts)} ${wM(n.frames,n.claudeSettings)} ${EM(n.claudeSettings.origin.sources)} (session=${t})`)}function JZ(e,t){let n={kind:`clicked`,sessionId:t},r=e.clients.ofSession(t,uO(new Date)),i;try{i=mX(e.doctor,KZ(e,t),SZ(e,t),n=>e.sessionState.get(t,n),{kind:`ok`,value:e.serving()},{kind:`ok`,value:r.map(e=>e.rateLimits)},{kind:`ok`,value:r.map(e=>e.transcript)},n,{kind:`ok`,value:BJ(n,r)},pX(t,r),VY(e.doctorStores))}catch(e){throw e instanceof IJ?new J(e.message):e}return{...i,urlHandler:uX(e.clientVersion),install:zY(e.doctor.install,e.bundle,r.map(e=>e.client)),clicked:YZ(e,i)}}function YZ(e,{terminal:t,clicked:n}){let r=t.kind===`seen`?mj(t.identified):null;if(r===null)return n;try{return e.doctorStores.clicked.update(e=>PJ(e,r))}catch(t){return e.dlog(`warn`,`doctor: clicked terminal not filed for ${JSON.stringify(r)}: ${t instanceof Error?t.message:String(t)}`),n}}const XZ=(e,t)=>{let n=nZ(rZ(e));qZ(t,n,JZ(t,n))},ZZ=(e,t)=>{let n=MX(rZ(e));if(n===null)throw new J(`doctor-probe: the value is not a probe nonce`);t.probes.arrive({nonce:n,handler:t.clientVersion}),t.dlog(`info`,`doctor-probe: arrived nonce=${n} handler=${t.clientVersion??`unreported`}`)},QZ=(e,t)=>{let[n=``,r=``]=iZ(()=>xr(e)),i=nZ(n),a=mM(r);if(a===void 0)throw new J(`doctor-fix: unknown check "${r}"`);let o=JZ(t,i),s=a.probe(o);if(s.ok||s.fix===void 0)throw new J(`doctor-fix: ${a.label} — ${s.ok?`nothing to fix`:s.reason}`);let c=hX(t.doctorStores,s.fix,o);if(c.kind===`failed`)throw new J(`doctor-fix: ${a.label} — ${c.reason}`);t.dlog(`info`,`doctor-fix: ${a.name} → ${Ej(s.fix)} (session=${i})`),qZ(t,i,c.value)},$Z=(e,t)=>{let[n=``,r=``,i=``]=iZ(()=>xr(e)),a=nZ(n),o=mM(r);if(o===void 0)throw new J(`doctor-mark: unknown check "${r}"`);if(!Cj.includes(i))throw new J(`doctor-mark: the mark is ${JSON.stringify(i)}, not ${Cj.join(` or `)}`);let s=JZ(t,a),c=o.probe(s);if(c.ok||c.sighting===void 0)throw new J(`doctor-mark: ${o.label} — ${c.ok?`nothing to mark`:`shows nothing to look at`}`);let l=[o.name,c.sighting.id,i],u=t.doctorStores.marks.update(e=>jJ(e,...l));if(u.kind===`failed`)throw new J(`doctor-mark: ${u.reason}`);t.dlog(`info`,`doctor-mark: ${o.name} ${i} on ${c.sighting.id} (session=${a})`),qZ(t,a,{...s,marks:u})},eQ=(e,t)=>{let[n=``,...r]=iZ(()=>xr(e)),i=nZ(n),a=SZ(t,i),o=Object.values(t.configFor(a).actions).filter(e=>`ceiling`in e).find(e=>{let t=AL(e);return t.length===r.length&&t.every((e,t)=>e===r[t])});if(o===void 0)throw new J(`ceiling: "${r.join(` `)}" is not a move this config declares`);let s=o.ceiling===`set`?{kind:`set`,to:o.to}:{kind:`clear`},c=rU({sessionId:i,projectDir:a.projectDir,cwd:a.cwd},KZ(t,i));t.memento.move(c,s),t.dlog(`info`,`ceiling: ${r.join(` `)} (session=${i} claudeConfigDir=${c.claudeConfigDir})`)},tQ=(e,t)=>{let[n=``,r=``]=iZ(()=>xr(e)),i=nZ(n),a=Object.values(t.configFor(SZ(t,i)).actions).filter(e=>`slash`in e),o=a.find(e=>e.slash===r);if(o===void 0)throw new J(`${JSON.stringify(r)} is not a command this config declares (it declares: ${[...new Set(a.map(e=>e.slash))].join(`, `)||`none`})`);let s=XX(t.claudeInput,KZ(t,i).tmux,o.slash);if(s.kind===`refused`)throw t.dlog(`warn`,`slash: ${r} refused — ${s.reason} (session=${i})`),new J(`${r} was not typed: ${s.reason}`);t.dlog(`info`,`slash: typed ${r} into ${s.pane} (session=${i})`)},nQ=`config-override`,rQ=new Map([[Xn,oZ],[`load-config`,(e,t)=>{let n=e.indexOf(`/`);if(n===-1)throw new J(`load-config: expected <sessionId>/<path> (missing separator)`);let r=nZ(iZ(()=>decodeURIComponent(e.slice(0,n)))),i=iZ(()=>decodeURIComponent(e.slice(n+1))).trim();if(i!==``){if(!i.startsWith(`/`))throw new J(`load-config: path must be absolute, got "${i}"`);if(!/\.(json5?|json)$/.test(i))throw new J(`load-config: path must end with .json5 or .json, got "${i}"`)}i===``?(t.sessionState.clear(r,nQ),t.dlog(`info`,`load-config: override cleared (session=${r})`)):(t.sessionState.set(r,nQ,i),t.dlog(`info`,`load-config: ${i} (session=${r})`))}],[Zn,sZ],[Jn,dZ],[Yn,mZ],[tr,OZ],[nr,kZ],[sr,IZ],[rr,AZ],[ir,NZ],[ar,PZ],[or,FZ],[cr,zZ],[lr,BZ],[ur,UZ],[dr,VZ],[fr,HZ],[$n,cZ],[er,lZ],[Qn,uZ],[pr,WZ],[mr,XZ],[hr,QZ],[gr,$Z],[_r,ZZ],[vr,eQ],[yr,tQ]]),iQ=new Set([Jn,Yn,tr,nr,sr,rr,ir,ar,or,cr,lr,ur,dr,fr,Qn,pr,mr,hr,gr,vr,yr]),aQ=(e,t)=>{let n=[],r=!1,i=null;for(let{verb:a,value:o}of Tr(Cr(e))){if(!i&&iQ.has(a)){let e=xr(o);e.length>0&&e[0]&&(i=e[0])}let e=rQ.get(a);if(!e){n.push(`unknown effect verb "${a}"`);continue}try{e(o,t)}catch(e){e instanceof J||(r=!0),n.push(`${a}: ${e instanceof Error?e.message:String(e)}`)}}if(n.length>0){i&&CJ(t.sessionState,i,n.join(`
492
492
  `),uO(new Date));let e=`dispatch: ${n.join(`; `)}`;throw r?Error(e):new J(e)}};function oQ(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 sQ=new Map([...rQ,[qn,aQ]].map(([e,t])=>[e,oQ(t)]));Object.freeze([...sQ.keys()]);const cQ=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`]),lQ=[[`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`]],uQ=[[`workspace.added_dirs`,`string-list`]];function dQ(e){let t={missingRequired:[],typeMismatches:[],unknownTopLevelFields:[]},n=typeof e==`object`&&e&&!Array.isArray(e)?e:{};for(let[e,r]of lQ){let i=mQ(n,e);if(i==null)t.missingRequired.push(e);else{let n=fQ(i);n!==r&&t.typeMismatches.push({path:e,expected:r,got:n})}}for(let[e,r]of uQ){let i=mQ(n,e),a=i===void 0?r:pQ(i);a!==r&&t.typeMismatches.push({path:e,expected:r,got:a})}for(let e of Object.keys(n))cQ.has(e)||t.unknownTopLevelFields.push(e);return{data:e,report:t}}function fQ(e){return Array.isArray(e)?`array`:typeof e==`string`&&!e.isWellFormed()?`ill-formed string`:typeof e}function pQ(e){return Array.isArray(e)&&e.every(e=>fQ(e)===`string`)?`string-list`:fQ(e)}function mQ(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 hQ(e,t){switch(e){case`vars`:return{what:e,vars:gQ(t)};case`segments`:return{what:e,segments:xQ(t)};case`config`:return{what:e,config:TQ(t)}}}function gQ(e){if(e===null)return[];let{store:t,registry:n,config:r}=e,i=yQ(r),a=t.names().sort(),o=[];for(let e of a){let r=t.getNode(e),a=_Q(r),s=n.getLastError(e);o.push({name:e,source:i.get(e)??null,...a,lastError:s===void 0?null:{timestampMs:s.timestamp,message:s.message},ageMs:vQ(r.lastUpdatedMs())})}return o}function _Q(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 vQ(e){return e===null?null:Math.max(0,Date.now()-e)}function yQ(e){let t=new Map;for(let[n,r]of Object.entries(e.variables))t.set(n,bQ(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}`,bQ(i));return t}function bQ(e){return e.kind}function xQ(e){if(e===null)return[];let{store:t,config:n,lastRenderBySegment:r}=e,i=new Set(t.names()),a=CQ(n),o=SQ(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:wQ(t.template,n.helpers,i),placements:(o.get(e)??[]).map(e=>({id:e,lastRender:r.get(e)??null}))})}return s}function SQ(e){let t=new Map;for(let n of ky(e.presets))for(let r of Zh(My(e,n).node)){if(r.kind!==`segment`)continue;let e=t.get(r.name)??[],n=qh(r);e.includes(n)||t.set(r.name,[...e,n])}return t}function CQ(e){let t=[],n=new Set;for(let r of Zh(Sy(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 wQ(e,t,n){let r=new Set;for(let i of eb(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 TQ(e){return e===null?null:e.config}const EQ=[`vars`,`segments`,`config`];function DQ(e){return typeof e==`string`&&EQ.includes(e)}function OQ(e){return Math.max(1,e-2)}const kQ={moving:1e3/30,still:1e3},AQ=1e3;function jQ(e){return o_.filter(t=>e[t].subscribers>0).map(t=>{let{subscribers:n,fps:r,shown:i}=e[t];return`${t}:${n}sub/${r}fps/${i?`shown`:`offscreen`}`}).join(`,`)||`-`}function MQ(e,t){e.push(t);let n=e.findIndex(e=>e>t-AQ);e.splice(0,n)}const NQ=e=>({resp:e,bytes:JSON.stringify(e)}),PQ=(e,t)=>a_[t].elsewhere===null?e.statusline:e.bar,FQ=e=>Math.round(1e3/e);var IQ=class{requests=new Map;feeds=new Map;stopWatching=null;drawn=0;pushed=0;refused=0;lookups=0;found=0;constructor(e){this.deps=e}note(e,t,n){let r=this.requests.get(e);if(r!==void 0&&r.order>n)return;this.requests.delete(e),this.requests.set(e,{req:t,order:n});for(let e of this.requests.keys()){if(this.requests.size<=256)break;this.feeds.has(e)||this.requests.delete(e)}let i=this.feeds.get(e);i!==void 0&&(i.noted++,this.wake(e))}subscribe(e,t){let n=this.requests.get(e);if(n!==void 0&&!this.deps.lanes(n.req)[t.lane])return this.refuse(e,t),()=>{};let r=this.feeds.get(e)??this.open(e);return r.followers.set(t,null),r.rates.has(t.lane)||r.rates.set(t.lane,[]),this.send(r,t),this.deps.log(`info`,`feed sid=${JSON.stringify(e)} subscribed lane=${t.lane} subscribers=${r.followers.size} data=${this.requests.has(e)?`Y`:`N`}`),()=>this.unsubscribe(r,t)}following(e){return new Set([...this.feeds.get(e)?.followers.keys()??[]].map(e=>e.lane))}wake(e){let t=this.feeds.get(e);if(t!==void 0)switch(t.phase.kind){case`drawing`:t.phase.again=!0;return;case`due`:clearTimeout(t.phase.timer),this.draw(t);return;case`waiting`:this.draw(t);return}}wakeWhere(e){for(let{sessionId:t,req:n}of this.watched())e(n)&&this.wake(t)}newestWhere(e){let t=null;for(let[n,{req:r,order:i}]of this.requests)e(r)&&(t===null||i>t.order)&&(t={sessionId:n,order:i});return this.lookups++,t!==null&&this.found++,t?.sessionId??null}watched(){return[...this.feeds.keys()].flatMap(e=>{let t=this.requests.get(e);return t===void 0?[]:[{sessionId:e,req:t.req}]})}feedsOf(e){let t=this.feeds.get(e);if(t===void 0)return f_;let n=this.deps.now()-AQ,r=this.shown(t);return d_(e=>{let i=t.rates.get(e);if(i===void 0)return l_;let a=0;for(let n of t.followers.keys())n.lane===e&&a++;let o=0;for(let e of i)e>n&&o++;return{subscribers:a,fps:o,shown:r}})}getStats(){let e=0;for(let t of this.feeds.values())e+=t.followers.size;return{feeds:this.feeds.size,subscribers:e,drawn:this.drawn,pushed:this.pushed,refused:this.refused,lookups:this.lookups,found:this.found}}open(e){let t=this.deps.now(),n={sessionId:e,followers:new Map,rates:new Map,unwatch:this.deps.watch(e,()=>this.wake(e)),phase:{kind:`waiting`},last:null,since:t,drawn:0,noted:0,moving:0,unseen:0,failed:0,pushed:0,pace:FQ(this.deps.periods.still),drawMs:0,summarizedAt:t};return this.feeds.set(e,n),this.stopWatching??=this.deps.watching(),this.draw(n),n}unsubscribe(e,t){e.followers.delete(t)&&([...e.followers.keys()].some(e=>e.lane===t.lane)||e.rates.delete(t.lane),!(e.followers.size>0)&&(e.phase.kind===`due`&&clearTimeout(e.phase.timer),e.unwatch(),this.feeds.delete(e.sessionId),this.feeds.size===0&&(this.stopWatching?.(),this.stopWatching=null),this.summarize(e,`closed`)))}draw(e){return this.step(e).catch(t=>{if(this.deps.log(`error`,`feed sid=${JSON.stringify(e.sessionId)} threw: ${ie(t)}`),this.feeds.get(e.sessionId)!==e)return;let n=this.deps.now();this.schedule(e,null,n,n)})}async step(e){let t=this.requests.get(e.sessionId);if(t===void 0){e.phase={kind:`waiting`};return}let{req:n}=t,r={kind:`drawing`,again:!1};e.phase=r;let i=this.deps.now(),a=await this.deps.render(n,e.pace),o=this.deps.now();if(this.drawn++,e.drawn++,e.drawMs+=o-i,this.feeds.get(e.sessionId)===e&&(this.countFailure(e,a),this.push(e,a),this.feeds.get(e.sessionId)===e)){if(o-e.summarizedAt>=6e4&&this.summarize(e,`running`),r.again){this.draw(e);return}this.schedule(e,a,i,o)}}schedule(e,t,n,r){let i=t?.moves===!0,a=i&&this.shown(e);a&&e.moving++,i&&!a&&e.unseen++;let o=a?this.deps.periods.moving:this.deps.periods.still;e.pace=FQ(o),e.phase={kind:`due`,timer:setTimeout(()=>void this.draw(e),Math.max(0,n+o-r))}}shown(e){let t=this.requests.get(e.sessionId);return t===void 0||this.deps.shown(t.req)}countFailure(e,t){t.failure!==null&&e.failed++}push(e,t){let n=this.requests.get(e.sessionId);if(n!==void 0){let t=this.deps.lanes(n.req);for(let n of[...e.followers.keys()])t[n.lane]||(this.unsubscribe(e,n),this.refuse(e.sessionId,n))}if(e.followers.size===0)return;let r={bar:NQ(t.resp),statusline:NQ(t.statusline)};if(e.last?.answers.bar.bytes===r.bar.bytes&&e.last.answers.statusline.bytes===r.statusline.bytes)return;let i=e.last?.answers??null;e.last={answers:r},this.pushed++,e.pushed++,t.failure!==null&&this.deps.log(t.failure.level,t.failure.line);let a=this.deps.now();for(let[t,n]of e.rates)(i===null||PQ(i,t).bytes!==PQ(r,t).bytes)&&MQ(n,a);for(let t of e.followers.keys())this.send(e,t)}send(e,t){if(e.last===null)return;let{resp:n,bytes:r}=PQ(e.last.answers,t.lane);e.followers.get(t)!==r&&(t.frame(n,r),e.followers.set(t,r))}refuse(e,t){this.refused++,this.deps.log(`info`,`feed sid=${JSON.stringify(e)} refused lane=${t.lane} switched-off`),t.refused({ok:!1,error:MA(t.lane),code:`SWITCHED_OFF`,daemonV:3})}summarize(e,t){let n=this.deps.now();this.deps.log(`info`,`feed sid=${JSON.stringify(e.sessionId)} ${t} subscribers=${e.followers.size} lanes=${[...e.followers.keys()].map(e=>e.lane).join(`,`)||`-`} for=${Math.round((n-e.since)/1e3)}s drawn=${e.drawn} noted=${e.noted} moving=${e.moving} unseen=${e.unseen} failed=${e.failed} pushed=${e.pushed} pace=${e.pace}fps meanDraw=${e.drawn===0?`-`:(e.drawMs/e.drawn).toFixed(2)}ms`),e.summarizedAt=n}};function LQ(e){let t=null;return e.on(`drain`,()=>{let n=t;t=null,n!==null&&e.write(n)}),n=>{if(e.writable){if(e.writableNeedDrain){t=n;return}e.write(n)}}}const RQ=`#{pane_id} #{session_id} #{session_attached} #{window_active} #{window_zoomed_flag} #{pane_active}`,zQ=`#{session_id} #{client_control_mode}`;function BQ(e){let t=new Set;for(let n of e.split(`
493
493
  `)){let[e,r]=n.trim().split(` `);e!==void 0&&r===`1`&&t.add(e)}return t}function VQ(e,t){let n=new Set;for(let r of e.split(`
494
- `)){let[e,i,a,o,s,c]=r.trim().split(` `);e===void 0||e===``||i===void 0||Number(a)>0&&(o===`1`||t.has(i))&&(s!==`1`||c===`1`)&&n.add(e)}return n}var HQ=class{servers=new Map;loop={kind:`idle`};constructor(e){this.deps=e}follow(){switch(this.loop.kind){case`idle`:this.deps.log(`info`,`visibility following`),this.ask();break;case`asking`:this.loop.following=!0;break;case`due`:break}return()=>this.stop()}stop(){switch(this.loop.kind){case`due`:clearTimeout(this.loop.timer),this.end();return;case`asking`:this.loop.following=!1;return;case`idle`:return}}ask(){let e={kind:`asking`,following:!0};this.loop=e,Promise.resolve().then(()=>this.refresh(this.deps.sockets())).catch(e=>this.deps.log(`error`,`visibility refresh threw: ${ie(e)}`)).then(()=>{if(e.following){this.loop={kind:`due`,timer:setTimeout(()=>this.ask(),this.deps.intervalMs).unref()};return}this.end()})}end(){this.deps.log(`info`,`visibility stopped forgot=${this.servers.size}`),this.loop={kind:`idle`},this.servers.clear()}shown(e){if(e==null)return!0;let t=this.servers.get(e.socket);return t?.kind!==`asked`||t.shown.has(e.pane)}async refresh(e){for(let t of this.servers.keys())e.has(t)||this.servers.delete(t);let t=await Promise.all([...e].map(async e=>{let[t,n]=await Promise.all([this.deps.listPanes(e),this.deps.listClients(e)]);return[e,t.kind===`ok`?n.kind===`ok`?{kind:`asked`,shown:VQ(t.stdout,BQ(n.stdout))}:{kind:`unasked`,reason:n.reason}:{kind:`unasked`,reason:t.reason}]})),n=new Set;for(let[e,r]of t){let t=this.servers.get(e);this.servers.set(e,r),!UQ(t,r)&&(n.add(e),this.deps.log(r.kind===`asked`?`info`:`warn`,r.kind===`asked`?`visibility socket=${JSON.stringify(e)} shown=${[...r.shown].join(`,`)||`-`}`:`visibility socket=${JSON.stringify(e)} unasked: ${r.reason} — its panes count as shown`))}n.size>0&&this.deps.onChange(n)}};function UQ(e,t){return e===void 0||e.kind!==t.kind?!1:e.kind===`unasked`||t.kind===`unasked`?!0:e.shown.size===t.shown.size&&[...e.shown].every(e=>t.shown.has(e))}const $=e=>({arity:e,keep:!0}),WQ=e=>({arity:e,keep:!1}),GQ={"--add-dir":$(`variadic`),"--agent":$(`one`),"--agents":$(`one`),"--allow-dangerously-skip-permissions":$(`none`),"--allowedTools":$(`variadic`),"--allowed-tools":$(`variadic`),"--append-system-prompt":$(`one`),"--autocompact":$(`one`),"--ax-screen-reader":$(`none`),"--bg":WQ(`none`),"--background":WQ(`none`),"--bare":$(`none`),"--betas":$(`variadic`),"--brief":$(`none`),"--chrome":$(`none`),"--cloud":WQ(`optional`),"-c":WQ(`none`),"--continue":WQ(`none`),"--dangerously-skip-permissions":$(`none`),"-d":$(`optional`),"--debug":$(`optional`),"--debug-file":$(`one`),"--desktop":WQ(`none`),"--disable-slash-commands":$(`none`),"--disallowedTools":$(`variadic`),"--disallowed-tools":$(`variadic`),"--effort":$(`one`),"--environment":WQ(`one`),"--exclude-dynamic-system-prompt-sections":$(`none`),"--fallback-model":$(`one`),"--file":$(`variadic`),"--fork-session":WQ(`none`),"--forward-subagent-text":$(`none`),"--from-pr":WQ(`optional`),"-h":WQ(`none`),"--help":WQ(`none`),"--ide":$(`none`),"--include-hook-events":$(`none`),"--include-partial-messages":$(`none`),"--input-format":$(`one`),"--json-schema":$(`one`),"--max-budget-usd":$(`one`),"--mcp-config":$(`variadic`),"--model":$(`one`),"-n":$(`one`),"--name":$(`one`),"--no-chrome":$(`none`),"--no-session-persistence":$(`none`),"--output-format":$(`one`),"--permission-mode":$(`one`),"--permission-prompts":$(`one`),"--plugin-dir":$(`one`),"--plugin-url":$(`one`),"-p":WQ(`none`),"--print":WQ(`none`),"--prompt-suggestions":$(`optional`),"--remote-control":$(`optional`),"--remote-control-session-name-prefix":$(`one`),"--replay-user-messages":$(`none`),"--restricted":$(`none`),"-r":WQ(`optional`),"--resume":WQ(`optional`),"--safe-mode":$(`none`),"--session-id":WQ(`one`),"--setting-sources":$(`one`),"--settings":$(`one`),"--strict-mcp-config":$(`none`),"--system-prompt":$(`one`),"--system-prompt-snapshot":$(`one`),"--teleport":WQ(`optional`),"--tmux":WQ(`none`),"--tools":$(`variadic`),"--verbose":$(`none`),"-v":WQ(`none`),"--version":WQ(`none`),"-w":WQ(`optional`),"--worktree":WQ(`optional`)},KQ=e=>e.startsWith(`-`)&&e!==`-`;function qQ(e,t){let n=[],r=e.slice(1),i=0;for(;i<r.length;){let e=r[i];if(i+=1,e===`--`)break;if(!KQ(e))continue;let t=e.indexOf(`=`),a=t===-1?e:e.slice(0,t),o=GQ[a];if(o===void 0)return{kind:`refused`,reason:`Claude Code was started with ${a}, which cc-candybar does not know how to carry to a restart`};let s=t===-1?o.arity===`one`?r.slice(i,i+1):o.arity===`optional`?r.slice(i,i+1).filter(e=>!KQ(e)):o.arity===`variadic`?JQ(r.slice(i),e=>!KQ(e)):[]:[];if(o.arity===`one`&&t===-1&&s.length===0)return{kind:`refused`,reason:`Claude Code was started with ${a} and no value after it`};i+=s.length,o.keep&&n.push(e,...s)}return{kind:`args`,args:[...n,`--resume`,t]}}function JQ(e,t){let n=e.findIndex(e=>!t(e));return n===-1?[...e]:e.slice(0,n)}const YQ=`candybar-band@cc-candybar`,XQ=s.join(`bin`,`cc-candybar-native`),ZQ=`@cc-candybar-bar-pane`,QQ=BM(`/reload-plugins`),$Q=BM(`/exit`),e$=e=>({kind:`done`,said:e});function t$(e){let t=YX(e.hints.tmux);if(t.kind===`refused`)throw new J(t.reason);return t.hint}const n$={band:{on:(e,t,n)=>{let r=ty(t.bundle);if(r===null)throw new J(`${a_.band.label} runs the band mod from a cc-candybar source checkout, and this daemon runs ${t.bundle} — run the daemon from a checkout (mod/README.md)`);let i=s.join(r,XQ);if(!n.fileExists(i))throw new J(`the band mod starts ${i}, which is not built — run \`just install-rust\` in ${r}`);return{kind:`underway`,said:`installing ${YQ} from ${r}`,finished:r$(e,r,n)}},off:()=>e$(`nothing to stop: the band mod draws nothing while the lane is off`)},statusline:{on:(e,t,n)=>{let r=t$(e),i=je(t.bundle);if(!n.fileExists(i))throw new J(`${a_.statusline.label} restarts Claude Code under the attach launcher, which is not at ${i} beside this daemon's bundle — rebuild (\`pnpm build\`) or reinstall cc-candybar`);if(!n.fileExists(e.transcript))throw new J(`this session has no conversation to resume yet — send a first message, then turn ${a_.statusline.label} off and on again`);return{kind:`underway`,said:`restarting Claude Code in ${r.pane} under the attach launcher`,finished:i$(e,r,[t.node[0],i],n)}},off:()=>e$(`nothing to stop: the attached statusline draws its command's output while the lane is off`)},pane:{on:(e,t,n)=>{let r=t$(e),i=n.barPanes(r);return i.length>0?e$(`bar pane ${i.join(`, `)} already draws ${r.pane}'s bar`):e$(`opened bar pane ${n.openBarPane(r,[...t.node,t.bundle,`bar-pane`,r.pane],{CC_CANDYBAR_SOCKET:t.socket})} under ${r.pane}`)},off:(e,t,n)=>{let r=YX(e.hints.tmux);if(r.kind===`refused`)return e$(`no bar pane to close: ${r.reason}`);let i=r.hint,a=n.barPanes(i);for(let e of a)n.closePane(i,e);return e$(a.length===0?`no bar pane draws ${i.pane}'s bar`:`closed bar pane ${a.join(`, `)}`)}}};async function r$(e,t,n){let r=e.hints.claudeConfigDir;await n.claude([`plugin`,`marketplace`,`add`,t],r),await n.claude([`plugin`,`install`,YQ],r);let i=XX(n.claudeInput,e.hints.tmux,QQ);if(i.kind===`refused`)throw Error(`the band mod is installed, but /reload-plugins was not typed: ${i.reason} — or type /reload-plugins yourself`);return`installed ${YQ} from ${t} and typed /reload-plugins into ${i.pane}`}async function i$(e,t,n,r){let i=await r.paneClaude(t);if(i.attached)return`left Claude Code in ${t.pane} running: it already runs under the attach launcher`;if(qX(r.claudeInput.read(t)))throw Error(`Claude Code in ${t.pane} is in the middle of a turn, and restarting it under the attach launcher would end that turn — once it is idle, turn ${a_.statusline.label} off and on again`);if(GX(r.claudeInput.read(t)))throw Error(`the prompt in ${t.pane} holds a draft, which restarting Claude Code under the attach launcher would lose — send or clear it, then turn ${a_.statusline.label} off and on again`);if(!i.fromShell)throw Error(`Claude Code is the first process of pane ${t.pane}, so nothing would be left in the pane to start it again under the attach launcher — start Claude Code from a shell in the pane`);let a=qQ(i.argv,e.sessionId);if(a.kind===`refused`)throw Error(`${a.reason} — restart it with that flag removed`);let[o,s]=n,c=await r.moduleGraph(o,Me(s),i.executable);if(!c.ok)throw Error(`Claude Code in ${t.pane} runs ${i.executable}, which the attach launcher cannot start (${c.reason}) — ${a_.statusline.label} needs the native Claude Code install (\`claude install\`), so it was left running`);let l=r.writeScript(`relaunch-${e.sessionId}.sh`,c$(i.cwd,[...n,i.executable,...a.args],i.env));try{let n=XX(r.claudeInput,t,$Q);if(n.kind===`refused`)throw Error(`Claude Code was not restarted under the attach launcher: /exit was not typed: ${n.reason}`);if(!await r.exited(i.pid,15e3))throw Error(`Claude Code in ${t.pane} did not exit within ${15e3/1e3} s of /exit, so it was not restarted under the attach launcher`);if(r.typeShellLine(t,`sh ${Ur(l)}`),!await r.followed(e.sessionId,`statusline`,3e4))throw Error(`Claude Code in ${t.pane} did not come back attached within ${3e4/1e3} s of its restart — the pane says why`)}finally{r.removeScript(l)}return`restarted Claude Code in ${t.pane} under the attach launcher, resuming ${e.sessionId}, and its statusline follows lane B`}const a$={switches:Object.fromEntries(o_.map(e=>[e,!1])),revision:0};var o$=class{seen=new Map;queued=new Map;constructor(e){this.deps=e}observe(e,t,n){let r=this.seen.get(e.sessionId)??a$;this.seen.delete(e.sessionId),this.seen.set(e.sessionId,{switches:t,revision:n});for(let[e]of this.seen){if(this.seen.size<=1024)break;this.seen.delete(e)}if(r.revision!==n)for(let n of o_){if(r.switches[n]===t[n])continue;let i=t[n];this.deps.defer(()=>this.enqueue(e.sessionId,()=>this.sync(e,n,i)))}}enqueue(e,t){let n=this.queued.get(e);if(n!==void 0){n.push(t);return}let r=[];this.queued.set(e,r);let i=t=>void t().then(()=>{let t=r.shift();t===void 0?this.queued.delete(e):i(t)});i(t)}sync(e,t,n){let r=`(session=${e.sessionId})`,i=i=>{let a=`lane: ${t} ${n?`on`:`off`}: ${i instanceof Error?i.message:String(i)}`;this.deps.log(`warn`,`${a} ${r}`),CJ(this.deps.state,e.sessionId,a,this.deps.now())},a;try{a=n$[t][n?`on`:`off`](e,this.deps.host,this.deps.edge)}catch(e){return i(e),Promise.resolve()}return this.deps.log(`info`,`lane: ${t} ${n?`on`:`off`} — ${a.said} ${r}`),a.kind===`underway`?a.finished.then(e=>this.deps.log(`info`,`lane: ${t} ${e} ${r}`),i):Promise.resolve()}};const s$=/^[A-Za-z_][A-Za-z0-9_]*=/;function c$(e,t,n){let r=n.filter(e=>s$.test(e));return[`cd -- ${Ur(e)} || exit 1`,...r.some(e=>e.startsWith(`CLAUDE_CONFIG_DIR=`))?[]:[`unset CLAUDE_CONFIG_DIR`],...r.map(e=>{let t=e.indexOf(`=`);return`export ${e.slice(0,t)}=${Ur(e.slice(t+1))}`}),`exec ${t.map(Ur).join(` `)}`,``].join(`
495
- `)}function l$(e,t,n){let r=ZH(e,`lane.tmux`,t,n);if(r.kind!==`ok`)throw Error(r.reason);return r.stdout}function u$(e,t){if(t.ok)return t.stdout;let n=t.error??[t.reason,t.stderr.trim(),t.stdout.trim()].filter(e=>e!==``).join(`: `);throw Error(`${e} failed (${n})`)}function d$(e){try{let t=JSON.parse(e);if(typeof t==`object`&&t&&`ok`in t&&t.ok===!1&&`reason`in t&&typeof t.reason==`string`)return`detail`in t&&typeof t.detail==`string`?`${t.reason}: ${t.detail}`:t.reason}catch{}return null}const f$=`#{pane_id} #{${ZQ}}`;function p$(e,t){return e.split(`
496
- `).map(e=>e.trim().split(` `)).filter(([,e])=>e===t).map(([e])=>e)}const m$=/(^|\/)(cc-attach|bun-attach\.js)(\s|$)/;function h$(e,t,n){for(let r of HJ(VJ(e),t)){if(r.command.split(` `).some(e=>m$.test(e)))return!0;if(r.pid===n)return!1}return!1}const g$=[`import ctypes, json, struct, sys`,`libc = ctypes.CDLL(None)`,`mib = (ctypes.c_int * 3)(1, 49, int(sys.argv[1]))`,`size = ctypes.c_size_t(0)`,`if libc.sysctl(mib, 3, None, ctypes.byref(size), None, 0) != 0: sys.exit('sysctl KERN_PROCARGS2 refused')`,`buf = ctypes.create_string_buffer(size.value)`,`if libc.sysctl(mib, 3, buf, ctypes.byref(size), None, 0) != 0: sys.exit('sysctl KERN_PROCARGS2 refused')`,`raw = buf.raw[:size.value]`,`argc = struct.unpack_from('i', raw)[0]`,`rest = raw[4:]`,`end = rest.index(b'\\0')`,`exe = rest[:end].decode('utf-8', 'surrogateescape')`,`rest = rest[end:].lstrip(b'\\0')`,`words = [w.decode('utf-8', 'surrogateescape') for w in rest.split(b'\\0')]`,`end = words.index('', argc) if '' in words[argc:] else len(words)`,`print(json.dumps({'executable': exe, 'argv': words[:argc], 'env': words[argc:end]}))`].join(`
497
- `);async function _$(e){if(process.platform===`linux`)return{executable:await p.promises.readlink(`/proc/${e}/exe`),argv:(await p.promises.readFile(`/proc/${e}/cmdline`,`utf8`)).split(`\0`).slice(0,-1),env:(await p.promises.readFile(`/proc/${e}/environ`,`utf8`)).split(`\0`).slice(0,-1)};let t=u$(`reading process ${e}'s arguments`,await Ue({bin:`python3`,args:[`-c`,g$,String(e)],timeoutMs:5e3,category:`lane.process`}));return JSON.parse(t)}async function v$(e,t){return u$(e,await Ue({bin:`ps`,args:t,timeoutMs:2e3,category:`lane.process`}))}async function y$(e){let t=await QH(e,`lane.tmux`,[`display`,`-p`,`-t`,e.pane,`#{pane_pid} #{pane_current_path}`]);if(t.kind!==`ok`)throw Error(t.reason);let[n=``,r=``]=t.stdout.trimEnd().split(` `),i=Number((await v$(`asking pane ${e.pane}'s foreground job`,[`-o`,`tpgid=`,`-p`,n])).trim()),a=await v$(`listing processes`,[`-A`,`-o`,`pid=,ppid=,args=`]),o=await _$(i);return{pid:i,executable:await p.promises.realpath(o.executable),argv:o.argv,env:o.env,cwd:r,fromShell:String(i)!==n,attached:h$(a,i,Number(n))}}function b$(e){let{CLAUDE_CONFIG_DIR:t,...n}=process.env;return e===void 0?n:{...n,CLAUDE_CONFIG_DIR:e}}function x$(e,t){return{claudeInput:tZ(),barPanes:e=>p$(l$(e,[`list-panes`,`-a`,`-F`,f$]),e.pane),openBarPane:(e,t,n)=>{let r=l$(e,[`split-window`,`-d`,`-v`,`-l`,`1`,`-t`,e.pane,`-P`,`-F`,`#{pane_id}`,...Object.entries(n).flatMap(([e,t])=>[`-e`,`${e}=${t}`]),...t]).trim();return l$(e,[`set-option`,`-p`,`-t`,r,ZQ,e.pane]),r},closePane:(e,t)=>void l$(e,[`kill-pane`,`-t`,t]),claude:async(e,t)=>void u$(`claude ${e.join(` `)}`,await Ue({bin:`claude`,args:[...e],env:b$(t),timeoutMs:3e4,category:`lane.claude`})),fileExists:e=>p.existsSync(e),paneClaude:y$,writeScript:(t,n)=>{let r=s.join(e,t);return p.writeFileSync(r,n,{mode:448}),r},removeScript:e=>p.rmSync(e,{force:!0}),followed:async(e,n,r)=>{let i=Date.now()+r;for(;!t(e).has(n);){if(Date.now()>i)return!1;await _e(200)}return!0},moduleGraph:async(e,t,n)=>{let r=await Ue({bin:e,args:[t,n],timeoutMs:2e4,category:`lane.process`}),i=!r.ok&&r.reason===`non-zero`?d$(r.stdout):null;return i===null?(u$(`reading ${n}'s module graph`,r),{ok:!0}):{ok:!1,reason:i}},exited:async(e,t)=>{let n=Date.now()+t;for(;po(e);){if(Date.now()>n)return!1;await _e(100)}return!0},typeShellLine:(e,t)=>void l$(e,$X(e.pane,`cc-candybar-lane`,[]),t)}}function S$(e,t){return o_.filter(n=>e[n]&&a_[n].elsewhere!==null&&t.has(n))}function C$(e,t){let n=`the bar is drawn in ${t.map(e=>a_[e].elsewhere).join(` and `)}`,r=Sr([{verb:sr,args:[e,...t.map(e=>a_[e].setting)]}]);return{channels:[{severity:Iv,message:n,lines:[[Lv(n,Sr([{verb:Xn,args:[n]}])),Lv(`[⟲ draw it here]`,r)]]}]}}const w$={order:-1/0,text:null,failure:null};var T$=class{synced=new Map;constructor(e){this.dir=e}pathFor(e){return s.join(this.dir,`${encodeURIComponent(e)}.txt`)}sync(e,t,n){let r=this.synced.get(e)??w$;if(t<r.order)return{link:this.linkFor(e,n),failure:null};let i=n===r.text&&r.failure===null?null:this.write(e,n);return this.synced.delete(e),this.synced.set(e,{order:t,text:n,failure:i}),this.forgetOldestClean(),{link:this.linkFor(e,n),failure:i}}linkFor(e,t){let n=this.synced.get(e)??w$;return n.text===t?n.failure===null?{kind:`file`,path:this.pathFor(e)}:{kind:`unavailable`,reason:n.failure}:{kind:`unavailable`,reason:`the file holds another render's text until the session's next statusline request`}}forgetOldestClean(){let e=0;for(let t of this.synced.values())t.text===null&&t.failure===null&&e++;for(let[t,n]of this.synced){if(e<=256)return;n.text!==null||n.failure!==null||(this.synced.delete(t),e--)}}write(e,t){let n=this.pathFor(e);try{return t===null?p.rmSync(n,{force:!0}):(p.mkdirSync(this.dir,{recursive:!0,mode:448}),p.writeFileSync(n,t,{mode:384})),null}catch(e){return`${n}: ${e.message}`}}reset(){this.synced.clear();try{return p.rmSync(this.dir,{recursive:!0,force:!0}),null}catch(e){return`${this.dir}: ${e.message}`}}};function E$(e,t){for(let n of Object.entries(t))e.push(n)}const D$={ok:`info`,"bad-request":`warn`,threw:`error`};function O$(e){switch(e.kind){case`ok`:return[];case`bad-request`:return[[`problems`,e.problems.join(`; `)]];case`threw`:return[[`error`,ie(e.error)]]}}function k$(e,t,n){let r=[...e,[`took`,`${n}ms`],[`outcome`,t.kind],...O$(t)];return{level:D$[t.kind],line:`render${r.map(([e,t])=>` ${e}=${gM(t)}`).join(``)}`}}const A$=new BK,j$=new AX,M$=new $A,N$=i(import.meta.url),P$=BY(Ze());Ve(A$.launchStats);const F$=new QD({counters:A$,logger:j}),I$=gU({watchers:F$,logger:j}),{gitProvider:L$,usageStore:R$,mementoProvider:z$}=I$,B$=new UK,V$=new Qq(B$,j),H$=new xJ,U$=new vv,W$=new o$({edge:x$(l(et()),e=>G$.following(e)),host:{bundle:N$,node:[t.execPath,...t.execArgv],socket:et()},state:B$,log:j,now:()=>uO(new Date),defer:e=>void me(e)}),G$=new IQ({render:(e,t)=>j1(e,t),watch:(e,t)=>(0,mb.reaction)(()=>B$.revision(e),t,{scheduler:e=>me(e)}),lanes:e=>N1(e),shown:e=>K$.shown(e.hints.tmux),watching:()=>K$.follow(),periods:kQ,now:()=>performance.now(),log:j}),K$=new HQ({listPanes:e=>QH({socket:e},`frames.visibility`,[`list-panes`,`-a`,`-F`,RQ]),listClients:e=>QH({socket:e},`frames.visibility`,[`list-clients`,`-F`,zQ]),sockets:()=>new Set(G$.watched().flatMap(({req:e})=>q$(e))),onChange:e=>G$.wakeWhere(t=>q$(t).some(t=>e.has(t))),intervalMs:1e3,log:j});function q$({hints:{tmux:e}}){return e==null?[]:[e.socket]}const J$=new T$(ft()),Y$=new RK({gitService:L$,sessionState:B$,watchers:F$,log:j},{budgetBytes:()=>(c1(),OK(t1)),observers:{onReload:e=>j(`info`,`config loaded projectDir=${e.projectDir} cwd=${e.cwd} files=${e.configLayers.join(` < `)||`<bundled default>`} error=${e.lastError===null?`none`:JSON.stringify(e.lastError)} warning=${e.lastWarning===null?`none`:JSON.stringify(e.lastWarning)}`)}}),X$=60*1e3,Z$=VV({targets:[...new Set([...import.meta.url.startsWith(`file://`)?[i(import.meta.url)]:[],...t.argv[1]?[t.argv[1]]:[]])],intervalMs:X$,stat:p.statSync,exit:()=>p1(0),log:j}),Q$=RV({entryUrl:import.meta.url,intervalMs:X$,releaseIntervalMs:216e5,registryUrl:t.env.CC_CANDYBAR_REGISTRY_URL??`https://registry.npmjs.org`,fetchImpl:fetch,onApplied:()=>Z$.checkNow(),log:j});let $$=null,e1=null,t1=0;function n1(){t.on(`uncaughtException`,e=>{j(`error`,`uncaughtException: ${e.stack||e.message}`),p1(1)}),t.on(`unhandledRejection`,e=>{j(`error`,`unhandledRejection: ${String(e)}`),p1(1)});for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])t.on(e,()=>{j(`info`,`received ${e}, shutting down`),p1(0)});try{l1(t.env)}catch(e){j(`error`,`refusing to boot: ${e.message}`),p1(1);return}$$=co(t.pid);let e=yo(xo($$));if(!e.decision.allow){j(`warn`,`fork-bomb breaker: ${e.decision.reason}; refusing to boot`),p1(1);return}e1=e.registryPath,p.mkdirSync($e(),{recursive:!0}),rt(et()),B$.useStorage(new GK(ot(),500,j)),V$.useStorage(yJ(st(),j)),fo({anchor:uo(t.env),isAlive:po,onOrphaned:e=>{j(`info`,`parent watchdog: ${e}; shutting down`),p1(0)}}),r1(C.createServer({allowHalfOpen:!1},e=>{m1(e)}),et(),!1)}function r1(e,n,r){e.removeAllListeners(`error`),e.removeAllListeners(`listening`),e.once(`error`,i=>{if(i.code!==`EADDRINUSE`){j(`error`,`server error: ${i.message}`),p1(1);return}if(r){j(`info`,`lost rebind race; another daemon is alive — exiting`),t.exit(0);return}i1(e,n)}),e.listen(n,()=>a1(n))}function i1(e,n){let r=Qa($a(it(n)),(e,t)=>so(e,t,{readStartTime:oo,pidAlive:po}));if(r.kind===`attach-and-exit`){j(`info`,`EADDRINUSE: ${r.reason} — exiting`),t.exit(0);return}j(`warn`,`EADDRINUSE: ${r.reason} — unlinking stale socket and rebinding`);try{p.unlinkSync(n)}catch(e){if(e.code!==`ENOENT`){j(`error`,`cannot unlink stale socket ${n}: ${e.message}`),p1(1);return}}r1(e,n,!0)}function a1(e){let n=no(e);if(n.kind!==`present`){j(`warn`,`no ownable socket at bind callback (${n.kind}); exiting`),p1(0);return}u1(e);try{p.chmodSync(e,384)}catch(e){j(`warn`,`chmod socket failed: ${e.message}`)}j(`info`,`daemon up: pid=${t.pid} v=3 sock=${e} heapCap=${hn(w.getHeapStatistics().heap_size_limit)}MB memoryLimit=${hn(t1)}MB`),In();let r=J$.reset();r!==null&&j(`warn`,`diagnostic dump wipe failed: ${r}`),Z$.arm(),Q$.arm(),c1().arm(),o1(e,n.identity)}function o1(e,n){ao({bound:n,myPid:t.pid,readIdentity:()=>no(e),readLease:()=>$a(it(e)),shutdown:e=>p1(e),log:j}).arm()}let s1=null;function c1(){if(s1===null)throw Error(`daemon: limits not yet established`);return s1}function l1(e){t1=gn(e),s1=Sn(Dn(A$.startedAt.getTime(),e=>p1(e),{limitBytes:t1}))}function u1(e){let n=eo(it(e),{pid:t.pid,version:3,binPath:t.argv[1],startTime:$$});n!==null&&j(`warn`,`lease write failed: ${n}`)}let d1=0,f1=!1;function p1(e){if(!f1){f1=!0,setTimeout(()=>t.kill(t.pid,`SIGKILL`),500);try{L$.close()}catch(e){j(`warn`,`gitService close failed: ${e.message}`)}try{R$.close()}catch(e){j(`warn`,`usageStore close failed: ${e.message}`)}try{F$.closeAll()}catch(e){j(`warn`,`watcherRegistry close failed: ${e.message}`)}try{B$.flush()}catch(e){j(`warn`,`sessionState flush failed: ${e.message}`)}to(at(),t.pid),e1!==null&&bo(e1,t.pid,_o,e=>p.unlinkSync(e)),t.exit(e)}}function m1(e){d1++,A$.inFlight=d1;let t=!1,n=!0,r=()=>{n&&(n=!1,d1=Math.max(0,d1-1),A$.inFlight=d1)},i=(n,r,i)=>{if(t){r!==null&&j(`warn`,`exit-after-flush dropped: an earlier responder settled this socket`);return}t=!0;let a=r===null?void 0:()=>p1(r);try{e.end(Nt(n),e=>{e??i(),a?.()})}catch(e){j(`warn`,`response write failed: ${e.message}`),a?.()}},a=!1,o=setTimeout(()=>{a=!0,A$.requestsTimedOut++,i({ok:!1,error:`request exceeded 200ms`,code:`TIMEOUT`,daemonV:3},null,h1)},200),s=Ft(e=>{S1(e,()=>a).then(e=>e.kind===`reply`?i(e.resp,e.exitAfterFlush,e.delivered):c(e.sessionId,e.lane)).catch(e=>{j(`error`,`handler threw: ${ie(e)}`),i(y1(e),null,h1)})},e=>{j(`warn`,`frame parse failed: ${e.message}`),i({ok:!1,error:e.message,code:`BAD_REQUEST`,daemonV:3},null,h1)}),c=(n,i)=>{if(t||e.destroyed)return;clearTimeout(o),r(),e.off(`data`,s);let a=LQ(e),c=G$.subscribe(n,{lane:i,frame:(e,t)=>a(Pt(eH[i](e,t))),refused:t=>e.end(Nt(t))});t=!0,e.on(`close`,c)};e.on(`data`,s),e.on(`error`,e=>{j(`warn`,`socket error: ${e.message}`)}),e.on(`close`,()=>{clearTimeout(o),r()})}const h1=()=>{},g1=e=>({resp:e,exitAfterFlush:null,delivered:h1}),_1=e=>({kind:`reply`,...e}),v1={render:!0,"pane-session":!0,shutdown:!0,stats:!0,click:!0,debug:!0},y1=e=>({ok:!1,error:e instanceof Error?e.message:ie(e),code:`RENDER_FAILED`,daemonV:3}),b1=(e,t)=>_1(g1({ok:!1,error:t,code:e,daemonV:3}));function x1(e){if(typeof e.sessionId!=`string`||e.sessionId===``)return b1(`BAD_REQUEST`,`subscribe needs a non-empty string sessionId`);if(e.lane===void 0)return b1(`VERSION_MISMATCH`,`this client's subscribe names no lane (${o_.join(`, `)}): it predates the lane toggles — update it`);let t=p_(e.lane);return t===null?b1(`BAD_REQUEST`,`subscribe needs a lane, one of ${o_.join(`, `)}: got ${JSON.stringify(e.lane)}`):{kind:`subscribe`,sessionId:e.sessionId,lane:t}}async function S1(e,t){return!e||typeof e!=`object`||typeof e.v!=`number`?b1(`BAD_REQUEST`,`malformed request`):e.v===3?e.kind===`subscribe`?x1(e):typeof e.kind!=`string`||!Object.hasOwn(v1,e.kind)?b1(`BAD_REQUEST`,`unknown kind`):_1(await C1(e,t)):(e.v>3?j(`info`,`version mismatch: client=${e.v} > daemon=3; binary likely upgraded — exiting after the response flushes`):j(`info`,`version mismatch: client=${e.v} < daemon=3; client is stale — staying up`),{kind:`reply`,resp:{ok:!1,error:`protocol v${e.v} not supported (daemon at v3)`,code:`VERSION_MISMATCH`,daemonV:3},exitAfterFlush:e.v>3?0:null,delivered:h1})}async function C1(e,t){if(e.kind===`shutdown`)return{resp:{ok:!0,output:``},exitAfterFlush:0,delivered:h1};if(e.kind===`pane-session`){let{socket:t,pane:n}=e;return g1(typeof t!=`string`||typeof n!=`string`?{ok:!1,error:`pane-session needs a string socket and pane`,code:`BAD_REQUEST`,daemonV:3}:{ok:!0,paneSession:G$.newestWhere(({hints:{tmux:e}})=>e!=null&&e.socket===t&&e.pane===n)})}if(e.kind===`stats`)return g1({ok:!0,stats:A$.snapshot({gitCache:L$.getStats(),usageCache:R$.getStats(),transcriptReads:qi(),renderCache:Y$.stats,effectCache:U$.getStats(),sessionState:{sessions:B$.size(),observers:B$.observers(),revision:B$.latestRevision()},frameFeeds:G$.getStats(),watchersActive:F$.size(),nextRestartReason:c1().describeNextRestart(),handlerProbes:j$.list(),clients:M$.list(uO(new Date)),bundle:N$,daemon:c1().serving(),doctorStores:VY(P$)})});if(e.kind===`render`){let n=new Date,r=uO(n),i=n.getTime(),a=[],o=++A$.requestsTotal,s=P1(e),c=(e,t)=>M$.see(e.hookData.session_id,{client:e.hints.client??null,termCols:e.hints.termCols??null,rateLimits:e.rateLimits,claudeConfigDir:ra(e.hints.claudeConfigDir),projectDir:e.requested.projectDir,transcript:YA(e.hookData),frame:t},r,o);s.ok&&(c(s.req,`drawing`),G$.note(s.req.hookData.session_id,s.req,o));let l=s.ok?await B1(s.req,o,r,a).then(({answer:e,motion:t,clickShown:n})=>(c(s.req,t),{outcome:{kind:`ok`},resp:{ok:!0,output:e},delivered:n===null?h1:()=>wJ(B$,s.req.hookData.session_id,n)}),e=>(c(s.req,`failed`),{outcome:{kind:`threw`,error:e},resp:y1(e),delivered:h1})):F1(s.problems);l.outcome.kind!==`ok`&&A$.requestsErrored++,E$(a,{timedOut:t()?`Y`:`N`});let{level:u,line:d}=k$(a,l.outcome,Date.now()-i);return j(u,d),{resp:l.resp,exitAfterFlush:null,delivered:l.delivered}}if(e.kind===`click`)return g1(A1(e.verb,e.value,jt(e.clientVersion)));if(e.kind===`debug`){if(!DQ(e.what))return g1({ok:!1,error:`unknown debug 'what': ${String(e.what)} (have: ${EQ.join(`, `)})`,code:`BAD_REQUEST`,daemonV:3});let t=Y$.firstState(),n=t===null?null:{store:t.store,registry:t.registry,config:t.config,compiled:t.compiled,lastRenderBySegment:e.what===`segments`?O1(t.lastRenderCellsBySegment,t.config.globals.colorCompatibility??L_(`colorCompatibility`)):D1};return g1({ok:!0,debug:hQ(e.what,n)})}throw Error(`no reply for request ${ie(e)}`)}function w1(e,t){let{tokens:n}=ae({args:e.slice(1),options:{config:{type:`string`}},strict:!1,tokens:!0,allowPositionals:!0}),r=(n??[]).filter(e=>e.kind===`option`&&e.name===`config`).at(-1),i=(n??[]).flatMap(e=>{switch(e.kind){case`option`:return e.name===`config`?e===r&&e.value===void 0?[{arg:e.rawName,why:`no-value`}]:[]:[{arg:e.rawName,why:`unknown`}];case`positional`:return[{arg:e.value,why:`positional`}];case`option-terminator`:return[]}});return{configFile:oz(t,r?.value),refusedArgs:i.filter((e,t)=>i.findIndex(t=>t.arg===e.arg&&t.why===e.why)===t)}}const T1={sessionState:B$,dlog:j,applyUpdate:()=>Q$.act(),doctor:ZY(e=>{let t=[e.projectDir,e.cwd,e.configFile??void 0];Y$.reload(...t);let n=Y$.getOrCreate(...t);return{layers:n.configLayers,error:n.lastError,warning:n.lastWarning,unused:n.state.unused,config:n.state.config}}),doctorStores:P$,probes:j$,clients:M$,bundle:N$,serving:()=>c1().serving(),memento:z$,claudeInput:tZ(),history:V$,navigation:H$,configFor:e=>Y$.getOrCreate(e.projectDir,e.cwd,e.configFile??void 0).state.config,reloadConfig:e=>Y$.reload(e.projectDir,e.cwd,e.configFile??void 0)};T1.reloadConfig;const E1={endcaps:L_(`endcaps`),colorCompatibility:L_(`colorCompatibility`),wrap:L_(`autoWrap`),padding:L_(`padding`),width:1/0},D1=new Map;function O1(e,t){let n=new Map;for(let[r,i]of e)n.set(r,jv(i,{...E1,colorCompatibility:t}));return n}const k1={...I$,history:e=>V$.depth(e),feeds:e=>G$.feedsOf(e)};function A1(e,t,n){let r=sQ.get(e);if(!r)return{ok:!1,error:`unknown click verb: ${e}`,code:`BAD_REQUEST`,daemonV:3};try{return r(t,{...T1,clientVersion:n}),{ok:!0,output:``}}catch(e){let t=e instanceof J?`BAD_REQUEST`:`RENDER_FAILED`;return{ok:!1,error:String(e instanceof Error?e.message:e),code:t,daemonV:3}}}async function j1(e,t){let n=new Date,r=[];try{let{drawn:i,motion:a,lanes:o}=await I1(e,uO(n),r,{by:`feed`,fps:t}),s=J$.linkFor(e.hookData.session_id,R1(i)),c=e.hookData.session_id,l=L1(i,s);return{resp:{ok:!0,output:l},statusline:{ok:!0,output:V1(c,i,s,l,S$(o,G$.following(c)))},moves:a===`moves`,failure:null}}catch(e){let{level:t,line:i}=k$(r,{kind:`threw`,error:e},Date.now()-n.getTime()),a=y1(e);return{resp:a,statusline:a,moves:!1,failure:{level:t,line:`frame ${i}`}}}}function M1(e,t){return PB(t.config,t=>B$.get(e,t),e=>t.authoredRoots.has(e))}function N1(e){try{var t=zi();let n=e.hookData.session_id,r=yZ(e.requested,B$,n);return MB(M1(n,t.u(Y$.hold(r.projectDir,r.cwd,r.configFile??void 0)).state))}catch(e){t.e=e}finally{t.d()}}function P1(e){let{report:t}=dQ(e.hookData);for(let e of t.unknownTopLevelFields)j(`info`,`schema: unknown field '${e}' — Anthropic may have added it`);let n=[];for(let e of t.missingRequired)n.push(`missing required field '${e}'`);for(let{path:e,expected:r,got:i}of t.typeMismatches)n.push(`field '${e}' expected ${r}, got ${i}`);if((typeof e.cwd!=`string`||!u(e.cwd))&&n.push(`request 'cwd' is not an absolute path: ${JSON.stringify(e.cwd)}`),(!Array.isArray(e.args)||!e.args.every(e=>typeof e==`string`))&&n.push(`request 'args' is not a list of strings: ${JSON.stringify(e.args)}`),n.length>0)return{ok:!1,problems:n};let r=yt(e),{configFile:i,refusedArgs:a}=w1(e.args,e.cwd);return{ok:!0,req:{...e,hints:r,rateLimits:JA(e.hookData),requested:{projectDir:e.hookData.workspace.project_dir,cwd:e.cwd,configFile:i??r.configEnv??null},refusedArgs:a}}}const F1=e=>({outcome:{kind:`bad-request`,problems:e},resp:{ok:!1,error:`malformed hookData: ${e.join(`; `)}`,code:`BAD_REQUEST`,daemonV:3},delivered:h1});async function I1(e,t,n,r){try{var i=zi();E$(n,{sid:e.hookData.session_id,at:t.toFixed(3)});let a=e.hookData.session_id,o=e.hints,s=bt(e,o),c=xt(s);E$(n,{termCols:String(o.termCols??`?`),termRows:String(o.termRows??`?`),refused:s.map(e=>e.hint).join(`,`)||`-`,badArgs:e.refusedArgs.map(e=>`${e.arg}:${e.why}`).join(`,`)||`-`,client:o.client?.kind??`unreported`,rateLimits:e.rateLimits});let l=yZ(e.requested,B$,a),{entry:u,state:d}=i.u(Y$.hold(l.projectDir,l.cwd,l.configFile??void 0)),f=o.termCols,p=OQ(f??120),m=Mv(o.termRows);E$(n,{width:String(p)});let h=t=>B$.get(e.hookData.session_id,t),g=M1(a,d),_=MB(g);E$(n,{lanes:o_.filter(e=>_[e]).join(`,`)||`-`}),W$.observe({sessionId:a,hints:o,origin:l,transcript:e.hookData.transcript_path},_,V$.revision(a));let v=await UU(e.hookData,t,{...k1,navigation:e=>H$.depth(e,B$,gV(d.config))},e.cwd,d.neededInputPaths(g.preset),g,o,{...rV(d.config,d.fileHeldSettings,h),configPath:u.configLayers.includes(u.configHome)?u.configHome:null});E$(n,{prompts:String(v.metrics?.messageCount??`-`),nonPrompts:String(v.metrics?.nonPrompts??`-`),pr:EU(v.git),feeds:jQ(v.feeds)});let y=[],b=CU(g,p),ee=U$.of(a),x=hK(d.config,d.compiled,d.store,d.registry,{...v,drawing:r},t,b,{perSegmentSink:d.lastRenderCellsBySegment,onRenderWarning:e=>y.push(e)},{...g,effects:ee}),S=EJ(B$,a,t,r.by),te=S.kind===`held`||S.kind===`owed`?S.error:null,ne=te?.text??null,re=[Ct(e.refusedArgs),c,u.lastError,ne].filter(Boolean).join(`
498
- `),ie=Q$.notice({sessionId:a,dismissed:B$.get(a,SV),enabled:g.updateNotice}),ae=u.lastError===null?null:u.failedFile,oe=[...u.lastWarning===null?[]:[{kind:`load`,message:u.lastWarning}],...y],C=Rv(re,ie,oe.map(e=>e.message).join(`
499
- `)),w=L$.getStats(),se=R$.getStats(),T=ee.lastFrame(),ce=T.own.map(e=>`${e.placement}:${e.effect}@${e.t.toFixed(3)}`).join(`,`)||`-`,le=e=>e.map(e=>`${e.placement}@${e.t.toFixed(3)}`).join(`,`)||`-`,ue=oe.map(e=>{switch(e.kind){case`rule`:return`rule:${e.slot}`;case`refresh`:return`refresh:${e.variable}`;case`load`:case`band-floor`:case`when`:return e.kind}}).join(`,`)||`-`;return E$(n,{git:`${w.size}/${w.hits}h/${w.misses}m`,usage:`${se.size}/${se.hits}h/${se.misses}m`,effect:T.effect,effectT:T.t.toFixed(3),effectRows:`${T.made}made/${T.reused}reused`,effectOwn:ce,fadeBasis:T.basis,stateRev:String(T.revision),fades:le(T.fades),leaves:le(T.leaves),motion:x.motion,err:re?`Y`:`N`,clickError:S.kind===`none`?`-`:S.kind,upd:String(ie.length),warn:ue}),{drawn:{body:x.text,diagnostics:C,failedConfigFile:ae,geometry:{width:p,rowCap:m,colorCompatibility:g.colorCompatibility}},motion:x.motion,clickShown:te,lanes:_}}catch(e){i.e=e}finally{i.d()}}function L1(e,t){return Vv(e.body,e.diagnostics,{fullText:t,failedConfigFile:e.failedConfigFile},e.geometry)+`
500
- `}function R1(e){return e.diagnostics===null?null:Bv(e.diagnostics)}function z1(e){let t=e.hookData.session_id,{client:n,...r}=e.hints,i=JSON.stringify(r);B$.get(t,`client-hints`)!==i&&B$.set(t,GZ,i);let a=bZ(e.requested);B$.get(t,`render-origin`)!==a&&B$.set(t,vZ,a)}async function B1(e,t,n,r){z1(e);let{drawn:i,motion:a,clickShown:o,lanes:s}=await I1(e,n,r,s_),{link:c,failure:l}=J$.sync(e.hookData.session_id,t,R1(i));E$(r,{dumpFailed:l===null?`-`:JSON.stringify(l)});let u=L1(i,c),d=e.hookData.session_id,f=S$(s,G$.following(d)),p=V1(d,i,c,u,f),m=QA(e.hints.client??null)===`statusline`;return E$(r,{handoff:(m?f:[]).join(`,`)||`-`}),{answer:m?p:u,motion:a,clickShown:o}}function V1(e,t,n,r,i){let[a,...o]=i;return a===void 0?r:L1({...t,body:Hv(C$(e,[a,...o]),t.geometry)},n)}const H1={connectMs:200,budgetMs:500};async function U1(e,n){let r=n.includes(`--json`),i=await W1(e);if(i.kind!==`ok`&&(t.stderr.write(`${e}: ${Wt(i)}\n`),t.exit(1)),r){t.stdout.write(JSON.stringify(i.value,null,2)+`
501
- `);return}t.stdout.write(G1(i.value))}function W1(e){return Rt({kind:`debug`,what:e},H1,e=>`debug`in e?e.debug:void 0)}function G1(e){switch(e.what){case`vars`:return K1(e.vars);case`segments`:return q1(e.segments);case`config`:return J1(e.config);default:return e}}function K1(e){if(e.length===0)return`no variables (DSL not active)
502
- `;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?``:` ${X1(a.ageMs)}`,o=a.lastError?` ✗ ${a.lastError.message}`:``;t.push(` ${a.name.padEnd(n)} ${(a.source??`—`).padEnd(r)} ${a.type.padEnd(i)} ${Y1(a.value)}${e}${o}`)}return t.join(`
494
+ `)){let[e,i,a,o,s,c]=r.trim().split(` `);e===void 0||e===``||i===void 0||Number(a)>0&&(o===`1`||t.has(i))&&(s!==`1`||c===`1`)&&n.add(e)}return n}var HQ=class{servers=new Map;loop={kind:`idle`};constructor(e){this.deps=e}follow(){switch(this.loop.kind){case`idle`:this.deps.log(`info`,`visibility following`),this.ask();break;case`asking`:this.loop.following=!0;break;case`due`:break}return()=>this.stop()}stop(){switch(this.loop.kind){case`due`:clearTimeout(this.loop.timer),this.end();return;case`asking`:this.loop.following=!1;return;case`idle`:return}}ask(){let e={kind:`asking`,following:!0};this.loop=e,Promise.resolve().then(()=>this.refresh(this.deps.sockets())).catch(e=>this.deps.log(`error`,`visibility refresh threw: ${ie(e)}`)).then(()=>{if(e.following){this.loop={kind:`due`,timer:setTimeout(()=>this.ask(),this.deps.intervalMs).unref()};return}this.end()})}end(){this.deps.log(`info`,`visibility stopped forgot=${this.servers.size}`),this.loop={kind:`idle`},this.servers.clear()}shown(e){if(e==null)return!0;let t=this.servers.get(e.socket);return t?.kind!==`asked`||t.shown.has(e.pane)}async refresh(e){for(let t of this.servers.keys())e.has(t)||this.servers.delete(t);let t=await Promise.all([...e].map(async e=>{let[t,n]=await Promise.all([this.deps.listPanes(e),this.deps.listClients(e)]);return[e,t.kind===`ok`?n.kind===`ok`?{kind:`asked`,shown:VQ(t.stdout,BQ(n.stdout))}:{kind:`unasked`,reason:n.reason}:{kind:`unasked`,reason:t.reason}]})),n=new Set;for(let[e,r]of t){let t=this.servers.get(e);this.servers.set(e,r),!UQ(t,r)&&(n.add(e),this.deps.log(r.kind===`asked`?`info`:`warn`,r.kind===`asked`?`visibility socket=${JSON.stringify(e)} shown=${[...r.shown].join(`,`)||`-`}`:`visibility socket=${JSON.stringify(e)} unasked: ${r.reason} — its panes count as shown`))}n.size>0&&this.deps.onChange(n)}};function UQ(e,t){return e===void 0||e.kind!==t.kind?!1:e.kind===`unasked`||t.kind===`unasked`?!0:e.shown.size===t.shown.size&&[...e.shown].every(e=>t.shown.has(e))}const $=e=>({arity:e,keep:!0}),WQ=e=>({arity:e,keep:!1}),GQ={"--add-dir":$(`variadic`),"--agent":$(`one`),"--agents":$(`one`),"--allow-dangerously-skip-permissions":$(`none`),"--allowedTools":$(`variadic`),"--allowed-tools":$(`variadic`),"--append-system-prompt":$(`one`),"--autocompact":$(`one`),"--ax-screen-reader":$(`none`),"--bg":WQ(`none`),"--background":WQ(`none`),"--bare":$(`none`),"--betas":$(`variadic`),"--brief":$(`none`),"--chrome":$(`none`),"--cloud":WQ(`optional`),"-c":WQ(`none`),"--continue":WQ(`none`),"--dangerously-skip-permissions":$(`none`),"-d":$(`optional`),"--debug":$(`optional`),"--debug-file":$(`one`),"--desktop":WQ(`none`),"--disable-slash-commands":$(`none`),"--disallowedTools":$(`variadic`),"--disallowed-tools":$(`variadic`),"--effort":$(`one`),"--environment":WQ(`one`),"--exclude-dynamic-system-prompt-sections":$(`none`),"--fallback-model":$(`one`),"--file":$(`variadic`),"--fork-session":WQ(`none`),"--forward-subagent-text":$(`none`),"--from-pr":WQ(`optional`),"-h":WQ(`none`),"--help":WQ(`none`),"--ide":$(`none`),"--include-hook-events":$(`none`),"--include-partial-messages":$(`none`),"--input-format":$(`one`),"--json-schema":$(`one`),"--max-budget-usd":$(`one`),"--mcp-config":$(`variadic`),"--model":$(`one`),"-n":$(`one`),"--name":$(`one`),"--no-chrome":$(`none`),"--no-session-persistence":$(`none`),"--output-format":$(`one`),"--permission-mode":$(`one`),"--permission-prompts":$(`one`),"--plugin-dir":$(`one`),"--plugin-url":$(`one`),"-p":WQ(`none`),"--print":WQ(`none`),"--prompt-suggestions":$(`optional`),"--remote-control":$(`optional`),"--remote-control-session-name-prefix":$(`one`),"--replay-user-messages":$(`none`),"--restricted":$(`none`),"-r":WQ(`optional`),"--resume":WQ(`optional`),"--safe-mode":$(`none`),"--session-id":WQ(`one`),"--setting-sources":$(`one`),"--settings":$(`one`),"--strict-mcp-config":$(`none`),"--system-prompt":$(`one`),"--system-prompt-snapshot":$(`one`),"--teleport":WQ(`optional`),"--tmux":WQ(`none`),"--tools":$(`variadic`),"--verbose":$(`none`),"-v":WQ(`none`),"--version":WQ(`none`),"-w":WQ(`optional`),"--worktree":WQ(`optional`)},KQ=e=>e.startsWith(`-`)&&e!==`-`;function qQ(e,t){let n=JQ(e.argv,t);if(n.kind===`refused`)return n;let r=YQ(e.cwd);return r===null?{kind:`relaunch`,dir:e.cwd,args:n.args}:{kind:`relaunch`,dir:r.repo,args:[`--worktree`,r.name,...n.args]}}function JQ(e,t){let n=[],r=e.slice(1),i=0;for(;i<r.length;){let e=r[i];if(i+=1,e===`--`)break;if(!KQ(e))continue;let t=e.indexOf(`=`),a=t===-1?e:e.slice(0,t),o=GQ[a];if(o===void 0)return{kind:`refused`,reason:`Claude Code was started with ${a}, which cc-candybar does not know how to carry to a restart`};let s=t===-1?o.arity===`one`?r.slice(i,i+1):o.arity===`optional`?r.slice(i,i+1).filter(e=>!KQ(e)):o.arity===`variadic`?XQ(r.slice(i),e=>!KQ(e)):[]:[];if(o.arity===`one`&&t===-1&&s.length===0)return{kind:`refused`,reason:`Claude Code was started with ${a} and no value after it`};i+=s.length,o.keep&&n.push(e,...s)}return{kind:`args`,args:[...n,`--resume`,t]}}function YQ(e){let t=e.split(s.sep),n=t.findLastIndex((e,n)=>e===`worktrees`&&t[n-1]===`.claude`&&n+1<t.length);return n===-1?null:{repo:t.slice(0,n-1).join(s.sep)||s.sep,name:t[n+1].replaceAll(`+`,`/`)}}function XQ(e,t){let n=e.findIndex(e=>!t(e));return n===-1?[...e]:e.slice(0,n)}const ZQ=`candybar-band@cc-candybar`,QQ=s.join(`bin`,`cc-candybar-native`),$Q=`@cc-candybar-bar-pane`,e$=BM(`/reload-plugins`),t$=e=>({kind:`done`,said:e});function n$(e){let t=YX(e.hints.tmux);if(t.kind===`refused`)throw new J(t.reason);return t.hint}const r$={band:{on:(e,t,n)=>{let r=ty(t.bundle);if(r===null)throw new J(`${a_.band.label} runs the band mod from a cc-candybar source checkout, and this daemon runs ${t.bundle} — run the daemon from a checkout (mod/README.md)`);let i=s.join(r,QQ);if(!n.fileExists(i))throw new J(`the band mod starts ${i}, which is not built — run \`just install-rust\` in ${r}`);return{kind:`underway`,said:`installing ${ZQ} from ${r}`,finished:i$(e,r,n)}},off:()=>t$(`nothing to stop: the band mod draws nothing while the lane is off`)},statusline:{on:(e,t,n)=>{let r=n$(e),i=je(t.bundle);if(!n.fileExists(i))throw new J(`${a_.statusline.label} restarts Claude Code under the attach launcher, which is not at ${i} beside this daemon's bundle — rebuild (\`pnpm build\`) or reinstall cc-candybar`);if(!n.fileExists(e.transcript))throw new J(`this session has no conversation to resume yet — send a first message, then turn ${a_.statusline.label} off and on again`);return{kind:`underway`,said:`restarting Claude Code in ${r.pane} under the attach launcher`,finished:a$(e,r,[t.node[0],i],n)}},off:()=>t$(`nothing to stop: the attached statusline draws its command's output while the lane is off`)},pane:{on:(e,t,n)=>{let r=n$(e),i=n.barPanes(r);return i.length>0?t$(`bar pane ${i.join(`, `)} already draws ${r.pane}'s bar`):t$(`opened bar pane ${n.openBarPane(r,[...t.node,t.bundle,`bar-pane`,r.pane],{CC_CANDYBAR_SOCKET:t.socket})} under ${r.pane}`)},off:(e,t,n)=>{let r=YX(e.hints.tmux);if(r.kind===`refused`)return t$(`no bar pane to close: ${r.reason}`);let i=r.hint,a=n.barPanes(i);for(let e of a)n.closePane(i,e);return t$(a.length===0?`no bar pane draws ${i.pane}'s bar`:`closed bar pane ${a.join(`, `)}`)}}};async function i$(e,t,n){let r=e.hints.claudeConfigDir;await n.claude([`plugin`,`marketplace`,`add`,t],r),await n.claude([`plugin`,`install`,ZQ],r);let i=XX(n.claudeInput,e.hints.tmux,e$);if(i.kind===`refused`)throw Error(`the band mod is installed, but /reload-plugins was not typed: ${i.reason} — or type /reload-plugins yourself`);return`installed ${ZQ} from ${t} and typed /reload-plugins into ${i.pane}`}async function a$(e,t,n,r){let i=await r.paneClaude(t);if(i.attached)return`left Claude Code in ${t.pane} running: it already runs under the attach launcher`;if(!i.fromShell)throw Error(`Claude Code is the first process of pane ${t.pane}, so nothing would be left in the pane to start it again under the attach launcher — start Claude Code from a shell in the pane`);let a=qQ(i,e.sessionId);if(a.kind===`refused`)throw Error(`${a.reason} — restart it with that flag removed`);let[o,s]=n,c=await r.moduleGraph(o,Me(s),i.executable);if(!c.ok)throw Error(`Claude Code in ${t.pane} runs ${i.executable}, which the attach launcher cannot start (${c.reason}) — ${a_.statusline.label} needs the native Claude Code install (\`claude install\`), so it was left running`);let l=r.writeScript(`relaunch-${e.sessionId}.sh`,d$(a.dir,[...n,i.executable,...a.args],i.env));try{if((await r.paneClaude(t)).pid!==i.pid)throw Error(`Claude Code in ${t.pane} is no longer the process the restart read (pid ${i.pid}), so it was not restarted under the attach launcher`);let n=s$(r.claudeInput.read(t));if(n!==null)throw Error(`Claude Code in ${t.pane} was left running: ${n} — then turn ${a_.statusline.label} off and on again`);if(r.terminate(i.pid),!await r.exited(i.pid,15e3))throw Error(`Claude Code in ${t.pane} did not exit within ${15e3/1e3} s of SIGTERM, so it was not restarted under the attach launcher`);if(r.typeShellLine(t,`sh ${Ur(l)}`),!await r.followed(e.sessionId,`statusline`,3e4))throw Error(`Claude Code in ${t.pane} did not come back attached within ${3e4/1e3} s of its restart — the pane says why`)}finally{r.removeScript(l)}return`restarted Claude Code in ${t.pane} under the attach launcher from ${a.dir}, resuming ${e.sessionId}, and its statusline follows lane B`}const o$={"in-mode":`its pane is in tmux copy mode — leave it (q)`,stashed:`it holds a stashed prompt (ctrl+s), which ending it would lose — restore or send it`,"no-prompt":`it is not at its prompt (a dialog or picker is open) — close it`};function s$(e){let t=WX(e);return t.kind===`ready`?qX(e)?`it is in the middle of a turn, which ending it would end — wait until it is idle`:GX(e)?`its prompt holds a draft, which ending it would lose — send or clear it`:null:o$[t.kind]}const c$={switches:Object.fromEntries(o_.map(e=>[e,!1])),revision:0};var l$=class{seen=new Map;queued=new Map;constructor(e){this.deps=e}observe(e,t,n){let r=this.seen.get(e.sessionId)??c$;this.seen.delete(e.sessionId),this.seen.set(e.sessionId,{switches:t,revision:n});for(let[e]of this.seen){if(this.seen.size<=1024)break;this.seen.delete(e)}if(r.revision!==n)for(let n of o_){if(r.switches[n]===t[n])continue;let i=t[n];this.deps.defer(()=>this.enqueue(e.sessionId,()=>this.sync(e,n,i)))}}enqueue(e,t){let n=this.queued.get(e);if(n!==void 0){n.push(t);return}let r=[];this.queued.set(e,r);let i=t=>void t().then(()=>{let t=r.shift();t===void 0?this.queued.delete(e):i(t)});i(t)}sync(e,t,n){let r=`(session=${e.sessionId})`,i=i=>{let a=`lane: ${t} ${n?`on`:`off`}: ${i instanceof Error?i.message:String(i)}`;this.deps.log(`warn`,`${a} ${r}`),CJ(this.deps.state,e.sessionId,a,this.deps.now())},a;try{a=r$[t][n?`on`:`off`](e,this.deps.host,this.deps.edge)}catch(e){return i(e),Promise.resolve()}return this.deps.log(`info`,`lane: ${t} ${n?`on`:`off`} — ${a.said} ${r}`),a.kind===`underway`?a.finished.then(e=>this.deps.log(`info`,`lane: ${t} ${e} ${r}`),i):Promise.resolve()}};const u$=/^[A-Za-z_][A-Za-z0-9_]*=/;function d$(e,t,n){let r=n.filter(e=>u$.test(e));return[`cd -- ${Ur(e)} || exit 1`,...r.some(e=>e.startsWith(`CLAUDE_CONFIG_DIR=`))?[]:[`unset CLAUDE_CONFIG_DIR`],...r.map(e=>{let t=e.indexOf(`=`);return`export ${e.slice(0,t)}=${Ur(e.slice(t+1))}`}),`exec ${t.map(Ur).join(` `)}`,``].join(`
495
+ `)}function f$(e,t,n){let r=ZH(e,`lane.tmux`,t,n);if(r.kind!==`ok`)throw Error(r.reason);return r.stdout}function p$(e,t){if(t.ok)return t.stdout;let n=t.error??[t.reason,t.stderr.trim(),t.stdout.trim()].filter(e=>e!==``).join(`: `);throw Error(`${e} failed (${n})`)}function m$(e){try{let t=JSON.parse(e);if(typeof t==`object`&&t&&`ok`in t&&t.ok===!1&&`reason`in t&&typeof t.reason==`string`)return`detail`in t&&typeof t.detail==`string`?`${t.reason}: ${t.detail}`:t.reason}catch{}return null}const h$=`#{pane_id} #{${$Q}}`;function g$(e,t){return e.split(`
496
+ `).map(e=>e.trim().split(` `)).filter(([,e])=>e===t).map(([e])=>e)}const _$=/(^|\/)(cc-attach|bun-attach\.js)(\s|$)/;function v$(e,t,n){for(let r of HJ(VJ(e),t)){if(r.command.split(` `).some(e=>_$.test(e)))return!0;if(r.pid===n)return!1}return!1}const y$=[`import ctypes, json, struct, sys`,`libc = ctypes.CDLL(None)`,`mib = (ctypes.c_int * 3)(1, 49, int(sys.argv[1]))`,`size = ctypes.c_size_t(0)`,`if libc.sysctl(mib, 3, None, ctypes.byref(size), None, 0) != 0: sys.exit('sysctl KERN_PROCARGS2 refused')`,`buf = ctypes.create_string_buffer(size.value)`,`if libc.sysctl(mib, 3, buf, ctypes.byref(size), None, 0) != 0: sys.exit('sysctl KERN_PROCARGS2 refused')`,`raw = buf.raw[:size.value]`,`argc = struct.unpack_from('i', raw)[0]`,`rest = raw[4:]`,`end = rest.index(b'\\0')`,`exe = rest[:end].decode('utf-8', 'surrogateescape')`,`rest = rest[end:].lstrip(b'\\0')`,`words = [w.decode('utf-8', 'surrogateescape') for w in rest.split(b'\\0')]`,`end = words.index('', argc) if '' in words[argc:] else len(words)`,`print(json.dumps({'executable': exe, 'argv': words[:argc], 'env': words[argc:end]}))`].join(`
497
+ `);async function b$(e){if(process.platform===`linux`)return{executable:await p.promises.readlink(`/proc/${e}/exe`),argv:(await p.promises.readFile(`/proc/${e}/cmdline`,`utf8`)).split(`\0`).slice(0,-1),env:(await p.promises.readFile(`/proc/${e}/environ`,`utf8`)).split(`\0`).slice(0,-1)};let t=p$(`reading process ${e}'s arguments`,await Ue({bin:`python3`,args:[`-c`,y$,String(e)],timeoutMs:5e3,category:`lane.process`}));return JSON.parse(t)}async function x$(e,t){return p$(e,await Ue({bin:`ps`,args:t,timeoutMs:2e3,category:`lane.process`}))}async function S$(e){let t=await QH(e,`lane.tmux`,[`display`,`-p`,`-t`,e.pane,`#{pane_pid} #{pane_current_path}`]);if(t.kind!==`ok`)throw Error(t.reason);let[n=``,r=``]=t.stdout.trimEnd().split(` `),i=Number((await x$(`asking pane ${e.pane}'s foreground job`,[`-o`,`tpgid=`,`-p`,n])).trim()),a=await x$(`listing processes`,[`-A`,`-o`,`pid=,ppid=,args=`]),o=await b$(i);return{pid:i,executable:await p.promises.realpath(o.executable),argv:o.argv,env:o.env,cwd:r,fromShell:String(i)!==n,attached:v$(a,i,Number(n))}}function C$(e){let{CLAUDE_CONFIG_DIR:t,...n}=process.env;return e===void 0?n:{...n,CLAUDE_CONFIG_DIR:e}}function w$(e,t){return{claudeInput:tZ(),barPanes:e=>g$(f$(e,[`list-panes`,`-a`,`-F`,h$]),e.pane),openBarPane:(e,t,n)=>{let r=f$(e,[`split-window`,`-d`,`-v`,`-l`,`1`,`-t`,e.pane,`-P`,`-F`,`#{pane_id}`,...Object.entries(n).flatMap(([e,t])=>[`-e`,`${e}=${t}`]),...t]).trim();return f$(e,[`set-option`,`-p`,`-t`,r,$Q,e.pane]),r},closePane:(e,t)=>void f$(e,[`kill-pane`,`-t`,t]),claude:async(e,t)=>void p$(`claude ${e.join(` `)}`,await Ue({bin:`claude`,args:[...e],env:C$(t),timeoutMs:3e4,category:`lane.claude`})),fileExists:e=>p.existsSync(e),paneClaude:S$,writeScript:(t,n)=>{let r=s.join(e,t);return p.writeFileSync(r,n,{mode:448}),r},removeScript:e=>p.rmSync(e,{force:!0}),followed:async(e,n,r)=>{let i=Date.now()+r;for(;!t(e).has(n);){if(Date.now()>i)return!1;await _e(200)}return!0},moduleGraph:async(e,t,n)=>{let r=await Ue({bin:e,args:[t,n],timeoutMs:2e4,category:`lane.process`}),i=!r.ok&&r.reason===`non-zero`?m$(r.stdout):null;return i===null?(p$(`reading ${n}'s module graph`,r),{ok:!0}):{ok:!1,reason:i}},terminate:e=>{try{process.kill(e,`SIGTERM`)}catch(t){throw Error(`Claude Code (pid ${e}) could not be sent SIGTERM: ${t instanceof Error?t.message:String(t)}`)}},exited:async(e,t)=>{let n=Date.now()+t;for(;po(e);){if(Date.now()>n)return!1;await _e(100)}return!0},typeShellLine:(e,t)=>void f$(e,$X(e.pane,`cc-candybar-lane`,[]),t)}}function T$(e,t){return o_.filter(n=>e[n]&&a_[n].elsewhere!==null&&t.has(n))}function E$(e,t){let n=`the bar is drawn in ${t.map(e=>a_[e].elsewhere).join(` and `)}`,r=Sr([{verb:sr,args:[e,...t.map(e=>a_[e].setting)]}]);return{channels:[{severity:Iv,message:n,lines:[[Lv(n,Sr([{verb:Xn,args:[n]}])),Lv(`[⟲ draw it here]`,r)]]}]}}const D$={order:-1/0,text:null,failure:null};var O$=class{synced=new Map;constructor(e){this.dir=e}pathFor(e){return s.join(this.dir,`${encodeURIComponent(e)}.txt`)}sync(e,t,n){let r=this.synced.get(e)??D$;if(t<r.order)return{link:this.linkFor(e,n),failure:null};let i=n===r.text&&r.failure===null?null:this.write(e,n);return this.synced.delete(e),this.synced.set(e,{order:t,text:n,failure:i}),this.forgetOldestClean(),{link:this.linkFor(e,n),failure:i}}linkFor(e,t){let n=this.synced.get(e)??D$;return n.text===t?n.failure===null?{kind:`file`,path:this.pathFor(e)}:{kind:`unavailable`,reason:n.failure}:{kind:`unavailable`,reason:`the file holds another render's text until the session's next statusline request`}}forgetOldestClean(){let e=0;for(let t of this.synced.values())t.text===null&&t.failure===null&&e++;for(let[t,n]of this.synced){if(e<=256)return;n.text!==null||n.failure!==null||(this.synced.delete(t),e--)}}write(e,t){let n=this.pathFor(e);try{return t===null?p.rmSync(n,{force:!0}):(p.mkdirSync(this.dir,{recursive:!0,mode:448}),p.writeFileSync(n,t,{mode:384})),null}catch(e){return`${n}: ${e.message}`}}reset(){this.synced.clear();try{return p.rmSync(this.dir,{recursive:!0,force:!0}),null}catch(e){return`${this.dir}: ${e.message}`}}};function k$(e,t){for(let n of Object.entries(t))e.push(n)}const A$={ok:`info`,"bad-request":`warn`,threw:`error`};function j$(e){switch(e.kind){case`ok`:return[];case`bad-request`:return[[`problems`,e.problems.join(`; `)]];case`threw`:return[[`error`,ie(e.error)]]}}function M$(e,t,n){let r=[...e,[`took`,`${n}ms`],[`outcome`,t.kind],...j$(t)];return{level:A$[t.kind],line:`render${r.map(([e,t])=>` ${e}=${gM(t)}`).join(``)}`}}const N$=new BK,P$=new AX,F$=new $A,I$=i(import.meta.url),L$=BY(Ze());Ve(N$.launchStats);const R$=new QD({counters:N$,logger:j}),z$=gU({watchers:R$,logger:j}),{gitProvider:B$,usageStore:V$,mementoProvider:H$}=z$,U$=new UK,W$=new Qq(U$,j),G$=new xJ,K$=new vv,q$=new l$({edge:w$(l(et()),e=>J$.following(e)),host:{bundle:I$,node:[t.execPath,...t.execArgv],socket:et()},state:U$,log:j,now:()=>uO(new Date),defer:e=>void me(e)}),J$=new IQ({render:(e,t)=>P1(e,t),watch:(e,t)=>(0,mb.reaction)(()=>U$.revision(e),t,{scheduler:e=>me(e)}),lanes:e=>I1(e),shown:e=>Y$.shown(e.hints.tmux),watching:()=>Y$.follow(),periods:kQ,now:()=>performance.now(),log:j}),Y$=new HQ({listPanes:e=>QH({socket:e},`frames.visibility`,[`list-panes`,`-a`,`-F`,RQ]),listClients:e=>QH({socket:e},`frames.visibility`,[`list-clients`,`-F`,zQ]),sockets:()=>new Set(J$.watched().flatMap(({req:e})=>X$(e))),onChange:e=>J$.wakeWhere(t=>X$(t).some(t=>e.has(t))),intervalMs:1e3,log:j});function X$({hints:{tmux:e}}){return e==null?[]:[e.socket]}const Z$=new O$(ft()),Q$=new RK({gitService:B$,sessionState:U$,watchers:R$,log:j},{budgetBytes:()=>(d1(),OK(i1)),observers:{onReload:e=>j(`info`,`config loaded projectDir=${e.projectDir} cwd=${e.cwd} files=${e.configLayers.join(` < `)||`<bundled default>`} error=${e.lastError===null?`none`:JSON.stringify(e.lastError)} warning=${e.lastWarning===null?`none`:JSON.stringify(e.lastWarning)}`)}}),$$=60*1e3,e1=VV({targets:[...new Set([...import.meta.url.startsWith(`file://`)?[i(import.meta.url)]:[],...t.argv[1]?[t.argv[1]]:[]])],intervalMs:$$,stat:p.statSync,exit:()=>g1(0),log:j}),t1=RV({entryUrl:import.meta.url,intervalMs:$$,releaseIntervalMs:216e5,registryUrl:t.env.CC_CANDYBAR_REGISTRY_URL??`https://registry.npmjs.org`,fetchImpl:fetch,onApplied:()=>e1.checkNow(),log:j});let n1=null,r1=null,i1=0;function a1(){t.on(`uncaughtException`,e=>{j(`error`,`uncaughtException: ${e.stack||e.message}`),g1(1)}),t.on(`unhandledRejection`,e=>{j(`error`,`unhandledRejection: ${String(e)}`),g1(1)});for(let e of[`SIGINT`,`SIGTERM`,`SIGHUP`])t.on(e,()=>{j(`info`,`received ${e}, shutting down`),g1(0)});try{f1(t.env)}catch(e){j(`error`,`refusing to boot: ${e.message}`),g1(1);return}n1=co(t.pid);let e=yo(xo(n1));if(!e.decision.allow){j(`warn`,`fork-bomb breaker: ${e.decision.reason}; refusing to boot`),g1(1);return}r1=e.registryPath,p.mkdirSync($e(),{recursive:!0}),rt(et()),U$.useStorage(new GK(ot(),500,j)),W$.useStorage(yJ(st(),j)),fo({anchor:uo(t.env),isAlive:po,onOrphaned:e=>{j(`info`,`parent watchdog: ${e}; shutting down`),g1(0)}}),o1(C.createServer({allowHalfOpen:!1},e=>{_1(e)}),et(),!1)}function o1(e,n,r){e.removeAllListeners(`error`),e.removeAllListeners(`listening`),e.once(`error`,i=>{if(i.code!==`EADDRINUSE`){j(`error`,`server error: ${i.message}`),g1(1);return}if(r){j(`info`,`lost rebind race; another daemon is alive — exiting`),t.exit(0);return}s1(e,n)}),e.listen(n,()=>c1(n))}function s1(e,n){let r=Qa($a(it(n)),(e,t)=>so(e,t,{readStartTime:oo,pidAlive:po}));if(r.kind===`attach-and-exit`){j(`info`,`EADDRINUSE: ${r.reason} — exiting`),t.exit(0);return}j(`warn`,`EADDRINUSE: ${r.reason} — unlinking stale socket and rebinding`);try{p.unlinkSync(n)}catch(e){if(e.code!==`ENOENT`){j(`error`,`cannot unlink stale socket ${n}: ${e.message}`),g1(1);return}}o1(e,n,!0)}function c1(e){let n=no(e);if(n.kind!==`present`){j(`warn`,`no ownable socket at bind callback (${n.kind}); exiting`),g1(0);return}p1(e);try{p.chmodSync(e,384)}catch(e){j(`warn`,`chmod socket failed: ${e.message}`)}j(`info`,`daemon up: pid=${t.pid} v=3 sock=${e} heapCap=${hn(w.getHeapStatistics().heap_size_limit)}MB memoryLimit=${hn(i1)}MB`),In();let r=Z$.reset();r!==null&&j(`warn`,`diagnostic dump wipe failed: ${r}`),e1.arm(),t1.arm(),d1().arm(),l1(e,n.identity)}function l1(e,n){ao({bound:n,myPid:t.pid,readIdentity:()=>no(e),readLease:()=>$a(it(e)),shutdown:e=>g1(e),log:j}).arm()}let u1=null;function d1(){if(u1===null)throw Error(`daemon: limits not yet established`);return u1}function f1(e){i1=gn(e),u1=Sn(Dn(N$.startedAt.getTime(),e=>g1(e),{limitBytes:i1}))}function p1(e){let n=eo(it(e),{pid:t.pid,version:3,binPath:t.argv[1],startTime:n1});n!==null&&j(`warn`,`lease write failed: ${n}`)}let m1=0,h1=!1;function g1(e){if(!h1){h1=!0,setTimeout(()=>t.kill(t.pid,`SIGKILL`),500);try{B$.close()}catch(e){j(`warn`,`gitService close failed: ${e.message}`)}try{V$.close()}catch(e){j(`warn`,`usageStore close failed: ${e.message}`)}try{R$.closeAll()}catch(e){j(`warn`,`watcherRegistry close failed: ${e.message}`)}try{U$.flush()}catch(e){j(`warn`,`sessionState flush failed: ${e.message}`)}to(at(),t.pid),r1!==null&&bo(r1,t.pid,_o,e=>p.unlinkSync(e)),t.exit(e)}}function _1(e){m1++,N$.inFlight=m1;let t=!1,n=!0,r=()=>{n&&(n=!1,m1=Math.max(0,m1-1),N$.inFlight=m1)},i=(n,r,i)=>{if(t){r!==null&&j(`warn`,`exit-after-flush dropped: an earlier responder settled this socket`);return}t=!0;let a=r===null?void 0:()=>g1(r);try{e.end(Nt(n),e=>{e??i(),a?.()})}catch(e){j(`warn`,`response write failed: ${e.message}`),a?.()}},a=!1,o=setTimeout(()=>{a=!0,N$.requestsTimedOut++,i({ok:!1,error:`request exceeded 200ms`,code:`TIMEOUT`,daemonV:3},null,v1)},200),s=Ft(e=>{T1(e,()=>a).then(e=>e.kind===`reply`?i(e.resp,e.exitAfterFlush,e.delivered):c(e.sessionId,e.lane)).catch(e=>{j(`error`,`handler threw: ${ie(e)}`),i(S1(e),null,v1)})},e=>{j(`warn`,`frame parse failed: ${e.message}`),i({ok:!1,error:e.message,code:`BAD_REQUEST`,daemonV:3},null,v1)}),c=(n,i)=>{if(t||e.destroyed)return;clearTimeout(o),r(),e.off(`data`,s);let a=LQ(e),c=J$.subscribe(n,{lane:i,frame:(e,t)=>a(Pt(eH[i](e,t))),refused:t=>e.end(Nt(t))});t=!0,e.on(`close`,c)};e.on(`data`,s),e.on(`error`,e=>{j(`warn`,`socket error: ${e.message}`)}),e.on(`close`,()=>{clearTimeout(o),r()})}const v1=()=>{},y1=e=>({resp:e,exitAfterFlush:null,delivered:v1}),b1=e=>({kind:`reply`,...e}),x1={render:!0,"pane-session":!0,shutdown:!0,stats:!0,click:!0,debug:!0},S1=e=>({ok:!1,error:e instanceof Error?e.message:ie(e),code:`RENDER_FAILED`,daemonV:3}),C1=(e,t)=>b1(y1({ok:!1,error:t,code:e,daemonV:3}));function w1(e){if(typeof e.sessionId!=`string`||e.sessionId===``)return C1(`BAD_REQUEST`,`subscribe needs a non-empty string sessionId`);if(e.lane===void 0)return C1(`VERSION_MISMATCH`,`this client's subscribe names no lane (${o_.join(`, `)}): it predates the lane toggles — update it`);let t=p_(e.lane);return t===null?C1(`BAD_REQUEST`,`subscribe needs a lane, one of ${o_.join(`, `)}: got ${JSON.stringify(e.lane)}`):{kind:`subscribe`,sessionId:e.sessionId,lane:t}}async function T1(e,t){return!e||typeof e!=`object`||typeof e.v!=`number`?C1(`BAD_REQUEST`,`malformed request`):e.v===3?e.kind===`subscribe`?w1(e):typeof e.kind!=`string`||!Object.hasOwn(x1,e.kind)?C1(`BAD_REQUEST`,`unknown kind`):b1(await E1(e,t)):(e.v>3?j(`info`,`version mismatch: client=${e.v} > daemon=3; binary likely upgraded — exiting after the response flushes`):j(`info`,`version mismatch: client=${e.v} < daemon=3; client is stale — staying up`),{kind:`reply`,resp:{ok:!1,error:`protocol v${e.v} not supported (daemon at v3)`,code:`VERSION_MISMATCH`,daemonV:3},exitAfterFlush:e.v>3?0:null,delivered:v1})}async function E1(e,t){if(e.kind===`shutdown`)return{resp:{ok:!0,output:``},exitAfterFlush:0,delivered:v1};if(e.kind===`pane-session`){let{socket:t,pane:n}=e;return y1(typeof t!=`string`||typeof n!=`string`?{ok:!1,error:`pane-session needs a string socket and pane`,code:`BAD_REQUEST`,daemonV:3}:{ok:!0,paneSession:J$.newestWhere(({hints:{tmux:e}})=>e!=null&&e.socket===t&&e.pane===n)})}if(e.kind===`stats`)return y1({ok:!0,stats:N$.snapshot({gitCache:B$.getStats(),usageCache:V$.getStats(),transcriptReads:qi(),renderCache:Q$.stats,effectCache:K$.getStats(),sessionState:{sessions:U$.size(),observers:U$.observers(),revision:U$.latestRevision()},frameFeeds:J$.getStats(),watchersActive:R$.size(),nextRestartReason:d1().describeNextRestart(),handlerProbes:P$.list(),clients:F$.list(uO(new Date)),bundle:I$,daemon:d1().serving(),doctorStores:VY(L$)})});if(e.kind===`render`){let n=new Date,r=uO(n),i=n.getTime(),a=[],o=++N$.requestsTotal,s=L1(e),c=(e,t)=>F$.see(e.hookData.session_id,{client:e.hints.client??null,termCols:e.hints.termCols??null,rateLimits:e.rateLimits,claudeConfigDir:ra(e.hints.claudeConfigDir),projectDir:e.requested.projectDir,transcript:YA(e.hookData),frame:t},r,o);s.ok&&(c(s.req,`drawing`),J$.note(s.req.hookData.session_id,s.req,o));let l=s.ok?await U1(s.req,o,r,a).then(({answer:e,motion:t,clickShown:n})=>(c(s.req,t),{outcome:{kind:`ok`},resp:{ok:!0,output:e},delivered:n===null?v1:()=>wJ(U$,s.req.hookData.session_id,n)}),e=>(c(s.req,`failed`),{outcome:{kind:`threw`,error:e},resp:S1(e),delivered:v1})):R1(s.problems);l.outcome.kind!==`ok`&&N$.requestsErrored++,k$(a,{timedOut:t()?`Y`:`N`});let{level:u,line:d}=M$(a,l.outcome,Date.now()-i);return j(u,d),{resp:l.resp,exitAfterFlush:null,delivered:l.delivered}}if(e.kind===`click`)return y1(N1(e.verb,e.value,jt(e.clientVersion)));if(e.kind===`debug`){if(!DQ(e.what))return y1({ok:!1,error:`unknown debug 'what': ${String(e.what)} (have: ${EQ.join(`, `)})`,code:`BAD_REQUEST`,daemonV:3});let t=Q$.firstState(),n=t===null?null:{store:t.store,registry:t.registry,config:t.config,compiled:t.compiled,lastRenderBySegment:e.what===`segments`?j1(t.lastRenderCellsBySegment,t.config.globals.colorCompatibility??L_(`colorCompatibility`)):A1};return y1({ok:!0,debug:hQ(e.what,n)})}throw Error(`no reply for request ${ie(e)}`)}function D1(e,t){let{tokens:n}=ae({args:e.slice(1),options:{config:{type:`string`}},strict:!1,tokens:!0,allowPositionals:!0}),r=(n??[]).filter(e=>e.kind===`option`&&e.name===`config`).at(-1),i=(n??[]).flatMap(e=>{switch(e.kind){case`option`:return e.name===`config`?e===r&&e.value===void 0?[{arg:e.rawName,why:`no-value`}]:[]:[{arg:e.rawName,why:`unknown`}];case`positional`:return[{arg:e.value,why:`positional`}];case`option-terminator`:return[]}});return{configFile:oz(t,r?.value),refusedArgs:i.filter((e,t)=>i.findIndex(t=>t.arg===e.arg&&t.why===e.why)===t)}}const O1={sessionState:U$,dlog:j,applyUpdate:()=>t1.act(),doctor:ZY(e=>{let t=[e.projectDir,e.cwd,e.configFile??void 0];Q$.reload(...t);let n=Q$.getOrCreate(...t);return{layers:n.configLayers,error:n.lastError,warning:n.lastWarning,unused:n.state.unused,config:n.state.config}}),doctorStores:L$,probes:P$,clients:F$,bundle:I$,serving:()=>d1().serving(),memento:H$,claudeInput:tZ(),history:W$,navigation:G$,configFor:e=>Q$.getOrCreate(e.projectDir,e.cwd,e.configFile??void 0).state.config,reloadConfig:e=>Q$.reload(e.projectDir,e.cwd,e.configFile??void 0)};O1.reloadConfig;const k1={endcaps:L_(`endcaps`),colorCompatibility:L_(`colorCompatibility`),wrap:L_(`autoWrap`),padding:L_(`padding`),width:1/0},A1=new Map;function j1(e,t){let n=new Map;for(let[r,i]of e)n.set(r,jv(i,{...k1,colorCompatibility:t}));return n}const M1={...z$,history:e=>W$.depth(e),feeds:e=>J$.feedsOf(e)};function N1(e,t,n){let r=sQ.get(e);if(!r)return{ok:!1,error:`unknown click verb: ${e}`,code:`BAD_REQUEST`,daemonV:3};try{return r(t,{...O1,clientVersion:n}),{ok:!0,output:``}}catch(e){let t=e instanceof J?`BAD_REQUEST`:`RENDER_FAILED`;return{ok:!1,error:String(e instanceof Error?e.message:e),code:t,daemonV:3}}}async function P1(e,t){let n=new Date,r=[];try{let{drawn:i,motion:a,lanes:o}=await z1(e,uO(n),r,{by:`feed`,fps:t}),s=Z$.linkFor(e.hookData.session_id,V1(i)),c=e.hookData.session_id,l=B1(i,s);return{resp:{ok:!0,output:l},statusline:{ok:!0,output:W1(c,i,s,l,T$(o,J$.following(c)))},moves:a===`moves`,failure:null}}catch(e){let{level:t,line:i}=M$(r,{kind:`threw`,error:e},Date.now()-n.getTime()),a=S1(e);return{resp:a,statusline:a,moves:!1,failure:{level:t,line:`frame ${i}`}}}}function F1(e,t){return PB(t.config,t=>U$.get(e,t),e=>t.authoredRoots.has(e))}function I1(e){try{var t=zi();let n=e.hookData.session_id,r=yZ(e.requested,U$,n);return MB(F1(n,t.u(Q$.hold(r.projectDir,r.cwd,r.configFile??void 0)).state))}catch(e){t.e=e}finally{t.d()}}function L1(e){let{report:t}=dQ(e.hookData);for(let e of t.unknownTopLevelFields)j(`info`,`schema: unknown field '${e}' — Anthropic may have added it`);let n=[];for(let e of t.missingRequired)n.push(`missing required field '${e}'`);for(let{path:e,expected:r,got:i}of t.typeMismatches)n.push(`field '${e}' expected ${r}, got ${i}`);if((typeof e.cwd!=`string`||!u(e.cwd))&&n.push(`request 'cwd' is not an absolute path: ${JSON.stringify(e.cwd)}`),(!Array.isArray(e.args)||!e.args.every(e=>typeof e==`string`))&&n.push(`request 'args' is not a list of strings: ${JSON.stringify(e.args)}`),n.length>0)return{ok:!1,problems:n};let r=yt(e),{configFile:i,refusedArgs:a}=D1(e.args,e.cwd);return{ok:!0,req:{...e,hints:r,rateLimits:JA(e.hookData),requested:{projectDir:e.hookData.workspace.project_dir,cwd:e.cwd,configFile:i??r.configEnv??null},refusedArgs:a}}}const R1=e=>({outcome:{kind:`bad-request`,problems:e},resp:{ok:!1,error:`malformed hookData: ${e.join(`; `)}`,code:`BAD_REQUEST`,daemonV:3},delivered:v1});async function z1(e,t,n,r){try{var i=zi();k$(n,{sid:e.hookData.session_id,at:t.toFixed(3)});let a=e.hookData.session_id,o=e.hints,s=bt(e,o),c=xt(s);k$(n,{termCols:String(o.termCols??`?`),termRows:String(o.termRows??`?`),refused:s.map(e=>e.hint).join(`,`)||`-`,badArgs:e.refusedArgs.map(e=>`${e.arg}:${e.why}`).join(`,`)||`-`,client:o.client?.kind??`unreported`,rateLimits:e.rateLimits});let l=yZ(e.requested,U$,a),{entry:u,state:d}=i.u(Q$.hold(l.projectDir,l.cwd,l.configFile??void 0)),f=o.termCols,p=OQ(f??120),m=Mv(o.termRows);k$(n,{width:String(p)});let h=t=>U$.get(e.hookData.session_id,t),g=F1(a,d),_=MB(g);k$(n,{lanes:o_.filter(e=>_[e]).join(`,`)||`-`}),q$.observe({sessionId:a,hints:o,origin:l,transcript:e.hookData.transcript_path},_,W$.revision(a));let v=await UU(e.hookData,t,{...M1,navigation:e=>G$.depth(e,U$,gV(d.config))},e.cwd,d.neededInputPaths(g.preset),g,o,{...rV(d.config,d.fileHeldSettings,h),configPath:u.configLayers.includes(u.configHome)?u.configHome:null});k$(n,{prompts:String(v.metrics?.messageCount??`-`),nonPrompts:String(v.metrics?.nonPrompts??`-`),pr:EU(v.git),feeds:jQ(v.feeds)});let y=[],b=CU(g,p),ee=K$.of(a),x=hK(d.config,d.compiled,d.store,d.registry,{...v,drawing:r},t,b,{perSegmentSink:d.lastRenderCellsBySegment,onRenderWarning:e=>y.push(e)},{...g,effects:ee}),S=EJ(U$,a,t,r.by),te=S.kind===`held`||S.kind===`owed`?S.error:null,ne=te?.text??null,re=[Ct(e.refusedArgs),c,u.lastError,ne].filter(Boolean).join(`
498
+ `),ie=t1.notice({sessionId:a,dismissed:U$.get(a,SV),enabled:g.updateNotice}),ae=u.lastError===null?null:u.failedFile,oe=[...u.lastWarning===null?[]:[{kind:`load`,message:u.lastWarning}],...y],C=Rv(re,ie,oe.map(e=>e.message).join(`
499
+ `)),w=B$.getStats(),se=V$.getStats(),T=ee.lastFrame(),ce=T.own.map(e=>`${e.placement}:${e.effect}@${e.t.toFixed(3)}`).join(`,`)||`-`,le=e=>e.map(e=>`${e.placement}@${e.t.toFixed(3)}`).join(`,`)||`-`,ue=oe.map(e=>{switch(e.kind){case`rule`:return`rule:${e.slot}`;case`refresh`:return`refresh:${e.variable}`;case`load`:case`band-floor`:case`when`:return e.kind}}).join(`,`)||`-`;return k$(n,{git:`${w.size}/${w.hits}h/${w.misses}m`,usage:`${se.size}/${se.hits}h/${se.misses}m`,effect:T.effect,effectT:T.t.toFixed(3),effectRows:`${T.made}made/${T.reused}reused`,effectOwn:ce,fadeBasis:T.basis,stateRev:String(T.revision),fades:le(T.fades),leaves:le(T.leaves),motion:x.motion,err:re?`Y`:`N`,clickError:S.kind===`none`?`-`:S.kind,upd:String(ie.length),warn:ue}),{drawn:{body:x.text,diagnostics:C,failedConfigFile:ae,geometry:{width:p,rowCap:m,colorCompatibility:g.colorCompatibility}},motion:x.motion,clickShown:te,lanes:_}}catch(e){i.e=e}finally{i.d()}}function B1(e,t){return Vv(e.body,e.diagnostics,{fullText:t,failedConfigFile:e.failedConfigFile},e.geometry)+`
500
+ `}function V1(e){return e.diagnostics===null?null:Bv(e.diagnostics)}function H1(e){let t=e.hookData.session_id,{client:n,...r}=e.hints,i=JSON.stringify(r);U$.get(t,`client-hints`)!==i&&U$.set(t,GZ,i);let a=bZ(e.requested);U$.get(t,`render-origin`)!==a&&U$.set(t,vZ,a)}async function U1(e,t,n,r){H1(e);let{drawn:i,motion:a,clickShown:o,lanes:s}=await z1(e,n,r,s_),{link:c,failure:l}=Z$.sync(e.hookData.session_id,t,V1(i));k$(r,{dumpFailed:l===null?`-`:JSON.stringify(l)});let u=B1(i,c),d=e.hookData.session_id,f=T$(s,J$.following(d)),p=W1(d,i,c,u,f),m=QA(e.hints.client??null)===`statusline`;return k$(r,{handoff:(m?f:[]).join(`,`)||`-`}),{answer:m?p:u,motion:a,clickShown:o}}function W1(e,t,n,r,i){let[a,...o]=i;return a===void 0?r:B1({...t,body:Hv(E$(e,[a,...o]),t.geometry)},n)}const G1={connectMs:200,budgetMs:500};async function K1(e,n){let r=n.includes(`--json`),i=await q1(e);if(i.kind!==`ok`&&(t.stderr.write(`${e}: ${Wt(i)}\n`),t.exit(1)),r){t.stdout.write(JSON.stringify(i.value,null,2)+`
501
+ `);return}t.stdout.write(J1(i.value))}function q1(e){return Rt({kind:`debug`,what:e},G1,e=>`debug`in e?e.debug:void 0)}function J1(e){switch(e.what){case`vars`:return Y1(e.vars);case`segments`:return X1(e.segments);case`config`:return Z1(e.config);default:return e}}function Y1(e){if(e.length===0)return`no variables (DSL not active)
502
+ `;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?``:` ${$1(a.ageMs)}`,o=a.lastError?` ✗ ${a.lastError.message}`:``;t.push(` ${a.name.padEnd(n)} ${(a.source??`—`).padEnd(r)} ${a.type.padEnd(i)} ${Q1(a.value)}${e}${o}`)}return t.join(`
503
503
  `)+`
504
- `}function q1(e){if(e.length===0)return`no segments (DSL not active)
504
+ `}function X1(e){if(e.length===0)return`no segments (DSL not active)
505
505
  `;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(`
506
506
  `)+`
507
- `}function J1(e){return e===null?`config: DSL not active
507
+ `}function Z1(e){return e===null?`config: DSL not active
508
508
  `:JSON.stringify(e,null,2)+`
509
- `}function Y1(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?t.slice(0,57)+`…`:t}function X1(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m`}function Z1(){let e=$1();return e===null?null:p.readFileSync(e,`utf-8`)}function Q1(){let e;try{e=Z1()}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 $1(){let e=s.join(`schema`,`cc-candybar.schema.json`),n=t.argv[1];if(n===void 0)return null;let r=s.dirname(s.resolve(n));for(;;){let t=s.join(r,e);if(p.existsSync(t))return t;let n=s.dirname(r);if(n===r)return null;r=n}}function e0(e,t){return oz(t,e.CC_CANDYBAR_CONFIG)}const t0=5e3;function n0(e,t,n){let r=`/home/tester`,i=Math.floor(n),a=`test0a1b-2c3d-4e5f-6a7b-8c9d0e1f2a3b`,o={current_dir:`${r}/code/cc-candybar/src`,project_dir:`${r}/code/cc-candybar`,added_dirs:[]};return{hook_event_name:`Status`,session_id:a,version:`1.15.0`,home:r,cwd:`${r}/code/cc-candybar/src`,transcript_path:`${r}/.claude/projects/x/test.jsonl`,model:{id:`claude-opus-4-8`,display_name:`Opus 4.8`},effort:{level:`xhigh`},workspace:o,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`,tracking:`tracked`,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:i+2*3600},weekly:{percentage:21,resetsAt:i+5*86400},cache:{expiresAt:i+900},tmux:{pane:`%0`,session:`work`},host:{name:`tester-box`,user:`tester`,ssh:!0},autocompact:JM(4e5,1e6),...wU(e),history:{undo:1,redo:1,sinceEdit:1},navigation:{back:1},unsaved:1,resettable:J_(()=>!0),themeDefault:{differs:!0,theme:`<theme>`},resumeCommand:SU(o,a,void 0),configPath:t??`${r}/.config/cc-candybar/config.json5`}}function r0(e,t){let n=Wz(e,e),r=qz(n);return r!==null&&t.push(r),n.kind===`chain`?n.layers:[]}async function i0(e,n=t.cwd()){let r=[],i=oz(n,e)??null,a=i===null?r0(n,r):[i];if(i!==null){let e;try{e=p.statSync(i,{throwIfNoEntry:!1})}catch(e){return{kind:`unreadable`,path:i,message:e instanceof Error?e.message:String(e)}}if(e!==void 0&&!e.isFile())return{kind:`unreadable`,path:i,message:`not a file`}}let o=Yz(n,n);o!==null&&r.push(o);try{return{kind:`clean`,layers:a,warnings:r,rendered:await s0(a,n,r)}}catch(e){let t=e;return typeof t==`object`&&t&&typeof t.code==`string`&&typeof t.path==`string`&&a.includes(t.path)&&typeof t.message==`string`?{kind:`unreadable`,path:t.path,message:t.message}:(e instanceof Sg&&r.push(...e.warnings),{kind:`fatal`,layers:a,message:e instanceof Sg||e instanceof Error?e.message:String(e),warnings:r})}}async function a0(e,t,n){let r=rB(e,EB,{entered:()=>{},warned:e=>n.push(...e)},{projectDir:t,cwd:t}),{config:i}=r,a=new DK,o=new PO(a,i.globals.default_empty_value??``,void 0,new UK);try{let s=tK(i,o,{cwd:t});n.push(...s.loadWarnings);let c=await o.settled(t0);return c.length>0&&n.push(`source${c.length===1?``:`s`} still running after ${t0} ms, rendered with fallback values: ${c.join(`, `)}`),{layers:e,droppedPlugins:[...r.installed.dropped,...r.layers.flatMap(e=>e.plugins.dropped)],config:i,compiled:s,store:a,registry:o}}catch(e){throw o.dispose(),e}}function o0({layers:e,config:t,compiled:n,store:r,registry:i},a,o,s){let c=new Map,l=new Set;return{rendered:mK(t,n,r,i,n0(a,e.at(-1)??null,s),s,CU(a,o),{onSegmentError:(e,t)=>c.set(`segment "${e}"`,t),onRenderWarning:e=>{switch(e.kind){case`rule`:c.set(`${e.slot} rule`,e.message);return;case`when`:c.set(e.where,e.error);return;case`refresh`:c.set(`variable "${e.variable}"`,`cannot refresh: ${e.error}`);return;case`band-floor`:l.add(e.message);return;default:}}},a),failures:c,advisories:l}}async function s0(e,t,n){let r=await a0(e,t,n),{config:i}=r,a=uO(new Date);try{let e=LV();try{gV(i),OF(i)}finally{e()}let t=Ay(null,i.globals.preset,i.presets),o=(e,t)=>{let n=PB(i,t=>t===`preset`?e:null,()=>t),o;try{o=o0(r,n,200,a)}catch(e){o={failures:new Map([[`render`,e instanceof Error?e.message:String(e)]]),advisories:new Set}}return{preset:e,customized:t,...o}},s=o(t,!1),c=[s,o(t,!0),...ky(i.presets).filter(e=>e!==t).flatMap(e=>[o(e,!1),o(e,!0)])],l=e=>{let n=new Map;for(let t of c)for(let r of e(t)){let e=n.get(r)??new Map;e.set(t.preset,(e.get(t.preset)??new Set).add(t.customized)),n.set(r,e)}return[...n].map(([e,n])=>n.get(t)?.has(!1)?e:`${e} (under ${[...n].map(([e,n])=>[...e===t?[]:[`preset "${e}"`],...n.has(!1)?[]:[`.preset.customized = true`]].join(`, `)).join(`; `)})`)};n.push(...l(e=>e.advisories));let u=l(e=>[...e.failures].map(([e,t])=>`${e}: ${t}`)),d=s.rendered,f=r.droppedPlugins.length,p=[...f>0?[`${f} plugin${f===1?``:`s`} did not load (named in the warnings)`]:[],...u.length>0||d===void 0?[`config renders with ${u.length} render error${u.length===1?``:`s`} (the daemon would show them on the bar):\n`+u.map(e=>` ${e}`).join(`
509
+ `}function Q1(e){let t=typeof e==`string`?e:JSON.stringify(e);return t.length>60?t.slice(0,57)+`…`:t}function $1(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m`}function e0(){let e=n0();return e===null?null:p.readFileSync(e,`utf-8`)}function t0(){let e;try{e=e0()}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 n0(){let e=s.join(`schema`,`cc-candybar.schema.json`),n=t.argv[1];if(n===void 0)return null;let r=s.dirname(s.resolve(n));for(;;){let t=s.join(r,e);if(p.existsSync(t))return t;let n=s.dirname(r);if(n===r)return null;r=n}}function r0(e,t){return oz(t,e.CC_CANDYBAR_CONFIG)}const i0=5e3;function a0(e,t,n){let r=`/home/tester`,i=Math.floor(n),a=`test0a1b-2c3d-4e5f-6a7b-8c9d0e1f2a3b`,o={current_dir:`${r}/code/cc-candybar/src`,project_dir:`${r}/code/cc-candybar`,added_dirs:[]};return{hook_event_name:`Status`,session_id:a,version:`1.15.0`,home:r,cwd:`${r}/code/cc-candybar/src`,transcript_path:`${r}/.claude/projects/x/test.jsonl`,model:{id:`claude-opus-4-8`,display_name:`Opus 4.8`},effort:{level:`xhigh`},workspace:o,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`,tracking:`tracked`,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:i+2*3600},weekly:{percentage:21,resetsAt:i+5*86400},cache:{expiresAt:i+900},tmux:{pane:`%0`,session:`work`},host:{name:`tester-box`,user:`tester`,ssh:!0},autocompact:JM(4e5,1e6),...wU(e),history:{undo:1,redo:1,sinceEdit:1},navigation:{back:1},unsaved:1,resettable:J_(()=>!0),themeDefault:{differs:!0,theme:`<theme>`},resumeCommand:SU(o,a,void 0),configPath:t??`${r}/.config/cc-candybar/config.json5`}}function o0(e,t){let n=Wz(e,e),r=qz(n);return r!==null&&t.push(r),n.kind===`chain`?n.layers:[]}async function s0(e,n=t.cwd()){let r=[],i=oz(n,e)??null,a=i===null?o0(n,r):[i];if(i!==null){let e;try{e=p.statSync(i,{throwIfNoEntry:!1})}catch(e){return{kind:`unreadable`,path:i,message:e instanceof Error?e.message:String(e)}}if(e!==void 0&&!e.isFile())return{kind:`unreadable`,path:i,message:`not a file`}}let o=Yz(n,n);o!==null&&r.push(o);try{return{kind:`clean`,layers:a,warnings:r,rendered:await u0(a,n,r)}}catch(e){let t=e;return typeof t==`object`&&t&&typeof t.code==`string`&&typeof t.path==`string`&&a.includes(t.path)&&typeof t.message==`string`?{kind:`unreadable`,path:t.path,message:t.message}:(e instanceof Sg&&r.push(...e.warnings),{kind:`fatal`,layers:a,message:e instanceof Sg||e instanceof Error?e.message:String(e),warnings:r})}}async function c0(e,t,n){let r=rB(e,EB,{entered:()=>{},warned:e=>n.push(...e)},{projectDir:t,cwd:t}),{config:i}=r,a=new DK,o=new PO(a,i.globals.default_empty_value??``,void 0,new UK);try{let s=tK(i,o,{cwd:t});n.push(...s.loadWarnings);let c=await o.settled(i0);return c.length>0&&n.push(`source${c.length===1?``:`s`} still running after ${i0} ms, rendered with fallback values: ${c.join(`, `)}`),{layers:e,droppedPlugins:[...r.installed.dropped,...r.layers.flatMap(e=>e.plugins.dropped)],config:i,compiled:s,store:a,registry:o}}catch(e){throw o.dispose(),e}}function l0({layers:e,config:t,compiled:n,store:r,registry:i},a,o,s){let c=new Map,l=new Set;return{rendered:mK(t,n,r,i,a0(a,e.at(-1)??null,s),s,CU(a,o),{onSegmentError:(e,t)=>c.set(`segment "${e}"`,t),onRenderWarning:e=>{switch(e.kind){case`rule`:c.set(`${e.slot} rule`,e.message);return;case`when`:c.set(e.where,e.error);return;case`refresh`:c.set(`variable "${e.variable}"`,`cannot refresh: ${e.error}`);return;case`band-floor`:l.add(e.message);return;default:}}},a),failures:c,advisories:l}}async function u0(e,t,n){let r=await c0(e,t,n),{config:i}=r,a=uO(new Date);try{let e=LV();try{gV(i),OF(i)}finally{e()}let t=Ay(null,i.globals.preset,i.presets),o=(e,t)=>{let n=PB(i,t=>t===`preset`?e:null,()=>t),o;try{o=l0(r,n,200,a)}catch(e){o={failures:new Map([[`render`,e instanceof Error?e.message:String(e)]]),advisories:new Set}}return{preset:e,customized:t,...o}},s=o(t,!1),c=[s,o(t,!0),...ky(i.presets).filter(e=>e!==t).flatMap(e=>[o(e,!1),o(e,!0)])],l=e=>{let n=new Map;for(let t of c)for(let r of e(t)){let e=n.get(r)??new Map;e.set(t.preset,(e.get(t.preset)??new Set).add(t.customized)),n.set(r,e)}return[...n].map(([e,n])=>n.get(t)?.has(!1)?e:`${e} (under ${[...n].map(([e,n])=>[...e===t?[]:[`preset "${e}"`],...n.has(!1)?[]:[`.preset.customized = true`]].join(`, `)).join(`; `)})`)};n.push(...l(e=>e.advisories));let u=l(e=>[...e.failures].map(([e,t])=>`${e}: ${t}`)),d=s.rendered,f=r.droppedPlugins.length,p=[...f>0?[`${f} plugin${f===1?``:`s`} did not load (named in the warnings)`]:[],...u.length>0||d===void 0?[`config renders with ${u.length} render error${u.length===1?``:`s`} (the daemon would show them on the bar):\n`+u.map(e=>` ${e}`).join(`
510
510
  `)]:[]];if(p.length>0||d===void 0)throw Error(p.join(`
511
- `));return d}finally{r.registry.dispose()}}function c0(e){return e.map(e=>`warning: ${e}\n`).join(``)}function l0(e,t=!1){switch(e.kind){case`clean`:return{stdout:`✓ ${e.layers.join(` < `)||`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:c0(e.warnings),code:0};case`fatal`:return{stdout:``,stderr:c0(e.warnings)+`✗ ${e.layers.join(` < `)||`<default>`}\n${e.message}\n`,code:1};case`unreadable`:return{stdout:``,stderr:`check: cannot read ${e.path}: ${e.message}\n`,code:2}}}const u0=`--render`,d0=`Usage: cc-candybar check [${u0}] [config-file]\n`;function f0(e){let t=e.filter(e=>e.startsWith(`--`)),n=e.filter(e=>!e.startsWith(`--`)),r=t.filter(e=>e!==u0);return r.length>0?{kind:`usage`,message:`check: unknown option ${r.join(` `)}\n${d0}`}:n.length>1||n[0]===``?{kind:`usage`,message:`check: expected at most one non-empty path\n${d0}`}:{kind:`run`,target:n[0],render:t.includes(u0)}}async function p0(e){let n=f0(e),r=n.kind===`usage`?{stdout:``,stderr:n.message,code:2}:l0(await i0(n.target??e0(t.env,t.cwd())),n.render);t.stdout.write(r.stdout),t.stderr.write(r.stderr),t.exit(r.code)}const m0=/^[a-z][a-z0-9+.-]*:\/\//i,h0=/^[^@\s/]+@[^:\s/]+:/,g0=/^([A-Za-z0-9-]+\/[A-Za-z0-9._-]+?)(?:\.git)?$/;function _0(e){if(!URL.canParse(e))return e;let t=new URL(e);return t.password===``?e:(t.password=`***`,t.href)}function v0(e,t,n){let r=az(t,e);if(n(r))return{kind:`path`,dir:r};if(m0.test(e)||h0.test(e))return{kind:`git`,url:e,shown:_0(e)};let i=g0.exec(e);if(i){let e=`https://github.com/${i[1]}.git`;return{kind:`git`,url:e,shown:e}}return{error:`"${e}" is not a directory, a GitHub repo slug (owner/repo) or a git URL`}}function y0(e,t){let n=s.join(e,Fz),r=Rz(n);if(`error`in r)throw Error(`${t}: could not list ${Fz}: ${r.error}`);if(r.folders.length===0)throw Error(`${t} has no plugins: none at ${Fz}/<name>/${lz}`);return r.folders.map(e=>s.join(n,e,lz))}function b0(e,t,n){let r=(n,...r)=>{let i=We({bin:`git`,args:r,env:n,category:`plugin.git`});if(!i.ok)throw Error(`git ${r.map(n=>n===e?t:n).join(` `)} failed (${i.reason}): ${i.stderr.trim()||i.error||``}`);return i.stdout},i={...process.env,GIT_TERMINAL_PROMPT:`0`};for(let e of r(i,`rev-parse`,`--local-env-vars`).split(`
512
- `))delete i[e];r(i,`clone`,`--quiet`,`--depth`,`1`,`--filter=blob:none`,`--sparse`,`--`,e,n),r(i,`-C`,n,`sparse-checkout`,`set`,`--no-cone`,`/${Fz}/`)}function x0(e,t){switch(e.kind){case`path`:return t(e.dir);case`git`:{let n=p.mkdtempSync(s.join(S.tmpdir(),`cc-candybar-plugin-`));try{return b0(e.url,e.shown,s.join(n,`repo`)),t(s.join(n,`repo`))}finally{p.rmSync(n,{recursive:!0,force:!0})}}}}function S0(e){let t;try{t=p.lstatSync(e)}catch(e){if(e.code===`ENOENT`)return`installed`;throw e}if(t.isDirectory())return`updated`;if(t.isSymbolicLink())return`replaced`;throw Error(`${e} is a file, not a plugin folder: move it, then install again`)}function C0(e,t,n,r){switch(r){case`updated`:p.renameSync(s.join(e,lz),s.join(t,lz));return;case`replaced`:p.renameSync(t,n),p.renameSync(e,t);return;case`installed`:p.renameSync(e,t);return}}function w0(e,t,n){let r=y0(e,n);p.mkdirSync(t,{recursive:!0});let i=p.mkdtempSync(s.join(t,`.install-`));try{let a=r.map(e=>{let t=s.join(i,s.basename(s.dirname(e)));p.mkdirSync(t);try{p.copyFileSync(e,s.join(t,lz))}catch(e){if(e.code!==`ENOENT`)throw e}return t}),o=tB(a.map(e=>s.join(e,lz)),EB,{root:e,git:!1});if(o.length>0)throw Error(o.map(e=>`${n}: ${s.join(Fz,s.relative(i,e.path))} would not load: ${e.reason.split(i).join(s.join(n,Fz))}`).join(`
513
- `));let c=a.map(e=>{let n=s.basename(e),r=s.join(t,n);return{folder:e,name:n,target:r,placed:S0(r)}}),l=[];try{for(let{folder:e,name:t,target:n,placed:r}of c)C0(e,n,s.join(i,`.replaced-${t}`),r),l.push(t)}catch(e){throw Error(`${e.message} (placed before it: ${l.join(`, `)||`none`})`)}return c.map(({target:e,placed:t})=>({path:s.join(e,lz),placed:t}))}finally{p.rmSync(i,{recursive:!0,force:!0})}}function T0(e){let[t,n,...r]=e;if(t!==`install`||n===void 0||r.length>0)return console.error(`Usage: cc-candybar plugin install <path | owner/repo | git URL>`),2;let i=v0(n,process.cwd(),EO);if(`error`in i)return console.error(`plugin install: ${i.error}`),2;try{let e=i.kind===`path`?i.dir:i.shown,t=x0(i,t=>w0(t,Pz(),e));for(let{path:n,placed:r}of t)console.log(`${r} plugin ${s.basename(s.dirname(n))} → ${n} (from ${e})`);return 0}catch(e){return console.error(`plugin install: ${e.message}`),1}}function E0(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 D0=[`SSH_CONNECTION`,`SSH_CLIENT`,`SSH_TTY`];function O0(e,t,n){return{termCols:E0(e.COLUMNS,n.columns),termRows:E0(e.LINES,n.rows),ssh:D0.some(t=>(e[t]??``)!==``),tmux:zA(e),configEnv:e0(e,t),claudeConfigDir:na(e,t),mementoEnv:mt(e,t),terminalEnv:gt(e)}}function k0(e){return e.clients.map(e=>typeof e==`object`&&e?e:{})}function A0(e){let t=yX(e,[`bundle`,`clients`]);if(t!==null)return{kind:`failed`,reason:t};if(typeof e.bundle!=`string`)return{kind:`failed`,reason:`the running daemon (${e.version}) reported its bundle as ${JSON.stringify(e.bundle)}`};let n=k0(e);return n.every(e=>typeof e.ago==`number`&&typeof e.sessionId==`string`)?{kind:`ok`,value:{bundle:e.bundle,clients:n.map(e=>({client:Lt(e.client)??null,sessionId:e.sessionId,ago:e.ago}))}}:{kind:`failed`,reason:`the running daemon (${e.version}) reported clients without their age or session: ${JSON.stringify(e.clients)}`}}const j0=e=>{let{identity:t,artifacts:n}=e??{};return typeof t==`string`&&typeof n==`object`&&!!n&&Object.values(n).every(e=>typeof e==`string`)},M0=e=>{let t=e??{};if(t.kind===`unmeasured`)return!0;let n=t.charge;return t.kind===`measured`&&typeof t.rss==`number`&&typeof t.heapTotal==`number`&&typeof n?.bytes==`number`&&(n.kind===`charged`&&(n.measure===`phys_footprint`||n.measure===`rss`)||n.kind===`stand-in`&&typeof n.unread==`string`)};function N0(e,t){let n=e;if(n?.kind===`failed`&&typeof n.reason==`string`)return{kind:`failed`,reason:n.reason};if(n?.kind!==`ok`)return{kind:`misshapen`,reason:`is not an answer`};let r=t(n.value);return r.kind===`ok`?r:{kind:`misshapen`,reason:r.reason}}function P0(e){let t=yX(e,[`daemon`]);if(t!==null)return{kind:`failed`,reason:t};let n=e.daemon,r=N0(n?.postMortems,e=>Array.isArray(e)&&e.every(j0)?{kind:`ok`,value:e}:{kind:`failed`,reason:`is not a list of post-mortems`});return typeof n?.pid==`number`&&M0(n.memory)&&typeof n.limit==`number`&&r.kind!==`misshapen`?{kind:`ok`,value:{...n,postMortems:r}}:{kind:`failed`,reason:`the running daemon (${e.version}) reported itself as ${JSON.stringify(e.daemon)}`}}function F0(e,t,n){let r=yX(e,[`clients`]);if(r!==null)return{kind:`failed`,reason:r};let i=k0(e);return i.every(t)?{kind:`ok`,value:i}:{kind:`failed`,reason:`the running daemon (${e.version}) reported its renders without ${n} — restart it on this build: ${JSON.stringify(e.clients)}`}}const I0=e=>ZA.includes(e.role),L0=e=>F0(e,e=>typeof e.ago==`number`&&typeof e.sessionId==`string`&&typeof e.claudeConfigDir==`string`&&qA.includes(e.rateLimits),`the rate-limit windows they carried`),R0=e=>F0(e,e=>{let t=e.transcript;return typeof e.ago==`number`&&typeof e.sessionId==`string`&&typeof t?.path==`string`&&typeof t.answered==`boolean`},`their transcripts`),z0=e=>F0(e,e=>typeof e.ago==`number`&&typeof e.claudeConfigDir==`string`&&typeof e.projectDir==`string`&&typeof e.sessionId==`string`&&typeof e.since==`number`&&Array.isArray(e.redrawn)&&e.redrawn.length>0&&e.redrawn.every(Number.isInteger)&&I0(e)&&XA.includes(e.frame),`what they drew, when, and from which project`),B0=e=>F0(e,e=>typeof e.sessionId==`string`&&typeof e.ago==`number`&&I0(e)&&(e.termCols===null||typeof e.termCols==`number`),`whose they were or the width they measured`);function V0(e,t,n){let r=e.doctorStores?.[t],i=N0(r,n);return i.kind===`misshapen`?{kind:`failed`,reason:`the running daemon (${e.version}) reported its ${t} as ${JSON.stringify(r)}, which ${i.reason}`}:i}function H0(e){let t=yX(e,[`doctorStores`]);if(t!==null){let e={kind:`failed`,reason:t};return{marks:e,clicked:e,postMortemsRead:e}}return{marks:V0(e,`marks`,AJ),clicked:V0(e,`clicked`,NJ),postMortemsRead:V0(e,`postMortemsRead`,FY)}}async function U0(){let e=await vX();if(e.kind!==`ok`){let t={kind:`failed`,reason:Wt(e).split(`
514
- `).join(` — `)};return{clients:t,rateLimits:t,transcripts:t,frames:t,widths:t,serving:t,stores:{marks:t,clicked:t,postMortemsRead:t}}}return{clients:A0(e.value),rateLimits:L0(e.value),transcripts:R0(e.value),frames:z0(e.value),widths:B0(e.value),serving:P0(e.value),stores:H0(e.value)}}const W0=` (fix: click the settings menu (${kr} by default) › 🧰 tools › 🩺 doctor, then [fix] on the bar)`,G0=`mark them ✓ shapes or ✗ boxes in the bar's doctor, and this command reads your mark: the settings menu (${kr} by default) › 🧰 tools › 🩺 doctor`;function K0({check:e,verdict:t}){return t.ok?`✓ ${e.label}${t.note===void 0?``:` — ${t.note}`}\n`:`✗ ${e.label} — ${t.reason}${t.fix===void 0?``:W0}\n`+(t.more??[]).map(e=>` ${e}\n`).join(``)+(t.sighting===void 0?``:` look: ${t.sighting.glyphs} — ${G0}\n`)}function q0(e){let t={sessionState:new UK},n=IK(e.projectDir,e.cwd,e.configFile??void 0,t),r=n.state??LK(e.cwd,e.projectDir,t);return r.registry.dispose(),{layers:n.layers,error:n.error,warning:n.warning,unused:r.unused,config:r.config}}function J0(e,t,n){return n.kind===`failed`?n:zY(e,n.value.bundle,RJ(t,n.value.clients).map(({client:e})=>e))}function Y0(e,t,n){return t.kind===`failed`?t:{kind:`ok`,value:RJ(e,t.value).filter(e=>e.claudeConfigDir===n).map(e=>e.rateLimits)}}function X0(e,t){return t.kind===`failed`?t:{kind:`ok`,value:RJ(e,t.value).map(e=>e.transcript)}}function Z0(e,t){return t.kind===`failed`?t:{kind:`ok`,value:BJ(e,t.value)}}function Q0(e,t,n){return e.kind===`recent`?{kind:`ok`,value:{columns:n,of:{kind:`command`}}}:t.kind===`failed`?t:pX(e.sessionId,RJ(e,t.value))}async function $0(e,t,n,r,i,a,o=void 0){let s;try{let c=await n(),l=O0(r,i,a()),u=LJ(r.CLAUDE_CODE_SESSION_ID);s={...mX(e,l,{projectDir:zJ(u,c.frames.kind===`ok`?c.frames.value:[],i),cwd:i,configFile:oz(i,o)??e0(r,i)??null},()=>null,c.serving,Y0(u,c.rateLimits,ra(l.claudeConfigDir)),X0(u,c.transcripts),u,Z0(u,c.frames),Q0(u,c.widths,l.termCols??null),c.stores),urlHandler:await FX(t),install:J0(e.install,u,c.clients)}}catch(e){return{stdout:``,stderr:`doctor: ${e instanceof Error?e.message:String(e)}\n`,code:2}}let c=pM(s);return{stdout:c.map(K0).join(``),stderr:``,code:+!c.every(e=>e.verdict.ok)}}function e2(){if(t.stderr.isTTY)return t.stderr;let e;try{e=v(`/dev/tty`,`r+`)}catch{return{}}let n=new ve(e),{columns:r}=n;return n.destroy(),{columns:r}}async function t2(e){(e.length>1||e[0]===``||e[0]?.startsWith(`--`))&&(t.stderr.write(`doctor: expected at most one config file
511
+ `));return d}finally{r.registry.dispose()}}function d0(e){return e.map(e=>`warning: ${e}\n`).join(``)}function f0(e,t=!1){switch(e.kind){case`clean`:return{stdout:`✓ ${e.layers.join(` < `)||`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:d0(e.warnings),code:0};case`fatal`:return{stdout:``,stderr:d0(e.warnings)+`✗ ${e.layers.join(` < `)||`<default>`}\n${e.message}\n`,code:1};case`unreadable`:return{stdout:``,stderr:`check: cannot read ${e.path}: ${e.message}\n`,code:2}}}const p0=`--render`,m0=`Usage: cc-candybar check [${p0}] [config-file]\n`;function h0(e){let t=e.filter(e=>e.startsWith(`--`)),n=e.filter(e=>!e.startsWith(`--`)),r=t.filter(e=>e!==p0);return r.length>0?{kind:`usage`,message:`check: unknown option ${r.join(` `)}\n${m0}`}:n.length>1||n[0]===``?{kind:`usage`,message:`check: expected at most one non-empty path\n${m0}`}:{kind:`run`,target:n[0],render:t.includes(p0)}}async function g0(e){let n=h0(e),r=n.kind===`usage`?{stdout:``,stderr:n.message,code:2}:f0(await s0(n.target??r0(t.env,t.cwd())),n.render);t.stdout.write(r.stdout),t.stderr.write(r.stderr),t.exit(r.code)}const _0=/^[a-z][a-z0-9+.-]*:\/\//i,v0=/^[^@\s/]+@[^:\s/]+:/,y0=/^([A-Za-z0-9-]+\/[A-Za-z0-9._-]+?)(?:\.git)?$/;function b0(e){if(!URL.canParse(e))return e;let t=new URL(e);return t.password===``?e:(t.password=`***`,t.href)}function x0(e,t,n){let r=az(t,e);if(n(r))return{kind:`path`,dir:r};if(_0.test(e)||v0.test(e))return{kind:`git`,url:e,shown:b0(e)};let i=y0.exec(e);if(i){let e=`https://github.com/${i[1]}.git`;return{kind:`git`,url:e,shown:e}}return{error:`"${e}" is not a directory, a GitHub repo slug (owner/repo) or a git URL`}}function S0(e,t){let n=s.join(e,Fz),r=Rz(n);if(`error`in r)throw Error(`${t}: could not list ${Fz}: ${r.error}`);if(r.folders.length===0)throw Error(`${t} has no plugins: none at ${Fz}/<name>/${lz}`);return r.folders.map(e=>s.join(n,e,lz))}function C0(e,t,n){let r=(n,...r)=>{let i=We({bin:`git`,args:r,env:n,category:`plugin.git`});if(!i.ok)throw Error(`git ${r.map(n=>n===e?t:n).join(` `)} failed (${i.reason}): ${i.stderr.trim()||i.error||``}`);return i.stdout},i={...process.env,GIT_TERMINAL_PROMPT:`0`};for(let e of r(i,`rev-parse`,`--local-env-vars`).split(`
512
+ `))delete i[e];r(i,`clone`,`--quiet`,`--depth`,`1`,`--filter=blob:none`,`--sparse`,`--`,e,n),r(i,`-C`,n,`sparse-checkout`,`set`,`--no-cone`,`/${Fz}/`)}function w0(e,t){switch(e.kind){case`path`:return t(e.dir);case`git`:{let n=p.mkdtempSync(s.join(S.tmpdir(),`cc-candybar-plugin-`));try{return C0(e.url,e.shown,s.join(n,`repo`)),t(s.join(n,`repo`))}finally{p.rmSync(n,{recursive:!0,force:!0})}}}}function T0(e){let t;try{t=p.lstatSync(e)}catch(e){if(e.code===`ENOENT`)return`installed`;throw e}if(t.isDirectory())return`updated`;if(t.isSymbolicLink())return`replaced`;throw Error(`${e} is a file, not a plugin folder: move it, then install again`)}function E0(e,t,n,r){switch(r){case`updated`:p.renameSync(s.join(e,lz),s.join(t,lz));return;case`replaced`:p.renameSync(t,n),p.renameSync(e,t);return;case`installed`:p.renameSync(e,t);return}}function D0(e,t,n){let r=S0(e,n);p.mkdirSync(t,{recursive:!0});let i=p.mkdtempSync(s.join(t,`.install-`));try{let a=r.map(e=>{let t=s.join(i,s.basename(s.dirname(e)));p.mkdirSync(t);try{p.copyFileSync(e,s.join(t,lz))}catch(e){if(e.code!==`ENOENT`)throw e}return t}),o=tB(a.map(e=>s.join(e,lz)),EB,{root:e,git:!1});if(o.length>0)throw Error(o.map(e=>`${n}: ${s.join(Fz,s.relative(i,e.path))} would not load: ${e.reason.split(i).join(s.join(n,Fz))}`).join(`
513
+ `));let c=a.map(e=>{let n=s.basename(e),r=s.join(t,n);return{folder:e,name:n,target:r,placed:T0(r)}}),l=[];try{for(let{folder:e,name:t,target:n,placed:r}of c)E0(e,n,s.join(i,`.replaced-${t}`),r),l.push(t)}catch(e){throw Error(`${e.message} (placed before it: ${l.join(`, `)||`none`})`)}return c.map(({target:e,placed:t})=>({path:s.join(e,lz),placed:t}))}finally{p.rmSync(i,{recursive:!0,force:!0})}}function O0(e){let[t,n,...r]=e;if(t!==`install`||n===void 0||r.length>0)return console.error(`Usage: cc-candybar plugin install <path | owner/repo | git URL>`),2;let i=x0(n,process.cwd(),EO);if(`error`in i)return console.error(`plugin install: ${i.error}`),2;try{let e=i.kind===`path`?i.dir:i.shown,t=w0(i,t=>D0(t,Pz(),e));for(let{path:n,placed:r}of t)console.log(`${r} plugin ${s.basename(s.dirname(n))} → ${n} (from ${e})`);return 0}catch(e){return console.error(`plugin install: ${e.message}`),1}}function k0(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 A0=[`SSH_CONNECTION`,`SSH_CLIENT`,`SSH_TTY`];function j0(e,t,n){return{termCols:k0(e.COLUMNS,n.columns),termRows:k0(e.LINES,n.rows),ssh:A0.some(t=>(e[t]??``)!==``),tmux:zA(e),configEnv:r0(e,t),claudeConfigDir:na(e,t),mementoEnv:mt(e,t),terminalEnv:gt(e)}}function M0(e){return e.clients.map(e=>typeof e==`object`&&e?e:{})}function N0(e){let t=yX(e,[`bundle`,`clients`]);if(t!==null)return{kind:`failed`,reason:t};if(typeof e.bundle!=`string`)return{kind:`failed`,reason:`the running daemon (${e.version}) reported its bundle as ${JSON.stringify(e.bundle)}`};let n=M0(e);return n.every(e=>typeof e.ago==`number`&&typeof e.sessionId==`string`)?{kind:`ok`,value:{bundle:e.bundle,clients:n.map(e=>({client:Lt(e.client)??null,sessionId:e.sessionId,ago:e.ago}))}}:{kind:`failed`,reason:`the running daemon (${e.version}) reported clients without their age or session: ${JSON.stringify(e.clients)}`}}const P0=e=>{let{identity:t,artifacts:n}=e??{};return typeof t==`string`&&typeof n==`object`&&!!n&&Object.values(n).every(e=>typeof e==`string`)},F0=e=>{let t=e??{};if(t.kind===`unmeasured`)return!0;let n=t.charge;return t.kind===`measured`&&typeof t.rss==`number`&&typeof t.heapTotal==`number`&&typeof n?.bytes==`number`&&(n.kind===`charged`&&(n.measure===`phys_footprint`||n.measure===`rss`)||n.kind===`stand-in`&&typeof n.unread==`string`)};function I0(e,t){let n=e;if(n?.kind===`failed`&&typeof n.reason==`string`)return{kind:`failed`,reason:n.reason};if(n?.kind!==`ok`)return{kind:`misshapen`,reason:`is not an answer`};let r=t(n.value);return r.kind===`ok`?r:{kind:`misshapen`,reason:r.reason}}function L0(e){let t=yX(e,[`daemon`]);if(t!==null)return{kind:`failed`,reason:t};let n=e.daemon,r=I0(n?.postMortems,e=>Array.isArray(e)&&e.every(P0)?{kind:`ok`,value:e}:{kind:`failed`,reason:`is not a list of post-mortems`});return typeof n?.pid==`number`&&F0(n.memory)&&typeof n.limit==`number`&&r.kind!==`misshapen`?{kind:`ok`,value:{...n,postMortems:r}}:{kind:`failed`,reason:`the running daemon (${e.version}) reported itself as ${JSON.stringify(e.daemon)}`}}function R0(e,t,n){let r=yX(e,[`clients`]);if(r!==null)return{kind:`failed`,reason:r};let i=M0(e);return i.every(t)?{kind:`ok`,value:i}:{kind:`failed`,reason:`the running daemon (${e.version}) reported its renders without ${n} — restart it on this build: ${JSON.stringify(e.clients)}`}}const z0=e=>ZA.includes(e.role),B0=e=>R0(e,e=>typeof e.ago==`number`&&typeof e.sessionId==`string`&&typeof e.claudeConfigDir==`string`&&qA.includes(e.rateLimits),`the rate-limit windows they carried`),V0=e=>R0(e,e=>{let t=e.transcript;return typeof e.ago==`number`&&typeof e.sessionId==`string`&&typeof t?.path==`string`&&typeof t.answered==`boolean`},`their transcripts`),H0=e=>R0(e,e=>typeof e.ago==`number`&&typeof e.claudeConfigDir==`string`&&typeof e.projectDir==`string`&&typeof e.sessionId==`string`&&typeof e.since==`number`&&Array.isArray(e.redrawn)&&e.redrawn.length>0&&e.redrawn.every(Number.isInteger)&&z0(e)&&XA.includes(e.frame),`what they drew, when, and from which project`),U0=e=>R0(e,e=>typeof e.sessionId==`string`&&typeof e.ago==`number`&&z0(e)&&(e.termCols===null||typeof e.termCols==`number`),`whose they were or the width they measured`);function W0(e,t,n){let r=e.doctorStores?.[t],i=I0(r,n);return i.kind===`misshapen`?{kind:`failed`,reason:`the running daemon (${e.version}) reported its ${t} as ${JSON.stringify(r)}, which ${i.reason}`}:i}function G0(e){let t=yX(e,[`doctorStores`]);if(t!==null){let e={kind:`failed`,reason:t};return{marks:e,clicked:e,postMortemsRead:e}}return{marks:W0(e,`marks`,AJ),clicked:W0(e,`clicked`,NJ),postMortemsRead:W0(e,`postMortemsRead`,FY)}}async function K0(){let e=await vX();if(e.kind!==`ok`){let t={kind:`failed`,reason:Wt(e).split(`
514
+ `).join(` — `)};return{clients:t,rateLimits:t,transcripts:t,frames:t,widths:t,serving:t,stores:{marks:t,clicked:t,postMortemsRead:t}}}return{clients:N0(e.value),rateLimits:B0(e.value),transcripts:V0(e.value),frames:H0(e.value),widths:U0(e.value),serving:L0(e.value),stores:G0(e.value)}}const q0=` (fix: click the settings menu (${kr} by default) › 🧰 tools › 🩺 doctor, then [fix] on the bar)`,J0=`mark them ✓ shapes or ✗ boxes in the bar's doctor, and this command reads your mark: the settings menu (${kr} by default) › 🧰 tools › 🩺 doctor`;function Y0({check:e,verdict:t}){return t.ok?`✓ ${e.label}${t.note===void 0?``:` — ${t.note}`}\n`:`✗ ${e.label} — ${t.reason}${t.fix===void 0?``:q0}\n`+(t.more??[]).map(e=>` ${e}\n`).join(``)+(t.sighting===void 0?``:` look: ${t.sighting.glyphs} — ${J0}\n`)}function X0(e){let t={sessionState:new UK},n=IK(e.projectDir,e.cwd,e.configFile??void 0,t),r=n.state??LK(e.cwd,e.projectDir,t);return r.registry.dispose(),{layers:n.layers,error:n.error,warning:n.warning,unused:r.unused,config:r.config}}function Z0(e,t,n){return n.kind===`failed`?n:zY(e,n.value.bundle,RJ(t,n.value.clients).map(({client:e})=>e))}function Q0(e,t,n){return t.kind===`failed`?t:{kind:`ok`,value:RJ(e,t.value).filter(e=>e.claudeConfigDir===n).map(e=>e.rateLimits)}}function $0(e,t){return t.kind===`failed`?t:{kind:`ok`,value:RJ(e,t.value).map(e=>e.transcript)}}function e2(e,t){return t.kind===`failed`?t:{kind:`ok`,value:BJ(e,t.value)}}function t2(e,t,n){return e.kind===`recent`?{kind:`ok`,value:{columns:n,of:{kind:`command`}}}:t.kind===`failed`?t:pX(e.sessionId,RJ(e,t.value))}async function n2(e,t,n,r,i,a,o=void 0){let s;try{let c=await n(),l=j0(r,i,a()),u=LJ(r.CLAUDE_CODE_SESSION_ID);s={...mX(e,l,{projectDir:zJ(u,c.frames.kind===`ok`?c.frames.value:[],i),cwd:i,configFile:oz(i,o)??r0(r,i)??null},()=>null,c.serving,Q0(u,c.rateLimits,ra(l.claudeConfigDir)),$0(u,c.transcripts),u,e2(u,c.frames),t2(u,c.widths,l.termCols??null),c.stores),urlHandler:await FX(t),install:Z0(e.install,u,c.clients)}}catch(e){return{stdout:``,stderr:`doctor: ${e instanceof Error?e.message:String(e)}\n`,code:2}}let c=pM(s);return{stdout:c.map(Y0).join(``),stderr:``,code:+!c.every(e=>e.verdict.ok)}}function r2(){if(t.stderr.isTTY)return t.stderr;let e;try{e=v(`/dev/tty`,`r+`)}catch{return{}}let n=new ve(e),{columns:r}=n;return n.destroy(),{columns:r}}async function i2(e){(e.length>1||e[0]===``||e[0]?.startsWith(`--`))&&(t.stderr.write(`doctor: expected at most one config file
515
515
  Usage: cc-candybar doctor [config-file]
516
- `),t.exit(2));let n=t.cwd(),r=await $0(ZY(q0),zX(),U0,t.env,n,e2,e[0]);t.stdout.write(r.stdout),t.stderr.write(r.stderr),t.exit(r.code)}function n2(e){return!e.ok&&e.code!==`RENDER_FAILED`}function r2(e,t,n,r,i){let a=null,o=e=>{a===null&&(a=e,s.destroy(),i(e))},s=C.createConnection({path:e}),c={v:3,kind:`subscribe`,sessionId:t,lane:n};return s.once(`connect`,()=>s.write(Nt(c))),s.on(`data`,Ft(e=>{let t=e;n2(t)?o({kind:`refused`,resp:t}):r(t)},e=>o({kind:`failed`,error:e}))),s.on(`error`,e=>o({kind:`failed`,error:e})),s.on(`close`,()=>o({kind:`closed-there`})),{close:()=>o({kind:`closed-here`})}}function i2(e,t){switch(t){case`frame-ok`:return 250;case`frame-failed`:return e;case`fault`:return Math.min(2e3,e*2)}}function a2(e){switch(e.kind){case`failed`:return{kind:`reconnect`,reason:`stream failed (${e.error.message})`,kick:!0};case`closed-there`:return{kind:`reconnect`,reason:`daemon closed the stream`,kick:!1};case`refused`:return e.resp.code===`SWITCHED_OFF`?{kind:`off`,resp:e.resp}:e.resp.code===`TIMEOUT`?{kind:`reconnect`,reason:`the daemon was too busy to open the stream (${e.resp.error})`,kick:!1}:e.resp.code===`BAD_REQUEST`?{kind:`reconnect`,reason:`the daemon does not take subscribe (${e.resp.error}); it restarts on the new build`,kick:!1}:e.resp.code===`VERSION_MISMATCH`&&e.resp.daemonV!==void 0&&e.resp.daemonV<3?{kind:`reconnect`,reason:`the daemon is older than this client (${e.resp.error})`,kick:!0}:{kind:`exit`,reason:`the daemon refused the stream: ${e.resp.code}: ${e.resp.error}`}}}function o2(e,t,n,r){let i=null,a=null,o=!1,s=250,c=(e,t)=>{a=setTimeout(()=>{a=null,((t?r.beforeReconnect?.():void 0)??Promise.resolve()).then(()=>{o||l()})},e)},l=()=>{i=r2(e,t,n,e=>{s=i2(s,e.ok?`frame-ok`:`frame-failed`),r.frame(e)},e=>{if(e.kind===`closed-here`||o)return;let t=a2(e);switch(t.kind){case`exit`:r.exit(t.reason);return;case`off`:r.off(t.resp),c(5e3,!1);return;case`reconnect`:{r.fault(t.reason,s),t.kick&&On();let e=s;s=i2(s,`fault`),c(e,!0);return}}})};return l(),{close:()=>{o=!0,a!==null&&clearTimeout(a),i?.close()}}}function s2(e,t){return t.kind===`frame`||t.kind!==e.kind?!0:t.kind===`fault`&&e.kind===`fault`&&t.reason!==e.reason}async function c2(e,n){let{values:r,tokens:i}=ae({args:e.slice(3),options:{config:{type:`string`},lane:{type:`string`}},strict:!0,tokens:!0}),a=[e[1],...i.flatMap(e=>e.kind===`option`&&e.name===`config`?[e.rawName,e.value]:[])],o=t.cwd(),s=e=>{t.stderr.write(`cc-candybar frames: ${e}\n`)},c=p_(r.lane);c===null&&(s(`--lane needs one of ${o_.join(`, `)}`),t.exit(2)),t.stdout.on(`error`,()=>t.exit(0));let l=LQ(t.stdout),u=null,d=null,f=null,p={kind:`none`},m=(e,t)=>{s2(p,e)&&t(),p=e},h=async e=>{let r=await Yt(e,a,o,{...O0(t.env,o,t.stderr),client:O(`frames`,n)});r.kind!==`ok`&&(s(Wt(r)),r.kind===`transient`&&On())},g=e=>{f?.close(),f=o2(et(),e,c,{frame:e=>m({kind:`frame`},()=>l(`${JSON.stringify(e)}\n`)),off:e=>m({kind:`off`},()=>l(`${JSON.stringify(e)}\n`)),fault:(e,t)=>m({kind:`fault`,reason:e},()=>s(`${e}; reconnecting in ${t}ms`)),exit:e=>{s(e),t.exit(1)},beforeReconnect:()=>d===null?Promise.resolve():h(d)})};for await(let e of ye({input:t.stdin})){if(e.trim()===``)continue;let t;try{t=JSON.parse(e)}catch(e){s(`stdin line is not JSON: ${e.message}`);continue}if(typeof t.session_id!=`string`||t.session_id===``){s(`stdin line carries no session_id`);continue}d=t,await h(t),t.session_id!==u&&(u=t.session_id,g(u))}t.exit(0)}function l2(e){let t=e.replace(/\n+$/,``).split(`
517
- `);return{bytes:t.map((e,t)=>`\x1b[${t+1}H${e}`).join(``)+`\x1B[J`,rows:t.length}}const u2=5e3,d2=`usage: cc-candybar bar-pane <claude-code-pane-id, e.g. %3>`;function f2(e,t,n,r){let i=e.split(`
518
- `).map(e=>e.trim().split(` `));return i.some(([e])=>e===n)?VQ(e,BQ(t)).has(r)?{kind:`shown`,zoomed:i.some(([e,,,,t])=>e===r&&t===`1`)}:{kind:`hidden`}:{kind:`gone`}}async function p2(e,t){let[n,r]=await Promise.all([QH(e,`bar-pane.tmux`,[`list-panes`,`-a`,`-f`,`#{||:#{==:#{pane_id},${t}},#{==:#{pane_id},${e.pane}}}`,`-F`,RQ]),QH(e,`bar-pane.tmux`,[`list-clients`,`-F`,zQ])]);return n.kind===`ok`?r.kind===`ok`?{kind:`ok`,placement:f2(n.stdout,r.stdout,t,e.pane)}:r:n}function m2(){let e=Date.now();return t=>{if(t.kind===`ok`)e=Date.now();else if(Date.now()-e>u2)throw Error(`tmux has not answered for ${u2/1e3} s: ${t.reason}`)}}function h2(e){let{positionals:t}=(()=>{try{return ae({args:[...e],allowPositionals:!0})}catch(e){throw Error(`${e.message}\n${d2}`)}})(),[n,...r]=t;if(n===void 0||r.length>0||!/^%\d+$/.test(n))throw Error(d2);return{pane:n}}async function g2(e){try{return await _2(e),0}catch(e){return t.stderr.write(`cc-candybar bar-pane: ${e.message}\n`),1}}async function _2(e){let{pane:n}=h2(e),r=zA(t.env);if(r===null)throw Error(`cc-candybar bar-pane runs in a tmux pane`);if(!t.stdout.isTTY)throw Error(`cc-candybar bar-pane draws on its pane's terminal`);let i=await p2(r,n);if(i.kind!==`ok`)throw Error(i.reason);let a=i.placement;if(a.kind===`gone`)throw Error(`no pane ${n} on this tmux server (${r.socket})`);t.stdout.write(`\x1B[?25l\x1B[?7l`),t.on(`exit`,()=>t.stdout.write(`\x1B[?25h\x1B[?7h`));for(let[e,n]of[[`SIGINT`,130],[`SIGTERM`,143],[`SIGHUP`,129]])t.once(e,()=>t.exit(n));let o=e=>{t.stderr.write(`cc-candybar bar-pane: ${e.message}\n`),t.exit(1)},s=null,c=`waiting for pane ${n}'s bar`,l=()=>s?.said.latest??c,u=``,d=m2(),f=async()=>{if(a.kind!==`shown`)return;let e=l2(l());e.rows!==t.stdout.rows&&!a.zoomed&&d(await QH(r,`bar-pane.tmux`,[`resize-pane`,`-t`,r.pane,`-y`,String(e.rows)])),e.bytes!==u&&t.stdout.write(e.bytes),u=e.bytes},p=null,m=!1,h=()=>{m=!0,p??=(async()=>{try{for(;m;)m=!1,await f()}finally{p=null}})(),p.catch(o)};t.stdout.on(`resize`,()=>{u=``,h()});let g=e=>{if(s?.sessionId===e)return;if(s?.follower.close(),e===null){s=null;return}let t={latest:null},n=e=>{t.latest=e,h()};s={sessionId:e,said:t,follower:o2(et(),e,`pane`,{frame:e=>n(GV(Jt(e)).output),off:e=>n(e.error),fault:n,exit:e=>o(Error(e))})}},_=m2();for(;a.kind!==`gone`;){if(a.kind===`hidden`)g(null);else{let e=await Xt(r.socket,n);e.kind===`ok`?(g(e.value),c=e.value===null?`waiting for pane ${n}'s statusline to render on ${et()}`:`waiting for pane ${n}'s bar`):(e.kind===`transient`&&(On(),u=``),c=Wt(e))}h(),await _e(500);let e=await p2(r,n);_(e),e.kind===`ok`&&(a=e.placement)}g(null),t.stderr.write(`cc-candybar bar-pane: pane ${n} closed\n`)}const v2=i(import.meta.url),y2=e=>e.some(e=>t.argv.includes(e));function b2(){console.log(IA)}const x2={install:async e=>{await Xa(e,v2),t.exit(0)},"install-url-handler":async()=>{Ga(v2),t.exit(0)},"url-handle":async e=>{await qa(e[0])},daemon:async()=>{n1()},"daemon-stats":async e=>{await _X(e),t.exit(0)},frames:async()=>{await c2(t.argv,v2)},check:async e=>{await p0(e)},lint:async e=>{await p0(e)},plugin:async e=>{t.exit(T0(e))},schema:async()=>{Q1()},doctor:async e=>{await t2(e)},"bar-pane":async e=>{t.exit(await g2(e))},...Object.fromEntries(EQ.map(e=>[e,async n=>{await U1(e,n),t.exit(0)}]))};async function S2(){try{let e=t.argv[2],n=e!==void 0&&!e.startsWith(`-`)?e:null;if(n!==null&&!Object.hasOwn(x2,n)&&(console.error(`cc-candybar: unknown subcommand ${JSON.stringify(n)} — see --help`),t.exit(2)),y2(SA.help)&&(b2(),t.exit(0)),y2(SA.version)&&(console.log(`cc-candybar ${Gt}`),t.exit(0)),n!==null){await x2[n](t.argv.slice(3));return}t.stdin.isTTY===!0&&(console.error(`Error: This tool requires input from Claude Code
516
+ `),t.exit(2));let n=t.cwd(),r=await n2(ZY(X0),zX(),K0,t.env,n,r2,e[0]);t.stdout.write(r.stdout),t.stderr.write(r.stderr),t.exit(r.code)}function a2(e){return!e.ok&&e.code!==`RENDER_FAILED`}function o2(e,t,n,r,i){let a=null,o=e=>{a===null&&(a=e,s.destroy(),i(e))},s=C.createConnection({path:e}),c={v:3,kind:`subscribe`,sessionId:t,lane:n};return s.once(`connect`,()=>s.write(Nt(c))),s.on(`data`,Ft(e=>{let t=e;a2(t)?o({kind:`refused`,resp:t}):r(t)},e=>o({kind:`failed`,error:e}))),s.on(`error`,e=>o({kind:`failed`,error:e})),s.on(`close`,()=>o({kind:`closed-there`})),{close:()=>o({kind:`closed-here`})}}function s2(e,t){switch(t){case`frame-ok`:return 250;case`frame-failed`:return e;case`fault`:return Math.min(2e3,e*2)}}function c2(e){switch(e.kind){case`failed`:return{kind:`reconnect`,reason:`stream failed (${e.error.message})`,kick:!0};case`closed-there`:return{kind:`reconnect`,reason:`daemon closed the stream`,kick:!1};case`refused`:return e.resp.code===`SWITCHED_OFF`?{kind:`off`,resp:e.resp}:e.resp.code===`TIMEOUT`?{kind:`reconnect`,reason:`the daemon was too busy to open the stream (${e.resp.error})`,kick:!1}:e.resp.code===`BAD_REQUEST`?{kind:`reconnect`,reason:`the daemon does not take subscribe (${e.resp.error}); it restarts on the new build`,kick:!1}:e.resp.code===`VERSION_MISMATCH`&&e.resp.daemonV!==void 0&&e.resp.daemonV<3?{kind:`reconnect`,reason:`the daemon is older than this client (${e.resp.error})`,kick:!0}:{kind:`exit`,reason:`the daemon refused the stream: ${e.resp.code}: ${e.resp.error}`}}}function l2(e,t,n,r){let i=null,a=null,o=!1,s=250,c=(e,t)=>{a=setTimeout(()=>{a=null,((t?r.beforeReconnect?.():void 0)??Promise.resolve()).then(()=>{o||l()})},e)},l=()=>{i=o2(e,t,n,e=>{s=s2(s,e.ok?`frame-ok`:`frame-failed`),r.frame(e)},e=>{if(e.kind===`closed-here`||o)return;let t=c2(e);switch(t.kind){case`exit`:r.exit(t.reason);return;case`off`:r.off(t.resp),c(5e3,!1);return;case`reconnect`:{r.fault(t.reason,s),t.kick&&On();let e=s;s=s2(s,`fault`),c(e,!0);return}}})};return l(),{close:()=>{o=!0,a!==null&&clearTimeout(a),i?.close()}}}function u2(e,t){return t.kind===`frame`||t.kind!==e.kind?!0:t.kind===`fault`&&e.kind===`fault`&&t.reason!==e.reason}async function d2(e,n){let{values:r,tokens:i}=ae({args:e.slice(3),options:{config:{type:`string`},lane:{type:`string`}},strict:!0,tokens:!0}),a=[e[1],...i.flatMap(e=>e.kind===`option`&&e.name===`config`?[e.rawName,e.value]:[])],o=t.cwd(),s=e=>{t.stderr.write(`cc-candybar frames: ${e}\n`)},c=p_(r.lane);c===null&&(s(`--lane needs one of ${o_.join(`, `)}`),t.exit(2)),t.stdout.on(`error`,()=>t.exit(0));let l=LQ(t.stdout),u=null,d=null,f=null,p={kind:`none`},m=(e,t)=>{u2(p,e)&&t(),p=e},h=async e=>{let r=await Yt(e,a,o,{...j0(t.env,o,t.stderr),client:O(`frames`,n)});r.kind!==`ok`&&(s(Wt(r)),r.kind===`transient`&&On())},g=e=>{f?.close(),f=l2(et(),e,c,{frame:e=>m({kind:`frame`},()=>l(`${JSON.stringify(e)}\n`)),off:e=>m({kind:`off`},()=>l(`${JSON.stringify(e)}\n`)),fault:(e,t)=>m({kind:`fault`,reason:e},()=>s(`${e}; reconnecting in ${t}ms`)),exit:e=>{s(e),t.exit(1)},beforeReconnect:()=>d===null?Promise.resolve():h(d)})};for await(let e of ye({input:t.stdin})){if(e.trim()===``)continue;let t;try{t=JSON.parse(e)}catch(e){s(`stdin line is not JSON: ${e.message}`);continue}if(typeof t.session_id!=`string`||t.session_id===``){s(`stdin line carries no session_id`);continue}d=t,await h(t),t.session_id!==u&&(u=t.session_id,g(u))}t.exit(0)}function f2(e){let t=e.replace(/\n+$/,``).split(`
517
+ `);return{bytes:t.map((e,t)=>`\x1b[${t+1}H${e}`).join(``)+`\x1B[J`,rows:t.length}}const p2=5e3,m2=`usage: cc-candybar bar-pane <claude-code-pane-id, e.g. %3>`;function h2(e,t,n,r){let i=e.split(`
518
+ `).map(e=>e.trim().split(` `));return i.some(([e])=>e===n)?VQ(e,BQ(t)).has(r)?{kind:`shown`,zoomed:i.some(([e,,,,t])=>e===r&&t===`1`)}:{kind:`hidden`}:{kind:`gone`}}async function g2(e,t){let[n,r]=await Promise.all([QH(e,`bar-pane.tmux`,[`list-panes`,`-a`,`-f`,`#{||:#{==:#{pane_id},${t}},#{==:#{pane_id},${e.pane}}}`,`-F`,RQ]),QH(e,`bar-pane.tmux`,[`list-clients`,`-F`,zQ])]);return n.kind===`ok`?r.kind===`ok`?{kind:`ok`,placement:h2(n.stdout,r.stdout,t,e.pane)}:r:n}function _2(){let e=Date.now();return t=>{if(t.kind===`ok`)e=Date.now();else if(Date.now()-e>p2)throw Error(`tmux has not answered for ${p2/1e3} s: ${t.reason}`)}}function v2(e){let{positionals:t}=(()=>{try{return ae({args:[...e],allowPositionals:!0})}catch(e){throw Error(`${e.message}\n${m2}`)}})(),[n,...r]=t;if(n===void 0||r.length>0||!/^%\d+$/.test(n))throw Error(m2);return{pane:n}}async function y2(e){try{return await b2(e),0}catch(e){return t.stderr.write(`cc-candybar bar-pane: ${e.message}\n`),1}}async function b2(e){let{pane:n}=v2(e),r=zA(t.env);if(r===null)throw Error(`cc-candybar bar-pane runs in a tmux pane`);if(!t.stdout.isTTY)throw Error(`cc-candybar bar-pane draws on its pane's terminal`);let i=await g2(r,n);if(i.kind!==`ok`)throw Error(i.reason);let a=i.placement;if(a.kind===`gone`)throw Error(`no pane ${n} on this tmux server (${r.socket})`);t.stdout.write(`\x1B[?25l\x1B[?7l`),t.on(`exit`,()=>t.stdout.write(`\x1B[?25h\x1B[?7h`));for(let[e,n]of[[`SIGINT`,130],[`SIGTERM`,143],[`SIGHUP`,129]])t.once(e,()=>t.exit(n));let o=e=>{t.stderr.write(`cc-candybar bar-pane: ${e.message}\n`),t.exit(1)},s=null,c=`waiting for pane ${n}'s bar`,l=()=>s?.said.latest??c,u=``,d=_2(),f=async()=>{if(a.kind!==`shown`)return;let e=f2(l());e.rows!==t.stdout.rows&&!a.zoomed&&d(await QH(r,`bar-pane.tmux`,[`resize-pane`,`-t`,r.pane,`-y`,String(e.rows)])),e.bytes!==u&&t.stdout.write(e.bytes),u=e.bytes},p=null,m=!1,h=()=>{m=!0,p??=(async()=>{try{for(;m;)m=!1,await f()}finally{p=null}})(),p.catch(o)};t.stdout.on(`resize`,()=>{u=``,h()});let g=e=>{if(s?.sessionId===e)return;if(s?.follower.close(),e===null){s=null;return}let t={latest:null},n=e=>{t.latest=e,h()};s={sessionId:e,said:t,follower:l2(et(),e,`pane`,{frame:e=>n(GV(Jt(e)).output),off:e=>n(e.error),fault:n,exit:e=>o(Error(e))})}},_=_2();for(;a.kind!==`gone`;){if(a.kind===`hidden`)g(null);else{let e=await Xt(r.socket,n);e.kind===`ok`?(g(e.value),c=e.value===null?`waiting for pane ${n}'s statusline to render on ${et()}`:`waiting for pane ${n}'s bar`):(e.kind===`transient`&&(On(),u=``),c=Wt(e))}h(),await _e(500);let e=await g2(r,n);_(e),e.kind===`ok`&&(a=e.placement)}g(null),t.stderr.write(`cc-candybar bar-pane: pane ${n} closed\n`)}const x2=i(import.meta.url),S2=e=>e.some(e=>t.argv.includes(e));function C2(){console.log(IA)}const w2={install:async e=>{await Xa(e,x2),t.exit(0)},"install-url-handler":async()=>{Ga(x2),t.exit(0)},"url-handle":async e=>{await qa(e[0])},daemon:async()=>{a1()},"daemon-stats":async e=>{await _X(e),t.exit(0)},frames:async()=>{await d2(t.argv,x2)},check:async e=>{await g0(e)},lint:async e=>{await g0(e)},plugin:async e=>{t.exit(O0(e))},schema:async()=>{t0()},doctor:async e=>{await i2(e)},"bar-pane":async e=>{t.exit(await y2(e))},...Object.fromEntries(EQ.map(e=>[e,async n=>{await K1(e,n),t.exit(0)}]))};async function T2(){try{let e=t.argv[2],n=e!==void 0&&!e.startsWith(`-`)?e:null;if(n!==null&&!Object.hasOwn(w2,n)&&(console.error(`cc-candybar: unknown subcommand ${JSON.stringify(n)} — see --help`),t.exit(2)),S2(SA.help)&&(C2(),t.exit(0)),S2(SA.version)&&(console.log(`cc-candybar ${Gt}`),t.exit(0)),n!==null){await w2[n](t.argv.slice(3));return}t.stdin.isTTY===!0&&(console.error(`Error: This tool requires input from Claude Code
519
519
 
520
520
  cc-candybar is designed to be used as a Claude Code statusLine command.
521
521
  It reads hook data from stdin and outputs formatted statusline.
@@ -531,4 +531,4 @@ Add to ~/.claude/settings.json:
531
531
  Run with --help for more options.
532
532
 
533
533
  To test output manually:
534
- echo '{"session_id":"test-session","workspace":{"project_dir":"/path/to/project"},"model":{"id":"claude-sonnet-4-5","display_name":"Claude"}}' | cc-candybar`),t.exit(1)),E(`Working directory: ${t.cwd()}`),E(`Process args:`,t.argv);let r=await o(t.stdin);E(`Received hook data:`,JSON.stringify(r,null,2)),r||(console.error(`Error: No input data received from stdin`),b2(),t.exit(1));let i=GV(await Yt(r,t.argv.slice(1),t.cwd(),{...O0(t.env,t.cwd(),t.stderr),client:O(`node`,v2)}));i.debug!==null&&E(i.debug),i.kick&&On(),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)}}S2();export{};
534
+ echo '{"session_id":"test-session","workspace":{"project_dir":"/path/to/project"},"model":{"id":"claude-sonnet-4-5","display_name":"Claude"}}' | cc-candybar`),t.exit(1)),E(`Working directory: ${t.cwd()}`),E(`Process args:`,t.argv);let r=await o(t.stdin);E(`Received hook data:`,JSON.stringify(r,null,2)),r||(console.error(`Error: No input data received from stdin`),C2(),t.exit(1));let i=GV(await Yt(r,t.argv.slice(1),t.cwd(),{...j0(t.env,t.cwd(),t.stderr),client:O(`node`,x2)}));i.debug!==null&&E(i.debug),i.kick&&On(),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)}}T2();export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@promptctl/cc-candybar",
3
- "version": "1.152.0",
3
+ "version": "1.152.1",
4
4
  "description": "Statusline renderer for Claude Code — a JSON5-configurable DSL with daemon-cached data sources, byte-clean palette-aware composition, and OSC8 click verbs.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",
@@ -104,9 +104,9 @@
104
104
  "typescript": "^5.0.0"
105
105
  },
106
106
  "optionalDependencies": {
107
- "@promptctl/cc-candybar-darwin-arm64": "1.152.0",
108
- "@promptctl/cc-candybar-darwin-x64": "1.152.0",
109
- "@promptctl/cc-candybar-linux-arm64": "1.152.0",
110
- "@promptctl/cc-candybar-linux-x64": "1.152.0"
107
+ "@promptctl/cc-candybar-darwin-arm64": "1.152.1",
108
+ "@promptctl/cc-candybar-darwin-x64": "1.152.1",
109
+ "@promptctl/cc-candybar-linux-arm64": "1.152.1",
110
+ "@promptctl/cc-candybar-linux-x64": "1.152.1"
111
111
  }
112
112
  }