litepaseo 0.9.0 → 0.9.2

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 (104) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +25 -8
  3. package/dist/server/cli.mjs +8 -2
  4. package/dist/server/{worker-CmsAgviJ.mjs → worker-Cq2Lf-Zo.mjs} +169 -21
  5. package/dist/web/assets/{ChangesPanel-DdtJswMt.js → ChangesPanel-BXtRMTqp.js} +1 -1
  6. package/dist/web/assets/ChangesPanel-BXtRMTqp.js.br +0 -0
  7. package/dist/web/assets/ChangesPanel-BXtRMTqp.js.gz +0 -0
  8. package/dist/web/assets/{CodeBlockNode-BOeBLCjf.js → CodeBlockNode-B9X7WZtj.js} +1 -1
  9. package/dist/web/assets/CodeBlockNode-B9X7WZtj.js.br +0 -0
  10. package/dist/web/assets/CodeBlockNode-B9X7WZtj.js.gz +0 -0
  11. package/dist/web/assets/{ConversationSearch-BXfGhrtx.js → ConversationSearch-DgRoYzWP.js} +1 -1
  12. package/dist/web/assets/ConversationSearch-DgRoYzWP.js.br +0 -0
  13. package/dist/web/assets/ConversationSearch-DgRoYzWP.js.gz +0 -0
  14. package/dist/web/assets/{FileViewer-C93qu9YH.js → FileViewer-B-N8t-A2.js} +1 -1
  15. package/dist/web/assets/FileViewer-B-N8t-A2.js.br +0 -0
  16. package/dist/web/assets/FileViewer-B-N8t-A2.js.gz +0 -0
  17. package/dist/web/assets/{FilesPanel-DyqtBDO_.js → FilesPanel-By85fwCy.js} +1 -1
  18. package/dist/web/assets/FilesPanel-By85fwCy.js.br +0 -0
  19. package/dist/web/assets/FilesPanel-By85fwCy.js.gz +0 -0
  20. package/dist/web/assets/{HostSettings-BCsvyF_3.js → HostSettings-Bzv1FBbL.js} +1 -1
  21. package/dist/web/assets/HostSettings-Bzv1FBbL.js.br +0 -0
  22. package/dist/web/assets/HostSettings-Bzv1FBbL.js.gz +0 -0
  23. package/dist/web/assets/{MarkdownMessage-CejBvgRc.js → MarkdownMessage-DbSS5ULZ.js} +5 -5
  24. package/dist/web/assets/MarkdownMessage-DbSS5ULZ.js.br +0 -0
  25. package/dist/web/assets/MarkdownMessage-DbSS5ULZ.js.gz +0 -0
  26. package/dist/web/assets/{PreCodeBlock-BBTzkaAH.js → PreCodeBlock-B-6jTSFa.js} +1 -1
  27. package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-4BQzC8nU.js → PreCodeBlock.vue_vue_type_style_index_0_lang-CunCuyah.js} +1 -1
  28. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-CunCuyah.js.br +0 -0
  29. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-CunCuyah.js.gz +0 -0
  30. package/dist/web/assets/{SubagentsPanel-D1bEm5QC.js → SubagentsPanel-CdZce3Xr.js} +1 -1
  31. package/dist/web/assets/SubagentsPanel-CdZce3Xr.js.br +0 -0
  32. package/dist/web/assets/SubagentsPanel-CdZce3Xr.js.gz +0 -0
  33. package/dist/web/assets/{TerminalPanel-wazWBZjN.js → TerminalPanel-iBK2wpI0.js} +1 -1
  34. package/dist/web/assets/TerminalPanel-iBK2wpI0.js.br +0 -0
  35. package/dist/web/assets/TerminalPanel-iBK2wpI0.js.gz +0 -0
  36. package/dist/web/assets/{Tooltip-CrG6tFax.js → Tooltip-DLPAOJ1c.js} +1 -1
  37. package/dist/web/assets/Tooltip-DLPAOJ1c.js.br +0 -0
  38. package/dist/web/assets/Tooltip-DLPAOJ1c.js.gz +0 -0
  39. package/dist/web/assets/index-DV5BdS_U.js +35 -0
  40. package/dist/web/assets/index-DV5BdS_U.js.br +0 -0
  41. package/dist/web/assets/index-DV5BdS_U.js.gz +0 -0
  42. package/dist/web/assets/{index10-C9Xw5wOS.js → index10-DgcnbLc5.js} +1 -1
  43. package/dist/web/assets/index10-DgcnbLc5.js.br +0 -0
  44. package/dist/web/assets/index10-DgcnbLc5.js.gz +0 -0
  45. package/dist/web/assets/index3-BdNVIlGK.js +1 -0
  46. package/dist/web/assets/index4-DnuPr-1i.js +1 -0
  47. package/dist/web/assets/{index5-Cxc_iCM3.js → index5-Bp-1tRh4.js} +1 -1
  48. package/dist/web/assets/index5-Bp-1tRh4.js.br +0 -0
  49. package/dist/web/assets/index5-Bp-1tRh4.js.gz +0 -0
  50. package/dist/web/assets/{index6-DsTT-iog.js → index6-B8l4-gzx.js} +1 -1
  51. package/dist/web/assets/index6-B8l4-gzx.js.br +0 -0
  52. package/dist/web/assets/index6-B8l4-gzx.js.gz +0 -0
  53. package/dist/web/assets/{index7-Bgw61c0t.js → index7-CIxLf3CP.js} +1 -1
  54. package/dist/web/assets/index7-CIxLf3CP.js.br +0 -0
  55. package/dist/web/assets/index7-CIxLf3CP.js.gz +0 -0
  56. package/dist/web/assets/{index8-DLEM8iM5.js → index8-CnHhIOzI.js} +1 -1
  57. package/dist/web/assets/index8-CnHhIOzI.js.br +0 -0
  58. package/dist/web/assets/index8-CnHhIOzI.js.gz +0 -0
  59. package/dist/web/assets/{index9-CUy1AFI-.js → index9-B_ZyF9x1.js} +1 -1
  60. package/dist/web/assets/index9-B_ZyF9x1.js.br +0 -0
  61. package/dist/web/assets/index9-B_ZyF9x1.js.gz +0 -0
  62. package/dist/web/index.html +1 -1
  63. package/dist/web/index.html.br +0 -0
  64. package/dist/web/index.html.gz +0 -0
  65. package/package.json +1 -1
  66. package/dist/web/assets/ChangesPanel-DdtJswMt.js.br +0 -0
  67. package/dist/web/assets/ChangesPanel-DdtJswMt.js.gz +0 -0
  68. package/dist/web/assets/CodeBlockNode-BOeBLCjf.js.br +0 -0
  69. package/dist/web/assets/CodeBlockNode-BOeBLCjf.js.gz +0 -0
  70. package/dist/web/assets/ConversationSearch-BXfGhrtx.js.br +0 -0
  71. package/dist/web/assets/ConversationSearch-BXfGhrtx.js.gz +0 -0
  72. package/dist/web/assets/FileViewer-C93qu9YH.js.br +0 -0
  73. package/dist/web/assets/FileViewer-C93qu9YH.js.gz +0 -0
  74. package/dist/web/assets/FilesPanel-DyqtBDO_.js.br +0 -0
  75. package/dist/web/assets/FilesPanel-DyqtBDO_.js.gz +0 -0
  76. package/dist/web/assets/HostSettings-BCsvyF_3.js.br +0 -0
  77. package/dist/web/assets/HostSettings-BCsvyF_3.js.gz +0 -0
  78. package/dist/web/assets/MarkdownMessage-CejBvgRc.js.br +0 -0
  79. package/dist/web/assets/MarkdownMessage-CejBvgRc.js.gz +0 -0
  80. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-4BQzC8nU.js.br +0 -0
  81. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-4BQzC8nU.js.gz +0 -0
  82. package/dist/web/assets/SubagentsPanel-D1bEm5QC.js.br +0 -0
  83. package/dist/web/assets/SubagentsPanel-D1bEm5QC.js.gz +0 -0
  84. package/dist/web/assets/TerminalPanel-wazWBZjN.js.br +0 -0
  85. package/dist/web/assets/TerminalPanel-wazWBZjN.js.gz +0 -0
  86. package/dist/web/assets/Tooltip-CrG6tFax.js.br +0 -0
  87. package/dist/web/assets/Tooltip-CrG6tFax.js.gz +0 -0
  88. package/dist/web/assets/index-Cmpdc3EH.js +0 -35
  89. package/dist/web/assets/index-Cmpdc3EH.js.br +0 -0
  90. package/dist/web/assets/index-Cmpdc3EH.js.gz +0 -0
  91. package/dist/web/assets/index10-C9Xw5wOS.js.br +0 -0
  92. package/dist/web/assets/index10-C9Xw5wOS.js.gz +0 -0
  93. package/dist/web/assets/index3-dduGUVTy.js +0 -1
  94. package/dist/web/assets/index4-qdeznE4u.js +0 -1
  95. package/dist/web/assets/index5-Cxc_iCM3.js.br +0 -0
  96. package/dist/web/assets/index5-Cxc_iCM3.js.gz +0 -0
  97. package/dist/web/assets/index6-DsTT-iog.js.br +0 -0
  98. package/dist/web/assets/index6-DsTT-iog.js.gz +0 -0
  99. package/dist/web/assets/index7-Bgw61c0t.js.br +0 -0
  100. package/dist/web/assets/index7-Bgw61c0t.js.gz +0 -0
  101. package/dist/web/assets/index8-DLEM8iM5.js.br +0 -0
  102. package/dist/web/assets/index8-DLEM8iM5.js.gz +0 -0
  103. package/dist/web/assets/index9-CUy1AFI-.js.br +0 -0
  104. package/dist/web/assets/index9-CUy1AFI-.js.gz +0 -0
@@ -1,35 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownMessage-CejBvgRc.js","assets/vue.runtime.esm-bundler-4XjPOHMM.js","assets/rolldown-runtime-XKyaHtl9.js","assets/highlight-BnTrj1LT.js","assets/MarkdownMessage-bqphU8I9.css","assets/HostSettings-BCsvyF_3.js","assets/HostSettings-DmJrFVbt.css","assets/ChangesPanel-DdtJswMt.js","assets/ChangesPanel-BlAOBntI.css","assets/ConversationSearch-BXfGhrtx.js","assets/ConversationSearch-BD_oQkce.css","assets/FilesPanel-DyqtBDO_.js","assets/FilesPanel-B0AM9mBQ.css","assets/FileViewer-C93qu9YH.js","assets/FileViewer-D0xXViyr.css","assets/TerminalPanel-wazWBZjN.js","assets/TerminalPanel-BzfVCEVB.css","assets/SubagentsPanel-D1bEm5QC.js","assets/SubagentsPanel-iAwY_tlt.css"])))=>i.map(i=>d[i]);
2
- import{C as e,F as t,I as n,M as r,N as i,P as a,Q as o,R as s,S as c,T as l,V as u,W as d,X as f,_ as p,a as m,at as h,c as g,ct as _,d as v,et as y,f as b,g as x,h as S,it as C,j as w,k as T,l as E,m as D,nt as O,o as k,p as A,q as j,r as M,s as N,st as P,tt as F,u as I,v as L,w as R,x as z,y as B,z as ee}from"./vue.runtime.esm-bundler-4XjPOHMM.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var V=12e4,H=15e3,te=[`pointerdown`,`keydown`,`wheel`,`touchstart`];function ne(e,t){let r=crypto.randomUUID(),i=0,a=null,o=!1,s=Date.now(),c;function l(n=!1){let u=!n&&!document.hidden&&document.hasFocus(),d=u?e():null,f=u&&Date.now()-s<V;clearInterval(c),t()?((d||a||f||o)&&fetch(`/api/presence`,{method:`PUT`,credentials:`same-origin`,keepalive:!0,headers:{"content-type":`application/json`,"x-litepaseo":`1`},body:JSON.stringify({tab:r,seq:++i,key:d,active:f}),signal:AbortSignal.timeout(1e4)}).catch(()=>{}),a=d,o=f,(d||f)&&(c=setInterval(l,H))):(a=null,o=!1)}let u=()=>l(),d=()=>l(!0),f=()=>{s=Date.now(),o||l()};j(e,u,{immediate:!0,flush:`post`}),document.addEventListener(`visibilitychange`,u),window.addEventListener(`resize`,u),window.addEventListener(`focus`,u),window.addEventListener(`blur`,u),window.addEventListener(`pagehide`,d),window.addEventListener(`pageshow`,u);for(let e of te)window.addEventListener(e,f,{passive:!0,capture:!0});n(()=>{d(),clearInterval(c),document.removeEventListener(`visibilitychange`,u),window.removeEventListener(`resize`,u),window.removeEventListener(`focus`,u),window.removeEventListener(`blur`,u),window.removeEventListener(`pagehide`,d),window.removeEventListener(`pageshow`,u);for(let e of te)window.removeEventListener(e,f,{capture:!0})})}var U=e=>e?e.size:0,W=e=>(e.size=1+U(e.left)+U(e.right),e),G=class{root=null;compare;constructor(e){this.compare=e}get size(){return U(this.root)}clear(){this.root=null}insert(e){let[t,n]=this.split(this.root,e,!1),r={item:e,priority:Math.random(),size:1,left:null,right:null};this.root=this.merge(this.merge(t,r),n)}remove(e){let[t,n]=this.split(this.root,e,!1),[r,i]=this.split(n,e,!0);return this.root=this.merge(t,i),r!==null}at(e){let t=this.root;for(;t;){let n=U(t.left);if(e<n)t=t.left;else if(e===n)return t.item;else e-=n+1,t=t.right}}rank(e){let t=this.root,n=0;for(;t;){let r=this.compare(e,t.item);if(r<0)t=t.left;else if(r>0)n+=U(t.left)+1,t=t.right;else return n+U(t.left)}return-1}range(e,t){let n=[],r=Math.min(this.size,e+t);if(e=Math.max(0,e),e>=r)return n;let i=[],a=this.root,o=e;for(;a;){let e=U(a.left);if(o<e)i.push(a),a=a.left;else if(o===e){i.push(a);break}else o-=e+1,a=a.right}for(;n.length<r-e&&i.length;){let e=i.pop();n.push(e.item);let t=e.right;for(;t;)i.push(t),t=t.left}return n}split(e,t,n){if(!e)return[null,null];let r=this.compare(e.item,t);if(r<0||n&&r===0){let[r,i]=this.split(e.right,t,n);return e.right=r,[W(e),i]}let[i,a]=this.split(e.left,t,n);return e.left=a,[i,W(e)]}merge(e,t){return e?t?e.priority>t.priority?(e.right=this.merge(e.right,t),W(e)):(t.left=this.merge(e,t.left),W(t)):e:t}},re=e=>e?e.size:0,K=e=>e?e.sum:0,ie=e=>(e.size=1+re(e.left)+re(e.right),e.sum=e.weight+K(e.left)+K(e.right),e),ae=class{root=null;compare;constructor(e){this.compare=e}get size(){return re(this.root)}get total(){return K(this.root)}clear(){this.root=null}insert(e,t){let[n,r]=this.split(this.root,e,!1),i={item:e,weight:t,priority:Math.random(),size:1,sum:t,left:null,right:null};this.root=this.merge(this.merge(n,i),r)}remove(e){let[t,n]=this.split(this.root,e,!1),[r,i]=this.split(n,e,!0);return this.root=this.merge(t,i),r!==null}reweigh(e,t){this.remove(e)&&this.insert(e,t)}at(e){let t=this.root;for(;t;){let n=re(t.left);if(e<n)t=t.left;else if(e===n)return t.item;else e-=n+1,t=t.right}}locate(e){let t=this.root,n=0,r=0;if(!t)return null;for(e=Math.max(0,Math.min(e,this.total-1e-9));t;){let i=K(t.left);if(e<i)t=t.left;else if(e<i+t.weight||!t.right)return{item:t.item,rank:n+re(t.left),start:r+i};else e-=i+t.weight,r+=i+t.weight,n+=re(t.left)+1,t=t.right}return null}offsetOf(e){let t=this.root,n=0;for(;t;){let r=this.compare(e,t.item);if(r<0)t=t.left;else if(r>0)n+=K(t.left)+t.weight,t=t.right;else return n+K(t.left)}return-1}split(e,t,n){if(!e)return[null,null];let r=this.compare(e.item,t);if(r<0||n&&r===0){let[r,i]=this.split(e.right,t,n);return e.right=r,[ie(e),i]}let[i,a]=this.split(e.left,t,n);return e.left=a,[i,ie(e)]}merge(e,t){return e?t?e.priority>t.priority?(e.right=this.merge(e.right,t),ie(e)):(t.left=this.merge(e,t.left),ie(t)):e:t}},oe=[`needs_input`,`running`,`review`,`done`],q=e=>e===`failed`||e===`unread`?`review`:e,se=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e,J=typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches?44:36,ce=(e,t)=>e.key<t.key?-1:+(e.key>t.key);function le(e,t){return t.activityAt-e.activityAt||ce(e,t)}function ue(e,t){let n=e.pinnedAt??0,r=t.pinnedAt??0;return n||r?n?r?n-r||ce(e,t):-1:1:le(e,t)}function de(e){return e.attention?`needs_input`:e.failed?`failed`:e.running?`running`:e.unread?`unread`:`done`}var fe=e=>`${e.hostId}\n${e.project.toLowerCase()}`,pe=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),me=(e,t)=>(e.pinnedAt||t.pinnedAt?e.pinnedAt?t.pinnedAt?e.pinnedAt-t.pinnedAt||pe.compare(e.key,t.key):-1:1:0)||t.recent-e.recent||pe.compare(e.name,t.name)||(e.key<t.key?-1:+(e.key>t.key)),he=e=>e.state??(e.status===`running`?`running`:`done`),ge=class{flat;groups=new Map;index=new ae(me);lanes;waiting=0;compare;isCollapsed;pinRank;constructor(e,t,n){this.pinRank=n,this.compare=e,this.isCollapsed=t,this.flat=new G(e),this.lanes=new Map(oe.map(e=>[e,new G(le)]))}get size(){return this.flat.size}weight(e){return 36+(this.isCollapsed(e.key)?0:e.items.size*J)}add(e){this.flat.insert(e),this.lanes.get(q(he(e))).insert(e);let t=fe(e),n=this.groups.get(t);n?this.index.remove(n):(n={key:t,name:e.project,items:new G(this.compare),byRecency:this.compare===le?null:new G(le),recent:0,attention:0,failed:0,running:0,unread:0,hosts:new Map},this.groups.set(t,n)),n.items.insert(e),n.byRecency?.insert(e),this.count(n,e,1),this.reinsert(n)}remove(e){if(!this.flat.remove(e))return;this.lanes.get(q(he(e))).remove(e);let t=this.groups.get(fe(e));t&&(this.index.remove(t),t.items.remove(e),t.byRecency?.remove(e),this.count(t,e,-1),t.items.size?this.reinsert(t):this.groups.delete(t.key))}refresh(e){let t=this.groups.get(e);t&&this.index.reweigh(t,this.weight(t))}clear(){this.flat.clear(),this.groups.clear(),this.index.clear();for(let e of this.lanes.values())e.clear();this.waiting=0}rows(e,t){let n=[],r=e+t,i=this.index.locate(Math.max(0,e));if(!i)return n;let a=i.rank,o=i.start;for(;o<r;){let t=this.index.at(a++);if(!t)break;let i=this.isCollapsed(t.key);if(o+36>e&&n.push({kind:`group`,key:`g:`+t.key,top:o,group:t,collapsed:i}),!i){let i=o+36,a=Math.max(0,Math.floor((e-i)/J)),s=Math.min(t.items.size,Math.ceil((r-i)/J));s>a&&t.items.range(a,s-a).forEach((e,t)=>n.push({kind:`item`,key:e.key,top:i+(a+t)*J,item:e}))}o+=this.weight(t)}return n}reinsert(e){e.recent=(e.byRecency??e.items).at(0).activityAt,this.index.insert(e,this.weight(e))}count(e,t,n){let r=this.pinRank(t);if(r){let t=e.pinRanks??=new Map,i=(t.get(r)??0)+n;i>0?t.set(r,i):t.delete(r),e.pinnedAt=t.size?Math.min(...t.keys()):0}let i=(e.hosts.get(t.hostId)??0)+n;i>0?e.hosts.set(t.hostId,i):e.hosts.delete(t.hostId),t.attention&&(e.attention+=n,this.waiting+=n);let a=he(t);a===`failed`?e.failed+=n:a===`running`?e.running+=n:a===`unread`&&(e.unread+=n)}},_e=class{generation=``;seq=-1;projectPins={};pinRank=e=>e.projectId?this.projectPins[JSON.stringify([e.hostId,e.projectId])]??0:0;setProjectPins(e){this.projectPins=e,this.all.clear();for(let e of this.byHost.values())e.clear();this.filtered=null;for(let e of this.byKey.values())this.all.add(e),this.hostView(e.hostId).add(e);this.predicate&&this.rebuildFiltered(),this.version.value++}byKey=new Map;collapsed;compare;all;byHost=new Map;host=null;filtered=null;predicate=null;persist;indexOf;buckets=new Map;version=O(0);constructor(e={}){this.collapsed=new Set(e.collapsed),this.persist=e.persist??(()=>{}),this.compare=e.compare??le,this.indexOf=e.indexBy??null,this.all=new ge(this.compare,this.collapsedFn,this.pinRank)}collapsedFn=e=>this.collapsed.has(e);get base(){return this.host===null?this.all:this.hostView(this.host)}get view(){return this.filtered??this.base}hostView(e){let t=this.byHost.get(e);return t||this.byHost.set(e,t=new ge(this.compare,this.collapsedFn,this.pinRank)),t}get size(){return this.view.size}get total(){return this.byKey.size}get waiting(){return this.all.waiting}get projectCount(){return this.view.groups.size}get hostFilter(){return this.host}hostSize(e){return this.byHost.get(e)?.size??0}get(e){return e?this.byKey.get(e):void 0}indexed(e,t=1){return e?this.buckets.get(e)?.range(0,t)??[]:[]}indexedSize(e){return e?this.buckets.get(e)?.size??0:0}range(e,t){return this.view.flat.range(e,t)}allLaneSize(e){return this.all.lanes.get(e).size}laneSize(e){return this.view.lanes.get(e).size}laneRange(e,t,n){return this.view.lanes.get(e).range(t,n)}get groupedHeight(){return this.view.index.total}groupedRows(e,t){return this.view.rows(e,t)}isCollapsed(e){return!this.filtered&&this.collapsed.has(e)}toggleGroup(e){if(!this.filtered){this.collapsed.has(e)?this.collapsed.delete(e):this.collapsed.add(e),this.all.refresh(e);for(let t of this.byHost.values())t.refresh(e);this.persist([...this.collapsed]),this.version.value++}}setHost(e){e!==this.host&&(this.host=e,this.predicate&&this.rebuildFiltered(),this.version.value++)}setFilter(e){this.predicate=e,e?this.rebuildFiltered():this.filtered=null,this.version.value++}applyCollection(e){if(e.type===`snapshot`){this.byKey.clear(),this.all.clear();for(let e of this.byHost.values())e.clear();this.filtered?.clear(),this.buckets.clear();for(let t of e.items)this.put(t)}else{if(e.generation!==this.generation)return;for(let t of e.changes){let e=this.byKey.get(t.key);e&&(this.all.remove(e),this.byHost.get(e.hostId)?.remove(e),this.filtered?.remove(e),this.unbucket(e)),t.value?this.put(t.value):this.byKey.delete(t.key)}}this.generation=e.generation,this.seq=e.seq,this.version.value++}apply(e){e.type===`snapshot`?this.applyCollection({type:`snapshot`,generation:e.generation,seq:e.seq,items:e.agents}):e.type===`changes`&&this.applyCollection({type:`changes`,generation:e.generation,seq:e.seq,changes:e.changes})}matches(e){return(this.host===null||e.hostId===this.host)&&this.predicate(e)}rebuildFiltered(){let e=new ge(this.compare,()=>!1,this.pinRank),t=this.base;for(let n of t.flat.range(0,t.size))this.predicate(n)&&e.add(n);this.filtered=e}bucketsOf(e){let t=this.indexOf?this.indexOf(e):null;return Array.isArray(t)?t:[t]}unbucket(e){for(let t of this.bucketsOf(e)){if(!t)continue;let n=this.buckets.get(t);n&&(n.remove(e),n.size||this.buckets.delete(t))}}put(e){this.byKey.set(e.key,e),this.all.add(e),this.hostView(e.hostId).add(e),this.filtered&&this.matches(e)&&this.filtered.add(e);for(let t of this.bucketsOf(e)){if(!t)continue;let n=this.buckets.get(t);n||this.buckets.set(t,n=new G(le)),n.insert(e)}}},ve=[`width`,`height`],ye=[`d`],Y=l({__name:`Icon`,props:{name:{},size:{}},setup(e){let t={chat:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,board:`M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM9 3v18M15 3v12`,server:`M4 3h16a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1zM4 13h16a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1zM7 7h.01M7 17h.01`,search:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.35-4.35`,back:`M15 18l-6-6 6-6`,send:`M12 19V5M5 12l7-7 7 7`,stop:`M7.5 5h9A2.5 2.5 0 0 1 19 7.5v9a2.5 2.5 0 0 1-2.5 2.5h-9A2.5 2.5 0 0 1 5 16.5v-9A2.5 2.5 0 0 1 7.5 5z`,plus:`M12 5v14M5 12h14`,close:`M18 6 6 18M6 6l12 12`,check:`M20 6 9 17l-5-5`,mic:`M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3zM19 10v2a7 7 0 0 1-14 0v-2M12 19v3`,eye:`M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`,bulb:`M9 18h6M10 21.5h4M12 2.5a6.5 6.5 0 0 0-3.9 11.7c.6.5.9 1.2.9 2V16h6v-.3c0-.8.3-1.5.9-2A6.5 6.5 0 0 0 12 2.5z`,npm:`M2 8.5h20v7H12v2H8v-2H2zM5.5 11v4.5M8.5 11h1.5v6M12.5 11h7v4.5M16 11v4.5`,js:`M12 2.5l8.5 4.75v9.5L12 21.5l-8.5-4.75v-9.5zM10.5 9v4.75a1.6 1.6 0 0 1-3 .75M16.6 9.6c-.5-.6-2.6-.9-2.6.6 0 1.6 2.8 1.1 2.8 2.7 0 1.5-2.2 1.4-3 .5`,clock:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 7v5l3 2`,hourglass:`M5 22h14M5 2h14M17 22v-4.2a2 2 0 0 0-.6-1.4L12 12l-4.4 4.4a2 2 0 0 0-.6 1.4V22M7 2v4.2a2 2 0 0 0 .6 1.4L12 12l4.4-4.4a2 2 0 0 0 .6-1.4V2`,undo:`M9 14 4 9l5-5M4 9h10.5a5.5 5.5 0 0 1 0 11H11`,layers:`M12 2 2 7l10 5 10-5zM2 17l10 5 10-5M2 12l10 5 10-5`,sliders:`M4 7h9M17 7h3M4 17h3M11 17h9M15 5v4M9 15v4`,panel:`M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2zM15 3v18`,play:`M7 4.5v15l12-7.5z`,pause:`M8 5v14M16 5v14`,copy:`M9 9h11a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V10a1 1 0 0 1 1-1zM5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1`,terminal:`M4 17l6-6-6-6M12 19h8`,file:`M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6`,edit:`M12 20h9M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4z`,globe:`M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z`,bot:`M12 8V4H8M4 8h16a0 0 0 0 1 0 0v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8zM2 14h2M20 14h2M9 13v2M15 13v2`,tool:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z`,brain:`M9 3a3 3 0 0 0-3 3 3 3 0 0 0-2 5 3 3 0 0 0 2 5 3 3 0 0 0 3 3 3 3 0 0 0 3-3V6a3 3 0 0 0-3-3zM15 3a3 3 0 0 1 3 3 3 3 0 0 1 2 5 3 3 0 0 1-2 5 3 3 0 0 1-3 3 3 3 0 0 1-3-3`,alert:`M12 9v4M12 17h.01M10.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`,"shield-off":`M2 2l20 20M9.5 3 12 2l8 3v7c0 1.2-.3 2.4-.8 3.5M4 5v7c0 6 8 10 8 10s2.5-1.2 4.7-3.4`,shield:`M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z`,trash:`M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6`,chevron:`M9 18l6-6-6-6`,folder:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.7-.9l-.8-1.2A2 2 0 0 0 7.9 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z`,list:`M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01`,sun:`M12 16a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41`,moon:`M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9z`,monitor:`M4 4h16a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM8 21h8M12 17v4`,bell:`M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9M10.3 21a1.94 1.94 0 0 0 3.4 0`,phone:`M7 2h10a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2zM11 18h2`,gear:`M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM19.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 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.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 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.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 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 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 19.4 9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`,bolt:`M13 2 3 14h9l-1 8 10-12h-9l1-8z`,refresh:`M21 12a9 9 0 1 1-3-6.7L21 8M21 3v5h-5`,pin:`M12 17v5M9 10.76V6a3 3 0 0 1 6 0v4.76a2 2 0 0 0 1.11 1.79l1.78.9A2 2 0 0 1 19 15.24V16a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-.76a2 2 0 0 1 1.11-1.79l1.78-.9A2 2 0 0 0 9 10.76z`,more:`M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM19 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM5 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2z`,"more-v":`M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM12 6a1 1 0 1 0 0-2 1 1 0 0 0 0 2zM12 20a1 1 0 1 0 0-2 1 1 0 0 0 0 2z`,archive:`M21 8v13H3V8M1 3h22v5H1zM10 12h4`,dot:`M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`,branch:`M6 3v12M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 9a9 9 0 0 1-9 9`,sparkle:`M12 3l1.9 5.8L20 11l-6.1 2.2L12 19l-1.9-5.8L4 11l6.1-2.2z`};return(n,r)=>(s(),B(`svg`,{class:`icon`,width:e.size??16,height:e.size??16,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.75`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[x(`path`,{d:t[e.name]??t.tool},null,8,ye)],8,ve))}}),be=[`aria-label`],xe={class:`menu-title`},Se=l({__name:`ThreadMenu`,props:{thread:{},x:{},y:{}},emits:[`close`,`rename`,`pin`,`unread`,`read`,`archive`],setup(r,{emit:i}){let a=r,o=i,l=F(null),u=F({left:a.x,top:a.y});function d(e){e(),o(`close`)}function f(e){e.key===`Escape`&&o(`close`)}function p(e){l.value&&!l.value.contains(e.target)&&o(`close`)}return t(()=>{w(()=>{let e=l.value;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect();u.value={left:Math.max(8,Math.min(a.x,innerWidth-t-8)),top:Math.max(8,Math.min(a.y,innerHeight-n-8))},e.querySelector(`button`)?.focus()}),window.addEventListener(`keydown`,f),setTimeout(()=>window.addEventListener(`pointerdown`,p),0)}),n(()=>{window.removeEventListener(`keydown`,f),window.removeEventListener(`pointerdown`,p)}),(t,n)=>(s(),B(`div`,{ref_key:`element`,ref:l,class:`menu`,role:`menu`,"aria-label":`Actions for `+r.thread.name,style:P({left:u.value.left+`px`,top:u.value.top+`px`})},[x(`div`,xe,_(r.thread.name),1),x(`button`,{role:`menuitem`,onClick:n[0]||=e=>d(()=>o(`rename`,r.thread))},[e(Y,{name:`edit`,size:14}),n[5]||=c(`Rename…`,-1)]),x(`button`,{role:`menuitem`,onClick:n[1]||=e=>d(()=>o(`pin`,r.thread,!r.thread.pinnedAt))},[e(Y,{name:`pin`,size:14}),c(_(r.thread.pinnedAt?`Unpin`:`Pin to top`),1)]),r.thread.unread?(s(),B(`button`,{key:0,role:`menuitem`,onClick:n[2]||=e=>d(()=>o(`read`,r.thread))},[e(Y,{name:`check`,size:14}),n[6]||=c(`Mark as read `,-1)])):(s(),B(`button`,{key:1,role:`menuitem`,onClick:n[3]||=e=>d(()=>o(`unread`,r.thread))},[e(Y,{name:`dot`,size:14}),n[7]||=c(`Mark as unread `,-1)])),n[9]||=x(`div`,{class:`menu-sep`},null,-1),x(`button`,{role:`menuitem`,class:`menu-danger`,onClick:n[4]||=e=>d(()=>o(`archive`,r.thread))},[e(Y,{name:`archive`,size:14}),n[8]||=c(`Archive… `,-1)])],12,be))}}),Ce={class:`sheet-head`},we={class:`sheet-body`},Te={class:`field`},Ee=[`placeholder`],De={class:`row-sub`},Oe={class:`sheet-foot`},ke=[`disabled`],Ae=[`disabled`],je=[`disabled`],Me=l({__name:`RenameThread`,props:{thread:{},busy:{type:Boolean}},emits:[`close`,`save`],setup(n,{emit:r}){let i=n,a=r,o=F(i.thread.title??i.thread.name),c=F(null);t(()=>w(()=>{c.value?.focus(),c.value?.select()}));function l(){let e=o.value.trim();a(`save`,e||null)}return(t,r)=>(s(),B(`div`,{class:`overlay`,onMousedown:r[4]||=v(e=>!n.busy&&a(`close`),[`self`]),onKeydown:r[5]||=I(e=>a(`close`),[`esc`])},[x(`form`,{class:`sheet sheet-small`,role:`dialog`,"aria-modal":`true`,"aria-label":`Rename thread`,onSubmit:v(l,[`prevent`])},[x(`header`,Ce,[r[6]||=x(`h2`,null,`Rename thread`,-1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:r[0]||=e=>a(`close`)},[e(Y,{name:`close`,size:16})])]),x(`div`,we,[x(`label`,Te,[r[7]||=x(`span`,null,`Name`,-1),f(x(`input`,{ref_key:`input`,ref:c,"onUpdate:modelValue":r[1]||=e=>o.value=e,maxlength:`200`,placeholder:n.thread.name},null,8,Ee),[[g,o.value]])]),x(`p`,De,_(n.thread.project)+_(n.thread.branch?` · `+n.thread.branch:``),1)]),x(`footer`,Oe,[n.thread.title?(s(),B(`button`,{key:0,type:`button`,class:`btn btn-ghost sheet-reset`,disabled:n.busy,onClick:r[2]||=e=>a(`save`,null)},` Reset to default `,8,ke)):L(``,!0),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:n.busy,onClick:r[3]||=e=>a(`close`)},`Cancel`,8,Ae),x(`button`,{class:`btn btn-primary`,disabled:n.busy||!o.value.trim()},`Save`,8,je)])],32)],32))}}),Ne=[`aria-label`],Pe={class:`menu-title`},Fe=l({__name:`ProjectMenu`,props:{name:{},pinned:{type:Boolean},host:{},x:{},y:{}},emits:[`close`,`settings`,`remove`,`pin`],setup(r,{emit:i}){let a=r,o=i,l=F(null),u=F({left:a.x,top:a.y});function d(e){o(e===`settings`?`settings`:e===`pin`?`pin`:`remove`),o(`close`)}function f(e){e.key===`Escape`&&o(`close`)}function p(e){l.value&&!l.value.contains(e.target)&&o(`close`)}return t(()=>{w(()=>{let e=l.value;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect();u.value={left:Math.max(8,Math.min(a.x,innerWidth-t-8)),top:Math.max(8,Math.min(a.y,innerHeight-n-8))},e.querySelector(`button`)?.focus()}),window.addEventListener(`keydown`,f),setTimeout(()=>window.addEventListener(`pointerdown`,p),0)}),n(()=>{window.removeEventListener(`keydown`,f),window.removeEventListener(`pointerdown`,p)}),(t,n)=>(s(),B(`div`,{ref_key:`element`,ref:l,class:`menu`,role:`menu`,"aria-label":`Actions for project `+r.name,style:P({left:u.value.left+`px`,top:u.value.top+`px`})},[x(`div`,Pe,_(r.name)+` · `+_(r.host),1),x(`button`,{role:`menuitem`,onClick:n[0]||=e=>d(`pin`)},[e(Y,{name:`pin`,size:14}),c(_(r.pinned?`Unpin project`:`Pin project`),1)]),x(`button`,{role:`menuitem`,onClick:n[1]||=e=>d(`settings`)},[e(Y,{name:`sliders`,size:14}),n[3]||=c(`Project settings…`,-1)]),n[5]||=x(`div`,{class:`menu-sep`},null,-1),x(`button`,{role:`menuitem`,class:`menu-danger`,onClick:n[2]||=e=>d(`remove`)},[e(Y,{name:`trash`,size:14}),n[4]||=c(`Remove project…`,-1)])],12,Ne))}}),Ie=[`src`],Le=F(new Set),Re=[`#4f7cc2`,`#5a9e6f`,`#c27a4f`,`#9a6fc2`,`#c25a7a`,`#4fa7b0`,`#b09a3f`],ze=e=>{let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return Re[t%Re.length]},X=e=>(Array.from(e.trim())[0]??`?`).toUpperCase();function Be(e){if(!e.rootPath)return null;let t=`/api/hosts/${encodeURIComponent(e.hostId)}/project-icon?cwd=${encodeURIComponent(e.rootPath)}`;return e.projectId&&(t+=`&project=${encodeURIComponent(e.projectId)}&v=${encodeURIComponent(e.projectIconRevision??``)}`),t}var Ve=l({__name:`ProjectIcon`,props:{name:{},source:{},src:{},size:{}},setup(e){let t=e,n=S(()=>{if(t.src!==void 0)return t.src;let e=t.source?Be(t.source):null;return e&&!Le.value.has(e)?e:null});function r(){let e=n.value;e&&t.src===void 0&&!Le.value.has(e)&&(Le.value=new Set(Le.value).add(e))}return(t,i)=>(s(),B(`span`,{class:`group-icon`,style:P({...n.value?{}:{background:ze(e.name)},...e.size?{width:e.size+`px`,height:e.size+`px`,fontSize:Math.round(e.size*.55)+`px`,borderRadius:Math.round(e.size*.28)+`px`}:{}})},[n.value?(s(),B(`img`,{key:0,src:n.value,alt:``,loading:`lazy`,onError:r},null,40,Ie)):(s(),B(b,{key:1},[c(_(X(e.name)),1)],64))],4))}}),He=[`onKeydown`],Ue={class:`sheet-head`},We={class:`sheet-body`},Ge={class:`field`},Z=[`value`,`placeholder`,`disabled`],Ke={key:0,class:`ps-field-error`,role:`alert`},qe={key:1,class:`field`},Je={class:`pe-icon-row`},Ye=[`disabled`],Xe=[`disabled`],Ze=[`value`,`disabled`],Qe={key:0,class:`pe-hint`},$e={key:1,class:`ps-field-error pe-icon-error`,role:`alert`},et={class:`sheet-foot`},tt=[`disabled`],nt=[`disabled`],rt=524288,it=l({__name:`ProjectEdit`,props:{hostId:{},rootPath:{},project:{},customIcons:{type:Boolean},request:{type:Function}},emits:[`close`,`saved`],setup(n,{emit:r}){let i=n,a=r,o=F(i.project.customName??``),c=F(``),l=F(null),u=F(`unchanged`),d=F(null),f=F(!1),p=F(null),m=F(null),h=S(()=>!!i.project.iconRevision),g=S(()=>{let e=o.value.trim()||null;return e===i.project.customName?null:{customName:e}}),y=S(()=>u.value===`automatic`?h.value?{type:`automatic`}:null:u.value===`upload`&&l.value?{type:`upload`,data:l.value.data}:u.value===`url`&&c.value.trim()?{type:`url`,url:c.value.trim()}:null),b=S(()=>y.value?y.value.type!==`automatic`:h.value),C=S(()=>!f.value&&!!(g.value||y.value)),T=S(()=>u.value===`automatic`?null:u.value===`upload`&&l.value?`data:${l.value.mimeType};base64,${l.value.data}`:void 0);function E(e){o.value=e,d.value=null}function D(e){c.value=e,u.value=e.trim()?`url`:l.value?`upload`:`unchanged`,d.value=null}function O(){m.value?.click()}async function k(e){let t=e.target,n=t.files?.[0];if(t.value=``,!n)return;if(n.size>rt){d.value={scope:`icon`,message:`Icon must be 512 KB or smaller`};return}let r=new Uint8Array(await n.arrayBuffer()),i=``;for(let e=0;e<r.length;e+=32768)i+=String.fromCharCode(...r.subarray(e,e+32768));l.value={fileName:n.name,mimeType:n.type||`image/png`,data:btoa(i)},u.value=`upload`,d.value=null}function A(){l.value=null,c.value=``,u.value=h.value?`automatic`:`unchanged`,d.value=null}async function j(){if(C.value){f.value=!0,d.value=null;try{await i.request(`/hosts/${encodeURIComponent(i.hostId)}/projects/${encodeURIComponent(i.project.projectId)}/edit`,`POST`,{rename:g.value,icon:y.value},4e4),a(`saved`),a(`close`)}catch(e){let t=e;d.value={scope:t.scope===`icon`?`icon`:`name`,message:t.message}}finally{f.value=!1}}}function M(){f.value||a(`close`)}return t(()=>w(()=>p.value?.focus())),(t,r)=>(s(),B(`div`,{class:`overlay ps-script-overlay`,onMousedown:v(M,[`self`]),onKeydown:I(v(M,[`stop`]),[`esc`])},[x(`form`,{class:`sheet sheet-small`,role:`dialog`,"aria-modal":`true`,"aria-label":`Edit project`,onSubmit:v(j,[`prevent`])},[x(`header`,Ue,[r[2]||=x(`h2`,null,`Edit project`,-1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:M},[e(Y,{name:`close`,size:16})])]),x(`div`,We,[x(`label`,Ge,[r[3]||=x(`span`,null,`Name`,-1),x(`input`,{ref_key:`nameInput`,ref:p,value:o.value,placeholder:n.project.name,disabled:f.value,maxlength:`200`,autocapitalize:`off`,autocomplete:`off`,spellcheck:`false`,"aria-label":`Project name`,onInput:r[0]||=e=>E(e.target.value)},null,40,Z)]),d.value?.scope===`name`?(s(),B(`p`,Ke,_(d.value.message),1)):L(``,!0),n.customIcons?(s(),B(`div`,qe,[r[4]||=x(`span`,null,`Icon`,-1),x(`div`,Je,[e(Ve,{name:n.project.name,size:40,src:T.value,source:{hostId:n.hostId,rootPath:n.rootPath,projectId:n.project.projectId,projectIconRevision:n.project.iconRevision}},null,8,[`name`,`src`,`source`]),x(`button`,{type:`button`,class:`btn btn-outline`,disabled:f.value,onClick:O},`Choose image`,8,Ye),b.value?(s(),B(`button`,{key:0,type:`button`,class:`btn btn-ghost`,disabled:f.value,onClick:A},`Use automatic`,8,Xe)):L(``,!0),x(`input`,{ref_key:`fileInput`,ref:m,class:`pe-file`,type:`file`,accept:`image/png,image/jpeg,image/gif,image/webp,image/x-icon,.ico`,tabindex:`-1`,"aria-hidden":`true`,onChange:k},null,544)]),x(`input`,{class:`pe-url`,value:c.value,type:`url`,inputmode:`url`,placeholder:`Image or website URL`,"aria-label":`Image or website URL`,disabled:f.value,autocapitalize:`off`,autocomplete:`off`,spellcheck:`false`,onInput:r[1]||=e=>D(e.target.value)},null,40,Ze),u.value===`upload`&&l.value?(s(),B(`p`,Qe,_(l.value.fileName),1)):L(``,!0),d.value?.scope===`icon`?(s(),B(`p`,$e,_(d.value.message),1)):L(``,!0)])):L(``,!0)]),x(`footer`,et,[x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:f.value,onClick:M},`Cancel`,8,tt),x(`button`,{class:`btn btn-primary`,disabled:!C.value},_(f.value?`Saving…`:`Save changes`),9,nt)])],32)],40,He))}}),at=[`branchName`,`commitMessage`,`pullRequest`],ot=`service`,st=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function ct(e){return typeof e==`string`?{text:e,kind:`string`}:Array.isArray(e)?{text:e.filter(e=>typeof e==`string`).join(`
3
- `),kind:`array`}:{text:``,kind:`missing`}}function lt(e,t){let n=e.split(`
4
- `).filter(e=>e.trim());if(n.length)return t===`string`?n.join(`
5
- `):t===`array`?n:n.length===1?n[0]:n}function ut(e){return typeof e==`number`&&Number.isFinite(e)?String(e):typeof e==`string`?e:``}function dt(e){let t=e.trim();if(t)return/^[0-9]+$/.test(t)?Number(t):t}var ft=0,pt=()=>`script-${++ft}`;function mt(e){let t=st(e?.worktree)?e.worktree:{},n=ct(t.setup),r=ct(t.teardown),i=Object.entries(st(e?.scripts)?e.scripts:{}).map(([e,t])=>{let n=st(t)?t:{},r=ct(n.command);return{id:pt(),name:e,commandText:r.text,commandKind:r.kind,type:typeof n.type==`string`?n.type:``,portText:ut(n.port),raw:n}}),a=st(e?.metadataGeneration)?e.metadataGeneration:void 0,o={branchName:``,commitMessage:``,pullRequest:``};for(let e of at){let t=a?.[e];st(t)&&typeof t.instructions==`string`&&(o[e]=t.instructions)}return{setupText:n.text,setupKind:n.kind,teardownText:r.text,teardownKind:r.kind,scripts:i,prompts:o,metadataBase:a}}var ht=(e,t,n)=>{n===void 0?delete e[t]:e[t]=n};function gt(e,t){let n={...t??{}},r={...st(n.worktree)?n.worktree:{}};ht(r,`setup`,lt(e.setupText,e.setupKind)),ht(r,`teardown`,lt(e.teardownText,e.teardownKind));let i={};for(let t of e.scripts){let e=t.name.trim();if(!e)continue;let n={...t.raw};ht(n,`command`,lt(t.commandText,t.commandKind)),ht(n,`type`,t.type.trim()||void 0),ht(n,`port`,dt(t.portText)),i[e]=n}let a={...e.metadataBase??{}};for(let t of at){let n=e.prompts[t],r={...st(e.metadataBase?.[t])?e.metadataBase[t]:{}};n.trim()?r.instructions=n:delete r.instructions,ht(a,t,Object.keys(r).length?r:void 0)}return ht(n,`worktree`,Object.keys(r).length?r:void 0),ht(n,`scripts`,Object.keys(i).length?i:void 0),ht(n,`metadataGeneration`,Object.keys(a).length?a:void 0),n}function _t(e){return{name:e.name.trim()?``:`Name is required`,command:e.commandText.trim()?``:`Command is required`}}var vt=e=>{let t=_t(e);return!t.name&&!t.command};function yt(e){return[e.type,e.portText&&`port ${e.portText}`,e.commandText.split(`
6
- `)[0]].filter(Boolean).join(` · `)}var bt={class:`sheet-head`},xt={class:`ps-title`},St={class:`ps-title-row`},Ct={class:`path-hint`},wt={key:0,class:`sheet-note`},Tt={key:1,class:`ps-callout is-error`,role:`alert`},Et={class:`ps-group`,"aria-labelledby":`ps-worktree`},Dt={class:`ps-section`},Ot={key:0,class:`ps-callout is-warn`},kt={class:`ps-section`},At={class:`ps-group`,"aria-labelledby":`ps-scripts`},jt={class:`ps-group-head`},Mt={class:`card ps-scripts`},Nt={key:0,class:`card-row row-sub`},Pt=[`onClick`],Ft={class:`row-title`},It={class:`row-sub`},Lt={class:`ps-script-more`},Rt=[`aria-label`,`onClick`],zt=[`onClick`],Bt=[`onClick`],Vt={class:`ps-group`,"aria-labelledby":`ps-metadata`},Ht={class:`ps-section-head`},Ut=[`for`],Wt=[`id`,`onUpdate:modelValue`,`placeholder`],Gt={key:0,class:`ps-callout is-error`,role:`alert`},Kt={key:1,class:`ps-callout is-error`,role:`alert`},Q={class:`sheet-foot`},qt={key:0,class:`sheet-note sheet-reset ps-saved`},Jt={key:1,class:`sheet-note sheet-reset ps-saved`},Yt=[`disabled`],Xt=[`disabled`],Zt=[`onKeydown`],Qt=[`aria-label`],$t={class:`sheet-head`},en={class:`sheet-body`},tn={class:`field`},nn={key:0,class:`ps-field-error`},rn={class:`field`},an={key:1,class:`ps-field-error`},on={class:`switch-row ps-service`},sn=[`checked`],cn=`https://paseo.sh/docs/worktrees`,ln=l({__name:`ProjectSettings`,props:{hostId:{},hostLabel:{},project:{},rootPath:{},customIcons:{type:Boolean},request:{type:Function}},emits:[`close`],setup(n,{emit:r}){let i=n,a=r,o={branchName:{title:`Branch names`,placeholder:`Prefix branches with feat/ or fix/, mb/ for personal branches`},commitMessage:{title:`Commit messages`,placeholder:`Use Conventional Commits with a scope`},pullRequest:{title:`Pull requests`,placeholder:`Lead with a one-paragraph summary, include a Test plan section`}},l=F(!0),d=F(!1),m=F(``),T=F(null),E=F(!1),D=F(!1),O=F(!1),k=F(null),A=F(mt(null)),M=F(``),N=S(()=>`/hosts/${encodeURIComponent(i.hostId)}/project-config`),P=e=>e.replace(/^\/(home|Users)\/[^/]+(?=\/|$)/,`~`),R=S(()=>JSON.stringify(gt(A.value,k.value?.config))),z=S(()=>!!k.value&&R.value!==M.value),ee=S(()=>A.value.scripts.some(e=>!vt(e))),V=S(()=>T.value?.code===`stale_project_config`);j(R,()=>E.value=O.value=!1);function H(e){k.value=e,A.value=mt(e.config),M.value=JSON.stringify(gt(A.value,e.config))}async function te(){l.value=!0,m.value=``,T.value=null;try{H(await i.request(`${N.value}?root=${encodeURIComponent(i.rootPath)}`))}catch(e){m.value=String(e.message)}finally{l.value=!1}}async function ne(){if(!(!k.value||d.value||V.value||ee.value)){d.value=!0,T.value=null;try{H(await i.request(N.value,`PUT`,{root:k.value.rootPath,config:gt(A.value,k.value.config),revision:k.value.revision})),E.value=!0}catch(e){let t=e;T.value={code:t.code??``,message:t.message}}finally{d.value=!1}}}function U(){if(!d.value){if(D.value)return void(D.value=!1);if(W.value)return se();(!z.value||confirm(`Discard your unsaved project settings?`))&&a(`close`)}}let W=F(null),G=y({name:!1,command:!1}),re=F(null),K=F(null),ie=S(()=>{let e=W.value;if(!e)return{name:``,command:``};let t=_t(e),n=e.name.trim();return!t.name&&A.value.scripts.some(t=>t.id!==e.id&&t.name.trim()===n)&&(t.name=`Another script already has this name`),t}),ae=null;function oe(e){re.value=null,W.value=e,ae={name:e.name,commandText:e.commandText,type:e.type},G.name=G.command=!1,w(()=>K.value?.focus())}function q(){let e={id:pt(),name:``,commandText:``,commandKind:`missing`,type:``,portText:``,raw:{}};A.value.scripts.push(e),oe(A.value.scripts[A.value.scripts.length-1])}function se(){let e=W.value;e&&ae&&Object.assign(e,ae),!e||e.name.trim()||e.commandText.trim()||e.type.trim()||e.portText.trim()||(A.value.scripts=A.value.scripts.filter(t=>t.id!==e.id)),W.value=null}function J(){ie.value.name||ie.value.command?G.name=G.command=!0:W.value=null}function ce(e){re.value=null,confirm(`Remove ${e.name||`this script`}?`)&&(A.value.scripts=A.value.scripts.filter(t=>t.id!==e.id))}function le(e){W.value&&(W.value.type=e.target.checked?ot:``)}function ue(e){(e.metaKey||e.ctrlKey)&&e.key===`s`&&(e.preventDefault(),!W.value&&!D.value&&ne())}return t(te),(t,r)=>(s(),B(`div`,{class:`overlay`,onMousedown:v(U,[`self`]),onKeydown:[I(U,[`esc`]),ue]},[x(`form`,{class:`sheet project-settings`,role:`dialog`,"aria-modal":`true`,"aria-label":`Project settings`,onSubmit:v(ne,[`prevent`])},[x(`header`,bt,[x(`div`,xt,[x(`div`,St,[e(Ve,{name:n.project.name,size:28,source:{hostId:n.hostId,rootPath:n.rootPath,projectId:n.project.projectId,projectIconRevision:n.project.iconRevision}},null,8,[`name`,`source`]),x(`h2`,null,_(n.project.name),1),n.project.projectId?(s(),B(`button`,{key:0,type:`button`,class:`icon-btn ps-edit`,"aria-label":`Edit project`,title:`Edit project`,onClick:r[0]||=e=>D.value=!0},[e(Y,{name:`edit`,size:14})])):L(``,!0)]),x(`p`,Ct,[e(Y,{name:`server`,size:12}),c(_(n.hostLabel)+` · `+_(P(n.rootPath)),1)])]),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:U},[e(Y,{name:`close`,size:16})])]),x(`div`,{class:`sheet-body ps-body`,onClick:r[4]||=e=>re.value=null},[l.value?(s(),B(`p`,wt,[...r[11]||=[x(`span`,{class:`spinner`},null,-1),c(` Reading paseo.json…`,-1)]])):m.value?(s(),B(`div`,Tt,[x(`p`,null,[e(Y,{name:`alert`,size:14}),c(_(m.value),1)]),x(`button`,{type:`button`,class:`btn btn-outline`,onClick:te},`Reload`)])):(s(),B(b,{key:2},[x(`section`,Et,[r[16]||=x(`h3`,{id:`ps-worktree`},`Worktree lifecycle hooks`,-1),r[17]||=x(`p`,{class:`ps-info`},`Commands that run when a worktree is created or torn down for this project`,-1),x(`div`,Dt,[x(`div`,{class:`ps-section-head`},[r[12]||=x(`label`,{for:`ps-setup`},`Setup`,-1),x(`a`,{href:cn,target:`_blank`,rel:`noopener`,title:`See docs for more details and the environment variables available to these commands`},`Docs`)]),k.value?.uncommittedSetup?(s(),B(`div`,Ot,[x(`p`,null,[e(Y,{name:`alert`,size:14}),r[13]||=x(`b`,null,`Commit paseo.json changes`,-1)]),r[14]||=x(`p`,{class:`ps-callout-sub`},`New worktrees use the setup script from the base branch you select.`,-1)])):L(``,!0),f(x(`textarea`,{id:`ps-setup`,"onUpdate:modelValue":r[1]||=e=>A.value.setupText=e,class:`ps-code`,placeholder:`npm install`,spellcheck:`false`,"aria-label":`Worktree setup commands`},null,512),[[g,A.value.setupText]])]),x(`div`,kt,[x(`div`,{class:`ps-section-head`},[r[15]||=x(`label`,{for:`ps-teardown`},`Teardown`,-1),x(`a`,{href:cn,target:`_blank`,rel:`noopener`,title:`See docs for more details and the environment variables available to these commands`},`Docs`)]),f(x(`textarea`,{id:`ps-teardown`,"onUpdate:modelValue":r[2]||=e=>A.value.teardownText=e,class:`ps-code`,placeholder:`docker compose down`,spellcheck:`false`,"aria-label":`Worktree teardown commands`},null,512),[[g,A.value.teardownText]])])]),x(`section`,At,[x(`div`,jt,[r[18]||=x(`h3`,{id:`ps-scripts`},`Scripts`,-1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Add script`,title:`Add script`,onClick:q},[e(Y,{name:`plus`,size:15})])]),r[21]||=x(`p`,{class:`ps-info`},`Long-running services and one-off commands you can launch from any agent in this project`,-1),x(`div`,Mt,[A.value.scripts.length?L(``,!0):(s(),B(`div`,Nt,`No scripts yet.`)),(s(!0),B(b,null,u(A.value.scripts,t=>(s(),B(`div`,{key:t.id,class:h([`card-row ps-script`,{invalid:!C(vt)(t)}])},[x(`button`,{type:`button`,class:`ps-script-main`,onClick:e=>oe(t)},[x(`span`,Ft,_(t.name||`Untitled script`),1),x(`span`,It,_(C(yt)(t)||`No command`),1)],8,Pt),x(`div`,Lt,[x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Open script menu for `+(t.name||`untitled script`),onClick:v(e=>re.value=re.value===t.id?null:t.id,[`stop`])},[e(Y,{name:`more-v`,size:15})],8,Rt),re.value===t.id?(s(),B(`div`,{key:0,class:`menu ps-menu`,role:`menu`,onClick:r[3]||=v(()=>{},[`stop`])},[x(`button`,{type:`button`,role:`menuitem`,onClick:e=>oe(t)},[e(Y,{name:`edit`,size:14}),r[19]||=c(`Edit`,-1)],8,zt),x(`button`,{type:`button`,role:`menuitem`,class:`menu-danger`,onClick:e=>ce(t)},[e(Y,{name:`trash`,size:14}),r[20]||=c(`Remove`,-1)],8,Bt)])):L(``,!0)])],2))),128))])]),x(`section`,Vt,[r[22]||=x(`h3`,{id:`ps-metadata`},`Metadata generation`,-1),r[23]||=x(`p`,{class:`ps-info`},` Project-specific instructions injected into the AI prompts Paseo uses to generate metadata — use them to enforce your team's conventions like branch naming, commit style, or PR format `,-1),(s(!0),B(b,null,u(C(at),e=>(s(),B(`div`,{key:e,class:`ps-section`},[x(`div`,Ht,[x(`label`,{for:`ps-prompt-`+e},_(o[e].title),9,Ut)]),f(x(`textarea`,{id:`ps-prompt-`+e,"onUpdate:modelValue":t=>A.value.prompts[e]=t,placeholder:o[e].placeholder},null,8,Wt),[[g,A.value.prompts[e]]])]))),128))]),V.value?(s(),B(`div`,Gt,[x(`p`,null,[e(Y,{name:`alert`,size:14}),r[24]||=x(`b`,null,`Config changed on disk`,-1)]),r[25]||=x(`p`,{class:`ps-callout-sub`},`Reload to fetch the latest paseo.json before saving. Your unsaved edits will be replaced.`,-1),x(`button`,{type:`button`,class:`btn btn-outline`,onClick:te},`Reload`)])):T.value?(s(),B(`div`,Kt,[x(`p`,null,[e(Y,{name:`alert`,size:14}),c(_(T.value.message),1)]),x(`div`,{class:`ps-callout-actions`},[x(`button`,{type:`button`,class:`btn btn-outline`,onClick:ne},`Try again`),x(`button`,{type:`button`,class:`btn btn-outline`,onClick:te},`Reload`)])])):L(``,!0)],64))]),x(`footer`,Q,[O.value&&!E.value?(s(),B(`span`,qt,[e(Y,{name:`check`,size:14}),r[26]||=c(`Project updated`,-1)])):L(``,!0),E.value&&!z.value?(s(),B(`span`,Jt,[e(Y,{name:`check`,size:14}),r[27]||=c(`Project saved`,-1)])):L(``,!0),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:d.value,onClick:U},_(z.value?`Cancel`:`Close`),9,Yt),x(`button`,{class:`btn btn-primary`,disabled:l.value||!!m.value||d.value||!z.value||V.value||ee.value},_(d.value?`Saving…`:`Save`),9,Xt)])],32),D.value?(s(),p(it,{key:0,"host-id":n.hostId,"root-path":n.rootPath,project:n.project,"custom-icons":n.customIcons,request:n.request,onSaved:r[5]||=e=>(O.value=!0,E.value=!1),onClose:r[6]||=e=>D.value=!1},null,8,[`host-id`,`root-path`,`project`,`custom-icons`,`request`])):L(``,!0),W.value?(s(),B(`div`,{key:1,class:`overlay ps-script-overlay`,onMousedown:v(se,[`self`]),onKeydown:I(v(se,[`stop`]),[`esc`])},[x(`form`,{class:`sheet sheet-small`,role:`dialog`,"aria-modal":`true`,"aria-label":W.value.name?`Edit `+W.value.name:`New script`,onSubmit:v(J,[`prevent`])},[x(`header`,$t,[x(`h2`,null,_(W.value.name.trim()?`Edit `+W.value.name.trim():`New script`),1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:se},[e(Y,{name:`close`,size:16})])]),x(`div`,en,[x(`label`,tn,[r[28]||=x(`span`,null,`Name`,-1),f(x(`input`,{ref_key:`nameInput`,ref:K,"onUpdate:modelValue":r[7]||=e=>W.value.name=e,placeholder:`dev`,spellcheck:`false`,autocapitalize:`off`,"aria-label":`Script name`,onBlur:r[8]||=e=>G.name=!0},null,544),[[g,W.value.name]])]),G.name&&ie.value.name?(s(),B(`p`,nn,_(ie.value.name),1)):L(``,!0),x(`label`,rn,[r[29]||=x(`span`,null,`Command`,-1),f(x(`textarea`,{"onUpdate:modelValue":r[9]||=e=>W.value.commandText=e,class:`ps-code`,placeholder:`npm run dev`,spellcheck:`false`,"aria-label":`Script command`,onBlur:r[10]||=e=>G.command=!0},null,544),[[g,W.value.commandText]])]),G.command&&ie.value.command?(s(),B(`p`,an,_(ie.value.command),1)):L(``,!0),x(`label`,on,[r[30]||=x(`div`,{class:`grow`},[x(`div`,{class:`row-title`},`Run as a service`),x(`div`,{class:`row-sub`},`Paseo supervises the process and assigns a port via $PASEO_PORT`)],-1),x(`input`,{class:`switch`,type:`checkbox`,checked:W.value.type===C(ot),"aria-label":`Run as a service`,onChange:le},null,40,sn)])]),x(`footer`,{class:`sheet-foot`},[x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:se},`Cancel`),r[31]||=x(`button`,{class:`btn btn-primary`},`Save`,-1)])],40,Qt)],40,Zt)):L(``,!0)],32))}}),un=`litepaseo-composer-v1:`,dn=un+`draft:`,fn=un+`message:`,pn=class{warning=F(``);revision=F(0);generation=0;drafts=y(new Map);pending=y(new Map);owner=crypto.randomUUID();storage;savedIndex=new Map;messageIndex=new Map;slotKey=new Map;constructor(e,t=Date.now()){try{this.storage=e()}catch{this.storage=null,this.unavailable()}this.rescan(t)}unavailable(){this.warning.value=`Draft storage is unavailable. Keep this tab open to retain your text.`}attempt(e,t){if(!this.storage)return t;try{return e(this.storage)}catch{return this.unavailable(),t}}decode(e){try{return JSON.parse(e)}catch{return null}}slot(e){return`${dn}${this.owner}:${encodeURIComponent(e)}`}rescan(e=Date.now()){this.savedIndex.clear(),this.messageIndex.clear(),this.slotKey.clear();let t=this.attempt(e=>{let t=[];for(let n=0;n<e.length;n++){let r=e.key(n);r?.startsWith(un)&&t.push([r,e.getItem(r)])}return t},[]),n=[];for(let[r,i]of t){let t=r.startsWith(dn)?this.decode(i):null;t&&Number.isFinite(t.updated)&&e-t.updated>2592e6?n.push(r):this.apply(r,i)}for(let[e]of this.savedIndex)n.push(...this.excess(e));for(let e of n)this.remove(e);this.revision.value++}excess(e){let t=this.savedIndex.get(e);return!t||t.size<=8?[]:[...t].sort((e,t)=>t[1].updated-e[1].updated).slice(8).map(([e])=>e).filter(t=>t!==this.slot(e))}apply(e,t){let n=this.slotKey.get(e);if(n!==void 0){this.slotKey.delete(e);let t=this.savedIndex.get(n);t?.delete(e),t&&!t.size&&this.savedIndex.delete(n);let r=this.messageIndex.get(n);r?.delete(e),r&&!r.size&&this.messageIndex.delete(n)}if(t===null)return;let r=this.decode(t);if(typeof r?.key==`string`&&typeof r.text==`string`){if(e.startsWith(dn)){if(!r.text||!Number.isFinite(r.updated))return;let n=this.savedIndex.get(r.key);n||this.savedIndex.set(r.key,n=new Map),n.set(e,{key:r.key,text:r.text,updated:r.updated,restoredFrom:r.restoredFrom,raw:t})}else if(e.startsWith(fn)){if(typeof r.messageId!=`string`)return;let t=this.messageIndex.get(r.key);t||this.messageIndex.set(r.key,t=new Map),t.set(e,r)}else return;this.slotKey.set(e,r.key)}}write(e,t){this.storage.setItem(e,t),this.apply(e,t)}remove(e){this.attempt(t=>(t.removeItem(e),!0),!1),this.apply(e,null)}onStorage(e,t){if(e===null)return this.rescan();e.startsWith(un)&&(this.apply(e,t),this.revision.value++)}saved(e){this.revision.value;let t=this.savedIndex.get(e);return t?[...t].map(([e,{raw:t,...n}])=>({...n,slot:e})).sort((e,t)=>t.updated-e.updated):[]}state(e){let t=this.drafts.get(e);if(!t){let n=this.saved(e)[0];this.drafts.set(e,{text:n?.text??``,restoredFrom:n?.restoredFrom,source:n?.slot,sourceValue:n?this.savedIndex.get(e)?.get(n.slot)?.raw:void 0}),t=this.drafts.get(e)}return t}setText(e,t,n){let r=this.state(e);r.text=t,r.restoredFrom=n,this.attempt(i=>(t&&this.write(this.slot(e),JSON.stringify({key:e,text:t,restoredFrom:n,updated:Date.now()})),r.source&&i.getItem(r.source)===r.sourceValue&&this.remove(r.source),r.source=r.sourceValue=void 0,t||this.remove(this.slot(e)),!0),!1),this.revision.value++}restore(e,t){let n=this.saved(e).find(e=>e.slot===t);if(!n)return;let r=this.state(e).text;r&&r!==n.text&&this.attempt(()=>{this.write(`${dn}${crypto.randomUUID()}:${encodeURIComponent(e)}`,JSON.stringify({key:e,text:r,updated:Date.now()}));for(let t of this.excess(e))this.remove(t);return!0},!1),this.setText(e,n.text)}unresolved(e){this.revision.value;let t=new Map((this.pending.get(e)??[]).map(e=>[e.messageId,e]));for(let n of this.messageIndex.get(e)?.values()??[])t.set(n.messageId,n);return[...t.values()]}begin(e,t){this.attempt(()=>(this.write(fn+t.messageId,JSON.stringify({key:e,...t})),!0),!1)||this.pending.set(e,[...this.unresolved(e),t]),this.revision.value++}resolve(e,t){this.pending.set(e,(this.pending.get(e)??[]).filter(e=>e.messageId!==t)),this.remove(fn+t),this.revision.value++}restoreFailed(e,t){this.state(e).text||this.setText(e,t.text,t.messageId)}confirm(e,t){this.state(e).restoredFrom===t&&this.setText(e,``),this.resolve(e,t)}refresh(){this.rescan()}clear(){this.generation++;for(let e of[...this.slotKey.keys()])this.remove(e);this.attempt(e=>{let t=[];for(let n=0;n<e.length;n++){let r=e.key(n);r?.startsWith(un)&&t.push(r)}for(let n of t)e.removeItem(n);return!0},!1),this.drafts.clear(),this.pending.clear(),this.revision.value++}},mn=[`src`],hn=l({__name:`ImagePreview`,props:{src:{}},emits:[`close`],setup(r,{emit:i}){let a=i,o=F(null),c=F(null),l=document.activeElement;return t(()=>o.value?.focus({preventScroll:!0})),n(()=>{l instanceof HTMLElement&&l.isConnected&&l.focus({preventScroll:!0})}),(t,n)=>(s(),B(`div`,{ref_key:`viewport`,ref:o,class:`lightbox`,role:`dialog`,"aria-modal":`true`,"aria-label":`Image`,tabindex:`0`,onClick:n[1]||=v(e=>a(`close`),[`self`]),onKeydown:[n[2]||=v(()=>{},[`stop`]),n[3]||=I(v(e=>a(`close`),[`stop`]),[`esc`]),n[4]||=I(v(e=>c.value?.focus(),[`prevent`]),[`tab`])]},[x(`button`,{ref_key:`closeButton`,ref:c,class:`lightbox-close`,"aria-label":`Close image`,onClick:n[0]||=e=>a(`close`)},[e(Y,{name:`close`,size:22})],512),x(`img`,{src:r.src,alt:`Image preview`},null,8,mn)],544))}}),gn=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},_n=gn(hn,[[`__scopeId`,`data-v-284e49c2`]]),vn=1e3,yn=3e4;function bn(e){let t=!1,n=null,r,i=vn,a=t=>e.onState?.(t),o=async()=>{if(t||document.hidden||n)return;clearTimeout(r),r=void 0;let s=n=new AbortController;a(`connecting`);try{let n=await fetch(e.url(),{headers:{accept:`text/event-stream`},signal:s.signal});if(n.status===401){t=!0,a(`unauthorized`);return}if(!n.ok||!n.body)throw Error(`Stream unavailable`);e.onResponse?.();let r=n.body.pipeThrough(new TextDecoderStream).getReader(),o=``,c=!1;for(;;){let{value:t,done:n}=await r.read();if(n)break;!c&&t&&(c=!0,a(`live`)),o+=t;let s;for(;(s=o.indexOf(`
7
-
8
- `))>=0;){let t=o.slice(0,s);o=o.slice(s+2);let n=``;for(let e of t.split(`
9
- `))e.startsWith(`data: `)&&(n+=(n?`
10
- `:``)+e.slice(6));n&&(i=vn,e.onMessage(JSON.parse(n)))}}}catch{}finally{n===s&&(n=null)}if(t)return a(`closed`);if(document.hidden)return a(`paused`);a(`connecting`),r=setTimeout(()=>void o(),i),i=Math.min(i*2,yn)},s=()=>{document.hidden?(n?.abort(),clearTimeout(r),a(`paused`)):(i=vn,o())};return document.addEventListener(`visibilitychange`,s),o(),{close(){t=!0,clearTimeout(r),document.removeEventListener(`visibilitychange`,s),n?.abort()}}}var xn=Symbol(`litepaseo-timeline`),Sn=e=>typeof e==`string`&&e.length>0?e:void 0;function Cn(e,t){if(!t||!e)return e;let n=t.replace(/\\/g,`/`).replace(/\/+$/,``),r=e.replace(/\\/g,`/`);return r.startsWith(n+`/`)?r.slice(n.length+1):r===n?`.`:e}var wn=e=>{let t=e.trim();return!t||/[:./]/.test(t)||t.includes(`__`)?t||`Tool`:t.replace(/[._-]+/g,` `).split(` `).filter(Boolean).join(` `).toLowerCase().replace(/^./,e=>e.toUpperCase())};function Tn(e){let t=e.split(/&&|\|\||;|\|/).map(e=>e.trim()).filter(Boolean);for(let e of t){let t=e.split(/\s+/).filter(e=>!/^[A-Z_][A-Z0-9_]*=/.test(e)),n=(t[0]??``).replace(/^.*\//,``);if(n&&n!==`cd`&&n!==`timeout`&&n!==`sudo`&&n!==`env`)return n;if(n===`timeout`||n===`sudo`||n===`env`){let e=t.slice(1).find(e=>!/^-|^\d+[smh]?$/.test(e));if(e)return e.replace(/^.*\//,``)}}return``}var En=[[/^(npm|npx|pnpm|yarn|bun|bunx)$/,`npm`],[/^(node|deno|tsx|ts-node|vitest|jest)$/,`js`],[/^(rg|grep|egrep|find|fd|ag|ls|tree|locate)$/,`search`],[/^git$/,`branch`],[/^(curl|wget|http)$/,`globe`],[/^(cat|head|tail|less|sed|awk|wc|jq)$/,`terminal`]],Dn=e=>{let t=Tn(e);return En.find(([e])=>e.test(t))?.[1]??`terminal`};function On(e){return e.replace(/(?:~|\/)[^\s'"`]*\/[^\s'"`]*/g,e=>{let t=e.split(`/`);return t.length>5?[...t.slice(0,4),`…`,t[t.length-1]||t[t.length-2]+`/`].join(`/`):e})}var $=e=>{let t=typeof e==`string`?e:``;return t?t.split(`
11
- `).length-+!!t.endsWith(`
12
- `):0},kn=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function An(e){if(!e)return``;let t=0,n=0;for(let r of e.split(`
13
- `))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return t||n?`+${t} −${n}`:``}function jn(e,t){let n=e.detail??{},r=n.type===`unknown`&&n.input&&typeof n.input==`object`?n.input:{},i=e=>Cn(String(e??``),t),a=String(e.name??``),o=(e,t,n,r,i=!1,a=``)=>({kind:e,icon:t,name:n,summary:r,showName:i,meta:a}),s=e=>o(`shell`,Dn(e),`Run`,On(e.split(`
14
- `)[0]));switch(n.type){case`shell`:return s(String(n.command??``));case`read`:return o(`read`,`eye`,`Read`,i(n.filePath));case`edit`:return o(`edit`,`edit`,`Edit`,i(n.filePath),!1,An(Pn(e)));case`write`:return o(`write`,`edit`,`Write`,i(n.filePath),!1,n.content?kn($(n.content),`line`):``);case`search`:return o(`search`,n.toolName===`web_search`?`globe`:`search`,n.toolName===`web_search`?`Search web`:`Search`,String(n.query??``));case`fetch`:return o(`fetch`,`globe`,`Fetch`,String(n.url??``),!0);case`sub_agent`:return o(`sub_agent`,`bot`,Sn(n.subAgentType)??`Task`,Sn(n.description)??``,!0);case`worktree_setup`:return o(`worktree`,`branch`,`Worktree setup`,String(n.branchName??``),!0);case`plain_text`:return o(`plain`,`tool`,wn(a),Sn(n.label)??``,!0);case`plan`:return o(`plan`,`list`,`Plan`,``,!0)}let c=a.toLowerCase(),l=Sn(r.path)??Sn(r.file_path)??Sn(r.filePath),u=Sn(r.command)??Sn(r.cmd)??l??Sn(r.pattern)??Sn(r.query)??Sn(r.url)??Sn(r.description)??``;return/^(bash|shell|exec|run|terminal)/.test(c)?s(u):/^(read|view|cat)/.test(c)?o(`read`,`eye`,`Read`,i(u)):/^(edit|patch|apply|multiedit|str_replace)/.test(c)?o(`edit`,`edit`,`Edit`,i(u),!1,An(Pn(e))):/^write/.test(c)?o(`write`,`edit`,`Write`,i(u),!1,r.content?kn($(r.content),`line`):``):/(grep|glob|find|search|ls)$/.test(c)?o(`search`,`search`,`Search`,u):/fetch|browse|http/.test(c)?o(`fetch`,`globe`,`Fetch`,u,!0):c===`thinking`?o(`plain`,`bulb`,`Thinking`,``,!0):c===`task`||c===`subagent`||c===`subagents`?o(`sub_agent`,`bot`,`Task`,u,!0):o(`unknown`,`tool`,wn(a),u,!0)}function Mn(e){return(e.split(`
15
- `).map(e=>e.trim()).find(Boolean)??``).replace(/^#+\s*/,``).replace(/\*\*|__|`/g,``).slice(0,300)}function Nn(e){let t=e.detail??{};if(t.type===`shell`)return String(t.output??``);if(t.type===`read`||t.type===`write`)return String(t.content??``);if(t.type===`search`)return String(t.content??(t.filePaths??[]).join(`
16
- `));if(t.type===`fetch`)return String(t.result??``);if(t.type===`sub_agent`)return String(t.log??``);if(t.type===`plain_text`||t.type===`plan`)return String(t.text??``);if(t.type===`worktree_setup`)return String(t.log??``);if(t.type===`unknown`){let e=t.output;if(typeof e==`string`)return e;let n=Array.isArray(e?.content)?e.content.filter(e=>e.type===`text`).map(e=>String(e.text)):[];return n.length?n.join(`
17
- `):e==null?``:JSON.stringify(e,null,2)}return``}function Pn(e){let t=e.detail??{},n=(e,t)=>String(e??``).split(`
18
- `).filter((e,t,n)=>t<n.length-1||n[t]!==``).map(e=>t+e),r=(e,t)=>[...n(e,`-`),...n(t,`+`)];if(t.type===`edit`)return Sn(t.unifiedDiff)?t.unifiedDiff:t.oldString===void 0&&t.newString===void 0?``:r(t.oldString,t.newString).join(`
19
- `);let i=t.type===`unknown`&&t.input&&typeof t.input==`object`?t.input:null;if(!i)return``;let a=Array.isArray(i.edits)?i.edits:[i],o=[];for(let e of a){let t=e.oldText??e.old_string??e.oldString,n=e.newText??e.new_string??e.newString;(t!==void 0||n!==void 0)&&(o.length&&o.push(`@@`),o.push(...r(t,n)))}return o.join(`
20
- `)}function Fn(e){if(!Number.isFinite(e)||e<0)return`0s`;let t=e/1e3;if(t<60)return`${Math.floor(t)}s`;let n=Math.floor(t/60);if(n<60){let e=Math.floor(t)%60;return e?`${n}m ${e}s`:`${n}m`}let r=Math.floor(n/60),i=n%60;return i?`${r}h ${i}m`:`${r}h`}var In=e=>e.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}),Ln=e=>Math.floor((e.getTime()-e.getTimezoneOffset()*6e4)/864e5);function Rn(e,t=new Date){let n=In(e),r=Ln(t)-Ln(e);return r===0?n:r===-1?`Tomorrow ${n}`:r<7&&r>-7?`${e.toLocaleDateString(void 0,{weekday:`long`})} ${n}`:`${e.toLocaleDateString(void 0,{day:`numeric`,month:`short`,year:`numeric`})}, ${n}`}function zn(e,t=Date.now()){if(!e)return``;let n=Math.max(0,(t-e)/1e3);return n<60?`now`:n<3600?`${Math.floor(n/60)}m`:n<86400?`${Math.floor(n/3600)}h`:n<604800?`${Math.floor(n/86400)}d`:n<3024e3?`${Math.floor(n/86400/7)}w`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function Bn(e,t,n=new Date){let r=new Map,i=null,a=e=>{if(!i||!e)return;let t=Date.parse(i.last.timestamp);if(!Number.isFinite(t))return;let a=i.first.item.type===`user_message`?Date.parse(i.first.timestamp):NaN;r.set(i.last.seqStart,{at:Rn(new Date(t),n),took:Number.isFinite(a)&&t>=a?Fn(t-a):``,messages:i.messages})};for(let t of e)t.turnId&&(i&&i.id!==t.turnId&&(a(!0),i=null),i??={id:t.turnId,first:t,last:t,messages:[]},i.last=t,t.item.type===`assistant_message`&&i.messages.push(t.seqStart));return a(t),r}var Vn=/!\[([^\]\n]*)\]\(\s*<?([^)\s>]+)>?(\s+"[^"]*")?\s*\)/g,Hn=/\.(png|jpe?g|webp|gif|bmp|avif)$/i;function Un(e,t){return e.includes(`![`)?e.replace(Vn,(e,n,r,i=``)=>{if(/^(https?:|data:|blob:)/i.test(r))return e;let a=r;if(/^file:\/\//i.test(a))try{a=decodeURIComponent(new URL(a).pathname)}catch{return e}return Hn.test(a)?`![${n}](${t}/image?path=${encodeURIComponent(a)}${i})`:e}):e}var Wn=`#litepaseo-copy-path=`,Gn=`Can't be opened here: click to copy the path`,Kn=/(?<![!\\])\[((?:[^[\]\n]|\[[^[\]\n]*\](?:\([^()\s]*(?:\s+"[^"\n]*")?\))?)*)\]\(\s*(<[^>\n]+>|[^)\s]+)(\s+"[^"\n]*")?\s*\)/g,qn=e=>e.replace(/[()<>\s]/g,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`)),Jn=e=>`"${e.replace(/"/g,`'`)}"`,Yn=/^[A-Za-z]:[\\/]/,Xn=e=>e.startsWith(`/`)||Yn.test(e);function Zn(e){let t=/^\/[A-Za-z]:[\\/]/.test(e)?e.slice(1):e,n=`/`;Yn.test(t)&&(n=t[0].toUpperCase()+`:/`,t=t.slice(3).replace(/\\/g,`/`));let r=[];for(let e of t.split(`/`))e&&e!==`.`&&(e===`..`?r.pop():r.push(e));return n+r.join(`/`)}function Qn(e){return e?/^(\/home\/[^/]+|\/Users\/[^/]+|\/root|[A-Z]:\/Users\/[^/]+)(?=\/|$)/.exec(Zn(e))?.[1]??null:null}function $n(e,t){if(!t)return null;let n=Zn(t),r=e.replace(/\/$/,``)||`/`;if(r===n)return``;let i=n.endsWith(`/`)?n:n+`/`;return r.startsWith(i)?r.slice(i.length):null}var er=(e,t)=>{let n=Number(e);if(!Number.isInteger(n)||n<1)return;let r=Number(t);return Number.isInteger(r)&&r>n?{line:n,end:r}:{line:n}};function tr(e){let t=/^(\d+)(?:-(\d+))?$/.exec(e??``);return t?er(t[1],t[2]):void 0}var nr=e=>e.end?`${e.line}-${e.end}`:String(e.line);function rr(e,t,n){let r=e.trim().replace(/^<(.*)>$/,`$1`).trim();if(!r||/^[#?]/.test(r)||r.startsWith(`//`)||r.startsWith(`/?`)||r.startsWith(`/api/`))return null;if(/^file:/i.test(r))try{r=new URL(r).pathname}catch{return null}else if(!Yn.test(r)&&/^[a-z][a-z\d+.-]*:/i.test(r))return null;let i=/#L(\d+)(?:C\d+)?(?:-L?(\d+)(?:C\d+)?)?$/i.exec(r),a=i?er(i[1],i[2]):void 0;r=r.replace(/[?#].*$/,``);try{r=decodeURIComponent(r)}catch{}let o=/:(\d+)(?::\d+|-(\d+))?$/.exec(r);if(o&&(a??=er(o[1],o[2]),r=r.slice(0,o.index)),!r)return null;let s=/[\\/]$/.test(r);if(/^~(?=[\\/]|$)/.test(r)){if(!n)return{path:r,...s?{}:a};r=n+`/`+r.slice(1)}let c=Xn(r)?Zn(r):t?Zn(`${t}/${r}`):null;return c?s?{path:c.endsWith(`/`)?c:c+`/`}:{path:c,...a}:null}function ir(e,t){let n=``,r=null,i=``,a=()=>{n+=i.split(/((`+)[\s\S]*?[^`]\2(?!`))/).map((e,n)=>n%3==0?t(e):n%3==1?e:``).join(``),i=``};for(let t of e.split(/(?<=\n)/)){let e=/^\s*(`{3,}|~{3,})/.exec(t)?.[1];r?(n+=t,e&&e[0]===r[0]&&e.length>=r.length&&!t.trim().slice(e.length).trim()&&(r=null)):e?(a(),r=e,n+=t):i+=t}return a(),n}var ar=(e,t)=>qn(`/?session=${encodeURIComponent(e.session)}&${t}`);function or(e,t,n){let r=Xn(t.path)?$n(t.path,n.workspace):null;if(r!==null&&t.path.endsWith(`/`))return`[${e}](${ar(n,`dir=${encodeURIComponent(r||`.`)}`)} ${Jn((r||`.`)+`/`)})`;if(r){let i=t.line?nr({line:t.line,end:t.end}):``;return`[${e}](${ar(n,`file=${encodeURIComponent(r)}${i?`&line=${i}`:``}`)} ${Jn(r+(i?`:${i}`:``))})`}return`[${e}](${Wn}${qn(encodeURIComponent(t.path))} ${Jn(Gn)})`}var sr=e=>({cwd:e.cwd||e.workspace,home:Qn(e.workspace||e.cwd)});function cr(e,t){if(!e.includes(`](`)||!t.session)return e;let{cwd:n,home:r}=sr(t);return ir(e,e=>e.replace(Kn,(e,i,a)=>{let o=rr(a,n,r);return o?or(i.trim()||o.path,o,t):e}))}var lr=/\/paseo-attachments-[A-Za-z0-9_-]{1,32}\/[a-f0-9]{64}\.[a-z0-9]+$/i;function ur(e,t,n){if(!e.includes(`![`)||!t.session)return e;let{cwd:r,home:i}=sr(t);return ir(e,e=>e.replace(Vn,(e,a,o,s=``)=>{let c=rr(o,r,i);if(!c)return e;let{path:l}=c,u=Xn(l)&&!l.endsWith(`/`)&&$n(l,t.workspace)||null,d=Hn.test(l)?n(l,u):null;return d?`![${a}](${qn(d)}${s})`:or(a.trim()||l.replace(/\/$/,``).split(`/`).pop()||l,{path:l},t)}))}function dr(e,t,n){let r=t.replace(/\/agents\/[^/]+$/,`/fs`),i=n.workspace;return ur(e,n,(e,a)=>a!==null&&!$n(e,n.cwd)&&!lr.test(e)?`${r}/raw?cwd=${encodeURIComponent(i)}&path=${encodeURIComponent(a)}`:Xn(e)?`${t}/image?path=${encodeURIComponent(e)}`:null)}function fr(e,t){let n=t.workspace;return ur(e,t,(e,r)=>r===null?null:`${t.rawBase}/raw?cwd=${encodeURIComponent(n)}&path=${encodeURIComponent(r)}`)}function pr(e){if(!e)return null;if(e.startsWith(Wn))try{return{kind:`copy`,path:decodeURIComponent(e.slice(21))}}catch{return null}if(!e.startsWith(`/?`))return null;let t=new URLSearchParams(e.slice(2)),n=t.get(`session`),r=t.get(`file`),i=t.get(`dir`);return n?r?{kind:`open`,session:n,path:r,...tr(t.get(`line`))}:i?{kind:`reveal`,session:n,path:i}:null:null}var mr=[`aria-expanded`,`onClick`,`onContextmenu`],hr={class:`group-lead`},gr={class:`group-name`},_r={class:`group-name-text`},vr=[`title`],yr=[`title`],br={key:0,class:`group-flag is-attention`},xr={key:1,class:`status-dot is-error`},Sr={key:2,class:`status-dot is-running`},Cr={key:3,class:`status-dot is-unread`},wr={key:1,class:`group-count`},Tr=[`aria-label`,`title`,`onClick`],Er=[`aria-label`,`onClick`],Dr=[`onClick`,`onContextmenu`,`onPointerdown`,`onMouseenter`],Or={class:`session-dot`},kr={class:`session-title`},Ar=[`title`],jr={key:0,class:`session-project`},Mr={key:1,class:`pill pill-attention`},Nr={key:2,class:`session-age`},Pr=[`aria-label`,`onClick`],Fr={class:`thread-card-title`},Ir={key:0,class:`thread-card-off`},Lr={key:0},Rr={key:0,class:`list-empty`},zr=320,Br=500,Vr=l({__name:`SessionList`,props:{store:{},mode:{},hostLabels:{},hostStates:{},selectedKey:{},searching:{type:Boolean},queues:{}},emits:[`select`,`new`,`menu`,`projectMenu`],setup(r,{emit:i}){let a=r,o=i,l=F(null),d=F(0),f=F(600),m=0,g,y=S(()=>(a.store.version.value,a.store.size)),w=S(()=>(a.store.version.value,a.mode===`projects`?a.store.groupedHeight:a.store.size*J)),T=S(()=>{a.store.version.value;let e=Math.max(0,d.value-zr),t=f.value+zr*2;if(a.mode===`projects`)return a.store.groupedRows(e,t);let n=Math.floor(e/J);return a.store.range(n,Math.ceil(t/J)+1).map((e,t)=>({kind:`item`,key:e.key,top:(n+t)*J,item:e}))}),E=e=>[e.attention&&`${e.attention} need you`,e.failed&&`${e.failed} failed`,e.running&&`${e.running} running`,e.unread&&`${e.unread} finished, not viewed`].filter(Boolean).join(` · `),O=e=>e.attention?`is-attention`:e.state===`failed`?`is-error`:e.state===`running`?`is-running`:e.unread||e.state===`unread`?`is-unread`:``,k=F(Date.now()),A,j=e=>{let t=[...e.hosts.keys()];return t.length===1?a.hostLabels.get(t[0])??`Unknown host`:`${t.length} hosts`},M=e=>[...e.hosts.keys()].map(e=>a.hostLabels.get(e)??`Unknown host`).join(`, `),N=e=>e.items.at(0)??null,I=matchMedia(`(hover: hover) and (pointer: fine)`).matches,R=F(null),z,ee=e=>e.replace(/^\/(home|Users)\/[^/]+(?=\/|$)/,`~`);function V(e,t){if(!I)return;clearTimeout(z);let n=e.currentTarget.getBoundingClientRect();z=setTimeout(()=>{R.value={thread:t,top:Math.max(8,Math.min(n.top-4,window.innerHeight-170)),left:n.right+10}},R.value?120:550)}function H(){clearTimeout(z),z=setTimeout(()=>R.value=null,80)}let te,ne=!1;function U(e,t){if(e.pointerType===`mouse`)return;ne=!1,clearTimeout(te);let{clientX:n,clientY:r}=e;te=setTimeout(()=>{ne=!0,navigator.vibrate?.(10),o(`menu`,t,n,r)},Br)}function W(){clearTimeout(te)}function G(e){clearTimeout(z),R.value=null,ne?ne=!1:o(`select`,e.key)}function re(e,t){let n=e.currentTarget.getBoundingClientRect();o(`menu`,t,n.left,n.bottom+4)}function K(e,t){let n=e.currentTarget.getBoundingClientRect();o(`projectMenu`,t,n.right-210,n.bottom+4)}function ie(){W(),R.value&&H(),m||=requestAnimationFrame(()=>{m=0,l.value&&(d.value=l.value.scrollTop)})}return t(()=>{let e=l.value;f.value=e.clientHeight||f.value,g=new ResizeObserver(()=>f.value=e.clientHeight||f.value),g.observe(e),A=setInterval(()=>k.value=Date.now(),6e4)}),n(()=>{g?.disconnect(),cancelAnimationFrame(m),clearTimeout(te),clearTimeout(z),clearInterval(A)}),(t,n)=>(s(),B(`div`,{ref_key:`element`,ref:l,class:`session-list`,style:P({"--row-h":C(J)+`px`}),onScrollPassive:ie},[x(`div`,{class:`session-spacer`,style:P({height:w.value+`px`})},[(s(!0),B(b,null,u(T.value,t=>(s(),B(b,{key:t.key},[t.kind===`group`?(s(),B(`div`,{key:0,class:h([`group-row`,{collapsed:t.collapsed}]),style:P({transform:`translateY(${t.top}px)`,height:C(36)-4+`px`})},[x(`button`,{class:`group-toggle`,"aria-expanded":!t.collapsed,onClick:e=>r.store.toggleGroup(t.group.key),onContextmenu:v(e=>o(`projectMenu`,t.group,e.clientX,e.clientY),[`prevent`])},[x(`span`,hr,[e(Ve,{name:t.group.name,source:N(t.group)},null,8,[`name`,`source`]),e(Y,{name:`chevron`,size:14,class:`group-chevron`})]),x(`span`,gr,[x(`span`,_r,_(t.group.name),1),t.group.pinnedAt?(s(),p(Y,{key:0,name:`pin`,size:11,class:`project-pin`,title:`Pinned project`})):L(``,!0)]),x(`span`,{class:`group-host`,title:M(t.group)},_(j(t.group)),9,vr),C(de)(t.group)===`done`?L(``,!0):(s(),B(`span`,{key:0,class:`group-marks`,title:E(t.group)},[t.group.attention?(s(),B(`span`,br,_(t.group.attention),1)):L(``,!0),t.group.failed?(s(),B(`span`,xr)):L(``,!0),t.group.running?(s(),B(`span`,Sr)):L(``,!0),t.group.unread?(s(),B(`span`,Cr)):L(``,!0)],8,yr)),t.collapsed?(s(),B(`span`,wr,_(t.group.items.size),1)):L(``,!0)],40,mr),x(`button`,{class:`group-add`,"aria-label":`New session in `+t.group.name+` on `+j(t.group),title:`New session in `+t.group.name+` on `+j(t.group),onClick:e=>o(`new`,t.group)},[e(Y,{name:`plus`,size:14})],8,Tr),x(`button`,{class:`group-add group-more`,"aria-label":`Actions for project `+t.group.name,title:`Project settings, remove project`,onClick:e=>K(e,t.group)},[e(Y,{name:`more-v`,size:15})],8,Er)],6)):(s(),B(`div`,{key:1,class:h([`session-row`,{chosen:r.selectedKey===t.item.key}]),style:P({transform:`translateY(${t.top}px)`})},[x(`button`,{class:h([`session`,{unread:t.item.unread,chosen:r.selectedKey===t.item.key,offline:r.hostStates.get(t.item.hostId)!==`connected`,nested:r.mode===`projects`}]),onClick:e=>G(t.item),onContextmenu:v(e=>o(`menu`,t.item,e.clientX,e.clientY),[`prevent`]),onPointerdown:e=>U(e,t.item),onPointerup:W,onPointercancel:W,onPointerleave:W,onMouseenter:e=>V(e,t.item),onMouseleave:H},[x(`span`,Or,[O(t.item)?(s(),B(`span`,{key:0,class:h([`status-dot`,O(t.item)])},null,2)):L(``,!0)]),x(`span`,kr,[t.item.pinnedAt?(s(),p(Y,{key:0,name:`pin`,size:11,class:`pin-mark`})):L(``,!0),c(_(t.item.name)+` `,1),r.queues?.[t.item.key]?(s(),B(`small`,{key:1,title:r.queues[t.item.key].paused?`Queue paused`:`Queued messages`},` · `+_(r.queues[t.item.key].paused?`Paused`:`Queued`)+` `+_(r.queues[t.item.key].count),9,Ar)):L(``,!0)]),r.mode===`recent`?(s(),B(`span`,jr,_(t.item.project),1)):L(``,!0),t.item.attention?(s(),B(`span`,Mr,`Needs you`)):(s(),B(`span`,Nr,_(C(zn)(t.item.activityAt,k.value)),1))],42,Dr),x(`button`,{class:`row-more`,"aria-label":`Actions for `+t.item.name,title:`Rename, pin, mark unread, archive`,onClick:v(e=>re(e,t.item),[`stop`])},[e(Y,{name:`more`,size:16})],8,Pr)],6))],64))),128))],4),(s(),p(D,{to:`body`},[R.value?(s(),B(`div`,{key:0,class:`thread-card`,style:P({top:R.value.top+`px`,left:R.value.left+`px`}),role:`tooltip`},[x(`p`,Fr,_(R.value.thread.name),1),x(`p`,null,[e(Y,{name:`server`,size:14}),c(_(r.hostLabels.get(R.value.thread.hostId)??`Unknown host`)+` `,1),r.hostStates.get(R.value.thread.hostId)===`connected`?L(``,!0):(s(),B(`span`,Ir,`offline`))]),R.value.thread.branch?(s(),B(`p`,Lr,[e(Y,{name:`branch`,size:14}),c(_(R.value.thread.branch),1)])):L(``,!0),x(`p`,null,[e(Y,{name:`folder`,size:14}),c(_(ee(R.value.thread.directory||R.value.thread.rootPath)),1)])],4)):L(``,!0)])),y.value?L(``,!0):(s(),B(`div`,Rr,_(r.searching?`No threads match.`:`No threads yet. Add a host to get started.`),1))],36))}}),Hr=Symbol(`litepaseo-suggestions`),Ur=3e3,Wr=2500;function Gr(e,t){return e.seqEnd===t.seqEnd&&e.timestamp===t.timestamp&&e.provider===t.provider&&e.turnId===t.turnId&&JSON.stringify(e.item)===JSON.stringify(t.item)}var Kr=class{rows=[];epoch=``;hasOlder=!1;startCursor=null;ready=!1;lastSeq=-1;membership=O(0);resumePoint(){let e=this.rows[0];return this.ready&&e&&this.lastSeq>=0?{epoch:this.epoch,seq:this.lastSeq,from:e.seqStart}:null}apply(e){let t=!1;for(let n of e)if(n.type===`reset`){let e=this.ready&&n.epoch===this.epoch?new Map(this.rows.map(e=>[e.seqStart,e])):null;this.rows=n.rows.map(t=>{let n=e?.get(t.seqStart);return n&&Gr(n.row.value,t)?n:n?(n.row.value=t,n):{seqStart:t.seqStart,row:O(t)}}),this.epoch=n.epoch,this.hasOlder=n.hasOlder,this.startCursor=n.startCursor,this.ready=!0,this.lastSeq=n.seq??n.rows.reduce((e,t)=>Math.max(e,t.seqEnd),-1),t=!0}else if(n.type===`upsert`){this.lastSeq=Math.max(this.lastSeq,n.row.seqEnd);let e=this.find(n.row.seqStart);e>=0?this.rows[e].row.value=n.row:(this.insert({seqStart:n.row.seqStart,row:O(n.row)}),t=!0)}else if(n.type===`append`){this.lastSeq=Math.max(this.lastSeq,n.seqEnd);let e=this.find(n.seqStart);if(e<0)continue;let t=this.rows[e].row,r=t.value;t.value={...r,seqEnd:n.seqEnd,timestamp:n.timestamp,item:{...r.item,text:(r.item.text??``)+n.text}}}this.rows.length>Ur&&(this.rows=this.rows.slice(this.rows.length-Wr),this.hasOlder=!0,this.startCursor={epoch:this.epoch,seq:this.rows[0].seqStart},t=!0),t&&this.membership.value++}find(e){let t=0,n=this.rows.length;if(n&&this.rows[n-1].seqStart===e)return n-1;for(;t<n;){let r=t+n>>>1;this.rows[r].seqStart<e?t=r+1:n=r}return this.rows[t]?.seqStart===e?t:-1}insert(e){let t=this.rows.at(-1);if(!t||t.seqStart<e.seqStart)return void this.rows.push(e);let n=0,r=this.rows.length;for(;n<r;){let t=n+r>>>1;this.rows[t].seqStart<e.seqStart?n=t+1:r=t}this.rows.splice(n,0,e)}};function qr(e,t,n){let r=n===`before`,i=r?e[0]?.seqStart:e.at(-1)?.seqStart,a=t.rows.filter(e=>i===void 0||(r?e.seqStart<i:e.seqStart>i)),o=(r?a.slice(-100):a.slice(0,100)).map(e=>({seqStart:e.seqStart,row:O(e)})),s=r?[...o,...e]:[...e,...o];return{rows:r?s.slice(0,150):s.slice(-150),hasOlder:!r||t.hasOlder||a.length>100,added:o.length}}var Jr=`0.9.0`,Yr=3e3,Xr=performance.now(),Zr=null,Qr=document.hidden?performance.now():null;document.addEventListener(`visibilitychange`,()=>{document.hidden?Qr=performance.now():Qr!==null&&(Zr={at:performance.now(),ms:Math.round(performance.now()-Qr)},Qr=null)});function $r(e,t,n){let r=performance.now(),i=()=>Math.round(performance.now()-r),a=null,o=null,s=null,c=0,l=document.hidden,u=!1,d=null,f=e=>{d=e,n(e)},p=Zr&&r-Zr.at<6e4?{backgroundMs:Zr.ms,visibleForMs:Math.round(r-Zr.at)}:{backgroundMs:null,visibleForMs:null},m=Math.round(r-Xr),h=()=>l||=document.hidden;document.addEventListener(`visibilitychange`,h),f(null);let g=setTimeout(()=>{u||f(a===null?`server`:o===null?`network`:`host`)},Yr),_=()=>{u=!0,clearTimeout(g),f(null),document.removeEventListener(`visibilitychange`,h)},v=n=>{n<3e3||t({hostId:e.hostId,agentId:e.id,totalMs:n,connectedMs:a,firstByteMs:o,rowsMs:s,renderMs:s===null?null:n-s,attempts:c,hidden:l,pageAgeMs:m,...p,version:Jr})};return{abandon(){u||(_(),v(i()))},response(){u||(a??=i(),d===`server`&&f(`network`))},state(e){u||(e===`connecting`&&c++,e===`live`&&(a??=i(),o??=i(),d&&f(`host`)),(e===`closed`||e===`unauthorized`)&&_())},message(e){!u&&e.ops.some(e=>e.type===`reset`)&&(s=i(),_(),w(()=>requestAnimationFrame(()=>v(i()))))}}}function ei(e){let t=Math.max(0,Math.floor(e/1e3)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=String(t%60).padStart(2,`0`);return n?`${n}:${String(r).padStart(2,`0`)}:${i}`:`${r}:${i}`}var ti={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},ni=e=>e.replace(/[&<>"']/g,e=>ti[e]);function ri(e){let t=e.trim();return/^(https?:|mailto:)/i.test(t)?t:null}var ii=e=>/^(\/\?session=|#litepaseo-copy-path=)/.test(e);function ai(e){let t=e.split(/(`+)([\s\S]*?[^`])\1(?!`)/),n=``;for(let e=0;e<t.length;e++){if(e%3==2){n+=`<code>${ni(t[e].replace(/^ (.*) $/,`$1`))}</code>`;continue}if(e%3==1)continue;let r=ni(t[e]);r=r.replace(/!\[([^\]]*)\]\((\/api\/hosts\/[^)\s]+)\)/g,(e,t,n)=>`<img src="${n}" alt="${t}" loading="lazy" decoding="async">`),r=r.replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+&quot;((?:(?!&quot;).)*)&quot;)?\)/g,(e,t,n,r)=>{let i=n.replace(/&amp;/g,`&`),a=r?` title="${r}"`:``;if(ii(i))return`<a href="${ni(i)}"${a}>${t}</a>`;let o=ri(i);return o?`<a href="${ni(o)}"${a} target="_blank" rel="noopener noreferrer">${t}</a>`:e}),r=r.replace(/(^|[\s(])(https?:\/\/[^\s<)]+[^\s<).,;:!?'"])/g,(e,t,n)=>`${t}<a href="${n}" target="_blank" rel="noopener noreferrer">${n}</a>`),r=r.replace(/\*\*([^*\n]+)\*\*/g,`<strong>$1</strong>`).replace(/__([^_\n]+)__/g,`<strong>$1</strong>`).replace(/(^|[^*\w])\*([^*\s][^*\n]*?)\*(?!\w)/g,`$1<em>$2</em>`).replace(/(^|[^_\w])_([^_\s][^_\n]*?)_(?!\w)/g,`$1<em>$2</em>`).replace(/~~([^~\n]+)~~/g,`<del>$1</del>`),n+=r}return n}var oi=e=>/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(e)&&e.includes(`|`),si=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>ai(e.trim()));function ci(e){let t=e.replace(/\r\n?/g,`
21
- `).split(`
22
- `),n=[],r=[],i=()=>{r.length&&n.push(`<p>${r.map(ai).join(`<br>`)}</p>`),r=[]};for(let e=0;e<t.length;e++){let a=t[e],o=/^(\s*)(```+|~~~+)\s*([\w+#.-]*)/.exec(a);if(o){i();let r=o[2],a=[];for(;++e<t.length&&!t[e].trimStart().startsWith(r);)a.push(t[e]);let s=o[3]?`<span class="code-lang">${ni(o[3])}</span>`:``;n.push(`<pre class="code">${s}<code>${ni(a.join(`
23
- `))}</code></pre>`);continue}if(!a.trim()){i();continue}let s=/^(#{1,6})\s+(.*)$/.exec(a);if(s){i();let e=Math.min(s[1].length+2,6);n.push(`<h${e}>${ai(s[2])}</h${e}>`);continue}if(/^\s*([-*_])(\s*\1){2,}\s*$/.test(a)){i(),n.push(`<hr>`);continue}if(/^\s*>/.test(a)){i();let r=[];for(;e<t.length&&/^\s*>/.test(t[e]);e++)r.push(t[e].replace(/^\s*>\s?/,``));e--,n.push(`<blockquote>${ci(r.join(`
24
- `))}</blockquote>`);continue}if(a.includes(`|`)&&e+1<t.length&&oi(t[e+1])){i();let r=si(a),o=[];for(e+=2;e<t.length&&t[e].includes(`|`)&&t[e].trim();e++)o.push(si(t[e]));e--,n.push(`<div class="table"><table><thead><tr>${r.map(e=>`<th>${e}</th>`).join(``)}</tr></thead><tbody>${o.map(e=>`<tr>${e.map(e=>`<td>${e}</td>`).join(``)}</tr>`).join(``)}</tbody></table></div>`);continue}let c=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/.exec(a);if(c){i();let r=/\d/.test(c[2]),a=[];for(;e<t.length;e++){let n=/^(\s*)([-*+]|\d+[.)])\s+(.*)$/.exec(t[e]);if(n&&/\d/.test(n[2])===r){let e=/^\[([ xX])\]\s+(.*)$/.exec(n[3]),t=n[1].length>=2?` class="nested"`:``;a.push(e?`<li class="task${n[1].length>=2?` nested`:``}"><span class="check${e[1]===` `?``:` done`}"></span>${ai(e[2])}</li>`:`<li${t}>${ai(n[3])}</li>`)}else if(t[e].trim()&&/^\s{2,}/.test(t[e])&&a.length)a[a.length-1]=a[a.length-1].replace(/<\/li>$/,` ${ai(t[e].trim())}</li>`);else break}e--,n.push(r?`<ol>${a.join(``)}</ol>`:`<ul>${a.join(``)}</ul>`)}else r.push(a)}return i(),n.join(``)}var li=`modulepreload`,ui=function(e){return`/`+e},di={},fi=function(e){return e.pathname.endsWith(`.css`)},pi=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},mi=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=ui(t,n);let r=s(t),i=fi(r);return pi(di,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:li,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{let i=a=>{t.removeEventListener(`load`,i),t.removeEventListener(`error`,i),a.type===`error`?n(Error(`Unable to preload CSS for ${r}`)):e(a)};t.addEventListener(`load`,i),t.addEventListener(`error`,i)})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},hi=O(null),gi=null;function _i(){return gi??=mi(()=>import(`./MarkdownMessage-CejBvgRc.js`).then(e=>{hi.value=o(e.default)}),__vite__mapDeps([0,1,2,3,4])).catch(()=>{gi=null}),gi}function vi(){let e=window.requestIdleCallback;e?e(()=>void _i(),{timeout:3e3}):setTimeout(()=>void _i(),1500)}var yi={key:0,class:`row row-plugin row-speed`,title:`Turn speed (turn-speed plugin)`},bi={class:`suggestion-actions`},xi={key:2,class:`suggestion-wait`},Si={class:`line-icon`},Ci={class:`line-name`},wi={class:`line-text`},Ti={key:0,class:`tool-body`},Ei={class:`tool-pre`},Di=l({__name:`PluginRow`,props:{item:{},seqStart:{}},setup(n){let r=n,i=T(Hr,null),a=S(()=>`${r.item.pluginId}/${r.item.kind}`),o=S(()=>r.item.data??{}),c=S(()=>{let e=o.value;if(a.value!==`turn-speed/turn-speed`||typeof e.tokensPerSecond!=`number`)return null;let t=e.outputTokens>=1e3?`${(e.outputTokens/1e3).toFixed(1)}k`:String(e.outputTokens),n=e.generationMs>=6e4?`${Math.floor(e.generationMs/6e4)}m ${Math.round(e.generationMs%6e4/1e3)}s`:`${(e.generationMs/1e3).toFixed(1)}s`;return`${e.tokensPerSecond.toFixed(1)} tok/s · ${t} tokens · ${n} · ${e.requests} ${e.requests===1?`request`:`requests`}`}),l=S(()=>a.value===`next-input/next-input`&&typeof o.value.token==`string`),u=F(`idle`),d=F(``),f=S(()=>/[`$|<>]|(^|\s)[.~]?\/[\w.-]|https?:|www\.|\b(rm|sudo|delete|drop|remove|reset|force|push|deploy|publish|release|merge|token|password|passwd|secret|credential|api[ _-]?key|ssh)\b|删除|推送|部署|发布|密码|密钥|令牌/i.test(d.value));async function p(){if(i&&l.value){if(o.value.status===`ready`&&o.value.text)u.value=`ready`,d.value=o.value.text;else{u.value=`loading`;try{let e=await i.predict(o.value.token);e.status===`ready`&&e.text?(u.value=`ready`,d.value=e.text):u.value=e.status===`error`?`error`:`hidden`}catch{u.value=`error`}}u.value===`ready`&&i.offer(r.seqStart,d.value)}}t(()=>void p()),j(()=>o.value.token,()=>void p());let m=F(!1),g=S(()=>m.value?JSON.stringify(r.item.data??r.item,null,2):``);return(t,r)=>c.value?(s(),B(`div`,yi,[e(Y,{name:`bolt`,size:12}),x(`span`,null,_(c.value),1)])):l.value?(s(),B(`div`,{key:1,class:h([`row row-suggestion`,`is-`+u.value])},[u.value===`loading`?(s(),B(b,{key:0},[r[4]||=x(`span`,{class:`spinner spinner-sm`},null,-1),r[5]||=x(`span`,{class:`suggestion-wait`},`Thinking of a next message…`,-1)],64)):u.value===`ready`?(s(),B(b,{key:1},[x(`button`,{class:`suggestion-text`,title:`Put in the message box to edit`,onClick:r[0]||=e=>C(i)?.use(d.value)},_(d.value),1),x(`span`,bi,[x(`button`,{class:`icon-btn`,title:`Edit in the message box`,"aria-label":`Edit suggestion`,onClick:r[1]||=e=>C(i)?.use(d.value)},[e(Y,{name:`edit`,size:14})]),f.value?L(``,!0):(s(),B(`button`,{key:0,class:`icon-btn`,title:`Send this message`,"aria-label":`Send suggestion`,onClick:r[2]||=e=>C(i)?.send(d.value)},[e(Y,{name:`send`,size:14})]))])],64)):u.value===`error`?(s(),B(`span`,xi,`Suggestion unavailable`)):L(``,!0)],2)):(s(),B(`details`,{key:2,class:`row row-line row-tool row-plugin`,onToggle:r[3]||=e=>m.value=e.target.open},[x(`summary`,null,[x(`span`,Si,[e(Y,{name:`sparkle`,size:15})]),x(`span`,Ci,_(n.item.pluginId),1),x(`span`,wi,_(n.item.kind),1)]),m.value?(s(),B(`div`,Ti,[x(`pre`,Ei,_(g.value),1)])):L(``,!0)],32))}}),Oi=[`aria-expanded`,`disabled`],ki={key:0,class:`spinner`},Ai={key:0,class:`rewind-menu`,role:`menu`},ji={class:`rewind-warning`},Mi=[`onClick`],Ni=l({__name:`RewindMenu`,props:{modes:{},busy:{type:Boolean}},emits:[`rewind`],setup(t,{emit:n}){let r=t,a=n,o={conversation:`Rewind conversation`,files:`Rewind files`,both:`Rewind conversation and files`},l={conversation:`chat`,files:`file`,both:`layers`},d=F(!1),f=F(null);function m(e){(e instanceof KeyboardEvent?e.key===`Escape`:!f.value?.contains(e.target))&&(d.value=!1)}j(d,e=>{let t=e?`addEventListener`:`removeEventListener`;document[t](`pointerdown`,m,!0),document[t](`keydown`,m,!0)}),i(()=>d.value=!1);function h(e){d.value=!1,a(`rewind`,e)}return(n,i)=>(s(),B(`span`,{ref_key:`root`,ref:f,class:`rewind`},[x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Rewind to this message`,title:`Rewind to this message`,"aria-expanded":d.value,disabled:t.busy,onClick:i[0]||=e=>d.value=!d.value},[t.busy?(s(),B(`span`,ki)):(s(),p(Y,{key:1,name:`undo`,size:14}))],8,Oi),d.value?(s(),B(`div`,Ai,[x(`p`,ji,[e(Y,{name:`alert`,size:13}),i[1]||=c(`This action cannot be undone`,-1)]),(s(!0),B(b,null,u(r.modes,t=>(s(),B(`button`,{key:t,type:`button`,role:`menuitem`,class:`rewind-item`,onClick:e=>h(t)},[e(Y,{name:l[t],size:15},null,8,[`name`]),c(_(o[t]),1)],8,Mi))),128))])):L(``,!0)],512))}}),Pi={key:0,class:`row row-user`},Fi={class:`bubble`,tabindex:`-1`},Ii={key:0,class:`user-images`},Li=[`href`],Ri=[`src`,`alt`],zi={class:`user-actions`},Bi={key:0,class:`user-time`},Vi=[`aria-label`,`title`],Hi=[`data-seq-end`],Ui=[`innerHTML`],Wi=[`tabindex`],Gi={class:`line-icon`},Ki={class:`line-text`},qi={key:0,class:`reasoning-text`},Ji=[`title`],Yi={class:`line-icon`},Xi={key:0,class:`status-dot is-running`},Zi={key:0,class:`line-name`},Qi={key:1,class:`line-meta`},$i={key:2,class:`line-meta`},ea={key:0,class:`tool-body`},ta={key:0,class:`tool-pre tool-command`},na={key:1,class:`tool-pre tool-diff`},ra={key:0,class:`diff-hunk`},ia={key:2,class:`tool-pre`},aa={key:3,class:`tool-pre tool-output`},oa={key:4,class:`tool-pre tool-error`},sa={key:5,class:`tool-exit`},ca={key:6,class:`tool-exit`},la={key:4,class:`row row-todo`},ua={class:`todo-title`},da={key:5,class:`row row-callout is-error`},fa={key:7,class:`row row-divider`},pa={class:`line-icon`},ma={class:`line-name`},ha={key:0,class:`tool-body`},ga={class:`tool-pre`},_a=2e4,va=600,ya=l({__name:`TimelineRowView`,props:{entry:{},final:{type:Boolean}},setup(t){let n=t,r=T(xn,null),i=S(()=>n.entry.value),a=S(()=>i.value.item),o=F(!1),l=S(()=>{let e=String(a.value.text??``),t=r?.value;if(!t)return e;if(!t.session)return Un(e,t.base);let n={session:t.session,cwd:t.cwd,workspace:t.workspace??t.cwd,localHost:t.localHost};return cr(dr(e,t.base,n),n)}),f=S(()=>!hi.value&&a.value.type===`assistant_message`?ci(l.value):``);!hi.value&&a.value.type===`assistant_message`&&_i();let m=S(()=>{let e=a.value;if(e.type!==`tool_call`)return null;let t=jn(e,r?.value.cwd);return{...t,summary:t.summary.split(`
25
- `)[0],status:String(e.status??`running`)}}),g=S(()=>{let e=a.value;return m.value?.kind!==`sub_agent`||typeof e.callId!=`string`?null:r?.value.subagents?.value.find(t=>t.toolCallId===e.callId)??null}),v=e=>{e.preventDefault(),g.value&&r?.value.openSubagent?.(g.value.id)},y=S(()=>a.value.type===`reasoning`?Mn(String(a.value.text??``)):``),w=F(!1);function E(e){let t=e.currentTarget.querySelector(`.line-text`);w.value=!!t&&t.scrollWidth>t.clientWidth+1}function D(e){E(e),k.value||e.preventDefault()}let O=S(()=>String(a.value.text??``).trim().length>y.value.length+4),k=S(()=>O.value||w.value||o.value),A=e=>e.length>_a?e.slice(0,_a)+`
26
- … (truncated)`:e,j=S(()=>{if(!o.value||!m.value)return null;let e=a.value,t=e.detail??{},n=Pn(e),r=n?n.split(`
27
- `):[],i=A(Nn(e)),s=t.type===`unknown`&&t.input!==void 0?A(JSON.stringify(t.input,null,2)):``;return{command:t.type===`shell`||m.value.kind===`shell`?String(t.command??t.input?.command??m.value.summary):``,exitCode:typeof t.exitCode==`number`?t.exitCode:null,diff:r.slice(0,va).map(e=>({text:e,kind:e.startsWith(`@@`)?`hunk`:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:``})),diffMore:Math.max(0,r.length-va),input:m.value.kind===`shell`?``:s,output:i,error:e.error?A(typeof e.error==`string`?e.error:JSON.stringify(e.error,null,2)):``}}),M=S(()=>a.value.type===`todo`?a.value.items:[]),N=S(()=>o.value?A(JSON.stringify(a.value,null,2)):``),P=S(()=>String(a.value.type).replaceAll(`_`,` `)),I=e=>o.value=e.target.open,R=S(()=>{if(a.value.type!==`user_message`)return``;let e=Date.parse(i.value.timestamp);return Number.isFinite(e)?Rn(new Date(e)):``}),z=S(()=>a.value.type===`user_message`&&typeof a.value.messageId==`string`?r?.value.rewindModes??[]:[]),ee=S(()=>!!r?.value.rewinding?.value),V=e=>r?.value.rewind?.(String(a.value.messageId),String(a.value.text??``),e),H=F(!1);async function te(){try{await navigator.clipboard.writeText(String(a.value.text??``)),H.value=!0,setTimeout(()=>H.value=!1,1500)}catch{}}return(n,r)=>a.value.type===`user_message`?(s(),B(`div`,Pi,[x(`div`,Fi,[a.value.imageUrls?.length?(s(),B(`div`,Ii,[(s(!0),B(b,null,u(a.value.imageUrls,(e,t)=>(s(),B(`a`,{key:e,href:e,target:`_blank`,rel:`noopener`},[x(`img`,{src:e,alt:`Attached image ${Number(t)+1}`,loading:`lazy`},null,8,Ri)],8,Li))),128))])):L(``,!0),c(_(a.value.text),1)]),x(`div`,zi,[R.value?(s(),B(`span`,Bi,_(R.value),1)):L(``,!0),z.value.length?(s(),p(Ni,{key:1,modes:z.value,busy:ee.value,onRewind:V},null,8,[`modes`,`busy`])):L(``,!0),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":H.value?`Copied`:`Copy message`,title:H.value?`Copied`:`Copy message`,onClick:te},[e(Y,{name:H.value?`check`:`copy`,size:14},null,8,[`name`])],8,Vi)])])):a.value.type===`assistant_message`?(s(),B(`div`,{key:1,class:`row row-assistant`,"data-seq-end":i.value.seqEnd},[C(hi)?(s(),p(d(C(hi)),{key:0,content:l.value,final:t.final},null,8,[`content`,`final`])):(s(),B(`div`,{key:1,class:`prose`,innerHTML:f.value},null,8,Ui))],8,Hi)):a.value.type===`reasoning`?(s(),B(`details`,{key:2,class:h([`row row-line row-reasoning`,{"is-static":!k.value}]),onToggle:I},[x(`summary`,{tabindex:k.value?void 0:-1,onPointerenter:E,onFocus:E,onClick:D},[x(`span`,Gi,[e(Y,{name:`bulb`,size:15})]),x(`span`,Ki,_(y.value||`Thinking`),1)],40,Wi),o.value?(s(),B(`div`,qi,_(a.value.text),1)):L(``,!0)],34)):m.value?(s(),B(`details`,{key:3,class:h([`row row-line row-tool`,[`is-`+m.value.status,`kind-`+m.value.kind]]),onToggle:I},[x(`summary`,{title:m.value.name+(m.value.status===`failed`?` · failed`:m.value.status===`canceled`?` · canceled`:``)},[x(`span`,Yi,[m.value.status===`running`?(s(),B(`span`,Xi)):(s(),p(Y,{key:1,name:m.value.status===`failed`?`close`:m.value.icon,size:15},null,8,[`name`]))]),m.value.showName||!m.value.summary?(s(),B(`span`,Zi,_(m.value.name),1)):L(``,!0),x(`span`,{class:h([`line-text`,{mono:m.value.kind!==`sub_agent`&&m.value.kind!==`plain`&&m.value.kind!==`unknown`}])},_(m.value.summary),3),m.value.meta?(s(),B(`span`,Qi,_(m.value.meta),1)):m.value.status===`canceled`?(s(),B(`span`,$i,`canceled`)):L(``,!0),g.value?(s(),B(`button`,{key:3,type:`button`,class:`line-open`,title:`Open the subagent conversation`,onClick:v},`Open`)):L(``,!0)],8,Ji),j.value?(s(),B(`div`,ea,[j.value.command?(s(),B(`pre`,ta,[r[0]||=x(`span`,{class:`tool-prompt`},`$`,-1),c(` `+_(j.value.command),1)])):L(``,!0),j.value.diff.length?(s(),B(`pre`,na,[(s(!0),B(b,null,u(j.value.diff,(e,t)=>(s(),B(`span`,{key:t,class:h(e.kind&&`diff-`+e.kind)},_(e.text)+`
28
- `,3))),128)),j.value.diffMore?(s(),B(`span`,ra,`… `+_(j.value.diffMore)+` more lines`,1)):L(``,!0)])):L(``,!0),j.value.input?(s(),B(`pre`,ia,_(j.value.input),1)):L(``,!0),j.value.output?(s(),B(`pre`,aa,_(j.value.output),1)):L(``,!0),j.value.error?(s(),B(`pre`,oa,_(j.value.error),1)):L(``,!0),j.value.exitCode!==null&&j.value.exitCode!==0&&!j.value.error?(s(),B(`p`,sa,`exit `+_(j.value.exitCode),1)):L(``,!0),!j.value.command&&!j.value.diff.length&&!j.value.input&&!j.value.output&&!j.value.error?(s(),B(`p`,ca,`No output`)):L(``,!0)])):L(``,!0)],34)):a.value.type===`todo`?(s(),B(`div`,la,[x(`div`,ua,[e(Y,{name:`list`,size:14}),r[1]||=c(` Plan`,-1)]),x(`ul`,null,[(s(!0),B(b,null,u(M.value,(e,t)=>(s(),B(`li`,{key:e.id??t,class:h({done:e.completed,active:e.status===`in_progress`})},[x(`span`,{class:h([`check`,{done:e.completed}])},null,2),c(_(e.text),1)],2))),128))])])):a.value.type===`error`?(s(),B(`div`,da,[e(Y,{name:`alert`,size:15}),r[2]||=c(),x(`span`,null,_(a.value.message),1)])):a.value.type===`notification`?(s(),B(`div`,{key:6,class:h([`row row-callout`,`is-`+a.value.level])},[e(Y,{name:`alert`,size:15}),r[3]||=c(),x(`span`,null,_(a.value.message),1)],2)):a.value.type===`compaction`?(s(),B(`div`,fa,[x(`span`,null,_(a.value.status===`loading`?`Compacting context…`:`Context compacted`),1)])):a.value.type===`plugin`?(s(),p(Di,{key:8,item:a.value,"seq-start":i.value.seqStart},null,8,[`item`,`seq-start`])):(s(),B(`details`,{key:9,class:`row row-line row-tool`,onToggle:I},[x(`summary`,null,[x(`span`,pa,[e(Y,{name:`tool`,size:15})]),x(`span`,ma,_(P.value),1)]),o.value?(s(),B(`div`,ha,[x(`pre`,ga,_(N.value),1)])):L(``,!0)],32))}}),ba=[`onPointerenter`],xa=[`aria-label`,`aria-current`,`onClick`],Sa={key:0,class:`outline-preview`,"aria-hidden":`true`},Ca=150,wa=3,Ta=l({__name:`ChatOutline`,props:{prompts:{},activeSeq:{}},emits:[`jump`],setup(e,{emit:t}){let n=e,r=t,a=F(null),o=F(!1),c;function l(e){a.value=e,o.value||c||(c=setTimeout(()=>{c=void 0,o.value=!0},Ca))}function d(){clearTimeout(c),c=void 0,a.value=null,o.value=!1}i(d);function f(e){if(a.value===null)return 0;let t=Math.abs(e-a.value);return t>=wa?0:(1+Math.cos(Math.PI*t/wa))/2}let p=S(()=>{let e=n.activeSeq;if(e===null)return-1;let t=-1;for(let r=0;r<n.prompts.length&&n.prompts[r].seq<=e;r++)t=r;return t});function m(e){let t=e===p.value?18:10,n=f(e);return{width:`${t+n*(26-t)}px`,height:`${2+2*n}px`}}function g(e){r(`jump`,n.prompts[e].seq)}return(t,n)=>(s(),B(`nav`,{class:`outline-rail`,"aria-label":`Prompts in this conversation`,onPointerleave:d},[(s(!0),B(b,null,u(e.prompts,(t,n)=>(s(),B(`div`,{key:t.seq,class:`outline-slot`,onPointerenter:e=>l(n)},[x(`button`,{type:`button`,class:`outline-target`,"aria-label":`${n+1} of ${e.prompts.length}: ${t.preview}`,"aria-current":n===p.value?`location`:void 0,onClick:e=>g(n)},[x(`span`,{class:h([`outline-tick`,{"is-active":n===p.value,"is-pointed":o.value&&n===a.value}]),style:P(m(n))},null,6)],8,xa),o.value&&n===a.value?(s(),B(`div`,Sa,_(t.preview||`(no text)`),1)):L(``,!0)],40,ba))),128))],32))}}),Ea={key:0,class:`icon provider-icon`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.25`,"stroke-linejoin":`round`,"aria-hidden":`true`},Da=[`transform`],Oa={key:1,class:`icon provider-icon`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},ka={key:2,class:`icon provider-icon`,width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"aria-hidden":`true`},Aa=[`transform`],ja=l({__name:`ProviderIcon`,props:{provider:{}},setup(e){let t=e,n=S(()=>t.provider.toLowerCase());return(e,t)=>n.value===`codex`||n.value===`openai`?(s(),B(`svg`,Ea,[(s(),B(b,null,u([0,60,120,180,240,300],e=>x(`path`,{key:e,transform:`rotate(${e} 12 12)`,d:`M12 3.2C14.3 1.8 17.4 3 18.1 5.5L18.1 12.4L12 15.9L8.6 13.9V7.1L14.5 3.7`},null,8,Da)),64))])):n.value===`pi`?(s(),B(`svg`,Oa,[...t[0]||=[x(`path`,{d:`M3 7c2-2 3-2 5-2h13M8 5v8c0 3-1 5-3 6M16 5v11c0 3 3 3 4 1`},null,-1)]])):n.value===`claude`||n.value===`anthropic`?(s(),B(`svg`,ka,[(s(),B(b,null,u([0,30,60,90,120,150],e=>x(`path`,{key:e,transform:`rotate(${e} 12 12)`,d:`M12 3v18`},null,8,Aa)),64))])):(s(),p(Y,{key:3,name:n.value===`gemini`?`sparkle`:`bot`,size:18,class:`provider-icon`},null,8,[`name`]))}}),Ma={class:`timeline-wrap`},Na={class:`timeline-inner`},Pa={key:0,class:`older`},Fa={key:0,class:`older-loading`,role:`status`},Ia={key:1,class:`notice`},La={key:0,class:`turn-footer`},Ra=[`aria-label`,`title`,`onClick`],za=[`title`],Ba=[`title`],Va=[`title`],Ha={key:2,class:`older`},Ua={key:0,class:`older-loading`,role:`status`},Wa={key:3,class:`timeline-working`,role:`status`,"aria-label":`Agent is working`},Ga={key:0,class:`timeline-elapsed`,"aria-hidden":`true`},Ka={key:1},qa={key:4,class:`timeline-empty`},Ja={key:0,class:`spinner`},Ya=l({__name:`ConversationView`,props:{agent:{},api:{type:Function},context:{},hostLabel:{},settled:{type:Boolean},footerModel:{}},emits:[`error`,`subagents`,`ready`,`timelineClick`,`unauthorized`,`suggestion`],setup(t,{expose:i,emit:o}){let l=t,d=o,f=()=>`/hosts/${encodeURIComponent(l.agent.hostId)}/agents/${encodeURIComponent(l.agent.id)}`,m=O([]),h=O({base:``,cwd:``}),g=e=>JSON.stringify([e.base,e.cwd,e.session,e.workspace,e.localHost,e.rewindModes]);j(()=>l.context,e=>{g(e)!==g(h.value)&&(h.value={...e,subagents:m})},{immediate:!0}),ee(xn,h);let v=T(Hr,null);v&&ee(Hr,{predict:e=>l.api(f()+`/suggestion`,`POST`,{token:e},65e3),use:e=>v.use(e),send:e=>v.send(e),offer:(e,t)=>d(`suggestion`,l.agent.key,e,t)});let y=!0,E=O(new Kr),D=F(``),k=F(null),A=O(null),M=F(!1),N=F([]),I=F(null),R=F(null),z=!1,V=S(()=>{if(A.value)return A.value;let e=E.value;return e.membership.value,e.rows.slice(-150)}),H=S(()=>{let e=V.value.map(e=>e.row.value),t=l.agent;return Bn(e,!!A.value&&N.value.length>0||!(t.turnActive??t.state===`running`))}),te=S(()=>{let e=E.value;return e.membership.value,e.rows.at(-1)?.seqStart}),ne=S(()=>{if(A.value)return M.value;let e=E.value;return e.membership.value,e.rows.length>150||e.hasOlder}),U=F(null),W;async function G(e,t){let n=new Set(t),r=V.value.filter(e=>n.has(e.seqStart)).map(e=>String(e.row.value.item.text??``).trim()).filter(Boolean).join(`
29
-
30
- `);if(r)try{await navigator.clipboard.writeText(r),U.value=e,clearTimeout(W),W=setTimeout(()=>U.value=null,1500)}catch{}}let re=S(()=>!A.value&&l.agent.state===`running`),K=F(Date.now()),ie=S(()=>re.value?l.agent.turnStartedAt??null:null),ae=S(()=>ie.value?ei(K.value-ie.value):``),oe=S(()=>ie.value?Math.max(0,Math.floor((K.value-ie.value)/1e3)):0),q;function se(){clearTimeout(q),q=void 0;let e=ie.value;if(!e||document.hidden||z||!y)return;let t=()=>{K.value=Date.now();let n=(K.value-e)%1e3;q=setTimeout(t,(n<0?-n:1e3-n)+10)};t()}j(ie,se,{immediate:!0}),document.addEventListener(`visibilitychange`,se);let J=$r(l.agent,e=>void l.api(`/diagnostics/timeline-slow`,`POST`,e).catch(()=>{}),e=>k.value=e),ce=le();function le(){return bn({url:()=>{let e=E.value.resumePoint(),t=e?`?epoch=${encodeURIComponent(e.epoch)}&seq=${e.seq}&from=${e.from}`:``;return`/api`+f()+`/timeline/stream`+t},onResponse:()=>J.response(),onState:e=>{e===`unauthorized`&&d(`unauthorized`),J.state(e)},onMessage:e=>{let t=E.value,n=e;if(n.type===`subagents`){m.value=n.subagents,d(`subagents`,n.subagents);return}J.message(n);let r=!A.value&&(be()||!t.ready),i=e.ops,a=i.find(e=>e.type===`error`);D.value=a?.type===`error`?a.message:``;let o=t.epoch,s=t.ready;t.apply(i),!s&&t.ready&&d(`ready`),t.epoch&&t.epoch!==Ae&&je(t),o&&o!==t.epoch&&(A.value=null,N.value=[],xe()),r&&xe()}})}let ue=!0,de=0;j(R,(e,t,n)=>{let r=e?.querySelector(`.timeline-inner`);if(!e||!r)return;let i=e.scrollTop,a=()=>{if(!y)return;let t=e.scrollTop;de=t,be()?ue=!0:t<i-1&&(ue=!1),Ie();let n=me!==null&&Math.abs(t-me)<2;n&&(me=null),!n&&performance.now()>=pe&&(t<i-1?fe=`up`:t>i+1&&(fe=`down`),ge()),i=t},o=new ResizeObserver(()=>{y&&!A.value&&ue&&xe()}),s=e=>{performance.now()<pe||!e.deltaY||(fe=e.deltaY<0?`up`:`down`,ge())},c=null,l,u=e=>{c=e.touches.length===1?e.touches[0].clientY:null},d=e=>{if(e.touches.length!==1){c=null;return}let t=e.touches[0].clientY;c!==null&&Math.abs(t-c)>2&&(fe=t>c?`up`:`down`,fe===`up`&&(ue=!1),performance.now()>=pe?ge():(clearTimeout(l),l=setTimeout(ge,50))),c=t},f=()=>{c=null};e.addEventListener(`touchstart`,u,{passive:!0}),e.addEventListener(`touchmove`,d,{passive:!0}),e.addEventListener(`touchend`,f,{passive:!0}),e.addEventListener(`touchcancel`,f,{passive:!0}),e.addEventListener(`scroll`,a,{passive:!0}),e.addEventListener(`wheel`,s,{passive:!0}),o.observe(r),o.observe(e),n(()=>{clearTimeout(l),e.removeEventListener(`touchstart`,u),e.removeEventListener(`touchmove`,d),e.removeEventListener(`touchend`,f),e.removeEventListener(`touchcancel`,f),o.disconnect(),e.removeEventListener(`scroll`,a),e.removeEventListener(`wheel`,s)})},{flush:`post`});let fe=null,pe=0,me=null;function he(e,t){e.scrollTop=t,me=e.scrollTop,pe=performance.now()+40}function ge(){let e=R.value;if(!e||!y||I.value||!fe||e.offsetParent===null)return;let t=Math.max(600,e.clientHeight);fe===`up`&&e.scrollTop<t&&ne.value?De(`before`):fe===`down`&&A.value&&e.scrollHeight-e.scrollTop-e.clientHeight<t&&De(`after`)}function _e(e){let t=R.value;if(!t)return null;let n=t.getBoundingClientRect(),r=Array.from(t.querySelectorAll(`[data-seq-start]`)).filter(e=>{let t=e.getBoundingClientRect();return t.bottom>n.top&&t.top<n.bottom}),i=e===`first`?r[0]:r.at(-1);return i?{seq:i.dataset.seqStart,top:i.getBoundingClientRect().top}:null}function ve(e){let t=R.value,n=e&&t?.querySelector(`[data-seq-start="${e.seq}"]`);return!t||!n?!1:(he(t,t.scrollTop+n.getBoundingClientRect().top-e.top),!0)}async function ye(){let e=_e(`last`);A.value=null,N.value=[],await w(),ve(e)?be()&&(ue=!0):xe()}function be(){let e=R.value;return!e||e.scrollHeight-e.scrollTop-e.clientHeight<120}function xe(){ue=!0,w(()=>{let e=R.value;e&&(e.scrollTop=e.scrollHeight)})}function Se(){A.value=null,N.value=[],xe()}function Ce(e,t){return l.api(f()+`/timeline?cursor=`+encodeURIComponent(JSON.stringify({epoch:e,seq:t})))}let we=new Set,Te=4;async function Ee(e,t,n){let r=[],i=!1;for(let a=0;a<8&&r.length<100;){let o=r.at(-1)?.seqStart??n,s=N.value.at(-1);if(s===void 0){let t=e.rows;if(!t.length)break;if(t[0].seqStart<=o||i){let e=t.findIndex(e=>e.seqStart>o);e>=0&&r.push(...t.slice(e,e+100-r.length));break}N.value.push(t[0].seqStart);continue}a++;let c=N.value,l=e=>!e.hasOlder||e.rows.some(e=>e.seqStart<=o),u=we.has(s)?0:Math.min(Te,c.length-1);if(u>0){let e=c.length-1-u,n=await Ce(t,c[e]);if(n.epoch!==t)return`stale`;if(l(n)){let t=c[e],i=n.rows.filter(e=>e.seqStart>o),a=100-r.length;c.splice(e),i.length>a&&c.push(t),r.push(...i.slice(0,a).map(e=>({seqStart:e.seqStart,row:O(e)}))),Te=Math.min(Te*2,64);continue}Te=u>>1;continue}let d=await Ce(t,s);if(d.epoch!==t)return`stale`;let f=d.rows.filter(e=>e.seqStart>o),p=!0;for(;!we.has(s)&&f.length&&d.hasOlder&&!d.rows.some(e=>e.seqStart<=o)&&a<8;){a++;let e=f[0].seqStart,n=await Ce(t,e);if(n.epoch!==t)return`stale`;let r=n.rows.filter(t=>t.seqStart>o&&t.seqStart<e);if(!r.length)break;d=n,f=r,p=!1}let m=100-r.length;if(!f.length&&s===e.rows[0]?.seqStart&&(i=!0),p&&f.length<=m&&N.value.pop(),r.push(...f.slice(0,m).map(e=>({seqStart:e.seqStart,row:O(e)}))),!p)break}return r.length?r:null}async function De(e){let t=E.value,n=R.value,r=V.value.slice();e===`before`&&r.forEach((e,t)=>r[t]={seqStart:e.seqStart,row:O(e.row.value)});let i=e===`before`?r[0]:r.at(-1);if(!i||I.value)return;let a=t.epoch;I.value=e;try{let o=()=>!z&&y&&E.value===t&&t.epoch===a;if(e===`before`){let e=await Ce(a,i.seqStart);if(!o())return;if(e.epoch!==a)return Se();let t=_e(`first`),s=qr(r,e,`before`);s.added&&(N.value.push(r.at(-1).seqStart+1),we.add(r.at(-1).seqStart+1)),A.value=s.rows,M.value=s.hasOlder,await w(),!ve(t)&&n&&(n.scrollTop=0)}else{let e=await Ee(t,a,i.seqStart);if(!o())return;if(e===`stale`)return Se();let s=t.rows.at(-1)?.seqStart,c=[...r,...e??[]].slice(-150);if(!e||s!==void 0&&c.at(-1).seqStart>=s){N.value=[],await ye();return}let l=_e(`last`);A.value=c,M.value=!0,await w(),!ve(l)&&n&&(n.scrollTop=n.scrollHeight)}}catch(e){d(`error`,String(e.message)),fe=null}finally{I.value=null}w(ge)}let Oe=matchMedia(`(hover: hover) and (pointer: fine)`).matches,ke=O(null),Ae=``;async function je(e){Ae=e.epoch;try{let t=await l.api(f()+`/timeline/prompts`);E.value===e&&t.epoch===e.epoch&&(ke.value=t.prompts)}catch{E.value===e&&(ke.value=[])}}let Me=e=>String(e.item.text??``).replace(/\s+/g,` `).trim().slice(0,240),Ne=S(()=>{let e=E.value;e.membership.value;let t=ke.value??[],n=t.at(-1)?.seq??-1,r=[];for(let t of e.rows)t.seqStart>n&&t.row.value.item.type===`user_message`&&r.push({seq:t.seqStart,preview:Me(t.row.value)});return r.length?[...t,...r]:t}),Pe=F(null),Fe=0;function Ie(){Fe||Ne.value.length<2||!Oe||(Fe=requestAnimationFrame(()=>{Fe=0;let e=_e(`first`);Pe.value=e?Number(e.seq):null}))}j([Ne,A],()=>void w(Ie));function Le(e){let t=R.value,n=t?.querySelector(`[data-seq-start="${e}"]`)??Array.from(t?.querySelectorAll(`[data-seq-start]`)??[]).find(t=>Number(t.dataset.seqStart)>=e||t.classList.contains(`row-assistant`)&&Number(t.dataset.seqEnd)>=e);t&&n&&(ue=!1,he(t,t.scrollTop+n.getBoundingClientRect().top-t.getBoundingClientRect().top-12),Ie())}async function Re(e,t=!1){let n=E.value;if(I.value||!y)return;if(R.value?.querySelector(`[data-seq-start="${e}"]`))return Le(e);let r=n.rows,i=r.length&&r[0].seqStart<=e?r.findIndex(t=>t.seqStart>=e||t.row.value.item.type===`assistant_message`&&t.row.value.seqEnd>=e):-1;if(i>=0){let t=i;return N.value=[],t>=r.length-150?A.value=null:(A.value=r.slice(t,t+150),M.value=t>0||n.hasOlder),await w(),Le(e)}let a=n.epoch,o=Ne.value.map(e=>e.seq).filter(t=>t>e&&(!r.length||t<r[0].seqStart));I.value=`before`;try{let i=t?e+1:o[0]??r[0]?.seqStart??2**53-1,s=[],c=!1;for(let t=0;t<8;t++){let t=await Ce(a,i);if(z||!y||E.value!==n)return;if(t.epoch!==a)return Se();if(s=[...t.rows,...s],c=t.hasOlder,!t.rows.length||t.rows[0].seqStart<=e||!t.hasOlder)break;i=t.rows[0].seqStart}let l=Math.max(0,s.findIndex(t=>t.seqStart>=e||t.item.type===`assistant_message`&&t.seqEnd>=e)),u=s.slice(l,l+150).map(e=>({seqStart:e.seqStart,row:O(e)}));if(N.value=[...o].reverse(),we.clear(),Te=4,u.length&&u.length<=50){let e=await Ee(n,a,u.at(-1).seqStart);if(z||!y||E.value!==n)return;if(e===`stale`)return Se();e&&(u=[...u,...e])}A.value=u,M.value=c||l>0,await w(),Le(e),fe=`down`,requestAnimationFrame(ge)}catch(e){d(`error`,String(e.message))}finally{I.value=null}}return a(()=>{y=!1,J.abandon(),ce.close(),clearTimeout(q),cancelAnimationFrame(Fe),Fe=0,fe=null}),r(()=>{if(y)return;y=!0;let e=R.value;e&&he(e,ue&&!A.value?e.scrollHeight:de),E.value.ready&&d(`ready`),m.value.length&&d(`subagents`,m.value),ce=le(),se(),Ie()}),n(()=>{z=!0,J.abandon(),ce.close(),clearTimeout(q),clearTimeout(W),cancelAnimationFrame(Fe),document.removeEventListener(`visibilitychange`,se)}),i({jumpToPrompt:Re,showLatest:Se,epoch:()=>E.value.epoch}),(n,r)=>(s(),B(`div`,Ma,[x(`div`,{ref_key:`timelineElement`,ref:R,class:`timeline`,onClick:r[1]||=e=>d(`timelineClick`,e)},[x(`div`,Na,[ne.value?(s(),B(`div`,Pa,[I.value===`before`?(s(),B(`span`,Fa,[...r[2]||=[x(`span`,{class:`spinner`},null,-1),c(`Loading earlier messages…`,-1)]])):(s(),B(`button`,{key:1,class:`btn btn-ghost`,onClick:r[0]||=e=>De(`before`)},`Show earlier messages`))])):L(``,!0),D.value?(s(),B(`p`,Ia,[e(Y,{name:`alert`,size:14}),c(_(D.value),1)])):L(``,!0),(s(!0),B(b,null,u(V.value,n=>(s(),B(b,{key:`${E.value.epoch}:${n.seqStart}`},[e(ya,{entry:n.row,final:n.seqStart!==te.value||t.settled,"data-seq-start":n.seqStart},null,8,[`entry`,`final`,`data-seq-start`]),H.value.get(n.seqStart)?(s(),B(`div`,La,[H.value.get(n.seqStart).messages.length?(s(),B(`button`,{key:0,type:`button`,class:`turn-item turn-copy`,"aria-label":U.value===n.seqStart?`Copied`:`Copy turn`,title:U.value===n.seqStart?`Copied`:`Copy turn`,onClick:e=>G(n.seqStart,H.value.get(n.seqStart).messages)},[e(Y,{name:U.value===n.seqStart?`check`:`copy`,size:14},null,8,[`name`]),c(_(U.value===n.seqStart?`Copied`:`Copy`),1)],8,Ra)):L(``,!0),t.footerModel&&n.row.value.provider===t.agent.provider?(s(),B(`span`,{key:1,class:`turn-item`,title:`Model: `+t.footerModel},[e(ja,{provider:n.row.value.provider},null,8,[`provider`]),c(_(t.footerModel),1)],8,za)):L(``,!0),x(`span`,{class:`turn-item`,title:`Finished `+H.value.get(n.seqStart).at},[e(Y,{name:`clock`,size:14}),c(_(H.value.get(n.seqStart).at),1)],8,Ba),H.value.get(n.seqStart).took?(s(),B(`span`,{key:2,class:`turn-item`,title:`Worked for `+H.value.get(n.seqStart).took},[e(Y,{name:`hourglass`,size:14}),c(_(H.value.get(n.seqStart).took),1)],8,Va)):L(``,!0)])):L(``,!0)],64))),128)),A.value?(s(),B(`div`,Ha,[I.value===`after`?(s(),B(`span`,Ua,[...r[3]||=[x(`span`,{class:`spinner`},null,-1),c(`Loading newer messages…`,-1)]])):(s(),B(`button`,{key:1,class:`btn btn-ghost`,onClick:Se},`Back to latest`))])):L(``,!0),re.value?(s(),B(`div`,Wa,[x(`span`,{class:`spinner spinner-ticked`,style:P(ae.value?{transform:`rotate(${oe.value*90}deg)`}:void 0)},null,4),ae.value?(s(),B(`span`,Ga,_(ae.value),1)):(s(),B(`span`,Ka,`Working…`))])):L(``,!0),V.value.length?L(``,!0):(s(),B(`div`,qa,[E.value.ready?L(``,!0):(s(),B(`span`,Ja)),c(` `+_(E.value.ready?`No messages yet.`:k.value===`server`?`Still connecting to LitePaseo…`:k.value===`network`?`Connected, waiting for the network to deliver data…`:k.value===`host`?`Waiting for ${t.hostLabel||`the host`} to load this conversation…`:`Loading conversation…`),1)]))])],512),Ne.value.length>=2&&C(Oe)?(s(),p(Ta,{key:0,prompts:Ne.value,"active-seq":Pe.value,onJump:Re},null,8,[`prompts`,`active-seq`])):L(``,!0)]))}}),Xa={class:`sheet-head`},Za=[`disabled`],Qa={class:`sheet-body`},$a={key:0,class:`sheet-note`},eo={class:`field-grid`},to={class:`field`},no=[`disabled`],ro=[`value`],io={class:`field`},ao=[`disabled`],oo={key:0,value:``},so=[`value`],co={key:0,class:`field`},lo=[`title`],uo={class:`field`},fo=[`placeholder`,`disabled`],po={class:`field-grid three`},mo={key:0,class:`field`},ho=[`disabled`],go=[`value`],_o={class:`field field-agent`},vo=[`disabled`],yo={key:0,value:``},bo=[`value`,`disabled`],xo={class:`field field-model`},So=[`disabled`],Co={key:0,value:``},wo=[`value`],To={class:`field field-thinking`},Eo=[`disabled`],Do={key:0,value:``},Oo=[`value`],ko={key:2,class:`field`},Ao=[`disabled`],jo=[`value`],Mo={class:`toggle`},No=[`disabled`],Po={key:3,class:`field`},Fo={key:4,class:`sheet-error`},Io={key:5,class:`sheet-error`},Lo={key:6,class:`sheet-error`,role:`alert`},Ro={class:`sheet-foot`},zo=[`disabled`],Bo=[`disabled`],Vo={key:0,class:`spinner spinner-on-accent`},Ho=`\0custom`,Uo=`litepaseo-new-session`,Wo=l({__name:`NewSession`,props:{hosts:{},initialHostId:{},initialCwd:{},initialProject:{},request:{type:Function}},emits:[`close`,`created`],setup(r,{emit:i}){let a=r,o=i,l=(()=>{try{return JSON.parse(localStorage.getItem(Uo)??`{}`)}catch{return{}}})(),d=S(()=>a.hosts.filter(e=>e.state===`connected`)),p=F(d.value.find(e=>e.id===a.initialHostId)?.id??d.value[0]?.id??``),h=F(null),y=F([]),C=F({}),T=0;async function E(e){let t=y.value.find(t=>t.id===e);if(!t)return;if(!h.value?.some(e=>e.id===t.provider)){te.value=`This profile's provider is unavailable on this host.`;return}let n=++T,r=p.value;M.value=t.provider,await w(),n===T&&r===p.value&&(P.value=t.model??G.value.find(e=>e.isDefault)?.id??G.value[0]?.id??``,await w(),n===T&&r===p.value&&(R.value=t.modeId??W.value?.defaultModeId??``,I.value=t.thinkingOptionId??re.value?.defaultThinkingId??``,C.value={...t.featureValues}))}let D=F(null),O=F(``),k=F(``),A=F(``),M=F(``),P=F(``),I=F(``),R=F(``),z=F(!1),ee=F(``),V=F(``),H=F(!1),te=F(``),ne=F(null),U=crypto.randomUUID(),W=S(()=>h.value?.find(e=>e.id===M.value)),G=S(()=>W.value?.models??[]),re=S(()=>G.value.find(e=>e.id===P.value)),K=S(()=>k.value===Ho?A.value.trim():k.value),ie=S(()=>D.value?.find(e=>e.rootPath===k.value)?.name??K.value.split(`/`).pop()??``),ae=S(()=>!!p.value&&!!K.value&&!!M.value&&!H.value&&(!z.value||!!ee.value.trim()));async function oe(e){if(++T,h.value=D.value=null,y.value=[],C.value={},a.request(`/hosts/${encodeURIComponent(e)}/settings`).then(t=>{e===p.value&&(y.value=t.features.agentProfiles?t.config.agentProfiles??[]:[])}).catch(()=>{}),O.value=``,e)try{let[t,n]=await Promise.all([a.request(`/hosts/${encodeURIComponent(e)}/providers`),a.request(`/hosts/${encodeURIComponent(e)}/projects`)]);if(e!==p.value)return;h.value=t,D.value=n.sort((e,t)=>e.name.localeCompare(t.name)),q();let r=D.value,i=e===a.initialHostId?a.initialProject:null,o=i?r.find(e=>i.key&&e.key===i.key)??r.find(e=>e.name.toLowerCase()===i.name.toLowerCase()):void 0;if(o)k.value=o.rootPath;else if(e===a.initialHostId&&a.initialCwd){let e=r.find(e=>e.rootPath===a.initialCwd);e?k.value=e.rootPath:(k.value=Ho,A.value=a.initialCwd)}else k.value||=r[0]?.rootPath??Ho}catch(t){e===p.value&&(O.value=t.message)}}function q(){let e=l[p.value]??{},t=h.value??[],n=t.find(t=>t.id===e.provider&&t.status!==`error`)??t.find(e=>e.status===`ready`)??t[0];M.value=n?.id??``,se(e.model,e.thinking),R.value=n?.modes.some(t=>t.id===e.mode)?e.mode:n?.defaultModeId??``}function se(e,t){let n=G.value,r=n.find(t=>t.id===e)??n.find(e=>e.isDefault)??n[0];P.value=r?.id??``,I.value=r?.thinking.some(e=>e.id===t)?t:r?.defaultThinkingId??``}j(p,e=>{k.value=``,oe(e)}),j(M,()=>{C.value={};let e=l[p.value];se(e?.provider===M.value?e.model:void 0);let t=W.value;t&&!t.modes.some(e=>e.id===R.value)&&(R.value=t.defaultModeId??``)}),j(P,()=>{let e=re.value;e&&!e.thinking.some(e=>e.id===I.value)&&(I.value=e.defaultThinkingId??``)}),j([p,k,A,M,P,I,R,C,z,ee,V],()=>{te.value&&(U=crypto.randomUUID()),te.value=``});async function J(){if(ae.value){H.value=!0,te.value=``;try{let e=await a.request(`/hosts/${encodeURIComponent(p.value)}/agents`,`POST`,{idempotencyKey:U,cwd:K.value,provider:M.value,...Object.keys(C.value).length?{featureValues:C.value}:{},...P.value?{model:P.value}:{},...R.value?{modeId:R.value}:{},...I.value?{thinkingOptionId:I.value}:{},...V.value.trim()?{prompt:V.value}:{},...z.value?{worktreeBranch:ee.value.trim()}:{}},12e4);l[p.value]={provider:M.value,model:P.value,thinking:I.value,mode:R.value},localStorage.setItem(Uo,JSON.stringify(l)),o(`created`,e.key)}catch(e){te.value=e.message}finally{H.value=!1}}}function ce(e){e.key===`Escape`&&!H.value&&o(`close`),e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),J())}return t(()=>{window.addEventListener(`keydown`,ce),oe(p.value),w(()=>ne.value?.focus())}),n(()=>window.removeEventListener(`keydown`,ce)),(t,n)=>(s(),B(`div`,{class:`overlay`,onMousedown:n[13]||=v(e=>!H.value&&o(`close`),[`self`])},[x(`form`,{class:`sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`New session`,onSubmit:v(J,[`prevent`])},[x(`header`,Xa,[n[14]||=x(`h2`,null,`New session`,-1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,disabled:H.value,onClick:n[0]||=e=>o(`close`)},[e(Y,{name:`close`,size:16})],8,Za)]),x(`div`,Qa,[d.value.length?(s(),B(b,{key:1},[x(`div`,eo,[x(`label`,to,[n[15]||=x(`span`,null,`Host`,-1),f(x(`select`,{"onUpdate:modelValue":n[1]||=e=>p.value=e,disabled:H.value},[(s(!0),B(b,null,u(d.value,e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,ro))),128))],8,no),[[N,p.value]])]),x(`label`,io,[n[16]||=x(`span`,null,`Project`,-1),f(x(`select`,{"onUpdate:modelValue":n[2]||=e=>k.value=e,disabled:H.value||!D.value},[D.value?L(``,!0):(s(),B(`option`,oo,`Loading…`)),(s(!0),B(b,null,u(D.value??[],e=>(s(),B(`option`,{key:e.key,value:e.rootPath},_(e.name),9,so))),128)),x(`option`,{value:Ho},`Another folder…`)],8,ao),[[N,k.value]])])]),k.value===Ho?(s(),B(`label`,co,[x(`span`,null,`Folder on `+_(d.value.find(e=>e.id===p.value)?.label),1),f(x(`input`,{"onUpdate:modelValue":n[3]||=e=>A.value=e,placeholder:`/home/me/code/project`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,A.value]])])):K.value?(s(),B(`p`,{key:1,class:`path-hint`,title:K.value},[e(Y,{name:`folder`,size:13}),c(_(K.value),1)],8,lo)):L(``,!0),x(`label`,uo,[n[17]||=x(`span`,null,`First message`,-1),f(x(`textarea`,{ref_key:`promptElement`,ref:ne,"onUpdate:modelValue":n[4]||=e=>V.value=e,rows:`5`,placeholder:ie.value?`What should the agent do in ${ie.value}?`:`What should the agent do?`,disabled:H.value},null,8,fo),[[g,V.value]])]),x(`div`,po,[y.value.length?(s(),B(`label`,mo,[n[19]||=x(`span`,null,`Apply agent profile`,-1),x(`select`,{disabled:H.value,value:``,onChange:n[5]||=e=>E(e.target.value)},[n[18]||=x(`option`,{value:``},`Choose profile…`,-1),(s(!0),B(b,null,u(y.value,e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.name),9,go))),128))],40,ho)])):L(``,!0),x(`label`,_o,[n[20]||=x(`span`,null,`Agent`,-1),f(x(`select`,{"onUpdate:modelValue":n[6]||=e=>M.value=e,disabled:H.value||!h.value},[h.value?L(``,!0):(s(),B(`option`,yo,`Loading…`)),(s(!0),B(b,null,u(h.value??[],e=>(s(),B(`option`,{key:e.id,value:e.id,disabled:e.status===`error`},_(e.label)+_(e.status===`loading`?` (starting)`:e.status===`error`?` (error)`:``),9,bo))),128))],8,vo),[[N,M.value]])]),x(`label`,xo,[n[21]||=x(`span`,null,`Model`,-1),f(x(`select`,{"onUpdate:modelValue":n[7]||=e=>P.value=e,disabled:H.value||!G.value.length},[G.value.length?L(``,!0):(s(),B(`option`,Co,`Default`)),(s(!0),B(b,null,u(G.value,e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,wo))),128))],8,So),[[N,P.value]])]),x(`label`,To,[n[22]||=x(`span`,null,`Thinking`,-1),f(x(`select`,{"onUpdate:modelValue":n[8]||=e=>I.value=e,disabled:H.value||!re.value?.thinking.length},[re.value?.thinking.length?L(``,!0):(s(),B(`option`,Do,`Default`)),(s(!0),B(b,null,u(re.value?.thinking??[],e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,Oo))),128))],8,Eo),[[N,I.value]])])]),W.value?.modes.length?(s(),B(`label`,ko,[n[23]||=x(`span`,null,`Mode`,-1),f(x(`select`,{"onUpdate:modelValue":n[9]||=e=>R.value=e,disabled:H.value},[(s(!0),B(b,null,u(W.value.modes,e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,jo))),128))],8,Ao),[[N,R.value]])])):L(``,!0),x(`label`,Mo,[f(x(`input`,{"onUpdate:modelValue":n[10]||=e=>z.value=e,type:`checkbox`,disabled:H.value},null,8,No),[[m,z.value]]),n[24]||=x(`span`,null,`Work in a new git worktree`,-1)]),z.value?(s(),B(`label`,Po,[n[25]||=x(`span`,null,`New branch`,-1),f(x(`input`,{"onUpdate:modelValue":n[11]||=e=>ee.value=e,placeholder:`feature/my-change`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,ee.value]])])):L(``,!0),O.value?(s(),B(`p`,Fo,[e(Y,{name:`alert`,size:14}),c(_(O.value),1)])):L(``,!0),W.value?.error?(s(),B(`p`,Io,[e(Y,{name:`alert`,size:14}),c(_(W.value.error),1)])):L(``,!0),te.value?(s(),B(`p`,Lo,[e(Y,{name:`alert`,size:14}),x(`span`,null,_(te.value),1)])):L(``,!0)],64)):(s(),B(`p`,$a,`No connected hosts. Connect a host first.`))]),x(`footer`,Ro,[n[26]||=x(`span`,{class:`sheet-hint hide-sm`},`Ctrl/⌘ + Enter to start`,-1),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:H.value,onClick:n[12]||=e=>o(`close`)},`Cancel`,8,zo),x(`button`,{class:`btn btn-primary`,disabled:!ae.value},[H.value?(s(),B(`span`,Vo)):L(``,!0),c(` `+_(H.value?`Starting…`:te.value?`Retry`:`Start session`),1)],8,Bo)])],32)],32))}}),Go={key:0,class:`attachment-tray`},Ko=[`data-state`,`title`],qo={class:`attachment-thumb`},Jo=[`src`,`alt`],Yo={key:2,class:`spinner spinner-sm attachment-uploading`},Xo={class:`attachment-text`},Zo={class:`attachment-name`},Qo={class:`attachment-meta`},$o=[`disabled`,`onClick`],es=[`aria-label`,`title`,`disabled`,`onClick`],ts={key:0,class:`attachment-error`,role:`alert`},ns=[`disabled`],rs=gn(l({__name:`AttachmentPanel`,props:{store:{},agentKey:{},base:{},busy:{type:Boolean}},setup(t,{expose:n}){let r=t,i=F(null),a=F(``),o=F(0),l=F(null),d=S(()=>r.store.get(r.agentKey));j([()=>r.base,o],async([e],t,n)=>{let r=new AbortController;n(()=>r.abort()),i.value=null,a.value=``;try{let t=await fetch(e+`/attachments/capabilities`,{signal:r.signal});if(!t.ok)throw Error(`Attachment capabilities are unavailable while the host is disconnected.`);let n=await t.json();r.signal.aborted||(i.value=n)}catch(e){r.signal.aborted||(a.value=e.message)}},{immediate:!0});let f=new Set([`image/png`,`image/jpeg`,`image/webp`]);function m(e){if(!f.has(e.type)||!/^image\.(png|jpe?g|webp)$/i.test(e.name))return e;let t=new Date().toISOString().replace(/[-:]/g,``).replace(`T`,`-`).slice(0,15),n=e.type===`image/jpeg`?`jpg`:e.type.slice(6);return new File([e],`pasted-${t}-${Math.random().toString(36).slice(2,6)}.${n}`,{type:e.type,lastModified:e.lastModified})}async function g(e,t){if(!f.has(e.type)||e.size<=t||typeof createImageBitmap!=`function`)return e;let n=await createImageBitmap(e);try{for(let[r,i]of[[3072,.9],[2400,.85],[1800,.8]]){let a=Math.min(1,r/Math.max(n.width,n.height)),o=document.createElement(`canvas`);o.width=Math.round(n.width*a),o.height=Math.round(n.height*a),o.getContext(`2d`).drawImage(n,0,0,o.width,o.height);let s=await new Promise(e=>o.toBlob(e,`image/jpeg`,i));if(s&&s.size<=t)return new File([s],e.name.replace(/\.\w+$/,`.jpg`),{type:`image/jpeg`})}}finally{n.close()}return e}async function v(e){if(e?.length&&!r.busy){a.value=``;try{if(!i.value)throw Error(`Wait for attachment capabilities, then try again.`);let t=i.value.maxBytes,n=await Promise.all(Array.from(e).map(e=>g(m(e),t)));await r.store.add(r.agentKey,r.base,n,i.value)}catch(e){a.value=e.message}l.value&&(l.value.value=``)}}let y=S(()=>!!i.value&&(i.value.images||i.value.files)),C=S(()=>i.value?y.value?[`Attach files (up to 4 · 8 MiB each · 24 MiB total)`,i.value.note].filter(Boolean).join(`
31
- `):`Attachments are unavailable for this agent`:a.value?`Attachments unavailable`:`Checking attachment support…`),w=()=>{y.value&&!r.busy&&l.value?.click()},T=e=>e<1048576?`${Math.ceil(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`;return n({addFiles:v,pick:w,available:y,hint:C}),(n,r)=>(s(),B(b,null,[x(`input`,{ref_key:`picker`,ref:l,type:`file`,multiple:``,hidden:``,"aria-label":`Choose attachments`,onChange:r[0]||=e=>v(l.value?.files)},null,544),d.value.length||a.value?(s(),B(`div`,Go,[(s(!0),B(b,null,u(d.value,n=>(s(),B(`div`,{key:n.localId,class:h([`attachment-item`,{"is-error":!!n.error}]),"data-state":n.uploading?`uploading`:n.error?`error`:`ready`,title:n.error||n.file.name},[x(`span`,qo,[n.preview?(s(),B(`img`,{key:0,src:n.preview,alt:n.file.name},null,8,Jo)):(s(),p(Y,{key:1,name:`file`,size:16})),n.uploading?(s(),B(`span`,Yo)):L(``,!0)]),x(`span`,Xo,[x(`span`,Zo,_(n.file.name),1),x(`span`,Qo,_(n.error?`Upload failed`:n.uploading?`Uploading…`:T(n.file.size)),1)]),n.error?(s(),B(`button`,{key:0,type:`button`,class:`attachment-action`,"aria-label":`Retry upload`,title:`Retry upload`,disabled:t.busy,onClick:e=>t.store.upload(n)},[e(Y,{name:`refresh`,size:13})],8,$o)):L(``,!0),x(`button`,{type:`button`,class:`attachment-action`,"aria-label":n.uploading?`Cancel upload`:`Remove attachment`,title:n.uploading?`Cancel upload`:`Remove attachment`,disabled:t.busy,onClick:e=>t.store.remove(t.agentKey,n)},[e(Y,{name:`close`,size:13})],8,es)],10,Ko))),128)),a.value?(s(),B(`p`,ts,[e(Y,{name:`alert`,size:13}),c(_(a.value)+` `,1),i.value?L(``,!0):(s(),B(`button`,{key:0,type:`button`,class:`attachment-retry`,disabled:t.busy,onClick:r[1]||=e=>o.value++},`Retry`,8,ns))])):L(``,!0)])):L(``,!0)],64))}}),[[`__scopeId`,`data-v-78817268`]]),is=class{entries=y(new Map);get(e){return this.entries.get(e)??[]}async add(e,t,n,r){for(let i of n){if(this.get(e).length>=4)throw Error(`Attach up to four files per message.`);if([...this.entries.values()].flat().reduce((e,t)=>e+t.file.size,0)+i.size>25165824)throw Error(`Attachments total more than 24 MiB. Remove files before adding more.`);if(!i.size||i.size>r.maxBytes)throw Error(`Files must be between 1 byte and 8 MiB.`);let n=[`image/png`,`image/jpeg`,`image/webp`,`image/gif`].includes(i.type);if(n?!r.images:!r.files)throw Error(n?`This provider does not support images.`:`This agent cannot read uploaded files.`);let a=y({localId:crypto.randomUUID(),file:i,preview:n?URL.createObjectURL(i):void 0,error:``,uploading:!1,cancelled:!1,base:t});this.entries.set(e,[...this.get(e),a]),this.upload(a)}}async upload(e){if(!(e.uploading||e.cancelled)){e.error=``,e.uploading=!0,e.controller=new AbortController;try{e.id&&await this.discardRemote(e);let t=await fetch(e.base+`/attachments`,{method:`POST`,body:e.file,headers:{"x-litepaseo":`1`,"x-file-name":encodeURIComponent(e.file.name),"content-type":e.file.type||`application/octet-stream`},signal:AbortSignal.any([e.controller.signal,AbortSignal.timeout(6e4)])}),n=await t.json();if(!t.ok)throw Error(n.error??`Upload failed`);e.id=n.id,e.cancelled&&await this.discardRemote(e)}catch(t){!e.cancelled&&!e.controller?.signal.aborted&&(e.error=t.message)}finally{e.uploading=!1}}}async discardRemote(e){let t=e.id;e.id=void 0,t&&await fetch(e.base+`/attachments/`+encodeURIComponent(t),{method:`DELETE`,headers:{"x-litepaseo":`1`},signal:AbortSignal.timeout(5e3)}).catch(()=>{})}remove(e,t,n=!1){t.cancelled=!0,t.controller?.abort(),t.preview&&URL.revokeObjectURL(t.preview),this.entries.set(e,this.get(e).filter(e=>e.localId!==t.localId)),n||this.discardRemote(t)}detach(e){let t=this.get(e);return this.entries.delete(e),t}reattach(e,t){let n=[...this.get(e),...t];for(let t of n.slice(4))this.remove(e,t);this.entries.set(e,n.slice(0,4))}consume(e,t){for(let n of this.get(e))n.id&&t.includes(n.id)&&this.remove(e,n,!0)}forgetRemote(e){for(let t of this.entries.values())for(let n of t)n.controller?.abort(),n.id=void 0,n.uploading=!1,n.error=e}clear(){for(let[e,t]of this.entries)for(let n of t)this.remove(e,n);this.entries.clear()}};function as(e){let t=e.input;if(e.kind!==`question`||!Array.isArray(t?.questions)||!t.questions.length)return null;let n=[],r=new Set;for(let i of t.questions){if(!i||typeof i!=`object`||typeof i.header!=`string`||!i.header.trim()||typeof i.question!=`string`||!i.question.trim()||r.has(i.header)||i.options!==void 0&&!Array.isArray(i.options))return null;let t=i.options??[];if(t.some(e=>!e||typeof e.label!=`string`||!e.label.trim()||e.description!==void 0&&typeof e.description!=`string`)||new Set(t.map(e=>e.label)).size!==t.length)return null;r.add(i.header),n.push({header:i.header,question:i.question,options:t,multiple:i.multiSelect===!0,other:i.isOther===!0||e.name===`AskUserQuestion`||!t.length,secret:i.isSecret===!0,required:i.required!==!1})}return n}function os(e,t){let n=e.map((e,n)=>{let r=t[n]??{selected:[],text:``},i=r.selected.filter(t=>e.options.some(e=>e.label===t)),a=e.other?r.text.trim():``,o=e.multiple?[...i,...a?[a]:[]].join(`, `):a||i[0]||``;if(e.required&&!o)throw Error(`Answer ${e.header} before submitting.`);return[e.header,o]});return{answers:Object.fromEntries(n)}}var ss={class:`permission-head`},cs={class:`permission-icon`},ls={class:`grow`},us={class:`row-title`},ds={class:`row-sub`},fs={class:`permission-details`},ps={key:0,class:`field`},ms=[`value`],hs=[`disabled`],gs=[`type`,`name`,`checked`,`onChange`],_s={key:0,class:`row-sub`},vs={key:0,class:`field`},ys=[`onUpdate:modelValue`,`type`,`aria-label`],bs={key:2,class:`field`},xs={key:3,role:`alert`},Ss={class:`permission-actions`},Cs=[`disabled`],ws=[`disabled`],Ts=gn(l({__name:`PermissionForm`,props:{permission:{},busy:{type:Boolean}},emits:[`respond`],setup(t,{emit:n}){let r=t,i=n,a=S(()=>as(r.permission)),o=F([]),l=F(``),d=F(``),p=F(``);j(()=>JSON.stringify(r.permission.input),()=>{o.value=(a.value??[]).map(()=>({selected:[],text:``})),l.value=``,p.value=``},{immediate:!0});function m(e,t,n){let r=o.value[e];n?r.selected=r.selected.includes(t)?r.selected.filter(e=>e!==t):[...r.selected,t]:(r.selected=[t],r.text=``)}function h(e){p.value=``;try{let t={behavior:e?`allow`:`deny`};if(d.value&&(t.selectedActionId=d.value),e&&r.permission.kind===`question`){if(a.value)t.updatedInput=os(a.value,o.value);else{let e=JSON.parse(l.value);if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Enter a JSON object for the answer.`);t.updatedInput=e}}i(`respond`,t)}catch(e){p.value=e instanceof SyntaxError?`Enter a valid JSON object for the answer.`:e.message}}return(n,r)=>(s(),B(`form`,{class:`permission`,onSubmit:r[3]||=v(e=>h(!0),[`prevent`])},[x(`div`,ss,[x(`span`,cs,[e(Y,{name:`shield`,size:16})]),x(`div`,ls,[x(`div`,us,_(t.permission.title||t.permission.name),1),x(`div`,ds,_(t.permission.kind===`question`?`Question`:`Permission request`)+` · `+_(t.permission.name),1)])]),x(`details`,fs,[r[4]||=x(`summary`,null,`Request details`,-1),x(`pre`,null,_(JSON.stringify(t.permission.input,null,2)),1)]),t.permission.actions?.length?(s(),B(`label`,ps,[r[6]||=x(`span`,null,`Action`,-1),f(x(`select`,{"onUpdate:modelValue":r[0]||=e=>d.value=e},[r[5]||=x(`option`,{value:``},`Default`,-1),(s(!0),B(b,null,u(t.permission.actions,e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label||e.id),9,ms))),128))],512),[[N,d.value]])])):L(``,!0),a.value?(s(!0),B(b,{key:1},u(a.value,(e,n)=>(s(),B(`fieldset`,{key:e.header,class:`question-field`,disabled:t.busy},[x(`legend`,null,_(e.header)+_(e.required?` *`:``)+`: `+_(e.question),1),(s(!0),B(b,null,u(e.options,r=>(s(),B(`label`,{key:r.label,class:`question-option`},[x(`input`,{type:e.multiple?`checkbox`:`radio`,name:t.permission.id+`:`+n,checked:o.value[n]?.selected.includes(r.label)&&(e.multiple||!o.value[n]?.text),onChange:t=>m(n,r.label,e.multiple)},null,40,gs),x(`span`,null,[c(_(r.label),1),r.description?(s(),B(`small`,_s,` — `+_(r.description),1)):L(``,!0)])]))),128)),e.other?(s(),B(`label`,vs,[x(`span`,null,_(e.options.length?`Other answer`:`Your answer`),1),f(x(`input`,{"onUpdate:modelValue":e=>o.value[n].text=e,type:e.secret?`password`:`text`,"aria-label":e.header+`: `+(e.options.length?`Other answer`:`Your answer`),autocomplete:`off`},null,8,ys),[[k,o.value[n].text]])])):L(``,!0)],8,hs))),128)):t.permission.kind===`question`?(s(),B(`label`,bs,[r[7]||=x(`span`,null,`This question format needs a JSON answer.`,-1),f(x(`textarea`,{"onUpdate:modelValue":r[1]||=e=>l.value=e,"aria-label":`Answer (JSON)`,rows:`3`,placeholder:`{"answers": {}}`},null,512),[[g,l.value]])])):L(``,!0),p.value?(s(),B(`p`,xs,_(p.value),1)):L(``,!0),x(`div`,Ss,[x(`button`,{type:`button`,class:`btn btn-outline`,disabled:t.busy,onClick:r[2]||=e=>h(!1)},`Deny`,8,Cs),x(`button`,{class:`btn btn-primary`,disabled:t.busy},`Allow / submit`,8,ws)])],32))}}),[[`__scopeId`,`data-v-f1db1c0a`]]),Es=`litepaseo-theme`,Ds=F((()=>{let e=localStorage.getItem(Es);return e===`light`||e===`dark`?e:`system`})()),Os=matchMedia(`(prefers-color-scheme: dark)`),ks=F(Os.matches);Os.addEventListener(`change`,e=>{ks.value=e.matches});var As=S(()=>Ds.value===`dark`||Ds.value===`system`&&ks.value);function js(e=Ds.value){Ds.value=e,e===`system`?(delete document.documentElement.dataset.theme,localStorage.removeItem(Es)):(document.documentElement.dataset.theme=e,localStorage.setItem(Es,e))}var Ms=[`system`,`light`,`dark`];function Ns(){js(Ms[(Ms.indexOf(Ds.value)+1)%Ms.length])}var Ps=[{id:`graphite`,label:`Graphite`,note:`Monochrome, like Paseo`,swatch:[`#18181b`,`#e4e4e7`],light:{"--accent":`#18181b`,"--accent-hover":`#3f3f46`,"--accent-soft":`rgba(24, 24, 27, 0.07)`,"--accent-fg":`#ffffff`,"--accent-2":`#71717a`,"--link":`#2563eb`,"--unread":`#16a34a`},dark:{"--accent":`#e4e4e7`,"--accent-hover":`#ffffff`,"--accent-soft":`rgba(255, 255, 255, 0.08)`,"--accent-fg":`#18191c`,"--accent-2":`#a1a1aa`,"--link":`#8ab4f8`,"--unread":`#4ade80`,"--surface-0":`#18191c`,"--surface-1":`#1d1e22`,"--surface-2":`#232429`,"--surface-3":`#2d2e34`,"--sidebar":`#141517`,"--fg":`#e4e4e7`,"--fg-muted":`#a1a1aa`,"--fg-faint":`#6b6b74`,"--border":`#2a2b30`,"--border-strong":`#3a3b42`,"--user-bubble":`#27282d`,"--code-bg":`#141517`,"--seg-track":`#141517`,"--seg-thumb":`#2d2e34`}},{id:`indigo`,label:`Indigo`,note:`Calm blue-violet`,swatch:[`#4f46e5`,`#8b93ff`],light:{"--accent":`#4f46e5`,"--accent-hover":`#4338ca`,"--accent-soft":`rgba(79, 70, 229, 0.1)`,"--accent-fg":`#ffffff`,"--accent-2":`#818cf8`,"--link":`#4f46e5`,"--unread":`#16a34a`},dark:{"--accent":`#8b93ff`,"--accent-hover":`#a5abff`,"--accent-soft":`rgba(139, 147, 255, 0.15)`,"--accent-fg":`#15172b`,"--accent-2":`#c4b5fd`,"--link":`#a5abff`,"--unread":`#4ade80`}},{id:`ocean`,label:`Ocean`,note:`Deep teal`,swatch:[`#0e7490`,`#5cc8dc`],light:{"--accent":`#0e7490`,"--accent-hover":`#0b5f76`,"--accent-soft":`rgba(14, 116, 144, 0.1)`,"--accent-fg":`#ffffff`,"--accent-2":`#22a3c4`,"--link":`#0e7490`,"--unread":`#16a34a`},dark:{"--accent":`#5cc8dc`,"--accent-hover":`#7fd6e6`,"--accent-soft":`rgba(92, 200, 220, 0.14)`,"--accent-fg":`#0f2328`,"--accent-2":`#8be0ee`,"--link":`#7fd6e6`,"--unread":`#4ade80`}},{id:`ember`,label:`Ember`,note:`Warm terracotta`,swatch:[`#c2410c`,`#f59e5b`],light:{"--accent":`#c2410c`,"--accent-hover":`#9a3412`,"--accent-soft":`rgba(194, 65, 12, 0.09)`,"--accent-fg":`#ffffff`,"--accent-2":`#ea7a3c`,"--link":`#b4410f`,"--unread":`#16a34a`},dark:{"--accent":`#f59e5b`,"--accent-hover":`#f8b47e`,"--accent-soft":`rgba(245, 158, 91, 0.14)`,"--accent-fg":`#2a1a0e`,"--accent-2":`#fbc08f`,"--link":`#f8b47e`,"--unread":`#4ade80`}}],Fs=`litepaseo-palette`,Is=F((()=>{let e=localStorage.getItem(Fs);return Ps.some(t=>t.id===e)?e:`ocean`})()),Ls=[];function Rs(){let e=document.documentElement.style;for(let t of Ls)e.removeProperty(t);let t=Ps.find(e=>e.id===Is.value)??Ps[0],n=As.value?t.dark:t.light;for(let[t,r]of Object.entries(n))e.setProperty(t,r);Ls=Object.keys(n),document.documentElement.dataset.palette=t.id}function zs(e=Is.value){Is.value=e,localStorage.setItem(Fs,e),Rs()}j(As,Rs);var Bs=`Brave turns push off by default. Open brave://settings/privacy, turn on “Use Google services for push messaging”, restart Brave, and try again.`,Vs=`This browser could not reach its push service. A proxy, VPN or firewall may block it, or this browser build has no push service; Chrome, Edge or Firefox work.`;function Hs(e){let{name:t,message:n}=e??{};return t===`AbortError`||/push service/i.test(String(n??``))}function Us(e,t){return Hs(e)?Error(t?Bs:Vs,{cause:e}):e instanceof Error?e:Error(String(e))}async function Ws(e=globalThis.navigator){let t=e?.brave;try{return typeof t?.isBrave==`function`&&await t.isBrave()===!0}catch{return!1}}var Gs=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Ks=()=>matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,qs=O(null),Js=F(Ks());window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),qs.value=e}),window.addEventListener(`appinstalled`,()=>{qs.value=null,Js.value=!0});async function Ys(){let e=qs.value;if(!e)return!1;await e.prompt();let{outcome:t}=await e.userChoice;return qs.value=null,t===`accepted`}var Xs=null;function Zs(){return`serviceWorker`in navigator?(Xs??=navigator.serviceWorker.register(`/sw.js`,{scope:`/`}).catch(()=>null),Xs):Promise.resolve(null)}function Qs(){return window.isSecureContext?`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window?`supported`:Gs&&!Ks()?`needs-install`:`unsupported`:`insecure`}async function $s(){let e=await Zs();return e?e.pushManager.getSubscription():null}function ec(e){let t=(e+`===`.slice((e.length+3)%4)).replace(/-/g,`+`).replace(/_/g,`/`),n=atob(t);return Uint8Array.from(n,e=>e.charCodeAt(0))}async function tc(e,t){let n=await Notification.requestPermission();if(n!==`granted`)throw Error(n===`denied`?`Notifications are blocked for this site in your browser settings.`:`Permission was not granted.`);let r=await Zs();if(!r)throw Error(`Service worker unavailable.`);let{publicKey:i}=await e(`/push/key`),a=await r.pushManager.getSubscription();if(!a)try{a=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:ec(i)})}catch(e){throw Us(e,await Ws())}return await e(`/push/subscribe`,`POST`,{subscription:a.toJSON(),prefs:t}),a}async function nc(e,t,n){await e(`/push/subscribe`,`POST`,{subscription:t.toJSON(),prefs:n})}async function rc(e){let t=await $s();t&&(await e(`/push/unsubscribe`,`POST`,{endpoint:t.endpoint}).catch(()=>{}),await t.unsubscribe().catch(()=>{}))}function ic(e){let t=navigator;t.setAppBadge&&(e>0?t.setAppBadge(e):t.clearAppBadge?.())?.catch(()=>{})}function ac(e){let t=document.querySelector(`link[rel="icon"][data-status]`);t||(document.querySelectorAll(`link[rel="icon"]`).forEach(e=>e.remove()),t=document.createElement(`link`),t.rel=`icon`,t.type=`image/png`,t.dataset.status=``,document.head.appendChild(t));let n=`/icons/favicon${e?`-`+e:``}-64.png`;t.getAttribute(`href`)!==n&&t.setAttribute(`href`,n)}var oc={class:`page`},sc={class:`page-head`},cc={class:`page-body`},lc={class:`field`},uc=[`disabled`],dc={class:`form-actions`},fc=[`disabled`],pc={key:0,class:`setting-note is-error`,role:`alert`},mc={key:1,class:`setting-note`,role:`status`},hc={class:`card`},gc={class:`card-row`},_c={class:`setting-icon`},vc={class:`segmented segmented-sm`,role:`radiogroup`,"aria-label":`Theme`},yc=[`aria-checked`,`onClick`],bc={class:`card-row palette-row`},xc={class:`setting-icon`},Sc={class:`grow`},Cc={class:`palette-grid`,role:`radiogroup`,"aria-label":`Colour palette`},wc=[`aria-checked`,`onClick`],Tc={class:`palette-swatch`},Ec={class:`palette-text`},Dc={class:`palette-name`},Oc={class:`row-sub`},kc={class:`card`},Ac={class:`card-row`},jc={class:`setting-icon`},Mc={class:`grow`},Nc={class:`row-sub`},Pc=[`disabled`],Fc=[`disabled`],Ic={class:`card-row switch-row`},Lc=[`disabled`],Rc={class:`card-row switch-row`},zc=[`disabled`],Bc={class:`card-row`},Vc=[`disabled`],Hc={key:0,class:`setting-note`},Uc={key:1,class:`setting-note is-error`},Wc={class:`card`},Gc={class:`card-row`},Kc={class:`setting-icon`},qc={class:`grow`},Jc={class:`row-sub`},Yc=[`disabled`],Xc={class:`field`},Zc={class:`field`},Qc=[`placeholder`,`required`],$c={class:`field-grid`},el={class:`field`},tl={class:`field`},nl={class:`field`},rl={class:`form-actions`},il=[`disabled`],al=[`disabled`],ol=[`disabled`],sl={key:2,class:`setting-note`},cl={key:3,class:`setting-note is-error`},ll={class:`card`},ul={class:`card-row`},dl={class:`setting-icon`},fl={class:`grow`},pl={class:`row-sub`},ml=[`disabled`],hl={class:`card`},gl={class:`card-row`},_l={class:`setting-icon`},vl={class:`grow`},yl={class:`row-sub`},bl=[`disabled`],xl={key:0,class:`card-row totp-setup`},Sl=[`src`],Cl={class:`grow`},wl={class:`secret`},Tl=[`disabled`],El={key:1,class:`card-row`},Dl=[`disabled`],Ol={key:4,class:`setting-note is-error`},kl={class:`card`},Al={class:`setting-icon`},jl={class:`grow`},Ml={class:`row-title`},Nl={key:0,class:`pill pill-current`},Pl={class:`row-sub`},Fl=[`disabled`,`onClick`],Il={key:0,class:`card-row row-sub`},Ll={class:`form-actions spaced`},Rl=[`disabled`],zl=l({__name:`Settings`,props:{request:{type:Function},totpEnabled:{type:Boolean},instanceName:{}},emits:[`instanceChanged`,`back`,`signedOut`,`totpChanged`,`dictationChanged`],setup(n,{emit:r}){let i=n,a=r,o=F(i.instanceName),l=F(!1),d=F(``),p=F(!1);j(()=>i.instanceName,(e,t)=>{o.value===t&&(o.value=e)}),j(o,()=>{p.value=!1},{flush:`sync`});async function y(){l.value=!0,d.value=``,p.value=!1;try{let e=await i.request(`/instance`,`PUT`,{name:o.value});o.value=e.name,a(`instanceChanged`,e.name),p.value=!0}catch(e){d.value=e.message}finally{l.value=!1}}let w=F(null),T=F({baseUrl:``,apiKey:``,model:``,languages:``,keywords:``}),E=(e,t)=>e.split(t).map(e=>e.trim()).filter(Boolean),D=F(!1),O=F(!1),k=F(``),A=F(``);function M(e){w.value=e,T.value={baseUrl:e.baseUrl,apiKey:``,model:e.model,languages:e.languages.join(`, `),keywords:e.keywords.join(`
32
- `)},a(`dictationChanged`,e.configured)}async function N(e){O.value=!0,k.value=A.value=``;try{await e()}catch(e){k.value=e.message}finally{O.value=!1}}let I=()=>N(async()=>{let e=T.value;M(await i.request(`/dictation`,`PUT`,{baseUrl:e.baseUrl,apiKey:e.apiKey,model:e.model,languages:E(e.languages,/[,\s]+/),keywords:E(e.keywords,/[,\n]+/)})),D.value=!1,A.value=`Saved. The microphone button is in the composer.`}),R=()=>N(async()=>{confirm(`Remove the transcription service? Voice input turns off on every device.`)&&(M(await i.request(`/dictation`,`DELETE`)),D.value=!1)});function z(){w.value&&M(w.value),D.value=!1,k.value=``}let ee=Qs(),V=F(null),H=F({attention:!0,turns:!0}),te=F(typeof Notification>`u`?`default`:Notification.permission),ne=F(!1),U=F(``),W=F(``);async function G(){if(ee!==`supported`||(V.value=await $s(),!V.value))return;let e=await i.request(`/push/status`,`POST`,{endpoint:V.value.endpoint});e.subscribed?H.value=e.prefs:V.value=null}async function re(e){ne.value=!0,W.value=U.value=``;try{await e()}catch(e){W.value=e.message}finally{ne.value=!1,te.value=typeof Notification>`u`?`default`:Notification.permission}}let K=()=>re(async()=>{V.value=await tc(i.request,H.value),U.value=`Notifications are on for this device.`}),ie=()=>re(async()=>{await rc(i.request),V.value=null}),ae=()=>re(async()=>{V.value&&await nc(i.request,V.value,H.value)}),oe=()=>re(async()=>{let{sent:e}=await i.request(`/push/test`,`POST`,{});U.value=e?`Test sent. It should arrive in a few seconds.`:`This device is not registered.`}),q=F(!1);async function se(){q.value=!0;try{await Ys()}finally{q.value=!1}}let J=F([]),ce=F(null),le=F(``),ue=F(``),de=F(!1);async function fe(){J.value=await i.request(`/sessions`)}async function pe(e){de.value=!0,ue.value=``;try{await e()}catch(e){ue.value=e.message}finally{de.value=!1}}let me=()=>pe(async()=>{ce.value=await i.request(`/totp/setup`,`POST`,{}),le.value=``}),he=()=>pe(async()=>{await i.request(`/totp/confirm`,`POST`,{code:le.value.trim()}),ce.value=null,le.value=``,a(`totpChanged`,!0)}),ge=()=>pe(async()=>{await i.request(`/totp/disable`,`POST`,{code:le.value.trim()}),le.value=``,a(`totpChanged`,!1)}),_e=e=>pe(async()=>{await i.request(`/sessions/`+e.id,`DELETE`),e.current?a(`signedOut`):await fe()}),ve=()=>pe(async()=>{confirm(`Sign out every device, including this one? Their notifications stop too.`)&&(await i.request(`/sessions/revoke-all`,`POST`,{}),a(`signedOut`))}),ye=e=>{let t=Math.max(0,(Date.now()-e)/1e3);return t<90?`just now`:t<5400?`${Math.round(t/60)} min ago`:t<129600?`${Math.round(t/3600)} h ago`:`${Math.round(t/86400)} days ago`},be=S(()=>te.value===`denied`);return t(()=>{G().catch(()=>{}),fe().catch(()=>{}),i.request(`/dictation`).then(M).catch(()=>{})}),(t,r)=>(s(),B(`section`,oc,[x(`header`,sc,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:r[0]||=e=>a(`back`)},[e(Y,{name:`back`,size:18})]),r[13]||=x(`div`,null,[x(`h1`,null,`Settings`),x(`p`,{class:`subtle`},`Appearance, notifications, the app on your phone, and who can sign in.`)],-1)]),x(`div`,cc,[r[32]||=x(`h2`,{class:`section-label`},`Instance`,-1),x(`form`,{class:`card form-card`,onSubmit:v(y,[`prevent`])},[x(`label`,lc,[r[14]||=x(`span`,null,`Instance name`,-1),f(x(`input`,{"onUpdate:modelValue":r[1]||=e=>o.value=e,maxlength:`64`,placeholder:`LitePaseo`,disabled:l.value},null,8,uc),[[g,o.value]])]),r[15]||=x(`p`,{class:`subtle`},`Shown in browser tabs and the sidebar for everyone using this instance. Leave blank to use LitePaseo.`,-1),x(`div`,dc,[x(`button`,{class:`btn btn-primary`,disabled:l.value||o.value===n.instanceName},_(l.value?`Saving…`:`Save instance name`),9,fc)]),d.value?(s(),B(`p`,pc,_(d.value),1)):L(``,!0),p.value?(s(),B(`p`,mc,`Instance name saved.`)):L(``,!0)],32),r[33]||=x(`h2`,{class:`section-label`},`Appearance`,-1),x(`div`,hc,[x(`div`,gc,[x(`span`,_c,[e(Y,{name:`sun`,size:16})]),r[16]||=x(`div`,{class:`grow`},[x(`div`,{class:`row-title`},`Theme`)],-1),x(`div`,vc,[(s(),B(b,null,u([`system`,`light`,`dark`],e=>x(`button`,{key:e,role:`radio`,"aria-checked":C(Ds)===e,class:h({chosen:C(Ds)===e}),onClick:t=>C(js)(e)},_(e===`system`?`System`:e===`light`?`Light`:`Dark`),11,yc)),64))])]),x(`div`,bc,[x(`span`,xc,[e(Y,{name:`sparkle`,size:16})]),x(`div`,Sc,[r[17]||=x(`div`,{class:`row-title`},`Colour`,-1),x(`div`,Cc,[(s(!0),B(b,null,u(C(Ps),e=>(s(),B(`button`,{key:e.id,type:`button`,role:`radio`,class:h([`palette-option`,{chosen:C(Is)===e.id}]),"aria-checked":C(Is)===e.id,onClick:t=>C(zs)(e.id)},[x(`span`,Tc,[x(`span`,{style:P({background:e.swatch[0]})},null,4),x(`span`,{style:P({background:e.swatch[1]})},null,4)]),x(`span`,Ec,[x(`span`,Dc,_(e.label),1),x(`span`,Oc,_(e.note),1)])],10,wc))),128))])])])]),r[34]||=x(`h2`,{class:`section-label`},`Notifications`,-1),x(`div`,kc,[x(`div`,Ac,[x(`span`,jc,[e(Y,{name:`bell`,size:16})]),x(`div`,Mc,[r[18]||=x(`div`,{class:`row-title`},`Push notifications`,-1),x(`div`,Nc,[C(ee)===`insecure`?(s(),B(b,{key:0},[c(`Needs HTTPS. Open the console through your tunnel's https:// address.`)],64)):C(ee)===`needs-install`?(s(),B(b,{key:1},[c(`On iPhone and iPad, add LitePaseo to your Home Screen first, then open it from there.`)],64)):C(ee)===`unsupported`?(s(),B(b,{key:2},[c(`This browser cannot receive push notifications.`)],64)):be.value?(s(),B(b,{key:3},[c(`Blocked in this browser's site settings. Allow notifications there, then return.`)],64)):V.value?(s(),B(b,{key:4},[c(`On for this device. Arrives even when the app is closed.`)],64)):(s(),B(b,{key:5},[c(`Get told when an agent needs you or a turn finishes, even with the app closed.`)],64))])]),C(ee)===`supported`&&!V.value&&!be.value?(s(),B(`button`,{key:0,class:`btn btn-primary`,disabled:ne.value,onClick:K},` Turn on `,8,Pc)):V.value?(s(),B(`button`,{key:1,class:`btn btn-outline`,disabled:ne.value,onClick:ie},`Turn off`,8,Fc)):L(``,!0)]),V.value?(s(),B(b,{key:0},[x(`label`,Ic,[r[19]||=x(`div`,{class:`grow`},[x(`div`,{class:`row-title`},`When an agent needs your input`),x(`div`,{class:`row-sub`},`Permission requests and questions`)],-1),f(x(`input`,{"onUpdate:modelValue":r[2]||=e=>H.value.attention=e,class:`switch`,type:`checkbox`,disabled:ne.value,onChange:ae},null,40,Lc),[[m,H.value.attention]])]),x(`label`,Rc,[r[20]||=x(`div`,{class:`grow`},[x(`div`,{class:`row-title`},`When a turn finishes`),x(`div`,{class:`row-sub`},`Including failed turns`)],-1),f(x(`input`,{"onUpdate:modelValue":r[3]||=e=>H.value.turns=e,class:`switch`,type:`checkbox`,disabled:ne.value,onChange:ae},null,40,zc),[[m,H.value.turns]])]),x(`div`,Bc,[r[21]||=x(`div`,{class:`grow row-sub`},`Not sent while you are viewing that conversation on any device.`,-1),x(`button`,{class:`btn btn-outline`,disabled:ne.value,onClick:oe},`Send a test`,8,Vc)])],64)):L(``,!0)]),U.value?(s(),B(`p`,Hc,_(U.value),1)):L(``,!0),W.value?(s(),B(`p`,Uc,_(W.value),1)):L(``,!0),r[35]||=x(`h2`,{class:`section-label`},`Voice input`,-1),x(`div`,Wc,[x(`div`,Gc,[x(`span`,Kc,[e(Y,{name:`mic`,size:16})]),x(`div`,qc,[r[22]||=x(`div`,{class:`row-title`},`Transcription service`,-1),x(`div`,Jc,[w.value?.configured?(s(),B(b,{key:0},[c(_(w.value.model)+` · `+_(w.value.baseUrl.replace(/^https?:\/\//,``))+` · key `+_(w.value.keyHint)+_(w.value.languages.length?` · `+w.value.languages.join(`, `):``)+_(w.value.keywords.length?` · ${w.value.keywords.length} terms`:``),1)],64)):(s(),B(b,{key:1},[c(`Any OpenAI-compatible speech-to-text API. Set it once here and the microphone works for every host.`)],64))])]),D.value?L(``,!0):(s(),B(`button`,{key:0,class:`btn btn-outline`,disabled:O.value||!w.value,onClick:r[4]||=e=>D.value=!0},_(w.value?.configured?`Edit`:`Set up`),9,Yc))]),D.value?(s(),B(`form`,{key:0,class:`card-row voice-form`,onSubmit:v(I,[`prevent`])},[x(`label`,Xc,[r[23]||=x(`span`,null,`Base URL`,-1),f(x(`input`,{"onUpdate:modelValue":r[5]||=e=>T.value.baseUrl=e,placeholder:`https://api.openai.com/v1`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,T.value.baseUrl]])]),x(`label`,Zc,[r[24]||=x(`span`,null,`API key`,-1),f(x(`input`,{"onUpdate:modelValue":r[6]||=e=>T.value.apiKey=e,type:`password`,autocomplete:`off`,placeholder:w.value?.configured?`Unchanged (`+w.value.keyHint+`)`:`sk-…`,required:!w.value?.configured},null,8,Qc),[[g,T.value.apiKey]])]),x(`div`,$c,[x(`label`,el,[r[25]||=x(`span`,null,`Model`,-1),f(x(`input`,{"onUpdate:modelValue":r[7]||=e=>T.value.model=e,placeholder:`gpt-transcribe`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,T.value.model]])]),x(`label`,tl,[r[26]||=x(`span`,null,`Languages`,-1),f(x(`input`,{"onUpdate:modelValue":r[8]||=e=>T.value.languages=e,placeholder:`Detect (or zh, en)`,maxlength:`80`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,T.value.languages]])])]),x(`label`,nl,[r[27]||=x(`span`,null,`Vocabulary`,-1),f(x(`textarea`,{"onUpdate:modelValue":r[9]||=e=>T.value.keywords=e,rows:`3`,placeholder:`LitePaseo
33
- Claude Code
34
- pnpm`,spellcheck:`false`},null,512),[[g,T.value.keywords]])]),r[28]||=x(`p`,{class:`row-sub`},` The key stays on this server; browsers never see it. List every language you mix while speaking. Vocabulary is names and terms to spell right, one per line. gpt-transcribe gets both as hints; Whisper-style models get one language and the terms as a prompt. `,-1),x(`div`,rl,[w.value?.configured?(s(),B(`button`,{key:0,type:`button`,class:`btn btn-ghost voice-remove`,disabled:O.value,onClick:R},`Remove`,8,il)):L(``,!0),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:O.value,onClick:z},`Cancel`,8,al),x(`button`,{class:`btn btn-primary`,disabled:O.value},`Save`,8,ol)])],32)):L(``,!0)]),A.value?(s(),B(`p`,sl,_(A.value),1)):L(``,!0),k.value?(s(),B(`p`,cl,_(k.value),1)):L(``,!0),r[36]||=x(`h2`,{class:`section-label`},`App`,-1),x(`div`,ll,[x(`div`,ul,[x(`span`,dl,[e(Y,{name:`phone`,size:16})]),x(`div`,fl,[r[29]||=x(`div`,{class:`row-title`},`Install LitePaseo`,-1),x(`div`,pl,[C(Js)?(s(),B(b,{key:0},[c(`Installed. You are using the app.`)],64)):C(qs)?(s(),B(b,{key:1},[c(`Full screen, its own icon, and notifications.`)],64)):C(Gs)?(s(),B(b,{key:2},[c(`In Safari, tap Share, then “Add to Home Screen”.`)],64)):(s(),B(b,{key:3},[c(`Use your browser's menu: “Install app” or “Add to Home screen”.`)],64))])]),C(qs)&&!C(Js)?(s(),B(`button`,{key:0,class:`btn btn-primary`,disabled:q.value,onClick:se},`Install`,8,ml)):L(``,!0)])]),r[37]||=x(`h2`,{class:`section-label`},`Sign-in`,-1),x(`div`,hl,[x(`div`,gl,[x(`span`,_l,[e(Y,{name:`shield`,size:16})]),x(`div`,vl,[r[30]||=x(`div`,{class:`row-title`},`Authenticator code`,-1),x(`div`,yl,_(n.totpEnabled?`On. Sign in with your access token and a 6-digit authenticator code.`:`Require an authenticator code in addition to your access token. Other browsers will need to sign in again.`),1)]),!n.totpEnabled&&!ce.value?(s(),B(`button`,{key:0,class:`btn btn-outline`,disabled:de.value,onClick:me},`Set up`,8,bl)):L(``,!0)]),ce.value?(s(),B(`div`,xl,[x(`img`,{src:ce.value.qr,alt:`Authenticator QR code`,width:`164`,height:`164`},null,8,Sl),x(`div`,Cl,[r[31]||=x(`p`,{class:`row-sub`},`Scan with Google Authenticator, 1Password, Authy or similar. Or enter this key:`,-1),x(`code`,wl,_(ce.value.secret.match(/.{1,4}/g)?.join(` `)),1),x(`form`,{class:`code-form`,onSubmit:v(he,[`prevent`])},[f(x(`input`,{"onUpdate:modelValue":r[10]||=e=>le.value=e,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,placeholder:`123456`,"aria-label":`Code from your app`},null,512),[[g,le.value]]),x(`button`,{class:`btn btn-primary`,disabled:de.value||le.value.trim().length!==6},`Turn on`,8,Tl),x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:r[11]||=e=>ce.value=null},`Cancel`)],32)])])):L(``,!0),n.totpEnabled?(s(),B(`div`,El,[x(`form`,{class:`code-form grow`,onSubmit:v(ge,[`prevent`])},[f(x(`input`,{"onUpdate:modelValue":r[12]||=e=>le.value=e,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,placeholder:`Current code`,"aria-label":`Current code`},null,512),[[g,le.value]]),x(`button`,{class:`btn btn-outline`,disabled:de.value||le.value.trim().length!==6},`Turn off`,8,Dl)],32)])):L(``,!0)]),ue.value?(s(),B(`p`,Ol,_(ue.value),1)):L(``,!0),r[38]||=x(`h2`,{class:`section-label`},`Signed-in devices`,-1),x(`div`,kl,[(s(!0),B(b,null,u(J.value,t=>(s(),B(`div`,{key:t.id,class:`card-row`},[x(`span`,Al,[e(Y,{name:/iOS|Android/.test(t.label)?`phone`:`monitor`,size:16},null,8,[`name`])]),x(`div`,jl,[x(`div`,Ml,[c(_(t.label),1),t.current?(s(),B(`span`,Nl,`This device`)):L(``,!0)]),x(`div`,Pl,`Active `+_(ye(t.lastSeen))+` · signed in `+_(new Date(t.created).toLocaleDateString()),1)]),x(`button`,{class:`btn btn-outline`,disabled:de.value,onClick:e=>_e(t)},_(t.current?`Sign out`:`Revoke`),9,Fl)]))),128)),J.value.length?L(``,!0):(s(),B(`div`,Il,`Signed in with the access token only.`))]),x(`div`,Ll,[x(`button`,{class:`btn btn-ghost`,disabled:de.value,onClick:ve},`Sign out everywhere`,8,Rl)])])]))}}),Bl={class:`agent-board`},Vl=[`title`],Hl={class:`count`},Ul=[`onClick`,`onKeydown`],Wl={class:`task-top`},Gl={class:`task-title`},Kl={class:`task-meta`},ql=[`onClick`],Jl=[`disabled`,`onClick`],Yl=[`disabled`,`onClick`],Xl=[`disabled`,`onClick`],Zl=[`onClick`],Ql={key:1,class:`column-empty`},$l=40,eu=l({__name:`AgentBoard`,props:{store:{},hostLabels:{},busy:{type:Boolean}},emits:[`open`,`stop`,`read`,`archive`],setup(t,{emit:n}){let r=t,i=n,a={needs_input:`Needs you`,running:`Running`,review:`To review`,done:`Done`},o={needs_input:`Waiting on a permission or an answer`,running:`Working right now`,review:`Finished or failed, not looked at yet`,done:`Seen and settled`},l=y({needs_input:$l,running:$l,review:$l,done:$l}),d=S(()=>(r.store.version.value,oe.map(e=>({lane:e,size:r.store.laneSize(e),agents:r.store.laneRange(e,0,l[e])})))),f=e=>{if(!e||e<15778368e5)return``;let t=Math.max(0,(Date.now()-e)/1e3);return t<60?`just now`:t<3600?`${Math.round(t/60)} min ago`:t<86400?`${Math.round(t/3600)} h ago`:`${Math.round(t/86400)} d ago`},p=e=>{if(e.state===`needs_input`){let t=e.pendingPermissions[0];return t?`${t.kind===`question`?`Asks:`:`Wants to`} ${se(t.title||t.name)}`:`Waiting for you`}return e.state===`failed`?e.lastError||`Turn failed`:e.state===`running`?`Working…`:e.state===`unread`?`Finished ${f(e.activityAt)}`:f(e.activityAt)};return(n,r)=>(s(),B(`div`,Bl,[(s(!0),B(b,null,u(d.value,n=>(s(),B(`section`,{key:n.lane,class:h([`lane`,`lane-`+n.lane])},[x(`header`,{class:`lane-head`,title:o[n.lane]},[r[1]||=x(`span`,{class:`lane-dot`},null,-1),x(`h3`,null,_(a[n.lane]),1),x(`span`,Hl,_(n.size),1)],8,Vl),(s(!0),B(b,null,u(n.agents,n=>(s(),B(`article`,{key:n.key,class:h([`task-card`,`is-`+n.state]),tabindex:`0`,onClick:e=>i(`open`,n.key),onKeydown:I(e=>i(`open`,n.key),[`enter`])},[x(`div`,Wl,[x(`span`,{class:h([`status-dot`,`is-`+(n.state===`needs_input`?`attention`:n.state===`failed`?`error`:n.state)])},null,2),x(`span`,Gl,_(n.title||`Untitled session`),1)]),x(`div`,Kl,_(n.project)+` · `+_(t.hostLabels.get(n.hostId)??`?`)+` · `+_(n.provider),1),x(`div`,{class:h([`task-detail`,{"is-error":n.state===`failed`}])},_(p(n)),3),x(`div`,{class:`task-actions`,onClick:r[0]||=v(()=>{},[`stop`])},[n.state===`needs_input`?(s(),B(`button`,{key:0,class:`btn btn-primary btn-sm`,onClick:e=>i(`open`,n.key)},`Respond`,8,ql)):L(``,!0),n.state===`running`?(s(),B(`button`,{key:1,class:`btn btn-outline btn-sm`,disabled:t.busy,onClick:e=>i(`stop`,n)},[e(Y,{name:`stop`,size:11}),r[2]||=c(`Stop `,-1)],8,Jl)):L(``,!0),n.unread?(s(),B(`button`,{key:2,class:`btn btn-outline btn-sm`,disabled:t.busy,onClick:e=>i(`read`,n)},[e(Y,{name:`check`,size:12}),r[3]||=c(`Mark read `,-1)],8,Yl)):L(``,!0),n.state!==`running`&&n.state!==`needs_input`?(s(),B(`button`,{key:3,class:`btn btn-ghost btn-sm`,disabled:t.busy,onClick:e=>i(`archive`,n)},` Archive `,8,Xl)):L(``,!0)])],42,Ul))),128)),n.size>l[n.lane]?(s(),B(`button`,{key:0,class:`btn btn-ghost lane-more`,onClick:e=>l[n.lane]+=$l},` Show `+_(Math.min($l,n.size-l[n.lane]))+` more `,9,Zl)):L(``,!0),n.size?L(``,!0):(s(),B(`p`,Ql,`Nothing here`))],2))),128))]))}}),tu={key:0,class:`usage`},nu=[`aria-expanded`],ru={class:`usage-name`},iu={key:0,class:`usage-card`,role:`dialog`,"aria-label":`Usage limits`},au=[`disabled`],ou={key:0,class:`spinner spinner-sm`},su={class:`usage-account-head`},cu={class:`row-title`},lu={class:`row-sub`},uu={key:0,class:`row-sub is-error`},du={class:`usage-window-head`},fu={class:`usage-bar`},pu={class:`usage-window-foot`},mu={class:`usage-foot`},hu=l({__name:`UsagePanel`,props:{report:{},loading:{type:Boolean}},emits:[`refresh`],setup(t,{emit:n}){let r=t,i=n,a=F(!1);function o(e){let t=`${e.shortLabel??``} ${e.label}`.toLowerCase();return/5\s*h|5-hour|five/.test(t)?18e6:/wk|week/.test(t)?6048e5:/month|mo\b/.test(t)?2592e6:null}function l(e){let t=o(e);if(e.remainingPct===null||!e.resetsAt||!t)return null;let n=Date.parse(e.resetsAt)-Date.now(),r=t<=18e6?36e5:864e5;if(n<=r)return null;let i=e.remainingPct/(n/r),a=i/(100/(t/r));return{text:`${i.toFixed(+(i<10))}% per ${r===36e5?`hour`:`day`}`,tone:a>=.85?`ok`:a>=.5?`warning`:`danger`}}function d(e){return e.remainingPct===null?`default`:e.remainingPct<10?`danger`:e.remainingPct<30?`warning`:`ok`}function f(e){if(!e.resetsAt)return``;let t=new Date(e.resetsAt),n=t.getTime()-Date.now();if(n<=0)return`resetting`;let r=new Date,i=new Date(r.getTime()+864e5),a=t.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}),o=t.toDateString()===r.toDateString()?`today`:t.toDateString()===i.toDateString()?`tomorrow`:t.toLocaleDateString([],{weekday:`short`,month:`numeric`,day:`numeric`}),s=Math.floor(n/36e5),c=Math.round(n%36e5/6e4);return`${o} ${a} · in ${s>=24?`${Math.floor(s/24)}d ${s%24}h`:s?`${s}h ${c}m`:`${c}m`}`}let m=S(()=>r.report?.accounts.filter(e=>e.windows.length||e.error)??[]),g=e=>e.shortLabel??e.label;return(n,r)=>m.value.length?(s(),B(`div`,tu,[x(`button`,{class:`usage-summary`,"aria-expanded":a.value,onClick:r[0]||=e=>a.value=!a.value},[(s(!0),B(b,null,u(m.value,e=>(s(),B(`span`,{key:e.key,class:`usage-line`},[x(`span`,ru,_(e.name),1),(s(!0),B(b,null,u(e.windows.slice(0,3),e=>(s(),B(`span`,{key:e.id,class:h([`usage-pct`,`tone-`+d(e)])},[c(_(e.remainingPct===null?`—`:Math.round(e.remainingPct)+`%`),1),x(`small`,null,_(g(e)),1)],2))),128))]))),128))],8,nu),a.value?(s(),B(`div`,iu,[x(`header`,null,[r[3]||=x(`strong`,null,`Usage left`,-1),x(`button`,{class:`icon-btn`,disabled:t.loading,title:`Refresh`,"aria-label":`Refresh usage`,onClick:r[1]||=e=>i(`refresh`)},[t.loading?(s(),B(`span`,ou)):(s(),p(Y,{key:1,name:`refresh`,size:14}))],8,au),x(`button`,{class:`icon-btn`,"aria-label":`Close`,onClick:r[2]||=e=>a.value=!1},[e(Y,{name:`close`,size:14})])]),(s(!0),B(b,null,u(m.value,e=>(s(),B(`section`,{key:e.key,class:`usage-account`},[x(`div`,su,[x(`span`,cu,_(e.name),1),x(`span`,lu,_([e.plan,e.hosts.join(`, `)].filter(Boolean).join(` · `)),1)]),e.error?(s(),B(`p`,uu,_(e.error),1)):L(``,!0),(s(!0),B(b,null,u(e.windows,e=>(s(),B(`div`,{key:e.id,class:`usage-window`},[x(`div`,du,[x(`span`,null,_(e.label),1),x(`strong`,{class:h(`tone-`+d(e))},_(e.remainingPct===null?`—`:Math.round(e.remainingPct)+`% left`),3)]),x(`div`,fu,[x(`span`,{class:h(`tone-`+d(e)),style:P({width:Math.max(0,Math.min(100,e.remainingPct??0))+`%`})},null,6)]),x(`div`,pu,[x(`span`,null,_(f(e)),1),l(e)?(s(),B(`span`,{key:0,class:h(`tone-`+l(e).tone)},_(l(e).text),3)):L(``,!0)])]))),128))]))),128)),(s(!0),B(b,null,u(t.report?.unavailableHosts??[],e=>(s(),B(`p`,{key:e.hostId,class:`row-sub`},_(e.label)+`: `+_(e.error),1))),128)),x(`p`,mu,` Updated `+_(t.report?.fetchedAt?new Date(t.report.fetchedAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):`—`)+` · hosts cache usage for 5 min `,1)])):L(``,!0)])):L(``,!0)}}),gu=[`aria-label`],_u={class:`sheet-head task-head`},vu={class:`sheet-body task-body`},yu={class:`task-meta`},bu=[`value`,`disabled`],xu={class:`task-link`},Su=[`title`],Cu={class:`card-link-name`},wu={key:1,class:`subtle small`},Tu=[`value`,`disabled`],Eu=[`value`],Du=[`value`],Ou={class:`task-section`},ku={class:`task-actions`},Au=[`disabled`],ju=[`innerHTML`],Mu={class:`task-section`},Nu={key:0,class:`subtle`},Pu={key:0,class:`task-comments`},Fu={class:`task-comment-head`},Iu={class:`subtle small`},Lu=[`disabled`,`onClick`],Ru=[`innerHTML`],zu={class:`task-actions`},Bu=[`disabled`],Vu={class:`sheet-foot task-foot`},Hu={class:`subtle small`},Uu=[`disabled`],Wu=2e4,Gu=5e3,Ku=l({__name:`TaskDialog`,props:{card:{},columns:{},links:{},linkedName:{},busy:{type:Boolean}},emits:[`close`,`patch`,`comment`,`uncomment`,`remove`,`open`],setup(t,{emit:n}){let r=t,i=n,a=F(r.card.title);j(()=>r.card.title,e=>a.value=e);function o(){let e=a.value.trim();e?e!==r.card.title&&i(`patch`,{title:e}):a.value=r.card.title}let l=F(!1),d=F(r.card.description??``),p=F(null);j(()=>r.card.description,e=>{l.value||(d.value=e??``)});let m=S(()=>ci(r.card.description??``)),h=S(()=>l.value&&d.value!==(r.card.description??``));function y(){l.value=!0,w(()=>{M(p.value),p.value?.focus()})}function C(){h.value&&i(`patch`,{description:d.value}),l.value=!1}function T(){d.value=r.card.description??``,l.value=!1}let E=F(``),D=F(null);function O(){let e=E.value.trim();e&&!r.busy&&(i(`comment`,e),E.value=``,w(()=>M(D.value)))}function k(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())}function A(e){e.key===`Enter`&&(e.metaKey||e.ctrlKey)?(e.preventDefault(),C()):e.key===`Escape`&&(e.stopPropagation(),T())}function M(e){e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,Math.round(window.innerHeight*.5))+`px`)}let N=S(()=>(r.card.comments??[]).map(e=>({...e,html:ci(e.text),when:Rn(new Date(e.at))}))),P=S(()=>r.card.hostId&&r.card.agentId?`${r.card.hostId}:${r.card.agentId}`:``);function R(e){let[t,...n]=e.split(`:`);i(`patch`,{link:e?{hostId:t,agentId:n.join(`:`)}:null})}let z=S(()=>{let e=[];return r.card.createdAt&&e.push(`Created `+Rn(new Date(r.card.createdAt))),r.card.updatedAt&&e.push(`updated `+Rn(new Date(r.card.updatedAt))),e.join(` · `)});function ee(){o(),h.value&&C(),(!E.value.trim()||confirm(`Discard the comment you started?`))&&i(`close`)}function V(){confirm(`Delete “${r.card.title}”? Its description and comments are deleted too.`)&&i(`remove`)}function H(e){confirm(`Delete this comment?`)&&i(`uncomment`,e)}return(n,r)=>(s(),B(`div`,{class:`overlay`,onMousedown:v(ee,[`self`]),onKeydown:I(ee,[`esc`])},[x(`section`,{class:`sheet task-sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`Task: `+t.card.title},[x(`header`,_u,[f(x(`input`,{"onUpdate:modelValue":r[0]||=e=>a.value=e,class:`task-title`,"aria-label":`Title`,maxlength:`300`,onBlur:o,onKeydown:r[1]||=I(v(e=>e.target.blur(),[`prevent`]),[`enter`])},null,544),[[g,a.value]]),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:ee},[e(Y,{name:`close`,size:16})])]),x(`div`,vu,[x(`div`,yu,[x(`select`,{value:t.card.column,"aria-label":`Column`,disabled:t.busy,onChange:r[2]||=e=>i(`patch`,{column:e.target.value})},[(s(!0),B(b,null,u(t.columns,e=>(s(),B(`option`,{key:e},_(e),1))),128))],40,bu),x(`div`,xu,[P.value&&t.linkedName?(s(),B(`button`,{key:0,type:`button`,class:`link-btn`,title:`Open `+t.linkedName,onClick:r[3]||=e=>i(`open`)},[e(Y,{name:`chat`,size:13}),x(`span`,Cu,_(t.linkedName),1)],8,Su)):P.value?(s(),B(`span`,wu,`Conversation unavailable`)):L(``,!0),x(`select`,{class:`card-link-select`,"aria-label":`Link to conversation`,value:P.value,disabled:t.busy,onChange:r[4]||=e=>R(e.target.value)},[r[10]||=x(`option`,{value:``},`No conversation`,-1),P.value&&!t.links.some(e=>e.key===P.value)?(s(),B(`option`,{key:0,value:P.value},_(t.linkedName??`Unavailable conversation`),9,Eu)):L(``,!0),(s(!0),B(b,null,u(t.links,e=>(s(),B(`option`,{key:e.key,value:e.key},_(e.label),9,Du))),128))],40,Tu)])]),x(`section`,Ou,[r[12]||=x(`h3`,null,`Description`,-1),l.value?(s(),B(b,{key:0},[f(x(`textarea`,{ref_key:`descriptionInput`,ref:p,"onUpdate:modelValue":r[5]||=e=>d.value=e,class:`task-textarea`,"aria-label":`Description`,maxlength:Wu,placeholder:`Markdown: what this task is, notes, checklists…`,onInput:r[6]||=e=>M(e.target),onKeydown:A},null,544),[[g,d.value]]),x(`div`,ku,[r[11]||=x(`span`,{class:`subtle small`},`Markdown · ⌘/Ctrl+Enter to save`,-1),x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:T},`Cancel`),x(`button`,{type:`button`,class:`btn btn-primary`,disabled:t.busy,onClick:C},`Save`,8,Au)])],64)):t.card.description?(s(),B(`div`,{key:2,class:`prose task-description`,role:`button`,tabindex:`0`,title:`Click to edit`,onClick:r[7]||=e=>e.target.closest(`a`)||y(),onKeydown:I(y,[`enter`]),innerHTML:m.value},null,40,ju)):(s(),B(`button`,{key:1,type:`button`,class:`task-empty`,onClick:y},`Add a description…`))]),x(`section`,Mu,[x(`h3`,null,[r[13]||=c(`Comments `,-1),N.value.length?(s(),B(`span`,Nu,_(N.value.length),1)):L(``,!0)]),N.value.length?(s(),B(`ol`,Pu,[(s(!0),B(b,null,u(N.value,n=>(s(),B(`li`,{key:n.id,class:`task-comment`},[x(`div`,Fu,[x(`span`,Iu,_(n.when),1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Delete comment`,title:`Delete comment`,disabled:t.busy,onClick:e=>H(n.id)},[e(Y,{name:`trash`,size:13})],8,Lu)]),x(`div`,{class:`prose`,innerHTML:n.html},null,8,Ru)]))),128))])):L(``,!0),x(`form`,{class:`task-new-comment`,onSubmit:v(O,[`prevent`])},[f(x(`textarea`,{ref_key:`commentInput`,ref:D,"onUpdate:modelValue":r[8]||=e=>E.value=e,class:`task-textarea`,rows:`2`,"aria-label":`New comment`,maxlength:Gu,placeholder:`Write a comment… (Markdown, ⌘/Ctrl+Enter to post)`,onInput:r[9]||=e=>M(e.target),onKeydown:k},null,544),[[g,E.value]]),x(`div`,zu,[x(`button`,{class:`btn btn-primary`,disabled:t.busy||!E.value.trim()},`Comment`,8,Bu)])],32)])]),x(`footer`,Vu,[x(`span`,Hu,_(z.value),1),x(`button`,{type:`button`,class:`btn btn-ghost task-delete`,disabled:t.busy,onClick:V},[e(Y,{name:`trash`,size:14}),r[14]||=c(`Delete task`,-1)],8,Uu)])],8,gu)],32))}}),qu={class:`agent-controls`},Ju=[`title`],Yu={class:`chip-text`},Xu=[`disabled`,`value`],Zu=[`value`],Qu=[`value`],$u=[`title`],ed={class:`chip-text`},td=[`disabled`,`value`],nd=[`value`],rd=[`title`],id={class:`chip-text`},ad=[`disabled`,`value`],od={key:0,value:``,disabled:``},sd=[`value`,`title`],cd=[`aria-label`,`aria-pressed`,`title`,`disabled`,`onClick`],ld={key:0,class:`chip-text`},ud=[`title`],dd={key:1,class:`chip-text`},fd={class:`chip-key`},pd=[`aria-label`,`disabled`,`value`,`onChange`],md=[`value`],hd=[`title`,`aria-label`],gd={width:`18`,height:`18`,viewBox:`0 0 18 18`,"aria-hidden":`true`},_d=[`stroke-dasharray`],vd=3e5,yd=gn(l({__name:`AgentControls`,props:{agent:{},path:{},api:{type:Function},disabled:{type:Boolean}},emits:[`notice`],setup(t,{expose:n,emit:r}){let i=t,a=r,o=new Map,l=F(null),d=F({});async function f(e=!1){let t=i.agent.key,n=o.get(t);if(!e&&n&&Date.now()-n.at<vd)l.value=n.options;else try{let e=await i.api(i.path+`/config`);o.set(t,{at:Date.now(),options:e}),i.agent.key===t&&(l.value=e)}catch{i.agent.key===t&&(l.value=n?.options??null)}}j(()=>i.agent.key,()=>{l.value=o.get(i.agent.key)?.options??null,d.value={},f()},{immediate:!0});let m=S(()=>d.value.model??i.agent.model??null),g=S(()=>l.value?.models.find(e=>e.id===m.value)??null),v=S(()=>g.value?.label??(m.value?m.value.split(`/`).pop():`Model`));n({modelLabel:v});let y=S(()=>d.value.thinking??i.agent.thinking??g.value?.defaultThinkingId??null),C=S(()=>g.value?.thinking??[]),w=S(()=>C.value.find(e=>e.id===y.value)?.label??y.value??``),T=S(()=>d.value.mode??i.agent.modeId??null),E=S(()=>l.value?.modes??[]),D=S(()=>E.value.find(e=>e.id===T.value)?.label??`Mode`),O=S(()=>/full|bypass|danger|unrestricted/i.test(`${T.value} ${D.value}`)),k=e=>/^(plan|plan[-_ ]?mode)$/i.test(e.id)||/^plan(?: mode)?$/i.test(e.label),A=e=>/fast|speed/i.test(`${e.id} ${e.label}`),M=S(()=>(l.value?.features??[]).filter(e=>!k(e)).map(e=>{let t=d.value[`feature:`+e.id]??e.value;return e.type===`toggle`?{...e,value:t}:{...e,value:t,current:e.options.find(e=>e.id===t)?.label??``}}));j(()=>[i.agent.model,i.agent.thinking,i.agent.modeId],()=>{let e={...d.value};e.model===i.agent.model&&delete e.model,e.thinking===i.agent.thinking&&delete e.thinking,e.mode===i.agent.modeId&&delete e.mode,d.value=e});async function N(e,t,n){let r=d.value[e];d.value={...d.value,[e]:n};try{let n=(await i.api(i.path+`/config`,`POST`,t))?.notice;if(n?.message&&a(`notice`,n.message),e.startsWith(`feature:`)){o.delete(i.agent.key),await f(!0);let t={...d.value};delete t[e],d.value=t}}catch(t){if(d.value={...d.value,[e]:r},r===void 0){let t={...d.value};delete t[e],d.value=t}a(`notice`,t.message)}}let P=e=>e.target.value,I=S(()=>{let e=i.agent.contextUsed??0,t=i.agent.contextMax??0;if(!e||!t)return null;let n=Math.min(1,e/t),r=e=>e>=1e6?`${(e/1e6).toFixed(e%1e6?1:0)}M`:`${Math.round(e/1e3)}k`;return{ratio:n,percent:Math.round(n*100),title:`Context window: ${r(e)} of ${r(t)} tokens used`}}),R=2*Math.PI*7;return(n,r)=>(s(),B(`div`,qu,[x(`label`,{class:h([`chip`,{"is-disabled":t.disabled||!l.value?.models.length}]),title:t.agent.provider+` · Model: `+v.value},[e(ja,{provider:t.agent.provider},null,8,[`provider`]),x(`span`,Yu,_(v.value),1),e(Y,{name:`chevron`,size:11,class:`chip-caret`}),x(`select`,{"aria-label":`Model`,disabled:t.disabled||!l.value?.models.length,value:m.value??``,onChange:r[0]||=e=>N(`model`,{model:P(e)},P(e))},[m.value&&!g.value?(s(),B(`option`,{key:0,value:m.value},_(v.value),9,Zu)):L(``,!0),(s(!0),B(b,null,u(l.value?.models??[],e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,Qu))),128))],40,Xu)],10,Ju),C.value.length?(s(),B(`label`,{key:0,class:h([`chip`,{"is-disabled":t.disabled}]),title:`Thinking: `+w.value},[e(Y,{name:`brain`,size:18}),x(`span`,ed,_(w.value),1),e(Y,{name:`chevron`,size:11,class:`chip-caret`}),x(`select`,{"aria-label":`Thinking`,disabled:t.disabled,value:y.value??``,onChange:r[1]||=e=>N(`thinking`,{thinkingOptionId:P(e)},P(e))},[(s(!0),B(b,null,u(C.value,e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,nd))),128))],40,td)],10,$u)):L(``,!0),E.value.length?(s(),B(`label`,{key:1,class:h([`chip`,{"is-disabled":t.disabled}]),title:`Mode: `+D.value},[e(Y,{name:O.value?`shield-off`:`shield`,size:18},null,8,[`name`]),x(`span`,id,_(D.value),1),e(Y,{name:`chevron`,size:11,class:`chip-caret`}),x(`select`,{"aria-label":`Mode`,disabled:t.disabled,value:T.value??``,onChange:r[2]||=e=>N(`mode`,{modeId:P(e)},P(e))},[T.value?L(``,!0):(s(),B(`option`,od,`Mode`)),(s(!0),B(b,null,u(E.value,e=>(s(),B(`option`,{key:e.id,value:e.id,title:e.description},_(e.label),9,sd))),128))],40,ad)],10,rd)):L(``,!0),(s(!0),B(b,null,u(M.value,n=>(s(),B(b,{key:n.id},[n.type===`toggle`?(s(),B(`button`,{key:0,type:`button`,class:h([`chip chip-toggle`,{chosen:n.value,"chip-icon-only":A(n)}]),"aria-label":n.label,"aria-pressed":n.value,title:n.tooltip??n.label,disabled:t.disabled,onClick:e=>N(`feature:`+n.id,{feature:{id:n.id,value:!n.value}},!n.value)},[e(Y,{name:A(n)?`bolt`:`sliders`,size:18},null,8,[`name`]),A(n)?L(``,!0):(s(),B(`span`,ld,_(n.label),1))],10,cd)):(s(),B(`label`,{key:1,class:h([`chip`,{"is-disabled":t.disabled,"chip-icon-only":A(n),chosen:A(n)&&n.value===`fast`}]),title:[n.label,n.current,n.tooltip].filter(Boolean).join(` · `)},[A(n)?(s(),p(Y,{key:0,name:`bolt`,size:18})):L(``,!0),A(n)?L(``,!0):(s(),B(`span`,dd,[x(`span`,fd,_(n.label)+`:`,1),c(` `+_(n.current||`Default`),1)])),A(n)?L(``,!0):(s(),p(Y,{key:2,name:`chevron`,size:11,class:`chip-caret`})),x(`select`,{"aria-label":n.label,disabled:t.disabled,value:n.value??``,onChange:e=>N(`feature:`+n.id,{feature:{id:n.id,value:P(e)}},P(e))},[(s(!0),B(b,null,u(n.options,e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,md))),128))],40,pd)],10,ud))],64))),128)),I.value?(s(),B(`span`,{key:2,class:h([`context-gauge`,{"is-high":I.value.ratio>=.8}]),title:I.value.title,role:`img`,"aria-label":I.value.title},[(s(),B(`svg`,gd,[r[3]||=x(`circle`,{cx:`9`,cy:`9`,r:`7`,class:`context-track`},null,-1),x(`circle`,{cx:`9`,cy:`9`,r:`7`,class:`context-fill`,"stroke-dasharray":`${R*I.value.ratio} ${R}`,transform:`rotate(-90 9 9)`},null,8,_d)])),x(`span`,null,_(I.value.percent)+`%`,1)],10,hd)):L(``,!0)]))}}),[[`__scopeId`,`data-v-d1984eb2`]]),bd={class:`page`},xd={class:`page-head`},Sd=[`disabled`],Cd={class:`page-body`},wd={key:0,class:`setting-note is-error`},Td={class:`row-title`},Ed={key:0,class:`field-grid`},Dd={class:`field`},Od=[`disabled`,`title`],kd=[`value`],Ad={class:`field`},jd=[`disabled`],Md=[`value`],Nd={class:`field`},Pd=[`disabled`],Fd=[`value`],Id={class:`field`},Ld=[`disabled`],Rd=[`value`],zd={class:`field`},Bd={class:`field`},Vd={class:`field-grid`},Hd={class:`field`},Ud={key:0,class:`field`},Wd=[`value`],Gd={key:1,class:`field`},Kd={key:2,class:`field`},qd={class:`subtle small`},Jd={key:1,class:`check-row`},Yd={key:2,class:`check-row`},Xd={class:`form-actions`},Zd=[`disabled`],Qd={key:2,class:`timeline-empty`},$d={key:3,class:`schedules-empty`},ef={key:4,class:`card`},tf={class:`card-row`},nf={class:`grow`},rf={class:`row-title`},af={class:`row-sub`},of={class:`row-sub`},sf={key:1,class:`schedule-status`},cf={class:`schedule-actions`},lf=[`disabled`,`onClick`],uf=[`disabled`,`onClick`],df=[`disabled`,`onClick`],ff=[`disabled`,`onClick`],pf=[`aria-expanded`,`onClick`],mf=[`disabled`,`onClick`],hf={key:0,class:`schedule-runs`},gf={class:`schedule-prompt`},_f={key:0,class:`subtle small`},vf={class:`run-when`},yf={class:`run-text`},bf=[`onClick`],xf=gn(l({__name:`SchedulesPage`,props:{hosts:{},api:{type:Function}},emits:[`back`,`openAgent`],setup(n,{emit:r}){let i=n,a=r,o=F(null),l=F(``),d=F(null),p=e=>i.hosts.find(t=>t.id===e)?.label??`Unknown host`;async function y(){try{o.value=await i.api(`/schedules`),l.value=``}catch(e){l.value=e.message}}t(y);let C=S(()=>(o.value??[]).flatMap(e=>e.schedules.map(t=>({hostId:e.hostId,s:t})))),T=S(()=>(o.value??[]).filter(e=>e.error));async function E(e,t,n){if(n!==`delete`||confirm(`Delete the schedule “${t.name||t.prompt.slice(0,40)}”?`)){d.value=t.id;try{await i.api(`/hosts/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t.id)}${n===`delete`?``:`/`+n}`,n===`delete`?`DELETE`:`POST`),await y()}catch(e){l.value=e.message}finally{d.value=null}}}let D=F(null),O=F([]);async function k(e,t){if(D.value===t.id)return D.value=null;D.value=t.id,O.value=[];try{O.value=(await i.api(`/hosts/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t.id)}/logs`)).runs}catch(e){l.value=e.message}}let A=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function M(e){let[t,n,r,i,a]=e.trim().split(/\s+/),o=(e,t)=>`${e.padStart(2,`0`)}:${t.padStart(2,`0`)}`;if(/^\d+$/.test(t)&&/^\d+$/.test(n)&&r===`*`&&i===`*`){if(a===`*`)return`Every day at ${o(n,t)}`;if(a===`1-5`)return`Weekdays at ${o(n,t)}`;if(/^\d$/.test(a))return`Every ${A[Number(a)%7]} at ${o(n,t)}`}if(/^\d+$/.test(t)&&n===`*`&&r===`*`&&i===`*`&&a===`*`)return`Every hour at :${t.padStart(2,`0`)}`;let s=/^\*\/(\d+)$/.exec(t);return s&&n===`*`&&r===`*`&&i===`*`&&a===`*`?`Every ${s[1]} minutes`:e}let P=e=>e?Rn(new Date(e)):`—`,I=F(!1),R=F({hostId:``,cwd:``,provider:``,model:``,name:``,prompt:``,preset:`daily`,time:`09:00`,day:`1`,cron:`0 9 * * *`,archive:!0,runNow:!1}),ee=F(null),V=F(null),H=S(()=>i.hosts.filter(e=>e.state===`connected`));j(()=>R.value.hostId,async e=>{if(ee.value=V.value=null,e)try{let[t,n]=await Promise.all([i.api(`/hosts/${encodeURIComponent(e)}/providers`),i.api(`/hosts/${encodeURIComponent(e)}/projects`)]);ee.value=t,V.value=n,R.value.provider||=t.find(e=>e.status===`ready`)?.id??t[0]?.id??``,R.value.cwd||=n[0]?.rootPath??``}catch(e){l.value=e.message}});let te=S(()=>{let e=V.value??[],t=R.value.cwd;return t&&!e.some(e=>e.rootPath===t)?[{key:t,name:t.split(`/`).pop()||t,rootPath:t,kind:`directory`},...e]:e}),ne=S(()=>ee.value?.find(e=>e.id===R.value.provider)?.models??[]);j(ne,e=>{e.some(e=>e.id===R.value.model)||(R.value.model=e.find(e=>e.isDefault)?.id??e[0]?.id??``)});let U=S(()=>{let[e,t]=R.value.time.split(`:`).map(e=>String(Number(e)||0));return R.value.preset===`daily`?`${t} ${e} * * *`:R.value.preset===`weekdays`?`${t} ${e} * * 1-5`:R.value.preset===`weekly`?`${t} ${e} * * ${R.value.day}`:R.value.preset===`hourly`?`${t} * * * *`:R.value.cron.trim()}),W=F(null);function G(){W.value=null,I.value=!0,R.value.hostId||=H.value[0]?.id??``}function re(e){let[t,n,r,i,a]=e.trim().split(/\s+/),o=(e,t)=>`${e.padStart(2,`0`)}:${t.padStart(2,`0`)}`,s=/^\d+$/.test(t)&&r===`*`&&i===`*`;return s&&/^\d+$/.test(n)&&a===`*`?{preset:`daily`,time:o(n,t)}:s&&/^\d+$/.test(n)&&a===`1-5`?{preset:`weekdays`,time:o(n,t)}:s&&/^\d+$/.test(n)&&/^\d$/.test(a)?{preset:`weekly`,time:o(n,t),day:String(Number(a)%7)}:s&&n===`*`&&a===`*`?{preset:`hourly`,time:o(`0`,t)}:{preset:`cron`,cron:e}}function K(e,t){let n=t.target.config??{};W.value={hostId:e,id:t.id,newAgent:t.target.type===`new-agent`},I.value=!0,R.value={...R.value,hostId:e,cwd:n.cwd??``,provider:n.provider??``,model:n.model??``,name:t.name??``,prompt:t.prompt,cron:t.cadence.expression,archive:n.archiveOnFinish??!0,runNow:!1,...re(t.cadence.expression)},ie.value=t.cadence.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,D.value=null,w(()=>document.querySelector(`.schedule-form`)?.scrollIntoView({block:`nearest`}))}let ie=F(Intl.DateTimeFormat().resolvedOptions().timeZone);function ae(){I.value=!1,W.value=null,ie.value=Intl.DateTimeFormat().resolvedOptions().timeZone}async function oe(){if(!W.value)return q();let{hostId:e,id:t,newAgent:n}=W.value;d.value=`create`;try{await i.api(`/hosts/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t)}`,`PATCH`,{name:R.value.name||null,prompt:R.value.prompt,cron:U.value,timezone:ie.value,...n?{cwd:R.value.cwd,provider:R.value.provider,model:R.value.model||null,archiveOnFinish:R.value.archive}:{}}),ae(),await y()}catch(e){l.value=e.message}finally{d.value=null}}async function q(){d.value=`create`;try{await i.api(`/hosts/${encodeURIComponent(R.value.hostId)}/schedules`,`POST`,{name:R.value.name||void 0,prompt:R.value.prompt,cron:U.value,timezone:ie.value,cwd:R.value.cwd,provider:R.value.provider,...R.value.model?{model:R.value.model}:{},archiveOnFinish:R.value.archive,runOnCreate:R.value.runNow}),I.value=!1,R.value.prompt=R.value.name=``,await y()}catch(e){l.value=e.message}finally{d.value=null}}return(t,n)=>(s(),B(`section`,bd,[x(`header`,xd,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:n[0]||=e=>a(`back`)},[e(Y,{name:`back`,size:18})]),n[14]||=x(`div`,{class:`grow`},[x(`h1`,null,`Schedules`),x(`p`,{class:`subtle`},`Prompts that start an agent on a timetable, on each host.`)],-1),x(`button`,{class:`btn btn-primary`,disabled:!H.value.length,onClick:G},[e(Y,{name:`plus`,size:15}),n[13]||=c(`New schedule`,-1)],8,Sd)]),x(`div`,Cd,[l.value?(s(),B(`p`,wd,_(l.value),1)):L(``,!0),(s(!0),B(b,null,u(T.value,e=>(s(),B(`p`,{key:e.hostId,class:`setting-note`},_(p(e.hostId))+`: `+_(e.error),1))),128)),I.value?(s(),B(`form`,{key:1,class:`card form-card schedule-form`,onSubmit:v(oe,[`prevent`])},[x(`div`,Td,_(W.value?`Edit schedule`:`New schedule`),1),!W.value||W.value.newAgent?(s(),B(`div`,Ed,[x(`label`,Dd,[n[15]||=x(`span`,null,`Host`,-1),f(x(`select`,{"onUpdate:modelValue":n[1]||=e=>R.value.hostId=e,required:``,disabled:!!W.value,title:W.value?`A schedule stays on its host`:void 0},[(s(!0),B(b,null,u(H.value,e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,kd))),128))],8,Od),[[N,R.value.hostId]])]),x(`label`,Ad,[n[16]||=x(`span`,null,`Project`,-1),f(x(`select`,{"onUpdate:modelValue":n[2]||=e=>R.value.cwd=e,required:``,disabled:!V.value},[(s(!0),B(b,null,u(te.value,e=>(s(),B(`option`,{key:e.key,value:e.rootPath},_(e.name),9,Md))),128))],8,jd),[[N,R.value.cwd]])]),x(`label`,Nd,[n[17]||=x(`span`,null,`Agent`,-1),f(x(`select`,{"onUpdate:modelValue":n[3]||=e=>R.value.provider=e,required:``,disabled:!ee.value},[(s(!0),B(b,null,u(ee.value??[],e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,Fd))),128))],8,Pd),[[N,R.value.provider]])]),x(`label`,Id,[n[18]||=x(`span`,null,`Model`,-1),f(x(`select`,{"onUpdate:modelValue":n[4]||=e=>R.value.model=e,disabled:!ne.value.length},[(s(!0),B(b,null,u(ne.value,e=>(s(),B(`option`,{key:e.id,value:e.id},_(e.label),9,Rd))),128))],8,Ld),[[N,R.value.model]])])])):L(``,!0),x(`label`,zd,[n[19]||=x(`span`,null,`Name`,-1),f(x(`input`,{"onUpdate:modelValue":n[5]||=e=>R.value.name=e,placeholder:`Daily check-in`,maxlength:`120`},null,512),[[g,R.value.name]])]),x(`label`,Bd,[n[20]||=x(`span`,null,`Prompt`,-1),f(x(`textarea`,{"onUpdate:modelValue":n[6]||=e=>R.value.prompt=e,rows:`4`,required:``,placeholder:`What should the agent do each time?`},null,512),[[g,R.value.prompt]])]),x(`div`,Vd,[x(`label`,Hd,[n[22]||=x(`span`,null,`Repeat`,-1),f(x(`select`,{"onUpdate:modelValue":n[7]||=e=>R.value.preset=e},[...n[21]||=[z(`<option value="daily" data-v-1a9bb929>Every day</option><option value="weekdays" data-v-1a9bb929>Weekdays</option><option value="weekly" data-v-1a9bb929>Every week</option><option value="hourly" data-v-1a9bb929>Every hour</option><option value="cron" data-v-1a9bb929>Custom (cron)</option>`,5)]],512),[[N,R.value.preset]])]),R.value.preset===`weekly`?(s(),B(`label`,Ud,[n[23]||=x(`span`,null,`Day`,-1),f(x(`select`,{"onUpdate:modelValue":n[8]||=e=>R.value.day=e},[(s(),B(b,null,u(A,(e,t)=>x(`option`,{key:e,value:String(t)},_(e),9,Wd)),64))],512),[[N,R.value.day]])])):L(``,!0),R.value.preset===`cron`?(s(),B(`label`,Kd,[n[24]||=x(`span`,null,`Cron`,-1),f(x(`input`,{"onUpdate:modelValue":n[10]||=e=>R.value.cron=e,placeholder:`0 9 * * 1-5`,required:``},null,512),[[g,R.value.cron]])])):(s(),B(`label`,Gd,[x(`span`,null,_(R.value.preset===`hourly`?`Minute`:`Time`),1),f(x(`input`,{"onUpdate:modelValue":n[9]||=e=>R.value.time=e,type:`time`,required:``},null,512),[[g,R.value.time]])]))]),x(`p`,qd,_(M(U.value))+` · `+_(ie.value),1),!W.value||W.value.newAgent?(s(),B(`label`,Jd,[f(x(`input`,{"onUpdate:modelValue":n[11]||=e=>R.value.archive=e,type:`checkbox`},null,512),[[m,R.value.archive]]),n[25]||=c(` Archive the agent when the run finishes`,-1)])):L(``,!0),W.value?L(``,!0):(s(),B(`label`,Yd,[f(x(`input`,{"onUpdate:modelValue":n[12]||=e=>R.value.runNow=e,type:`checkbox`},null,512),[[m,R.value.runNow]]),n[26]||=c(` Run once now`,-1)])),x(`div`,Xd,[x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:ae},`Cancel`),x(`button`,{class:`btn btn-primary`,disabled:d.value===`create`||!R.value.prompt.trim()||(!W.value||W.value.newAgent)&&!R.value.cwd},_(W.value?`Save changes`:`Create schedule`),9,Zd)])],32)):L(``,!0),o.value?!C.value.length&&!I.value?(s(),B(`div`,$d,[e(Y,{name:`clock`,size:22}),n[28]||=x(`p`,null,`No schedules yet.`,-1)])):(s(),B(`div`,ef,[(s(!0),B(b,null,u(C.value,({hostId:t,s:n})=>(s(),B(`div`,{key:t+n.id,class:`schedule`},[x(`div`,tf,[x(`span`,{class:h([`setting-icon`,{paused:n.status!==`active`}])},[e(Y,{name:`clock`,size:16})],2),x(`div`,nf,[x(`div`,rf,_(n.name||n.target.config?.title||n.prompt.slice(0,60)),1),x(`div`,af,[c(_(M(n.cadence.expression))+` `,1),n.cadence.timezone?(s(),B(b,{key:0},[c(` · `+_(n.cadence.timezone),1)],64)):L(``,!0),c(` · `+_(p(t))+` `,1),n.target.config?.cwd?(s(),B(b,{key:1},[c(` · `+_(n.target.config.cwd.split(`/`).pop()),1)],64)):L(``,!0)]),x(`div`,of,[n.status===`active`?(s(),B(b,{key:0},[c(`Next `+_(P(n.nextRunAt)),1)],64)):(s(),B(`span`,sf,_(n.status),1)),c(` · Last `+_(P(n.lastRunAt)),1)])]),x(`div`,cf,[x(`button`,{class:`icon-btn`,title:`Run now`,"aria-label":`Run now`,disabled:d.value===n.id,onClick:e=>E(t,n,`run`)},[e(Y,{name:`play`,size:14})],8,lf),n.status===`active`?(s(),B(`button`,{key:0,class:`icon-btn`,title:`Pause`,"aria-label":`Pause`,disabled:d.value===n.id,onClick:e=>E(t,n,`pause`)},[e(Y,{name:`pause`,size:14})],8,uf)):(s(),B(`button`,{key:1,class:`icon-btn`,title:`Resume`,"aria-label":`Resume`,disabled:d.value===n.id,onClick:e=>E(t,n,`resume`)},[e(Y,{name:`refresh`,size:14})],8,df)),x(`button`,{class:`icon-btn`,title:`Edit`,"aria-label":`Edit schedule`,disabled:d.value===n.id,onClick:e=>K(t,n)},[e(Y,{name:`edit`,size:14})],8,ff),x(`button`,{class:`icon-btn`,title:`Run history`,"aria-label":`Run history`,"aria-expanded":D.value===n.id,onClick:e=>k(t,n)},[e(Y,{name:`list`,size:14})],8,pf),x(`button`,{class:`icon-btn`,title:`Delete`,"aria-label":`Delete schedule`,disabled:d.value===n.id,onClick:e=>E(t,n,`delete`)},[e(Y,{name:`trash`,size:14})],8,mf)])]),D.value===n.id?(s(),B(`div`,hf,[x(`p`,gf,_(n.prompt),1),O.value.length?L(``,!0):(s(),B(`p`,_f,`No runs yet.`)),(s(!0),B(b,null,u(O.value,e=>(s(),B(`div`,{key:e.id,class:h([`schedule-run`,`is-`+e.status])},[x(`span`,{class:h([`status-dot`,e.status===`failed`?`is-error`:e.status===`running`?`is-running`:`is-idle-ok`])},null,2),x(`span`,vf,_(P(e.startedAt)),1),x(`span`,yf,_(e.error||e.output||e.status),1),e.agentId?(s(),B(`button`,{key:0,class:`btn btn-ghost btn-sm`,onClick:n=>a(`openAgent`,`${t}:${e.agentId}`)},`Open`,8,bf)):L(``,!0)],2))),128))])):L(``,!0)]))),128))])):(s(),B(`div`,Qd,[...n[27]||=[x(`span`,{class:`spinner`},null,-1),c(`Loading schedules…`,-1)]]))])]))}}),[[`__scopeId`,`data-v-1a9bb929`]]),Sf=[`disabled`,`aria-label`,`title`,`onKeydown`],Cf={key:0,class:`spinner spinner-sm`},wf={class:`rec-time`},Tf=24e3,Ef=300,Df=gn(l({__name:`DictationButton`,props:{disabled:{type:Boolean}},emits:[`text`,`preview`,`notice`],setup(e,{expose:t,emit:r}){let i=r,a=F(`idle`),o=F(0),c=typeof window<`u`&&!!navigator.mediaDevices?.getUserMedia&&window.isSecureContext,l=null,u=null,d=null,f=null,m=[],g=0,y=0,S=!1,C=0,w,T,E=Tf,D=``;function O(e){let t=E/Tf,n=new Int16Array(Math.floor(e.length/t));for(let r=0;r<n.length;r++){let i=Math.max(-1,Math.min(1,e[Math.floor(r*t)]));n[r]=i<0?i*32768:i*32767}return n}function k(){d&&(d.onaudioprocess=null,d.disconnect()),d=null,u?.close().catch(()=>{}),u=null,l?.getTracks().forEach(e=>e.stop()),l=null}function A(){C++,k(),clearTimeout(T),w?.abort(),w=void 0,f&&(f.onopen=f.onmessage=f.onerror=f.onclose=null,f.close()),f=null,m=[],g=0,S=!1,a.value=`idle`,D=``,i(`preview`,``)}function j(e){let t=D.trim();A(),t&&i(`text`,t),i(`notice`,e+(t?` Recognized text was kept; the last phrase may be missing.`:``))}function M(){if(S&&f?.readyState===WebSocket.OPEN){if(f.bufferedAmount>Tf*2*10)j(`Voice upload cannot keep up with recording. Please try again.`);else{for(let e of m)f.send(e.buffer);m=[],g=0,a.value===`transcribing`&&f.send(JSON.stringify({type:`stop`}))}}}async function N(){if(a.value!==`idle`)return;if(!c){i(`notice`,`Voice input needs HTTPS (or localhost) and microphone access.`);return}a.value=`starting`;let e=++C;try{let t=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}});if(e!==C){t.getTracks().forEach(e=>e.stop());return}l=t;try{u=new AudioContext({sampleRate:Tf})}catch{u=new AudioContext}if(await u.resume(),e!==C)return;E=u.sampleRate;let n=u.createMediaStreamSource(l);d=u.createScriptProcessor(4096,1,1),y=0,m=[],g=0,d.onaudioprocess=t=>{if(e!==C||a.value!==`recording`)return;let n=O(t.inputBuffer.getChannelData(0)).subarray(0,Ef*Tf-y);m.push(n),g+=n.length,y+=n.length,g>Tf*12?j(`Voice connection is taking too long. Please try again.`):(M(),o.value=Math.floor(y/Tf),y>=Ef*Tf&&R())},n.connect(d),d.connect(u.destination),o.value=0,a.value=`recording`,T=setTimeout(()=>{e===C&&j(`Could not connect to the transcription service.`)},12e3),w=new AbortController;let r=await fetch(`/api/dictation/session`,{method:`POST`,headers:{"x-litepaseo":`1`},signal:w.signal}),s=await r.json();if(e!==C)return;if(!r.ok)throw Error(s.error??`Could not start voice input.`);let c=new URL(`/api/dictation/stream`,location.href);c.protocol=location.protocol===`https:`?`wss:`:`ws:`,c.searchParams.set(`ticket`,s.ticket),f=new WebSocket(c),f.onmessage=t=>{if(e===C)try{let n=JSON.parse(t.data);if(n.type===`ready`)S=!0,clearTimeout(T),a.value===`transcribing`&&P(e),M();else if(n.type===`partial`)D=String(n.text??``),i(`preview`,D);else if(n.type===`done`){let e=String(n.text??``).trim();A(),e?i(`text`,e):i(`notice`,`No speech recognized.`)}else if(n.type===`error`){let e=String(n.text??``).trim();A(),e&&i(`text`,e),i(`notice`,String(n.message??`Transcription failed.`)+(e?` Recognized text was kept; the last phrase may be missing.`:``))}}catch{j(`Invalid transcription response.`)}},f.onerror=()=>{e===C&&j(`Voice connection failed. Please try again.`)},f.onclose=()=>{e===C&&j(`Voice connection interrupted. Please try again.`)}}catch(t){if(e!==C)return;j(t.name===`NotAllowedError`?`Microphone access was denied.`:t.message)}}function P(e){clearTimeout(T),T=setTimeout(()=>{e===C&&j(`Timed out waiting for transcription.`)},125e3)}function R(){a.value===`recording`&&(k(),y<Tf/5?j(`Recording too short.`):(a.value=`transcribing`,S&&(P(C),M())))}function z(){f?.readyState===WebSocket.OPEN&&f.send(JSON.stringify({type:`cancel`})),A()}let ee=()=>a.value===`recording`?R():a.value===`idle`?void N():void 0,V=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;return t({cancel:z}),n(z),(t,n)=>(s(),B(b,null,[x(`button`,{type:`button`,class:h([`dictation`,`is-`+a.value]),disabled:e.disabled&&a.value===`idle`||a.value===`transcribing`||a.value===`starting`,"aria-label":a.value===`recording`?`Stop recording and transcribe`:a.value===`transcribing`?`Transcribing`:a.value===`starting`?`Starting voice input`:`Voice input`,title:a.value===`recording`?`Stop recording (Esc cancels)`:a.value===`transcribing`?`Finishing transcription…`:`Voice input`,onClick:ee,onKeydown:I(v(z,[`prevent`]),[`esc`])},[a.value===`transcribing`||a.value===`starting`?(s(),B(`span`,Cf)):a.value===`recording`?(s(),B(b,{key:1},[n[0]||=x(`span`,{class:`rec-dot`},null,-1),x(`span`,wf,_(V(o.value)),1)],64)):(s(),p(Y,{key:2,name:`mic`,size:17}))],42,Sf),a.value===`idle`?L(``,!0):(s(),B(`button`,{key:0,type:`button`,class:`dictation`,"aria-label":`Cancel voice input`,title:`Cancel voice input`,onClick:z},`×`))],64))}}),[[`__scopeId`,`data-v-9ec56bd9`]]),Of={key:0,class:`login`},kf={class:`brand brand-large`},Af={class:`field`},jf={class:`field`},Mf=[`disabled`],Nf={key:1,class:`form-error`},Pf={class:`sidebar`},Ff=[`aria-valuenow`],If=[`title`],Lf={class:`side-nav`,"aria-label":`Pages`},Rf={class:`hide-sm`},zf={class:`side-section`},Bf={class:`side-label`},Vf=[`title`,`aria-label`],Hf=[`aria-expanded`],Uf={key:1,class:`active-host-filter`,role:`group`,"aria-label":`Active host filter`},Wf=[`title`],Gf={key:2,class:`view-menu`},Kf={class:`segmented segmented-sm`,role:`radiogroup`,"aria-label":`Group sessions`},qf=[`aria-checked`],Jf=[`aria-checked`],Yf={key:0,class:`host-filter`,role:`radiogroup`,"aria-label":`Filter by host`},Xf=[`aria-checked`],Zf=[`title`],Qf=[`aria-checked`,`title`,`onClick`],$f=[`title`],ep={class:`side-foot`},tp=[`title`],np=[`title`,`aria-label`],rp={key:0,class:`foot-alert`,"aria-hidden":`true`},ip=[`title`,`aria-label`],ap={class:`main`},op={key:0,class:`toast update-toast`,role:`status`},sp={key:1,class:`toast`,role:`alert`},cp={key:4,class:`page`},lp={class:`page-head`},up={class:`page-body`},dp={class:`card`},fp={class:`grow`},pp={class:`row-title`},mp={class:`row-sub`},hp={key:0,role:`status`},gp={key:1,class:`row-sub`},_p={key:2,class:`row-sub`},vp={key:3,class:`row-sub`},yp=[`disabled`,`onClick`],bp=[`disabled`,`onClick`],xp={key:0,class:`card-row muted-text`},Sp={class:`field`},Cp={class:`field`},wp={class:`form-actions`},Tp=[`disabled`],Ep={key:6,class:`page`},Dp={class:`page-head`},Op={class:`subtle`},kp={class:`segmented head-toggle`,role:`radiogroup`,"aria-label":`Board`},Ap={class:`page-body wide`},jp=[`value`],Mp=[`disabled`],Np={class:`board`},Pp={class:`column-head`},Fp={class:`count`},Ip=[`aria-label`,`onClick`],Lp={class:`row-title`},Rp={key:0,class:`kanban-excerpt`},zp={key:0,class:`card-link`},Bp=[`title`,`onClick`],Vp={class:`card-link-name`},Hp={key:1,class:`subtle small`},Up=[`disabled`,`onClick`],Wp=[`disabled`,`onChange`],Gp=[`value`],Kp={class:`kanban-actions`},qp=[`value`,`onChange`],Jp=[`title`,`onClick`],Yp=[`onClick`],Xp=[`onClick`],Zp={key:0,class:`column-empty`},Qp={class:`chat`},$p={class:`chat-head`},em=[`title`],tm=[`title`],nm=[`title`],rm=[`title`],im=[`aria-label`,`title`],am={key:0,class:`agent-tabs`,"aria-label":`Tabs`},om=[`onClick`],sm={class:`agent-tab-name`},cm=[`title`,`onClick`,`onAuxclick`],lm={class:`agent-tab-name`},um=[`aria-label`,`onClick`],dm={class:`dock`},fm={class:`dock-inner`},pm={key:0,role:`status`},mm={key:1,role:`status`},hm={key:2,class:`composer-notice`,role:`status`},gm={key:3},_m={style:{"white-space":`pre-wrap`}},vm=[`onClick`],ym={key:4,class:`uncertain`},bm={class:`grow`},xm=[`disabled`],Sm={key:5,class:`send-queue`,role:`list`,"aria-label":`Queued messages`},Cm={class:`queue-body`},wm=[`disabled`,`onClick`],Tm=[`title`],Em={key:2,class:`queue-meta`},Dm={class:`queue-meta`},Om={key:3,class:`queue-meta queue-error`},km=[`disabled`,`onClick`],Am=[`disabled`,`onClick`],jm=[`disabled`,`onClick`],Mm=[`disabled`,`title`,`onClick`],Nm=[`disabled`,`onClick`],Pm=[`disabled`,`onClick`],Fm=[`placeholder`,`required`],Im={class:`composer-bar`},Lm=[`title`,`disabled`],Rm={class:`composer-actions`},zm=[`title`],Bm={key:0,value:`steer`},Vm=[`disabled`],Hm=[`disabled`],Um={key:0,class:`side-panel`,"aria-label":`Files`},Wm={class:`panel-tabs`},Gm={class:`panel-body`},Km={key:8,class:`empty`},qm={key:9,class:`empty`},Jm={class:`empty-mark`},Ym=280,Xm=900,Zm=420,Qm=220,$m=520,eh=300,th=l({__name:`App`,setup(t){let r=R(()=>mi(()=>import(`./HostSettings-BCsvyF_3.js`),__vite__mapDeps([5,1,2,6]))),i=R(()=>mi(()=>import(`./ChangesPanel-DdtJswMt.js`),__vite__mapDeps([7,1,2,8]))),a=R(()=>mi(()=>import(`./ConversationSearch-BXfGhrtx.js`),__vite__mapDeps([9,1,2,10]))),o=R(()=>mi(()=>import(`./FilesPanel-DyqtBDO_.js`),__vite__mapDeps([11,1,2,12]))),l=R(()=>mi(()=>import(`./FileViewer-C93qu9YH.js`),__vite__mapDeps([13,1,2,3,14]))),d=R(()=>mi(()=>import(`./TerminalPanel-wazWBZjN.js`),__vite__mapDeps([15,1,2,16]))),m=R(()=>mi(()=>import(`./SubagentsPanel-D1bEm5QC.js`),__vite__mapDeps([17,1,2,18]))),T=[`Todo`,`Doing`,`Done`],D=matchMedia(`(pointer: coarse)`).matches,k=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),M=F(!1),V=F(localStorage.getItem(`litepaseo-panel`)===`files`?`files`:null);j(V,e=>e?localStorage.setItem(`litepaseo-panel`,e):localStorage.removeItem(`litepaseo-panel`));let H=e=>V.value=V.value===e?null:e,te=O([]),U=F(null);function W(e){U.value=e,V.value=`subagents`}let G=y(new Map),re=S(()=>G.has(q.value)),K=S(()=>G.get(q.value)===!0);function ie(){G.set(q.value,!0),J.value=null,zn.matches&&(V.value=null)}function ae(){G.has(q.value)&&G.set(q.value,!1),J.value=null}let oe=y(new Map),q=S(()=>Ue.value??Z.value??``),se=S(()=>oe.get(q.value)?.paths??[]),J=S({get:()=>oe.get(q.value)?.active??null,set:e=>{let t=oe.get(q.value);t&&(t.active=e),e&&G.has(q.value)&&G.set(q.value,!1)}}),ce=0,le=S(()=>{let e=oe.get(q.value);return e?.jump&&e.jump.path===e.active?e.jump:void 0});function de(e,t){let n=q.value;if(!n)return;let r=oe.get(n)??{paths:[],active:null};r.paths.includes(e)||(r.paths=[...r.paths,e].slice(-12)),r.active=e,r.jump=t?.line?{path:e,line:t.line,end:t.end,seq:++ce}:void 0,G.has(n)&&G.set(n,!1),oe.set(n,r),zn.matches&&(V.value=null)}let fe=new Map,pe=(e,t)=>`${e}\n${t}`;function me(e,t){let n=e.indexOf(`
35
- `);oe.get(e.slice(0,n))?.paths.includes(e.slice(n+1))&&fe.set(e,t)}let he=F(null);function ge(e){he.value={owner:q.value,path:e,seq:++ce},V.value=`files`}function ve(e){e.kind===`reveal`?ge(e.path):de(e.path,e)}function ye(e){let t=oe.get(q.value);if(!t)return;fe.delete(pe(q.value,e));let n=t.paths.indexOf(e);t.paths=t.paths.filter(t=>t!==e),t.active===e&&(t.active=t.paths[Math.min(n,t.paths.length-1)]??null)}let be=e=>Math.round(Math.min(Xm,Math.max(Ym,e))),xe=F(be(Number(localStorage.getItem(`litepaseo-panel-width`))||Zm));function Ce(e){xe.value=be(e),localStorage.setItem(`litepaseo-panel-width`,String(xe.value))}function we(e){if(e.button!==0)return;let t=e.currentTarget,n=e.clientX,r=xe.value;t.setPointerCapture(e.pointerId),De.value=!0;let i=e=>xe.value=be(r-(e.clientX-n)),a=()=>{De.value=!1,Ce(xe.value),t.removeEventListener(`pointermove`,i),t.removeEventListener(`pointerup`,a),t.removeEventListener(`pointercancel`,a)};t.addEventListener(`pointermove`,i),t.addEventListener(`pointerup`,a),t.addEventListener(`pointercancel`,a)}let Te=e=>Math.round(Math.min($m,Math.max(Qm,e))),Ee=F(Te(Number(localStorage.getItem(`litepaseo-sidebar-width`))||eh)),De=F(!1);function Oe(e){Ee.value=Te(e),localStorage.setItem(`litepaseo-sidebar-width`,String(Ee.value))}function ke(e){if(e.button!==0)return;let t=e.currentTarget,n=e.clientX,r=Ee.value;t.setPointerCapture(e.pointerId),De.value=!0;let i=0,a=e=>{i&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>Ee.value=Te(r+e.clientX-n))},o=()=>{cancelAnimationFrame(i),De.value=!1,Oe(Ee.value),t.removeEventListener(`pointermove`,a),t.removeEventListener(`pointerup`,o),t.removeEventListener(`pointercancel`,o)};t.addEventListener(`pointermove`,a),t.addEventListener(`pointerup`,o),t.addEventListener(`pointercancel`,o)}function Ae(e,t){try{return JSON.parse(localStorage.getItem(e)??`null`)??t}catch{return t}}let je=F(``),Ne=S(()=>je.value||`LitePaseo`),Pe=F(``),Ie=F(``),Le=F(null),Re=F(!1),ze=F(``),X=F(!1),Be=O([]),Ve=new _e({collapsed:Ae(`litepaseo-collapsed-projects`,[]),persist:e=>localStorage.setItem(`litepaseo-collapsed-projects`,JSON.stringify(e)),compare:ue}),He=new _e({indexBy:e=>[e.workspaceId?`${e.hostId}:${e.workspaceId}`:null,e.parentAgentId?`parent:${e.hostId}:${e.parentAgentId}`:null]}),Ue=F(null),We=F(localStorage.getItem(`litepaseo-list-mode`)===`recent`?`recent`:`projects`),Ge=F(`closed`),Z=F(null),Ke=F(null),qe=F(null),Je=F(null),Ye=F(``),Xe=F(!1),Ze=F(``),Qe=F(``),$e=F(`steer`),et=F(`chat`),tt=F(``),nt=F(``),rt=F({revision:0,cards:[]}),it=new pn(()=>localStorage),at=new is,ot=F([]),st=new Map,ct=F(null),lt=F(``),ut=0;async function dt(){let e=Q.value,t=++ut;if(!e||!Re.value)ot.value=[];else try{let n=await $(An(e)+`/queue`);t===ut&&Q.value?.key===e.key&&(ot.value=Array.isArray(n)?n:[])}catch{}}j(Z,()=>{ot.value=[],dt()});let ft=F({}),pt=null;j(Re,e=>{pt?.close(),ft.value={},e&&(pt=bn({url:()=>`/api/queue/stream`,onMessage:e=>{ft.value=e}}))}),n(()=>pt?.close());let mt=null;j([Z,Re],()=>{mt?.close(),mt=null,ut++,ot.value=[];let e=Q.value;e&&Re.value&&(mt=bn({url:()=>`/api`+An(e)+`/queue/stream`,onMessage:t=>{Re.value&&Q.value?.key===e.key&&Array.isArray(t)&&(ut++,ot.value=t)}}))}),n(()=>mt?.close());async function ht(e,t){let n=Q.value;n&&await kn(async()=>{await $(An(n)+`/queue/`+e.id+`/control`,`POST`,{action:t}),await dt()})}async function gt(e,t){let n=Ke.value;!n||n.epoch()!==t?ze.value=`Conversation changed. Search again.`:(ae(),zn.matches&&(V.value=null),await n.jumpToPrompt(e,!0))}j(()=>Q.value?.key??null,()=>{te.value=[],U.value=null,V.value===`subagents`&&(V.value=null)});let _t=F(null),vt=F(null),yt=S(()=>{let e=vt.value?.modelLabel;return e&&e!==`Model`?e:``}),bt=S(()=>Z.value?at.get(Z.value):[]),xt=F(!1),St=F(``),Ct=F(null);j(St,()=>{let e=Ct.value;e&&(e.scrollTop=e.scrollHeight)},{flush:`post`});async function wt(){try{xt.value=!!(await $(`/dictation`)).configured}catch{}}let Tt=F(``),Et;function Dt(e){Tt.value=e,clearTimeout(Et),Et=setTimeout(()=>Tt.value=``,8e3)}function Ot(e){let t=Je.value,n=Pt.value,r=t&&document.activeElement===t?t.selectionStart:n.length,i=t&&document.activeElement===t?t.selectionEnd:n.length,a=n.slice(0,r),o=n.slice(i),s=a&&!/\s$/.test(a)?` `:``;Pt.value=a+s+e+o,w(()=>{if(!t)return;t.focus();let n=(a+s+e).length;t.setSelectionRange(n,n),Nr()})}let kt=S(()=>!!Pt.value.trim()||bt.value.length>0),At=F(!1);function jt(e){e.currentTarget.contains(e.relatedTarget)||(At.value=!1)}let Mt=S(()=>bt.value.every(e=>!!e.id&&!e.uploading&&!e.error));function Nt(e){let t=e.clipboardData;if(!t)return;let n=Array.from(t.files);n.length||(n=Array.from(t.items).filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(e=>!!e)),n.length&&(e.preventDefault(),_t.value?.addFiles(n))}let Pt=S({get:()=>Z.value?it.state(Z.value).text:``,set:e=>{Z.value&&it.setText(Z.value,e)}}),Ft=S(()=>Z.value?it.unresolved(Z.value)[0]??null:null),It=S(()=>Z.value?it.saved(Z.value).filter(e=>e.text!==Pt.value):[]),Lt=F(!1),Rt=F(``);async function zt(){let e=Q.value;if(!e||X.value||Lt.value||document.hidden)return;let t=it.unresolved(e.key);if(!t.length)return;let n=it.generation;Lt.value=!0;try{let r=await $(An(e)+`/messages/status`,`POST`,{messageIds:t.slice(0,20).map(e=>e.messageId)});if(n!==it.generation)return;for(let n of r.confirmed??[]){let r=t.find(e=>e.messageId===n);r&&(at.consume(e.key,r.attachmentIds??[]),it.confirm(e.key,n))}Q.value?.key===e.key&&(Rt.value=r.confirmed?.length?`Delivery confirmed from conversation history.`:`Not confirmed yet. No message has been resent.`)}catch{Q.value?.key===e.key&&(Rt.value=`Unable to check delivery. Your message remains saved.`)}finally{Lt.value=!1}}let Bt=setInterval(()=>void zt(),15e3);j([Z,X],()=>{Rt.value=``,zt()});function Vt(){Z.value&&Ft.value&&it.resolve(Z.value,Ft.value.messageId)}function Ht(e){e.storageArea===localStorage&&(e.key===`litepaseo-composer-signout`?it.clear():it.onStorage(e.key,e.newValue))}window.addEventListener(`storage`,Ht);let Ut=S(()=>new Map(Be.value.map(e=>[e.id,e.label]))),Wt=S(()=>new Map(Be.value.map(e=>[e.id,e.state]))),Gt=F(null),Kt=S(()=>Be.value.filter(e=>e.state===`connected`).length),Q=S(()=>(He.version.value,He.get(Z.value)??null)),qt=S(()=>(Ve.version.value,Ve.get(Ue.value)??null)),Jt=S(()=>{He.version.value;let e=Q.value;return e?He.indexed(`parent:${e.hostId}:${e.id}`,50):[]}),Yt=S(()=>{He.version.value;let e=Q.value;return e?.parentAgentId?He.get(`${e.hostId}:${e.parentAgentId}`)??null:null}),Xt=S(()=>{let e=Jt.value,t=te.value,n=e.length+t.length;if(!n)return null;let r=e.filter(e=>e.attention).length,i=e.filter(e=>e.state===`running`&&!e.attention).length+t.filter(e=>e.status===`running`).length,a=e.filter(e=>e.state===`failed`).length+t.filter(e=>e.status===`failed`).length;return{total:n,label:r?`${r} need${r===1?`s`:``} input`:i?`${i} working`:a?`${a} failed`:`${n} subagent${n===1?``:`s`}`,tone:r?`attention`:i?`running`:a?`error`:`idle`}}),Zt=S(()=>(He.version.value,He.indexed(Ue.value,12))),Qt=S(()=>(Ve.version.value,Ve.total)),$t=S(()=>(Ve.version.value,Ve.size)),en=S(()=>(Ve.version.value,Ve.projectCount)),tn=(e,t)=>`${e} ${t}${e===1?``:`s`}`,nn=S(()=>`${tn($t.value,`workspace`)} in ${tn(en.value,`project`)}`);j(We,e=>localStorage.setItem(`litepaseo-list-mode`,e));let rn=F(localStorage.getItem(`litepaseo-host-filter`));j(rn,e=>{Ve.setHost(e),He.setHost(e),e?localStorage.setItem(`litepaseo-host-filter`,e):localStorage.removeItem(`litepaseo-host-filter`)},{immediate:!0}),j(Be,e=>{rn.value&&e.length&&!e.some(e=>e.id===rn.value)&&(rn.value=null)});let an=S(()=>(Ve.version.value,new Map(Be.value.map(e=>[e.id,Ve.hostSize(e.id)])))),on=S(()=>qt.value?.directory||Q.value?.cwd||``),sn=F(null);j([sn,Q,Ue],([e,t,n])=>{!e||t?.key!==e.session||t.workspaceId&&!n||(sn.value=null,ve(e))});let cn=S(()=>{let e=Q.value?.cwd??``;return e.replace(/\/+$/,``).split(`/`).pop()||e}),un=S(()=>Q.value?.status===`running`),dn=S(()=>Q.value?.deliveryModes??[`queue`,`interrupt`]),fn=S(()=>dn.value.includes($e.value)?$e.value:`queue`);j([()=>Q.value?.key,()=>dn.value.includes(`steer`)],([,e])=>{$e.value=e?`steer`:`queue`},{immediate:!0});let mn=S(()=>Ge.value===`live`&&Wt.value.get(Q.value?.hostId??``)===`connected`&&Q.value?.turnActive===!1),hn=F(!1);async function gn(e,t,n){let r=Q.value;if(r&&!hn.value){hn.value=!0,ze.value=``;try{await $(An(r)+`/rewind`,`POST`,{messageId:e,mode:n},12e4),n!==`files`&&Z.value===r.key&&!Pt.value.trim()&&(Pt.value=t,w(Nr)),Z.value===r.key&&Dt(n===`files`?`Files rewound.`:n===`both`?`Conversation and files rewound.`:`Conversation rewound.`)}catch(e){ze.value=String(e.message)}finally{hn.value=!1}}}let vn=O({base:``,cwd:``}),yn=S(()=>{let e=Be.value.find(e=>e.id===Q.value?.hostId);return e?!!e.local:void 0});j([Q,on,yn],([e,t,n])=>{let r=e?`/api`+An(e):``,i=e?.rewind??[],a=vn.value;(r!==a.base||(e?.cwd??``)!==a.cwd||t!==a.workspace||n!==a.localHost||i.join()!==(a.rewindModes??[]).join())&&(vn.value={base:r,cwd:e?.cwd??``,session:e?.key,workspace:t,localHost:n,rewindModes:i,rewinding:hn,rewind:(e,t,n)=>void gn(e,t,n),subagents:te,openSubagent:W})},{immediate:!0}),ee(xn,vn);let Sn=F(null);function Cn(e){let t=e.target;if(t instanceof HTMLImageElement&&t.closest(`.prose, .user-images`)){e.preventDefault(),Sn.value=t.currentSrc||t.src;return}let n=t?.closest?.(`.prose a`),r=pr(n?.getAttribute(`href`));if(r){if(r.kind===`copy`){e.preventDefault();let t=()=>Dt(`Can't open this here. Path: ${r.path}`);navigator.clipboard?navigator.clipboard.writeText(r.path).then(()=>Dt(`Copied path: ${r.path}`),t):t()}else e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),r.session!==Z.value&&Ln(r.session),ve(r))}}let wn=S(()=>{let e=new Map(T.map(e=>[e,[]]));for(let t of rt.value.cards)e.get(t.column)?.push(t);return e}),Tn=S(()=>Ge.value===`live`?`Live`:Ge.value===`paused`?`Paused`:`Reconnecting`),En=null,Dn=null,On;async function $(e,t=`GET`,n,r=2e4){let i=await fetch(`/api`+e,{method:t,headers:{"Content-Type":`application/json`,"x-litepaseo":`1`},body:n===void 0?void 0:JSON.stringify(n),signal:AbortSignal.timeout(r)}),a=await i.json().catch(()=>({}));if(i.status===401&&Re.value&&e!==`/login`&&jn(`ended`),!i.ok)throw Object.assign(Error((a.error??`Request failed`)+(a.requestId?` (reference ${a.requestId})`:``)),{status:i.status,delivery:a.delivery,code:a.code,scope:a.scope});return a}async function kn(e){X.value=!0,ze.value=``;try{await e()}catch(e){ze.value=String(e.message)}finally{X.value=!1}}function An(e){return`/hosts/${encodeURIComponent(e.hostId)}/agents/${encodeURIComponent(e.id)}`}function jn(e){if(Re.value=!1,e===`user`){it.clear(),ot.value=[],ut++,at.clear();try{localStorage.setItem(`litepaseo-composer-signout`,crypto.randomUUID())}catch{}}else at.forgetRemote(`Sign in again, then retry the upload.`);En?.close(),Dn?.close(),En=Dn=null,Pe.value=Ie.value=``,Mn(),ze.value=e===`ended`?`Your session ended. Sign in again; your drafts are kept.`:``}async function Mn(){try{Le.value=await $(`/auth`),je.value=Le.value?.instanceName??``}catch{Le.value={authenticated:!1,totp:!1};return}Le.value.authenticated&&await Pn()}async function Nn(){await kn(async()=>{await $(`/login`,`POST`,{token:Pe.value.trim(),...Le.value?.totp?{code:Ie.value.trim()}:{}}),Pe.value=Ie.value=``,await Pn()})}async function Pn(){Re.value=!0,ze.value=``,rt.value=await $(`/board`),In(),Zs(),vi(),Ar(),wt(),clearInterval(kr),kr=setInterval(()=>void Ar(),3e5);let e=new URLSearchParams(location.search).get(`session`);if(e){let t=pr(`/`+location.search);history.replaceState(history.state,``,`/`),sn.value=t&&t.kind!==`copy`?t:null,Ln(e)}}function Fn(){Ie.value=Ie.value.replace(/\D/g,``).slice(0,6)}navigator.serviceWorker?.addEventListener(`message`,e=>{e.data?.type===`open-session`&&Re.value&&Ln(String(e.data.key))});function In(){En?.close(),En=bn({url:()=>`/api/stream?generation=${encodeURIComponent(He.generation)}&since=${He.seq}&wgeneration=${encodeURIComponent(Ve.generation)}&wsince=${Ve.seq}`,onState:e=>{Ge.value=e,e===`unauthorized`&&jn(`ended`)},onMessage:e=>{let t=e;t.type===`project-pins`?lr(t.pins):t.type===`hosts`?(Be.value=t.hosts,t.instanceName!==void 0&&(je.value=t.instanceName),t.version&&(jr.value=t.version)):t.type===`workspaces-snapshot`?Ve.applyCollection({type:`snapshot`,generation:t.generation,seq:t.seq,items:t.workspaces}):t.type===`workspaces-changes`?Ve.applyCollection({type:`changes`,generation:t.generation,seq:t.seq,changes:t.changes}):He.apply(t)}})}j(Ye,e=>{clearTimeout(On),On=setTimeout(()=>{let t=e.trim().toLowerCase();if(!t){Ve.setFilter(null),He.setFilter(null);return}let n=Ut.value;Ve.setFilter(e=>`${e.name}\n${e.project}\n${e.branch??``}\n${e.directory}\n${n.get(e.hostId)??``}`.toLowerCase().includes(t)),He.setFilter(e=>`${e.title??``}\n${e.project}\n${e.cwd}\n${n.get(e.hostId)??``}\n${e.provider}`.toLowerCase().includes(t))},120)});function Ln(e){et.value=`chat`,Z.value=e;let t=He.get(e);Ue.value=t?.workspaceId?`${t.hostId}:${t.workspaceId}`:null,Vn()}function Rn(e){et.value=`chat`,Ue.value=e,Z.value=He.indexed(e,1)[0]?.key??null,Vn()}j(Q,e=>{e?.workspaceId&&!Ue.value&&(Ue.value=`${e.hostId}:${e.workspaceId}`)}),j(Zt,e=>{Ue.value&&e.length&&!e.some(e=>e.key===Z.value)&&(Z.value=e[0].key)});let zn=matchMedia(`(max-width: 760px)`),Bn=zn.matches?3:5;function Vn(){!Xe.value&&zn.matches&&history.pushState({litepaseoDetail:!0},``),Xe.value=!0}function Hn(){history.state?.litepaseoDetail?history.back():Xe.value=!1}function Un(){Xe.value&&!history.state?.litepaseoDetail&&(Xe.value=!1)}window.addEventListener(`popstate`,Un);let Wn=F(null);function Gn(e){let t=e.target,n=!!t&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName));e.key===`Escape`&&Sn.value?Sn.value=null:e.key===`k`&&(e.metaKey||e.ctrlKey)||e.key===`/`&&!n?(e.preventDefault(),Xe.value&&zn.matches&&Hn(),Wn.value?.focus(),Wn.value?.select()):e.key===`n`&&!n&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&Re.value&&!Kn.value?(e.preventDefault(),qn()):e.key===`Escape`&&t===Wn.value&&Ye.value&&(Ye.value=``)}window.addEventListener(`keydown`,Gn);let Kn=F(null);function qn(e){let t=e?e.items.at(0):Ve.range(0,1)[0];Kn.value={hostId:rn.value??t?.hostId??Q.value?.hostId??null,cwd:t?.rootPath??null,project:t?{key:t.projectKey,name:t.project}:null}}function Jn(e){Kn.value=null,Ye.value&&=``,Ln(e)}let Yn=S(()=>(!!Z.value||!!Ue.value)&&!Q.value),Xn=O(null),Zn=O(null);function Qn(e){return`/hosts/${encodeURIComponent(e.hostId)}/workspaces/${encodeURIComponent(e.id)}`}function $n(e,t,n){Xn.value={thread:e,x:t,y:n}}function er(e){let t=qt.value;if(!t)return;let n=e.currentTarget.getBoundingClientRect();$n(t,n.right-200,n.bottom+6)}async function tr(e){let t=Zn.value;t&&await kn(async()=>{await $(Qn(t)+`/title`,`POST`,{title:e}),Zn.value=null})}async function nr(e,t){await kn(async()=>void await $(Qn(e)+`/pin`,`POST`,{pinned:t}))}async function rr(e){await kn(async()=>{await $(Qn(e)+`/unread`,`POST`,{}),Ue.value===e.key&&(Ue.value=Z.value=null,Hn())})}async function ir(e){await kn(async()=>void await $(Qn(e)+`/read`,`POST`,{}))}async function ar(e){confirm(`Archive “${e.name}”? It leaves the sidebar; the host keeps its history.`)&&await kn(async()=>{await $(Qn(e)+`/archive`,`POST`,{}),Ue.value===e.key&&(Ue.value=Z.value=null)})}let or=F({});function sr(e){return e.projectIds.some(t=>!!or.value[JSON.stringify([e.hostId,t])])}let cr=0;function lr(e){cr++,or.value=e,Ve.setProjectPins(e)}async function ur(e){let t=!sr(e),n=cr;await kn(async()=>{let r=await $(`/project-pins`,`POST`,{hostId:e.hostId,projectIds:e.projectIds,pinned:t});n===cr&&lr(r)})}let dr=O(null),fr=O(null),mr=S(()=>{Ve.version.value;let e=fr.value;if(!e)return null;let t=e.threadKeys.map(e=>Ve.get(e)).find(Boolean);return{projectId:t?.projectId??e.projectIds[0]??``,name:t?.project??e.name,customName:t?.projectCustomName??null,iconRevision:t?.projectIconRevision??null}});function hr(e,t,n){let r=e.items.range(0,e.items.size),i=r[0];i&&(dr.value={project:{name:e.name,hostId:i.hostId,rootPath:i.rootPath,projectIds:[...new Set(r.map(e=>e.projectId).filter(Boolean))],threadKeys:r.map(e=>e.key)},x:t,y:n})}async function gr(e){let t=Ut.value.get(e.hostId)??`its host`,n=e.threadKeys.length;confirm(`Remove “${e.name}” from ${t}? Its ${n===1?`thread is`:`${n} threads are`} archived and the project leaves the sidebar. Files on disk are not touched; the host keeps the history.`)&&await kn(async()=>{if(!e.projectIds.length)throw Error(`This host did not report a project id; update Paseo on it.`);for(let t of e.projectIds)await $(`/hosts/${encodeURIComponent(e.hostId)}/projects/${encodeURIComponent(t)}`,`DELETE`,void 0,6e4);Ue.value&&e.threadKeys.includes(Ue.value)&&(Ue.value=Z.value=null)})}let _r=``;j(()=>qt.value?.unread&&Z.value&&qe.value===Z.value?qt.value:null,e=>{if(!e||document.hidden)return;let t=`${e.key}@${e.activityAt}`;_r!==t&&(_r=t,$(Qn(e)+`/read`,`POST`,{}).catch(()=>_r=``))});let vr=F(localStorage.getItem(`litepaseo-board-mode`)===`plan`?`plan`:`agents`);j(vr,e=>localStorage.setItem(`litepaseo-board-mode`,e));async function yr(e){await kn(async()=>void await $(An(e)+`/stop`,`POST`))}async function br(e){await kn(async()=>void await $(An(e)+`/read`,`POST`,{}))}async function xr(e){confirm(`Archive “${e.title||`this session`}”? It leaves the board and sidebar; the host keeps its history.`)&&await kn(async()=>void await $(An(e)+`/archive`,`POST`,{}))}let Sr=``;j(()=>Q.value&&Q.value.unread&&qe.value===Q.value.key?Q.value:null,e=>{if(!e||document.hidden)return;let t=`${e.key}@${e.activityAt}`;Sr!==t&&(Sr=t,$(An(e)+`/read`,`POST`,{}).catch(()=>Sr=``))});let Cr=y(new Map);function wr(e,t,n){let r=Cr.get(e);(!r||t>=r.seqStart)&&Cr.set(e,{seqStart:t,text:n})}ee(Hr,{predict:e=>{let t=Q.value;return t?$(An(t)+`/suggestion`,`POST`,{token:e},65e3):Promise.resolve({status:`expired`,text:``})},use:e=>{Pt.value=e,w(()=>{Nr(),Je.value?.focus()})},send:e=>void Lr(e),offer:(e,t)=>{Q.value&&wr(Q.value.key,e,t)}});let Tr=S(()=>{let e=Q.value&&Cr.get(Q.value.key);return e&&!Pt.value?e.text:``}),Er=S(()=>Tr.value&&!D?Tr.value:un.value?fn.value===`queue`?`Queue a message for when this turn ends`:fn.value===`steer`?`Guide the current turn with a new instruction`:`Interrupt and send a new message`:`Message this agent…`),Dr=O(null),Or=F(!1),kr;async function Ar(e=!1){if(Re.value&&!document.hidden){Or.value=!0;try{Dr.value=await $(`/usage`+(e?`?refresh=1`:``))}catch{}finally{Or.value=!1}}}let jr=F(``),Mr=()=>location.reload();function Nr(){let e=Je.value;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,Math.round(window.innerHeight*.4))+`px`)}function Pr(e){e.key===`Tab`&&!e.shiftKey&&Tr.value?(e.preventDefault(),Pt.value=Tr.value,w(Nr)):e.key!==`Enter`||e.isComposing||(!D&&!e.shiftKey||e.metaKey||e.ctrlKey)&&(e.preventDefault(),Fr())}async function Fr(){await Lr(Pt.value,!0)}function Ir(e){return e.turnActive===!1||e.turnActive===void 0&&e.status!==`running`&&e.status!==`initializing`}async function Lr(e,t=!1){let n=Q.value;if(!n||!e.trim()&&(!t||!bt.value.length)||Ft.value||X.value||t&&!Mt.value)return;if(fn.value===`queue`&&(!Ir(n)||ot.value.length>0)){let r=t?[...bt.value]:[];await kn(async()=>{let i=r.map(e=>e.id),a=JSON.stringify([n.key,e,i]),o=st.get(a)??crypto.randomUUID();st.set(a,o);try{await $(An(n)+`/queue`,`POST`,{id:o,text:e,attachmentIds:i})}catch(e){throw await dt(),e}st.delete(a);for(let e of r)at.remove(n.key,e,!0);t&&it.state(n.key).text===e&&it.setText(n.key,``),Cr.delete(n.key),await dt(),w(Nr)});return}let r=t?[...bt.value]:[];t&&it.setText(n.key,``),await Rr(n,e,r,Ir(n)||fn.value===`queue`?`send`:fn.value,{restore:t})}async function Rr(e,t,n,r,{restore:i}){let a=it.state(e.key),o=it.generation,s={text:t,messageId:crypto.randomUUID(),attachmentIds:n.map(e=>e.id),attachmentNames:n.map(e=>e.file.name)};it.begin(e.key,s);let c=!1;return await kn(async()=>{try{if(await $(An(e)+`/messages`,`POST`,{...s,behavior:r}),c=!0,o!==it.generation)return;it.resolve(e.key,s.messageId);for(let t of n)at.remove(e.key,t,!0);Cr.delete(e.key),w(Nr),Z.value===e.key&&Ke.value?.showLatest()}catch(t){if(o!==it.generation)return;if(t.delivery===`not-sent`&&(it.resolve(e.key,s.messageId),t.status!==409))for(let e of n)e.error=`Not sent. Retry the upload or remove this attachment.`;throw i&&!a.text&&it.restoreFailed(e.key,s),t}}),c}async function zr(e){let t=Q.value;t&&await kn(async()=>{await $(An(t)+`/queue/`+e.id,`DELETE`),await dt()})}async function Br(e){let t=Q.value;if(!t)return;let n=lt.value;await kn(async()=>{await $(An(t)+`/queue/`+e.id,`PATCH`,{text:n}),ct.value=null,await dt()})}async function Ur(e){let t=Q.value;!t||X.value||Ft.value||await kn(async()=>{await $(An(t)+`/queue/`+e.id+`/send`,`POST`),await dt()})}async function Wr(){let e=Q.value;e&&await kn(async()=>void await $(An(e)+`/stop`,`POST`))}async function Gr(e,t){let n=Q.value;n&&await kn(async()=>{await $(An(n)+`/permissions/`+encodeURIComponent(e.id),`POST`,t)})}async function Kr(){await kn(async()=>{await $(`/hosts`,`POST`,{label:Ze.value,connection:Qe.value}),Ze.value=``,Qe.value=``})}async function qr(e){confirm(`Disconnect and remove ${e.label}? Its agents keep running on the host.`)&&await kn(async()=>void await $(`/hosts/`+e.id,`DELETE`))}async function Jr(e){try{rt.value=await $(`/board`,`PUT`,{revision:rt.value.revision,cards:e})}catch(e){throw rt.value=await $(`/board`),e}}function Yr(e){let t=He.get(e);return t?{hostId:t.hostId,agentId:t.id}:{hostId:null,agentId:null}}async function Xr(){await kn(async()=>{tt.value.trim()&&(await Jr([...rt.value.cards,{id:crypto.randomUUID(),title:tt.value.trim(),column:`Todo`,...Yr(nt.value),createdAt:Date.now()}]),tt.value=``,nt.value=``)})}async function Zr(e,t){await kn(async()=>{rt.value=await $(`/board/cards/${encodeURIComponent(e.id)}`,`PATCH`,t)})}async function Qr(e,t){let n=Yr(t);await Zr(e,{link:n.hostId&&n.agentId?{hostId:n.hostId,agentId:n.agentId}:null})}async function $r(e,t){await kn(async()=>{rt.value=await $(`/board/cards/${encodeURIComponent(e.id)}/comments`,`POST`,{text:t})})}async function ei(e,t){await kn(async()=>{rt.value=await $(`/board/cards/${encodeURIComponent(e.id)}/comments/${encodeURIComponent(t)}`,`DELETE`)})}function ti(e){if(!e.description&&!e.comments?.length)return void ni(e);confirm(`Delete “${e.title}”? Its description and comments are deleted too.`)&&ni(e)}async function ni(e){await kn(()=>Jr(rt.value.cards.filter(t=>t.id!==e.id))),ri.value===e.id&&(ri.value=null)}let ri=F(null),ii=S(()=>rt.value.cards.find(e=>e.id===ri.value)??null);function ai(e){return(e.description??``).replace(/```[\s\S]*?```/g,` `).replace(/[#>*_`~\[\]()|-]+/g,` `).replace(/\s+/g,` `).trim().slice(0,160)}let oi=S(()=>{He.version.value;let e=He.range(0,30),t=Q.value,n=t?[t,...e.filter(e=>e.key!==t.key)]:e,r=Be.value.length>1;return n.map(e=>({key:e.key,label:(e.title||`${e.provider} · ${e.project}`)+(r?` (${Ut.value.get(e.hostId)??e.hostId})`:``)}))});function si(e){return He.version.value,e.hostId&&e.agentId?He.get(`${e.hostId}:${e.agentId}`)??null:null}async function ci(e,t){await Zr(e,{column:t})}function li(e){e.hostId&&e.agentId&&Ln(`${e.hostId}:${e.agentId}`)}function ui(e){et.value=e,e!==`chat`||Z.value?Vn():Hn()}ne(()=>Re.value&&et.value===`chat`&&(!zn.matches||Xe.value)&&!J.value&&!K.value?Q.value?.key??null:null,()=>Re.value),Mn();let di=S(()=>(Ve.version.value,He.waiting));j(di,e=>ic(e)),j([di,je],([e,t])=>{let n=t?`${t} · LitePaseo`:`LitePaseo`;document.title=e?`(${e}) ${n}`:n},{immediate:!0});let fi=S(()=>(He.version.value,He.waiting?`attention`:He.allLaneSize(`running`)?`running`:He.allLaneSize(`review`)?`unread`:``));return j(fi,e=>ac(e),{immediate:!0}),document.addEventListener(`visibilitychange`,()=>{document.hidden||Ar()}),n(()=>{clearInterval(kr),clearInterval(Bt),at.clear(),window.removeEventListener(`storage`,Ht),window.removeEventListener(`popstate`,Un),window.removeEventListener(`keydown`,Gn),En?.close(),clearTimeout(On)}),(t,n)=>Re.value?(s(),B(`div`,{key:1,class:h([`shell`,{"detail-open":Xe.value,"is-resizing":De.value}]),style:P({"--sidebar-w":Ee.value+`px`})},[x(`aside`,Pf,[x(`div`,{class:h([`sidebar-resize`,{"is-dragging":De.value}]),role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,"aria-valuenow":Ee.value,"aria-valuemin":Qm,"aria-valuemax":$m,tabindex:`0`,title:`Drag to resize · double-click to reset`,onPointerdown:ke,onDblclick:n[2]||=e=>Oe(eh),onKeydown:[n[3]||=I(v(e=>Oe(Ee.value-16),[`prevent`]),[`left`]),n[4]||=I(v(e=>Oe(Ee.value+16),[`prevent`]),[`right`])]},null,42,Ff),je.value?(s(),B(`div`,{key:0,class:`instance-name`,title:je.value},_(je.value),9,If)):L(``,!0),x(`nav`,Lf,[x(`label`,{class:h([`side-row side-search`,{active:!!Ye.value}])},[e(Y,{name:`search`,size:15}),f(x(`input`,{ref_key:`searchInput`,ref:Wn,"onUpdate:modelValue":n[5]||=e=>Ye.value=e,type:`search`,placeholder:`Search`,"aria-label":`Search sessions, projects, hosts`,"aria-keyshortcuts":`/ Control+K Meta+K`},null,512),[[g,Ye.value]]),x(`kbd`,Rf,_(C(k)?`⌘K`:`Ctrl K`),1)],2),x(`button`,{class:h([`side-row`,{chosen:et.value===`board`}]),onClick:n[6]||=e=>ui(`board`)},[e(Y,{name:`board`,size:15}),n[82]||=c(`Kanban `,-1)],2)]),x(`div`,zf,[x(`span`,Bf,_(We.value===`projects`?`Workspaces`:`Recent`),1),x(`span`,{class:`list-summary`,title:nn.value,"aria-label":nn.value},_($t.value),9,Vf),x(`button`,{class:h([`icon-btn side-tool`,{chosen:M.value||rn.value!==null||We.value!==`projects`}]),"aria-label":`View options`,title:`Group and filter`,"aria-expanded":M.value,onClick:n[7]||=e=>M.value=!M.value},[e(Y,{name:`sliders`,size:15})],10,Hf)]),rn.value?(s(),B(`div`,Uf,[x(`button`,{class:`active-host-label`,title:`Filtered by host: `+(Ut.value.get(rn.value)??rn.value),onClick:n[8]||=e=>M.value=!0},[e(Y,{name:`server`,size:13}),x(`span`,null,`Host: `+_(Ut.value.get(rn.value)??rn.value),1)],8,Wf),x(`button`,{class:`icon-btn`,"aria-label":`Clear host filter`,title:`Show all hosts`,onClick:n[9]||=e=>rn.value=null},[e(Y,{name:`close`,size:13})])])):L(``,!0),M.value?(s(),B(`div`,Gf,[x(`div`,Kf,[x(`button`,{role:`radio`,"aria-checked":We.value===`projects`,class:h({chosen:We.value===`projects`}),onClick:n[10]||=e=>We.value=`projects`},` By project `,10,qf),x(`button`,{role:`radio`,"aria-checked":We.value===`recent`,class:h({chosen:We.value===`recent`}),onClick:n[11]||=e=>We.value=`recent`},`Recent`,10,Jf)]),Be.value.length>1?(s(),B(`div`,Yf,[x(`button`,{role:`radio`,"aria-checked":rn.value===null,class:h({chosen:rn.value===null}),onClick:n[12]||=e=>rn.value=null},[n[83]||=c(` All`,-1),x(`span`,{class:`chip-count`,title:tn(Qt.value,`workspace`)},_(Qt.value),9,Zf)],10,Xf),(s(!0),B(b,null,u(Be.value,e=>(s(),B(`button`,{key:e.id,role:`radio`,"aria-checked":rn.value===e.id,class:h({chosen:rn.value===e.id}),title:e.label+` · `+e.state,onClick:t=>rn.value=e.id},[x(`span`,{class:h([`status-dot`,e.state===`connected`?`is-idle-ok`:`is-offline`])},null,2),c(_(e.label),1),x(`span`,{class:`chip-count`,title:tn(an.value.get(e.id)??0,`workspace`)},_(an.value.get(e.id)),9,$f)],10,Qf))),128))])):L(``,!0)])):L(``,!0),e(Vr,{queues:ft.value,mode:We.value,store:C(Ve),"host-labels":Ut.value,"host-states":Wt.value,"selected-key":Ue.value,searching:!!Ye.value.trim(),onSelect:Rn,onNew:qn,onMenu:$n,onProjectMenu:hr},null,8,[`queues`,`mode`,`store`,`host-labels`,`host-states`,`selected-key`,`searching`]),e(hu,{report:Dr.value,loading:Or.value,onRefresh:n[13]||=e=>Ar(!0)},null,8,[`report`,`loading`]),x(`div`,ep,[x(`span`,{class:h([`live`,`is-`+Ge.value]),title:`Directory stream: `+Ge.value},[n[84]||=x(`span`,{class:`live-dot`},null,-1),c(_(Tn.value),1)],10,tp),x(`button`,{class:h([`icon-btn`,{chosen:et.value===`schedules`}]),title:`Schedules`,"aria-label":`Schedules`,onClick:n[14]||=e=>ui(`schedules`)},[e(Y,{name:`clock`,size:15})],2),x(`button`,{class:h([`icon-btn foot-hosts`,{chosen:et.value===`hosts`}]),title:`Hosts: ${Kt.value} of ${Be.value.length} connected`,"aria-label":`Hosts, ${Kt.value} of ${Be.value.length} connected`,onClick:n[15]||=e=>ui(`hosts`)},[e(Y,{name:`server`,size:15}),Kt.value<Be.value.length?(s(),B(`span`,rp)):L(``,!0)],10,np),x(`button`,{class:`icon-btn`,title:`Theme: `+C(Ds)+` (click to change)`,"aria-label":`Theme: `+C(Ds),onClick:n[16]||=(...e)=>C(Ns)&&C(Ns)(...e)},[e(Y,{name:C(Ds)===`dark`?`moon`:C(Ds)===`light`?`sun`:`monitor`,size:15},null,8,[`name`])],8,ip),x(`button`,{class:h([`icon-btn`,{chosen:et.value===`settings`}]),title:`Settings`,"aria-label":`Settings`,onClick:n[17]||=e=>ui(`settings`)},[e(Y,{name:`gear`,size:15})],2)])]),x(`main`,ap,[jr.value&&jr.value!==C(`0.9.0`)?(s(),B(`div`,op,[e(Y,{name:`refresh`,size:15}),x(`span`,null,`LitePaseo `+_(jr.value)+` is installed. Reload to use it.`,1),x(`button`,{class:`btn btn-sm`,onClick:Mr},`Reload`)])):L(``,!0),ze.value?(s(),B(`div`,sp,[e(Y,{name:`alert`,size:15}),x(`span`,null,_(ze.value),1),x(`button`,{class:`icon-btn`,"aria-label":`Dismiss`,onClick:n[18]||=e=>ze.value=``},[e(Y,{name:`close`,size:14})])])):L(``,!0),et.value===`settings`?(s(),p(zl,{key:2,request:$,"instance-name":je.value,onInstanceChanged:n[19]||=e=>je.value=e,"totp-enabled":!!Le.value?.totp,onBack:Hn,onSignedOut:n[20]||=e=>jn(`user`),onTotpChanged:n[21]||=e=>Le.value&&(Le.value.totp=e),onDictationChanged:n[22]||=e=>xt.value=e},null,8,[`instance-name`,`totp-enabled`])):et.value===`hosts`&&Gt.value?(s(),p(C(r),{key:Gt.value.id,host:Gt.value,api:$,onBack:n[23]||=e=>Gt.value=null},null,8,[`host`])):et.value===`hosts`?(s(),B(`section`,cp,[x(`header`,lp,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:Hn},[e(Y,{name:`back`,size:18})]),n[85]||=x(`div`,null,[x(`h1`,null,`Hosts`),x(`p`,{class:`subtle`},`Paseo daemons this console connects to. Secrets stay on this server.`)],-1)]),x(`div`,up,[x(`div`,dp,[(s(!0),B(b,null,u(Be.value,e=>(s(),B(`div`,{key:e.id,class:`card-row`},[x(`span`,{class:h([`status-dot`,e.state===`connected`?`is-idle-ok`:`is-offline`])},null,2),x(`div`,fp,[x(`div`,pp,_(e.label),1),x(`div`,mp,_(e.state),1),e.diagnostic?.error?(s(),B(`p`,hp,_(e.diagnostic.error.message),1)):L(``,!0),e.diagnostic?.lastConnectedAt?(s(),B(`div`,gp,`Last connected: `+_(new Date(e.diagnostic.lastConnectedAt).toLocaleString()),1)):L(``,!0),e.diagnostic?.attempt?(s(),B(`div`,_p,`Connection attempt `+_(e.diagnostic.attempt),1)):L(``,!0),e.diagnostic?.nextRetryAt?(s(),B(`div`,vp,`Next retry: `+_(new Date(e.diagnostic.nextRetryAt).toLocaleString()),1)):L(``,!0)]),x(`button`,{class:`btn btn-outline`,disabled:e.state!==`connected`,onClick:t=>Gt.value=e},`Settings`,8,yp),x(`button`,{class:`btn btn-outline`,disabled:X.value,onClick:t=>qr(e)},`Remove`,8,bp)]))),128)),Be.value.length?L(``,!0):(s(),B(`div`,xp,`No hosts yet.`))]),n[89]||=x(`h2`,{class:`section-label`},`Add a host`,-1),x(`form`,{class:`card form-card`,onSubmit:v(Kr,[`prevent`])},[x(`label`,Sp,[n[86]||=x(`span`,null,`Name`,-1),f(x(`input`,{"onUpdate:modelValue":n[24]||=e=>Ze.value=e,placeholder:`Build server`,required:``},null,512),[[g,Ze.value]])]),x(`label`,Cp,[n[87]||=x(`span`,null,`Connection`,-1),f(x(`input`,{"onUpdate:modelValue":n[25]||=e=>Qe.value=e,type:`password`,placeholder:`ws://host:port/ws, pairing offer or SSH target`,required:``,autocomplete:`off`,"aria-describedby":`host-connection-help`},null,512),[[g,Qe.value]])]),n[88]||=z(`<div id="host-connection-help" class="field-help"><p> The LitePaseo server connects to the daemon, so the address must be reachable from the server, not from this browser. The default daemon port is <code>6767</code>. </p><details><summary>Connection formats</summary><dl><dt>Same machine</dt><dd><code>6767</code> or <code>127.0.0.1:6767</code></dd><dt>Network address</dt><dd><code>192.168.1.10:6767</code>, <code>tcp://host:6767</code>, <code>ws://host:6767/ws</code> or <code>wss://host/ws</code></dd><dt>Daemon password</dt><dd><code>ws://host:6767/ws?password=…</code></dd><dt>SSH tunnel</dt><dd><code>ssh://user@host</code> or <code>ssh://user@host:2222?daemonPort=6767</code>. Key-based login only: the server&#39;s user must be able to run <code>ssh user@host</code> without a prompt. </dd><dt>Pairing / relay</dt><dd>Paste a pairing link from Paseo (containing <code>#connect=</code>) or a <code>relay://</code> URL.</dd><dt>Local socket</dt><dd><code>unix:///path/to/socket</code></dd></dl></details></div>`,1),x(`div`,wp,[x(`button`,{class:`btn btn-primary`,disabled:X.value},`Add host`,8,Tp)])],32)])])):et.value===`schedules`?(s(),p(xf,{key:5,hosts:Be.value,api:$,onBack:Hn,onOpenAgent:Ln},null,8,[`hosts`])):et.value===`board`?(s(),B(`section`,Ep,[x(`header`,Dp,[x(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:Hn},[e(Y,{name:`back`,size:18})]),x(`div`,null,[n[90]||=x(`h1`,null,`Kanban`,-1),x(`p`,Op,_(vr.value===`agents`?`Every agent by state, live. Follows the host filter and search.`:`Your own plan. Moving a card never changes an agent.`),1)]),x(`div`,kp,[x(`button`,{class:h({chosen:vr.value===`agents`}),onClick:n[26]||=e=>vr.value=`agents`},`Agents`,2),x(`button`,{class:h({chosen:vr.value===`plan`}),onClick:n[27]||=e=>vr.value=`plan`},`Plan`,2)])]),x(`div`,Ap,[vr.value===`agents`?(s(),p(eu,{key:0,store:C(He),"host-labels":Ut.value,busy:X.value,onOpen:Ln,onStop:yr,onRead:br,onArchive:xr},null,8,[`store`,`host-labels`,`busy`])):(s(),B(b,{key:1},[x(`form`,{class:`add-card`,onSubmit:v(Xr,[`prevent`])},[f(x(`input`,{"onUpdate:modelValue":n[28]||=e=>tt.value=e,placeholder:`New task`,required:``},null,512),[[g,tt.value]]),f(x(`select`,{"onUpdate:modelValue":n[29]||=e=>nt.value=e,class:`card-link-select`,"aria-label":`Link to conversation`},[n[91]||=x(`option`,{value:``},`No conversation`,-1),(s(!0),B(b,null,u(oi.value,e=>(s(),B(`option`,{key:e.key,value:e.key},_(e.label),9,jp))),128))],512),[[N,nt.value]]),x(`button`,{class:`btn btn-primary`,disabled:X.value},[e(Y,{name:`plus`,size:15}),n[92]||=c(`Add task`,-1)],8,Mp)],32),x(`div`,Np,[(s(),B(b,null,u(T,t=>x(`div`,{key:t,class:`column`},[x(`div`,Pp,[x(`h3`,null,_(t),1),x(`span`,Fp,_(wn.value.get(t).length),1)]),(s(!0),B(b,null,u(wn.value.get(t),t=>(s(),B(`article`,{key:t.id,class:`card kanban-card`},[x(`button`,{type:`button`,class:`kanban-open`,"aria-label":`Open task `+t.title,onClick:e=>ri.value=t.id},[x(`span`,Lp,_(t.title),1),ai(t)?(s(),B(`span`,Rp,_(ai(t)),1)):L(``,!0)],8,Ip),t.agentId?(s(),B(`div`,zp,[si(t)?(s(),B(`button`,{key:0,class:`link-btn`,title:`Open `+(si(t).title||si(t).id),onClick:e=>li(t)},[e(Y,{name:`chat`,size:13}),x(`span`,Vp,_(si(t).title||si(t).provider),1)],8,Bp)):(s(),B(`span`,Hp,`Conversation unavailable`)),x(`button`,{class:`icon-btn`,"aria-label":`Unlink conversation`,title:`Unlink conversation`,disabled:X.value,onClick:e=>Qr(t,``)},[e(Y,{name:`close`,size:13})],8,Up)])):(s(),B(`select`,{key:1,class:`card-link-select`,"aria-label":`Link to conversation`,disabled:X.value,value:``,onChange:e=>Qr(t,e.target.value)},[n[93]||=x(`option`,{value:``,disabled:``},`Link a conversation…`,-1),(s(!0),B(b,null,u(oi.value,e=>(s(),B(`option`,{key:e.key,value:e.key},_(e.label),9,Gp))),128))],40,Wp)),x(`div`,Kp,[x(`select`,{value:t.column,"aria-label":`Column`,onChange:e=>ci(t,e.target.value)},[(s(),B(b,null,u(T,e=>x(`option`,{key:e},_(e),1)),64))],40,qp),t.comments?.length?(s(),B(`button`,{key:0,type:`button`,class:`kanban-count`,title:t.comments.length+` comments`,onClick:e=>ri.value=t.id},[e(Y,{name:`chat`,size:13}),c(_(t.comments.length),1)],8,Jp)):L(``,!0),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Edit task`,title:`Edit`,onClick:e=>ri.value=t.id},[e(Y,{name:`edit`,size:15})],8,Yp),x(`button`,{class:`icon-btn`,"aria-label":`Remove`,onClick:e=>ti(t)},[e(Y,{name:`trash`,size:15})],8,Xp)])]))),128)),wn.value.get(t).length?L(``,!0):(s(),B(`p`,Zp,`Nothing here`))])),64))]),ii.value?(s(),p(Ku,{key:ii.value.id,card:ii.value,columns:T,links:oi.value,"linked-name":si(ii.value)?si(ii.value).title||si(ii.value).provider:null,busy:X.value,onClose:n[30]||=e=>ri.value=null,onPatch:n[31]||=e=>Zr(ii.value,e),onComment:n[32]||=e=>$r(ii.value,e),onUncomment:n[33]||=e=>ei(ii.value,e),onRemove:n[34]||=e=>ni(ii.value),onOpen:n[35]||=e=>{ri.value=null,li(ii.value)}},null,8,[`card`,`links`,`linked-name`,`busy`])):L(``,!0)],64))])])):Q.value?(s(),B(`div`,{key:7,class:`chat-split`,style:P({"--panel-w":xe.value+`px`})},[x(`section`,Qp,[x(`header`,$p,[x(`button`,{class:`icon-btn back`,"aria-label":`Back to sessions`,onClick:Hn},[e(Y,{name:`back`,size:18})]),x(`span`,{class:h([`status-dot chat-status`,`is-`+(Q.value.attention?`attention`:Q.value.state===`failed`?`error`:Q.value.state===`running`?`running`:`idle`)]),title:Q.value.status},null,10,em),x(`h1`,{class:`chat-title`,title:qt.value?.name||Q.value.title||``},[qt.value?.pinnedAt?(s(),p(Y,{key:0,name:`pin`,size:12,class:`title-pin`})):L(``,!0),c(_(qt.value?.name||Q.value.title||`Untitled session`),1)],8,tm),x(`span`,{class:`chat-context hide-sm`,title:[cn.value,Ut.value.get(Q.value.hostId),qt.value?.branch,Q.value.provider].filter(Boolean).join(` · `)},[c(_(cn.value),1),Be.value.length>1?(s(),B(b,{key:0},[c(` · `+_(Ut.value.get(Q.value.hostId)),1)],64)):L(``,!0),qt.value?.branch?(s(),B(b,{key:1},[c(` · `+_(qt.value.branch),1)],64)):L(``,!0)],8,nm),Yt.value?(s(),B(`button`,{key:0,class:`chat-chip`,title:`Subagent of `+(Yt.value.title||`another session`)+` · open the parent`,onClick:n[36]||=e=>Ln(Yt.value.key)},[e(Y,{name:`back`,size:12}),x(`span`,null,_(Yt.value.title||`Parent agent`),1)],8,rm)):L(``,!0),n[94]||=x(`span`,{class:`grow`},null,-1),Xt.value?(s(),B(`button`,{key:1,class:h([`chat-chip chat-subagents`,[`is-`+Xt.value.tone,{chosen:V.value===`subagents`}]]),"aria-label":`Subagents: `+Xt.value.label,title:Xt.value.total+(Xt.value.total===1?` subagent`:` subagents`),onClick:n[37]||=e=>{U.value=null,H(`subagents`)}},[Xt.value.tone===`idle`?(s(),p(Y,{key:1,name:`bot`,size:14})):(s(),B(`span`,{key:0,class:h([`status-dot`,`is-`+Xt.value.tone])},null,2)),x(`span`,null,_(Xt.value.label),1)],10,im)):L(``,!0),x(`button`,{class:`icon-btn head-tool`,"aria-label":`Changes`,title:`Workspace changes`,onClick:n[38]||=e=>H(`changes`)},[e(Y,{name:`file`,size:16})]),x(`button`,{class:`icon-btn head-tool`,"aria-label":`Search conversation`,title:`Search conversation`,onClick:n[39]||=e=>H(`search`)},[e(Y,{name:`search`,size:16})]),x(`button`,{class:h([`icon-btn head-tool`,{chosen:V.value===`files`}]),"aria-label":`Files`,title:`Files`,onClick:n[40]||=e=>H(`files`)},[e(Y,{name:`folder`,size:16})],2),x(`button`,{class:h([`icon-btn head-tool`,{chosen:K.value}]),"aria-label":`Terminal`,title:`Terminal`,onClick:n[41]||=e=>ie()},[e(Y,{name:`terminal`,size:16})],2),qt.value?(s(),B(`button`,{key:2,class:`icon-btn head-tool`,"aria-label":`Thread actions`,title:`Rename, pin, mark unread, archive`,onClick:er},[e(Y,{name:`more`,size:16})])):L(``,!0)]),Zt.value.length>1||se.value.length||re.value?(s(),B(`nav`,am,[(s(!0),B(b,null,u(Zt.value.length?Zt.value:[Q.value],e=>(s(),B(`button`,{key:e.key,class:h({chosen:e.key===Z.value&&!J.value&&!K.value}),onClick:t=>{Z.value=e.key,ae()}},[x(`span`,{class:h([`status-dot`,`is-`+(e.attention?`attention`:e.state===`failed`?`error`:e.state===`running`?`running`:e.unread?`unread`:`idle`)])},null,2),x(`span`,sm,_(e.title||e.provider),1)],10,om))),128)),(s(!0),B(b,null,u(se.value,t=>(s(),B(`button`,{key:`file:`+t,class:h([`file-tab`,{chosen:J.value===t}]),title:t,onClick:e=>J.value=t,onAuxclick:v(e=>e.button===1&&ye(t),[`prevent`])},[e(Y,{name:`file`,size:13}),x(`span`,lm,_(t.split(`/`).pop()),1),x(`span`,{class:`tab-close`,role:`button`,"aria-label":`Close `+t,onClick:v(e=>ye(t),[`stop`])},[e(Y,{name:`close`,size:11})],8,um)],42,cm))),128)),re.value?(s(),B(`button`,{key:0,class:h([`file-tab`,{chosen:K.value}]),onClick:n[43]||=e=>ie()},[e(Y,{name:`terminal`,size:13}),n[95]||=x(`span`,{class:`agent-tab-name`},`Terminal`,-1),x(`span`,{class:`tab-close`,role:`button`,"aria-label":`Close terminal tab`,onClick:n[42]||=v(e=>G.delete(q.value),[`stop`])},[e(Y,{name:`close`,size:11})])],2)):L(``,!0)])):L(``,!0),re.value?f((s(),p(C(d),{key:`t:`+Q.value.hostId+on.value,"host-id":Q.value.hostId,cwd:on.value,api:$,visible:K.value},null,8,[`host-id`,`cwd`,`visible`])),[[E,K.value]]):L(``,!0),J.value?(s(),p(C(l),{key:Q.value.hostId+`:`+on.value+`:`+J.value,"host-id":Q.value.hostId,cwd:on.value,path:J.value,api:$,session:Q.value.key,jump:le.value,view:C(fe).get(pe(q.value,J.value)),"view-key":pe(q.value,J.value),onView:me,onOpen:de,onReveal:ge},null,8,[`host-id`,`cwd`,`path`,`session`,`jump`,`view`,`view-key`])):L(``,!0),(s(),p(A,{max:C(Bn)},[f((s(),p(Ya,{ref_key:`conversation`,ref:Ke,key:Q.value.key,agent:Q.value,api:$,context:vn.value,"host-label":Ut.value.get(Q.value.hostId)??``,settled:mn.value,"footer-model":yt.value,onError:n[44]||=e=>ze.value=e,onSubagents:n[45]||=e=>te.value=e,onReady:n[46]||=e=>qe.value=Q.value.key,onTimelineClick:Cn,onUnauthorized:n[47]||=e=>jn(`ended`),onSuggestion:wr},null,8,[`agent`,`context`,`host-label`,`settled`,`footer-model`])),[[E,!J.value&&!K.value]])],1032,[`max`])),f(x(`div`,dm,[x(`div`,fm,[(s(!0),B(b,null,u(Q.value.pendingPermissions,e=>(s(),p(Ts,{key:Q.value.key+`:`+e.id,permission:e,busy:X.value,onRespond:t=>Gr(e,t)},null,8,[`permission`,`busy`,`onRespond`]))),128)),Rt.value?(s(),B(`p`,pm,_(Rt.value),1)):L(``,!0),C(it).warning.value?(s(),B(`p`,mm,_(C(it).warning.value),1)):L(``,!0),Tt.value?(s(),B(`p`,hm,[e(Y,{name:`alert`,size:13}),c(_(Tt.value)+` `,1),x(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Dismiss`,onClick:n[48]||=e=>Tt.value=``},[e(Y,{name:`close`,size:12})])])):L(``,!0),It.value.length?(s(),B(`details`,gm,[x(`summary`,null,`Other saved drafts (`+_(It.value.length)+`)`,1),(s(!0),B(b,null,u(It.value,e=>(s(),B(`div`,{key:e.slot},[x(`p`,_m,_(e.text),1),x(`button`,{class:`btn btn-ghost`,onClick:t=>Z.value&&C(it).restore(Z.value,e.slot)},`Restore draft`,8,vm)]))),128))])):L(``,!0),Ft.value&&!X.value?(s(),B(`div`,ym,[e(Y,{name:`alert`,size:15}),x(`span`,bm,`Delivery unknown. Check the conversation before sending again. Message: `+_(Ft.value.text)+` `+_(Ft.value.attachmentNames?.join(`, `)),1),x(`button`,{class:`btn btn-ghost`,disabled:Lt.value,onClick:zt},_(Lt.value?`Checking…`:`Check delivery`),9,xm),x(`button`,{class:`btn btn-ghost`,onClick:Vt},`I checked`)])):L(``,!0),ot.value.length?(s(),B(`div`,Sm,[(s(!0),B(b,null,u(ot.value,t=>(s(),B(`div`,{key:t.id,class:h([`queue-item`,{"is-error":t.error}]),role:`listitem`},[e(Y,{name:t.error?`alert`:`clock`,size:14,class:`queue-icon`},null,8,[`name`]),x(`div`,Cm,[ct.value===t.id?(s(),B(b,{key:0},[f(x(`textarea`,{"onUpdate:modelValue":n[49]||=e=>lt.value=e,"aria-label":`Queued message text`,rows:`3`},null,512),[[g,lt.value]]),x(`button`,{type:`button`,class:`btn btn-ghost`,disabled:X.value,onClick:e=>Br(t)},`Save`,8,wm),x(`button`,{type:`button`,class:`btn btn-ghost`,onClick:n[50]||=e=>ct.value=null},`Cancel`)],64)):(s(),B(`span`,{key:1,class:`queue-text`,title:t.text},_(t.text||`(attachments only)`),9,Tm)),t.attachmentNames.length?(s(),B(`span`,Em,_(t.attachmentNames.join(`, `)),1)):L(``,!0),x(`span`,Dm,_(t.sending?`Sending…`:t.error?`Delivery unknown · queue paused`:t.paused?`Paused`:Wt.value.get(Q.value.hostId)===`connected`?`Waiting for turn to finish`:`Waiting for host`),1),t.error?(s(),B(`span`,Om,_(t.error),1)):L(``,!0)]),x(`button`,{class:`btn btn-ghost`,disabled:X.value||t.sending,onClick:e=>ht(t,t.paused?`resume`:`pause`)},_(t.paused?`Resume`:`Pause`),9,km),x(`button`,{class:`btn btn-ghost`,disabled:X.value||t.sending||ot.value[0].id===t.id,onClick:e=>ht(t,`up`),"aria-label":`Move queued message up`},`↑`,8,Am),t.error?(s(),B(`button`,{key:0,class:`btn btn-ghost`,disabled:X.value,onClick:e=>ht(t,`check`)},`Check delivery`,8,jm)):L(``,!0),x(`button`,{type:`button`,class:`queue-send`,disabled:X.value||!!Ft.value||t.sending,title:un.value?`Send now: stops the running turn`:`Send now`,onClick:e=>Ur(t)},_(un.value?`Interrupt`:`Send`),9,Mm),x(`button`,{type:`button`,class:`icon-btn`,disabled:X.value||t.sending,"aria-label":`Edit queued message`,title:`Edit`,onClick:e=>{ct.value=t.id,lt.value=t.text}},[e(Y,{name:`edit`,size:14})],8,Nm),x(`button`,{type:`button`,class:`icon-btn`,disabled:X.value||t.sending,"aria-label":`Remove queued message`,title:`Remove`,onClick:e=>zr(t)},[e(Y,{name:`close`,size:14})],8,Pm)],2))),128))])):L(``,!0),x(`form`,{class:h([`composer`,{"is-dragging":At.value}]),onSubmit:v(Fr,[`prevent`]),onDragover:n[55]||=v(e=>At.value=!0,[`prevent`]),onDragleave:jt,onDrop:n[56]||=v(e=>{At.value=!1,_t.value?.addFiles(e.dataTransfer?.files)},[`prevent`]),onPaste:Nt},[e(rs,{ref_key:`attachmentPanel`,ref:_t,store:C(at),"agent-key":Q.value.key,base:`/api`+An(Q.value),busy:X.value||!!Ft.value},null,8,[`store`,`agent-key`,`base`,`busy`]),St.value?(s(),B(`div`,{key:0,ref_key:`dictationPreviewElement`,ref:Ct,class:`dictation-preview`,role:`status`,"aria-live":`polite`},_(St.value),513)):L(``,!0),f(x(`textarea`,{ref_key:`composerElement`,ref:Je,"onUpdate:modelValue":n[51]||=e=>Pt.value=e,rows:`1`,placeholder:Er.value,required:!bt.value.length,onInput:Nr,onKeydown:Pr},null,40,Fm),[[g,Pt.value]]),x(`div`,Im,[x(`button`,{type:`button`,class:`composer-tool`,"aria-label":`Attach files`,title:_t.value?.hint,disabled:X.value||!!Ft.value||!_t.value?.available,onClick:n[52]||=e=>_t.value?.pick()},[e(Y,{name:`plus`,size:18})],8,Lm),e(yd,{ref_key:`agentControls`,ref:vt,agent:Q.value,path:An(Q.value),api:$,disabled:X.value||Wt.value.get(Q.value.hostId)!==`connected`,onNotice:Dt},null,8,[`agent`,`path`,`disabled`]),x(`div`,Rm,[un.value?(s(),B(`label`,{key:0,class:h([`chip-behavior`,`is-`+$e.value]),title:$e.value===`queue`?`Queue: send when the current turn ends`:$e.value===`steer`?`Steer: send instructions into the current turn; Paseo may interrupt if steering is unavailable`:`Interrupt: stop the current turn and start a new one`},[x(`span`,null,_($e.value===`queue`?`Queue`:$e.value===`steer`?`Steer`:`Interrupt`),1),e(Y,{name:`chevron`,size:11,class:`behavior-caret`}),f(x(`select`,{"onUpdate:modelValue":n[53]||=e=>$e.value=e,"aria-label":`Message delivery mode`},[n[96]||=x(`option`,{value:`queue`},`Queue`,-1),dn.value.includes(`steer`)?(s(),B(`option`,Bm,`Steer`)):L(``,!0),n[97]||=x(`option`,{value:`interrupt`},`Interrupt`,-1)],512),[[N,$e.value]])],10,zm)):L(``,!0),xt.value?(s(),p(Df,{key:Q.value.key,disabled:X.value,onText:Ot,onPreview:n[54]||=e=>St.value=e,onNotice:Dt},null,8,[`disabled`])):L(``,!0),un.value?(s(),B(`button`,{key:2,type:`button`,class:h([`disc disc-stop`,{"is-primary":!kt.value}]),"aria-label":`Stop turn`,title:`Stop turn`,disabled:X.value,onClick:Wr},[e(Y,{name:`stop`,size:18})],10,Vm)):L(``,!0),!un.value||kt.value?(s(),B(`button`,{key:3,class:`disc disc-send`,"aria-label":`Send`,title:`Send (Enter) · Shift+Enter for a new line`,disabled:X.value||!!Ft.value||!Mt.value||!kt.value},[e(Y,{name:`send`,size:17})],8,Hm)):L(``,!0)])])],34)])],512),[[E,!J.value&&!K.value]])]),V.value?(s(),B(`aside`,Um,[x(`div`,{class:`panel-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize panel`,tabindex:`0`,onPointerdown:we,onDblclick:n[57]||=e=>Ce(Zm)},null,32),x(`div`,Wm,[x(`button`,{class:h({chosen:V.value===`files`}),onClick:n[58]||=e=>V.value=`files`},[e(Y,{name:`folder`,size:14}),n[98]||=c(`Files`,-1)],2),x(`button`,{class:h({chosen:V.value===`changes`}),onClick:n[59]||=e=>V.value=`changes`},`Changes`,2),x(`button`,{class:h({chosen:V.value===`search`}),onClick:n[60]||=e=>V.value=`search`},`Search`,2),Xt.value||V.value===`subagents`?(s(),B(`button`,{key:0,class:h({chosen:V.value===`subagents`}),onClick:n[61]||=e=>V.value=`subagents`},`Subagents`,2)):L(``,!0),n[99]||=x(`span`,{class:`grow`},null,-1),x(`button`,{class:`icon-btn`,"aria-label":`Close panel`,title:`Close panel`,onClick:n[62]||=e=>V.value=null},[e(Y,{name:`close`,size:14})])]),x(`div`,Gm,[V.value===`changes`?(s(),p(C(i),{key:0,"host-id":Q.value.hostId,cwd:on.value,api:$},null,8,[`host-id`,`cwd`])):L(``,!0),V.value===`search`?(s(),p(C(a),{key:1,base:An(Q.value),api:$,onJump:gt},null,8,[`base`])):L(``,!0),V.value===`subagents`?(s(),p(C(m),{key:2,opened:U.value,"onUpdate:opened":n[63]||=e=>U.value=e,agents:Jt.value,subagents:te.value,base:An(Q.value),api:$,onSelect:Ln},null,8,[`opened`,`agents`,`subagents`,`base`])):L(``,!0),(s(),p(A,null,[V.value===`files`?(s(),p(C(o),{key:`f:`+Q.value.hostId+on.value,"host-id":Q.value.hostId,cwd:on.value,api:$,"active-path":J.value,reveal:he.value?.owner===q.value?he.value:null,onOpen:de},null,8,[`host-id`,`cwd`,`active-path`,`reveal`])):L(``,!0)],1024))])])):L(``,!0)],4)):et.value===`chat`&&Yn.value?(s(),B(`section`,Km,[...n[100]||=[x(`span`,{class:`spinner`},null,-1),x(`p`,null,`Starting session…`,-1)]])):(s(),B(`section`,qm,[x(`div`,Jm,[e(Y,{name:`chat`,size:26})]),x(`h2`,null,_(Qt.value?`Pick a session`:`Connect your first host`),1),x(`p`,null,_(Qt.value?rn.value?`${$t.value} sessions in ${en.value} projects on ${Ut.value.get(rn.value)??`this host`}.`:`${Qt.value} sessions in ${en.value} projects across ${Be.value.length} hosts.`:`Add a Paseo daemon and its agents show up here, live.`),1),Be.value.length?(s(),B(`button`,{key:1,class:`btn btn-primary`,onClick:n[65]||=e=>qn()},[e(Y,{name:`plus`,size:15}),n[101]||=c(`New session`,-1)])):(s(),B(`button`,{key:0,class:`btn btn-primary`,onClick:n[64]||=e=>ui(`hosts`)},`Add a host`))]))]),Xn.value?(s(),p(Se,{key:0,thread:Xn.value.thread,x:Xn.value.x,y:Xn.value.y,onClose:n[66]||=e=>Xn.value=null,onRename:n[67]||=e=>Zn.value=e,onPin:nr,onUnread:rr,onRead:ir,onArchive:ar},null,8,[`thread`,`x`,`y`])):L(``,!0),dr.value?(s(),p(Fe,{key:1,name:dr.value.project.name,pinned:sr(dr.value.project),onPin:n[68]||=e=>ur(dr.value.project),host:Ut.value.get(dr.value.project.hostId)??`Unknown host`,x:dr.value.x,y:dr.value.y,onClose:n[69]||=e=>dr.value=null,onSettings:n[70]||=e=>fr.value=dr.value.project,onRemove:n[71]||=e=>gr(dr.value.project)},null,8,[`name`,`pinned`,`host`,`x`,`y`])):L(``,!0),fr.value?(s(),p(ln,{key:2,"host-id":fr.value.hostId,"host-label":Ut.value.get(fr.value.hostId)??`Unknown host`,project:mr.value,"root-path":fr.value.rootPath,"custom-icons":!!Be.value.find(e=>e.id===fr.value.hostId)?.customIcons,request:$,onClose:n[72]||=e=>fr.value=null},null,8,[`host-id`,`host-label`,`project`,`root-path`,`custom-icons`])):L(``,!0),Sn.value?(s(),p(_n,{key:3,src:Sn.value,onClose:n[73]||=e=>Sn.value=null},null,8,[`src`])):L(``,!0),Zn.value?(s(),p(Me,{key:4,thread:Zn.value,busy:X.value,onClose:n[74]||=e=>Zn.value=null,onSave:tr},null,8,[`thread`,`busy`])):L(``,!0),Kn.value?(s(),p(Wo,{key:5,hosts:Be.value,"initial-host-id":Kn.value.hostId,"initial-cwd":Kn.value.cwd,"initial-project":Kn.value.project,request:$,onClose:n[75]||=e=>Kn.value=null,onCreated:Jn},null,8,[`hosts`,`initial-host-id`,`initial-cwd`,`initial-project`])):L(``,!0)],6)):(s(),B(`div`,Of,[Le.value?(s(),B(`form`,{key:0,class:`login-card`,onSubmit:v(Nn,[`prevent`])},[x(`div`,kf,[n[76]||=x(`img`,{class:`brand-mark`,src:`/icons/mark.svg`,alt:``,width:`22`,height:`22`},null,-1),c(_(Ne.value),1)]),n[80]||=x(`p`,{class:`login-lede`},`All your Paseo hosts, one fast console.`,-1),x(`label`,Af,[n[77]||=x(`span`,null,`Server access token`,-1),f(x(`input`,{"onUpdate:modelValue":n[0]||=e=>Pe.value=e,type:`password`,autocomplete:`off`,required:``,autofocus:``},null,512),[[g,Pe.value]])]),n[81]||=x(`p`,{class:`hint`},[c(`Run `),x(`code`,null,`litepaseo token`),c(` on the server to print it.`)],-1),Le.value.totp?(s(),B(b,{key:0},[x(`label`,jf,[n[78]||=x(`span`,null,`Authenticator code`,-1),f(x(`input`,{"onUpdate:modelValue":n[1]||=e=>Ie.value=e,class:`code-input`,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,pattern:`[0-9]{6}`,placeholder:`••••••`,required:``,onInput:Fn},null,544),[[g,Ie.value]])]),n[79]||=x(`p`,{class:`hint`},`Both your access token and a code from your authenticator app are required.`,-1)],64)):L(``,!0),x(`button`,{class:`btn btn-primary btn-block`,disabled:X.value},_(X.value?`Signing in…`:`Connect`),9,Mf),ze.value?(s(),B(`p`,Nf,_(ze.value),1)):L(``,!0)],32)):L(``,!0)]))}});function nh(){let e=matchMedia(`(prefers-reduced-motion: reduce)`),t,n=!1,r=()=>Math.max(200,Number(getComputedStyle(document.documentElement).getPropertyValue(`--motion-step-ms`))||1e3),i=e=>e-performance.now()%e+10,a=()=>{clearTimeout(t),t=void 0},o=()=>{if(t=void 0,n||document.hidden||e.matches)return;let a=document.getAnimations().filter(e=>e instanceof CSSAnimation&&[`pulse`,`spin`].includes(e.animationName));if(!a.length)return;let s=r(),c=Math.floor(performance.now()/s)*s;for(let e of a)e.pause(),e.currentTime=c;t=setTimeout(o,i(s))},s=()=>{document.hidden||e.matches?a():!t&&!n&&(t=setTimeout(o,i(r())))},c=new MutationObserver(s);return c.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`class`,`style`,`hidden`,`open`]}),document.addEventListener(`visibilitychange`,s),window.addEventListener(`resize`,s),e.addEventListener(`change`,s),s(),()=>{n=!0,a(),c.disconnect(),document.removeEventListener(`visibilitychange`,s),window.removeEventListener(`resize`,s),e.removeEventListener(`change`,s)}}js(),zs();var rh=M(th);rh.mount(`#app`),rh.onUnmount(nh());export{hi as a,xn as c,cr as d,bn as f,_i as i,pr as l,Y as m,ja as n,mi as o,gn as p,ya as r,Kr as s,As as t,fr as u};