@kubitnodes/stellaris 0.3.12 → 0.3.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/cli/index.js +55 -3
  2. package/dist/server/index.js +171 -8
  3. package/package.json +1 -1
  4. package/web/dist/assets/{BackLink-BlJvN2RA.js → BackLink-d0xz7ZLb.js} +1 -1
  5. package/web/dist/assets/{ChannelForms-CmFxBXNK.js → ChannelForms-BIRwT9CY.js} +1 -1
  6. package/web/dist/assets/{ChannelView-4s--IwKC.js → ChannelView-BvMlzMiN.js} +1 -1
  7. package/web/dist/assets/{CitizenView-B5-LVVCG.js → CitizenView-DNQwjpIp.js} +1 -1
  8. package/web/dist/assets/{CitizensView-B8lVGSBD.js → CitizensView-Bv04iH-y.js} +1 -1
  9. package/web/dist/assets/{CliIcon-CT5ljQDC.js → CliIcon-tYTwI_RQ.js} +1 -1
  10. package/web/dist/assets/{KnowledgeView-DbI8DIZb.js → KnowledgeView-L0pdaM_2.js} +1 -1
  11. package/web/dist/assets/{Markdown-B5zEdYuO.js → Markdown-BLiIulgZ.js} +1 -1
  12. package/web/dist/assets/{MessageItem-DuxSZwn0.js → MessageItem-CHrmjF7P.js} +1 -1
  13. package/web/dist/assets/{MetricsView-D8D-y-sz.js → MetricsView-DG1alTgs.js} +1 -1
  14. package/web/dist/assets/{NeedsYouView-Buwq8-_l.js → NeedsYouView-Doc0fKPi.js} +1 -1
  15. package/web/dist/assets/{Overview-CrQ8ybpq.js → Overview-ChsOgIEW.js} +1 -1
  16. package/web/dist/assets/{Pane-CFoSKOo5.js → Pane-MJgGXQBb.js} +1 -1
  17. package/web/dist/assets/{ProjectView-BBQg-ZxC.js → ProjectView-CQTn7yDo.js} +1 -1
  18. package/web/dist/assets/{ProposalView-BjPHVxj4.js → ProposalView-C92OJ_w1.js} +1 -1
  19. package/web/dist/assets/{ProposalsView-DjyZpZe0.js → ProposalsView-CSA8neXR.js} +1 -1
  20. package/web/dist/assets/{RunnersView-2h5NWUuD.js → RunnersView-Dx21LDFu.js} +1 -1
  21. package/web/dist/assets/{SocietyView-BuaSb_3d.js → SocietyView-CdVW2DgG.js} +1 -1
  22. package/web/dist/assets/{SubjectThread-C1mHvHMI.js → SubjectThread-egXeFhT1.js} +1 -1
  23. package/web/dist/assets/{TaskFileView-CeEzbSCL.js → TaskFileView-BqqzxJKb.js} +1 -1
  24. package/web/dist/assets/{TaskView-yL9hCM7G.js → TaskView-rks26vuF.js} +2 -2
  25. package/web/dist/assets/{TasksView-DCVU5oZn.js → TasksView-Ba5fPAvy.js} +1 -1
  26. package/web/dist/assets/{ThreadCard-CXXf9qfA.js → ThreadCard-D6i69_15.js} +1 -1
  27. package/web/dist/assets/{ThreadForms-CTBaAJ57.js → ThreadForms-ChTFRu-P.js} +1 -1
  28. package/web/dist/assets/{ThreadView-zg8KqF3t.js → ThreadView-CnJPNS_8.js} +1 -1
  29. package/web/dist/assets/{citizen-CImM6WB6.js → citizen-D-dxX00V.js} +1 -1
  30. package/web/dist/assets/{compose-BG_-Tp87.js → compose-BgpUWGYE.js} +1 -1
  31. package/web/dist/assets/{format-BWr3zKWg.js → format-C3aawMM6.js} +1 -1
  32. package/web/dist/assets/{governance-cDTg2_iq.js → governance-Di4MijNG.js} +1 -1
  33. package/web/dist/assets/{index-Cxqhrg2v.js → index-krHkeIbX.js} +3 -3
  34. package/web/dist/assets/{link-CFdt17Sp.js → link-DAMxBItI.js} +1 -1
  35. package/web/dist/assets/{tasks-C10zwkED.js → tasks-bwj_EdwF.js} +1 -1
  36. package/web/dist/assets/{useMatch-BpnmzT6s.js → useMatch-B-8IcuU6.js} +1 -1
  37. package/web/dist/assets/{useStickyScroll-BjqdEt_f.js → useStickyScroll-BILPUgGj.js} +1 -1
  38. package/web/dist/index.html +8 -8
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChannelView-4s--IwKC.js","assets/format-BWr3zKWg.js","assets/compose-BG_-Tp87.js","assets/mentions-BCdV0bMK.js","assets/ThreadForms-CTBaAJ57.js","assets/ChannelForms-CmFxBXNK.js","assets/link-CFdt17Sp.js","assets/MessageItem-DuxSZwn0.js","assets/tasks-C10zwkED.js","assets/Markdown-B5zEdYuO.js","assets/Pane-CFoSKOo5.js","assets/ThreadCard-CXXf9qfA.js","assets/useStickyScroll-BjqdEt_f.js","assets/ThreadView-zg8KqF3t.js","assets/BackLink-BlJvN2RA.js","assets/SocietyView-BuaSb_3d.js","assets/Overview-CrQ8ybpq.js","assets/CliIcon-CT5ljQDC.js","assets/citizen-CImM6WB6.js","assets/ProjectView-BBQg-ZxC.js","assets/KnowledgeView-DbI8DIZb.js","assets/TasksView-DCVU5oZn.js","assets/TaskView-yL9hCM7G.js","assets/governance-cDTg2_iq.js","assets/SubjectThread-C1mHvHMI.js","assets/TaskFileView-CeEzbSCL.js","assets/MetricsView-D8D-y-sz.js","assets/CitizensView-B8lVGSBD.js","assets/NeedsYouView-Buwq8-_l.js","assets/RunnersView-2h5NWUuD.js","assets/ProposalsView-DjyZpZe0.js","assets/ProposalView-BjPHVxj4.js","assets/CitizenView-B5-LVVCG.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,$t as t,At as n,B as r,Bt as i,C as a,Dt as o,E as s,Et as c,F as l,Ft as u,G as d,Gt as f,H as p,Ht as m,I as h,It as g,K as _,Lt as v,M as y,Mt as b,Nt as x,O as S,Ot as C,Pt as w,Qt as T,Rt as ee,S as te,Tt as E,U as ne,Ut as re,V as ie,Vt as ae,W as oe,Wt as se,X as ce,Xt as le,Y as ue,Z as de,Zt as fe,_n as pe,an as me,b as he,c as ge,dn as _e,dt as ve,en as ye,et as be,fn as D,ft as O,g as xe,h as Se,hn as Ce,i as we,in as Te,j as k,jt as Ee,k as De,kt as Oe,lt as ke,mn as Ae,n as je,nn as Me,nt as Ne,on as Pe,pn as Fe,q as Ie,qt as Le,r as Re,rn as ze,s as Be,sn as Ve,t as He,tn as Ue,u as We,un as Ge,w as Ke,y as qe,z as Je,zt as Ye}from"./format-BWr3zKWg.js";import{a as Xe,c as Ze,i as Qe,l as $e,n as et,o as tt,r as nt,s as rt,t as it,u as at}from"./compose-BG_-Tp87.js";import{i as ot,n as st,r as ct,t as lt}from"./useMatch-BpnmzT6s.js";import{a as ut,c as dt,i as ft,l as pt,n as mt,o as ht,r as gt,s as _t,t as vt}from"./link-CFdt17Sp.js";import{n as yt,r as bt,t as xt}from"./CliIcon-CT5ljQDC.js";import{a as St,n as Ct,r as wt,s as Tt,t as Et}from"./tasks-C10zwkED.js";import{a as Dt,d as Ot}from"./governance-cDTg2_iq.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 kt=class extends t{#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 at({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=At(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=At(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=At(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=At(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){fe.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=>ze(t,e))}findAll(e={}){return this.getAll().filter(t=>ze(e,t))}notify(e){fe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return fe.batch(()=>Promise.all(e.map(e=>e.continue().catch(me))))}};function At(e){return e.options.scope?.id}var jt=class extends t{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Me(r,t),a=this.get(i);return a||(a=new Le({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(){fe.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=>Te(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Te(e,t)):t}notify(e){fe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Mt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new jt,this.#t=e.mutationCache||new kt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=T.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=le.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(Ve(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=ye(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return fe.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;fe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return fe.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=fe.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(me).catch(me)}invalidateQueries(e,t={}){return fe.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=fe.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(me)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(me)}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(Ve(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(Ve(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(me).catch(me)}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(me).catch(me)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return le.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(Ue(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Pe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ue(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Pe(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||=Me(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===Ge&&(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()}},Nt=Ce((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,E());else{var t=n(l);t!==null&&ie(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function te(){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&&ee());){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?E():S=!1}}}var E;if(typeof y==`function`)E=function(){y(te)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=te,E=function(){re.postMessage(null)}}else E=function(){_(te,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,E()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Pt=Ce(((e,t)=>{t.exports=Nt()})),Ft=Ce((e=>{var t=Ae();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`})),It=Ce(((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=Ft()})),Lt=Ce((e=>{var t=Pt(),n=Ae(),r=It();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`),ee=Symbol.for(`react.transitional.element`),te=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),ne=Symbol.for(`react.strict_mode`),re=Symbol.for(`react.profiler`),ie=Symbol.for(`react.consumer`),ae=Symbol.for(`react.context`),oe=Symbol.for(`react.forward_ref`),se=Symbol.for(`react.suspense`),ce=Symbol.for(`react.suspense_list`),le=Symbol.for(`react.memo`),ue=Symbol.for(`react.lazy`),de=Symbol.for(`react.activity`),fe=Symbol.for(`react.legacy_hidden`),pe=Symbol.for(`react.memo_cache_sentinel`),me=Symbol.for(`react.view_transition`),he=Symbol.for(`react.recoverable`),ge=Symbol.iterator;function _e(e){return typeof e!=`object`||!e?null:(e=ge&&e[ge]||e[`@@iterator`],typeof e==`function`?e:null)}var ve=Symbol.for(`react.client.reference`);function ye(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ve?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case re:return`Profiler`;case ne:return`StrictMode`;case se:return`Suspense`;case ce:return`SuspenseList`;case de:return`Activity`;case me:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case te:return`Portal`;case ae:return e.displayName||`Context`;case ie:return(e._context.displayName||`Context`)+`.Consumer`;case oe:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case le:return t=e.displayName||null,t===null?ye(e.type)||`Memo`:t;case ue:t=e._payload,e=e._init;try{return ye(e(t))}catch{}}return null}var be=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,xe={pending:!1,data:null,method:null,action:null},Se=[],Ce=-1;function we(e){return{current:e}}function Te(e){0>Ce||(e.current=Se[Ce],Se[Ce]=null,Ce--)}function k(e,t){Ce++,Se[Ce]=e.current,e.current=t}var Ee=we(null),De=we(null),Oe=we(null),ke=we(null);function je(e,t){switch(k(Oe,t),k(De,e),k(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}}Te(Ee),k(Ee,e)}function Me(){Te(Ee),Te(De),Te(Oe)}function Ne(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,k(ke,e)),t=Ee.current;var n=dp(t,e.type);t!==n&&(k(De,e),k(Ee,n))}function Pe(e){De.current===e&&(Te(Ee),Te(De)),ke.current===e&&(Te(ke),sh._currentValue=xe)}var Fe,Ie;function Le(e){if(Fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Fe=t&&t[1]||``,Ie=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChannelView-BvMlzMiN.js","assets/format-C3aawMM6.js","assets/compose-BgpUWGYE.js","assets/mentions-BCdV0bMK.js","assets/ThreadForms-ChTFRu-P.js","assets/ChannelForms-BIRwT9CY.js","assets/link-DAMxBItI.js","assets/MessageItem-CHrmjF7P.js","assets/tasks-bwj_EdwF.js","assets/Markdown-BLiIulgZ.js","assets/Pane-MJgGXQBb.js","assets/ThreadCard-D6i69_15.js","assets/useStickyScroll-BILPUgGj.js","assets/ThreadView-CnJPNS_8.js","assets/BackLink-d0xz7ZLb.js","assets/SocietyView-CdVW2DgG.js","assets/Overview-ChsOgIEW.js","assets/CliIcon-tYTwI_RQ.js","assets/citizen-D-dxX00V.js","assets/ProjectView-CQTn7yDo.js","assets/KnowledgeView-L0pdaM_2.js","assets/TasksView-Ba5fPAvy.js","assets/TaskView-rks26vuF.js","assets/governance-Di4MijNG.js","assets/SubjectThread-egXeFhT1.js","assets/TaskFileView-BqqzxJKb.js","assets/MetricsView-DG1alTgs.js","assets/CitizensView-Bv04iH-y.js","assets/NeedsYouView-Doc0fKPi.js","assets/RunnersView-Dx21LDFu.js","assets/ProposalsView-CSA8neXR.js","assets/ProposalView-C92OJ_w1.js","assets/CitizenView-DNQwjpIp.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,$t as t,At as n,B as r,Bt as i,C as a,Dt as o,E as s,Et as c,F as l,Ft as u,G as d,Gt as f,H as p,Ht as m,I as h,It as g,K as _,Lt as v,M as y,Mt as b,Nt as x,O as S,Ot as C,Pt as w,Qt as T,Rt as ee,S as te,Tt as E,U as ne,Ut as re,V as ie,Vt as ae,W as oe,Wt as se,X as ce,Xt as le,Y as ue,Z as de,Zt as fe,_n as pe,an as me,b as he,c as ge,dn as _e,dt as ve,en as ye,et as be,fn as D,ft as O,g as xe,h as Se,hn as Ce,i as we,in as Te,j as k,jt as Ee,k as De,kt as Oe,lt as ke,mn as Ae,n as je,nn as Me,nt as Ne,on as Pe,pn as Fe,q as Ie,qt as Le,r as Re,rn as ze,s as Be,sn as Ve,t as He,tn as Ue,u as We,un as Ge,w as Ke,y as qe,z as Je,zt as Ye}from"./format-C3aawMM6.js";import{a as Xe,c as Ze,i as Qe,l as $e,n as et,o as tt,r as nt,s as rt,t as it,u as at}from"./compose-BgpUWGYE.js";import{i as ot,n as st,r as ct,t as lt}from"./useMatch-B-8IcuU6.js";import{a as ut,c as dt,i as ft,l as pt,n as mt,o as ht,r as gt,s as _t,t as vt}from"./link-DAMxBItI.js";import{n as yt,r as bt,t as xt}from"./CliIcon-tYTwI_RQ.js";import{a as St,n as Ct,r as wt,s as Tt,t as Et}from"./tasks-bwj_EdwF.js";import{a as Dt,d as Ot}from"./governance-Di4MijNG.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 kt=class extends t{#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 at({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=At(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=At(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=At(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=At(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){fe.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=>ze(t,e))}findAll(e={}){return this.getAll().filter(t=>ze(e,t))}notify(e){fe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return fe.batch(()=>Promise.all(e.map(e=>e.continue().catch(me))))}};function At(e){return e.options.scope?.id}var jt=class extends t{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??Me(r,t),a=this.get(i);return a||(a=new Le({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(){fe.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=>Te(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Te(e,t)):t}notify(e){fe.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){fe.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){fe.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Mt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new jt,this.#t=e.mutationCache||new kt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=T.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=le.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(Ve(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=ye(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return fe.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;fe.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return fe.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=fe.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(me).catch(me)}invalidateQueries(e,t={}){return fe.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=fe.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(me)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(me)}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(Ve(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(Ve(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(me).catch(me)}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(me).catch(me)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return le.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(Ue(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Pe(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(Ue(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Pe(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||=Me(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===Ge&&(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()}},Nt=Ce((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,E());else{var t=n(l);t!==null&&ie(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function ee(){return g?!0:!(e.unstable_now()-T<w)}function te(){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&&ee());){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?E():S=!1}}}var E;if(typeof y==`function`)E=function(){y(te)};else if(typeof MessageChannel<`u`){var ne=new MessageChannel,re=ne.port2;ne.port1.onmessage=te,E=function(){re.postMessage(null)}}else E=function(){_(te,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,E()))),r},e.unstable_shouldYield=ee,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Pt=Ce(((e,t)=>{t.exports=Nt()})),Ft=Ce((e=>{var t=Ae();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`})),It=Ce(((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=Ft()})),Lt=Ce((e=>{var t=Pt(),n=Ae(),r=It();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`),ee=Symbol.for(`react.transitional.element`),te=Symbol.for(`react.portal`),E=Symbol.for(`react.fragment`),ne=Symbol.for(`react.strict_mode`),re=Symbol.for(`react.profiler`),ie=Symbol.for(`react.consumer`),ae=Symbol.for(`react.context`),oe=Symbol.for(`react.forward_ref`),se=Symbol.for(`react.suspense`),ce=Symbol.for(`react.suspense_list`),le=Symbol.for(`react.memo`),ue=Symbol.for(`react.lazy`),de=Symbol.for(`react.activity`),fe=Symbol.for(`react.legacy_hidden`),pe=Symbol.for(`react.memo_cache_sentinel`),me=Symbol.for(`react.view_transition`),he=Symbol.for(`react.recoverable`),ge=Symbol.iterator;function _e(e){return typeof e!=`object`||!e?null:(e=ge&&e[ge]||e[`@@iterator`],typeof e==`function`?e:null)}var ve=Symbol.for(`react.client.reference`);function ye(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ve?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case re:return`Profiler`;case ne:return`StrictMode`;case se:return`Suspense`;case ce:return`SuspenseList`;case de:return`Activity`;case me:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case te:return`Portal`;case ae:return e.displayName||`Context`;case ie:return(e._context.displayName||`Context`)+`.Consumer`;case oe:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case le:return t=e.displayName||null,t===null?ye(e.type)||`Memo`:t;case ue:t=e._payload,e=e._init;try{return ye(e(t))}catch{}}return null}var be=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,xe={pending:!1,data:null,method:null,action:null},Se=[],Ce=-1;function we(e){return{current:e}}function Te(e){0>Ce||(e.current=Se[Ce],Se[Ce]=null,Ce--)}function k(e,t){Ce++,Se[Ce]=e.current,e.current=t}var Ee=we(null),De=we(null),Oe=we(null),ke=we(null);function je(e,t){switch(k(Oe,t),k(De,e),k(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}}Te(Ee),k(Ee,e)}function Me(){Te(Ee),Te(De),Te(Oe)}function Ne(e){var t=e.memoizedState;t!==null&&(sh._currentValue=t.memoizedState,k(ke,e)),t=Ee.current;var n=dp(t,e.type);t!==n&&(k(De,e),k(Ee,n))}function Pe(e){De.current===e&&(Te(Ee),Te(De)),ke.current===e&&(Te(ke),sh._currentValue=xe)}var Fe,Ie;function Le(e){if(Fe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Fe=t&&t[1]||``,Ie=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Fe+e+Ie}var Re=!1;function ze(e,t){if(!e||Re)return``;Re=!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(`
5
5
  `),l=s.split(`
@@ -20,4 +20,4 @@ Error generating stack: `+e.message+`
20
20
  `)){let n=Wa(o.slice(0,t));o=o.slice(t+2),n!==``&&e.onData(n)}e.onBatch?.()}}catch{if(n.aborted)return}i=!0,await Ua(r,n),r=Math.min(r*2,15e3)}})(),()=>t.abort()}function Ka(e,t,n={}){return de(e,t,ue(n))}function qa(e){let t=ue(e);return t===void 0?e.scope:`${e.scope}/${t}`}function Ja(e,t){return[...e.values()].filter(e=>e.agent===t).toSorted((e,t)=>t.lastAt.localeCompare(e.lastAt))}var Ya=400,Xa=400,Za=4e3,Qa=/^\[([^\]]*)\] (.*?) from @([a-z0-9][a-z0-9-]*)(?:, who .*?)? \(message [0-9A-Z]+\)$/;function $a(e){let t=e.split(/^### /m).slice(1).flatMap(e=>{let[t=``,...n]=e.split(`
21
21
  `),r=Qa.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 eo(e){let t=/^mcp__(.+?)__(.+)$/.exec(e);return t===null?e:t[1]===`board`?t[2]??e:`${t[1]}:${t[2]}`}function to(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function no(e){return e.replaceAll(/\s+/g,` `).trim()}function ro(e){return e.split(`
23
- `).map(e=>e.trim()).find(e=>e.length>0)??``}function io(e){return/^\/bin\/(?:ba)?sh -lc (["'])([\s\S]*)\1$/.exec(e.trim())?.[2]??e}function ao(e){return typeof e==`object`&&e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):{}}var oo=[`file_path`,`path`,`url`,`query`,`pattern`,`description`,`prompt`];function so(e){let t=ao(e),n=t.command;if(typeof n==`string`){let e=io(n);return{summary:to(no(e),Xa),detail:to(e,Za)}}let r=to(JSON.stringify(e??null,null,2),Za),i=t.changes;if(Array.isArray(i))return{summary:to(i.map(e=>ao(e).path).filter(e=>typeof e==`string`).join(`, `),Xa),detail:r};let a=oo.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:to(no(a??o.slice(0,3).join(` · `)),Xa),detail:r}}var co=`StructuredOutput`;function lo(e,t){try{return ao(JSON.parse(e)).summary===t}catch{return!1}}function uo(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 fo(e,t,{maxSteps:n}={maxSteps:Ya}){let{event:r}=t,i=Ka(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,uo(c,{kind:`say`,seq:t.seq,at:t.ts,text:r.delta},n));break;case`tool_call`:if(r.name===co)break;o.set(i,uo(c,{kind:`tool`,seq:t.seq,at:t.ts,name:r.name,...so(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,uo(c,{kind:`error`,seq:t.seq,at:t.ts,message:r.message},n));break;case`steered`:o.set(i,uo(c,{kind:`steer`,seq:t.seq,at:t.ts,...$a(r.text??``)},n));break;case`turn_completed`:{let e=r.status?.summary??null,n=c.steps.at(-1),a=n?.kind===`say`&&e!==null&&lo(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 po(e,t,n,r={}){let i=new Map;for(let[a,o]of e.entries())i=fo(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(Ka(t,n,r))}function mo(e,t){if(eo(e)!==`post_message`)return null;let n=ao(t).body,r=typeof n==`string`?ro(n).replace(/^[#>*\-\s]+/,``):``;return r===``?null:to(r,Xa)}function ho(e){let t=e.steps.at(-1);return t===void 0?null:t.kind===`tool`?`${eo(t.name)} · ${t.summary}`:t.kind===`steer`?`took ${go(t.posts.length)}${t.from.length===0?``:` from ${t.from.join(`, `)}`}`:to(ro(t.kind===`say`?t.text:t.message),Xa)}function go(e){return e===1?`1 post`:`${e} posts`}function _o(e,t){return Re(t-Date.parse(e))}var vo=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 Ga({token:e,url:()=>`/api/turns/stream?since=0`,onOpen:()=>{this.turns=new Map,this.emit()},onData:e=>{let t=be.safeParse(JSON.parse(e));if(t.success){this.turns=fo(this.turns,t.data);for(let e of this.eventListeners)e(t.data)}},onBatch:()=>this.emit()})}emit(){for(let e of this.listeners)e()}},yo=(0,A.createContext)(null);function bo(){let e=(0,A.useContext)(yo);if(e===null)throw Error(`useLiveTurns needs a LiveContext`);return(0,A.useSyncExternalStore)(e.subscribe,e.snapshot)}function xo({activeCitizen:e,activeScope:t}){let n=s(),r=xe(),i=bo(),a=za(),o=qe(5e3),c=ne(n.data?.running??[]),l=n.data?.pending.length??0;return(0,M.jsxs)(`section`,{"aria-label":`Working now`,className:`mt-3`,children:[(0,M.jsxs)(`h3`,{className:`flex items-center justify-between px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[(0,M.jsx)(`span`,{children:`Working now`}),l>0?(0,M.jsxs)(`span`,{className:`font-normal tracking-normal normal-case`,children:[l,` queued`]}):null]}),c.length===0?(0,M.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`Nobody is in a turn.`}):(0,M.jsx)(`ul`,{children:c.map(({agent:n,scope:s,thread:c,channel:l})=>{let u=i.get(Ka(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?ho(u):null,m=qa({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,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{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,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,M.jsxs)(`span`,{className:`relative grid size-4 shrink-0 place-items-center`,children:[f===null?null:(0,M.jsx)(xt,{cli:f,size:13}),(0,M.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 size-1.5 animate-pulse rounded-full bg-emerald-400`})]}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:_===null?g:`${g} · ${_}`}),d?(0,M.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,children:[u.fromStart?``:`≥ `,_o(u.startedAt,o)]}):null]}),(0,M.jsx)(`span`,{className:`mt-0.5 block truncate pl-5.5 text-[11px] text-fg-muted`,children:p===null?`Starting…`:(0,M.jsx)(Ha,{text:p,links:!1})})]})},m===s?`${n}/${s}`:`${n}/${m}`)})})]})}var So=`flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors`;function Co(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 wo=`bg-surface-2/80 text-fg-primary`,To=`text-fg-secondary hover:bg-surface-2/50 hover:text-fg-primary`;function Eo({slug:e,active:t}){let n=(l(e).data??[]).filter(St).length;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/p/$slug/tasks`,params:{slug:e},className:`${So} ${t?wo:To}`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`tasks`}),n>0?(0,M.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 Do({value:e,title:t}){return e===0?null:(0,M.jsx)(`span`,{title:t,className:`rounded-md bg-amber-500/15 px-1.5 text-[11px] text-amber-300`,children:e})}function Oo({active:e}){let t=(te().data??[]).filter(Ot).length,n=Ea().length;return(0,M.jsxs)(`section`,{"aria-label":`Governance`,className:`mt-3`,children:[(0,M.jsx)(`h3`,{className:`px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:`Governance`}),(0,M.jsxs)(`ul`,{children:[(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/needs-you`,className:`${So} ${e===`needs-you`?wo:To}`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◉`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`needs you`}),(0,M.jsx)(Do,{value:n,title:`${n} waiting on you`})]})}),(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/proposals`,className:`${So} ${e===`proposals`?wo:To}`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◈`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`proposals`}),(0,M.jsx)(Do,{value:t,title:`${t} waiting on you`})]})})]})]})}function ko({activeChannel:e,activeTasks:t,activeCitizen:n,activeScope:r,activeGovernance:i,activeOverview:a}){let o=ge(),s=he(),c=h(),l=Sa();(0,A.useEffect)(()=>{o.data!==void 0&&Ca(o.data.map(e=>[e.ref,e.lastMessageId]))},[o.data]);let u=(0,A.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,A.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,A.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,M.jsxs)(ma,{label:`Board navigator`,className:`top-[72px] bottom-4 left-4 w-64`,children:[(0,M.jsxs)(`header`,{className:`flex items-center justify-between px-4 pt-4 pb-1`,children:[(0,M.jsx)(`span`,{className:`text-caps`,children:`Board`}),(0,M.jsx)(vt,{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,M.jsxs)(`nav`,{className:`flex-1 overflow-y-auto px-2 pb-3`,children:[(0,M.jsx)(xo,{activeCitizen:n,activeScope:r}),(0,M.jsx)(Oo,{active:i}),f.map(n=>(0,M.jsxs)(`section`,{className:`mt-3`,children:[(0,M.jsx)(`h3`,{className:`pb-1`,children:n.project===null?(0,M.jsx)(vt,{to:`/society`,className:Co(a===n.key),children:n.label}):(0,M.jsx)(vt,{to:`/p/$slug`,params:{slug:n.project},className:Co(a===n.key),children:n.label})}),(0,M.jsxs)(`ul`,{children:[n.channels.map(t=>{let n=t.ref===e,r=p.get(t.ref)??0,i=!n&&Ta(l,t.ref,t.lastMessageId);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/c/$`,params:{_splat:t.ref},className:`${So} ${n?wo:To}`,children:[(0,M.jsx)(`span`,{className:`text-fg-muted`,children:`#`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate ${i?`font-semibold`:``}`,children:t.name}),r>0?(0,M.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,M.jsx)(`span`,{"aria-label":`new messages`,className:`size-1.5 rounded-full bg-emerald-400`}):null]})},t.ref)}),n.project===null?null:(0,M.jsx)(Eo,{slug:n.project,active:n.project===t})]})]},n.key)),d.length===0?null:(0,M.jsxs)(`section`,{"aria-label":`Archived projects`,className:`mt-3`,children:[(0,M.jsx)(`h3`,{className:`px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:`Archived`}),(0,M.jsx)(`ul`,{children:d.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/p/$slug`,params:{slug:e.slug},className:`${So} ${a===e.slug?wo:To}`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`▫`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]})},e.slug))})]})]})]})}var Ao=(0,A.createContext)(void 0);function jo(e,t){let n=new URL(e);return n.searchParams.set(n.hostname===`github.com`?`size`:`s`,String(t)),n.href}function Mo({name:e,members:t}){let n=(0,A.useContext)(Ao),r=t?.find(t=>t.name===e)?.cli??null;return r===null?e===`user`&&n!==void 0?(0,M.jsx)(`img`,{src:jo(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,M.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,M.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,M.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface-2/80`,children:(0,M.jsx)(xt,{cli:r,size:16})})}function No({name:e,members:t}){let n=t?.find(t=>t.name===e)?.cli??null;return(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 align-middle`,children:[n===null?null:(0,M.jsx)(xt,{cli:n,size:12}),(0,M.jsx)(`span`,{className:`text-fg-secondary`,children:e})]})}function Po(e,t){return e===`user`?t?.login??`you`:e}function Fo(){let e=(0,A.useContext)(Ao);return t=>Po(t,e)}var Io=6;function Lo({target:e,placeholder:t,initialText:n=``,oneLine:r=!1,className:i=`border-t border-line p-3`,focusOnOpen:a=!1,onPosted:o,onEmptyEscape:c}){let{api:l}=S(),u=D(),d=xe(),f=Ke(),p=s(),[m,h]=(0,A.useState)(n),[g,_]=(0,A.useState)(0),[v,y]=(0,A.useState)(0),[b,x]=(0,A.useState)(!1),C=(0,A.useRef)(null),w=(0,A.useRef)(null),T=$e({mutationFn:async t=>{if(`channel`in e)return l.sendMessage({channel:e.channel,body:t});if(`threadId`in e)return l.sendMessage({thread_id:e.threadId,body:t});let n=await l.openThread({channel:Ne,title:P(t)});return l.sendMessage({thread_id:n.id,body:t})},onSuccess:t=>{h(n),u.invalidateQueries({queryKey:t.thread===void 0?[`channel`,t.channel]:[`thread`,t.thread]}),`ask`in e&&u.invalidateQueries({queryKey:[`threads`]}),u.invalidateQueries({queryKey:[`requests`]}),o?.(t)}});(0,A.useEffect)(()=>{a&&C.current?.focus()},[a]),(0,A.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 ee=b?null:nt(m,g),te=(d.data??[]).filter(e=>e.status===`active`&&e.cli!==null),E=ee===null?[]:te.filter(e=>e.name.startsWith(ee.prefix)).slice(0,Io),ne=tt(m,d.data??[],f.data??[]),re=`ask`in e?[]:Qe(ne,d.data??[],p.data?.turns??[],`channel`in e?{channel:e.channel}:{thread:e.threadId}),ie=Xe(re,ne.filter(e=>!re.includes(e))),ae=e=>{if(ee===null)return;let t=it(m,g,ee.start,e);w.current=t.caret,h(t.text),_(t.caret)},oe=()=>{m.trim()!==``&&m.trim()!==n.trim()&&!T.isPending&&T.mutate(m.trim())},se=e=>{if(E.length>0){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:E.length-1;y((v+t)%E.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),ae(E[Math.min(v,E.length-1)]?.name??``);return}if(e.key===`Escape`){e.preventDefault(),x(!0);return}}if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){e.preventDefault(),oe();return}e.key===`Escape`&&m===``&&c!==void 0&&(e.preventDefault(),c())},ce=(0,M.jsx)(rt,{variant:`primary`,type:`submit`,disabled:m.trim()===``||m.trim()===n.trim()||T.isPending,children:T.isPending?`Sending…`:`Send`});return(0,M.jsxs)(`form`,{className:i,onSubmit:e=>{e.preventDefault(),oe()},children:[(0,M.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)] ${r?`flex items-end gap-2 pr-1.5`:``}`,children:[E.length>0?(0,M.jsx)(`ul`,{"aria-label":`Citizens to mention`,className:`card absolute bottom-full left-2 mb-2 w-60 overflow-hidden py-1`,children:E.map((e,t)=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),ae(e.name)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${t===v?`bg-surface-2 text-fg-primary`:`text-fg-secondary`}`,children:[e.cli===null?null:(0,M.jsx)(xt,{cli:e.cli,size:14}),(0,M.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),(0,M.jsx)(`span`,{className:`truncate font-mono text-[11px] text-fg-muted`,children:e.role})]})},e.name))}):null,(0,M.jsx)(`textarea`,{ref:C,rows:1,value:m,placeholder:t,"aria-label":t,onChange:e=>{h(e.target.value),_(e.target.selectionStart),y(0),x(!1)},onSelect:e=>_(e.currentTarget.selectionStart),onKeyDown:se,className:`block max-h-48 w-full resize-none bg-transparent px-3 text-sm text-fg-primary outline-none placeholder:text-fg-muted ${r?`py-2.5`:`pt-2.5 pb-1`}`}),r?(0,M.jsx)(`div`,{className:`shrink-0 pb-1.5`,children:ce}):(0,M.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-2`,children:[(0,M.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:ie??`Enter to send · Shift+Enter for a new line`}),ce]})]}),T.error===null?null:(0,M.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-red-400`,children:T.error instanceof Je?T.error.message:`The message was not sent.`})]})}var Ro=5;function zo(e,t,n){switch(e.kind){case`answering`:return{text:`${et(e.who)} ${e.who.length===1?`is`:`are`} answering…`,tone:`text-emerald-300`};case`queued`:return{text:`${et(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 Bo({left:e,width:t,onClose:n}){let r=h(),i=s(),a=Sa(),o=qe(3e4),c=Fo(),l=(0,A.useRef)(null),u=N(r.data??[]).slice(0,Ro),d=ne(i.data?.running??[]),f=ne(i.data?.pending??[]);return(0,A.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,M.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,M.jsx)(`div`,{className:pa,children:(0,M.jsx)(Lo,{target:{ask:!0},placeholder:`Ask the front desk`,oneLine:!0,className:`p-2`,focusOnOpen:!0,onEmptyEscape:n})}),u.length===0?null:(0,M.jsx)(`ol`,{"aria-label":`Your asks`,className:`${pa} max-h-[40vh] overflow-y-auto py-1`,children:u.map(e=>{let t=zo(da(e,d,f),e,c),n=fa(e,a);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/thread/$threadId`,params:{threadId:e.id},className:`block px-4 py-2 transition-colors hover:bg-surface-2/50`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary ${n?`font-semibold`:``}`,children:e.title}),n?(0,M.jsx)(`span`,{"aria-label":`new answer`,className:`size-1.5 shrink-0 rounded-full bg-emerald-400`}):null,(0,M.jsx)(`time`,{dateTime:e.openedAt,className:`shrink-0 text-meta`,children:He(e.openedAt,o)})]}),(0,M.jsx)(`span`,{className:`mt-0.5 block truncate text-xs ${t.tone}`,children:t.text})]})},e.id)})})]})}function Vo({unread:e,onOpen:t}){let n=Fo(),[r]=e,i=r===void 0?null:e.length===1?`${n(r.lastAuthor??`board`)} answered “${r.title}”`:`${e.length} new answers`;return(0,M.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,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 shrink-0 rounded-full bg-emerald-400`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:i}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}),(0,M.jsx)(`kbd`,{className:`shrink-0 rounded border border-line px-1.5 font-sans text-[11px] text-fg-secondary`,children:`Space`}),(0,M.jsx)(`span`,{className:`shrink-0`,children:`to ask`})]})}var Ho={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 Uo(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 ${He(e.lastTurnAt,r)}`}function Wo({member:e,star:t,place:n,now:r}){let i=e.lastModel??e.model,a=Ho[t.state];return(0,M.jsxs)(`article`,{className:`card w-72 p-3.5`,"aria-label":`${e.name}, ${e.role}`,children:[(0,M.jsxs)(`header`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-md bg-surface-2/70`,children:(0,M.jsx)(xt,{cli:t.cli,size:18})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`text-title truncate`,children:e.name}),(0,M.jsxs)(`p`,{className:`truncate text-meta`,children:[e.role,i===void 0?``:` · ${i}`]})]}),(0,M.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${a.style}`,children:a.label})]}),(0,M.jsx)(`p`,{className:`mt-2.5 text-sm text-fg-secondary`,children:Uo(e,t,n,r)})]})}function Go({society:e,citizens:t,citizensOpen:n,onToggleCitizens:r,runnersOpen:i,onToggleRunners:a,enrolling:o,attention:s,onOpenAttention:c,paused:l,onTogglePause:u,pauseBusy:d,boardOpen:f,onToggleBoard:p,metricsOpen:m,onToggleMetrics:h,logsOpen:g,onToggleLogs:_,onSignOut:v}){return(0,M.jsxs)(`header`,{className:`pointer-events-none absolute inset-x-0 top-0 flex items-start justify-between p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,M.jsx)(`span`,{className:`text-display`,children:`Stellaris`}),e===void 0?null:(0,M.jsx)(`span`,{className:`text-meta`,children:e})]}),(0,M.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2`,children:[s===0?null:(0,M.jsxs)(`button`,{type:`button`,onClick:c,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,M.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-amber-300`}),s,` `,s===1?`needs`:`need`,` you`]}),(0,M.jsx)(`button`,{type:`button`,"aria-pressed":l,disabled:d,onClick:u,title:l?`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 ${l?`text-amber-300 hover:text-amber-200`:`text-fg-tertiary hover:text-fg-primary`}`,children:l?`Paused · resume`:`Pause`}),(0,M.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,M.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,M.jsx)(`span`,{className:`rounded bg-amber-500/15 px-1 text-[11px] text-amber-300`,children:o})]}),(0,M.jsx)(`button`,{type:`button`,"aria-pressed":f,onClick:p,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 ${f?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Board`}),(0,M.jsx)(`button`,{type:`button`,"aria-pressed":m,onClick:h,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 ${m?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Metrics`}),(0,M.jsx)(`button`,{type:`button`,"aria-expanded":g,onClick:_,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 ${g?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Logs`}),(0,M.jsx)(`button`,{type:`button`,onClick:v,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 Ko=new Set(Ie),qo={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`};function I(e){return Ko.has(e)}function L(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 R(e){return[e.project??``,e.agent??``,e.role===void 0?``:`role ${e.role}`,I(e.kind)?`wakes the steward`:``].filter(e=>e.length>0)}function Jo({onClose:e}){let t=De(!0),n=s(),r=qe(3e4),i=t.data??[],a=L(i,n.data?.signals??[]);return(0,M.jsxs)(ma,{label:`Operations log`,className:`top-[72px] right-4 z-20 max-h-[min(70vh,640px)]`,style:{width:400},children:[(0,M.jsxs)(`header`,{className:`flex items-start gap-3 border-b border-line px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`text-heading`,children:`Operations log`}),(0,M.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,M.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:`×`})]}),i.length===0?(0,M.jsx)(`p`,{className:`px-4 py-4 text-meta`,children:t.data===void 0?`Reading the log…`:`Nothing measured yet.`}):(0,M.jsx)(`ol`,{className:`flex-1 overflow-y-auto`,children:i.toReversed().map(({id:e,ts:t,signal:n})=>{let i=I(n.kind),o=R(n);return(0,M.jsxs)(`li`,{className:`border-b border-line/60 px-4 py-2.5 last:border-b-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`rounded-md px-1.5 py-px text-[11px] ${i?`bg-amber-500/15 text-amber-300`:`bg-surface-2 text-fg-tertiary`}`,children:qo[n.kind]}),a.has(e)?(0,M.jsx)(`span`,{className:`text-[11px] text-emerald-300`,children:`holds now`}):null,(0,M.jsx)(`time`,{dateTime:t,title:t,className:`ml-auto shrink-0 text-meta`,children:He(t,r)})]}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:(0,M.jsx)(Ha,{text:n.summary})}),o.length===0&&n.taskId===void 0?null:(0,M.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[o.join(` · `),n.taskId===void 0?null:(0,M.jsxs)(M.Fragment,{children:[o.length===0?``:` · `,(0,M.jsx)(vt,{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 Yo=32;function Xo(e,t){return t.width+t.x-e.clientX}function Zo({width:e,min:t,max:n,onResize:r,onToggle:i}){let a=(0,A.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(Xo(e,a.current),!1)},c=e=>{a.current!==null&&(r(Xo(e,a.current),!0),a.current=null)};return(0,M.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+Yo:i.key===`ArrowRight`?e-Yo: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 Qo({mark:e,project:t,members:n}){let r=n?.find(t=>t.name===e.holder)?.cli??null,i=Et.find(t=>t.phase===e.phase)?.label??e.phase;return(0,M.jsxs)(`article`,{className:`card w-72 p-4`,"aria-label":`Task ${e.title}`,children:[(0,M.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(`h2`,{className:`text-title min-w-0 flex-1`,children:e.title}),(0,M.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${Ct[e.phase]}`,children:i.toLowerCase()})]}),(0,M.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:[(0,M.jsx)(`dt`,{className:`text-fg-muted`,children:`Project`}),(0,M.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:t}),(0,M.jsx)(`dt`,{className:`text-fg-muted`,children:`Stage`}),(0,M.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:e.stage}),e.holder===null?e.waitingFor===null?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`dt`,{className:`text-fg-muted`,children:`Waiting for`}),(0,M.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:e.waitingFor})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`dt`,{className:`text-fg-muted`,children:`Held by`}),(0,M.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-1 text-fg-secondary`,children:[r===null?null:(0,M.jsx)(xt,{cli:r,size:12}),e.holder,e.linked===null?` · resting`:` · in a turn on it`]})]})]})]})}function $o(t,n){let r=`latest`;return Ga({token:t,url:()=>`/api/events/stream?since=${r}`,onData:t=>{let i=e.parse(JSON.parse(t));r=i.id,n.onEvent(i)},onOpen:e=>{e&&n.onResume()}})}function es(e){return typeof e==`string`?e:void 0}function z(e){let{type:t,payload:n,actor:r}=e;if(t===`message.posted`){let e=es(n.thread);return e===void 0?[[`channels`],[`channel`,es(n.channel)],[`requests`]]:[[`threads`],[`thread`,e],[`requests`]]}return t.startsWith(`thread.`)?[[`threads`],[`thread`,es(n.threadId)],[`channel`],[`requests`]]:t.startsWith(`task.`)||t.startsWith(`merge.`)||t===`lease.expired`?[[`tasks`],[`task`,es(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`]]:t===`turn.started`?[[`scheduler`],[`members`],[`metrics`]]:t.startsWith(`turn.`)||t===`wake.requested`||t===`paused.changed`?[[`scheduler`],[`members`]]:t===`knowledge.written`||t===`knowledge.removed`?[[`knowledge`,es(n.project)??`society`]]:t===`dashboard.updated`?[[`dashboard`,es(n.project)]]:t.startsWith(`agent.`)||t===`subscription.changed`?[[`members`]]:t.startsWith(`project.`)||t===`channel.added`||t===`channel.archived`?[[`projects`],[`channels`],[`society`]]:t===`role.added`?[[`roles`]]:t.startsWith(`runner.`)?[[`runners`],[`models`],[`server-version`]]:t.startsWith(`proposal.`)?[[`proposals`],[`proposal`,es(n.proposalId)],[`metrics`]]:t===`skill.promoted`?[[`skills`]]:t===`ops.signal`?[[`signals`],[`scheduler`],[`metrics`]]:[]}function ts(e,t){for(let n of z(t)){let t=n.filter(e=>e!==void 0);e.invalidateQueries({queryKey:t})}}var ns=`stellaris.contentWidth`;function rs(e){return Math.round(Math.min(680,Math.max(420,e*.4)))}function is(e){return Math.max(420,e-256-48)}function as(e,t){let n=is(e);return t===`widest`?n:Math.round(Math.min(n,Math.max(420,t??rs(e))))}function os(e,t){return as(e,t)>=is(e)?null:`widest`}function ss(){let e=localStorage.getItem(ns);if(e===`widest`)return`widest`;let t=Number(e);return e!==null&&Number.isFinite(t)&&t>0?t:null}function cs(e){e===null?localStorage.removeItem(ns):localStorage.setItem(ns,String(e))}var ls=`stellaris.trail`;function B(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 us(e,t){let n=e[t-1];return n===void 0||new URL(n,`http://board`).pathname===`/`?null:n}function ds(){try{let e=JSON.parse(sessionStorage.getItem(ls)??`{}`);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 fs(e){sessionStorage.setItem(ls,JSON.stringify(e))}function ps(e,t){return decodeURIComponent(e.split(`/`)[t]??``)}function ms(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`?ps(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 hs=typeof sessionStorage>`u`?{}:ds(),gs=new Set;function _s(e,t){if(hs[e]!==t||hs[e+1]!==void 0){hs=B(hs,e,t),fs(hs);for(let e of gs)e()}}function vs(){return(0,A.useSyncExternalStore)(e=>(gs.add(e),()=>gs.delete(e)),()=>hs)}function ys(e,t){let n=Et.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 bs=Math.PI*(3-Math.sqrt(5)),xs=68,Ss=44,Cs=58,ws=26,Ts=13,Es=.3,Ds=1.5*Math.PI,Os=28,ks=280,As=8,js=40;function Ms(e){return Math.max(Cs,xs*Math.sqrt(Math.max(0,e-1))+Ss)}function Ns(e){return e+ws}function Ps(e){let t=new Map;for(let n of e.toSorted()){let e=ce(n);if(e!==null){let n=t.get(e.agent)??[];n.includes(e.scope)||t.set(e.agent,[...n,e.scope])}}return t}function Fs(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:ke,i=Ps(e.scheduler.running),a=Ps(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:ke,queuedFor:n===void 0?null:r(n)}]}),l=new Map([[ke,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:ke,label:`society`,kind:`society`,x:0,y:0,radius:Ms(u.get(`society`)??0)},f=[d,...Rs(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=xs*Math.sqrt(s),u=s*bs-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=Is(e.tasks??[],f,m),g=Math.max(...f.map(e=>Math.hypot(e.x,e.y)+Ns(e.radius)));return{anchors:f,stars:m,tasks:h,radius:Math.round(g+js)}}function Is(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=Tt(e);return t===`done`||t===`abandoned`?[]:[{task:e,phase:t}]}).toSorted((e,t)=>e.task.id.localeCompare(t.task.id)),a=Math.min(Es,Ds/Math.max(1,t.length)),o=i.radius+Ts;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=ve(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?wt(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 Ls(e,t,n){let r=e.stars.filter(e=>e.name===t);return(r.find(e=>e.anchor===n)??r[0])?.id??null}function Rs(e,t,n){let r=[],i=Ns(n.radius),a=As;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=>Ms(t.get(e.slug)??0)),l=c.map(Ns),u=l.map(e=>2*e+Os),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?ks:0,i+Math.max(...l)+Os);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)+Os)/(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]??Cs)})}),i=h+Math.max(...l)}return r}var zs=.15,Bs=.45,Vs=1.35,Hs=64,Us=1.15;function Ws(e,t,n){return Math.min(n,Math.max(t,e))}function Gs(e){return Math.max(240,e.width-e.left-e.right)}function Ks(e){return{x:e.left+Gs(e)/2,y:e.height/2}}function qs(e,t){return{x:0,y:0,scale:Ws(Math.min(Gs(e),e.height)/(2*t),Bs,Vs)}}function Js(e,t,n,r){let i=Ws(e.scale*n,zs,3),a=Ks(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 Ys(e,t,n){return{...e,x:e.x-t/e.scale,y:e.y-n/e.scale}}function Xs(e,t,n){let r=Ks(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>=Hs&&a+o<=t.height)return null;let s=Math.min(Gs(t),t.height-Hs)/(2*n.reach*Us);return{x:n.x,y:n.y,scale:Math.min(e.scale,Ws(s,zs,3))}}var Zs=`#0a0a0a`,Qs=`#171717`,$s=`212, 212, 212`,ec=`163, 163, 163`,tc=`115, 115, 115`,nc=`"Instrument Sans Variable", ui-sans-serif, sans-serif`,rc=`500 12px "Onest Variable", ui-sans-serif, sans-serif`,ic=`600 10px "Onest Variable", ui-sans-serif, sans-serif`,ac={waiting:`#fcd34d`,working:`#6ee7b7`,returned:`#fdba74`,landing:`#7dd3fc`},oc=`500 11px ${nc}`,sc=5,cc=240,lc=34,uc=.06,dc=15,fc=5,pc=4.2,mc=280;function hc(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 gc(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 _c(e,t){return(e%t+t)%t}function vc(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function yc(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(n!==null){let t=vc(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 bc=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(yt.claude.path),codex:new Path2D(yt.codex.path)};let r=hc(7);this.specks=Array.from({length:mc},()=>({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:gc(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=Js(this.target,n,e,t??Ks(n)),this.mode=`manual`}panBy(e,t){this.target=Ys(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=Xs(this.target,e,{x:t.anchor.x,y:t.anchor.y,reach:t.anchor.radius+lc});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(dc*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=qs(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=Ks(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+=(fc*(n.star.x-n.x)-pc*n.vx)*e,n.vy+=(fc*(n.star.y-n.y)-pc*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>sc||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=yc(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=Zs,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=vc(ac[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=ac[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=oc,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,(sc-i)/1.2)*r.presence;if(a<=0)continue;let o=n.text;if(e.measureText(o).width>cc){for(;o.length>1&&e.measureText(`${o}…`).width>cc;)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,dc*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(${$s}, 1)`,e.fillText(o,u+8,d+11+.5)}e.restore()}drawSpecks(e){let{ctx:t}=this,n=-this.camX*this.scale*uc,r=-this.camY*this.scale*uc;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(_c(i.x*this.width+n,this.width),_c(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=ic,e.letterSpacing=`2px`,e.fillStyle=`rgba(${tc}, 0.9)`,e.fillText(t.label.toUpperCase(),a.x,a.y+o+10),e.letterSpacing=`0px`):(e.font=rc,e.fillStyle=s?`rgba(245, 245, 245, 1)`:`rgba(${ec}, 0.95)`,e.fillText(t.label,a.x,a.y+o+10))}}drawBody(e,t){let{ctx:n}=this,{star:r}=e,i=yt[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,dc*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=vc(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(${$s}, 0.55)`,n.lineWidth=1,n.stroke(),n.setLineDash([])),n.beginPath(),n.arc(u.x,u.y,m,0,Math.PI*2),n.fillStyle=Qs,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 ${nc}`,n.textAlign=`center`,n.textBaseline=`top`,n.fillStyle=`rgba(${$s}, ${a||o?1:.7})`,n.fillText(r.name,u.x,u.y+m+8*this.scale+3),n.restore()}},xc=15e3,Sc=26,Cc=12,wc=4,Tc=.0015,Ec=.01,Dc=1.3,Oc=`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 kc(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+Cc,s=n.width-r.right-Cc,c=t.x+Sc+i<=s?t.x+Sc:t.x-Sc-i,l=Math.min(Math.max(Cc,t.y-a/3),n.height-a-Cc);e.style.transform=`translate(${Math.round(Math.max(o,c))}px, ${Math.round(l)}px)`,e.style.visibility=`visible`}function Ac({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,A.useRef)(null),f=(0,A.useRef)(null),p=(0,A.useRef)(null),m=(0,A.useRef)(i);(0,A.useLayoutEffect)(()=>{m.current=i},[i]);let h=(0,A.useRef)(e);(0,A.useLayoutEffect)(()=>{h.current=e},[e]);let g=za(),_=(0,A.useRef)(g);(0,A.useLayoutEffect)(()=>{_.current=g},[g]);let v=(0,A.useRef)(null),y=(0,A.useRef)(!1);return(0,A.useEffect)(()=>{let e=d.current;if(e===null)throw Error(`the sky's canvas is not mounted`);let t=e.getBoundingClientRect(),n=new bc(e,{reducedMotion:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,onHoverPosition:e=>kc(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?Ec:Tc)),{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,A.useEffect)(()=>{p.current?.setModel(e)},[e]),(0,A.useEffect)(()=>l.listen(e=>{let t=p.current;if(t===null||e.event.type!==`tool_call`||Date.now()-Date.parse(e.ts)>xc)return;let n=Ls(h.current,e.agent,e.project);if(n===null)return;t.flash(n);let r=mo(e.event.name,e.event.input);r!==null&&t.say(n,ja(r,_.current))}),[l]),(0,A.useEffect)(()=>{p.current?.setPaused(t)},[t]),(0,A.useEffect)(()=>{p.current?.setHovered(n)},[n]),(0,A.useEffect)(()=>{p.current?.setFocus(a)},[a]),(0,A.useEffect)(()=>{p.current?.setInsets(i.left,i.right)},[i.left,i.right]),(0,M.jsxs)(`div`,{className:`absolute inset-0`,children:[(0,M.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)>wc&&(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,M.jsxs)(`fieldset`,{className:`card absolute bottom-4 flex flex-col gap-0.5 p-1`,style:{right:i.right+16},children:[(0,M.jsx)(`legend`,{className:`sr-only`,children:`Camera`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,className:Oc,onClick:()=>p.current?.zoomBy(Dc),children:`+`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,className:Oc,onClick:()=>p.current?.zoomBy(1/Dc),children:`−`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Fit the whole sky`,title:`Fit the whole sky`,className:Oc,onClick:()=>p.current?.home(),children:`⤢`})]}),(0,M.jsx)(`div`,{ref:f,className:`pointer-events-none absolute top-0 left-0 will-change-transform`,style:{visibility:`hidden`},children:u})]})}var jc={left:0,right:0};function Mc(){let[e,t]=(0,A.useState)(()=>window.innerWidth);return(0,A.useEffect)(()=>{let e=()=>t(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Nc(e,t){return e.startsWith(t)?decodeURIComponent(e.slice(t.length)):null}function Pc(){let{api:e,token:t,signOut:n,expire:r}=S(),i=D();(0,A.useEffect)(()=>$o(t,{onEvent:e=>ts(i,e),onResume:()=>void i.invalidateQueries()}),[t,i]);let[a]=(0,A.useState)(()=>new vo);(0,A.useEffect)(()=>a.follow(t),[a,t]);let o=k(),c=Se(),l=xe(),u=he(),d=s(),f=h(),p=Be(),m=te(),g=(0,A.useMemo)(()=>ka(f.data??[],p,m.data??[]),[f.data,p,m.data]),_=Ze(),v=$e({mutationFn:t=>e.setPaused(t),onSuccess:()=>void i.invalidateQueries({queryKey:[`scheduler`]})}),b=ra({select:e=>e.location.pathname}),x=ra({select:e=>e.location.href}),C=ra({select:e=>e.location.state.__TSR_index});(0,A.useEffect)(()=>_s(C,x),[C,x]);let[w,T]=(0,A.useState)(!1),[ee,E]=(0,A.useState)(null),ne=ee===b,re=(0,A.useCallback)(()=>E(null),[]),ie=(0,A.useRef)(!0),ae=Sa(),oe=Ai({strict:!1}),[se,ce]=(0,A.useState)(null),le=qe(3e4),ue=Mc(),de=b!==`/`,[fe,pe]=(0,A.useState)(ss),me=as(ue,fe),ge=(e,t)=>{let n=as(ue,e),r=n>=is(ue)?`widest`:n;pe(r),t&&cs(r)},_e=()=>{let e=os(ue,fe);pe(e),cs(e)},ve=(0,A.useMemo)(()=>de?{left:288,right:me+32}:jc,[de,me]),ye=Nc(b,`/thread/`),be=y(Nc(b,`/task/`)),O=Nc(b,`/c/`)??(ye===null?null:f.data?.find(e=>e.id===ye)?.channel??null),Ce=/^\/p\/([^/]+)\/tasks$/.exec(b)?.[1]??be.data?.project??null,we=Nc(b,`/citizen/`),Te=we===null?null:oe.scope??null,Ee=Te?.split(`/`)[0]??null,De=b===`/needs-you`?`needs-you`:b===`/proposals`||b.startsWith(`/proposal/`)?`proposals`:null,Oe=Ea().length,Ae=We().data?.length??0,je=b===`/society`?ke:/^\/p\/([^/]+)$/.exec(b)?.[1]??/^\/knowledge\/([^/]+)\//.exec(b)?.[1]??null;(0,A.useEffect)(()=>{let e=()=>{ie.current=!0},t=e=>{e.key===`Tab`&&(ie.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&&!ie.current)return;e.preventDefault(),E(b);return}e.key===`Escape`&&(ne?E(null):w?T(!1):de&&_({to:`/`}))}};return window.addEventListener(`keydown`,t),window.addEventListener(`pointerdown`,e),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`pointerdown`,e)}},[de,w,ne,b,_]);let Me=[o,l,u,d].some(e=>e.error instanceof Je&&e.error.status===401);(0,A.useEffect)(()=>{Me&&r()},[Me,r]);let Ne=(0,A.useMemo)(()=>l.data===void 0||u.data===void 0||d.data===void 0?null:Fs({members:l.data,projects:u.data,scheduler:d.data,tasks:p}),[l.data,u.data,d.data,p]);if(Ne===null){let e=[l,u,d].some(e=>e.error!==null);return(0,M.jsx)(`main`,{className:`grid h-full place-items-center`,children:(0,M.jsx)(`p`,{className:`text-meta`,"aria-live":`polite`,children:e?`The board server is not answering. Retrying…`:`Reading the board…`})})}let Pe=(De!==null||b===`/metrics`||b===`/runners`?`society`:null)??je??Ce??(O===null?we===null?null:Ee??Ne.stars.find(e=>e.name===we)?.anchor??null:O.includes(`/`)?O.split(`/`)[0]??null:`society`),Fe=ue-ve.left-ve.right,Ie=Fe>=460,Le=Math.min(560,(Ie?Fe:ue)-32),Re={left:(Ie?ve.left:0)+((Ie?Fe:ue)-Le)/2,width:Le},ze=N(f.data??[]).filter(e=>fa(e,ae)),Ve=e=>e===`society`?`the society`:u.data?.find(t=>t.slug===e)?.name??e,He=Ne.stars.find(e=>e.id===se),Ue=Ne.tasks.find(e=>`task:${e.id}`===se),Ge=l.data?.find(e=>e.name===He?.name),Ke=He===void 0?`the society`:Ve(He.queuedFor??He.anchor),Ye=e=>{let t=Ne.stars.find(t=>t.id===e);t!==void 0&&_({to:`/citizen/$name`,params:{name:t.name},search:t.state===`working`?{scope:t.anchor}:{}})},Xe=e=>{_({to:`/task/$taskId`,params:{taskId:e}})};return(0,M.jsx)(yo,{value:a,children:(0,M.jsx)(Ra,{value:g,children:(0,M.jsx)(Ao,{value:c.data?.signIn,children:(0,M.jsxs)(`main`,{className:`relative h-full overflow-hidden`,children:[(0,M.jsx)(Ac,{model:Ne,paused:d.data?.paused??!1,hovered:se,onHover:ce,insets:ve,focus:Pe,onSelectAnchor:e=>{_(e===`society`?{to:`/society`}:{to:`/p/$slug`,params:{slug:e}})},onSelectStar:Ye,onSelectTask:Xe,live:a,card:Ue===void 0?He===void 0||Ge===void 0?null:(0,M.jsx)(Wo,{member:Ge,star:He,place:Ke,now:le}):(0,M.jsx)(Qo,{mark:Ue,project:Ve(Ue.project),members:l.data})}),(0,M.jsx)(Go,{society:o.data?.name,citizens:new Set(Ne.stars.map(e=>e.name)).size,citizensOpen:b===`/citizens`,onToggleCitizens:()=>void _(b===`/citizens`?{to:`/`}:{to:`/citizens`}),runnersOpen:b===`/runners`,onToggleRunners:()=>void _(b===`/runners`?{to:`/`}:{to:`/runners`}),enrolling:Ae,attention:Oe,onOpenAttention:()=>void _({to:`/needs-you`}),paused:d.data?.paused??!1,onTogglePause:()=>v.mutate(!(d.data?.paused??!1)),pauseBusy:v.isPending,boardOpen:de,onToggleBoard:()=>void _(de?{to:`/`}:{to:`/c/$`,params:{_splat:`general`}}),logsOpen:w,metricsOpen:b===`/metrics`,onToggleMetrics:()=>void _(b===`/metrics`?{to:`/`}:{to:`/metrics`}),onToggleLogs:()=>T(!w),onSignOut:n}),de?(0,M.jsx)(ko,{activeChannel:O,activeTasks:Ce,activeCitizen:we,activeScope:Te,activeGovernance:De,activeOverview:je}):null,de?(0,M.jsxs)(ma,{label:`Board content`,className:`top-[72px] right-4 bottom-4`,style:{width:me},children:[(0,M.jsx)(Zo,{width:me,min:420,max:is(ue),onResize:ge,onToggle:_e}),(0,M.jsx)(qi,{})]}):null,w?(0,M.jsx)(Jo,{onClose:()=>T(!1)}):null,ne?(0,M.jsx)(Bo,{left:Re.left,width:Re.width,onClose:re}):(0,M.jsx)(`div`,{className:`pointer-events-none absolute bottom-5 flex justify-center px-16`,style:{left:ve.left,right:ve.right},children:(0,M.jsx)(Vo,{unread:ze,onOpen:()=>E(b)})}),Ne.stars.length===0&&!de?(0,M.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,M.jsx)(`code`,{className:`font-mono text-fg-secondary`,children:`stellaris agent add`}),`.`]}):null,(0,M.jsx)(`ul`,{className:`sr-only`,"aria-label":`Tasks in play`,children:Ne.tasks.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{type:`button`,onFocus:()=>ce(`task:${e.id}`),onBlur:()=>ce(null),onClick:()=>Xe(e.id),children:ys(e,Ve(e.project))})},e.id))}),(0,M.jsx)(`ul`,{className:`sr-only`,"aria-label":`Citizens`,children:Ne.stars.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,onFocus:()=>ce(e.id),onBlur:()=>ce(null),onClick:()=>Ye(e.id),children:[e.name,`, `,e.state,e.state===`working`?` at ${Ve(e.anchor)}`:``]})},e.id))})]})})})})}var Fc=`modulepreload`,Ic=function(e){return`/`+e},Lc={},Rc=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=Ic(t,n),t=s(t),t in Lc)return;Lc[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`:Fc,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 zc(){return null}var Bc=Fi({component:Pc}),Vc=$i({routeTree:Bc.addChildren([Ni({getParentRoute:()=>Bc,path:`/`,component:zc}),Ni({getParentRoute:()=>Bc,path:`/c/$`,component:Ii(()=>Rc(()=>import(`./ChannelView-4s--IwKC.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),`ChannelView`)}),Ni({getParentRoute:()=>Bc,path:`/thread/$threadId`,component:Ii(()=>Rc(()=>import(`./ThreadView-zg8KqF3t.js`),__vite__mapDeps([13,1,2,3,6,4,9,7,8,10,11,12,14])),`ThreadView`)}),Ni({getParentRoute:()=>Bc,path:`/society`,component:Ii(()=>Rc(()=>import(`./SocietyView-BuaSb_3d.js`),__vite__mapDeps([15,1,2,3,5,6,4,10,16,17,18])),`SocietyView`)}),Ni({getParentRoute:()=>Bc,path:`/p/$slug`,component:Ii(()=>Rc(()=>import(`./ProjectView-BBQg-ZxC.js`),__vite__mapDeps([19,1,2,3,6,8,4,5,9,10,16,17,18])),`ProjectView`)}),Ni({getParentRoute:()=>Bc,path:`/knowledge/$scope/$topic`,component:Ii(()=>Rc(()=>import(`./KnowledgeView-DbI8DIZb.js`),__vite__mapDeps([20,1,2,3,6,4,9,10,14])),`KnowledgeView`)}),Ni({getParentRoute:()=>Bc,path:`/p/$slug/tasks`,component:Ii(()=>Rc(()=>import(`./TasksView-DCVU5oZn.js`),__vite__mapDeps([21,1,6,8,10])),`TasksView`)}),Ni({getParentRoute:()=>Bc,path:`/task/$taskId`,component:Ii(()=>Rc(()=>import(`./TaskView-yL9hCM7G.js`),__vite__mapDeps([22,1,2,3,6,8,23,4,9,10,14,24,7])),`TaskView`)}),Ni({getParentRoute:()=>Bc,path:`/task/$taskId/files/$`,validateSearch:e=>{let t=Number(e.line);return Number.isInteger(t)&&t>0?{line:t}:{}},component:Ii(()=>Rc(()=>import(`./TaskFileView-CeEzbSCL.js`),__vite__mapDeps([25,1,6,9,3,10,14])),`TaskFileView`)}),Ni({getParentRoute:()=>Bc,path:`/metrics`,validateSearch:e=>{let t=_.safeParse(e.window);return t.success?{window:t.data}:{}},component:Ii(()=>Rc(()=>import(`./MetricsView-D8D-y-sz.js`),__vite__mapDeps([26,1,6,10,16,17,18])),`MetricsView`)}),Ni({getParentRoute:()=>Bc,path:`/citizens`,component:Ii(()=>Rc(()=>import(`./CitizensView-B8lVGSBD.js`),__vite__mapDeps([27,1,6,17,10,18])),`CitizensView`)}),Ni({getParentRoute:()=>Bc,path:`/needs-you`,component:Ii(()=>Rc(()=>import(`./NeedsYouView-Buwq8-_l.js`),__vite__mapDeps([28,1,6,23,8,10])),`NeedsYouView`)}),Ni({getParentRoute:()=>Bc,path:`/runners`,validateSearch:e=>typeof e.code==`string`?{code:e.code}:{},component:Ii(()=>Rc(()=>import(`./RunnersView-2h5NWUuD.js`),__vite__mapDeps([29,1,2,3,17,4,10])),`RunnersView`)}),Ni({getParentRoute:()=>Bc,path:`/proposals`,component:Ii(()=>Rc(()=>import(`./ProposalsView-DjyZpZe0.js`),__vite__mapDeps([30,1,6,23,8,10])),`ProposalsView`)}),Ni({getParentRoute:()=>Bc,path:`/proposal/$proposalId`,component:Ii(()=>Rc(()=>import(`./ProposalView-BjPHVxj4.js`),__vite__mapDeps([31,1,2,3,6,17,8,23,4,9,10,14,30,24,7])),`ProposalView`)}),Ni({getParentRoute:()=>Bc,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:Ii(()=>Rc(()=>import(`./CitizenView-B5-LVVCG.js`),__vite__mapDeps([32,1,2,3,6,17,4,9,10,12,18])),`CitizenView`)})])});function Hc({signInError:e}){let t=D(),[n,r]=(0,A.useState)(d),i=(0,A.useCallback)(()=>{ie(),t.clear(),r(null)},[t]),a=(0,A.useCallback)(()=>{n!==null&&p(n).signOut().catch(()=>void 0),i(),Vc.navigate({to:`/`})},[n,i]),o=(0,A.useMemo)(()=>n===null?null:{api:p(n),token:n,signOut:a,expire:i},[n,a,i]);return o===null?(0,M.jsx)(la,{initialError:e,onEnter:e=>{oe(e),r(e)}}):(0,M.jsx)(we,{value:o,children:(0,M.jsx)(na,{router:Vc})})}var Uc={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 Wc(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:Uc[r]??`GitHub sign-in failed.`}}function Gc(){let e=Wc(window.location.hash);return e!==null&&(e.token!==null&&oe(e.token),window.history.replaceState(window.history.state,``,`${window.location.pathname}${window.location.search}`)),e}var Kc=new Mt({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),qc=Gc(),Jc=document.getElementById(`root`);if(Jc===null)throw Error(`missing #root element`);(0,ia.createRoot)(Jc).render((0,M.jsx)(A.StrictMode,{children:(0,M.jsx)(_e,{client:Kc,children:(0,M.jsx)(Hc,{signInError:qc?.error??null})})}));export{ra as C,wa as S,ki as T,Ha as _,Mo as a,La as b,qa as c,go as d,eo as f,Va as g,bo as h,Lo as i,_o as l,Ja as m,us as n,No as o,po as p,vs as r,Fo as s,ms as t,Ka as u,za as v,Ai as w,Ea as x,Pa as y};
23
+ `).map(e=>e.trim()).find(e=>e.length>0)??``}function io(e){return/^\/bin\/(?:ba)?sh -lc (["'])([\s\S]*)\1$/.exec(e.trim())?.[2]??e}function ao(e){return typeof e==`object`&&e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):{}}var oo=[`file_path`,`path`,`url`,`query`,`pattern`,`description`,`prompt`];function so(e){let t=ao(e),n=t.command;if(typeof n==`string`){let e=io(n);return{summary:to(no(e),Xa),detail:to(e,Za)}}let r=to(JSON.stringify(e??null,null,2),Za),i=t.changes;if(Array.isArray(i))return{summary:to(i.map(e=>ao(e).path).filter(e=>typeof e==`string`).join(`, `),Xa),detail:r};let a=oo.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:to(no(a??o.slice(0,3).join(` · `)),Xa),detail:r}}var co=`StructuredOutput`;function lo(e,t){try{return ao(JSON.parse(e)).summary===t}catch{return!1}}function uo(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 fo(e,t,{maxSteps:n}={maxSteps:Ya}){let{event:r}=t,i=Ka(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,uo(c,{kind:`say`,seq:t.seq,at:t.ts,text:r.delta},n));break;case`tool_call`:if(r.name===co)break;o.set(i,uo(c,{kind:`tool`,seq:t.seq,at:t.ts,name:r.name,...so(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,uo(c,{kind:`error`,seq:t.seq,at:t.ts,message:r.message},n));break;case`steered`:o.set(i,uo(c,{kind:`steer`,seq:t.seq,at:t.ts,...$a(r.text??``)},n));break;case`turn_completed`:{let e=r.status?.summary??null,n=c.steps.at(-1),a=n?.kind===`say`&&e!==null&&lo(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 po(e,t,n,r={}){let i=new Map;for(let[a,o]of e.entries())i=fo(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(Ka(t,n,r))}function mo(e,t){if(eo(e)!==`post_message`)return null;let n=ao(t).body,r=typeof n==`string`?ro(n).replace(/^[#>*\-\s]+/,``):``;return r===``?null:to(r,Xa)}function ho(e){let t=e.steps.at(-1);return t===void 0?null:t.kind===`tool`?`${eo(t.name)} · ${t.summary}`:t.kind===`steer`?`took ${go(t.posts.length)}${t.from.length===0?``:` from ${t.from.join(`, `)}`}`:to(ro(t.kind===`say`?t.text:t.message),Xa)}function go(e){return e===1?`1 post`:`${e} posts`}function _o(e,t){return Re(t-Date.parse(e))}var vo=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 Ga({token:e,url:()=>`/api/turns/stream?since=0`,onOpen:()=>{this.turns=new Map,this.emit()},onData:e=>{let t=be.safeParse(JSON.parse(e));if(t.success){this.turns=fo(this.turns,t.data);for(let e of this.eventListeners)e(t.data)}},onBatch:()=>this.emit()})}emit(){for(let e of this.listeners)e()}},yo=(0,A.createContext)(null);function bo(){let e=(0,A.useContext)(yo);if(e===null)throw Error(`useLiveTurns needs a LiveContext`);return(0,A.useSyncExternalStore)(e.subscribe,e.snapshot)}function xo({activeCitizen:e,activeScope:t}){let n=s(),r=xe(),i=bo(),a=za(),o=qe(5e3),c=ne(n.data?.running??[]),l=n.data?.pending.length??0;return(0,M.jsxs)(`section`,{"aria-label":`Working now`,className:`mt-3`,children:[(0,M.jsxs)(`h3`,{className:`flex items-center justify-between px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[(0,M.jsx)(`span`,{children:`Working now`}),l>0?(0,M.jsxs)(`span`,{className:`font-normal tracking-normal normal-case`,children:[l,` queued`]}):null]}),c.length===0?(0,M.jsx)(`p`,{className:`px-2 py-1 text-xs text-fg-muted`,children:`Nobody is in a turn.`}):(0,M.jsx)(`ul`,{children:c.map(({agent:n,scope:s,thread:c,channel:l})=>{let u=i.get(Ka(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?ho(u):null,m=qa({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,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{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,M.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,M.jsxs)(`span`,{className:`relative grid size-4 shrink-0 place-items-center`,children:[f===null?null:(0,M.jsx)(xt,{cli:f,size:13}),(0,M.jsx)(`span`,{className:`absolute -right-0.5 -bottom-0.5 size-1.5 animate-pulse rounded-full bg-emerald-400`})]}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:_===null?g:`${g} · ${_}`}),d?(0,M.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,children:[u.fromStart?``:`≥ `,_o(u.startedAt,o)]}):null]}),(0,M.jsx)(`span`,{className:`mt-0.5 block truncate pl-5.5 text-[11px] text-fg-muted`,children:p===null?`Starting…`:(0,M.jsx)(Ha,{text:p,links:!1})})]})},m===s?`${n}/${s}`:`${n}/${m}`)})})]})}var So=`flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors`;function Co(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 wo=`bg-surface-2/80 text-fg-primary`,To=`text-fg-secondary hover:bg-surface-2/50 hover:text-fg-primary`;function Eo({slug:e,active:t}){let n=(l(e).data??[]).filter(St).length;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/p/$slug/tasks`,params:{slug:e},className:`${So} ${t?wo:To}`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◇`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`tasks`}),n>0?(0,M.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 Do({value:e,title:t}){return e===0?null:(0,M.jsx)(`span`,{title:t,className:`rounded-md bg-amber-500/15 px-1.5 text-[11px] text-amber-300`,children:e})}function Oo({active:e}){let t=(te().data??[]).filter(Ot).length,n=Ea().length;return(0,M.jsxs)(`section`,{"aria-label":`Governance`,className:`mt-3`,children:[(0,M.jsx)(`h3`,{className:`px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:`Governance`}),(0,M.jsxs)(`ul`,{children:[(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/needs-you`,className:`${So} ${e===`needs-you`?wo:To}`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◉`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`needs you`}),(0,M.jsx)(Do,{value:n,title:`${n} waiting on you`})]})}),(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/proposals`,className:`${So} ${e===`proposals`?wo:To}`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`◈`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`proposals`}),(0,M.jsx)(Do,{value:t,title:`${t} waiting on you`})]})})]})]})}function ko({activeChannel:e,activeTasks:t,activeCitizen:n,activeScope:r,activeGovernance:i,activeOverview:a}){let o=ge(),s=he(),c=h(),l=Sa();(0,A.useEffect)(()=>{o.data!==void 0&&Ca(o.data.map(e=>[e.ref,e.lastMessageId]))},[o.data]);let u=(0,A.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,A.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,A.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,M.jsxs)(ma,{label:`Board navigator`,className:`top-[72px] bottom-4 left-4 w-64`,children:[(0,M.jsxs)(`header`,{className:`flex items-center justify-between px-4 pt-4 pb-1`,children:[(0,M.jsx)(`span`,{className:`text-caps`,children:`Board`}),(0,M.jsx)(vt,{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,M.jsxs)(`nav`,{className:`flex-1 overflow-y-auto px-2 pb-3`,children:[(0,M.jsx)(xo,{activeCitizen:n,activeScope:r}),(0,M.jsx)(Oo,{active:i}),f.map(n=>(0,M.jsxs)(`section`,{className:`mt-3`,children:[(0,M.jsx)(`h3`,{className:`pb-1`,children:n.project===null?(0,M.jsx)(vt,{to:`/society`,className:Co(a===n.key),children:n.label}):(0,M.jsx)(vt,{to:`/p/$slug`,params:{slug:n.project},className:Co(a===n.key),children:n.label})}),(0,M.jsxs)(`ul`,{children:[n.channels.map(t=>{let n=t.ref===e,r=p.get(t.ref)??0,i=!n&&Ta(l,t.ref,t.lastMessageId);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/c/$`,params:{_splat:t.ref},className:`${So} ${n?wo:To}`,children:[(0,M.jsx)(`span`,{className:`text-fg-muted`,children:`#`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate ${i?`font-semibold`:``}`,children:t.name}),r>0?(0,M.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,M.jsx)(`span`,{"aria-label":`new messages`,className:`size-1.5 rounded-full bg-emerald-400`}):null]})},t.ref)}),n.project===null?null:(0,M.jsx)(Eo,{slug:n.project,active:n.project===t})]})]},n.key)),d.length===0?null:(0,M.jsxs)(`section`,{"aria-label":`Archived projects`,className:`mt-3`,children:[(0,M.jsx)(`h3`,{className:`px-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:`Archived`}),(0,M.jsx)(`ul`,{children:d.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/p/$slug`,params:{slug:e.slug},className:`${So} ${a===e.slug?wo:To}`,children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`▫`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]})},e.slug))})]})]})]})}var Ao=(0,A.createContext)(void 0);function jo(e,t){let n=new URL(e);return n.searchParams.set(n.hostname===`github.com`?`size`:`s`,String(t)),n.href}function Mo({name:e,members:t}){let n=(0,A.useContext)(Ao),r=t?.find(t=>t.name===e)?.cli??null;return r===null?e===`user`&&n!==void 0?(0,M.jsx)(`img`,{src:jo(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,M.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,M.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,M.jsx)(`span`,{className:`grid size-7 shrink-0 place-items-center rounded-lg bg-surface-2/80`,children:(0,M.jsx)(xt,{cli:r,size:16})})}function No({name:e,members:t}){let n=t?.find(t=>t.name===e)?.cli??null;return(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1 align-middle`,children:[n===null?null:(0,M.jsx)(xt,{cli:n,size:12}),(0,M.jsx)(`span`,{className:`text-fg-secondary`,children:e})]})}function Po(e,t){return e===`user`?t?.login??`you`:e}function Fo(){let e=(0,A.useContext)(Ao);return t=>Po(t,e)}var Io=6;function Lo({target:e,placeholder:t,initialText:n=``,oneLine:r=!1,className:i=`border-t border-line p-3`,focusOnOpen:a=!1,onPosted:o,onEmptyEscape:c}){let{api:l}=S(),u=D(),d=xe(),f=Ke(),p=s(),[m,h]=(0,A.useState)(n),[g,_]=(0,A.useState)(0),[v,y]=(0,A.useState)(0),[b,x]=(0,A.useState)(!1),C=(0,A.useRef)(null),w=(0,A.useRef)(null),T=$e({mutationFn:async t=>{if(`channel`in e)return l.sendMessage({channel:e.channel,body:t});if(`threadId`in e)return l.sendMessage({thread_id:e.threadId,body:t});let n=await l.openThread({channel:Ne,title:P(t)});return l.sendMessage({thread_id:n.id,body:t})},onSuccess:t=>{h(n),u.invalidateQueries({queryKey:t.thread===void 0?[`channel`,t.channel]:[`thread`,t.thread]}),`ask`in e&&u.invalidateQueries({queryKey:[`threads`]}),u.invalidateQueries({queryKey:[`requests`]}),o?.(t)}});(0,A.useEffect)(()=>{a&&C.current?.focus()},[a]),(0,A.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 ee=b?null:nt(m,g),te=(d.data??[]).filter(e=>e.status===`active`&&e.cli!==null),E=ee===null?[]:te.filter(e=>e.name.startsWith(ee.prefix)).slice(0,Io),ne=tt(m,d.data??[],f.data??[]),re=`ask`in e?[]:Qe(ne,d.data??[],p.data?.turns??[],`channel`in e?{channel:e.channel}:{thread:e.threadId}),ie=Xe(re,ne.filter(e=>!re.includes(e))),ae=e=>{if(ee===null)return;let t=it(m,g,ee.start,e);w.current=t.caret,h(t.text),_(t.caret)},oe=()=>{m.trim()!==``&&m.trim()!==n.trim()&&!T.isPending&&T.mutate(m.trim())},se=e=>{if(E.length>0){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:E.length-1;y((v+t)%E.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),ae(E[Math.min(v,E.length-1)]?.name??``);return}if(e.key===`Escape`){e.preventDefault(),x(!0);return}}if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){e.preventDefault(),oe();return}e.key===`Escape`&&m===``&&c!==void 0&&(e.preventDefault(),c())},ce=(0,M.jsx)(rt,{variant:`primary`,type:`submit`,disabled:m.trim()===``||m.trim()===n.trim()||T.isPending,children:T.isPending?`Sending…`:`Send`});return(0,M.jsxs)(`form`,{className:i,onSubmit:e=>{e.preventDefault(),oe()},children:[(0,M.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)] ${r?`flex items-end gap-2 pr-1.5`:``}`,children:[E.length>0?(0,M.jsx)(`ul`,{"aria-label":`Citizens to mention`,className:`card absolute bottom-full left-2 mb-2 w-60 overflow-hidden py-1`,children:E.map((e,t)=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),ae(e.name)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${t===v?`bg-surface-2 text-fg-primary`:`text-fg-secondary`}`,children:[e.cli===null?null:(0,M.jsx)(xt,{cli:e.cli,size:14}),(0,M.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),(0,M.jsx)(`span`,{className:`truncate font-mono text-[11px] text-fg-muted`,children:e.role})]})},e.name))}):null,(0,M.jsx)(`textarea`,{ref:C,rows:1,value:m,placeholder:t,"aria-label":t,onChange:e=>{h(e.target.value),_(e.target.selectionStart),y(0),x(!1)},onSelect:e=>_(e.currentTarget.selectionStart),onKeyDown:se,className:`block max-h-48 w-full resize-none bg-transparent px-3 text-sm text-fg-primary outline-none placeholder:text-fg-muted ${r?`py-2.5`:`pt-2.5 pb-1`}`}),r?(0,M.jsx)(`div`,{className:`shrink-0 pb-1.5`,children:ce}):(0,M.jsxs)(`div`,{className:`flex items-center gap-2 px-3 pb-2`,children:[(0,M.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:ie??`Enter to send · Shift+Enter for a new line`}),ce]})]}),T.error===null?null:(0,M.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-red-400`,children:T.error instanceof Je?T.error.message:`The message was not sent.`})]})}var Ro=5;function zo(e,t,n){switch(e.kind){case`answering`:return{text:`${et(e.who)} ${e.who.length===1?`is`:`are`} answering…`,tone:`text-emerald-300`};case`queued`:return{text:`${et(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 Bo({left:e,width:t,onClose:n}){let r=h(),i=s(),a=Sa(),o=qe(3e4),c=Fo(),l=(0,A.useRef)(null),u=N(r.data??[]).slice(0,Ro),d=ne(i.data?.running??[]),f=ne(i.data?.pending??[]);return(0,A.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,M.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,M.jsx)(`div`,{className:pa,children:(0,M.jsx)(Lo,{target:{ask:!0},placeholder:`Ask the front desk`,oneLine:!0,className:`p-2`,focusOnOpen:!0,onEmptyEscape:n})}),u.length===0?null:(0,M.jsx)(`ol`,{"aria-label":`Your asks`,className:`${pa} max-h-[40vh] overflow-y-auto py-1`,children:u.map(e=>{let t=zo(da(e,d,f),e,c),n=fa(e,a);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(vt,{to:`/thread/$threadId`,params:{threadId:e.id},className:`block px-4 py-2 transition-colors hover:bg-surface-2/50`,children:[(0,M.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary ${n?`font-semibold`:``}`,children:e.title}),n?(0,M.jsx)(`span`,{"aria-label":`new answer`,className:`size-1.5 shrink-0 rounded-full bg-emerald-400`}):null,(0,M.jsx)(`time`,{dateTime:e.openedAt,className:`shrink-0 text-meta`,children:He(e.openedAt,o)})]}),(0,M.jsx)(`span`,{className:`mt-0.5 block truncate text-xs ${t.tone}`,children:t.text})]})},e.id)})})]})}function Vo({unread:e,onOpen:t}){let n=Fo(),[r]=e,i=r===void 0?null:e.length===1?`${n(r.lastAuthor??`board`)} answered “${r.title}”`:`${e.length} new answers`;return(0,M.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,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 shrink-0 rounded-full bg-emerald-400`}),(0,M.jsx)(`span`,{className:`min-w-0 truncate text-fg-secondary`,children:i}),(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`·`})]}),(0,M.jsx)(`kbd`,{className:`shrink-0 rounded border border-line px-1.5 font-sans text-[11px] text-fg-secondary`,children:`Space`}),(0,M.jsx)(`span`,{className:`shrink-0`,children:`to ask`})]})}var Ho={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 Uo(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 ${He(e.lastTurnAt,r)}`}function Wo({member:e,star:t,place:n,now:r}){let i=e.lastModel??e.model,a=Ho[t.state];return(0,M.jsxs)(`article`,{className:`card w-72 p-3.5`,"aria-label":`${e.name}, ${e.role}`,children:[(0,M.jsxs)(`header`,{className:`flex items-center gap-3`,children:[(0,M.jsx)(`span`,{className:`grid size-8 shrink-0 place-items-center rounded-md bg-surface-2/70`,children:(0,M.jsx)(xt,{cli:t.cli,size:18})}),(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`text-title truncate`,children:e.name}),(0,M.jsxs)(`p`,{className:`truncate text-meta`,children:[e.role,i===void 0?``:` · ${i}`]})]}),(0,M.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${a.style}`,children:a.label})]}),(0,M.jsx)(`p`,{className:`mt-2.5 text-sm text-fg-secondary`,children:Uo(e,t,n,r)})]})}function Go({society:e,citizens:t,citizensOpen:n,onToggleCitizens:r,runnersOpen:i,onToggleRunners:a,enrolling:o,attention:s,onOpenAttention:c,paused:l,onTogglePause:u,pauseBusy:d,boardOpen:f,onToggleBoard:p,metricsOpen:m,onToggleMetrics:h,logsOpen:g,onToggleLogs:_,onSignOut:v}){return(0,M.jsxs)(`header`,{className:`pointer-events-none absolute inset-x-0 top-0 flex items-start justify-between p-5`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,M.jsx)(`span`,{className:`text-display`,children:`Stellaris`}),e===void 0?null:(0,M.jsx)(`span`,{className:`text-meta`,children:e})]}),(0,M.jsxs)(`div`,{className:`pointer-events-auto flex items-center gap-2`,children:[s===0?null:(0,M.jsxs)(`button`,{type:`button`,onClick:c,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,M.jsx)(`span`,{"aria-hidden":`true`,className:`size-1.5 rounded-full bg-amber-300`}),s,` `,s===1?`needs`:`need`,` you`]}),(0,M.jsx)(`button`,{type:`button`,"aria-pressed":l,disabled:d,onClick:u,title:l?`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 ${l?`text-amber-300 hover:text-amber-200`:`text-fg-tertiary hover:text-fg-primary`}`,children:l?`Paused · resume`:`Pause`}),(0,M.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,M.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,M.jsx)(`span`,{className:`rounded bg-amber-500/15 px-1 text-[11px] text-amber-300`,children:o})]}),(0,M.jsx)(`button`,{type:`button`,"aria-pressed":f,onClick:p,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 ${f?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Board`}),(0,M.jsx)(`button`,{type:`button`,"aria-pressed":m,onClick:h,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 ${m?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Metrics`}),(0,M.jsx)(`button`,{type:`button`,"aria-expanded":g,onClick:_,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 ${g?`text-fg-primary`:`text-fg-secondary hover:text-fg-primary`}`,children:`Logs`}),(0,M.jsx)(`button`,{type:`button`,onClick:v,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 Ko=new Set(Ie),qo={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`};function I(e){return Ko.has(e)}function L(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 R(e){return[e.project??``,e.agent??``,e.role===void 0?``:`role ${e.role}`,I(e.kind)?`wakes the steward`:``].filter(e=>e.length>0)}function Jo({onClose:e}){let t=De(!0),n=s(),r=qe(3e4),i=t.data??[],a=L(i,n.data?.signals??[]);return(0,M.jsxs)(ma,{label:`Operations log`,className:`top-[72px] right-4 z-20 max-h-[min(70vh,640px)]`,style:{width:400},children:[(0,M.jsxs)(`header`,{className:`flex items-start gap-3 border-b border-line px-4 py-3`,children:[(0,M.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,M.jsx)(`h2`,{className:`text-heading`,children:`Operations log`}),(0,M.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,M.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:`×`})]}),i.length===0?(0,M.jsx)(`p`,{className:`px-4 py-4 text-meta`,children:t.data===void 0?`Reading the log…`:`Nothing measured yet.`}):(0,M.jsx)(`ol`,{className:`flex-1 overflow-y-auto`,children:i.toReversed().map(({id:e,ts:t,signal:n})=>{let i=I(n.kind),o=R(n);return(0,M.jsxs)(`li`,{className:`border-b border-line/60 px-4 py-2.5 last:border-b-0`,children:[(0,M.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,M.jsx)(`span`,{className:`rounded-md px-1.5 py-px text-[11px] ${i?`bg-amber-500/15 text-amber-300`:`bg-surface-2 text-fg-tertiary`}`,children:qo[n.kind]}),a.has(e)?(0,M.jsx)(`span`,{className:`text-[11px] text-emerald-300`,children:`holds now`}):null,(0,M.jsx)(`time`,{dateTime:t,title:t,className:`ml-auto shrink-0 text-meta`,children:He(t,r)})]}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:(0,M.jsx)(Ha,{text:n.summary})}),o.length===0&&n.taskId===void 0?null:(0,M.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[o.join(` · `),n.taskId===void 0?null:(0,M.jsxs)(M.Fragment,{children:[o.length===0?``:` · `,(0,M.jsx)(vt,{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 Yo=32;function Xo(e,t){return t.width+t.x-e.clientX}function Zo({width:e,min:t,max:n,onResize:r,onToggle:i}){let a=(0,A.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(Xo(e,a.current),!1)},c=e=>{a.current!==null&&(r(Xo(e,a.current),!0),a.current=null)};return(0,M.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+Yo:i.key===`ArrowRight`?e-Yo: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 Qo({mark:e,project:t,members:n}){let r=n?.find(t=>t.name===e.holder)?.cli??null,i=Et.find(t=>t.phase===e.phase)?.label??e.phase;return(0,M.jsxs)(`article`,{className:`card w-72 p-4`,"aria-label":`Task ${e.title}`,children:[(0,M.jsxs)(`header`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(`h2`,{className:`text-title min-w-0 flex-1`,children:e.title}),(0,M.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${Ct[e.phase]}`,children:i.toLowerCase()})]}),(0,M.jsxs)(`dl`,{className:`mt-3 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs`,children:[(0,M.jsx)(`dt`,{className:`text-fg-muted`,children:`Project`}),(0,M.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:t}),(0,M.jsx)(`dt`,{className:`text-fg-muted`,children:`Stage`}),(0,M.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:e.stage}),e.holder===null?e.waitingFor===null?null:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`dt`,{className:`text-fg-muted`,children:`Waiting for`}),(0,M.jsx)(`dd`,{className:`min-w-0 truncate text-fg-secondary`,children:e.waitingFor})]}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`dt`,{className:`text-fg-muted`,children:`Held by`}),(0,M.jsxs)(`dd`,{className:`flex min-w-0 items-center gap-1 text-fg-secondary`,children:[r===null?null:(0,M.jsx)(xt,{cli:r,size:12}),e.holder,e.linked===null?` · resting`:` · in a turn on it`]})]})]})]})}function $o(t,n){let r=`latest`;return Ga({token:t,url:()=>`/api/events/stream?since=${r}`,onData:t=>{let i=e.parse(JSON.parse(t));r=i.id,n.onEvent(i)},onOpen:e=>{e&&n.onResume()}})}function es(e){return typeof e==`string`?e:void 0}function z(e){let{type:t,payload:n,actor:r}=e;if(t===`message.posted`){let e=es(n.thread);return e===void 0?[[`channels`],[`channel`,es(n.channel)],[`requests`]]:[[`threads`],[`thread`,e],[`requests`]]}return t.startsWith(`thread.`)?[[`threads`],[`thread`,es(n.threadId)],[`channel`],[`requests`]]:t.startsWith(`task.`)||t.startsWith(`merge.`)||t.startsWith(`pull_request.`)||t===`lease.expired`?[[`tasks`],[`task`,es(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`]]:t===`turn.started`?[[`scheduler`],[`members`],[`metrics`]]:t.startsWith(`turn.`)||t===`wake.requested`||t===`paused.changed`?[[`scheduler`],[`members`]]:t===`knowledge.written`||t===`knowledge.removed`?[[`knowledge`,es(n.project)??`society`]]:t===`dashboard.updated`?[[`dashboard`,es(n.project)]]:t.startsWith(`agent.`)||t===`subscription.changed`?[[`members`]]:t.startsWith(`project.`)||t===`channel.added`||t===`channel.archived`?[[`projects`],[`channels`],[`society`]]:t===`role.added`?[[`roles`]]:t.startsWith(`runner.`)?[[`runners`],[`models`],[`server-version`]]:t.startsWith(`proposal.`)?[[`proposals`],[`proposal`,es(n.proposalId)],[`metrics`]]:t===`skill.promoted`?[[`skills`]]:t===`ops.signal`?[[`signals`],[`scheduler`],[`metrics`]]:[]}function ts(e,t){for(let n of z(t)){let t=n.filter(e=>e!==void 0);e.invalidateQueries({queryKey:t})}}var ns=`stellaris.contentWidth`;function rs(e){return Math.round(Math.min(680,Math.max(420,e*.4)))}function is(e){return Math.max(420,e-256-48)}function as(e,t){let n=is(e);return t===`widest`?n:Math.round(Math.min(n,Math.max(420,t??rs(e))))}function os(e,t){return as(e,t)>=is(e)?null:`widest`}function ss(){let e=localStorage.getItem(ns);if(e===`widest`)return`widest`;let t=Number(e);return e!==null&&Number.isFinite(t)&&t>0?t:null}function cs(e){e===null?localStorage.removeItem(ns):localStorage.setItem(ns,String(e))}var ls=`stellaris.trail`;function B(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 us(e,t){let n=e[t-1];return n===void 0||new URL(n,`http://board`).pathname===`/`?null:n}function ds(){try{let e=JSON.parse(sessionStorage.getItem(ls)??`{}`);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 fs(e){sessionStorage.setItem(ls,JSON.stringify(e))}function ps(e,t){return decodeURIComponent(e.split(`/`)[t]??``)}function ms(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`?ps(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 hs=typeof sessionStorage>`u`?{}:ds(),gs=new Set;function _s(e,t){if(hs[e]!==t||hs[e+1]!==void 0){hs=B(hs,e,t),fs(hs);for(let e of gs)e()}}function vs(){return(0,A.useSyncExternalStore)(e=>(gs.add(e),()=>gs.delete(e)),()=>hs)}function ys(e,t){let n=Et.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 bs=Math.PI*(3-Math.sqrt(5)),xs=68,Ss=44,Cs=58,ws=26,Ts=13,Es=.3,Ds=1.5*Math.PI,Os=28,ks=280,As=8,js=40;function Ms(e){return Math.max(Cs,xs*Math.sqrt(Math.max(0,e-1))+Ss)}function Ns(e){return e+ws}function Ps(e){let t=new Map;for(let n of e.toSorted()){let e=ce(n);if(e!==null){let n=t.get(e.agent)??[];n.includes(e.scope)||t.set(e.agent,[...n,e.scope])}}return t}function Fs(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:ke,i=Ps(e.scheduler.running),a=Ps(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:ke,queuedFor:n===void 0?null:r(n)}]}),l=new Map([[ke,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:ke,label:`society`,kind:`society`,x:0,y:0,radius:Ms(u.get(`society`)??0)},f=[d,...Rs(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=xs*Math.sqrt(s),u=s*bs-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=Is(e.tasks??[],f,m),g=Math.max(...f.map(e=>Math.hypot(e.x,e.y)+Ns(e.radius)));return{anchors:f,stars:m,tasks:h,radius:Math.round(g+js)}}function Is(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=Tt(e);return t===`done`||t===`abandoned`?[]:[{task:e,phase:t}]}).toSorted((e,t)=>e.task.id.localeCompare(t.task.id)),a=Math.min(Es,Ds/Math.max(1,t.length)),o=i.radius+Ts;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=ve(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?wt(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 Ls(e,t,n){let r=e.stars.filter(e=>e.name===t);return(r.find(e=>e.anchor===n)??r[0])?.id??null}function Rs(e,t,n){let r=[],i=Ns(n.radius),a=As;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=>Ms(t.get(e.slug)??0)),l=c.map(Ns),u=l.map(e=>2*e+Os),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?ks:0,i+Math.max(...l)+Os);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)+Os)/(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]??Cs)})}),i=h+Math.max(...l)}return r}var zs=.15,Bs=.45,Vs=1.35,Hs=64,Us=1.15;function Ws(e,t,n){return Math.min(n,Math.max(t,e))}function Gs(e){return Math.max(240,e.width-e.left-e.right)}function Ks(e){return{x:e.left+Gs(e)/2,y:e.height/2}}function qs(e,t){return{x:0,y:0,scale:Ws(Math.min(Gs(e),e.height)/(2*t),Bs,Vs)}}function Js(e,t,n,r){let i=Ws(e.scale*n,zs,3),a=Ks(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 Ys(e,t,n){return{...e,x:e.x-t/e.scale,y:e.y-n/e.scale}}function Xs(e,t,n){let r=Ks(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>=Hs&&a+o<=t.height)return null;let s=Math.min(Gs(t),t.height-Hs)/(2*n.reach*Us);return{x:n.x,y:n.y,scale:Math.min(e.scale,Ws(s,zs,3))}}var Zs=`#0a0a0a`,Qs=`#171717`,$s=`212, 212, 212`,ec=`163, 163, 163`,tc=`115, 115, 115`,nc=`"Instrument Sans Variable", ui-sans-serif, sans-serif`,rc=`500 12px "Onest Variable", ui-sans-serif, sans-serif`,ic=`600 10px "Onest Variable", ui-sans-serif, sans-serif`,ac={waiting:`#fcd34d`,working:`#6ee7b7`,returned:`#fdba74`,landing:`#7dd3fc`},oc=`500 11px ${nc}`,sc=5,cc=240,lc=34,uc=.06,dc=15,fc=5,pc=4.2,mc=280;function hc(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 gc(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 _c(e,t){return(e%t+t)%t}function vc(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function yc(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(n!==null){let t=vc(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 bc=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(yt.claude.path),codex:new Path2D(yt.codex.path)};let r=hc(7);this.specks=Array.from({length:mc},()=>({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:gc(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=Js(this.target,n,e,t??Ks(n)),this.mode=`manual`}panBy(e,t){this.target=Ys(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=Xs(this.target,e,{x:t.anchor.x,y:t.anchor.y,reach:t.anchor.radius+lc});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(dc*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=qs(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=Ks(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+=(fc*(n.star.x-n.x)-pc*n.vx)*e,n.vy+=(fc*(n.star.y-n.y)-pc*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>sc||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=yc(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=Zs,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=vc(ac[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=ac[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=oc,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,(sc-i)/1.2)*r.presence;if(a<=0)continue;let o=n.text;if(e.measureText(o).width>cc){for(;o.length>1&&e.measureText(`${o}…`).width>cc;)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,dc*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(${$s}, 1)`,e.fillText(o,u+8,d+11+.5)}e.restore()}drawSpecks(e){let{ctx:t}=this,n=-this.camX*this.scale*uc,r=-this.camY*this.scale*uc;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(_c(i.x*this.width+n,this.width),_c(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=ic,e.letterSpacing=`2px`,e.fillStyle=`rgba(${tc}, 0.9)`,e.fillText(t.label.toUpperCase(),a.x,a.y+o+10),e.letterSpacing=`0px`):(e.font=rc,e.fillStyle=s?`rgba(245, 245, 245, 1)`:`rgba(${ec}, 0.95)`,e.fillText(t.label,a.x,a.y+o+10))}}drawBody(e,t){let{ctx:n}=this,{star:r}=e,i=yt[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,dc*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=vc(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(${$s}, 0.55)`,n.lineWidth=1,n.stroke(),n.setLineDash([])),n.beginPath(),n.arc(u.x,u.y,m,0,Math.PI*2),n.fillStyle=Qs,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 ${nc}`,n.textAlign=`center`,n.textBaseline=`top`,n.fillStyle=`rgba(${$s}, ${a||o?1:.7})`,n.fillText(r.name,u.x,u.y+m+8*this.scale+3),n.restore()}},xc=15e3,Sc=26,Cc=12,wc=4,Tc=.0015,Ec=.01,Dc=1.3,Oc=`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 kc(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+Cc,s=n.width-r.right-Cc,c=t.x+Sc+i<=s?t.x+Sc:t.x-Sc-i,l=Math.min(Math.max(Cc,t.y-a/3),n.height-a-Cc);e.style.transform=`translate(${Math.round(Math.max(o,c))}px, ${Math.round(l)}px)`,e.style.visibility=`visible`}function Ac({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,A.useRef)(null),f=(0,A.useRef)(null),p=(0,A.useRef)(null),m=(0,A.useRef)(i);(0,A.useLayoutEffect)(()=>{m.current=i},[i]);let h=(0,A.useRef)(e);(0,A.useLayoutEffect)(()=>{h.current=e},[e]);let g=za(),_=(0,A.useRef)(g);(0,A.useLayoutEffect)(()=>{_.current=g},[g]);let v=(0,A.useRef)(null),y=(0,A.useRef)(!1);return(0,A.useEffect)(()=>{let e=d.current;if(e===null)throw Error(`the sky's canvas is not mounted`);let t=e.getBoundingClientRect(),n=new bc(e,{reducedMotion:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,onHoverPosition:e=>kc(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?Ec:Tc)),{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,A.useEffect)(()=>{p.current?.setModel(e)},[e]),(0,A.useEffect)(()=>l.listen(e=>{let t=p.current;if(t===null||e.event.type!==`tool_call`||Date.now()-Date.parse(e.ts)>xc)return;let n=Ls(h.current,e.agent,e.project);if(n===null)return;t.flash(n);let r=mo(e.event.name,e.event.input);r!==null&&t.say(n,ja(r,_.current))}),[l]),(0,A.useEffect)(()=>{p.current?.setPaused(t)},[t]),(0,A.useEffect)(()=>{p.current?.setHovered(n)},[n]),(0,A.useEffect)(()=>{p.current?.setFocus(a)},[a]),(0,A.useEffect)(()=>{p.current?.setInsets(i.left,i.right)},[i.left,i.right]),(0,M.jsxs)(`div`,{className:`absolute inset-0`,children:[(0,M.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)>wc&&(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,M.jsxs)(`fieldset`,{className:`card absolute bottom-4 flex flex-col gap-0.5 p-1`,style:{right:i.right+16},children:[(0,M.jsx)(`legend`,{className:`sr-only`,children:`Camera`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,className:Oc,onClick:()=>p.current?.zoomBy(Dc),children:`+`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,className:Oc,onClick:()=>p.current?.zoomBy(1/Dc),children:`−`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Fit the whole sky`,title:`Fit the whole sky`,className:Oc,onClick:()=>p.current?.home(),children:`⤢`})]}),(0,M.jsx)(`div`,{ref:f,className:`pointer-events-none absolute top-0 left-0 will-change-transform`,style:{visibility:`hidden`},children:u})]})}var jc={left:0,right:0};function Mc(){let[e,t]=(0,A.useState)(()=>window.innerWidth);return(0,A.useEffect)(()=>{let e=()=>t(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Nc(e,t){return e.startsWith(t)?decodeURIComponent(e.slice(t.length)):null}function Pc(){let{api:e,token:t,signOut:n,expire:r}=S(),i=D();(0,A.useEffect)(()=>$o(t,{onEvent:e=>ts(i,e),onResume:()=>void i.invalidateQueries()}),[t,i]);let[a]=(0,A.useState)(()=>new vo);(0,A.useEffect)(()=>a.follow(t),[a,t]);let o=k(),c=Se(),l=xe(),u=he(),d=s(),f=h(),p=Be(),m=te(),g=(0,A.useMemo)(()=>ka(f.data??[],p,m.data??[]),[f.data,p,m.data]),_=Ze(),v=$e({mutationFn:t=>e.setPaused(t),onSuccess:()=>void i.invalidateQueries({queryKey:[`scheduler`]})}),b=ra({select:e=>e.location.pathname}),x=ra({select:e=>e.location.href}),C=ra({select:e=>e.location.state.__TSR_index});(0,A.useEffect)(()=>_s(C,x),[C,x]);let[w,T]=(0,A.useState)(!1),[ee,E]=(0,A.useState)(null),ne=ee===b,re=(0,A.useCallback)(()=>E(null),[]),ie=(0,A.useRef)(!0),ae=Sa(),oe=Ai({strict:!1}),[se,ce]=(0,A.useState)(null),le=qe(3e4),ue=Mc(),de=b!==`/`,[fe,pe]=(0,A.useState)(ss),me=as(ue,fe),ge=(e,t)=>{let n=as(ue,e),r=n>=is(ue)?`widest`:n;pe(r),t&&cs(r)},_e=()=>{let e=os(ue,fe);pe(e),cs(e)},ve=(0,A.useMemo)(()=>de?{left:288,right:me+32}:jc,[de,me]),ye=Nc(b,`/thread/`),be=y(Nc(b,`/task/`)),O=Nc(b,`/c/`)??(ye===null?null:f.data?.find(e=>e.id===ye)?.channel??null),Ce=/^\/p\/([^/]+)\/tasks$/.exec(b)?.[1]??be.data?.project??null,we=Nc(b,`/citizen/`),Te=we===null?null:oe.scope??null,Ee=Te?.split(`/`)[0]??null,De=b===`/needs-you`?`needs-you`:b===`/proposals`||b.startsWith(`/proposal/`)?`proposals`:null,Oe=Ea().length,Ae=We().data?.length??0,je=b===`/society`?ke:/^\/p\/([^/]+)$/.exec(b)?.[1]??/^\/knowledge\/([^/]+)\//.exec(b)?.[1]??null;(0,A.useEffect)(()=>{let e=()=>{ie.current=!0},t=e=>{e.key===`Tab`&&(ie.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&&!ie.current)return;e.preventDefault(),E(b);return}e.key===`Escape`&&(ne?E(null):w?T(!1):de&&_({to:`/`}))}};return window.addEventListener(`keydown`,t),window.addEventListener(`pointerdown`,e),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`pointerdown`,e)}},[de,w,ne,b,_]);let Me=[o,l,u,d].some(e=>e.error instanceof Je&&e.error.status===401);(0,A.useEffect)(()=>{Me&&r()},[Me,r]);let Ne=(0,A.useMemo)(()=>l.data===void 0||u.data===void 0||d.data===void 0?null:Fs({members:l.data,projects:u.data,scheduler:d.data,tasks:p}),[l.data,u.data,d.data,p]);if(Ne===null){let e=[l,u,d].some(e=>e.error!==null);return(0,M.jsx)(`main`,{className:`grid h-full place-items-center`,children:(0,M.jsx)(`p`,{className:`text-meta`,"aria-live":`polite`,children:e?`The board server is not answering. Retrying…`:`Reading the board…`})})}let Pe=(De!==null||b===`/metrics`||b===`/runners`?`society`:null)??je??Ce??(O===null?we===null?null:Ee??Ne.stars.find(e=>e.name===we)?.anchor??null:O.includes(`/`)?O.split(`/`)[0]??null:`society`),Fe=ue-ve.left-ve.right,Ie=Fe>=460,Le=Math.min(560,(Ie?Fe:ue)-32),Re={left:(Ie?ve.left:0)+((Ie?Fe:ue)-Le)/2,width:Le},ze=N(f.data??[]).filter(e=>fa(e,ae)),Ve=e=>e===`society`?`the society`:u.data?.find(t=>t.slug===e)?.name??e,He=Ne.stars.find(e=>e.id===se),Ue=Ne.tasks.find(e=>`task:${e.id}`===se),Ge=l.data?.find(e=>e.name===He?.name),Ke=He===void 0?`the society`:Ve(He.queuedFor??He.anchor),Ye=e=>{let t=Ne.stars.find(t=>t.id===e);t!==void 0&&_({to:`/citizen/$name`,params:{name:t.name},search:t.state===`working`?{scope:t.anchor}:{}})},Xe=e=>{_({to:`/task/$taskId`,params:{taskId:e}})};return(0,M.jsx)(yo,{value:a,children:(0,M.jsx)(Ra,{value:g,children:(0,M.jsx)(Ao,{value:c.data?.signIn,children:(0,M.jsxs)(`main`,{className:`relative h-full overflow-hidden`,children:[(0,M.jsx)(Ac,{model:Ne,paused:d.data?.paused??!1,hovered:se,onHover:ce,insets:ve,focus:Pe,onSelectAnchor:e=>{_(e===`society`?{to:`/society`}:{to:`/p/$slug`,params:{slug:e}})},onSelectStar:Ye,onSelectTask:Xe,live:a,card:Ue===void 0?He===void 0||Ge===void 0?null:(0,M.jsx)(Wo,{member:Ge,star:He,place:Ke,now:le}):(0,M.jsx)(Qo,{mark:Ue,project:Ve(Ue.project),members:l.data})}),(0,M.jsx)(Go,{society:o.data?.name,citizens:new Set(Ne.stars.map(e=>e.name)).size,citizensOpen:b===`/citizens`,onToggleCitizens:()=>void _(b===`/citizens`?{to:`/`}:{to:`/citizens`}),runnersOpen:b===`/runners`,onToggleRunners:()=>void _(b===`/runners`?{to:`/`}:{to:`/runners`}),enrolling:Ae,attention:Oe,onOpenAttention:()=>void _({to:`/needs-you`}),paused:d.data?.paused??!1,onTogglePause:()=>v.mutate(!(d.data?.paused??!1)),pauseBusy:v.isPending,boardOpen:de,onToggleBoard:()=>void _(de?{to:`/`}:{to:`/c/$`,params:{_splat:`general`}}),logsOpen:w,metricsOpen:b===`/metrics`,onToggleMetrics:()=>void _(b===`/metrics`?{to:`/`}:{to:`/metrics`}),onToggleLogs:()=>T(!w),onSignOut:n}),de?(0,M.jsx)(ko,{activeChannel:O,activeTasks:Ce,activeCitizen:we,activeScope:Te,activeGovernance:De,activeOverview:je}):null,de?(0,M.jsxs)(ma,{label:`Board content`,className:`top-[72px] right-4 bottom-4`,style:{width:me},children:[(0,M.jsx)(Zo,{width:me,min:420,max:is(ue),onResize:ge,onToggle:_e}),(0,M.jsx)(qi,{})]}):null,w?(0,M.jsx)(Jo,{onClose:()=>T(!1)}):null,ne?(0,M.jsx)(Bo,{left:Re.left,width:Re.width,onClose:re}):(0,M.jsx)(`div`,{className:`pointer-events-none absolute bottom-5 flex justify-center px-16`,style:{left:ve.left,right:ve.right},children:(0,M.jsx)(Vo,{unread:ze,onOpen:()=>E(b)})}),Ne.stars.length===0&&!de?(0,M.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,M.jsx)(`code`,{className:`font-mono text-fg-secondary`,children:`stellaris agent add`}),`.`]}):null,(0,M.jsx)(`ul`,{className:`sr-only`,"aria-label":`Tasks in play`,children:Ne.tasks.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{type:`button`,onFocus:()=>ce(`task:${e.id}`),onBlur:()=>ce(null),onClick:()=>Xe(e.id),children:ys(e,Ve(e.project))})},e.id))}),(0,M.jsx)(`ul`,{className:`sr-only`,"aria-label":`Citizens`,children:Ne.stars.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,onFocus:()=>ce(e.id),onBlur:()=>ce(null),onClick:()=>Ye(e.id),children:[e.name,`, `,e.state,e.state===`working`?` at ${Ve(e.anchor)}`:``]})},e.id))})]})})})})}var Fc=`modulepreload`,Ic=function(e){return`/`+e},Lc={},Rc=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=Ic(t,n),t=s(t),t in Lc)return;Lc[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`:Fc,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 zc(){return null}var Bc=Fi({component:Pc}),Vc=$i({routeTree:Bc.addChildren([Ni({getParentRoute:()=>Bc,path:`/`,component:zc}),Ni({getParentRoute:()=>Bc,path:`/c/$`,component:Ii(()=>Rc(()=>import(`./ChannelView-BvMlzMiN.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])),`ChannelView`)}),Ni({getParentRoute:()=>Bc,path:`/thread/$threadId`,component:Ii(()=>Rc(()=>import(`./ThreadView-CnJPNS_8.js`),__vite__mapDeps([13,1,2,3,6,4,9,7,8,10,11,12,14])),`ThreadView`)}),Ni({getParentRoute:()=>Bc,path:`/society`,component:Ii(()=>Rc(()=>import(`./SocietyView-CdVW2DgG.js`),__vite__mapDeps([15,1,2,3,5,6,4,10,16,17,18])),`SocietyView`)}),Ni({getParentRoute:()=>Bc,path:`/p/$slug`,component:Ii(()=>Rc(()=>import(`./ProjectView-CQTn7yDo.js`),__vite__mapDeps([19,1,2,3,6,8,4,5,9,10,16,17,18])),`ProjectView`)}),Ni({getParentRoute:()=>Bc,path:`/knowledge/$scope/$topic`,component:Ii(()=>Rc(()=>import(`./KnowledgeView-L0pdaM_2.js`),__vite__mapDeps([20,1,2,3,6,4,9,10,14])),`KnowledgeView`)}),Ni({getParentRoute:()=>Bc,path:`/p/$slug/tasks`,component:Ii(()=>Rc(()=>import(`./TasksView-Ba5fPAvy.js`),__vite__mapDeps([21,1,6,8,10])),`TasksView`)}),Ni({getParentRoute:()=>Bc,path:`/task/$taskId`,component:Ii(()=>Rc(()=>import(`./TaskView-rks26vuF.js`),__vite__mapDeps([22,1,2,3,6,8,23,4,9,10,14,24,7])),`TaskView`)}),Ni({getParentRoute:()=>Bc,path:`/task/$taskId/files/$`,validateSearch:e=>{let t=Number(e.line);return Number.isInteger(t)&&t>0?{line:t}:{}},component:Ii(()=>Rc(()=>import(`./TaskFileView-BqqzxJKb.js`),__vite__mapDeps([25,1,6,9,3,10,14])),`TaskFileView`)}),Ni({getParentRoute:()=>Bc,path:`/metrics`,validateSearch:e=>{let t=_.safeParse(e.window);return t.success?{window:t.data}:{}},component:Ii(()=>Rc(()=>import(`./MetricsView-DG1alTgs.js`),__vite__mapDeps([26,1,6,10,16,17,18])),`MetricsView`)}),Ni({getParentRoute:()=>Bc,path:`/citizens`,component:Ii(()=>Rc(()=>import(`./CitizensView-Bv04iH-y.js`),__vite__mapDeps([27,1,6,17,10,18])),`CitizensView`)}),Ni({getParentRoute:()=>Bc,path:`/needs-you`,component:Ii(()=>Rc(()=>import(`./NeedsYouView-Doc0fKPi.js`),__vite__mapDeps([28,1,6,23,8,10])),`NeedsYouView`)}),Ni({getParentRoute:()=>Bc,path:`/runners`,validateSearch:e=>typeof e.code==`string`?{code:e.code}:{},component:Ii(()=>Rc(()=>import(`./RunnersView-Dx21LDFu.js`),__vite__mapDeps([29,1,2,3,17,4,10])),`RunnersView`)}),Ni({getParentRoute:()=>Bc,path:`/proposals`,component:Ii(()=>Rc(()=>import(`./ProposalsView-CSA8neXR.js`),__vite__mapDeps([30,1,6,23,8,10])),`ProposalsView`)}),Ni({getParentRoute:()=>Bc,path:`/proposal/$proposalId`,component:Ii(()=>Rc(()=>import(`./ProposalView-C92OJ_w1.js`),__vite__mapDeps([31,1,2,3,6,17,8,23,4,9,10,14,30,24,7])),`ProposalView`)}),Ni({getParentRoute:()=>Bc,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:Ii(()=>Rc(()=>import(`./CitizenView-DNQwjpIp.js`),__vite__mapDeps([32,1,2,3,6,17,4,9,10,12,18])),`CitizenView`)})])});function Hc({signInError:e}){let t=D(),[n,r]=(0,A.useState)(d),i=(0,A.useCallback)(()=>{ie(),t.clear(),r(null)},[t]),a=(0,A.useCallback)(()=>{n!==null&&p(n).signOut().catch(()=>void 0),i(),Vc.navigate({to:`/`})},[n,i]),o=(0,A.useMemo)(()=>n===null?null:{api:p(n),token:n,signOut:a,expire:i},[n,a,i]);return o===null?(0,M.jsx)(la,{initialError:e,onEnter:e=>{oe(e),r(e)}}):(0,M.jsx)(we,{value:o,children:(0,M.jsx)(na,{router:Vc})})}var Uc={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 Wc(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:Uc[r]??`GitHub sign-in failed.`}}function Gc(){let e=Wc(window.location.hash);return e!==null&&(e.token!==null&&oe(e.token),window.history.replaceState(window.history.state,``,`${window.location.pathname}${window.location.search}`)),e}var Kc=new Mt({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),qc=Gc(),Jc=document.getElementById(`root`);if(Jc===null)throw Error(`missing #root element`);(0,ia.createRoot)(Jc).render((0,M.jsx)(A.StrictMode,{children:(0,M.jsx)(_e,{client:Kc,children:(0,M.jsx)(Hc,{signInError:qc?.error??null})})}));export{ra as C,wa as S,ki as T,Ha as _,Mo as a,La as b,qa as c,go as d,eo as f,Va as g,bo as h,Lo as i,_o as l,Ja as m,us as n,No as o,po as p,vs as r,Fo as s,ms as t,Ka as u,za as v,Ai as w,Ea as x,Pa as y};
@@ -1 +1 @@
1
- import{Bt as e,Dt as t,Ht as n,It as r,Lt as i,Ot as a,Pt as o,_n as s,mn as c,pn as l}from"./format-BWr3zKWg.js";function u(e){return e.replace(/\/{2,}/g,`/`)}function d(e){return e===`/`?e:e.replace(/^\/+/,``)}function f(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function p(e){return f(d(e))}function m(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function h(e,t,r=`never`,i){if(t.includes(`//`)&&(t=u(t)),t.startsWith(`/`))return t.length===1||r===`preserve`?t:r===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let a=t===`.`,o;if(i){o=a?e:e+`\0`+t;let n=i.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else{for(e.includes(`//`)&&(e=u(e)),s=e.split(`/`);s.length>1&&n(s)===``;)s.pop();let r=t.split(`/`);for(let e=0,t=r.length;e<t;e++){let n=r[e];n===``?e?e===t-1&&s.push(n):s=[n]:n===`..`?s.length>1?s.pop():s=[``]:n===`.`||s.push(n)}}s.length>1&&(n(s)===``?r===`never`&&s.pop():r===`always`&&s.push(``));let c=s.join(`/`),l=(a?u(c):c)||`/`;return o&&i&&i.set(o,l),l}function g(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function _(e){return e==null||e===``}function v(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function y(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&_(f)){if(c===`/`&&!d)continue;f=``}o+=c+v(s,f,r)+(d||``)}}return o+a||`/`}var b=`Error preloading route! ☝️`,x=s(c(),1),S=l(),C=()=>!0,w=()=>!1;function T({children:e,fallback:t=null}){return(0,S.jsx)(x.Fragment,{children:E()?e:t})}function E(e=!0){return x.useSyncExternalStore(D,C,e?w:C)}function D(){return()=>{}}function O(...e){let t=x.useRef(e),n=t.current;return e.forEach((e,t)=>{o(n[t],e,!1,!0)||(n[t]=e)}),t.current}function k(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(b)})}var A={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function ee(e,t){let n=typeof e==`string`&&i(e);if(n)return t.has(n)?e:null}function te(e,t,n,r,i){let a=m(e.pathname,r),s=m(t.pathname,r);return(n?.exact?a!==s:!a.startsWith(s)||a.length!==s.length&&a[s.length]!==`/`)||(n?.includeSearch??!0)&&!o(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||i&&e.hash===t.hash}function j(e,n,r){let o=a(),s=x.useRef(null),c=x.useCallback(e=>{if(s.current=e,typeof n==`function`)return n(e);n&&(n.current=e)},[n]),{activeOptions:l,to:u,preload:d,preloadDelay:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,ignoreBlocker:v,disabled:y,target:b,onClick:S,onBlur:C,onFocus:w,onMouseEnter:T,onMouseLeave:D,onTouchStart:j}=e,M=E(!!l?.includeHash),[N,P,V]=O(e.search,e.params,l),[H,U]=x.useMemo(()=>[e,{...e}],[o,e.from,e._fromLocation,e.hash,e.to,N,P,e.state,e.mask,e.unsafeRelative]),ne=x.useCallback(e=>{let t=ee(u,o.protocolAllowlist);if(t!==void 0)return[t??void 0];H._fromLocation||(U._fromLocation=e);let n=o.buildLocation(U),r=B(n,o,y);return[r,!y&&(!r||i(r))?void 0:te(e,n,V,o.basepath,M)]},[V,y,M,H,U,o,u]),[W,G]=t(o.stores.location,ne,A),K=G===void 0?W:void 0,q=y||W===void 0,J=x.useRef(!1),Y=e.reloadDocument||K||q?!1:d??o.options.defaultPreload,X=f??o.options.defaultPreloadDelay??0,Z=x.useCallback(e=>{let t=e?.isIntersecting;if(!(t??Y===`intent`)){t===!1&&R(s);return}if(!X){k(o,H);return}L.has(s)||L.set(s,setTimeout(()=>{L.delete(s),k(o,H)},X))},[o,H,s,Y,X]);x.useEffect(()=>{if(!Y)return;Y===`render`&&!J.current&&(J.current=!0,k(o,H));let e=!0,t;return Y===`viewport`&&s.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&Z(t.pop())},{rootMargin:`100px`}),t.observe(s.current)),()=>{e=!1,t?.disconnect(),R(s)}},[o,H,Y,Z,s]);let Q=F(e,r);if(Q.ref=n?c:s,K)return Q.href=K,Q;let re=e=>{let t=b??e.currentTarget.getAttribute(`target`);!q&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),o.navigate({...H,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:v}))},ie=()=>{Y===`intent`&&k(o,H)},$=()=>{Y===`intent`&&R(s)};return Q.onClick=z(S,re),Q.onBlur=z(C,$),Q.onFocus=z(w,Z),Q.onMouseEnter=z(T,Z),Q.onMouseLeave=z(D,$),Q.onTouchStart=z(j,ie),I(Q,e,G,W,q,r)}var M={},N={className:`active`},P=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`_fromLocation`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function F(e,t){let n={};for(let r in e)P.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function I(e,t,n,i,a,o){let{activeProps:s,inactiveProps:c,className:l,style:u,target:d}=t,f=r(n?s:c,{})??(n?N:M);Object.assign(e,f),e.href=i,o!==`a`&&(e.disabled=a),e.target=d;let p=f.style;(u||p)&&(e.style=u&&p?{...u,...p}:u||p);let m=f.className;return(l||m)&&(e.className=l?m?`${l} ${m}`:l:m),a&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var L=new WeakMap,R=e=>{clearTimeout(L.get(e)),L.delete(e)},z=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function B(t,n,r){if(r)return;let i=t.maskedLocation??t,a=i.external?i.publicHref:n.history.createHref(i.publicHref)||`/`;if(!i.external&&a===i.publicHref||!e(a,n.protocolAllowlist))return a}var V=x.memo(x.forwardRef((e,t)=>{let n=e._asChild||`a`,r=j(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return x.createElement(n,r,i)}),H);function H(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!P.has(r)||!o(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}export{y as a,d as c,g as i,f as l,T as n,h as o,u as r,p as s,V as t};
1
+ import{Bt as e,Dt as t,Ht as n,It as r,Lt as i,Ot as a,Pt as o,_n as s,mn as c,pn as l}from"./format-C3aawMM6.js";function u(e){return e.replace(/\/{2,}/g,`/`)}function d(e){return e===`/`?e:e.replace(/^\/+/,``)}function f(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function p(e){return f(d(e))}function m(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function h(e,t,r=`never`,i){if(t.includes(`//`)&&(t=u(t)),t.startsWith(`/`))return t.length===1||r===`preserve`?t:r===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let a=t===`.`,o;if(i){o=a?e:e+`\0`+t;let n=i.get(o);if(n)return n}let s;if(a)s=e.split(`/`);else{for(e.includes(`//`)&&(e=u(e)),s=e.split(`/`);s.length>1&&n(s)===``;)s.pop();let r=t.split(`/`);for(let e=0,t=r.length;e<t;e++){let n=r[e];n===``?e?e===t-1&&s.push(n):s=[n]:n===`..`?s.length>1?s.pop():s=[``]:n===`.`||s.push(n)}}s.length>1&&(n(s)===``?r===`never`&&s.pop():r===`always`&&s.push(``));let c=s.join(`/`),l=(a?u(c):c)||`/`;return o&&i&&i.set(o,l),l}function g(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function _(e){return e==null||e===``}function v(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function y(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&_(f)){if(c===`/`&&!d)continue;f=``}o+=c+v(s,f,r)+(d||``)}}return o+a||`/`}var b=`Error preloading route! ☝️`,x=s(c(),1),S=l(),C=()=>!0,w=()=>!1;function T({children:e,fallback:t=null}){return(0,S.jsx)(x.Fragment,{children:E()?e:t})}function E(e=!0){return x.useSyncExternalStore(D,C,e?w:C)}function D(){return()=>{}}function O(...e){let t=x.useRef(e),n=t.current;return e.forEach((e,t)=>{o(n[t],e,!1,!0)||(n[t]=e)}),t.current}function k(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(b)})}var A={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function ee(e,t){let n=typeof e==`string`&&i(e);if(n)return t.has(n)?e:null}function te(e,t,n,r,i){let a=m(e.pathname,r),s=m(t.pathname,r);return(n?.exact?a!==s:!a.startsWith(s)||a.length!==s.length&&a[s.length]!==`/`)||(n?.includeSearch??!0)&&!o(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||i&&e.hash===t.hash}function j(e,n,r){let o=a(),s=x.useRef(null),c=x.useCallback(e=>{if(s.current=e,typeof n==`function`)return n(e);n&&(n.current=e)},[n]),{activeOptions:l,to:u,preload:d,preloadDelay:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,ignoreBlocker:v,disabled:y,target:b,onClick:S,onBlur:C,onFocus:w,onMouseEnter:T,onMouseLeave:D,onTouchStart:j}=e,M=E(!!l?.includeHash),[N,P,V]=O(e.search,e.params,l),[H,U]=x.useMemo(()=>[e,{...e}],[o,e.from,e._fromLocation,e.hash,e.to,N,P,e.state,e.mask,e.unsafeRelative]),ne=x.useCallback(e=>{let t=ee(u,o.protocolAllowlist);if(t!==void 0)return[t??void 0];H._fromLocation||(U._fromLocation=e);let n=o.buildLocation(U),r=B(n,o,y);return[r,!y&&(!r||i(r))?void 0:te(e,n,V,o.basepath,M)]},[V,y,M,H,U,o,u]),[W,G]=t(o.stores.location,ne,A),K=G===void 0?W:void 0,q=y||W===void 0,J=x.useRef(!1),Y=e.reloadDocument||K||q?!1:d??o.options.defaultPreload,X=f??o.options.defaultPreloadDelay??0,Z=x.useCallback(e=>{let t=e?.isIntersecting;if(!(t??Y===`intent`)){t===!1&&R(s);return}if(!X){k(o,H);return}L.has(s)||L.set(s,setTimeout(()=>{L.delete(s),k(o,H)},X))},[o,H,s,Y,X]);x.useEffect(()=>{if(!Y)return;Y===`render`&&!J.current&&(J.current=!0,k(o,H));let e=!0,t;return Y===`viewport`&&s.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&Z(t.pop())},{rootMargin:`100px`}),t.observe(s.current)),()=>{e=!1,t?.disconnect(),R(s)}},[o,H,Y,Z,s]);let Q=F(e,r);if(Q.ref=n?c:s,K)return Q.href=K,Q;let re=e=>{let t=b??e.currentTarget.getAttribute(`target`);!q&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),o.navigate({...H,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:v}))},ie=()=>{Y===`intent`&&k(o,H)},$=()=>{Y===`intent`&&R(s)};return Q.onClick=z(S,re),Q.onBlur=z(C,$),Q.onFocus=z(w,Z),Q.onMouseEnter=z(T,Z),Q.onMouseLeave=z(D,$),Q.onTouchStart=z(j,ie),I(Q,e,G,W,q,r)}var M={},N={className:`active`},P=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`_fromLocation`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function F(e,t){let n={};for(let r in e)P.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function I(e,t,n,i,a,o){let{activeProps:s,inactiveProps:c,className:l,style:u,target:d}=t,f=r(n?s:c,{})??(n?N:M);Object.assign(e,f),e.href=i,o!==`a`&&(e.disabled=a),e.target=d;let p=f.style;(u||p)&&(e.style=u&&p?{...u,...p}:u||p);let m=f.className;return(l||m)&&(e.className=l?m?`${l} ${m}`:l:m),a&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var L=new WeakMap,R=e=>{clearTimeout(L.get(e)),L.delete(e)},z=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function B(t,n,r){if(r)return;let i=t.maskedLocation??t,a=i.external?i.publicHref:n.history.createHref(i.publicHref)||`/`;if(!i.external&&a===i.publicHref||!e(a,n.protocolAllowlist))return a}var V=x.memo(x.forwardRef((e,t)=>{let n=e._asChild||`a`,r=j(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return x.createElement(n,r,i)}),H);function H(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!P.has(r)||!o(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}export{y as a,d as c,g as i,f as l,T as n,h as o,u as r,p as s,V as t};
@@ -1 +1 @@
1
- import{ht as e,mt as t}from"./format-BWr3zKWg.js";var n=[{phase:`returned`,label:`Sent back`},{phase:`waiting`,label:`Waiting for a holder`},{phase:`working`,label:`Being worked`},{phase:`landing`,label:`Landing`},{phase:`done`,label:`Done`},{phase:`abandoned`,label:`Abandoned`}],r={returned:`bg-orange-500/15 text-orange-300`,waiting:`bg-amber-500/15 text-amber-300`,working:`bg-emerald-500/15 text-emerald-300`,landing:`bg-sky-500/15 text-sky-300`,done:`bg-surface-2 text-fg-secondary`,abandoned:`bg-surface-2 text-fg-muted`};function i(e){return e.status===`done`||e.status===`abandoned`?e.status:e.completing?`landing`:e.returned===void 0?e.status===`claimed`?`working`:`waiting`:`returned`}function a(e,t){let n=i(e);return t.id===e.stage&&n!==`landing`&&n!==`done`&&n!==`abandoned`}function o(e){let t=i(e);return t!==`done`&&t!==`abandoned`}function s(e,t){return e.stages.find(e=>e.id===t)?.name??t}function c(e,n){if(!t(e))return e.action===`approved`?{text:`approved`,tone:r.working}:{text:`rejected`,tone:`bg-red-500/15 text-red-300`};let i=e=>n===void 0?e:s(n,e);if(e.action===`advanced`)return{text:e.to===null?`finished ${i(e.stage)}`:`finished ${i(e.stage)} → ${i(e.to)}`,tone:r.working};if(e.action===`returned`){let t=e.to===null?`an earlier stage`:i(e.to);return{text:`sent back from ${i(e.stage)} to ${t}`,tone:r.returned}}return e.action===`abandoned`?{text:`abandoned`,tone:r.abandoned}:e.action===`landed`?{text:`landed`,tone:r.landing}:{text:`landing failed · back at ${i(e.stage)}`,tone:`bg-red-500/15 text-red-300`}}function l(e){return e.agent===void 0?e.role===void 0?`anyone in the project`:`any ${e.role}`:e.agent}function u(e){return n.map(({phase:t})=>({phase:t,tasks:e.filter(e=>i(e)===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))})).filter(e=>e.tasks.length>0)}function d(t){let n=i(t);return n===`done`?`All ${t.stages.length} stages done`:n===`abandoned`?`Abandoned`:`Stage ${e(t,t.stage)+1} of ${t.stages.length}`}export{o as a,d as c,u as i,s as l,r as n,a as o,l as r,i as s,n as t,c as u};
1
+ import{ht as e,mt as t}from"./format-C3aawMM6.js";var n=[{phase:`returned`,label:`Sent back`},{phase:`waiting`,label:`Waiting for a holder`},{phase:`working`,label:`Being worked`},{phase:`landing`,label:`Landing`},{phase:`done`,label:`Done`},{phase:`abandoned`,label:`Abandoned`}],r={returned:`bg-orange-500/15 text-orange-300`,waiting:`bg-amber-500/15 text-amber-300`,working:`bg-emerald-500/15 text-emerald-300`,landing:`bg-sky-500/15 text-sky-300`,done:`bg-surface-2 text-fg-secondary`,abandoned:`bg-surface-2 text-fg-muted`};function i(e){return e.status===`done`||e.status===`abandoned`?e.status:e.completing?`landing`:e.returned===void 0?e.status===`claimed`?`working`:`waiting`:`returned`}function a(e,t){let n=i(e);return t.id===e.stage&&n!==`landing`&&n!==`done`&&n!==`abandoned`}function o(e){let t=i(e);return t!==`done`&&t!==`abandoned`}function s(e,t){return e.stages.find(e=>e.id===t)?.name??t}function c(e,n){if(!t(e))return e.action===`approved`?{text:`approved`,tone:r.working}:{text:`rejected`,tone:`bg-red-500/15 text-red-300`};let i=e=>n===void 0?e:s(n,e);if(e.action===`advanced`)return{text:e.to===null?`finished ${i(e.stage)}`:`finished ${i(e.stage)} → ${i(e.to)}`,tone:r.working};if(e.action===`returned`){let t=e.to===null?`an earlier stage`:i(e.to);return{text:`sent back from ${i(e.stage)} to ${t}`,tone:r.returned}}return e.action===`abandoned`?{text:`abandoned`,tone:r.abandoned}:e.action===`landed`?{text:`landed`,tone:r.landing}:{text:`landing failed · back at ${i(e.stage)}`,tone:`bg-red-500/15 text-red-300`}}function l(e){return e.agent===void 0?e.role===void 0?`anyone in the project`:`any ${e.role}`:e.agent}function u(e){return n.map(({phase:t})=>({phase:t,tasks:e.filter(e=>i(e)===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))})).filter(e=>e.tasks.length>0)}function d(t){let n=i(t);return n===`done`?`All ${t.stages.length} stages done`:n===`abandoned`?`Abandoned`:`Stage ${e(t,t.stage)+1} of ${t.stages.length}`}export{o as a,d as c,u as i,s as l,r as n,a as o,l as r,i as s,n as t,c as u};
@@ -1 +1 @@
1
- import{Dt as e,Gt as t,Ot as n,_n as r,mn as i}from"./format-BWr3zKWg.js";function a(){throw Error(`Invariant failed`)}var o=r(i(),1),s=o.createContext(void 0),c=o.createContext(void 0),l={};function u(e,n){let r=o.useRef();return i=>{let a=e?.select?e.select(i):i;return e?.structuralSharing??n.options.defaultStructuralSharing?r.current=t(r.current,a):a}}function d(t){let r=n(),i=o.useContext(t.from?c:s),d=t.from??i,f=r.stores.getMatchStore(d),p=u(t,r),m=e(f,e=>e?p(e):l);if(m!==l)return m;(t.shouldThrow??!0)&&a()}export{a as i,u as n,s as r,d as t};
1
+ import{Dt as e,Gt as t,Ot as n,_n as r,mn as i}from"./format-C3aawMM6.js";function a(){throw Error(`Invariant failed`)}var o=r(i(),1),s=o.createContext(void 0),c=o.createContext(void 0),l={};function u(e,n){let r=o.useRef();return i=>{let a=e?.select?e.select(i):i;return e?.structuralSharing??n.options.defaultStructuralSharing?r.current=t(r.current,a):a}}function d(t){let r=n(),i=o.useContext(t.from?c:s),d=t.from??i,f=r.stores.getMatchStore(d),p=u(t,r),m=e(f,e=>e?p(e):l);if(m!==l)return m;(t.shouldThrow??!0)&&a()}export{a as i,u as n,s as r,d as t};
@@ -1 +1 @@
1
- import{_n as e,mn as t}from"./format-BWr3zKWg.js";var n=e(t(),1);function r(){let e=(0,n.useRef)(null),t=(0,n.useRef)(!0);return(0,n.useLayoutEffect)(()=>{let n=e.current;n!==null&&t.current&&(n.scrollTop=n.scrollHeight)}),{ref:e,onScroll:()=>{let n=e.current;n!==null&&(t.current=n.scrollHeight-n.scrollTop-n.clientHeight<80)}}}export{r as t};
1
+ import{_n as e,mn as t}from"./format-C3aawMM6.js";var n=e(t(),1);function r(){let e=(0,n.useRef)(null),t=(0,n.useRef)(!0);return(0,n.useLayoutEffect)(()=>{let n=e.current;n!==null&&t.current&&(n.scrollTop=n.scrollHeight)}),{ref:e,onScroll:()=>{let n=e.current;n!==null&&(t.current=n.scrollHeight-n.scrollTop-n.clientHeight<80)}}}export{r as t};
@@ -6,15 +6,15 @@
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-Cxqhrg2v.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/format-BWr3zKWg.js">
9
+ <script type="module" crossorigin src="/assets/index-krHkeIbX.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/format-C3aawMM6.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/mentions-BCdV0bMK.js">
12
- <link rel="modulepreload" crossorigin href="/assets/compose-BG_-Tp87.js">
13
- <link rel="modulepreload" crossorigin href="/assets/useMatch-BpnmzT6s.js">
14
- <link rel="modulepreload" crossorigin href="/assets/link-CFdt17Sp.js">
15
- <link rel="modulepreload" crossorigin href="/assets/CliIcon-CT5ljQDC.js">
16
- <link rel="modulepreload" crossorigin href="/assets/tasks-C10zwkED.js">
17
- <link rel="modulepreload" crossorigin href="/assets/governance-cDTg2_iq.js">
12
+ <link rel="modulepreload" crossorigin href="/assets/compose-BgpUWGYE.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/useMatch-B-8IcuU6.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/link-DAMxBItI.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/CliIcon-tYTwI_RQ.js">
16
+ <link rel="modulepreload" crossorigin href="/assets/tasks-bwj_EdwF.js">
17
+ <link rel="modulepreload" crossorigin href="/assets/governance-Di4MijNG.js">
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-VVnGdAXc.css">
19
19
  </head>
20
20
  <body class="antialiased">