@wjarka/cezarion 0.14.8 → 0.14.9-dev.829
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +76 -2
- package/dist/application-update/bin-recovery.d.ts +5 -0
- package/dist/application-update/bin-recovery.js +96 -0
- package/dist/application-update/bin-recovery.js.map +1 -0
- package/dist/application-update/discovery.d.ts +22 -0
- package/dist/application-update/discovery.js +91 -0
- package/dist/application-update/discovery.js.map +1 -0
- package/dist/application-update/helper.d.ts +57 -0
- package/dist/application-update/helper.js +374 -0
- package/dist/application-update/helper.js.map +1 -0
- package/dist/application-update/launcher.d.ts +8 -0
- package/dist/application-update/launcher.js +53 -0
- package/dist/application-update/launcher.js.map +1 -0
- package/dist/application-update/lock.d.ts +4 -0
- package/dist/application-update/lock.js +70 -0
- package/dist/application-update/lock.js.map +1 -0
- package/dist/application-update/npm-process.d.ts +17 -0
- package/dist/application-update/npm-process.js +133 -0
- package/dist/application-update/npm-process.js.map +1 -0
- package/dist/application-update/service.d.ts +69 -0
- package/dist/application-update/service.js +456 -0
- package/dist/application-update/service.js.map +1 -0
- package/dist/artifacts/cli.d.ts +1 -0
- package/dist/artifacts/cli.js +32 -0
- package/dist/artifacts/cli.js.map +1 -0
- package/dist/artifacts/lifecycle.d.ts +4 -0
- package/dist/artifacts/lifecycle.js +42 -0
- package/dist/artifacts/lifecycle.js.map +1 -0
- package/dist/artifacts/resolve.d.ts +18 -0
- package/dist/artifacts/resolve.js +102 -0
- package/dist/artifacts/resolve.js.map +1 -0
- package/dist/artifacts/store.d.ts +8 -0
- package/dist/artifacts/store.js +323 -0
- package/dist/artifacts/store.js.map +1 -0
- package/dist/ci-wait/mcp.d.ts +3 -0
- package/dist/ci-wait/mcp.js +14 -3
- package/dist/ci-wait/mcp.js.map +1 -1
- package/dist/contract/application-update.d.ts +32 -0
- package/dist/contract/artifacts.d.ts +83 -0
- package/dist/contract/ask-schema.d.ts +32 -0
- package/dist/contract/ask.d.ts +2 -32
- package/dist/contract/conversations.d.ts +165 -0
- package/dist/contract/delegation.d.ts +39 -0
- package/dist/contract/events.d.ts +49 -0
- package/dist/contract/health.d.ts +12 -0
- package/dist/contract/index.d.ts +2 -0
- package/dist/contract/index.js +1374 -1247
- package/dist/contract/runs.d.ts +143 -0
- package/dist/contract/skills.d.ts +28 -0
- package/dist/core/agent-runner.d.ts +33 -4
- package/dist/core/agent-runner.js +5 -0
- package/dist/core/agent-runner.js.map +1 -1
- package/dist/core/claude-cli-runner.d.ts +6 -12
- package/dist/core/claude-cli-runner.js +89 -19
- package/dist/core/claude-cli-runner.js.map +1 -1
- package/dist/core/codex-app-server-runner.d.ts +2 -1
- package/dist/core/codex-app-server-runner.js +327 -92
- package/dist/core/codex-app-server-runner.js.map +1 -1
- package/dist/core/codex-app-server-transport.d.ts +13 -1
- package/dist/core/codex-app-server-transport.js +58 -17
- package/dist/core/codex-app-server-transport.js.map +1 -1
- package/dist/core/cursor-acp-runner.d.ts +4 -1
- package/dist/core/cursor-acp-runner.js +3 -0
- package/dist/core/cursor-acp-runner.js.map +1 -1
- package/dist/core/cursor-provider-error.js +3 -1
- package/dist/core/cursor-provider-error.js.map +1 -1
- package/dist/core/input-submissions.d.ts +14 -0
- package/dist/core/input-submissions.js +26 -0
- package/dist/core/input-submissions.js.map +1 -0
- package/dist/core/opencode-server-runner.d.ts +4 -1
- package/dist/core/opencode-server-runner.js +144 -21
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/pi-runner.d.ts +2 -1
- package/dist/core/pi-runner.js +72 -7
- package/dist/core/pi-runner.js.map +1 -1
- package/dist/delegation/cli.js +102 -6
- package/dist/delegation/cli.js.map +1 -1
- package/dist/delegation/conversations.js +13 -5
- package/dist/delegation/conversations.js.map +1 -1
- package/dist/delegation/input.d.ts +2 -1
- package/dist/delegation/input.js +6 -1
- package/dist/delegation/input.js.map +1 -1
- package/dist/delegation/provision.js +5 -3
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/questions.d.ts +19 -0
- package/dist/delegation/questions.js +45 -0
- package/dist/delegation/questions.js.map +1 -0
- package/dist/delegation/results.d.ts +1 -1
- package/dist/delegation/results.js +23 -13
- package/dist/delegation/results.js.map +1 -1
- package/dist/delegation/routes.d.ts +142 -15
- package/dist/delegation/routes.js +4 -1
- package/dist/delegation/routes.js.map +1 -1
- package/dist/delegation/service.d.ts +9 -5
- package/dist/delegation/service.js +106 -7
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +138 -11
- package/dist/index.js +72 -26
- package/dist/index.js.map +1 -1
- package/dist/open-url.d.ts +2 -0
- package/dist/open-url.js +20 -0
- package/dist/open-url.js.map +1 -0
- package/dist/release/snapshot.d.ts +3 -3
- package/dist/release/snapshot.js +6 -6
- package/dist/release/snapshot.js.map +1 -1
- package/dist/runs/client-request.d.ts +11 -0
- package/dist/runs/client-request.js +26 -0
- package/dist/runs/client-request.js.map +1 -0
- package/dist/runs/delegation-state.d.ts +17 -0
- package/dist/runs/event-history.js +6 -0
- package/dist/runs/event-history.js.map +1 -1
- package/dist/runs/store.d.ts +78 -6
- package/dist/runs/store.js +163 -1
- package/dist/runs/store.js.map +1 -1
- package/dist/server/server.d.ts +3761 -1648
- package/dist/server/server.js +170 -4
- package/dist/server/server.js.map +1 -1
- package/dist/task-cli/cli.d.ts +38 -0
- package/dist/task-cli/cli.js +463 -0
- package/dist/task-cli/cli.js.map +1 -0
- package/dist/task-cli/discovery.d.ts +22 -0
- package/dist/task-cli/discovery.js +95 -0
- package/dist/task-cli/discovery.js.map +1 -0
- package/dist/task-cli/http.d.ts +43 -0
- package/dist/task-cli/http.js +101 -0
- package/dist/task-cli/http.js.map +1 -0
- package/dist/task-cli/projections.d.ts +40 -0
- package/dist/task-cli/projections.js +45 -0
- package/dist/task-cli/projections.js.map +1 -0
- package/dist/task-cli/watch.d.ts +78 -0
- package/dist/task-cli/watch.js +336 -0
- package/dist/task-cli/watch.js.map +1 -0
- package/dist/workflows/run.d.ts +93 -0
- package/dist/workflows/run.js +816 -81
- package/dist/workflows/run.js.map +1 -1
- package/dist/workspace/projects-cli.js +1 -1
- package/package.json +3 -3
- package/scripts/mock-claude.mjs +38 -2
- package/scripts/mock-codex-app-server.mjs +98 -1
- package/scripts/mock-cursor-acp.mjs +3 -0
- package/scripts/mock-opencode-serve.mjs +69 -2
- package/scripts/mock-pi-rpc.mjs +63 -2
- package/web/dist/assets/agent-accounts-JPfZPgKn.js +1 -0
- package/web/dist/assets/centered-state-HwCqQkH3.js +43 -0
- package/web/dist/assets/collapsible-CTymFdL7.js +1 -0
- package/web/dist/assets/commit-list-BZpYGQl2.js +1 -0
- package/web/dist/assets/compare-variants-9VkybaQ7.js +1 -0
- package/web/dist/assets/{diff-tRE59UNb2.js → diff-CZcD4D1r2.js} +2 -2
- package/web/dist/assets/diff-controls-CpcHG3Mm.js +1 -0
- package/web/dist/assets/{diff-stat-Cgnl_hYF.js → diff-stat-Cn7rzy1H.js} +1 -1
- package/web/dist/assets/{diff-view-DN1ort7Q.js → diff-view-C46nHiP2.js} +2 -2
- package/web/dist/assets/dropdown-menu-_YAzCaoQ.js +1 -0
- package/web/dist/assets/git-toolbar-BvKDz6uS.js +1 -0
- package/web/dist/assets/github-CgjJCGrD.js +1 -0
- package/web/dist/assets/{image-preview-C2JGcBlC.js → image-preview-B618kDBH.js} +1 -1
- package/web/dist/assets/index-BJtve0Pm.js +7 -0
- package/web/dist/assets/index-D0WAgmTQ.css +1 -0
- package/web/dist/assets/markdown-CFWZnvMh.js +2 -0
- package/web/dist/assets/pill-QfwkuR50.js +1 -0
- package/web/dist/assets/project-router-CkAA39N5.js +1 -0
- package/web/dist/assets/prompt-templates-Cfna_S0T.js +15 -0
- package/web/dist/assets/repo-git-DgzgJ0cP.js +1 -0
- package/web/dist/assets/{run-diff-CyG0Nciv.js → run-diff-YbCEQn5I.js} +2 -2
- package/web/dist/assets/run-header-DMgIbr1d.js +1 -0
- package/web/dist/assets/skills-BW79kUTd.js +1 -0
- package/web/dist/assets/{tab-link-BWNp3mLY.js → tab-link-MIHvczEm.js} +1 -1
- package/web/dist/assets/task-changes-C96ekt94.js +1 -0
- package/web/dist/assets/task-commits-DBfcMZyG.js +1 -0
- package/web/dist/assets/task-files-BKpH8dKQ.js +2 -0
- package/web/dist/assets/task-thread-Bw_nQuTx.css +1 -0
- package/web/dist/assets/task-thread-Dnq7Ek6W.js +9 -0
- package/web/dist/assets/textarea-D2vAVgYW.js +1 -0
- package/web/dist/assets/thread-loading-NW8Mthco.js +1 -0
- package/web/dist/assets/token-metrics-D188e6_0.js +1 -0
- package/web/dist/assets/utils-DKheTxGD.js +64 -0
- package/web/dist/assets/workflows-BFY1hgp3.js +11 -0
- package/web/dist/assets/{zoomable-image-Z3JDnm0b.js → zoomable-image-YW3Qdrr_.js} +1 -1
- package/web/dist/index.html +14 -14
- package/web/dist/assets/agent-accounts-BZm_2WAv.js +0 -1
- package/web/dist/assets/alert-dialog-B422RI-k.js +0 -43
- package/web/dist/assets/collapsible-Cy_Fmkrd.js +0 -1
- package/web/dist/assets/commit-list-Dcnk7TnI.js +0 -1
- package/web/dist/assets/compare-variants-Ciqwvd_f.js +0 -1
- package/web/dist/assets/diff-controls-BGrXGi7O.js +0 -1
- package/web/dist/assets/dropdown-menu-dwDGT8MM.js +0 -1
- package/web/dist/assets/git-toolbar-UiHnGvE0.js +0 -1
- package/web/dist/assets/github-D-MrkbJ7.js +0 -1
- package/web/dist/assets/ibm-plex-mono-regular-BF3vfe7_.ttf +0 -0
- package/web/dist/assets/index-BszfYvBq.js +0 -7
- package/web/dist/assets/index-CWh4pKP3.css +0 -1
- package/web/dist/assets/markdown-C_IcKVQd.js +0 -2
- package/web/dist/assets/pill-BsbO6G7y.js +0 -1
- package/web/dist/assets/project-router-DbLkll25.js +0 -1
- package/web/dist/assets/prompt-templates-BlTGJB5W.js +0 -15
- package/web/dist/assets/repo-git-Bm3s6Why.js +0 -1
- package/web/dist/assets/run-header-IFyIGCey.js +0 -1
- package/web/dist/assets/skills-C-C4DVFY.js +0 -1
- package/web/dist/assets/task-changes-D2PHtWUW.js +0 -1
- package/web/dist/assets/task-commits-N5u9U0_R.js +0 -1
- package/web/dist/assets/task-files-BS7c7CFm.js +0 -2
- package/web/dist/assets/task-thread-BQFdz1dJ.css +0 -1
- package/web/dist/assets/task-thread-DGM2dZV-.js +0 -9
- package/web/dist/assets/textarea-FjaU370i.js +0 -1
- package/web/dist/assets/thread-loading-77sJ8Yu_.js +0 -1
- package/web/dist/assets/token-metrics-Clxh03bE.js +0 -1
- package/web/dist/assets/utils-PYYcpCFZ.js +0 -64
- package/web/dist/assets/workflows-Czl0ZfXH.js +0 -11
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Aa as r,At as i,G as a,Gt as o,Pt as s,X as ee,Y as te,_ as ne,d as c,f as l,fr as re,g as ie,h as ae,hr as oe,in as se,l as u,m as d,p as f,qi as ce,qt as le,sa as p,tn as ue,v as de,y as fe}from"./alert-dialog-B422RI-k.js";import{_ as pe,b as me,t as m,v as h}from"./utils-PYYcpCFZ.js";import{a as he,i as ge,r as _e}from"./agent-accounts-BZm_2WAv.js";import{E as ve,F as ye,M as be,j as xe,r as Se}from"./prompt-templates-BlTGJB5W.js";import{u as Ce}from"./project-router-DbLkll25.js";import{i as we,n as Te,r as Ee,t as De}from"./skills-DFBiAuJG.js";import{t as Oe}from"./use-submit-shortcut-KWJsC906.js";var g=n(),_=e(t(),1);function ke(e){if(!(e instanceof HTMLElement))return!1;let t=e.tagName;return t===`INPUT`||t===`TEXTAREA`||t===`SELECT`||e.isContentEditable?!0:e.closest(`[contenteditable=""], [contenteditable="true"]`)!==null}function Ae(e){return e instanceof HTMLElement&&e.closest(`[cmdk-input]`)!==null}function je(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||!e.metaKey&&!e.ctrlKey||e.altKey||e.shiftKey||e.repeat||ke(e.target)&&!Ae(e.target))}function v(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{je(t,e)&&(t.preventDefault(),n.current(t))};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function Me(e,t){return!(typeof e.key!=`string`||e.key.toLowerCase()!==t.toLowerCase()||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.repeat||ke(e.target))}function Ne(e,t=typeof navigator>`u`?``:navigator.platform){let n=e.toUpperCase();return/mac|iphone|ipad|ipod/i.test(t)?`⌘${n}`:`Ctrl+${n}`}function y(e,t){let n=_.useRef(t);_.useLayoutEffect(()=>{n.current=t}),_.useEffect(()=>{let t=t=>{Me(t,e)&&n.current(t)};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e])}function b({...e}){return(0,g.jsx)(l,{"data-slot":`sheet`,...e})}function x({...e}){return(0,g.jsx)(fe,{"data-slot":`sheet-trigger`,...e})}function Pe({...e}){return(0,g.jsx)(f,{"data-slot":`sheet-close`,...e})}function Fe({...e}){return(0,g.jsx)(ne,{"data-slot":`sheet-portal`,...e})}function S({className:e,...t}){return(0,g.jsx)(ie,{"data-slot":`sheet-overlay`,className:m(`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 Ie({className:e,children:t,side:n=`right`,showCloseButton:r=!0,overlayClassName:i,...a}){return(0,g.jsxs)(Fe,{children:[(0,g.jsx)(S,{className:i}),(0,g.jsxs)(d,{"data-slot":`sheet-content`,className:m(`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),...a,children:[t,r&&(0,g.jsxs)(f,{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,g.jsx)(ue,{className:`size-4`}),(0,g.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function C({className:e,...t}){return(0,g.jsx)(`div`,{"data-slot":`sheet-header`,className:m(`flex flex-col gap-1.5 p-4`,e),...t})}function Le({className:e,...t}){return(0,g.jsx)(de,{"data-slot":`sheet-title`,className:m(`font-semibold text-foreground`,e),...t})}function Re({className:e,...t}){return(0,g.jsx)(ae,{"data-slot":`sheet-description`,className:m(`text-sm text-muted-foreground`,e),...t})}function w(e){let[t,n]=_.useState(()=>Date.now());return _.useEffect(()=>{let t=setInterval(()=>n(Date.now()),e);return()=>clearInterval(t)},[e]),t}var ze={png:`image/png`,jpg:`image/jpeg`,jpeg:`image/jpeg`,gif:`image/gif`,webp:`image/webp`,svg:`image/svg+xml`,bmp:`image/bmp`,avif:`image/avif`,md:`text/markdown`,markdown:`text/markdown`,txt:`text/plain`,log:`text/plain`,pdf:`application/pdf`};function T(e){return h(e.type)?e.type:ze[e.name.split(`.`).pop()?.toLowerCase()??``]??null}async function Be(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),i=T(e)??`application/octet-stream`,a=me(i);return{mediaType:i,data:r,...a?{preview:`data:${i};base64,${r}`}:{},name:e.name||(a?`pasted image`:`pasted.${pe(i)}`),isImage:a}}function Ve(e,t){let n=[],r=[],i=t;for(let t of e){let e=t.name||`attachment`;if(T(t)===null){r.push(`${e} is not a supported attachment (images, PDF and plain-text files such as TXT or MD)`);continue}if(t.size>5242880){r.push(`${e} is too large (max 5 MB)`);continue}if(i>=4){r.push(`${e} skipped — max 4 attachments per message`);continue}n.push(t),i+=1}return{accepted:n,rejected:r}}var He=new Set([`/`,`@`]);function Ue(e,t){for(let n=t-1;n>=0;--n){let r=e[n];if(/\s/.test(r))return null;if(He.has(r))return n>0&&!/\s/.test(e[n-1])?null:{trigger:r,start:n,query:e.slice(n+1,t)}}return null}function We(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 Ge(){let e=window;return e.SpeechRecognition??e.webkitSpeechRecognition}function Ke(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 qe(e){let[t,n]=_.useState(null),r=_.useRef(null),i=_.useRef(``),[a]=_.useState(()=>Ge()!==void 0),o=_.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 _.useEffect(()=>o,[o]),{supported:a,recording:t,start:_.useCallback(()=>{if(r.current)return;let t=Ge();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=Ke(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:_.useCallback(()=>o(),[o]),finish:_.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 E(e,t){let n=Math.max(0,Math.floor((t-e)/1e3));return`${Math.floor(n/60)}:${String(n%60).padStart(2,`0`)}`}var Je=new Map,Ye={KeyA:`Yes, approved.`,KeyC:`Continue.`};function D({onSubmit:e,retainDraftUntilSuccess:t=!1,onStop:n,onFinish:ne,finishing:l=!1,secondaryAction:ie,stopOnEmpty:ae=!1,stopping:u=!1,emptySubmitLabel:d,compactFeedback:f=!1,idleFeedback:de,pendingLabel:fe=`Starting task…`,failureHint:pe=`Could not confirm submission. Check Tasks before you retry. Your draft is kept.`,clearOnSuccess:me=!0,onPendingChange:h,value:Ce,onValueChange:Ae,autoFocus:je=!1,mobileCollapsible:v=!1,mobileDisclosureKey:Me,footerStart:Ne,footerEnd:y,sessionControls:b,executionOptions:x,agentOptions:Pe,sendAriaLabel:Fe=`Send`,disabled:S=!1,disabledReason:Ie=`Session closed — Continue to reopen.`,allowEmptySubmit:C=!1,placeholder:Le=`Reply — / for skills, @ for files…`,ariaLabel:Re=`Reply to the agent`,autocompleteSkills:w=!0,quickReplies:ze=!1,getMentionCandidates:T,ref:He}){let[Ge,Ke]=(0,_.useState)(``),E=Ce??Ge,D=(0,_.useRef)(E);D.current=E;let Qe=(0,_.useRef)(Ae);Qe.current=Ae;let O=(0,_.useCallback)(e=>{let t=typeof e==`function`?e(D.current):e;Ke(t),Qe.current?.(t)},[]),[k,A]=(0,_.useState)([]),j=(0,_.useRef)(k);j.current=k;let[$e,et]=(0,_.useState)(!1),M=u||$e,N=(0,_.useRef)(M);N.current=M;let P=E.trim()!==``||k.length>0,tt=!P&&(n!==void 0&&ae||M),nt=!P&&!tt&&ne!==void 0,rt=tt||nt||!P&&d!==void 0,it=!P&&d?d:Fe,[F,I]=(0,_.useState)(!1),L=(0,_.useRef)(!1),at=(0,_.useRef)(0),R=(0,_.useRef)(!0);(0,_.useEffect)(()=>(R.current=!0,()=>{R.current=!1}),[]);let[z,B]=(0,_.useState)(null),V=M||t&&F,H=()=>N.current||t&&L.current,[U,W]=(0,_.useState)(null),[ot,st]=(0,_.useState)(``),[ct,lt]=(0,_.useState)(!1),G=(0,_.useRef)(null),K=(0,_.useId)(),ut=(0,_.useId)(),dt=(0,_.useRef)(new Map),ft=Me===void 0?dt.current:Je,pt=Me??`default`,[,mt]=(0,_.useReducer)(e=>e+1,0),q=ft.get(pt)??!1,ht=v&&!q,gt=(0,_.useRef)(null),J=(0,_.useRef)(null),_t=re(w&&ct),Y=oe(),vt=r(),X=qe(e=>p(e,{tone:`danger`}));(0,_.useEffect)(()=>{je&&G.current?.focus()},[]),(0,_.useImperativeHandle)(He,()=>({insertAtCaret:e=>{if(H())return;let t=G.current,n=Se(D.current,t?.selectionStart??D.current.length,e);O(n.text),J.current=n.caret,t?.focus()}}),[O,t]);let yt=(0,_.useCallback)(()=>{let e=G.current;if(!e||S||H()){W(null);return}let t=Ue(e.value,e.selectionStart??e.value.length);if(t?.trigger===`/`&&!w||t?.trigger===`@`&&T===void 0)return W(null);t?.trigger===`/`&<(!0),W(t)},[w,S,T,t]),Z=(0,_.useMemo)(()=>U===null?[]:U.trigger===`/`?Te(_t.data??[],U.query,Y.data?.skillUsage).map(e=>({value:`${e.name} ${e.path}`,insert:e.name,label:e.name,description:e.description,emphasized:we(e)})):(T?.()??[]).filter(e=>Ee(e,U.query)).map(e=>({value:e,insert:e,label:e,emphasized:!1})),[T,_t.data,U,Y.data?.skillUsage]),bt=Z.some(e=>e.value===ot)?ot:Z[0]?.value,xt=U!==null,St=(0,_.useCallback)(()=>W(null),[]),Ct=e=>{let t=G.current;if(!t||U===null||H())return;let n=t.selectionStart??t.value.length,r=We(t.value,U,n,e.insert);U.trigger===`/`&&Y.data!==void 0&&ce({skillUsage:De(Y.data.skillUsage,e.insert)}).then(()=>vt.invalidateQueries({queryKey:se.uiState})).catch(()=>{}),O(r.text),J.current=r.caret,W(null),t.focus()};(0,_.useLayoutEffect)(()=>{let e=J.current,t=G.current;e!==null&&t&&(t.setSelectionRange(e,e),J.current=null)},[E]),(0,_.useLayoutEffect)(()=>{let e=G.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,220)}px`)},[E,q]);let wt=(0,_.useCallback)(e=>{if(S||H())return;let n=at.current,r=Ve(e,j.current.length);for(let e of r.rejected)p(e,{tone:`danger`});for(let e of r.accepted)Be(e).then(e=>{!R.current||t&&L.current&&!N.current||n!==at.current||A(t=>t.length>=4?t:[...t,e])},()=>p(`${e.name||`Attachment`} could not be read — try attaching it again`,{tone:`danger`}))},[S,t]),Tt=e=>{let t=[...e.clipboardData?.items??[]].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>e!==null);t.length!==0&&(e.preventDefault(),wt(t))},Et=e=>{let t=[...e.dataTransfer?.files??[]];t.length!==0&&(e.preventDefault(),wt(t))},Q=(0,_.useCallback)(async(n,r,i)=>{let a=n.trim();if(!(S||u||L.current)&&!(a===``&&r.length===0&&!C)){L.current=!0,t&&(at.current+=1),I(!0),B(null),h?.(!0),W(null),i&&!t&&(O(``),A([]));try{await e(a,r.map(({mediaType:e,data:t})=>({mediaType:e,data:t}))),R.current&&t&&me&&(D.current===n&&O(``),j.current===r&&A([]))}catch(e){if(!R.current&&t)return;let a=e instanceof Error?e.message:String(e);t?B(a):(p(a,{tone:`danger`}),i&&(O(e=>e===``?n:`${n}\n${e}`),A(e=>[...r,...e].slice(0,4))))}finally{L.current=!1,R.current&&(h?.(!1),I(!1))}}},[C,S,u,e,t,me,h,O]),Dt=(0,_.useCallback)(()=>{S||u||L.current||Q(D.current,j.current,!0)},[S,u,Q]),Ot=async()=>{if(!(!n||u||L.current)){L.current=!0,I(!0),et(!0),B(null);try{await n()}catch(e){R.current&&B(e instanceof Error?e.message:String(e))}finally{L.current=!1,R.current&&(I(!1),et(!1))}}},kt=e=>{if(xt){if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),Z.length===0)return;let t=Z.findIndex(e=>e.value===bt),n=e.key===`ArrowDown`?1:-1,r=Z[(t+n+Z.length)%Z.length];st(r.value);return}if(e.key===`Escape`){e.preventDefault(),St();return}if((e.key===`Enter`||e.key===`Tab`)&&!e.shiftKey){let t=Z.find(e=>e.value===bt);if(t){e.preventDefault(),Ct(t);return}St()}}Oe({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.preventDefault(),Dt())};(0,_.useEffect)(()=>{if(!ze||S)return;let e=e=>{if(!e.altKey||e.metaKey||e.ctrlKey||e.repeat||ke(e.target))return;let t=Ye[e.code];t!==void 0&&(e.preventDefault(),Q(t,[],!1))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[S,ze,Q]);let At=e=>{if(S||N.current||L.current&&(e||t))return;let n=X.finish();if(n===``)return;let r=E.trim()===``?n:`${E.replace(/\s*$/,``)} ${n}`;if(e){t&&O(r),Q(r,k,!0);return}O(r),J.current=r.length,G.current?.focus()},$=X.recording,jt=X.supported?(0,g.jsxs)(c,{type:`button`,variant:`ghost`,size:`sm`,disabled:S||V,"aria-label":`Start dictation`,title:`Dictation`,className:m(`h-11 gap-1.5 px-2.5 text-xs font-medium text-muted-foreground md:h-8`,ht&&`hidden md:inline-flex`),onClick:()=>{H()||X.start()},children:[(0,g.jsx)(i,{"aria-hidden":`true`,className:`size-3.5`}),x||b?null:`Dictation`]}):null,Mt=nt?(0,g.jsxs)(c,{type:`button`,"data-slot":`composer-finish`,"aria-label":l?`Finishing…`:`Finish`,"aria-busy":l||void 0,title:`Close the session and mark this task done`,disabled:F||M||l,className:`h-11 w-auto gap-[7px] px-5 active:opacity-80`,onClick:()=>void ne?.(),children:[(0,g.jsx)(te,{"aria-hidden":`true`}),l?`Finishing…`:`Finish`]}):null,Nt=n||M?(0,g.jsxs)(c,{type:`button`,variant:`outline`,size:`icon-sm`,"aria-label":M?`Stopping…`:`Stop`,"aria-busy":M||void 0,title:M?`Waiting for execution to stop`:`Stop execution; keep existing work`,disabled:F||M,className:m(`h-11 min-w-11 active:opacity-80`,rt?`w-auto px-3`:`w-11`),onClick:()=>void Ot(),children:[(0,g.jsx)(o,{"aria-hidden":`true`,className:`size-3 fill-current`}),rt?M?`Stopping…`:`Stop`:null]}):null,Pt=M||F||z!==null||de!=null,Ft=(0,g.jsx)(g.Fragment,{children:t||n||u?(0,g.jsx)(`div`,{className:m(`overflow-y-auto text-xs leading-5 text-muted-foreground`,f&&!Pt?`h-0`:`px-3 pb-2 md:px-4`,f?Pt&&`min-h-6`:`h-24 md:h-20`),children:(0,g.jsx)(`div`,{id:`${K}-submission`,role:z===null?`status`:`alert`,"aria-atomic":`true`,tabIndex:z===null?void 0:0,className:`break-words`,children:M?`Stopping execution. Your draft is kept.`:F?fe:z===null?de??null:(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{className:`font-medium text-foreground`,children:z}),(0,g.jsx)(`p`,{children:pe})]})})}):null}),It=(0,g.jsxs)(`div`,{"data-slot":`composer-submit-row`,className:m(`ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1 md:flex-nowrap`,x&&`new-task-submission`),children:[x||b?null:jt,y?(0,g.jsx)(`div`,{id:ut,"data-slot":`composer-footer-end`,className:m(`min-w-0 flex-wrap items-center gap-1.5 md:flex-nowrap`,x&&`mr-auto`,v&&`max-md:[&_button]:min-h-11 max-md:[&_button]:min-w-11`,ht?`hidden md:flex`:`flex`),children:(0,g.jsx)(`div`,{className:`contents`,inert:V||void 0,children:y})}):null,(0,g.jsxs)(`div`,{className:`flex min-w-[100px] items-center justify-end gap-1`,"data-slot":`composer-actions`,children:[Nt??ie,Mt,!tt&&!nt?(0,g.jsxs)(c,{type:`button`,size:`icon-sm`,"aria-label":it,"aria-busy":F&&!M||void 0,disabled:S||F||M||!P&&!C,className:m(x?`h-12 w-full gap-2 px-6`:b?`h-11 w-auto gap-2 px-5`:`size-11`,!P&&d&&`w-auto px-3`,`active:opacity-80`),onClick:Dt,children:[!b&&!P&&d?(0,g.jsx)(ye,{"aria-hidden":`true`}):null,x||b||!P&&d?it:null,b||P||!d?(0,g.jsx)(a,{"aria-hidden":`true`}):null]}):null]})]});return(0,g.jsxs)(_e,{open:xt,onOpenChange:e=>e?void 0:St(),children:[(0,g.jsx)(ge,{asChild:!0,children:(0,g.jsxs)(`div`,{ref:gt,"data-slot":`composer`,"data-disabled":S||void 0,onDrop:Et,onDragOver:e=>e.preventDefault(),className:m(x&&`new-task-composer`,b&&`session-composer`,S&&`opacity-80`),children:[(0,g.jsxs)(`div`,{"data-slot":`composer-editor`,className:m(`rounded-xl border border-[var(--composer-border)] bg-card shadow-none transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-[3px] focus-within:ring-ring/15`,x&&`new-task-editor`),children:[k.length>0?(0,g.jsx)(`div`,{"data-slot":`composer-thumbs`,className:`flex flex-nowrap items-center gap-2 overflow-x-auto px-4 pt-3 md:flex-wrap md:overflow-visible`,children:k.map((e,t)=>(0,g.jsxs)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,title:V?`Attachment submitted`:`Click to remove`,disabled:V,className:m(`group relative shrink-0 overflow-hidden rounded-md border border-border`,e.isImage?`size-12`:`flex h-12 min-w-11 max-w-[200px] items-center gap-1.5 bg-muted/40 px-2.5 text-xs text-muted-foreground`),onClick:()=>{H()||A(e=>e.filter((e,n)=>n!==t))},children:[e.isImage?(0,g.jsx)(`img`,{src:e.preview,alt:``,className:`size-full object-cover`}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(s,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,g.jsx)(`span`,{className:`truncate`,children:e.name})]}),(0,g.jsx)(`span`,{className:`absolute inset-0 hidden items-center justify-center bg-background/70 group-hover:flex group-focus-visible:flex`,children:(0,g.jsx)(ue,{"aria-hidden":`true`,className:`size-4`})})]},`${e.name}-${t}`))}):null,(0,g.jsx)(`label`,{htmlFor:K,className:x?`hidden px-5 pt-5 text-xs text-muted-foreground md:block`:`sr-only`,children:x?`Task description`:Re}),(0,g.jsx)(`textarea`,{ref:G,id:K,autoComplete:`off`,rows:1,value:E,disabled:S,readOnly:V,"aria-busy":V||void 0,"aria-describedby":t?`${K}-submission`:void 0,"aria-label":Re,placeholder:S?Ie:Le,className:m(`block min-h-11 w-full resize-none bg-transparent px-3 pt-2.5 pb-1 text-base leading-normal outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed md:min-h-[54px] md:px-4 md:pt-3 md:text-sm`,ht?`max-h-11 md:max-h-[220px]`:`max-h-[220px]`),onChange:e=>{H()||(O(e.target.value),yt())},onKeyDown:kt,onSelect:yt,onPaste:Tt}),x?(0,g.jsxs)(`p`,{"data-slot":`composer-skill-hint`,className:`flex items-center gap-2 px-5 pt-3 pb-2 text-xs text-muted-foreground`,children:[(0,g.jsx)(le,{"aria-hidden":`true`,className:`size-[15px] shrink-0`}),`Type / for a skill or workflow`]}):null,b&&$?(0,g.jsx)(`div`,{"data-slot":`session-controls`,inert:V||void 0,children:b}):null,$?(0,g.jsxs)(`div`,{children:[(0,g.jsx)(Ze,{transcript:$.transcript,startedAt:$.startedAt,insertionDisabled:V,onCancel:X.cancel,onInsert:()=>At(!1),onInsertAndSend:()=>At(!0)}),Nt?(0,g.jsx)(`div`,{className:`flex justify-end px-2 pb-2`,children:Nt}):null]}):(0,g.jsxs)(`div`,{"data-slot":`composer-toolbar`,className:`flex flex-wrap items-center gap-1 gap-y-1 px-1.5 pt-1 pb-1.5 md:gap-y-1.5 md:px-2 md:pt-1.5 md:pb-2`,children:[b?(0,g.jsx)(`div`,{"data-slot":`session-controls`,inert:V||void 0,children:b}):null,(0,g.jsxs)(`div`,{"data-slot":`composer-footer-start`,className:m(`flex min-w-0 flex-wrap items-center gap-1`,x&&`w-full`),children:[(0,g.jsx)(Xe,{disabled:S||V,onFiles:wt}),v?(0,g.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`size-11 md:hidden`,"aria-label":q?`Collapse composer`:`Expand composer`,"aria-expanded":q,"aria-controls":y?`${K} ${ut}`:K,onClick:()=>{ft.set(pt,!q),mt()},children:(0,g.jsx)(ee,{"aria-hidden":`true`,className:m(`transition-transform motion-reduce:transition-none`,!q&&`rotate-180`)})}):null,(0,g.jsx)(`div`,{className:`contents`,inert:V||void 0,children:Ne}),x||b?(0,g.jsx)(`div`,{children:jt}):null]}),x?null:It]}),x?null:Ft]}),x?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`div`,{"data-slot":`composer-agent-options`,inert:V||void 0,children:Pe}),(0,g.jsx)(`div`,{"data-slot":`composer-execution-panel`,inert:V||void 0,children:x}),It,(0,g.jsx)(`div`,{"data-slot":`composer-feedback`,children:Ft})]}):null]})}),(0,g.jsx)(he,{side:`top`,align:`start`,sideOffset:8,className:`w-80 max-w-[calc(100vw-2rem)] p-0`,onOpenAutoFocus:e=>e.preventDefault(),onInteractOutside:e=>{gt.current?.contains(e.target)&&e.preventDefault()},children:(0,g.jsx)(ve,{shouldFilter:!1,value:bt??``,onValueChange:st,children:(0,g.jsx)(be,{"data-slot":`composer-menu`,"data-trigger":U?.trigger,className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] p-1`,children:Z.length===0?(0,g.jsx)(`p`,{className:`px-3 py-4 text-center text-xs text-muted-foreground`,children:U?.trigger===`@`?`No files seen in this session yet — full file search arrives with the Files tab.`:_t.isPending?`Loading skills…`:`No matching skills.`}):Z.map(e=>(0,g.jsxs)(xe,{value:e.value,"data-slot":`composer-menu-item`,"data-emphasized":e.emphasized||void 0,onSelect:()=>Ct(e),children:[(0,g.jsx)(`span`,{className:m(`shrink-0 truncate`,e.emphasized&&`font-semibold`,U?.trigger===`@`&&`font-mono text-xs`),children:e.label}),e.description?(0,g.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null]},e.value))})})})]})}function Xe({disabled:e,onFiles:t}){let n=(0,_.useRef)(null);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Attach files`,title:`Attach an image, PDF, TXT or MD file (or paste a screenshot)`,disabled:e,className:`size-11 text-muted-foreground`,onClick:()=>n.current?.click(),children:(0,g.jsx)(s,{"aria-hidden":`true`,className:`size-[15px]`})}),(0,g.jsx)(`input`,{ref:n,type:`file`,accept:`image/*,application/pdf,text/plain,text/markdown,.pdf,.txt,.md,.markdown,.log`,multiple:!0,className:`hidden`,"aria-hidden":`true`,tabIndex:-1,onChange:e=>{t([...e.target.files??[]]),e.target.value=``}})]})}function Ze({transcript:e,startedAt:t,insertionDisabled:n,onCancel:r,onInsert:i,onInsertAndSend:o}){let s=w(1e3);return(0,g.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,g.jsx)(`span`,{"aria-hidden":`true`,className:`size-2 flex-none animate-pulse rounded-full bg-danger motion-reduce:animate-none`}),(0,g.jsx)(`span`,{"data-slot":`dictation-timer`,className:`text-xs font-medium text-muted-foreground tabular-nums`,children:E(t,s)}),(0,g.jsx)(`span`,{"data-slot":`dictation-transcript`,"aria-live":`polite`,className:`min-w-0 flex-1 truncate text-sm text-foreground`,children:e===``?(0,g.jsx)(`span`,{className:`text-muted-foreground`,children:`Listening…`}):e}),(0,g.jsx)(c,{type:`button`,variant:`ghost`,size:`icon-sm`,"aria-label":`Cancel dictation`,className:`size-11 text-muted-foreground md:size-8`,onClick:r,children:(0,g.jsx)(ue,{"aria-hidden":`true`})}),(0,g.jsx)(c,{type:`button`,variant:`outline`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription`,className:`size-11 md:size-8`,onClick:i,children:(0,g.jsx)(te,{"aria-hidden":`true`})}),(0,g.jsx)(c,{type:`button`,size:`icon-sm`,disabled:n,"aria-label":`Insert transcription and send`,className:`size-11 md:size-8`,onClick:o,children:(0,g.jsx)(a,{"aria-hidden":`true`})})]})}function Qe(){return(0,g.jsx)(`div`,{"data-route":`task-thread`,className:`flex min-h-full flex-col`,children:(0,g.jsx)(u,{icon:(0,g.jsx)(Ce,{className:`motion-safe:animate-spin`}),tone:`neutral`,title:`Loading task…`,subtitle:`Fetching the run and its session transcript.`})})}export{Pe as a,C as c,Ne as d,v as f,b as i,Le as l,D as n,Ie as o,y as p,w as r,Re as s,Qe as t,x as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./utils-PYYcpCFZ.js";import{n}from"./markdown-C_IcKVQd.js";var r=e();function i(e){return e===void 0?`unknown`:new Intl.NumberFormat().format(e)}function a(e,t){return`Input tokens: ${i(e)}; output tokens: ${i(t)}`}function o(e,t,r=`compact`){let i=e===void 0?`—`:n(e),a=t===void 0?`—`:n(t);return r===`table`?`${i} / ${a}`:`IN ${i} · OUT ${a}`}function s({inputTokens:e,outputTokens:n,variant:i=`compact`,omitWhenUnknown:s=!0,className:c,title:l}){return s&&e===void 0&&n===void 0?null:(0,r.jsx)(`span`,{"data-slot":`directional-usage`,"aria-label":a(e,n),title:l,className:t(`font-mono tabular-nums`,c),children:o(e,n,i)})}function c(e){let t=e?.capabilities,n=t?.tokenMetrics!==!1;return{tokens:t?.tokenUsageMetrics??n,cost:t?.costMetrics??n}}export{o as i,s as n,a as r,c as t};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import{r as e,t}from"./bundle-mjs-BT31bpU6.js";var n;function r(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 i=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},a=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(n=globalThis).__zod_globalConfig??(n.__zod_globalConfig={});var o=globalThis.__zod_globalConfig;function s(e){return e&&Object.assign(o,e),o}function c(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 l(e,t){return typeof t==`bigint`?t.toString():t}function u(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}throw Error(`cached value already set`)}}}function d(e){return e==null}function f(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function p(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 ee=Symbol(`evaluating`);function m(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ee)return r===void 0&&(r=ee,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 te(e){return JSON.stringify(e)}function ne(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var re=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function _(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var ie=u(()=>{if(o.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 ae(e){return v(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var oe=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 se(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ce={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function le(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 ue(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 de(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 fe(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 pe(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 me(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 he(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 ge(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 _e(e){return typeof e==`string`?e:e?.message}function w(e,t,n){let r=e.message?e.message:_e(e.inst?._zod.def?.error?.(e))??_e(t?.error?.(e))??_e(n.customError?.(e))??_e(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 ve(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function ye(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var be=(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,l,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},xe=r(`$ZodError`,be),Se=r(`$ZodError`,be,{Parent:Error});function Ce(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 we(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 Te=e=>(t,n,r,a)=>{let o=r?{...r,async:!1}:{async:!1},c=t._zod.run({value:n,issues:[]},o);if(c instanceof Promise)throw new i;if(c.issues.length){let t=new((a?.Err)??e)(c.issues.map(e=>w(e,o,s())));throw re(t,a?.callee),t}return c.value},Ee=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,s())));throw re(t,i?.callee),t}return o.value},De=e=>(t,n,r)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new i;return o.issues.length?{success:!1,error:new(e??xe)(o.issues.map(e=>w(e,a,s())))}:{success:!0,data:o.value}},Oe=De(Se),ke=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,s())))}:{success:!0,data:a.value}},Ae=ke(Se),je=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Te(e)(t,n,i)},Me=e=>(t,n,r)=>Te(e)(t,n,r),Ne=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Ee(e)(t,n,i)},Pe=e=>async(t,n,r)=>Ee(e)(t,n,r),Fe=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return De(e)(t,n,i)},Ie=e=>(t,n,r)=>De(e)(t,n,r),Le=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return ke(e)(t,n,i)},Re=e=>async(t,n,r)=>ke(e)(t,n,r),ze=/^[cC][0-9a-z]{6,}$/,Be=/^[0-9a-z]+$/,Ve=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,He=/^[0-9a-vA-V]{20}$/,Ue=/^[A-Za-z0-9]{27}$/,We=/^[a-zA-Z0-9_-]{21}$/,Ge=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ke=/^([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})$/,qe=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)$/,Je=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Ye=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function Xe(){return new RegExp(Ye,`u`)}var Ze=/^(?:(?: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])$/,Qe=/^(([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}|:))$/,$e=/^((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])$/,et=/^(([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])$/,tt=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,nt=/^[A-Za-z0-9_-]*$/,rt=/^https?$/,it=/^\+[1-9]\d{6,14}$/,at=`(?:(?:\\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])))`,ot=RegExp(`^${at}$`);function st(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 ct(e){return RegExp(`^${st(e)}$`)}function lt(e){let t=st({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(`^${at}T(?:${r})$`)}var ut=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},dt=/^-?\d+$/,ft=/^-?\d+(?:\.\d+)?$/,pt=/^(?:true|false)$/i,mt=/^null$/i,ht=/^[^A-Z]*$/,gt=/^[^a-z]*$/,T=r(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),_t={number:`number`,bigint:`bigint`,object:`date`},vt=r(`$ZodCheckLessThan`,(e,t)=>{T.init(e,t);let n=_t[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})}}),yt=r(`$ZodCheckGreaterThan`,(e,t)=>{T.init(e,t);let n=_t[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})}}),bt=r(`$ZodCheckMultipleOf`,(e,t)=>{T.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):p(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})}}),xt=r(`$ZodCheckNumberFormat`,(e,t)=>{T.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ce[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=dt)}),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})}}),St=r(`$ZodCheckMaxLength`,(e,t)=>{var n;T.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(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=ve(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ct=r(`$ZodCheckMinLength`,(e,t)=>{var n;T.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(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=ve(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),wt=r(`$ZodCheckLengthEquals`,(e,t)=>{var n;T.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!d(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=ve(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})}}),Tt=r(`$ZodCheckStringFormat`,(e,t)=>{var n,r;T.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=()=>{})}),Et=r(`$ZodCheckRegex`,(e,t)=>{Tt.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})}}),Dt=r(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=ht,Tt.init(e,t)}),Ot=r(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=gt,Tt.init(e,t)}),kt=r(`$ZodCheckIncludes`,(e,t)=>{T.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})}}),At=r(`$ZodCheckStartsWith`,(e,t)=>{T.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})}}),jt=r(`$ZodCheckEndsWith`,(e,t)=>{T.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})}}),Mt=r(`$ZodCheckOverwrite`,(e,t)=>{T.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Nt=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
|
-
`))}},Pt={major:4,minor:4,patch:3},E=r(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pt;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),a;for(let o of t){if(o._zod.def.when){if(ge(e)||!o._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,s=o._zod.check(e);if(s instanceof Promise&&n?.async===!1)throw new i;if(a||s instanceof Promise)a=(a??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 a?a.then(()=>e):e},n=(n,a,o)=>{if(S(n))return n.aborted=!0,n;let s=t(a,r,o);if(s instanceof Promise){if(o.async===!1)throw new i;return s.then(t=>e._zod.parse(t,o))}return e._zod.parse(s,o)};e._zod.run=(a,o)=>{if(o.skipChecks)return e._zod.parse(a,o);if(o.direction===`backward`){let t=e._zod.parse({value:a.value,issues:[]},{...o,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,a,o)):n(t,a,o)}let s=e._zod.parse(a,o);if(s instanceof Promise){if(o.async===!1)throw new i;return s.then(e=>t(e,r,o))}return t(s,r,o)}}m(e,`~standard`,()=>({validate:t=>{try{let n=Oe(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ae(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Ft=r(`$ZodString`,(e,t)=>{E.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ut(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}}),D=r(`$ZodStringFormat`,(e,t)=>{Tt.init(e,t),Ft.init(e,t)}),It=r(`$ZodGUID`,(e,t)=>{t.pattern??=Ke,D.init(e,t)}),Lt=r(`$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??=qe(e)}else t.pattern??=qe();D.init(e,t)}),Rt=r(`$ZodEmail`,(e,t)=>{t.pattern??=Je,D.init(e,t)}),zt=r(`$ZodURL`,(e,t)=>{D.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===rt.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})}}}),Bt=r(`$ZodEmoji`,(e,t)=>{t.pattern??=Xe(),D.init(e,t)}),Vt=r(`$ZodNanoID`,(e,t)=>{t.pattern??=We,D.init(e,t)}),Ht=r(`$ZodCUID`,(e,t)=>{t.pattern??=ze,D.init(e,t)}),Ut=r(`$ZodCUID2`,(e,t)=>{t.pattern??=Be,D.init(e,t)}),Wt=r(`$ZodULID`,(e,t)=>{t.pattern??=Ve,D.init(e,t)}),Gt=r(`$ZodXID`,(e,t)=>{t.pattern??=He,D.init(e,t)}),Kt=r(`$ZodKSUID`,(e,t)=>{t.pattern??=Ue,D.init(e,t)}),qt=r(`$ZodISODateTime`,(e,t)=>{t.pattern??=lt(t),D.init(e,t)}),Jt=r(`$ZodISODate`,(e,t)=>{t.pattern??=ot,D.init(e,t)}),Yt=r(`$ZodISOTime`,(e,t)=>{t.pattern??=ct(t),D.init(e,t)}),Xt=r(`$ZodISODuration`,(e,t)=>{t.pattern??=Ge,D.init(e,t)}),Zt=r(`$ZodIPv4`,(e,t)=>{t.pattern??=Ze,D.init(e,t),e._zod.bag.format=`ipv4`}),Qt=r(`$ZodIPv6`,(e,t)=>{t.pattern??=Qe,D.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})}}}),$t=r(`$ZodCIDRv4`,(e,t)=>{t.pattern??=$e,D.init(e,t)}),en=r(`$ZodCIDRv6`,(e,t)=>{t.pattern??=et,D.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 tn(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var nn=r(`$ZodBase64`,(e,t)=>{t.pattern??=tt,D.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{tn(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function rn(e){if(!nt.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return tn(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var an=r(`$ZodBase64URL`,(e,t)=>{t.pattern??=nt,D.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{rn(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),on=r(`$ZodE164`,(e,t)=>{t.pattern??=it,D.init(e,t)});function sn(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 cn=r(`$ZodJWT`,(e,t)=>{D.init(e,t),e._zod.check=n=>{sn(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),ln=r(`$ZodNumber`,(e,t)=>{E.init(e,t),e._zod.pattern=e._zod.bag.pattern??ft,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}}),un=r(`$ZodNumberFormat`,(e,t)=>{xt.init(e,t),ln.init(e,t)}),dn=r(`$ZodBoolean`,(e,t)=>{E.init(e,t),e._zod.pattern=pt,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}}),fn=r(`$ZodNull`,(e,t)=>{E.init(e,t),e._zod.pattern=mt,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}}),pn=r(`$ZodAny`,(e,t)=>{E.init(e,t),e._zod.parse=e=>e}),mn=r(`$ZodUnknown`,(e,t)=>{E.init(e,t),e._zod.parse=e=>e}),hn=r(`$ZodNever`,(e,t)=>{E.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function gn(e,t,n){e.issues.length&&t.issues.push(...C(n,e.issues)),t.value[n]=e.value}var _n=r(`$ZodArray`,(e,t)=>{E.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=>gn(t,n,e))):gn(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function vn(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 yn(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=se(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function bn(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=>vn(e,n,i,t,u,d))):vn(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 xn=r(`$ZodObject`,(e,t)=>{if(E.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=u(()=>yn(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=>vn(n,t,e,s,r,i))):vn(a,t,e,s,r,i)}return i?bn(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),Sn=r(`$ZodObjectJIT`,(e,t)=>{xn.init(e,t);let n=e._zod.parse,r=u(()=>yn(t)),i=e=>{let t=new Nt([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=te(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=te(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,s=_,c=!o.jitless,l=c&&ie.value,d=t.catchall,f;e._zod.parse=(o,u)=>{f??=r.value;let p=o.value;return s(p)?c&&l&&u?.async===!1&&u.jitless!==!0?(a||=i(t.shape),o=a(o,u),d?bn([],p,o,u,f,e):o):n(o,u):(o.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),o)}});function Cn(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,s())))}),t)}var wn=r(`$ZodUnion`,(e,t)=>{E.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=>f(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=>Cn(t,r,e,i)):Cn(o,r,e,i)}}),Tn=r(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,wn.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=u(()=>{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)}}),En=r(`$ZodIntersection`,(e,t)=>{E.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])=>On(e,t,n)):On(e,i,a)}});function Dn(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=Dn(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=Dn(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 On(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=Dn(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var kn=r(`$ZodRecord`,(e,t)=>{E.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 c=new Set;for(let l of o)if(typeof l==`string`||typeof l==`number`||typeof l==`symbol`){c.add(typeof l==`number`?l.toString():l);let o=t.keyType._zod.run({value:l,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,s())),input:l,path:[l],inst:e});continue}let u=o.value,d=t.valueType._zod.run({value:i[l],issues:[]},r);d instanceof Promise?a.push(d.then(e=>{e.issues.length&&n.issues.push(...C(l,e.issues)),n.value[u]=e.value})):(d.issues.length&&n.issues.push(...C(l,d.issues)),n.value[u]=d.value)}let l;for(let e in i)c.has(e)||(l??=[],l.push(e));l&&l.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:l})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let c=t.keyType._zod.run({value:o,issues:[]},r);if(c instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&ft.test(o)&&c.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&&(c=e)}if(c.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:c.issues.map(e=>w(e,r,s())),input:o,path:[o],inst:e});continue}let l=t.valueType._zod.run({value:i[o],issues:[]},r);l instanceof Promise?a.push(l.then(e=>{e.issues.length&&n.issues.push(...C(o,e.issues)),n.value[c.value]=e.value})):(l.issues.length&&n.issues.push(...C(o,l.issues)),n.value[c.value]=l.value)}}return a.length?Promise.all(a).then(()=>n):n}}),An=r(`$ZodEnum`,(e,t)=>{E.init(e,t);let n=c(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>oe.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}}),jn=r(`$ZodLiteral`,(e,t)=>{if(E.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}}),Mn=r(`$ZodTransform`,(e,t)=>{E.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new a(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(e=>(n.value=e,n.fallback=!0,n));if(o instanceof Promise)throw new i;return n.value=o,n.fallback=!0,n}});function Nn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Pn=r(`$ZodOptional`,(e,t)=>{E.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(`^(${f(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=>Nn(e,r)):Nn(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Fn=r(`$ZodExactOptional`,(e,t)=>{Pn.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)}),In=r(`$ZodNullable`,(e,t)=>{E.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(`^(${f(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)}),Ln=r(`$ZodDefault`,(e,t)=>{E.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=>Rn(e,t)):Rn(r,t)}});function Rn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var zn=r(`$ZodPrefault`,(e,t)=>{E.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))}),Bn=r(`$ZodNonOptional`,(e,t)=>{E.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=>Vn(t,e)):Vn(i,e)}});function Vn(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 Hn=r(`$ZodCatch`,(e,t)=>{E.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,s()))},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,s()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Un=r(`$ZodPipe`,(e,t)=>{E.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=>Wn(e,t.in,n)):Wn(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Wn(e,t.out,n)):Wn(r,t.out,n)}});function Wn(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 Gn=r(`$ZodReadonly`,(e,t)=>{E.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(Kn):Kn(r)}});function Kn(e){return e.value=Object.freeze(e.value),e}var qn=r(`$ZodCustom`,(e,t)=>{T.init(e,t),E.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=>Jn(t,n,r,e));Jn(i,n,r,e)}});function Jn(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(ye(e))}}var Yn,Xn=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 Zn(){return new Xn}(Yn=globalThis).__zod_globalRegistry??(Yn.__zod_globalRegistry=Zn());var Qn=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 vt({check:`less_than`,...x(t),value:e,inclusive:!1})}function Fr(e,t){return new vt({check:`less_than`,...x(t),value:e,inclusive:!0})}function Ir(e,t){return new yt({check:`greater_than`,...x(t),value:e,inclusive:!1})}function Lr(e,t){return new yt({check:`greater_than`,...x(t),value:e,inclusive:!0})}function Rr(e,t){return new bt({check:`multiple_of`,...x(t),value:e})}function zr(e,t){return new St({check:`max_length`,...x(t),maximum:e})}function Br(e,t){return new Ct({check:`min_length`,...x(t),minimum:e})}function Vr(e,t){return new wt({check:`length_equals`,...x(t),length:e})}function Hr(e,t){return new Et({check:`string_format`,format:`regex`,...x(t),pattern:e})}function Ur(e){return new Dt({check:`string_format`,format:`lowercase`,...x(e)})}function Wr(e){return new Ot({check:`string_format`,format:`uppercase`,...x(e)})}function Gr(e,t){return new kt({check:`string_format`,format:`includes`,...x(t),includes:e})}function Kr(e,t){return new At({check:`string_format`,format:`starts_with`,...x(t),prefix:e})}function qr(e,t){return new jt({check:`string_format`,format:`ends_with`,...x(t),suffix:e})}function O(e){return new Mt({check:`overwrite`,tx:e})}function Jr(e){return O(t=>t.normalize(e))}function Yr(){return O(e=>e.trim())}function Xr(){return O(e=>e.toLowerCase())}function Zr(){return O(e=>e.toUpperCase())}function Qr(){return O(e=>ne(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(ye(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(ye(r))}},e(t.value,t)),t);return n}function ni(e,t){let n=new T({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??Qn,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 k(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,k(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`&&A(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 A(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 A(r.element,n);if(r.type===`set`)return A(r.valueType,n);if(r.type===`lazy`)return A(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 A(r.innerType,n);if(r.type===`intersection`)return A(r.left,n)||A(r.right,n);if(r.type===`record`||r.type===`map`)return A(r.keyType,n)||A(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:A(r.in,n)||A(r.out,n);if(r.type===`object`){for(let e in r.shape)if(A(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(A(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(A(e,n))return!0;return!!(r.rest&&A(r.rest,n))}return!1}var oi=(e,t={})=>n=>{let r=ri({...n,processors:t});return k(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 k(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=c(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=k(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]=k(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=k(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)=>k(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=k(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=k(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=k(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=k(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=k(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=k(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;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ti=(e,t,n,r)=>{let i=e._zod.def;k(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;k(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;k(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;k(o,t,r);let s=t.seen.get(e);s.ref=o},ki=(e,t,n,r)=>{let i=e._zod.def;k(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;k(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},ji=r(`ZodISODateTime`,(e,t)=>{qt.init(e,t),I.init(e,t)});function j(e){return Sr(ji,e)}var Mi=r(`ZodISODate`,(e,t)=>{Jt.init(e,t),I.init(e,t)});function Ni(e){return Cr(Mi,e)}var Pi=r(`ZodISOTime`,(e,t)=>{Yt.init(e,t),I.init(e,t)});function Fi(e){return wr(Pi,e)}var Ii=r(`ZodISODuration`,(e,t)=>{Xt.init(e,t),I.init(e,t)});function Li(e){return Tr(Ii,e)}var M=r(`ZodError`,(e,t)=>{xe.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>we(e,t)},flatten:{value:t=>Ce(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,l,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,l,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ri=Te(M),zi=Ee(M),Bi=De(M),Vi=ke(M),Hi=je(M),Ui=Me(M),Wi=Ne(M),Gi=Pe(M),Ki=Fe(M),qi=Ie(M),Ji=Le(M),Yi=Re(M),Xi=new WeakMap;function N(e,t,n){let r=Object.getPrototypeOf(e),i=Xi.get(r);if(i||(i=new Set,Xi.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 P=r(`ZodType`,(e,t)=>(E.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)=>Ri(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Bi(e,t,n),e.parseAsync=async(t,n)=>zi(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Vi(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Hi(e,t,n),e.decode=(t,n)=>Ui(e,t,n),e.encodeAsync=async(t,n)=>Wi(e,t,n),e.decodeAsync=async(t,n)=>Gi(e,t,n),e.safeEncode=(t,n)=>Ki(e,t,n),e.safeDecode=(t,n)=>qi(e,t,n),e.safeEncodeAsync=async(t,n)=>Ji(e,t,n),e.safeDecodeAsync=async(t,n)=>Yi(e,t,n),N(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(O(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 B(this)},or(e){return U([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 Qn.add(t,{description:e}),t},meta(...e){if(e.length===0)return Qn.get(this);let t=this.clone();return Qn.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 Qn.get(e)?.description},configurable:!0}),e)),Zi=r(`_ZodString`,(e,t)=>{Ft.init(e,t),P.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,N(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())}})}),Qi=r(`ZodString`,(e,t)=>{Ft.init(e,t),Zi.init(e,t),e.email=t=>e.check(er($i,t)),e.url=t=>e.check(or(na,t)),e.jwt=t=>e.check(xr(_a,t)),e.emoji=t=>e.check(sr(ra,t)),e.guid=t=>e.check(tr(ea,t)),e.uuid=t=>e.check(nr(ta,t)),e.uuidv4=t=>e.check(rr(ta,t)),e.uuidv6=t=>e.check(ir(ta,t)),e.uuidv7=t=>e.check(ar(ta,t)),e.nanoid=t=>e.check(cr(ia,t)),e.guid=t=>e.check(tr(ea,t)),e.cuid=t=>e.check(lr(aa,t)),e.cuid2=t=>e.check(ur(oa,t)),e.ulid=t=>e.check(dr(sa,t)),e.base64=t=>e.check(vr(ma,t)),e.base64url=t=>e.check(yr(ha,t)),e.xid=t=>e.check(fr(ca,t)),e.ksuid=t=>e.check(pr(la,t)),e.ipv4=t=>e.check(mr(ua,t)),e.ipv6=t=>e.check(hr(da,t)),e.cidrv4=t=>e.check(gr(fa,t)),e.cidrv6=t=>e.check(_r(pa,t)),e.e164=t=>e.check(br(ga,t)),e.datetime=t=>e.check(j(t)),e.date=t=>e.check(Ni(t)),e.time=t=>e.check(Fi(t)),e.duration=t=>e.check(Li(t))});function F(e){return $n(Qi,e)}var I=r(`ZodStringFormat`,(e,t)=>{D.init(e,t),Zi.init(e,t)}),$i=r(`ZodEmail`,(e,t)=>{Rt.init(e,t),I.init(e,t)}),ea=r(`ZodGUID`,(e,t)=>{It.init(e,t),I.init(e,t)}),ta=r(`ZodUUID`,(e,t)=>{Lt.init(e,t),I.init(e,t)});function L(e){return nr(ta,e)}var na=r(`ZodURL`,(e,t)=>{zt.init(e,t),I.init(e,t)}),ra=r(`ZodEmoji`,(e,t)=>{Bt.init(e,t),I.init(e,t)}),ia=r(`ZodNanoID`,(e,t)=>{Vt.init(e,t),I.init(e,t)}),aa=r(`ZodCUID`,(e,t)=>{Ht.init(e,t),I.init(e,t)}),oa=r(`ZodCUID2`,(e,t)=>{Ut.init(e,t),I.init(e,t)}),sa=r(`ZodULID`,(e,t)=>{Wt.init(e,t),I.init(e,t)}),ca=r(`ZodXID`,(e,t)=>{Gt.init(e,t),I.init(e,t)}),la=r(`ZodKSUID`,(e,t)=>{Kt.init(e,t),I.init(e,t)}),ua=r(`ZodIPv4`,(e,t)=>{Zt.init(e,t),I.init(e,t)}),da=r(`ZodIPv6`,(e,t)=>{Qt.init(e,t),I.init(e,t)}),fa=r(`ZodCIDRv4`,(e,t)=>{$t.init(e,t),I.init(e,t)}),pa=r(`ZodCIDRv6`,(e,t)=>{en.init(e,t),I.init(e,t)}),ma=r(`ZodBase64`,(e,t)=>{nn.init(e,t),I.init(e,t)}),ha=r(`ZodBase64URL`,(e,t)=>{an.init(e,t),I.init(e,t)}),ga=r(`ZodE164`,(e,t)=>{on.init(e,t),I.init(e,t)}),_a=r(`ZodJWT`,(e,t)=>{cn.init(e,t),I.init(e,t)}),va=r(`ZodNumber`,(e,t)=>{ln.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ui(e,t,n,r),N(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(ba(e))},safe(e){return this.check(ba(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(va,e)}var ya=r(`ZodNumberFormat`,(e,t)=>{un.init(e,t),va.init(e,t)});function ba(e){return Or(ya,e)}var xa=r(`ZodBoolean`,(e,t)=>{dn.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>di(e,t,n,r)});function z(e){return kr(xa,e)}var Sa=r(`ZodNull`,(e,t)=>{fn.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fi(e,t,n,r)});function Ca(e){return Ar(Sa,e)}var wa=r(`ZodAny`,(e,t)=>{pn.init(e,t),P.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Ta(){return jr(wa)}var Ea=r(`ZodUnknown`,(e,t)=>{mn.init(e,t),P.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Da(){return Mr(Ea)}var Oa=r(`ZodNever`,(e,t)=>{hn.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pi(e,t,n,r)});function ka(e){return Nr(Oa,e)}var Aa=r(`ZodArray`,(e,t)=>{_n.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>vi(e,t,n,r),e.element=t.element,N(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 B(e,t){return $r(Aa,e,t)}var ja=r(`ZodObject`,(e,t)=>{Sn.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>yi(e,t,n,r),m(e,`shape`,()=>t.shape),N(e,`ZodObject`,{keyof(){return K(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Da()})},loose(){return this.clone({...this._zod.def,catchall:Da()})},strict(){return this.clone({...this._zod.def,catchall:ka()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return de(this,e)},safeExtend(e){return fe(this,e)},merge(e){return pe(this,e)},pick(e){return le(this,e)},omit(e){return ue(this,e)},partial(...e){return me(Ha,this,e[0])},required(...e){return he(Qa,this,e[0])}})});function V(e,t){return new ja({type:`object`,shape:e??{},...x(t)})}function Ma(e,t){return new ja({type:`object`,shape:e,catchall:ka(),...x(t)})}function H(e,t){return new ja({type:`object`,shape:e,catchall:Da(),...x(t)})}var Na=r(`ZodUnion`,(e,t)=>{wn.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>bi(e,t,n,r),e.options=t.options});function U(e,t){return new Na({type:`union`,options:e,...x(t)})}var Pa=r(`ZodDiscriminatedUnion`,(e,t)=>{Na.init(e,t),Tn.init(e,t)});function W(e,t,n){return new Pa({type:`union`,options:t,discriminator:e,...x(n)})}var Fa=r(`ZodIntersection`,(e,t)=>{En.init(e,t),P.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=r(`ZodRecord`,(e,t)=>{kn.init(e,t),P.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Si(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function G(e,t,n){return!t||!t._zod?new La({type:`record`,keyType:F(),valueType:e,...x(t)}):new La({type:`record`,keyType:e,valueType:t,...x(n)})}var Ra=r(`ZodEnum`,(e,t)=>{An.init(e,t),P.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 K(e,t){return new Ra({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...x(t)})}var za=r(`ZodLiteral`,(e,t)=>{jn.init(e,t),P.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 q(e,t){return new za({type:`literal`,values:Array.isArray(e)?e:[e],...x(t)})}var Ba=r(`ZodTransform`,(e,t)=>{Mn.init(e,t),P.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 a(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ye(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(ye(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=r(`ZodOptional`,(e,t)=>{Pn.init(e,t),P.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=r(`ZodExactOptional`,(e,t)=>{Fn.init(e,t),P.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=r(`ZodNullable`,(e,t)=>{In.init(e,t),P.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=r(`ZodDefault`,(e,t)=>{Ln.init(e,t),P.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():ae(t)}})}var Xa=r(`ZodPrefault`,(e,t)=>{zn.init(e,t),P.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():ae(t)}})}var Qa=r(`ZodNonOptional`,(e,t)=>{Bn.init(e,t),P.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=r(`ZodCatch`,(e,t)=>{Hn.init(e,t),P.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=r(`ZodPipe`,(e,t)=>{Un.init(e,t),P.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=r(`ZodReadonly`,(e,t)=>{Gn.init(e,t),P.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=r(`ZodCustom`,(e,t)=>{qn.init(e,t),P.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(va,e)}var uo=V({senderRunId:L(),recipientRunId:L(),kind:K([`request`,`progress`,`follow-up`,`reply`]),requestId:L().optional()}).strict(),fo=uo.extend({id:L(),text:F().min(1).max(1e5),createdAt:j(),deadline:j().optional(),requestHash:F().regex(/^[0-9a-f]{64}$/),state:K([`accepted`,`continuation-required`,`destroyed`,`late`]),resumed:q(!0).optional(),instruction:F().max(2048).optional()}),po=V({requestId:L(),status:K([`replied`,`completed-without-reply`,`failed`,`cancelled`,`destroyed`,`timed-out`,`sender-closed`]),observedAt:j(),replyId:L().optional()}).strict(),mo=V({messages:B(fo).max(1024),outcomes:B(po).max(1024)}).strict();V({id:L(),recipientRunId:L(),kind:uo.shape.kind,requestId:L().optional(),text:F().min(1).max(1e5).refine(e=>e.trim().length>0),timeoutSeconds:R().int().min(1).max(1800).default(600),resume:z().optional()}).strict().refine(e=>(e.kind===`reply`||e.kind===`follow-up`)==(e.requestId!==void 0),{message:`Replies and follow-ups require a request ID; new messages must omit it`}).refine(e=>!e.resume||e.kind===`request`||e.kind===`progress`,{message:`--resume requires a new request or progress instruction`}),V({message:fo,delivery:K([`queued`,`delivered`,`not-delivered`]),outcome:po.optional()}).strict(),V({recipientRunId:L()}).strict(),V({requestId:L()}).strict(),V({requestIds:B(L()).min(1).max(32).refine(e=>new Set(e).size===e.length),mode:K([`one`,`any`,`all`]).optional(),timeoutSeconds:R().int().min(1).max(1800).default(600)}).strict().refine(e=>e.mode!==`one`||e.requestIds.length===1,{message:`one requires exactly one request`});var ho=K([`low`,`medium`,`high`,`xhigh`,`max`]),go=F().max(32).optional(),_o=K([`spawn`,`inspect`,`steer`,`stop`,`destroy`,`diff`,`wait`]),J=F().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/),vo=F().regex(/^[0-9a-f]{64}$/),yo=B(L()).min(1).max(32).refine(e=>new Set(e).size===e.length),bo=B(_o).max(7).refine(e=>new Set(e).size===e.length),xo=B(K([`process`,`worktree`,`branch`])).max(3).refine(e=>new Set(e).size===e.length),So=F().max(2e3),Co=V({ownerRunId:L(),resourceId:L(),kind:q(`owned-isolated`),path:F().min(1),branch:F().min(1),baselineSha:J}).strict(),wo=V({workerId:L(),status:K([`review`,`done`,`failed`,`cancelled`]),observedAt:j(),summary:F().max(4e3).optional(),revision:R().int().nonnegative().optional()}).strict(),To=K([`one`,`any`,`all`]),Y=V({id:L(),workerIds:B(L()).max(32).refine(e=>new Set(e).size===e.length),requestIds:B(L()).min(1).max(32).optional(),requestOutcomes:B(po).max(32).optional(),deadline:j(),mode:To.optional(),revisions:B(V({workerId:L(),revision:R().int().nonnegative()}).strict()).max(32).optional(),reason:K([`outcome`,`timeout`,`cancelled`,`message`]).optional(),phase:K([`registered`,`parked`,`wake-pending`]),outcomes:B(wo).max(32),wakeId:L().optional()}).strict(),Eo=V({requestedAt:j(),phase:K([`requested`,`terminating`,`cleaning`,`complete`,`incomplete`]),remaining:xo,error:So.optional()}).strict(),Do=V({requestId:L(),workerId:L(),requestHash:vo,deletion:V({phase:K([`pending`,`complete`]),revision:R().int().nonnegative(),resourceId:L(),generation:L()}).strict().optional()}).strict(),Oo=K([`claude`,`codex`,`opencode`,`pi`,`cursor`]),ko=F().min(1).max(4096).refine(e=>!/[\\\u0000-\u001f\u007f:]/.test(e)&&!e.startsWith(`/`)&&e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`)),Ao=W(`kind`,[V({kind:q(`baseline-file`),path:ko}).strict(),V({kind:q(`parent-attachment`),id:F().min(1).max(255).regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine(e=>!e.includes(`..`))}).strict()]),jo=V({text:F().max(1e5).optional(),artifacts:B(Ao).max(32).optional()}).strict(),Mo=V({source:Ao,path:F().min(1).max(8192),sha256:vo,bytes:R().int().min(0).max(2**53-1)}).strict(),No=V({text:F().max(1e5).optional(),inputs:B(Mo).max(32)}).strict(),Po=V({state:q(`unavailable`),reason:K([`no-assistant-output`,`missing`,`unreadable`,`unverified`]),detail:So.optional()}).strict(),Fo=V({state:q(`deleted`),reason:q(`missing`)}).strict(),Io=K([`running`,`review-ready`,`completed`,`failed`,`cancelled`]),Lo=W(`state`,[V({state:q(`available`),id:F().max(255),path:F().max(8192)}).strict(),Po.extend({id:F().max(255),path:F().max(8192)}),Fo.extend({id:F().max(255),path:F().max(8192)})]);V({result:V({workerId:L(),parentRunId:L(),revision:R().int().nonnegative(),observedAt:j(),status:K([`queued`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`]),outcome:K([`running`,`review-ready`,`completed`,`failed`,`cancelled`,`destroyed`]),lastExecutionOutcome:Io,partial:z(),settled:z(),error:So.optional(),backend:Oo.optional(),model:F().max(512).optional(),baselineSha:J,workspace:Co.extend({state:K([`available`,`unavailable`,`deleted`]).optional()}),cleanup:K([`retained`,`requested`,`terminating`,`cleaning`,`complete`,`incomplete`]),summary:W(`state`,[V({state:q(`available`),text:F().min(1).max(4e3),source:q(`assistant`),seq:R().int().nonnegative(),truncated:z()}).strict(),Po,Fo]),head:W(`state`,[V({state:q(`available`),sha:J}).strict(),Po.extend({sha:J.optional()}),Fo.extend({sha:J.optional()})]),diff:W(`state`,[V({state:q(`available`),snapshotId:L(),path:F().min(1).max(8192),truncated:z()}).strict(),Po,Fo]),artifacts:W(`state`,[V({state:q(`available`),items:B(Lo).max(32),truncated:z()}).strict(),Po,Fo])}).strict(),diffSnapshot:F().max(4e5).optional()}).strict();var Ro=V({workerId:L(),revision:R().int().nonnegative(),snapshotId:L(),observedAt:j(),lastExecutionOutcome:Io,previous:V({revision:R().int().nonnegative(),observedAt:j(),lastExecutionOutcome:Io}).strict().optional()}).strict(),zo=W(`role`,[V({role:q(`root`),conversation:mo.optional(),permissions:bo,receipts:B(Do).max(32).refine(e=>new Set(e.map(e=>e.requestId)).size===e.length&&new Set(e.map(e=>e.workerId)).size===e.length),wait:Y.optional(),lastWait:Y.optional(),results:B(Ro).max(32).refine(e=>new Set(e.map(e=>e.workerId)).size===e.length).optional(),finishRequestedAt:j().optional(),historyDeletion:q(`pending`).optional(),completion:V({phase:K([`waiting`,`attention`]),waitId:L().optional()}).strict().optional()}).strict(),V({role:q(`worker`),wait:Y.optional(),lastWait:Y.optional(),permissions:bo,parentRunId:L(),workspace:Co,destroy:Eo.optional(),context:No.optional(),executionRevision:R().int().nonnegative().optional(),executionStartSeq:R().int().nonnegative().optional()}).strict(),V({role:q(`invalid`)}).strict()]),Bo=W(`role`,[zo.options[0].pick({role:!0}).strip().extend({wait:Y.pick({phase:!0,requestIds:!0}).strip().optional()}),zo.options[1].pick({role:!0}).strip().extend({wait:Y.pick({phase:!0,requestIds:!0}).strip().optional()}),zo.options[2].strip()]);V({task:F().min(1).max(1e5),baseline:F().min(1).max(1024),requestId:L(),context:jo.optional(),backend:Oo.optional(),model:F().trim().min(1).max(512).optional(),effort:go,workflow:F().trim().min(1).max(200).optional()}).strict().refine(e=>e.task.length+(e.context?.text?.length??0)<=1e5,{message:`Combined task and context exceed 100000 characters`}),V({text:F().max(1e5).refine(e=>e.trim().length>0)}).strict(),V({workerIds:yo,timeoutSeconds:R().int().min(1).max(1800).default(600),mode:To.optional()}).strict().refine(e=>e.mode!==`one`||e.workerIds.length===1,{message:`one mode requires exactly one worker`});var Vo=V({conversation:uo.optional(),id:L(),source:K([`agent`,`lifecycle`]),parentRunId:L(),text:F().min(1).max(1e5),createdAt:j(),deliveredAt:j().optional()}).strict(),Ho=V({workerId:L(),parentRunId:L(),status:K([`queued`,`running`,`waiting`,...wo.shape.status.options]),currentStepId:F().optional(),activity:K([`monitoring`]).optional(),workspace:Co,backend:Oo.optional(),model:F().max(512).optional(),inputs:B(Mo).max(32).optional(),wait:Y.optional(),destroy:Eo.optional(),outcome:wo.optional()});V({workerId:L(),baselineSha:J,diff:F().max(4e5),truncated:z()}),V({workerId:L(),state:K([`stopping`,`terminated`])}),V({workerId:L(),state:K([`complete`,`incomplete`]),deleted:B(W(`kind`,[V({kind:q(`worktree`),path:F().max(8192)}).strict(),V({kind:q(`branch`),ref:F().max(1024)}).strict()])).max(2).optional(),remaining:xo,error:So.optional()});var Uo=V({parentRunId:L().optional(),workers:B(Ho).max(32)});V({code:K([`unavailable_transport`,`unauthenticated`,`denied_scope`,`invalid_input`,`invalid_baseline`,`incompatible_state`,`capacity_limit`,`unavailable_diff`,`incomplete_cleanup`]),error:So}),V({workerId:L()}).strict(),V({workerId:L(),baselineSha:J}).strict(),V({workerId:L(),state:K([`queued`,`delivered`])}).strict(),V({wait:Y,instruction:F().min(1).max(1e3)}).strict(),V({}).strict(),V({waitId:L()}).strict(),V({wait:Y}).strict();var Wo=H({seq:R(),ts:F(),stepId:F().optional(),type:F()}),Go=Wo.extend({type:q(`conversation-message`),message:fo,delivery:K([`queued`,`delivered`,`not-delivered`]),deliveredAt:j().optional()}),Ko=Wo.extend({type:q(`request-outcome`),outcome:po}),qo=Wo.extend({type:q(`agent-input`),input:Vo}),Jo=Wo.extend({type:q(`human-input-delivered`),askSeq:R().int().nonnegative()});Wo.extend({type:q(`worker-outcome`),outcome:wo}),V({id:F().min(1).max(128).regex(/^[A-Za-z0-9._-]+$/)});var Yo=F().min(1).max(2048);V({cursor:Yo.optional()}),V({cursor:Yo.optional(),afterSeq:lo().int().nonnegative().optional()});var Xo=V({seq:R(),ts:F(),stepId:F().optional(),type:F()}).catchall(Ta()),Zo=V({events:B(Xo),itemCount:R().int().min(0).max(100),olderCursor:Yo.optional(),newerCursor:Yo.optional(),liveCursor:Yo,asOfSeq:R().int().nonnegative(),hasOlder:z()}),Qo=V({contextEvents:B(Xo),asOfSeq:R().int().nonnegative()});V({checkoutId:F().optional(),name:F(),phase:K([`cloning`,`done`,`error`]),line:F().optional(),error:F().optional()});var $o=V({label:F().min(1).max(60),description:F().max(280).optional()}).strict(),es=V({questions:B(V({id:F().min(1).max(64).optional(),header:F().min(1).max(12),question:F().min(1).max(400),options:B($o).min(2).max(4).refine(e=>new Set(e.map(e=>e.label)).size===e.length,{message:`option labels must be unique within a question`}),multiSelect:z().optional()}).strict()).min(1).max(4).refine(e=>new Set(e.map(e=>e.question)).size===e.length,{message:`question texts must be unique`})}).strict();function ts(e,t){if(t.type===`ask.requested`&&typeof t.requestId==`string`&&es.safeParse({questions:t.questions}).success)return t;if(t.type===`human-input-delivered`){let n=Jo.safeParse(t);if(n.success&&n.data.askSeq===e?.seq)return}return e}function ns(e){let t;for(let n of e)t=ts(t,n);return t}var X=K([`claude`,`codex`,`opencode`,`pi`,`cursor`]),rs=V({root:F(),branch:F(),remote:F().optional()}),is=V({name:K([`claude`,`codex`,`opencode`,`pi`,`cursor`,`gh`,`git`]),available:z(),version:F().optional(),hint:F().optional()}),as=V({kind:q(`github`),available:z().optional(),reason:F().optional()}),os=V({localHandoff:z(),followups:z(),singleProject:z(),automations:z(),tokenMetrics:z(),tokenUsageMetrics:z(),costMetrics:z()});V({version:F(),latestVersion:F().optional(),repoRoot:F(),repo:rs.nullable(),checks:B(is),defaultRunner:X,forge:as.nullable(),capabilities:os,projects:B(V({id:F(),name:F()})),bootProject:F()});var ss=/^https:\/\/([a-zA-Z0-9](?:[a-zA-Z0-9.-]*[a-zA-Z0-9])?)\/([a-zA-Z0-9_-]+)\/([a-zA-Z0-9_.-]+)\/pull\/([1-9][0-9]*)$/,cs=F().max(2048).regex(ss).refine(e=>{let t=ss.exec(e);return!!t&&Number.isSafeInteger(Number(t[4]))&&t[3]!==`.`&&t[3]!==`..`},`Expected an HTTPS GitHub PR URL with a positive integer PR number`);V({pr:cs,timeout_seconds:R().int().min(1).max(7200).default(1800)}).strict();var ls=F().regex(/^[0-9a-f]{40}$/i),us=V({prUrl:cs,repository:F().max(2048).regex(/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_.-]+$/),prNumber:R().int().positive().max(2**53-1),headSha:ls}).strict(),ds=K([`passed`,`failed`,`cancelled`,`skipped`,`no_checks`,`head_changed`,`deadline`,`error`]);V({code:K([`invalid_request`,`unsupported_host`,`gh_missing`,`authentication`,`inaccessible_pr`,`malformed_data`,`output_limit`,`query_timeout`,`command_failed`,`wait_conflict`,`capacity`,`unavailable`,`unauthorized`,`persistence`]),message:F().max(4096)}).strict();function fs(e){let t=0;for(let n of e){let e=n.codePointAt(0);t+=e<=127?1:e<=2047?2:e<=65535?3:4}return t}var ps=V({outcome:ds,headSha:ls,observedHeadSha:ls.optional(),observedAt:j(),checks:B(V({name:F().max(256),state:F().max(256),link:F().max(2048)}).strict()).max(100),totalChecks:R().int().nonnegative(),truncated:z(),diagnostic:F().max(4096).refine(e=>fs(e)<=4096).optional()}).strict().refine(e=>fs(JSON.stringify(e))<=32*1024,`CI result exceeds 32 KiB`),ms=us.extend({id:L(),generation:F().min(1).max(256),turnId:F().min(1).max(256),timeoutSeconds:R().int().min(1).max(7200),registeredAt:j(),deadline:j(),phase:K([`registered`,`parked`,`wake-pending`,`delivered`,`withdrawn`]),result:ps.optional(),wakeId:F().min(1).max(256).optional(),deliveredAt:j().optional()}).strict();us.extend({waitId:L(),registeredAt:j(),deadline:j(),phase:ms.shape.phase}).strict();var hs=K([`passing`,`failing`,`pending`]).nullable(),gs=V({kind:K([`issue`,`pr`]),number:R(),title:F(),author:F(),createdAt:F(),labels:B(F()),body:F(),url:F(),comments:R(),assignees:B(F()).optional(),projectIds:B(F()).optional(),isDraft:z().optional(),additions:R().optional(),deletions:R().optional(),checks:hs.optional()}),_s=V({id:F(),title:F(),url:F()});V({available:z(),reason:F().optional(),repo:F().optional(),syncedAt:F().optional(),issues:B(gs),prs:B(gs),labelColors:G(F(),F()).optional(),viewerLogin:F().optional(),projects:B(_s).optional(),projectsReason:F().optional()}),W(`available`,[V({available:q(!0),checks:G(R(),hs)}),V({available:q(!1),reason:F()})]),V({kind:K([`issue`,`pr`]),q:F().trim().min(1).max(256),limit:lo().int().positive().max(50).optional()}),V({available:z(),projectsReason:F().optional(),reason:F().optional(),items:B(gs),truncated:z().optional(),labelColors:G(F(),F()).optional()});var vs=K([`draft`,`review-required`,`changes-requested`,`checks-pending`,`checks-failing`,`ready`,`merged`,`closed`,`open`,`completed`,`not-planned`]),ys=R().nullable();W(`available`,[V({available:q(!0),prs:G(R(),vs),issues:G(R(),vs),conflicts:B(R()).optional(),recheckAfterMs:ys}),V({available:q(!1),reason:F(),recheckAfterMs:ys})]);var bs=V({id:R(),author:F(),avatarUrl:F().optional(),createdAt:F(),body:F(),kind:K([`comment`,`review`]),reviewState:K([`approved`,`changes_requested`,`commented`,`dismissed`]).optional(),url:F()}),xs=K([`committed`,`labeled`,`unlabeled`,`assigned`,`unassigned`,`merged`,`closed`,`reopened`,`head_ref_force_pushed`,`cross-referenced`,`renamed`]),Ss=V({id:F(),kind:xs,actor:F(),avatarUrl:F().optional(),createdAt:F(),url:F().optional(),sha:F().optional(),message:F().optional(),checks:hs.optional(),label:V({name:F(),color:F().optional()}).optional(),subject:F().optional(),refNumber:R().optional(),refTitle:F().optional(),refIsPr:z().optional()});V({available:z(),reason:F().optional(),comments:B(bs),truncated:z().optional(),events:B(Ss).optional()});var Cs=K([`merge`,`squash`,`rebase`]),ws=V({name:F(),state:K([`passing`,`failing`,`pending`,`unknown`]),required:z().nullable(),url:F().optional()}),Ts=V({number:R(),title:F(),url:F(),state:K([`open`,`closed`,`merged`]),isDraft:z(),headRef:F(),baseRef:F(),headSha:F(),mergeable:K([`mergeable`,`conflicting`,`unknown`]),reviewDecision:K([`approved`,`changes-requested`,`review-required`,`unknown`]),checks:B(ws),methods:B(Cs),defaultMethod:Cs.nullable(),eligibility:K([`ready`,`blocked`,`pending`,`unauthorized`,`terminal`,`unknown`]),blockers:B(V({code:F(),message:F()})),canMerge:z(),canOverride:z()});W(`available`,[V({available:q(!0),mergeState:Ts}),V({available:q(!1),reason:F()})]),V({merged:q(!0),number:R(),url:F(),method:Cs,mergeCommitSha:F().optional()});var Es=V({path:F(),previousPath:F().optional(),status:K([`added`,`modified`,`removed`,`renamed`,`copied`,`changed`]),additions:R(),deletions:R(),patch:F().optional(),patchUnavailableReason:K([`binary`,`too-large`,`not-provided`]).optional(),truncated:z().optional()});W(`available`,[V({available:q(!0),number:R(),headSha:F(),files:B(Es),additions:R(),deletions:R(),truncated:z(),reason:F().optional()}),V({available:q(!1),reason:F()})]);var Ds=V({id:F().min(1),name:F().optional(),prompt:F().optional(),skill:F().optional(),model:F().optional(),effort:F().max(32).optional(),runner:X.optional(),agentProfile:F().min(1).max(64).optional(),allowedTools:B(F()).optional(),bashAllowlist:B(F()).optional(),command:F().optional(),onFail:V({retry:F().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`}),Os=V({name:F(),description:F().optional(),steps:B(Ds),source:K([`built-in`,`file`]),path:F().optional()});function ks(e,t){let n=new Set;for(let r of e.steps)r.command||n.add(r.runner??t);return X.options.filter(e=>n.has(e))}var As=V({path:F(),message:F()});V({workflows:B(Os),issues:B(As)}),V({name:F().trim().min(1).max(80),description:F().max(2e3,`must be at most 2000 characters`).optional(),steps:B(Ds).min(1).max(8).optional(),skills:B(F().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`}),V({path:F(),name:F()}),V({name:F(),description:F().optional(),steps:B(Ds)}),V({ok:q(!0),path:F()}),V({name:F().optional(),steps:B(Ds),rationale:F(),fallback:z()});var js=K([`queued`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`]),Ms=K([`monitoring`]),Ns=K([`pending`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`,`skipped`]),Z=R().finite().nonnegative(),Ps=V({id:F(),name:F(),kind:K([`agent`,`check`]),status:Ns,iterations:R(),retriesUsed:R().int().nonnegative().optional(),tokensUsed:R(),inputTokens:Z.optional(),outputTokens:Z.optional(),usageInvocationsStarted:Z.optional(),usageInvocationsObserved:Z.optional(),usageTurnsStarted:Z.optional(),usageTurnsRecorded:Z.optional(),usageInvocationEpoch:Z.optional(),startedAt:F().optional(),finishedAt:F().optional(),error:F().optional(),sessionId:F().optional(),backend:X.optional(),profileId:F().optional(),costUsd:R().optional(),synthetic:q(`continuation`).optional()}),Fs=V({adds:R(),dels:R(),files:R(),repointed:z().optional()}),Is=V({id:F(),text:F(),images:B(F()).optional(),createdAt:F()}),Ls=Is.extend({origin:K([`human`,`lifecycle`]).optional(),agentInputId:L().optional()}),Rs=V({cpuPct:R(),rssBytes:R(),procCount:R()}),Q=V({id:F(),title:F(),titleSummary:F().optional(),diffStat:Fs.optional(),workflow:F(),task:F(),queuedMessages:B(Is).optional(),stopping:z().optional(),continuationMessage:Ls.optional(),invalidAsk:z().optional(),delegation:zo.optional(),agentInputs:B(Vo).optional(),ciWait:ms.optional(),lastCiWait:ms.optional(),lastCiWaitError:F().max(256).optional(),taskImages:B(F()).optional(),model:F().optional(),effort:F().max(32).optional(),modelIdentity:F().optional(),runner:X.optional(),agentProfile:F().optional(),systemPrompt:F().optional(),generateFollowups:z().optional(),autonomous:z().optional(),automation:V({automationId:F(),automationRevision:R(),receiptId:F(),event:F(),githubUrl:F()}).optional(),status:js,activity:Ms.optional(),hasPendingHumanAsk:z().optional(),monitoringWakeAt:F().optional(),monitoringWakeCapReached:z().optional(),autoResumeAt:F().optional(),autoResumeAttempts:R().optional(),createdAt:F(),startedAt:F().optional(),finishedAt:F().optional(),tokensUsed:R(),inputTokens:Z.optional(),outputTokens:Z.optional(),costUsd:R().optional(),pullRequestUrl:F().optional(),referencedPullRequestUrl:F().optional(),prNumber:R().optional(),issueNumber:R().optional(),referencedIssueNumberSeeded:z().optional(),titleOrigin:K([`user`,`auto`,`marker`]).optional(),markerRefs:V({pr:R().optional(),issue:R().optional()}).optional(),referencedPrCandidates:B(F()).optional(),referencedIssueUrl:F().optional(),referencedIssueCandidates:B(F()).optional(),worktree:q(!1).optional(),worktreePath:F().optional(),branch:F().optional(),baseBranch:F().optional(),worktreeReclaimedAt:F().optional(),groupId:F().optional(),variant:F().optional(),peakRssBytes:R().optional(),peakProcCount:R().optional(),archived:z(),archivedAt:F().optional(),pinned:z().optional(),pinnedAt:F().optional(),seenAt:F().optional(),currentStepId:F().optional(),error:F().optional(),steps:B(Ps),workflowDef:Os.optional()});Q.extend({finishBlocked:F().nullable().optional(),cliResumeCommand:F().optional(),usage:Rs.optional()});var zs=V({projectId:F(),id:F(),title:F(),titleSummary:F().optional(),titleOrigin:K([`user`,`auto`,`marker`]).optional(),status:js,activity:Ms.optional(),hasPendingHumanAsk:Q.shape.hasPendingHumanAsk,delegation:Bo.optional(),createdAt:F(),finishedAt:F().optional(),seenAt:F().optional(),archived:z(),autoResumeAt:F().optional(),workflow:F(),branch:F().optional(),startedAt:F().optional(),pullRequestUrl:F().optional(),referencedPullRequestUrl:F().optional(),prNumber:R().optional(),issueNumber:R().optional(),referencedIssueUrl:F().optional(),markerRefs:V({pr:R().optional(),issue:R().optional()}).optional(),costUsd:R().optional(),peakRssBytes:R().optional(),peakProcCount:R().optional(),usage:Rs.optional()}),Bs=G(F(),V({prs:G(R(),vs),issues:G(R(),vs)}));V({runs:B(zs),referenceStatuses:Bs,perProjectLimit:R(),truncated:B(F())}),U([Q,V({runs:B(Q)})]),V({cancelled:z()}),V({cancelled:q(!0)}),V({archived:R()}),V({read:R()}),V({deleted:q(!0)}),V({finished:q(!0)}),V({continued:q(!0)}),V({url:F(),dryRun:z()}),U([V({delivered:q(!0)}),V({queued:q(!0),message:Is}),V({deferred:q(!0)})]),V({message:Is}),V({removed:q(!0)}),V({opened:q(!0),command:F()}),V({removed:q(!0)}),V({committed:q(!0),sha:F()}),V({pushed:q(!0),branch:F(),remote:F(),upstreamSet:z()}),V({commits:B(V({sha:F(),subject:F(),author:F(),when:F()}))});var Vs=V({id:F(),variant:F(),title:F(),status:js,archived:z(),tokensUsed:R(),inputTokens:Z.optional(),outputTokens:Z.optional(),costUsd:R().optional(),diffStat:F(),handoffExcerpt:F()});V({groupId:F(),runs:B(Vs)}),V({winner:Q.optional()});var Hs=[`text/plain`,`text/markdown`,`text/x-markdown`,`application/pdf`];function Us(e){return/^image\//.test(e)}function Ws(e){return Us(e)||Hs.includes(e)}function Gs(e){return/png/.test(e)?`png`:/jpe?g/.test(e)?`jpg`:/webp/.test(e)?`webp`:/gif/.test(e)?`gif`:e===`application/pdf`?`pdf`:e===`text/plain`?`txt`:e===`text/markdown`||e===`text/x-markdown`?`md`:`img`}var Ks=new Set([`png`,`jpg`,`jpeg`,`webp`,`gif`,`img`]);function qs(e){let t=e.split(`.`).pop()?.toLowerCase();return t!==void 0&&Ks.has(t)}V({id:F().min(1),file:F().regex(/^[A-Za-z0-9_-][A-Za-z0-9._-]*$/).refine(e=>!e.includes(`..`))});var Js=V({mediaType:F().refine(Ws,{message:`unsupported attachment type — images, plain text, markdown and PDF only`}),data:F().min(1).max(7e6)}),Ys=V({workflow:F().min(1).optional(),steps:B(Ds).min(1).max(8).optional(),task:F().min(1).max(1e5,`must be at most 100000 characters`),model:F().optional(),effort:F().max(32).optional(),runner:X.optional(),agentProfile:F().max(64).optional(),variants:R().int().min(1).max(3).optional(),worktree:z().optional(),autonomous:z().optional(),generateFollowups:z().optional(),systemPrompt:F().trim().max(2e4,`must be at most 20000 characters`).optional().transform(e=>e||void 0),images:B(Js).max(4).optional(),todoId:F().min(1).max(200,`must be at most 200 characters`).optional()});Ys.refine(e=>!!e.workflow!=!!e.steps,{message:`provide either "workflow" or "steps", not both`}),V({text:F().max(1e5).default(``),images:B(Js).max(4).default([])}).refine(e=>e.text.trim().length>0||e.images.length>0,{message:`message needs text or at least one attachment`}),V({title:F().trim().min(1).max(300).optional(),task:F().trim().min(1).max(1e5).optional()}),V({pinned:z().optional()});var Xs=V({status:F(),path:F()}),Zs=V({hash:F(),subject:F(),author:F(),when:F()});U([V({info:Ca(),status:B(ka()),log:B(ka()),branches:B(ka()),baseBranch:Ca()}),V({info:rs,status:B(Xs),log:B(Zs),branches:B(F()),baseBranch:F().nullable()})]),V({branch:F(),created:z()});var Qs=V({branches:B(F())});V({branch:F().trim().min(1).max(200).optional(),confirm:z().optional()});var $s=V({branch:F(),pulled:q(!0),summary:F()}),ec=V({error:F(),branch:F(),risks:B(K([`active_runs`,`dirty_tree`]))});U([ec,V({error:F()})]);var tc=V({adds:R(),dels:R(),files:R()}),nc=V({path:F(),oldPath:F().optional(),status:K([`added`,`modified`,`deleted`,`renamed`,`copied`]),adds:R(),dels:R(),binary:z(),image:z().optional(),patch:F()});V({files:B(nc),stat:tc,repointedHead:V({headBranch:F(),taskBranch:F()}).optional()}),V({sha:F(),subject:F(),author:F(),when:F(),files:B(nc),stat:tc});var rc=V({name:F(),type:K([`dir`,`file`]),size:R().optional()});W(`type`,[V({type:q(`dir`),path:F(),entries:B(rc)}),V({type:q(`file`),path:F(),size:R(),binary:z(),tooLarge:z(),content:F().optional()})]);var ic=K([`queued`,`running`,`waiting`,`review`,`done`,`failed`,`cancelled`]);V({worktrees:B(V({runId:F(),title:F(),status:ic,branch:F().nullable(),sizeBytes:R().nullable(),finishedAt:F().nullable(),reclaimable:z()})),totalBytes:R().nullable(),keep:R()}),V({reclaimed:B(F())});var ac=V({id:F(),name:F(),root:F(),addedAt:F(),lastOpenedAt:F(),source:K([`local`,`checkout`]),status:K([`ok`,`missing`,`not-git`]),branch:F().optional(),forge:q(`github`).optional(),repoUrl:F().optional(),maxParallel:R().optional(),tags:B(F()).optional()});V({projects:B(ac),bootProject:F(),projectsDir:F()}),V({project:ac,error:F().optional()}),V({removed:q(!0),id:F()}),V({project:ac}),V({maxParallel:R().int().min(1).max(16).nullable().optional(),tags:B(F().trim().min(1).max(32)).max(20).nullable().optional()}).refine(e=>e.maxParallel!==void 0||e.tags!==void 0,`specify maxParallel or tags`),V({url:F().trim().min(1).max(512),name:F().trim().max(128).optional(),checkoutId:F().trim().max(128).optional()});var oc=V({name:F(),path:F(),isRepo:z()});V({path:F(),parent:F().nullable(),dirs:B(oc),truncated:z()}),V({key:F()}),V({browseRoot:F(),projectsDir:F(),skillsAutoUpdate:z().nullable(),effectiveSkillsAutoUpdate:z(),composerDefaults:V({autonomous:z().nullable(),worktree:z().nullable(),inheritedAutonomous:U([z(),q(`source-dependent`)]),inheritedWorktree:z()}),resources:V({maxParallel:R(),maxMonitoringSessions:R(),monitoringWakeIntervalMinutes:R().nullable(),autoResumeOnUsageLimit:z(),memoryLimitMb:R().nullable(),worktreeRetentionDefault:R()}),agentDefaults:V({runner:X.optional(),models:V({claude:F().optional(),codex:F().optional(),opencode:F().optional(),pi:F().optional(),cursor:F().optional()}).optional()})}),V({browseRoot:F().trim().min(1).max(4096).optional(),projectsDir:F().trim().min(1).max(4096).optional(),skillsAutoUpdate:z().nullable().optional(),composerDefaults:V({autonomous:z().nullable().optional(),worktree:z().nullable().optional()}).optional(),agentDefaults:V({runner:X.nullable().optional(),models:V({claude:F().trim().min(1).max(200).nullable().optional(),codex:F().trim().min(1).max(200).nullable().optional(),opencode:F().trim().min(1).max(200).nullable().optional(),pi:F().trim().min(1).max(200).nullable().optional(),cursor:F().trim().min(1).max(200).nullable().optional()}).optional()}).optional(),resources:V({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 sc=V({accent:K([`cezarion`,`lime`,`violet`]).optional(),density:K([`comfortable`,`compact`,`ultra`]).optional(),width:K([`narrow`,`wide`]).optional()}),cc=H({expandedColumns:G(F(),z()).optional()});H({lastTask:V({source:K([`workflow`,`skill`]),ref:F()}).nullable().optional(),recentSources:B(V({source:K([`workflow`,`skill`]),ref:F()})).optional(),lastWorktree:z().optional(),lastAutonomous:z().optional(),lastGenerateFollowups:z().optional(),skillUsage:G(F(),R()).optional(),runsView:K([`list`,`table`]).optional(),githubView:K([`issues`,`prs`]).optional(),appearance:sc.optional(),promptTemplates:B(V({id:F(),label:F(),text:F(),skills:B(F()).optional()})).optional(),dismissedSkillsBanner:z().optional()});var lc=Ma({projectId:F().min(1).max(64),pathname:F().min(1).max(2048).startsWith(`/p/`),search:F().max(4096).startsWith(`?`).optional(),hash:F().max(2048).startsWith(`#`).optional()}),uc=H({sidebar:H({collapsed:G(F(),z()).optional()}).optional(),dismissedProviderAuthFailures:V({claude:F().optional(),codex:F().optional(),opencode:F().optional(),pi:F().optional(),cursor:F().optional()}).optional(),appearance:sc.optional(),notifications:H({enabled:z().optional()}).optional(),taskTable:cc.optional(),lastLocation:lc.optional(),importedSkills:B(F()).optional()}),dc=200,fc=50;H({...uc.shape,sidebar:H({collapsed:G(F().min(1).max(64),z()).refine(e=>Object.keys(e).length<=dc,{message:`sidebar.collapsed must have at most ${dc} entries`}).optional()}).optional(),dismissedProviderAuthFailures:Ma({claude:F().min(1).max(128).optional(),codex:F().min(1).max(128).optional(),opencode:F().min(1).max(128).optional(),pi:F().min(1).max(128).optional(),cursor:F().min(1).max(128).optional()}).optional(),importedSkills:B(F().min(1).max(200)).max(dc).optional(),taskTable:cc.extend({expandedColumns:G(F().min(1).max(64),z()).refine(e=>Object.keys(e).length<=fc,{message:`taskTable.expandedColumns must have at most ${fc} entries`}).optional()}).optional()}).superRefine((e,t)=>{Object.keys(e).length>dc&&t.addIssue({code:`custom`,message:`ui-state has too many keys (max ${dc})`})});var pc=V({claude:F().optional(),codex:F().optional(),opencode:F().optional(),pi:F().optional(),cursor:F().optional()});V({baseBranch:F().nullable(),defaultRunner:X,systemPrompt:F().nullable(),defaultModels:pc,modelsLocked:z(),maxParallel:R(),memoryLimitMb:R().nullable(),worktreeRetention:R(),liveTitleUpdates:z().nullable(),reviewGate:z().nullable()}),V({baseBranch:F().trim().min(1).max(200).nullable().optional(),defaultRunner:X.optional(),systemPrompt:F().trim().max(2e4).nullable().optional(),defaultModels:V({claude:F().trim().max(200).nullable().optional(),codex:F().trim().max(200).nullable().optional(),opencode:F().trim().max(200).nullable().optional(),pi:F().trim().max(200).nullable().optional(),cursor:F().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 mc=K([`idle`,`checking`,`available`,`updating`,`current`,`unavailable`,`error`]),hc=V({scope:K([`project`,`global`]),status:mc,available:z(),skills:B(F()),checkedAt:F().nullable(),updatedAt:F().nullable(),reason:F().optional()});V({status:mc,available:z(),autoUpdateEnabled:z(),inherited:z(),checkedAt:F().nullable(),updatedAt:F().nullable(),scopes:B(hc),needsUpgradeNotes:z()});var gc=X,_c=V({provider:gc,status:K([`connected`,`disconnected`,`not-installed`,`unknown`]),enabled:z().optional(),hint:F().optional(),authFailureId:F().optional(),profileId:F().optional()});V({providers:B(_c)}),W(`opened`,[V({opened:q(!0),command:F()}),V({opened:q(!1),connected:q(!0),command:F()})]);var vc=K([`claude`,`codex`,`opencode`,`pi`,`cursor`]).options;function yc(e){return vc.includes(e)}V({runner:X,models:B(V({id:F(),label:F(),description:F(),effortLevels:B(ho).optional()})),source:K([`live`,`cache`,`unavailable`]),stale:z(),reason:F().optional()}),V({targets:B(V({id:F(),label:F(),icon:F().optional()}))}),V({target:F().trim().min(1,`target required`).max(200)}),V({opened:q(!0),path:F()}),V({name:F(),description:F().optional(),interactive:q(!0).optional(),body:F(),path:F(),source:K([`ai`,`cezar`,`agents`,`global`,`team`]),team:V({repo:F(),ref:F(),path:F(),dir:z(),commit:F().optional()}).optional()}),V({name:F(),description:F().optional()}),V({id:F(),ts:F().optional(),taskId:F().optional(),summary:F().min(1),action:F().optional(),prUrl:F().optional(),suggestedSkill:F().optional(),suggestedArgs:F().optional(),suggestedPrompt:F().optional(),runnable:z().optional(),startedTaskId:F().optional()}),V({removed:q(!0)}),V({run:Q});var bc=K([`json`,`jsonc`,`toml`,`markdown`]),xc=K([`user`,`project`,`local`]),Sc=K([`settings`,`memory`,`mcp`]),Cc=K([`tracked`,`gitignored`,`outside-repo`]),wc=V({id:F(),runners:B(X),kind:Sc,scope:xc,label:F(),path:F(),format:bc,tracked:Cc,seeded:z(),holdsMcp:z(),precedence:F(),hotReload:F().optional(),docsUrl:F(),exists:z(),size:R(),version:F().nullable(),writable:z(),readOnlyReason:F().optional()}),Tc=V({path:F(),servers:B(F()),readable:z()});V({editable:z(),files:B(wc),userMcp:Tc.nullable()}),V({id:F(),path:F(),exists:z(),content:F(),version:F().nullable()}),V({content:F().max(2e6),version:F().nullable()});var Ec=`default`,Dc=V({id:F(),label:F(),path:F(),exists:z()}),Oc=V({id:F(),provider:gc,label:F(),configDir:F(),path:F(),exists:z(),looksValid:z(),isDefault:z(),status:_c.optional(),files:B(Dc)});function kc(e){return e.isDefault?`default:${e.provider}`:e.id}var Ac=V({claude:F().optional(),codex:F().optional(),opencode:F().optional(),pi:F().optional(),cursor:F().optional()});V({editable:z(),profiles:B(Oc),profileCapableProviders:B(gc),selections:G(F(),Ac),defaults:Ac}),V({projectId:F().min(1).max(64).nullable(),provider:gc,profileId:F().max(64).nullable()}),V({selections:G(F(),Ac),defaults:Ac}),V({status:_c}),V({available:z(),reason:F().optional(),fields:B(V({label:F(),value:F()}))}),V({file:F().min(1).max(200),target:F().min(1).max(64).optional()}),V({opened:q(!0),path:F()}),V({provider:gc,label:F().trim().max(200).optional(),configDir:F().trim().min(1).max(4096)}),V({profile:Oc}),V({label:F().trim().max(200).optional(),configDir:F().trim().min(1).max(4096).optional()}),V({removed:q(!0),id:F()});var jc=K([`pull_request.opened`,`issue.opened`,`issue.labeled`,`issue.unlabeled`]),Mc=V({authors:B(F()).optional(),assignees:B(F()).optional(),allLabels:B(F()).optional(),anyLabels:B(F()).optional(),excludeLabels:B(F()).optional(),changedLabels:B(F()).optional(),lookbackDays:R(),maxRecords:R()}),Nc=Ys.omit({task:!0,images:!0,todoId:!0,systemPrompt:!0}).extend({prompt:F(),variants:U([q(1),q(2),q(3)]).optional(),systemPrompt:F().optional()}),Pc=V({id:F(),revision:R(),name:F(),description:F().optional(),enabled:z(),events:B(jc),intervalSeconds:R(),filters:Mc,task:Nc,createdAt:F(),updatedAt:F()}),Fc=V({timestamp:F(),tieBreaker:F().optional()}),Ic=V({revision:R().optional(),baselineAt:F().optional(),cursor:Fc.optional(),frozenHighWatermark:Fc.extend({tieBreaker:F()}).optional(),backlogAfter:Fc.extend({tieBreaker:F()}).optional(),nextCheckAt:F().optional(),lastSuccessAt:F().optional(),etags:G(F(),F()).optional(),backoffUntil:F().optional(),consecutiveFailures:R().optional()}),Lc=K([`launched`,`no-match`,`duplicate`,`rate-limited`,`error`,`baseline`,`preview`]),Rc=V({seq:R(),ts:F(),automationId:F(),revision:R(),event:jc.optional(),result:Lc,reason:F().optional(),durationMs:R().optional(),receiptId:F().optional(),runId:F().optional(),githubNumber:R().optional(),githubTitle:F().optional(),githubUrl:F().optional(),rateLimit:V({bucket:K([`core`,`search`]),remaining:R().optional(),resetAt:F().optional()}).optional()}),zc=V({matches:R(),launched:R(),duplicates:R(),errors:R()}),Bc=Pc.extend({state:Ic.optional(),latestLog:Rc.optional(),counts:zc});V({available:z(),reason:F().optional(),scheduler:V({state:K([`scheduled`,`idle`]),nextDue:F().optional()}),automations:B(Bc)}),V({automation:Pc}),V({automation:Pc,state:Ic.optional(),latestLog:Rc.optional()}),V({id:F(),automationId:F(),mode:K([`preview`,`execute`]),status:K([`queued`,`running`,`complete`,`error`]),createdAt:F(),completedAt:F().optional(),matches:R().optional(),truncated:z().optional(),error:F().optional()}),V({checkId:F()}),V({records:B(Rc)}),V({receiptId:F(),runId:F()}),Pc.omit({id:!0,revision:!0,createdAt:!0,updatedAt:!0,enabled:!0}).extend({enable:z().optional()}).omit({enable:!0}).extend({enabled:z().optional(),expectedRevision:R()}),V({mode:K([`preview`,`execute`])});var Vc=`/api/v1`,$=``;function Hc(e){$=e.replace(/\/+$/,``)}function Uc(){return $}var Wc=null;function Gc(e){Wc=e===``?null:e}function Kc(){return Wc}function qc(){return Wc??`default`}var Jc=/^\/(?:health$|models(?:$|[/?])|providers(?:$|[/?])|projects(?:$|[/?])|workspace\/|fs\/)/;function Yc(e){return`${$}${Vc}${Xc(e)}`}function Xc(e){return Wc===null||Jc.test(e)?e:`/p/${encodeURIComponent(Wc)}${e}`}var Zc=/^\/api(?:\/v1)?(\/.*)$/;function Qc(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=$c(e.slice(r));return a===null?e:`${i}${a}`}let n=$c($&&e.startsWith($)?e.slice($.length):e);return n===null?e:`${$}${n}`}function $c(e){let t=Zc.exec(e);if(!t)return null;let n=t[1];return n.startsWith(`/p/`)?`${Vc}${n}`:`${Vc}${Xc(n)}`}var el=t({extend:{classGroups:{shadow:[`shadow-modal`]}}});function tl(...t){return el(e(t))}function nl(e){return typeof e==`string`&&/^https?:\/\//i.test(e)}export{qo as C,Zo as D,Qo as E,Bo as O,ns as S,Ko as T,Gs as _,Uc as a,Us as b,Qc as c,Ec as d,kc as f,$s as g,ec as h,Yc as i,Uo as k,Hc as l,Qs as m,nl as n,Kc as o,yc as p,Vc as r,qc as s,tl as t,Gc as u,Ws as v,Go as w,ks as x,qs as y};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,r as n,t as r}from"./react-runtime-CCIEwYL0.js";import{Aa as i,Bi as a,Ca as o,G as s,H as c,It as l,Jt as u,Qt as d,Rt as f,Ta as p,Ui as m,Ut as h,X as g,Xt as _,Y as v,Yt as y,a as b,bi as x,c as ee,ct as S,d as C,fr as te,hr as ne,i as w,in as re,it as T,l as ie,n as ae,ni as oe,o as E,ot as se,r as ce,s as D,sa as O,st as k,t as le,tn as A,vi as ue,vr as j}from"./alert-dialog-B422RI-k.js";import{t as M}from"./utils-PYYcpCFZ.js";import{i as N,l as de,r as P,t as fe}from"./dropdown-menu-dwDGT8MM.js";import{i as pe,n as me,o as he,r as ge,s as _e,t as ve}from"./textarea-FjaU370i.js";import{i as ye,l as be,s as xe}from"./skills-DFBiAuJG.js";import{h as Se,i as Ce}from"./index-BszfYvBq.js";import{n as we}from"./skill-empty-hint-oOtzR3v0.js";var F=e(n()),I=e(t());function Te(){var e=[...arguments];return(0,I.useMemo)(()=>t=>{e.forEach(e=>e(t))},e)}var L=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function R(e){let t=Object.prototype.toString.call(e);return t===`[object Window]`||t===`[object global]`}function Ee(e){return`nodeType`in e}function z(e){return e?R(e)?e:Ee(e)?e.ownerDocument?.defaultView??window:window:window}function B(e){let{Document:t}=z(e);return e instanceof t}function V(e){return!R(e)&&e instanceof z(e).HTMLElement}function De(e){return e instanceof z(e).SVGElement}function Oe(e){return e?R(e)?e.document:Ee(e)?B(e)?e:V(e)||De(e)?e.ownerDocument:document:document:document}var H=L?I.useLayoutEffect:I.useEffect;function ke(e){let t=(0,I.useRef)(e);return H(()=>{t.current=e}),(0,I.useCallback)(function(){var e=[...arguments];return t.current==null?void 0:t.current(...e)},[])}function Ae(){let e=(0,I.useRef)(null);return[(0,I.useCallback)((t,n)=>{e.current=setInterval(t,n)},[]),(0,I.useCallback)(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[])]}function U(e,t){t===void 0&&(t=[e]);let n=(0,I.useRef)(e);return H(()=>{n.current!==e&&(n.current=e)},t),n}function je(e,t){let n=(0,I.useRef)();return(0,I.useMemo)(()=>{let t=e(n.current);return n.current=t,t},[...t])}function Me(e){let t=ke(e),n=(0,I.useRef)(null);return[n,(0,I.useCallback)(e=>{e!==n.current&&t?.(e,n.current),n.current=e},[])]}function Ne(e){let t=(0,I.useRef)();return(0,I.useEffect)(()=>{t.current=e},[e]),t.current}var Pe={};function Fe(e,t){return(0,I.useMemo)(()=>{if(t)return t;let n=Pe[e]==null?0:Pe[e]+1;return Pe[e]=n,e+`-`+n},[e,t])}function Ie(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>{let r=Object.entries(n);for(let[n,i]of r){let r=t[n];r!=null&&(t[n]=r+e*i)}return t},{...t})}}var W=Ie(1),Le=Ie(-1);function Re(e){return`clientX`in e&&`clientY`in e}function ze(e){if(!e)return!1;let{KeyboardEvent:t}=z(e.target);return t&&e instanceof t}function Be(e){if(!e)return!1;let{TouchEvent:t}=z(e.target);return t&&e instanceof t}function Ve(e){if(Be(e)){if(e.touches&&e.touches.length){let{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){let{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return Re(e)?{x:e.clientX,y:e.clientY}:null}var G=Object.freeze({Translate:{toString(e){if(!e)return;let{x:t,y:n}=e;return`translate3d(`+(t?Math.round(t):0)+`px, `+(n?Math.round(n):0)+`px, 0)`}},Scale:{toString(e){if(!e)return;let{scaleX:t,scaleY:n}=e;return`scaleX(`+t+`) scaleY(`+n+`)`}},Transform:{toString(e){if(e)return[G.Translate.toString(e),G.Scale.toString(e)].join(` `)}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+` `+n+`ms `+r}}}),He=`a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]`;function Ue(e){return e.matches(He)?e:e.querySelector(He)}var K={display:`none`};function We(e){let{id:t,value:n}=e;return I.createElement(`div`,{id:t,style:K},n)}function Ge(e){let{id:t,announcement:n,ariaLiveType:r=`assertive`}=e;return I.createElement(`div`,{id:t,style:{position:`fixed`,top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:`hidden`,clip:`rect(0 0 0 0)`,clipPath:`inset(100%)`,whiteSpace:`nowrap`},role:`status`,"aria-live":r,"aria-atomic":!0},n)}function Ke(){let[e,t]=(0,I.useState)(``);return{announce:(0,I.useCallback)(e=>{e!=null&&t(e)},[]),announcement:e}}var qe=(0,I.createContext)(null);function Je(e){let t=(0,I.useContext)(qe);(0,I.useEffect)(()=>{if(!t)throw Error(`useDndMonitor must be used within a children of <DndContext>`);return t(e)},[e,t])}function Ye(){let[e]=(0,I.useState)(()=>new Set),t=(0,I.useCallback)(t=>(e.add(t),()=>e.delete(t)),[e]);return[(0,I.useCallback)(t=>{let{type:n,event:r}=t;e.forEach(e=>e[n]?.call(e,r))},[e]),t]}var Xe={draggable:`
|
|
2
|
-
To pick up a draggable item, press the space bar.
|
|
3
|
-
While dragging, use the arrow keys to move the item.
|
|
4
|
-
Press space again to drop the item in its new position, or press escape to cancel.
|
|
5
|
-
`},Ze={onDragStart(e){let{active:t}=e;return`Picked up draggable item `+t.id+`.`},onDragOver(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was moved over droppable area `+n.id+`.`:`Draggable item `+t.id+` is no longer over a droppable area.`},onDragEnd(e){let{active:t,over:n}=e;return n?`Draggable item `+t.id+` was dropped over droppable area `+n.id:`Draggable item `+t.id+` was dropped.`},onDragCancel(e){let{active:t}=e;return`Dragging was cancelled. Draggable item `+t.id+` was dropped.`}};function Qe(e){let{announcements:t=Ze,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Xe}=e,{announce:a,announcement:o}=Ke(),s=Fe(`DndLiveRegion`),[c,l]=(0,I.useState)(!1);if((0,I.useEffect)(()=>{l(!0)},[]),Je((0,I.useMemo)(()=>({onDragStart(e){let{active:n}=e;a(t.onDragStart({active:n}))},onDragMove(e){let{active:n,over:r}=e;t.onDragMove&&a(t.onDragMove({active:n,over:r}))},onDragOver(e){let{active:n,over:r}=e;a(t.onDragOver({active:n,over:r}))},onDragEnd(e){let{active:n,over:r}=e;a(t.onDragEnd({active:n,over:r}))},onDragCancel(e){let{active:n,over:r}=e;a(t.onDragCancel({active:n,over:r}))}}),[a,t])),!c)return null;let u=I.createElement(I.Fragment,null,I.createElement(We,{id:r,value:i.draggable}),I.createElement(Ge,{id:s,announcement:o}));return n?(0,F.createPortal)(u,n):u}var q;(function(e){e.DragStart=`dragStart`,e.DragMove=`dragMove`,e.DragEnd=`dragEnd`,e.DragCancel=`dragCancel`,e.DragOver=`dragOver`,e.RegisterDroppable=`registerDroppable`,e.SetDroppableDisabled=`setDroppableDisabled`,e.UnregisterDroppable=`unregisterDroppable`})(q||={});function $e(){}function et(e,t){return(0,I.useMemo)(()=>({sensor:e,options:t??{}}),[e,t])}function tt(){var e=[...arguments];return(0,I.useMemo)(()=>[...e].filter(e=>e!=null),[...e])}var J=Object.freeze({x:0,y:0});function nt(e,t){return Math.sqrt((e.x-t.x)**2+(e.y-t.y)**2)}function rt(e,t){let n=Ve(e);if(!n)return`0 0`;let r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+`% `+r.y+`%`}function it(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function at(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function ot(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function st(e,t){if(!e||e.length===0)return null;let[n]=e;return t?n[t]:n}function ct(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}var lt=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ct(t,t.left,t.top),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=nt(ct(r),i);a.push({id:t,data:{droppableContainer:e,value:n}})}}return a.sort(it)},ut=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=ot(t),a=[];for(let e of r){let{id:t}=e,r=n.get(t);if(r){let n=ot(r),o=i.reduce((e,t,r)=>e+nt(n[r],t),0),s=Number((o/4).toFixed(4));a.push({id:t,data:{droppableContainer:e,value:s}})}}return a.sort(it)};function dt(e,t){let n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),a=Math.min(t.top+t.height,e.top+e.height),o=i-r,s=a-n;if(r<i&&n<a){let n=t.width*t.height,r=e.width*e.height,i=o*s,a=i/(n+r-i);return Number(a.toFixed(4))}return 0}var ft=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e,i=[];for(let e of r){let{id:r}=e,a=n.get(r);if(a){let n=dt(a,t);n>0&&i.push({id:r,data:{droppableContainer:e,value:n}})}}return i.sort(at)};function pt(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function mt(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:J}function ht(e){return function(t){return[...arguments].slice(1).reduce((t,n)=>({...t,top:t.top+e*n.y,bottom:t.bottom+e*n.y,left:t.left+e*n.x,right:t.right+e*n.x}),{...t})}}var gt=ht(1);function _t(e){if(e.startsWith(`matrix3d(`)){let t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith(`matrix(`)){let t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function vt(e,t,n){let r=_t(t);if(!r)return e;let{scaleX:i,scaleY:a,x:o,y:s}=r,c=e.left-o-(1-i)*parseFloat(n),l=e.top-s-(1-a)*parseFloat(n.slice(n.indexOf(` `)+1)),u=i?e.width/i:e.width,d=a?e.height/a:e.height;return{width:u,height:d,top:l,right:c+u,bottom:l+d,left:c}}var yt={ignoreTransform:!1};function bt(e,t){t===void 0&&(t=yt);let n=e.getBoundingClientRect();if(t.ignoreTransform){let{transform:t,transformOrigin:r}=z(e).getComputedStyle(e);t&&(n=vt(n,t,r))}let{top:r,left:i,width:a,height:o,bottom:s,right:c}=n;return{top:r,left:i,width:a,height:o,bottom:s,right:c}}function xt(e){return bt(e,{ignoreTransform:!0})}function St(e){let t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function Ct(e,t){return t===void 0&&(t=z(e).getComputedStyle(e)),t.position===`fixed`}function wt(e,t){t===void 0&&(t=z(e).getComputedStyle(e));let n=/(auto|scroll|overlay)/;return[`overflow`,`overflowX`,`overflowY`].some(e=>{let r=t[e];return typeof r==`string`&&n.test(r)})}function Tt(e,t){let n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(B(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!V(i)||De(i)||n.includes(i))return n;let a=z(e).getComputedStyle(i);return i!==e&&wt(i,a)&&n.push(i),Ct(i,a)?n:r(i.parentNode)}return e?r(e):n}function Et(e){let[t]=Tt(e,1);return t??null}function Dt(e){return!L||!e?null:R(e)?e:Ee(e)?B(e)||e===Oe(e).scrollingElement?window:V(e)?e:null:null}function Ot(e){return R(e)?e.scrollX:e.scrollLeft}function kt(e){return R(e)?e.scrollY:e.scrollTop}function At(e){return{x:Ot(e),y:kt(e)}}var Y;(function(e){e[e.Forward=1]=`Forward`,e[e.Backward=-1]=`Backward`})(Y||={});function jt(e){return!L||!e?!1:e===document.scrollingElement}function Mt(e){let t={x:0,y:0},n=jt(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height};return{isTop:e.scrollTop<=t.y,isLeft:e.scrollLeft<=t.x,isBottom:e.scrollTop>=r.y,isRight:e.scrollLeft>=r.x,maxScroll:r,minScroll:t}}var Nt={x:.2,y:.2};function Pt(e,t,n,r,i){let{top:a,left:o,right:s,bottom:c}=n;r===void 0&&(r=10),i===void 0&&(i=Nt);let{isTop:l,isBottom:u,isLeft:d,isRight:f}=Mt(e),p={x:0,y:0},m={x:0,y:0},h={height:t.height*i.y,width:t.width*i.x};return!l&&a<=t.top+h.height?(p.y=Y.Backward,m.y=r*Math.abs((t.top+h.height-a)/h.height)):!u&&c>=t.bottom-h.height&&(p.y=Y.Forward,m.y=r*Math.abs((t.bottom-h.height-c)/h.height)),!f&&s>=t.right-h.width?(p.x=Y.Forward,m.x=r*Math.abs((t.right-h.width-s)/h.width)):!d&&o<=t.left+h.width&&(p.x=Y.Backward,m.x=r*Math.abs((t.left+h.width-o)/h.width)),{direction:p,speed:m}}function Ft(e){if(e===document.scrollingElement){let{innerWidth:e,innerHeight:t}=window;return{top:0,left:0,right:e,bottom:t,width:e,height:t}}let{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function It(e){return e.reduce((e,t)=>W(e,At(t)),J)}function Lt(e){return e.reduce((e,t)=>e+Ot(t),0)}function Rt(e){return e.reduce((e,t)=>e+kt(t),0)}function zt(e,t){if(t===void 0&&(t=bt),!e)return;let{top:n,left:r,bottom:i,right:a}=t(e);Et(e)&&(i<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:`center`,inline:`center`})}var Bt=[[`x`,[`left`,`right`],Lt],[`y`,[`top`,`bottom`],Rt]],Vt=class{constructor(e,t){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let n=Tt(t),r=It(n);this.rect={...e},this.width=e.width,this.height=e.height;for(let[e,t,i]of Bt)for(let a of t)Object.defineProperty(this,a,{get:()=>{let t=i(n),o=r[e]-t;return this.rect[a]+o},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},Ht=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(e=>this.target?.removeEventListener(...e))},this.target=e}add(e,t,n){var r;(r=this.target)==null||r.addEventListener(e,t,n),this.listeners.push([e,t,n])}};function Ut(e){let{EventTarget:t}=z(e);return e instanceof t?e:Oe(e)}function Wt(e,t){let n=Math.abs(e.x),r=Math.abs(e.y);return typeof t==`number`?Math.sqrt(n**2+r**2)>t:`x`in t&&`y`in t?n>t.x&&r>t.y:`x`in t?n>t.x:`y`in t&&r>t.y}var X;(function(e){e.Click=`click`,e.DragStart=`dragstart`,e.Keydown=`keydown`,e.ContextMenu=`contextmenu`,e.Resize=`resize`,e.SelectionChange=`selectionchange`,e.VisibilityChange=`visibilitychange`})(X||={});function Gt(e){e.preventDefault()}function Kt(e){e.stopPropagation()}var Z;(function(e){e.Space=`Space`,e.Down=`ArrowDown`,e.Right=`ArrowRight`,e.Left=`ArrowLeft`,e.Up=`ArrowUp`,e.Esc=`Escape`,e.Enter=`Enter`,e.Tab=`Tab`})(Z||={});var qt={start:[Z.Space,Z.Enter],cancel:[Z.Esc],end:[Z.Space,Z.Enter,Z.Tab]},Jt=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Z.Right:return{...n,x:n.x+25};case Z.Left:return{...n,x:n.x-25};case Z.Down:return{...n,y:n.y+25};case Z.Up:return{...n,y:n.y-25}}},Yt=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:t}}=e;this.props=e,this.listeners=new Ht(Oe(t)),this.windowListeners=new Ht(z(t)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(X.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:t}=this.props,n=e.node.current;n&&zt(n),t(J)}handleKeyDown(e){if(ze(e)){let{active:t,context:n,options:r}=this.props,{keyboardCodes:i=qt,coordinateGetter:a=Jt,scrollBehavior:o=`smooth`}=r,{code:s}=e;if(i.end.includes(s)){this.handleEnd(e);return}if(i.cancel.includes(s)){this.handleCancel(e);return}let{collisionRect:c}=n.current,l=c?{x:c.left,y:c.top}:J;this.referenceCoordinates||=l;let u=a(e,{active:t,context:n.current,currentCoordinates:l});if(u){let t=Le(u,l),r={x:0,y:0},{scrollableAncestors:i}=n.current;for(let n of i){let i=e.code,{isTop:a,isRight:s,isLeft:c,isBottom:l,maxScroll:d,minScroll:f}=Mt(n),p=Ft(n),m={x:Math.min(i===Z.Right?p.right-p.width/2:p.right,Math.max(i===Z.Right?p.left:p.left+p.width/2,u.x)),y:Math.min(i===Z.Down?p.bottom-p.height/2:p.bottom,Math.max(i===Z.Down?p.top:p.top+p.height/2,u.y))},h=i===Z.Right&&!s||i===Z.Left&&!c,g=i===Z.Down&&!l||i===Z.Up&&!a;if(h&&m.x!==u.x){let e=n.scrollLeft+t.x,a=i===Z.Right&&e<=d.x||i===Z.Left&&e>=f.x;if(a&&!t.y){n.scrollTo({left:e,behavior:o});return}a?r.x=n.scrollLeft-e:r.x=i===Z.Right?n.scrollLeft-d.x:n.scrollLeft-f.x,r.x&&n.scrollBy({left:-r.x,behavior:o});break}else if(g&&m.y!==u.y){let e=n.scrollTop+t.y,a=i===Z.Down&&e<=d.y||i===Z.Up&&e>=f.y;if(a&&!t.x){n.scrollTo({top:e,behavior:o});return}a?r.y=n.scrollTop-e:r.y=i===Z.Down?n.scrollTop-d.y:n.scrollTop-f.y,r.y&&n.scrollBy({top:-r.y,behavior:o});break}}this.handleMove(e,W(Le(u,this.referenceCoordinates),r))}}}handleMove(e,t){let{onMove:n}=this.props;e.preventDefault(),n(t)}handleEnd(e){let{onEnd:t}=this.props;e.preventDefault(),this.detach(),t()}handleCancel(e){let{onCancel:t}=this.props;e.preventDefault(),this.detach(),t()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};Yt.activators=[{eventName:`onKeyDown`,handler:(e,t,n)=>{let{keyboardCodes:r=qt,onActivation:i}=t,{active:a}=n,{code:o}=e.nativeEvent;if(r.start.includes(o)){let t=a.activatorNode.current;return t&&e.target!==t?!1:(e.preventDefault(),i?.({event:e.nativeEvent}),!0)}return!1}}];function Xt(e){return!!(e&&`distance`in e)}function Zt(e){return!!(e&&`delay`in e)}var Qt=class{constructor(e,t,n){n===void 0&&(n=Ut(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=t;let{event:r}=e,{target:i}=r;this.props=e,this.events=t,this.document=Oe(i),this.documentListeners=new Ht(this.document),this.listeners=new Ht(n),this.windowListeners=new Ht(z(i)),this.initialCoordinates=Ve(r)??J,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:t,bypassActivationConstraint:n}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(X.Resize,this.handleCancel),this.windowListeners.add(X.DragStart,Gt),this.windowListeners.add(X.VisibilityChange,this.handleCancel),this.windowListeners.add(X.ContextMenu,Gt),this.documentListeners.add(X.Keydown,this.handleKeydown),t){if(n!=null&&n({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Zt(t)){this.timeoutId=setTimeout(this.handleStart,t.delay),this.handlePending(t);return}if(Xt(t)){this.handlePending(t);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,t){let{active:n,onPending:r}=this.props;r(n,e,this.initialCoordinates,t)}handleStart(){let{initialCoordinates:e}=this,{onStart:t}=this.props;e&&(this.activated=!0,this.documentListeners.add(X.Click,Kt,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(X.SelectionChange,this.removeTextSelection),t(e))}handleMove(e){let{activated:t,initialCoordinates:n,props:r}=this,{onMove:i,options:{activationConstraint:a}}=r;if(!n)return;let o=Ve(e)??J,s=Le(n,o);if(!t&&a){if(Xt(a)){if(a.tolerance!=null&&Wt(s,a.tolerance))return this.handleCancel();if(Wt(s,a.distance))return this.handleStart()}if(Zt(a)&&Wt(s,a.tolerance))return this.handleCancel();this.handlePending(a,s);return}e.cancelable&&e.preventDefault(),i(o)}handleEnd(){let{onAbort:e,onEnd:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleCancel(){let{onAbort:e,onCancel:t}=this.props;this.detach(),this.activated||e(this.props.active),t()}handleKeydown(e){e.code===Z.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},$t={cancel:{name:`pointercancel`},move:{name:`pointermove`},end:{name:`pointerup`}},en=class extends Qt{constructor(e){let{event:t}=e,n=Oe(t.target);super(e,$t,n)}};en.activators=[{eventName:`onPointerDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];var tn={move:{name:`mousemove`},end:{name:`mouseup`}},nn;(function(e){e[e.RightClick=2]=`RightClick`})(nn||={});var rn=class extends Qt{constructor(e){super(e,tn,Oe(e.event.target))}};rn.activators=[{eventName:`onMouseDown`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===nn.RightClick?!1:(r?.({event:n}),!0)}}];var an={cancel:{name:`touchcancel`},move:{name:`touchmove`},end:{name:`touchend`}},on=class extends Qt{constructor(e){super(e,an)}static setup(){return window.addEventListener(an.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(an.move.name,e)};function e(){}}};on.activators=[{eventName:`onTouchStart`,handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t,{touches:i}=n;return i.length>1?!1:(r?.({event:n}),!0)}}];var sn;(function(e){e[e.Pointer=0]=`Pointer`,e[e.DraggableRect=1]=`DraggableRect`})(sn||={});var cn;(function(e){e[e.TreeOrder=0]=`TreeOrder`,e[e.ReversedTreeOrder=1]=`ReversedTreeOrder`})(cn||={});function ln(e){let{acceleration:t,activator:n=sn.Pointer,canScroll:r,draggingRect:i,enabled:a,interval:o=5,order:s=cn.TreeOrder,pointerCoordinates:c,scrollableAncestors:l,scrollableAncestorRects:u,delta:d,threshold:f}=e,p=dn({delta:d,disabled:!a}),[m,h]=Ae(),g=(0,I.useRef)({x:0,y:0}),_=(0,I.useRef)({x:0,y:0}),v=(0,I.useMemo)(()=>{switch(n){case sn.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case sn.DraggableRect:return i}},[n,i,c]),y=(0,I.useRef)(null),b=(0,I.useCallback)(()=>{let e=y.current;if(!e)return;let t=g.current.x*_.current.x,n=g.current.y*_.current.y;e.scrollBy(t,n)},[]),x=(0,I.useMemo)(()=>s===cn.TreeOrder?[...l].reverse():l,[s,l]);(0,I.useEffect)(()=>{if(!a||!l.length||!v){h();return}for(let e of x){if(r?.(e)===!1)continue;let n=l.indexOf(e),i=u[n];if(!i)continue;let{direction:a,speed:s}=Pt(e,i,v,t,f);for(let e of[`x`,`y`])p[e][a[e]]||(s[e]=0,a[e]=0);if(s.x>0||s.y>0){h(),y.current=e,m(b,o),g.current=s,_.current=a;return}}g.current={x:0,y:0},_.current={x:0,y:0},h()},[t,b,r,h,a,o,JSON.stringify(v),JSON.stringify(p),m,l,x,u,JSON.stringify(f)])}var un={x:{[Y.Backward]:!1,[Y.Forward]:!1},y:{[Y.Backward]:!1,[Y.Forward]:!1}};function dn(e){let{delta:t,disabled:n}=e,r=Ne(t);return je(e=>{if(n||!r||!e)return un;let i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Y.Backward]:e.x[Y.Backward]||i.x===-1,[Y.Forward]:e.x[Y.Forward]||i.x===1},y:{[Y.Backward]:e.y[Y.Backward]||i.y===-1,[Y.Forward]:e.y[Y.Forward]||i.y===1}}},[n,t,r])}function fn(e,t){let n=t==null?void 0:e.get(t),r=n?n.node.current:null;return je(e=>t==null?null:r??e??null,[r,t])}function pn(e,t){return(0,I.useMemo)(()=>e.reduce((e,n)=>{let{sensor:r}=n,i=r.activators.map(e=>({eventName:e.eventName,handler:t(e.handler,n)}));return[...e,...i]},[]),[e,t])}var mn;(function(e){e[e.Always=0]=`Always`,e[e.BeforeDragging=1]=`BeforeDragging`,e[e.WhileDragging=2]=`WhileDragging`})(mn||={});var hn;(function(e){e.Optimized=`optimized`})(hn||={});var gn=new Map;function _n(e,t){let{dragging:n,dependencies:r,config:i}=t,[a,o]=(0,I.useState)(null),{frequency:s,measure:c,strategy:l}=i,u=(0,I.useRef)(e),d=g(),f=U(d),p=(0,I.useCallback)(function(e){e===void 0&&(e=[]),!f.current&&o(t=>t===null?e:t.concat(e.filter(e=>!t.includes(e))))},[f]),m=(0,I.useRef)(null),h=je(t=>{if(d&&!n)return gn;if(!t||t===gn||u.current!==e||a!=null){let t=new Map;for(let n of e){if(!n)continue;if(a&&a.length>0&&!a.includes(n.id)&&n.rect.current){t.set(n.id,n.rect.current);continue}let e=n.node.current,r=e?new Vt(c(e),e):null;n.rect.current=r,r&&t.set(n.id,r)}return t}return t},[e,a,n,d,c]);return(0,I.useEffect)(()=>{u.current=e},[e]),(0,I.useEffect)(()=>{d||p()},[n,d]),(0,I.useEffect)(()=>{a&&a.length>0&&o(null)},[JSON.stringify(a)]),(0,I.useEffect)(()=>{d||typeof s!=`number`||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},s))},[s,d,p,...r]),{droppableRects:h,measureDroppableContainers:p,measuringScheduled:a!=null};function g(){switch(l){case mn.Always:return!1;case mn.BeforeDragging:return n;default:return!n}}}function vn(e,t){return je(n=>e?n||(typeof t==`function`?t(e):e):null,[t,e])}function yn(e,t){return vn(e,t)}function bn(e){let{callback:t,disabled:n}=e,r=ke(t),i=(0,I.useMemo)(()=>{if(n||typeof window>`u`||window.MutationObserver===void 0)return;let{MutationObserver:e}=window;return new e(r)},[r,n]);return(0,I.useEffect)(()=>()=>i?.disconnect(),[i]),i}function xn(e){let{callback:t,disabled:n}=e,r=ke(t),i=(0,I.useMemo)(()=>{if(n||typeof window>`u`||window.ResizeObserver===void 0)return;let{ResizeObserver:e}=window;return new e(r)},[n]);return(0,I.useEffect)(()=>()=>i?.disconnect(),[i]),i}function Sn(e){return new Vt(bt(e),e)}function Cn(e,t,n){t===void 0&&(t=Sn);let[r,i]=(0,I.useState)(null);function a(){i(r=>{if(!e)return null;if(e.isConnected===!1)return r??n??null;let i=t(e);return JSON.stringify(r)===JSON.stringify(i)?r:i})}let o=bn({callback(t){if(e)for(let n of t){let{type:t,target:r}=n;if(t===`childList`&&r instanceof HTMLElement&&r.contains(e)){a();break}}}}),s=xn({callback:a});return H(()=>{a(),e?(s?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),o?.disconnect())},[e]),r}function wn(e){return mt(e,vn(e))}var Tn=[];function En(e){let t=(0,I.useRef)(e),n=je(n=>e?n&&n!==Tn&&e&&t.current&&e.parentNode===t.current.parentNode?n:Tt(e):Tn,[e]);return(0,I.useEffect)(()=>{t.current=e},[e]),n}function Dn(e){let[t,n]=(0,I.useState)(null),r=(0,I.useRef)(e),i=(0,I.useCallback)(e=>{let t=Dt(e.target);t&&n(e=>e?(e.set(t,At(t)),new Map(e)):null)},[]);return(0,I.useEffect)(()=>{let t=r.current;if(e!==t){a(t);let o=e.map(e=>{let t=Dt(e);return t?(t.addEventListener(`scroll`,i,{passive:!0}),[t,At(t)]):null}).filter(e=>e!=null);n(o.length?new Map(o):null),r.current=e}return()=>{a(e),a(t)};function a(e){e.forEach(e=>{Dt(e)?.removeEventListener(`scroll`,i)})}},[i,e]),(0,I.useMemo)(()=>e.length?t?Array.from(t.values()).reduce((e,t)=>W(e,t),J):It(e):J,[e,t])}function On(e,t){t===void 0&&(t=[]);let n=(0,I.useRef)(null);return(0,I.useEffect)(()=>{n.current=null},t),(0,I.useEffect)(()=>{let t=e!==J;t&&!n.current&&(n.current=e),!t&&n.current&&(n.current=null)},[e]),n.current?Le(e,n.current):J}function kn(e){(0,I.useEffect)(()=>{if(!L)return;let t=e.map(e=>{let{sensor:t}=e;return t.setup==null?void 0:t.setup()});return()=>{for(let e of t)e?.()}},e.map(e=>{let{sensor:t}=e;return t}))}function An(e,t){return(0,I.useMemo)(()=>e.reduce((e,n)=>{let{eventName:r,handler:i}=n;return e[r]=e=>{i(e,t)},e},{}),[e,t])}function jn(e){return(0,I.useMemo)(()=>e?St(e):null,[e])}var Mn=[];function Nn(e,t){t===void 0&&(t=bt);let[n]=e,r=jn(n?z(n):null),[i,a]=(0,I.useState)(Mn);function o(){a(()=>e.length?e.map(e=>jt(e)?r:new Vt(t(e),e)):Mn)}let s=xn({callback:o});return H(()=>{s?.disconnect(),o(),e.forEach(e=>s?.observe(e))},[e]),i}function Pn(e){if(!e)return null;if(e.children.length>1)return e;let t=e.children[0];return V(t)?t:e}function Fn(e){let{measure:t}=e,[n,r]=(0,I.useState)(null),i=xn({callback:(0,I.useCallback)(e=>{for(let{target:n}of e)if(V(n)){r(e=>{let r=t(n);return e?{...e,width:r.width,height:r.height}:r});break}},[t])}),[a,o]=Me((0,I.useCallback)(e=>{let n=Pn(e);i?.disconnect(),n&&i?.observe(n),r(n?t(n):null)},[t,i]));return(0,I.useMemo)(()=>({nodeRef:a,rect:n,setRef:o}),[n,a,o])}var In=[{sensor:en,options:{}},{sensor:Yt,options:{}}],Ln={current:{}},Rn={draggable:{measure:xt},droppable:{measure:xt,strategy:mn.WhileDragging,frequency:hn.Optimized},dragOverlay:{measure:bt}},zn=class extends Map{get(e){return e==null?void 0:super.get(e)??void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:t}=e;return!t})}getNodeFor(e){return this.get(e)?.node.current??void 0}},Bn={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new zn,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:$e},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Rn,measureDroppableContainers:$e,windowRect:null,measuringScheduled:!1},Vn={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:``},dispatch:$e,draggableNodes:new Map,over:null,measureDroppableContainers:$e},Hn=(0,I.createContext)(Vn),Un=(0,I.createContext)(Bn);function Wn(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new zn}}}function Gn(e,t){switch(t.type){case q.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case q.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case q.DragEnd:case q.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case q.RegisterDroppable:{let{element:n}=t,{id:r}=n,i=new zn(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case q.SetDroppableDisabled:{let{id:n,key:r,disabled:i}=t,a=e.droppable.containers.get(n);if(!a||r!==a.key)return e;let o=new zn(e.droppable.containers);return o.set(n,{...a,disabled:i}),{...e,droppable:{...e.droppable,containers:o}}}case q.UnregisterDroppable:{let{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;let a=new zn(e.droppable.containers);return a.delete(n),{...e,droppable:{...e.droppable,containers:a}}}default:return e}}function Kn(e){let{disabled:t}=e,{active:n,activatorEvent:r,draggableNodes:i}=(0,I.useContext)(Hn),a=Ne(r),o=Ne(n?.id);return(0,I.useEffect)(()=>{if(!t&&!r&&a&&o!=null){if(!ze(a)||document.activeElement===a.target)return;let e=i.get(o);if(!e)return;let{activatorNode:t,node:n}=e;if(!t.current&&!n.current)return;requestAnimationFrame(()=>{for(let e of[t.current,n.current]){if(!e)continue;let t=Ue(e);if(t){t.focus();break}}})}},[r,t,i,o,a]),null}function qn(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((e,t)=>t({transform:e,...r}),n):n}function Jn(e){return(0,I.useMemo)(()=>({draggable:{...Rn.draggable,...e?.draggable},droppable:{...Rn.droppable,...e?.droppable},dragOverlay:{...Rn.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function Yn(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e,a=(0,I.useRef)(!1),{x:o,y:s}=typeof i==`boolean`?{x:i,y:i}:i;H(()=>{if(!o&&!s||!t){a.current=!1;return}if(a.current||!r)return;let e=t?.node.current;if(!e||e.isConnected===!1)return;let i=mt(n(e),r);if(o||(i.x=0),s||(i.y=0),a.current=!0,Math.abs(i.x)>0||Math.abs(i.y)>0){let t=Et(e);t&&t.scrollBy({top:i.y,left:i.x})}},[t,o,s,r,n])}var Xn=(0,I.createContext)({...J,scaleX:1,scaleY:1}),Zn;(function(e){e[e.Uninitialized=0]=`Uninitialized`,e[e.Initializing=1]=`Initializing`,e[e.Initialized=2]=`Initialized`})(Zn||={});var Qn=(0,I.memo)(function(e){let{id:t,accessibility:n,autoScroll:r=!0,children:i,sensors:a=In,collisionDetection:o=ft,measuring:s,modifiers:c,...l}=e,[u,d]=(0,I.useReducer)(Gn,void 0,Wn),[f,p]=Ye(),[m,h]=(0,I.useState)(Zn.Uninitialized),g=m===Zn.Initialized,{draggable:{active:_,nodes:v,translate:y},droppable:{containers:b}}=u,x=_==null?null:v.get(_),ee=(0,I.useRef)({initial:null,translated:null}),S=(0,I.useMemo)(()=>_==null?null:{id:_,data:x?.data??Ln,rect:ee},[_,x]),C=(0,I.useRef)(null),[te,ne]=(0,I.useState)(null),[w,re]=(0,I.useState)(null),T=U(l,Object.values(l)),ie=Fe(`DndDescribedBy`,t),ae=(0,I.useMemo)(()=>b.getEnabled(),[b]),oe=Jn(s),{droppableRects:E,measureDroppableContainers:se,measuringScheduled:ce}=_n(ae,{dragging:g,dependencies:[y.x,y.y],config:oe.droppable}),D=fn(v,_),O=(0,I.useMemo)(()=>w?Ve(w):null,[w]),k=Ae(),le=yn(D,oe.draggable.measure);Yn({activeNode:_==null?null:v.get(_),config:k.layoutShiftCompensation,initialRect:le,measure:oe.draggable.measure});let A=Cn(D,oe.draggable.measure,le),ue=Cn(D?D.parentElement:null),j=(0,I.useRef)({activatorEvent:null,active:null,activeNode:D,collisionRect:null,collisions:null,droppableRects:E,draggableNodes:v,draggingNode:null,draggingNodeRect:null,droppableContainers:b,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),M=b.getNodeFor(j.current.over?.id),N=Fn({measure:oe.dragOverlay.measure}),de=N.nodeRef.current??D,P=g?N.rect??A:null,fe=!!(N.nodeRef.current&&N.rect),pe=wn(fe?null:A),me=jn(de?z(de):null),he=En(g?M??D:null),ge=Nn(he),_e=qn(c,{transform:{x:y.x-pe.x,y:y.y-pe.y,scaleX:1,scaleY:1},activatorEvent:w,active:S,activeNodeRect:A,containerNodeRect:ue,draggingNodeRect:P,over:j.current.over,overlayNodeRect:N.rect,scrollableAncestors:he,scrollableAncestorRects:ge,windowRect:me}),ve=O?W(O,y):null,ye=Dn(he),be=On(ye),xe=On(ye,[A]),Se=W(_e,be),Ce=P?gt(P,_e):null,we=S&&Ce?o({active:S,collisionRect:Ce,droppableRects:E,droppableContainers:ae,pointerCoordinates:ve}):null,Te=st(we,`id`),[L,R]=(0,I.useState)(null),Ee=pt(fe?_e:W(_e,xe),L?.rect??null,A),B=(0,I.useRef)(null),V=(0,I.useCallback)((e,t)=>{let{sensor:n,options:r}=t;if(C.current==null)return;let i=v.get(C.current);if(!i)return;let a=e.nativeEvent,o=new n({active:C.current,activeNode:i,event:a,options:r,context:j,onAbort(e){if(!v.get(e))return;let{onDragAbort:t}=T.current,n={id:e};t?.(n),f({type:`onDragAbort`,event:n})},onPending(e,t,n,r){if(!v.get(e))return;let{onDragPending:i}=T.current,a={id:e,constraint:t,initialCoordinates:n,offset:r};i?.(a),f({type:`onDragPending`,event:a})},onStart(e){let t=C.current;if(t==null)return;let n=v.get(t);if(!n)return;let{onDragStart:r}=T.current,i={activatorEvent:a,active:{id:t,data:n.data,rect:ee}};(0,F.unstable_batchedUpdates)(()=>{r?.(i),h(Zn.Initializing),d({type:q.DragStart,initialCoordinates:e,active:t}),f({type:`onDragStart`,event:i}),ne(B.current),re(a)})},onMove(e){d({type:q.DragMove,coordinates:e})},onEnd:s(q.DragEnd),onCancel:s(q.DragCancel)});B.current=o;function s(e){return async function(){let{active:t,collisions:n,over:r,scrollAdjustedTranslate:i}=j.current,o=null;if(t&&i){let{cancelDrop:s}=T.current;o={activatorEvent:a,active:t,collisions:n,delta:i,over:r},e===q.DragEnd&&typeof s==`function`&&await Promise.resolve(s(o))&&(e=q.DragCancel)}C.current=null,(0,F.unstable_batchedUpdates)(()=>{d({type:e}),h(Zn.Uninitialized),R(null),ne(null),re(null),B.current=null;let t=e===q.DragEnd?`onDragEnd`:`onDragCancel`;if(o){let e=T.current[t];e?.(o),f({type:t,event:o})}})}}},[v]),De=pn(a,(0,I.useCallback)((e,t)=>(n,r)=>{let i=n.nativeEvent,a=v.get(r);if(C.current!==null||!a||i.dndKit||i.defaultPrevented)return;let o={active:a};e(n,t.options,o)===!0&&(i.dndKit={capturedBy:t.sensor},C.current=r,V(n,t))},[v,V]));kn(a),H(()=>{A&&m===Zn.Initializing&&h(Zn.Initialized)},[A,m]),(0,I.useEffect)(()=>{let{onDragMove:e}=T.current,{active:t,activatorEvent:n,collisions:r,over:i}=j.current;if(!t||!n)return;let a={active:t,activatorEvent:n,collisions:r,delta:{x:Se.x,y:Se.y},over:i};(0,F.unstable_batchedUpdates)(()=>{e?.(a),f({type:`onDragMove`,event:a})})},[Se.x,Se.y]),(0,I.useEffect)(()=>{let{active:e,activatorEvent:t,collisions:n,droppableContainers:r,scrollAdjustedTranslate:i}=j.current;if(!e||C.current==null||!t||!i)return;let{onDragOver:a}=T.current,o=r.get(Te),s=o&&o.rect.current?{id:o.id,rect:o.rect.current,data:o.data,disabled:o.disabled}:null,c={active:e,activatorEvent:t,collisions:n,delta:{x:i.x,y:i.y},over:s};(0,F.unstable_batchedUpdates)(()=>{R(s),a?.(c),f({type:`onDragOver`,event:c})})},[Te]),H(()=>{j.current={activatorEvent:w,active:S,activeNode:D,collisionRect:Ce,collisions:we,droppableRects:E,draggableNodes:v,draggingNode:de,draggingNodeRect:P,droppableContainers:b,over:L,scrollableAncestors:he,scrollAdjustedTranslate:Se},ee.current={initial:P,translated:Ce}},[S,D,we,Ce,v,de,P,E,b,L,he,Se]),ln({...k,delta:y,draggingRect:Ce,pointerCoordinates:ve,scrollableAncestors:he,scrollableAncestorRects:ge});let Oe=(0,I.useMemo)(()=>({active:S,activeNode:D,activeNodeRect:A,activatorEvent:w,collisions:we,containerNodeRect:ue,dragOverlay:N,draggableNodes:v,droppableContainers:b,droppableRects:E,over:L,measureDroppableContainers:se,scrollableAncestors:he,scrollableAncestorRects:ge,measuringConfiguration:oe,measuringScheduled:ce,windowRect:me}),[S,D,A,w,we,ue,N,v,b,E,L,se,he,ge,oe,ce,me]),ke=(0,I.useMemo)(()=>({activatorEvent:w,activators:De,active:S,activeNodeRect:A,ariaDescribedById:{draggable:ie},dispatch:d,draggableNodes:v,over:L,measureDroppableContainers:se}),[w,De,S,A,d,ie,v,L,se]);return I.createElement(qe.Provider,{value:p},I.createElement(Hn.Provider,{value:ke},I.createElement(Un.Provider,{value:Oe},I.createElement(Xn.Provider,{value:Ee},i)),I.createElement(Kn,{disabled:n?.restoreFocus===!1})),I.createElement(Qe,{...n,hiddenTextDescribedById:ie}));function Ae(){let e=te?.autoScrollEnabled===!1,t=typeof r==`object`?r.enabled===!1:r===!1,n=g&&!e&&!t;return typeof r==`object`?{...r,enabled:n}:{enabled:n}}}),$n=(0,I.createContext)(null),er=`button`,tr=`Draggable`;function nr(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e,a=Fe(tr),{activators:o,activatorEvent:s,active:c,activeNodeRect:l,ariaDescribedById:u,draggableNodes:d,over:f}=(0,I.useContext)(Hn),{role:p=er,roleDescription:m=`draggable`,tabIndex:h=0}=i??{},g=c?.id===t,_=(0,I.useContext)(g?Xn:$n),[v,y]=Me(),[b,x]=Me(),ee=An(o,t),S=U(n);return H(()=>(d.set(t,{id:t,key:a,node:v,activatorNode:b,data:S}),()=>{let e=d.get(t);e&&e.key===a&&d.delete(t)}),[d,t]),{active:c,activatorEvent:s,activeNodeRect:l,attributes:(0,I.useMemo)(()=>({role:p,tabIndex:h,"aria-disabled":r,"aria-pressed":g&&p===er?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,h,g,m,u.draggable]),isDragging:g,listeners:r?void 0:ee,node:v,over:f,setNodeRef:y,setActivatorNodeRef:x,transform:_}}function rr(){return(0,I.useContext)(Un)}var ir=`Droppable`,ar={timeout:25};function or(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e,a=Fe(ir),{active:o,dispatch:s,over:c,measureDroppableContainers:l}=(0,I.useContext)(Hn),u=(0,I.useRef)({disabled:n}),d=(0,I.useRef)(!1),f=(0,I.useRef)(null),p=(0,I.useRef)(null),{disabled:m,updateMeasurementsFor:h,timeout:g}={...ar,...i},_=U(h??r),v=xn({callback:(0,I.useCallback)(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{l(Array.isArray(_.current)?_.current:[_.current]),p.current=null},g)},[g]),disabled:m||!o}),[y,b]=Me((0,I.useCallback)((e,t)=>{v&&(t&&(v.unobserve(t),d.current=!1),e&&v.observe(e))},[v])),x=U(t);return(0,I.useEffect)(()=>{!v||!y.current||(v.disconnect(),d.current=!1,v.observe(y.current))},[y,v]),(0,I.useEffect)(()=>(s({type:q.RegisterDroppable,element:{id:r,key:a,disabled:n,node:y,rect:f,data:x}}),()=>s({type:q.UnregisterDroppable,key:a,id:r})),[r]),(0,I.useEffect)(()=>{n!==u.current.disabled&&(s({type:q.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:o,rect:f,isOver:c?.id===r,node:y,over:c,setNodeRef:b}}function sr(e){let{animation:t,children:n}=e,[r,i]=(0,I.useState)(null),[a,o]=(0,I.useState)(null),s=Ne(n);return!n&&!r&&s&&i(s),H(()=>{if(!a)return;let e=r?.key,n=r?.props.id;if(e==null||n==null){i(null);return}Promise.resolve(t(n,a)).then(()=>{i(null)})},[t,r,a]),I.createElement(I.Fragment,null,n,r?(0,I.cloneElement)(r,{ref:o}):null)}var cr={x:0,y:0,scaleX:1,scaleY:1};function lr(e){let{children:t}=e;return I.createElement(Hn.Provider,{value:Vn},I.createElement(Xn.Provider,{value:cr},t))}var ur={position:`fixed`,touchAction:`none`},dr=e=>ze(e)?`transform 250ms ease`:void 0,fr=(0,I.forwardRef)((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:a,className:o,rect:s,style:c,transform:l,transition:u=dr}=e;if(!s)return null;let d=i?l:{...l,scaleX:1,scaleY:1},f={...ur,width:s.width,height:s.height,top:s.top,left:s.left,transform:G.Transform.toString(d),transformOrigin:i&&r?rt(r,s):void 0,transition:typeof u==`function`?u(r):u,...c};return I.createElement(n,{className:o,style:f,ref:t},a)}),pr={duration:250,easing:`ease`,keyframes:e=>{let{transform:{initial:t,final:n}}=e;return[{transform:G.Transform.toString(t)},{transform:G.Transform.toString(n)}]},sideEffects:(e=>t=>{let{active:n,dragOverlay:r}=t,i={},{styles:a,className:o}=e;if(a!=null&&a.active)for(let[e,t]of Object.entries(a.active))t!==void 0&&(i[e]=n.node.style.getPropertyValue(e),n.node.style.setProperty(e,t));if(a!=null&&a.dragOverlay)for(let[e,t]of Object.entries(a.dragOverlay))t!==void 0&&r.node.style.setProperty(e,t);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(let[e,t]of Object.entries(i))n.node.style.setProperty(e,t);o!=null&&o.active&&n.node.classList.remove(o.active)}})({styles:{active:{opacity:`0`}}})};function mr(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return ke((e,a)=>{if(t===null)return;let o=n.get(e);if(!o)return;let s=o.node.current;if(!s)return;let c=Pn(a);if(!c)return;let{transform:l}=z(a).getComputedStyle(a),u=_t(l);if(!u)return;let d=typeof t==`function`?t:hr(t);return zt(s,i.draggable.measure),d({active:{id:e,data:o.data,node:s,rect:i.draggable.measure(s)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:i,transform:u})})}function hr(e){let{duration:t,easing:n,sideEffects:r,keyframes:i}={...pr,...e};return e=>{let{active:a,dragOverlay:o,transform:s,...c}=e;if(!t)return;let l={x:o.rect.left-a.rect.left,y:o.rect.top-a.rect.top},u={scaleX:s.scaleX===1?1:a.rect.width*s.scaleX/o.rect.width,scaleY:s.scaleY===1?1:a.rect.height*s.scaleY/o.rect.height},d={x:s.x-l.x,y:s.y-l.y,...u},f=i({...c,active:a,dragOverlay:o,transform:{initial:s,final:d}}),[p]=f,m=f[f.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;let h=r?.({active:a,dragOverlay:o,...c}),g=o.node.animate(f,{duration:t,easing:n,fill:`forwards`});return new Promise(e=>{g.onfinish=()=>{h?.(),e()}})}}var gr=0;function _r(e){return(0,I.useMemo)(()=>{if(e!=null)return gr++,gr},[e])}var vr=I.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:a,modifiers:o,wrapperElement:s=`div`,className:c,zIndex:l=999}=e,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:h,dragOverlay:g,over:_,measuringConfiguration:v,scrollableAncestors:y,scrollableAncestorRects:b,windowRect:x}=rr(),ee=(0,I.useContext)(Xn),S=_r(d?.id),C=qn(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:g.rect,over:_,overlayNodeRect:g.rect,scrollableAncestors:y,scrollableAncestorRects:b,transform:ee,windowRect:x}),te=vn(f),ne=mr({config:r,draggableNodes:m,droppableContainers:h,measuringConfiguration:v}),w=te?g.setRef:void 0;return I.createElement(lr,null,I.createElement(sr,{animation:ne},d&&S?I.createElement(fr,{key:S,id:d.id,ref:w,as:s,activatorEvent:u,adjustScale:t,className:c,transition:a,rect:te,style:{zIndex:l,...i},transform:C},n):null))});function yr(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function br(e,t){return e.reduce((e,n,r)=>{let i=t.get(n);return i&&(e[r]=i),e},Array(e.length))}function xr(e){return e!==null&&e>=0}function Sr(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Cr(e){return typeof e==`boolean`?{draggable:e,droppable:e}:e}var wr=e=>{let{rects:t,activeIndex:n,overIndex:r,index:i}=e,a=yr(t,r,n),o=t[i],s=a[i];return!s||!o?null:{x:s.left-o.left,y:s.top-o.top,scaleX:s.width/o.width,scaleY:s.height/o.height}},Tr={scaleX:1,scaleY:1},Er=e=>{let{activeIndex:t,activeNodeRect:n,index:r,rects:i,overIndex:a}=e,o=i[t]??n;if(!o)return null;if(r===t){let e=i[a];return e?{x:0,y:t<a?e.top+e.height-(o.top+o.height):e.top-o.top,...Tr}:null}let s=Dr(i,r,t);return r>t&&r<=a?{x:0,y:-o.height-s,...Tr}:r<t&&r>=a?{x:0,y:o.height+s,...Tr}:{x:0,y:0,...Tr}};function Dr(e,t,n){let r=e[t],i=e[t-1],a=e[t+1];return r?n<t?i?r.top-(i.top+i.height):a?a.top-(r.top+r.height):0:a?a.top-(r.top+r.height):i?r.top-(i.top+i.height):0:0}var Or=`Sortable`,kr=I.createContext({activeIndex:-1,containerId:Or,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:wr,disabled:{draggable:!1,droppable:!1}});function Ar(e){let{children:t,id:n,items:r,strategy:i=wr,disabled:a=!1}=e,{active:o,dragOverlay:s,droppableRects:c,over:l,measureDroppableContainers:u}=rr(),d=Fe(Or,n),f=s.rect!==null,p=(0,I.useMemo)(()=>r.map(e=>typeof e==`object`&&`id`in e?e.id:e),[r]),m=o!=null,h=o?p.indexOf(o.id):-1,g=l?p.indexOf(l.id):-1,_=(0,I.useRef)(p),v=!Sr(p,_.current),y=g!==-1&&h===-1||v,b=Cr(a);H(()=>{v&&m&&u(p)},[v,p,m,u]),(0,I.useEffect)(()=>{_.current=p},[p]);let x=(0,I.useMemo)(()=>({activeIndex:h,containerId:d,disabled:b,disableTransforms:y,items:p,overIndex:g,useDragOverlay:f,sortedRects:br(p,c),strategy:i}),[h,d,b.draggable,b.droppable,y,p,g,c,f,i]);return I.createElement(kr.Provider,{value:x},t)}var jr=e=>{let{id:t,items:n,activeIndex:r,overIndex:i}=e;return yr(n,r,i).indexOf(t)},Mr=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:i,items:a,newIndex:o,previousItems:s,previousContainerId:c,transition:l}=e;return!l||!r||s!==a&&i===o?!1:n?!0:o!==i&&t===c},Nr={duration:200,easing:`ease`},Pr=`transform`,Fr=G.Transition.toString({property:Pr,duration:0,easing:`linear`}),Ir={roleDescription:`sortable`};function Lr(e){let{disabled:t,index:n,node:r,rect:i}=e,[a,o]=(0,I.useState)(null),s=(0,I.useRef)(n);return H(()=>{if(!t&&n!==s.current&&r.current){let e=i.current;if(e){let t=bt(r.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&o(n)}}n!==s.current&&(s.current=n)},[t,n,r,i]),(0,I.useEffect)(()=>{a&&o(null)},[a]),a}function Rr(e){let{animateLayoutChanges:t=Mr,attributes:n,disabled:r,data:i,getNewIndex:a=jr,id:o,strategy:s,resizeObserverConfig:c,transition:l=Nr}=e,{items:u,containerId:d,activeIndex:f,disabled:p,disableTransforms:m,sortedRects:h,overIndex:g,useDragOverlay:_,strategy:v}=(0,I.useContext)(kr),y=zr(r,p),b=u.indexOf(o),x=(0,I.useMemo)(()=>({sortable:{containerId:d,index:b,items:u},...i}),[d,i,b,u]),ee=(0,I.useMemo)(()=>u.slice(u.indexOf(o)),[u,o]),{rect:S,node:C,isOver:te,setNodeRef:ne}=or({id:o,data:x,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:ee,...c}}),{active:w,activatorEvent:re,activeNodeRect:T,attributes:ie,setNodeRef:ae,listeners:oe,isDragging:E,over:se,setActivatorNodeRef:ce,transform:D}=nr({id:o,data:x,attributes:{...Ir,...n},disabled:y.draggable}),O=Te(ne,ae),k=!!w,le=k&&!m&&xr(f)&&xr(g),A=!_&&E,ue=le?(A&&le?D:null)??(s??v)({rects:h,activeNodeRect:T,activeIndex:f,overIndex:g,index:b}):null,j=xr(f)&&xr(g)?a({id:o,items:u,activeIndex:f,overIndex:g}):b,M=w?.id,N=(0,I.useRef)({activeId:M,items:u,newIndex:j,containerId:d}),de=u!==N.current.items,P=t({active:w,containerId:d,isDragging:E,isSorting:k,id:o,index:b,items:u,newIndex:N.current.newIndex,previousItems:N.current.items,previousContainerId:N.current.containerId,transition:l,wasDragging:N.current.activeId!=null}),fe=Lr({disabled:!P,index:b,node:C,rect:S});return(0,I.useEffect)(()=>{k&&N.current.newIndex!==j&&(N.current.newIndex=j),d!==N.current.containerId&&(N.current.containerId=d),u!==N.current.items&&(N.current.items=u)},[k,j,d,u]),(0,I.useEffect)(()=>{if(M===N.current.activeId)return;if(M!=null&&N.current.activeId==null){N.current.activeId=M;return}let e=setTimeout(()=>{N.current.activeId=M},50);return()=>clearTimeout(e)},[M]),{active:w,activeIndex:f,attributes:ie,data:x,rect:S,index:b,newIndex:j,items:u,isOver:te,isSorting:k,isDragging:E,listeners:oe,node:C,overIndex:g,over:se,setNodeRef:O,setActivatorNodeRef:ce,setDroppableNodeRef:ne,setDraggableNodeRef:ae,transform:fe??ue,transition:pe()};function pe(){if(fe||de&&N.current.newIndex===b)return Fr;if(!(A&&!ze(re)||!l)&&(k||P))return G.Transition.toString({...l,property:Pr})}}function zr(e,t){return typeof e==`boolean`?{draggable:e,droppable:!1}:{draggable:e?.draggable??t.draggable,droppable:e?.droppable??t.droppable}}function Br(e){if(!e)return!1;let t=e.data.current;return!!(t&&`sortable`in t&&typeof t.sortable==`object`&&`containerId`in t.sortable&&`items`in t.sortable&&`index`in t.sortable)}var Vr=[Z.Down,Z.Right,Z.Up,Z.Left],Hr=(e,t)=>{let{context:{active:n,collisionRect:r,droppableRects:i,droppableContainers:a,over:o,scrollableAncestors:s}}=t;if(Vr.includes(e.code)){if(e.preventDefault(),!n||!r)return;let t=[];a.getEnabled().forEach(n=>{if(!n||n!=null&&n.disabled)return;let a=i.get(n.id);if(a)switch(e.code){case Z.Down:r.top<a.top&&t.push(n);break;case Z.Up:r.top>a.top&&t.push(n);break;case Z.Left:r.left>a.left&&t.push(n);break;case Z.Right:r.left<a.left&&t.push(n);break}});let c=ut({active:n,collisionRect:r,droppableRects:i,droppableContainers:t,pointerCoordinates:null}),l=st(c,`id`);if(l===o?.id&&c.length>1&&(l=c[1].id),l!=null){let e=a.get(n.id),t=a.get(l),o=t?i.get(t.id):null,c=t?.node.current;if(c&&o&&e&&t){let n=Tt(c).some((e,t)=>s[t]!==e),i=Ur(e,t),a=Wr(e,t),l=n||!i?{x:0,y:0}:{x:a?r.width-o.width:0,y:a?r.height-o.height:0},u={x:o.left,y:o.top};return l.x&&l.y?u:Le(u,l)}}}};function Ur(e,t){return!Br(e)||!Br(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function Wr(e,t){return!Br(e)||!Br(t)||!Ur(e,t)?!1:e.data.current.sortable.index<t.data.current.sortable.index}function Gr(e){let t=[];for(let n of e){if(n.command||!n.skill||n.prompt!==void 0&&n.prompt!==`{{task}}`||n.name!==void 0&&n.name!==n.skill||n.model||n.effort!==void 0||n.runner||n.agentProfile||n.allowedTools||n.bashAllowlist||n.onFail)return null;t.push(n.skill)}return t.length?t:null}function Kr(e,t){let n=new Set(t.map(e=>e.id)),r=e;for(let t=2;n.has(r);t++)r=`${e}-${t}`;return{id:r,name:e,skill:e,prompt:`{{task}}`}}function qr(e,t,n){let r=[...e];return r.splice(Math.max(0,Math.min(n,r.length)),0,t),r}function Jr(e,t,n){if(t===n||t<0||t>=e.length||n<0||n>=e.length)return[...e];let r=[...e],[i]=r.splice(t,1);return i===void 0?[...e]:(r.splice(n,0,i),r)}function Yr(e,t){return e.filter((e,n)=>n!==t)}function Q(e){let t=String(e),n=/^[A-Za-z0-9._][A-Za-z0-9 ._/-]*$/.test(t)&&!t.endsWith(` `),r=/^(true|false|yes|no|on|off|null|~)$/i.test(t)||/^[-+.]?\d/.test(t);return n&&!r?t:JSON.stringify(t)}function Xr(e,t,n){let r=` `.repeat(n);return t.includes(`
|
|
6
|
-
`)?[`${r}${e}: |`,...t.split(`
|
|
7
|
-
`).map(e=>`${r} ${e}`)]:[`${r}${e}: ${Q(t)}`]}function Zr(e,t,n){let r=[`name: ${Q(e.trim()||`my-workflow`)}`];t.trim()&&r.push(...Xr(`description`,t.trim(),0));let i=Gr(n);if(i){r.push(`skills:`);for(let e of i)r.push(` - ${Q(e)}`)}else if(n.length){r.push(`steps:`);for(let e of n)r.push(` - id: ${Q(e.id)}`),e.name&&e.name!==e.id&&r.push(` name: ${Q(e.name)}`),e.skill&&r.push(` skill: ${Q(e.skill)}`),e.prompt&&r.push(...Xr(`prompt`,e.prompt,4)),e.model&&r.push(` model: ${Q(e.model)}`),e.effort!==void 0&&r.push(` effort: ${Q(e.effort)}`),e.runner&&r.push(` runner: ${Q(e.runner)}`),e.agentProfile&&r.push(` agentProfile: ${Q(e.agentProfile)}`),e.allowedTools&&r.push(` allowedTools: [${e.allowedTools.map(Q).join(`, `)}]`),e.bashAllowlist&&r.push(` bashAllowlist: [${e.bashAllowlist.map(Q).join(`, `)}]`),e.command&&r.push(...Xr(`command`,e.command,4)),e.onFail&&r.push(` onFail:`,` retry: ${Q(e.onFail.retry)}`,` max: ${e.onFail.max??2}`)}else r.push(`skills: []`);return`${r.join(`
|
|
8
|
-
`)}\n`}function Qr(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`workflow`}function $r(e){let t=Gr(e)?`skill`:`step`;return`${e.length} ${t}${e.length===1?``:`s`}`}function ei(e,t){let n=new Set,r=[];for(let t of e.steps.slice(0,8)){let e=t.id||`step`,i=e;for(let t=2;n.has(i);t++)i=`${e}-${t}`;n.add(i),r.push({...t,id:i})}return{name:e.name?.trim()||t,steps:r}}function ti(e,t,n){let r=Gr(n);return{name:e.trim(),...t.trim()?{description:t.trim()}:{},...r?{skills:r}:{steps:[...n]}}}var $=r(),ni=`wb-canvas`;function ri(){return{name:`my-workflow`,description:``,steps:[]}}function ii(e){return{name:e.name,description:e.description??``,steps:structuredClone(e.steps??[])}}function ai(){let{name:e}=o();return(0,$.jsx)(oi,{routeName:e},e??``)}function oi({routeName:e}){let t=j(),n=te(),r=ne(),o=i(),[s,c]=(0,I.useState)(null),[T,k]=(0,I.useState)(``),[M,N]=(0,I.useState)(!1),[de,P]=(0,I.useState)(``),[fe,ye]=(0,I.useState)(null),[we,F]=(0,I.useState)(!1),[Te,L]=(0,I.useState)(``),[R,Ee]=(0,I.useState)(``),[z,B]=(0,I.useState)(!1),[V,De]=(0,I.useState)(``),[Oe,H]=(0,I.useState)(!1),[ke,Ae]=(0,I.useState)(!1),[U,je]=(0,I.useState)(null),[Me,Ne]=(0,I.useState)(null),Pe=(0,I.useRef)(null),Fe=(0,I.useRef)(null),Ie=t.data?.workflows??[],W=n.data??[],Le=xe(W,r.data?.skillUsage),Re=be(Le,de,r.data?.skillUsage);(0,I.useEffect)(()=>{if(s!==null||t.data===void 0)return;let n=t.data.workflows,r=(e?n.find(t=>t.name===e):void 0)??n.find(e=>e.source===`file`);c(r?ii(r):ri())},[s,t.data,e]);let ze=e=>c(t=>t===null?t:{...t,steps:e}),Be=p({mutationFn:e=>a(e),onSuccess:e=>{c({name:e.name,description:e.description??``,steps:e.steps}),F(!1),L(``),Ee(``),O(`Imported "${e.name}" — review, then Save.`)},onError:e=>Ee(e.message)}),Ve=p({mutationFn:e=>m(e),onSuccess:e=>{c(t=>{let n=t??ri(),{name:r,steps:i}=ei(e,n.name);return{...n,name:r,steps:i}}),B(!1),De(``),O(e.fallback?`Planner unavailable — added a single step. Edit, then Save.`:`Built "${e.name??s?.name??`workflow`}" — review, tweak, then Save.`,e.fallback?{tone:`danger`}:void 0)},onError:e=>O(e instanceof Error?e.message:String(e),{tone:`danger`})}),G=p({mutationFn:e=>ue({...ti(s?.name??``,s?.description??``,s?.steps??[]),...e?{overwrite:!0}:{}}),onSuccess:e=>{H(!1),O(`Saved — ${e.path.split(`/`).pop()??e.path}`),o.invalidateQueries({queryKey:re.workflows})},onError:e=>{e instanceof oe&&e.exists===!0?H(!0):O(e instanceof Error?e.message:String(e),{tone:`danger`})}}),He=p({mutationFn:e=>x(e),onSuccess:(e,t)=>{Ae(!1),O(`Deleted "${t}".`),c(ri()),o.invalidateQueries({queryKey:re.workflows})},onError:e=>{Ae(!1),O(e instanceof Error?e.message:String(e),{tone:`danger`})}}),Ue=tt(et(en,{activationConstraint:{distance:4}}),et(Yt,{coordinateGetter:Hr}));if(t.isError)return(0,$.jsx)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:(0,$.jsx)(ie,{icon:(0,$.jsx)(y,{}),tone:`danger`,title:`Could not load workflows`,subtitle:t.error.message})});if(s===null)return(0,$.jsx)(Ce,{});let K=s.steps,We=s.name.trim(),Ge=Ie.find(e=>e.name===We&&e.source===`file`),Ke=Zr(s.name,s.description,K),qe=(e,t=K.length)=>{if(K.length>=8){O(`A workflow holds at most 8 steps.`,{tone:`danger`});return}ze(qr(K,Kr(e,K),t))},Je=e=>{let t=e.active.data.current;je(t??null)},Ye=e=>{Ne(e.over?String(e.over.id):null)},Xe=e=>{je(null),Ne(null);let{active:t,over:n}=e;if(n===null)return;let r=t.data.current;if(r?.type===`palette`){let e=n.id===ni?K.length:K.findIndex(e=>e.id===n.id);qe(r.skill,e===-1?K.length:e);return}if(n.id===t.id)return;let i=K.findIndex(e=>e.id===t.id),a=K.findIndex(e=>e.id===n.id);i!==-1&&a!==-1&&ze(Jr(K,i,a))},Ze=()=>{let e=Te.trim();e!==``&&Be.mutate(e)},Qe=()=>{let e=V.trim();e===``||Ve.isPending||Ve.mutate(e)};return(0,$.jsxs)(`div`,{"data-route":`workflows`,className:`@container mx-auto min-h-full w-full px-[18px] py-6 md:p-9`,children:[(0,$.jsxs)(`header`,{className:`mb-[22px] flex flex-wrap items-center justify-between gap-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-[25px] font-semibold md:text-[30px]`,children:`Workflows`}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground md:text-[13px]`,children:`Portable skill chains. Steps run from top to bottom.`})]}),(0,$.jsxs)(C,{variant:`primary`,"data-slot":`wb-new`,className:`min-h-11`,onClick:()=>c(ri()),children:[(0,$.jsx)(l,{"aria-hidden":`true`,className:`size-4`}),`New workflow`]})]}),(0,$.jsxs)(Qn,{sensors:Ue,collisionDetection:lt,onDragStart:Je,onDragOver:Ye,onDragEnd:Xe,onDragCancel:()=>{je(null),Ne(null)},children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-[22px] pb-[calc(32px+env(safe-area-inset-bottom))]`,children:[(0,$.jsxs)(`section`,{"data-slot":`wb-metadata`,className:`flex min-w-0 flex-col gap-3`,children:[(0,$.jsxs)(`div`,{"data-slot":`wb-load`,className:`flex flex-col items-start gap-2`,children:[(0,$.jsx)(`label`,{htmlFor:`workflow-load`,className:`text-xs text-muted-foreground`,children:`Load an existing workflow`}),(0,$.jsxs)(`div`,{className:`relative max-w-full`,children:[(0,$.jsx)(g,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,$.jsxs)(`select`,{id:`workflow-load`,value:Ie.some(e=>e.name===We)?We:``,onChange:e=>{let t=Ie.find(t=>t.name===e.target.value);t&&c(ii(t))},className:`h-11 max-w-full rounded-lg border border-border bg-card pl-9 pr-3 text-xs font-medium appearance-none focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,$.jsx)(`option`,{value:``,disabled:!0,children:`Choose a workflow`}),Ie.map(e=>(0,$.jsx)(`option`,{value:e.name,"data-slot":`wb-load-option`,"data-name":e.name,children:e.name},e.name))]})]})]}),(0,$.jsx)(`label`,{htmlFor:`workflow-name`,className:`text-xs font-semibold`,children:`Workflow name`}),(0,$.jsx)(Se,{id:`workflow-name`,ref:Pe,"data-slot":`wb-name`,"aria-label":`Workflow name`,spellCheck:!1,value:s.name,onChange:e=>c({...s,name:e.target.value}),className:`h-12 bg-card text-sm`}),(0,$.jsx)(`label`,{htmlFor:`workflow-description`,className:`text-xs font-semibold`,children:`Description`}),(0,$.jsx)(ve,{id:`workflow-description`,"data-slot":`wb-description`,"aria-label":`Description`,value:s.description,onChange:e=>c({...s,description:e.target.value}),className:`min-h-[72px] bg-card p-3.5 text-sm`})]}),(0,$.jsxs)(`div`,{"data-slot":`wb-actions`,className:`grid grid-cols-[max-content_max-content] items-center justify-start gap-2 sm:flex sm:flex-wrap [&_button]:min-h-11 [&_button]:border [&_button]:border-border [&_button]:bg-card`,children:[(0,$.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import`,className:`col-span-2 justify-self-start`,onClick:()=>{Ee(``),B(!1),F(e=>!e)},children:[(0,$.jsx)(_,{"aria-hidden":`true`,className:`size-3`}),`Import`]}),(0,$.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-export`,className:`col-span-2 justify-self-start`,title:`Download workflow.yaml`,onClick:()=>{let e=new Blob([Ke],{type:`text/yaml`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`${Qr(s.name)}.yaml`,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(t),1e3)},children:[(0,$.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),`Export`]}),(0,$.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto`,"aria-expanded":z,title:`Describe a chain — the agent builds it`,onClick:()=>{F(!1),B(e=>!e)},children:[(0,$.jsx)(d,{"aria-hidden":`true`,className:`size-3`}),`Auto`]}),Ge?(0,$.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-delete`,className:`text-danger hover:text-danger`,title:`Delete the saved workflow file`,onClick:()=>Ae(!0),children:[(0,$.jsx)(u,{"aria-hidden":`true`,className:`size-3`}),`Delete`]}):null]}),z?(0,$.jsxs)(`div`,{"data-slot":`wb-auto-panel`,className:`rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,$.jsx)(`h2`,{className:`text-lg font-normal`,children:`Build a chain from a prompt`}),(0,$.jsx)(`p`,{className:`mt-4 text-[13px] leading-relaxed text-muted-foreground`,children:`Describe the outcome. An agent proposes a title and ordered skill/check steps. Review the result, edit it, then Save.`}),(0,$.jsx)(ve,{"data-slot":`wb-auto-text`,"aria-label":`Describe the chain to build`,rows:3,autoFocus:!0,placeholder:`e.g. Fix the bug, run the tests, then review the diff for regressions.`,value:V,onChange:e=>De(e.target.value),onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),Qe())},className:`mt-4 min-h-[108px] bg-background p-4 text-sm`}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,$.jsxs)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-auto-run`,disabled:Ve.isPending||V.trim()===``,onClick:Qe,children:[(0,$.jsx)(d,{"aria-hidden":`true`,className:`size-3`}),Ve.isPending?`Building…`:`Build chain`]}),(0,$.jsxs)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-auto-cancel`,onClick:()=>{B(!1),De(``)},children:[(0,$.jsx)(A,{"aria-hidden":`true`,className:`size-4`}),`Cancel`]})]}),(0,$.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`Creates an editable draft. Review the generated name and steps before saving.`})]}):null,(0,$.jsx)(me,{open:we,onOpenChange:F,children:(0,$.jsxs)(ge,{showCloseButton:!1,"data-slot":`wb-import-panel`,className:`max-md:translate-x-0 max-md:translate-y-0 sm:max-w-[660px] rounded-xl border border-border bg-card p-5 [&_button]:min-h-11`,children:[(0,$.jsx)(_e,{className:`text-xl font-normal`,children:`Import workflow YAML`}),(0,$.jsx)(pe,{className:`sr-only`,children:`Paste a portable workflow definition to import.`}),(0,$.jsx)(ve,{"data-slot":`wb-import-text`,"aria-label":`Workflow YAML to import`,rows:4,spellCheck:!1,placeholder:`name: my-flow
|
|
9
|
-
skills:
|
|
10
|
-
- test-conventions
|
|
11
|
-
- commit-style`,value:Te,onChange:e=>L(e.target.value),className:`mt-4 min-h-[124px] bg-background p-4 font-mono text-[13px] leading-relaxed`}),(0,$.jsx)(`p`,{className:`mt-4 text-[13px] text-muted-foreground`,children:`Paste a portable workflow definition. Imported steps appear in execution order.`}),R===``?null:(0,$.jsx)(`p`,{"data-slot":`wb-import-error`,role:`alert`,className:`mt-2 text-xs text-danger`,children:R}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-1.5`,children:[(0,$.jsx)(C,{type:`button`,variant:`primary`,size:`sm`,"data-slot":`wb-import-run`,disabled:Be.isPending,onClick:Ze,children:`Import`}),(0,$.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,"data-slot":`wb-import-cancel`,onClick:()=>{F(!1),L(``),Ee(``)},children:`Cancel`})]})]})}),(0,$.jsxs)(`div`,{className:`grid min-w-0 items-start gap-[22px] @min-[700px]:grid-cols-[minmax(0,1fr)_300px]`,children:[(0,$.jsxs)(`section`,{"data-slot":`wb-main`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Steps · `,K.length,` of `,8,(0,$.jsx)(`span`,{"data-slot":`wb-count`,className:`sr-only`,children:$r(K)})]}),(0,$.jsx)(si,{steps:K,skills:W,dragging:U!==null,overId:Me,activeStepId:U?.type===`step`?U.step.id:null,onRemove:e=>ze(Yr(K,e)),onMove:(e,t)=>ze(Jr(K,e,t))}),(0,$.jsxs)(C,{ref:Fe,variant:`outline`,className:`mt-4 min-h-11`,onClick:()=>{ye(null),P(``),N(!0)},children:[(0,$.jsx)(l,{"aria-hidden":`true`,className:`size-4`}),`Add step`]}),(0,$.jsxs)(`p`,{className:`mt-4 text-xs leading-relaxed text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`hidden @min-[900px]:inline`,children:`Drag to reorder. The agent follows this sequence from top to bottom.`}),(0,$.jsx)(`span`,{className:`@min-[900px]:hidden`,children:`Use Move up / Move down to reorder without dragging.`})]}),(0,$.jsxs)(`footer`,{className:`mt-4 flex flex-wrap items-center justify-between gap-4 border-t border-border pt-4`,children:[(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`Review the name and steps, then save to a workflow file.`}),(0,$.jsxs)(C,{type:`button`,variant:`primary`,size:`sm`,className:`min-h-11 max-sm:w-full`,"data-slot":`wb-save`,disabled:G.isPending,onClick:()=>{if(We===``){Pe.current?.focus();return}if(K.length===0){O(`Add at least one step first.`,{tone:`danger`});return}G.mutate(!1)},children:[(0,$.jsx)(v,{"aria-hidden":`true`,className:`size-3`}),`Save`]})]})]}),(0,$.jsxs)(`aside`,{"data-slot":`wb-aside`,className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,$.jsx)(`h2`,{className:`text-[15px] font-semibold`,children:`Available skills`}),(0,$.jsxs)(`div`,{className:`sw-search relative mt-4`,children:[(0,$.jsx)(f,{"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,$.jsx)(Se,{"data-slot":`wb-filter`,placeholder:`Find a skill…`,"aria-label":`Filter skills`,value:T,onChange:e=>k(e.target.value),className:`h-11 pl-9 text-xs`})]}),(0,$.jsx)(ui,{skills:Le,query:T,error:n.isError?n.error.message:null,inFlow:new Set(K.map(e=>e.skill).filter(e=>!!e)),onAdd:e=>qe(e)}),(0,$.jsx)(`h3`,{className:`mt-5 text-sm font-semibold`,children:`workflow.yaml`}),(0,$.jsx)(`p`,{className:`mt-3 text-xs leading-relaxed text-muted-foreground`,children:`Export the workflow to use this chain in another project.`}),(0,$.jsxs)(`details`,{className:`mt-4 min-w-0`,children:[(0,$.jsxs)(`summary`,{"data-slot":`wb-yaml-toggle`,className:`inline-flex min-h-[44px] cursor-pointer items-center rounded-lg border border-border px-3 text-xs font-medium focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,$.jsx)(S,{"aria-hidden":`true`,className:`mr-2 size-4`}),`View YAML`]}),(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsx)(fi,{yaml:Ke})}),(0,$.jsx)(`pre`,{"data-slot":`wb-yaml`,className:`mt-2 max-h-96 overflow-auto rounded-lg border border-border bg-background p-3 font-mono text-[11.5px] leading-relaxed whitespace-pre text-muted-foreground`,children:Ke})]})]})]})]}),(0,$.jsx)(vr,{children:U?.type===`palette`?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[13px] font-medium shadow-md`,children:[(0,$.jsx)(h,{"aria-hidden":`true`,className:`size-3.5 text-link-foreground`}),U.skill]}):U?.type===`step`?(0,$.jsx)(li,{step:U.step,index:K.findIndex(e=>e.id===U.step.id),skills:W,overlay:!0}):null})]}),(0,$.jsx)(me,{open:M,onOpenChange:N,children:(0,$.jsxs)(ge,{"data-slot":`wb-add-dialog`,onCloseAutoFocus:e=>{e.preventDefault(),Fe.current?.focus()},className:`max-h-[85dvh] overflow-y-auto sm:max-w-[660px] [&_button]:min-h-11`,children:[(0,$.jsxs)(he,{children:[(0,$.jsx)(_e,{className:`text-xl font-normal`,children:`Add step`}),(0,$.jsx)(pe,{className:`sr-only`,children:`Choose a skill to append to this workflow.`})]}),(0,$.jsx)(Se,{"aria-label":`Filter skills`,placeholder:`Filter skills…`,value:de,onChange:e=>P(e.target.value)}),n.isError?(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm text-danger`,children:[`Could not load skills: `,n.error.message]}):(0,$.jsxs)(`div`,{role:`radiogroup`,"aria-label":`Available skills`,className:`grid max-h-80 gap-2 overflow-y-auto`,children:[Re.map(e=>(0,$.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg py-2 has-[:checked]:bg-accent-strong/10 has-[:focus-visible]:outline-2`,children:[(0,$.jsx)(`input`,{type:`radio`,name:`workflow-add-skill`,className:`sr-only`,value:e.name,checked:fe===e.name,onChange:()=>ye(e.name)}),(0,$.jsxs)(`span`,{className:`min-w-0 break-words text-sm`,children:[(0,$.jsx)(`span`,{className:`block`,children:e.name}),(0,$.jsx)(`span`,{className:`mt-2 block text-xs text-muted-foreground`,children:e.description})]})]},e.name)),Re.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:W.length===0?`No skills available in this project.`:`No matching skills.`}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,$.jsx)(C,{variant:`outline`,onClick:()=>N(!1),children:`Cancel`}),(0,$.jsx)(C,{variant:`primary`,disabled:!fe||K.length>=8,onClick:()=>{fe&&(qe(fe),N(!1))},children:`Add selected skill`})]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Append the selected skill, then reorder it in the existing canvas.`}),K.length>=8?(0,$.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`A workflow can contain up to `,8,` steps. Remove a step before adding another.`]}):null]})}),(0,$.jsx)(le,{open:Oe,onOpenChange:e=>!e&&H(!1),children:(0,$.jsxs)(w,{"data-slot":`wb-overwrite-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,$.jsxs)(D,{children:[(0,$.jsxs)(ee,{children:[`“`,We,`” already exists`]}),(0,$.jsx)(b,{children:`Saving overwrites the existing workflow file. There is no undo.`})]}),(0,$.jsxs)(E,{children:[(0,$.jsx)(ce,{children:`Keep the file`}),(0,$.jsx)(ae,{"data-slot":`wb-overwrite-confirm`,className:`bg-danger text-danger-foreground`,onClick:()=>G.mutate(!0),children:`Overwrite`})]})]})}),(0,$.jsx)(le,{open:ke,onOpenChange:e=>!e&&Ae(!1),children:(0,$.jsxs)(w,{"data-slot":`wb-delete-dialog`,className:`sw-workflow-confirm sm:max-w-[660px]`,children:[(0,$.jsxs)(D,{children:[(0,$.jsxs)(ee,{children:[`Delete workflow “`,We,`”?`]}),(0,$.jsxs)(b,{children:[`Removes `,Ge?.path?.split(`/`).pop()??`the saved file`,` from`,` `,(0,$.jsx)(`span`,{className:`font-mono`,children:`.ai/cezar/workflows/`}),`. There is no undo.`]})]}),(0,$.jsxs)(E,{children:[(0,$.jsx)(ce,{children:`Keep the file`}),(0,$.jsx)(ae,{"data-slot":`wb-delete-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>He.mutate(We),children:`Delete workflow`})]})]})})]})}function si({steps:e,skills:t,dragging:n,overId:r,activeStepId:i,onRemove:a,onMove:o}){let{setNodeRef:s,isOver:c}=or({id:ni}),l=n&&r===ni;return(0,$.jsx)(`div`,{ref:s,"data-slot":`wb-steps`,"data-dragging":n||void 0,className:M(`relative mt-4 rounded-lg transition-colors`,c?`border-accent-strong/60 bg-accent-strong/5`:`border-muted-foreground/25`),children:e.length===0?(0,$.jsx)(`p`,{className:M(`rounded-md px-3 py-10 text-center text-[13px] transition-colors`,c?`text-link-foreground`:`text-muted-foreground`),children:`Drop a skill here — or Import a workflow.yaml`}):(0,$.jsxs)(Ar,{items:e.map(e=>e.id),strategy:Er,children:[(0,$.jsx)(`ol`,{className:`flex flex-col gap-4`,children:e.map((s,c)=>(0,$.jsx)(ci,{step:s,index:c,skills:t,dragging:n,insertBefore:n&&r===s.id&&i!==s.id,onRemove:()=>a(c),onMoveUp:c>0?()=>o(c,c-1):void 0,onMoveDown:c<e.length-1?()=>o(c,c+1):void 0},s.id))}),(0,$.jsx)(`div`,{"aria-hidden":`true`,className:M(`absolute inset-x-0 mt-1 h-[3px] rounded-full transition-colors`,l?`bg-accent-strong`:`bg-transparent`)})]})})}function ci({step:e,index:t,skills:n,dragging:r,insertBefore:i,onRemove:a,onMoveUp:o,onMoveDown:s}){let{attributes:c,listeners:l,setNodeRef:u,transform:d,transition:f,isDragging:p}=Rr({id:e.id,data:{type:`step`,step:e}});return(0,$.jsxs)(`li`,{ref:u,style:{transform:G.Transform.toString(d),transition:f},className:M(`relative`,p&&`opacity-40`),children:[i?(0,$.jsx)(`span`,{"aria-hidden":`true`,"data-slot":`wb-drop-line`,className:`pointer-events-none absolute -top-[7px] right-0 left-0 h-[3px] rounded-full bg-accent-strong`}):null,(0,$.jsx)(li,{step:e,index:t,skills:n,onRemove:a,onMoveUp:o,onMoveDown:s,gripProps:{...c,...l}})]})}function li({step:e,index:t,skills:n,onRemove:r,gripProps:i,onMoveUp:a,onMoveDown:o,overlay:l=!1}){let d=n.find(t=>t.name===e.skill),f=!!e.command,p=e.name??e.skill??e.id,m=e.prompt?.trim()===`{{task}}`?void 0:e.prompt?.trim(),h=f?`$ ${e.command}${e.onFail?` — on fail retry from "${e.onFail.retry}" (×${e.onFail.max??2})`:``}`:e.skill?m||d?.description||`Not in this repo or the team skills — the step runs on its plain prompt.`:e.prompt??``,g=e.skill&&!d?`unknown`:null;return(0,$.jsxs)(`div`,{"data-slot":`wb-step`,"data-id":e.id,"data-index":t,className:M(`rounded-lg border border-border bg-background p-4`,l&&`shadow-md`),children:[(0,$.jsxs)(`div`,{"data-slot":`wb-step-heading`,className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-step-grip`,"aria-label":`Reorder step ${t+1}: ${p}`,className:`inline-flex size-[26px] shrink-0 cursor-grab items-center justify-center rounded-md text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,...i,children:(0,$.jsx)(`span`,{className:`rounded bg-accent-strong/10 px-2 py-1 font-mono text-[10px] text-link-foreground`,children:String(t+1).padStart(2,`0`)})}),(0,$.jsx)(`div`,{className:`min-w-0 flex-1 break-words text-sm font-medium [overflow-wrap:anywhere]`,children:p}),g?(0,$.jsx)(`span`,{"data-slot":`wb-step-badge`,className:M(`shrink-0 rounded-full border px-2 py-px font-mono text-[10.5px]`,g===`unknown`&&`border-danger/35 text-danger`),children:g}):null,r?(0,$.jsxs)(fe,{children:[(0,$.jsx)(de,{asChild:!0,children:(0,$.jsx)(C,{"data-slot":`wb-step-actions`,variant:`ghost`,size:`icon`,className:`size-[26px]`,"aria-label":`Step ${t+1} actions: ${p}`,children:(0,$.jsx)(k,{"aria-hidden":`true`,className:`size-4`})})}),(0,$.jsx)(P,{align:`end`,children:(0,$.jsxs)(N,{"data-slot":`wb-step-remove`,"aria-label":`Remove step ${t+1}: ${p}`,onSelect:r,children:[(0,$.jsx)(u,{"aria-hidden":`true`}),` Remove step`]})})]}):null]}),h?(0,$.jsx)(`div`,{"data-slot":`wb-step-summary`,className:`mt-3 break-words text-xs leading-relaxed text-muted-foreground`,children:h}):null,(0,$.jsx)(`p`,{"data-slot":`wb-step-kind`,className:`mt-3 text-[10px] text-link-foreground`,children:f?`Command step${e.onFail?` · Retry ×${e.onFail.max??2}`:``}`:e.skill?`Skill step`:`Prompt step`}),l?null:(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 @min-[900px]:hidden`,children:[(0,$.jsxs)(C,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${t+1} up`,disabled:!a,onClick:a,children:[(0,$.jsx)(s,{"aria-hidden":`true`,className:`size-4`}),`Move up`]}),(0,$.jsxs)(C,{variant:`outline`,size:`sm`,className:`min-h-11`,"aria-label":`Move step ${t+1} down`,disabled:!o,onClick:o,children:[(0,$.jsx)(c,{"aria-hidden":`true`,className:`size-4`}),`Move down`]})]})]})}function ui({skills:e,query:t,error:n,inFlow:r,onAdd:i}){if(n!==null)return(0,$.jsxs)(`p`,{"data-slot":`wb-palette`,className:`mt-2.5 text-xs text-danger`,children:[`Could not load skills: `,n]});let a=be(e,t);return(0,$.jsx)(`div`,{"data-slot":`wb-palette`,className:`mt-2.5 flex flex-col gap-1`,children:a.length>0?a.map(e=>(0,$.jsx)(di,{skill:e,inFlow:r.has(e.name),onAdd:i},e.path)):(0,$.jsx)(`p`,{className:`py-1 text-xs leading-relaxed text-soft-foreground`,children:e.length>0?`No skills match.`:(0,$.jsx)(we,{})})})}function di({skill:e,inFlow:t,onAdd:n}){let{attributes:r,listeners:i,setNodeRef:a,isDragging:o}=nr({id:`palette:${e.name}`,data:{type:`palette`,skill:e.name}});return(0,$.jsxs)(`div`,{ref:a,"data-slot":`wb-skill`,"data-skill":e.name,"data-in-flow":t||void 0,title:e.description??``,className:M(`flex min-h-11 cursor-grab items-center gap-2 rounded-md py-1 transition-colors hover:bg-muted`,o&&`opacity-40`),...r,...i,children:[(0,$.jsx)(`span`,{className:M(`min-w-0 flex-1 break-words text-xs`,ye(e)?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-skill-add`,"aria-label":`Add ${e.name} to the flow`,title:`Add to the flow`,onClick:()=>n(e.name),className:`inline-flex size-11 shrink-0 items-center justify-center rounded-md text-link-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:(0,$.jsx)(l,{"aria-hidden":`true`,className:`size-3.5`})})]})}function fi({yaml:e}){let[t,n]=(0,I.useState)(!1),r=(0,I.useRef)(null);return(0,I.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]),(0,$.jsx)(`button`,{type:`button`,"data-slot":`wb-copy`,title:`Copy the YAML`,onClick:()=>{navigator.clipboard?.writeText(e).catch(()=>{}),n(!0),r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1600)},className:`flex items-center gap-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground`,children:t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(v,{"aria-hidden":`true`,className:`size-3 text-success`}),`Copied`]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(T,{"aria-hidden":`true`,className:`size-3`}),`Copy`]})})}export{ai as WorkflowsRoute};
|