@edspencer/paddock 0.61.1 → 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +35 -14
  2. package/package.json +1 -1
  3. package/packages/server/dist/app.js +35 -8
  4. package/packages/server/dist/claude-credentials.d.ts +116 -0
  5. package/packages/server/dist/claude-credentials.js +103 -0
  6. package/packages/server/dist/claude-home.d.ts +102 -30
  7. package/packages/server/dist/claude-home.js +437 -97
  8. package/packages/server/dist/claude-instructions.d.ts +121 -0
  9. package/packages/server/dist/claude-instructions.js +114 -0
  10. package/packages/server/dist/claude-mcp.d.ts +146 -0
  11. package/packages/server/dist/claude-mcp.js +367 -0
  12. package/packages/server/dist/claude-settings.d.ts +159 -0
  13. package/packages/server/dist/claude-settings.js +159 -0
  14. package/packages/server/dist/cli/args.d.ts +1 -9
  15. package/packages/server/dist/cli/args.js +36 -18
  16. package/packages/server/dist/cli/paddock.js +20 -39
  17. package/packages/server/dist/config.d.ts +166 -30
  18. package/packages/server/dist/config.js +106 -26
  19. package/packages/server/dist/herdctl-agent-config.d.ts +11 -1
  20. package/packages/server/dist/herdctl-agent-config.js +53 -7
  21. package/packages/server/dist/herdctl-agent-names.d.ts +11 -0
  22. package/packages/server/dist/herdctl-agent-names.js +31 -0
  23. package/packages/server/dist/herdctl.d.ts +69 -13
  24. package/packages/server/dist/herdctl.js +70 -18
  25. package/packages/server/dist/instance-config.js +36 -0
  26. package/packages/server/dist/mcp-servers.d.ts +168 -0
  27. package/packages/server/dist/mcp-servers.js +305 -0
  28. package/packages/server/dist/routes/chats.js +10 -4
  29. package/packages/server/dist/transcripts.d.ts +61 -30
  30. package/packages/server/dist/transcripts.js +141 -46
  31. package/packages/server/package.json +1 -1
  32. package/packages/web/dist/assets/{InstanceConfigPage-BgNXqAox.js → InstanceConfigPage-Ca905oey.js} +1 -1
  33. package/packages/web/dist/assets/{MarkdownRenderer-DfD_UtqU.js → MarkdownRenderer-ChlC1ezH.js} +1 -1
  34. package/packages/web/dist/assets/{ProjectRedirect-1EXdHXmO.js → ProjectRedirect-CslqbhUb.js} +1 -1
  35. package/packages/web/dist/assets/{ProjectView-DHb5vNUp.js → ProjectView-DkNdilGo.js} +3 -3
  36. package/packages/web/dist/assets/{ProjectsGrid-Br-EhLZE.js → ProjectsGrid-BrlvLc-Y.js} +1 -1
  37. package/packages/web/dist/assets/{arc-C2Jekujs.js → arc-CGqCI5nQ.js} +1 -1
  38. package/packages/web/dist/assets/{architectureDiagram-3BPJPVTR-CflCA-em.js → architectureDiagram-3BPJPVTR-Cp4KTxE2.js} +1 -1
  39. package/packages/web/dist/assets/{blockDiagram-GPEHLZMM-Ds7GLNnC.js → blockDiagram-GPEHLZMM-yFxaTv04.js} +1 -1
  40. package/packages/web/dist/assets/{c4Diagram-AAUBKEIU-D4WyGO6I.js → c4Diagram-AAUBKEIU-59lhWjRt.js} +1 -1
  41. package/packages/web/dist/assets/channel-CZs6Z1i5.js +2 -0
  42. package/packages/web/dist/assets/{chunk-2J33WTMH-tQunO_M5.js → chunk-2J33WTMH-BrpXGnJg.js} +1 -1
  43. package/packages/web/dist/assets/{chunk-4BX2VUAB-DT5dOWd2.js → chunk-4BX2VUAB-UxBDb5pi.js} +1 -1
  44. package/packages/web/dist/assets/{chunk-55IACEB6-CfTUqUEF.js → chunk-55IACEB6-D4ZJyUHW.js} +1 -1
  45. package/packages/web/dist/assets/{chunk-727SXJPM-sK5bOAA0.js → chunk-727SXJPM-DWdPj_8E.js} +1 -1
  46. package/packages/web/dist/assets/{chunk-AQP2D5EJ-DcMgVe-P.js → chunk-AQP2D5EJ-BIpNbflY.js} +1 -1
  47. package/packages/web/dist/assets/{chunk-FMBD7UC4-In3h_-7v.js → chunk-FMBD7UC4-f6iJDfdI.js} +1 -1
  48. package/packages/web/dist/assets/{chunk-ND2GUHAM-DuaIeRaC.js → chunk-ND2GUHAM-Bz3TKIJk.js} +1 -1
  49. package/packages/web/dist/assets/{chunk-QZHKN3VN-DeT5mR5T.js → chunk-QZHKN3VN-buQmkafK.js} +1 -1
  50. package/packages/web/dist/assets/classDiagram-4FO5ZUOK-CrbEUUCd.js +2 -0
  51. package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-CrbEUUCd.js +2 -0
  52. package/packages/web/dist/assets/{core-DgOgLvnM.js → core-TyFI6p0n.js} +1 -1
  53. package/packages/web/dist/assets/{cose-bilkent-S5V4N54A-CyO-rznJ.js → cose-bilkent-S5V4N54A-CIkdi0XF.js} +1 -1
  54. package/packages/web/dist/assets/{dagre-BM42HDAG-B_9Ihzgn.js → dagre-BM42HDAG-BnLJCfNs.js} +1 -1
  55. package/packages/web/dist/assets/{diagram-2AECGRRQ-z5mvZ5YT.js → diagram-2AECGRRQ-D0OqfDB9.js} +1 -1
  56. package/packages/web/dist/assets/{diagram-5GNKFQAL-Bsz0cgfn.js → diagram-5GNKFQAL-DQ2spGrK.js} +1 -1
  57. package/packages/web/dist/assets/{diagram-KO2AKTUF-B29k5f4q.js → diagram-KO2AKTUF-RDIVQ_S3.js} +1 -1
  58. package/packages/web/dist/assets/{diagram-LMA3HP47-CFrwsHoI.js → diagram-LMA3HP47-DKoTfh2C.js} +1 -1
  59. package/packages/web/dist/assets/{diagram-OG6HWLK6-D9Sjc2HR.js → diagram-OG6HWLK6-6k0OuSAL.js} +1 -1
  60. package/packages/web/dist/assets/{erDiagram-TEJ5UH35-C3vbkD7M.js → erDiagram-TEJ5UH35-B-oQaYAC.js} +1 -1
  61. package/packages/web/dist/assets/{flowDiagram-I6XJVG4X-DkMIgntd.js → flowDiagram-I6XJVG4X-B7qpYe9C.js} +1 -1
  62. package/packages/web/dist/assets/{format-BFDqyFuw.js → format-PHdEBNOi.js} +1 -1
  63. package/packages/web/dist/assets/{ganttDiagram-6RSMTGT7-nvHanjpW.js → ganttDiagram-6RSMTGT7-SfBsqMmx.js} +1 -1
  64. package/packages/web/dist/assets/{gitGraphDiagram-PVQCEYII-DbCNfOu7.js → gitGraphDiagram-PVQCEYII-CuM4Rl_i.js} +1 -1
  65. package/packages/web/dist/assets/{index-DGCs1YIO.js → index-D_1ogxg1.js} +2 -2
  66. package/packages/web/dist/assets/{infoDiagram-5YYISTIA-aJjH9x3D.js → infoDiagram-5YYISTIA-Dq-32Oj4.js} +1 -1
  67. package/packages/web/dist/assets/{ishikawaDiagram-YF4QCWOH-DoifwNnZ.js → ishikawaDiagram-YF4QCWOH-BLFHCj_o.js} +1 -1
  68. package/packages/web/dist/assets/{journeyDiagram-JHISSGLW-Cz9kG9HN.js → journeyDiagram-JHISSGLW-CHP-Yu63.js} +1 -1
  69. package/packages/web/dist/assets/{kanban-definition-UN3LZRKU-BoXnfr7A.js → kanban-definition-UN3LZRKU-DRuehSqn.js} +1 -1
  70. package/packages/web/dist/assets/{linear-BlTTO9yR.js → linear-Bwz2vnH7.js} +1 -1
  71. package/packages/web/dist/assets/{mermaid.core-YAG8eSPQ.js → mermaid.core-CeMMnCip.js} +4 -4
  72. package/packages/web/dist/assets/{mindmap-definition-RKZ34NQL-DtUBKfkr.js → mindmap-definition-RKZ34NQL-CEdqeoRW.js} +1 -1
  73. package/packages/web/dist/assets/{pieDiagram-4H26LBE5-B3Rwpmy0.js → pieDiagram-4H26LBE5-BdDXBx87.js} +1 -1
  74. package/packages/web/dist/assets/{quadrantDiagram-W4KKPZXB-B8eJtTyk.js → quadrantDiagram-W4KKPZXB-Bovd1Zhx.js} +1 -1
  75. package/packages/web/dist/assets/{requirementDiagram-4Y6WPE33-CpAluiY9.js → requirementDiagram-4Y6WPE33-DiyrKnJ2.js} +1 -1
  76. package/packages/web/dist/assets/{sankeyDiagram-5OEKKPKP-Cl_Rd1tN.js → sankeyDiagram-5OEKKPKP-BuX7TRVw.js} +1 -1
  77. package/packages/web/dist/assets/{sequenceDiagram-3UESZ5HK-CRpqKSGm.js → sequenceDiagram-3UESZ5HK-BjetZWJo.js} +1 -1
  78. package/packages/web/dist/assets/{stateDiagram-AJRCARHV-h3h8gXv_.js → stateDiagram-AJRCARHV-4AUBV6dF.js} +1 -1
  79. package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-Cq84MOtb.js +2 -0
  80. package/packages/web/dist/assets/{timeline-definition-PNZ67QCA-PVr5V_pG.js → timeline-definition-PNZ67QCA-BpQ8g8Bm.js} +1 -1
  81. package/packages/web/dist/assets/{vennDiagram-CIIHVFJN-De-4NPAX.js → vennDiagram-CIIHVFJN-Cj99BWER.js} +1 -1
  82. package/packages/web/dist/assets/{wardley-L42UT6IY-Dtv10D2d.js → wardley-L42UT6IY-S7AGTOWw.js} +1 -1
  83. package/packages/web/dist/assets/{wardleyDiagram-YWT4CUSO-p2fJuQ6C.js → wardleyDiagram-YWT4CUSO-LNXkUA7S.js} +1 -1
  84. package/packages/web/dist/assets/{xychartDiagram-2RQKCTM6-DyYF-k92.js → xychartDiagram-2RQKCTM6-DGdTh4Xk.js} +1 -1
  85. package/packages/web/dist/index.html +1 -1
  86. package/packages/web/dist/sw.js +1 -1
  87. package/packages/server/dist/cli/claude-home-choice.d.ts +0 -44
  88. package/packages/server/dist/cli/claude-home-choice.js +0 -108
  89. package/packages/web/dist/assets/channel-B1K_gwAH.js +0 -2
  90. package/packages/web/dist/assets/classDiagram-4FO5ZUOK-DYQQOKrW.js +0 -2
  91. package/packages/web/dist/assets/classDiagram-v2-Q7XG4LA2-DYQQOKrW.js +0 -2
  92. package/packages/web/dist/assets/stateDiagram-v2-BHNVJYJU-BKRI9TnH.js +0 -2
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectsGrid-Br-EhLZE.js","assets/format-BFDqyFuw.js","assets/ProjectView-DHb5vNUp.js","assets/queued-LamEU0GH.js","assets/lastTab-CU1zsF0j.js","assets/ProjectRedirect-1EXdHXmO.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectsGrid-BrlvLc-Y.js","assets/format-PHdEBNOi.js","assets/ProjectView-DkNdilGo.js","assets/queued-LamEU0GH.js","assets/lastTab-CU1zsF0j.js","assets/ProjectRedirect-CslqbhUb.js"])))=>i.map(i=>d[i]);
2
2
  function zc(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const l in r)if(l!=="default"&&!(l in e)){const o=Object.getOwnPropertyDescriptor(r,l);o&&Object.defineProperty(e,l,o.get?o:{enumerable:!0,get:()=>r[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))r(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(l){if(l.ep)return;l.ep=!0;const o=n(l);fetch(l.href,o)}})();const Qh="modulepreload",Kh=function(e){return"/"+e},ru={},Sl=function(t,n,r){let l=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));l=Promise.allSettled(n.map(s=>{if(s=Kh(s),s in ru)return;ru[s]=!0;const u=s.endsWith(".css"),h=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${s}"]${h}`))return;const c=document.createElement("link");if(c.rel=u?"stylesheet":Qh,u||(c.as="script"),c.crossOrigin="",c.href=s,a&&c.setAttribute("nonce",a),document.head.appendChild(c),u)return new Promise((p,S)=>{c.addEventListener("load",p),c.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${s}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return l.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return t().catch(o)})};var a0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Uc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fc={exports:{}},Vo={},$c={exports:{}},X={};/**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -67,5 +67,5 @@ Error generating stack: `+o.message+`
67
67
  * LICENSE.md file in the root directory of this source tree.
68
68
  *
69
69
  * @license MIT
70
- */function Er(){return Er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Er.apply(this,arguments)}function ph(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,o;for(o=0;o<r.length;o++)l=r[o],!(t.indexOf(l)>=0)&&(n[l]=e[l]);return n}function Fg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $g(e,t){return e.button===0&&(!t||t==="_self")&&!Fg(e)}const Ag=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Bg=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Wg="6";try{window.__reactRouterVersion=Wg}catch{}function Vg(e,t){return Xv({basename:void 0,future:Er({},void 0,{v7_prependBasename:!0}),history:Sv({window:void 0}),hydrationData:Hg(),routes:e,mapRouteProperties:Ug,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function Hg(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Er({},t,{errors:Qg(t.errors)})),t}function Qg(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,l]of t)if(l&&l.__type==="RouteErrorResponse")n[r]=new Bo(l.status,l.statusText,l.data,l.internal===!0);else if(l&&l.__type==="Error"){if(l.__subType){let o=window[l.__subType];if(typeof o=="function")try{let i=new o(l.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let o=new Error(l.message);o.stack="",n[r]=o}}else n[r]=l;return n}const mh=C.createContext({isTransitioning:!1}),Kg=C.createContext(new Map),bg="startTransition",_c=sp[bg],Jg="flushSync",Rc=xv[Jg];function Yg(e){_c?_c(e):e()}function Ar(e){Rc?Rc(e):e()}class Gg{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function Xg(e){let{fallbackElement:t,router:n,future:r}=e,[l,o]=C.useState(n.state),[i,a]=C.useState(),[s,u]=C.useState({isTransitioning:!1}),[h,c]=C.useState(),[p,S]=C.useState(),[k,E]=C.useState(),R=C.useRef(new Map),{v7_startTransition:m}=r||{},d=C.useCallback(y=>{m?Yg(y):y()},[m]),g=C.useCallback((y,F)=>{let{deletedFetchers:I,unstable_flushSync:Q,unstable_viewTransitionOpts:te}=F;I.forEach(se=>R.current.delete(se)),y.fetchers.forEach((se,et)=>{se.data!==void 0&&R.current.set(et,se.data)});let pe=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!te||pe){Q?Ar(()=>o(y)):d(()=>o(y));return}if(Q){Ar(()=>{p&&(h&&h.resolve(),p.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:te.currentLocation,nextLocation:te.nextLocation})});let se=n.window.document.startViewTransition(()=>{Ar(()=>o(y))});se.finished.finally(()=>{Ar(()=>{c(void 0),S(void 0),a(void 0),u({isTransitioning:!1})})}),Ar(()=>S(se));return}p?(h&&h.resolve(),p.skipTransition(),E({state:y,currentLocation:te.currentLocation,nextLocation:te.nextLocation})):(a(y),u({isTransitioning:!0,flushSync:!1,currentLocation:te.currentLocation,nextLocation:te.nextLocation}))},[n.window,p,h,R,d]);C.useLayoutEffect(()=>n.subscribe(g),[n,g]),C.useEffect(()=>{s.isTransitioning&&!s.flushSync&&c(new Gg)},[s]),C.useEffect(()=>{if(h&&i&&n.window){let y=i,F=h.promise,I=n.window.document.startViewTransition(async()=>{d(()=>o(y)),await F});I.finished.finally(()=>{c(void 0),S(void 0),a(void 0),u({isTransitioning:!1})}),S(I)}},[d,i,h,n.window]),C.useEffect(()=>{h&&i&&l.location.key===i.location.key&&h.resolve()},[h,p,l.location,i]),C.useEffect(()=>{!s.isTransitioning&&k&&(a(k.state),u({isTransitioning:!0,flushSync:!1,currentLocation:k.currentLocation,nextLocation:k.nextLocation}),E(void 0))},[s.isTransitioning,k]),C.useEffect(()=>{},[]);let x=C.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:y=>n.navigate(y),push:(y,F,I)=>n.navigate(y,{state:F,preventScrollReset:I==null?void 0:I.preventScrollReset}),replace:(y,F,I)=>n.navigate(y,{replace:!0,state:F,preventScrollReset:I==null?void 0:I.preventScrollReset})}),[n]),P=n.basename||"/",T=C.useMemo(()=>({router:n,navigator:x,static:!1,basename:P}),[n,x,P]),L=C.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return C.createElement(C.Fragment,null,C.createElement(Nl.Provider,{value:T},C.createElement(Us.Provider,{value:l},C.createElement(Kg.Provider,{value:R.current},C.createElement(mh.Provider,{value:s},C.createElement(zg,{basename:P,location:l.location,navigationType:l.historyAction,navigator:x,future:L},l.initialized||n.future.v7_partialHydration?C.createElement(Zg,{routes:n.routes,future:n.future,state:l}):t))))),null)}const Zg=C.memo(qg);function qg(e){let{routes:t,future:n,state:r}=e;return Cg(t,void 0,r,n)}const ey=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ty=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ny=C.forwardRef(function(t,n){let{onClick:r,relative:l,reloadDocument:o,replace:i,state:a,target:s,to:u,preventScrollReset:h,unstable_viewTransition:c}=t,p=ph(t,Ag),{basename:S}=C.useContext(bt),k,E=!1;if(typeof u=="string"&&ty.test(u)&&(k=u,ey))try{let g=new URL(window.location.href),x=u.startsWith("//")?new URL(g.protocol+u):new URL(u),P=Qt(x.pathname,S);x.origin===g.origin&&P!=null?u=P+x.search+x.hash:E=!0}catch{}let R=xg(u,{relative:l}),m=ly(u,{replace:i,state:a,target:s,preventScrollReset:h,relative:l,unstable_viewTransition:c});function d(g){r&&r(g),g.defaultPrevented||m(g)}return C.createElement("a",Er({},p,{href:k||R,onClick:E||o?r:d,ref:n,target:s}))}),bn=C.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:l=!1,className:o="",end:i=!1,style:a,to:s,unstable_viewTransition:u,children:h}=t,c=ph(t,Bg),p=ui(s,{relative:c.relative}),S=Wn(),k=C.useContext(Us),{navigator:E,basename:R}=C.useContext(bt),m=k!=null&&oy(p)&&u===!0,d=E.encodeLocation?E.encodeLocation(p).pathname:p.pathname,g=S.pathname,x=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;l||(g=g.toLowerCase(),x=x?x.toLowerCase():null,d=d.toLowerCase()),x&&R&&(x=Qt(x,R)||x);const P=d!=="/"&&d.endsWith("/")?d.length-1:d.length;let T=g===d||!i&&g.startsWith(d)&&g.charAt(P)==="/",L=x!=null&&(x===d||!i&&x.startsWith(d)&&x.charAt(d.length)==="/"),y={isActive:T,isPending:L,isTransitioning:m},F=T?r:void 0,I;typeof o=="function"?I=o(y):I=[o,T?"active":null,L?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let Q=typeof a=="function"?a(y):a;return C.createElement(ny,Er({},c,{"aria-current":F,className:I,ref:n,style:Q,to:s,unstable_viewTransition:u}),typeof h=="function"?h(y):h)});var Ua;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ua||(Ua={}));var Tc;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Tc||(Tc={}));function ry(e){let t=C.useContext(Nl);return t||Y(!1),t}function ly(e,t){let{target:n,replace:r,state:l,preventScrollReset:o,relative:i,unstable_viewTransition:a}=t===void 0?{}:t,s=si(),u=Wn(),h=ui(e,{relative:i});return C.useCallback(c=>{if($g(c,n)){c.preventDefault();let p=r!==void 0?r:$n(u)===$n(h);s(e,{replace:p,state:l,preventScrollReset:o,relative:i,unstable_viewTransition:a})}},[u,s,h,r,l,n,e,o,i,a])}function oy(e,t){t===void 0&&(t={});let n=C.useContext(mh);n==null&&Y(!1);let{basename:r}=ry(Ua.useViewTransitionState),l=ui(e,{relative:t.relative});if(!n.isTransitioning)return!1;let o=Qt(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Qt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ao(l.pathname,i)!=null||Ao(l.pathname,o)!=null}const vh="";function $s(e){return e===vh}function b(e){return $s(e)?"/api/root":`/api/projects/${encodeURIComponent(e)}`}function c0(e){return $s(e)?"":`/projects/${e}`}function d0(e){return e===""?"/":`${e}/home`}function iy(){return"/projects"}function f0(e,t){const n=e.startsWith(t)?e.slice(t.length):e;return n.startsWith("/files")?"files":n.startsWith("/changes")?"changes":n.startsWith("/history")?"history":n.startsWith("/settings")?"settings":n.startsWith("/triggers")||n.startsWith("/hooks")?"triggers":n.startsWith("/home")?"home":n.startsWith("/chat")?"chat":t===""?"home":"chat"}function h0(e,t){const n=`${t}/files`;if(!e.startsWith(n))return"";const r=e.slice(n.length).replace(/^\//,"");return r?r.split("/").filter(Boolean).map(l=>{try{return decodeURIComponent(l)}catch{return l}}).join("/"):""}function p0(e){if(!e)return"#";const t=e.trim().replace(/\.git$/i,"");if(/^https?:\/\//i.test(t))return t;const n=/^git@([^:]+):(.+)$/.exec(t);if(n)return`https://${n[1]}/${n[2]}`;const r=/^ssh:\/\/git@([^/]+)\/(.+)$/i.exec(t);return r?`https://${r[1]}/${r[2]}`:"#"}const ar="";async function W(e,t){const n=await fetch(`${ar}${e}`,{headers:{"content-type":"application/json",...(t==null?void 0:t.headers)??{}},...t});if(!n.ok){let r=n.statusText;try{const l=await n.json();l.error&&(r=l.error)}catch{}throw new xl(r,n.status)}return await n.json()}async function ay(e,t){const n=await fetch(`${ar}${e}`,t);if(!n.ok){let r=n.statusText;try{const l=JSON.parse(await n.text());l.error&&(r=l.error)}catch{}throw new xl(r,n.status)}return n.text()}class xl extends Error{constructor(t,n){super(t),this.status=n,this.name="ApiError"}}const gh={async me(){return W("/api/me")},async markChatSeen(e,t,n,r){const l=`${b(e)}/chats/${encodeURIComponent(t)}/seen`;await W(l,{method:"POST",body:JSON.stringify({...n!==void 0?{when:n}:{},...r!=null&&r.keepUnread?{keepUnread:!0}:{}})})},async markChatUnread(e,t,n){const r=`${b(e)}/chats/${encodeURIComponent(t)}/unread`;await W(r,{method:"POST",body:JSON.stringify({unread:n})})},async projectRuns(e,t){const n=t!==void 0?`?limit=${encodeURIComponent(t)}`:"";return W(`${b(e)}/runs${n}`)},async markRunsSeen(e,t){await W(`${b(e)}/runs/seen`,{method:"POST",body:JSON.stringify(t!==void 0?{when:t}:{})})},async getModels(){return W("/api/models")},async getInstanceConfig(){return W("/api/instance-config")},async updateInstanceConfig(e){return W("/api/instance-config",{method:"PUT",body:JSON.stringify({patch:e})})},async uploadAttachments(e,t,n){const r=new FormData;for(const o of n)r.append("files",o,o.name);const l=await fetch(`${ar}${b(e)}/chats/${encodeURIComponent(t)}/upload`,{method:"POST",body:r});if(!l.ok){let o=l.statusText;try{const i=await l.json();i.error&&(o=i.error)}catch{}throw new xl(o,l.status)}return await l.json()},async projectCommands(e){const{commands:t}=await W(`${b(e)}/commands`);return t},async listProjects(){const{projects:e,root:t}=await W("/api/projects");return{projects:e,root:t??null}},async getProjectDetail(e){return W(`${b(e)}`)},async attentionChats(e){const t=await W(`${b(e)}/chats/attention`);return{running:t.running??[],unread:t.unread??[]}},async createProject(e){const{project:t}=await W("/api/projects",{method:"POST",body:JSON.stringify(e)});return t},async updateProject(e,t){const{project:n}=await W(`${b(e)}`,{method:"PATCH",body:JSON.stringify(t)});return n},async promoteProject(e,t){const{project:n}=await W(`${b(e)}/promote`,{method:"POST",body:JSON.stringify({repo:t})});return n},async deleteProject(e){await W(`${b(e)}`,{method:"DELETE"})},async deleteProjectChat(e,t){await W(`${b(e)}/chats/${encodeURIComponent(t)}`,{method:"DELETE"})},async renameProjectChat(e,t,n){await W(`${b(e)}/chats/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({name:n})})},async archiveProjectChat(e,t,n){await W(`${b(e)}/chats/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify({archived:n})})},async starProjectChat(e,t,n){await W(`${b(e)}/chats/${encodeURIComponent(t)}/star`,{method:"POST",body:JSON.stringify({starred:n})})},async archiveProjectChats(e,t,n){await W(`${b(e)}/chats/batch/archive`,{method:"POST",body:JSON.stringify({sessionIds:t,archived:n})})},async markChatsUnread(e,t,n){await W(`${b(e)}/chats/batch/unread`,{method:"POST",body:JSON.stringify({sessionIds:t,unread:n})})},async deleteProjectChats(e,t){const n=await W(`${b(e)}/chats/batch/delete`,{method:"POST",body:JSON.stringify({sessionIds:t})});return{removed:n.removed??[],failed:n.failed??[]}},async detachProjectChat(e,t,n){await W(`${b(e)}/chats/${encodeURIComponent(t)}/detach`,{method:"POST",body:JSON.stringify({detached:n})})},async promoteChat(e,t,n){return W(`${b(e)}/chats/${encodeURIComponent(t)}/promote`,{method:"POST",body:JSON.stringify(n)})},async forkChat(e,t,n,r){const{sessionId:l}=await W(`${b(e)}/chats/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify({name:n,fromUuid:r})});return l},async revertChat(e,t,n){const{removed:r}=await W(`${b(e)}/chats/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({uuid:n})});return r},async listProjectDir(e,t=""){const n=t?`?path=${encodeURIComponent(t)}`:"";return W(`${b(e)}/files${n}`)},async listProjectFiles(e){const{entries:t}=await this.listProjectDir(e);return t.filter(n=>n.kind==="file").map(n=>n.name)},async getProjectFile(e,t){return W(`${b(e)}/files/${encodeURIComponent(t)}`)},projectFileRawUrl(e,t){return`${ar}${b(e)}/files/${encodeURIComponent(t)}?raw=1`},chatFileRawUrl(e){return`${ar}/api/chat-files/${encodeURIComponent(e)}`},async pinFile(e,t){const{project:n}=await W(`${b(e)}/pins`,{method:"PUT",body:JSON.stringify({file:t})});return n},async unpinFile(e,t){const{project:n}=await W(`${b(e)}/pins/${encodeURIComponent(t)}`,{method:"DELETE"});return n},async listProjectChats(e){const{chats:t}=await W(`${b(e)}/chats`);return t},async getAdoptableChats(e){return W(`${b(e)}/adoptable-chats`)},async adoptChats(e,t){return W(`${b(e)}/adopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async unadoptChats(e,t){return W(`${b(e)}/unadopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async chatUsage(e,t){const n=t?`?scope=${t}`:"",{usage:r}=await W(`${b(e)}/chats/usage${n}`);return r},async projectChatMessages(e,t){const{messages:n}=await W(`${b(e)}/chats/${encodeURIComponent(t)}/messages`);return n},async subagentMessages(e,t,n){const r=`${b(e)}/chats/${encodeURIComponent(t)}`,{messages:l}=await W(`${r}/subagents/${encodeURIComponent(n)}/messages`);return l},async chatContext(e,t){const n=`${b(e)}/chats/${encodeURIComponent(t)}/context`,{usage:r}=await W(n);return r},async listTriggers(e){return W(`${b(e)}/triggers`)},async putTrigger(e,t,n){const{trigger:r}=await W(`${b(e)}/triggers/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});return r},async deleteTrigger(e,t){await W(`${b(e)}/triggers/${encodeURIComponent(t)}`,{method:"DELETE"})},async triggerRuntime(e){return W(`${b(e)}/triggers/runtime`)},async runTrigger(e,t){const{sessionId:n}=await W(`${b(e)}/triggers/${encodeURIComponent(t)}/run`,{method:"POST",body:"{}"});return n},async gitInfo(){return W("/api/git")},async gitStatus(e){return W(`${b(e)}/git/status`)},async gitDiff(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return ay(`${b(e)}/git/diff${n}`)},async gitCommit(e,t,n){return W(`${b(e)}/git/commit`,{method:"POST",body:JSON.stringify(n?{message:t,files:n}:{message:t})})},async gitPush(){return W("/api/git/push",{method:"POST"})},async githubConnect(){return W("/api/git/github/connect",{method:"POST"})},async githubPoll(e){return W("/api/git/github/poll",{method:"POST",body:JSON.stringify({deviceCode:e})})},async githubDisconnect(){await W("/api/git/github/disconnect",{method:"POST"})},async transcriptionStatus(){return W("/api/transcription")},async transcribe(e,t="dictation.webm",n){const r=new FormData;r.append("file",e,t);const l=await fetch(`${ar}/api/transcribe`,{method:"POST",body:r,signal:n});if(!l.ok){let i=l.statusText;try{const a=await l.json();a.error&&(i=a.error)}catch{}throw new xl(i,l.status)}const{text:o}=await l.json();return o}},yh=C.createContext(null);function sy({children:e}){const[t,n]=C.useState([]),[r,l]=C.useState(null),[o,i]=C.useState(!0),[a,s]=C.useState(null),u=C.useRef(!1),h=C.useCallback(async()=>{u.current||i(!0),s(null);try{const{projects:k,root:E}=await gh.listProjects();u.current=!0,n(k),E&&l(E)}catch(k){s(k instanceof Error?k.message:"Failed to load projects")}finally{i(!1)}},[]),c=C.useCallback(k=>{if($s(k.slug)){l(k);return}n(E=>[k,...E.filter(R=>R.slug!==k.slug)])},[]),p=C.useCallback(k=>{n(E=>E.filter(R=>R.slug!==k))},[]);C.useEffect(()=>{h()},[h]);const S=C.useMemo(()=>({projects:t,rootWorkspace:r,loading:o,error:a,refresh:h,upsert:c,remove:p}),[t,r,o,a,h,c,p]);return f.jsx(yh.Provider,{value:S,children:e})}function uy(){const e=C.useContext(yh);if(!e)throw new Error("useProjects must be used within ProjectsProvider");return e}const cy="paddock:theme";function dy(){return typeof document<"u"&&document.documentElement.classList.contains("dark")}function fy(){const[e,t]=C.useState(dy),n=C.useCallback(()=>{t(r=>{const l=!r;document.documentElement.classList.toggle("dark",l);try{localStorage.setItem(cy,l?"dark":"light")}catch{}return l})},[]);return{dark:e,toggle:n}}const hy={name:"Paddock",logo:"🐎",accent:"#c2603c"},py={enabled:!1,path:"/open-api"};function my(){const e=globalThis.__PADDOCK_CONFIG__;return{...hy,...(e==null?void 0:e.brand)??{}}}function vy(){const e=globalThis.__PADDOCK_CONFIG__;return{...py,...(e==null?void 0:e.openapi)??{}}}function gy(e){return/^(https?:\/\/|\/)/i.test(e.trim())}const As=[{slug:"homelab",label:"Homelab",blurb:"Servers, networking, self-hosted services."},{slug:"house",label:"House",blurb:"Physical home systems — water, climate, power, garden."},{slug:"side-projects",label:"Side Projects",blurb:"Apps and ideas of your own."}],Lc="",wh=new Map(As.map(e=>[e.slug,e]));function yy(e){if(!e)return"Unsorted";const t=wh.get(e);return t?t.label:e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function m0(e){var t;return(t=wh.get(e))==null?void 0:t.blurb}function wy(e){const t=new Set(e),n=[];for(const l of As)t.has(l.slug)&&(n.push(l.slug),t.delete(l.slug));const r=t.delete(Lc);return n.push(...[...t].sort()),r&&n.push(Lc),n}const xh=25e3,Sh=1e4,xy=xh+Sh+5e3,Sy=500,ky=1e4;class Ey{constructor(){this.ws=null,this.outbox=[],this.subs=new Map,this.pingTimer=null,this.pongTimer=null,this.awaitingPong=!1,this.lastPongAt=0,this.reconnectTimer=null,this.reconnectAttempts=0,this.manualClose=!1,this.stateListeners=new Set,this._state="closed",this.activeSessions=new Map,this.activeListeners=new Set,this.activeInfoListeners=new Set,this.knownSessions=new Set;const n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;if(this.url=`${n.replace(/^http/,"ws")}/ws`,typeof window<"u"){const r=()=>this.ensureLive();window.addEventListener("online",r),window.addEventListener("focus",r),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.ensureLive()})}}get state(){return this._state}onState(t){return this.stateListeners.add(t),t(this._state),()=>this.stateListeners.delete(t)}setState(t){if(this._state!==t){this._state=t;for(const n of this.stateListeners)n(t)}}onActiveSessions(t){return this.activeListeners.add(t),t(new Set(this.activeSessions.keys())),this.connect(),()=>this.activeListeners.delete(t)}onActiveInfos(t){return this.activeInfoListeners.add(t),t(new Map(this.activeSessions)),this.connect(),()=>this.activeInfoListeners.delete(t)}setActive(t,n,r){const l=this.activeSessions.has(t);if(n?this.activeSessions.set(t,r):this.activeSessions.delete(t),this.activeSessions.has(t)!==l){const o=new Set(this.activeSessions.keys());for(const a of this.activeListeners)a(o);const i=new Map(this.activeSessions);for(const a of this.activeInfoListeners)a(i)}}subscribe(t,n,r){const l=Symbol("chat-sub"),o={projectSlug:t,sessionId:n,handlers:r,lastSeq:-1,turnActive:!1};return this.subs.set(l,o),this.connect(),n&&this.attachSession(o,!1),{setSessionId:i=>{const a=this.subs.get(l);a&&(a.sessionId=i,i&&this.attachSession(a,!1))},unsubscribe:()=>{this.subs.delete(l)}}}attachSession(t,n){t.sessionId&&(this.knownSessions.add(t.sessionId),this.transmit(JSON.stringify({type:"chat:subscribe",payload:{projectSlug:t.projectSlug,sessionId:t.sessionId,wantReplay:n,lastSeq:t.lastSeq}})))}send(t,n,r,l){const o={projectSlug:t,sessionId:r,message:n};l!=null&&l.preloadContext&&(o.preloadContext=!0),l!=null&&l.model&&(o.model=l.model),l!=null&&l.attachments&&l.attachments.length>0&&(o.attachments=l.attachments),this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:send",payload:o}))}setQueued(t,n,r,l){const o={projectSlug:t,sessionId:n,text:r,ts:l};this.transmit(JSON.stringify({type:"chat:set_queue",payload:o}))}markTurnStart(t,n){for(const r of this.subs.values())r.projectSlug===t&&r.sessionId===n&&(r.lastSeq=-1,r.turnActive=!0)}sendCommand(t,n,r){this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:command",payload:{projectSlug:t,sessionId:r,command:n}}))}cancel(t){this.transmit(JSON.stringify({type:"chat:cancel",payload:{jobId:t}}))}continueChat(t,n){this.markTurnStart(t,n),this.transmit(JSON.stringify({type:"chat:continue",payload:{projectSlug:t,sessionId:n}}))}transmit(t){this.isLive()?this.ws.send(t):(this.outbox.push(t),this.ensureLive())}isLive(){var t;return((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN?!1:Date.now()-this.lastPongAt<xy}wantsSocket(){return this.subs.size>0||this.activeListeners.size>0||this.activeInfoListeners.size>0}ensureLive(){var n;if(!this.wantsSocket())return;const t=(n=this.ws)==null?void 0:n.readyState;t===WebSocket.OPEN?this.sendPing():t!==WebSocket.CONNECTING&&(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectAttempts=0,this.connect())}flushOutbox(){var n;if(((n=this.ws)==null?void 0:n.readyState)!==WebSocket.OPEN||this.outbox.length===0)return;const t=this.outbox;this.outbox=[];for(const r of t)this.ws.send(r)}connect(){if(this.manualClose=!1,this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.setState("connecting");let t;try{t=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.reconnectAttempts=0,this.awaitingPong=!1,this.lastPongAt=Date.now(),this.setState("open"),this.flushOutbox();for(const n of this.subs.values())n.sessionId&&this.attachSession(n,n.turnActive);this.startPing()},t.onclose=()=>{this.stopPing(),this.setState("closed"),this.manualClose||this.scheduleReconnect()},t.onerror=()=>{t.close()},t.onmessage=n=>this.dispatch(n.data)}startPing(){this.stopPing(),this.pingTimer=setInterval(()=>this.sendPing(),xh)}sendPing(){var t;if(!(((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN||this.awaitingPong)){this.awaitingPong=!0;try{this.ws.send(JSON.stringify({type:"ping"}))}catch{this.awaitingPong=!1,this.ws.close();return}this.pongTimer=setTimeout(()=>{var n;this.pongTimer=null,this.awaitingPong&&((n=this.ws)==null||n.close())},Sh)}}stopPing(){this.pingTimer&&clearInterval(this.pingTimer),this.pingTimer=null,this.pongTimer&&clearTimeout(this.pongTimer),this.pongTimer=null,this.awaitingPong=!1}scheduleReconnect(){if(this.reconnectTimer)return;const t=Math.min(ky,Sy*2**this.reconnectAttempts);this.reconnectAttempts+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}route(t,n){const r=[...this.subs.values()].filter(o=>o.projectSlug===t);if(r.length===0)return;if(n){const o=r.find(i=>i.sessionId===n);if(o)return o;if(this.knownSessions.has(n))return}const l=r.find(o=>o.sessionId===null);if(l)return l;if(n===null&&r.length===1)return r[0]}dispatch(t){var u,h,c,p,S,k,E,R,m,d,g,x,P,T,L,y,F,I,Q,te,pe,se,et,Ke;let n;try{n=JSON.parse(t)}catch{return}if(n.type==="pong"){this.awaitingPong=!1,this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null),this.lastPongAt=Date.now(),this.flushOutbox();return}const r=n.payload.projectSlug;if(r==null)return;if(n.type==="chat:error"){const le=this.route(r,null);(h=le==null?void 0:(u=le.handlers).onError)==null||h.call(u,n.payload.error);return}if(n.type==="chat:resync"){const le=this.route(r,n.payload.sessionId);(p=le==null?void 0:(c=le.handlers).onResync)==null||p.call(c);return}if(n.type==="chat:active"){this.setActive(n.payload.sessionId,n.payload.running,r);for(const le of this.subs.values())le.projectSlug===r&&le.sessionId===n.payload.sessionId&&((k=(S=le.handlers).onActive)==null||k.call(S,{running:n.payload.running,jobId:n.payload.jobId}));return}if(n.type==="chat:queued_flushed"){const{sessionId:le,text:D}=n.payload;if(le){Sl(async()=>{const{writeQueued:O,writeQueuedTs:V}=await import("./queued-LamEU0GH.js");return{writeQueued:O,writeQueuedTs:V}},[]).then(({writeQueued:O,writeQueuedTs:V})=>{O(le,r,null),V(le,r,null)});for(const O of this.subs.values())O.projectSlug===r&&O.sessionId===le&&((R=(E=O.handlers).onQueuedFlushed)==null||R.call(E,{text:D}))}return}if(n.type==="chat:killed_task"){const{sessionId:le,summary:D,timestamp:O}=n.payload;if(le)for(const V of this.subs.values())V.projectSlug===r&&V.sessionId===le&&((d=(m=V.handlers).onKilledTask)==null||d.call(m,{summary:D??"",timestamp:O??""}));return}const{sessionId:l,jobId:o}=n.payload,i=this.route(r,l);if(!i)return;const a={sessionId:l,jobId:o},s=n.payload.seq;switch(typeof s=="number"&&s>i.lastSeq&&(i.lastSeq=s),i.turnActive=n.type!=="chat:complete",n.type){case"chat:response":(x=(g=i.handlers).onResponse)==null||x.call(g,n.payload.chunk,a);break;case"chat:tool_call":(T=(P=i.handlers).onToolCall)==null||T.call(P,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,output:n.payload.output,isError:n.payload.isError,durationMs:n.payload.durationMs,toolUseId:n.payload.toolUseId,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:tool_start":(y=(L=i.handlers).onToolStart)==null||y.call(L,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,toolUseId:n.payload.toolUseId,output:"",isError:!1,pending:!0,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:message_boundary":(I=(F=i.handlers).onMessageBoundary)==null||I.call(F,a);break;case"chat:injected":(te=(Q=i.handlers).onInjected)==null||te.call(Q,{sender:n.payload.sender,content:n.payload.content,timestamp:n.payload.timestamp},a);break;case"chat:notice":(se=(pe=i.handlers).onNotice)==null||se.call(pe,n.payload.notice,a);break;case"chat:complete":(Ke=(et=i.handlers).onComplete)==null||Ke.call(et,{...a,success:n.payload.success,error:n.payload.error,model:n.payload.model,usage:n.payload.usage});break}}}const Cy=new Ey,mn=new Map,Fa="paddock:lastSeen-changed";function Bs(e){try{window.dispatchEvent(new CustomEvent(Fa,{detail:{sessionId:e}}))}catch{}}function jy(e){return mn.get(e)??0}function Py(e,t){!t||!Number.isFinite(t)||t<=(mn.get(e)??0)||(mn.set(e,t),Bs(e))}function v0(e,t=Date.now()){const n=mn.get(e)??0;return t<=n||(mn.set(e,t),Bs(e)),n}function g0(e,t,n){mn.get(e)===n&&(t?mn.set(e,t):mn.delete(e),Bs(e))}function Ny({tag:e,className:t=""}){const n=si();return f.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),n(`/tags/${encodeURIComponent(e)}`)},title:`Show projects tagged ${e}`,className:`tag relative z-10 transition-colors hover:bg-paddock-300/70 dark:hover:bg-paddock-700 ${t}`,children:e})}function G(e){return{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...e}}const _y=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M12 5v14M5 12h14"})}),y0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),Ry=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M3 10.5 12 3l9 7.5"}),f.jsx("path",{d:"M5 9.5V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9.5"})]}),w0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),x0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"m21 21-4.3-4.3"})]}),S0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M4 5h16"}),f.jsx("path",{d:"M8 5v6h12"}),f.jsx("path",{d:"M8 11v6h12"})]}),k0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Ty=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"})}),E0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),f.jsx("path",{d:"M22 2 11 13"})]}),C0=e=>f.jsx("svg",{...G(e),children:f.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),j0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),f.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),f.jsx("path",{d:"M12 17v4M8 21h8"})]}),P0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"m9 18 6-6-6-6"})}),N0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2-2 2.6-2.6Z"})}),Ly=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"})]}),_0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"}),f.jsx("path",{d:"M12 9v4M12 17h.01"})]}),R0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8"})}),kh=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),T0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M13 2 4.5 13.5H11l-1 8.5 8.5-11.5H12z"})}),L0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M6 4.5v15l13-7.5z"})}),My=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M3 6h18M3 12h18M3 18h18"})}),M0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"9"}),f.jsx("path",{d:"M12 7v5l3 2"})]}),D0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"12",cy:"5",r:"1"}),f.jsx("circle",{cx:"12",cy:"12",r:"1"}),f.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),O0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M10 11v6M14 11v6"})}),I0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M12 20h9"}),f.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),z0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),f.jsx("path",{d:"M14 2v6h6"})]}),U0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M12 17v5"}),f.jsx("path",{d:"M9 10.76V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v6.76a2 2 0 0 0 .59 1.42l1.12 1.12A1 1 0 0 1 17 15H7a1 1 0 0 1-.71-1.7l1.12-1.12A2 2 0 0 0 9 10.76Z"})]}),F0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M20 6 9 17l-5-5"})}),$0=({open:e,...t})=>e?f.jsxs("svg",{...G(t),children:[f.jsx("path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"}),f.jsx("path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"})]}):f.jsxs("svg",{...G(t),children:[f.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),f.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),A0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"6",cy:"6",r:"3"}),f.jsx("circle",{cx:"6",cy:"18",r:"3"}),f.jsx("circle",{cx:"18",cy:"6",r:"3"}),f.jsx("path",{d:"M6 9v6M18 9a9 9 0 0 1-9 9"})]}),B0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M9.5 14.5l-1.7 1.7a4 4 0 0 1-5.66-5.66l1.7-1.7"}),f.jsx("path",{d:"M14.5 9.5l1.7-1.7a4 4 0 0 1 5.66 5.66l-1.7 1.7"}),f.jsx("path",{d:"M8 3.5v2M3.5 8h2M16 20.5v-2M20.5 16h-2"})]}),W0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f.jsx("path",{d:"M17 8l-5-5-5 5M12 3v12"})]}),V0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"})}),H0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.9a3.4 3.4 0 0 0-1-2.6c3-.3 6.2-1.5 6.2-6.6a5.2 5.2 0 0 0-1.4-3.6 4.8 4.8 0 0 0-.1-3.6s-1.1-.3-3.7 1.4a12.6 12.6 0 0 0-6.6 0C6.5 1.3 5.4 1.6 5.4 1.6a4.8 4.8 0 0 0-.1 3.6 5.2 5.2 0 0 0-1.4 3.6c0 5.1 3.2 6.3 6.2 6.6a3.4 3.4 0 0 0-1 2.6V22"})}),Dy=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"4"}),f.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),Oy=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})}),Iy=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.5 1.5"}),f.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.5-1.5"})]}),Q0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"m6 9 6 6 6-6"})}),K0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),f.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),f.jsx("path",{d:"M10 12h4"})]}),b0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M12 2.5l2.9 5.88 6.49.94-4.7 4.58 1.11 6.46L12 17.8l-5.8 3.05 1.11-6.46-4.7-4.58 6.49-.94z"})}),zy=["idea","active","paused","blocked","done"];function Uy({open:e,onClose:t,onCreated:n}){const[r,l]=C.useState(""),[o,i]=C.useState(""),[a,s]=C.useState(""),[u,h]=C.useState(""),[c,p]=C.useState("active"),[S,k]=C.useState(""),[E,R]=C.useState(!1),[m,d]=C.useState(null);if(C.useEffect(()=>{e&&(l(""),i(""),s(""),h(""),p("active"),k(""),d(null))},[e]),C.useEffect(()=>{const x=P=>{P.key==="Escape"&&e&&!E&&t()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[e,E,t]),!e)return null;const g=async x=>{if(x.preventDefault(),!!r.trim()){R(!0),d(null);try{const P=await gh.createProject({name:r.trim(),status:c,group:u||void 0,summary:o.trim()||void 0,repo:S.trim()||void 0,domain:a.split(",").map(T=>T.trim()).filter(Boolean)});n(P)}catch(P){d(P instanceof xl?P.message:"Failed to create project")}finally{R(!1)}}};return f.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 backdrop-blur-sm",onClick:()=>!E&&t(),children:f.jsxs("form",{className:"w-full max-w-md animate-scale-in rounded-2xl border border-paddock-200 bg-white p-6 shadow-2xl dark:border-paddock-800 dark:bg-paddock-900",onClick:x=>x.stopPropagation(),onSubmit:g,children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsx("h2",{className:"text-lg font-semibold",children:"New project"}),f.jsx("button",{type:"button",onClick:t,className:"rounded-lg p-1 text-paddock-400 hover:bg-paddock-100 hover:text-paddock-600 dark:hover:bg-paddock-800","aria-label":"Close",children:f.jsx(kh,{width:18,height:18})})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Name"}),f.jsx("input",{autoFocus:!0,className:"input",value:r,onChange:x=>l(x.target.value),placeholder:"Garage Water Heater Replacement"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Summary (optional)"}),f.jsx("input",{className:"input",value:o,onChange:x=>i(x.target.value),placeholder:"One line on what this project is about"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Area"}),f.jsxs("select",{className:"input",value:u,onChange:x=>h(x.target.value),children:[f.jsx("option",{value:"",children:"Unsorted"}),As.map(x=>f.jsx("option",{value:x.slug,children:x.label},x.slug))]})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Git repository URL (optional)"}),f.jsx("input",{className:"input",value:S,onChange:x=>k(x.target.value),placeholder:"https://github.com/owner/repo.git"}),f.jsx("span",{className:"mt-1 block text-xs text-paddock-400 dark:text-paddock-500",children:"Link an external repo and Paddock clones it as the project's working directory — the repo's own CLAUDE.md, branches & PR flow apply. Leave blank for a notebook project."})]}),f.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3",children:[f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Domain tags"}),f.jsx("input",{className:"input",value:a,onChange:x=>s(x.target.value),placeholder:"home, plumbing"})]}),f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Status"}),f.jsx("select",{className:"input capitalize",value:c,onChange:x=>p(x.target.value),children:zy.map(x=>f.jsx("option",{value:x,className:"capitalize",children:x},x))})]})]}),m&&f.jsx("p",{className:"mb-4 rounded-lg bg-rose-50 px-3 py-2 text-sm text-rose-600 dark:bg-rose-950/40 dark:text-rose-300",children:m}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx("button",{type:"button",className:"btn-ghost",onClick:t,disabled:E,children:"Cancel"}),f.jsx("button",{type:"submit",className:"btn-primary",disabled:E||!r.trim(),children:E?"Creating…":"Create project"})]})]})})}function Mc(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function Fy(e){const[t,n]=C.useState(()=>{var r;return((r=Mc(e))==null?void 0:r.matches)??!1});return C.useEffect(()=>{var o;const r=Mc(e);if(!r)return;const l=()=>n(!!r.matches);return l(),typeof r.addEventListener=="function"?(r.addEventListener("change",l),()=>r.removeEventListener("change",l)):((o=r.addListener)==null||o.call(r,l),()=>{var i;return(i=r.removeListener)==null?void 0:i.call(r,l)})},[e]),t}const Ws="paddock:panewidth:",$y={key:"sidenav",def:288,min:200,max:480},J0={key:"chatlist",def:256,min:220,max:520},Ay="(min-width: 1024px)";function pr(e,t){return Math.min(Math.max(t,e.min),e.max)}function Dc(e,t,n){return pr(n,e+t)}function By(e){try{const t=localStorage.getItem(Ws+e.key);if(t==null)return null;const n=Number.parseFloat(t);return Number.isFinite(n)?pr(e,n):null}catch{return null}}function Wy(e,t){try{localStorage.setItem(Ws+e.key,String(pr(e,t)))}catch{}}function Vy(e){try{localStorage.removeItem(Ws+e.key)}catch{}}function Hy(e){const t=Fy(Ay),[n,r]=C.useState(()=>By(e)),l=pr(e,n??e.def);return{isDesktop:t,width:l,style:t?{width:l}:void 0,preview:o=>r(pr(e,o)),commit:o=>{const i=pr(e,o);r(i),Wy(e,i)},reset:()=>{r(null),Vy(e)},spec:e}}function Qy({spec:e,width:t,onPreview:n,onCommit:r,onReset:l,label:o}){const i=C.useRef(null),a=C.useRef(t);a.current=t;const s=16;return f.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o,"aria-valuenow":Math.round(t),"aria-valuemin":e.min,"aria-valuemax":e.max,tabIndex:0,onPointerDown:u=>{i.current={startX:u.clientX,startWidth:t},u.currentTarget.setPointerCapture(u.pointerId)},onPointerMove:u=>{i.current&&n(Dc(i.current.startWidth,u.clientX-i.current.startX,e))},onPointerUp:u=>{if(i.current){i.current=null;try{u.currentTarget.releasePointerCapture(u.pointerId)}catch{}r(a.current)}},onDoubleClick:l,onKeyDown:u=>{if(u.key==="ArrowLeft"||u.key==="ArrowRight"){u.preventDefault();const h=Dc(t,u.key==="ArrowRight"?s:-s,e);n(h),r(h)}},title:"Drag to resize · double-click to reset",className:"group/resizer absolute inset-y-0 right-0 z-10 hidden w-1.5 -mr-0.5 cursor-ew-resize touch-none lg:block",children:f.jsx("span",{className:"absolute inset-y-0 right-0 w-px bg-paddock-200 transition group-hover/resizer:w-0.5 group-hover/resizer:bg-accent group-focus/resizer:w-0.5 group-focus/resizer:bg-accent dark:bg-paddock-800"})})}function Ky(e){const[t,n]=C.useState(new Map),r=C.useRef(new Map),[l,o]=C.useState(0);return C.useEffect(()=>{const i=r.current;for(const a of e)for(const s of a.chatTurns??[]){Py(s.sessionId,s.lastSeen);const u=Date.parse(s.lastTurnCompletedAt);if(!Number.isFinite(u))continue;const h=i.get(s.sessionId);!h||u>h.at?i.set(s.sessionId,{slug:a.slug,at:u,unread:s.unread}):h.unread=s.unread}o(a=>a+1)},[e]),C.useEffect(()=>{const i=new Map;return Cy.onActiveInfos(a=>{for(const[s,u]of i)a.has(s)||r.current.set(s,{slug:u,at:Date.now()});i.clear();for(const[s,u]of a)i.set(s,u);n(new Map(a)),o(s=>s+1)})},[]),C.useEffect(()=>{const i=()=>o(a=>a+1);return window.addEventListener(Fa,i),()=>window.removeEventListener(Fa,i)},[]),C.useMemo(()=>{const i=new Map,a=s=>{let u=i.get(s);return u||(u={unread:0,inflight:0},i.set(s,u)),u};for(const[s,{slug:u,at:h,unread:c}]of r.current)!t.has(s)&&(c||h>jy(s))&&(a(u).unread+=1);for(const s of t.values())a(s).inflight+=1;return i},[t,l])}function by(){const{projects:e,rootWorkspace:t,loading:n,upsert:r}=uy(),{dark:l,toggle:o}=fy(),[i,a]=C.useState(!1),[s,u]=C.useState(!1),h=si(),c=Wn(),p=my(),S=vy(),k=Hy($y),E=c.pathname==="/"||c.pathname==="/projects"||c.pathname.startsWith("/chat"),R=c.pathname.startsWith("/projects/")||E;C.useEffect(()=>{a(!1)},[c.pathname]),C.useEffect(()=>{document.title=p.name},[p.name]);const m=C.useMemo(()=>{const P=new Map;for(const T of e){const L=T.group??"",y=P.get(L);y?y.push(T):P.set(L,[T])}return wy(P.keys()).map(T=>[T,P.get(T)??[]])},[e]),d=C.useMemo(()=>t?[...e,t]:e,[e,t]),g=Ky(d),x=g.get(vh);return f.jsxs("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-canvas dark:bg-canvas-dark lg:flex-row",children:[!R&&f.jsxs("header",{className:"pt-safe flex items-center gap-2 border-b border-paddock-200 px-3 pb-2 dark:border-paddock-800 lg:hidden",children:[f.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Open menu",className:"btn-subtle -ml-1 px-2 py-2",children:f.jsx(My,{width:20,height:20})}),f.jsxs(bn,{to:"/",className:"flex items-center gap-2",children:[f.jsx(Oc,{brand:p,className:"h-7 w-7 text-sm"}),f.jsx("span",{className:"text-[15px] font-semibold tracking-tight",children:p.name})]})]}),i&&f.jsx("div",{className:"fixed inset-0 z-30 bg-black/40 backdrop-blur-sm lg:hidden","aria-hidden":"true",onClick:()=>a(!1)}),f.jsxs("aside",{style:k.style,className:`fixed inset-y-0 left-0 z-40 flex w-72 max-w-[85%] shrink-0 flex-col border-r border-paddock-200 bg-canvas shadow-2xl transition-transform duration-200 ease-out dark:border-paddock-800 dark:bg-paddock-900 lg:relative lg:z-auto lg:max-w-none lg:translate-x-0 lg:bg-white/50 lg:shadow-none dark:lg:bg-paddock-900/30 ${i?"translate-x-0":"-translate-x-full"}`,children:[k.isDesktop&&f.jsx(Qy,{spec:k.spec,width:k.width,onPreview:k.preview,onCommit:k.commit,onReset:k.reset,label:"Resize sidebar"}),f.jsxs("div",{className:"flex items-center gap-2 px-5 py-4",children:[f.jsxs(bn,{to:"/",className:"group flex items-center gap-2",children:[f.jsx(Oc,{brand:p,className:"h-8 w-8 text-base"}),f.jsx("span",{className:"text-[17px] font-semibold tracking-tight",children:p.name})]}),f.jsx("button",{type:"button",onClick:()=>a(!1),"aria-label":"Close menu",className:"btn-subtle ml-auto px-2 py-2 lg:hidden",children:f.jsx(kh,{width:18,height:18})})]}),f.jsx("div",{className:"px-3 pb-1",children:f.jsxs(bn,{to:"/",end:!0,className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-paddock-200/80 dark:bg-paddock-800":""}`,title:"The root workspace — every project, and the instance's own chats",children:[f.jsx(Ry,{width:16,height:16}),"Home",f.jsx(Eh,{badge:x,className:"ml-auto"})]})}),f.jsxs("div",{className:"mt-5 mb-1 flex items-center justify-between pr-3",children:[f.jsx(bn,{to:iy(),className:"section-label hover:text-accent",children:"Projects"}),f.jsx("button",{type:"button",onClick:()=>u(!0),"aria-label":"New Project",title:"New Project",className:"btn-subtle -mr-1 px-1.5 py-1 text-paddock-400 hover:text-accent",children:f.jsx(_y,{width:14,height:14})})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 pb-4",children:[n&&f.jsx("div",{className:"space-y-2 px-2 py-2",children:[0,1,2].map(P=>f.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-paddock-200/60 dark:bg-paddock-800/50"},P))}),!n&&e.length===0&&f.jsx("p",{className:"px-3 py-2 text-sm text-paddock-500",children:"No projects yet."}),!n&&e.length>0&&m.map(([P,T])=>f.jsxs("div",{className:"mb-2",children:[m.length>1&&f.jsx("div",{className:"px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wider text-paddock-400",children:yy(P)}),T.map(L=>f.jsx(Yy,{project:L,badge:g.get(L.slug)},L.slug))]},P||"unsorted"))]}),f.jsxs("div",{className:"border-t border-paddock-200 px-3 py-3 dark:border-paddock-800",children:[f.jsxs(bn,{to:"/config",className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-paddock-200/80 dark:bg-paddock-800":""}`,title:"Instance config — paddock.config.yaml (restart required)",children:[f.jsx(Ly,{width:15,height:15}),"Config"]}),S.enabled&&f.jsxs("a",{href:S.path,target:"_blank",rel:"noreferrer",className:"btn-subtle mt-1 w-full justify-start",title:"OpenAPI / Swagger reference (opens in a new tab)",children:[f.jsx(Iy,{width:15,height:15}),"Swagger API"]}),f.jsxs("button",{type:"button",onClick:o,className:"btn-subtle mt-1 w-full justify-start","aria-label":l?"Switch to light mode":"Switch to dark mode",title:"Toggle light / dark theme",children:[l?f.jsx(Dy,{width:15,height:15}):f.jsx(Oy,{width:15,height:15}),l?"Light mode":"Dark mode"]}),f.jsxs("p",{className:"mt-2 px-2 text-[11px] text-paddock-400",children:["v","0.61.1"]})]})]}),f.jsx("main",{className:"min-w-0 flex-1 overflow-hidden",children:f.jsx(C.Suspense,{fallback:f.jsx(Jy,{}),children:f.jsx(Ig,{context:{openNav:()=>a(!0)}})})}),f.jsx(Uy,{open:s,onClose:()=>u(!1),onCreated:P=>{r(P),u(!1),h(`/projects/${P.slug}/chat`)}})]})}function Oc({brand:e,className:t=""}){return f.jsx("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accent text-white shadow-sm ${t}`,children:gy(e.logo)?f.jsx("img",{src:e.logo,alt:"",className:"h-full w-full object-cover"}):e.logo})}function Jy(){return f.jsxs("div",{className:"flex h-full items-center justify-center","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-paddock-300 border-t-accent dark:border-paddock-700 dark:border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Loading…"})]})}function Yy({project:e,badge:t}){return f.jsxs(bn,{to:`/projects/${e.slug}`,className:({isActive:n})=>`group mb-0.5 flex flex-col gap-1 rounded-lg px-2.5 py-2 text-sm transition-colors ${n?"bg-paddock-200/80 dark:bg-paddock-800":"hover:bg-paddock-200/50 dark:hover:bg-paddock-800/50"}`,children:[f.jsxs("span",{className:"flex items-center justify-between gap-2",children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(Ty,{width:13,height:13,className:"shrink-0 text-paddock-400 group-hover:text-paddock-500"}),f.jsx("span",{className:"truncate font-medium",children:e.name})]}),f.jsx(Eh,{badge:t})]}),e.domain.length>0&&f.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden pl-[18px]",children:[e.domain.slice(0,2).map(n=>f.jsx(Ny,{tag:n,className:"max-w-[7rem] truncate"},n)),e.domain.length>2&&f.jsxs("span",{className:"shrink-0 text-[11px] text-paddock-400",children:["+",e.domain.length-2]})]})]})}function Eh({badge:e,className:t=""}){const n=(e==null?void 0:e.unread)??0,r=(e==null?void 0:e.inflight)??0;return n===0&&r===0?null:f.jsxs("span",{className:`flex shrink-0 items-center gap-1.5 ${t}`,children:[r>0&&f.jsxs("span",{className:"flex items-center gap-1 text-[11px] tabular-nums text-paddock-500 dark:text-paddock-400",title:`${r} chat${r===1?"":"s"} in flight`,"aria-label":`${r} chat${r===1?"":"s"} in flight`,children:[f.jsx("span",{"aria-hidden":"true",className:"h-2.5 w-2.5 spin-eco rounded-full border-[1.5px] border-paddock-400 border-t-transparent dark:border-paddock-500 dark:border-t-transparent"}),r]}),n>0&&f.jsx("span",{className:"inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-accent px-1.5 py-0.5 text-[11px] font-semibold leading-none tabular-nums text-white",title:`${n} unread ${n===1?"reply":"replies"}`,"aria-label":`${n} unread ${n===1?"reply":"replies"}`,children:n})]})}const Ch="paddock:chunkReloadAt",Gy=1e4,Ic=/dynamically imported module|module script|importing a module|failed to fetch|unable to preload|load failed|error loading/i;function Xy(e){return e?e instanceof Error?e.name==="ChunkLoadError"?!0:Ic.test(e.message):Ic.test(String(e)):!1}function Vs(){try{return typeof sessionStorage<"u"?sessionStorage:void 0}catch{return}}function Zy(e=Date.now(),t=Vs()){if(!t)return!1;const n=t.getItem(Ch);if(!n)return!1;const r=Number(n);return Number.isFinite(r)&&e-r<Gy}function qy(e=Date.now(),t=Vs()){try{t==null||t.setItem(Ch,String(e))}catch{}}function e0(e,t=Date.now(),n=Vs()){return Xy(e)&&!Zy(t,n)?"reload":"show"}function t0(){const e=hh(),t=e0(e);if(C.useEffect(()=>{t==="reload"&&(qy(),window.location.reload())},[t]),t==="reload")return f.jsxs("div",{className:"flex h-[100dvh] items-center justify-center bg-canvas dark:bg-canvas-dark","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-paddock-300 border-t-accent dark:border-paddock-700 dark:border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Updating…"})]});const n=e instanceof Error?e.message:typeof e=="string"?e:"";return f.jsxs("div",{className:"flex h-[100dvh] flex-col items-center justify-center gap-4 bg-canvas px-6 text-center dark:bg-canvas-dark",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Something went wrong"}),f.jsx("p",{className:"mt-1 max-w-md text-sm text-paddock-500 dark:text-paddock-400",children:"The app hit an unexpected error. Reloading usually fixes it."}),n?f.jsx("p",{className:"mt-2 max-w-md break-words font-mono text-[11px] text-paddock-400",children:n}):null]}),f.jsx("button",{className:"btn-primary",onClick:()=>window.location.reload(),children:"Reload"})]})}function n0(){typeof navigator>"u"||!("serviceWorker"in navigator)||window.addEventListener("load",()=>{const e=navigator.serviceWorker,t=!!e.controller;let n=!1;e.addEventListener("controllerchange",()=>{n||!t||(n=!0,window.location.reload())}),e.register("/sw.js").catch(()=>{})})}const jh=C.lazy(()=>Sl(()=>import("./ProjectsGrid-Br-EhLZE.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ProjectsGrid}))),ke=C.lazy(()=>Sl(()=>import("./ProjectView-DHb5vNUp.js").then(e=>e.P),__vite__mapDeps([2,1,3,4])).then(e=>({default:e.ProjectView}))),r0=C.lazy(()=>Sl(()=>import("./ProjectRedirect-1EXdHXmO.js"),__vite__mapDeps([5,4])).then(e=>({default:e.ProjectRedirect}))),l0=C.lazy(()=>Sl(()=>import("./InstanceConfigPage-BgNXqAox.js"),[]).then(e=>({default:e.InstanceConfigPage}))),Ph=()=>document.documentElement.setAttribute("data-tab-hidden",document.hidden?"true":"false");document.addEventListener("visibilitychange",Ph);Ph();function o0(){const{tag:e}=Eg();return f.jsx(jh,{filterTag:e?decodeURIComponent(e):void 0})}const i0=Vg([{path:"/",element:f.jsx(by,{}),errorElement:f.jsx(t0,{}),children:[{index:!0,element:f.jsx(ke,{root:!0})},{path:"projects",element:f.jsx(jh,{})},{path:"tags/:tag",element:f.jsx(o0,{})},{path:"projects/:slug",element:f.jsx(r0,{})},{path:"projects/:slug/home",element:f.jsx(ke,{})},{path:"projects/:slug/chat",element:f.jsx(ke,{})},{path:"projects/:slug/chat/:sessionId",element:f.jsx(ke,{})},{path:"projects/:slug/files",element:f.jsx(ke,{})},{path:"projects/:slug/files/*",element:f.jsx(ke,{})},{path:"projects/:slug/changes",element:f.jsx(ke,{})},{path:"projects/:slug/changes/:file",element:f.jsx(ke,{})},{path:"projects/:slug/history",element:f.jsx(ke,{})},{path:"projects/:slug/settings",element:f.jsx(ke,{})},{path:"projects/:slug/triggers",element:f.jsx(ke,{})},{path:"projects/:slug/hooks",element:f.jsx(ke,{})},{path:"chat",element:f.jsx(ke,{root:!0})},{path:"chat/:sessionId",element:f.jsx(ke,{root:!0})},{path:"files",element:f.jsx(ke,{root:!0})},{path:"files/*",element:f.jsx(ke,{root:!0})},{path:"changes",element:f.jsx(ke,{root:!0})},{path:"changes/:file",element:f.jsx(ke,{root:!0})},{path:"history",element:f.jsx(ke,{root:!0})},{path:"triggers",element:f.jsx(ke,{root:!0})},{path:"settings",element:f.jsx(ke,{root:!0})},{path:"config",element:f.jsx(l0,{})}]}]);Wi.createRoot(document.getElementById("root")).render(f.jsx(Jc.StrictMode,{children:f.jsx(sy,{children:f.jsx(Xg,{router:i0})})}));n0();export{Qy as $,_0 as A,A0 as B,w0 as C,E0 as D,Ty as E,z0 as F,Ds as G,x0 as H,Cy as I,y0 as J,H0 as K,ny as L,My as M,Uy as N,V0 as O,_y as P,U0 as Q,As as R,R0 as S,Ny as T,W0 as U,L0 as V,N0 as W,kh as X,k0 as Y,S0 as Z,Sl as _,si as a,Q0 as a0,B0 as a1,K0 as a2,$0 as a3,b0 as a4,v0 as a5,g0 as a6,Py as a7,jy as a8,vh as a9,Wn as aa,f0 as ab,h0 as ac,Hy as ad,d0 as ae,c0 as af,p0 as ag,J0 as ah,gh as b,M0 as c,m0 as d,yy as e,P0 as f,iy as g,Eg as h,u0 as i,f as j,F0 as k,xl as l,s0 as m,Ly as n,wy as o,Uc as p,D0 as q,C as r,I0 as s,O0 as t,uy as u,a0 as v,j0 as w,C0 as x,T0 as y,Iy as z};
70
+ */function Er(){return Er=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Er.apply(this,arguments)}function ph(e,t){if(e==null)return{};var n={},r=Object.keys(e),l,o;for(o=0;o<r.length;o++)l=r[o],!(t.indexOf(l)>=0)&&(n[l]=e[l]);return n}function Fg(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $g(e,t){return e.button===0&&(!t||t==="_self")&&!Fg(e)}const Ag=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","unstable_viewTransition"],Bg=["aria-current","caseSensitive","className","end","style","to","unstable_viewTransition","children"],Wg="6";try{window.__reactRouterVersion=Wg}catch{}function Vg(e,t){return Xv({basename:void 0,future:Er({},void 0,{v7_prependBasename:!0}),history:Sv({window:void 0}),hydrationData:Hg(),routes:e,mapRouteProperties:Ug,unstable_dataStrategy:void 0,unstable_patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function Hg(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Er({},t,{errors:Qg(t.errors)})),t}function Qg(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,l]of t)if(l&&l.__type==="RouteErrorResponse")n[r]=new Bo(l.status,l.statusText,l.data,l.internal===!0);else if(l&&l.__type==="Error"){if(l.__subType){let o=window[l.__subType];if(typeof o=="function")try{let i=new o(l.message);i.stack="",n[r]=i}catch{}}if(n[r]==null){let o=new Error(l.message);o.stack="",n[r]=o}}else n[r]=l;return n}const mh=C.createContext({isTransitioning:!1}),Kg=C.createContext(new Map),bg="startTransition",_c=sp[bg],Jg="flushSync",Rc=xv[Jg];function Yg(e){_c?_c(e):e()}function Ar(e){Rc?Rc(e):e()}class Gg{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function Xg(e){let{fallbackElement:t,router:n,future:r}=e,[l,o]=C.useState(n.state),[i,a]=C.useState(),[s,u]=C.useState({isTransitioning:!1}),[h,c]=C.useState(),[p,S]=C.useState(),[k,E]=C.useState(),R=C.useRef(new Map),{v7_startTransition:m}=r||{},d=C.useCallback(y=>{m?Yg(y):y()},[m]),g=C.useCallback((y,F)=>{let{deletedFetchers:I,unstable_flushSync:Q,unstable_viewTransitionOpts:te}=F;I.forEach(se=>R.current.delete(se)),y.fetchers.forEach((se,et)=>{se.data!==void 0&&R.current.set(et,se.data)});let pe=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!te||pe){Q?Ar(()=>o(y)):d(()=>o(y));return}if(Q){Ar(()=>{p&&(h&&h.resolve(),p.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:te.currentLocation,nextLocation:te.nextLocation})});let se=n.window.document.startViewTransition(()=>{Ar(()=>o(y))});se.finished.finally(()=>{Ar(()=>{c(void 0),S(void 0),a(void 0),u({isTransitioning:!1})})}),Ar(()=>S(se));return}p?(h&&h.resolve(),p.skipTransition(),E({state:y,currentLocation:te.currentLocation,nextLocation:te.nextLocation})):(a(y),u({isTransitioning:!0,flushSync:!1,currentLocation:te.currentLocation,nextLocation:te.nextLocation}))},[n.window,p,h,R,d]);C.useLayoutEffect(()=>n.subscribe(g),[n,g]),C.useEffect(()=>{s.isTransitioning&&!s.flushSync&&c(new Gg)},[s]),C.useEffect(()=>{if(h&&i&&n.window){let y=i,F=h.promise,I=n.window.document.startViewTransition(async()=>{d(()=>o(y)),await F});I.finished.finally(()=>{c(void 0),S(void 0),a(void 0),u({isTransitioning:!1})}),S(I)}},[d,i,h,n.window]),C.useEffect(()=>{h&&i&&l.location.key===i.location.key&&h.resolve()},[h,p,l.location,i]),C.useEffect(()=>{!s.isTransitioning&&k&&(a(k.state),u({isTransitioning:!0,flushSync:!1,currentLocation:k.currentLocation,nextLocation:k.nextLocation}),E(void 0))},[s.isTransitioning,k]),C.useEffect(()=>{},[]);let x=C.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:y=>n.navigate(y),push:(y,F,I)=>n.navigate(y,{state:F,preventScrollReset:I==null?void 0:I.preventScrollReset}),replace:(y,F,I)=>n.navigate(y,{replace:!0,state:F,preventScrollReset:I==null?void 0:I.preventScrollReset})}),[n]),P=n.basename||"/",T=C.useMemo(()=>({router:n,navigator:x,static:!1,basename:P}),[n,x,P]),L=C.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return C.createElement(C.Fragment,null,C.createElement(Nl.Provider,{value:T},C.createElement(Us.Provider,{value:l},C.createElement(Kg.Provider,{value:R.current},C.createElement(mh.Provider,{value:s},C.createElement(zg,{basename:P,location:l.location,navigationType:l.historyAction,navigator:x,future:L},l.initialized||n.future.v7_partialHydration?C.createElement(Zg,{routes:n.routes,future:n.future,state:l}):t))))),null)}const Zg=C.memo(qg);function qg(e){let{routes:t,future:n,state:r}=e;return Cg(t,void 0,r,n)}const ey=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ty=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ny=C.forwardRef(function(t,n){let{onClick:r,relative:l,reloadDocument:o,replace:i,state:a,target:s,to:u,preventScrollReset:h,unstable_viewTransition:c}=t,p=ph(t,Ag),{basename:S}=C.useContext(bt),k,E=!1;if(typeof u=="string"&&ty.test(u)&&(k=u,ey))try{let g=new URL(window.location.href),x=u.startsWith("//")?new URL(g.protocol+u):new URL(u),P=Qt(x.pathname,S);x.origin===g.origin&&P!=null?u=P+x.search+x.hash:E=!0}catch{}let R=xg(u,{relative:l}),m=ly(u,{replace:i,state:a,target:s,preventScrollReset:h,relative:l,unstable_viewTransition:c});function d(g){r&&r(g),g.defaultPrevented||m(g)}return C.createElement("a",Er({},p,{href:k||R,onClick:E||o?r:d,ref:n,target:s}))}),bn=C.forwardRef(function(t,n){let{"aria-current":r="page",caseSensitive:l=!1,className:o="",end:i=!1,style:a,to:s,unstable_viewTransition:u,children:h}=t,c=ph(t,Bg),p=ui(s,{relative:c.relative}),S=Wn(),k=C.useContext(Us),{navigator:E,basename:R}=C.useContext(bt),m=k!=null&&oy(p)&&u===!0,d=E.encodeLocation?E.encodeLocation(p).pathname:p.pathname,g=S.pathname,x=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;l||(g=g.toLowerCase(),x=x?x.toLowerCase():null,d=d.toLowerCase()),x&&R&&(x=Qt(x,R)||x);const P=d!=="/"&&d.endsWith("/")?d.length-1:d.length;let T=g===d||!i&&g.startsWith(d)&&g.charAt(P)==="/",L=x!=null&&(x===d||!i&&x.startsWith(d)&&x.charAt(d.length)==="/"),y={isActive:T,isPending:L,isTransitioning:m},F=T?r:void 0,I;typeof o=="function"?I=o(y):I=[o,T?"active":null,L?"pending":null,m?"transitioning":null].filter(Boolean).join(" ");let Q=typeof a=="function"?a(y):a;return C.createElement(ny,Er({},c,{"aria-current":F,className:I,ref:n,style:Q,to:s,unstable_viewTransition:u}),typeof h=="function"?h(y):h)});var Ua;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Ua||(Ua={}));var Tc;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Tc||(Tc={}));function ry(e){let t=C.useContext(Nl);return t||Y(!1),t}function ly(e,t){let{target:n,replace:r,state:l,preventScrollReset:o,relative:i,unstable_viewTransition:a}=t===void 0?{}:t,s=si(),u=Wn(),h=ui(e,{relative:i});return C.useCallback(c=>{if($g(c,n)){c.preventDefault();let p=r!==void 0?r:$n(u)===$n(h);s(e,{replace:p,state:l,preventScrollReset:o,relative:i,unstable_viewTransition:a})}},[u,s,h,r,l,n,e,o,i,a])}function oy(e,t){t===void 0&&(t={});let n=C.useContext(mh);n==null&&Y(!1);let{basename:r}=ry(Ua.useViewTransitionState),l=ui(e,{relative:t.relative});if(!n.isTransitioning)return!1;let o=Qt(n.currentLocation.pathname,r)||n.currentLocation.pathname,i=Qt(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ao(l.pathname,i)!=null||Ao(l.pathname,o)!=null}const vh="";function $s(e){return e===vh}function b(e){return $s(e)?"/api/root":`/api/projects/${encodeURIComponent(e)}`}function c0(e){return $s(e)?"":`/projects/${e}`}function d0(e){return e===""?"/":`${e}/home`}function iy(){return"/projects"}function f0(e,t){const n=e.startsWith(t)?e.slice(t.length):e;return n.startsWith("/files")?"files":n.startsWith("/changes")?"changes":n.startsWith("/history")?"history":n.startsWith("/settings")?"settings":n.startsWith("/triggers")||n.startsWith("/hooks")?"triggers":n.startsWith("/home")?"home":n.startsWith("/chat")?"chat":t===""?"home":"chat"}function h0(e,t){const n=`${t}/files`;if(!e.startsWith(n))return"";const r=e.slice(n.length).replace(/^\//,"");return r?r.split("/").filter(Boolean).map(l=>{try{return decodeURIComponent(l)}catch{return l}}).join("/"):""}function p0(e){if(!e)return"#";const t=e.trim().replace(/\.git$/i,"");if(/^https?:\/\//i.test(t))return t;const n=/^git@([^:]+):(.+)$/.exec(t);if(n)return`https://${n[1]}/${n[2]}`;const r=/^ssh:\/\/git@([^/]+)\/(.+)$/i.exec(t);return r?`https://${r[1]}/${r[2]}`:"#"}const ar="";async function W(e,t){const n=await fetch(`${ar}${e}`,{headers:{"content-type":"application/json",...(t==null?void 0:t.headers)??{}},...t});if(!n.ok){let r=n.statusText;try{const l=await n.json();l.error&&(r=l.error)}catch{}throw new xl(r,n.status)}return await n.json()}async function ay(e,t){const n=await fetch(`${ar}${e}`,t);if(!n.ok){let r=n.statusText;try{const l=JSON.parse(await n.text());l.error&&(r=l.error)}catch{}throw new xl(r,n.status)}return n.text()}class xl extends Error{constructor(t,n){super(t),this.status=n,this.name="ApiError"}}const gh={async me(){return W("/api/me")},async markChatSeen(e,t,n,r){const l=`${b(e)}/chats/${encodeURIComponent(t)}/seen`;await W(l,{method:"POST",body:JSON.stringify({...n!==void 0?{when:n}:{},...r!=null&&r.keepUnread?{keepUnread:!0}:{}})})},async markChatUnread(e,t,n){const r=`${b(e)}/chats/${encodeURIComponent(t)}/unread`;await W(r,{method:"POST",body:JSON.stringify({unread:n})})},async projectRuns(e,t){const n=t!==void 0?`?limit=${encodeURIComponent(t)}`:"";return W(`${b(e)}/runs${n}`)},async markRunsSeen(e,t){await W(`${b(e)}/runs/seen`,{method:"POST",body:JSON.stringify(t!==void 0?{when:t}:{})})},async getModels(){return W("/api/models")},async getInstanceConfig(){return W("/api/instance-config")},async updateInstanceConfig(e){return W("/api/instance-config",{method:"PUT",body:JSON.stringify({patch:e})})},async uploadAttachments(e,t,n){const r=new FormData;for(const o of n)r.append("files",o,o.name);const l=await fetch(`${ar}${b(e)}/chats/${encodeURIComponent(t)}/upload`,{method:"POST",body:r});if(!l.ok){let o=l.statusText;try{const i=await l.json();i.error&&(o=i.error)}catch{}throw new xl(o,l.status)}return await l.json()},async projectCommands(e){const{commands:t}=await W(`${b(e)}/commands`);return t},async listProjects(){const{projects:e,root:t}=await W("/api/projects");return{projects:e,root:t??null}},async getProjectDetail(e){return W(`${b(e)}`)},async attentionChats(e){const t=await W(`${b(e)}/chats/attention`);return{running:t.running??[],unread:t.unread??[]}},async createProject(e){const{project:t}=await W("/api/projects",{method:"POST",body:JSON.stringify(e)});return t},async updateProject(e,t){const{project:n}=await W(`${b(e)}`,{method:"PATCH",body:JSON.stringify(t)});return n},async promoteProject(e,t){const{project:n}=await W(`${b(e)}/promote`,{method:"POST",body:JSON.stringify({repo:t})});return n},async deleteProject(e){await W(`${b(e)}`,{method:"DELETE"})},async deleteProjectChat(e,t){await W(`${b(e)}/chats/${encodeURIComponent(t)}`,{method:"DELETE"})},async renameProjectChat(e,t,n){await W(`${b(e)}/chats/${encodeURIComponent(t)}`,{method:"PATCH",body:JSON.stringify({name:n})})},async archiveProjectChat(e,t,n){await W(`${b(e)}/chats/${encodeURIComponent(t)}/archive`,{method:"POST",body:JSON.stringify({archived:n})})},async starProjectChat(e,t,n){await W(`${b(e)}/chats/${encodeURIComponent(t)}/star`,{method:"POST",body:JSON.stringify({starred:n})})},async archiveProjectChats(e,t,n){await W(`${b(e)}/chats/batch/archive`,{method:"POST",body:JSON.stringify({sessionIds:t,archived:n})})},async markChatsUnread(e,t,n){await W(`${b(e)}/chats/batch/unread`,{method:"POST",body:JSON.stringify({sessionIds:t,unread:n})})},async deleteProjectChats(e,t){const n=await W(`${b(e)}/chats/batch/delete`,{method:"POST",body:JSON.stringify({sessionIds:t})});return{removed:n.removed??[],failed:n.failed??[]}},async detachProjectChat(e,t,n){await W(`${b(e)}/chats/${encodeURIComponent(t)}/detach`,{method:"POST",body:JSON.stringify({detached:n})})},async promoteChat(e,t,n){return W(`${b(e)}/chats/${encodeURIComponent(t)}/promote`,{method:"POST",body:JSON.stringify(n)})},async forkChat(e,t,n,r){const{sessionId:l}=await W(`${b(e)}/chats/${encodeURIComponent(t)}/fork`,{method:"POST",body:JSON.stringify({name:n,fromUuid:r})});return l},async revertChat(e,t,n){const{removed:r}=await W(`${b(e)}/chats/${encodeURIComponent(t)}/revert`,{method:"POST",body:JSON.stringify({uuid:n})});return r},async listProjectDir(e,t=""){const n=t?`?path=${encodeURIComponent(t)}`:"";return W(`${b(e)}/files${n}`)},async listProjectFiles(e){const{entries:t}=await this.listProjectDir(e);return t.filter(n=>n.kind==="file").map(n=>n.name)},async getProjectFile(e,t){return W(`${b(e)}/files/${encodeURIComponent(t)}`)},projectFileRawUrl(e,t){return`${ar}${b(e)}/files/${encodeURIComponent(t)}?raw=1`},chatFileRawUrl(e){return`${ar}/api/chat-files/${encodeURIComponent(e)}`},async pinFile(e,t){const{project:n}=await W(`${b(e)}/pins`,{method:"PUT",body:JSON.stringify({file:t})});return n},async unpinFile(e,t){const{project:n}=await W(`${b(e)}/pins/${encodeURIComponent(t)}`,{method:"DELETE"});return n},async listProjectChats(e){const{chats:t}=await W(`${b(e)}/chats`);return t},async getAdoptableChats(e){return W(`${b(e)}/adoptable-chats`)},async adoptChats(e,t){return W(`${b(e)}/adopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async unadoptChats(e,t){return W(`${b(e)}/unadopt-chats`,{method:"POST",body:JSON.stringify(t??{})})},async chatUsage(e,t){const n=t?`?scope=${t}`:"",{usage:r}=await W(`${b(e)}/chats/usage${n}`);return r},async projectChatMessages(e,t){const{messages:n}=await W(`${b(e)}/chats/${encodeURIComponent(t)}/messages`);return n},async subagentMessages(e,t,n){const r=`${b(e)}/chats/${encodeURIComponent(t)}`,{messages:l}=await W(`${r}/subagents/${encodeURIComponent(n)}/messages`);return l},async chatContext(e,t){const n=`${b(e)}/chats/${encodeURIComponent(t)}/context`,{usage:r}=await W(n);return r},async listTriggers(e){return W(`${b(e)}/triggers`)},async putTrigger(e,t,n){const{trigger:r}=await W(`${b(e)}/triggers/${encodeURIComponent(t)}`,{method:"PUT",body:JSON.stringify(n)});return r},async deleteTrigger(e,t){await W(`${b(e)}/triggers/${encodeURIComponent(t)}`,{method:"DELETE"})},async triggerRuntime(e){return W(`${b(e)}/triggers/runtime`)},async runTrigger(e,t){const{sessionId:n}=await W(`${b(e)}/triggers/${encodeURIComponent(t)}/run`,{method:"POST",body:"{}"});return n},async gitInfo(){return W("/api/git")},async gitStatus(e){return W(`${b(e)}/git/status`)},async gitDiff(e,t){const n=t?`?file=${encodeURIComponent(t)}`:"";return ay(`${b(e)}/git/diff${n}`)},async gitCommit(e,t,n){return W(`${b(e)}/git/commit`,{method:"POST",body:JSON.stringify(n?{message:t,files:n}:{message:t})})},async gitPush(){return W("/api/git/push",{method:"POST"})},async githubConnect(){return W("/api/git/github/connect",{method:"POST"})},async githubPoll(e){return W("/api/git/github/poll",{method:"POST",body:JSON.stringify({deviceCode:e})})},async githubDisconnect(){await W("/api/git/github/disconnect",{method:"POST"})},async transcriptionStatus(){return W("/api/transcription")},async transcribe(e,t="dictation.webm",n){const r=new FormData;r.append("file",e,t);const l=await fetch(`${ar}/api/transcribe`,{method:"POST",body:r,signal:n});if(!l.ok){let i=l.statusText;try{const a=await l.json();a.error&&(i=a.error)}catch{}throw new xl(i,l.status)}const{text:o}=await l.json();return o}},yh=C.createContext(null);function sy({children:e}){const[t,n]=C.useState([]),[r,l]=C.useState(null),[o,i]=C.useState(!0),[a,s]=C.useState(null),u=C.useRef(!1),h=C.useCallback(async()=>{u.current||i(!0),s(null);try{const{projects:k,root:E}=await gh.listProjects();u.current=!0,n(k),E&&l(E)}catch(k){s(k instanceof Error?k.message:"Failed to load projects")}finally{i(!1)}},[]),c=C.useCallback(k=>{if($s(k.slug)){l(k);return}n(E=>[k,...E.filter(R=>R.slug!==k.slug)])},[]),p=C.useCallback(k=>{n(E=>E.filter(R=>R.slug!==k))},[]);C.useEffect(()=>{h()},[h]);const S=C.useMemo(()=>({projects:t,rootWorkspace:r,loading:o,error:a,refresh:h,upsert:c,remove:p}),[t,r,o,a,h,c,p]);return f.jsx(yh.Provider,{value:S,children:e})}function uy(){const e=C.useContext(yh);if(!e)throw new Error("useProjects must be used within ProjectsProvider");return e}const cy="paddock:theme";function dy(){return typeof document<"u"&&document.documentElement.classList.contains("dark")}function fy(){const[e,t]=C.useState(dy),n=C.useCallback(()=>{t(r=>{const l=!r;document.documentElement.classList.toggle("dark",l);try{localStorage.setItem(cy,l?"dark":"light")}catch{}return l})},[]);return{dark:e,toggle:n}}const hy={name:"Paddock",logo:"🐎",accent:"#c2603c"},py={enabled:!1,path:"/open-api"};function my(){const e=globalThis.__PADDOCK_CONFIG__;return{...hy,...(e==null?void 0:e.brand)??{}}}function vy(){const e=globalThis.__PADDOCK_CONFIG__;return{...py,...(e==null?void 0:e.openapi)??{}}}function gy(e){return/^(https?:\/\/|\/)/i.test(e.trim())}const As=[{slug:"homelab",label:"Homelab",blurb:"Servers, networking, self-hosted services."},{slug:"house",label:"House",blurb:"Physical home systems — water, climate, power, garden."},{slug:"side-projects",label:"Side Projects",blurb:"Apps and ideas of your own."}],Lc="",wh=new Map(As.map(e=>[e.slug,e]));function yy(e){if(!e)return"Unsorted";const t=wh.get(e);return t?t.label:e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" ")}function m0(e){var t;return(t=wh.get(e))==null?void 0:t.blurb}function wy(e){const t=new Set(e),n=[];for(const l of As)t.has(l.slug)&&(n.push(l.slug),t.delete(l.slug));const r=t.delete(Lc);return n.push(...[...t].sort()),r&&n.push(Lc),n}const xh=25e3,Sh=1e4,xy=xh+Sh+5e3,Sy=500,ky=1e4;class Ey{constructor(){this.ws=null,this.outbox=[],this.subs=new Map,this.pingTimer=null,this.pongTimer=null,this.awaitingPong=!1,this.lastPongAt=0,this.reconnectTimer=null,this.reconnectAttempts=0,this.manualClose=!1,this.stateListeners=new Set,this._state="closed",this.activeSessions=new Map,this.activeListeners=new Set,this.activeInfoListeners=new Set,this.knownSessions=new Set;const n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;if(this.url=`${n.replace(/^http/,"ws")}/ws`,typeof window<"u"){const r=()=>this.ensureLive();window.addEventListener("online",r),window.addEventListener("focus",r),typeof document<"u"&&document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"&&this.ensureLive()})}}get state(){return this._state}onState(t){return this.stateListeners.add(t),t(this._state),()=>this.stateListeners.delete(t)}setState(t){if(this._state!==t){this._state=t;for(const n of this.stateListeners)n(t)}}onActiveSessions(t){return this.activeListeners.add(t),t(new Set(this.activeSessions.keys())),this.connect(),()=>this.activeListeners.delete(t)}onActiveInfos(t){return this.activeInfoListeners.add(t),t(new Map(this.activeSessions)),this.connect(),()=>this.activeInfoListeners.delete(t)}setActive(t,n,r){const l=this.activeSessions.has(t);if(n?this.activeSessions.set(t,r):this.activeSessions.delete(t),this.activeSessions.has(t)!==l){const o=new Set(this.activeSessions.keys());for(const a of this.activeListeners)a(o);const i=new Map(this.activeSessions);for(const a of this.activeInfoListeners)a(i)}}subscribe(t,n,r){const l=Symbol("chat-sub"),o={projectSlug:t,sessionId:n,handlers:r,lastSeq:-1,turnActive:!1};return this.subs.set(l,o),this.connect(),n&&this.attachSession(o,!1),{setSessionId:i=>{const a=this.subs.get(l);a&&(a.sessionId=i,i&&this.attachSession(a,!1))},unsubscribe:()=>{this.subs.delete(l)}}}attachSession(t,n){t.sessionId&&(this.knownSessions.add(t.sessionId),this.transmit(JSON.stringify({type:"chat:subscribe",payload:{projectSlug:t.projectSlug,sessionId:t.sessionId,wantReplay:n,lastSeq:t.lastSeq}})))}send(t,n,r,l){const o={projectSlug:t,sessionId:r,message:n};l!=null&&l.preloadContext&&(o.preloadContext=!0),l!=null&&l.model&&(o.model=l.model),l!=null&&l.attachments&&l.attachments.length>0&&(o.attachments=l.attachments),this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:send",payload:o}))}setQueued(t,n,r,l){const o={projectSlug:t,sessionId:n,text:r,ts:l};this.transmit(JSON.stringify({type:"chat:set_queue",payload:o}))}markTurnStart(t,n){for(const r of this.subs.values())r.projectSlug===t&&r.sessionId===n&&(r.lastSeq=-1,r.turnActive=!0)}sendCommand(t,n,r){this.markTurnStart(t,r),this.transmit(JSON.stringify({type:"chat:command",payload:{projectSlug:t,sessionId:r,command:n}}))}cancel(t){this.transmit(JSON.stringify({type:"chat:cancel",payload:{jobId:t}}))}continueChat(t,n){this.markTurnStart(t,n),this.transmit(JSON.stringify({type:"chat:continue",payload:{projectSlug:t,sessionId:n}}))}transmit(t){this.isLive()?this.ws.send(t):(this.outbox.push(t),this.ensureLive())}isLive(){var t;return((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN?!1:Date.now()-this.lastPongAt<xy}wantsSocket(){return this.subs.size>0||this.activeListeners.size>0||this.activeInfoListeners.size>0}ensureLive(){var n;if(!this.wantsSocket())return;const t=(n=this.ws)==null?void 0:n.readyState;t===WebSocket.OPEN?this.sendPing():t!==WebSocket.CONNECTING&&(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.reconnectAttempts=0,this.connect())}flushOutbox(){var n;if(((n=this.ws)==null?void 0:n.readyState)!==WebSocket.OPEN||this.outbox.length===0)return;const t=this.outbox;this.outbox=[];for(const r of t)this.ws.send(r)}connect(){if(this.manualClose=!1,this.ws&&(this.ws.readyState===WebSocket.OPEN||this.ws.readyState===WebSocket.CONNECTING))return;this.setState("connecting");let t;try{t=new WebSocket(this.url)}catch{this.scheduleReconnect();return}this.ws=t,t.onopen=()=>{this.reconnectAttempts=0,this.awaitingPong=!1,this.lastPongAt=Date.now(),this.setState("open"),this.flushOutbox();for(const n of this.subs.values())n.sessionId&&this.attachSession(n,n.turnActive);this.startPing()},t.onclose=()=>{this.stopPing(),this.setState("closed"),this.manualClose||this.scheduleReconnect()},t.onerror=()=>{t.close()},t.onmessage=n=>this.dispatch(n.data)}startPing(){this.stopPing(),this.pingTimer=setInterval(()=>this.sendPing(),xh)}sendPing(){var t;if(!(((t=this.ws)==null?void 0:t.readyState)!==WebSocket.OPEN||this.awaitingPong)){this.awaitingPong=!0;try{this.ws.send(JSON.stringify({type:"ping"}))}catch{this.awaitingPong=!1,this.ws.close();return}this.pongTimer=setTimeout(()=>{var n;this.pongTimer=null,this.awaitingPong&&((n=this.ws)==null||n.close())},Sh)}}stopPing(){this.pingTimer&&clearInterval(this.pingTimer),this.pingTimer=null,this.pongTimer&&clearTimeout(this.pongTimer),this.pongTimer=null,this.awaitingPong=!1}scheduleReconnect(){if(this.reconnectTimer)return;const t=Math.min(ky,Sy*2**this.reconnectAttempts);this.reconnectAttempts+=1,this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},t)}route(t,n){const r=[...this.subs.values()].filter(o=>o.projectSlug===t);if(r.length===0)return;if(n){const o=r.find(i=>i.sessionId===n);if(o)return o;if(this.knownSessions.has(n))return}const l=r.find(o=>o.sessionId===null);if(l)return l;if(n===null&&r.length===1)return r[0]}dispatch(t){var u,h,c,p,S,k,E,R,m,d,g,x,P,T,L,y,F,I,Q,te,pe,se,et,Ke;let n;try{n=JSON.parse(t)}catch{return}if(n.type==="pong"){this.awaitingPong=!1,this.pongTimer&&(clearTimeout(this.pongTimer),this.pongTimer=null),this.lastPongAt=Date.now(),this.flushOutbox();return}const r=n.payload.projectSlug;if(r==null)return;if(n.type==="chat:error"){const le=this.route(r,null);(h=le==null?void 0:(u=le.handlers).onError)==null||h.call(u,n.payload.error);return}if(n.type==="chat:resync"){const le=this.route(r,n.payload.sessionId);(p=le==null?void 0:(c=le.handlers).onResync)==null||p.call(c);return}if(n.type==="chat:active"){this.setActive(n.payload.sessionId,n.payload.running,r);for(const le of this.subs.values())le.projectSlug===r&&le.sessionId===n.payload.sessionId&&((k=(S=le.handlers).onActive)==null||k.call(S,{running:n.payload.running,jobId:n.payload.jobId}));return}if(n.type==="chat:queued_flushed"){const{sessionId:le,text:D}=n.payload;if(le){Sl(async()=>{const{writeQueued:O,writeQueuedTs:V}=await import("./queued-LamEU0GH.js");return{writeQueued:O,writeQueuedTs:V}},[]).then(({writeQueued:O,writeQueuedTs:V})=>{O(le,r,null),V(le,r,null)});for(const O of this.subs.values())O.projectSlug===r&&O.sessionId===le&&((R=(E=O.handlers).onQueuedFlushed)==null||R.call(E,{text:D}))}return}if(n.type==="chat:killed_task"){const{sessionId:le,summary:D,timestamp:O}=n.payload;if(le)for(const V of this.subs.values())V.projectSlug===r&&V.sessionId===le&&((d=(m=V.handlers).onKilledTask)==null||d.call(m,{summary:D??"",timestamp:O??""}));return}const{sessionId:l,jobId:o}=n.payload,i=this.route(r,l);if(!i)return;const a={sessionId:l,jobId:o},s=n.payload.seq;switch(typeof s=="number"&&s>i.lastSeq&&(i.lastSeq=s),i.turnActive=n.type!=="chat:complete",n.type){case"chat:response":(x=(g=i.handlers).onResponse)==null||x.call(g,n.payload.chunk,a);break;case"chat:tool_call":(T=(P=i.handlers).onToolCall)==null||T.call(P,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,output:n.payload.output,isError:n.payload.isError,durationMs:n.payload.durationMs,toolUseId:n.payload.toolUseId,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:tool_start":(y=(L=i.handlers).onToolStart)==null||y.call(L,{toolName:n.payload.toolName,inputSummary:n.payload.inputSummary,toolUseId:n.payload.toolUseId,output:"",isError:!1,pending:!0,subagentType:n.payload.subagentType,description:n.payload.description,hasSubagent:n.payload.hasSubagent},a);break;case"chat:message_boundary":(I=(F=i.handlers).onMessageBoundary)==null||I.call(F,a);break;case"chat:injected":(te=(Q=i.handlers).onInjected)==null||te.call(Q,{sender:n.payload.sender,content:n.payload.content,timestamp:n.payload.timestamp},a);break;case"chat:notice":(se=(pe=i.handlers).onNotice)==null||se.call(pe,n.payload.notice,a);break;case"chat:complete":(Ke=(et=i.handlers).onComplete)==null||Ke.call(et,{...a,success:n.payload.success,error:n.payload.error,model:n.payload.model,usage:n.payload.usage});break}}}const Cy=new Ey,mn=new Map,Fa="paddock:lastSeen-changed";function Bs(e){try{window.dispatchEvent(new CustomEvent(Fa,{detail:{sessionId:e}}))}catch{}}function jy(e){return mn.get(e)??0}function Py(e,t){!t||!Number.isFinite(t)||t<=(mn.get(e)??0)||(mn.set(e,t),Bs(e))}function v0(e,t=Date.now()){const n=mn.get(e)??0;return t<=n||(mn.set(e,t),Bs(e)),n}function g0(e,t,n){mn.get(e)===n&&(t?mn.set(e,t):mn.delete(e),Bs(e))}function Ny({tag:e,className:t=""}){const n=si();return f.jsx("button",{type:"button",onClick:r=>{r.preventDefault(),r.stopPropagation(),n(`/tags/${encodeURIComponent(e)}`)},title:`Show projects tagged ${e}`,className:`tag relative z-10 transition-colors hover:bg-paddock-300/70 dark:hover:bg-paddock-700 ${t}`,children:e})}function G(e){return{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",...e}}const _y=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M12 5v14M5 12h14"})}),y0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"})}),Ry=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M3 10.5 12 3l9 7.5"}),f.jsx("path",{d:"M5 9.5V20a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9.5"})]}),w0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),x0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"11",cy:"11",r:"7"}),f.jsx("path",{d:"m21 21-4.3-4.3"})]}),S0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M4 5h16"}),f.jsx("path",{d:"M8 5v6h12"}),f.jsx("path",{d:"M8 11v6h12"})]}),k0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M4 6h16M4 12h16M4 18h16"})}),Ty=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z"})}),E0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"m22 2-7 20-4-9-9-4Z"}),f.jsx("path",{d:"M22 2 11 13"})]}),C0=e=>f.jsx("svg",{...G(e),children:f.jsx("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),j0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),f.jsx("path",{d:"M5 10a7 7 0 0 0 14 0"}),f.jsx("path",{d:"M12 17v4M8 21h8"})]}),P0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"m9 18 6-6-6-6"})}),N0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2-2 2.6-2.6Z"})}),Ly=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"3"}),f.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09a1.65 1.65 0 0 0-1-1.51 1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09a1.65 1.65 0 0 0 1.51-1 1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"})]}),_0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z"}),f.jsx("path",{d:"M12 9v4M12 17h.01"})]}),R0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M12 3v4M12 17v4M3 12h4M17 12h4M5.6 5.6l2.8 2.8M15.6 15.6l2.8 2.8M5.6 18.4l2.8-2.8M15.6 8.4l2.8-2.8"})}),kh=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M18 6 6 18M6 6l12 12"})}),T0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M13 2 4.5 13.5H11l-1 8.5 8.5-11.5H12z"})}),L0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M6 4.5v15l13-7.5z"})}),My=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M3 6h18M3 12h18M3 18h18"})}),M0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"9"}),f.jsx("path",{d:"M12 7v5l3 2"})]}),D0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"12",cy:"5",r:"1"}),f.jsx("circle",{cx:"12",cy:"12",r:"1"}),f.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),O0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M10 11v6M14 11v6"})}),I0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M12 20h9"}),f.jsx("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),z0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),f.jsx("path",{d:"M14 2v6h6"})]}),U0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M12 17v5"}),f.jsx("path",{d:"M9 10.76V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v6.76a2 2 0 0 0 .59 1.42l1.12 1.12A1 1 0 0 1 17 15H7a1 1 0 0 1-.71-1.7l1.12-1.12A2 2 0 0 0 9 10.76Z"})]}),F0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M20 6 9 17l-5-5"})}),$0=({open:e,...t})=>e?f.jsxs("svg",{...G(t),children:[f.jsx("path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z"}),f.jsx("path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"})]}):f.jsxs("svg",{...G(t),children:[f.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),f.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),A0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"6",cy:"6",r:"3"}),f.jsx("circle",{cx:"6",cy:"18",r:"3"}),f.jsx("circle",{cx:"18",cy:"6",r:"3"}),f.jsx("path",{d:"M6 9v6M18 9a9 9 0 0 1-9 9"})]}),B0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M9.5 14.5l-1.7 1.7a4 4 0 0 1-5.66-5.66l1.7-1.7"}),f.jsx("path",{d:"M14.5 9.5l1.7-1.7a4 4 0 0 1 5.66 5.66l-1.7 1.7"}),f.jsx("path",{d:"M8 3.5v2M3.5 8h2M16 20.5v-2M20.5 16h-2"})]}),W0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),f.jsx("path",{d:"M17 8l-5-5-5 5M12 3v12"})]}),V0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M4 17l6-5-6-5M12 19h8"})}),H0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.9a3.4 3.4 0 0 0-1-2.6c3-.3 6.2-1.5 6.2-6.6a5.2 5.2 0 0 0-1.4-3.6 4.8 4.8 0 0 0-.1-3.6s-1.1-.3-3.7 1.4a12.6 12.6 0 0 0-6.6 0C6.5 1.3 5.4 1.6 5.4 1.6a4.8 4.8 0 0 0-.1 3.6 5.2 5.2 0 0 0-1.4 3.6c0 5.1 3.2 6.3 6.2 6.6a3.4 3.4 0 0 0-1 2.6V22"})}),Dy=e=>f.jsxs("svg",{...G(e),children:[f.jsx("circle",{cx:"12",cy:"12",r:"4"}),f.jsx("path",{d:"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4"})]}),Oy=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})}),Iy=e=>f.jsxs("svg",{...G(e),children:[f.jsx("path",{d:"M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.5 1.5"}),f.jsx("path",{d:"M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.5-1.5"})]}),Q0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"m6 9 6 6 6-6"})}),K0=e=>f.jsxs("svg",{...G(e),children:[f.jsx("rect",{x:"3",y:"4",width:"18",height:"4",rx:"1"}),f.jsx("path",{d:"M5 8v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V8"}),f.jsx("path",{d:"M10 12h4"})]}),b0=e=>f.jsx("svg",{...G(e),children:f.jsx("path",{d:"M12 2.5l2.9 5.88 6.49.94-4.7 4.58 1.11 6.46L12 17.8l-5.8 3.05 1.11-6.46-4.7-4.58 6.49-.94z"})}),zy=["idea","active","paused","blocked","done"];function Uy({open:e,onClose:t,onCreated:n}){const[r,l]=C.useState(""),[o,i]=C.useState(""),[a,s]=C.useState(""),[u,h]=C.useState(""),[c,p]=C.useState("active"),[S,k]=C.useState(""),[E,R]=C.useState(!1),[m,d]=C.useState(null);if(C.useEffect(()=>{e&&(l(""),i(""),s(""),h(""),p("active"),k(""),d(null))},[e]),C.useEffect(()=>{const x=P=>{P.key==="Escape"&&e&&!E&&t()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[e,E,t]),!e)return null;const g=async x=>{if(x.preventDefault(),!!r.trim()){R(!0),d(null);try{const P=await gh.createProject({name:r.trim(),status:c,group:u||void 0,summary:o.trim()||void 0,repo:S.trim()||void 0,domain:a.split(",").map(T=>T.trim()).filter(Boolean)});n(P)}catch(P){d(P instanceof xl?P.message:"Failed to create project")}finally{R(!1)}}};return f.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4 backdrop-blur-sm",onClick:()=>!E&&t(),children:f.jsxs("form",{className:"w-full max-w-md animate-scale-in rounded-2xl border border-paddock-200 bg-white p-6 shadow-2xl dark:border-paddock-800 dark:bg-paddock-900",onClick:x=>x.stopPropagation(),onSubmit:g,children:[f.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[f.jsx("h2",{className:"text-lg font-semibold",children:"New project"}),f.jsx("button",{type:"button",onClick:t,className:"rounded-lg p-1 text-paddock-400 hover:bg-paddock-100 hover:text-paddock-600 dark:hover:bg-paddock-800","aria-label":"Close",children:f.jsx(kh,{width:18,height:18})})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Name"}),f.jsx("input",{autoFocus:!0,className:"input",value:r,onChange:x=>l(x.target.value),placeholder:"Garage Water Heater Replacement"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Summary (optional)"}),f.jsx("input",{className:"input",value:o,onChange:x=>i(x.target.value),placeholder:"One line on what this project is about"})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Area"}),f.jsxs("select",{className:"input",value:u,onChange:x=>h(x.target.value),children:[f.jsx("option",{value:"",children:"Unsorted"}),As.map(x=>f.jsx("option",{value:x.slug,children:x.label},x.slug))]})]}),f.jsxs("label",{className:"mb-4 block",children:[f.jsx("span",{className:"field-label",children:"Git repository URL (optional)"}),f.jsx("input",{className:"input",value:S,onChange:x=>k(x.target.value),placeholder:"https://github.com/owner/repo.git"}),f.jsx("span",{className:"mt-1 block text-xs text-paddock-400 dark:text-paddock-500",children:"Link an external repo and Paddock clones it as the project's working directory — the repo's own CLAUDE.md, branches & PR flow apply. Leave blank for a notebook project."})]}),f.jsxs("div",{className:"mb-5 grid grid-cols-2 gap-3",children:[f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Domain tags"}),f.jsx("input",{className:"input",value:a,onChange:x=>s(x.target.value),placeholder:"home, plumbing"})]}),f.jsxs("label",{className:"block",children:[f.jsx("span",{className:"field-label",children:"Status"}),f.jsx("select",{className:"input capitalize",value:c,onChange:x=>p(x.target.value),children:zy.map(x=>f.jsx("option",{value:x,className:"capitalize",children:x},x))})]})]}),m&&f.jsx("p",{className:"mb-4 rounded-lg bg-rose-50 px-3 py-2 text-sm text-rose-600 dark:bg-rose-950/40 dark:text-rose-300",children:m}),f.jsxs("div",{className:"flex justify-end gap-2",children:[f.jsx("button",{type:"button",className:"btn-ghost",onClick:t,disabled:E,children:"Cancel"}),f.jsx("button",{type:"submit",className:"btn-primary",disabled:E||!r.trim(),children:E?"Creating…":"Create project"})]})]})})}function Mc(e){if(typeof window>"u"||typeof window.matchMedia!="function")return null;try{return window.matchMedia(e)??null}catch{return null}}function Fy(e){const[t,n]=C.useState(()=>{var r;return((r=Mc(e))==null?void 0:r.matches)??!1});return C.useEffect(()=>{var o;const r=Mc(e);if(!r)return;const l=()=>n(!!r.matches);return l(),typeof r.addEventListener=="function"?(r.addEventListener("change",l),()=>r.removeEventListener("change",l)):((o=r.addListener)==null||o.call(r,l),()=>{var i;return(i=r.removeListener)==null?void 0:i.call(r,l)})},[e]),t}const Ws="paddock:panewidth:",$y={key:"sidenav",def:288,min:200,max:480},J0={key:"chatlist",def:256,min:220,max:520},Ay="(min-width: 1024px)";function pr(e,t){return Math.min(Math.max(t,e.min),e.max)}function Dc(e,t,n){return pr(n,e+t)}function By(e){try{const t=localStorage.getItem(Ws+e.key);if(t==null)return null;const n=Number.parseFloat(t);return Number.isFinite(n)?pr(e,n):null}catch{return null}}function Wy(e,t){try{localStorage.setItem(Ws+e.key,String(pr(e,t)))}catch{}}function Vy(e){try{localStorage.removeItem(Ws+e.key)}catch{}}function Hy(e){const t=Fy(Ay),[n,r]=C.useState(()=>By(e)),l=pr(e,n??e.def);return{isDesktop:t,width:l,style:t?{width:l}:void 0,preview:o=>r(pr(e,o)),commit:o=>{const i=pr(e,o);r(i),Wy(e,i)},reset:()=>{r(null),Vy(e)},spec:e}}function Qy({spec:e,width:t,onPreview:n,onCommit:r,onReset:l,label:o}){const i=C.useRef(null),a=C.useRef(t);a.current=t;const s=16;return f.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":o,"aria-valuenow":Math.round(t),"aria-valuemin":e.min,"aria-valuemax":e.max,tabIndex:0,onPointerDown:u=>{i.current={startX:u.clientX,startWidth:t},u.currentTarget.setPointerCapture(u.pointerId)},onPointerMove:u=>{i.current&&n(Dc(i.current.startWidth,u.clientX-i.current.startX,e))},onPointerUp:u=>{if(i.current){i.current=null;try{u.currentTarget.releasePointerCapture(u.pointerId)}catch{}r(a.current)}},onDoubleClick:l,onKeyDown:u=>{if(u.key==="ArrowLeft"||u.key==="ArrowRight"){u.preventDefault();const h=Dc(t,u.key==="ArrowRight"?s:-s,e);n(h),r(h)}},title:"Drag to resize · double-click to reset",className:"group/resizer absolute inset-y-0 right-0 z-10 hidden w-1.5 -mr-0.5 cursor-ew-resize touch-none lg:block",children:f.jsx("span",{className:"absolute inset-y-0 right-0 w-px bg-paddock-200 transition group-hover/resizer:w-0.5 group-hover/resizer:bg-accent group-focus/resizer:w-0.5 group-focus/resizer:bg-accent dark:bg-paddock-800"})})}function Ky(e){const[t,n]=C.useState(new Map),r=C.useRef(new Map),[l,o]=C.useState(0);return C.useEffect(()=>{const i=r.current;for(const a of e)for(const s of a.chatTurns??[]){Py(s.sessionId,s.lastSeen);const u=Date.parse(s.lastTurnCompletedAt);if(!Number.isFinite(u))continue;const h=i.get(s.sessionId);!h||u>h.at?i.set(s.sessionId,{slug:a.slug,at:u,unread:s.unread}):h.unread=s.unread}o(a=>a+1)},[e]),C.useEffect(()=>{const i=new Map;return Cy.onActiveInfos(a=>{for(const[s,u]of i)a.has(s)||r.current.set(s,{slug:u,at:Date.now()});i.clear();for(const[s,u]of a)i.set(s,u);n(new Map(a)),o(s=>s+1)})},[]),C.useEffect(()=>{const i=()=>o(a=>a+1);return window.addEventListener(Fa,i),()=>window.removeEventListener(Fa,i)},[]),C.useMemo(()=>{const i=new Map,a=s=>{let u=i.get(s);return u||(u={unread:0,inflight:0},i.set(s,u)),u};for(const[s,{slug:u,at:h,unread:c}]of r.current)!t.has(s)&&(c||h>jy(s))&&(a(u).unread+=1);for(const s of t.values())a(s).inflight+=1;return i},[t,l])}function by(){const{projects:e,rootWorkspace:t,loading:n,upsert:r}=uy(),{dark:l,toggle:o}=fy(),[i,a]=C.useState(!1),[s,u]=C.useState(!1),h=si(),c=Wn(),p=my(),S=vy(),k=Hy($y),E=c.pathname==="/"||c.pathname==="/projects"||c.pathname.startsWith("/chat"),R=c.pathname.startsWith("/projects/")||E;C.useEffect(()=>{a(!1)},[c.pathname]),C.useEffect(()=>{document.title=p.name},[p.name]);const m=C.useMemo(()=>{const P=new Map;for(const T of e){const L=T.group??"",y=P.get(L);y?y.push(T):P.set(L,[T])}return wy(P.keys()).map(T=>[T,P.get(T)??[]])},[e]),d=C.useMemo(()=>t?[...e,t]:e,[e,t]),g=Ky(d),x=g.get(vh);return f.jsxs("div",{className:"flex h-[100dvh] flex-col overflow-hidden bg-canvas dark:bg-canvas-dark lg:flex-row",children:[!R&&f.jsxs("header",{className:"pt-safe flex items-center gap-2 border-b border-paddock-200 px-3 pb-2 dark:border-paddock-800 lg:hidden",children:[f.jsx("button",{type:"button",onClick:()=>a(!0),"aria-label":"Open menu",className:"btn-subtle -ml-1 px-2 py-2",children:f.jsx(My,{width:20,height:20})}),f.jsxs(bn,{to:"/",className:"flex items-center gap-2",children:[f.jsx(Oc,{brand:p,className:"h-7 w-7 text-sm"}),f.jsx("span",{className:"text-[15px] font-semibold tracking-tight",children:p.name})]})]}),i&&f.jsx("div",{className:"fixed inset-0 z-30 bg-black/40 backdrop-blur-sm lg:hidden","aria-hidden":"true",onClick:()=>a(!1)}),f.jsxs("aside",{style:k.style,className:`fixed inset-y-0 left-0 z-40 flex w-72 max-w-[85%] shrink-0 flex-col border-r border-paddock-200 bg-canvas shadow-2xl transition-transform duration-200 ease-out dark:border-paddock-800 dark:bg-paddock-900 lg:relative lg:z-auto lg:max-w-none lg:translate-x-0 lg:bg-white/50 lg:shadow-none dark:lg:bg-paddock-900/30 ${i?"translate-x-0":"-translate-x-full"}`,children:[k.isDesktop&&f.jsx(Qy,{spec:k.spec,width:k.width,onPreview:k.preview,onCommit:k.commit,onReset:k.reset,label:"Resize sidebar"}),f.jsxs("div",{className:"flex items-center gap-2 px-5 py-4",children:[f.jsxs(bn,{to:"/",className:"group flex items-center gap-2",children:[f.jsx(Oc,{brand:p,className:"h-8 w-8 text-base"}),f.jsx("span",{className:"text-[17px] font-semibold tracking-tight",children:p.name})]}),f.jsx("button",{type:"button",onClick:()=>a(!1),"aria-label":"Close menu",className:"btn-subtle ml-auto px-2 py-2 lg:hidden",children:f.jsx(kh,{width:18,height:18})})]}),f.jsx("div",{className:"px-3 pb-1",children:f.jsxs(bn,{to:"/",end:!0,className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-paddock-200/80 dark:bg-paddock-800":""}`,title:"The root workspace — every project, and the instance's own chats",children:[f.jsx(Ry,{width:16,height:16}),"Home",f.jsx(Eh,{badge:x,className:"ml-auto"})]})}),f.jsxs("div",{className:"mt-5 mb-1 flex items-center justify-between pr-3",children:[f.jsx(bn,{to:iy(),className:"section-label hover:text-accent",children:"Projects"}),f.jsx("button",{type:"button",onClick:()=>u(!0),"aria-label":"New Project",title:"New Project",className:"btn-subtle -mr-1 px-1.5 py-1 text-paddock-400 hover:text-accent",children:f.jsx(_y,{width:14,height:14})})]}),f.jsxs("nav",{className:"flex-1 overflow-y-auto px-2 pb-4",children:[n&&f.jsx("div",{className:"space-y-2 px-2 py-2",children:[0,1,2].map(P=>f.jsx("div",{className:"h-10 animate-pulse rounded-lg bg-paddock-200/60 dark:bg-paddock-800/50"},P))}),!n&&e.length===0&&f.jsx("p",{className:"px-3 py-2 text-sm text-paddock-500",children:"No projects yet."}),!n&&e.length>0&&m.map(([P,T])=>f.jsxs("div",{className:"mb-2",children:[m.length>1&&f.jsx("div",{className:"px-2.5 pb-1 pt-2 text-[10px] font-semibold uppercase tracking-wider text-paddock-400",children:yy(P)}),T.map(L=>f.jsx(Yy,{project:L,badge:g.get(L.slug)},L.slug))]},P||"unsorted"))]}),f.jsxs("div",{className:"border-t border-paddock-200 px-3 py-3 dark:border-paddock-800",children:[f.jsxs(bn,{to:"/config",className:({isActive:P})=>`btn-subtle w-full justify-start ${P?"bg-paddock-200/80 dark:bg-paddock-800":""}`,title:"Instance config — paddock.config.yaml (restart required)",children:[f.jsx(Ly,{width:15,height:15}),"Config"]}),S.enabled&&f.jsxs("a",{href:S.path,target:"_blank",rel:"noreferrer",className:"btn-subtle mt-1 w-full justify-start",title:"OpenAPI / Swagger reference (opens in a new tab)",children:[f.jsx(Iy,{width:15,height:15}),"Swagger API"]}),f.jsxs("button",{type:"button",onClick:o,className:"btn-subtle mt-1 w-full justify-start","aria-label":l?"Switch to light mode":"Switch to dark mode",title:"Toggle light / dark theme",children:[l?f.jsx(Dy,{width:15,height:15}):f.jsx(Oy,{width:15,height:15}),l?"Light mode":"Dark mode"]}),f.jsxs("p",{className:"mt-2 px-2 text-[11px] text-paddock-400",children:["v","0.62.0"]})]})]}),f.jsx("main",{className:"min-w-0 flex-1 overflow-hidden",children:f.jsx(C.Suspense,{fallback:f.jsx(Jy,{}),children:f.jsx(Ig,{context:{openNav:()=>a(!0)}})})}),f.jsx(Uy,{open:s,onClose:()=>u(!1),onCreated:P=>{r(P),u(!1),h(`/projects/${P.slug}/chat`)}})]})}function Oc({brand:e,className:t=""}){return f.jsx("span",{className:`flex shrink-0 items-center justify-center overflow-hidden rounded-lg bg-accent text-white shadow-sm ${t}`,children:gy(e.logo)?f.jsx("img",{src:e.logo,alt:"",className:"h-full w-full object-cover"}):e.logo})}function Jy(){return f.jsxs("div",{className:"flex h-full items-center justify-center","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-paddock-300 border-t-accent dark:border-paddock-700 dark:border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Loading…"})]})}function Yy({project:e,badge:t}){return f.jsxs(bn,{to:`/projects/${e.slug}`,className:({isActive:n})=>`group mb-0.5 flex flex-col gap-1 rounded-lg px-2.5 py-2 text-sm transition-colors ${n?"bg-paddock-200/80 dark:bg-paddock-800":"hover:bg-paddock-200/50 dark:hover:bg-paddock-800/50"}`,children:[f.jsxs("span",{className:"flex items-center justify-between gap-2",children:[f.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[f.jsx(Ty,{width:13,height:13,className:"shrink-0 text-paddock-400 group-hover:text-paddock-500"}),f.jsx("span",{className:"truncate font-medium",children:e.name})]}),f.jsx(Eh,{badge:t})]}),e.domain.length>0&&f.jsxs("span",{className:"flex min-w-0 items-center gap-1 overflow-hidden pl-[18px]",children:[e.domain.slice(0,2).map(n=>f.jsx(Ny,{tag:n,className:"max-w-[7rem] truncate"},n)),e.domain.length>2&&f.jsxs("span",{className:"shrink-0 text-[11px] text-paddock-400",children:["+",e.domain.length-2]})]})]})}function Eh({badge:e,className:t=""}){const n=(e==null?void 0:e.unread)??0,r=(e==null?void 0:e.inflight)??0;return n===0&&r===0?null:f.jsxs("span",{className:`flex shrink-0 items-center gap-1.5 ${t}`,children:[r>0&&f.jsxs("span",{className:"flex items-center gap-1 text-[11px] tabular-nums text-paddock-500 dark:text-paddock-400",title:`${r} chat${r===1?"":"s"} in flight`,"aria-label":`${r} chat${r===1?"":"s"} in flight`,children:[f.jsx("span",{"aria-hidden":"true",className:"h-2.5 w-2.5 spin-eco rounded-full border-[1.5px] border-paddock-400 border-t-transparent dark:border-paddock-500 dark:border-t-transparent"}),r]}),n>0&&f.jsx("span",{className:"inline-flex min-w-[1.1rem] items-center justify-center rounded-full bg-accent px-1.5 py-0.5 text-[11px] font-semibold leading-none tabular-nums text-white",title:`${n} unread ${n===1?"reply":"replies"}`,"aria-label":`${n} unread ${n===1?"reply":"replies"}`,children:n})]})}const Ch="paddock:chunkReloadAt",Gy=1e4,Ic=/dynamically imported module|module script|importing a module|failed to fetch|unable to preload|load failed|error loading/i;function Xy(e){return e?e instanceof Error?e.name==="ChunkLoadError"?!0:Ic.test(e.message):Ic.test(String(e)):!1}function Vs(){try{return typeof sessionStorage<"u"?sessionStorage:void 0}catch{return}}function Zy(e=Date.now(),t=Vs()){if(!t)return!1;const n=t.getItem(Ch);if(!n)return!1;const r=Number(n);return Number.isFinite(r)&&e-r<Gy}function qy(e=Date.now(),t=Vs()){try{t==null||t.setItem(Ch,String(e))}catch{}}function e0(e,t=Date.now(),n=Vs()){return Xy(e)&&!Zy(t,n)?"reload":"show"}function t0(){const e=hh(),t=e0(e);if(C.useEffect(()=>{t==="reload"&&(qy(),window.location.reload())},[t]),t==="reload")return f.jsxs("div",{className:"flex h-[100dvh] items-center justify-center bg-canvas dark:bg-canvas-dark","aria-busy":"true","aria-live":"polite",children:[f.jsx("span",{className:"h-6 w-6 animate-spin rounded-full border-2 border-paddock-300 border-t-accent dark:border-paddock-700 dark:border-t-accent"}),f.jsx("span",{className:"sr-only",children:"Updating…"})]});const n=e instanceof Error?e.message:typeof e=="string"?e:"";return f.jsxs("div",{className:"flex h-[100dvh] flex-col items-center justify-center gap-4 bg-canvas px-6 text-center dark:bg-canvas-dark",children:[f.jsxs("div",{children:[f.jsx("h1",{className:"text-lg font-semibold tracking-tight",children:"Something went wrong"}),f.jsx("p",{className:"mt-1 max-w-md text-sm text-paddock-500 dark:text-paddock-400",children:"The app hit an unexpected error. Reloading usually fixes it."}),n?f.jsx("p",{className:"mt-2 max-w-md break-words font-mono text-[11px] text-paddock-400",children:n}):null]}),f.jsx("button",{className:"btn-primary",onClick:()=>window.location.reload(),children:"Reload"})]})}function n0(){typeof navigator>"u"||!("serviceWorker"in navigator)||window.addEventListener("load",()=>{const e=navigator.serviceWorker,t=!!e.controller;let n=!1;e.addEventListener("controllerchange",()=>{n||!t||(n=!0,window.location.reload())}),e.register("/sw.js").catch(()=>{})})}const jh=C.lazy(()=>Sl(()=>import("./ProjectsGrid-BrlvLc-Y.js"),__vite__mapDeps([0,1])).then(e=>({default:e.ProjectsGrid}))),ke=C.lazy(()=>Sl(()=>import("./ProjectView-DkNdilGo.js").then(e=>e.P),__vite__mapDeps([2,1,3,4])).then(e=>({default:e.ProjectView}))),r0=C.lazy(()=>Sl(()=>import("./ProjectRedirect-CslqbhUb.js"),__vite__mapDeps([5,4])).then(e=>({default:e.ProjectRedirect}))),l0=C.lazy(()=>Sl(()=>import("./InstanceConfigPage-Ca905oey.js"),[]).then(e=>({default:e.InstanceConfigPage}))),Ph=()=>document.documentElement.setAttribute("data-tab-hidden",document.hidden?"true":"false");document.addEventListener("visibilitychange",Ph);Ph();function o0(){const{tag:e}=Eg();return f.jsx(jh,{filterTag:e?decodeURIComponent(e):void 0})}const i0=Vg([{path:"/",element:f.jsx(by,{}),errorElement:f.jsx(t0,{}),children:[{index:!0,element:f.jsx(ke,{root:!0})},{path:"projects",element:f.jsx(jh,{})},{path:"tags/:tag",element:f.jsx(o0,{})},{path:"projects/:slug",element:f.jsx(r0,{})},{path:"projects/:slug/home",element:f.jsx(ke,{})},{path:"projects/:slug/chat",element:f.jsx(ke,{})},{path:"projects/:slug/chat/:sessionId",element:f.jsx(ke,{})},{path:"projects/:slug/files",element:f.jsx(ke,{})},{path:"projects/:slug/files/*",element:f.jsx(ke,{})},{path:"projects/:slug/changes",element:f.jsx(ke,{})},{path:"projects/:slug/changes/:file",element:f.jsx(ke,{})},{path:"projects/:slug/history",element:f.jsx(ke,{})},{path:"projects/:slug/settings",element:f.jsx(ke,{})},{path:"projects/:slug/triggers",element:f.jsx(ke,{})},{path:"projects/:slug/hooks",element:f.jsx(ke,{})},{path:"chat",element:f.jsx(ke,{root:!0})},{path:"chat/:sessionId",element:f.jsx(ke,{root:!0})},{path:"files",element:f.jsx(ke,{root:!0})},{path:"files/*",element:f.jsx(ke,{root:!0})},{path:"changes",element:f.jsx(ke,{root:!0})},{path:"changes/:file",element:f.jsx(ke,{root:!0})},{path:"history",element:f.jsx(ke,{root:!0})},{path:"triggers",element:f.jsx(ke,{root:!0})},{path:"settings",element:f.jsx(ke,{root:!0})},{path:"config",element:f.jsx(l0,{})}]}]);Wi.createRoot(document.getElementById("root")).render(f.jsx(Jc.StrictMode,{children:f.jsx(sy,{children:f.jsx(Xg,{router:i0})})}));n0();export{Qy as $,_0 as A,A0 as B,w0 as C,E0 as D,Ty as E,z0 as F,Ds as G,x0 as H,Cy as I,y0 as J,H0 as K,ny as L,My as M,Uy as N,V0 as O,_y as P,U0 as Q,As as R,R0 as S,Ny as T,W0 as U,L0 as V,N0 as W,kh as X,k0 as Y,S0 as Z,Sl as _,si as a,Q0 as a0,B0 as a1,K0 as a2,$0 as a3,b0 as a4,v0 as a5,g0 as a6,Py as a7,jy as a8,vh as a9,Wn as aa,f0 as ab,h0 as ac,Hy as ad,d0 as ae,c0 as af,p0 as ag,J0 as ah,gh as b,M0 as c,m0 as d,yy as e,P0 as f,iy as g,Eg as h,u0 as i,f as j,F0 as k,xl as l,s0 as m,Ly as n,wy as o,Uc as p,D0 as q,C as r,I0 as s,O0 as t,uy as u,a0 as v,j0 as w,C0 as x,T0 as y,Iy as z};
71
71
 
@@ -1,3 +1,3 @@
1
- import{_ as a,l as s,L as o,e as i}from"./mermaid.core-YAG8eSPQ.js";import{p as g}from"./wardley-L42UT6IY-Dtv10D2d.js";import"./index-DGCs1YIO.js";var p={parse:a(async r=>{const e=await g("info",r);s.debug(e)},"parse")},v={version:"11.15.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,n)=>{s.debug(`rendering info diagram
1
+ import{_ as a,l as s,L as o,e as i}from"./mermaid.core-CeMMnCip.js";import{p as g}from"./wardley-L42UT6IY-S7AGTOWw.js";import"./index-D_1ogxg1.js";var p={parse:a(async r=>{const e=await g("info",r);s.debug(e)},"parse")},v={version:"11.15.0"},d=a(()=>v.version,"getVersion"),m={getVersion:d},c=a((r,e,n)=>{s.debug(`rendering info diagram
2
2
  `+r);const t=o(e);i(t,100,400,!0),t.append("g").append("text").attr("x",100).attr("y",40).attr("class","version").attr("font-size",32).style("text-anchor","middle").text(`v${n}`)},"draw"),l={draw:c},b={parser:p,db:m,renderer:l};export{b as diagram};
3
3
 
@@ -1,4 +1,4 @@
1
- import{_ as o,c as ot,a4 as ut,L as dt,al as yt,z as ft,k as pt,p as it,a as gt,b as kt,g as mt,s as wt,q as _t,e as bt}from"./mermaid.core-YAG8eSPQ.js";import"./index-DGCs1YIO.js";var tt=function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(C.yy[z]=this.yy[z]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(F,"popStack");function j(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(j,"lex");for(var A,W,B,K,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=j()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
1
+ import{_ as o,c as ot,a4 as ut,L as dt,al as yt,z as ft,k as pt,p as it,a as gt,b as kt,g as mt,s as wt,q as _t,e as bt}from"./mermaid.core-CeMMnCip.js";import"./index-D_1ogxg1.js";var tt=function(){var e=o(function(M,t,s,i){for(s=s||{},i=M.length;i--;s[M[i]]=t);return s},"o"),h=[1,4],r=[1,14],a=[1,12],l=[1,13],y=[6,7,8],f=[1,20],d=[1,18],m=[1,19],c=[6,7,11],k=[1,6,13,14],g=[1,23],_=[1,24],x=[1,6,7,11,13,14],N={trace:o(function(){},"trace"),yy:{},symbols_:{error:2,start:3,ishikawa:4,spaceLines:5,SPACELINE:6,NL:7,ISHIKAWA:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,TEXT:14,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"ISHIKAWA",11:"EOF",13:"SPACELIST",14:"TEXT"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,2],[12,1],[12,1],[12,1]],performAction:o(function(t,s,i,u,p,n,v){var w=n.length-1;switch(p){case 6:case 7:return u;case 15:u.addNode(n[w-1].length,n[w].trim());break;case 16:u.addNode(0,n[w].trim());break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:h},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:h},{6:r,7:[1,10],9:9,12:11,13:a,14:l},e(y,[2,3]),{1:[2,2]},e(y,[2,4]),e(y,[2,5]),{1:[2,6],6:r,12:15,13:a,14:l},{6:r,9:16,12:11,13:a,14:l},{6:f,7:d,10:17,11:m},e(c,[2,18],{14:[1,21]}),e(c,[2,16]),e(c,[2,17]),{6:f,7:d,10:22,11:m},{1:[2,7],6:r,12:15,13:a,14:l},e(k,[2,14],{7:g,11:_}),e(x,[2,8]),e(x,[2,9]),e(x,[2,10]),e(c,[2,15]),e(k,[2,13],{7:g,11:_}),e(x,[2,11]),e(x,[2,12])],defaultActions:{2:[2,1],6:[2,2]},parseError:o(function(t,s){if(s.recoverable)this.trace(t);else{var i=new Error(t);throw i.hash=s,i}},"parseError"),parse:o(function(t){var s=this,i=[0],u=[],p=[null],n=[],v=this.table,w="",I=0,S=0,L=2,E=1,R=n.slice.call(arguments,1),b=Object.create(this.lexer),C={yy:{}};for(var z in this.yy)Object.prototype.hasOwnProperty.call(this.yy,z)&&(C.yy[z]=this.yy[z]);b.setInput(t,C.yy),C.yy.lexer=b,C.yy.parser=this,typeof b.yylloc>"u"&&(b.yylloc={});var T=b.yylloc;n.push(T);var D=b.options&&b.options.ranges;typeof C.yy.parseError=="function"?this.parseError=C.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function F(P){i.length=i.length-2*P,p.length=p.length-P,n.length=n.length-P}o(F,"popStack");function j(){var P;return P=u.pop()||b.lex()||E,typeof P!="number"&&(P instanceof Array&&(u=P,P=u.pop()),P=s.symbols_[P]||P),P}o(j,"lex");for(var A,W,B,K,H={},X,V,et,Y;;){if(W=i[i.length-1],this.defaultActions[W]?B=this.defaultActions[W]:((A===null||typeof A>"u")&&(A=j()),B=v[W]&&v[W][A]),typeof B>"u"||!B.length||!B[0]){var Q="";Y=[];for(X in v[W])this.terminals_[X]&&X>L&&Y.push("'"+this.terminals_[X]+"'");b.showPosition?Q="Parse error on line "+(I+1)+`:
2
2
  `+b.showPosition()+`
3
3
  Expecting `+Y.join(", ")+", got '"+(this.terminals_[A]||A)+"'":Q="Parse error on line "+(I+1)+": Unexpected "+(A==E?"end of input":"'"+(this.terminals_[A]||A)+"'"),this.parseError(Q,{text:b.match,token:this.terminals_[A]||A,line:b.yylineno,loc:T,expected:Y})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+W+", token: "+A);switch(B[0]){case 1:i.push(A),p.push(b.yytext),n.push(b.yylloc),i.push(B[1]),A=null,S=b.yyleng,w=b.yytext,I=b.yylineno,T=b.yylloc;break;case 2:if(V=this.productions_[B[1]][1],H.$=p[p.length-V],H._$={first_line:n[n.length-(V||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(V||1)].first_column,last_column:n[n.length-1].last_column},D&&(H._$.range=[n[n.length-(V||1)].range[0],n[n.length-1].range[1]]),K=this.performAction.apply(H,[w,S,I,C.yy,B[1],p,n].concat(R)),typeof K<"u")return K;V&&(i=i.slice(0,-1*V*2),p=p.slice(0,-1*V),n=n.slice(0,-1*V)),i.push(this.productions_[B[1]][0]),p.push(H.$),n.push(H._$),et=v[i[i.length-2]][i[i.length-1]],i.push(et);break;case 3:return!0}}return!0},"parse")},O=function(){var M={EOF:1,parseError:o(function(s,i){if(this.yy.parser)this.yy.parser.parseError(s,i);else throw new Error(s)},"parseError"),setInput:o(function(t,s){return this.yy=s||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:o(function(){var t=this._input[0];this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t;var s=t.match(/(?:\r\n?|\n).*/g);return s?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:o(function(t){var s=t.length,i=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-s),this.offset-=s;var u=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),i.length-1&&(this.yylineno-=i.length-1);var p=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:i?(i.length===u.length?this.yylloc.first_column:0)+u[u.length-i.length].length-i[0].length:this.yylloc.first_column-s},this.options.ranges&&(this.yylloc.range=[p[0],p[0]+this.yyleng-s]),this.yyleng=this.yytext.length,this},"unput"),more:o(function(){return this._more=!0,this},"more"),reject:o(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:o(function(t){this.unput(this.match.slice(t))},"less"),pastInput:o(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:o(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:o(function(){var t=this.pastInput(),s=new Array(t.length+1).join("-");return t+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{g as gt}from"./chunk-FMBD7UC4-In3h_-7v.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-ND2GUHAM-DuaIeRaC.js";import{g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,_ as s,c as R,d as G,e as $t,z as Mt}from"./mermaid.core-YAG8eSPQ.js";import{d as it}from"./arc-C2Jekujs.js";import"./index-DGCs1YIO.js";var U=function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var X="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?X="Parse error on line "+(C+1)+`:
1
+ import{g as gt}from"./chunk-FMBD7UC4-f6iJDfdI.js";import{a as mt,g as lt,h as xt,d as kt}from"./chunk-ND2GUHAM-Bz3TKIJk.js";import{g as _t,s as vt,a as bt,b as wt,q as Tt,p as St,_ as s,c as R,d as G,e as $t,z as Mt}from"./mermaid.core-CeMMnCip.js";import{d as it}from"./arc-CGqCI5nQ.js";import"./index-D_1ogxg1.js";var U=function(){var t=s(function(h,r,n,l){for(n=n||{},l=h.length;l--;n[h[l]]=r);return n},"o"),e=[6,8,10,11,12,14,16,17,18],a=[1,9],f=[1,10],i=[1,11],u=[1,12],p=[1,13],o=[1,14],g={trace:s(function(){},"trace"),yy:{},symbols_:{error:2,start:3,journey:4,document:5,EOF:6,line:7,SPACE:8,statement:9,NEWLINE:10,title:11,acc_title:12,acc_title_value:13,acc_descr:14,acc_descr_value:15,acc_descr_multiline_value:16,section:17,taskName:18,taskData:19,$accept:0,$end:1},terminals_:{2:"error",4:"journey",6:"EOF",8:"SPACE",10:"NEWLINE",11:"title",12:"acc_title",13:"acc_title_value",14:"acc_descr",15:"acc_descr_value",16:"acc_descr_multiline_value",17:"section",18:"taskName",19:"taskData"},productions_:[0,[3,3],[5,0],[5,2],[7,2],[7,1],[7,1],[7,1],[9,1],[9,2],[9,2],[9,1],[9,1],[9,2]],performAction:s(function(r,n,l,y,d,c,v){var k=c.length-1;switch(d){case 1:return c[k-1];case 2:this.$=[];break;case 3:c[k-1].push(c[k]),this.$=c[k-1];break;case 4:case 5:this.$=c[k];break;case 6:case 7:this.$=[];break;case 8:y.setDiagramTitle(c[k].substr(6)),this.$=c[k].substr(6);break;case 9:this.$=c[k].trim(),y.setAccTitle(this.$);break;case 10:case 11:this.$=c[k].trim(),y.setAccDescription(this.$);break;case 12:y.addSection(c[k].substr(8)),this.$=c[k].substr(8);break;case 13:y.addTask(c[k-1],c[k]),this.$="task";break}},"anonymous"),table:[{3:1,4:[1,2]},{1:[3]},t(e,[2,2],{5:3}),{6:[1,4],7:5,8:[1,6],9:7,10:[1,8],11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,7],{1:[2,1]}),t(e,[2,3]),{9:15,11:a,12:f,14:i,16:u,17:p,18:o},t(e,[2,5]),t(e,[2,6]),t(e,[2,8]),{13:[1,16]},{15:[1,17]},t(e,[2,11]),t(e,[2,12]),{19:[1,18]},t(e,[2,4]),t(e,[2,9]),t(e,[2,10]),t(e,[2,13])],defaultActions:{},parseError:s(function(r,n){if(n.recoverable)this.trace(r);else{var l=new Error(r);throw l.hash=n,l}},"parseError"),parse:s(function(r){var n=this,l=[0],y=[],d=[null],c=[],v=this.table,k="",C=0,Q=0,yt=2,D=1,dt=c.slice.call(arguments,1),_=Object.create(this.lexer),I={yy:{}};for(var O in this.yy)Object.prototype.hasOwnProperty.call(this.yy,O)&&(I.yy[O]=this.yy[O]);_.setInput(r,I.yy),I.yy.lexer=_,I.yy.parser=this,typeof _.yylloc>"u"&&(_.yylloc={});var Y=_.yylloc;c.push(Y);var ft=_.options&&_.options.ranges;typeof I.yy.parseError=="function"?this.parseError=I.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pt(w){l.length=l.length-2*w,d.length=d.length-w,c.length=c.length-w}s(pt,"popStack");function tt(){var w;return w=y.pop()||_.lex()||D,typeof w!="number"&&(w instanceof Array&&(y=w,w=y.pop()),w=n.symbols_[w]||w),w}s(tt,"lex");for(var b,A,T,q,F={},N,M,et,z;;){if(A=l[l.length-1],this.defaultActions[A]?T=this.defaultActions[A]:((b===null||typeof b>"u")&&(b=tt()),T=v[A]&&v[A][b]),typeof T>"u"||!T.length||!T[0]){var X="";z=[];for(N in v[A])this.terminals_[N]&&N>yt&&z.push("'"+this.terminals_[N]+"'");_.showPosition?X="Parse error on line "+(C+1)+`:
2
2
  `+_.showPosition()+`
3
3
  Expecting `+z.join(", ")+", got '"+(this.terminals_[b]||b)+"'":X="Parse error on line "+(C+1)+": Unexpected "+(b==D?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(X,{text:_.match,token:this.terminals_[b]||b,line:_.yylineno,loc:Y,expected:z})}if(T[0]instanceof Array&&T.length>1)throw new Error("Parse Error: multiple actions possible at state: "+A+", token: "+b);switch(T[0]){case 1:l.push(b),d.push(_.yytext),c.push(_.yylloc),l.push(T[1]),b=null,Q=_.yyleng,k=_.yytext,C=_.yylineno,Y=_.yylloc;break;case 2:if(M=this.productions_[T[1]][1],F.$=d[d.length-M],F._$={first_line:c[c.length-(M||1)].first_line,last_line:c[c.length-1].last_line,first_column:c[c.length-(M||1)].first_column,last_column:c[c.length-1].last_column},ft&&(F._$.range=[c[c.length-(M||1)].range[0],c[c.length-1].range[1]]),q=this.performAction.apply(F,[k,Q,C,I.yy,T[1],d,c].concat(dt)),typeof q<"u")return q;M&&(l=l.slice(0,-1*M*2),d=d.slice(0,-1*M),c=c.slice(0,-1*M)),l.push(this.productions_[T[1]][0]),d.push(F.$),c.push(F._$),et=v[l[l.length-2]][l[l.length-1]],l.push(et);break;case 3:return!0}}return!0},"parse")},m=function(){var h={EOF:1,parseError:s(function(n,l){if(this.yy.parser)this.yy.parser.parseError(n,l);else throw new Error(n)},"parseError"),setInput:s(function(r,n){return this.yy=n||this.yy||{},this._input=r,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:s(function(){var r=this._input[0];this.yytext+=r,this.yyleng++,this.offset++,this.match+=r,this.matched+=r;var n=r.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),r},"input"),unput:s(function(r){var n=r.length,l=r.split(/(?:\r\n?|\n)/g);this._input=r+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var y=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),l.length-1&&(this.yylineno-=l.length-1);var d=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:l?(l.length===y.length?this.yylloc.first_column:0)+y[y.length-l.length].length-l[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[d[0],d[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:s(function(){return this._more=!0,this},"more"),reject:s(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:s(function(r){this.unput(this.match.slice(r))},"less"),pastInput:s(function(){var r=this.matched.substr(0,this.matched.length-this.match.length);return(r.length>20?"...":"")+r.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:s(function(){var r=this.match;return r.length<20&&(r+=this._input.substr(0,20-r.length)),(r.substr(0,20)+(r.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:s(function(){var r=this.pastInput(),n=new Array(r.length+1).join("-");return r+this.upcomingInput()+`
@@ -1,4 +1,4 @@
1
- import{_ as c,l as te,c as W,L as fe,ah as ye,ai as be,aj as me,af as _e,I as Y,i as G,t as ke,J as Ee,ac as Se,ad as le,ae as ce}from"./mermaid.core-YAG8eSPQ.js";import{g as Ne}from"./chunk-FMBD7UC4-In3h_-7v.js";import"./index-DGCs1YIO.js";var $=function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],j=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],U=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:j}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:U}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:j}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:U}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
1
+ import{_ as c,l as te,c as W,L as fe,ah as ye,ai as be,aj as me,af as _e,I as Y,i as G,t as ke,J as Ee,ac as Se,ad as le,ae as ce}from"./mermaid.core-CeMMnCip.js";import{g as Ne}from"./chunk-FMBD7UC4-f6iJDfdI.js";import"./index-D_1ogxg1.js";var $=function(){var t=c(function(_,s,n,a){for(n=n||{},a=_.length;a--;n[_[a]]=s);return n},"o"),g=[1,4],d=[1,13],r=[1,12],p=[1,15],k=[1,16],f=[1,20],h=[1,19],L=[6,7,8],C=[1,26],w=[1,24],N=[1,25],i=[6,7,11],j=[1,31],x=[6,7,11,24],P=[1,6,13,16,17,20,23],M=[1,35],U=[1,36],A=[1,6,7,11,13,16,17,20,23],H=[1,38],V={trace:c(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mindMap:4,spaceLines:5,SPACELINE:6,NL:7,KANBAN:8,document:9,stop:10,EOF:11,statement:12,SPACELIST:13,node:14,shapeData:15,ICON:16,CLASS:17,nodeWithId:18,nodeWithoutId:19,NODE_DSTART:20,NODE_DESCR:21,NODE_DEND:22,NODE_ID:23,SHAPE_DATA:24,$accept:0,$end:1},terminals_:{2:"error",6:"SPACELINE",7:"NL",8:"KANBAN",11:"EOF",13:"SPACELIST",16:"ICON",17:"CLASS",20:"NODE_DSTART",21:"NODE_DESCR",22:"NODE_DEND",23:"NODE_ID",24:"SHAPE_DATA"},productions_:[0,[3,1],[3,2],[5,1],[5,2],[5,2],[4,2],[4,3],[10,1],[10,1],[10,1],[10,2],[10,2],[9,3],[9,2],[12,3],[12,2],[12,2],[12,2],[12,1],[12,2],[12,1],[12,1],[12,1],[12,1],[14,1],[14,1],[19,3],[18,1],[18,4],[15,2],[15,1]],performAction:c(function(s,n,a,o,u,e,B){var l=e.length-1;switch(u){case 6:case 7:return o;case 8:o.getLogger().trace("Stop NL ");break;case 9:o.getLogger().trace("Stop EOF ");break;case 11:o.getLogger().trace("Stop NL2 ");break;case 12:o.getLogger().trace("Stop EOF2 ");break;case 15:o.getLogger().info("Node: ",e[l-1].id),o.addNode(e[l-2].length,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 16:o.getLogger().info("Node: ",e[l].id),o.addNode(e[l-1].length,e[l].id,e[l].descr,e[l].type);break;case 17:o.getLogger().trace("Icon: ",e[l]),o.decorateNode({icon:e[l]});break;case 18:case 23:o.decorateNode({class:e[l]});break;case 19:o.getLogger().trace("SPACELIST");break;case 20:o.getLogger().trace("Node: ",e[l-1].id),o.addNode(0,e[l-1].id,e[l-1].descr,e[l-1].type,e[l]);break;case 21:o.getLogger().trace("Node: ",e[l].id),o.addNode(0,e[l].id,e[l].descr,e[l].type);break;case 22:o.decorateNode({icon:e[l]});break;case 27:o.getLogger().trace("node found ..",e[l-2]),this.$={id:e[l-1],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 28:this.$={id:e[l],descr:e[l],type:0};break;case 29:o.getLogger().trace("node found ..",e[l-3]),this.$={id:e[l-3],descr:e[l-1],type:o.getType(e[l-2],e[l])};break;case 30:this.$=e[l-1]+e[l];break;case 31:this.$=e[l];break}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],8:g},{1:[3]},{1:[2,1]},{4:6,6:[1,7],7:[1,8],8:g},{6:d,7:[1,10],9:9,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(L,[2,3]),{1:[2,2]},t(L,[2,4]),t(L,[2,5]),{1:[2,6],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:d,9:22,12:11,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},{6:C,7:w,10:23,11:N},t(i,[2,24],{18:17,19:18,14:27,16:[1,28],17:[1,29],20:f,23:h}),t(i,[2,19]),t(i,[2,21],{15:30,24:j}),t(i,[2,22]),t(i,[2,23]),t(x,[2,25]),t(x,[2,26]),t(x,[2,28],{20:[1,32]}),{21:[1,33]},{6:C,7:w,10:34,11:N},{1:[2,7],6:d,12:21,13:r,14:14,16:p,17:k,18:17,19:18,20:f,23:h},t(P,[2,14],{7:M,11:U}),t(A,[2,8]),t(A,[2,9]),t(A,[2,10]),t(i,[2,16],{15:37,24:j}),t(i,[2,17]),t(i,[2,18]),t(i,[2,20],{24:H}),t(x,[2,31]),{21:[1,39]},{22:[1,40]},t(P,[2,13],{7:M,11:U}),t(A,[2,11]),t(A,[2,12]),t(i,[2,15],{24:H}),t(x,[2,30]),{22:[1,41]},t(x,[2,27]),t(x,[2,29])],defaultActions:{2:[2,1],6:[2,2]},parseError:c(function(s,n){if(n.recoverable)this.trace(s);else{var a=new Error(s);throw a.hash=n,a}},"parseError"),parse:c(function(s){var n=this,a=[0],o=[],u=[null],e=[],B=this.table,l="",z=0,ie=0,ue=2,re=1,ge=e.slice.call(arguments,1),m=Object.create(this.lexer),T={yy:{}};for(var J in this.yy)Object.prototype.hasOwnProperty.call(this.yy,J)&&(T.yy[J]=this.yy[J]);m.setInput(s,T.yy),T.yy.lexer=m,T.yy.parser=this,typeof m.yylloc>"u"&&(m.yylloc={});var q=m.yylloc;e.push(q);var de=m.options&&m.options.ranges;typeof T.yy.parseError=="function"?this.parseError=T.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function pe(S){a.length=a.length-2*S,u.length=u.length-S,e.length=e.length-S}c(pe,"popStack");function ae(){var S;return S=o.pop()||m.lex()||re,typeof S!="number"&&(S instanceof Array&&(o=S,S=o.pop()),S=n.symbols_[S]||S),S}c(ae,"lex");for(var E,R,v,Q,F={},X,I,oe,K;;){if(R=a[a.length-1],this.defaultActions[R]?v=this.defaultActions[R]:((E===null||typeof E>"u")&&(E=ae()),v=B[R]&&B[R][E]),typeof v>"u"||!v.length||!v[0]){var Z="";K=[];for(X in B[R])this.terminals_[X]&&X>ue&&K.push("'"+this.terminals_[X]+"'");m.showPosition?Z="Parse error on line "+(z+1)+`:
2
2
  `+m.showPosition()+`
3
3
  Expecting `+K.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Z="Parse error on line "+(z+1)+": Unexpected "+(E==re?"end of input":"'"+(this.terminals_[E]||E)+"'"),this.parseError(Z,{text:m.match,token:this.terminals_[E]||E,line:m.yylineno,loc:q,expected:K})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+R+", token: "+E);switch(v[0]){case 1:a.push(E),u.push(m.yytext),e.push(m.yylloc),a.push(v[1]),E=null,ie=m.yyleng,l=m.yytext,z=m.yylineno,q=m.yylloc;break;case 2:if(I=this.productions_[v[1]][1],F.$=u[u.length-I],F._$={first_line:e[e.length-(I||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(I||1)].first_column,last_column:e[e.length-1].last_column},de&&(F._$.range=[e[e.length-(I||1)].range[0],e[e.length-1].range[1]]),Q=this.performAction.apply(F,[l,ie,z,T.yy,v[1],u,e].concat(ge)),typeof Q<"u")return Q;I&&(a=a.slice(0,-1*I*2),u=u.slice(0,-1*I),e=e.slice(0,-1*I)),a.push(this.productions_[v[1]][0]),u.push(F.$),e.push(F._$),oe=B[a[a.length-2]][a[a.length-1]],a.push(oe);break;case 3:return!0}}return!0},"parse")},y=function(){var _={EOF:1,parseError:c(function(n,a){if(this.yy.parser)this.yy.parser.parseError(n,a);else throw new Error(n)},"parseError"),setInput:c(function(s,n){return this.yy=n||this.yy||{},this._input=s,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:c(function(){var s=this._input[0];this.yytext+=s,this.yyleng++,this.offset++,this.match+=s,this.matched+=s;var n=s.match(/(?:\r\n?|\n).*/g);return n?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),s},"input"),unput:c(function(s){var n=s.length,a=s.split(/(?:\r\n?|\n)/g);this._input=s+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-n),this.offset-=n;var o=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),a.length-1&&(this.yylineno-=a.length-1);var u=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:a?(a.length===o.length?this.yylloc.first_column:0)+o[o.length-a.length].length-a[0].length:this.yylloc.first_column-n},this.options.ranges&&(this.yylloc.range=[u[0],u[0]+this.yyleng-n]),this.yyleng=this.yytext.length,this},"unput"),more:c(function(){return this._more=!0,this},"more"),reject:c(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
4
4
  `+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:c(function(s){this.unput(this.match.slice(s))},"less"),pastInput:c(function(){var s=this.matched.substr(0,this.matched.length-this.match.length);return(s.length>20?"...":"")+s.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:c(function(){var s=this.match;return s.length<20&&(s+=this._input.substr(0,20-s.length)),(s.substr(0,20)+(s.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:c(function(){var s=this.pastInput(),n=new Array(s.length+1).join("-");return s+this.upcomingInput()+`
@@ -1,2 +1,2 @@
1
- import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-YAG8eSPQ.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<0?i=l+1:h=l}while(i<h)}return i}function f(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<=0?i=l+1:h=l}while(i<h)}return i}function a(o,c,i=0,h=o.length){const l=u(o,c,i,h-1);return l>i&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/i<n&&++o,c/i>r&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*i<n&&++o,c*i>r&&--c),c<o&&.5<=t&&t<2?v(n,r,t*2):[o,c,i]}function E(n,r,t){if(r=+r,n=+n,t=+t,!(t>0))return[];if(n===r)return[n];const e=r<n,[u,f,a]=e?v(r,n,t):v(n,r,t);if(!(f>=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;i<o;++i)c[i]=(f-i)/-a;else for(let i=0;i<o;++i)c[i]=(f-i)*a;else if(a<0)for(let i=0;i<o;++i)c[i]=(u+i)/-a;else for(let i=0;i<o;++i)c[i]=(u+i)*a;return c}function y(n,r,t){return r=+r,n=+n,t=+t,v(n,r,t)[2]}function G(n,r,t){r=+r,n=+n,t=+t;const e=r<n,u=e?y(r,n,t):y(n,r,t);return(e?-1:1)*(u<0?1/-u:u)}function H(n,r){r||(r=[]);var t=n?Math.min(r.length,n.length):0,e=r.slice(),u;return function(f){for(u=0;u<t;++u)e[u]=n[u]*(1-f)+r[u]*f;return e}}function J(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function K(n,r){var t=r?r.length:0,e=n?Math.min(t,n.length):0,u=new Array(e),f=new Array(t),a;for(a=0;a<e;++a)u[a]=d(n[a],r[a]);for(;a<t;++a)f[a]=r[a];return function(o){for(a=0;a<e;++a)f[a]=u[a](o);return f}}function L(n,r){var t=new Date;return n=+n,r=+r,function(e){return t.setTime(n*(1-e)+r*e),t}}function Q(n,r){var t={},e={},u;(n===null||typeof n!="object")&&(n={}),(r===null||typeof r!="object")&&(r={});for(u in r)u in n?t[u]=d(n[u],r[u]):e[u]=r[u];return function(f){for(u in t)e[u]=t[u](f);return e}}function d(n,r){var t=typeof r,e;return r==null||t==="boolean"?j(r):(t==="number"?p:t==="string"?(e=w(r))?(r=e,k):q:r instanceof w?k:r instanceof Date?L:J(r)?H:Array.isArray(r)?K:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Q:p)(n,r)}function U(n,r){return n=+n,r=+r,function(t){return Math.round(n*(1-t)+r*t)}}function W(n){return Math.max(0,-g(Math.abs(n)))}function X(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(g(r)/3)))*3-g(Math.abs(n)))}function Y(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,g(r)-g(n))+1}function Z(n){return function(){return n}}function _(n){return+n}var A=[0,1];function m(n){return n}function N(n,r){return(r-=n=+n)?function(t){return(t-n)/r}:Z(isNaN(r)?NaN:.5)}function b(n,r){var t;return n>r&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u<e?(e=N(u,e),f=t(a,f)):(e=N(e,u),f=t(f,a)),function(o){return f(e(o))}}function rn(n,r,t){var e=Math.min(n.length,r.length)-1,u=new Array(e),f=new Array(e),a=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<e;)u[a]=N(n[a],n[a+1]),f[a]=t(r[a],r[a+1]);return function(o){var c=x(n,o,1,e)-1;return f[c](u[c](o))}}function en(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function tn(){var n=A,r=A,t=d,e,u,f,a=m,o,c,i;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=b(n[0],n[s-1])),o=s>2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o<a&&(i=a,a=o,o=i,i=u,u=f,f=i);h-- >0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t};
1
+ import{b7 as j,b8 as p,b9 as w,ba as k,bb as q}from"./mermaid.core-CeMMnCip.js";import{i as D}from"./init-Gi6I4Gst.js";import{e as g,f as F,a as z,b as B}from"./defaultLocale-DX6XiGOO.js";function M(n,r){return n==null||r==null?NaN:n<r?-1:n>r?1:n>=r?0:NaN}function I(n,r){return n==null||r==null?NaN:r<n?-1:r>n?1:r>=n?0:NaN}function R(n){let r,t,e;n.length!==2?(r=M,t=(o,c)=>M(n(o),c),e=(o,c)=>n(o)-c):(r=n===M||n===I?n:P,t=n,e=n);function u(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<0?i=l+1:h=l}while(i<h)}return i}function f(o,c,i=0,h=o.length){if(i<h){if(r(c,c)!==0)return h;do{const l=i+h>>>1;t(o[l],c)<=0?i=l+1:h=l}while(i<h)}return i}function a(o,c,i=0,h=o.length){const l=u(o,c,i,h-1);return l>i&&e(o[l-1],c)>-e(o[l],c)?l-1:l}return{left:u,center:a,right:f}}function P(){return 0}function V(n){return n===null?NaN:+n}const $=R(M),x=$.right;R(V).center;const O=Math.sqrt(50),T=Math.sqrt(10),C=Math.sqrt(2);function v(n,r,t){const e=(r-n)/Math.max(0,t),u=Math.floor(Math.log10(e)),f=e/Math.pow(10,u),a=f>=O?10:f>=T?5:f>=C?2:1;let o,c,i;return u<0?(i=Math.pow(10,-u)/a,o=Math.round(n*i),c=Math.round(r*i),o/i<n&&++o,c/i>r&&--c,i=-i):(i=Math.pow(10,u)*a,o=Math.round(n/i),c=Math.round(r/i),o*i<n&&++o,c*i>r&&--c),c<o&&.5<=t&&t<2?v(n,r,t*2):[o,c,i]}function E(n,r,t){if(r=+r,n=+n,t=+t,!(t>0))return[];if(n===r)return[n];const e=r<n,[u,f,a]=e?v(r,n,t):v(n,r,t);if(!(f>=u))return[];const o=f-u+1,c=new Array(o);if(e)if(a<0)for(let i=0;i<o;++i)c[i]=(f-i)/-a;else for(let i=0;i<o;++i)c[i]=(f-i)*a;else if(a<0)for(let i=0;i<o;++i)c[i]=(u+i)/-a;else for(let i=0;i<o;++i)c[i]=(u+i)*a;return c}function y(n,r,t){return r=+r,n=+n,t=+t,v(n,r,t)[2]}function G(n,r,t){r=+r,n=+n,t=+t;const e=r<n,u=e?y(r,n,t):y(n,r,t);return(e?-1:1)*(u<0?1/-u:u)}function H(n,r){r||(r=[]);var t=n?Math.min(r.length,n.length):0,e=r.slice(),u;return function(f){for(u=0;u<t;++u)e[u]=n[u]*(1-f)+r[u]*f;return e}}function J(n){return ArrayBuffer.isView(n)&&!(n instanceof DataView)}function K(n,r){var t=r?r.length:0,e=n?Math.min(t,n.length):0,u=new Array(e),f=new Array(t),a;for(a=0;a<e;++a)u[a]=d(n[a],r[a]);for(;a<t;++a)f[a]=r[a];return function(o){for(a=0;a<e;++a)f[a]=u[a](o);return f}}function L(n,r){var t=new Date;return n=+n,r=+r,function(e){return t.setTime(n*(1-e)+r*e),t}}function Q(n,r){var t={},e={},u;(n===null||typeof n!="object")&&(n={}),(r===null||typeof r!="object")&&(r={});for(u in r)u in n?t[u]=d(n[u],r[u]):e[u]=r[u];return function(f){for(u in t)e[u]=t[u](f);return e}}function d(n,r){var t=typeof r,e;return r==null||t==="boolean"?j(r):(t==="number"?p:t==="string"?(e=w(r))?(r=e,k):q:r instanceof w?k:r instanceof Date?L:J(r)?H:Array.isArray(r)?K:typeof r.valueOf!="function"&&typeof r.toString!="function"||isNaN(r)?Q:p)(n,r)}function U(n,r){return n=+n,r=+r,function(t){return Math.round(n*(1-t)+r*t)}}function W(n){return Math.max(0,-g(Math.abs(n)))}function X(n,r){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(g(r)/3)))*3-g(Math.abs(n)))}function Y(n,r){return n=Math.abs(n),r=Math.abs(r)-n,Math.max(0,g(r)-g(n))+1}function Z(n){return function(){return n}}function _(n){return+n}var A=[0,1];function m(n){return n}function N(n,r){return(r-=n=+n)?function(t){return(t-n)/r}:Z(isNaN(r)?NaN:.5)}function b(n,r){var t;return n>r&&(t=n,n=r,r=t),function(e){return Math.max(n,Math.min(r,e))}}function nn(n,r,t){var e=n[0],u=n[1],f=r[0],a=r[1];return u<e?(e=N(u,e),f=t(a,f)):(e=N(e,u),f=t(f,a)),function(o){return f(e(o))}}function rn(n,r,t){var e=Math.min(n.length,r.length)-1,u=new Array(e),f=new Array(e),a=-1;for(n[e]<n[0]&&(n=n.slice().reverse(),r=r.slice().reverse());++a<e;)u[a]=N(n[a],n[a+1]),f[a]=t(r[a],r[a+1]);return function(o){var c=x(n,o,1,e)-1;return f[c](u[c](o))}}function en(n,r){return r.domain(n.domain()).range(n.range()).interpolate(n.interpolate()).clamp(n.clamp()).unknown(n.unknown())}function tn(){var n=A,r=A,t=d,e,u,f,a=m,o,c,i;function h(){var s=Math.min(n.length,r.length);return a!==m&&(a=b(n[0],n[s-1])),o=s>2?rn:nn,c=i=null,l}function l(s){return s==null||isNaN(s=+s)?f:(c||(c=o(n.map(e),r,t)))(e(a(s)))}return l.invert=function(s){return a(u((i||(i=o(r,n.map(e),p)))(s)))},l.domain=function(s){return arguments.length?(n=Array.from(s,_),h()):n.slice()},l.range=function(s){return arguments.length?(r=Array.from(s),h()):r.slice()},l.rangeRound=function(s){return r=Array.from(s),t=U,h()},l.clamp=function(s){return arguments.length?(a=s?!0:m,h()):a!==m},l.interpolate=function(s){return arguments.length?(t=s,h()):t},l.unknown=function(s){return arguments.length?(f=s,l):f},function(s,S){return e=s,u=S,h()}}function un(){return tn()(m,m)}function an(n,r,t,e){var u=G(n,r,t),f;switch(e=F(e??",f"),e.type){case"s":{var a=Math.max(Math.abs(n),Math.abs(r));return e.precision==null&&!isNaN(f=X(u,a))&&(e.precision=f),z(e,a)}case"":case"e":case"g":case"p":case"r":{e.precision==null&&!isNaN(f=Y(u,Math.max(Math.abs(n),Math.abs(r))))&&(e.precision=f-(e.type==="e"));break}case"f":case"%":{e.precision==null&&!isNaN(f=W(u))&&(e.precision=f-(e.type==="%")*2);break}}return B(e)}function on(n){var r=n.domain;return n.ticks=function(t){var e=r();return E(e[0],e[e.length-1],t??10)},n.tickFormat=function(t,e){var u=r();return an(u[0],u[u.length-1],t??10,e)},n.nice=function(t){t==null&&(t=10);var e=r(),u=0,f=e.length-1,a=e[u],o=e[f],c,i,h=10;for(o<a&&(i=a,a=o,o=i,i=u,u=f,f=i);h-- >0;){if(i=y(a,o,t),i===c)return e[u]=a,e[f]=o,r(e);if(i>0)a=Math.floor(a/i)*i,o=Math.ceil(o/i)*i;else if(i<0)a=Math.ceil(a*i)/i,o=Math.floor(o*i)/i;else break;c=i}return n},n}function fn(){var n=un();return n.copy=function(){return en(n,fn())},D.apply(n,arguments),on(n)}export{en as a,R as b,un as c,fn as l,G as t};
2
2