@open-mercato/cezar 0.9.2 → 0.10.0-pr892.1298
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/LICENSE +21 -0
- package/README.md +169 -38
- package/dist/agent-config/account-identity.d.ts +44 -0
- package/dist/agent-config/account-identity.js +128 -0
- package/dist/agent-config/account-identity.js.map +1 -0
- package/dist/agent-config/catalog.d.ts +8 -0
- package/dist/agent-config/catalog.js +18 -0
- package/dist/agent-config/catalog.js.map +1 -1
- package/dist/agent-config/model-settings/claude.d.ts +2 -0
- package/dist/agent-config/model-settings/claude.js +11 -0
- package/dist/agent-config/model-settings/claude.js.map +1 -0
- package/dist/agent-config/model-settings/codex.d.ts +2 -0
- package/dist/agent-config/model-settings/codex.js +16 -0
- package/dist/agent-config/model-settings/codex.js.map +1 -0
- package/dist/agent-config/model-settings/opencode.d.ts +2 -0
- package/dist/agent-config/model-settings/opencode.js +8 -0
- package/dist/agent-config/model-settings/opencode.js.map +1 -0
- package/dist/agent-config/model-settings/pi.d.ts +12 -0
- package/dist/agent-config/model-settings/pi.js +18 -0
- package/dist/agent-config/model-settings/pi.js.map +1 -0
- package/dist/agent-config/model-settings/shared.d.ts +9 -0
- package/dist/agent-config/model-settings/shared.js +93 -0
- package/dist/agent-config/model-settings/shared.js.map +1 -0
- package/dist/agent-config/model-settings/types.d.ts +9 -0
- package/dist/agent-config/model-settings/types.js +2 -0
- package/dist/agent-config/model-settings/types.js.map +1 -0
- package/dist/agent-config/models.d.ts +9 -0
- package/dist/agent-config/models.js +32 -0
- package/dist/agent-config/models.js.map +1 -0
- package/dist/agent-config/service.js +4 -4
- package/dist/agent-config/service.js.map +1 -1
- package/dist/automations/types.d.ts +4 -0
- package/dist/automations/types.js +2 -1
- package/dist/automations/types.js.map +1 -1
- package/dist/config.d.ts +10 -1
- package/dist/config.js +48 -5
- package/dist/config.js.map +1 -1
- package/dist/contract/agent-config.d.ts +2 -0
- package/dist/contract/agent-profiles.d.ts +347 -0
- package/dist/contract/automations.d.ts +24 -0
- package/dist/contract/events.d.ts +59 -0
- package/dist/contract/github.d.ts +88 -0
- package/dist/contract/health.d.ts +7 -1
- package/dist/contract/index.d.ts +1 -0
- package/dist/contract/index.js +1005 -555
- package/dist/contract/projects.d.ts +33 -5
- package/dist/contract/runs.d.ts +247 -0
- package/dist/contract/skills.d.ts +7 -0
- package/dist/contract/workflows.d.ts +6 -0
- package/dist/contract/workspace.d.ts +137 -2
- package/dist/core/agent-env.js +41 -16
- package/dist/core/agent-env.js.map +1 -1
- package/dist/core/agent-model-policy.d.ts +10 -0
- package/dist/core/agent-model-policy.js +36 -0
- package/dist/core/agent-model-policy.js.map +1 -0
- package/dist/core/agent-profiles.d.ts +62 -0
- package/dist/core/agent-profiles.js +90 -0
- package/dist/core/agent-profiles.js.map +1 -0
- package/dist/core/agent-runner.d.ts +37 -6
- package/dist/core/agent-runner.js +35 -3
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/backend-detect.d.ts +5 -5
- package/dist/core/backend-detect.js +44 -7
- package/dist/core/backend-detect.js.map +1 -1
- package/dist/core/claude-cli-runner.js +10 -5
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-app-server-runner.js +13 -3
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-app-server-transport.js +7 -2
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/model-identity.d.ts +23 -11
- package/dist/core/model-identity.js +41 -24
- package/dist/core/model-identity.js.map +1 -1
- package/dist/core/model-presets.d.ts +8 -2
- package/dist/core/model-presets.js +51 -8
- package/dist/core/model-presets.js.map +1 -1
- package/dist/core/opencode-model-catalog.d.ts +32 -0
- package/dist/core/opencode-model-catalog.js +153 -0
- package/dist/core/opencode-model-catalog.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +2 -0
- package/dist/core/opencode-server-runner.js +42 -11
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.d.ts +24 -0
- package/dist/core/pi-runner.js +349 -0
- package/dist/core/pi-runner.js.map +1 -0
- package/dist/core/pi-ui-mapper.d.ts +34 -0
- package/dist/core/pi-ui-mapper.js +270 -0
- package/dist/core/pi-ui-mapper.js.map +1 -0
- package/dist/core/provider-auth.d.ts +95 -3
- package/dist/core/provider-auth.js +234 -15
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/core/provider-availability.d.ts +1 -1
- package/dist/core/provider-availability.js +2 -1
- package/dist/core/provider-availability.js.map +1 -1
- package/dist/core/runner-factory.js +3 -0
- package/dist/core/runner-factory.js.map +1 -1
- package/dist/core/shell-env.d.ts +28 -0
- package/dist/core/shell-env.js +56 -0
- package/dist/core/shell-env.js.map +1 -0
- package/dist/core/ui-events.d.ts +1 -1
- package/dist/core/usage-limit.d.ts +42 -0
- package/dist/core/usage-limit.js +209 -0
- package/dist/core/usage-limit.js.map +1 -0
- package/dist/git-diff-base.d.ts +51 -26
- package/dist/git-diff-base.js +163 -37
- package/dist/git-diff-base.js.map +1 -1
- package/dist/git-worktree.d.ts +15 -6
- package/dist/git-worktree.js +10 -3
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +53 -5
- package/dist/paths.js +63 -9
- package/dist/paths.js.map +1 -1
- package/dist/planner.js +6 -0
- package/dist/planner.js.map +1 -1
- package/dist/release/snapshot.d.ts +13 -2
- package/dist/release/snapshot.js +25 -1
- package/dist/release/snapshot.js.map +1 -1
- package/dist/runs/agent-tmpdir.d.ts +41 -0
- package/dist/runs/agent-tmpdir.js +183 -0
- package/dist/runs/agent-tmpdir.js.map +1 -0
- package/dist/runs/auto-name.js +6 -1
- package/dist/runs/auto-name.js.map +1 -1
- package/dist/runs/event-history.d.ts +50 -0
- package/dist/runs/event-history.js +613 -0
- package/dist/runs/event-history.js.map +1 -0
- package/dist/runs/run-index.d.ts +19 -0
- package/dist/runs/run-index.js +43 -0
- package/dist/runs/run-index.js.map +1 -0
- package/dist/runs/store.d.ts +78 -19
- package/dist/runs/store.js +175 -43
- package/dist/runs/store.js.map +1 -1
- package/dist/server/capabilities.d.ts +15 -1
- package/dist/server/capabilities.js +16 -1
- package/dist/server/capabilities.js.map +1 -1
- package/dist/server/forge/github.d.ts +169 -0
- package/dist/server/forge/github.js +511 -0
- package/dist/server/forge/github.js.map +1 -1
- package/dist/server/forge/index.d.ts +9 -0
- package/dist/server/forge/index.js +14 -0
- package/dist/server/forge/index.js.map +1 -1
- package/dist/server/git-changes.d.ts +7 -5
- package/dist/server/git-changes.js +15 -10
- package/dist/server/git-changes.js.map +1 -1
- package/dist/server/github.d.ts +2 -2
- package/dist/server/github.js +1 -1
- package/dist/server/github.js.map +1 -1
- package/dist/server/open-in-app.d.ts +2 -1
- package/dist/server/open-in-app.js +3 -1
- package/dist/server/open-in-app.js.map +1 -1
- package/dist/server/open-in-terminal.d.ts +46 -1
- package/dist/server/open-in-terminal.js +72 -13
- package/dist/server/open-in-terminal.js.map +1 -1
- package/dist/server/provider-action-gate.js +3 -1
- package/dist/server/provider-action-gate.js.map +1 -1
- package/dist/server/server.d.ts +2206 -434
- package/dist/server/server.js +1219 -136
- package/dist/server/server.js.map +1 -1
- package/dist/server-install/engine.js +5 -18
- package/dist/server-install/engine.js.map +1 -1
- package/dist/server-install/steps.js +6 -2
- package/dist/server-install/steps.js.map +1 -1
- package/dist/skills.js +4 -0
- package/dist/skills.js.map +1 -1
- package/dist/workflows/run.d.ts +229 -9
- package/dist/workflows/run.js +877 -147
- package/dist/workflows/run.js.map +1 -1
- package/dist/workflows/types.d.ts +3 -0
- package/dist/workflows/types.js +11 -2
- package/dist/workflows/types.js.map +1 -1
- package/dist/workspace/agent-accounts.d.ts +153 -0
- package/dist/workspace/agent-accounts.js +304 -0
- package/dist/workspace/agent-accounts.js.map +1 -0
- package/dist/workspace/agent-profiles.d.ts +78 -0
- package/dist/workspace/agent-profiles.js +115 -0
- package/dist/workspace/agent-profiles.js.map +1 -0
- package/dist/workspace/config.d.ts +27 -1
- package/dist/workspace/config.js +83 -2
- package/dist/workspace/config.js.map +1 -1
- package/dist/workspace/projects-cli.js +54 -4
- package/dist/workspace/projects-cli.js.map +1 -1
- package/dist/workspace/projects.d.ts +19 -1
- package/dist/workspace/projects.js +34 -1
- package/dist/workspace/projects.js.map +1 -1
- package/dist/workspace/semaphore.d.ts +46 -1
- package/dist/workspace/semaphore.js +41 -4
- package/dist/workspace/semaphore.js.map +1 -1
- package/dist/workspace/ui-state.d.ts +3 -2
- package/dist/workspace/ui-state.js +3 -2
- package/dist/workspace/ui-state.js.map +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +20 -0
- package/scripts/mock-pi-rpc.mjs +83 -0
- package/web/dist/assets/{alert-dialog-ghffK6g9.js → alert-dialog-Byp42_IG.js} +1 -1
- package/web/dist/assets/arrow-down-CGDbDYKD.js +1 -0
- package/web/dist/assets/arrow-left-ESCjr1Hq.js +1 -0
- package/web/dist/assets/centered-state-LfAW-igm.js +43 -0
- package/web/dist/assets/chevron-right-Du-P1IUd.js +1 -0
- package/web/dist/assets/{collapsible-B0JVzd0B.js → collapsible-CBiiqDJM.js} +1 -1
- package/web/dist/assets/{commit-list-wm6DPHNs.js → commit-list-6PPve7PE.js} +1 -1
- package/web/dist/assets/{compare-variants-DbdP4Y5T.js → compare-variants-BDnp6mXJ.js} +1 -1
- package/web/dist/assets/{diff-Bizc96qe.js → diff-_jK0OWpF.js} +2 -2
- package/web/dist/assets/{diff-stat-Dyfg3ltF.js → diff-stat-CIrTu4Ym.js} +1 -1
- package/web/dist/assets/{diff-view-CG8ek6tC.js → diff-view-COA_5IyY.js} +1 -1
- package/web/dist/assets/dropdown-menu-BofYpFFw.js +1 -0
- package/web/dist/assets/editable-title-_J0zFDl-.js +1 -0
- package/web/dist/assets/{ellipsis-vertical-DpGTRqC2.js → ellipsis-vertical-BeMR-l62.js} +1 -1
- package/web/dist/assets/{file-DlUGpUlb.js → file-DY996Pee.js} +1 -1
- package/web/dist/assets/{folder-BAY6Vddy.js → folder-NO3Ec-TY.js} +1 -1
- package/web/dist/assets/git-toolbar-BqJeUWcD.js +1 -0
- package/web/dist/assets/github-C96HPV9E.js +1 -0
- package/web/dist/assets/{image-preview-BWGk5fPX.js → image-preview-D9cCDfKQ.js} +1 -1
- package/web/dist/assets/index-Bx-grqa9.css +2 -0
- package/web/dist/assets/index-DoVvGDfW.js +7 -0
- package/web/dist/assets/{markdown-BGBOGCA_.js → markdown-DDzk11zj.js} +1 -1
- package/web/dist/assets/new-task-form-BNLLgC6P.js +1 -0
- package/web/dist/assets/pill-CVM1EmV4.js +1 -0
- package/web/dist/assets/{project-router-Cx8NPoqn.js → project-router-LRCtP48W.js} +1 -1
- package/web/dist/assets/prompt-templates-DFOvYgtW.js +15 -0
- package/web/dist/assets/{refresh-cw-BoGdAykg.js → refresh-cw-D1ys6QY2.js} +1 -1
- package/web/dist/assets/repo-git-CzUnsgWY.js +1 -0
- package/web/dist/assets/{run-diff-EcOkf3ti.js → run-diff-BlnqwfSS.js} +2 -2
- package/web/dist/assets/run-header-Bn7cN0Z1.js +1 -0
- package/web/dist/assets/{search-x-X3EpVhgs.js → search-x-D6FSpxId.js} +1 -1
- package/web/dist/assets/{skill-empty-hint-CZLALx6l.js → skill-empty-hint-iwpCcqgI.js} +1 -1
- package/web/dist/assets/skills-CezbOaol.js +1 -0
- package/web/dist/assets/{sparkles-Dt4q7pbG.js → sparkles-MrQrgCI9.js} +1 -1
- package/web/dist/assets/{square-terminal-hwBL8XsC.js → square-terminal-TTH64lO7.js} +1 -1
- package/web/dist/assets/tab-link-FYksz037.js +1 -0
- package/web/dist/assets/task-changes-ClWlnzBL.js +1 -0
- package/web/dist/assets/{task-commits-BTTA5k5T.js → task-commits-Crbrl86b.js} +1 -1
- package/web/dist/assets/{task-files-Da8_4C9g.js → task-files-uSCWyD0-.js} +2 -2
- package/web/dist/assets/task-thread-DPmamBA1.js +9 -0
- package/web/dist/assets/{textarea-CUdokhkv.js → textarea-B9Ahj4E4.js} +1 -1
- package/web/dist/assets/thread-loading-BH_ypQoy.js +1 -0
- package/web/dist/assets/{trash-2-DhVIdWv8.js → trash-2-D8S3V3fu.js} +1 -1
- package/web/dist/assets/{triangle-alert-XYT0DGCI.js → triangle-alert-bB7p9n5E.js} +1 -1
- package/web/dist/assets/{upload-BKjN59-1.js → upload-Bd5oRLPV.js} +1 -1
- package/web/dist/assets/{use-desktop-Bf5LS_P4.js → use-desktop-BNvbRBeZ.js} +1 -1
- package/web/dist/assets/{use-submit-shortcut-CzVyoAMd.js → use-submit-shortcut-B-xhu4Bf.js} +1 -1
- package/web/dist/assets/utils-BhpbVMwN.js +64 -0
- package/web/dist/assets/{workflows-o2QU_pvU.js → workflows-RmfbM9Vy.js} +3 -3
- package/web/dist/assets/{zoomable-image-7WyUiaVD.js → zoomable-image-BCW6ZBV0.js} +1 -1
- package/web/dist/index.html +24 -23
- package/web/dist/assets/arrow-down-Cz8qb71e.js +0 -1
- package/web/dist/assets/arrow-left-wcYKQXI_.js +0 -1
- package/web/dist/assets/centered-state-ZtnFHA-n.js +0 -43
- package/web/dist/assets/chevron-right-G4caF2QV.js +0 -1
- package/web/dist/assets/circle-check--KvBxXWp.js +0 -1
- package/web/dist/assets/circle-x-C3EFZ3xf.js +0 -1
- package/web/dist/assets/dropdown-menu-C1Dlf35P.js +0 -1
- package/web/dist/assets/editable-title-5rC_QRBZ.js +0 -1
- package/web/dist/assets/git-pull-request-agOG0iGM.js +0 -1
- package/web/dist/assets/git-toolbar-DGiNMmtY.js +0 -1
- package/web/dist/assets/github-Vp7lxYGQ.js +0 -1
- package/web/dist/assets/index-DSxyJpuK.css +0 -2
- package/web/dist/assets/index-DiawI6RX.js +0 -6
- package/web/dist/assets/new-task-form-BpAw_Dks.js +0 -1
- package/web/dist/assets/pill-Dvs-P0xy.js +0 -1
- package/web/dist/assets/prompt-templates-CSBYBR1I.js +0 -15
- package/web/dist/assets/repo-git-PmX-BNMo.js +0 -1
- package/web/dist/assets/run-header-BGiv6_qX.js +0 -1
- package/web/dist/assets/skills-CC91ouGH.js +0 -1
- package/web/dist/assets/tab-link-DIlR5T07.js +0 -1
- package/web/dist/assets/task-changes-XkHDxzQA.js +0 -1
- package/web/dist/assets/task-thread-DoNXUsHr.js +0 -9
- package/web/dist/assets/thread-loading-B8q8ukXJ.js +0 -1
- package/web/dist/assets/utils-DsLuRXwV.js +0 -64
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,At as i,Br as a,Fn as o,Fr as s,Gr as c,Jr as l,Lr as u,Or as d,Pt as f,St as p,Tn as m,Tr as h,U as g,Ur as _,V as v,Vr as y,Xn as b,Yn as x,_t as S,a as C,at as w,bn as T,ct as E,et as D,i as O,it as ee,j as k,jn as A,jt as te,k as j,n as ne,nn as re,qr as ie,rn as ae,t as M,z as N,zr as P}from"./centered-state-LfAW-igm.js";import{a as oe,c as se,n as ce,r as F,t as I}from"./utils-BhpbVMwN.js";import{_ as le,m as ue,y as L}from"./editable-title-_J0zFDl-.js";import{t as de}from"./arrow-down-CGDbDYKD.js";import{c as fe,i as pe,l as me,n as he,o as ge,s as _e,t as ve}from"./thread-loading-BH_ypQoy.js";import{_ as ye,a as be,i as xe,s as Se}from"./new-task-form-BNLLgC6P.js";import{t as R}from"./chevron-right-Du-P1IUd.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as ke,s as Ae,t as je}from"./run-header-Bn7cN0Z1.js";import{b as Me,y as Ne}from"./dropdown-menu-BofYpFFw.js";import{n as Pe,t as Fe}from"./trash-2-D8S3V3fu.js";import{E as Ie,T as Le,d as Re,f as ze,p as Be}from"./prompt-templates-DFOvYgtW.js";import{t as Ve}from"./search-x-D6FSpxId.js";import{t as He}from"./square-terminal-TTH64lO7.js";import{t as Ue}from"./textarea-B9Ahj4E4.js";import{n as z,r as B,t as We}from"./collapsible-CBiiqDJM.js";import{t as Ge}from"./use-submit-shortcut-B-xhu4Bf.js";import{t as V}from"./project-router-LRCtP48W.js";import{s as H}from"./pill-CVM1EmV4.js";import{t as U}from"./markdown-DDzk11zj.js";import{t as Ke}from"./lib-BQXq3kEf.js";import{t as qe}from"./zoomable-image-BCW6ZBV0.js";import{t as Je}from"./run-diff-BlnqwfSS.js";var Ye=120;function W(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function G(e){let t=e.replace(/\s+/g,` `).trim();return t.length>Ye?`${t.slice(0,Ye-1)}…`:t}function K(e,...t){if(W(e))for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim()!==``)return G(t)}}function Xe(e){if(!W(e))return;let t=e.command;if(typeof t==`string`&&t.trim()!==``)return G(t);if(Array.isArray(t)){let e=t.filter(e=>typeof e==`string`);if(e.length>0)return G(e.join(` `))}}function Ze(e){if(!W(e)||!Array.isArray(e.changes))return[];let t=[];for(let n of e.changes)W(n)&&typeof n.path==`string`&&n.path.trim()!==``&&t.push(n.path);return t}function Qe(e){return K(e,`description`,`query`,`url`,`filePath`,`file_path`,`path`,`pattern`,`name`)}function q(e,t){return t?`${e} ${t}`:e}function $e(e,t){let n=typeof e==`string`?e.toLowerCase():``;switch(n){case`bash`:case`commandexecution`:return{toolKind:`execute`,title:q(`Ran`,Xe(t)),subtitle:K(t,`description`)};case`edit`:case`multiedit`:return{toolKind:`edit`,title:q(`Edit`,K(t,`file_path`,`filePath`,`path`))};case`write`:return{toolKind:`edit`,title:q(`Write`,K(t,`file_path`,`filePath`,`path`))};case`notebookedit`:return{toolKind:`edit`,title:q(`Edit`,K(t,`notebook_path`,`notebookPath`,`file_path`,`filePath`,`path`))};case`filechange`:{let e=Ze(t);return{toolKind:`edit`,title:q(`Edit`,e.length===1?e[0]:e.length>1?`${e.length} files`:void 0)}}case`read`:return{toolKind:`read`,title:q(`Read`,K(t,`file_path`,`filePath`,`path`))};case`imageview`:return{toolKind:`read`,title:q(`View image`,K(t,`path`))};case`glob`:case`grep`:return{toolKind:`search`,title:q(`Search`,K(t,`pattern`,`query`)),subtitle:K(t,`path`)};case`webfetch`:return{toolKind:`fetch`,title:q(`Fetch`,K(t,`url`))};case`websearch`:return{toolKind:`fetch`,title:q(`Web search`,K(t,`query`))};case`task`:case`agent`:{let e=n===`agent`?`Agent`:`Task`,r=K(t,`subagent_type`,`subagentType`),i=K(t,`description`,`prompt`)??r;return{toolKind:`task`,title:i?`${e}: ${i}`:e,subtitle:i===r?void 0:r}}case`skill`:{let e=K(t,`skill`,`name`,`command`);return{toolKind:`task`,title:e?`Skill: ${e}`:`Skill`,subtitle:K(t,`args`,`description`)}}case`todowrite`:case`todolist`:case`plan`:case`taskcreate`:case`taskupdate`:case`tasklist`:return{toolKind:`plan`,title:`Update plan`};case`contextcompaction`:return{toolKind:`other`,title:`Compacted context`};case`mcptoolcall`:{let e=K(t,`server`),n=K(t,`tool`);return e&&n?{toolKind:`other`,title:`${e}.${n}`}:{toolKind:`other`,title:`MCP tool`,subtitle:Qe(t)}}}if(n.startsWith(`mcp__`)){let t=e.split(`__`).filter(e=>e!==``);if(t.length>=3)return{toolKind:`other`,title:`${t[1]}.${t.slice(2).join(`__`)}`}}return{toolKind:`other`,title:typeof e==`string`&&e.trim()!==``?G(e):`Tool`,subtitle:Qe(t)}}var et=class extends c{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,u=o&&c===`forward`,d=i&&c===`forward`,f=o&&c===`backward`,p=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:ie(t,n.data),hasPreviousPage:l(t,n.data),isFetchNextPageError:u,isFetchingNextPage:d,isFetchPreviousPageError:f,isFetchingPreviousPage:p,isRefetchError:s&&!u&&!f,isRefetching:a&&!d&&!p}}};function tt(e,t){return y(e,et,t)}var nt=F(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),rt=F(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),it=F(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),at=F(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),ot=F(`message-square-text`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]),st=F(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),ct=F(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),J=e(t(),1),lt=[`run-event`,`ui-event`];function ut(e){let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let{seq:n,type:r}=t;return typeof n!=`number`||typeof r!=`string`||r===``?null:t}function dt(e,t={}){let[n,r]=(0,J.useState)([]),{cursor:i,afterSeq:a=0,maxEvents:o,compactAt:s,onCompact:c}=t;return(0,J.useEffect)(()=>{if(r([]),!e)return;let t=globalThis.EventSource;if(typeof t!=`function`)return;let n=a,l=null,u,d=!1,f=!1,p=Date.now(),m,h=e=>{p=Date.now();let t=ut(e.data);!t||!(t.seq>n)||(n=t.seq,r(e=>{let n=[...e,t];return!f&&s!==void 0&&n.length>=s&&(f=!0,queueMicrotask(()=>{d||c?.()})),o===void 0||n.length<=o?n:n.slice(-o)}))},g=()=>{p=Date.now()},_=()=>{d||u!==void 0||(u=setTimeout(()=>{u=void 0,d||v()},1500))},v=()=>{l?.close(),p=Date.now();let r=new URLSearchParams;i!==void 0&&r.set(`cursor`,i),(i!==void 0||a>0)&&r.set(`afterSeq`,String(n));let o=r.size>0?`?${r.toString()}`:``;l=new t(oe(`/runs/${encodeURIComponent(e)}/events${o}`),{withCredentials:!0});for(let e of lt)l.addEventListener(e,h);l.addEventListener(`ping`,g),l.addEventListener(`error`,()=>{l?.readyState===2&&_()})},y=()=>{document.visibilityState===`visible`&&(!l||l.readyState===2)&&(clearTimeout(u),u=void 0,v())},b=()=>{clearTimeout(u),u=void 0,l?.close()},x=e=>{e.persisted&&v()};return m=setInterval(()=>{d||document.visibilityState!==`visible`||Date.now()-p<=4e4||(clearTimeout(u),u=void 0,v())},1e4),document.addEventListener(`visibilitychange`,y),window.addEventListener(`pagehide`,b),window.addEventListener(`pageshow`,x),v(),()=>{d=!0,clearTimeout(u),clearInterval(m),document.removeEventListener(`visibilitychange`,y),window.removeEventListener(`pagehide`,b),window.removeEventListener(`pageshow`,x),l?.close()}},[e,i,a,o,s,c]),n}var ft=5,pt=200,mt=5e3;function ht(...e){let t=new Map;for(let n of e)for(let e of n)t.set(e.seq,e);return[...t.values()].sort((e,t)=>e.seq-t.seq)}function gt(e){let t=se(),n=_(),r=[`run-history`,t,e],i=[`run-history-context`,t,e],o=tt({queryKey:r,enabled:e!==void 0,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>x(e,t,{signal:n}),getPreviousPageParam:e=>e.olderCursor,getNextPageParam:e=>e.newerCursor,maxPages:ft,retry:1}),s=a({queryKey:i,enabled:e!==void 0,queryFn:({signal:t})=>b(e,{signal:t}),retry:1}),c=o.isError||s.isError,l=dt(c?e:void 0),u=o.data?.pages??[],d=u.reduce((e,t)=>t.newerCursor===void 0?t:e??t,void 0),f=(0,J.useRef)(!1),p=(0,J.useCallback)(()=>{e===void 0||f.current||(f.current=!0,x(e,void 0).then(r=>{n.setQueryData([`run-history`,t,e],e=>{if(!e)return{pages:[r],pageParams:[void 0]};let t=[...e.pages],n=[...e.pageParams],i=-1;for(let e=0;e<t.length;e+=1)(i===-1||t[e].asOfSeq>t[i].asOfSeq)&&(i=e);for(i>=0&&t[i].newerCursor===void 0?(t[i]=r,n[i]=void 0):(t.push(r),n.push(void 0));t.length>ft;)t.shift(),n.shift();return{pages:t,pageParams:n}})}).catch(()=>{}).finally(()=>{f.current=!1}))},[n,e,t]),m=dt(!c&&d?e:void 0,{cursor:d?.liveCursor,afterSeq:d?.asOfSeq,maxEvents:mt,compactAt:pt,onCompact:p}),h=(0,J.useMemo)(()=>ht(...u.map(e=>e.events)),[u]),g=(0,J.useMemo)(()=>c?l:ht(h,m),[c,l,h,m]),v=(0,J.useMemo)(()=>{if(c)return l;let e=s.data?.contextEvents??[],t=s.data?.asOfSeq??0;return ht(e,g.filter(({seq:e})=>e>t))},[s.data,c,l,g]),y=(0,J.useCallback)(async()=>{await o.fetchPreviousPage()},[o.fetchPreviousPage]),S=(0,J.useCallback)(async()=>{await n.resetQueries({queryKey:r,exact:!0})},[r,n]);return{visibleEvents:g,currentEvents:v,isPending:!c&&o.isPending,contextPending:!c&&s.isPending,fallback:c,hasOlder:!c&&!!o.hasPreviousPage,isFetchingOlder:o.isFetchingPreviousPage,olderError:o.isFetchPreviousPageError?o.error instanceof Error?o.error.message:`Could not load earlier items`:void 0,loadOlder:y,jumpToLatest:S,retainedPages:u.length}}var Y=n();function _t({run:e}){let t=_(),n=P({mutationFn:()=>m(e.id),onSuccess:()=>{t.invalidateQueries({queryKey:k.runs.detail(e.id)}),t.invalidateQueries({queryKey:k.runs.list()}),O(`This task will not resume itself`)},onError:e=>O(e.message,{tone:`danger`})});if(e.status!==`failed`||!e.autoResumeAt)return null;let r=new Date(e.autoResumeAt);if(!Number.isFinite(r.getTime()))return null;let i=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(r);return(0,Y.jsxs)(`div`,{"data-slot":`auto-resume-hint`,role:`status`,className:`flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(H,{tone:`pending`,pulse:!0}),(0,Y.jsxs)(`span`,{children:[`Usage limit reached — this task resumes automatically at`,` `,(0,Y.jsx)(`time`,{dateTime:e.autoResumeAt,className:`font-medium text-foreground`,children:i})]}),(0,Y.jsx)(`button`,{type:`button`,"data-action":`auto-resume-cancel`,disabled:n.isPending,onClick:()=>n.mutate(),className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:opacity-50`,children:`Don’t resume`}),(0,Y.jsx)(d,{to:`/settings/global/resources`,"data-slot":`auto-resume-settings-link`,className:`font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground`,children:`Auto-resume settings`})]})}var vt=e=>e.kind===`tool`,yt=e=>(e.toolKind===`read`||e.toolKind===`search`)&&e.status===`completed`,bt=(e,t,n)=>`${e} ${e===1?t:n}`;function xt(e,t){let n=[];return e>0&&n.push(bt(e,`file`,`files`)),t>0&&n.push(bt(t,`search`,`searches`)),`Explored ${n.join(` · `)}`}function St(e){return`${e} earlier tool call${e===1?``:`s`}`}var Ct=[`Web search`,`Ran`,`Edit`,`Write`,`Read`,`Search`,`Fetch`,`Task:`];function wt(e){for(let t of Ct)if(e.startsWith(`${t} `)&&e.length>t.length+1)return{verb:t===`Task:`?`Task`:t,detail:e.slice(t.length+1)};return{verb:e}}function Tt(e){let t=e.filter(e=>!(e.kind===`tool`&&e.toolKind===`plan`)&&!(e.kind===`reasoning`&&e.text.trim()===``)),n=new Set(t.filter(vt).map(e=>e.id)),r=new Map,i=[];for(let e of t){let t=(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&e.parentItemId!==void 0&&e.parentItemId!==e.id&&n.has(e.parentItemId)?e.parentItemId:void 0;if(t===void 0)i.push(e);else{let n=r.get(t);n?n.push(e):r.set(t,[e])}}let a=[],o=[],s=()=>{if(o.length>=2){let e=o.filter(e=>e.toolKind===`read`).length;a.push({kind:`context-group`,id:`group:${o[0].id}`,tools:o,files:e,searches:o.length-e,label:xt(e,o.length-e)})}else for(let e of o)a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]});o=[]};for(let e of i)vt(e)&&yt(e)&&!r.has(e.id)?o.push(e):(s(),vt(e)?a.push({kind:`tool-card`,id:e.id,item:e,children:r.get(e.id)??[]}):a.push({kind:`entry`,id:e.id,entry:e}));s();let c=e=>e.kind===`context-group`||e.kind===`tool-card`&&e.item.status===`completed`,l=e=>e.kind===`context-group`?e.tools.length:1,u=[],d=[],f=()=>{if(d.length>3){let e=d.slice(0,d.length-3);u.push({kind:`streak`,id:`streak:${e[0].id}`,count:e.reduce((e,t)=>e+l(t),0),blocks:e}),u.push(...d.slice(d.length-3))}else u.push(...d);d=[]};for(let e of a)c(e)?d.push(e):(f(),u.push(e));return f(),u}var Et=new Map,Dt=(0,J.createContext)(null);function Ot(){return(0,J.useContext)(Dt)}function kt({runId:e,children:t}){let n=(0,J.useMemo)(()=>({get:t=>Et.get(e)?.get(t),set:(t,n)=>{let r=Et.get(e)??new Map;r.set(t,n),Et.set(e,r)}}),[e]);return(0,Y.jsx)(Dt.Provider,{value:n,children:t})}function X(e){return e.scrollTop<Math.max(600,e.clientHeight)}function At(e,t){let n=t.find(({bottom:t})=>t>e);return n===void 0?void 0:{key:n.key,offset:n.top-e}}function jt(e,t,n,r,i){if(n===void 0)return i;let a=r.find(({key:e})=>e===n.key);return a===void 0?i:e+(a.top-t-n.offset)}function Mt(e,t=24){return e.scrollHeight-e.scrollTop-e.clientHeight<t}function Nt(e,t){let n=new URLSearchParams(e).get(`thread`);return n===`flat`||n===`virtual`?n:t>300?`virtual`:`flat`}var Pt=new Map;function Ft(e,t){Pt.set(e,t)}function It(e){return Pt.get(e)}var Lt=new Map;function Rt(e,t){Lt.set(e,t)}function zt(e,t){let n=Lt.get(e);return n!==void 0&&n.rows===t?n.cache:void 0}function Bt({text:e,imageCount:t=0,images:n=[],onEdit:r,onRemove:i,editLabel:a=`Edit message`,removeLabel:o=`Remove message`}){let s=t-n.length,[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(e),[f,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(),g=()=>{d(e),h(void 0),l(!0)},_=async()=>{let t=u.trim();if(!t||t===e){l(!1);return}p(!0),h(void 0);try{await r?.(t),l(!1)}catch(e){h(e instanceof Error?e.message:`Could not save the message`)}finally{p(!1)}},v=async()=>{p(!0),h(void 0);try{await i?.()}catch(e){h(e instanceof Error?e.message:`Could not remove the message`)}finally{p(!1)}};return c?(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,"data-editing":`true`,className:`max-w-[78%] self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[(0,Y.jsx)(`textarea`,{autoFocus:!0,"aria-label":`Edit the message`,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.stopPropagation(),l(!1)):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),_())},className:`block max-h-[220px] min-h-[60px] w-full resize-none rounded-md bg-background px-2 py-1.5 text-[13.5px] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`}),(0,Y.jsxs)(`span`,{className:`mt-1.5 flex justify-end gap-1.5`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>l(!1),disabled:f,className:`rounded-sm px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-background hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:`Cancel`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void _(),disabled:f,className:`rounded-sm bg-primary px-2 py-1 text-xs font-semibold text-primary-foreground hover:brightness-[0.96] focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:f?(0,Y.jsx)(j,{className:`size-3.5 animate-spin`}):`Save`})]}),m?(0,Y.jsx)(`p`,{role:`alert`,className:`mt-1.5 text-xs text-danger`,children:m}):null]}):(0,Y.jsxs)(`div`,{"data-slot":`user-bubble`,className:`group max-w-[78%] min-w-0 self-end rounded-2xl rounded-br-md bg-muted px-[15px] py-2.5 text-[13.5px] leading-[1.55] md:max-w-[70%]`,children:[r||i?(0,Y.jsxs)(`span`,{"data-slot":`bubble-actions`,className:`mb-1 flex justify-end gap-0.5 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100`,children:[r?(0,Y.jsx)(`button`,{type:`button`,"aria-label":a,onClick:g,disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(st,{className:`size-3.5`})}):null,i?(0,Y.jsx)(`button`,{type:`button`,"aria-label":o,onClick:()=>void v(),disabled:f,className:`rounded-sm p-1 text-soft-foreground hover:bg-background hover:text-danger focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(Fe,{className:`size-3.5`})}):null]}):null,m?(0,Y.jsx)(`p`,{role:`alert`,className:`mb-1 text-xs text-danger`,children:m}):null,(0,Y.jsx)(U,{breaks:!0,children:e}),n.length>0?(0,Y.jsx)(`span`,{"data-slot":`user-images`,className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:n.map(e=>(0,Y.jsx)(qe,{src:e,alt:`attached`,className:`max-h-40 max-w-[220px] rounded-md border border-border object-contain`},e))}):null,s>0?(0,Y.jsxs)(`span`,{className:`mt-1 block text-xs text-soft-foreground`,children:[s,` image`,s>1?`s`:``,` attached`]}):null]})}function Vt({text:e}){return(0,Y.jsx)(`div`,{"data-slot":`assistant-message`,className:`min-w-0 text-[15px] leading-[1.65]`,children:(0,Y.jsx)(U,{children:e})})}function Ht({note:e}){return(0,Y.jsxs)(`div`,{"data-slot":`note-line`,"data-tone":e.tone,className:I(`px-0.5 text-xs`,e.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[e.tone===`danger`?`✗ `:`· `,e.text]})}var Ut={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`};function Wt({incident:e}){let t=Ut[e.provider];return(0,Y.jsxs)(`div`,{role:`alert`,"data-slot":`provider-auth-required`,className:`rounded-md border border-danger/30 bg-danger/5 px-3.5 py-3`,children:[(0,Y.jsxs)(`p`,{className:`text-[13px] font-semibold text-foreground`,children:[`This run needed `,t,` authorization`]}),(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Review `,t,` settings before retrying.`]}),(0,Y.jsx)(V,{to:`/settings/agents#providers`,className:`mt-2 inline-flex text-xs font-medium text-foreground underline-offset-2 hover:underline`,children:`Open provider settings`})]})}function Gt({text:e}){let t=(0,J.useId)();if(e.trim()===``)return null;let n=e.split(`
|
|
2
|
+
`,1)[0]??``,r=n.length<e.length;return(0,Y.jsxs)(We,{"data-slot":`reasoning`,className:`group/reasoning min-w-0`,children:[(0,Y.jsxs)(`div`,{id:t,className:`relative flex w-full items-center gap-1.5 rounded-md p-0.5 text-left text-[13px] text-soft-foreground hover:text-muted-foreground`,children:[(0,Y.jsx)(R,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]/reasoning:rotate-90`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Thinking — `}),(0,Y.jsx)(`div`,{className:`min-w-0 truncate text-muted-foreground`,children:(0,Y.jsx)(U,{inline:!0,children:n})}),r?(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`…`}):null,(0,Y.jsx)(B,{"aria-labelledby":t,className:`absolute inset-0 rounded-md focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`})]}),(0,Y.jsx)(z,{children:(0,Y.jsx)(`div`,{className:`px-6 py-1.5 text-[13px] leading-[1.6] text-soft-foreground`,children:(0,Y.jsx)(U,{children:e})})})]})}function Kt(){return(0,Y.jsxs)(`div`,{"data-slot":`working-indicator`,className:`flex items-center gap-2 py-1 text-[13px] text-soft-foreground`,children:[(0,Y.jsx)(j,{role:`status`,"aria-label":`Working`,className:`size-3.5 shrink-0 animate-spin`}),(0,Y.jsx)(`span`,{className:`shimmer font-medium`,children:`Working…`})]})}var qt={read:Ee,edit:st,delete:Fe,move:it,search:Le,execute:He,think:nt,fetch:le,task:L,plan:at,other:ct},Jt=e=>e.split(`
|
|
3
|
+
`).length;function Yt({text:e,streaming:t}){let[n,r]=(0,J.useState)(!1),i=(0,J.useRef)(null),a=(0,J.useRef)(!0);(0,J.useEffect)(()=>{let e=i.current;t&&e&&a.current&&(e.scrollTop=e.scrollHeight)},[e,t]);let o=Jt(e),s=!t&&!n&&o>12;return(0,Y.jsxs)(`div`,{"data-slot":`tool-output`,"data-clamped":s?`true`:void 0,children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(`div`,{ref:i,onScroll:t?e=>{a.current=Mt(e.currentTarget)}:void 0,className:I(`overflow-x-auto`,t&&`max-h-[216px] overflow-y-auto`,s&&`max-h-[216px] overflow-y-hidden`),children:(0,Y.jsx)(`pre`,{className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre text-muted-foreground`,children:e})}),s?(0,Y.jsx)(`div`,{"data-slot":`tool-output-fade`,"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 h-14 bg-gradient-to-b from-transparent to-card-2`}):null]}),!t&&o>12?(0,Y.jsx)(`button`,{type:`button`,"data-slot":`tool-output-toggle`,onClick:()=>r(e=>!e),className:`block w-full border-t border-border/50 px-4 py-1.5 text-left text-[11px] font-medium text-soft-foreground hover:text-foreground`,children:n?`Show less`:`Show all ${o} lines`}):null]})}function Xt({diffs:e}){return(0,Y.jsx)(Y.Fragment,{children:e.map((e,t)=>(0,Y.jsxs)(`div`,{"data-slot":`diff-preview`,className:`min-w-0`,children:[(0,Y.jsx)(`div`,{className:`border-b border-border/50 px-4 py-1.5 font-mono text-[11px] text-soft-foreground`,children:e.path}),(0,Y.jsx)(`pre`,{className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7] whitespace-pre`,children:e.unified===void 0?[...Zt(e.oldText).map((e,t)=>(0,Y.jsxs)(`span`,{className:`block bg-diff-del px-4 text-muted-foreground`,children:[`- `,e]},`old-${t}`)),...Zt(e.newText).map((e,t)=>(0,Y.jsxs)(`span`,{className:`block bg-diff-add px-4`,children:[`+ `,e]},`new-${t}`))]:e.unified.split(`
|
|
4
|
+
`).map((e,t)=>(0,Y.jsx)(Qt,{text:e},t))})]},`${e.path}:${t}`))})}function Zt(e){return e==null||e===``?[]:e.replace(/\n$/,``).split(`
|
|
5
|
+
`)}function Qt({text:e}){return(0,Y.jsx)(`span`,{className:I(`block px-4`,e.startsWith(`+`)&&`bg-diff-add`,e.startsWith(`-`)&&`bg-diff-del text-muted-foreground`,e.startsWith(`@@`)&&`text-soft-foreground`),children:e})}function $t(e){return e.toolKind===`execute`&&e.status===`running`&&e.output!==void 0}function en({item:e,nested:t=[],cacheKey:n,renderNested:r}){let i=Ot(),[a,o]=(0,J.useState)(()=>n===void 0?null:i?.get(n)??null),s=e=>{n!==void 0&&i?.set(n,e),o(e)},c=e.status===`running`||e.status===`pending`,l=e.output!==void 0&&e.output!==``||e.error!==void 0&&e.error!==``||e.diffs!==void 0&&e.diffs.length>0||t.length>0,u=l&&(a??$t(e)),{verb:d,detail:f}=wt(e.title),p=qt[e.toolKind]??ct;return(0,Y.jsxs)(We,{"data-slot":`tool-card`,"data-status":e.status,"data-kind":e.toolKind,open:u,onOpenChange:s,className:I(`min-w-0 overflow-hidden rounded-md border bg-card`,e.status===`failed`?`border-danger/25`:`border-border`),children:[(0,Y.jsxs)(B,{disabled:!l,className:`group flex min-h-[28px] w-full items-center gap-1.5 px-2.5 py-0.5 text-left text-[13px] enabled:hover:bg-muted`,children:[(0,Y.jsx)(R,{"aria-hidden":!0,className:I(`size-3 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`,!l&&`invisible`)}),(0,Y.jsx)(p,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:I(`shrink-0 font-semibold`,c&&`shimmer`,e.status===`declined`&&`text-muted-foreground`),children:d}),f===void 0?null:(0,Y.jsx)(`code`,{className:`min-w-0 truncate font-mono text-xs text-muted-foreground`,children:f}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-2 pl-2`,children:[c?(0,Y.jsx)(j,{role:`status`,"aria-label":`Running`,className:`size-3.5 animate-spin text-soft-foreground`}):null,e.status===`failed`?(0,Y.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`failed`}):null,e.status===`declined`?(0,Y.jsx)(`span`,{className:`text-xs text-soft-foreground`,children:`declined`}):null,e.toolKind===`execute`&&typeof e.exitCode==`number`?(0,Y.jsx)(`span`,{"data-slot":`tool-exit`,className:I(`rounded-full px-2 py-px font-mono text-[10.5px] font-semibold`,e.exitCode===0?`bg-success/10 text-success`:`bg-danger/10 text-danger`),children:e.exitCode}):null]})]}),(0,Y.jsx)(z,{children:(0,Y.jsxs)(`div`,{className:`border-t border-border bg-card-2`,children:[e.error!==void 0&&e.error!==``?(0,Y.jsx)(`div`,{"data-slot":`tool-error`,className:`px-4 py-3 font-mono text-xs leading-[1.7] whitespace-pre-wrap text-danger`,children:e.error}):null,e.diffs!==void 0&&e.diffs.length>0?(0,Y.jsx)(Xt,{diffs:e.diffs}):null,e.output!==void 0&&e.output!==``?(0,Y.jsx)(Yt,{text:e.output,streaming:c}):null,t.length>0?(0,Y.jsx)(`div`,{"data-slot":`tool-nested`,className:`flex flex-col gap-2 border-l-2 border-border py-2.5 pr-3 pl-3 ml-4 my-2`,children:r?.(t,n??e.id)}):null]})})]})}function tn({group:e,scope:t}){return(0,Y.jsxs)(We,{"data-slot":`ctx-group`,className:`min-w-0`,children:[(0,Y.jsxs)(B,{className:`group flex h-[34px] w-full items-center gap-2 rounded-md px-2 -mx-2 text-left text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(R,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground transition-transform group-data-[state=open]:rotate-90`}),e.label]}),(0,Y.jsx)(z,{children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-1.5 pt-1.5 pl-4`,children:e.tools.map(e=>(0,Y.jsx)(en,{item:e,cacheKey:t===void 0?void 0:`${t}:${e.id}`},e.id))})})]})}function nn({count:e,children:t}){return(0,Y.jsxs)(We,{"data-slot":`tool-streak`,className:`min-w-0`,children:[(0,Y.jsxs)(B,{className:`group flex items-center gap-1.5 rounded-md p-0.5 text-left text-xs text-soft-foreground hover:text-muted-foreground`,children:[(0,Y.jsx)(R,{"aria-hidden":!0,className:`size-3.5 shrink-0 transition-transform group-data-[state=open]:rotate-90`}),St(e)]}),(0,Y.jsx)(z,{children:(0,Y.jsx)(`div`,{className:`flex flex-col gap-2 pt-2`,children:t})})]})}function rn({image:e}){return(0,Y.jsx)(qe,{"data-slot":`thread-image`,src:e.url,alt:e.name??`image from the agent session`,className:`max-h-72 max-w-full self-start rounded-lg border border-border`})}function an(e){let t=_(),n=we(e).continueRun,r=N(),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),l=ke(e,a),{runners:u,canContinue:d,currentRunner:f,runner:p}=l,m=i(p,n),h=r.data?.modelsLocked===!0,g=!h&&p===f&&e.model?{...r.data?.defaultModels,[p]:e.model}:r.data?.defaultModels,v=h?null:s,y=be(p,m.data,[v,g?.[p]]),b=Se(v,p,g,m.data),x=P({mutationFn:({text:t,images:n})=>d?A(e.id,{text:t.trim()?t:void 0,images:n.length?n:void 0,runner:l.runnerOverride,model:!h&&s!==null?b:void 0}):Promise.reject(Error(l.reason??`Connect an agent provider to continue.`)),onSuccess:()=>t.invalidateQueries({queryKey:k.runs.all})});return{available:n,canContinue:d,reason:l.reason,providerPending:l.providerPending,pills:(0,Y.jsxs)(`div`,{"data-slot":`follow-up-engine`,className:`flex flex-wrap items-center gap-1.5`,children:[u.length>1?(0,Y.jsx)(Be,{runners:u,value:p,onPick:e=>{o(e),c(null)}}):null,(0,Y.jsx)(ze,{slot:`follow-up-model-pill`,ariaLabel:`Model`,label:y.find(e=>e.id===b)?.label??`auto`,value:b,readOnly:h,disabledHint:`Model selection is locked to native coding-agent settings.`,onPick:e=>c(e),options:y.map(e=>({value:e.id,label:e.label,desc:e.desc})),status:xe(p,m.data,m.isError)})]}),continueWith:(e,t)=>x.mutateAsync({text:e,images:t})}}var on=120,sn=e=>e!==`pending`&&e!==`running`,cn=e=>e.kind===`tool`&&e.toolKind===`task`,Z=e=>cn(e)&&e.parentItemId===void 0,ln=e=>(e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`)&&!(e.kind===`tool`&&e.toolKind===`plan`);function un(e,t){for(let n=0;n<e.length;n+=1)if(e[n].items.some(e=>Z(e)&&t.has(e.id)))return n;return 0}function dn(e){let t=e.input;if(typeof t!=`object`||!t)return;let n=t;for(let e of[`subagent_type`,`subagentType`,`agent`]){let t=n[e];if(typeof t==`string`&&t.trim()!==``)return t.trim()}}function fn(e){if(e.kind===`tool`)return pn(e.title);if(e.kind===`message`||e.kind===`reasoning`){let t=e.text.split(`
|
|
6
|
+
`);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n!==``)return pn(n)}}}function pn(e){return e.length>on?`${e.slice(0,on-1).trimEnd()}…`:e}function mn(e,t=!1){let n=yn(e,e=>e.items.some(Z));if(n===-1)return[];let r=e=>!t&&!sn(e.status),i=[];for(let t=n-1;t>=0;--t){let n=e[t].items.filter(Z);if(n.length!==0){if(!n.some(r))break;i.unshift(...n)}}let a=[...i,...e[n].items.filter(Z)];if(n!==e.length-1&&!a.some(r))return[];let o=new Set(a.map(e=>e.id)),s=i.length>0?un(e,o):n,c=new Map;for(let t=s;t<e.length;t+=1)for(let n of e[t].items){if(!ln(n))continue;let e=n.parentItemId;if(e===void 0||!o.has(e))continue;let t=c.get(e);t?t.push(n):c.set(e,[n])}return a.map(e=>hn(e,c.get(e.id)??[],t))}function hn(e,t,n){let r={id:e.id,title:wt(e.title).detail??e.title,status:e.status,toolCalls:t.filter(e=>e.kind===`tool`).length},i=dn(e);i!==void 0&&(r.agentType=i),n&&!sn(e.status)&&(r.stalled=!0);for(let e=t.length-1;e>=0;--e){let n=fn(t[e]);if(n!==void 0){r.activity=n;break}}return r}function gn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.length}}function _n(e){return e.activity??(e.stalled===!0?`never finished`:`starting…`)}function vn(e){return e.find(e=>!sn(e.status))??e[0]}function yn(e,t){for(let n=e.length-1;n>=0;--n)if(t(e[n]))return n;return-1}function bn(e,t,n=!1){for(let r=e.length-1;r>=0;--r){let i=e[r].items.find(e=>e.id===t&&Z(e));if(i!==void 0)return hn(i,xn(e,t),n)}}function xn(e,t){let n=e.findIndex(e=>e.items.some(e=>e.id===t&&Z(e)));if(n===-1)return[];let r=[];for(let i=n;i<e.length;i+=1)for(let n of e[i].items)ln(n)&&n.parentItemId===t&&n.id!==t&&r.push(n);return r}var Sn=new Map,Cn=!1;function wn({runId:e,agents:t,onSelect:n}){let[r,i]=(0,J.useState)(()=>Sn.get(e)??Cn);if(t.length===0)return null;let{done:a,total:o}=gn(t),s=vn(t);return(0,Y.jsxs)(`section`,{"data-slot":`agents-dock`,"data-state":r?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,Y.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>i(t=>(Sn.set(e,!t),!t)),"aria-expanded":r,className:I(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,r?`pt-2 pb-1.5`:`py-2`),children:[(0,Y.jsx)(L,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-soft-foreground`}),(0,Y.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Agents`}),(0,Y.jsxs)(`span`,{"data-slot":`agents-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,a,`/`,o]}),!r&&s!==void 0?(0,Y.jsxs)(`span`,{"data-slot":`agents-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,_n(s)]}):null,(0,Y.jsx)(ye,{"aria-hidden":!0,className:I(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!r&&`rotate-180`)})]}),r?(0,Y.jsx)(`ul`,{"data-slot":`agents-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map(e=>(0,Y.jsx)(Tn,{agent:e,onSelect:n},e.id))}):null]})}function Tn({agent:e,onSelect:t}){let n=(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(En,{status:e.status,stalled:e.stalled===!0}),(0,Y.jsx)(`span`,{className:`min-w-0 shrink truncate font-medium`,children:e.title}),e.agentType===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:e.agentType}),(0,Y.jsx)(`span`,{"data-slot":`agent-activity`,className:`min-w-0 flex-1 truncate text-muted-foreground`,children:_n(e)}),(0,Y.jsxs)(`span`,{"data-slot":`agent-tools`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[e.toolCalls,` `,e.toolCalls===1?`tool`:`tools`]})]});return(0,Y.jsx)(`li`,{"data-slot":`agent-item`,"data-status":e.status,className:`min-w-0 text-[13px]`,children:t?(0,Y.jsx)(`button`,{type:`button`,onClick:()=>t(e.id),"aria-haspopup":`dialog`,className:`flex min-h-5 w-full min-w-0 items-center gap-2.5 rounded-sm text-left hover:bg-muted/50`,children:n}):(0,Y.jsx)(`div`,{className:`flex min-h-5 min-w-0 items-center gap-2.5`,children:n})})}function En({status:e,stalled:t=!1}){return t?(0,Y.jsx)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,"data-stalled":`true`,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeDasharray:`3 2.5`,children:(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})}):e===`completed`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Y.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`failed`||e===`declined`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 text-danger`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Y.jsx)(`path`,{d:`m9 9 6 6M15 9l-6 6`})]}):(0,Y.jsxs)(`svg`,{"aria-hidden":!0,"data-slot":`agent-glyph`,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,Y.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Y.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]})}var Dn=new Map;function On(){return typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches}function kn(e){return{done:e.filter(e=>e.status===`completed`).length,total:e.filter(e=>e.status!==`cancelled`).length}}function An(e){return e.find(e=>e.status===`in_progress`)??e.find(e=>e.status===`pending`)}function jn({runId:e,entries:t}){let[n,r]=(0,J.useState)(()=>Dn.get(e)??On());if(t.length===0)return null;let{done:i,total:a}=kn(t),o=An(t);return(0,Y.jsxs)(`section`,{"data-slot":`plan-dock`,"data-state":n?`open`:`collapsed`,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card shadow-xs`,children:[(0,Y.jsx)(`div`,{"aria-hidden":!0,"data-slot":`grad-edge`,className:`h-[3px]`,style:{background:`var(--grad)`}}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r(t=>(Dn.set(e,!t),!t)),"aria-expanded":n,className:I(`flex w-full items-center gap-2 px-3.5 text-left text-[13px]`,n?`pt-2 pb-1.5`:`py-2`),children:[(0,Y.jsx)(`span`,{className:`shrink-0 font-semibold`,children:`Plan`}),(0,Y.jsxs)(`span`,{"data-slot":`plan-count`,className:`shrink-0 text-muted-foreground tabular-nums`,children:[`· `,i,`/`,a]}),!n&&o!==void 0?(0,Y.jsxs)(`span`,{"data-slot":`plan-current`,className:`min-w-0 truncate text-muted-foreground`,children:[`— `,o.activeForm??o.content]}):null,(0,Y.jsx)(ye,{"aria-hidden":!0,className:I(`ml-auto size-3.5 shrink-0 text-soft-foreground transition-transform`,!n&&`rotate-180`)})]}),n?(0,Y.jsx)(`ul`,{"data-slot":`plan-list`,className:`flex flex-col gap-[7px] px-3.5 pb-3`,children:t.map((e,t)=>(0,Y.jsx)(Mn,{entry:e},`${t}:${e.content}`))}):null]})}function Mn({entry:e}){return(0,Y.jsxs)(`li`,{"data-slot":`plan-item`,"data-status":e.status,className:I(`flex min-h-5 min-w-0 items-center gap-2.5 text-[13px]`,e.status===`completed`&&`text-soft-foreground line-through`,e.status===`in_progress`&&`font-medium`,e.status===`pending`&&`text-muted-foreground`,e.status===`cancelled`&&`text-soft-foreground/70 line-through`),children:[(0,Y.jsx)(Nn,{status:e.status}),(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:e.content}),e.status===`in_progress`?(0,Y.jsx)(`span`,{"data-slot":`plan-tag`,className:`ml-auto shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:`in progress`}):null]})}function Nn({status:e}){return e===`cancelled`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground/70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`,opacity:`.5`}),(0,Y.jsx)(`path`,{d:`m8.5 15.5 7-7`})]}):e===`completed`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-success`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`,opacity:`.35`}),(0,Y.jsx)(`path`,{d:`m8.5 12.2 2.4 2.4 4.6-5`})]}):e===`in_progress`?(0,Y.jsxs)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 animate-pulse motion-reduce:animate-none`,viewBox:`0 0 24 24`,fill:`none`,children:[(0,Y.jsx)(`circle`,{className:`stroke-pending`,cx:`12`,cy:`12`,r:`8.5`,strokeWidth:`2`}),(0,Y.jsx)(`path`,{className:`fill-pending`,d:`M12 3.5 A8.5 8.5 0 0 1 12 20.5 Z`})]}):(0,Y.jsx)(`svg`,{"aria-hidden":!0,className:`size-[15px] shrink-0 text-soft-foreground`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,Y.jsx)(`circle`,{cx:`12`,cy:`12`,r:`8.5`})})}function Pn(e,t={}){let{surface:n=`document`,onLoadOlder:r,onJumpToLatest:i,rowKeys:a=[]}=t,o=(0,J.useRef)(null),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(0,J.useRef)(!0),f=(0,J.useRef)(null),p=(0,J.useRef)(null),m=(0,J.useRef)(null),h=(0,J.useCallback)(e=>{let t=o.current;if(!t)return;let n=m.current;n?n.scrollTo(e):t.scrollTop=e},[]),g=(0,J.useCallback)(()=>{let e=o.current;e&&h(e.scrollHeight-e.clientHeight)},[h]),_=(0,J.useCallback)(()=>{if(o.current){if(p.current!==e){p.current=e;let t=It(e);t&&!t.atBottom?(d.current=!1,f.current=t.top):(d.current=!0,f.current=null)}f.current===null?d.current&&g():h(f.current)}},[e,h,g]),v=(0,J.useCallback)(e=>{c(e),e&&(o.current=e.closest(n===`panel`?`[data-slot="transcript-viewport"]`:`[data-slot="main"]`),_())},[n,_]),y=(0,J.useCallback)(()=>{d.current&&g()},[g]),b=(0,J.useRef)(!1),x=(0,J.useRef)(!1),S=(0,J.useRef)(void 0),C=(0,J.useRef)(!1),w=(0,J.useRef)(!1),T=(0,J.useRef)(a);T.current=a;let E=(0,J.useCallback)(e=>[...e.querySelectorAll(`[data-slot="thread-row"][data-row-key]`)].map(e=>{let t=e.getBoundingClientRect();return{key:e.dataset.rowKey,top:t.top,bottom:t.bottom}}),[]),D=(0,J.useCallback)(()=>{let e=o.current;if(!e||!r||b.current)return;b.current=!0;let t=e.scrollHeight,n=e.scrollTop,i=e.getBoundingClientRect().top,a=At(i,E(e));r().finally(()=>{requestAnimationFrame(()=>{let e=o.current;if(e){let r=n+Math.max(0,e.scrollHeight-t),i=e.getBoundingClientRect().top,o=a===void 0?-1:T.current.indexOf(a.key),s=m.current;s&&o>=0?s.scrollToIndex(o,{align:`start`,offset:-a.offset}):h(jt(e.scrollTop,i,a,E(e),r))}b.current=!1})})},[E,r,h]);(0,J.useEffect)(()=>()=>clearTimeout(S.current),[]);let O=(0,J.useCallback)(()=>{o.current&&(f.current=null,d.current=!0,(i?.()??Promise.resolve()).finally(()=>{requestAnimationFrame(()=>{let e=o.current;e?.scrollTo({top:e.scrollHeight-e.clientHeight,behavior:`smooth`})})}))},[i]);return(0,J.useLayoutEffect)(()=>{!o.current||!s||_()},[s,_]),(0,J.useEffect)(()=>{let t=o.current,n=s;if(!t||!n)return;let r=0,i=null,a=!1,c=t.scrollTop,l=()=>{f.current=null,d.current=!1,r=0},p=()=>{r=Date.now()},m=e=>{if(e.deltaY<0){l();let e=!x.current;x.current=!0,clearTimeout(S.current),S.current=setTimeout(()=>{x.current=!1},180),e&&X(t)&&D()}else p()},_=e=>{[`ArrowUp`,`PageUp`,`Home`].includes(e.key)?(l(),!e.repeat&&X(t)&&D()):[`ArrowDown`,`PageDown`,`End`].includes(e.key)&&p()},v=()=>{a=!0,w.current=!1,c=t.scrollTop,Mt(t,80)||(l(),p())},y=()=>{a=!1},b=e=>{C.current=!1,i=e.touches[0]?.clientY??null},T=e=>{let n=e.touches[0]?.clientY;n!==void 0&&(i!==null&&n>i+1?(l(),!C.current&&X(t)&&(C.current=!0,D())):i!==null&&n<i-1&&p(),i=n)},E=()=>{a&&!w.current&&t.scrollTop<c&&X(t)&&(w.current=!0,D()),c=t.scrollTop;let n=Mt(t,80);n&&f.current===null&&(d.current||Date.now()-r<2e3)&&(d.current=!0),u(!n),f.current===null&&Ft(e,{top:t.scrollTop,atBottom:n})};t.addEventListener(`scroll`,E,{passive:!0}),t.addEventListener(`wheel`,m,{passive:!0}),t.addEventListener(`touchstart`,b,{passive:!0}),t.addEventListener(`touchmove`,T,{passive:!0}),t.addEventListener(`pointerdown`,v,{passive:!0}),window.addEventListener(`pointerup`,y,{passive:!0}),t.addEventListener(`keydown`,_);let O;return typeof ResizeObserver<`u`&&(O=new ResizeObserver(()=>{let e=f.current;if(e!==null){let n=t.scrollHeight-t.clientHeight;h(Math.min(e,n)),n>=e&&(f.current=null)}else d.current&&g()}),O.observe(n)),()=>{t.removeEventListener(`scroll`,E),t.removeEventListener(`wheel`,m),t.removeEventListener(`touchstart`,b),t.removeEventListener(`touchmove`,T),t.removeEventListener(`pointerdown`,v),window.removeEventListener(`pointerup`,y),t.removeEventListener(`keydown`,_),O?.disconnect()}},[e,s,D,h,g]),{attachContent:v,scrollElRef:o,virtualizerRef:m,pillVisible:l,jumpToLatest:O,loadOlder:D,restickIfStuck:y}}function Fn({runId:e,rows:t,mode:n,controls:r}){return n===`virtual`?(0,Y.jsx)(In,{runId:e,rows:t,controls:r}):(0,Y.jsx)(`div`,{ref:r.attachContent,"data-slot":`thread-rows`,"data-virtualized":`false`,children:t.map(e=>(0,Y.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5 [contain-intrinsic-block-size:auto_3rem] [content-visibility:auto]`,children:e.node},e.key))})}function In({runId:e,rows:t,controls:n}){let r=(0,J.useRef)(null),[i]=(0,J.useState)(()=>zt(e,t.length)),a=(0,J.useRef)(t.length);a.current=t.length;let o=(0,J.useRef)(null),s=(0,J.useCallback)(t=>{n.virtualizerRef.current=t,t?o.current=t:o.current&&=(Rt(e,{rows:a.current,cache:o.current.cache}),null)},[e,n.virtualizerRef]),[c,l]=(0,J.useState)(0);return(0,J.useLayoutEffect)(()=>{let e=()=>{let e=r.current,t=n.scrollElRef.current;!e||!t||l(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[n.scrollElRef]),(0,Y.jsx)(`div`,{ref:e=>{r.current=e,n.attachContent(e)},"data-slot":`thread-rows`,"data-virtualized":`true`,children:(0,Y.jsx)(Ke,{ref:s,scrollRef:n.scrollElRef,startMargin:c,...i===void 0?{}:{cache:i},children:t.map(e=>(0,Y.jsx)(`div`,{"data-slot":`thread-row`,"data-row-key":e.key,className:`flex w-full flex-col pb-2.5`,children:e.node},e.key))})})}function Ln({onJump:e}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`jump-to-latest`,onClick:e,className:`pointer-events-auto inline-flex min-h-8 items-center gap-1.5 rounded-full border border-border bg-background px-3.5 text-xs font-medium text-muted-foreground shadow-modal hover:text-foreground`,children:[(0,Y.jsx)(de,{"aria-hidden":!0,className:`size-3.5`}),`Jump to latest`]})}function Rn(e,t){let n=[];e.task&&n.push({id:`task`,userMessageKey:`task`,userMessage:{text:e.task,images:e.taskImages??[]},entries:[]});for(let t of e.queuedMessages??[])n.push({id:`queued:${t.id}`,userMessageKey:`queued:${t.id}`,userMessage:{text:t.text,images:t.images??[]},entries:[]});for(let e of t.turns)n.push({id:e.id,userMessageKey:`${e.id}:user`,...e.userMessage===void 0?{}:{userMessage:{text:e.userMessage.text,imageCount:e.userMessage.imageCount,images:e.userMessage.images}},entries:e.items});return n}function zn(e,t){return[{id:`agent:${e}`,entries:t}]}function Bn(e,t){let n=[];for(let t of e){t.userMessage!==void 0&&n.push({key:t.userMessageKey??`${t.id}:user`,scope:t.id,content:{kind:`user-message`,message:t.userMessage}});for(let e of Tt([...t.entries]))n.push({key:`${t.id}:${e.id}`,scope:t.id,content:{kind:`block`,block:e}})}return n}function Vn({runId:e,viewId:t,sections:n,mode:r,empty:i,renderAsk:a,messageActions:o,scrollControls:s,renderMode:c}){let l=(0,J.useMemo)(()=>Bn(n,e),[n,e]),u=Pn(`${e}:${t}`,{surface:r}),d=s??u,f=(0,J.useMemo)(()=>l.map(e=>({key:e.key,node:e.content.kind===`user-message`?(0,Y.jsx)(Hn,{message:e.content.message,actions:o?.[e.key]}):(0,Y.jsx)(Un,{block:e.content.block,scope:e.scope,renderAsk:a})})),[o,a,l]),p=c??Nt(``,f.length),m=f.length===0?i??null:(0,Y.jsx)(Fn,{runId:`${e}:${t}`,rows:f,mode:p,controls:d});return(0,Y.jsx)(kt,{runId:e,children:r===`panel`?(0,Y.jsxs)(`div`,{"data-slot":`transcript-viewport`,"aria-label":`Agent transcript`,role:`region`,tabIndex:0,className:`relative flex min-h-0 flex-1 flex-col overflow-y-auto [scrollbar-gutter:stable]`,children:[(0,Y.jsx)(`div`,{"data-slot":`subagent-stream`,className:`flex flex-col px-5 py-4`,children:m}),d.pillVisible?(0,Y.jsx)(`div`,{className:`pointer-events-none sticky inset-x-0 bottom-4 flex justify-center`,children:(0,Y.jsx)(Ln,{onJump:d.jumpToLatest})}):null]}):m})}function Hn({message:e,actions:t}){return(0,Y.jsx)(Bt,{text:e.text,imageCount:e.imageCount,images:e.images,onEdit:t?.onEdit,onRemove:t?.onRemove,editLabel:t?.editLabel,removeLabel:t?.removeLabel})}function Un({block:e,scope:t,renderAsk:n}){switch(e.kind){case`entry`:return(0,Y.jsx)(Gn,{entry:e.entry,scope:t,renderAsk:n});case`tool-card`:return(0,Y.jsx)(en,{item:e.item,nested:e.children,cacheKey:`${t}:${e.id}`,renderNested:(e,t)=>(0,Y.jsx)(Wn,{entries:e,scope:t,renderAsk:n})});case`context-group`:return(0,Y.jsx)(tn,{group:e,scope:t});case`streak`:return(0,Y.jsx)(nn,{count:e.count,children:e.blocks.map(e=>(0,Y.jsx)(Un,{block:e,scope:t,renderAsk:n},e.id))});default:return Kn(e)}}function Wn({entries:e,scope:t,renderAsk:n}){return Tt([...e]).map(e=>(0,Y.jsx)(Un,{block:e,scope:t,renderAsk:n},e.id))}function Gn({entry:e,scope:t,renderAsk:n}){switch(e.kind){case`message`:return e.role===`assistant`?(0,Y.jsx)(Vt,{text:e.text}):(0,Y.jsx)(Bt,{text:e.text});case`reasoning`:return(0,Y.jsx)(Gt,{text:e.text});case`tool`:return(0,Y.jsx)(en,{item:e,cacheKey:`${t}:${e.id}`});case`note`:return(0,Y.jsx)(Ht,{note:e});case`image`:return(0,Y.jsx)(rn,{image:e});case`ask`:return n===void 0?(0,Y.jsx)(`div`,{"data-slot":`ask-card`,className:`rounded-lg border border-border bg-card px-4 py-3 text-sm`,children:`The agent asked a question. Open the main session to answer it.`}):n(e);case`provider-auth-required`:return(0,Y.jsx)(Wt,{incident:e});default:return Kn(e)}}function Kn(e){throw Error(`Unhandled transcript variant: ${JSON.stringify(e)}`)}function qn({runId:e,renderAsk:t,agent:n,entries:r,onClose:i}){return(0,Y.jsx)(pe,{open:n!==void 0,onOpenChange:e=>{e||i()},children:(0,Y.jsx)(ge,{"data-slot":`subagent-sheet`,side:`right`,className:`flex min-h-0 w-full gap-0 p-0 sm:max-w-xl`,children:n===void 0?null:(0,Y.jsx)(Jn,{runId:e,renderAsk:t,agent:n,entries:r})})})}function Jn({runId:e,renderAsk:t,agent:n,entries:r}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(fe,{className:`gap-1.5 border-b border-border px-5 py-4`,children:[(0,Y.jsxs)(me,{className:`flex min-w-0 items-center gap-2 pr-8 text-[15px]`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 truncate`,children:n.title}),n.agentType===void 0?null:(0,Y.jsx)(`span`,{"data-slot":`agent-type`,className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] text-muted-foreground uppercase`,children:n.agentType})]}),(0,Y.jsxs)(_e,{"data-slot":`subagent-meta`,className:`flex items-center gap-2 text-xs`,children:[(0,Y.jsx)(Yn,{status:n.status}),(0,Y.jsxs)(`span`,{className:`tabular-nums`,children:[n.toolCalls,` `,n.toolCalls===1?`tool call`:`tool calls`]})]})]}),(0,Y.jsx)(Vn,{runId:e,viewId:`agent:${n.id}`,sections:zn(n.id,r),mode:`panel`,renderAsk:t,empty:(0,Y.jsx)(`div`,{"data-slot":`subagent-empty`,className:`py-2 text-[13px] text-muted-foreground`,children:`No attributed output — see the thread card for this agent's result.`})})]})}function Yn({status:e}){let t=e===`completed`?`Completed`:e===`failed`?`Failed`:e===`declined`?`Declined`:e===`pending`?`Pending`:`Running`;return(0,Y.jsx)(`span`,{"data-slot":`subagent-status`,"data-status":e,className:I(`rounded-full px-2 py-0.5 text-[10.5px] font-semibold tracking-[0.05em] uppercase`,e===`completed`&&`bg-success/15 text-success`,(e===`failed`||e===`declined`)&&`bg-danger/15 text-danger`,(e===`running`||e===`pending`)&&`bg-muted text-muted-foreground`),children:t})}function Xn({run:e}){return(0,Y.jsxs)(`section`,{"data-slot":`review-panel`,"aria-label":`Review the changes`,className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{"data-slot":`review-banner`,className:`flex items-center gap-2.5 rounded-md border border-violet/30 bg-violet/10 px-3.5 py-2.5`,children:[(0,Y.jsx)(Ie,{className:`size-4 shrink-0 text-violet`,"aria-hidden":`true`}),(0,Y.jsxs)(`p`,{className:`min-w-0 text-[13px]`,children:[(0,Y.jsx)(`span`,{className:`font-semibold`,children:`Review the changes before anything lands.`}),` `,(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:`Read the diff, send notes back, draft a PR — or accept. Nothing merges on its own.`})]})]}),(0,Y.jsx)(Je,{runId:e.id}),(0,Y.jsx)(Zn,{run:e})]})}function Zn({run:e}){let t=_(),n=(0,J.useRef)(null),[i,a]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),l=De(e.id),u=ke(e),d=()=>t.invalidateQueries({queryKey:k.runs.all}),f=P({mutationFn:async t=>u.canContinue?A(e.id,{text:`Review feedback:\n${t}`,runner:u.runnerOverride}):null,onSuccess:e=>{e!==null&&(a(``),d())},onError:e=>O(e.message,{tone:`danger`})}),p=P({mutationFn:()=>o(e.id),onSuccess:e=>{O(`Draft PR created — ${e.url}`),d()},onError:e=>{e instanceof T&&e.manual!==void 0&&c(e.manual),O(e.message,{tone:`danger`})}}),m=()=>{let e=i.trim();if(e.length===0){O(`Write what to change first.`),n.current?.focus();return}f.mutate(e)};return(0,Y.jsxs)(`div`,{"data-slot":`review-actions`,className:`flex flex-col gap-2`,children:[(0,Y.jsx)(Ue,{ref:n,"data-slot":`review-notes`,"aria-label":`Notes for the agent`,placeholder:`Notes for the agent — what should change?`,rows:2,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{Ge({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),m())},className:`min-h-[52px] text-[13px]`}),u.canContinue?null:(0,Y.jsxs)(`p`,{id:`review-provider-guidance`,className:`flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:u.reason}),u.providerPending?null:(0,Y.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsxs)(C,{"data-slot":`review-send-back`,variant:`outline`,size:`sm`,title:u.reason??`Send the notes back into the agent's session`,"aria-describedby":u.canContinue?void 0:`review-provider-guidance`,disabled:f.isPending||!u.canContinue,onClick:m,children:[(0,Y.jsx)(rt,{"aria-hidden":`true`}),`Send back`]}),ce(e.pullRequestUrl)?(0,Y.jsx)(C,{asChild:!0,variant:`outline`,size:`sm`,children:(0,Y.jsxs)(`a`,{"data-slot":`pr-link`,href:e.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,title:`The PR for this task is already open`,children:[(0,Y.jsx)(Me,{"aria-hidden":`true`}),`PR ↗`]})}):(0,Y.jsxs)(C,{"data-slot":`review-draft-pr`,variant:`outline`,size:`sm`,title:`Push the branch and open a draft PR`,disabled:p.isPending,onClick:()=>p.mutate(),children:[(0,Y.jsx)(Ne,{"aria-hidden":`true`}),`Draft PR`]}),(0,Y.jsxs)(C,{"data-slot":`review-accept`,variant:`contrast`,size:`sm`,className:`ml-auto`,title:Te(`review`),disabled:l.isPending,onClick:()=>l.mutate(),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),`Accept`]})]}),s===null?null:(0,Y.jsx)(Qn,{command:s})]})}function Qn({command:e}){return(0,Y.jsxs)(`button`,{type:`button`,"data-slot":`review-manual`,title:`Copy the command`,onClick:()=>{navigator.clipboard.writeText(e).then(()=>O(`Command copied to clipboard.`)).catch(()=>O(`Run manually: ${e}`))},className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1 py-0.5 text-left font-mono text-[11px] text-soft-foreground hover:bg-muted hover:text-foreground`,children:[(0,Y.jsx)(Pe,{className:`size-3 shrink-0`,"aria-hidden":`true`}),(0,Y.jsxs)(`span`,{className:`truncate`,children:[`manual path: `,e]})]})}function $n(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var er=1500;function tr({status:e}){let t=(0,J.useRef)(e),[n,r]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{let n=t.current;if(t.current=e,n!==`review`||e!==`done`||$n())return;r(!0);let i=setTimeout(()=>r(!1),er);return()=>clearTimeout(i)},[e]),n?(0,Y.jsxs)(`div`,{"data-slot":`accept-celebration`,"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 isolate z-40`,children:[(0,Y.jsx)(ne,{}),(0,Y.jsx)(`div`,{className:`flex justify-center pt-24`,children:(0,Y.jsx)(`span`,{className:`rounded-full border border-violet/30 bg-violet/15 px-4 py-1.5 text-[13px] font-medium text-violet shadow-modal`,children:`✓ Changes accepted`})})]}):null}var nr={claude:`Claude Code`,codex:`Codex`,opencode:`OpenCode`,pi:`pi`};function rr(e){let t=e.currentStepId?e.steps.find(t=>t.id===e.currentStepId):void 0;if(t?.backend)return t.backend;if(e.runner)return e.runner;for(let t=e.steps.length-1;t>=0;--t){let n=e.steps[t]?.backend;if(n)return n}return`claude`}function ir(e){return e.runner??`claude`}function ar(e,t){let n=h(t,e);return n?.enabled===!1?{provider:e,usable:!1,reason:`${nr[e]} is disabled. Enable it in Settings → Agents → Providers.`}:n?.status===`connected`?{provider:e,usable:!0}:{provider:e,usable:!1,reason:`${nr[e]} credentials are unavailable. Authorize it in Settings → Agents → Providers.`}}function or(e,t){return ar(rr(e),t)}function sr(e,t){return ar(ir(e),t)}function cr(e){let t=E(),n=rr(e);return t.isSuccess&&t.data?or(e,t.data):{provider:n,usable:!0}}function lr(e){let t=E(),n=ir(e);return t.isSuccess&&t.data?sr(e,t.data):t.isError?{provider:n,usable:!1,reason:`Provider authentication could not be verified.`}:{provider:n,usable:!1,reason:`Checking agent providers…`}}var ur=[50,100,200,400,800,1e3,1e3,1e3,1e3],dr=e=>new Promise(t=>setTimeout(t,e));function fr(e){return e instanceof T&&e.status===409&&e.message===`run is still active`}async function pr(e,t=dr){for(let n=0;;n+=1)try{return await e()}catch(e){let r=ur[n];if(!fr(e)||r===void 0)throw e;await t(r)}}function mr(e){return Ce(e.status)?`live`:we(e).continueRun?`resume`:`unavailable`}function hr(e){let t=f(e.id),n=v(e.id),r=cr(e),i=lr(e),[a,o]=(0,J.useState)(void 0),[s,c]=(0,J.useState)(!1),l=(0,J.useRef)(!1),u=mr(e),d=u===`resume`?!i.usable:u===`live`&&!r.usable,p=u===`unavailable`?`no-session`:d?`provider`:void 0,m=p===`no-session`?`This session has ended and no agent session was recorded, so the answer cannot be delivered.`:p===`provider`?u===`resume`?i.reason:r.reason:void 0,h=e=>i.usable?n.mutateAsync({text:e}):Promise.reject(Error(i.reason??`The run provider is unavailable.`));return{mode:u,blockedBy:p,reason:m,isPending:s||t.isPending||n.isPending,error:a,send:async n=>{if(!(p||l.current)){l.current=!0,c(!0),o(void 0);try{if(u===`resume`){await pr(()=>h(n));return}try{await t.mutateAsync({text:n})}catch(t){if(t instanceof T&&t.status===409&&Oe(e)!==void 0){await pr(()=>h(n));return}throw t}}catch(e){o(e instanceof Error?e.message:String(e))}finally{l.current=!1,c(!1)}}}}}function gr(e,t){return`${e.header}: ${t.join(`, `)}`}function _r({ask:e,run:t}){return e.resolved?(0,Y.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`true`,className:`rounded-lg border border-border bg-card px-3.5 py-2.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{className:`text-soft-foreground`,children:`Answered`}),e.answer?(0,Y.jsx)(`span`,{className:`ml-1.5 break-words whitespace-pre-line text-foreground`,children:e.answer}):null]}):(0,Y.jsx)(vr,{ask:e,run:t})}function vr({ask:e,run:t}){let n=hr(t),r=n.blockedBy!==void 0,i=e.questions,a=i.length===1&&i[0]?.multiSelect!==!0,[o,s]=(0,J.useState)({}),c=(e,t)=>s(n=>({...n,[e]:t})),l=i.every((e,t)=>(o[t]?.length??0)>0),u=()=>void n.send(i.map((e,t)=>gr(e,o[t]??[])).join(`
|
|
7
|
+
`)),d=n.mode===`resume`;return(0,Y.jsxs)(`div`,{"data-slot":`ask-card`,"data-resolved":`false`,"data-delivery":n.mode,className:`rounded-lg border border-primary/25 bg-primary/[0.04] px-4 pt-3.5 pb-3.5`,children:[(0,Y.jsx)(`div`,{className:`mb-2.5 flex items-center gap-2`,children:(0,Y.jsx)(`span`,{className:`text-xs font-medium text-primary`,children:`The agent is asking`})}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-4`,children:i.map((e,t)=>(0,Y.jsx)(yr,{question:e,disabled:n.isPending||r,selected:o[t]??[],onSelect:i=>{r||(a?n.send(gr(e,i)):c(t,i))}},e.id??t))}),a?d?(0,Y.jsx)(`p`,{"data-slot":`ask-resume-hint`,className:`mt-3 text-[11.5px] text-soft-foreground`,children:`The session has ended — your answer reopens it and goes to the agent.`}):null:(0,Y.jsxs)(`div`,{className:`mt-3 flex items-center gap-2.5`,children:[(0,Y.jsx)(C,{size:`sm`,disabled:n.isPending||r||!l,onClick:u,children:d?`Send answer & reopen`:`Send answer`}),(0,Y.jsx)(`span`,{"data-slot":d?`ask-resume-hint`:`ask-hint`,className:`text-[11.5px] text-soft-foreground`,children:d?`the session has ended — sending reopens it`:`${i.length>1?`answer each question`:`pick one or more`} — or type a reply below`})]}),n.blockedBy===`provider`?(0,Y.jsxs)(`div`,{"data-slot":`ask-provider-gate`,className:`mt-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Y.jsx)(`span`,{children:n.reason}),(0,Y.jsx)(V,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,n.blockedBy===`no-session`?(0,Y.jsx)(`p`,{"data-slot":`ask-no-session`,className:`mt-3 text-xs text-muted-foreground`,children:n.reason}):null,n.error?(0,Y.jsx)(`p`,{"data-slot":`ask-error`,role:`alert`,className:`mt-3 text-xs text-danger`,children:n.error}):null]})}function yr({question:e,disabled:t,selected:n,onSelect:r}){let i=e.multiSelect===!0,a=e=>{if(!i){r([e]);return}r(n.includes(e)?n.filter(t=>t!==e):[...n,e])};return(0,Y.jsxs)(`div`,{role:`group`,"aria-label":e.question,children:[(0,Y.jsxs)(`div`,{className:`mb-0.5 flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`rounded-md bg-primary px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground`,children:e.header}),i?(0,Y.jsx)(`span`,{className:`ml-auto text-[10.5px] text-soft-foreground`,children:`select all that apply`}):null]}),(0,Y.jsx)(`p`,{className:`mb-2.5 break-words text-sm font-semibold text-foreground`,children:e.question}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.options.map(e=>{let r=n.includes(e.label);return(0,Y.jsxs)(`button`,{type:`button`,disabled:t,"aria-pressed":r,onClick:()=>a(e.label),className:I(`flex w-full flex-col gap-0.5 rounded-md border px-3.5 py-2.5 text-left transition-colors`,`hover:border-primary/50 hover:bg-primary/[0.06] disabled:pointer-events-none disabled:opacity-50`,r?`border-primary/60 bg-primary/[0.06]`:`border-border bg-card`),children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 text-[13.5px] font-semibold text-foreground`,children:[i?(0,Y.jsx)(`span`,{"aria-hidden":!0,className:I(`flex size-4 shrink-0 items-center justify-center rounded border text-[10px]`,r?`border-primary bg-primary text-primary-foreground`:`border-soft-foreground`),children:r?`✓`:``}):null,(0,Y.jsx)(`span`,{className:`min-w-0 break-words`,children:e.label})]}),e.description?(0,Y.jsx)(`span`,{className:`min-w-0 break-words text-xs text-muted-foreground`,children:e.description}):null]},e.label)})})]})}var br=2e3;function xr(e){let t=0,n=0;for(let r of e)typeof r.seq==`number`&&(r.type===`session.ended`&&r.seq>t&&(t=r.seq),(r.type===`session.started`||r.type===`step-start`&&r.kind===`agent`)&&r.seq>n&&(n=r.seq));return t>n?t:0}function Sr(e,t){let n=_(),r=(0,J.useMemo)(()=>xr(t),[t]),i=e?.id,a=e?.status;(0,J.useEffect)(()=>{if(r===0||i===void 0||a!==`running`&&a!==`waiting`)return;let e=setTimeout(()=>{n.invalidateQueries({queryKey:k.runs.detail(i)}),n.invalidateQueries({queryKey:k.runs.list()})},br);return()=>clearTimeout(e)},[r,i,a,n])}function Cr(e){for(let t=e.turns.length-1;t>=0;--t){let n=e.turns[t].planEntries;if(n!==void 0)return n}}function wr(e){let t=[];for(let n of e.turns)for(let e of n.items)if(e.kind===`tool`){for(let n of e.locations??[])t.push(n.path);for(let n of e.diffs??[])t.push(n.path)}let n=[];for(let e=t.length-1;e>=0;--e)n.includes(t[e])||n.push(t[e]);return n}function Tr(e,t){switch(e){case`waiting`:return{state:`waiting`};case`failed`:return{state:`closed`,tone:`danger`,label:t?`Session failed — ${t}`:`Session failed`};case`review`:return{state:`closed`,tone:`dim`,label:`Session closed — waiting for your review`};case`done`:case`cancelled`:return{state:`closed`,tone:`dim`,label:`Session closed`};default:return null}}function Q(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function $(e){return typeof e==`string`?e:void 0}function Er(e){return e===`claude`||e===`codex`||e===`opencode`||e===`pi`?e:void 0}function Dr(e,t){let n=e.replace(/\s*CEZ:DONE\s*$/,``).replace(/\s*CEZ:MONITORING\s*$/,``);return t&&(n=n.replace(/\s*CEZ:ASK[ \t]+\{[\s\S]*\}\s*$/,``)),n.includes(`CEZ:`)?n.split(`
|
|
8
|
+
`).filter(e=>!/^CEZ:(?:PR=\d+|ISSUE=\d+|TITLE=.+)\s*$/.test(e)).join(`
|
|
9
|
+
`):n}function Or(e){let t=e=>Dr(e,!0).replace(/\s+/g,``),n=new Set,r=[];for(let{origin:i,entry:a}of e.entries)if(i===`v2`&&a.kind===`message`){let e=t(a.text);n.add(e),r.push(e)}if(r.length===0)return;n.add(r.join(``));let i=[],a={entries:[],texts:[]},o=()=>{if(a.entries.length>=2&&n.has(t(a.texts.join(``)))){a={entries:[],texts:[]};return}i.push(...a.entries),a={entries:[],texts:[]}};for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`message`?(a.entries.push(t),a.texts.push(t.entry.text)):(o(),i.push(t));o(),e.entries=i}function kr(e){if(typeof e==`string`)return e;if(e==null)return``;try{return JSON.stringify(e)}catch{return String(e)}}var Ar=e=>e.kind===`message`||e.kind===`reasoning`||e.kind===`tool`,jr=new Set([`pending`,`in_progress`,`completed`,`cancelled`]);function Mr(e){if(!Q(e)||!Array.isArray(e.todos))return;let t=[];for(let n of e.todos){if(!Q(n)||typeof n.content!=`string`)return;t.push({content:n.content,status:jr.has(n.status)?n.status:`pending`,...typeof n.activeForm==`string`?{activeForm:n.activeForm}:{}})}return t}function Nr(e,t={}){let n=[],r=new Map,i,a=0,o,s=e=>{a+=1;let t={id:e===void 0?`turn-fallback-${a}`:`turn-seq-${e}`,entries:[],v2Items:!1};return n.push(t),t},c=()=>n.at(-1)??s(),l=(e,t)=>{let n=$(e.stepId);return n===void 0?t:`${n}:${t}`},u=(e,t,n)=>{let i={...t};if(!e.v2Items){e.v2Items=!0;for(let t of e.entries)t.origin===`v1`&&t.entry.kind===`tool`&&r.delete(t.entry.id);e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`tool`))}let a=r.get(n);if(a&&a.turn===e){a.entry.entry=i,r.set(n,a);return}let o={origin:`v2`,entry:i};e.entries.push(o),r.set(n,{turn:e,entry:o})};for(let t of e)switch(t.type){case`user-message`:{let e=$(t.text)??``;o&&!o.resolved&&(o.resolved=!0,e!==``&&(o.answer=e),o=void 0);let n=s(t.seq);n.userMessage={text:e,imageCount:typeof t.imageCount==`number`?t.imageCount:0,images:Array.isArray(t.images)?t.images.filter(e=>typeof e==`string`):[]};break}case`turn.started`:{let e=$(t.turnId),r=n.at(-1);r&&r.turnId===void 0&&!r.v2Items?r.turnId=e:s(t.seq).turnId=e;break}case`turn.completed`:{let e=$(t.turnId),r;for(let t=n.length-1;t>=0&&!r;--t)n[t].turnId===e&&(r=n[t]);let i=r??n.at(-1);i&&(i.completed={stopReason:$(t.stopReason)??`end_turn`,...typeof t.costUsd==`number`?{costUsd:t.costUsd}:{}});break}case`item.started`:case`item.updated`:case`item.completed`:{if(!Q(t.item))break;let e=t.item.kind,n=t.item.id;if(e!==`message`&&e!==`reasoning`&&e!==`tool`||typeof n!=`string`||n===``)break;let i=t.item,a=l(t,i.id);u(r.get(a)?.turn??c(),i,a);break}case`item.delta`:{let e=$(t.itemId)??``,n=r.get(l(t,e)),i=$(t.delta)??``;if(!n||i===``||!Ar(n.entry.entry))break;let a=n.entry.entry;t.field===`output`&&a.kind===`tool`?a.output=(a.output??``)+i:t.field!==`output`&&a.kind!==`tool`&&(a.text+=i);break}case`text`:{let e=c(),n=$(t.text)??``;if(n===``)break;e.entries.push({origin:`v1`,entry:{kind:`message`,id:`v1:${t.seq}`,role:`assistant`,text:n}});break}case`tool-call`:{let e=c();if(e.v2Items)break;let n=$(t.tool)??`Tool`;if(Pr.has(n))break;let i=$e(n,t.input);if(i.toolKind===`plan`){let n=Mr(t.input);n!==void 0&&(e.planEntries=n)}let a={kind:`tool`,id:$(t.id)??`v1:${t.seq}`,name:n,toolKind:i.toolKind,title:i.title,status:`running`,input:t.input},o={origin:`v1`,entry:a};e.entries.push(o),r.set(a.id,{turn:e,entry:o});break}case`tool-result`:{let e=r.get($(t.toolCallId)??``);if(!e||e.turn.v2Items||e.entry.origin!==`v1`)break;let n=e.entry.entry;if(n.kind!==`tool`)break;n.status=`completed`,n.output=kr(t.result);break}case`note`:case`lifecycle`:{let e=$(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`dim`}});break}case`error`:{let e=$(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:e,tone:`danger`}});break}case`session.error`:{let e=$(t.message)??``;if(e===``)break;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v2:${t.seq}`,text:e,tone:`danger`}});break}case`step-end`:{if(t.status!==`failed`)break;let e=$(t.error)?` — ${$(t.error)}`:``;c().entries.push({origin:`meta`,entry:{kind:`note`,id:`v1:${t.seq}`,text:`step ${$(t.stepId)??`?`} failed${e}`,tone:`danger`}});break}case`check-output`:{let e=$(t.command)??`check`,n=typeof t.exitCode==`number`?t.exitCode:-1,r={kind:`tool`,id:`v1:${t.seq}`,name:`check`,toolKind:`execute`,title:`Ran ${e}`,status:n===0?`completed`:`failed`,output:$(t.text)??``,exitCode:n};c().entries.push({origin:`meta`,entry:r});break}case`provider-auth-required`:{let e=Er(t.provider),n=$(t.authFailureId);if(e===void 0||n===void 0||n.length<1||n.length>128)break;c().entries.push({origin:`meta`,entry:{kind:`provider-auth-required`,id:`v1:${t.seq}`,provider:e,authFailureId:n}});break}case`image`:{let e=$(t.url);if(e===void 0)break;let n={kind:`image`,id:`v1:${t.seq}`,url:e},r=$(t.name);r!==void 0&&(n.name=r),c().entries.push({origin:`meta`,entry:n});break}case`plan.updated`:Array.isArray(t.entries)&&(c().planEntries=t.entries);break;case`session.ended`:i={reason:$(t.reason)??`end_turn`,...$(t.message)===void 0?{}:{message:$(t.message)}};break;case`ask.requested`:{let e=$(t.requestId);if(e===void 0||!Array.isArray(t.questions))break;let n=t.questions.filter(e=>Q(e)&&typeof e.header==`string`&&Array.isArray(e.options));if(n.length===0)break;let r={kind:`ask`,id:e,questions:n,resolved:!1};c().entries.push({origin:`meta`,entry:r}),o=r;break}case`step-start`:case`token-usage`:case`cost`:case`turn-end`:case`done`:case`session`:break;default:break}for(let e of n){if(!e.v2Items)continue;let t=new Set;for(let{origin:n,entry:r}of e.entries)n===`v2`&&r.kind===`message`&&t.add(Dr(r.text,!0).trim());t.size!==0&&(e.entries=e.entries.filter(e=>!(e.origin===`v1`&&e.entry.kind===`message`&&t.has(Dr(e.entry.text,!0).trim()))),Or(e))}return{turns:n.map((e,r)=>{let i=e.entries.some(({entry:e})=>e.kind===`ask`),a=t.activeTurn===!0&&r===n.length-1;return{id:e.id,...e.turnId===void 0?{}:{turnId:e.turnId},...e.userMessage===void 0?{}:{userMessage:e.userMessage},...e.planEntries===void 0?{}:{planEntries:e.planEntries},...e.completed===void 0?{}:{completed:e.completed},items:e.entries.map(({entry:e})=>e.kind===`message`&&e.role===`assistant`?{...e,text:Dr(e.text,i||a)}:e)}}),...i===void 0?{}:{sessionEnded:i}}}var Pr=new Set([`subAgentActivity`,`collabAgentToolCall`,`collabToolCall`]);function Fr(){let{id:e}=u(),t=p(e),n=gt(e),r=t.data?.status,i=(0,J.useMemo)(()=>Nr(n.visibleEvents,{activeTurn:r===`running`}),[n.visibleEvents,r]),a=(0,J.useMemo)(()=>Nr(n.currentEvents,{activeTurn:r===`running`}),[n.currentEvents,r]),o=(0,J.useRef)(void 0),s=(0,J.useCallback)(e=>{o.current=e},[]),{mutate:c}=D();if((0,J.useEffect)(()=>{t.data&&o.current!==t.data.id&&ue(t.data)&&c(t.data.id)},[c,t.data?.id,t.data?.status,t.data?.finishedAt,t.data?.seenAt,t.data?.archived]),Sr(t.data,n.visibleEvents),t.isPending)return(0,Y.jsx)(ve,{});if(t.isError){let e=t.error instanceof T&&t.error.status===404;return(0,Y.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,Y.jsx)(M,{icon:e?(0,Y.jsx)(Ve,{}):(0,Y.jsx)(ot,{}),tone:e?`neutral`:`danger`,title:e?`Task not found`:`Could not load this task`,subtitle:e?`No run has this id. It may have been deleted, or the link is from another machine.`:t.error.message,actions:(0,Y.jsx)(C,{asChild:!0,variant:`outline`,children:(0,Y.jsx)(V,{to:`/`,children:`Back to tasks`})})})})}return n.isPending?(0,Y.jsx)(ve,{}):(0,Y.jsx)(Ir,{run:t.data,thread:i,currentThread:a,history:n,onMarkedUnread:s})}function Ir({run:e,thread:t,currentThread:n=t,history:r,onMarkedUnread:i}){let a=Tr(e.status,e.error),o=Cr(n),c=o!==void 0&&o.length>0?kn(o):void 0,l=e.status===`running`||e.status===`waiting`,u=e.status===`queued`,d=an(e),p=!l&&!u&&d.available,m=p&&d.canContinue,h=!l&&e.status!==`queued`,_=(0,J.useMemo)(()=>mn(n.turns,h),[n.turns,h]),[v,y]=(0,J.useState)(void 0),[b,x]=(0,J.useState)(e.id);b!==e.id&&(x(e.id),y(void 0));let C=(0,J.useMemo)(()=>v===void 0?void 0:bn(n.turns,v,h),[n.turns,v,h]),T=(0,J.useMemo)(()=>v===void 0?[]:xn(n.turns,v),[n.turns,v]),E=f(e.id),D=cr(e),O=l&&!D.usable,k=p&&!d.canContinue,A=O||k,te=O?D.reason:d.reason,{mutateAsync:j}=ee(e.id),{mutateAsync:ne}=g(e.id),{mutateAsync:ie}=S(e.id),M=(0,J.useMemo)(()=>u?{onEditTask:async e=>{await j({task:e})},onEditMessage:(e,t)=>ne({msgId:e,message:{text:t}}).then(()=>void 0),onRemoveMessage:e=>ie(e).then(()=>void 0)}:void 0,[u,j,ne,ie]),N=(0,J.useMemo)(()=>Rn(e,t),[e,t]),P=(0,J.useMemo)(()=>Bn(N,e.id),[N,e.id]),oe=(0,J.useCallback)(t=>(0,Y.jsx)(_r,{ask:t,run:e}),[e]),se=(0,J.useMemo)(()=>{if(M===void 0)return;let t={task:{onEdit:M.onEditTask,editLabel:`Edit the prompt`}};for(let n of e.queuedMessages??[])t[`queued:${n.id}`]={onEdit:e=>M.onEditMessage(n.id,e),onRemove:()=>M.onRemoveMessage(n.id)};return t},[M,e.queuedMessages]),F=re(e,w()),{search:le}=s(),ue=Nt(le,P.length),L=Pn(`${e.id}:main`,{onLoadOlder:r?.hasOlder?r.loadOlder:void 0,onJumpToLatest:r?.jumpToLatest,rowKeys:P.map(({key:e})=>e)});return Re(L.restickIfStuck),(0,Y.jsxs)(`div`,{"data-route":`task-thread`,"data-run-id":e.id,className:`flex min-h-full flex-col`,children:[(0,Y.jsx)(je,{run:e,planTally:c,onMarkedUnread:()=>i?.(e.id)}),(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-1 flex-col gap-3.5 px-4 py-5 md:px-6`,children:[r?(0,Y.jsx)(Lr,{hasOlder:r.hasOlder,loading:r.isFetchingOlder,error:r.olderError,fallback:r.fallback,retainedPages:r.retainedPages,onLoad:L.loadOlder}):null,(0,Y.jsx)(Vn,{runId:e.id,viewId:`main`,sections:N,mode:`document`,renderAsk:oe,messageActions:se,scrollControls:L,renderMode:ue}),t.turns.length===0?e.status===`queued`?(0,Y.jsx)(Rr,{run:e}):(0,Y.jsx)(`p`,{"data-slot":`thread-empty`,className:`py-6 text-center text-xs text-soft-foreground`,children:`No session events yet.`}):null,e.status===`running`?(0,Y.jsx)(Kt,{}):null,a&&a.state===`closed`?(0,Y.jsxs)(`div`,{"data-slot":`thread-footer`,"data-state":a.state,className:I(`mt-auto flex items-center gap-2 border-t border-border pt-3 text-xs`,a.tone===`danger`?`text-danger`:`text-soft-foreground`),children:[a.label,ce(ae(e))?(0,Y.jsx)(`a`,{"data-slot":`pr-link`,href:ae(e),target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`PR ↗`}):null,ce(F)?(0,Y.jsx)(`a`,{"data-slot":`issue-link`,href:F,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-foreground underline-offset-2 hover:underline`,children:`Issue ↗`}):null]}):null,e.status===`review`?(0,Y.jsx)(Xn,{run:e}):null]}),(0,Y.jsx)(tr,{status:e.status}),(0,Y.jsx)(qn,{runId:e.id,renderAsk:oe,agent:C,entries:T,onClose:()=>y(void 0)}),(0,Y.jsxs)(`div`,{"data-slot":`thread-dock`,className:`sticky bottom-[var(--kb,0px)] z-10 bg-background px-4 pt-1.5 pb-3 max-md:border-t max-md:border-border md:px-6 md:pb-4`,children:[L.pillVisible?(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 -top-12 flex justify-center`,children:(0,Y.jsx)(Ln,{onJump:L.jumpToLatest})}):null,(0,Y.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[var(--measure)] flex-col gap-2.5`,children:[(0,Y.jsx)(wn,{runId:e.id,agents:_,onSelect:y},`agents:${e.id}`),o!==void 0&&o.length>0?(0,Y.jsx)(jn,{runId:e.id,entries:o},e.id):null,(0,Y.jsx)(_t,{run:e}),e.status===`waiting`?(0,Y.jsxs)(`div`,{"data-slot":`paused-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(H,{tone:`pending`,pulse:!0}),`The agent is paused, waiting for your reply`]}):null,u?(0,Y.jsxs)(`div`,{"data-slot":`queued-hint`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,Y.jsx)(H,{tone:`pending`}),`Messages you add now are folded into the prompt before the run starts.`]}):null,(0,Y.jsx)(he,{onSubmit:m?(e,t)=>d.continueWith(e,t):(e,t)=>E.mutateAsync({text:e,images:t}),disabled:A||!l&&!u&&!m,disabledReason:A?te:`Session closed — no session to resume.`,footerEnd:A&&!d.providerPending?(0,Y.jsx)(V,{to:`/settings/agents#providers`,className:`text-xs font-medium text-foreground underline underline-offset-4`,children:`Configure providers`}):m?d.pills:void 0,allowEmptySubmit:m,sendAriaLabel:m?`Continue`:`Send`,placeholder:u?`Add to the prompt — sent when the run starts…`:m?`Continue — add a prompt, or send to just reopen the session…`:e.status===`waiting`?`Reply — / for skills, @ for files…`:`Message the agent — / for skills, @ for files…`,autocompleteSkills:!0,quickReplies:!0,getMentionCandidates:()=>wr(t)})]})]})]})}function Lr({hasOlder:e,loading:t,error:n,fallback:r,retainedPages:i,onLoad:a}){return r?(0,Y.jsx)(`p`,{"data-slot":`history-fallback`,className:`text-center text-xs text-soft-foreground`,role:`status`,children:`Progressive history is unavailable; showing the complete session.`}):!e&&!n?(0,Y.jsxs)(`div`,{"data-slot":`history-start`,className:`flex items-center gap-3 text-[11px] text-soft-foreground`,children:[(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`}),`Start of session`,(0,Y.jsx)(`span`,{"aria-hidden":!0,className:`h-px flex-1 bg-border`})]}):(0,Y.jsxs)(`div`,{"data-slot":`history-boundary`,"data-retained-pages":i,"aria-busy":t,className:`flex min-h-8 items-center justify-center text-xs text-muted-foreground`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:a,disabled:t,className:`rounded-md px-3 py-1.5 font-medium hover:bg-muted disabled:cursor-wait`,children:t?`Loading 100 earlier items…`:n?`Couldn’t load earlier items · Retry`:`Load 100 earlier items`}),(0,Y.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:t?`Loading earlier session history`:n||``})]})}function Rr({run:e}){let t=Ae(te().data??[],e.id);return(0,Y.jsxs)(`div`,{"data-slot":`queued-state`,className:`flex flex-col items-center gap-1.5 py-10 text-center`,children:[(0,Y.jsx)(H,{tone:`pending`,pulse:!0}),(0,Y.jsxs)(`p`,{className:`text-[13px] font-medium`,children:[`Waiting for a free agent slot`,t===void 0?``:` — #${t} in queue`]}),(0,Y.jsxs)(`p`,{className:`text-xs text-soft-foreground`,children:[e.workflow,` · starts automatically when a slot frees up`]})]})}export{Fr as TaskThreadRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{r as n,t as r}from"./utils-
|
|
1
|
+
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{r as n,t as r}from"./utils-BhpbVMwN.js";var i=n(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);e();var a=t();function o({className:e,...t}){return(0,a.jsx)(`textarea`,{"data-slot":`textarea`,className:r(`flex field-sizing-content min-h-16 w-full resize-none rounded-md border border-input bg-card px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-soft-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 md:text-sm`,e),...t})}export{i as n,o as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,Ft as i,Rt as a,Ur as o,a as s,i as c,j as ee,k as l,lr as te,t as u}from"./centered-state-LfAW-igm.js";import{r as d,t as f}from"./utils-BhpbVMwN.js";import{S as ne,c as re,g as ie,l as ae,r as oe,s as se,x as ce}from"./prompt-templates-DFOvYgtW.js";import{n as p}from"./textarea-B9Ahj4E4.js";import{d as m,f as h,g,h as _,l as v,m as y,p as b,u as x}from"./alert-dialog-Byp42_IG.js";import{t as le}from"./use-submit-shortcut-B-xhu4Bf.js";import{i as ue,n as de,r as fe,t as pe}from"./skills-BiWfHmCR.js";var S=d(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),me=d(`mic`,[[`path`,{d:`M12 19v3`,key:`npa21l`}],[`path`,{d:`M19 10v2a7 7 0 0 1-14 0v-2`,key:`1vc78b`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`13`,rx:`3`,key:`s6n7sd`}]]),C=d(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),w=e(t(),1),T=n();function he({...e}){return(0,T.jsx)(v,{"data-slot":`sheet`,...e})}function E({...e}){return(0,T.jsx)(g,{"data-slot":`sheet-trigger`,...e})}function D({...e}){return(0,T.jsx)(x,{"data-slot":`sheet-close`,...e})}function O({...e}){return(0,T.jsx)(y,{"data-slot":`sheet-portal`,...e})}function k({className:e,...t}){return(0,T.jsx)(b,{"data-slot":`sheet-overlay`,className:f(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function A({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,T.jsxs)(O,{children:[(0,T.jsx)(k,{}),(0,T.jsxs)(m,{"data-slot":`sheet-content`,className:f(`fixed z-50 flex flex-col gap-4 bg-background shadow-modal transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,T.jsxs)(x,{className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-secondary`,children:[(0,T.jsx)(p,{className:`size-4`}),(0,T.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function j({className:e,...t}){return(0,T.jsx)(`div`,{"data-slot":`sheet-header`,className:f(`flex flex-col gap-1.5 p-4`,e),...t})}function M({className:e,...t}){return(0,T.jsx)(_,{"data-slot":`sheet-title`,className:f(`font-semibold text-foreground`,e),...t})}function N({className:e,...t}){return(0,T.jsx)(h,{"data-slot":`sheet-description`,className:f(`text-sm text-muted-foreground`,e),...t})}function P(e){let[t,n]=w.useState(()=>Date.now());return w.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}async function ge(e){let t=new Uint8Array(await e.arrayBuffer()),n=``;for(let e=0;e<t.length;e+=32768)n+=String.fromCharCode(...t.subarray(e,e+32768));let r=btoa(n);return{mediaType:e.type,data:r,preview:`data:${e.type};base64,${r}`,name:e.name||`pasted image`}}function _e(e,t){let n=[],r=[],i=t;for(let t of e)if(t.type.startsWith(`image/`)){if(t.size>5242880){r.push(`${t.name||`image`} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${t.name||`image`} skipped — max 4 images per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var F=new Set([`/`,`@`]);function ve(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(F.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function ye(e,t,n,r){let i=`${t.trigger}${r} `;return{text:e.slice(0,t.start)+i+e.slice(n),caret:t.start+i.length}}function I(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function L(e,t){let n=e,r=``;for(let e=t.resultIndex;e<t.results.length;e+=1){let i=t.results[e],a=i[0]?.transcript??``;i.isFinal?n+=a:r+=a}return{finalText:n,interim:r}}function be(e){let[t,n]=w.useState(null),r=w.useRef(null),i=w.useRef(``),[a]=w.useState(()=>I()!==void 0),o=w.useCallback(()=>{let e=r.current;r.current=null,i.current=``,n(null),e&&(e.onresult=null,e.onerror=null,e.onend=null,e.abort())},[]);return w.useEffect(()=>o,[o]),{supported:a,recording:t,start:w.useCallback(()=>{if(r.current)return;let t=I();if(!t)return;let a;try{a=new t,a.lang=navigator.language||`en-US`,a.continuous=!0,a.interimResults=!0;let s=Date.now();a.onresult=e=>{let t=L(i.current,e);i.current=t.finalText,n({transcript:t.finalText+t.interim,startedAt:s})},a.onerror=t=>{e(`Dictation failed${t.error?` — ${t.error}`:``}`),o()},a.start(),r.current=a,n({transcript:``,startedAt:s})}catch{e(`Dictation failed — the microphone could not be started`),o()}},[e,o]),cancel:w.useCallback(()=>o(),[o]),finish:w.useCallback(()=>{let e=r.current,a=(i.current+``).trim()===``?``:i.current,o=t?.transcript??a;return e&&(e.onresult=null,e.onerror=null,e.onend=null,e.stop()),r.current=null,i.current=``,n(null),o.trim()},[t])}}function R(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var xe={KeyA:`Yes, approved.`,KeyC:`Continue.`};function z({onSubmit:e,value:t,onValueChange:n,autoFocus:r=!1,footerStart:l,footerEnd:u,sendAriaLabel:d=`Send`,disabled:m=!1,disabledReason:h=`Session closed — Continue to reopen.`,allowEmptySubmit:g=!1,placeholder:_=`Reply — / for skills, @ for files…`,ariaLabel:v=`Reply to the agent`,autocompleteSkills:y=!0,quickReplies:b=!1,getMentionCandidates:x,ref:C}){let[he,E]=(0,w.useState)(``),D=t??he,O=(0,w.useRef)(D);O.current=D;let k=(0,w.useRef)(n);k.current=n;let A=(0,w.useCallback)(e=>{let t=typeof e==`function`?e(O.current):e;E(t),k.current?.(t)},[]),[j,M]=(0,w.useState)([]),N=(0,w.useRef)(j);N.current=j;let[P,F]=(0,w.useState)(!1),[I,L]=(0,w.useState)(null),[R,z]=(0,w.useState)(``),[B,we]=(0,w.useState)(!1),V=(0,w.useRef)(null),H=(0,w.useRef)(null),U=(0,w.useRef)(null),W=i(y&&B),G=a(),Te=o(),K=be(e=>c(e,{tone:`danger`}));(0,w.useEffect)(()=>{r&&V.current?.focus()},[]),(0,w.useImperativeHandle)(C,()=>({insertAtCaret:e=>{let t=V.current,n=oe(O.current,t?.selectionStart??O.current.length,e);A(n.text),U.current=n.caret,t?.focus()}}),[A]);let q=(0,w.useCallback)(()=>{let e=V.current;if(!e||m){L(null);return}let t=ve(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!y||t?.trigger===`@`&&x===void 0)return L(null);t?.trigger===`/`&&we(!0),L(t)},[y,m,x]),J=(0,w.useMemo)(()=>I===null?[]:I.trigger===`/`?de(W.data??[],I.query,G.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:ue(e)})):(x?.()??[]).filter(e=>fe(e,I.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[x,W.data,I,G.data?.skillUsage]),Y=J.some(e=>e.value===R)?R:J[0]?.value,Ee=I!==null,X=(0,w.useCallback)(()=>L(null),[]),De=e=>{let t=V.current;if(!t||I===null)return;let n=t.selectionStart??t.value.length,r=ye(t.value,I,n,e.insert);I.trigger===`/`&&G.data!==void 0&&te({skillUsage:pe(G.data.skillUsage,e.insert)}).then(()=>Te.invalidateQueries({queryKey:ee.uiState})).catch(()=>{}),A(r.text),U.current=r.caret,L(null),t.focus()};(0,w.useLayoutEffect)(()=>{let e=U.current,t=V.current;e!==null&&t&&(t.setSelectionRange(e,e),U.current=null)},[D]),(0,w.useLayoutEffect)(()=>{let e=V.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[D]);let Z=(0,w.useCallback)(e=>{if(m)return;let t=_e(e,N.current.length);for(let e of t.rejected)c(e,{tone:`danger`});for(let e of t.accepted)ge(e).then(e=>M(t=>t.length>=4?t:[...t,e]))},[m]),Oe=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.type.startsWith(`image/`)).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),Z(t))},ke=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),Z(t))},Q=(0,w.useCallback)(async(t,n,r)=>{let i=t.trim();if(!(m||P)&&!(i===``&&n.length===0&&!g)){F(!0);try{await e(i,n.map(({mediaType:e,data:t})=>({mediaType:e,data:t})))}catch(e){c(e instanceof Error?e.message:String(e),{tone:`danger`}),r&&(A(e=>e===``?t:`${t}\n${e}`),M(e=>[...n,...e].slice(0,4)))}finally{F(!1)}}},[g,P,m,e]),Ae=(0,w.useCallback)(()=>{if(D.trim()===``&&j.length===0&&!g)return;let e=D,t=j;A(``),M([]),L(null),Q(e,t,!0)},[g,j,Q,D]),je=e=>{if(Ee){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),J.length===0)return;let t=J.findIndex(e=>e.value===Y),n=e.key===`ArrowDown`?1:-1,r=J[(t+n+J.length)%J.length];z(r.value);return}if(e.key===`Escape`){e.preventDefault(),X();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=J.find(e=>e.value===Y);if(t){e.preventDefault(),De(t);return}X()}}le({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Ae())};(0,w.useEffect)(()=>{if(!b||m)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat)return;let t=xe[e.code];t!==void 0&&(e.preventDefault(),Q(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[m,b,Q]);let Me=e=>{let t=K.finish();if(t===``)return;let n=D.trim()===``?t:`${D.replace(/\s*$/,``)} ${t}`;if(e){A(``),M([]),Q(n,j,!0);return}A(n),U.current=n.length,V.current?.focus()},$=K.recording;return(0,T.jsxs)(se,{open:Ee,onOpenChange:e=>e?void 0:X(),children:[(0,T.jsx)(re,{asChild:!0,children:(0,T.jsxs)(`div`,{ref:H,"data-slot":`composer`,"data-disabled":m||void 0,onDrop:ke,onDragOver:e=>e.preventDefault(),className:f(`rounded-xl border border-border bg-card shadow-xs transition-[border-color,box-shadow]`,`focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,m&&`opacity-80`),children:[j.length>0?(0,T.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-wrap gap-2 px-4 pt-3`,children:j.map((e,t)=>(0,T.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:`Click to remove`,className:`group relative size-12 overflow-hidden rounded-md border border-border`,onClick:()=>M(e=>e.filter((e,n)=>n!==t)),children:[(0,T.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}),(0,T.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,T.jsx)(p,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,T.jsx)(`textarea`,{ref:V,rows:2,value:D,disabled:m,"aria-label":v,placeholder:m?h:_,className:`block max-h-[220px] min-h-[54px] w-full resize-none bg-transparent px-4 pt-3 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:text-sm`,onChange:e=>{A(e.target.value),q()},onKeyDown:je,onSelect:q,onPaste:Oe}),$?(0,T.jsx)(Ce,{transcript:$.transcript,startedAt:$.startedAt,onCancel:K.cancel,onInsert:()=>Me(!1),onInsertAndSend:()=>Me(!0)}):(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 gap-y-1.5 px-2 pt-1.5 pb-2`,children:[(0,T.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:`flex min-w-0 flex-wrap items-center gap-1`,children:[(0,T.jsx)(Se,{disabled:m,onFiles:Z}),l]}),(0,T.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[K.supported?(0,T.jsxs)(s,{type:`button`,variant:`ghost`,size:`sm`,disabled:m,"aria-label":`Start dictation`,title:`Dictation`,className:`h-8 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground`,onClick:K.start,children:[(0,T.jsx)(me,{"aria-hidden":`true`,className:`size-3.5`}),`Dictation`]}):null,u?(0,T.jsx)(`div`,{"data-slot":`composer-footer-end`,className:`flex items-center gap-1.5`,children:u}):null,(0,T.jsx)(s,{type:`button`,size:`icon-sm`,"aria-label":d,disabled:m||P||D.trim()===``&&j.length===0&&!g,className:`size-8`,onClick:Ae,children:(0,T.jsx)(S,{"aria-hidden":`true`})})]})]})]})}),(0,T.jsx)(ae,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{H.current?.contains(e.target)&&e.preventDefault()},children:(0,T.jsx)(ie,{shouldFilter:!1,value:Y??``,onValueChange:z,children:(0,T.jsx)(ne,{"data-slot":`composer-menu`,"data-trigger":I?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:J.length===0?(0,T.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:I?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:W.isPending?`Loading skills…`:`No matching skills.`}):J.map(e=>(0,T.jsxs)(ce,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>De(e),children:[(0,T.jsx)(`span`,{className:f(`shrink-0 truncate`,e.emphasized&&`font-semibold`,I?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,T.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Se({disabled:e,onFiles:t}){let n=(0,w.useRef)(null);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach images`,title:`Attach an image (or paste a screenshot)`,disabled:e,className:`size-8 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,T.jsx)(C,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,T.jsx)(`input`,{ref:n,type:`file`,accept:`image/*`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Ce({transcript:e,startedAt:t,onCancel:n,onInsert:i,onInsertAndSend:a}){let o=P(1e3);return(0,T.jsxs)(`div`,{"data-slot":`dictation-overlay`,role:`status`,"aria-label":`Dictation in progress`,className:`flex items-center gap-2.5 rounded-b-xl border-t border-border bg-muted/60 px-3 py-2`,children:[(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,T.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:R(t,o)}),(0,T.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,T.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,T.jsx)(s,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-8 text-muted-foreground`,onClick:n,children:(0,T.jsx)(p,{"aria-hidden":`true`})}),(0,T.jsx)(s,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":`Insert transcription`,className:`size-8`,onClick:i,children:(0,T.jsx)(r,{"aria-hidden":`true`})}),(0,T.jsx)(s,{type:`button`,size:`icon-sm`,"aria-label":`Insert transcription and send`,className:`size-8`,onClick:a,children:(0,T.jsx)(S,{"aria-hidden":`true`})})]})}function B(){return(0,T.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,T.jsx)(u,{icon:(0,T.jsx)(l,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{D as a,j as c,S as d,he as i,M as l,z as n,A as o,P as r,N as s,B as t,E as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./utils-
|
|
1
|
+
import{r as e}from"./utils-BhpbVMwN.js";var t=e(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),n=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t as n,n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./utils-
|
|
1
|
+
import{r as e}from"./utils-BhpbVMwN.js";var t=e(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./utils-
|
|
1
|
+
import{r as e}from"./utils-BhpbVMwN.js";var t=e(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]);export{t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./centered-state-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./centered-state-LfAW-igm.js";import{r as i,t as a}from"./utils-BhpbVMwN.js";import{x as o}from"./index-DoVvGDfW.js";var s=i(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),c=i(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),l=n();function u({mode:e,wrap:t,onModeChange:n,onWrapChange:i}){return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,l.jsx)(d,{current:e,value:`unified`,onModeChange:n}),(0,l.jsx)(d,{current:e,value:`split`,onModeChange:n})]}),(0,l.jsx)(r,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:a(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,l.jsx)(c,{"aria-hidden":`true`})})]})}function d({current:e,value:t,onModeChange:n}){let r=e===t;return(0,l.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:a(`rounded-[5px] px-2 py-0.5 text-[11px] font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function f({branch:e}){return(0,l.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium`,children:[(0,l.jsx)(o,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,l.jsx)(`span`,{className:`truncate`,children:e})]})}var p=e(t(),1);function m(){let[e,t]=(0,p.useState)(()=>typeof window.matchMedia!=`function`||window.matchMedia(`(min-width: 768px)`).matches);return(0,p.useEffect)(()=>{if(typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(min-width: 768px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}export{s as i,f as n,u as r,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{a as n}from"./centered-state-
|
|
1
|
+
import"./rolldown-runtime-QTnfLwEv.js";import{i as e,t}from"./react-runtime-CCIEwYL0.js";import{a as n}from"./centered-state-LfAW-igm.js";import{t as r}from"./utils-BhpbVMwN.js";import{n as i}from"./textarea-B9Ahj4E4.js";import{d as a,f as o,h as s,l as c,m as l,p as u,u as d}from"./alert-dialog-Byp42_IG.js";e();var f=t();function p({...e}){return(0,f.jsx)(c,{"data-slot":`dialog`,...e})}function m({...e}){return(0,f.jsx)(l,{"data-slot":`dialog-portal`,...e})}function h({...e}){return(0,f.jsx)(d,{"data-slot":`dialog-close`,...e})}function g({className:e,...t}){return(0,f.jsx)(u,{"data-slot":`dialog-overlay`,className:r(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function _({className:e,children:t,showCloseButton:n=!0,...o}){return(0,f.jsxs)(m,{"data-slot":`dialog-portal`,children:[(0,f.jsx)(g,{}),(0,f.jsxs)(a,{"data-slot":`dialog-content`,className:r(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-card p-6 shadow-modal duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...o,children:[t,n&&(0,f.jsxs)(d,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,f.jsx)(i,{}),(0,f.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function v({className:e,...t}){return(0,f.jsx)(`div`,{"data-slot":`dialog-header`,className:r(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function y({className:e,showCloseButton:t=!1,children:i,...a}){return(0,f.jsxs)(`div`,{"data-slot":`dialog-footer`,className:r(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...a,children:[i,t&&(0,f.jsx)(d,{asChild:!0,children:(0,f.jsx)(n,{variant:`outline`,children:`Close`})})]})}function b({className:e,...t}){return(0,f.jsx)(s,{"data-slot":`dialog-title`,className:r(`text-lg leading-none font-semibold`,e),...t})}function x({className:e,...t}){return(0,f.jsx)(o,{"data-slot":`dialog-description`,className:r(`text-sm text-muted-foreground`,e),...t})}function S(e){return!(e.key!==`Enter`||e.shiftKey||e.altKey||e.repeat||e.isComposing)}function C(e=typeof navigator>`u`?``:navigator.platform){return/mac|iphone|ipad|ipod/i.test(e)?`⌘↵`:`Ctrl+↵`}export{_ as a,v as c,h as i,b as l,C as n,x as o,p as r,y as s,S as t};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{r as n,t as r}from"./bundle-mjs-BT31bpU6.js";var i;function a(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var o=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},s=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(i=globalThis).__zod_globalConfig??(i.__zod_globalConfig={});var c=globalThis.__zod_globalConfig;function l(e){return e&&Object.assign(c,e),c}function u(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function d(e,t){return typeof t==`bigint`?t.toString():t}function f(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function p(e){return e==null}function ee(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function te(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var ne=Symbol(`evaluating`);function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ne)return r===void 0&&(r=ne,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function h(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function g(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function re(e){return JSON.stringify(e)}function ie(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var ae=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var oe=f(()=>{if(c.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function v(e){if(_(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return!(_(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}function se(e){return v(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ce=new Set([`string`,`number`,`symbol`]);function y(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function b(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function x(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function le(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ue={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function de(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return b(e,g(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return h(this,`shape`,e),e},checks:[]}))}function fe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return b(e,g(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return h(this,`shape`,r),r},checks:[]}))}function pe(e,t){if(!v(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return b(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function me(e,t){if(!v(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return b(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return h(this,`shape`,n),n}}))}function he(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return b(e,g(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return h(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ge(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return b(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return h(this,`shape`,i),i},checks:[]}))}function _e(e,t,n){return b(t,g(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return h(this,`shape`,i),i}}))}function S(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function ve(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function C(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ye(e){return typeof e==`string`?e:e?.message}function w(e,t,n){let r=e.message?e.message:ye(e.inst?._zod.def?.error?.(e))??ye(t?.error?.(e))??ye(n.customError?.(e))??ye(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function be(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function T(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var xe=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,d,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Se=a(`$ZodError`,xe),Ce=a(`$ZodError`,xe,{Parent:Error});function we(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Te(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var Ee=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new o;if(s.issues.length){let t=new((i?.Err)??e)(s.issues.map(e=>w(e,a,l())));throw ae(t,i?.callee),t}return s.value},De=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>w(e,a,l())));throw ae(t,i?.callee),t}return o.value},Oe=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new o;return a.issues.length?{success:!1,error:new(e??Se)(a.issues.map(e=>w(e,i,l())))}:{success:!0,data:a.value}},ke=Oe(Ce),Ae=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>w(e,i,l())))}:{success:!0,data:a.value}},je=Ae(Ce),Me=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ee(e)(t,n,i)},Ne=e=>(t,n,r)=>Ee(e)(t,n,r),Pe=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return De(e)(t,n,i)},Fe=e=>async(t,n,r)=>De(e)(t,n,r),Ie=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Oe(e)(t,n,i)},Le=e=>(t,n,r)=>Oe(e)(t,n,r),Re=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ae(e)(t,n,i)},ze=e=>async(t,n,r)=>Ae(e)(t,n,r),Be=/^[cC][0-9a-z]{6,}$/,Ve=/^[0-9a-z]+$/,He=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ue=/^[0-9a-vA-V]{20}$/,We=/^[A-Za-z0-9]{27}$/,Ge=/^[a-zA-Z0-9_-]{21}$/,Ke=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,qe=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Je=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ye=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Xe=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Ze(){return new RegExp(Xe,`u`)}var Qe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,$e=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,et=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,tt=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,rt=/^[A-Za-z0-9_-]*$/,it=/^https?$/,at=/^\+[1-9]\d{6,14}$/,ot=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,st=RegExp(`^${ot}$`);function ct(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function lt(e){return RegExp(`^${ct(e)}$`)}function ut(e){let t=ct({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${ot}T(?:${r})$`)}var dt=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},ft=/^-?\d+$/,pt=/^-?\d+(?:\.\d+)?$/,mt=/^(?:true|false)$/i,ht=/^null$/i,gt=/^[^A-Z]*$/,_t=/^[^a-z]*$/,E=a(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),vt={number:`number`,bigint:`bigint`,object:`date`},yt=a(`$ZodCheckLessThan`,(e,t)=>{E.init(e,t);let n=vt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),bt=a(`$ZodCheckGreaterThan`,(e,t)=>{E.init(e,t);let n=vt[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),xt=a(`$ZodCheckMultipleOf`,(e,t)=>{E.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):te(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),St=a(`$ZodCheckNumberFormat`,(e,t)=>{E.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ue[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=ft)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Ct=a(`$ZodCheckMaxLength`,(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!p(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=be(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wt=a(`$ZodCheckMinLength`,(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!p(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=be(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Tt=a(`$ZodCheckLengthEquals`,(e,t)=>{var n;E.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!p(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=be(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Et=a(`$ZodCheckStringFormat`,(e,t)=>{var n,r;E.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Dt=a(`$ZodCheckRegex`,(e,t)=>{Et.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Ot=a(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=gt,Et.init(e,t)}),kt=a(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=_t,Et.init(e,t)}),At=a(`$ZodCheckIncludes`,(e,t)=>{E.init(e,t);let n=y(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),jt=a(`$ZodCheckStartsWith`,(e,t)=>{E.init(e,t);let n=RegExp(`^${y(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Mt=a(`$ZodCheckEndsWith`,(e,t)=>{E.init(e,t);let n=RegExp(`.*${y(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Nt=a(`$ZodCheckOverwrite`,(e,t)=>{E.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Pt=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
2
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
|
|
3
|
+
`))}},Ft={major:4,minor:4,patch:3},D=a(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ft;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=S(e),i;for(let a of t){if(a._zod.def.when){if(ve(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=a._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new o;if(i||s instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await s,e.issues.length!==t&&(r||=S(e,t))});else{if(e.issues.length===t)continue;r||=S(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(S(n))return n.aborted=!0,n;let s=t(i,r,a);if(s instanceof Promise){if(a.async===!1)throw new o;return s.then(t=>e._zod.parse(t,a))}return e._zod.parse(s,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let s=e._zod.parse(i,a);if(s instanceof Promise){if(a.async===!1)throw new o;return s.then(e=>t(e,r,a))}return t(s,r,a)}}m(e,`~standard`,()=>({validate:t=>{try{let n=ke(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return je(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),It=a(`$ZodString`,(e,t)=>{D.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??dt(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),O=a(`$ZodStringFormat`,(e,t)=>{Et.init(e,t),It.init(e,t)}),Lt=a(`$ZodGUID`,(e,t)=>{t.pattern??=qe,O.init(e,t)}),Rt=a(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Je(e)}else t.pattern??=Je();O.init(e,t)}),zt=a(`$ZodEmail`,(e,t)=>{t.pattern??=Ye,O.init(e,t)}),Bt=a(`$ZodURL`,(e,t)=>{O.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===it.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Vt=a(`$ZodEmoji`,(e,t)=>{t.pattern??=Ze(),O.init(e,t)}),Ht=a(`$ZodNanoID`,(e,t)=>{t.pattern??=Ge,O.init(e,t)}),Ut=a(`$ZodCUID`,(e,t)=>{t.pattern??=Be,O.init(e,t)}),Wt=a(`$ZodCUID2`,(e,t)=>{t.pattern??=Ve,O.init(e,t)}),Gt=a(`$ZodULID`,(e,t)=>{t.pattern??=He,O.init(e,t)}),Kt=a(`$ZodXID`,(e,t)=>{t.pattern??=Ue,O.init(e,t)}),qt=a(`$ZodKSUID`,(e,t)=>{t.pattern??=We,O.init(e,t)}),Jt=a(`$ZodISODateTime`,(e,t)=>{t.pattern??=ut(t),O.init(e,t)}),Yt=a(`$ZodISODate`,(e,t)=>{t.pattern??=st,O.init(e,t)}),Xt=a(`$ZodISOTime`,(e,t)=>{t.pattern??=lt(t),O.init(e,t)}),Zt=a(`$ZodISODuration`,(e,t)=>{t.pattern??=Ke,O.init(e,t)}),Qt=a(`$ZodIPv4`,(e,t)=>{t.pattern??=Qe,O.init(e,t),e._zod.bag.format=`ipv4`}),$t=a(`$ZodIPv6`,(e,t)=>{t.pattern??=$e,O.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),en=a(`$ZodCIDRv4`,(e,t)=>{t.pattern??=et,O.init(e,t)}),tn=a(`$ZodCIDRv6`,(e,t)=>{t.pattern??=tt,O.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function nn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var rn=a(`$ZodBase64`,(e,t)=>{t.pattern??=nt,O.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{nn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function an(e){if(!rt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return nn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var on=a(`$ZodBase64URL`,(e,t)=>{t.pattern??=rt,O.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{an(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),sn=a(`$ZodE164`,(e,t)=>{t.pattern??=at,O.init(e,t)});function cn(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var ln=a(`$ZodJWT`,(e,t)=>{O.init(e,t),e._zod.check=n=>{cn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),un=a(`$ZodNumber`,(e,t)=>{D.init(e,t),e._zod.pattern=e._zod.bag.pattern??pt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),dn=a(`$ZodNumberFormat`,(e,t)=>{St.init(e,t),un.init(e,t)}),fn=a(`$ZodBoolean`,(e,t)=>{D.init(e,t),e._zod.pattern=mt,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),pn=a(`$ZodNull`,(e,t)=>{D.init(e,t),e._zod.pattern=ht,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),mn=a(`$ZodAny`,(e,t)=>{D.init(e,t),e._zod.parse=e=>e}),hn=a(`$ZodUnknown`,(e,t)=>{D.init(e,t),e._zod.parse=e=>e}),gn=a(`$ZodNever`,(e,t)=>{D.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function _n(e,t,n){e.issues.length&&t.issues.push(...C(n,e.issues)),t.value[n]=e.value}var vn=a(`$ZodArray`,(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>_n(t,n,e))):_n(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function yn(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...C(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function bn(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=le(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function xn(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>yn(e,n,i,t,u,d))):yn(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Sn=a(`$ZodObject`,(e,t)=>{if(D.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=f(()=>bn(t));m(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=_,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>yn(n,t,e,s,r,i))):yn(a,t,e,s,r,i)}return i?xn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Cn=a(`$ZodObjectJIT`,(e,t)=>{Sn.init(e,t);let n=e._zod.parse,r=f(()=>bn(t)),i=e=>{let t=new Pt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=re(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=re(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
|
|
4
|
+
if (${n}.issues.length) {
|
|
5
|
+
if (${o} in input) {
|
|
6
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
7
|
+
...iss,
|
|
8
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
9
|
+
})));
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (${n}.value === undefined) {
|
|
14
|
+
if (${o} in input) {
|
|
15
|
+
newResult[${o}] = undefined;
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
newResult[${o}] = ${n}.value;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
`):c?t.write(`
|
|
22
|
+
if (${n}.issues.length) {
|
|
23
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
24
|
+
...iss,
|
|
25
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
26
|
+
})));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (${n}.value === undefined) {
|
|
30
|
+
if (${o} in input) {
|
|
31
|
+
newResult[${o}] = undefined;
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
newResult[${o}] = ${n}.value;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
`):t.write(`
|
|
38
|
+
const ${n}_present = ${o} in input;
|
|
39
|
+
if (${n}.issues.length) {
|
|
40
|
+
payload.issues = payload.issues.concat(${n}.issues.map(iss => ({
|
|
41
|
+
...iss,
|
|
42
|
+
path: iss.path ? [${o}, ...iss.path] : [${o}]
|
|
43
|
+
})));
|
|
44
|
+
}
|
|
45
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
46
|
+
payload.issues.push({
|
|
47
|
+
code: "invalid_type",
|
|
48
|
+
expected: "nonoptional",
|
|
49
|
+
input: undefined,
|
|
50
|
+
path: [${o}]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (${n}_present) {
|
|
55
|
+
if (${n}.value === undefined) {
|
|
56
|
+
newResult[${o}] = undefined;
|
|
57
|
+
} else {
|
|
58
|
+
newResult[${o}] = ${n}.value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
`)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=_,s=!c.jitless,l=s&&oe.value,u=t.catchall,d;e._zod.parse=(c,f)=>{d??=r.value;let p=c.value;return o(p)?s&&l&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),c=a(c,f),u?xn([],p,c,f,d,e):c):n(c,f):(c.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),c)}});function wn(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!S(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>w(e,r,l())))}),t)}var Tn=a(`$ZodUnion`,(e,t)=>{D.init(e,t),m(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),m(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),m(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),m(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>ee(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>wn(t,r,e,i)):wn(o,r,e,i)}}),En=a(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Tn.init(e,t);let n=e._zod.parse;m(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=f(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!_(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Dn=a(`$ZodIntersection`,(e,t)=>{D.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>kn(e,t,n)):kn(e,i,a)}});function On(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(v(e)&&v(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=On(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=On(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function kn(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),S(e))return e;let o=On(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var An=a(`$ZodRecord`,(e,t)=>{D.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!v(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>w(e,r,l())),input:c,path:[c],inst:e});continue}let u=o.value,d=t.valueType._zod.run({value:i[c],issues:[]},r);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&n.issues.push(...C(c,e.issues)),n.value[u]=e.value})):(d.issues.length&&n.issues.push(...C(c,d.issues)),n.value[u]=d.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&pt.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>w(e,r,l())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...C(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...C(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),jn=a(`$ZodEnum`,(e,t)=>{D.init(e,t);let n=u(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ce.has(typeof e)).map(e=>typeof e==`string`?y(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Mn=a(`$ZodLiteral`,(e,t)=>{if(D.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?y(e):e?y(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Nn=a(`$ZodTransform`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new s(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new o;return n.value=i,n.fallback=!0,n}});function Pn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Fn=a(`$ZodOptional`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ee(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Pn(e,r)):Pn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),In=a(`$ZodExactOptional`,(e,t)=>{Fn.init(e,t),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Ln=a(`$ZodNullable`,(e,t)=>{D.init(e,t),m(e._zod,`optin`,()=>t.innerType._zod.optin),m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${ee(e.source)}|null)$`):void 0}),m(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Rn=a(`$ZodDefault`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>zn(e,t)):zn(r,t)}});function zn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Bn=a(`$ZodPrefault`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Vn=a(`$ZodNonOptional`,(e,t)=>{D.init(e,t),m(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Hn(t,e)):Hn(i,e)}});function Hn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Un=a(`$ZodCatch`,(e,t)=>{D.init(e,t),e._zod.optin=`optional`,m(e._zod,`optout`,()=>t.innerType._zod.optout),m(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>w(e,n,l()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>w(e,n,l()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Wn=a(`$ZodPipe`,(e,t)=>{D.init(e,t),m(e._zod,`values`,()=>t.in._zod.values),m(e._zod,`optin`,()=>t.in._zod.optin),m(e._zod,`optout`,()=>t.out._zod.optout),m(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.in,n)):Gn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Gn(e,t.out,n)):Gn(r,t.out,n)}});function Gn(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Kn=a(`$ZodReadonly`,(e,t)=>{D.init(e,t),m(e._zod,`propValues`,()=>t.innerType._zod.propValues),m(e._zod,`values`,()=>t.innerType._zod.values),m(e._zod,`optin`,()=>t.innerType?._zod?.optin),m(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(qn):qn(r)}});function qn(e){return e.value=Object.freeze(e.value),e}var Jn=a(`$ZodCustom`,(e,t)=>{E.init(e,t),D.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Yn(t,n,r,e));Yn(i,n,r,e)}});function Yn(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(T(e))}}var Xn,Zn=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Qn(){return new Zn}(Xn=globalThis).__zod_globalRegistry??(Xn.__zod_globalRegistry=Qn());var k=globalThis.__zod_globalRegistry;function $n(e,t){return new e({type:`string`,...x(t)})}function er(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...x(t)})}function tr(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...x(t)})}function nr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...x(t)})}function rr(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...x(t)})}function ir(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...x(t)})}function ar(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...x(t)})}function or(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...x(t)})}function sr(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...x(t)})}function cr(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...x(t)})}function lr(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...x(t)})}function ur(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...x(t)})}function dr(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...x(t)})}function fr(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...x(t)})}function pr(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...x(t)})}function mr(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...x(t)})}function hr(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...x(t)})}function gr(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...x(t)})}function _r(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...x(t)})}function vr(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...x(t)})}function yr(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...x(t)})}function br(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...x(t)})}function xr(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...x(t)})}function Sr(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...x(t)})}function Cr(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...x(t)})}function wr(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...x(t)})}function Tr(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...x(t)})}function Er(e,t){return new e({type:`number`,checks:[],...x(t)})}function Dr(e,t){return new e({type:`number`,coerce:!0,checks:[],...x(t)})}function Or(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...x(t)})}function kr(e,t){return new e({type:`boolean`,...x(t)})}function Ar(e,t){return new e({type:`null`,...x(t)})}function jr(e){return new e({type:`any`})}function Mr(e){return new e({type:`unknown`})}function Nr(e,t){return new e({type:`never`,...x(t)})}function Pr(e,t){return new yt({check:`less_than`,...x(t),value:e,inclusive:!1})}function Fr(e,t){return new yt({check:`less_than`,...x(t),value:e,inclusive:!0})}function Ir(e,t){return new bt({check:`greater_than`,...x(t),value:e,inclusive:!1})}function Lr(e,t){return new bt({check:`greater_than`,...x(t),value:e,inclusive:!0})}function Rr(e,t){return new xt({check:`multiple_of`,...x(t),value:e})}function zr(e,t){return new Ct({check:`max_length`,...x(t),maximum:e})}function Br(e,t){return new wt({check:`min_length`,...x(t),minimum:e})}function Vr(e,t){return new Tt({check:`length_equals`,...x(t),length:e})}function Hr(e,t){return new Dt({check:`string_format`,format:`regex`,...x(t),pattern:e})}function Ur(e){return new Ot({check:`string_format`,format:`lowercase`,...x(e)})}function Wr(e){return new kt({check:`string_format`,format:`uppercase`,...x(e)})}function Gr(e,t){return new At({check:`string_format`,format:`includes`,...x(t),includes:e})}function Kr(e,t){return new jt({check:`string_format`,format:`starts_with`,...x(t),prefix:e})}function qr(e,t){return new Mt({check:`string_format`,format:`ends_with`,...x(t),suffix:e})}function A(e){return new Nt({check:`overwrite`,tx:e})}function Jr(e){return A(t=>t.normalize(e))}function Yr(){return A(e=>e.trim())}function Xr(){return A(e=>e.toLowerCase())}function Zr(){return A(e=>e.toUpperCase())}function Qr(){return A(e=>ie(e))}function $r(e,t,n){return new e({type:`array`,element:t,...x(n)})}function ei(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...x(n)})}function ti(e,t){let n=ni(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(T(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(T(r))}},e(t.value,t)),t);return n}function ni(e,t){let n=new E({check:`custom`,...x(t)});return n._zod.check=e,n}function ri(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??k,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function j(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,j(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&M(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ii(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
63
|
+
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ai(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:si(t,`input`,e.processors),output:si(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function M(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return M(r.element,n);if(r.type===`set`)return M(r.valueType,n);if(r.type===`lazy`)return M(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return M(r.innerType,n);if(r.type===`intersection`)return M(r.left,n)||M(r.right,n);if(r.type===`record`||r.type===`map`)return M(r.keyType,n)||M(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:M(r.in,n)||M(r.out,n);if(r.type===`object`){for(let e in r.shape)if(M(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(M(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(M(e,n))return!0;return!!(r.rest&&M(r.rest,n))}return!1}var oi=(e,t={})=>n=>{let r=ri({...n,processors:t});return j(e,r),ii(r,e),ai(r,e)},si=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ri({...i??{},target:a,io:t,processors:n});return j(e,o),ii(o,e),ai(o,e)},ci={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},li=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ci[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},ui=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},di=(e,t,n,r)=>{n.type=`boolean`},fi=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},pi=(e,t,n,r)=>{n.not={}},mi=(e,t,n,r)=>{let i=e._zod.def,a=u(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},hi=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},gi=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},_i=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},vi=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=j(a.element,t,{...r,path:[...r.path,`items`]})},yi=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=j(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=j(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},bi=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>j(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},xi=(e,t,n,r)=>{let i=e._zod.def,a=j(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=j(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Si=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=j(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=j(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=j(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Ci=(e,t,n,r)=>{let i=e._zod.def,a=j(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},wi=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ti=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ei=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Di=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Oi=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;j(o,t,r);let s=t.seen.get(e);s.ref=o},ki=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ai=(e,t,n,r)=>{let i=e._zod.def;j(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ji=a(`ZodISODateTime`,(e,t)=>{Jt.init(e,t),L.init(e,t)});function Mi(e){return Sr(ji,e)}var Ni=a(`ZodISODate`,(e,t)=>{Yt.init(e,t),L.init(e,t)});function Pi(e){return Cr(Ni,e)}var Fi=a(`ZodISOTime`,(e,t)=>{Xt.init(e,t),L.init(e,t)});function Ii(e){return wr(Fi,e)}var Li=a(`ZodISODuration`,(e,t)=>{Zt.init(e,t),L.init(e,t)});function Ri(e){return Tr(Li,e)}var N=a(`ZodError`,(e,t)=>{Se.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Te(e,t)},flatten:{value:t=>we(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,d,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,d,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),zi=Ee(N),Bi=De(N),Vi=Oe(N),Hi=Ae(N),Ui=Me(N),Wi=Ne(N),Gi=Pe(N),Ki=Fe(N),qi=Ie(N),Ji=Le(N),Yi=Re(N),Xi=ze(N),Zi=new WeakMap;function P(e,t,n){let r=Object.getPrototypeOf(e),i=Zi.get(r);if(i||(i=new Set,Zi.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var F=a(`ZodType`,(e,t)=>(D.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:si(e,`input`),output:si(e,`output`)}}),e.toJSONSchema=oi(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>zi(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Vi(e,t,n),e.parseAsync=async(t,n)=>Bi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Hi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ui(e,t,n),e.decode=(t,n)=>Wi(e,t,n),e.encodeAsync=async(t,n)=>Gi(e,t,n),e.decodeAsync=async(t,n)=>Ki(e,t,n),e.safeEncode=(t,n)=>qi(e,t,n),e.safeDecode=(t,n)=>Ji(e,t,n),e.safeEncodeAsync=async(t,n)=>Yi(e,t,n),e.safeDecodeAsync=async(t,n)=>Xi(e,t,n),P(e,`ZodType`,{check(...e){let t=this.def;return this.clone(g(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return b(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(so(e,t))},superRefine(e,t){return this.check(co(e,t))},overwrite(e){return this.check(A(e))},optional(){return Ua(this)},exactOptional(){return Ga(this)},nullable(){return qa(this)},nullish(){return Ua(qa(this))},nonoptional(e){return $a(this,e)},array(){return V(this)},or(e){return W([this,e])},and(e){return Ia(this,e)},transform(e){return ro(this,Va(e))},default(e){return Ya(this,e)},prefault(e){return Za(this,e)},catch(e){return to(this,e)},pipe(e){return ro(this,e)},readonly(){return ao(this)},describe(e){let t=this.clone();return k.add(t,{description:e}),t},meta(...e){if(e.length===0)return k.get(this);let t=this.clone();return k.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return k.get(e)?.description},configurable:!0}),e)),Qi=a(`_ZodString`,(e,t)=>{It.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>li(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,P(e,`_ZodString`,{regex(...e){return this.check(Hr(...e))},includes(...e){return this.check(Gr(...e))},startsWith(...e){return this.check(Kr(...e))},endsWith(...e){return this.check(qr(...e))},min(...e){return this.check(Br(...e))},max(...e){return this.check(zr(...e))},length(...e){return this.check(Vr(...e))},nonempty(...e){return this.check(Br(1,...e))},lowercase(e){return this.check(Ur(e))},uppercase(e){return this.check(Wr(e))},trim(){return this.check(Yr())},normalize(...e){return this.check(Jr(...e))},toLowerCase(){return this.check(Xr())},toUpperCase(){return this.check(Zr())},slugify(){return this.check(Qr())}})}),$i=a(`ZodString`,(e,t)=>{It.init(e,t),Qi.init(e,t),e.email=t=>e.check(er(ea,t)),e.url=t=>e.check(or(ra,t)),e.jwt=t=>e.check(xr(va,t)),e.emoji=t=>e.check(sr(ia,t)),e.guid=t=>e.check(tr(ta,t)),e.uuid=t=>e.check(nr(na,t)),e.uuidv4=t=>e.check(rr(na,t)),e.uuidv6=t=>e.check(ir(na,t)),e.uuidv7=t=>e.check(ar(na,t)),e.nanoid=t=>e.check(cr(aa,t)),e.guid=t=>e.check(tr(ta,t)),e.cuid=t=>e.check(lr(oa,t)),e.cuid2=t=>e.check(ur(sa,t)),e.ulid=t=>e.check(dr(ca,t)),e.base64=t=>e.check(vr(ha,t)),e.base64url=t=>e.check(yr(ga,t)),e.xid=t=>e.check(fr(la,t)),e.ksuid=t=>e.check(pr(ua,t)),e.ipv4=t=>e.check(mr(da,t)),e.ipv6=t=>e.check(hr(fa,t)),e.cidrv4=t=>e.check(gr(pa,t)),e.cidrv6=t=>e.check(_r(ma,t)),e.e164=t=>e.check(br(_a,t)),e.datetime=t=>e.check(Mi(t)),e.date=t=>e.check(Pi(t)),e.time=t=>e.check(Ii(t)),e.duration=t=>e.check(Ri(t))});function I(e){return $n($i,e)}var L=a(`ZodStringFormat`,(e,t)=>{O.init(e,t),Qi.init(e,t)}),ea=a(`ZodEmail`,(e,t)=>{zt.init(e,t),L.init(e,t)}),ta=a(`ZodGUID`,(e,t)=>{Lt.init(e,t),L.init(e,t)}),na=a(`ZodUUID`,(e,t)=>{Rt.init(e,t),L.init(e,t)}),ra=a(`ZodURL`,(e,t)=>{Bt.init(e,t),L.init(e,t)}),ia=a(`ZodEmoji`,(e,t)=>{Vt.init(e,t),L.init(e,t)}),aa=a(`ZodNanoID`,(e,t)=>{Ht.init(e,t),L.init(e,t)}),oa=a(`ZodCUID`,(e,t)=>{Ut.init(e,t),L.init(e,t)}),sa=a(`ZodCUID2`,(e,t)=>{Wt.init(e,t),L.init(e,t)}),ca=a(`ZodULID`,(e,t)=>{Gt.init(e,t),L.init(e,t)}),la=a(`ZodXID`,(e,t)=>{Kt.init(e,t),L.init(e,t)}),ua=a(`ZodKSUID`,(e,t)=>{qt.init(e,t),L.init(e,t)}),da=a(`ZodIPv4`,(e,t)=>{Qt.init(e,t),L.init(e,t)}),fa=a(`ZodIPv6`,(e,t)=>{$t.init(e,t),L.init(e,t)}),pa=a(`ZodCIDRv4`,(e,t)=>{en.init(e,t),L.init(e,t)}),ma=a(`ZodCIDRv6`,(e,t)=>{tn.init(e,t),L.init(e,t)}),ha=a(`ZodBase64`,(e,t)=>{rn.init(e,t),L.init(e,t)}),ga=a(`ZodBase64URL`,(e,t)=>{on.init(e,t),L.init(e,t)}),_a=a(`ZodE164`,(e,t)=>{sn.init(e,t),L.init(e,t)}),va=a(`ZodJWT`,(e,t)=>{ln.init(e,t),L.init(e,t)}),ya=a(`ZodNumber`,(e,t)=>{un.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r),P(e,`ZodNumber`,{gt(e,t){return this.check(Ir(e,t))},gte(e,t){return this.check(Lr(e,t))},min(e,t){return this.check(Lr(e,t))},lt(e,t){return this.check(Pr(e,t))},lte(e,t){return this.check(Fr(e,t))},max(e,t){return this.check(Fr(e,t))},int(e){return this.check(xa(e))},safe(e){return this.check(xa(e))},positive(e){return this.check(Ir(0,e))},nonnegative(e){return this.check(Lr(0,e))},negative(e){return this.check(Pr(0,e))},nonpositive(e){return this.check(Fr(0,e))},multipleOf(e,t){return this.check(Rr(e,t))},step(e,t){return this.check(Rr(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function R(e){return Er(ya,e)}var ba=a(`ZodNumberFormat`,(e,t)=>{dn.init(e,t),ya.init(e,t)});function xa(e){return Or(ba,e)}var Sa=a(`ZodBoolean`,(e,t)=>{fn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r)});function z(e){return kr(Sa,e)}var Ca=a(`ZodNull`,(e,t)=>{pn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r)});function wa(e){return Ar(Ca,e)}var Ta=a(`ZodAny`,(e,t)=>{mn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ea(){return jr(Ta)}var Da=a(`ZodUnknown`,(e,t)=>{hn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Oa(){return Mr(Da)}var ka=a(`ZodNever`,(e,t)=>{gn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r)});function B(e){return Nr(ka,e)}var Aa=a(`ZodArray`,(e,t)=>{vn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r),e.element=t.element,P(e,`ZodArray`,{min(e,t){return this.check(Br(e,t))},nonempty(e){return this.check(Br(1,e))},max(e,t){return this.check(zr(e,t))},length(e,t){return this.check(Vr(e,t))},unwrap(){return this.element}})});function V(e,t){return $r(Aa,e,t)}var ja=a(`ZodObject`,(e,t)=>{Cn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r),m(e,`shape`,()=>t.shape),P(e,`ZodObject`,{keyof(){return q(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Oa()})},loose(){return this.clone({...this._zod.def,catchall:Oa()})},strict(){return this.clone({...this._zod.def,catchall:B()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return pe(this,e)},safeExtend(e){return me(this,e)},merge(e){return he(this,e)},pick(e){return de(this,e)},omit(e){return fe(this,e)},partial(...e){return ge(Ha,this,e[0])},required(...e){return _e(Qa,this,e[0])}})});function H(e,t){return new ja({type:`object`,shape:e??{},...x(t)})}function Ma(e,t){return new ja({type:`object`,shape:e,catchall:B(),...x(t)})}function U(e,t){return new ja({type:`object`,shape:e,catchall:Oa(),...x(t)})}var Na=a(`ZodUnion`,(e,t)=>{Tn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e.options=t.options});function W(e,t){return new Na({type:`union`,options:e,...x(t)})}var Pa=a(`ZodDiscriminatedUnion`,(e,t)=>{Na.init(e,t),En.init(e,t)});function G(e,t,n){return new Pa({type:`union`,options:t,discriminator:e,...x(n)})}var Fa=a(`ZodIntersection`,(e,t)=>{Dn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xi(e,t,n,r)});function Ia(e,t){return new Fa({type:`intersection`,left:e,right:t})}var La=a(`ZodRecord`,(e,t)=>{An.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function K(e,t,n){return!t||!t._zod?new La({type:`record`,keyType:I(),valueType:e,...x(t)}):new La({type:`record`,keyType:e,valueType:t,...x(n)})}var Ra=a(`ZodEnum`,(e,t)=>{jn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>mi(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Ra({...t,checks:[],...x(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Ra({...t,checks:[],...x(r),entries:i})}});function q(e,t){return new Ra({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...x(t)})}var za=a(`ZodLiteral`,(e,t)=>{Mn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>hi(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function J(e,t){return new za({type:`literal`,values:Array.isArray(e)?e:[e],...x(t)})}var Ba=a(`ZodTransform`,(e,t)=>{Nn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_i(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new s(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(T(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(T(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Va(e){return new Ba({type:`transform`,transform:e})}var Ha=a(`ZodOptional`,(e,t)=>{Fn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ua(e){return new Ha({type:`optional`,innerType:e})}var Wa=a(`ZodExactOptional`,(e,t)=>{In.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ai(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ga(e){return new Wa({type:`optional`,innerType:e})}var Ka=a(`ZodNullable`,(e,t)=>{Ln.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ci(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function qa(e){return new Ka({type:`nullable`,innerType:e})}var Ja=a(`ZodDefault`,(e,t)=>{Rn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ti(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ya(e,t){return new Ja({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}var Xa=a(`ZodPrefault`,(e,t)=>{Bn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ei(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Za(e,t){return new Xa({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():se(t)}})}var Qa=a(`ZodNonOptional`,(e,t)=>{Vn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wi(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function $a(e,t){return new Qa({type:`nonoptional`,innerType:e,...x(t)})}var eo=a(`ZodCatch`,(e,t)=>{Un.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Di(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function to(e,t){return new eo({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var no=a(`ZodPipe`,(e,t)=>{Wn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oi(e,t,n,r),e.in=t.in,e.out=t.out});function ro(e,t){return new no({type:`pipe`,in:e,out:t})}var io=a(`ZodReadonly`,(e,t)=>{Kn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ki(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ao(e){return new io({type:`readonly`,innerType:e})}var oo=a(`ZodCustom`,(e,t)=>{Jn.init(e,t),F.init(e,t),e._zod.processJSONSchema=(t,n,r)=>gi(e,t,n,r)});function so(e,t={}){return ei(oo,e,t)}function co(e,t){return ti(e,t)}function lo(e){return Dr(ya,e)}U({seq:R(),ts:I(),stepId:I().optional(),type:I()}),H({id:I().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)});var Y=I().min(1).max(2048);H({cursor:Y.optional()}),H({cursor:Y.optional(),afterSeq:lo().int().nonnegative().optional()});var uo=H({seq:R(),ts:I(),stepId:I().optional(),type:I()}).catchall(Ea()),fo=H({events:V(uo),itemCount:R().int().min(0).max(100),olderCursor:Y.optional(),newerCursor:Y.optional(),liveCursor:Y,asOfSeq:R().int().nonnegative(),hasOlder:z()}),po=H({contextEvents:V(uo),asOfSeq:R().int().nonnegative()});H({checkoutId:I().optional(),name:I(),phase:q([`cloning`,`done`,`error`]),line:I().optional(),error:I().optional()});var X=q([`claude`,`codex`,`opencode`,`pi`]),mo=H({root:I(),branch:I(),remote:I().optional()}),ho=H({name:q([`claude`,`codex`,`opencode`,`pi`,`gh`,`git`]),available:z(),version:I().optional(),hint:I().optional()}),go=H({kind:J(`github`),available:z().optional(),reason:I().optional()}),_o=H({localHandoff:z(),followups:z(),singleProject:z(),automations:z(),tokenMetrics:z(),tokenUsageMetrics:z(),costMetrics:z()});H({version:I(),latestVersion:I().optional(),repoRoot:I(),repo:mo.nullable(),checks:V(ho),defaultRunner:X,forge:go.nullable(),capabilities:_o,projects:V(H({id:I(),name:I()})),bootProject:I()});var vo=q([`passing`,`failing`,`pending`]).nullable(),yo=H({kind:q([`issue`,`pr`]),number:R(),title:I(),author:I(),createdAt:I(),labels:V(I()),body:I(),url:I(),comments:R(),isDraft:z().optional(),additions:R().optional(),deletions:R().optional(),checks:vo.optional()});H({available:z(),reason:I().optional(),repo:I().optional(),syncedAt:I().optional(),issues:V(yo),prs:V(yo),labelColors:K(I(),I()).optional()}),G(`available`,[H({available:J(!0),checks:K(R(),vo)}),H({available:J(!1),reason:I()})]);var bo=q([`draft`,`review-required`,`changes-requested`,`checks-pending`,`checks-failing`,`ready`,`merged`,`closed`,`open`,`completed`,`not-planned`]),xo=R().nullable();G(`available`,[H({available:J(!0),prs:K(R(),bo),issues:K(R(),bo),recheckAfterMs:xo}),H({available:J(!1),reason:I(),recheckAfterMs:xo})]);var So=H({id:R(),author:I(),avatarUrl:I().optional(),createdAt:I(),body:I(),kind:q([`comment`,`review`]),reviewState:q([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:I()}),Co=q([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),wo=H({id:I(),kind:Co,actor:I(),avatarUrl:I().optional(),createdAt:I(),url:I().optional(),sha:I().optional(),message:I().optional(),checks:vo.optional(),label:H({name:I(),color:I().optional()}).optional(),subject:I().optional(),refNumber:R().optional(),refTitle:I().optional(),refIsPr:z().optional()});H({available:z(),reason:I().optional(),comments:V(So),truncated:z().optional(),events:V(wo).optional()});var To=q([`merge`,`squash`,`rebase`]),Eo=H({name:I(),state:q([`passing`,`failing`,`pending`,`unknown`]),required:z().nullable(),url:I().optional()}),Do=H({number:R(),title:I(),url:I(),state:q([`open`,`closed`,`merged`]),isDraft:z(),headRef:I(),baseRef:I(),headSha:I(),mergeable:q([`mergeable`,`conflicting`,`unknown`]),reviewDecision:q([`approved`,`changes-requested`,`review-required`,`unknown`]),checks:V(Eo),methods:V(To),defaultMethod:To.nullable(),eligibility:q([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:V(H({code:I(),message:I()})),canMerge:z(),canOverride:z()});G(`available`,[H({available:J(!0),mergeState:Do}),H({available:J(!1),reason:I()})]),H({merged:J(!0),number:R(),url:I(),method:To,mergeCommitSha:I().optional()});var Oo=H({path:I(),previousPath:I().optional(),status:q([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:R(),deletions:R(),patch:I().optional(),patchUnavailableReason:q([`binary`,`too-large`,`not-provided`]).optional(),truncated:z().optional()});G(`available`,[H({available:J(!0),number:R(),headSha:I(),files:V(Oo),additions:R(),deletions:R(),truncated:z(),reason:I().optional()}),H({available:J(!1),reason:I()})]);var ko=H({id:I().min(1),name:I().optional(),prompt:I().optional(),skill:I().optional(),model:I().optional(),runner:X.optional(),allowedTools:V(I()).optional(),bashAllowlist:V(I()).optional(),command:I().optional(),onFail:H({retry:I().min(1),max:R().int().positive().default(2)}).optional()}).refine(e=>!!e.command!=!!(e.prompt??e.skill),{message:`a step is either an agent step (prompt/skill) or a check step (command), not both`}),Ao=H({name:I(),description:I().optional(),steps:V(ko),source:q([`built-in`,`file`]),path:I().optional()}),jo=H({path:I(),message:I()});H({workflows:V(Ao),issues:V(jo)}),H({name:I().trim().min(1).max(80),description:I().max(2e3,`must be at most 2000 characters`).optional(),steps:V(ko).min(1).max(8).optional(),skills:V(I().trim().min(1)).min(1).max(8).optional(),overwrite:z().optional()}).refine(e=>!!e.steps!=!!e.skills,{message:`provide either "steps" or "skills", not both`}),H({path:I(),name:I()}),H({name:I(),description:I().optional(),steps:V(ko)}),H({ok:J(!0),path:I()}),H({name:I().optional(),steps:V(ko),rationale:I(),fallback:z()});var Mo=q([`queued`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`]),No=q([`monitoring`]),Po=q([`pending`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`,`skipped`]),Z=R().finite().nonnegative(),Fo=H({id:I(),name:I(),kind:q([`agent`,`check`]),status:Po,iterations:R(),tokensUsed:R(),inputTokens:Z.optional(),outputTokens:Z.optional(),usageInvocationsStarted:Z.optional(),usageInvocationsObserved:Z.optional(),usageTurnsStarted:Z.optional(),usageTurnsRecorded:Z.optional(),usageInvocationEpoch:Z.optional(),startedAt:I().optional(),finishedAt:I().optional(),error:I().optional(),sessionId:I().optional(),backend:X.optional(),profileId:I().optional(),costUsd:R().optional()}),Io=H({adds:R(),dels:R(),files:R(),repointed:z().optional()}),Lo=H({id:I(),text:I(),images:V(I()).optional(),createdAt:I()}),Ro=H({cpuPct:R(),rssBytes:R(),procCount:R()}),zo=H({id:I(),title:I(),titleSummary:I().optional(),diffStat:Io.optional(),workflow:I(),task:I(),queuedMessages:V(Lo).optional(),taskImages:V(I()).optional(),model:I().optional(),modelIdentity:I().optional(),runner:X.optional(),agentProfile:I().optional(),systemPrompt:I().optional(),generateFollowups:z().optional(),autonomous:z().optional(),automation:H({automationId:I(),automationRevision:R(),receiptId:I(),event:I(),githubUrl:I()}).optional(),status:Mo,activity:No.optional(),monitoringWakeAt:I().optional(),monitoringWakeCapReached:z().optional(),autoResumeAt:I().optional(),autoResumeAttempts:R().optional(),createdAt:I(),startedAt:I().optional(),finishedAt:I().optional(),tokensUsed:R(),inputTokens:Z.optional(),outputTokens:Z.optional(),costUsd:R().optional(),pullRequestUrl:I().optional(),referencedPullRequestUrl:I().optional(),prNumber:R().optional(),issueNumber:R().optional(),referencedIssueNumberSeeded:z().optional(),titleOrigin:q([`user`,`auto`,`marker`]).optional(),markerRefs:H({pr:R().optional(),issue:R().optional()}).optional(),referencedPrCandidates:V(I()).optional(),referencedIssueUrl:I().optional(),referencedIssueCandidates:V(I()).optional(),worktree:J(!1).optional(),worktreePath:I().optional(),branch:I().optional(),baseBranch:I().optional(),worktreeReclaimedAt:I().optional(),groupId:I().optional(),variant:I().optional(),peakRssBytes:R().optional(),peakProcCount:R().optional(),archived:z(),archivedAt:I().optional(),seenAt:I().optional(),currentStepId:I().optional(),error:I().optional(),steps:V(Fo),workflowDef:Ao.optional()});zo.extend({usage:Ro.optional()});var Bo=H({projectId:I(),id:I(),title:I(),titleSummary:I().optional(),titleOrigin:q([`user`,`auto`,`marker`]).optional(),status:Mo,activity:No.optional(),createdAt:I(),finishedAt:I().optional(),seenAt:I().optional(),archived:z(),autoResumeAt:I().optional(),workflow:I(),branch:I().optional(),startedAt:I().optional(),pullRequestUrl:I().optional(),referencedPullRequestUrl:I().optional(),prNumber:R().optional(),issueNumber:R().optional(),referencedIssueUrl:I().optional(),markerRefs:H({pr:R().optional(),issue:R().optional()}).optional(),costUsd:R().optional(),peakRssBytes:R().optional(),peakProcCount:R().optional(),usage:Ro.optional()}),Vo=K(I(),H({prs:K(R(),bo),issues:K(R(),bo)}));H({runs:V(Bo),referenceStatuses:Vo,perProjectLimit:R(),truncated:V(I())}),W([zo,H({runs:V(zo)})]),H({cancelled:z()}),H({cancelled:J(!0)}),H({archived:R()}),H({read:R()}),H({deleted:J(!0)}),H({finished:J(!0)}),H({continued:J(!0)}),H({url:I(),dryRun:z()}),W([H({delivered:J(!0)}),H({queued:J(!0),message:Lo}),H({deferred:J(!0)})]),H({message:Lo}),H({removed:J(!0)}),H({opened:J(!0),command:I()}),H({removed:J(!0)}),H({committed:J(!0),sha:I()}),H({pushed:J(!0),branch:I(),remote:I(),upstreamSet:z()}),H({commits:V(H({sha:I(),subject:I(),author:I(),when:I()}))});var Ho=H({id:I(),variant:I(),title:I(),status:Mo,archived:z(),tokensUsed:R(),inputTokens:Z.optional(),outputTokens:Z.optional(),costUsd:R().optional(),diffStat:I(),handoffExcerpt:I()});H({groupId:I(),runs:V(Ho)}),H({winner:zo.optional()});var Uo=H({mediaType:I().regex(/^image\//),data:I().min(1).max(7e6)}),Wo=H({workflow:I().min(1).optional(),steps:V(ko).min(1).max(8).optional(),task:I().min(1).max(1e5,`must be at most 100000 characters`),model:I().optional(),runner:X.optional(),agentProfile:I().max(64).optional(),variants:R().int().min(1).max(3).optional(),worktree:z().optional(),autonomous:z().optional(),generateFollowups:z().optional(),systemPrompt:I().trim().max(2e4,`must be at most 20000 characters`).optional().transform(e=>e||void 0),images:V(Uo).max(4).optional(),todoId:I().min(1).max(200,`must be at most 200 characters`).optional()});Wo.refine(e=>!!e.workflow!=!!e.steps,{message:`provide either "workflow" or "steps", not both`}),H({text:I().max(1e5).default(``),images:V(Uo).max(4).default([])}).refine(e=>e.text.trim().length>0||e.images.length>0,{message:`message needs text or at least one image`}),H({title:I().trim().min(1).max(300).optional(),task:I().trim().min(1).max(1e5).optional()});var Go=H({status:I(),path:I()}),Ko=H({hash:I(),subject:I(),author:I(),when:I()});W([H({info:wa(),status:V(B()),log:V(B()),branches:V(B()),baseBranch:wa()}),H({info:mo,status:V(Go),log:V(Ko),branches:V(I()),baseBranch:I().nullable()})]),H({branch:I(),created:z()});var qo=H({adds:R(),dels:R(),files:R()}),Jo=H({path:I(),oldPath:I().optional(),status:q([`added`,`modified`,`deleted`,`renamed`,`copied`]),adds:R(),dels:R(),binary:z(),image:z().optional(),patch:I()});H({files:V(Jo),stat:qo,repointedHead:H({headBranch:I(),taskBranch:I()}).optional()}),H({sha:I(),subject:I(),author:I(),when:I(),files:V(Jo),stat:qo});var Yo=H({name:I(),type:q([`dir`,`file`]),size:R().optional()});G(`type`,[H({type:J(`dir`),path:I(),entries:V(Yo)}),H({type:J(`file`),path:I(),size:R(),binary:z(),tooLarge:z(),content:I().optional()})]);var Xo=q([`queued`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`]);H({worktrees:V(H({runId:I(),title:I(),status:Xo,branch:I().nullable(),sizeBytes:R().nullable(),finishedAt:I().nullable(),reclaimable:z()})),totalBytes:R().nullable(),keep:R()}),H({reclaimed:V(I())});var Zo=H({id:I(),name:I(),root:I(),addedAt:I(),lastOpenedAt:I(),source:q([`local`,`checkout`]),status:q([`ok`,`missing`,`not-git`]),branch:I().optional(),forge:J(`github`).optional(),repoUrl:I().optional(),maxParallel:R().optional(),tags:V(I()).optional()});H({projects:V(Zo),bootProject:I(),projectsDir:I()}),H({project:Zo,error:I().optional()}),H({removed:J(!0),id:I()}),H({project:Zo}),H({maxParallel:R().int().min(1).max(16).nullable().optional(),tags:V(I().trim().min(1).max(32)).max(20).nullable().optional()}).refine(e=>e.maxParallel!==void 0||e.tags!==void 0,`specify maxParallel or tags`),H({url:I().trim().min(1).max(512),name:I().trim().max(128).optional(),checkoutId:I().trim().max(128).optional()});var Qo=H({name:I(),path:I(),isRepo:z()});H({path:I(),parent:I().nullable(),dirs:V(Qo),truncated:z()}),H({key:I()}),H({browseRoot:I(),projectsDir:I(),skillsAutoUpdate:z().nullable(),effectiveSkillsAutoUpdate:z(),composerDefaults:H({autonomous:z().nullable(),worktree:z().nullable(),inheritedAutonomous:W([z(),J(`source-dependent`)]),inheritedWorktree:z()}),resources:H({maxParallel:R(),maxMonitoringSessions:R(),monitoringWakeIntervalMinutes:R().nullable(),autoResumeOnUsageLimit:z(),memoryLimitMb:R().nullable(),worktreeRetentionDefault:R()}),agentDefaults:H({runner:X.optional(),models:H({claude:I().optional(),codex:I().optional(),opencode:I().optional(),pi:I().optional()}).optional()})}),H({browseRoot:I().trim().min(1).max(4096).optional(),projectsDir:I().trim().min(1).max(4096).optional(),skillsAutoUpdate:z().nullable().optional(),composerDefaults:H({autonomous:z().nullable().optional(),worktree:z().nullable().optional()}).optional(),agentDefaults:H({runner:X.nullable().optional(),models:H({claude:I().trim().min(1).max(200).nullable().optional(),codex:I().trim().min(1).max(200).nullable().optional(),opencode:I().trim().min(1).max(200).nullable().optional(),pi:I().trim().min(1).max(200).nullable().optional()}).optional()}).optional(),resources:H({maxParallel:R().int().min(1).max(16).optional(),maxMonitoringSessions:R().int().min(0).max(16).optional(),monitoringWakeIntervalMinutes:R().int().min(1).max(60).nullable().optional(),autoResumeOnUsageLimit:z().optional(),memoryLimitMb:R().int().min(0).max(1048576).nullable().optional(),worktreeRetentionDefault:R().int().min(0).max(1e3).optional()}).optional()});var $o=H({accent:q([`lime`,`violet`]).optional(),density:q([`comfortable`,`compact`,`ultra`]).optional(),width:q([`narrow`,`wide`]).optional()}),es=U({expandedColumns:K(I(),z()).optional()});U({lastTask:H({source:q([`workflow`,`skill`]),ref:I()}).optional(),recentSources:V(H({source:q([`workflow`,`skill`]),ref:I()})).optional(),lastWorktree:z().optional(),lastAutonomous:z().optional(),lastGenerateFollowups:z().optional(),skillUsage:K(I(),R()).optional(),runsView:q([`list`,`table`]).optional(),githubView:q([`issues`,`prs`]).optional(),appearance:$o.optional(),promptTemplates:V(H({id:I(),label:I(),text:I(),skills:V(I()).optional()})).optional(),dismissedSkillsBanner:z().optional()});var ts=Ma({projectId:I().min(1).max(64),pathname:I().min(1).max(2048).startsWith(`/p/`),search:I().max(4096).startsWith(`?`).optional(),hash:I().max(2048).startsWith(`#`).optional()}),ns=U({sidebar:U({collapsed:K(I(),z()).optional()}).optional(),dismissedProviderAuthFailures:H({claude:I().optional(),codex:I().optional(),opencode:I().optional(),pi:I().optional()}).optional(),appearance:$o.optional(),notifications:U({enabled:z().optional()}).optional(),taskTable:es.optional(),lastLocation:ts.optional(),importedSkills:V(I()).optional()}),rs=200,is=50;U({...ns.shape,sidebar:U({collapsed:K(I().min(1).max(64),z()).refine(e=>Object.keys(e).length<=rs,{message:`sidebar.collapsed must have at most ${rs} entries`}).optional()}).optional(),dismissedProviderAuthFailures:Ma({claude:I().min(1).max(128).optional(),codex:I().min(1).max(128).optional(),opencode:I().min(1).max(128).optional(),pi:I().min(1).max(128).optional()}).optional(),importedSkills:V(I().min(1).max(200)).max(rs).optional(),taskTable:es.extend({expandedColumns:K(I().min(1).max(64),z()).refine(e=>Object.keys(e).length<=is,{message:`taskTable.expandedColumns must have at most ${is} entries`}).optional()}).optional()}).superRefine((e,t)=>{Object.keys(e).length>rs&&t.addIssue({code:`custom`,message:`ui-state has too many keys (max ${rs})`})});var as=H({claude:I().optional(),codex:I().optional(),opencode:I().optional(),pi:I().optional()});H({baseBranch:I().nullable(),defaultRunner:X,systemPrompt:I().nullable(),defaultModels:as,modelsLocked:z(),maxParallel:R(),memoryLimitMb:R().nullable(),worktreeRetention:R(),liveTitleUpdates:z().nullable(),reviewGate:z().nullable()}),H({baseBranch:I().trim().min(1).max(200).nullable().optional(),defaultRunner:X.optional(),systemPrompt:I().trim().max(2e4).nullable().optional(),defaultModels:H({claude:I().trim().max(200).nullable().optional(),codex:I().trim().max(200).nullable().optional(),opencode:I().trim().max(200).nullable().optional(),pi:I().trim().max(200).nullable().optional()}).optional(),maxParallel:R().int().min(1).max(16).optional(),memoryLimitMb:R().int().min(0).max(1048576).nullable().optional(),worktreeRetention:R().int().min(0).max(1e3).nullable().optional(),liveTitleUpdates:z().nullable().optional(),reviewGate:z().nullable().optional()});var os=q([`idle`,`checking`,`available`,`updating`,`current`,`unavailable`,`error`]),ss=H({scope:q([`project`,`global`]),status:os,available:z(),skills:V(I()),checkedAt:I().nullable(),updatedAt:I().nullable(),reason:I().optional()});H({status:os,available:z(),autoUpdateEnabled:z(),inherited:z(),checkedAt:I().nullable(),updatedAt:I().nullable(),scopes:V(ss),needsUpgradeNotes:z()});var cs=X,ls=H({provider:cs,status:q([`connected`,`disconnected`,`not-installed`,`unknown`]),enabled:z().optional(),hint:I().optional(),authFailureId:I().optional(),profileId:I().optional()});H({providers:V(ls)}),G(`opened`,[H({opened:J(!0),command:I()}),H({opened:J(!1),connected:J(!0),command:I()})]);var us=q([`codex`,`opencode`]).options;function ds(e){return us.includes(e)}H({runner:X,models:V(H({id:I(),label:I(),description:I()})),source:q([`live`,`cache`,`unavailable`]),stale:z(),reason:I().optional()}),H({targets:V(H({id:I(),label:I(),icon:I().optional()}))}),H({target:I().trim().min(1,`target required`).max(200)}),H({opened:J(!0),path:I()}),H({name:I(),description:I().optional(),interactive:J(!0).optional(),body:I(),path:I(),source:q([`ai`,`cezar`,`agents`,`global`,`team`]),team:H({repo:I(),ref:I(),path:I(),dir:z(),commit:I().optional()}).optional()}),H({name:I(),description:I().optional()}),H({id:I(),ts:I().optional(),taskId:I().optional(),summary:I().min(1),action:I().optional(),prUrl:I().optional(),suggestedSkill:I().optional(),suggestedArgs:I().optional(),suggestedPrompt:I().optional(),runnable:z().optional(),startedTaskId:I().optional()}),H({removed:J(!0)}),H({run:zo});var fs=q([`json`,`jsonc`,`toml`,`markdown`]),ps=q([`user`,`project`,`local`]),ms=q([`settings`,`memory`,`mcp`]),hs=q([`tracked`,`gitignored`,`outside-repo`]),gs=H({id:I(),runners:V(X),kind:ms,scope:ps,label:I(),path:I(),format:fs,tracked:hs,seeded:z(),holdsMcp:z(),precedence:I(),hotReload:I().optional(),docsUrl:I(),exists:z(),size:R(),version:I().nullable(),writable:z(),readOnlyReason:I().optional()}),_s=H({path:I(),servers:V(I()),readable:z()});H({editable:z(),files:V(gs),userMcp:_s.nullable()}),H({id:I(),path:I(),exists:z(),content:I(),version:I().nullable()}),H({content:I().max(2e6),version:I().nullable()});var vs=`default`,ys=H({id:I(),label:I(),path:I(),exists:z()}),bs=H({id:I(),provider:cs,label:I(),configDir:I(),path:I(),exists:z(),looksValid:z(),isDefault:z(),status:ls.optional(),files:V(ys)});function xs(e){return e.isDefault?`default:${e.provider}`:e.id}var Ss=H({claude:I().optional(),codex:I().optional(),opencode:I().optional(),pi:I().optional()});H({editable:z(),profiles:V(bs),profileCapableProviders:V(cs),selections:K(I(),Ss),defaults:Ss}),H({projectId:I().min(1).max(64).nullable(),provider:cs,profileId:I().max(64).nullable()}),H({selections:K(I(),Ss),defaults:Ss}),H({status:ls}),H({available:z(),reason:I().optional(),fields:V(H({label:I(),value:I()}))}),H({file:I().min(1).max(200),target:I().min(1).max(64).optional()}),H({opened:J(!0),path:I()}),H({provider:cs,label:I().trim().max(200).optional(),configDir:I().trim().min(1).max(4096)}),H({profile:bs}),H({label:I().trim().max(200).optional(),configDir:I().trim().min(1).max(4096).optional()}),H({removed:J(!0),id:I()});var Cs=q([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),ws=H({authors:V(I()).optional(),assignees:V(I()).optional(),allLabels:V(I()).optional(),anyLabels:V(I()).optional(),excludeLabels:V(I()).optional(),changedLabels:V(I()).optional(),lookbackDays:R(),maxRecords:R()}),Ts=Wo.omit({task:!0,images:!0,todoId:!0,systemPrompt:!0}).extend({prompt:I(),variants:W([J(1),J(2),J(3)]).optional(),systemPrompt:I().optional()}),Es=H({id:I(),revision:R(),name:I(),description:I().optional(),enabled:z(),events:V(Cs),intervalSeconds:R(),filters:ws,task:Ts,createdAt:I(),updatedAt:I()}),Ds=H({timestamp:I(),tieBreaker:I().optional()}),Os=H({revision:R().optional(),baselineAt:I().optional(),cursor:Ds.optional(),frozenHighWatermark:Ds.extend({tieBreaker:I()}).optional(),backlogAfter:Ds.extend({tieBreaker:I()}).optional(),nextCheckAt:I().optional(),lastSuccessAt:I().optional(),etags:K(I(),I()).optional(),backoffUntil:I().optional(),consecutiveFailures:R().optional()}),ks=q([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`]),As=H({seq:R(),ts:I(),automationId:I(),revision:R(),event:Cs.optional(),result:ks,reason:I().optional(),durationMs:R().optional(),receiptId:I().optional(),runId:I().optional(),githubNumber:R().optional(),githubTitle:I().optional(),githubUrl:I().optional(),rateLimit:H({bucket:q([`core`,`search`]),remaining:R().optional(),resetAt:I().optional()}).optional()}),js=H({matches:R(),launched:R(),duplicates:R(),errors:R()}),Ms=Es.extend({state:Os.optional(),latestLog:As.optional(),counts:js});H({available:z(),reason:I().optional(),scheduler:H({state:q([`scheduled`,`idle`]),nextDue:I().optional()}),automations:V(Ms)}),H({automation:Es}),H({automation:Es,state:Os.optional(),latestLog:As.optional()}),H({id:I(),automationId:I(),mode:q([`preview`,`execute`]),status:q([`queued`,`running`,`complete`,`error`]),createdAt:I(),completedAt:I().optional(),matches:R().optional(),truncated:z().optional(),error:I().optional()}),H({checkId:I()}),H({records:V(As)}),H({receiptId:I(),runId:I()}),Es.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0}).extend({enable:z().optional()}).omit({enable:!0}).extend({enabled:z().optional(),expectedRevision:R()}),H({mode:q([`preview`,`execute`])});var Ns=`/api/v1`,Q=``;function Ps(e){Q=e.replace(/\/+$/,``)}function Fs(){return Q}var Is=null;function Ls(e){Is=e===``?null:e}function Rs(){return Is}function zs(){return Is??`default`}var Bs=/^\/(?:health$|models(?:$|[/?])|providers(?:$|[/?])|projects(?:$|[/?])|workspace\/|fs\/)/;function Vs(e){return`${Q}${Ns}${Hs(e)}`}function Hs(e){return Is===null||Bs.test(e)?e:`/p/${encodeURIComponent(Is)}${e}`}var Us=/^\/api(?:\/v1)?(\/.*)$/;function Ws(e){let t=/^[a-z][a-z0-9+.-]*:/i.exec(e);if(t){let n=e.indexOf(`//`,t[0].length);if(n!==t[0].length)return e;let r=e.indexOf(`/`,n+2);if(r===-1)return e;let i=e.slice(0,r),a=Gs(e.slice(r));return a===null?e:`${i}${a}`}let n=Gs(Q&&e.startsWith(Q)?e.slice(Q.length):e);return n===null?e:`${Q}${n}`}function Gs(e){let t=Us.exec(e);if(!t)return null;let n=t[1];return n.startsWith(`/p/`)?`${Ns}${n}`:`${Ns}${Hs(n)}`}var $=e(t(),1),Ks=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),qs=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Js=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),Ys=e=>{let t=Js(e);return t.charAt(0).toUpperCase()+t.slice(1)},Xs={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},Zs=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},Qs=(0,$.createContext)({}),$s=()=>(0,$.useContext)(Qs),ec=(0,$.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=$s()??{},ee=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,$.createElement)(`svg`,{ref:c,...Xs,width:t??l??Xs.width,height:t??l??Xs.height,stroke:e??f,strokeWidth:ee,className:Ks(`lucide`,p,i),...!a&&!Zs(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,$.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),tc=(e,t)=>{let n=(0,$.forwardRef)(({className:n,...r},i)=>(0,$.createElement)(ec,{ref:i,iconNode:t,className:Ks(`lucide-${qs(Ys(e))}`,`lucide-${e}`,n),...r}));return n.displayName=Ys(e),n},nc=r({extend:{classGroups:{shadow:[`shadow-modal`]}}});function rc(...e){return nc(n(e))}function ic(e){return typeof e==`string`&&/^https?:\/\//i.test(e)}export{Vs as a,zs as c,Ls as d,vs as f,fo as g,po as h,Ns as i,Ws as l,ds as m,ic as n,Fs as o,xs as p,tc as r,Rs as s,rc as t,Ps as u};
|