@kubitnodes/stellaris 0.3.3 → 0.3.5

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 (46) hide show
  1. package/dist/cli/index.js +23 -4
  2. package/dist/server/index.js +83 -9
  3. package/package.json +1 -1
  4. package/web/dist/assets/BackLink-DivaHiZ7.js +1 -0
  5. package/web/dist/assets/{ChannelView-CBWvCs5U.js → ChannelView-DgkkiZuY.js} +1 -1
  6. package/web/dist/assets/CitizenView-BzhH1ycF.js +2 -0
  7. package/web/dist/assets/{CitizensView-BtutRBPU.js → CitizensView-BzGNyC2f.js} +1 -1
  8. package/web/dist/assets/KnowledgeView-DedLlEZd.js +1 -0
  9. package/web/dist/assets/Markdown-MZnGPfvk.js +31 -0
  10. package/web/dist/assets/{MessageItem-DaQY-yGb.js → MessageItem-Deq-ntT8.js} +1 -1
  11. package/web/dist/assets/MetricsView-C-2j71rI.js +1 -0
  12. package/web/dist/assets/NeedsYouView-D4xqHNDU.js +1 -0
  13. package/web/dist/assets/{Overview-C7bUUfnY.js → Overview-DxCYcW_A.js} +1 -1
  14. package/web/dist/assets/{Pane-JzhKR0rO.js → Pane-B-pz52UC.js} +1 -1
  15. package/web/dist/assets/ProjectView-BhZYFv7f.js +1 -0
  16. package/web/dist/assets/ProposalView-DAc9lEHB.js +1 -0
  17. package/web/dist/assets/{ProposalsView-D35XMr14.js → ProposalsView-CmwwJuop.js} +1 -1
  18. package/web/dist/assets/{RunnersView-DxmadMPv.js → RunnersView-Dqo_BEoK.js} +1 -1
  19. package/web/dist/assets/{SocietyView-DQ3w5OWp.js → SocietyView-DA_65uyo.js} +1 -1
  20. package/web/dist/assets/{SubjectThread-XI7ydhsi.js → SubjectThread-M4F1paqV.js} +1 -1
  21. package/web/dist/assets/TaskFileView-CCNVrooP.js +4 -0
  22. package/web/dist/assets/TaskView-BTSDk1yL.js +1 -0
  23. package/web/dist/assets/{TasksView-nQhDOU_5.js → TasksView-0IQm6u-_.js} +1 -1
  24. package/web/dist/assets/ThreadCard-BTGP4fOT.js +1 -0
  25. package/web/dist/assets/{ThreadForms-TZMoO5-W.js → ThreadForms-BipMby65.js} +1 -1
  26. package/web/dist/assets/ThreadView-D96DZAOM.js +1 -0
  27. package/web/dist/assets/{citizen-9NPRBOpv.js → citizen-CYBzbWt-.js} +1 -1
  28. package/web/dist/assets/{format-8m6fdeP8.js → format-11lojpK1.js} +1 -1
  29. package/web/dist/assets/index-BXq4t0NA.js +23 -0
  30. package/web/dist/assets/index-CKjqsZME.css +2 -0
  31. package/web/dist/assets/{tasks-Di8iatzY.js → tasks-DnJj3psB.js} +1 -1
  32. package/web/dist/assets/{useStickyScroll-BPuANcOs.js → useStickyScroll-D_7q2RKi.js} +1 -1
  33. package/web/dist/index.html +4 -4
  34. package/web/dist/assets/CitizenView-DKqzTA5L.js +0 -2
  35. package/web/dist/assets/KnowledgeView-DSinMNzK.js +0 -1
  36. package/web/dist/assets/Markdown-CwjhVNEk.js +0 -31
  37. package/web/dist/assets/MetricsView-BBgZsSMk.js +0 -1
  38. package/web/dist/assets/NeedsYouView-gft672O-.js +0 -1
  39. package/web/dist/assets/ProjectView-CSTwTULB.js +0 -1
  40. package/web/dist/assets/ProposalView-B0qXK-Vb.js +0 -1
  41. package/web/dist/assets/TaskFileView-7ljZ5Olx.js +0 -1
  42. package/web/dist/assets/TaskView-DyZBBjh1.js +0 -1
  43. package/web/dist/assets/ThreadCard-BZHmKArH.js +0 -1
  44. package/web/dist/assets/ThreadView-BV2yDunm.js +0 -1
  45. package/web/dist/assets/index-C3ujZpqY.css +0 -2
  46. package/web/dist/assets/index-DrMc2vuA.js +0 -23
@@ -0,0 +1,4 @@
1
+ import{N as e,R as t,St as n,Y as r,_n as i,b as a,j as o,t as s,vn as c,xn as l,y as u}from"./format-11lojpK1.js";import{B as d,z as f}from"./index-BXq4t0NA.js";import{c as p,d as m,f as h,i as g,l as _,n as v,o as y,p as b,r as x,t as S}from"./Markdown-MZnGPfvk.js";import{n as C,t as w}from"./Pane-B-pz52UC.js";import{t as T}from"./BackLink-DivaHiZ7.js";var E=l(c(),1),D=i(),O=`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,k=`inline-flex h-7 shrink-0 items-center rounded-md px-3 text-xs text-fg-tertiary transition-colors hover:bg-surface-2/70 hover:text-fg-primary`,A=1e3,j=2e4;function M({taskId:e,path:t}){let n=t===``?[]:t.split(`/`),r=`text-fg-tertiary hover:text-fg-primary`;return(0,D.jsxs)(`nav`,{"aria-label":`Path`,className:`flex flex-wrap items-center gap-x-1 text-meta`,children:[n.length===0?(0,D.jsx)(`span`,{children:`Files`}):(0,D.jsx)(v,{taskId:e,path:``,className:r,children:`Files`}),n.map((t,i)=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i===n.length-1?(0,D.jsx)(`span`,{className:`text-fg-secondary`,children:t}):(0,D.jsx)(v,{taskId:e,path:n.slice(0,i+1).join(`/`),className:r,children:t})]},n.slice(0,i+1).join(`/`)))]})}function N({taskId:e,file:t}){let n=t.entries.toSorted((e,t)=>e.kind===t.kind?e.name.localeCompare(t.name):e.kind===`dir`?-1:1);return(0,D.jsx)(`ul`,{className:`mt-3 space-y-1`,children:n.map(n=>(0,D.jsxs)(`li`,{className:`flex items-baseline gap-2`,children:[(0,D.jsx)(v,{taskId:e,path:t.path===``?n.name:`${t.path}/${n.name}`,className:`text-sm text-fg-secondary hover:text-fg-primary`,children:n.kind===`dir`?`${n.name}/`:n.name}),n.size===null?null:(0,D.jsx)(`span`,{className:`text-meta`,children:h(n.size)})]},n.name))})}function P({rows:e}){let[t,...n]=e;if(t===void 0)return(0,D.jsx)(`p`,{className:`mt-3 text-meta`,children:`The table is empty.`});let r=n.slice(0,A),i=`border border-line px-2 py-1 text-left align-top whitespace-pre-wrap`;return(0,D.jsxs)(`div`,{className:`mt-3 overflow-x-auto`,children:[(0,D.jsxs)(`table`,{className:`text-xs text-fg-secondary`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsx)(`tr`,{children:t.map((e,t)=>(0,D.jsx)(`th`,{scope:`col`,className:`${i} font-medium text-fg-primary`,children:e},t))})}),(0,D.jsx)(`tbody`,{children:r.map((e,t)=>(0,D.jsx)(`tr`,{children:e.map((e,t)=>(0,D.jsx)(`td`,{className:i,children:e},t))},t))})]}),n.length>r.length?(0,D.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,A,` of `,n.length,` rows; download the file for the rest.`]}):null]})}function F({text:e,line:t}){let n=e.endsWith(`
2
+ `)?e.slice(0,-1).split(`
3
+ `):e.split(`
4
+ `),r=`mt-3 overflow-x-auto rounded-lg bg-surface-0/80 p-3 font-mono text-[12px] leading-relaxed text-fg-secondary shadow-[inset_0_0_0_1px_rgba(255,255,255,0.05)]`;return n.length>j?(0,D.jsx)(`pre`,{className:r,children:e}):(0,D.jsx)(`pre`,{className:r,children:n.map((e,n)=>(0,D.jsxs)(`span`,{className:`flex ${n+1===t?`line-target`:``}`,children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,className:`w-10 shrink-0 pr-3 text-right text-fg-muted select-none`,children:n+1}),(0,D.jsx)(`span`,{className:`whitespace-pre`,children:e===``?` `:e})]},n))})}function I({taskId:e,file:t,url:n,line:i}){let a=(0,E.useMemo)(()=>t.content===null?null:b(t.path,g(t.content)),[t.path,t.content]),o=t.path.split(`/`).at(-1)??t.path;return a===null?(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[o,` is `,h(t.size),`, more than the `,h(r),` the board shows. Its runner still has it on the task's branch.`]}):a.kind===`markdown`?(0,D.jsx)(`div`,{className:`mt-3`,children:(0,D.jsx)(S,{text:a.text,base:{taskId:e,dir:m(t.path)},line:i})}):a.kind===`image`?n===null?null:(0,D.jsx)(`img`,{src:n,alt:o,className:`mt-3 max-w-full rounded-lg`}):a.kind===`table`?(0,D.jsx)(P,{rows:a.rows}):a.kind===`text`?(0,D.jsx)(F,{text:a.text,line:i}):(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[o,` is not text (`,h(t.size),`). Download it to open it.`]})}function L(){let{taskId:r,_splat:i}=d({from:`/task/$taskId/files/$`}),c=f({from:`/task/$taskId/files/$`}),l=y(_(i??``)??``),m=l.path,h=c.line??l.line,g=o(r),v=a(),b=e(r,m),S=u(3e4),A=b.data,j=A?.kind===`file`?A.content:null,P=x(j,p(m)??`application/octet-stream`),F=m===``?`Files`:m.split(`/`).at(-1)??m,L=g.data?.title??r,R=(0,E.useRef)(null);(0,E.useEffect)(()=>{h!==void 0&&A!==void 0&&R.current?.querySelector(`.line-target`)?.scrollIntoView({block:`center`})},[h,A]);let z;if(A!==void 0)z=A.kind===`dir`?(0,D.jsx)(N,{taskId:r,file:A}):(0,D.jsx)(I,{taskId:r,file:A,url:P,line:h});else if(b.error instanceof t&&b.error.status===404)z=(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[m===``?`Nothing`:m,` is not on task/`,r,` yet. What a turn writes reaches the branch when the turn ends.`]});else if(b.error instanceof t&&b.error.status===503){let e=v.data?.find(e=>e.slug===g.data?.project);z=(0,D.jsxs)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:[e?.runner===void 0?`The runner`:`${e.runner}, the runner`,` `,e?.name??`the project`,` lives on, is not connected, so the task's files cannot be read now.`]})}else z=b.error===null?(0,D.jsxs)(C,{children:[`Reading `,F,` from the task's runner…`]}):(0,D.jsx)(`p`,{className:`mt-3 text-sm text-fg-secondary`,children:b.error.message});return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(w,{leading:(0,D.jsx)(T,{fallback:(0,D.jsx)(n,{to:`/task/$taskId`,params:{taskId:r},"aria-label":`Back to the task ${L}`,className:O,children:`←`})}),title:F,subtitle:A===void 0?L:`${L}${h===void 0?``:` · line ${h}`} · committed by ${A.commit.author} ${s(A.commit.at,S)} · ${A.commit.id.slice(0,7)}`,trailing:P===null?null:(0,D.jsx)(`a`,{href:P,download:F,className:k,children:`Download`})}),(0,D.jsxs)(`div`,{ref:R,className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,D.jsx)(M,{taskId:r,path:m}),z]})]})}export{L as TaskFileView};
@@ -0,0 +1 @@
1
+ import{D as e,F as t,M as n,R as r,St as i,_n as a,b as o,gn as s,h as c,j as l,t as u,vn as d,xn as f,y as p}from"./format-11lojpK1.js";import{a as m,c as h,l as g,n as _,o as v,r as y,s as b,t as x}from"./tasks-DnJj3psB.js";import{B as S,V as C,c as w,d as T,i as E,u as D,x as O}from"./index-BXq4t0NA.js";import{a as k,n as A,s as j,t as M,u as N}from"./Markdown-MZnGPfvk.js";import{n as P,t as F}from"./Pane-B-pz52UC.js";import{t as I}from"./BackLink-DivaHiZ7.js";import{t as L}from"./SubjectThread-M4F1paqV.js";var R=f(d(),1),z=a();function B({last:e,now:t}){return e===void 0?null:(0,z.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 text-meta`,children:[e.author,` `,u(e.at,t)]})}function V({taskId:e,nodes:t,nested:n,isOpen:r,toggle:i,now:a}){return(0,z.jsx)(`ul`,{className:n?`ml-[5px] border-l border-line-strong pl-2`:`mt-2`,children:t.map(t=>{if(t.kind===`dir`){let n=r(t);return(0,z.jsxs)(`li`,{children:[(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>i(t),className:`flex w-full items-baseline gap-2 rounded-md py-0.5 text-left text-sm hover:bg-surface-2/40`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`inline-block w-2.5 shrink-0 text-[10px] text-fg-muted transition-transform ${n?`rotate-90`:``}`,children:`▸`}),(0,z.jsxs)(`span`,{className:`min-w-0 truncate text-fg-primary`,children:[t.name,`/`]}),(0,z.jsx)(`span`,{className:`shrink-0 text-meta`,children:t.files===1?`1 file`:`${t.files} files`}),(0,z.jsx)(B,{last:t.lastChange,now:a})]}),n?(0,z.jsx)(V,{taskId:e,nodes:t.children,nested:!0,isOpen:r,toggle:i,now:a}):null]},`dir:${t.path}`)}let{change:n}=t;return(0,z.jsxs)(`li`,{className:`flex items-baseline gap-2 py-0.5 text-sm`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`w-2.5 shrink-0`}),n.status===`deleted`?(0,z.jsx)(`span`,{className:`min-w-0 truncate text-fg-tertiary line-through`,title:n.path,children:t.name}):(0,z.jsx)(A,{taskId:e,path:n.path,className:`min-w-0 truncate text-fg-secondary hover:text-fg-primary`,children:t.name}),(0,z.jsx)(`span`,{className:`shrink-0 text-meta`,children:k(n)}),(0,z.jsx)(B,{last:n.lastChange,now:a})]},n.path)})})}function H({taskId:e,changes:t,now:n}){let r=(0,R.useMemo)(()=>j(t),[t]),i=(0,R.useMemo)(()=>N(r),[r]),[a,o]=(0,R.useState)(new Map);return(0,z.jsx)(V,{taskId:e,nodes:r.children,nested:!1,isOpen:e=>a.get(e.path)??i.has(e.path),toggle:e=>{o(t=>new Map(t).set(e.path,!(t.get(e.path)??i.has(e.path))))},now:n})}function U({task:e,now:t}){let i=n(e.id),a=o(),s=`task/${e.id}`,c;if(i.data!==void 0){let{files:n,total:r,head:a}=i.data;c=n.length===0?(0,z.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing changed on `,s,` yet. What a turn writes reaches the branch when the turn ends.`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`mt-2 text-meta`,children:[r===1?`1 file`:`${r} files`,` changed · newest commit by `,a.author,` `,u(a.at,t)]}),(0,z.jsx)(H,{taskId:e.id,changes:n,now:t}),r>n.length?(0,z.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`The first `,n.length,` of `,r,`; browse the branch for the rest.`]}):null]})}else if(i.error instanceof r&&i.error.status===404)c=(0,z.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Nothing on `,s,` yet. What a turn writes reaches the branch when the turn ends.`]});else if(i.error instanceof r&&i.error.status===503){let t=a.data?.find(t=>t.slug===e.project);c=(0,z.jsxs)(`p`,{className:`mt-2 text-meta`,children:[t?.runner===void 0?`The runner`:`${t.runner}, the runner`,` `,t?.name??e.project,` lives on, is not connected, so the task's files cannot be listed now.`]})}else c=i.error===null?(0,z.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the task's branch…`}):(0,z.jsx)(`p`,{className:`mt-2 text-meta`,children:i.error.message});return(0,z.jsxs)(`section`,{"aria-label":`Files`,className:`mt-5 border-t border-line pt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-section`,children:`Files`}),(0,z.jsx)(A,{taskId:e.id,path:``,className:`text-meta underline decoration-line underline-offset-2 hover:text-fg-primary`,children:`Browse the branch`})]}),c]})}function W({stage:e,index:t,task:n,members:r,now:i}){let a=e.completedBy!==void 0,o=v(n,e),s=t===n.stages.length-1,c=o&&n.status===`claimed`?n.claimedBy:void 0,l=e.holders.filter(t=>t!==c&&t!==e.completedBy),d=n.returned?.from===e.id?n.returned:void 0;return(0,z.jsxs)(`li`,{className:`relative flex gap-3 pb-4`,children:[s?null:(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-6 bottom-0 left-2.5 w-px bg-line`}),(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`relative z-10 grid size-5 shrink-0 place-items-center rounded-full text-[10px] ${a?`bg-emerald-400/20 text-emerald-300`:o?`bg-fg-primary text-surface-0`:`bg-surface-2 text-fg-muted`}`,children:a?`✓`:t+1}),(0,z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,z.jsxs)(`p`,{className:`text-sm ${o?`font-medium text-fg-primary`:`text-fg-secondary`}`,children:[e.name,e.gate?(0,z.jsx)(`span`,{className:`ml-2 rounded-md bg-sky-400/10 px-1.5 py-px text-[11px] text-sky-300`,children:`gate`}):null]}),(0,z.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[`for `,y(e),c===void 0?null:(0,z.jsxs)(z.Fragment,{children:[` · held by `,(0,z.jsx)(D,{name:c,members:r})]}),e.completedBy!==void 0&&e.completedAt!==void 0?` · done by ${e.completedBy} ${u(e.completedAt,i)}`:o&&n.status===`open`?` · waiting since ${u(n.stageSince,i)}`:``,l.length>0?` · held before by ${l.join(`, `)}`:``,d===void 0?``:` · sent back by ${d.by} ${u(d.at,i)}`]})]})]})}function G({taskId:t}){let{api:n}=e(),r=s(),i=C({mutationFn:()=>n.openThread({task_id:t}),onSuccess:()=>{r.invalidateQueries({queryKey:[`threads`]})}});return(0,z.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,z.jsx)(w,{variant:`primary`,disabled:i.isPending,onClick:()=>i.mutate(),children:i.isPending?`Opening…`:`Open its thread`}),(0,z.jsx)(`p`,{className:`text-meta`,children:i.error===null?`This task is older than task threads. It closes when the task ends.`:i.error.message})]})}function K(){let{taskId:e}=S({from:`/task/$taskId`}),n=l(e),a=t(),s=o(),d=c(),f=p(3e4);if(n.data===void 0)return(0,z.jsx)(P,{children:n.error instanceof r&&n.error.status===404?`There is no task ${e}.`:`Reading the task…`});let v=n.data,y=b(v),C=s.data?.find(e=>e.slug===v.project),w=a.data?.find(e=>e.id===v.id);return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(F,{leading:(0,z.jsx)(I,{fallback:(0,z.jsx)(i,{to:`/p/$slug/tasks`,params:{slug:v.project},"aria-label":`Back to the tasks of ${C?.name??v.project}`,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`←`})}),title:v.title,subtitle:`${C?.name??v.project} · ${h(v)} · created by ${T(v.createdBy)} ${u(v.createdAt,f)}`,trailing:(0,z.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${_[y]}`,children:x.find(e=>e.phase===y)?.label.toLowerCase()})}),(0,z.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,z.jsx)(`h3`,{className:`text-section`,children:`Plan`}),v.returned===void 0?null:(0,z.jsxs)(`p`,{className:`mt-2 rounded-lg bg-orange-500/10 px-3 py-2 text-xs leading-relaxed text-orange-200`,children:[`Sent back from `,g(v,v.returned.from),` by `,v.returned.by,` `,u(v.returned.at,f),`. The work is redone from`,` `,g(v,v.stage),` until it reaches that stage again.`]}),(0,z.jsx)(`ol`,{className:`mt-3`,children:v.stages.map((e,t)=>(0,z.jsx)(W,{stage:e,index:t,task:v,members:d.data,now:f},e.id))}),(0,z.jsxs)(`p`,{className:`text-meta`,children:[`When the last stage is done:`,` `,v.onDone===`merge`?`task/${v.id} merges onto the default branch`:`nothing more`,v.blockedBy.length>0?(0,z.jsxs)(z.Fragment,{children:[` · blocked by `,(0,z.jsx)(O,{text:v.blockedBy.join(`, `)})]}):null]}),v.body.trim()===``?null:(0,z.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,z.jsx)(`h3`,{className:`text-section`,children:`Brief`}),(0,z.jsx)(`div`,{className:`mt-2`,children:(0,z.jsx)(M,{text:v.body})})]}),(0,z.jsx)(U,{task:v,now:f}),(0,z.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,z.jsx)(`h3`,{className:`text-section`,children:`Thread`}),a.data===void 0?null:w===void 0?m(v)?(0,z.jsx)(G,{taskId:v.id}):(0,z.jsx)(`p`,{className:`mt-2 text-meta`,children:`No thread on this task.`}):(0,z.jsx)(L,{thread:w,now:f,task:v,empty:`Nothing said yet. Each stage's handover lands here, and so does anything written below.`})]})]}),w?.state===`open`?(0,z.jsx)(E,{target:{threadId:v.id},placeholder:`Write in the task's thread`}):null]})}export{K as TaskView};
@@ -1 +1 @@
1
- import{N as e,_n as t,bn as n,gn as r,m as i,ot as a,t as o,v as s,xt as c,y as l}from"./format-8m6fdeP8.js";import{c as u,i as d,l as f,o as p,r as m,s as h,t as g}from"./tasks-Di8iatzY.js";import{I as _,s as v}from"./index-DrMc2vuA.js";import{n as y,t as b}from"./Pane-JzhKR0rO.js";var x=n(t(),1),S=r();function C({task:e}){let t=h(e);return(0,S.jsx)(`ol`,{className:`flex gap-1`,"aria-hidden":`true`,children:e.stages.map((n,r)=>{let i=n.completedBy!==void 0,a=p(e,n),o=i?`bg-emerald-400/60`:a?e.status===`claimed`?`bg-fg-primary/90`:`bg-amber-300/80`:t===`abandoned`?`bg-surface-2/50`:`bg-surface-2`;return(0,S.jsx)(`li`,{title:`${r+1}. ${n.name} · ${m(n)}${n.gate?` · gate`:``}`,className:`h-1.5 min-w-3 flex-1 rounded-full ${o} ${n.gate?`ring-1 ring-sky-300/70 ring-offset-1 ring-offset-surface-1`:``}`},n.id)})})}var w=5;function T({task:e,members:t,now:n}){let r=h(e),i=a(e);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(c,{to:`/task/$taskId`,params:{taskId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:e.title}),(0,S.jsx)(`span`,{className:`shrink-0 text-meta`,children:u(e)})]}),(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(C,{task:e})}),e.returned===void 0?null:(0,S.jsxs)(`p`,{className:`mt-1.5 truncate text-xs text-orange-300/90`,children:[`Sent back from `,f(e,e.returned.from),` by `,e.returned.by,` `,o(e.returned.at,n)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:e.status===`claimed`&&r!==`landing`&&i!==void 0?(0,S.jsxs)(S.Fragment,{children:[i.name,` · held by `,(0,S.jsx)(v,{name:e.claimedBy??``,members:t})]}):e.status===`open`&&r!==`landing`&&i!==void 0?`${i.name} · waiting for ${m(i)} since ${o(e.stageSince,n)}`:r===`landing`?`landing task/${e.id} on the default branch`:`${r} ${o(e.updatedAt,n)}`})]})})}function E(){let{slug:t}=_({from:`/p/$slug/tasks`}),n=e(t),r=l(),a=i(),o=s(3e4),[c,u]=(0,x.useState)(new Set),f=r.data?.find(e=>e.slug===t),p=d(n.data??[]),m=p.filter(e=>e.phase!==`done`&&e.phase!==`abandoned`).reduce((e,t)=>e+t.tasks.length,0);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(b,{title:`Tasks`,subtitle:`${f?.name??t} · ${m} in play · ${n.data?.length??0} in all`}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:n.data===void 0?(0,S.jsx)(y,{children:`Reading the tasks…`}):p.length===0?(0,S.jsx)(y,{children:`No tasks in this project yet.`}):p.map(e=>{let t=e.phase!==`done`&&e.phase!==`abandoned`||c.has(e.phase)?e.tasks:e.tasks.slice(0,w);return(0,S.jsxs)(`section`,{className:`mb-3`,children:[(0,S.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[g.find(t=>t.phase===e.phase)?.label,` · `,e.tasks.length]}),(0,S.jsx)(`ul`,{children:t.map(e=>(0,S.jsx)(T,{task:e,members:a.data,now:o},e.id))}),t.length<e.tasks.length?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>u(new Set([...c,e.phase])),className:`px-3 pt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show all `,e.tasks.length]}):null]},e.phase)})})]})}export{E as TasksView};
1
+ import{P as e,St as t,_n as n,b as r,h as i,st as a,t as o,vn as s,xn as c,y as l}from"./format-11lojpK1.js";import{c as u,i as d,l as f,o as p,r as m,s as h,t as g}from"./tasks-DnJj3psB.js";import{B as _,u as v}from"./index-BXq4t0NA.js";import{n as y,t as b}from"./Pane-B-pz52UC.js";var x=c(s(),1),S=n();function C({task:e}){let t=h(e);return(0,S.jsx)(`ol`,{className:`flex gap-1`,"aria-hidden":`true`,children:e.stages.map((n,r)=>{let i=n.completedBy!==void 0,a=p(e,n),o=i?`bg-emerald-400/60`:a?e.status===`claimed`?`bg-fg-primary/90`:`bg-amber-300/80`:t===`abandoned`?`bg-surface-2/50`:`bg-surface-2`;return(0,S.jsx)(`li`,{title:`${r+1}. ${n.name} · ${m(n)}${n.gate?` · gate`:``}`,className:`h-1.5 min-w-3 flex-1 rounded-full ${o} ${n.gate?`ring-1 ring-sky-300/70 ring-offset-1 ring-offset-surface-1`:``}`},n.id)})})}var w=5;function T({task:e,members:n,now:r}){let i=h(e),s=a(e);return(0,S.jsx)(`li`,{children:(0,S.jsxs)(t,{to:`/task/$taskId`,params:{taskId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:e.title}),(0,S.jsx)(`span`,{className:`shrink-0 text-meta`,children:u(e)})]}),(0,S.jsx)(`div`,{className:`mt-2`,children:(0,S.jsx)(C,{task:e})}),e.returned===void 0?null:(0,S.jsxs)(`p`,{className:`mt-1.5 truncate text-xs text-orange-300/90`,children:[`Sent back from `,f(e,e.returned.from),` by `,e.returned.by,` `,o(e.returned.at,r)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:e.status===`claimed`&&i!==`landing`&&s!==void 0?(0,S.jsxs)(S.Fragment,{children:[s.name,` · held by `,(0,S.jsx)(v,{name:e.claimedBy??``,members:n})]}):e.status===`open`&&i!==`landing`&&s!==void 0?`${s.name} · waiting for ${m(s)} since ${o(e.stageSince,r)}`:i===`landing`?`landing task/${e.id} on the default branch`:`${i} ${o(e.updatedAt,r)}`})]})})}function E(){let{slug:t}=_({from:`/p/$slug/tasks`}),n=e(t),a=r(),o=i(),s=l(3e4),[c,u]=(0,x.useState)(new Set),f=a.data?.find(e=>e.slug===t),p=d(n.data??[]),m=p.filter(e=>e.phase!==`done`&&e.phase!==`abandoned`).reduce((e,t)=>e+t.tasks.length,0);return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(b,{title:`Tasks`,subtitle:`${f?.name??t} · ${m} in play · ${n.data?.length??0} in all`}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:n.data===void 0?(0,S.jsx)(y,{children:`Reading the tasks…`}):p.length===0?(0,S.jsx)(y,{children:`No tasks in this project yet.`}):p.map(e=>{let t=e.phase!==`done`&&e.phase!==`abandoned`||c.has(e.phase)?e.tasks:e.tasks.slice(0,w);return(0,S.jsxs)(`section`,{className:`mb-3`,children:[(0,S.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[g.find(t=>t.phase===e.phase)?.label,` · `,e.tasks.length]}),(0,S.jsx)(`ul`,{children:t.map(e=>(0,S.jsx)(T,{task:e,members:o.data,now:s},e.id))}),t.length<e.tasks.length?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>u(new Set([...c,e.phase])),className:`px-3 pt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show all `,e.tasks.length]}):null]},e.phase)})})]})}export{E as TasksView};
@@ -0,0 +1 @@
1
+ import{St as e,_n as t,n,t as r}from"./format-11lojpK1.js";import{x as i}from"./index-BXq4t0NA.js";var a=t();function o(e){return e?.kind??`topic`}function s({state:e}){return(0,a.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${e===`open`?`bg-emerald-500/15 text-emerald-300`:`bg-surface-2 text-fg-tertiary`}`,children:e})}function c({thread:t,now:c}){let l=t.state===`closed`?n(t.body,180):``,u=t.messages===1?`1 message`:`${t.messages} messages`;return(0,a.jsxs)(e,{to:`/thread/$threadId`,params:{threadId:t.id},className:`mx-4 my-2 block rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] transition-colors hover:bg-surface-2/70`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,className:`text-fg-muted`,children:`↳`}),(0,a.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:t.title}),(0,a.jsx)(s,{state:t.state})]}),(0,a.jsxs)(`p`,{className:`mt-1 text-meta`,children:[o(t.subject),` thread by `,t.openedBy,` · `,u,` · opened`,` `,r(t.openedAt,c)]}),l===``?null:(0,a.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-secondary`,children:(0,a.jsx)(i,{text:l,links:!1})})]})}export{c as n,o as r,s as t};
@@ -1 +1 @@
1
- import{C as e,E as t,L as n,_n as r,bn as i,gn as a,hn as o,m as s}from"./format-8m6fdeP8.js";import{L as c,P as l,a as u,n as d,r as f}from"./index-DrMc2vuA.js";var p=i(r(),1),m=a(),h=`block w-full rounded-lg bg-surface-2/50 px-3 py-2 text-sm text-fg-primary outline-none shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] placeholder:text-fg-muted focus:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.16)]`;function g({error:e}){return e===null?null:(0,m.jsx)(`p`,{role:`alert`,className:`text-xs text-red-400`,children:e instanceof n?e.message:`The board did not take it.`})}function _({channel:n,onDone:r}){let{api:i}=t(),a=o(),_=l(),v=s(),y=e(),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null);(0,p.useEffect)(()=>w.current?.focus(),[]);let T=c({mutationFn:async()=>{let e=await i.openThread({channel:n,title:b.trim()});return S.trim()!==``&&await i.sendMessage({thread_id:e.id,body:S.trim()}),e},onSuccess:e=>{a.invalidateQueries({queryKey:[`threads`]}),r(),_({to:`/thread/$threadId`,params:{threadId:e.id}})}}),E=S.trim()===``?[]:f(S,v.data??[],y.data??[]);return(0,m.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),T.mutate()},children:[(0,m.jsx)(`input`,{ref:w,value:b,maxLength:200,placeholder:`What is the thread about?`,"aria-label":`Thread title`,onChange:e=>x(e.target.value),className:h}),(0,m.jsx)(`textarea`,{value:S,rows:3,placeholder:`First message, optional`,"aria-label":`First message`,onChange:e=>C(e.target.value),className:`${h} resize-none`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:E.length>0?`The first message wakes ${d(E)}.`:`Only its participants and anyone mentioned will read it.`}),(0,m.jsx)(u,{onClick:r,children:`Cancel`}),(0,m.jsx)(u,{variant:`primary`,type:`submit`,disabled:b.trim()===``||T.isPending,children:T.isPending?`Opening…`:`Open thread`})]}),(0,m.jsx)(g,{error:T.error})]})}function v({threadId:e,channel:n,onDone:r}){let{api:i}=t(),a=o(),[s,l]=(0,p.useState)(``),d=(0,p.useRef)(null);(0,p.useEffect)(()=>d.current?.focus(),[]);let f=c({mutationFn:()=>i.closeThread({thread_id:e,summary:s.trim()}),onSuccess:()=>{for(let t of[[`thread`,e],[`threads`],[`channel`,n]])a.invalidateQueries({queryKey:t});r()}});return(0,m.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),f.mutate()},children:[(0,m.jsx)(`textarea`,{ref:d,value:s,rows:3,placeholder:`What did it settle? The summary is posted to #${n}.`,"aria-label":`Closing summary`,onChange:e=>l(e.target.value),className:`${h} resize-none`}),(0,m.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,m.jsx)(u,{onClick:r,children:`Cancel`}),(0,m.jsx)(u,{variant:`primary`,type:`submit`,disabled:s.trim()===``||f.isPending,children:f.isPending?`Closing…`:`Close thread`})]}),(0,m.jsx)(g,{error:f.error})]})}export{_ as i,h as n,g as r,v as t};
1
+ import{D as e,R as t,_n as n,gn as r,h as i,vn as a,w as o,xn as s}from"./format-11lojpK1.js";import{R as c,V as l,a as u,c as d,o as f}from"./index-BXq4t0NA.js";var p=s(a(),1),m=n(),h=`block w-full rounded-lg bg-surface-2/50 px-3 py-2 text-sm text-fg-primary outline-none shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)] placeholder:text-fg-muted focus:shadow-[inset_0_0_0_1px_rgba(255,255,255,0.16)]`;function g({error:e}){return e===null?null:(0,m.jsx)(`p`,{role:`alert`,className:`text-xs text-red-400`,children:e instanceof t?e.message:`The board did not take it.`})}function _({channel:t,onDone:n}){let{api:a}=e(),s=r(),_=c(),v=i(),y=o(),[b,x]=(0,p.useState)(``),[S,C]=(0,p.useState)(``),w=(0,p.useRef)(null);(0,p.useEffect)(()=>w.current?.focus(),[]);let T=l({mutationFn:async()=>{let e=await a.openThread({channel:t,title:b.trim()});return S.trim()!==``&&await a.sendMessage({thread_id:e.id,body:S.trim()}),e},onSuccess:e=>{s.invalidateQueries({queryKey:[`threads`]}),n(),_({to:`/thread/$threadId`,params:{threadId:e.id}})}}),E=S.trim()===``?[]:f(S,v.data??[],y.data??[]);return(0,m.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),T.mutate()},children:[(0,m.jsx)(`input`,{ref:w,value:b,maxLength:200,placeholder:`What is the thread about?`,"aria-label":`Thread title`,onChange:e=>x(e.target.value),className:h}),(0,m.jsx)(`textarea`,{value:S,rows:3,placeholder:`First message, optional`,"aria-label":`First message`,onChange:e=>C(e.target.value),className:`${h} resize-none`}),(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-fg-muted`,children:E.length>0?`The first message wakes ${u(E)}.`:`Only its participants and anyone mentioned will read it.`}),(0,m.jsx)(d,{onClick:n,children:`Cancel`}),(0,m.jsx)(d,{variant:`primary`,type:`submit`,disabled:b.trim()===``||T.isPending,children:T.isPending?`Opening…`:`Open thread`})]}),(0,m.jsx)(g,{error:T.error})]})}function v({threadId:t,channel:n,onDone:i}){let{api:a}=e(),o=r(),[s,c]=(0,p.useState)(``),u=(0,p.useRef)(null);(0,p.useEffect)(()=>u.current?.focus(),[]);let f=l({mutationFn:()=>a.closeThread({thread_id:t,summary:s.trim()}),onSuccess:()=>{for(let e of[[`thread`,t],[`threads`],[`channel`,n]])o.invalidateQueries({queryKey:e});i()}});return(0,m.jsxs)(`form`,{className:`space-y-2 border-b border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),f.mutate()},children:[(0,m.jsx)(`textarea`,{ref:u,value:s,rows:3,placeholder:`What did it settle? The summary is posted to #${n}.`,"aria-label":`Closing summary`,onChange:e=>c(e.target.value),className:`${h} resize-none`}),(0,m.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,m.jsx)(d,{onClick:i,children:`Cancel`}),(0,m.jsx)(d,{variant:`primary`,type:`submit`,disabled:s.trim()===``||f.isPending,children:f.isPending?`Closing…`:`Close thread`})]}),(0,m.jsx)(g,{error:f.error})]})}export{_ as i,h as n,g as r,v as t};
@@ -0,0 +1 @@
1
+ import{D as e,R as t,St as n,Xt as r,_n as i,h as a,j as o,t as s,vn as c,xn as l,y as u}from"./format-11lojpK1.js";import{B as d,I as f,c as p,d as m,i as h}from"./index-BXq4t0NA.js";import{t as g}from"./Markdown-MZnGPfvk.js";import{t as _}from"./MessageItem-Deq-ntT8.js";import{n as v,t as y}from"./Pane-B-pz52UC.js";import{r as b,t as x}from"./ThreadCard-BTGP4fOT.js";import{t as S}from"./ThreadForms-BipMby65.js";import{t as C}from"./useStickyScroll-D_7q2RKi.js";import{t as w}from"./BackLink-DivaHiZ7.js";var T=l(c(),1),E=i();function D(){let{threadId:e}=d({from:`/thread/$threadId`});return(0,E.jsx)(O,{id:e},e)}function O({id:i}){let{api:c}=e(),l=r({queryKey:[`thread`,i],queryFn:()=>c.thread(i)}),d=a(),D=u(3e4),O=l.data?.messages??[],k=O.at(-1)?.id??null;(0,T.useEffect)(()=>f(i,k),[i,k]);let{ref:A,onScroll:j}=C(),[M,N]=(0,T.useState)(!1),P=l.data?.thread.subject,F=o(P?.kind===`task`?P.id:null);if(l.data===void 0)return(0,E.jsx)(v,{children:l.error instanceof t&&l.error.status===404?`There is no thread ${i}.`:`Reading the thread…`});let{thread:I}=l.data;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(y,{leading:(0,E.jsx)(w,{fallback:(0,E.jsx)(n,{to:`/c/$`,params:{_splat:I.channel},"aria-label":`Back to #${I.channel}`,className:`grid size-7 shrink-0 place-items-center rounded-lg text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`←`})}),title:I.title,subtitle:`${b(I.subject)} thread in #${I.channel} · opened by ${m(I.openedBy)} ${s(I.openedAt,D)}`,trailing:(0,E.jsxs)(E.Fragment,{children:[I.subject?.kind===`task`?(0,E.jsx)(n,{to:`/task/$taskId`,params:{taskId:I.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Task →`}):I.subject?.kind===`proposal`?(0,E.jsx)(n,{to:`/proposal/$proposalId`,params:{proposalId:I.subject.id},className:`shrink-0 rounded-md px-2 py-1 text-xs text-fg-tertiary hover:bg-surface-2/70 hover:text-fg-primary`,children:`Proposal →`}):null,I.state===`open`&&!M&&I.subject?.kind!==`task`?(0,E.jsx)(p,{onClick:()=>N(!0),children:`Close`}):(0,E.jsx)(x,{state:I.state})]})}),M&&I.state===`open`?(0,E.jsx)(S,{threadId:I.id,channel:I.channel,onDone:()=>N(!1)}):null,(0,E.jsxs)(`div`,{ref:A,onScroll:j,className:`flex-1 overflow-y-auto py-2`,children:[O.length===0?(0,E.jsx)(v,{children:`No messages in this thread yet.`}):null,O.map(e=>(0,E.jsx)(_,{message:e,members:d.data,now:D,task:F.data},e.id)),I.state===`closed`?(0,E.jsxs)(`section`,{className:`mx-4 mt-3 mb-2 rounded-xl bg-surface-2/40 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:[(0,E.jsxs)(`p`,{className:`text-caps`,children:[`Closed by `,m(I.closedBy??`board`),I.closedAt===void 0?``:` ${s(I.closedAt,D)}`]}),I.body.trim()===``?(0,E.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`It ended with its `,b(I.subject),`.`]}):(0,E.jsx)(g,{text:I.body})]}):null]}),I.state===`open`?(0,E.jsx)(h,{target:{threadId:I.id},placeholder:`Reply in the thread`}):null]})}export{D as ThreadView};
@@ -1 +1 @@
1
- import{it as e}from"./format-8m6fdeP8.js";import{u as t}from"./index-DrMc2vuA.js";function n(e){return e===`society`?`the society`:e}function r(t){return[...t.memberships,e]}function i(e){return e.startedAt===void 0?null:t(e.startedAt,Date.parse(e.ts))}var a={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`interrupted`,blocked:`blocked`,stopped:`stopped by you`};function o(e){return e.exitReason===null?e.outcome===`failed`?`failed`:`completed`:a[e.exitReason]??e.exitReason}function s(e){return e.outcome===`failed`||e.exitReason!==null&&e.exitReason!==`completed`&&e.exitReason!==`stopped`}function c(e,t){return t===`codex`&&e.costUsd===0?`unmetered`:`$${e.costUsd.toFixed(2)}`}function l(e){return{turns:e.length,failed:e.filter(s).length,costUsd:e.reduce((e,t)=>e+t.costUsd,0)}}function u(e,t){let n=/^\s*#{1,6}\s+(.+?)\s*(?:\n|$)/.exec(e);return n?.[1]?.toLowerCase()===t.toLowerCase()?e.slice(n[0].length).trim():e}function d(e,t){let n=[...e.homeRunner===void 0?[]:[{what:`outside projects`,runner:e.homeRunner}],...e.memberships.map(e=>({what:e,runner:t.get(e)}))],r=[...new Set(n.flatMap(e=>e.runner===void 0?[]:[e.runner]))],i=n.map(e=>`${e.what}: ${e.runner??`placed on its first turn`}`).join(`; `);return{label:r.length===0?`no runner yet`:`on ${r.join(`, `)}`,detail:i===``?`pinned to a runner on its first turn`:i}}export{n as a,u as c,d as i,o as n,i as o,l as r,r as s,c as t};
1
+ import{at as e}from"./format-11lojpK1.js";import{p as t}from"./index-BXq4t0NA.js";function n(e){return e===`society`?`the society`:e}function r(t){return[...t.memberships,e]}function i(e){return e.startedAt===void 0?null:t(e.startedAt,Date.parse(e.ts))}var a={completed:`completed`,timeout:`timed out`,error:`failed`,interrupted:`interrupted`,blocked:`blocked`,stopped:`stopped by you`};function o(e){return e.exitReason===null?e.outcome===`failed`?`failed`:`completed`:a[e.exitReason]??e.exitReason}function s(e){return e.outcome===`failed`||e.exitReason!==null&&e.exitReason!==`completed`&&e.exitReason!==`stopped`}function c(e,t){return t===`codex`&&e.costUsd===0?`unmetered`:`$${e.costUsd.toFixed(2)}`}function l(e){return{turns:e.length,failed:e.filter(s).length,costUsd:e.reduce((e,t)=>e+t.costUsd,0)}}function u(e,t){let n=/^\s*#{1,6}\s+(.+?)\s*(?:\n|$)/.exec(e);return n?.[1]?.toLowerCase()===t.toLowerCase()?e.slice(n[0].length).trim():e}function d(e,t){let n=[...e.homeRunner===void 0?[]:[{what:`outside projects`,runner:e.homeRunner}],...e.memberships.map(e=>({what:e,runner:t.get(e)}))],r=[...new Set(n.flatMap(e=>e.runner===void 0?[]:[e.runner]))],i=n.map(e=>`${e.what}: ${e.runner??`placed on its first turn`}`).join(`; `);return{label:r.length===0?`no runner yet`:`on ${r.join(`, `)}`,detail:i===``?`pinned to a runner on its first turn`:i}}export{n as a,u as c,d as i,o as n,i as o,l as r,r as s,c as t};
@@ -52,4 +52,4 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
52
52
 
53
53
  `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=In,c=!jr.jitless,l=c&&Ln.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?io([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function so(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!nr(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>sr(e,r,Mr())))}),t)}var co=k(`$ZodUnion`,(e,t)=>{j.init(e,t),O(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),O(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),O(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),O(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>wn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>so(t,r,e,i)):so(o,r,e,i)}});function lo(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var uo=k(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,co.init(e,t);let n=e._zod.parse;O(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||En(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=Dn(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=Sn(()=>lo(t));e._zod.parse=(i,a)=>{let o=i.value;if(!In(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),fo=k(`$ZodIntersection`,(e,t)=>{j.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>mo(e,t,n)):mo(e,i,a)}});function po(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Rn(e)&&Rn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=po(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=po(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function mo(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=po(t.value,n.value);if(!c.valid){if(nr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ho=k(`$ZodRecord`,(e,t)=>{j.init(e,t);let n=jr.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Rn(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>sr(e,i,Mr())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...ir(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...ir(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&Li.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>sr(e,i,Mr())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...ir(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...ir(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),go=k(`$ZodEnum`,(e,t)=>{j.init(e,t);let n=vn(t.entries),r=new Set(n);e._zod.values=r,O(e,`pattern`,e=>{let t=vn(e.def.entries).filter(e=>Bn.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Vn(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),_o=k(`$ZodLiteral`,(e,t)=>{j.init(e,t);let n=new Set(t.values);e._zod.values=n,O(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Vn(e):e?Vn(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),vo=k(`$ZodTransform`,(e,t)=>{j.init(e,t),e._zod.optin=`optional`,jr.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ar(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new kr;return n.value=i,n}});function yo(e,t){return e.value=t.issues.length?void 0:t.value,e}var bo=k(`$ZodOptional`,(e,t)=>{j.init(e,t),O(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,O(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),O(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${wn(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>yo(e,t)):yo(e,r)}return t.innerType._zod.run(e,n)}}),xo=k(`$ZodExactOptional`,(e,t)=>{bo.init(e,t),O(e,`values`,e=>e.def.innerType._zod.values),O(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),So=k(`$ZodNullable`,(e,t)=>{j.init(e,t),O(e,`optin`,e=>e.def.innerType._zod.optin),O(e,`optout`,e=>e.def.innerType._zod.optout),O(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${wn(t.source)}|null)$`):void 0}),O(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Co=k(`$ZodDefault`,(e,t)=>{j.init(e,t),e._zod.optin=`defaulted`,O(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>wo(e,t)):wo(r,t)}});function wo(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var To=k(`$ZodPrefault`,(e,t)=>{j.init(e,t),e._zod.optin=`defaulted`,O(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Eo=k(`$ZodNonOptional`,(e,t)=>{j.init(e,t),O(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Do(t,e)):Do(i,e)}});function Do(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function Oo(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>sr(e,r,Mr()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ko=k(`$ZodCatch`,(e,t)=>{j.init(e,t),O(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),O(e,`optout`,e=>e.def.innerType._zod.optout),O(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>Oo(e,r,t,n)):Oo(e,r,t,n)}}),Ao=k(`$ZodPipe`,(e,t)=>{j.init(e,t),O(e,`values`,e=>e.def.in._zod.values),O(e,`optin`,e=>e.def.in._zod.optin),O(e,`optout`,e=>e.def.out._zod.optout),O(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>jo(e,t.in,n)):jo(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>jo(e,t.out,n)):jo(r,t.out,n)}});function jo(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Mo=k(`$ZodPreprocess`,(e,t)=>{Ao.init(e,t)}),No=k(`$ZodReadonly`,(e,t)=>{j.init(e,t),O(e,`propValues`,e=>e.def.innerType._zod.propValues),O(e,`values`,e=>e.def.innerType._zod.values),O(e,`optin`,e=>e.def.innerType?._zod?.optin),O(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Po):Po(r)}});function Po(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Fo=k(`$ZodCustom`,(e,t)=>{A.init(e,t),j.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Io(t,n,r,e));Io(i,n,r,e)}});function Io(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(fr(e))}}var Lo=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Ro=`~memo`,zo=[];function Bo(e){return typeof e==`object`&&!!e}function Vo(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Ho=new WeakMap,Uo=0,Wo=1,Go=2;function Ko(e,t,n){let r=Ho.get(e);if(r!==void 0)return r?Go:Uo;if(t.has(e))return Go;t.add(e);let i=Uo,a=e=>{if(i!==Go&&e?._zod){let r=Ko(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Uo;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Wo:o.value?._zod?Ko(o.value,t,n):Uo;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=Dn(c);s(e?o(e,!0):Wo),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Ko(r,t,!1):Wo);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),qo(e,i)}function qo(e,t){return t!==Wo&&Ho.set(e,t===Go),t}function Jo(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Yo,Xo=[],Zo={alloc(e,t,n){let r=Yo;if(!r)return n;Yo=void 0;let i={value:n,issues:null};return r.set(t.value,i),Xo.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&$o(n,e.value))throw new Lo;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Ko(e,new Set,!1);if(i===Uo)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Go||r?n=!0:r=!0}let l=s.value;if(!Bo(l))return t(s,c);let u=c[Ro];u||(u={buckets:new WeakMap,backEdges:void 0},c[Ro]=u);let d;i===c?d=a:(d=Jo(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...Vo(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Yo=d;let p=Xo.length,m=t(s,c);Yo=void 0;let h=Xo.length>p?Xo.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?Vo(e.issues):zo),e)):(h&&(h.issues=m.issues.length?Vo(m.issues):zo),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Qo(){return Zo}function $o(e,t){let n=e[Ro]?.backEdges;return n!==void 0&&Bo(t)&&n.has(t)}var es=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(dr(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Un(e.values[0])}`:`Invalid option: expected one of ${yn(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${yn(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function ts(){return{localeError:es()}}var ns,rs=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function is(){return new rs}(ns=globalThis).__zod_globalRegistry??(ns.__zod_globalRegistry=is());var as=globalThis.__zod_globalRegistry;function os(e){return e.checks&&=[...e.checks],e}function ss(e,t){return new e(os({type:`string`,...D(t)}))}function cs(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...D(t)})}function ls(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...D(t)})}function us(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...D(t)})}function ds(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...D(t)})}function fs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...D(t)})}function ps(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...D(t)})}function ms(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...D(t)})}function hs(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...D(t)})}function gs(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...D(t)})}function _s(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...D(t)})}function vs(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...D(t)})}function ys(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...D(t)})}function bs(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...D(t)})}function xs(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...D(t)})}function Ss(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...D(t)})}function Cs(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...D(t)})}function ws(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...D(t)})}function Ts(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...D(t)})}function Es(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...D(t)})}function Ds(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...D(t)})}function Os(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...D(t)})}function ks(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...D(t)})}function As(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...D(t)})}function js(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...D(t)})}function Ms(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...D(t)})}function Ns(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...D(t)})}function Ps(e,t){return new e(os({type:`number`,checks:[],...D(t)}))}function Fs(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...D(t)})}function Is(e,t){return new e({type:`boolean`,...D(t)})}function Ls(e){return new e({type:`unknown`})}function Rs(e,t){return new e({type:`never`,...D(t)})}function zs(e,t){return new Ui({check:`less_than`,...D(t),value:e,inclusive:!1})}function Bs(e,t){return new Ui({check:`less_than`,...D(t),value:e,inclusive:!0})}function Vs(e,t){return new Wi({check:`greater_than`,...D(t),value:e,inclusive:!1})}function Hs(e,t){return new Wi({check:`greater_than`,...D(t),value:e,inclusive:!0})}function Us(e,t){return new Gi({check:`multiple_of`,...D(t),value:e})}function Ws(e,t){return new qi({check:`max_length`,...D(t),maximum:e})}function Gs(e,t){return new Ji({check:`min_length`,...D(t),minimum:e})}function Ks(e,t){return new Yi({check:`length_equals`,...D(t),length:e})}function qs(e,t){return new Zi({check:`string_format`,format:`regex`,...D(t),pattern:e})}function Js(e){return new Qi({check:`string_format`,format:`lowercase`,...D(e)})}function Ys(e){return new $i({check:`string_format`,format:`uppercase`,...D(e)})}function Xs(e,t){return new ea({check:`string_format`,format:`includes`,...D(t),includes:e})}function Zs(e,t){return new ta({check:`string_format`,format:`starts_with`,...D(t),prefix:e})}function Qs(e,t){return new na({check:`string_format`,format:`ends_with`,...D(t),suffix:e})}function $s(e){return new ra({check:`overwrite`,tx:e})}function ec(e){return $s(t=>t.normalize(e))}function tc(){return $s(e=>e.trim())}function nc(){return $s(e=>e.toLowerCase())}function rc(){return $s(e=>e.toUpperCase())}function ic(){return $s(e=>Pn(e))}function ac(e,t,n){return new e({type:`array`,element:t,...D(n)})}function oc(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...D(n)})}function sc(e,t){let n=cc(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(fr(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(fr(r))}},e(t.value,t)),t);return n}function cc(e,t){let n=new A({check:`custom`,...D(t)});return n._zod.check=e,n}function lc(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&En(e,t,n[t]);return e}function uc(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??as,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function dc(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function N(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,N(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&lc(o.schema,c),t.io===`input`&&P(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function fc(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function pc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${fc(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+fc(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
54
54
 
55
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function mc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;mc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var hc=new Set([`type`,`properties`,`required`,`additionalProperties`]),gc=[`oneOf`,`anyOf`];function _c(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function vc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!hc.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??_c(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}En(n,r,e.length===1?e[0]:vc(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=_c(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function yc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of hc)if(t in e)return;let n=t.filter(e=>gc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=vc(t);else{let e=n[0],i=gc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>vc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,lc(e,r))}function bc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):lc(i,s),lc(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())mc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])yc(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}lc(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,En(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Sc(t,`input`,e.processors),output:Sc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function P(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return P(r.element,n);if(r.type===`set`)return P(r.valueType,n);if(r.type===`lazy`)return P(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return P(r.innerType,n);if(r.type===`intersection`)return P(r.left,n)||P(r.right,n);if(r.type===`record`||r.type===`map`)return P(r.keyType,n)||P(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:P(r.in,n)||P(r.out,n);if(r.type===`object`){for(let e in r.shape)if(P(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(P(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(P(e,n))return!0;return!!(r.rest&&P(r.rest,n))}return!1}var xc=(e,t={})=>n=>{let r=uc({...n,processors:t});return N(e,r),pc(r,e),bc(r,e)},Sc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=uc({...i??{},target:a,io:t,processors:n});return N(e,o),pc(o,e),bc(o,e)},Cc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},wc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Tc=(e,t)=>{Cc(e,`minimum`,t),wc(e,`maximum`,t)},Ec=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Dc=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Oc=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},kc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ac=(e,t)=>Cc(e,`minimum`,t.minimum),jc=(e,t)=>wc(e,`maximum`,t.maximum),Mc=e=>(t,n)=>{kc(t,n.format);let[r,i]=e[n.format];Cc(t,`minimum`,r),wc(t,`maximum`,i)},Nc={greater_than:(e,t)=>Cc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>wc(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ec(e,t.value),number_format:Mc(Gn),bigint_format:Mc(Kn),min_length:Ac,max_length:jc,length_equals:(e,t)=>Tc(e,t.length),min_size:Ac,max_size:jc,size_equals:(e,t)=>Tc(e,t.size),string_format:(e,t)=>{kc(e,t.format),t.pattern&&Dc(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Oc(e,t.mime)};function F(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Nc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Cc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Cc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&wc(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&wc(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ec(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Oc(t,i.mime);for(let e of i.patterns??[])Dc(t,e);return t}var Pc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Fc=new Map([[Ba,Ti],[Ha,Ei]]),Ic=e=>Fc.get(e)??e,Lc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=F(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Pc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Ic);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Rc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=F(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):dc(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},zc=(e,t,n,r)=>{n.type=`boolean`},Bc=(e,t,n,r)=>{n.not={}},Vc=(e,t,n,r)=>{let i=e._zod.def,a=vn(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Hc=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(dc(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(dc(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Uc=(e,t,n,r)=>{dc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Wc=(e,t,n,r)=>{dc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Gc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=F(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=N(a.element,t,{...r,path:[...r.path,`items`]})};function Kc(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Kc(t.out):t.type===`catch`?Kc(t.innerType):e._zod.optin}var qc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&dc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)En(i.properties,e,N(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Kc(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=N(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Jc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>N(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Yc=(e,t,n,r)=>{let i=e._zod.def,a=N(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=N(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Xc(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Xc(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Xc(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Li:Ii).source),p):p}var Zc=new WeakMap;function Qc(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Zc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Xc(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var $c=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=F(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=N(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)En(i.patternProperties,Ic(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=N(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Zc.get(t);n||(n=[],Zc.set(t,n),t.deferred.push(()=>Qc(t))),n.push(e)}i.additionalProperties=N(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Kc(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},el=(e,t,n,r)=>{let i=e._zod.def,a=N(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},tl=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},nl=Symbol();function rl(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(dc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),nl):JSON.parse(o)}var il=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=rl(i.defaultValue,e,t,n,r);o!==nl&&(n.default=o)},al=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=rl(i.defaultValue,e,t,n,r);o!==nl&&(n._prefault=o)},ol=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{dc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},sl=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;N(o,t,r);let s=t.seen.get(e);s.ref=o},cl=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ll=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ul=new WeakSet([Object.prototype,Error.prototype]);function dl(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var I=k(`ZodError`,(e,t)=>{zr.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ul.has(n)||(ul.add(n),dl(n,`format`,e=>t=>Hr(e,t)),dl(n,`flatten`,e=>t=>Vr(e,t)),dl(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,bn,2)}),dl(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,bn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),fl=Wr(I),pl=Gr(I),ml=Kr(I),hl=Jr(I),gl=ei(I),_l=ti(I),vl=ni(I),yl=ri(I),bl=ii(I),xl=ai(I),Sl=oi(I),Cl=si(I);function wl(){jr.localeError||Mr(ts())}function Tl(){jr.memoizer||Mr({memoizer:Qo()})}var L=k(`ZodType`,(e,t)=>(wl(),j.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(E(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Hn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Bu(e,t))},superRefine(e,t){return this.check(Vu(e,t))},overwrite(e){return this.check($s(e))},optional(){return xu(this)},exactOptional(){return Cu(this)},nullable(){return Tu(this)},nullish(){return xu(Tu(this))},nonoptional(e){return ju(this,e)},array(){return H(this)},or(e){return lu([this,e])},and(e){return pu(this,e)},transform(e){return Fu(this,yu(e))},default(e){return Du(this,e)},prefault(e){return ku(this,e)},catch(e){return Nu(this,e)},pipe(e){return Fu(this,e)},readonly(){return Ru(this)},describe(e){let t=this.clone();return as.add(t,{description:e}),t},meta(...e){if(e.length===0)return as.get(this);let t=this.clone();return as.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return hr(this,`~standard`,{...ca(this),jsonSchema:{input:Sc(this,`input`),output:Sc(this,`output`)}})},set"~standard"(e){mr(this,`~standard`,e)},parse:function e(t,n){return fl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await pl(this,t,n,{callee:e})},safeParse(e,t){return ml(this,e,t)},async safeParseAsync(e,t){return hl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){mr(this,`spa`,e)},validate(e,t){return Zr(this,e,t)},validateAsync(e,t){return $r(this,e,t)},encode:function e(t,n){return gl(this,t,n,{callee:e})},decode:function e(t,n){return _l(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await vl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await yl(this,t,n,{callee:e})},safeEncode(e,t){return bl(this,e,t)},safeDecode(e,t){return xl(this,e,t)},async safeEncodeAsync(e,t){return Sl(this,e,t)},async safeDecodeAsync(e,t){return Cl(this,e,t)},toJSONSchema(e){return xc(this,{})(e)},get description(){return as.get(this)?.description},get _def(){return this._zod.def}}),El=k(`_ZodString`,(e,t)=>{la.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r)},gr({format:e=>F(e).format??null,minLength:e=>F(e).minimum??null,maxLength:e=>F(e).maximum??null},{regex(...e){return this.check(qs(...e))},includes(...e){return this.check(Xs(...e))},startsWith(...e){return this.check(Zs(...e))},endsWith(...e){return this.check(Qs(...e))},min(...e){return this.check(Gs(...e))},max(...e){return this.check(Ws(...e))},length(...e){return this.check(Ks(...e))},nonempty(...e){return this.check(Gs(1,...e))},lowercase(e){return this.check(Js(e))},uppercase(e){return this.check(Ys(e))},trim(){return this.check(tc())},normalize(...e){return this.check(ec(...e))},toLowerCase(){return this.check(nc())},toUpperCase(){return this.check(rc())},slugify(){return this.check(ic())}})),Dl=k(`ZodString`,(e,t)=>{la.init(e,t),El.init(e,t)},{email(e){return this.check(cs(Ml,e))},url(e){return this.check(ms(Il,e))},jwt(e){return this.check(ks(Zl,e))},emoji(e){return this.check(hs(Ll,e))},guid(e){return this.check(ls(Nl,e))},uuid(e){return this.check(us(Pl,e))},uuidv4(e){return this.check(ds(Pl,e))},uuidv6(e){return this.check(fs(Pl,e))},uuidv7(e){return this.check(ps(Pl,e))},nanoid(e){return this.check(gs(Rl,e))},cuid(e){return this.check(_s(zl,e))},cuid2(e){return this.check(vs(Bl,e))},ulid(e){return this.check(ys(Vl,e))},base64(e){return this.check(Es(Jl,e))},base64url(e){return this.check(Ds(Yl,e))},xid(e){return this.check(bs(Hl,e))},ksuid(e){return this.check(xs(Ul,e))},ipv4(e){return this.check(Ss(Wl,e))},ipv6(e){return this.check(Cs(Gl,e))},cidrv4(e){return this.check(ws(Kl,e))},cidrv6(e){return this.check(Ts(ql,e))},e164(e){return this.check(Os(Xl,e))},datetime(e){return this.check(As(Ol,e))},date(e){return this.check(js(kl,e))},time(e){return this.check(Ms(Al,e))},duration(e){return this.check(Ns(jl,e))}});function R(e){return ss(Dl,e)}var z=k(`ZodStringFormat`,(e,t)=>{M.init(e,t),El.init(e,t)}),Ol=k(`ZodISODateTime`,(e,t)=>{Oa.init(e,t),z.init(e,t)}),kl=k(`ZodISODate`,(e,t)=>{ka.init(e,t),z.init(e,t)}),Al=k(`ZodISOTime`,(e,t)=>{Aa.init(e,t),z.init(e,t)}),jl=k(`ZodISODuration`,(e,t)=>{ja.init(e,t),z.init(e,t)}),Ml=k(`ZodEmail`,(e,t)=>{fa.init(e,t),z.init(e,t)}),Nl=k(`ZodGUID`,(e,t)=>{ua.init(e,t),z.init(e,t)}),Pl=k(`ZodUUID`,(e,t)=>{da.init(e,t),z.init(e,t)});function Fl(e){return us(Pl,e)}var Il=k(`ZodURL`,(e,t)=>{ba.init(e,t),z.init(e,t)}),Ll=k(`ZodEmoji`,(e,t)=>{xa.init(e,t),z.init(e,t)}),Rl=k(`ZodNanoID`,(e,t)=>{Sa.init(e,t),z.init(e,t)}),zl=k(`ZodCUID`,(e,t)=>{Ca.init(e,t),z.init(e,t)}),Bl=k(`ZodCUID2`,(e,t)=>{wa.init(e,t),z.init(e,t)}),Vl=k(`ZodULID`,(e,t)=>{Ta.init(e,t),z.init(e,t)}),Hl=k(`ZodXID`,(e,t)=>{Ea.init(e,t),z.init(e,t)}),Ul=k(`ZodKSUID`,(e,t)=>{Da.init(e,t),z.init(e,t)}),Wl=k(`ZodIPv4`,(e,t)=>{Ma.init(e,t),z.init(e,t)}),Gl=k(`ZodIPv6`,(e,t)=>{Fa.init(e,t),z.init(e,t)}),Kl=k(`ZodCIDRv4`,(e,t)=>{Ia.init(e,t),z.init(e,t)}),ql=k(`ZodCIDRv6`,(e,t)=>{Ra.init(e,t),z.init(e,t)}),Jl=k(`ZodBase64`,(e,t)=>{Va.init(e,t),z.init(e,t)}),Yl=k(`ZodBase64URL`,(e,t)=>{Wa.init(e,t),z.init(e,t)}),Xl=k(`ZodE164`,(e,t)=>{Ga.init(e,t),z.init(e,t)}),Zl=k(`ZodJWT`,(e,t)=>{qa.init(e,t),z.init(e,t)}),Ql=k(`ZodNumber`,(e,t)=>{Ja.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r),e.isFinite=!0},gr({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=F(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=F(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=F(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>F(e).format??null},{gt(e,t){return this.check(Vs(e,t))},gte(e,t){return this.check(Hs(e,t))},min(e,t){return this.check(Hs(e,t))},lt(e,t){return this.check(zs(e,t))},lte(e,t){return this.check(Bs(e,t))},max(e,t){return this.check(Bs(e,t))},int(e){return this.check(eu(e))},safe(e){return this.check(eu(e))},positive(e){return this.check(Vs(0,e))},nonnegative(e){return this.check(Hs(0,e))},negative(e){return this.check(zs(0,e))},nonpositive(e){return this.check(Bs(0,e))},multipleOf(e,t){return this.check(Us(e,t))},step(e,t){return this.check(Us(e,t))},finite(){return this}}));function B(e){return Ps(Ql,e)}var $l=k(`ZodNumberFormat`,(e,t)=>{Ya.init(e,t),Ql.init(e,t)});function eu(e){return Fs($l,e)}var tu=k(`ZodBoolean`,(e,t)=>{Xa.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zc(e,t,n,r)});function V(e){return Is(tu,e)}var nu=k(`ZodUnknown`,(e,t)=>{Za.init(e,t),L.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ru(){return Ls(nu)}var iu=k(`ZodNever`,(e,t)=>{Qa.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(e,t,n,r)});function au(e){return Rs(iu,e)}var ou=k(`ZodArray`,(e,t)=>{Tl(),eo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Gs(e,t))},nonempty(e){return this.check(Gs(1,e))},max(e,t){return this.check(Ws(e,t))},length(e,t){return this.check(Ks(e,t))},unwrap(){return this.element}});function H(e,t){return ac(ou,e,t)}var su=k(`ZodObject`,(e,t)=>{Tl(),oo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qc(e,t,n,r),Sr(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(E(this._zod.def,{catchall:e}))},passthrough(){return this.clone(E(this._zod.def,{catchall:ru()}))},loose(){return this.clone(E(this._zod.def,{catchall:ru()}))},strict(){return this.clone(E(this._zod.def,{catchall:au()}))},strip(){return this.clone(E(this._zod.def,{catchall:void 0}))},extend(e){return Xn(this,e)},safeExtend(e){return Qn(this,e)},merge(e){return $n(this,e)},pick(e){return qn(this,e)},omit(e){return Yn(this,e)},partial(...e){return er(bu,this,e[0])},exactPartial(...e){return er(Su,this,e[0],`exactPartial`)},required(...e){return tr(Au,this,e[0])}});function U(e,t){return new su({type:`object`,shape:e??{},...D(t)})}var cu=k(`ZodUnion`,(e,t)=>{co.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jc(e,t,n,r),e.options=t.options});function lu(e,t){return new cu({type:`union`,options:e,...D(t)})}var uu=k(`ZodDiscriminatedUnion`,(e,t)=>{cu.init(e,t),uo.init(e,t)});function du(e,t,n){return new uu({type:`union`,options:t,discriminator:e,...D(n)})}var fu=k(`ZodIntersection`,(e,t)=>{fo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yc(e,t,n,r)});function pu(e,t){return new fu({type:`intersection`,left:e,right:t})}var mu=k(`ZodRecord`,(e,t)=>{Tl(),ho.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function hu(e,t,n){return!t||!t._zod?new mu({type:`record`,keyType:R(),valueType:e,...D(t)}):new mu({type:`record`,keyType:e,valueType:t,...D(n)})}var gu=k(`ZodEnum`,(e,t)=>{go.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new gu({...t,checks:[],...D(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new gu({...t,checks:[],...D(r),entries:i})}});function W(e,t){return new gu({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...D(t)})}var _u=k(`ZodLiteral`,(e,t)=>{_o.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new _u({type:`literal`,values:Array.isArray(e)?e:[e],...D(t)})}var vu=k(`ZodTransform`,(e,t)=>{Tl(),vo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ar(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(fr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(fr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function yu(e){return new vu({type:`transform`,transform:e})}var bu=k(`ZodOptional`,(e,t)=>{bo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ll(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xu(e){return new bu({type:`optional`,innerType:e})}var Su=k(`ZodExactOptional`,(e,t)=>{xo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ll(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cu(e){return new Su({type:`optional`,innerType:e})}var wu=k(`ZodNullable`,(e,t)=>{So.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>el(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tu(e){return new wu({type:`nullable`,innerType:e})}var Eu=k(`ZodDefault`,(e,t)=>{Co.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>il(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Du(e,t){return new Eu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():zn(t)}})}var Ou=k(`ZodPrefault`,(e,t)=>{To.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ku(e,t){return new Ou({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():zn(t)}})}var Au=k(`ZodNonOptional`,(e,t)=>{Eo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ju(e,t){return new Au({type:`nonoptional`,innerType:e,...D(t)})}var Mu=k(`ZodCatch`,(e,t)=>{ko.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ol(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Nu(e,t){return new Mu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:wr(t)})}var Pu=k(`ZodPipe`,(e,t)=>{Ao.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sl(e,t,n,r),e.in=t.in,e.out=t.out});function Fu(e,t){return new Pu({type:`pipe`,in:e,out:t})}var Iu=k(`ZodPreprocess`,(e,t)=>{Pu.init(e,t),Mo.init(e,t)}),Lu=k(`ZodReadonly`,(e,t)=>{No.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ru(e){return new Lu({type:`readonly`,innerType:e})}var zu=k(`ZodCustom`,(e,t)=>{Fo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r)});function Bu(e,t={}){return oc(zu,e,t)}function Vu(e,t){return sc(e,t)}function Hu(e,t){return new Iu({type:`pipe`,in:yu(e),out:t})}function Uu(e){return As(Ol,e)}var K=R().regex(/^[a-z0-9][a-z0-9-]{0,31}$/,`expected 1-32 lowercase letters, digits, or hyphens, starting with a letter or digit`),q=R().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`expected a ULID`),J=R().regex(/^(?:[a-z0-9][a-z0-9-]{0,31}\/)?[a-z0-9][a-z0-9-]{0,31}$/,`expected <channel> or <project>/<channel>`);function Wu(e){let t=e.indexOf(`/`);return t===-1?{project:null,channel:e}:{project:e.slice(0,t),channel:e.slice(t+1)}}function Gu(e,t){return e===null?t:`${e}/${t}`}var Y=Hu(e=>e instanceof Date?e.toISOString():e,Uu()),Ku=W([`post_message`,`read_inbox`,`search`,`open_thread`,`close_thread`,`create_task`,`claim_task`,`release_task`,`update_task`,`get_task`,`subscribe`,`unsubscribe`,`propose`,`approve`,`reject`,`create_project`,`join_project`,`leave_project`,`write_knowledge`,`plan_task`,`advance_task`,`configure_project`,`archive_project`]),qu=W([`user_post`,`ops_event`,`heartbeat`]),Ju=U({name:K,purpose:R().min(1),verbs:H(Ku),wakeTriggers:H(qu).default([`heartbeat`]),reviewDate:R().optional(),maxReplicas:B().int().min(1).default(1),backlogThreshold:B().positive().default(3),resident:V().default(!1),societyScope:V().default(!1),reflects:V().default(!0)}),Yu=`user`,Xu=`user`,Zu=[`post_message`,`read_inbox`,`search`,`open_thread`,`close_thread`,`create_task`,`claim_task`,`release_task`,`update_task`,`get_task`,`subscribe`,`unsubscribe`,`propose`,`join_project`,`leave_project`,`write_knowledge`,`plan_task`,`advance_task`],Qu=[`approve`,`reject`],$u=[`create_project`],ed=[`configure_project`],td=[`archive_project`];[...Zu,...Qu,...$u,...ed,...td],[...Zu,...Qu,...ed],[...Zu,...$u,...ed];var nd=`asks`,rd=`society`;function id(e,t){return t!==null&&e.memberships.includes(t)?t:rd}var X=W([`claude`,`codex`]),ad=U({name:R().min(1),version:G(1),createdAt:Y,channels:H(K)}),od=W([`none`,`merge`]),sd=R().regex(/^s[1-9][0-9]*$/,`expected a stage id such as s1`),cd={name:R().trim().min(1).max(120),role:K.optional(),agent:K.optional(),gate:V().default(!1)};function ld(e){return e.role===void 0||e.agent===void 0}var ud={message:`a stage names a role or an agent, not both`},dd=U(cd).refine(ld,ud),fd=U({id:sd.optional(),...cd}).refine(ld,ud),pd=U({slug:K,name:R().min(1),repo:R().nullable(),defaultBranch:R().min(1),channels:H(K),members:H(K),approvers:H(K),requiredCapabilities:H(R()),createdAt:Y,onDone:od.default(`none`),runner:K.optional(),archived:U({at:Y,by:K,reason:R().min(1)}).optional()}),md=lu([U({action:W([`advanced`,`returned`,`abandoned`,`landed`,`reopened`]),stage:sd,to:sd.nullable()}),U({action:W([`approved`,`rejected`])})]);function hd(e){return`stage`in e}var gd=U({id:q,author:K,channel:J,thread:q.optional(),task:q.optional(),closes:q.optional(),step:md.optional(),ts:Y,mentions:H(K)}),_d=W([`open`,`claimed`,`done`,`abandoned`]),vd=W([`open`,`closed`]),yd=U({kind:W([`task`,`proposal`]),id:q}),bd=U({id:q,channel:J,title:R().min(1).max(200),subject:yd.optional(),state:vd,openedBy:K,openedAt:Y,closedBy:K.optional(),closedAt:Y.optional()}),xd=U({id:sd,name:R().min(1),role:K.optional(),agent:K.optional(),gate:V().default(!1),holders:H(K).default([]),completedBy:K.optional(),completedAt:Y.optional()}),Sd=U({from:sd,by:K,at:Y}),Cd=U({id:q,project:K,title:R().min(1),status:_d,createdBy:K,createdAt:Y,updatedAt:Y,claimedBy:K.optional(),leaseExpiresAt:Y.optional(),parentId:q.optional(),blockedBy:H(q),requiredCapabilities:H(R()),stages:H(xd).min(1),stage:sd,stageSince:Y,stageSeq:B().int().positive(),onDone:od.default(`none`),completing:V().default(!1),returned:Sd.optional()});function wd(e,t){return e.stages.findIndex(e=>e.id===t)}function Td(e){return e.stages.find(t=>t.id===e.stage)}var Ed=U({id:R().trim().min(1).max(120).regex(/^[\w.:/[\]-]+$/,`a model name is one word of letters, digits, and . _ : / - [ ]`),name:R(),description:R().default(``),isDefault:V().default(!1)}),Dd=W([`active`,`retired`]),Od=U({name:K,role:K,cli:X.nullable(),model:R().optional(),homeRunner:K.optional(),memberships:H(K),subscriptions:H(J),status:Dd,createdAt:Y,tokenHash:R().min(1),retiredAt:Y.optional(),retiredReason:R().optional()}),kd=U({name:K,role:K,cli:X.nullable(),homeRunner:K.optional(),status:Dd,resident:V().default(!1),model:R().optional(),lastModel:R().optional(),skills:H(K).default([]),memberships:H(K),subscriptions:H(J),claimsHeld:B().int().nonnegative().default(0),tasksDone:B().int().nonnegative().default(0),lastTurnAt:Y.optional(),lastTurnOutcome:R().optional(),createdAt:Y,retiredAt:Y.optional()}),Ad=W([`linux`,`windows`,`darwin`]),jd=U({name:K,os:Ad,clis:H(X),capabilities:H(R()),status:W([`connected`,`disconnected`]),lastSeen:Y.optional()}),Md=W([`role`,`member`,`channel`,`reallocation`,`retirement`,`skill`,`archive`]),Nd=W([`proposed`,`approved`,`rejected`,`provisioned`,`retired`]),Pd=U({name:K,role:K,cli:X,model:R().optional(),homeRunner:K.optional(),memberships:H(K).default([]),subscriptions:H(J).default([]),seedInstructions:R().optional()}),Fd=U({project:K.nullable().default(null),name:K,purpose:R().min(1)}),Id=U({description:R().min(1)}),Ld=U({agent:K,reason:R().min(1)}),Rd=U({project:K,reason:R().min(1)}),zd=U({name:K,summary:R().min(1).max(200),body:R().min(1)}),Bd={role:[Yu],member:[Yu],retirement:[Yu],archive:[Yu],channel:[Yu,`steward`],reallocation:[Yu,`steward`],skill:[Yu,`steward`]};function Vd(e,t){switch(e){case`member`:{let e=Pd.safeParse(t);if(!e.success)break;let{name:n,role:r,cli:i,memberships:a}=e.data;return`member ${n} as ${r} on ${i}${a.length===0?``:` for ${a.join(`, `)}`}`}case`role`:{let e=Ju.safeParse(t);if(!e.success)break;let{name:n,verbs:r,maxReplicas:i}=e.data;return`role ${n} (${r.length} verbs, up to ${i} per project)`}case`channel`:{let e=Fd.safeParse(t);if(!e.success)break;return`channel ${Gu(e.data.project,e.data.name)}: ${e.data.purpose}`}case`retirement`:{let e=Ld.safeParse(t);if(!e.success)break;return`retirement of ${e.data.agent}: ${e.data.reason}`}case`reallocation`:{let e=Id.safeParse(t);if(!e.success)break;return`reallocation: ${e.data.description}`}case`skill`:{let e=zd.safeParse(t);if(!e.success)break;return`skill ${e.data.name}: ${e.data.summary.trim().replace(/\.+$/,``)}`}case`archive`:{let e=Rd.safeParse(t);if(!e.success)break;return`archive of project ${e.data.project}: ${e.data.reason}`}}return`${e} ${JSON.stringify(t)}`}var Hd=U({name:K,summary:R().default(``),scope:W([`own`,`society`]),path:R().min(1)}),Ud=U({path:R().min(1),file:R().min(1),since:Y}),Wd=R().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/),Gd=U({path:R().min(1),status:W([`added`,`modified`,`deleted`]),added:B().int().nonnegative().nullable(),removed:B().int().nonnegative().nullable()}),Kd=U({changes:H(U({commit:Wd,at:Y,kind:W([`turn`,`board`,`merge`]),author:R(),turnId:q.optional(),subject:R(),files:H(Gd)})),more:V()}),qd=Gd.pick({path:!0,status:!0}).extend({patch:R().nullable(),truncated:V()}),Jd=U({topic:K,project:K.nullable(),updatedBy:K,updatedAt:Y}),Yd=U({id:q,kind:Md,proposedBy:K,status:Nd,createdAt:Y,decidedBy:K.optional(),decidedAt:Y.optional(),reason:R().optional(),charter:hu(R(),ru()),provisionedAt:Y.optional(),provision:hu(R(),ru()).optional()}),Xd=U({id:q,proposalId:q,decidedBy:K,outcome:W([`approved`,`rejected`]),reason:R().optional(),ts:Y});U({channel:J.optional(),body:R().min(1),thread_id:q.optional()}),U({since_cursor:q.nullable().optional(),limit:B().int().positive().max(200).default(50),advance:V().default(!0)}),U({query:R().min(1),project:K.optional(),channel:J.optional(),limit:B().int().positive().max(100).default(20)}),U({task_id:q.optional(),proposal_id:q.optional(),channel:J.optional(),title:R().min(1).max(200).optional()}),U({thread_id:q,summary:R().min(1)}),U({project:K,title:R().min(1).max(200),body:R().default(``),parent_id:q.optional(),required_capabilities:H(R()).default([]),stages:H(dd).min(1).optional()}),U({task_id:q}),U({task_id:q}),U({task_id:q,stage:sd.optional(),status:W([`abandoned`]).optional(),note:R().min(1).optional(),blocked_by:H(q).optional()}),U({task_id:q}),U({channel:J}),U({channel:J}),U({kind:Md,charter:hu(R(),ru()),rationale:R().default(``)}),U({proposal_id:q,reason:R().optional()}),U({proposal_id:q,reason:R().min(1)}),U({slug:K,name:R().min(1).optional(),repo:R().min(1).nullable().default(null),default_branch:R().min(1).default(`main`),on_done:od.optional()}),U({project:K,agent:K.optional()}),U({project:K,agent:K.optional()}),U({project:K.nullable().default(null),topic:K,body:R().min(1)}),U({task_id:q,stages:H(fd),on_done:od.optional()}),U({task_id:q,note:R().min(1).optional()}),U({project:K,on_done:od}),U({project:K,reason:R().min(1)});var Zd=U({id:q,ts:Y,type:W(`society.initialized,project.added,project.configured,project.archived,project.placed,agent.added,agent.configured,agent.placed,message.posted,thread.opened,thread.closed,task.created,task.claimed,task.released,task.updated,task.planned,task.advanced,task.moved,task.completing,task.completed,task.reopened,lease.expired,subscription.changed,proposal.created,proposal.decided,proposal.provisioned,channel.added,role.added,agent.retired,agent.joined,agent.left,knowledge.written,skill.promoted,runner.added,user.signed_in,user.signed_out,user.token_rotated,runner.changed,ops.signal,paused.changed,wake.requested,turn.started,turn.steered,turn.stopped,turn.completed,turn.failed,merge.completed,merge.failed`.split(`,`)),actor:K,payload:hu(R(),ru())}),Qd=U({inputTokens:B().int().nonnegative(),outputTokens:B().int().nonnegative(),cacheReadTokens:B().int().nonnegative().default(0),cacheWriteTokens:B().int().nonnegative().default(0)}),$d=U({summary:R().min(1),claimsHeld:H(q).default([]),blockedOn:H(R()).default([]),needsUserDecision:V().default(!1),memoryUpdated:V().default(!1)}),ef=W([`completed`,`timeout`,`error`,`interrupted`,`blocked`,`stopped`]),tf=du(`type`,[U({type:G(`turn_started`),agent:K,session:R(),runner:K,model:R().optional()}),U({type:G(`steered`),steer:R().min(1),messages:H(q).optional(),text:R().optional()}),U({type:G(`text`),delta:R()}),U({type:G(`tool_call`),name:R(),input:ru()}),U({type:G(`tool_result`),name:R(),ok:V(),output:R().optional()}),U({type:G(`approval_requested`),kind:R(),detail:ru()}),U({type:G(`turn_completed`),usage:Qd,costUsd:B().nonnegative(),status:$d.nullable(),exitReason:ef}),U({type:G(`error`),message:R()})]),nf=U({ts:Y,event:tf}),rf=U({seq:B().int().positive(),ts:Y,agent:K,project:K,thread:q.optional(),event:tf});U({protocol:B().int().positive(),version:R().min(1),os:Ad,clis:H(X),residentClis:H(X).default([]),steerableClis:H(X).default([]),stoppableClis:H(X).default([]),branchReads:V().default(!1),branchChanges:V().default(!1),capabilities:H(R()).default([]),slots:B().int().positive().nullable(),turns:H(q).default([])}),U({name:K,version:R()}),U({protocol:B().int().positive(),version:R().min(1).max(64),hostname:R().min(1).max(253),os:Ad,clis:H(X).max(8),capabilities:H(R().min(1).max(64)).max(32).default([])}),U({deviceCode:R().min(1),userCode:R().min(1),expiresAt:Y,intervalMs:B().int().positive()}),U({deviceCode:R().min(1)}),du(`status`,[U({status:G(`pending`)}),U({status:G(`approved`),name:K,token:R().min(1)}),U({status:G(`denied`)})]);var af=U({userCode:R().min(1),hostname:R(),os:Ad,clis:H(X),capabilities:H(R()),version:R(),requestedAt:Y,expiresAt:Y}),of=U({slug:K,origin:R().nullable(),defaultBranch:R().min(1)}),sf=du(`kind`,[U({kind:G(`home`)}),U({kind:G(`project`),repo:of,branches:H(R().min(1))}),U({kind:G(`task`),repo:of,taskId:q})]),cf=U({turnId:q,agent:K,role:K,cli:X,model:R().optional(),scope:K,thread:q.optional(),session:R().min(1).nullable(),costSoFarUsd:B().nonnegative(),instructions:R(),prompt:R(),mcp:U({url:R().min(1),token:R().min(1)}),limits:U({timeoutMs:B().int().positive().nullable(),maxTurns:B().int().positive().nullable()}),resident:U({key:R().min(1),idleMs:B().int().positive()}).optional(),workspace:sf}),lf=U({branch:R().min(1),head:R().min(1)});U({entries:H(nf)}),U({exitReason:ef,status:$d.nullable(),error:R().nullable(),usage:Qd,costUsd:B().nonnegative(),sessionCostUsd:B().nonnegative().optional(),session:R().min(1),model:R().nullable(),work:lf.nullable()}),U({dropWorktree:V()});var uf=U({repo:of,branch:R().min(1)});U({ok:V(),detail:R()});var df=8388608,ff=R().max(4096).refine(e=>e===``||e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&!e.includes(`\0`)),{message:"a path inside the branch, with no empty, `.`, or `..` segment"}),pf=R().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/),mf=U({repo:of,branch:pf,path:ff}),hf=U({id:R().min(1),at:Y,author:R()}),gf=du(`kind`,[U({kind:G(`file`),path:ff,commit:hf,size:B().int().nonnegative(),content:R().nullable()}),U({kind:G(`dir`),path:ff,commit:hf,entries:H(U({name:R().min(1),kind:W([`file`,`dir`]),size:B().int().nonnegative().nullable()}))})]),_f=U({repo:of,branch:pf}),vf=U({head:hf,files:H(U({path:R().min(1),status:W([`added`,`modified`,`deleted`]),added:B().int().nonnegative().nullable(),removed:B().int().nonnegative().nullable(),lastChange:U({author:R(),at:Y}).optional()})),total:B().int().nonnegative()}),yf=U({id:Fl(),text:R().min(1)});du(`type`,[U({type:G(`turn`),job:cf}),U({type:G(`land`),request:R().min(1),land:uf}),U({type:G(`models`),request:R().min(1),cli:X}),U({type:G(`file`),request:R().min(1),read:mf}),U({type:G(`changes`),request:R().min(1),read:_f}),U({type:G(`steer`),request:R().min(1),turnId:q,steer:yf}),U({type:G(`stop`),request:R().min(1),turnId:q})]),du(`ok`,[U({ok:G(!0),value:ru()}),U({ok:G(!1),error:R()})]),U({warm:H(R())}),U({files:hu(R(),R())}),U({paths:H(R())}),U({files:hu(R(),R())});var bf=U({kind:W([`mention`,`stage`,`task_done`,`proposal_decided`,`heartbeat`,`reflection`,`onboarding`,`manual`,`ops_event`,`user_post`]),from:K.optional(),fromUser:V().default(!1),reason:R().default(``),taskId:q.optional(),messageId:q.optional(),channel:J.optional()});U({agent:K,project:K,thread:U({id:q,task:V()}).optional(),trigger:bf,priority:B().int().min(0).max(2),onboarding:V().default(!1)});function xf(e,t,n){return n===void 0?`${e}/${t}`:`${e}/${t}/${n}`}function Sf(e){let[t,n,r,i]=e.split(`/`);return t===void 0||n===void 0||i!==void 0?null:r===void 0?{agent:t,scope:n}:{agent:t,scope:n,thread:r}}U({id:q.optional(),agent:K,project:K,thread:q.optional(),runner:K,cli:X.nullable(),session:R().nullable(),trigger:bf,startedAt:Y,endedAt:Y.nullable(),exitReason:ef.nullable(),status:$d.nullable(),error:R().nullable(),usage:Qd.nullable(),costUsd:B().nonnegative().default(0),sessionCostUsd:B().nonnegative().optional(),toolCalls:B().int().nonnegative().default(0),model:R().nullable().default(null),work:lf.optional(),stoppedBy:K.optional()});var Cf=U({turnId:q,agent:K,scope:K,thread:q.optional(),cli:X,channel:J.optional(),steerable:V(),stoppable:V()});U({claude:R().optional(),codex:R().optional(),runner:K.optional()}),U({agent:K,project:K,reason:R().default(`manual wake`),kind:W([`manual`,`reflection`]).default(`manual`)});var wf=U({id:q,turnId:q.optional(),ts:Y,outcome:W([`completed`,`failed`]),project:K,thread:q.optional(),trigger:R(),exitReason:R().nullable(),costUsd:B(),model:R().nullable(),summary:R().nullable(),error:R().nullable(),startedAt:Y.optional(),toolCalls:B().int().nonnegative().optional()}),Tf=W([`waiting_stage`,`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`turn_cost`,`scaled`,`runner`,`home_conflict`]),Ef=[`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`scaled`],Df=U({kind:Tf,key:R().min(1),summary:R().min(1),value:B(),threshold:B().optional(),project:K.optional(),agent:K.optional(),role:K.optional(),taskId:q.optional()}),Of=W([`24h`,`7d`,`all`]),Z=B().int().nonnegative(),kf=B().nonnegative(),Af=U({window:Of,since:Y.nullable(),until:Y,idle:U({turns:Z,idle:Z,unknown:Z,byTrigger:H(U({trigger:R(),turns:Z,idle:Z})),byAgent:H(U({agent:K,role:K.nullable(),turns:Z,idle:Z}))}),sentBack:U({finished:Z,sendBacks:Z,tasksSentBack:Z,byStage:H(U({project:K,stage:R(),count:Z})),bySender:H(U({agent:K,count:Z}))}),messages:U({finished:Z,messages:Z,byProject:H(U({project:K,finished:Z,messages:Z})),busiest:H(U({taskId:q,title:R(),project:K,messages:Z}))}),latency:U({mentions:Z,unanswered:Z,medianMs:kf.nullable(),slowestMs:kf.nullable(),byAgent:H(U({agent:K,mentions:Z,medianMs:kf,slowestMs:kf}))}),decisions:U({total:Z,byDay:H(U({day:R(),proposals:Z,answers:Z,stages:Z}))}),blocked:H(U({taskId:q,title:R().nullable(),project:K.nullable(),summary:R(),firstAt:Y,lastAt:Y,holds:V()}))}),jf=W([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]),Mf=U({clientId:R().min(1),clientSecret:R().min(1),users:H(R().min(1)).min(1)});U({dataDir:R().min(1),host:R().min(1),port:B().int().positive().max(65535),publicUrl:R().min(1).nullable(),logLevel:jf,concurrency:B().int().positive().nullable(),turnTimeoutMs:B().int().positive().nullable(),toolRounds:B().int().positive().nullable(),residentIdleMs:B().int().positive(),github:Mf.nullable(),trustedProxies:B().int().min(0).max(16)}),U({serverUrl:R().url(),token:R().min(1).nullable(),dataDir:R().min(1),logLevel:jf,slots:B().int().positive().nullable(),clis:H(X).min(1),capabilities:H(R())});var Nf=`stellaris.token`;function Pf(){return localStorage.getItem(Nf)}function Ff(e){localStorage.setItem(Nf,e)}function If(){localStorage.removeItem(Nf)}var Lf=U({github:V()});async function Rf(){try{let e=Lf.safeParse(await(await fetch(`/auth/config`)).json());return e.success?e.data:{github:!1}}catch{return{github:!1}}}var zf=class extends Error{status;constructor(e,t){super(t),this.status=e}},Bf=U({name:K,role:K}),Vf=kd.extend({profile:R()}).array(),Hf=U({paused:V(),running:H(R()),pending:H(R()),resident:H(R()),signals:H(R()),turns:H(Cf).default([])});function Uf(e){return e.flatMap(e=>{let t=Sf(e);return t===null?[]:[t]})}var Wf=gd.extend({body:R()}),Gf=Wf.array(),Kf=U({ref:J,project:K.nullable(),name:K,messages:B().int(),lastMessageId:q.nullable(),lastAt:R().nullable()}),qf=bd.extend({body:R()}),Jf=qf.extend({messages:B().int(),lastMessageId:q.nullable(),lastAuthor:K.nullable().default(null)}),Yf=U({thread:qf,messages:Gf}),Xf=U({message:Wf,thread:qf.nullable()}),Zf=Cd.extend({body:R()}),Qf=Yd.extend({body:R()}),$f=Jd.extend({body:R()}),ep=U({body:R()}),tp=U({data:hu(R(),ru()),body:R()});function np(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}var rp=U({message:R()});async function Q(e,t,n){let r;try{r=await fetch(e,{headers:{authorization:`Bearer ${t}`}})}catch{throw new zf(0,`The board server is not reachable.`)}if(!r.ok){let t=rp.safeParse(await r.json().catch(()=>null));throw new zf(r.status,t.success?t.data.message:`${e} answered ${r.status}`)}return n.parse(await r.json())}async function ip(e,t,n,r,i){let a;try{a=await fetch(t,{method:e,headers:{authorization:`Bearer ${n}`,"content-type":`application/json`},body:JSON.stringify(r)})}catch{throw new zf(0,`The board server is not reachable.`)}if(!a.ok){let e=rp.safeParse(await a.json().catch(()=>null));throw new zf(a.status,e.success?e.data.message:`${t} answered ${a.status}`)}return i.parse(await a.json())}function ap(e,t,n,r){return ip(`POST`,`/api/verbs/${e}`,t,n,r)}var op=U({paused:V()}),sp=U({id:q,ts:R(),signal:Df}),cp=Od.omit({tokenHash:!0}),lp=U({signedOut:V()}),up=U({denied:V()}),dp=U({stopped:V()});function fp(e){return{me:()=>Q(`/api/me`,e,Bf),signOut:()=>ip(`DELETE`,`/api/sign-in`,e,{},lp),society:()=>Q(`/api/society`,e,ad),members:()=>Q(`/api/members`,e,Vf),projects:()=>Q(`/api/projects`,e,pd.array()),roles:()=>Q(`/api/roles`,e,Ju.array()),scheduler:()=>Q(`/api/scheduler`,e,Hf),signals:t=>Q(`/api/signals?limit=${t}`,e,sp.array()),metrics:t=>Q(`/api/metrics?window=${t}`,e,Af),channels:()=>Q(`/api/channels`,e,Kf.array()),channel:t=>Q(`/api/channels/${np(t)}`,e,Gf),threads:()=>Q(`/api/threads`,e,Jf.array()),requests:()=>Q(`/api/requests`,e,Xf.array()),thread:t=>Q(`/api/threads/${encodeURIComponent(t)}`,e,Yf),tasks:t=>Q(`/api/projects/${encodeURIComponent(t)}/tasks`,e,Zf.array()),task:t=>Q(`/api/tasks/${encodeURIComponent(t)}`,e,Zf),taskFile:(t,n)=>Q(`/api/tasks/${encodeURIComponent(t)}/files${n.split(`/`).filter(e=>e!==``).map(e=>`/${encodeURIComponent(e)}`).join(``)}`,e,gf),taskChanges:t=>Q(`/api/tasks/${encodeURIComponent(t)}/changes`,e,vf),proposals:()=>Q(`/api/proposals`,e,Qf.array()),proposal:t=>Q(`/api/proposals/${encodeURIComponent(t)}`,e,Qf),skills:()=>Q(`/api/skills`,e,Hd.array()),turns:(t,n)=>Q(`/api/agents/${encodeURIComponent(t)}/turns?limit=${n}`,e,wf.array()),transcript:(t,n)=>Q(`/api/agents/${encodeURIComponent(t)}/turns/${encodeURIComponent(n)}`,e,nf.array()),memory:t=>Q(`/api/agents/${encodeURIComponent(t)}/memory`,e,ep),agentSkills:t=>Q(`/api/agents/${encodeURIComponent(t)}/skills`,e,Hd.array()),history:(t,n)=>Q(`/api/agents/${encodeURIComponent(t)}/history?limit=${n}`,e,Kd),change:(t,n)=>Q(`/api/agents/${encodeURIComponent(t)}/history/${encodeURIComponent(n)}`,e,qd.array()),conflicts:t=>Q(`/api/agents/${encodeURIComponent(t)}/conflicts`,e,Ud.array()),dashboard:t=>Q(`/api/projects/${encodeURIComponent(t)}/dashboard`,e,tp),knowledge:t=>Q(t===`society`?`/api/society/knowledge`:`/api/projects/${encodeURIComponent(t)}/knowledge`,e,$f.array()),sendMessage:t=>ap(`post_message`,e,t,Wf),openThread:t=>ap(`open_thread`,e,t,qf),closeThread:t=>ap(`close_thread`,e,t,Wf),approve:t=>ap(`approve`,e,t,Xd),reject:t=>ap(`reject`,e,t,Xd),wake:t=>ip(`POST`,`/api/wake`,e,t,Zd),setPaused:t=>ip(`POST`,t?`/api/pause`:`/api/resume`,e,{},op),stopTurn:t=>ip(`POST`,`/api/turns/${encodeURIComponent(t)}/stop`,e,{},dp),models:t=>Q(`/api/models/${t}`,e,Ed.array()),runners:()=>Q(`/api/runners`,e,jd.array()),enrollments:()=>Q(`/api/enrollments`,e,af.array()),approveEnrollment:(t,n)=>ip(`POST`,`/api/enrollments/${encodeURIComponent(t)}/approve`,e,{name:n},jd),denyEnrollment:t=>ip(`POST`,`/api/enrollments/${encodeURIComponent(t)}/deny`,e,{},up),setRunner:(t,n)=>ip(`PUT`,`/api/agents/${encodeURIComponent(t)}/runner`,e,{runner:n},cp),setModel:(t,n)=>ip(`PUT`,`/api/agents/${encodeURIComponent(t)}/model`,e,{model:n},cp)}}var pp=(0,m.createContext)(null);function $(){let e=(0,m.useContext)(pp);if(e===null)throw Error(`useSession needs a signed-in SessionContext`);return e}function mp(){let{api:e}=$();return T({queryKey:[`society`],queryFn:e.society,staleTime:6e4})}function hp(){let{api:e}=$();return T({queryKey:[`members`],queryFn:e.members,refetchInterval:3e4})}function gp(){let{api:e}=$();return T({queryKey:[`projects`],queryFn:e.projects,refetchInterval:6e4})}function _p(){let{api:e}=$();return T({queryKey:[`roles`],queryFn:e.roles,refetchInterval:6e4})}function vp(){let{api:e}=$();return T({queryKey:[`scheduler`],queryFn:e.scheduler,refetchInterval:3e3})}function yp(){let{api:e}=$();return T({queryKey:[`requests`],queryFn:e.requests,refetchInterval:6e4})}function bp(e){let{api:t}=$();return T({queryKey:[`signals`],queryFn:()=>t.signals(200),enabled:e,refetchInterval:6e4})}function xp(e){let{api:t}=$();return T({queryKey:[`metrics`,e],queryFn:()=>t.metrics(e),refetchInterval:6e4})}function Sp(){let{api:e}=$();return T({queryKey:[`channels`],queryFn:e.channels,refetchInterval:6e4})}function Cp(){let{api:e}=$();return T({queryKey:[`threads`],queryFn:e.threads,refetchInterval:6e4})}function wp(e){let{api:t}=$();return T({queryKey:[`tasks`,e],queryFn:()=>t.tasks(e),refetchInterval:6e4})}function Tp(e){return e.flatMap(e=>e.data??[])}function Ep(){let{api:e}=$();return ct({queries:(gp().data??[]).map(t=>({queryKey:[`tasks`,t.slug],queryFn:()=>e.tasks(t.slug),refetchInterval:6e4})),combine:Tp})}function Dp(e){let{api:t}=$();return T({queryKey:[`task`,e],queryFn:()=>t.task(e??``),enabled:e!==null})}function Op(e,t){let{api:n}=$();return T({queryKey:[`task-file`,e,t],queryFn:()=>n.taskFile(e,t),staleTime:3e4,retry:(e,t)=>e<1&&!(t instanceof zf&&(t.status===404||t.status===503))})}function kp(e){let{api:t}=$();return T({queryKey:[`task-changes`,e],queryFn:()=>t.taskChanges(e),staleTime:3e4,retry:(e,t)=>e<1&&!(t instanceof zf&&(t.status===404||t.status===503))})}function Ap(){let{api:e}=$();return T({queryKey:[`proposals`],queryFn:e.proposals,refetchInterval:6e4})}function jp(e){let{api:t}=$();return T({queryKey:[`proposal`,e],queryFn:()=>t.proposal(e)})}function Mp(){let{api:e}=$();return T({queryKey:[`skills`],queryFn:e.skills,staleTime:6e4})}function Np(e,t){let{api:n}=$();return T({queryKey:[`turns`,e,t],queryFn:()=>n.turns(e,t),refetchInterval:6e4})}function Pp(e,t){let{api:n}=$();return T({queryKey:[`transcript`,e,t],queryFn:()=>n.transcript(e,t??``),enabled:t!==null,staleTime:1/0})}function Fp(e){let{api:t}=$();return T({queryKey:[`memory`,e],queryFn:()=>t.memory(e)})}function Ip(e){let{api:t}=$();return T({queryKey:[`agent-skills`,e],queryFn:()=>t.agentSkills(e)})}function Lp(e,t){let{api:n}=$();return T({queryKey:[`history`,e,t],queryFn:()=>n.history(e,t),placeholderData:ge})}function Rp(e,t,n){let{api:r}=$();return T({queryKey:[`home-change`,e,t],queryFn:()=>r.change(e,t),enabled:n,staleTime:1/0})}function zp(e){let{api:t}=$();return T({queryKey:[`conflicts`,e],queryFn:()=>t.conflicts(e)})}function Bp(e){let{api:t}=$();return T({queryKey:[`dashboard`,e],queryFn:()=>t.dashboard(e),refetchInterval:6e4})}function Vp(e){let{api:t}=$();return T({queryKey:[`knowledge`,e],queryFn:()=>t.knowledge(e),refetchInterval:12e4})}function Hp(){let{api:e}=$();return T({queryKey:[`runners`],queryFn:()=>e.runners(),refetchInterval:6e4})}function Up(){let{api:e}=$();return T({queryKey:[`enrollments`],queryFn:e.enrollments,refetchInterval:5e3})}function Wp(e){let{api:t}=$();return T({queryKey:[`models`,e],queryFn:()=>t.models(e??`claude`),enabled:e!==null,staleTime:6e5,retry:!1})}function Gp(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Kp=[[`day`,86400],[`hour`,3600],[`minute`,60]],qp=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});function Jp(e,t){let n=Math.round((Date.parse(e)-t)/1e3);for(let[e,t]of Kp)if(Math.abs(n)>=t)return qp.format(Math.round(n/t),e);return`just now`}function Yp(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function Xp(e,t=220){let n=(e.split(/\n\s*\n/).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith(`#`))??``).replaceAll(/[*_`>]/g,``).replaceAll(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}export{Fd as $,Ae as $t,Dp as A,Nt as At,fp as B,wt as Bt,_p as C,qt as Ct,bp as D,It as Dt,$ as E,At as Et,Pp as F,mt as Ft,Ef as G,ut as Gt,Ff as H,ft as Ht,Np as I,Dt as It,df as J,gt as Jt,Sf as K,ht as Kt,zf as L,vt as Lt,Op as M,Mt,wp as N,Ct as Nt,Mp as O,zt as Ot,Cp as P,kt as Pt,Rd as Q,Pe as Qt,Rf as R,Ot as Rt,yp as S,$t as St,vp as T,Ut as Tt,Pf as U,Et as Ut,Uf as V,pt as Vt,Of as W,yt as Wt,rf as X,ze as Xt,Zd as Y,T as Yt,nd as Z,Fe as Zt,Wp as _,d as _n,V as _t,Ip as a,le as an,zd as at,jp as b,l as bn,R as bt,Bp as c,ae as cn,hd as ct,zp as d,S as dn,Ju as dt,ke as en,Pd as et,Lp as f,xe as fn,Xu as ft,xp as g,p as gn,H as gt,Fp as h,g as hn,Wu as ht,pp as i,ue as in,rd as it,kp as j,jt,mp as k,Ft as kt,Up as l,de as ln,wd as lt,hp as m,te as mn,Gu as mt,Xp as n,Te as nn,Id as nt,Ep as o,b as on,Td as ot,Vp as p,ye as pn,Yu as pt,xf as q,Tt as qt,Yp as r,oe as rn,Ld as rt,Sp as s,ce as sn,Vd as st,Jp as t,Ee as tn,Bd as tt,Rp as u,y as un,id as ut,Gp as v,o as vn,U as vt,Hp as w,Kt as wt,Ap as x,gn as xt,gp as y,s as yn,hu as yt,If as z,dt as zt};
55
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function mc(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;mc(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var hc=new Set([`type`,`properties`,`required`,`additionalProperties`]),gc=[`oneOf`,`anyOf`];function _c(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function vc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!hc.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??_c(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}En(n,r,e.length===1?e[0]:vc(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=_c(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function yc(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of hc)if(t in e)return;let n=t.filter(e=>gc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=vc(t);else{let e=n[0],i=gc.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>vc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,lc(e,r))}function bc(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):lc(i,s),lc(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())mc(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])yc(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}lc(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,En(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:Sc(t,`input`,e.processors),output:Sc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function P(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return P(r.element,n);if(r.type===`set`)return P(r.valueType,n);if(r.type===`lazy`)return P(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`||r.type===`catch`)return P(r.innerType,n);if(r.type===`intersection`)return P(r.left,n)||P(r.right,n);if(r.type===`record`||r.type===`map`)return P(r.keyType,n)||P(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:P(r.in,n)||P(r.out,n);if(r.type===`object`){for(let e in r.shape)if(P(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(P(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(P(e,n))return!0;return!!(r.rest&&P(r.rest,n))}return!1}var xc=(e,t={})=>n=>{let r=uc({...n,processors:t});return N(e,r),pc(r,e),bc(r,e)},Sc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=uc({...i??{},target:a,io:t,processors:n});return N(e,o),pc(o,e),bc(o,e)},Cc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},wc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Tc=(e,t)=>{Cc(e,`minimum`,t),wc(e,`maximum`,t)},Ec=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Dc=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Oc=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},kc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Ac=(e,t)=>Cc(e,`minimum`,t.minimum),jc=(e,t)=>wc(e,`maximum`,t.maximum),Mc=e=>(t,n)=>{kc(t,n.format);let[r,i]=e[n.format];Cc(t,`minimum`,r),wc(t,`maximum`,i)},Nc={greater_than:(e,t)=>Cc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>wc(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>Ec(e,t.value),number_format:Mc(Gn),bigint_format:Mc(Kn),min_length:Ac,max_length:jc,length_equals:(e,t)=>Tc(e,t.length),min_size:Ac,max_size:jc,size_equals:(e,t)=>Tc(e,t.size),string_format:(e,t)=>{kc(e,t.format),t.pattern&&Dc(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>Oc(e,t.mime)};function F(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)Nc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Cc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Cc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&wc(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&wc(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&Ec(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Oc(t,i.mime);for(let e of i.patterns??[])Dc(t,e);return t}var Pc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Fc=new Map([[Ba,Ti],[Ha,Ei]]),Ic=e=>Fc.get(e)??e,Lc=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=F(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Pc[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Ic);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Rc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=F(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):dc(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},zc=(e,t,n,r)=>{n.type=`boolean`},Bc=(e,t,n,r)=>{n.not={}},Vc=(e,t,n,r)=>{let i=e._zod.def,a=vn(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Hc=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if(dc(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(dc(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Uc=(e,t,n,r)=>{dc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Wc=(e,t,n,r)=>{dc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Gc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=F(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=N(a.element,t,{...r,path:[...r.path,`items`]})};function Kc(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Kc(t.out):t.type===`catch`?Kc(t.innerType):e._zod.optin}var qc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&dc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)En(i.properties,e,N(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Kc(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=N(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Jc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>N(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Yc=(e,t,n,r)=>{let i=e._zod.def,a=N(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=N(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Xc(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Xc(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Xc(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?Li:Ii).source),p):p}var Zc=new WeakMap;function Qc(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Zc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Xc(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var $c=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=F(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=N(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)En(i.patternProperties,Ic(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=N(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Zc.get(t);n||(n=[],Zc.set(t,n),t.deferred.push(()=>Qc(t))),n.push(e)}i.additionalProperties=N(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Kc(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},el=(e,t,n,r)=>{let i=e._zod.def,a=N(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},tl=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},nl=Symbol();function rl(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(dc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),nl):JSON.parse(o)}var il=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=rl(i.defaultValue,e,t,n,r);o!==nl&&(n.default=o)},al=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=rl(i.defaultValue,e,t,n,r);o!==nl&&(n._prefault=o)},ol=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{dc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},sl=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;N(o,t,r);let s=t.seen.get(e);s.ref=o},cl=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ll=(e,t,n,r)=>{let i=e._zod.def;N(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ul=new WeakSet([Object.prototype,Error.prototype]);function dl(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var I=k(`ZodError`,(e,t)=>{zr.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ul.has(n)||(ul.add(n),dl(n,`format`,e=>t=>Hr(e,t)),dl(n,`flatten`,e=>t=>Vr(e,t)),dl(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,bn,2)}),dl(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,bn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),fl=Wr(I),pl=Gr(I),ml=Kr(I),hl=Jr(I),gl=ei(I),_l=ti(I),vl=ni(I),yl=ri(I),bl=ii(I),xl=ai(I),Sl=oi(I),Cl=si(I);function wl(){jr.localeError||Mr(ts())}function Tl(){jr.memoizer||Mr({memoizer:Qo()})}var L=k(`ZodType`,(e,t)=>(wl(),j.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(E(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Hn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Vu(e,t))},superRefine(e,t){return this.check(Hu(e,t))},overwrite(e){return this.check($s(e))},optional(){return Su(this)},exactOptional(){return wu(this)},nullable(){return Eu(this)},nullish(){return Su(Eu(this))},nonoptional(e){return Mu(this,e)},array(){return H(this)},or(e){return uu([this,e])},and(e){return mu(this,e)},transform(e){return Iu(this,bu(e))},default(e){return Ou(this,e)},prefault(e){return Au(this,e)},catch(e){return Pu(this,e)},pipe(e){return Iu(this,e)},readonly(){return zu(this)},describe(e){let t=this.clone();return as.add(t,{description:e}),t},meta(...e){if(e.length===0)return as.get(this);let t=this.clone();return as.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return hr(this,`~standard`,{...ca(this),jsonSchema:{input:Sc(this,`input`),output:Sc(this,`output`)}})},set"~standard"(e){mr(this,`~standard`,e)},parse:function e(t,n){return fl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await pl(this,t,n,{callee:e})},safeParse(e,t){return ml(this,e,t)},async safeParseAsync(e,t){return hl(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){mr(this,`spa`,e)},validate(e,t){return Zr(this,e,t)},validateAsync(e,t){return $r(this,e,t)},encode:function e(t,n){return gl(this,t,n,{callee:e})},decode:function e(t,n){return _l(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await vl(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await yl(this,t,n,{callee:e})},safeEncode(e,t){return bl(this,e,t)},safeDecode(e,t){return xl(this,e,t)},async safeEncodeAsync(e,t){return Sl(this,e,t)},async safeDecodeAsync(e,t){return Cl(this,e,t)},toJSONSchema(e){return xc(this,{})(e)},get description(){return as.get(this)?.description},get _def(){return this._zod.def}}),El=k(`_ZodString`,(e,t)=>{la.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r)},gr({format:e=>F(e).format??null,minLength:e=>F(e).minimum??null,maxLength:e=>F(e).maximum??null},{regex(...e){return this.check(qs(...e))},includes(...e){return this.check(Xs(...e))},startsWith(...e){return this.check(Zs(...e))},endsWith(...e){return this.check(Qs(...e))},min(...e){return this.check(Gs(...e))},max(...e){return this.check(Ws(...e))},length(...e){return this.check(Ks(...e))},nonempty(...e){return this.check(Gs(1,...e))},lowercase(e){return this.check(Js(e))},uppercase(e){return this.check(Ys(e))},trim(){return this.check(tc())},normalize(...e){return this.check(ec(...e))},toLowerCase(){return this.check(nc())},toUpperCase(){return this.check(rc())},slugify(){return this.check(ic())}})),Dl=k(`ZodString`,(e,t)=>{la.init(e,t),El.init(e,t)},{email(e){return this.check(cs(Ml,e))},url(e){return this.check(ms(Il,e))},jwt(e){return this.check(ks(Ql,e))},emoji(e){return this.check(hs(Rl,e))},guid(e){return this.check(ls(Nl,e))},uuid(e){return this.check(us(Pl,e))},uuidv4(e){return this.check(ds(Pl,e))},uuidv6(e){return this.check(fs(Pl,e))},uuidv7(e){return this.check(ps(Pl,e))},nanoid(e){return this.check(gs(zl,e))},cuid(e){return this.check(_s(Bl,e))},cuid2(e){return this.check(vs(Vl,e))},ulid(e){return this.check(ys(Hl,e))},base64(e){return this.check(Es(Yl,e))},base64url(e){return this.check(Ds(Xl,e))},xid(e){return this.check(bs(Ul,e))},ksuid(e){return this.check(xs(Wl,e))},ipv4(e){return this.check(Ss(Gl,e))},ipv6(e){return this.check(Cs(Kl,e))},cidrv4(e){return this.check(ws(ql,e))},cidrv6(e){return this.check(Ts(Jl,e))},e164(e){return this.check(Os(Zl,e))},datetime(e){return this.check(As(Ol,e))},date(e){return this.check(js(kl,e))},time(e){return this.check(Ms(Al,e))},duration(e){return this.check(Ns(jl,e))}});function R(e){return ss(Dl,e)}var z=k(`ZodStringFormat`,(e,t)=>{M.init(e,t),El.init(e,t)}),Ol=k(`ZodISODateTime`,(e,t)=>{Oa.init(e,t),z.init(e,t)}),kl=k(`ZodISODate`,(e,t)=>{ka.init(e,t),z.init(e,t)}),Al=k(`ZodISOTime`,(e,t)=>{Aa.init(e,t),z.init(e,t)}),jl=k(`ZodISODuration`,(e,t)=>{ja.init(e,t),z.init(e,t)}),Ml=k(`ZodEmail`,(e,t)=>{fa.init(e,t),z.init(e,t)}),Nl=k(`ZodGUID`,(e,t)=>{ua.init(e,t),z.init(e,t)}),Pl=k(`ZodUUID`,(e,t)=>{da.init(e,t),z.init(e,t)});function Fl(e){return us(Pl,e)}var Il=k(`ZodURL`,(e,t)=>{ba.init(e,t),z.init(e,t)});function Ll(e){return ms(Il,e)}var Rl=k(`ZodEmoji`,(e,t)=>{xa.init(e,t),z.init(e,t)}),zl=k(`ZodNanoID`,(e,t)=>{Sa.init(e,t),z.init(e,t)}),Bl=k(`ZodCUID`,(e,t)=>{Ca.init(e,t),z.init(e,t)}),Vl=k(`ZodCUID2`,(e,t)=>{wa.init(e,t),z.init(e,t)}),Hl=k(`ZodULID`,(e,t)=>{Ta.init(e,t),z.init(e,t)}),Ul=k(`ZodXID`,(e,t)=>{Ea.init(e,t),z.init(e,t)}),Wl=k(`ZodKSUID`,(e,t)=>{Da.init(e,t),z.init(e,t)}),Gl=k(`ZodIPv4`,(e,t)=>{Ma.init(e,t),z.init(e,t)}),Kl=k(`ZodIPv6`,(e,t)=>{Fa.init(e,t),z.init(e,t)}),ql=k(`ZodCIDRv4`,(e,t)=>{Ia.init(e,t),z.init(e,t)}),Jl=k(`ZodCIDRv6`,(e,t)=>{Ra.init(e,t),z.init(e,t)}),Yl=k(`ZodBase64`,(e,t)=>{Va.init(e,t),z.init(e,t)}),Xl=k(`ZodBase64URL`,(e,t)=>{Wa.init(e,t),z.init(e,t)}),Zl=k(`ZodE164`,(e,t)=>{Ga.init(e,t),z.init(e,t)}),Ql=k(`ZodJWT`,(e,t)=>{qa.init(e,t),z.init(e,t)}),$l=k(`ZodNumber`,(e,t)=>{Ja.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r),e.isFinite=!0},gr({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=F(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=F(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=F(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>F(e).format??null},{gt(e,t){return this.check(Vs(e,t))},gte(e,t){return this.check(Hs(e,t))},min(e,t){return this.check(Hs(e,t))},lt(e,t){return this.check(zs(e,t))},lte(e,t){return this.check(Bs(e,t))},max(e,t){return this.check(Bs(e,t))},int(e){return this.check(tu(e))},safe(e){return this.check(tu(e))},positive(e){return this.check(Vs(0,e))},nonnegative(e){return this.check(Hs(0,e))},negative(e){return this.check(zs(0,e))},nonpositive(e){return this.check(Bs(0,e))},multipleOf(e,t){return this.check(Us(e,t))},step(e,t){return this.check(Us(e,t))},finite(){return this}}));function B(e){return Ps($l,e)}var eu=k(`ZodNumberFormat`,(e,t)=>{Ya.init(e,t),$l.init(e,t)});function tu(e){return Fs(eu,e)}var nu=k(`ZodBoolean`,(e,t)=>{Xa.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zc(e,t,n,r)});function V(e){return Is(nu,e)}var ru=k(`ZodUnknown`,(e,t)=>{Za.init(e,t),L.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function iu(){return Ls(ru)}var au=k(`ZodNever`,(e,t)=>{Qa.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(e,t,n,r)});function ou(e){return Rs(au,e)}var su=k(`ZodArray`,(e,t)=>{Tl(),eo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Gs(e,t))},nonempty(e){return this.check(Gs(1,e))},max(e,t){return this.check(Ws(e,t))},length(e,t){return this.check(Ks(e,t))},unwrap(){return this.element}});function H(e,t){return ac(su,e,t)}var cu=k(`ZodObject`,(e,t)=>{Tl(),oo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qc(e,t,n,r),Sr(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return W(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(E(this._zod.def,{catchall:e}))},passthrough(){return this.clone(E(this._zod.def,{catchall:iu()}))},loose(){return this.clone(E(this._zod.def,{catchall:iu()}))},strict(){return this.clone(E(this._zod.def,{catchall:ou()}))},strip(){return this.clone(E(this._zod.def,{catchall:void 0}))},extend(e){return Xn(this,e)},safeExtend(e){return Qn(this,e)},merge(e){return $n(this,e)},pick(e){return qn(this,e)},omit(e){return Yn(this,e)},partial(...e){return er(xu,this,e[0])},exactPartial(...e){return er(Cu,this,e[0],`exactPartial`)},required(...e){return tr(ju,this,e[0])}});function U(e,t){return new cu({type:`object`,shape:e??{},...D(t)})}var lu=k(`ZodUnion`,(e,t)=>{co.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jc(e,t,n,r),e.options=t.options});function uu(e,t){return new lu({type:`union`,options:e,...D(t)})}var du=k(`ZodDiscriminatedUnion`,(e,t)=>{lu.init(e,t),uo.init(e,t)});function fu(e,t,n){return new du({type:`union`,options:t,discriminator:e,...D(n)})}var pu=k(`ZodIntersection`,(e,t)=>{fo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yc(e,t,n,r)});function mu(e,t){return new pu({type:`intersection`,left:e,right:t})}var hu=k(`ZodRecord`,(e,t)=>{Tl(),ho.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function gu(e,t,n){return!t||!t._zod?new hu({type:`record`,keyType:R(),valueType:e,...D(t)}):new hu({type:`record`,keyType:e,valueType:t,...D(n)})}var _u=k(`ZodEnum`,(e,t)=>{go.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new _u({...t,checks:[],...D(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new _u({...t,checks:[],...D(r),entries:i})}});function W(e,t){return new _u({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...D(t)})}var vu=k(`ZodLiteral`,(e,t)=>{_o.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function G(e,t){return new vu({type:`literal`,values:Array.isArray(e)?e:[e],...D(t)})}var yu=k(`ZodTransform`,(e,t)=>{Tl(),vo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ar(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(fr(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(fr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function bu(e){return new yu({type:`transform`,transform:e})}var xu=k(`ZodOptional`,(e,t)=>{bo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ll(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Su(e){return new xu({type:`optional`,innerType:e})}var Cu=k(`ZodExactOptional`,(e,t)=>{xo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ll(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wu(e){return new Cu({type:`optional`,innerType:e})}var Tu=k(`ZodNullable`,(e,t)=>{So.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>el(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Eu(e){return new Tu({type:`nullable`,innerType:e})}var Du=k(`ZodDefault`,(e,t)=>{Co.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>il(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ou(e,t){return new Du({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():zn(t)}})}var ku=k(`ZodPrefault`,(e,t)=>{To.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Au(e,t){return new ku({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():zn(t)}})}var ju=k(`ZodNonOptional`,(e,t)=>{Eo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mu(e,t){return new ju({type:`nonoptional`,innerType:e,...D(t)})}var Nu=k(`ZodCatch`,(e,t)=>{ko.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ol(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Pu(e,t){return new Nu({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:wr(t)})}var Fu=k(`ZodPipe`,(e,t)=>{Ao.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sl(e,t,n,r),e.in=t.in,e.out=t.out});function Iu(e,t){return new Fu({type:`pipe`,in:e,out:t})}var Lu=k(`ZodPreprocess`,(e,t)=>{Fu.init(e,t),Mo.init(e,t)}),Ru=k(`ZodReadonly`,(e,t)=>{No.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zu(e){return new Ru({type:`readonly`,innerType:e})}var Bu=k(`ZodCustom`,(e,t)=>{Fo.init(e,t),L.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r)});function Vu(e,t={}){return oc(Bu,e,t)}function Hu(e,t){return sc(e,t)}function Uu(e,t){return new Lu({type:`pipe`,in:bu(e),out:t})}function Wu(e){return As(Ol,e)}var K=R().regex(/^[a-z0-9][a-z0-9-]{0,31}$/,`expected 1-32 lowercase letters, digits, or hyphens, starting with a letter or digit`),q=R().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`expected a ULID`),J=R().regex(/^(?:[a-z0-9][a-z0-9-]{0,31}\/)?[a-z0-9][a-z0-9-]{0,31}$/,`expected <channel> or <project>/<channel>`);function Gu(e){let t=e.indexOf(`/`);return t===-1?{project:null,channel:e}:{project:e.slice(0,t),channel:e.slice(t+1)}}function Ku(e,t){return e===null?t:`${e}/${t}`}var Y=Uu(e=>e instanceof Date?e.toISOString():e,Wu()),qu=W([`post_message`,`read_inbox`,`search`,`open_thread`,`close_thread`,`create_task`,`claim_task`,`release_task`,`update_task`,`get_task`,`subscribe`,`unsubscribe`,`propose`,`approve`,`reject`,`create_project`,`join_project`,`leave_project`,`write_knowledge`,`plan_task`,`advance_task`,`configure_project`,`archive_project`]),Ju=W([`user_post`,`ops_event`,`heartbeat`]),Yu=U({name:K,purpose:R().min(1),verbs:H(qu),wakeTriggers:H(Ju).default([`heartbeat`]),reviewDate:R().optional(),maxReplicas:B().int().min(1).default(1),backlogThreshold:B().positive().default(3),resident:V().default(!1),societyScope:V().default(!1),reflects:V().default(!0)}),Xu=`user`,Zu=`user`,Qu=[`post_message`,`read_inbox`,`search`,`open_thread`,`close_thread`,`create_task`,`claim_task`,`release_task`,`update_task`,`get_task`,`subscribe`,`unsubscribe`,`propose`,`join_project`,`leave_project`,`write_knowledge`,`plan_task`,`advance_task`],$u=[`approve`,`reject`],ed=[`create_project`],td=[`configure_project`],nd=[`archive_project`];[...Qu,...$u,...ed,...td,...nd],[...Qu,...$u,...td],[...Qu,...ed,...td];var rd=`asks`,id=`society`;function ad(e,t){return t!==null&&e.memberships.includes(t)?t:id}var X=W([`claude`,`codex`]),od=U({name:R().min(1),version:G(1),createdAt:Y,channels:H(K)}),sd=W([`none`,`merge`]),cd=R().regex(/^s[1-9][0-9]*$/,`expected a stage id such as s1`),ld={name:R().trim().min(1).max(120),role:K.optional(),agent:K.optional(),gate:V().default(!1)};function ud(e){return e.role===void 0||e.agent===void 0}var dd={message:`a stage names a role or an agent, not both`},fd=U(ld).refine(ud,dd),pd=U({id:cd.optional(),...ld}).refine(ud,dd),md=U({slug:K,name:R().min(1),repo:R().nullable(),defaultBranch:R().min(1),channels:H(K),members:H(K),approvers:H(K),requiredCapabilities:H(R()),createdAt:Y,onDone:sd.default(`none`),runner:K.optional(),archived:U({at:Y,by:K,reason:R().min(1)}).optional()}),hd=uu([U({action:W([`advanced`,`returned`,`abandoned`,`landed`,`reopened`]),stage:cd,to:cd.nullable()}),U({action:W([`approved`,`rejected`])})]);function gd(e){return`stage`in e}var _d=U({id:q,author:K,channel:J,thread:q.optional(),task:q.optional(),closes:q.optional(),step:hd.optional(),ts:Y,mentions:H(K)}),vd=W([`open`,`claimed`,`done`,`abandoned`]),yd=W([`open`,`closed`]),bd=U({kind:W([`task`,`proposal`]),id:q}),xd=U({id:q,channel:J,title:R().min(1).max(200),subject:bd.optional(),state:yd,openedBy:K,openedAt:Y,closedBy:K.optional(),closedAt:Y.optional()}),Sd=U({id:cd,name:R().min(1),role:K.optional(),agent:K.optional(),gate:V().default(!1),holders:H(K).default([]),completedBy:K.optional(),completedAt:Y.optional()}),Cd=U({from:cd,by:K,at:Y}),wd=U({id:q,project:K,title:R().min(1),status:vd,createdBy:K,createdAt:Y,updatedAt:Y,claimedBy:K.optional(),leaseExpiresAt:Y.optional(),parentId:q.optional(),blockedBy:H(q),requiredCapabilities:H(R()),stages:H(Sd).min(1),stage:cd,stageSince:Y,stageSeq:B().int().positive(),onDone:sd.default(`none`),completing:V().default(!1),returned:Cd.optional()});function Td(e,t){return e.stages.findIndex(e=>e.id===t)}function Ed(e){return e.stages.find(t=>t.id===e.stage)}var Dd=U({id:R().trim().min(1).max(120).regex(/^[\w.:/[\]-]+$/,`a model name is one word of letters, digits, and . _ : / - [ ]`),name:R(),description:R().default(``),isDefault:V().default(!1)}),Od=W([`active`,`retired`]),kd=U({name:K,role:K,cli:X.nullable(),model:R().optional(),homeRunner:K.optional(),memberships:H(K),subscriptions:H(J),status:Od,createdAt:Y,tokenHash:R().min(1),retiredAt:Y.optional(),retiredReason:R().optional()}),Ad=U({name:K,role:K,cli:X.nullable(),homeRunner:K.optional(),status:Od,resident:V().default(!1),model:R().optional(),lastModel:R().optional(),skills:H(K).default([]),memberships:H(K),subscriptions:H(J),claimsHeld:B().int().nonnegative().default(0),tasksDone:B().int().nonnegative().default(0),lastTurnAt:Y.optional(),lastTurnOutcome:R().optional(),createdAt:Y,retiredAt:Y.optional()}),jd=W([`linux`,`windows`,`darwin`]),Md=U({name:K,os:jd,clis:H(X),capabilities:H(R()),status:W([`connected`,`disconnected`]),lastSeen:Y.optional()}),Nd=W([`role`,`member`,`channel`,`reallocation`,`retirement`,`skill`,`archive`]),Pd=W([`proposed`,`approved`,`rejected`,`provisioned`,`retired`]),Fd=U({name:K,role:K,cli:X,model:R().optional(),homeRunner:K.optional(),memberships:H(K).default([]),subscriptions:H(J).default([]),seedInstructions:R().optional()}),Id=U({project:K.nullable().default(null),name:K,purpose:R().min(1)}),Ld=U({description:R().min(1)}),Rd=U({agent:K,reason:R().min(1)}),zd=U({project:K,reason:R().min(1)}),Bd=U({name:K,summary:R().min(1).max(200),body:R().min(1)}),Vd={role:[Xu],member:[Xu],retirement:[Xu],archive:[Xu],channel:[Xu,`steward`],reallocation:[Xu,`steward`],skill:[Xu,`steward`]};function Hd(e,t){switch(e){case`member`:{let e=Fd.safeParse(t);if(!e.success)break;let{name:n,role:r,cli:i,memberships:a}=e.data;return`member ${n} as ${r} on ${i}${a.length===0?``:` for ${a.join(`, `)}`}`}case`role`:{let e=Yu.safeParse(t);if(!e.success)break;let{name:n,verbs:r,maxReplicas:i}=e.data;return`role ${n} (${r.length} verbs, up to ${i} per project)`}case`channel`:{let e=Id.safeParse(t);if(!e.success)break;return`channel ${Ku(e.data.project,e.data.name)}: ${e.data.purpose}`}case`retirement`:{let e=Rd.safeParse(t);if(!e.success)break;return`retirement of ${e.data.agent}: ${e.data.reason}`}case`reallocation`:{let e=Ld.safeParse(t);if(!e.success)break;return`reallocation: ${e.data.description}`}case`skill`:{let e=Bd.safeParse(t);if(!e.success)break;return`skill ${e.data.name}: ${e.data.summary.trim().replace(/\.+$/,``)}`}case`archive`:{let e=zd.safeParse(t);if(!e.success)break;return`archive of project ${e.data.project}: ${e.data.reason}`}}return`${e} ${JSON.stringify(t)}`}var Ud=U({name:K,summary:R().default(``),scope:W([`own`,`society`]),path:R().min(1)}),Wd=U({path:R().min(1),file:R().min(1),since:Y}),Gd=R().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/),Kd=U({path:R().min(1),status:W([`added`,`modified`,`deleted`]),added:B().int().nonnegative().nullable(),removed:B().int().nonnegative().nullable()}),qd=U({changes:H(U({commit:Gd,at:Y,kind:W([`turn`,`board`,`merge`]),author:R(),turnId:q.optional(),subject:R(),files:H(Kd)})),more:V()}),Jd=Kd.pick({path:!0,status:!0}).extend({patch:R().nullable(),truncated:V()}),Yd=U({topic:K,project:K.nullable(),updatedBy:K,updatedAt:Y}),Xd=U({id:q,kind:Nd,proposedBy:K,status:Pd,createdAt:Y,decidedBy:K.optional(),decidedAt:Y.optional(),reason:R().optional(),charter:gu(R(),iu()),provisionedAt:Y.optional(),provision:gu(R(),iu()).optional()}),Zd=U({id:q,proposalId:q,decidedBy:K,outcome:W([`approved`,`rejected`]),reason:R().optional(),ts:Y});U({channel:J.optional(),body:R().min(1),thread_id:q.optional()}),U({since_cursor:q.nullable().optional(),limit:B().int().positive().max(200).default(50),advance:V().default(!0)}),U({query:R().min(1),project:K.optional(),channel:J.optional(),limit:B().int().positive().max(100).default(20)}),U({task_id:q.optional(),proposal_id:q.optional(),channel:J.optional(),title:R().min(1).max(200).optional()}),U({thread_id:q,summary:R().min(1)}),U({project:K,title:R().min(1).max(200),body:R().default(``),parent_id:q.optional(),required_capabilities:H(R()).default([]),stages:H(fd).min(1).optional()}),U({task_id:q}),U({task_id:q}),U({task_id:q,stage:cd.optional(),status:W([`abandoned`]).optional(),note:R().min(1).optional(),blocked_by:H(q).optional()}),U({task_id:q}),U({channel:J}),U({channel:J}),U({kind:Nd,charter:gu(R(),iu()),rationale:R().default(``)}),U({proposal_id:q,reason:R().optional()}),U({proposal_id:q,reason:R().min(1)}),U({slug:K,name:R().min(1).optional(),repo:R().min(1).nullable().default(null),default_branch:R().min(1).default(`main`),on_done:sd.optional()}),U({project:K,agent:K.optional()}),U({project:K,agent:K.optional()}),U({project:K.nullable().default(null),topic:K,body:R().min(1)}),U({task_id:q,stages:H(pd),on_done:sd.optional()}),U({task_id:q,note:R().min(1).optional()}),U({project:K,on_done:sd}),U({project:K,reason:R().min(1)});var Qd=U({id:q,ts:Y,type:W(`society.initialized,project.added,project.configured,project.archived,project.placed,agent.added,agent.configured,agent.placed,message.posted,thread.opened,thread.closed,task.created,task.claimed,task.released,task.updated,task.planned,task.advanced,task.moved,task.completing,task.completed,task.reopened,lease.expired,subscription.changed,proposal.created,proposal.decided,proposal.provisioned,channel.added,role.added,agent.retired,agent.joined,agent.left,knowledge.written,skill.promoted,runner.added,user.signed_in,user.signed_out,user.token_rotated,runner.changed,ops.signal,paused.changed,wake.requested,turn.started,turn.steered,turn.stopped,turn.completed,turn.failed,merge.completed,merge.failed`.split(`,`)),actor:K,payload:gu(R(),iu())}),$d=U({inputTokens:B().int().nonnegative(),outputTokens:B().int().nonnegative(),cacheReadTokens:B().int().nonnegative().default(0),cacheWriteTokens:B().int().nonnegative().default(0)}),ef=U({summary:R().min(1),claimsHeld:H(q).default([]),blockedOn:H(R()).default([]),needsUserDecision:V().default(!1),memoryUpdated:V().default(!1)}),tf=W([`completed`,`timeout`,`error`,`interrupted`,`blocked`,`stopped`]),nf=fu(`type`,[U({type:G(`turn_started`),agent:K,session:R(),runner:K,model:R().optional()}),U({type:G(`steered`),steer:R().min(1),messages:H(q).optional(),text:R().optional()}),U({type:G(`text`),delta:R()}),U({type:G(`tool_call`),name:R(),input:iu()}),U({type:G(`tool_result`),name:R(),ok:V(),output:R().optional()}),U({type:G(`approval_requested`),kind:R(),detail:iu()}),U({type:G(`turn_completed`),usage:$d,costUsd:B().nonnegative(),status:ef.nullable(),exitReason:tf}),U({type:G(`error`),message:R()})]),rf=U({ts:Y,event:nf}),af=U({seq:B().int().positive(),ts:Y,agent:K,project:K,thread:q.optional(),event:nf});U({protocol:B().int().positive(),version:R().min(1),os:jd,clis:H(X),residentClis:H(X).default([]),steerableClis:H(X).default([]),stoppableClis:H(X).default([]),branchReads:V().default(!1),branchChanges:V().default(!1),capabilities:H(R()).default([]),slots:B().int().positive().nullable(),turns:H(q).default([])}),U({name:K,version:R()}),U({protocol:B().int().positive(),version:R().min(1).max(64),hostname:R().min(1).max(253),os:jd,clis:H(X).max(8),capabilities:H(R().min(1).max(64)).max(32).default([])}),U({deviceCode:R().min(1),userCode:R().min(1),expiresAt:Y,intervalMs:B().int().positive()}),U({deviceCode:R().min(1)}),fu(`status`,[U({status:G(`pending`)}),U({status:G(`approved`),name:K,token:R().min(1)}),U({status:G(`denied`)})]);var of=U({userCode:R().min(1),hostname:R(),os:jd,clis:H(X),capabilities:H(R()),version:R(),requestedAt:Y,expiresAt:Y}),sf=U({slug:K,origin:R().nullable(),defaultBranch:R().min(1)}),cf=fu(`kind`,[U({kind:G(`home`)}),U({kind:G(`project`),repo:sf,branches:H(R().min(1))}),U({kind:G(`task`),repo:sf,taskId:q})]),lf=U({turnId:q,agent:K,role:K,cli:X,model:R().optional(),scope:K,thread:q.optional(),session:R().min(1).nullable(),costSoFarUsd:B().nonnegative(),instructions:R(),prompt:R(),mcp:U({url:R().min(1),token:R().min(1)}),limits:U({timeoutMs:B().int().positive().nullable(),maxTurns:B().int().positive().nullable()}),resident:U({key:R().min(1),idleMs:B().int().positive()}).optional(),workspace:cf}),uf=U({branch:R().min(1),head:R().min(1)});U({entries:H(rf)}),U({exitReason:tf,status:ef.nullable(),error:R().nullable(),usage:$d,costUsd:B().nonnegative(),sessionCostUsd:B().nonnegative().optional(),session:R().min(1),model:R().nullable(),work:uf.nullable()}),U({dropWorktree:V()});var df=U({repo:sf,branch:R().min(1)});U({ok:V(),detail:R()});var ff=8388608,pf=R().max(4096).refine(e=>e===``||e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&!e.includes(`\0`)),{message:"a path inside the branch, with no empty, `.`, or `..` segment"}),mf=R().regex(/^[A-Za-z0-9][A-Za-z0-9._/-]*$/),hf=U({repo:sf,branch:mf,path:pf}),gf=U({id:R().min(1),at:Y,author:R()}),_f=fu(`kind`,[U({kind:G(`file`),path:pf,commit:gf,size:B().int().nonnegative(),content:R().nullable()}),U({kind:G(`dir`),path:pf,commit:gf,entries:H(U({name:R().min(1),kind:W([`file`,`dir`]),size:B().int().nonnegative().nullable()}))})]),vf=U({repo:sf,branch:mf}),yf=U({head:gf,files:H(U({path:R().min(1),status:W([`added`,`modified`,`deleted`]),added:B().int().nonnegative().nullable(),removed:B().int().nonnegative().nullable(),lastChange:U({author:R(),at:Y}).optional()})),total:B().int().nonnegative()}),bf=U({id:Fl(),text:R().min(1)});fu(`type`,[U({type:G(`turn`),job:lf}),U({type:G(`land`),request:R().min(1),land:df}),U({type:G(`models`),request:R().min(1),cli:X}),U({type:G(`file`),request:R().min(1),read:hf}),U({type:G(`changes`),request:R().min(1),read:vf}),U({type:G(`steer`),request:R().min(1),turnId:q,steer:bf}),U({type:G(`stop`),request:R().min(1),turnId:q})]),fu(`ok`,[U({ok:G(!0),value:iu()}),U({ok:G(!1),error:R()})]),U({warm:H(R())}),U({files:gu(R(),R())}),U({paths:H(R())}),U({files:gu(R(),R())});var xf=U({kind:W([`mention`,`stage`,`task_done`,`proposal_decided`,`heartbeat`,`reflection`,`onboarding`,`manual`,`ops_event`,`user_post`]),from:K.optional(),fromUser:V().default(!1),reason:R().default(``),taskId:q.optional(),messageId:q.optional(),channel:J.optional()});U({agent:K,project:K,thread:U({id:q,task:V()}).optional(),trigger:xf,priority:B().int().min(0).max(2),onboarding:V().default(!1)});function Sf(e,t,n){return n===void 0?`${e}/${t}`:`${e}/${t}/${n}`}function Cf(e){let[t,n,r,i]=e.split(`/`);return t===void 0||n===void 0||i!==void 0?null:r===void 0?{agent:t,scope:n}:{agent:t,scope:n,thread:r}}U({id:q.optional(),agent:K,project:K,thread:q.optional(),runner:K,cli:X.nullable(),session:R().nullable(),trigger:xf,startedAt:Y,endedAt:Y.nullable(),exitReason:tf.nullable(),status:ef.nullable(),error:R().nullable(),usage:$d.nullable(),costUsd:B().nonnegative().default(0),sessionCostUsd:B().nonnegative().optional(),toolCalls:B().int().nonnegative().default(0),model:R().nullable().default(null),work:uf.optional(),stoppedBy:K.optional()});var wf=U({turnId:q,agent:K,scope:K,thread:q.optional(),cli:X,channel:J.optional(),steerable:V(),stoppable:V()});U({claude:R().optional(),codex:R().optional(),runner:K.optional()}),U({agent:K,project:K,reason:R().default(`manual wake`),kind:W([`manual`,`reflection`]).default(`manual`)});var Tf=U({id:q,turnId:q.optional(),ts:Y,outcome:W([`completed`,`failed`]),project:K,thread:q.optional(),trigger:R(),exitReason:R().nullable(),costUsd:B(),model:R().nullable(),summary:R().nullable(),error:R().nullable(),startedAt:Y.optional(),toolCalls:B().int().nonnegative().optional()}),Ef=W([`waiting_stage`,`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`turn_cost`,`scaled`,`runner`,`home_conflict`]),Df=[`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`scaled`],Of=U({kind:Ef,key:R().min(1),summary:R().min(1),value:B(),threshold:B().optional(),project:K.optional(),agent:K.optional(),role:K.optional(),taskId:q.optional()}),kf=W([`24h`,`7d`,`all`]),Z=B().int().nonnegative(),Af=B().nonnegative(),jf=U({window:kf,since:Y.nullable(),until:Y,idle:U({turns:Z,idle:Z,unknown:Z,byTrigger:H(U({trigger:R(),turns:Z,idle:Z})),byAgent:H(U({agent:K,role:K.nullable(),turns:Z,idle:Z}))}),sentBack:U({finished:Z,sendBacks:Z,tasksSentBack:Z,byStage:H(U({project:K,stage:R(),count:Z})),bySender:H(U({agent:K,count:Z}))}),messages:U({finished:Z,messages:Z,byProject:H(U({project:K,finished:Z,messages:Z})),busiest:H(U({taskId:q,title:R(),project:K,messages:Z}))}),latency:U({mentions:Z,unanswered:Z,medianMs:Af.nullable(),slowestMs:Af.nullable(),byAgent:H(U({agent:K,mentions:Z,medianMs:Af,slowestMs:Af}))}),decisions:U({total:Z,byDay:H(U({day:R(),proposals:Z,answers:Z,stages:Z}))}),blocked:H(U({taskId:q,title:R().nullable(),project:K.nullable(),summary:R(),firstAt:Y,lastAt:Y,holds:V()}))}),Mf=W([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]),Nf=U({clientId:R().min(1),clientSecret:R().min(1),users:H(R().min(1)).min(1)});U({dataDir:R().min(1),host:R().min(1),port:B().int().positive().max(65535),publicUrl:R().min(1).nullable(),logLevel:Mf,concurrency:B().int().positive().nullable(),turnTimeoutMs:B().int().positive().nullable(),toolRounds:B().int().positive().nullable(),residentIdleMs:B().int().positive(),github:Nf.nullable(),trustedProxies:B().int().min(0).max(16)}),U({serverUrl:R().url(),token:R().min(1).nullable(),dataDir:R().min(1),logLevel:Mf,slots:B().int().positive().nullable(),clis:H(X).min(1),capabilities:H(R())});var Pf=`stellaris.token`;function Ff(){return localStorage.getItem(Pf)}function If(e){localStorage.setItem(Pf,e)}function Lf(){localStorage.removeItem(Pf)}var Rf=U({github:V()});async function zf(){try{let e=Rf.safeParse(await(await fetch(`/auth/config`)).json());return e.success?e.data:{github:!1}}catch{return{github:!1}}}var Bf=class extends Error{status;constructor(e,t){super(t),this.status=e}},Vf=U({name:K,role:K,signIn:U({login:R().min(1),avatarUrl:Ll()}).optional()}),Hf=Ad.extend({profile:R()}).array(),Uf=U({paused:V(),running:H(R()),pending:H(R()),resident:H(R()),signals:H(R()),turns:H(wf).default([])});function Wf(e){return e.flatMap(e=>{let t=Cf(e);return t===null?[]:[t]})}var Gf=_d.extend({body:R()}),Kf=Gf.array(),qf=U({ref:J,project:K.nullable(),name:K,messages:B().int(),lastMessageId:q.nullable(),lastAt:R().nullable()}),Jf=xd.extend({body:R()}),Yf=Jf.extend({messages:B().int(),lastMessageId:q.nullable(),lastAuthor:K.nullable().default(null)}),Xf=U({thread:Jf,messages:Kf}),Zf=U({message:Gf,thread:Jf.nullable()}),Qf=wd.extend({body:R()}),$f=Xd.extend({body:R()}),ep=Yd.extend({body:R()}),tp=U({body:R()}),np=U({data:gu(R(),iu()),body:R()});function rp(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}var ip=U({message:R()});async function Q(e,t,n){let r;try{r=await fetch(e,{headers:{authorization:`Bearer ${t}`}})}catch{throw new Bf(0,`The board server is not reachable.`)}if(!r.ok){let t=ip.safeParse(await r.json().catch(()=>null));throw new Bf(r.status,t.success?t.data.message:`${e} answered ${r.status}`)}return n.parse(await r.json())}async function ap(e,t,n,r,i){let a;try{a=await fetch(t,{method:e,headers:{authorization:`Bearer ${n}`,"content-type":`application/json`},body:JSON.stringify(r)})}catch{throw new Bf(0,`The board server is not reachable.`)}if(!a.ok){let e=ip.safeParse(await a.json().catch(()=>null));throw new Bf(a.status,e.success?e.data.message:`${t} answered ${a.status}`)}return i.parse(await a.json())}function op(e,t,n,r){return ap(`POST`,`/api/verbs/${e}`,t,n,r)}var sp=U({paused:V()}),cp=U({id:q,ts:R(),signal:Of}),lp=kd.omit({tokenHash:!0}),up=U({signedOut:V()}),dp=U({denied:V()}),fp=U({stopped:V()});function pp(e){return{me:()=>Q(`/api/me`,e,Vf),signOut:()=>ap(`DELETE`,`/api/sign-in`,e,{},up),society:()=>Q(`/api/society`,e,od),members:()=>Q(`/api/members`,e,Hf),projects:()=>Q(`/api/projects`,e,md.array()),roles:()=>Q(`/api/roles`,e,Yu.array()),scheduler:()=>Q(`/api/scheduler`,e,Uf),signals:t=>Q(`/api/signals?limit=${t}`,e,cp.array()),metrics:t=>Q(`/api/metrics?window=${t}`,e,jf),channels:()=>Q(`/api/channels`,e,qf.array()),channel:t=>Q(`/api/channels/${rp(t)}`,e,Kf),threads:()=>Q(`/api/threads`,e,Yf.array()),requests:()=>Q(`/api/requests`,e,Zf.array()),thread:t=>Q(`/api/threads/${encodeURIComponent(t)}`,e,Xf),tasks:t=>Q(`/api/projects/${encodeURIComponent(t)}/tasks`,e,Qf.array()),task:t=>Q(`/api/tasks/${encodeURIComponent(t)}`,e,Qf),taskFile:(t,n)=>Q(`/api/tasks/${encodeURIComponent(t)}/files${n.split(`/`).filter(e=>e!==``).map(e=>`/${encodeURIComponent(e)}`).join(``)}`,e,_f),taskChanges:t=>Q(`/api/tasks/${encodeURIComponent(t)}/changes`,e,yf),proposals:()=>Q(`/api/proposals`,e,$f.array()),proposal:t=>Q(`/api/proposals/${encodeURIComponent(t)}`,e,$f),skills:()=>Q(`/api/skills`,e,Ud.array()),turns:(t,n)=>Q(`/api/agents/${encodeURIComponent(t)}/turns?limit=${n}`,e,Tf.array()),transcript:(t,n)=>Q(`/api/agents/${encodeURIComponent(t)}/turns/${encodeURIComponent(n)}`,e,rf.array()),memory:t=>Q(`/api/agents/${encodeURIComponent(t)}/memory`,e,tp),agentSkills:t=>Q(`/api/agents/${encodeURIComponent(t)}/skills`,e,Ud.array()),history:(t,n)=>Q(`/api/agents/${encodeURIComponent(t)}/history?limit=${n}`,e,qd),change:(t,n)=>Q(`/api/agents/${encodeURIComponent(t)}/history/${encodeURIComponent(n)}`,e,Jd.array()),conflicts:t=>Q(`/api/agents/${encodeURIComponent(t)}/conflicts`,e,Wd.array()),dashboard:t=>Q(`/api/projects/${encodeURIComponent(t)}/dashboard`,e,np),knowledge:t=>Q(t===`society`?`/api/society/knowledge`:`/api/projects/${encodeURIComponent(t)}/knowledge`,e,ep.array()),sendMessage:t=>op(`post_message`,e,t,Gf),openThread:t=>op(`open_thread`,e,t,Jf),closeThread:t=>op(`close_thread`,e,t,Gf),approve:t=>op(`approve`,e,t,Zd),reject:t=>op(`reject`,e,t,Zd),wake:t=>ap(`POST`,`/api/wake`,e,t,Qd),setPaused:t=>ap(`POST`,t?`/api/pause`:`/api/resume`,e,{},sp),stopTurn:t=>ap(`POST`,`/api/turns/${encodeURIComponent(t)}/stop`,e,{},fp),models:t=>Q(`/api/models/${t}`,e,Dd.array()),runners:()=>Q(`/api/runners`,e,Md.array()),enrollments:()=>Q(`/api/enrollments`,e,of.array()),approveEnrollment:(t,n)=>ap(`POST`,`/api/enrollments/${encodeURIComponent(t)}/approve`,e,{name:n},Md),denyEnrollment:t=>ap(`POST`,`/api/enrollments/${encodeURIComponent(t)}/deny`,e,{},dp),setRunner:(t,n)=>ap(`PUT`,`/api/agents/${encodeURIComponent(t)}/runner`,e,{runner:n},lp),setModel:(t,n)=>ap(`PUT`,`/api/agents/${encodeURIComponent(t)}/model`,e,{model:n},lp)}}var mp=(0,m.createContext)(null);function $(){let e=(0,m.useContext)(mp);if(e===null)throw Error(`useSession needs a signed-in SessionContext`);return e}function hp(){let{api:e}=$();return T({queryKey:[`society`],queryFn:e.society,staleTime:6e4})}function gp(){let{api:e}=$();return T({queryKey:[`me`],queryFn:e.me,staleTime:1/0})}function _p(){let{api:e}=$();return T({queryKey:[`members`],queryFn:e.members,refetchInterval:3e4})}function vp(){let{api:e}=$();return T({queryKey:[`projects`],queryFn:e.projects,refetchInterval:6e4})}function yp(){let{api:e}=$();return T({queryKey:[`roles`],queryFn:e.roles,refetchInterval:6e4})}function bp(){let{api:e}=$();return T({queryKey:[`scheduler`],queryFn:e.scheduler,refetchInterval:3e3})}function xp(){let{api:e}=$();return T({queryKey:[`requests`],queryFn:e.requests,refetchInterval:6e4})}function Sp(e){let{api:t}=$();return T({queryKey:[`signals`],queryFn:()=>t.signals(200),enabled:e,refetchInterval:6e4})}function Cp(e){let{api:t}=$();return T({queryKey:[`metrics`,e],queryFn:()=>t.metrics(e),refetchInterval:6e4})}function wp(){let{api:e}=$();return T({queryKey:[`channels`],queryFn:e.channels,refetchInterval:6e4})}function Tp(){let{api:e}=$();return T({queryKey:[`threads`],queryFn:e.threads,refetchInterval:6e4})}function Ep(e){let{api:t}=$();return T({queryKey:[`tasks`,e],queryFn:()=>t.tasks(e),refetchInterval:6e4})}function Dp(e){return e.flatMap(e=>e.data??[])}function Op(){let{api:e}=$();return ct({queries:(vp().data??[]).map(t=>({queryKey:[`tasks`,t.slug],queryFn:()=>e.tasks(t.slug),refetchInterval:6e4})),combine:Dp})}function kp(e){let{api:t}=$();return T({queryKey:[`task`,e],queryFn:()=>t.task(e??``),enabled:e!==null})}function Ap(e,t){let{api:n}=$();return T({queryKey:[`task-file`,e,t],queryFn:()=>n.taskFile(e,t),staleTime:3e4,retry:(e,t)=>e<1&&!(t instanceof Bf&&(t.status===404||t.status===503))})}function jp(e){let{api:t}=$();return T({queryKey:[`task-changes`,e],queryFn:()=>t.taskChanges(e),staleTime:3e4,retry:(e,t)=>e<1&&!(t instanceof Bf&&(t.status===404||t.status===503))})}function Mp(){let{api:e}=$();return T({queryKey:[`proposals`],queryFn:e.proposals,refetchInterval:6e4})}function Np(e){let{api:t}=$();return T({queryKey:[`proposal`,e],queryFn:()=>t.proposal(e)})}function Pp(){let{api:e}=$();return T({queryKey:[`skills`],queryFn:e.skills,staleTime:6e4})}function Fp(e,t){let{api:n}=$();return T({queryKey:[`turns`,e,t],queryFn:()=>n.turns(e,t),refetchInterval:6e4})}function Ip(e,t){let{api:n}=$();return T({queryKey:[`transcript`,e,t],queryFn:()=>n.transcript(e,t??``),enabled:t!==null,staleTime:1/0})}function Lp(e){let{api:t}=$();return T({queryKey:[`memory`,e],queryFn:()=>t.memory(e)})}function Rp(e){let{api:t}=$();return T({queryKey:[`agent-skills`,e],queryFn:()=>t.agentSkills(e)})}function zp(e,t){let{api:n}=$();return T({queryKey:[`history`,e,t],queryFn:()=>n.history(e,t),placeholderData:ge})}function Bp(e,t,n){let{api:r}=$();return T({queryKey:[`home-change`,e,t],queryFn:()=>r.change(e,t),enabled:n,staleTime:1/0})}function Vp(e){let{api:t}=$();return T({queryKey:[`conflicts`,e],queryFn:()=>t.conflicts(e)})}function Hp(e){let{api:t}=$();return T({queryKey:[`dashboard`,e],queryFn:()=>t.dashboard(e),refetchInterval:6e4})}function Up(e){let{api:t}=$();return T({queryKey:[`knowledge`,e],queryFn:()=>t.knowledge(e),refetchInterval:12e4})}function Wp(){let{api:e}=$();return T({queryKey:[`runners`],queryFn:()=>e.runners(),refetchInterval:6e4})}function Gp(){let{api:e}=$();return T({queryKey:[`enrollments`],queryFn:e.enrollments,refetchInterval:5e3})}function Kp(e){let{api:t}=$();return T({queryKey:[`models`,e],queryFn:()=>t.models(e??`claude`),enabled:e!==null,staleTime:6e5,retry:!1})}function qp(e){let[t,n]=(0,m.useState)(()=>Date.now());return(0,m.useEffect)(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var Jp=[[`day`,86400],[`hour`,3600],[`minute`,60]],Yp=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});function Xp(e,t){let n=Math.round((Date.parse(e)-t)/1e3);for(let[e,t]of Jp)if(Math.abs(n)>=t)return Yp.format(Math.round(n/t),e);return`just now`}function Zp(e){let t=Math.max(0,Math.round(e/1e3));if(t<60)return`${t}s`;let n=Math.floor(t/60);return n<60?`${n}m`:`${Math.floor(n/60)}h ${n%60}m`}function Qp(e,t=220){let n=(e.split(/\n\s*\n/).map(e=>e.trim()).find(e=>e.length>0&&!e.startsWith(`#`))??``).replaceAll(/[*_`>]/g,``).replaceAll(/\s+/g,` `).trim();return n.length<=t?n:`${n.slice(0,t-1).trimEnd()}…`}export{zd as $,Pe as $t,hp as A,Ft as At,Lf as B,dt as Bt,xp as C,$t as Ct,$ as D,At as Dt,bp as E,Ut as Et,Tp as F,kt as Ft,kf as G,yt as Gt,Wf as H,pt as Ht,Ip as I,mt as It,Sf as J,Tt as Jt,Df as K,ut as Kt,Fp as L,Dt as Lt,jp as M,jt as Mt,Ap as N,Mt as Nt,Sp as O,It as Ot,Ep as P,Ct as Pt,rd as Q,Fe as Qt,Bf as R,vt as Rt,Mp as S,gn as St,Wp as T,Kt as Tt,If as U,ft as Ut,pp as V,wt as Vt,Ff as W,Et as Wt,Qd as X,T as Xt,ff as Y,gt as Yt,af as Z,ze as Zt,Cp as _,p as _n,H as _t,Rp as a,ue as an,id as at,vp as b,s as bn,gu as bt,Hp as c,ce as cn,Hd as ct,Vp as d,y as dn,ad as dt,Ae as en,Id as et,zp as f,S as fn,Yu as ft,Lp as g,g as gn,Gu as gt,_p as h,te as hn,Ku as ht,mp as i,oe as in,Rd as it,kp as j,Nt as jt,Pp as k,zt as kt,Gp as l,ae as ln,gd as lt,gp as m,ye as mn,Xu as mt,Qp as n,Ee as nn,Vd as nt,Op as o,le as on,Bd as ot,Up as p,xe as pn,Zu as pt,Cf as q,ht as qt,Zp as r,Te as rn,Ld as rt,wp as s,b as sn,Ed as st,Xp as t,ke as tn,Fd as tt,Bp as u,de as un,Td as ut,Kp as v,d as vn,V as vt,yp as w,qt as wt,Np as x,l as xn,R as xt,qp as y,o as yn,U as yt,zf as z,Ot as zt};