@uniqbit/mate-core 1.0.0-canary.8 → 1.0.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/claude-capability-plugins/companion-mentions/.claude-plugin/plugin.json +1 -1
- package/package.json +5 -4
- package/src/cli/commands/artifact/delivery/link.ts +1 -1
- package/src/cli/commands/artifact/delivery/output.ts +10 -1
- package/src/cli/commands/artifact/delivery/resolve.ts +3 -2
- package/src/cli/commands/artifact/delivery/submit.ts +9 -4
- package/src/cli/commands/artifact/delivery/take.ts +12 -9
- package/src/cli/commands/artifact/finish/command.ts +16 -14
- package/src/cli/commands/artifact/finish/engine.ts +8 -8
- package/src/cli/commands/artifact/project/command.ts +2 -3
- package/src/cli/commands/companion/hub.ts +11 -6
- package/src/cli/commands/companion/link.ts +173 -46
- package/src/cli/commands/doctor.ts +17 -0
- package/src/cli/commands/report/contract.ts +0 -17
- package/src/cli/commands/studio/access.ts +4 -0
- package/src/cli/commands/studio/actions.ts +35 -2
- package/src/cli/commands/studio/mcp-manager.ts +162 -0
- package/src/cli/commands/studio/routes.ts +12 -0
- package/src/cli/commands/studio/selection.ts +44 -11
- package/src/cli/commands/studio/server.ts +246 -2
- package/src/cli/commands/studio/services.ts +26 -0
- package/src/cli/commands/studio/terminal-launch.ts +21 -4
- package/src/cli/commands/studio/terminal.ts +3 -14
- package/src/cli/commands/studio/work-requests.ts +9 -0
- package/src/cli/commands/studio/work.ts +473 -0
- package/src/cli/commands/vscode/release-vsix.json +2 -2
- package/src/cli/commands/working/cleanup.ts +1 -18
- package/src/cli/companion-link-wizard.tsx +158 -91
- package/src/cli/usage.ts +1 -1
- package/src/create-mate.ts +4 -1
- package/src/lib/agent-credential.ts +131 -0
- package/src/lib/credential-kinds.ts +7 -0
- package/src/lib/delivery/merge-git.ts +16 -0
- package/src/lib/delivery/record-delivery.ts +12 -6
- package/src/lib/delivery/record.ts +5 -0
- package/src/lib/delivery/refresh.ts +34 -6
- package/src/lib/delivery/staging/refs.ts +9 -4
- package/src/lib/delivery/staging/submit.ts +81 -22
- package/src/lib/mcp-manager/resolve.ts +88 -0
- package/src/lib/mcp-manager/store.ts +133 -0
- package/src/lib/mcp-manager/types.ts +72 -0
- package/src/lib/mcp-manager/validate.ts +242 -0
- package/src/lib/opencode-server.ts +2 -17
- package/src/lib/orchestrator/config-store.ts +30 -7
- package/src/lib/orchestrator/engine-floor.ts +16 -4
- package/src/lib/orchestrator/engine-guard.ts +7 -1
- package/src/lib/orchestrator/repo-local-store.ts +14 -0
- package/src/lib/orchestrator/repository-link.ts +80 -52
- package/src/lib/orchestrator/root-context.ts +17 -1
- package/src/lib/orchestrator/types.ts +4 -0
- package/src/lib/studio-chat/agent.ts +139 -0
- package/src/lib/studio-chat/companion-context.ts +136 -0
- package/src/lib/studio-chat/credential.ts +79 -0
- package/src/lib/studio-chat/harness-chat-agent.ts +334 -0
- package/src/lib/studio-chat/host-sandbox.ts +578 -0
- package/src/lib/studio-chat/prepare-bridges.ts +95 -0
- package/src/lib/studio-chat/session.ts +15 -0
- package/src/lib/studio-chat/turns.ts +112 -0
- package/src/lib/workset/claims.ts +85 -0
- package/src/lib/workset/execution.ts +71 -0
- package/src/lib/workset/git-transaction.ts +74 -0
- package/src/lib/workset/groups.ts +176 -0
- package/src/lib/workset/inventory.ts +196 -0
- package/src/lib/workset/projection.ts +237 -0
- package/src/lib/workset/record.ts +101 -36
- package/src/lib/workset/repositories.ts +24 -0
- package/src/lib/workset/sharing.ts +951 -0
- package/src/lib/workset/stages.ts +50 -14
- package/src/lib/workset/transactions.ts +158 -0
- package/src/runtime/companion-git-state.ts +1 -0
- package/src/runtime/companion-guidance.ts +2 -2
- package/src/runtime/forge-remote.ts +6 -0
- package/src/runtime/host-process.ts +28 -0
- package/src/runtime/secret-guard.ts +18 -1
- package/src/runtime/secret-patterns.ts +4 -3
- package/src/runtime/submitted-arrivals.ts +28 -2
- package/src/runtime/workflow/turn.ts +14 -12
- package/src/runtime/write-atomic.ts +2 -2
- package/src/studio.ts +61 -0
- package/src/templates/capabilities/openspec-cap/mate-full/schema.yaml +1 -1
- package/src/templates/capabilities/openspec-cap/mate-full/templates/proposal.md +1 -1
- package/src/templates/mate-skills/agents/mate-publish-artifact/SKILL.md +3 -2
- package/src/templates/mate-skills/agents/mate-submit-change/SKILL.md +5 -3
- package/src/templates/mate-skills/claude/mate-publish-artifact/SKILL.md +3 -2
- package/src/templates/mate-skills/claude/mate-submit-change/SKILL.md +5 -3
- package/src/tools/setup/__snapshots__/runtime-surface-golden.test.ts.snap +12 -12
- package/src/tools/setup/capabilities/mcp-manager.ts +73 -0
- package/src/tools/setup/context-services.ts +35 -6
- package/src/tools/setup/dynamic-plugins/audiences.ts +3 -2
- package/src/tools/setup/dynamic-plugins/declarations.ts +0 -26
- package/src/tools/setup/engine.ts +55 -3
- package/src/tools/setup/plugin.ts +14 -0
- package/src/tools/setup/plugins/gitignore.ts +1 -0
- package/src/tools/setup/providers/claude-format.ts +40 -7
- package/src/tools/setup/providers/claude.ts +38 -3
- package/src/tools/setup/providers/opencode-format.ts +13 -3
- package/src/tools/setup/providers/opencode.ts +7 -18
- package/src/tools/setup/providers/relative-path-warnings.ts +26 -0
- package/studio-dist/THIRD-PARTY-NOTICES.md +297 -0
- package/studio-dist/client/THIRD-PARTY-LICENSES.md +4294 -0
- package/studio-dist/client/assets/DialogTitle-DOhjDa7H.js +1 -0
- package/studio-dist/client/assets/app-CG3vCgyA.css +2 -0
- package/studio-dist/client/assets/bundle-mjs-CdK3cBzO.js +1 -0
- package/studio-dist/client/assets/button-upSzkd-q.js +1 -0
- package/studio-dist/client/assets/chat-DbaMXb8H.js +157 -0
- package/studio-dist/client/assets/cn-BCnYnarL.js +1 -0
- package/studio-dist/client/assets/combobox-cP9OsRf2.js +1 -0
- package/studio-dist/client/assets/{companion-view-C_N237bf.js → companion-view-B54_Lj0S.js} +1 -1
- package/studio-dist/client/assets/fields-DNZ4a89M.js +1 -0
- package/studio-dist/client/assets/friction-DgEimeDB.js +1 -0
- package/studio-dist/client/assets/getting-started-BTfYCt5s.js +1 -0
- package/studio-dist/client/assets/{getting-started-djaQeWlu.js → getting-started-CAszmdDJ.js} +1 -1
- package/studio-dist/client/assets/getting-started._topic-CHJMf0pa.js +1 -0
- package/studio-dist/client/assets/getting-started.index-MR6HftWs.js +1 -0
- package/studio-dist/client/assets/{graph-canvas-ySGKMhmk.js → graph-canvas-BdNk2F9O.js} +1 -1
- package/studio-dist/client/assets/graph-hRijsC89.js +2 -0
- package/studio-dist/client/assets/guides-CwFnh08E.js +1 -0
- package/studio-dist/client/assets/highlighted-body-JLMTFACH-BcroQey-.js +1 -0
- package/studio-dist/client/assets/index-D5oGyvG8.js +41 -0
- package/studio-dist/client/assets/{markdown-view-jMiaBTSO.js → markdown-view-CJ8JsLb7.js} +1 -1
- package/studio-dist/client/assets/marked.esm-vFuq1cCd.js +65 -0
- package/studio-dist/client/assets/mcp-BE9M-bkO.js +4 -0
- package/studio-dist/client/assets/mermaid-WFAXDIZX-BjSsakrn.js +1 -0
- package/studio-dist/client/assets/panel-CDQ6Lryw.js +1 -0
- package/studio-dist/client/assets/plugins._service._view-DRVPUAWN.js +1 -0
- package/studio-dist/client/assets/{prepaint-CKsXyJOR.js → prepaint-sD_LlrDN.js} +1 -1
- package/studio-dist/client/assets/{queries-Dfp5deWj.js → queries-COL925ML.js} +1 -1
- package/studio-dist/client/assets/react-dom-K3Hp2Cdj.js +1 -0
- package/studio-dist/client/assets/{react-BYUSgtBs.js → react-h2xQ_NSp.js} +1 -1
- package/studio-dist/client/assets/reports-BClsojkb.js +1 -0
- package/studio-dist/client/assets/routes-CJQ2MAej.js +1 -0
- package/studio-dist/client/assets/search-DhWdEiKT.js +1 -0
- package/studio-dist/client/assets/select-B2FsN9FY.js +1 -0
- package/studio-dist/client/assets/skills-SoUHk77W.js +1 -0
- package/studio-dist/client/assets/{specs-BrCOjOch.js → specs-C_tZnAvF.js} +1 -1
- package/studio-dist/client/assets/specs-view-C6t3Y5IT.js +1 -0
- package/studio-dist/client/assets/steps-CF3-Zpmh.js +1 -0
- package/studio-dist/client/assets/{store-C3vJq8Wj.js → store-pY9gU4uS.js} +1 -1
- package/studio-dist/client/assets/studio-X7bnFrRe.js +36 -0
- package/studio-dist/client/assets/studio-queries-CKtAnIKP.js +2 -0
- package/studio-dist/client/assets/usage-BaaqUpTG.js +55 -0
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-BspHR7Wt.js +1 -0
- package/studio-dist/client/assets/useBlocker-BQOfcu_f.js +1 -0
- package/studio-dist/client/assets/useMutation-DKeEoP5S.js +1 -0
- package/studio-dist/client/assets/useOpenInteractionType-CtaZCaFT.js +1 -0
- package/studio-dist/client/assets/usePopupHandleStore-Bc7Q4bnF.js +1 -0
- package/studio-dist/client/assets/vault-sAPFUnPN.js +1 -0
- package/studio-dist/client/assets/{warnings-CqOOGlPD.js → warnings-D7YY1HSG.js} +1 -1
- package/studio-dist/client/assets/work-BZek_LGB.js +5 -0
- package/studio-dist/client/assets/workflow-N5boHXFz.js +1 -0
- package/studio-dist/server/THIRD-PARTY-LICENSES.md +4371 -0
- package/studio-dist/server/assets/DialogTitle-DnKSl2V0.js +421 -0
- package/studio-dist/server/assets/{__23tanstack-start-server-fn-resolver-gVfW5vIV.js → __23tanstack-start-server-fn-resolver-Bli9bpSB.js} +38 -18
- package/studio-dist/server/assets/_tanstack-start-manifest_v.js +91 -59
- package/studio-dist/server/assets/{actions-D8erOphH.js → actions-CHEFA1i9.js} +33 -1
- package/studio-dist/server/assets/{cn-FXJAM0KO.js → bundle-mjs-Ot6dQ8Pq.js} +1 -2056
- package/studio-dist/server/assets/{button-D6bvrFmm.js → button-BqA1urbl.js} +14 -7
- package/studio-dist/server/assets/chat-zl332Tvu.js +49486 -0
- package/studio-dist/server/assets/cn-B0fl6NWK.js +2057 -0
- package/studio-dist/server/assets/{combobox-D2MbYV1O.js → combobox-iTjvPCtS.js} +7 -6
- package/studio-dist/server/assets/{companion-view-Mf1ANbMb.js → companion-view-DIQ6AFIY.js} +2 -2
- package/studio-dist/server/assets/{companions-Dr6IpNAb.js → companions-aVwjRL8j.js} +1 -1
- package/studio-dist/server/assets/{fields-B4mAPETz.js → fields-BMap2_Ju.js} +10 -3
- package/studio-dist/server/assets/{friction-CWOTjpCV.js → friction-BER50hoD.js} +2 -2
- package/studio-dist/server/assets/{friction-9a5S1m7U.js → friction-BPs9KWdq.js} +8 -8
- package/studio-dist/server/assets/{getting-started-RU6tYU2Q.js → getting-started-DGfRVmZ_.js} +2 -2
- package/studio-dist/server/assets/{getting-started._topic-C02HGrC6.js → getting-started._topic-BgrBA4Vj.js} +2 -2
- package/studio-dist/server/assets/{getting-started.index-EzLRosbb.js → getting-started.index-BaFfQ9Mn.js} +2 -2
- package/studio-dist/server/assets/{graph-CZ2H9Fzr.js → graph-Cgzlrv3P.js} +8 -8
- package/studio-dist/server/assets/{graph-B11ITte0.js → graph-DODpuOy_.js} +1 -1
- package/studio-dist/server/assets/{graph-canvas-rP5TT14Z.js → graph-canvas-DW_zU1nA.js} +2 -2
- package/studio-dist/server/assets/{guides-BGftp4wf.js → guides-CA_EMG7E.js} +1 -1
- package/studio-dist/server/assets/{guides-B8HdeK_C.js → guides-D0SpoD32.js} +1 -1
- package/studio-dist/server/assets/{guides.server-DqFQAStf.js → guides.server-DJjQuy03.js} +1 -1
- package/studio-dist/server/assets/highlighted-body-JLMTFACH-BeHllu-r.js +41 -0
- package/studio-dist/server/assets/{markdown-view-CArpV-CS.js → markdown-view-CvVBGMZV.js} +1 -1
- package/studio-dist/server/assets/mcp-BU0fLYyJ.js +1103 -0
- package/studio-dist/server/assets/mcp-manager-D9YctTQe.js +50 -0
- package/studio-dist/server/assets/mermaid-WFAXDIZX-B1yDN6vG.js +1 -0
- package/studio-dist/server/assets/{panel-DR0iq46J.js → panel-D1K6Bsux.js} +4 -32
- package/studio-dist/server/assets/{plugins._service._view-n7u2k5dF.js → plugins._service._view-DdO1nELF.js} +4 -4
- package/studio-dist/server/assets/{prepaint-B28ClcPN.js → prepaint-BB3dwSmz.js} +1 -1
- package/studio-dist/server/assets/{queries-D-yVP9i0.js → queries-BwiDxQy5.js} +1 -1
- package/studio-dist/server/assets/{react-CiBZPDs8.js → react-B2cLiz-i.js} +1 -1
- package/studio-dist/server/assets/{reports-C2SmTgqh.js → reports-9Pr7Bz6o.js} +7 -7
- package/studio-dist/server/assets/{reports-B9k98oE6.js → reports-Cc9M3phM.js} +1 -1
- package/studio-dist/server/assets/{router-CPt0TAk_.js → router-DcWe0J7Y.js} +827 -548
- package/studio-dist/server/assets/{routes-CwH8LEy2.js → routes-BEXxl0py.js} +8 -8
- package/studio-dist/server/assets/{search-b-yQesv3.js → search-bltT7gwy.js} +39 -7
- package/studio-dist/server/assets/{select-C3i6TTX-.js → select-CZvHgGCi.js} +7 -6
- package/studio-dist/server/assets/{shell-CagqZZMZ.js → shell-BQ0vMKXN.js} +13 -4
- package/studio-dist/server/assets/{skills-DGg0mWDM.js → skills-Be_52h0i.js} +1 -1
- package/studio-dist/server/assets/{skills-C21Mg_8-.js → skills-BpGGUl6L.js} +8 -8
- package/studio-dist/server/assets/{specs-DetoMiaB.js → specs-CCGgXE-V.js} +5 -5
- package/studio-dist/server/assets/{specs-view-CmbfLDwN.js → specs-view-DtL5JxYM.js} +12 -11
- package/studio-dist/server/assets/{steps-D1tYAyWZ.js → steps-BWFSO6dM.js} +1 -1
- package/studio-dist/server/assets/{store-aC-I6f6o.js → store-X7yLPp7v.js} +1 -1
- package/studio-dist/server/assets/{studio-queries-Dqf-3nzj.js → studio-queries-ur1ygXi3.js} +117 -13
- package/studio-dist/server/assets/{studio-qRvQjRpz.js → studio-qzH-UETC.js} +1555 -179
- package/studio-dist/server/assets/{usage-Cwle9-xY.js → usage-C1o0DLzS.js} +1 -1
- package/studio-dist/server/assets/{usage-CS4CBK9D.js → usage-DWbSPrPD.js} +10 -9
- package/studio-dist/server/assets/{useAnchoredPopupScrollLock-BjMNgXv9.js → useAnchoredPopupScrollLock-DLDmv6kM.js} +4 -135
- package/studio-dist/server/assets/useBlocker-CQtANHK8.js +111 -0
- package/studio-dist/server/assets/{useMutation-DpBIuWXt.js → useMutation-NjlA8oFY.js} +2 -2
- package/studio-dist/server/assets/useOpenInteractionType-CZYscfOb.js +136 -0
- package/studio-dist/server/assets/usePopupHandleStore-DEEXJYv0.js +26 -0
- package/studio-dist/server/assets/{vault-CEBBRLMb.js → vault-B_kfi1h-.js} +1 -1
- package/studio-dist/server/assets/{vault-DVQidlId.js → vault-dL79JlKH.js} +8 -115
- package/studio-dist/server/assets/{views-UgO0Qz_g.js → views-BSGH56lb.js} +3 -3
- package/studio-dist/server/assets/{warnings-C7hgXpdk.js → warnings-DtUVPV-k.js} +2 -2
- package/studio-dist/server/assets/work-D789VXGH.js +110 -0
- package/studio-dist/server/assets/work-DsCEfhmK.js +3817 -0
- package/studio-dist/server/assets/work-requests-BLhOmQFO.js +11 -0
- package/studio-dist/server/assets/{workflow-6dZZ1ofw.js → workflow-BOZ2sRYg.js} +9 -9
- package/studio-dist/server/server.js +3 -3
- package/wrappers/bin/openspec +87 -2
- package/studio-dist/client/assets/app-ggXJ_QVh.css +0 -2
- package/studio-dist/client/assets/button-amJ3g5oD.js +0 -1
- package/studio-dist/client/assets/cn-BQPKiwI4.js +0 -1
- package/studio-dist/client/assets/combobox-CJ7aGFid.js +0 -1
- package/studio-dist/client/assets/fields-BAiGkJ5N.js +0 -1
- package/studio-dist/client/assets/friction-DqOU59v7.js +0 -1
- package/studio-dist/client/assets/getting-started-yp42dj5S.js +0 -1
- package/studio-dist/client/assets/getting-started._topic-C9zVXz_m.js +0 -1
- package/studio-dist/client/assets/getting-started.index-DWbDKICP.js +0 -1
- package/studio-dist/client/assets/graph-BYaD_5Bq.js +0 -2
- package/studio-dist/client/assets/guides-D6T6W_jV.js +0 -1
- package/studio-dist/client/assets/index-Qx7reRPD.js +0 -40
- package/studio-dist/client/assets/panel-C4bf_h2W.js +0 -1
- package/studio-dist/client/assets/plugins._service._view-y6f2FDAB.js +0 -1
- package/studio-dist/client/assets/reports-JFSwSueq.js +0 -1
- package/studio-dist/client/assets/routes-BdOWSgzK.js +0 -1
- package/studio-dist/client/assets/search-CXosfvYh.js +0 -1
- package/studio-dist/client/assets/select-BHYYWPhK.js +0 -1
- package/studio-dist/client/assets/skills-Bo9FLsBd.js +0 -1
- package/studio-dist/client/assets/specs-view-CdE2rlli.js +0 -1
- package/studio-dist/client/assets/steps-CKUno4lh.js +0 -1
- package/studio-dist/client/assets/studio-0ueISxwP.js +0 -100
- package/studio-dist/client/assets/studio-queries-BflKt9va.js +0 -2
- package/studio-dist/client/assets/usage-BLsLy0nN.js +0 -55
- package/studio-dist/client/assets/useAnchoredPopupScrollLock-DC7f8GOp.js +0 -1
- package/studio-dist/client/assets/useMutation-uJUrejsi.js +0 -1
- package/studio-dist/client/assets/vault-BB1B_OhR.js +0 -1
- package/studio-dist/client/assets/workflow-BFzmI-06.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-MZURdZre.js";import{A as r,Cn as i,Dn as a,Et as o,G as s,Ir as c,Jn as ee,On as te,Ot as ne,Qt as l,Rr as u,Sn as d,Tn as re,Tt as f,Vn as ie,W as ae,Xt as oe,Zt as se,an as ce,br as le,c as ue,cr as p,i as m,in as de,j as fe,jn as h,lr as g,nr as pe,or as me,tn as he,wn as _,wt as ge,xn as v,xr as _e}from"./button-upSzkd-q.js";import{a as y,b as ve}from"./fields-DNZ4a89M.js";function b(e){let{open:t=!1,onOpenChange:n,elements:i={}}=e,a=u(),o=r()!=null,s=c(()=>new m({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:i.reference??null,floatingElement:i.floating??null,triggerElements:new ue,floatingId:a,syncOnly:!1,nested:o})).current;return p(()=>{let e={open:t,floatingId:a};i.reference!==void 0&&(e.referenceElement=i.reference,e.domReferenceElement=le(i.reference)?i.reference:null),i.floating!==void 0&&(e.floatingElement=i.floating),s.update(e)},[t,a,i.reference,i.floating,s]),s.context.onOpenChange=n,s.context.nested=o,s}var x=e(t(),1);function ye(e){return h&&e.movementX===0&&e.movementY===0}function S(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function C(e,t){return S(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function w(e,t,n){return S(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function be(e,t,n){return S(t,n?e===d:e===i,e===v)}function xe(e,t,n,r){return t===`both`||t===`horizontal`&&r?e===`Escape`:S(t,n?e===i:e===d,e===_)}function T(e,t){let{listRef:n,activeIndex:i,onNavigate:c=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:le=!1,loopFocus:ue=!1,nested:m=!1,rtl:h=!1,virtual:_=!1,focusItemOnOpen:v=`auto`,focusItemOnHover:y=!0,openOnArrowKeyDown:b=!0,disabledIndices:S=void 0,orientation:T=`vertical`,triggerOrientation:E=T,parentOrientation:Se,id:D,resetOnPointerLeave:O=!0,externalTree:Ce,nestedReturnFocusRef:k,grid:A}=t,we=A!=null,j=e.useState(`open`),M=e.useState(`floatingElement`),N=e.useState(`domReferenceElement`),P=e.context.dataRef,Te=he(M),F=de(N),I=s(Te),L=r(),R=fe(Ce),z=x.useRef(v),B=x.useRef(d??-1),V=x.useRef(null),H=x.useRef(!0),U=g(e=>{c(B.current===-1?null:B.current,e)}),W=x.useRef(!!M),Ee=x.useRef(j),G=x.useRef(!1),K=x.useRef(!1),De=x.useRef(null),Oe=s(S),q=s(j),J=s(d),ke=s(O),Ae=ae(),je=ae(),Y=g(()=>{Ae.cancel();function e(e){_||(De.current=ve(e,{sync:G.current,preventScroll:!0}))}let t=n.current[B.current],r=K.current;t&&e(t),(G.current?e=>e():e=>Ae.request(e))(()=>{let i=n.current[B.current]||t;i&&(t||e(i),Fe&&(r||!H.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});p(()=>{P.current.orientation=T},[P,T]),p(()=>{j||(V.current=null),j&&v===`auto`||(z.current=v)},[j,v]),p(()=>{u&&(j&&M?(B.current=d??-1,z.current&&d!=null&&(K.current=!0,U())):W.current&&(B.current=-1,U()))},[u,j,M,d,U]),p(()=>{if(u){if(!j)G.current=!1;else if(M){if(i==null){if(G.current=!1,J.current!=null)return;if(W.current&&(B.current=-1,Y()),(!Ee.current||!W.current)&&z.current&&(V.current!=null||z.current===!0&&V.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>je.request(e):queueMicrotask)(t),e+=1):(B.current=V.current==null||w(V.current,E,h)||m?f(n):ge(n),V.current=null,U())};t()}}else ne(n.current,i)||(B.current=i,Y(),K.current=!1)}}},[u,j,M,i,J,m,n,E,h,U,Y,je]),p(()=>{if(!u||M||!R||_||!W.current)return;let e=R.nodesRef.current,t=e.find(e=>e.id===L)?.context?.elements.floating,n=re(me(N??t??null)),r=e.some(e=>e.context&&a(e.context.elements.floating,n));t&&!r&&H.current&&t.focus({preventScroll:!0})},[u,M,N,R,L,_]),p(()=>{Ee.current=j,W.current=!!M});let Me=i!=null,Ne=g(e=>{if(!q.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(B.current!==t||i!==t)&&(B.current=t,U(e))}),X=g(()=>Se??R?.nodesRef.current.find(e=>e.id===L)?.context?.dataRef?.current.orientation),Pe=g(()=>f(n,Oe.current)),Z=g(t=>{if(H.current=!1,G.current=!0,t.which===229||!q.current&&t.currentTarget===I.current)return;if(m&&xe(t.key,T,h,we)){C(t.key,X())||l(t),e.setOpen(!1,pe(ee,t.nativeEvent));let n=k?.current??N;_e(n)&&n.focus();return}i!=null&&i!==B.current&&!ne(n.current,i)&&(B.current=i);let r=B.current,s=f(n,S),c=ge(n,S);if(F||(t.key===`Home`&&(l(t),B.current=s,U(t)),t.key===`End`&&(l(t),B.current=c,U(t))),A!=null){let e=A(t,B.current,n,T,ue,h,S,s,c);if(e!=null&&e!==B.current&&(B.current=e,U(t)),T===`both`)return}if(C(t.key,T)){l(t);let e=re(t.currentTarget.ownerDocument);if(j&&!_&&a(t.currentTarget,e)&&!n.current.some(t=>t!=null&&a(t,e))){B.current=w(t.key,T,h)?s:c,U(t),i===B.current&&Y();return}let{index:ee,wrapped:te}=o(n.current,r,{decrement:!w(t.key,T,h),loopFocus:ue,allowEscape:le,disabledIndices:S,minIndex:s,maxIndex:c});te&&(G.current=!1),B.current=ee,U(t)}}),Fe=x.useMemo(()=>({onFocus(e){G.current=!0,Ne(e)},onClick({currentTarget:e}){_||e.focus({preventScroll:!0})},onMouseMove(e){ye(e)||(G.current=!0,K.current=!1,y&&Ne(e))},onPointerLeave(e){if(!q.current||!H.current||e.pointerType===`touch`)return;G.current=!0;let t=e.relatedTarget;if(y&&!n.current.includes(t)&&ke.current&&(De.current?.(),De.current=null,B.current=-1,U(e),!_)){let e=I.current,t=re(me(e));e&&a(e,t)&&e.focus({preventScroll:!0})}}}),[Ne,q,I,y,n,U,ke,_]),Q=x.useMemo(()=>_&&j&&Me&&{"aria-activedescendant":`${D}-${i}`},[_,j,Me,D,i]),Ie=x.useMemo(()=>({...F?{}:Q,onKeyDown(t){if(t.key===`Tab`&&t.shiftKey&&j&&!_){let n=te(t.nativeEvent);if(n&&!a(I.current,n))return;l(t);let r=pe(ie,t.nativeEvent);e.setOpen(!1,r);let i=k?.current??N;!r.isCanceled&&_e(i)&&i.focus()}else Z(t)},onPointerMove(e){ye(e)||(H.current=!0)}}),[Q,Z,I,F,e,j,_,N,k]),$=x.useMemo(()=>{function t(t){e.setOpen(!0,pe(ee,t.nativeEvent,t.currentTarget))}function n(e){v===`auto`&&oe(e.nativeEvent)&&(z.current=!_)}function r(e){z.current=v,v===`auto`&&se(e.nativeEvent)&&(z.current=!0)}return{onKeyDown(n){let r=e.select(`open`);H.current=!1;let i=n.key.startsWith(`Arrow`),a=be(n.key,X(),h),o=C(n.key,r?T:E),s=(m?a:o)||n.key===`Enter`||n.key.trim()===``;if(_&&r&&(!m||ce(n.currentTarget)))return Z(n);if(r||b||!i){if(s){let e=C(n.key,X());V.current=m&&e?null:n.key}m?a&&(l(n),r?(B.current=Pe(),U(n),_&&I.current?.focus()):t(n)):o&&(J.current!=null&&(B.current=J.current),l(n),!r&&b?t(n):Z(n),r&&U(n))}},onFocus(t){t.target===t.currentTarget&&e.select(`open`)&&!_&&(B.current=-1,U(t))},onPointerDown:r,onPointerEnter:r,onMouseDown:n,onClick:n}},[Z,v,Pe,m,U,e,b,T,E,X,h,J,_,I]),Le=x.useMemo(()=>({...Q,...$}),[Q,$]);return x.useMemo(()=>u?{reference:Le,floating:Ie,item:Fe,trigger:$}:{},[u,Le,Ie,$,Fe])}function E(e){let t=x.useRef(!0);t.current&&(t.current=!1,e())}function Se(e,t,n=Object.is){let{length:r}=e;if(r!==t.length)return!1;for(let i=0;i<r;i+=1)if(!n(e[i],t[i]))return!1;return!0}var D=(e,t)=>Object.is(e,t);function O(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Ce(e,t,n){return Array.isArray(e)&&Array.isArray(t)?!Se(e,t,(e,t)=>O(e,t,n)):e!==t}function k(e,t,n){return e?e.some(e=>e!==void 0&&O(t,e,n)):!1}function A(e,t,n){return e?e.findIndex(e=>e!==void 0&&O(e,t,n)):-1}function we(e,t){if(t!==D)return n=>k(e,n,t);let n=new Set(e);return n.delete(void 0),t=>n.has(t)&&(t!==0||e.some(e=>Object.is(t,e)))}function j(e,t,n,r){let i=r&&Array.isArray(t)?e.findIndex(we(t,n)):A(e,t,n);return i===-1?null:i}function M(e,t,n,r,i,a){return k(r,t,i)?a!=null&&e>a&&k(r,n[a],i)?a:e:e===a?j(n,r,i,!0):a}function N(e,t,n){return e.filter(e=>!O(t,e,n))}function P(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Te=n();function F(e){return typeof e==`object`&&!!e&&Array.isArray(e.items)}function I(e){return F(e?.[0])}function L(e){return I(e)?e.flatMap(e=>e.items):e}function R(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(I(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function z(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return P(e)}function B(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?P(e.value):P(e)}function V(e,t,n){function r(){return z(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return(Object.hasOwn(t,e)?t[e]:void 0)??r();if(Array.isArray(t)){let n=L(t);if(typeof e!=`object`||!e){let t=n.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=n.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function H(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Te.jsx)(x.Fragment,{children:V(r,t,n)},i)),e),[])}var U=20;function W(e,t,n,r){let[i,a]=x.useState(!1);p(()=>{if(!e||!t||n==null){a(!1);return}let r=me(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-U)},[e,t,n]),y(e&&(!t||i),r)}export{E as _,H as a,B as c,A as d,j as f,k as g,M as h,I as i,O as l,N as m,L as n,V as o,Ce as p,R as r,z as s,W as t,D as u,T as v,b as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./useSelector-AYcH7lB0.js";import{a as t,n}from"./jsx-runtime-MZURdZre.js";var r=t(n(),1);function i(e,t){if(e===void 0)return{shouldBlockFn:()=>!0,withResolver:!1};if(`shouldBlockFn`in e)return e;if(typeof e==`function`){let n=!!(t??!0);return{shouldBlockFn:async()=>n?await e():!1,enableBeforeUnload:n,withResolver:!1}}let n=!!(e.condition??!0),r=e.blockerFn;return{shouldBlockFn:async()=>n&&r!==void 0?await r():n,enableBeforeUnload:n,withResolver:r===void 0}}function a(t,n){let{shouldBlockFn:a,enableBeforeUnload:o=!0,disabled:s=!1,withResolver:c=!1}=i(t,n),l=e(),{history:u}=l,[d,f]=r.useState({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0});return r.useEffect(()=>s?void 0:u.block({blockerFn:async e=>{function t(e){let t=l.parseLocation(e),[,n,r]=l.getMatchedRoutes(t.pathname);return r===void 0?{routeId:`__notFound__`,fullPath:t.pathname,pathname:t.pathname,params:n,search:l.options.parseSearch(e.search)}:{routeId:r.id,fullPath:r.fullPath,pathname:t.pathname,params:n,search:l.options.parseSearch(e.search)}}let n=t(e.currentLocation),r=t(e.nextLocation);if(n.routeId===`__notFound__`&&r.routeId!==`__notFound__`)return!1;let i=await a({action:e.action,current:n,next:r});if(!c)return i;if(!i)return!1;let o=await new Promise(t=>{f({status:`blocked`,current:n,next:r,action:e.action,proceed:()=>t(!1),reset:()=>t(!0)})});return f({status:`idle`,current:void 0,next:void 0,action:void 0,proceed:void 0,reset:void 0}),o},enableBeforeUnload:o}),[a,o,s,c,u,l]),d}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,l as t,o as n,p as r,s as i}from"./cn-BCnYnarL.js";import{a,n as o}from"./jsx-runtime-MZURdZre.js";import{$ as s,J as c,V as l,et as u}from"./studio-queries-CKtAnIKP.js";var d=class extends n{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||f(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=i({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),a=this.state.status===`pending`,o=!r.canStart();try{if(a)t();else{this.#i({type:`pending`,variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:o})}this.state.isPaused&&r.canStart()&&t();let i=await r.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#i({type:`success`,data:i}),i}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let n=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=n(this.state),t.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function f(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var p=class extends e{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),s(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&l(t.mutationKey)!==l(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??f();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){t.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},m=a(o(),1);function h(e,n){let i=r(n),[a]=m.useState(()=>new p(i,e));m.useEffect(()=>{a.setOptions(e)},[a,e]);let o=m.useSyncExternalStore(m.useCallback(e=>a.subscribe(t.batchCalls(e)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),s=m.useCallback((...e)=>{a.mutate(e[0],e[1]).catch(c)},[a]);if(o.error&&u(a.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:s,mutateAsync:o.mutate}}export{d as n,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t}from"./jsx-runtime-MZURdZre.js";import{Mr as n,Nn as r,On as i,W as a,Y as o,Yt as s,Zt as c,an as l,er as u,lr as d,nr as f}from"./button-upSzkd-q.js";import{c as p}from"./fields-DNZ4a89M.js";var m=e(t(),1);function h(e,t={}){let{enabled:r=!0,event:d=`click`,toggle:p=!0,ignoreMouse:h=!1,stickIfOpen:g=!0,touchOpenDelay:_=0,reason:v=u}=t,y=e.context.dataRef,b=m.useRef(void 0),x=a(),S=o(),C=m.useMemo(()=>{function t(t,n,r,i){let a=f(v,n,r);t&&i===`touch`&&_>0?S.start(_,()=>{e.setOpen(!0,a)}):e.setOpen(t,a)}function n(t,n,r){let i=y.current.openEvent,a=e.select(`domReferenceElement`)!==n;return t&&a||!t||!p?!0:i&&(typeof g==`function`?g():g)?!r(i.type):!1}return{onPointerDown(e){b.current=s(e.pointerType,!0)&&c(e.nativeEvent)?`virtual`:e.pointerType},onMouseDown(r){let a=b.current,o=r.nativeEvent,c=e.select(`open`);if(r.button!==0||d===`click`||s(a,!0)&&h)return;let u=n(c,r.currentTarget,e=>e===`click`||e===`mousedown`),f=i(o),p=l(f);if(p||a===`virtual`){t(u,o,p?f:r.currentTarget,a);return}let m=r.currentTarget;x.request(()=>{t(u,o,m,a)})},onClick(r){if(d===`mousedown-only`)return;let i=b.current;d===`mousedown`&&i?b.current=void 0:s(i,!0)&&h||t(n(e.select(`open`),r.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),r.nativeEvent,r.currentTarget,i)},onKeyDown(){b.current=void 0}}},[y,d,h,v,e,g,p,x,S,_]);return m.useMemo(()=>r?{reference:C}:n,[r,C])}function g(e){let t=m.useRef(``),n=m.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:m.useCallback(n=>{n.detail===0?e(n,`keyboard`):(`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``)},[e]),onPointerDown:n}}function _(e,t){let{onClick:n,onPointerDown:i}=g(d((n,i)=>{(typeof e==`function`?e():e)||t(i||(r?`touch`:``))}));return m.useMemo(()=>({onClick:n,onPointerDown:i}),[n,i])}function v(e){let[t,n]=m.useState(null),r=_(e,n);return p(e,t=>{t&&!e&&n(null)}),m.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}export{_ as n,h as r,v as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t}from"./jsx-runtime-MZURdZre.js";import{Nr as n,s as r}from"./button-upSzkd-q.js";var i=e(t(),1),a=r();function o(e){let t=i.useCallback(t=>e===void 0?n:e.subscribeStore(t),[e]),r=i.useCallback(()=>e===void 0?void 0:e.store,[e]);return(0,a.useSyncExternalStore)(t,r,()=>e?.serverStore)}export{o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{B as e,It as t,Lt as n,St as r,j as i,o as a,vt as o}from"./index-D5oGyvG8.js";import{b as s,d as c,dt as l,h as u,i as d,m as f,p,r as m,ut as h,v as g,y as _}from"./studio-queries-CKtAnIKP.js";import{t as v}from"./useMutation-DKeEoP5S.js";import{p as y,t as b}from"./cn-BCnYnarL.js";import{a as x,n as S,t as C}from"./jsx-runtime-MZURdZre.js";import{ct as w,n as T,r as E,rt as D,t as O}from"./button-upSzkd-q.js";import{t as k}from"./useBlocker-BQOfcu_f.js";import{t as A}from"./markdown-view-CJ8JsLb7.js";var j=x(S(),1),M=C(),N=(e,t)=>`/api/vault/events?${new URLSearchParams({companion:e,path:t})}`;function P(e,t,n){let r=(0,j.useRef)(n);(0,j.useEffect)(()=>{r.current=n}),(0,j.useEffect)(()=>{if(typeof EventSource>`u`)return;let n=new EventSource(N(e,t));return n.addEventListener(`message`,e=>{try{r.current(JSON.parse(e.data))}catch{}}),()=>n.close()},[e,t])}function F({crumbs:e,children:t}){return(0,M.jsxs)(`div`,{className:`vault-bar sticky top-0 z-2 flex min-h-[52px] items-center gap-2 border-b border-rule-soft bg-[color-mix(in_srgb,var(--bg)_88%,transparent)] px-6 py-2 backdrop-blur-md max-sm:px-3`,children:[(0,M.jsx)(`div`,{className:`mr-auto flex min-w-0 items-center gap-1`,children:e}),t]})}var I=`vault-prose prose mx-auto w-full max-w-[68ch] px-10 pt-10 pb-28 max-sm:px-4`,L=T({variant:`default`,size:`sm`});function R({path:e}){return(0,M.jsxs)(`button`,{type:`button`,className:T({variant:`ghost`,size:`sm`}),"data-copy":e,"data-copy-label":`path`,"aria-label":`Copy path`,children:[(0,M.jsx)(E,{name:`copy`,className:`size-3.5`}),(0,M.jsx)(`span`,{className:`@max-[1000px]:hidden`,children:`Copy path`})]})}function z({companion:e,data:t,writable:n,search:r,crumbs:i}){let a=t.open;return a?n&&r.mode===`edit`?(0,M.jsx)(ee,{companion:e,data:t,crumbs:i},`${a.path}:edit`):(0,M.jsx)(V,{companion:e,data:t,writable:n,crumbs:i},`${a.path}:read`):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(F,{crumbs:i}),(0,M.jsxs)(`div`,{className:I,children:[(0,M.jsx)(`h1`,{className:`text-xl`,children:t.refusal?`File refused`:`Open a markdown file`}),(0,M.jsx)(`p`,{className:t.refusal?`vault-warning text-warn`:`empty text-muted`,children:t.refusal??`Choose a file from the tree to begin.`})]})]})}var B=e=>e.split(`/`).at(-1)??e;function V({companion:e,data:t,writable:n,crumbs:r}){let i=t.open,a=y(),[o,s]=(0,j.useState)(``);return P(e,i.path,t=>{t.kind===`removed`?s(`this file no longer exists on disk`):m(a,e)}),(0,M.jsxs)(`div`,{"data-vault-root":!0,"data-vault-mode":`read`,"data-vault-path":i.path,children:[(0,M.jsxs)(F,{crumbs:r,children:[(0,M.jsx)(R,{path:i.path}),n?(0,M.jsxs)(h,{className:L,id:`vault-mode-edit`,to:`/vault`,search:e=>({...e,mode:`edit`}),"data-vault-mode-link":!0,children:[(0,M.jsx)(E,{name:`pencil`,className:`size-3.5`}),`Edit`]}):(0,M.jsx)(`span`,{className:`text-xs text-muted`,title:`Start Studio with --writable to edit.`,children:`Read only`})]}),(0,M.jsxs)(`article`,{className:I,"aria-label":B(i.path),children:[(0,M.jsx)(A,{nodes:i.markdown}),(0,M.jsx)(`p`,{id:`vault-status`,className:`text-sm text-warn`,"aria-live":`polite`,children:o})]})]})}function H({companion:t,open:r,text:i}){let[a,o]=(0,j.useState)(i);(0,j.useEffect)(()=>{let e=setTimeout(()=>o(i),250);return()=>clearTimeout(e)},[i]);let s=e(`(min-width: 64rem)`),c=a===r.content,l=n({queryKey:[`vault-preview`,t,r.path,a],queryFn:()=>_({data:{companion:t,path:r.path,content:a}}),placeholderData:e=>e,enabled:s&&!c,gcTime:0}),u=c?r.markdown:l.data;return(0,M.jsxs)(`div`,{className:`vault-preview min-h-0 overflow-auto max-lg:hidden`,"aria-label":`Preview`,role:`region`,"data-vault-preview":!0,children:[(0,M.jsx)(`p`,{className:`m-0 px-7 pt-3 text-xs font-semibold text-muted`,children:`Preview`}),(0,M.jsx)(`div`,{className:`prose px-7 pt-2 pb-16 text-sm`,children:u?(0,M.jsx)(A,{nodes:u}):null})]})}function ee({companion:e,data:t,crumbs:n}){let r=t.open,i=y(),a=l(),[c,u]=(0,j.useState)(r.content),[d,f]=(0,j.useState)(r.content),[p,g]=(0,j.useState)(r.token),[_,x]=(0,j.useState)(``),[S,C]=(0,j.useState)(null),w=c!==d,T=(0,j.useRef)(w);(0,j.useEffect)(()=>{T.current=w},[w]);let D=o(e=>e.setDirty);(0,j.useEffect)(()=>D(w),[w,D]),(0,j.useEffect)(()=>()=>D(!1),[D]),k({shouldBlockFn:()=>T.current&&!window.confirm(`Discard unsaved changes?`),enableBeforeUnload:()=>T.current}),P(e,r.path,e=>{if(e.kind===`removed`){x(`this file no longer exists on disk`);return}let t={content:e.content??``,token:e.token??``};e.kind===`overwritten`?(C(t),x(`a version was overwritten; its content is available below`)):w?(C(t),x(`the file changed on disk; unsaved content is still in the editor`)):(u(t.content),f(t.content),g(t.token),x(`updated from disk`))});let A=v({mutationFn:()=>s({data:{companion:e,path:r.path,content:c,token:p}}),onSuccess:t=>{t.kind===`conflict`?(C({content:t.content,token:t.token}),x(t.reason||`save refused`)):(g(t.token),f(c),T.current=!1,D(!1),x(`saved`),m(i,e),a({to:`/vault`,search:e=>({...e,mode:void 0}),resetScroll:!1}))},onError:e=>x(e.message||`save failed`)});return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-vault-root":!0,"data-vault-mode":`edit`,"data-vault-path":r.path,children:[(0,M.jsxs)(F,{crumbs:n,children:[w?(0,M.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs text-warn`,children:[(0,M.jsx)(`span`,{className:`size-[7px] rounded-full bg-current`,"aria-hidden":`true`}),`Unsaved`]}):null,(0,M.jsxs)(h,{className:L,id:`vault-mode-read`,to:`/vault`,search:e=>({...e,mode:void 0}),"data-vault-mode-link":!0,children:[(0,M.jsx)(E,{name:`eye`,className:`size-3.5`}),`Read`]}),(0,M.jsx)(O,{variant:`primary`,size:`sm`,id:`vault-save`,onClick:()=>A.mutate(),disabled:A.isPending,children:`Save`})]}),(0,M.jsxs)(`div`,{className:_||S?`grid gap-2 border-b border-rule-soft px-6 py-2.5 text-sm`:`sr-only`,children:[(0,M.jsx)(`p`,{id:`vault-status`,className:`m-0 text-warn`,"aria-live":`polite`,children:_}),S?(0,M.jsxs)(`div`,{id:`vault-incoming`,className:`grid gap-2`,children:[(0,M.jsx)(`strong`,{id:`vault-incoming-title`,className:`text-sm`,children:`Incoming version`}),(0,M.jsx)(`pre`,{id:`vault-incoming-content`,className:`m-0 max-h-40 overflow-auto rounded-control border border-rule bg-surface p-3 font-mono text-xs whitespace-pre-wrap`,children:S.content}),(0,M.jsx)(O,{size:`sm`,id:`vault-recover`,className:`justify-self-start`,onClick:()=>{u(S.content),f(S.content),S.token&&g(S.token),C(null),x(`incoming version loaded into the editor`)},children:`Put incoming content back`})]}):null]}),(0,M.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-2 max-lg:grid-cols-1`,children:[(0,M.jsx)(`textarea`,{id:`vault-editor`,"data-vault-editor":!0,"data-vault-path":r.path,"aria-label":`Markdown source of ${B(r.path)}`,spellCheck:!1,value:c,onChange:e=>u(e.target.value),className:b(`min-h-[60vh] resize-none border-0 border-r border-rule-soft bg-transparent px-6 pt-4 pb-10 font-mono text-[0.86rem] leading-[1.75] text-text outline-none focus-visible:outline-none max-lg:border-r-0`)}),(0,M.jsx)(H,{companion:e,open:r,text:c})]})]})}var U=e=>e.split(`/`).filter(Boolean),W=`flex w-full min-w-0 items-center gap-2 rounded-[6px] border-0 bg-transparent px-2.5 py-1.5 text-left text-sm text-text no-underline hover:bg-surface aria-[current=page]:bg-accent-soft aria-[current=page]:font-semibold`;function G({entry:e,current:t,label:n}){return(0,M.jsxs)(h,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:b(W,`vault-file`),"data-vault-entry":e.path,"aria-current":t?`page`:void 0,children:[(0,M.jsx)(E,{name:`doc`,className:b(`size-3.5`,t?`text-accent`:`text-muted`)}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n??e.name})]})}function K({dir:e,className:t,children:n}){return(0,M.jsx)(h,{to:`/vault`,search:t=>({...t,path:void 0,dir:e??void 0,mode:void 0}),className:t,children:n})}function q({entry:e,companion:t,search:n}){return e.kind===`file`?(0,M.jsx)(G,{entry:e,current:n.path===e.path}):(0,M.jsx)(te,{entry:e,companion:t,search:n})}function te({entry:e,companion:t,search:r}){let[i,a]=(0,j.useState)(e.children!==void 0),o=n({...p(t,e.path),enabled:i&&e.children===void 0}),s=e.children??o.data?.entries;return(0,M.jsxs)(`details`,{className:`vault-directory group/dir`,open:i,"data-vault-dir":e.path,onToggle:e=>a(e.currentTarget.open),children:[(0,M.jsxs)(`summary`,{className:b(W,`cursor-pointer list-none font-semibold [&::-webkit-details-marker]:hidden`),"aria-current":r.dir===e.path?`page`:void 0,children:[(0,M.jsx)(E,{name:`right`,className:`size-3 text-muted transition-transform group-open/dir:rotate-90`}),(0,M.jsx)(E,{name:`folder`,className:`size-3.5 text-muted`}),(0,M.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name})]}),(0,M.jsxs)(`div`,{className:`vault-children grid gap-px pl-3.5`,children:[i&&s?s.map(e=>(0,M.jsx)(q,{entry:e,companion:t,search:r},e.path)):null,o.error?(0,M.jsx)(`p`,{className:`vault-warning m-0 px-2.5 py-1 text-xs text-warn`,children:o.error.message}):null]})]})}var J=`m-0 px-2.5 py-1.5 text-sm text-muted`,Y=`vault-warning m-0 px-2.5 py-1.5 text-xs text-warn`;function ne({data:e,companion:t,search:n}){return e.failure?(0,M.jsx)(`div`,{"data-vault-slot":`tree`,children:(0,M.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]})}):e.tree===null?(0,M.jsx)(`div`,{"data-vault-slot":`tree`,"aria-busy":`true`,children:(0,M.jsx)(`p`,{className:b(J,`empty`),children:`Listing files…`})}):(0,M.jsxs)(`div`,{"data-vault-slot":`tree`,"data-vault-generation":e.generation??void 0,children:[(0,M.jsx)(re,{data:e}),e.tree.length===0?(0,M.jsx)(`p`,{className:b(J,`empty`),children:`This companion has no markdown files.`}):(0,M.jsx)(`nav`,{className:`vault-tree grid gap-px`,"aria-label":`Markdown files`,children:e.tree.map(e=>(0,M.jsx)(q,{entry:e,companion:t,search:n},e.path))})]})}function re({data:e}){return e.warning?(0,M.jsxs)(`p`,{className:Y,children:[e.warning,`. The tree may be out of date.`]}):e.watching?null:(0,M.jsx)(`p`,{className:Y,children:`The tree may be out of date.`})}function ie({companion:e,query:t,search:r}){let[i,a]=(0,j.useState)(t);(0,j.useEffect)(()=>{let e=setTimeout(()=>a(t),150);return()=>clearTimeout(e)},[t]);let o=n({...f(e,i),enabled:i.trim().length>0});if(!o.data)return null;let{shown:s,total:c}=o.data,l=c-s.length;return(0,M.jsxs)(`div`,{"data-vault-filter-results":!0,children:[s.length===0?(0,M.jsx)(`p`,{className:b(J,`empty`),children:`No files match.`}):(0,M.jsx)(`nav`,{className:`vault-tree vault-results grid gap-px`,"aria-label":`Matching files`,children:s.map(e=>(0,M.jsx)(G,{entry:e,current:r.path===e.path,label:e.path},e.path))}),l>0?(0,M.jsxs)(`p`,{className:J,"data-vault-more":!0,children:[l,` more match`,l===1?``:`es`,`; refine the filter.`]}):null]})}var X=`vault-crumb rounded-[6px] px-1.5 py-0.5 text-sm text-muted no-underline hover:bg-surface hover:text-text`;function ae({rootName:e,search:t}){let n=U(t.path??t.dir??``);return(0,M.jsx)(`nav`,{className:`vault-breadcrumb min-w-0`,"aria-label":`Breadcrumb`,"data-vault-crumb":!0,children:(0,M.jsxs)(`ol`,{className:`m-0 flex min-w-0 list-none items-center gap-0.5 overflow-hidden p-0 text-sm text-muted`,children:[(0,M.jsx)(`li`,{className:`flex-none`,children:n.length===0?(0,M.jsx)(`span`,{"aria-current":`page`,className:`px-1.5 font-semibold text-text`,children:e}):(0,M.jsx)(K,{dir:null,className:X,children:e})}),n.map((e,t)=>{let r=n.slice(0,t+1).join(`/`),i=t===n.length-1;return(0,M.jsxs)(`li`,{className:b(`flex items-center gap-0.5`,i?`min-w-0`:`flex-none max-md:hidden`),children:[(0,M.jsx)(`span`,{"aria-hidden":`true`,children:`/`}),i?(0,M.jsx)(`span`,{"aria-current":`page`,className:`truncate px-1.5 font-semibold text-text`,children:e}):(0,M.jsx)(K,{dir:r,className:X,children:e})]},r)})]})})}function oe(e,t){let n=e;for(let e of U(t)){let t=n?.find(t=>t.kind===`directory`&&t.name===e);if(!t)return null;n=t.children}return n??null}function se({data:e,rootName:t}){let n=e.failure?(0,M.jsxs)(`p`,{className:Y,children:[`The files could not be listed: `,e.failure]}):e.tree===null?(0,M.jsx)(`p`,{className:b(J,`empty`),children:`Listing files…`}):null,r=e.dir?U(e.dir):[],i=r.at(-1)??t;if(n)return(0,M.jsx)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto w-full max-w-[820px] px-10 py-8`,"aria-busy":e.tree===null,children:n});let a=(e.dir?oe(e.tree,e.dir):null)??e.tree;return(0,M.jsxs)(`div`,{"data-vault-slot":`listing`,className:`vault-listing mx-auto grid w-full max-w-[820px] gap-4 px-10 py-8 max-sm:px-4`,children:[(0,M.jsx)(`h1`,{className:`m-0 text-xl font-semibold`,children:i}),e.dirMissing?(0,M.jsx)(`p`,{className:Y,children:`That folder is not in the tree; showing the root.`}):null,a.length===0&&r.length===0?(0,M.jsx)(`p`,{className:b(J,`empty`),children:`This companion has no markdown files.`}):(0,M.jsx)(D,{title:`In this folder`,count:a.length,children:(0,M.jsxs)(`ul`,{className:`vault-rows m-0 list-none p-0`,"aria-label":`Folder contents`,children:[r.length>0?(0,M.jsx)(`li`,{children:(0,M.jsxs)(K,{dir:r.length>1?r.slice(0,-1).join(`/`):null,className:b(w,`vault-row py-1.5`),children:[(0,M.jsx)(E,{name:`left`,className:`text-muted`}),(0,M.jsx)(`span`,{children:`..`})]})}):null,a.map(e=>(0,M.jsx)(`li`,{children:e.kind===`directory`?(0,M.jsxs)(K,{dir:e.path,className:b(w,`vault-row py-1.5 font-semibold`),children:[(0,M.jsx)(E,{name:`folder`,className:`text-muted`}),(0,M.jsx)(`span`,{className:`truncate`,children:e.name})]}):(0,M.jsxs)(h,{to:`/vault`,search:t=>({...t,path:e.path,dir:void 0,mode:void 0}),className:b(w,`vault-row py-1.5`),children:[(0,M.jsx)(E,{name:`doc`,className:`text-muted`}),(0,M.jsx)(`span`,{className:`truncate`,children:e.name})]})},e.path))]})})]})}function Z(e){return typeof e==`string`?e:(e.c??[]).map(Z).join(``)}function ce(e){return(e??[]).filter(e=>typeof e!=`string`&&e.t===`h2`).map((e,t)=>({index:t,text:Z(e)}))}var Q=e=>[...e?.querySelectorAll(`article .markdown-body h2`)??[]];function le(e,t,n){let[r,i]=(0,j.useState)(null);return(0,j.useEffect)(()=>{if(!t)return;let n=e.current,r=Q(n);if(r.length===0||typeof IntersectionObserver>`u`)return;let a=new IntersectionObserver(e=>{let t=e.find(e=>e.isIntersecting);t&&i(r.indexOf(t.target))},{root:n,rootMargin:`-60px 0px -70% 0px`});for(let e of r)a.observe(e);return()=>a.disconnect()},[e,t]),{current:r!==null&&r<n?r:0,go:t=>{Q(e.current)[t]?.scrollIntoView({behavior:`smooth`,block:`start`}),i(t)}}}function ue({headings:e,current:t,go:n}){return(0,M.jsxs)(`nav`,{className:`vault-outline min-h-0 overflow-auto border-l border-rule-soft px-5 pt-[72px] pb-6 @max-[1080px]:hidden`,"aria-label":`Outline`,children:[(0,M.jsx)(`h2`,{className:`m-0 mb-2 text-xs font-semibold text-muted`,children:`On this page`}),(0,M.jsx)(`ol`,{className:`m-0 grid list-none gap-0.5 p-0`,children:e.map(e=>(0,M.jsx)(`li`,{children:(0,M.jsx)(`button`,{type:`button`,className:b(`block w-full truncate rounded-r-[8px] border-0 bg-transparent px-2.5 py-1 text-left text-sm text-text hover:bg-surface`,t===e.index&&`font-semibold text-accent shadow-[inset_2px_0_0_var(--accent)]`),"aria-current":t===e.index?`location`:void 0,onClick:()=>n(e.index),children:e.text})},e.index))})]})}var de=[],$=(e,t)=>[e?`272px`:null,`minmax(0,1fr)`,t?`232px`:null].filter(Boolean).join(` `);function fe({data:e,companion:t,search:n,stale:i,refresh:a,filter:o,setFilter:s,hidden:c}){return(0,M.jsxs)(`aside`,{hidden:c,className:`vault-tree-panel flex min-h-0 flex-col border-r border-rule @max-[720px]:max-h-[40vh] @max-[720px]:border-r-0 @max-[720px]:border-b`,id:`vault-tree-panel`,"aria-label":`Files`,children:[(0,M.jsxs)(`div`,{className:`flex items-center justify-between pt-3 pr-2.5 pb-2 pl-5`,children:[(0,M.jsx)(`strong`,{className:`text-sm`,children:`Files`}),(0,M.jsx)(r,{label:`Refresh tree`,side:`bottom`,children:(0,M.jsx)(O,{size:`icon-sm`,variant:`ghost`,"aria-label":a.isPending?`Refreshing…`:`Refresh tree`,onClick:()=>a.mutate(),disabled:a.isPending,children:(0,M.jsx)(E,{name:`refresh`,className:a.isPending?`animate-spin`:void 0})})})]}),(0,M.jsx)(`p`,{id:`vault-stale`,className:Y+` mx-2.5`,role:`status`,hidden:!i,children:`Files changed — refresh tree.`}),a.error?(0,M.jsx)(`p`,{className:Y+` mx-2.5`,role:`status`,children:a.error.message}):null,(0,M.jsxs)(`label`,{className:`mx-3.5 mb-2 flex h-[34px] items-center gap-2 rounded-control border border-rule bg-surface pr-2 pl-2.5 text-muted focus-within:border-accent`,children:[(0,M.jsx)(E,{name:`search`,className:`size-3.5`}),(0,M.jsx)(`input`,{type:`search`,id:`vault-filter`,className:`vault-filter min-w-0 flex-1 border-0 bg-transparent text-sm text-text outline-none placeholder:text-muted`,placeholder:`Go to file`,"aria-label":`Go to file`,value:o,onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Escape`&&s(``)}})]}),(0,M.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-2.5 pb-6`,children:o.trim()?(0,M.jsx)(ie,{companion:t,query:o,search:n}):(0,M.jsx)(ne,{data:e,companion:t,search:n})})]})}function pe({companion:e,rootName:t,writable:a,search:s}){let c=y(),l=n(u(e,s)),f=n({...u(e,s,!0),enabled:!(!l.data||l.data.tree!==null||l.data.failure)}).data??l.data,[p,m]=(0,j.useState)(``),h=o(e=>e.latestGeneration),_=o(e=>e.treeHidden),b=o(e=>e.toggleTree),x=o(e=>e.hydrate);(0,j.useEffect)(x,[x]);let S=v({mutationFn:()=>g({data:{companion:e,path:s.path,dir:s.dir,refresh:!0,wait:!0}}),onSuccess:t=>void d(c,e,s,t)}),C=(0,j.useRef)(null),w=!!f?.open&&s.mode!==`edit`,T=w?ce(f?.open?.markdown):de,D=le(C,w?f?.open?.markdown:void 0,T.length);if(!f)return(0,M.jsx)(i,{});let k=h!==null&&f.generation!==null&&h>f.generation,A=T.length>0,N=(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(r,{label:_?`Show files`:`Hide files`,side:`bottom`,children:(0,M.jsx)(O,{size:`icon-sm`,variant:`ghost`,id:`vault-tree-toggle`,"aria-controls":`vault-tree-panel`,"aria-expanded":!_,"aria-label":_?`Show files`:`Hide files`,onClick:b,children:(0,M.jsx)(E,{name:`sidebar`})})}),(0,M.jsx)(ae,{rootName:t,search:s})]});return(0,M.jsx)(`div`,{className:`@container flex min-h-0 flex-1 flex-col`,children:(0,M.jsxs)(`section`,{className:`vault-layout grid min-h-0 flex-1 border-t border-rule @max-[720px]:grid-cols-1!`,style:{"--vault-wide":$(!0,A),"--vault-wide-bare":$(!1,A),"--vault-narrow":$(!0,!1),"--vault-narrow-bare":$(!1,!1)},"data-vault-layout":!0,children:[(0,M.jsx)(fe,{data:f,companion:e,search:s,stale:k,refresh:S,filter:p,setFilter:m,hidden:_}),(0,M.jsx)(`div`,{ref:C,className:`vault-main min-h-0 min-w-0 overflow-auto scroll-smooth`,"data-vault-main":!0,"data-vault-pane":!0,children:s.path||f.open||f.refusal?(0,M.jsx)(z,{companion:e,data:f,writable:a,search:s,crumbs:N}):(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(F,{crumbs:N}),(0,M.jsx)(se,{data:f,rootName:t})]})}),A?(0,M.jsx)(ue,{headings:T,...D}):null]})})}function me(){let e=a.useSearch(),{data:n}=t(c({companion:e.companion,studioMode:e.studioMode}));if(!e.companion||!n.selected)return null;let r=n.selected.path.split(/[\\/]/).findLast(Boolean)??`companion`;return(0,M.jsx)(pe,{companion:e.companion,rootName:r,writable:n.writable,search:{path:e.path,dir:e.dir,mode:e.mode}})}export{me as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cn-
|
|
1
|
+
import{t as e}from"./cn-BCnYnarL.js";import{it as t}from"./button-upSzkd-q.js";import{t as n}from"./jsx-runtime-MZURdZre.js";var r=n();function i({warnings:n}){return n.length===0?null:(0,r.jsx)(`section`,{className:e(t,`pb-4`),"aria-label":`Warnings`,children:(0,r.jsxs)(`div`,{className:`warnings grid gap-1.5 rounded-card border border-[color-mix(in_srgb,var(--warn)_35%,var(--border))] bg-warn-soft px-4 py-3 text-sm`,children:[(0,r.jsx)(`h2`,{className:`m-0 text-sm font-semibold text-warn`,children:`Some data could not be read`}),(0,r.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:n.map(e=>(0,r.jsx)(`li`,{children:e},e))})]})})}export{i as t};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{$ as e,E as t,Ft as n,It as r,Pt as i,Q as a,T as o,X as s,a as c,et as l}from"./index-D5oGyvG8.js";import{_ as u,a as d,dt as f,g as p}from"./studio-queries-CKtAnIKP.js";import{a as m,n as h,t as g}from"./jsx-runtime-MZURdZre.js";import{t as _}from"./react-dom-K3Hp2Cdj.js";import"./studio-X7bnFrRe.js";import{$ as v,ct as y,et as b,it as x,lt as ee,n as S,nt as C,r as w,t as T,tt as E}from"./button-upSzkd-q.js";import{i as te,t as D}from"./fields-DNZ4a89M.js";import{p as ne,t as O}from"./cn-BCnYnarL.js";import{t as k}from"./react-h2xQ_NSp.js";import{t as re}from"./useMutation-DKeEoP5S.js";var ie=m(_()),A=m(h()),j=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function M(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function N(e){return`nodeType`in e}function P(e){return e?M(e)?e:N(e)?e.ownerDocument?.defaultView??window:window:window}function ae(e){let{Document:t}=P(e);return e instanceof t}function oe(e){return!M(e)&&e instanceof P(e).HTMLElement}function se(e){return e instanceof P(e).SVGElement}function F(e){return e?M(e)?e.document:N(e)?ae(e)?e:oe(e)||se(e)?e.ownerDocument:document:document:document}var I=j?A.useLayoutEffect:A.useEffect;function L(e){let t=(0,A.useRef)(e);return I(()=>{t.current=e}),(0,A.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function R(){let e=(0,A.useRef)(null);return[(0,A.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,A.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function ce(e,t){t===void 0&&(t=[e]);let n=(0,A.useRef)(e);return I(()=>{n.current!==e&&(n.current=e)},t),n}function le(e,t){let n=(0,A.useRef)();return(0,A.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function z(e){let t=L(e),n=(0,A.useRef)(null);return[n,(0,A.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function B(e){let t=(0,A.useRef)();return(0,A.useEffect)(()=>{t.current=e},[e]),t.current}var V={};function ue(e,t){return(0,A.useMemo)(()=>{if(t)return t;let n=V[e]==null?0:V[e]+1;return V[e]=n,e+`-`+n},[e,t])}function de(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 fe=de(1),pe=de(-1);function me(e){return`clientX`in e&&`clientY`in e}function H(e){if(!e)return!1;let{KeyboardEvent:t}=P(e.target);return t&&e instanceof t}function he(e){if(!e)return!1;let{TouchEvent:t}=P(e.target);return t&&e instanceof t}function ge(e){if(he(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 me(e)?{x:e.clientX,y:e.clientY}:null}var U=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[U.Translate.toString(e),U.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),_e=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function ve(e){return e.matches(_e)?e:e.querySelector(_e)}var ye={display:`none`};function be(e){let{id:t,value:n}=e;return A.createElement(`div`,{id:t,style:ye},n)}function W(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return A.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 G(){let[e,t]=(0,A.useState)(``);return{announce:(0,A.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var xe=(0,A.createContext)(null);function Se(e){let t=(0,A.useContext)(xe);(0,A.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ce(){let[e]=(0,A.useState)(()=>new Set),t=(0,A.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,A.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var we={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
|
+
`},K={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 Te(e){let{announcements:t=K,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=we}=e,{announce:a,announcement:o}=G(),s=ue(`DndLiveRegion`),[c,l]=(0,A.useState)(!1);if((0,A.useEffect)(()=>{l(!0)},[]),Se((0,A.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=A.createElement(A.Fragment,null,A.createElement(be,{id:r,value:i.draggable}),A.createElement(W,{id:s,announcement:o}));return n?(0,ie.createPortal)(u,n):u}var q;(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`})(q||={});function Ee(){}function De(e,t){return(0,A.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function Oe(){var e=[...arguments];return(0,A.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var J=Object.freeze({x:0,y:0});function ke(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function Ae(e,t){let n=ge(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 je(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function Me(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function Ne(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 Pe(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function Fe(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 Ie=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=Fe(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(Me)};function Le(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 Re=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&&Le(r,a)){let n=Ne(a).reduce((e,t)=>e+ke(r,t),0),o=Number((n/4).toFixed(4));i.push({id:t,data:{droppableContainer:e,value:o}})}}return i.sort(je)};function ze(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function Be(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:J}function Ve(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 He=Ve(1);function Ue(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 We(e,t,n){let r=Ue(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 Ge={ignoreTransform:!1};function Ke(e,t){t===void 0&&(t=Ge);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=P(e).getComputedStyle(e);t&&(n=We(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 qe(e){return Ke(e,{ignoreTransform:!0})}function Je(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ye(e,t){return t===void 0&&(t=P(e).getComputedStyle(e)),t.position===`fixed`}function Xe(e,t){t===void 0&&(t=P(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 Ze(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(ae(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!oe(i)||se(i)||n.includes(i))return n;let a=P(e).getComputedStyle(i);return i!==e&&Xe(i,a)&&n.push(i),Ye(i,a)?n:r(i.parentNode)}return e?r(e):n}function Qe(e){let[t]=Ze(e,1);return t??null}function $e(e){return!j||!e?null:M(e)?e:N(e)?ae(e)||e===F(e).scrollingElement?window:oe(e)?e:null:null}function et(e){return M(e)?e.scrollX:e.scrollLeft}function tt(e){return M(e)?e.scrollY:e.scrollTop}function nt(e){return{x:et(e),y:tt(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function rt(e){return!j||!e?!1:e===document.scrollingElement}function it(e){let t={x:0,y:0},n=rt(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 at={x:.2,y:.2};function ot(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=at);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=it(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=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function st(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 ct(e){return e.reduce((e,t)=>fe(e,nt(t)),J)}function lt(e){return e.reduce((e,t)=>e+et(t),0)}function ut(e){return e.reduce((e,t)=>e+tt(t),0)}function dt(e,t){if(t===void 0&&(t=Ke),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Qe(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var ft=[[`x`,[`left`,`right`],lt],[`y`,[`top`,`bottom`],ut]],pt=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=Ze(t),r=ct(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of ft)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})}},mt=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 ht(e){let{EventTarget:t}=P(e);return e instanceof t?e:F(e)}function gt(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 X;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(X||={});function _t(e){e.preventDefault()}function vt(e){e.stopPropagation()}var Z;(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`})(Z||={});var yt={start:[Z.Space,Z.Enter],cancel:[Z.Esc],end:[Z.Space,Z.Enter,Z.Tab]},bt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Z.Right:return{...n,x:n.x+25};case Z.Left:return{...n,x:n.x-25};case Z.Down:return{...n,y:n.y+25};case Z.Up:return{...n,y:n.y-25}}},xt=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 mt(F(t)),this.windowListeners=new mt(P(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(X.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&dt(n),t(J)}handleKeyDown(e){if(H(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=yt,coordinateGetter:a=bt,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}:J;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=pe(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}=it(n),p=st(n),m={x:Math.min(i===Z.Right?p.right-p.width/2:p.right,Math.max(i===Z.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Z.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Z.Down?p.top:p.top+p.height/2,u.y))},h=i===Z.Right&&!s||i===Z.Left&&!c,g=i===Z.Down&&!l||i===Z.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Z.Right&&e<=d.x||i===Z.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}r.x=a?n.scrollLeft-e:i===Z.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===Z.Down&&e<=d.y||i===Z.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}r.y=a?n.scrollTop-e:i===Z.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,fe(pe(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()}};xt.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=yt,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 St(e){return!!(e&&`distance`in e)}function Ct(e){return!!(e&&`delay`in e)}var wt=class{constructor(e,t,n){n===void 0&&(n=ht(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=F(i),this.documentListeners=new mt(this.document),this.listeners=new mt(n),this.windowListeners=new mt(P(i)),this.initialCoordinates=ge(r)??J,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(X.Resize,this.handleCancel),this.windowListeners.add(X.DragStart,_t),this.windowListeners.add(X.VisibilityChange,this.handleCancel),this.windowListeners.add(X.ContextMenu,_t),this.documentListeners.add(X.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ct(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(St(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(X.Click,vt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(X.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=ge(e)??J,s=pe(n,o);if(!t&&a){if(St(a)){if(a.tolerance!=null&>(s,a.tolerance))return this.handleCancel();if(gt(s,a.distance))return this.handleStart()}if(Ct(a)&>(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===Z.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Tt={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},Et=class extends wt{constructor(e){let{event:t}=e,n=F(t.target);super(e,Tt,n)}};Et.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 Dt={move:{name:`mousemove`},end:{name:`mouseup`}},Ot;(function(e){e[e.RightClick=2]=`RightClick`})(Ot||={});var kt=class extends wt{constructor(e){super(e,Dt,F(e.event.target))}};kt.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button!==Ot.RightClick&&(r?.({event:n}),!0)}}];var At={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},jt=class extends wt{constructor(e){super(e,At)}static setup(){return window.addEventListener(At.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(At.move.name,e)};function e(){}}};jt.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 Mt;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(Mt||={});var Nt;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(Nt||={});function Pt(e){let{acceleration:t,activator:n=Mt.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=Nt.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=It({delta:d,disabled:!a}),[m,h]=R(),g=(0,A.useRef)({x:0,y:0}),_=(0,A.useRef)({x:0,y:0}),v=(0,A.useMemo)(()=>{switch(n){case Mt.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Mt.DraggableRect:return i}},[n,i,c]),y=(0,A.useRef)(null),b=(0,A.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,A.useMemo)(()=>s===Nt.TreeOrder?[...l].reverse():l,[s,l]);(0,A.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}=ot(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 Ft={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function It(e){let{delta:t,disabled:n}=e,r=B(t);return le(e=>{if(n||!r||!e)return Ft;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function Lt(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return le(e=>t==null?null:r??e??null,[r,t])}function Rt(e,t){return(0,A.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 zt;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(zt||={});var Bt;(function(e){e.Optimized=`optimized`})(Bt||={});var Vt=new Map;function Ht(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,A.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,A.useRef)(e),d=g(),f=ce(d),p=(0,A.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,A.useRef)(null),h=le(t=>{if(d&&!n)return Vt;if(!t||t===Vt||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 pt(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,A.useEffect)(()=>{u.current=e},[e]),(0,A.useEffect)(()=>{d||p()},[n,d]),(0,A.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,A.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 zt.Always:return!1;case zt.BeforeDragging:return n;default:return!n}}}function Ut(e,t){return le(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function Wt(e,t){return Ut(e,t)}function Gt(e){let{callback:t,disabled:n}=e,r=L(t),i=(0,A.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,A.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Kt(e){let{callback:t,disabled:n}=e,r=L(t),i=(0,A.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,A.useEffect)(()=>()=>i?.disconnect(),[i]),i}function qt(e){return new pt(Ke(e),e)}function Jt(e,t,n){t===void 0&&(t=qt);let[r,i]=(0,A.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=Gt({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=Kt({callback:a});return I(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function Yt(e){return Be(e,Ut(e))}var Xt=[];function Zt(e){let t=(0,A.useRef)(e),n=le(n=>e?n&&n!==Xt&&e&&t.current&&e.parentNode===t.current.parentNode?n:Ze(e):Xt,[e]);return(0,A.useEffect)(()=>{t.current=e},[e]),n}function Qt(e){let[t,n]=(0,A.useState)(null),r=(0,A.useRef)(e),i=(0,A.useCallback)(e=>{let t=$e(e.target);t&&n(e=>e?(e.set(t,nt(t)),new Map(e)):null)},[]);return(0,A.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=$e(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,nt(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=>{$e(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,A.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>fe(e,t),J):ct(e):J,[e,t])}function $t(e,t){t===void 0&&(t=[]);let n=(0,A.useRef)(null);return(0,A.useEffect)(()=>{n.current=null},t),(0,A.useEffect)(()=>{let t=e!==J;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?pe(e,n.current):J}function en(e){(0,A.useEffect)(()=>{if(!j)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 tn(e,t){return(0,A.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function nn(e){return(0,A.useMemo)(()=>e?Je(e):null,[e])}var rn=[];function an(e,t){t===void 0&&(t=Ke);let[n]=e,r=nn(n?P(n):null),[i,a]=(0,A.useState)(rn);function o(){a(()=>e.length?e.map(e=>rt(e)?r:new pt(t(e),e)):rn)}let s=Kt({callback:o});return I(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function on(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return oe(t)?t:e}function sn(e){let{measure:t}=e,[n,r]=(0,A.useState)(null),i=Kt({callback:(0,A.useCallback)(e=>{for(let{target:n}of e)if(oe(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=z((0,A.useCallback)(e=>{let n=on(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,A.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var cn=[{sensor:Et,options:{}},{sensor:xt,options:{}}],ln={current:{}},un={draggable:{measure:qe},droppable:{measure:qe,strategy:zt.WhileDragging,frequency:Bt.Optimized},dragOverlay:{measure:Ke}},dn=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}},fn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new dn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Ee},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:un,measureDroppableContainers:Ee,windowRect:null,measuringScheduled:!1},pn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:Ee,draggableNodes:new Map,over:null,measureDroppableContainers:Ee},mn=(0,A.createContext)(pn),hn=(0,A.createContext)(fn);function gn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new dn}}}function _n(e,t){switch(t.type){case q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case q.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 q.DragEnd:case q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case q.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new dn(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case q.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 dn(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case q.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new dn(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function vn(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,A.useContext)(mn),a=B(r),o=B(n?.id);return(0,A.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!H(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=ve(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function yn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function bn(e){return(0,A.useMemo)(()=>({draggable:{...un.draggable,...e?.draggable},droppable:{...un.droppable,...e?.droppable},dragOverlay:{...un.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function xn(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,A.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;I(()=>{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=Be(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=Qe(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Sn=(0,A.createContext)({...J,scaleX:1,scaleY:1}),Cn;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Cn||={});var wn=(0,A.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=cn,collisionDetection:o=Ie,measuring:s,modifiers:c,...l}=e,[u,d]=(0,A.useReducer)(_n,void 0,gn),[f,p]=Ce(),[m,h]=(0,A.useState)(Cn.Uninitialized),g=m===Cn.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),ee=(0,A.useRef)({initial:null,translated:null}),S=(0,A.useMemo)(()=>_==null?null:{id:_,data:x?.data??ln,rect:ee},[_,x]),C=(0,A.useRef)(null),[w,T]=(0,A.useState)(null),[E,te]=(0,A.useState)(null),D=ce(l,Object.values(l)),ne=ue(`DndDescribedBy`,t),O=(0,A.useMemo)(()=>b.getEnabled(),[b]),k=bn(s),{droppableRects:re,measureDroppableContainers:j,measuringScheduled:M}=Ht(O,{dragging:g,dependencies:[y.x,y.y],config:k.droppable}),N=Lt(v,_),ae=(0,A.useMemo)(()=>E?ge(E):null,[E]),oe=Me(),se=Wt(N,k.draggable.measure);xn({activeNode:_==null?null:v.get(_),config:oe.layoutShiftCompensation,initialRect:se,measure:k.draggable.measure});let F=Jt(N,k.draggable.measure,se),L=Jt(N?N.parentElement:null),R=(0,A.useRef)({activatorEvent:null,active:null,activeNode:N,collisionRect:null,collisions:null,droppableRects:re,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),le=b.getNodeFor(R.current.over?.id),z=sn({measure:k.dragOverlay.measure}),B=z.nodeRef.current??N,V=g?z.rect??F:null,de=!!(z.nodeRef.current&&z.rect),pe=Yt(de?null:F),me=nn(B?P(B):null),H=Zt(g?le??N:null),he=an(H),U=yn(c,{transform:{x:y.x-pe.x,y:y.y-pe.y,scaleX:1,scaleY:1},activatorEvent:E,active:S,activeNodeRect:F,containerNodeRect:L,draggingNodeRect:V,over:R.current.over,overlayNodeRect:z.rect,scrollableAncestors:H,scrollableAncestorRects:he,windowRect:me}),_e=ae?fe(ae,y):null,ve=Qt(H),ye=$t(ve),be=$t(ve,[F]),W=fe(U,ye),G=V?He(V,U):null,Se=S&&G?o({active:S,collisionRect:G,droppableRects:re,droppableContainers:O,pointerCoordinates:_e}):null,we=Pe(Se,`id`),[K,Ee]=(0,A.useState)(null),De=ze(de?U:fe(U,be),K?.rect??null,F),Oe=(0,A.useRef)(null),J=(0,A.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(C.current==null)return;let i=v.get(C.current);if(!i)return;let a=e.nativeEvent,o=new n({active:C.current,activeNode:i,event:a,options:r,context:R,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=D.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=D.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=C.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=D.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:ee}};(0,ie.unstable_batchedUpdates)(()=>{r?.(i),h(Cn.Initializing),d({type:q.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),T(Oe.current),te(a)})},onMove(e){d({type:q.DragMove,coordinates:e})},onEnd:s(q.DragEnd),onCancel:s(q.DragCancel)});Oe.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=R.current,o=null;if(t&&i){let{cancelDrop:s}=D.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===q.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=q.DragCancel)}C.current=null,(0,ie.unstable_batchedUpdates)(()=>{d({type:e}),h(Cn.Uninitialized),Ee(null),T(null),te(null),Oe.current=null;let t=e===q.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=D.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),ke=Rt(a,(0,A.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(C.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},C.current=r,J(n,t))},[v,J]));en(a),I(()=>{F&&m===Cn.Initializing&&h(Cn.Initialized)},[F,m]),(0,A.useEffect)(()=>{let{onDragMove:e}=D.current,{active:t,activatorEvent:n,collisions:r,over:i}=R.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:W.x,y:W.y},over:i};(0,ie.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[W.x,W.y]),(0,A.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=R.current;if(!e||C.current==null||!t||!i)return;let{onDragOver:a}=D.current,o=r.get(we),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,ie.unstable_batchedUpdates)(()=>{Ee(s),a?.(c),f({type:`onDragOver`,event:c})})},[we]),I(()=>{R.current={activatorEvent:E,active:S,activeNode:N,collisionRect:G,collisions:Se,droppableRects:re,draggableNodes:v,draggingNode:B,draggingNodeRect:V,droppableContainers:b,over:K,scrollableAncestors:H,scrollAdjustedTranslate:W},ee.current={initial:V,translated:G}},[S,N,Se,G,v,B,V,re,b,K,H,W]),Pt({...oe,delta:y,draggingRect:G,pointerCoordinates:_e,scrollableAncestors:H,scrollableAncestorRects:he});let Ae=(0,A.useMemo)(()=>({active:S,activeNode:N,activeNodeRect:F,activatorEvent:E,collisions:Se,containerNodeRect:L,dragOverlay:z,draggableNodes:v,droppableContainers:b,droppableRects:re,over:K,measureDroppableContainers:j,scrollableAncestors:H,scrollableAncestorRects:he,measuringConfiguration:k,measuringScheduled:M,windowRect:me}),[S,N,F,E,Se,L,z,v,b,re,K,j,H,he,k,M,me]),je=(0,A.useMemo)(()=>({activatorEvent:E,activators:ke,active:S,activeNodeRect:F,ariaDescribedById:{draggable:ne},dispatch:d,draggableNodes:v,over:K,measureDroppableContainers:j}),[E,ke,S,F,d,ne,v,K,j]);return A.createElement(xe.Provider,{value:p},A.createElement(mn.Provider,{value:je},A.createElement(hn.Provider,{value:Ae},A.createElement(Sn.Provider,{value:De},i)),A.createElement(vn,{disabled:n?.restoreFocus===!1})),A.createElement(Te,{...n,hiddenTextDescribedById:ne}));function Me(){let e=w?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),Tn=(0,A.createContext)(null),En=`button`,Dn=`Draggable`;function On(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=ue(Dn),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,A.useContext)(mn),{role:p=En,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,A.useContext)(g?Sn:Tn),[v,y]=z(),[b,x]=z(),ee=tn(o,t),S=ce(n);return I(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:S}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,A.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===En?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:ee,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function kn(){return(0,A.useContext)(hn)}var An=`Droppable`,jn={timeout:25};function Mn(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=ue(An),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,A.useContext)(mn),u=(0,A.useRef)({disabled:n}),d=(0,A.useRef)(!1),f=(0,A.useRef)(null),p=(0,A.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...jn,...i},_=ce(h??r),v=Kt({callback:(0,A.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]=z((0,A.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=ce(t);return(0,A.useEffect)(()=>{v&&y.current&&(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,A.useEffect)(()=>(s({type:q.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:q.UnregisterDroppable,key:a,id:r})),[r]),(0,A.useEffect)(()=>{n!==u.current.disabled&&(s({type:q.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 Nn(e){let{animation:t,children:n}=e,[r,i]=(0,A.useState)(null),[a,o]=(0,A.useState)(null),s=B(n);return!n&&!r&&s&&i(s),I(()=>{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]),A.createElement(A.Fragment,null,n,r?(0,A.cloneElement)(r,{ref:o}):null)}var Pn={x:0,y:0,scaleX:1,scaleY:1};function Fn(e){let{children:t}=e;return A.createElement(mn.Provider,{value:pn},A.createElement(Sn.Provider,{value:Pn},t))}var In={position:`fixed`,touchAction:`none`},Ln=e=>H(e)?`transform 250ms ease`:void 0,Rn=(0,A.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=Ln}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...In,width:s.width,height:s.height,top:s.top,left:s.left,transform:U.Transform.toString(d),transformOrigin:i&&r?Ae(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return A.createElement(n,{className:o,style:f,ref:t},a)}),zn={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:U.Transform.toString(t)},{transform:U.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 Bn(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return L((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=on(a);if(!c)return;let{transform:l}=P(a).getComputedStyle(a),u=Ue(l);if(!u)return;let d=typeof t==`function`?t:Vn(t);return dt(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 Vn(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...zn,...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 Hn=0;function Un(e){return(0,A.useMemo)(()=>{if(e!=null)return Hn++,Hn},[e])}var Wn=A.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}=kn(),ee=(0,A.useContext)(Sn),S=Un(d?.id),C=yn(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:ee,windowRect:x}),w=Ut(f),T=Bn({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),E=w?g.setRef:void 0;return A.createElement(Fn,null,A.createElement(Nn,{animation:T},d&&S?A.createElement(Rn,{key:S,id:d.id,ref:E,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:w,style:{zIndex:l,...i},transform:C},n):null))}),Q=k()(t(e=>({drafts:{},setDraft:(t,n)=>e(e=>({drafts:{...e.drafts,[t]:n}})),dialog:null,open:t=>e({dialog:t,focusAfter:null}),close:()=>e({dialog:null}),focusAfter:null,acted:t=>e({dialog:null,focusAfter:t}),focused:()=>e({focusAfter:null}),expanded:{},toggle:t=>e(e=>({expanded:{...e.expanded,[t]:!e.expanded[t]}}))}),{name:`mate.work.drafts`,storage:o(()=>sessionStorage),partialize:({drafts:e})=>({drafts:e})})),Gn={share:`Share`,claim:`Claim`,"start-manual":`Continue manually`,release:`Release`};function Kn(e){return Object.keys(Gn).filter(t=>e.actions[t]===null)}function qn(e){let t=t=>e.actions[t]===null,n={};if(e.bucket===`local`){let r=e.claim.kind===`mine`?`release`:`share`;t(r)&&(n.remote=r)}return e.bucket===`remote`&&t(`claim`)&&(n.local=`claim`),n}var Jn={share:`share it`,release:`release your claim`,claim:`claim it`},$=g(),Yn={"clarify-intent":`idle`,explore:`idle`,propose:`idle`,"human-review":`review`,apply:`build`,"merge-wait":`review`,publish:`review`,done:`done`},Xn=new Set([`claim`,`start-manual`]);function Zn(e){switch(e.claim.kind){case`mine`:return`Claimed by you (${e.claim.label})`;case`other`:return`Claimed by ${e.claim.label}`;case`none`:return e.bucket===`remote`&&e.progress.kind===`none`?`Available`:null;case`conflict`:return null}}function Qn(e){return e.progress.kind===`here`?`In progress here on ${e.progress.branch}`:e.progress.kind===`elsewhere`?`In progress on ${e.progress.branch}`:null}var $n={ahead:`Local changes not shared`,behind:`The shared version is newer; take it with mate artifact take`,diverged:`Local and shared versions differ`};function er(e){let{sharing:t}=e,r=n(t.presence),i=[];return r&&$n[t.sync]&&i.push($n[t.sync]),t.remoteOnly&&i.push(`Only on the inbox; take it with mate artifact take`),t.stale&&r&&i.push(`Shared information may be stale`),i}var tr=O(S({size:`sm`}),`gap-1.5`);function nr({card:e}){let t=Q(t=>t.expanded[e.id]===!0),n=Q(e=>e.toggle),r=Zn(e),i=Qn(e);return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted`,children:[r?(0,$.jsx)(`span`,{className:O(e.claim.kind===`mine`&&`text-text`),children:r}):null,i?(0,$.jsx)(`span`,{children:i}):null,e.memberNames.length>1?(0,$.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1 text-xs text-muted hover:text-text`,"aria-expanded":t,"aria-controls":`members-${e.id}`,onClick:()=>n(e.id),children:[(0,$.jsx)(w,{name:t?`chevron`:`right`,className:`size-3.5`}),e.memberNames.length,` changes`]}):null]})}function rr({items:e,className:t,label:n}){return e.length===0?null:(0,$.jsx)(`ul`,{className:O(`m-0 list-none p-0 text-xs`,t),"aria-label":n,children:e.map(e=>(0,$.jsx)(`li`,{children:e},e))})}function ir({card:e,writable:t}){return e.offers.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex gap-1.5`,children:[t&&e.runAgents.length>0?(0,$.jsxs)(`button`,{type:`button`,className:O(tr,`work-action`),"data-studio-action":e.action,"data-studio-subject":e.subject,"data-studio-agents":e.runAgents.join(` `),"aria-label":`${e.label} ${e.subject} in the terminal`,children:[(0,$.jsx)(w,{name:`play`,className:`size-3.5`}),e.label]}):null,(0,$.jsxs)(`button`,{type:`button`,className:O(tr,`work-copy`),"data-studio-copy-prompt":e.action,"data-prompt-claude":e.prompts.claude,"data-prompt-opencode":e.prompts.opencode,"aria-label":`Copy the ${e.label.toLowerCase()} prompt for ${e.subject}`,children:[(0,$.jsx)(w,{name:`copy`,className:`size-3.5`}),e.label,` prompt`]})]},`${e.action}:${e.subject}`))}function ar({card:e,actions:t}){let n=Q(e=>e.open);return t.map(t=>(0,$.jsx)(`button`,{type:`button`,className:O(S({variant:Xn.has(t)?`primary`:`default`,size:`sm`}),`work-action`),"data-work-action":t,onClick:()=>n({kind:t,workset:e.id}),children:Gn[t]},t))}function or({card:e}){return!Q(t=>t.expanded[e.id]===!0)||e.memberNames.length<2?null:(0,$.jsx)(`ul`,{id:`members-${e.id}`,className:`m-0 grid list-none gap-1 pr-3 pb-2.5 pl-10`,"aria-label":`Changes`,children:e.members.map(t=>(0,$.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 text-xs`,children:[(0,$.jsx)(`code`,{className:`font-mono`,children:t.name}),e.sharing.remoteOnly?null:(0,$.jsx)(ee,{marker:t.problem?`issue`:Yn[t.stage],children:t.delivered?`Delivered`:t.stageLabel}),t.problem?(0,$.jsx)(`span`,{className:`text-bad`,children:t.problem}):null]},t.name))})}function sr({card:e}){return(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[(0,$.jsx)(`span`,{className:`line-clamp-2 font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1`,children:[e.sharing.remoteOnly&&e.diagnostics.length===0?null:(0,$.jsx)(ee,{marker:e.diagnostics.length>0?`issue`:Yn[e.stage],children:e.done?`Done`:e.stageLabel}),e.title===e.id?null:(0,$.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted`,children:e.id})]})]})}function cr({card:e,writable:t}){let n=t?Kn(e):[],r=t?qn(e):{},i=Object.keys(r).length>0,a={title:e.title,targets:r},{attributes:o,listeners:s,setNodeRef:c,setActivatorNodeRef:l,isDragging:u}=On({id:e.id,data:a,disabled:!i});return(0,$.jsxs)(`li`,{ref:c,className:O(`work-card border-t border-rule-soft transition-opacity first:border-t-0`,u&&`opacity-40`),"data-workset":e.id,children:[(0,$.jsxs)(`div`,{className:O(y,`items-start gap-2 border-t-0 py-2.5 pr-3 pl-2 hover:bg-transparent`),children:[i?(0,$.jsx)(`button`,{ref:l,type:`button`,className:`work-drag -my-0.5 grid size-6 flex-none cursor-grab touch-none place-items-center rounded-control text-muted hover:bg-surface hover:text-text active:cursor-grabbing`,"data-work-drag":e.id,...o,...s,"aria-label":`Move ${e.title}`,children:(0,$.jsx)(w,{name:`grip`,className:`size-4 [stroke-width:2.6]`})}):(0,$.jsx)(`span`,{className:`size-6 flex-none`,"aria-hidden":`true`}),(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1.5`,children:[(0,$.jsx)(sr,{card:e}),(0,$.jsx)(nr,{card:e}),(0,$.jsx)(rr,{items:er(e),className:`grid gap-0.5 text-muted`}),(0,$.jsx)(rr,{items:e.diagnostics,className:`grid gap-0.5 text-bad`,label:`Problems`}),n.length>0||e.offers.length>0?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 pt-0.5`,children:[(0,$.jsx)(ar,{card:e,actions:n}),(0,$.jsx)(ir,{card:e,writable:t})]}):null]})]}),(0,$.jsx)(or,{card:e})]})}function lr(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`k-${Date.now()}-${Math.random().toString(36).slice(2)}`}function ur(e){let t=ne();return re({mutationFn:async t=>u({data:{companion:e,request:t}}),onSettled:(n,r,i)=>i.action===`share-preview`?void 0:d(t,e)})}function dr(e){if(!e.error)return e.data;let{error:t}=e;return{ok:!1,kind:`failed`,reason:t instanceof Error&&t.message?t.message:`The request failed.`}}var fr={stale:`Something changed meanwhile. Review the current state and confirm again.`,access:`This needs write access, or it is someone else's.`};function pr({result:e}){return!e||e.ok?null:(0,$.jsxs)(`div`,{className:`grid gap-1 rounded-control border border-bad bg-bad-soft px-3 py-2 text-sm`,role:`alert`,children:[(0,$.jsx)(`span`,{children:e.reason}),fr[e.kind]?(0,$.jsx)(`span`,{className:`text-xs text-muted`,children:fr[e.kind]}):null]})}function mr({title:t,description:n,children:r,footer:i}){let o=Q(e=>e.close);return(0,$.jsx)(s,{open:!0,onOpenChange:e=>e?void 0:o(),children:(0,$.jsxs)(a,{className:`grid gap-4 p-5`,"data-work-dialog":``,children:[(0,$.jsxs)(`div`,{className:`grid gap-1`,children:[(0,$.jsx)(l,{children:t}),(0,$.jsx)(e,{children:n})]}),r,(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(T,{variant:`ghost`,onClick:o,children:`Cancel`}),i]})]})})}function hr(e){let t=Q(e=>e.close),n=ur(e),[r]=(0,A.useState)(lr);return{mutation:n,run:(e,r,i)=>n.mutate(e,{onSuccess:e=>{if(!e.ok)return i?.(e);r?r(e):t()}}),key:r,result:dr(n)}}function gr({preview:e}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{className:`m-0`,children:[`To `,(0,$.jsx)(`code`,{className:`font-mono`,children:`${e.target.remote}/${e.target.branch}`}),`:`,` `,e.members.length,` `,e.members.length===1?`change`:`changes`,`,`,` `,e.files.length,` files.`]}),(0,$.jsxs)(`details`,{children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-xs text-muted`,children:`Files`}),(0,$.jsx)(`ul`,{className:`m-0 mt-1 max-h-40 list-none overflow-auto p-0 font-mono text-xs`,children:e.files.map(e=>(0,$.jsx)(`li`,{children:e.path},e.path))})]}),e.excluded.length>0?(0,$.jsxs)(`p`,{className:`m-0 text-xs text-muted`,children:[`Not shared: `,e.excluded.map(e=>e.path).join(`, `)]}):null,e.problems.length>0?(0,$.jsx)(`ul`,{className:`m-0 list-none p-0 text-xs text-bad`,children:e.problems.map(e=>(0,$.jsx)(`li`,{children:e},e))}):null]})}function _r({dependencies:e,included:t,onChange:n}){return e.length===0?null:(0,$.jsxs)(`fieldset`,{className:`m-0 grid gap-1 border-0 p-0`,children:[(0,$.jsx)(`legend`,{className:`text-xs text-warn`,children:`It depends on unshared active changes. Include them, or share them first.`}),e.map(e=>(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:t.has(e),onChange:t=>{let r=t.target.checked;n(t=>r?[...t,e]:t.filter(t=>t!==e))}}),(0,$.jsx)(`code`,{className:`font-mono`,children:e})]},e))]})}function vr({companion:e,card:t}){let n=Q(e=>e.acted),r=ur(e),{mutation:i,run:a,key:o,result:s}=hr(e),[c,l]=(0,A.useState)([]),{mutate:u}=r,d=(0,A.useCallback)(()=>u({action:`share-preview`,workset:t.id,include:c}),[u,t.id,c]);(0,A.useEffect)(()=>d(),[d]);let f=r.data?.ok?r.data.preview:void 0,p=!f||f.problems.length>0||f.externalDependencies.length>0||r.isPending,m=new Set(c);return(0,$.jsxs)(mr,{title:`Share ${t.title}`,description:`Pushes only these files to the team inbox ${f?.target.branch??`mate/inbox`}, where teammates can claim it. Your checkout stays as it is. It starts no work, claims nothing new, submits nothing and records no approval.`,footer:(0,$.jsx)(T,{variant:`primary`,disabled:p||i.isPending,onClick:()=>f&&a({action:`share`,workset:t.id,hash:f.hash,include:c,key:o},()=>n(t),e=>{e.kind===`stale`&&d()}),children:`Share`}),children:[r.isPending?(0,$.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Reading what would be shared…`}):null,(0,$.jsx)(pr,{result:dr(r)}),f?(0,$.jsxs)(`div`,{className:`grid gap-3 text-sm`,children:[(0,$.jsx)(gr,{preview:f}),(0,$.jsx)(_r,{dependencies:[...new Set([...c,...f.externalDependencies])],included:m,onChange:l})]}):null,(0,$.jsx)(pr,{result:s})]})}function yr({companion:e,card:t,kind:n,operator:r}){let{mutation:i,run:a,key:o,result:s}=hr(e),c=Q(e=>e.close),l=Q(e=>e.acted),u=n===`claim`&&s?.ok?s.needsTake??[]:[],d={claim:{title:`Claim ${t.title}`,description:`Adds owner.yaml naming ${r?.label??`you`} to all ${t.claimMemberNames.length} of its changes on the team inbox. A claim coordinates trusted teammates; it is not access control.`,button:`Claim`},release:{title:`Release ${t.title}`,description:t.progress.kind===`none`?`Removes its owner.yaml files, so anyone on the team may claim it. Its files and branches stay as they are.`:`Removes its owner.yaml files. It still records ${t.progress.branch}, so teammates see it as in progress and cannot claim it; whoever checks out ${t.progress.branch} may continue it. Its files and branches stay as they are.`,button:`Release`}}[n];return(0,$.jsxs)(mr,{title:d.title,description:d.description,footer:u.length>0?(0,$.jsx)(T,{variant:`primary`,onClick:c,children:`Done`}):(0,$.jsx)(T,{variant:`primary`,disabled:i.isPending,onClick:()=>a({action:n,workset:t.id,members:t.claimMemberNames,key:o},e=>{n!==`release`&&e.needsTake?.length||l(t)}),children:d.button}),children:[u.length>0?(0,$.jsxs)(`div`,{className:`grid gap-2 text-sm`,role:`status`,children:[(0,$.jsx)(`p`,{className:`m-0`,children:`Claimed. Take its changes into this checkout before you start:`}),u.map(e=>(0,$.jsx)(b,{text:`mate artifact take ${e}`,label:`Take ${e}`},e))]}):null,(0,$.jsx)(pr,{result:s})]})}function br({companion:e,card:t}){let{mutation:n,run:r,result:i}=hr(e),a=i?.ok?i.prompts??[]:null,o=Q(e=>e.close);return(0,$.jsxs)(mr,{title:`Continue ${t.title} manually`,description:`Checks that it is yours to continue, then shows the prompts for your own agent session. Nothing is written.`,footer:a?(0,$.jsx)(T,{variant:`primary`,onClick:o,children:`Done`}):(0,$.jsx)(T,{variant:`primary`,disabled:n.isPending,onClick:()=>r({action:`start-manual`,workset:t.id,members:t.memberNames},()=>void 0),children:`Continue`}),children:[a?(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[a.flatMap(e=>Object.entries(e).map(([e,t])=>(0,$.jsx)(b,{text:t??``,label:`${e} prompt`},`${e}:${t}`))),(0,$.jsx)(`p`,{className:`m-0 text-xs text-muted`,children:`A copied prompt runs wherever you paste it; Studio cannot see or fence that session.`})]}):null,(0,$.jsx)(pr,{result:i})]})}function xr({companion:e,payload:t,dialog:n}){let r=Q(e=>e.close),i=n?t.cards.find(e=>e.id===n.workset):void 0,a=!!n&&!i;if((0,A.useEffect)(()=>{a&&r()},[a,r]),(0,A.useEffect)(()=>r,[r]),!n||!i)return null;switch(n.kind){case`share`:return(0,$.jsx)(vr,{companion:e,card:i},i.id);case`claim`:case`release`:return(0,$.jsx)(yr,{companion:e,card:i,kind:n.kind,operator:t.operator},i.id);case`start-manual`:return(0,$.jsx)(br,{companion:e,card:i},i.id)}}var Sr={scratchpad:`Scratchpad`,local:`Local work`,remote:`Remote work`},Cr={scratchpad:`Ideas on this checkout only. Nothing here runs or is pushed.`,local:`Your changes: not shared yet, claimed by you, or built here.`,remote:`Shared changes: available to claim, claimed by others, or built elsewhere.`},wr={scratchpad:`No saved ideas.`,local:`No local work. Propose a change to see it here.`,remote:`Nothing shared. Refresh to look at the team branch.`},Tr=`No shared work to claim.`;function Er(e,t){let n=t?.data.current?.bucket,r=n?Dr(e)?.targets[n]:void 0;return n&&r?{bucket:n,action:r}:null}var Dr=e=>e?.data.current,Or=e=>Dr(e)?.title??String(e.id),kr={ArrowRight:1,ArrowDown:1,ArrowLeft:-1,ArrowUp:-1},Ar=e=>e.width>0,jr=(e,{currentCoordinates:t,context:n})=>{let r=kr[e.code],i=n.collisionRect;if(!r||!i)return;e.preventDefault();let a={x:i.left+i.width/2,y:i.top+i.height/2},o=n.droppableContainers.getEnabled().flatMap(e=>{let t=n.droppableRects.get(e.id),i=t&&Math.sign(t.left+t.width/2-a.x)===r;return t&&Ar(t)&&i?[t]:[]}).reduce((e,t)=>!e||r*(t.left-e.left)<0?t:e,void 0);if(!o)return;let s=Math.min(Math.max(a.y,o.top+i.height/2),o.bottom-i.height/2);return{x:t.x+o.left+o.width/2-a.x,y:t.y+(o.height>i.height?s:o.top+o.height/2)-a.y}},Mr=e=>{let t=Re(e);return t.length>0?t:Ie(e)};function Nr({cards:e}){let{active:t}=kn(),n=t?e.find(e=>e.id===t.id):void 0;return n?(0,$.jsxs)(`div`,{className:`flex w-[min(340px,80vw)] cursor-grabbing items-start gap-2 rounded-card border border-accent bg-surface py-2.5 pr-3 pl-2 text-base text-text shadow-float`,children:[(0,$.jsx)(`span`,{className:`grid size-6 flex-none place-items-center text-accent`,children:(0,$.jsx)(w,{name:`grip`,className:`size-4 [stroke-width:2.6]`})}),(0,$.jsx)(sr,{card:n})]}):null}function Pr({payload:e,search:t}){let r=t.companion,a=f(),o=t.bucket??`scratchpad`,s=Q(e=>e.dialog),c=Q(e=>e.open),l=Q(e=>e.focusAfter),u=Q(e=>e.focused),d=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(!l||s)return;let t=e.cards.find(e=>e.id===l.id);if(t===l)return;u();let n=d.current?.querySelector(`[role="tablist"]`),r=n&&Ar(n.getBoundingClientRect())&&t?.bucket!==o?d.current?.querySelector(`#work-tab-${(t??l).bucket}`):d.current?.querySelector(`[data-workset="${CSS.escape(l.id)}"]`)?.querySelector(`.work-action, .work-copy`);queueMicrotask(()=>r?.focus())},[l,s,u,e.cards,o]);let p=Oe(De(Et,{activationConstraint:{distance:4}}),De(xt,{coordinateGetter:jr})),m=t=>e.cards.filter(e=>e.bucket===t),h=e.cards.some(e=>n(e.sharing.presence)),g=e=>void a({to:`/work`,search:t=>({companion:t.companion,studioMode:t.studioMode,...e===`scratchpad`?{}:{bucket:e}}),resetScroll:!1});return(0,$.jsxs)(`section`,{ref:d,className:O(x,`view-section work @container grid content-start gap-4 pb-10`),"aria-label":`Work`,children:[(0,$.jsxs)(wn,{id:`work-dnd`,sensors:p,collisionDetection:Mr,onDragEnd:({active:e,over:t})=>{let n=Er(e,t);n&&c({kind:n.action,workset:String(e.id)})},accessibility:{screenReaderInstructions:{draggable:`To move a Workset, press Space or Enter, choose a bucket with the arrow keys, then press Space or Enter to drop it, or Escape to cancel. A drop asks for confirmation.`},announcements:{onDragStart:({active:e})=>`Picked up ${Or(e)}.`,onDragOver:({active:e,over:t})=>{let n=Er(e,t);return n?`Over ${Sr[n.bucket]}: drop to ${Jn[n.action]}.`:`${Or(e)} is not over a bucket that takes it.`},onDragEnd:({active:e,over:t})=>{let n=Er(e,t);return n?`Dropped on ${Sr[n.bucket]}. Confirm to ${Jn[n.action]}.`:`${Or(e)} stays where it was.`},onDragCancel:({active:e})=>`Moving ${Or(e)} was cancelled.`}},children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,$.jsx)(`div`,{role:`tablist`,"aria-label":`Work buckets`,className:`flex flex-wrap gap-1.5 @min-[56rem]:hidden`,children:i.map(e=>(0,$.jsx)(Ir,{bucket:e,cards:m(e),selected:o===e,onSelect:()=>g(e)},e))}),(0,$.jsx)(Rr,{payload:e,companion:r})]}),(0,$.jsx)(`div`,{className:`grid items-start gap-4 @min-[56rem]:grid-cols-3`,children:i.map(t=>(0,$.jsx)(Lr,{bucket:t,cards:m(t),empty:t===`remote`&&h?Tr:wr[t],selected:o===t,writable:e.writable,children:t===`scratchpad`?(0,$.jsx)(zr,{payload:e,companion:r}):null},t))}),(0,$.jsx)(Wn,{dropAnimation:null,children:(0,$.jsx)(Nr,{cards:e.cards})})]}),e.diagnostics.length>0?(0,$.jsx)(`ul`,{className:`m-0 list-none p-0 text-xs text-warn`,"aria-label":`Workset records that cannot be read`,children:e.diagnostics.map(e=>(0,$.jsx)(`li`,{children:e},e))}):null,e.writable?(0,$.jsx)(xr,{companion:r,payload:e,dialog:s}):null]})}function Fr(e,t){let{active:n}=kn(),r=Dr(n)?.targets[t],{setNodeRef:i,isOver:a}=Mn({id:e,data:{bucket:t},disabled:!r});return{setNodeRef:i,action:r,over:a&&r!==void 0}}function Ir({bucket:e,cards:t,selected:n,onSelect:r}){let{setNodeRef:i,action:a,over:o}=Fr(`tab:${e}`,e),s=t.filter(e=>e.needsYou).length;return(0,$.jsxs)(`button`,{ref:i,type:`button`,role:`tab`,id:`work-tab-${e}`,"aria-selected":n,"aria-controls":`work-lane-${e}`,"data-work-bucket":e,className:O(`inline-flex h-8 items-center gap-2 rounded-control border px-3 text-sm transition-colors`,n?`border-accent bg-accent-soft font-semibold`:`border-rule bg-surface`,a&&`outline-1 outline-offset-2 outline-accent outline-dashed`,o&&`border-accent bg-accent-soft outline-2 outline-solid`),onClick:r,children:[Sr[e],s>0?(0,$.jsx)(E,{value:s,tone:`warn`,label:`${s} need you`}):(0,$.jsx)(E,{value:t.length})]})}function Lr({bucket:e,cards:t,empty:n,selected:r,writable:i,children:a}){let{setNodeRef:o,action:s,over:c}=Fr(`lane:${e}`,e),l=t.filter(e=>e.needsYou).length;return(0,$.jsxs)(`section`,{ref:o,id:`work-lane-${e}`,"aria-labelledby":`work-lane-${e}-title`,"data-work-lane":e,className:O(`work-lane grid min-w-0 content-start gap-3 rounded-panel p-2 transition-[background-color,outline-color] duration-150`,!r&&`@max-[56rem]:hidden`,s&&`outline-1 -outline-offset-1 outline-accent outline-dashed`,c&&`bg-accent-soft outline-2 outline-solid`),children:[(0,$.jsxs)(`header`,{className:`grid gap-0.5 px-1 pt-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 @max-[56rem]:sr-only`,children:[(0,$.jsx)(`h2`,{id:`work-lane-${e}-title`,className:`m-0 text-[0.9rem] font-semibold`,children:Sr[e]}),(0,$.jsx)(E,{value:t.length}),l>0?(0,$.jsx)(E,{value:l,tone:`warn`,label:`${l} need you`}):null,s?(0,$.jsxs)(`span`,{className:`ml-auto text-xs font-medium text-accent`,"aria-hidden":`true`,children:[`Drop to `,Jn[s]]}):null]}),(0,$.jsx)(`p`,{className:`m-0 text-xs text-muted @min-[56rem]:min-h-[2lh]`,children:Cr[e]})]}),a,t.length===0?(0,$.jsx)(C,{className:`px-4 py-4 text-sm`,children:n}):(0,$.jsx)(`ul`,{className:`m-0 list-none overflow-hidden rounded-card border border-rule bg-page p-0`,"aria-label":Sr[e],children:t.map(e=>(0,$.jsx)(cr,{card:e,writable:i},e.id))})]})}function Rr({payload:e,companion:t}){let n=ur(t),{team:r}=e;return e.gitBacked?(0,$.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2 text-xs text-muted`,children:[r.remote&&r.branch?(0,$.jsxs)(`span`,{children:[`Shared on `,(0,$.jsx)(`code`,{className:`font-mono`,children:`${r.remote}/${r.branch}`})]}):null,r.fetchedAt?(0,$.jsx)(v,{at:r.fetchedAt}):(0,$.jsx)(`span`,{children:`never refreshed`}),r.failure?(0,$.jsxs)(`span`,{className:`text-warn`,role:`status`,children:[`Stale: `,r.failure]}):null,(0,$.jsxs)(T,{size:`sm`,disabled:n.isPending,onClick:()=>n.mutate({action:`refresh`}),"aria-label":`Refresh shared work`,children:[(0,$.jsx)(w,{name:`refresh`,className:`size-3.5`}),`Refresh`]})]}):(0,$.jsx)(`span`,{className:`text-xs text-muted`,children:`Local only: the companion is not a Git repository.`})}function zr({payload:e,companion:t}){let n=Q(e=>e.drafts[t]??``),r=Q(e=>e.setDraft),[i,a]=(0,A.useState)(e.linkedRepositories[0]??``),[o,s]=(0,A.useState)(``),c=ur(t);if(!e.writable)return null;let l={...e.linkedRepositories.length>1?{repository:i}:{},...o.trim()?{ticket:o.trim()}:{}},u=()=>{r(t,``),s(``)},d=e=>{e.preventDefault(),n.trim()&&c.mutate({action:`capture`,text:n,...l},{onSuccess:e=>{e.ok&&u()}})},f=dr(c);return(0,$.jsxs)(`form`,{className:`work-capture grid min-w-0 grid-cols-[minmax(0,1fr)] gap-2`,onSubmit:d,"aria-label":`Capture an idea`,children:[(0,$.jsx)(`label`,{htmlFor:`work-capture-text`,className:`text-sm font-medium`,children:`What should we build or improve?`}),(0,$.jsx)(te,{id:`work-capture-text`,value:n,onChange:e=>r(t,e.target.value),placeholder:`Describe the outcome in plain words.`}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[e.linkedRepositories.length>1?(0,$.jsxs)(`label`,{className:`flex min-w-0 max-w-full items-center gap-2 text-xs text-muted`,children:[`Repository`,(0,$.jsx)(`select`,{className:`h-8 min-w-0 max-w-full truncate rounded-control border border-rule bg-page px-2 text-sm text-text`,value:i,onChange:e=>a(e.target.value),children:e.linkedRepositories.map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))})]}):null,e.ticketFormat===`jira`?(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted`,children:[`Ticket`,(0,$.jsx)(D,{className:`h-8 w-32`,value:o,onChange:e=>s(e.target.value),placeholder:`ABC-123`})]}):null,(0,$.jsx)(`div`,{className:`ml-auto flex gap-2`,children:(0,$.jsx)(T,{type:`submit`,disabled:!n.trim()||c.isPending,children:`Save`})})]}),f&&!f.ok?(0,$.jsx)(`p`,{className:`m-0 text-sm text-bad`,role:`alert`,children:f.reason}):null]})}function Br(){let e=c.useSearch();return e.companion?(0,$.jsx)(Vr,{search:e}):null}function Vr({search:e}){let{data:t}=r(p(e.companion));return(0,$.jsx)(Pr,{payload:t,search:e})}export{Br as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{G as e,Lt as t,M as n,U as r,i,q as a}from"./index-D5oGyvG8.js";import{o}from"./studio-queries-CKtAnIKP.js";import{t as s}from"./companion-view-B54_Lj0S.js";import{g as c}from"./studio-X7bnFrRe.js";import{t as l}from"./warnings-D7YY1HSG.js";import{a as u,n as d,t as f}from"./jsx-runtime-MZURdZre.js";import{et as p,it as m,ot as h,rt as g,tt as _}from"./button-upSzkd-q.js";import{t as v}from"./cn-BCnYnarL.js";import{n as y,r as b,t as x}from"./panel-CDQ6Lryw.js";import{i as S,n as C,r as w,t as T}from"./steps-CF3-Zpmh.js";var E=u(d(),1),D=e=>({id:e.id,kind:`stage`,step:e});function O(e){let t=e.map.map(e=>e.kind===`stage`?{nodes:[D(e.step)],optional:e.step.optional,phase:e.step.phase}:e.group===`human`?{nodes:[{id:C(e.steps[0]),kind:`review-group`,steps:e.steps}],optional:e.steps[0].optional,phase:e.steps[0].phase}:{nodes:e.steps.map(D),optional:!0,phase:e.steps[0].phase});return t.unshift({nodes:[{id:`start`,kind:`start`}],optional:!1,phase:t[0]?.phase??`plan`}),t}function k(e){return e.kind===`stage`?!!e.step.sessionBreakBefore:e.kind===`review-group`&&!!e.steps[0].sessionBreakBefore}function ee(e){let t=[],n=(e,n,r)=>{for(let i of e)for(let e of n)t.push({from:i.id,to:e.id,kind:r,newSession:k(e)})};return e.forEach((t,r)=>{let i=e[r+1];i&&n(t.nodes,i.nodes,`flow`);let a=e[r-1];t.optional&&a&&i&&n(a.nodes,i.nodes,`bypass`)}),t}function A(e){let t=[];return e.forEach((e,n)=>{let r=t.at(-1);r?.phase===e.phase?r.to=n+1:t.push({phase:e.phase,label:T[e.phase],from:n,to:n+1})}),t}function j(e){let t=e.findIndex(e=>e.nodes.some(e=>e.id===`submit`));return t===-1?null:{from:0,to:t+1}}function M(e){let t=O(e),n=Math.max(1,...t.map(e=>e.nodes.length)),r=t.flatMap((e,t)=>e.nodes.map((r,i)=>e.nodes.length===1?{...r,column:t,row:0,rowSpan:n}:{...r,column:t,row:i,rowSpan:1}));return{columns:t.length,rows:n,nodes:r,edges:ee(t),bands:A(t),cycle:j(t)}}var N=e=>e.rows*2+1;function P(e){return{along:e.column+.5,across:e.row*2+e.rowSpan}}var F=e=>Math.round(e*1e4)/1e4,I=(e,t)=>`${F(e/t*100)}%`,L=({along:e,across:t})=>`${F(t)} ${F(e)}`;function R(e,t){let n=t=>{let n=e.nodes.find(e=>e.id===t);if(!n)throw Error(`Unknown graph node: ${t}`);return P(n)};return[n(t.from),n(t.to)]}function z(e,t){let[n,r]=R(e,t);if(t.kind===`bypass`){let t=N(e);return`M ${L(n)} C ${L({along:n.along,across:t})}, ${L({along:r.along,across:t})}, ${L(r)}`}let i=(n.along+r.along)/2;return`M ${L(n)} C ${L({along:i,across:n.across})}, ${L({along:i,across:r.across})}, ${L(r)}`}function B(e,t){let[n,r]=R(e,t),i=(n.along+r.along)/2;return t.kind===`bypass`?{along:i,across:(n.across+r.across)/8+N(e)*3/4}:{along:i,across:(n.across+r.across)/2}}function V(e,t){return{x:I(t.across,N(e)),y:I(t.along,e.columns)}}function H(e,t){return{top:I(t.from,e.columns),height:I(t.to-t.from,e.columns)}}var U=f(),W={},te=[];function G({payload:e,counts:t=W,changesByStage:n=te}){let r=S({skills:e.skills&&e.skills.length>0?e.skills:void 0,topology:e.topology,workflow:e.workflow}),[i,a]=(0,E.useState)(r.paths[0].schema),o=r.paths.find(e=>e.schema===i)??r.paths[0];return(0,U.jsx)(`section`,{className:`workflow-delivery-path @container grid content-start gap-2`,"aria-label":`Delivery Path`,children:(0,U.jsx)(K,{path:o,paths:r.paths,onSchemaChange:a,counts:t,changesByStage:n})})}function K({path:e,paths:t,onSchemaChange:n,counts:r,changesByStage:i}){let[a,o]=(0,E.useState)(null),s=e.steps.find(e=>e.id===a)??null,c=i.filter(e=>e.changes.length>0);return(0,U.jsxs)(`div`,{className:v(m,`workflow-path grid grid-cols-[minmax(380px,520px)_minmax(260px,1fr)] items-start gap-10 pt-10 pb-12 @max-[880px]:grid-cols-1`),"data-workflow-schema-panel":e.schema,children:[(0,U.jsxs)(`div`,{className:`workflow-path-graph grid min-w-0 justify-items-center gap-9 px-8 pt-4`,children:[(0,U.jsx)(X,{path:e,selected:a,onSelect:o,counts:r}),(0,U.jsx)(Q,{})]}),(0,U.jsxs)(`div`,{className:`workflow-detail-overview grid content-start gap-5`,id:q(e),children:[(0,U.jsxs)(`div`,{className:`grid gap-2 text-sm leading-relaxed text-muted`,children:[(0,U.jsx)(`p`,{className:`workflow-description m-0 text-text`,children:e.description}),e.reviewsKnown?null:(0,U.jsx)(`p`,{className:`workflow-description m-0`,children:`The schema's artifacts could not be read, so its review stages are unknown.`}),(0,U.jsx)(`p`,{className:`workflow-description m-0`,children:`A workset is one or more changes published together: after Submit change, start again at the top for the next change, and publish once the workset is merged.`}),(0,U.jsx)(`p`,{className:`workflow-detail-hint m-0`,children:`Choose a stage to see what it does and the prompt that runs it.`})]}),c.length>0?(0,U.jsx)(g,{title:`Where your changes are`,children:(0,U.jsx)(`ul`,{className:`m-0 list-none p-0`,children:c.map(e=>(0,U.jsxs)(`li`,{className:`grid gap-1 border-t border-rule-soft px-4 py-2 first:border-t-0`,children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-semibold`,children:[e.label,(0,U.jsx)(_,{value:e.changes.length})]}),(0,U.jsx)(`span`,{className:`truncate font-mono text-xs text-muted`,children:e.changes.join(`, `)})]},e.node))})}):null]}),(0,U.jsx)(b,{items:e.steps.map(e=>e.id),current:s?.id??null,onSelect:o,title:s?`Stage ${s.label}`:`Stage`,children:s?(0,U.jsx)(re,{step:s,stepsKnown:e.stepsKnown,changes:i.find(e=>e.node===C(s))?.changes??[],children:s.kind===`human`?(0,U.jsx)(y,{title:`OpenSpec schema`,children:(0,U.jsxs)(`div`,{className:`grid gap-2`,"data-workflow-schema-root":!0,children:[t.length>1?(0,U.jsx)(h,{label:`OpenSpec schema`,value:e.schema,onChange:e=>{let r=t.find(t=>t.schema===e);r&&(r.steps.some(e=>e.id===a)||o(r.steps.find(e=>e.kind===`human`)?.id??null),n(e))},options:t.map(e=>({value:e.schema,label:e.label}))}):(0,U.jsx)(`code`,{className:`font-mono text-sm`,children:e.label}),(0,U.jsx)(`span`,{className:`text-sm text-muted`,children:e.tagline})]})}):null}):null})]})}var q=e=>`workflow-${e.schema}-overview`,J=(e,t,n)=>e.startsWith(`reviews`)?`${n} ${n===1?`change waits`:`changes wait`} for review`:`${n} ${n===1?`change`:`changes`} at ${t}`;function Y({count:e,name:t}){return e?(0,U.jsx)(`span`,{className:`workflow-graph-count absolute -top-2.5 -right-2.5 z-1 inline-grid h-5 min-w-5 place-items-center rounded-full border border-[color-mix(in_srgb,var(--accent)_45%,var(--border))] bg-accent-soft px-1.5 font-sans text-2xs font-bold text-text`,"aria-label":t,role:`img`,children:e}):null}function X({path:e,label:t=`Delivery Path map`,selected:n=null,onSelect:r,counts:i=W}){let a=M(e),o=!r;return(0,U.jsxs)(`nav`,{className:`workflow-graph`,"aria-label":t,style:{"--graph-columns":String(a.columns),"--graph-rows":String(a.rows)},children:[(0,U.jsxs)(`div`,{className:`workflow-graph-bands`,"aria-hidden":`true`,children:[a.bands.map(e=>(0,U.jsx)(`div`,{className:`workflow-graph-band`,"data-band":e.phase,style:H(a,e),children:e.label},e.phase)),a.cycle?(0,U.jsx)(`div`,{className:`workflow-graph-cycle`,style:H(a,a.cycle),children:(0,U.jsx)(`span`,{children:`repeats for each change`})}):null,(0,U.jsx)(`div`,{className:`workflow-graph-workset`,children:(0,U.jsx)(`span`,{children:`workset`})})]}),(0,U.jsx)(ne,{graph:a}),(0,U.jsx)(`ol`,{className:`workflow-graph-nodes`,children:a.nodes.map(e=>e.kind===`start`?null:(0,U.jsx)(`li`,{className:`workflow-graph-node`,"data-node-kind":e.kind,style:{"--graph-row":String(e.column+1),"--graph-lane":String(e.row+1),"--graph-span":String(e.rowSpan)},children:e.kind===`stage`?(0,U.jsxs)(`span`,{className:`relative max-w-full`,children:[(0,U.jsx)($,{step:e.step,box:!0,plain:o,current:n===e.step.id,onSelect:r}),o?null:(0,U.jsx)(Y,{count:i[e.id],name:J(e.id,e.step.label,i[e.id]??0)})]}):(0,U.jsxs)(`div`,{className:`workflow-graph-box workflow-graph-group relative`,"data-map-group":`human`,"data-current":e.steps.some(e=>e.id===n)?`true`:void 0,children:[o?(0,U.jsx)(`span`,{className:`workflow-graph-group-label`,children:Z(e.steps)}):(0,U.jsx)(`button`,{type:`button`,className:`workflow-graph-group-label cursor-pointer rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent`,onClick:()=>r?.(e.steps[0].id),children:Z(e.steps)}),(0,U.jsx)(`ol`,{children:e.steps.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsx)($,{step:e,plain:o,current:n===e.id,onSelect:r})},e.id))}),o?null:(0,U.jsx)(Y,{count:i[e.id],name:J(e.id,Z(e.steps),i[e.id]??0)})]})},e.id))})]})}function Z(e){let[t]=e;return t?.kind===`human`?t.groupLabel:`Human review`}function Q(){return(0,U.jsxs)(`ul`,{className:`workflow-graph-legend`,"aria-hidden":`true`,children:[(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-legend-optional`}),`optional`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-graph-openspec`}),`OpenSpec`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-legend-session`}),`new session`]}),(0,U.jsxs)(`li`,{children:[(0,U.jsx)(`i`,{className:`workflow-legend-skip`}),`can be skipped`]})]})}function ne({graph:e}){return(0,U.jsxs)(`svg`,{className:`workflow-graph-layer`,"aria-hidden":`true`,focusable:`false`,children:[(0,U.jsx)(`svg`,{viewBox:`0 0 ${N(e)} ${e.columns}`,preserveAspectRatio:`none`,overflow:`visible`,children:e.edges.map(t=>(0,U.jsx)(`path`,{className:`workflow-graph-edge`,d:z(e,t),"data-edge-kind":t.kind,"data-edge-from":t.from,"data-edge-to":t.to,"data-new-session":t.newSession?`true`:void 0},`${t.kind}-${t.from}-${t.to}`))}),e.nodes.map(t=>{if(t.kind!==`start`)return null;let{x:n,y:r}=V(e,P(t));return(0,U.jsx)(`circle`,{className:`workflow-graph-start`,cx:n,cy:r,r:`3.5`},t.id)}),e.edges.map(t=>{if(!t.newSession)return null;let{x:n,y:r}=V(e,B(e,t));return(0,U.jsx)(`circle`,{className:`workflow-graph-session`,"data-session-mark":t.to,cx:n,cy:r,r:`3.5`},`${t.from}-${t.to}`)})]})}function $({step:e,box:t,plain:n,current:r,onSelect:i}){let a={className:t?`workflow-graph-link workflow-graph-box`:`workflow-graph-link`,"data-map-stage":e.id,"data-stage-kind":e.kind,"data-optional":e.optional?`true`:void 0},o=(0,U.jsxs)(U.Fragment,{children:[e.badges.includes(`openspec`)?(0,U.jsx)(`span`,{className:`workflow-graph-openspec`,"aria-hidden":`true`}):null,e.kind===`human`?e.artifact:e.label]});return n?(0,U.jsx)(`span`,{...a,children:o}):(0,U.jsx)(`button`,{type:`button`,...a,"aria-label":e.kind===`human`?e.label:void 0,"aria-current":r?`true`:void 0,onClick:()=>i?.(e.id),children:o})}function re({step:e,stepsKnown:t,changes:n,children:r}){return(0,U.jsxs)(`article`,{className:`workflow-card`,"data-stage":e.id,"data-stage-kind":e.kind,"data-optional":e.optional?`true`:void 0,children:[(0,U.jsx)(x,{title:e.label,kicker:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:T[e.phase]}),e.optional?(0,U.jsx)(`span`,{children:`· optional`}):null,e.kind===`human`?(0,U.jsx)(`span`,{className:`text-why`,children:`· human review`}):null,e.badges.includes(`openspec`)?(0,U.jsx)(`span`,{children:`· OpenSpec`}):null]}),children:e.skill||e.sessionBreakBefore?(0,U.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm text-muted`,children:[e.skill?(0,U.jsx)(`code`,{className:`font-mono text-text`,children:e.skill}):null,e.sessionBreakBefore?(0,U.jsxs)(`span`,{className:`workflow-card-session inline-flex items-center gap-1.5 text-accent`,children:[(0,U.jsx)(`span`,{className:`size-2 rounded-full border-[1.5px] border-accent`,"aria-hidden":`true`}),`New session / clean chat`]}):null]}):null}),r,(0,U.jsxs)(y,{title:e.kind===`human`?`How it runs`:`Run`,children:[(0,U.jsx)(ie,{step:e}),e.missingSkill?(0,U.jsxs)(`p`,{className:`workflow-missing-skill m-0 text-sm text-warn`,role:`note`,children:[`Skill not reported for this companion:`,` `,(0,U.jsx)(`code`,{className:`font-mono`,children:e.missingSkill}),`. Run`,` `,(0,U.jsx)(`code`,{className:`font-mono`,children:`mate companion update`}),`; this stage is not complete.`]}):null]}),e.kind===`skill`&&t?(0,U.jsx)(y,{title:`Steps`,aside:e.source,children:(0,U.jsx)(`ol`,{className:`workflow-stage-steps m-0 grid list-decimal gap-1 pl-5 text-sm`,children:e.steps.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsx)(`code`,{className:`font-mono`,children:e.skill})},`${t}-${e.skill}`))})}):null,(0,U.jsx)(y,{title:`What`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm leading-relaxed`,children:e.what})}),(0,U.jsx)(y,{title:`Why`,children:(0,U.jsx)(`p`,{className:`m-0 text-sm leading-relaxed`,children:e.why})}),n.length>0?(0,U.jsx)(y,{title:`Changes at this stage`,aside:String(n.length),children:(0,U.jsx)(`ul`,{className:`m-0 grid list-none gap-1 p-0`,children:n.map(e=>(0,U.jsx)(`li`,{className:`truncate font-mono text-sm`,children:e},e))})}):null]})}function ie({step:e}){return e.kind===`human`?(0,U.jsxs)(`p`,{className:`workflow-card-human m-0 text-sm`,children:[`Review `,e.artifact,` yourself — no skill, no prompt`]}):e.alternatives?.length?(0,U.jsx)(`div`,{className:`workflow-option-list grid gap-3`,children:e.alternatives.map(e=>(0,U.jsxs)(`div`,{className:`workflow-option grid gap-1.5`,children:[(0,U.jsx)(p,{text:e.prompt,copy:e.copyPrompt,label:`${e.name} prompt`}),(0,U.jsx)(`small`,{className:`text-xs text-muted`,children:e.description})]},e.name))}):e.prompt?(0,U.jsx)(p,{text:e.prompt,copy:e.copyPrompt??e.prompt,label:`${e.label} prompt`}):null}var ae=c();function oe(t,n){let r=t.map(e=>({name:e.name,stage:a(e,n).stageId})),i=e(n).map(e=>({node:e.kind===`review`?w(e.id):e.id,label:e.label,changes:r.flatMap(t=>t.stage===e.id?[t.name]:[])})),o={};for(let e of i)e.changes.length>0&&(o[e.node]=e.changes.length);return{counts:o,byStage:i}}var se=[];function ce({payload:e,changes:t=se}){let{counts:n,byStage:r}=oe(t,e.workflow??ae);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(l,{warnings:e.warnings}),(0,U.jsx)(`div`,{className:`workflow-view`,children:(0,U.jsx)(G,{payload:e,counts:n,changesByStage:r})})]})}var le=function(){let e=i.useSearch(),a=n(),c=t({...o(`dashboard`,e),enabled:a});return(0,U.jsx)(s,{view:`workflow`,search:e,children:e=>(0,U.jsx)(ce,{payload:{skills:e.skills??[],topology:e.topology??null,warnings:e.warnings,workflow:e.workflow},changes:r(c.data?.changes??[],c.data?.submitted??[])})})};export{le as component};
|