@spencerboucher/switchyard 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/bridge/switchyard-terminal.js +62 -1
- package/dist/switchyard.mjs +869 -643
- package/package.json +1 -1
- package/web-dist/assets/AutomationView-BIW_pO0M.js +2 -0
- package/web-dist/assets/AutomationView-BIW_pO0M.js.map +1 -0
- package/web-dist/assets/Badge-BiDp7NKI.js +2 -0
- package/web-dist/assets/Badge-BiDp7NKI.js.map +1 -0
- package/web-dist/assets/InteractionCard-CWxyDv81.js +6 -0
- package/web-dist/assets/InteractionCard-CWxyDv81.js.map +1 -0
- package/web-dist/assets/{Menu-GymfuHGP.js → Menu-BDt1bxwz.js} +2 -2
- package/web-dist/assets/{Menu-GymfuHGP.js.map → Menu-BDt1bxwz.js.map} +1 -1
- package/web-dist/assets/{SegmentedControl-ChdVilXb.js → SegmentedControl-D-2BCZzd.js} +2 -2
- package/web-dist/assets/{SegmentedControl-ChdVilXb.js.map → SegmentedControl-D-2BCZzd.js.map} +1 -1
- package/web-dist/assets/Tabs-ByiPklAw.js +184 -0
- package/web-dist/assets/Tabs-ByiPklAw.js.map +1 -0
- package/web-dist/assets/TextArea-BYr88SnV.js +2 -0
- package/web-dist/assets/TextArea-BYr88SnV.js.map +1 -0
- package/web-dist/assets/attention-Bya8XHKI.js +2 -0
- package/web-dist/assets/attention-Bya8XHKI.js.map +1 -0
- package/web-dist/assets/automations-DiXKRcnE.js +2 -0
- package/web-dist/assets/automations-DiXKRcnE.js.map +1 -0
- package/web-dist/assets/board-BrLaJwLJ.js +10 -0
- package/web-dist/assets/board-BrLaJwLJ.js.map +1 -0
- package/web-dist/assets/c-Cz4nF6n_.js +1 -0
- package/web-dist/assets/c-SSSlmE39.js +2 -0
- package/web-dist/assets/c-SSSlmE39.js.map +1 -0
- package/web-dist/assets/code-DKLO8bzz.js +11 -0
- package/web-dist/assets/code-DKLO8bzz.js.map +1 -0
- package/web-dist/assets/cpp-Cts1PyIS.js +2 -0
- package/web-dist/assets/cpp-Cts1PyIS.js.map +1 -0
- package/web-dist/assets/cpp-DzjeI0uH.js +1 -0
- package/web-dist/assets/css-BGIxQoYs.js +2 -0
- package/web-dist/assets/css-BGIxQoYs.js.map +1 -0
- package/web-dist/assets/css-DgaLhXQH.js +1 -0
- package/web-dist/assets/describe-DnvH6_fl.js +5 -0
- package/web-dist/assets/describe-DnvH6_fl.js.map +1 -0
- package/web-dist/assets/diff-woXpYk--.js +2 -0
- package/web-dist/assets/diff-woXpYk--.js.map +1 -0
- package/web-dist/assets/{dist-Bgkh2hc5.js → dist-BE_V9dwJ.js} +2 -2
- package/web-dist/assets/dist-BE_V9dwJ.js.map +1 -0
- package/web-dist/assets/dockerfile-IyjqRm3v.js +2 -0
- package/web-dist/assets/dockerfile-IyjqRm3v.js.map +1 -0
- package/web-dist/assets/enroll-DUDpbJoB.js +2 -0
- package/web-dist/assets/enroll-DUDpbJoB.js.map +1 -0
- package/web-dist/assets/github-dark-C-LZuMrd.js +2 -0
- package/web-dist/assets/github-dark-C-LZuMrd.js.map +1 -0
- package/web-dist/assets/github-light-EUqPIrTm.js +2 -0
- package/web-dist/assets/github-light-EUqPIrTm.js.map +1 -0
- package/web-dist/assets/go-rLFTqkRN.js +2 -0
- package/web-dist/assets/go-rLFTqkRN.js.map +1 -0
- package/web-dist/assets/html-BMn1ogTm.js +2 -0
- package/web-dist/assets/html-BMn1ogTm.js.map +1 -0
- package/web-dist/assets/html-BWDvXlHg.js +1 -0
- package/web-dist/assets/index-DvRcMGEe.css +2 -0
- package/web-dist/assets/index-vIzH1m8u.js +11 -0
- package/web-dist/assets/index-vIzH1m8u.js.map +1 -0
- package/web-dist/assets/java-BtIQNnN0.js +2 -0
- package/web-dist/assets/java-BtIQNnN0.js.map +1 -0
- package/web-dist/assets/java-_ATy9zCa.js +1 -0
- package/web-dist/assets/javascript-BzbQS41l.js +2 -0
- package/web-dist/assets/javascript-BzbQS41l.js.map +1 -0
- package/web-dist/assets/javascript-CpIGwZ_Y.js +1 -0
- package/web-dist/assets/json-qhed-kSA.js +2 -0
- package/web-dist/assets/json-qhed-kSA.js.map +1 -0
- package/web-dist/assets/jsonc-CYpm1nAK.js +2 -0
- package/web-dist/assets/jsonc-CYpm1nAK.js.map +1 -0
- package/web-dist/assets/jsx-C4yDKi0A.js +1 -0
- package/web-dist/assets/jsx-D3KKoC5L.js +2 -0
- package/web-dist/assets/jsx-D3KKoC5L.js.map +1 -0
- package/web-dist/assets/logic-xb-QF00E.js +2 -0
- package/web-dist/assets/logic-xb-QF00E.js.map +1 -0
- package/web-dist/assets/lua-DjuecEsk.js +2 -0
- package/web-dist/assets/lua-DjuecEsk.js.map +1 -0
- package/web-dist/assets/lua-fPRBWD-V.js +1 -0
- package/web-dist/assets/{more-CRGJsz6E.js → more-BP5x45cs.js} +2 -2
- package/web-dist/assets/{more-CRGJsz6E.js.map → more-BP5x45cs.js.map} +1 -1
- package/web-dist/assets/now--XjJC37b.js +2 -0
- package/web-dist/assets/now--XjJC37b.js.map +1 -0
- package/web-dist/assets/python-gzcpVVnB.js +2 -0
- package/web-dist/assets/python-gzcpVVnB.js.map +1 -0
- package/web-dist/assets/ruby-Bx-U2qjP.js +2 -0
- package/web-dist/assets/ruby-Bx-U2qjP.js.map +1 -0
- package/web-dist/assets/rust-DpiIf5JO.js +2 -0
- package/web-dist/assets/rust-DpiIf5JO.js.map +1 -0
- package/web-dist/assets/scss-8bKmll0B.js +2 -0
- package/web-dist/assets/scss-8bKmll0B.js.map +1 -0
- package/web-dist/assets/send-BKjswHxB.js +2 -0
- package/web-dist/assets/send-BKjswHxB.js.map +1 -0
- package/web-dist/assets/settings-D8T1esWq.js +7 -0
- package/web-dist/assets/settings-D8T1esWq.js.map +1 -0
- package/web-dist/assets/shared-CZ7fcu_B.js +3 -0
- package/web-dist/assets/shared-CZ7fcu_B.js.map +1 -0
- package/web-dist/assets/shellscript-CVTB3cr6.js +1 -0
- package/web-dist/assets/shellscript-CqHdAlCp.js +2 -0
- package/web-dist/assets/shellscript-CqHdAlCp.js.map +1 -0
- package/web-dist/assets/sliders-horizontal-DAoirila.js +2 -0
- package/web-dist/assets/sliders-horizontal-DAoirila.js.map +1 -0
- package/web-dist/assets/sql-CNu3Or2W.js +2 -0
- package/web-dist/assets/sql-CNu3Or2W.js.map +1 -0
- package/web-dist/assets/sql-CfM2IJm3.js +1 -0
- package/web-dist/assets/states--geW2Ntl.js +2 -0
- package/web-dist/assets/states--geW2Ntl.js.map +1 -0
- package/web-dist/assets/swift-CyEgAFGc.js +2 -0
- package/web-dist/assets/swift-CyEgAFGc.js.map +1 -0
- package/web-dist/assets/terminal-login-BJxV78au.js +2 -0
- package/web-dist/assets/terminal-login-BJxV78au.js.map +1 -0
- package/web-dist/assets/toml-CcmNWLt0.js +2 -0
- package/web-dist/assets/toml-CcmNWLt0.js.map +1 -0
- package/web-dist/assets/tsx-BOvsFOI6.js +2 -0
- package/web-dist/assets/tsx-BOvsFOI6.js.map +1 -0
- package/web-dist/assets/tsx-CGosfAUg.js +1 -0
- package/web-dist/assets/typescript-Bb1J8qyy.js +1 -0
- package/web-dist/assets/typescript-j_1H8WHN.js +2 -0
- package/web-dist/assets/typescript-j_1H8WHN.js.map +1 -0
- package/web-dist/assets/useNow-jxdoOC_1.js +2 -0
- package/web-dist/assets/{useNow-Bc_NlDY3.js.map → useNow-jxdoOC_1.js.map} +1 -1
- package/web-dist/assets/xml-DuKfbPI6.js +1 -0
- package/web-dist/assets/xml-WY0zc4PG.js +2 -0
- package/web-dist/assets/xml-WY0zc4PG.js.map +1 -0
- package/web-dist/assets/yaml-DDA_XMNu.js +1 -0
- package/web-dist/assets/yaml-DijMHRDA.js +2 -0
- package/web-dist/assets/yaml-DijMHRDA.js.map +1 -0
- package/web-dist/index.html +4 -3
- package/web-dist/sw.js +1 -1
- package/web-dist/sw.js.map +1 -1
- package/web-dist/assets/AutomationView-DgZn3ltn.js +0 -2
- package/web-dist/assets/AutomationView-DgZn3ltn.js.map +0 -1
- package/web-dist/assets/InteractionCard-cvPWKSu1.js +0 -4
- package/web-dist/assets/InteractionCard-cvPWKSu1.js.map +0 -1
- package/web-dist/assets/Markdown-jXkvZeRp.js +0 -31
- package/web-dist/assets/Markdown-jXkvZeRp.js.map +0 -1
- package/web-dist/assets/Overlay-oYnnwvFM.js +0 -2
- package/web-dist/assets/Overlay-oYnnwvFM.js.map +0 -1
- package/web-dist/assets/TextArea-BsQHOQMe.js +0 -2
- package/web-dist/assets/TextArea-BsQHOQMe.js.map +0 -1
- package/web-dist/assets/attention-Bxg9W15n.js +0 -2
- package/web-dist/assets/attention-Bxg9W15n.js.map +0 -1
- package/web-dist/assets/automations-DdB97dnL.js +0 -2
- package/web-dist/assets/automations-DdB97dnL.js.map +0 -1
- package/web-dist/assets/board-s4LuDPcg.js +0 -10
- package/web-dist/assets/board-s4LuDPcg.js.map +0 -1
- package/web-dist/assets/code-B0KXn7lD.js +0 -8
- package/web-dist/assets/code-B0KXn7lD.js.map +0 -1
- package/web-dist/assets/describe-C_3FJuSs.js +0 -5
- package/web-dist/assets/describe-C_3FJuSs.js.map +0 -1
- package/web-dist/assets/dist-Bgkh2hc5.js.map +0 -1
- package/web-dist/assets/enroll-DijmoolY.js +0 -2
- package/web-dist/assets/enroll-DijmoolY.js.map +0 -1
- package/web-dist/assets/index-C5n2QB-Y.css +0 -2
- package/web-dist/assets/index-Cf6ZUCfK.js +0 -11
- package/web-dist/assets/index-Cf6ZUCfK.js.map +0 -1
- package/web-dist/assets/logic-D_Eq9DMW.js +0 -2
- package/web-dist/assets/logic-D_Eq9DMW.js.map +0 -1
- package/web-dist/assets/now-D6lDofYy.js +0 -2
- package/web-dist/assets/now-D6lDofYy.js.map +0 -1
- package/web-dist/assets/settings-Csal1F-W.js +0 -8
- package/web-dist/assets/settings-Csal1F-W.js.map +0 -1
- package/web-dist/assets/sliders-horizontal-S3tmwxsP.js +0 -2
- package/web-dist/assets/sliders-horizontal-S3tmwxsP.js.map +0 -1
- package/web-dist/assets/states-DrTQuYXw.js +0 -2
- package/web-dist/assets/states-DrTQuYXw.js.map +0 -1
- package/web-dist/assets/useNow-Bc_NlDY3.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e,m as t,t as n}from"./jsx-runtime-D13aM9HY.js";import{i as r}from"./Badge-BiDp7NKI.js";import{h as i}from"./states--geW2Ntl.js";import{m as a}from"./index-vIzH1m8u.js";var o=r(),s=e(t(),1),c=n(),l=(0,s.forwardRef)(function({label:e,icon:t,variant:n=`ghost`,size:r=`md`,className:a,type:o,...s},l){return(0,c.jsx)(`button`,{ref:l,type:o??`button`,"aria-label":e,title:e,className:i(`tap inline-flex shrink-0 items-center justify-center rounded-md border transition-colors`,`disabled:opacity-55 disabled:pointer-events-none`,r===`sm`?`size-8`:`size-9`,n===`ghost`&&`border-transparent text-muted hover:bg-surface-2 hover:text-text`,n===`secondary`&&`border-border bg-surface text-text hover:bg-surface-2`,n===`danger`&&`border-transparent text-danger hover:bg-danger-soft`,a),...s,children:t})}),u=`a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex="-1"]), [contenteditable="true"]`;function d(e){return[...e.querySelectorAll(u)].filter(e=>!e.hasAttribute(`inert`)&&e.getClientRects().length>0)}function f(e,t,n,r){let i=(0,s.useRef)(n);i.current=n;let a=(0,s.useRef)(null),o=(0,s.useRef)(!1);t&&!o.current&&typeof document<`u`&&(a.current=document.activeElement),o.current=t,(0,s.useEffect)(()=>{if(!t)return;let n=e.current;if(!n)return;let o=a.current,s=o&&!n.contains(o)?o:document.activeElement,c=r?.current??d(n)[0]??n,l=requestAnimationFrame(()=>{(r?.current||!n.contains(document.activeElement))&&c.focus({preventScroll:!0})}),u=e=>{if(e.key===`Escape`&&i.current){e.stopPropagation(),i.current();return}if(e.key!==`Tab`)return;let t=d(n);if(t.length===0){e.preventDefault(),n.focus();return}let r=t[0],a=t[t.length-1],o=document.activeElement;e.shiftKey&&(o===r||!n.contains(o))?(e.preventDefault(),a.focus()):e.shiftKey||o!==a&&n.contains(o)||(e.preventDefault(),r.focus())};return n.addEventListener(`keydown`,u),()=>{cancelAnimationFrame(l),n.removeEventListener(`keydown`,u),s&&document.contains(s)&&s.focus({preventScroll:!0})}},[t,e,r])}function p(e){(0,s.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e])}function m({placement:e,open:t,onClose:n,title:r,description:u,children:d,footer:m,initialFocus:h,dismissOnBackdrop:g=!0,headerActions:_,className:v,style:y}){let b=(0,s.useRef)(null),x=(0,s.useId)(),S=(0,s.useId)();return f(b,t,n,h),p(t),t?(0,o.createPortal)((0,c.jsxs)(`div`,{className:i(`fixed inset-0 z-50 flex`,e===`right`&&`justify-end`,e===`bottom`&&`items-end`,e===`center`&&`items-center justify-center p-4`),children:[(0,c.jsx)(`div`,{className:`absolute inset-0 bg-overlay`,"aria-hidden":!0,onClick:g?n:void 0}),(0,c.jsxs)(`div`,{ref:b,role:`dialog`,"aria-modal":`true`,"aria-labelledby":x,"aria-describedby":u?S:void 0,tabIndex:-1,style:y,className:i(`relative flex flex-col bg-surface text-text shadow-pop outline-none`,e===`right`&&`h-full max-w-full border-l border-border safe-pt safe-pb`,e===`bottom`&&`max-h-[90dvh] w-full rounded-t-xl border-t border-border safe-pb`,e===`center`&&`max-h-[min(90dvh,720px)] w-full max-w-lg rounded-xl border border-border`,v),children:[e===`bottom`&&(0,c.jsx)(`div`,{className:`flex justify-center pt-2`,"aria-hidden":!0,children:(0,c.jsx)(`div`,{className:`h-1 w-10 rounded-full bg-border-strong`})}),(0,c.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-border px-4 py-3`,children:[(0,c.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,c.jsx)(`h2`,{id:x,className:`text-base font-semibold leading-6`,children:r}),u&&(0,c.jsx)(`p`,{id:S,className:`text-sm text-muted`,children:u})]}),_,(0,c.jsx)(l,{label:`Close`,icon:(0,c.jsx)(a,{className:`size-4`}),onClick:n})]}),(0,c.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-3`,children:d}),m&&(0,c.jsx)(`div`,{className:`flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3`,children:m})]})]}),document.body):null}function h({width:e=520,...t}){return(0,c.jsx)(m,{...t,placement:`right`,style:{width:`min(${e}px, 100vw)`}})}function g(e){return(0,c.jsx)(m,{...e,placement:`bottom`})}function _(e){return(0,c.jsx)(m,{...e,placement:`center`})}var v=(0,s.forwardRef)(function({maxHeight:e=`33vh`,minRows:t=1,className:n,value:r,style:a,...o},l){let u=(0,s.useRef)(null),d=(0,s.useCallback)(e=>{u.current=e,typeof l==`function`?l(e):l&&(l.current=e)},[l]);return(0,s.useLayoutEffect)(()=>{let e=u.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+(e.offsetHeight-e.clientHeight)}px`)},[r]),(0,c.jsx)(`textarea`,{ref:d,rows:t,value:r,style:{maxHeight:e,...a},className:i(`block w-full resize-none overflow-y-auto rounded-md border border-border bg-surface px-3 py-2 text-base text-text placeholder:text-subtle md:text-sm`,`focus:border-accent focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-0`,n),...o})}),y=(0,s.forwardRef)(function({className:e,...t},n){return(0,c.jsx)(`input`,{ref:n,className:i(`tap block h-9 w-full rounded-md border border-border bg-surface px-3 text-base text-text placeholder:text-subtle md:text-sm`,`focus:border-accent focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-0`,e),...t})});export{g as a,h as i,y as n,f as o,_ as r,l as s,v as t};
|
|
2
|
+
//# sourceMappingURL=TextArea-BYr88SnV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextArea-BYr88SnV.js","names":["forwardRef","useRef","useRef","useId","createPortal","forwardRef","useRef","useCallback","__toESM","require_react","require_jsx_runtime","require_react_dom","cn","X","import_react_dom","import_react","import_jsx_runtime","IconButton","rest","type","label","size","variant","className","icon","FOCUSABLE","focusableWithin","root","el","useFocusTrap","escRef","onEscape","triggerRef","wasActive","active","ref","captured","previous","target","initialFocus","raf","onKey","items","first","last","activeEl","useScrollLock","prev","Surface","titleId","descId","open","onClose","placement","dismissOnBackdrop","description","title","headerActions","footer","Drawer","props","width","Sheet","Dialog","TextArea","inner","setRef","value","minRows","style","TextInput"],"sources":["../../src/components/ui/IconButton.tsx","../../src/components/ui/useFocusTrap.ts","../../src/components/ui/Overlay.tsx","../../src/components/ui/TextArea.tsx"],"sourcesContent":["import { type ButtonHTMLAttributes, forwardRef, type ReactNode } from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface IconButtonProps\n extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, \"aria-label\"> {\n /** Accessible name (also the tooltip). Required: icon-only controls need a label. */\n label: string;\n icon: ReactNode;\n variant?: \"ghost\" | \"secondary\" | \"danger\";\n size?: \"sm\" | \"md\";\n}\n\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { label, icon, variant = \"ghost\", size = \"md\", className, type, ...rest },\n ref,\n) {\n return (\n <button\n ref={ref}\n type={type ?? \"button\"}\n aria-label={label}\n title={label}\n className={cn(\n \"tap inline-flex shrink-0 items-center justify-center rounded-md border transition-colors\",\n \"disabled:opacity-55 disabled:pointer-events-none\",\n size === \"sm\" ? \"size-8\" : \"size-9\",\n variant === \"ghost\" && \"border-transparent text-muted hover:bg-surface-2 hover:text-text\",\n variant === \"secondary\" && \"border-border bg-surface text-text hover:bg-surface-2\",\n variant === \"danger\" && \"border-transparent text-danger hover:bg-danger-soft\",\n className,\n )}\n {...rest}\n >\n {icon}\n </button>\n );\n});\n","import { type RefObject, useEffect, useRef } from \"react\";\n\nconst FOCUSABLE =\n 'a[href], area[href], button:not([disabled]), input:not([disabled]):not([type=\"hidden\"]), select:not([disabled]), textarea:not([disabled]), iframe, [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]';\n\nexport function focusableWithin(root: HTMLElement): HTMLElement[] {\n return [...root.querySelectorAll<HTMLElement>(FOCUSABLE)].filter(\n (el) => !el.hasAttribute(\"inert\") && el.getClientRects().length > 0,\n );\n}\n\n/**\n * Modal focus management: moves focus into `ref` when `active`, keeps Tab\n * inside it, closes on Escape, and returns focus to the element that had it\n * (the trigger) when deactivated.\n */\nexport function useFocusTrap(\n ref: RefObject<HTMLElement | null>,\n active: boolean,\n onEscape?: () => void,\n initialFocus?: RefObject<HTMLElement | null>,\n): void {\n const escRef = useRef(onEscape);\n escRef.current = onEscape;\n // Remember the trigger while rendering the opening frame: by the time effects run, an\n // `autoFocus` field inside the surface has already taken focus.\n const triggerRef = useRef<HTMLElement | null>(null);\n const wasActive = useRef(false);\n if (active && !wasActive.current && typeof document !== \"undefined\") {\n triggerRef.current = document.activeElement as HTMLElement | null;\n }\n wasActive.current = active;\n useEffect(() => {\n if (!active) return;\n const root = ref.current;\n if (!root) return;\n const captured = triggerRef.current;\n const previous =\n captured && !root.contains(captured)\n ? captured\n : (document.activeElement as HTMLElement | null);\n const target = initialFocus?.current ?? focusableWithin(root)[0] ?? root;\n // Defer so the element is laid out (portals, transitions).\n // An `autoFocus` field inside keeps its focus unless an explicit initial focus was given.\n const raf = requestAnimationFrame(() => {\n if (!initialFocus?.current && root.contains(document.activeElement)) return;\n target.focus({ preventScroll: true });\n });\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\" && escRef.current) {\n e.stopPropagation();\n escRef.current();\n return;\n }\n if (e.key !== \"Tab\") return;\n const items = focusableWithin(root);\n if (items.length === 0) {\n e.preventDefault();\n root.focus();\n return;\n }\n const first = items[0]!;\n const last = items[items.length - 1]!;\n const activeEl = document.activeElement;\n if (e.shiftKey && (activeEl === first || !root.contains(activeEl))) {\n e.preventDefault();\n last.focus();\n } else if (!e.shiftKey && (activeEl === last || !root.contains(activeEl))) {\n e.preventDefault();\n first.focus();\n }\n };\n root.addEventListener(\"keydown\", onKey);\n return () => {\n cancelAnimationFrame(raf);\n root.removeEventListener(\"keydown\", onKey);\n if (previous && document.contains(previous)) previous.focus({ preventScroll: true });\n };\n }, [active, ref, initialFocus]);\n}\n\n/** Lock body scroll while a modal surface is open. */\nexport function useScrollLock(active: boolean): void {\n useEffect(() => {\n if (!active) return;\n const prev = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n return () => {\n document.body.style.overflow = prev;\n };\n }, [active]);\n}\n","import { X } from \"lucide-react\";\nimport { type ReactNode, type RefObject, useId, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { cn } from \"../../lib/cn\";\nimport { IconButton } from \"./IconButton\";\nimport { useFocusTrap, useScrollLock } from \"./useFocusTrap\";\n\nexport interface OverlayProps {\n open: boolean;\n onClose: () => void;\n /** Visible heading; also the accessible name. */\n title: ReactNode;\n /** Accessible description shown under the title. */\n description?: ReactNode;\n children?: ReactNode;\n /** Sticky footer (actions). */\n footer?: ReactNode;\n /** Element to focus first (defaults to the first focusable). */\n initialFocus?: RefObject<HTMLElement | null>;\n /** Close when the backdrop is clicked (default true). */\n dismissOnBackdrop?: boolean;\n /** Extra header controls before the close button. */\n headerActions?: ReactNode;\n className?: string;\n}\n\ntype Placement = \"right\" | \"bottom\" | \"center\";\n\nfunction Surface({\n placement,\n open,\n onClose,\n title,\n description,\n children,\n footer,\n initialFocus,\n dismissOnBackdrop = true,\n headerActions,\n className,\n style,\n}: OverlayProps & { placement: Placement; style?: React.CSSProperties }) {\n const ref = useRef<HTMLDivElement>(null);\n const titleId = useId();\n const descId = useId();\n useFocusTrap(ref, open, onClose, initialFocus);\n useScrollLock(open);\n if (!open) return null;\n return createPortal(\n <div\n className={cn(\n \"fixed inset-0 z-50 flex\",\n placement === \"right\" && \"justify-end\",\n placement === \"bottom\" && \"items-end\",\n placement === \"center\" && \"items-center justify-center p-4\",\n )}\n >\n <div\n className=\"absolute inset-0 bg-overlay\"\n aria-hidden\n onClick={dismissOnBackdrop ? onClose : undefined}\n />\n <div\n ref={ref}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={titleId}\n aria-describedby={description ? descId : undefined}\n tabIndex={-1}\n style={style}\n className={cn(\n \"relative flex flex-col bg-surface text-text shadow-pop outline-none\",\n placement === \"right\" && \"h-full max-w-full border-l border-border safe-pt safe-pb\",\n placement === \"bottom\" &&\n \"max-h-[90dvh] w-full rounded-t-xl border-t border-border safe-pb\",\n placement === \"center\" &&\n \"max-h-[min(90dvh,720px)] w-full max-w-lg rounded-xl border border-border\",\n className,\n )}\n >\n {placement === \"bottom\" && (\n <div className=\"flex justify-center pt-2\" aria-hidden>\n <div className=\"h-1 w-10 rounded-full bg-border-strong\" />\n </div>\n )}\n <div className=\"flex items-start gap-2 border-b border-border px-4 py-3\">\n <div className=\"min-w-0 flex-1\">\n <h2 id={titleId} className=\"text-base font-semibold leading-6\">\n {title}\n </h2>\n {description && (\n <p id={descId} className=\"text-sm text-muted\">\n {description}\n </p>\n )}\n </div>\n {headerActions}\n <IconButton label=\"Close\" icon={<X className=\"size-4\" />} onClick={onClose} />\n </div>\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-3\">\n {children}\n </div>\n {footer && (\n <div className=\"flex flex-wrap items-center justify-end gap-2 border-t border-border px-4 py-3\">\n {footer}\n </div>\n )}\n </div>\n </div>,\n document.body,\n );\n}\n\nexport interface DrawerProps extends OverlayProps {\n /** Width in px (default 520, the task drawer width). Never wider than the viewport. */\n width?: number;\n}\n\n/** Right-side drawer with focus trap, Escape to close, and focus returned to the trigger. */\nexport function Drawer({ width = 520, ...props }: DrawerProps) {\n return <Surface {...props} placement=\"right\" style={{ width: `min(${width}px, 100vw)` }} />;\n}\n\n/** Bottom sheet for mobile; same accessibility behavior as Drawer. */\nexport function Sheet(props: OverlayProps) {\n return <Surface {...props} placement=\"bottom\" />;\n}\n\n/** Centered modal dialog. */\nexport function Dialog(props: OverlayProps) {\n return <Surface {...props} placement=\"center\" />;\n}\n","import {\n forwardRef,\n type TextareaHTMLAttributes,\n useCallback,\n useLayoutEffect,\n useRef,\n} from \"react\";\nimport { cn } from \"../../lib/cn\";\n\nexport interface TextAreaProps extends TextareaHTMLAttributes<HTMLTextAreaElement> {\n /** Max height before scrolling internally (CSS length; default \"33vh\"). */\n maxHeight?: string;\n /** Minimum rows (default 1). */\n minRows?: number;\n}\n\n/** Auto-growing textarea that scrolls internally past `maxHeight`. */\nexport const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(function TextArea(\n { maxHeight = \"33vh\", minRows = 1, className, value, style, ...rest },\n ref,\n) {\n const inner = useRef<HTMLTextAreaElement | null>(null);\n const setRef = useCallback(\n (el: HTMLTextAreaElement | null) => {\n inner.current = el;\n if (typeof ref === \"function\") ref(el);\n else if (ref) ref.current = el;\n },\n [ref],\n );\n // biome-ignore lint/correctness/useExhaustiveDependencies: re-measure when the value changes\n useLayoutEffect(() => {\n const el = inner.current;\n if (!el) return;\n el.style.height = \"auto\";\n el.style.height = `${el.scrollHeight + (el.offsetHeight - el.clientHeight)}px`;\n }, [value]);\n return (\n <textarea\n ref={setRef}\n rows={minRows}\n value={value}\n style={{ maxHeight, ...style }}\n className={cn(\n \"block w-full resize-none overflow-y-auto rounded-md border border-border bg-surface px-3 py-2 text-base text-text placeholder:text-subtle md:text-sm\",\n \"focus:border-accent focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-0\",\n className,\n )}\n {...rest}\n />\n );\n});\n\n/** Single-line input with the same styling. */\nexport const TextInput = forwardRef<HTMLInputElement, React.InputHTMLAttributes<HTMLInputElement>>(\n function TextInput({ className, ...rest }, ref) {\n return (\n <input\n ref={ref}\n className={cn(\n \"tap block h-9 w-full rounded-md border border-border bg-surface px-3 text-base text-text placeholder:text-subtle md:text-sm\",\n \"focus:border-accent focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-0\",\n className,\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IAC7E,EAAG,CAACuC,CAAK,CAAC,GAER,EAAAnD,EAAA,IAAA,CAAC,WAAD,CACE,IAAKkD,EACL,KAAME,EACC,QACP,MAAO,CAAE,YAAW,GAAGC,CAAM,EAC7B,UAAWzD,EACT,uJACA,gGACAW,CACF,EACA,GAAIL,CACL,CAAA,CAEL,CAAC,EAGYoD,GAAA,EAAYjE,EAAAA,WAAAA,CACvB,SAAmB,CAAE,YAAW,GAAGa,GAAQ,EAAK,CAC9C,OACE,EAAAF,EAAA,IAAA,CAAC,QAAD,CACO,MACL,UAAWJ,EACT,8HACA,gGACAW,CACF,EACA,GAAIL,CACL,CAAA,CAEL,CACF,E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{_ as e,i as t,m as n,n as r,t as i}from"./jsx-runtime-D13aM9HY.js";import{D as a,P as o,T as s,U as c,W as l,c as u,i as d,l as f,n as p,o as m,p as h,t as g,u as _}from"./states--geW2Ntl.js";import{t as v}from"./server-SxFxIScj.js";import{t as y}from"./external-link-3jjTxo92.js";import{n as b,t as x}from"./InteractionCard-CWxyDv81.js";import{F as S,P as C,f as w,l as T,s as E,t as D,u as O,w as k}from"./index-vIzH1m8u.js";import{t as A}from"./SegmentedControl-D-2BCZzd.js";var j={name:`list-todo`,size:24,node:[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]};j.node;var M=r(j),N=e(n(),1),P=i(),F=[`needs_input`,`failed`,`ready_for_review`,`unsupported_interaction`,`host_unreachable`],I={needs_input:`Answer here; the answer goes to the same runtime question.`,failed:`Runs that failed or were blocked. Open the task to see why.`,ready_for_review:`Finished runs waiting for your review.`,unsupported_interaction:`Questions this client cannot display. Answer them in a terminal attached to the session.`,host_unreachable:`Running work on hosts that stopped responding. Nothing is restarted elsewhere.`};function L(e){let t=Object.fromEntries(F.map(e=>[e,[]]));for(let n of e)t[n.reason]?.push(n);return t}function R(){let e=a(),t=o(e=>e.hydrated),n=s(),[r,i]=E(`attention`,`all`),c=(0,N.useMemo)(()=>r===`new`?e.filter(e=>!e.acknowledgedAt):e,[e,r]),l=(0,N.useMemo)(()=>L(c),[c]);return(0,P.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-4 px-4 py-4 safe-pt md:px-6`,children:[(0,P.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-3`,children:[(0,P.jsx)(`h1`,{className:`flex-1 text-lg font-semibold`,children:`Attention`}),(0,P.jsx)(A,{label:`Show`,className:`max-sm:w-full max-sm:basis-full`,value:r,onChange:i,options:[{value:`all`,label:`All open`},{value:`new`,label:`Not acknowledged`}]})]}),n.state!==`live`&&t&&(0,P.jsx)(`p`,{className:`text-sm text-muted`,role:`status`,children:`Showing the last known attention items; answers are sent once the connection is back.`}),t?c.length===0?(0,P.jsx)(g,{icon:(0,P.jsx)(S,{className:`size-8`}),title:e.length>0?`Nothing new`:`Nothing needs your attention`,description:e.length>0?`${e.length} acknowledged ${e.length===1?`item is`:`items are`} still open.`:`Questions, failures and finished work show up here.`,action:e.length>0?{label:`Show all open`,onClick:()=>i(`all`)}:{label:`Go to Board`,to:D.board}}):F.filter(e=>l[e].length>0).map(e=>{let t=O[e],n=t.icon;return(0,P.jsxs)(`section`,{"data-testid":`attention-group-${e}`,"aria-labelledby":`att-${e}`,className:`flex min-w-0 flex-col gap-2`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`h2`,{id:`att-${e}`,className:`flex items-center gap-2 text-base font-semibold`,children:[(0,P.jsx)(n,{"aria-hidden":!0,className:`size-4 text-muted`}),t.label,(0,P.jsxs)(`span`,{className:`text-sm font-normal text-muted`,children:[`(`,l[e].length,`)`]})]}),(0,P.jsx)(`p`,{className:`text-sm text-muted`,children:I[e]})]}),(0,P.jsx)(`ul`,{className:`flex min-w-0 flex-col gap-2`,children:l[e].map(e=>(0,P.jsx)(`li`,{className:`min-w-0`,children:(0,P.jsx)(z,{item:e})},e.id))})]},e)}):(0,P.jsx)(m,{label:`Loading attention…`})]})}function z({item:e}){let n=o(t=>e.projectId?t.projects[e.projectId]:void 0),r=o(t=>e.taskId?t.tasks[e.taskId]:void 0),i=o(t=>e.sessionId?t.sessions[e.sessionId]:void 0),a=o(e=>i?e.hosts[i.hostId]:void 0),s=o(t=>e.interactionId?t.interactions[e.interactionId]:void 0),[m,g]=(0,N.useState)(!1),[S,E]=(0,N.useState)(null),A=async()=>{g(!0),E(null);try{let t=await c(`/api/attention/${encodeURIComponent(e.id)}/acknowledge`),n=t&&typeof t==`object`&&`id`in t?t:{...e,acknowledgedAt:new Date().toISOString()};o.setState(t=>t.attention[e.id]?{attention:{...t.attention,[e.id]:n}}:{}),T.success(`Acknowledged. It stays open until the underlying task or question is resolved.`)}catch(e){E(e)}finally{g(!1)}},j=e.sessionId?e.interactionId?D.interaction(e.sessionId,e.interactionId):D.session(e.sessionId):null,F=!!a&&a.connectivity!==`connected`,I=null;switch(e.reason){case`needs_input`:I=s&&s.state===`pending`?(0,P.jsx)(x,{flush:!0,interaction:s,readOnlyReason:F?`Host ${a?.name} is offline. You can answer once it reconnects.`:i?.readOnly?`This session is read-only.`:null}):s?(0,P.jsx)(x,{flush:!0,interaction:s}):j?(0,P.jsxs)(t,{to:j,className:_(`primary`,`sm`),children:[(0,P.jsx)(y,{"aria-hidden":!0,className:`size-3.5`}),`Answer in session`]}):null;break;case`failed`:I=e.taskId?(0,P.jsxs)(t,{to:D.task(e.taskId),className:_(`primary`,`sm`),children:[(0,P.jsx)(M,{"aria-hidden":!0,className:`size-3.5`}),`Open task`]}):null;break;case`ready_for_review`:I=e.sessionId?(0,P.jsxs)(t,{to:`${D.session(e.sessionId)}?tab=changes`,className:_(`primary`,`sm`),children:[(0,P.jsx)(k,{"aria-hidden":!0,className:`size-3.5`}),`Review changes`]}):e.taskId?(0,P.jsxs)(t,{to:D.task(e.taskId),className:_(`primary`,`sm`),children:[(0,P.jsx)(k,{"aria-hidden":!0,className:`size-3.5`}),`Open review`]}):null;break;case`unsupported_interaction`:I=s?(0,P.jsx)(x,{interaction:s,readOnlyReason:F?`Host ${a?.name} is offline. You can choose once it reconnects.`:i?.readOnly?`This session is read-only.`:null}):(0,P.jsx)(u,{capability:`This dialog`,reason:`An extension opened a terminal-only dialog. In RPC mode Pi gave it no answer, so the extension continued without one.`});break;case`host_unreachable`:I=a?(0,P.jsx)(d,{compact:!0,hostName:a.name,connectivity:a.connectivity===`reconnecting`?`reconnecting`:`unreachable`,lastSeenAt:a.lastSeenAt}):null}let L=[n?.name,r?.title,i&&i.title!==r?.title?i.title:null].filter(Boolean).join(` · `)||`Switchyard`;return e.reason===`needs_input`&&s?.state===`pending`&&b(s.presentation)?(0,P.jsxs)(`article`,{"aria-label":`Plan awaiting approval: ${L}`,className:`flex min-w-0 flex-col gap-2`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted`,children:[(0,P.jsx)(`span`,{className:`min-w-0 basis-full truncate sm:basis-auto sm:flex-1`,children:L}),j&&(0,P.jsxs)(t,{to:j,className:_(`ghost`,`sm`),children:[(0,P.jsx)(y,{"aria-hidden":!0,className:`size-3.5`}),`Open session`]}),(0,P.jsx)(`time`,{dateTime:e.createdAt,className:`shrink-0 text-xs text-subtle sm:ml-auto`,children:h(e.createdAt)}),!e.acknowledgedAt&&(0,P.jsx)(f,{size:`sm`,variant:`ghost`,busy:m,onClick:()=>void A(),children:`Acknowledge`})]}),I,S!==null&&(0,P.jsx)(p,{compact:!0,title:`Could not acknowledge`,error:l(S),onRetry:()=>void A()})]}):(0,P.jsxs)(`article`,{"aria-label":`${O[e.reason].label}: ${r?.title??i?.title??e.summary}`,className:`flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[(0,P.jsx)(w,{kind:`attention`,value:e.reason,size:`sm`}),(0,P.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm text-muted`,children:[n?.name,r?.title,i&&i.title!==r?.title?i.title:null].filter(Boolean).join(` · `)||`Switchyard`}),(0,P.jsx)(`time`,{dateTime:e.createdAt,className:`shrink-0 text-xs text-subtle`,children:h(e.createdAt)})]}),(0,P.jsx)(`p`,{className:`min-w-0 text-sm break-words`,children:e.summary}),I&&(0,P.jsx)(`div`,{className:`flex min-w-0 flex-col items-start`,children:I}),(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[e.reason!==`failed`&&e.taskId&&(0,P.jsxs)(t,{to:D.task(e.taskId),className:_(`ghost`,`sm`),children:[(0,P.jsx)(M,{"aria-hidden":!0,className:`size-3.5`}),`Task`]}),j&&(0,P.jsxs)(t,{to:j,className:_(`ghost`,`sm`),children:[(0,P.jsx)(y,{"aria-hidden":!0,className:`size-3.5`}),`Open session`]}),e.reason===`host_unreachable`&&a&&(0,P.jsxs)(t,{to:`${D.settings(`hosts`)}/${encodeURIComponent(a.id)}`,className:_(`ghost`,`sm`),children:[(0,P.jsx)(v,{"aria-hidden":!0,className:`size-3.5`}),`Host details`]}),(0,P.jsx)(`span`,{className:`ml-auto`}),e.acknowledgedAt?(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs text-muted`,children:[(0,P.jsx)(C,{"aria-hidden":!0,className:`size-3.5`}),`Acknowledged `,h(e.acknowledgedAt)]}):(0,P.jsx)(f,{size:`sm`,busy:m,onClick:()=>void A(),title:`Hide the alert without resolving the task`,children:`Acknowledge`})]}),S!==null&&(0,P.jsx)(p,{compact:!0,title:`Could not acknowledge`,error:l(S),onRetry:()=>void A()})]})}export{F as ATTENTION_GROUPS,R as default,L as groupAttention};
|
|
2
|
+
//# sourceMappingURL=attention-Bya8XHKI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attention-Bya8XHKI.js","names":["useMemo","useState","__toESM","Link","require_react","createLucideIcon","require_jsx_runtime","useOpenAttention","useSyncStore","useConnection","apiPost","errorMessage","UnsupportedCapability","HostUnavailable","Button","ErrorState","LoadingState","formatRelative","EmptyState","buttonClasses","Server","ExternalLink","isDocumentPresentation","InteractionCard","Bell","CircleCheck","StatusChip","toast","useFilter","ROUTES","ATTENTION_STATUS","Eye","SegmentedControl","__iconData","ListTodo","import_react","import_jsx_runtime","ATTENTION_GROUPS","GROUP_HINT","groupAttention","out","r","a","items","AttentionView","all","hydrated","s","connection","show","setShow","groups","info","reason","Icon","AttentionRow","project","item","task","session","host","interaction","busy","setBusy","ackError","setAckError","acknowledge","res","next","sessionHref","hostOffline","action","metaText"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/list-todo.mjs","../../src/features/attention/index.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"list-todo\",\n size: 24,\n node: [\n [\"path\", { d: \"M13 5h8\", key: \"a7qcls\" }],\n [\"path\", { d: \"M13 12h8\", key: \"h98zly\" }],\n [\"path\", { d: \"M13 19h8\", key: \"c3s6r1\" }],\n [\"path\", { d: \"m3 17 2 2 4-4\", key: \"1jhpwq\" }],\n [\"rect\", { x: \"3\", y: \"4\", width: \"6\", height: \"6\", rx: \"1\", key: \"cif1o7\" }]\n ]\n};\n__iconData.node;\nconst ListTodo = createLucideIcon(__iconData);\n\nexport { __iconData, ListTodo as default };\n//# sourceMappingURL=list-todo.mjs.map\n","import type { AttentionItem, AttentionReason } from \"@switchyard/protocol\";\nimport { Bell, CircleCheck, ExternalLink, Eye, ListTodo, Server } from \"lucide-react\";\nimport { useMemo, useState } from \"react\";\nimport { Link } from \"react-router\";\nimport { ROUTES } from \"../../app/routes\";\nimport { InteractionCard, isDocumentPresentation } from \"../../components/intent/InteractionCard\";\nimport { Button, buttonClasses } from \"../../components/ui/Button\";\nimport { SegmentedControl } from \"../../components/ui/SegmentedControl\";\nimport { ATTENTION_STATUS, StatusChip } from \"../../components/ui/StatusChip\";\nimport {\n EmptyState,\n ErrorState,\n HostUnavailable,\n LoadingState,\n UnsupportedCapability,\n} from \"../../components/ui/states\";\nimport { toast } from \"../../components/ui/Toast\";\nimport { formatRelative } from \"../../lib/time\";\nimport { useFilter } from \"../../prefs\";\nimport { apiPost, errorMessage } from \"../../sync/api\";\nimport { useConnection, useOpenAttention, useSyncStore } from \"../../sync/store\";\n\nexport const ATTENTION_GROUPS: AttentionReason[] = [\n \"needs_input\",\n \"failed\",\n \"ready_for_review\",\n \"unsupported_interaction\",\n \"host_unreachable\",\n];\n\nconst GROUP_HINT: Record<AttentionReason, string> = {\n needs_input: \"Answer here; the answer goes to the same runtime question.\",\n failed: \"Runs that failed or were blocked. Open the task to see why.\",\n ready_for_review: \"Finished runs waiting for your review.\",\n unsupported_interaction:\n \"Questions this client cannot display. Answer them in a terminal attached to the session.\",\n host_unreachable:\n \"Running work on hosts that stopped responding. Nothing is restarted elsewhere.\",\n};\n\n/** Group open attention by reason, keeping newest first within a group. */\nexport function groupAttention(items: AttentionItem[]): Record<AttentionReason, AttentionItem[]> {\n const out = Object.fromEntries(ATTENTION_GROUPS.map((r) => [r, [] as AttentionItem[]])) as Record<\n AttentionReason,\n AttentionItem[]\n >;\n for (const a of items) out[a.reason]?.push(a);\n return out;\n}\n\n/** /attention: Needs input, Failed, Ready for review (plus unsupported and unreachable). */\nexport default function AttentionView() {\n const all = useOpenAttention();\n const hydrated = useSyncStore((s) => s.hydrated);\n const connection = useConnection();\n const [show, setShow] = useFilter<\"all\" | \"new\">(\"attention\", \"all\");\n const items = useMemo(\n () => (show === \"new\" ? all.filter((a) => !a.acknowledgedAt) : all),\n [all, show],\n );\n const groups = useMemo(() => groupAttention(items), [items]);\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-4 px-4 py-4 safe-pt md:px-6\">\n <header className=\"flex min-w-0 flex-wrap items-center gap-3\">\n <h1 className=\"flex-1 text-lg font-semibold\">Attention</h1>\n <SegmentedControl\n label=\"Show\"\n className=\"max-sm:w-full max-sm:basis-full\"\n value={show}\n onChange={setShow}\n options={[\n { value: \"all\", label: \"All open\" },\n { value: \"new\", label: \"Not acknowledged\" },\n ]}\n />\n </header>\n {connection.state !== \"live\" && hydrated && (\n <p className=\"text-sm text-muted\" role=\"status\">\n Showing the last known attention items; answers are sent once the connection is back.\n </p>\n )}\n {!hydrated ? (\n <LoadingState label=\"Loading attention…\" />\n ) : items.length === 0 ? (\n <EmptyState\n icon={<Bell className=\"size-8\" />}\n title={all.length > 0 ? \"Nothing new\" : \"Nothing needs your attention\"}\n description={\n all.length > 0\n ? `${all.length} acknowledged ${all.length === 1 ? \"item is\" : \"items are\"} still open.`\n : \"Questions, failures and finished work show up here.\"\n }\n action={\n all.length > 0\n ? { label: \"Show all open\", onClick: () => setShow(\"all\") }\n : { label: \"Go to Board\", to: ROUTES.board }\n }\n />\n ) : (\n ATTENTION_GROUPS.filter((r) => groups[r].length > 0).map((reason) => {\n const info = ATTENTION_STATUS[reason];\n const Icon = info.icon;\n return (\n <section\n key={reason}\n data-testid={`attention-group-${reason}`}\n aria-labelledby={`att-${reason}`}\n className=\"flex min-w-0 flex-col gap-2\"\n >\n <div>\n <h2\n id={`att-${reason}`}\n className=\"flex items-center gap-2 text-base font-semibold\"\n >\n <Icon aria-hidden className=\"size-4 text-muted\" />\n {info.label}\n <span className=\"text-sm font-normal text-muted\">({groups[reason].length})</span>\n </h2>\n <p className=\"text-sm text-muted\">{GROUP_HINT[reason]}</p>\n </div>\n <ul className=\"flex min-w-0 flex-col gap-2\">\n {groups[reason].map((a) => (\n <li key={a.id} className=\"min-w-0\">\n <AttentionRow item={a} />\n </li>\n ))}\n </ul>\n </section>\n );\n })\n )}\n </div>\n );\n}\n\nfunction AttentionRow({ item }: { item: AttentionItem }) {\n const project = useSyncStore((s) => (item.projectId ? s.projects[item.projectId] : undefined));\n const task = useSyncStore((s) => (item.taskId ? s.tasks[item.taskId] : undefined));\n const session = useSyncStore((s) => (item.sessionId ? s.sessions[item.sessionId] : undefined));\n const host = useSyncStore((s) => (session ? s.hosts[session.hostId] : undefined));\n const interaction = useSyncStore((s) =>\n item.interactionId ? s.interactions[item.interactionId] : undefined,\n );\n const [busy, setBusy] = useState(false);\n const [ackError, setAckError] = useState<unknown>(null);\n\n const acknowledge = async () => {\n setBusy(true);\n setAckError(null);\n try {\n const res = await apiPost<AttentionItem>(\n `/api/attention/${encodeURIComponent(item.id)}/acknowledge`,\n );\n const next =\n res && typeof res === \"object\" && \"id\" in res\n ? res\n : { ...item, acknowledgedAt: new Date().toISOString() };\n useSyncStore.setState((s) =>\n s.attention[item.id] ? { attention: { ...s.attention, [item.id]: next } } : {},\n );\n toast.success(\n \"Acknowledged. It stays open until the underlying task or question is resolved.\",\n );\n } catch (e) {\n setAckError(e);\n } finally {\n setBusy(false);\n }\n };\n\n const sessionHref = item.sessionId\n ? item.interactionId\n ? ROUTES.interaction(item.sessionId, item.interactionId)\n : ROUTES.session(item.sessionId)\n : null;\n const hostOffline = !!host && host.connectivity !== \"connected\";\n\n let action: React.ReactNode = null;\n switch (item.reason) {\n case \"needs_input\":\n action =\n interaction && interaction.state === \"pending\" ? (\n <InteractionCard\n flush\n interaction={interaction}\n readOnlyReason={\n hostOffline\n ? `Host ${host?.name} is offline. You can answer once it reconnects.`\n : session?.readOnly\n ? \"This session is read-only.\"\n : null\n }\n />\n ) : interaction ? (\n <InteractionCard flush interaction={interaction} />\n ) : sessionHref ? (\n <Link to={sessionHref} className={buttonClasses(\"primary\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Answer in session\n </Link>\n ) : null;\n break;\n case \"failed\":\n action = item.taskId ? (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"primary\", \"sm\")}>\n <ListTodo aria-hidden className=\"size-3.5\" />\n Open task\n </Link>\n ) : null;\n break;\n case \"ready_for_review\":\n action = item.sessionId ? (\n <Link\n to={`${ROUTES.session(item.sessionId)}?tab=changes`}\n className={buttonClasses(\"primary\", \"sm\")}\n >\n <Eye aria-hidden className=\"size-3.5\" />\n Review changes\n </Link>\n ) : item.taskId ? (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"primary\", \"sm\")}>\n <Eye aria-hidden className=\"size-3.5\" />\n Open review\n </Link>\n ) : null;\n break;\n case \"unsupported_interaction\":\n action = interaction ? (\n <InteractionCard\n interaction={interaction}\n readOnlyReason={\n hostOffline\n ? `Host ${host?.name} is offline. You can choose once it reconnects.`\n : session?.readOnly\n ? \"This session is read-only.\"\n : null\n }\n />\n ) : (\n <UnsupportedCapability\n capability=\"This dialog\"\n reason=\"An extension opened a terminal-only dialog. In RPC mode Pi gave it no answer, so the extension continued without one.\"\n />\n );\n break;\n case \"host_unreachable\":\n action = host ? (\n <HostUnavailable\n compact\n hostName={host.name}\n connectivity={host.connectivity === \"reconnecting\" ? \"reconnecting\" : \"unreachable\"}\n lastSeenAt={host.lastSeenAt}\n />\n ) : null;\n break;\n }\n\n const metaText =\n [project?.name, task?.title, session && session.title !== task?.title ? session.title : null]\n .filter(Boolean)\n .join(\" · \") || \"Switchyard\";\n\n // A plan awaiting approval gets the whole width: one meta line, no card around it.\n if (\n item.reason === \"needs_input\" &&\n interaction?.state === \"pending\" &&\n isDocumentPresentation(interaction.presentation)\n ) {\n return (\n <article\n aria-label={`Plan awaiting approval: ${metaText}`}\n className=\"flex min-w-0 flex-col gap-2\"\n >\n <div className=\"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted\">\n <span className=\"min-w-0 basis-full truncate sm:basis-auto sm:flex-1\">{metaText}</span>\n {sessionHref && (\n <Link to={sessionHref} className={buttonClasses(\"ghost\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Open session\n </Link>\n )}\n <time dateTime={item.createdAt} className=\"shrink-0 text-xs text-subtle sm:ml-auto\">\n {formatRelative(item.createdAt)}\n </time>\n {!item.acknowledgedAt && (\n <Button size=\"sm\" variant=\"ghost\" busy={busy} onClick={() => void acknowledge()}>\n Acknowledge\n </Button>\n )}\n </div>\n {action}\n {ackError !== null && (\n <ErrorState\n compact\n title=\"Could not acknowledge\"\n error={errorMessage(ackError)}\n onRetry={() => void acknowledge()}\n />\n )}\n </article>\n );\n }\n\n return (\n <article\n aria-label={`${ATTENTION_STATUS[item.reason].label}: ${task?.title ?? session?.title ?? item.summary}`}\n className=\"flex min-w-0 flex-col gap-2 rounded-lg border border-border bg-surface p-3\"\n >\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n <StatusChip kind=\"attention\" value={item.reason} size=\"sm\" />\n <span className=\"min-w-0 flex-1 truncate text-sm text-muted\">\n {[\n project?.name,\n task?.title,\n session && session.title !== task?.title ? session.title : null,\n ]\n .filter(Boolean)\n .join(\" · \") || \"Switchyard\"}\n </span>\n <time dateTime={item.createdAt} className=\"shrink-0 text-xs text-subtle\">\n {formatRelative(item.createdAt)}\n </time>\n </div>\n <p className=\"min-w-0 text-sm break-words\">{item.summary}</p>\n {action && <div className=\"flex min-w-0 flex-col items-start\">{action}</div>}\n <div className=\"flex min-w-0 flex-wrap items-center gap-2\">\n {item.reason !== \"failed\" && item.taskId && (\n <Link to={ROUTES.task(item.taskId)} className={buttonClasses(\"ghost\", \"sm\")}>\n <ListTodo aria-hidden className=\"size-3.5\" />\n Task\n </Link>\n )}\n {sessionHref && (\n <Link to={sessionHref} className={buttonClasses(\"ghost\", \"sm\")}>\n <ExternalLink aria-hidden className=\"size-3.5\" />\n Open session\n </Link>\n )}\n {item.reason === \"host_unreachable\" && host && (\n <Link\n to={`${ROUTES.settings(\"hosts\")}/${encodeURIComponent(host.id)}`}\n className={buttonClasses(\"ghost\", \"sm\")}\n >\n <Server aria-hidden className=\"size-3.5\" />\n Host details\n </Link>\n )}\n <span className=\"ml-auto\" />\n {item.acknowledgedAt ? (\n <span className=\"inline-flex items-center gap-1 text-xs text-muted\">\n <CircleCheck aria-hidden className=\"size-3.5\" />\n Acknowledged {formatRelative(item.acknowledgedAt)}\n </span>\n ) : (\n <Button\n size=\"sm\"\n busy={busy}\n onClick={() => void acknowledge()}\n title=\"Hide the alert without resolving the task\"\n >\n Acknowledge\n </Button>\n )}\n </div>\n {ackError !== null && (\n <ErrorState\n compact\n title=\"Could not acknowledge\"\n error={errorMessage(ackError)}\n onRetry={() => void acknowledge()}\n />\n )}\n </article>\n );\n}\n"],"ignoreList":[0],"mappings":"A,qeASA,IAAMiC,EAAa,CACjB,KAAM,YACN,KAAM,GACN,KAAM,CACJ,CAAC,OAAQ,CAAE,EAAG,UAAW,IAAK,QAAS,CAAC,EACxC,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,EACzC,CAAC,OAAQ,CAAE,EAAG,WAAY,IAAK,QAAS,CAAC,EACzC,CAAC,OAAQ,CAAE,EAAG,gBAAiB,IAAK,QAAS,CAAC,EAC9C,CAAC,OAAQ,CAAE,EAAG,IAAK,EAAG,IAAK,MAAO,IAAK,OAAQ,IAAK,GAAI,IAAK,IAAK,QAAS,CAAC,CAC9E,CACF,EACAA,EAAW,KACX,IAAMC,EAAW7B,EAAiB4B,CAAU,E,iBCC/BI,EAAsC,CACjD,cACA,SACA,mBACA,0BACA,kBACF,EAEMC,EAA8C,CAClD,YAAa,6DACb,OAAQ,8DACR,iBAAkB,yCAClB,wBACE,2FACF,iBACE,gFACJ,EAGA,SAAgBC,EAAe,EAAkE,CAC/F,IAAMC,EAAM,OAAO,YAAYH,EAAiB,IAAK,GAAM,CAACI,EAAG,CAAC,CAAoB,CAAC,CAAC,EAItF,IAAK,IAAMC,KAAKC,EAAOH,EAAIE,EAAE,OAAO,EAAE,KAAKA,CAAC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t as i}from"./jsx-runtime-D13aM9HY.js";import{P as a,V as o,h as s,l as c,n as l,o as u,p as d,r as f,t as p,u as m}from"./states--geW2Ntl.js";import{t as h}from"./calendar-clock-B8zE4JsX.js";import{t as g}from"./chevron-right-evVLS6hq.js";import{t as _}from"./hand-UPoHamrn.js";import{t as v}from"./link-2-CaMlUDRG.js";import{A as y,C as b,F as x,I as S,M as C,P as w,_ as T,c as E,p as D,w as O}from"./describe-DnvH6_fl.js";import{t as k}from"./play-CjoDg3ws.js";import{t as A}from"./plus-BLP-wIYD.js";import{D as j,g as M,h as N,r as P}from"./index-vIzH1m8u.js";import{a as F}from"./dist-BE_V9dwJ.js";var I={name:`webhook`,size:24,node:[[`path`,{d:`M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2`,key:`q3hayz`}],[`path`,{d:`m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06`,key:`1go1hn`}],[`path`,{d:`m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8`,key:`qlwsc0`}]]};I.node;var L=r(I),R=e(n(),1),z=i(),B=`/automations/new`,V=e=>`/automations/${encodeURIComponent(e)}`,H={manual:_,once:j,cron:h,webhook:L,dependency:v};function U(){let e=a(e=>e.hydrated),n=w(),r=a(e=>e.projects),i=a(e=>e.hosts),s=a(e=>e.tasks),c=P(),[d,h]=(0,R.useState)({status:`idle`}),g=(0,R.useCallback)(async()=>{h({status:`loading`});try{let e=await o(`/api/automations`),t=Array.isArray(e)?e:e&&typeof e==`object`&&Array.isArray(e.items)?e.items:null,n=t?F.array().safeParse(t):null;if(!n?.success){h({status:`fatal`,error:Error(`The coordinator returned automations in an unexpected format.`)});return}C.getState().putMany(n.data),h({status:`done`})}catch(e){h({status:`error`,error:e})}},[]);(0,R.useEffect)(()=>{e||g()},[e,g]);let _=(0,R.useMemo)(()=>Object.values(n).sort((e,t)=>e.name.localeCompare(t.name)),[n]),v=e||d.status===`done`,y;return y=v?_.length===0?(0,z.jsx)(p,{icon:(0,z.jsx)(N,{className:`size-8`}),title:`No automations yet`,description:`Automations create tasks on a schedule, from a webhook, or when another task is done.`,action:{label:`Create an automation`,to:B,icon:(0,z.jsx)(A,{className:`size-4`})}}):(0,z.jsx)(G,{automations:_,projects:r,hosts:i,tasks:s,table:c===`desktop`}):d.status===`fatal`?(0,z.jsx)(f,{error:d.error}):d.status===`error`?(0,z.jsx)(l,{title:`Could not load automations`,error:d.error,onRetry:()=>void g()}):(0,z.jsx)(u,{label:`Loading automations…`}),(0,z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-4 px-4 py-4 md:px-6`,children:[(0,z.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Automations`}),(0,z.jsx)(`p`,{className:`text-sm text-muted`,children:`Scheduled, webhook and dependency automations. Routine successes stay in each automation's history.`})]}),(0,z.jsxs)(t,{to:B,className:m(`primary`),children:[(0,z.jsx)(A,{"aria-hidden":!0,className:`size-4`}),`New automation`]})]}),(0,z.jsx)(b,{}),y]})}var W=`grid grid-cols-[minmax(0,2.4fr)_minmax(0,1fr)_5.5rem_minmax(0,1.2fr)_minmax(0,1.4fr)_7.5rem_7rem_auto] items-center gap-3`;function G({automations:e,projects:t,hosts:n,tasks:r,table:i}){let{busy:a,toggle:o}=S(),{busy:c,run:l}=x(),u=(0,R.useCallback)(e=>r[e]?.title,[r]);return(0,z.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-border bg-surface`,children:[i&&(0,z.jsxs)(`div`,{"aria-hidden":!0,className:s(W,`border-b border-border bg-surface-2 px-4 py-2 text-xs font-medium text-muted`),children:[(0,z.jsx)(`span`,{children:`Automation`}),(0,z.jsx)(`span`,{children:`Project`}),(0,z.jsx)(`span`,{children:`Mode`}),(0,z.jsx)(`span`,{children:`Next occurrence`}),(0,z.jsx)(`span`,{children:`Last outcome`}),(0,z.jsx)(`span`,{children:`Failures`}),(0,z.jsx)(`span`,{children:`Enabled`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Actions`})]}),(0,z.jsx)(`ul`,{"data-testid":`automations-list`,className:`divide-y divide-border`,children:e.map(e=>{let r=t[e.projectId],s=e.hostId??r?.defaultHostId??null,d=s?n[s]:void 0,f={automation:e,projectName:r?.name??`Unknown project`,host:d,trigger:E(e.trigger,{taskTitle:u}),toggling:!!a[e.id],running:!!c[e.id],onToggle:t=>void o(e,t),onRun:()=>void l(e)};return(0,z.jsx)(`li`,{"data-testid":`automation-row`,"data-automation-id":e.id,children:i?(0,z.jsx)(X,{...f}):(0,z.jsx)(Z,{...f})},e.id)})})]})}function K({automation:e,trigger:t}){let n=H[e.trigger.kind];return(0,z.jsxs)(`span`,{className:`flex min-w-0 items-start gap-1.5 text-sm text-muted`,children:[(0,z.jsx)(n,{"aria-hidden":!0,className:`mt-0.5 size-3.5 shrink-0`}),(0,z.jsx)(`span`,{className:`min-w-0 break-words`,children:t})]})}function q({automation:e}){if(!e.enabled)return(0,z.jsx)(`span`,{className:`text-sm text-muted`,children:`Paused (disabled)`});if(!e.nextAt){let t=e.trigger.kind;return(0,z.jsx)(`span`,{className:`text-sm text-muted`,children:t===`manual`?`On demand`:t===`webhook`?`On webhook`:t===`dependency`?`When the task is done`:`None scheduled`})}return(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col text-sm`,children:[(0,z.jsx)(`span`,{children:d(e.nextAt)}),(0,z.jsx)(`time`,{dateTime:e.nextAt,className:`text-xs text-muted`,children:D(e.nextAt)})]})}function J({host:e}){return!e||e.connectivity===`connected`?null:(0,z.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-danger`,children:[(0,z.jsx)(M,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,z.jsxs)(`span`,{className:`min-w-0 break-words`,children:[`Host `,e.name,` `,e.connectivity===`reconnecting`?`reconnecting`:`unreachable`]})]})}function Y({running:e,onRun:t,name:n}){return(0,z.jsx)(c,{size:`sm`,busy:e,icon:(0,z.jsx)(k,{className:`size-3.5`}),onClick:t,"aria-label":`Run ${n} now`,children:`Run now`})}function X(e){let n=e.automation;return(0,z.jsxs)(`div`,{className:s(W,`px-4 py-3`),children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,z.jsx)(t,{to:V(n.id),className:`truncate font-medium text-text hover:underline focus-visible:underline`,children:n.name}),(0,z.jsx)(K,{automation:n,trigger:e.trigger})]}),(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:`Project: `}),(0,z.jsx)(`span`,{className:`truncate text-sm`,children:e.projectName}),(0,z.jsx)(J,{host:e.host})]}),(0,z.jsxs)(`span`,{className:`text-sm`,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:`Mode: `}),T(n.mode)]}),(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:`Next occurrence: `}),(0,z.jsx)(q,{automation:n})]}),(0,z.jsxs)(`div`,{className:`min-w-0 text-sm break-words`,children:[(0,z.jsx)(`span`,{className:`sr-only`,children:`Last outcome: `}),n.lastOutcome??(0,z.jsx)(`span`,{className:`text-muted`,children:`No runs yet`})]}),(0,z.jsx)(O,{count:n.failureCount}),(0,z.jsx)(y,{checked:n.enabled,onChange:e.onToggle,busy:e.toggling,label:`Enable ${n.name}`,onText:`Enabled`,offText:`Disabled`}),(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(Y,{running:e.running,onRun:e.onRun,name:n.name}),(0,z.jsx)(t,{to:V(n.id),"aria-label":`Edit ${n.name}`,title:`Edit`,className:`tap inline-flex size-9 items-center justify-center rounded-md text-muted hover:bg-surface-2 hover:text-text`,children:(0,z.jsx)(g,{"aria-hidden":!0,className:`size-4`})})]})]})}function Z(e){let n=e.automation;return(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 px-4 py-3`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,z.jsx)(t,{to:V(n.id),className:`font-medium break-words text-text hover:underline focus-visible:underline`,children:n.name}),(0,z.jsx)(K,{automation:n,trigger:e.trigger})]}),(0,z.jsx)(y,{checked:n.enabled,onChange:e.onToggle,busy:e.toggling,label:`Enable ${n.name}`,onText:`Enabled`,offText:`Disabled`})]}),(0,z.jsxs)(`dl`,{className:`grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-sm`,children:[(0,z.jsx)(`dt`,{className:`text-muted`,children:`Project`}),(0,z.jsxs)(`dd`,{className:`flex min-w-0 flex-col break-words`,children:[e.projectName,(0,z.jsx)(J,{host:e.host})]}),(0,z.jsx)(`dt`,{className:`text-muted`,children:`Mode`}),(0,z.jsx)(`dd`,{children:T(n.mode)}),(0,z.jsx)(`dt`,{className:`text-muted`,children:`Next`}),(0,z.jsx)(`dd`,{className:`min-w-0`,children:(0,z.jsx)(q,{automation:n})}),(0,z.jsx)(`dt`,{className:`text-muted`,children:`Last outcome`}),(0,z.jsx)(`dd`,{className:`min-w-0 break-words`,children:n.lastOutcome??(0,z.jsx)(`span`,{className:`text-muted`,children:`No runs yet`})}),(0,z.jsx)(`dt`,{className:`text-muted`,children:`Failures`}),(0,z.jsx)(`dd`,{children:(0,z.jsx)(O,{count:n.failureCount})})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,z.jsx)(Y,{running:e.running,onRun:e.onRun,name:n.name}),(0,z.jsxs)(t,{to:V(n.id),className:m(`ghost`,`sm`),children:[`Edit`,(0,z.jsx)(g,{"aria-hidden":!0,className:`size-3.5`})]})]})]})}export{U as default};
|
|
2
|
+
//# sourceMappingURL=automations-DiXKRcnE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"automations-DiXKRcnE.js","names":["useState","useCallback","useMemo","__toESM","Link","require_react","createLucideIcon","require_jsx_runtime","useSyncStore","apiGet","cn","Button","ErrorState","LoadingState","formatRelative","FatalError","EmptyState","buttonClasses","CalendarClock","ChevronRight","Hand","Link2","Switch","ConnectionNote","useRunNow","useToggleEnabled","useLocalAutomations","useMergedAutomations","modeLabel","describeTrigger","formatAbsolute","FailureCount","Play","Plus","Clock","WifiOff","Workflow","useBreakpoint","Automation","__iconData","Webhook","import_react","import_jsx_runtime","NEW_PATH","editPath","id","TRIGGER_ICONS","AutomationsView","hydrated","s","automations","projects","hosts","tasks","bp","fetchState","setFetchState","load","res","list","parsed","rows","a","b","haveData","body","AutomationRows","TABLE_COLS","toggling","running","taskTitle","table","project","hostId","host","props","toggle","next","run","TableRow","CardRow","TriggerText","Icon","automation","trigger","NextOccurrence","k","HostWarning","RunButton","onRun","name","p"],"sources":["../../../../node_modules/.pnpm/lucide-react@1.61.0_@types+react@19.3.0_react@19.3.1/node_modules/lucide-react/dist/esm/icons/webhook.mjs","../../src/features/automations/index.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.61.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.mjs';\n\nconst __iconData = {\n name: \"webhook\",\n size: 24,\n node: [\n [\n \"path\",\n {\n d: \"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2\",\n key: \"q3hayz\"\n }\n ],\n [\"path\", { d: \"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06\", key: \"1go1hn\" }],\n [\"path\", { d: \"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8\", key: \"qlwsc0\" }]\n ]\n};\n__iconData.node;\nconst Webhook = createLucideIcon(__iconData);\n\nexport { __iconData, Webhook as default };\n//# sourceMappingURL=webhook.mjs.map\n","import { Automation, type Host, type Project, type Task } from \"@switchyard/protocol\";\nimport {\n CalendarClock,\n ChevronRight,\n Clock,\n Hand,\n Link2,\n type LucideIcon,\n Play,\n Plus,\n Webhook,\n WifiOff,\n Workflow,\n} from \"lucide-react\";\nimport { type ReactNode, useCallback, useEffect, useMemo, useState } from \"react\";\nimport { Link } from \"react-router\";\nimport { useBreakpoint } from \"../../app/useBreakpoint\";\nimport { Button, buttonClasses } from \"../../components/ui/Button\";\nimport { EmptyState, ErrorState, FatalError, LoadingState } from \"../../components/ui/states\";\nimport { cn } from \"../../lib/cn\";\nimport { formatRelative } from \"../../lib/time\";\nimport { apiGet } from \"../../sync/api\";\nimport { useSyncStore } from \"../../sync/store\";\nimport {\n ConnectionNote,\n FailureCount,\n Switch,\n useLocalAutomations,\n useMergedAutomations,\n useRunNow,\n useToggleEnabled,\n} from \"./controls\";\nimport { describeTrigger, formatAbsolute, modeLabel, type TriggerKind } from \"./describe\";\n\nconst NEW_PATH = \"/automations/new\";\nconst editPath = (id: string) => `/automations/${encodeURIComponent(id)}`;\n\nconst TRIGGER_ICONS: Record<TriggerKind, LucideIcon> = {\n manual: Hand,\n once: Clock,\n cron: CalendarClock,\n webhook: Webhook,\n dependency: Link2,\n};\n\ntype FetchState =\n | { status: \"idle\" | \"loading\" | \"done\" }\n | { status: \"error\"; error: unknown }\n | { status: \"fatal\"; error: unknown };\n\n/** Automations list (spec 15): enabled state, trigger, next occurrence, last outcome, failures. */\nexport default function AutomationsView() {\n const hydrated = useSyncStore((s) => s.hydrated);\n const automations = useMergedAutomations();\n const projects = useSyncStore((s) => s.projects);\n const hosts = useSyncStore((s) => s.hosts);\n const tasks = useSyncStore((s) => s.tasks);\n const bp = useBreakpoint();\n const [fetchState, setFetchState] = useState<FetchState>({ status: \"idle\" });\n\n // REST fallback while the sync snapshot has not arrived (and for retry after a failure).\n const load = useCallback(async () => {\n setFetchState({ status: \"loading\" });\n try {\n const res = await apiGet<unknown>(\"/api/automations\");\n const list = Array.isArray(res)\n ? res\n : res && typeof res === \"object\" && Array.isArray((res as { items?: unknown }).items)\n ? (res as { items: unknown[] }).items\n : null;\n const parsed = list ? Automation.array().safeParse(list) : null;\n if (!parsed?.success) {\n setFetchState({\n status: \"fatal\",\n error: new Error(\"The coordinator returned automations in an unexpected format.\"),\n });\n return;\n }\n useLocalAutomations.getState().putMany(parsed.data);\n setFetchState({ status: \"done\" });\n } catch (e) {\n setFetchState({ status: \"error\", error: e });\n }\n }, []);\n\n useEffect(() => {\n if (!hydrated) void load();\n }, [hydrated, load]);\n\n const rows = useMemo(\n () => Object.values(automations).sort((a, b) => a.name.localeCompare(b.name)),\n [automations],\n );\n\n const haveData = hydrated || fetchState.status === \"done\";\n\n let body: ReactNode;\n if (!haveData) {\n if (fetchState.status === \"fatal\") body = <FatalError error={fetchState.error} />;\n else if (fetchState.status === \"error\")\n body = (\n <ErrorState\n title=\"Could not load automations\"\n error={fetchState.error}\n onRetry={() => void load()}\n />\n );\n else body = <LoadingState label=\"Loading automations…\" />;\n } else if (rows.length === 0) {\n body = (\n <EmptyState\n icon={<Workflow className=\"size-8\" />}\n title=\"No automations yet\"\n description=\"Automations create tasks on a schedule, from a webhook, or when another task is done.\"\n action={{ label: \"Create an automation\", to: NEW_PATH, icon: <Plus className=\"size-4\" /> }}\n />\n );\n } else {\n body = (\n <AutomationRows\n automations={rows}\n projects={projects}\n hosts={hosts}\n tasks={tasks}\n table={bp === \"desktop\"}\n />\n );\n }\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-4 px-4 py-4 md:px-6\">\n <header className=\"flex flex-wrap items-center justify-between gap-3\">\n <div className=\"min-w-0\">\n <h1 className=\"text-lg font-semibold\">Automations</h1>\n <p className=\"text-sm text-muted\">\n Scheduled, webhook and dependency automations. Routine successes stay in each\n automation's history.\n </p>\n </div>\n <Link to={NEW_PATH} className={buttonClasses(\"primary\")}>\n <Plus aria-hidden className=\"size-4\" />\n New automation\n </Link>\n </header>\n <ConnectionNote />\n {body}\n </div>\n );\n}\n\nconst TABLE_COLS =\n \"grid grid-cols-[minmax(0,2.4fr)_minmax(0,1fr)_5.5rem_minmax(0,1.2fr)_minmax(0,1.4fr)_7.5rem_7rem_auto] items-center gap-3\";\n\nfunction AutomationRows({\n automations,\n projects,\n hosts,\n tasks,\n table,\n}: {\n automations: Automation[];\n projects: Record<string, Project>;\n hosts: Record<string, Host>;\n tasks: Record<string, Task>;\n table: boolean;\n}) {\n const { busy: toggling, toggle } = useToggleEnabled();\n const { busy: running, run } = useRunNow();\n const taskTitle = useCallback((id: string) => tasks[id]?.title, [tasks]);\n\n return (\n <div className=\"min-w-0 overflow-hidden rounded-lg border border-border bg-surface\">\n {table && (\n <div\n aria-hidden\n className={cn(\n TABLE_COLS,\n \"border-b border-border bg-surface-2 px-4 py-2 text-xs font-medium text-muted\",\n )}\n >\n <span>Automation</span>\n <span>Project</span>\n <span>Mode</span>\n <span>Next occurrence</span>\n <span>Last outcome</span>\n <span>Failures</span>\n <span>Enabled</span>\n <span className=\"sr-only\">Actions</span>\n </div>\n )}\n <ul data-testid=\"automations-list\" className=\"divide-y divide-border\">\n {automations.map((a) => {\n const project = projects[a.projectId];\n const hostId = a.hostId ?? project?.defaultHostId ?? null;\n const host = hostId ? hosts[hostId] : undefined;\n const props: RowProps = {\n automation: a,\n projectName: project?.name ?? \"Unknown project\",\n host,\n trigger: describeTrigger(a.trigger, { taskTitle }),\n toggling: !!toggling[a.id],\n running: !!running[a.id],\n onToggle: (next) => void toggle(a, next),\n onRun: () => void run(a),\n };\n return (\n <li key={a.id} data-testid=\"automation-row\" data-automation-id={a.id}>\n {table ? <TableRow {...props} /> : <CardRow {...props} />}\n </li>\n );\n })}\n </ul>\n </div>\n );\n}\n\ninterface RowProps {\n automation: Automation;\n projectName: string;\n host: Host | undefined;\n trigger: string;\n toggling: boolean;\n running: boolean;\n onToggle: (next: boolean) => void;\n onRun: () => void;\n}\n\nfunction TriggerText({ automation, trigger }: { automation: Automation; trigger: string }) {\n const Icon = TRIGGER_ICONS[automation.trigger.kind];\n return (\n <span className=\"flex min-w-0 items-start gap-1.5 text-sm text-muted\">\n <Icon aria-hidden className=\"mt-0.5 size-3.5 shrink-0\" />\n <span className=\"min-w-0 break-words\">{trigger}</span>\n </span>\n );\n}\n\nfunction NextOccurrence({ automation }: { automation: Automation }) {\n if (!automation.enabled) return <span className=\"text-sm text-muted\">Paused (disabled)</span>;\n if (!automation.nextAt) {\n const k = automation.trigger.kind;\n const text =\n k === \"manual\"\n ? \"On demand\"\n : k === \"webhook\"\n ? \"On webhook\"\n : k === \"dependency\"\n ? \"When the task is done\"\n : \"None scheduled\";\n return <span className=\"text-sm text-muted\">{text}</span>;\n }\n return (\n <span className=\"flex min-w-0 flex-col text-sm\">\n <span>{formatRelative(automation.nextAt)}</span>\n <time dateTime={automation.nextAt} className=\"text-xs text-muted\">\n {formatAbsolute(automation.nextAt)}\n </time>\n </span>\n );\n}\n\nfunction HostWarning({ host }: { host: Host | undefined }) {\n if (!host || host.connectivity === \"connected\") return null;\n return (\n <span className=\"flex items-center gap-1 text-xs text-danger\">\n <WifiOff aria-hidden className=\"size-3.5 shrink-0\" />\n <span className=\"min-w-0 break-words\">\n Host {host.name} {host.connectivity === \"reconnecting\" ? \"reconnecting\" : \"unreachable\"}\n </span>\n </span>\n );\n}\n\nfunction RunButton({\n running,\n onRun,\n name,\n}: {\n running: boolean;\n onRun: () => void;\n name: string;\n}) {\n return (\n <Button\n size=\"sm\"\n busy={running}\n icon={<Play className=\"size-3.5\" />}\n onClick={onRun}\n aria-label={`Run ${name} now`}\n >\n Run now\n </Button>\n );\n}\n\nfunction TableRow(p: RowProps) {\n const a = p.automation;\n return (\n <div className={cn(TABLE_COLS, \"px-4 py-3\")}>\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n <Link\n to={editPath(a.id)}\n className=\"truncate font-medium text-text hover:underline focus-visible:underline\"\n >\n {a.name}\n </Link>\n <TriggerText automation={a} trigger={p.trigger} />\n </div>\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"sr-only\">Project: </span>\n <span className=\"truncate text-sm\">{p.projectName}</span>\n <HostWarning host={p.host} />\n </div>\n <span className=\"text-sm\">\n <span className=\"sr-only\">Mode: </span>\n {modeLabel(a.mode)}\n </span>\n <div className=\"min-w-0\">\n <span className=\"sr-only\">Next occurrence: </span>\n <NextOccurrence automation={a} />\n </div>\n <div className=\"min-w-0 text-sm break-words\">\n <span className=\"sr-only\">Last outcome: </span>\n {a.lastOutcome ?? <span className=\"text-muted\">No runs yet</span>}\n </div>\n <FailureCount count={a.failureCount} />\n <Switch\n checked={a.enabled}\n onChange={p.onToggle}\n busy={p.toggling}\n label={`Enable ${a.name}`}\n onText=\"Enabled\"\n offText=\"Disabled\"\n />\n <div className=\"flex items-center gap-1\">\n <RunButton running={p.running} onRun={p.onRun} name={a.name} />\n <Link\n to={editPath(a.id)}\n aria-label={`Edit ${a.name}`}\n title=\"Edit\"\n className=\"tap inline-flex size-9 items-center justify-center rounded-md text-muted hover:bg-surface-2 hover:text-text\"\n >\n <ChevronRight aria-hidden className=\"size-4\" />\n </Link>\n </div>\n </div>\n );\n}\n\nfunction CardRow(p: RowProps) {\n const a = p.automation;\n return (\n <div className=\"flex min-w-0 flex-col gap-2 px-4 py-3\">\n <div className=\"flex min-w-0 items-start justify-between gap-2\">\n <div className=\"flex min-w-0 flex-col gap-0.5\">\n <Link\n to={editPath(a.id)}\n className=\"font-medium break-words text-text hover:underline focus-visible:underline\"\n >\n {a.name}\n </Link>\n <TriggerText automation={a} trigger={p.trigger} />\n </div>\n <Switch\n checked={a.enabled}\n onChange={p.onToggle}\n busy={p.toggling}\n label={`Enable ${a.name}`}\n onText=\"Enabled\"\n offText=\"Disabled\"\n />\n </div>\n <dl className=\"grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-sm\">\n <dt className=\"text-muted\">Project</dt>\n <dd className=\"flex min-w-0 flex-col break-words\">\n {p.projectName}\n <HostWarning host={p.host} />\n </dd>\n <dt className=\"text-muted\">Mode</dt>\n <dd>{modeLabel(a.mode)}</dd>\n <dt className=\"text-muted\">Next</dt>\n <dd className=\"min-w-0\">\n <NextOccurrence automation={a} />\n </dd>\n <dt className=\"text-muted\">Last outcome</dt>\n <dd className=\"min-w-0 break-words\">\n {a.lastOutcome ?? <span className=\"text-muted\">No runs yet</span>}\n </dd>\n <dt className=\"text-muted\">Failures</dt>\n <dd>\n <FailureCount count={a.failureCount} />\n </dd>\n </dl>\n <div className=\"flex flex-wrap gap-2\">\n <RunButton running={p.running} onRun={p.onRun} name={a.name} />\n <Link to={editPath(a.id)} className={buttonClasses(\"ghost\", \"sm\")}>\n Edit\n <ChevronRight aria-hidden className=\"size-3.5\" />\n </Link>\n </div>\n </div>\n );\n}\n"],"ignoreList":[0],"mappings":"A,+nBASA,IAAMuC,EAAa,CACjB,KAAM,UACN,KAAM,GACN,KAAM,CACJ,CACE,OACA,CACE,EAAG,2EACH,IAAK,QACP,CACF,EACA,CAAC,OAAQ,CAAE,EAAG,4DAA6D,IAAK,QAAS,CAAC,EAC1F,CAAC,OAAQ,CAAE,EAAG,yDAA0D,IAAK,QAAS,CAAC,CACzF,CACF,EACAA,EAAW,KACX,IAAMC,EAAUlC,EAAiBiC,CAAU,E,iBCSrCI,EAAW,mBACXC,EAAY,GAAe,gBAAgB,mBAAmBC,CAAE,IAEhEC,EAAiD,CACrD,OAAQ1B,EACR,KAAMc,EACN,KAAMhB,EACN,QAASsB,EACT,WAAYnB,CACd,EAQA,SAAwB0B,GAAkB,CACxC,IAAMC,EAAWxC,EAAc,GAAMyC,EAAE,QAAQ,EACzCC,EAAcvB,EAAqB,EACnCwB,EAAW3C,EAAc,GAAMyC,EAAE,QAAQ,EACzCG,EAAQ5C,EAAc,GAAMyC,EAAE,KAAK,EACnCI,EAAQ7C,EAAc,GAAMyC,EAAE,KAAK,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x-runtime-D13aM9HY.js";import{i as c,t as l}from"./Badge-BiDp7NKI.js";import{A as u,E as d,F as f,G as p,P as m,S as h,W as g,a as _,b as v,c as y,d as b,f as x,h as S,i as C,l as w,m as T,n as E,o as D,p as ee,t as O,u as k,x as te,y as A}from"./states--geW2Ntl.js";import{i as j,n as M,r as N,t as P}from"./Menu-BDt1bxwz.js";import{t as ne}from"./arrow-left-C6YWM6y6.js";import{c as re,n as ie,r as F,t as ae}from"./Tabs-ByiPklAw.js";import{t as oe}from"./server-SxFxIScj.js";import{t as se}from"./chevron-right-evVLS6hq.js";import{t as I}from"./external-link-3jjTxo92.js";import{A as ce,C as le,D as ue,E as de,M as fe,N as L,O as pe,P as me,S as he,T as ge,_ as _e,a as ve,b as ye,c as R,d as be,f as z,g as B,h as xe,i as Se,j as Ce,k as we,l as Te,m as Ee,n as De,o as Oe,p as ke,r as Ae,s as je,t as Me,u as Ne,v as Pe,w as Fe,x as Ie,y as Le}from"./useNow-jxdoOC_1.js";import{n as Re,t as ze}from"./pencil-DI8QbCN8.js";import{t as Be}from"./link-2-CaMlUDRG.js";import{t as Ve}from"./play-CjoDg3ws.js";import{t as He}from"./plus-BLP-wIYD.js";import{t as Ue}from"./trash-C6X2OLrI.js";import{D as We,F as Ge,P as Ke,T as qe,a as Je,c as Ye,d as Xe,f as Ze,j as Qe,l as V,p as $e,r as et,s as tt,t as H,u as nt,v as rt,w as it,y as at}from"./index-vIzH1m8u.js";import{a as ot,i as st,n as ct,r as lt,s as ut,t as dt}from"./TextArea-BYr88SnV.js";import{c as ft}from"./dist-BE_V9dwJ.js";import{t as pt}from"./SegmentedControl-D-2BCZzd.js";var mt={name:`arrow-right-left`,size:24,node:[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]};mt.node;var ht=a(mt),gt={name:`chevrons-up`,size:24,node:[[`path`,{d:`m17 11-5-5-5 5`,key:`e8nh98`}],[`path`,{d:`m17 18-5-5-5 5`,key:`2avn1x`}]]};gt.node;var _t=a(gt),vt={name:`columns-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]],aliases:[`panels-left-right`]};vt.node;var yt=a(vt),bt={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};bt.node;var xt=a(bt),St={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};St.node;var Ct=a(St),wt={name:`message-square-warning`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M12 15h.01`,key:`q59x07`}],[`path`,{d:`M12 7v4`,key:`xawao1`}]]};wt.node;var Tt=a(wt),Et={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};Et.node;var Dt=a(Et),Ot={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};Ot.node;var kt=a(Ot),At=c(),U=e(i()),jt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Mt(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Nt(e){return`nodeType`in e}function W(e){return e?Mt(e)?e:Nt(e)?e.ownerDocument?.defaultView??window:window:window}function Pt(e){let{Document:t}=W(e);return e instanceof t}function Ft(e){return!Mt(e)&&e instanceof W(e).HTMLElement}function It(e){return e instanceof W(e).SVGElement}function Lt(e){return e?Mt(e)?e.document:Nt(e)?Pt(e)?e:Ft(e)||It(e)?e.ownerDocument:document:document:document}var G=jt?U.useLayoutEffect:U.useEffect;function Rt(e){let t=(0,U.useRef)(e);return G(()=>{t.current=e}),(0,U.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function zt(){let e=(0,U.useRef)(null);return[(0,U.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,U.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function Bt(e,t){t===void 0&&(t=[e]);let n=(0,U.useRef)(e);return G(()=>{n.current!==e&&(n.current=e)},t),n}function Vt(e,t){let n=(0,U.useRef)();return(0,U.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Ht(e){let t=Rt(e),n=(0,U.useRef)(null);return[n,(0,U.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Ut(e){let t=(0,U.useRef)();return(0,U.useEffect)(()=>{t.current=e},[e]),t.current}var Wt={};function Gt(e,t){return(0,U.useMemo)(()=>{if(t)return t;let n=Wt[e]==null?0:Wt[e]+1;return Wt[e]=n,e+`-`+n},[e,t])}function Kt(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var qt=Kt(1),Jt=Kt(-1);function Yt(e){return`clientX`in e&&`clientY`in e}function Xt(e){if(!e)return!1;let{KeyboardEvent:t}=W(e.target);return t&&e instanceof t}function Zt(e){if(!e)return!1;let{TouchEvent:t}=W(e.target);return t&&e instanceof t}function Qt(e){if(Zt(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Yt(e)?{x:e.clientX,y:e.clientY}:null}var $t=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[$t.Translate.toString(e),$t.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),en=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function tn(e){return e.matches(en)?e:e.querySelector(en)}var nn={display:`none`};function rn(e){let{id:t,value:n}=e;return U.createElement(`div`,{id:t,style:nn},n)}function an(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return U.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function on(){let[e,t]=(0,U.useState)(``);return{announce:(0,U.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var sn=(0,U.createContext)(null);function cn(e){let t=(0,U.useContext)(sn);(0,U.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function ln(){let[e]=(0,U.useState)(()=>new Set),t=(0,U.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,U.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var un={draggable:`
|
|
2
|
+
To pick up a draggable item, press the space bar.
|
|
3
|
+
While dragging, use the arrow keys to move the item.
|
|
4
|
+
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
+
`},dn={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function fn(e){let{announcements:t=dn,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=un}=e,{announce:a,announcement:o}=on(),s=Gt(`DndLiveRegion`),[c,l]=(0,U.useState)(!1);if((0,U.useEffect)(()=>{l(!0)},[]),cn((0,U.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=U.createElement(U.Fragment,null,U.createElement(rn,{id:r,value:i.draggable}),U.createElement(an,{id:s,announcement:o}));return n?(0,At.createPortal)(u,n):u}var K;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(K||={});function pn(){}function mn(e,t){return(0,U.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function hn(){var e=[...arguments];return(0,U.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var q=Object.freeze({x:0,y:0});function gn(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function _n(e,t){let n=Qt(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function vn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function yn(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function bn(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function xn(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Sn(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var Cn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=Sn(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=gn(Sn(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(vn)};function wn(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var Tn=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=wn(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(yn)};function En(e,t){let{top:n,left:r,bottom:i,right:a}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=a}var Dn=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];let i=[];for(let e of t){let{id:t}=e,a=n.get(t);if(a&&En(r,a)){let n=bn(a).reduce((e,t)=>e+gn(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(vn)};function On(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function kn(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:q}function An(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var jn=An(1);function Mn(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function Nn(e,t,n){let r=Mn(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var Pn={ignoreTransform:!1};function Fn(e,t){t===void 0&&(t=Pn);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=W(e).getComputedStyle(e);t&&(n=Nn(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function In(e){return Fn(e,{ignoreTransform:!0})}function Ln(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Rn(e,t){return t===void 0&&(t=W(e).getComputedStyle(e)),t.position===`fixed`}function zn(e,t){t===void 0&&(t=W(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function Bn(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(Pt(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!Ft(i)||It(i)||n.includes(i))return n;let a=W(e).getComputedStyle(i);return i!==e&&zn(i,a)&&n.push(i),Rn(i,a)?n:r(i.parentNode)}return e?r(e):n}function Vn(e){let[t]=Bn(e,1);return t??null}function Hn(e){return!jt||!e?null:Mt(e)?e:Nt(e)?Pt(e)||e===Lt(e).scrollingElement?window:Ft(e)?e:null:null}function Un(e){return Mt(e)?e.scrollX:e.scrollLeft}function Wn(e){return Mt(e)?e.scrollY:e.scrollTop}function Gn(e){return{x:Un(e),y:Wn(e)}}var J;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(J||={});function Kn(e){return!jt||!e?!1:e===document.scrollingElement}function qn(e){let t={x:0,y:0},n=Kn(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Jn={x:.2,y:.2};function Yn(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Jn);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=qn(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=J.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=J.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=J.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=J.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Xn(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function Zn(e){return e.reduce((e,t)=>qt(e,Gn(t)),q)}function Qn(e){return e.reduce((e,t)=>e+Un(t),0)}function $n(e){return e.reduce((e,t)=>e+Wn(t),0)}function er(e,t){if(t===void 0&&(t=Fn),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Vn(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var tr=[[`x`,[`left`,`right`],Qn],[`y`,[`top`,`bottom`],$n]],nr=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Bn(t),r=Zn(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of tr)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},rr=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function ir(e){let{EventTarget:t}=W(e);return e instanceof t?e:Lt(e)}function ar(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var Y;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(Y||={});function or(e){e.preventDefault()}function sr(e){e.stopPropagation()}var X;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(X||={});var cr={start:[X.Space,X.Enter],cancel:[X.Esc],end:[X.Space,X.Enter,X.Tab]},lr=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case X.Right:return{...n,x:n.x+25};case X.Left:return{...n,x:n.x-25};case X.Down:return{...n,y:n.y+25};case X.Up:return{...n,y:n.y-25}}},ur=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new rr(Lt(t)),this.windowListeners=new rr(W(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Y.Resize,this.handleCancel),this.windowListeners.add(Y.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Y.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&er(n),t(q)}handleKeyDown(e){if(Xt(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=cr,coordinateGetter:a=lr,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:q;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Jt(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=qn(n),p=Xn(n),m={x:Math.min(i===X.Right?p.right-p.width/2:p.right,Math.max(i===X.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===X.Down?p.bottom-p.height/2:p.bottom,Math.max(i===X.Down?p.top:p.top+p.height/2,u.y))},h=i===X.Right&&!s||i===X.Left&&!c,g=i===X.Down&&!l||i===X.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===X.Right&&e<=d.x||i===X.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===X.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===X.Down&&e<=d.y||i===X.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===X.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,qt(Jt(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};ur.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=cr,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function dr(e){return!!(e&&`distance`in e)}function fr(e){return!!(e&&`delay`in e)}var pr=class{constructor(e,t,n){n===void 0&&(n=ir(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Lt(i),this.documentListeners=new rr(this.document),this.listeners=new rr(n),this.windowListeners=new rr(W(i)),this.initialCoordinates=Qt(r)??q,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Y.Resize,this.handleCancel),this.windowListeners.add(Y.DragStart,or),this.windowListeners.add(Y.VisibilityChange,this.handleCancel),this.windowListeners.add(Y.ContextMenu,or),this.documentListeners.add(Y.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(fr(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(dr(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(Y.Click,sr,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Y.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Qt(e)??q,s=Jt(n,o);if(!t&&a){if(dr(a)){if(a.tolerance!=null&&ar(s,a.tolerance))return this.handleCancel();if(ar(s,a.distance))return this.handleStart()}if(fr(a)&&ar(s,a.tolerance))return this.handleCancel();this.handlePending(a,s)}else e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===X.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},mr={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},hr=class extends pr{constructor(e){let{event:t}=e,n=Lt(t.target);super(e,mr,n)}};hr.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var gr={move:{name:`mousemove`},end:{name:`mouseup`}},_r;(function(e){e[e.RightClick=2]=`RightClick`})(_r||={});var vr=class extends pr{constructor(e){super(e,gr,Lt(e.event.target))}};vr.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==_r.RightClick&&(r?.({event:n}),!0)}}];var yr={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},br=class extends pr{constructor(e){super(e,yr)}static setup(){return window.addEventListener(yr.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(yr.move.name,e)};function e(){}}};br.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var xr;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(xr||={});var Sr;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Sr||={});function Cr(e){let{acceleration:t,activator:n=xr.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Sr.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=Tr({delta:d,disabled:!a}),[m,h]=zt(),g=(0,U.useRef)({x:0,y:0}),_=(0,U.useRef)({x:0,y:0}),v=(0,U.useMemo)(()=>{switch(n){case xr.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case xr.DraggableRect:return i}},[n,i,c]),y=(0,U.useRef)(null),b=(0,U.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,U.useMemo)(()=>s===Sr.TreeOrder?[...l].reverse():l,[s,l]);(0,U.useEffect)(()=>{if(!a||!l.length||!v)h();else{for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=Yn(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()}},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var wr={x:{[J.Backward]:!1,[J.Forward]:!1},y:{[J.Backward]:!1,[J.Forward]:!1}};function Tr(e){let{delta:t,disabled:n}=e,r=Ut(t);return Vt(e=>{if(n||!r||!e)return wr;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[J.Backward]:e.x[J.Backward]||i.x===-1,[J.Forward]:e.x[J.Forward]||i.x===1},y:{[J.Backward]:e.y[J.Backward]||i.y===-1,[J.Forward]:e.y[J.Forward]||i.y===1}}},[n,t,r])}function Er(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return Vt(e=>t==null?null:r??e??null,[r,t])}function Dr(e,t){return(0,U.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var Or;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(Or||={});var kr;(function(e){e.Optimized=`optimized`})(kr||={});var Ar=new Map;function jr(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,U.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,U.useRef)(e),d=g(),f=Bt(d),p=(0,U.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,U.useRef)(null),h=Vt(t=>{if(d&&!n)return Ar;if(!t||t===Ar||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new nr(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,U.useEffect)(()=>{u.current=e},[e]),(0,U.useEffect)(()=>{d||p()},[n,d]),(0,U.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,U.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case Or.Always:return!1;case Or.BeforeDragging:return n;default:return!n}}}function Mr(e,t){return Vt(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Nr(e,t){return Mr(e,t)}function Pr(e){let{callback:t,disabled:n}=e,r=Rt(t),i=(0,U.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,U.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Fr(e){let{callback:t,disabled:n}=e,r=Rt(t),i=(0,U.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,U.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Ir(e){return new nr(Fn(e),e)}function Lr(e,t,n){t===void 0&&(t=Ir);let[r,i]=(0,U.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=Pr({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=Fr({callback:a});return G(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Rr(e){return kn(e,Mr(e))}var zr=[];function Br(e){let t=(0,U.useRef)(e),n=Vt(n=>e?n&&n!==zr&&e&&t.current&&e.parentNode===t.current.parentNode?n:Bn(e):zr,[e]);return(0,U.useEffect)(()=>{t.current=e},[e]),n}function Vr(e){let[t,n]=(0,U.useState)(null),r=(0,U.useRef)(e),i=(0,U.useCallback)(e=>{let t=Hn(e.target);t&&n(e=>e?(e.set(t,Gn(t)),new Map(e)):null)},[]);return(0,U.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Hn(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,Gn(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Hn(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,U.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>qt(e,t),q):Zn(e):q,[e,t])}function Hr(e,t){t===void 0&&(t=[]);let n=(0,U.useRef)(null);return(0,U.useEffect)(()=>{n.current=null},t),(0,U.useEffect)(()=>{let t=e!==q;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Jt(e,n.current):q}function Ur(e){(0,U.useEffect)(()=>{if(!jt)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function Wr(e,t){return(0,U.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function Gr(e){return(0,U.useMemo)(()=>e?Ln(e):null,[e])}var Kr=[];function qr(e,t){t===void 0&&(t=Fn);let[n]=e,r=Gr(n?W(n):null),[i,a]=(0,U.useState)(Kr);function o(){a(()=>e.length?e.map(e=>Kn(e)?r:new nr(t(e),e)):Kr)}let s=Fr({callback:o});return G(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Jr(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return Ft(t)?t:e}function Yr(e){let{measure:t}=e,[n,r]=(0,U.useState)(null),i=Fr({callback:(0,U.useCallback)(e=>{for(let{target:n}of e)if(Ft(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Ht((0,U.useCallback)(e=>{let n=Jr(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,U.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var Xr=[{sensor:hr,options:{}},{sensor:ur,options:{}}],Zr={current:{}},Qr={draggable:{measure:In},droppable:{measure:In,strategy:Or.WhileDragging,frequency:kr.Optimized},dragOverlay:{measure:Fn}},$r=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},ei={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new $r,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:pn},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Qr,measureDroppableContainers:pn,windowRect:null,measuringScheduled:!1},ti={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:pn,draggableNodes:new Map,over:null,measureDroppableContainers:pn},ni=(0,U.createContext)(ti),ri=(0,U.createContext)(ei);function ii(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new $r}}}function ai(e,t){switch(t.type){case K.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case K.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case K.DragEnd:case K.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case K.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new $r(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case K.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new $r(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case K.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new $r(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function oi(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,U.useContext)(ni),a=Ut(r),o=Ut(n?.id);return(0,U.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!Xt(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=tn(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function si(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function ci(e){return(0,U.useMemo)(()=>({draggable:{...Qr.draggable,...e?.draggable},droppable:{...Qr.droppable,...e?.droppable},dragOverlay:{...Qr.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function li(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,U.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;G(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=kn(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Vn(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var ui=(0,U.createContext)({...q,scaleX:1,scaleY:1}),di;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(di||={});var fi=(0,U.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=Xr,collisionDetection:o=Tn,measuring:s,modifiers:c,...l}=e,[u,d]=(0,U.useReducer)(ai,void 0,ii),[f,p]=ln(),[m,h]=(0,U.useState)(di.Uninitialized),g=m===di.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),S=(0,U.useRef)({initial:null,translated:null}),C=(0,U.useMemo)(()=>_==null?null:{id:_,data:x?.data??Zr,rect:S},[_,x]),w=(0,U.useRef)(null),[T,E]=(0,U.useState)(null),[D,ee]=(0,U.useState)(null),O=Bt(l,Object.values(l)),k=Gt(`DndDescribedBy`,t),te=(0,U.useMemo)(()=>b.getEnabled(),[b]),A=ci(s),{droppableRects:j,measureDroppableContainers:M,measuringScheduled:N}=jr(te,{dragging:g,dependencies:[y.x,y.y],config:A.droppable}),P=Er(v,_),ne=(0,U.useMemo)(()=>D?Qt(D):null,[D]),re=Oe(),ie=Nr(P,A.draggable.measure);li({activeNode:_==null?null:v.get(_),config:re.layoutShiftCompensation,initialRect:ie,measure:A.draggable.measure});let F=Lr(P,A.draggable.measure,ie),ae=Lr(P?P.parentElement:null),oe=(0,U.useRef)({activatorEvent:null,active:null,activeNode:P,collisionRect:null,collisions:null,droppableRects:j,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),se=b.getNodeFor(oe.current.over?.id),I=Yr({measure:A.dragOverlay.measure}),ce=I.nodeRef.current??P,le=g?I.rect??F:null,ue=!!(I.nodeRef.current&&I.rect),de=Rr(ue?null:F),fe=Gr(ce?W(ce):null),L=Br(g?se??P:null),pe=qr(L),me=si(c,{transform:{x:y.x-de.x,y:y.y-de.y,scaleX:1,scaleY:1},activatorEvent:D,active:C,activeNodeRect:F,containerNodeRect:ae,draggingNodeRect:le,over:oe.current.over,overlayNodeRect:I.rect,scrollableAncestors:L,scrollableAncestorRects:pe,windowRect:fe}),he=ne?qt(ne,y):null,ge=Vr(L),_e=Hr(ge),ve=Hr(ge,[F]),ye=qt(me,_e),R=le?jn(le,me):null,be=C&&R?o({active:C,collisionRect:R,droppableRects:j,droppableContainers:te,pointerCoordinates:he}):null,z=xn(be,`id`),[B,xe]=(0,U.useState)(null),Se=On(ue?me:qt(me,ve),B?.rect??null,F),Ce=(0,U.useRef)(null),we=(0,U.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(w.current==null)return;let i=v.get(w.current);if(!i)return;let a=e.nativeEvent,o=new n({active:w.current,activeNode:i,event:a,options:r,context:oe,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=O.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=O.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=w.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=O.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:S}};(0,At.unstable_batchedUpdates)(()=>{r?.(i),h(di.Initializing),d({type:K.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),E(Ce.current),ee(a)})},onMove(e){d({type:K.DragMove,coordinates:e})},onEnd:s(K.DragEnd),onCancel:s(K.DragCancel)});Ce.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=oe.current,o=null;if(t&&i){let{cancelDrop:s}=O.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===K.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=K.DragCancel)}w.current=null,(0,At.unstable_batchedUpdates)(()=>{d({type:e}),h(di.Uninitialized),xe(null),E(null),ee(null),Ce.current=null;let t=e===K.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=O.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),Te=Dr(a,(0,U.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(w.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},w.current=r,we(n,t))},[v,we]));Ur(a),G(()=>{F&&m===di.Initializing&&h(di.Initialized)},[F,m]),(0,U.useEffect)(()=>{let{onDragMove:e}=O.current,{active:t,activatorEvent:n,collisions:r,over:i}=oe.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:ye.x,y:ye.y},over:i};(0,At.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[ye.x,ye.y]),(0,U.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=oe.current;if(!e||w.current==null||!t||!i)return;let{onDragOver:a}=O.current,o=r.get(z),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,At.unstable_batchedUpdates)(()=>{xe(s),a?.(c),f({type:`onDragOver`,event:c})})},[z]),G(()=>{oe.current={activatorEvent:D,active:C,activeNode:P,collisionRect:R,collisions:be,droppableRects:j,draggableNodes:v,draggingNode:ce,draggingNodeRect:le,droppableContainers:b,over:B,scrollableAncestors:L,scrollAdjustedTranslate:ye},S.current={initial:le,translated:R}},[C,P,be,R,v,ce,le,j,b,B,L,ye]),Cr({...re,delta:y,draggingRect:R,pointerCoordinates:he,scrollableAncestors:L,scrollableAncestorRects:pe});let Ee=(0,U.useMemo)(()=>({active:C,activeNode:P,activeNodeRect:F,activatorEvent:D,collisions:be,containerNodeRect:ae,dragOverlay:I,draggableNodes:v,droppableContainers:b,droppableRects:j,over:B,measureDroppableContainers:M,scrollableAncestors:L,scrollableAncestorRects:pe,measuringConfiguration:A,measuringScheduled:N,windowRect:fe}),[C,P,F,D,be,ae,I,v,b,j,B,M,L,pe,A,N,fe]),De=(0,U.useMemo)(()=>({activatorEvent:D,activators:Te,active:C,activeNodeRect:F,ariaDescribedById:{draggable:k},dispatch:d,draggableNodes:v,over:B,measureDroppableContainers:M}),[D,Te,C,F,d,k,v,B,M]);return U.createElement(sn.Provider,{value:p},U.createElement(ni.Provider,{value:De},U.createElement(ri.Provider,{value:Ee},U.createElement(ui.Provider,{value:Se},i)),U.createElement(oi,{disabled:n?.restoreFocus===!1})),U.createElement(fn,{...n,hiddenTextDescribedById:k}));function Oe(){let e=T?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),pi=(0,U.createContext)(null),mi=`button`,hi=`Draggable`;function gi(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Gt(hi),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,U.useContext)(ni),{role:p=mi,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,U.useContext)(g?ui:pi),[v,y]=Ht(),[b,x]=Ht(),S=Wr(o,t),C=Bt(n);return G(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:C}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,U.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===mi?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:S,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function _i(){return(0,U.useContext)(ri)}var vi=`Droppable`,yi={timeout:25};function bi(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Gt(vi),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,U.useContext)(ni),u=(0,U.useRef)({disabled:n}),d=(0,U.useRef)(!1),f=(0,U.useRef)(null),p=(0,U.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...yi,...i},_=Bt(h??r),v=Fr({callback:(0,U.useCallback)(()=>{d.current?(p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)):d.current=!0},[g]),disabled:m||!o}),[y,b]=Ht((0,U.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=Bt(t);return(0,U.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,U.useEffect)(()=>(s({type:K.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:K.UnregisterDroppable,key:a,id:r})),[r]),(0,U.useEffect)(()=>{n!==u.current.disabled&&(s({type:K.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function xi(e){let{animation:t,children:n}=e,[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),s=Ut(n);return!n&&!r&&s&&i(s),G(()=>{if(!a)return;let e=r?.key,n=r?.props.id;e==null||n==null?i(null):Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),U.createElement(U.Fragment,null,n,r?(0,U.cloneElement)(r,{ref:o}):null)}var Si={x:0,y:0,scaleX:1,scaleY:1};function Ci(e){let{children:t}=e;return U.createElement(ni.Provider,{value:ti},U.createElement(ui.Provider,{value:Si},t))}var wi={position:`fixed`,touchAction:`none`},Ti=e=>Xt(e)?`transform 250ms ease`:void 0,Ei=(0,U.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Ti}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...wi,width:s.width,height:s.height,top:s.top,left:s.left,transform:$t.Transform.toString(d),transformOrigin:i&&r?_n(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return U.createElement(n,{className:o,style:f,ref:t},a)}),Di={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:$t.Transform.toString(t)},{transform:$t.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function Oi(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return Rt((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Jr(a);if(!c)return;let{transform:l}=W(a).getComputedStyle(a),u=Mn(l);if(!u)return;let d=typeof t==`function`?t:ki(t);return er(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function ki(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...Di,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var Ai=0;function ji(e){return(0,U.useMemo)(()=>{if(e!=null)return Ai++,Ai},[e])}var Mi=U.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=_i(),S=(0,U.useContext)(ui),C=ji(d?.id),w=si(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:S,windowRect:x}),T=Mr(f),E=Oi({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),D=T?g.setRef:void 0;return U.createElement(Ci,null,U.createElement(xi,{animation:E},d&&C?U.createElement(Ei,{key:C,id:d.id,ref:D,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:T,style:{zIndex:l,...i},transform:w},n):null))}),Z=o(),Ni=(0,U.createContext)(null);function Pi(){let e=(0,U.useContext)(Ni);if(!e)throw Error(`useTaskMover must be used inside <MoveProvider>`);return e}var Fi=`Accepting marks the task Done. It does not merge or push.`;function Ii({children:e}){let[t,n]=(0,U.useState)({}),[r,i]=(0,U.useState)(null),[a,o]=(0,U.useState)(null),s=(0,U.useCallback)(async(e,t)=>{n(t=>({...t,[e]:!0}));try{await t()}finally{n(t=>{let{[e]:n,...r}=t;return r})}},[]),c=(0,U.useCallback)(async(e,t)=>{if(t===`ready`)try{let t=await ue(e.id);V.success(`Moved to Ready. ${B(t)}.`)}catch{V.success(`Moved to Ready. The dispatcher starts it when it is eligible.`)}else V.success(`Moved "${e.title}" to ${z[t]}`)},[]),l=(0,U.useCallback)(async(e,t,n)=>{try{return await we(e.id,{to:t,...n}),await c(e,t),!0}catch(r){return!n.onRunning&&Ce(r)?(i({kind:`choice`,task:e,to:t,position:n.position,reasons:[],carry:{confirm:n.confirm}}),!1):!n.confirm&&ce(r)?(i({kind:`confirm_done`,task:e,to:t,position:n.position,reasons:[g(r)],carry:{onRunning:n.onRunning}}),!1):(V.error(`Could not move "${e.title}": ${g(r)}`),!1)}},[c]),u=(0,U.useCallback)(e=>s(e.id,async()=>{try{await L(e.id,`run-now`),V.info(`Dispatch requested for "${e.title}". Waiting for the host to confirm.`)}catch(t){V.error(`Cannot run "${e.title}" now: ${g(t)}`)}}),[s]),d=(0,U.useCallback)(e=>s(e.id,async()=>{try{await L(e.id,`new-attempt`),V.info(`New attempt requested for "${e.title}".`)}catch(t){if(p(t,`native_session_missing`)){i({kind:`fresh_attempt`,task:e,to:`in_progress`,reasons:[g(t)]});return}V.error(`Could not start a new attempt: ${g(t)}`)}}),[s]),f=(0,U.useCallback)(async(e,t,n={})=>{let r=e.currentRunId?m.getState().runs[e.currentRunId]:void 0,a=Ie(e,t,r);switch(a.kind){case`noop`:return;case`invalid`:V.error(a.reason);return;case`run_now`:return u(e);case`new_attempt`:return d(e);case`choose_running`:i({kind:`choice`,task:e,to:t,position:n.position,reasons:[]});return;case`confirm_done`:i({kind:`confirm_done`,task:e,to:t,position:n.position,reasons:a.reasons});return;case`move`:await s(e.id,async()=>{await l(e,t,{position:n.position})})}},[u,d,l,s]),h=(0,U.useCallback)((e,t)=>s(e.id,async()=>{try{await me(e.id,{position:t})}catch(e){V.error(`Could not reorder: ${g(e)}`)}}),[s]),_=async e=>{if(!r)return;let t=r;o(e);try{if(t.kind===`fresh_attempt`)try{await L(t.task.id,`new-attempt`,{},`?fresh=true`),V.info(`New attempt in a fresh session requested for "${t.task.title}".`)}catch(e){V.error(`Could not start a new attempt: ${g(e)}`)}else t.via===`accept`?await s(t.task.id,async()=>{try{await L(t.task.id,`accept`,{confirm:!0}),V.success(`Accepted "${t.task.title}". It is Done.`)}catch(e){V.error(`Could not accept: ${g(e)}`)}}):await s(t.task.id,async()=>{await l(t.task,t.to,{position:t.position,...t.carry,...e===`confirm`?{confirm:!0}:{onRunning:e}})})}finally{o(null),i(e=>e===t?null:e)}},v=(0,U.useCallback)(e=>s(e.id,async()=>{try{await L(e.id,`accept`,{}),V.success(`Accepted "${e.title}". It is Done.`)}catch(t){if(ce(t)){i({kind:`confirm_done`,task:e,to:`done`,reasons:[g(t)],via:`accept`});return}V.error(`Could not accept: ${g(t)}`)}}),[s]),y=(0,U.useMemo)(()=>({move:f,runNow:u,newAttempt:d,reorder:h,accept:v,isBusy:e=>!!t[e]}),[f,u,d,h,v,t]),b=()=>{a||i(null)};return(0,Z.jsxs)(Ni.Provider,{value:y,children:[e,(0,Z.jsx)(lt,{open:r?.kind===`choice`,onClose:b,title:`This task is running`,description:r?`Moving "${r.task.title}" to ${z[r.to]} needs a decision about its active run. Nothing changes until you choose.`:void 0,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(w,{onClick:b,disabled:!!a,children:`Keep running`}),(0,Z.jsx)(w,{icon:(0,Z.jsx)(Qe,{className:`size-4`}),busy:a===`pause`,disabled:!!a,onClick:()=>void _(`pause`),children:`Pause automation`}),(0,Z.jsx)(w,{variant:`danger`,icon:(0,Z.jsx)(rt,{className:`size-4`}),busy:a===`stop`,disabled:!!a,onClick:()=>void _(`stop`),children:`Stop execution`})]}),children:(0,Z.jsxs)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:[(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Pause automation`}),`: you take over the session. The agent keeps its current turn, and automatic continuations, retries and successor runs stop until you return it to automation.`]}),(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Stop execution`}),`: aborts the current run. The session and its workspace are kept.`]})]})}),(0,Z.jsxs)(lt,{open:r?.kind===`confirm_done`,onClose:b,title:`Accept and mark Done?`,description:Fi,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(w,{onClick:b,disabled:!!a,children:`Cancel`}),(0,Z.jsx)(w,{variant:`primary`,busy:a===`confirm`,disabled:!!a,onClick:()=>void _(`confirm`),children:`Accept and mark Done`})]}),children:[(0,Z.jsx)(`p`,{className:`mb-2 text-sm`,children:`These items are unresolved:`}),(0,Z.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-sm`,children:r?.reasons.map(e=>(0,Z.jsx)(`li`,{children:e},e))}),r&&r.task.acceptanceCriteria.length>0&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`p`,{className:`mt-3 mb-1 text-sm font-medium`,children:`Acceptance criteria`}),(0,Z.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-sm text-muted`,children:r.task.acceptanceCriteria.map(e=>(0,Z.jsx)(`li`,{children:e},e))})]})]}),(0,Z.jsx)(lt,{open:r?.kind===`fresh_attempt`,onClose:b,title:`Start a fresh session?`,description:r?.reasons[0],footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(w,{onClick:b,disabled:!!a,children:`Cancel`}),(0,Z.jsx)(w,{variant:`primary`,busy:a===`confirm`,onClick:()=>void _(`confirm`),children:`Start fresh session`})]}),children:(0,Z.jsx)(`p`,{className:`text-sm`,children:`The previous Pi session is no longer available on the host, so the new attempt cannot continue it. A fresh session starts with the task objective and your review feedback.`})})]})}var Li={0:{label:ft[0],icon:_t,tone:`danger`},1:{label:ft[1],icon:re,tone:`warning`},2:{label:ft[2],icon:Dt,tone:`neutral`},3:{label:ft[3],icon:j,tone:`neutral`}};function Ri(e){let t=m(e=>e.runs),n=m(e=>e.hosts),r=m(e=>e.sessions),i=m(e=>e.workspaces),a=m(e=>e.projects),o=m(e=>e.attention),s=m(e=>e.interactions);return(0,U.useMemo)(()=>{if(!e)return{run:void 0,hostName:null,hostOffline:!1,branch:null,projectName:null,attention:[],pendingInteraction:void 0};let c=e.currentRunId?t[e.currentRunId]:void 0,l=e.sessionId?r[e.sessionId]:void 0,u=c?.hostId??l?.hostId??e.policy.hostId??null,d=u?n[u]:void 0,f=(l?.workspaceId?i[l.workspaceId]:void 0)?.branch??(e.policy.workspace.mode===`new_worktree`?e.policy.workspace.branch:null)??(e.policy.workspace.mode===`existing`?i[e.policy.workspace.workspaceId]?.branch??null:null),p=Object.values(o).filter(t=>!t.resolvedAt&&(t.taskId===e.id||!!e.sessionId&&t.sessionId===e.sessionId)),m=e.sessionId?Object.values(s).filter(t=>t.sessionId===e.sessionId&&t.state===`pending`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt))[0]:void 0;return{run:c,hostName:d?.name??null,hostOffline:!!d&&d.connectivity!==`connected`,branch:f??null,projectName:a[e.projectId]?.name??null,attention:p,pendingInteraction:m}},[e,t,n,r,i,a,o,s])}function zi(e,t,n){if(e.blocked)return{icon:te,text:`Blocked: ${e.blocked.reason}`,tone:`danger`};if(e.state===`in_progress`&&t){let e=Xe[t.state],n=t.controlMode===`human`?` · You have control`:``;return{icon:e.icon,text:`${e.label}${n}`,tone:e.tone,spin:e.spin,pulse:e.pulse}}return e.state===`ready`?n&&!n.eligible?{icon:We,text:n.message||ke[n.wait],tone:`warning`}:n?.eligible?{icon:We,text:`Starting on ${n.hostName}`,tone:`info`}:{icon:We,text:`Queued for dispatch`,tone:`neutral`}:e.state===`review`?e.review.changesRequested?{icon:te,text:`Changes requested`,tone:`warning`}:t?.outcome?{icon:Xe.succeeded.icon,text:t.outcome.summary||`Ready for review`,tone:`info`}:{icon:Xe.succeeded.icon,text:`Ready for review`,tone:`info`}:null}var Bi=`Accepting marks the task Done. It does not merge or push.`;function Vi(e){return e.sessionId?`${H.session(e.sessionId)}?tab=changes`:null}function Hi(e){let t=!!e&&(e.state===`ready`||e.state===`backlog`),n=t?`${e.id}:${e.state}:${e.updatedAt}`:null,r=De(n,t=>ue(e.id,t)),i=m(e=>e.hosts),a=m(e=>e.tasks),o=m(e=>e.projects),s=m(e=>e.runs),c=m(e=>e.dispatchPaused),l=(0,U.useMemo)(()=>{if(!e)return;let t={};for(let e of Object.values(s)){if(!_e(e))continue;let n=a[e.taskId]?.projectId;n&&(t[n]=(t[n]??0)+1)}return le({project:o[e.projectId],hostId:e.policy.hostId,dependencies:e.dependencies,notBefore:e.notBefore},{hosts:i,tasks:a,dispatchPaused:c,runningByProject:t})},[e,i,a,o,s,c]),u=r.data,d;return t?u?d=!u.eligible&&u.wait===`not_ready`?l:u:r.error&&(d=l):d=void 0,{eligibility:d,loading:r.loading&&!r.data,error:r.error,estimated:!!d&&d===l}}function Ui({title:e,children:t,action:n}){let r=(0,U.useId)();return(0,Z.jsxs)(`section`,{"aria-labelledby":r,className:`flex min-w-0 flex-col gap-2 border-b border-border py-4 last:border-b-0`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h3`,{id:r,className:`min-w-0 flex-1 text-sm font-semibold`,children:e}),n]}),t]})}function Q({label:e,children:t}){return(0,Z.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[minmax(7rem,auto)_1fr] gap-x-3 text-sm`,children:[(0,Z.jsx)(`dt`,{className:`text-muted`,children:e}),(0,Z.jsx)(`dd`,{className:`min-w-0 break-words`,children:t})]})}function Wi({task:e,eligibility:t,block:n}){let i=Pi(),a=i.isBusy(e.id),[o,s]=(0,U.useState)(!1),c=t?(0,Z.jsx)(Gi,{e:t,prefix:e.state===`backlog`?`If made ready: `:``}):null;switch(e.state){case`backlog`:return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(w,{variant:`primary`,block:n,busy:a,icon:(0,Z.jsx)(Ve,{className:`size-4`}),onClick:()=>void i.move(e,`ready`),children:`Make ready`}),c]});case`ready`:return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(w,{variant:`primary`,block:n,busy:a,icon:(0,Z.jsx)(Ve,{className:`size-4`}),onClick:()=>void i.runNow(e),children:`Run now`}),c]});case`in_progress`:return e.sessionId?(0,Z.jsxs)(r,{to:H.session(e.sessionId),className:k(`primary`,`md`,n?`w-full`:void 0),children:[(0,Z.jsx)(I,{"aria-hidden":!0,className:`size-4`}),`Open session`]}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:e.blocked?`No session is attached to this task.`:`The session is starting; Open session appears once the host confirms the launch.`});case`review`:{let t=Vi(e);return t?(0,Z.jsxs)(r,{to:t,className:k(`primary`,`md`,n?`w-full`:void 0),children:[(0,Z.jsx)(it,{"aria-hidden":!0,className:`size-4`}),`Review changes`]}):(0,Z.jsxs)(`a`,{href:`#task-review`,className:k(`primary`,`md`,n?`w-full`:void 0),children:[(0,Z.jsx)(it,{"aria-hidden":!0,className:`size-4`}),`Review changes`]})}case`done`:return(0,Z.jsx)(w,{variant:`primary`,block:n,busy:o,icon:(0,Z.jsx)(kt,{className:`size-4`}),onClick:async()=>{s(!0);try{await L(e.id,`reopen`),V.success(`Reopened "${e.title}"`)}catch(e){V.error(`Could not reopen: ${g(e)}`)}finally{s(!1)}},children:`Reopen`});case`canceled`:return(0,Z.jsx)(w,{variant:`primary`,block:n,busy:a,icon:(0,Z.jsx)(kt,{className:`size-4`}),onClick:()=>void i.move(e,`backlog`),children:`Restore to Backlog`})}}function Gi({e,prefix:t=``}){let n=e.eligible?Ke:We;return(0,Z.jsxs)(`p`,{role:`status`,className:S(`flex items-start gap-1.5 text-sm`,e.eligible?`text-success`:`text-warning`),children:[(0,Z.jsx)(n,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`span`,{className:`min-w-0 break-words text-text`,children:[t,B(e)]})]})}function Ki({task:e,onDeleted:t}){let n=Ri(e),{eligibility:i,error:a}=Hi(e),o=m(e=>e.tasks),s=m(e=>e.hosts),c=m(e=>e.profiles),l=m(e=>e.projects),u=m(e=>e.workspaces),d=m(e=>e.runs),f=De(`${e.id}:${e.currentRunId??``}`,t=>pe(e.id,t)),v=(0,U.useMemo)(()=>{let t=new Map;for(let e of f.data??[])t.set(e.id,e);for(let n of h(d,e.id)){let e=t.get(n.id);(!e||e.updatedAt<=n.updatedAt)&&t.set(n.id,n)}return[...t.values()].sort((e,t)=>t.attempt-e.attempt||t.createdAt.localeCompare(e.createdAt))},[f.data,d,e.id]),[b,S]=(0,U.useState)(!1),D=l[e.projectId],O=n.run,A=zi(e,O,i),j=e.policy.hostId??D?.defaultHostId??null,M=j?s[j]:void 0,N=O?.hostId?s[O.hostId]:void 0,P=N&&N.connectivity!==`connected`?N:void 0,ne=Li[e.priority],re=ne.icon,ie=e.policy.profileId??D?.defaultProfileId??null,ae=m(t=>e.sessionId?Object.values(t.interactions).filter(t=>t.sessionId===e.sessionId&&t.state===`pending`).length:0);return(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,"data-testid":`task-detail`,children:[ae>0&&e.sessionId&&n.pendingInteraction&&(0,Z.jsx)(_,{count:ae,to:H.interaction(e.sessionId,n.pendingInteraction.id),className:`mt-3`}),P&&(0,Z.jsx)(C,{compact:!0,className:`mt-3`,hostName:P.name,connectivity:P.connectivity===`reconnecting`?`reconnecting`:`unreachable`,lastSeenAt:P.lastSeenAt,detail:`The run keeps its last known state. Switchyard does not restart it on another host.`}),(0,Z.jsx)(Ui,{title:`Objective and acceptance criteria`,action:!b&&(0,Z.jsx)(w,{size:`sm`,variant:`ghost`,icon:(0,Z.jsx)(ze,{className:`size-3.5`}),onClick:()=>S(!0),children:`Edit`}),children:b?(0,Z.jsx)(Xi,{task:e,onDone:()=>S(!1)}):(0,Z.jsxs)(Z.Fragment,{children:[e.objective.trim()?(0,Z.jsx)(F,{text:e.objective}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No objective yet. Edit the task to describe what done looks like.`}),(0,Z.jsx)(`h4`,{className:`pt-1 text-xs font-semibold tracking-wide text-muted uppercase`,children:`Acceptance criteria`}),e.acceptanceCriteria.length>0?(0,Z.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-sm`,children:e.acceptanceCriteria.map(e=>(0,Z.jsx)(`li`,{className:`break-words`,children:e},e))}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No acceptance criteria.`})]})}),(0,Z.jsxs)(Ui,{title:`State`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(Ze,{kind:`task`,value:e.state}),(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-sm text-muted`,children:[(0,Z.jsx)(re,{"aria-hidden":!0,className:`size-4`}),ne.label,` priority`]})]}),e.blocked&&(0,Z.jsxs)(`p`,{className:`flex items-start gap-1.5 rounded-md bg-danger-soft px-3 py-2 text-sm`,children:[(0,Z.jsx)(te,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-danger`}),(0,Z.jsxs)(`span`,{className:`min-w-0 break-words`,children:[(0,Z.jsx)(`span`,{className:`font-medium`,children:`Blocked:`}),` `,e.blocked.reason]})]}),A&&!e.blocked&&!(e.state===`ready`&&i)&&(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:A.text}),(e.state===`ready`||e.state===`backlog`)&&i&&(0,Z.jsx)(Gi,{e:i,prefix:e.state===`backlog`?`If made ready: `:``}),a!==null&&p(a)&&a.status===404&&(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`Eligibility is estimated on this device; the coordinator did not report it.`}),e.notBefore&&(0,Z.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Not before `,T(e.notBefore)]})]}),(0,Z.jsxs)(Ui,{title:`Current run`,children:[O?(0,Z.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(Q,{label:`Status`,children:(0,Z.jsx)(Ze,{kind:`run`,value:O.state,size:`sm`})}),(0,Z.jsx)(Q,{label:`Attempt`,children:O.attempt}),(0,Z.jsx)(Q,{label:`Control`,children:O.controlMode===`human`?`You (automation paused)`:`Automation`}),N&&(0,Z.jsx)(Q,{label:`Host`,children:N.name}),O.startedAt&&(0,Z.jsx)(Q,{label:`Started`,children:ee(O.startedAt)}),(0,Z.jsx)(Q,{label:`Continuations`,children:O.continuationsUsed}),(0,Z.jsx)(Q,{label:`Usage`,children:O.usage.accounting===`available`?`${O.usage.tokens??0} tokens${O.usage.costUsd===null?``:` · $${O.usage.costUsd.toFixed(2)}`}`:O.usage.note??`Token/cost accounting not reported`}),O.outcome&&(0,Z.jsx)(Q,{label:`Outcome`,children:O.outcome.summary})]}):(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No run yet.`}),e.sessionId&&(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(r,{to:H.session(e.sessionId),className:k(`secondary`,`sm`),children:[(0,Z.jsx)(I,{"aria-hidden":!0,className:`size-3.5`}),`Open session`]})})]}),e.state===`review`&&(0,Z.jsx)(Yi,{task:e}),(0,Z.jsx)(Ui,{title:`Dependencies`,children:e.dependencies.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No dependencies.`}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1`,children:e.dependencies.map(e=>{let t=o[e];return(0,Z.jsx)(`li`,{className:`flex min-w-0 items-center gap-2 text-sm`,children:t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Ze,{kind:`task`,value:t.state,size:`sm`}),(0,Z.jsx)(r,{to:H.task(e),className:`min-w-0 truncate text-accent hover:underline`,children:t.title})]}):(0,Z.jsx)(`span`,{className:`text-muted`,children:`A task that is no longer available`})},e)})})}),(0,Z.jsxs)(Ui,{title:`Host, profile and workspace`,children:[(0,Z.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(Q,{label:`Project`,children:D?.name??`Unknown project`}),(0,Z.jsx)(Q,{label:`Host`,children:e.policy.hostId?M?.name??`Unknown host`:`Project default${M?` (${M.name})`:``}`}),(0,Z.jsx)(Q,{label:`Profile`,children:e.policy.profileId?c[e.policy.profileId]?.name??`Unknown profile`:`Project default${ie&&c[ie]?` (${c[ie].name})`:``}`}),(0,Z.jsx)(Q,{label:`Workspace`,children:e.policy.workspace.mode===`existing`?`Existing: ${u[e.policy.workspace.workspaceId]?.branch??u[e.policy.workspace.workspaceId]?.path??`unknown workspace`}`:`New worktree${e.policy.workspace.branch?` on ${e.policy.workspace.branch}`:``}${e.policy.workspace.base?` from ${e.policy.workspace.base}`:``}`}),D&&(0,Z.jsx)(Q,{label:`Sharing`,children:D.workspaceSharing===`single_writer`?`Single writer`:`Shared`})]}),M&&!M.piCompatible&&(0,Z.jsx)(y,{capability:`Running on this host`,reason:`Pi ${M.piVersion??`(unknown version)`} on ${M.name} is not compatible with Switchyard.`})]}),(0,Z.jsxs)(Ui,{title:`Limits and completion`,children:[(0,Z.jsxs)(`dl`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(Q,{label:`Continuation`,children:e.policy.continuation.enabled?`Up to ${e.policy.continuation.maxContinuations} continuations within ${e.policy.continuation.maxElapsedMinutes} min${e.policy.continuation.maxTokens?`, ${e.policy.continuation.maxTokens} tokens`:``}${e.policy.continuation.maxCostUsd?`, $${e.policy.continuation.maxCostUsd}`:``}`:`Off`}),(0,Z.jsx)(Q,{label:`Checks`,children:e.policy.completion.checks===null?`Project default${D?.checks.length?` (${D.checks.join(`, `)})`:` (none)`}`:e.policy.completion.checks.length>0?e.policy.completion.checks.join(`, `):`None`}),(0,Z.jsx)(Q,{label:`Human review`,children:e.policy.completion.requireHumanReview?`Required`:`Not required`})]}),O&&O.checks.length>0&&(0,Z.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:O.checks.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 items-start gap-1.5`,children:[e.exitCode===0?(0,Z.jsx)(Ke,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-success`}):(0,Z.jsx)(te,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0 text-danger`}),(0,Z.jsx)(`span`,{className:`min-w-0 break-all font-mono text-xs`,children:e.command}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted`,children:e.exitCode===0?`Passed`:`Failed (${e.exitCode??`no exit code`})`})]},e.command))})]}),(0,Z.jsxs)(Ui,{title:`Run history and activity`,children:[f.error!==null&&!f.data&&v.length===0&&(0,Z.jsx)(E,{compact:!0,title:`Could not load run history`,error:g(f.error),onRetry:f.reload}),v.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:f.loading?`Loading runs…`:`No runs yet.`}):(0,Z.jsx)(`ol`,{className:`flex flex-col gap-2`,children:v.map(e=>(0,Z.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-0.5 rounded-md border border-border px-3 py-2 text-sm`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsxs)(`span`,{className:`font-medium`,children:[`Attempt `,e.attempt]}),(0,Z.jsx)(Ze,{kind:`run`,value:e.state,size:`sm`})]}),e.outcome&&(0,Z.jsx)(`p`,{className:`break-words text-muted`,children:e.outcome.summary}),(0,Z.jsxs)(`p`,{className:`text-xs text-subtle`,children:[e.startedAt?`Started ${T(e.startedAt)}`:`Created ${T(e.createdAt)}`,e.startedAt&&e.endedAt?` · ${x(Date.parse(e.endedAt)-Date.parse(e.startedAt))}`:``,e.infraRetries>0?` · ${e.infraRetries} infrastructure retries`:``]})]},e.id))}),e.review.feedback.length>0&&(0,Z.jsxs)(`div`,{className:`text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Review feedback`}),(0,Z.jsx)(`ul`,{className:`list-disc pl-5 text-muted`,children:e.review.feedback.map(e=>(0,Z.jsx)(`li`,{className:`break-words`,children:e},e))})]}),(0,Z.jsxs)(`p`,{className:`text-xs text-subtle`,children:[`Created `,T(e.createdAt),` · last activity `,ee(e.lastActivityAt),e.origin.kind===`automation`?` · created by an automation`:``]})]}),(0,Z.jsx)(qi,{task:e,onDeleted:t})]})}function qi({task:e,onDeleted:t}){let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(!1);return e.state!==`backlog`&&e.state!==`canceled`&&e.state!==`done`?null:(0,Z.jsxs)(`div`,{className:`py-4`,children:[(0,Z.jsx)(w,{variant:`ghost`,size:`sm`,icon:(0,Z.jsx)(Ue,{className:`size-4`}),className:`text-danger`,onClick:()=>r(!0),children:`Delete task`}),(0,Z.jsx)(lt,{open:n,onClose:()=>!i&&r(!1),title:`Delete this task?`,description:`"${e.title}" and its history are removed from the board. Sessions and workspaces are kept.`,footer:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(w,{onClick:()=>r(!1),disabled:i,children:`Cancel`}),(0,Z.jsx)(w,{variant:`danger`,busy:i,onClick:async()=>{a(!0);try{await de(e.id),V.success(`Deleted "${e.title}"`),r(!1),t?.()}catch(e){V.error(`Could not delete: ${g(e)}`)}finally{a(!1)}},children:`Delete task`})]})})]})}var Ji=e=>`sy:feedback:${e}`;function Yi({task:e}){let t=Pi(),r=n(),[i,a]=(0,U.useState)(()=>sessionStorage.getItem(Ji(e.id))??``),[o,s]=(0,U.useState)(null),c=(0,U.useId)();(0,U.useEffect)(()=>{i?sessionStorage.setItem(Ji(e.id),i):sessionStorage.removeItem(Ji(e.id))},[i,e.id]);let l=Vi(e),u=i.split(`
|
|
6
|
+
`).map(e=>e.replace(/^[-*]\s*/,``).trim()).filter(Boolean);return(0,Z.jsxs)(`section`,{id:`task-review`,"aria-labelledby":`${c}-h`,className:`flex min-w-0 flex-col gap-3 border-b border-border py-4`,children:[(0,Z.jsx)(`h3`,{id:`${c}-h`,className:`text-sm font-semibold`,children:`Review`}),l&&(0,Z.jsx)(`div`,{children:(0,Z.jsx)(w,{size:`sm`,icon:(0,Z.jsx)(it,{className:`size-3.5`}),onClick:()=>r(l),children:`Review changes`})}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:c,className:`text-sm font-medium`,children:`Feedback for the next attempt`}),(0,Z.jsx)(dt,{id:c,minRows:3,maxHeight:`40vh`,placeholder:`One change per line`,value:i,onChange:e=>a(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(w,{icon:(0,Z.jsx)(Tt,{className:`size-4`}),busy:o===`changes`,disabled:o!==null||u.length===0,onClick:async()=>{s(`changes`);try{await fe(e.id,u),a(``),V.success(`Changes requested. Start a new attempt when ready.`)}catch(e){V.error(`Could not request changes: ${g(e)}`)}finally{s(null)}},children:`Request changes`}),(0,Z.jsx)(w,{icon:(0,Z.jsx)(kt,{className:`size-4`}),busy:t.isBusy(e.id),disabled:o!==null,onClick:()=>void t.newAttempt(e),children:`Start new attempt`})]}),u.length===0&&(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`Write at least one line of feedback to request changes.`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(w,{variant:`primary`,icon:(0,Z.jsx)(Ke,{className:`size-4`}),busy:t.isBusy(e.id),disabled:o!==null,onClick:()=>void t.accept(e),children:`Accept task`}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:Bi})]})]})}function Xi({task:e,onDone:t}){let n=m(e=>e.tasks),[r,i]=(0,U.useState)(e.title),[a,o]=(0,U.useState)(e.objective),[s,c]=(0,U.useState)(e.acceptanceCriteria.join(`
|
|
7
|
+
`)),[l,u]=(0,U.useState)(e.priority),[d,f]=(0,U.useState)(e.dependencies),[p,h]=(0,U.useState)(!1),[_,v]=(0,U.useState)(null),y=(0,U.useId)(),b=Object.values(n).filter(t=>t.projectId===e.projectId&&t.id!==e.id&&t.state!==`canceled`&&!t.hiddenFromBoard).sort((e,t)=>e.title.localeCompare(t.title));return(0,Z.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:async n=>{if(n.preventDefault(),!r.trim())v(`Title is required.`);else{h(!0),v(null);try{await me(e.id,{title:r.trim(),objective:a,acceptanceCriteria:s.split(`
|
|
8
|
+
`).map(e=>e.trim()).filter(Boolean),priority:l,dependencies:d}),V.success(`Task saved`),t()}catch(e){v(g(e))}finally{h(!1)}}},children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${y}-title`,className:`text-sm font-medium`,children:`Title`}),(0,Z.jsx)(ct,{id:`${y}-title`,value:r,onChange:e=>i(e.target.value),required:!0})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${y}-obj`,className:`text-sm font-medium`,children:`Objective`}),(0,Z.jsx)(dt,{id:`${y}-obj`,minRows:4,maxHeight:`40vh`,value:a,onChange:e=>o(e.target.value)})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${y}-crit`,className:`text-sm font-medium`,children:`Acceptance criteria (one per line)`}),(0,Z.jsx)(dt,{id:`${y}-crit`,minRows:2,maxHeight:`30vh`,value:s,onChange:e=>c(e.target.value)})]}),(0,Z.jsx)(Zi,{id:`${y}-prio`,value:l,onChange:u}),(0,Z.jsx)(Qi,{candidates:b,value:d,onChange:f}),_&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:_}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(w,{type:`submit`,variant:`primary`,busy:p,children:`Save`}),(0,Z.jsx)(w,{onClick:t,disabled:p,children:`Cancel`})]})]})}function Zi({id:e,value:t,onChange:n}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:`Priority`}),(0,Z.jsx)(`select`,{id:e,value:t,onChange:e=>n(Number(e.target.value)),className:`tap h-9 rounded-md border border-border bg-surface px-2 text-base md:text-sm`,children:ft.map((e,t)=>(0,Z.jsx)(`option`,{value:t,children:e},e))})]})}function Qi({candidates:e,value:t,onChange:n}){let[r,i]=(0,U.useState)(``),a=(0,U.useId)(),o=e.filter(e=>t.includes(e.id)||e.title.toLowerCase().includes(r.toLowerCase())).slice(0,50);return(0,Z.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:`Dependencies`}),e.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted`,children:`No other tasks in this project.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{htmlFor:a,className:`sr-only`,children:`Filter tasks`}),(0,Z.jsx)(ct,{id:a,placeholder:`Filter tasks`,value:r,onChange:e=>i(e.target.value)}),(0,Z.jsx)(`ul`,{className:`max-h-48 overflow-y-auto rounded-md border border-border`,children:o.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`label`,{className:`tap flex min-w-0 items-center gap-2 px-3 py-1.5 text-sm hover:bg-surface-2`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:t.includes(e.id),onChange:r=>n(r.target.checked?[...t,e.id]:t.filter(t=>t!==e.id))}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-muted`,children:z[e.state]})]})},e.id))}),t.length>0&&(0,Z.jsxs)(`p`,{className:`text-xs text-muted`,children:[t.length,` selected. The task waits until they are Done.`]})]})]})}var $i=`sy:new-task-draft`;function ea(e){return{title:``,objective:``,projectId:e,advanced:!1,priority:2,dependencies:[],hostId:``,profileId:``,branch:``,criteria:``,continuation:!1,contObjective:``,maxContinuations:`3`,maxMinutes:`60`,maxTokens:``,maxCost:``,checks:``,checksMode:`default`,humanReview:!0}}function ta(e){try{let t=sessionStorage.getItem($i);if(t)return{...ea(e),...JSON.parse(t)}}catch{}return ea(e)}var na=e=>e.split(`
|
|
9
|
+
`).map(e=>e.trim()).filter(Boolean);function ra(e){let t={},n={};if(e.hostId&&(n.hostId=e.hostId),e.profileId&&(n.profileId=e.profileId),e.branch.trim()&&(n.workspace={mode:`new_worktree`,branch:e.branch.trim(),base:null}),e.continuation){let r=Number(e.maxContinuations),i=Number(e.maxMinutes),a=e.maxTokens.trim()?Number(e.maxTokens):null,o=e.maxCost.trim()?Number(e.maxCost):null;e.contObjective.trim()||(t.contObjective=`Continuation needs an objective.`),(!Number.isInteger(r)||r<1||r>50)&&(t.maxContinuations=`Use 1 to 50.`),(!Number.isInteger(i)||i<1||i>1440)&&(t.maxMinutes=`Use 1 to 1440 minutes.`),a!==null&&(!Number.isInteger(a)||a<=0)&&(t.maxTokens=`Use a positive whole number.`),o!==null&&(!Number.isFinite(o)||o<=0)&&(t.maxCost=`Use a positive amount.`),n.continuation={enabled:!0,objective:e.contObjective.trim(),maxContinuations:r,maxElapsedMinutes:i,maxTokens:a,maxCostUsd:o}}return e.checksMode!==`custom`&&e.humanReview||(n.completion={checks:e.checksMode===`custom`?na(e.checks):null,requireHumanReview:e.humanReview}),{policy:n,errors:t}}function ia({defaultProjectId:e,onCreated:t,onCancel:n}){let r=u(),i=d(),a=m(e=>e.profiles),o=m(e=>e.tasks),s=m(e=>e.runs),c=m(e=>e.hosts),l=m(e=>e.dispatchPaused),[f,p]=(0,U.useState)(()=>ta(e??r[0]?.id??``)),[h,_]=(0,U.useState)(null),[y,b]=(0,U.useState)({}),[x,S]=(0,U.useState)(null),C=(0,U.useId)(),T=(e,t)=>p(n=>({...n,[e]:t}));(0,U.useEffect)(()=>{!f.projectId&&r[0]&&p(e=>({...e,projectId:r[0].id}))},[f.projectId,r]),(0,U.useEffect)(()=>{sessionStorage.setItem($i,JSON.stringify(f))},[f]);let E=r.find(e=>e.id===f.projectId),D=E?.defaultHostId?c[E.defaultHostId]:void 0,ee=E?.defaultProfileId?a[E.defaultProfileId]:void 0,O=Object.values(o).filter(e=>e.projectId===f.projectId&&e.state!==`canceled`&&!e.hiddenFromBoard).sort((e,t)=>e.title.localeCompare(t.title)),k=(0,U.useMemo)(()=>{let e={};for(let t of Object.values(s)){if(!_e(t))continue;let n=o[t.taskId]?.projectId;n&&(e[n]=(e[n]??0)+1)}return le({project:E,hostId:f.hostId||null,dependencies:f.dependencies},{hosts:c,tasks:o,dispatchPaused:l,runningByProject:e})},[E,f.hostId,f.dependencies,c,o,s,l]),te=async e=>{let n={};f.title.trim()||(n.title=`Give the task a title.`),E||(n.projectId=`Choose a project.`);let{policy:r,errors:i}=ra(f);if(Object.assign(n,i),b(n),Object.keys(n).length>0)Object.keys(i).length>0&&T(`advanced`,!0);else{_(e),S(null);try{let n=await ge({projectId:f.projectId,title:f.title.trim(),objective:f.objective,acceptanceCriteria:na(f.criteria),dependencies:f.dependencies,priority:f.priority,state:e,...Object.keys(r).length>0?{policy:r}:{}});if(sessionStorage.removeItem($i),e===`ready`){let e=B(k);try{e=B(await ue(n.id))}catch{}V.success(`Created "${n.title}" in Ready. ${e}.`)}else V.success(`Created "${n.title}" in Backlog.`);t(n)}catch(e){S(g(e))}finally{_(null)}}},A=e=>y[e]?(0,Z.jsx)(`p`,{id:`${C}-${e}-err`,className:`text-xs text-danger`,children:y[e]}):null,j=`tap h-9 w-full rounded-md border border-border bg-surface px-2 text-base md:text-sm`;return(0,Z.jsxs)(`form`,{"data-testid":`new-task-form`,className:`flex min-w-0 flex-col gap-4`,onSubmit:e=>{e.preventDefault(),te(`backlog`)},children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${C}-title`,className:`text-sm font-medium`,children:`Title`}),(0,Z.jsx)(ct,{id:`${C}-title`,value:f.title,autoFocus:!0,"aria-invalid":!!y.title,"aria-describedby":y.title?`${C}-title-err`:void 0,onChange:e=>T(`title`,e.target.value),placeholder:`What should be done?`}),A(`title`)]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${C}-objective`,className:`text-sm font-medium`,children:`Objective`}),(0,Z.jsx)(dt,{id:`${C}-objective`,minRows:3,maxHeight:`35vh`,value:f.objective,onChange:e=>T(`objective`,e.target.value),placeholder:`Context, constraints and what done looks like`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${C}-project`,className:`text-sm font-medium`,children:`Project`}),(0,Z.jsxs)(`select`,{id:`${C}-project`,className:j,value:f.projectId,"aria-invalid":!!y.projectId,onChange:e=>p(t=>({...t,projectId:e.target.value,dependencies:[]})),children:[r.length===0&&(0,Z.jsx)(`option`,{value:``,children:`No projects yet`}),r.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]}),A(`projectId`)]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`tap inline-flex items-center gap-1 rounded text-sm font-medium text-accent`,"aria-expanded":f.advanced,"aria-controls":`${C}-adv`,onClick:()=>T(`advanced`,!f.advanced),children:[f.advanced?(0,Z.jsx)(N,{"aria-hidden":!0,className:`size-4`}):(0,Z.jsx)(se,{"aria-hidden":!0,className:`size-4`}),`Advanced options`]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`Unset options inherit the project defaults.`})]}),f.advanced&&(0,Z.jsxs)(`div`,{id:`${C}-adv`,className:`flex flex-col gap-4 rounded-lg border border-border p-3`,children:[(0,Z.jsx)(Zi,{id:`${C}-prio`,value:f.priority,onChange:e=>T(`priority`,e)}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${C}-criteria`,className:`text-sm font-medium`,children:`Acceptance criteria (one per line)`}),(0,Z.jsx)(dt,{id:`${C}-criteria`,minRows:2,maxHeight:`25vh`,value:f.criteria,onChange:e=>T(`criteria`,e.target.value)})]}),(0,Z.jsx)(Qi,{candidates:O,value:f.dependencies,onChange:e=>T(`dependencies`,e)}),(0,Z.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${C}-host`,className:`text-sm font-medium`,children:`Host`}),(0,Z.jsxs)(`select`,{id:`${C}-host`,className:j,value:f.hostId,onChange:e=>T(`hostId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,D?` (${D.name})`:``]}),i.map(e=>(0,Z.jsxs)(`option`,{value:e.id,children:[e.name,e.connectivity===`connected`?``:` (offline)`]},e.id))]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${C}-profile`,className:`text-sm font-medium`,children:`Pi profile`}),(0,Z.jsxs)(`select`,{id:`${C}-profile`,className:j,value:f.profileId,onChange:e=>T(`profileId`,e.target.value),children:[(0,Z.jsxs)(`option`,{value:``,children:[`Project default`,ee?` (${ee.name})`:``]}),Object.values(a).map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`${C}-branch`,className:`text-sm font-medium`,children:`Branch`}),(0,Z.jsx)(ct,{id:`${C}-branch`,value:f.branch,placeholder:`Generated from the title`,onChange:e=>T(`branch`,e.target.value)}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`Work happens in a new worktree on this branch.`})]}),(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:`Continuation limits`}),(0,Z.jsxs)(`label`,{className:`tap flex items-center gap-2 text-sm`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:f.continuation,onChange:e=>T(`continuation`,e.target.checked)}),`Continue automatically until done (off by default)`]}),f.continuation&&(0,Z.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 sm:col-span-2`,children:[(0,Z.jsx)(`label`,{htmlFor:`${C}-cobj`,className:`text-sm`,children:`Continuation objective`}),(0,Z.jsx)(ct,{id:`${C}-cobj`,value:f.contObjective,"aria-invalid":!!y.contObjective,onChange:e=>T(`contObjective`,e.target.value)}),A(`contObjective`)]}),(0,Z.jsx)(aa,{id:`${C}-cmax`,label:`Max continuations`,value:f.maxContinuations,onChange:e=>T(`maxContinuations`,e),error:A(`maxContinuations`)}),(0,Z.jsx)(aa,{id:`${C}-cmin`,label:`Max minutes`,value:f.maxMinutes,onChange:e=>T(`maxMinutes`,e),error:A(`maxMinutes`)}),(0,Z.jsx)(aa,{id:`${C}-ctok`,label:`Max tokens (optional)`,value:f.maxTokens,onChange:e=>T(`maxTokens`,e),error:A(`maxTokens`)}),(0,Z.jsx)(aa,{id:`${C}-ccost`,label:`Max cost USD (optional)`,value:f.maxCost,onChange:e=>T(`maxCost`,e),error:A(`maxCost`)}),(0,Z.jsx)(`p`,{className:`text-xs text-muted sm:col-span-2`,children:`Token and cost limits apply only when the Pi provider reports usage.`})]})]}),(0,Z.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`legend`,{className:`text-sm font-medium`,children:`Checks and review`}),(0,Z.jsxs)(`label`,{className:`tap flex items-center gap-2 text-sm`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:f.checksMode===`custom`,onChange:e=>T(`checksMode`,e.target.checked?`custom`:`default`)}),`Use custom checks instead of the project's`,E?.checks.length?` (${E.checks.join(`, `)})`:` (none)`]}),f.checksMode===`custom`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`label`,{htmlFor:`${C}-checks`,className:`text-sm`,children:`Check commands (one per line; empty means no checks)`}),(0,Z.jsx)(dt,{id:`${C}-checks`,minRows:2,className:`font-mono`,value:f.checks,onChange:e=>T(`checks`,e.target.value)})]}),(0,Z.jsxs)(`label`,{className:`tap flex items-center gap-2 text-sm`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:f.humanReview,onChange:e=>T(`humanReview`,e.target.checked)}),`Require human review before Done`]})]})]}),x&&(0,Z.jsxs)(`p`,{role:`alert`,className:`rounded-md bg-danger-soft px-3 py-2 text-sm`,children:[`Could not create the task: `,x]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-border pt-3`,children:[(0,Z.jsx)(Gi,{e:k,prefix:`Make ready: `}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Z.jsx)(w,{type:`submit`,icon:(0,Z.jsx)(v,{className:`size-4`}),busy:h===`backlog`,disabled:h!==null,children:`Save to Backlog`}),(0,Z.jsx)(w,{variant:`primary`,icon:(0,Z.jsx)(Ve,{className:`size-4`}),busy:h===`ready`,disabled:h!==null,onClick:()=>void te(`ready`),children:`Make ready`}),(0,Z.jsx)(w,{variant:`ghost`,onClick:n,disabled:h!==null,children:`Cancel`})]}),(0,Z.jsx)(`p`,{className:`text-xs text-muted`,children:`Make ready authorizes dispatch. Nothing starts until the coordinator confirms.`})]})]})}function aa({id:e,label:t,value:n,onChange:r,error:i}){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:e,className:`text-sm`,children:t}),(0,Z.jsx)(ct,{id:e,inputMode:`decimal`,value:n,onChange:e=>r(e.target.value)}),i]})}var oa={neutral:`text-muted`,info:`text-info`,success:`text-success`,warning:`text-warning`,danger:`text-danger`,accent:`text-accent`};function sa({task:e,showProject:t,wait:i,onOpen:a,drag:o,full:s,selected:c}){let l=Ri(e),u=m(e=>e.tasks),d=Pi(),f=n(),p=d.isBusy(e.id),h=Li[e.priority],g=h.icon,_=zi(e,l.run,i),v=xe(e,u),y=l.attention[0],x=[{id:`open`,label:`Open details`,icon:(0,Z.jsx)(M,{className:`size-4`}),onSelect:()=>a(e)}];if(e.sessionId){let t=e.sessionId;x.push({id:`session`,label:`Open session`,icon:(0,Z.jsx)(I,{className:`size-4`}),onSelect:()=>f(H.session(t))})}x.push(`separator`);for(let t of Pe(e))x.push({id:`move-${t}`,label:ua(e.state,t),icon:(0,Z.jsx)(la,{state:t}),onSelect:()=>void d.move(e,t)});return(0,Z.jsxs)(`article`,{ref:o?.setNodeRef,"data-testid":`task-card`,"data-task-id":e.id,"aria-label":e.title,"aria-busy":p||void 0,style:o?.style,...o?.cardProps,className:S(`group relative flex min-w-0 flex-col gap-1.5 rounded-lg border bg-surface p-3 text-sm shadow-sm`,c?`border-accent`:`border-border`,o?.dragging&&`opacity-60`,s?`w-full`:``),children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-1`,children:[o&&(0,Z.jsx)(`button`,{type:`button`,ref:o.setHandleRef,...o.handleProps,"aria-label":`Drag ${e.title}`,title:`Drag to move (Space to pick up, arrows to move, Space to drop)`,className:`tap -ml-1.5 inline-flex h-7 w-5 shrink-0 cursor-grab items-center justify-center rounded text-subtle hover:bg-surface-2 hover:text-text`,children:(0,Z.jsx)(xt,{"aria-hidden":!0,className:`size-4`})}),(0,Z.jsx)(`button`,{type:`button`,"data-card-open":e.id,onClick:()=>a(e),className:`tap min-w-0 flex-1 rounded text-left font-medium leading-snug`,children:(0,Z.jsx)(`span`,{className:`line-clamp-2 break-words`,children:e.title})}),p&&(0,Z.jsx)(b,{label:`Updating`,className:`mt-0.5 shrink-0`}),(0,Z.jsx)(P,{label:`Actions for ${e.title}`,items:x,trigger:t=>(0,Z.jsx)(`button`,{type:`button`,...t,"aria-label":`Move to… and other actions for ${e.title}`,title:`Move to…`,className:`tap -mr-1.5 inline-flex size-7 shrink-0 items-center justify-center rounded text-muted hover:bg-surface-2 hover:text-text`,children:(0,Z.jsx)(qe,{"aria-hidden":!0,className:`size-4`})})})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted`,children:[(0,Z.jsxs)(`span`,{className:S(`inline-flex items-center gap-1`,oa[h.tone]),children:[(0,Z.jsx)(g,{"aria-hidden":!0,className:`size-3.5`}),h.label]}),t&&l.projectName&&(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:l.projectName})]}),_&&(0,Z.jsx)(ca,{icon:_.spin?(0,Z.jsx)(b,{className:`size-3.5`}):(0,Z.jsx)(_.icon,{"aria-hidden":!0,className:S(`size-3.5`,_.pulse&&`animate-pulse`)}),className:oa[_.tone],children:_.text}),(l.hostName||l.branch)&&(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted`,children:[l.hostName&&(0,Z.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(oe,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[l.hostName,l.hostOffline?` (offline)`:``]})]}),l.branch&&(0,Z.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1`,children:[(0,Z.jsx)(Re,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,Z.jsx)(`span`,{className:`truncate`,children:l.branch})]})]}),v&&(0,Z.jsx)(ca,{icon:(0,Z.jsx)(Be,{"aria-hidden":!0,className:`size-3.5`}),className:`text-muted`,children:v}),l.pendingInteraction&&e.sessionId?(0,Z.jsxs)(r,{to:H.interaction(e.sessionId,l.pendingInteraction.id),className:`tap inline-flex min-w-0 items-center gap-1 rounded text-xs font-medium text-warning hover:underline`,children:[(0,Z.jsx)(A,{"aria-hidden":!0,className:`size-3.5 shrink-0`}),(0,Z.jsxs)(`span`,{className:`truncate`,children:[`Needs input: `,l.pendingInteraction.title]})]}):y?(0,Z.jsxs)(ca,{icon:(0,Z.jsx)(Ge,{"aria-hidden":!0,className:`size-3.5`}),className:oa[nt[y.reason].tone],children:[nt[y.reason].label,l.attention.length>1?` (+${l.attention.length-1})`:``]}):null,(0,Z.jsxs)(`div`,{className:`text-xs text-subtle`,children:[`Updated `,(0,Z.jsx)(`time`,{dateTime:e.lastActivityAt,children:ee(e.lastActivityAt)})]})]})}function ca({icon:e,children:t,className:n}){return(0,Z.jsxs)(`div`,{className:S(`flex min-w-0 items-start gap-1 text-xs`,n),children:[(0,Z.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,Z.jsx)(`span`,{className:`min-w-0 break-words line-clamp-2`,children:t})]})}function la({state:e,className:t}){let n=$e[e].icon;return(0,Z.jsx)(n,{"aria-hidden":!0,className:S(`size-4`,t)})}function ua(e,t){return e===`ready`&&t===`in_progress`?`Run now (In progress)`:e===`review`&&t===`in_progress`?`Start new attempt (In progress)`:e===`backlog`&&t===`ready`?`Make ready`:(e===`done`||e===`canceled`)&&t!==`canceled`?`Reopen to ${z[t]}`:t===`canceled`?`Cancel task`:t===`done`?`Accept (Done)`:`Move to ${z[t]}`}function da(){let e=Ye(e=>e.filters.board),t=Ye(e=>e.setFilter),n=Ye(e=>e.selectedProjectId),r=Ye(e=>e.set),i=(0,U.useMemo)(()=>Le(e),[e]),a=m(e=>e.tasks),o=m(e=>e.runs),s=m(e=>e.attention),c=m(e=>e.projects),l=Me(),u=n&&c[n]?n:null,d=(0,U.useMemo)(()=>{let e=new Set(ye(s).keys());return Ee(a,i,{projectId:u,runs:o,attentionTaskIds:e})},[a,i,u,o,s]),f=(0,U.useMemo)(()=>{let e=new Map;for(let t of l.data?.queued??[])e.set(t.taskId,t.eligibility);return e},[l.data]),p=(0,U.useMemo)(()=>l.data?l.data.queued.filter(e=>!u||a[e.taskId]?.projectId===u).length:Object.values(a).filter(e=>e.state===`ready`&&!e.hiddenFromBoard&&(!u||e.projectId===u)).length,[l.data,a,u]),h=Fe(i),g=(0,U.useMemo)(()=>Object.values(a).filter(e=>!e.hiddenFromBoard&&(!u||e.projectId===u)).length,[a,u]),_=h.reduce((e,t)=>e+d[t].length,0);return{filters:i,setFilters:e=>t(`board`,e),projectId:u,setProjectId:e=>r(`selectedProjectId`,e),columns:d,states:h,waits:f,queueCount:p,now:l,showProject:!u&&Object.keys(c).length>1,totalTasks:g,visibleCount:_}}var $={mainScrollTop:0,boardScrollLeft:0,columnScroll:{},focusTaskId:null},fa=`col:`,pa=`card:`,ma=`task:`,ha=(e,{currentCoordinates:t,context:n})=>{if(e.code===`ArrowDown`)return{...t,y:t.y+72};if(e.code===`ArrowUp`)return{...t,y:t.y-72};if(e.code!==`ArrowRight`&&e.code!==`ArrowLeft`)return;e.preventDefault();let r=n.droppableContainers.toArray().filter(e=>String(e.id).startsWith(fa)).map(e=>({id:e.id,rect:n.droppableRects.get(e.id)})).filter(e=>!!e.rect).sort((e,t)=>e.rect.left-t.rect.left);if(r.length===0)return;let i=n.collisionRect?.width??0,a=t.x+i/2,o=r.findIndex(e=>a>=e.rect.left&&a<=e.rect.left+e.rect.width);o<0&&(o=0);let s=r[Math.max(0,Math.min(r.length-1,o+(e.code===`ArrowRight`?1:-1)))];return{x:s.rect.left+(s.rect.width-i)/2,y:t.y}},ga=e=>{let t=Dn(e);if(t.length>0){let e=t.find(e=>String(e.id).startsWith(pa));return e?[e]:t}return Cn(e)};function _a(e,t){if(e.startsWith(fa))return{state:e.slice(4),beforeId:null};if(e.startsWith(pa)){let n=t[e.slice(5)];return n?{state:n.state,beforeId:n.id}:null}return null}function va({taskId:e}){let t=da(),r=m(e=>e.hydrated),i=m(e=>e.projects),a=m(e=>e.tasks),o=Pi(),c=n(),l=s(),u=Ye(e=>e.paneSizes.boardColumn),[d,f]=(0,U.useState)(null),[p,h]=(0,U.useState)(!1),g=hn(mn(hr,{activationConstraint:{distance:6}}),mn(ur,{coordinateGetter:ha,keyboardCodes:{start:[`Space`],cancel:[`Escape`],end:[`Space`,`Enter`]}})),_=(0,U.useCallback)(e=>{e&&(e.scrollLeft=$.boardScrollLeft)},[]);(0,U.useEffect)(()=>{if(e||!$.focusTaskId)return;let t=$.focusTaskId;$.focusTaskId=null,requestAnimationFrame(()=>document.querySelector(`[data-card-open="${CSS.escape(t)}"]`)?.focus({preventScroll:!1}))},[e]);let v=e=>{$.focusTaskId=e.id,c(H.task(e.id),{state:{fromBoard:!0}})},y=()=>{e&&($.focusTaskId=e),l.state?.fromBoard?c(-1):c(H.board)},b=e=>f(String(e.active.id).slice(5)),x=e=>{f(null);let n=String(e.active.id).slice(5),r=a[n];if(!r||!e.over)return;let i=_a(String(e.over.id),a);if(!i||i.beforeId===n)return;let s=t.columns[i.state],c=he(s,i.beforeId,n);i.state===r.state?t.filters.sort===`priority`&&o.reorder(r,c):o.move(r,i.state,{position:c})},S={onDragStart:({active:e})=>`Picked up ${ba(e.id,a)}.`,onDragOver:({active:e,over:t})=>t?`${ba(e.id,a)} is over ${xa(String(t.id),a)}.`:void 0,onDragEnd:({active:e,over:t})=>t?`Dropped ${ba(e.id,a)} on ${xa(String(t.id),a)}.`:`Dropped ${ba(e.id,a)}. It did not move.`,onDragCancel:({active:e})=>`Moving ${ba(e.id,a)} was canceled.`},C=d?a[d]:void 0,T=e?a[e]:void 0,E=r&&Object.keys(i).length===0;return(0,Z.jsxs)(`div`,{"data-testid":`board`,className:`absolute inset-0 flex min-w-0 flex-col`,children:[(0,Z.jsxs)(`header`,{className:`flex min-w-0 flex-wrap items-center gap-2 border-b border-border px-4 py-2.5`,children:[(0,Z.jsx)(`h1`,{className:`mr-2 text-lg font-semibold`,children:`Board`}),(0,Z.jsx)(R,{board:t}),(0,Z.jsx)(Te,{board:t,className:`w-56 max-w-full`}),(0,Z.jsx)(Oe,{board:t}),(0,Z.jsx)(`div`,{className:`ml-auto`,children:(0,Z.jsx)(w,{variant:`primary`,icon:(0,Z.jsx)(He,{className:`size-4`}),onClick:()=>h(!0),disabled:E,title:E?`Add a project first`:void 0,children:`New task`})})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-5 gap-y-2 border-b border-border px-4 py-2`,children:[(0,Z.jsx)(ve,{}),(0,Z.jsxs)(`span`,{className:`text-sm text-muted`,role:`status`,children:[t.queueCount,` queued`]}),(0,Z.jsx)(Ne,{board:t}),(0,Z.jsx)(Se,{board:t}),(0,Z.jsx)(je,{board:t})]}),(0,Z.jsx)(Ae,{board:t}),r?E?(0,Z.jsx)(O,{icon:(0,Z.jsx)(at,{className:`size-8`}),title:`No projects yet`,description:`Tasks belong to a project. Add a project from a host checkout to start planning work.`,action:{label:`Add a project`,to:H.settings(`projects`)}}):t.totalTasks===0?(0,Z.jsx)(O,{icon:(0,Z.jsx)(at,{className:`size-8`}),title:`No tasks yet`,description:`Create a task in Backlog, or make it ready so the dispatcher starts it.`,action:{label:`New task`,onClick:()=>h(!0)}}):(0,Z.jsxs)(fi,{sensors:g,collisionDetection:ga,onDragStart:b,onDragEnd:x,onDragCancel:()=>f(null),accessibility:{announcements:S,screenReaderInstructions:{draggable:`To move a task, press Space to pick it up, use the arrow keys to move between columns, then press Space to drop or Escape to cancel. The task menu offers Move to… without dragging.`}},children:[t.visibleCount===0&&(0,Z.jsxs)(`p`,{role:`status`,className:`px-4 pt-3 text-sm text-muted`,children:[`No tasks match the filters.`,` `,(0,Z.jsx)(`button`,{type:`button`,className:`tap font-medium text-accent`,onClick:()=>t.setFilters({...be,sort:t.filters.sort}),children:`Clear filters`})]}),(0,Z.jsx)(`section`,{ref:_,"aria-label":`Board columns`,onScroll:e=>{$.boardScrollLeft=e.currentTarget.scrollLeft},className:`min-h-0 flex-1 overflow-x-auto overflow-y-hidden overscroll-x-contain`,children:(0,Z.jsx)(`div`,{className:`flex h-full w-max gap-3 p-4`,children:t.states.map(n=>(0,Z.jsx)(Sa,{state:n,board:t,width:u,onOpen:v,selectedId:e,onNew:()=>h(!0)},n))})}),(0,Z.jsx)(Mi,{dropAnimation:null,children:C&&(0,Z.jsx)(`div`,{className:`rotate-1 shadow-pop`,style:{width:`clamp(272px, ${u-16}px, 344px)`},children:(0,Z.jsx)(sa,{task:C,showProject:t.showProject,wait:t.waits.get(C.id),onOpen:()=>void 0})})})]}):(0,Z.jsx)(D,{label:`Loading tasks…`}),(0,Z.jsx)(st,{open:!!e,onClose:y,width:520,title:T?.title??(r?`Task not found`:`Loading task…`),description:T?z[T.state]:void 0,footer:T?(0,Z.jsx)(ya,{task:T}):void 0,children:(0,Z.jsx)(`div`,{"data-testid":`task-drawer`,className:`min-w-0`,children:T?(0,Z.jsx)(Ki,{task:T,onDeleted:()=>c(H.board,{replace:!0})}):r?(0,Z.jsx)(O,{title:`Task not found`,description:`It may have been deleted, or this link is from another coordinator.`,action:{label:`Back to board`,to:H.board}}):(0,Z.jsx)(D,{label:`Loading task…`})})}),(0,Z.jsx)(lt,{open:p,onClose:()=>h(!1),title:`New task`,className:`max-w-xl`,children:(0,Z.jsx)(ia,{defaultProjectId:t.projectId,onCancel:()=>h(!1),onCreated:e=>{h(!1),$.focusTaskId=e.id,requestAnimationFrame(()=>document.querySelector(`[data-card-open="${CSS.escape(e.id)}"]`)?.focus())}})})]})}function ya({task:e}){let{eligibility:t}=Hi(e);return(0,Z.jsx)(`div`,{className:`w-full min-w-0`,children:(0,Z.jsx)(Wi,{task:e,eligibility:t})})}function ba(e,t){let n=t[String(e).replace(ma,``)];return n?`task ${n.title}`:`task`}function xa(e,t){if(e.startsWith(fa))return`the ${z[e.slice(4)]} column`;let n=t[e.slice(5)];return n?`${n.title} in ${z[n.state]}`:`a task`}function Sa({state:e,board:t,width:n,onOpen:r,selectedId:i,onNew:a}){let{setNodeRef:o,isOver:s}=bi({id:`${fa}${e}`}),[c,l]=(0,U.useState)(!1),u=t.columns[e],d=$e[e].icon,f=e===`done`&&!t.filters.showCompleted&&!c,p=`col-${e}-title`,m=(0,U.useCallback)(t=>{t&&(t.scrollTop=$.columnScroll[e]??0)},[e]);return(0,Z.jsx)(`section`,{ref:o,"data-testid":`column-${e}`,"aria-labelledby":p,style:{width:`clamp(288px, ${n}px, 360px)`},className:`flex h-full shrink-0 flex-col rounded-lg border bg-surface-2 ${s?`border-accent`:`border-border`}`,children:(0,Z.jsxs)(`div`,{ref:m,"data-column-scroll":e,onScroll:t=>{$.columnScroll[e]=t.currentTarget.scrollTop},className:`min-h-0 flex-1 overflow-y-auto overscroll-y-contain`,children:[(0,Z.jsxs)(`h2`,{id:p,className:`sticky top-0 z-10 flex items-center gap-2 rounded-t-lg border-b border-border bg-surface-2 px-3 py-2 text-sm font-semibold`,children:[(0,Z.jsx)(d,{"aria-hidden":!0,className:`size-4 text-muted`}),(0,Z.jsx)(`span`,{className:`flex-1`,children:z[e]}),(0,Z.jsxs)(`span`,{className:`rounded-full bg-surface px-2 text-xs font-medium text-muted tabular-nums`,children:[u.length,(0,Z.jsx)(`span`,{className:`sr-only`,children:` tasks`})]})]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2 p-2`,children:f?(0,Z.jsxs)(`li`,{className:`flex flex-col items-start gap-1 px-1 py-2 text-sm text-muted`,children:[u.length,` completed `,u.length===1?`task is`:`tasks are`,` hidden.`,u.length>0&&(0,Z.jsx)(`button`,{type:`button`,className:`tap font-medium text-accent`,onClick:()=>l(!0),children:`Show completed`})]}):u.length===0?(0,Z.jsx)(`li`,{className:`px-1 py-2 text-sm text-muted`,children:e===`backlog`?(0,Z.jsxs)(`button`,{type:`button`,className:`tap inline-flex items-center gap-1 font-medium text-accent`,onClick:a,children:[(0,Z.jsx)(He,{"aria-hidden":!0,className:`size-4`}),` New task`]}):`No tasks`}):u.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(Ca,{task:e,board:t,onOpen:r,selected:e.id===i})},e.id))})]})})}function Ca({task:e,board:t,onOpen:n,selected:r}){let i=gi({id:`${ma}${e.id}`}),a=bi({id:`${pa}${e.id}`,disabled:i.isDragging}),{onPointerDown:o,onKeyDown:s}=i.listeners??{},c={setNodeRef:e=>{i.setNodeRef(e),a.setNodeRef(e)},setHandleRef:i.setActivatorNodeRef,cardProps:{onPointerDown:o},handleProps:{...i.attributes,onKeyDown:s},dragging:i.isDragging,style:a.isOver?{boxShadow:`0 -3px 0 0 var(--sy-accent)`}:void 0};return(0,Z.jsx)(sa,{task:e,showProject:t.showProject,wait:t.waits.get(e.id),onOpen:n,drag:c,selected:r})}var wa=()=>document.getElementById(`main`);function Ta(){let e=da(),t=m(e=>e.hydrated),r=m(e=>e.projects),i=n(),[a,o]=tt(`board-mobile`,{tab:`ready`,layout:`column`}),[s,c]=(0,U.useState)(!1),u=e.states.includes(a.tab)?a.tab:`ready`;(0,U.useLayoutEffect)(()=>{if(!t)return;let e=wa(),n=$.mainScrollTop;e&&(e.scrollTop=n);let r=requestAnimationFrame(()=>{r=requestAnimationFrame(()=>{e&&e.scrollTop<n&&(e.scrollTop=n)})}),i=$.focusTaskId;return $.focusTaskId=null,i&&requestAnimationFrame(()=>document.querySelector(`[data-card-open="${CSS.escape(i)}"]`)?.focus({preventScroll:!0})),()=>cancelAnimationFrame(r)},[t]);let d=e=>{$.mainScrollTop=wa()?.scrollTop??0,$.focusTaskId=e.id,i(H.task(e.id),{state:{fromBoard:!0}})},f=t&&Object.keys(r).length===0,p=(t,n)=>t.length===0?(0,Z.jsxs)(`p`,{className:`px-1 py-3 text-sm text-muted`,children:[`No `,z[n],` tasks.`]}):(0,Z.jsx)(`ul`,{className:`flex flex-col gap-2`,children:t.map(t=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(sa,{task:t,full:!0,showProject:e.showProject,wait:e.waits.get(t.id),onOpen:d})},t.id))});return(0,Z.jsxs)(`div`,{"data-testid":`board`,className:`flex min-w-0 flex-col`,children:[(0,Z.jsxs)(`header`,{className:`flex min-w-0 flex-col gap-2 border-b border-border bg-bg px-3 pt-3 pb-0 safe-pt`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`h1`,{className:`flex-1 text-lg font-semibold`,children:`Board`}),(0,Z.jsx)(w,{variant:`primary`,icon:(0,Z.jsx)(He,{className:`size-4`}),onClick:()=>c(!0),disabled:f,children:`New task`})]}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(R,{board:e,className:`min-w-0 flex-1`}),(0,Z.jsx)(Oe,{board:e,mobile:!0})]}),(0,Z.jsx)(Te,{board:e}),(0,Z.jsx)(je,{board:e}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(ve,{compact:!0}),(0,Z.jsxs)(`span`,{className:`text-sm text-muted`,children:[e.queueCount,` queued`]})]}),(0,Z.jsx)(pt,{label:`Board layout`,block:!0,value:a.layout,onChange:e=>o({...a,layout:e}),options:[{value:`column`,label:`Columns`,icon:(0,Z.jsx)(yt,{"aria-hidden":!0,className:`size-4`})},{value:`list`,label:`List`,icon:(0,Z.jsx)(Ct,{"aria-hidden":!0,className:`size-4`})}]}),a.layout===`column`&&(0,Z.jsx)(`div`,{"data-testid":`status-tabs`,className:`-mx-3 px-1`,children:(0,Z.jsx)(ie,{label:`Task status`,idPrefix:`board-tab`,scrollable:!0,className:`border-b-0`,value:u,onChange:e=>o({...a,tab:e}),tabs:e.states.map(t=>{let n=$e[t].icon;return{id:t,label:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(n,{"aria-hidden":!0,className:`size-4`}),z[t]]}),badge:(0,Z.jsx)(l,{label:`${e.columns[t].length} tasks`,children:e.columns[t].length})}})})})]}),(0,Z.jsx)(Ae,{board:e}),(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3 px-3 py-3`,children:t?f?(0,Z.jsx)(O,{icon:(0,Z.jsx)(at,{className:`size-8`}),title:`No projects yet`,description:`Tasks belong to a project. Add a project from a host checkout first.`,action:{label:`Add a project`,to:H.settings(`projects`)}}):e.totalTasks===0?(0,Z.jsx)(O,{icon:(0,Z.jsx)(at,{className:`size-8`}),title:`No tasks yet`,description:`Create a task in Backlog, or make it ready so the dispatcher starts it.`,action:{label:`New task`,onClick:()=>c(!0)}}):e.visibleCount===0?(0,Z.jsx)(O,{title:`No tasks match the filters`,action:{label:`Clear filters`,onClick:()=>e.setFilters({...be,sort:e.filters.sort})}}):a.layout===`column`?(0,Z.jsx)(ae,{idPrefix:`board-tab`,id:u,children:u===`done`&&!e.filters.showCompleted?(0,Z.jsxs)(`p`,{className:`text-sm text-muted`,children:[`Completed tasks are hidden.`,` `,(0,Z.jsx)(`button`,{type:`button`,className:`tap font-medium text-accent`,onClick:()=>e.setFilters({...e.filters,showCompleted:!0}),children:`Show completed`})]}):p(e.columns[u],u)}):e.states.filter(t=>t!==`done`||e.filters.showCompleted).map(t=>(0,Z.jsxs)(`section`,{"aria-labelledby":`grp-${t}`,"data-testid":`column-${t}`,className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`h2`,{id:`grp-${t}`,className:`flex items-center gap-2 pt-1 text-sm font-semibold`,children:[(0,Z.jsx)(la,{state:t,className:`text-muted`}),z[t],(0,Z.jsxs)(`span`,{className:`text-muted`,children:[`(`,e.columns[t].length,`)`]})]}),p(e.columns[t],t)]},t)):(0,Z.jsx)(D,{label:`Loading tasks…`})}),(0,Z.jsx)(ot,{open:s,onClose:()=>c(!1),title:`New task`,children:(0,Z.jsx)(ia,{defaultProjectId:e.projectId,onCancel:()=>c(!1),onCreated:e=>{c(!1),o({...a,tab:e.state})}})})]})}function Ea({taskId:e}){Je();let t=f(e),r=m(e=>e.hydrated),i=n(),a=s(),[o,c]=(0,U.useState)(!1),{eligibility:l}=Hi(t);return(0,U.useLayoutEffect)(()=>{let e=wa();e&&(e.scrollTop=0)},[]),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col`,"data-testid":`task-page`,children:[(0,Z.jsxs)(`header`,{className:`sticky top-0 z-20 flex min-w-0 items-center gap-1 border-b border-border bg-surface px-1 py-1 safe-pt`,children:[(0,Z.jsx)(ut,{label:`Back to board`,icon:(0,Z.jsx)(ne,{className:`size-5`}),onClick:()=>{a.state?.fromBoard?i(-1):i(H.board)}}),(0,Z.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-base font-semibold`,children:t?.title??`Task`}),t&&(0,Z.jsx)(w,{size:`sm`,icon:(0,Z.jsx)(ht,{className:`size-4`}),onClick:()=>c(!0),children:`Move task`})]}),t?(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col px-4 pt-3 pb-8`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsx)(Wi,{task:t,eligibility:l,block:!0})}),(0,Z.jsx)(Ki,{task:t,onDeleted:()=>i(H.board,{replace:!0})}),(0,Z.jsx)(Da,{task:t,open:o,onClose:()=>c(!1)})]}):r?(0,Z.jsx)(O,{title:`Task not found`,description:`It may have been deleted.`,action:{label:`Back to board`,to:H.board}}):(0,Z.jsx)(D,{label:`Loading task…`})]})}function Da({task:e,open:t,onClose:n}){let r=Pi(),i=m(e=>e.runs),a=e.currentRunId?i[e.currentRunId]:void 0,o=[`backlog`,`ready`,`in_progress`,`review`,`done`,`canceled`],s=new Set(Pe(e));return(0,Z.jsx)(ot,{open:t,onClose:n,title:`Move task`,description:`Currently ${z[e.state]}`,children:(0,Z.jsx)(`ul`,{"data-testid":`move-sheet`,className:`flex flex-col`,children:o.filter(t=>t!==e.state).map(t=>{let i=Ie(e,t,a),o=i.kind===`invalid`?i.reason:i.kind===`choose_running`?`Asks whether to pause automation or stop execution.`:i.kind===`confirm_done`?`Asks you to confirm acceptance.`:i.kind===`run_now`?`Starts now if the task is eligible.`:null;return(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,disabled:!s.has(t),onClick:()=>{n(),r.move(e,t)},className:`tap flex w-full items-start gap-3 rounded-md px-2 py-3 text-left hover:bg-surface-2 disabled:opacity-60`,children:[(0,Z.jsx)(la,{state:t,className:`mt-0.5 text-muted`}),(0,Z.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:ua(e.state,t)}),o&&(0,Z.jsx)(`span`,{className:`block text-sm text-muted`,children:o})]})]})},t)})})})}function Oa(){let e=et(),n=t(`/tasks/:taskId`)?.params.taskId;return(0,Z.jsx)(Ii,{children:e===`mobile`?n?(0,Z.jsx)(Ea,{taskId:n},n):(0,Z.jsx)(Ta,{}):(0,Z.jsx)(va,{taskId:n})})}export{Oa as default};
|
|
10
|
+
//# sourceMappingURL=board-BrLaJwLJ.js.map
|