@kubitnodes/stellaris 0.1.0 → 0.2.0

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 (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +3 -2
  3. package/dist/cli/index.js +167 -12
  4. package/dist/server/index.js +543 -32
  5. package/package.json +2 -1
  6. package/web/dist/assets/ChannelView-O1FQ_Cbf.js +1 -0
  7. package/web/dist/assets/CitizenView-D0rSRBnj.js +2 -0
  8. package/web/dist/assets/CitizensView-BPx5ChvL.js +1 -0
  9. package/web/dist/assets/KnowledgeView-Cjf5Axu5.js +1 -0
  10. package/web/dist/assets/Markdown-Dkiv3bKi.js +29 -0
  11. package/web/dist/assets/MessageItem-sep2BGUh.js +1 -0
  12. package/web/dist/assets/MetricsView-BIH8FLob.js +1 -0
  13. package/web/dist/assets/NeedsYouView-CuB7daZ0.js +1 -0
  14. package/web/dist/assets/Overview-C6Ae0n9b.js +1 -0
  15. package/web/dist/assets/Pane-BXpuXst6.js +1 -0
  16. package/web/dist/assets/ProjectView-CpTcrvFa.js +1 -0
  17. package/web/dist/assets/ProposalView-BXisoFis.js +1 -0
  18. package/web/dist/assets/ProposalsView-BjPeXIxG.js +1 -0
  19. package/web/dist/assets/RunnersView-0ou0ekMc.js +1 -0
  20. package/web/dist/assets/SocietyView-C8lU_XY4.js +1 -0
  21. package/web/dist/assets/SubjectThread-BWbOV_wk.js +1 -0
  22. package/web/dist/assets/TaskView-CDLRRfS6.js +1 -0
  23. package/web/dist/assets/TasksView-p6PdvdWY.js +1 -0
  24. package/web/dist/assets/ThreadCard-BisvLnYg.js +1 -0
  25. package/web/dist/assets/ThreadForms-DZ1yLsjU.js +1 -0
  26. package/web/dist/assets/ThreadView-CQUPQ5oR.js +1 -0
  27. package/web/dist/assets/{citizen-BXVebeiP.js → citizen-BwK8Ciw3.js} +1 -1
  28. package/web/dist/assets/format-DZLzLk7S.js +55 -0
  29. package/web/dist/assets/index-CbJnPhSw.js +21 -0
  30. package/web/dist/assets/index-DJ30ENcc.css +2 -0
  31. package/web/dist/assets/{tasks-rltmWd5a.js → tasks-DZgkXWwu.js} +1 -1
  32. package/web/dist/assets/{useStickyScroll-DDS3s21P.js → useStickyScroll-CVTdIoKj.js} +1 -1
  33. package/web/dist/index.html +4 -4
  34. package/web/dist/assets/ChannelView-B8BZLsf1.js +0 -1
  35. package/web/dist/assets/CitizenView-GomLDcrr.js +0 -2
  36. package/web/dist/assets/CitizensView-yNv8WtND.js +0 -1
  37. package/web/dist/assets/KnowledgeView--jxofSSN.js +0 -1
  38. package/web/dist/assets/Markdown-BpYzeV5r.js +0 -28
  39. package/web/dist/assets/MessageItem-BGPpqgpq.js +0 -1
  40. package/web/dist/assets/MetricsView-CcqLr6S1.js +0 -1
  41. package/web/dist/assets/NeedsYouView-r7gJGgVG.js +0 -1
  42. package/web/dist/assets/Overview-Cmz4_gfI.js +0 -1
  43. package/web/dist/assets/Pane-DRpHmeJ9.js +0 -1
  44. package/web/dist/assets/ProjectView-CuACZj4L.js +0 -1
  45. package/web/dist/assets/ProposalView-BiVcNEDL.js +0 -1
  46. package/web/dist/assets/ProposalsView-BIdkOfZO.js +0 -1
  47. package/web/dist/assets/SocietyView-Dya97szC.js +0 -1
  48. package/web/dist/assets/SubjectThread-2j_msY38.js +0 -1
  49. package/web/dist/assets/TaskView-CcJr7xnH.js +0 -1
  50. package/web/dist/assets/TasksView-BUvHntvK.js +0 -1
  51. package/web/dist/assets/ThreadCard-tzMGvn9j.js +0 -1
  52. package/web/dist/assets/ThreadForms-DE2yJEhz.js +0 -1
  53. package/web/dist/assets/ThreadView-FsNOTyVC.js +0 -1
  54. package/web/dist/assets/format-Ca2VAvEx.js +0 -77
  55. package/web/dist/assets/index-CtuchAFa.css +0 -2
  56. package/web/dist/assets/index-D4GJkeKU.js +0 -237
@@ -0,0 +1 @@
1
+ import{An as e,C as t,Dt as n,E as r,Ft as i,J as a,M as o,Nt as s,O as c,Ot as l,Pn as u,Y as d,b as f,ct as p,ft as m,j as h,jn as g,jt as _,kn as v,kt as y,lt as b,m as x,t as S,tt as C,v as w,y as T}from"./format-DZLzLk7S.js";import{a as E}from"./tasks-DZgkXWwu.js";import{A as D,D as O,L as ee,N as te,O as ne,R as k,T as A,a as j,c as M,j as N,k as P,s as F,t as I,w as L,x as R}from"./index-CbJnPhSw.js";import{t as z}from"./Markdown-Dkiv3bKi.js";import{n as B,t as V}from"./Pane-BXpuXst6.js";import{n as H,r as U}from"./ThreadForms-DZ1yLsjU.js";import{StatusChip as W}from"./ProposalsView-BjPeXIxG.js";import{t as G}from"./SubjectThread-BWbOV_wk.js";var K=u(g(),1),q=e();function J({proposal:e,consequence:t}){let{api:n}=r(),i=v(),a=x(),[o,s]=(0,K.useState)(null),[c,l]=(0,K.useState)(``),u=(0,K.useRef)(null);(0,K.useEffect)(()=>{o!==null&&u.current?.focus()},[o]);let d=k({mutationFn:()=>{let t=c.trim();return o===`reject`?n.reject({proposal_id:e.id,reason:t}):n.approve({proposal_id:e.id,...t===``?{}:{reason:t}})},onSuccess:()=>{let t=[[`proposals`],[`proposal`,e.id],[`threads`],[`thread`,e.id]];for(let e of t)i.invalidateQueries({queryKey:e});s(null),l(``)}}),f=(a.data??[]).find(t=>t.name===e.proposedBy&&t.status===`active`&&t.cli!==null),p=f===void 0?`Your decision is posted in the proposal's thread, which closes.`:`Your decision is posted in the proposal's thread, which closes, and wakes ${f.name}, who proposed it.`;if(o===null)return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-line px-4 py-3`,children:[(0,q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-meta`,children:`This proposal waits on you.`}),(0,q.jsx)(j,{onClick:()=>s(`reject`),children:`Reject`}),(0,q.jsx)(j,{variant:`primary`,onClick:()=>s(`approve`),children:`Approve`})]});let m=o===`approve`;return(0,q.jsxs)(`form`,{"aria-label":m?`Approve the proposal`:`Reject the proposal`,className:`space-y-2 border-t border-line bg-surface-2/20 p-3`,onSubmit:e=>{e.preventDefault(),d.mutate()},children:[(0,q.jsx)(`textarea`,{ref:u,value:c,rows:2,placeholder:m?`Why approve? Optional.`:`Why not? It is posted with the decision.`,"aria-label":m?`Reason for approving`:`Reason for rejecting`,onChange:e=>l(e.target.value),className:`${H} resize-none`}),(0,q.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-fg-muted`,children:[m?t:`Nothing is created, and the proposal's thread closes.`,` `,p]}),(0,q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,q.jsx)(j,{onClick:()=>{s(null),d.reset()},children:`Cancel`}),(0,q.jsx)(j,{variant:`primary`,type:`submit`,disabled:d.isPending||!m&&c.trim()===``,children:d.isPending?`Deciding…`:m?`Confirm approval`:`Confirm rejection`})]}),(0,q.jsx)(U,{error:d.error})]})}function Y({children:e}){return(0,q.jsx)(`dl`,{className:`mt-2 space-y-1.5`,children:e})}function X({label:e,children:t}){return(0,q.jsxs)(`div`,{className:`grid grid-cols-[9rem_1fr] gap-3 text-sm`,children:[(0,q.jsx)(`dt`,{className:`text-meta`,children:e}),(0,q.jsx)(`dd`,{className:`min-w-0 break-words text-fg-secondary`,children:t})]})}function Z(e){return e.length===0?`none`:e.join(`, `)}function Q({name:e,change:t}){return(0,q.jsxs)(`span`,{className:`inline-block rounded-md px-1.5 py-px font-mono text-[11px] ${t===`added`?`bg-emerald-500/15 text-emerald-300`:t===`removed`?`bg-red-500/15 text-red-300 line-through`:`bg-surface-2/70 text-fg-tertiary`}`,children:[t===`added`?`+ `:t===`removed`?`− `:``,e]})}function $({children:e}){return(0,q.jsx)(`div`,{className:`mt-2 rounded-xl bg-surface-2/30 px-3.5 py-3 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.06)]`,children:e})}function re({next:e,current:t,compare:n}){let r=t===void 0?null:P(t,e),i=r!==null&&r.verbsAdded.length===0&&r.verbsRemoved.length===0&&r.changes.length===0&&!r.purposeChanged;return(0,q.jsxs)(q.Fragment,{children:[n?r===null?(0,q.jsx)(`p`,{className:`mt-2 text-meta`,children:`A new role: no charter by this name exists yet.`}):i?(0,q.jsx)(`p`,{className:`mt-2 text-meta`,children:`The same as the charter the role has now.`}):(0,q.jsxs)($,{children:[(0,q.jsx)(`p`,{className:`text-caps`,children:`Against the charter it has now`}),r.verbsAdded.length+r.verbsRemoved.length===0?null:(0,q.jsxs)(`p`,{className:`mt-2 flex flex-wrap gap-1`,children:[r.verbsAdded.map(e=>(0,q.jsx)(Q,{name:e,change:`added`},e)),r.verbsRemoved.map(e=>(0,q.jsx)(Q,{name:e,change:`removed`},e))]}),r.changes.length===0?null:(0,q.jsx)(Y,{children:r.changes.map(e=>(0,q.jsxs)(X,{label:e.field,children:[e.from,` → `,(0,q.jsx)(`span`,{className:`text-fg-primary`,children:e.to})]},e.field))}),r.purposeChanged?(0,q.jsx)(`p`,{className:`mt-2 text-xs text-fg-secondary`,children:`The purpose is rewritten.`}):null]}):null,(0,q.jsxs)(Y,{children:[(0,q.jsx)(X,{label:`Role`,children:e.name}),(0,q.jsx)(X,{label:`Purpose`,children:e.purpose}),(0,q.jsx)(X,{label:`Verbs`,children:(0,q.jsx)(`span`,{className:`flex flex-wrap gap-1`,children:e.verbs.map(e=>(0,q.jsx)(Q,{name:e},e))})}),(0,q.jsx)(X,{label:`Wake triggers`,children:Z(e.wakeTriggers)}),(0,q.jsx)(X,{label:`Replicas per project`,children:e.maxReplicas}),(0,q.jsx)(X,{label:`Warm session`,children:e.resident?`yes`:`no`}),(0,q.jsx)(X,{label:`Society role`,children:e.societyScope?`yes, in no project`:`no`}),(0,q.jsx)(X,{label:`Reflects`,children:e.reflects?`yes`:`no`})]})]})}function ie({proposal:e,slug:t,reason:n,members:r}){let a=T(),o=h(t),s=a.data?.find(e=>e.slug===t),c=e.status===`proposed`,l=c?(r??[]).filter(e=>e.status===`active`&&e.memberships.includes(t)).map(e=>e.name):e.provision?.members??[],u=(o.data??[]).filter(E).length;return(0,q.jsxs)(Y,{children:[(0,q.jsxs)(X,{label:`Project`,children:[(0,q.jsx)(i,{to:`/p/$slug`,params:{slug:t},className:`hover:text-fg-primary`,children:s?.name??t}),s?.name===void 0||s.name===t?null:` · ${t}`]}),(0,q.jsx)(X,{label:c?`Members who leave`:`Members who left`,children:Array.isArray(l)?Z(l.filter(e=>typeof e==`string`)):`none`}),c?(0,q.jsx)(X,{label:`Tasks in play`,children:o.data===void 0?`reading…`:u===0?`none`:`${u}: approval is refused until they are done, abandoned, or filed elsewhere`}):null,(0,q.jsx)(X,{label:`Reason`,children:n}),(0,q.jsx)(X,{label:`After`,children:`Its open threads close and nothing more is posted, filed, or joined there; its channels, tasks, repository, and history stay readable.`})]})}function ae({proposal:e,roles:t,members:r}){let i=e.status===`proposed`,{charter:o}=e;switch(e.kind){case`member`:{let e=C.safeParse(o);if(!e.success)break;let t=e.data;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(Y,{children:[(0,q.jsx)(X,{label:`Citizen`,children:(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,q.jsx)(R,{cli:t.cli,size:13}),t.name]})}),(0,q.jsx)(X,{label:`Role`,children:t.role}),(0,q.jsxs)(X,{label:`CLI and model`,children:[t.cli,` · `,t.model??`cli default`]}),(0,q.jsx)(X,{label:`Projects`,children:Z(t.memberships)}),(0,q.jsx)(X,{label:`Also follows`,children:Z(t.subscriptions)}),t.homeRunner===void 0?null:(0,q.jsx)(X,{label:`Runs on`,children:t.homeRunner})]}),t.seedInstructions===void 0?null:(0,q.jsxs)($,{children:[(0,q.jsx)(`p`,{className:`text-caps`,children:`Seed instructions`}),(0,q.jsx)(`div`,{className:`mt-1.5`,children:(0,q.jsx)(z,{text:t.seedInstructions})})]})]})}case`role`:{let n=ne(e);if(n===null)break;return(0,q.jsx)(re,{next:n,current:t?.find(e=>e.name===n.name),compare:i})}case`skill`:{let e=m.safeParse(o);if(!e.success)break;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(Y,{children:[(0,q.jsx)(X,{label:`Skill`,children:e.data.name}),(0,q.jsx)(X,{label:`Summary`,children:e.data.summary})]}),(0,q.jsx)($,{children:(0,q.jsx)(z,{text:D(e.data.body)})})]})}case`channel`:{let e=d.safeParse(o);if(!e.success)break;return(0,q.jsxs)(Y,{children:[(0,q.jsxs)(X,{label:`Channel`,children:[`#`,n(e.data.project,e.data.name)]}),(0,q.jsx)(X,{label:`Purpose`,children:e.data.purpose})]})}case`retirement`:{let e=b.safeParse(o);if(!e.success)break;let t=r?.find(t=>t.name===e.data.agent);return(0,q.jsxs)(Y,{children:[(0,q.jsxs)(X,{label:`Citizen`,children:[(0,q.jsx)(F,{name:e.data.agent,members:r}),t===void 0?null:` · ${t.role}`]}),(0,q.jsx)(X,{label:`Holds now`,children:t===void 0?`unknown`:t.claimsHeld===1?`1 stage`:`${t.claimsHeld} stages`}),(0,q.jsx)(X,{label:`Reason`,children:e.data.reason})]})}case`archive`:{let t=a.safeParse(o);if(!t.success)break;return(0,q.jsx)(ie,{proposal:e,slug:t.data.project,reason:t.data.reason,members:r})}case`reallocation`:{let e=p.safeParse(o);if(!e.success)break;return(0,q.jsx)(Y,{children:(0,q.jsx)(X,{label:`Reallocation`,children:e.data.description})})}}return(0,q.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded-lg bg-surface-2/40 p-3 font-mono text-[11px] text-fg-tertiary`,children:JSON.stringify(o,null,2)})}var oe=_({agent:s().optional(),channel:s().optional(),role:s().optional(),skill:s().optional(),replaced:y().optional(),releasedTasks:l(s()).optional(),project:s().optional()});function se({proposal:e}){let t=oe.safeParse(e.provision??{});if(e.provision===void 0||!t.success)return null;let n=t.data,r=`text-fg-primary underline decoration-fg-muted underline-offset-2`;if(e.kind===`member`&&n.agent!==void 0)return(0,q.jsxs)(`p`,{className:`mt-1`,children:[`Created`,` `,(0,q.jsx)(i,{to:`/citizen/$name`,params:{name:n.agent},className:r,children:n.agent}),`.`]});if(e.kind===`channel`&&n.channel!==void 0)return(0,q.jsxs)(`p`,{className:`mt-1`,children:[`Created`,` `,(0,q.jsxs)(i,{to:`/c/$`,params:{_splat:n.channel},className:r,children:[`#`,n.channel]}),`.`]});if(e.kind===`retirement`&&n.agent!==void 0){let e=n.releasedTasks?.length??0;return(0,q.jsxs)(`p`,{className:`mt-1`,children:[`Retired `,n.agent,`; `,e===1?`1 stage went`:`${e} stages went`,` back to open.`]})}return e.kind===`archive`&&n.project!==void 0?(0,q.jsxs)(`p`,{className:`mt-1`,children:[`Archived`,` `,(0,q.jsx)(i,{to:`/p/$slug`,params:{slug:n.project},className:r,children:n.project}),`; its members left and its threads closed.`]}):n.role===void 0?n.skill===void 0?null:(0,q.jsxs)(`p`,{className:`mt-1`,children:[n.replaced===!0?`Replaced`:`Published`,` the society's skill `,n.skill,`.`]}):(0,q.jsxs)(`p`,{className:`mt-1`,children:[n.replaced===!0?`Rewrote`:`Added`,` the role `,n.role,`.`]})}function ce(){let{proposalId:e}=ee({from:`/proposal/$proposalId`}),n=f(e),r=x(),a=t(),s=c(),l=o(),u=w(3e4);if(n.data===void 0)return(0,q.jsx)(B,{children:n.error instanceof te&&n.error.status===404?`There is no proposal ${e}.`:`Reading the proposal…`});let d=n.data,p=d.status===`proposed`,m=r.data?.find(e=>e.name===d.proposedBy)?.role,h=l.data?.find(e=>e.id===d.id),g=d.status===`rejected`?`Rejected`:`Approved`,_=L(d,{members:r.data??[],roles:a.data??[],skills:s.data??[]});return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(V,{leading:(0,q.jsx)(i,{to:`/proposals`,"aria-label":`Back to the proposals`,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:O(d),subtitle:`${d.kind} proposal by ${M(d.proposedBy)} ${S(d.createdAt,u)}${p?` · for ${A(d,m)} to decide`:``}`,trailing:(0,q.jsx)(W,{status:d.status})}),(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:[p?(0,q.jsxs)(`p`,{className:`rounded-lg bg-sky-400/10 px-3 py-2 text-xs leading-relaxed text-sky-200`,children:[`If approved: `,_]}):(0,q.jsxs)(`div`,{className:`rounded-lg bg-surface-2/40 px-3 py-2 text-xs leading-relaxed text-fg-secondary`,children:[(0,q.jsxs)(`p`,{children:[g,` by `,M(d.decidedBy??`someone`),d.decidedAt===void 0?``:` ${S(d.decidedAt,u)}`,d.reason===void 0?`.`:`: ${d.reason}`]}),(0,q.jsx)(se,{proposal:d})]}),d.body.trim()===``||h!==void 0?null:(0,q.jsxs)(`section`,{className:`mt-5`,children:[(0,q.jsx)(`h3`,{className:`text-section`,children:`Why`}),(0,q.jsx)(`div`,{className:`mt-2`,children:(0,q.jsx)(z,{text:d.body})})]}),(0,q.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,q.jsx)(`h3`,{className:`text-section`,children:p?`What it would make`:d.status===`provisioned`?`What it made`:`What it proposed`}),(0,q.jsx)(ae,{proposal:d,roles:a.data,members:r.data})]}),(0,q.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,q.jsx)(`h3`,{className:`text-section`,children:`Thread`}),h===void 0?(0,q.jsx)(`p`,{className:`mt-2 text-meta`,children:l.data===void 0?`Reading the thread…`:`This proposal is older than proposal threads; its thread opens when it is decided.`}):(0,q.jsx)(G,{thread:h,now:u,empty:`Nothing said yet. The pitch and the decision are posted here.`})]})]}),h?.state===`open`?(0,q.jsx)(I,{target:{threadId:d.id},placeholder:`Write in the proposal's thread`}):null,N(d)?(0,q.jsx)(J,{proposal:d,consequence:_}):null]})}export{ce as ProposalView};
@@ -0,0 +1 @@
1
+ import{An as e,Ft as t,Pn as n,jn as r,t as i,v as a,x as o}from"./format-DZLzLk7S.js";import{C as s,D as c,E as l,c as u}from"./index-CbJnPhSw.js";import{n as d,t as f}from"./Pane-BXpuXst6.js";var p=n(r(),1),m=e(),h=8,g={proposed:`bg-amber-500/15 text-amber-300`,approved:`bg-emerald-500/15 text-emerald-300`,provisioned:`bg-emerald-500/15 text-emerald-300`,rejected:`bg-red-500/15 text-red-300`,retired:`bg-surface-2 text-fg-muted`};function _({status:e}){return(0,m.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${g[e]}`,children:e===`provisioned`?`approved`:e})}function v({proposal:e,now:n}){let r=e.decidedBy===void 0||e.decidedAt===void 0?``:` · ${e.status===`rejected`?`rejected`:`approved`} by ${u(e.decidedBy)} ${i(e.decidedAt,n)}`;return(0,m.jsx)(`li`,{children:(0,m.jsxs)(t,{to:`/proposal/$proposalId`,params:{proposalId:e.id},className:`block rounded-xl px-3 py-2.5 transition-colors hover:bg-surface-2/50`,children:[(0,m.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,m.jsx)(`span`,{className:`text-title min-w-0 flex-1 truncate`,children:c(e)}),(0,m.jsx)(_,{status:e.status})]}),(0,m.jsxs)(`p`,{className:`mt-1 truncate text-meta`,children:[`proposed by `,u(e.proposedBy),` `,i(e.createdAt,n),r]})]})})}function y(){let e=o(),t=a(3e4),[n,r]=(0,p.useState)(!1),i=l(e.data??[]),c=i.find(e=>e.group===`yours`)?.proposals.length??0;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f,{title:`Proposals`,subtitle:`${c===0?`nothing`:c} waiting on you · ${e.data?.length??0} in all`}),(0,m.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:e.data===void 0?(0,m.jsx)(d,{children:`Reading the proposals…`}):i.length===0?(0,m.jsx)(d,{children:`No proposals yet. Citizens propose roles, members, channels, and skills.`}):i.map(e=>{let i=e.group===`decided`&&!n?e.proposals.slice(0,h):e.proposals;return(0,m.jsxs)(`section`,{className:`mb-3`,children:[(0,m.jsxs)(`h3`,{className:`px-3 pt-2 pb-1 text-[11px] font-semibold tracking-wider text-fg-muted uppercase`,children:[s.find(t=>t.group===e.group)?.label,` ·`,` `,e.proposals.length]}),(0,m.jsx)(`ul`,{children:i.map(e=>(0,m.jsx)(v,{proposal:e,now:t},e.id))}),i.length<e.proposals.length?(0,m.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`px-3 pt-1 text-xs text-fg-tertiary hover:text-fg-primary`,children:[`Show all `,e.proposals.length]}):null]},e.group)})})]})}export{y as ProposalsView,_ as StatusChip};
@@ -0,0 +1 @@
1
+ import{An as e,E as t,Pn as n,jn as r,kn as i,l as a,t as o,v as s,w as c,y as l}from"./format-DZLzLk7S.js";import{I as u,R as d,a as f}from"./index-CbJnPhSw.js";import{n as p,t as m}from"./Pane-BXpuXst6.js";import{n as h,r as g}from"./ThreadForms-DZ1yLsjU.js";import{n as _}from"./Overview-C6Ae0n9b.js";var v=n(r(),1);function y(e){return e.toUpperCase().replaceAll(/[^A-Z0-9]/g,``)}function b(e,t){return y(e)===y(t)}function x(e,t){let n=(e.split(`.`)[0]??``).toLowerCase().replaceAll(/[^a-z0-9-]+/g,`-`).replaceAll(/-+/g,`-`).replace(/^-+/,``).slice(0,32).replace(/-+$/,``)||`runner`;if(!t.includes(n))return n;for(let e=2;;e+=1){let r=`-${e}`,i=`${n.slice(0,32-r.length)}${r}`;if(!t.includes(i))return i}}var S=e();function C(e,t){return[e.length===0?`no CLI`:e.join(`, `),...t].join(` · `)}function w({enrollment:e,taken:n,followed:r,now:a}){let{api:s}=t(),c=i(),[l,u]=(0,v.useState)(()=>x(e.hostname,n)),p=()=>{c.invalidateQueries({queryKey:[`enrollments`]}),c.invalidateQueries({queryKey:[`runners`]})},m=d({mutationFn:()=>s.approveEnrollment(e.userCode,l.trim()),onSuccess:p}),_=d({mutationFn:()=>s.denyEnrollment(e.userCode),onSuccess:p}),y=m.isPending||_.isPending;return(0,S.jsxs)(`li`,{className:`rounded-xl border px-3 py-3 ${r?`border-amber-500/40 bg-amber-500/5`:`border-line`}`,children:[(0,S.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,S.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-fg-primary`,children:e.hostname}),(0,S.jsx)(`code`,{className:`shrink-0 font-mono text-sm text-fg-primary`,children:e.userCode})]}),(0,S.jsxs)(`p`,{className:`mt-0.5 truncate text-meta`,children:[e.os,` · `,C(e.clis,e.capabilities),` · runner`,` `,e.version,` · asked `,o(e.requestedAt,a)]}),(0,S.jsxs)(`form`,{"aria-label":`Approve ${e.hostname}`,className:`mt-2.5 flex items-center gap-2`,onSubmit:e=>{e.preventDefault(),m.mutate()},children:[(0,S.jsx)(`input`,{value:l,maxLength:32,spellCheck:!1,"aria-label":`Runner name`,onChange:e=>u(e.target.value),className:`${h} min-w-0 flex-1 font-mono`}),(0,S.jsx)(f,{onClick:()=>_.mutate(),disabled:y,children:`Deny`}),(0,S.jsx)(f,{variant:`primary`,type:`submit`,disabled:y||l.trim()===``,children:m.isPending?`Approving…`:`Approve`})]}),(0,S.jsx)(`div`,{className:`mt-1.5`,children:(0,S.jsx)(g,{error:m.error??_.error})})]})}function T({runner:e,projects:t,now:n}){let r=t.filter(t=>t.runner===e.name&&t.archived===void 0).map(e=>e.slug);return(0,S.jsxs)(`li`,{className:`py-1.5`,children:[(0,S.jsxs)(`p`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,S.jsx)(`span`,{"aria-hidden":`true`,className:e.status===`connected`?`text-emerald-400`:`text-fg-muted`,children:`●`}),(0,S.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-meta`,children:[e.status===`connected`?`connected`:`away${e.lastSeen===void 0?``:`, last seen ${o(e.lastSeen,n)}`}`,` `,`· `,e.os,` · `,C(e.clis,e.capabilities)]})]}),r.length===0?null:(0,S.jsxs)(`p`,{className:`ml-5 truncate text-meta`,children:[`projects: `,r.join(`, `)]})]})}function E(){let{code:e}=u({from:`/runners`}),t=a(),n=c(),r=l(),i=s(3e4),o=t.data??[],d=(n.data??[]).map(e=>e.name),f=(n.data??[]).filter(e=>e.status===`connected`).length,h=e===void 0?void 0:o.find(t=>b(t.userCode,e)),g=h===void 0?o:[h,...o.filter(e=>e!==h)];return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(m,{title:`Runners`,subtitle:`${f} connected · ${o.length===0?`none`:o.length} waiting for approval`}),(0,S.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,S.jsxs)(_,{title:`Waiting for approval`,children:[e!==void 0&&t.data!==void 0&&h===void 0?(0,S.jsxs)(`output`,{className:`mb-2 block text-meta`,children:[`No runner waits with the code `,e,`. It may have been approved, denied, or expired; a runner whose code expired asks again with a new one.`]}):null,t.data===void 0?(0,S.jsx)(`p`,{className:`text-meta`,children:`Reading the runners that wait…`}):o.length===0?(0,S.jsx)(`p`,{className:`text-meta`,children:`None. A runner started with STELLARIS_SERVER_URL set to this board and no token prints a code to approve here.`}):(0,S.jsx)(`ul`,{className:`space-y-2`,children:g.map(e=>(0,S.jsx)(w,{enrollment:e,taken:d,followed:e===h,now:i},e.userCode))})]}),(0,S.jsx)(_,{title:`Registered`,children:n.data===void 0?(0,S.jsx)(p,{children:`Reading the runners…`}):n.data.length===0?(0,S.jsx)(`p`,{className:`text-meta`,children:`No runners yet.`}):(0,S.jsx)(`ul`,{children:n.data.map(e=>(0,S.jsx)(T,{runner:e,projects:r.data??[],now:i},e.name))})})]})]})}export{E as RunnersView};
@@ -0,0 +1 @@
1
+ import{An as e,C as t,Ct as n,O as r,dt as i,k as a,m as o,p as s,v as c,y as l}from"./format-DZLzLk7S.js";import{n as u,t as d}from"./Pane-BXpuXst6.js";import{n as f,r as p,t as m}from"./Overview-C6Ae0n9b.js";var h=e();function g(){let e=a(),g=o(),_=l(),v=t(),y=r(),b=s(i),x=c(3e4);if(e.data===void 0||g.data===void 0)return(0,h.jsx)(u,{children:`Reading the society…`});let S=g.data.filter(e=>e.cli!==null),C=S.filter(e=>e.status===`active`),w=S.filter(e=>e.status===`retired`),T=(v.data??[]).filter(e=>e.name!==n);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(d,{title:e.data.name,subtitle:`${C.length} citizens · ${_.data?.length??0} projects · ${T.length} roles`}),(0,h.jsxs)(`div`,{className:`flex-1 space-y-5 overflow-y-auto px-4 py-4`,children:[(0,h.jsxs)(f,{title:`Citizens`,children:[(0,h.jsx)(m,{members:C,scope:i}),w.length===0?null:(0,h.jsxs)(`p`,{className:`mt-2 text-meta`,children:[`Retired: `,w.map(e=>e.name).join(`, `)]})]}),(0,h.jsx)(f,{title:`Roles`,children:(0,h.jsx)(`ul`,{className:`space-y-2.5`,children:T.map(e=>{let t=C.filter(t=>t.role===e.name).length;return(0,h.jsxs)(`li`,{children:[(0,h.jsxs)(`p`,{className:`flex items-baseline gap-2 text-sm`,children:[(0,h.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),(0,h.jsxs)(`span`,{className:`text-meta`,children:[t===1?`1 member`:`${t} members`,e.resident?` · warm session`:``,e.societyScope?` · society role`:``]})]}),(0,h.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-sm leading-relaxed text-fg-secondary`,children:e.purpose})]},e.name)})})}),(0,h.jsx)(f,{title:`Knowledge`,children:(0,h.jsx)(p,{scope:i,topics:b.data,now:x})}),(0,h.jsx)(f,{title:`Skills`,children:y.data===void 0?(0,h.jsx)(`p`,{className:`text-meta`,children:`Reading…`}):y.data.length===0?(0,h.jsx)(`p`,{className:`text-meta`,children:`None yet. A citizen's skill joins the society by proposal.`}):(0,h.jsx)(`ul`,{className:`space-y-1.5`,children:y.data.map(e=>(0,h.jsxs)(`li`,{className:`text-sm`,children:[(0,h.jsx)(`span`,{className:`text-fg-primary`,children:e.name}),e.summary===``?null:(0,h.jsxs)(`span`,{className:`text-fg-secondary`,children:[` · `,e.summary]})]},e.name))})})]})]})}export{g as SocietyView};
@@ -0,0 +1 @@
1
+ import{An as e,E as t,Pn as n,jn as r,ln as i,m as a,t as o}from"./format-DZLzLk7S.js";import{M as s}from"./index-CbJnPhSw.js";import{t as c}from"./Markdown-Dkiv3bKi.js";import{t as l}from"./MessageItem-sep2BGUh.js";var u=n(r(),1),d=e();function f({thread:e,now:n,task:r,empty:f}){let{api:p}=t(),m=a(),h=i({queryKey:[`thread`,e.id],queryFn:()=>p.thread(e.id)}),g=h.data?.messages??[],_=g.at(-1)?.id??null;if((0,u.useEffect)(()=>s(e.id,_),[e.id,_]),h.data===void 0)return(0,d.jsx)(`p`,{className:`mt-2 text-meta`,children:`Reading the thread…`});let v=h.data.thread;return(0,d.jsxs)(`div`,{className:`-mx-4 mt-1`,children:[g.length===0?(0,d.jsx)(`p`,{className:`mx-4 mt-1 text-meta`,children:f}):g.map(e=>(0,d.jsx)(l,{message:e,members:m.data,now:n,task:r},e.id)),e.state===`closed`?(0,d.jsxs)(`div`,{className:`mx-4 mt-2`,children:[(0,d.jsxs)(`p`,{className:`text-meta`,children:[`Closed`,v.closedAt===void 0?``:` ${o(v.closedAt,n)}`,v.body.trim()===``?`.`:`:`]}),v.body.trim()===``?null:(0,d.jsx)(c,{text:v.body})]}):null]})}export{f as t};
@@ -0,0 +1 @@
1
+ import{A as e,An as t,E as n,Ft as r,M as i,kn as a,m as o,t as s,v as c,y as l}from"./format-DZLzLk7S.js";import{a as u,c as d,l as f,n as p,o as m,r as h,s as g,t as _}from"./tasks-DZgkXWwu.js";import{L as v,N as y,R as b,_ as x,a as S,c as C,s as w,t as T}from"./index-CbJnPhSw.js";import{t as E}from"./Markdown-Dkiv3bKi.js";import{n as D,t as O}from"./Pane-BXpuXst6.js";import{t as k}from"./SubjectThread-BWbOV_wk.js";var A=t();function j({stage:e,index:t,task:n,members:r,now:i}){let a=e.completedBy!==void 0,o=m(n,e),c=t===n.stages.length-1,l=o&&n.status===`claimed`?n.claimedBy:void 0,u=e.holders.filter(t=>t!==l&&t!==e.completedBy),d=n.returned?.from===e.id?n.returned:void 0;return(0,A.jsxs)(`li`,{className:`relative flex gap-3 pb-4`,children:[c?null:(0,A.jsx)(`span`,{"aria-hidden":`true`,className:`absolute top-6 bottom-0 left-2.5 w-px bg-line`}),(0,A.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,A.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,A.jsxs)(`p`,{className:`text-sm ${o?`font-medium text-fg-primary`:`text-fg-secondary`}`,children:[e.name,e.gate?(0,A.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,A.jsxs)(`p`,{className:`mt-0.5 text-meta`,children:[`for `,h(e),l===void 0?null:(0,A.jsxs)(A.Fragment,{children:[` · held by `,(0,A.jsx)(w,{name:l,members:r})]}),e.completedBy!==void 0&&e.completedAt!==void 0?` · done by ${e.completedBy} ${s(e.completedAt,i)}`:o&&n.status===`open`?` · waiting since ${s(n.stageSince,i)}`:``,u.length>0?` · held before by ${u.join(`, `)}`:``,d===void 0?``:` · sent back by ${d.by} ${s(d.at,i)}`]})]})]})}function M({taskId:e}){let{api:t}=n(),r=a(),i=b({mutationFn:()=>t.openThread({task_id:e}),onSuccess:()=>{r.invalidateQueries({queryKey:[`threads`]})}});return(0,A.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,A.jsx)(S,{variant:`primary`,disabled:i.isPending,onClick:()=>i.mutate(),children:i.isPending?`Opening…`:`Open its thread`}),(0,A.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 N(){let{taskId:t}=v({from:`/task/$taskId`}),n=e(t),a=i(),m=l(),h=o(),b=c(3e4);if(n.data===void 0)return(0,A.jsx)(D,{children:n.error instanceof y&&n.error.status===404?`There is no task ${t}.`:`Reading the task…`});let S=n.data,w=g(S),N=m.data?.find(e=>e.slug===S.project),P=a.data?.find(e=>e.id===S.id);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(O,{leading:(0,A.jsx)(r,{to:`/p/$slug/tasks`,params:{slug:S.project},"aria-label":`Back to the tasks of ${N?.name??S.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:S.title,subtitle:`${N?.name??S.project} · ${d(S)} · created by ${C(S.createdBy)} ${s(S.createdAt,b)}`,trailing:(0,A.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium ${p[w]}`,children:_.find(e=>e.phase===w)?.label.toLowerCase()})}),(0,A.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-4 py-4`,children:[(0,A.jsx)(`h3`,{className:`text-section`,children:`Plan`}),S.returned===void 0?null:(0,A.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 `,f(S,S.returned.from),` by `,S.returned.by,` `,s(S.returned.at,b),`. The work is redone from`,` `,f(S,S.stage),` until it reaches that stage again.`]}),(0,A.jsx)(`ol`,{className:`mt-3`,children:S.stages.map((e,t)=>(0,A.jsx)(j,{stage:e,index:t,task:S,members:h.data,now:b},e.id))}),(0,A.jsxs)(`p`,{className:`text-meta`,children:[`When the last stage is done:`,` `,S.onDone===`merge`?`task/${S.id} merges onto the default branch`:`nothing more`,S.blockedBy.length>0?(0,A.jsxs)(A.Fragment,{children:[` · blocked by `,(0,A.jsx)(x,{text:S.blockedBy.join(`, `)})]}):null]}),S.body.trim()===``?null:(0,A.jsxs)(`section`,{className:`mt-5 border-t border-line pt-4`,children:[(0,A.jsx)(`h3`,{className:`text-section`,children:`Brief`}),(0,A.jsx)(`div`,{className:`mt-2`,children:(0,A.jsx)(E,{text:S.body})})]}),(0,A.jsxs)(`section`,{"aria-label":`Thread`,className:`mt-5 border-t border-line pt-4`,children:[(0,A.jsx)(`h3`,{className:`text-section`,children:`Thread`}),a.data===void 0?null:P===void 0?u(S)?(0,A.jsx)(M,{taskId:S.id}):(0,A.jsx)(`p`,{className:`mt-2 text-meta`,children:`No thread on this task.`}):(0,A.jsx)(k,{thread:P,now:b,task:S,empty:`Nothing said yet. Each stage's handover lands here, and so does anything written below.`})]})]}),P?.state===`open`?(0,A.jsx)(T,{target:{threadId:S.id},placeholder:`Write in the task's thread`}):null]})}export{N as TaskView};
@@ -0,0 +1 @@
1
+ import{An as e,Ft as t,Pn as n,_t as r,j as i,jn as a,m as o,t as s,v as c,y as l}from"./format-DZLzLk7S.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-DZgkXWwu.js";import{L as _,s as v}from"./index-CbJnPhSw.js";import{n as y,t as b}from"./Pane-BXpuXst6.js";var x=n(a(),1),S=e();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:i}){let a=h(e),o=r(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,` `,s(e.returned.at,i)]}),(0,S.jsx)(`p`,{className:`mt-1.5 truncate text-meta`,children:e.status===`claimed`&&a!==`landing`&&o!==void 0?(0,S.jsxs)(S.Fragment,{children:[o.name,` · held by `,(0,S.jsx)(v,{name:e.claimedBy??``,members:n})]}):e.status===`open`&&a!==`landing`&&o!==void 0?`${o.name} · waiting for ${m(o)} since ${s(e.stageSince,i)}`:a===`landing`?`landing task/${e.id} on the default branch`:`${a} ${s(e.updatedAt,i)}`})]})})}function E(){let{slug:e}=_({from:`/p/$slug/tasks`}),t=i(e),n=l(),r=o(),a=c(3e4),[s,u]=(0,x.useState)(new Set),f=n.data?.find(t=>t.slug===e),p=d(t.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??e} · ${m} in play · ${t.data?.length??0} in all`}),(0,S.jsx)(`div`,{className:`flex-1 overflow-y-auto px-2 py-2`,children:t.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`||s.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:r.data,now:a},e.id))}),t.length<e.tasks.length?(0,S.jsxs)(`button`,{type:`button`,onClick:()=>u(new Set([...s,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{An as e,Ft as t,n,t as r}from"./format-DZLzLk7S.js";import{_ as i}from"./index-CbJnPhSw.js";var a=e();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:e,now:c}){let l=e.state===`closed`?n(e.body,180):``,u=e.messages===1?`1 message`:`${e.messages} messages`;return(0,a.jsxs)(t,{to:`/thread/$threadId`,params:{threadId:e.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:e.title}),(0,a.jsx)(s,{state:e.state})]}),(0,a.jsxs)(`p`,{className:`mt-1 text-meta`,children:[o(e.subject),` thread by `,e.openedBy,` · `,u,` · opened`,` `,r(e.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};
@@ -0,0 +1 @@
1
+ import{An as e,C as t,E as n,Pn as r,jn as i,kn as a,m as o}from"./format-DZLzLk7S.js";import{F as s,N as c,R as l,a as u,n as d,r as f}from"./index-CbJnPhSw.js";var p=r(i(),1),m=e(),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 c?e.message:`The board did not take it.`})}function _({channel:e,onDone:r}){let{api:i}=n(),c=a(),_=s(),v=o(),y=t(),[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 t=await i.openThread({channel:e,title:b.trim()});return S.trim()!==``&&await i.sendMessage({thread_id:t.id,body:S.trim()}),t},onSuccess:e=>{c.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:t,onDone:r}){let{api:i}=n(),o=a(),[s,c]=(0,p.useState)(``),d=(0,p.useRef)(null);(0,p.useEffect)(()=>d.current?.focus(),[]);let f=l({mutationFn:()=>i.closeThread({thread_id:e,summary:s.trim()}),onSuccess:()=>{for(let n of[[`thread`,e],[`threads`],[`channel`,t]])o.invalidateQueries({queryKey:n});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 #${t}.`,"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)(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};
@@ -0,0 +1 @@
1
+ import{A as e,An as t,E as n,Ft as r,Pn as i,jn as a,ln as o,m as s,t as c,v as l}from"./format-DZLzLk7S.js";import{L as u,M as d,N as f,a as p,c as m,t as h}from"./index-CbJnPhSw.js";import{t as g}from"./Markdown-Dkiv3bKi.js";import{t as _}from"./MessageItem-sep2BGUh.js";import{n as v,t as y}from"./Pane-BXpuXst6.js";import{r as b,t as x}from"./ThreadCard-BisvLnYg.js";import{t as S}from"./ThreadForms-DZ1yLsjU.js";import{t as C}from"./useStickyScroll-CVTdIoKj.js";var w=i(a(),1),T=t();function E(){let{threadId:e}=u({from:`/thread/$threadId`});return(0,T.jsx)(D,{id:e},e)}function D({id:t}){let{api:i}=n(),a=o({queryKey:[`thread`,t],queryFn:()=>i.thread(t)}),u=s(),E=l(3e4),D=a.data?.messages??[],O=D.at(-1)?.id??null;(0,w.useEffect)(()=>d(t,O),[t,O]);let{ref:k,onScroll:A}=C(),[j,M]=(0,w.useState)(!1),N=a.data?.thread.subject,P=e(N?.kind===`task`?N.id:null);if(a.data===void 0)return(0,T.jsx)(v,{children:a.error instanceof f&&a.error.status===404?`There is no thread ${t}.`:`Reading the thread…`});let{thread:F}=a.data;return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(y,{leading:(0,T.jsx)(r,{to:`/c/$`,params:{_splat:F.channel},"aria-label":`Back to #${F.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:F.title,subtitle:`${b(F.subject)} thread in #${F.channel} · opened by ${m(F.openedBy)} ${c(F.openedAt,E)}`,trailing:(0,T.jsxs)(T.Fragment,{children:[F.subject?.kind===`task`?(0,T.jsx)(r,{to:`/task/$taskId`,params:{taskId:F.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 →`}):F.subject?.kind===`proposal`?(0,T.jsx)(r,{to:`/proposal/$proposalId`,params:{proposalId:F.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,F.state===`open`&&!j&&F.subject?.kind!==`task`?(0,T.jsx)(p,{onClick:()=>M(!0),children:`Close`}):(0,T.jsx)(x,{state:F.state})]})}),j&&F.state===`open`?(0,T.jsx)(S,{threadId:F.id,channel:F.channel,onDone:()=>M(!1)}):null,(0,T.jsxs)(`div`,{ref:k,onScroll:A,className:`flex-1 overflow-y-auto py-2`,children:[D.length===0?(0,T.jsx)(v,{children:`No messages in this thread yet.`}):null,D.map(e=>(0,T.jsx)(_,{message:e,members:u.data,now:E,task:P.data},e.id)),F.state===`closed`?(0,T.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,T.jsxs)(`p`,{className:`text-caps`,children:[`Closed by `,m(F.closedBy??`board`),F.closedAt===void 0?``:` ${c(F.closedAt,E)}`]}),F.body.trim()===``?(0,T.jsxs)(`p`,{className:`mt-1 text-meta`,children:[`It ended with its `,b(F.subject),`.`]}):(0,T.jsx)(g,{text:F.body})]}):null]}),F.state===`open`?(0,T.jsx)(h,{target:{threadId:F.id},placeholder:`Reply in the thread`}):null]})}export{E as ThreadView};
@@ -1 +1 @@
1
- import{ut as e}from"./format-Ca2VAvEx.js";import{u as t}from"./index-D4GJkeKU.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`};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`}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{dt as e}from"./format-DZLzLk7S.js";import{u as t}from"./index-CbJnPhSw.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`};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`}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};
@@ -0,0 +1,55 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,o)=>(o=n==null?{}:e(i(n)),c(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n)),u=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.for(`react.view_transition`),m=Symbol.iterator;function h(e){return typeof e!=`object`||!e?null:(e=m&&e[m]||e[`@@iterator`],typeof e==`function`?e:null)}var ee={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,te={};function ne(e,t,n){this.props=e,this.context=t,this.refs=te,this.updater=n||ee}ne.prototype.isReactComponent={},ne.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},ne.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function _(){}_.prototype=ne.prototype;function re(e,t,n){this.props=e,this.context=t,this.refs=te,this.updater=n||ee}var ie=re.prototype=new _;ie.constructor=re,g(ie,ne.prototype),ie.isPureReactComponent=!0;var ae=Array.isArray;function oe(){}var v={H:null,A:null,T:null,S:null},se=Object.prototype.hasOwnProperty;function y(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function ce(e,t){return y(e.type,t,e.props)}function b(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function le(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var ue=/\/+/g;function x(e,t){return typeof e==`object`&&e&&e.key!=null?le(``+e.key):t.toString(36)}function de(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(oe,oe):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function S(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,S(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+x(e,0):a,ae(o)?(i=``,c!=null&&(i=c.replace(ue,`$&/`)+`/`),S(o,r,i,``,function(e){return e})):o!=null&&(b(o)&&(o=ce(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(ue,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(ae(e))for(var u=0;u<e.length;u++)a=e[u],s=l+x(a,u),c+=S(a,r,i,s,o);else if(u=h(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+x(a,u++),c+=S(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return S(de(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function C(e,t,n){if(e==null)return e;var r=[],i=0;return S(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function fe(e){if(e._status===-1){var t=e._result,n=t();n.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t,n.status===void 0&&(n.status=`fulfilled`,n.value=t))},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t,n.status===void 0&&(n.status=`rejected`,n.reason=t))}),e._status===-1&&(e._status=0,e._result=n)}if(e._status===1)return e._result.default;throw e._result}var w=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)};function pe(e){var t=v.T,n={};n.types=t===null?null:t.types,v.T=n;try{var r=e(),i=v.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(oe,w)}catch(e){w(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),v.T=t}}function me(e){var t=v.T;if(t!==null){var n=t.types;n===null?t.types=[e]:n.indexOf(e)===-1&&n.push(e)}else pe(me.bind(null,e))}var T={map:C,forEach:function(e,t,n){C(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return C(e,function(){t++}),t},toArray:function(e){return C(e,function(e){return e})||[]},only:function(e){if(!b(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=T,e.Component=ne,e.Fragment=r,e.Profiler=a,e.PureComponent=re,e.StrictMode=i,e.Suspense=l,e.ViewTransition=p,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=v,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return v.H.useMemoCache(e)}},e.addTransitionType=me,e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!se.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return y(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)se.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return y(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=b,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:fe}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=pe,e.unstable_useCacheRefresh=function(){return v.H.useCacheRefresh()},e.use=function(e){return v.H.use(e)},e.useActionState=function(e,t,n){return v.H.useActionState(e,t,n)},e.useCallback=function(e,t){return v.H.useCallback(e,t)},e.useContext=function(e){return v.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return v.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return v.H.useEffect(e,t)},e.useEffectEvent=function(e){return v.H.useEffectEvent(e)},e.useId=function(){return v.H.useId()},e.useImperativeHandle=function(e,t,n){return v.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return v.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return v.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return v.H.useMemo(e,t)},e.useOptimistic=function(e,t){return v.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return v.H.useReducer(e,t,n)},e.useRef=function(e){return v.H.useRef(e)},e.useState=function(e){return v.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return v.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return v.H.useTransition()},e.version=`19.3.0`})),d=o(((e,t)=>{t.exports=u()})),f=o((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.fragment`);function r(e,n,r){var i=null;if(r!==void 0&&(i=``+r),n.key!==void 0&&(i=``+n.key),`key`in n)for(var a in r={},n)a!==`key`&&(r[a]=n[a]);else r=n;return n=r.ref,{$$typeof:t,type:e,key:i,ref:n===void 0?null:n,props:r}}e.Fragment=n,e.jsx=r,e.jsxs=r})),p=o(((e,t)=>{t.exports=f()})),m=l(d(),1),h=p(),ee=m.createContext(void 0),g=e=>{let t=m.useContext(ee);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},te=({client:e,children:t})=>(m.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,h.jsx)(ee.Provider,{value:e,children:t})),ne={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},_=new class{#e=ne;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function re(e){setTimeout(e,0)}var ie=typeof window>`u`||`Deno`in globalThis;function ae(){}function oe(e,t){return typeof e==`function`?e(t):e}function v(e){return typeof e==`number`&&e>=0&&e!==1/0}function se(e,t){return Math.max(e+(t||0)-Date.now(),0)}function y(e,t){return typeof e==`function`?e(t):e}function ce(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==le(o,t.options))return!1}else if(!x(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function b(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(ue(t.options.mutationKey)!==ue(a))return!1}else if(!x(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function le(e,t){return(t?.queryKeyHashFn||ue)(e)}function ue(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function x(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(e&&t&&typeof e==`object`&&typeof t==`object`){if(Array.isArray(e)&&Array.isArray(t)){if(t.length>e.length)return!1;for(let n=0;n<t.length;n++)if(!x(e[n],t[n]))return!1;return!0}let n=Object.keys(t);for(let r of n)if(!x(e[r],t[r]))return!1;return!0}return!1}var de=Object.prototype.hasOwnProperty;function S(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=fe(e)&&fe(t);if(!r&&!(w(e)&&w(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:de.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=S(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function C(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function fe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!pe(e))return!1;let t=Object.getPrototypeOf(e),n=t?.constructor;if(n===void 0)return!0;if(typeof n!=`function`)return!1;let r=n.prototype;return!(!pe(r)||!r.hasOwnProperty(`isPrototypeOf`)||t!==Object.prototype)}function pe(e){return Object.prototype.toString.call(e)===`[object Object]`}function me(e){return new Promise(t=>{_.setTimeout(t,e)})}function T(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:S(e,t)}function he(e){return e}function ge(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function _e(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var ve=Symbol();function ye(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===ve?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function be(e,t){return typeof e==`function`?e(...t):!!e}function xe(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Se=()=>ie,Ce=()=>Se(),we=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Te=new class extends we{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},Ee=re;function De(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Ee,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Oe=De(),ke=new class extends we{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Ae(e){return Math.min(1e3*2**e,3e4)}function je(e){return(e??`online`)!==`online`||ke.isOnline()}var Me=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function Ne(e){let t=!1,n=0,r,i=`pending`,a,o,s=new Promise((e,t)=>{a=e,o=t});s.catch(ae);let c=()=>i!==`pending`,l=t=>{if(!c()){let n=new Me(t);h(n),e.onCancel?.(n)}},u=()=>{t=!0},d=()=>{t=!1},f=()=>Te.isFocused()&&(e.networkMode===`always`||ke.isOnline())&&e.canRun(),p=()=>je(e.networkMode)&&e.canRun(),m=e=>{c()||(r?.(),i=`resolved`,a(e))},h=e=>{c()||(r?.(),i=`rejected`,o(e))},ee=()=>new Promise(t=>{r=e=>{(c()||f())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,c()||e.onContinue?.()}),g=()=>{if(c())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(m).catch(r=>{if(c())return;let i=e.retry??(Ce()?0:3),a=e.retryDelay??Ae,o=typeof a==`function`?a(n,r):a,s=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!s){h(r);return}n++,e.onFail?.(n,r),me(o).then(()=>f()?void 0:ee()).then(()=>{t?h(r):g()})})};return{promise:s,status:()=>i,cancel:l,continue:()=>(r?.(),s),cancelRetry:u,continueRetry:d,canStart:p,start:()=>(p()?g():ee().then(g),s)}}var Pe=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),v(this.gcTime)&&(this.#e=_.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Ce()?1/0:3e5))}clearGcTimeout(){this.#e!==void 0&&(_.clearTimeout(this.#e),this.#e=void 0)}};function Fe(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{xe(e,()=>t.signal,()=>n=!0)},u=ye(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=(()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})(),o=await u(a),{maxPages:s}=t.options,c=i?_e:ge;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,r,s)}};if(i&&a.length){let e=i===`backward`,t=e?Le:Ie,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:Ie(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.fetchFn=t.options.persister?()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):l}}}function Ie(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function Le(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Re=class extends Pe{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Ve(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=Ve(this.options);e.data!==void 0&&(this.setState(Be(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=T(this.state.data,e,this.options);return this.#c({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#c({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(ae).catch(ae):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>y(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===ve||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0&&this.observers.some(e=>y(e.options.staleTime,this)===`static`)}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!se(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){let t=this.observers.indexOf(e);t!==-1&&(this.observers.splice(t,1),this.observers.length||(this.#a&&(this.#s||this.state.fetchStatus===`paused`&&this.state.status===`pending`?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#c({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=ye(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?Fe(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#c({type:`fetch`,meta:a.fetchOptions?.meta});let o=this.#a=Ne({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Me&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#c({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#c({type:`pause`})},onContinue:()=>{this.#c({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await o.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Me){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#c({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.#a===o&&(this.#a=void 0),this.scheduleGc()}}#c(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...ze(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...Be(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Oe.batch(()=>{this.observers.slice().forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function ze(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:je(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function Be(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function Ve(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var He=class extends we{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),We(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ge(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ge(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof y(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!C(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&Ke(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||y(this.options.staleTime,this.#t)!==y(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||y(this.options.enabled,this.#t)!==y(t.enabled,this.#t)||i!==this.#f)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return C(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(ae)),t}#h(e){return!Ce()&&y(this.options.enabled,this.#t)!==!1&&v(e)}#g(){this.#b();let e=y(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let t=se(this.#r.dataUpdatedAt,e)+1;this.#u=_.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return y(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,this.#f!==0&&this.#h(this.#f)&&(this.#d=_.setInterval(()=>{(this.options.refetchIntervalInBackground||Te.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(_.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(_.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&We(e,t),o=i&&Ke(e,n,t,r);(a||o)&&(l={...l,...ze(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:m}=l;d=l.data;let h=!1;if(t.placeholderData!==void 0&&d===void 0&&m===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,h=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(m=`success`,d=T(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!h){if(i&&d===a?.data&&t.select===this.#s)d=this.#c;else try{this.#s=t.select,d=t.select(d),d=T(i?.data,d,t),this.#c=d,this.#o=null}catch(e){this.#o=e}}else d===void 0&&(this.#o=null);this.#o&&(f=this.#o,d=this.#c,p=Date.now(),m=`error`,u=!1);let ee=l.fetchStatus===`fetching`,g=m===`pending`,te=m===`error`,ne=g&&ee,_=d!==void 0;return{status:m,fetchStatus:l.fetchStatus,isPending:g,isSuccess:m===`success`,isError:te,isInitialLoading:ne,isLoading:ne,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:ee,isRefetching:ee&&!g,isLoadingError:te&&!_,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:te&&_,isStale:qe(e,t),refetch:this.refetch,isEnabled:y(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),C(t,e))return;this.#r=t;let n=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();Oe.batch(()=>{n&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function Ue(e,t){return y(t.enabled,e)!==!1&&e.state.data===void 0&&(e.state.status!==`error`||y(t.retryOnMount,e)!==!1)}function We(e,t){return Ue(e,t)||e.state.data!==void 0&&Ge(e,t,t.refetchOnMount)}function Ge(e,t,n){if(y(t.enabled,e)!==!1&&y(t.staleTime,e)!==`static`){let r=y(n,e);return r===`always`||r!==!1&&qe(e,t)}return!1}function Ke(e,t,n,r){return(e!==t||y(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&qe(e,n)}function qe(e,t){return y(t.enabled,e)!==!1&&e.isStaleByTime(y(t.staleTime,e))}function Je(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}var Ye=class extends we{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,Oe.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!C(e,n)});(o||s)&&(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Je(e,n).forEach(e=>{e.destroy()}),Je(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){let n=new Set;return t.map((r,i)=>{let a=e[i];return r.defaultedQueryOptions.notifyOnChangeProps?a:r.observer.trackResult(a,e=>{n.has(e)||(n.add(e),t.forEach(t=>{t.observer.trackProp(e)}))})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=S(this.#a,t(e))),this.#a}return e}#f(){return!this.#r?.combine||this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new He(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=this.#t.slice(),this.#t[n]=t,this.#h())}#h(){if(this.hasListeners()){let e=this.#f(),t=this.#a,n=e?t:this.#d(this.#u(this.#t,this.#l),this.#r?.combine);(e||t!==n)&&Oe.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},Xe=m.createContext(!1),Ze=()=>m.useContext(Xe);Xe.Provider;function Qe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $e=m.createContext(Qe()),et=()=>m.useContext($e),tt=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?be(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},nt=e=>{m.useEffect(()=>{e.clearReset()},[e])},rt=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||be(n,[e.error,r])),it=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},at=(e,t)=>e?.suspense&&t.isPending,ot=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function st({queries:e,...t},n){let r=g(n),i=Ze(),a=et(),o=t.subscribed!==!1,s=m.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:o?`optimistic`:void 0,t}),[e,r,i,o]);s.forEach(e=>{it(e);let t=r.getQueryCache().get(e.queryHash);tt(e,a,t)}),nt(a);let[c]=m.useState(()=>new Ye(r,s,t)),[l,u,d]=c.getOptimisticResult(s,t.combine),f=!i&&o;m.useSyncExternalStore(m.useCallback(e=>f?c.subscribe(Oe.batchCalls(e)):ae,[c,f]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),m.useEffect(()=>{c.setQueries(s,t)},[s,t,c]);let p=l.some((e,t)=>at(s[t],e))?l.flatMap((e,t)=>{let n=s[t];return n&&at(n,e)?ot(n,new He(r,n),a):[]}):[];if(p.length>0)throw Promise.all(p);let h=l.find((e,t)=>{let n=s[t];return n&&rt({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(h)throw h.error;return u(d())}function ct(e,t,n){let r=Ze(),i=et(),a=g(n),o=a.defaultQueryOptions(e),s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,it(o),tt(o,i,s),nt(i);let[l]=m.useState(()=>new t(a,o)),u=l.getOptimisticResult(o),d=!r&&c;if(m.useSyncExternalStore(m.useCallback(e=>{let t=d?l.subscribe(Oe.batchCalls(e)):ae;return l.updateResult(),t},[l,d]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),m.useEffect(()=>{l.setOptions(o)},[o,l]),at(o,u))throw ot(o,l,i);if(rt({result:u,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw u.error;return o.notifyOnChangeProps?u:l.trackResult(u)}function E(e,t){return ct(e,He,t)}function lt(e){return e[e.length-1]}function ut(e,t){return typeof e==`function`?e(t):e}var dt=Object.prototype.hasOwnProperty;function ft(e){for(let t in e)if(dt.call(e,t))return!0;return!1}var pt=()=>Object.create(null),mt=(e,t)=>ht(e,t,!0);function ht(e,t,n,r=0){if(e===t)return e;if(r++>500)return t;let i=Array.isArray(e)&&Array.isArray(t);if(!i&&!(gt(e)&&gt(t)))return t;let a=Object.keys(e),o=a.length,s=Object.keys(t),c=s.length;if(i?o!==e.length||c!==t.length||o&&lt(a)!==`${o-1}`||c&&lt(s)!==`${c-1}`:o!==Object.getOwnPropertyNames(e).length||c!==Object.getOwnPropertyNames(t).length||Object.getOwnPropertySymbols(t).length)return t;let l=0,u,d,f;if(i){for(;l<c&&(f=l,d=e[f],u=t[f],u=d===u?d:typeof d==`object`?ht(d,u,n,r):u,u===d);l++);if(l===c&&o===c)return e}else{let i=o===c,p=!0;for(;l<c;l++){f=s[l],d=e[f];let o=t[f];u=d===o?d:typeof d==`object`?ht(d,o,n,r):o,i&&=u===d&&(a[l]===f||dt.call(e,f)),p&&=Object.is(u,o),a[l]=u}if(i)return Object.getOwnPropertySymbols(e).length?t:e;if(p)return t}let p=i?s.fill(0):n?pt():{};for(let o=0;o<c;o++)f=i?o:s[o],i?(d=e[f],o>l&&(u=t[f],u=d===u?d:typeof d==`object`?ht(d,u,n,r):u),p[f]=o<l?d:u):p[f]=a[o];return p}function gt(e){return!e||typeof e!=`object`?!1:(Object.getPrototypeOf(e)?.constructor??Object)===Object}function _t(e,t,n,r){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let i=0,a=e.length;i<a;i++){let a=e[i],o=t[i];if(a!==o&&!_t(a,o,n,r))return!1}return!0}if(gt(e)&&gt(t)){if(n){for(let i in t)if((r||t[i]!==void 0)&&!_t(e[i],t[i],n,r))return!1;return!0}let i=0;if(r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;for(let a in t)if((r||t[a]!==void 0)&&(i--===0||!_t(e[a],t[a],n,r)))return!1;return i===0}return!1}function vt(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var yt=/[\x00-\x1f\x7f"<>`{}]/g;function bt(e){return e.replace(yt,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function xt(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return bt(t)}var St=[`http:`,`https:`,`mailto:`,`tel:`];function Ct(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var wt=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function Tt(e,t){if(!e)return!1;if(wt.test(e))return!0;let n=Ct(e);return n?!t.has(n):!1}function Et(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=xt(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=xt(r?e.slice(r):e)}return t}function Dt(e){return/[\s\u0080-\uFFFF]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function Ot(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function kt(e){return e.replace(/\/{2,}/g,`/`)}function At(e){return e===`/`?e:e.replace(/^\/+/,``)}function jt(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/+$/,``):e}function Mt(e){return jt(At(e))}function Nt(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Pt(e,t,n=`never`,r){if(t.includes(`//`)&&(t=kt(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=kt(e)),o=e.split(`/`);o.length>1&&lt(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(lt(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?kt(s):s)||`/`;return a&&r&&r.set(a,c),c}function Ft(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=new RegExp([...t.keys()].join(`|`).replace(/[.*()]/g,`\\$&`),`g`);return e=>e.replace(n,e=>t.get(e)??e)}function It(e){return e==null||e===``}function Lt(e,t,n){if(typeof t!=`string`)return``+(t??void 0);let r=e===`_splat`;if(r&&(!t||/^[a-zA-Z0-9\-._~!/]*$/.test(t)))return t;let i=encodeURIComponent(t);return r&&(i=i.replaceAll(`%2F`,`/`)),n?n(i):i}function Rt(e,t,n,r,i){let a=e.endsWith(`/`)?`/`:``,o=``;for(let e of t){if(typeof e==`string`){o+=e;continue}let[t,s,c,l]=e,u=t===2,d=u&&l!==void 0?l+a:l,f=n[s];if(t!==3||f!=null){if(i&&(i[s]=f,u&&(i[`*`]=f)),u&&It(f)){if(c===`/`&&!d)continue;f=``}o+=c+Lt(s,f,r)+(d||``)}}return o+a||`/`}var zt=`Error preloading route! ☝️`,Bt=()=>!0,Vt=()=>!1;function Ht({children:e,fallback:t=null}){return(0,h.jsx)(m.Fragment,{children:Ut()?e:t})}function Ut(e=!0){return m.useSyncExternalStore(Wt,Bt,e?Vt:Bt)}function Wt(){return()=>{}}var Gt=m.createContext(null);function Kt(e){return m.useContext(Gt)}var qt=o((e=>{var t=d();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Jt=o(((e,t)=>{t.exports=qt()})),Yt=o((e=>{var t=d(),n=Jt();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Xt=o(((e,t)=>{t.exports=Yt()}))();function Zt(e,t){return e===t}function Qt(e,t=e=>e,n){let r=n?.compare??Zt,i=(0,m.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,m.useCallback)(()=>e.get(),[e]);return(0,Xt.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function $t(...e){let t=m.useRef(e),n=t.current;return e.forEach((e,t)=>{_t(n[t],e,!1,!0)||(n[t]=e)}),t.current}function en(e,t){e.preloadRoute(t).catch(e=>{console.warn(e),console.warn(zt)})}var tn={compare:(e,t)=>e[0]===t[0]&&e[1]===t[1]};function nn(e,t){let n=typeof e==`string`&&Ct(e);if(n)return t.has(n)?e:null}function rn(e,t,n,r,i){let a=Nt(e.pathname,r),o=Nt(t.pathname,r);return(n?.exact?a!==o:!a.startsWith(o)||a.length!==o.length&&a[o.length]!==`/`)||(n?.includeSearch??!0)&&!_t(e.search,t.search,!n?.exact,n?.explicitUndefined)?!1:!n?.includeHash||i&&e.hash===t.hash}function an(e,t,n){let r=Kt(),i=m.useRef(null),a=m.useCallback(e=>{if(i.current=e,typeof t==`function`)return t(e);t&&(t.current=e)},[t]),{activeOptions:o,to:s,preload:c,preloadDelay:l,hashScrollIntoView:u,replace:d,startTransition:f,resetScroll:p,viewTransition:h,ignoreBlocker:ee,disabled:g,target:te,onClick:ne,onBlur:_,onFocus:re,onMouseEnter:ie,onMouseLeave:ae,onTouchStart:oe}=e,v=Ut(!!o?.includeHash),[se,y,ce]=$t(e.search,e.params,o),[b,le]=m.useMemo(()=>[e,{...e}],[r,e.from,e._fromLocation,e.hash,e.to,se,y,e.state,e.mask,e.unsafeRelative]),ue=m.useCallback(e=>{let t=nn(s,r.protocolAllowlist);if(t!==void 0)return[t??void 0];b._fromLocation||(le._fromLocation=e);let n=r.buildLocation(le),i=mn(n,r,g);return[i,!g&&(!i||Ct(i))?void 0:rn(e,n,ce,r.basepath,v)]},[ce,g,v,b,le,r,s]),[x,de]=Qt(r.stores.location,ue,tn),S=de===void 0?x:void 0,C=g||x===void 0,fe=m.useRef(!1),w=e.reloadDocument||S||C?!1:c??r.options.defaultPreload,pe=l??r.options.defaultPreloadDelay??0,me=m.useCallback(e=>{let t=e?.isIntersecting;if(!(t??w===`intent`)){t===!1&&fn(i);return}if(!pe){en(r,b);return}dn.has(i)||dn.set(i,setTimeout(()=>{dn.delete(i),en(r,b)},pe))},[r,b,i,w,pe]);m.useEffect(()=>{if(!w)return;w===`render`&&!fe.current&&(fe.current=!0,en(r,b));let e=!0,t;return w===`viewport`&&i.current&&typeof IntersectionObserver==`function`&&(t=new IntersectionObserver(t=>{e&&me(t.pop())},{rootMargin:`100px`}),t.observe(i.current)),()=>{e=!1,t?.disconnect(),fn(i)}},[r,b,w,me,i]);let T=ln(e,n);if(T.ref=t?a:i,S)return T.href=S,T;let he=e=>{let t=te??e.currentTarget.getAttribute(`target`);!C&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!t||t===`_self`)&&e.button===0&&(e.preventDefault(),r.navigate({...b,replace:d,resetScroll:p,hashScrollIntoView:u,startTransition:f,viewTransition:h,ignoreBlocker:ee}))},ge=()=>{w===`intent`&&en(r,b)},_e=()=>{w===`intent`&&fn(i)};return T.onClick=pn(ne,he),T.onBlur=pn(_,_e),T.onFocus=pn(re,me),T.onMouseEnter=pn(ie,me),T.onMouseLeave=pn(ae,_e),T.onTouchStart=pn(oe,ge),un(T,e,de,x,C,n)}var on={},sn={className:`active`},cn=new Set([`to`,`params`,`search`,`hash`,`state`,`mask`,`from`,`unsafeRelative`,`_fromLocation`,`reloadDocument`,`preload`,`preloadDelay`,`preloadIntentProximity`,`hashScrollIntoView`,`replace`,`startTransition`,`resetScroll`,`viewTransition`,`ignoreBlocker`,`activeProps`,`inactiveProps`,`activeOptions`,`_asChild`]);function ln(e,t){let n={};for(let r in e)cn.has(r)||r===`type`&&t!==void 0||r===`disabled`&&t===`a`||(n[r]=e[r]);return n}function un(e,t,n,r,i,a){let{activeProps:o,inactiveProps:s,className:c,style:l,target:u}=t,d=ut(n?o:s,{})??(n?sn:on);Object.assign(e,d),e.href=r,a!==`a`&&(e.disabled=i),e.target=u;let f=d.style;(l||f)&&(e.style=l&&f?{...l,...f}:l||f);let p=d.className;return(c||p)&&(e.className=c?p?`${c} ${p}`:c:p),i&&(e.role=`link`,e[`aria-disabled`]=!0),n&&(e[`data-status`]=`active`,e[`aria-current`]=`page`),e}var dn=new WeakMap,fn=e=>{clearTimeout(dn.get(e)),dn.delete(e)},pn=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function mn(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!Tt(i,t.protocolAllowlist))return i}var hn=m.memo(m.forwardRef((e,t)=>{let n=e._asChild||`a`,r=an(e,t,n),i=typeof e.children==`function`?e.children({isActive:r[`data-status`]===`active`}):e.children;return m.createElement(n,r,i)}),gn);function gn(e,t){let n=0;for(let r in t)if(n++,e[r]!==t[r]&&(!cn.has(r)||!_t(e[r],t[r],!1,!0)))return!1;for(let t in e)n--;return n===0}function _n(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function vn(e,t=`|`){return e.map(e=>Hn(e)).join(t)}function yn(e,t){return typeof t==`bigint`?t.toString():t}var bn=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function xn(e){return new bn(e)}function Sn(e){return e==null}function Cn(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function wn(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function Tn(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function En(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function Dn(e){return En(e._zod.def)??e._zod.def.shape}function On(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return Tn(this,t,e),e},enumerable:!0,configurable:!0})}function kn(e,t,n){t in e?Tn(e,t,n):e[t]=n}function An(e,t,n,r){let i=Dn(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?On(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):kn(e,a,r?r(n.value,a):n.value))}}function jn(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?On(e,n,()=>t[n]):kn(e,n,r.value))}}function D(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function Mn(e){return JSON.stringify(e)}function Nn(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var Pn=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Fn(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var In=xn(()=>{if(j.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ln(e){if(Fn(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Fn(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Rn(e){return Ln(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var zn=new Set([`string`,`number`,`symbol`]);function Bn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Vn(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function O(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Hn(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function Un(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Wn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Gn={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Kn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return An(i,e,qn(e,t)),Vn(e,D(n,{shape:i,checks:[]}))}function qn(e,t){let n=Dn(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Jn(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(qn(e,t)),a={};return An(a,e,Reflect.ownKeys(Dn(e)).filter(e=>!i.has(e))),Vn(e,D(n,{shape:a,checks:[]}))}function Yn(e,t){if(!Ln(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=Dn(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Vn(e,D(e._zod.def,{shape:Xn(e,t)}))}function Xn(e,t){let n={};return An(n,e,Reflect.ownKeys(Dn(e))),jn(n,t),n}function Zn(e,t){if(!Ln(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Vn(e,D(e._zod.def,{shape:Xn(e,t)}))}function Qn(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return An(n,e,Reflect.ownKeys(Dn(e))),An(n,t,Reflect.ownKeys(Dn(t))),Vn(e,D(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function $n(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(qn(t,n)):void 0,o={};return An(o,t,Reflect.ownKeys(Dn(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Vn(t,D(t._zod.def,{shape:o,checks:[]}))}function er(e,t,n){let r=n?new Set(qn(t,n)):void 0,i={};return An(i,t,Reflect.ownKeys(Dn(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Vn(t,D(t._zod.def,{shape:i}))}function tr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function nr(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function rr(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ir(e){return typeof e==`string`?e:e?.message}function ar(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function or(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:ir(e.inst?._zod.def?.error?.(e))??ir(a?.(e))??ir(t?.error?.(e))??ir(n.customError?.(e))??ir(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var sr=/[\uD800-\uDBFF]/;function cr(e){let t=e.length;if(!sr.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function lr(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ur(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function dr(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function fr(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):gr(e,n,r.value)}}function pr(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function mr(e,t,n){return pr(e,t,n,!1)}function hr(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return pr(this,n,r(this))},set(e){pr(this,n,e)}})}return t}function gr(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:pr(this,t,n.bind(this))},set(e){pr(this,t,e)}})}function _r(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var vr,yr=!1,br={configurable:!0,get(){yr=!0}};function k(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&vr!==e._zod){vr=void 0;return}vr=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,br);let e=yr;yr=!1;try{let r=n(this);return yr?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),yr||=e,r}catch(n){throw delete this[t],yr||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function xr(e,t,n,r){let i=_r(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var Sr=`~constantCatch`;function Cr(e){let t=()=>e;return t[Sr]=!0,t}var wr,Tr={value:void 0,enumerable:!1},Er=`captureStackTrace`in Error?Error:null;function Dr(e){let t=Er;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return Er=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function A(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){Tr.value=new a(r);try{Object.defineProperty(n,"_zod",Tr)}finally{Tr.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),fr(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?Dr(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var Or=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},kr=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(wr=globalThis).__zod_globalConfig??(wr.__zod_globalConfig={});var j=globalThis.__zod_globalConfig;function Ar(e){return e&&Object.assign(j,e),j}function jr(){let e=this._zod;return e.message??=JSON.stringify(e.def,yn,2),e.message}function Mr(e){this._zod.message=e}var Nr={get:jr,set:Mr,enumerable:!0,configurable:!0},Pr={value:void 0,enumerable:!1},Fr=new WeakSet([Object.prototype,Error.prototype]),Ir=(e,t)=>{e.name=`$ZodError`,Pr.value=t,Object.defineProperty(e,"issues",Pr),Pr.value=void 0,Object.defineProperty(e,"message",Nr);let n=Object.getPrototypeOf(e);Fr.has(n)||(Fr.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Lr=A(`$ZodError`,Ir);A(`$ZodError`,Ir,void 0,{Parent:Error});function Rr(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function zr(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Rr(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Br(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function Vr(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Hr=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Or;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>or(e,o,Ar())));throw Pn(n,a?.callee??t),n}return s.value};return t},Ur=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>or(e,o,Ar())));throw Pn(n,a?.callee??t),n}return s.value};return t},Wr=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Or;return a.issues.length?Gr(e,a.issues,i):{success:!0,data:a.value}};function Gr(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>or(e,n,Ar()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Kr=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Gr(e,a.issues,i):{success:!0,data:a.value}},qr=Symbol.for(`zod.compile.invalid`),Jr=Symbol.for(`zod.compile.fallback`),Yr=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==qr)return!0;if(r.definite===!0&&n===void 0)return!1}return Xr(e,t,n)});function Xr(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[Jr]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new Or;return a.issues.length===0}var Zr=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Qr=e=>{let t=Hr(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,Vr(n,a))};return n},$r=e=>{let t=Hr(e),n=(e,r,i,a)=>t(e,r,i,Vr(n,a));return n},ei=e=>{let t=Ur(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,Vr(n,a))};return n},ti=e=>{let t=Ur(e),n=async(e,r,i,a)=>await t(e,r,i,Vr(n,a));return n},ni=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Wr(e)(t,n,i)},ri=e=>(t,n,r)=>Wr(e)(t,n,r),ii=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Kr(e)(t,n,i)},ai=e=>async(t,n,r)=>Kr(e)(t,n,r),oi=/^[cC][0-9a-z]{6,}$/,si=/^[0-9a-z]+$/,ci=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,li=/^[0-9a-vA-V]{20}$/,ui=/^[A-Za-z0-9]{27}$/,di=/^[a-zA-Z0-9_-]{21}$/;function fi(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var pi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,mi=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,hi=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,gi=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,_i=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function vi(){return new RegExp(_i,`u`)}var yi=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bi=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xi=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Si=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ci=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,wi=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Ti=/^https?$/,Ei=/^\+[1-9]\d{6,14}$/,Di=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Oi(e){return RegExp(`^${e}$`)}var ki=Oi(Di);function Ai(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function ji(e){return RegExp(`^${Ai(e)}$`)}function Mi(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Ai({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Ai({precision:e.precision})}`:n;return RegExp(`^${Di}T(?:${r})$`)}var Ni=/^[\s\S]{0,}$/,Pi=/^-?\d+$/,Fi=/^-?\d+(?:\.\d+)?$/,Ii=/^(?:true|false)$/i,Li=/^[^A-Z]*$/,Ri=/^[^a-z]*$/,M=A(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),zi=e=>{let t=e.value;return!Sn(t)&&t.length!==void 0},Bi={number:`number`,bigint:`bigint`,object:`date`},Vi=A(`$ZodCheckLessThan`,(e,t)=>{M.init(e,t);let n=Bi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:Bi[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Hi=A(`$ZodCheckGreaterThan`,(e,t)=>{M.init(e,t);let n=Bi[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:Bi[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Ui=A(`$ZodCheckMultipleOf`,(e,t)=>{M.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):wn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Wi=A(`$ZodCheckNumberFormat`,(e,t)=>{M.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Wn[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Gi=A(`$ZodCheckMaxLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=zi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?cr(r):i)<=t.maximum)return;let a=lr(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ki=A(`$ZodCheckMinLength`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=zi),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?cr(r):i)>=t.minimum)return;let a=lr(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),qi=A(`$ZodCheckLengthEquals`,(e,t)=>{var n;M.init(e,t),(n=e._zod.def).when??(n.when=zi),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?cr(r):i;if(a===t.length)return;let o=lr(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ji=A(`$ZodCheckStringFormat`,(e,t)=>{var n,r;M.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Yi=A(`$ZodCheckRegex`,(e,t)=>{Ji.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Xi=A(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Li,Ji.init(e,t)}),Zi=A(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Ri,Ji.init(e,t)}),Qi=A(`$ZodCheckIncludes`,(e,t)=>{M.init(e,t);let n=Bn(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),$i=A(`$ZodCheckStartsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`^${Bn(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),ea=A(`$ZodCheckEndsWith`,(e,t)=>{M.init(e,t);let n=RegExp(`.*${Bn(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),ta=A(`$ZodCheckOverwrite`,(e,t)=>{M.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),na=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
+ `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
3
+ `)}\n};`)(...Object.values(this.closed))}},ra={major:4,minor:6,patch:5},N=A(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=ra;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=tr(t),a;for(let o of n){if(o._zod.def.when){if(nr(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new Or;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(ar(t.issues,n,e),i||=tr(t,n))});else{if(t.issues.length===n)continue;ar(t.issues,n,e),i||=tr(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(tr(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new Or;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new Or;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return mr(this,`~standard`,oa(this))},set"~standard"(e){pr(this,`~standard`,e)}}),ia=(e,t)=>e.issues.length?{issues:e.issues.map(e=>or(e,t,Ar()))}:{value:e.value};async function aa(e,t){let n={async:!0};return ia(await e._zod.run({value:t,issues:[]},n),n)}function oa(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return ia(r,n)}catch{}return aa(e,t)},vendor:`zod`,version:1}}var sa=A(`$ZodString`,(e,t)=>{N.init(e,t),e._zod.pattern=t.pattern??Ni,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),P=A(`$ZodStringFormat`,(e,t)=>{Ji.init(e,t),sa.init(e,t)}),ca=A(`$ZodGUID`,(e,t)=>{t.pattern??=mi,P.init(e,t)}),la=A(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=hi(e)}else t.pattern??=hi();P.init(e,t)}),ua=A(`$ZodEmail`,(e,t)=>{t.pattern??=gi,P.init(e,t)});function da(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function fa(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?da(e)||2:pa(e,t)}function pa(e,t){if(!t.normalize&&t.protocol?.source===Ti.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var ma=/[\t\n\r]/g;function ha(e){return e.replace(ma,``)}function ga(e,t){return t.lastIndex=0,t.test(e.hostname)}function _a(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var va=A(`$ZodURL`,(e,t)=>{P.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=fa(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=ha(r);return}t.hostname&&!ga(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!_a(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:ha(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),ya=A(`$ZodEmoji`,(e,t)=>{t.pattern??=vi(),P.init(e,t)}),ba=A(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?di:fi(t.length),P.init(e,t)}),xa=A(`$ZodCUID`,(e,t)=>{t.pattern??=oi,P.init(e,t)}),Sa=A(`$ZodCUID2`,(e,t)=>{t.pattern??=si,P.init(e,t)}),Ca=A(`$ZodULID`,(e,t)=>{t.pattern??=ci,P.init(e,t)}),wa=A(`$ZodXID`,(e,t)=>{t.pattern??=li,P.init(e,t)}),Ta=A(`$ZodKSUID`,(e,t)=>{t.pattern??=ui,P.init(e,t)}),Ea=A(`$ZodISODateTime`,(e,t)=>{t.pattern??=Mi(t),P.init(e,t)}),Da=A(`$ZodISODate`,(e,t)=>{t.pattern??=ki,P.init(e,t)}),Oa=A(`$ZodISOTime`,(e,t)=>{t.pattern??=ji(t),P.init(e,t)}),ka=A(`$ZodISODuration`,(e,t)=>{t.pattern??=pi,P.init(e,t)}),Aa=A(`$ZodIPv4`,(e,t)=>{t.pattern??=yi,P.init(e,t)}),ja=/^[0-9a-fA-F:.]+$/;function Ma(e){return ja.test(e)?da(`http://[${e}]`):!1}var Na=A(`$ZodIPv6`,(e,t)=>{t.pattern??=bi,P.init(e,t),e._zod.check=n=>{Ma(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),Pa=A(`$ZodCIDRv4`,(e,t)=>{t.pattern??=xi,P.init(e,t)});function Fa(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Ma(n)}var Ia=A(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Si,P.init(e,t),e._zod.check=n=>{Fa(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function La(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Ra=/^[0-9a-zA-Z+/]*={0,2}$/,za=A(`$ZodBase64`,(e,t)=>{t.pattern??=Ra,P.init(e,t),e._zod.check=n=>{La(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Ba=/^[A-Za-z0-9_-]*$/;function Va(e){if(!Ba.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return La(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Ha=A(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ba,P.init(e,t),e._zod.check=n=>{Va(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Ua=A(`$ZodE164`,(e,t)=>{t.pattern??=Ei,P.init(e,t)});function Wa(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Ga=A(`$ZodJWT`,(e,t)=>{P.init(e,t),e._zod.check=n=>{Wa(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ka=A(`$ZodNumber`,(e,t)=>{N.init(e,t),e._zod.pattern=Fi,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),qa=A(`$ZodNumberFormat`,(e,t)=>{Wi.init(e,t),Ka.init(e,t)}),Ja=A(`$ZodBoolean`,(e,t)=>{N.init(e,t),e._zod.pattern=Ii,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),Ya=A(`$ZodUnknown`,(e,t)=>{N.init(e,t),e._zod.parse=e=>e}),Xa=A(`$ZodNever`,(e,t)=>{N.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Za(e,t,n){e.issues.length&&t.issues.push(...rr(n,e.issues)),t.value[n]=e.value}var Qa=A(`$ZodArray`,(e,t)=>{N.init(e,t);let n=j.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Za(t,r,e)));else if(Za(c,r,e),s&&c.issues.length!==0&&tr(c))break}return o.length?Promise.all(o).then(()=>r):r}});function $a(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...rr(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var eo=[];function to(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:eo,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Un(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function no(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(tr(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>$a(e,n,i,t,d,f))):$a(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var ro=A(`$ZodObject`,(e,t)=>{N.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=xn(()=>to(t));k(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||Tn(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Fn,o=t.catchall,s,c=j.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(tr(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>$a(n,t,e,r,a,o))):$a(s,t,e,r,a,o)}return o?no(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),io=A(`$ZodObjectJIT`,(e,t)=>{ro.init(e,t);let n=e._zod.parse,r=xn(()=>to(t)),i=j.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new na([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
4
+ let ${e}_ab = false;
5
+ for (let i = 0; i < ${e}.issues.length; i++) {
6
+ const iss = ${e}.issues[i];
7
+ iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
8
+ payload.issues.push(iss);
9
+ if (iss.continue !== true) ${e}_ab = true;
10
+ }
11
+ if (${e}_ab && ctx && ctx.abortEarly) {
12
+ payload.value = newResult;
13
+ return payload;
14
+ }`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:Mn(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
15
+ const ${n}_present = ${i};
16
+ if (!${n}.issues.length || ${n}_present) {
17
+ if (${n}.issues.length) {${c(n,r)}
18
+ }
19
+
20
+ if (${e}) {
21
+ newResult[${r}] = ${n}.value;
22
+ }
23
+ }
24
+
25
+ `)}else f?(o.write(`
26
+ if (${n}.issues.length) {${c(n,r)}
27
+ }
28
+ `),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
29
+ if (${n}.value !== undefined || ${i}) {
30
+ newResult[${r}] = ${n}.value;
31
+ }
32
+ `)):o.write(`
33
+ const ${n}_present = ${i};
34
+ if (${n}.issues.length) {${c(n,r)}
35
+ }
36
+ if (!${n}_present && !${n}.issues.length) {
37
+ payload.issues.push({
38
+ code: "invalid_type",
39
+ expected: "nonoptional",
40
+ input: undefined,
41
+ path: [${r}]
42
+ });
43
+ if (ctx && ctx.abortEarly) {
44
+ payload.value = newResult;
45
+ return payload;
46
+ }
47
+ }
48
+
49
+ if (${n}_present) {
50
+ newResult[${r}] = ${n}.value;
51
+ }
52
+
53
+ `)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=Fn,c=!j.jitless,l=c&&In.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?no([],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 ao(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=>!tr(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=>or(e,r,Ar())))}),t)}var oo=A(`$ZodUnion`,(e,t)=>{N.init(e,t),k(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),k(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),k(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)))}),k(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=>Cn(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=>ao(t,r,e,i)):ao(o,r,e,i)}});function so(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 co=A(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,oo.init(e,t);let n=e._zod.parse;k(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)||Tn(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=En(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=xn(()=>so(t));e._zod.parse=(i,a)=>{let o=i.value;if(!Fn(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)}}),lo=A(`$ZodIntersection`,(e,t)=>{N.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])=>fo(e,t,n)):fo(e,i,a)}});function uo(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ln(e)&&Ln(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=uo(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=uo(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 fo(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=uo(t.value,n.value);if(!c.valid){if(tr(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var po=A(`$ZodRecord`,(e,t)=>{N.init(e,t);let n=j.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Ln(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=>or(e,i,Ar())),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(...rr(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...rr(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`&&Fi.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=>or(e,i,Ar())),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(...rr(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...rr(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}}),mo=A(`$ZodEnum`,(e,t)=>{N.init(e,t);let n=_n(t.entries),r=new Set(n);e._zod.values=r,k(e,`pattern`,e=>{let t=_n(e.def.entries).filter(e=>zn.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Bn(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}}),ho=A(`$ZodLiteral`,(e,t)=>{N.init(e,t);let n=new Set(t.values);e._zod.values=n,k(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Bn(e):e?Bn(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}}),go=A(`$ZodTransform`,(e,t)=>{N.init(e,t),e._zod.optin=`optional`,j.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kr(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 Or;return n.value=i,n}});function _o(e,t){return e.value=t.issues.length?void 0:t.value,e}var vo=A(`$ZodOptional`,(e,t)=>{N.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,k(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Cn(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=>_o(e,t)):_o(e,r)}return t.innerType._zod.run(e,n)}}),yo=A(`$ZodExactOptional`,(e,t)=>{vo.init(e,t),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),bo=A(`$ZodNullable`,(e,t)=>{N.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin),k(e,`optout`,e=>e.def.innerType._zod.optout),k(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Cn(t.source)}|null)$`):void 0}),k(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)}),xo=A(`$ZodDefault`,(e,t)=>{N.init(e,t),e._zod.optin=`defaulted`,k(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=>So(e,t)):So(r,t)}});function So(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Co=A(`$ZodPrefault`,(e,t)=>{N.init(e,t),e._zod.optin=`defaulted`,k(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))}),wo=A(`$ZodNonOptional`,(e,t)=>{N.init(e,t),k(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=>To(t,e)):To(i,e)}});function To(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 Eo(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>or(e,r,Ar()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var Do=A(`$ZodCatch`,(e,t)=>{N.init(e,t),k(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),k(e,`optout`,e=>e.def.innerType._zod.optout),k(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=>Eo(e,r,t,n)):Eo(e,r,t,n)}}),Oo=A(`$ZodPipe`,(e,t)=>{N.init(e,t),k(e,`values`,e=>e.def.in._zod.values),k(e,`optin`,e=>e.def.in._zod.optin),k(e,`optout`,e=>e.def.out._zod.optout),k(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=>ko(e,t.in,n)):ko(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>ko(e,t.out,n)):ko(r,t.out,n)}});function ko(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 Ao=A(`$ZodPreprocess`,(e,t)=>{Oo.init(e,t)}),jo=A(`$ZodReadonly`,(e,t)=>{N.init(e,t),k(e,`propValues`,e=>e.def.innerType._zod.propValues),k(e,`values`,e=>e.def.innerType._zod.values),k(e,`optin`,e=>e.def.innerType?._zod?.optin),k(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(Mo):Mo(r)}});function Mo(e){return e.memo||(e.value=Object.freeze(e.value)),e}var No=A(`$ZodCustom`,(e,t)=>{M.init(e,t),N.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=>Po(t,n,r,e));Po(i,n,r,e)}});function Po(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(dr(e))}}var Fo=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Io=`~memo`,Lo=[];function Ro(e){return typeof e==`object`&&!!e}function zo(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Bo=new WeakMap,Vo=0,Ho=1,Uo=2;function Wo(e,t,n){let r=Bo.get(e);if(r!==void 0)return r?Uo:Vo;if(t.has(e))return Uo;t.add(e);let i=Vo,a=e=>{if(i!==Uo&&e?._zod){let r=Wo(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=Vo;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Ho:o.value?._zod?Wo(o.value,t,n):Vo;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=En(c);s(e?o(e,!0):Ho),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?Wo(r,t,!1):Ho);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),Go(e,i)}function Go(e,t){return t!==Ho&&Bo.set(e,t===Uo),t}function Ko(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var qo,Jo=[],Yo={alloc(e,t,n){let r=qo;if(!r)return n;qo=void 0;let i={value:n,issues:null};return r.set(t.value,i),Jo.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`&&Zo(n,e.value))throw new Fo;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=Wo(e,new Set,!1);if(i===Vo)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Uo||r?n=!0:r=!0}let l=s.value;if(!Ro(l))return t(s,c);let u=c[Io];u||(u={buckets:new WeakMap,backEdges:void 0},c[Io]=u);let d;i===c?d=a:(d=Ko(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(...zo(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;qo=d;let p=Jo.length,m=t(s,c);qo=void 0;let h=Jo.length>p?Jo.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?zo(e.issues):Lo),e)):(h&&(h.issues=m.issues.length?zo(m.issues):Lo),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Xo(){return Yo}function Zo(e,t){let n=e[Io]?.backEdges;return n!==void 0&&Ro(t)&&n.has(t)}var Qo=()=>{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(ur(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Hn(e.values[0])}`:`Invalid option: expected one of ${vn(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`:``}: ${vn(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 $o(){return{localeError:Qo()}}var es,ts=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 ns(){return new ts}(es=globalThis).__zod_globalRegistry??(es.__zod_globalRegistry=ns());var rs=globalThis.__zod_globalRegistry;function is(e){return e.checks&&=[...e.checks],e}function as(e,t){return new e(is({type:`string`,...O(t)}))}function os(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...O(t)})}function ss(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...O(t)})}function cs(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...O(t)})}function ls(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...O(t)})}function us(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...O(t)})}function ds(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...O(t)})}function fs(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...O(t)})}function ps(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...O(t)})}function ms(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...O(t)})}function hs(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...O(t)})}function gs(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...O(t)})}function _s(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...O(t)})}function vs(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...O(t)})}function ys(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...O(t)})}function bs(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...O(t)})}function xs(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...O(t)})}function Ss(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...O(t)})}function Cs(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...O(t)})}function ws(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...O(t)})}function Ts(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...O(t)})}function Es(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...O(t)})}function Ds(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...O(t)})}function Os(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...O(t)})}function ks(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...O(t)})}function As(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...O(t)})}function js(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...O(t)})}function Ms(e,t){return new e(is({type:`number`,checks:[],...O(t)}))}function Ns(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...O(t)})}function Ps(e,t){return new e({type:`boolean`,...O(t)})}function Fs(e){return new e({type:`unknown`})}function Is(e,t){return new e({type:`never`,...O(t)})}function Ls(e,t){return new Vi({check:`less_than`,...O(t),value:e,inclusive:!1})}function Rs(e,t){return new Vi({check:`less_than`,...O(t),value:e,inclusive:!0})}function zs(e,t){return new Hi({check:`greater_than`,...O(t),value:e,inclusive:!1})}function Bs(e,t){return new Hi({check:`greater_than`,...O(t),value:e,inclusive:!0})}function Vs(e,t){return new Ui({check:`multiple_of`,...O(t),value:e})}function Hs(e,t){return new Gi({check:`max_length`,...O(t),maximum:e})}function Us(e,t){return new Ki({check:`min_length`,...O(t),minimum:e})}function Ws(e,t){return new qi({check:`length_equals`,...O(t),length:e})}function Gs(e,t){return new Yi({check:`string_format`,format:`regex`,...O(t),pattern:e})}function Ks(e){return new Xi({check:`string_format`,format:`lowercase`,...O(e)})}function qs(e){return new Zi({check:`string_format`,format:`uppercase`,...O(e)})}function Js(e,t){return new Qi({check:`string_format`,format:`includes`,...O(t),includes:e})}function Ys(e,t){return new $i({check:`string_format`,format:`starts_with`,...O(t),prefix:e})}function Xs(e,t){return new ea({check:`string_format`,format:`ends_with`,...O(t),suffix:e})}function Zs(e){return new ta({check:`overwrite`,tx:e})}function Qs(e){return Zs(t=>t.normalize(e))}function $s(){return Zs(e=>e.trim())}function ec(){return Zs(e=>e.toLowerCase())}function tc(){return Zs(e=>e.toUpperCase())}function nc(){return Zs(e=>Nn(e))}function rc(e,t,n){return new e({type:`array`,element:t,...O(n)})}function ic(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...O(n)})}function ac(e,t){let n=oc(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(dr(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(dr(r))}},e(t.value,t)),t);return n}function oc(e,t){let n=new M({check:`custom`,...O(t)});return n._zod.check=e,n}function sc(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&Tn(e,t,n[t]);return e}function cc(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??rs,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 lc(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 F(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,F(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&sc(o.schema,c),t.io===`input`&&I(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 uc(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function dc(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}/${uc(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+uc(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
+
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 fc(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;fc(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 pc=new Set([`type`,`properties`,`required`,`additionalProperties`]),mc=[`oneOf`,`anyOf`];function hc(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function gc(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!pc.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]??hc(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}Tn(n,r,e.length===1?e[0]:gc(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=hc(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 _c(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of pc)if(t in e)return;let n=t.filter(e=>mc.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=gc(t);else{let e=n[0],i=mc.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=>gc([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,sc(e,r))}function vc(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)):sc(i,s),sc(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())fc(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)??[])_c(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)}sc(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,Tn(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:bc(t,`input`,e.processors),output:bc(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function I(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 I(r.element,n);if(r.type===`set`)return I(r.valueType,n);if(r.type===`lazy`)return I(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 I(r.innerType,n);if(r.type===`intersection`)return I(r.left,n)||I(r.right,n);if(r.type===`record`||r.type===`map`)return I(r.keyType,n)||I(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:I(r.in,n)||I(r.out,n);if(r.type===`object`){for(let e in r.shape)if(I(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(I(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(I(e,n))return!0;return!!(r.rest&&I(r.rest,n))}return!1}var yc=(e,t={})=>n=>{let r=cc({...n,processors:t});return F(e,r),dc(r,e),vc(r,e)},bc=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=cc({...i??{},target:a,io:t,processors:n});return F(e,o),dc(o,e),vc(o,e)},xc=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Sc=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Cc=(e,t)=>{xc(e,`minimum`,t),Sc(e,`maximum`,t)},wc=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Tc=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ec=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Dc=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Oc=(e,t)=>xc(e,`minimum`,t.minimum),kc=(e,t)=>Sc(e,`maximum`,t.maximum),Ac=e=>(t,n)=>{Dc(t,n.format);let[r,i]=e[n.format];xc(t,`minimum`,r),Sc(t,`maximum`,i)},jc={greater_than:(e,t)=>xc(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Sc(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>wc(e,t.value),number_format:Ac(Wn),bigint_format:Ac(Gn),min_length:Oc,max_length:kc,length_equals:(e,t)=>Cc(e,t.length),min_size:Oc,max_size:kc,size_equals:(e,t)=>Cc(e,t.size),string_format:(e,t)=>{Dc(e,t.format),t.pattern&&Tc(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)=>Ec(e,t.mime)};function Mc(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)jc[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&xc(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&xc(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Sc(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Sc(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&wc(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ec(t,i.mime);for(let e of i.patterns??[])Tc(t,e);return t}var Nc={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Pc=new Map([[Ra,Ci],[Ba,wi]]),Fc=e=>Pc.get(e)??e,Ic=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Mc(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Nc[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(Fc);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}))])}},Lc=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Mc(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)):lc(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}))])}},Rc=(e,t,n,r)=>{n.type=`boolean`},zc=(e,t,n,r)=>{n.not={}},Bc=(e,t,n,r)=>{let i=e._zod.def,a=_n(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},Vc=(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(lc(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(lc(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}},Hc=(e,t,n,r)=>{lc(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Uc=(e,t,n,r)=>{lc(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Wc=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Mc(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=F(a.element,t,{...r,path:[...r.path,`items`]})};function Gc(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Gc(t.out):t.type===`catch`?Gc(t.innerType):e._zod.optin}var Kc=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&lc(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)Tn(i.properties,e,F(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`?Gc(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=F(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},qc=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>F(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Jc=(e,t,n,r)=>{let i=e._zod.def,a=F(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=F(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 Yc(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=Yc(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=>Yc(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`)?Fi:Pi).source),p):p}var Xc=new WeakMap;function Zc(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 Xc.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Yc(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 Qc=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Mc(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=F(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)Tn(i.patternProperties,Fc(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=F(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Xc.get(t);n||(n=[],Xc.set(t,n),t.deferred.push(()=>Zc(t))),n.push(e)}i.additionalProperties=F(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Gc(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))}},$c=(e,t,n,r)=>{let i=e._zod.def,a=F(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`}]},el=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},tl=Symbol();function nl(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(lc(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),tl):JSON.parse(o)}var rl=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=nl(i.defaultValue,e,t,n,r);o!==tl&&(n.default=o)},il=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=nl(i.defaultValue,e,t,n,r);o!==tl&&(n._prefault=o)},al=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{lc(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ol=(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;F(o,t,r);let s=t.seen.get(e);s.ref=o},sl=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},cl=(e,t,n,r)=>{let i=e._zod.def;F(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ll=new WeakSet([Object.prototype,Error.prototype]);function ul(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 L=A(`ZodError`,(e,t)=>{Lr.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);ll.has(n)||(ll.add(n),ul(n,`format`,e=>t=>Br(e,t)),ul(n,`flatten`,e=>t=>zr(e,t)),ul(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yn,2)}),ul(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yn,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),dl=Hr(L),fl=Ur(L),pl=Wr(L),ml=Kr(L),hl=Qr(L),gl=$r(L),_l=ei(L),vl=ti(L),yl=ni(L),bl=ri(L),xl=ii(L),Sl=ai(L);function Cl(){j.localeError||Ar($o())}function wl(){j.memoizer||Ar({memoizer:Xo()})}var R=A(`ZodType`,(e,t)=>(Cl(),N.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(D(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 Vn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ru(e,t))},superRefine(e,t){return this.check(zu(e,t))},overwrite(e){return this.check(Zs(e))},optional(){return yu(this)},exactOptional(){return xu(this)},nullable(){return Cu(this)},nullish(){return yu(Cu(this))},nonoptional(e){return ku(this,e)},array(){return U(this)},or(e){return su([this,e])},and(e){return du(this,e)},transform(e){return Nu(this,_u(e))},default(e){return Tu(this,e)},prefault(e){return Du(this,e)},catch(e){return ju(this,e)},pipe(e){return Nu(this,e)},readonly(){return Iu(this)},describe(e){let t=this.clone();return rs.add(t,{description:e}),t},meta(...e){if(e.length===0)return rs.get(this);let t=this.clone();return rs.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 mr(this,`~standard`,{...oa(this),jsonSchema:{input:bc(this,`input`),output:bc(this,`output`)}})},set"~standard"(e){pr(this,`~standard`,e)},parse:function e(t,n){return dl(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await fl(this,t,n,{callee:e})},safeParse(e,t){return pl(this,e,t)},async safeParseAsync(e,t){return ml(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){pr(this,`spa`,e)},validate(e,t){return Yr(this,e,t)},validateAsync(e,t){return Zr(this,e,t)},encode:function e(t,n){return hl(this,t,n,{callee:e})},decode:function e(t,n){return gl(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await _l(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await vl(this,t,n,{callee:e})},safeEncode(e,t){return yl(this,e,t)},safeDecode(e,t){return bl(this,e,t)},async safeEncodeAsync(e,t){return xl(this,e,t)},async safeDecodeAsync(e,t){return Sl(this,e,t)},toJSONSchema(e){return yc(this,{})(e)},get description(){return rs.get(this)?.description},get _def(){return this._zod.def}}),Tl=A(`_ZodString`,(e,t)=>{sa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ic(e,t,n,r)},hr({format:e=>Mc(e).format??null,minLength:e=>Mc(e).minimum??null,maxLength:e=>Mc(e).maximum??null},{regex(...e){return this.check(Gs(...e))},includes(...e){return this.check(Js(...e))},startsWith(...e){return this.check(Ys(...e))},endsWith(...e){return this.check(Xs(...e))},min(...e){return this.check(Us(...e))},max(...e){return this.check(Hs(...e))},length(...e){return this.check(Ws(...e))},nonempty(...e){return this.check(Us(1,...e))},lowercase(e){return this.check(Ks(e))},uppercase(e){return this.check(qs(e))},trim(){return this.check($s())},normalize(...e){return this.check(Qs(...e))},toLowerCase(){return this.check(ec())},toUpperCase(){return this.check(tc())},slugify(){return this.check(nc())}})),El=A(`ZodString`,(e,t)=>{sa.init(e,t),Tl.init(e,t)},{email(e){return this.check(os(jl,e))},url(e){return this.check(fs(Pl,e))},jwt(e){return this.check(Ds(Yl,e))},emoji(e){return this.check(ps(Fl,e))},guid(e){return this.check(ss(Ml,e))},uuid(e){return this.check(cs(Nl,e))},uuidv4(e){return this.check(ls(Nl,e))},uuidv6(e){return this.check(us(Nl,e))},uuidv7(e){return this.check(ds(Nl,e))},nanoid(e){return this.check(ms(Il,e))},cuid(e){return this.check(hs(Ll,e))},cuid2(e){return this.check(gs(Rl,e))},ulid(e){return this.check(_s(zl,e))},base64(e){return this.check(ws(Kl,e))},base64url(e){return this.check(Ts(ql,e))},xid(e){return this.check(vs(Bl,e))},ksuid(e){return this.check(ys(Vl,e))},ipv4(e){return this.check(bs(Hl,e))},ipv6(e){return this.check(xs(Ul,e))},cidrv4(e){return this.check(Ss(Wl,e))},cidrv6(e){return this.check(Cs(Gl,e))},e164(e){return this.check(Es(Jl,e))},datetime(e){return this.check(Os(Dl,e))},date(e){return this.check(ks(Ol,e))},time(e){return this.check(As(kl,e))},duration(e){return this.check(js(Al,e))}});function z(e){return as(El,e)}var B=A(`ZodStringFormat`,(e,t)=>{P.init(e,t),Tl.init(e,t)}),Dl=A(`ZodISODateTime`,(e,t)=>{Ea.init(e,t),B.init(e,t)}),Ol=A(`ZodISODate`,(e,t)=>{Da.init(e,t),B.init(e,t)}),kl=A(`ZodISOTime`,(e,t)=>{Oa.init(e,t),B.init(e,t)}),Al=A(`ZodISODuration`,(e,t)=>{ka.init(e,t),B.init(e,t)}),jl=A(`ZodEmail`,(e,t)=>{ua.init(e,t),B.init(e,t)}),Ml=A(`ZodGUID`,(e,t)=>{ca.init(e,t),B.init(e,t)}),Nl=A(`ZodUUID`,(e,t)=>{la.init(e,t),B.init(e,t)}),Pl=A(`ZodURL`,(e,t)=>{va.init(e,t),B.init(e,t)}),Fl=A(`ZodEmoji`,(e,t)=>{ya.init(e,t),B.init(e,t)}),Il=A(`ZodNanoID`,(e,t)=>{ba.init(e,t),B.init(e,t)}),Ll=A(`ZodCUID`,(e,t)=>{xa.init(e,t),B.init(e,t)}),Rl=A(`ZodCUID2`,(e,t)=>{Sa.init(e,t),B.init(e,t)}),zl=A(`ZodULID`,(e,t)=>{Ca.init(e,t),B.init(e,t)}),Bl=A(`ZodXID`,(e,t)=>{wa.init(e,t),B.init(e,t)}),Vl=A(`ZodKSUID`,(e,t)=>{Ta.init(e,t),B.init(e,t)}),Hl=A(`ZodIPv4`,(e,t)=>{Aa.init(e,t),B.init(e,t)}),Ul=A(`ZodIPv6`,(e,t)=>{Na.init(e,t),B.init(e,t)}),Wl=A(`ZodCIDRv4`,(e,t)=>{Pa.init(e,t),B.init(e,t)}),Gl=A(`ZodCIDRv6`,(e,t)=>{Ia.init(e,t),B.init(e,t)}),Kl=A(`ZodBase64`,(e,t)=>{za.init(e,t),B.init(e,t)}),ql=A(`ZodBase64URL`,(e,t)=>{Ha.init(e,t),B.init(e,t)}),Jl=A(`ZodE164`,(e,t)=>{Ua.init(e,t),B.init(e,t)}),Yl=A(`ZodJWT`,(e,t)=>{Ga.init(e,t),B.init(e,t)}),Xl=A(`ZodNumber`,(e,t)=>{Ka.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lc(e,t,n,r),e.isFinite=!0},hr({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Mc(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Mc(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Mc(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Mc(e).format??null},{gt(e,t){return this.check(zs(e,t))},gte(e,t){return this.check(Bs(e,t))},min(e,t){return this.check(Bs(e,t))},lt(e,t){return this.check(Ls(e,t))},lte(e,t){return this.check(Rs(e,t))},max(e,t){return this.check(Rs(e,t))},int(e){return this.check(Ql(e))},safe(e){return this.check(Ql(e))},positive(e){return this.check(zs(0,e))},nonnegative(e){return this.check(Bs(0,e))},negative(e){return this.check(Ls(0,e))},nonpositive(e){return this.check(Rs(0,e))},multipleOf(e,t){return this.check(Vs(e,t))},step(e,t){return this.check(Vs(e,t))},finite(){return this}}));function V(e){return Ms(Xl,e)}var Zl=A(`ZodNumberFormat`,(e,t)=>{qa.init(e,t),Xl.init(e,t)});function Ql(e){return Ns(Zl,e)}var $l=A(`ZodBoolean`,(e,t)=>{Ja.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Rc(e,t,n,r)});function H(e){return Ps($l,e)}var eu=A(`ZodUnknown`,(e,t)=>{Ya.init(e,t),R.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function tu(){return Fs(eu)}var nu=A(`ZodNever`,(e,t)=>{Xa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zc(e,t,n,r)});function ru(e){return Is(nu,e)}var iu=A(`ZodArray`,(e,t)=>{wl(),Qa.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wc(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Us(e,t))},nonempty(e){return this.check(Us(1,e))},max(e,t){return this.check(Hs(e,t))},length(e,t){return this.check(Ws(e,t))},unwrap(){return this.element}});function U(e,t){return rc(iu,e,t)}var au=A(`ZodObject`,(e,t)=>{wl(),io.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kc(e,t,n,r),xr(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return G(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(D(this._zod.def,{catchall:e}))},passthrough(){return this.clone(D(this._zod.def,{catchall:tu()}))},loose(){return this.clone(D(this._zod.def,{catchall:tu()}))},strict(){return this.clone(D(this._zod.def,{catchall:ru()}))},strip(){return this.clone(D(this._zod.def,{catchall:void 0}))},extend(e){return Yn(this,e)},safeExtend(e){return Zn(this,e)},merge(e){return Qn(this,e)},pick(e){return Kn(this,e)},omit(e){return Jn(this,e)},partial(...e){return $n(vu,this,e[0])},exactPartial(...e){return $n(bu,this,e[0],`exactPartial`)},required(...e){return er(Ou,this,e[0])}});function W(e,t){return new au({type:`object`,shape:e??{},...O(t)})}var ou=A(`ZodUnion`,(e,t)=>{oo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qc(e,t,n,r),e.options=t.options});function su(e,t){return new ou({type:`union`,options:e,...O(t)})}var cu=A(`ZodDiscriminatedUnion`,(e,t)=>{ou.init(e,t),co.init(e,t)});function lu(e,t,n){return new cu({type:`union`,options:t,discriminator:e,...O(n)})}var uu=A(`ZodIntersection`,(e,t)=>{lo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jc(e,t,n,r)});function du(e,t){return new uu({type:`intersection`,left:e,right:t})}var fu=A(`ZodRecord`,(e,t)=>{wl(),po.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qc(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function pu(e,t,n){return!t||!t._zod?new fu({type:`record`,keyType:z(),valueType:e,...O(t)}):new fu({type:`record`,keyType:e,valueType:t,...O(n)})}var mu=A(`ZodEnum`,(e,t)=>{mo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Bc(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 mu({...t,checks:[],...O(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 mu({...t,checks:[],...O(r),entries:i})}});function G(e,t){return new mu({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...O(t)})}var hu=A(`ZodLiteral`,(e,t)=>{ho.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vc(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 K(e,t){return new hu({type:`literal`,values:Array.isArray(e)?e:[e],...O(t)})}var gu=A(`ZodTransform`,(e,t)=>{wl(),go.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uc(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new kr(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(dr(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(dr(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function _u(e){return new gu({type:`transform`,transform:e})}var vu=A(`ZodOptional`,(e,t)=>{vo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yu(e){return new vu({type:`optional`,innerType:e})}var bu=A(`ZodExactOptional`,(e,t)=>{yo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xu(e){return new bu({type:`optional`,innerType:e})}var Su=A(`ZodNullable`,(e,t)=>{bo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$c(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Cu(e){return new Su({type:`nullable`,innerType:e})}var wu=A(`ZodDefault`,(e,t)=>{xo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Tu(e,t){return new wu({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rn(t)}})}var Eu=A(`ZodPrefault`,(e,t)=>{Co.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>il(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Du(e,t){return new Eu({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Rn(t)}})}var Ou=A(`ZodNonOptional`,(e,t)=>{wo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>el(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ku(e,t){return new Ou({type:`nonoptional`,innerType:e,...O(t)})}var Au=A(`ZodCatch`,(e,t)=>{Do.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>al(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ju(e,t){return new Au({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:Cr(t)})}var Mu=A(`ZodPipe`,(e,t)=>{Oo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ol(e,t,n,r),e.in=t.in,e.out=t.out});function Nu(e,t){return new Mu({type:`pipe`,in:e,out:t})}var Pu=A(`ZodPreprocess`,(e,t)=>{Mu.init(e,t),Ao.init(e,t)}),Fu=A(`ZodReadonly`,(e,t)=>{jo.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sl(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Iu(e){return new Fu({type:`readonly`,innerType:e})}var Lu=A(`ZodCustom`,(e,t)=>{No.init(e,t),R.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hc(e,t,n,r)});function Ru(e,t={}){return ic(Lu,e,t)}function zu(e,t){return ac(e,t)}function Bu(e,t){return new Pu({type:`pipe`,in:_u(e),out:t})}function Vu(e){return Os(Dl,e)}var q=z().regex(/^[a-z0-9][a-z0-9-]{0,31}$/,`expected 1-32 lowercase letters, digits, or hyphens, starting with a letter or digit`),J=z().regex(/^[0-9A-HJKMNP-TV-Z]{26}$/,`expected a ULID`),Y=z().regex(/^(?:[a-z0-9][a-z0-9-]{0,31}\/)?[a-z0-9][a-z0-9-]{0,31}$/,`expected <channel> or <project>/<channel>`);function Hu(e,t){return e===null?t:`${e}/${t}`}var X=Bu(e=>e instanceof Date?e.toISOString():e,Vu()),Uu=G([`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`]),Wu=G([`user_post`,`ops_event`,`heartbeat`]),Gu=W({name:q,purpose:z().min(1),verbs:U(Uu),wakeTriggers:U(Wu).default([`heartbeat`]),reviewDate:z().optional(),maxReplicas:V().int().min(1).default(1),backlogThreshold:V().positive().default(3),resident:H().default(!1),societyScope:H().default(!1),reflects:H().default(!0)}),Ku=`user`,qu=`user`,Ju=[`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`],Yu=[`approve`,`reject`],Xu=[`create_project`],Zu=[`configure_project`],Qu=[`archive_project`];[...Ju,...Yu,...Xu,...Zu,...Qu],[...Ju,...Yu,...Zu],[...Ju,...Xu,...Zu];var $u=`asks`,ed=`society`,Z=G([`claude`,`codex`]),td=W({name:z().min(1),version:K(1),createdAt:X,channels:U(q)}),nd=G([`none`,`merge`]),rd=z().regex(/^s[1-9][0-9]*$/,`expected a stage id such as s1`),id={name:z().trim().min(1).max(120),role:q.optional(),agent:q.optional(),gate:H().default(!1)};function ad(e){return e.role===void 0||e.agent===void 0}var od={message:`a stage names a role or an agent, not both`},sd=W(id).refine(ad,od),cd=W({id:rd.optional(),...id}).refine(ad,od),ld=W({slug:q,name:z().min(1),repo:z().nullable(),defaultBranch:z().min(1),channels:U(q),members:U(q),approvers:U(q),requiredCapabilities:U(z()),createdAt:X,onDone:nd.default(`none`),runner:q.optional(),archived:W({at:X,by:q,reason:z().min(1)}).optional()}),ud=su([W({action:G([`advanced`,`returned`,`abandoned`,`landed`,`reopened`]),stage:rd,to:rd.nullable()}),W({action:G([`approved`,`rejected`])})]);function dd(e){return`stage`in e}var fd=W({id:J,author:q,channel:Y,thread:J.optional(),task:J.optional(),closes:J.optional(),step:ud.optional(),ts:X,mentions:U(q)}),pd=G([`open`,`claimed`,`done`,`abandoned`]),md=G([`open`,`closed`]),hd=W({kind:G([`task`,`proposal`]),id:J}),gd=W({id:J,channel:Y,title:z().min(1).max(200),subject:hd.optional(),state:md,openedBy:q,openedAt:X,closedBy:q.optional(),closedAt:X.optional()}),_d=W({id:rd,name:z().min(1),role:q.optional(),agent:q.optional(),gate:H().default(!1),holders:U(q).default([]),completedBy:q.optional(),completedAt:X.optional()}),vd=W({from:rd,by:q,at:X}),yd=W({id:J,project:q,title:z().min(1),status:pd,createdBy:q,createdAt:X,updatedAt:X,claimedBy:q.optional(),leaseExpiresAt:X.optional(),parentId:J.optional(),blockedBy:U(J),requiredCapabilities:U(z()),stages:U(_d).min(1),stage:rd,stageSince:X,stageSeq:V().int().positive(),onDone:nd.default(`none`),completing:H().default(!1),returned:vd.optional()});function bd(e,t){return e.stages.findIndex(e=>e.id===t)}function xd(e){return e.stages.find(t=>t.id===e.stage)}var Sd=W({id:z().trim().min(1).max(120).regex(/^[\w.:/[\]-]+$/,`a model name is one word of letters, digits, and . _ : / - [ ]`),name:z(),description:z().default(``),isDefault:H().default(!1)}),Cd=G([`active`,`retired`]),wd=W({name:q,role:q,cli:Z.nullable(),model:z().optional(),homeRunner:q.optional(),memberships:U(q),subscriptions:U(Y),status:Cd,createdAt:X,tokenHash:z().min(1),retiredAt:X.optional(),retiredReason:z().optional()}),Td=W({name:q,role:q,cli:Z.nullable(),homeRunner:q.optional(),status:Cd,resident:H().default(!1),model:z().optional(),lastModel:z().optional(),skills:U(q).default([]),memberships:U(q),subscriptions:U(Y),claimsHeld:V().int().nonnegative().default(0),tasksDone:V().int().nonnegative().default(0),lastTurnAt:X.optional(),lastTurnOutcome:z().optional(),createdAt:X,retiredAt:X.optional()}),Ed=G([`linux`,`windows`,`darwin`]),Dd=W({name:q,os:Ed,clis:U(Z),capabilities:U(z()),status:G([`connected`,`disconnected`]),lastSeen:X.optional()}),Od=G([`role`,`member`,`channel`,`reallocation`,`retirement`,`skill`,`archive`]),kd=G([`proposed`,`approved`,`rejected`,`provisioned`,`retired`]),Ad=W({name:q,role:q,cli:Z,model:z().optional(),homeRunner:q.optional(),memberships:U(q).default([]),subscriptions:U(Y).default([]),seedInstructions:z().optional()}),jd=W({project:q.nullable().default(null),name:q,purpose:z().min(1)}),Md=W({description:z().min(1)}),Nd=W({agent:q,reason:z().min(1)}),Pd=W({project:q,reason:z().min(1)}),Fd=W({name:q,summary:z().min(1).max(200),body:z().min(1)}),Id={role:[Ku],member:[Ku],retirement:[Ku],archive:[Ku],channel:[Ku,`steward`],reallocation:[Ku,`steward`],skill:[Ku,`steward`]};function Ld(e,t){switch(e){case`member`:{let e=Ad.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=Gu.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=jd.safeParse(t);if(!e.success)break;return`channel ${Hu(e.data.project,e.data.name)}: ${e.data.purpose}`}case`retirement`:{let e=Nd.safeParse(t);if(!e.success)break;return`retirement of ${e.data.agent}: ${e.data.reason}`}case`reallocation`:{let e=Md.safeParse(t);if(!e.success)break;return`reallocation: ${e.data.description}`}case`skill`:{let e=Fd.safeParse(t);if(!e.success)break;return`skill ${e.data.name}: ${e.data.summary.trim().replace(/\.+$/,``)}`}case`archive`:{let e=Pd.safeParse(t);if(!e.success)break;return`archive of project ${e.data.project}: ${e.data.reason}`}}return`${e} ${JSON.stringify(t)}`}var Rd=W({name:q,summary:z().default(``),scope:G([`own`,`society`]),path:z().min(1)}),zd=W({path:z().min(1),file:z().min(1),since:X}),Bd=z().regex(/^[0-9a-f]{40}([0-9a-f]{24})?$/),Vd=W({path:z().min(1),status:G([`added`,`modified`,`deleted`]),added:V().int().nonnegative().nullable(),removed:V().int().nonnegative().nullable()}),Hd=W({changes:U(W({commit:Bd,at:X,kind:G([`turn`,`board`,`merge`]),author:z(),turnId:J.optional(),subject:z(),files:U(Vd)})),more:H()}),Ud=Vd.pick({path:!0,status:!0}).extend({patch:z().nullable(),truncated:H()}),Wd=W({topic:q,project:q.nullable(),updatedBy:q,updatedAt:X}),Gd=W({id:J,kind:Od,proposedBy:q,status:kd,createdAt:X,decidedBy:q.optional(),decidedAt:X.optional(),reason:z().optional(),charter:pu(z(),tu()),provisionedAt:X.optional(),provision:pu(z(),tu()).optional()}),Kd=W({id:J,proposalId:J,decidedBy:q,outcome:G([`approved`,`rejected`]),reason:z().optional(),ts:X});W({channel:Y.optional(),body:z().min(1),thread_id:J.optional()}),W({since_cursor:J.nullable().optional(),limit:V().int().positive().max(200).default(50),advance:H().default(!0)}),W({query:z().min(1),project:q.optional(),channel:Y.optional(),limit:V().int().positive().max(100).default(20)}),W({task_id:J.optional(),proposal_id:J.optional(),channel:Y.optional(),title:z().min(1).max(200).optional()}),W({thread_id:J,summary:z().min(1)}),W({project:q,title:z().min(1).max(200),body:z().default(``),parent_id:J.optional(),required_capabilities:U(z()).default([]),stages:U(sd).min(1).optional()}),W({task_id:J}),W({task_id:J}),W({task_id:J,stage:rd.optional(),status:G([`abandoned`]).optional(),note:z().min(1).optional(),blocked_by:U(J).optional()}),W({task_id:J}),W({channel:Y}),W({channel:Y}),W({kind:Od,charter:pu(z(),tu()),rationale:z().default(``)}),W({proposal_id:J,reason:z().optional()}),W({proposal_id:J,reason:z().min(1)}),W({slug:q,name:z().min(1).optional(),repo:z().min(1).nullable().default(null),default_branch:z().min(1).default(`main`),on_done:nd.optional()}),W({project:q,agent:q.optional()}),W({project:q,agent:q.optional()}),W({project:q.nullable().default(null),topic:q,body:z().min(1)}),W({task_id:J,stages:U(cd),on_done:nd.optional()}),W({task_id:J,note:z().min(1).optional()}),W({project:q,on_done:nd}),W({project:q,reason:z().min(1)});var qd=W({id:J,ts:X,type:G(`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.completed,turn.failed,merge.completed,merge.failed`.split(`,`)),actor:q,payload:pu(z(),tu())}),Jd=W({inputTokens:V().int().nonnegative(),outputTokens:V().int().nonnegative(),cacheReadTokens:V().int().nonnegative().default(0),cacheWriteTokens:V().int().nonnegative().default(0)}),Yd=W({summary:z().min(1),claimsHeld:U(J).default([]),blockedOn:U(z()).default([]),needsUserDecision:H().default(!1),memoryUpdated:H().default(!1)}),Xd=G([`completed`,`timeout`,`error`,`interrupted`,`blocked`]),Zd=lu(`type`,[W({type:K(`turn_started`),agent:q,session:z(),runner:q,model:z().optional()}),W({type:K(`text`),delta:z()}),W({type:K(`tool_call`),name:z(),input:tu()}),W({type:K(`tool_result`),name:z(),ok:H(),output:z().optional()}),W({type:K(`approval_requested`),kind:z(),detail:tu()}),W({type:K(`turn_completed`),usage:Jd,costUsd:V().nonnegative(),status:Yd.nullable(),exitReason:Xd}),W({type:K(`error`),message:z()})]),Qd=W({ts:X,event:Zd}),$d=W({seq:V().int().positive(),ts:X,agent:q,project:q,thread:J.optional(),event:Zd});W({protocol:V().int().positive(),version:z().min(1),os:Ed,clis:U(Z),residentClis:U(Z).default([]),capabilities:U(z()).default([]),slots:V().int().positive().nullable(),turns:U(J).default([])}),W({name:q,version:z()}),W({protocol:V().int().positive(),version:z().min(1).max(64),hostname:z().min(1).max(253),os:Ed,clis:U(Z).max(8),capabilities:U(z().min(1).max(64)).max(32).default([])}),W({deviceCode:z().min(1),userCode:z().min(1),expiresAt:X,intervalMs:V().int().positive()}),W({deviceCode:z().min(1)}),lu(`status`,[W({status:K(`pending`)}),W({status:K(`approved`),name:q,token:z().min(1)}),W({status:K(`denied`)})]);var ef=W({userCode:z().min(1),hostname:z(),os:Ed,clis:U(Z),capabilities:U(z()),version:z(),requestedAt:X,expiresAt:X}),tf=W({slug:q,origin:z().nullable(),defaultBranch:z().min(1)}),nf=lu(`kind`,[W({kind:K(`home`)}),W({kind:K(`project`),repo:tf,branches:U(z().min(1))}),W({kind:K(`task`),repo:tf,taskId:J})]),rf=W({turnId:J,agent:q,role:q,cli:Z,model:z().optional(),scope:q,thread:J.optional(),session:z().min(1).nullable(),costSoFarUsd:V().nonnegative(),instructions:z(),prompt:z(),mcp:W({url:z().min(1),token:z().min(1)}),limits:W({timeoutMs:V().int().positive().nullable(),maxTurns:V().int().positive().nullable()}),resident:W({key:z().min(1),idleMs:V().int().positive()}).optional(),workspace:nf}),af=W({branch:z().min(1),head:z().min(1)});W({entries:U(Qd)}),W({exitReason:Xd,status:Yd.nullable(),error:z().nullable(),usage:Jd,costUsd:V().nonnegative(),sessionCostUsd:V().nonnegative().optional(),session:z().min(1),model:z().nullable(),work:af.nullable()}),W({dropWorktree:H()});var of=W({repo:tf,branch:z().min(1)});W({ok:H(),detail:z()}),lu(`type`,[W({type:K(`turn`),job:rf}),W({type:K(`land`),request:z().min(1),land:of}),W({type:K(`models`),request:z().min(1),cli:Z})]),lu(`ok`,[W({ok:K(!0),value:tu()}),W({ok:K(!1),error:z()})]),W({warm:U(z())}),W({files:pu(z(),z())}),W({paths:U(z())}),W({files:pu(z(),z())});var sf=W({kind:G([`mention`,`stage`,`task_done`,`proposal_decided`,`heartbeat`,`reflection`,`onboarding`,`manual`,`ops_event`,`user_post`]),from:q.optional(),fromUser:H().default(!1),reason:z().default(``),taskId:J.optional(),messageId:J.optional(),channel:Y.optional()});W({agent:q,project:q,thread:W({id:J,task:H()}).optional(),trigger:sf,priority:V().int().min(0).max(2),onboarding:H().default(!1)});function cf(e,t,n){return n===void 0?`${e}/${t}`:`${e}/${t}/${n}`}function lf(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}}W({id:J.optional(),agent:q,project:q,thread:J.optional(),runner:q,cli:Z.nullable(),session:z().nullable(),trigger:sf,startedAt:X,endedAt:X.nullable(),exitReason:Xd.nullable(),status:Yd.nullable(),error:z().nullable(),usage:Jd.nullable(),costUsd:V().nonnegative().default(0),sessionCostUsd:V().nonnegative().optional(),toolCalls:V().int().nonnegative().default(0),model:z().nullable().default(null),work:af.optional()}),W({claude:z().optional(),codex:z().optional(),runner:q.optional()}),W({agent:q,project:q,reason:z().default(`manual wake`),kind:G([`manual`,`reflection`]).default(`manual`)});var uf=W({id:J,turnId:J.optional(),ts:X,outcome:G([`completed`,`failed`]),project:q,thread:J.optional(),trigger:z(),exitReason:z().nullable(),costUsd:V(),model:z().nullable(),summary:z().nullable(),error:z().nullable(),startedAt:X.optional(),toolCalls:V().int().nonnegative().optional()}),df=G([`waiting_stage`,`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`turn_cost`,`scaled`,`runner`,`home_conflict`]),ff=[`backlog`,`role_gap`,`churn`,`stale_thread`,`idle_member`,`blocked_capability`,`scaled`],pf=W({kind:df,key:z().min(1),summary:z().min(1),value:V(),threshold:V().optional(),project:q.optional(),agent:q.optional(),role:q.optional(),taskId:J.optional()}),mf=G([`24h`,`7d`,`all`]),Q=V().int().nonnegative(),hf=V().nonnegative(),gf=W({window:mf,since:X.nullable(),until:X,idle:W({turns:Q,idle:Q,unknown:Q,byTrigger:U(W({trigger:z(),turns:Q,idle:Q})),byAgent:U(W({agent:q,role:q.nullable(),turns:Q,idle:Q}))}),sentBack:W({finished:Q,sendBacks:Q,tasksSentBack:Q,byStage:U(W({project:q,stage:z(),count:Q})),bySender:U(W({agent:q,count:Q}))}),messages:W({finished:Q,messages:Q,byProject:U(W({project:q,finished:Q,messages:Q})),busiest:U(W({taskId:J,title:z(),project:q,messages:Q}))}),latency:W({mentions:Q,unanswered:Q,medianMs:hf.nullable(),slowestMs:hf.nullable(),byAgent:U(W({agent:q,mentions:Q,medianMs:hf,slowestMs:hf}))}),decisions:W({total:Q,byDay:U(W({day:z(),proposals:Q,answers:Q,stages:Q}))}),blocked:U(W({taskId:J,title:z().nullable(),project:q.nullable(),summary:z(),firstAt:X,lastAt:X,holds:H()}))}),_f=G([`trace`,`debug`,`info`,`warn`,`error`,`fatal`]),vf=W({clientId:z().min(1),clientSecret:z().min(1),users:U(z().min(1)).min(1)});W({dataDir:z().min(1),host:z().min(1),port:V().int().positive().max(65535),publicUrl:z().min(1).nullable(),logLevel:_f,concurrency:V().int().positive().nullable(),turnTimeoutMs:V().int().positive().nullable(),toolRounds:V().int().positive().nullable(),residentIdleMs:V().int().positive(),github:vf.nullable(),trustedProxies:V().int().min(0).max(16)}),W({serverUrl:z().url(),token:z().min(1).nullable(),dataDir:z().min(1),logLevel:_f,slots:V().int().positive().nullable(),clis:U(Z).min(1),capabilities:U(z())});var yf=(0,m.createContext)(null);function $(){let e=(0,m.useContext)(yf);if(e===null)throw Error(`useSession needs a signed-in SessionContext`);return e}function bf(){let{api:e}=$();return E({queryKey:[`society`],queryFn:e.society,staleTime:6e4})}function xf(){let{api:e}=$();return E({queryKey:[`members`],queryFn:e.members,refetchInterval:3e4})}function Sf(){let{api:e}=$();return E({queryKey:[`projects`],queryFn:e.projects,refetchInterval:6e4})}function Cf(){let{api:e}=$();return E({queryKey:[`roles`],queryFn:e.roles,refetchInterval:6e4})}function wf(){let{api:e}=$();return E({queryKey:[`scheduler`],queryFn:e.scheduler,refetchInterval:3e3})}function Tf(){let{api:e}=$();return E({queryKey:[`requests`],queryFn:e.requests,refetchInterval:6e4})}function Ef(e){let{api:t}=$();return E({queryKey:[`signals`],queryFn:()=>t.signals(200),enabled:e,refetchInterval:6e4})}function Df(e){let{api:t}=$();return E({queryKey:[`metrics`,e],queryFn:()=>t.metrics(e),refetchInterval:6e4})}function Of(){let{api:e}=$();return E({queryKey:[`channels`],queryFn:e.channels,refetchInterval:6e4})}function kf(){let{api:e}=$();return E({queryKey:[`threads`],queryFn:e.threads,refetchInterval:6e4})}function Af(e){let{api:t}=$();return E({queryKey:[`tasks`,e],queryFn:()=>t.tasks(e),refetchInterval:6e4})}function jf(e){return e.flatMap(e=>e.data??[])}function Mf(){let{api:e}=$();return st({queries:(Sf().data??[]).map(t=>({queryKey:[`tasks`,t.slug],queryFn:()=>e.tasks(t.slug),refetchInterval:6e4})),combine:jf})}function Nf(e){let{api:t}=$();return E({queryKey:[`task`,e],queryFn:()=>t.task(e??``),enabled:e!==null})}function Pf(){let{api:e}=$();return E({queryKey:[`proposals`],queryFn:e.proposals,refetchInterval:6e4})}function Ff(e){let{api:t}=$();return E({queryKey:[`proposal`,e],queryFn:()=>t.proposal(e)})}function If(){let{api:e}=$();return E({queryKey:[`skills`],queryFn:e.skills,staleTime:6e4})}function Lf(e,t){let{api:n}=$();return E({queryKey:[`turns`,e,t],queryFn:()=>n.turns(e,t),refetchInterval:6e4})}function Rf(e,t){let{api:n}=$();return E({queryKey:[`transcript`,e,t],queryFn:()=>n.transcript(e,t??``),enabled:t!==null,staleTime:1/0})}function zf(e){let{api:t}=$();return E({queryKey:[`memory`,e],queryFn:()=>t.memory(e)})}function Bf(e){let{api:t}=$();return E({queryKey:[`agent-skills`,e],queryFn:()=>t.agentSkills(e)})}function Vf(e,t){let{api:n}=$();return E({queryKey:[`history`,e,t],queryFn:()=>n.history(e,t),placeholderData:he})}function Hf(e,t,n){let{api:r}=$();return E({queryKey:[`home-change`,e,t],queryFn:()=>r.change(e,t),enabled:n,staleTime:1/0})}function Uf(e){let{api:t}=$();return E({queryKey:[`conflicts`,e],queryFn:()=>t.conflicts(e)})}function Wf(e){let{api:t}=$();return E({queryKey:[`dashboard`,e],queryFn:()=>t.dashboard(e),refetchInterval:6e4})}function Gf(e){let{api:t}=$();return E({queryKey:[`knowledge`,e],queryFn:()=>t.knowledge(e),refetchInterval:12e4})}function Kf(){let{api:e}=$();return E({queryKey:[`runners`],queryFn:()=>e.runners(),refetchInterval:6e4})}function qf(){let{api:e}=$();return E({queryKey:[`enrollments`],queryFn:e.enrollments,refetchInterval:5e3})}function Jf(e){let{api:t}=$();return E({queryKey:[`models`,e],queryFn:()=>t.models(e??`claude`),enabled:e!==null,staleTime:6e5,retry:!1})}function Yf(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 Xf=[[`day`,86400],[`hour`,3600],[`minute`,60]],Zf=new Intl.RelativeTimeFormat(`en`,{numeric:`auto`});function Qf(e,t){let n=Math.round((Date.parse(e)-t)/1e3);for(let[e,t]of Xf)if(Math.abs(n)>=t)return Zf.format(Math.round(n/t),e);return`just now`}function $f(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 ep(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{Hd as $,ut as $t,Nf as A,p as An,V as At,lf as B,kt as Bt,Cf as C,x as Cn,Ku as Ct,Ef as D,ve as Dn,Hu as Dt,$ as E,be as En,J as Et,gf as F,hn as Ft,Qd as G,At as Gt,ef as H,Rt as Ht,mf as I,Qt as It,Pd as J,Ot as Jt,$u as K,jt as Kt,pf as L,Kt as Lt,kf as M,o as Mn,pu as Mt,Rf as N,s as Nn,z as Nt,If as O,te as On,U as Ot,Lf as P,l as Pn,tu as Pt,Ud as Q,Dt as Qt,ff as R,Gt as Rt,Tf as S,ae as Sn,qu as St,wf as T,C as Tn,q as Tt,qd as U,Pt as Ut,cf as V,Ft as Vt,$d as W,Mt as Wt,Kd as X,Et as Xt,jd as Y,pt as Yt,zd as Z,_t as Zt,Jf as _,oe as _n,xd as _t,Bf as a,lt as an,ld as at,Ff as b,b as bn,bd as bt,Wf as c,ht as cn,Md as ct,Uf as d,Pe as dn,ed as dt,Ct as en,Wd as et,Vf as f,Ne as fn,Fd as ft,Df as g,we as gn,gd as gt,zf as h,Te as hn,yd as ht,yf as i,vt as in,Sd as it,Af as j,d as jn,W as jt,bf as k,g as kn,H as kt,qf as l,E as ln,Nd as lt,xf as m,Oe as mn,td as mt,ep as n,dt as nn,Td as nt,Mf as o,mt as on,Gd as ot,Gf as p,ke as pn,Rd as pt,wd as q,St as qt,$f as r,Tt as rn,fd as rt,Of as s,wt as sn,Id as st,Qf as t,ft as tn,Ad as tt,Hf as u,Re as un,Dd as ut,Yf as v,ue as vn,Ld as vt,Kf as w,y as wn,Y as wt,Pf as x,ce as xn,Gu as xt,Sf as y,le as yn,dd as yt,uf as z,Ht as zt};