@kubitnodes/stellaris 0.3.14 → 0.3.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/package.json +1 -1
- package/web/dist/assets/{BackLink-giAdtos8.js → BackLink-hLg9AYSp.js} +1 -1
- package/web/dist/assets/{ChannelView-DXoJ5w3z.js → ChannelView-CHvr0c9I.js} +1 -1
- package/web/dist/assets/CitizenView-DlqilbFH.js +2 -0
- package/web/dist/assets/{CitizensView-Dbo47F82.js → CitizensView-Dq3V4mpg.js} +1 -1
- package/web/dist/assets/CronsView-CBiPaq-C.js +1 -0
- package/web/dist/assets/{KnowledgeView-BXLj85OH.js → KnowledgeView-ndWDlRoP.js} +1 -1
- package/web/dist/assets/{Markdown-Dw04_ImA.js → Markdown-BMm7unnl.js} +1 -1
- package/web/dist/assets/{MessageItem-DnfMDxDB.js → MessageItem-Dk1m5NaR.js} +1 -1
- package/web/dist/assets/{MetricsView-_h2TWeo8.js → MetricsView-B31t_Q2z.js} +1 -1
- package/web/dist/assets/{NeedsYouView-BI1-_bYI.js → NeedsYouView-d8_ydJI9.js} +1 -1
- package/web/dist/assets/{Overview-BdZiHglw.js → Overview-D-6YP-tf.js} +1 -1
- package/web/dist/assets/Picker-DB-wxloY.js +1 -0
- package/web/dist/assets/{ProjectView-CScK4F7F.js → ProjectView-CH-nqrAo.js} +1 -1
- package/web/dist/assets/{ProposalView-BQ1rflqo.js → ProposalView-D-E0Hzdr.js} +1 -1
- package/web/dist/assets/{ProposalsView-DSi2u6qO.js → ProposalsView-Bmuq8Qnh.js} +1 -1
- package/web/dist/assets/{RunnersView-9E2qUSO5.js → RunnersView-N4iUU4FM.js} +1 -1
- package/web/dist/assets/{SocietyView-DEeUo4wb.js → SocietyView-fSkmFC3z.js} +1 -1
- package/web/dist/assets/{SubjectThread-DhGB5RPc.js → SubjectThread-akZdGCfo.js} +1 -1
- package/web/dist/assets/{TaskFileView-DQC_ZUdY.js → TaskFileView-DM_JjQQx.js} +1 -1
- package/web/dist/assets/{TaskView-yVpUG83f.js → TaskView-JLLJKQ0_.js} +1 -1
- package/web/dist/assets/{TasksView-CJbJt5dM.js → TasksView-CncU8UNJ.js} +1 -1
- package/web/dist/assets/{ThreadCard-DVAx3gGc.js → ThreadCard-8OB70j9B.js} +1 -1
- package/web/dist/assets/{ThreadView-CMwiVZFq.js → ThreadView-DrwqggME.js} +1 -1
- package/web/dist/assets/citizen-BRSvyK2X.js +1 -0
- package/web/dist/assets/index-Dw96wkep.css +2 -0
- package/web/dist/assets/{index-7uInG5D9.js → index-ww_EHgVF.js} +2 -2
- package/web/dist/index.html +2 -2
- package/web/dist/assets/CitizenView-yOnQtNz4.js +0 -2
- package/web/dist/assets/CronsView-DYx7dQcr.js +0 -1
- package/web/dist/assets/citizen-aLkZ4owL.js +0 -1
- package/web/dist/assets/index-D02Wgo_C.css +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChannelView-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChannelView-CHvr0c9I.js","assets/format-BORdp4w-.js","assets/compose-D7DOz6kC.js","assets/mentions-BCdV0bMK.js","assets/ThreadForms-RnrV7V5X.js","assets/ChannelForms-b6eKogvP.js","assets/link-1v5lugnf.js","assets/MessageItem-Dk1m5NaR.js","assets/tasks-C-9dAYQV.js","assets/Markdown-BMm7unnl.js","assets/Pane-CODhA5zE.js","assets/ThreadCard-8OB70j9B.js","assets/useStickyScroll-CE7dyz0Q.js","assets/ThreadView-DrwqggME.js","assets/BackLink-hLg9AYSp.js","assets/SocietyView-fSkmFC3z.js","assets/Overview-D-6YP-tf.js","assets/CliIcon-DxDvRRcX.js","assets/citizen-BRSvyK2X.js","assets/ProjectView-CH-nqrAo.js","assets/KnowledgeView-ndWDlRoP.js","assets/TasksView-CncU8UNJ.js","assets/TaskView-JLLJKQ0_.js","assets/governance-WrDQawLN.js","assets/SubjectThread-akZdGCfo.js","assets/TaskFileView-DM_JjQQx.js","assets/MetricsView-B31t_Q2z.js","assets/CitizensView-Dq3V4mpg.js","assets/NeedsYouView-d8_ydJI9.js","assets/RunnersView-N4iUU4FM.js","assets/CronsView-CBiPaq-C.js","assets/Picker-DB-wxloY.js","assets/ProposalsView-Bmuq8Qnh.js","assets/ProposalView-D-E0Hzdr.js","assets/CitizenView-DlqilbFH.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{$t as e,A as t,B as n,Bt as r,C as i,Cn as a,Ct as o,D as s,Ft as c,G as l,Gt as u,H as d,Ht as f,I as p,It as m,J as h,Jt as g,K as _,Kt as v,L as y,Lt as b,M as x,N as S,Nt as C,Pt as w,Q as T,Qt as E,Rt as ee,Sn as te,T as ne,Tn as re,U as ie,Ut as ae,V as oe,Vt as se,W as ce,Wt as le,X as ue,Xt as de,Yt as fe,Z as pe,Zt as me,_ as he,an as ge,b as _e,bn as ve,bt as ye,c as be,cn as xe,d as D,dn as O,et as Se,fn as Ce,ft as we,g as Te,hn as k,i as A,in as Ee,k as De,l as Oe,ln as ke,mn as Ae,n as je,on as Me,pn as Ne,pt as Pe,q as Fe,qt as Ie,r as Le,rt as Re,s as ze,sn as Be,t as Ve,tn as He,tt as Ue,un as We,ut as Ge,vn as Ke,vt as qe,w as Je,wt as Ye,x as Xe,xn as Ze,xt as Qe,yn as $e,yt as et,zt as tt}from"./format-BORdp4w-.js";import{a as nt,c as rt,i as it,l as at,n as ot,o as st,r as ct,s as lt,t as ut,u as dt}from"./compose-D7DOz6kC.js";import{i as ft,n as pt,r as mt,t as ht}from"./useMatch-CyeFfbcR.js";import{a as gt,c as _t,i as vt,l as yt,n as bt,o as xt,r as St,s as Ct,t as wt}from"./link-1v5lugnf.js";import{n as Tt,r as Et,t as Dt}from"./CliIcon-DxDvRRcX.js";import{a as Ot,n as kt,r as At,s as jt,t as Mt}from"./tasks-C-9dAYQV.js";import{a as Nt,d as Pt}from"./governance-WrDQawLN.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Ft=class extends Be{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new dt({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=It(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=It(e);if(typeof t==`string`){let n=this.#t.get(t);if(n){if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=It(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=It(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){ge.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>O(t,e))}findAll(e={}){return this.getAll().filter(t=>O(e,t))}notify(e){ge.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return ge.batch(()=>Promise.all(e.map(e=>e.continue().catch(Ne))))}};function It(e){return e.options.scope?.id}var Lt=class extends Be{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??We(r,t),a=this.get(i);return a||(a=new He({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){ge.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ce(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ce(e,t)):t}notify(e){ge.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){ge.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){ge.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Rt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Lt,this.#t=e.mutationCache||new Ft,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=Me.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Ee.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(k(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=xe(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return ge.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;ge.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return ge.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=ge.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(Ne).catch(Ne)}invalidateQueries(e,t={}){return ge.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=ge.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(Ne)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(Ne)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(k(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(k(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Ne).catch(Ne)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Ne).catch(Ne)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Ee.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(ke(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Ae(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ke(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Ae(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=We(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Ke&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},zt=a((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,te());else{var t=n(l);t!==null&&ie(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function ee(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ie(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?te():S=!1}}}var te;if(typeof y==`function`)te=function(){y(ee)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=ee,te=function(){re.postMessage(null)}}else te=function(){_(ee,0)};function ie(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,ie(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,te()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Bt=a(((e,t)=>{t.exports=zt()})),Vt=a((e=>{var t=te();function n(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`),o=Symbol.for(`react.recoverable`),s=Symbol.for(`react.optimistic_key`);function c(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:r===s?s:``+r,children:e,containerInfo:t,implementation:n}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.browser=function(e){return{$$typeof:o,_reason:e}},e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return c(e,t,null,r)},e.flushSync=function(e){var t=l.T,n=i.p;try{if(l.T=null,i.p=2,e)return e()}finally{l.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=u(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}}else t??i.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=u(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=u(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0})}else i.d.m(e)}},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return l.H.useFormState(e,t,n)},e.useFormStatus=function(){return l.H.useHostTransitionStatus()},e.version=`19.3.0`})),Ht=a(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Vt()})),Ut=a((e=>{var t=Bt(),n=te(),r=Ht();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function m(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function h(e){var t=[null,null],n=p(e);return n===null||g(t,e,n.child,{foundSelf:!1}),t}function g(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&g(e,t,n.child,r))return!0;n=n.sibling}return!1}function _(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var v=null,y=null;function b(e,t,n){return e===n||e===t&&(v=e,!0)}function x(e,t,n){return e===n?(y=e,!1):e===t&&(y!==null&&(v=e),!0)}function S(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function C(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var w=Object.assign,T=Symbol.for(`react.element`),E=Symbol.for(`react.transitional.element`),ee=Symbol.for(`react.portal`),ne=Symbol.for(`react.fragment`),re=Symbol.for(`react.strict_mode`),ie=Symbol.for(`react.profiler`),ae=Symbol.for(`react.consumer`),oe=Symbol.for(`react.context`),se=Symbol.for(`react.forward_ref`),ce=Symbol.for(`react.suspense`),le=Symbol.for(`react.suspense_list`),ue=Symbol.for(`react.memo`),de=Symbol.for(`react.lazy`),fe=Symbol.for(`react.activity`),pe=Symbol.for(`react.legacy_hidden`),me=Symbol.for(`react.memo_cache_sentinel`),he=Symbol.for(`react.view_transition`),ge=Symbol.for(`react.recoverable`),_e=Symbol.iterator;function ve(e){return typeof e!=`object`||!e?null:(e=_e&&e[_e]||e[`@@iterator`],typeof e==`function`?e:null)}var ye=Symbol.for(`react.client.reference`);function be(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ye?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case ne:return`Fragment`;case ie:return`Profiler`;case re:return`StrictMode`;case ce:return`Suspense`;case le:return`SuspenseList`;case fe:return`Activity`;case he:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case ee:return`Portal`;case oe:return e.displayName||`Context`;case ae:return(e._context.displayName||`Context`)+`.Consumer`;case se:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ue:return t=e.displayName||null,t===null?be(e.type)||`Memo`:t;case de:t=e._payload,e=e._init;try{return be(e(t))}catch{}}return null}var xe=Array.isArray,D=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Se={pending:!1,data:null,method:null,action:null},Ce=[],we=-1;function Te(e){return{current:e}}function k(e){0>we||(e.current=Ce[we],Ce[we]=null,we--)}function A(e,t){we++,Ce[we]=e.current,e.current=t}var Ee=Te(null),De=Te(null),Oe=Te(null),ke=Te(null);function Ae(e,t){switch(A(Oe,t),A(De,e),A(Ee,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?up(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=up(t),e=dp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}k(Ee),A(Ee,e)}function je(){k(Ee),k(De),k(Oe)}function Me(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,A(ke,e)),t=Ee.current;var n=dp(t,e.type);t!==n&&(A(De,e),A(Ee,n))}function Ne(e){De.current===e&&(k(Ee),k(De)),ke.current===e&&(k(ke),sh._currentValue=Se)}var Pe,Fe;function Ie(e){if(Pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Pe=t&&t[1]||``,Fe=-1<e.stack.indexOf(`
|
|
3
3
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
4
|
`+Pe+e+Fe}var Le=!1;function Re(e,t){if(!e||Le)return``;Le=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
@@ -20,4 +20,4 @@ Error generating stack: `+e.message+`
|
|
|
20
20
|
`)){let n=$a(o.slice(0,t));o=o.slice(t+2),n!==``&&e.onData(n)}e.onBatch?.()}}catch{if(n.aborted)return}i=!0,await Qa(r,n),r=Math.min(r*2,15e3)}})(),()=>t.abort()}function to(e,t,n={}){return T(e,t,ue(n))}function no(e){let t=ue(e);return t===void 0?e.scope:`${e.scope}/${t}`}function ro(e,t){return[...e.values()].filter(e=>e.agent===t).toSorted((e,t)=>t.lastAt.localeCompare(e.lastAt))}var io=400,ao=400,oo=4e3,so=/^\[([^\]]*)\] (.*?) from @([a-z0-9][a-z0-9-]*)(?:, who .*?)? \(message [0-9A-Z]+\)$/;function co(e){let t=e.split(/^### /m).slice(1).flatMap(e=>{let[t=``,...n]=e.split(`
|
|
21
21
|
`),r=so.exec(t.trim());return r===null?[]:[{at:r[1]??``,where:r[2]??``,author:r[3]??``,body:n.join(`
|
|
22
22
|
`).trim()}]});return{posts:t,from:[...new Set(t.map(e=>e.author))]}}function lo(e){let t=/^mcp__(.+?)__(.+)$/.exec(e);return t===null?e:t[1]===`board`?t[2]??e:`${t[1]}:${t[2]}`}function uo(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function fo(e){return e.replaceAll(/\s+/g,` `).trim()}function po(e){return e.split(`
|
|
23
|
-
`).map(e=>e.trim()).find(e=>e.length>0)??``}function mo(e){return/^\/bin\/(?:ba)?sh -lc (["'])([\s\S]*)\1$/.exec(e.trim())?.[2]??e}function ho(e){return typeof e==`object`&&e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):{}}var go=[`file_path`,`path`,`url`,`query`,`pattern`,`description`,`prompt`];function _o(e){let t=ho(e),n=t.command;if(typeof n==`string`){let e=mo(n);return{summary:uo(fo(e),ao),detail:uo(e,oo)}}let r=uo(JSON.stringify(e??null,null,2),oo),i=t.changes;if(Array.isArray(i))return{summary:uo(i.map(e=>ho(e).path).filter(e=>typeof e==`string`).join(`, `),ao),detail:r};let a=go.map(e=>t[e]).find(e=>typeof e==`string`&&e.trim()!==``),o=Object.values(t).filter(e=>typeof e==`string`||typeof e==`number`);return{summary:uo(fo(a??o.slice(0,3).join(` · `)),ao),detail:r}}var vo=`StructuredOutput`;function yo(e,t){try{return ho(JSON.parse(e)).summary===t}catch{return!1}}function bo(e,t,n){let r=[...e.steps,t],i=r.length-n;return{...e,steps:i>0?r.slice(i):r,fromStart:e.fromStart&&i<=0,lastAt:t.at}}function xo(e,t,{maxSteps:n}={maxSteps:io}){let{event:r}=t,i=to(t.agent,t.project,t),a=e.get(i),o=new Map(e),s={agent:t.agent,scope:t.project,...t.thread===void 0?{}:{thread:t.thread},...t.channel===void 0?{}:{channel:t.channel}};if(r.type===`turn_started`)return o.set(i,{...s,startedAt:t.ts,fromStart:!0,model:r.model??null,steps:[],lastAt:t.ts,end:null}),o;let c=a!==void 0&&a.end===null?a:{...s,startedAt:t.ts,fromStart:!1,model:null,steps:[],lastAt:t.ts,end:null};switch(r.type){case`text`:o.set(i,bo(c,{kind:`say`,seq:t.seq,at:t.ts,text:r.delta},n));break;case`tool_call`:if(r.name===vo)break;o.set(i,bo(c,{kind:`tool`,seq:t.seq,at:t.ts,name:r.name,..._o(r.input),ok:null,output:null},n));break;case`tool_result`:{let e=c.steps.findIndex(e=>e.kind===`tool`&&e.name===r.name&&e.ok===null),n=c.steps[e];if(n?.kind===`tool`){let a=c.steps.with(e,{...n,ok:r.ok,output:r.output??null});o.set(i,{...c,steps:a,lastAt:t.ts})}break}case`error`:o.set(i,bo(c,{kind:`error`,seq:t.seq,at:t.ts,message:r.message},n));break;case`steered`:o.set(i,bo(c,{kind:`steer`,seq:t.seq,at:t.ts,...co(r.text??``)},n));break;case`turn_completed`:{let e=r.status?.summary??null,n=c.steps.at(-1),a=n?.kind===`say`&&e!==null&&yo(n.text,e);o.set(i,{...c,steps:a?c.steps.slice(0,-1):c.steps,lastAt:t.ts,end:{at:t.ts,exitReason:r.exitReason,summary:e}});break}}return o}function So(e,t,n,r={}){let i=new Map;for(let[a,o]of e.entries())i=xo(i,{seq:a+1,ts:o.ts,agent:t,project:n,...r.thread===void 0?{}:{thread:r.thread},...r.channel===void 0?{}:{channel:r.channel},event:o.event},{maxSteps:1/0});return i.get(to(t,n,r))}function Co(e,t){if(lo(e)!==`post_message`)return null;let n=ho(t).body,r=typeof n==`string`?po(n).replace(/^[#>*\-\s]+/,``):``;return r===``?null:uo(r,ao)}function wo(e){let t=e.steps.at(-1);return t===void 0?null:t.kind===`tool`?`${lo(t.name)} · ${t.summary}`:t.kind===`steer`?`took ${To(t.posts.length)}${t.from.length===0?``:` from ${t.from.join(`, `)}`}`:uo(po(t.kind===`say`?t.text:t.message),ao)}function To(e){return e===1?`1 post`:`${e} posts`}function Eo(e,t){return Le(t-Date.parse(e))}var Do=class{turns=new Map;listeners=new Set;eventListeners=new Set;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});snapshot=()=>this.turns;listen=e=>(this.eventListeners.add(e),()=>{this.eventListeners.delete(e)});follow(e){return eo({token:e,url:()=>`/api/turns/stream?since=0`,onOpen:()=>{this.turns=new Map,this.emit()},onData:e=>{let t=Ue.safeParse(JSON.parse(e));if(t.success){this.turns=xo(this.turns,t.data);for(let e of this.eventListeners)e(t.data)}},onBatch:()=>this.emit()})}emit(){for(let e of this.listeners)e()}},Oo=(0,j.createContext)(null);function ko(){let e=(0,j.useContext)(Oo);if(e===null)throw Error(`useLiveTurns needs a LiveContext`);return(0,j.useSyncExternalStore)(e.subscribe,e.snapshot)}function Ao({activeCitizen:e,activeScope:t}){let n=s(),r=he(),i=ko(),a=Ja(),o=_e(5e3),c=ce(n.data?.running??[]),l=n.data?.pending.length??0;return(0,P.jsxs)(`section`,{"aria-label":`Working now`,className:`mt-3`,children:[(0,P.jsxs)(`h3`,{className:`flex items-center justify-between px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[(0,P.jsx)(`span`,{children:`Working now`}),l>0?(0,P.jsxs)(`span`,{className:`font-normal tracking-normal normal-case`,children:[l,` queued`]}):null]}),c.length===0?(0,P.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`Nobody is in a turn.`}):(0,P.jsx)(`ul`,{children:c.map(({agent:n,scope:s,thread:c,channel:l})=>{let u=i.get(to(n,s,{thread:c,channel:l})),d=u!==void 0&&u.end===null,f=r.data?.find(e=>e.name===n)?.cli??null,p=d?wo(u):null,m=no({scope:s,thread:c,channel:l}),h=n===e&&(t===null||t===m||t===s),g=s===`society`?`society`:s,_=c===void 0?l===void 0?null:`#${l}`:a.get(c)?.title??`a thread`;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/citizen/$name`,params:{name:n},search:{scope:m},className:`block rounded-lg px-2 py-1.5 transition-colors ${h?`bg-surface-2/80 text-fg-primary`:`text-fg-secondary hover:bg-surface-2/50 hover:text-fg-primary`}`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,P.jsxs)(`span`,{className:`relative grid size-4 shrink-0 place-items-center`,children:[f===null?null:(0,P.jsx)(Dt,{cli:f,size:13}),(0,P.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 size-1.5 animate-pulse rounded-full bg-emerald-400`})]}),(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:_===null?g:`${g} · ${_}`}),d?(0,P.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,children:[u.fromStart?``:`≥ `,Eo(u.startedAt,o)]}):null]}),(0,P.jsx)(`span`,{className:`mt-0.5 block truncate pl-5.5 text-[11px] text-fg-muted`,children:p===null?`Starting…`:(0,P.jsx)(Za,{text:p,links:!1})})]})},m===s?`${n}/${s}`:`${n}/${m}`)})})]})}var jo=`flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors`;function Mo(e){return`block truncate rounded-md px-2 text-[11px] font-semibold tracking-wider uppercase transition-colors ${e?`text-fg-primary`:`text-fg-muted hover:text-fg-primary`}`}var No=`bg-surface-2/80 text-fg-primary`,Po=`text-fg-secondary hover:bg-surface-2/50 hover:text-fg-primary`;function Fo({slug:e,active:t}){let n=(p(e).data??[]).filter(Ot).length;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/p/$slug/tasks`,params:{slug:e},className:`${jo} ${t?No:Po}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`tasks`}),n>0?(0,P.jsx)(`span`,{title:`${n} tasks in play`,className:`rounded-md bg-surface-2/70 px-1.5 text-[11px] text-fg-tertiary`,children:n}):null]})})}function Io({value:e,title:t}){return e===0?null:(0,P.jsx)(`span`,{title:t,className:`rounded-md bg-amber-500/15 px-1.5 text-[11px] text-amber-300`,children:e})}function Lo({active:e}){let t=(i().data??[]).filter(Pt).length,n=L().length;return(0,P.jsxs)(`section`,{"aria-label":`Governance`,className:`mt-3`,children:[(0,P.jsx)(`h3`,{className:`px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:`Governance`}),(0,P.jsxs)(`ul`,{children:[(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/needs-you`,className:`${jo} ${e===`needs-you`?No:Po}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◉`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`needs you`}),(0,P.jsx)(Io,{value:n,title:`${n} waiting on you`})]})}),(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/proposals`,className:`${jo} ${e===`proposals`?No:Po}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◈`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`proposals`}),(0,P.jsx)(Io,{value:t,title:`${t} waiting on you`})]})})]})]})}function Ro({activeChannel:e,activeTasks:t,activeCitizen:n,activeScope:r,activeGovernance:i,activeOverview:a}){let o=be(),s=Xe(),c=y(),l=ja();(0,j.useEffect)(()=>{o.data!==void 0&&Ma(o.data.map(e=>[e.ref,e.lastMessageId]))},[o.data]);let u=(0,j.useMemo)(()=>(s.data??[]).toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt)||e.slug.localeCompare(t.slug)),[s.data]),d=u.filter(e=>e.archived!==void 0),f=(0,j.useMemo)(()=>{let e=(o.data??[]).filter(e=>e.archived===void 0);return[{key:`society`,label:`Society`,project:null,channels:e.filter(e=>e.project===null)},...u.filter(e=>e.archived===void 0).map(t=>({key:t.slug,label:t.name,project:t.slug,channels:e.filter(e=>e.project===t.slug)}))]},[o.data,u]),p=(0,j.useMemo)(()=>{let e=new Map;for(let t of c.data??[])t.state===`open`&&e.set(t.channel,(e.get(t.channel)??0)+1);return e},[c.data]);return(0,P.jsxs)(Ca,{label:`Board navigator`,className:`top-[72px] bottom-4 left-4 w-64`,children:[(0,P.jsxs)(`header`,{className:`flex items-center justify-between px-4 pt-4 pb-1`,children:[(0,P.jsx)(`span`,{className:`text-caps`,children:`Board`}),(0,P.jsx)(wt,{to:`/`,"aria-label":`Close the board`,className:`grid size-7 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`✕`})]}),(0,P.jsxs)(`nav`,{className:`flex-1 overflow-y-auto px-2 pb-3`,children:[(0,P.jsx)(Ao,{activeCitizen:n,activeScope:r}),(0,P.jsx)(Lo,{active:i}),f.map(n=>(0,P.jsxs)(`section`,{className:`mt-3`,children:[(0,P.jsx)(`h3`,{className:`pb-1`,children:n.project===null?(0,P.jsx)(wt,{to:`/society`,className:Mo(a===n.key),children:n.label}):(0,P.jsx)(wt,{to:`/p/$slug`,params:{slug:n.project},className:Mo(a===n.key),children:n.label})}),(0,P.jsxs)(`ul`,{children:[n.channels.map(t=>{let n=t.ref===e,r=p.get(t.ref)??0,i=!n&&Pa(l,t.ref,t.lastMessageId);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/c/$`,params:{_splat:t.ref},className:`${jo} ${n?No:Po}`,children:[(0,P.jsx)(`span`,{className:`text-fg-muted`,children:`#`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate ${i?`font-semibold`:``}`,children:t.name}),r>0?(0,P.jsx)(`span`,{title:`${r} open threads`,className:`rounded-md bg-surface-2/70 px-1.5 text-[11px] text-fg-tertiary`,children:r}):null,i?(0,P.jsx)(`span`,{"aria-label":`new messages`,className:`size-1.5 rounded-full bg-emerald-400`}):null]})},t.ref)}),n.project===null?null:(0,P.jsx)(Fo,{slug:n.project,active:n.project===t})]})]},n.key)),d.length===0?null:(0,P.jsxs)(`section`,{"aria-label":`Archived projects`,className:`mt-3`,children:[(0,P.jsx)(`h3`,{className:`px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:`Archived`}),(0,P.jsx)(`ul`,{children:d.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/p/$slug`,params:{slug:e.slug},className:`${jo} ${a===e.slug?No:Po}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`▫`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]})},e.slug))})]})]})]})}var zo=(0,j.createContext)(void 0);function Bo(e,t){let n=new URL(e);return n.searchParams.set(n.hostname===`github.com`?`size`:`s`,String(t)),n.href}function Vo({name:e,members:t}){let n=(0,j.useContext)(zo),r=t?.find(t=>t.name===e)?.cli??null;return r===null?e===`user`&&n!==void 0?(0,P.jsx)(`img`,{src:Bo(n.avatarUrl,56),alt:``,width:28,height:28,referrerPolicy:`no-referrer`,className:`size-7 shrink-0 rounded-lg bg-surface-2/80 object-cover`}):e===`user`?(0,P.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-fg-primary/90 text-[10px] font-semibold text-surface-0`,children:`you`}):(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface-2/50 text-xs text-fg-muted`,children:`✦`}):(0,P.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface-2/80`,children:(0,P.jsx)(Dt,{cli:r,size:16})})}function Ho({name:e,members:t}){let n=t?.find(t=>t.name===e)?.cli??null;return(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 align-middle`,children:[n===null?null:(0,P.jsx)(Dt,{cli:n,size:12}),(0,P.jsx)(`span`,{className:`text-fg-secondary`,children:e})]})}function Uo(e,t){return e===`user`?t?.login??`you`:e}function Wo(){let e=(0,j.useContext)(zo);return t=>Uo(t,e)}var Go=6;function R({target:e,placeholder:t,initialText:r=``,oneLine:i=!1,className:a=`border-t border-line p-3`,focusOnOpen:o=!1,onPosted:c,onEmptyEscape:l}){let{api:u}=De(),d=ve(),f=he(),p=ne(),m=s(),[h,g]=(0,j.useState)(r),[_,v]=(0,j.useState)(0),[y,b]=(0,j.useState)(0),[x,S]=(0,j.useState)(!1),C=(0,j.useRef)(null),w=(0,j.useRef)(null),T=at({mutationFn:async t=>{if(`channel`in e)return u.sendMessage({channel:e.channel,body:t});if(`threadId`in e)return u.sendMessage({thread_id:e.threadId,body:t});let n=await u.openThread({channel:Re,title:ha(t)});return u.sendMessage({thread_id:n.id,body:t})},onSuccess:t=>{g(r),d.invalidateQueries({queryKey:t.thread===void 0?[`channel`,t.channel]:[`thread`,t.thread]}),`ask`in e&&d.invalidateQueries({queryKey:[`threads`]}),d.invalidateQueries({queryKey:[`requests`]}),c?.(t)}});(0,j.useEffect)(()=>{o&&C.current?.focus()},[o]),(0,j.useLayoutEffect)(()=>{let e=C.current;e!==null&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,w.current!==null&&(e.setSelectionRange(w.current,w.current),w.current=null))});let E=x?null:ct(h,_),ee=(f.data??[]).filter(e=>e.status===`active`&&e.cli!==null),te=E===null?[]:ee.filter(e=>e.name.startsWith(E.prefix)).slice(0,Go),re=st(h,f.data??[],p.data??[]),ie=`ask`in e?[]:it(re,f.data??[],m.data?.turns??[],`channel`in e?{channel:e.channel}:{thread:e.threadId}),ae=nt(ie,re.filter(e=>!ie.includes(e))),oe=e=>{if(E===null)return;let t=ut(h,_,E.start,e);w.current=t.caret,g(t.text),v(t.caret)},se=()=>{h.trim()!==``&&h.trim()!==r.trim()&&!T.isPending&&T.mutate(h.trim())},ce=e=>{if(te.length>0){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:te.length-1;b((y+t)%te.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),oe(te[Math.min(y,te.length-1)]?.name??``);return}if(e.key===`Escape`){e.preventDefault(),S(!0);return}}if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){e.preventDefault(),se();return}e.key===`Escape`&&h===``&&l!==void 0&&(e.preventDefault(),l())},le=(0,P.jsx)(lt,{variant:`primary`,type:`submit`,disabled:h.trim()===``||h.trim()===r.trim()||T.isPending,children:T.isPending?`Sending…`:`Send`});return(0,P.jsxs)(`form`,{className:a,onSubmit:e=>{e.preventDefault(),se()},children:[(0,P.jsxs)(`div`,{className:`relative rounded-xl bg-surface-2/50 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] focus-within:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.16)] ${i?`flex items-end gap-2 pr-1.5`:``}`,children:[te.length>0?(0,P.jsx)(`ul`,{"aria-label":`Citizens to mention`,className:`card absolute bottom-full left-2 mb-2 w-60 overflow-hidden py-1`,children:te.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),oe(e.name)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${t===y?`bg-surface-2 text-fg-primary`:`text-fg-secondary`}`,children:[e.cli===null?null:(0,P.jsx)(Dt,{cli:e.cli,size:14}),(0,P.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),(0,P.jsx)(`span`,{className:`truncate font-mono text-[11px] text-fg-muted`,children:e.role})]})},e.name))}):null,(0,P.jsx)(`textarea`,{ref:C,rows:1,value:h,placeholder:t,"aria-label":t,onChange:e=>{g(e.target.value),v(e.target.selectionStart),b(0),S(!1)},onSelect:e=>v(e.currentTarget.selectionStart),onKeyDown:ce,className:`block max-h-48 w-full resize-none bg-transparent px-3 text-sm text-fg-primary outline-none placeholder:text-fg-muted ${i?`py-2.5`:`pt-2.5 pb-1`}`}),i?(0,P.jsx)(`div`,{className:`shrink-0 pb-1.5`,children:le}):(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-2`,children:[(0,P.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:ae??`Enter to send · Shift+Enter for a new line`}),le]})]}),T.error===null?null:(0,P.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-red-400`,children:T.error instanceof n?T.error.message:`The message was not sent.`})]})}var z=5;function Ko(e,t,n){switch(e.kind){case`answering`:return{text:`${ot(e.who)} ${e.who.length===1?`is`:`are`} answering…`,tone:`text-emerald-300`};case`queued`:return{text:`${ot(e.who)} will answer next`,tone:`text-amber-300`};case`waiting`:return{text:`waiting for an answer`,tone:`text-fg-muted`};case`answered`:return{text:`answered by ${n(e.by)}`,tone:`text-fg-secondary`}}let r=je(t.body,160);return{text:`closed by ${n(e.by??`board`)}${r===``?``:` · ${r}`}`,tone:`text-fg-muted`}}function qo({left:e,width:t,onClose:n}){let r=y(),i=s(),a=ja(),o=_e(3e4),c=Wo(),l=(0,j.useRef)(null),u=ma(r.data??[]).slice(0,z),d=ce(i.data?.running??[]),f=ce(i.data?.pending??[]);return(0,j.useEffect)(()=>{let e=e=>{e.target instanceof Node&&l.current?.contains(e.target)===!1&&n()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[n]),(0,P.jsxs)(`section`,{ref:l,"aria-label":`Ask`,className:`absolute top-[26%] z-30 flex flex-col gap-2`,style:{left:e,width:t},children:[(0,P.jsx)(`div`,{className:Sa,children:(0,P.jsx)(R,{target:{ask:!0},placeholder:`Ask the front desk`,oneLine:!0,className:`p-2`,focusOnOpen:!0,onEmptyEscape:n})}),u.length===0?null:(0,P.jsx)(`ol`,{"aria-label":`Your asks`,className:`${Sa} max-h-[40vh] overflow-y-auto py-1`,children:u.map(e=>{let t=Ko(ga(e,d,f),e,c),n=_a(e,a);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/thread/$threadId`,params:{threadId:e.id},className:`block px-4 py-2 transition-colors hover:bg-surface-2/50`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary ${n?`font-semibold`:``}`,children:e.title}),n?(0,P.jsx)(`span`,{"aria-label":`new answer`,className:`size-1.5 shrink-0 rounded-full bg-emerald-400`}):null,(0,P.jsx)(`time`,{dateTime:e.openedAt,className:`shrink-0 text-meta`,children:Ve(e.openedAt,o)})]}),(0,P.jsx)(`span`,{className:`mt-0.5 block truncate text-xs ${t.tone}`,children:t.text})]})},e.id)})})]})}function Jo({unread:e,onOpen:t}){let n=Wo(),[r]=e,i=r===void 0?null:e.length===1?`${n(r.lastAuthor??`board`)} answered “${r.title}”`:`${e.length} new answers`;return(0,P.jsxs)(`button`,{type:`button`,onClick:t,className:`pointer-events-auto flex max-w-full min-w-0 items-center gap-2 rounded-full px-3 py-1.5 text-meta transition-colors hover:text-fg-secondary`,children:[i===null?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 shrink-0 rounded-full bg-emerald-400`}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:i}),(0,P.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}),(0,P.jsx)(`kbd`,{className:`shrink-0 rounded border border-line px-1.5 font-sans text-[11px] text-fg-secondary`,children:`Space`}),(0,P.jsx)(`span`,{className:`shrink-0`,children:`to ask`})]})}var Yo={working:{label:`working`,style:`bg-emerald-500/15 text-emerald-300`},queued:{label:`queued`,style:`bg-amber-500/15 text-amber-300`},idle:{label:`resting`,style:`bg-surface-2 text-fg-tertiary`}};function Xo(e,t,n,r){return t.state===`working`?`In a turn at ${n}`:t.state===`queued`?`Queued for ${n}`:e.lastTurnAt===void 0?`No turns yet`:`Last turn ${Ve(e.lastTurnAt,r)}`}function Zo({member:e,star:t,place:n,now:r}){let i=e.lastModel??e.model,a=Yo[t.state];return(0,P.jsxs)(`article`,{className:`card w-72 p-3.5`,"aria-label":`${e.name}, ${e.role}`,children:[(0,P.jsxs)(`header`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-md bg-surface-2/70`,children:(0,P.jsx)(Dt,{cli:t.cli,size:18})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`h2`,{className:`text-title truncate`,children:e.name}),(0,P.jsxs)(`p`,{className:`truncate text-meta`,children:[e.role,i===void 0?``:` · ${i}`]})]}),(0,P.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${a.style}`,children:a.label})]}),(0,P.jsx)(`p`,{className:`mt-2.5 text-sm text-fg-secondary`,children:Xo(e,t,n,r)})]})}function Qo({society:e,citizens:t,citizensOpen:n,onToggleCitizens:r,runnersOpen:i,onToggleRunners:a,enrolling:o,cronsOpen:s,onToggleCrons:c,failingCrons:l,attention:u,onOpenAttention:d,paused:f,onTogglePause:p,pauseBusy:m,boardOpen:h,onToggleBoard:g,metricsOpen:_,onToggleMetrics:v,logsOpen:y,onToggleLogs:b,onSignOut:x}){return(0,P.jsxs)(`header`,{className:`pointer-events-none absolute inset-x-0 top-0 flex items-start justify-between p-5`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,P.jsx)(`span`,{className:`text-display`,children:`Stellaris`}),e===void 0?null:(0,P.jsx)(`span`,{className:`text-meta`,children:e})]}),(0,P.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2`,children:[u===0?null:(0,P.jsxs)(`button`,{type:`button`,onClick:d,className:`card inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs text-amber-300 transition-colors hover:text-amber-200 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-amber-300`}),u,` `,u===1?`needs`:`need`,` you`]}),(0,P.jsx)(`button`,{type:`button`,"aria-pressed":f,disabled:m,onClick:p,title:f?`Nobody takes a turn until you resume; wakes wait in the queue.`:`Stop dispatching turns. Running turns finish; new wakes wait.`,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none disabled:opacity-50 ${f?`text-amber-300 hover:text-amber-200`:`text-fg-tertiary hover:text-fg-primary`}`,children:f?`Paused · resume`:`Pause`}),(0,P.jsx)(`button`,{type:`button`,"aria-pressed":n,onClick:r,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${n?`text-fg-primary`:`text-fg-tertiary hover:text-fg-primary`}`,children:t===1?`1 citizen`:`${t} citizens`}),(0,P.jsxs)(`button`,{type:`button`,"aria-pressed":i,"aria-label":o===0?`Runners`:`Runners, ${o} waiting for approval`,onClick:a,className:`card inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${i?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:[`Runners`,o===0?null:(0,P.jsx)(`span`,{className:`rounded bg-amber-500/15 px-1 text-[11px] text-amber-300`,children:o})]}),(0,P.jsxs)(`button`,{type:`button`,"aria-pressed":s,"aria-label":l===0?`Crons`:`Crons, ${l} failing`,onClick:c,className:`card inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${s?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:[`Crons`,l===0?null:(0,P.jsx)(`span`,{className:`rounded bg-amber-500/15 px-1 text-[11px] text-amber-300`,children:l})]}),(0,P.jsx)(`button`,{type:`button`,"aria-pressed":h,onClick:g,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${h?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Board`}),(0,P.jsx)(`button`,{type:`button`,"aria-pressed":_,onClick:v,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${_?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Metrics`}),(0,P.jsx)(`button`,{type:`button`,"aria-expanded":y,onClick:b,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${y?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Logs`}),(0,P.jsx)(`button`,{type:`button`,onClick:x,className:`h-7 rounded-md px-2.5 text-xs text-fg-tertiary transition-colors hover:bg-surface-2/60 hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:`Sign out`})]})]})}var $o=new Set(h),B={waiting_stage:`stage waiting`,backlog:`backlog`,role_gap:`role gap`,churn:`churn`,stale_thread:`stale thread`,idle_member:`idle member`,blocked_capability:`missing capability`,turn_cost:`spend`,scaled:`replica added`,runner:`runner`,home_conflict:`edits to reconcile`,stuck_workspace:`work left on no branch`,cron_failing:`cron failing`};function es(e){return $o.has(e)}function ts(e,t){let n=new Set(t),r=new Map;for(let t of e)n.has(t.signal.key)&&r.set(t.signal.key,t.id);return new Set(r.values())}function ns(e){return[e.project??``,e.agent??``,e.role===void 0?``:`role ${e.role}`,es(e.kind)?`wakes the steward`:``].filter(e=>e.length>0)}function rs({onClose:e}){let n=t(!0),r=s(),i=_e(3e4),a=n.data??[],o=ts(a,r.data?.signals??[]);return(0,P.jsxs)(Ca,{label:`Operations log`,className:`top-[72px] right-4 z-20 max-h-[min(70vh,640px)]`,style:{width:400},children:[(0,P.jsxs)(`header`,{className:`flex items-start gap-3 border-b border-line px-4 py-3`,children:[(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`h2`,{className:`text-heading`,children:`Operations log`}),(0,P.jsx)(`p`,{className:`mt-0.5 text-meta`,children:`What the scheduler measured. Only kinds that wake the steward start a turn; it reads the rest at its next one.`})]}),(0,P.jsx)(`button`,{type:`button`,"aria-label":`Close the log`,onClick:e,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:`×`})]}),a.length===0?(0,P.jsx)(`p`,{className:`px-4 py-4 text-meta`,children:n.data===void 0?`Reading the log…`:`Nothing measured yet.`}):(0,P.jsx)(`ol`,{className:`flex-1 overflow-y-auto`,children:a.toReversed().map(({id:e,ts:t,signal:n})=>{let r=es(n.kind),a=ns(n);return(0,P.jsxs)(`li`,{className:`border-b border-line/60 px-4 py-2.5 last:border-b-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`rounded-md px-1.5 py-px text-[11px] ${r?`bg-amber-500/15 text-amber-300`:`bg-surface-2 text-fg-tertiary`}`,children:B[n.kind]}),o.has(e)?(0,P.jsx)(`span`,{className:`text-[11px] text-emerald-300`,children:`holds now`}):null,(0,P.jsx)(`time`,{dateTime:t,title:t,className:`ml-auto shrink-0 text-meta`,children:Ve(t,i)})]}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:(0,P.jsx)(Za,{text:n.summary})}),a.length===0&&n.taskId===void 0?null:(0,P.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[a.join(` · `),n.taskId===void 0?null:(0,P.jsxs)(P.Fragment,{children:[a.length===0?``:` · `,(0,P.jsx)(wt,{to:`/task/$taskId`,params:{taskId:n.taskId},className:`text-fg-tertiary underline-offset-2 hover:text-fg-primary hover:underline`,children:`the task`})]})]})]},e)})})]})}var is=32;function as(e,t){return t.width+t.x-e.clientX}function os({width:e,min:t,max:n,onResize:r,onToggle:i}){let a=(0,j.useRef)(null),o=t=>{t.button===0&&(t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),a.current={x:t.clientX,width:e})},s=e=>{a.current!==null&&r(as(e,a.current),!1)},c=e=>{a.current!==null&&(r(as(e,a.current),!0),a.current=null)};return(0,P.jsx)(`button`,{type:`button`,"aria-label":`Width of the board's content, ${e} of at most ${n} pixels: drag or use the arrow keys, Enter widens it all the way or back`,title:`Drag to resize. Double-click to widen it all the way, or back.`,onPointerDown:o,onPointerMove:s,onPointerUp:c,onPointerCancel:c,onClick:e=>{e.detail===0&&i()},onDoubleClick:i,onKeyDown:i=>{let a=i.key===`ArrowLeft`?e+is:i.key===`ArrowRight`?e-is:i.key===`Home`?t:i.key===`End`?n:null;a!==null&&(i.preventDefault(),r(a,!0))},className:`absolute inset-y-0 left-0 z-10 w-2 cursor-col-resize touch-none before:absolute before:inset-y-4 before:left-0.5 before:w-0.5 before:rounded-full before:transition-colors hover:before:bg-fg-muted/60 focus-visible:outline-none focus-visible:before:bg-fg-primary/60 active:before:bg-fg-primary/60`})}function ss({mark:e,project:t,members:n}){let r=n?.find(t=>t.name===e.holder)?.cli??null,i=Mt.find(t=>t.phase===e.phase)?.label??e.phase;return(0,P.jsxs)(`article`,{className:`card w-72 p-4`,"aria-label":`Task ${e.title}`,children:[(0,P.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,P.jsx)(`h2`,{className:`text-title min-w-0 flex-1`,children:e.title}),(0,P.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${kt[e.phase]}`,children:i.toLowerCase()})]}),(0,P.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:[(0,P.jsx)(`dt`,{className:`text-fg-muted`,children:`Project`}),(0,P.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:t}),(0,P.jsx)(`dt`,{className:`text-fg-muted`,children:`Stage`}),(0,P.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:e.stage}),e.holder===null?e.waitingFor===null?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`dt`,{className:`text-fg-muted`,children:`Waiting for`}),(0,P.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:e.waitingFor})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`dt`,{className:`text-fg-muted`,children:`Held by`}),(0,P.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-1 text-fg-secondary`,children:[r===null?null:(0,P.jsx)(Dt,{cli:r,size:12}),e.holder,e.linked===null?` · resting`:` · in a turn on it`]})]})]})]})}function cs(e,t){let n=`latest`;return eo({token:e,url:()=>`/api/events/stream?since=${n}`,onData:e=>{let r=Se.parse(JSON.parse(e));n=r.id,t.onEvent(r)},onOpen:e=>{e&&t.onResume()}})}function V(e){return typeof e==`string`?e:void 0}function ls(e){let{type:t,payload:n,actor:r}=e;if(t===`message.posted`){let e=V(n.thread);return e===void 0?[[`channels`],[`channel`,V(n.channel)],[`requests`]]:[[`threads`],[`thread`,e],[`requests`]]}return t.startsWith(`thread.`)?[[`threads`],[`thread`,V(n.threadId)],[`channel`],[`requests`]]:t.startsWith(`task.`)||t.startsWith(`merge.`)||t.startsWith(`pull_request.`)||t===`lease.expired`?[[`tasks`],[`task`,V(n.taskId)],[`members`],[`metrics`]]:t===`turn.completed`||t===`turn.failed`?[[`scheduler`],[`members`],[`turns`,r],[`memory`,r],[`agent-skills`,r],[`conflicts`,r],[`history`,r],[`task-file`],[`task-changes`],[`metrics`],[`crons`]]:t===`turn.started`?[[`scheduler`],[`members`],[`metrics`]]:t.startsWith(`turn.`)||t===`wake.requested`||t===`paused.changed`?[[`scheduler`],[`members`]]:t===`knowledge.written`||t===`knowledge.removed`?[[`knowledge`,V(n.project)??`society`]]:t===`dashboard.updated`?[[`dashboard`,V(n.project)]]:t.startsWith(`cron.`)?[[`crons`]]:t===`society.configured`?[[`society`],[`crons`]]:t.startsWith(`agent.`)||t===`subscription.changed`?[[`members`],[`crons`]]:t.startsWith(`project.`)||t===`channel.added`||t===`channel.archived`?[[`projects`],[`channels`],[`society`],[`crons`]]:t===`role.added`?[[`roles`]]:t.startsWith(`runner.`)?[[`runners`],[`models`],[`server-version`]]:t.startsWith(`proposal.`)?[[`proposals`],[`proposal`,V(n.proposalId)],[`metrics`]]:t===`skill.promoted`?[[`skills`]]:t===`ops.signal`?[[`signals`],[`scheduler`],[`metrics`]]:[]}function us(e,t){for(let n of ls(t)){let t=n.filter(e=>e!==void 0);e.invalidateQueries({queryKey:t})}}var ds=`stellaris.contentWidth`;function fs(e){return Math.round(Math.min(680,Math.max(420,e*.4)))}function ps(e){return Math.max(420,e-256-48)}function ms(e,t){let n=ps(e);return t===`widest`?n:Math.round(Math.min(n,Math.max(420,t??fs(e))))}function hs(e,t){return ms(e,t)>=ps(e)?null:`widest`}function gs(){let e=localStorage.getItem(ds);if(e===`widest`)return`widest`;let t=Number(e);return e!==null&&Number.isFinite(t)&&t>0?t:null}function _s(e){e===null?localStorage.removeItem(ds):localStorage.setItem(ds,String(e))}var vs=`stellaris.trail`;function ys(e,t,n){let r={};for(let[n,i]of Object.entries(e))Number(n)<t&&(r[Number(n)]=i);return r[t]=n,r}function bs(e,t){let n=e[t-1];return n===void 0||new URL(n,`http://board`).pathname===`/`?null:n}function xs(){try{let e=JSON.parse(sessionStorage.getItem(vs)??`{}`);if(typeof e!=`object`||!e)return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&Number.isInteger(Number(n))&&(t[Number(n)]=r);return t}catch{return{}}}function Ss(e){sessionStorage.setItem(vs,JSON.stringify(e))}function Cs(e,t){return decodeURIComponent(e.split(`/`)[t]??``)}function ws(e,t){let{pathname:n}=new URL(e,`http://board`),r=n.split(`/`).filter(e=>e!==``),[i=``,a=``,o=``]=r;if(i===`task`&&o===`files`)return r.slice(3).map(decodeURIComponent).at(-1)??`the task's files`;if(i===`task`||i===`thread`||i===`proposal`)return t.entity(a)??`the ${i}`;if(i===`c`)return`#${decodeURIComponent(r.at(-1)??``)}`;if(i===`p`){let e=t.project(a)??a;return o===`tasks`?`the tasks of ${e}`:e}return i===`knowledge`?Cs(n,3):i===`citizen`?decodeURIComponent(a):{society:`the society`,citizens:`the citizens`,"needs-you":`what needs you`,proposals:`the proposals`,metrics:`the metrics`,runners:`the runners`}[i]??`the previous view`}var Ts=typeof sessionStorage>`u`?{}:xs(),Es=new Set;function Ds(e,t){if(Ts[e]!==t||Ts[e+1]!==void 0){Ts=ys(Ts,e,t),Ss(Ts);for(let e of Es)e()}}function Os(){return(0,j.useSyncExternalStore)(e=>(Es.add(e),()=>Es.delete(e)),()=>Ts)}function ks(e,t){let n=Mt.find(t=>t.phase===e.phase)?.label.toLowerCase(),r=e.holder===null?e.waitingFor===null?null:`for ${e.waitingFor}`:`held by ${e.holder}${e.linked===null?``:`, in a turn there`}`;return[`Task ${e.title} at ${t}`,`stage ${e.stage}`,n,r].filter(e=>e!=null).join(`, `)}var As=Math.PI*(3-Math.sqrt(5)),js=68,Ms=44,Ns=58,Ps=26,Fs=13,Is=.3,Ls=1.5*Math.PI,Rs=28,zs=280,Bs=8,Vs=40;function Hs(e){return Math.max(Ns,js*Math.sqrt(Math.max(0,e-1))+Ms)}function Us(e){return e+Ps}function Ws(e){let t=new Map;for(let n of e.toSorted()){let e=pe(n);if(e!==null){let n=t.get(e.agent)??[];n.includes(e.scope)||t.set(e.agent,[...n,e.scope])}}return t}function Gs(e){let t=e.projects.filter(e=>e.archived===void 0).toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt)||e.slug.localeCompare(t.slug)),n=new Set(t.map(e=>e.slug)),r=e=>n.has(e)?e:Ge,i=Ws(e.scheduler.running),a=Ws(e.scheduler.pending),o=new Set(e.scheduler.resident.map(e=>e.split(`/`)[0])),s=e.members.filter(e=>e.cli!==null).filter(e=>e.status===`active`).toSorted((e,t)=>e.name.localeCompare(t.name)),c=s.flatMap(e=>{let t=[...new Set((i.get(e.name)??[]).map(r))];if(t.length>0)return t.map(t=>({id:t===`society`?e.name:`${e.name}/${t}`,member:e,state:`working`,scope:t,queuedFor:null}));let n=a.get(e.name)?.[0];return[{id:e.name,member:e,state:n===void 0?`idle`:`queued`,scope:Ge,queuedFor:n===void 0?null:r(n)}]}),l=new Map([[Ge,new Map(s.map((e,t)=>[e.name,t]))]]);for(let e of t){let t=s.filter(t=>t.memberships.includes(e.slug)),n=c.filter(t=>t.scope===e.slug).map(e=>e.member).filter(t=>!t.memberships.includes(e.slug));l.set(e.slug,new Map([...t,...n].map((e,t)=>[e.name,t])))}let u=new Map([...l].map(([e,t])=>[e,t.size])),d={id:Ge,label:`society`,kind:`society`,x:0,y:0,radius:Hs(u.get(`society`)??0)},f=[d,...Js(t,u,d)],p=new Map(f.map(e=>[e.id,e])),m=c.map(({id:e,member:t,state:n,scope:r,queuedFor:i})=>{let a=p.get(r)??d,s=l.get(a.id)?.get(t.name)??0,c=js*Math.sqrt(s),u=s*As-Math.PI/2;return{id:e,name:t.name,cli:t.cli,state:n,resident:o.has(t.name),anchor:a.id,queuedFor:i,x:Math.round(a.x+c*Math.cos(u)),y:Math.round(a.y+c*Math.sin(u))}}),h=Ks(e.tasks??[],f,m),g=Math.max(...f.map(e=>Math.hypot(e.x,e.y)+Us(e.radius)));return{anchors:f,stars:m,tasks:h,radius:Math.round(g+Vs)}}function Ks(e,t,n){let r=[];for(let i of t){if(i.kind!==`project`)continue;let t=e.filter(e=>e.project===i.id).flatMap(e=>{let t=jt(e);return t===`done`||t===`abandoned`?[]:[{task:e,phase:t}]}).toSorted((e,t)=>e.task.id.localeCompare(t.task.id)),a=Math.min(Is,Ls/Math.max(1,t.length)),o=i.radius+Fs;t.forEach(({task:e,phase:t},s)=>{let c=s%2==0?1:-1,l=-Math.PI/2+c*Math.ceil(s/2)*a,u=t===`landing`?null:e.claimedBy??null,d=we(e),f=u===null?null:n.find(e=>e.name===u&&e.anchor===i.id)?.id??null;r.push({id:e.id,title:e.title,project:i.id,phase:t,stage:d?.name??e.stage,holder:u,waitingFor:u===null&&t!==`landing`&&d!==void 0?At(d):null,linked:f,x:Math.round(i.x+o*Math.cos(l)),y:Math.round(i.y+o*Math.sin(l))})})}return r}function qs(e,t,n){let r=e.stars.filter(e=>e.name===t);return(r.find(e=>e.anchor===n)??r[0])?.id??null}function Js(e,t,n){let r=[],i=Us(n.radius),a=Bs;for(let n=0,o=0;n<e.length;o+=1){let s=e.slice(n,n+a);n+=a,a+=4;let c=s.map(e=>Hs(t.get(e.slug)??0)),l=c.map(Us),u=l.map(e=>2*e+Rs),d=u.reduce((e,t)=>e+t,0),f=u.map(e=>2*Math.PI*e/d),p=-Math.PI/2-(f[0]??0)/2+(o===0?0:Math.PI/s.length),m=f.map(e=>{let t=p+e/2;return p+=e,t}),h=Math.max(o===0?zs:0,i+Math.max(...l)+Rs);if(s.length>1)for(let e=0;e<s.length;e+=1){let t=(e+1)%s.length,n=((f[e]??0)+(f[t]??0))/2,r=((l[e]??0)+(l[t]??0)+Rs)/(2*Math.sin(n/2));h=Math.max(h,r)}s.forEach((e,t)=>{let n=m[t]??0;r.push({id:e.slug,label:e.name,kind:`project`,x:Math.round(h*Math.cos(n)),y:Math.round(h*Math.sin(n)),radius:Math.round(c[t]??Ns)})}),i=h+Math.max(...l)}return r}var Ys=.15,Xs=.45,Zs=1.35,Qs=64,$s=1.15;function ec(e,t,n){return Math.min(n,Math.max(t,e))}function tc(e){return Math.max(240,e.width-e.left-e.right)}function nc(e){return{x:e.left+tc(e)/2,y:e.height/2}}function rc(e,t){return{x:0,y:0,scale:ec(Math.min(tc(e),e.height)/(2*t),Xs,Zs)}}function ic(e,t,n,r){let i=ec(e.scale*n,Ys,3),a=nc(t),o=e.x+(r.x-a.x)/e.scale,s=e.y+(r.y-a.y)/e.scale;return{x:o-(r.x-a.x)/i,y:s-(r.y-a.y)/i,scale:i}}function ac(e,t,n){return{...e,x:e.x-t/e.scale,y:e.y-n/e.scale}}function oc(e,t,n){let r=nc(t),i=r.x+(n.x-e.x)*e.scale,a=r.y+(n.y-e.y)*e.scale,o=n.reach*e.scale;if(i-o>=t.left&&i+o<=t.width-t.right&&a-o>=Qs&&a+o<=t.height)return null;let s=Math.min(tc(t),t.height-Qs)/(2*n.reach*$s);return{x:n.x,y:n.y,scale:Math.min(e.scale,ec(s,Ys,3))}}var sc=`#0a0a0a`,cc=`#171717`,lc=`212, 212, 212`,uc=`163, 163, 163`,dc=`115, 115, 115`,fc=`"Instrument Sans Variable", ui-sans-serif, sans-serif`,pc=`500 12px "Onest Variable", ui-sans-serif, sans-serif`,mc=`600 10px "Onest Variable", ui-sans-serif, sans-serif`,hc={waiting:`#fcd34d`,working:`#6ee7b7`,returned:`#fdba74`,landing:`#7dd3fc`},gc=`500 11px ${fc}`,_c=5,vc=240,yc=34,bc=.06,xc=15,Sc=5,Cc=4.2,wc=280;function Tc(e){let t=e;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function Ec(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0)/4294967296*Math.PI*2}function Dc(e,t){return(e%t+t)%t}function Oc(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function kc(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(n!==null){let t=Oc(e),r=n.createRadialGradient(128,128,0,128,128,128);r.addColorStop(0,`rgba(${t}, 0.55)`),r.addColorStop(.22,`rgba(${t}, 0.2)`),r.addColorStop(.55,`rgba(${t}, 0.05)`),r.addColorStop(1,`rgba(${t}, 0)`),n.fillStyle=r,n.fillRect(0,0,256,256)}return t}var Ac=class{canvas;options;ctx;glyphs;glows=new Map;bodies=new Map;marks=new Map;bubbles=new Map;clock=0;specks;spheres=new Map;radius=400;scale=1;camX=0;camY=0;target={x:0,y:0,scale:1};mode=`home`;focusPending=!1;width=0;height=0;dpr=1;hovered=null;focus=null;paused=!1;insetLeft=0;insetRight=0;centerX=0;frameId=null;last=0;constructor(e,t){this.canvas=e,this.options=t;let n=e.getContext(`2d`);if(n===null)throw Error(`the sky needs a 2D canvas context`);this.ctx=n,this.glyphs={claude:new Path2D(Tt.claude.path),codex:new Path2D(Tt.codex.path)};let r=Tc(7);this.specks=Array.from({length:wc},()=>({x:r(),y:r(),size:.5+r()*1.1,alpha:.12+r()*.45,rate:.2+r()*.8,phase:r()*Math.PI*2}))}setModel(e){this.radius=e.radius;for(let t of e.anchors){let e=this.spheres.get(t.id);e===void 0?this.spheres.set(t.id,{anchor:t,x:t.x,y:t.y,radius:t.radius}):e.anchor=t}for(let t of this.spheres.keys())e.anchors.some(e=>e.id===t)||this.spheres.delete(t);let t=new Set(e.stars.map(e=>e.id)),n=[...this.bodies.entries()].filter(([e])=>!t.has(e));for(let r of e.stars){let i=this.bodies.get(r.id);if(i!==void 0){i.star=r,i.leaving=!1;continue}let a=n.findIndex(([,e])=>e.star.name===r.name),o=n[a];if(o!==void 0){n.splice(a,1),this.bodies.delete(o[0]),this.bodies.set(r.id,{...o[1],star:r,leaving:!1});continue}let s=[...this.bodies.values()].find(e=>e.star.name===r.name&&t.has(e.star.id)),c=e.anchors.find(e=>e.id===r.anchor),l=s??c??r;this.bodies.set(r.id,{star:r,x:this.options.reducedMotion?r.x:l.x,y:this.options.reducedMotion?r.y:l.y,vx:0,vy:0,phase:Ec(r.name),presence:+!!this.options.reducedMotion,leaving:!1,screen:{x:0,y:0},flash:0})}for(let[,t]of n){let n=e.stars.find(e=>e.name===t.star.name);t.leaving=!0,n!==void 0&&(t.star={...t.star,x:n.x,y:n.y})}let r=new Set(e.tasks.map(e=>e.id));for(let t of e.tasks){let e=this.marks.get(t.id);e===void 0?this.marks.set(t.id,{mark:t,x:t.x,y:t.y,presence:+!!this.options.reducedMotion,leaving:!1,screen:{x:0,y:0}}):(e.mark=t,e.leaving=!1)}for(let[e,t]of this.marks)r.has(e)||(t.leaving=!0)}flash(e){let t=this.bodies.get(e);t!==void 0&&!this.options.reducedMotion&&(t.flash=1)}say(e,t){this.bodies.has(e)&&this.bubbles.set(e,{text:t,born:this.clock})}setHovered(e){this.hovered=e}setPaused(e){this.paused=e}setFocus(e){this.focus=e,this.focusPending=!0}zoomBy(e,t){let n=this.view();this.target=ic(this.target,n,e,t??nc(n)),this.mode=`manual`}panBy(e,t){this.target=ac(this.target,e,t),this.camX-=e/this.scale,this.camY-=t/this.scale,this.mode=`manual`}home(){this.mode=`home`}view(){return{width:this.width,height:this.height,left:this.insetLeft,right:this.insetRight}}frameFocus(e){let t=this.focus===null?void 0:this.spheres.get(this.focus);if(t===void 0||t.anchor.kind===`society`){this.mode===`focus`&&(this.mode=`home`);return}let n=oc(this.target,e,{x:t.anchor.x,y:t.anchor.y,reach:t.anchor.radius+yc});n!==null&&(this.target=n,this.mode=`focus`)}setInsets(e,t){this.insetLeft=e,this.insetRight=t}hitTestAnchor(e,t){let n=null,r=1/0;for(let i of this.spheres.values()){let a=this.toScreen(i.x,i.y),o=Math.hypot(a.x-e,a.y-t);o<=i.radius*this.scale&&o<r&&(n=i.anchor.id,r=o)}return n}resize(e,t,n){this.width=e,this.height=t,this.dpr=n,this.canvas.width=Math.round(e*n),this.canvas.height=Math.round(t*n)}hitTestMark(e,t){let n=null,r=10;for(let[i,a]of this.marks){let o=Math.hypot(a.screen.x-e,a.screen.y-t);!a.leaving&&o<r&&(n=i,r=o)}return n}hitTest(e,t){let n=null,r=Math.max(xc*this.scale+8,18);for(let[i,a]of this.bodies){if(a.leaving)continue;let o=Math.hypot(a.screen.x-e,a.screen.y-t);o<r&&(n=i,r=o)}return n}start(){this.frameId===null&&(this.last=performance.now()/1e3,this.frameId=requestAnimationFrame(this.frame))}stop(){this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}frame=e=>{let t=e/1e3;this.clock=t;let n=Math.min(.05,Math.max(0,t-this.last));this.last=t,this.step(n),this.draw(this.options.reducedMotion?0:t),this.frameId=requestAnimationFrame(this.frame)};step(e){let t=this.view();this.mode===`home`&&(this.target=rc(t,this.radius)),this.focusPending&&this.width>0&&(this.focusPending=!1,this.frameFocus(t));let n=this.options.reducedMotion?1:Math.min(1,e*3);this.scale+=(this.target.scale-this.scale)*n,this.camX+=(this.target.x-this.camX)*n,this.camY+=(this.target.y-this.camY)*n;let r=nc(t).x;this.centerX=this.centerX===0?r:this.centerX+(r-this.centerX)*n;for(let e of this.spheres.values())e.x+=(e.anchor.x-e.x)*n,e.y+=(e.anchor.y-e.y)*n,e.radius+=(e.anchor.radius-e.radius)*n;for(let[t,n]of this.bodies){if(this.options.reducedMotion)n.x=n.star.x,n.y=n.star.y,n.presence=+!n.leaving;else{n.vx+=(Sc*(n.star.x-n.x)-Cc*n.vx)*e,n.vy+=(Sc*(n.star.y-n.y)-Cc*n.vy)*e,n.x+=n.vx*e,n.y+=n.vy*e;let t=+!n.leaving;n.presence+=(t-n.presence)*Math.min(1,e*2.5)}n.flash=Math.max(0,n.flash-e*2.2),n.leaving&&n.presence<.02&&this.bodies.delete(t)}for(let[t,r]of this.marks){r.x+=(r.mark.x-r.x)*n,r.y+=(r.mark.y-r.y)*n;let i=+!r.leaving;r.presence+=(i-r.presence)*(this.options.reducedMotion?1:Math.min(1,e*2.5)),r.leaving&&r.presence<.02&&this.marks.delete(t)}for(let[e,t]of this.bubbles)(this.clock-t.born>_c||this.bodies.get(e)?.leaving!==!1)&&this.bubbles.delete(e)}toScreen(e,t){return{x:this.centerX+(e-this.camX)*this.scale,y:this.height/2+(t-this.camY)*this.scale}}glow(e){let t=this.glows.get(e);return t===void 0&&(t=kc(e),this.glows.set(e,t)),t}draw(e){let{ctx:t}=this;t.setTransform(this.dpr,0,0,this.dpr,0,0),t.fillStyle=sc,t.fillRect(0,0,this.width,this.height),this.drawSpecks(e),this.drawAnchors(),this.drawTasks(e);let n=[...this.bodies.values()].toSorted((e,t)=>Number(e.star.id===this.hovered)-Number(t.star.id===this.hovered));for(let t of n)this.drawBody(t,e);this.drawBubbles();let r=this.hovered?.startsWith(`task:`)===!0?this.hovered.slice(5):null,i=r===null?this.hovered===null?void 0:this.bodies.get(this.hovered):this.marks.get(r);this.options.onHoverPosition(i===void 0||i.leaving?null:i.screen)}drawTasks(e){let{ctx:t}=this;for(let e of this.marks.values())e.screen=this.toScreen(e.x,e.y);t.save(),t.lineWidth=1;for(let n of this.marks.values()){let r=n.mark.linked===null?void 0:this.bodies.get(n.mark.linked);if(r===void 0||r.leaving)continue;let i=Oc(hc[n.mark.phase]),a=Math.min(n.presence,r.presence),o=n.screen,s=r.screen,c=t.createLinearGradient(o.x,o.y,s.x,s.y);if(c.addColorStop(0,`rgba(${i}, ${(.55*a).toFixed(3)})`),c.addColorStop(1,`rgba(${i}, ${(.12*a).toFixed(3)})`),t.strokeStyle=c,t.beginPath(),t.moveTo(o.x,o.y),t.lineTo(s.x,s.y),t.stroke(),e!==0){let n=(e*.45+r.phase)%1;t.beginPath(),t.arc(s.x+(o.x-s.x)*n,s.y+(o.y-s.y)*n,1.4,0,Math.PI*2),t.fillStyle=`rgba(${i}, ${(.85*a).toFixed(3)})`,t.fill()}}t.restore();for(let[n,r]of this.marks){let{mark:i,screen:a}=r,o=this.hovered===`task:${n}`,s=hc[i.phase],c=i.phase===`waiting`&&e!==0?.65+.35*Math.sin(e*1.6+a.x):1,l=Math.max(3,4*this.scale)*(o?1.5:1);t.save(),t.globalAlpha=r.presence*c*(this.paused?.7:1),t.globalCompositeOperation=`lighter`;let u=l*7;t.drawImage(this.glow(s),a.x-u/2,a.y-u/2,u,u),t.globalCompositeOperation=`source-over`,t.translate(a.x,a.y),t.rotate(Math.PI/4),t.fillStyle=s,t.fillRect(-l/2,-l/2,l,l),o&&(t.strokeStyle=`rgba(255, 255, 255, 0.8)`,t.lineWidth=1,t.strokeRect(-l/2-2,-l/2-2,l+4,l+4)),t.restore()}}drawBubbles(){let{ctx:e}=this;e.save(),e.font=gc,e.textAlign=`left`,e.textBaseline=`middle`;for(let[t,n]of this.bubbles){let r=this.bodies.get(t);if(r===void 0)continue;let i=this.clock-n.born,a=Math.min(1,i/.25,(_c-i)/1.2)*r.presence;if(a<=0)continue;let o=n.text;if(e.measureText(o).width>vc){for(;o.length>1&&e.measureText(`${o}…`).width>vc;)o=o.slice(0,-1);o=`${o.trimEnd()}…`}let s=e.measureText(o).width+16,c=this.options.reducedMotion?0:i*7,l=Math.max(10,xc*this.scale),u=r.screen.x-s/2,d=r.screen.y-l-14-22-c;e.globalAlpha=a,e.beginPath(),e.roundRect(u,d,s,22,7),e.fillStyle=`rgba(23, 23, 23, 0.92)`,e.fill(),e.strokeStyle=`rgba(255, 255, 255, 0.1)`,e.lineWidth=1,e.stroke(),e.fillStyle=`rgba(${lc}, 1)`,e.fillText(o,u+8,d+11+.5)}e.restore()}drawSpecks(e){let{ctx:t}=this,n=-this.camX*this.scale*bc,r=-this.camY*this.scale*bc;for(let i of this.specks){let a=e===0?1:.6+.4*Math.sin(e*i.rate+i.phase);t.fillStyle=`rgba(255, 255, 255, ${(i.alpha*a*(this.paused?.6:1)).toFixed(3)})`,t.fillRect(Dc(i.x*this.width+n,this.width),Dc(i.y*this.height+r,this.height),i.size,i.size)}let i=this.toScreen(0,0),a=t.createRadialGradient(i.x,i.y,0,i.x,i.y,320*this.scale);a.addColorStop(0,`rgba(255, 255, 255, 0.035)`),a.addColorStop(1,`rgba(255, 255, 255, 0)`),t.fillStyle=a,t.fillRect(0,0,this.width,this.height)}drawAnchors(){let{ctx:e}=this,t=this.toScreen(0,0);e.save(),e.setLineDash([2,7]),e.lineWidth=1,e.strokeStyle=`rgba(255, 255, 255, 0.07)`;for(let n of this.spheres.values())if(n.anchor.kind===`project`){let r=this.toScreen(n.x,n.y);e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(r.x,r.y),e.stroke()}e.restore();for(let{anchor:t,x:n,y:r,radius:i}of this.spheres.values()){let a=this.toScreen(n,r),o=i*this.scale,s=t.id===this.focus;if(t.kind===`project`){let t=e.createRadialGradient(a.x,a.y,0,a.x,a.y,o*1.8);t.addColorStop(0,`rgba(160, 170, 255, ${s?.1:.05})`),t.addColorStop(1,`rgba(160, 170, 255, 0)`),e.fillStyle=t,e.fillRect(a.x-o*1.8,a.y-o*1.8,o*3.6,o*3.6)}e.beginPath(),e.arc(a.x,a.y,o,0,Math.PI*2),e.lineWidth=s?1.5:1,e.strokeStyle=s?`rgba(255, 255, 255, 0.28)`:t.kind===`society`?`rgba(255, 255, 255, 0.09)`:`rgba(255, 255, 255, 0.06)`,e.stroke(),e.textAlign=`center`,e.textBaseline=`top`,t.kind===`society`?(e.font=mc,e.letterSpacing=`2px`,e.fillStyle=`rgba(${dc}, 0.9)`,e.fillText(t.label.toUpperCase(),a.x,a.y+o+10),e.letterSpacing=`0px`):(e.font=pc,e.fillStyle=s?`rgba(245, 245, 245, 1)`:`rgba(${uc}, 0.95)`,e.fillText(t.label,a.x,a.y+o+10))}}drawBody(e,t){let{ctx:n}=this,{star:r}=e,i=Tt[r.cli],a=r.id===this.hovered,o=r.state===`working`,s=o?2.5:5,c=s*(Math.sin(t*.29+e.phase)+.6*Math.sin(t*.17+e.phase*2.1)),l=s*(Math.cos(t*.23+e.phase*1.3)+.6*Math.cos(t*.11+e.phase)),u=this.toScreen(e.x+c,e.y+l);e.screen=u;let d=o?2.4:r.state===`queued`?1.4:.7,f=t===0?.5:.5+.5*Math.sin(t*d+e.phase),p=((o?.95+.35*f:r.state===`queued`?.7+.2*f:.5+.2*f)+(a?.25:0)+.8*e.flash)*e.presence*(this.paused?.7:1),m=Math.max(10,xc*this.scale),h=(o?170:130)*this.scale*(.9+.15*f);n.save(),n.globalCompositeOperation=`lighter`,n.globalAlpha=Math.min(1,p),n.drawImage(this.glow(i.accent),u.x-h/2,u.y-h/2,h,h),n.restore(),n.save(),n.globalAlpha=e.presence;let g=Oc(i.accent);if(o&&t!==0){let r=(t+e.phase)%1.8/1.8;n.beginPath(),n.arc(u.x,u.y,m+(6+30*r)*this.scale,0,Math.PI*2),n.strokeStyle=`rgba(${g}, ${(.4*(1-r)).toFixed(3)})`,n.lineWidth=1.25,n.stroke()}e.flash>0&&(n.beginPath(),n.arc(u.x,u.y,m+(3+12*(1-e.flash))*this.scale,0,Math.PI*2),n.strokeStyle=`rgba(255, 255, 255, ${(.55*e.flash).toFixed(3)})`,n.lineWidth=1.25,n.stroke()),r.resident&&(n.beginPath(),n.arc(u.x,u.y,m+5*this.scale,0,Math.PI*2),n.strokeStyle=`rgba(${g}, 0.3)`,n.lineWidth=1,n.stroke()),r.state===`queued`&&(n.beginPath(),n.arc(u.x,u.y,m+8*this.scale,0,Math.PI*2),n.setLineDash([3,4]),n.lineDashOffset=-t*8,n.strokeStyle=`rgba(${lc}, 0.55)`,n.lineWidth=1,n.stroke(),n.setLineDash([])),n.beginPath(),n.arc(u.x,u.y,m,0,Math.PI*2),n.fillStyle=cc,n.fill(),n.strokeStyle=`rgba(${g}, ${a?.95:.6})`,n.lineWidth=a?1.75:1.25,n.stroke(),n.save();let _=m*1.2/24;if(n.translate(u.x,u.y),n.scale(_,_),n.translate(-12,-12),n.fillStyle=i.fill,n.fill(this.glyphs[r.cli],`evenodd`),n.restore(),o)for(let r=0;r<3;r+=1){let i=t*1.8+r*Math.PI*2/3+e.phase,a=m+9*this.scale;n.beginPath(),n.arc(u.x+a*Math.cos(i),u.y+a*Math.sin(i),1.6,0,Math.PI*2),n.fillStyle=`rgba(${g}, 0.9)`,n.fill()}n.font=`500 ${Math.max(9,Math.min(11,11*this.scale)).toFixed(1)}px ${fc}`,n.textAlign=`center`,n.textBaseline=`top`,n.fillStyle=`rgba(${lc}, ${a||o?1:.7})`,n.fillText(r.name,u.x,u.y+m+8*this.scale+3),n.restore()}},jc=15e3,Mc=26,Nc=12,Pc=4,Fc=.0015,Ic=.01,Lc=1.3,Rc=`grid size-7 place-items-center rounded-md text-sm text-fg-tertiary transition-colors hover:bg-surface-2/70 hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`;function zc(e,t,n,r){if(e===null)return;if(t===null){e.style.visibility=`hidden`;return}let i=e.offsetWidth,a=e.offsetHeight,o=r.left+Nc,s=n.width-r.right-Nc,c=t.x+Mc+i<=s?t.x+Mc:t.x-Mc-i,l=Math.min(Math.max(Nc,t.y-a/3),n.height-a-Nc);e.style.transform=`translate(${Math.round(Math.max(o,c))}px, ${Math.round(l)}px)`,e.style.visibility=`visible`}function Bc({model:e,paused:t,hovered:n,onHover:r,insets:i,focus:a,onSelectAnchor:o,onSelectStar:s,onSelectTask:c,live:l,card:u}){let d=(0,j.useRef)(null),f=(0,j.useRef)(null),p=(0,j.useRef)(null),m=(0,j.useRef)(i);(0,j.useLayoutEffect)(()=>{m.current=i},[i]);let h=(0,j.useRef)(e);(0,j.useLayoutEffect)(()=>{h.current=e},[e]);let g=Ja(),_=(0,j.useRef)(g);(0,j.useLayoutEffect)(()=>{_.current=g},[g]);let v=(0,j.useRef)(null),y=(0,j.useRef)(!1);return(0,j.useEffect)(()=>{let e=d.current;if(e===null)throw Error(`the sky's canvas is not mounted`);let t=e.getBoundingClientRect(),n=new Ac(e,{reducedMotion:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,onHoverPosition:e=>zc(f.current,e,t,m.current)});p.current=n;let r=new ResizeObserver(()=>{t=e.getBoundingClientRect(),n.resize(t.width,t.height,window.devicePixelRatio)});r.observe(e);let i=e=>{e.preventDefault();let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*16:e.deltaY;n.zoomBy(Math.exp(-t*(e.ctrlKey?Ic:Fc)),{x:e.offsetX,y:e.offsetY})};return e.addEventListener(`wheel`,i,{passive:!1}),n.start(),()=>{e.removeEventListener(`wheel`,i),r.disconnect(),n.stop(),p.current=null}},[]),(0,j.useEffect)(()=>{p.current?.setModel(e)},[e]),(0,j.useEffect)(()=>l.listen(e=>{let t=p.current;if(t===null||e.event.type!==`tool_call`||Date.now()-Date.parse(e.ts)>jc)return;let n=qs(h.current,e.agent,e.project);if(n===null)return;t.flash(n);let r=Co(e.event.name,e.event.input);r!==null&&t.say(n,za(r,_.current))}),[l]),(0,j.useEffect)(()=>{p.current?.setPaused(t)},[t]),(0,j.useEffect)(()=>{p.current?.setHovered(n)},[n]),(0,j.useEffect)(()=>{p.current?.setFocus(a)},[a]),(0,j.useEffect)(()=>{p.current?.setInsets(i.left,i.right)},[i.left,i.right]),(0,P.jsxs)(`div`,{className:`absolute inset-0`,children:[(0,P.jsx)(`canvas`,{ref:d,className:`size-full touch-none`,"aria-hidden":`true`,onPointerDown:e=>{e.button===0&&(v.current={x:e.clientX,y:e.clientY,dragging:!1},y.current=!1)},onPointerUp:e=>{v.current?.dragging===!0&&(e.currentTarget.releasePointerCapture(e.pointerId),e.currentTarget.style.cursor=`grab`),v.current=null},onPointerMove:e=>{let t=p.current,i=v.current;if(i!==null&&t!==null){let n=e.clientX-i.x,a=e.clientY-i.y;if(!i.dragging&&Math.hypot(n,a)>Pc&&(i.dragging=!0,y.current=!0,e.currentTarget.setPointerCapture(e.pointerId),r(null)),i.dragging){t.panBy(n,a),i.x=e.clientX,i.y=e.clientY,e.currentTarget.style.cursor=`grabbing`;return}}let{offsetX:a,offsetY:o}=e.nativeEvent,s=t?.hitTest(a,o)??null,c=s===null?t?.hitTestMark(a,o)??null:null,l=s??(c===null?null:`task:${c}`),u=l===null?t?.hitTestAnchor(a,o)??null:null;e.currentTarget.style.cursor=l!==null||u!==null?`pointer`:`grab`,l!==n&&r(l)},onPointerLeave:()=>r(null),onClick:e=>{let t=p.current,{offsetX:n,offsetY:r}=e.nativeEvent;if(t===null||y.current){y.current=!1;return}let i=t.hitTest(n,r),a=i===null?t.hitTestMark(n,r):null,l=i===null&&a===null?t.hitTestAnchor(n,r):null;i===null?a===null?l!==null&&o(l):c(a):s(i)}}),(0,P.jsxs)(`fieldset`,{className:`card absolute bottom-4 flex flex-col gap-0.5 p-1`,style:{right:i.right+16},children:[(0,P.jsx)(`legend`,{className:`sr-only`,children:`Camera`}),(0,P.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,className:Rc,onClick:()=>p.current?.zoomBy(Lc),children:`+`}),(0,P.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,className:Rc,onClick:()=>p.current?.zoomBy(1/Lc),children:`−`}),(0,P.jsx)(`button`,{type:`button`,"aria-label":`Fit the whole sky`,title:`Fit the whole sky`,className:Rc,onClick:()=>p.current?.home(),children:`⤢`})]}),(0,P.jsx)(`div`,{ref:f,className:`pointer-events-none absolute top-0 left-0 will-change-transform`,style:{visibility:`hidden`},children:u})]})}var Vc={left:0,right:0};function Hc(){let[e,t]=(0,j.useState)(()=>window.innerWidth);return(0,j.useEffect)(()=>{let e=()=>t(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Uc(e,t){return e.startsWith(t)?decodeURIComponent(e.slice(t.length)):null}function Wc(){let{api:e,token:t,signOut:r,expire:a}=De(),o=ve();(0,j.useEffect)(()=>cs(t,{onEvent:e=>us(o,e),onResume:()=>void o.invalidateQueries()}),[t,o]);let[c]=(0,j.useState)(()=>new Do);(0,j.useEffect)(()=>c.follow(t),[c,t]);let l=x(),u=Te(),d=he(),f=Xe(),p=s(),m=y(),h=ze(),g=i(),_=(0,j.useMemo)(()=>La(m.data??[],h,g.data??[]),[m.data,h,g.data]),v=rt(),b=at({mutationFn:t=>e.setPaused(t),onSuccess:()=>void o.invalidateQueries({queryKey:[`scheduler`]})}),C=ca({select:e=>e.location.pathname}),w=ca({select:e=>e.location.href}),T=ca({select:e=>e.location.state.__TSR_index});(0,j.useEffect)(()=>Ds(T,w),[T,w]);let[E,ee]=(0,j.useState)(!1),[te,ne]=(0,j.useState)(null),re=te===C,ie=(0,j.useCallback)(()=>ne(null),[]),ae=(0,j.useRef)(!0),oe=ja(),se=Fi({strict:!1}),[ce,le]=(0,j.useState)(null),ue=_e(3e4),de=Hc(),fe=C!==`/`,[pe,me]=(0,j.useState)(gs),ge=ms(de,pe),ye=(e,t)=>{let n=ms(de,e),r=n>=ps(de)?`widest`:n;me(r),t&&_s(r)},be=()=>{let e=hs(de,pe);me(e),_s(e)},xe=(0,j.useMemo)(()=>fe?{left:288,right:ge+32}:Vc,[fe,ge]),O=Uc(C,`/thread/`),Se=S(Uc(C,`/task/`)),Ce=Uc(C,`/c/`)??(O===null?null:m.data?.find(e=>e.id===O)?.channel??null),we=/^\/p\/([^/]+)\/tasks$/.exec(C)?.[1]??Se.data?.project??null,k=Uc(C,`/citizen/`),A=k===null?null:se.scope??null,Ee=A?.split(`/`)[0]??null,ke=C===`/needs-you`?`needs-you`:C===`/proposals`||C.startsWith(`/proposal/`)?`proposals`:null,Ae=L().length,je=D().data?.length??0,Me=Oe().data?.filter(va).length??0,Ne=C===`/society`?Ge:/^\/p\/([^/]+)$/.exec(C)?.[1]??/^\/knowledge\/([^/]+)\//.exec(C)?.[1]??null;(0,j.useEffect)(()=>{let e=()=>{ae.current=!0},t=e=>{e.key===`Tab`&&(ae.current=!1);let t=e.target instanceof HTMLElement?e.target:null;if(!(t?.closest(`input, textarea, select, [contenteditable]`)!=null||e.metaKey||e.ctrlKey||e.altKey)){if(e.key===` `){if(t?.closest(`button, a, summary, [role='button']`)!=null&&!ae.current)return;e.preventDefault(),ne(C);return}e.key===`Escape`&&(re?ne(null):E?ee(!1):fe&&v({to:`/`}))}};return window.addEventListener(`keydown`,t),window.addEventListener(`pointerdown`,e),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`pointerdown`,e)}},[fe,E,re,C,v]);let Pe=[l,d,f,p].some(e=>e.error instanceof n&&e.error.status===401);(0,j.useEffect)(()=>{Pe&&a()},[Pe,a]);let Fe=(0,j.useMemo)(()=>d.data===void 0||f.data===void 0||p.data===void 0?null:Gs({members:d.data,projects:f.data,scheduler:p.data,tasks:h}),[d.data,f.data,p.data,h]);if(Fe===null){let e=[d,f,p].some(e=>e.error!==null);return(0,P.jsx)(`main`,{className:`grid h-full place-items-center`,children:(0,P.jsx)(`p`,{className:`text-meta`,"aria-live":`polite`,children:e?`The board server is not answering. Retrying…`:`Reading the board…`})})}let Ie=(ke!==null||C===`/metrics`||C===`/runners`||C===`/crons`?`society`:null)??Ne??we??(Ce===null?k===null?null:Ee??Fe.stars.find(e=>e.name===k)?.anchor??null:Ce.includes(`/`)?Ce.split(`/`)[0]??null:`society`),Le=de-xe.left-xe.right,Re=Le>=460,Be=Math.min(560,(Re?Le:de)-32),Ve={left:(Re?xe.left:0)+((Re?Le:de)-Be)/2,width:Be},He=ma(m.data??[]).filter(e=>_a(e,oe)),Ue=e=>e===`society`?`the society`:f.data?.find(t=>t.slug===e)?.name??e,We=Fe.stars.find(e=>e.id===ce),Ke=Fe.tasks.find(e=>`task:${e.id}`===ce),qe=d.data?.find(e=>e.name===We?.name),Je=We===void 0?`the society`:Ue(We.queuedFor??We.anchor),Ye=e=>{let t=Fe.stars.find(t=>t.id===e);t!==void 0&&v({to:`/citizen/$name`,params:{name:t.name},search:t.state===`working`?{scope:t.anchor}:{}})},Ze=e=>{v({to:`/task/$taskId`,params:{taskId:e}})};return(0,P.jsx)(Oo,{value:c,children:(0,P.jsx)(qa,{value:_,children:(0,P.jsx)(zo,{value:u.data?.signIn,children:(0,P.jsxs)(`main`,{className:`relative h-full overflow-hidden`,children:[(0,P.jsx)(Bc,{model:Fe,paused:p.data?.paused??!1,hovered:ce,onHover:le,insets:xe,focus:Ie,onSelectAnchor:e=>{v(e===`society`?{to:`/society`}:{to:`/p/$slug`,params:{slug:e}})},onSelectStar:Ye,onSelectTask:Ze,live:c,card:Ke===void 0?We===void 0||qe===void 0?null:(0,P.jsx)(Zo,{member:qe,star:We,place:Je,now:ue}):(0,P.jsx)(ss,{mark:Ke,project:Ue(Ke.project),members:d.data})}),(0,P.jsx)(Qo,{society:l.data?.name,citizens:new Set(Fe.stars.map(e=>e.name)).size,citizensOpen:C===`/citizens`,onToggleCitizens:()=>void v(C===`/citizens`?{to:`/`}:{to:`/citizens`}),runnersOpen:C===`/runners`,onToggleRunners:()=>void v(C===`/runners`?{to:`/`}:{to:`/runners`}),enrolling:je,cronsOpen:C===`/crons`,onToggleCrons:()=>void v(C===`/crons`?{to:`/`}:{to:`/crons`}),failingCrons:Me,attention:Ae,onOpenAttention:()=>void v({to:`/needs-you`}),paused:p.data?.paused??!1,onTogglePause:()=>b.mutate(!(p.data?.paused??!1)),pauseBusy:b.isPending,boardOpen:fe,onToggleBoard:()=>void v(fe?{to:`/`}:{to:`/c/$`,params:{_splat:`general`}}),logsOpen:E,metricsOpen:C===`/metrics`,onToggleMetrics:()=>void v(C===`/metrics`?{to:`/`}:{to:`/metrics`}),onToggleLogs:()=>ee(!E),onSignOut:r}),fe?(0,P.jsx)(Ro,{activeChannel:Ce,activeTasks:we,activeCitizen:k,activeScope:A,activeGovernance:ke,activeOverview:Ne}):null,fe?(0,P.jsxs)(Ca,{label:`Board content`,className:`top-[72px] right-4 bottom-4`,style:{width:ge},children:[(0,P.jsx)(os,{width:ge,min:420,max:ps(de),onResize:ye,onToggle:be}),(0,P.jsx)(Qi,{})]}):null,E?(0,P.jsx)(rs,{onClose:()=>ee(!1)}):null,re?(0,P.jsx)(qo,{left:Ve.left,width:Ve.width,onClose:ie}):(0,P.jsx)(`div`,{className:`pointer-events-none absolute bottom-5 flex justify-center px-16`,style:{left:xe.left,right:xe.right},children:(0,P.jsx)(Jo,{unread:He,onOpen:()=>ne(C)})}),Fe.stars.length===0&&!fe?(0,P.jsxs)(`p`,{className:`pointer-events-none absolute inset-x-0 top-1/2 mt-24 text-center text-meta`,children:[`No citizens yet. Ask the concierge for one, or add one with`,` `,(0,P.jsx)(`code`,{className:`font-mono text-fg-secondary`,children:`stellaris agent add`}),`.`]}):null,(0,P.jsx)(`ul`,{className:`sr-only`,"aria-label":`Tasks in play`,children:Fe.tasks.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,onFocus:()=>le(`task:${e.id}`),onBlur:()=>le(null),onClick:()=>Ze(e.id),children:ks(e,Ue(e.project))})},e.id))}),(0,P.jsx)(`ul`,{className:`sr-only`,"aria-label":`Citizens`,children:Fe.stars.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,onFocus:()=>le(e.id),onBlur:()=>le(null),onClick:()=>Ye(e.id),children:[e.name,`, `,e.state,e.state===`working`?` at ${Ue(e.anchor)}`:``]})},e.id))})]})})})})}var Gc=`modulepreload`,Kc=function(e){return`/`+e},qc={},Jc=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Kc(t,n),t=s(t),t in qc)return;qc[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Gc,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Yc(){return null}var Xc=Bi({component:Wc}),Zc=ia({routeTree:Xc.addChildren([Ri({getParentRoute:()=>Xc,path:`/`,component:Yc}),Ri({getParentRoute:()=>Xc,path:`/c/$`,component:Vi(()=>Jc(()=>import(`./ChannelView-DXoJ5w3z.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),`ChannelView`)}),Ri({getParentRoute:()=>Xc,path:`/thread/$threadId`,component:Vi(()=>Jc(()=>import(`./ThreadView-CMwiVZFq.js`),__vite__mapDeps([13,1,2,3,6,4,9,7,8,10,11,12,14])),`ThreadView`)}),Ri({getParentRoute:()=>Xc,path:`/society`,component:Vi(()=>Jc(()=>import(`./SocietyView-DEeUo4wb.js`),__vite__mapDeps([15,1,2,3,5,6,4,10,16,17,18])),`SocietyView`)}),Ri({getParentRoute:()=>Xc,path:`/p/$slug`,component:Vi(()=>Jc(()=>import(`./ProjectView-CScK4F7F.js`),__vite__mapDeps([19,1,2,3,6,8,4,5,9,10,16,17,18])),`ProjectView`)}),Ri({getParentRoute:()=>Xc,path:`/knowledge/$scope/$topic`,component:Vi(()=>Jc(()=>import(`./KnowledgeView-BXLj85OH.js`),__vite__mapDeps([20,1,2,3,6,4,9,10,14])),`KnowledgeView`)}),Ri({getParentRoute:()=>Xc,path:`/p/$slug/tasks`,component:Vi(()=>Jc(()=>import(`./TasksView-CJbJt5dM.js`),__vite__mapDeps([21,1,6,8,10])),`TasksView`)}),Ri({getParentRoute:()=>Xc,path:`/task/$taskId`,component:Vi(()=>Jc(()=>import(`./TaskView-yVpUG83f.js`),__vite__mapDeps([22,1,2,3,6,8,23,4,9,10,14,24,7])),`TaskView`)}),Ri({getParentRoute:()=>Xc,path:`/task/$taskId/files/$`,validateSearch:e=>{let t=Number(e.line);return Number.isInteger(t)&&t>0?{line:t}:{}},component:Vi(()=>Jc(()=>import(`./TaskFileView-DQC_ZUdY.js`),__vite__mapDeps([25,1,6,9,3,10,14])),`TaskFileView`)}),Ri({getParentRoute:()=>Xc,path:`/metrics`,validateSearch:e=>{let t=Fe.safeParse(e.window);return t.success?{window:t.data}:{}},component:Vi(()=>Jc(()=>import(`./MetricsView-_h2TWeo8.js`),__vite__mapDeps([26,1,6,10,16,17,18])),`MetricsView`)}),Ri({getParentRoute:()=>Xc,path:`/citizens`,component:Vi(()=>Jc(()=>import(`./CitizensView-Dbo47F82.js`),__vite__mapDeps([27,1,6,17,10,18])),`CitizensView`)}),Ri({getParentRoute:()=>Xc,path:`/needs-you`,component:Vi(()=>Jc(()=>import(`./NeedsYouView-BI1-_bYI.js`),__vite__mapDeps([28,1,6,23,8,10])),`NeedsYouView`)}),Ri({getParentRoute:()=>Xc,path:`/runners`,validateSearch:e=>typeof e.code==`string`?{code:e.code}:{},component:Vi(()=>Jc(()=>import(`./RunnersView-9E2qUSO5.js`),__vite__mapDeps([29,1,2,3,17,4,10])),`RunnersView`)}),Ri({getParentRoute:()=>Xc,path:`/crons`,validateSearch:e=>typeof e.agent==`string`?{agent:e.agent}:{},component:Vi(()=>Jc(()=>import(`./CronsView-DYx7dQcr.js`),__vite__mapDeps([30,1,2,3,6,17,4,9,10,18])),`CronsView`)}),Ri({getParentRoute:()=>Xc,path:`/proposals`,component:Vi(()=>Jc(()=>import(`./ProposalsView-DSi2u6qO.js`),__vite__mapDeps([31,1,6,23,8,10])),`ProposalsView`)}),Ri({getParentRoute:()=>Xc,path:`/proposal/$proposalId`,component:Vi(()=>Jc(()=>import(`./ProposalView-BQ1rflqo.js`),__vite__mapDeps([32,1,2,3,6,17,8,23,4,9,10,14,31,24,7])),`ProposalView`)}),Ri({getParentRoute:()=>Xc,path:`/citizen/$name`,validateSearch:e=>({...typeof e.scope==`string`?{scope:e.scope}:{},...e.tab===`turns`||e.tab===`memory`||e.tab===`history`?{tab:e.tab}:{},...typeof e.turn==`string`?{turn:e.turn}:{}}),component:Vi(()=>Jc(()=>import(`./CitizenView-yOnQtNz4.js`),__vite__mapDeps([33,1,2,3,6,17,4,9,10,12,18])),`CitizenView`)})])});function Qc({signInError:e}){let t=ve(),[n,r]=(0,j.useState)(_),i=(0,j.useCallback)(()=>{d(),t.clear(),r(null)},[t]),a=(0,j.useCallback)(()=>{n!==null&&ie(n).signOut().catch(()=>void 0),i(),Zc.navigate({to:`/`})},[n,i]),o=(0,j.useMemo)(()=>n===null?null:{api:ie(n),token:n,signOut:a,expire:i},[n,a,i]);return o===null?(0,P.jsx)(fa,{initialError:e,onEnter:e=>{l(e),r(e)}}):(0,P.jsx)(A,{value:o,children:(0,P.jsx)(sa,{router:Zc})})}var $c={expired:`The sign-in took too long or was already used. Try again.`,declined:`GitHub sign-in was cancelled.`,github:`GitHub could not confirm who signed in. Try again.`,"not-allowed":`That GitHub account is not allowed on this board.`};function el(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`session`),r=t.get(`signin-error`);return n===null&&r===null?null:{token:n===null||n===``?null:n,error:r===null?null:$c[r]??`GitHub sign-in failed.`}}function tl(){let e=el(window.location.hash);return e!==null&&(e.token!==null&&l(e.token),window.history.replaceState(window.history.state,``,`${window.location.pathname}${window.location.search}`)),e}var nl=new Rt({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),rl=tl(),il=document.getElementById(`root`);if(il===null)throw Error(`missing #root element`);(0,F.createRoot)(il).render((0,P.jsx)(j.StrictMode,{children:(0,P.jsx)($e,{client:nl,children:(0,P.jsx)(Qc,{signInError:rl?.error??null})})}));export{ya as C,ca as D,xa as E,Fi as O,Na as S,va as T,Za as _,Vo as a,Ka as b,no as c,To as d,lo as f,Xa as g,ko as h,R as i,Pi as k,Eo as l,ro as m,bs as n,Ho as o,So as p,Os as r,Wo as s,ws as t,to as u,Ja as v,ba as w,L as x,Ha as y};
|
|
23
|
+
`).map(e=>e.trim()).find(e=>e.length>0)??``}function mo(e){return/^\/bin\/(?:ba)?sh -lc (["'])([\s\S]*)\1$/.exec(e.trim())?.[2]??e}function ho(e){return typeof e==`object`&&e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):{}}var go=[`file_path`,`path`,`url`,`query`,`pattern`,`description`,`prompt`];function _o(e){let t=ho(e),n=t.command;if(typeof n==`string`){let e=mo(n);return{summary:uo(fo(e),ao),detail:uo(e,oo)}}let r=uo(JSON.stringify(e??null,null,2),oo),i=t.changes;if(Array.isArray(i))return{summary:uo(i.map(e=>ho(e).path).filter(e=>typeof e==`string`).join(`, `),ao),detail:r};let a=go.map(e=>t[e]).find(e=>typeof e==`string`&&e.trim()!==``),o=Object.values(t).filter(e=>typeof e==`string`||typeof e==`number`);return{summary:uo(fo(a??o.slice(0,3).join(` · `)),ao),detail:r}}var vo=`StructuredOutput`;function yo(e,t){try{return ho(JSON.parse(e)).summary===t}catch{return!1}}function bo(e,t,n){let r=[...e.steps,t],i=r.length-n;return{...e,steps:i>0?r.slice(i):r,fromStart:e.fromStart&&i<=0,lastAt:t.at}}function xo(e,t,{maxSteps:n}={maxSteps:io}){let{event:r}=t,i=to(t.agent,t.project,t),a=e.get(i),o=new Map(e),s={agent:t.agent,scope:t.project,...t.thread===void 0?{}:{thread:t.thread},...t.channel===void 0?{}:{channel:t.channel}};if(r.type===`turn_started`)return o.set(i,{...s,startedAt:t.ts,fromStart:!0,model:r.model??null,steps:[],lastAt:t.ts,end:null}),o;let c=a!==void 0&&a.end===null?a:{...s,startedAt:t.ts,fromStart:!1,model:null,steps:[],lastAt:t.ts,end:null};switch(r.type){case`text`:o.set(i,bo(c,{kind:`say`,seq:t.seq,at:t.ts,text:r.delta},n));break;case`tool_call`:if(r.name===vo)break;o.set(i,bo(c,{kind:`tool`,seq:t.seq,at:t.ts,name:r.name,..._o(r.input),ok:null,output:null},n));break;case`tool_result`:{let e=c.steps.findIndex(e=>e.kind===`tool`&&e.name===r.name&&e.ok===null),n=c.steps[e];if(n?.kind===`tool`){let a=c.steps.with(e,{...n,ok:r.ok,output:r.output??null});o.set(i,{...c,steps:a,lastAt:t.ts})}break}case`error`:o.set(i,bo(c,{kind:`error`,seq:t.seq,at:t.ts,message:r.message},n));break;case`steered`:o.set(i,bo(c,{kind:`steer`,seq:t.seq,at:t.ts,...co(r.text??``)},n));break;case`turn_completed`:{let e=r.status?.summary??null,n=c.steps.at(-1),a=n?.kind===`say`&&e!==null&&yo(n.text,e);o.set(i,{...c,steps:a?c.steps.slice(0,-1):c.steps,lastAt:t.ts,end:{at:t.ts,exitReason:r.exitReason,summary:e}});break}}return o}function So(e,t,n,r={}){let i=new Map;for(let[a,o]of e.entries())i=xo(i,{seq:a+1,ts:o.ts,agent:t,project:n,...r.thread===void 0?{}:{thread:r.thread},...r.channel===void 0?{}:{channel:r.channel},event:o.event},{maxSteps:1/0});return i.get(to(t,n,r))}function Co(e,t){if(lo(e)!==`post_message`)return null;let n=ho(t).body,r=typeof n==`string`?po(n).replace(/^[#>*\-\s]+/,``):``;return r===``?null:uo(r,ao)}function wo(e){let t=e.steps.at(-1);return t===void 0?null:t.kind===`tool`?`${lo(t.name)} · ${t.summary}`:t.kind===`steer`?`took ${To(t.posts.length)}${t.from.length===0?``:` from ${t.from.join(`, `)}`}`:uo(po(t.kind===`say`?t.text:t.message),ao)}function To(e){return e===1?`1 post`:`${e} posts`}function Eo(e,t){return Le(t-Date.parse(e))}var Do=class{turns=new Map;listeners=new Set;eventListeners=new Set;subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});snapshot=()=>this.turns;listen=e=>(this.eventListeners.add(e),()=>{this.eventListeners.delete(e)});follow(e){return eo({token:e,url:()=>`/api/turns/stream?since=0`,onOpen:()=>{this.turns=new Map,this.emit()},onData:e=>{let t=Ue.safeParse(JSON.parse(e));if(t.success){this.turns=xo(this.turns,t.data);for(let e of this.eventListeners)e(t.data)}},onBatch:()=>this.emit()})}emit(){for(let e of this.listeners)e()}},Oo=(0,j.createContext)(null);function ko(){let e=(0,j.useContext)(Oo);if(e===null)throw Error(`useLiveTurns needs a LiveContext`);return(0,j.useSyncExternalStore)(e.subscribe,e.snapshot)}function Ao({activeCitizen:e,activeScope:t}){let n=s(),r=he(),i=ko(),a=Ja(),o=_e(5e3),c=ce(n.data?.running??[]),l=n.data?.pending.length??0;return(0,P.jsxs)(`section`,{"aria-label":`Working now`,className:`mt-3`,children:[(0,P.jsxs)(`h3`,{className:`flex items-center justify-between px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[(0,P.jsx)(`span`,{children:`Working now`}),l>0?(0,P.jsxs)(`span`,{className:`font-normal tracking-normal normal-case`,children:[l,` queued`]}):null]}),c.length===0?(0,P.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`Nobody is in a turn.`}):(0,P.jsx)(`ul`,{children:c.map(({agent:n,scope:s,thread:c,channel:l})=>{let u=i.get(to(n,s,{thread:c,channel:l})),d=u!==void 0&&u.end===null,f=r.data?.find(e=>e.name===n)?.cli??null,p=d?wo(u):null,m=no({scope:s,thread:c,channel:l}),h=n===e&&(t===null||t===m||t===s),g=s===`society`?`society`:s,_=c===void 0?l===void 0?null:`#${l}`:a.get(c)?.title??`a thread`;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/citizen/$name`,params:{name:n},search:{scope:m},className:`block rounded-lg px-2 py-1.5 transition-colors ${h?`bg-surface-2/80 text-fg-primary`:`text-fg-secondary hover:bg-surface-2/50 hover:text-fg-primary`}`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,P.jsxs)(`span`,{className:`relative grid size-4 shrink-0 place-items-center`,children:[f===null?null:(0,P.jsx)(Dt,{cli:f,size:13}),(0,P.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 size-1.5 animate-pulse rounded-full bg-emerald-400`})]}),(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:_===null?g:`${g} · ${_}`}),d?(0,P.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,children:[u.fromStart?``:`≥ `,Eo(u.startedAt,o)]}):null]}),(0,P.jsx)(`span`,{className:`mt-0.5 block truncate pl-5.5 text-[11px] text-fg-muted`,children:p===null?`Starting…`:(0,P.jsx)(Za,{text:p,links:!1})})]})},m===s?`${n}/${s}`:`${n}/${m}`)})})]})}var jo=`flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors`;function Mo(e){return`block truncate rounded-md px-2 text-[11px] font-semibold tracking-wider uppercase transition-colors ${e?`text-fg-primary`:`text-fg-muted hover:text-fg-primary`}`}var No=`bg-surface-2/80 text-fg-primary`,Po=`text-fg-secondary hover:bg-surface-2/50 hover:text-fg-primary`;function Fo({slug:e,active:t}){let n=(p(e).data??[]).filter(Ot).length;return(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/p/$slug/tasks`,params:{slug:e},className:`${jo} ${t?No:Po}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`tasks`}),n>0?(0,P.jsx)(`span`,{title:`${n} tasks in play`,className:`rounded-md bg-surface-2/70 px-1.5 text-[11px] text-fg-tertiary`,children:n}):null]})})}function Io({value:e,title:t}){return e===0?null:(0,P.jsx)(`span`,{title:t,className:`rounded-md bg-amber-500/15 px-1.5 text-[11px] text-amber-300`,children:e})}function Lo({active:e}){let t=(i().data??[]).filter(Pt).length,n=L().length;return(0,P.jsxs)(`section`,{"aria-label":`Governance`,className:`mt-3`,children:[(0,P.jsx)(`h3`,{className:`px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:`Governance`}),(0,P.jsxs)(`ul`,{children:[(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/needs-you`,className:`${jo} ${e===`needs-you`?No:Po}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◉`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`needs you`}),(0,P.jsx)(Io,{value:n,title:`${n} waiting on you`})]})}),(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/proposals`,className:`${jo} ${e===`proposals`?No:Po}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◈`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`proposals`}),(0,P.jsx)(Io,{value:t,title:`${t} waiting on you`})]})})]})]})}function Ro({activeChannel:e,activeTasks:t,activeCitizen:n,activeScope:r,activeGovernance:i,activeOverview:a}){let o=be(),s=Xe(),c=y(),l=ja();(0,j.useEffect)(()=>{o.data!==void 0&&Ma(o.data.map(e=>[e.ref,e.lastMessageId]))},[o.data]);let u=(0,j.useMemo)(()=>(s.data??[]).toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt)||e.slug.localeCompare(t.slug)),[s.data]),d=u.filter(e=>e.archived!==void 0),f=(0,j.useMemo)(()=>{let e=(o.data??[]).filter(e=>e.archived===void 0);return[{key:`society`,label:`Society`,project:null,channels:e.filter(e=>e.project===null)},...u.filter(e=>e.archived===void 0).map(t=>({key:t.slug,label:t.name,project:t.slug,channels:e.filter(e=>e.project===t.slug)}))]},[o.data,u]),p=(0,j.useMemo)(()=>{let e=new Map;for(let t of c.data??[])t.state===`open`&&e.set(t.channel,(e.get(t.channel)??0)+1);return e},[c.data]);return(0,P.jsxs)(Ca,{label:`Board navigator`,className:`top-[72px] bottom-4 left-4 w-64`,children:[(0,P.jsxs)(`header`,{className:`flex items-center justify-between px-4 pt-4 pb-1`,children:[(0,P.jsx)(`span`,{className:`text-caps`,children:`Board`}),(0,P.jsx)(wt,{to:`/`,"aria-label":`Close the board`,className:`grid size-7 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`✕`})]}),(0,P.jsxs)(`nav`,{className:`flex-1 overflow-y-auto px-2 pb-3`,children:[(0,P.jsx)(Ao,{activeCitizen:n,activeScope:r}),(0,P.jsx)(Lo,{active:i}),f.map(n=>(0,P.jsxs)(`section`,{className:`mt-3`,children:[(0,P.jsx)(`h3`,{className:`pb-1`,children:n.project===null?(0,P.jsx)(wt,{to:`/society`,className:Mo(a===n.key),children:n.label}):(0,P.jsx)(wt,{to:`/p/$slug`,params:{slug:n.project},className:Mo(a===n.key),children:n.label})}),(0,P.jsxs)(`ul`,{children:[n.channels.map(t=>{let n=t.ref===e,r=p.get(t.ref)??0,i=!n&&Pa(l,t.ref,t.lastMessageId);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/c/$`,params:{_splat:t.ref},className:`${jo} ${n?No:Po}`,children:[(0,P.jsx)(`span`,{className:`text-fg-muted`,children:`#`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate ${i?`font-semibold`:``}`,children:t.name}),r>0?(0,P.jsx)(`span`,{title:`${r} open threads`,className:`rounded-md bg-surface-2/70 px-1.5 text-[11px] text-fg-tertiary`,children:r}):null,i?(0,P.jsx)(`span`,{"aria-label":`new messages`,className:`size-1.5 rounded-full bg-emerald-400`}):null]})},t.ref)}),n.project===null?null:(0,P.jsx)(Fo,{slug:n.project,active:n.project===t})]})]},n.key)),d.length===0?null:(0,P.jsxs)(`section`,{"aria-label":`Archived projects`,className:`mt-3`,children:[(0,P.jsx)(`h3`,{className:`px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:`Archived`}),(0,P.jsx)(`ul`,{children:d.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/p/$slug`,params:{slug:e.slug},className:`${jo} ${a===e.slug?No:Po}`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`▫`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]})},e.slug))})]})]})]})}var zo=(0,j.createContext)(void 0);function Bo(e,t){let n=new URL(e);return n.searchParams.set(n.hostname===`github.com`?`size`:`s`,String(t)),n.href}function Vo({name:e,members:t}){let n=(0,j.useContext)(zo),r=t?.find(t=>t.name===e)?.cli??null;return r===null?e===`user`&&n!==void 0?(0,P.jsx)(`img`,{src:Bo(n.avatarUrl,56),alt:``,width:28,height:28,referrerPolicy:`no-referrer`,className:`size-7 shrink-0 rounded-lg bg-surface-2/80 object-cover`}):e===`user`?(0,P.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-fg-primary/90 text-[10px] font-semibold text-surface-0`,children:`you`}):(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface-2/50 text-xs text-fg-muted`,children:`✦`}):(0,P.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface-2/80`,children:(0,P.jsx)(Dt,{cli:r,size:16})})}function Ho({name:e,members:t}){let n=t?.find(t=>t.name===e)?.cli??null;return(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 align-middle`,children:[n===null?null:(0,P.jsx)(Dt,{cli:n,size:12}),(0,P.jsx)(`span`,{className:`text-fg-secondary`,children:e})]})}function Uo(e,t){return e===`user`?t?.login??`you`:e}function Wo(){let e=(0,j.useContext)(zo);return t=>Uo(t,e)}var Go=6;function R({target:e,placeholder:t,initialText:r=``,oneLine:i=!1,className:a=`border-t border-line p-3`,focusOnOpen:o=!1,onPosted:c,onEmptyEscape:l}){let{api:u}=De(),d=ve(),f=he(),p=ne(),m=s(),[h,g]=(0,j.useState)(r),[_,v]=(0,j.useState)(0),[y,b]=(0,j.useState)(0),[x,S]=(0,j.useState)(!1),C=(0,j.useRef)(null),w=(0,j.useRef)(null),T=at({mutationFn:async t=>{if(`channel`in e)return u.sendMessage({channel:e.channel,body:t});if(`threadId`in e)return u.sendMessage({thread_id:e.threadId,body:t});let n=await u.openThread({channel:Re,title:ha(t)});return u.sendMessage({thread_id:n.id,body:t})},onSuccess:t=>{g(r),d.invalidateQueries({queryKey:t.thread===void 0?[`channel`,t.channel]:[`thread`,t.thread]}),`ask`in e&&d.invalidateQueries({queryKey:[`threads`]}),d.invalidateQueries({queryKey:[`requests`]}),c?.(t)}});(0,j.useEffect)(()=>{o&&C.current?.focus()},[o]),(0,j.useLayoutEffect)(()=>{let e=C.current;e!==null&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,w.current!==null&&(e.setSelectionRange(w.current,w.current),w.current=null))});let E=x?null:ct(h,_),ee=(f.data??[]).filter(e=>e.status===`active`&&e.cli!==null),te=E===null?[]:ee.filter(e=>e.name.startsWith(E.prefix)).slice(0,Go),re=st(h,f.data??[],p.data??[]),ie=`ask`in e?[]:it(re,f.data??[],m.data?.turns??[],`channel`in e?{channel:e.channel}:{thread:e.threadId}),ae=nt(ie,re.filter(e=>!ie.includes(e))),oe=e=>{if(E===null)return;let t=ut(h,_,E.start,e);w.current=t.caret,g(t.text),v(t.caret)},se=()=>{h.trim()!==``&&h.trim()!==r.trim()&&!T.isPending&&T.mutate(h.trim())},ce=e=>{if(te.length>0){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:te.length-1;b((y+t)%te.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),oe(te[Math.min(y,te.length-1)]?.name??``);return}if(e.key===`Escape`){e.preventDefault(),S(!0);return}}if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){e.preventDefault(),se();return}e.key===`Escape`&&h===``&&l!==void 0&&(e.preventDefault(),l())},le=(0,P.jsx)(lt,{variant:`primary`,type:`submit`,disabled:h.trim()===``||h.trim()===r.trim()||T.isPending,children:T.isPending?`Sending…`:`Send`});return(0,P.jsxs)(`form`,{className:a,onSubmit:e=>{e.preventDefault(),se()},children:[(0,P.jsxs)(`div`,{className:`relative rounded-xl bg-surface-2/50 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] focus-within:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.16)] ${i?`flex items-end gap-2 pr-1.5`:``}`,children:[te.length>0?(0,P.jsx)(`ul`,{"aria-label":`Citizens to mention`,className:`card absolute bottom-full left-2 mb-2 w-60 overflow-hidden py-1`,children:te.map((e,t)=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),oe(e.name)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${t===y?`bg-surface-2 text-fg-primary`:`text-fg-secondary`}`,children:[e.cli===null?null:(0,P.jsx)(Dt,{cli:e.cli,size:14}),(0,P.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),(0,P.jsx)(`span`,{className:`truncate font-mono text-[11px] text-fg-muted`,children:e.role})]})},e.name))}):null,(0,P.jsx)(`textarea`,{ref:C,rows:1,value:h,placeholder:t,"aria-label":t,onChange:e=>{g(e.target.value),v(e.target.selectionStart),b(0),S(!1)},onSelect:e=>v(e.currentTarget.selectionStart),onKeyDown:ce,className:`block max-h-48 w-full resize-none bg-transparent px-3 text-sm text-fg-primary outline-none placeholder:text-fg-muted ${i?`py-2.5`:`pt-2.5 pb-1`}`}),i?(0,P.jsx)(`div`,{className:`shrink-0 pb-1.5`,children:le}):(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-2`,children:[(0,P.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:ae??`Enter to send · Shift+Enter for a new line`}),le]})]}),T.error===null?null:(0,P.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-red-400`,children:T.error instanceof n?T.error.message:`The message was not sent.`})]})}var z=5;function Ko(e,t,n){switch(e.kind){case`answering`:return{text:`${ot(e.who)} ${e.who.length===1?`is`:`are`} answering…`,tone:`text-emerald-300`};case`queued`:return{text:`${ot(e.who)} will answer next`,tone:`text-amber-300`};case`waiting`:return{text:`waiting for an answer`,tone:`text-fg-muted`};case`answered`:return{text:`answered by ${n(e.by)}`,tone:`text-fg-secondary`}}let r=je(t.body,160);return{text:`closed by ${n(e.by??`board`)}${r===``?``:` · ${r}`}`,tone:`text-fg-muted`}}function qo({left:e,width:t,onClose:n}){let r=y(),i=s(),a=ja(),o=_e(3e4),c=Wo(),l=(0,j.useRef)(null),u=ma(r.data??[]).slice(0,z),d=ce(i.data?.running??[]),f=ce(i.data?.pending??[]);return(0,j.useEffect)(()=>{let e=e=>{e.target instanceof Node&&l.current?.contains(e.target)===!1&&n()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[n]),(0,P.jsxs)(`section`,{ref:l,"aria-label":`Ask`,className:`absolute top-[26%] z-30 flex flex-col gap-2`,style:{left:e,width:t},children:[(0,P.jsx)(`div`,{className:Sa,children:(0,P.jsx)(R,{target:{ask:!0},placeholder:`Ask the front desk`,oneLine:!0,className:`p-2`,focusOnOpen:!0,onEmptyEscape:n})}),u.length===0?null:(0,P.jsx)(`ol`,{"aria-label":`Your asks`,className:`${Sa} max-h-[40vh] overflow-y-auto py-1`,children:u.map(e=>{let t=Ko(ga(e,d,f),e,c),n=_a(e,a);return(0,P.jsx)(`li`,{children:(0,P.jsxs)(wt,{to:`/thread/$threadId`,params:{threadId:e.id},className:`block px-4 py-2 transition-colors hover:bg-surface-2/50`,children:[(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary ${n?`font-semibold`:``}`,children:e.title}),n?(0,P.jsx)(`span`,{"aria-label":`new answer`,className:`size-1.5 shrink-0 rounded-full bg-emerald-400`}):null,(0,P.jsx)(`time`,{dateTime:e.openedAt,className:`shrink-0 text-meta`,children:Ve(e.openedAt,o)})]}),(0,P.jsx)(`span`,{className:`mt-0.5 block truncate text-xs ${t.tone}`,children:t.text})]})},e.id)})})]})}function Jo({unread:e,onOpen:t}){let n=Wo(),[r]=e,i=r===void 0?null:e.length===1?`${n(r.lastAuthor??`board`)} answered “${r.title}”`:`${e.length} new answers`;return(0,P.jsxs)(`button`,{type:`button`,onClick:t,className:`pointer-events-auto flex max-w-full min-w-0 items-center gap-2 rounded-full px-3 py-1.5 text-meta transition-colors hover:text-fg-secondary`,children:[i===null?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 shrink-0 rounded-full bg-emerald-400`}),(0,P.jsx)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:i}),(0,P.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}),(0,P.jsx)(`kbd`,{className:`shrink-0 rounded border border-line px-1.5 font-sans text-[11px] text-fg-secondary`,children:`Space`}),(0,P.jsx)(`span`,{className:`shrink-0`,children:`to ask`})]})}var Yo={working:{label:`working`,style:`bg-emerald-500/15 text-emerald-300`},queued:{label:`queued`,style:`bg-amber-500/15 text-amber-300`},idle:{label:`resting`,style:`bg-surface-2 text-fg-tertiary`}};function Xo(e,t,n,r){return t.state===`working`?`In a turn at ${n}`:t.state===`queued`?`Queued for ${n}`:e.lastTurnAt===void 0?`No turns yet`:`Last turn ${Ve(e.lastTurnAt,r)}`}function Zo({member:e,star:t,place:n,now:r}){let i=e.lastModel??e.model,a=Yo[t.state];return(0,P.jsxs)(`article`,{className:`card w-72 p-3.5`,"aria-label":`${e.name}, ${e.role}`,children:[(0,P.jsxs)(`header`,{className:`flex items-center gap-3`,children:[(0,P.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-md bg-surface-2/70`,children:(0,P.jsx)(Dt,{cli:t.cli,size:18})}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`h2`,{className:`text-title truncate`,children:e.name}),(0,P.jsxs)(`p`,{className:`truncate text-meta`,children:[e.role,i===void 0?``:` · ${i}`]})]}),(0,P.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${a.style}`,children:a.label})]}),(0,P.jsx)(`p`,{className:`mt-2.5 text-sm text-fg-secondary`,children:Xo(e,t,n,r)})]})}function Qo({society:e,citizens:t,citizensOpen:n,onToggleCitizens:r,runnersOpen:i,onToggleRunners:a,enrolling:o,cronsOpen:s,onToggleCrons:c,failingCrons:l,attention:u,onOpenAttention:d,paused:f,onTogglePause:p,pauseBusy:m,boardOpen:h,onToggleBoard:g,metricsOpen:_,onToggleMetrics:v,logsOpen:y,onToggleLogs:b,onSignOut:x}){return(0,P.jsxs)(`header`,{className:`pointer-events-none absolute inset-x-0 top-0 flex items-start justify-between p-5`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,P.jsx)(`span`,{className:`text-display`,children:`Stellaris`}),e===void 0?null:(0,P.jsx)(`span`,{className:`text-meta`,children:e})]}),(0,P.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2`,children:[u===0?null:(0,P.jsxs)(`button`,{type:`button`,onClick:d,className:`card inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs text-amber-300 transition-colors hover:text-amber-200 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,P.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-amber-300`}),u,` `,u===1?`needs`:`need`,` you`]}),(0,P.jsx)(`button`,{type:`button`,"aria-pressed":f,disabled:m,onClick:p,title:f?`Nobody takes a turn until you resume; wakes wait in the queue.`:`Stop dispatching turns. Running turns finish; new wakes wait.`,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none disabled:opacity-50 ${f?`text-amber-300 hover:text-amber-200`:`text-fg-tertiary hover:text-fg-primary`}`,children:f?`Paused · resume`:`Pause`}),(0,P.jsx)(`button`,{type:`button`,"aria-pressed":n,onClick:r,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${n?`text-fg-primary`:`text-fg-tertiary hover:text-fg-primary`}`,children:t===1?`1 citizen`:`${t} citizens`}),(0,P.jsxs)(`button`,{type:`button`,"aria-pressed":i,"aria-label":o===0?`Runners`:`Runners, ${o} waiting for approval`,onClick:a,className:`card inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${i?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:[`Runners`,o===0?null:(0,P.jsx)(`span`,{className:`rounded bg-amber-500/15 px-1 text-[11px] text-amber-300`,children:o})]}),(0,P.jsxs)(`button`,{type:`button`,"aria-pressed":s,"aria-label":l===0?`Crons`:`Crons, ${l} failing`,onClick:c,className:`card inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${s?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:[`Crons`,l===0?null:(0,P.jsx)(`span`,{className:`rounded bg-amber-500/15 px-1 text-[11px] text-amber-300`,children:l})]}),(0,P.jsx)(`button`,{type:`button`,"aria-pressed":h,onClick:g,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${h?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Board`}),(0,P.jsx)(`button`,{type:`button`,"aria-pressed":_,onClick:v,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${_?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Metrics`}),(0,P.jsx)(`button`,{type:`button`,"aria-expanded":y,onClick:b,className:`card inline-flex h-7 items-center rounded-md px-2.5 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none ${y?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Logs`}),(0,P.jsx)(`button`,{type:`button`,onClick:x,className:`h-7 rounded-md px-2.5 text-xs text-fg-tertiary transition-colors hover:bg-surface-2/60 hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:`Sign out`})]})]})}var $o=new Set(h),B={waiting_stage:`stage waiting`,backlog:`backlog`,role_gap:`role gap`,churn:`churn`,stale_thread:`stale thread`,idle_member:`idle member`,blocked_capability:`missing capability`,turn_cost:`spend`,scaled:`replica added`,runner:`runner`,home_conflict:`edits to reconcile`,stuck_workspace:`work left on no branch`,cron_failing:`cron failing`};function es(e){return $o.has(e)}function ts(e,t){let n=new Set(t),r=new Map;for(let t of e)n.has(t.signal.key)&&r.set(t.signal.key,t.id);return new Set(r.values())}function ns(e){return[e.project??``,e.agent??``,e.role===void 0?``:`role ${e.role}`,es(e.kind)?`wakes the steward`:``].filter(e=>e.length>0)}function rs({onClose:e}){let n=t(!0),r=s(),i=_e(3e4),a=n.data??[],o=ts(a,r.data?.signals??[]);return(0,P.jsxs)(Ca,{label:`Operations log`,className:`top-[72px] right-4 z-20 max-h-[min(70vh,640px)]`,style:{width:400},children:[(0,P.jsxs)(`header`,{className:`flex items-start gap-3 border-b border-line px-4 py-3`,children:[(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`h2`,{className:`text-heading`,children:`Operations log`}),(0,P.jsx)(`p`,{className:`mt-0.5 text-meta`,children:`What the scheduler measured. Only kinds that wake the steward start a turn; it reads the rest at its next one.`})]}),(0,P.jsx)(`button`,{type:`button`,"aria-label":`Close the log`,onClick:e,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:`×`})]}),a.length===0?(0,P.jsx)(`p`,{className:`px-4 py-4 text-meta`,children:n.data===void 0?`Reading the log…`:`Nothing measured yet.`}):(0,P.jsx)(`ol`,{className:`flex-1 overflow-y-auto`,children:a.toReversed().map(({id:e,ts:t,signal:n})=>{let r=es(n.kind),a=ns(n);return(0,P.jsxs)(`li`,{className:`border-b border-line/60 px-4 py-2.5 last:border-b-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(`span`,{className:`rounded-md px-1.5 py-px text-[11px] ${r?`bg-amber-500/15 text-amber-300`:`bg-surface-2 text-fg-tertiary`}`,children:B[n.kind]}),o.has(e)?(0,P.jsx)(`span`,{className:`text-[11px] text-emerald-300`,children:`holds now`}):null,(0,P.jsx)(`time`,{dateTime:t,title:t,className:`ml-auto shrink-0 text-meta`,children:Ve(t,i)})]}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:(0,P.jsx)(Za,{text:n.summary})}),a.length===0&&n.taskId===void 0?null:(0,P.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[a.join(` · `),n.taskId===void 0?null:(0,P.jsxs)(P.Fragment,{children:[a.length===0?``:` · `,(0,P.jsx)(wt,{to:`/task/$taskId`,params:{taskId:n.taskId},className:`text-fg-tertiary underline-offset-2 hover:text-fg-primary hover:underline`,children:`the task`})]})]})]},e)})})]})}var is=32;function as(e,t){return t.width+t.x-e.clientX}function os({width:e,min:t,max:n,onResize:r,onToggle:i}){let a=(0,j.useRef)(null),o=t=>{t.button===0&&(t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),a.current={x:t.clientX,width:e})},s=e=>{a.current!==null&&r(as(e,a.current),!1)},c=e=>{a.current!==null&&(r(as(e,a.current),!0),a.current=null)};return(0,P.jsx)(`button`,{type:`button`,"aria-label":`Width of the board's content, ${e} of at most ${n} pixels: drag or use the arrow keys, Enter widens it all the way or back`,title:`Drag to resize. Double-click to widen it all the way, or back.`,onPointerDown:o,onPointerMove:s,onPointerUp:c,onPointerCancel:c,onClick:e=>{e.detail===0&&i()},onDoubleClick:i,onKeyDown:i=>{let a=i.key===`ArrowLeft`?e+is:i.key===`ArrowRight`?e-is:i.key===`Home`?t:i.key===`End`?n:null;a!==null&&(i.preventDefault(),r(a,!0))},className:`absolute inset-y-0 left-0 z-10 w-2 cursor-col-resize touch-none before:absolute before:inset-y-4 before:left-0.5 before:w-0.5 before:rounded-full before:transition-colors hover:before:bg-fg-muted/60 focus-visible:outline-none focus-visible:before:bg-fg-primary/60 active:before:bg-fg-primary/60`})}function ss({mark:e,project:t,members:n}){let r=n?.find(t=>t.name===e.holder)?.cli??null,i=Mt.find(t=>t.phase===e.phase)?.label??e.phase;return(0,P.jsxs)(`article`,{className:`card w-72 p-4`,"aria-label":`Task ${e.title}`,children:[(0,P.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,P.jsx)(`h2`,{className:`text-title min-w-0 flex-1`,children:e.title}),(0,P.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${kt[e.phase]}`,children:i.toLowerCase()})]}),(0,P.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:[(0,P.jsx)(`dt`,{className:`text-fg-muted`,children:`Project`}),(0,P.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:t}),(0,P.jsx)(`dt`,{className:`text-fg-muted`,children:`Stage`}),(0,P.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:e.stage}),e.holder===null?e.waitingFor===null?null:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`dt`,{className:`text-fg-muted`,children:`Waiting for`}),(0,P.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:e.waitingFor})]}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(`dt`,{className:`text-fg-muted`,children:`Held by`}),(0,P.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-1 text-fg-secondary`,children:[r===null?null:(0,P.jsx)(Dt,{cli:r,size:12}),e.holder,e.linked===null?` · resting`:` · in a turn on it`]})]})]})]})}function cs(e,t){let n=`latest`;return eo({token:e,url:()=>`/api/events/stream?since=${n}`,onData:e=>{let r=Se.parse(JSON.parse(e));n=r.id,t.onEvent(r)},onOpen:e=>{e&&t.onResume()}})}function V(e){return typeof e==`string`?e:void 0}function ls(e){let{type:t,payload:n,actor:r}=e;if(t===`message.posted`){let e=V(n.thread);return e===void 0?[[`channels`],[`channel`,V(n.channel)],[`requests`]]:[[`threads`],[`thread`,e],[`requests`]]}return t.startsWith(`thread.`)?[[`threads`],[`thread`,V(n.threadId)],[`channel`],[`requests`]]:t.startsWith(`task.`)||t.startsWith(`merge.`)||t.startsWith(`pull_request.`)||t===`lease.expired`?[[`tasks`],[`task`,V(n.taskId)],[`members`],[`metrics`]]:t===`turn.completed`||t===`turn.failed`?[[`scheduler`],[`members`],[`turns`,r],[`memory`,r],[`agent-skills`,r],[`conflicts`,r],[`history`,r],[`task-file`],[`task-changes`],[`metrics`],[`crons`]]:t===`turn.started`?[[`scheduler`],[`members`],[`metrics`]]:t.startsWith(`turn.`)||t===`wake.requested`||t===`paused.changed`?[[`scheduler`],[`members`]]:t===`knowledge.written`||t===`knowledge.removed`?[[`knowledge`,V(n.project)??`society`]]:t===`dashboard.updated`?[[`dashboard`,V(n.project)]]:t.startsWith(`cron.`)?[[`crons`]]:t===`society.configured`?[[`society`],[`crons`]]:t.startsWith(`agent.`)||t===`subscription.changed`?[[`members`],[`crons`]]:t.startsWith(`project.`)||t===`channel.added`||t===`channel.archived`?[[`projects`],[`channels`],[`society`],[`crons`]]:t===`role.added`?[[`roles`]]:t.startsWith(`runner.`)?[[`runners`],[`models`],[`server-version`]]:t.startsWith(`proposal.`)?[[`proposals`],[`proposal`,V(n.proposalId)],[`metrics`]]:t===`skill.promoted`?[[`skills`]]:t===`ops.signal`?[[`signals`],[`scheduler`],[`metrics`]]:[]}function us(e,t){for(let n of ls(t)){let t=n.filter(e=>e!==void 0);e.invalidateQueries({queryKey:t})}}var ds=`stellaris.contentWidth`;function fs(e){return Math.round(Math.min(680,Math.max(420,e*.4)))}function ps(e){return Math.max(420,e-256-48)}function ms(e,t){let n=ps(e);return t===`widest`?n:Math.round(Math.min(n,Math.max(420,t??fs(e))))}function hs(e,t){return ms(e,t)>=ps(e)?null:`widest`}function gs(){let e=localStorage.getItem(ds);if(e===`widest`)return`widest`;let t=Number(e);return e!==null&&Number.isFinite(t)&&t>0?t:null}function _s(e){e===null?localStorage.removeItem(ds):localStorage.setItem(ds,String(e))}var vs=`stellaris.trail`;function ys(e,t,n){let r={};for(let[n,i]of Object.entries(e))Number(n)<t&&(r[Number(n)]=i);return r[t]=n,r}function bs(e,t){let n=e[t-1];return n===void 0||new URL(n,`http://board`).pathname===`/`?null:n}function xs(){try{let e=JSON.parse(sessionStorage.getItem(vs)??`{}`);if(typeof e!=`object`||!e)return{};let t={};for(let[n,r]of Object.entries(e))typeof r==`string`&&Number.isInteger(Number(n))&&(t[Number(n)]=r);return t}catch{return{}}}function Ss(e){sessionStorage.setItem(vs,JSON.stringify(e))}function Cs(e,t){return decodeURIComponent(e.split(`/`)[t]??``)}function ws(e,t){let{pathname:n}=new URL(e,`http://board`),r=n.split(`/`).filter(e=>e!==``),[i=``,a=``,o=``]=r;if(i===`task`&&o===`files`)return r.slice(3).map(decodeURIComponent).at(-1)??`the task's files`;if(i===`task`||i===`thread`||i===`proposal`)return t.entity(a)??`the ${i}`;if(i===`c`)return`#${decodeURIComponent(r.at(-1)??``)}`;if(i===`p`){let e=t.project(a)??a;return o===`tasks`?`the tasks of ${e}`:e}return i===`knowledge`?Cs(n,3):i===`citizen`?decodeURIComponent(a):{society:`the society`,citizens:`the citizens`,"needs-you":`what needs you`,proposals:`the proposals`,metrics:`the metrics`,runners:`the runners`}[i]??`the previous view`}var Ts=typeof sessionStorage>`u`?{}:xs(),Es=new Set;function Ds(e,t){if(Ts[e]!==t||Ts[e+1]!==void 0){Ts=ys(Ts,e,t),Ss(Ts);for(let e of Es)e()}}function Os(){return(0,j.useSyncExternalStore)(e=>(Es.add(e),()=>Es.delete(e)),()=>Ts)}function ks(e,t){let n=Mt.find(t=>t.phase===e.phase)?.label.toLowerCase(),r=e.holder===null?e.waitingFor===null?null:`for ${e.waitingFor}`:`held by ${e.holder}${e.linked===null?``:`, in a turn there`}`;return[`Task ${e.title} at ${t}`,`stage ${e.stage}`,n,r].filter(e=>e!=null).join(`, `)}var As=Math.PI*(3-Math.sqrt(5)),js=68,Ms=44,Ns=58,Ps=26,Fs=13,Is=.3,Ls=1.5*Math.PI,Rs=28,zs=280,Bs=8,Vs=40;function Hs(e){return Math.max(Ns,js*Math.sqrt(Math.max(0,e-1))+Ms)}function Us(e){return e+Ps}function Ws(e){let t=new Map;for(let n of e.toSorted()){let e=pe(n);if(e!==null){let n=t.get(e.agent)??[];n.includes(e.scope)||t.set(e.agent,[...n,e.scope])}}return t}function Gs(e){let t=e.projects.filter(e=>e.archived===void 0).toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt)||e.slug.localeCompare(t.slug)),n=new Set(t.map(e=>e.slug)),r=e=>n.has(e)?e:Ge,i=Ws(e.scheduler.running),a=Ws(e.scheduler.pending),o=new Set(e.scheduler.resident.map(e=>e.split(`/`)[0])),s=e.members.filter(e=>e.cli!==null).filter(e=>e.status===`active`).toSorted((e,t)=>e.name.localeCompare(t.name)),c=s.flatMap(e=>{let t=[...new Set((i.get(e.name)??[]).map(r))];if(t.length>0)return t.map(t=>({id:t===`society`?e.name:`${e.name}/${t}`,member:e,state:`working`,scope:t,queuedFor:null}));let n=a.get(e.name)?.[0];return[{id:e.name,member:e,state:n===void 0?`idle`:`queued`,scope:Ge,queuedFor:n===void 0?null:r(n)}]}),l=new Map([[Ge,new Map(s.map((e,t)=>[e.name,t]))]]);for(let e of t){let t=s.filter(t=>t.memberships.includes(e.slug)),n=c.filter(t=>t.scope===e.slug).map(e=>e.member).filter(t=>!t.memberships.includes(e.slug));l.set(e.slug,new Map([...t,...n].map((e,t)=>[e.name,t])))}let u=new Map([...l].map(([e,t])=>[e,t.size])),d={id:Ge,label:`society`,kind:`society`,x:0,y:0,radius:Hs(u.get(`society`)??0)},f=[d,...Js(t,u,d)],p=new Map(f.map(e=>[e.id,e])),m=c.map(({id:e,member:t,state:n,scope:r,queuedFor:i})=>{let a=p.get(r)??d,s=l.get(a.id)?.get(t.name)??0,c=js*Math.sqrt(s),u=s*As-Math.PI/2;return{id:e,name:t.name,cli:t.cli,state:n,resident:o.has(t.name),anchor:a.id,queuedFor:i,x:Math.round(a.x+c*Math.cos(u)),y:Math.round(a.y+c*Math.sin(u))}}),h=Ks(e.tasks??[],f,m),g=Math.max(...f.map(e=>Math.hypot(e.x,e.y)+Us(e.radius)));return{anchors:f,stars:m,tasks:h,radius:Math.round(g+Vs)}}function Ks(e,t,n){let r=[];for(let i of t){if(i.kind!==`project`)continue;let t=e.filter(e=>e.project===i.id).flatMap(e=>{let t=jt(e);return t===`done`||t===`abandoned`?[]:[{task:e,phase:t}]}).toSorted((e,t)=>e.task.id.localeCompare(t.task.id)),a=Math.min(Is,Ls/Math.max(1,t.length)),o=i.radius+Fs;t.forEach(({task:e,phase:t},s)=>{let c=s%2==0?1:-1,l=-Math.PI/2+c*Math.ceil(s/2)*a,u=t===`landing`?null:e.claimedBy??null,d=we(e),f=u===null?null:n.find(e=>e.name===u&&e.anchor===i.id)?.id??null;r.push({id:e.id,title:e.title,project:i.id,phase:t,stage:d?.name??e.stage,holder:u,waitingFor:u===null&&t!==`landing`&&d!==void 0?At(d):null,linked:f,x:Math.round(i.x+o*Math.cos(l)),y:Math.round(i.y+o*Math.sin(l))})})}return r}function qs(e,t,n){let r=e.stars.filter(e=>e.name===t);return(r.find(e=>e.anchor===n)??r[0])?.id??null}function Js(e,t,n){let r=[],i=Us(n.radius),a=Bs;for(let n=0,o=0;n<e.length;o+=1){let s=e.slice(n,n+a);n+=a,a+=4;let c=s.map(e=>Hs(t.get(e.slug)??0)),l=c.map(Us),u=l.map(e=>2*e+Rs),d=u.reduce((e,t)=>e+t,0),f=u.map(e=>2*Math.PI*e/d),p=-Math.PI/2-(f[0]??0)/2+(o===0?0:Math.PI/s.length),m=f.map(e=>{let t=p+e/2;return p+=e,t}),h=Math.max(o===0?zs:0,i+Math.max(...l)+Rs);if(s.length>1)for(let e=0;e<s.length;e+=1){let t=(e+1)%s.length,n=((f[e]??0)+(f[t]??0))/2,r=((l[e]??0)+(l[t]??0)+Rs)/(2*Math.sin(n/2));h=Math.max(h,r)}s.forEach((e,t)=>{let n=m[t]??0;r.push({id:e.slug,label:e.name,kind:`project`,x:Math.round(h*Math.cos(n)),y:Math.round(h*Math.sin(n)),radius:Math.round(c[t]??Ns)})}),i=h+Math.max(...l)}return r}var Ys=.15,Xs=.45,Zs=1.35,Qs=64,$s=1.15;function ec(e,t,n){return Math.min(n,Math.max(t,e))}function tc(e){return Math.max(240,e.width-e.left-e.right)}function nc(e){return{x:e.left+tc(e)/2,y:e.height/2}}function rc(e,t){return{x:0,y:0,scale:ec(Math.min(tc(e),e.height)/(2*t),Xs,Zs)}}function ic(e,t,n,r){let i=ec(e.scale*n,Ys,3),a=nc(t),o=e.x+(r.x-a.x)/e.scale,s=e.y+(r.y-a.y)/e.scale;return{x:o-(r.x-a.x)/i,y:s-(r.y-a.y)/i,scale:i}}function ac(e,t,n){return{...e,x:e.x-t/e.scale,y:e.y-n/e.scale}}function oc(e,t,n){let r=nc(t),i=r.x+(n.x-e.x)*e.scale,a=r.y+(n.y-e.y)*e.scale,o=n.reach*e.scale;if(i-o>=t.left&&i+o<=t.width-t.right&&a-o>=Qs&&a+o<=t.height)return null;let s=Math.min(tc(t),t.height-Qs)/(2*n.reach*$s);return{x:n.x,y:n.y,scale:Math.min(e.scale,ec(s,Ys,3))}}var sc=`#0a0a0a`,cc=`#171717`,lc=`212, 212, 212`,uc=`163, 163, 163`,dc=`115, 115, 115`,fc=`"Instrument Sans Variable", ui-sans-serif, sans-serif`,pc=`500 12px "Onest Variable", ui-sans-serif, sans-serif`,mc=`600 10px "Onest Variable", ui-sans-serif, sans-serif`,hc={waiting:`#fcd34d`,working:`#6ee7b7`,returned:`#fdba74`,landing:`#7dd3fc`},gc=`500 11px ${fc}`,_c=5,vc=240,yc=34,bc=.06,xc=15,Sc=5,Cc=4.2,wc=280;function Tc(e){let t=e;return()=>{t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function Ec(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0)/4294967296*Math.PI*2}function Dc(e,t){return(e%t+t)%t}function Oc(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function kc(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(n!==null){let t=Oc(e),r=n.createRadialGradient(128,128,0,128,128,128);r.addColorStop(0,`rgba(${t}, 0.55)`),r.addColorStop(.22,`rgba(${t}, 0.2)`),r.addColorStop(.55,`rgba(${t}, 0.05)`),r.addColorStop(1,`rgba(${t}, 0)`),n.fillStyle=r,n.fillRect(0,0,256,256)}return t}var Ac=class{canvas;options;ctx;glyphs;glows=new Map;bodies=new Map;marks=new Map;bubbles=new Map;clock=0;specks;spheres=new Map;radius=400;scale=1;camX=0;camY=0;target={x:0,y:0,scale:1};mode=`home`;focusPending=!1;width=0;height=0;dpr=1;hovered=null;focus=null;paused=!1;insetLeft=0;insetRight=0;centerX=0;frameId=null;last=0;constructor(e,t){this.canvas=e,this.options=t;let n=e.getContext(`2d`);if(n===null)throw Error(`the sky needs a 2D canvas context`);this.ctx=n,this.glyphs={claude:new Path2D(Tt.claude.path),codex:new Path2D(Tt.codex.path)};let r=Tc(7);this.specks=Array.from({length:wc},()=>({x:r(),y:r(),size:.5+r()*1.1,alpha:.12+r()*.45,rate:.2+r()*.8,phase:r()*Math.PI*2}))}setModel(e){this.radius=e.radius;for(let t of e.anchors){let e=this.spheres.get(t.id);e===void 0?this.spheres.set(t.id,{anchor:t,x:t.x,y:t.y,radius:t.radius}):e.anchor=t}for(let t of this.spheres.keys())e.anchors.some(e=>e.id===t)||this.spheres.delete(t);let t=new Set(e.stars.map(e=>e.id)),n=[...this.bodies.entries()].filter(([e])=>!t.has(e));for(let r of e.stars){let i=this.bodies.get(r.id);if(i!==void 0){i.star=r,i.leaving=!1;continue}let a=n.findIndex(([,e])=>e.star.name===r.name),o=n[a];if(o!==void 0){n.splice(a,1),this.bodies.delete(o[0]),this.bodies.set(r.id,{...o[1],star:r,leaving:!1});continue}let s=[...this.bodies.values()].find(e=>e.star.name===r.name&&t.has(e.star.id)),c=e.anchors.find(e=>e.id===r.anchor),l=s??c??r;this.bodies.set(r.id,{star:r,x:this.options.reducedMotion?r.x:l.x,y:this.options.reducedMotion?r.y:l.y,vx:0,vy:0,phase:Ec(r.name),presence:+!!this.options.reducedMotion,leaving:!1,screen:{x:0,y:0},flash:0})}for(let[,t]of n){let n=e.stars.find(e=>e.name===t.star.name);t.leaving=!0,n!==void 0&&(t.star={...t.star,x:n.x,y:n.y})}let r=new Set(e.tasks.map(e=>e.id));for(let t of e.tasks){let e=this.marks.get(t.id);e===void 0?this.marks.set(t.id,{mark:t,x:t.x,y:t.y,presence:+!!this.options.reducedMotion,leaving:!1,screen:{x:0,y:0}}):(e.mark=t,e.leaving=!1)}for(let[e,t]of this.marks)r.has(e)||(t.leaving=!0)}flash(e){let t=this.bodies.get(e);t!==void 0&&!this.options.reducedMotion&&(t.flash=1)}say(e,t){this.bodies.has(e)&&this.bubbles.set(e,{text:t,born:this.clock})}setHovered(e){this.hovered=e}setPaused(e){this.paused=e}setFocus(e){this.focus=e,this.focusPending=!0}zoomBy(e,t){let n=this.view();this.target=ic(this.target,n,e,t??nc(n)),this.mode=`manual`}panBy(e,t){this.target=ac(this.target,e,t),this.camX-=e/this.scale,this.camY-=t/this.scale,this.mode=`manual`}home(){this.mode=`home`}view(){return{width:this.width,height:this.height,left:this.insetLeft,right:this.insetRight}}frameFocus(e){let t=this.focus===null?void 0:this.spheres.get(this.focus);if(t===void 0||t.anchor.kind===`society`){this.mode===`focus`&&(this.mode=`home`);return}let n=oc(this.target,e,{x:t.anchor.x,y:t.anchor.y,reach:t.anchor.radius+yc});n!==null&&(this.target=n,this.mode=`focus`)}setInsets(e,t){this.insetLeft=e,this.insetRight=t}hitTestAnchor(e,t){let n=null,r=1/0;for(let i of this.spheres.values()){let a=this.toScreen(i.x,i.y),o=Math.hypot(a.x-e,a.y-t);o<=i.radius*this.scale&&o<r&&(n=i.anchor.id,r=o)}return n}resize(e,t,n){this.width=e,this.height=t,this.dpr=n,this.canvas.width=Math.round(e*n),this.canvas.height=Math.round(t*n)}hitTestMark(e,t){let n=null,r=10;for(let[i,a]of this.marks){let o=Math.hypot(a.screen.x-e,a.screen.y-t);!a.leaving&&o<r&&(n=i,r=o)}return n}hitTest(e,t){let n=null,r=Math.max(xc*this.scale+8,18);for(let[i,a]of this.bodies){if(a.leaving)continue;let o=Math.hypot(a.screen.x-e,a.screen.y-t);o<r&&(n=i,r=o)}return n}start(){this.frameId===null&&(this.last=performance.now()/1e3,this.frameId=requestAnimationFrame(this.frame))}stop(){this.frameId!==null&&(cancelAnimationFrame(this.frameId),this.frameId=null)}frame=e=>{let t=e/1e3;this.clock=t;let n=Math.min(.05,Math.max(0,t-this.last));this.last=t,this.step(n),this.draw(this.options.reducedMotion?0:t),this.frameId=requestAnimationFrame(this.frame)};step(e){let t=this.view();this.mode===`home`&&(this.target=rc(t,this.radius)),this.focusPending&&this.width>0&&(this.focusPending=!1,this.frameFocus(t));let n=this.options.reducedMotion?1:Math.min(1,e*3);this.scale+=(this.target.scale-this.scale)*n,this.camX+=(this.target.x-this.camX)*n,this.camY+=(this.target.y-this.camY)*n;let r=nc(t).x;this.centerX=this.centerX===0?r:this.centerX+(r-this.centerX)*n;for(let e of this.spheres.values())e.x+=(e.anchor.x-e.x)*n,e.y+=(e.anchor.y-e.y)*n,e.radius+=(e.anchor.radius-e.radius)*n;for(let[t,n]of this.bodies){if(this.options.reducedMotion)n.x=n.star.x,n.y=n.star.y,n.presence=+!n.leaving;else{n.vx+=(Sc*(n.star.x-n.x)-Cc*n.vx)*e,n.vy+=(Sc*(n.star.y-n.y)-Cc*n.vy)*e,n.x+=n.vx*e,n.y+=n.vy*e;let t=+!n.leaving;n.presence+=(t-n.presence)*Math.min(1,e*2.5)}n.flash=Math.max(0,n.flash-e*2.2),n.leaving&&n.presence<.02&&this.bodies.delete(t)}for(let[t,r]of this.marks){r.x+=(r.mark.x-r.x)*n,r.y+=(r.mark.y-r.y)*n;let i=+!r.leaving;r.presence+=(i-r.presence)*(this.options.reducedMotion?1:Math.min(1,e*2.5)),r.leaving&&r.presence<.02&&this.marks.delete(t)}for(let[e,t]of this.bubbles)(this.clock-t.born>_c||this.bodies.get(e)?.leaving!==!1)&&this.bubbles.delete(e)}toScreen(e,t){return{x:this.centerX+(e-this.camX)*this.scale,y:this.height/2+(t-this.camY)*this.scale}}glow(e){let t=this.glows.get(e);return t===void 0&&(t=kc(e),this.glows.set(e,t)),t}draw(e){let{ctx:t}=this;t.setTransform(this.dpr,0,0,this.dpr,0,0),t.fillStyle=sc,t.fillRect(0,0,this.width,this.height),this.drawSpecks(e),this.drawAnchors(),this.drawTasks(e);let n=[...this.bodies.values()].toSorted((e,t)=>Number(e.star.id===this.hovered)-Number(t.star.id===this.hovered));for(let t of n)this.drawBody(t,e);this.drawBubbles();let r=this.hovered?.startsWith(`task:`)===!0?this.hovered.slice(5):null,i=r===null?this.hovered===null?void 0:this.bodies.get(this.hovered):this.marks.get(r);this.options.onHoverPosition(i===void 0||i.leaving?null:i.screen)}drawTasks(e){let{ctx:t}=this;for(let e of this.marks.values())e.screen=this.toScreen(e.x,e.y);t.save(),t.lineWidth=1;for(let n of this.marks.values()){let r=n.mark.linked===null?void 0:this.bodies.get(n.mark.linked);if(r===void 0||r.leaving)continue;let i=Oc(hc[n.mark.phase]),a=Math.min(n.presence,r.presence),o=n.screen,s=r.screen,c=t.createLinearGradient(o.x,o.y,s.x,s.y);if(c.addColorStop(0,`rgba(${i}, ${(.55*a).toFixed(3)})`),c.addColorStop(1,`rgba(${i}, ${(.12*a).toFixed(3)})`),t.strokeStyle=c,t.beginPath(),t.moveTo(o.x,o.y),t.lineTo(s.x,s.y),t.stroke(),e!==0){let n=(e*.45+r.phase)%1;t.beginPath(),t.arc(s.x+(o.x-s.x)*n,s.y+(o.y-s.y)*n,1.4,0,Math.PI*2),t.fillStyle=`rgba(${i}, ${(.85*a).toFixed(3)})`,t.fill()}}t.restore();for(let[n,r]of this.marks){let{mark:i,screen:a}=r,o=this.hovered===`task:${n}`,s=hc[i.phase],c=i.phase===`waiting`&&e!==0?.65+.35*Math.sin(e*1.6+a.x):1,l=Math.max(3,4*this.scale)*(o?1.5:1);t.save(),t.globalAlpha=r.presence*c*(this.paused?.7:1),t.globalCompositeOperation=`lighter`;let u=l*7;t.drawImage(this.glow(s),a.x-u/2,a.y-u/2,u,u),t.globalCompositeOperation=`source-over`,t.translate(a.x,a.y),t.rotate(Math.PI/4),t.fillStyle=s,t.fillRect(-l/2,-l/2,l,l),o&&(t.strokeStyle=`rgba(255, 255, 255, 0.8)`,t.lineWidth=1,t.strokeRect(-l/2-2,-l/2-2,l+4,l+4)),t.restore()}}drawBubbles(){let{ctx:e}=this;e.save(),e.font=gc,e.textAlign=`left`,e.textBaseline=`middle`;for(let[t,n]of this.bubbles){let r=this.bodies.get(t);if(r===void 0)continue;let i=this.clock-n.born,a=Math.min(1,i/.25,(_c-i)/1.2)*r.presence;if(a<=0)continue;let o=n.text;if(e.measureText(o).width>vc){for(;o.length>1&&e.measureText(`${o}…`).width>vc;)o=o.slice(0,-1);o=`${o.trimEnd()}…`}let s=e.measureText(o).width+16,c=this.options.reducedMotion?0:i*7,l=Math.max(10,xc*this.scale),u=r.screen.x-s/2,d=r.screen.y-l-14-22-c;e.globalAlpha=a,e.beginPath(),e.roundRect(u,d,s,22,7),e.fillStyle=`rgba(23, 23, 23, 0.92)`,e.fill(),e.strokeStyle=`rgba(255, 255, 255, 0.1)`,e.lineWidth=1,e.stroke(),e.fillStyle=`rgba(${lc}, 1)`,e.fillText(o,u+8,d+11+.5)}e.restore()}drawSpecks(e){let{ctx:t}=this,n=-this.camX*this.scale*bc,r=-this.camY*this.scale*bc;for(let i of this.specks){let a=e===0?1:.6+.4*Math.sin(e*i.rate+i.phase);t.fillStyle=`rgba(255, 255, 255, ${(i.alpha*a*(this.paused?.6:1)).toFixed(3)})`,t.fillRect(Dc(i.x*this.width+n,this.width),Dc(i.y*this.height+r,this.height),i.size,i.size)}let i=this.toScreen(0,0),a=t.createRadialGradient(i.x,i.y,0,i.x,i.y,320*this.scale);a.addColorStop(0,`rgba(255, 255, 255, 0.035)`),a.addColorStop(1,`rgba(255, 255, 255, 0)`),t.fillStyle=a,t.fillRect(0,0,this.width,this.height)}drawAnchors(){let{ctx:e}=this,t=this.toScreen(0,0);e.save(),e.setLineDash([2,7]),e.lineWidth=1,e.strokeStyle=`rgba(255, 255, 255, 0.07)`;for(let n of this.spheres.values())if(n.anchor.kind===`project`){let r=this.toScreen(n.x,n.y);e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(r.x,r.y),e.stroke()}e.restore();for(let{anchor:t,x:n,y:r,radius:i}of this.spheres.values()){let a=this.toScreen(n,r),o=i*this.scale,s=t.id===this.focus;if(t.kind===`project`){let t=e.createRadialGradient(a.x,a.y,0,a.x,a.y,o*1.8);t.addColorStop(0,`rgba(160, 170, 255, ${s?.1:.05})`),t.addColorStop(1,`rgba(160, 170, 255, 0)`),e.fillStyle=t,e.fillRect(a.x-o*1.8,a.y-o*1.8,o*3.6,o*3.6)}e.beginPath(),e.arc(a.x,a.y,o,0,Math.PI*2),e.lineWidth=s?1.5:1,e.strokeStyle=s?`rgba(255, 255, 255, 0.28)`:t.kind===`society`?`rgba(255, 255, 255, 0.09)`:`rgba(255, 255, 255, 0.06)`,e.stroke(),e.textAlign=`center`,e.textBaseline=`top`,t.kind===`society`?(e.font=mc,e.letterSpacing=`2px`,e.fillStyle=`rgba(${dc}, 0.9)`,e.fillText(t.label.toUpperCase(),a.x,a.y+o+10),e.letterSpacing=`0px`):(e.font=pc,e.fillStyle=s?`rgba(245, 245, 245, 1)`:`rgba(${uc}, 0.95)`,e.fillText(t.label,a.x,a.y+o+10))}}drawBody(e,t){let{ctx:n}=this,{star:r}=e,i=Tt[r.cli],a=r.id===this.hovered,o=r.state===`working`,s=o?2.5:5,c=s*(Math.sin(t*.29+e.phase)+.6*Math.sin(t*.17+e.phase*2.1)),l=s*(Math.cos(t*.23+e.phase*1.3)+.6*Math.cos(t*.11+e.phase)),u=this.toScreen(e.x+c,e.y+l);e.screen=u;let d=o?2.4:r.state===`queued`?1.4:.7,f=t===0?.5:.5+.5*Math.sin(t*d+e.phase),p=((o?.95+.35*f:r.state===`queued`?.7+.2*f:.5+.2*f)+(a?.25:0)+.8*e.flash)*e.presence*(this.paused?.7:1),m=Math.max(10,xc*this.scale),h=(o?170:130)*this.scale*(.9+.15*f);n.save(),n.globalCompositeOperation=`lighter`,n.globalAlpha=Math.min(1,p),n.drawImage(this.glow(i.accent),u.x-h/2,u.y-h/2,h,h),n.restore(),n.save(),n.globalAlpha=e.presence;let g=Oc(i.accent);if(o&&t!==0){let r=(t+e.phase)%1.8/1.8;n.beginPath(),n.arc(u.x,u.y,m+(6+30*r)*this.scale,0,Math.PI*2),n.strokeStyle=`rgba(${g}, ${(.4*(1-r)).toFixed(3)})`,n.lineWidth=1.25,n.stroke()}e.flash>0&&(n.beginPath(),n.arc(u.x,u.y,m+(3+12*(1-e.flash))*this.scale,0,Math.PI*2),n.strokeStyle=`rgba(255, 255, 255, ${(.55*e.flash).toFixed(3)})`,n.lineWidth=1.25,n.stroke()),r.resident&&(n.beginPath(),n.arc(u.x,u.y,m+5*this.scale,0,Math.PI*2),n.strokeStyle=`rgba(${g}, 0.3)`,n.lineWidth=1,n.stroke()),r.state===`queued`&&(n.beginPath(),n.arc(u.x,u.y,m+8*this.scale,0,Math.PI*2),n.setLineDash([3,4]),n.lineDashOffset=-t*8,n.strokeStyle=`rgba(${lc}, 0.55)`,n.lineWidth=1,n.stroke(),n.setLineDash([])),n.beginPath(),n.arc(u.x,u.y,m,0,Math.PI*2),n.fillStyle=cc,n.fill(),n.strokeStyle=`rgba(${g}, ${a?.95:.6})`,n.lineWidth=a?1.75:1.25,n.stroke(),n.save();let _=m*1.2/24;if(n.translate(u.x,u.y),n.scale(_,_),n.translate(-12,-12),n.fillStyle=i.fill,n.fill(this.glyphs[r.cli],`evenodd`),n.restore(),o)for(let r=0;r<3;r+=1){let i=t*1.8+r*Math.PI*2/3+e.phase,a=m+9*this.scale;n.beginPath(),n.arc(u.x+a*Math.cos(i),u.y+a*Math.sin(i),1.6,0,Math.PI*2),n.fillStyle=`rgba(${g}, 0.9)`,n.fill()}n.font=`500 ${Math.max(9,Math.min(11,11*this.scale)).toFixed(1)}px ${fc}`,n.textAlign=`center`,n.textBaseline=`top`,n.fillStyle=`rgba(${lc}, ${a||o?1:.7})`,n.fillText(r.name,u.x,u.y+m+8*this.scale+3),n.restore()}},jc=15e3,Mc=26,Nc=12,Pc=4,Fc=.0015,Ic=.01,Lc=1.3,Rc=`grid size-7 place-items-center rounded-md text-sm text-fg-tertiary transition-colors hover:bg-surface-2/70 hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`;function zc(e,t,n,r){if(e===null)return;if(t===null){e.style.visibility=`hidden`;return}let i=e.offsetWidth,a=e.offsetHeight,o=r.left+Nc,s=n.width-r.right-Nc,c=t.x+Mc+i<=s?t.x+Mc:t.x-Mc-i,l=Math.min(Math.max(Nc,t.y-a/3),n.height-a-Nc);e.style.transform=`translate(${Math.round(Math.max(o,c))}px, ${Math.round(l)}px)`,e.style.visibility=`visible`}function Bc({model:e,paused:t,hovered:n,onHover:r,insets:i,focus:a,onSelectAnchor:o,onSelectStar:s,onSelectTask:c,live:l,card:u}){let d=(0,j.useRef)(null),f=(0,j.useRef)(null),p=(0,j.useRef)(null),m=(0,j.useRef)(i);(0,j.useLayoutEffect)(()=>{m.current=i},[i]);let h=(0,j.useRef)(e);(0,j.useLayoutEffect)(()=>{h.current=e},[e]);let g=Ja(),_=(0,j.useRef)(g);(0,j.useLayoutEffect)(()=>{_.current=g},[g]);let v=(0,j.useRef)(null),y=(0,j.useRef)(!1);return(0,j.useEffect)(()=>{let e=d.current;if(e===null)throw Error(`the sky's canvas is not mounted`);let t=e.getBoundingClientRect(),n=new Ac(e,{reducedMotion:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,onHoverPosition:e=>zc(f.current,e,t,m.current)});p.current=n;let r=new ResizeObserver(()=>{t=e.getBoundingClientRect(),n.resize(t.width,t.height,window.devicePixelRatio)});r.observe(e);let i=e=>{e.preventDefault();let t=e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*16:e.deltaY;n.zoomBy(Math.exp(-t*(e.ctrlKey?Ic:Fc)),{x:e.offsetX,y:e.offsetY})};return e.addEventListener(`wheel`,i,{passive:!1}),n.start(),()=>{e.removeEventListener(`wheel`,i),r.disconnect(),n.stop(),p.current=null}},[]),(0,j.useEffect)(()=>{p.current?.setModel(e)},[e]),(0,j.useEffect)(()=>l.listen(e=>{let t=p.current;if(t===null||e.event.type!==`tool_call`||Date.now()-Date.parse(e.ts)>jc)return;let n=qs(h.current,e.agent,e.project);if(n===null)return;t.flash(n);let r=Co(e.event.name,e.event.input);r!==null&&t.say(n,za(r,_.current))}),[l]),(0,j.useEffect)(()=>{p.current?.setPaused(t)},[t]),(0,j.useEffect)(()=>{p.current?.setHovered(n)},[n]),(0,j.useEffect)(()=>{p.current?.setFocus(a)},[a]),(0,j.useEffect)(()=>{p.current?.setInsets(i.left,i.right)},[i.left,i.right]),(0,P.jsxs)(`div`,{className:`absolute inset-0`,children:[(0,P.jsx)(`canvas`,{ref:d,className:`size-full touch-none`,"aria-hidden":`true`,onPointerDown:e=>{e.button===0&&(v.current={x:e.clientX,y:e.clientY,dragging:!1},y.current=!1)},onPointerUp:e=>{v.current?.dragging===!0&&(e.currentTarget.releasePointerCapture(e.pointerId),e.currentTarget.style.cursor=`grab`),v.current=null},onPointerMove:e=>{let t=p.current,i=v.current;if(i!==null&&t!==null){let n=e.clientX-i.x,a=e.clientY-i.y;if(!i.dragging&&Math.hypot(n,a)>Pc&&(i.dragging=!0,y.current=!0,e.currentTarget.setPointerCapture(e.pointerId),r(null)),i.dragging){t.panBy(n,a),i.x=e.clientX,i.y=e.clientY,e.currentTarget.style.cursor=`grabbing`;return}}let{offsetX:a,offsetY:o}=e.nativeEvent,s=t?.hitTest(a,o)??null,c=s===null?t?.hitTestMark(a,o)??null:null,l=s??(c===null?null:`task:${c}`),u=l===null?t?.hitTestAnchor(a,o)??null:null;e.currentTarget.style.cursor=l!==null||u!==null?`pointer`:`grab`,l!==n&&r(l)},onPointerLeave:()=>r(null),onClick:e=>{let t=p.current,{offsetX:n,offsetY:r}=e.nativeEvent;if(t===null||y.current){y.current=!1;return}let i=t.hitTest(n,r),a=i===null?t.hitTestMark(n,r):null,l=i===null&&a===null?t.hitTestAnchor(n,r):null;i===null?a===null?l!==null&&o(l):c(a):s(i)}}),(0,P.jsxs)(`fieldset`,{className:`card absolute bottom-4 flex flex-col gap-0.5 p-1`,style:{right:i.right+16},children:[(0,P.jsx)(`legend`,{className:`sr-only`,children:`Camera`}),(0,P.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,className:Rc,onClick:()=>p.current?.zoomBy(Lc),children:`+`}),(0,P.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,className:Rc,onClick:()=>p.current?.zoomBy(1/Lc),children:`−`}),(0,P.jsx)(`button`,{type:`button`,"aria-label":`Fit the whole sky`,title:`Fit the whole sky`,className:Rc,onClick:()=>p.current?.home(),children:`⤢`})]}),(0,P.jsx)(`div`,{ref:f,className:`pointer-events-none absolute top-0 left-0 will-change-transform`,style:{visibility:`hidden`},children:u})]})}var Vc={left:0,right:0};function Hc(){let[e,t]=(0,j.useState)(()=>window.innerWidth);return(0,j.useEffect)(()=>{let e=()=>t(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Uc(e,t){return e.startsWith(t)?decodeURIComponent(e.slice(t.length)):null}function Wc(){let{api:e,token:t,signOut:r,expire:a}=De(),o=ve();(0,j.useEffect)(()=>cs(t,{onEvent:e=>us(o,e),onResume:()=>void o.invalidateQueries()}),[t,o]);let[c]=(0,j.useState)(()=>new Do);(0,j.useEffect)(()=>c.follow(t),[c,t]);let l=x(),u=Te(),d=he(),f=Xe(),p=s(),m=y(),h=ze(),g=i(),_=(0,j.useMemo)(()=>La(m.data??[],h,g.data??[]),[m.data,h,g.data]),v=rt(),b=at({mutationFn:t=>e.setPaused(t),onSuccess:()=>void o.invalidateQueries({queryKey:[`scheduler`]})}),C=ca({select:e=>e.location.pathname}),w=ca({select:e=>e.location.href}),T=ca({select:e=>e.location.state.__TSR_index});(0,j.useEffect)(()=>Ds(T,w),[T,w]);let[E,ee]=(0,j.useState)(!1),[te,ne]=(0,j.useState)(null),re=te===C,ie=(0,j.useCallback)(()=>ne(null),[]),ae=(0,j.useRef)(!0),oe=ja(),se=Fi({strict:!1}),[ce,le]=(0,j.useState)(null),ue=_e(3e4),de=Hc(),fe=C!==`/`,[pe,me]=(0,j.useState)(gs),ge=ms(de,pe),ye=(e,t)=>{let n=ms(de,e),r=n>=ps(de)?`widest`:n;me(r),t&&_s(r)},be=()=>{let e=hs(de,pe);me(e),_s(e)},xe=(0,j.useMemo)(()=>fe?{left:288,right:ge+32}:Vc,[fe,ge]),O=Uc(C,`/thread/`),Se=S(Uc(C,`/task/`)),Ce=Uc(C,`/c/`)??(O===null?null:m.data?.find(e=>e.id===O)?.channel??null),we=/^\/p\/([^/]+)\/tasks$/.exec(C)?.[1]??Se.data?.project??null,k=Uc(C,`/citizen/`),A=k===null?null:se.scope??null,Ee=A?.split(`/`)[0]??null,ke=C===`/needs-you`?`needs-you`:C===`/proposals`||C.startsWith(`/proposal/`)?`proposals`:null,Ae=L().length,je=D().data?.length??0,Me=Oe().data?.filter(va).length??0,Ne=C===`/society`?Ge:/^\/p\/([^/]+)$/.exec(C)?.[1]??/^\/knowledge\/([^/]+)\//.exec(C)?.[1]??null;(0,j.useEffect)(()=>{let e=()=>{ae.current=!0},t=e=>{e.key===`Tab`&&(ae.current=!1);let t=e.target instanceof HTMLElement?e.target:null;if(!(t?.closest(`input, textarea, select, [contenteditable]`)!=null||e.metaKey||e.ctrlKey||e.altKey)){if(e.key===` `){if(t?.closest(`button, a, summary, [role='button']`)!=null&&!ae.current)return;e.preventDefault(),ne(C);return}e.key===`Escape`&&(re?ne(null):E?ee(!1):fe&&v({to:`/`}))}};return window.addEventListener(`keydown`,t),window.addEventListener(`pointerdown`,e),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`pointerdown`,e)}},[fe,E,re,C,v]);let Pe=[l,d,f,p].some(e=>e.error instanceof n&&e.error.status===401);(0,j.useEffect)(()=>{Pe&&a()},[Pe,a]);let Fe=(0,j.useMemo)(()=>d.data===void 0||f.data===void 0||p.data===void 0?null:Gs({members:d.data,projects:f.data,scheduler:p.data,tasks:h}),[d.data,f.data,p.data,h]);if(Fe===null){let e=[d,f,p].some(e=>e.error!==null);return(0,P.jsx)(`main`,{className:`grid h-full place-items-center`,children:(0,P.jsx)(`p`,{className:`text-meta`,"aria-live":`polite`,children:e?`The board server is not answering. Retrying…`:`Reading the board…`})})}let Ie=(ke!==null||C===`/metrics`||C===`/runners`||C===`/crons`?`society`:null)??Ne??we??(Ce===null?k===null?null:Ee??Fe.stars.find(e=>e.name===k)?.anchor??null:Ce.includes(`/`)?Ce.split(`/`)[0]??null:`society`),Le=de-xe.left-xe.right,Re=Le>=460,Be=Math.min(560,(Re?Le:de)-32),Ve={left:(Re?xe.left:0)+((Re?Le:de)-Be)/2,width:Be},He=ma(m.data??[]).filter(e=>_a(e,oe)),Ue=e=>e===`society`?`the society`:f.data?.find(t=>t.slug===e)?.name??e,We=Fe.stars.find(e=>e.id===ce),Ke=Fe.tasks.find(e=>`task:${e.id}`===ce),qe=d.data?.find(e=>e.name===We?.name),Je=We===void 0?`the society`:Ue(We.queuedFor??We.anchor),Ye=e=>{let t=Fe.stars.find(t=>t.id===e);t!==void 0&&v({to:`/citizen/$name`,params:{name:t.name},search:t.state===`working`?{scope:t.anchor}:{}})},Ze=e=>{v({to:`/task/$taskId`,params:{taskId:e}})};return(0,P.jsx)(Oo,{value:c,children:(0,P.jsx)(qa,{value:_,children:(0,P.jsx)(zo,{value:u.data?.signIn,children:(0,P.jsxs)(`main`,{className:`relative h-full overflow-hidden`,children:[(0,P.jsx)(Bc,{model:Fe,paused:p.data?.paused??!1,hovered:ce,onHover:le,insets:xe,focus:Ie,onSelectAnchor:e=>{v(e===`society`?{to:`/society`}:{to:`/p/$slug`,params:{slug:e}})},onSelectStar:Ye,onSelectTask:Ze,live:c,card:Ke===void 0?We===void 0||qe===void 0?null:(0,P.jsx)(Zo,{member:qe,star:We,place:Je,now:ue}):(0,P.jsx)(ss,{mark:Ke,project:Ue(Ke.project),members:d.data})}),(0,P.jsx)(Qo,{society:l.data?.name,citizens:new Set(Fe.stars.map(e=>e.name)).size,citizensOpen:C===`/citizens`,onToggleCitizens:()=>void v(C===`/citizens`?{to:`/`}:{to:`/citizens`}),runnersOpen:C===`/runners`,onToggleRunners:()=>void v(C===`/runners`?{to:`/`}:{to:`/runners`}),enrolling:je,cronsOpen:C===`/crons`,onToggleCrons:()=>void v(C===`/crons`?{to:`/`}:{to:`/crons`}),failingCrons:Me,attention:Ae,onOpenAttention:()=>void v({to:`/needs-you`}),paused:p.data?.paused??!1,onTogglePause:()=>b.mutate(!(p.data?.paused??!1)),pauseBusy:b.isPending,boardOpen:fe,onToggleBoard:()=>void v(fe?{to:`/`}:{to:`/c/$`,params:{_splat:`general`}}),logsOpen:E,metricsOpen:C===`/metrics`,onToggleMetrics:()=>void v(C===`/metrics`?{to:`/`}:{to:`/metrics`}),onToggleLogs:()=>ee(!E),onSignOut:r}),fe?(0,P.jsx)(Ro,{activeChannel:Ce,activeTasks:we,activeCitizen:k,activeScope:A,activeGovernance:ke,activeOverview:Ne}):null,fe?(0,P.jsxs)(Ca,{label:`Board content`,className:`top-[72px] right-4 bottom-4`,style:{width:ge},children:[(0,P.jsx)(os,{width:ge,min:420,max:ps(de),onResize:ye,onToggle:be}),(0,P.jsx)(Qi,{})]}):null,E?(0,P.jsx)(rs,{onClose:()=>ee(!1)}):null,re?(0,P.jsx)(qo,{left:Ve.left,width:Ve.width,onClose:ie}):(0,P.jsx)(`div`,{className:`pointer-events-none absolute bottom-5 flex justify-center px-16`,style:{left:xe.left,right:xe.right},children:(0,P.jsx)(Jo,{unread:He,onOpen:()=>ne(C)})}),Fe.stars.length===0&&!fe?(0,P.jsxs)(`p`,{className:`pointer-events-none absolute inset-x-0 top-1/2 mt-24 text-center text-meta`,children:[`No citizens yet. Ask the concierge for one, or add one with`,` `,(0,P.jsx)(`code`,{className:`font-mono text-fg-secondary`,children:`stellaris agent add`}),`.`]}):null,(0,P.jsx)(`ul`,{className:`sr-only`,"aria-label":`Tasks in play`,children:Fe.tasks.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsx)(`button`,{type:`button`,onFocus:()=>le(`task:${e.id}`),onBlur:()=>le(null),onClick:()=>Ze(e.id),children:ks(e,Ue(e.project))})},e.id))}),(0,P.jsx)(`ul`,{className:`sr-only`,"aria-label":`Citizens`,children:Fe.stars.map(e=>(0,P.jsx)(`li`,{children:(0,P.jsxs)(`button`,{type:`button`,onFocus:()=>le(e.id),onBlur:()=>le(null),onClick:()=>Ye(e.id),children:[e.name,`, `,e.state,e.state===`working`?` at ${Ue(e.anchor)}`:``]})},e.id))})]})})})})}var Gc=`modulepreload`,Kc=function(e){return`/`+e},qc={},Jc=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=Kc(t,n),t=s(t),t in qc)return;qc[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:Gc,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};function Yc(){return null}var Xc=Bi({component:Wc}),Zc=ia({routeTree:Xc.addChildren([Ri({getParentRoute:()=>Xc,path:`/`,component:Yc}),Ri({getParentRoute:()=>Xc,path:`/c/$`,component:Vi(()=>Jc(()=>import(`./ChannelView-CHvr0c9I.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),`ChannelView`)}),Ri({getParentRoute:()=>Xc,path:`/thread/$threadId`,component:Vi(()=>Jc(()=>import(`./ThreadView-DrwqggME.js`),__vite__mapDeps([13,1,2,3,6,4,9,7,8,10,11,12,14])),`ThreadView`)}),Ri({getParentRoute:()=>Xc,path:`/society`,component:Vi(()=>Jc(()=>import(`./SocietyView-fSkmFC3z.js`),__vite__mapDeps([15,1,2,3,5,6,4,10,16,17,18])),`SocietyView`)}),Ri({getParentRoute:()=>Xc,path:`/p/$slug`,component:Vi(()=>Jc(()=>import(`./ProjectView-CH-nqrAo.js`),__vite__mapDeps([19,1,2,3,6,8,4,5,9,10,16,17,18])),`ProjectView`)}),Ri({getParentRoute:()=>Xc,path:`/knowledge/$scope/$topic`,component:Vi(()=>Jc(()=>import(`./KnowledgeView-ndWDlRoP.js`),__vite__mapDeps([20,1,2,3,6,4,9,10,14])),`KnowledgeView`)}),Ri({getParentRoute:()=>Xc,path:`/p/$slug/tasks`,component:Vi(()=>Jc(()=>import(`./TasksView-CncU8UNJ.js`),__vite__mapDeps([21,1,6,8,10])),`TasksView`)}),Ri({getParentRoute:()=>Xc,path:`/task/$taskId`,component:Vi(()=>Jc(()=>import(`./TaskView-JLLJKQ0_.js`),__vite__mapDeps([22,1,2,3,6,8,23,4,9,10,14,24,7])),`TaskView`)}),Ri({getParentRoute:()=>Xc,path:`/task/$taskId/files/$`,validateSearch:e=>{let t=Number(e.line);return Number.isInteger(t)&&t>0?{line:t}:{}},component:Vi(()=>Jc(()=>import(`./TaskFileView-DM_JjQQx.js`),__vite__mapDeps([25,1,6,9,3,10,14])),`TaskFileView`)}),Ri({getParentRoute:()=>Xc,path:`/metrics`,validateSearch:e=>{let t=Fe.safeParse(e.window);return t.success?{window:t.data}:{}},component:Vi(()=>Jc(()=>import(`./MetricsView-B31t_Q2z.js`),__vite__mapDeps([26,1,6,10,16,17,18])),`MetricsView`)}),Ri({getParentRoute:()=>Xc,path:`/citizens`,component:Vi(()=>Jc(()=>import(`./CitizensView-Dq3V4mpg.js`),__vite__mapDeps([27,1,6,17,10,18])),`CitizensView`)}),Ri({getParentRoute:()=>Xc,path:`/needs-you`,component:Vi(()=>Jc(()=>import(`./NeedsYouView-d8_ydJI9.js`),__vite__mapDeps([28,1,6,23,8,10])),`NeedsYouView`)}),Ri({getParentRoute:()=>Xc,path:`/runners`,validateSearch:e=>typeof e.code==`string`?{code:e.code}:{},component:Vi(()=>Jc(()=>import(`./RunnersView-N4iUU4FM.js`),__vite__mapDeps([29,1,2,3,17,4,10])),`RunnersView`)}),Ri({getParentRoute:()=>Xc,path:`/crons`,validateSearch:e=>typeof e.agent==`string`?{agent:e.agent}:{},component:Vi(()=>Jc(()=>import(`./CronsView-CBiPaq-C.js`),__vite__mapDeps([30,1,2,3,6,17,4,9,10,18,31])),`CronsView`)}),Ri({getParentRoute:()=>Xc,path:`/proposals`,component:Vi(()=>Jc(()=>import(`./ProposalsView-Bmuq8Qnh.js`),__vite__mapDeps([32,1,6,23,8,10])),`ProposalsView`)}),Ri({getParentRoute:()=>Xc,path:`/proposal/$proposalId`,component:Vi(()=>Jc(()=>import(`./ProposalView-D-E0Hzdr.js`),__vite__mapDeps([33,1,2,3,6,17,8,23,4,9,10,14,32,24,7])),`ProposalView`)}),Ri({getParentRoute:()=>Xc,path:`/citizen/$name`,validateSearch:e=>({...typeof e.scope==`string`?{scope:e.scope}:{},...e.tab===`turns`||e.tab===`memory`||e.tab===`history`?{tab:e.tab}:{},...typeof e.turn==`string`?{turn:e.turn}:{}}),component:Vi(()=>Jc(()=>import(`./CitizenView-DlqilbFH.js`),__vite__mapDeps([34,1,2,3,6,17,4,9,10,12,18,31])),`CitizenView`)})])});function Qc({signInError:e}){let t=ve(),[n,r]=(0,j.useState)(_),i=(0,j.useCallback)(()=>{d(),t.clear(),r(null)},[t]),a=(0,j.useCallback)(()=>{n!==null&&ie(n).signOut().catch(()=>void 0),i(),Zc.navigate({to:`/`})},[n,i]),o=(0,j.useMemo)(()=>n===null?null:{api:ie(n),token:n,signOut:a,expire:i},[n,a,i]);return o===null?(0,P.jsx)(fa,{initialError:e,onEnter:e=>{l(e),r(e)}}):(0,P.jsx)(A,{value:o,children:(0,P.jsx)(sa,{router:Zc})})}var $c={expired:`The sign-in took too long or was already used. Try again.`,declined:`GitHub sign-in was cancelled.`,github:`GitHub could not confirm who signed in. Try again.`,"not-allowed":`That GitHub account is not allowed on this board.`};function el(e){let t=new URLSearchParams(e.replace(/^#/,``)),n=t.get(`session`),r=t.get(`signin-error`);return n===null&&r===null?null:{token:n===null||n===``?null:n,error:r===null?null:$c[r]??`GitHub sign-in failed.`}}function tl(){let e=el(window.location.hash);return e!==null&&(e.token!==null&&l(e.token),window.history.replaceState(window.history.state,``,`${window.location.pathname}${window.location.search}`)),e}var nl=new Rt({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),rl=tl(),il=document.getElementById(`root`);if(il===null)throw Error(`missing #root element`);(0,F.createRoot)(il).render((0,P.jsx)(j.StrictMode,{children:(0,P.jsx)($e,{client:nl,children:(0,P.jsx)(Qc,{signInError:rl?.error??null})})}));export{ya as C,ca as D,xa as E,Fi as O,Na as S,va as T,Za as _,Vo as a,Ka as b,no as c,To as d,lo as f,Xa as g,ko as h,R as i,Pi as k,Eo as l,ro as m,bs as n,Ho as o,So as p,Os as r,Wo as s,ws as t,to as u,Ja as v,ba as w,L as x,Ha as y};
|
package/web/dist/index.html
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<meta name="color-scheme" content="dark" />
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
8
8
|
<title>Stellaris</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-ww_EHgVF.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/format-BORdp4w-.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/mentions-BCdV0bMK.js">
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/compose-D7DOz6kC.js">
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/CliIcon-DxDvRRcX.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/tasks-C-9dAYQV.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/governance-WrDQawLN.js">
|
|
18
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
18
|
+
<link rel="stylesheet" crossorigin href="/assets/index-Dw96wkep.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body class="antialiased">
|
|
21
21
|
<div id="root"></div>
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{B as e,D as t,E as n,I as r,Ot as i,R as a,Sn as o,T as s,Tn as c,W as l,_ as u,a as d,b as f,bn as p,f as m,ft as h,k as g,l as _,m as v,o as y,p as b,t as x,v as S,xn as C,z as w}from"./format-BORdp4w-.js";import{l as T,s as E}from"./compose-D7DOz6kC.js";import{t as D}from"./link-1v5lugnf.js";import{t as ee}from"./CliIcon-DxDvRRcX.js";import{O,_ as k,c as A,d as j,f as te,h as M,i as ne,k as re,l as ie,m as ae,p as oe,u as se,v as N}from"./index-7uInG5D9.js";import{n as ce,r as P}from"./ThreadForms-RnrV7V5X.js";import{t as F}from"./Markdown-Dw04_ImA.js";import{n as I,t as le}from"./Pane-CODhA5zE.js";import{t as ue}from"./useStickyScroll-CE7dyz0Q.js";import{a as L,c as de,i as R,l as z,n as fe,o as B,s as pe,t as me}from"./citizen-aLkZ4owL.js";var V=c(o(),1),H=C(),he={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`was interrupted`,blocked:`was blocked`,stopped:`was stopped by you`};function U(e){return new Date(e).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}function W({label:e,tone:t,children:n}){return(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`px-0.5 pb-0.5 text-[10px] tracking-wider text-fg-muted uppercase`,children:e}),(0,H.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-md bg-surface-0/60 p-2 font-mono text-[11px] leading-relaxed whitespace-pre-wrap break-words ${t}`,children:n})]})}function ge({step:e,open:t}){if(e.kind===`say`)return(0,H.jsx)(`li`,{className:`py-1.5 text-sm`,title:U(e.at),children:(0,H.jsx)(F,{text:e.text})});if(e.kind===`error`)return(0,H.jsx)(`li`,{className:`py-1 font-mono text-xs break-words text-red-400`,title:U(e.at),children:e.message});if(e.kind===`steer`)return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md px-1.5 py-1 text-xs hover:bg-surface-2/40`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`grid w-3 shrink-0 place-items-center text-sky-300`,children:`↳`}),(0,H.jsxs)(`span`,{className:`shrink-0 text-fg-tertiary`,children:[`Took `,j(e.posts.length)]}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:e.from.length===0?``:`from ${e.from.join(`, `)}, delivered mid-turn`}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:U(e.at)})]}),(0,H.jsx)(`ul`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:e.posts.map(e=>(0,H.jsxs)(`li`,{className:`rounded-md bg-surface-0/40 px-2.5 py-2`,children:[(0,H.jsxs)(`p`,{className:`flex gap-1.5 text-meta`,children:[(0,H.jsx)(`span`,{className:`text-fg-secondary`,children:e.author}),(0,H.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`in `,e.where]}),e.at===``?null:(0,H.jsx)(`span`,{className:`ml-auto shrink-0 font-mono`,children:U(e.at)})]}),(0,H.jsx)(`div`,{className:`mt-1 text-sm`,children:(0,H.jsx)(F,{text:e.body})})]},`${e.at}-${e.author}`))})]})});let n=e.ok===null?(0,H.jsx)(`span`,{"aria-label":`running`,className:`size-1.5 animate-pulse rounded-full bg-amber-300`}):e.ok?(0,H.jsx)(`span`,{"aria-label":`succeeded`,className:`text-[11px] text-emerald-400`,children:`✓`}):(0,H.jsx)(`span`,{"aria-label":`failed`,className:`text-[11px] text-red-400`,children:`✕`});return(0,H.jsx)(`li`,{children:(0,H.jsxs)(`details`,{open:t,className:`group rounded-md open:bg-surface-2/30`,children:[(0,H.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-md px-1.5 py-1 text-xs hover:bg-surface-2/40`,children:[(0,H.jsx)(`span`,{className:`grid w-3 shrink-0 place-items-center`,children:n}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-fg-tertiary`,children:te(e.name)}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-fg-secondary`,children:e.summary}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[10px] text-fg-muted`,children:U(e.at)})]}),(0,H.jsxs)(`div`,{className:`space-y-1.5 px-1.5 pb-1.5`,children:[(0,H.jsx)(W,{label:`Input`,tone:`text-fg-secondary`,children:e.detail}),e.output===null?null:(0,H.jsx)(W,{label:e.ok===!1?`Returned an error`:`Returned`,tone:e.ok===!1?`text-red-300`:`text-fg-tertiary`,children:e.output})]})]})})}function G({steps:e}){let[t,n]=(0,V.useState)(!1),r=e.filter(e=>e.kind===`tool`).length;return e.length===0?(0,H.jsx)(`p`,{className:`mt-2 text-meta`,children:`No steps yet.`}):(0,H.jsxs)(H.Fragment,{children:[r===0?null:(0,H.jsxs)(`p`,{className:`mt-2 flex items-center gap-2 text-meta`,children:[r===1?`1 tool call`:`${r} tool calls`,(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(!t),className:`rounded-md px-1.5 py-0.5 text-fg-tertiary transition-colors hover:bg-surface-2/60 hover:text-fg-primary`,children:t?`Collapse all`:`Expand all`})]}),(0,H.jsx)(`ol`,{className:`mt-1 space-y-0.5`,children:e.map(e=>(0,H.jsx)(ge,{step:e,open:t},e.seq))})]})}function _e({turn:e,running:t,now:n}){return e.end===null?t?(0,H.jsxs)(`p`,{className:`mt-3 flex items-center gap-2 text-meta`,"aria-live":`polite`,children:[(0,H.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}),`Working · last step `,x(e.lastAt,n)]}):(0,H.jsx)(`p`,{className:`mt-3 text-meta`,children:`The turn ended without a report.`}):(0,H.jsxs)(`section`,{className:`mt-3 rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:[(0,H.jsxs)(`p`,{className:`text-caps`,children:[`The turn `,he[e.end.exitReason],` `,x(e.end.at,n),e.fromStart?` · ${ie(e.startedAt,Date.parse(e.end.at))}`:``]}),e.end.summary===null?null:(0,H.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:e.end.summary})]})}var K=30,ve={turn:`turn`,board:`board`,merge:`both kept`},ye={turn:`Changed by a turn`,board:`Written by the board`,merge:`Both versions kept`};function be(e){return e.status===`added`?`new`:e.status===`deleted`?`deleted`:e.added===null||e.removed===null?`binary`:`+${e.added} −${e.removed}`}function xe(e){return e.files.map(e=>`${e.path} ${be(e)}`).join(`, `)}function Se(e){return e.startsWith(`@@`)||e.startsWith(`\\`)?`text-fg-muted`:e.startsWith(`+`)?`text-emerald-300`:e.startsWith(`-`)?`text-red-300`:`text-fg-tertiary`}function Ce({file:e}){return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[e.path,e.status===`modified`?``:(0,H.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,e.status]})]}),e.patch===null?(0,H.jsx)(`p`,{className:`mt-1 text-meta`,children:`A binary file; its contents are not shown.`}):e.patch===``?(0,H.jsx)(`p`,{className:`mt-1 text-meta`,children:`Empty.`}):(0,H.jsx)(`pre`,{className:`mt-1 max-h-96 overflow-auto rounded-md bg-surface-0/60 p-2 font-mono text-[11px] leading-relaxed`,children:e.patch.split(`
|
|
2
|
-
`).map((e,t)=>(0,H.jsx)(`span`,{className:`block whitespace-pre-wrap break-words ${Se(e)}`,children:e===``?` `:e},t))}),e.truncated?(0,H.jsx)(`p`,{className:`mt-1 text-meta`,children:`The rest of this file's change is cut.`}):null]})}function we({name:e,change:t}){let n=m(e,t.commit,!0);return(0,H.jsxs)(`div`,{className:`space-y-3 px-4 pt-1 pb-3`,children:[(0,H.jsxs)(`p`,{className:`text-xs text-fg-secondary`,children:[t.kind===`merge`?`Two turns on different runners changed the same lines at once. The file kept one turn's version, and this copy holds the other's until the citizen reconciles them.`:t.kind===`board`?`Written by the board: ${t.subject.replace(/^home: /,``)}.`:t.turnId===void 0?t.subject:(0,H.jsx)(D,{to:`/citizen/$name`,params:{name:e},search:{tab:`turns`,turn:t.turnId},className:`text-fg-secondary underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Open the turn that made it`}),(0,H.jsxs)(`span`,{className:`text-fg-muted`,children:[` · `,U(t.at)]})]}),n.data===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:n.isError?`Could not read the change.`:`Reading the change…`}):n.data.map(e=>(0,H.jsx)(Ce,{file:e},e.path))]})}function Te({name:e,change:t,now:n}){let[r,i]=(0,V.useState)(!1),a=t.files.length===0?t.subject:xe(t);return(0,H.jsx)(`li`,{className:`border-b border-line/60 last:border-b-0`,children:(0,H.jsxs)(`details`,{className:`group`,onToggle:e=>i(e.currentTarget.open),children:[(0,H.jsx)(`summary`,{"aria-label":`${ye[t.kind]} ${x(t.at,n)}: ${a}`,className:`block cursor-pointer list-none px-4 py-2.5 transition-colors hover:bg-surface-2/30 group-open:bg-surface-2/20`,children:(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:ve[t.kind]}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-secondary`,children:a}),(0,H.jsx)(`span`,{className:`shrink-0 text-fg-muted`,children:x(t.at,n)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]})}),r?(0,H.jsx)(we,{name:e,change:t}):null]})})}function Ee({name:e}){let[t,n]=(0,V.useState)(K),r=v(e,t),i=f(3e4);if(r.data===void 0)return(0,H.jsx)(I,{children:r.isError?`Could not read the home's history.`:`Reading the history…`});let{changes:a,more:o}=r.data;return a.length===0?(0,H.jsxs)(I,{children:[e,`'s home has no history yet; it starts with the citizen's first turn.`]}):(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,H.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,children:[`What `,e,`'s turns changed in its memory, skills, and profile, newest first.`]}),(0,H.jsx)(`ol`,{children:a.map(t=>(0,H.jsx)(Te,{name:e,change:t,now:i},t.commit))}),o?(0,H.jsx)(`button`,{type:`button`,onClick:()=>n(t+K),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:`Show earlier changes`}):null]})}function q({title:e,children:t}){return(0,H.jsxs)(`section`,{className:`border-t border-line pt-4 first:border-t-0 first:pt-0`,children:[(0,H.jsx)(`h3`,{className:`text-section`,children:e}),(0,H.jsx)(`div`,{className:`mt-2`,children:t})]})}function De({member:e,charter:t}){let n=S(e.name),r=y(e.name),i=b(e.name),a=f(3e4);return(0,H.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[i.data===void 0||i.data.length===0?null:(0,H.jsxs)(q,{title:`Edits to reconcile`,children:[(0,H.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`Two turns on different runners changed these files at once. Each file kept one version; the other waits beside it until `,e.name,` merges it in and deletes the copy.`]}),(0,H.jsx)(`ul`,{className:`mt-2 space-y-1.5`,children:i.data.map(e=>(0,H.jsxs)(`li`,{className:`text-sm`,children:[(0,H.jsx)(`span`,{className:`text-fg-primary`,children:e.file}),(0,H.jsxs)(`span`,{className:`text-meta`,children:[` `,`· `,e.path.slice(e.path.lastIndexOf(`/`)+1),` · left`,` `,x(e.since,a)]})]},e.path))})]}),(0,H.jsx)(q,{title:`Profile`,children:e.profile.trim()===``?(0,H.jsx)(`p`,{className:`text-meta`,children:`No profile yet. The citizen writes its own profile.md.`}):(0,H.jsx)(F,{text:z(e.profile,`Profile`)})}),(0,H.jsx)(q,{title:`Core memory`,children:n.data===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):n.data.body.trim()===``?(0,H.jsx)(`p`,{className:`text-meta`,children:`Empty. Every turn loads this file in full.`}):(0,H.jsx)(F,{text:z(n.data.body,`Core memory`)})}),(0,H.jsx)(q,{title:`Own skills`,children:r.data===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):r.data.length===0?(0,H.jsx)(`p`,{className:`text-meta`,children:`None yet.`}):(0,H.jsx)(`ul`,{className:`space-y-1.5`,children:r.data.map(e=>(0,H.jsxs)(`li`,{className:`text-sm`,children:[(0,H.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,H.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]},e.name))})}),t===void 0?null:(0,H.jsxs)(q,{title:`Charter of ${t.name}`,children:[(0,H.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:t.purpose}),(0,H.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Wakes on mentions, stages, and `,t.wakeTriggers.join(`, `)||`nothing else`,t.resident?` · keeps a warm session`:``,t.reflects?` · reflects`:``]}),(0,H.jsx)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:t.verbs.map(e=>(0,H.jsx)(`span`,{className:`rounded-md bg-surface-2/70 px-1.5 py-px font-mono text-[11px] text-fg-tertiary`,children:e},e))})]})]})}function J(e,t){let n=a(e,t?.turnId??null);return{turn:(0,V.useMemo)(()=>t===void 0||n.data===void 0?void 0:oe(n.data,e,t.project,t),[t,n.data,e]),loading:t?.turnId!==void 0&&n.isPending,missing:t!==void 0&&(t.turnId===void 0||n.isError)}}var Y=50;function Oe({name:e,entry:t,now:n,opened:r}){let[i,a]=(0,V.useState)(r),o=(0,V.useRef)(null);(0,V.useEffect)(()=>{r&&o.current?.scrollIntoView({block:`start`})},[r]);let s=N(),c=pe(t),l=t.thread===void 0?t.channel===void 0?null:`#${t.channel}`:s.get(t.thread)?.title??`a thread`,u=t.error??t.summary??``,d=t.error===null?`text-fg-secondary`:`text-red-300`;return(0,H.jsx)(`li`,{ref:o,className:`border-b border-line/60 last:border-b-0`,children:(0,H.jsxs)(`details`,{className:`group`,open:i,onToggle:e=>a(e.currentTarget.open),children:[(0,H.jsxs)(`summary`,{className:`block cursor-pointer list-none px-4 py-2.5 transition-colors hover:bg-surface-2/30 group-open:bg-surface-2/20`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-xs`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:[R(t.project),l===null?``:` · ${l}`]}),(0,H.jsx)(`span`,{className:`text-fg-muted`,children:t.trigger}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-fg-muted`,children:[me(t),` `,x(t.ts,n)]}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,title:t.usage===void 0?void 0:L(t.usage),children:[c,t.toolCalls===void 0?null:`${t.toolCalls} tools`,t.usage===void 0?null:B(t.usage)].filter(e=>e!==null).join(` · `)}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0 text-[10px] text-fg-muted transition-transform group-open:rotate-90`,children:`▸`})]}),u.trim()===``?null:(0,H.jsx)(`span`,{className:`mt-1 line-clamp-2 block text-xs leading-relaxed group-open:hidden ${d}`,children:(0,H.jsx)(k,{text:u,links:!1})})]}),i?(0,H.jsx)(ke,{name:e,entry:t,text:u,tone:d}):null]})})}function ke({name:e,entry:t,text:n,tone:r}){let i=J(e,t);return(0,H.jsxs)(`div`,{className:`px-4 pt-1 pb-3`,children:[n.trim()===``?null:(0,H.jsx)(`p`,{className:`text-xs leading-relaxed whitespace-pre-wrap ${r}`,children:(0,H.jsx)(k,{text:n})}),(0,H.jsx)(`div`,{className:`mt-2`,children:t.turnId===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`This turn ran before turns kept their steps.`}):i.loading?(0,H.jsx)(`p`,{className:`text-meta`,children:`Reading the steps…`}):i.turn===void 0?(0,H.jsx)(`p`,{className:`text-meta`,children:`No steps were kept for this turn.`}):(0,H.jsxs)(H.Fragment,{children:[t.startedAt===void 0?null:(0,H.jsxs)(`p`,{className:`text-caps`,children:[`Started `,U(t.startedAt)]}),(0,H.jsx)(G,{steps:i.turn.steps})]})})]})}function Ae({name:e,opened:t}){let[n,r]=(0,V.useState)(Y),i=w(e,n),a=f(3e4);if(i.data===void 0)return(0,H.jsx)(I,{children:`Reading the turns…`});let o=i.data.toReversed();if(o.length===0)return(0,H.jsxs)(I,{children:[e,` has not finished a turn yet.`]});let s=fe(o),c=s.usage===null?``:` · ${B(s.usage)}${s.withUsage<s.turns?` over ${s.withUsage} of them`:``}`;return(0,H.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[(0,H.jsxs)(`p`,{className:`px-4 pt-3 pb-1 text-meta`,title:s.usage===null?void 0:L(s.usage),children:[s.turns===1?`1 turn`:`${s.turns} turns`,s.failed===0?``:`, ${s.failed} not completed`,c]}),t!==null&&!o.some(e=>e.turnId===t)?(0,H.jsx)(`p`,{className:`px-4 pb-1 text-meta`,children:i.data.length===n?`The turn this address opens is further back; show earlier turns to reach it.`:`The turn this address opens is not in this citizen's history.`}):null,(0,H.jsx)(`ol`,{children:o.map(n=>(0,H.jsx)(Oe,{name:e,entry:n,now:a,opened:t!==null&&n.turnId===t},n.id))}),i.data.length===n?(0,H.jsxs)(`button`,{type:`button`,onClick:()=>r(n+Y),className:`px-4 py-3 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show `,Y,` earlier turns`]}):null]})}function je(e){return e===void 0?``:`${e.name}${e.id===null?``:` · ${e.id}`}`}function X({label:e,choices:t,value:n,onChange:r,listClassName:i=`inset-x-0`}){let[a,o]=(0,V.useState)(!1),s=(0,V.useRef)(null),c=(0,V.useRef)(null),l=(0,V.useRef)([]),u=t.findIndex(e=>e.value===n);(0,V.useEffect)(()=>{if(!a)return;l.current[Math.max(u,0)]?.focus();let e=e=>{e.target instanceof Node&&s.current?.contains(e.target)===!0||o(!1)};return window.addEventListener(`pointerdown`,e),()=>window.removeEventListener(`pointerdown`,e)},[a,u]);let d=e=>{if(e.key===`Escape`){e.stopPropagation(),o(!1),c.current?.focus();return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;e.preventDefault();let n=(l.current.findIndex(e=>e===document.activeElement)+(e.key===`ArrowDown`?1:-1)+t.length)%t.length;l.current[n]?.focus()},f=t[u];return(0,H.jsxs)(`div`,{ref:s,className:`relative min-w-0 flex-1`,children:[(0,H.jsxs)(`button`,{ref:c,type:`button`,"aria-label":`${e}: ${je(f)}`,"aria-expanded":a,onClick:()=>o(!a),onKeyDown:a?d:void 0,className:`flex h-7 w-full items-center gap-1.5 rounded-md bg-surface-2/60 px-2.5 text-xs text-fg-secondary transition-colors hover:bg-surface-2 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:[f?.name,f?.id===null||f===void 0?null:(0,H.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,f.id]})]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-[10px] text-fg-muted transition-transform ${a?`rotate-180`:``}`,children:`▾`})]}),a?(0,H.jsx)(`div`,{className:`absolute ${i} top-full z-20 mt-1 max-h-80 overflow-y-auto rounded-xl bg-surface-1/95 p-1 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.08),0_16px_32px_-12px_rgba(0,0,0,0.8)] backdrop-blur-xl`,children:t.map((e,t)=>{let i=e.value===n;return(0,H.jsxs)(`button`,{ref:e=>{l.current[t]=e},type:`button`,"aria-current":i?`true`:void 0,onKeyDown:d,onClick:()=>{r(e.value),o(!1),c.current?.focus()},className:`flex w-full items-start gap-2 rounded-lg px-2.5 py-1.5 text-left transition-colors focus-visible:outline-none ${i?`bg-surface-2/80`:`hover:bg-surface-2/50 focus-visible:bg-surface-2/50`}`,children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`block truncate text-xs text-fg-secondary`,children:[e.name,e.id===null?null:(0,H.jsxs)(`span`,{className:`text-fg-tertiary`,children:[` · `,e.id]})]}),e.description===``?null:(0,H.jsx)(`span`,{className:`block truncate text-[11px] text-fg-muted`,children:e.description})]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`w-3 shrink-0 pt-px text-[11px] text-fg-primary`,children:i?`✓`:``})]},e.value)})}):null]})}var Z=``,Q=``;function Me(e,t){return[{value:Z,name:`CLI default`,id:e.find(e=>e.isDefault)?.name??null,description:`Whatever the CLI runs when no model is set.`},...e.map(e=>({value:e.id,name:e.name,id:e.name===e.id?null:e.id,description:e.description})),...t===null?[]:[{value:t,name:t,id:null,description:`Not in the CLI's list.`}]]}function Ne(e,t){return[{value:Q,name:`Default`,id:e?.defaultEffort??null,description:`Whatever the model runs unset.`},...(e?.efforts??[]).map(e=>({value:e.id,name:e.id,id:null,description:e.description})),...t===null?[]:[{value:t,name:t,id:null,description:`Not in the model's list.`}]]}function Pe({member:t,onDone:n}){let{api:r}=g(),i=p(),a=d(t.name),o=t.model??Z,s=t.effort??Q,[c,l]=(0,V.useState)(o),[u,f]=(0,V.useState)(s),m=T({mutationFn:async()=>{c!==o&&await r.setModel(t.name,c===Z?null:c),u!==s&&await r.setEffort(t.name,u===Q?null:u)},onSettled:()=>void i.invalidateQueries({queryKey:[`members`]}),onSuccess:n}),h=a.data?.models??[],_=t.model!==void 0&&!h.some(e=>e.id===t.model)?t.model:null,v=e=>h.find(t=>e===Z?t.isDefault:t.id===e),y=v(c)?.efforts??[],b=u!==Q&&!y.some(e=>e.id===u)?u:null,x=e=>{l(e);let t=v(e)?.efforts??[];u!==Q&&!t.some(e=>e.id===u)&&f(Q)},S=c!==o||u!==s;return(0,H.jsxs)(`form`,{"aria-label":`Model of ${t.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.isPending?(0,H.jsxs)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:[`Asking `,t.cli,` for its models…`]}):a.error===null?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{label:`Model`,choices:Me(h,_),value:c,onChange:x}),y.length===0&&b===null?null:(0,H.jsx)(`div`,{className:`flex w-32 shrink-0`,children:(0,H.jsx)(X,{label:`Effort`,choices:Ne(v(c),b),value:u,onChange:f,listClassName:`right-0 w-64`})})]}):(0,H.jsxs)(`p`,{role:`alert`,className:`min-w-0 flex-1 truncate text-xs text-red-400`,children:[t.cli,` did not list its models:`,` `,a.error instanceof e?a.error.message:`the board server did not answer`]}),(0,H.jsx)(E,{onClick:n,children:`Cancel`}),(0,H.jsx)(E,{variant:`primary`,type:`submit`,disabled:m.isPending||!S||a.error!==null,children:m.isPending?`Saving…`:`Save`})]}),a.data===void 0?null:(0,H.jsxs)(`p`,{className:`text-meta`,children:[`As `,a.data.cli,` on `,a.data.runner,` lists them, where this citizen's turns run.`]}),(0,H.jsx)(P,{error:m.error})]})}var $=``;function Fe(e,t){let n=t.cli;return[e.status,e.clis.length===0?`offers no CLI yet`:e.clis.join(`, `),n!==null&&e.clis.length>0&&!e.clis.includes(n)?`has no ${n}`:``,e.capabilities.length===0?``:e.capabilities.join(`, `)].filter(e=>e!==``).join(` · `)}function Ie(e,t){return[{value:$,name:`Any runner`,id:null,description:`Pinned to the least busy runner on its next turn outside a project.`},...e.map(e=>({value:e.name,name:e.name,id:e.os,description:Fe(e,t)}))]}function Le({member:e,onDone:t}){let{api:r}=g(),i=p(),a=n(),o=e.homeRunner??$,[s,c]=(0,V.useState)(o),l=T({mutationFn:()=>r.setRunner(e.name,s===$?null:s),onSuccess:()=>{i.invalidateQueries({queryKey:[`members`]}),t()}});return(0,H.jsxs)(`form`,{"aria-label":`Runner of ${e.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),l.mutate()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[a.data===void 0?(0,H.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`Reading the runners…`}):(0,H.jsx)(X,{label:`Runner`,choices:Ie(a.data,e),value:s,onChange:c}),(0,H.jsx)(E,{onClick:t,children:`Cancel`}),(0,H.jsx)(E,{variant:`primary`,type:`submit`,disabled:l.isPending||s===o,children:l.isPending?`Saving…`:`Run here`})]}),(0,H.jsx)(`p`,{className:`text-meta`,children:`Its conversations outside projects start afresh there from its next turn; its memory and skills follow it. Project work runs where each project lives.`}),(0,H.jsx)(P,{error:l.error})]})}function Re(e){if(e.thread!==void 0)return{threadId:e.thread};let t=e.scope===`society`?null:e.scope;return e.channel===void 0?{channel:e.askedIn??i(t,`general`)}:{channel:i(t,e.channel)}}function ze({name:e,turn:t}){let{api:n}=g(),r=p(),[i,a]=(0,V.useState)(!1),o=T({mutationFn:()=>n.stopTurn(t.turnId),onSuccess:()=>{a(!1),r.invalidateQueries({queryKey:[`scheduler`]})}});return(0,H.jsxs)(`div`,{className:`border-t border-line`,children:[(0,H.jsx)(ne,{target:Re(t),initialText:`@${e} `,placeholder:t.steerable?`Message ${e} while it works`:`Message ${e} for its next turn`,className:`px-3 pt-3 pb-2`},t.turnId),t.stoppable?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-3`,children:[(0,H.jsx)(`p`,{className:`min-w-0 flex-1 text-[11px] leading-snug text-fg-muted`,children:i?`Ends the turn now. What it was shown counts as read; its stages stay held.`:t.steerable?`Posts reach the turn at its next step.`:`This runner delivers posts after the turn ends.`}),i?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(E,{onClick:()=>{a(!1),o.reset()},children:`Keep it running`}),(0,H.jsx)(E,{variant:`primary`,disabled:o.isPending,onClick:()=>{o.mutate()},children:o.isPending?`Stopping…`:`Stop the turn`})]}):(0,H.jsx)(E,{onClick:()=>a(!0),children:`Stop…`})]}):null,o.error===null?null:(0,H.jsx)(`div`,{className:`px-3 pb-3`,children:(0,H.jsx)(P,{error:o.error})})]})}function Be({member:e,scopes:t,preferred:n,running:r,paused:i,onDone:a}){let{api:o}=g(),s=p(),[c,l]=(0,V.useState)(`manual`),[u,d]=(0,V.useState)(n!==null&&t.includes(n)?n:t[0]??``),[f,m]=(0,V.useState)(``),h=(0,V.useRef)(null);(0,V.useEffect)(()=>h.current?.focus(),[]);let _=T({mutationFn:()=>o.wake({agent:e.name,project:u,kind:c,...f.trim()===``?{}:{reason:f.trim()}}),onSuccess:()=>{s.invalidateQueries({queryKey:[`scheduler`]}),a()}}),v=R(u),y=c===`reflection`?`Asks ${e.name} to reflect at ${v}: consolidate its memory, skills, and profile, and take no new work. It restarts the reflection clock.`:`Starts a turn for ${e.name} at ${v} as soon as the scheduler takes it.`,b=i?` The society is paused, so it waits until you resume.`:r.includes(u)?` ${e.name} is in a turn there now; this one follows it.`:``;return(0,H.jsxs)(`form`,{"aria-label":`Wake ${e.name}`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),_.mutate()},children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,H.jsx)(`legend`,{className:`sr-only`,children:`Kind of turn`}),[`manual`,`reflection`].map(e=>(0,H.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${c===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,H.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:c===e,onChange:()=>l(e),className:`sr-only`}),e===`manual`?`A turn`:`A reflection`]},e))]}),(0,H.jsxs)(`label`,{className:`ml-auto flex items-center gap-2 text-xs text-fg-tertiary`,children:[`at`,(0,H.jsx)(`select`,{value:u,onChange:e=>d(e.target.value),"aria-label":`Where`,className:`rounded-md bg-surface-2/60 px-2 py-1 text-xs text-fg-primary outline-none`,children:t.map(e=>(0,H.jsx)(`option`,{value:e,children:R(e)},e))})]})]}),(0,H.jsx)(`textarea`,{ref:h,value:f,rows:2,placeholder:c===`reflection`?`Anything to reflect on in particular? Optional.`:`What should it look at? It reads this as the reason it was woken.`,"aria-label":`Reason`,onChange:e=>m(e.target.value),className:`${ce} resize-none`}),(0,H.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[y,b,` Each turn costs money.`]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,H.jsx)(E,{onClick:a,children:`Cancel`}),(0,H.jsx)(E,{variant:`primary`,type:`submit`,disabled:_.isPending||u===``,children:_.isPending?`Waking…`:c===`reflection`?`Ask for a reflection`:`Wake ${e.name}`})]}),(0,H.jsx)(P,{error:_.error})]})}var Ve={working:`bg-emerald-500/15 text-emerald-300`,queued:`bg-amber-500/15 text-amber-300`,idle:`bg-surface-2 text-fg-tertiary`};function He({project:e,name:t}){let n=(r(e).data??[]).filter(e=>e.status===`claimed`&&e.claimedBy===t);return n.length===0?null:(0,H.jsx)(`ul`,{className:`mt-1.5 space-y-1`,children:n.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsxs)(D,{to:`/task/$taskId`,params:{taskId:e.id},className:`flex items-center gap-2 rounded-md text-xs text-fg-secondary hover:text-fg-primary`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,H.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,H.jsx)(`span`,{className:`max-w-[40%] shrink-0 truncate font-mono text-[11px] text-fg-muted`,children:h(e)?.name??e.stage})]})},e.id))})}function Ue(){let{name:e}=re({from:`/citizen/$name`}),{scope:t,tab:n,turn:r}=O({from:`/citizen/$name`});return(0,H.jsx)(Ge,{name:e,chosen:t??null,tab:n??`now`,turn:r??null},e)}var We=[{tab:`now`,label:`Now`},{tab:`turns`,label:`Turns`},{tab:`memory`,label:`Memory`},{tab:`history`,label:`History`}];function Ge({name:e,chosen:n,tab:r,turn:i}){let a=u(),o=s(),c=t(),d=M(),f=_(),[p,m]=(0,V.useState)(null),h=a.data?.find(t=>t.name===e);if(h===void 0)return(0,H.jsx)(I,{children:a.data===void 0?`Reading the roster…`:`There is no citizen ${e}.`});let g=l(c.data?.running??[]).filter(t=>t.agent===e),v=[...new Set(g.map(e=>e.scope))],y=g.map(e=>se(e.agent,e.scope,e)),b=l(c.data?.pending??[]).find(t=>t.agent===e),x=v.length>0?`working`:b===void 0?`idle`:`queued`,S=ae(d,e)[0],C=S?.model??h.lastModel,w=C??h.model??`CLI default`,T=h.model!==void 0&&h.model!==C?h.model:null,O=o.data?.find(e=>e.name===h.role),k=de(h),A=h.status===`active`&&h.cli!==null,j=(f.data??[]).filter(t=>t.agent===e&&t.ended===void 0).length;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(le,{leading:h.cli===null?null:(0,H.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-surface-2/70`,children:(0,H.jsx)(ee,{cli:h.cli,size:20})}),title:e,subtitle:(0,H.jsxs)(H.Fragment,{children:[h.role,` · `,w,T===null?``:` · set to ${T}`,h.effort===void 0?``:` · ${h.effort} effort`,h.homeRunner===void 0?``:` · on ${h.homeRunner}`,h.status===`retired`?` · retired`:``]}),trailing:(0,H.jsxs)(H.Fragment,{children:[j===0?null:(0,H.jsx)(D,{to:`/crons`,search:{agent:e},className:`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs text-fg-tertiary transition-colors hover:bg-surface-2/70 hover:text-fg-primary focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:j===1?`1 cron`:`${j} crons`}),A&&p===null?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(E,{onClick:()=>m(`model`),children:`Model…`}),(0,H.jsx)(E,{onClick:()=>m(`runner`),children:`Runner…`}),(0,H.jsx)(E,{onClick:()=>m(`wake`),children:`Wake…`})]}):null,(0,H.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${Ve[x]}`,children:x})]})}),p===`wake`?(0,H.jsx)(Be,{member:h,scopes:k,preferred:n?.split(`/`)[0]??S?.scope??null,running:v,paused:c.data?.paused??!1,onDone:()=>m(null)}):p===`model`?(0,H.jsx)(Pe,{member:h,onDone:()=>m(null)}):p===`runner`?(0,H.jsx)(Le,{member:h,onDone:()=>m(null)}):null,(0,H.jsx)(`nav`,{"aria-label":`Citizen views`,className:`flex gap-1 border-b border-line px-3 py-2`,children:We.map(t=>(0,H.jsx)(D,{to:`/citizen/$name`,params:{name:e},search:{...n===null?{}:{scope:n},...t.tab===`now`?{}:{tab:t.tab}},replace:!0,"aria-current":t.tab===r?`page`:void 0,className:`rounded-md px-2.5 py-1 text-xs transition-colors ${t.tab===r?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:t.label},t.tab))}),r===`turns`?(0,H.jsx)(Ae,{name:e,opened:i},i):r===`memory`?(0,H.jsx)(De,{member:h,charter:O}):r===`history`?(0,H.jsx)(Ee,{name:e}):(0,H.jsx)(qe,{name:e,chosen:n,lastTurnAt:h.lastTurnAt,state:x,runningScopes:v,runningKeys:y,runningTurns:(c.data?.turns??[]).filter(t=>t.agent===e),queuedScope:b?.scope??null})]})}function Ke(e){return e.toSorted((e,t)=>e.startedAt.localeCompare(t.startedAt))[0]}function qe({name:e,chosen:t,lastTurnAt:n,state:r,runningScopes:i,runningKeys:a,runningTurns:o,queuedScope:s}){let c=M(),l=f(5e3),{ref:u,onScroll:d}=ue(),p=ae(c,e),m=w(e,1),h=J(e,p.length===0?m.data?.at(-1):void 0),g=N(),_=e=>e.end===null&&a.includes(se(e.agent,e.scope,e)),v=t?.split(`/`)[0]??null,y=(t?.includes(`/`)===!0?p.find(e=>A(e)===t):void 0)??Ke(p.filter(e=>e.scope===v&&_(e)))??p.find(e=>A(e)===t)??Ke(p.filter(_))??p[0]??h.turn,b=e=>e.thread===void 0?e.channel===void 0?R(e.scope):`${R(e.scope)} · #${e.channel}`:`${R(e.scope)} · ${g.get(e.thread)?.title??`a thread`}`,S=y!==void 0&&_(y),C=y?.scope??i[0]??s,T=(y===void 0?void 0:o.find(e=>e.scope===y.scope&&e.thread===y.thread&&e.channel===y.channel))??(S?void 0:o[0]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`section`,{className:`border-b border-line px-4 py-3 text-xs text-fg-tertiary`,children:[(0,H.jsx)(`p`,{children:S?`In a turn at ${R(y.scope)} for ${y.fromStart?``:`at least `}${ie(y.startedAt,l)}`:i.length>0?`In a turn at ${i.map(R).join(` and `)}`:s===null?n===void 0?`No turns yet`:`Last turn ${x(n,l)}`:`Queued for a turn at ${R(s)}`}),C===null||C===`society`?null:(0,H.jsx)(He,{project:C,name:e})]}),(0,H.jsx)(`div`,{ref:u,onScroll:d,className:`flex-1 overflow-y-auto px-4 py-3`,children:y===void 0?(0,H.jsx)(I,{children:r===`working`?`The turn has not reported a step yet.`:h.loading?`Reading the last turn…`:n===void 0?`${e} has not taken a turn yet.`:`${e}'s last turn kept no steps; Turns lists every finished one.`}):(0,H.jsxs)(H.Fragment,{children:[p.length>1?(0,H.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,"aria-label":`Turns by conversation`,children:p.toSorted((e,t)=>A(e).localeCompare(A(t))).map(t=>(0,H.jsxs)(D,{to:`/citizen/$name`,params:{name:e},search:{scope:A(t)},replace:!0,"aria-current":t===y?`true`:void 0,className:`inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-[11px] transition-colors ${t===y?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[_(t)?(0,H.jsx)(`span`,{className:`size-1.5 animate-pulse rounded-full bg-emerald-400`}):null,b(t)]},A(t)))}):null,(0,H.jsxs)(`p`,{className:`text-caps`,children:[S?`This turn`:`Last turn`,` · `,b(y),` · started`,` `,y.fromStart?U(y.startedAt):`before the earliest step shown`]}),y.fromStart?null:(0,H.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`Earlier steps of this turn are no longer in the server's live buffer`,S?``:`; Turns has the whole turn`,`.`]}),(0,H.jsx)(G,{steps:y.steps}),(0,H.jsx)(_e,{turn:y,running:S,now:l})]})}),T===void 0?null:(0,H.jsx)(ze,{name:e,turn:T})]})}export{Ue as CitizenView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{L as e,M as t,Sn as n,St as r,Tn as i,_ as a,b as o,bn as s,k as c,l,t as u,ut as d,x as f,xn as p}from"./format-BORdp4w-.js";import{l as m,s as h}from"./compose-D7DOz6kC.js";import{t as g}from"./link-1v5lugnf.js";import{t as _}from"./CliIcon-DxDvRRcX.js";import{C as v,E as y,O as b,T as x,w as S}from"./index-7uInG5D9.js";import{n as C,r as w}from"./ThreadForms-RnrV7V5X.js";import{t as T}from"./Markdown-Dw04_ImA.js";import{n as E,t as D}from"./Pane-CODhA5zE.js";import{c as O,i as k}from"./citizen-aLkZ4owL.js";var A=i(n(),1),j=p(),M=`rounded-md bg-surface-2/60 px-2 py-1 text-xs text-fg-primary outline-none`;function N(e,t){return r(typeof e==`string`?new Date(e):e,t)}function P({cron:t}){let n=e(),r=S(t);if(r.kind===`thread`){let e=n.data?.find(e=>e.id===r.id)?.title??r.id;return(0,j.jsxs)(g,{to:`/thread/$threadId`,params:{threadId:r.id},className:`truncate hover:text-fg-primary`,children:[`thread “`,e,`”`]})}return r.kind===`channel`?(0,j.jsxs)(g,{to:`/c/$`,params:{_splat:r.ref},className:`hover:text-fg-primary`,children:[`#`,r.ref]}):(0,j.jsxs)(`span`,{children:[`home at `,k(r.scope)]})}function F({cron:e,next:t,member:n,zone:r,now:i}){let{api:a}=c(),o=s(),[l,d]=(0,A.useState)(!1),[f,p]=(0,A.useState)(``),v=()=>void o.invalidateQueries({queryKey:[`crons`]}),y=m({mutationFn:t=>a.pauseCron(e.id,t),onSuccess:v}),b=m({mutationFn:()=>a.removeCron(e.id,f.trim()),onSuccess:v}),S=`at`in e.schedule?`once, ${N(e.schedule.at,r)}`:`${e.schedule.cron} · ${e.schedule.timezone??r}`,E=e.ended===void 0?e.paused===void 0?t===null?`no time to come`:t.getTime()<=i?`due, waiting for its turn`:u(t.toISOString(),i):`paused`:`ended ${u(e.ended.at,i)}`,D=x(e);return(0,j.jsx)(`li`,{className:`rounded-lg`,children:(0,j.jsxs)(`details`,{className:`group`,children:[(0,j.jsxs)(`summary`,{className:`cursor-pointer list-none rounded-lg px-2 py-2 hover:bg-surface-2/40 focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none`,children:[(0,j.jsxs)(`div`,{className:`flex items-baseline gap-2 text-sm`,children:[n?.cli===void 0||n.cli===null?null:(0,j.jsx)(_,{cli:n.cli,size:13}),(0,j.jsx)(`span`,{className:`shrink-0 text-fg-secondary`,children:e.agent}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-fg-primary`,children:e.title}),(0,j.jsx)(`span`,{className:`shrink-0 text-xs ${e.paused===void 0?`text-fg-muted`:`text-amber-300`}`,title:t===null?void 0:`${N(t,r)}, ${r}`,children:E})]}),(0,j.jsxs)(`p`,{className:`mt-0.5 flex items-baseline gap-1.5 truncate text-meta`,children:[(0,j.jsx)(`code`,{className:`font-mono`,children:S}),(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,j.jsx)(P,{cron:e}),e.lastRun===void 0?null:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,j.jsxs)(`span`,{children:[`last turn `,e.lastRun.outcome,` `,u(e.lastRun.at,i)]})]}),D?(0,j.jsxs)(`span`,{className:`text-amber-300`,children:[`· `,e.failures,` failed in a row`]}):null]})]}),(0,j.jsxs)(`div`,{className:`space-y-3 px-2 pt-1 pb-3`,children:[(0,j.jsx)(`div`,{className:`rounded-lg bg-surface-2/30 px-3 py-2`,children:(0,j.jsx)(T,{text:e.note})}),(0,j.jsxs)(`p`,{className:`text-meta`,children:[`Set by `,e.createdBy,` `,u(e.createdAt,i),e.lastFiredAt===void 0?``:` · fired last ${N(e.lastFiredAt,r)}`,e.ended===void 0?``:` · ended by ${e.ended.by}: ${e.ended.reason}`]}),t===null?null:(0,j.jsxs)(`p`,{className:`text-meta`,children:[`Next `,N(t,r),` (`,r,`)`]}),e.lastRun===void 0?null:(0,j.jsx)(g,{to:`/citizen/$name`,params:{name:e.agent},search:{tab:`turns`,turn:e.lastRun.turnId},className:`text-meta underline-offset-2 hover:text-fg-primary hover:underline`,children:`Open its last turn`}),e.ended===void 0?l?(0,j.jsxs)(`form`,{"aria-label":`Remove ${e.title}`,className:`space-y-2`,onSubmit:e=>{e.preventDefault(),b.mutate()},children:[(0,j.jsx)(`input`,{value:f,"aria-label":`Why it ends`,placeholder:`Why it ends, which the cron keeps`,onChange:e=>p(e.target.value),className:C}),(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,j.jsx)(h,{onClick:()=>d(!1),children:`Cancel`}),(0,j.jsx)(h,{variant:`primary`,type:`submit`,disabled:b.isPending||f.trim()===``,children:b.isPending?`Removing…`:`Remove cron`})]}),(0,j.jsx)(w,{error:b.error})]}):(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,j.jsx)(h,{onClick:()=>y.mutate(e.paused===void 0),disabled:y.isPending,children:e.paused===void 0?`Pause`:`Resume`}),(0,j.jsx)(h,{onClick:()=>d(!0),children:`Remove…`}),(0,j.jsx)(w,{error:y.error})]}):null]})]})})}function I({zone:e,onDone:t}){let{api:n}=c(),r=s(),[i,a]=(0,A.useState)(e),o=new Intl.DateTimeFormat().resolvedOptions().timeZone,l=(0,A.useMemo)(()=>Intl.supportedValuesOf(`timeZone`),[]),u=m({mutationFn:()=>n.setTimezone(i.trim()),onSuccess:()=>{r.invalidateQueries({queryKey:[`society`]}),r.invalidateQueries({queryKey:[`crons`]}),t()}});return(0,j.jsxs)(`form`,{"aria-label":`Time zone`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),u.mutate()},children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,j.jsx)(`input`,{value:i,list:`time-zones`,spellCheck:!1,"aria-label":`Society time zone`,onChange:e=>a(e.target.value),className:`${C} min-w-0 flex-1 font-mono`}),(0,j.jsx)(`datalist`,{id:`time-zones`,children:[`UTC`,...l].map(e=>(0,j.jsx)(`option`,{value:e,children:e},e))}),o===i?null:(0,j.jsxs)(h,{onClick:()=>a(o),children:[`Use `,o]})]}),(0,j.jsx)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:`Crons that name no zone are read in it, so their times move with it, and every turn's prompt tells the time in it.`}),(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,j.jsx)(h,{onClick:t,children:`Cancel`}),(0,j.jsx)(h,{variant:`primary`,type:`submit`,disabled:u.isPending||i.trim()===``||i.trim()===e,children:u.isPending?`Saving…`:`Save`})]}),(0,j.jsx)(w,{error:u.error})]})}function L({members:e,preferred:n,zone:r,onDone:i}){let{api:a}=c(),l=s(),u=f(),p=t(),[g,_]=(0,A.useState)(e.find(e=>e.name===n)?.name??e[0]?.name??``),v=e.find(e=>e.name===g),b=v===void 0?[]:O(v),[x,S]=(0,A.useState)(b[0]??`society`),[T,E]=(0,A.useState)(``),[D,P]=(0,A.useState)(`repeats`),[F,I]=(0,A.useState)(`0 9 * * 1-5`),[L,R]=(0,A.useState)(``),[z,B]=(0,A.useState)(``),[V,H]=(0,A.useState)(``),[U,W]=(0,A.useState)(``),G=(0,A.useRef)(null);(0,A.useEffect)(()=>G.current?.focus(),[]);let K=o(3e4),q=(x===`society`?p.data?.channels??[]:u.data?.find(e=>e.slug===x)?.channels??[]).filter(e=>e!==`general`),J=D===`repeats`?{cron:F,...L.trim()===``?{}:{timezone:L.trim()}}:{at:z===``?``:new Date(z).toISOString()},Y=y(D===`once`&&z===``?{at:`invalid`}:J,r,new Date(K)),X=D===`repeats`?L.trim()===``?r:L.trim():r,Z=m({mutationFn:()=>a.createCron({agent:g,title:V.trim(),note:U.trim(),project:x,...T===``?{}:{channel:T},...J}),onSuccess:()=>{l.invalidateQueries({queryKey:[`crons`]}),i()}});return(0,j.jsxs)(`form`,{"aria-label":`New cron`,className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),Z.mutate()},children:[(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-tertiary`,children:[(0,j.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[`wakes`,(0,j.jsx)(`select`,{value:g,"aria-label":`Citizen`,onChange:t=>{let n=e.find(e=>e.name===t.target.value);_(t.target.value),S(n===void 0?d:O(n)[0]??`society`),E(``)},className:M,children:e.map(e=>(0,j.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),(0,j.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[`at`,(0,j.jsx)(`select`,{value:x,"aria-label":`Where`,onChange:e=>{S(e.target.value),E(``)},className:M,children:b.map(e=>(0,j.jsx)(`option`,{value:e,children:k(e)},e))})]}),(0,j.jsxs)(`label`,{className:`flex items-center gap-1.5`,children:[`in`,(0,j.jsxs)(`select`,{value:T,"aria-label":`Conversation`,onChange:e=>E(e.target.value),className:M,children:[(0,j.jsx)(`option`,{value:``,children:`its home`}),q.map(e=>(0,j.jsxs)(`option`,{value:e,children:[`#`,e]},e))]})]})]}),(0,j.jsx)(`input`,{ref:G,value:V,maxLength:120,"aria-label":`Title`,placeholder:`Title, such as Morning report`,onChange:e=>H(e.target.value),className:C}),(0,j.jsx)(`textarea`,{value:U,rows:3,"aria-label":`Note`,placeholder:`What to do when it fires; the citizen reads this in every turn it starts.`,onChange:e=>W(e.target.value),className:`${C} resize-none`}),(0,j.jsxs)(`fieldset`,{className:`flex gap-1`,children:[(0,j.jsx)(`legend`,{className:`sr-only`,children:`How often`}),[`repeats`,`once`].map(e=>(0,j.jsxs)(`label`,{className:`cursor-pointer rounded-md px-2.5 py-1 text-xs transition-colors has-focus-visible:ring-2 has-focus-visible:ring-fg-primary/30 ${D===e?`bg-surface-2 text-fg-primary`:`text-fg-tertiary hover:bg-surface-2/60 hover:text-fg-primary`}`,children:[(0,j.jsx)(`input`,{type:`radio`,name:`kind`,value:e,checked:D===e,onChange:()=>P(e),className:`sr-only`}),e===`repeats`?`Repeats`:`Once`]},e))]}),D===`repeats`?(0,j.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,11rem)_minmax(0,1fr)] gap-2`,children:[(0,j.jsx)(`input`,{value:F,spellCheck:!1,"aria-label":`Cron expression`,placeholder:`minute hour day month weekday`,onChange:e=>I(e.target.value),className:`${C} font-mono`}),(0,j.jsx)(`input`,{value:L,spellCheck:!1,"aria-label":`Its time zone`,placeholder:`${r}, the society's`,onChange:e=>R(e.target.value),className:`${C} font-mono`})]}):(0,j.jsx)(`input`,{type:`datetime-local`,value:z,"aria-label":`When, in this browser's time`,onChange:e=>B(e.target.value),className:C}),(0,j.jsxs)(`p`,{"aria-live":`polite`,className:`text-[11px] leading-relaxed text-fg-muted`,children:[`error`in Y?(0,j.jsx)(`span`,{className:`text-amber-300`,children:Y.error}):(0,j.jsxs)(j.Fragment,{children:[Y.times.length===1?`Fires `:`Fires next `,Y.times.map(e=>N(e,X)).join(`, `),` (`,X,`).`]}),` `,`Each fire is a turn for `,g===``?`the citizen`:g,`, which costs money.`]}),(0,j.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,j.jsx)(h,{onClick:i,children:`Cancel`}),(0,j.jsx)(h,{variant:`primary`,type:`submit`,disabled:Z.isPending||g===``||V.trim()===``||U.trim()===``||`error`in Y,children:Z.isPending?`Setting…`:`Set cron`})]}),(0,j.jsx)(w,{error:Z.error})]})}function R(){let{agent:e}=b({from:`/crons`}),n=l(),r=a(),i=t(),s=o(3e4),[c,u]=(0,A.useState)(null),d=i.data?.timezone??`UTC`,f=(n.data??[]).filter(t=>e===void 0||t.agent===e),p=v(f,d),m=f.filter(x).length,_=(r.data??[]).filter(e=>e.status===`active`&&e.cli!==null),y=e=>r.data?.find(t=>t.name===e);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(D,{title:e===void 0?`Crons`:`Crons of ${e}`,subtitle:[`${p.active.length} running`,...p.paused.length===0?[]:[`${p.paused.length} paused`],...m===0?[]:[`${m} failing`],`times in ${d}`].join(` · `),trailing:c===null?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(h,{onClick:()=>u(`zone`),children:`Time zone…`}),(0,j.jsx)(h,{onClick:()=>u(`new`),disabled:_.length===0,children:`New cron…`})]}):null}),c===`new`?(0,j.jsx)(L,{members:_,preferred:e,zone:d,onDone:()=>u(null)}):c===`zone`?(0,j.jsx)(I,{zone:d,onDone:()=>u(null)}):null,(0,j.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:[e===void 0?null:(0,j.jsx)(g,{to:`/crons`,className:`block px-2 pb-2 text-meta hover:text-fg-primary`,children:`Show every citizen's crons`}),n.error!==null&&n.data===void 0?(0,j.jsxs)(E,{children:[`The board server did not list its crons (`,n.error.message,`); one older than this interface has none.`]}):n.data===void 0?(0,j.jsx)(E,{children:`Reading the crons…`}):p.active.length+p.paused.length+p.ended.length===0?(0,j.jsx)(`p`,{className:`px-2 py-2 text-meta`,children:`No crons yet. A citizen sets one with create_cron when it needs to come back to something later; you can set one for any citizen here.`}):null,p.active.length===0?null:(0,j.jsx)(`ul`,{"aria-label":`Running`,className:`space-y-0.5`,children:p.active.map(({cron:e,next:t})=>(0,j.jsx)(F,{cron:e,next:t,member:y(e.agent),zone:d,now:s},e.id))}),p.paused.length===0?null:(0,j.jsxs)(`section`,{"aria-label":`Paused`,className:`mt-3`,children:[(0,j.jsx)(`h3`,{className:`px-2 pb-1 text-section`,children:`Paused`}),(0,j.jsx)(`ul`,{className:`space-y-0.5`,children:p.paused.map(e=>(0,j.jsx)(F,{cron:e,next:null,member:y(e.agent),zone:d,now:s},e.id))})]}),p.ended.length===0?null:(0,j.jsxs)(`details`,{className:`mt-3`,children:[(0,j.jsxs)(`summary`,{className:`cursor-pointer px-2 pb-1 text-section`,children:[`Ended (`,p.ended.length,`)`]}),(0,j.jsx)(`ul`,{"aria-label":`Ended`,className:`space-y-0.5`,children:p.ended.map(e=>(0,j.jsx)(F,{cron:e,next:null,member:y(e.agent),zone:d,now:s},e.id))})]})]})]})}export{R as CronsView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{nt as e,ut as t}from"./format-BORdp4w-.js";import{l as n}from"./index-7uInG5D9.js";function r(e){return e===`society`?`the society`:e}function i(e){return[...e.memberships,t]}function a(e){return e.startedAt===void 0?null:n(e.startedAt,Date.parse(e.ts))}var o={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`interrupted`,blocked:`blocked`,stopped:`stopped by you`};function s(e){return e.exitReason===null?e.outcome===`failed`?`failed`:`completed`:o[e.exitReason]??e.exitReason}function c(e){return e.outcome===`failed`||e.exitReason!==null&&e.exitReason!==`completed`&&e.exitReason!==`stopped`}var l=new Intl.NumberFormat(`en`,{notation:`compact`}),u=new Intl.NumberFormat(`en`);function d(e){return e.inputTokens+e.cacheReadTokens+e.cacheWriteTokens}function f(e){return`${l.format(d(e))} in · ${l.format(e.outputTokens)} out`}function p(e){return[`${u.format(d(e))} input tokens: ${u.format(e.cacheReadTokens)} read from the cache,`,`${u.format(e.cacheWriteTokens)} written to it, ${u.format(e.inputTokens)} neither;`,`${u.format(e.outputTokens)} output tokens`].join(` `)}function m(t){let n=t.flatMap(e=>e.usage===void 0?[]:[e.usage]);return{turns:t.length,failed:t.filter(c).length,usage:n.length===0?null:n.reduce(e),withUsage:n.length}}function h(e,t){let n=/^\s*#{1,6}\s+(.+?)\s*(?:\n|$)/.exec(e);return n?.[1]?.toLowerCase()===t.toLowerCase()?e.slice(n[0].length).trim():e}function g(e,t){let n=[...e.homeRunner===void 0?[]:[{what:`outside projects`,runner:e.homeRunner}],...e.memberships.map(e=>({what:e,runner:t.get(e)}))],r=[...new Set(n.flatMap(e=>e.runner===void 0?[]:[e.runner]))],i=n.map(e=>`${e.what}: ${e.runner??`placed on its first turn`}`).join(`; `);return{label:r.length===0?`no runner yet`:`on ${r.join(`, `)}`,detail:i===``?`pinned to a runner on its first turn`:i}}export{p as a,i as c,r as i,h as l,m as n,f as o,g as r,a as s,s as t};
|