litepaseo 0.3.0 → 0.3.1

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 (89) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +22 -5
  3. package/dist/server/cli.mjs +650 -32
  4. package/dist/web/assets/{CodeBlockNode-D-c_NpDN.js → CodeBlockNode-fLbELjCG.js} +1 -1
  5. package/dist/web/assets/CodeBlockNode-fLbELjCG.js.br +0 -0
  6. package/dist/web/assets/CodeBlockNode-fLbELjCG.js.gz +0 -0
  7. package/dist/web/assets/{FileViewer-C6rgOMRo.js → FileViewer-C7zGfiFt.js} +1 -1
  8. package/dist/web/assets/FileViewer-C7zGfiFt.js.br +0 -0
  9. package/dist/web/assets/FileViewer-C7zGfiFt.js.gz +0 -0
  10. package/dist/web/assets/{FilesPanel-CNkBvKGD.js → FilesPanel-B1YfdWK8.js} +1 -1
  11. package/dist/web/assets/FilesPanel-B1YfdWK8.js.br +0 -0
  12. package/dist/web/assets/FilesPanel-B1YfdWK8.js.gz +0 -0
  13. package/dist/web/assets/{MarkdownMessage-DjRNZCD0.js → MarkdownMessage-C30PkBRA.js} +5 -5
  14. package/dist/web/assets/MarkdownMessage-C30PkBRA.js.br +0 -0
  15. package/dist/web/assets/MarkdownMessage-C30PkBRA.js.gz +0 -0
  16. package/dist/web/assets/{PreCodeBlock-BitPoeXT.js → PreCodeBlock-3ozveRNf.js} +1 -1
  17. package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-DVJqSz-5.js → PreCodeBlock.vue_vue_type_style_index_0_lang-BPnMZFbo.js} +1 -1
  18. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BPnMZFbo.js.br +0 -0
  19. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BPnMZFbo.js.gz +0 -0
  20. package/dist/web/assets/{TerminalPanel-CpGnkfa7.js → TerminalPanel-BR2okuCE.js} +1 -1
  21. package/dist/web/assets/TerminalPanel-BR2okuCE.js.br +0 -0
  22. package/dist/web/assets/TerminalPanel-BR2okuCE.js.gz +0 -0
  23. package/dist/web/assets/{Tooltip-C9GHriiI.js → Tooltip-Dh7ELGI1.js} +1 -1
  24. package/dist/web/assets/Tooltip-Dh7ELGI1.js.br +0 -0
  25. package/dist/web/assets/Tooltip-Dh7ELGI1.js.gz +0 -0
  26. package/dist/web/assets/index-BJ4CkuXT.js +30 -0
  27. package/dist/web/assets/index-BJ4CkuXT.js.br +0 -0
  28. package/dist/web/assets/index-BJ4CkuXT.js.gz +0 -0
  29. package/dist/web/assets/{index-Wf4Xa0ob.css → index-CaFqUnEO.css} +1 -1
  30. package/dist/web/assets/index-CaFqUnEO.css.br +0 -0
  31. package/dist/web/assets/index-CaFqUnEO.css.gz +0 -0
  32. package/dist/web/assets/{index10-QexvIpKb.js → index10-BXOnBXXV.js} +1 -1
  33. package/dist/web/assets/index10-BXOnBXXV.js.br +0 -0
  34. package/dist/web/assets/index10-BXOnBXXV.js.gz +0 -0
  35. package/dist/web/assets/index3-C1CbKHXb.js +1 -0
  36. package/dist/web/assets/index4-CE4EA6Rx.js +1 -0
  37. package/dist/web/assets/{index5-DaBM1kaC.js → index5-BrR0S3K6.js} +1 -1
  38. package/dist/web/assets/index5-BrR0S3K6.js.br +0 -0
  39. package/dist/web/assets/index5-BrR0S3K6.js.gz +0 -0
  40. package/dist/web/assets/{index6-1dcCVob7.js → index6-DWBoE2gM.js} +1 -1
  41. package/dist/web/assets/index6-DWBoE2gM.js.br +0 -0
  42. package/dist/web/assets/index6-DWBoE2gM.js.gz +0 -0
  43. package/dist/web/assets/{index7-DGSFcnYT.js → index7-CoJTOvQ5.js} +1 -1
  44. package/dist/web/assets/index7-CoJTOvQ5.js.br +0 -0
  45. package/dist/web/assets/index7-CoJTOvQ5.js.gz +0 -0
  46. package/dist/web/assets/{index8-BjPxjipz.js → index8-CQGhir4p.js} +1 -1
  47. package/dist/web/assets/index8-CQGhir4p.js.br +0 -0
  48. package/dist/web/assets/index8-CQGhir4p.js.gz +0 -0
  49. package/dist/web/assets/{index9-VNQsX15e.js → index9-D_kItRZJ.js} +1 -1
  50. package/dist/web/assets/index9-D_kItRZJ.js.br +0 -0
  51. package/dist/web/assets/index9-D_kItRZJ.js.gz +0 -0
  52. package/dist/web/index.html +2 -2
  53. package/dist/web/index.html.br +0 -0
  54. package/dist/web/index.html.gz +0 -0
  55. package/docs/cloudflare-access.md +111 -0
  56. package/package.json +4 -1
  57. package/dist/web/assets/CodeBlockNode-D-c_NpDN.js.br +0 -0
  58. package/dist/web/assets/CodeBlockNode-D-c_NpDN.js.gz +0 -0
  59. package/dist/web/assets/FileViewer-C6rgOMRo.js.br +0 -0
  60. package/dist/web/assets/FileViewer-C6rgOMRo.js.gz +0 -0
  61. package/dist/web/assets/FilesPanel-CNkBvKGD.js.br +0 -0
  62. package/dist/web/assets/FilesPanel-CNkBvKGD.js.gz +0 -0
  63. package/dist/web/assets/MarkdownMessage-DjRNZCD0.js.br +0 -0
  64. package/dist/web/assets/MarkdownMessage-DjRNZCD0.js.gz +0 -0
  65. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-DVJqSz-5.js.br +0 -0
  66. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-DVJqSz-5.js.gz +0 -0
  67. package/dist/web/assets/TerminalPanel-CpGnkfa7.js.br +0 -0
  68. package/dist/web/assets/TerminalPanel-CpGnkfa7.js.gz +0 -0
  69. package/dist/web/assets/Tooltip-C9GHriiI.js.br +0 -0
  70. package/dist/web/assets/Tooltip-C9GHriiI.js.gz +0 -0
  71. package/dist/web/assets/index-D4mQel3H.js +0 -30
  72. package/dist/web/assets/index-D4mQel3H.js.br +0 -0
  73. package/dist/web/assets/index-D4mQel3H.js.gz +0 -0
  74. package/dist/web/assets/index-Wf4Xa0ob.css.br +0 -0
  75. package/dist/web/assets/index-Wf4Xa0ob.css.gz +0 -0
  76. package/dist/web/assets/index10-QexvIpKb.js.br +0 -0
  77. package/dist/web/assets/index10-QexvIpKb.js.gz +0 -0
  78. package/dist/web/assets/index3-B9LRPNVQ.js +0 -1
  79. package/dist/web/assets/index4-CTBFr99S.js +0 -1
  80. package/dist/web/assets/index5-DaBM1kaC.js.br +0 -0
  81. package/dist/web/assets/index5-DaBM1kaC.js.gz +0 -0
  82. package/dist/web/assets/index6-1dcCVob7.js.br +0 -0
  83. package/dist/web/assets/index6-1dcCVob7.js.gz +0 -0
  84. package/dist/web/assets/index7-DGSFcnYT.js.br +0 -0
  85. package/dist/web/assets/index7-DGSFcnYT.js.gz +0 -0
  86. package/dist/web/assets/index8-BjPxjipz.js.br +0 -0
  87. package/dist/web/assets/index8-BjPxjipz.js.gz +0 -0
  88. package/dist/web/assets/index9-VNQsX15e.js.br +0 -0
  89. package/dist/web/assets/index9-VNQsX15e.js.gz +0 -0
@@ -0,0 +1,30 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/MarkdownMessage-C30PkBRA.js","assets/vue.runtime.esm-bundler-D6xZ1zFq.js","assets/MarkdownMessage-bqphU8I9.css","assets/FilesPanel-B1YfdWK8.js","assets/FilesPanel-CY9yMixJ.css","assets/FileViewer-C7zGfiFt.js","assets/FileViewer-CljYTF8J.css","assets/TerminalPanel-BR2okuCE.js","assets/TerminalPanel-DvfBWyiQ.css"])))=>i.map(i=>d[i]);
2
+ import{$ as e,C as t,G as n,H as r,I as i,J as a,L as o,N as s,P as c,Q as l,S as u,T as d,X as f,_ as p,a as m,at as h,c as g,d as _,et as v,f as y,g as b,h as x,j as S,k as C,l as w,m as T,nt as E,o as D,ot as O,p as k,r as A,rt as j,s as M,u as N,v as P,w as F,x as ee,y as I,z as L}from"./vue.runtime.esm-bundler-D6xZ1zFq.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 R=e=>e?e.size:0,z=e=>(e.size=1+R(e.left)+R(e.right),e),te=class{root=null;compare;constructor(e){this.compare=e}get size(){return R(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=R(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+=R(t.left)+1,t=t.right;else return n+R(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=R(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,[z(e),i]}let[i,a]=this.split(e.left,t,n);return e.left=a,[i,z(e)]}merge(e,t){return e?t?e.priority>t.priority?(e.right=this.merge(e.right,t),z(e)):(t.left=this.merge(e,t.left),z(t)):e:t}},B=e=>e?e.size:0,V=e=>e?e.sum:0,H=e=>(e.size=1+B(e.left)+B(e.right),e.sum=e.weight+V(e.left)+V(e.right),e),ne=class{root=null;compare;constructor(e){this.compare=e}get size(){return B(this.root)}get total(){return V(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=B(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=V(t.left);if(e<i)t=t.left;else if(e<i+t.weight||!t.right)return{item:t.item,rank:n+B(t.left),start:r+i};else e-=i+t.weight,r+=i+t.weight,n+=B(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+=V(t.left)+t.weight,t=t.right;else return n+V(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,[H(e),i]}let[i,a]=this.split(e.left,t,n);return e.left=a,[i,H(e)]}merge(e,t){return e?t?e.priority>t.priority?(e.right=this.merge(e.right,t),H(e)):(t.left=this.merge(e,t.left),H(t)):e:t}},re=[`needs_input`,`running`,`review`,`done`],U=e=>e===`failed`||e===`unread`?`review`:e,ie=e=>/^[A-Z][a-z]/.test(e)?e[0].toLowerCase()+e.slice(1):e,ae=typeof matchMedia==`function`&&matchMedia(`(pointer: coarse)`).matches?44:36,oe=(e,t)=>e.key<t.key?-1:+(e.key>t.key);function W(e,t){return t.activityAt-e.activityAt||oe(e,t)}function se(e,t){let n=e.pinnedAt??0,r=t.pinnedAt??0;return n||r?n?r?n-r||oe(e,t):-1:1:W(e,t)}function ce(e){return e.attention?`needs_input`:e.failed?`failed`:e.running?`running`:e.unread?`unread`:`done`}var le=e=>`${e.hostId}\n${e.project.toLowerCase()}`,ue=new Intl.Collator(void 0,{sensitivity:`base`,numeric:!0}),de=(e,t)=>t.recent-e.recent||ue.compare(e.name,t.name)||(e.key<t.key?-1:+(e.key>t.key)),fe=e=>e.state??(e.status===`running`?`running`:`done`),pe=class{flat;groups=new Map;index=new ne(de);lanes;waiting=0;compare;isCollapsed;constructor(e,t){this.compare=e,this.isCollapsed=t,this.flat=new te(e),this.lanes=new Map(re.map(e=>[e,new te(W)]))}get size(){return this.flat.size}weight(e){return 36+(this.isCollapsed(e.key)?0:e.items.size*ae)}add(e){this.flat.insert(e),this.lanes.get(U(fe(e))).insert(e);let t=le(e),n=this.groups.get(t);n?this.index.remove(n):(n={key:t,name:e.project,items:new te(this.compare),byRecency:this.compare===W?null:new te(W),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(U(fe(e))).remove(e);let t=this.groups.get(le(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)/ae)),s=Math.min(t.items.size,Math.ceil((r-i)/ae));s>a&&t.items.range(a,s-a).forEach((e,t)=>n.push({kind:`item`,key:e.key,top:i+(a+t)*ae,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=(e.hosts.get(t.hostId)??0)+n;r>0?e.hosts.set(t.hostId,r):e.hosts.delete(t.hostId),t.attention&&(e.attention+=n,this.waiting+=n);let i=fe(t);i===`failed`?e.failed+=n:i===`running`?e.running+=n:i===`unread`&&(e.unread+=n)}},me=class{generation=``;seq=-1;byKey=new Map;collapsed;compare;all;byHost=new Map;host=null;filtered=null;predicate=null;persist;indexOf;buckets=new Map;version=v(0);constructor(e={}){this.collapsed=new Set(e.collapsed),this.persist=e.persist??(()=>{}),this.compare=e.compare??W,this.indexOf=e.indexBy??null,this.all=new pe(this.compare,this.collapsedFn)}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 pe(this.compare,this.collapsedFn)),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 pe(this.compare,()=>!1),t=this.base;for(let n of t.flat.range(0,t.size))this.predicate(n)&&e.add(n);this.filtered=e}bucketOf(e){return this.indexOf?this.indexOf(e):null}unbucket(e){let t=this.bucketOf(e);if(!t)return;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);let t=this.bucketOf(e);if(t){let n=this.buckets.get(t);n||this.buckets.set(t,n=new te(W)),n.insert(e)}}},he=[`width`,`height`],ge=[`d`],G=d({__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`,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`,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)=>(i(),I(`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`},[b(`path`,{d:t[e.name]??t.tool},null,8,ge)],8,he))}}),K=[`aria-label`],q={class:`menu-title`},_e=d({__name:`ThreadMenu`,props:{thread:{},x:{},y:{}},emits:[`close`,`rename`,`pin`,`unread`,`read`,`archive`],setup(n,{emit:r}){let a=n,o=r,l=e(null),d=e({left:a.x,top:a.y});function f(e){e(),o(`close`)}function p(e){e.key===`Escape`&&o(`close`)}function m(e){l.value&&!l.value.contains(e.target)&&o(`close`)}return s(()=>{S(()=>{let e=l.value;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect();d.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`,p),setTimeout(()=>window.addEventListener(`pointerdown`,m),0)}),c(()=>{window.removeEventListener(`keydown`,p),window.removeEventListener(`pointerdown`,m)}),(e,r)=>(i(),I(`div`,{ref_key:`element`,ref:l,class:`menu`,role:`menu`,"aria-label":`Actions for `+n.thread.name,style:h({left:d.value.left+`px`,top:d.value.top+`px`})},[b(`div`,q,O(n.thread.name),1),b(`button`,{role:`menuitem`,onClick:r[0]||=e=>f(()=>o(`rename`,n.thread))},[t(G,{name:`edit`,size:14}),r[5]||=u(`Rename…`,-1)]),b(`button`,{role:`menuitem`,onClick:r[1]||=e=>f(()=>o(`pin`,n.thread,!n.thread.pinnedAt))},[t(G,{name:`pin`,size:14}),u(O(n.thread.pinnedAt?`Unpin`:`Pin to top`),1)]),n.thread.unread?(i(),I(`button`,{key:0,role:`menuitem`,onClick:r[2]||=e=>f(()=>o(`read`,n.thread))},[t(G,{name:`check`,size:14}),r[6]||=u(`Mark as read `,-1)])):(i(),I(`button`,{key:1,role:`menuitem`,onClick:r[3]||=e=>f(()=>o(`unread`,n.thread))},[t(G,{name:`dot`,size:14}),r[7]||=u(`Mark as unread `,-1)])),r[9]||=b(`div`,{class:`menu-sep`},null,-1),b(`button`,{role:`menuitem`,class:`menu-danger`,onClick:r[4]||=e=>f(()=>o(`archive`,n.thread))},[t(G,{name:`archive`,size:14}),r[8]||=u(`Archive… `,-1)])],12,K))}}),J={class:`sheet-head`},ve={class:`sheet-body`},ye={class:`field`},be=[`placeholder`],xe={class:`row-sub`},Y={class:`sheet-foot`},Se=[`disabled`],Ce=[`disabled`],we=[`disabled`],Te=d({__name:`RenameThread`,props:{thread:{},busy:{type:Boolean}},emits:[`close`,`save`],setup(n,{emit:r}){let o=n,c=r,l=e(o.thread.title??o.thread.name),u=e(null);s(()=>S(()=>{u.value?.focus(),u.value?.select()}));function d(){let e=l.value.trim();c(`save`,e||null)}return(e,r)=>(i(),I(`div`,{class:`overlay`,onMousedown:r[4]||=_(e=>!n.busy&&c(`close`),[`self`]),onKeydown:r[5]||=N(e=>c(`close`),[`esc`])},[b(`form`,{class:`sheet sheet-small`,role:`dialog`,"aria-modal":`true`,"aria-label":`Rename thread`,onSubmit:_(d,[`prevent`])},[b(`header`,J,[r[6]||=b(`h2`,null,`Rename thread`,-1),b(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,onClick:r[0]||=e=>c(`close`)},[t(G,{name:`close`,size:16})])]),b(`div`,ve,[b(`label`,ye,[r[7]||=b(`span`,null,`Name`,-1),a(b(`input`,{ref_key:`input`,ref:u,"onUpdate:modelValue":r[1]||=e=>l.value=e,maxlength:`200`,placeholder:n.thread.name},null,8,be),[[g,l.value]])]),b(`p`,xe,O(n.thread.project)+O(n.thread.branch?` · `+n.thread.branch:``),1)]),b(`footer`,Y,[n.thread.title?(i(),I(`button`,{key:0,type:`button`,class:`btn btn-ghost sheet-reset`,disabled:n.busy,onClick:r[2]||=e=>c(`save`,null)},` Reset to default `,8,Se)):P(``,!0),b(`button`,{type:`button`,class:`btn btn-ghost`,disabled:n.busy,onClick:r[3]||=e=>c(`close`)},`Cancel`,8,Ce),b(`button`,{class:`btn btn-primary`,disabled:n.busy||!l.value.trim()},`Save`,8,we)])],32)],32))}}),Ee=`litepaseo-composer-v1:`,De=Ee+`draft:`,Oe=Ee+`message:`,ke=class{warning=e(``);revision=e(0);generation=0;drafts=l(new Map);pending=l(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`${De}${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(Ee)&&t.push([r,e.getItem(r)])}return t},[]),n=[];for(let[r,i]of t){let t=r.startsWith(De)?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(De)){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(Oe)){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(Ee)&&(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(`${De}${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(Oe+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(Oe+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(Ee)&&t.push(r)}for(let n of t)e.removeItem(n);return!0},!1),this.drafts.clear(),this.pending.clear(),this.revision.value++}},Ae=3e3,je=2500,Me=class{rows=[];epoch=``;hasOlder=!1;startCursor=null;ready=!1;membership=v(0);apply(e){let t=!1;for(let n of e)if(n.type===`reset`)this.rows=n.rows.map(e=>({seqStart:e.seqStart,row:v(e)})),this.epoch=n.epoch,this.hasOlder=n.hasOlder,this.startCursor=n.startCursor,this.ready=!0,t=!0;else if(n.type===`upsert`){let e=this.find(n.row.seqStart);e>=0?this.rows[e].row.value=n.row:(this.insert({seqStart:n.row.seqStart,row:v(n.row)}),t=!0)}else if(n.type===`append`){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>Ae&&(this.rows=this.rows.slice(this.rows.length-je),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)}},Ne=100;function Pe(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,Ne)).map(e=>({seqStart:e.seqStart,row:v(e)})),s=r?[...o,...e]:[...e,...o];return{rows:r?s.slice(0,150):s.slice(-150),hasOlder:!r||t.hasOlder||a.length>Ne,added:o.length}}var Fe=1e3,Ie=3e4;function Le(e){let t=!1,n=null,r,i=Fe,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`);a(`live`);let r=n.body.pipeThrough(new TextDecoderStream).getReader(),o=``;for(;;){let{value:t,done:n}=await r.read();if(n)break;o+=t;let a;for(;(a=o.indexOf(`
3
+
4
+ `))>=0;){let t=o.slice(0,a);o=o.slice(a+2);let n=``;for(let e of t.split(`
5
+ `))e.startsWith(`data: `)&&(n+=(n?`
6
+ `:``)+e.slice(6));n&&(i=Fe,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,Ie)},s=()=>{document.hidden?(n?.abort(),clearTimeout(r),a(`paused`)):(i=Fe,o())};return document.addEventListener(`visibilitychange`,s),o(),{close(){t=!0,clearTimeout(r),document.removeEventListener(`visibilitychange`,s),n?.abort()}}}var Re=Symbol(`litepaseo-timeline`),X=e=>typeof e==`string`&&e.length>0?e:void 0;function ze(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 Be=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 Ve(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 Z=[[/^(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`]],He=e=>{let t=Ve(e);return Z.find(([e])=>e.test(t))?.[1]??`terminal`};function Ue(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 We=e=>{let t=typeof e==`string`?e:``;return t?t.split(`
7
+ `).length-+!!t.endsWith(`
8
+ `):0},Ge=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function Ke(e){if(!e)return``;let t=0,n=0;for(let r of e.split(`
9
+ `))r.startsWith(`+`)&&!r.startsWith(`+++`)?t++:r.startsWith(`-`)&&!r.startsWith(`---`)&&n++;return t||n?`+${t} −${n}`:``}function qe(e,t){let n=e.detail??{},r=n.type===`unknown`&&n.input&&typeof n.input==`object`?n.input:{},i=e=>ze(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`,He(e),`Run`,Ue(e.split(`
10
+ `)[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,Ke(Xe(e)));case`write`:return o(`write`,`edit`,`Write`,i(n.filePath),!1,n.content?Ge(We(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`,X(n.subAgentType)??`Task`,X(n.description)??``,!0);case`worktree_setup`:return o(`worktree`,`branch`,`Worktree setup`,String(n.branchName??``),!0);case`plain_text`:return o(`plain`,`tool`,Be(a),X(n.label)??``,!0);case`plan`:return o(`plan`,`list`,`Plan`,``,!0)}let c=a.toLowerCase(),l=X(r.path)??X(r.file_path)??X(r.filePath),u=X(r.command)??X(r.cmd)??l??X(r.pattern)??X(r.query)??X(r.url)??X(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,Ke(Xe(e))):/^write/.test(c)?o(`write`,`edit`,`Write`,i(u),!1,r.content?Ge(We(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`,Be(a),u,!0)}function Je(e){return(e.split(`
11
+ `).map(e=>e.trim()).find(Boolean)??``).replace(/^#+\s*/,``).replace(/\*\*|__|`/g,``).slice(0,300)}function Ye(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(`
12
+ `));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(`
13
+ `):e==null?``:JSON.stringify(e,null,2)}return``}function Xe(e){let t=e.detail??{},n=(e,t)=>String(e??``).split(`
14
+ `).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 X(t.unifiedDiff)?t.unifiedDiff:t.oldString===void 0&&t.newString===void 0?``:r(t.oldString,t.newString).join(`
15
+ `);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(`
16
+ `)}function Ze(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 Qe=e=>e.toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`}),$e=e=>Math.floor((e.getTime()-e.getTimezoneOffset()*6e4)/864e5);function et(e,t=new Date){let n=Qe(e),r=$e(t)-$e(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 tt(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 nt(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:et(new Date(t),n),took:Number.isFinite(a)&&t>=a?Ze(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 rt=/!\[([^\]\n]*)\]\(\s*<?([^)\s>]+)>?(\s+"[^"]*")?\s*\)/g,it=/\.(png|jpe?g|webp|gif|bmp|avif)$/i;function at(e,t){return e.includes(`![`)?e.replace(rt,(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 it.test(a)?`![${n}](${t}/image?path=${encodeURIComponent(a)}${i})`:e}):e}var ot=[`aria-expanded`,`onClick`],st=[`src`,`onError`],ct={class:`group-name`},lt=[`title`],ut=[`title`],dt={key:0,class:`group-flag is-attention`},ft={key:1,class:`status-dot is-error`},pt={key:2,class:`status-dot is-running`},mt={key:3,class:`status-dot is-unread`},ht={key:1,class:`group-count`},gt=[`aria-label`,`title`,`onClick`],Q=[`onClick`,`onContextmenu`,`onPointerdown`,`onMouseenter`],_t={class:`session-dot`},vt={class:`session-title`},yt={key:0,class:`session-project`},bt={key:1,class:`pill pill-attention`},xt={key:2,class:`session-age`},St=[`aria-label`,`onClick`],Ct={class:`thread-card-title`},wt={key:0,class:`thread-card-off`},Tt={key:0},Et={key:0,class:`list-empty`},Dt=320,Ot=500,kt=d({__name:`SessionList`,props:{store:{},mode:{},hostLabels:{},hostStates:{},selectedKey:{},searching:{type:Boolean}},emits:[`select`,`new`,`menu`],setup(n,{emit:r}){let a=n,o=r,l=e(null),d=e(0),f=e(600),m=0,g,v=x(()=>(a.store.version.value,a.store.size)),S=x(()=>(a.store.version.value,a.mode===`projects`?a.store.groupedHeight:a.store.size*ae)),C=x(()=>{a.store.version.value;let e=Math.max(0,d.value-Dt),t=f.value+Dt*2;if(a.mode===`projects`)return a.store.groupedRows(e,t);let n=Math.floor(e/ae);return a.store.range(n,Math.ceil(t/ae)+1).map((e,t)=>({kind:`item`,key:e.key,top:(n+t)*ae,item:e}))}),w=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(` · `),D=e=>e.attention?`is-attention`:e.state===`failed`?`is-error`:e.state===`running`?`is-running`:e.unread||e.state===`unread`?`is-unread`:``,k=e(Date.now()),A,M=e=>{let t=[...e.hosts.keys()];return t.length===1?a.hostLabels.get(t[0])??`Unknown host`:`${t.length} hosts`},N=e=>[...e.hosts.keys()].map(e=>a.hostLabels.get(e)??`Unknown host`).join(`, `),F=e(new Set),ee=e=>{let t=e.items.at(0);if(!t?.rootPath)return null;let n=`/api/hosts/${encodeURIComponent(t.hostId)}/project-icon?cwd=${encodeURIComponent(t.rootPath)}`;return F.value.has(n)?null:n},R=e=>{e&&!F.value.has(e)&&(F.value=new Set(F.value).add(e))},z=[`#4f7cc2`,`#5a9e6f`,`#c27a4f`,`#9a6fc2`,`#c25a7a`,`#4fa7b0`,`#b09a3f`],te=e=>{let t=0;for(let n=0;n<e.length;n++)t=t*31+e.charCodeAt(n)>>>0;return z[t%z.length]},B=e=>(Array.from(e.trim())[0]??`?`).toUpperCase(),V=matchMedia(`(hover: hover) and (pointer: fine)`).matches,H=e(null),ne,re=e=>e.replace(/^\/(home|Users)\/[^/]+(?=\/|$)/,`~`);function U(e,t){if(!V)return;clearTimeout(ne);let n=e.currentTarget.getBoundingClientRect();ne=setTimeout(()=>{H.value={thread:t,top:Math.max(8,Math.min(n.top-4,window.innerHeight-170)),left:n.right+10}},H.value?120:550)}function ie(){clearTimeout(ne),ne=setTimeout(()=>H.value=null,80)}let oe,W=!1;function se(e,t){if(e.pointerType===`mouse`)return;W=!1,clearTimeout(oe);let{clientX:n,clientY:r}=e;oe=setTimeout(()=>{W=!0,navigator.vibrate?.(10),o(`menu`,t,n,r)},Ot)}function le(){clearTimeout(oe)}function ue(e){clearTimeout(ne),H.value=null,W?W=!1:o(`select`,e.key)}function de(e,t){let n=e.currentTarget.getBoundingClientRect();o(`menu`,t,n.left,n.bottom+4)}function fe(){le(),H.value&&ie(),m||=requestAnimationFrame(()=>{m=0,l.value&&(d.value=l.value.scrollTop)})}return s(()=>{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)}),c(()=>{g?.disconnect(),cancelAnimationFrame(m),clearTimeout(oe),clearTimeout(ne),clearInterval(A)}),(e,r)=>(i(),I(`div`,{ref_key:`element`,ref:l,class:`session-list`,style:h({"--row-h":E(ae)+`px`}),onScrollPassive:fe},[b(`div`,{class:`session-spacer`,style:h({height:S.value+`px`})},[(i(!0),I(y,null,L(C.value,e=>(i(),I(y,{key:e.key},[e.kind===`group`?(i(),I(`div`,{key:0,class:j([`group-row`,{collapsed:e.collapsed}]),style:h({transform:`translateY(${e.top}px)`,height:E(36)-4+`px`})},[b(`button`,{class:`group-toggle`,"aria-expanded":!e.collapsed,onClick:t=>n.store.toggleGroup(e.group.key)},[b(`span`,{class:`group-icon`,style:h(ee(e.group)?void 0:{background:te(e.group.name)})},[ee(e.group)?(i(),I(`img`,{key:0,src:ee(e.group),alt:``,loading:`lazy`,onError:t=>R(ee(e.group))},null,40,st)):(i(),I(y,{key:1},[u(O(B(e.group.name)),1)],64))],4),b(`span`,ct,O(e.group.name),1),b(`span`,{class:`group-host`,title:N(e.group)},O(M(e.group)),9,lt),E(ce)(e.group)===`done`?P(``,!0):(i(),I(`span`,{key:0,class:`group-marks`,title:w(e.group)},[e.group.attention?(i(),I(`span`,dt,O(e.group.attention),1)):P(``,!0),e.group.failed?(i(),I(`span`,ft)):P(``,!0),e.group.running?(i(),I(`span`,pt)):P(``,!0),e.group.unread?(i(),I(`span`,mt)):P(``,!0)],8,ut)),e.collapsed?(i(),I(`span`,ht,O(e.group.items.size),1)):P(``,!0),t(G,{name:`chevron`,size:12,class:`group-chevron`})],8,ot),b(`button`,{class:`group-add`,"aria-label":`New session in `+e.group.name+` on `+M(e.group),title:`New session in `+e.group.name+` on `+M(e.group),onClick:t=>o(`new`,e.group)},[t(G,{name:`plus`,size:14})],8,gt)],6)):(i(),I(`div`,{key:1,class:j([`session-row`,{chosen:n.selectedKey===e.item.key}]),style:h({transform:`translateY(${e.top}px)`})},[b(`button`,{class:j([`session`,{unread:e.item.unread,chosen:n.selectedKey===e.item.key,offline:n.hostStates.get(e.item.hostId)!==`connected`,nested:n.mode===`projects`}]),onClick:t=>ue(e.item),onContextmenu:_(t=>o(`menu`,e.item,t.clientX,t.clientY),[`prevent`]),onPointerdown:t=>se(t,e.item),onPointerup:le,onPointercancel:le,onPointerleave:le,onMouseenter:t=>U(t,e.item),onMouseleave:ie},[b(`span`,_t,[D(e.item)?(i(),I(`span`,{key:0,class:j([`status-dot`,D(e.item)])},null,2)):P(``,!0)]),b(`span`,vt,[e.item.pinnedAt?(i(),p(G,{key:0,name:`pin`,size:11,class:`pin-mark`})):P(``,!0),u(O(e.item.name),1)]),n.mode===`recent`?(i(),I(`span`,yt,O(e.item.project),1)):P(``,!0),e.item.attention?(i(),I(`span`,bt,`Needs you`)):(i(),I(`span`,xt,O(E(tt)(e.item.activityAt,k.value)),1))],42,Q),b(`button`,{class:`row-more`,"aria-label":`Actions for `+e.item.name,title:`Rename, pin, mark unread, archive`,onClick:_(t=>de(t,e.item),[`stop`])},[t(G,{name:`more`,size:16})],8,St)],6))],64))),128))],4),(i(),p(T,{to:`body`},[H.value?(i(),I(`div`,{key:0,class:`thread-card`,style:h({top:H.value.top+`px`,left:H.value.left+`px`}),role:`tooltip`},[b(`p`,Ct,O(H.value.thread.name),1),b(`p`,null,[t(G,{name:`server`,size:14}),u(O(n.hostLabels.get(H.value.thread.hostId)??`Unknown host`)+` `,1),n.hostStates.get(H.value.thread.hostId)===`connected`?P(``,!0):(i(),I(`span`,wt,`offline`))]),H.value.thread.branch?(i(),I(`p`,Tt,[t(G,{name:`branch`,size:14}),u(O(H.value.thread.branch),1)])):P(``,!0),b(`p`,null,[t(G,{name:`folder`,size:14}),u(O(re(H.value.thread.directory||H.value.thread.rootPath)),1)])],4)):P(``,!0)])),v.value?P(``,!0):(i(),I(`div`,Et,O(n.searching?`No threads match.`:`No threads yet. Add a host to get started.`),1))],36))}}),At={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},jt=e=>e.replace(/[&<>"']/g,e=>At[e]);function Mt(e){let t=e.trim();return/^(https?:|mailto:)/i.test(t)?t:null}function Nt(e){let t=e.split(/(`+)([\s\S]*?[^`])\1(?!`)/),n=``;for(let e=0;e<t.length;e++){if(e%3==2){n+=`<code>${jt(t[e].replace(/^ (.*) $/,`$1`))}</code>`;continue}if(e%3==1)continue;let r=jt(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]+)\)/g,(e,t,n)=>{let r=Mt(n.replace(/&amp;/g,`&`));return r?`<a href="${jt(r)}" 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 Pt=e=>/^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(e)&&e.includes(`|`),Ft=e=>e.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`).map(e=>Nt(e.trim()));function It(e){let t=e.replace(/\r\n?/g,`
17
+ `).split(`
18
+ `),n=[],r=[],i=()=>{r.length&&n.push(`<p>${r.map(Nt).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">${jt(o[3])}</span>`:``;n.push(`<pre class="code">${s}<code>${jt(a.join(`
19
+ `))}</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}>${Nt(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>${It(r.join(`
20
+ `))}</blockquote>`);continue}if(a.includes(`|`)&&e+1<t.length&&Pt(t[e+1])){i();let r=Ft(a),o=[];for(e+=2;e<t.length&&t[e].includes(`|`)&&t[e].trim();e++)o.push(Ft(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>${Nt(e[2])}</li>`:`<li${t}>${Nt(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>$/,` ${Nt(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 Lt=`modulepreload`,Rt=function(e){return`/`+e},zt={},Bt=function(e){return e.pathname.endsWith(`.css`)},Vt=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},Ht=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=Rt(t,n);let r=s(t),i=Bt(r);return Vt(zt,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`:Lt,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)})},Ut=v(null),Wt=null;function Gt(){return Wt??=Ht(()=>import(`./MarkdownMessage-C30PkBRA.js`).then(e=>{Ut.value=f(e.default)}),__vite__mapDeps([0,1,2])).catch(()=>{Wt=null}),Wt}function Kt(){let e=window.requestIdleCallback;e?e(()=>void Gt(),{timeout:3e3}):setTimeout(()=>void Gt(),1500)}var qt=Symbol(`litepaseo-suggestions`),Jt={key:0,class:`row row-plugin row-speed`,title:`Turn speed (turn-speed plugin)`},Yt={class:`suggestion-actions`},Xt={key:2,class:`suggestion-wait`},Zt={class:`line-icon`},Qt={class:`line-name`},$t={class:`line-text`},$={key:0,class:`tool-body`},en={class:`tool-pre`},tn=d({__name:`PluginRow`,props:{item:{},seqStart:{}},setup(r){let a=r,o=C(qt,null),c=x(()=>`${a.item.pluginId}/${a.item.kind}`),l=x(()=>a.item.data??{}),u=x(()=>{let e=l.value;if(c.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`}`}),d=x(()=>c.value===`next-input/next-input`&&typeof l.value.token==`string`),f=e(`idle`),p=e(``),m=x(()=>/[`$|<>]|(^|\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(p.value));async function h(){if(o&&d.value){if(l.value.status===`ready`&&l.value.text)f.value=`ready`,p.value=l.value.text;else{f.value=`loading`;try{let e=await o.predict(l.value.token);e.status===`ready`&&e.text?(f.value=`ready`,p.value=e.text):f.value=e.status===`error`?`error`:`hidden`}catch{f.value=`error`}}f.value===`ready`&&o.offer(a.seqStart,p.value)}}s(()=>void h()),n(()=>l.value.token,()=>void h());let g=e(!1),_=x(()=>g.value?JSON.stringify(a.item.data??a.item,null,2):``);return(e,n)=>u.value?(i(),I(`div`,Jt,[t(G,{name:`bolt`,size:12}),b(`span`,null,O(u.value),1)])):d.value?(i(),I(`div`,{key:1,class:j([`row row-suggestion`,`is-`+f.value])},[f.value===`loading`?(i(),I(y,{key:0},[n[4]||=b(`span`,{class:`spinner spinner-sm`},null,-1),n[5]||=b(`span`,{class:`suggestion-wait`},`Thinking of a next message…`,-1)],64)):f.value===`ready`?(i(),I(y,{key:1},[b(`button`,{class:`suggestion-text`,title:`Put in the message box to edit`,onClick:n[0]||=e=>E(o)?.use(p.value)},O(p.value),1),b(`span`,Yt,[b(`button`,{class:`icon-btn`,title:`Edit in the message box`,"aria-label":`Edit suggestion`,onClick:n[1]||=e=>E(o)?.use(p.value)},[t(G,{name:`edit`,size:14})]),m.value?P(``,!0):(i(),I(`button`,{key:0,class:`icon-btn`,title:`Send this message`,"aria-label":`Send suggestion`,onClick:n[2]||=e=>E(o)?.send(p.value)},[t(G,{name:`send`,size:14})]))])],64)):f.value===`error`?(i(),I(`span`,Xt,`Suggestion unavailable`)):P(``,!0)],2)):(i(),I(`details`,{key:2,class:`row row-line row-tool row-plugin`,onToggle:n[3]||=e=>g.value=e.target.open},[b(`summary`,null,[b(`span`,Zt,[t(G,{name:`sparkle`,size:15})]),b(`span`,Qt,O(r.item.pluginId),1),b(`span`,$t,O(r.item.kind),1)]),g.value?(i(),I(`div`,$,[b(`pre`,en,O(_.value),1)])):P(``,!0)],32))}}),nn={key:0,class:`row row-user`},rn={class:`bubble`},an={key:1,class:`row row-assistant`},on=[`innerHTML`],sn=[`tabindex`],cn={class:`line-icon`},ln={class:`line-text`},un={key:0,class:`reasoning-text`},dn=[`title`],fn={class:`line-icon`},pn={key:0,class:`status-dot is-running`},mn={key:0,class:`line-name`},hn={key:1,class:`line-meta`},gn={key:2,class:`line-meta`},_n={key:0,class:`tool-body`},vn={key:0,class:`tool-pre tool-command`},yn={key:1,class:`tool-pre tool-diff`},bn={key:0,class:`diff-hunk`},xn={key:2,class:`tool-pre`},Sn={key:3,class:`tool-pre tool-output`},Cn={key:4,class:`tool-pre tool-error`},wn={key:5,class:`tool-exit`},Tn={key:6,class:`tool-exit`},En={key:4,class:`row row-todo`},Dn={class:`todo-title`},On={key:5,class:`row row-callout is-error`},kn={key:7,class:`row row-divider`},An={class:`line-icon`},jn={class:`line-name`},Mn={key:0,class:`tool-body`},Nn={class:`tool-pre`},Pn=2e4,Fn=600,In=d({__name:`TimelineRowView`,props:{entry:{},final:{type:Boolean}},setup(n){let a=n,o=C(Re,null),s=x(()=>a.entry.value),c=x(()=>s.value.item),l=e(!1),d=x(()=>{let e=String(c.value.text??``);return o?.value?at(e,o.value.base):e}),f=x(()=>!Ut.value&&c.value.type===`assistant_message`?It(d.value):``);!Ut.value&&c.value.type===`assistant_message`&&Gt();let m=x(()=>{let e=c.value;if(e.type!==`tool_call`)return null;let t=qe(e,o?.value.cwd);return{...t,summary:t.summary.split(`
21
+ `)[0],status:String(e.status??`running`)}}),h=x(()=>c.value.type===`reasoning`?Je(String(c.value.text??``)):``),g=x(()=>String(c.value.text??``).trim().length>h.value.length+4),_=e=>e.length>Pn?e.slice(0,Pn)+`
22
+ … (truncated)`:e,v=x(()=>{if(!l.value||!m.value)return null;let e=c.value,t=e.detail??{},n=Xe(e),r=n?n.split(`
23
+ `):[],i=_(Ye(e)),a=t.type===`unknown`&&t.input!==void 0?_(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,Fn).map(e=>({text:e,kind:e.startsWith(`@@`)?`hunk`:e.startsWith(`+`)&&!e.startsWith(`+++`)?`add`:e.startsWith(`-`)&&!e.startsWith(`---`)?`del`:``})),diffMore:Math.max(0,r.length-Fn),input:m.value.kind===`shell`?``:a,output:i,error:e.error?_(typeof e.error==`string`?e.error:JSON.stringify(e.error,null,2)):``}}),S=x(()=>c.value.type===`todo`?c.value.items:[]),w=x(()=>l.value?_(JSON.stringify(c.value,null,2)):``),T=x(()=>String(c.value.type).replaceAll(`_`,` `)),D=e=>l.value=e.target.open;return(e,a)=>c.value.type===`user_message`?(i(),I(`div`,nn,[b(`div`,rn,O(c.value.text),1)])):c.value.type===`assistant_message`?(i(),I(`div`,an,[E(Ut)?(i(),p(r(E(Ut)),{key:0,content:d.value,final:n.final},null,8,[`content`,`final`])):(i(),I(`div`,{key:1,class:`prose`,innerHTML:f.value},null,8,on))])):c.value.type===`reasoning`?(i(),I(`details`,{key:2,class:j([`row row-line row-reasoning`,{"is-static":!g.value}]),onToggle:D},[b(`summary`,{tabindex:g.value?void 0:-1,onClick:a[0]||=e=>!g.value&&e.preventDefault()},[b(`span`,cn,[t(G,{name:`bulb`,size:15})]),b(`span`,ln,O(h.value||`Thinking`),1)],8,sn),l.value?(i(),I(`div`,un,O(c.value.text),1)):P(``,!0)],34)):m.value?(i(),I(`details`,{key:3,class:j([`row row-line row-tool`,[`is-`+m.value.status,`kind-`+m.value.kind]]),onToggle:D},[b(`summary`,{title:m.value.name+(m.value.status===`failed`?` · failed`:m.value.status===`canceled`?` · canceled`:``)},[b(`span`,fn,[m.value.status===`running`?(i(),I(`span`,pn)):(i(),p(G,{key:1,name:m.value.status===`failed`?`close`:m.value.icon,size:15},null,8,[`name`]))]),m.value.showName||!m.value.summary?(i(),I(`span`,mn,O(m.value.name),1)):P(``,!0),b(`span`,{class:j([`line-text`,{mono:m.value.kind!==`sub_agent`&&m.value.kind!==`plain`&&m.value.kind!==`unknown`}])},O(m.value.summary),3),m.value.meta?(i(),I(`span`,hn,O(m.value.meta),1)):m.value.status===`canceled`?(i(),I(`span`,gn,`canceled`)):P(``,!0)],8,dn),v.value?(i(),I(`div`,_n,[v.value.command?(i(),I(`pre`,vn,[a[1]||=b(`span`,{class:`tool-prompt`},`$`,-1),u(` `+O(v.value.command),1)])):P(``,!0),v.value.diff.length?(i(),I(`pre`,yn,[(i(!0),I(y,null,L(v.value.diff,(e,t)=>(i(),I(`span`,{key:t,class:j(e.kind&&`diff-`+e.kind)},O(e.text)+`
24
+ `,3))),128)),v.value.diffMore?(i(),I(`span`,bn,`… `+O(v.value.diffMore)+` more lines`,1)):P(``,!0)])):P(``,!0),v.value.input?(i(),I(`pre`,xn,O(v.value.input),1)):P(``,!0),v.value.output?(i(),I(`pre`,Sn,O(v.value.output),1)):P(``,!0),v.value.error?(i(),I(`pre`,Cn,O(v.value.error),1)):P(``,!0),v.value.exitCode!==null&&v.value.exitCode!==0&&!v.value.error?(i(),I(`p`,wn,`exit `+O(v.value.exitCode),1)):P(``,!0),!v.value.command&&!v.value.diff.length&&!v.value.input&&!v.value.output&&!v.value.error?(i(),I(`p`,Tn,`No output`)):P(``,!0)])):P(``,!0)],34)):c.value.type===`todo`?(i(),I(`div`,En,[b(`div`,Dn,[t(G,{name:`list`,size:14}),a[2]||=u(` Plan`,-1)]),b(`ul`,null,[(i(!0),I(y,null,L(S.value,(e,t)=>(i(),I(`li`,{key:e.id??t,class:j({done:e.completed,active:e.status===`in_progress`})},[b(`span`,{class:j([`check`,{done:e.completed}])},null,2),u(O(e.text),1)],2))),128))])])):c.value.type===`error`?(i(),I(`div`,On,[t(G,{name:`alert`,size:15}),a[3]||=u(),b(`span`,null,O(c.value.message),1)])):c.value.type===`notification`?(i(),I(`div`,{key:6,class:j([`row row-callout`,`is-`+c.value.level])},[t(G,{name:`alert`,size:15}),a[4]||=u(),b(`span`,null,O(c.value.message),1)],2)):c.value.type===`compaction`?(i(),I(`div`,kn,[b(`span`,null,O(c.value.status===`loading`?`Compacting context…`:`Context compacted`),1)])):c.value.type===`plugin`?(i(),p(tn,{key:8,item:c.value,"seq-start":s.value.seqStart},null,8,[`item`,`seq-start`])):(i(),I(`details`,{key:9,class:`row row-line row-tool`,onToggle:D},[b(`summary`,null,[b(`span`,An,[t(G,{name:`tool`,size:15})]),b(`span`,jn,O(T.value),1)]),l.value?(i(),I(`div`,Mn,[b(`pre`,Nn,O(w.value),1)])):P(``,!0)],32))}}),Ln={class:`sheet-head`},Rn=[`disabled`],zn={class:`sheet-body`},Bn={key:0,class:`sheet-note`},Vn={class:`field-grid`},Hn={class:`field`},Un=[`disabled`],Wn=[`value`],Gn={class:`field`},Kn=[`disabled`],qn={key:0,value:``},Jn=[`value`],Yn={key:0,class:`field`},Xn=[`title`],Zn={class:`field`},Qn=[`placeholder`,`disabled`],$n={class:`field-grid three`},er={class:`field field-agent`},tr=[`disabled`],nr={key:0,value:``},rr=[`value`,`disabled`],ir={class:`field field-model`},ar=[`disabled`],or={key:0,value:``},sr=[`value`],cr={class:`field field-thinking`},lr=[`disabled`],ur={key:0,value:``},dr=[`value`],fr={key:2,class:`field`},pr=[`disabled`],mr=[`value`],hr={class:`toggle`},gr=[`disabled`],_r={key:3,class:`field`},vr={key:4,class:`sheet-error`},yr={key:5,class:`sheet-error`},br={key:6,class:`sheet-error`,role:`alert`},xr={class:`sheet-foot`},Sr=[`disabled`],Cr=[`disabled`],wr={key:0,class:`spinner spinner-on-accent`},Tr=`\0custom`,Er=`litepaseo-new-session`,Dr=d({__name:`NewSession`,props:{hosts:{},initialHostId:{},initialCwd:{},initialProject:{},request:{type:Function}},emits:[`close`,`created`],setup(r,{emit:o}){let l=r,d=o,f=(()=>{try{return JSON.parse(localStorage.getItem(Er)??`{}`)}catch{return{}}})(),p=x(()=>l.hosts.filter(e=>e.state===`connected`)),h=e(p.value.find(e=>e.id===l.initialHostId)?.id??p.value[0]?.id??``),v=e(null),C=e(null),w=e(``),T=e(``),E=e(``),D=e(``),k=e(``),A=e(``),j=e(``),N=e(!1),F=e(``),ee=e(``),R=e(!1),z=e(``),te=e(null),B=crypto.randomUUID(),V=x(()=>v.value?.find(e=>e.id===D.value)),H=x(()=>V.value?.models??[]),ne=x(()=>H.value.find(e=>e.id===k.value)),re=x(()=>T.value===Tr?E.value.trim():T.value),U=x(()=>C.value?.find(e=>e.rootPath===T.value)?.name??re.value.split(`/`).pop()??``),ie=x(()=>!!h.value&&!!re.value&&!!D.value&&!R.value&&(!N.value||!!F.value.trim()));async function ae(e){if(v.value=C.value=null,w.value=``,e)try{let[t,n]=await Promise.all([l.request(`/hosts/${encodeURIComponent(e)}/providers`),l.request(`/hosts/${encodeURIComponent(e)}/projects`)]);if(e!==h.value)return;v.value=t,C.value=n.sort((e,t)=>e.name.localeCompare(t.name)),oe();let r=C.value,i=e===l.initialHostId?l.initialProject:null,a=i?r.find(e=>i.key&&e.key===i.key)??r.find(e=>e.name.toLowerCase()===i.name.toLowerCase()):void 0;if(a)T.value=a.rootPath;else if(e===l.initialHostId&&l.initialCwd){let e=r.find(e=>e.rootPath===l.initialCwd);e?T.value=e.rootPath:(T.value=Tr,E.value=l.initialCwd)}else T.value||=r[0]?.rootPath??Tr}catch(t){e===h.value&&(w.value=t.message)}}function oe(){let e=f[h.value]??{},t=v.value??[],n=t.find(t=>t.id===e.provider&&t.status!==`error`)??t.find(e=>e.status===`ready`)??t[0];D.value=n?.id??``,W(e.model,e.thinking),j.value=n?.modes.some(t=>t.id===e.mode)?e.mode:n?.defaultModeId??``}function W(e,t){let n=H.value,r=n.find(t=>t.id===e)??n.find(e=>e.isDefault)??n[0];k.value=r?.id??``,A.value=r?.thinking.some(e=>e.id===t)?t:r?.defaultThinkingId??``}n(h,e=>{T.value=``,ae(e)}),n(D,()=>{let e=f[h.value];W(e?.provider===D.value?e.model:void 0);let t=V.value;t&&!t.modes.some(e=>e.id===j.value)&&(j.value=t.defaultModeId??``)}),n(k,()=>{let e=ne.value;e&&!e.thinking.some(e=>e.id===A.value)&&(A.value=e.defaultThinkingId??``)}),n([h,T,E,D,k,A,j,N,F,ee],()=>{z.value&&(B=crypto.randomUUID()),z.value=``});async function se(){if(ie.value){R.value=!0,z.value=``;try{let e=await l.request(`/hosts/${encodeURIComponent(h.value)}/agents`,`POST`,{idempotencyKey:B,cwd:re.value,provider:D.value,...k.value?{model:k.value}:{},...j.value?{modeId:j.value}:{},...A.value?{thinkingOptionId:A.value}:{},...ee.value.trim()?{prompt:ee.value}:{},...N.value?{worktreeBranch:F.value.trim()}:{}},12e4);f[h.value]={provider:D.value,model:k.value,thinking:A.value,mode:j.value},localStorage.setItem(Er,JSON.stringify(f)),d(`created`,e.key)}catch(e){z.value=e.message}finally{R.value=!1}}}function ce(e){e.key===`Escape`&&!R.value&&d(`close`),e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),se())}return s(()=>{window.addEventListener(`keydown`,ce),ae(h.value),S(()=>te.value?.focus())}),c(()=>window.removeEventListener(`keydown`,ce)),(e,n)=>(i(),I(`div`,{class:`overlay`,onMousedown:n[12]||=_(e=>!R.value&&d(`close`),[`self`])},[b(`form`,{class:`sheet`,role:`dialog`,"aria-modal":`true`,"aria-label":`New session`,onSubmit:_(se,[`prevent`])},[b(`header`,Ln,[n[13]||=b(`h2`,null,`New session`,-1),b(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Close`,disabled:R.value,onClick:n[0]||=e=>d(`close`)},[t(G,{name:`close`,size:16})],8,Rn)]),b(`div`,zn,[p.value.length?(i(),I(y,{key:1},[b(`div`,Vn,[b(`label`,Hn,[n[14]||=b(`span`,null,`Host`,-1),a(b(`select`,{"onUpdate:modelValue":n[1]||=e=>h.value=e,disabled:R.value},[(i(!0),I(y,null,L(p.value,e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,Wn))),128))],8,Un),[[M,h.value]])]),b(`label`,Gn,[n[15]||=b(`span`,null,`Project`,-1),a(b(`select`,{"onUpdate:modelValue":n[2]||=e=>T.value=e,disabled:R.value||!C.value},[C.value?P(``,!0):(i(),I(`option`,qn,`Loading…`)),(i(!0),I(y,null,L(C.value??[],e=>(i(),I(`option`,{key:e.key,value:e.rootPath},O(e.name),9,Jn))),128)),b(`option`,{value:Tr},`Another folder…`)],8,Kn),[[M,T.value]])])]),T.value===Tr?(i(),I(`label`,Yn,[b(`span`,null,`Folder on `+O(p.value.find(e=>e.id===h.value)?.label),1),a(b(`input`,{"onUpdate:modelValue":n[3]||=e=>E.value=e,placeholder:`/home/me/code/project`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,E.value]])])):re.value?(i(),I(`p`,{key:1,class:`path-hint`,title:re.value},[t(G,{name:`folder`,size:13}),u(O(re.value),1)],8,Xn)):P(``,!0),b(`label`,Zn,[n[16]||=b(`span`,null,`First message`,-1),a(b(`textarea`,{ref_key:`promptElement`,ref:te,"onUpdate:modelValue":n[4]||=e=>ee.value=e,rows:`5`,placeholder:U.value?`What should the agent do in ${U.value}?`:`What should the agent do?`,disabled:R.value},null,8,Qn),[[g,ee.value]])]),b(`div`,$n,[b(`label`,er,[n[17]||=b(`span`,null,`Agent`,-1),a(b(`select`,{"onUpdate:modelValue":n[5]||=e=>D.value=e,disabled:R.value||!v.value},[v.value?P(``,!0):(i(),I(`option`,nr,`Loading…`)),(i(!0),I(y,null,L(v.value??[],e=>(i(),I(`option`,{key:e.id,value:e.id,disabled:e.status===`error`},O(e.label)+O(e.status===`loading`?` (starting)`:e.status===`error`?` (error)`:``),9,rr))),128))],8,tr),[[M,D.value]])]),b(`label`,ir,[n[18]||=b(`span`,null,`Model`,-1),a(b(`select`,{"onUpdate:modelValue":n[6]||=e=>k.value=e,disabled:R.value||!H.value.length},[H.value.length?P(``,!0):(i(),I(`option`,or,`Default`)),(i(!0),I(y,null,L(H.value,e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,sr))),128))],8,ar),[[M,k.value]])]),b(`label`,cr,[n[19]||=b(`span`,null,`Thinking`,-1),a(b(`select`,{"onUpdate:modelValue":n[7]||=e=>A.value=e,disabled:R.value||!ne.value?.thinking.length},[ne.value?.thinking.length?P(``,!0):(i(),I(`option`,ur,`Default`)),(i(!0),I(y,null,L(ne.value?.thinking??[],e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,dr))),128))],8,lr),[[M,A.value]])])]),V.value?.modes.length?(i(),I(`label`,fr,[n[20]||=b(`span`,null,`Mode`,-1),a(b(`select`,{"onUpdate:modelValue":n[8]||=e=>j.value=e,disabled:R.value},[(i(!0),I(y,null,L(V.value.modes,e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,mr))),128))],8,pr),[[M,j.value]])])):P(``,!0),b(`label`,hr,[a(b(`input`,{"onUpdate:modelValue":n[9]||=e=>N.value=e,type:`checkbox`,disabled:R.value},null,8,gr),[[m,N.value]]),n[21]||=b(`span`,null,`Work in a new git worktree`,-1)]),N.value?(i(),I(`label`,_r,[n[22]||=b(`span`,null,`New branch`,-1),a(b(`input`,{"onUpdate:modelValue":n[10]||=e=>F.value=e,placeholder:`feature/my-change`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,F.value]])])):P(``,!0),w.value?(i(),I(`p`,vr,[t(G,{name:`alert`,size:14}),u(O(w.value),1)])):P(``,!0),V.value?.error?(i(),I(`p`,yr,[t(G,{name:`alert`,size:14}),u(O(V.value.error),1)])):P(``,!0),z.value?(i(),I(`p`,br,[t(G,{name:`alert`,size:14}),b(`span`,null,O(z.value),1)])):P(``,!0)],64)):(i(),I(`p`,Bn,`No connected hosts. Connect a host first.`))]),b(`footer`,xr,[n[23]||=b(`span`,{class:`sheet-hint hide-sm`},`Ctrl/⌘ + Enter to start`,-1),b(`button`,{type:`button`,class:`btn btn-ghost`,disabled:R.value,onClick:n[11]||=e=>d(`close`)},`Cancel`,8,Sr),b(`button`,{class:`btn btn-primary`,disabled:!ie.value},[R.value?(i(),I(`span`,wr)):P(``,!0),u(` `+O(R.value?`Starting…`:z.value?`Retry`:`Start session`),1)],8,Cr)])],32)],32))}}),Or={key:0,class:`attachment-tray`},kr=[`data-state`,`title`],Ar={class:`attachment-thumb`},jr=[`src`,`alt`],Mr={key:2,class:`spinner spinner-sm attachment-uploading`},Nr={class:`attachment-text`},Pr={class:`attachment-name`},Fr={class:`attachment-meta`},Ir=[`disabled`,`onClick`],Lr=[`aria-label`,`title`,`disabled`,`onClick`],Rr={key:0,class:`attachment-error`,role:`alert`},zr=[`disabled`],Br=d({__name:`AttachmentPanel`,props:{store:{},agentKey:{},base:{},busy:{type:Boolean}},setup(r,{expose:a}){let o=r,s=e(null),c=e(``),l=e(0),d=e(null),f=x(()=>o.store.get(o.agentKey));n([()=>o.base,l],async([e],t,n)=>{let r=new AbortController;n(()=>r.abort()),s.value=null,c.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||(s.value=n)}catch(e){r.signal.aborted||(c.value=e.message)}},{immediate:!0});let m=new Set([`image/png`,`image/jpeg`,`image/webp`]);function h(e){if(!m.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(!m.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 _(e){if(e?.length&&!o.busy){c.value=``;try{if(!s.value)throw Error(`Wait for attachment capabilities, then try again.`);let t=s.value.maxBytes,n=await Promise.all(Array.from(e).map(e=>g(h(e),t)));await o.store.add(o.agentKey,o.base,n,s.value)}catch(e){c.value=e.message}d.value&&(d.value.value=``)}}let v=x(()=>!!s.value&&(s.value.images||s.value.files)),S=x(()=>s.value?v.value?[`Attach files (up to 4 · 8 MiB each · 24 MiB total)`,s.value.note].filter(Boolean).join(`
25
+ `):`Attachments are unavailable for this agent`:c.value?`Attachments unavailable`:`Checking attachment support…`),C=()=>{v.value&&!o.busy&&d.value?.click()},w=e=>e<1048576?`${Math.ceil(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`;return a({addFiles:_,pick:C,available:v,hint:S}),(e,n)=>(i(),I(y,null,[b(`input`,{ref_key:`picker`,ref:d,type:`file`,multiple:``,hidden:``,"aria-label":`Choose attachments`,onChange:n[0]||=e=>_(d.value?.files)},null,544),f.value.length||c.value?(i(),I(`div`,Or,[(i(!0),I(y,null,L(f.value,e=>(i(),I(`div`,{key:e.localId,class:j([`attachment-item`,{"is-error":!!e.error}]),"data-state":e.uploading?`uploading`:e.error?`error`:`ready`,title:e.error||e.file.name},[b(`span`,Ar,[e.preview?(i(),I(`img`,{key:0,src:e.preview,alt:e.file.name},null,8,jr)):(i(),p(G,{key:1,name:`file`,size:16})),e.uploading?(i(),I(`span`,Mr)):P(``,!0)]),b(`span`,Nr,[b(`span`,Pr,O(e.file.name),1),b(`span`,Fr,O(e.error?`Upload failed`:e.uploading?`Uploading…`:w(e.file.size)),1)]),e.error?(i(),I(`button`,{key:0,type:`button`,class:`attachment-action`,"aria-label":`Retry upload`,title:`Retry upload`,disabled:r.busy,onClick:t=>r.store.upload(e)},[t(G,{name:`refresh`,size:13})],8,Ir)):P(``,!0),b(`button`,{type:`button`,class:`attachment-action`,"aria-label":e.uploading?`Cancel upload`:`Remove attachment`,title:e.uploading?`Cancel upload`:`Remove attachment`,disabled:r.busy,onClick:t=>r.store.remove(r.agentKey,e)},[t(G,{name:`close`,size:13})],8,Lr)],10,kr))),128)),c.value?(i(),I(`p`,Rr,[t(G,{name:`alert`,size:13}),u(O(c.value)+` `,1),s.value?P(``,!0):(i(),I(`button`,{key:0,type:`button`,class:`attachment-retry`,disabled:r.busy,onClick:n[1]||=e=>l.value++},`Retry`,8,zr))])):P(``,!0)])):P(``,!0)],64))}}),Vr=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n},Hr=Vr(Br,[[`__scopeId`,`data-v-78817268`]]),Ur=class{entries=l(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=l({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)}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 Wr(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 Gr(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 Kr={class:`permission-head`},qr={class:`permission-icon`},Jr={class:`grow`},Yr={class:`row-title`},Xr={class:`row-sub`},Zr={class:`permission-details`},Qr={key:0,class:`field`},$r=[`value`],ei=[`disabled`],ti=[`type`,`name`,`checked`,`onChange`],ni={key:0,class:`row-sub`},ri={key:0,class:`field`},ii=[`onUpdate:modelValue`,`type`,`aria-label`],ai={key:2,class:`field`},oi={key:3,role:`alert`},si={class:`permission-actions`},ci=[`disabled`],li=[`disabled`],ui=Vr(d({__name:`PermissionForm`,props:{permission:{},busy:{type:Boolean}},emits:[`respond`],setup(r,{emit:o}){let s=r,c=o,l=x(()=>Wr(s.permission)),d=e([]),f=e(``),p=e(``),m=e(``);n(()=>JSON.stringify(s.permission.input),()=>{d.value=(l.value??[]).map(()=>({selected:[],text:``})),f.value=``,m.value=``},{immediate:!0});function h(e,t,n){let r=d.value[e];n?r.selected=r.selected.includes(t)?r.selected.filter(e=>e!==t):[...r.selected,t]:(r.selected=[t],r.text=``)}function v(e){m.value=``;try{let t={behavior:e?`allow`:`deny`};if(p.value&&(t.selectedActionId=p.value),e&&s.permission.kind===`question`){if(l.value)t.updatedInput=Gr(l.value,d.value);else{let e=JSON.parse(f.value);if(!e||typeof e!=`object`||Array.isArray(e))throw Error(`Enter a JSON object for the answer.`);t.updatedInput=e}}c(`respond`,t)}catch(e){m.value=e instanceof SyntaxError?`Enter a valid JSON object for the answer.`:e.message}}return(e,n)=>(i(),I(`form`,{class:`permission`,onSubmit:n[3]||=_(e=>v(!0),[`prevent`])},[b(`div`,Kr,[b(`span`,qr,[t(G,{name:`shield`,size:16})]),b(`div`,Jr,[b(`div`,Yr,O(r.permission.title||r.permission.name),1),b(`div`,Xr,O(r.permission.kind===`question`?`Question`:`Permission request`)+` · `+O(r.permission.name),1)])]),b(`details`,Zr,[n[4]||=b(`summary`,null,`Request details`,-1),b(`pre`,null,O(JSON.stringify(r.permission.input,null,2)),1)]),r.permission.actions?.length?(i(),I(`label`,Qr,[n[6]||=b(`span`,null,`Action`,-1),a(b(`select`,{"onUpdate:modelValue":n[0]||=e=>p.value=e},[n[5]||=b(`option`,{value:``},`Default`,-1),(i(!0),I(y,null,L(r.permission.actions,e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label||e.id),9,$r))),128))],512),[[M,p.value]])])):P(``,!0),l.value?(i(!0),I(y,{key:1},L(l.value,(e,t)=>(i(),I(`fieldset`,{key:e.header,class:`question-field`,disabled:r.busy},[b(`legend`,null,O(e.header)+O(e.required?` *`:``)+`: `+O(e.question),1),(i(!0),I(y,null,L(e.options,n=>(i(),I(`label`,{key:n.label,class:`question-option`},[b(`input`,{type:e.multiple?`checkbox`:`radio`,name:r.permission.id+`:`+t,checked:d.value[t]?.selected.includes(n.label)&&(e.multiple||!d.value[t]?.text),onChange:r=>h(t,n.label,e.multiple)},null,40,ti),b(`span`,null,[u(O(n.label),1),n.description?(i(),I(`small`,ni,` — `+O(n.description),1)):P(``,!0)])]))),128)),e.other?(i(),I(`label`,ri,[b(`span`,null,O(e.options.length?`Other answer`:`Your answer`),1),a(b(`input`,{"onUpdate:modelValue":e=>d.value[t].text=e,type:e.secret?`password`:`text`,"aria-label":e.header+`: `+(e.options.length?`Other answer`:`Your answer`),autocomplete:`off`},null,8,ii),[[D,d.value[t].text]])])):P(``,!0)],8,ei))),128)):r.permission.kind===`question`?(i(),I(`label`,ai,[n[7]||=b(`span`,null,`This question format needs a JSON answer.`,-1),a(b(`textarea`,{"onUpdate:modelValue":n[1]||=e=>f.value=e,"aria-label":`Answer (JSON)`,rows:`3`,placeholder:`{"answers": {}}`},null,512),[[g,f.value]])])):P(``,!0),m.value?(i(),I(`p`,oi,O(m.value),1)):P(``,!0),b(`div`,si,[b(`button`,{type:`button`,class:`btn btn-outline`,disabled:r.busy,onClick:n[2]||=e=>v(!1)},`Deny`,8,ci),b(`button`,{class:`btn btn-primary`,disabled:r.busy},`Allow / submit`,8,li)])],32))}}),[[`__scopeId`,`data-v-f1db1c0a`]]),di=`litepaseo-theme`,fi=e((()=>{let e=localStorage.getItem(di);return e===`light`||e===`dark`?e:`system`})()),pi=matchMedia(`(prefers-color-scheme: dark)`),mi=e(pi.matches);pi.addEventListener(`change`,e=>{mi.value=e.matches});var hi=x(()=>fi.value===`dark`||fi.value===`system`&&mi.value);function gi(e=fi.value){fi.value=e,e===`system`?(delete document.documentElement.dataset.theme,localStorage.removeItem(di)):(document.documentElement.dataset.theme=e,localStorage.setItem(di,e))}var _i=[`system`,`light`,`dark`];function vi(){gi(_i[(_i.indexOf(fi.value)+1)%_i.length])}var yi=[{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`}}],bi=`litepaseo-palette`,xi=e((()=>{let e=localStorage.getItem(bi);return yi.some(t=>t.id===e)?e:`ocean`})()),Si=[];function Ci(){let e=document.documentElement.style;for(let t of Si)e.removeProperty(t);let t=yi.find(e=>e.id===xi.value)??yi[0],n=hi.value?t.dark:t.light;for(let[t,r]of Object.entries(n))e.setProperty(t,r);Si=Object.keys(n),document.documentElement.dataset.palette=t.id}function wi(e=xi.value){xi.value=e,localStorage.setItem(bi,e),Ci()}n(hi,Ci);var Ti=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Ei=()=>matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,Di=v(null),Oi=e(Ei());window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),Di.value=e}),window.addEventListener(`appinstalled`,()=>{Di.value=null,Oi.value=!0});async function ki(){let e=Di.value;if(!e)return!1;await e.prompt();let{outcome:t}=await e.userChoice;return Di.value=null,t===`accepted`}var Ai=null;function ji(){return`serviceWorker`in navigator?(Ai??=navigator.serviceWorker.register(`/sw.js`,{scope:`/`}).catch(()=>null),Ai):Promise.resolve(null)}function Mi(){return window.isSecureContext?`serviceWorker`in navigator&&`PushManager`in window&&`Notification`in window?`supported`:Ti&&!Ei()?`needs-install`:`unsupported`:`insecure`}async function Ni(){let e=await ji();return e?e.pushManager.getSubscription():null}function Pi(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 Fi(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 ji();if(!r)throw Error(`Service worker unavailable.`);let{publicKey:i}=await e(`/push/key`),a=await r.pushManager.getSubscription();return a||=await r.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Pi(i)}),await e(`/push/subscribe`,`POST`,{subscription:a.toJSON(),prefs:t}),a}async function Ii(e,t,n){await e(`/push/subscribe`,`POST`,{subscription:t.toJSON(),prefs:n})}async function Li(e){let t=await Ni();t&&(await e(`/push/unsubscribe`,`POST`,{endpoint:t.endpoint}).catch(()=>{}),await t.unsubscribe().catch(()=>{}))}function Ri(e){let t=navigator;t.setAppBadge&&(e>0?t.setAppBadge(e):t.clearAppBadge?.())?.catch(()=>{})}function zi(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 Bi={class:`page`},Vi={class:`page-head`},Hi={class:`page-body`},Ui={class:`card`},Wi={class:`card-row`},Gi={class:`setting-icon`},Ki={class:`segmented segmented-sm`,role:`radiogroup`,"aria-label":`Theme`},qi=[`aria-checked`,`onClick`],Ji={class:`card-row palette-row`},Yi={class:`setting-icon`},Xi={class:`grow`},Zi={class:`palette-grid`,role:`radiogroup`,"aria-label":`Colour palette`},Qi=[`aria-checked`,`onClick`],$i={class:`palette-swatch`},ea={class:`palette-text`},ta={class:`palette-name`},na={class:`row-sub`},ra={class:`card`},ia={class:`card-row`},aa={class:`setting-icon`},oa={class:`grow`},sa={class:`row-sub`},ca=[`disabled`],la=[`disabled`],ua={class:`card-row switch-row`},da=[`disabled`],fa={class:`card-row switch-row`},pa=[`disabled`],ma={class:`card-row`},ha=[`disabled`],ga={key:0,class:`setting-note`},_a={key:1,class:`setting-note is-error`},va={class:`card`},ya={class:`card-row`},ba={class:`setting-icon`},xa={class:`grow`},Sa={class:`row-sub`},Ca=[`disabled`],wa={class:`field`},Ta={class:`field`},Ea=[`placeholder`,`required`],Da={class:`field-grid`},Oa={class:`field`},ka={class:`field`},Aa={class:`field`},ja={class:`form-actions`},Ma=[`disabled`],Na=[`disabled`],Pa=[`disabled`],Fa={key:2,class:`setting-note`},Ia={key:3,class:`setting-note is-error`},La={class:`card`},Ra={class:`card-row`},za={class:`setting-icon`},Ba={class:`grow`},Va={class:`row-sub`},Ha=[`disabled`],Ua={class:`card`},Wa={class:`card-row`},Ga={class:`setting-icon`},Ka={class:`grow`},qa={class:`row-sub`},Ja=[`disabled`],Ya={key:0,class:`card-row totp-setup`},Xa=[`src`],Za={class:`grow`},Qa={class:`secret`},$a=[`disabled`],eo={key:1,class:`card-row`},to=[`disabled`],no={key:4,class:`setting-note is-error`},ro={class:`card`},io={class:`setting-icon`},ao={class:`grow`},oo={class:`row-title`},so={key:0,class:`pill pill-current`},co={class:`row-sub`},lo=[`disabled`,`onClick`],uo={key:0,class:`card-row row-sub`},fo={class:`form-actions spaced`},po=[`disabled`],mo=d({__name:`Settings`,props:{request:{type:Function},totpEnabled:{type:Boolean}},emits:[`back`,`signedOut`,`totpChanged`,`dictationChanged`],setup(n,{emit:r}){let o=n,c=r,l=e(null),d=e({baseUrl:``,apiKey:``,model:``,languages:``,keywords:``}),f=(e,t)=>e.split(t).map(e=>e.trim()).filter(Boolean),p=e(!1),v=e(!1),S=e(``),C=e(``);function w(e){l.value=e,d.value={baseUrl:e.baseUrl,apiKey:``,model:e.model,languages:e.languages.join(`, `),keywords:e.keywords.join(`
26
+ `)},c(`dictationChanged`,e.configured)}async function T(e){v.value=!0,S.value=C.value=``;try{await e()}catch(e){S.value=e.message}finally{v.value=!1}}let D=()=>T(async()=>{let e=d.value;w(await o.request(`/dictation`,`PUT`,{baseUrl:e.baseUrl,apiKey:e.apiKey,model:e.model,languages:f(e.languages,/[,\s]+/),keywords:f(e.keywords,/[,\n]+/)})),p.value=!1,C.value=`Saved. The microphone button is in the composer.`}),k=()=>T(async()=>{confirm(`Remove the transcription service? Voice input turns off on every device.`)&&(w(await o.request(`/dictation`,`DELETE`)),p.value=!1)});function A(){l.value&&w(l.value),p.value=!1,S.value=``}let M=Mi(),N=e(null),F=e({attention:!0,turns:!0}),ee=e(typeof Notification>`u`?`default`:Notification.permission),R=e(!1),z=e(``),te=e(``);async function B(){if(M!==`supported`||(N.value=await Ni(),!N.value))return;let e=await o.request(`/push/status`,`POST`,{endpoint:N.value.endpoint});e.subscribed?F.value=e.prefs:N.value=null}async function V(e){R.value=!0,te.value=z.value=``;try{await e()}catch(e){te.value=e.message}finally{R.value=!1,ee.value=typeof Notification>`u`?`default`:Notification.permission}}let H=()=>V(async()=>{N.value=await Fi(o.request,F.value),z.value=`Notifications are on for this device.`}),ne=()=>V(async()=>{await Li(o.request),N.value=null}),re=()=>V(async()=>{N.value&&await Ii(o.request,N.value,F.value)}),U=()=>V(async()=>{let{sent:e}=await o.request(`/push/test`,`POST`,{});z.value=e?`Test sent. It should arrive in a few seconds.`:`This device is not registered.`}),ie=e(!1);async function ae(){ie.value=!0;try{await ki()}finally{ie.value=!1}}let oe=e([]),W=e(null),se=e(``),ce=e(``),le=e(!1);async function ue(){oe.value=await o.request(`/sessions`)}async function de(e){le.value=!0,ce.value=``;try{await e()}catch(e){ce.value=e.message}finally{le.value=!1}}let fe=()=>de(async()=>{W.value=await o.request(`/totp/setup`,`POST`,{}),se.value=``}),pe=()=>de(async()=>{await o.request(`/totp/confirm`,`POST`,{code:se.value.trim()}),W.value=null,se.value=``,c(`totpChanged`,!0)}),me=()=>de(async()=>{await o.request(`/totp/disable`,`POST`,{code:se.value.trim()}),se.value=``,c(`totpChanged`,!1)}),he=e=>de(async()=>{await o.request(`/sessions/`+e.id,`DELETE`),e.current?c(`signedOut`):await ue()}),ge=()=>de(async()=>{confirm(`Sign out every device, including this one? Their notifications stop too.`)&&(await o.request(`/sessions/revoke-all`,`POST`,{}),c(`signedOut`))}),K=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`},q=x(()=>ee.value===`denied`);return s(()=>{B().catch(()=>{}),ue().catch(()=>{}),o.request(`/dictation`).then(w).catch(()=>{})}),(e,r)=>(i(),I(`section`,Bi,[b(`header`,Vi,[b(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:r[0]||=e=>c(`back`)},[t(G,{name:`back`,size:18})]),r[12]||=b(`div`,null,[b(`h1`,null,`Settings`),b(`p`,{class:`subtle`},`Appearance, notifications, the app on your phone, and who can sign in.`)],-1)]),b(`div`,Hi,[r[29]||=b(`h2`,{class:`section-label`},`Appearance`,-1),b(`div`,Ui,[b(`div`,Wi,[b(`span`,Gi,[t(G,{name:`sun`,size:16})]),r[13]||=b(`div`,{class:`grow`},[b(`div`,{class:`row-title`},`Theme`)],-1),b(`div`,Ki,[(i(),I(y,null,L([`system`,`light`,`dark`],e=>b(`button`,{key:e,role:`radio`,"aria-checked":E(fi)===e,class:j({chosen:E(fi)===e}),onClick:t=>E(gi)(e)},O(e===`system`?`System`:e===`light`?`Light`:`Dark`),11,qi)),64))])]),b(`div`,Ji,[b(`span`,Yi,[t(G,{name:`sparkle`,size:16})]),b(`div`,Xi,[r[14]||=b(`div`,{class:`row-title`},`Colour`,-1),b(`div`,Zi,[(i(!0),I(y,null,L(E(yi),e=>(i(),I(`button`,{key:e.id,type:`button`,role:`radio`,class:j([`palette-option`,{chosen:E(xi)===e.id}]),"aria-checked":E(xi)===e.id,onClick:t=>E(wi)(e.id)},[b(`span`,$i,[b(`span`,{style:h({background:e.swatch[0]})},null,4),b(`span`,{style:h({background:e.swatch[1]})},null,4)]),b(`span`,ea,[b(`span`,ta,O(e.label),1),b(`span`,na,O(e.note),1)])],10,Qi))),128))])])])]),r[30]||=b(`h2`,{class:`section-label`},`Notifications`,-1),b(`div`,ra,[b(`div`,ia,[b(`span`,aa,[t(G,{name:`bell`,size:16})]),b(`div`,oa,[r[15]||=b(`div`,{class:`row-title`},`Push notifications`,-1),b(`div`,sa,[E(M)===`insecure`?(i(),I(y,{key:0},[u(`Needs HTTPS. Open the console through your tunnel's https:// address.`)],64)):E(M)===`needs-install`?(i(),I(y,{key:1},[u(`On iPhone and iPad, add LitePaseo to your Home Screen first, then open it from there.`)],64)):E(M)===`unsupported`?(i(),I(y,{key:2},[u(`This browser cannot receive push notifications.`)],64)):q.value?(i(),I(y,{key:3},[u(`Blocked in this browser's site settings. Allow notifications there, then return.`)],64)):N.value?(i(),I(y,{key:4},[u(`On for this device. Arrives even when the app is closed.`)],64)):(i(),I(y,{key:5},[u(`Get told when an agent needs you or a turn finishes, even with the app closed.`)],64))])]),E(M)===`supported`&&!N.value&&!q.value?(i(),I(`button`,{key:0,class:`btn btn-primary`,disabled:R.value,onClick:H},` Turn on `,8,ca)):N.value?(i(),I(`button`,{key:1,class:`btn btn-outline`,disabled:R.value,onClick:ne},`Turn off`,8,la)):P(``,!0)]),N.value?(i(),I(y,{key:0},[b(`label`,ua,[r[16]||=b(`div`,{class:`grow`},[b(`div`,{class:`row-title`},`When an agent needs your input`),b(`div`,{class:`row-sub`},`Permission requests and questions`)],-1),a(b(`input`,{"onUpdate:modelValue":r[1]||=e=>F.value.attention=e,class:`switch`,type:`checkbox`,disabled:R.value,onChange:re},null,40,da),[[m,F.value.attention]])]),b(`label`,fa,[r[17]||=b(`div`,{class:`grow`},[b(`div`,{class:`row-title`},`When a turn finishes`),b(`div`,{class:`row-sub`},`Including failed turns`)],-1),a(b(`input`,{"onUpdate:modelValue":r[2]||=e=>F.value.turns=e,class:`switch`,type:`checkbox`,disabled:R.value,onChange:re},null,40,pa),[[m,F.value.turns]])]),b(`div`,ma,[r[18]||=b(`div`,{class:`grow row-sub`},`Not sent while you are viewing that conversation.`,-1),b(`button`,{class:`btn btn-outline`,disabled:R.value,onClick:U},`Send a test`,8,ha)])],64)):P(``,!0)]),z.value?(i(),I(`p`,ga,O(z.value),1)):P(``,!0),te.value?(i(),I(`p`,_a,O(te.value),1)):P(``,!0),r[31]||=b(`h2`,{class:`section-label`},`Voice input`,-1),b(`div`,va,[b(`div`,ya,[b(`span`,ba,[t(G,{name:`mic`,size:16})]),b(`div`,xa,[r[19]||=b(`div`,{class:`row-title`},`Transcription service`,-1),b(`div`,Sa,[l.value?.configured?(i(),I(y,{key:0},[u(O(l.value.model)+` · `+O(l.value.baseUrl.replace(/^https?:\/\//,``))+` · key `+O(l.value.keyHint)+O(l.value.languages.length?` · `+l.value.languages.join(`, `):``)+O(l.value.keywords.length?` · ${l.value.keywords.length} terms`:``),1)],64)):(i(),I(y,{key:1},[u(`Any OpenAI-compatible speech-to-text API. Set it once here and the microphone works for every host.`)],64))])]),p.value?P(``,!0):(i(),I(`button`,{key:0,class:`btn btn-outline`,disabled:v.value||!l.value,onClick:r[3]||=e=>p.value=!0},O(l.value?.configured?`Edit`:`Set up`),9,Ca))]),p.value?(i(),I(`form`,{key:0,class:`card-row voice-form`,onSubmit:_(D,[`prevent`])},[b(`label`,wa,[r[20]||=b(`span`,null,`Base URL`,-1),a(b(`input`,{"onUpdate:modelValue":r[4]||=e=>d.value.baseUrl=e,placeholder:`https://api.openai.com/v1`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,d.value.baseUrl]])]),b(`label`,Ta,[r[21]||=b(`span`,null,`API key`,-1),a(b(`input`,{"onUpdate:modelValue":r[5]||=e=>d.value.apiKey=e,type:`password`,autocomplete:`off`,placeholder:l.value?.configured?`Unchanged (`+l.value.keyHint+`)`:`sk-…`,required:!l.value?.configured},null,8,Ea),[[g,d.value.apiKey]])]),b(`div`,Da,[b(`label`,Oa,[r[22]||=b(`span`,null,`Model`,-1),a(b(`input`,{"onUpdate:modelValue":r[6]||=e=>d.value.model=e,placeholder:`gpt-transcribe`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,d.value.model]])]),b(`label`,ka,[r[23]||=b(`span`,null,`Languages`,-1),a(b(`input`,{"onUpdate:modelValue":r[7]||=e=>d.value.languages=e,placeholder:`Detect (or zh, en)`,maxlength:`80`,autocomplete:`off`,spellcheck:`false`},null,512),[[g,d.value.languages]])])]),b(`label`,Aa,[r[24]||=b(`span`,null,`Vocabulary`,-1),a(b(`textarea`,{"onUpdate:modelValue":r[8]||=e=>d.value.keywords=e,rows:`3`,placeholder:`LitePaseo
27
+ Claude Code
28
+ pnpm`,spellcheck:`false`},null,512),[[g,d.value.keywords]])]),r[25]||=b(`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),b(`div`,ja,[l.value?.configured?(i(),I(`button`,{key:0,type:`button`,class:`btn btn-ghost voice-remove`,disabled:v.value,onClick:k},`Remove`,8,Ma)):P(``,!0),b(`button`,{type:`button`,class:`btn btn-ghost`,disabled:v.value,onClick:A},`Cancel`,8,Na),b(`button`,{class:`btn btn-primary`,disabled:v.value},`Save`,8,Pa)])],32)):P(``,!0)]),C.value?(i(),I(`p`,Fa,O(C.value),1)):P(``,!0),S.value?(i(),I(`p`,Ia,O(S.value),1)):P(``,!0),r[32]||=b(`h2`,{class:`section-label`},`App`,-1),b(`div`,La,[b(`div`,Ra,[b(`span`,za,[t(G,{name:`phone`,size:16})]),b(`div`,Ba,[r[26]||=b(`div`,{class:`row-title`},`Install LitePaseo`,-1),b(`div`,Va,[E(Oi)?(i(),I(y,{key:0},[u(`Installed. You are using the app.`)],64)):E(Di)?(i(),I(y,{key:1},[u(`Full screen, its own icon, and notifications.`)],64)):E(Ti)?(i(),I(y,{key:2},[u(`In Safari, tap Share, then “Add to Home Screen”.`)],64)):(i(),I(y,{key:3},[u(`Use your browser's menu: “Install app” or “Add to Home screen”.`)],64))])]),E(Di)&&!E(Oi)?(i(),I(`button`,{key:0,class:`btn btn-primary`,disabled:ie.value,onClick:ae},`Install`,8,Ha)):P(``,!0)])]),r[33]||=b(`h2`,{class:`section-label`},`Sign-in`,-1),b(`div`,Ua,[b(`div`,Wa,[b(`span`,Ga,[t(G,{name:`shield`,size:16})]),b(`div`,Ka,[r[27]||=b(`div`,{class:`row-title`},`Authenticator code`,-1),b(`div`,qa,O(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&&!W.value?(i(),I(`button`,{key:0,class:`btn btn-outline`,disabled:le.value,onClick:fe},`Set up`,8,Ja)):P(``,!0)]),W.value?(i(),I(`div`,Ya,[b(`img`,{src:W.value.qr,alt:`Authenticator QR code`,width:`164`,height:`164`},null,8,Xa),b(`div`,Za,[r[28]||=b(`p`,{class:`row-sub`},`Scan with Google Authenticator, 1Password, Authy or similar. Or enter this key:`,-1),b(`code`,Qa,O(W.value.secret.match(/.{1,4}/g)?.join(` `)),1),b(`form`,{class:`code-form`,onSubmit:_(pe,[`prevent`])},[a(b(`input`,{"onUpdate:modelValue":r[9]||=e=>se.value=e,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,placeholder:`123456`,"aria-label":`Code from your app`},null,512),[[g,se.value]]),b(`button`,{class:`btn btn-primary`,disabled:le.value||se.value.trim().length!==6},`Turn on`,8,$a),b(`button`,{type:`button`,class:`btn btn-ghost`,onClick:r[10]||=e=>W.value=null},`Cancel`)],32)])])):P(``,!0),n.totpEnabled?(i(),I(`div`,eo,[b(`form`,{class:`code-form grow`,onSubmit:_(me,[`prevent`])},[a(b(`input`,{"onUpdate:modelValue":r[11]||=e=>se.value=e,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,placeholder:`Current code`,"aria-label":`Current code`},null,512),[[g,se.value]]),b(`button`,{class:`btn btn-outline`,disabled:le.value||se.value.trim().length!==6},`Turn off`,8,to)],32)])):P(``,!0)]),ce.value?(i(),I(`p`,no,O(ce.value),1)):P(``,!0),r[34]||=b(`h2`,{class:`section-label`},`Signed-in devices`,-1),b(`div`,ro,[(i(!0),I(y,null,L(oe.value,e=>(i(),I(`div`,{key:e.id,class:`card-row`},[b(`span`,io,[t(G,{name:/iOS|Android/.test(e.label)?`phone`:`monitor`,size:16},null,8,[`name`])]),b(`div`,ao,[b(`div`,oo,[u(O(e.label),1),e.current?(i(),I(`span`,so,`This device`)):P(``,!0)]),b(`div`,co,`Active `+O(K(e.lastSeen))+` · signed in `+O(new Date(e.created).toLocaleDateString()),1)]),b(`button`,{class:`btn btn-outline`,disabled:le.value,onClick:t=>he(e)},O(e.current?`Sign out`:`Revoke`),9,lo)]))),128)),oe.value.length?P(``,!0):(i(),I(`div`,uo,`Signed in with the access token only.`))]),b(`div`,fo,[b(`button`,{class:`btn btn-ghost`,disabled:le.value,onClick:ge},`Sign out everywhere`,8,po)])])]))}}),ho={class:`agent-board`},go=[`title`],_o={class:`count`},vo=[`onClick`,`onKeydown`],yo={class:`task-top`},bo={class:`task-title`},xo={class:`task-meta`},So=[`onClick`],Co=[`disabled`,`onClick`],wo=[`disabled`,`onClick`],To=[`disabled`,`onClick`],Eo=[`onClick`],Do={key:1,class:`column-empty`},Oo=40,ko=d({__name:`AgentBoard`,props:{store:{},hostLabels:{},busy:{type:Boolean}},emits:[`open`,`stop`,`read`,`archive`],setup(e,{emit:n}){let r=e,a=n,o={needs_input:`Needs you`,running:`Running`,review:`To review`,done:`Done`},s={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`},c=l({needs_input:Oo,running:Oo,review:Oo,done:Oo}),d=x(()=>(r.store.version.value,re.map(e=>({lane:e,size:r.store.laneSize(e),agents:r.store.laneRange(e,0,c[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`} ${ie(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)=>(i(),I(`div`,ho,[(i(!0),I(y,null,L(d.value,n=>(i(),I(`section`,{key:n.lane,class:j([`lane`,`lane-`+n.lane])},[b(`header`,{class:`lane-head`,title:s[n.lane]},[r[1]||=b(`span`,{class:`lane-dot`},null,-1),b(`h3`,null,O(o[n.lane]),1),b(`span`,_o,O(n.size),1)],8,go),(i(!0),I(y,null,L(n.agents,n=>(i(),I(`article`,{key:n.key,class:j([`task-card`,`is-`+n.state]),tabindex:`0`,onClick:e=>a(`open`,n.key),onKeydown:N(e=>a(`open`,n.key),[`enter`])},[b(`div`,yo,[b(`span`,{class:j([`status-dot`,`is-`+(n.state===`needs_input`?`attention`:n.state===`failed`?`error`:n.state)])},null,2),b(`span`,bo,O(n.title||`Untitled session`),1)]),b(`div`,xo,O(n.project)+` · `+O(e.hostLabels.get(n.hostId)??`?`)+` · `+O(n.provider),1),b(`div`,{class:j([`task-detail`,{"is-error":n.state===`failed`}])},O(p(n)),3),b(`div`,{class:`task-actions`,onClick:r[0]||=_(()=>{},[`stop`])},[n.state===`needs_input`?(i(),I(`button`,{key:0,class:`btn btn-primary btn-sm`,onClick:e=>a(`open`,n.key)},`Respond`,8,So)):P(``,!0),n.state===`running`?(i(),I(`button`,{key:1,class:`btn btn-outline btn-sm`,disabled:e.busy,onClick:e=>a(`stop`,n)},[t(G,{name:`stop`,size:11}),r[2]||=u(`Stop `,-1)],8,Co)):P(``,!0),n.unread?(i(),I(`button`,{key:2,class:`btn btn-outline btn-sm`,disabled:e.busy,onClick:e=>a(`read`,n)},[t(G,{name:`check`,size:12}),r[3]||=u(`Mark read `,-1)],8,wo)):P(``,!0),n.state!==`running`&&n.state!==`needs_input`?(i(),I(`button`,{key:3,class:`btn btn-ghost btn-sm`,disabled:e.busy,onClick:e=>a(`archive`,n)},` Archive `,8,To)):P(``,!0)])],42,vo))),128)),n.size>c[n.lane]?(i(),I(`button`,{key:0,class:`btn btn-ghost lane-more`,onClick:e=>c[n.lane]+=Oo},` Show `+O(Math.min(Oo,n.size-c[n.lane]))+` more `,9,Eo)):P(``,!0),n.size?P(``,!0):(i(),I(`p`,Do,`Nothing here`))],2))),128))]))}}),Ao={key:0,class:`usage`},jo=[`aria-expanded`],Mo={class:`usage-name`},No={key:0,class:`usage-card`,role:`dialog`,"aria-label":`Usage limits`},Po=[`disabled`],Fo={key:0,class:`spinner spinner-sm`},Io={class:`usage-account-head`},Lo={class:`row-title`},Ro={class:`row-sub`},zo={key:0,class:`row-sub is-error`},Bo={class:`usage-window-head`},Vo={class:`usage-bar`},Ho={class:`usage-window-foot`},Uo={class:`usage-foot`},Wo=d({__name:`UsagePanel`,props:{report:{},loading:{type:Boolean}},emits:[`refresh`],setup(n,{emit:r}){let a=n,o=r,s=e(!1);function c(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=c(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=x(()=>a.report?.accounts.filter(e=>e.windows.length||e.error)??[]),g=e=>e.shortLabel??e.label;return(e,r)=>m.value.length?(i(),I(`div`,Ao,[b(`button`,{class:`usage-summary`,"aria-expanded":s.value,onClick:r[0]||=e=>s.value=!s.value},[(i(!0),I(y,null,L(m.value,e=>(i(),I(`span`,{key:e.key,class:`usage-line`},[b(`span`,Mo,O(e.name),1),(i(!0),I(y,null,L(e.windows.slice(0,3),e=>(i(),I(`span`,{key:e.id,class:j([`usage-pct`,`tone-`+d(e)])},[u(O(e.remainingPct===null?`—`:Math.round(e.remainingPct)+`%`),1),b(`small`,null,O(g(e)),1)],2))),128))]))),128))],8,jo),s.value?(i(),I(`div`,No,[b(`header`,null,[r[3]||=b(`strong`,null,`Usage left`,-1),b(`button`,{class:`icon-btn`,disabled:n.loading,title:`Refresh`,"aria-label":`Refresh usage`,onClick:r[1]||=e=>o(`refresh`)},[n.loading?(i(),I(`span`,Fo)):(i(),p(G,{key:1,name:`refresh`,size:14}))],8,Po),b(`button`,{class:`icon-btn`,"aria-label":`Close`,onClick:r[2]||=e=>s.value=!1},[t(G,{name:`close`,size:14})])]),(i(!0),I(y,null,L(m.value,e=>(i(),I(`section`,{key:e.key,class:`usage-account`},[b(`div`,Io,[b(`span`,Lo,O(e.name),1),b(`span`,Ro,O([e.plan,e.hosts.join(`, `)].filter(Boolean).join(` · `)),1)]),e.error?(i(),I(`p`,zo,O(e.error),1)):P(``,!0),(i(!0),I(y,null,L(e.windows,e=>(i(),I(`div`,{key:e.id,class:`usage-window`},[b(`div`,Bo,[b(`span`,null,O(e.label),1),b(`strong`,{class:j(`tone-`+d(e))},O(e.remainingPct===null?`—`:Math.round(e.remainingPct)+`% left`),3)]),b(`div`,Vo,[b(`span`,{class:j(`tone-`+d(e)),style:h({width:Math.max(0,Math.min(100,e.remainingPct??0))+`%`})},null,6)]),b(`div`,Ho,[b(`span`,null,O(f(e)),1),l(e)?(i(),I(`span`,{key:0,class:j(`tone-`+l(e).tone)},O(l(e).text),3)):P(``,!0)])]))),128))]))),128)),(i(!0),I(y,null,L(n.report?.unavailableHosts??[],e=>(i(),I(`p`,{key:e.hostId,class:`row-sub`},O(e.label)+`: `+O(e.error),1))),128)),b(`p`,Uo,` Updated `+O(n.report?.fetchedAt?new Date(n.report.fetchedAt).toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`}):`—`)+` · hosts cache usage for 5 min `,1)])):P(``,!0)])):P(``,!0)}});function Go(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 Ko={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`},qo=[`transform`],Jo={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`},Yo={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`},Xo=[`transform`],Zo=d({__name:`ProviderIcon`,props:{provider:{}},setup(e){let t=e,n=x(()=>t.provider.toLowerCase());return(e,t)=>n.value===`codex`||n.value===`openai`?(i(),I(`svg`,Ko,[(i(),I(y,null,L([0,60,120,180,240,300],e=>b(`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,qo)),64))])):n.value===`pi`?(i(),I(`svg`,Jo,[...t[0]||=[b(`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`?(i(),I(`svg`,Yo,[(i(),I(y,null,L([0,30,60,90,120,150],e=>b(`path`,{key:e,transform:`rotate(${e} 12 12)`,d:`M12 3v18`},null,8,Xo)),64))])):(i(),p(G,{key:3,name:n.value===`gemini`?`sparkle`:`bot`,size:18,class:`provider-icon`},null,8,[`name`]))}}),Qo={class:`agent-controls`},$o=[`title`],es={class:`chip-text`},ts=[`disabled`,`value`],ns=[`value`],rs=[`value`],is=[`title`],as={class:`chip-text`},os=[`disabled`,`value`],ss=[`value`],cs=[`title`],ls={class:`chip-text`},us=[`disabled`,`value`],ds={key:0,value:``,disabled:``},fs=[`value`,`title`],ps=[`aria-label`,`aria-pressed`,`title`,`disabled`,`onClick`],ms={key:0,class:`chip-text`},hs=[`title`],gs={key:1,class:`chip-text`},_s={class:`chip-key`},vs=[`aria-label`,`disabled`,`value`,`onChange`],ys=[`value`],bs=[`title`,`aria-label`],xs={width:`18`,height:`18`,viewBox:`0 0 18 18`,"aria-hidden":`true`},Ss=[`stroke-dasharray`],Cs=3e5,ws=Vr(d({__name:`AgentControls`,props:{agent:{},path:{},api:{type:Function},disabled:{type:Boolean}},emits:[`notice`],setup(r,{emit:a}){let o=r,s=a,c=new Map,l=e(null),d=e({});async function f(e=!1){let t=o.agent.key,n=c.get(t);if(!e&&n&&Date.now()-n.at<Cs)l.value=n.options;else try{let e=await o.api(o.path+`/config`);c.set(t,{at:Date.now(),options:e}),o.agent.key===t&&(l.value=e)}catch{o.agent.key===t&&(l.value=n?.options??null)}}n(()=>o.agent.key,()=>{l.value=c.get(o.agent.key)?.options??null,d.value={},f()},{immediate:!0});let m=x(()=>d.value.model??o.agent.model??null),h=x(()=>l.value?.models.find(e=>e.id===m.value)??null),g=x(()=>h.value?.label??(m.value?m.value.split(`/`).pop():`Model`)),_=x(()=>d.value.thinking??o.agent.thinking??h.value?.defaultThinkingId??null),v=x(()=>h.value?.thinking??[]),S=x(()=>v.value.find(e=>e.id===_.value)?.label??_.value??``),C=x(()=>d.value.mode??o.agent.modeId??null),w=x(()=>l.value?.modes??[]),T=x(()=>w.value.find(e=>e.id===C.value)?.label??`Mode`),E=x(()=>/full|bypass|danger|unrestricted/i.test(`${C.value} ${T.value}`)),D=e=>/^(plan|plan[-_ ]?mode)$/i.test(e.id)||/^plan(?: mode)?$/i.test(e.label),k=e=>/fast|speed/i.test(`${e.id} ${e.label}`),A=x(()=>(l.value?.features??[]).filter(e=>!D(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??``}}));n(()=>[o.agent.model,o.agent.thinking,o.agent.modeId],()=>{let e={...d.value};e.model===o.agent.model&&delete e.model,e.thinking===o.agent.thinking&&delete e.thinking,e.mode===o.agent.modeId&&delete e.mode,d.value=e});async function M(e,t,n){let r=d.value[e];d.value={...d.value,[e]:n};try{let n=(await o.api(o.path+`/config`,`POST`,t))?.notice;if(n?.message&&s(`notice`,n.message),e.startsWith(`feature:`)){c.delete(o.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}s(`notice`,t.message)}}let N=e=>e.target.value,F=x(()=>{let e=o.agent.contextUsed??0,t=o.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`}}),ee=2*Math.PI*7;return(e,n)=>(i(),I(`div`,Qo,[b(`label`,{class:j([`chip`,{"is-disabled":r.disabled||!l.value?.models.length}]),title:r.agent.provider+` · Model: `+g.value},[t(Zo,{provider:r.agent.provider},null,8,[`provider`]),b(`span`,es,O(g.value),1),t(G,{name:`chevron`,size:11,class:`chip-caret`}),b(`select`,{"aria-label":`Model`,disabled:r.disabled||!l.value?.models.length,value:m.value??``,onChange:n[0]||=e=>M(`model`,{model:N(e)},N(e))},[m.value&&!h.value?(i(),I(`option`,{key:0,value:m.value},O(g.value),9,ns)):P(``,!0),(i(!0),I(y,null,L(l.value?.models??[],e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,rs))),128))],40,ts)],10,$o),v.value.length?(i(),I(`label`,{key:0,class:j([`chip`,{"is-disabled":r.disabled}]),title:`Thinking: `+S.value},[t(G,{name:`brain`,size:18}),b(`span`,as,O(S.value),1),t(G,{name:`chevron`,size:11,class:`chip-caret`}),b(`select`,{"aria-label":`Thinking`,disabled:r.disabled,value:_.value??``,onChange:n[1]||=e=>M(`thinking`,{thinkingOptionId:N(e)},N(e))},[(i(!0),I(y,null,L(v.value,e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,ss))),128))],40,os)],10,is)):P(``,!0),w.value.length?(i(),I(`label`,{key:1,class:j([`chip`,{"is-disabled":r.disabled}]),title:`Mode: `+T.value},[t(G,{name:E.value?`shield-off`:`shield`,size:18},null,8,[`name`]),b(`span`,ls,O(T.value),1),t(G,{name:`chevron`,size:11,class:`chip-caret`}),b(`select`,{"aria-label":`Mode`,disabled:r.disabled,value:C.value??``,onChange:n[2]||=e=>M(`mode`,{modeId:N(e)},N(e))},[C.value?P(``,!0):(i(),I(`option`,ds,`Mode`)),(i(!0),I(y,null,L(w.value,e=>(i(),I(`option`,{key:e.id,value:e.id,title:e.description},O(e.label),9,fs))),128))],40,us)],10,cs)):P(``,!0),(i(!0),I(y,null,L(A.value,e=>(i(),I(y,{key:e.id},[e.type===`toggle`?(i(),I(`button`,{key:0,type:`button`,class:j([`chip chip-toggle`,{chosen:e.value,"chip-icon-only":k(e)}]),"aria-label":e.label,"aria-pressed":e.value,title:e.tooltip??e.label,disabled:r.disabled,onClick:t=>M(`feature:`+e.id,{feature:{id:e.id,value:!e.value}},!e.value)},[t(G,{name:k(e)?`bolt`:`sliders`,size:18},null,8,[`name`]),k(e)?P(``,!0):(i(),I(`span`,ms,O(e.label),1))],10,ps)):(i(),I(`label`,{key:1,class:j([`chip`,{"is-disabled":r.disabled,"chip-icon-only":k(e),chosen:k(e)&&e.value===`fast`}]),title:[e.label,e.current,e.tooltip].filter(Boolean).join(` · `)},[k(e)?(i(),p(G,{key:0,name:`bolt`,size:18})):P(``,!0),k(e)?P(``,!0):(i(),I(`span`,gs,[b(`span`,_s,O(e.label)+`:`,1),u(` `+O(e.current||`Default`),1)])),k(e)?P(``,!0):(i(),p(G,{key:2,name:`chevron`,size:11,class:`chip-caret`})),b(`select`,{"aria-label":e.label,disabled:r.disabled,value:e.value??``,onChange:t=>M(`feature:`+e.id,{feature:{id:e.id,value:N(t)}},N(t))},[(i(!0),I(y,null,L(e.options,e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,ys))),128))],40,vs)],10,hs))],64))),128)),F.value?(i(),I(`span`,{key:2,class:j([`context-gauge`,{"is-high":F.value.ratio>=.8}]),title:F.value.title,role:`img`,"aria-label":F.value.title},[(i(),I(`svg`,xs,[n[3]||=b(`circle`,{cx:`9`,cy:`9`,r:`7`,class:`context-track`},null,-1),b(`circle`,{cx:`9`,cy:`9`,r:`7`,class:`context-fill`,"stroke-dasharray":`${ee*F.value.ratio} ${ee}`,transform:`rotate(-90 9 9)`},null,8,Ss)])),b(`span`,null,O(F.value.percent)+`%`,1)],10,bs)):P(``,!0)]))}}),[[`__scopeId`,`data-v-75860281`]]),Ts={class:`page`},Es={class:`page-head`},Ds=[`disabled`],Os={class:`page-body`},ks={key:0,class:`setting-note is-error`},As={class:`row-title`},js={key:0,class:`field-grid`},Ms={class:`field`},Ns=[`disabled`,`title`],Ps=[`value`],Fs={class:`field`},Is=[`disabled`],Ls=[`value`],Rs={class:`field`},zs=[`disabled`],Bs=[`value`],Vs={class:`field`},Hs=[`disabled`],Us=[`value`],Ws={class:`field`},Gs={class:`field`},Ks={class:`field-grid`},qs={class:`field`},Js={key:0,class:`field`},Ys=[`value`],Xs={key:1,class:`field`},Zs={key:2,class:`field`},Qs={class:`subtle small`},$s={key:1,class:`check-row`},ec={key:2,class:`check-row`},tc={class:`form-actions`},nc=[`disabled`],rc={key:2,class:`timeline-empty`},ic={key:3,class:`schedules-empty`},ac={key:4,class:`card`},oc={class:`card-row`},sc={class:`grow`},cc={class:`row-title`},lc={class:`row-sub`},uc={class:`row-sub`},dc={key:1,class:`schedule-status`},fc={class:`schedule-actions`},pc=[`disabled`,`onClick`],mc=[`disabled`,`onClick`],hc=[`disabled`,`onClick`],gc=[`disabled`,`onClick`],_c=[`aria-expanded`,`onClick`],vc=[`disabled`,`onClick`],yc={key:0,class:`schedule-runs`},bc={class:`schedule-prompt`},xc={key:0,class:`subtle small`},Sc={class:`run-when`},Cc={class:`run-text`},wc=[`onClick`],Tc=Vr(d({__name:`SchedulesPage`,props:{hosts:{},api:{type:Function}},emits:[`back`,`openAgent`],setup(r,{emit:o}){let c=r,l=o,d=e(null),f=e(``),p=e(null),h=e=>c.hosts.find(t=>t.id===e)?.label??`Unknown host`;async function v(){try{d.value=await c.api(`/schedules`),f.value=``}catch(e){f.value=e.message}}s(v);let C=x(()=>(d.value??[]).flatMap(e=>e.schedules.map(t=>({hostId:e.hostId,s:t})))),w=x(()=>(d.value??[]).filter(e=>e.error));async function T(e,t,n){if(n!==`delete`||confirm(`Delete the schedule “${t.name||t.prompt.slice(0,40)}”?`)){p.value=t.id;try{await c.api(`/hosts/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t.id)}${n===`delete`?``:`/`+n}`,n===`delete`?`DELETE`:`POST`),await v()}catch(e){f.value=e.message}finally{p.value=null}}}let E=e(null),D=e([]);async function k(e,t){if(E.value===t.id)return E.value=null;E.value=t.id,D.value=[];try{D.value=(await c.api(`/hosts/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t.id)}/logs`)).runs}catch(e){f.value=e.message}}let A=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function N(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 F=e=>e?et(new Date(e)):`—`,R=e(!1),z=e({hostId:``,cwd:``,provider:``,model:``,name:``,prompt:``,preset:`daily`,time:`09:00`,day:`1`,cron:`0 9 * * *`,archive:!0,runNow:!1}),te=e(null),B=e(null),V=x(()=>c.hosts.filter(e=>e.state===`connected`));n(()=>z.value.hostId,async e=>{if(te.value=B.value=null,e)try{let[t,n]=await Promise.all([c.api(`/hosts/${encodeURIComponent(e)}/providers`),c.api(`/hosts/${encodeURIComponent(e)}/projects`)]);te.value=t,B.value=n,z.value.provider||=t.find(e=>e.status===`ready`)?.id??t[0]?.id??``,z.value.cwd||=n[0]?.rootPath??``}catch(e){f.value=e.message}});let H=x(()=>{let e=B.value??[],t=z.value.cwd;return t&&!e.some(e=>e.rootPath===t)?[{key:t,name:t.split(`/`).pop()||t,rootPath:t,kind:`directory`},...e]:e}),ne=x(()=>te.value?.find(e=>e.id===z.value.provider)?.models??[]);n(ne,e=>{e.some(e=>e.id===z.value.model)||(z.value.model=e.find(e=>e.isDefault)?.id??e[0]?.id??``)});let re=x(()=>{let[e,t]=z.value.time.split(`:`).map(e=>String(Number(e)||0));return z.value.preset===`daily`?`${t} ${e} * * *`:z.value.preset===`weekdays`?`${t} ${e} * * 1-5`:z.value.preset===`weekly`?`${t} ${e} * * ${z.value.day}`:z.value.preset===`hourly`?`${t} * * * *`:z.value.cron.trim()}),U=e(null);function ie(){U.value=null,R.value=!0,z.value.hostId||=V.value[0]?.id??``}function ae(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 oe(e,t){let n=t.target.config??{};U.value={hostId:e,id:t.id,newAgent:t.target.type===`new-agent`},R.value=!0,z.value={...z.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,...ae(t.cadence.expression)},W.value=t.cadence.timezone??Intl.DateTimeFormat().resolvedOptions().timeZone,E.value=null,S(()=>document.querySelector(`.schedule-form`)?.scrollIntoView({block:`nearest`}))}let W=e(Intl.DateTimeFormat().resolvedOptions().timeZone);function se(){R.value=!1,U.value=null,W.value=Intl.DateTimeFormat().resolvedOptions().timeZone}async function ce(){if(!U.value)return le();let{hostId:e,id:t,newAgent:n}=U.value;p.value=`create`;try{await c.api(`/hosts/${encodeURIComponent(e)}/schedules/${encodeURIComponent(t)}`,`PATCH`,{name:z.value.name||null,prompt:z.value.prompt,cron:re.value,timezone:W.value,...n?{cwd:z.value.cwd,provider:z.value.provider,model:z.value.model||null,archiveOnFinish:z.value.archive}:{}}),se(),await v()}catch(e){f.value=e.message}finally{p.value=null}}async function le(){p.value=`create`;try{await c.api(`/hosts/${encodeURIComponent(z.value.hostId)}/schedules`,`POST`,{name:z.value.name||void 0,prompt:z.value.prompt,cron:re.value,timezone:W.value,cwd:z.value.cwd,provider:z.value.provider,...z.value.model?{model:z.value.model}:{},archiveOnFinish:z.value.archive,runOnCreate:z.value.runNow}),R.value=!1,z.value.prompt=z.value.name=``,await v()}catch(e){f.value=e.message}finally{p.value=null}}return(e,n)=>(i(),I(`section`,Ts,[b(`header`,Es,[b(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:n[0]||=e=>l(`back`)},[t(G,{name:`back`,size:18})]),n[14]||=b(`div`,{class:`grow`},[b(`h1`,null,`Schedules`),b(`p`,{class:`subtle`},`Prompts that start an agent on a timetable, on each host.`)],-1),b(`button`,{class:`btn btn-primary`,disabled:!V.value.length,onClick:ie},[t(G,{name:`plus`,size:15}),n[13]||=u(`New schedule`,-1)],8,Ds)]),b(`div`,Os,[f.value?(i(),I(`p`,ks,O(f.value),1)):P(``,!0),(i(!0),I(y,null,L(w.value,e=>(i(),I(`p`,{key:e.hostId,class:`setting-note`},O(h(e.hostId))+`: `+O(e.error),1))),128)),R.value?(i(),I(`form`,{key:1,class:`card form-card schedule-form`,onSubmit:_(ce,[`prevent`])},[b(`div`,As,O(U.value?`Edit schedule`:`New schedule`),1),!U.value||U.value.newAgent?(i(),I(`div`,js,[b(`label`,Ms,[n[15]||=b(`span`,null,`Host`,-1),a(b(`select`,{"onUpdate:modelValue":n[1]||=e=>z.value.hostId=e,required:``,disabled:!!U.value,title:U.value?`A schedule stays on its host`:void 0},[(i(!0),I(y,null,L(V.value,e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,Ps))),128))],8,Ns),[[M,z.value.hostId]])]),b(`label`,Fs,[n[16]||=b(`span`,null,`Project`,-1),a(b(`select`,{"onUpdate:modelValue":n[2]||=e=>z.value.cwd=e,required:``,disabled:!B.value},[(i(!0),I(y,null,L(H.value,e=>(i(),I(`option`,{key:e.key,value:e.rootPath},O(e.name),9,Ls))),128))],8,Is),[[M,z.value.cwd]])]),b(`label`,Rs,[n[17]||=b(`span`,null,`Agent`,-1),a(b(`select`,{"onUpdate:modelValue":n[3]||=e=>z.value.provider=e,required:``,disabled:!te.value},[(i(!0),I(y,null,L(te.value??[],e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,Bs))),128))],8,zs),[[M,z.value.provider]])]),b(`label`,Vs,[n[18]||=b(`span`,null,`Model`,-1),a(b(`select`,{"onUpdate:modelValue":n[4]||=e=>z.value.model=e,disabled:!ne.value.length},[(i(!0),I(y,null,L(ne.value,e=>(i(),I(`option`,{key:e.id,value:e.id},O(e.label),9,Us))),128))],8,Hs),[[M,z.value.model]])])])):P(``,!0),b(`label`,Ws,[n[19]||=b(`span`,null,`Name`,-1),a(b(`input`,{"onUpdate:modelValue":n[5]||=e=>z.value.name=e,placeholder:`Daily check-in`,maxlength:`120`},null,512),[[g,z.value.name]])]),b(`label`,Gs,[n[20]||=b(`span`,null,`Prompt`,-1),a(b(`textarea`,{"onUpdate:modelValue":n[6]||=e=>z.value.prompt=e,rows:`4`,required:``,placeholder:`What should the agent do each time?`},null,512),[[g,z.value.prompt]])]),b(`div`,Ks,[b(`label`,qs,[n[22]||=b(`span`,null,`Repeat`,-1),a(b(`select`,{"onUpdate:modelValue":n[7]||=e=>z.value.preset=e},[...n[21]||=[ee(`<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),[[M,z.value.preset]])]),z.value.preset===`weekly`?(i(),I(`label`,Js,[n[23]||=b(`span`,null,`Day`,-1),a(b(`select`,{"onUpdate:modelValue":n[8]||=e=>z.value.day=e},[(i(),I(y,null,L(A,(e,t)=>b(`option`,{key:e,value:String(t)},O(e),9,Ys)),64))],512),[[M,z.value.day]])])):P(``,!0),z.value.preset===`cron`?(i(),I(`label`,Zs,[n[24]||=b(`span`,null,`Cron`,-1),a(b(`input`,{"onUpdate:modelValue":n[10]||=e=>z.value.cron=e,placeholder:`0 9 * * 1-5`,required:``},null,512),[[g,z.value.cron]])])):(i(),I(`label`,Xs,[b(`span`,null,O(z.value.preset===`hourly`?`Minute`:`Time`),1),a(b(`input`,{"onUpdate:modelValue":n[9]||=e=>z.value.time=e,type:`time`,required:``},null,512),[[g,z.value.time]])]))]),b(`p`,Qs,O(N(re.value))+` · `+O(W.value),1),!U.value||U.value.newAgent?(i(),I(`label`,$s,[a(b(`input`,{"onUpdate:modelValue":n[11]||=e=>z.value.archive=e,type:`checkbox`},null,512),[[m,z.value.archive]]),n[25]||=u(` Archive the agent when the run finishes`,-1)])):P(``,!0),U.value?P(``,!0):(i(),I(`label`,ec,[a(b(`input`,{"onUpdate:modelValue":n[12]||=e=>z.value.runNow=e,type:`checkbox`},null,512),[[m,z.value.runNow]]),n[26]||=u(` Run once now`,-1)])),b(`div`,tc,[b(`button`,{type:`button`,class:`btn btn-ghost`,onClick:se},`Cancel`),b(`button`,{class:`btn btn-primary`,disabled:p.value===`create`||!z.value.prompt.trim()||(!U.value||U.value.newAgent)&&!z.value.cwd},O(U.value?`Save changes`:`Create schedule`),9,nc)])],32)):P(``,!0),d.value?!C.value.length&&!R.value?(i(),I(`div`,ic,[t(G,{name:`clock`,size:22}),n[28]||=b(`p`,null,`No schedules yet.`,-1)])):(i(),I(`div`,ac,[(i(!0),I(y,null,L(C.value,({hostId:e,s:n})=>(i(),I(`div`,{key:e+n.id,class:`schedule`},[b(`div`,oc,[b(`span`,{class:j([`setting-icon`,{paused:n.status!==`active`}])},[t(G,{name:`clock`,size:16})],2),b(`div`,sc,[b(`div`,cc,O(n.name||n.target.config?.title||n.prompt.slice(0,60)),1),b(`div`,lc,[u(O(N(n.cadence.expression))+` `,1),n.cadence.timezone?(i(),I(y,{key:0},[u(` · `+O(n.cadence.timezone),1)],64)):P(``,!0),u(` · `+O(h(e))+` `,1),n.target.config?.cwd?(i(),I(y,{key:1},[u(` · `+O(n.target.config.cwd.split(`/`).pop()),1)],64)):P(``,!0)]),b(`div`,uc,[n.status===`active`?(i(),I(y,{key:0},[u(`Next `+O(F(n.nextRunAt)),1)],64)):(i(),I(`span`,dc,O(n.status),1)),u(` · Last `+O(F(n.lastRunAt)),1)])]),b(`div`,fc,[b(`button`,{class:`icon-btn`,title:`Run now`,"aria-label":`Run now`,disabled:p.value===n.id,onClick:t=>T(e,n,`run`)},[t(G,{name:`play`,size:14})],8,pc),n.status===`active`?(i(),I(`button`,{key:0,class:`icon-btn`,title:`Pause`,"aria-label":`Pause`,disabled:p.value===n.id,onClick:t=>T(e,n,`pause`)},[t(G,{name:`pause`,size:14})],8,mc)):(i(),I(`button`,{key:1,class:`icon-btn`,title:`Resume`,"aria-label":`Resume`,disabled:p.value===n.id,onClick:t=>T(e,n,`resume`)},[t(G,{name:`refresh`,size:14})],8,hc)),b(`button`,{class:`icon-btn`,title:`Edit`,"aria-label":`Edit schedule`,disabled:p.value===n.id,onClick:t=>oe(e,n)},[t(G,{name:`edit`,size:14})],8,gc),b(`button`,{class:`icon-btn`,title:`Run history`,"aria-label":`Run history`,"aria-expanded":E.value===n.id,onClick:t=>k(e,n)},[t(G,{name:`list`,size:14})],8,_c),b(`button`,{class:`icon-btn`,title:`Delete`,"aria-label":`Delete schedule`,disabled:p.value===n.id,onClick:t=>T(e,n,`delete`)},[t(G,{name:`trash`,size:14})],8,vc)])]),E.value===n.id?(i(),I(`div`,yc,[b(`p`,bc,O(n.prompt),1),D.value.length?P(``,!0):(i(),I(`p`,xc,`No runs yet.`)),(i(!0),I(y,null,L(D.value,t=>(i(),I(`div`,{key:t.id,class:j([`schedule-run`,`is-`+t.status])},[b(`span`,{class:j([`status-dot`,t.status===`failed`?`is-error`:t.status===`running`?`is-running`:`is-idle-ok`])},null,2),b(`span`,Sc,O(F(t.startedAt)),1),b(`span`,Cc,O(t.error||t.output||t.status),1),t.agentId?(i(),I(`button`,{key:0,class:`btn btn-ghost btn-sm`,onClick:n=>l(`openAgent`,`${e}:${t.agentId}`)},`Open`,8,wc)):P(``,!0)],2))),128))])):P(``,!0)]))),128))])):(i(),I(`div`,rc,[...n[27]||=[b(`span`,{class:`spinner`},null,-1),u(`Loading schedules…`,-1)]]))])]))}}),[[`__scopeId`,`data-v-1a9bb929`]]),Ec=[`disabled`,`aria-label`,`title`,`onKeydown`],Dc={key:0,class:`spinner spinner-sm`},Oc={class:`rec-time`},kc=24e3,Ac=300,jc=Vr(d({__name:`DictationButton`,props:{disabled:{type:Boolean}},emits:[`text`,`preview`,`notice`],setup(t,{expose:n,emit:r}){let a=r,o=e(`idle`),s=e(0),l=typeof window<`u`&&!!navigator.mediaDevices?.getUserMedia&&window.isSecureContext,u=null,d=null,f=null,m=null,h=[],g=0,v=0,x=!1,S=0,C,w,T=kc,E=``;function D(e){let t=T/kc,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(){f&&(f.onaudioprocess=null,f.disconnect()),f=null,d?.close().catch(()=>{}),d=null,u?.getTracks().forEach(e=>e.stop()),u=null}function A(){S++,k(),clearTimeout(w),C?.abort(),C=void 0,m&&(m.onopen=m.onmessage=m.onerror=m.onclose=null,m.close()),m=null,h=[],g=0,x=!1,o.value=`idle`,E=``,a(`preview`,``)}function M(e){let t=E.trim();A(),t&&a(`text`,t),a(`notice`,e+(t?` Recognized text was kept; the last phrase may be missing.`:``))}function F(){if(x&&m?.readyState===WebSocket.OPEN){if(m.bufferedAmount>kc*2*10)M(`Voice upload cannot keep up with recording. Please try again.`);else{for(let e of h)m.send(e.buffer);h=[],g=0,o.value===`transcribing`&&m.send(JSON.stringify({type:`stop`}))}}}async function ee(){if(o.value!==`idle`)return;if(!l){a(`notice`,`Voice input needs HTTPS (or localhost) and microphone access.`);return}o.value=`starting`;let e=++S;try{let t=await navigator.mediaDevices.getUserMedia({audio:{channelCount:1,echoCancellation:!0,noiseSuppression:!0}});if(e!==S){t.getTracks().forEach(e=>e.stop());return}u=t;try{d=new AudioContext({sampleRate:kc})}catch{d=new AudioContext}if(await d.resume(),e!==S)return;T=d.sampleRate;let n=d.createMediaStreamSource(u);f=d.createScriptProcessor(4096,1,1),v=0,h=[],g=0,f.onaudioprocess=t=>{if(e!==S||o.value!==`recording`)return;let n=D(t.inputBuffer.getChannelData(0)).subarray(0,Ac*kc-v);h.push(n),g+=n.length,v+=n.length,g>kc*12?M(`Voice connection is taking too long. Please try again.`):(F(),s.value=Math.floor(v/kc),v>=Ac*kc&&R())},n.connect(f),f.connect(d.destination),s.value=0,o.value=`recording`,w=setTimeout(()=>{e===S&&M(`Could not connect to the transcription service.`)},12e3),C=new AbortController;let r=await fetch(`/api/dictation/session`,{method:`POST`,headers:{"x-litepaseo":`1`},signal:C.signal}),i=await r.json();if(e!==S)return;if(!r.ok)throw Error(i.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`,i.ticket),m=new WebSocket(c),m.onmessage=t=>{if(e===S)try{let n=JSON.parse(t.data);if(n.type===`ready`)x=!0,clearTimeout(w),o.value===`transcribing`&&L(e),F();else if(n.type===`partial`)E=String(n.text??``),a(`preview`,E);else if(n.type===`done`){let e=String(n.text??``).trim();A(),e?a(`text`,e):a(`notice`,`No speech recognized.`)}else if(n.type===`error`){let e=String(n.text??``).trim();A(),e&&a(`text`,e),a(`notice`,String(n.message??`Transcription failed.`)+(e?` Recognized text was kept; the last phrase may be missing.`:``))}}catch{M(`Invalid transcription response.`)}},m.onerror=()=>{e===S&&M(`Voice connection failed. Please try again.`)},m.onclose=()=>{e===S&&M(`Voice connection interrupted. Please try again.`)}}catch(t){if(e!==S)return;M(t.name===`NotAllowedError`?`Microphone access was denied.`:t.message)}}function L(e){clearTimeout(w),w=setTimeout(()=>{e===S&&M(`Timed out waiting for transcription.`)},125e3)}function R(){o.value===`recording`&&(k(),v<kc/5?M(`Recording too short.`):(o.value=`transcribing`,x&&(L(S),F())))}function z(){m?.readyState===WebSocket.OPEN&&m.send(JSON.stringify({type:`cancel`})),A()}let te=()=>o.value===`recording`?R():o.value===`idle`?void ee():void 0,B=e=>`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)}`;return n({cancel:z}),c(z),(e,n)=>(i(),I(y,null,[b(`button`,{type:`button`,class:j([`dictation`,`is-`+o.value]),disabled:t.disabled&&o.value===`idle`||o.value===`transcribing`||o.value===`starting`,"aria-label":o.value===`recording`?`Stop recording and transcribe`:o.value===`transcribing`?`Transcribing`:o.value===`starting`?`Starting voice input`:`Voice input`,title:o.value===`recording`?`Stop recording (Esc cancels)`:o.value===`transcribing`?`Finishing transcription…`:`Voice input`,onClick:te,onKeydown:N(_(z,[`prevent`]),[`esc`])},[o.value===`transcribing`||o.value===`starting`?(i(),I(`span`,Dc)):o.value===`recording`?(i(),I(y,{key:1},[n[0]||=b(`span`,{class:`rec-dot`},null,-1),b(`span`,Oc,O(B(s.value)),1)],64)):(i(),p(G,{key:2,name:`mic`,size:17}))],42,Ec),o.value===`idle`?P(``,!0):(i(),I(`button`,{key:0,type:`button`,class:`dictation`,"aria-label":`Cancel voice input`,title:`Cancel voice input`,onClick:z},`×`))],64))}}),[[`__scopeId`,`data-v-9ec56bd9`]]),Mc={key:0,class:`login`},Nc={class:`field`},Pc={class:`field`},Fc=[`disabled`],Ic={key:1,class:`form-error`},Lc={class:`sidebar`},Rc=[`aria-valuenow`],zc={class:`side-nav`,"aria-label":`Pages`},Bc={class:`hide-sm`},Vc={class:`side-section`},Hc={class:`side-label`},Uc={class:`list-summary`},Wc=[`aria-expanded`],Gc={key:0,class:`view-menu`},Kc={class:`segmented segmented-sm`,role:`radiogroup`,"aria-label":`Group sessions`},qc=[`aria-checked`],Jc=[`aria-checked`],Yc={key:0,class:`host-filter`,role:`radiogroup`,"aria-label":`Filter by host`},Xc=[`aria-checked`],Zc={class:`chip-count`},Qc=[`aria-checked`,`title`,`onClick`],$c={class:`chip-count`},el={class:`side-foot`},tl=[`title`],nl=[`title`,`aria-label`],rl={key:0,class:`foot-alert`,"aria-hidden":`true`},il=[`title`,`aria-label`],al={class:`main`},ol={key:0,class:`toast`,role:`alert`},sl={key:2,class:`page`},cl={class:`page-head`},ll={class:`page-body`},ul={class:`card`},dl={class:`grow`},fl={class:`row-title`},pl={class:`row-sub`},ml={key:0,role:`status`},hl={key:1,class:`row-sub`},gl={key:2,class:`row-sub`},_l={key:3,class:`row-sub`},vl=[`disabled`,`onClick`],yl={key:0,class:`card-row muted-text`},bl={class:`field`},xl={class:`field`},Sl={class:`form-actions`},Cl=[`disabled`],wl={key:4,class:`page`},Tl={class:`page-head`},El={class:`subtle`},Dl={class:`segmented head-toggle`,role:`radiogroup`,"aria-label":`Board`},Ol={class:`page-body wide`},kl=[`disabled`],Al={key:0,class:`subtle small`},jl={class:`board`},Ml={class:`column-head`},Nl={class:`count`},Pl={class:`row-title`},Fl=[`onClick`],Il={class:`kanban-actions`},Ll=[`value`,`onChange`],Rl=[`onClick`],zl={key:0,class:`column-empty`},Bl={class:`chat`},Vl={class:`chat-head`},Hl=[`title`],Ul=[`title`],Wl=[`title`],Gl={key:0,class:`agent-tabs`,"aria-label":`Tabs`},Kl=[`onClick`],ql={class:`agent-tab-name`},Jl=[`title`,`onClick`,`onAuxclick`],Yl={class:`agent-tab-name`},Xl=[`aria-label`,`onClick`],Zl={class:`timeline-inner`},Ql={key:0,class:`older`},$l=[`disabled`],eu={key:1,class:`notice`},tu={key:0,class:`turn-footer`},nu=[`aria-label`,`title`,`onClick`],ru={key:1},iu={key:2,class:`older`},au=[`disabled`],ou=[`disabled`],su={key:3,class:`timeline-working`,role:`status`,"aria-label":`Agent is working`},cu={key:0,class:`timeline-elapsed`,"aria-hidden":`true`},lu={key:1},uu={key:4,class:`timeline-empty`},du={key:0,class:`spinner`},fu={class:`dock`},pu={class:`dock-inner`},mu={key:0,role:`status`},hu={key:1,role:`status`},gu={key:2,class:`composer-notice`,role:`status`},_u={key:3},vu={style:{"white-space":`pre-wrap`}},yu=[`onClick`],bu={key:4,class:`uncertain`},xu={class:`grow`},Su=[`disabled`],Cu=[`placeholder`,`required`],wu={class:`composer-bar`},Tu=[`title`,`disabled`],Eu={class:`composer-actions`},Du=[`aria-label`,`title`],Ou=[`disabled`],ku=[`disabled`],Au=[`aria-label`],ju={class:`panel-tabs`},Mu={class:`panel-body`},Nu={key:6,class:`empty`},Pu={key:7,class:`empty`},Fu={class:`empty-mark`},Iu=[`src`],Lu=280,Ru=900,zu=420,Bu=220,Vu=520,Hu=300,Uu=d({__name:`App`,setup(r){let s=F(()=>Ht(()=>import(`./FilesPanel-B1YfdWK8.js`),__vite__mapDeps([3,1,4]))),d=F(()=>Ht(()=>import(`./FileViewer-C7zGfiFt.js`),__vite__mapDeps([5,1,6]))),f=F(()=>Ht(()=>import(`./TerminalPanel-BR2okuCE.js`),__vite__mapDeps([7,1,8]))),m=[`Todo`,`Doing`,`Done`],C=matchMedia(`(pointer: coarse)`).matches,T=/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),D=e(!1),A=e(localStorage.getItem(`litepaseo-panel`)||null);n(A,e=>e?localStorage.setItem(`litepaseo-panel`,e):localStorage.removeItem(`litepaseo-panel`));let M=e=>A.value=A.value===e?null:e,R=l(new Map),z=x(()=>ye.value??Y.value??``),te=x(()=>R.get(z.value)?.paths??[]),B=x({get:()=>R.get(z.value)?.active??null,set:e=>{let t=R.get(z.value);t&&(t.active=e)}});function V(e){let t=z.value;if(!t)return;let n=R.get(t)??{paths:[],active:null};n.paths.includes(e)||(n.paths=[...n.paths,e].slice(-12)),n.active=e,R.set(t,n),mn.matches&&(A.value=null)}function H(e){let t=R.get(z.value);if(!t)return;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 ne=e=>Math.round(Math.min(Ru,Math.max(Lu,e))),re=e(ne(Number(localStorage.getItem(`litepaseo-panel-width`))||zu));function U(e){re.value=ne(e),localStorage.setItem(`litepaseo-panel-width`,String(re.value))}function ie(e){if(e.button!==0)return;let t=e.currentTarget,n=e.clientX,r=re.value;t.setPointerCapture(e.pointerId),W.value=!0;let i=e=>re.value=ne(r-(e.clientX-n)),a=()=>{W.value=!1,U(re.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 ae=e=>Math.round(Math.min(Vu,Math.max(Bu,e))),oe=e(ae(Number(localStorage.getItem(`litepaseo-sidebar-width`))||Hu)),W=e(!1);function ce(e){oe.value=ae(e),localStorage.setItem(`litepaseo-sidebar-width`,String(oe.value))}function le(e){if(e.button!==0)return;let t=e.currentTarget,n=e.clientX,r=oe.value;t.setPointerCapture(e.pointerId),W.value=!0;let i=0,a=e=>{i&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>oe.value=ae(r+e.clientX-n))},o=()=>{cancelAnimationFrame(i),W.value=!1,ce(oe.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 ue(e,t){try{return JSON.parse(localStorage.getItem(e)??`null`)??t}catch{return t}}let de=e(``),fe=e(``),pe=e(null),he=e(!1),ge=e(``),K=e(!1),q=v([]),J=new me({collapsed:ue(`litepaseo-collapsed-projects`,[]),persist:e=>localStorage.setItem(`litepaseo-collapsed-projects`,JSON.stringify(e)),compare:se}),ve=new me({indexBy:e=>e.workspaceId?`${e.hostId}:${e.workspaceId}`:null}),ye=e(null),be=e(localStorage.getItem(`litepaseo-list-mode`)===`recent`?`recent`:`projects`),xe=e(`closed`),Y=e(null),Se=v(new Me),Ce=e(``),we=v(null),Ee=e(!1),De=e([]),Oe=e(null),Ae=e(null),je=e(``),Ne=e(!1),Fe=e(``),Ie=e(``),X=e(`steer`),ze=e(`chat`),Be=e(``),Ve=e({revision:0,cards:[]}),Z=new ke(()=>localStorage),He=new Ur,Ue=e(null),We=x(()=>Y.value?He.get(Y.value):[]),Ge=e(!1),Ke=e(``),qe=e(null);n(Ke,()=>{let e=qe.value;e&&(e.scrollTop=e.scrollHeight)},{flush:`post`});async function Je(){try{Ge.value=!!(await $(`/dictation`)).configured}catch{}}let Ye=e(``),Xe;function Ze(e){Ye.value=e,clearTimeout(Xe),Xe=setTimeout(()=>Ye.value=``,8e3)}function Qe(e){let t=Ae.value,n=at.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)?` `:``;at.value=a+s+e+o,S(()=>{if(!t)return;t.focus();let n=(a+s+e).length;t.setSelectionRange(n,n),Xn()})}let $e=x(()=>!!at.value.trim()||We.value.length>0),et=e(!1);function tt(e){e.currentTarget.contains(e.relatedTarget)||(et.value=!1)}let rt=x(()=>We.value.every(e=>!!e.id&&!e.uploading&&!e.error));function it(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(),Ue.value?.addFiles(n))}let at=x({get:()=>Y.value?Z.state(Y.value).text:``,set:e=>{Y.value&&Z.setText(Y.value,e)}}),ot=x(()=>Y.value?Z.unresolved(Y.value)[0]??null:null),st=x(()=>Y.value?Z.saved(Y.value).filter(e=>e.text!==at.value):[]),ct=e(!1),lt=e(``);async function ut(){let e=Q.value;if(!e||K.value||ct.value||document.hidden)return;let t=Z.unresolved(e.key);if(!t.length)return;let n=Z.generation;ct.value=!0;try{let r=await $(tn(e)+`/messages/status`,`POST`,{messageIds:t.slice(0,20).map(e=>e.messageId)});if(n!==Z.generation)return;for(let n of r.confirmed??[]){let r=t.find(e=>e.messageId===n);r&&(He.consume(e.key,r.attachmentIds??[]),Z.confirm(e.key,n))}Q.value?.key===e.key&&(lt.value=r.confirmed?.length?`Delivery confirmed from conversation history.`:`Not confirmed yet. No message has been resent.`)}catch{Q.value?.key===e.key&&(lt.value=`Unable to check delivery. Your message remains saved.`)}finally{ct.value=!1}}let dt=setInterval(()=>void ut(),15e3);n([Y,K],()=>{lt.value=``,ut()});function ft(){Y.value&&ot.value&&Z.resolve(Y.value,ot.value.messageId)}function pt(e){e.storageArea===localStorage&&(e.key===`litepaseo-composer-signout`?Z.clear():Z.onStorage(e.key,e.newValue))}window.addEventListener(`storage`,pt);let mt=x(()=>new Map(q.value.map(e=>[e.id,e.label]))),ht=x(()=>new Map(q.value.map(e=>[e.id,e.state]))),gt=x(()=>q.value.filter(e=>e.state===`connected`).length),Q=x(()=>(ve.version.value,ve.get(Y.value)??null)),_t=x(()=>(J.version.value,J.get(ye.value)??null)),vt=x(()=>(ve.version.value,ve.indexed(ye.value,12))),yt=x(()=>(J.version.value,J.total)),bt=x(()=>(J.version.value,J.size)),xt=x(()=>(J.version.value,J.projectCount));n(be,e=>localStorage.setItem(`litepaseo-list-mode`,e));let St=e(localStorage.getItem(`litepaseo-host-filter`));n(St,e=>{J.setHost(e),ve.setHost(e),e?localStorage.setItem(`litepaseo-host-filter`,e):localStorage.removeItem(`litepaseo-host-filter`)},{immediate:!0}),n(q,e=>{St.value&&e.length&&!e.some(e=>e.id===St.value)&&(St.value=null)});let Ct=x(()=>(J.version.value,new Map(q.value.map(e=>[e.id,J.hostSize(e.id)])))),wt=x(()=>_t.value?.directory||Q.value?.cwd||``),Tt=x(()=>{let e=Q.value?.cwd??``;return e.replace(/\/+$/,``).split(`/`).pop()||e}),Et=x(()=>Q.value?.status===`running`),Dt=x(()=>!we.value&&Q.value?.state===`running`),Ot=e(Date.now()),At=x(()=>Dt.value?Q.value?.turnStartedAt??null:null),jt=x(()=>At.value?Go(Ot.value-At.value):``),Mt=x(()=>At.value?Math.max(0,Math.floor((Ot.value-At.value)/1e3)):0),Nt;function Pt(){clearTimeout(Nt),Nt=void 0;let e=At.value;if(!e||document.hidden)return;let t=()=>{Ot.value=Date.now();let n=(Ot.value-e)%1e3;Nt=setTimeout(t,(n<0?-n:1e3-n)+10)};t()}n(At,Pt,{immediate:!0}),document.addEventListener(`visibilitychange`,Pt);let Ft=x(()=>{if(we.value)return we.value;let e=Se.value;return e.membership.value,e.rows.slice(-150)}),It=x(()=>xe.value===`live`&&ht.value.get(Q.value?.hostId??``)===`connected`&&Q.value?.turnActive===!1),Lt=x(()=>{let e=Ft.value.map(e=>e.row.value),t=Q.value;return nt(e,!!we.value&&De.value.length>0||!!t&&!(t.turnActive??t.state===`running`))}),Rt=e(null),zt;async function Bt(e,t){let n=new Set(t),r=Ft.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),Rt.value=e,clearTimeout(zt),zt=setTimeout(()=>Rt.value=null,1500)}catch{}}let Vt=v({base:``,cwd:``});n(Q,e=>{let t=e?`/api`+tn(e):``;(t!==Vt.value.base||(e?.cwd??``)!==Vt.value.cwd)&&(Vt.value={base:t,cwd:e?.cwd??``})},{immediate:!0}),o(Re,Vt);let Ut=e(null);function Wt(e){let t=e.target;t instanceof HTMLImageElement&&t.closest(`.prose`)&&(Ut.value=t.currentSrc||t.src)}let Gt=x(()=>{let e=Se.value;return e.membership.value,e.rows.at(-1)?.seqStart}),Jt=x(()=>{if(we.value)return Ee.value;let e=Se.value;return e.membership.value,e.rows.length>150||e.hasOlder}),Yt=x(()=>{let e=new Map(m.map(e=>[e,[]]));for(let t of Ve.value.cards)e.get(t.column)?.push(t);return e}),Xt=x(()=>xe.value===`live`?`Live`:xe.value===`paused`?`Paused`:`Reconnecting`),Zt=null,Qt=null,$t;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&&he.value&&e!==`/login`&&nn(`ended`),!i.ok)throw Object.assign(Error((a.error??`Request failed`)+(a.requestId?` (reference ${a.requestId})`:``)),{delivery:a.delivery});return a}async function en(e){K.value=!0,ge.value=``;try{await e()}catch(e){ge.value=String(e.message)}finally{K.value=!1}}function tn(e){return`/hosts/${encodeURIComponent(e.hostId)}/agents/${encodeURIComponent(e.id)}`}function nn(e){if(he.value=!1,e===`user`){Z.clear(),He.clear();try{localStorage.setItem(`litepaseo-composer-signout`,crypto.randomUUID())}catch{}}else He.forgetRemote(`Sign in again, then retry the upload.`);Zt?.close(),Qt?.close(),Zt=Qt=null,de.value=fe.value=``,rn(),ge.value=e===`ended`?`Your session ended. Sign in again; your drafts are kept.`:``}async function rn(){try{pe.value=await $(`/auth`)}catch{pe.value={authenticated:!1,totp:!1};return}pe.value.authenticated&&await on()}async function an(){await en(async()=>{await $(`/login`,`POST`,{token:de.value.trim(),...pe.value?.totp?{code:fe.value.trim()}:{}}),de.value=fe.value=``,await on()})}async function on(){he.value=!0,ge.value=``,Ve.value=await $(`/board`),cn(),ji(),Kt(),qn(),Je(),clearInterval(Kn),Kn=setInterval(()=>void qn(),3e5);let e=new URLSearchParams(location.search).get(`session`);e&&(history.replaceState(history.state,``,`/`),fn(e))}function sn(){fe.value=fe.value.replace(/\D/g,``).slice(0,6)}navigator.serviceWorker?.addEventListener(`message`,e=>{e.data?.type===`open-session`&&he.value&&fn(String(e.data.key))});function cn(){Zt?.close(),Zt=Le({url:()=>`/api/stream?generation=${encodeURIComponent(ve.generation)}&since=${ve.seq}&wgeneration=${encodeURIComponent(J.generation)}&wsince=${J.seq}`,onState:e=>{xe.value=e,e===`unauthorized`&&nn(`ended`)},onMessage:e=>{let t=e;t.type===`hosts`?q.value=t.hosts:t.type===`workspaces-snapshot`?J.applyCollection({type:`snapshot`,generation:t.generation,seq:t.seq,items:t.workspaces}):t.type===`workspaces-changes`?J.applyCollection({type:`changes`,generation:t.generation,seq:t.seq,changes:t.changes}):ve.apply(t)}})}n(je,e=>{clearTimeout($t),$t=setTimeout(()=>{let t=e.trim().toLowerCase();if(!t){J.setFilter(null),ve.setFilter(null);return}let n=mt.value;J.setFilter(e=>`${e.name}\n${e.project}\n${e.branch??``}\n${e.directory}\n${n.get(e.hostId)??``}`.toLowerCase().includes(t)),ve.setFilter(e=>`${e.title??``}\n${e.project}\n${e.cwd}\n${n.get(e.hostId)??``}\n${e.provider}`.toLowerCase().includes(t))},120)});let ln=!0;n(Oe,(e,t,n)=>{let r=e?.querySelector(`.timeline-inner`);if(!e||!r)return;let i=e.scrollTop,a=()=>{let t=e.scrollTop;un()?ln=!0:t<i-1&&(ln=!1),i=t},o=new ResizeObserver(()=>{!we.value&&ln&&dn()});e.addEventListener(`scroll`,a,{passive:!0}),o.observe(r),o.observe(e),n(()=>{o.disconnect(),e.removeEventListener(`scroll`,a)})},{flush:`post`});function un(){let e=Oe.value;return!e||e.scrollHeight-e.scrollTop-e.clientHeight<120}function dn(){ln=!0,S(()=>{let e=Oe.value;e&&(e.scrollTop=e.scrollHeight)})}function fn(e){ze.value=`chat`,Y.value=e;let t=ve.get(e);ye.value=t?.workspaceId?`${t.hostId}:${t.workspaceId}`:null,hn()}function pn(e){ze.value=`chat`,ye.value=e,Y.value=ve.indexed(e,1)[0]?.key??null,hn()}n(Q,e=>{e?.workspaceId&&!ye.value&&(ye.value=`${e.hostId}:${e.workspaceId}`)}),n(vt,e=>{ye.value&&e.length&&!e.some(e=>e.key===Y.value)&&(Y.value=e[0].key)});let mn=matchMedia(`(max-width: 760px)`);function hn(){!Ne.value&&mn.matches&&history.pushState({litepaseoDetail:!0},``),Ne.value=!0}function gn(){history.state?.litepaseoDetail?history.back():Ne.value=!1}function _n(){Ne.value&&!history.state?.litepaseoDetail&&(Ne.value=!1)}window.addEventListener(`popstate`,_n);let vn=e(null);function yn(e){let t=e.target,n=!!t&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName));e.key===`Escape`&&Ut.value?Ut.value=null:e.key===`k`&&(e.metaKey||e.ctrlKey)||e.key===`/`&&!n?(e.preventDefault(),Ne.value&&mn.matches&&gn(),vn.value?.focus(),vn.value?.select()):e.key===`n`&&!n&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&he.value&&!bn.value?(e.preventDefault(),xn()):e.key===`Escape`&&t===vn.value&&je.value&&(je.value=``)}window.addEventListener(`keydown`,yn);let bn=e(null);function xn(e){let t=e?e.items.at(0):J.range(0,1)[0];bn.value={hostId:St.value??t?.hostId??Q.value?.hostId??null,cwd:t?.rootPath??null,project:t?{key:t.projectKey,name:t.project}:null}}function Sn(e){bn.value=null,je.value&&=``,fn(e)}let Cn=x(()=>(!!Y.value||!!ye.value)&&!Q.value),wn=v(null),Tn=v(null);function En(e){return`/hosts/${encodeURIComponent(e.hostId)}/workspaces/${encodeURIComponent(e.id)}`}function Dn(e,t,n){wn.value={thread:e,x:t,y:n}}function On(e){let t=_t.value;if(!t)return;let n=e.currentTarget.getBoundingClientRect();Dn(t,n.right-200,n.bottom+6)}async function kn(e){let t=Tn.value;t&&await en(async()=>{await $(En(t)+`/title`,`POST`,{title:e}),Tn.value=null})}async function An(e,t){await en(async()=>void await $(En(e)+`/pin`,`POST`,{pinned:t}))}async function jn(e){await en(async()=>{await $(En(e)+`/unread`,`POST`,{}),ye.value===e.key&&(ye.value=Y.value=null,gn())})}async function Mn(e){await en(async()=>void await $(En(e)+`/read`,`POST`,{}))}async function Nn(e){confirm(`Archive “${e.name}”? It leaves the sidebar; the host keeps its history.`)&&await en(async()=>{await $(En(e)+`/archive`,`POST`,{}),ye.value===e.key&&(ye.value=Y.value=null)})}let Pn=``;n(()=>_t.value?.unread&&Se.value.membership.value>=0&&Se.value.ready?_t.value:null,e=>{if(!e||document.hidden)return;let t=`${e.key}@${e.activityAt}`;Pn!==t&&(Pn=t,$(En(e)+`/read`,`POST`,{}).catch(()=>Pn=``))});let Fn=e(localStorage.getItem(`litepaseo-board-mode`)===`plan`?`plan`:`agents`);n(Fn,e=>localStorage.setItem(`litepaseo-board-mode`,e));async function Ln(e){await en(async()=>void await $(tn(e)+`/stop`,`POST`))}async function Rn(e){await en(async()=>void await $(tn(e)+`/read`,`POST`,{}))}async function zn(e){confirm(`Archive “${e.title||`this session`}”? It leaves the board and sidebar; the host keeps its history.`)&&await en(async()=>void await $(tn(e)+`/archive`,`POST`,{}))}let Bn=``;n(()=>Q.value&&Q.value.unread&&Se.value.membership.value>=0&&Se.value.ready?Q.value:null,e=>{if(!e||document.hidden)return;let t=`${e.key}@${e.activityAt}`;Bn!==t&&(Bn=t,$(tn(e)+`/read`,`POST`,{}).catch(()=>Bn=``))});let Vn=e(null);o(qt,{predict:e=>{let t=Q.value;return t?$(tn(t)+`/suggestion`,`POST`,{token:e},65e3):Promise.resolve({status:`expired`,text:``})},use:e=>{at.value=e,S(()=>{Xn(),Ae.value?.focus()})},send:e=>void $n(e),offer:(e,t)=>{let n=Q.value;n&&(!Vn.value||Vn.value.key!==n.key||e>=Vn.value.seqStart)&&(Vn.value={key:n.key,seqStart:e,text:t})}});let Hn=x(()=>Vn.value&&Vn.value.key===Q.value?.key&&!at.value?Vn.value.text:``),Un=x(()=>Hn.value&&!C?Hn.value:Et.value?X.value===`steer`?`Interject to steer the current turn`:`Interrupt and send a new message`:`Message this agent…`),Wn=v(null),Gn=e(!1),Kn;async function qn(e=!1){if(he.value&&!document.hidden){Gn.value=!0;try{Wn.value=await $(`/usage`+(e?`?refresh=1`:``))}catch{}finally{Gn.value=!1}}}n(Y,()=>{Vn.value=null}),n(()=>Q.value?.key??null,e=>{Qt?.close(),Qt=null;let t=new Me;Se.value=t,we.value=null,De.value=[],Ce.value=``;let n=ve.get(e);n&&(Qt=Le({url:()=>`/api`+tn(n)+`/timeline/stream`,onState:e=>{e===`unauthorized`&&nn(`ended`)},onMessage:e=>{if(Se.value!==t)return;let n=!we.value&&(un()||!t.ready),r=e.ops,i=r.find(e=>e.type===`error`);Ce.value=i?.type===`error`?i.message:``;let a=t.epoch;t.apply(r),a&&a!==t.epoch&&(we.value=null,De.value=[],dn()),n&&dn()}}))});function Jn(){we.value=null,De.value=[],dn()}async function Yn(e){let t=Se.value,n=Oe.value,r=Ft.value.map(e=>({seqStart:e.seqStart,row:v(e.row.value)})),i=e===`before`?r[0]:r.at(-1),a=Q.value;if(!a||!i)return;let o=t.epoch,s=n?.getBoundingClientRect(),c=n?Array.from(n.querySelectorAll(`[data-seq-start]`)).filter(e=>e.getBoundingClientRect().bottom>s.top&&e.getBoundingClientRect().top<s.bottom):[],l=e===`before`?c[0]:c.at(-1),u=l?.dataset.seqStart,d=l?.getBoundingClientRect().top,f=e===`before`?i.seqStart:De.value.at(-1);if(f===void 0)return;let p={epoch:o,seq:f};await en(async()=>{let i=await $(tn(a)+`/timeline?cursor=`+encodeURIComponent(JSON.stringify(p)));if(Se.value!==t||t.epoch!==o)return;if(i.epoch!==o){Jn();return}let s=Pe(r,i,e);if(e===`after`&&!s.added){Jn();return}e===`before`&&s.added&&De.value.push(r.at(-1).seqStart+1),e===`after`&&De.value.pop(),we.value=s.rows,Ee.value=s.hasOlder,await S();let c=n?.querySelector(`[data-seq-start="${u}"]`);n&&c&&d!==void 0?n.scrollTop+=c.getBoundingClientRect().top-d:n&&(n.scrollTop=e===`before`?0:n.scrollHeight)})}function Xn(){let e=Ae.value;e&&(e.style.height=`auto`,e.style.height=Math.min(e.scrollHeight,Math.round(window.innerHeight*.4))+`px`)}function Zn(e){e.key===`Tab`&&!e.shiftKey&&Hn.value?(e.preventDefault(),at.value=Hn.value,S(Xn)):e.key!==`Enter`||e.isComposing||(!C&&!e.shiftKey||e.metaKey||e.ctrlKey)&&(e.preventDefault(),Qn())}async function Qn(){await $n(at.value,!0)}async function $n(e,t=!1){let n=Q.value;if(!n||!e.trim()&&(!t||!We.value.length)||ot.value||K.value||t&&!rt.value)return;let r=Z.state(n.key),i=Z.generation,a=t?[...We.value]:[],o={text:e,messageId:crypto.randomUUID(),attachmentIds:a.map(e=>e.id),attachmentNames:a.map(e=>e.file.name)};Z.begin(n.key,o),t&&Z.setText(n.key,``),await en(async()=>{try{if(await $(tn(n)+`/messages`,`POST`,{...o,behavior:X.value}),i!==Z.generation)return;Z.resolve(n.key,o.messageId),He.consume(n.key,o.attachmentIds),Y.value===n.key&&(Vn.value=null),S(Xn),Y.value===n.key&&Jn()}catch(e){if(i!==Z.generation)return;if(t&&!r.text&&Z.restoreFailed(n.key,o),e.delivery===`not-sent`){Z.resolve(n.key,o.messageId);for(let e of a)e.error=`Not sent. Retry the upload or remove this attachment.`}throw e}})}async function er(){let e=Q.value;e&&await en(async()=>void await $(tn(e)+`/stop`,`POST`))}async function tr(e,t){let n=Q.value;n&&await en(async()=>{await $(tn(n)+`/permissions/`+encodeURIComponent(e.id),`POST`,t)})}async function nr(){await en(async()=>{await $(`/hosts`,`POST`,{label:Fe.value,connection:Ie.value}),Fe.value=``,Ie.value=``})}async function rr(e){confirm(`Disconnect and remove ${e.label}? Its agents keep running on the host.`)&&await en(async()=>void await $(`/hosts/`+e.id,`DELETE`))}async function ir(e){try{Ve.value=await $(`/board`,`PUT`,{revision:Ve.value.revision,cards:e})}catch(e){throw Ve.value=await $(`/board`),e}}async function ar(){await en(async()=>{Be.value.trim()&&(await ir([...Ve.value.cards,{id:crypto.randomUUID(),title:Be.value,column:`Todo`,hostId:Q.value?.hostId??null,agentId:Q.value?.id??null}]),Be.value=``)})}async function or(e,t){await en(()=>ir(Ve.value.cards.map(n=>n.id===e.id?{...n,column:t}:n)))}function sr(e){e.hostId&&e.agentId&&fn(`${e.hostId}:${e.agentId}`)}function cr(e){ze.value=e,e!==`chat`||Y.value?hn():gn()}rn();let lr=x(()=>(J.version.value,ve.waiting));n(lr,e=>{Ri(e),document.title=e?`(${e}) LitePaseo`:`LitePaseo`});let ur=x(()=>(ve.version.value,ve.waiting?`attention`:ve.allLaneSize(`running`)?`running`:ve.allLaneSize(`review`)?`unread`:``));return n(ur,e=>zi(e),{immediate:!0}),document.addEventListener(`visibilitychange`,()=>{document.hidden||qn()}),c(()=>{clearInterval(Kn),clearInterval(dt),clearTimeout(Nt),document.removeEventListener(`visibilitychange`,Pt),He.clear(),window.removeEventListener(`storage`,pt),window.removeEventListener(`popstate`,_n),window.removeEventListener(`keydown`,yn),Zt?.close(),Qt?.close(),clearTimeout($t)}),(e,n)=>he.value?(i(),I(`div`,{key:1,class:j([`shell`,{"detail-open":Ne.value,"is-resizing":W.value}]),style:h({"--sidebar-w":oe.value+`px`})},[b(`aside`,Lc,[b(`div`,{class:j([`sidebar-resize`,{"is-dragging":W.value}]),role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,"aria-valuenow":oe.value,"aria-valuemin":Bu,"aria-valuemax":Vu,tabindex:`0`,title:`Drag to resize · double-click to reset`,onPointerdown:le,onDblclick:n[2]||=e=>ce(Hu),onKeydown:[n[3]||=N(_(e=>ce(oe.value-16),[`prevent`]),[`left`]),n[4]||=N(_(e=>ce(oe.value+16),[`prevent`]),[`right`])]},null,42,Rc),b(`nav`,zc,[b(`label`,{class:j([`side-row side-search`,{active:!!je.value}])},[t(G,{name:`search`,size:15}),a(b(`input`,{ref_key:`searchInput`,ref:vn,"onUpdate:modelValue":n[5]||=e=>je.value=e,type:`search`,placeholder:`Search`,"aria-label":`Search sessions, projects, hosts`,"aria-keyshortcuts":`/ Control+K Meta+K`},null,512),[[g,je.value]]),b(`kbd`,Bc,O(E(T)?`⌘K`:`Ctrl K`),1)],2),b(`button`,{class:j([`side-row`,{chosen:ze.value===`board`}]),onClick:n[6]||=e=>cr(`board`)},[t(G,{name:`board`,size:15}),n[53]||=u(`Kanban `,-1)],2)]),b(`div`,Vc,[b(`span`,Hc,O(be.value===`projects`?`Workspaces`:`Recent`),1),b(`span`,Uc,O(be.value===`projects`?xt.value:bt.value),1),b(`button`,{class:j([`icon-btn side-tool`,{chosen:D.value||St.value!==null||be.value!==`projects`}]),"aria-label":`View options`,title:`Group and filter`,"aria-expanded":D.value,onClick:n[7]||=e=>D.value=!D.value},[t(G,{name:`sliders`,size:15})],10,Wc)]),D.value?(i(),I(`div`,Gc,[b(`div`,Kc,[b(`button`,{role:`radio`,"aria-checked":be.value===`projects`,class:j({chosen:be.value===`projects`}),onClick:n[8]||=e=>be.value=`projects`},` By project `,10,qc),b(`button`,{role:`radio`,"aria-checked":be.value===`recent`,class:j({chosen:be.value===`recent`}),onClick:n[9]||=e=>be.value=`recent`},`Recent`,10,Jc)]),q.value.length>1?(i(),I(`div`,Yc,[b(`button`,{role:`radio`,"aria-checked":St.value===null,class:j({chosen:St.value===null}),onClick:n[10]||=e=>St.value=null},[n[54]||=u(` All`,-1),b(`span`,Zc,O(yt.value),1)],10,Xc),(i(!0),I(y,null,L(q.value,e=>(i(),I(`button`,{key:e.id,role:`radio`,"aria-checked":St.value===e.id,class:j({chosen:St.value===e.id}),title:e.label+` · `+e.state,onClick:t=>St.value=e.id},[b(`span`,{class:j([`status-dot`,e.state===`connected`?`is-idle-ok`:`is-offline`])},null,2),u(O(e.label),1),b(`span`,$c,O(Ct.value.get(e.id)),1)],10,Qc))),128))])):P(``,!0)])):P(``,!0),t(kt,{mode:be.value,store:E(J),"host-labels":mt.value,"host-states":ht.value,"selected-key":ye.value,searching:!!je.value.trim(),onSelect:pn,onNew:xn,onMenu:Dn},null,8,[`mode`,`store`,`host-labels`,`host-states`,`selected-key`,`searching`]),t(Wo,{report:Wn.value,loading:Gn.value,onRefresh:n[11]||=e=>qn(!0)},null,8,[`report`,`loading`]),b(`div`,el,[b(`span`,{class:j([`live`,`is-`+xe.value]),title:`Directory stream: `+xe.value},[n[55]||=b(`span`,{class:`live-dot`},null,-1),u(O(Xt.value),1)],10,tl),b(`button`,{class:j([`icon-btn`,{chosen:ze.value===`schedules`}]),title:`Schedules`,"aria-label":`Schedules`,onClick:n[12]||=e=>cr(`schedules`)},[t(G,{name:`clock`,size:15})],2),b(`button`,{class:j([`icon-btn foot-hosts`,{chosen:ze.value===`hosts`}]),title:`Hosts: ${gt.value} of ${q.value.length} connected`,"aria-label":`Hosts, ${gt.value} of ${q.value.length} connected`,onClick:n[13]||=e=>cr(`hosts`)},[t(G,{name:`server`,size:15}),gt.value<q.value.length?(i(),I(`span`,rl)):P(``,!0)],10,nl),b(`button`,{class:`icon-btn`,title:`Theme: `+E(fi)+` (click to change)`,"aria-label":`Theme: `+E(fi),onClick:n[14]||=(...e)=>E(vi)&&E(vi)(...e)},[t(G,{name:E(fi)===`dark`?`moon`:E(fi)===`light`?`sun`:`monitor`,size:15},null,8,[`name`])],8,il),b(`button`,{class:j([`icon-btn`,{chosen:ze.value===`settings`}]),title:`Settings`,"aria-label":`Settings`,onClick:n[15]||=e=>cr(`settings`)},[t(G,{name:`gear`,size:15})],2)])]),b(`main`,al,[ge.value?(i(),I(`div`,ol,[t(G,{name:`alert`,size:15}),b(`span`,null,O(ge.value),1),b(`button`,{class:`icon-btn`,"aria-label":`Dismiss`,onClick:n[16]||=e=>ge.value=``},[t(G,{name:`close`,size:14})])])):P(``,!0),ze.value===`settings`?(i(),p(mo,{key:1,request:$,"totp-enabled":!!pe.value?.totp,onBack:gn,onSignedOut:n[17]||=e=>nn(`user`),onTotpChanged:n[18]||=e=>pe.value&&(pe.value.totp=e),onDictationChanged:n[19]||=e=>Ge.value=e},null,8,[`totp-enabled`])):ze.value===`hosts`?(i(),I(`section`,sl,[b(`header`,cl,[b(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:gn},[t(G,{name:`back`,size:18})]),n[56]||=b(`div`,null,[b(`h1`,null,`Hosts`),b(`p`,{class:`subtle`},`Paseo daemons this console connects to. Secrets stay on this server.`)],-1)]),b(`div`,ll,[b(`div`,ul,[(i(!0),I(y,null,L(q.value,e=>(i(),I(`div`,{key:e.id,class:`card-row`},[b(`span`,{class:j([`status-dot`,e.state===`connected`?`is-idle-ok`:`is-offline`])},null,2),b(`div`,dl,[b(`div`,fl,O(e.label),1),b(`div`,pl,O(e.state),1),e.diagnostic?.error?(i(),I(`p`,ml,O(e.diagnostic.error.message),1)):P(``,!0),e.diagnostic?.lastConnectedAt?(i(),I(`div`,hl,`Last connected: `+O(new Date(e.diagnostic.lastConnectedAt).toLocaleString()),1)):P(``,!0),e.diagnostic?.attempt?(i(),I(`div`,gl,`Connection attempt `+O(e.diagnostic.attempt),1)):P(``,!0),e.diagnostic?.nextRetryAt?(i(),I(`div`,_l,`Next retry: `+O(new Date(e.diagnostic.nextRetryAt).toLocaleString()),1)):P(``,!0)]),b(`button`,{class:`btn btn-outline`,disabled:K.value,onClick:t=>rr(e)},`Remove`,8,vl)]))),128)),q.value.length?P(``,!0):(i(),I(`div`,yl,`No hosts yet.`))]),n[60]||=b(`h2`,{class:`section-label`},`Add a host`,-1),b(`form`,{class:`card form-card`,onSubmit:_(nr,[`prevent`])},[b(`label`,bl,[n[57]||=b(`span`,null,`Name`,-1),a(b(`input`,{"onUpdate:modelValue":n[20]||=e=>Fe.value=e,placeholder:`Build server`,required:``},null,512),[[g,Fe.value]])]),b(`label`,xl,[n[58]||=b(`span`,null,`Connection`,-1),a(b(`input`,{"onUpdate:modelValue":n[21]||=e=>Ie.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,Ie.value]])]),n[59]||=ee(`<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),b(`div`,Sl,[b(`button`,{class:`btn btn-primary`,disabled:K.value},`Add host`,8,Cl)])],32)])])):ze.value===`schedules`?(i(),p(Tc,{key:3,hosts:q.value,api:$,onBack:gn,onOpenAgent:fn},null,8,[`hosts`])):ze.value===`board`?(i(),I(`section`,wl,[b(`header`,Tl,[b(`button`,{class:`icon-btn back`,"aria-label":`Back`,onClick:gn},[t(G,{name:`back`,size:18})]),b(`div`,null,[n[61]||=b(`h1`,null,`Kanban`,-1),b(`p`,El,O(Fn.value===`agents`?`Every agent by state, live. Follows the host filter and search.`:`Your own plan. Moving a card never changes an agent.`),1)]),b(`div`,Dl,[b(`button`,{class:j({chosen:Fn.value===`agents`}),onClick:n[22]||=e=>Fn.value=`agents`},`Agents`,2),b(`button`,{class:j({chosen:Fn.value===`plan`}),onClick:n[23]||=e=>Fn.value=`plan`},`Plan`,2)])]),b(`div`,Ol,[Fn.value===`agents`?(i(),p(ko,{key:0,store:E(ve),"host-labels":mt.value,busy:K.value,onOpen:fn,onStop:Ln,onRead:Rn,onArchive:zn},null,8,[`store`,`host-labels`,`busy`])):(i(),I(y,{key:1},[b(`form`,{class:`add-card`,onSubmit:_(ar,[`prevent`])},[a(b(`input`,{"onUpdate:modelValue":n[24]||=e=>Be.value=e,placeholder:`New task`,required:``},null,512),[[g,Be.value]]),b(`button`,{class:`btn btn-primary`,disabled:K.value},[t(G,{name:`plus`,size:15}),n[62]||=u(`Add task`,-1)],8,kl)],32),Q.value?(i(),I(`p`,Al,`New tasks link to “`+O(Q.value.title||Q.value.id)+`”.`,1)):P(``,!0),b(`div`,jl,[(i(),I(y,null,L(m,e=>b(`div`,{key:e,class:`column`},[b(`div`,Ml,[b(`h3`,null,O(e),1),b(`span`,Nl,O(Yt.value.get(e).length),1)]),(i(!0),I(y,null,L(Yt.value.get(e),e=>(i(),I(`article`,{key:e.id,class:`card kanban-card`},[b(`div`,Pl,O(e.title),1),e.agentId?(i(),I(`button`,{key:0,class:`link-btn`,onClick:t=>sr(e)},[t(G,{name:`chat`,size:13}),n[63]||=u(`Open conversation `,-1)],8,Fl)):P(``,!0),b(`div`,Il,[b(`select`,{value:e.column,onChange:t=>or(e,t.target.value)},[(i(),I(y,null,L(m,e=>b(`option`,{key:e},O(e),1)),64))],40,Ll),b(`button`,{class:`icon-btn`,"aria-label":`Remove`,onClick:t=>en(()=>ir(Ve.value.cards.filter(t=>t.id!==e.id)))},[t(G,{name:`trash`,size:15})],8,Rl)])]))),128)),Yt.value.get(e).length?P(``,!0):(i(),I(`p`,zl,`Nothing here`))])),64))])],64))])])):Q.value?(i(),I(`div`,{key:5,class:`chat-split`,style:h({"--panel-w":re.value+`px`})},[b(`section`,Bl,[b(`header`,Vl,[b(`button`,{class:`icon-btn back`,"aria-label":`Back to sessions`,onClick:gn},[t(G,{name:`back`,size:18})]),b(`span`,{class:j([`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,Hl),b(`h1`,{class:`chat-title`,title:_t.value?.name||Q.value.title||``},[_t.value?.pinnedAt?(i(),p(G,{key:0,name:`pin`,size:12,class:`title-pin`})):P(``,!0),u(O(_t.value?.name||Q.value.title||`Untitled session`),1)],8,Ul),b(`span`,{class:`chat-context hide-sm`,title:[Tt.value,mt.value.get(Q.value.hostId),_t.value?.branch,Q.value.provider].filter(Boolean).join(` · `)},[u(O(Tt.value),1),q.value.length>1?(i(),I(y,{key:0},[u(` · `+O(mt.value.get(Q.value.hostId)),1)],64)):P(``,!0),_t.value?.branch?(i(),I(y,{key:1},[u(` · `+O(_t.value.branch),1)],64)):P(``,!0)],8,Wl),n[64]||=b(`span`,{class:`grow`},null,-1),b(`button`,{class:j([`icon-btn head-tool`,{chosen:A.value===`files`}]),"aria-label":`Files`,title:`Files`,onClick:n[25]||=e=>M(`files`)},[t(G,{name:`folder`,size:16})],2),b(`button`,{class:j([`icon-btn head-tool`,{chosen:A.value===`terminal`}]),"aria-label":`Terminal`,title:`Terminal`,onClick:n[26]||=e=>M(`terminal`)},[t(G,{name:`terminal`,size:16})],2),_t.value?(i(),I(`button`,{key:0,class:`icon-btn head-tool`,"aria-label":`Thread actions`,title:`Rename, pin, mark unread, archive`,onClick:On},[t(G,{name:`more`,size:16})])):P(``,!0)]),vt.value.length>1||te.value.length?(i(),I(`nav`,Gl,[(i(!0),I(y,null,L(vt.value.length?vt.value:[Q.value],e=>(i(),I(`button`,{key:e.key,class:j({chosen:e.key===Y.value&&!B.value}),onClick:t=>{Y.value=e.key,B.value=null}},[b(`span`,{class:j([`status-dot`,`is-`+(e.attention?`attention`:e.state===`failed`?`error`:e.state===`running`?`running`:e.unread?`unread`:`idle`)])},null,2),b(`span`,ql,O(e.title||e.provider),1)],10,Kl))),128)),(i(!0),I(y,null,L(te.value,e=>(i(),I(`button`,{key:`file:`+e,class:j([`file-tab`,{chosen:B.value===e}]),title:e,onClick:t=>B.value=e,onAuxclick:_(t=>t.button===1&&H(e),[`prevent`])},[t(G,{name:`file`,size:13}),b(`span`,Yl,O(e.split(`/`).pop()),1),b(`span`,{class:`tab-close`,role:`button`,"aria-label":`Close `+e,onClick:_(t=>H(e),[`stop`])},[t(G,{name:`close`,size:11})],8,Xl)],42,Jl))),128))])):P(``,!0),B.value?(i(),p(E(d),{key:Q.value.hostId+`:`+wt.value+`:`+B.value,"host-id":Q.value.hostId,cwd:wt.value,path:B.value,api:$},null,8,[`host-id`,`cwd`,`path`])):P(``,!0),a(b(`div`,{ref_key:`timelineElement`,ref:Oe,class:`timeline`,onClick:Wt},[b(`div`,Zl,[Jt.value?(i(),I(`div`,Ql,[b(`button`,{class:`btn btn-ghost`,disabled:K.value,onClick:n[27]||=e=>Yn(`before`)},`Show earlier messages`,8,$l)])):P(``,!0),Ce.value?(i(),I(`p`,eu,[t(G,{name:`alert`,size:14}),u(O(Ce.value),1)])):P(``,!0),(i(!0),I(y,null,L(Ft.value,e=>(i(),I(y,{key:`${Q.value?.key}:${Se.value.epoch}:${e.seqStart}`},[t(In,{entry:e.row,final:e.seqStart!==Gt.value||It.value,"data-seq-start":e.seqStart},null,8,[`entry`,`final`,`data-seq-start`]),Lt.value.get(e.seqStart)?(i(),I(`div`,tu,[Lt.value.get(e.seqStart).messages.length?(i(),I(`button`,{key:0,type:`button`,class:`icon-btn`,"aria-label":Rt.value===e.seqStart?`Copied`:`Copy turn`,title:Rt.value===e.seqStart?`Copied`:`Copy turn`,onClick:t=>Bt(e.seqStart,Lt.value.get(e.seqStart).messages)},[t(G,{name:Rt.value===e.seqStart?`check`:`copy`,size:14},null,8,[`name`])],8,nu)):P(``,!0),b(`span`,null,O(Lt.value.get(e.seqStart).at),1),Lt.value.get(e.seqStart).took?(i(),I(`span`,ru,`Worked for `+O(Lt.value.get(e.seqStart).took),1)):P(``,!0)])):P(``,!0)],64))),128)),we.value?(i(),I(`div`,iu,[De.value.length?(i(),I(`button`,{key:0,class:`btn btn-ghost`,disabled:K.value,onClick:n[28]||=e=>Yn(`after`)},`Show newer messages`,8,au)):P(``,!0),b(`button`,{class:`btn btn-ghost`,disabled:K.value,onClick:Jn},`Back to latest`,8,ou)])):P(``,!0),Dt.value?(i(),I(`div`,su,[b(`span`,{class:`spinner spinner-ticked`,style:h(jt.value?{transform:`rotate(${Mt.value*90}deg)`}:void 0)},null,4),jt.value?(i(),I(`span`,cu,O(jt.value),1)):(i(),I(`span`,lu,`Working…`))])):P(``,!0),Ft.value.length?P(``,!0):(i(),I(`div`,uu,[Se.value.ready?P(``,!0):(i(),I(`span`,du)),u(` `+O(Se.value.ready?`No messages yet.`:`Loading conversation…`),1)]))])],512),[[w,!B.value]]),a(b(`div`,fu,[b(`div`,pu,[(i(!0),I(y,null,L(Q.value.pendingPermissions,e=>(i(),p(ui,{key:Q.value.key+`:`+e.id,permission:e,busy:K.value,onRespond:t=>tr(e,t)},null,8,[`permission`,`busy`,`onRespond`]))),128)),lt.value?(i(),I(`p`,mu,O(lt.value),1)):P(``,!0),E(Z).warning.value?(i(),I(`p`,hu,O(E(Z).warning.value),1)):P(``,!0),Ye.value?(i(),I(`p`,gu,[t(G,{name:`alert`,size:13}),u(O(Ye.value)+` `,1),b(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Dismiss`,onClick:n[29]||=e=>Ye.value=``},[t(G,{name:`close`,size:12})])])):P(``,!0),st.value.length?(i(),I(`details`,_u,[b(`summary`,null,`Other saved drafts (`+O(st.value.length)+`)`,1),(i(!0),I(y,null,L(st.value,e=>(i(),I(`div`,{key:e.slot},[b(`p`,vu,O(e.text),1),b(`button`,{class:`btn btn-ghost`,onClick:t=>Y.value&&E(Z).restore(Y.value,e.slot)},`Restore draft`,8,yu)]))),128))])):P(``,!0),ot.value&&!K.value?(i(),I(`div`,bu,[t(G,{name:`alert`,size:15}),b(`span`,xu,`Delivery unknown. Check the conversation before sending again. Message: `+O(ot.value.text)+` `+O(ot.value.attachmentNames?.join(`, `)),1),b(`button`,{class:`btn btn-ghost`,disabled:ct.value,onClick:ut},O(ct.value?`Checking…`:`Check delivery`),9,Su),b(`button`,{class:`btn btn-ghost`,onClick:ft},`I checked`)])):P(``,!0),b(`form`,{class:j([`composer`,{"is-dragging":et.value}]),onSubmit:_(Qn,[`prevent`]),onDragover:n[34]||=_(e=>et.value=!0,[`prevent`]),onDragleave:tt,onDrop:n[35]||=_(e=>{et.value=!1,Ue.value?.addFiles(e.dataTransfer?.files)},[`prevent`]),onPaste:it},[t(Hr,{ref_key:`attachmentPanel`,ref:Ue,store:E(He),"agent-key":Q.value.key,base:`/api`+tn(Q.value),busy:K.value||!!ot.value},null,8,[`store`,`agent-key`,`base`,`busy`]),Ke.value?(i(),I(`div`,{key:0,ref_key:`dictationPreviewElement`,ref:qe,class:`dictation-preview`,role:`status`,"aria-live":`polite`},O(Ke.value),513)):P(``,!0),a(b(`textarea`,{ref_key:`composerElement`,ref:Ae,"onUpdate:modelValue":n[30]||=e=>at.value=e,rows:`1`,placeholder:Un.value,required:!We.value.length,onInput:Xn,onKeydown:Zn},null,40,Cu),[[g,at.value]]),b(`div`,wu,[b(`button`,{type:`button`,class:`composer-tool`,"aria-label":`Attach files`,title:Ue.value?.hint,disabled:K.value||!!ot.value||!Ue.value?.available,onClick:n[31]||=e=>Ue.value?.pick()},[t(G,{name:`plus`,size:18})],8,Tu),t(ws,{agent:Q.value,path:tn(Q.value),api:$,disabled:K.value||ht.value.get(Q.value.hostId)!==`connected`,onNotice:Ze},null,8,[`agent`,`path`,`disabled`]),b(`div`,Eu,[Et.value?(i(),I(`button`,{key:0,type:`button`,class:j([`chip-behavior`,`is-`+X.value]),"aria-label":X.value===`steer`?`Steer: your message joins the running turn (click for interrupt)`:`Interrupt: your message stops the running turn (click for steer)`,title:X.value===`steer`?`Steer: your message joins the running turn`:`Interrupt: your message stops the running turn and starts a new one`,onClick:n[32]||=e=>X.value=X.value===`steer`?`interrupt`:`steer`},O(X.value===`steer`?`Steer`:`Interrupt`),11,Du)):P(``,!0),Ge.value?(i(),p(jc,{key:Q.value.key,disabled:K.value,onText:Qe,onPreview:n[33]||=e=>Ke.value=e,onNotice:Ze},null,8,[`disabled`])):P(``,!0),Et.value?(i(),I(`button`,{key:2,type:`button`,class:j([`disc disc-stop`,{"is-primary":!$e.value}]),"aria-label":`Stop turn`,title:`Stop turn`,disabled:K.value,onClick:er},[t(G,{name:`stop`,size:18})],10,Ou)):P(``,!0),!Et.value||$e.value?(i(),I(`button`,{key:3,class:`disc disc-send`,"aria-label":`Send`,title:`Send (Enter) · Shift+Enter for a new line`,disabled:K.value||!!ot.value||!rt.value||!$e.value},[t(G,{name:`send`,size:17})],8,ku)):P(``,!0)])])],34)])],512),[[w,!B.value]])]),A.value?(i(),I(`aside`,{key:0,class:`side-panel`,"aria-label":A.value===`files`?`Files`:`Terminal`},[b(`div`,{class:`panel-resize`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize panel`,tabindex:`0`,onPointerdown:ie,onDblclick:n[36]||=e=>U(zu)},null,32),b(`div`,ju,[b(`button`,{class:j({chosen:A.value===`files`}),onClick:n[37]||=e=>A.value=`files`},[t(G,{name:`folder`,size:14}),n[65]||=u(`Files`,-1)],2),b(`button`,{class:j({chosen:A.value===`terminal`}),onClick:n[38]||=e=>A.value=`terminal`},[t(G,{name:`terminal`,size:14}),n[66]||=u(`Terminal`,-1)],2),n[67]||=b(`span`,{class:`grow`},null,-1),b(`button`,{class:`icon-btn`,"aria-label":`Close panel`,title:`Close panel`,onClick:n[39]||=e=>A.value=null},[t(G,{name:`close`,size:14})])]),b(`div`,Mu,[(i(),p(k,null,[A.value===`files`?(i(),p(E(s),{key:`f:`+Q.value.hostId+wt.value,"host-id":Q.value.hostId,cwd:wt.value,api:$,"active-path":B.value,onOpen:V},null,8,[`host-id`,`cwd`,`active-path`])):(i(),p(E(f),{key:`t:`+Q.value.hostId+wt.value,"host-id":Q.value.hostId,cwd:wt.value,api:$},null,8,[`host-id`,`cwd`]))],1024))])],8,Au)):P(``,!0)],4)):ze.value===`chat`&&Cn.value?(i(),I(`section`,Nu,[...n[68]||=[b(`span`,{class:`spinner`},null,-1),b(`p`,null,`Starting session…`,-1)]])):(i(),I(`section`,Pu,[b(`div`,Fu,[t(G,{name:`chat`,size:26})]),b(`h2`,null,O(yt.value?`Pick a session`:`Connect your first host`),1),b(`p`,null,O(yt.value?St.value?`${bt.value} sessions in ${xt.value} projects on ${mt.value.get(St.value)??`this host`}.`:`${yt.value} sessions in ${xt.value} projects across ${q.value.length} hosts.`:`Add a Paseo daemon and its agents show up here, live.`),1),q.value.length?(i(),I(`button`,{key:1,class:`btn btn-primary`,onClick:n[41]||=e=>xn()},[t(G,{name:`plus`,size:15}),n[69]||=u(`New session`,-1)])):(i(),I(`button`,{key:0,class:`btn btn-primary`,onClick:n[40]||=e=>cr(`hosts`)},`Add a host`))]))]),wn.value?(i(),p(_e,{key:0,thread:wn.value.thread,x:wn.value.x,y:wn.value.y,onClose:n[42]||=e=>wn.value=null,onRename:n[43]||=e=>Tn.value=e,onPin:An,onUnread:jn,onRead:Mn,onArchive:Nn},null,8,[`thread`,`x`,`y`])):P(``,!0),Ut.value?(i(),I(`div`,{key:1,class:`lightbox`,role:`dialog`,"aria-label":`Image`,onClick:n[44]||=e=>Ut.value=null},[b(`img`,{src:Ut.value,alt:``},null,8,Iu)])):P(``,!0),Tn.value?(i(),p(Te,{key:2,thread:Tn.value,busy:K.value,onClose:n[45]||=e=>Tn.value=null,onSave:kn},null,8,[`thread`,`busy`])):P(``,!0),bn.value?(i(),p(Dr,{key:3,hosts:q.value,"initial-host-id":bn.value.hostId,"initial-cwd":bn.value.cwd,"initial-project":bn.value.project,request:$,onClose:n[46]||=e=>bn.value=null,onCreated:Sn},null,8,[`hosts`,`initial-host-id`,`initial-cwd`,`initial-project`])):P(``,!0)],6)):(i(),I(`div`,Mc,[pe.value?(i(),I(`form`,{key:0,class:`login-card`,onSubmit:_(an,[`prevent`])},[n[50]||=b(`div`,{class:`brand brand-large`},[b(`img`,{class:`brand-mark`,src:`/icons/mark.svg`,alt:``,width:`22`,height:`22`}),u(`LitePaseo`)],-1),n[51]||=b(`p`,{class:`login-lede`},`All your Paseo hosts, one fast console.`,-1),b(`label`,Nc,[n[47]||=b(`span`,null,`Server access token`,-1),a(b(`input`,{"onUpdate:modelValue":n[0]||=e=>de.value=e,type:`password`,autocomplete:`off`,required:``,autofocus:``},null,512),[[g,de.value]])]),n[52]||=b(`p`,{class:`hint`},[u(`Run `),b(`code`,null,`litepaseo token`),u(` on the server to print it.`)],-1),pe.value.totp?(i(),I(y,{key:0},[b(`label`,Pc,[n[48]||=b(`span`,null,`Authenticator code`,-1),a(b(`input`,{"onUpdate:modelValue":n[1]||=e=>fe.value=e,class:`code-input`,inputmode:`numeric`,autocomplete:`one-time-code`,maxlength:`6`,pattern:`[0-9]{6}`,placeholder:`••••••`,required:``,onInput:sn},null,544),[[g,fe.value]])]),n[49]||=b(`p`,{class:`hint`},`Both your access token and a code from your authenticator app are required.`,-1)],64)):P(``,!0),b(`button`,{class:`btn btn-primary btn-block`,disabled:K.value},O(K.value?`Signing in…`:`Connect`),9,Fc),ge.value?(i(),I(`p`,Ic,O(ge.value),1)):P(``,!0)],32)):P(``,!0)]))}});function Wu(){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)}}gi(),wi();var Gu=A(Uu);Gu.mount(`#app`),Gu.onUnmount(Wu());export{Ht as a,Ut as i,Vr as n,Le as o,Gt as r,G as s,hi as t};