mastra 1.40.3-alpha.0 → 1.40.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/factory/assets/{AlertDialog.es-D0lBXghn.js → AlertDialog.es-BZTBj-Ow.js} +1 -1
- package/dist/factory/assets/{BoardConfigPage-Dj5kwI2y.js → BoardConfigPage-DjXxXroS.js} +1 -1
- package/dist/factory/assets/{BoardIcons-BwoF0u8e.js → BoardIcons-Cpj2za0J.js} +1 -1
- package/dist/factory/assets/{BoardIntakePage-Q9Xj8mXp.js → BoardIntakePage-BVsPx7DM.js} +1 -1
- package/dist/factory/assets/{BoardRulesPage-D0CHHtNK.js → BoardRulesPage-jNjZP0S7.js} +1 -1
- package/dist/factory/assets/{Breadcrumb.es-DjvzVu5v.js → Breadcrumb.es-DVw5RHLo.js} +1 -1
- package/dist/factory/assets/{CompositeRoot-Dh1DVCmf.js → CompositeRoot-BtGsxbLn.js} +1 -1
- package/dist/factory/assets/{ConditionRows-BII3QMlB.js → ConditionRows-DsnKRQxV.js} +1 -1
- package/dist/factory/assets/{DescriptionMarkdown-DdlduiCY.js → DescriptionMarkdown-DPlQn5q6.js} +1 -1
- package/dist/factory/assets/{FactorySkillPage-CgiFCZpq.js → FactorySkillPage-vmfJqCAS.js} +1 -1
- package/dist/factory/assets/{FactorySkillsPage-BrewD3Xe.js → FactorySkillsPage-B1KW9fhb.js} +1 -1
- package/dist/factory/assets/{Field.es-DnLKooWt.js → Field.es-I4QCnl1o.js} +2 -2
- package/dist/factory/assets/{GithubIcon.es-Bg-ShonN.js → GithubIcon.es-B7Jlpkjd.js} +1 -1
- package/dist/factory/assets/{HoverCard.es-C8aHXADr.js → HoverCard.es-Dnm-ghrz.js} +1 -1
- package/dist/factory/assets/{IconArrowRotateClockwise.es-EH4DxhF-.js → IconArrowRotateClockwise.es-DhowLRn4.js} +1 -1
- package/dist/factory/assets/{IconCodeTree.es-CoO-cbs1.js → IconCodeTree.es-E6vLoMad.js} +1 -1
- package/dist/factory/assets/IconEyeSlash.es-BZ6NRFrO.js +1 -0
- package/dist/factory/assets/{IconScript.es-CJGOgANb.js → IconScript.es--vf6h52G.js} +1 -1
- package/dist/factory/assets/{Input-CI6m9l4V.js → Input-dMuuS5IE.js} +1 -1
- package/dist/factory/assets/{InputNumber.es-Dy6Zb_oj.js → InputNumber.es-BPDq_0hm.js} +1 -1
- package/dist/factory/assets/{KnowledgePage--7Lsedqn.js → KnowledgePage-COp3vCGs.js} +1 -1
- package/dist/factory/assets/{MarkdownRenderer-BMd9aqtH-Dt2AEdfj.js → MarkdownRenderer-BMd9aqtH-BK9bzaqa.js} +1 -1
- package/dist/factory/assets/{ModelPackTimeline-fFIOAxty.js → ModelPackTimeline-BJXDWCur.js} +1 -1
- package/dist/factory/assets/{NewBoardPage-DZ0Rbam8.js → NewBoardPage-D7tR011b.js} +1 -1
- package/dist/factory/assets/{NewPage-pP4mPkSn.js → NewPage-BjnFQwxO.js} +1 -1
- package/dist/factory/assets/{OnboardingPage-ztL7s9Gl.js → OnboardingPage-DghFvtpQ.js} +1 -1
- package/dist/factory/assets/RadioGroup-DwB_0H0R.js +1 -0
- package/dist/factory/assets/{RadioGroup.es-C8uhRWPA.js → RadioGroup.es-Diuc7XUK.js} +1 -1
- package/dist/factory/assets/{RootGuards-DXwaB2QY.js → RootGuards-Bq_5BP5b.js} +1 -1
- package/dist/factory/assets/{RulesPage-DgBirgyO.js → RulesPage-BxCPbycK.js} +1 -1
- package/dist/factory/assets/{SearchInput.es-Pf9qxs2A.js → SearchInput.es-EPXeDwAb.js} +1 -1
- package/dist/factory/assets/SessionLayout-mUnA_9Ot.js +4 -0
- package/dist/factory/assets/SessionPage-BtWjRjo1.js +1 -0
- package/dist/factory/assets/SettingsPage-IPmJcblp.js +3 -0
- package/dist/factory/assets/{SettingsSubsection-DaTV_qpr.js → SettingsSubsection-CMossisW.js} +1 -1
- package/dist/factory/assets/{Sidebar-zeEMJHoc-CAYPr70W.js → Sidebar-zeEMJHoc-Bxyc3674.js} +1 -1
- package/dist/factory/assets/{SignInPage-5os1Jbzt.js → SignInPage-BkShLKz1.js} +1 -1
- package/dist/factory/assets/{SkillBadges-B_RoiVSH.js → SkillBadges-CN6YD9QA.js} +1 -1
- package/dist/factory/assets/{SlackConnectionPage-OMyUwT1O.js → SlackConnectionPage-mWQc9JRf.js} +1 -1
- package/dist/factory/assets/{StackedDiffs-wbpgGXrR.js → StackedDiffs-DjwX9sor.js} +1 -1
- package/dist/factory/assets/{Switch.es-D4TVspgz.js → Switch.es-BHKLznzT.js} +1 -1
- package/dist/factory/assets/{TabsRoot-DXvmv54V.js → TabsRoot-4cFAZPuR.js} +1 -1
- package/dist/factory/assets/{Textarea.es-BeC279Kh.js → Textarea.es-CrxP76D-.js} +1 -1
- package/dist/factory/assets/{buttons-group-DA_wORqQ-CESZ0_Us.js → buttons-group-DA_wORqQ-CeiWcE01.js} +1 -1
- package/dist/factory/assets/{code-block-MoHEPzJi-0pwwq7GL.js → code-block-MoHEPzJi-AiVE7yQU.js} +1 -1
- package/dist/factory/assets/{code-editor-zfQ0QGHJ-Dnbelmjy.js → code-editor-zfQ0QGHJ-BtKKJIqS.js} +1 -1
- package/dist/factory/assets/{copy-button-C3L1ZoAD-ZUkWCqKU.js → copy-button-C3L1ZoAD-pBYcknU5.js} +1 -1
- package/dist/factory/assets/{esm-C7LfA2Jk.js → esm-BjvkvBIs.js} +1 -1
- package/dist/factory/assets/{index-DVwYIa0W.css → index-CuZK36j6.css} +1 -1
- package/dist/factory/assets/index-NEF1i6yv.js +165 -0
- package/dist/factory/assets/{input-group-BXqgO3Q2-DzeL0Gjq.js → input-group-BXqgO3Q2-7uE7UjzF.js} +1 -1
- package/dist/factory/assets/{onboardingFlow-CKxltbcm.js → onboardingFlow-Ct_pM-EX.js} +1 -1
- package/dist/factory/assets/{provider-credential-D3GMGkrr.js → provider-credential-B9Y0ovT3.js} +1 -1
- package/dist/factory/assets/relative-time.es-wpw_qmIJ.js +1 -0
- package/dist/factory/assets/{remarkKnowledgeLinks.es-B-tYr6Bw.js → remarkKnowledgeLinks.es-C9XE1vZo.js} +1 -1
- package/dist/factory/assets/{ruleLanes-CnBKj6eB.js → ruleLanes-CVuOFT_F.js} +1 -1
- package/dist/factory/assets/{settings-D8kIm4wB-Crk4R7dN.js → settings-D8kIm4wB-CQbqVTud.js} +1 -1
- package/dist/factory/assets/{use-clock.es-BRtR1ha2.js → use-clock.es-DcwchSBi.js} +1 -1
- package/dist/factory/assets/{useBoardCatalog-BWEZygG2.js → useBoardCatalog-D5xZ_2Xd.js} +1 -1
- package/dist/factory/assets/{useBoardEditor-DhrV_vHP.js → useBoardEditor-DIdpxjCz.js} +1 -1
- package/dist/factory/assets/useDraftModelGuards-CAShZoHh.js +29 -0
- package/dist/factory/assets/{useFactoryDecisions-uD1xceQU.js → useFactoryDecisions-BCqzi2Z6.js} +1 -1
- package/dist/factory/assets/{useGlobalSearchControls-BpSe2Oen.js → useGlobalSearchControls-CQvRIEQY.js} +1 -1
- package/dist/factory/assets/{useInfiniteQuery-CZPCsZCl.js → useInfiniteQuery-XQoKhmBF.js} +1 -1
- package/dist/factory/assets/{useIntakeRoutes-C4ob2f2v.js → useIntakeRoutes-CO5RNQRx.js} +1 -1
- package/dist/factory/assets/{useRouteSessionId-DdAvkJPa.js → useRouteSessionId-fsWC_coB.js} +1 -1
- package/dist/factory/assets/{useRowDrag-De5Tj8SP.js → useRowDrag-Er_-vkz8.js} +1 -1
- package/dist/factory/assets/{useSessionCard-w-2LebX-.js → useSessionCard-ZKG4PEL7.js} +1 -1
- package/dist/factory/assets/{useSessionRepository-B9WnbBsY.js → useSessionRepository-DlERDfty.js} +1 -1
- package/dist/factory/assets/{useSessionRows-DQ5H8cED.js → useSessionRows-CK_XCZpc.js} +1 -1
- package/dist/factory/assets/{useThreadWorkspacePath-BXgaPpZH.js → useThreadWorkspacePath-CKVxAhqk.js} +1 -1
- package/dist/factory/assets/workspaces-D44CefKy.js +2 -0
- package/dist/factory/index.html +36 -36
- package/dist/index.js +1 -1
- package/dist/studio/assets/{index-menbjLeT.js → index-NHBQRBt4.js} +2 -2
- package/dist/studio/assets/{main-BjGpEwF_.js → main-d0yQCqRz.js} +277 -277
- package/dist/studio/index.html +1 -1
- package/package.json +5 -5
- package/dist/factory/assets/RadioGroup-Bn4ryXJm.js +0 -1
- package/dist/factory/assets/SessionLayout-CZPWzGQy.js +0 -4
- package/dist/factory/assets/SessionPage-CZRkLPmc.js +0 -1
- package/dist/factory/assets/SettingsPage-BVO5Cnca.js +0 -3
- package/dist/factory/assets/index-BRs5cQ2x.js +0 -165
- package/dist/factory/assets/relative-time.es-CaeSND32.js +0 -1
- package/dist/factory/assets/useDraftModelGuards-CyhFV5s9.js +0 -29
- package/dist/factory/assets/workspaces-B1zVvDbs.js +0 -2
package/dist/docs/SKILL.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Bt as e,Gt as t,Ht as n,It as r,Jt as i,Kt as a,Rt as o,Ut as s,Vt as c,Wt as l,Zr as u,qt as d,zt as f}from"./GithubIcon.es-
|
|
1
|
+
import{Bt as e,Gt as t,Ht as n,It as r,Jt as i,Kt as a,Rt as o,Ut as s,Vt as c,Wt as l,Zr as u,qt as d,zt as f}from"./GithubIcon.es-B7Jlpkjd.js";import{O as p,T as m}from"./IconChevronRightMedium.es-BkPdzxSm.js";var h=p();function g(e){return(0,h.jsx)(r,{...e,modal:!0,disablePointerDismissal:!0})}function _({size:e=`sm`,...t}){return(0,h.jsx)(c,{"data-slot":`alert-dialog-content`,size:e,showCloseButton:!1,...t,role:`alertdialog`})}function v({children:t,loading:n,...r}){return(0,h.jsx)(e,{render:(0,h.jsx)(u,{variant:`primary`,size:`md`,loading:n,className:m(d,i.md),children:t}),...r})}g.Trigger=a,g.Content=_,g.Header=l,g.Footer=s,g.Body=o,g.Title=t,g.Description=n,g.Action=v,g.Cancel=f;export{g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./Breadcrumb.es-DjvzVu5v.js";import{t as r}from"./EmptyState-IMGHVwoU-DpmxDoqJ.js";import{$r as i,Ar as a,Br as o,Ci as s,Dn as c,Dr as l,En as u,Er as d,Gr as f,Hr as p,Ir as m,Kr as h,Lr as g,Nr as _,Oi as v,On as y,Or as b,Pi as x,Qr as S,Rr as C,Si as w,Tr as T,U as E,V as D,Vr as O,Wr as ee,Xr as k,Yr as A,ci as j,hi as M,jr as te,kr as ne,li as re,mi as ie,mr as ae,si as oe,ui as N,vr as se,wi as ce,wr as P,xi as F,yr as le,zr as ue}from"./index-BRs5cQ2x.js";import{a as de}from"./Sidebar-zeEMJHoc-CAYPr70W.js";import{f as fe,t as I,u as pe}from"./settings-D8kIm4wB-Crk4R7dN.js";import{O as me,T as L,k as he,n as R,s as z,t as ge}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{Ai as _e,Jn as B,Mi as ve,Qn as ye,Zr as V,ki as be,n as H,or as xe,qr as Se,r as Ce,rr as we,rt as Te}from"./GithubIcon.es-Bg-ShonN.js";import{c as Ee,o as De,r as Oe,s as ke,t as Ae}from"./useBoardEditor-DhrV_vHP.js";import{i as je,t as Me}from"./SkillBadges-B_RoiVSH.js";import{a as U,c as Ne,f as Pe,l as Fe,s as Ie}from"./boardConfigPaths-Btimpi_r.js";import{t as W}from"./AlertDialog.es-D0lBXghn.js";import{t as G}from"./SettingsSubsection-DaTV_qpr.js";import{_t as Le,cn as Re,gt as K,ht as ze,mt as Be,on as Ve,pt as q}from"./useSessionRows-DQ5H8cED.js";import{b as He,v as Ue,y as We}from"./BoardIcons-BwoF0u8e.js";import{n as Ge}from"./useBoardCatalog-BWEZygG2.js";import{h as Ke,o as qe}from"./useIntakeRoutes-C4ob2f2v.js";import{a as Je,n as Ye,r as Xe,t as Ze}from"./HoverCard.es-C8aHXADr.js";import{r as Qe}from"./overlays-B4T3HdBk.js";import{t as $e}from"./DescriptionMarkdown-DdlduiCY.js";import{h as et,w as tt,y as nt}from"./ruleLanes-CnBKj6eB.js";import{j as rt}from"./TabsRoot-DXvmv54V.js";import{a as it,n as at,r as ot,s as st,t as J}from"./Field.es-DnLKooWt.js";import{t as ct}from"./Switch.es-D4TVspgz.js";import{n as lt,t as ut}from"./ConditionRows-BII3QMlB.js";import{t as dt}from"./Textarea.es-BeC279Kh.js";import{t as ft}from"./IconLock.es-Da9O9rEP.js";import{t as pt}from"./IconPlusMedium.es-BOotRziY.js";import{r as mt}from"./IconClipboard2.es-DTJVO2Dz.js";import{n as ht,t as gt}from"./boardCatalog-y-s19dQU.js";import{t as _t}from"./IconArrowRotateCounterClockwise.es-Dxk4yi6B.js";import{t as vt}from"./InlineText-tcMMASWp.js";import{c as yt}from"./code-block-MoHEPzJi-0pwwq7GL.js";var Y=me(),bt=`mx-auto w-full max-w-2xl`,xt=`sticky left-0 w-[100cqw] px-4`,St=`mx-auto flex w-max px-[max(0.75rem,calc((100cqw_-_42rem)/2_-_1.25rem))]`,Ct=`relative flex w-64 shrink-0 flex-col px-2 before:via-border-strong not-first:before:absolute not-first:before:inset-y-0 not-first:before:left-0 not-first:before:w-px not-first:before:bg-linear-to-b not-first:before:from-transparent not-first:before:to-transparent`,wt=`flex items-center gap-2 px-3 pt-3 pb-1`;function Tt({pinned:e,sticky:t,className:n,children:r}){let i=t&&`sticky bottom-4 z-10`;return e?(0,Y.jsx)(`div`,{className:L(xt,i),children:(0,Y.jsx)(`div`,{className:L(bt,n),children:r})}):(0,Y.jsx)(`div`,{className:L(bt,i,n),children:r})}function Et({boardId:e,phases:t,column:n,action:r,notice:i,leaving:a,LinkComponent:o=`a`}){return(0,Y.jsxs)(`section`,{"aria-label":`Board map`,className:`flex flex-col gap-3`,children:[r&&(0,Y.jsx)(Tt,{pinned:!0,className:`flex justify-end`,children:r}),i&&(0,Y.jsx)(Tt,{pinned:!0,children:i}),a&&(0,Y.jsx)(Tt,{pinned:!0,className:`mb-4`,children:(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:a})}),(0,Y.jsx)(`ol`,{"aria-label":`Phases`,className:St,children:t.map(r=>{let i=n(r);return(0,Y.jsxs)(`li`,{"aria-label":r.name,className:Ct,children:[(0,Y.jsx)(`div`,{className:wt,children:(0,Y.jsxs)(o,{href:i.href,className:`flex min-w-0 items-center gap-2 hover:underline focus-visible:underline focus-visible:outline-hidden`,children:[(0,Y.jsx)(We,{stage:r.key,kind:He(e,r.kind),decorative:!0}),(0,Y.jsx)(R,{as:`span`,variant:`label`,tone:`ink`,className:`truncate`,children:r.name})]})}),(0,Y.jsx)(`div`,{className:`p-3`,children:(0,Y.jsx)(w,{boardId:e,phase:r,phases:t,arrivals:i.arrivals,starts:i.starts,agent:i.agent})})]},r.key)})})]})}var X=e(he(),1),Dt=`mx-auto w-full max-w-2xl`,Ot=`[container-type:inline-size] h-full min-h-0 overflow-auto overscroll-x-contain [scrollbar-gutter:stable]`,kt=`sticky left-0 w-[100cqw] px-4`;function Z({pinned:e,sticky:t,className:n,children:r}){let i=t&&`sticky bottom-4 z-10`;return e?(0,Y.jsx)(`div`,{className:L(kt,i),children:(0,Y.jsx)(`div`,{className:L(Dt,n),children:r})}):(0,Y.jsx)(`div`,{className:L(Dt,i,n),children:r})}function At({factoryId:e,boardId:t,phase:n,skills:r}){let i=n.runner;if(!i)return null;let a=i.skill,o=a?r?.find(e=>e.name===a):void 0,s=a!==void 0&&r!==void 0&&o===void 0,c=s||o?.error!==void 0,l=a&&!s?Ne(e,t,a):U(e,t,n.key),u=a?x:Qe;return(0,Y.jsxs)(Ze,{children:[(0,Y.jsxs)(Xe,{delay:0,closeDelay:100,render:(0,Y.jsx)(B,{to:l}),className:L(z,`border-border bg-fill-subtle hover:bg-fill flex w-fit max-w-full min-w-0 items-center gap-1.5 rounded-md border px-1.5 py-0.5 transition-colors`,c&&`border-destructive-foreground text-destructive-foreground`),children:[(0,Y.jsx)(u,{"aria-hidden":!0,className:`size-icon-sm shrink-0 opacity-70`}),(0,Y.jsx)(`span`,{className:`truncate`,children:a??`Agent`}),c&&(0,Y.jsx)(`span`,{className:`sr-only`,children:s?`, skill not found`:`, skill failed to load`})]}),(0,Y.jsxs)(Ye,{side:`right`,align:`start`,sideOffset:8,collisionPadding:8,showArrow:!1,className:`flex w-96 max-w-[calc(100vw-2rem)] flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(u,{"aria-hidden":!0,className:`text-muted-foreground size-icon-md shrink-0`}),(0,Y.jsx)(R,{as:`span`,variant:`label`,tone:`ink`,className:`truncate`,children:a??`${n.name} agent`}),o&&(0,Y.jsx)(Me,{skill:o})]}),s?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`This factory has no `,a,` skill, so cards entering `,n.name,` fail to start.`]}):o?.error?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`Agents can't load this skill: `,o.error]}):o?.description&&(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:o.description}),a&&!r&&(0,Y.jsx)(F,{children:`Loading the skill…`}),o?.content.trim()&&(0,Y.jsx)(jt,{title:`Skill instructions`,children:(0,Y.jsx)($e,{titleLevel:`h3`,children:o.content})}),i.instructions?.trim()&&(0,Y.jsx)(jt,{title:`${n.name} adds`,children:(0,Y.jsx)($e,{titleLevel:`h3`,children:i.instructions})}),i.goal?.objective&&(0,Y.jsx)(jt,{title:i.goal.maxRuns?`Goal, up to ${i.goal.maxRuns} runs`:`Goal`,children:(0,Y.jsx)(R,{as:`p`,variant:`body-sm`,className:`whitespace-pre-wrap`,children:i.goal.objective})}),(0,Y.jsxs)(R,{as:`p`,variant:`caption`,tone:`muted`,children:[`Session `,i.context||`work`,`, shared with phases that name it too.`]})]})]})}function jt({title:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(R,{as:`span`,variant:`caption`,tone:`faint`,children:e}),(0,Y.jsx)(`div`,{className:`bg-fill-subtle max-h-56 overflow-y-auto rounded-md px-2.5 py-2`,children:t})]})}function Mt({rules:e,title:t,to:n,boardId:r,boards:i}){return(0,Y.jsxs)(Ze,{children:[(0,Y.jsx)(Xe,{delay:0,closeDelay:100,render:(0,Y.jsx)(B,{to:n}),className:L(z,`w-fit rounded-sm underline decoration-dotted underline-offset-2`),children:et(e.length)}),(0,Y.jsxs)(Ye,{side:`right`,align:`start`,sideOffset:8,collisionPadding:8,showArrow:!1,className:`flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2`,children:[(0,Y.jsx)(R,{as:`span`,variant:`caption`,tone:`faint`,children:t}),(0,Y.jsx)(`ul`,{"aria-label":t,className:`flex max-h-80 flex-col gap-1.5 overflow-y-auto`,children:e.map(e=>(0,Y.jsx)(le,{rule:e,boardId:r,boards:i},e.id))})]})]})}function Nt({factoryId:e,boardId:t,phases:n,skills:r,action:i,onAutoStart:a}){let o=Ge(e),s=qe(e),c=o.isPending||s.isPending,l=o.data?.find(e=>e.id===t)?.initialPhase??n[0]?.key,u=n.map(e=>P(e,n)),f=s.data&&l?d(s.data.intakeRoutes,{key:t,initialPhase:l}):void 0;return(0,Y.jsx)(Et,{boardId:t,phases:u.map(T),LinkComponent:ae,action:i,notice:s.isError&&(0,Y.jsx)(H,{variant:`warning`,children:(0,Y.jsx)(H.Message,{children:`Rules didn’t load, so the map doesn’t count them.`})}),leaving:f&&f.leaving.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Mt,{rules:f.leaving,title:`Rules that send cards to other boards`,to:Ie(e,t,`leaving`),boardId:t,boards:o.data}),` `,f.leaving.length===1?`sends`:`send`,` cards from here to other boards.`]}),column:i=>{let s=n.find(e=>e.key===i.key),u=f?.into.get(s.key)??[];return{href:U(e,t,s.key),arrivals:(0,Y.jsxs)(Y.Fragment,{children:[c?(0,Y.jsx)(q,{line:`text-caption`,className:`w-20 motion-reduce:before:animate-none`}):f?u.length>0?(0,Y.jsx)(Mt,{rules:u,title:`Rules that move cards into ${s.name}`,to:Ie(e,t,{into:s.key}),boardId:t,boards:o.data}):(0,Y.jsx)(F,{children:`No rule moves cards here`}):(0,Y.jsx)(F,{children:`Rules didn’t load`}),s.key===l&&(0,Y.jsx)(F,{children:`New cards start here`})]}),starts:(0,Y.jsx)(se,{label:s.name,autoStart:s.autoStart??!1,autoStartWhen:s.autoStartWhen,onChange:a&&(e=>a(s.key,e))}),agent:(0,Y.jsx)(At,{factoryId:e,boardId:t,phase:s,skills:r})}}})}var Pt=`Finish or remove unfinished conditions to save.`;function Ft({label:e,description:t,rule:n,disabled:r,facts:i=nt,options:a,schema:o,json:s,onChange:c,onUnfinished:l}){let[u,d]=(0,X.useState)(void 0),f=s?s.text:u,p=s?s.onChange:d,m=(0,X.useId)(),h=f===void 0?S(o,n):A(o,f),g=e=>{p(e);let t=k(o,e);`problem`in t?c(n??null,t.problem):c(t.rule,void 0)};return(0,Y.jsxs)(J,{invalid:h!==void 0,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(it,{htmlFor:m,children:e}),(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,disabled:r,onClick:()=>{f===void 0?p(n?JSON.stringify(n,null,2):``):(p(void 0),c(n??null,S(o,n)))},children:f===void 0?`Edit as JSON`:`Edit as conditions`})]}),(0,Y.jsx)(at,{children:t}),f===void 0?r?(0,Y.jsx)(R,{id:m,as:`p`,variant:`caption`,tone:`muted`,children:tt(n,a)}):(0,Y.jsx)(`div`,{id:m,children:(0,Y.jsx)(ut,{label:e,rule:n,facts:i,options:a,onChange:(e,t)=>{l?.(t),t?c(n??null,Pt):c(e,S(o,e))}})}):(0,Y.jsx)(dt,{id:m,"aria-label":`${e} JSON`,value:f,disabled:r,rows:6,onChange:e=>g(e.target.value)}),h&&(0,Y.jsx)(ot,{children:h})]})}var It=`inline-flex h-8 max-w-48 min-w-0 items-center gap-1.5 rounded-lg border px-2.5`;function Lt({phase:e,phases:t,next:n,required:r,boardId:i,disabled:a,onChange:o}){let s=e=>o(n.includes(e)?n.filter(t=>t!==e):t.filter(t=>t.key===e||n.includes(t.key)).map(e=>e.key));return(0,Y.jsx)(`ul`,{"aria-label":`Allowed moves from ${e.name}`,className:`flex flex-wrap gap-1.5`,children:t.map(t=>{let o=(0,Y.jsx)(We,{stage:t.key,kind:He(i,t.kind),decorative:!0});if(t.key===e.key)return(0,Y.jsxs)(`li`,{className:L(It,`border-border-strong bg-card shadow-raised dark:bg-muted`),children:[o,(0,Y.jsx)(Rt,{children:t.name}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`(this phase)`})]},t.key);let c=n.includes(t.key),l=c&&r.has(t.key),u=l||a,d=(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":c,"aria-label":l?`${t.name} (locked)`:void 0,"aria-disabled":u||void 0,onClick:u?void 0:()=>s(t.key),className:L(It,`group/move transition-colors`,c?`bg-fill text-foreground border-transparent`:`border-border text-muted-foreground border-dashed`,!u&&(c?`hover:bg-fill-hover`:`hover:text-foreground hover:border-border-strong`),u&&!l&&`cursor-default`,z),children:[(0,Y.jsx)(`span`,{className:L(`grid place-items-center`,!c&&`opacity-50`),children:o}),(0,Y.jsx)(Rt,{children:t.name}),(0,Y.jsx)(`span`,{className:`text-muted-foreground grid size-3.5 shrink-0 place-items-center`,children:l?(0,Y.jsx)(ft,{className:`size-icon-sm`,"aria-hidden":!0}):c?(0,Y.jsx)(Ve,{className:`size-icon-sm`,"aria-hidden":!0}):!a&&(0,Y.jsx)(pt,{className:`size-icon-sm invisible group-hover/move:visible group-focus-visible/move:visible`,"aria-hidden":!0})})]});return(0,Y.jsx)(`li`,{className:`min-w-0`,children:l?(0,Y.jsxs)(be,{children:[(0,Y.jsx)(ve,{render:d}),(0,Y.jsx)(_e,{children:`Factory's code makes this move`})]}):d},t.key)})})}function Rt({children:e}){return(0,Y.jsx)(R,{as:`span`,variant:`label`,className:`truncate`,children:e})}var zt=`What the agent passes to factory_report_outcome. Letters, digits, hyphens and underscores; unique in this phase.`,Bt=`Tells the agent when this outcome applies, and shows in the card's history when Factory moves the card.`,Vt=`Where Factory moves the card once the run that reported this outcome ends. Only allowed moves.`;function Ht({phase:e,phases:t,disabled:n,onChange:r}){let i=e.outcomes?.length?e.outcomes:null,o=C(e,t),s=e=>t.find(t=>t.key===e)?.name??e;if(o.length===0)return(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:`Allow a move first; each outcome goes to one of them.`});let c=e.exitTool?.id,l=e=>{if(!c)return null;let n=_(e,t);return n?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,tone:`muted`,children:[`When `,(0,Y.jsx)(`code`,{children:c}),` succeeds, it reports `,(0,Y.jsx)(`code`,{children:n.key}),`, moving the card to`,` `,s(n.to),`.`]}):(0,Y.jsx)(H,{variant:`warning`,children:(0,Y.jsxs)(H.Message,{children:[`When `,(0,Y.jsx)(`code`,{children:c}),` succeeds, no outcome is picked, so the card waits for the agent to report one. Key an outcome `,(0,Y.jsx)(`code`,{children:`advance`}),` to choose where its success moves the card.`]})})};if(!i){let i=a(e,t);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`ul`,{"aria-label":`${e.name} outcomes`,className:`flex flex-col gap-1`,children:i.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(R,{as:`span`,variant:`caption`,tone:`muted`,children:[(0,Y.jsx)(`code`,{children:e.key}),` moves the card to `,s(e.to)]})},e.key))}),l(i),(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:`This phase lists no outcomes, so the agent may report any allowed move by the key of the phase it goes to. Customize them to give each a description the agent reads, or to offer fewer moves than people have.`}),!n&&(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>r(i.slice(0,20)),children:`Customize outcomes`})})]})}let u=ue(i),d=(e,t)=>r(i.map((n,r)=>r===e?{...n,...t}:n)),f=e=>{let t=i.filter((t,n)=>n!==e);r(t.length>0?t:null)},p=g(e,t,i);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(I,{children:[(0,Y.jsxs)(`div`,{className:`flex gap-3 px-4 pt-3`,children:[(0,Y.jsx)(J,{className:`w-36`,children:(0,Y.jsx)(it,{size:`smaller`,info:zt,children:`Key`})}),(0,Y.jsx)(J,{className:`min-w-48 flex-1`,children:(0,Y.jsx)(it,{size:`smaller`,info:Bt,children:`Description`})}),(0,Y.jsx)(J,{className:`w-44`,children:(0,Y.jsx)(it,{size:`smaller`,info:Vt,children:`Moves the card to`})}),!n&&(0,Y.jsx)(`div`,{"aria-hidden":!0,className:`w-8`})]}),(0,Y.jsx)(`ul`,{"aria-label":`${e.name} outcomes`,className:`flex flex-col`,children:i.map((t,r)=>{let i=u[r]??{},a=`outcome ${t.key||r+1}`;return(0,Y.jsxs)(`li`,{className:`flex items-start gap-3 px-4 py-2`,children:[(0,Y.jsxs)(J,{invalid:!!i.key,disabled:n,className:`w-36`,children:[(0,Y.jsx)(st,{"aria-label":`${e.name} outcome ${r+1} key`,value:t.key,placeholder:`e.g. review`,disabled:n,onChange:e=>d(r,{key:e.target.value.trim()})}),i.key&&(0,Y.jsx)(ot,{children:i.key})]}),(0,Y.jsxs)(J,{invalid:!!i.label,disabled:n,className:`min-w-48 flex-1`,children:[(0,Y.jsx)(st,{"aria-label":`${e.name} outcome ${r+1} label`,value:t.label,placeholder:`e.g. Change request opened for review`,disabled:n,onChange:e=>d(r,{label:e.target.value})}),i.label&&(0,Y.jsx)(ot,{children:i.label})]}),(0,Y.jsx)(J,{disabled:n,className:`w-44`,children:(0,Y.jsxs)(Be,{value:t.to,disabled:n,onValueChange:e=>d(r,{to:String(e)}),children:[(0,Y.jsx)(Le,{size:`sm`,"aria-label":`${e.name} ${a} goes to`,className:`w-full`,children:(0,Y.jsx)(`span`,{className:`truncate`,children:s(t.to)})}),(0,Y.jsx)(ze,{children:o.map(e=>(0,Y.jsx)(K,{value:e,children:s(e)},e))})]})}),!n&&(0,Y.jsx)(V,{size:`icon-sm`,variant:`ghost`,tooltip:`Remove ${a}`,onClick:()=>f(r),children:(0,Y.jsx)(mt,{})})]},r)})})]}),l(i),!n&&(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[p&&i.length<20&&(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,icon:(0,Y.jsx)(pt,{}),onClick:()=>r([...i,p]),children:`Add outcome`}),(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>r(null),children:`Use one per move`})]})]})}function Ut({label:e,children:t}){return(0,Y.jsx)(`ol`,{"aria-label":e,className:`flex flex-col`,children:t})}function Wt({icon:e,title:t,description:n,children:r}){let i=(0,X.useId)();return(0,Y.jsxs)(`li`,{"aria-labelledby":i,className:`before:bg-border relative grid grid-cols-[--spacing(7)_minmax(0,1fr)] gap-x-3 pb-8 before:absolute before:top-9 before:bottom-1 before:left-[calc(--spacing(3.5)-0.5px)] before:w-px last:pb-0 last:before:hidden`,children:[(0,Y.jsx)(`span`,{className:`border-border bg-card text-muted-foreground [&_svg]:size-icon-sm flex size-7 items-center justify-center rounded-full border`,children:e}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-h-7 flex-col justify-center`,children:[(0,Y.jsx)(R,{as:`h2`,id:i,variant:`subheading`,tone:`ink`,children:t}),n&&(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:n})]}),r]})]})}var Gt=`__none__`,Kt=`sm:max-w-xs`;function qt({phase:e,phases:t,requiredNextPhases:n,skills:r,skillsEditable:i,factoryId:a,boardId:o,disabled:s,rawRules:c,onChange:u,onRawRule:d,onUnfinished:f,onRemove:p}){let m=lt(a),g=e.kind===`working`,_=C(e,t),v=e.runner?.instructions??``,y=e.runner?.goal,S=e.tools??[],w=e.exitTool?.id??``,T=e.runner?.skill,D=T?r?.find(e=>e.name===T):void 0,O=T!==void 0&&r!==void 0&&D===void 0,k=t=>{let n={...e.runner,...t},r=Object.fromEntries(Object.entries(n).filter(([,e])=>e!=null&&e!==``));u({...e,runner:Object.keys(r).length>0?r:null})},A=e=>({text:c[e],onChange:t=>d(e,t)}),j=(0,Y.jsx)(Lt,{phase:e,phases:t,next:_,required:new Set(n),boardId:o,disabled:s,onChange:t=>u(h(e,t))}),te=p&&(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(V,{variant:`ghost`,icon:(0,Y.jsx)(mt,{}),onClick:p,children:[`Remove `,e.name]})});return g?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsxs)(Ut,{label:`How ${e.name} runs`,children:[(0,Y.jsx)(Wt,{icon:(0,Y.jsx)(Ue,{}),title:`Starts`,children:(0,Y.jsxs)(I,{children:[(0,Y.jsx)(fe,{label:`Start on its own`,disabled:s,children:(0,Y.jsx)(ct,{"aria-label":`${e.name}: start on its own`,checked:e.autoStart??!1,disabled:s,onCheckedChange:t=>{u(ee(e,t)),t||d(`autoStartWhen`,void 0)}})}),e.autoStart&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(Ft,{label:`${e.name}: start only when`,description:`Leave empty to start every card on its own.`,rule:e.autoStartWhen,schema:Ke,options:{"source.repository":m},disabled:s,json:A(`autoStartWhen`),onUnfinished:e=>f(`autoStartWhen`,e),onChange:t=>u({...e,autoStartWhen:t})})})]})}),(0,Y.jsxs)(Wt,{icon:(0,Y.jsx)(Qe,{}),title:`Agent runs`,children:[(0,Y.jsx)(M,{phaseName:e.name,instructions:v,goal:y,disabled:s,onInstructionsChange:e=>k({instructions:e}),onGoalChange:e=>k({goal:e})}),(0,Y.jsx)(ie,{title:`Session`,description:`Phases with the same session share one agent session per card.`,disabled:s,children:(0,Y.jsx)(st,{className:Kt,"aria-label":`${e.name} session`,value:e.runner?.context??``,placeholder:l,disabled:s,onChange:e=>k({context:e.target.value})})}),(0,Y.jsx)(G,{title:`Skill`,children:(0,Y.jsx)(I,{children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsxs)(Be,{value:T??Gt,disabled:s,onValueChange:e=>k({skill:e===Gt?void 0:String(e)}),children:[(0,Y.jsx)(Le,{variant:`ghost`,size:`sm`,"aria-label":`${e.name} skill`,className:`-ml-2 w-fit`,children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(x,{"aria-hidden":!0,className:`text-muted-foreground size-icon-md shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:T??`No skill`})]})}),(0,Y.jsxs)(ze,{children:[(0,Y.jsx)(K,{value:Gt,children:`None`}),(r??[]).map(e=>(0,Y.jsx)(K,{value:e.name,children:e.name},e.name))]})]}),O&&(0,Y.jsx)(rt,{variant:`destructive`,children:`Not found`}),D?.error&&(0,Y.jsx)(rt,{variant:`destructive`,children:`Failed to load`}),D&&(0,Y.jsx)(Me,{skill:D}),D&&(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,icon:i?(0,Y.jsx)(Je,{}):(0,Y.jsx)(Ce,{}),"aria-label":`${i?`Edit`:`View`} ${D.name}`,className:`ml-auto`,render:(0,Y.jsx)(B,{to:Ne(a,o,D.name)}),children:i?`Edit`:`View`})]}),D?.error?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`Agents can't load this skill: `,D.error]}):O?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`This factory has no `,T,` skill, so cards entering `,e.name,` fail to start.`]}):D?.description&&(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:D.description})]})})}),(0,Y.jsx)(G,{title:`Factory tools`,description:`Given to the session that works the card in this phase.`,children:(0,Y.jsx)(I,{children:b.map(t=>(0,Y.jsx)(fe,{label:t.label,disabled:s,children:(0,Y.jsx)(ct,{"aria-label":`${e.name}: ${t.label}`,checked:S.includes(t.id),disabled:s,onCheckedChange:n=>{let r=b.map(({id:e})=>e).filter(e=>e===t.id?n:S.includes(e));u({...e,tools:r.length>0?r:null})}})},t.id))})})]}),(0,Y.jsxs)(Wt,{icon:(0,Y.jsx)(ce,{}),title:`Ends`,children:[(0,Y.jsx)(ie,{title:`Exit tool`,description:`Ends the phase when it succeeds. Leave empty for none.`,disabled:s,children:(0,Y.jsx)(st,{className:Kt,"aria-label":`${e.name} exit tool`,value:w,disabled:s,onChange:t=>{let n=t.target.value.trim();u({...e,exitTool:n?{...e.exitTool,id:n}:null}),n||d(`autoApproveWhen`,void 0)}})}),w!==``&&(0,Y.jsxs)(I,{children:[(0,Y.jsx)(fe,{label:`Approve on its own`,disabled:s,children:(0,Y.jsx)(ct,{"aria-label":`${e.name}: approve ${w} on its own`,checked:e.exitTool?.autoApprove??!1,disabled:s,onCheckedChange:t=>{u({...e,exitTool:{...e.exitTool,id:w,autoApprove:t,autoApproveWhen:t?e.exitTool?.autoApproveWhen:void 0}}),t||d(`autoApproveWhen`,void 0)}})}),e.exitTool?.autoApprove&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(Ft,{label:`${e.name}: approve only when`,description:`Leave empty to approve for every card.`,rule:e.exitTool.autoApproveWhen,schema:Ke,options:{"source.repository":m},disabled:s,json:A(`autoApproveWhen`),onUnfinished:e=>f(`autoApproveWhen`,e),onChange:t=>u({...e,exitTool:{...e.exitTool,id:w,autoApprove:!0,autoApproveWhen:t??void 0}})})})]})]}),(0,Y.jsxs)(Wt,{icon:(0,Y.jsx)(E,{}),title:`Allowed moves`,children:[j,(0,Y.jsx)(G,{title:`Outcomes`,description:`The ways this phase can end. The agent reports one by its key when its work is done, and Factory moves the card to that outcome's phase once the run ends. People can still make any allowed move.`,children:(0,Y.jsx)(Ht,{phase:e,phases:t,disabled:s,onChange:t=>u({...e,outcomes:t})})})]})]}),te]}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsx)(G,{title:`Allowed moves`,children:j}),te]})}var Jt=[`autoStartWhen`,`autoApproveWhen`];function Yt({factory:e,boardId:t,phaseKey:n,response:i,skills:a,skillsEditable:s,sidebarHidden:l,onReload:u}){let{board:d,canEdit:f}=i,{draft:m,rawRules:h,locked:g,setDraft:_,setRawRule:v,discard:y}=c(e.id,t,d),[b,S]=(0,X.useState)(0),C=()=>{y(),S(e=>e+1)},w=xe(),T=Ee(e.id,t),E=Se(),k=!f||!d.editable,A=n?m.phases.find(e=>e.key===n):void 0,j=A&&`${A.key}:${d.revision??`code`}:${b}`,[M,re]=(0,X.useState)({page:j,fields:[]});M.page!==j&&re({page:j,fields:[]});let ie=M.page===j?M.fields:[],ae=(e,t)=>re(n=>{let r=n.fields.filter(t=>t!==e);return{...n,fields:t?[...r,e]:r}}),oe=!k&&(te(m,d)||Object.keys(h).length>0||ie.length>0),N=m.phases.filter(e=>o(e,h)||e===A&&ie.length>0),se=m.name.trim()===``,ce=T.error?.code===`revision_mismatch`,P=we(({nextLocation:n})=>{let r=E.getQueryData(Te.boardCatalog(e.id))?.boards.some(e=>e.id===t);if(!oe||r===!1)return!1;let i=Pe(n.pathname);return i?.factoryId!==e.id||i.boardId!==t||i.skills===!0||i.rules===!0||i.intake===!0});ye(e=>{oe&&e.preventDefault()});let F=U(e.id,t),le;return le=n&&!A?(0,Y.jsx)(r,{titleSlot:(0,Y.jsxs)(`span`,{role:`alert`,children:[d.name,` has no such phase.`]}),actionSlot:(0,Y.jsx)(V,{size:`sm`,render:(0,Y.jsx)(B,{to:F}),children:`Back to general`})}):A?(0,Y.jsx)(qt,{phase:A,phases:m.phases,requiredNextPhases:d.codeBehaviour?.[A.key]?.requiredNextPhases??[],skills:a,skillsEditable:s,factoryId:e.id,boardId:t,disabled:k||g,rawRules:{autoStartWhen:h[O(A.key,`autoStartWhen`)],autoApproveWhen:h[O(A.key,`autoApproveWhen`)]},onRawRule:(e,t)=>{v(O(A.key,e),t),ae(e,!1)},onUnfinished:ae,onRemove:k||g||!ne(m.phases,A.key,d.codeBehaviour)?void 0:()=>{for(let e of Jt)v(O(A.key,e),void 0);_(e=>({...e,phases:p(e.phases,A.key)})),w(F)},onChange:e=>_(t=>({...t,phases:t.phases.map(t=>t.key===e.key?e:t)}))},j):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsx)(Nt,{factoryId:e.id,boardId:t,phases:m.phases,skills:a,onAutoStart:k||g?void 0:(e,t)=>{_(n=>({...n,phases:n.phases.map(n=>n.key===e?ee(n,t):n)})),t||v(O(e,`autoStartWhen`),void 0)},action:l&&!k?(0,Y.jsx)(D,{factoryId:e.id,boardId:t,board:d,disabled:g}):void 0}),(0,Y.jsx)(Z,{pinned:!0,className:`flex flex-col gap-8 empty:hidden`,children:l&&(0,Y.jsx)(G,{title:`Factory`,children:(0,Y.jsx)(I,{children:(0,Y.jsxs)(B,{to:Fe(e.id,t),className:`hover:bg-fill focus-visible:bg-fill flex items-center gap-3 px-4 py-3 focus-visible:outline-hidden`,children:[(0,Y.jsx)(x,{className:`text-muted-foreground size-icon-md`,"aria-hidden":!0}),(0,Y.jsx)(R,{as:`span`,variant:`label`,className:`min-w-0 flex-1 truncate`,children:`Skills`}),(0,Y.jsx)(ge,{className:`text-muted-foreground size-icon-md`,"aria-hidden":!0})]})})})})]}),(0,Y.jsxs)(`div`,{className:L(`flex flex-col gap-8 pb-4`,!A&&`w-max min-w-full`),children:[d.editable?!f&&(0,Y.jsx)(Z,{pinned:!A,children:(0,Y.jsx)(H,{variant:`info`,children:`Only organization admins can change this board.`})}):(0,Y.jsx)(Z,{pinned:!A,children:(0,Y.jsx)(H,{variant:`info`,children:`This board is defined in code, so it can't be changed here.`})}),!A&&d.problems.length>0&&(0,Y.jsx)(Z,{pinned:!0,children:(0,Y.jsx)(H,{variant:`warning`,title:`This board has problems`,children:(0,Y.jsx)(H.Message,{children:d.problems.join(` `)})})}),le,oe&&(0,Y.jsxs)(Z,{pinned:!A,sticky:!0,className:`rounded-card bg-card shadow-overlay dark:bg-muted flex flex-col gap-3 p-3`,children:[ce&&(0,Y.jsx)(H,{variant:`warning`,title:`Someone else changed this board`,action:(0,Y.jsx)(H.Button,{onClick:u,children:`Reload`}),children:(0,Y.jsx)(H.Message,{children:`Reload to see their version. Your unsaved changes will be lost.`})}),T.error&&!ce&&(0,Y.jsx)(H,{variant:`destructive`,role:`alert`,children:(0,Y.jsxs)(H.Message,{children:[`The board was not saved. `,T.error.reasons]})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(R,{variant:`body-sm`,tone:`muted`,className:`min-w-0 flex-1`,role:`status`,children:se?`Name the board to save.`:N.length>0?`Fix ${N.map(e=>e.name||e.key).join(`, `)} to save.`:`Unsaved changes`}),(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,disabled:T.isPending,onClick:C,children:`Discard`}),(0,Y.jsx)(V,{size:`sm`,variant:`primary`,disabled:se||N.length>0,onClick:()=>T.mutate({name:m.name,description:m.description,phases:m.phases,expectedRevision:d.revision??0}),loading:T.isPending,children:`Save`})]})]}),(0,Y.jsx)(W,{open:P.state===`blocked`,onOpenChange:e=>!e&&P.reset?.(),children:(0,Y.jsxs)(W.Content,{children:[(0,Y.jsxs)(W.Header,{children:[(0,Y.jsxs)(W.Title,{children:[`Discard changes to `,d.name,`?`]}),(0,Y.jsx)(W.Description,{children:`Your unsaved changes to this board will be lost.`})]}),(0,Y.jsxs)(W.Footer,{children:[(0,Y.jsx)(W.Cancel,{children:`Keep editing`}),(0,Y.jsx)(V,{variant:`destructive`,size:`md`,onClick:()=>{y(),P.proceed?.()},children:`Discard`})]})]})})]})}function Xt({name:e,disabled:t,loading:n,onDelete:r}){return(0,Y.jsxs)(W,{children:[(0,Y.jsx)(W.Trigger,{render:(0,Y.jsx)(V,{variant:`ghost`,size:`sm`,icon:(0,Y.jsx)(mt,{}),disabled:t,loading:n,children:`Delete`})}),(0,Y.jsxs)(W.Content,{children:[(0,Y.jsxs)(W.Header,{children:[(0,Y.jsxs)(W.Title,{children:[`Delete `,e,`?`]}),(0,Y.jsx)(W.Description,{children:`The board and its phases are removed from this project. A board that still has cards can’t be deleted.`})]}),(0,Y.jsxs)(W.Footer,{children:[(0,Y.jsx)(W.Cancel,{children:`Cancel`}),(0,Y.jsx)(W.Action,{onClick:r,children:`Delete`})]})]})]})}function Zt({name:e,disabled:t,loading:n,onReset:r}){return(0,Y.jsxs)(W,{children:[(0,Y.jsx)(W.Trigger,{render:(0,Y.jsx)(V,{variant:`ghost`,size:`sm`,icon:(0,Y.jsx)(_t,{}),tooltip:`Go back to Factory's version of this board`,tooltipPosition:`bottom`,disabled:t,loading:n,children:`Reset`})}),(0,Y.jsxs)(W.Content,{children:[(0,Y.jsxs)(W.Header,{children:[(0,Y.jsxs)(W.Title,{children:[`Reset `,e,` to default?`]}),(0,Y.jsx)(W.Description,{children:`Every change made to this board's name and phases is replaced with Factory's version.`})]}),(0,Y.jsxs)(W.Footer,{children:[(0,Y.jsx)(W.Cancel,{children:`Cancel`}),(0,Y.jsx)(W.Action,{onClick:r,children:`Reset`})]})]})]})}var Q={resting:{label:`Resting`,meaning:`No agent works here. Cards wait for a person or an event to move them.`},working:{label:`Working`,meaning:`An agent works on each card here, following the steps below.`},terminal:{label:`Terminal`,meaning:`Cards are finished here. Their agent sessions stop.`}},Qt=[`resting`,`working`,`terminal`];function $t({label:e,meaning:t,children:n}){return(0,Y.jsxs)(be,{children:[(0,Y.jsx)(ve,{render:(0,Y.jsx)(`span`,{role:`img`,tabIndex:0,"aria-label":`${e}. ${t}`,className:L(`inline-flex rounded-sm`,z),children:n})}),(0,Y.jsx)(_e,{side:`bottom`,className:`max-w-72`,children:t})]})}function en({factoryId:e,boardId:t,phaseKey:n,response:r}){let{board:i,canEdit:a}=r,{draft:o,locked:s,setDraft:l,setRawRule:u,discard:d}=c(e,t,i),p=Ge(e),h=xe(),g=!a||!i.editable||s,_=ke(e,t),v=De(e,t,()=>{d();let n=ht(p.data??[]).find(e=>e.id!==t);h(n?gt(e,n.id):`/factories/${e}`,{replace:!0})}),y=!n&&a&&i.editable,b=y&&i.source!==`stored`,x=y&&i.source!==`builtin`,S=n?o.phases.find(e=>e.key===n):void 0;if(n&&!S)return null;let C=e=>l(t=>({...t,phases:t.phases.map(t=>t.key===n?{...t,...e}:t)})),w=e=>{S&&(u(O(S.key,`autoStartWhen`),void 0),u(O(S.key,`autoApproveWhen`),void 0),l(t=>({...t,phases:t.phases.map(n=>n.key===S.key?f(n,e,t.phases):n)})))},T=S?S.name:o.name,E=(S?S.description:o.description)??``,D=S!==void 0&&!g&&!m(o.phases,S.key,i.codeBehaviour);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(N.Title,{className:`gap-2.5`,children:[S&&(0,Y.jsx)(We,{stage:S.key,kind:He(t,S.kind),decorative:!0}),(0,Y.jsx)(vt,{value:T,label:S?`Phase name`:`Board name`,required:!0,readOnly:g,variant:`heading`,tone:`ink`,onChange:e=>S?C({name:e}):l(t=>({...t,name:e}))})]}),S&&(0,Y.jsx)(N.Meta,{beside:!0,children:D?(0,Y.jsxs)(Be,{value:S.kind,onValueChange:e=>{let t=Qt.find(t=>t===e);t&&w(t)},children:[(0,Y.jsx)(Le,{size:`sm`,"aria-label":`Phase kind`,children:Q[S.kind].label}),(0,Y.jsx)(ze,{children:Qt.map(e=>(0,Y.jsx)(K,{value:e,children:Q[e].label},e))})]}):(0,Y.jsx)($t,{label:Q[S.kind].label,meaning:Q[S.kind].meaning,children:(0,Y.jsx)(rt,{children:Q[S.kind].label})})}),(E||!g)&&(0,Y.jsx)(N.Description,{children:(0,Y.jsx)(vt,{value:E,label:S?`Phase description`:`Board description`,placeholder:`Add a description`,multiline:!0,readOnly:g,variant:`caption`,tone:`muted`,className:`zoom-safe-text w-full`,onChange:e=>S?C({description:e||null}):l(t=>({...t,description:e||null}))})}),(b||x)&&(0,Y.jsxs)(N.Action,{className:`gap-1`,children:[b&&(0,Y.jsx)(Zt,{name:i.name,disabled:s,loading:_.isPending,onReset:()=>_.mutate(i.revision??0)}),x&&(0,Y.jsx)(Xt,{name:i.name,disabled:s,loading:v.isPending,onDelete:()=>v.mutate(i.revision??0)})]})]}),_.error&&(0,Y.jsx)(H,{variant:`destructive`,role:`alert`,className:`mt-4`,children:(0,Y.jsxs)(H.Message,{children:[`The board was not reset. `,_.error.reasons]})}),v.error&&(0,Y.jsx)(H,{variant:`destructive`,role:`alert`,className:`mt-4`,children:(0,Y.jsxs)(H.Message,{children:[`The board was not deleted. `,v.error.reasons]})})]})}var $=`motion-reduce:before:animate-none`,tn=3;function nn({className:e}){return(0,Y.jsx)(Re,{className:L(e,`rounded-full`,$)})}function rn({phase:e=!1}){return(0,Y.jsxs)(N,{"aria-hidden":!0,children:[(0,Y.jsxs)(N.Title,{className:`gap-2.5`,children:[e&&(0,Y.jsx)(nn,{className:`size-4 shrink-0`}),(0,Y.jsx)(q,{line:`text-heading`,className:L(`h-5 w-32`,$)})]}),e&&(0,Y.jsx)(N.Meta,{beside:!0,children:(0,Y.jsx)(Re,{className:L(`h-5 w-16`,$)})}),(0,Y.jsx)(N.Description,{children:(0,Y.jsx)(q,{line:`text-caption`,className:L(`w-28`,$)})})]})}function an(){return(0,Y.jsxs)(`li`,{className:Ct,children:[(0,Y.jsxs)(`div`,{className:wt,children:[(0,Y.jsx)(nn,{className:`size-4 shrink-0`}),(0,Y.jsx)(q,{line:`text-label`,className:L(`w-20`,$)})]}),(0,Y.jsx)(`div`,{className:`p-3`,children:(0,Y.jsxs)(`ol`,{className:`flex flex-col`,children:[(0,Y.jsx)(s,{label:`In`,icon:yt,children:(0,Y.jsx)(q,{line:`text-caption`,className:L(`w-20`,$)})}),(0,Y.jsx)(s,{label:`Work`,icon:nn,children:(0,Y.jsx)(q,{line:`text-caption`,className:L(`w-28`,$)})}),(0,Y.jsx)(s,{label:`Next`,icon:v,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(nn,{className:`size-4 shrink-0`}),(0,Y.jsx)(q,{className:L(`w-20`,$)})]})})]})})]})}function on(){return(0,Y.jsx)(`div`,{role:`status`,"aria-label":`Loading board`,children:(0,Y.jsx)(`ol`,{"aria-hidden":!0,className:St,children:Array.from({length:tn},(e,t)=>(0,Y.jsx)(an,{},t))})})}function sn(){let e=i(),a=u(),o=a?.boardId??``,s=a?.phaseKey,{isMobile:c,desktopState:l}=de(),d=c||l===`collapsed`,f=Oe(e.id,o),p=je(e.id),m=f.data?.board,h=y(e.id,o,m),g=s?h?.phases.find(e=>e.key===s):void 0,_=U(e.id,o),v=oe({breadcrumbs:d&&m?(0,Y.jsxs)(n,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(t,{as:B,to:gt(e.id,o),children:h?.name||m.name}),s?(0,Y.jsx)(t,{as:B,to:_,children:`Configure`}):(0,Y.jsx)(t,{as:`span`,isCurrent:!0,children:`Configure`}),g&&(0,Y.jsx)(t,{as:`span`,isCurrent:!0,children:g.name})]}):void 0}),b=f.isPending?(0,Y.jsx)(rn,{phase:s!==void 0}):f.isSuccess&&(!s||g)?(0,Y.jsx)(en,{factoryId:e.id,boardId:o,phaseKey:s,response:f.data},`${o}:${f.data.board.revision??`code`}`):void 0,x=f.isPending?s?(0,Y.jsx)(I,{children:(0,Y.jsx)(pe,{label:`Loading board`,rows:3})}):(0,Y.jsx)(on,{}):f.isError&&f.error instanceof Ae&&f.error.code===`board_not_found`?(0,Y.jsx)(r,{variant:`fill`,titleSlot:(0,Y.jsx)(`span`,{role:`alert`,children:`Board unavailable: this board is not installed.`})}):f.isError?(0,Y.jsx)(j,{title:`Couldn’t load this board`,error:f.error,onRetry:()=>void f.refetch(),retrying:f.isFetching}):(0,Y.jsx)(Yt,{factory:e,boardId:o,phaseKey:s,response:f.data,skills:p.data?.skills,skillsEditable:p.data?.canEdit??!1,sidebarHidden:d,onReload:()=>void f.refetch()},`${o}:${f.data.board.revision??`code`}`);return s?(0,Y.jsx)(re,{variant:`settings`,header:b,...v,children:x}):(0,Y.jsx)(re,{variant:`page`,body:`fixed`,header:b&&(0,Y.jsx)(`div`,{className:`mx-auto w-full max-w-2xl`,children:b}),...v,children:(0,Y.jsx)(`div`,{className:f.isError?L(Dt,`px-4`):Ot,children:x})})}export{sn as BoardConfigPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,t as n}from"./Breadcrumb.es-DVw5RHLo.js";import{t as r}from"./EmptyState-IMGHVwoU-DpmxDoqJ.js";import{$r as i,Ar as a,Br as o,Ci as s,Dn as c,Dr as l,En as u,Er as d,Gr as f,Hr as p,Ir as m,Kr as h,Lr as g,Nr as _,Oi as v,On as y,Or as b,Pi as x,Qr as S,Rr as C,Si as w,Tr as T,U as E,V as D,Vr as O,Wr as ee,Xr as k,Yr as A,ci as j,hi as M,jr as te,kr as ne,li as re,mi as ie,mr as ae,si as oe,ui as N,vr as se,wi as ce,wr as P,xi as F,yr as le,zr as ue}from"./index-NEF1i6yv.js";import{a as de}from"./Sidebar-zeEMJHoc-Bxyc3674.js";import{f as fe,t as I,u as pe}from"./settings-D8kIm4wB-CQbqVTud.js";import{O as me,T as L,k as he,n as R,s as z,t as ge}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{Ai as _e,Jn as B,Mi as ve,Qn as ye,Zr as V,ki as be,n as H,or as xe,qr as Se,r as Ce,rr as we,rt as Te}from"./GithubIcon.es-B7Jlpkjd.js";import{c as Ee,o as De,r as Oe,s as ke,t as Ae}from"./useBoardEditor-DIdpxjCz.js";import{i as je,t as Me}from"./SkillBadges-CN6YD9QA.js";import{a as U,c as Ne,f as Pe,l as Fe,s as Ie}from"./boardConfigPaths-Btimpi_r.js";import{t as W}from"./AlertDialog.es-BZTBj-Ow.js";import{t as G}from"./SettingsSubsection-CMossisW.js";import{_t as Le,cn as Re,gt as K,ht as ze,mt as Be,on as Ve,pt as q}from"./useSessionRows-CK_XCZpc.js";import{b as He,v as Ue,y as We}from"./BoardIcons-Cpj2za0J.js";import{n as Ge}from"./useBoardCatalog-D5xZ_2Xd.js";import{h as Ke,o as qe}from"./useIntakeRoutes-CO5RNQRx.js";import{a as Je,n as Ye,r as Xe,t as Ze}from"./HoverCard.es-Dnm-ghrz.js";import{r as Qe}from"./overlays-B4T3HdBk.js";import{t as $e}from"./DescriptionMarkdown-DPlQn5q6.js";import{h as et,w as tt,y as nt}from"./ruleLanes-CVuOFT_F.js";import{j as rt}from"./TabsRoot-4cFAZPuR.js";import{a as it,c as at,n as ot,r as st,t as J}from"./Field.es-I4QCnl1o.js";import{t as ct}from"./Switch.es-BHKLznzT.js";import{n as lt,t as ut}from"./ConditionRows-DsnKRQxV.js";import{t as dt}from"./Textarea.es-CrxP76D-.js";import{t as ft}from"./IconLock.es-Da9O9rEP.js";import{t as pt}from"./IconPlusMedium.es-BOotRziY.js";import{r as mt}from"./IconClipboard2.es-DTJVO2Dz.js";import{n as ht,t as gt}from"./boardCatalog-y-s19dQU.js";import{t as _t}from"./IconArrowRotateCounterClockwise.es-Dxk4yi6B.js";import{t as vt}from"./InlineText-tcMMASWp.js";import{c as yt}from"./code-block-MoHEPzJi-AiVE7yQU.js";var Y=me(),bt=`mx-auto w-full max-w-2xl`,xt=`sticky left-0 w-[100cqw] px-4`,St=`mx-auto flex w-max px-[max(0.75rem,calc((100cqw_-_42rem)/2_-_1.25rem))]`,Ct=`relative flex w-64 shrink-0 flex-col px-2 before:via-border-strong not-first:before:absolute not-first:before:inset-y-0 not-first:before:left-0 not-first:before:w-px not-first:before:bg-linear-to-b not-first:before:from-transparent not-first:before:to-transparent`,wt=`flex items-center gap-2 px-3 pt-3 pb-1`;function Tt({pinned:e,sticky:t,className:n,children:r}){let i=t&&`sticky bottom-4 z-10`;return e?(0,Y.jsx)(`div`,{className:L(xt,i),children:(0,Y.jsx)(`div`,{className:L(bt,n),children:r})}):(0,Y.jsx)(`div`,{className:L(bt,i,n),children:r})}function Et({boardId:e,phases:t,column:n,action:r,notice:i,leaving:a,LinkComponent:o=`a`}){return(0,Y.jsxs)(`section`,{"aria-label":`Board map`,className:`flex flex-col gap-3`,children:[r&&(0,Y.jsx)(Tt,{pinned:!0,className:`flex justify-end`,children:r}),i&&(0,Y.jsx)(Tt,{pinned:!0,children:i}),a&&(0,Y.jsx)(Tt,{pinned:!0,className:`mb-4`,children:(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:a})}),(0,Y.jsx)(`ol`,{"aria-label":`Phases`,className:St,children:t.map(r=>{let i=n(r);return(0,Y.jsxs)(`li`,{"aria-label":r.name,className:Ct,children:[(0,Y.jsx)(`div`,{className:wt,children:(0,Y.jsxs)(o,{href:i.href,className:`flex min-w-0 items-center gap-2 hover:underline focus-visible:underline focus-visible:outline-hidden`,children:[(0,Y.jsx)(We,{stage:r.key,kind:He(e,r.kind),decorative:!0}),(0,Y.jsx)(R,{as:`span`,variant:`label`,tone:`ink`,className:`truncate`,children:r.name})]})}),(0,Y.jsx)(`div`,{className:`p-3`,children:(0,Y.jsx)(w,{boardId:e,phase:r,phases:t,arrivals:i.arrivals,starts:i.starts,agent:i.agent})})]},r.key)})})]})}var X=e(he(),1),Dt=`mx-auto w-full max-w-2xl`,Ot=`[container-type:inline-size] h-full min-h-0 overflow-auto overscroll-x-contain [scrollbar-gutter:stable]`,kt=`sticky left-0 w-[100cqw] px-4`;function Z({pinned:e,sticky:t,className:n,children:r}){let i=t&&`sticky bottom-4 z-10`;return e?(0,Y.jsx)(`div`,{className:L(kt,i),children:(0,Y.jsx)(`div`,{className:L(Dt,n),children:r})}):(0,Y.jsx)(`div`,{className:L(Dt,i,n),children:r})}function At({factoryId:e,boardId:t,phase:n,skills:r}){let i=n.runner;if(!i)return null;let a=i.skill,o=a?r?.find(e=>e.name===a):void 0,s=a!==void 0&&r!==void 0&&o===void 0,c=s||o?.error!==void 0,l=a&&!s?Ne(e,t,a):U(e,t,n.key),u=a?x:Qe;return(0,Y.jsxs)(Ze,{children:[(0,Y.jsxs)(Xe,{delay:0,closeDelay:100,render:(0,Y.jsx)(B,{to:l}),className:L(z,`border-border bg-fill-subtle hover:bg-fill flex w-fit max-w-full min-w-0 items-center gap-1.5 rounded-md border px-1.5 py-0.5 transition-colors`,c&&`border-destructive-foreground text-destructive-foreground`),children:[(0,Y.jsx)(u,{"aria-hidden":!0,className:`size-icon-sm shrink-0 opacity-70`}),(0,Y.jsx)(`span`,{className:`truncate`,children:a??`Agent`}),c&&(0,Y.jsx)(`span`,{className:`sr-only`,children:s?`, skill not found`:`, skill failed to load`})]}),(0,Y.jsxs)(Ye,{side:`right`,align:`start`,sideOffset:8,collisionPadding:8,showArrow:!1,className:`flex w-96 max-w-[calc(100vw-2rem)] flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,Y.jsx)(u,{"aria-hidden":!0,className:`text-muted-foreground size-icon-md shrink-0`}),(0,Y.jsx)(R,{as:`span`,variant:`label`,tone:`ink`,className:`truncate`,children:a??`${n.name} agent`}),o&&(0,Y.jsx)(Me,{skill:o})]}),s?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`This factory has no `,a,` skill, so cards entering `,n.name,` fail to start.`]}):o?.error?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`Agents can't load this skill: `,o.error]}):o?.description&&(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:o.description}),a&&!r&&(0,Y.jsx)(F,{children:`Loading the skill…`}),o?.content.trim()&&(0,Y.jsx)(jt,{title:`Skill instructions`,children:(0,Y.jsx)($e,{titleLevel:`h3`,children:o.content})}),i.instructions?.trim()&&(0,Y.jsx)(jt,{title:`${n.name} adds`,children:(0,Y.jsx)($e,{titleLevel:`h3`,children:i.instructions})}),i.goal?.objective&&(0,Y.jsx)(jt,{title:i.goal.maxRuns?`Goal, up to ${i.goal.maxRuns} runs`:`Goal`,children:(0,Y.jsx)(R,{as:`p`,variant:`body-sm`,className:`whitespace-pre-wrap`,children:i.goal.objective})}),(0,Y.jsxs)(R,{as:`p`,variant:`caption`,tone:`muted`,children:[`Session `,i.context||`work`,`, shared with phases that name it too.`]})]})]})}function jt({title:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Y.jsx)(R,{as:`span`,variant:`caption`,tone:`faint`,children:e}),(0,Y.jsx)(`div`,{className:`bg-fill-subtle max-h-56 overflow-y-auto rounded-md px-2.5 py-2`,children:t})]})}function Mt({rules:e,title:t,to:n,boardId:r,boards:i}){return(0,Y.jsxs)(Ze,{children:[(0,Y.jsx)(Xe,{delay:0,closeDelay:100,render:(0,Y.jsx)(B,{to:n}),className:L(z,`w-fit rounded-sm underline decoration-dotted underline-offset-2`),children:et(e.length)}),(0,Y.jsxs)(Ye,{side:`right`,align:`start`,sideOffset:8,collisionPadding:8,showArrow:!1,className:`flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2`,children:[(0,Y.jsx)(R,{as:`span`,variant:`caption`,tone:`faint`,children:t}),(0,Y.jsx)(`ul`,{"aria-label":t,className:`flex max-h-80 flex-col gap-1.5 overflow-y-auto`,children:e.map(e=>(0,Y.jsx)(le,{rule:e,boardId:r,boards:i},e.id))})]})]})}function Nt({factoryId:e,boardId:t,phases:n,skills:r,action:i,onAutoStart:a}){let o=Ge(e),s=qe(e),c=o.isPending||s.isPending,l=o.data?.find(e=>e.id===t)?.initialPhase??n[0]?.key,u=n.map(e=>P(e,n)),f=s.data&&l?d(s.data.intakeRoutes,{key:t,initialPhase:l}):void 0;return(0,Y.jsx)(Et,{boardId:t,phases:u.map(T),LinkComponent:ae,action:i,notice:s.isError&&(0,Y.jsx)(H,{variant:`warning`,children:(0,Y.jsx)(H.Message,{children:`Rules didn’t load, so the map doesn’t count them.`})}),leaving:f&&f.leaving.length>0&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Mt,{rules:f.leaving,title:`Rules that send cards to other boards`,to:Ie(e,t,`leaving`),boardId:t,boards:o.data}),` `,f.leaving.length===1?`sends`:`send`,` cards from here to other boards.`]}),column:i=>{let s=n.find(e=>e.key===i.key),u=f?.into.get(s.key)??[];return{href:U(e,t,s.key),arrivals:(0,Y.jsxs)(Y.Fragment,{children:[c?(0,Y.jsx)(q,{line:`text-caption`,className:`w-20 motion-reduce:before:animate-none`}):f?u.length>0?(0,Y.jsx)(Mt,{rules:u,title:`Rules that move cards into ${s.name}`,to:Ie(e,t,{into:s.key}),boardId:t,boards:o.data}):(0,Y.jsx)(F,{children:`No rule moves cards here`}):(0,Y.jsx)(F,{children:`Rules didn’t load`}),s.key===l&&(0,Y.jsx)(F,{children:`New cards start here`})]}),starts:(0,Y.jsx)(se,{label:s.name,autoStart:s.autoStart??!1,autoStartWhen:s.autoStartWhen,onChange:a&&(e=>a(s.key,e))}),agent:(0,Y.jsx)(At,{factoryId:e,boardId:t,phase:s,skills:r})}}})}var Pt=`Finish or remove unfinished conditions to save.`;function Ft({label:e,description:t,rule:n,disabled:r,facts:i=nt,options:a,schema:o,json:s,onChange:c,onUnfinished:l}){let[u,d]=(0,X.useState)(void 0),f=s?s.text:u,p=s?s.onChange:d,m=(0,X.useId)(),h=f===void 0?S(o,n):A(o,f),g=e=>{p(e);let t=k(o,e);`problem`in t?c(n??null,t.problem):c(t.rule,void 0)};return(0,Y.jsxs)(J,{invalid:h!==void 0,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(it,{htmlFor:m,children:e}),(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,disabled:r,onClick:()=>{f===void 0?p(n?JSON.stringify(n,null,2):``):(p(void 0),c(n??null,S(o,n)))},children:f===void 0?`Edit as JSON`:`Edit as conditions`})]}),(0,Y.jsx)(ot,{children:t}),f===void 0?r?(0,Y.jsx)(R,{id:m,as:`p`,variant:`caption`,tone:`muted`,children:tt(n,a)}):(0,Y.jsx)(`div`,{id:m,children:(0,Y.jsx)(ut,{label:e,rule:n,facts:i,options:a,onChange:(e,t)=>{l?.(t),t?c(n??null,Pt):c(e,S(o,e))}})}):(0,Y.jsx)(dt,{id:m,"aria-label":`${e} JSON`,value:f,disabled:r,rows:6,onChange:e=>g(e.target.value)}),h&&(0,Y.jsx)(st,{children:h})]})}var It=`inline-flex h-8 max-w-48 min-w-0 items-center gap-1.5 rounded-lg border px-2.5`;function Lt({phase:e,phases:t,next:n,required:r,boardId:i,disabled:a,onChange:o}){let s=e=>o(n.includes(e)?n.filter(t=>t!==e):t.filter(t=>t.key===e||n.includes(t.key)).map(e=>e.key));return(0,Y.jsx)(`ul`,{"aria-label":`Allowed moves from ${e.name}`,className:`flex flex-wrap gap-1.5`,children:t.map(t=>{let o=(0,Y.jsx)(We,{stage:t.key,kind:He(i,t.kind),decorative:!0});if(t.key===e.key)return(0,Y.jsxs)(`li`,{className:L(It,`border-border-strong bg-card shadow-raised dark:bg-muted`),children:[o,(0,Y.jsx)(Rt,{children:t.name}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`(this phase)`})]},t.key);let c=n.includes(t.key),l=c&&r.has(t.key),u=l||a,d=(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":c,"aria-label":l?`${t.name} (locked)`:void 0,"aria-disabled":u||void 0,onClick:u?void 0:()=>s(t.key),className:L(It,`group/move transition-colors`,c?`bg-fill text-foreground border-transparent`:`border-border text-muted-foreground border-dashed`,!u&&(c?`hover:bg-fill-hover`:`hover:text-foreground hover:border-border-strong`),u&&!l&&`cursor-default`,z),children:[(0,Y.jsx)(`span`,{className:L(`grid place-items-center`,!c&&`opacity-50`),children:o}),(0,Y.jsx)(Rt,{children:t.name}),(0,Y.jsx)(`span`,{className:`text-muted-foreground grid size-3.5 shrink-0 place-items-center`,children:l?(0,Y.jsx)(ft,{className:`size-icon-sm`,"aria-hidden":!0}):c?(0,Y.jsx)(Ve,{className:`size-icon-sm`,"aria-hidden":!0}):!a&&(0,Y.jsx)(pt,{className:`size-icon-sm invisible group-hover/move:visible group-focus-visible/move:visible`,"aria-hidden":!0})})]});return(0,Y.jsx)(`li`,{className:`min-w-0`,children:l?(0,Y.jsxs)(be,{children:[(0,Y.jsx)(ve,{render:d}),(0,Y.jsx)(_e,{children:`Factory's code makes this move`})]}):d},t.key)})})}function Rt({children:e}){return(0,Y.jsx)(R,{as:`span`,variant:`label`,className:`truncate`,children:e})}var zt=`What the agent passes to factory_report_outcome. Letters, digits, hyphens and underscores; unique in this phase.`,Bt=`Tells the agent when this outcome applies, and shows in the card's history when Factory moves the card.`,Vt=`Where Factory moves the card once the run that reported this outcome ends. Only allowed moves.`;function Ht({phase:e,phases:t,disabled:n,onChange:r}){let i=e.outcomes?.length?e.outcomes:null,o=C(e,t),s=e=>t.find(t=>t.key===e)?.name??e;if(o.length===0)return(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:`Allow a move first; each outcome goes to one of them.`});let c=e.exitTool?.id,l=e=>{if(!c)return null;let n=_(e,t);return n?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,tone:`muted`,children:[`When `,(0,Y.jsx)(`code`,{children:c}),` succeeds, it reports `,(0,Y.jsx)(`code`,{children:n.key}),`, moving the card to`,` `,s(n.to),`.`]}):(0,Y.jsx)(H,{variant:`warning`,children:(0,Y.jsxs)(H.Message,{children:[`When `,(0,Y.jsx)(`code`,{children:c}),` succeeds, no outcome is picked, so the card waits for the agent to report one. Key an outcome `,(0,Y.jsx)(`code`,{children:`advance`}),` to choose where its success moves the card.`]})})};if(!i){let i=a(e,t);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`ul`,{"aria-label":`${e.name} outcomes`,className:`flex flex-col gap-1`,children:i.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(R,{as:`span`,variant:`caption`,tone:`muted`,children:[(0,Y.jsx)(`code`,{children:e.key}),` moves the card to `,s(e.to)]})},e.key))}),l(i),(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:`This phase lists no outcomes, so the agent may report any allowed move by the key of the phase it goes to. Customize them to give each a description the agent reads, or to offer fewer moves than people have.`}),!n&&(0,Y.jsx)(`div`,{children:(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>r(i.slice(0,20)),children:`Customize outcomes`})})]})}let u=ue(i),d=(e,t)=>r(i.map((n,r)=>r===e?{...n,...t}:n)),f=e=>{let t=i.filter((t,n)=>n!==e);r(t.length>0?t:null)},p=g(e,t,i);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(I,{children:[(0,Y.jsxs)(`div`,{className:`flex gap-3 px-4 pt-3`,children:[(0,Y.jsx)(J,{className:`w-36`,children:(0,Y.jsx)(it,{size:`smaller`,info:zt,children:`Key`})}),(0,Y.jsx)(J,{className:`min-w-48 flex-1`,children:(0,Y.jsx)(it,{size:`smaller`,info:Bt,children:`Description`})}),(0,Y.jsx)(J,{className:`w-44`,children:(0,Y.jsx)(it,{size:`smaller`,info:Vt,children:`Moves the card to`})}),!n&&(0,Y.jsx)(`div`,{"aria-hidden":!0,className:`w-8`})]}),(0,Y.jsx)(`ul`,{"aria-label":`${e.name} outcomes`,className:`flex flex-col`,children:i.map((t,r)=>{let i=u[r]??{},a=`outcome ${t.key||r+1}`;return(0,Y.jsxs)(`li`,{className:`flex items-start gap-3 px-4 py-2`,children:[(0,Y.jsxs)(J,{invalid:!!i.key,disabled:n,className:`w-36`,children:[(0,Y.jsx)(at,{"aria-label":`${e.name} outcome ${r+1} key`,value:t.key,placeholder:`e.g. review`,disabled:n,onChange:e=>d(r,{key:e.target.value.trim()})}),i.key&&(0,Y.jsx)(st,{children:i.key})]}),(0,Y.jsxs)(J,{invalid:!!i.label,disabled:n,className:`min-w-48 flex-1`,children:[(0,Y.jsx)(at,{"aria-label":`${e.name} outcome ${r+1} label`,value:t.label,placeholder:`e.g. Change request opened for review`,disabled:n,onChange:e=>d(r,{label:e.target.value})}),i.label&&(0,Y.jsx)(st,{children:i.label})]}),(0,Y.jsx)(J,{disabled:n,className:`w-44`,children:(0,Y.jsxs)(Be,{value:t.to,disabled:n,onValueChange:e=>d(r,{to:String(e)}),children:[(0,Y.jsx)(Le,{size:`sm`,"aria-label":`${e.name} ${a} goes to`,className:`w-full`,children:(0,Y.jsx)(`span`,{className:`truncate`,children:s(t.to)})}),(0,Y.jsx)(ze,{children:o.map(e=>(0,Y.jsx)(K,{value:e,children:s(e)},e))})]})}),!n&&(0,Y.jsx)(V,{size:`icon-sm`,variant:`ghost`,tooltip:`Remove ${a}`,onClick:()=>f(r),children:(0,Y.jsx)(mt,{})})]},r)})})]}),l(i),!n&&(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[p&&i.length<20&&(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,icon:(0,Y.jsx)(pt,{}),onClick:()=>r([...i,p]),children:`Add outcome`}),(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>r(null),children:`Use one per move`})]})]})}function Ut({label:e,children:t}){return(0,Y.jsx)(`ol`,{"aria-label":e,className:`flex flex-col`,children:t})}function Wt({icon:e,title:t,description:n,children:r}){let i=(0,X.useId)();return(0,Y.jsxs)(`li`,{"aria-labelledby":i,className:`before:bg-border relative grid grid-cols-[--spacing(7)_minmax(0,1fr)] gap-x-3 pb-8 before:absolute before:top-9 before:bottom-1 before:left-[calc(--spacing(3.5)-0.5px)] before:w-px last:pb-0 last:before:hidden`,children:[(0,Y.jsx)(`span`,{className:`border-border bg-card text-muted-foreground [&_svg]:size-icon-sm flex size-7 items-center justify-center rounded-full border`,children:e}),(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-h-7 flex-col justify-center`,children:[(0,Y.jsx)(R,{as:`h2`,id:i,variant:`subheading`,tone:`ink`,children:t}),n&&(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:n})]}),r]})]})}var Gt=`__none__`,Kt=`sm:max-w-xs`;function qt({phase:e,phases:t,requiredNextPhases:n,skills:r,skillsEditable:i,factoryId:a,boardId:o,disabled:s,rawRules:c,onChange:u,onRawRule:d,onUnfinished:f,onRemove:p}){let m=lt(a),g=e.kind===`working`,_=C(e,t),v=e.runner?.instructions??``,y=e.runner?.goal,S=e.tools??[],w=e.exitTool?.id??``,T=e.runner?.skill,D=T?r?.find(e=>e.name===T):void 0,O=T!==void 0&&r!==void 0&&D===void 0,k=t=>{let n={...e.runner,...t},r=Object.fromEntries(Object.entries(n).filter(([,e])=>e!=null&&e!==``));u({...e,runner:Object.keys(r).length>0?r:null})},A=e=>({text:c[e],onChange:t=>d(e,t)}),j=(0,Y.jsx)(Lt,{phase:e,phases:t,next:_,required:new Set(n),boardId:o,disabled:s,onChange:t=>u(h(e,t))}),te=p&&(0,Y.jsx)(`div`,{children:(0,Y.jsxs)(V,{variant:`ghost`,icon:(0,Y.jsx)(mt,{}),onClick:p,children:[`Remove `,e.name]})});return g?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsxs)(Ut,{label:`How ${e.name} runs`,children:[(0,Y.jsx)(Wt,{icon:(0,Y.jsx)(Ue,{}),title:`Starts`,children:(0,Y.jsxs)(I,{children:[(0,Y.jsx)(fe,{label:`Start on its own`,disabled:s,children:(0,Y.jsx)(ct,{"aria-label":`${e.name}: start on its own`,checked:e.autoStart??!1,disabled:s,onCheckedChange:t=>{u(ee(e,t)),t||d(`autoStartWhen`,void 0)}})}),e.autoStart&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(Ft,{label:`${e.name}: start only when`,description:`Leave empty to start every card on its own.`,rule:e.autoStartWhen,schema:Ke,options:{"source.repository":m},disabled:s,json:A(`autoStartWhen`),onUnfinished:e=>f(`autoStartWhen`,e),onChange:t=>u({...e,autoStartWhen:t})})})]})}),(0,Y.jsxs)(Wt,{icon:(0,Y.jsx)(Qe,{}),title:`Agent runs`,children:[(0,Y.jsx)(M,{phaseName:e.name,instructions:v,goal:y,disabled:s,onInstructionsChange:e=>k({instructions:e}),onGoalChange:e=>k({goal:e})}),(0,Y.jsx)(ie,{title:`Session`,description:`Phases with the same session share one agent session per card.`,disabled:s,children:(0,Y.jsx)(at,{className:Kt,"aria-label":`${e.name} session`,value:e.runner?.context??``,placeholder:l,disabled:s,onChange:e=>k({context:e.target.value})})}),(0,Y.jsx)(G,{title:`Skill`,children:(0,Y.jsx)(I,{children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 py-3`,children:[(0,Y.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsxs)(Be,{value:T??Gt,disabled:s,onValueChange:e=>k({skill:e===Gt?void 0:String(e)}),children:[(0,Y.jsx)(Le,{variant:`ghost`,size:`sm`,"aria-label":`${e.name} skill`,className:`-ml-2 w-fit`,children:(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Y.jsx)(x,{"aria-hidden":!0,className:`text-muted-foreground size-icon-md shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:T??`No skill`})]})}),(0,Y.jsxs)(ze,{children:[(0,Y.jsx)(K,{value:Gt,children:`None`}),(r??[]).map(e=>(0,Y.jsx)(K,{value:e.name,children:e.name},e.name))]})]}),O&&(0,Y.jsx)(rt,{variant:`destructive`,children:`Not found`}),D?.error&&(0,Y.jsx)(rt,{variant:`destructive`,children:`Failed to load`}),D&&(0,Y.jsx)(Me,{skill:D}),D&&(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,icon:i?(0,Y.jsx)(Je,{}):(0,Y.jsx)(Ce,{}),"aria-label":`${i?`Edit`:`View`} ${D.name}`,className:`ml-auto`,render:(0,Y.jsx)(B,{to:Ne(a,o,D.name)}),children:i?`Edit`:`View`})]}),D?.error?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`Agents can't load this skill: `,D.error]}):O?(0,Y.jsxs)(R,{as:`p`,variant:`caption`,role:`alert`,className:`text-destructive-foreground`,children:[`This factory has no `,T,` skill, so cards entering `,e.name,` fail to start.`]}):D?.description&&(0,Y.jsx)(R,{as:`p`,variant:`caption`,tone:`muted`,children:D.description})]})})}),(0,Y.jsx)(G,{title:`Factory tools`,description:`Given to the session that works the card in this phase.`,children:(0,Y.jsx)(I,{children:b.map(t=>(0,Y.jsx)(fe,{label:t.label,disabled:s,children:(0,Y.jsx)(ct,{"aria-label":`${e.name}: ${t.label}`,checked:S.includes(t.id),disabled:s,onCheckedChange:n=>{let r=b.map(({id:e})=>e).filter(e=>e===t.id?n:S.includes(e));u({...e,tools:r.length>0?r:null})}})},t.id))})})]}),(0,Y.jsxs)(Wt,{icon:(0,Y.jsx)(ce,{}),title:`Ends`,children:[(0,Y.jsx)(ie,{title:`Exit tool`,description:`Ends the phase when it succeeds. Leave empty for none.`,disabled:s,children:(0,Y.jsx)(at,{className:Kt,"aria-label":`${e.name} exit tool`,value:w,disabled:s,onChange:t=>{let n=t.target.value.trim();u({...e,exitTool:n?{...e.exitTool,id:n}:null}),n||d(`autoApproveWhen`,void 0)}})}),w!==``&&(0,Y.jsxs)(I,{children:[(0,Y.jsx)(fe,{label:`Approve on its own`,disabled:s,children:(0,Y.jsx)(ct,{"aria-label":`${e.name}: approve ${w} on its own`,checked:e.exitTool?.autoApprove??!1,disabled:s,onCheckedChange:t=>{u({...e,exitTool:{...e.exitTool,id:w,autoApprove:t,autoApproveWhen:t?e.exitTool?.autoApproveWhen:void 0}}),t||d(`autoApproveWhen`,void 0)}})}),e.exitTool?.autoApprove&&(0,Y.jsx)(`div`,{className:`px-4 py-3`,children:(0,Y.jsx)(Ft,{label:`${e.name}: approve only when`,description:`Leave empty to approve for every card.`,rule:e.exitTool.autoApproveWhen,schema:Ke,options:{"source.repository":m},disabled:s,json:A(`autoApproveWhen`),onUnfinished:e=>f(`autoApproveWhen`,e),onChange:t=>u({...e,exitTool:{...e.exitTool,id:w,autoApprove:!0,autoApproveWhen:t??void 0}})})})]})]}),(0,Y.jsxs)(Wt,{icon:(0,Y.jsx)(E,{}),title:`Allowed moves`,children:[j,(0,Y.jsx)(G,{title:`Outcomes`,description:`The ways this phase can end. The agent reports one by its key when its work is done, and Factory moves the card to that outcome's phase once the run ends. People can still make any allowed move.`,children:(0,Y.jsx)(Ht,{phase:e,phases:t,disabled:s,onChange:t=>u({...e,outcomes:t})})})]})]}),te]}):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsx)(G,{title:`Allowed moves`,children:j}),te]})}var Jt=[`autoStartWhen`,`autoApproveWhen`];function Yt({factory:e,boardId:t,phaseKey:n,response:i,skills:a,skillsEditable:s,sidebarHidden:l,onReload:u}){let{board:d,canEdit:f}=i,{draft:m,rawRules:h,locked:g,setDraft:_,setRawRule:v,discard:y}=c(e.id,t,d),[b,S]=(0,X.useState)(0),C=()=>{y(),S(e=>e+1)},w=xe(),T=Ee(e.id,t),E=Se(),k=!f||!d.editable,A=n?m.phases.find(e=>e.key===n):void 0,j=A&&`${A.key}:${d.revision??`code`}:${b}`,[M,re]=(0,X.useState)({page:j,fields:[]});M.page!==j&&re({page:j,fields:[]});let ie=M.page===j?M.fields:[],ae=(e,t)=>re(n=>{let r=n.fields.filter(t=>t!==e);return{...n,fields:t?[...r,e]:r}}),oe=!k&&(te(m,d)||Object.keys(h).length>0||ie.length>0),N=m.phases.filter(e=>o(e,h)||e===A&&ie.length>0),se=m.name.trim()===``,ce=T.error?.code===`revision_mismatch`,P=we(({nextLocation:n})=>{let r=E.getQueryData(Te.boardCatalog(e.id))?.boards.some(e=>e.id===t);if(!oe||r===!1)return!1;let i=Pe(n.pathname);return i?.factoryId!==e.id||i.boardId!==t||i.skills===!0||i.rules===!0||i.intake===!0});ye(e=>{oe&&e.preventDefault()});let F=U(e.id,t),le;return le=n&&!A?(0,Y.jsx)(r,{titleSlot:(0,Y.jsxs)(`span`,{role:`alert`,children:[d.name,` has no such phase.`]}),actionSlot:(0,Y.jsx)(V,{size:`sm`,render:(0,Y.jsx)(B,{to:F}),children:`Back to general`})}):A?(0,Y.jsx)(qt,{phase:A,phases:m.phases,requiredNextPhases:d.codeBehaviour?.[A.key]?.requiredNextPhases??[],skills:a,skillsEditable:s,factoryId:e.id,boardId:t,disabled:k||g,rawRules:{autoStartWhen:h[O(A.key,`autoStartWhen`)],autoApproveWhen:h[O(A.key,`autoApproveWhen`)]},onRawRule:(e,t)=>{v(O(A.key,e),t),ae(e,!1)},onUnfinished:ae,onRemove:k||g||!ne(m.phases,A.key,d.codeBehaviour)?void 0:()=>{for(let e of Jt)v(O(A.key,e),void 0);_(e=>({...e,phases:p(e.phases,A.key)})),w(F)},onChange:e=>_(t=>({...t,phases:t.phases.map(t=>t.key===e.key?e:t)}))},j):(0,Y.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,Y.jsx)(Nt,{factoryId:e.id,boardId:t,phases:m.phases,skills:a,onAutoStart:k||g?void 0:(e,t)=>{_(n=>({...n,phases:n.phases.map(n=>n.key===e?ee(n,t):n)})),t||v(O(e,`autoStartWhen`),void 0)},action:l&&!k?(0,Y.jsx)(D,{factoryId:e.id,boardId:t,board:d,disabled:g}):void 0}),(0,Y.jsx)(Z,{pinned:!0,className:`flex flex-col gap-8 empty:hidden`,children:l&&(0,Y.jsx)(G,{title:`Factory`,children:(0,Y.jsx)(I,{children:(0,Y.jsxs)(B,{to:Fe(e.id,t),className:`hover:bg-fill focus-visible:bg-fill flex items-center gap-3 px-4 py-3 focus-visible:outline-hidden`,children:[(0,Y.jsx)(x,{className:`text-muted-foreground size-icon-md`,"aria-hidden":!0}),(0,Y.jsx)(R,{as:`span`,variant:`label`,className:`min-w-0 flex-1 truncate`,children:`Skills`}),(0,Y.jsx)(ge,{className:`text-muted-foreground size-icon-md`,"aria-hidden":!0})]})})})})]}),(0,Y.jsxs)(`div`,{className:L(`flex flex-col gap-8 pb-4`,!A&&`w-max min-w-full`),children:[d.editable?!f&&(0,Y.jsx)(Z,{pinned:!A,children:(0,Y.jsx)(H,{variant:`info`,children:`Only organization admins can change this board.`})}):(0,Y.jsx)(Z,{pinned:!A,children:(0,Y.jsx)(H,{variant:`info`,children:`This board is defined in code, so it can't be changed here.`})}),!A&&d.problems.length>0&&(0,Y.jsx)(Z,{pinned:!0,children:(0,Y.jsx)(H,{variant:`warning`,title:`This board has problems`,children:(0,Y.jsx)(H.Message,{children:d.problems.join(` `)})})}),le,oe&&(0,Y.jsxs)(Z,{pinned:!A,sticky:!0,className:`rounded-card bg-card shadow-overlay dark:bg-muted flex flex-col gap-3 p-3`,children:[ce&&(0,Y.jsx)(H,{variant:`warning`,title:`Someone else changed this board`,action:(0,Y.jsx)(H.Button,{onClick:u,children:`Reload`}),children:(0,Y.jsx)(H.Message,{children:`Reload to see their version. Your unsaved changes will be lost.`})}),T.error&&!ce&&(0,Y.jsx)(H,{variant:`destructive`,role:`alert`,children:(0,Y.jsxs)(H.Message,{children:[`The board was not saved. `,T.error.reasons]})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(R,{variant:`body-sm`,tone:`muted`,className:`min-w-0 flex-1`,role:`status`,children:se?`Name the board to save.`:N.length>0?`Fix ${N.map(e=>e.name||e.key).join(`, `)} to save.`:`Unsaved changes`}),(0,Y.jsx)(V,{size:`sm`,variant:`ghost`,disabled:T.isPending,onClick:C,children:`Discard`}),(0,Y.jsx)(V,{size:`sm`,variant:`primary`,disabled:se||N.length>0,onClick:()=>T.mutate({name:m.name,description:m.description,phases:m.phases,expectedRevision:d.revision??0}),loading:T.isPending,children:`Save`})]})]}),(0,Y.jsx)(W,{open:P.state===`blocked`,onOpenChange:e=>!e&&P.reset?.(),children:(0,Y.jsxs)(W.Content,{children:[(0,Y.jsxs)(W.Header,{children:[(0,Y.jsxs)(W.Title,{children:[`Discard changes to `,d.name,`?`]}),(0,Y.jsx)(W.Description,{children:`Your unsaved changes to this board will be lost.`})]}),(0,Y.jsxs)(W.Footer,{children:[(0,Y.jsx)(W.Cancel,{children:`Keep editing`}),(0,Y.jsx)(V,{variant:`destructive`,size:`md`,onClick:()=>{y(),P.proceed?.()},children:`Discard`})]})]})})]})}function Xt({name:e,disabled:t,loading:n,onDelete:r}){return(0,Y.jsxs)(W,{children:[(0,Y.jsx)(W.Trigger,{render:(0,Y.jsx)(V,{variant:`ghost`,size:`sm`,icon:(0,Y.jsx)(mt,{}),disabled:t,loading:n,children:`Delete`})}),(0,Y.jsxs)(W.Content,{children:[(0,Y.jsxs)(W.Header,{children:[(0,Y.jsxs)(W.Title,{children:[`Delete `,e,`?`]}),(0,Y.jsx)(W.Description,{children:`The board and its phases are removed from this project. A board that still has cards can’t be deleted.`})]}),(0,Y.jsxs)(W.Footer,{children:[(0,Y.jsx)(W.Cancel,{children:`Cancel`}),(0,Y.jsx)(W.Action,{onClick:r,children:`Delete`})]})]})]})}function Zt({name:e,disabled:t,loading:n,onReset:r}){return(0,Y.jsxs)(W,{children:[(0,Y.jsx)(W.Trigger,{render:(0,Y.jsx)(V,{variant:`ghost`,size:`sm`,icon:(0,Y.jsx)(_t,{}),tooltip:`Go back to Factory's version of this board`,tooltipPosition:`bottom`,disabled:t,loading:n,children:`Reset`})}),(0,Y.jsxs)(W.Content,{children:[(0,Y.jsxs)(W.Header,{children:[(0,Y.jsxs)(W.Title,{children:[`Reset `,e,` to default?`]}),(0,Y.jsx)(W.Description,{children:`Every change made to this board's name and phases is replaced with Factory's version.`})]}),(0,Y.jsxs)(W.Footer,{children:[(0,Y.jsx)(W.Cancel,{children:`Cancel`}),(0,Y.jsx)(W.Action,{onClick:r,children:`Reset`})]})]})]})}var Q={resting:{label:`Resting`,meaning:`No agent works here. Cards wait for a person or an event to move them.`},working:{label:`Working`,meaning:`An agent works on each card here, following the steps below.`},terminal:{label:`Terminal`,meaning:`Cards are finished here. Their agent sessions stop.`}},Qt=[`resting`,`working`,`terminal`];function $t({label:e,meaning:t,children:n}){return(0,Y.jsxs)(be,{children:[(0,Y.jsx)(ve,{render:(0,Y.jsx)(`span`,{role:`img`,tabIndex:0,"aria-label":`${e}. ${t}`,className:L(`inline-flex rounded-sm`,z),children:n})}),(0,Y.jsx)(_e,{side:`bottom`,className:`max-w-72`,children:t})]})}function en({factoryId:e,boardId:t,phaseKey:n,response:r}){let{board:i,canEdit:a}=r,{draft:o,locked:s,setDraft:l,setRawRule:u,discard:d}=c(e,t,i),p=Ge(e),h=xe(),g=!a||!i.editable||s,_=ke(e,t),v=De(e,t,()=>{d();let n=ht(p.data??[]).find(e=>e.id!==t);h(n?gt(e,n.id):`/factories/${e}`,{replace:!0})}),y=!n&&a&&i.editable,b=y&&i.source!==`stored`,x=y&&i.source!==`builtin`,S=n?o.phases.find(e=>e.key===n):void 0;if(n&&!S)return null;let C=e=>l(t=>({...t,phases:t.phases.map(t=>t.key===n?{...t,...e}:t)})),w=e=>{S&&(u(O(S.key,`autoStartWhen`),void 0),u(O(S.key,`autoApproveWhen`),void 0),l(t=>({...t,phases:t.phases.map(n=>n.key===S.key?f(n,e,t.phases):n)})))},T=S?S.name:o.name,E=(S?S.description:o.description)??``,D=S!==void 0&&!g&&!m(o.phases,S.key,i.codeBehaviour);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(N,{children:[(0,Y.jsxs)(N.Title,{className:`gap-2.5`,children:[S&&(0,Y.jsx)(We,{stage:S.key,kind:He(t,S.kind),decorative:!0}),(0,Y.jsx)(vt,{value:T,label:S?`Phase name`:`Board name`,required:!0,readOnly:g,variant:`heading`,tone:`ink`,onChange:e=>S?C({name:e}):l(t=>({...t,name:e}))})]}),S&&(0,Y.jsx)(N.Meta,{beside:!0,children:D?(0,Y.jsxs)(Be,{value:S.kind,onValueChange:e=>{let t=Qt.find(t=>t===e);t&&w(t)},children:[(0,Y.jsx)(Le,{size:`sm`,"aria-label":`Phase kind`,children:Q[S.kind].label}),(0,Y.jsx)(ze,{children:Qt.map(e=>(0,Y.jsx)(K,{value:e,children:Q[e].label},e))})]}):(0,Y.jsx)($t,{label:Q[S.kind].label,meaning:Q[S.kind].meaning,children:(0,Y.jsx)(rt,{children:Q[S.kind].label})})}),(E||!g)&&(0,Y.jsx)(N.Description,{children:(0,Y.jsx)(vt,{value:E,label:S?`Phase description`:`Board description`,placeholder:`Add a description`,multiline:!0,readOnly:g,variant:`caption`,tone:`muted`,className:`zoom-safe-text w-full`,onChange:e=>S?C({description:e||null}):l(t=>({...t,description:e||null}))})}),(b||x)&&(0,Y.jsxs)(N.Action,{className:`gap-1`,children:[b&&(0,Y.jsx)(Zt,{name:i.name,disabled:s,loading:_.isPending,onReset:()=>_.mutate(i.revision??0)}),x&&(0,Y.jsx)(Xt,{name:i.name,disabled:s,loading:v.isPending,onDelete:()=>v.mutate(i.revision??0)})]})]}),_.error&&(0,Y.jsx)(H,{variant:`destructive`,role:`alert`,className:`mt-4`,children:(0,Y.jsxs)(H.Message,{children:[`The board was not reset. `,_.error.reasons]})}),v.error&&(0,Y.jsx)(H,{variant:`destructive`,role:`alert`,className:`mt-4`,children:(0,Y.jsxs)(H.Message,{children:[`The board was not deleted. `,v.error.reasons]})})]})}var $=`motion-reduce:before:animate-none`,tn=3;function nn({className:e}){return(0,Y.jsx)(Re,{className:L(e,`rounded-full`,$)})}function rn({phase:e=!1}){return(0,Y.jsxs)(N,{"aria-hidden":!0,children:[(0,Y.jsxs)(N.Title,{className:`gap-2.5`,children:[e&&(0,Y.jsx)(nn,{className:`size-4 shrink-0`}),(0,Y.jsx)(q,{line:`text-heading`,className:L(`h-5 w-32`,$)})]}),e&&(0,Y.jsx)(N.Meta,{beside:!0,children:(0,Y.jsx)(Re,{className:L(`h-5 w-16`,$)})}),(0,Y.jsx)(N.Description,{children:(0,Y.jsx)(q,{line:`text-caption`,className:L(`w-28`,$)})})]})}function an(){return(0,Y.jsxs)(`li`,{className:Ct,children:[(0,Y.jsxs)(`div`,{className:wt,children:[(0,Y.jsx)(nn,{className:`size-4 shrink-0`}),(0,Y.jsx)(q,{line:`text-label`,className:L(`w-20`,$)})]}),(0,Y.jsx)(`div`,{className:`p-3`,children:(0,Y.jsxs)(`ol`,{className:`flex flex-col`,children:[(0,Y.jsx)(s,{label:`In`,icon:yt,children:(0,Y.jsx)(q,{line:`text-caption`,className:L(`w-20`,$)})}),(0,Y.jsx)(s,{label:`Work`,icon:nn,children:(0,Y.jsx)(q,{line:`text-caption`,className:L(`w-28`,$)})}),(0,Y.jsx)(s,{label:`Next`,icon:v,children:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Y.jsx)(nn,{className:`size-4 shrink-0`}),(0,Y.jsx)(q,{className:L(`w-20`,$)})]})})]})})]})}function on(){return(0,Y.jsx)(`div`,{role:`status`,"aria-label":`Loading board`,children:(0,Y.jsx)(`ol`,{"aria-hidden":!0,className:St,children:Array.from({length:tn},(e,t)=>(0,Y.jsx)(an,{},t))})})}function sn(){let e=i(),a=u(),o=a?.boardId??``,s=a?.phaseKey,{isMobile:c,desktopState:l}=de(),d=c||l===`collapsed`,f=Oe(e.id,o),p=je(e.id),m=f.data?.board,h=y(e.id,o,m),g=s?h?.phases.find(e=>e.key===s):void 0,_=U(e.id,o),v=oe({breadcrumbs:d&&m?(0,Y.jsxs)(n,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(t,{as:B,to:gt(e.id,o),children:h?.name||m.name}),s?(0,Y.jsx)(t,{as:B,to:_,children:`Configure`}):(0,Y.jsx)(t,{as:`span`,isCurrent:!0,children:`Configure`}),g&&(0,Y.jsx)(t,{as:`span`,isCurrent:!0,children:g.name})]}):void 0}),b=f.isPending?(0,Y.jsx)(rn,{phase:s!==void 0}):f.isSuccess&&(!s||g)?(0,Y.jsx)(en,{factoryId:e.id,boardId:o,phaseKey:s,response:f.data},`${o}:${f.data.board.revision??`code`}`):void 0,x=f.isPending?s?(0,Y.jsx)(I,{children:(0,Y.jsx)(pe,{label:`Loading board`,rows:3})}):(0,Y.jsx)(on,{}):f.isError&&f.error instanceof Ae&&f.error.code===`board_not_found`?(0,Y.jsx)(r,{variant:`fill`,titleSlot:(0,Y.jsx)(`span`,{role:`alert`,children:`Board unavailable: this board is not installed.`})}):f.isError?(0,Y.jsx)(j,{title:`Couldn’t load this board`,error:f.error,onRetry:()=>void f.refetch(),retrying:f.isFetching}):(0,Y.jsx)(Yt,{factory:e,boardId:o,phaseKey:s,response:f.data,skills:p.data?.skills,skillsEditable:p.data?.canEdit??!1,sidebarHidden:d,onReload:()=>void f.refetch()},`${o}:${f.data.board.revision??`code`}`);return s?(0,Y.jsx)(re,{variant:`settings`,header:b,...v,children:x}):(0,Y.jsx)(re,{variant:`page`,body:`fixed`,header:b&&(0,Y.jsx)(`div`,{className:`mx-auto w-full max-w-2xl`,children:b}),...v,children:(0,Y.jsx)(`div`,{className:f.isError?L(Dt,`px-4`):Ot,children:x})})}export{sn as BoardConfigPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as e,T as t,f as n}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{Gr as r,Kn as i,hr as a,mr as o,rt as s}from"./GithubIcon.es-Bg-ShonN.js";import{B as c,dt as l}from"./useSessionRows-DQ5H8cED.js";import{d as u}from"./Sidebar-zeEMJHoc-CAYPr70W.js";import{c as ee,n as d,t as f}from"./IconClipboard2.es-DTJVO2Dz.js";import{t as p}from"./IconCircleCheck.es-D6u0E19o.js";import{t as m}from"./IconCircleDashed.es-CrssFpNj.js";import{t as h}from"./IconCircleX.es-Bah9f48z.js";import{s as g}from"./useBoardCatalog-BWEZygG2.js";var _=e();function v({size:e=16,className:t}){return(0,_.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:t,"aria-hidden":!0,children:(0,_.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 14.67C11.68 14.67 14.67 11.68 14.67 8C14.67 4.32 11.68 1.33 8 1.33C4.32 1.33 1.33 4.32 1.33 8C1.33 11.68 4.32 14.67 8 14.67ZM9.14 5.53C8.88 5.27 8.46 5.27 8.2 5.53C7.93 5.79 7.93 6.21 8.2 6.47L9.06 7.33H5.33C4.97 7.33 4.67 7.63 4.67 8C4.67 8.37 4.97 8.67 5.33 8.67H9.06L8.2 9.53C7.93 9.79 7.93 10.21 8.2 10.47C8.46 10.73 8.88 10.73 9.14 10.47L11.14 8.47C11.4 8.21 11.4 7.79 11.14 7.53L9.14 5.53Z`,fill:`currentColor`})})}var y=[`intake`,`triage`,`planning`,`execute`,`review`,`pr-review`,`done`,`canceled`],b={intake:`neutral`,triage:`orange`,planning:`cyan`,execute:`info`,review:`green`,"pr-review":`green`,done:`purple`,canceled:`destructive`};function x(e){return y.find(t=>t===e)}var S={resting:`neutral`,working:`info`,terminal:`success`},C={neutral:{icon:`text-muted-foreground`,tint:`bg-fill-subtle`,strongTint:`bg-fill-strong`,gradientFrom:`from-fill-subtle`},orange:{icon:`text-(--orange-500) dark:text-(--orange-400)`,tint:`bg-badge-orange-subtle`,strongTint:`bg-badge-orange-strong`,gradientFrom:`from-badge-orange-subtle`},cyan:{icon:`text-(--cyan-500) dark:text-(--cyan-400)`,tint:`bg-badge-cyan-subtle`,strongTint:`bg-badge-cyan-strong`,gradientFrom:`from-badge-cyan-subtle`},info:{icon:`text-info-indicator`,tint:`bg-info-subtle`,strongTint:`bg-badge-blue-strong`,gradientFrom:`from-badge-blue-subtle`},green:{icon:`text-badge-green-indicator`,tint:`bg-badge-green-subtle`,strongTint:`bg-badge-green-strong`,gradientFrom:`from-badge-green-subtle`},purple:{icon:`text-badge-purple-indicator`,tint:`bg-badge-purple-subtle`,strongTint:`bg-badge-purple-strong`,gradientFrom:`from-badge-purple-subtle`},success:{icon:`text-(--green-500) dark:text-(--green-400)`,tint:`bg-success-subtle`,strongTint:`bg-badge-green-strong`,gradientFrom:`from-badge-green-subtle`},destructive:{icon:`text-destructive-indicator`,tint:`bg-destructive-subtle`,strongTint:`bg-badge-red-strong`,gradientFrom:`from-badge-red-subtle`}},te=`M7.49512 10.9072C7.88154 10.9074 8.1952 11.221 8.19531 11.6074V13.9053C8.19531 14.2918 7.8816 14.6053 7.49512 14.6055C7.10852 14.6055 6.79492 14.2919 6.79492 13.9053V11.6074C6.79503 11.2209 7.10859 10.9072 7.49512 10.9072ZM3.84375 9.90039C4.11701 9.62739 4.55969 9.62748 4.83301 9.90039C5.10637 10.1738 5.10637 10.6173 4.83301 10.8906L3.14355 12.5801C2.87019 12.8534 2.42669 12.8534 2.15332 12.5801C1.88047 12.3068 1.88051 11.8641 2.15332 11.5908L3.84375 9.90039ZM10.0166 9.76172C10.29 9.48835 10.7335 9.48835 11.0068 9.76172L12.7012 11.4551C12.9745 11.7284 12.9744 12.1719 12.7012 12.4453C12.4278 12.7187 11.9843 12.7187 11.7109 12.4453L10.0166 10.751C9.74372 10.4777 9.74372 10.035 10.0166 9.76172ZM7.44043 5.30957C8.52235 5.30957 9.39941 6.18664 9.39941 7.26855C9.39941 8.35047 8.52235 9.22754 7.44043 9.22754C6.59445 9.22754 5.87568 8.69058 5.60156 7.93945H0.700195C0.313596 7.93945 0 7.62586 0 7.23926C9.01695e-06 6.85267 0.313602 6.53906 0.700195 6.53906H5.62305C5.91249 5.81865 6.61651 5.30957 7.44043 5.30957ZM14.0107 6.53906C14.3973 6.53911 14.7109 6.8527 14.7109 7.23926C14.7109 7.62583 14.3973 7.93941 14.0107 7.93945H11.7373C11.3507 7.93945 11.0371 7.62586 11.0371 7.23926C11.0371 6.85267 11.3507 6.53906 11.7373 6.53906H14.0107ZM11.6289 2.11523C11.9023 1.84204 12.3458 1.84192 12.6191 2.11523C12.8923 2.38855 12.8923 2.83213 12.6191 3.10547L10.8613 4.86328C10.588 5.13661 10.1445 5.13653 9.87109 4.86328C9.59773 4.58991 9.59773 4.14641 9.87109 3.87305L11.6289 2.11523ZM2.37207 2.11621C2.64543 1.843 3.088 1.84295 3.36133 2.11621L4.93945 3.69434C5.2127 3.96767 5.21266 4.41024 4.93945 4.68359C4.66609 4.95696 4.22259 4.95696 3.94922 4.68359L2.37207 3.10645C2.0987 2.83308 2.0987 2.38958 2.37207 2.11621ZM7.49512 0C7.8816 0.000131874 8.19531 0.313677 8.19531 0.700195V3.00391C8.19515 3.39029 7.8815 3.70299 7.49512 3.70312C7.10862 3.70312 6.79509 3.39037 6.79492 3.00391V0.700195C6.79492 0.313596 7.10852 0 7.49512 0Z`,ne=`M10.667 3.30078C11.7899 3.30078 12.7 4.21116 12.7002 5.33398V9.39551C13.8516 9.7042 14.7002 10.7522 14.7002 12.001C14.7002 13.4922 13.4912 14.7012 12 14.7012C10.5088 14.7012 9.2998 13.4922 9.2998 12.001C9.2998 10.7518 10.1488 9.70283 11.3008 9.39453V5.33398C11.3006 4.98435 11.0167 4.70117 10.667 4.70117H8.66699C8.28039 4.70117 7.9668 4.38758 7.9668 4.00098C7.9668 3.61438 8.28039 3.30078 8.66699 3.30078H10.667ZM4 1.30078C5.49117 1.30078 6.7002 2.50981 6.7002 4.00098C6.7002 5.24962 5.85146 6.29669 4.7002 6.60547V13.668C4.70002 14.0544 4.38649 14.3672 4 14.3672C3.61351 14.3672 3.29998 14.0544 3.2998 13.668V6.60547C2.14854 6.29669 1.2998 5.24962 1.2998 4.00098C1.2998 2.50981 2.50883 1.30078 4 1.30078ZM12 10.7012C11.282 10.7012 10.7002 11.283 10.7002 12.001C10.7002 12.719 11.282 13.3008 12 13.3008C12.718 13.3008 13.2998 12.719 13.2998 12.001C13.2998 11.283 12.718 10.7012 12 10.7012ZM4 2.70117C3.28203 2.70117 2.7002 3.28301 2.7002 4.00098C2.7002 4.71894 3.28203 5.30078 4 5.30078C4.71797 5.30078 5.2998 4.71894 5.2998 4.00098C5.2998 3.28301 4.71797 2.70117 4 2.70117Z`;function w(e,t){let n=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="${e}"><path d="${t}"/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(n)}")`}var T=w(`0 0 14.7109 14.6055`,te),E=w(`0 0 16 16`,ne);function D({mask:e,className:n}){return(0,_.jsx)(`span`,{"aria-hidden":!0,style:{maskImage:e},className:t(`size-4 shrink-0 bg-current mask-contain mask-center mask-no-repeat`,n)})}var O=2.25,k=2*Math.PI*O;function A({progress:e,className:n}){return(0,_.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,className:t(`shrink-0`,n),children:[(0,_.jsx)(`circle`,{cx:8,cy:8,r:6,stroke:`currentColor`,strokeWidth:1.5}),(0,_.jsx)(`circle`,{cx:8,cy:8,r:O,stroke:`currentColor`,strokeWidth:O*2,strokeDasharray:`${e*k} ${k}`,transform:`rotate(-90 8 8)`})]})}function j(e,t){return t?void 0:x(e)}function M(e,t){return e===`work`||e===`review`?void 0:t}function N(e,t){let n=j(e,t);return n?b[n]:S[t??`resting`]}function P({stage:e,kind:n,className:r}){let i=t(`shrink-0`,r);switch(j(e,n)??n??`resting`){case`intake`:return(0,_.jsx)(v,{className:i});case`triage`:return(0,_.jsx)(D,{mask:T,className:r});case`planning`:return(0,_.jsx)(A,{progress:.25,className:r});case`execute`:case`working`:return(0,_.jsx)(A,{progress:.5,className:r});case`review`:case`pr-review`:return(0,_.jsx)(D,{mask:E,className:r});case`done`:case`terminal`:return(0,_.jsx)(p,{"aria-hidden":!0,className:t(`size-icon-md`,i)});case`canceled`:return(0,_.jsx)(h,{"aria-hidden":!0,className:t(`size-icon-md`,i)});case`resting`:return(0,_.jsx)(m,{"aria-hidden":!0,className:t(`size-icon-md`,i)})}}function F(e,t){return C[N(e,t)].tint}function I(e,n){return t(ee,`bg-linear-to-r to-transparent`,C[N(e,n)].gradientFrom)}function L(e,t){return C[N(e,t)].strongTint}function R(e,t){return C[N(e,t)].icon}var z=`opacity-30`;function B({stage:e,kind:t,decorative:n=!1}){let r=(0,_.jsx)(P,{stage:e,kind:t,className:C[N(e,t)].icon});return n||!t?r:(0,_.jsx)(`span`,{role:`img`,"aria-label":`${t} phase`,className:`inline-flex shrink-0`,children:r})}var V=n(`IconPlay`,()=>(0,_.jsx)(`path`,{d:`M20.245 10.2984L9.05099 3.38443C7.71854 2.56145 6 3.51992 6 5.08603V18.914C6 20.4801 7.71854 21.4385 9.05098 20.6156L20.245 13.7016C21.5104 12.9201 21.5104 11.0799 20.245 10.2984Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`}));async function H(e,t,n,r){let i=new URLSearchParams;for(let[e,t]of Object.entries(r??{}))t!==void 0&&i.set(e,t);let a=i.size===0?``:`?${i}`,o=`${e}/web/github/projects/${encodeURIComponent(t)}/${n}${a}`,s=await fetch(o,{headers:{Accept:`application/json`},credentials:`include`});if(!s.ok){let e=`Request failed (${s.status})`;try{let t=await s.json();t.message?e=t.message:t.error&&(e=t.error)}catch{}throw Error(e)}return await s.json()}async function U(e,t,n){return H(e,t,`issues/${n}`)}async function re(e,t,n){return H(e,t,`prs/${n}`)}var W=3e5;function G(e,t){let{baseUrl:n}=i();return a({queryKey:s.githubIssue(e,t),queryFn:e!==void 0&&t!==void 0?()=>U(n,e,t):r,staleTime:W})}function K(e,t){let{baseUrl:n}=i();return a({queryKey:s.githubPull(e,t),queryFn:e!==void 0&&t!==void 0?()=>re(n,e,t):r,staleTime:W})}async function q(e){try{let t=await fetch(`${e}/web/linear/status`,{headers:{Accept:`application/json`},credentials:`include`});return t.status===401?{enabled:!1,connected:!1,workspace:null,reason:`auth_required`}:t.status===404?{enabled:!1,connected:!1,workspace:null}:t.ok?await t.json():{enabled:!1,connected:!1,workspace:null,reason:`unavailable`}}catch{return{enabled:!1,connected:!1,workspace:null,reason:`unavailable`}}}function J(e,t){let n=new URLSearchParams({return_to:`${window.location.pathname}${window.location.search}`});t&&n.set(`workspace_id`,t),window.location.assign(`${e}/auth/linear/connect?${n}`)}async function Y(e,t){let n=await fetch(`${e}${t}`,{headers:{Accept:`application/json`},credentials:`include`});if(!n.ok){let e=`Request failed (${n.status})`,t;try{let r=await n.json();t=r.error,r.message?e=r.message:r.error&&(e=r.error)}catch{}let r=new l(e,n.status);throw r.code=t,r}return await n.json()}function X(e){return e?.code===`linear_reauth_required`}async function ie(e,t,n,r){let i=new URLSearchParams({factoryProjectId:t});return r&&i.set(`issueId`,r),Y(e,`/web/linear/issues/${encodeURIComponent(n)}?${i.toString()}`)}function Z(e){return Y(e,`/web/linear/projects`)}function ae(e){return Y(e,`/web/linear/teams`)}var oe=`linear-team:`;function se(e){return e.sourceId??`linear-team:${e.id}`}function ce(e){let t=/^linear-(?:project|team):(.+)$/.exec(e)?.[1];if(!t)return null;try{let e=JSON.parse(atob(t.replace(/-/g,`+`).replace(/_/g,`/`)));return e&&typeof e==`object`&&`workspaceId`in e&&typeof e.workspaceId==`string`&&e.workspaceId||null}catch{return null}}function le(e){return e.startsWith(oe)}function Q(e){return o({queryKey:s.linearStatus(),queryFn:()=>q(e)})}function ue(e=!0){let{baseUrl:t}=i();return a({...Q(t),enabled:e})}function de(e,t,n){let{baseUrl:o}=i();return a({queryKey:s.linearIssue(e,t,n),queryFn:e!==void 0&&t!==void 0?()=>ie(o,e,t,n):r,staleTime:W,retry:(e,t)=>!(t instanceof l&&t.status===404)&&e<3})}function fe(e){let{baseUrl:t}=i();return a({queryKey:s.linearProjects(),queryFn:()=>Z(t),select:e=>e.projects,enabled:e})}function pe(e){let{baseUrl:t}=i();return a({queryKey:s.linearProjects(),queryFn:()=>Z(t),enabled:e})}function $(e){let{baseUrl:t}=i();return a({queryKey:s.linearTeams(),queryFn:()=>ae(t),enabled:e})}var me=n(`IconHammer`,()=>(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`path`,{d:`M6.70694 14.7929C6.31641 15.1834 5.68325 15.1834 5.29272 14.7929L2.45696 11.9571C2.06643 11.5666 2.06643 10.9334 2.45696 10.5429L9.70694 3.29289C9.89447 3.10536 10.1488 3 10.414 3L14.0857 3C14.3509 3 14.6052 3.10536 14.7928 3.29289L15.7927 4.29286C16.1832 4.68338 16.1832 5.31655 15.7927 5.70707L6.70694 14.7929Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,_.jsx)(`path`,{d:`M9.5 12.5L16.3358 19.3358C17.1168 20.1168 18.3832 20.1168 19.1642 19.3358L19.3358 19.1642C20.1168 18.3832 20.1168 17.1168 19.3358 16.3358L12.5 9.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]}));function he({source:e,className:n}){let{Icon:r,iconClassName:i}=c[e];return(0,_.jsx)(r,{"data-source":e,className:t(`size-4 shrink-0`,i,n),"aria-hidden":!0})}var ge={Investigate:u,Build:me,"Prepare approval":f,Review:d};function _e(e){let t=ge[e]??V;return(0,_.jsx)(t,{"aria-hidden":!0})}function ve(e,t){let n=g(e,t);return e&&n?M(e.id,n):void 0}export{L as C,v as E,I as S,z as T,K as _,de as a,M as b,ue as c,X as d,le as f,G as g,W as h,Q as i,$ as l,se as m,_e as n,pe as o,ce as p,ve as r,fe as s,he as t,J as u,V as v,F as w,R as x,B as y};
|
|
1
|
+
import{O as e,T as t,f as n}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{Gr as r,Kn as i,hr as a,mr as o,rt as s}from"./GithubIcon.es-B7Jlpkjd.js";import{B as c,dt as l}from"./useSessionRows-CK_XCZpc.js";import{d as u}from"./Sidebar-zeEMJHoc-Bxyc3674.js";import{c as ee,n as d,t as f}from"./IconClipboard2.es-DTJVO2Dz.js";import{t as p}from"./IconCircleCheck.es-D6u0E19o.js";import{t as m}from"./IconCircleDashed.es-CrssFpNj.js";import{t as h}from"./IconCircleX.es-Bah9f48z.js";import{s as g}from"./useBoardCatalog-D5xZ_2Xd.js";var _=e();function v({size:e=16,className:t}){return(0,_.jsx)(`svg`,{width:e,height:e,viewBox:`0 0 16 16`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:t,"aria-hidden":!0,children:(0,_.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M8 14.67C11.68 14.67 14.67 11.68 14.67 8C14.67 4.32 11.68 1.33 8 1.33C4.32 1.33 1.33 4.32 1.33 8C1.33 11.68 4.32 14.67 8 14.67ZM9.14 5.53C8.88 5.27 8.46 5.27 8.2 5.53C7.93 5.79 7.93 6.21 8.2 6.47L9.06 7.33H5.33C4.97 7.33 4.67 7.63 4.67 8C4.67 8.37 4.97 8.67 5.33 8.67H9.06L8.2 9.53C7.93 9.79 7.93 10.21 8.2 10.47C8.46 10.73 8.88 10.73 9.14 10.47L11.14 8.47C11.4 8.21 11.4 7.79 11.14 7.53L9.14 5.53Z`,fill:`currentColor`})})}var y=[`intake`,`triage`,`planning`,`execute`,`review`,`pr-review`,`done`,`canceled`],b={intake:`neutral`,triage:`orange`,planning:`cyan`,execute:`info`,review:`green`,"pr-review":`green`,done:`purple`,canceled:`destructive`};function x(e){return y.find(t=>t===e)}var S={resting:`neutral`,working:`info`,terminal:`success`},C={neutral:{icon:`text-muted-foreground`,tint:`bg-fill-subtle`,strongTint:`bg-fill-strong`,gradientFrom:`from-fill-subtle`},orange:{icon:`text-(--orange-500) dark:text-(--orange-400)`,tint:`bg-badge-orange-subtle`,strongTint:`bg-badge-orange-strong`,gradientFrom:`from-badge-orange-subtle`},cyan:{icon:`text-(--cyan-500) dark:text-(--cyan-400)`,tint:`bg-badge-cyan-subtle`,strongTint:`bg-badge-cyan-strong`,gradientFrom:`from-badge-cyan-subtle`},info:{icon:`text-info-indicator`,tint:`bg-info-subtle`,strongTint:`bg-badge-blue-strong`,gradientFrom:`from-badge-blue-subtle`},green:{icon:`text-badge-green-indicator`,tint:`bg-badge-green-subtle`,strongTint:`bg-badge-green-strong`,gradientFrom:`from-badge-green-subtle`},purple:{icon:`text-badge-purple-indicator`,tint:`bg-badge-purple-subtle`,strongTint:`bg-badge-purple-strong`,gradientFrom:`from-badge-purple-subtle`},success:{icon:`text-(--green-500) dark:text-(--green-400)`,tint:`bg-success-subtle`,strongTint:`bg-badge-green-strong`,gradientFrom:`from-badge-green-subtle`},destructive:{icon:`text-destructive-indicator`,tint:`bg-destructive-subtle`,strongTint:`bg-badge-red-strong`,gradientFrom:`from-badge-red-subtle`}},te=`M7.49512 10.9072C7.88154 10.9074 8.1952 11.221 8.19531 11.6074V13.9053C8.19531 14.2918 7.8816 14.6053 7.49512 14.6055C7.10852 14.6055 6.79492 14.2919 6.79492 13.9053V11.6074C6.79503 11.2209 7.10859 10.9072 7.49512 10.9072ZM3.84375 9.90039C4.11701 9.62739 4.55969 9.62748 4.83301 9.90039C5.10637 10.1738 5.10637 10.6173 4.83301 10.8906L3.14355 12.5801C2.87019 12.8534 2.42669 12.8534 2.15332 12.5801C1.88047 12.3068 1.88051 11.8641 2.15332 11.5908L3.84375 9.90039ZM10.0166 9.76172C10.29 9.48835 10.7335 9.48835 11.0068 9.76172L12.7012 11.4551C12.9745 11.7284 12.9744 12.1719 12.7012 12.4453C12.4278 12.7187 11.9843 12.7187 11.7109 12.4453L10.0166 10.751C9.74372 10.4777 9.74372 10.035 10.0166 9.76172ZM7.44043 5.30957C8.52235 5.30957 9.39941 6.18664 9.39941 7.26855C9.39941 8.35047 8.52235 9.22754 7.44043 9.22754C6.59445 9.22754 5.87568 8.69058 5.60156 7.93945H0.700195C0.313596 7.93945 0 7.62586 0 7.23926C9.01695e-06 6.85267 0.313602 6.53906 0.700195 6.53906H5.62305C5.91249 5.81865 6.61651 5.30957 7.44043 5.30957ZM14.0107 6.53906C14.3973 6.53911 14.7109 6.8527 14.7109 7.23926C14.7109 7.62583 14.3973 7.93941 14.0107 7.93945H11.7373C11.3507 7.93945 11.0371 7.62586 11.0371 7.23926C11.0371 6.85267 11.3507 6.53906 11.7373 6.53906H14.0107ZM11.6289 2.11523C11.9023 1.84204 12.3458 1.84192 12.6191 2.11523C12.8923 2.38855 12.8923 2.83213 12.6191 3.10547L10.8613 4.86328C10.588 5.13661 10.1445 5.13653 9.87109 4.86328C9.59773 4.58991 9.59773 4.14641 9.87109 3.87305L11.6289 2.11523ZM2.37207 2.11621C2.64543 1.843 3.088 1.84295 3.36133 2.11621L4.93945 3.69434C5.2127 3.96767 5.21266 4.41024 4.93945 4.68359C4.66609 4.95696 4.22259 4.95696 3.94922 4.68359L2.37207 3.10645C2.0987 2.83308 2.0987 2.38958 2.37207 2.11621ZM7.49512 0C7.8816 0.000131874 8.19531 0.313677 8.19531 0.700195V3.00391C8.19515 3.39029 7.8815 3.70299 7.49512 3.70312C7.10862 3.70312 6.79509 3.39037 6.79492 3.00391V0.700195C6.79492 0.313596 7.10852 0 7.49512 0Z`,ne=`M10.667 3.30078C11.7899 3.30078 12.7 4.21116 12.7002 5.33398V9.39551C13.8516 9.7042 14.7002 10.7522 14.7002 12.001C14.7002 13.4922 13.4912 14.7012 12 14.7012C10.5088 14.7012 9.2998 13.4922 9.2998 12.001C9.2998 10.7518 10.1488 9.70283 11.3008 9.39453V5.33398C11.3006 4.98435 11.0167 4.70117 10.667 4.70117H8.66699C8.28039 4.70117 7.9668 4.38758 7.9668 4.00098C7.9668 3.61438 8.28039 3.30078 8.66699 3.30078H10.667ZM4 1.30078C5.49117 1.30078 6.7002 2.50981 6.7002 4.00098C6.7002 5.24962 5.85146 6.29669 4.7002 6.60547V13.668C4.70002 14.0544 4.38649 14.3672 4 14.3672C3.61351 14.3672 3.29998 14.0544 3.2998 13.668V6.60547C2.14854 6.29669 1.2998 5.24962 1.2998 4.00098C1.2998 2.50981 2.50883 1.30078 4 1.30078ZM12 10.7012C11.282 10.7012 10.7002 11.283 10.7002 12.001C10.7002 12.719 11.282 13.3008 12 13.3008C12.718 13.3008 13.2998 12.719 13.2998 12.001C13.2998 11.283 12.718 10.7012 12 10.7012ZM4 2.70117C3.28203 2.70117 2.7002 3.28301 2.7002 4.00098C2.7002 4.71894 3.28203 5.30078 4 5.30078C4.71797 5.30078 5.2998 4.71894 5.2998 4.00098C5.2998 3.28301 4.71797 2.70117 4 2.70117Z`;function w(e,t){let n=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="${e}"><path d="${t}"/></svg>`;return`url("data:image/svg+xml,${encodeURIComponent(n)}")`}var T=w(`0 0 14.7109 14.6055`,te),E=w(`0 0 16 16`,ne);function D({mask:e,className:n}){return(0,_.jsx)(`span`,{"aria-hidden":!0,style:{maskImage:e},className:t(`size-4 shrink-0 bg-current mask-contain mask-center mask-no-repeat`,n)})}var O=2.25,k=2*Math.PI*O;function A({progress:e,className:n}){return(0,_.jsxs)(`svg`,{width:16,height:16,viewBox:`0 0 16 16`,fill:`none`,"aria-hidden":!0,className:t(`shrink-0`,n),children:[(0,_.jsx)(`circle`,{cx:8,cy:8,r:6,stroke:`currentColor`,strokeWidth:1.5}),(0,_.jsx)(`circle`,{cx:8,cy:8,r:O,stroke:`currentColor`,strokeWidth:O*2,strokeDasharray:`${e*k} ${k}`,transform:`rotate(-90 8 8)`})]})}function j(e,t){return t?void 0:x(e)}function M(e,t){return e===`work`||e===`review`?void 0:t}function N(e,t){let n=j(e,t);return n?b[n]:S[t??`resting`]}function P({stage:e,kind:n,className:r}){let i=t(`shrink-0`,r);switch(j(e,n)??n??`resting`){case`intake`:return(0,_.jsx)(v,{className:i});case`triage`:return(0,_.jsx)(D,{mask:T,className:r});case`planning`:return(0,_.jsx)(A,{progress:.25,className:r});case`execute`:case`working`:return(0,_.jsx)(A,{progress:.5,className:r});case`review`:case`pr-review`:return(0,_.jsx)(D,{mask:E,className:r});case`done`:case`terminal`:return(0,_.jsx)(p,{"aria-hidden":!0,className:t(`size-icon-md`,i)});case`canceled`:return(0,_.jsx)(h,{"aria-hidden":!0,className:t(`size-icon-md`,i)});case`resting`:return(0,_.jsx)(m,{"aria-hidden":!0,className:t(`size-icon-md`,i)})}}function F(e,t){return C[N(e,t)].tint}function I(e,n){return t(ee,`bg-linear-to-r to-transparent`,C[N(e,n)].gradientFrom)}function L(e,t){return C[N(e,t)].strongTint}function R(e,t){return C[N(e,t)].icon}var z=`opacity-30`;function B({stage:e,kind:t,decorative:n=!1}){let r=(0,_.jsx)(P,{stage:e,kind:t,className:C[N(e,t)].icon});return n||!t?r:(0,_.jsx)(`span`,{role:`img`,"aria-label":`${t} phase`,className:`inline-flex shrink-0`,children:r})}var V=n(`IconPlay`,()=>(0,_.jsx)(`path`,{d:`M20.245 10.2984L9.05099 3.38443C7.71854 2.56145 6 3.51992 6 5.08603V18.914C6 20.4801 7.71854 21.4385 9.05098 20.6156L20.245 13.7016C21.5104 12.9201 21.5104 11.0799 20.245 10.2984Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinejoin:`round`}));async function H(e,t,n,r){let i=new URLSearchParams;for(let[e,t]of Object.entries(r??{}))t!==void 0&&i.set(e,t);let a=i.size===0?``:`?${i}`,o=`${e}/web/github/projects/${encodeURIComponent(t)}/${n}${a}`,s=await fetch(o,{headers:{Accept:`application/json`},credentials:`include`});if(!s.ok){let e=`Request failed (${s.status})`;try{let t=await s.json();t.message?e=t.message:t.error&&(e=t.error)}catch{}throw Error(e)}return await s.json()}async function U(e,t,n){return H(e,t,`issues/${n}`)}async function re(e,t,n){return H(e,t,`prs/${n}`)}var W=3e5;function G(e,t){let{baseUrl:n}=i();return a({queryKey:s.githubIssue(e,t),queryFn:e!==void 0&&t!==void 0?()=>U(n,e,t):r,staleTime:W})}function K(e,t){let{baseUrl:n}=i();return a({queryKey:s.githubPull(e,t),queryFn:e!==void 0&&t!==void 0?()=>re(n,e,t):r,staleTime:W})}async function q(e){try{let t=await fetch(`${e}/web/linear/status`,{headers:{Accept:`application/json`},credentials:`include`});return t.status===401?{enabled:!1,connected:!1,workspace:null,reason:`auth_required`}:t.status===404?{enabled:!1,connected:!1,workspace:null}:t.ok?await t.json():{enabled:!1,connected:!1,workspace:null,reason:`unavailable`}}catch{return{enabled:!1,connected:!1,workspace:null,reason:`unavailable`}}}function J(e,t){let n=new URLSearchParams({return_to:`${window.location.pathname}${window.location.search}`});t&&n.set(`workspace_id`,t),window.location.assign(`${e}/auth/linear/connect?${n}`)}async function Y(e,t){let n=await fetch(`${e}${t}`,{headers:{Accept:`application/json`},credentials:`include`});if(!n.ok){let e=`Request failed (${n.status})`,t;try{let r=await n.json();t=r.error,r.message?e=r.message:r.error&&(e=r.error)}catch{}let r=new l(e,n.status);throw r.code=t,r}return await n.json()}function X(e){return e?.code===`linear_reauth_required`}async function ie(e,t,n,r){let i=new URLSearchParams({factoryProjectId:t});return r&&i.set(`issueId`,r),Y(e,`/web/linear/issues/${encodeURIComponent(n)}?${i.toString()}`)}function Z(e){return Y(e,`/web/linear/projects`)}function ae(e){return Y(e,`/web/linear/teams`)}var oe=`linear-team:`;function se(e){return e.sourceId??`linear-team:${e.id}`}function ce(e){let t=/^linear-(?:project|team):(.+)$/.exec(e)?.[1];if(!t)return null;try{let e=JSON.parse(atob(t.replace(/-/g,`+`).replace(/_/g,`/`)));return e&&typeof e==`object`&&`workspaceId`in e&&typeof e.workspaceId==`string`&&e.workspaceId||null}catch{return null}}function le(e){return e.startsWith(oe)}function Q(e){return o({queryKey:s.linearStatus(),queryFn:()=>q(e)})}function ue(e=!0){let{baseUrl:t}=i();return a({...Q(t),enabled:e})}function de(e,t,n){let{baseUrl:o}=i();return a({queryKey:s.linearIssue(e,t,n),queryFn:e!==void 0&&t!==void 0?()=>ie(o,e,t,n):r,staleTime:W,retry:(e,t)=>!(t instanceof l&&t.status===404)&&e<3})}function fe(e){let{baseUrl:t}=i();return a({queryKey:s.linearProjects(),queryFn:()=>Z(t),select:e=>e.projects,enabled:e})}function pe(e){let{baseUrl:t}=i();return a({queryKey:s.linearProjects(),queryFn:()=>Z(t),enabled:e})}function $(e){let{baseUrl:t}=i();return a({queryKey:s.linearTeams(),queryFn:()=>ae(t),enabled:e})}var me=n(`IconHammer`,()=>(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(`path`,{d:`M6.70694 14.7929C6.31641 15.1834 5.68325 15.1834 5.29272 14.7929L2.45696 11.9571C2.06643 11.5666 2.06643 10.9334 2.45696 10.5429L9.70694 3.29289C9.89447 3.10536 10.1488 3 10.414 3L14.0857 3C14.3509 3 14.6052 3.10536 14.7928 3.29289L15.7927 4.29286C16.1832 4.68338 16.1832 5.31655 15.7927 5.70707L6.70694 14.7929Z`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,_.jsx)(`path`,{d:`M9.5 12.5L16.3358 19.3358C17.1168 20.1168 18.3832 20.1168 19.1642 19.3358L19.3358 19.1642C20.1168 18.3832 20.1168 17.1168 19.3358 16.3358L12.5 9.5`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`})]}));function he({source:e,className:n}){let{Icon:r,iconClassName:i}=c[e];return(0,_.jsx)(r,{"data-source":e,className:t(`size-4 shrink-0`,i,n),"aria-hidden":!0})}var ge={Investigate:u,Build:me,"Prepare approval":f,Review:d};function _e(e){let t=ge[e]??V;return(0,_.jsx)(t,{"aria-hidden":!0})}function ve(e,t){let n=g(e,t);return e&&n?M(e.id,n):void 0}export{L as C,v as E,I as S,z as T,K as _,de as a,M as b,ue as c,X as d,le as f,G as g,W as h,Q as i,$ as l,se as m,_e as n,pe as o,ce as p,ve as r,fe as s,he as t,J as u,V as v,F as w,R as x,B as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$r as t,En as n,li as r,si as i,ui as a}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$r as t,En as n,li as r,si as i,ui as a}from"./index-NEF1i6yv.js";import{n as o,t as s}from"./Breadcrumb.es-DVw5RHLo.js";import{a as c}from"./Sidebar-zeEMJHoc-Bxyc3674.js";import{Jn as l,Zr as u,n as d}from"./GithubIcon.es-B7Jlpkjd.js";import{r as f}from"./useBoardEditor-DIdpxjCz.js";import{a as p,n as m,s as h,t as g}from"./boardConfigPaths-Btimpi_r.js";import{j as _}from"./TabsRoot-4cFAZPuR.js";import{ln as v}from"./useSessionRows-CK_XCZpc.js";import{O as y,T as b,k as x,n as S}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{o as C,s as w,t as T,u as E}from"./settings-D8kIm4wB-CQbqVTud.js";import{a as D,c as O,d as k,i as A,l as j,n as M,o as N,r as P,t as F,u as I}from"./useRowDrag-Er_-vkz8.js";import{o as L}from"./useIntakeRoutes-CO5RNQRx.js";import{h as R,p as z}from"./ruleLanes-CVuOFT_F.js";import{f as B}from"./Field.es-I4QCnl1o.js";import{n as V}from"./useBoardCatalog-D5xZ_2Xd.js";import{t as H}from"./SettingsSubsection-CMossisW.js";import{s as U}from"./settingsSections-XZPX_pR6.js";var W=e(x(),1),G=y();function K({factoryId:e}){let t=A(e),n=D(e),r=new Map((V(e).data??[]).map(e=>[e.id,e.name])),i=t.data?.pages??[],a=i.flatMap(e=>e.notRouted),o=i[0]?.canEdit??!1,s=e=>n.mutate(e.id,{onSuccess:t=>v.success(`Filing “${e.title}” on ${r.get(t.boardKey)??t.boardKey}.`),onError:e=>v.error(e.message)}),c=t.isPending?`Loading…`:t.isError?`Items not routed didn’t load.`:t.hasNextPage?`${a.length>0?`${a.length}+`:`More`} waiting for a board.`:a.length===0?`Every new issue and pull request found a board.`:`${a.length} waiting for a board.`;return(0,G.jsxs)(`section`,{id:m,"aria-label":`Not routed`,className:`flex scroll-mt-4 flex-col gap-3 px-3.5 pt-3 pb-3.5`,children:[(0,G.jsx)(C,{media:(0,G.jsx)(w,{children:(0,G.jsx)(j,{})}),title:(0,G.jsxs)(`span`,{className:`flex items-center gap-1`,children:[`Not routed`,(0,G.jsx)(B,{"aria-label":`When an item is not routed`,children:`A new issue or pull request ends up here when no board’s rules take it. Change a board’s rules, then route it again.`})]}),description:c}),(a.length>0||t.hasNextPage)&&(0,G.jsxs)(`ul`,{"aria-label":`Items not routed`,className:`ml-11 flex flex-col`,children:[a.map(t=>(0,G.jsx)(`li`,{className:`border-border border-t py-3`,children:(0,G.jsxs)(C,{title:t.url?(0,G.jsx)(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`,className:`hover:underline`,children:t.title}):t.title,description:(0,G.jsxs)(`span`,{className:`flex flex-wrap gap-x-3 gap-y-1`,children:[t.sourceKey&&(0,G.jsx)(`span`,{children:t.sourceKey}),(0,G.jsx)(`span`,{children:t.reason??`No board’s rules match it.`}),(0,G.jsx)(`time`,{dateTime:t.decidedAt,children:q(t.decidedAt)})]}),children:[(0,G.jsx)(M,{factoryProjectId:e,itemId:t.id,label:`Why?`}),o&&(0,G.jsx)(u,{size:`sm`,variant:`ghost`,onClick:()=>s(t),loading:n.isPending&&n.variables===t.id,children:`Route again`})]})},t.id)),t.hasNextPage&&(0,G.jsx)(`li`,{className:`border-border flex justify-center border-t pt-3`,children:(0,G.jsx)(u,{size:`sm`,variant:`ghost`,onClick:()=>void t.fetchNextPage(),loading:t.isFetchingNextPage,children:`Load more`})})]})]})}function q(e){return new Date(e).toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})}var J=b(`relative before:pointer-events-none before:absolute before:right-0 before:left-0 before:z-20 before:hidden before:h-0.5 before:rounded-full before:bg-border-focus`,`data-[drop=before]:before:top-0 data-[drop=before]:before:block data-[drop=after]:before:bottom-0 data-[drop=after]:before:block`);function Y({factoryId:e}){let t=P(e);return(0,G.jsx)(H,{id:g,scope:`factory`,title:`Intake order`,description:`A new issue or pull request is offered to each board in this order. The first board whose rules take it keeps it.`,children:t.isPending?(0,G.jsx)(T,{children:(0,G.jsx)(E,{label:`Loading intake order`,variant:`item`,rows:3})}):t.isError?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(d,{variant:`destructive`,children:`The intake order didn’t load.`}),(0,G.jsx)(`div`,{className:`border-border rounded-xl border`,children:(0,G.jsx)(K,{factoryId:e})})]}):(0,G.jsx)(X,{factoryId:e,order:t.data},e)})}function X({factoryId:e,order:t}){let n=L(e),r=N(e),[i,a]=(0,W.useState)(),o=t.boards.map(e=>e.boardKey),s=i&&$(i,o)?i:void 0,c=s??o,f=new Map(t.boards.map(e=>[e.boardKey,e.name])),p=s!==void 0&&s.some((e,t)=>e!==o[t]),m=(e,t)=>{let n=[...c],[r]=n.splice(e,1);r!==void 0&&(n.splice(t,0,r),a(n))},g=F({min:0,max:c.length-1,onDrop:m}),_=()=>r.mutate(c,{onSuccess:()=>{a(void 0),v.success(`Intake order saved.`)},onError:e=>v.error(e.message)}),y=t.canEdit&&c.length>1,x=y&&!r.isPending;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(Q,{order:t,changed:p}),n.isError&&(0,G.jsx)(d,{variant:`warning`,children:`Rule counts didn’t load.`}),(0,G.jsxs)(`div`,{className:`border-border flex flex-col rounded-xl border`,children:[(0,G.jsx)(T,{role:`list`,"aria-label":`Intake order`,children:c.map((t,r)=>{let i=g.drag?.from===r,a=f.get(t)??t;return(0,G.jsx)(C,{role:`listitem`,"data-drop":g.dropAt(r),style:i?{transform:`translateY(${g.drag?.offset??0}px)`}:void 0,onPointerDown:x?e=>g.onPointerDown(e,r):void 0,onKeyDown:x?e=>g.onKeyDown(e,r):void 0,className:b(`group/row`,J,i&&`z-10 opacity-90`),media:(0,G.jsxs)(w,{children:[(0,G.jsx)(S,{as:`span`,variant:`caption`,className:b(`tabular-nums`,y&&`pointer-fine:group-hover/row:hidden`,i&&`hidden`),children:r+1}),y&&(0,G.jsx)(`span`,{"data-grip":!0,"aria-hidden":!0,className:b(`text-icon3 hidden cursor-grab touch-none pointer-fine:group-hover/row:inline-flex`,i&&`inline-flex`),children:(0,G.jsx)(O,{className:`size-icon-md`})})]}),title:a,description:(0,G.jsx)(Z,{routes:n.data?.intakeRoutes,boardKey:t}),children:(0,G.jsxs)(`div`,{className:`flex items-center gap-1 transition-opacity pointer-fine:opacity-0 pointer-fine:group-focus-within/row:opacity-100 pointer-fine:group-hover/row:opacity-100`,children:[y&&(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(u,{size:`icon-sm`,variant:`ghost`,tooltip:`Check earlier`,disabled:!x||r===0,onClick:()=>m(r,r-1),children:(0,G.jsx)(I,{})}),(0,G.jsx)(u,{size:`icon-sm`,variant:`ghost`,tooltip:`Check later`,disabled:!x||r===c.length-1,onClick:()=>m(r,r+1),children:(0,G.jsx)(k,{})})]}),(0,G.jsx)(u,{size:`sm`,variant:`ghost`,render:(0,G.jsx)(l,{to:h(e,t)}),children:`Edit rules`})]})},t)})}),(0,G.jsx)(K,{factoryId:e})]}),t.canEdit&&p&&(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(u,{size:`sm`,variant:`ghost`,onClick:()=>a(void 0),disabled:r.isPending,children:`Discard`}),(0,G.jsx)(u,{size:`sm`,variant:`primary`,onClick:_,loading:r.isPending,children:`Save order`})]})]})}function Z({routes:e,boardKey:t}){if(!e)return null;let{count:n,catchesAll:r}=z(e.filter(e=>e.target.boardKey===t));return(0,G.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{children:n===0?`No rules for new issues and pull requests`:`${R(n)} for new issues and pull requests`}),r&&(0,G.jsx)(_,{children:`Ends in catch-all`})]})}function Q({order:e,changed:t}){let{compared:n,differing:r,notRouted:i}=e.comparison,a=[];if(e.origin===`derived`&&a.push(`Worked out from the old route list until someone saves an order.`),n>0){let e=i>0?`, ${i} of them Not routed`:``;a.push(r===0?`The last ${n} cards land on the same boards as with the old route list.`:`Of the last ${n} cards, ${r} would land on another board than with the old route list${e}.`)}return e.evaluator===`route-list`&&a.push(`Intake still files cards by the old route list.`),t&&a.push(`Not saved yet. The comparison is for the saved order.`),a.length===0?null:(0,G.jsx)(d,{variant:`info`,children:(0,G.jsx)(`span`,{className:`flex flex-col gap-1`,children:a.map(e=>(0,G.jsx)(`span`,{children:e},e))})})}function $(e,t){let n=new Set(t);return e.length===t.length&&e.every(e=>n.has(e))}function ee(){let e=t(),u=n()?.boardId??``,{isMobile:d,desktopState:m}=c(),h=d||m===`collapsed`,g=f(e.id,u).data?.board,_=i({breadcrumbs:h&&g?(0,G.jsxs)(s,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,G.jsx)(o,{as:l,to:p(e.id,u),children:g.name}),(0,G.jsx)(o,{as:`span`,isCurrent:!0,children:`Routing`})]}):void 0});return(0,G.jsx)(r,{variant:`settings`,header:(0,G.jsxs)(a,{children:[(0,G.jsx)(a.Title,{children:`Routing`}),(0,G.jsx)(a.Description,{children:(0,G.jsxs)(`span`,{children:[`The order boards are offered new issues and pull requests. What comes in is chosen in`,` `,(0,G.jsx)(l,{to:U(e.id,`intake`),className:`underline`,children:`Settings → Work Intake`}),`.`]})})]}),..._,children:(0,G.jsx)(Y,{factoryId:e.id})})}export{ee as BoardIntakePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$r as t,Cr as n,En as r,Er as i,Sr as a,br as o,li as s,si as c,ui as l,xr as u}from"./index-BRs5cQ2x.js";import{n as d,t as f}from"./Breadcrumb.es-DjvzVu5v.js";import{a as p}from"./Sidebar-zeEMJHoc-CAYPr70W.js";import{$n as m,Gt as h,It as g,Jn as _,Rt as v,Ut as y,Vt as b,Wt as ee,Zr as x,n as S,t as C}from"./GithubIcon.es-Bg-ShonN.js";import{r as w,t as T}from"./useBoardEditor-DhrV_vHP.js";import{a as E,i as D,o as O,s as k,t as A}from"./boardConfigPaths-Btimpi_r.js";import{ln as j,pt as M}from"./useSessionRows-DQ5H8cED.js";import{O as N,T as P,k as te,n as F}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{n as ne}from"./useBoardCatalog-BWEZygG2.js";import{c as I,d as L,l as re,n as ie,r as R,s as z,t as ae,u as B}from"./useRowDrag-De5Tj8SP.js";import{a as V,d as oe,f as se,g as ce,o as H,r as U,s as W}from"./useIntakeRoutes-C4ob2f2v.js";import{C as G,E as le,_ as ue,a as de,c as K,d as fe,f as q,g as pe,i as me,l as J,m as he,n as ge,o as _e,s as ve,u as Y,w as ye}from"./ruleLanes-CnBKj6eB.js";import{i as be,j as xe}from"./TabsRoot-DXvmv54V.js";import{t as Se}from"./Switch.es-D4TVspgz.js";import{t as X}from"./createLucideIcon-BHFyd0LL.js";import{b as Ce,y as we}from"./BoardIcons-BwoF0u8e.js";import{d as Te,n as Ee}from"./settings-D8kIm4wB-Crk4R7dN.js";import{s as De}from"./Field.es-DnLKooWt.js";import{n as Oe,t as ke}from"./RadioGroup.es-C8uhRWPA.js";import{n as Ae,t as je}from"./ConditionRows-BII3QMlB.js";var Me={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Me.node;var Ne=X(Me),Pe={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Pe.node;var Fe=X(Pe),Ie={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Ie.node;var Le=X(Ie),Re={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Re.node;var ze=X(Re),Be={name:`funnel`,size:24,node:[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],aliases:[`filter`]};Be.node;var Ve=X(Be),He={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};He.node;var Ue=X(He),We={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};We.node;var Ge=X(We),Ke={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};Ke.node;var qe=X(Ke),Je={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Je.node;var Ye=X(Je),Xe={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Xe.node;var Ze=X(Xe),Qe={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};Qe.node;var $e=X(Qe),Z=e(te(),1),Q=N();function et({when:e,options:t,everything:n}){let r=G(e,t);return!e||!r?(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,children:n}):(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:r.parts.map((t,n)=>{let i=e.conditions[n],a=i&&`conditions`in i?i:void 0;return(0,Q.jsxs)(`span`,{className:`contents`,children:[n>0&&(0,Q.jsx)(F,{as:`span`,variant:`meta`,tone:`muted`,children:r.join}),a?(0,Q.jsxs)(`span`,{className:`border-border inline-flex max-w-full items-center gap-1 rounded-md border border-dashed px-1 py-0.5`,children:[(0,Q.jsx)(F,{as:`span`,variant:`meta`,tone:`muted`,children:a.operator===`OR`?`any of`:`all of`}),(0,Q.jsx)(tt,{children:t.replace(/^\((.*)\)$/,`$1`)})]}):(0,Q.jsx)(tt,{children:t})]},n)})})}function tt({children:e}){return(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`bg-fill max-w-full truncate rounded-sm px-1.5 py-0.5`,children:e})}function nt(){return(0,Q.jsx)(xe,{size:`xs`,variant:`neutral`,emphasis:`subtle`,icon:(0,Q.jsx)(C,{"aria-hidden":`true`}),children:`GitHub only`})}function rt({boards:e,ownBoard:t,boardKey:n,phaseKey:r}){let i=e.find(e=>e.id===n);if(!i)return(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,children:[n,` (not installed)`]});let a=r??i.initialPhase,s=i.phases.find(e=>e.id===a);return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[i.id!==t&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{as:`span`,variant:`caption`,className:`truncate`,children:o(i)}),(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,children:`›`})]}),s&&(0,Q.jsx)(we,{stage:s.id,kind:Ce(i.id,s.kind),decorative:!0}),(0,Q.jsx)(F,{as:`span`,variant:`caption`,className:`truncate`,children:u(i,a)??a})]})}var it=P(`relative before:pointer-events-none before:absolute before:right-0 before:left-0 before:z-20 before:hidden before:h-0.5 before:rounded-full before:bg-border-focus`,`data-[drop=before]:before:-top-1 data-[drop=before]:before:block data-[drop=after]:before:-bottom-1 data-[drop=after]:before:block`),at=`flex flex-col gap-3 rounded-xl border border-border bg-card p-4`;function ot({event:e}){let t=Y(e),n=t.icon;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(n,{className:`text-badge-amber-indicator size-3.5 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(F,{as:`h3`,variant:`label`,tone:`ink`,children:t.label}),t.githubOnly&&(0,Q.jsx)(nt,{})]}),t.description&&(0,Q.jsx)(F,{as:`p`,variant:`caption`,tone:`muted`,children:t.description})]})}function st({children:e}){return(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`flex flex-1 items-center gap-2.5 px-3 py-1.5`,children:[(0,Q.jsx)(re,{className:`size-icon-md shrink-0`,"aria-hidden":!0}),e]})}function ct({event:e,rules:t,board:n,boards:r,phaseOptions:i,canEdit:a,skips:s,footer:c,incoming:l,only:d,onEdit:f,onAdd:p,onMove:m,onToggle:h,onDelete:g,onUngate:_}){let v=Y(e),y=de(t,e),b=K(e),ee=_e(e),S=ae({min:0,max:t.length-1,onDrop:m}),C=a&&t.length>1&&!d,w=c??(t.length?`Otherwise, the card stays where it is`:l?`No rules: this board’s cards stay where they are`:`No rules: the card stays where it is`);return(0,Q.jsxs)(`section`,{"aria-label":v.label,className:P(at,!t.length&&!l&&`opacity-60 focus-within:opacity-100 hover:opacity-100`),children:[(0,Q.jsx)(ot,{event:e}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`ol`,{"aria-label":`${v.label} rules`,className:`flex min-w-0 flex-col`,children:[t.map((c,l)=>{if(d&&!d.has(c.id))return null;let p=pe(t,e,l),w=p>=0,T=!c.enabled||w,E=S.drag?.from===l,D=s?.get(c.id),O=r.find(e=>e.id===(c.target.moveToBoardKey??c.target.boardKey)),k=!q(c.name,[v.label,ye(c.when,i),O&&o(O),u(O,c.target.phaseKey)].join(` `));return(0,Q.jsxs)(`li`,{"aria-label":c.name,"data-drop":S.dropAt(l),style:E?{transform:`translateY(${S.drag?.offset??0}px)`}:void 0,onPointerDown:C?e=>S.onPointerDown(e,l):void 0,className:P(`group/rule flex flex-col`,it,E&&`z-10 opacity-90`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 sm:flex-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Edit conditions of ${c.name}`,onClick:()=>f(c,`conditions`),onKeyDown:C?e=>S.onKeyDown(e,l):void 0,className:P(`flex w-full items-start gap-2.5 rounded-lg border bg-fill-subtle px-3 py-2 text-left transition-colors hover:border-border-hover`,T?`border-dashed border-border opacity-50`:`border-border`),children:[(0,Q.jsxs)(F,{as:`span`,variant:`meta`,tone:`muted`,className:`bg-fill mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full tabular-nums`,children:[(0,Q.jsx)(`span`,{className:P(C&&`pointer-fine:group-hover/rule:hidden`,E&&`hidden`),children:l+1}),C&&(0,Q.jsx)(`span`,{"data-grip":!0,"aria-hidden":!0,className:P(`hidden cursor-grab touch-none pointer-fine:group-hover/rule:flex`,E&&`flex`),children:(0,Q.jsx)(I,{className:`size-icon-sm`})})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[k&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`ink`,className:`truncate font-medium`,children:c.name}),(0,Q.jsx)(et,{when:c.when,options:i,everything:ee})]})]}),C&&(0,Q.jsxs)(`div`,{className:`border-border bg-card absolute top-0 right-2 flex -translate-y-1/2 rounded-md border shadow-sm transition-opacity pointer-fine:opacity-0 pointer-fine:group-focus-within/rule:opacity-100 pointer-fine:group-hover/rule:opacity-100`,children:[(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`Check earlier`,disabled:l===0,onClick:()=>m(l,l-1),children:(0,Q.jsx)(B,{})}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`Check later`,disabled:l===t.length-1,onClick:()=>m(l,l+1),children:(0,Q.jsx)(L,{})})]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 sm:shrink-0`,children:[(0,Q.jsxs)(`div`,{className:P(`flex min-w-0 items-center`,T&&`opacity-40`),children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:P(`h-px w-8 shrink-0`,T?`border-t border-dashed border-border-strong`:`bg-muted-foreground`)}),(0,Q.jsx)(Ne,{"aria-hidden":!0,className:`text-muted-foreground size-icon-sm mr-2 -ml-1.5 shrink-0`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Edit where ${c.name} moves the card`,onClick:()=>f(c,`action`),className:`border-border bg-fill-subtle hover:border-border-hover flex w-44 shrink-0 rounded-lg border px-3 py-2 text-left`,children:(0,Q.jsx)(rt,{boards:r,ownBoard:n.id,boardKey:c.target.moveToBoardKey??c.target.boardKey,phaseKey:c.target.phaseKey})})]}),a&&(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,Q.jsx)(Se,{"aria-label":`${c.name} on`,checked:c.enabled,onCheckedChange:e=>h(c,e)}),(0,Q.jsxs)(be,{children:[(0,Q.jsx)(be.Trigger,{render:(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`More for ${c.name}`,children:(0,Q.jsx)(ze,{})})}),(0,Q.jsx)(be.Content,{align:`end`,children:(0,Q.jsxs)(be.Item,{variant:`destructive`,onClick:()=>g(c),children:[(0,Q.jsx)(Ze,{}),`Delete rule`]})})]})]})]})]}),T&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex items-center gap-1.5`,children:w?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs`,"aria-hidden":!0}),`Never reached: rule `,p+1,` above matches `,ee.toLowerCase(),`.`]}):`Off, skipped`}),c.problems.map(e=>(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex items-center gap-1.5`,children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs shrink-0`,"aria-hidden":!0}),e]},e)),D&&(0,Q.jsx)(ut,{skips:D}),ue(c,e)&&(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[`Skips outside authors’ pull requests (older rule).`,a&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>_(c),className:`underline`,children:`Let outside authors match`})]}),fe(c,e)&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3`,children:`Moves cards only: files no new pull requests`}),b&&ve(c)&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3`,children:Y(`work_item.created`).label}),l!==y&&!d&&(0,Q.jsxs)(`div`,{"aria-hidden":!0,className:`flex h-7 items-center pl-5.5`,children:[(0,Q.jsx)(`span`,{className:`bg-border-strong h-full w-px`}),(0,Q.jsx)(F,{as:`span`,variant:`meta`,tone:`muted`,className:`ml-2`,children:`no`})]})]},c.id)}),!d&&(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3`,children:[y<0&&(0,Q.jsx)(st,{children:w}),a&&(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(Ye,{}),onClick:p,children:`Add rule`})]})]}),l]})]})}function lt(e){return e?.match(/was skipped: (.+?)\.?$/)?.[1]??e??`its target couldn’t take the card`}function ut({skips:e}){let{count:t,latest:n}=e;return(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs shrink-0`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[`Skipped `,t===1?`once`:`${t} times`,` in the last 30 days: `,lt(n.reason),`.`]}),n.url?(0,Q.jsxs)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`,className:`underline`,children:[`Latest: `,n.title]}):(0,Q.jsxs)(`span`,{children:[`Latest: `,n.title]})]})}var dt=`flex flex-col gap-8`;function ft({section:e,intakeChain:t,children:n}){return(0,Q.jsxs)(`section`,{"aria-label":e.title,className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(Te,{children:e.title}),e.events.some(K)?t:(0,Q.jsx)(Ee,{children:`Only cards already on this board; other boards never see them.`})]}),n]})}function pt({event:e}){return(0,Q.jsxs)(`div`,{className:at,children:[(0,Q.jsx)(ot,{event:e}),(0,Q.jsx)(st,{children:(0,Q.jsx)(M,{line:`text-caption`,className:`w-56 motion-reduce:before:animate-none`})})]})}function mt(){return(0,Q.jsx)(`div`,{role:`status`,"aria-label":`Loading rules`,children:(0,Q.jsx)(`div`,{"aria-hidden":!0,className:dt,children:ge.map(e=>(0,Q.jsx)(ft,{section:e,intakeChain:(0,Q.jsx)(M,{line:`text-caption leading-6 ps-2`,className:`w-96 max-w-full motion-reduce:before:animate-none`}),children:e.events.map(e=>(0,Q.jsx)(pt,{event:e},e))},e.title))})})}function ht({factoryId:e,rules:t,board:n,boards:r}){return(0,Q.jsxs)(`section`,{"aria-label":`From other boards`,className:`border-border mt-3 flex flex-col gap-1.5 border-t pt-3`,children:[(0,Q.jsxs)(F,{as:`h4`,variant:`meta`,tone:`muted`,className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(qe,{className:`size-icon-xs shrink-0`,"aria-hidden":!0}),`From other boards`]}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:t.map(t=>{let i=r.find(e=>e.id===t.target.boardKey);return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(_,{to:k(e,t.target.boardKey),"aria-label":`${t.name}, on ${i?o(i):t.target.boardKey}`,className:P(`group flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,!t.enabled&&`opacity-50`),children:[(0,Q.jsxs)(`span`,{className:`border-border group-hover:border-border-hover flex w-full min-w-0 flex-col gap-1 rounded-lg border border-dashed px-3 py-2 sm:flex-1`,children:[(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`ink`,className:`truncate font-medium`,children:i?o(i):`${t.target.boardKey} (not installed)`}),(0,Q.jsx)(et,{when:t.when,options:a(i),everything:`Every card`})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 shrink-0 items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`border-border-strong h-0 w-8 shrink-0 border-t border-dashed`}),(0,Q.jsx)(Ne,{"aria-hidden":!0,className:`text-muted-foreground size-icon-sm mr-2 -ml-1.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`flex w-44 shrink-0 items-center px-3 py-2`,children:(0,Q.jsx)(rt,{boards:r,ownBoard:n.id,boardKey:n.id,phaseKey:t.target.phaseKey})})]}),!t.enabled&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,children:`Off`})]})},t.id)})})]})}function gt({factoryId:e,boardKey:t,order:n,evaluator:r}){let i=n.some(e=>e.boardKey===t);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[r===`route-list`?(0,Q.jsx)(F,{as:`p`,variant:`caption`,tone:`muted`,children:`Intake still files new issues and pull requests by the old route list, not by board.`}):i?(0,Q.jsxs)(`ol`,{"aria-label":`Intake order`,className:`flex flex-wrap items-center gap-1`,children:[n.map(n=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(`li`,{children:n.boardKey===t?(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`ink`,"aria-current":`step`,className:`bg-surface3 rounded-md px-2 py-0.5 font-medium`,children:n.name}):(0,Q.jsx)(_,{to:k(e,n.boardKey),className:`text-muted-foreground hover:text-foreground rounded-md px-2 py-0.5`,children:(0,Q.jsx)(F,{as:`span`,variant:`caption`,children:n.name})})}),(0,Q.jsx)(Le,{"aria-hidden":!0,className:`text-muted-foreground size-icon-xs shrink-0`})]},n.boardKey)),(0,Q.jsx)(`li`,{children:(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`px-2 py-0.5`,children:`Not routed`})})]}):(0,Q.jsx)(F,{as:`p`,variant:`caption`,tone:`muted`,children:`Not in the intake order: new issues and pull requests never reach these rules.`}),(0,Q.jsxs)(_,{to:O(e,t,A),className:`text-muted-foreground hover:text-foreground flex items-center gap-1.5`,children:[(0,Q.jsx)(Ge,{className:`size-icon-xs shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(F,{as:`span`,variant:`caption`,className:`underline decoration-dotted underline-offset-2`,children:`Reorder`})]})]})}var _t=`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors`,vt=`border-border-focus bg-fill-hover`,yt=`border-border bg-fill-subtle hover:border-border-hover hover:bg-fill-hover`;function bt({selected:e,disabled:t,onClick:n,children:r}){return(0,Q.jsx)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,onClick:n,className:P(_t,`disabled:opacity-50`,e?vt:yt),children:r})}function xt({value:e,selected:t,disabled:n,onClick:r,children:i}){let a=(0,Z.useId)();return(0,Q.jsxs)(`label`,{onClick:r,className:P(_t,`has-[[role=radio]:focus-visible]:outline-border-focus has-[[role=radio]:focus-visible]:outline-1 has-[[role=radio]:focus-visible]:outline-solid`,t?vt:yt,n?`cursor-not-allowed opacity-50`:`cursor-pointer`),children:[(0,Q.jsx)(Oe,{value:e,disabled:n,"aria-labelledby":a,className:`sr-only`}),(0,Q.jsx)(`span`,{id:a,className:`flex min-w-0 items-start gap-3`,children:i})]})}var St=120,Ct=ce(W),$=[{id:`trigger`,title:`Trigger`,question:`What should this rule listen for?`},{id:`conditions`,title:`Only if`,question:`Which items should it apply to?`},{id:`action`,title:`Move to`,question:`Where should it go?`},{id:`review`,title:`Review`,question:`Name and check your rule`}];function wt(e,t){let n=e?.phases??[];return t?n.filter(e=>e.kind!==`terminal`):n}function Tt(e,t){if(t){let e=Ct.safeParse(t);if(!e.success)return e.error.issues[0]?.message}return se(e,t)??void 0}function Et(e,t,n){let r=`When ${e.map(e=>Y(e).label.toLowerCase()).join(` or `)}${t?`, ${ye(t).charAt(0).toLowerCase()}${ye(t).slice(1)}`:``}, move to ${n}`;return r.length>St?`${r.slice(0,119)}…`:r}function Dt({factoryId:e,board:t,boards:n,initial:r,initialEvent:i,initialStep:s,readOnly:c,saving:l,error:d,onSave:f,onClose:p}){let m=Ae(e),[_,C]=(0,Z.useState)(()=>r?.on??(i?[i]:[])),[w,T]=(0,Z.useState)(()=>r?.when??null),[E,D]=(0,Z.useState)(()=>(r?.when?.conditions.length??0)>0),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(()=>r?.target.moveToBoardKey??t.id),[M,N]=(0,Z.useState)(()=>r?r.target.phaseKey??void 0:void 0),[te,ne]=(0,Z.useState)(()=>r?.name),[I,L]=(0,Z.useState)(s),[re,ie]=(0,Z.useState)(0),R=he(_),z=n.find(e=>e.id===A),ae=wt(z,R),B=ae.find(e=>e.id===(M??z?.initialPhase)),V=E?w:null,se=_.length?Tt(_,V):void 0,ce=B&&z?`${o(z)} › ${u(z,B.id)}`:``,H=te??(B?Et(_,V,ce):``),U={trigger:_.length>0,conditions:_.length>0&&!(E&&O)&&!se,action:B!==void 0,review:H.trim().length>0},W=!c&&U.trigger&&U.conditions&&U.action&&U.review,G=$.findIndex(e=>e.id===I),ue=$[G]??$[0],de=e=>{C(e),he(e)&&A!==t.id&&(j(t.id),N(void 0))},K=()=>{W&&B&&f({name:H.trim(),on:_,when:V,target:{phaseKey:B.id,moveToBoardKey:A===t.id?null:A}})},fe=()=>{let e={field:`pullRequest.trusted`,operator:`equals`,value:!0};T(V===null?{operator:`AND`,conditions:[e]}:V.operator===`AND`?{...V,conditions:[...V.conditions,e]}:{operator:`AND`,conditions:[V,e]}),D(!0),k(!1),ie(e=>e+1)},q={trigger:_.length?_.map(e=>Y(e).label).join(`, `):void 0,conditions:_.length?ye(V,a(t)):void 0,action:B?(0,Q.jsx)(rt,{boards:n,ownBoard:t.id,boardKey:A,phaseKey:B.id}):void 0,review:void 0};return(0,Q.jsx)(g,{open:!0,onOpenChange:e=>!e&&p(),children:(0,Q.jsxs)(b,{size:`xl`,children:[(0,Q.jsx)(ee,{children:(0,Q.jsx)(h,{children:c?`Rule`:r?`Edit rule`:`Add rule`})}),(0,Q.jsx)(v,{children:(0,Q.jsxs)(`div`,{className:`grid min-h-105 grid-cols-1 gap-6 sm:grid-cols-[12rem_1fr]`,children:[(0,Q.jsx)(`nav`,{"aria-label":`Rule steps`,className:`sm:border-border flex gap-1 overflow-x-auto sm:flex-col sm:border-r sm:pr-4`,children:$.map((e,t)=>{let n=t===0||$.slice(0,t).every(e=>U[e.id]),r=U[e.id]&&e.id!==`review`;return(0,Q.jsxs)(`button`,{type:`button`,disabled:!n,"aria-current":I===e.id?`step`:void 0,onClick:()=>L(e.id),className:P(`flex shrink-0 items-start gap-2.5 rounded-lg px-2 py-2 text-left transition-colors disabled:opacity-40`,I===e.id?`bg-fill-hover`:`hover:bg-fill-subtle`),children:[(0,Q.jsx)(F,{as:`span`,variant:`meta`,className:P(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full border`,r?`border-transparent bg-fill-inverse text-background`:`border-border-strong`),children:r?(0,Q.jsx)(Fe,{className:`size-icon-xs`,"aria-hidden":!0}):t+1}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(F,{as:`span`,variant:`label`,tone:`ink`,className:`block`,children:e.title}),q[e.id]&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`hidden truncate sm:block`,children:q[e.id]})]})]},e.id)})}),(0,Q.jsxs)(`section`,{"aria-label":ue.title,className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsx)(F,{as:`h3`,variant:`heading`,children:ue.question}),I===`trigger`&&(0,Q.jsx)(At,{value:_,disabled:c,onChange:de}),I===`conditions`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(ke,{"aria-label":`Which ones`,value:E?`matching`:`every`,disabled:c,onValueChange:e=>{D(e===`matching`),k(!1)},className:`grid-cols-1 sm:grid-cols-2`,children:[(0,Q.jsx)(xt,{value:`every`,selected:!E,disabled:c,children:(0,Q.jsx)(Ot,{title:R?`Every new one`:`Every card`,hint:`Run whenever this happens.`})}),(0,Q.jsx)(xt,{value:`matching`,selected:E,disabled:c,children:(0,Q.jsx)(Ot,{title:`Only ones that match`,hint:`Narrow it down by repository, label, author and more.`})})]}),E&&(0,Q.jsx)(`div`,{className:`border-border bg-fill-subtle rounded-xl border p-3`,children:(0,Q.jsx)(je,{label:`Conditions`,rule:w,facts:le(_),options:{...a(t),"source.repository":m},onChange:(e,t)=>{T(e),k(t)}},re)}),se&&(0,Q.jsx)(S,{variant:`warning`,children:se}),!r?.outsiderPullRequestsGated&&oe(_,V)&&(0,Q.jsx)(S,{variant:`info`,children:(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Q.jsx)(`span`,{children:`Also matches pull requests from outside authors.`}),!c&&(0,Q.jsx)(`button`,{type:`button`,onClick:fe,className:`shrink-0 underline`,children:`Add: Pull request trusted is yes`})]})})]}),I===`action`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[R?(0,Q.jsx)(F,{as:`p`,variant:`caption`,tone:`muted`,children:`An item with no card yet can only be filed on this board.`}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(F,{as:`span`,variant:`eyebrow`,tone:`muted`,children:`Board`}),(0,Q.jsx)(ke,{"aria-label":`Board`,value:A,disabled:c,onValueChange:e=>{typeof e==`string`&&e!==A&&(j(e),N(void 0))},className:`grid-cols-1 sm:grid-cols-3`,children:n.map(e=>(0,Q.jsx)(xt,{value:e.id,selected:e.id===A,disabled:c,children:(0,Q.jsxs)(F,{as:`span`,variant:`label`,tone:`ink`,children:[o(e),e.id===t.id?` (this board)`:``]})},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(F,{as:`span`,variant:`eyebrow`,tone:`muted`,children:`Phase`}),(0,Q.jsx)(ke,{"aria-label":`Phase`,value:B?.id??null,disabled:c,onValueChange:e=>typeof e==`string`&&N(e),className:`grid-cols-1 sm:grid-cols-2`,children:z&&ae.map(e=>(0,Q.jsx)(xt,{value:e.id,selected:e.id===B?.id,disabled:c,onClick:()=>{N(e.id),L(`review`)},children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(we,{stage:e.id,kind:Ce(z.id,e.kind),decorative:!0}),(0,Q.jsx)(F,{as:`span`,variant:`label`,tone:`ink`,children:u(z,e.id)})]})},e.id))})]})]}),I===`review`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(F,{as:`span`,variant:`label`,tone:`muted`,children:`Name`}),(0,Q.jsx)(De,{value:H,maxLength:St,disabled:c,onChange:e=>ne(e.target.value)})]}),(0,Q.jsxs)(`div`,{className:`border-border bg-fill-subtle rounded-xl border p-4`,children:[(0,Q.jsx)(F,{as:`span`,variant:`eyebrow`,tone:`muted`,className:`mb-3 block`,children:`This rule reads as`}),(0,Q.jsxs)(`ol`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(kt,{label:`When`,children:q.trigger}),(0,Q.jsx)(kt,{label:`Only if`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Ve,{className:`text-muted-foreground size-icon-sm`,"aria-hidden":!0}),q.conditions]})}),(0,Q.jsx)(kt,{label:`Then`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Move to `,(0,Q.jsx)(Ne,{className:`size-icon-sm`,"aria-hidden":!0}),` `,q.action]})})]})]})]}),d&&(0,Q.jsx)(S,{variant:`destructive`,role:`alert`,children:d})]})]})}),(0,Q.jsxs)(y,{children:[(0,Q.jsx)(x,{variant:`ghost`,onClick:p,children:c?`Close`:`Cancel`}),(0,Q.jsx)(`div`,{className:`flex-1`}),G>0&&(0,Q.jsx)(x,{variant:`default`,onClick:()=>L($[G-1].id),children:`Back`}),!c&&(I===`review`||r&&W?(0,Q.jsx)(x,{variant:`primary`,disabled:!W,onClick:K,loading:l,children:r?`Save rule`:`Create rule`}):(0,Q.jsx)(x,{variant:`primary`,disabled:!U[I],onClick:()=>L($[G+1]?.id??`review`),children:`Continue`}))]})]})})}function Ot({title:e,hint:t}){return(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(F,{as:`span`,variant:`label`,tone:`ink`,className:`block`,children:e}),(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`block`,children:t})]})}function kt({label:e,children:t}){return(0,Q.jsxs)(`li`,{className:`grid grid-cols-[4.5rem_1fr] items-start gap-3`,children:[(0,Q.jsx)(F,{as:`span`,variant:`body-sm`,tone:`muted`,children:e}),(0,Q.jsx)(F,{as:`span`,variant:`body-sm`,children:t})]})}function At({value:e,disabled:t,onChange:n}){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.includes(`work_item.created`)&&(0,Q.jsxs)(S,{variant:`info`,children:[`Also listens on “`,Y(`work_item.created`).label,`”, which takes new issues and pull requests. Saving keeps it.`]}),ge.map(r=>(0,Q.jsxs)(`div`,{role:`group`,"aria-label":r.title,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(F,{as:`span`,variant:`eyebrow`,tone:`muted`,children:r.title}),(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:r.events.map(r=>{let i=Y(r),a=i.icon,o=e.includes(r);return(0,Q.jsxs)(bt,{selected:o,disabled:t||o&&e.length===1,onClick:()=>n(o?e.filter(e=>e!==r):[...e,r]),children:[(0,Q.jsx)(a,{className:`text-badge-amber-indicator mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(Ot,{title:i.label,hint:i.description}),i.githubOnly&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,Q.jsx)(nt,{})})]},r)})})]},r.title))]})}function jt({count:e,into:t,leaving:n,showAll:r}){let i=n?`sending cards to ${t}`:`moving cards into ${t}`;return(0,Q.jsxs)(`div`,{className:`border-border flex items-center gap-2 rounded-lg border px-3 py-2`,children:[(0,Q.jsx)(Ue,{className:`size-icon-md text-muted-foreground shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(F,{as:`p`,variant:`body-sm`,tone:e===void 0?`muted`:`ink`,className:`flex-1`,children:e===void 0?`Couldn’t pick out the rules ${i}, so every rule is shown.`:e===0?`No rule is ${i}.`:`Only the ${e===1?`rule`:`${e} rules`} ${i}.`}),(0,Q.jsx)(x,{size:`sm`,variant:`ghost`,render:(0,Q.jsx)(_,{to:r}),children:`Show all`})]})}var Mt=new Set([`revision_mismatch`,`intake_route_set_mismatch`,`intake_route_not_found`]);function Nt(e){return e instanceof T&&e.code!==void 0&&Mt.has(e.code)}function Pt(e){return Nt(e)?`Someone else changed these rules first. They have been reloaded; try again.`:e instanceof Error?e.message:`The change didn’t save.`}function Ft({factoryId:e,boardId:t}){let n=ne(e),r=n.data?.find(e=>e.id===t);return n.isPending?(0,Q.jsx)(mt,{}):n.isError?(0,Q.jsx)(S,{variant:`destructive`,children:`Boards didn’t load.`}):r?(0,Q.jsx)(It,{factoryId:e,board:r,boards:n.data},`${e}:${r.id}`):(0,Q.jsx)(S,{variant:`warning`,children:`This board isn’t installed.`})}function It({factoryId:e,board:t,boards:r}){let o=U(e,t.id),s=H(e),c=R(e),l=z(e),d=V(e),[f,p]=(0,Z.useState)(),h=(0,Z.useRef)(void 0),g=e=>{h.current=e,p(e)},[_,v]=(0,Z.useState)(),y=o.data?.intakeRoutes??[],b=o.data?.canEdit??!1,ee=a(t),x=(s.data?.intakeRoutes??[]).filter(e=>e.target.moveToBoardKey===t.id&&e.target.boardKey!==t.id),C=new Map(l.data?.skipped.map(e=>[e.routeId,e])),[w]=m(),T=w.get(`into`)??void 0,E=w.has(D),O=E||T!==void 0,A=O&&s.data?i(s.data.intakeRoutes,{key:t.id,initialPhase:t.initialPhase}):void 0,M=A&&new Set((E?A.leaving:A.into.get(T??``)??[]).map(e=>e.id)),N=e=>!M||e.some(e=>M.has(e.id));if(o.isPending||O&&s.isPending)return(0,Q.jsx)(mt,{});if(o.isError)return(0,Q.jsx)(S,{variant:`destructive`,children:`This board’s rules didn’t load.`});let P=e=>d.mutateAsync(e).catch(e=>j.error(Pt(e))),te=(e,r,i)=>{let a=J(y,e).map(e=>e.id);P([{kind:`reorder`,boardKey:t.id,ids:n(y,a,r,i)}])},F=e=>{v(void 0),g(e)},ne=async e=>{let n=h.current,r=n?.rule,i=()=>n!==void 0&&h.current===n;v(void 0);try{if(r)await d.mutateAsync([{kind:`update`,id:r.id,patch:{name:e.name,on:e.on,when:e.when,target:{boardKey:r.target.boardKey,...e.target,joinClosedIssue:r.target.joinClosedIssue},expectedRevision:r.revision}}]);else{let[n]=await d.mutateAsync([{kind:`create`,route:{...e,target:{boardKey:t.id,...e.target}}}]);i()&&g(void 0),n&&await L(n,e.on).catch(e=>j.error(Pt(e)));return}i()&&g(void 0)}catch(e){if(!i())return;if(r&&Nt(e))return I(r);v(Pt(e))}},I=async e=>{let t=h.current,n=(await o.refetch()).data?.intakeRoutes.find(t=>t.id===e.id);t&&h.current===t&&(n?(g({...t,rule:n}),v(`Someone else changed this rule first. It now shows their version; make your change again.`)):(g(void 0),j.error(`Someone else deleted this rule first.`)))},L=async(e,r)=>{if(e.target.boardKey!==t.id)return;let i=(await o.refetch()).data?.intakeRoutes??[],a=i.map(e=>e.id),s=a.indexOf(e.id),c=r.flatMap(t=>{let n=J(i,t),r=n[pe(n,t,n.findIndex(t=>t.id===e.id))];return r?[a.indexOf(r.id)]:[]}),l=Math.min(...c);s<0||!(l<s)||await d.mutateAsync([{kind:`reorder`,boardKey:t.id,ids:n(i,a,s,l)}])},re=c.data?.evaluator===`route-list`?`Otherwise: the old route list decides`:me(c.data?.boards,t.id);return(0,Q.jsxs)(`div`,{className:dt,children:[s.isError&&(0,Q.jsx)(S,{variant:`warning`,children:`Rules on other boards that move cards here didn’t load, so they aren’t shown.`}),O&&(0,Q.jsx)(jt,{count:M?.size,into:E||!T?`other boards`:u(t,T)??T,leaving:E,showAll:k(e,t.id)}),ge.filter(e=>e.events.some(e=>N([...J(y,e),...J(x,e)]))).map(n=>(0,Q.jsx)(ft,{section:n,intakeChain:c.data&&(0,Q.jsx)(gt,{factoryId:e,boardKey:t.id,order:c.data.boards,evaluator:c.data.evaluator}),children:n.events.map(n=>{let i=K(n),a=J(y,n),o=J(x,n).filter(e=>!M||M.has(e.id));return N([...a,...o])?(0,Q.jsx)(ct,{event:n,rules:a,board:t,boards:r,phaseOptions:ee,canEdit:b,skips:C,footer:i?re:void 0,only:M,incoming:o.length?(0,Q.jsx)(ht,{factoryId:e,rules:o,board:t,boards:r}):void 0,onEdit:(e,t)=>F({rule:e,step:t}),onAdd:()=>F({event:n,step:`conditions`}),onMove:(e,t)=>te(n,e,t),onToggle:(e,t)=>void P([{kind:`update`,id:e.id,patch:{enabled:t,expectedRevision:e.revision}}]),onDelete:e=>void P([{kind:`delete`,id:e.id,expectedRevision:e.revision}]).then(t=>t&&j.success(`Deleted “${e.name}”`)),onUngate:e=>void P([{kind:`update`,id:e.id,patch:{outsiderPullRequestsGated:!1,expectedRevision:e.revision}}]).then(t=>t&&j.success(`“${e.name}” now matches outside authors’ pull requests`))},n):null})},n.title)),f&&(0,Q.jsx)(Dt,{factoryId:e,board:t,boards:r,initial:f.rule,initialEvent:f.event,initialStep:f.step,readOnly:!b,saving:d.isPending,error:_,onSave:e=>void ne(e),onClose:()=>g(void 0)},f.rule?`${f.rule.id}:${f.rule.revision}`:`new-${f.event}`)]})}function Lt(){let e=t(),n=r()?.boardId??``,{isMobile:i,desktopState:a}=p(),o=i||a===`collapsed`,u=w(e.id,n).data?.board,m=c({breadcrumbs:o&&u?(0,Q.jsxs)(f,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(d,{as:_,to:E(e.id,n),children:u.name}),(0,Q.jsx)(d,{as:`span`,isCurrent:!0,children:`Rules`})]}):void 0});return(0,Q.jsx)(s,{variant:`settings`,header:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(l,{children:[(0,Q.jsx)(l.Title,{children:`Rules`}),(0,Q.jsx)(l.Description,{children:`What happens to issues and pull requests on this board. In each lane the first matching rule wins.`})]}),(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(ie,{factoryProjectId:e.id,label:`Test an issue or pull request`})})]}),...m,children:(0,Q.jsx)(Ft,{factoryId:e.id,boardId:n})})}export{Lt as BoardRulesPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$r as t,Cr as n,En as r,Er as i,Sr as a,br as o,li as s,si as c,ui as l,xr as u}from"./index-NEF1i6yv.js";import{n as d,t as f}from"./Breadcrumb.es-DVw5RHLo.js";import{a as p}from"./Sidebar-zeEMJHoc-Bxyc3674.js";import{$n as m,Gt as h,It as g,Jn as _,Rt as v,Ut as y,Vt as b,Wt as ee,Zr as x,n as S,t as C}from"./GithubIcon.es-B7Jlpkjd.js";import{r as w,t as T}from"./useBoardEditor-DIdpxjCz.js";import{a as E,i as D,o as O,s as k,t as A}from"./boardConfigPaths-Btimpi_r.js";import{ln as j,pt as M}from"./useSessionRows-CK_XCZpc.js";import{O as N,T as P,k as te,n as F}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{n as ne}from"./useBoardCatalog-D5xZ_2Xd.js";import{c as I,d as L,l as re,n as ie,r as R,s as z,t as ae,u as B}from"./useRowDrag-Er_-vkz8.js";import{a as V,d as oe,f as se,g as ce,o as H,r as U,s as W}from"./useIntakeRoutes-CO5RNQRx.js";import{C as G,E as le,_ as ue,a as de,c as K,d as fe,f as q,g as pe,i as me,l as J,m as he,n as ge,o as _e,s as ve,u as Y,w as ye}from"./ruleLanes-CVuOFT_F.js";import{i as be,j as xe}from"./TabsRoot-4cFAZPuR.js";import{t as Se}from"./Switch.es-BHKLznzT.js";import{t as X}from"./createLucideIcon-BHFyd0LL.js";import{b as Ce,y as we}from"./BoardIcons-Cpj2za0J.js";import{d as Te,n as Ee}from"./settings-D8kIm4wB-CQbqVTud.js";import{c as De}from"./Field.es-I4QCnl1o.js";import{n as Oe,t as ke}from"./RadioGroup.es-Diuc7XUK.js";import{n as Ae,t as je}from"./ConditionRows-DsnKRQxV.js";var Me={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};Me.node;var Ne=X(Me),Pe={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};Pe.node;var Fe=X(Pe),Ie={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Ie.node;var Le=X(Ie),Re={name:`ellipsis`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]],aliases:[`more-horizontal`]};Re.node;var ze=X(Re),Be={name:`funnel`,size:24,node:[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]],aliases:[`filter`]};Be.node;var Ve=X(Be),He={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};He.node;var Ue=X(He),We={name:`list-ordered`,size:24,node:[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]};We.node;var Ge=X(We),Ke={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};Ke.node;var qe=X(Ke),Je={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};Je.node;var Ye=X(Je),Xe={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Xe.node;var Ze=X(Xe),Qe={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};Qe.node;var $e=X(Qe),Z=e(te(),1),Q=N();function et({when:e,options:t,everything:n}){let r=G(e,t);return!e||!r?(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,children:n}):(0,Q.jsx)(`span`,{className:`flex flex-wrap items-center gap-1`,children:r.parts.map((t,n)=>{let i=e.conditions[n],a=i&&`conditions`in i?i:void 0;return(0,Q.jsxs)(`span`,{className:`contents`,children:[n>0&&(0,Q.jsx)(F,{as:`span`,variant:`meta`,tone:`muted`,children:r.join}),a?(0,Q.jsxs)(`span`,{className:`border-border inline-flex max-w-full items-center gap-1 rounded-md border border-dashed px-1 py-0.5`,children:[(0,Q.jsx)(F,{as:`span`,variant:`meta`,tone:`muted`,children:a.operator===`OR`?`any of`:`all of`}),(0,Q.jsx)(tt,{children:t.replace(/^\((.*)\)$/,`$1`)})]}):(0,Q.jsx)(tt,{children:t})]},n)})})}function tt({children:e}){return(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`bg-fill max-w-full truncate rounded-sm px-1.5 py-0.5`,children:e})}function nt(){return(0,Q.jsx)(xe,{size:`xs`,variant:`neutral`,emphasis:`subtle`,icon:(0,Q.jsx)(C,{"aria-hidden":`true`}),children:`GitHub only`})}function rt({boards:e,ownBoard:t,boardKey:n,phaseKey:r}){let i=e.find(e=>e.id===n);if(!i)return(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,children:[n,` (not installed)`]});let a=r??i.initialPhase,s=i.phases.find(e=>e.id===a);return(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[i.id!==t&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{as:`span`,variant:`caption`,className:`truncate`,children:o(i)}),(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,children:`›`})]}),s&&(0,Q.jsx)(we,{stage:s.id,kind:Ce(i.id,s.kind),decorative:!0}),(0,Q.jsx)(F,{as:`span`,variant:`caption`,className:`truncate`,children:u(i,a)??a})]})}var it=P(`relative before:pointer-events-none before:absolute before:right-0 before:left-0 before:z-20 before:hidden before:h-0.5 before:rounded-full before:bg-border-focus`,`data-[drop=before]:before:-top-1 data-[drop=before]:before:block data-[drop=after]:before:-bottom-1 data-[drop=after]:before:block`),at=`flex flex-col gap-3 rounded-xl border border-border bg-card p-4`;function ot({event:e}){let t=Y(e),n=t.icon;return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(n,{className:`text-badge-amber-indicator size-3.5 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(F,{as:`h3`,variant:`label`,tone:`ink`,children:t.label}),t.githubOnly&&(0,Q.jsx)(nt,{})]}),t.description&&(0,Q.jsx)(F,{as:`p`,variant:`caption`,tone:`muted`,children:t.description})]})}function st({children:e}){return(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`flex flex-1 items-center gap-2.5 px-3 py-1.5`,children:[(0,Q.jsx)(re,{className:`size-icon-md shrink-0`,"aria-hidden":!0}),e]})}function ct({event:e,rules:t,board:n,boards:r,phaseOptions:i,canEdit:a,skips:s,footer:c,incoming:l,only:d,onEdit:f,onAdd:p,onMove:m,onToggle:h,onDelete:g,onUngate:_}){let v=Y(e),y=de(t,e),b=K(e),ee=_e(e),S=ae({min:0,max:t.length-1,onDrop:m}),C=a&&t.length>1&&!d,w=c??(t.length?`Otherwise, the card stays where it is`:l?`No rules: this board’s cards stay where they are`:`No rules: the card stays where it is`);return(0,Q.jsxs)(`section`,{"aria-label":v.label,className:P(at,!t.length&&!l&&`opacity-60 focus-within:opacity-100 hover:opacity-100`),children:[(0,Q.jsx)(ot,{event:e}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,Q.jsxs)(`ol`,{"aria-label":`${v.label} rules`,className:`flex min-w-0 flex-col`,children:[t.map((c,l)=>{if(d&&!d.has(c.id))return null;let p=pe(t,e,l),w=p>=0,T=!c.enabled||w,E=S.drag?.from===l,D=s?.get(c.id),O=r.find(e=>e.id===(c.target.moveToBoardKey??c.target.boardKey)),k=!q(c.name,[v.label,ye(c.when,i),O&&o(O),u(O,c.target.phaseKey)].join(` `));return(0,Q.jsxs)(`li`,{"aria-label":c.name,"data-drop":S.dropAt(l),style:E?{transform:`translateY(${S.drag?.offset??0}px)`}:void 0,onPointerDown:C?e=>S.onPointerDown(e,l):void 0,className:P(`group/rule flex flex-col`,it,E&&`z-10 opacity-90`),children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 sm:flex-1`,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Edit conditions of ${c.name}`,onClick:()=>f(c,`conditions`),onKeyDown:C?e=>S.onKeyDown(e,l):void 0,className:P(`flex w-full items-start gap-2.5 rounded-lg border bg-fill-subtle px-3 py-2 text-left transition-colors hover:border-border-hover`,T?`border-dashed border-border opacity-50`:`border-border`),children:[(0,Q.jsxs)(F,{as:`span`,variant:`meta`,tone:`muted`,className:`bg-fill mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full tabular-nums`,children:[(0,Q.jsx)(`span`,{className:P(C&&`pointer-fine:group-hover/rule:hidden`,E&&`hidden`),children:l+1}),C&&(0,Q.jsx)(`span`,{"data-grip":!0,"aria-hidden":!0,className:P(`hidden cursor-grab touch-none pointer-fine:group-hover/rule:flex`,E&&`flex`),children:(0,Q.jsx)(I,{className:`size-icon-sm`})})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[k&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`ink`,className:`truncate font-medium`,children:c.name}),(0,Q.jsx)(et,{when:c.when,options:i,everything:ee})]})]}),C&&(0,Q.jsxs)(`div`,{className:`border-border bg-card absolute top-0 right-2 flex -translate-y-1/2 rounded-md border shadow-sm transition-opacity pointer-fine:opacity-0 pointer-fine:group-focus-within/rule:opacity-100 pointer-fine:group-hover/rule:opacity-100`,children:[(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`Check earlier`,disabled:l===0,onClick:()=>m(l,l-1),children:(0,Q.jsx)(B,{})}),(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`Check later`,disabled:l===t.length-1,onClick:()=>m(l,l+1),children:(0,Q.jsx)(L,{})})]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 sm:shrink-0`,children:[(0,Q.jsxs)(`div`,{className:P(`flex min-w-0 items-center`,T&&`opacity-40`),children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:P(`h-px w-8 shrink-0`,T?`border-t border-dashed border-border-strong`:`bg-muted-foreground`)}),(0,Q.jsx)(Ne,{"aria-hidden":!0,className:`text-muted-foreground size-icon-sm mr-2 -ml-1.5 shrink-0`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Edit where ${c.name} moves the card`,onClick:()=>f(c,`action`),className:`border-border bg-fill-subtle hover:border-border-hover flex w-44 shrink-0 rounded-lg border px-3 py-2 text-left`,children:(0,Q.jsx)(rt,{boards:r,ownBoard:n.id,boardKey:c.target.moveToBoardKey??c.target.boardKey,phaseKey:c.target.phaseKey})})]}),a&&(0,Q.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-0.5`,children:[(0,Q.jsx)(Se,{"aria-label":`${c.name} on`,checked:c.enabled,onCheckedChange:e=>h(c,e)}),(0,Q.jsxs)(be,{children:[(0,Q.jsx)(be.Trigger,{render:(0,Q.jsx)(x,{variant:`ghost`,size:`icon-sm`,tooltip:`More for ${c.name}`,children:(0,Q.jsx)(ze,{})})}),(0,Q.jsx)(be.Content,{align:`end`,children:(0,Q.jsxs)(be.Item,{variant:`destructive`,onClick:()=>g(c),children:[(0,Q.jsx)(Ze,{}),`Delete rule`]})})]})]})]})]}),T&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex items-center gap-1.5`,children:w?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs`,"aria-hidden":!0}),`Never reached: rule `,p+1,` above matches `,ee.toLowerCase(),`.`]}):`Off, skipped`}),c.problems.map(e=>(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex items-center gap-1.5`,children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs shrink-0`,"aria-hidden":!0}),e]},e)),D&&(0,Q.jsx)(ut,{skips:D}),ue(c,e)&&(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[`Skips outside authors’ pull requests (older rule).`,a&&(0,Q.jsx)(`button`,{type:`button`,onClick:()=>_(c),className:`underline`,children:`Let outside authors match`})]}),fe(c,e)&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3`,children:`Moves cards only: files no new pull requests`}),b&&ve(c)&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3`,children:Y(`work_item.created`).label}),l!==y&&!d&&(0,Q.jsxs)(`div`,{"aria-hidden":!0,className:`flex h-7 items-center pl-5.5`,children:[(0,Q.jsx)(`span`,{className:`bg-border-strong h-full w-px`}),(0,Q.jsx)(F,{as:`span`,variant:`meta`,tone:`muted`,className:`ml-2`,children:`no`})]})]},c.id)}),!d&&(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3`,children:[y<0&&(0,Q.jsx)(st,{children:w}),a&&(0,Q.jsx)(x,{variant:`ghost`,size:`sm`,icon:(0,Q.jsx)(Ye,{}),onClick:p,children:`Add rule`})]})]}),l]})]})}function lt(e){return e?.match(/was skipped: (.+?)\.?$/)?.[1]??e??`its target couldn’t take the card`}function ut({skips:e}){let{count:t,latest:n}=e;return(0,Q.jsxs)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`mt-1 ml-3 flex flex-wrap items-center gap-x-1.5 gap-y-1`,children:[(0,Q.jsx)($e,{className:`text-warning-indicator size-icon-xs shrink-0`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[`Skipped `,t===1?`once`:`${t} times`,` in the last 30 days: `,lt(n.reason),`.`]}),n.url?(0,Q.jsxs)(`a`,{href:n.url,target:`_blank`,rel:`noreferrer`,className:`underline`,children:[`Latest: `,n.title]}):(0,Q.jsxs)(`span`,{children:[`Latest: `,n.title]})]})}var dt=`flex flex-col gap-8`;function ft({section:e,intakeChain:t,children:n}){return(0,Q.jsxs)(`section`,{"aria-label":e.title,className:`flex flex-col gap-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(Te,{children:e.title}),e.events.some(K)?t:(0,Q.jsx)(Ee,{children:`Only cards already on this board; other boards never see them.`})]}),n]})}function pt({event:e}){return(0,Q.jsxs)(`div`,{className:at,children:[(0,Q.jsx)(ot,{event:e}),(0,Q.jsx)(st,{children:(0,Q.jsx)(M,{line:`text-caption`,className:`w-56 motion-reduce:before:animate-none`})})]})}function mt(){return(0,Q.jsx)(`div`,{role:`status`,"aria-label":`Loading rules`,children:(0,Q.jsx)(`div`,{"aria-hidden":!0,className:dt,children:ge.map(e=>(0,Q.jsx)(ft,{section:e,intakeChain:(0,Q.jsx)(M,{line:`text-caption leading-6 ps-2`,className:`w-96 max-w-full motion-reduce:before:animate-none`}),children:e.events.map(e=>(0,Q.jsx)(pt,{event:e},e))},e.title))})})}function ht({factoryId:e,rules:t,board:n,boards:r}){return(0,Q.jsxs)(`section`,{"aria-label":`From other boards`,className:`border-border mt-3 flex flex-col gap-1.5 border-t pt-3`,children:[(0,Q.jsxs)(F,{as:`h4`,variant:`meta`,tone:`muted`,className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(qe,{className:`size-icon-xs shrink-0`,"aria-hidden":!0}),`From other boards`]}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:t.map(t=>{let i=r.find(e=>e.id===t.target.boardKey);return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(_,{to:k(e,t.target.boardKey),"aria-label":`${t.name}, on ${i?o(i):t.target.boardKey}`,className:P(`group flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3`,!t.enabled&&`opacity-50`),children:[(0,Q.jsxs)(`span`,{className:`border-border group-hover:border-border-hover flex w-full min-w-0 flex-col gap-1 rounded-lg border border-dashed px-3 py-2 sm:flex-1`,children:[(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`ink`,className:`truncate font-medium`,children:i?o(i):`${t.target.boardKey} (not installed)`}),(0,Q.jsx)(et,{when:t.when,options:a(i),everything:`Every card`})]}),(0,Q.jsxs)(`span`,{className:`flex min-w-0 shrink-0 items-center`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`border-border-strong h-0 w-8 shrink-0 border-t border-dashed`}),(0,Q.jsx)(Ne,{"aria-hidden":!0,className:`text-muted-foreground size-icon-sm mr-2 -ml-1.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`flex w-44 shrink-0 items-center px-3 py-2`,children:(0,Q.jsx)(rt,{boards:r,ownBoard:n.id,boardKey:n.id,phaseKey:t.target.phaseKey})})]}),!t.enabled&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,children:`Off`})]})},t.id)})})]})}function gt({factoryId:e,boardKey:t,order:n,evaluator:r}){let i=n.some(e=>e.boardKey===t);return(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[r===`route-list`?(0,Q.jsx)(F,{as:`p`,variant:`caption`,tone:`muted`,children:`Intake still files new issues and pull requests by the old route list, not by board.`}):i?(0,Q.jsxs)(`ol`,{"aria-label":`Intake order`,className:`flex flex-wrap items-center gap-1`,children:[n.map(n=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsx)(`li`,{children:n.boardKey===t?(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`ink`,"aria-current":`step`,className:`bg-surface3 rounded-md px-2 py-0.5 font-medium`,children:n.name}):(0,Q.jsx)(_,{to:k(e,n.boardKey),className:`text-muted-foreground hover:text-foreground rounded-md px-2 py-0.5`,children:(0,Q.jsx)(F,{as:`span`,variant:`caption`,children:n.name})})}),(0,Q.jsx)(Le,{"aria-hidden":!0,className:`text-muted-foreground size-icon-xs shrink-0`})]},n.boardKey)),(0,Q.jsx)(`li`,{children:(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`px-2 py-0.5`,children:`Not routed`})})]}):(0,Q.jsx)(F,{as:`p`,variant:`caption`,tone:`muted`,children:`Not in the intake order: new issues and pull requests never reach these rules.`}),(0,Q.jsxs)(_,{to:O(e,t,A),className:`text-muted-foreground hover:text-foreground flex items-center gap-1.5`,children:[(0,Q.jsx)(Ge,{className:`size-icon-xs shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(F,{as:`span`,variant:`caption`,className:`underline decoration-dotted underline-offset-2`,children:`Reorder`})]})]})}var _t=`flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors`,vt=`border-border-focus bg-fill-hover`,yt=`border-border bg-fill-subtle hover:border-border-hover hover:bg-fill-hover`;function bt({selected:e,disabled:t,onClick:n,children:r}){return(0,Q.jsx)(`button`,{type:`button`,role:`checkbox`,"aria-checked":e,disabled:t,onClick:n,className:P(_t,`disabled:opacity-50`,e?vt:yt),children:r})}function xt({value:e,selected:t,disabled:n,onClick:r,children:i}){let a=(0,Z.useId)();return(0,Q.jsxs)(`label`,{onClick:r,className:P(_t,`has-[[role=radio]:focus-visible]:outline-border-focus has-[[role=radio]:focus-visible]:outline-1 has-[[role=radio]:focus-visible]:outline-solid`,t?vt:yt,n?`cursor-not-allowed opacity-50`:`cursor-pointer`),children:[(0,Q.jsx)(Oe,{value:e,disabled:n,"aria-labelledby":a,className:`sr-only`}),(0,Q.jsx)(`span`,{id:a,className:`flex min-w-0 items-start gap-3`,children:i})]})}var St=120,Ct=ce(W),$=[{id:`trigger`,title:`Trigger`,question:`What should this rule listen for?`},{id:`conditions`,title:`Only if`,question:`Which items should it apply to?`},{id:`action`,title:`Move to`,question:`Where should it go?`},{id:`review`,title:`Review`,question:`Name and check your rule`}];function wt(e,t){let n=e?.phases??[];return t?n.filter(e=>e.kind!==`terminal`):n}function Tt(e,t){if(t){let e=Ct.safeParse(t);if(!e.success)return e.error.issues[0]?.message}return se(e,t)??void 0}function Et(e,t,n){let r=`When ${e.map(e=>Y(e).label.toLowerCase()).join(` or `)}${t?`, ${ye(t).charAt(0).toLowerCase()}${ye(t).slice(1)}`:``}, move to ${n}`;return r.length>St?`${r.slice(0,119)}…`:r}function Dt({factoryId:e,board:t,boards:n,initial:r,initialEvent:i,initialStep:s,readOnly:c,saving:l,error:d,onSave:f,onClose:p}){let m=Ae(e),[_,C]=(0,Z.useState)(()=>r?.on??(i?[i]:[])),[w,T]=(0,Z.useState)(()=>r?.when??null),[E,D]=(0,Z.useState)(()=>(r?.when?.conditions.length??0)>0),[O,k]=(0,Z.useState)(!1),[A,j]=(0,Z.useState)(()=>r?.target.moveToBoardKey??t.id),[M,N]=(0,Z.useState)(()=>r?r.target.phaseKey??void 0:void 0),[te,ne]=(0,Z.useState)(()=>r?.name),[I,L]=(0,Z.useState)(s),[re,ie]=(0,Z.useState)(0),R=he(_),z=n.find(e=>e.id===A),ae=wt(z,R),B=ae.find(e=>e.id===(M??z?.initialPhase)),V=E?w:null,se=_.length?Tt(_,V):void 0,ce=B&&z?`${o(z)} › ${u(z,B.id)}`:``,H=te??(B?Et(_,V,ce):``),U={trigger:_.length>0,conditions:_.length>0&&!(E&&O)&&!se,action:B!==void 0,review:H.trim().length>0},W=!c&&U.trigger&&U.conditions&&U.action&&U.review,G=$.findIndex(e=>e.id===I),ue=$[G]??$[0],de=e=>{C(e),he(e)&&A!==t.id&&(j(t.id),N(void 0))},K=()=>{W&&B&&f({name:H.trim(),on:_,when:V,target:{phaseKey:B.id,moveToBoardKey:A===t.id?null:A}})},fe=()=>{let e={field:`pullRequest.trusted`,operator:`equals`,value:!0};T(V===null?{operator:`AND`,conditions:[e]}:V.operator===`AND`?{...V,conditions:[...V.conditions,e]}:{operator:`AND`,conditions:[V,e]}),D(!0),k(!1),ie(e=>e+1)},q={trigger:_.length?_.map(e=>Y(e).label).join(`, `):void 0,conditions:_.length?ye(V,a(t)):void 0,action:B?(0,Q.jsx)(rt,{boards:n,ownBoard:t.id,boardKey:A,phaseKey:B.id}):void 0,review:void 0};return(0,Q.jsx)(g,{open:!0,onOpenChange:e=>!e&&p(),children:(0,Q.jsxs)(b,{size:`xl`,children:[(0,Q.jsx)(ee,{children:(0,Q.jsx)(h,{children:c?`Rule`:r?`Edit rule`:`Add rule`})}),(0,Q.jsx)(v,{children:(0,Q.jsxs)(`div`,{className:`grid min-h-105 grid-cols-1 gap-6 sm:grid-cols-[12rem_1fr]`,children:[(0,Q.jsx)(`nav`,{"aria-label":`Rule steps`,className:`sm:border-border flex gap-1 overflow-x-auto sm:flex-col sm:border-r sm:pr-4`,children:$.map((e,t)=>{let n=t===0||$.slice(0,t).every(e=>U[e.id]),r=U[e.id]&&e.id!==`review`;return(0,Q.jsxs)(`button`,{type:`button`,disabled:!n,"aria-current":I===e.id?`step`:void 0,onClick:()=>L(e.id),className:P(`flex shrink-0 items-start gap-2.5 rounded-lg px-2 py-2 text-left transition-colors disabled:opacity-40`,I===e.id?`bg-fill-hover`:`hover:bg-fill-subtle`),children:[(0,Q.jsx)(F,{as:`span`,variant:`meta`,className:P(`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full border`,r?`border-transparent bg-fill-inverse text-background`:`border-border-strong`),children:r?(0,Q.jsx)(Fe,{className:`size-icon-xs`,"aria-hidden":!0}):t+1}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(F,{as:`span`,variant:`label`,tone:`ink`,className:`block`,children:e.title}),q[e.id]&&(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`hidden truncate sm:block`,children:q[e.id]})]})]},e.id)})}),(0,Q.jsxs)(`section`,{"aria-label":ue.title,className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsx)(F,{as:`h3`,variant:`heading`,children:ue.question}),I===`trigger`&&(0,Q.jsx)(At,{value:_,disabled:c,onChange:de}),I===`conditions`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(ke,{"aria-label":`Which ones`,value:E?`matching`:`every`,disabled:c,onValueChange:e=>{D(e===`matching`),k(!1)},className:`grid-cols-1 sm:grid-cols-2`,children:[(0,Q.jsx)(xt,{value:`every`,selected:!E,disabled:c,children:(0,Q.jsx)(Ot,{title:R?`Every new one`:`Every card`,hint:`Run whenever this happens.`})}),(0,Q.jsx)(xt,{value:`matching`,selected:E,disabled:c,children:(0,Q.jsx)(Ot,{title:`Only ones that match`,hint:`Narrow it down by repository, label, author and more.`})})]}),E&&(0,Q.jsx)(`div`,{className:`border-border bg-fill-subtle rounded-xl border p-3`,children:(0,Q.jsx)(je,{label:`Conditions`,rule:w,facts:le(_),options:{...a(t),"source.repository":m},onChange:(e,t)=>{T(e),k(t)}},re)}),se&&(0,Q.jsx)(S,{variant:`warning`,children:se}),!r?.outsiderPullRequestsGated&&oe(_,V)&&(0,Q.jsx)(S,{variant:`info`,children:(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,Q.jsx)(`span`,{children:`Also matches pull requests from outside authors.`}),!c&&(0,Q.jsx)(`button`,{type:`button`,onClick:fe,className:`shrink-0 underline`,children:`Add: Pull request trusted is yes`})]})})]}),I===`action`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[R?(0,Q.jsx)(F,{as:`p`,variant:`caption`,tone:`muted`,children:`An item with no card yet can only be filed on this board.`}):(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(F,{as:`span`,variant:`eyebrow`,tone:`muted`,children:`Board`}),(0,Q.jsx)(ke,{"aria-label":`Board`,value:A,disabled:c,onValueChange:e=>{typeof e==`string`&&e!==A&&(j(e),N(void 0))},className:`grid-cols-1 sm:grid-cols-3`,children:n.map(e=>(0,Q.jsx)(xt,{value:e.id,selected:e.id===A,disabled:c,children:(0,Q.jsxs)(F,{as:`span`,variant:`label`,tone:`ink`,children:[o(e),e.id===t.id?` (this board)`:``]})},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(F,{as:`span`,variant:`eyebrow`,tone:`muted`,children:`Phase`}),(0,Q.jsx)(ke,{"aria-label":`Phase`,value:B?.id??null,disabled:c,onValueChange:e=>typeof e==`string`&&N(e),className:`grid-cols-1 sm:grid-cols-2`,children:z&&ae.map(e=>(0,Q.jsx)(xt,{value:e.id,selected:e.id===B?.id,disabled:c,onClick:()=>{N(e.id),L(`review`)},children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(we,{stage:e.id,kind:Ce(z.id,e.kind),decorative:!0}),(0,Q.jsx)(F,{as:`span`,variant:`label`,tone:`ink`,children:u(z,e.id)})]})},e.id))})]})]}),I===`review`&&(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(F,{as:`span`,variant:`label`,tone:`muted`,children:`Name`}),(0,Q.jsx)(De,{value:H,maxLength:St,disabled:c,onChange:e=>ne(e.target.value)})]}),(0,Q.jsxs)(`div`,{className:`border-border bg-fill-subtle rounded-xl border p-4`,children:[(0,Q.jsx)(F,{as:`span`,variant:`eyebrow`,tone:`muted`,className:`mb-3 block`,children:`This rule reads as`}),(0,Q.jsxs)(`ol`,{className:`flex flex-col gap-3`,children:[(0,Q.jsx)(kt,{label:`When`,children:q.trigger}),(0,Q.jsx)(kt,{label:`Only if`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Q.jsx)(Ve,{className:`text-muted-foreground size-icon-sm`,"aria-hidden":!0}),q.conditions]})}),(0,Q.jsx)(kt,{label:`Then`,children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[`Move to `,(0,Q.jsx)(Ne,{className:`size-icon-sm`,"aria-hidden":!0}),` `,q.action]})})]})]})]}),d&&(0,Q.jsx)(S,{variant:`destructive`,role:`alert`,children:d})]})]})}),(0,Q.jsxs)(y,{children:[(0,Q.jsx)(x,{variant:`ghost`,onClick:p,children:c?`Close`:`Cancel`}),(0,Q.jsx)(`div`,{className:`flex-1`}),G>0&&(0,Q.jsx)(x,{variant:`default`,onClick:()=>L($[G-1].id),children:`Back`}),!c&&(I===`review`||r&&W?(0,Q.jsx)(x,{variant:`primary`,disabled:!W,onClick:K,loading:l,children:r?`Save rule`:`Create rule`}):(0,Q.jsx)(x,{variant:`primary`,disabled:!U[I],onClick:()=>L($[G+1]?.id??`review`),children:`Continue`}))]})]})})}function Ot({title:e,hint:t}){return(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(F,{as:`span`,variant:`label`,tone:`ink`,className:`block`,children:e}),(0,Q.jsx)(F,{as:`span`,variant:`caption`,tone:`muted`,className:`block`,children:t})]})}function kt({label:e,children:t}){return(0,Q.jsxs)(`li`,{className:`grid grid-cols-[4.5rem_1fr] items-start gap-3`,children:[(0,Q.jsx)(F,{as:`span`,variant:`body-sm`,tone:`muted`,children:e}),(0,Q.jsx)(F,{as:`span`,variant:`body-sm`,children:t})]})}function At({value:e,disabled:t,onChange:n}){return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[e.includes(`work_item.created`)&&(0,Q.jsxs)(S,{variant:`info`,children:[`Also listens on “`,Y(`work_item.created`).label,`”, which takes new issues and pull requests. Saving keeps it.`]}),ge.map(r=>(0,Q.jsxs)(`div`,{role:`group`,"aria-label":r.title,className:`flex flex-col gap-2`,children:[(0,Q.jsx)(F,{as:`span`,variant:`eyebrow`,tone:`muted`,children:r.title}),(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-2`,children:r.events.map(r=>{let i=Y(r),a=i.icon,o=e.includes(r);return(0,Q.jsxs)(bt,{selected:o,disabled:t||o&&e.length===1,onClick:()=>n(o?e.filter(e=>e!==r):[...e,r]),children:[(0,Q.jsx)(a,{className:`text-badge-amber-indicator mt-0.5 size-4 shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(Ot,{title:i.label,hint:i.description}),i.githubOnly&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,Q.jsx)(nt,{})})]},r)})})]},r.title))]})}function jt({count:e,into:t,leaving:n,showAll:r}){let i=n?`sending cards to ${t}`:`moving cards into ${t}`;return(0,Q.jsxs)(`div`,{className:`border-border flex items-center gap-2 rounded-lg border px-3 py-2`,children:[(0,Q.jsx)(Ue,{className:`size-icon-md text-muted-foreground shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(F,{as:`p`,variant:`body-sm`,tone:e===void 0?`muted`:`ink`,className:`flex-1`,children:e===void 0?`Couldn’t pick out the rules ${i}, so every rule is shown.`:e===0?`No rule is ${i}.`:`Only the ${e===1?`rule`:`${e} rules`} ${i}.`}),(0,Q.jsx)(x,{size:`sm`,variant:`ghost`,render:(0,Q.jsx)(_,{to:r}),children:`Show all`})]})}var Mt=new Set([`revision_mismatch`,`intake_route_set_mismatch`,`intake_route_not_found`]);function Nt(e){return e instanceof T&&e.code!==void 0&&Mt.has(e.code)}function Pt(e){return Nt(e)?`Someone else changed these rules first. They have been reloaded; try again.`:e instanceof Error?e.message:`The change didn’t save.`}function Ft({factoryId:e,boardId:t}){let n=ne(e),r=n.data?.find(e=>e.id===t);return n.isPending?(0,Q.jsx)(mt,{}):n.isError?(0,Q.jsx)(S,{variant:`destructive`,children:`Boards didn’t load.`}):r?(0,Q.jsx)(It,{factoryId:e,board:r,boards:n.data},`${e}:${r.id}`):(0,Q.jsx)(S,{variant:`warning`,children:`This board isn’t installed.`})}function It({factoryId:e,board:t,boards:r}){let o=U(e,t.id),s=H(e),c=R(e),l=z(e),d=V(e),[f,p]=(0,Z.useState)(),h=(0,Z.useRef)(void 0),g=e=>{h.current=e,p(e)},[_,v]=(0,Z.useState)(),y=o.data?.intakeRoutes??[],b=o.data?.canEdit??!1,ee=a(t),x=(s.data?.intakeRoutes??[]).filter(e=>e.target.moveToBoardKey===t.id&&e.target.boardKey!==t.id),C=new Map(l.data?.skipped.map(e=>[e.routeId,e])),[w]=m(),T=w.get(`into`)??void 0,E=w.has(D),O=E||T!==void 0,A=O&&s.data?i(s.data.intakeRoutes,{key:t.id,initialPhase:t.initialPhase}):void 0,M=A&&new Set((E?A.leaving:A.into.get(T??``)??[]).map(e=>e.id)),N=e=>!M||e.some(e=>M.has(e.id));if(o.isPending||O&&s.isPending)return(0,Q.jsx)(mt,{});if(o.isError)return(0,Q.jsx)(S,{variant:`destructive`,children:`This board’s rules didn’t load.`});let P=e=>d.mutateAsync(e).catch(e=>j.error(Pt(e))),te=(e,r,i)=>{let a=J(y,e).map(e=>e.id);P([{kind:`reorder`,boardKey:t.id,ids:n(y,a,r,i)}])},F=e=>{v(void 0),g(e)},ne=async e=>{let n=h.current,r=n?.rule,i=()=>n!==void 0&&h.current===n;v(void 0);try{if(r)await d.mutateAsync([{kind:`update`,id:r.id,patch:{name:e.name,on:e.on,when:e.when,target:{boardKey:r.target.boardKey,...e.target,joinClosedIssue:r.target.joinClosedIssue},expectedRevision:r.revision}}]);else{let[n]=await d.mutateAsync([{kind:`create`,route:{...e,target:{boardKey:t.id,...e.target}}}]);i()&&g(void 0),n&&await L(n,e.on).catch(e=>j.error(Pt(e)));return}i()&&g(void 0)}catch(e){if(!i())return;if(r&&Nt(e))return I(r);v(Pt(e))}},I=async e=>{let t=h.current,n=(await o.refetch()).data?.intakeRoutes.find(t=>t.id===e.id);t&&h.current===t&&(n?(g({...t,rule:n}),v(`Someone else changed this rule first. It now shows their version; make your change again.`)):(g(void 0),j.error(`Someone else deleted this rule first.`)))},L=async(e,r)=>{if(e.target.boardKey!==t.id)return;let i=(await o.refetch()).data?.intakeRoutes??[],a=i.map(e=>e.id),s=a.indexOf(e.id),c=r.flatMap(t=>{let n=J(i,t),r=n[pe(n,t,n.findIndex(t=>t.id===e.id))];return r?[a.indexOf(r.id)]:[]}),l=Math.min(...c);s<0||!(l<s)||await d.mutateAsync([{kind:`reorder`,boardKey:t.id,ids:n(i,a,s,l)}])},re=c.data?.evaluator===`route-list`?`Otherwise: the old route list decides`:me(c.data?.boards,t.id);return(0,Q.jsxs)(`div`,{className:dt,children:[s.isError&&(0,Q.jsx)(S,{variant:`warning`,children:`Rules on other boards that move cards here didn’t load, so they aren’t shown.`}),O&&(0,Q.jsx)(jt,{count:M?.size,into:E||!T?`other boards`:u(t,T)??T,leaving:E,showAll:k(e,t.id)}),ge.filter(e=>e.events.some(e=>N([...J(y,e),...J(x,e)]))).map(n=>(0,Q.jsx)(ft,{section:n,intakeChain:c.data&&(0,Q.jsx)(gt,{factoryId:e,boardKey:t.id,order:c.data.boards,evaluator:c.data.evaluator}),children:n.events.map(n=>{let i=K(n),a=J(y,n),o=J(x,n).filter(e=>!M||M.has(e.id));return N([...a,...o])?(0,Q.jsx)(ct,{event:n,rules:a,board:t,boards:r,phaseOptions:ee,canEdit:b,skips:C,footer:i?re:void 0,only:M,incoming:o.length?(0,Q.jsx)(ht,{factoryId:e,rules:o,board:t,boards:r}):void 0,onEdit:(e,t)=>F({rule:e,step:t}),onAdd:()=>F({event:n,step:`conditions`}),onMove:(e,t)=>te(n,e,t),onToggle:(e,t)=>void P([{kind:`update`,id:e.id,patch:{enabled:t,expectedRevision:e.revision}}]),onDelete:e=>void P([{kind:`delete`,id:e.id,expectedRevision:e.revision}]).then(t=>t&&j.success(`Deleted “${e.name}”`)),onUngate:e=>void P([{kind:`update`,id:e.id,patch:{outsiderPullRequestsGated:!1,expectedRevision:e.revision}}]).then(t=>t&&j.success(`“${e.name}” now matches outside authors’ pull requests`))},n):null})},n.title)),f&&(0,Q.jsx)(Dt,{factoryId:e,board:t,boards:r,initial:f.rule,initialEvent:f.event,initialStep:f.step,readOnly:!b,saving:d.isPending,error:_,onSave:e=>void ne(e),onClose:()=>g(void 0)},f.rule?`${f.rule.id}:${f.rule.revision}`:`new-${f.event}`)]})}function Lt(){let e=t(),n=r()?.boardId??``,{isMobile:i,desktopState:a}=p(),o=i||a===`collapsed`,u=w(e.id,n).data?.board,m=c({breadcrumbs:o&&u?(0,Q.jsxs)(f,{label:`Breadcrumb`,className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(d,{as:_,to:E(e.id,n),children:u.name}),(0,Q.jsx)(d,{as:`span`,isCurrent:!0,children:`Rules`})]}):void 0});return(0,Q.jsx)(s,{variant:`settings`,header:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(l,{children:[(0,Q.jsx)(l.Title,{children:`Rules`}),(0,Q.jsx)(l.Description,{children:`What happens to issues and pull requests on this board. In each lane the first matching rule wins.`})]}),(0,Q.jsx)(`div`,{className:`mt-3`,children:(0,Q.jsx)(ie,{factoryProjectId:e.id,label:`Test an issue or pull request`})})]}),...m,children:(0,Q.jsx)(Ft,{factoryId:e.id,boardId:n})})}export{Lt as BoardRulesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Di as t,in as n,rn as r,xi as i}from"./GithubIcon.es-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{Di as t,in as n,rn as r,xi as i}from"./GithubIcon.es-B7Jlpkjd.js";import{O as a,T as o,k as s,o as c}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{cn as l}from"./useSessionRows-CK_XCZpc.js";import{t as u}from"./popup-anchor.es-g9MI9mVW.js";var d=e(s(),1),f=a(),p=e=>(0,f.jsx)(`svg`,{width:`19.125`,height:`18`,viewBox:`-1.0625 -1 19.125 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:(0,f.jsx)(`path`,{d:`M5.25684 12.6387L10.4003 3.36133H11.7432L6.5997 12.6387H5.25684Z`,fill:`currentColor`})}),m=({children:e,label:t,className:n,listClassName:r})=>(0,f.jsx)(`nav`,{"aria-label":t,className:n,children:(0,f.jsx)(`ol`,{className:o(`flex items-center gap-0.5`,r),children:e})}),h=e=>(0,f.jsx)(l,{className:`h-3 w-24`,...e}),g=({className:e,as:a,to:s,href:l,isCurrent:m,action:g,switcher:_,icon:v,isLoading:y,children:b,...x})=>{let S=a||`span`,C=!(!_||!m&&(s||l)),w=d.useRef(null);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsxs)(`li`,{ref:w,className:o(`group flex h-control-sm min-w-0 items-center`,m?`shrink`:`shrink-0`,C&&`relative rounded-full has-[[data-slot=crumb-switcher]_[data-popup-open]]:bg-fill-subtle has-[[data-slot=crumb-switcher]_button:enabled]:hover:bg-fill-subtle has-[[data-slot=crumb-switcher]_button:enabled]:active:bg-fill`),children:[(0,f.jsxs)(S,{"aria-current":m?`page`:void 0,className:o(`inline-flex min-w-0 items-center gap-2 overflow-hidden rounded-full px-[.9em]`,i.sm,c,m?`max-w-xs cursor-default text-foreground`:C?o(n,`max-w-48`):o(r,`max-w-48 cursor-pointer hover:bg-fill-subtle active:bg-fill`),e),to:s,href:l,...x,children:[v&&(0,f.jsx)(t,{className:o(`ml-[-.3em] shrink-0 opacity-50 group-hover:opacity-100`,`transition-opacity duration-normal ease-out-custom`),children:v}),y?(0,f.jsx)(h,{}):(0,f.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:b})]}),_&&(0,f.jsx)(`span`,{"data-slot":`crumb-switcher`,className:o(`-ml-1 flex h-control-sm shrink-0 items-center`,C&&`[&_button]:bg-transparent! [&_button:enabled]:after:absolute [&_button:enabled]:after:inset-0 [&_button:enabled]:after:rounded-full`),children:(0,f.jsx)(u,{value:w,children:_})}),g&&(0,f.jsx)(`span`,{className:`-ml-1 flex h-control-sm shrink-0 items-center`,children:g})]}),!m&&(0,f.jsx)(`li`,{role:`separator`,className:`flex h-full items-center`,children:(0,f.jsx)(t,{className:`text-subtle-foreground`,children:(0,f.jsx)(p,{})})})]})};export{g as n,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,b as n,k as r,m as i,x as a,y as o}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{Ct as s,Ht as c}from"./useSessionRows-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{O as t,b as n,k as r,m as i,x as a,y as o}from"./IconChevronRightMedium.es-BkPdzxSm.js";import{Ct as s,Ht as c}from"./useSessionRows-CK_XCZpc.js";import{An as l,Ba as u,Cs as d,Fn as f,Ga as p,Li as m,Ln as h,Mn as g,Nn as _,Ra as v,Rn as y,Va as b,Wa as x,ai as S,eo as C,es as w,jn as T,kn as E}from"./GithubIcon.es-B7Jlpkjd.js";var D=e(r(),1),O=`data-composite-item-active`;function k(e){let{loopFocus:t=!0,orientation:r=`both`,grid:i,onLoop:a,direction:s,highlightedIndex:f,onHighlightedIndexChange:m,rootRef:S,enableHomeAndEndKeys:O=!1,stopEventPropagation:k,disabledIndices:M,modifierKeys:N=n}=e,[P,F]=D.useState(0),I=i!=null,L=D.useRef(null),R=o(L,S),z=D.useRef([]),B=D.useRef(!1),V=D.useRef(null),H=f??P,U=C((e,t=!1)=>{if(V.current=z.current[e]??null,(m??F)(e),t){let t=z.current[e];y(L.current,t,s,r)}}),W=C(e=>{if(e.size===0)return;if(B.current){let e=z.current,t=e.indexOf(V.current);if(t===-1){let t=e[H];!t||p(e,H,M)?U(A(e,M)):V.current=t}else t!==H&&U(t);return}B.current=!0;let t=Array.from(e.keys()),n=t.find(e=>e?.hasAttribute(`data-composite-item-active`))??null,i=n?e.get(n)?.index??-1:-1;if(i!==-1)U(i);else if(p(t,H,M)){let e=v(t,{disabledIndices:M});x(t,e)||U(e)}y(L.current,n,s,r)});d(()=>{if(M==null||f!=null||!B.current)return;let e=z.current;if(p(e,H,M)){let t=v(e,{disabledIndices:M});x(e,t)||U(t)}},[M,f,H,z,U]);let G=C((e,t,n)=>a?a(e,t,n,z):n),K=C(e=>{let n=e.key===`Home`||e.key===`End`;if(!_.has(e.key)||!O&&n||j(e,N)||!L.current)return;let o=s===`rtl`,d=o?l:T,f=o?T:l,p=r===`vertical`?E:d,m=r===`vertical`?g:f,y=w(e.nativeEvent);if(y!=null&&h(y)&&!c(y)){let t=y.selectionStart,n=y.selectionEnd,r=y.value;if(t==null||e.shiftKey||t!==n||e.key!==m&&t<r.length||e.key!==p&&t>0)return}let S=H,C=b(z,M),D=u(z,M);i!=null&&(S=i({disabledIndices:M,elementsRef:z,event:e,highlightedIndex:H,loopFocus:t,maxIndex:D,minIndex:C,onLoop:G,orientation:r,rtl:o}));let A=r!==`vertical`&&e.key===d||r!==`horizontal`&&e.key===`ArrowDown`,P=r!==`vertical`&&e.key===f||r!==`horizontal`&&e.key===`ArrowUp`;O&&(e.key===`Home`?S=C:e.key===`End`&&(S=D)),S===H&&(A||P)&&(t&&S===D&&A?(S=C,a&&(S=a(e,H,S,z))):t&&S===C&&P?(S=D,a&&(S=a(e,H,S,z))):S=v(z.current,{startingIndex:S,decrement:P,disabledIndices:M})),S!==H&&!x(z.current,S)&&(k&&e.stopPropagation(),(I||n||A||P)&&e.preventDefault(),U(S,!0),queueMicrotask(()=>{z.current[S]?.focus()}))});return{props:{ref:R,onFocus(e){let t=L.current,n=w(e.nativeEvent);t&&n!=null&&h(n)&&n.setSelectionRange(0,n.value.length)},onKeyDown:K},highlightedIndex:H,onHighlightedIndexChange:U,elementsRef:z,onMapChange:W,relayKeyboardEvent:K}}function A(e,t){let n=-1;for(let r=0;r<e.length;r+=1){let i=e[r];if(i&&!p(e,r,t)){if(i.hasAttribute(`data-composite-item-active`))return r;n===-1&&(n=r)}}return Math.max(n,0)}function j(e,t){for(let n of f)if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}var M=t();function N(e){let{render:t,className:r,style:o,refs:c=n,props:l=n,state:u=a,stateAttributesMapping:d,highlightedIndex:f,onHighlightedIndexChange:p,orientation:h,grid:g,loopFocus:_,onLoop:v,enableHomeAndEndKeys:y,onMapChange:b,stopEventPropagation:x=!0,rootRef:C,disabledIndices:w,modifierKeys:T,highlightItemOnHover:E=!1,tag:O=`div`,...A}=e,{props:j,highlightedIndex:N,onHighlightedIndexChange:P,elementsRef:F,onMapChange:I,relayKeyboardEvent:L}=k({grid:g,loopFocus:_,onLoop:v,orientation:h,highlightedIndex:f,onHighlightedIndexChange:p,rootRef:C,stopEventPropagation:x,enableHomeAndEndKeys:y,direction:m(),disabledIndices:w,modifierKeys:T}),R=i(O,e,{state:u,ref:c,props:[j,...l,A],stateAttributesMapping:d}),z=D.useMemo(()=>({highlightedIndex:N,onHighlightedIndexChange:P,highlightItemOnHover:E,relayKeyboardEvent:L}),[N,P,E,L]);return(0,M.jsx)(S.Provider,{value:z,children:(0,M.jsx)(s,{elementsRef:F,onMapChange:e=>{b?.(e),I(e)},children:R})})}export{O as n,N as t};
|