@kubitnodes/stellaris 0.3.9 → 0.3.10

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 (32) hide show
  1. package/dist/cli/index.js +27 -11
  2. package/dist/server/index.js +100 -69
  3. package/package.json +1 -1
  4. package/web/dist/assets/{BackLink-1EUHNOu3.js → BackLink-B3tz8OFm.js} +1 -1
  5. package/web/dist/assets/{ChannelView-A47Rvstg.js → ChannelView-Dkzr1zkF.js} +1 -1
  6. package/web/dist/assets/{CitizenView-B_jG9N5w.js → CitizenView-BLgyEvYz.js} +1 -1
  7. package/web/dist/assets/{CitizensView-DdIHzcx3.js → CitizensView-DttP5FqR.js} +1 -1
  8. package/web/dist/assets/{KnowledgeView-CXRQ4igk.js → KnowledgeView-DFAC95aF.js} +1 -1
  9. package/web/dist/assets/{Markdown-B2tp7ki-.js → Markdown-4W4xjIq7.js} +1 -1
  10. package/web/dist/assets/{MessageItem-CWZ0X2Vr.js → MessageItem-Bfpve1_Y.js} +1 -1
  11. package/web/dist/assets/{MetricsView-7X3Cmybh.js → MetricsView-Bp486U0v.js} +1 -1
  12. package/web/dist/assets/{NeedsYouView-Pi1jBF8V.js → NeedsYouView-CJ4COcNn.js} +1 -1
  13. package/web/dist/assets/{Overview-C1leALP3.js → Overview-BnO1K52h.js} +1 -1
  14. package/web/dist/assets/{Pane-DxXjKLAj.js → Pane-xzIpwnBD.js} +1 -1
  15. package/web/dist/assets/{ProjectView-DFReelVz.js → ProjectView-w0mcF0KW.js} +1 -1
  16. package/web/dist/assets/{ProposalView-3L5osVUL.js → ProposalView-CyJCwUYK.js} +1 -1
  17. package/web/dist/assets/{ProposalsView-Uc6fp4bD.js → ProposalsView-XrraDhwt.js} +1 -1
  18. package/web/dist/assets/{RunnersView-D4pd3ArT.js → RunnersView-H3kCdSQB.js} +1 -1
  19. package/web/dist/assets/{SocietyView--buUCciX.js → SocietyView-Cf8ENDAw.js} +1 -1
  20. package/web/dist/assets/{SubjectThread-C811fit3.js → SubjectThread-ClMmgVVd.js} +1 -1
  21. package/web/dist/assets/{TaskFileView-dvFssKHp.js → TaskFileView-CRwwL5K8.js} +1 -1
  22. package/web/dist/assets/{TaskView-C-VIKoFp.js → TaskView-A9IgTxQ0.js} +1 -1
  23. package/web/dist/assets/{TasksView-BXqfwU5R.js → TasksView-CnhTIldG.js} +1 -1
  24. package/web/dist/assets/{ThreadCard-Bn7HfgDI.js → ThreadCard-fvf8cY_l.js} +1 -1
  25. package/web/dist/assets/{ThreadForms-CzYPjU1-.js → ThreadForms-D09Ykgj9.js} +1 -1
  26. package/web/dist/assets/{ThreadView-BioBQeqV.js → ThreadView-BqNSssCf.js} +1 -1
  27. package/web/dist/assets/{citizen-BqHxQY9q.js → citizen-C27Wvimj.js} +1 -1
  28. package/web/dist/assets/{format-Cc6KjiYZ.js → format-lz-5NQWT.js} +1 -1
  29. package/web/dist/assets/{index-WB0PqHlY.js → index-CoKyPk79.js} +3 -3
  30. package/web/dist/assets/{tasks-CbQrkZ1C.js → tasks-DK1cnXqs.js} +1 -1
  31. package/web/dist/assets/{useStickyScroll-NvlGfk6Z.js → useStickyScroll-CfP3Yl_4.js} +1 -1
  32. package/web/dist/index.html +3 -3
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChannelView-A47Rvstg.js","assets/format-Cc6KjiYZ.js","assets/MessageItem-CWZ0X2Vr.js","assets/tasks-CbQrkZ1C.js","assets/Markdown-B2tp7ki-.js","assets/Pane-DxXjKLAj.js","assets/ThreadCard-Bn7HfgDI.js","assets/ThreadForms-CzYPjU1-.js","assets/useStickyScroll-NvlGfk6Z.js","assets/ThreadView-BioBQeqV.js","assets/BackLink-1EUHNOu3.js","assets/SocietyView--buUCciX.js","assets/Overview-C1leALP3.js","assets/citizen-BqHxQY9q.js","assets/ProjectView-DFReelVz.js","assets/KnowledgeView-CXRQ4igk.js","assets/TasksView-BXqfwU5R.js","assets/TaskView-C-VIKoFp.js","assets/SubjectThread-C811fit3.js","assets/TaskFileView-dvFssKHp.js","assets/MetricsView-7X3Cmybh.js","assets/CitizensView-DdIHzcx3.js","assets/NeedsYouView-Pi1jBF8V.js","assets/RunnersView-D4pd3ArT.js","assets/ProposalsView-Uc6fp4bD.js","assets/ProposalView-3L5osVUL.js","assets/CitizenView-B_jG9N5w.js"])))=>i.map(i=>d[i]);
2
- import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Ct as s,D as c,Dt as l,E as u,Et as d,F as f,Ft as p,G as m,Gt as h,H as g,It as _,J as v,Jt as y,K as b,Kt as x,Lt as S,Mt as C,Nt as w,O as ee,Ot as T,P as te,Pt as ne,Qt as re,R as ie,Rt as ae,S as oe,St as se,Tt as ce,U as le,Ut as ue,V as de,Vt as E,W as fe,Wt as pe,X as me,Xt as he,Yt as ge,Z as _e,Zt as ve,_t as ye,an as be,at as D,b as O,c as xe,cn as Se,ct as Ce,dn as we,en as Te,et as k,ft as Ee,g as De,gt as Oe,h as ke,i as Ae,in as je,j as Me,jt as Ne,kt as Pe,ln as Fe,lt as Ie,n as Le,nn as Re,nt as ze,on as Be,ot as Ve,pn as He,pt as Ue,q as We,qt as Ge,r as Ke,rn as qe,rt as Je,s as Ye,sn as Xe,st as Ze,t as Qe,tn as $e,tt as et,u as tt,un as nt,w as rt,wt as it,xt as at,y as ot,z as st,zt as ct}from"./format-Cc6KjiYZ.js";import{a as lt,n as ut,r as dt,s as ft,t as pt}from"./tasks-CbQrkZ1C.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 mt=class extends pe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ht(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=h({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Ge.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ht(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var gt=class extends ge{#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 mt({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=_t(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=_t(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=_t(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=_t(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Ge.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let n={exact:!0,...e};return this.getAll().find(e=>t(n,e))}findAll(e={}){return this.getAll().filter(n=>t(e,n))}notify(e){Ge.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Ge.batch(()=>Promise.all(e.map(e=>e.continue().catch($e))))}};function _t(e){return e.options.scope?.id}var vt=class extends ge{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),je(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ve(t.mutationKey)!==ve(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ht();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){Ge.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},yt=class extends ge{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??re(r,t),a=this.get(i);return a||(a=new ue({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Ge.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Te(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Te(e,t)):t}notify(e){Ge.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ge.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ge.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new yt,this.#t=e.mutationCache||new gt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=x.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(qe(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=he(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Ge.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Ge.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Ge.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Ge.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then($e).catch($e)}invalidateQueries(e,t={}){return Ge.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ge.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch($e)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then($e)}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(qe(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(qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then($e).catch($e)}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($e).catch($e)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return x.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(ve(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Re(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ve(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Re(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||=re(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===Be&&(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()}},A=He(nt(),1);function xt(e,t){let n=Se(t),[r]=A.useState(()=>new vt(n,e));A.useEffect(()=>{r.setOptions(e)},[r,e]);let i=A.useSyncExternalStore(A.useCallback(e=>r.subscribe(Ge.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=A.useCallback((...e)=>{r.mutate(e[0],e[1]).catch($e)},[r]);if(i.error&&be(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var St=we((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,ne());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}}var S=!1,C=-1,w=5,ee=-1;function T(){return g?!0:!(e.unstable_now()-ee<w)}function te(){if(g=!1,S){var t=e.unstable_now();ee=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&&T());){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&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ne():S=!1}}}var ne;if(typeof y==`function`)ne=function(){y(te)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=te,ne=function(){ie.postMessage(null)}}else ne=function(){_(te,0)};function ae(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,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ne()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Ct=we(((e,t)=>{t.exports=St()})),wt=we((e=>{var t=nt();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`})),Tt=we(((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=wt()})),Et=we((e=>{var t=Ct(),n=nt(),r=Tt();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,ee=Symbol.for(`react.element`),T=Symbol.for(`react.transitional.element`),te=Symbol.for(`react.portal`),ne=Symbol.for(`react.fragment`),re=Symbol.for(`react.strict_mode`),ie=Symbol.for(`react.profiler`),ae=Symbol.for(`react.consumer`),oe=Symbol.for(`react.context`),se=Symbol.for(`react.forward_ref`),ce=Symbol.for(`react.suspense`),le=Symbol.for(`react.suspense_list`),ue=Symbol.for(`react.memo`),de=Symbol.for(`react.lazy`),E=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 ne:return`Fragment`;case ie:return`Profiler`;case re:return`StrictMode`;case ce:return`Suspense`;case le:return`SuspenseList`;case E:return`Activity`;case me:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case te:return`Portal`;case oe:return e.displayName||`Context`;case ae:return(e._context.displayName||`Context`)+`.Consumer`;case se:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ue:return t=e.displayName||null,t===null?ye(e.type)||`Memo`:t;case de: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 Ae(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 je(){Te(Ee),Te(De),Te(Oe)}function Me(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 Ne(e){De.current===e&&(Te(Ee),Te(De)),ke.current===e&&(Te(ke),sh._currentValue=xe)}var Pe,Fe;function Ie(e){if(Pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Pe=t&&t[1]||``,Fe=-1<e.stack.indexOf(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ChannelView-Dkzr1zkF.js","assets/format-lz-5NQWT.js","assets/MessageItem-Bfpve1_Y.js","assets/tasks-DK1cnXqs.js","assets/Markdown-4W4xjIq7.js","assets/Pane-xzIpwnBD.js","assets/ThreadCard-fvf8cY_l.js","assets/ThreadForms-D09Ykgj9.js","assets/useStickyScroll-CfP3Yl_4.js","assets/ThreadView-BqNSssCf.js","assets/BackLink-B3tz8OFm.js","assets/SocietyView-Cf8ENDAw.js","assets/Overview-BnO1K52h.js","assets/citizen-C27Wvimj.js","assets/ProjectView-w0mcF0KW.js","assets/KnowledgeView-DFAC95aF.js","assets/TasksView-CnhTIldG.js","assets/TaskView-A9IgTxQ0.js","assets/SubjectThread-ClMmgVVd.js","assets/TaskFileView-CRwwL5K8.js","assets/MetricsView-Bp486U0v.js","assets/CitizensView-DttP5FqR.js","assets/NeedsYouView-CJ4COcNn.js","assets/RunnersView-H3kCdSQB.js","assets/ProposalsView-XrraDhwt.js","assets/ProposalView-CyJCwUYK.js","assets/CitizenView-BLgyEvYz.js"])))=>i.map(i=>d[i]);
2
+ import{$ as e,$t as t,A as n,At as r,B as i,Bt as a,C as o,Ct as s,D as c,Dt as l,E as u,Et as d,F as f,Ft as p,G as m,Gt as h,H as g,It as _,J as v,Jt as y,K as b,Kt as x,Lt as S,Mt as C,Nt as w,O as ee,Ot as T,P as te,Pt as ne,Qt as re,R as ie,Rt as ae,S as oe,St as se,Tt as ce,U as le,Ut as ue,V as de,Vt as E,W as fe,Wt as pe,X as me,Xt as he,Yt as ge,Z as _e,Zt as ve,_t as ye,an as be,at as D,b as O,c as xe,cn as Se,ct as Ce,dn as we,en as Te,et as k,ft as Ee,g as De,gt as Oe,h as ke,i as Ae,in as je,j as Me,jt as Ne,kt as Pe,ln as Fe,lt as Ie,n as Le,nn as Re,nt as ze,on as Be,ot as Ve,pn as He,pt as Ue,q as We,qt as Ge,r as Ke,rn as qe,rt as Je,s as Ye,sn as Xe,st as Ze,t as Qe,tn as $e,tt as et,u as tt,un as nt,w as rt,wt as it,xt as at,y as ot,z as st,zt as ct}from"./format-lz-5NQWT.js";import{a as lt,n as ut,r as dt,s as ft,t as pt}from"./tasks-DK1cnXqs.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 mt=class extends pe{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||ht(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=h({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Ge.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function ht(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var gt=class extends ge{#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 mt({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=_t(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=_t(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=_t(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=_t(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Ge.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let n={exact:!0,...e};return this.getAll().find(e=>t(n,e))}findAll(e={}){return this.getAll().filter(n=>t(e,n))}notify(e){Ge.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Ge.batch(()=>Promise.all(e.map(e=>e.continue().catch($e))))}};function _t(e){return e.options.scope?.id}var vt=class extends ge{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),je(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&ve(t.mutationKey)!==ve(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??ht();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){Ge.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},yt=class extends ge{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??re(r,t),a=this.get(i);return a||(a=new ue({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){this.#e.get(e.queryHash)===e&&(e.destroy(),this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Ge.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Te(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Te(e,t)):t}notify(e){Ge.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Ge.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Ge.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},bt=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new yt,this.#t=e.mutationCache||new gt,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=y.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=x.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(qe(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=he(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Ge.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Ge.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Ge.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=Ge.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then($e).catch($e)}invalidateQueries(e,t={}){return Ge.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Ge.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch($e)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then($e)}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(qe(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(qe(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then($e).catch($e)}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($e).catch($e)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return x.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(ve(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Re(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(ve(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Re(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||=re(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===Be&&(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()}},A=He(nt(),1);function xt(e,t){let n=Se(t),[r]=A.useState(()=>new vt(n,e));A.useEffect(()=>{r.setOptions(e)},[r,e]);let i=A.useSyncExternalStore(A.useCallback(e=>r.subscribe(Ge.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=A.useCallback((...e)=>{r.mutate(e[0],e[1]).catch($e)},[r]);if(i.error&&be(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var St=we((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,ne());else{var t=n(l);t!==null&&ae(x,t.startTime-e)}}}var S=!1,C=-1,w=5,ee=-1;function T(){return g?!0:!(e.unstable_now()-ee<w)}function te(){if(g=!1,S){var t=e.unstable_now();ee=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&&T());){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&&ae(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?ne():S=!1}}}var ne;if(typeof y==`function`)ne=function(){y(te)};else if(typeof MessageChannel<`u`){var re=new MessageChannel,ie=re.port2;re.port1.onmessage=te,ne=function(){ie.postMessage(null)}}else ne=function(){_(te,0)};function ae(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,ae(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,ne()))),r},e.unstable_shouldYield=T,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Ct=we(((e,t)=>{t.exports=St()})),wt=we((e=>{var t=nt();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`})),Tt=we(((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=wt()})),Et=we((e=>{var t=Ct(),n=nt(),r=Tt();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,ee=Symbol.for(`react.element`),T=Symbol.for(`react.transitional.element`),te=Symbol.for(`react.portal`),ne=Symbol.for(`react.fragment`),re=Symbol.for(`react.strict_mode`),ie=Symbol.for(`react.profiler`),ae=Symbol.for(`react.consumer`),oe=Symbol.for(`react.context`),se=Symbol.for(`react.forward_ref`),ce=Symbol.for(`react.suspense`),le=Symbol.for(`react.suspense_list`),ue=Symbol.for(`react.memo`),de=Symbol.for(`react.lazy`),E=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 ne:return`Fragment`;case ie:return`Profiler`;case re:return`StrictMode`;case ce:return`Suspense`;case le:return`SuspenseList`;case E:return`Activity`;case me:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case te:return`Portal`;case oe:return e.displayName||`Context`;case ae:return(e._context.displayName||`Context`)+`.Consumer`;case se:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ue:return t=e.displayName||null,t===null?ye(e.type)||`Memo`:t;case de: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 Ae(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 je(){Te(Ee),Te(De),Te(Oe)}function Me(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 Ne(e){De.current===e&&(Te(Ee),Te(De)),ke.current===e&&(Te(ke),sh._currentValue=xe)}var Pe,Fe;function Ie(e){if(Pe===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);Pe=t&&t[1]||``,Fe=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+Pe+e+Fe}var Le=!1;function Re(e,t){if(!e||Le)return``;Le=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
5
5
  `),l=s.split(`
@@ -20,4 +20,4 @@ Error generating stack: `+e.message+`
20
20
  `)){let n=Ro(o.slice(0,t));o=o.slice(t+2),n!==``&&e.onData(n)}e.onBatch?.()}}catch{if(n.aborted)return}i=!0,await Lo(r,n),r=Math.min(r*2,15e3)}})(),()=>t.abort()}function Bo(e,t,n){return v(e,t,n)}function Vo(e){return e.thread===void 0?e.scope:`${e.scope}/${e.thread}`}function Ho(e,t){return[...e.values()].filter(e=>e.agent===t).toSorted((e,t)=>t.lastAt.localeCompare(e.lastAt))}var Uo=400,Wo=400,Go=4e3,Ko=/^\[([^\]]*)\] (.*?) from @([a-z0-9][a-z0-9-]*)(?:, who .*?)? \(message [0-9A-Z]+\)$/;function qo(e){let t=e.split(/^### /m).slice(1).flatMap(e=>{let[t=``,...n]=e.split(`
21
21
  `),r=Ko.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 I(e){let t=/^mcp__(.+?)__(.+)$/.exec(e);return t===null?e:t[1]===`board`?t[2]??e:`${t[1]}:${t[2]}`}function L(e,t){return e.length<=t?e:`${e.slice(0,t-1)}…`}function Jo(e){return e.replaceAll(/\s+/g,` `).trim()}function Yo(e){return e.split(`
23
- `).map(e=>e.trim()).find(e=>e.length>0)??``}function Xo(e){return/^\/bin\/(?:ba)?sh -lc (["'])([\s\S]*)\1$/.exec(e.trim())?.[2]??e}function Zo(e){return typeof e==`object`&&e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):{}}var Qo=[`file_path`,`path`,`url`,`query`,`pattern`,`description`,`prompt`];function $o(e){let t=Zo(e),n=t.command;if(typeof n==`string`){let e=Xo(n);return{summary:L(Jo(e),Wo),detail:L(e,Go)}}let r=L(JSON.stringify(e??null,null,2),Go),i=t.changes;if(Array.isArray(i))return{summary:L(i.map(e=>Zo(e).path).filter(e=>typeof e==`string`).join(`, `),Wo),detail:r};let a=Qo.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:L(Jo(a??o.slice(0,3).join(` · `)),Wo),detail:r}}var es=`StructuredOutput`;function ts(e,t){try{return Zo(JSON.parse(e)).summary===t}catch{return!1}}function R(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 ns(e,t,{maxSteps:n}={maxSteps:Uo}){let{event:r}=t,i=Bo(t.agent,t.project,t.thread),a=e.get(i),o=new Map(e),s={agent:t.agent,scope:t.project,...t.thread===void 0?{}:{thread:t.thread}};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,R(c,{kind:`say`,seq:t.seq,at:t.ts,text:r.delta},n));break;case`tool_call`:if(r.name===es)break;o.set(i,R(c,{kind:`tool`,seq:t.seq,at:t.ts,name:r.name,...$o(r.input),ok:null,output:null},n));break;case`tool_result`:{let e=c.steps.findIndex(e=>e.kind===`tool`&&e.name===r.name&&e.ok===null),n=c.steps[e];if(n?.kind===`tool`){let a=c.steps.with(e,{...n,ok:r.ok,output:r.output??null});o.set(i,{...c,steps:a,lastAt:t.ts})}break}case`error`:o.set(i,R(c,{kind:`error`,seq:t.seq,at:t.ts,message:r.message},n));break;case`steered`:o.set(i,R(c,{kind:`steer`,seq:t.seq,at:t.ts,...qo(r.text??``)},n));break;case`turn_completed`:{let e=r.status?.summary??null,n=c.steps.at(-1),a=n?.kind===`say`&&e!==null&&ts(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 rs(e,t,n,r){let i=new Map;for(let[a,o]of e.entries())i=ns(i,{seq:a+1,ts:o.ts,agent:t,project:n,...r===void 0?{}:{thread:r},event:o.event},{maxSteps:1/0});return i.get(Bo(t,n,r))}function is(e,t){if(I(e)!==`post_message`)return null;let n=Zo(t).body,r=typeof n==`string`?Yo(n).replace(/^[#>*\-\s]+/,``):``;return r===``?null:L(r,Wo)}function as(e){let t=e.steps.at(-1);return t===void 0?null:t.kind===`tool`?`${I(t.name)} · ${t.summary}`:t.kind===`steer`?`took ${os(t.posts.length)}${t.from.length===0?``:` from ${t.from.join(`, `)}`}`:L(Yo(t.kind===`say`?t.text:t.message),Wo)}function os(e){return e===1?`1 post`:`${e} posts`}function ss(e,t){return Ke(t-Date.parse(e))}var cs=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 zo({token:e,url:()=>`/api/turns/stream?since=0`,onOpen:()=>{this.turns=new Map,this.emit()},onData:e=>{let t=_e.safeParse(JSON.parse(e));if(t.success){this.turns=ns(this.turns,t.data);for(let e of this.eventListeners)e(t.data)}},onBatch:()=>this.emit()})}emit(){for(let e of this.listeners)e()}},ls=(0,A.createContext)(null);function us(){let e=(0,A.useContext)(ls);if(e===null)throw Error(`useLiveTurns needs a LiveContext`);return(0,A.useSyncExternalStore)(e.subscribe,e.snapshot)}function ds({activeCitizen:e,activeScope:t}){let n=u(),r=De(),i=us(),a=No(),o=ot(5e3),s=g(n.data?.running??[]),c=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`}),c>0?(0,M.jsxs)(`span`,{className:`font-normal tracking-normal normal-case`,children:[c,` queued`]}):null]}),s.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:s.map(({agent:n,scope:s,thread:c})=>{let l=i.get(Bo(n,s,c)),u=l!==void 0&&l.end===null,d=r.data?.find(e=>e.name===n)?.cli??null,f=u?as(l):null,p=Vo({scope:s,thread:c}),m=n===e&&(t===null||t===p||t===s),h=s===`society`?`society`:s,g=c===void 0?null:a.get(c)?.title??`a thread`;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{to:`/citizen/$name`,params:{name:n},search:{scope:p},className:`block rounded-lg px-2 py-1.5 transition-colors ${m?`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:[d===null?null:(0,M.jsx)(yo,{cli:d,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:g===null?h:`${h} · ${g}`}),u?(0,M.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,children:[l.fromStart?``:`≥ `,ss(l.startedAt,o)]}):null]}),(0,M.jsx)(`span`,{className:`mt-0.5 block truncate pl-5.5 text-[11px] text-fg-muted`,children:f===null?`Starting…`:(0,M.jsx)(Io,{text:f,links:!1})})]})},Bo(n,s,c))})})]})}var fs=`flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors`;function ps(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 ms=`bg-surface-2/80 text-fg-primary`,hs=`text-fg-secondary hover:bg-surface-2/50 hover:text-fg-primary`;function gs({slug:e,active:t}){let n=(te(e).data??[]).filter(lt).length;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{to:`/p/$slug/tasks`,params:{slug:e},className:`${fs} ${t?ms:hs}`,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 _s({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 vs({active:e}){let t=(oe().data??[]).filter(io).length,n=vo().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)(N,{to:`/needs-you`,className:`${fs} ${e===`needs-you`?ms:hs}`,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)(_s,{value:n,title:`${n} waiting on you`})]})}),(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{to:`/proposals`,className:`${fs} ${e===`proposals`?ms:hs}`,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)(_s,{value:t,title:`${t} waiting on you`})]})})]})]})}function ys({activeChannel:e,activeTasks:t,activeCitizen:n,activeScope:r,activeGovernance:i,activeOverview:a}){let o=xe(),s=O(),c=f(),l=Qa();(0,A.useEffect)(()=>{o.data!==void 0&&$a(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),p=(0,A.useMemo)(()=>{let e=o.data??[];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]),m=(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)(Wa,{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)(N,{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)(ds,{activeCitizen:n,activeScope:r}),(0,M.jsx)(vs,{active:i}),p.map(n=>(0,M.jsxs)(`section`,{className:`mt-3`,children:[(0,M.jsx)(`h3`,{className:`pb-1`,children:n.project===null?(0,M.jsx)(N,{to:`/society`,className:ps(a===n.key),children:n.label}):(0,M.jsx)(N,{to:`/p/$slug`,params:{slug:n.project},className:ps(a===n.key),children:n.label})}),(0,M.jsxs)(`ul`,{children:[n.channels.map(t=>{let n=t.ref===e,r=m.get(t.ref)??0,i=!n&&to(l,t.ref,t.lastMessageId);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{to:`/c/$`,params:{_splat:t.ref},className:`${fs} ${n?ms:hs}`,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)(gs,{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)(N,{to:`/p/$slug`,params:{slug:e.slug},className:`${fs} ${a===e.slug?ms:hs}`,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 bs=(0,A.createContext)(void 0);function xs(e,t){let n=new URL(e);return n.searchParams.set(n.hostname===`github.com`?`size`:`s`,String(t)),n.href}function Ss({name:e,members:t}){let n=(0,A.useContext)(bs),r=t?.find(t=>t.name===e)?.cli??null;return r===null?e===`user`&&n!==void 0?(0,M.jsx)(`img`,{src:xs(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)(yo,{cli:r,size:16})})}function Cs({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)(yo,{cli:n,size:12}),(0,M.jsx)(`span`,{className:`text-fg-secondary`,children:e})]})}function ws(e,t){return e===`user`?t?.login??`you`:e}function Ts(){let e=(0,A.useContext)(bs);return t=>ws(t,e)}var Es={primary:`bg-fg-primary font-medium text-surface-0 hover:bg-white`,ghost:`text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`};function Ds({variant:e=`ghost`,className:t=``,...n}){return(0,M.jsx)(`button`,{type:`button`,...n,className:`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40 ${Es[e]} ${t}`})}var Os=/(^|[^\w@])@([a-z0-9][a-z0-9-]{0,31})(?![\w-])/g,ks=new Set([`code`,`inlineCode`,`link`,`linkReference`,`html`]);function As(e){let t=[],n=0;for(let r of e.matchAll(Os)){let i=(r.index??0)+(r[1]?.length??0);i>n&&t.push({type:`text`,value:e.slice(n,i)});let a=r[2]??``;t.push({type:`mention`,data:{hName:`span`,hProperties:{className:[`mention`]},hChildren:[{type:`text`,value:`@${a}`}]}}),n=i+a.length+1}return n<e.length&&t.push({type:`text`,value:e.slice(n)}),t}function js(e){e.children!==void 0&&(e.children=e.children.flatMap(e=>e.type===`text`&&e.value!==void 0?As(e.value):(ks.has(e.type)||js(e),[e])))}function Ms(e){return[...new Set([...e.matchAll(Os)].map(e=>e[2]??``))].filter(e=>e!==``)}function Ns(){return e=>js(e)}function Ps(e,t){let n=/(^|[^\w@])@([a-z0-9-]*)$/.exec(e.slice(0,t))?.[2];return n===void 0?null:{start:t-n.length-1,prefix:n}}function Fs(e,t,n,r){let i=`@${r} `;return{text:e.slice(0,n)+i+e.slice(t),caret:n+i.length}}function Is(e,t,n){let r=t.filter(e=>e.status===`active`&&e.cli!==null),i=r.filter(e=>n.find(t=>t.name===e.role)?.wakeTriggers.includes(`user_post`)).map(e=>e.name),a=Ms(e).filter(e=>r.some(t=>t.name===e));return[...new Set([...i,...a])]}function Ls(e,t,n,r){return e.filter(e=>n.some(n=>{if(n.agent!==e||!n.steerable)return!1;if(`thread`in r)return n.thread===r.thread;let i=t.find(t=>t.name===e);return i!==void 0&&n.thread===void 0&&n.scope===Ee(i,ye(r.channel).project)}))}function Rs(e,t){let n=e.length===0?null:`reaches ${Bs(e)} in the turn under way`,r=t.length===0?null:`wakes ${Bs(t)}: a turn each`;return n===null&&r===null?null:`Sending ${[n,r].filter(e=>e!==null).join(` and `)}.`}var zs=new Intl.ListFormat(`en`,{type:`conjunction`});function Bs(e){return zs.format(e)}var Vs=6;function Hs({target:t,placeholder:n,initialText:r=``,oneLine:i=!1,className:a=`border-t border-line p-3`,focusOnOpen:o=!1,onPosted:s,onEmptyEscape:l}){let{api:d}=c(),f=Se(),p=De(),m=rt(),h=u(),[g,_]=(0,A.useState)(r),[v,y]=(0,A.useState)(0),[b,x]=(0,A.useState)(0),[S,C]=(0,A.useState)(!1),w=(0,A.useRef)(null),ee=(0,A.useRef)(null),T=xt({mutationFn:async n=>{if(`channel`in t)return d.sendMessage({channel:t.channel,body:n});if(`threadId`in t)return d.sendMessage({thread_id:t.threadId,body:n});let r=await d.openThread({channel:e,title:Ba(n)});return d.sendMessage({thread_id:r.id,body:n})},onSuccess:e=>{_(r),f.invalidateQueries({queryKey:e.thread===void 0?[`channel`,e.channel]:[`thread`,e.thread]}),`ask`in t&&f.invalidateQueries({queryKey:[`threads`]}),f.invalidateQueries({queryKey:[`requests`]}),s?.(e)}});(0,A.useEffect)(()=>{o&&w.current?.focus()},[o]),(0,A.useLayoutEffect)(()=>{let e=w.current;e!==null&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,ee.current!==null&&(e.setSelectionRange(ee.current,ee.current),ee.current=null))});let te=S?null:Ps(g,v),ne=(p.data??[]).filter(e=>e.status===`active`&&e.cli!==null),re=te===null?[]:ne.filter(e=>e.name.startsWith(te.prefix)).slice(0,Vs),ae=Is(g,p.data??[],m.data??[]),oe=`ask`in t?[]:Ls(ae,p.data??[],h.data?.turns??[],`channel`in t?{channel:t.channel}:{thread:t.threadId}),se=Rs(oe,ae.filter(e=>!oe.includes(e))),ce=e=>{if(te===null)return;let t=Fs(g,v,te.start,e);ee.current=t.caret,_(t.text),y(t.caret)},le=()=>{g.trim()!==``&&g.trim()!==r.trim()&&!T.isPending&&T.mutate(g.trim())},ue=e=>{if(re.length>0){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:re.length-1;x((b+t)%re.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),ce(re[Math.min(b,re.length-1)]?.name??``);return}if(e.key===`Escape`){e.preventDefault(),C(!0);return}}if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){e.preventDefault(),le();return}e.key===`Escape`&&g===``&&l!==void 0&&(e.preventDefault(),l())},de=(0,M.jsx)(Ds,{variant:`primary`,type:`submit`,disabled:g.trim()===``||g.trim()===r.trim()||T.isPending,children:T.isPending?`Sending…`:`Send`});return(0,M.jsxs)(`form`,{className:a,onSubmit:e=>{e.preventDefault(),le()},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)] ${i?`flex items-end gap-2 pr-1.5`:``}`,children:[re.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:re.map((e,t)=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),ce(e.name)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${t===b?`bg-surface-2 text-fg-primary`:`text-fg-secondary`}`,children:[e.cli===null?null:(0,M.jsx)(yo,{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:w,rows:1,value:g,placeholder:n,"aria-label":n,onChange:e=>{_(e.target.value),y(e.target.selectionStart),x(0),C(!1)},onSelect:e=>y(e.currentTarget.selectionStart),onKeyDown:ue,className:`block max-h-48 w-full resize-none bg-transparent px-3 text-sm text-fg-primary outline-none placeholder:text-fg-muted ${i?`py-2.5`:`pt-2.5 pb-1`}`}),i?(0,M.jsx)(`div`,{className:`shrink-0 pb-1.5`,children:de}):(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:se??`Enter to send · Shift+Enter for a new line`}),de]})]}),T.error===null?null:(0,M.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-red-400`,children:T.error instanceof ie?T.error.message:`The message was not sent.`})]})}var Us=5;function Ws(e,t,n){switch(e.kind){case`answering`:return{text:`${Bs(e.who)} ${e.who.length===1?`is`:`are`} answering…`,tone:`text-emerald-300`};case`queued`:return{text:`${Bs(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=Le(t.body,160);return{text:`closed by ${n(e.by??`board`)}${r===``?``:` · ${r}`}`,tone:`text-fg-muted`}}function Gs({left:e,width:t,onClose:n}){let r=f(),i=u(),a=Qa(),o=ot(3e4),s=Ts(),c=(0,A.useRef)(null),l=za(r.data??[]).slice(0,Us),d=g(i.data?.running??[]),p=g(i.data?.pending??[]);return(0,A.useEffect)(()=>{let e=e=>{e.target instanceof Node&&c.current?.contains(e.target)===!1&&n()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[n]),(0,M.jsxs)(`section`,{ref:c,"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:Ua,children:(0,M.jsx)(Hs,{target:{ask:!0},placeholder:`Ask the front desk`,oneLine:!0,className:`p-2`,focusOnOpen:!0,onEmptyEscape:n})}),l.length===0?null:(0,M.jsx)(`ol`,{"aria-label":`Your asks`,className:`${Ua} max-h-[40vh] overflow-y-auto py-1`,children:l.map(e=>{let t=Ws(Va(e,d,p),e,s),n=Ha(e,a);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{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:Qe(e.openedAt,o)})]}),(0,M.jsx)(`span`,{className:`mt-0.5 block truncate text-xs ${t.tone}`,children:t.text})]})},e.id)})})]})}function Ks({unread:e,onOpen:t}){let n=Ts(),[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 qs={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 Js(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 ${Qe(e.lastTurnAt,r)}`}function Ys({member:e,star:t,place:n,now:r}){let i=e.lastModel??e.model,a=qs[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)(yo,{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:Js(e,t,n,r)})]})}function Xs({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 Zs=new Set(b),Qs={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`};function $s(e){return Zs.has(e)}function ec(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 tc(e){return[e.project??``,e.agent??``,e.role===void 0?``:`role ${e.role}`,$s(e.kind)?`wakes the steward`:``].filter(e=>e.length>0)}function nc({onClose:e}){let t=ee(!0),n=u(),r=ot(3e4),i=t.data??[],a=ec(i,n.data?.signals??[]);return(0,M.jsxs)(Wa,{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=$s(n.kind),o=tc(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:Qs[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:Qe(t,r)})]}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:(0,M.jsx)(Io,{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)(N,{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 rc=32;function ic(e,t){return t.width+t.x-e.clientX}function ac({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(ic(e,a.current),!1)},c=e=>{a.current!==null&&(r(ic(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+rc:i.key===`ArrowRight`?e-rc: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 oc({mark:e,project:t,members:n}){let r=n?.find(t=>t.name===e.holder)?.cli??null,i=pt.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 ${ut[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)(yo,{cli:r,size:12}),e.holder,e.linked===null?` · resting`:` · in a turn on it`]})]})]})]})}function sc(e,t){let n=`latest`;return zo({token:e,url:()=>`/api/events/stream?since=${n}`,onData:e=>{let r=me.parse(JSON.parse(e));n=r.id,t.onEvent(r)},onOpen:e=>{e&&t.onResume()}})}function cc(e){return typeof e==`string`?e:void 0}function lc(e){let{type:t,payload:n,actor:r}=e;if(t===`message.posted`){let e=cc(n.thread);return e===void 0?[[`channels`],[`channel`,cc(n.channel)],[`requests`]]:[[`threads`],[`thread`,e],[`requests`]]}return t.startsWith(`thread.`)?[[`threads`],[`thread`,cc(n.threadId)],[`channel`],[`requests`]]:t.startsWith(`task.`)||t.startsWith(`merge.`)||t===`lease.expired`?[[`tasks`],[`task`,cc(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`,cc(n.project)??`society`]]:t.startsWith(`agent.`)||t===`subscription.changed`?[[`members`]]:t.startsWith(`project.`)||t===`channel.added`?[[`projects`],[`channels`],[`society`]]:t===`role.added`?[[`roles`]]:t.startsWith(`runner.`)?[[`runners`],[`models`]]:t.startsWith(`proposal.`)?[[`proposals`],[`proposal`,cc(n.proposalId)],[`metrics`]]:t===`skill.promoted`?[[`skills`]]:t===`ops.signal`?[[`signals`],[`scheduler`],[`metrics`]]:[]}function uc(e,t){for(let n of lc(t)){let t=n.filter(e=>e!==void 0);e.invalidateQueries({queryKey:t})}}var dc=`stellaris.contentWidth`;function fc(e){return Math.round(Math.min(680,Math.max(420,e*.4)))}function pc(e){return Math.max(420,e-256-48)}function mc(e,t){let n=pc(e);return t===`widest`?n:Math.round(Math.min(n,Math.max(420,t??fc(e))))}function hc(e,t){return mc(e,t)>=pc(e)?null:`widest`}function gc(){let e=localStorage.getItem(dc);if(e===`widest`)return`widest`;let t=Number(e);return e!==null&&Number.isFinite(t)&&t>0?t:null}function _c(e){e===null?localStorage.removeItem(dc):localStorage.setItem(dc,String(e))}var vc=`stellaris.trail`;function yc(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 bc(e,t){let n=e[t-1];return n===void 0||new URL(n,`http://board`).pathname===`/`?null:n}function xc(){try{let e=JSON.parse(sessionStorage.getItem(vc)??`{}`);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 Sc(e){sessionStorage.setItem(vc,JSON.stringify(e))}function Cc(e,t){return decodeURIComponent(e.split(`/`)[t]??``)}function wc(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`?Cc(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 Tc=typeof sessionStorage>`u`?{}:xc(),Ec=new Set;function Dc(e,t){if(Tc[e]!==t||Tc[e+1]!==void 0){Tc=yc(Tc,e,t),Sc(Tc);for(let e of Ec)e()}}function Oc(){return(0,A.useSyncExternalStore)(e=>(Ec.add(e),()=>Ec.delete(e)),()=>Tc)}function kc(e,t){let n=pt.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 Ac=Math.PI*(3-Math.sqrt(5)),jc=68,Mc=44,Nc=58,Pc=26,Fc=13,Ic=.3,Lc=1.5*Math.PI,z=28,Rc=280,zc=8,Bc=40;function Vc(e){return Math.max(Nc,jc*Math.sqrt(Math.max(0,e-1))+Mc)}function Hc(e){return e+Pc}function Uc(e){let t=new Map;for(let n of e.toSorted()){let e=We(n);if(e!==null){let n=t.get(e.agent)??[];n.includes(e.scope)||t.set(e.agent,[...n,e.scope])}}return t}function Wc(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:Ve,i=Uc(e.scheduler.running),a=Uc(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:Ve,queuedFor:n===void 0?null:r(n)}]}),l=new Map([[Ve,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:Ve,label:`society`,kind:`society`,x:0,y:0,radius:Vc(u.get(`society`)??0)},f=[d,...qc(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=jc*Math.sqrt(s),u=s*Ac-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=Gc(e.tasks??[],f,m),g=Math.max(...f.map(e=>Math.hypot(e.x,e.y)+Hc(e.radius)));return{anchors:f,stars:m,tasks:h,radius:Math.round(g+Bc)}}function Gc(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=ft(e);return t===`done`||t===`abandoned`?[]:[{task:e,phase:t}]}).toSorted((e,t)=>e.task.id.localeCompare(t.task.id)),a=Math.min(Ic,Lc/Math.max(1,t.length)),o=i.radius+Fc;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=Ce(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?dt(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 Kc(e,t,n){let r=e.stars.filter(e=>e.name===t);return(r.find(e=>e.anchor===n)??r[0])?.id??null}function qc(e,t,n){let r=[],i=Hc(n.radius),a=zc;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=>Vc(t.get(e.slug)??0)),l=c.map(Hc),u=l.map(e=>2*e+z),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?Rc:0,i+Math.max(...l)+z);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)+z)/(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]??Nc)})}),i=h+Math.max(...l)}return r}var Jc=.15,Yc=.45,Xc=1.35,Zc=64,Qc=1.15;function $c(e,t,n){return Math.min(n,Math.max(t,e))}function el(e){return Math.max(240,e.width-e.left-e.right)}function tl(e){return{x:e.left+el(e)/2,y:e.height/2}}function nl(e,t){return{x:0,y:0,scale:$c(Math.min(el(e),e.height)/(2*t),Yc,Xc)}}function rl(e,t,n,r){let i=$c(e.scale*n,Jc,3),a=tl(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 il(e,t,n){return{...e,x:e.x-t/e.scale,y:e.y-n/e.scale}}function al(e,t,n){let r=tl(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>=Zc&&a+o<=t.height)return null;let s=Math.min(el(t),t.height-Zc)/(2*n.reach*Qc);return{x:n.x,y:n.y,scale:Math.min(e.scale,$c(s,Jc,3))}}var ol=`#0a0a0a`,sl=`#171717`,cl=`212, 212, 212`,ll=`163, 163, 163`,ul=`115, 115, 115`,dl=`"Instrument Sans Variable", ui-sans-serif, sans-serif`,fl=`500 12px "Onest Variable", ui-sans-serif, sans-serif`,pl=`600 10px "Onest Variable", ui-sans-serif, sans-serif`,ml={waiting:`#fcd34d`,working:`#6ee7b7`,returned:`#fdba74`,landing:`#7dd3fc`},hl=`500 11px ${dl}`,gl=5,_l=240,vl=34,yl=.06,bl=15,xl=5,B=4.2,Sl=280;function Cl(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 wl(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 Tl(e,t){return(e%t+t)%t}function El(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function Dl(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(n!==null){let t=El(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 Ol=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(Ma.claude.path),codex:new Path2D(Ma.codex.path)};let r=Cl(7);this.specks=Array.from({length:Sl},()=>({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:wl(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=rl(this.target,n,e,t??tl(n)),this.mode=`manual`}panBy(e,t){this.target=il(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=al(this.target,e,{x:t.anchor.x,y:t.anchor.y,reach:t.anchor.radius+vl});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(bl*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=nl(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=tl(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+=(xl*(n.star.x-n.x)-B*n.vx)*e,n.vy+=(xl*(n.star.y-n.y)-B*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>gl||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=Dl(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=ol,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=El(ml[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=ml[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=hl,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,(gl-i)/1.2)*r.presence;if(a<=0)continue;let o=n.text;if(e.measureText(o).width>_l){for(;o.length>1&&e.measureText(`${o}…`).width>_l;)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,bl*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(${cl}, 1)`,e.fillText(o,u+8,d+11+.5)}e.restore()}drawSpecks(e){let{ctx:t}=this,n=-this.camX*this.scale*yl,r=-this.camY*this.scale*yl;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(Tl(i.x*this.width+n,this.width),Tl(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=pl,e.letterSpacing=`2px`,e.fillStyle=`rgba(${ul}, 0.9)`,e.fillText(t.label.toUpperCase(),a.x,a.y+o+10),e.letterSpacing=`0px`):(e.font=fl,e.fillStyle=s?`rgba(245, 245, 245, 1)`:`rgba(${ll}, 0.95)`,e.fillText(t.label,a.x,a.y+o+10))}}drawBody(e,t){let{ctx:n}=this,{star:r}=e,i=Ma[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,bl*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=El(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(${cl}, 0.55)`,n.lineWidth=1,n.stroke(),n.setLineDash([])),n.beginPath(),n.arc(u.x,u.y,m,0,Math.PI*2),n.fillStyle=sl,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 ${dl}`,n.textAlign=`center`,n.textBaseline=`top`,n.fillStyle=`rgba(${cl}, ${a||o?1:.7})`,n.fillText(r.name,u.x,u.y+m+8*this.scale+3),n.restore()}},kl=15e3,Al=26,jl=12,Ml=4,Nl=.0015,Pl=.01,Fl=1.3,Il=`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 Ll(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+jl,s=n.width-r.right-jl,c=t.x+Al+i<=s?t.x+Al:t.x-Al-i,l=Math.min(Math.max(jl,t.y-a/3),n.height-a-jl);e.style.transform=`translate(${Math.round(Math.max(o,c))}px, ${Math.round(l)}px)`,e.style.visibility=`visible`}function Rl({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=No(),_=(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 Ol(e,{reducedMotion:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,onHoverPosition:e=>Ll(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?Pl:Nl)),{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)>kl)return;let n=Kc(h.current,e.agent,e.project);if(n===null)return;t.flash(n);let r=is(e.event.name,e.event.input);r!==null&&t.say(n,wo(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)>Ml&&(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:Il,onClick:()=>p.current?.zoomBy(Fl),children:`+`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,className:Il,onClick:()=>p.current?.zoomBy(1/Fl),children:`−`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Fit the whole sky`,title:`Fit the whole sky`,className:Il,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 zl={left:0,right:0};function Bl(){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 Vl(e,t){return e.startsWith(t)?decodeURIComponent(e.slice(t.length)):null}function Hl(){let{api:e,token:t,signOut:r,expire:i}=c(),a=Se();(0,A.useEffect)(()=>sc(t,{onEvent:e=>uc(a,e),onResume:()=>void a.invalidateQueries()}),[t,a]);let[o]=(0,A.useState)(()=>new cs);(0,A.useEffect)(()=>o.follow(t),[o,t]);let s=n(),l=ke(),d=De(),p=O(),m=u(),h=f(),g=Ye(),_=oe(),v=(0,A.useMemo)(()=>So(h.data??[],g,_.data??[]),[h.data,g,_.data]),y=Hi(),b=xt({mutationFn:t=>e.setPaused(t),onSuccess:()=>void a.invalidateQueries({queryKey:[`scheduler`]})}),x=ka({select:e=>e.location.pathname}),S=ka({select:e=>e.location.href}),C=ka({select:e=>e.location.state.__TSR_index});(0,A.useEffect)(()=>Dc(C,S),[C,S]);let[w,ee]=(0,A.useState)(!1),[T,te]=(0,A.useState)(null),ne=T===x,re=(0,A.useCallback)(()=>te(null),[]),ae=(0,A.useRef)(!0),se=Qa(),ce=Vi({strict:!1}),[le,ue]=(0,A.useState)(null),de=ot(3e4),E=Bl(),fe=x!==`/`,[pe,me]=(0,A.useState)(gc),he=mc(E,pe),ge=(e,t)=>{let n=mc(E,e),r=n>=pc(E)?`widest`:n;me(r),t&&_c(r)},_e=()=>{let e=hc(E,pe);me(e),_c(e)},ve=(0,A.useMemo)(()=>fe?{left:288,right:he+32}:zl,[fe,he]),ye=Vl(x,`/thread/`),be=Me(Vl(x,`/task/`)),D=Vl(x,`/c/`)??(ye===null?null:h.data?.find(e=>e.id===ye)?.channel??null),xe=/^\/p\/([^/]+)\/tasks$/.exec(x)?.[1]??be.data?.project??null,Ce=Vl(x,`/citizen/`),we=Ce===null?null:ce.scope??null,Te=we?.split(`/`)[0]??null,k=x===`/needs-you`?`needs-you`:x===`/proposals`||x.startsWith(`/proposal/`)?`proposals`:null,Ee=vo().length,Oe=tt().data?.length??0,Ae=x===`/society`?Ve:/^\/p\/([^/]+)$/.exec(x)?.[1]??/^\/knowledge\/([^/]+)\//.exec(x)?.[1]??null;(0,A.useEffect)(()=>{let e=()=>{ae.current=!0},t=e=>{e.key===`Tab`&&(ae.current=!1);let t=e.target instanceof HTMLElement?e.target:null;if(!(t?.closest(`input, textarea, select, [contenteditable]`)!=null||e.metaKey||e.ctrlKey||e.altKey)){if(e.key===` `){if(t?.closest(`button, a, summary, [role='button']`)!=null&&!ae.current)return;e.preventDefault(),te(x);return}e.key===`Escape`&&(ne?te(null):w?ee(!1):fe&&y({to:`/`}))}};return window.addEventListener(`keydown`,t),window.addEventListener(`pointerdown`,e),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`pointerdown`,e)}},[fe,w,ne,x,y]);let je=[s,d,p,m].some(e=>e.error instanceof ie&&e.error.status===401);(0,A.useEffect)(()=>{je&&i()},[je,i]);let Ne=(0,A.useMemo)(()=>d.data===void 0||p.data===void 0||m.data===void 0?null:Wc({members:d.data,projects:p.data,scheduler:m.data,tasks:g}),[d.data,p.data,m.data,g]);if(Ne===null){let e=[d,p,m].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=(k!==null||x===`/metrics`||x===`/runners`?`society`:null)??Ae??xe??(D===null?Ce===null?null:Te??Ne.stars.find(e=>e.name===Ce)?.anchor??null:D.includes(`/`)?D.split(`/`)[0]??null:`society`),Fe=E-ve.left-ve.right,Ie=Fe>=460,Le=Math.min(560,(Ie?Fe:E)-32),Re={left:(Ie?ve.left:0)+((Ie?Fe:E)-Le)/2,width:Le},ze=za(h.data??[]).filter(e=>Ha(e,se)),Be=e=>e===`society`?`the society`:p.data?.find(t=>t.slug===e)?.name??e,He=Ne.stars.find(e=>e.id===le),Ue=Ne.tasks.find(e=>`task:${e.id}`===le),We=d.data?.find(e=>e.name===He?.name),Ge=He===void 0?`the society`:Be(He.queuedFor??He.anchor),Ke=e=>{let t=Ne.stars.find(t=>t.id===e);t!==void 0&&y({to:`/citizen/$name`,params:{name:t.name},search:t.state===`working`?{scope:t.anchor}:{}})},qe=e=>{y({to:`/task/$taskId`,params:{taskId:e}})};return(0,M.jsx)(ls,{value:o,children:(0,M.jsx)(Mo,{value:v,children:(0,M.jsx)(bs,{value:l.data?.signIn,children:(0,M.jsxs)(`main`,{className:`relative h-full overflow-hidden`,children:[(0,M.jsx)(Rl,{model:Ne,paused:m.data?.paused??!1,hovered:le,onHover:ue,insets:ve,focus:Pe,onSelectAnchor:e=>{y(e===`society`?{to:`/society`}:{to:`/p/$slug`,params:{slug:e}})},onSelectStar:Ke,onSelectTask:qe,live:o,card:Ue===void 0?He===void 0||We===void 0?null:(0,M.jsx)(Ys,{member:We,star:He,place:Ge,now:de}):(0,M.jsx)(oc,{mark:Ue,project:Be(Ue.project),members:d.data})}),(0,M.jsx)(Xs,{society:s.data?.name,citizens:new Set(Ne.stars.map(e=>e.name)).size,citizensOpen:x===`/citizens`,onToggleCitizens:()=>void y(x===`/citizens`?{to:`/`}:{to:`/citizens`}),runnersOpen:x===`/runners`,onToggleRunners:()=>void y(x===`/runners`?{to:`/`}:{to:`/runners`}),enrolling:Oe,attention:Ee,onOpenAttention:()=>void y({to:`/needs-you`}),paused:m.data?.paused??!1,onTogglePause:()=>b.mutate(!(m.data?.paused??!1)),pauseBusy:b.isPending,boardOpen:fe,onToggleBoard:()=>void y(fe?{to:`/`}:{to:`/c/$`,params:{_splat:`general`}}),logsOpen:w,metricsOpen:x===`/metrics`,onToggleMetrics:()=>void y(x===`/metrics`?{to:`/`}:{to:`/metrics`}),onToggleLogs:()=>ee(!w),onSignOut:r}),fe?(0,M.jsx)(ys,{activeChannel:D,activeTasks:xe,activeCitizen:Ce,activeScope:we,activeGovernance:k,activeOverview:Ae}):null,fe?(0,M.jsxs)(Wa,{label:`Board content`,className:`top-[72px] right-4 bottom-4`,style:{width:he},children:[(0,M.jsx)(ac,{width:he,min:420,max:pc(E),onResize:ge,onToggle:_e}),(0,M.jsx)(ya,{})]}):null,w?(0,M.jsx)(nc,{onClose:()=>ee(!1)}):null,ne?(0,M.jsx)(Gs,{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)(Ks,{unread:ze,onOpen:()=>te(x)})}),Ne.stars.length===0&&!fe?(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:()=>ue(`task:${e.id}`),onBlur:()=>ue(null),onClick:()=>qe(e.id),children:kc(e,Be(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:()=>ue(e.id),onBlur:()=>ue(null),onClick:()=>Ke(e.id),children:[e.name,`, `,e.state,e.state===`working`?` at ${Be(e.anchor)}`:``]})},e.id))})]})})})})}var Ul=`modulepreload`,Wl=function(e){return`/`+e},Gl={},V=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=Wl(t,n),t=s(t),t in Gl)return;Gl[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`:Ul,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 Kl(){return null}var H=la({component:Hl}),ql=Ta({routeTree:H.addChildren([sa({getParentRoute:()=>H,path:`/`,component:Kl}),sa({getParentRoute:()=>H,path:`/c/$`,component:P(()=>V(()=>import(`./ChannelView-A47Rvstg.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`ChannelView`)}),sa({getParentRoute:()=>H,path:`/thread/$threadId`,component:P(()=>V(()=>import(`./ThreadView-BioBQeqV.js`),__vite__mapDeps([9,1,4,2,3,5,6,7,8,10])),`ThreadView`)}),sa({getParentRoute:()=>H,path:`/society`,component:P(()=>V(()=>import(`./SocietyView--buUCciX.js`),__vite__mapDeps([11,1,5,12,13])),`SocietyView`)}),sa({getParentRoute:()=>H,path:`/p/$slug`,component:P(()=>V(()=>import(`./ProjectView-DFReelVz.js`),__vite__mapDeps([14,1,3,4,5,7,12,13])),`ProjectView`)}),sa({getParentRoute:()=>H,path:`/knowledge/$scope/$topic`,component:P(()=>V(()=>import(`./KnowledgeView-CXRQ4igk.js`),__vite__mapDeps([15,1,4,5,7,10])),`KnowledgeView`)}),sa({getParentRoute:()=>H,path:`/p/$slug/tasks`,component:P(()=>V(()=>import(`./TasksView-BXqfwU5R.js`),__vite__mapDeps([16,1,3,5])),`TasksView`)}),sa({getParentRoute:()=>H,path:`/task/$taskId`,component:P(()=>V(()=>import(`./TaskView-C-VIKoFp.js`),__vite__mapDeps([17,1,3,4,5,10,18,2])),`TaskView`)}),sa({getParentRoute:()=>H,path:`/task/$taskId/files/$`,validateSearch:e=>{let t=Number(e.line);return Number.isInteger(t)&&t>0?{line:t}:{}},component:P(()=>V(()=>import(`./TaskFileView-dvFssKHp.js`),__vite__mapDeps([19,1,4,5,10])),`TaskFileView`)}),sa({getParentRoute:()=>H,path:`/metrics`,validateSearch:e=>{let t=m.safeParse(e.window);return t.success?{window:t.data}:{}},component:P(()=>V(()=>import(`./MetricsView-7X3Cmybh.js`),__vite__mapDeps([20,1,5,12,13])),`MetricsView`)}),sa({getParentRoute:()=>H,path:`/citizens`,component:P(()=>V(()=>import(`./CitizensView-DdIHzcx3.js`),__vite__mapDeps([21,1,5,13])),`CitizensView`)}),sa({getParentRoute:()=>H,path:`/needs-you`,component:P(()=>V(()=>import(`./NeedsYouView-Pi1jBF8V.js`),__vite__mapDeps([22,1,5])),`NeedsYouView`)}),sa({getParentRoute:()=>H,path:`/runners`,validateSearch:e=>typeof e.code==`string`?{code:e.code}:{},component:P(()=>V(()=>import(`./RunnersView-D4pd3ArT.js`),__vite__mapDeps([23,1,5,7])),`RunnersView`)}),sa({getParentRoute:()=>H,path:`/proposals`,component:P(()=>V(()=>import(`./ProposalsView-Uc6fp4bD.js`),__vite__mapDeps([24,1,5])),`ProposalsView`)}),sa({getParentRoute:()=>H,path:`/proposal/$proposalId`,component:P(()=>V(()=>import(`./ProposalView-3L5osVUL.js`),__vite__mapDeps([25,1,3,4,5,7,10,24,18,2])),`ProposalView`)}),sa({getParentRoute:()=>H,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:P(()=>V(()=>import(`./CitizenView-B_jG9N5w.js`),__vite__mapDeps([26,1,4,5,7,8,13])),`CitizenView`)})])});function Jl({signInError:e}){let t=Se(),[n,r]=(0,A.useState)(fe),a=(0,A.useCallback)(()=>{i(),t.clear(),r(null)},[t]),o=(0,A.useCallback)(()=>{n!==null&&de(n).signOut().catch(()=>void 0),a(),ql.navigate({to:`/`})},[n,a]),s=(0,A.useMemo)(()=>n===null?null:{api:de(n),token:n,signOut:o,expire:a},[n,o,a]);return s===null?(0,M.jsx)(La,{initialError:e,onEnter:e=>{le(e),r(e)}}):(0,M.jsx)(Ae,{value:s,children:(0,M.jsx)(Oa,{router:ql})})}var Yl={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 Xl(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:Yl[r]??`GitHub sign-in failed.`}}function Zl(){let e=Xl(window.location.hash);return e!==null&&(e.token!==null&&le(e.token),window.history.replaceState(window.history.state,``,`${window.location.pathname}${window.location.search}`)),e}var Ql=new bt({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),$l=Zl(),eu=document.getElementById(`root`);if(eu===null)throw Error(`missing #root element`);(0,Aa.createRoot)(eu).render((0,M.jsx)(A.StrictMode,{children:(0,M.jsx)(Xe,{client:Ql,children:(0,M.jsx)(Jl,{signInError:$l?.error??null})})}));export{oo as A,Vi as B,Do as C,no as D,vo as E,io as F,xt as H,eo as I,ka as L,lo as M,po as N,ho as O,mo as P,N as R,No as S,yo as T,Bi as V,rs as _,Bs as a,Fo as b,Ds as c,Ts as d,Vo as f,I as g,os as h,Hs as i,ro as j,co as k,Ss as l,Bo as m,bc as n,Is as o,ss as p,Oc as r,Ns as s,wc as t,Cs as u,Ho as v,jo as w,Io as x,us as y,Hi as z};
23
+ `).map(e=>e.trim()).find(e=>e.length>0)??``}function Xo(e){return/^\/bin\/(?:ba)?sh -lc (["'])([\s\S]*)\1$/.exec(e.trim())?.[2]??e}function Zo(e){return typeof e==`object`&&e&&!Array.isArray(e)?Object.fromEntries(Object.entries(e)):{}}var Qo=[`file_path`,`path`,`url`,`query`,`pattern`,`description`,`prompt`];function $o(e){let t=Zo(e),n=t.command;if(typeof n==`string`){let e=Xo(n);return{summary:L(Jo(e),Wo),detail:L(e,Go)}}let r=L(JSON.stringify(e??null,null,2),Go),i=t.changes;if(Array.isArray(i))return{summary:L(i.map(e=>Zo(e).path).filter(e=>typeof e==`string`).join(`, `),Wo),detail:r};let a=Qo.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:L(Jo(a??o.slice(0,3).join(` · `)),Wo),detail:r}}var es=`StructuredOutput`;function ts(e,t){try{return Zo(JSON.parse(e)).summary===t}catch{return!1}}function R(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 ns(e,t,{maxSteps:n}={maxSteps:Uo}){let{event:r}=t,i=Bo(t.agent,t.project,t.thread),a=e.get(i),o=new Map(e),s={agent:t.agent,scope:t.project,...t.thread===void 0?{}:{thread:t.thread}};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,R(c,{kind:`say`,seq:t.seq,at:t.ts,text:r.delta},n));break;case`tool_call`:if(r.name===es)break;o.set(i,R(c,{kind:`tool`,seq:t.seq,at:t.ts,name:r.name,...$o(r.input),ok:null,output:null},n));break;case`tool_result`:{let e=c.steps.findIndex(e=>e.kind===`tool`&&e.name===r.name&&e.ok===null),n=c.steps[e];if(n?.kind===`tool`){let a=c.steps.with(e,{...n,ok:r.ok,output:r.output??null});o.set(i,{...c,steps:a,lastAt:t.ts})}break}case`error`:o.set(i,R(c,{kind:`error`,seq:t.seq,at:t.ts,message:r.message},n));break;case`steered`:o.set(i,R(c,{kind:`steer`,seq:t.seq,at:t.ts,...qo(r.text??``)},n));break;case`turn_completed`:{let e=r.status?.summary??null,n=c.steps.at(-1),a=n?.kind===`say`&&e!==null&&ts(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 rs(e,t,n,r){let i=new Map;for(let[a,o]of e.entries())i=ns(i,{seq:a+1,ts:o.ts,agent:t,project:n,...r===void 0?{}:{thread:r},event:o.event},{maxSteps:1/0});return i.get(Bo(t,n,r))}function is(e,t){if(I(e)!==`post_message`)return null;let n=Zo(t).body,r=typeof n==`string`?Yo(n).replace(/^[#>*\-\s]+/,``):``;return r===``?null:L(r,Wo)}function as(e){let t=e.steps.at(-1);return t===void 0?null:t.kind===`tool`?`${I(t.name)} · ${t.summary}`:t.kind===`steer`?`took ${os(t.posts.length)}${t.from.length===0?``:` from ${t.from.join(`, `)}`}`:L(Yo(t.kind===`say`?t.text:t.message),Wo)}function os(e){return e===1?`1 post`:`${e} posts`}function ss(e,t){return Ke(t-Date.parse(e))}var cs=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 zo({token:e,url:()=>`/api/turns/stream?since=0`,onOpen:()=>{this.turns=new Map,this.emit()},onData:e=>{let t=_e.safeParse(JSON.parse(e));if(t.success){this.turns=ns(this.turns,t.data);for(let e of this.eventListeners)e(t.data)}},onBatch:()=>this.emit()})}emit(){for(let e of this.listeners)e()}},ls=(0,A.createContext)(null);function us(){let e=(0,A.useContext)(ls);if(e===null)throw Error(`useLiveTurns needs a LiveContext`);return(0,A.useSyncExternalStore)(e.subscribe,e.snapshot)}function ds({activeCitizen:e,activeScope:t}){let n=u(),r=De(),i=us(),a=No(),o=ot(5e3),s=g(n.data?.running??[]),c=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`}),c>0?(0,M.jsxs)(`span`,{className:`font-normal tracking-normal normal-case`,children:[c,` queued`]}):null]}),s.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:s.map(({agent:n,scope:s,thread:c})=>{let l=i.get(Bo(n,s,c)),u=l!==void 0&&l.end===null,d=r.data?.find(e=>e.name===n)?.cli??null,f=u?as(l):null,p=Vo({scope:s,thread:c}),m=n===e&&(t===null||t===p||t===s),h=s===`society`?`society`:s,g=c===void 0?null:a.get(c)?.title??`a thread`;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{to:`/citizen/$name`,params:{name:n},search:{scope:p},className:`block rounded-lg px-2 py-1.5 transition-colors ${m?`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:[d===null?null:(0,M.jsx)(yo,{cli:d,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:g===null?h:`${h} · ${g}`}),u?(0,M.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-fg-tertiary`,children:[l.fromStart?``:`≥ `,ss(l.startedAt,o)]}):null]}),(0,M.jsx)(`span`,{className:`mt-0.5 block truncate pl-5.5 text-[11px] text-fg-muted`,children:f===null?`Starting…`:(0,M.jsx)(Io,{text:f,links:!1})})]})},Bo(n,s,c))})})]})}var fs=`flex items-center gap-1.5 rounded-lg px-2 py-1.5 text-sm transition-colors`;function ps(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 ms=`bg-surface-2/80 text-fg-primary`,hs=`text-fg-secondary hover:bg-surface-2/50 hover:text-fg-primary`;function gs({slug:e,active:t}){let n=(te(e).data??[]).filter(lt).length;return(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{to:`/p/$slug/tasks`,params:{slug:e},className:`${fs} ${t?ms:hs}`,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 _s({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 vs({active:e}){let t=(oe().data??[]).filter(io).length,n=vo().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)(N,{to:`/needs-you`,className:`${fs} ${e===`needs-you`?ms:hs}`,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)(_s,{value:n,title:`${n} waiting on you`})]})}),(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{to:`/proposals`,className:`${fs} ${e===`proposals`?ms:hs}`,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)(_s,{value:t,title:`${t} waiting on you`})]})})]})]})}function ys({activeChannel:e,activeTasks:t,activeCitizen:n,activeScope:r,activeGovernance:i,activeOverview:a}){let o=xe(),s=O(),c=f(),l=Qa();(0,A.useEffect)(()=>{o.data!==void 0&&$a(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),p=(0,A.useMemo)(()=>{let e=o.data??[];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]),m=(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)(Wa,{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)(N,{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)(ds,{activeCitizen:n,activeScope:r}),(0,M.jsx)(vs,{active:i}),p.map(n=>(0,M.jsxs)(`section`,{className:`mt-3`,children:[(0,M.jsx)(`h3`,{className:`pb-1`,children:n.project===null?(0,M.jsx)(N,{to:`/society`,className:ps(a===n.key),children:n.label}):(0,M.jsx)(N,{to:`/p/$slug`,params:{slug:n.project},className:ps(a===n.key),children:n.label})}),(0,M.jsxs)(`ul`,{children:[n.channels.map(t=>{let n=t.ref===e,r=m.get(t.ref)??0,i=!n&&to(l,t.ref,t.lastMessageId);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{to:`/c/$`,params:{_splat:t.ref},className:`${fs} ${n?ms:hs}`,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)(gs,{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)(N,{to:`/p/$slug`,params:{slug:e.slug},className:`${fs} ${a===e.slug?ms:hs}`,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 bs=(0,A.createContext)(void 0);function xs(e,t){let n=new URL(e);return n.searchParams.set(n.hostname===`github.com`?`size`:`s`,String(t)),n.href}function Ss({name:e,members:t}){let n=(0,A.useContext)(bs),r=t?.find(t=>t.name===e)?.cli??null;return r===null?e===`user`&&n!==void 0?(0,M.jsx)(`img`,{src:xs(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)(yo,{cli:r,size:16})})}function Cs({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)(yo,{cli:n,size:12}),(0,M.jsx)(`span`,{className:`text-fg-secondary`,children:e})]})}function ws(e,t){return e===`user`?t?.login??`you`:e}function Ts(){let e=(0,A.useContext)(bs);return t=>ws(t,e)}var Es={primary:`bg-fg-primary font-medium text-surface-0 hover:bg-white`,ghost:`text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`};function Ds({variant:e=`ghost`,className:t=``,...n}){return(0,M.jsx)(`button`,{type:`button`,...n,className:`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs transition-colors focus-visible:ring-2 focus-visible:ring-fg-primary/30 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-40 ${Es[e]} ${t}`})}var Os=/(^|[^\w@])@([a-z0-9][a-z0-9-]{0,31})(?![\w-])/g,ks=new Set([`code`,`inlineCode`,`link`,`linkReference`,`html`]);function As(e){let t=[],n=0;for(let r of e.matchAll(Os)){let i=(r.index??0)+(r[1]?.length??0);i>n&&t.push({type:`text`,value:e.slice(n,i)});let a=r[2]??``;t.push({type:`mention`,data:{hName:`span`,hProperties:{className:[`mention`]},hChildren:[{type:`text`,value:`@${a}`}]}}),n=i+a.length+1}return n<e.length&&t.push({type:`text`,value:e.slice(n)}),t}function js(e){e.children!==void 0&&(e.children=e.children.flatMap(e=>e.type===`text`&&e.value!==void 0?As(e.value):(ks.has(e.type)||js(e),[e])))}function Ms(e){return[...new Set([...e.matchAll(Os)].map(e=>e[2]??``))].filter(e=>e!==``)}function Ns(){return e=>js(e)}function Ps(e,t){let n=/(^|[^\w@])@([a-z0-9-]*)$/.exec(e.slice(0,t))?.[2];return n===void 0?null:{start:t-n.length-1,prefix:n}}function Fs(e,t,n,r){let i=`@${r} `;return{text:e.slice(0,n)+i+e.slice(t),caret:n+i.length}}function Is(e,t,n){let r=t.filter(e=>e.status===`active`&&e.cli!==null),i=r.filter(e=>n.find(t=>t.name===e.role)?.wakeTriggers.includes(`user_post`)).map(e=>e.name),a=Ms(e).filter(e=>r.some(t=>t.name===e));return[...new Set([...i,...a])]}function Ls(e,t,n,r){return e.filter(e=>n.some(n=>{if(n.agent!==e||!n.steerable)return!1;if(`thread`in r)return n.thread===r.thread;let i=t.find(t=>t.name===e);return i!==void 0&&n.thread===void 0&&n.scope===Ee(i,ye(r.channel).project)}))}function Rs(e,t){let n=e.length===0?null:`reaches ${Bs(e)} in the turn under way`,r=t.length===0?null:`wakes ${Bs(t)}: a turn each`;return n===null&&r===null?null:`Sending ${[n,r].filter(e=>e!==null).join(` and `)}.`}var zs=new Intl.ListFormat(`en`,{type:`conjunction`});function Bs(e){return zs.format(e)}var Vs=6;function Hs({target:t,placeholder:n,initialText:r=``,oneLine:i=!1,className:a=`border-t border-line p-3`,focusOnOpen:o=!1,onPosted:s,onEmptyEscape:l}){let{api:d}=c(),f=Se(),p=De(),m=rt(),h=u(),[g,_]=(0,A.useState)(r),[v,y]=(0,A.useState)(0),[b,x]=(0,A.useState)(0),[S,C]=(0,A.useState)(!1),w=(0,A.useRef)(null),ee=(0,A.useRef)(null),T=xt({mutationFn:async n=>{if(`channel`in t)return d.sendMessage({channel:t.channel,body:n});if(`threadId`in t)return d.sendMessage({thread_id:t.threadId,body:n});let r=await d.openThread({channel:e,title:Ba(n)});return d.sendMessage({thread_id:r.id,body:n})},onSuccess:e=>{_(r),f.invalidateQueries({queryKey:e.thread===void 0?[`channel`,e.channel]:[`thread`,e.thread]}),`ask`in t&&f.invalidateQueries({queryKey:[`threads`]}),f.invalidateQueries({queryKey:[`requests`]}),s?.(e)}});(0,A.useEffect)(()=>{o&&w.current?.focus()},[o]),(0,A.useLayoutEffect)(()=>{let e=w.current;e!==null&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,ee.current!==null&&(e.setSelectionRange(ee.current,ee.current),ee.current=null))});let te=S?null:Ps(g,v),ne=(p.data??[]).filter(e=>e.status===`active`&&e.cli!==null),re=te===null?[]:ne.filter(e=>e.name.startsWith(te.prefix)).slice(0,Vs),ae=Is(g,p.data??[],m.data??[]),oe=`ask`in t?[]:Ls(ae,p.data??[],h.data?.turns??[],`channel`in t?{channel:t.channel}:{thread:t.threadId}),se=Rs(oe,ae.filter(e=>!oe.includes(e))),ce=e=>{if(te===null)return;let t=Fs(g,v,te.start,e);ee.current=t.caret,_(t.text),y(t.caret)},le=()=>{g.trim()!==``&&g.trim()!==r.trim()&&!T.isPending&&T.mutate(g.trim())},ue=e=>{if(re.length>0){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:re.length-1;x((b+t)%re.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),ce(re[Math.min(b,re.length-1)]?.name??``);return}if(e.key===`Escape`){e.preventDefault(),C(!0);return}}if(e.key===`Enter`&&!e.shiftKey&&!e.nativeEvent.isComposing){e.preventDefault(),le();return}e.key===`Escape`&&g===``&&l!==void 0&&(e.preventDefault(),l())},de=(0,M.jsx)(Ds,{variant:`primary`,type:`submit`,disabled:g.trim()===``||g.trim()===r.trim()||T.isPending,children:T.isPending?`Sending…`:`Send`});return(0,M.jsxs)(`form`,{className:a,onSubmit:e=>{e.preventDefault(),le()},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)] ${i?`flex items-end gap-2 pr-1.5`:``}`,children:[re.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:re.map((e,t)=>(0,M.jsx)(`li`,{children:(0,M.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),ce(e.name)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm ${t===b?`bg-surface-2 text-fg-primary`:`text-fg-secondary`}`,children:[e.cli===null?null:(0,M.jsx)(yo,{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:w,rows:1,value:g,placeholder:n,"aria-label":n,onChange:e=>{_(e.target.value),y(e.target.selectionStart),x(0),C(!1)},onSelect:e=>y(e.currentTarget.selectionStart),onKeyDown:ue,className:`block max-h-48 w-full resize-none bg-transparent px-3 text-sm text-fg-primary outline-none placeholder:text-fg-muted ${i?`py-2.5`:`pt-2.5 pb-1`}`}),i?(0,M.jsx)(`div`,{className:`shrink-0 pb-1.5`,children:de}):(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:se??`Enter to send · Shift+Enter for a new line`}),de]})]}),T.error===null?null:(0,M.jsx)(`p`,{role:`alert`,className:`mt-2 text-xs text-red-400`,children:T.error instanceof ie?T.error.message:`The message was not sent.`})]})}var Us=5;function Ws(e,t,n){switch(e.kind){case`answering`:return{text:`${Bs(e.who)} ${e.who.length===1?`is`:`are`} answering…`,tone:`text-emerald-300`};case`queued`:return{text:`${Bs(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=Le(t.body,160);return{text:`closed by ${n(e.by??`board`)}${r===``?``:` · ${r}`}`,tone:`text-fg-muted`}}function Gs({left:e,width:t,onClose:n}){let r=f(),i=u(),a=Qa(),o=ot(3e4),s=Ts(),c=(0,A.useRef)(null),l=za(r.data??[]).slice(0,Us),d=g(i.data?.running??[]),p=g(i.data?.pending??[]);return(0,A.useEffect)(()=>{let e=e=>{e.target instanceof Node&&c.current?.contains(e.target)===!1&&n()};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[n]),(0,M.jsxs)(`section`,{ref:c,"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:Ua,children:(0,M.jsx)(Hs,{target:{ask:!0},placeholder:`Ask the front desk`,oneLine:!0,className:`p-2`,focusOnOpen:!0,onEmptyEscape:n})}),l.length===0?null:(0,M.jsx)(`ol`,{"aria-label":`Your asks`,className:`${Ua} max-h-[40vh] overflow-y-auto py-1`,children:l.map(e=>{let t=Ws(Va(e,d,p),e,s),n=Ha(e,a);return(0,M.jsx)(`li`,{children:(0,M.jsxs)(N,{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:Qe(e.openedAt,o)})]}),(0,M.jsx)(`span`,{className:`mt-0.5 block truncate text-xs ${t.tone}`,children:t.text})]})},e.id)})})]})}function Ks({unread:e,onOpen:t}){let n=Ts(),[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 qs={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 Js(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 ${Qe(e.lastTurnAt,r)}`}function Ys({member:e,star:t,place:n,now:r}){let i=e.lastModel??e.model,a=qs[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)(yo,{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:Js(e,t,n,r)})]})}function Xs({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 Zs=new Set(b),Qs={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`};function $s(e){return Zs.has(e)}function ec(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 tc(e){return[e.project??``,e.agent??``,e.role===void 0?``:`role ${e.role}`,$s(e.kind)?`wakes the steward`:``].filter(e=>e.length>0)}function nc({onClose:e}){let t=ee(!0),n=u(),r=ot(3e4),i=t.data??[],a=ec(i,n.data?.signals??[]);return(0,M.jsxs)(Wa,{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=$s(n.kind),o=tc(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:Qs[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:Qe(t,r)})]}),(0,M.jsx)(`p`,{className:`mt-1 text-sm text-fg-secondary`,children:(0,M.jsx)(Io,{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)(N,{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 rc=32;function ic(e,t){return t.width+t.x-e.clientX}function ac({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(ic(e,a.current),!1)},c=e=>{a.current!==null&&(r(ic(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+rc:i.key===`ArrowRight`?e-rc: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 oc({mark:e,project:t,members:n}){let r=n?.find(t=>t.name===e.holder)?.cli??null,i=pt.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 ${ut[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)(yo,{cli:r,size:12}),e.holder,e.linked===null?` · resting`:` · in a turn on it`]})]})]})]})}function sc(e,t){let n=`latest`;return zo({token:e,url:()=>`/api/events/stream?since=${n}`,onData:e=>{let r=me.parse(JSON.parse(e));n=r.id,t.onEvent(r)},onOpen:e=>{e&&t.onResume()}})}function cc(e){return typeof e==`string`?e:void 0}function lc(e){let{type:t,payload:n,actor:r}=e;if(t===`message.posted`){let e=cc(n.thread);return e===void 0?[[`channels`],[`channel`,cc(n.channel)],[`requests`]]:[[`threads`],[`thread`,e],[`requests`]]}return t.startsWith(`thread.`)?[[`threads`],[`thread`,cc(n.threadId)],[`channel`],[`requests`]]:t.startsWith(`task.`)||t.startsWith(`merge.`)||t===`lease.expired`?[[`tasks`],[`task`,cc(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`,cc(n.project)??`society`]]:t.startsWith(`agent.`)||t===`subscription.changed`?[[`members`]]:t.startsWith(`project.`)||t===`channel.added`?[[`projects`],[`channels`],[`society`]]:t===`role.added`?[[`roles`]]:t.startsWith(`runner.`)?[[`runners`],[`models`]]:t.startsWith(`proposal.`)?[[`proposals`],[`proposal`,cc(n.proposalId)],[`metrics`]]:t===`skill.promoted`?[[`skills`]]:t===`ops.signal`?[[`signals`],[`scheduler`],[`metrics`]]:[]}function uc(e,t){for(let n of lc(t)){let t=n.filter(e=>e!==void 0);e.invalidateQueries({queryKey:t})}}var dc=`stellaris.contentWidth`;function fc(e){return Math.round(Math.min(680,Math.max(420,e*.4)))}function pc(e){return Math.max(420,e-256-48)}function mc(e,t){let n=pc(e);return t===`widest`?n:Math.round(Math.min(n,Math.max(420,t??fc(e))))}function hc(e,t){return mc(e,t)>=pc(e)?null:`widest`}function gc(){let e=localStorage.getItem(dc);if(e===`widest`)return`widest`;let t=Number(e);return e!==null&&Number.isFinite(t)&&t>0?t:null}function _c(e){e===null?localStorage.removeItem(dc):localStorage.setItem(dc,String(e))}var vc=`stellaris.trail`;function yc(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 bc(e,t){let n=e[t-1];return n===void 0||new URL(n,`http://board`).pathname===`/`?null:n}function xc(){try{let e=JSON.parse(sessionStorage.getItem(vc)??`{}`);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 Sc(e){sessionStorage.setItem(vc,JSON.stringify(e))}function Cc(e,t){return decodeURIComponent(e.split(`/`)[t]??``)}function wc(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`?Cc(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 Tc=typeof sessionStorage>`u`?{}:xc(),Ec=new Set;function Dc(e,t){if(Tc[e]!==t||Tc[e+1]!==void 0){Tc=yc(Tc,e,t),Sc(Tc);for(let e of Ec)e()}}function Oc(){return(0,A.useSyncExternalStore)(e=>(Ec.add(e),()=>Ec.delete(e)),()=>Tc)}function kc(e,t){let n=pt.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 Ac=Math.PI*(3-Math.sqrt(5)),jc=68,Mc=44,Nc=58,Pc=26,Fc=13,Ic=.3,Lc=1.5*Math.PI,z=28,Rc=280,zc=8,Bc=40;function Vc(e){return Math.max(Nc,jc*Math.sqrt(Math.max(0,e-1))+Mc)}function Hc(e){return e+Pc}function Uc(e){let t=new Map;for(let n of e.toSorted()){let e=We(n);if(e!==null){let n=t.get(e.agent)??[];n.includes(e.scope)||t.set(e.agent,[...n,e.scope])}}return t}function Wc(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:Ve,i=Uc(e.scheduler.running),a=Uc(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:Ve,queuedFor:n===void 0?null:r(n)}]}),l=new Map([[Ve,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:Ve,label:`society`,kind:`society`,x:0,y:0,radius:Vc(u.get(`society`)??0)},f=[d,...qc(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=jc*Math.sqrt(s),u=s*Ac-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=Gc(e.tasks??[],f,m),g=Math.max(...f.map(e=>Math.hypot(e.x,e.y)+Hc(e.radius)));return{anchors:f,stars:m,tasks:h,radius:Math.round(g+Bc)}}function Gc(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=ft(e);return t===`done`||t===`abandoned`?[]:[{task:e,phase:t}]}).toSorted((e,t)=>e.task.id.localeCompare(t.task.id)),a=Math.min(Ic,Lc/Math.max(1,t.length)),o=i.radius+Fc;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=Ce(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?dt(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 Kc(e,t,n){let r=e.stars.filter(e=>e.name===t);return(r.find(e=>e.anchor===n)??r[0])?.id??null}function qc(e,t,n){let r=[],i=Hc(n.radius),a=zc;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=>Vc(t.get(e.slug)??0)),l=c.map(Hc),u=l.map(e=>2*e+z),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?Rc:0,i+Math.max(...l)+z);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)+z)/(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]??Nc)})}),i=h+Math.max(...l)}return r}var Jc=.15,Yc=.45,Xc=1.35,Zc=64,Qc=1.15;function $c(e,t,n){return Math.min(n,Math.max(t,e))}function el(e){return Math.max(240,e.width-e.left-e.right)}function tl(e){return{x:e.left+el(e)/2,y:e.height/2}}function nl(e,t){return{x:0,y:0,scale:$c(Math.min(el(e),e.height)/(2*t),Yc,Xc)}}function rl(e,t,n,r){let i=$c(e.scale*n,Jc,3),a=tl(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 il(e,t,n){return{...e,x:e.x-t/e.scale,y:e.y-n/e.scale}}function al(e,t,n){let r=tl(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>=Zc&&a+o<=t.height)return null;let s=Math.min(el(t),t.height-Zc)/(2*n.reach*Qc);return{x:n.x,y:n.y,scale:Math.min(e.scale,$c(s,Jc,3))}}var ol=`#0a0a0a`,sl=`#171717`,cl=`212, 212, 212`,ll=`163, 163, 163`,ul=`115, 115, 115`,dl=`"Instrument Sans Variable", ui-sans-serif, sans-serif`,fl=`500 12px "Onest Variable", ui-sans-serif, sans-serif`,pl=`600 10px "Onest Variable", ui-sans-serif, sans-serif`,ml={waiting:`#fcd34d`,working:`#6ee7b7`,returned:`#fdba74`,landing:`#7dd3fc`},hl=`500 11px ${dl}`,gl=5,_l=240,vl=34,yl=.06,bl=15,xl=5,B=4.2,Sl=280;function Cl(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 wl(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 Tl(e,t){return(e%t+t)%t}function El(e){let t=Number.parseInt(e.slice(1),16);return`${t>>16&255}, ${t>>8&255}, ${t&255}`}function Dl(e){let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(n!==null){let t=El(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 Ol=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(Ma.claude.path),codex:new Path2D(Ma.codex.path)};let r=Cl(7);this.specks=Array.from({length:Sl},()=>({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:wl(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=rl(this.target,n,e,t??tl(n)),this.mode=`manual`}panBy(e,t){this.target=il(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=al(this.target,e,{x:t.anchor.x,y:t.anchor.y,reach:t.anchor.radius+vl});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(bl*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=nl(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=tl(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+=(xl*(n.star.x-n.x)-B*n.vx)*e,n.vy+=(xl*(n.star.y-n.y)-B*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>gl||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=Dl(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=ol,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=El(ml[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=ml[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=hl,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,(gl-i)/1.2)*r.presence;if(a<=0)continue;let o=n.text;if(e.measureText(o).width>_l){for(;o.length>1&&e.measureText(`${o}…`).width>_l;)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,bl*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(${cl}, 1)`,e.fillText(o,u+8,d+11+.5)}e.restore()}drawSpecks(e){let{ctx:t}=this,n=-this.camX*this.scale*yl,r=-this.camY*this.scale*yl;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(Tl(i.x*this.width+n,this.width),Tl(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=pl,e.letterSpacing=`2px`,e.fillStyle=`rgba(${ul}, 0.9)`,e.fillText(t.label.toUpperCase(),a.x,a.y+o+10),e.letterSpacing=`0px`):(e.font=fl,e.fillStyle=s?`rgba(245, 245, 245, 1)`:`rgba(${ll}, 0.95)`,e.fillText(t.label,a.x,a.y+o+10))}}drawBody(e,t){let{ctx:n}=this,{star:r}=e,i=Ma[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,bl*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=El(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(${cl}, 0.55)`,n.lineWidth=1,n.stroke(),n.setLineDash([])),n.beginPath(),n.arc(u.x,u.y,m,0,Math.PI*2),n.fillStyle=sl,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 ${dl}`,n.textAlign=`center`,n.textBaseline=`top`,n.fillStyle=`rgba(${cl}, ${a||o?1:.7})`,n.fillText(r.name,u.x,u.y+m+8*this.scale+3),n.restore()}},kl=15e3,Al=26,jl=12,Ml=4,Nl=.0015,Pl=.01,Fl=1.3,Il=`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 Ll(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+jl,s=n.width-r.right-jl,c=t.x+Al+i<=s?t.x+Al:t.x-Al-i,l=Math.min(Math.max(jl,t.y-a/3),n.height-a-jl);e.style.transform=`translate(${Math.round(Math.max(o,c))}px, ${Math.round(l)}px)`,e.style.visibility=`visible`}function Rl({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=No(),_=(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 Ol(e,{reducedMotion:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,onHoverPosition:e=>Ll(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?Pl:Nl)),{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)>kl)return;let n=Kc(h.current,e.agent,e.project);if(n===null)return;t.flash(n);let r=is(e.event.name,e.event.input);r!==null&&t.say(n,wo(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)>Ml&&(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:Il,onClick:()=>p.current?.zoomBy(Fl),children:`+`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,className:Il,onClick:()=>p.current?.zoomBy(1/Fl),children:`−`}),(0,M.jsx)(`button`,{type:`button`,"aria-label":`Fit the whole sky`,title:`Fit the whole sky`,className:Il,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 zl={left:0,right:0};function Bl(){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 Vl(e,t){return e.startsWith(t)?decodeURIComponent(e.slice(t.length)):null}function Hl(){let{api:e,token:t,signOut:r,expire:i}=c(),a=Se();(0,A.useEffect)(()=>sc(t,{onEvent:e=>uc(a,e),onResume:()=>void a.invalidateQueries()}),[t,a]);let[o]=(0,A.useState)(()=>new cs);(0,A.useEffect)(()=>o.follow(t),[o,t]);let s=n(),l=ke(),d=De(),p=O(),m=u(),h=f(),g=Ye(),_=oe(),v=(0,A.useMemo)(()=>So(h.data??[],g,_.data??[]),[h.data,g,_.data]),y=Hi(),b=xt({mutationFn:t=>e.setPaused(t),onSuccess:()=>void a.invalidateQueries({queryKey:[`scheduler`]})}),x=ka({select:e=>e.location.pathname}),S=ka({select:e=>e.location.href}),C=ka({select:e=>e.location.state.__TSR_index});(0,A.useEffect)(()=>Dc(C,S),[C,S]);let[w,ee]=(0,A.useState)(!1),[T,te]=(0,A.useState)(null),ne=T===x,re=(0,A.useCallback)(()=>te(null),[]),ae=(0,A.useRef)(!0),se=Qa(),ce=Vi({strict:!1}),[le,ue]=(0,A.useState)(null),de=ot(3e4),E=Bl(),fe=x!==`/`,[pe,me]=(0,A.useState)(gc),he=mc(E,pe),ge=(e,t)=>{let n=mc(E,e),r=n>=pc(E)?`widest`:n;me(r),t&&_c(r)},_e=()=>{let e=hc(E,pe);me(e),_c(e)},ve=(0,A.useMemo)(()=>fe?{left:288,right:he+32}:zl,[fe,he]),ye=Vl(x,`/thread/`),be=Me(Vl(x,`/task/`)),D=Vl(x,`/c/`)??(ye===null?null:h.data?.find(e=>e.id===ye)?.channel??null),xe=/^\/p\/([^/]+)\/tasks$/.exec(x)?.[1]??be.data?.project??null,Ce=Vl(x,`/citizen/`),we=Ce===null?null:ce.scope??null,Te=we?.split(`/`)[0]??null,k=x===`/needs-you`?`needs-you`:x===`/proposals`||x.startsWith(`/proposal/`)?`proposals`:null,Ee=vo().length,Oe=tt().data?.length??0,Ae=x===`/society`?Ve:/^\/p\/([^/]+)$/.exec(x)?.[1]??/^\/knowledge\/([^/]+)\//.exec(x)?.[1]??null;(0,A.useEffect)(()=>{let e=()=>{ae.current=!0},t=e=>{e.key===`Tab`&&(ae.current=!1);let t=e.target instanceof HTMLElement?e.target:null;if(!(t?.closest(`input, textarea, select, [contenteditable]`)!=null||e.metaKey||e.ctrlKey||e.altKey)){if(e.key===` `){if(t?.closest(`button, a, summary, [role='button']`)!=null&&!ae.current)return;e.preventDefault(),te(x);return}e.key===`Escape`&&(ne?te(null):w?ee(!1):fe&&y({to:`/`}))}};return window.addEventListener(`keydown`,t),window.addEventListener(`pointerdown`,e),()=>{window.removeEventListener(`keydown`,t),window.removeEventListener(`pointerdown`,e)}},[fe,w,ne,x,y]);let je=[s,d,p,m].some(e=>e.error instanceof ie&&e.error.status===401);(0,A.useEffect)(()=>{je&&i()},[je,i]);let Ne=(0,A.useMemo)(()=>d.data===void 0||p.data===void 0||m.data===void 0?null:Wc({members:d.data,projects:p.data,scheduler:m.data,tasks:g}),[d.data,p.data,m.data,g]);if(Ne===null){let e=[d,p,m].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=(k!==null||x===`/metrics`||x===`/runners`?`society`:null)??Ae??xe??(D===null?Ce===null?null:Te??Ne.stars.find(e=>e.name===Ce)?.anchor??null:D.includes(`/`)?D.split(`/`)[0]??null:`society`),Fe=E-ve.left-ve.right,Ie=Fe>=460,Le=Math.min(560,(Ie?Fe:E)-32),Re={left:(Ie?ve.left:0)+((Ie?Fe:E)-Le)/2,width:Le},ze=za(h.data??[]).filter(e=>Ha(e,se)),Be=e=>e===`society`?`the society`:p.data?.find(t=>t.slug===e)?.name??e,He=Ne.stars.find(e=>e.id===le),Ue=Ne.tasks.find(e=>`task:${e.id}`===le),We=d.data?.find(e=>e.name===He?.name),Ge=He===void 0?`the society`:Be(He.queuedFor??He.anchor),Ke=e=>{let t=Ne.stars.find(t=>t.id===e);t!==void 0&&y({to:`/citizen/$name`,params:{name:t.name},search:t.state===`working`?{scope:t.anchor}:{}})},qe=e=>{y({to:`/task/$taskId`,params:{taskId:e}})};return(0,M.jsx)(ls,{value:o,children:(0,M.jsx)(Mo,{value:v,children:(0,M.jsx)(bs,{value:l.data?.signIn,children:(0,M.jsxs)(`main`,{className:`relative h-full overflow-hidden`,children:[(0,M.jsx)(Rl,{model:Ne,paused:m.data?.paused??!1,hovered:le,onHover:ue,insets:ve,focus:Pe,onSelectAnchor:e=>{y(e===`society`?{to:`/society`}:{to:`/p/$slug`,params:{slug:e}})},onSelectStar:Ke,onSelectTask:qe,live:o,card:Ue===void 0?He===void 0||We===void 0?null:(0,M.jsx)(Ys,{member:We,star:He,place:Ge,now:de}):(0,M.jsx)(oc,{mark:Ue,project:Be(Ue.project),members:d.data})}),(0,M.jsx)(Xs,{society:s.data?.name,citizens:new Set(Ne.stars.map(e=>e.name)).size,citizensOpen:x===`/citizens`,onToggleCitizens:()=>void y(x===`/citizens`?{to:`/`}:{to:`/citizens`}),runnersOpen:x===`/runners`,onToggleRunners:()=>void y(x===`/runners`?{to:`/`}:{to:`/runners`}),enrolling:Oe,attention:Ee,onOpenAttention:()=>void y({to:`/needs-you`}),paused:m.data?.paused??!1,onTogglePause:()=>b.mutate(!(m.data?.paused??!1)),pauseBusy:b.isPending,boardOpen:fe,onToggleBoard:()=>void y(fe?{to:`/`}:{to:`/c/$`,params:{_splat:`general`}}),logsOpen:w,metricsOpen:x===`/metrics`,onToggleMetrics:()=>void y(x===`/metrics`?{to:`/`}:{to:`/metrics`}),onToggleLogs:()=>ee(!w),onSignOut:r}),fe?(0,M.jsx)(ys,{activeChannel:D,activeTasks:xe,activeCitizen:Ce,activeScope:we,activeGovernance:k,activeOverview:Ae}):null,fe?(0,M.jsxs)(Wa,{label:`Board content`,className:`top-[72px] right-4 bottom-4`,style:{width:he},children:[(0,M.jsx)(ac,{width:he,min:420,max:pc(E),onResize:ge,onToggle:_e}),(0,M.jsx)(ya,{})]}):null,w?(0,M.jsx)(nc,{onClose:()=>ee(!1)}):null,ne?(0,M.jsx)(Gs,{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)(Ks,{unread:ze,onOpen:()=>te(x)})}),Ne.stars.length===0&&!fe?(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:()=>ue(`task:${e.id}`),onBlur:()=>ue(null),onClick:()=>qe(e.id),children:kc(e,Be(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:()=>ue(e.id),onBlur:()=>ue(null),onClick:()=>Ke(e.id),children:[e.name,`, `,e.state,e.state===`working`?` at ${Be(e.anchor)}`:``]})},e.id))})]})})})})}var Ul=`modulepreload`,Wl=function(e){return`/`+e},Gl={},V=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=Wl(t,n),t=s(t),t in Gl)return;Gl[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`:Ul,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 Kl(){return null}var H=la({component:Hl}),ql=Ta({routeTree:H.addChildren([sa({getParentRoute:()=>H,path:`/`,component:Kl}),sa({getParentRoute:()=>H,path:`/c/$`,component:P(()=>V(()=>import(`./ChannelView-Dkzr1zkF.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`ChannelView`)}),sa({getParentRoute:()=>H,path:`/thread/$threadId`,component:P(()=>V(()=>import(`./ThreadView-BqNSssCf.js`),__vite__mapDeps([9,1,4,2,3,5,6,7,8,10])),`ThreadView`)}),sa({getParentRoute:()=>H,path:`/society`,component:P(()=>V(()=>import(`./SocietyView-Cf8ENDAw.js`),__vite__mapDeps([11,1,5,12,13])),`SocietyView`)}),sa({getParentRoute:()=>H,path:`/p/$slug`,component:P(()=>V(()=>import(`./ProjectView-w0mcF0KW.js`),__vite__mapDeps([14,1,3,4,5,7,12,13])),`ProjectView`)}),sa({getParentRoute:()=>H,path:`/knowledge/$scope/$topic`,component:P(()=>V(()=>import(`./KnowledgeView-DFAC95aF.js`),__vite__mapDeps([15,1,4,5,7,10])),`KnowledgeView`)}),sa({getParentRoute:()=>H,path:`/p/$slug/tasks`,component:P(()=>V(()=>import(`./TasksView-CnhTIldG.js`),__vite__mapDeps([16,1,3,5])),`TasksView`)}),sa({getParentRoute:()=>H,path:`/task/$taskId`,component:P(()=>V(()=>import(`./TaskView-A9IgTxQ0.js`),__vite__mapDeps([17,1,3,4,5,10,18,2])),`TaskView`)}),sa({getParentRoute:()=>H,path:`/task/$taskId/files/$`,validateSearch:e=>{let t=Number(e.line);return Number.isInteger(t)&&t>0?{line:t}:{}},component:P(()=>V(()=>import(`./TaskFileView-CRwwL5K8.js`),__vite__mapDeps([19,1,4,5,10])),`TaskFileView`)}),sa({getParentRoute:()=>H,path:`/metrics`,validateSearch:e=>{let t=m.safeParse(e.window);return t.success?{window:t.data}:{}},component:P(()=>V(()=>import(`./MetricsView-Bp486U0v.js`),__vite__mapDeps([20,1,5,12,13])),`MetricsView`)}),sa({getParentRoute:()=>H,path:`/citizens`,component:P(()=>V(()=>import(`./CitizensView-DttP5FqR.js`),__vite__mapDeps([21,1,5,13])),`CitizensView`)}),sa({getParentRoute:()=>H,path:`/needs-you`,component:P(()=>V(()=>import(`./NeedsYouView-CJ4COcNn.js`),__vite__mapDeps([22,1,5])),`NeedsYouView`)}),sa({getParentRoute:()=>H,path:`/runners`,validateSearch:e=>typeof e.code==`string`?{code:e.code}:{},component:P(()=>V(()=>import(`./RunnersView-H3kCdSQB.js`),__vite__mapDeps([23,1,5,7])),`RunnersView`)}),sa({getParentRoute:()=>H,path:`/proposals`,component:P(()=>V(()=>import(`./ProposalsView-XrraDhwt.js`),__vite__mapDeps([24,1,5])),`ProposalsView`)}),sa({getParentRoute:()=>H,path:`/proposal/$proposalId`,component:P(()=>V(()=>import(`./ProposalView-CyJCwUYK.js`),__vite__mapDeps([25,1,3,4,5,7,10,24,18,2])),`ProposalView`)}),sa({getParentRoute:()=>H,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:P(()=>V(()=>import(`./CitizenView-BLgyEvYz.js`),__vite__mapDeps([26,1,4,5,7,8,13])),`CitizenView`)})])});function Jl({signInError:e}){let t=Se(),[n,r]=(0,A.useState)(fe),a=(0,A.useCallback)(()=>{i(),t.clear(),r(null)},[t]),o=(0,A.useCallback)(()=>{n!==null&&de(n).signOut().catch(()=>void 0),a(),ql.navigate({to:`/`})},[n,a]),s=(0,A.useMemo)(()=>n===null?null:{api:de(n),token:n,signOut:o,expire:a},[n,o,a]);return s===null?(0,M.jsx)(La,{initialError:e,onEnter:e=>{le(e),r(e)}}):(0,M.jsx)(Ae,{value:s,children:(0,M.jsx)(Oa,{router:ql})})}var Yl={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 Xl(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:Yl[r]??`GitHub sign-in failed.`}}function Zl(){let e=Xl(window.location.hash);return e!==null&&(e.token!==null&&le(e.token),window.history.replaceState(window.history.state,``,`${window.location.pathname}${window.location.search}`)),e}var Ql=new bt({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),$l=Zl(),eu=document.getElementById(`root`);if(eu===null)throw Error(`missing #root element`);(0,Aa.createRoot)(eu).render((0,M.jsx)(A.StrictMode,{children:(0,M.jsx)(Xe,{client:Ql,children:(0,M.jsx)(Jl,{signInError:$l?.error??null})})}));export{oo as A,Vi as B,Do as C,no as D,vo as E,io as F,xt as H,eo as I,ka as L,lo as M,po as N,ho as O,mo as P,N as R,No as S,yo as T,Bi as V,rs as _,Bs as a,Fo as b,Ds as c,Ts as d,Vo as f,I as g,os as h,Hs as i,ro as j,co as k,Ss as l,Bo as m,bc as n,Is as o,ss as p,Oc as r,Ns as s,wc as t,Cs as u,Ho as v,jo as w,Io as x,us as y,Hi as z};
@@ -1 +1 @@
1
- import{dt as e,ut as t}from"./format-Cc6KjiYZ.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{dt as e,ut as t}from"./format-lz-5NQWT.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{pn as e,un as t}from"./format-Cc6KjiYZ.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{pn as e,un as t}from"./format-lz-5NQWT.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,9 +6,9 @@
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-WB0PqHlY.js"></script>
10
- <link rel="modulepreload" crossorigin href="/assets/format-Cc6KjiYZ.js">
11
- <link rel="modulepreload" crossorigin href="/assets/tasks-CbQrkZ1C.js">
9
+ <script type="module" crossorigin src="/assets/index-CoKyPk79.js"></script>
10
+ <link rel="modulepreload" crossorigin href="/assets/format-lz-5NQWT.js">
11
+ <link rel="modulepreload" crossorigin href="/assets/tasks-DK1cnXqs.js">
12
12
  <link rel="stylesheet" crossorigin href="/assets/index-t2fXHB5Y.css">
13
13
  </head>
14
14
  <body class="antialiased">