orc-ai 0.1.65 → 0.1.66

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.
Files changed (90) hide show
  1. package/dist/index.js +962 -856
  2. package/dist/web/assets/{Agents-CXxHOAVS.js → Agents-Ea53mwU5.js} +2 -2
  3. package/dist/web/assets/AreaChart-DkQeb97X.js +53 -0
  4. package/dist/web/assets/Audit-DAiirOM4.js +1 -0
  5. package/dist/web/assets/ChatUiRenderer-DJT_oi3u.js +4 -0
  6. package/dist/web/assets/{ConfirmDialog-DKN0AVIw.js → ConfirmDialog-C3dzLtR4.js} +1 -1
  7. package/dist/web/assets/Dashboard-slRH5N5R.js +1 -0
  8. package/dist/web/assets/{DocumentWorkspace-B9hQN2EX.js → DocumentWorkspace-wa4thtsL.js} +1 -1
  9. package/dist/web/assets/{FileEditor-BK8_4AJM.js → FileEditor-XqW9fb96.js} +1 -1
  10. package/dist/web/assets/{IntegrationCallback-DCf4a1AA.js → IntegrationCallback-DNevaJXw.js} +1 -1
  11. package/dist/web/assets/{JobWebhooks-C2F4RzTr.js → JobWebhooks-aMXo5S6g.js} +1 -1
  12. package/dist/web/assets/Jobs-BM9nAyJy.js +3 -0
  13. package/dist/web/assets/Knowledge-09MwCxYi.js +1 -0
  14. package/dist/web/assets/{MarkdownRenderer-DM6lt7Sg.js → MarkdownRenderer-CrSV3P6q.js} +5 -5
  15. package/dist/web/assets/{NativeFolderField-D1ZqCzY1.js → NativeFolderField-srI-ZtZZ.js} +1 -1
  16. package/dist/web/assets/{Notifications-Ciw_MC2q.js → Notifications-BcvzwMXq.js} +1 -1
  17. package/dist/web/assets/PackageCatalog-CBsyIWnV.js +8 -0
  18. package/dist/web/assets/{PackageRunDialog-CW_N4ttU.js → PackageRunDialog-BQ3-6zSn.js} +7 -7
  19. package/dist/web/assets/{Pager-B-GnS1ry.js → Pager-D0n3VFBv.js} +1 -1
  20. package/dist/web/assets/Projects-vx3NvaMW.js +3 -0
  21. package/dist/web/assets/{ResponsiveFilters-BwU4JbGU.js → ResponsiveFilters-DZtbOOk-.js} +1 -1
  22. package/dist/web/assets/ResumeActions-pClJ3sij.js +1 -0
  23. package/dist/web/assets/{Rules-Dqx8X4wX.js → Rules-CDAUasTP.js} +2 -2
  24. package/dist/web/assets/{ScratchpadDiagramEditor-iUkemC_h.js → ScratchpadDiagramEditor-B-zDXmlg.js} +1 -1
  25. package/dist/web/assets/Scratchpads-DGo0X8eK.js +10 -0
  26. package/dist/web/assets/SessionContextChart-DQLkAChi.js +1 -0
  27. package/dist/web/assets/{SessionHomeLink-DKoq9wT8.js → SessionHomeLink-Cxs6iwyM.js} +1 -1
  28. package/dist/web/assets/Sessions-CbnzU19J.js +5 -0
  29. package/dist/web/assets/Settings-CBoQPHwB.js +14 -0
  30. package/dist/web/assets/Skills-DdI2Yc07.js +3 -0
  31. package/dist/web/assets/{SourceEditor-CKe3Nz5k.js → SourceEditor-DxwuHwxq.js} +3 -3
  32. package/dist/web/assets/{TagInput-QqNDQOz_.js → TagInput-DhTBLa-Y.js} +1 -1
  33. package/dist/web/assets/TaskDetailSheet-BNj2WDE2.js +1 -0
  34. package/dist/web/assets/Tasks-SMG8VxgV.js +22 -0
  35. package/dist/web/assets/Terminals-BUW5kPFm.js +2 -0
  36. package/dist/web/assets/{ViewHeader-BiFirRWq.js → ViewHeader-C0jvjK4H.js} +1 -1
  37. package/dist/web/assets/{Webhooks-8B-qbOiF.js → Webhooks-3VEhlc54.js} +1 -1
  38. package/dist/web/assets/{badge-BEhHQEk0.js → badge-B-HUZUEh.js} +1 -1
  39. package/dist/web/assets/check-D6qPSbzK.js +1 -0
  40. package/dist/web/assets/chevron-down-BOVfTOEc.js +1 -0
  41. package/dist/web/assets/chevron-up-Cc1Ej9c-.js +1 -0
  42. package/dist/web/assets/{circle-check-CrMHbBhC.js → circle-check-DheEkK87.js} +1 -1
  43. package/dist/web/assets/client-CU0CuJmV.js +1 -0
  44. package/dist/web/assets/dist-K8VprW0w.js +1 -0
  45. package/dist/web/assets/{download-Cnjcb403.js → download-CHoQtgi5.js} +1 -1
  46. package/dist/web/assets/eye-off-Bu5lzZba.js +1 -0
  47. package/dist/web/assets/{highlighted-body-JLMTFACH-DqkWK4Ru.js → highlighted-body-JLMTFACH-DGCWiTQ4.js} +1 -1
  48. package/dist/web/assets/index-D9oB2Mu_.css +1 -0
  49. package/dist/web/assets/index-DQH0HZcb.js +134 -0
  50. package/dist/web/assets/live-sessions-Drv2_M1y.js +1 -0
  51. package/dist/web/assets/{maximize-2-ar3sWM7r.js → maximize-2-DBU42483.js} +1 -1
  52. package/dist/web/assets/mermaid-WFAXDIZX-D9sLmKsI.js +1 -0
  53. package/dist/web/assets/{scratchpad-kinds-BFBap9Ix.js → scratchpad-kinds-DugBIeUW.js} +1 -1
  54. package/dist/web/assets/{scratchpad-routes-DqBRARVl.js → scratchpad-routes-crwVjDaM.js} +1 -1
  55. package/dist/web/assets/{send-CwHls3BT.js → send-DIQ-1FHy.js} +1 -1
  56. package/dist/web/assets/{upload-Bbixlc7i.js → upload-2b4q__Wd.js} +1 -1
  57. package/dist/web/assets/{useIntegrations-D5PIxedU.js → useIntegrations-Dxa_V2z0.js} +1 -1
  58. package/dist/web/assets/{useJobs-DYaqHA8F.js → useJobs-DIARQp4w.js} +1 -1
  59. package/dist/web/assets/{useMemories-Ce1S_iFK.js → useMemories-Ba4rSH8N.js} +1 -1
  60. package/dist/web/assets/x-Dpr46SlC.js +1 -0
  61. package/dist/web/index.html +10 -11
  62. package/package.json +1 -1
  63. package/dist/web/assets/Audit-B38_H4W1.js +0 -1
  64. package/dist/web/assets/ChatUiRenderer-BYlgsVLZ.js +0 -4
  65. package/dist/web/assets/Dashboard-BZKUS4Tw.js +0 -1
  66. package/dist/web/assets/Jobs-Dho4B9b-.js +0 -3
  67. package/dist/web/assets/Knowledge-CDhPBr8J.js +0 -1
  68. package/dist/web/assets/PackageCatalog-BuT4GoJo.js +0 -8
  69. package/dist/web/assets/Projects-C27puQUE.js +0 -3
  70. package/dist/web/assets/ResumeActions-S3h5yKXv.js +0 -1
  71. package/dist/web/assets/Scratchpads-DRIBlLwW.js +0 -10
  72. package/dist/web/assets/SessionContextChart-CXAR0czK.js +0 -53
  73. package/dist/web/assets/Sessions-DBthIWpR.js +0 -5
  74. package/dist/web/assets/Settings-DU-nfC2z.js +0 -14
  75. package/dist/web/assets/Skills-BPkciOfy.js +0 -3
  76. package/dist/web/assets/TaskDetailSheet-BGAiFxPD.js +0 -1
  77. package/dist/web/assets/Tasks-daCTnumY.js +0 -22
  78. package/dist/web/assets/Terminals-CmRdwS_i.js +0 -2
  79. package/dist/web/assets/check-cnj-S1QW.js +0 -1
  80. package/dist/web/assets/chevron-down-CsfelGxA.js +0 -1
  81. package/dist/web/assets/chevron-up-COeKodk9.js +0 -1
  82. package/dist/web/assets/client-RPZmgRqE.js +0 -1
  83. package/dist/web/assets/dist-B-iYpxX5.js +0 -1
  84. package/dist/web/assets/dist-bytwC6rk.js +0 -1
  85. package/dist/web/assets/index-DMLXoHsj.css +0 -1
  86. package/dist/web/assets/index-DsVJrhHJ.js +0 -134
  87. package/dist/web/assets/live-sessions-DYGSpoN-.js +0 -1
  88. package/dist/web/assets/mermaid-WFAXDIZX-3nzsUtGy.js +0 -1
  89. package/dist/web/assets/useSessions-D1nMvBf0.js +0 -1
  90. package/dist/web/assets/x-uOircJYm.js +0 -1
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./useMutation-CRAWY7v2.js";import{t as i}from"./button-BlVCkBiz.js";import{n as a}from"./client-RPZmgRqE.js";import{Gt as o,Yr as s}from"./index-DsVJrhHJ.js";var c=e(t(),1),l=n();function u(e,t=`the folder`){let n=e.level===`identical`?`Identical to`:e.level===`near`?`Near copy of`:`Similar to`,r=e.where===`orc`?`in ORC`:`in ${t}`;return`${n} ${e.name} ${r} (${Math.round(e.score*100)}%)`}function d({match:e,folder:t}){return e?(0,l.jsx)(`span`,{className:`block text-xs text-warning wrap-break-word`,"data-testid":`transfer-match`,children:u(e,t)}):null}var f=`project:`;function p({withSkillsOnly:e}){return(r({queryKey:[`skills`,`project-folders`],queryFn:()=>a.skills.projectFolders()}).data?.projects??[]).map(t=>{let n=t.folders.filter(t=>!e||t.skills>0);return n.length?(0,l.jsx)(`optgroup`,{label:`Project ${t.project_name} (${t.root})`,children:n.map(e=>(0,l.jsxs)(`option`,{value:`${f}${e.dir}`,children:[t.project_name,`: `,e.label,` (`,e.dir,e.skills?`, ${e.skills} skills`:``,`)`]},e.dir))},t.root):null})}function m({id:e,label:t,value:n,onChange:r,disabled:a}){let[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(null);return(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,l.jsx)(s,{id:e,"data-testid":e,value:n,disabled:a,placeholder:`Absolute folder path on the API host`,onChange:e=>r(e.target.value)}),(0,l.jsx)(i,{type:`button`,variant:`outline`,ref:f,"data-testid":`${e}-browse`,disabled:a,onClick:()=>d(!0),children:`Browse`})]}),(0,l.jsx)(o,{open:u,onOpenChange:d,host:null,initial:n,onPick:r,returnFocusRef:f})]})}export{p as i,m as n,f as r,d as t};
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./useMutation-CRAWY7v2.js";import{t as i}from"./button-BlVCkBiz.js";import{n as a}from"./client-CU0CuJmV.js";import{an as o,li as s}from"./index-DQH0HZcb.js";var c=e(t(),1),l=n();function u(e,t=`the folder`){let n=e.level===`identical`?`Identical to`:e.level===`near`?`Near copy of`:`Similar to`,r=e.where===`orc`?`in ORC`:`in ${t}`;return`${n} ${e.name} ${r} (${Math.round(e.score*100)}%)`}function d({match:e,folder:t}){return e?(0,l.jsx)(`span`,{className:`block text-xs text-warning wrap-break-word`,"data-testid":`transfer-match`,children:u(e,t)}):null}var f=`project:`;function p({withSkillsOnly:e}){return(r({queryKey:[`skills`,`project-folders`],queryFn:()=>a.skills.projectFolders()}).data?.projects??[]).map(t=>{let n=t.folders.filter(t=>!e||t.skills>0);return n.length?(0,l.jsx)(`optgroup`,{label:`Project ${t.project_name} (${t.root})`,children:n.map(e=>(0,l.jsxs)(`option`,{value:`${f}${e.dir}`,children:[t.project_name,`: `,e.label,` (`,e.dir,e.skills?`, ${e.skills} skills`:``,`)`]},e.dir))},t.root):null})}function m({id:e,label:t,value:n,onChange:r,disabled:a}){let[u,d]=(0,c.useState)(!1),f=(0,c.useRef)(null);return(0,l.jsxs)(`div`,{className:`space-y-1`,children:[(0,l.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),(0,l.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,l.jsx)(s,{id:e,"data-testid":e,value:n,disabled:a,placeholder:`Absolute folder path on the API host`,onChange:e=>r(e.target.value)}),(0,l.jsx)(i,{type:`button`,variant:`outline`,ref:f,"data-testid":`${e}-browse`,disabled:a,onClick:()=>d(!0),children:`Browse`})]}),(0,l.jsx)(o,{open:u,onOpenChange:d,host:null,initial:n,onPick:r,returnFocusRef:f})]})}export{p as i,m as n,f as r,d as t};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{f as r,h as i}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as a}from"./button-BlVCkBiz.js";import{Bi as o,Fi as s,Ln as c,Rn as l}from"./index-DsVJrhHJ.js";import{t as u}from"./ViewHeader-BiFirRWq.js";var d=e(t(),1),f=n();function p(){let e=l(),t=r(),[n]=i(),p=n.get(`request`),m=e.setSelected;return(0,d.useEffect)(()=>{p&&m(p)},[p,m]),(0,f.jsxs)(`div`,{"data-testid":`notifications-page`,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-background`,children:[e.phone?(0,f.jsxs)(`header`,{className:`flex min-h-12 shrink-0 items-center gap-1 border-b border-border px-2`,children:[(0,f.jsx)(a,{variant:`ghost`,size:`icon`,"data-testid":`notifications-back`,"aria-label":`Back`,className:`min-h-11 min-w-11`,onClick:()=>{(window.history.state?.idx??0)>0?t(-1):t(`/activity`)},children:(0,f.jsx)(o,{})}),(0,f.jsx)(`h1`,{className:`min-w-0 truncate font-headline text-base font-medium text-on-surface`,children:`Notifications`}),e.unread>0&&(0,f.jsxs)(`span`,{className:`shrink-0 text-sm text-outline`,children:[e.unread,` unread`]}),(0,f.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,f.jsx)(a,{variant:`ghost`,size:`icon`,"data-testid":`notifications-mark-all-read`,"aria-label":`Mark all read`,title:`Mark all read`,className:`min-h-11 min-w-11`,disabled:!e.unread||e.markAllBusy,onClick:e.markAllRead,children:(0,f.jsx)(s,{})})]}):(0,f.jsx)(`div`,{className:`shrink-0 px-6 pt-6`,children:(0,f.jsx)(u,{title:`Notifications`,meta:`${e.unread} unread`,action:(0,f.jsxs)(a,{size:`sm`,variant:`ghost`,"data-testid":`notifications-mark-all-read`,disabled:!e.unread||e.markAllBusy,onClick:e.markAllRead,children:[(0,f.jsx)(s,{}),` Mark all read`]})})}),(0,f.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]`,children:(0,f.jsx)(c,{onOpenRequest:t=>{e.setSelected(t);let n=e.items.find(e=>e.type===`human.request`&&e.source_id===t);n&&!n.read_at&&e.setRead(n.id,!0)}})})]})}export{p as default};
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{f as r,h as i}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as a}from"./button-BlVCkBiz.js";import{Qn as o,Yi as s,Zn as c,ea as l}from"./index-DQH0HZcb.js";import{t as u}from"./ViewHeader-C0jvjK4H.js";var d=e(t(),1),f=n();function p(){let e=o(),t=r(),[n]=i(),p=n.get(`request`),m=e.setSelected;return(0,d.useEffect)(()=>{p&&m(p)},[p,m]),(0,f.jsxs)(`div`,{"data-testid":`notifications-page`,className:`flex h-full min-h-0 w-full min-w-0 flex-col bg-background`,children:[e.phone?(0,f.jsxs)(`header`,{className:`flex min-h-12 shrink-0 items-center gap-1 border-b border-border px-2`,children:[(0,f.jsx)(a,{variant:`ghost`,size:`icon`,"data-testid":`notifications-back`,"aria-label":`Back`,className:`min-h-11 min-w-11`,onClick:()=>{(window.history.state?.idx??0)>0?t(-1):t(`/activity`)},children:(0,f.jsx)(l,{})}),(0,f.jsx)(`h1`,{className:`min-w-0 truncate font-headline text-base font-medium text-on-surface`,children:`Notifications`}),e.unread>0&&(0,f.jsxs)(`span`,{className:`shrink-0 text-sm text-outline`,children:[e.unread,` unread`]}),(0,f.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,f.jsx)(a,{variant:`ghost`,size:`icon`,"data-testid":`notifications-mark-all-read`,"aria-label":`Mark all read`,title:`Mark all read`,className:`min-h-11 min-w-11`,disabled:!e.unread||e.markAllBusy,onClick:e.markAllRead,children:(0,f.jsx)(s,{})})]}):(0,f.jsx)(`div`,{className:`shrink-0 px-6 pt-6`,children:(0,f.jsx)(u,{title:`Notifications`,meta:`${e.unread} unread`,action:(0,f.jsxs)(a,{size:`sm`,variant:`ghost`,"data-testid":`notifications-mark-all-read`,disabled:!e.unread||e.markAllBusy,onClick:e.markAllRead,children:[(0,f.jsx)(s,{}),` Mark all read`]})})}),(0,f.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pb-[env(safe-area-inset-bottom)]`,children:(0,f.jsx)(c,{onOpenRequest:t=>{e.setSelected(t);let n=e.items.find(e=>e.type===`human.request`&&e.source_id===t);n&&!n.read_at&&e.setRead(n.id,!0)}})})]})}export{p as default};
@@ -0,0 +1,8 @@
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r}from"./QueryClientProvider-DlPztvhd.js";import{n as i,t as a}from"./useMutation-CRAWY7v2.js";import{f as o,h as s}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as c}from"./button-BlVCkBiz.js";import{h as l,n as u}from"./client-CU0CuJmV.js";import{t as d}from"./ResponsiveFilters-DZtbOOk-.js";import{t as f}from"./upload-2b4q__Wd.js";import{Bt as p,Gt as m,Sn as h,Vi as g,Vt as _,Wt as v,_i as y,_n as b,_t as x,ci as S,ct as C,ii as w,li as T,ri as E,ti as D,vn as O,xn as ee,yn as k,yt as A,zt as j}from"./index-DQH0HZcb.js";import{t as M}from"./save-file-3ZpJah8W.js";import{a as N,i as P,n as te,r as F,t as ne}from"./PackageRunDialog-BQ3-6zSn.js";import{t as I}from"./ViewHeader-C0jvjK4H.js";import{t as L}from"./useDetailRoute-B-xjWsyW.js";import{t as R}from"./view-params-YEmeZppw.js";import{t as z}from"./primitive-files-BKGHFjYN.js";var B={name:`package-plus`,size:24,node:[[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`path`,{d:`M16 17h6`,key:`1ook5g`}],[`path`,{d:`M19 14v6`,key:`1ckrd5`}],[`path`,{d:`M21 10.535V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.729l7 4a2 2 0 0 0 2 .001l1.675-.955`,key:`28k6lz`}],[`path`,{d:`M3.29 7 12 12l8.71-5`,key:`19ckod`}],[`path`,{d:`m7.5 4.27 8.997 5.148`,key:`9yrvtv`}]]};B.node;var re=l(B),V=Uint8Array,H=Uint16Array,U=Int32Array,W=new V([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ie=new V([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),G=new V([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ae=function(e,t){for(var n=new H(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new U(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},K=ae(W,2),oe=K.b,se=K.r;oe[28]=258,se[258]=28;for(var ce=ae(ie,0),le=ce.b,q=ce.r,ue=new H(32768),J=0;J<32768;++J){var de=(J&43690)>>1|(J&21845)<<1;de=(de&52428)>>2|(de&13107)<<2,de=(de&61680)>>4|(de&3855)<<4,ue[J]=((de&65280)>>8|(de&255)<<8)>>1}for(var fe=(function(e,t,n){for(var r=e.length,i=0,a=new H(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new H(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new H(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[ue[d]>>c]=l}else for(s=new H(r),i=0;i<r;++i)e[i]&&(s[i]=ue[o[e[i]-1]++]>>15-e[i]);return s}),pe=new V(288),J=0;J<144;++J)pe[J]=8;for(var J=144;J<256;++J)pe[J]=9;for(var J=256;J<280;++J)pe[J]=7;for(var J=280;J<288;++J)pe[J]=8;for(var me=new V(32),J=0;J<32;++J)me[J]=5;var he=fe(pe,9,0),ge=fe(pe,9,1),_e=fe(me,5,0),ve=fe(me,5,1),ye=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},be=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},xe=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Se=function(e){return(e+7)/8|0},Ce=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new V(e.subarray(t,n))},we=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],Y=function(e,t,n){var r=Error(t||we[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Y),!n)throw r;return r},Te=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new V(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new V(i*3));var l=function(e){var t=n.length;if(e>t){var r=new V(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=be(e,d,1);var v=be(e,d+1,3);if(d+=3,!v){var y=Se(d)+4,b=e[y-4]|e[y-3]<<8,x=y+b;if(x>i){c&&Y(0);break}s&&l(f+b),n.set(e.subarray(y,x),f),t.b=f+=b,t.p=d=x*8,t.f=u;continue}if(v==1)p=ge,m=ve,h=9,g=5;else if(v==2){var S=be(e,d,31)+257,C=be(e,d+10,15)+4,w=S+be(e,d+5,31)+1;d+=14;for(var T=new V(w),E=new V(19),D=0;D<C;++D)E[G[D]]=be(e,d+D*3,7);d+=C*3;for(var O=ye(E),ee=(1<<O)-1,k=fe(E,O,1),D=0;D<w;){var A=k[be(e,d,ee)];d+=A&15;var y=A>>4;if(y<16)T[D++]=y;else{var j=0,M=0;for(y==16?(M=3+be(e,d,3),d+=2,j=T[D-1]):y==17?(M=3+be(e,d,7),d+=3):y==18&&(M=11+be(e,d,127),d+=7);M--;)T[D++]=j}}var N=T.subarray(0,S),P=T.subarray(S);h=ye(N),g=ye(P),p=fe(N,h,1),m=fe(P,g,1)}else Y(1);if(d>_){c&&Y(0);break}}s&&l(f+131072);for(var te=(1<<h)-1,F=(1<<g)-1,ne=d;;ne=d){var j=p[xe(e,d)&te],I=j>>4;if(d+=j&15,d>_){c&&Y(0);break}if(j||Y(2),I<256)n[f++]=I;else if(I==256){ne=d,p=null;break}else{var L=I-254;if(I>264){var D=I-257,R=W[D];L=be(e,d,(1<<R)-1)+oe[D],d+=R}var z=m[xe(e,d)&F],B=z>>4;z||Y(3),d+=z&15;var P=le[B];if(B>3){var R=ie[B];P+=xe(e,d)&(1<<R)-1,d+=R}if(d>_){c&&Y(0);break}s&&l(f+131072);var re=f+L;if(f<P){var H=a-P,U=Math.min(P,re);for(H+f<0&&Y(3);f<U;++f)n[f]=r[H+f]}for(;f<re;++f)n[f]=n[f-P]}}t.l=p,t.p=ne,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?Ce(n,0,f):n.subarray(0,f)},Ee=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},De=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},Oe=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:Fe,l:0};if(i==1){var o=new V(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new H(f+1),m=ke(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new V(p),l:m}},ke=function(e,t,n){return e.s==-1?Math.max(ke(e.l,t,n+1),ke(e.r,t,n+1)):t[e.s]=n},Ae=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new H(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},je=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},Me=function(e,t,n){var r=n.length,i=Se(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},Ne=function(e,t,n,r,i,a,o,s,c,l,u){Ee(t,u++,n),++i[256];for(var d=Oe(i,15),f=d.t,p=d.l,m=Oe(a,15),h=m.t,g=m.l,_=Ae(f),v=_.c,y=_.n,b=Ae(h),x=b.c,S=b.n,C=new H(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=Oe(C,7),E=T.t,D=T.l,O=19;O>4&&!E[G[O-1]];--O);var ee=l+5<<3,k=je(i,pe)+je(a,me)+o,A=je(i,f)+je(a,h)+o+14+3*O+je(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&ee<=k&&ee<=A)return Me(t,u,e.subarray(c,c+l));var j,M,N,P;if(Ee(t,u,1+(A<k)),u+=2,A<k){j=fe(f,p,0),M=f,N=fe(h,g,0),P=h;var te=fe(E,D,0);Ee(t,u,y-257),Ee(t,u+5,S-1),Ee(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)Ee(t,u+3*w,E[G[w]]);u+=3*O;for(var F=[v,x],ne=0;ne<2;++ne)for(var I=F[ne],w=0;w<I.length;++w){var L=I[w]&31;Ee(t,u,te[L]),u+=E[L],L>15&&(Ee(t,u,I[w]>>5&127),u+=I[w]>>12)}}else j=he,M=pe,N=_e,P=me;for(var w=0;w<s;++w){var R=r[w];if(R>255){var L=R>>18&31;De(t,u,j[L+257]),u+=M[L+257],L>7&&(Ee(t,u,R>>23&31),u+=W[L]);var z=R&31;De(t,u,N[z]),u+=P[z],z>3&&(De(t,u,R>>5&8191),u+=ie[z])}else De(t,u,j[R]),u+=M[R]}return De(t,u,j[256]),u+M[256]},Pe=new U([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Fe=new V(0),Ie=function(e,t,n,r,i,a){var o=a.z||e.length,s=new V(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=Pe[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new H(32768),g=a.h||new H(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new U(25e3),x=new H(288),S=new H(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var ee=y(T),k=T&32767,A=g[ee];if(h[k]=A,g[ee]=k,D<=T){var j=o-T;if((C>7e3||E>24576)&&(j>423||!l)){u=Ne(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var M=0;M<286;++M)x[M]=0;for(var M=0;M<30;++M)S[M]=0}var N=2,P=0,te=p,F=k-A&32767;if(j>2&&ee==y(T-F))for(var ne=Math.min(f,j)-1,I=Math.min(32767,T),L=Math.min(258,j);F<=I&&--te&&k!=A;){if(e[T+N]==e[T+N-F]){for(var R=0;R<L&&e[T+R]==e[T+R-F];++R);if(R>N){if(N=R,P=F,R>ne)break;for(var z=Math.min(F,R-2),B=0,M=0;M<z;++M){var re=T-F+M&32767,G=re-h[re]&32767;G>B&&(B=G,A=re)}}}k=A,A=h[k],F+=k-A&32767}if(P){b[E++]=268435456|se[N]<<18|q[P];var ae=se[N]&31,K=q[P]&31;w+=W[ae]+ie[K],++x[257+ae],++S[K],D=T+N,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=Ne(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var oe=T+65535;oe>=o&&(c[u/8|0]=l,oe=o),u=Me(c,u+1,e.subarray(T,oe))}a.i=o}return Ce(s,0,r+Se(u)+i)},Le=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),Re=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=Le[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},ze=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new V(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return Ie(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},Be=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},Ve=function(e,t){return e[t]|e[t+1]<<8},X=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},He=function(e,t){return X(e,t)+X(e,t+4)*4294967296},Z=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8};function Ue(e,t){return ze(e,t||{},0,0)}function We(e,t){return Te(e,{i:2},t&&t.out,t&&t.dictionary)}var Ge=function(e,t,n,r){for(var i in e){var a=e[i],o=t+i,s=r;Array.isArray(a)&&(s=Be(r,a[1]),a=a[0]),ArrayBuffer.isView(a)?n[o]=[a,s]:(n[o+=`/`]=[new V(0),s],Ge(a,o,n,r))}},Ke=typeof TextEncoder<`u`&&new TextEncoder,qe=typeof TextDecoder<`u`&&new TextDecoder;try{qe.decode(Fe,{stream:!0})}catch{}var Je=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Ce(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function Ye(e,t){if(t){for(var n=new V(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(Ke)return Ke.encode(e);for(var i=e.length,a=new V(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new V(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return Ce(a,0,o)}function Xe(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}if(qe)return qe.decode(e);var i=Je(e),a=i.s,n=i.r;return n.length&&Y(8),a}var Ze=function(e,t){return t+30+Ve(e,t+26)+Ve(e,t+28)},Qe=function(e,t,n){var r=Ve(e,t+28),i=Ve(e,t+30),a=Xe(e.subarray(t+46,t+46+r),!(Ve(e,t+8)&2048)),o=t+46+r,s=$e(e,o,i,n,X(e,t+20),X(e,t+24),X(e,t+42)),c=s[0],l=s[1],u=s[2];return[Ve(e,t+10),c,l,a,o+i+Ve(e,t+32),u]},$e=function(e,t,n,r,i,a,o){var s=i==4294967295,c=a==4294967295,l=o==4294967295,u=t+n,d=s+c+l;if(r&&d){for(;t+4<u;t+=4+Ve(e,t+2))if(Ve(e,t)==1)return[s?He(e,t+4+8*c):i,c?He(e,t+4):a,l?He(e,t+4+8*(c+s)):o,1];r<2&&Y(13)}return[i,a,o,0]},et=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Y(9),t+=r+4}return t},tt=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=et(l);Z(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&Y(10),Z(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(Z(e,t,n.crc),Z(e,t+4,a<0?-a-2:a),Z(e,t+8,n.size)),Z(e,t+12,c),Z(e,t+14,d),t+=16,o!=null&&(Z(e,t,u),Z(e,t+6,n.attrs),Z(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;Z(e,t,+m),Z(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},nt=function(e,t,n,r,i){Z(e,t,101010256),Z(e,t+8,n),Z(e,t+10,n),Z(e,t+12,r),Z(e,t+16,i)};function rt(e,t){t||={};var n={},r=[];Ge(e,``,n,t);var i=0,a=0;for(var o in n){var s=n[o],c=s[0],l=s[1],u=l.level==0?0:8,d=Ye(o),f=d.length,p=l.comment,m=p&&Ye(p),h=m&&m.length,g=et(l.extra);f>65535&&Y(11);var _=u?Ue(c,l):c,v=_.length,y=Re();y.p(c),r.push(Be(l,{size:c.length,crc:y.d(),c:_,f:d,m,u:f!=o.length||m&&p.length!=h,o:i,compression:u})),i+=30+f+g+v,a+=76+2*(f+g)+(h||0)+v}for(var b=new V(a+22),x=i,S=a-i,C=0;C<r.length;++C){var d=r[C];tt(b,d.o,d,d.f,d.u,d.c.length);var w=30+d.f.length+et(d.extra);b.set(d.c,d.o+w),tt(b,i,d,d.f,d.u,d.c.length,d.o,d.m),i+=16+w+(d.m?d.m.length:0)}return nt(b,i,r.length,S,x),b}function it(e,t){for(var n={},r=e.length-22;X(e,r)!=101010256;--r)(!r||e.length-r>65558)&&Y(13);var i=Ve(e,r+8);if(!i)return{};var a=X(e,r+16),o=X(e,r-20)==117853008;if(o){var s=X(e,r-12);o=X(e,s)==101075792,o&&(i=X(e,s+32),a=X(e,s+48))}for(var c=t&&t.filter,l=0;l<i;++l){var u=Qe(e,a,o),d=u[0],f=u[1],p=u[2],m=u[3],h=u[4],g=u[5],_=Ze(e,g);a=h,(!c||c({name:m,size:f,originalSize:p,compression:d}))&&(d?d==8?n[m]=We(e.subarray(_,_+f),{out:new V(p)}):Y(14,`unknown compression type `+d):n[m]=Ce(e,_,_+f))}return n}var Q=e(t(),1),$=n();function at({files:e,readOnly:t=!1,onChange:n,testId:r}){let[i,a]=R(t?`packageFile`:`packageDraftFile`,e[0]?.path??``),[o,s]=R(`editorMode`,t?`read`:`edit`,[`read`,`edit`,`split`]),[c,l]=(0,Q.useState)([e[0]?.path??``]),u=e.some(e=>e.path===i)?i:e[0]?.path;return(0,$.jsxs)(`div`,{className:`min-w-0 overflow-hidden rounded-lg border border-surface-highest`,children:[(0,$.jsx)(`div`,{role:`tablist`,"aria-label":`Package files`,className:`flex overflow-x-auto bg-background`,children:e.map(t=>(0,$.jsx)(`button`,{type:`button`,role:`tab`,"aria-selected":u===t.path,"data-testid":`package-file`,"data-file-name":t.path,title:t.path,className:`shrink-0 border-r border-surface-highest px-4 py-3 text-sm ${u===t.path?`border-t-2 border-t-transparent bg-surface-highest text-on-surface`:`border-t-2 border-t-transparent text-muted-foreground hover:bg-surface-low hover:text-on-surface`}`,onClick:()=>{a(t.path),l(e=>e.includes(t.path)?e:[...e,t.path])},onKeyDown:n=>{let r=e.findIndex(e=>e.path===t.path),i=n.key===`ArrowRight`?r+1:n.key===`ArrowLeft`?r-1:void 0;if(i===void 0)return;n.preventDefault();let a=n.currentTarget.parentElement?.querySelectorAll(`[role="tab"]`)?.[(i+e.length)%e.length];a?.focus(),a?.click()},children:t.path.endsWith(`/SKILL.md`)?t.path.split(`/`).slice(-2).join(`/`):t.path.split(`/`).pop()},t.path))}),e.filter(e=>c.includes(e.path)||u===e.path).map(e=>(0,$.jsxs)(`div`,{role:`tabpanel`,"aria-label":e.path,hidden:u!==e.path,className:`[&_[data-testid=code-editor]>div>span[title]]:hidden [&_[data-testid=markdown-editor]>div>span[title]]:hidden`,children:[(0,$.jsx)(x,{mode:A(e.path)?o:void 0,onModeChange:s,path:e.path,value:e.content,onChange:n?t=>n(e.path,t):void 0,readOnly:t||e.encoding===`base64`,height:420,testId:u===e.path?r:void 0}),e.encoding===`base64`&&(0,$.jsx)(`p`,{className:`px-4 py-2 text-xs text-outline`,children:`Binary asset shown as base64.`})]},e.path))]})}function ot({name:e,onClose:t,onUse:n,onEdit:r,onDelete:a,onExport:o,onSource:s,busy:l,operationError:d}){let f=i({queryKey:[`agent-package`,e],queryFn:()=>u.agentPackages.get(e)}),h=i({enabled:!!f.data,queryKey:[`agent-package-files`,e],queryFn:async()=>{let t=f.data;if(!t)return[];let n=await Promise.all(t.files.map(async t=>{let n=await u.agentPackages.get(e,t.name);return{path:t.name,content:n.content,encoding:n.encoding}}));return[{path:t.manifestFile,content:t.content},...n]}}),g=f.data?[{label:`skills`,count:f.data.files.filter(e=>/(^|\/)SKILL\.md$/.test(e.name)).length},{label:`instruction files`,count:f.data.files.filter(e=>e.name.endsWith(`.instructions.md`)).length},{label:`agent definitions`,count:f.data.files.filter(e=>e.name.endsWith(`.agent.md`)).length}].filter(e=>e.count>0).map(e=>`${e.count} ${e.label}`).join(` · `):``;return(0,$.jsx)(j,{open:!0,onOpenChange:e=>{e||t()},children:(0,$.jsxs)(_,{defaultWidth:960,resizeKey:`packages`,"data-testid":`package-detail-sheet`,children:[(0,$.jsx)(v,{children:(0,$.jsx)(m,{children:e})}),(0,$.jsxs)(p,{children:[(0,$.jsxs)(`div`,{className:`mb-5 space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-outline wrap-break-word`,children:f.data?.description}),f.data&&(0,$.jsxs)(`p`,{className:`text-xs text-outline`,children:[f.data.format===`apm`?`APM package`:`Agent Plugin`,g?` · ${g}`:``,f.data.files.some(e=>e.name===`mcp.json`)?` · MCP tools`:``]}),f.data?.warnings.map(e=>(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive wrap-break-word`,children:e},e)),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 border-b border-outline-variant pb-3`,"data-testid":`package-actions`,children:[n&&(0,$.jsx)(c,{size:`sm`,"data-testid":`package-detail-run`,onClick:n,disabled:l,children:`Use package`}),r&&(0,$.jsx)(c,{size:`sm`,"data-testid":`package-edit`,variant:`ghost`,onClick:r,disabled:l,children:`Edit`}),a&&(0,$.jsx)(c,{size:`sm`,variant:`ghost`,className:`text-destructive`,"data-testid":`package-detail-delete`,onClick:a,disabled:l,children:`Delete package`}),o&&(0,$.jsx)(c,{size:`sm`,"data-testid":`package-export-artifact`,variant:`ghost`,onClick:o,disabled:l,children:l?`Preparing…`:`Installation export`}),s&&(0,$.jsx)(c,{size:`sm`,"data-testid":`package-export`,variant:`ghost`,onClick:s,disabled:l,children:`Source ZIP`})]}),(0,$.jsxs)(`details`,{className:`text-xs text-outline`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:`About exports`}),(0,$.jsxs)(`p`,{className:`mt-2`,children:[`APM builds installation exports (`,f.data?.format===`agent-plugin`?`portable Agent Plugin`:`Claude plugin`,`). Download source preserves the editable manifest and all files.`]})]}),d&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:d})]}),f.error||h.error?(0,$.jsx)(`p`,{role:`alert`,children:(f.error??h.error)?.message}):h.isLoading?(0,$.jsx)(`p`,{children:`Loading files…`}):(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`h4`,{className:`text-sm font-medium`,children:`Package files`}),(0,$.jsx)(at,{files:h.data??[],readOnly:!0,testId:`package-file-content`})]})]})]})})}var st=`https://agent-plugins.org/schemas/1.0.0/plugin.schema.json`;function ct(e){return e===`apm`?`name: my-agent-package
2
+ version: '1.0.0'
3
+ description: Describe when to use this configuration
4
+ dependencies: {}
5
+ `:JSON.stringify({$schema:st,name:`my-agent-package`,version:`1.0.0`,description:`Describe when to use this configuration`},null,2)}function lt(e,t){let n=t===`apm`?te(e):null;if(n?.errors.length)throw Error(n.errors[0]?.message);let r=n?n.toJS():JSON.parse(e);if(!r||typeof r!=`object`||Array.isArray(r))throw Error(`Manifest must be an object`);return r}function ut(e,t,n,r){if(t===`agent-plugin`)return JSON.stringify({...lt(e,t),[n]:r},null,2);let i=te(e);if(i.errors.length)throw Error(`Fix the manifest before switching to fields`);return i.set(n,r),i.toString()}function dt(e,t,n){return e.some(e=>e.path===t)?e.map(e=>e.path===t?{...e,content:n,encoding:`utf8`}:e):[...e,{path:t,content:n,encoding:`utf8`}]}function ft(e,t){return`${e?.match(/^---\r?\n[\s\S]*?\r?\n---(?:\r?\n)?/)?.[0]??`---
6
+ description: Shared package instructions
7
+ ---
8
+ `}${t}`}function pt(e,t){let n=te(t);if(n.errors.length)throw Error(`Fix the MCP YAML before saving`);let r=n.toJS();if(!Array.isArray(r))throw Error(`MCP declarations must be a YAML list (use [] for none)`);let i=te(e);if(i.errors.length)throw Error(`Fix apm.yml before editing MCP declarations`);i.setIn([`dependencies`,`mcp`],r);let a=i.get(`dependencies`,!0);P(a)&&(a.flow=!1);let o=i.getIn([`dependencies`,`mcp`],!0);if(N(o)){o.flow=!1;for(let e of o.items)P(e)&&(e.flow=!1)}return i.toString()}function mt(e,t){let n=lt(e,t);if(typeof n.name!=`string`||!/^[a-z0-9]+(?:[.-][a-z0-9]+)*$/.test(n.name)||n.name.length>64)throw Error(`Use a lowercase package name with single hyphens or periods (up to 64 characters)`);if(t===`apm`&&(!n.version||typeof n.version!=`string`))throw Error(`APM packages require a version`);if(t===`agent-plugin`&&n.$schema!==`https://agent-plugins.org/schemas/1.0.0/plugin.schema.json`)throw Error(`Use the Agent Plugins v1 schema`);return n}var ht=new Map;typeof window<`u`&&window.addEventListener(`beforeunload`,e=>{ht.size&&(e.preventDefault(),e.returnValue=``)});function gt(e){ht.delete(e)}function _t(e){return ht.get(e)?.baseline}function vt(e){return ht.has(e)?window.confirm(`Discard unsaved package changes?`)?(gt(e),!0):!1:!0}var yt=`.apm/instructions/general.instructions.md`;function bt({initial:e,pending:t,error:n,onSave:r}){let[a,o]=R(`packageFormat`,``,[``,`apm`,`agent-plugin`]),s=(0,Q.useRef)(ht.get(e?.name??`new`)),l=e?.format??(a||void 0),d=l,[f,p]=(0,Q.useState)(s.current?.source??e?.content??ct(l??`apm`)),[m,g]=(0,Q.useState)(s.current?.files??e?.files??[]),[_,v]=(0,Q.useState)(s.current?.selectedSkills??[]),[y,b]=(0,Q.useState)(``),[w,E]=R(`packageTab`,e?`files`:`configuration`,[`files`,`configuration`,`skills`]),[D,A]=R(`packageSource`,`fields`,[`fields`,`source`]),j=D===`source`,M=e=>A(e?`source`:`fields`),[N,P]=(0,Q.useState)(),[te,ne]=(0,Q.useState)(!1),[I,L]=(0,Q.useState)(``),[B,re]=(0,Q.useState)(s.current?.mcpDraft),[V,H]=(0,Q.useState)(),U=i({queryKey:[`package-skill-picker`],queryFn:async()=>{let e=await u.skills.list({limit:500}),t=[...e.skills],n=e.next_offset;for(;n!==null;){let e=await u.skills.list({limit:500,offset:n});t.push(...e.skills),n=e.next_offset}return{...e,skills:t}}}),W=i({queryKey:[`agents`],queryFn:u.agents.list}),ie=(0,Q.useMemo)(()=>{try{return{fields:lt(f,d??`apm`),error:void 0}}catch(e){return{fields:void 0,error:e.message}}},[f,d]),G=ie.fields,ae=typeof G?.name==`string`?G.name:``,K=t||te,oe=m.find(e=>e.path===yt),se=oe?.content.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,``)??``,ce=m.find(e=>e.path===`mcp.json`);(0,Q.useEffect)(()=>{f!==(e?.content??ct(d??`apm`))||JSON.stringify(m)!==JSON.stringify(e?.files??[])||_.length>0||B!==void 0?ht.set(e?.name??`new`,{format:d??ht.get(e?.name??`new`)?.format??s.current?.format,source:f,files:m,selectedSkills:_,mcpDraft:B,baseline:s.current?.baseline??e}):ht.delete(e?.name??`new`)},[f,m,_,B,d,e]);function le(e,t){try{p(ut(f,d??`apm`,e,t)),P(void 0)}catch(e){P(e.message)}}function q(t){let n=ht.get(e?.name??`new`);n&&n.format===t?(o(t),p(n.source),g(n.files),v(n.selectedSkills),re(n.mcpDraft)):(!n||vt(e?.name??`new`))&&(o(t),p(ct(t)),g([]),v([]),re(void 0))}return(0,$.jsxs)(O,{className:`min-w-0 grid-cols-[minmax(0,1fr)] w-[calc(100%-1rem)] max-w-4xl max-h-[94dvh] overflow-x-hidden overflow-y-auto p-4 sm:p-6`,children:[(0,$.jsxs)(ee,{children:[(0,$.jsx)(h,{className:`wrap-break-word pr-8`,children:e?`Edit ${e.name}`:`New package`}),(0,$.jsx)(k,{children:`Save a configuration once, then use it in any project.`})]}),d?(0,$.jsxs)(`form`,{className:`min-w-0 space-y-4`,onSubmit:e=>{if(e.preventDefault(),!V){P(void 0);try{let e=mt(f,d);d===`agent-plugin`&&ce&&JSON.parse(ce.content),r({name:e.name,content:f,files:m,format:d,skills:_})}catch(e){P(e.message)}}},children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,$.jsx)(`span`,{className:`rounded bg-surface-high px-3 py-1`,children:d===`apm`?`APM`:`Plugin`}),!e&&(0,$.jsx)(c,{type:`button`,variant:`ghost`,disabled:K,onClick:()=>{vt(`new`)&&(o(``),p(ct(`apm`)),g([]),v([]),re(void 0))},children:`Change type`})]}),(0,$.jsx)(`div`,{role:`tablist`,"aria-label":`Package editor`,className:`flex flex-wrap gap-1 border-b border-surface-highest pb-2`,children:[`configuration`,`skills`,`files`].map(e=>(0,$.jsxs)(c,{type:`button`,role:`tab`,"aria-selected":w===e,variant:w===e?`default`:`ghost`,"data-testid":`package-editor-${e}`,onClick:()=>E(e),children:[e[0]?.toUpperCase(),e.slice(1),e===`skills`&&_.length?` (${_.length})`:``]},e))}),(0,$.jsxs)(`fieldset`,{disabled:K,className:`min-w-0 space-y-4`,children:[w===`configuration`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-sm text-outline`,children:d===`apm`?`APM configuration`:`Portable plugin identity`}),(0,$.jsx)(c,{type:`button`,variant:`outline`,"data-testid":`package-editor-mode`,disabled:!!V||j&&!!ie.error,onClick:()=>{M(!j),re(void 0)},children:j?`Edit fields`:d===`apm`?`Edit YAML`:`Edit JSON`})]}),j?(0,$.jsx)(x,{id:`package-yaml`,testId:`package-yaml-input`,path:d===`apm`?`apm.yml`:`plugin.json`,value:f,onChange:p,readOnly:K,height:320}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[[`name`,`Package name`],[`version`,`Version`],[`description`,`When would you use this?`]].map(([t,n])=>(0,$.jsxs)(`div`,{className:t===`description`?`space-y-1 sm:col-span-2`:`space-y-1`,children:[(0,$.jsx)(C,{htmlFor:`package-${t}`,children:n}),(0,$.jsx)(T,{id:`package-${t}`,"data-testid":`package-${t}-input`,disabled:t===`name`&&!!e,value:typeof G?.[t]==`string`?G[t]:``,onChange:e=>le(t,e.target.value)})]},t))}),d===`apm`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(C,{htmlFor:`package-apm-mcp`,children:`MCP servers (YAML declarations)`}),(0,$.jsx)(x,{id:`package-apm-mcp`,path:`mcp-dependencies.yml`,testId:`package-apm-mcp`,height:180,readOnly:K,value:B??F(G?.dependencies?.mcp??[]),onChange:e=>{re(e);try{p(pt(f,e)),H(void 0)}catch(e){H(e.message)}}}),(0,$.jsxs)(`p`,{className:`text-xs text-outline`,children:[`Use registry names, or named APM mappings with transport and command/URL. Credentials use environment references such as`,` `,(0,$.jsxs)(`code`,{children:[`$`,`{API_TOKEN}`]}),`.`]}),V&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:V})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(C,{htmlFor:`package-instructions`,children:`Shared instructions`}),(0,$.jsx)(S,{id:`package-instructions`,"data-testid":`package-instructions`,rows:7,placeholder:`What should the agent know and how should it work?`,value:se,onChange:e=>g(dt(m,yt,ft(oe?.content,e.target.value)))}),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Saved as an APM instruction primitive. Agent-specific model and tool configuration belongs in an agent definition.`})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(C,{htmlFor:`package-agent-picker`,children:`Add an existing agent definition`}),(0,$.jsxs)(`select`,{id:`package-agent-picker`,"data-testid":`package-agent-picker`,className:`w-full rounded border border-control-border bg-background p-3`,value:``,onChange:async e=>{let t=e.target.value;if(t){ne(!0);try{let e=await u.agents.get(t),n=t.split(`/`).slice(-1)[0]?.replace(/[^a-zA-Z0-9-]/g,`-`)??`agent`;g(t=>dt(t,`.apm/agents/${n}.agent.md`,e.raw))}catch(e){P(e.message)}finally{ne(!1)}}},children:[(0,$.jsx)(`option`,{value:``,children:`Select an agent to copy into this package…`}),W.data?.agents.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Configure targets, MCP dependencies and launch scripts in Edit YAML. Supporting agent files are editable in Files.`})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Agent Plugins v1 contains skills and MCP. Choose APM if you need shared instructions or agent profiles.`}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(C,{children:`mcp.json (optional)`}),(0,$.jsx)(x,{path:`mcp.json`,testId:`package-mcp-input`,height:220,value:ce?.content??JSON.stringify({$schema:`https://agent-plugins.org/schemas/1.0.0/mcp.schema.json`,mcpServers:{}},null,2),readOnly:K,onChange:e=>g(dt(m,`mcp.json`,e))}),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Credentials are managed by the coding agent. Keep secrets out of package files.`})]})]})]})]}),w===`skills`&&(0,$.jsxs)($.Fragment,{children:[m.filter(e=>/^(skills|\.apm\/skills)\/[^/]+\/SKILL\.md$/.test(e.path)).map(e=>{let t=e.path.slice(0,-8);return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-b border-outline-variant p-3`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 wrap-break-word text-sm`,children:[`Included: `,t.split(`/`).slice(-2)[0]]}),(0,$.jsx)(c,{type:`button`,variant:`outline`,"data-testid":`package-skill-remove`,onClick:()=>g(e=>e.filter(e=>!e.path.startsWith(t))),children:`Remove from package`})]},e.path)}),(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Choose skills from your library. Their SKILL.md, scripts, references and assets are copied into this package; the originals stay available independently.`}),(0,$.jsx)(T,{"aria-label":`Search existing skills`,"data-testid":`package-skill-search`,placeholder:`Search your skills…`,value:y,onChange:e=>b(e.target.value)}),U.error&&(0,$.jsx)(`p`,{role:`alert`,children:U.error.message}),U.isLoading&&(0,$.jsx)(`p`,{children:`Loading skills…`}),(0,$.jsx)(`div`,{className:`max-h-[40dvh] overflow-auto space-y-2`,children:U.data?.skills.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(y.toLowerCase())).map(e=>{let t=e.name.split(`/`).slice(-1)[0],n=m.some(e=>e.path===`${d===`apm`?`.apm/skills`:`skills`}/${t}/SKILL.md`);return(0,$.jsxs)(`label`,{className:`flex items-start gap-3 border-b border-outline-variant p-3`,"data-testid":`package-skill-option`,"data-skill-name":e.name,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`mt-1 size-5 shrink-0`,"data-testid":`package-skill-select`,checked:n||_.includes(e.name),disabled:n||K||!_.includes(e.name)&&_.length>=32,onChange:t=>v(t.target.checked?[..._,e.name]:_.filter(t=>t!==e.name))}),(0,$.jsxs)(`span`,{className:`min-w-0 wrap-break-word`,children:[(0,$.jsxs)(`span`,{className:`block text-sm font-medium`,children:[e.name,n?` · included`:``]}),(0,$.jsx)(`span`,{className:`block text-xs text-outline line-clamp-2`,children:e.description})]})]},e.name)})}),!U.isLoading&&U.data?.skills.length===0&&(0,$.jsx)(`p`,{children:`No skills yet. Import skills into your library first, or add skill files directly in Files.`})]}),w===`files`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`details`,{className:`border-t border-outline-variant p-3`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-sm`,children:`Add a file or folder`}),(0,$.jsx)(C,{htmlFor:`package-files`,children:`Add files from a folder`}),(0,$.jsx)(T,{id:`package-files`,"data-testid":`package-files-input`,type:`file`,multiple:!0,webkitdirectory:``,onChange:async e=>{let t=e.target.files;if(t?.length){ne(!0);try{let e=(await z(t)).filter(e=>![`apm.yml`,`plugin.json`].includes(e.path));g(t=>[...t.filter(t=>!e.some(e=>e.path===t.path)),...e]),P(void 0)}catch(e){P(e.message)}finally{ne(!1)}}}}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(T,{"aria-label":`New file path`,"data-testid":`package-new-file-path`,placeholder:d===`apm`?`.apm/agents/reviewer.agent.md`:`skills/my-skill/SKILL.md`,value:I,onChange:e=>L(e.target.value)}),(0,$.jsx)(c,{type:`button`,variant:`outline`,disabled:!I||m.some(e=>e.path===I),onClick:()=>{g(e=>[...e,{path:I,content:``,encoding:`utf8`}]),L(``)},children:`Add file`})]})]}),(0,$.jsx)(at,{files:[{path:d===`apm`?`apm.yml`:`plugin.json`,content:f},...m],readOnly:K,testId:`package-file-input`,onChange:(e,t)=>{e===(d===`apm`?`apm.yml`:`plugin.json`)?p(t):g(n=>dt(n,e,t))}})]})]}),(n||N||ie.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-editor-error`,className:`text-sm text-destructive`,children:n||N||ie.error}),(0,$.jsxs)(`div`,{className:`sticky bottom-0 border-t border-surface-highest bg-surface pt-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`text-xs text-outline`,children:[m.length,` files · `,_.length,` skills selected`]}),(0,$.jsx)(c,{type:`submit`,"data-testid":`package-submit`,disabled:K||!ae.trim()||!!(ie.error||V),children:t?`Saving…`:e?`Save changes`:`Save to catalog`})]})]}):(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,"data-testid":`package-type-choice`,children:[(0,$.jsxs)(`button`,{type:`button`,"data-testid":`package-type-apm`,onClick:()=>q(`apm`),className:`rounded-lg border border-outline-variant p-5 text-left hover:bg-surface-low`,children:[(0,$.jsx)(`strong`,{className:`block mb-2`,children:`APM package`}),(0,$.jsx)(`span`,{className:`text-sm text-outline`,children:`Instructions, agents, skills, MCP and dependencies. Configure with apm.yml.`})]}),(0,$.jsxs)(`button`,{type:`button`,"data-testid":`package-type-agent-plugin`,onClick:()=>q(`agent-plugin`),className:`rounded-lg border border-outline-variant p-5 text-left hover:bg-surface-low`,children:[(0,$.jsx)(`strong`,{className:`block mb-2`,children:`Agent Plugin`}),(0,$.jsx)(`span`,{className:`text-sm text-outline`,children:`Portable skills and MCP. Configure with plugin.json and mcp.json.`})]})]})]})}function xt(e){if(e.length>16777216)throw Error(`Archive exceeds 16 MiB`);let t=0,n=0,r=it(e,{filter:e=>{if(e.name.endsWith(`/`))return!1;if(t+=e.originalSize,n++,e.originalSize>8388608||t>16777216||n>513)throw Error(`Archive exceeds package file or size limits`);return!0}}),i=Object.keys(r),a=i.filter(e=>/(^|\/)(apm\.yml|plugin\.json)$/.test(e)).sort((e,t)=>e.split(`/`).length-t.split(`/`).length)[0];if(!a)throw Error(`Choose a source ZIP containing apm.yml or portable plugin.json`);let o=a.includes(`/`)?a.slice(0,a.lastIndexOf(`/`)+1):``;if(i.some(e=>!e.startsWith(o)))throw Error(`Choose an archive containing one package folder`);return Object.entries(r).map(([e,t])=>{let n=``;for(let e of t)n+=String.fromCharCode(e);try{let n=new TextDecoder(`utf8`,{fatal:!0,ignoreBOM:!0}).decode(t);if(!n.includes(`\0`))return{path:e.slice(o.length),content:n,encoding:`utf8`}}catch{}return{path:e.slice(o.length),content:btoa(n),encoding:`base64`}})}function St({onClose:e,onImported:t}){let[n,r]=R(`importMethod`,`git`,[`git`,`zip`,`folder`]),[i,o]=(0,Q.useState)(``),[s,l]=(0,Q.useState)(``),[d,f]=(0,Q.useState)(`auto`),[p,m]=(0,Q.useState)(),[g,_]=(0,Q.useState)(!1),v=a({mutationFn:u.agentPackages.discover}),y=a({mutationFn:u.agentPackages.importGit,onSuccess:e=>t(e.name)}),x=a({mutationFn:u.agentPackages.acquire}),S=a({mutationFn:u.agentPackages.importAcquired,onSuccess:e=>t(e.name)}),w=v.isPending||y.isPending||x.isPending||S.isPending||g,E=v.data?.packages??x.data?.packages,D=E?.find(e=>`${e.format}:${e.path}`===s);async function A(){l(``),v.reset(),x.reset(),y.reset(),S.reset();let e=i.trim();if(!e.includes(`://`)||/^https:\/\/github\.com\//i.test(e))try{await v.mutateAsync(e);return}catch{v.reset()}x.mutate(e)}async function j(e){let n=e.find(e=>e.path===`apm.yml`),r=e.find(e=>e.path===`plugin.json`);if(d===`auto`&&n&&r)throw Error(`Both manifests are present. Select a format before importing.`);let i=d===`auto`?n?`apm`:`agent-plugin`:d,a=i===`apm`?n:r;if(!a||a.encoding===`base64`)throw Error(`The selected format's manifest is missing`);let o=lt(a.content,i);if(typeof o.name!=`string`)throw Error(`Manifest is missing a package name`);t((await u.agentPackages.create({name:o.name,content:a.content,format:i,imported:!0,files:e.filter(e=>e!==a&&(i!==`agent-plugin`||e.path!==`apm.yml`))})).name)}return(0,$.jsx)(b,{open:!0,onOpenChange:t=>!t&&!w&&e(),children:(0,$.jsxs)(O,{className:`min-w-0 grid-cols-[minmax(0,1fr)] w-[calc(100%-1rem)] max-w-xl max-h-[94dvh] overflow-x-hidden overflow-y-auto p-4 sm:p-6`,children:[(0,$.jsxs)(ee,{children:[(0,$.jsx)(h,{children:`Import a package`}),(0,$.jsx)(k,{children:`Add reusable configuration to your catalog, then choose where to install it.`})]}),(0,$.jsx)(`div`,{role:`tablist`,"aria-label":`Import source`,className:`flex flex-wrap gap-2`,children:[[`git`,`Git repository`],[`zip`,`ZIP file`],[`folder`,`Folder`]].map(([e,t])=>(0,$.jsx)(c,{role:`tab`,"aria-selected":n===e,"data-testid":`package-import-${e}`,variant:n===e?`default`:`outline`,disabled:w,onClick:()=>{r(e),m(void 0)},children:t},e))}),n===`git`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),A()},children:[(0,$.jsx)(C,{htmlFor:`package-git-source`,children:`Repository URL`}),(0,$.jsx)(T,{id:`package-git-source`,"data-testid":`package-git-source`,placeholder:`https://github.com/owner/repository`,value:i,disabled:w,onChange:e=>{o(e.target.value),v.reset(),x.reset(),y.reset(),S.reset(),l(``)}}),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Paste a GitHub, GitLab, Bitbucket or Azure DevOps repository or package link.`}),(0,$.jsx)(c,{type:`submit`,"data-testid":`package-git-discover`,disabled:w||!i.trim(),children:v.isPending||x.isPending?`Finding packages…`:`Find packages`})]}),E&&(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`div`,{className:`max-h-[40dvh] space-y-2 overflow-auto`,children:E.map(e=>(0,$.jsxs)(`label`,{className:`flex items-start gap-3 rounded border border-surface-highest p-3`,"data-testid":`remote-package`,children:[(0,$.jsx)(`input`,{className:`mt-1 size-5`,type:`radio`,name:`package-import-selection`,disabled:w||e.installed,checked:s===`${e.format}:${e.path}`,onChange:()=>l(`${e.format}:${e.path}`)}),(0,$.jsxs)(`span`,{className:`min-w-0 wrap-break-word`,children:[(0,$.jsxs)(`strong`,{className:`block text-sm`,children:[e.name,e.installed?` · already in catalog`:``]}),(0,$.jsx)(`span`,{className:`block text-xs text-outline`,children:e.description}),(0,$.jsxs)(`span`,{className:`block text-xs text-outline`,children:[e.format===`apm`?`APM`:`Plugin`,` ·`,` `,e.path||`Repository root`]})]})]},`${e.format}:${e.path}`))}),!E.length&&(0,$.jsx)(`p`,{children:`No APM or Plugin packages found in this repository.`}),v.data?.issues.map(e=>(0,$.jsxs)(`p`,{role:`alert`,className:`text-xs text-destructive wrap-break-word`,children:[e.path,`: `,e.error]},e.path))]}),E&&(0,$.jsx)(c,{"data-testid":`package-git-import`,disabled:w||!D,onClick:()=>{D&&(v.data?y.mutate({source:v.data.source,commit:v.data.commit,path:D.path,format:D.format}):x.data&&S.mutate({token:x.data.token,path:D.path}))},children:y.isPending||S.isPending?`Importing…`:`Import to catalog`})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(C,{htmlFor:`package-import-format`,children:`Package format`}),(0,$.jsxs)(`select`,{id:`package-import-format`,"data-testid":`package-import-format`,disabled:w,className:`w-full rounded border border-control-border bg-surface-low p-3`,value:d,onChange:e=>f(e.target.value),children:[(0,$.jsx)(`option`,{value:`auto`,children:`Detect from manifest`}),(0,$.jsx)(`option`,{value:`apm`,children:`APM`}),(0,$.jsx)(`option`,{value:`agent-plugin`,children:`Agent Plugin`})]}),(0,$.jsx)(C,{htmlFor:`agent-package-folder`,children:n===`folder`?`Package folder`:`Package source ZIP`}),(0,$.jsx)(T,{id:`agent-package-folder`,"data-testid":n===`folder`?`agent-package-folder`:`package-zip-input`,type:`file`,accept:n===`zip`?`.zip`:void 0,multiple:n===`folder`,...n===`folder`?{webkitdirectory:``}:{},disabled:w,onChange:async e=>{let t=e.target.files;if(t?.length){_(!0),m(void 0);try{await j(n===`folder`?await z(t):xt(new Uint8Array(await t[0].arrayBuffer())))}catch(e){m(e.message)}finally{_(!1)}}}},n),(0,$.jsx)(`p`,{className:`text-xs text-outline`,children:`Original manifests and supporting files are preserved. Import does not launch an agent or run package scripts. Use ZIP on phones where folder selection is unavailable.`})]}),(v.error||y.error||x.error||S.error||p)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-import-error`,className:`text-sm text-destructive`,children:v.error?.message??y.error?.message??x.error?.message??S.error?.message??p})]})})}function Ct(e,t){M(new Blob([new Uint8Array(t)],{type:`application/zip`}),e)}function wt(){let e=r(),[t,n]=s(),l=o(),[p,m]=R(`packageAction`,``,[``,`new`,`import`,`edit`]),_=i({queryKey:[`agent-packages`],queryFn:u.agentPackages.list}),v=i({queryKey:[`package-tools`],queryFn:()=>u.packageTools.list()}),{selectedId:x,closeDetail:S}=L(`/packages/item`,`packageName`),C=p===`new`,A=e=>m(e?`new`:``),[j,M]=(0,Q.useState)(),N=p===`import`,P=e=>m(e?`import`:``);function te(e){let t=new URLSearchParams(window.location.search);t.delete(`packageAction`),l(`/packages/item/${encodeURIComponent(e)}?${t}`)}function F(e){let t=new URLSearchParams(window.location.search);t.set(`packageAction`,`edit`),l(`/packages/item/${encodeURIComponent(e)}?${t}`)}let[z,B]=(0,Q.useState)(),[V,H]=(0,Q.useState)(),[U,W]=(0,Q.useState)(!1),[ie,G]=(0,Q.useState)(),ae=t.get(`q`)??``,K=t.get(`format`)??`all`;async function oe(){await Promise.all([`agent-packages`,`agents`,`skills`,`package-skill-picker`,`agent-package`,`agent-package-files`].map(t=>e.invalidateQueries({queryKey:[t]})))}let se=a({mutationFn:e=>j?u.agentPackages.update(j.name,{content:e.content,files:e.files,skills:e.skills,expectedRevision:j.revision}):u.agentPackages.create(e),onSuccess:async e=>{await oe(),gt(j?.name??`new`),A(!1),M(void 0),G(`${e.name} saved to your catalog.`),te(e.name)}}),[ce,le]=(0,Q.useState)(),q=a({mutationFn:e=>u.agentPackages.delete(e.name,e.revision),onSuccess:async(e,t)=>{le(void 0),x===t.name&&S(),gt(t.name),G(`${t.name} deleted from your catalog.`),await oe()}});async function ue(e){W(!0),H(void 0),q.reset();try{let t=await u.agentPackages.get(e);if(!t.revision)throw Error(`Package revision is missing; update the API before deleting`);le({name:t.name,revision:t.revision})}catch(e){H(e instanceof Error?e.message:`Could not open package deletion.`)}finally{W(!1)}}let J=se.reset;(0,Q.useEffect)(()=>{let e=!0;if(M(void 0),p!==`edit`||!x)W(!1);else return W(!0),H(void 0),J(),(async()=>{try{let t=await u.agentPackages.get(x),n=await Promise.all(t.files.map(async e=>{let t=await u.agentPackages.get(x,e.name);return{path:e.name,content:t.content,encoding:t.encoding}}));if(!t.revision)throw Error(`Package revision is missing; update the API before editing`);let r=_t(x);e&&M(r?{...t,content:r.content,format:r.format,revision:r.revision??t.revision,draftFiles:r.files}:{...t,draftFiles:n})}catch(t){e&&H(t.message)}finally{e&&W(!1)}})(),()=>{e=!1}},[p,x,J]);function de(e){let t=_.data?.packages.find(t=>t.name===e);S(),B({name:`${e.replace(/\./g,`-`)}-setup`,packages:[e],backend:t?.format===`agent-plugin`?`copilot`:`claude`,tool:`apm`,cwd:``,prompt:``})}async function fe(e){W(!0),H(void 0);try{let t=await u.agentPackages.get(e),n={[`${e}/${t.manifestFile}`]:Ye(t.content)};for(let r of t.files){let t=await u.agentPackages.get(e,r.name);n[`${e}/${r.name}`]=t.encoding===`base64`?Uint8Array.from(atob(t.content),e=>e.charCodeAt(0)):Ye(t.content)}Ct(`${e}-source.zip`,rt(n))}catch(e){H(e.message)}finally{W(!1)}}async function pe(e){W(!0),H(void 0),G(`APM is building the installation archive…`);try{let t=await u.agentPackages.exportArtifact(e);Ct(t.filename,Uint8Array.from(atob(t.content),e=>e.charCodeAt(0))),G(`Exported ${t.format} installation archive.`)}catch(e){H(e.message),G(void 0)}finally{W(!1)}}let me=_.data?.packages.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(ae.toLowerCase())&&(K===`all`||e.format===K))??[];return(0,$.jsxs)(`div`,{className:`min-w-0 space-y-4`,children:[(0,$.jsx)(I,{title:`Packages`,meta:`${_.data?.packages.length??0} in your catalog`,help:`Packages combine instructions, skills and tools for reuse. Use a package in chat or a terminal on the host and folder you choose.`,action:(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(c,{variant:`ghost`,"data-testid":`package-import-button`,onClick:()=>P(!0),children:[(0,$.jsx)(f,{size:16,className:`mr-2`}),`Import`]}),(0,$.jsxs)(c,{"data-testid":`new-agent-package-button`,onClick:()=>{se.reset(),A(!0)},children:[(0,$.jsx)(re,{size:16,className:`mr-2`}),`New package`]})]})}),ie&&(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-primary wrap-break-word`,children:ie}),(V||_.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-error`,className:`text-sm text-destructive`,children:(0,$.jsx)(`span`,{"data-testid":`page-error`,children:V??_.error?.message})}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1 lg:max-w-md`,children:[(0,$.jsx)(y,{size:14,className:`absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(T,{className:`pl-9`,"data-testid":`package-search`,"aria-label":`Search packages`,placeholder:`Find a configuration by name or purpose…`,value:ae,onChange:e=>{let r=new URLSearchParams(t);e.target.value?r.set(`q`,e.target.value):r.delete(`q`),n(r,{replace:!0})}})]}),(0,$.jsx)(d,{activeCount:Number(K!==`all`),children:(0,$.jsxs)(`select`,{"aria-label":`Filter package type`,"data-testid":`package-format-filter`,className:`form-control form-control-single w-full lg:w-auto`,value:K,onChange:e=>{let r=new URLSearchParams(t);r.set(`format`,e.target.value),n(r,{replace:!0})},children:[(0,$.jsx)(`option`,{value:`all`,children:`All formats`}),(0,$.jsx)(`option`,{value:`apm`,children:`APM packages`}),(0,$.jsx)(`option`,{value:`agent-plugin`,children:`Agent Plugins`})]})})]}),_.isLoading&&(0,$.jsx)(`p`,{role:`status`,"data-testid":`page-loading`,children:`Loading your catalog…`}),(0,$.jsx)(`div`,{className:`divide-y divide-outline-variant`,children:me.map(e=>(0,$.jsxs)(`article`,{"data-testid":`agent-package-row`,"data-package-name":e.name,className:`flex min-w-0 flex-wrap items-start justify-between gap-x-6 gap-y-2 px-2 py-3 sm:flex-nowrap`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`button`,{type:`button`,"data-testid":`package-inspect`,onClick:()=>te(e.name),className:`min-h-8 text-left text-sm font-medium wrap-break-word hover:text-primary`,children:e.name}),(0,$.jsxs)(`span`,{className:`ml-3 text-xs text-muted-foreground`,children:[e.format===`apm`?`APM package`:`Agent Plugins`,e.version?` · v${e.version}`:``]}),e.description&&(0,$.jsx)(`p`,{className:`line-clamp-2 text-sm text-muted-foreground wrap-break-word`,children:e.description}),e.warnings.map(e=>(0,$.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground wrap-break-word`,children:e},e))]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,$.jsx)(c,{size:`sm`,variant:`ghost`,"data-testid":`package-run`,disabled:U,onClick:()=>de(e.name),children:`Use package`}),(0,$.jsxs)(D,{children:[(0,$.jsx)(w,{asChild:!0,children:(0,$.jsx)(c,{variant:`ghost`,size:`icon`,"data-testid":`package-actions-menu`,"aria-label":`Actions for ${e.name}`,children:(0,$.jsx)(g,{size:16})})}),(0,$.jsxs)(E,{"aria-label":`Package actions`,align:`end`,className:`w-44 space-y-1 p-1`,children:[(0,$.jsx)(c,{size:`sm`,variant:`ghost`,className:`w-full justify-start`,"data-testid":`package-card-edit`,onClick:()=>void F(e.name),children:`Edit package`}),(0,$.jsx)(c,{size:`sm`,variant:`ghost`,className:`w-full justify-start text-destructive`,"data-testid":`package-card-delete`,disabled:U||q.isPending,onClick:()=>void ue(e.name),children:`Delete package`})]})]})]})]},e.name))}),!_.isLoading&&!_.error&&!me.length&&(0,$.jsx)(`div`,{"data-testid":`page-empty`,className:`px-4 py-16 text-center`,children:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:ae||K!==`all`?`No matching packages`:`No packages configured`})}),_.data?.broken.map(e=>(0,$.jsxs)(`p`,{role:`alert`,className:`text-destructive wrap-break-word`,children:[e.path,`: `,e.error]},e.path)),v.data&&!v.data.apm&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Catalog editing is available. Installation, Git acquisition and installation exports require APM on this ORC machine.`}),x&&!p&&(0,$.jsx)(ot,{name:x,onClose:S,onUse:()=>de(x),onEdit:()=>void F(x),onDelete:()=>void ue(x),onExport:()=>void pe(x),onSource:()=>void fe(x),busy:U,operationError:V},x),(0,$.jsx)(b,{open:C||p===`edit`,onOpenChange:e=>{if(!e&&!se.isPending){if(!vt(j?.name??`new`))return;A(!1),M(void 0)}},children:C||p===`edit`&&j?(0,$.jsx)(bt,{initial:j?{name:j.name,content:j.content,format:j.format,files:j.draftFiles,revision:j.revision}:void 0,pending:se.isPending,error:se.error?.message,onSave:e=>se.mutate(e)}):p===`edit`?(0,$.jsxs)(O,{children:[(0,$.jsx)(ee,{children:(0,$.jsx)(h,{children:`Package editor`})}),(0,$.jsx)(`p`,{role:V?`alert`:`status`,children:V??`Opening package editor…`})]}):null}),(0,$.jsx)(b,{open:!!ce,onOpenChange:e=>{!e&&!q.isPending&&le(void 0)},children:(0,$.jsxs)(O,{"data-testid":`package-delete-dialog`,children:[(0,$.jsxs)(ee,{children:[(0,$.jsx)(h,{children:`Delete package?`}),(0,$.jsxs)(k,{children:[`Delete `,ce?.name,` from your catalog? Copies already installed in project folders will remain.`]})]}),q.error&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`package-delete-error`,className:`text-sm text-destructive`,children:q.error.message}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(c,{variant:`outline`,"data-testid":`package-delete-cancel`,disabled:q.isPending,onClick:()=>le(void 0),children:`Cancel`}),(0,$.jsx)(c,{variant:`destructive`,"data-testid":`package-delete-confirm`,disabled:q.isPending||!ce,onClick:()=>{ce&&q.mutate(ce)},children:q.isPending?`Deleting…`:`Delete package`})]})]})}),N&&(0,$.jsx)(St,{onClose:()=>P(!1),onImported:e=>{oe(),P(!1),G(`${e} added to your catalog.`),te(e)}}),z&&(0,$.jsx)(ne,{initial:z,onClose:()=>B(void 0)},z.name)]})}export{wt as default};
@@ -1,5 +1,5 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r,t as i}from"./useMutation-CRAWY7v2.js";import{f as a,u as o}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as s}from"./button-BlVCkBiz.js";import{n as c}from"./client-RPZmgRqE.js";import{t as l}from"./download-Cnjcb403.js";import{$ as u,Cn as d,Gt as f,Jn as p,Jr as m,Nt as h,Q as g,Qn as _,Ur as v,Vr as y,Wr as b,Yr as x,an as S,cn as ee,ct as te,et as ne,in as re,on as ie,rn as ae,sn as oe,tt as se,yn as ce}from"./index-DsVJrhHJ.js";var le=Symbol.for(`yaml.alias`),ue=Symbol.for(`yaml.document`),C=Symbol.for(`yaml.map`),w=Symbol.for(`yaml.pair`),T=Symbol.for(`yaml.scalar`),de=Symbol.for(`yaml.seq`),E=Symbol.for(`yaml.node.type`),fe=e=>!!e&&typeof e==`object`&&e[E]===le,pe=e=>!!e&&typeof e==`object`&&e[E]===ue,D=e=>!!e&&typeof e==`object`&&e[E]===C,O=e=>!!e&&typeof e==`object`&&e[E]===w,k=e=>!!e&&typeof e==`object`&&e[E]===T,A=e=>!!e&&typeof e==`object`&&e[E]===de;function j(e){if(e&&typeof e==`object`)switch(e[E]){case C:case de:return!0}return!1}function M(e){if(e&&typeof e==`object`)switch(e[E]){case le:case C:case T:case de:return!0}return!1}var me=e=>(k(e)||j(e))&&!!e.anchor,N=Symbol(`break visit`),P=Symbol(`skip children`),F=Symbol(`remove node`);function he(e,t){let n=ge(t);pe(e)?I(null,e.contents,n,Object.freeze([e]))===F&&(e.contents=null):I(null,e,n,Object.freeze([]))}he.BREAK=N,he.SKIP=P,he.REMOVE=F;function I(e,t,n,r){let i=_e(e,t,n,r);if(M(i)||O(i))return ve(e,r,i),I(e,i,n,r);if(typeof i!=`symbol`){if(j(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=I(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===N)return N;else i===F&&(t.items.splice(e,1),--e)}}else if(O(t)){r=Object.freeze(r.concat(t));let e=I(`key`,t.key,n,r);if(e===N)return N;e===F&&(t.key=null);let i=I(`value`,t.value,n,r);if(i===N)return N;i===F&&(t.value=null)}}return i}function ge(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function _e(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(D(t))return n.Map?.(e,t,r);if(A(t))return n.Seq?.(e,t,r);if(O(t))return n.Pair?.(e,t,r);if(k(t))return n.Scalar?.(e,t,r);if(fe(t))return n.Alias?.(e,t,r)}function ve(e,t,n){let r=t[t.length-1];if(j(r))r.items[e]=n;else if(O(r))e===`key`?r.key=n:r.value=n;else if(pe(r))r.contents=n;else{let e=fe(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var L={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},R=e=>e.replace(/[!,[\]{}]/g,e=>L[e]),z=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+R(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&M(e.contents)){let t={};he(e.contents,(e,n)=>{M(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||e&&!r.some(e=>e.startsWith(a))||t.push(`%TAG ${i} ${a}`);return t.join(`
2
- `)}};z.defaultYaml={explicit:!1,version:`1.2`},z.defaultTags={"!!":`tag:yaml.org,2002:`};function B(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function V(e){let t=new Set;return he(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function ye(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function be(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=V(e);let a=ye(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(k(t.node)||j(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function H(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=H(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=H(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=H(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=H(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function U(e,t,n){if(Array.isArray(e))return e.map((e,t)=>U(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!me(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var W=class{constructor(e){Object.defineProperty(this,E,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!pe(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=U(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?H(i,{"":o},``,o):o}},xe=class extends W{constructor(e){super(le),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],he(e,{Node:(e,t)=>{(fe(t)||me(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(U(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Se(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(B(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Se(e,t,n){if(fe(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(j(t)){let r=0;for(let i of t.items){let t=Se(e,i,n);t>r&&(r=t)}return r}if(O(t)){let r=Se(e,t.key,n),i=Se(e,t.value,n);return Math.max(r,i)}return 1}var Ce=e=>!e||typeof e!=`function`&&typeof e!=`object`,G=class extends W{constructor(e){super(T),this.value=e}toJSON(e,t){return t?.keep?this.value:U(this.value,e,t)}toString(){return String(this.value)}};G.BLOCK_FOLDED=`BLOCK_FOLDED`,G.BLOCK_LITERAL=`BLOCK_LITERAL`,G.PLAIN=`PLAIN`,G.QUOTE_DOUBLE=`QUOTE_DOUBLE`,G.QUOTE_SINGLE=`QUOTE_SINGLE`;var we=`tag:yaml.org,2002:`;function Te(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Ee(e,t,n){if(pe(e)&&(e=e.contents),M(e))return e;if(O(e)){let t=n.schema[C].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new xe(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=we+t.slice(2));let l=Te(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new G(e);return c&&(c.node=t),t}l=e instanceof Map?o[C]:Symbol.iterator in Object(e)?o[de]:o[C]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new G(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function De(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Ee(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var Oe=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,ke=class extends W{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>M(t)||O(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Oe(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(j(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,De(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(j(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&k(i)?i.value:i:j(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!O(t))return!1;let n=t.value;return n==null||e&&k(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return j(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(j(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,De(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ae=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function K(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var je=(e,t,n)=>e.endsWith(`
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{n as r,t as i}from"./useMutation-CRAWY7v2.js";import{f as a,u as o}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as s}from"./button-BlVCkBiz.js";import{n as c}from"./client-CU0CuJmV.js";import{t as l}from"./download-CHoQtgi5.js";import{$ as u,In as d,Nn as f,Q as p,Sn as m,Sr as h,_n as g,an as _,bn as v,ci as y,ct as b,et as x,ii as S,li as ee,or as te,qt as ne,ri as re,ti as ie,tt as ae,vn as oe,xn as se,yn as ce}from"./index-DQH0HZcb.js";var le=Symbol.for(`yaml.alias`),ue=Symbol.for(`yaml.document`),C=Symbol.for(`yaml.map`),w=Symbol.for(`yaml.pair`),T=Symbol.for(`yaml.scalar`),de=Symbol.for(`yaml.seq`),E=Symbol.for(`yaml.node.type`),D=e=>!!e&&typeof e==`object`&&e[E]===le,fe=e=>!!e&&typeof e==`object`&&e[E]===ue,pe=e=>!!e&&typeof e==`object`&&e[E]===C,O=e=>!!e&&typeof e==`object`&&e[E]===w,k=e=>!!e&&typeof e==`object`&&e[E]===T,A=e=>!!e&&typeof e==`object`&&e[E]===de;function j(e){if(e&&typeof e==`object`)switch(e[E]){case C:case de:return!0}return!1}function M(e){if(e&&typeof e==`object`)switch(e[E]){case le:case C:case T:case de:return!0}return!1}var me=e=>(k(e)||j(e))&&!!e.anchor,N=Symbol(`break visit`),P=Symbol(`skip children`),F=Symbol(`remove node`);function he(e,t){let n=ge(t);fe(e)?I(null,e.contents,n,Object.freeze([e]))===F&&(e.contents=null):I(null,e,n,Object.freeze([]))}he.BREAK=N,he.SKIP=P,he.REMOVE=F;function I(e,t,n,r){let i=_e(e,t,n,r);if(M(i)||O(i))return ve(e,r,i),I(e,i,n,r);if(typeof i!=`symbol`){if(j(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=I(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===N)return N;else i===F&&(t.items.splice(e,1),--e)}}else if(O(t)){r=Object.freeze(r.concat(t));let e=I(`key`,t.key,n,r);if(e===N)return N;e===F&&(t.key=null);let i=I(`value`,t.value,n,r);if(i===N)return N;i===F&&(t.value=null)}}return i}function ge(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function _e(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(pe(t))return n.Map?.(e,t,r);if(A(t))return n.Seq?.(e,t,r);if(O(t))return n.Pair?.(e,t,r);if(k(t))return n.Scalar?.(e,t,r);if(D(t))return n.Alias?.(e,t,r)}function ve(e,t,n){let r=t[t.length-1];if(j(r))r.items[e]=n;else if(O(r))e===`key`?r.key=n:r.value=n;else if(fe(r))r.contents=n;else{let e=D(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var L={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},R=e=>e.replace(/[!,[\]{}]/g,e=>L[e]),z=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+R(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&M(e.contents)){let t={};he(e.contents,(e,n)=>{M(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)i===`!!`&&a===`tag:yaml.org,2002:`||e&&!r.some(e=>e.startsWith(a))||t.push(`%TAG ${i} ${a}`);return t.join(`
2
+ `)}};z.defaultYaml={explicit:!1,version:`1.2`},z.defaultTags={"!!":`tag:yaml.org,2002:`};function B(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function V(e){let t=new Set;return he(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function ye(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function be(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=V(e);let a=ye(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(k(t.node)||j(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function H(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=H(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=H(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=H(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=H(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function U(e,t,n){if(Array.isArray(e))return e.map((e,t)=>U(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!me(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var W=class{constructor(e){Object.defineProperty(this,E,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!fe(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=U(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?H(i,{"":o},``,o):o}},xe=class extends W{constructor(e){super(le),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],he(e,{Node:(e,t)=>{(D(t)||me(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(U(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Se(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(B(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Se(e,t,n){if(D(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(j(t)){let r=0;for(let i of t.items){let t=Se(e,i,n);t>r&&(r=t)}return r}if(O(t)){let r=Se(e,t.key,n),i=Se(e,t.value,n);return Math.max(r,i)}return 1}var Ce=e=>!e||typeof e!=`function`&&typeof e!=`object`,G=class extends W{constructor(e){super(T),this.value=e}toJSON(e,t){return t?.keep?this.value:U(this.value,e,t)}toString(){return String(this.value)}};G.BLOCK_FOLDED=`BLOCK_FOLDED`,G.BLOCK_LITERAL=`BLOCK_LITERAL`,G.PLAIN=`PLAIN`,G.QUOTE_DOUBLE=`QUOTE_DOUBLE`,G.QUOTE_SINGLE=`QUOTE_SINGLE`;var we=`tag:yaml.org,2002:`;function Te(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function Ee(e,t,n){if(fe(e)&&(e=e.contents),M(e))return e;if(O(e)){let t=n.schema[C].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new xe(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=we+t.slice(2));let l=Te(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new G(e);return c&&(c.node=t),t}l=e instanceof Map?o[C]:Symbol.iterator in Object(e)?o[de]:o[C]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new G(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function De(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return Ee(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var Oe=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,ke=class extends W{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>M(t)||O(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Oe(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(j(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,De(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(j(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&k(i)?i.value:i:j(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!O(t))return!1;let n=t.value;return n==null||e&&k(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return j(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(j(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,De(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Ae=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function K(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var je=(e,t,n)=>e.endsWith(`
3
3
  `)?K(n,t):n.includes(`
4
4
  `)?`
5
5
  `+K(n,t):(e.endsWith(` `)?``:` `)+n,Me=`flow`,Ne=`block`,Pe=`quoted`;function Fe(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=Ie(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
@@ -24,18 +24,18 @@ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./j
24
24
  $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=Le(r,!0);o!==`folded`&&t!==G.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=Fe(`${v}${e}${p}`,l,Ne,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function Ge(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
25
25
  `)||u&&/[[\]{},]/.test(a))return He(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
26
26
  `)?He(a,t):We(e,t,n,r);if(!s&&!u&&i!==G.PLAIN&&a.includes(`
27
- `))return We(e,t,n,r);if(Re(a)){if(c===``)return t.forceBlockIndent=!0,We(e,t,n,r);if(s&&c===l)return He(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return He(a,t)}return s?d:Fe(d,c,Me,Le(t,!1))}function Ke(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==G.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=G.QUOTE_DOUBLE);let c=e=>{switch(e){case G.BLOCK_FOLDED:case G.BLOCK_LITERAL:return i||a?He(o.value,t):We(o,t,n,r);case G.QUOTE_DOUBLE:return Be(o.value,t);case G.QUOTE_SINGLE:return Ve(o.value,t);case G.PLAIN:return Ge(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function qe(e,t){let n=Object.assign({blockQuote:!0,commentString:Ae,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Je(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(k(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Ye(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(k(e)||j(e))&&e.anchor;a&&B(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Xe(e,t,n,r){if(O(e))return e.toString(t,n,r);if(fe(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=M(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Je(t.doc.schema.tags,a);let o=Ye(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):k(a)?Ke(a,t,n,r):a.toString(t,n,r);return o?k(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Ze({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=M(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(j(e)||!M(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||j(e)||(k(e)?e.type===G.BLOCK_FOLDED||e.type===G.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Xe(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=je(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=je(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=je(g,n.indent,l(f))));let _,v,y;M(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&k(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&A(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Xe(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
27
+ `))return We(e,t,n,r);if(Re(a)){if(c===``)return t.forceBlockIndent=!0,We(e,t,n,r);if(s&&c===l)return He(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return He(a,t)}return s?d:Fe(d,c,Me,Le(t,!1))}function Ke(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==G.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=G.QUOTE_DOUBLE);let c=e=>{switch(e){case G.BLOCK_FOLDED:case G.BLOCK_LITERAL:return i||a?He(o.value,t):We(o,t,n,r);case G.QUOTE_DOUBLE:return Be(o.value,t);case G.QUOTE_SINGLE:return Ve(o.value,t);case G.PLAIN:return Ge(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function qe(e,t){let n=Object.assign({blockQuote:!0,commentString:Ae,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Je(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(k(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Ye(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(k(e)||j(e))&&e.anchor;a&&B(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Xe(e,t,n,r){if(O(e))return e.toString(t,n,r);if(D(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=M(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Je(t.doc.schema.tags,a);let o=Ye(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):k(a)?Ke(a,t,n,r):a.toString(t,n,r);return o?k(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Ze({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=M(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(j(e)||!M(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||j(e)||(k(e)?e.type===G.BLOCK_FOLDED||e.type===G.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Xe(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=je(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=je(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=je(g,n.indent,l(f))));let _,v,y;M(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&k(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&A(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Xe(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
28
28
  `:``,v){let e=l(v);S+=`\n${K(e,n.indent)}`}x===``&&!n.inFlow?S===`
29
29
  `&&y&&(S=`
30
30
 
31
31
  `):S+=`\n${n.indent}`}else if(!p&&j(t)){let e=x[0],r=x.indexOf(`
32
32
  `),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
33
- `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=je(g,n.indent,l(y)):h&&i&&i(),g}function Qe(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var $e=`<<`,q={identify:e=>e===$e||typeof e==`symbol`&&e.description===$e,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new G(Symbol($e)),{addToJSMap:tt}),stringify:()=>$e},et=(e,t)=>(q.identify(t)||k(t)&&(!t.type||t.type===G.PLAIN)&&q.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===q.tag&&e.default);function tt(e,t,n){let r=rt(e,n);if(A(r))for(let n of r.items)nt(e,t,n);else if(Array.isArray(r))for(let n of r)nt(e,t,n);else nt(e,t,r)}function nt(e,t,n){let r=rt(e,n);if(!D(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function rt(e,t){return e&&fe(t)?t.resolve(e.doc,e):t}function it(e,t,{key:n,value:r}){if(M(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(et(e,n))tt(e,t,r);else{let i=U(n,``,e);if(t instanceof Map)t.set(i,U(r,i,e));else if(t instanceof Set)t.add(i);else{let a=at(n,i,e),o=U(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function at(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(M(e)&&n?.doc){let t=qe(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Qe(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function ot(e,t,n){return new J(Ee(e,void 0,n),Ee(t,void 0,n))}var J=class e{constructor(e,t=null){Object.defineProperty(this,E,{value:w}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return M(n)&&(n=n.clone(t)),M(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return it(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Ze(this,e,t,n):JSON.stringify(this)}};function st(e,t,n){return(t.inFlow??e.flow?lt:ct)(e,t,n)}function ct({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(M(i))!d&&i.spaceBefore&&f.push(``),ut(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(O(i)){let e=M(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),ut(n,f,e.commentBefore,d))}d=!1;let s=Xe(i,u,()=>o=null,()=>d=!0);o&&(s+=je(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
33
+ `)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=je(g,n.indent,l(y)):h&&i&&i(),g}function Qe(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var $e=`<<`,q={identify:e=>e===$e||typeof e==`symbol`&&e.description===$e,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new G(Symbol($e)),{addToJSMap:tt}),stringify:()=>$e},et=(e,t)=>(q.identify(t)||k(t)&&(!t.type||t.type===G.PLAIN)&&q.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===q.tag&&e.default);function tt(e,t,n){let r=rt(e,n);if(A(r))for(let n of r.items)nt(e,t,n);else if(Array.isArray(r))for(let n of r)nt(e,t,n);else nt(e,t,r)}function nt(e,t,n){let r=rt(e,n);if(!pe(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function rt(e,t){return e&&D(t)?t.resolve(e.doc,e):t}function it(e,t,{key:n,value:r}){if(M(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(et(e,n))tt(e,t,r);else{let i=U(n,``,e);if(t instanceof Map)t.set(i,U(r,i,e));else if(t instanceof Set)t.add(i);else{let a=at(n,i,e),o=U(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function at(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(M(e)&&n?.doc){let t=qe(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Qe(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function ot(e,t,n){return new J(Ee(e,void 0,n),Ee(t,void 0,n))}var J=class e{constructor(e,t=null){Object.defineProperty(this,E,{value:w}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return M(n)&&(n=n.clone(t)),M(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return it(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Ze(this,e,t,n):JSON.stringify(this)}};function st(e,t,n){return(t.inFlow??e.flow?lt:ct)(e,t,n)}function ct({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(M(i))!d&&i.spaceBefore&&f.push(``),ut(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(O(i)){let e=M(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),ut(n,f,e.commentBefore,d))}d=!1;let s=Xe(i,u,()=>o=null,()=>d=!0);o&&(s+=je(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
34
34
  `}}return e?(p+=`
35
35
  `+K(l(e),c),s&&s()):d&&o&&o(),p}function lt({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(M(i))i.spaceBefore&&d.push(``),ut(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(O(i)){let e=M(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),ut(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=M(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Xe(i,c,()=>a=null);l||=d.length>u||o.includes(`
36
36
  `),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=je(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
37
- `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function ut({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=K(t(r),e);n.push(i.trimStart())}}function dt(e,t){let n=k(t)?t.value:t;for(let r of e)if(O(r)&&(r.key===t||r.key===n||k(r.key)&&r.key.value===n))return r}var Y=class extends ke{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(C,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(ot(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=O(e)?e:!e||typeof e!=`object`||!(`key`in e)?new J(e,e?.value):new J(e.key,e.value);let r=dt(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);k(r.value)&&Ce(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=dt(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=dt(this.items,e)?.value;return(!t&&k(n)?n.value:n)??void 0}has(e){return!!dt(this.items,e)}set(e,t){this.add(new J(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)it(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!O(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),st(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},ft={collection:`map`,default:!0,nodeClass:Y,tag:`tag:yaml.org,2002:map`,resolve(e,t){return D(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Y.from(e,t,n)},pt=class extends ke{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(de,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=mt(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=mt(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&k(r)?r.value:r}has(e){let t=mt(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=mt(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];k(r)&&Ce(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(U(e,String(r++),t));return n}toString(e,t,n){return e?st(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Ee(a,void 0,n))}}return i}};function mt(e){let t=k(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var ht={collection:`seq`,default:!0,nodeClass:pt,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return A(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>pt.from(e,t,n)},gt={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Ke(e,t,n,r)}},_t={identify:e=>e==null,createNode:()=>new G(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new G(null),stringify:({source:e},t)=>typeof e==`string`&&_t.test.test(e)?e:t.options.nullStr},vt={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new G(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&vt.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function X({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var yt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:X},bt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():X(e)}},xt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new G(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:X},St=e=>typeof e==`bigint`||Number.isInteger(e),Ct=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function wt(e,t,n){let{value:r}=e;return St(r)&&r>=0?n+r.toString(t):X(e)}var Tt={identify:e=>St(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>Ct(e,2,8,n),stringify:e=>wt(e,8,`0o`)},Et={identify:St,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Ct(e,0,10,n),stringify:X},Dt={identify:e=>St(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Ct(e,2,16,n),stringify:e=>wt(e,16,`0x`)},Ot=[ft,ht,gt,_t,vt,Tt,Et,Dt,yt,bt,xt];function kt(e){return typeof e==`bigint`||Number.isInteger(e)}var At=({value:e})=>JSON.stringify(e),jt=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:At},{identify:e=>e==null,createNode:()=>new G(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:At},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:At},{identify:kt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>kt(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:At}],Mt=[ft,ht].concat(jt,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Nt={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=G.BLOCK_LITERAL,t!==G.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===G.BLOCK_LITERAL?`
38
- `:` `)}return Ke({comment:e,type:t,value:s},r,i,a)}};function Pt(e,t){if(A(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!O(r)){if(D(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new J(new G(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=O(r)?r:new J(r)}}else t(`Expected a sequence for this tag`);return e}function Ft(e,t,n){let{replacer:r}=n,i=new pt(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(ot(o,s,n))}return i}var It={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Pt,createNode:Ft},Lt=class e extends pt{constructor(){super(),this.add=Y.prototype.add.bind(this),this.delete=Y.prototype.delete.bind(this),this.get=Y.prototype.get.bind(this),this.has=Y.prototype.has.bind(this),this.set=Y.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(O(e)?(r=U(e.key,``,t),i=U(e.value,r,t)):r=U(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Ft(e,t,n),i=new this;return i.items=r.items,i}};Lt.tag=`tag:yaml.org,2002:omap`;var Rt={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Lt,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Pt(e,t),r=[];for(let{key:e}of n.items)k(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Lt,n)},createNode:(e,t,n)=>Lt.from(e,t,n)};function zt({value:e,source:t},n){return t&&(e?Bt:Vt).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Bt={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new G(!0),stringify:zt},Vt={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new G(!1),stringify:zt},Ht={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:X},Ut={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():X(e)}},Wt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new G(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:X},Gt=e=>typeof e==`bigint`||Number.isInteger(e);function Kt(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function qt(e,t,n){let{value:r}=e;if(Gt(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return X(e)}var Jt={identify:Gt,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Kt(e,2,2,n),stringify:e=>qt(e,2,`0b`)},Yt={identify:Gt,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Kt(e,1,8,n),stringify:e=>qt(e,8,`0`)},Xt={identify:Gt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Kt(e,0,10,n),stringify:X},Zt={identify:Gt,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Kt(e,2,16,n),stringify:e=>qt(e,16,`0x`)},Qt=class e extends Y{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=O(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new J(e.key,null):new J(e,null),dt(this.items,t.key)||this.items.push(t)}get(e,t){let n=dt(this.items,e);return!t&&O(n)?k(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=dt(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new J(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(ot(e,null,n));return i}};Qt.tag=`tag:yaml.org,2002:set`;var $t={collection:`map`,identify:e=>e instanceof Set,nodeClass:Qt,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Qt.from(e,t,n),resolve(e,t){if(D(e)){if(e.hasAllNullValues(!0))return Object.assign(new Qt,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function en(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function tn(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return X(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var nn={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>en(e,n),stringify:tn},rn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>en(e,!1),stringify:tn},an={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(an.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=en(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},on=[ft,ht,gt,_t,Bt,Vt,Jt,Yt,Xt,Zt,Ht,Ut,Wt,Nt,q,Rt,It,$t,nn,rn,an],sn=new Map([[`core`,Ot],[`failsafe`,[ft,ht,gt]],[`json`,Mt],[`yaml11`,on],[`yaml-1.1`,on]]),cn={binary:Nt,bool:vt,float:xt,floatExp:bt,floatNaN:yt,floatTime:rn,int:Et,intHex:Dt,intOct:Tt,intTime:nn,map:ft,merge:q,null:_t,omap:Rt,pairs:It,seq:ht,set:$t,timestamp:an},ln={"tag:yaml.org,2002:binary":Nt,"tag:yaml.org,2002:merge":q,"tag:yaml.org,2002:omap":Rt,"tag:yaml.org,2002:pairs":It,"tag:yaml.org,2002:set":$t,"tag:yaml.org,2002:timestamp":an};function un(e,t,n){let r=sn.get(t);if(r&&!e)return n&&!r.includes(q)?r.concat(q):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(sn.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(q)),i.reduce((e,t)=>{let n=typeof t==`string`?cn[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(cn).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var dn=(e,t)=>e.key<t.key?-1:+(e.key>t.key),fn=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?un(e,`compat`):e?un(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?ln:{},this.tags=un(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,C,{value:ft}),Object.defineProperty(this,T,{value:gt}),Object.defineProperty(this,de,{value:ht}),this.sortMapEntries=typeof a==`function`?a:a===!0?dn:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function pn(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=qe(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(K(t,``))}let o=!1,s=null;if(e.contents){if(M(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(K(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Xe(e.contents,i,()=>s=null,t);s&&(c+=je(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Xe(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
37
+ `;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function ut({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=K(t(r),e);n.push(i.trimStart())}}function dt(e,t){let n=k(t)?t.value:t;for(let r of e)if(O(r)&&(r.key===t||r.key===n||k(r.key)&&r.key.value===n))return r}var Y=class extends ke{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(C,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(ot(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=O(e)?e:!e||typeof e!=`object`||!(`key`in e)?new J(e,e?.value):new J(e.key,e.value);let r=dt(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);k(r.value)&&Ce(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=dt(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=dt(this.items,e)?.value;return(!t&&k(n)?n.value:n)??void 0}has(e){return!!dt(this.items,e)}set(e,t){this.add(new J(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)it(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!O(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),st(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},ft={collection:`map`,default:!0,nodeClass:Y,tag:`tag:yaml.org,2002:map`,resolve(e,t){return pe(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Y.from(e,t,n)},pt=class extends ke{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(de,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=mt(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=mt(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&k(r)?r.value:r}has(e){let t=mt(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=mt(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];k(r)&&Ce(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(U(e,String(r++),t));return n}toString(e,t,n){return e?st(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(Ee(a,void 0,n))}}return i}};function mt(e){let t=k(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var ht={collection:`seq`,default:!0,nodeClass:pt,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return A(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>pt.from(e,t,n)},gt={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Ke(e,t,n,r)}},_t={identify:e=>e==null,createNode:()=>new G(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new G(null),stringify:({source:e},t)=>typeof e==`string`&&_t.test.test(e)?e:t.options.nullStr},vt={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new G(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&vt.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function X({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var yt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:X},bt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():X(e)}},xt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new G(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:X},St=e=>typeof e==`bigint`||Number.isInteger(e),Ct=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function wt(e,t,n){let{value:r}=e;return St(r)&&r>=0?n+r.toString(t):X(e)}var Tt={identify:e=>St(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>Ct(e,2,8,n),stringify:e=>wt(e,8,`0o`)},Et={identify:St,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Ct(e,0,10,n),stringify:X},Dt={identify:e=>St(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Ct(e,2,16,n),stringify:e=>wt(e,16,`0x`)},Ot=[ft,ht,gt,_t,vt,Tt,Et,Dt,yt,bt,xt];function kt(e){return typeof e==`bigint`||Number.isInteger(e)}var At=({value:e})=>JSON.stringify(e),jt=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:At},{identify:e=>e==null,createNode:()=>new G(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:At},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:At},{identify:kt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>kt(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:At}],Mt=[ft,ht].concat(jt,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Nt={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=G.BLOCK_LITERAL,t!==G.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===G.BLOCK_LITERAL?`
38
+ `:` `)}return Ke({comment:e,type:t,value:s},r,i,a)}};function Pt(e,t){if(A(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!O(r)){if(pe(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new J(new G(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=O(r)?r:new J(r)}}else t(`Expected a sequence for this tag`);return e}function Ft(e,t,n){let{replacer:r}=n,i=new pt(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(ot(o,s,n))}return i}var It={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:Pt,createNode:Ft},Lt=class e extends pt{constructor(){super(),this.add=Y.prototype.add.bind(this),this.delete=Y.prototype.delete.bind(this),this.get=Y.prototype.get.bind(this),this.has=Y.prototype.has.bind(this),this.set=Y.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(O(e)?(r=U(e.key,``,t),i=U(e.value,r,t)):r=U(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=Ft(e,t,n),i=new this;return i.items=r.items,i}};Lt.tag=`tag:yaml.org,2002:omap`;var Rt={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Lt,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=Pt(e,t),r=[];for(let{key:e}of n.items)k(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Lt,n)},createNode:(e,t,n)=>Lt.from(e,t,n)};function zt({value:e,source:t},n){return t&&(e?Bt:Vt).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Bt={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new G(!0),stringify:zt},Vt={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new G(!1),stringify:zt},Ht={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:X},Ut={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():X(e)}},Wt={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new G(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:X},Gt=e=>typeof e==`bigint`||Number.isInteger(e);function Kt(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function qt(e,t,n){let{value:r}=e;if(Gt(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return X(e)}var Jt={identify:Gt,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Kt(e,2,2,n),stringify:e=>qt(e,2,`0b`)},Yt={identify:Gt,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Kt(e,1,8,n),stringify:e=>qt(e,8,`0`)},Xt={identify:Gt,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Kt(e,0,10,n),stringify:X},Zt={identify:Gt,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Kt(e,2,16,n),stringify:e=>qt(e,16,`0x`)},Qt=class e extends Y{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=O(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new J(e.key,null):new J(e,null),dt(this.items,t.key)||this.items.push(t)}get(e,t){let n=dt(this.items,e);return!t&&O(n)?k(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=dt(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new J(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(ot(e,null,n));return i}};Qt.tag=`tag:yaml.org,2002:set`;var $t={collection:`map`,identify:e=>e instanceof Set,nodeClass:Qt,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Qt.from(e,t,n),resolve(e,t){if(pe(e)){if(e.hasAllNullValues(!0))return Object.assign(new Qt,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function en(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function tn(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return X(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var nn={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>en(e,n),stringify:tn},rn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>en(e,!1),stringify:tn},an={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(an.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=en(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},on=[ft,ht,gt,_t,Bt,Vt,Jt,Yt,Xt,Zt,Ht,Ut,Wt,Nt,q,Rt,It,$t,nn,rn,an],sn=new Map([[`core`,Ot],[`failsafe`,[ft,ht,gt]],[`json`,Mt],[`yaml11`,on],[`yaml-1.1`,on]]),cn={binary:Nt,bool:vt,float:xt,floatExp:bt,floatNaN:yt,floatTime:rn,int:Et,intHex:Dt,intOct:Tt,intTime:nn,map:ft,merge:q,null:_t,omap:Rt,pairs:It,seq:ht,set:$t,timestamp:an},ln={"tag:yaml.org,2002:binary":Nt,"tag:yaml.org,2002:merge":q,"tag:yaml.org,2002:omap":Rt,"tag:yaml.org,2002:pairs":It,"tag:yaml.org,2002:set":$t,"tag:yaml.org,2002:timestamp":an};function un(e,t,n){let r=sn.get(t);if(r&&!e)return n&&!r.includes(q)?r.concat(q):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(sn.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(q)),i.reduce((e,t)=>{let n=typeof t==`string`?cn[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(cn).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var dn=(e,t)=>e.key<t.key?-1:+(e.key>t.key),fn=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?un(e,`compat`):e?un(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?ln:{},this.tags=un(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,C,{value:ft}),Object.defineProperty(this,T,{value:gt}),Object.defineProperty(this,de,{value:ht}),this.sortMapEntries=typeof a==`function`?a:a===!0?dn:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function pn(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=qe(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(K(t,``))}let o=!1,s=null;if(e.contents){if(M(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(K(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Xe(e.contents,i,()=>s=null,t);s&&(c+=je(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Xe(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
39
39
  `)?(n.push(`...`),n.push(K(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(K(a(t),``)))}return n.join(`
40
40
  `)+`
41
41
  `}var mn=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,E,{value:ue});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new z({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[E]:{value:ue}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=M(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){hn(this.contents)&&this.contents.add(e)}addIn(e,t){hn(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=V(this);e.anchor=!t||n.has(t)?ye(t||`a`,n):t}return new xe(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=be(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=Ee(e,l,p);return o&&j(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new J(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return hn(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Oe(e)?this.contents!=null&&(this.contents=null,!0):hn(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return j(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Oe(e)?!t&&k(this.contents)?this.contents.value:this.contents:j(this.contents)?this.contents.getIn(e,t):void 0}has(e){return j(this.contents)?this.contents.has(e):!1}hasIn(e){return Oe(e)?this.contents!==void 0:j(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=De(this.schema,[e],t):hn(this.contents)&&this.contents.set(e,t)}setIn(e,t){Oe(e)?this.contents=t:this.contents==null?this.contents=De(this.schema,Array.from(e),t):hn(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new z({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new z({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new fn(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=U(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?H(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return pn(this,e)}};function hn(e){if(j(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var gn=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},_n=class extends gn{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},vn=class extends gn{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},yn=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
@@ -102,4 +102,4 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
102
102
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
103
103
  `,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){br(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(hr(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=yr(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(hr(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(_r(t.key)&&!hr(t.sep,`newline`)){let e=yr(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):hr(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!hr(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){br(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||hr(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=yr(vr(t));xr(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
104
104
  `)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
105
- `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=yr(vr(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=yr(vr(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function Cr(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new mr||null,prettyErrors:t}}function wr(e,t={}){let{lineCounter:n,prettyErrors:r}=Cr(t),i=new Sr(n?.addNewLine),a=new tr(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new _n(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(yn(e,n)),o.warnings.forEach(yn(e,n))),o}function Tr(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return pe(e)&&!r?e.toString(n):new mn(e,r,n).toString(n)}var Q=e(t(),1),$=n();function Er({initial:e,onClose:t}){let[n,le]=(0,Q.useState)({...e,tool:`apm`}),[ue,C]=(0,Q.useState)(),[w,T]=(0,Q.useState)(!1),[de,E]=(0,Q.useState)(!1),[fe,pe]=(0,Q.useState)(`run`),D=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=a(),A=o(),j=ce(),M=d(),me=p(),N=_(),P=n.host===void 0?M.data?.host??null:n.host,[F,he]=(0,Q.useState)(`terminal`),[I,ge]=(0,Q.useState)(`context`),[_e,ve]=(0,Q.useState)(!1),L=r({queryKey:[`package-tools`,P],queryFn:()=>c.packageTools.list(P),enabled:!!M.data}),R=r({queryKey:[`package-launch-host`,P],queryFn:()=>c.terminals.list(P),enabled:!!M.data,retry:!1}),z=r({queryKey:[`setup-components`,n.packages],enabled:n.packages.length>0,queryFn:()=>Promise.all(n.packages.map(e=>c.agentPackages.get(e)))}),B=r({queryKey:[`agent`,n.agent],queryFn:()=>c.agents.get(n.agent),enabled:!!n.agent}),V=i({mutationFn:c.agentSetups.command});(0,Q.useEffect)(()=>{V.data&&D.current?.scrollIntoView({block:`nearest`})},[V.data]);let ye=z.data?.some(e=>e.format===`agent-plugin`),be=ye&&n.backend===`claude`,H=z.data?.some(e=>e.format===`apm`||n.backend!==`codex`),U=!!(n.cwd.trim()&&(n.packages.length||n.agent)&&n.name.trim())&&L.data?.bun&&(!H||L.data?.apm)&&!be&&!z.error&&!z.isFetching&&!B.error&&!B.isFetching&&!R.isFetching&&!R.error;function W(e){le(t=>({...t,...e})),V.reset(),E(!1),C(void 0),ve(!1)}async function xe(e){T(!0),C(void 0);try{if(e===`run`&&F===`chat`){let e=await c.chat.fromSetup({...n,host:P});N.openThread(e,{follow:!1}),n.prompt.trim()&&N.send(n.prompt);let r=new URLSearchParams(A.search);r.set(`chat`,`open`),r.set(`chatThread`,e.id),t(),k(`${A.pathname}?${r}`);return}let r=await j.create({kind:n.backend,name:`${n.name}${e===`install`?` · install`:``}`,host:P,setup:{...n,host:P,operation:e}});t(),k(h(`/terminals/${r.id}`,new URLSearchParams(A.search).get(`project`)??`all`,A.search))}catch(e){C(e.message)}finally{T(!1)}}return(0,$.jsx)(ae,{open:!0,onOpenChange:e=>!e&&!_e&&!w&&!V.isPending&&t(),children:(0,$.jsxs)(re,{closeDisabled:w||V.isPending||_e,className:`flex min-w-0 w-[min(960px,calc(100vw-2rem))] max-w-none max-h-[calc(var(--app-height,100dvh)-2rem)] flex-col gap-0 overflow-hidden p-0`,children:[(0,$.jsxs)(oe,{className:`shrink-0 border-b px-4 py-4 pr-12 sm:px-6`,children:[(0,$.jsx)(ee,{children:n.packages.length?`Use package`:`Launch agent`}),(0,$.jsx)(S,{className:`sr-only`,children:`Choose the context and instructions, then launch or install configuration.`})]}),(0,$.jsxs)(g,{value:I,onValueChange:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(ne,{"aria-label":`Launch setup`,className:`shrink-0 justify-start border-b rounded-none px-4 sm:px-6`,children:[(0,$.jsx)(se,{value:`context`,"data-testid":`setup-context-tab`,disabled:w||V.isPending,children:`Context`}),(0,$.jsx)(se,{value:`instructions`,"data-testid":`setup-instructions-tab`,disabled:w||V.isPending,children:`Instructions`})]}),(0,$.jsxs)(`div`,{"data-testid":`package-setup-body`,className:`min-h-0 min-w-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-4 py-4 sm:px-6`,children:[(0,$.jsxs)(`fieldset`,{disabled:w||V.isPending,className:`min-w-0 space-y-4`,children:[(0,$.jsxs)(u,{value:`context`,forceMount:!0,className:`mt-0 space-y-4 data-[state=inactive]:hidden`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(te,{htmlFor:`setup-host`,children:`Host`}),(0,$.jsxs)(`select`,{id:`setup-host`,"data-testid":`setup-host`,className:`form-control form-control-single`,value:P??``,onChange:e=>W({host:e.target.value||null,cwd:``}),children:[(0,$.jsx)(`option`,{value:``,children:`Local`}),[...new Set([...M.data?.hosts??[],...M.data?.host?[M.data.host]:[]])].map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(te,{htmlFor:`setup-backend`,children:`Coding agent`}),(0,$.jsx)(`select`,{id:`setup-backend`,"data-testid":`setup-backend`,className:`form-control form-control-single`,value:n.backend,onChange:e=>W({backend:e.target.value}),children:[`claude`,`codex`,`copilot`].map(e=>(0,$.jsxs)(`option`,{value:e,disabled:!!(ye&&e===`claude`),children:[e,ye&&e===`claude`?` · unsupported for this plugin`:R.data?.launchers.includes(e)?``:` · not installed`]},e))})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(te,{htmlFor:`setup-cwd`,children:[`Working folder on `,P??`Local`]}),(0,$.jsxs)(`select`,{"data-testid":`setup-project-folder`,"aria-label":`Fill working folder from a project (optional)`,className:`form-control form-control-single`,value:``,onChange:e=>{e.target.value&&W({cwd:e.target.value})},children:[(0,$.jsx)(`option`,{value:``,children:`Use a project folder (optional)…`}),me.data?.filter(e=>e.scope).map(e=>(0,$.jsx)(`option`,{value:e.scope??``,children:e.name},e.id))]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(x,{id:`setup-cwd`,"data-testid":`setup-cwd`,value:n.cwd,onChange:e=>W({cwd:e.target.value})}),(0,$.jsx)(s,{type:`button`,variant:`outline`,"data-testid":`setup-browse`,ref:O,disabled:R.isFetching||!!R.error||!P&&!R.data?.ready,onClick:async()=>{if(P)ve(!0);else try{let e=await c.terminals.pickFolder(n.cwd||void 0,null);e.path&&W({cwd:e.path})}catch(e){C(e.message)}},children:`Browse`})]}),(0,$.jsx)(f,{open:_e&&!!P,onOpenChange:ve,host:P,initial:n.cwd,onPick:e=>W({cwd:e}),returnFocusRef:O})]}),(0,$.jsxs)(`details`,{"data-testid":`setup-components`,className:`text-sm space-y-1`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer min-h-11 content-center sm:min-h-8`,children:`Configuration to apply`}),B.data&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{children:[B.data.name,` · agent instructions`,B.data.fields.model?` · ${B.data.fields.model}`:``]}),P&&(0,$.jsxs)(`p`,{className:`text-xs text-outline`,children:[`Supporting files referenced by this agent are not transferred. Make them available at the referenced paths on `,P,`.`]})]}),z.isFetching&&(0,$.jsx)(`p`,{children:`Checking package contents…`}),z.data?.map(e=>(0,$.jsxs)(`p`,{className:`wrap-break-word`,children:[e.name,`:`,` `,e.files.filter(e=>/^(skills|\.apm\/skills)\/[^/]+\/SKILL\.md$/.test(e.name)).length,` `,`skill files`,e.files.some(e=>e.name===`mcp.json`)?`, native MCP configuration`:``,e.files.some(e=>e.name.endsWith(`.instructions.md`))?`, shared instructions`:``]},e.name))]})]}),(0,$.jsx)(u,{value:`instructions`,forceMount:!0,className:`mt-0 space-y-4 data-[state=inactive]:hidden`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(te,{htmlFor:`setup-prompt`,children:`What should the agent work on?`}),(0,$.jsx)(m,{id:`setup-prompt`,"data-testid":`setup-prompt`,rows:5,value:n.prompt,onChange:e=>W({prompt:e.target.value})})]})})]}),(0,$.jsxs)(`details`,{className:`text-xs text-outline`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer min-h-11 flex items-center sm:min-h-8`,children:`How configuration is applied`}),(0,$.jsx)(`p`,{children:`Package files are transferred to the selected host when needed. APM deploys agent configuration into the working folder; Codex plugins install into Codex's user cache on that host. These tools must already be installed. Configuration remains after the session; use a terminal for installer trust or conflict prompts.`})]}),be&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Choose Codex or Copilot for this Agent Plugin.`}),L.data&&H&&!L.data.apm&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`APM 0.33.0 or newer must be available on `,P??`Local`,`.`]}),L.data&&!L.data.bun&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Bun must be available on `,P??`Local`,`.`]}),!R.data?.ready&&F===`terminal`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:R.data?.reason??`Checking terminal availability…`}),F===`chat`&&n.backend===`copilot`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:`Chat requires Claude or Codex. Choose another coding agent in Context.`}),(ue||V.error||z.error||B.error||L.error||R.error||M.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`setup-error`,className:`text-sm text-destructive`,children:ue??V.error?.message??z.error?.message??B.error?.message??L.error?.message??R.error?.message??M.error?.message}),(0,$.jsxs)(`div`,{hidden:I!==`instructions`||F!==`command`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(te,{htmlFor:`command-mode`,children:`Command for your terminal`}),(0,$.jsxs)(`select`,{id:`command-mode`,className:`form-control form-control-single`,disabled:w||V.isPending,value:fe,onChange:e=>{pe(e.target.value),V.reset()},children:[(0,$.jsx)(`option`,{value:`run`,children:`Install and launch the agent`}),(0,$.jsx)(`option`,{value:`install`,children:`Install configuration only`})]})]}),V.data&&(0,$.jsxs)(`div`,{ref:D,className:`min-w-0 space-y-2 rounded border border-surface-highest p-3`,children:[(0,$.jsxs)(te,{htmlFor:`package-command`,children:[`Run in `,V.data.shell,` on `,P??`Local`]}),(0,$.jsx)(m,{id:`package-command`,"data-testid":`package-command`,value:V.data.command,readOnly:!0,rows:3,className:`font-mono text-xs`}),(0,$.jsx)(s,{variant:`outline`,disabled:w||V.isPending,onClick:async()=>{try{await navigator.clipboard.writeText(V.data.command),E(!0)}catch{C(`Copy is unavailable in this browser. Select and copy the command above.`)}},children:de?`Copied`:`Copy command`})]})]})]})]}),(0,$.jsxs)(ie,{className:`shrink-0 flex-row flex-nowrap items-center gap-2 border-t px-4 py-3 pb-[max(12px,env(safe-area-inset-bottom))] sm:px-6`,children:[(0,$.jsxs)(y,{children:[(0,$.jsx)(b,{asChild:!0,children:(0,$.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,actionHelp:!1,"aria-label":`Install configuration`,title:`Install configuration`,"data-testid":`setup-install-info`,disabled:w||V.isPending,className:`shrink-0 mr-auto`,children:(0,$.jsx)(l,{"aria-hidden":`true`})})}),(0,$.jsxs)(v,{align:`start`,side:`top`,className:`w-80 space-y-3`,"data-testid":`setup-install-explanation`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[`Install package configuration for your coding agent on `,P??`Local`,`, without launching an agent. Configuration remains after the session. Installer trust or conflict prompts open in a terminal.`]}),!n.packages.length&&(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Choose a package to install configuration separately. This saved agent can be launched directly.`}),(0,$.jsx)(s,{"data-testid":`setup-install`,variant:`ghost`,disabled:w||V.isPending||!U||!R.data?.ready||!n.packages.length,onClick:()=>void xe(`install`),children:`Install configuration`})]})]}),(0,$.jsxs)(`select`,{id:`setup-destination`,"data-testid":`setup-destination`,"aria-label":`Launch action`,className:`form-control form-control-single w-auto min-w-0 max-w-36`,disabled:w||V.isPending,value:F,onChange:e=>{let t=e.target.value;he(t),t===`command`&&ge(`instructions`)},children:[(0,$.jsx)(`option`,{value:`terminal`,children:`Terminal`}),(0,$.jsxs)(`option`,{value:`chat`,disabled:n.backend===`copilot`,children:[`Chat`,n.backend===`copilot`?` · requires Claude or Codex`:``]}),(0,$.jsx)(`option`,{value:`command`,children:`Command`})]}),(0,$.jsx)(s,{"data-testid":F===`command`?`setup-command`:`setup-launch`,className:`shrink-0`,disabled:w||V.isPending||!U||(F===`command`?!1:F===`terminal`?!R.data?.ready||!R.data?.launchers.includes(n.backend):!N.ready||n.backend===`copilot`),onClick:()=>F===`command`?V.mutate({...n,host:P,operation:fe}):void xe(`run`),children:w||V.isPending?`Preparing…`:F===`command`?`Generate`:F===`chat`?`Open chat`:`Run`})]})]})})}export{A as a,D as i,wr as n,Tr as r,Er as t};
105
+ `,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=yr(vr(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=yr(vr(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function Cr(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new mr||null,prettyErrors:t}}function wr(e,t={}){let{lineCounter:n,prettyErrors:r}=Cr(t),i=new Sr(n?.addNewLine),a=new tr(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new _n(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(yn(e,n)),o.warnings.forEach(yn(e,n))),o}function Tr(e,t,n){let r=null;if(typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t),typeof n==`string`&&(n=n.length),typeof n==`number`){let e=Math.round(n);n=e<1?void 0:e>8?{indent:8}:{indent:e}}if(e===void 0){let{keepUndefined:e}=n??t??{};if(!e)return}return fe(e)&&!r?e.toString(n):new mn(e,r,n).toString(n)}var Q=e(t(),1),$=n();function Er({initial:e,onClose:t}){let[n,le]=(0,Q.useState)({...e,tool:`apm`}),[ue,C]=(0,Q.useState)(),[w,T]=(0,Q.useState)(!1),[de,E]=(0,Q.useState)(!1),[D,fe]=(0,Q.useState)(`run`),pe=(0,Q.useRef)(null),O=(0,Q.useRef)(null),k=a(),A=o(),j=f(),M=d(),me=h(),N=te(),P=n.host===void 0?M.data?.host??null:n.host,[F,he]=(0,Q.useState)(`terminal`),[I,ge]=(0,Q.useState)(`context`),[_e,ve]=(0,Q.useState)(!1),L=r({queryKey:[`package-tools`,P],queryFn:()=>c.packageTools.list(P),enabled:!!M.data}),R=r({queryKey:[`package-launch-host`,P],queryFn:()=>c.terminals.list(P),enabled:!!M.data,retry:!1}),z=r({queryKey:[`setup-components`,n.packages],enabled:n.packages.length>0,queryFn:()=>Promise.all(n.packages.map(e=>c.agentPackages.get(e)))}),B=r({queryKey:[`agent`,n.agent],queryFn:()=>c.agents.get(n.agent),enabled:!!n.agent}),V=i({mutationFn:c.agentSetups.command});(0,Q.useEffect)(()=>{V.data&&pe.current?.scrollIntoView({block:`nearest`})},[V.data]);let ye=z.data?.some(e=>e.format===`agent-plugin`),be=ye&&n.backend===`claude`,H=z.data?.some(e=>e.format===`apm`||n.backend!==`codex`),U=!!(n.cwd.trim()&&(n.packages.length||n.agent)&&n.name.trim())&&L.data?.bun&&(!H||L.data?.apm)&&!be&&!z.error&&!z.isFetching&&!B.error&&!B.isFetching&&!R.isFetching&&!R.error;function W(e){le(t=>({...t,...e})),V.reset(),E(!1),C(void 0),ve(!1)}async function xe(e){T(!0),C(void 0);try{if(e===`run`&&F===`chat`){let e=await c.chat.fromSetup({...n,host:P});N.openThread(e,{follow:!1}),n.prompt.trim()&&N.send(n.prompt);let r=new URLSearchParams(A.search);r.set(`chat`,`open`),r.set(`chatThread`,e.id),t(),k(`${A.pathname}?${r}`);return}let r=await j.create({kind:n.backend,name:`${n.name}${e===`install`?` · install`:``}`,host:P,setup:{...n,host:P,operation:e}});t(),k(ne(`/terminals/${r.id}`,new URLSearchParams(A.search).get(`project`)??`all`,A.search))}catch(e){C(e.message)}finally{T(!1)}}return(0,$.jsx)(g,{open:!0,onOpenChange:e=>!e&&!_e&&!w&&!V.isPending&&t(),children:(0,$.jsxs)(oe,{closeDisabled:w||V.isPending||_e,className:`flex min-w-0 w-[min(960px,calc(100vw-2rem))] max-w-none max-h-[calc(var(--app-height,100dvh)-2rem)] flex-col gap-0 overflow-hidden p-0`,children:[(0,$.jsxs)(se,{className:`shrink-0 border-b px-4 py-4 pr-12 sm:px-6`,children:[(0,$.jsx)(m,{children:n.packages.length?`Use package`:`Launch agent`}),(0,$.jsx)(ce,{className:`sr-only`,children:`Choose the context and instructions, then launch or install configuration.`})]}),(0,$.jsxs)(p,{value:I,onValueChange:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(x,{"aria-label":`Launch setup`,className:`shrink-0 justify-start border-b rounded-none px-4 sm:px-6`,children:[(0,$.jsx)(ae,{value:`context`,"data-testid":`setup-context-tab`,disabled:w||V.isPending,children:`Context`}),(0,$.jsx)(ae,{value:`instructions`,"data-testid":`setup-instructions-tab`,disabled:w||V.isPending,children:`Instructions`})]}),(0,$.jsxs)(`div`,{"data-testid":`package-setup-body`,className:`min-h-0 min-w-0 flex-1 space-y-4 overflow-y-auto overscroll-contain px-4 py-4 sm:px-6`,children:[(0,$.jsxs)(`fieldset`,{disabled:w||V.isPending,className:`min-w-0 space-y-4`,children:[(0,$.jsxs)(u,{value:`context`,forceMount:!0,className:`mt-0 space-y-4 data-[state=inactive]:hidden`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(b,{htmlFor:`setup-host`,children:`Host`}),(0,$.jsxs)(`select`,{id:`setup-host`,"data-testid":`setup-host`,className:`form-control form-control-single`,value:P??``,onChange:e=>W({host:e.target.value||null,cwd:``}),children:[(0,$.jsx)(`option`,{value:``,children:`Local`}),[...new Set([...M.data?.hosts??[],...M.data?.host?[M.data.host]:[]])].map(e=>(0,$.jsx)(`option`,{value:e,children:e},e))]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(b,{htmlFor:`setup-backend`,children:`Coding agent`}),(0,$.jsx)(`select`,{id:`setup-backend`,"data-testid":`setup-backend`,className:`form-control form-control-single`,value:n.backend,onChange:e=>W({backend:e.target.value}),children:[`claude`,`codex`,`copilot`].map(e=>(0,$.jsxs)(`option`,{value:e,disabled:!!(ye&&e===`claude`),children:[e,ye&&e===`claude`?` · unsupported for this plugin`:R.data?.launchers.includes(e)?``:` · not installed`]},e))})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsxs)(b,{htmlFor:`setup-cwd`,children:[`Working folder on `,P??`Local`]}),(0,$.jsxs)(`select`,{"data-testid":`setup-project-folder`,"aria-label":`Fill working folder from a project (optional)`,className:`form-control form-control-single`,value:``,onChange:e=>{e.target.value&&W({cwd:e.target.value})},children:[(0,$.jsx)(`option`,{value:``,children:`Use a project folder (optional)…`}),me.data?.filter(e=>e.scope).map(e=>(0,$.jsx)(`option`,{value:e.scope??``,children:e.name},e.id))]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(ee,{id:`setup-cwd`,"data-testid":`setup-cwd`,value:n.cwd,onChange:e=>W({cwd:e.target.value})}),(0,$.jsx)(s,{type:`button`,variant:`outline`,"data-testid":`setup-browse`,ref:O,disabled:R.isFetching||!!R.error||!P&&!R.data?.ready,onClick:async()=>{if(P)ve(!0);else try{let e=await c.terminals.pickFolder(n.cwd||void 0,null);e.path&&W({cwd:e.path})}catch(e){C(e.message)}},children:`Browse`})]}),(0,$.jsx)(_,{open:_e&&!!P,onOpenChange:ve,host:P,initial:n.cwd,onPick:e=>W({cwd:e}),returnFocusRef:O})]}),(0,$.jsxs)(`details`,{"data-testid":`setup-components`,className:`text-sm space-y-1`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer min-h-11 content-center sm:min-h-8`,children:`Configuration to apply`}),B.data&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`p`,{children:[B.data.name,` · agent instructions`,B.data.fields.model?` · ${B.data.fields.model}`:``]}),P&&(0,$.jsxs)(`p`,{className:`text-xs text-outline`,children:[`Supporting files referenced by this agent are not transferred. Make them available at the referenced paths on `,P,`.`]})]}),z.isFetching&&(0,$.jsx)(`p`,{children:`Checking package contents…`}),z.data?.map(e=>(0,$.jsxs)(`p`,{className:`wrap-break-word`,children:[e.name,`:`,` `,e.files.filter(e=>/^(skills|\.apm\/skills)\/[^/]+\/SKILL\.md$/.test(e.name)).length,` `,`skill files`,e.files.some(e=>e.name===`mcp.json`)?`, native MCP configuration`:``,e.files.some(e=>e.name.endsWith(`.instructions.md`))?`, shared instructions`:``]},e.name))]})]}),(0,$.jsx)(u,{value:`instructions`,forceMount:!0,className:`mt-0 space-y-4 data-[state=inactive]:hidden`,children:(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(b,{htmlFor:`setup-prompt`,children:`What should the agent work on?`}),(0,$.jsx)(y,{id:`setup-prompt`,"data-testid":`setup-prompt`,rows:5,value:n.prompt,onChange:e=>W({prompt:e.target.value})})]})})]}),(0,$.jsxs)(`details`,{className:`text-xs text-outline`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer min-h-11 flex items-center sm:min-h-8`,children:`How configuration is applied`}),(0,$.jsx)(`p`,{children:`Package files are transferred to the selected host when needed. APM deploys agent configuration into the working folder; Codex plugins install into Codex's user cache on that host. These tools must already be installed. Configuration remains after the session; use a terminal for installer trust or conflict prompts.`})]}),be&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Choose Codex or Copilot for this Agent Plugin.`}),L.data&&H&&!L.data.apm&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`APM 0.33.0 or newer must be available on `,P??`Local`,`.`]}),L.data&&!L.data.bun&&(0,$.jsxs)(`p`,{role:`alert`,className:`text-sm`,children:[`Bun must be available on `,P??`Local`,`.`]}),!R.data?.ready&&F===`terminal`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:R.data?.reason??`Checking terminal availability…`}),F===`chat`&&n.backend===`copilot`&&(0,$.jsx)(`p`,{role:`alert`,className:`text-sm`,children:`Chat requires Claude or Codex. Choose another coding agent in Context.`}),(ue||V.error||z.error||B.error||L.error||R.error||M.error)&&(0,$.jsx)(`p`,{role:`alert`,"data-testid":`setup-error`,className:`text-sm text-destructive`,children:ue??V.error?.message??z.error?.message??B.error?.message??L.error?.message??R.error?.message??M.error?.message}),(0,$.jsxs)(`div`,{hidden:I!==`instructions`||F!==`command`,className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(b,{htmlFor:`command-mode`,children:`Command for your terminal`}),(0,$.jsxs)(`select`,{id:`command-mode`,className:`form-control form-control-single`,disabled:w||V.isPending,value:D,onChange:e=>{fe(e.target.value),V.reset()},children:[(0,$.jsx)(`option`,{value:`run`,children:`Install and launch the agent`}),(0,$.jsx)(`option`,{value:`install`,children:`Install configuration only`})]})]}),V.data&&(0,$.jsxs)(`div`,{ref:pe,className:`min-w-0 space-y-2 rounded border border-surface-highest p-3`,children:[(0,$.jsxs)(b,{htmlFor:`package-command`,children:[`Run in `,V.data.shell,` on `,P??`Local`]}),(0,$.jsx)(y,{id:`package-command`,"data-testid":`package-command`,value:V.data.command,readOnly:!0,rows:3,className:`font-mono text-xs`}),(0,$.jsx)(s,{variant:`outline`,disabled:w||V.isPending,onClick:async()=>{try{await navigator.clipboard.writeText(V.data.command),E(!0)}catch{C(`Copy is unavailable in this browser. Select and copy the command above.`)}},children:de?`Copied`:`Copy command`})]})]})]})]}),(0,$.jsxs)(v,{className:`shrink-0 flex-row flex-nowrap items-center gap-2 border-t px-4 py-3 pb-[max(12px,env(safe-area-inset-bottom))] sm:px-6`,children:[(0,$.jsxs)(ie,{children:[(0,$.jsx)(S,{asChild:!0,children:(0,$.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,actionHelp:!1,"aria-label":`Install configuration`,title:`Install configuration`,"data-testid":`setup-install-info`,disabled:w||V.isPending,className:`shrink-0 mr-auto`,children:(0,$.jsx)(l,{"aria-hidden":`true`})})}),(0,$.jsxs)(re,{align:`start`,side:`top`,className:`w-80 space-y-3`,"data-testid":`setup-install-explanation`,children:[(0,$.jsxs)(`p`,{className:`text-sm`,children:[`Install package configuration for your coding agent on `,P??`Local`,`, without launching an agent. Configuration remains after the session. Installer trust or conflict prompts open in a terminal.`]}),!n.packages.length&&(0,$.jsx)(`p`,{className:`text-sm text-outline`,children:`Choose a package to install configuration separately. This saved agent can be launched directly.`}),(0,$.jsx)(s,{"data-testid":`setup-install`,variant:`ghost`,disabled:w||V.isPending||!U||!R.data?.ready||!n.packages.length,onClick:()=>void xe(`install`),children:`Install configuration`})]})]}),(0,$.jsxs)(`select`,{id:`setup-destination`,"data-testid":`setup-destination`,"aria-label":`Launch action`,className:`form-control form-control-single w-auto min-w-0 max-w-36`,disabled:w||V.isPending,value:F,onChange:e=>{let t=e.target.value;he(t),t===`command`&&ge(`instructions`)},children:[(0,$.jsx)(`option`,{value:`terminal`,children:`Terminal`}),(0,$.jsxs)(`option`,{value:`chat`,disabled:n.backend===`copilot`,children:[`Chat`,n.backend===`copilot`?` · requires Claude or Codex`:``]}),(0,$.jsx)(`option`,{value:`command`,children:`Command`})]}),(0,$.jsx)(s,{"data-testid":F===`command`?`setup-command`:`setup-launch`,className:`shrink-0`,disabled:w||V.isPending||!U||(F===`command`?!1:F===`terminal`?!R.data?.ready||!R.data?.launchers.includes(n.backend):!N.ready||n.backend===`copilot`),onClick:()=>F===`command`?V.mutate({...n,host:P,operation:D}):void xe(`run`),children:w||V.isPending?`Preparing…`:F===`command`?`Generate`:F===`chat`?`Open chat`:`Run`})]})]})})}export{A as a,pe as i,wr as n,Tr as r,Er as t};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{Ni as t,Pi as n}from"./index-DsVJrhHJ.js";var r=e(),i=`inline-flex min-h-11 items-center gap-1 font-label text-xs text-primary hover:text-on-surface disabled:opacity-40 disabled:hover:text-primary`;function a({page:e,pageSize:a,total:o,onPage:s}){let c=Math.max(1,Math.ceil(o/a));if(o<=a)return null;let l=e*a+1,u=Math.min(o,(e+1)*a);return(0,r.jsxs)(`div`,{"data-testid":`pager`,className:`flex flex-wrap gap-2 items-center justify-between border-t border-surface-highest px-3 py-2`,children:[(0,r.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[l,`–`,u,` of `,o]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,r.jsxs)(`button`,{type:`button`,"data-testid":`pager-prev`,className:i,disabled:e===0,onClick:()=>s(e-1),children:[(0,r.jsx)(n,{className:`h-3 w-3`}),`Prev`]}),(0,r.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[`Page `,e+1,` / `,c]}),(0,r.jsxs)(`button`,{type:`button`,"data-testid":`pager-next`,className:i,disabled:e>=c-1,onClick:()=>s(e+1),children:[`Next`,(0,r.jsx)(t,{className:`h-3 w-3`})]})]})]})}export{a as t};
1
+ import{t as e}from"./jsx-runtime-CVMpzJz9.js";import{Ji as t,qi as n}from"./index-DQH0HZcb.js";var r=e(),i=`inline-flex min-h-11 items-center gap-1 font-label text-xs text-primary hover:text-on-surface disabled:opacity-40 disabled:hover:text-primary`;function a({page:e,pageSize:a,total:o,onPage:s}){let c=Math.max(1,Math.ceil(o/a));if(o<=a)return null;let l=e*a+1,u=Math.min(o,(e+1)*a);return(0,r.jsxs)(`div`,{"data-testid":`pager`,className:`flex flex-wrap gap-2 items-center justify-between border-t border-surface-highest px-3 py-2`,children:[(0,r.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[l,`–`,u,` of `,o]}),(0,r.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,r.jsxs)(`button`,{type:`button`,"data-testid":`pager-prev`,className:i,disabled:e===0,onClick:()=>s(e-1),children:[(0,r.jsx)(t,{className:`h-3 w-3`}),`Prev`]}),(0,r.jsxs)(`span`,{className:`font-label text-xs text-outline`,children:[`Page `,e+1,` / `,c]}),(0,r.jsxs)(`button`,{type:`button`,"data-testid":`pager-next`,className:i,disabled:e>=c-1,onClick:()=>s(e+1),children:[`Next`,(0,r.jsx)(n,{className:`h-3 w-3`})]})]})]})}export{a as t};
@@ -0,0 +1,3 @@
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{h as r,t as i}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as a}from"./button-BlVCkBiz.js";import{t as o}from"./TaskDetailSheet-BNj2WDE2.js";import{t as s}from"./ResponsiveFilters-DZtbOOk-.js";import{$ as c,Cr as ee,G as te,J as ne,K as l,O as u,Q as d,Sn as f,Sr as p,W as re,X as ie,Y as m,Z as h,_ as g,_i as _,ar as v,at as y,bn as b,ci as x,ct as S,dt as C,et as w,fi as T,ft as E,ht as D,it as O,li as k,lt as A,nt as j,ot as M,rt as N,st as P,tt as F,ut as I,wr as L,xi as R,xn as z,xr as B,y as V,yr as H,z as U}from"./index-DQH0HZcb.js";import{t as W}from"./ConfirmDialog-C3dzLtR4.js";import{t as G}from"./ErrorState-CpcyNx03.js";import{t as K}from"./ViewHeader-C0jvjK4H.js";import{t as q}from"./useDetailRoute-B-xjWsyW.js";import{t as J}from"./view-params-YEmeZppw.js";import{t as ae}from"./EmptyState-YM4VSLR9.js";import{a as oe,i as Y,n as se,o as ce,r as X,t as le}from"./table-D2GMF--l.js";import{n as ue,t as de}from"./useListSelection-BKCFyGyf.js";var Z=e(t(),1),Q=n(),fe=[{value:`all`,label:`All`},{value:`active`,label:`Active`},{value:`archived`,label:`Archived`},{value:`paused`,label:`Paused`}];function pe(){let e=v(`xl`),{data:t,isLoading:n,error:i,refetch:ne}=p(),[l,f]=J(`projectQuery`,``),[,ie]=r(),[m,h]=J(`status`,`all`,[`all`,`active`,`archived`,`paused`]),[g,y]=(0,Z.useState)(!1),[b,x]=(0,Z.useState)(null),[S,C]=(0,Z.useState)(null),[E,D]=(0,Z.useState)(null),{selectedId:O,openDetail:A,closeDetail:j}=q(`/projects`,`projectId`),M=H(),N=O?(t??[]).find(e=>e.id===O)??null:null,P=(0,Z.useMemo)(()=>{let e=l.trim().toLowerCase();return(t??[]).filter(t=>!e||`${t.name} ${t.description??``} ${t.scope??``} ${(t.tags??[]).join(` `)}`.toLowerCase().includes(e))},[t,l]),I=(0,Z.useMemo)(()=>m===`all`?P:P.filter(e=>e.status===m),[P,m]),L=JSON.stringify([m,l]),z=de(I.map(e=>e.id),L),B=ee(),U=B.data?.scope===L?B.data:void 0;async function pe(e){let t=await B.mutateAsync({ids:z.selectedIds,status:e,scope:L});z.select(t.failed.map(e=>e.id))}let $=(0,Z.useMemo)(()=>P.reduce((e,t)=>(e[t.status]=(e[t.status]??0)+1,e),{}),[P]);return i?(0,Q.jsx)(G,{message:i.message,onRetry:()=>ne()}):(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(K,{title:`Projects`,meta:l||m!==`all`?`${I.length} of ${(t??[]).length}`:(t??[]).length,action:(0,Q.jsxs)(a,{"data-testid":`new-project-button`,size:`sm`,onClick:()=>y(!0),className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90`,children:[(0,Q.jsx)(R,{size:12,className:`mr-1`}),`New project`]})}),(0,Q.jsxs)(d,{value:m,onValueChange:e=>h(e),className:`mb-4`,children:[(0,Q.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 flex-1 lg:max-w-md`,children:[(0,Q.jsx)(_,{size:14,"aria-hidden":!0,className:`absolute left-3 top-1/2 -translate-y-1/2 text-outline`}),(0,Q.jsx)(k,{type:`search`,"data-testid":`project-search`,"aria-label":`Search projects`,placeholder:`Search projects…`,value:l,onChange:e=>f(e.target.value,{replace:!0}),className:`pl-9`})]}),(0,Q.jsx)(s,{activeCount:Number(m!==`all`),children:(0,Q.jsx)(w,{"aria-label":`Project status`,className:`bg-transparent gap-1 h-auto max-w-full flex-wrap justify-start p-0`,children:fe.map(({value:e,label:t})=>(0,Q.jsxs)(F,{"data-testid":`projects-filter-${e}`,value:e,className:`font-label text-[13px] px-3 py-1.5 rounded-md
2
+ data-[state=active]:bg-surface-highest data-[state=active]:text-on-surface data-[state=active]:shadow-none
3
+ text-muted-foreground hover:text-on-surface`,children:[t,e!==`all`&&$[e]!=null&&(0,Q.jsx)(`span`,{className:`ml-1.5 text-xs text-muted-foreground px-1.5 py-0.5`,children:$[e]})]},e))})})]}),I.length>0&&(0,Q.jsx)(ue,{resourceLabel:`projects`,count:z.selectedIds.length,allSelected:z.allSelected,someSelected:z.someSelected,onSelectAll:z.selectAll,onClear:z.clear,disabled:B.isPending,children:te.map(e=>(0,Q.jsxs)(a,{type:`button`,size:`sm`,variant:`outline`,disabled:B.isPending,"data-testid":`projects-bulk-${e}`,onClick:()=>void pe(e),children:[e===`active`?`Activate`:e===`paused`?`Pause`:`Archive`,` `,`selected`]},e))}),B.isPending&&(0,Q.jsx)(`p`,{role:`status`,className:`mb-3 text-sm text-outline`,children:`Updating selected projects...`}),!B.isPending&&U&&(0,Q.jsxs)(`div`,{role:`status`,className:`mb-3 space-y-1 text-sm`,"data-testid":`projects-bulk-result`,children:[(0,Q.jsxs)(`p`,{children:[U.succeeded.length,` `,U.succeeded.length===1?`project`:`projects`,` set to`,` `,U.status,`.`]}),U.failed.map(e=>(0,Q.jsxs)(`p`,{className:`text-error`,children:[t?.find(t=>t.id===e.id)?.name??e.id,`: `,e.error,`. Still selected for retry.`]},e.id))]}),(0,Q.jsx)(c,{value:m,children:n?(0,Q.jsx)(`div`,{className:`space-y-2`,children:[...[,,,]].map((e,t)=>(0,Q.jsx)(u,{className:`h-12 w-full bg-surface-highest`},t))}):I.length===0?l||m!==`all`?(0,Q.jsxs)(`div`,{"data-testid":`empty-state`,className:`flex flex-col items-center justify-center gap-2 py-16 text-sm text-outline`,children:[(0,Q.jsx)(`p`,{children:`No matching projects`}),(0,Q.jsx)(a,{variant:`ghost`,"data-testid":`project-clear-filters`,onClick:()=>ie(e=>{let t=new URLSearchParams(e);return t.delete(`projectQuery`),t.delete(`status`),t}),children:`Clear filters`})]}):(0,Q.jsx)(ae,{message:`No projects`}):e?(0,Q.jsx)(`div`,{className:`overflow-hidden`,children:(0,Q.jsxs)(le,{children:[(0,Q.jsx)(oe,{children:(0,Q.jsxs)(ce,{className:`border-b border-outline-variant hover:bg-transparent`,children:[(0,Q.jsx)(Y,{className:`w-11`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Select projects`})}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground`,children:`Name`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground`,children:`Description`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground w-28`,children:`Status`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground w-36`,children:`Tags`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground w-24`,children:`Max workers`}),(0,Q.jsx)(Y,{className:`font-label text-sm text-muted-foreground w-24`,children:`Created`}),(0,Q.jsx)(Y,{className:`w-10`,children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,Q.jsx)(se,{children:I.map(e=>(0,Q.jsxs)(ce,{"data-testid":`project-row`,"data-project-id":e.id,"data-project-name":e.name,className:`border-b border-outline-variant/50 hover:bg-surface-high cursor-pointer`,onClick:()=>A(e.id),children:[(0,Q.jsx)(X,{children:(0,Q.jsx)(`input`,{type:`checkbox`,"data-testid":`project-select`,"aria-label":`Select ${e.name}`,className:`size-4 accent-primary`,checked:z.selectedIds.includes(e.id),disabled:B.isPending,onClick:e=>e.stopPropagation(),onChange:()=>z.toggle(e.id)})}),(0,Q.jsx)(X,{className:`font-body text-sm font-medium text-on-surface`,children:(0,Q.jsx)(`button`,{type:`button`,className:`min-h-8 text-left hover:text-primary`,"aria-label":`Edit project: ${e.name}`,onClick:t=>{t.stopPropagation(),A(e.id)},children:e.name})}),(0,Q.jsx)(X,{className:`font-body text-sm text-muted-foreground max-w-xs truncate`,children:e.description??`—`}),(0,Q.jsx)(X,{children:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-xs font-normal capitalize text-muted-foreground`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-1.5 shrink-0 rounded-full ${e.status===`active`?`bg-secondary`:e.status===`paused`?`bg-tertiary`:`bg-outline`}`}),e.status]})}),(0,Q.jsx)(X,{children:(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:(e.tags??[]).map(e=>(0,Q.jsx)(`span`,{className:`font-label text-sm px-1.5 py-0.5 text-muted-foreground`,children:e},e))})}),(0,Q.jsx)(X,{className:`font-label text-sm text-on-surface text-center`,children:e.max_workers??`—`}),(0,Q.jsx)(X,{className:`font-label text-sm text-muted-foreground`,children:new Date(e.created_at).toLocaleDateString()}),(0,Q.jsx)(X,{children:(0,Q.jsx)(`button`,{type:`button`,"data-testid":`project-delete`,"aria-label":`Delete project: ${e.name}`,onClick:t=>{t.stopPropagation(),D(e)},className:`text-muted-foreground hover:text-error transition-colors p-1`,children:(0,Q.jsx)(T,{size:12})})})]},e.id))})]})}):(0,Q.jsx)(`div`,{className:`divide-y divide-border`,children:I.map(e=>(0,Q.jsxs)(`article`,{"data-testid":`project-row`,"data-project-id":e.id,"data-project-name":e.name,className:`flex min-w-0 items-start gap-1 py-3`,children:[(0,Q.jsx)(`label`,{className:`flex size-11 shrink-0 items-center justify-center`,children:(0,Q.jsx)(`input`,{type:`checkbox`,"data-testid":`project-select`,"aria-label":`Select ${e.name}`,className:`size-4 accent-primary`,checked:z.selectedIds.includes(e.id),disabled:B.isPending,onChange:()=>z.toggle(e.id)})}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`project-open`,"aria-label":`Edit project: ${e.name}`,className:`min-h-11 w-full text-left text-sm font-medium wrap-break-word hover:text-primary`,onClick:()=>A(e.id),children:e.name}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 capitalize`,children:[(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`size-1.5 rounded-full ${e.status===`active`?`bg-secondary`:e.status===`paused`?`bg-tertiary`:`bg-outline`}`}),e.status]}),e.max_workers!=null&&(0,Q.jsxs)(`span`,{children:[e.max_workers,` workers`]})]}),e.description&&(0,Q.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground wrap-break-word`,children:e.description})]}),(0,Q.jsx)(a,{type:`button`,variant:`ghost`,size:`icon`,"data-testid":`project-delete`,"aria-label":`Delete project: ${e.name}`,onClick:()=>D(e),className:`shrink-0 text-muted-foreground hover:text-error`,children:(0,Q.jsx)(T,{size:14})})]},e.id))})})]}),g&&(0,Q.jsx)(re,{open:g,onClose:()=>y(!1),onFirstTask:x}),b&&(0,Q.jsx)(V,{open:!0,defaultProjectId:b,onClose:()=>x(null),onCreated:C}),(0,Q.jsx)(o,{taskId:S,open:!!S,onOpenChange:e=>{e||C(null)}}),N&&(0,Q.jsx)(me,{open:!!N,project:N,onClose:j,onFirstTask:e=>{j(),x(e)}},N.id),E&&(0,Q.jsx)(W,{open:!!E,title:`Delete project`,description:`This deletes the project, its memories and its scratchpads. Its tasks, jobs and sessions are kept without a project. This action cannot be undone.`,confirmLabel:`Delete`,variant:`destructive`,isPending:M.isPending,onConfirm:()=>{M.mutate(E.id,{onSuccess:()=>D(null)})},onCancel:()=>D(null)})]})}function me({open:e,project:t,onClose:n,onFirstTask:r}){let i=h([{id:`details`,label:`Details`},{id:`configuration`,label:`Configuration`},{id:`workspace`,label:`Workspace`}],e),[o,s]=(0,Z.useState)(t.name),[c,ee]=(0,Z.useState)(t.description??``),[u,d]=(0,Z.useState)(t.status),[p,re]=(0,Z.useState)((t.tags??[]).join(`, `)),[g,_]=(0,Z.useState)(t.scope??``),[v,w]=(0,Z.useState)(t.git_remote_url??``),[T,F]=(0,Z.useState)(t.github_sync??{enabled:!1,status_labels:D}),[R,V]=(0,Z.useState)(t.upload_directory??``),[H,U]=(0,Z.useState)(t.max_workers==null?``:String(t.max_workers)),[W,G]=(0,Z.useState)(()=>t.workspace?E(t.workspace):C()),K=L(),{data:q}=B(t.id),J=JSON.stringify([o,c,u,p,g,v,T,H,R,W])!==JSON.stringify([t.name,t.description??``,t.status,(t.tags??[]).join(`, `),t.scope??``,t.git_remote_url??``,t.github_sync??{enabled:!1,status_labels:D},t.max_workers==null?``:String(t.max_workers),t.upload_directory??``,t.workspace?E(t.workspace):C()]),ae=(e,n)=>{if(e.preventDefault(),!o.trim())return;let r=I.safeParse(W);if(!r.success){i.invalid(`workspace`,r.error.issues[0].message);return}let a={id:t.id,name:o.trim(),description:c.trim()||null,status:u,tags:p.trim()?p.split(`,`).map(e=>e.trim()).filter(Boolean):null,scope:g.trim()||null,git_remote_url:v.trim()||null,github_sync:T,max_workers:H?Number(H):null,upload_directory:R.trim()||null,workspace:r.data};K.mutate(a,{onSuccess:n})};return(0,Q.jsx)(A,{open:e,onClose:n,dirty:J,busy:K.isPending,testId:`edit-project-dialog`,children:(e,n)=>(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{children:(0,Q.jsx)(f,{className:`font-headline text-base text-on-surface`,children:`Edit project`})}),(0,Q.jsx)(`form`,{noValidate:!0,ref:i.form,onSubmit:e=>i.submit(e,()=>ae(e,n)),className:`min-h-0`,children:(0,Q.jsxs)(ie,{steps:i,children:[(0,Q.jsxs)(`div`,{className:`work-form-body space-y-4`,children:[(0,Q.jsxs)(m,{steps:i,id:`details`,children:[q&&(0,Q.jsx)(`div`,{className:`md:col-span-2`,children:(0,Q.jsx)($,{summary:q,allowNavigation:!J})}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:col-span-2`,children:[(0,Q.jsx)(a,{type:`button`,"data-testid":`project-create-task`,variant:`outline`,size:`sm`,onClick:()=>r(t.id),disabled:J||K.isPending,children:`Create task in this project`}),J&&(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Save changes before opening related work.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(S,{className:`font-label text-sm text-muted-foreground`,children:`Name *`}),(0,Q.jsx)(k,{"aria-label":`Name`,"data-testid":`edit-project-name-input`,required:!0,value:o,onChange:e=>s(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`,autoFocus:!0})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(S,{className:`font-label text-sm text-muted-foreground`,children:`Description`}),(0,Q.jsx)(x,{"aria-label":`Description`,value:c,onChange:e=>ee(e.target.value),rows:2,className:`bg-background border-control-border text-on-surface font-body text-sm resize-none`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(S,{className:`font-label text-sm text-muted-foreground`,children:`Status`}),(0,Q.jsxs)(j,{value:u,onValueChange:e=>d(e),children:[(0,Q.jsx)(y,{"aria-label":`Status`,className:`bg-background border-control-border text-on-surface font-label text-sm`,children:(0,Q.jsx)(M,{})}),(0,Q.jsx)(N,{className:`bg-surface border-outline-variant`,children:te.map(e=>(0,Q.jsx)(O,{value:e,className:`font-label text-sm`,children:e},e))})]})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(S,{className:`font-label text-sm text-muted-foreground`,children:`Tags (comma separated)`}),(0,Q.jsx)(k,{"aria-label":`Tags (comma separated)`,value:p,onChange:e=>re(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]})]}),(0,Q.jsxs)(m,{steps:i,id:`configuration`,children:[(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(S,{className:`font-label text-sm text-muted-foreground`,children:`Scope`}),(0,Q.jsx)(k,{"aria-label":`Scope`,value:g,onChange:e=>_(e.target.value),className:`bg-background border-control-border text-on-surface font-body text-sm`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5 md:col-span-2`,children:[(0,Q.jsx)(S,{htmlFor:`edit-project-git-remote-url`,className:`font-label text-sm text-muted-foreground`,children:`Git remote URL (optional)`}),(0,Q.jsx)(k,{id:`edit-project-git-remote-url`,className:`bg-background border-control-border text-on-surface font-body text-sm`,"data-testid":`edit-project-git-remote-url`,value:v,onChange:e=>w(e.target.value),placeholder:`https://github.com/owner/repo.git or git@github.com:owner/repo.git`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Clear this field to remove the saved address.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5 md:col-span-2`,children:[(0,Q.jsx)(S,{htmlFor:`edit-project-upload-directory`,children:`Upload directory (optional)`}),(0,Q.jsx)(k,{id:`edit-project-upload-directory`,"data-testid":`edit-project-upload-directory`,value:R,onChange:e=>V(e.target.value),placeholder:`.orc/sessions`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Relative to the conversation folder, or an absolute path on its execution host. External folders may require agent read permission. Empty uses .orc/sessions.`})]}),(0,Q.jsx)(P,{value:T,onChange:F,state:t.github_sync_state}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(S,{className:`font-label text-sm text-muted-foreground`,children:`Max workers`}),(0,Q.jsx)(k,{"aria-label":`Max Workers`,type:`number`,min:1,value:H,onChange:e=>U(e.target.value),placeholder:`1`,className:`bg-background border-control-border text-on-surface font-body text-sm`})]})]}),(0,Q.jsx)(m,{steps:i,id:`workspace`,children:(0,Q.jsx)(l,{value:W,onChange:G})}),K.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-error md:col-span-2`,children:K.error.message}),i.error&&(0,Q.jsx)(`p`,{role:`alert`,className:`text-sm text-error`,children:i.error})]}),(0,Q.jsxs)(b,{className:`work-form-footer`,children:[(0,Q.jsx)(a,{type:`button`,variant:`ghost`,size:`sm`,onClick:e,className:`font-label text-sm text-muted-foreground`,children:`Cancel`}),(0,Q.jsx)(ne,{steps:i,busy:K.isPending,children:(0,Q.jsx)(a,{"data-testid":`edit-project-submit`,type:`submit`,size:`sm`,disabled:K.isPending,className:`font-label text-sm bg-primary text-primary-foreground hover:bg-primary/90`,children:K.isPending?`Saving…`:`Save changes`})})]})]})})]})})}function $({summary:e,allowNavigation:t=!0}){return(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-4 py-3 border-t border-outline-variant mt-2`,children:[(0,Q.jsxs)(U,{label:`Tasks`,children:[(0,Q.jsx)(`span`,{className:`font-label text-sm text-primary`,children:e.tasks.total}),Object.keys(e.tasks.by_status).length>0&&(0,Q.jsxs)(`span`,{className:`text-muted-foreground text-sm ml-1`,children:[`(`,Object.entries(e.tasks.by_status).map(([e,t])=>`${t} ${e}`).join(`, `),`)`]})]}),(0,Q.jsx)(U,{label:`Memories`,children:t?(0,Q.jsx)(i,{"data-testid":`project-memories-link`,to:`${g}?project=${encodeURIComponent(e.project.id)}`,className:`font-label text-sm text-primary underline`,children:e.memories}):(0,Q.jsx)(`span`,{className:`font-label text-sm text-muted-foreground`,children:e.memories})}),(0,Q.jsx)(U,{label:`Jobs`,children:(0,Q.jsx)(`span`,{className:`font-label text-sm text-primary`,children:e.jobs})})]})}export{pe as default};
@@ -1 +1 @@
1
- import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{c as r,t as i}from"./button-BlVCkBiz.js";import{h as a}from"./client-RPZmgRqE.js";var o={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};o.node;var s=a(o),c=e(t(),1),l=n();function u({children:e,activeCount:t=0}){let[n,a]=(0,c.useState)(!1),o=(0,c.useId)();return(0,l.jsxs)(`div`,{className:`contents`,children:[(0,l.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0 lg:hidden`,"aria-expanded":n,"aria-controls":o,"data-testid":`view-filters-toggle`,onClick:()=>a(!n),children:[(0,l.jsx)(s,{"aria-hidden":!0}),`Filters`,t>0?` (${t})`:``]}),(0,l.jsx)(`div`,{id:o,"data-testid":`view-filters`,className:r(`order-last w-full flex-wrap items-center gap-2 border-t border-border pt-3 lg:order-none lg:flex lg:w-auto lg:border-0 lg:pt-0 lg:[&>select]:w-auto`,n?`flex`:`hidden`),children:e})]})}export{u as t};
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{c as r,t as i}from"./button-BlVCkBiz.js";import{h as a}from"./client-CU0CuJmV.js";var o={name:`sliders-horizontal`,size:24,node:[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]};o.node;var s=a(o),c=e(t(),1),l=n();function u({children:e,activeCount:t=0}){let[n,a]=(0,c.useState)(!1),o=(0,c.useId)();return(0,l.jsxs)(`div`,{className:`contents`,children:[(0,l.jsxs)(i,{type:`button`,variant:`outline`,size:`sm`,className:`shrink-0 lg:hidden`,"aria-expanded":n,"aria-controls":o,"data-testid":`view-filters-toggle`,onClick:()=>a(!n),children:[(0,l.jsx)(s,{"aria-hidden":!0}),`Filters`,t>0?` (${t})`:``]}),(0,l.jsx)(`div`,{id:o,"data-testid":`view-filters`,className:r(`order-last w-full flex-wrap items-center gap-2 border-t border-border pt-3 lg:order-none lg:flex lg:w-auto lg:border-0 lg:pt-0 lg:[&>select]:w-auto`,n?`flex`:`hidden`),children:e})]})}export{u as t};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-DSDNlrLa.js";import{n as t,t as n}from"./jsx-runtime-CVMpzJz9.js";import{f as r,h as i}from"./chunk-OB3PAWPO-BD6ylT0A.js";import{t as a}from"./button-BlVCkBiz.js";import{h as o,n as s}from"./client-CU0CuJmV.js";import{t as c}from"./check-D6qPSbzK.js";import{t as l}from"./chevron-down-BOVfTOEc.js";import{t as u}from"./eye-off-Bu5lzZba.js";import{Hi as d,It as f,Nn as p,Si as ee,Sn as m,Ti as te,_n as h,cn as ne,ii as g,ki as _,kr as v,li as y,ln as b,on as x,or as S,pi as C,ri as w,sn as re,ti as T,vn as E,yn as D,zi as O}from"./index-DQH0HZcb.js";import{c as k,n as A,o as j,s as M}from"./live-sessions-Drv2_M1y.js";var N={name:`split`,size:24,node:[[`path`,{d:`M16 3h5v5`,key:`1806ms`}],[`path`,{d:`M8 3H3v5`,key:`15dfkv`}],[`path`,{d:`M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3`,key:`1qrqzj`}],[`path`,{d:`m15 9 6-6`,key:`ko1vev`}]]};N.node;var P=o(N),F=e(t(),1),I=n();function L({session:e,open:t,onClose:n,onSaved:r}){let i=f(),[o,s]=(0,F.useState)(e.name??``),[c,l]=(0,F.useState)(null),u=e.name??``,d=o.trim();async function p(t){l(null);try{await i.mutateAsync({id:e.id,display_title:t}),r?.(t),n()}catch(e){l(e instanceof Error?e.message:String(e))}}return(0,I.jsx)(h,{open:t,onOpenChange:e=>{i.isPending||e||n()},children:(0,I.jsxs)(E,{children:[(0,I.jsx)(m,{children:`Rename session`}),(0,I.jsx)(D,{children:`The name stays after a restart and a re-sync. The agent keeps its own title.`}),(0,I.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),!i.isPending&&d&&p(d)},children:[(0,I.jsxs)(`label`,{htmlFor:`session-name-${e.id}`,className:`block space-y-2`,children:[(0,I.jsx)(`span`,{className:`text-sm`,children:`Session name`}),(0,I.jsx)(y,{id:`session-name-${e.id}`,"data-testid":`session-rename-input`,value:o,onChange:e=>s(e.target.value),maxLength:200,required:!0,disabled:i.isPending})]}),c&&(0,I.jsx)(`p`,{role:`alert`,"data-testid":`session-rename-error`,className:`text-sm text-error`,children:c}),(0,I.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[e.renamed&&(0,I.jsx)(a,{type:`button`,variant:`ghost`,"data-testid":`session-rename-reset`,disabled:i.isPending,onClick:()=>void p(null),children:`Use agent title`}),(0,I.jsx)(a,{type:`button`,variant:`ghost`,"data-testid":`session-rename-cancel`,disabled:i.isPending,onClick:n,children:`Cancel`}),(0,I.jsx)(a,{type:`submit`,"data-testid":`session-rename-save`,disabled:i.isPending||!d||d===u,children:i.isPending?`Saving…`:`Save`})]})]})]})})}var R=`inline-flex min-h-9 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-border px-2 py-1 text-xs text-primary hover:bg-surface-highest disabled:opacity-50`,z=`${R} min-h-11 w-full justify-start border-0`;function B({session:e}){let{openLiveSession:t,info:n,terminals:a}=p(),o=r(),l=S(),m=f(),[h]=i(),[g,y]=(0,F.useState)(!1),[w,T]=(0,F.useState)(!1),[E,D]=(0,F.useState)(!1),[N,B]=(0,F.useState)(null),[H,U]=(0,F.useState)(null),[ie,W]=(0,F.useState)(!1),G=j(e),K=A(e),q=re(a,e.id),J=h.get(`project`)??e.project_id,Y=!!(G||q||K),ae=q?null:n?.reason??`Integrated terminals are unavailable`,X=v(e.agent)??(!G||!e.cwd?`Session has no native session ID or working folder.`:void 0),Z=g||E||w||m.isPending;(0,F.useEffect)(()=>{if(!H)return;let e=setTimeout(()=>U(null),2e3);return()=>clearTimeout(e)},[H]);async function oe(){if(B(null),q)o(k(b(q.id),J));else{y(!0);try{await t(e)}catch(e){B(e instanceof Error?e.message:`Could not open terminal`)}finally{y(!1)}}}async function se(){B(null),T(!0);try{await t(e,void 0,!0)}catch(e){B(e instanceof Error?e.message:`Could not fork the session`)}finally{T(!1)}}async function ce(t){B(null);try{await m.mutateAsync({id:e.id,hidden:t})}catch(e){B(e instanceof Error?e.message:`Could not update the session`)}}async function Q(e,t){B(null);try{await navigator.clipboard.writeText(e),U(t)}catch{B(`Clipboard access failed. Allow clipboard access and try again.`)}}async function le(){D(!0),B(null);try{l.openThread(await s.chat.resume(e.id));let t=new URLSearchParams(h);t.delete(`session`),t.set(`chat`,`open`),o({search:t.toString()})}catch(e){B(e instanceof Error?e.message:`Could not resume in chat`)}finally{D(!1)}}let $=t=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{type:`button`,"data-testid":`rename-session`,disabled:Z,onClick:()=>{t(),W(!0)},className:z,children:[(0,I.jsx)(ee,{size:13}),`Rename`]}),(0,I.jsxs)(`button`,{type:`button`,"data-testid":e.hidden?`unhide-session`:`hide-session`,disabled:Z,title:e.hidden?`Show this session in the list again`:`Keep this session but leave it out of the list`,onClick:()=>{t(),ce(!e.hidden)},className:z,children:[e.hidden?(0,I.jsx)(O,{size:13}):(0,I.jsx)(u,{size:13}),e.hidden?`Show in list`:`Hide from list`]})]});return(0,I.jsxs)(`div`,{className:`max-w-72 space-y-1 text-left`,children:[(0,I.jsx)(`div`,{className:`flex flex-wrap items-center gap-1`,children:Y?(0,I.jsxs)(`fieldset`,{"aria-label":`Resume session`,className:`inline-flex`,children:[(0,I.jsxs)(`button`,{type:`button`,"data-testid":`open-chat-resume`,disabled:Z||!!X,title:X??`Resume in chat`,onClick:()=>void le(),className:`${R} rounded-r-none`,children:[(0,I.jsx)(te,{size:13}),E?`Resuming…`:`Resume`]}),(0,I.jsx)(V,{triggerTestId:`resume-actions-menu`,triggerLabel:`More session actions`,triggerClass:`${R} rounded-l-none border-l-0 px-2`,extra:t=>(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`button`,{type:`button`,"data-testid":`open-terminal-resume`,disabled:Z||!q&&!n?.ready,title:ae??`Resume in terminal`,onClick:()=>{t(),oe()},className:z,children:[(0,I.jsx)(C,{size:13}),g?`Resuming…`:`Terminal`]}),K&&(0,I.jsxs)(`button`,{type:`button`,"data-testid":`fork-terminal-session`,disabled:Z||!n?.ready,title:n?.ready?`Open a new session that starts from this history; the original stays untouched`:n?.reason??`Integrated terminals are unavailable`,onClick:()=>{t(),se()},className:z,children:[(0,I.jsx)(P,{size:13}),w?`Forking…`:`Fork in terminal`]}),G&&(0,I.jsxs)(`button`,{type:`button`,"data-testid":`copy-resume`,className:z,title:G,onClick:()=>{t(),Q(G,`Resume command copied`)},children:[H===`Resume command copied`?(0,I.jsx)(c,{size:13}):(0,I.jsx)(d,{size:13}),`Copy resume command`]}),(0,I.jsxs)(`button`,{type:`button`,"data-testid":`copy-terminal-link`,className:z,"aria-label":`Copy terminal link`,title:`Copy terminal link`,onClick:()=>{t(),Q(x(k(ne(e.id),J)),`Terminal link copied`)},children:[(0,I.jsx)(_,{size:13}),`Copy terminal link`]})]}),housekeeping:$})]}):(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(0,I.jsx)(`span`,{"data-testid":`resume-unavailable`,className:`max-w-56 text-xs text-outline`,children:M(e)}),(0,I.jsx)(V,{triggerTestId:`session-actions-menu`,triggerLabel:`Session actions`,triggerClass:`${R} px-2`,housekeeping:$})]})}),X&&Y&&(0,I.jsx)(`p`,{"data-testid":`chat-resume-unavailable`,className:`text-xs text-outline`,children:X}),H&&(0,I.jsx)(`p`,{role:`status`,"data-testid":`resume-feedback`,className:`text-xs text-outline`,children:H}),N&&(0,I.jsx)(`p`,{role:`alert`,className:`text-xs text-error wrap-break-word`,children:N}),(0,I.jsx)(L,{session:e,open:ie,onClose:()=>W(!1)})]})}function V({triggerTestId:e,triggerLabel:t,triggerClass:n,extra:r,housekeeping:i}){let[a,o]=(0,F.useState)(!1),s=()=>o(!1);return(0,I.jsxs)(T,{open:a,onOpenChange:o,children:[(0,I.jsx)(g,{asChild:!0,children:(0,I.jsx)(`button`,{type:`button`,"data-testid":e,"aria-label":t,className:n,children:(0,I.jsx)(l,{size:13})})}),(0,I.jsxs)(w,{align:`end`,sideOffset:4,collisionPadding:8,"aria-label":`Session actions`,"data-testid":`resume-actions-dropdown`,className:`z-50 w-56 rounded-md border border-border bg-surface-high p-1 shadow-lg`,children:[r?.(s),i(s)]})]})}export{B as t};