pi-web-ui 0.48.1 → 0.48.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/agent-service.js +5 -16
- package/dist/server/model-admin.js +2 -0
- package/package.json +110 -110
- package/themes/md-preview.css +42 -85
- package/themes/white.css +42 -85
- package/web/dist/assets/{TerminalPanel-zmg6ssVv.js → TerminalPanel-m1Uq9P_a.js} +1 -1
- package/web/dist/assets/{index-B22rO2Ct.css → index-B8YOHfUN.css} +1 -1
- package/web/dist/assets/{index-ChxqCQTs.js → index-Dg-bQ98a.js} +2 -2
- package/web/dist/index.html +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPanel-m1Uq9P_a.js","assets/markdown-DRBrS2Nf.js","assets/xterm-D1D2FVe3.js","assets/react-C9ovnpIm.js","assets/TerminalPanel-6GBZ9nXN.css"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{R as $e,a as r,j as e,M as Es,b as vn,c as yn}from"./markdown-DRBrS2Nf.js";import{r as Ms}from"./react-C9ovnpIm.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const c of document.querySelectorAll('link[rel="modulepreload"]'))l(c);new MutationObserver(c=>{for(const a of c)if(a.type==="childList")for(const n of a.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&l(n)}).observe(document,{childList:!0,subtree:!0});function i(c){const a={};return c.integrity&&(a.integrity=c.integrity),c.referrerPolicy&&(a.referrerPolicy=c.referrerPolicy),c.crossOrigin==="use-credentials"?a.credentials="include":c.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function l(c){if(c.ep)return;c.ep=!0;const a=i(c);fetch(c.href,a)}})();var Xe={},Gt;function kn(){if(Gt)return Xe;Gt=1;var t=Ms();return Xe.createRoot=t.createRoot,Xe.hydrateRoot=t.hydrateRoot,Xe}var bn=kn();const jn="modulepreload",wn=function(t){return"/"+t},Jt={},Rs=function(s,i,l){let c=Promise.resolve();if(i&&i.length>0){let n=function(p){return Promise.all(p.map(h=>Promise.resolve(h).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),u=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));c=n(i.map(p=>{if(p=wn(p),p in Jt)return;Jt[p]=!0;const h=p.endsWith(".css"),g=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${g}`))return;const x=document.createElement("link");if(x.rel=h?"stylesheet":jn,h||(x.as="script"),x.crossOrigin="",x.href=p,u&&x.setAttribute("nonce",u),document.head.appendChild(x),h)return new Promise((v,b)=>{x.addEventListener("load",v),x.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${p}`)))})}))}function a(n){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=n,window.dispatchEvent(o),!o.defaultPrevented)throw n}return c.then(n=>{for(const o of n||[])o.status==="rejected"&&a(o.reason);return s().catch(a)})};var Ps={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Yt=$e.createContext&&$e.createContext(Ps),Nn=["attr","size","title"];function Cn(t,s){if(t==null)return{};var i,l,c=Sn(t,s);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(l=0;l<a.length;l++)i=a[l],s.indexOf(i)===-1&&{}.propertyIsEnumerable.call(t,i)&&(c[i]=t[i])}return c}function Sn(t,s){if(t==null)return{};var i={};for(var l in t)if({}.hasOwnProperty.call(t,l)){if(s.indexOf(l)!==-1)continue;i[l]=t[l]}return i}function it(){return it=Object.assign?Object.assign.bind():function(t){for(var s=1;s<arguments.length;s++){var i=arguments[s];for(var l in i)({}).hasOwnProperty.call(i,l)&&(t[l]=i[l])}return t},it.apply(null,arguments)}function Qt(t,s){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);s&&(l=l.filter(function(c){return Object.getOwnPropertyDescriptor(t,c).enumerable})),i.push.apply(i,l)}return i}function at(t){for(var s=1;s<arguments.length;s++){var i=arguments[s]!=null?arguments[s]:{};s%2?Qt(Object(i),!0).forEach(function(l){Tn(t,l,i[l])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Qt(Object(i)).forEach(function(l){Object.defineProperty(t,l,Object.getOwnPropertyDescriptor(i,l))})}return t}function Tn(t,s,i){return(s=En(s))in t?Object.defineProperty(t,s,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[s]=i,t}function En(t){var s=Mn(t,"string");return typeof s=="symbol"?s:s+""}function Mn(t,s){if(typeof t!="object"||!t)return t;var i=t[Symbol.toPrimitive];if(i!==void 0){var l=i.call(t,s);if(typeof l!="object")return l;throw new TypeError("@@toPrimitive must return a primitive value.")}return(s==="string"?String:Number)(t)}function Is(t){return t&&t.map((s,i)=>$e.createElement(s.tag,at({key:i},s.attr),Is(s.child)))}function V(t){return s=>$e.createElement(Rn,it({attr:at({},t.attr)},s),Is(t.child))}function Rn(t){var s=i=>{var l=t.attr,c=t.size,a=t.title,n=Cn(t,Nn),o=c||i.size||"1em",u;return i.className&&(u=i.className),t.className&&(u=(u?u+" ":"")+t.className),$e.createElement("svg",it({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},i.attr,l,n,{className:u,style:at(at({color:t.color||i.color},i.style),t.style),height:o,width:o,xmlns:"http://www.w3.org/2000/svg"}),a&&$e.createElement("title",null,a),t.children)};return Yt!==void 0?$e.createElement(Yt.Consumer,null,i=>s(i)):s(Ps)}function Pn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"11",cy:"11",r:"8"},child:[]},{tag:"line",attr:{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},child:[]},{tag:"line",attr:{x1:"8",y1:"11",x2:"14",y2:"11"},child:[]}]})(t)}function In(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"11",cy:"11",r:"8"},child:[]},{tag:"line",attr:{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},child:[]},{tag:"line",attr:{x1:"11",y1:"8",x2:"11",y2:"14"},child:[]},{tag:"line",attr:{x1:"8",y1:"11",x2:"14",y2:"11"},child:[]}]})(t)}function tt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polygon",attr:{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"},child:[]}]})(t)}function je(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"18",y1:"6",x2:"6",y2:"18"},child:[]},{tag:"line",attr:{x1:"6",y1:"6",x2:"18",y2:"18"},child:[]}]})(t)}function Ls(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polygon",attr:{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"},child:[]},{tag:"path",attr:{d:"M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07"},child:[]}]})(t)}function Ln(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"},child:[]},{tag:"path",attr:{d:"M7 11V7a5 5 0 0 1 9.9-1"},child:[]}]})(t)}function Me(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"3 6 5 6 21 6"},child:[]},{tag:"path",attr:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"},child:[]},{tag:"line",attr:{x1:"10",y1:"11",x2:"10",y2:"17"},child:[]},{tag:"line",attr:{x1:"14",y1:"11",x2:"14",y2:"17"},child:[]}]})(t)}function qe(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"4 17 10 11 4 5"},child:[]},{tag:"line",attr:{x1:"12",y1:"19",x2:"20",y2:"19"},child:[]}]})(t)}function Xt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"circle",attr:{cx:"12",cy:"12",r:"6"},child:[]},{tag:"circle",attr:{cx:"12",cy:"12",r:"2"},child:[]}]})(t)}function Dn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"5"},child:[]},{tag:"line",attr:{x1:"12",y1:"1",x2:"12",y2:"3"},child:[]},{tag:"line",attr:{x1:"12",y1:"21",x2:"12",y2:"23"},child:[]},{tag:"line",attr:{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"},child:[]},{tag:"line",attr:{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"},child:[]},{tag:"line",attr:{x1:"1",y1:"12",x2:"3",y2:"12"},child:[]},{tag:"line",attr:{x1:"21",y1:"12",x2:"23",y2:"12"},child:[]},{tag:"line",attr:{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"},child:[]},{tag:"line",attr:{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"},child:[]}]})(t)}function rt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},child:[]}]})(t)}function Bn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"4",y1:"21",x2:"4",y2:"14"},child:[]},{tag:"line",attr:{x1:"4",y1:"10",x2:"4",y2:"3"},child:[]},{tag:"line",attr:{x1:"12",y1:"21",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12",y2:"3"},child:[]},{tag:"line",attr:{x1:"20",y1:"21",x2:"20",y2:"16"},child:[]},{tag:"line",attr:{x1:"20",y1:"12",x2:"20",y2:"3"},child:[]},{tag:"line",attr:{x1:"1",y1:"14",x2:"7",y2:"14"},child:[]},{tag:"line",attr:{x1:"9",y1:"8",x2:"15",y2:"8"},child:[]},{tag:"line",attr:{x1:"17",y1:"16",x2:"23",y2:"16"},child:[]}]})(t)}function lt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]},{tag:"path",attr:{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"},child:[]}]})(t)}function Ds(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"22",y1:"2",x2:"11",y2:"13"},child:[]},{tag:"polygon",attr:{points:"22 2 15 22 11 13 2 9 22 2"},child:[]}]})(t)}function ot(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"11",cy:"11",r:"8"},child:[]},{tag:"line",attr:{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},child:[]}]})(t)}function Fn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"},child:[]},{tag:"polyline",attr:{points:"17 21 17 13 7 13 7 21"},child:[]},{tag:"polyline",attr:{points:"7 3 7 8 15 8"},child:[]}]})(t)}function Bs(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"1 4 1 10 7 10"},child:[]},{tag:"path",attr:{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"},child:[]}]})(t)}function dt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"23 4 23 10 17 10"},child:[]},{tag:"polyline",attr:{points:"1 20 1 14 7 14"},child:[]},{tag:"path",attr:{d:"M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"},child:[]}]})(t)}function De(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"12",y1:"5",x2:"12",y2:"19"},child:[]},{tag:"line",attr:{x1:"5",y1:"12",x2:"19",y2:"12"},child:[]}]})(t)}function mr(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polygon",attr:{points:"5 3 19 12 5 21 5 3"},child:[]}]})(t)}function $n(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21.44 11.05l-9.19 9.19a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"},child:[]}]})(t)}function Zt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"16.5",y1:"9.4",x2:"7.5",y2:"4.21"},child:[]},{tag:"path",attr:{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"},child:[]},{tag:"polyline",attr:{points:"3.27 6.96 12 12.01 20.73 6.96"},child:[]},{tag:"line",attr:{x1:"12",y1:"22.08",x2:"12",y2:"12"},child:[]}]})(t)}function An(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"1"},child:[]},{tag:"circle",attr:{cx:"19",cy:"12",r:"1"},child:[]},{tag:"circle",attr:{cx:"5",cy:"12",r:"1"},child:[]}]})(t)}function _n(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 3v3a2 2 0 0 1-2 2H3m18 0h-3a2 2 0 0 1-2-2V3m0 18v-3a2 2 0 0 1 2-2h3M3 16h3a2 2 0 0 1 2 2v3"},child:[]}]})(t)}function Ke(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"},child:[]}]})(t)}function On(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"3",y1:"12",x2:"21",y2:"12"},child:[]},{tag:"line",attr:{x1:"3",y1:"6",x2:"21",y2:"6"},child:[]},{tag:"line",attr:{x1:"3",y1:"18",x2:"21",y2:"18"},child:[]}]})(t)}function Wn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"},child:[]}]})(t)}function Hn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"15 3 21 3 21 9"},child:[]},{tag:"polyline",attr:{points:"9 21 3 21 3 15"},child:[]},{tag:"line",attr:{x1:"21",y1:"3",x2:"14",y2:"10"},child:[]},{tag:"line",attr:{x1:"3",y1:"21",x2:"10",y2:"14"},child:[]}]})(t)}function qn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"},child:[]},{tag:"path",attr:{d:"M7 11V7a5 5 0 0 1 10 0v4"},child:[]}]})(t)}function jt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},child:[]},{tag:"path",attr:{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},child:[]}]})(t)}function ct(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polygon",attr:{points:"12 2 2 7 12 12 22 7 12 2"},child:[]},{tag:"polyline",attr:{points:"2 17 12 22 22 17"},child:[]},{tag:"polyline",attr:{points:"2 12 12 17 22 12"},child:[]}]})(t)}function Kn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4"},child:[]}]})(t)}function Un(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"16",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12.01",y2:"8"},child:[]}]})(t)}function zn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"},child:[]},{tag:"circle",attr:{cx:"8.5",cy:"8.5",r:"1.5"},child:[]},{tag:"polyline",attr:{points:"21 15 16 10 5 21"},child:[]}]})(t)}function Vn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"3",y:"3",width:"7",height:"7"},child:[]},{tag:"rect",attr:{x:"14",y:"3",width:"7",height:"7"},child:[]},{tag:"rect",attr:{x:"14",y:"14",width:"7",height:"7"},child:[]},{tag:"rect",attr:{x:"3",y:"14",width:"7",height:"7"},child:[]}]})(t)}function Gn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"2",y1:"12",x2:"22",y2:"12"},child:[]},{tag:"path",attr:{d:"M12 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"},child:[]}]})(t)}function es(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"},child:[]}]})(t)}function st(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"6",y1:"3",x2:"6",y2:"15"},child:[]},{tag:"circle",attr:{cx:"18",cy:"6",r:"3"},child:[]},{tag:"circle",attr:{cx:"6",cy:"18",r:"3"},child:[]},{tag:"path",attr:{d:"M18 9a9 9 0 0 1-9 9"},child:[]}]})(t)}function Ue(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"},child:[]}]})(t)}function Fs(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M13 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V9z"},child:[]},{tag:"polyline",attr:{points:"13 2 13 9 20 9"},child:[]}]})(t)}function $s(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"},child:[]},{tag:"polyline",attr:{points:"14 2 14 8 20 8"},child:[]},{tag:"line",attr:{x1:"16",y1:"13",x2:"8",y2:"13"},child:[]},{tag:"line",attr:{x1:"16",y1:"17",x2:"8",y2:"17"},child:[]},{tag:"polyline",attr:{points:"10 9 9 9 8 9"},child:[]}]})(t)}function wt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"},child:[]},{tag:"circle",attr:{cx:"12",cy:"12",r:"3"},child:[]}]})(t)}function Nt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 20h9"},child:[]},{tag:"path",attr:{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"},child:[]}]})(t)}function Ct(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"},child:[]}]})(t)}function Pt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"},child:[]},{tag:"polyline",attr:{points:"7 10 12 15 17 10"},child:[]},{tag:"line",attr:{x1:"12",y1:"15",x2:"12",y2:"3"},child:[]}]})(t)}function Ye(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"4",y:"4",width:"16",height:"16",rx:"2",ry:"2"},child:[]},{tag:"rect",attr:{x:"9",y:"9",width:"6",height:"6"},child:[]},{tag:"line",attr:{x1:"9",y1:"1",x2:"9",y2:"4"},child:[]},{tag:"line",attr:{x1:"15",y1:"1",x2:"15",y2:"4"},child:[]},{tag:"line",attr:{x1:"9",y1:"20",x2:"9",y2:"23"},child:[]},{tag:"line",attr:{x1:"15",y1:"20",x2:"15",y2:"23"},child:[]},{tag:"line",attr:{x1:"20",y1:"9",x2:"23",y2:"9"},child:[]},{tag:"line",attr:{x1:"20",y1:"14",x2:"23",y2:"14"},child:[]},{tag:"line",attr:{x1:"1",y1:"9",x2:"4",y2:"9"},child:[]},{tag:"line",attr:{x1:"1",y1:"14",x2:"4",y2:"14"},child:[]}]})(t)}function Jn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"9 10 4 15 9 20"},child:[]},{tag:"path",attr:{d:"M20 4v7a4 4 0 0 1-4 4H4"},child:[]}]})(t)}function It(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"},child:[]},{tag:"path",attr:{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"},child:[]}]})(t)}function Yn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"16 18 22 12 16 6"},child:[]},{tag:"polyline",attr:{points:"8 6 2 12 8 18"},child:[]}]})(t)}function ut(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"18 15 12 9 6 15"},child:[]}]})(t)}function pt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"9 18 15 12 9 6"},child:[]}]})(t)}function Ae(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"6 9 12 15 18 9"},child:[]}]})(t)}function mt(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"20 6 9 17 4 12"},child:[]}]})(t)}function Qn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M22 11.08V12a10 10 0 1 1-5.93-9.14"},child:[]},{tag:"polyline",attr:{points:"22 4 12 14.01 9 11.01"},child:[]}]})(t)}function ts(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"},child:[]},{tag:"polyline",attr:{points:"3.27 6.96 12 12.01 20.73 6.96"},child:[]},{tag:"line",attr:{x1:"12",y1:"22.08",x2:"12",y2:"12"},child:[]}]})(t)}function Xn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z"},child:[]},{tag:"path",attr:{d:"M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z"},child:[]}]})(t)}function As(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"12",y1:"19",x2:"12",y2:"5"},child:[]},{tag:"polyline",attr:{points:"5 12 12 5 19 12"},child:[]}]})(t)}function _s(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"line",attr:{x1:"12",y1:"5",x2:"12",y2:"19"},child:[]},{tag:"polyline",attr:{points:"19 12 12 19 5 12"},child:[]}]})(t)}function Zn(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"},child:[]},{tag:"line",attr:{x1:"12",y1:"9",x2:"12",y2:"13"},child:[]},{tag:"line",attr:{x1:"12",y1:"17",x2:"12.01",y2:"17"},child:[]}]})(t)}function ei(t){return V({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"line",attr:{x1:"12",y1:"8",x2:"12",y2:"12"},child:[]},{tag:"line",attr:{x1:"12",y1:"16",x2:"12.01",y2:"16"},child:[]}]})(t)}function Be(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(16);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(t);else for(let i=0;i<16;i++)t[i]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const s=[...t].map(i=>i.toString(16).padStart(2,"0")).join("");return`${s.slice(0,8)}-${s.slice(8,12)}-${s.slice(12,16)}-${s.slice(16,20)}-${s.slice(20)}`}function Le({trigger:t,open:s,onOpenChange:i,children:l,align:c="right",fit:a=!1,direction:n="down",menuClassName:o,menuRef:u,menuStyle:p}){const h=r.useRef(null);return r.useEffect(()=>{if(!s)return;const g=v=>{h.current&&!h.current.contains(v.target)&&i(!1)},x=v=>{v.key==="Escape"&&i(!1)};return document.addEventListener("mousedown",g),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",x)}},[s,i]),e.jsxs("div",{className:`dropdown ${c} ${a?"fit":""} ${n==="up"?"dd-up":""}`,ref:h,children:[e.jsxs("button",{type:"button",className:"chip",onClick:()=>i(!s),"aria-expanded":s,children:[t,e.jsx(Ae,{className:`dd-caret ${s?"up":""}`})]}),s&&e.jsx("div",{className:`dd-menu ${o??""}`,ref:u,style:p,children:l})]})}function we({active:t,disabled:s=!1,title:i,onClick:l,children:c}){return e.jsx("button",{type:"button",className:`dd-item ${t?"active":""}`,disabled:s,title:i,onClick:l,children:c})}const Os="pi-web-ui:lang",ti={cancel:"取消",ok:"确定",save:"保存",close:"关闭",widgetExpand:"点击放大查看完整输出",dragToResize:"拖拽调整宽度 · 双击复位",loading:"加载中…",connected:"已连接",connecting:"连接中…",reconnecting:"重连中…",language:"语言",langZh:"中文",langEn:"English",githubRepo:"GitHub 仓库(xing-shuyin/pi-web-ui)",copy:"复制",viewSwitch:"视图切换",chat:"对话",terminal:"终端",selectModel:"选择模型",availableModels:"可用模型",allProviders:"全部",providers:"服务商",noModels:"暂无可用模型(请先配置 API 密钥)",reasoning:"推理",vision:"识图",refreshModels:"刷新模型列表(保留手填,合并新增)",manageModels:"⚙ 管理模型(新增 / 修改)",manageModelsTitle:"管理模型",thinkingLevel:"思考强度",thinking:"思考",thinkingChip:"思考:{level}",sound:"声音",theme:"主题",themeDefault:"深色(默认)",newChat:"新对话",more:"更多",newChatTip:"新建对话(每个浏览器独立保存会话)","thinking.off":"关闭","thinking.minimal":"极简","thinking.low":"低","thinking.medium":"中","thinking.high":"高","thinking.xhigh":"极高","thinking.max":"最大",thinkingUnsupported:"当前模型不支持该级别,已按模型能力就近生效",context:"上下文",contextUsage:"上下文用量",cumulativeCost:"累计成本",sessionMessages:"会话消息数",messages:"消息",pluginStatus:"插件状态",working:"工作中",queued:"排队",enterPath:"输入路径,Enter 切换",cwdTip:"工作目录:{path}(点击切换)",folderRef:"文件夹引用:{path}",refOnly:"仅引用:{path}",attachContent:"附加内容:{path}",attachLines:"附加选中行:{path}(第 {start}-{end} 行)",attachImage:"图片:{name}",attachFile:"文件:{name}",removeAttachment:"移除附件",attachHint:"将随下一条消息发送",uploadFile:"添加文件(图片/文本/任意文件,也可直接拖入或粘贴截图)",dropHereToAttach:"松开以添加文件",imageNotSupported:"当前模型不支持识图:图片将交给视觉桥转写(若未配置视觉模型则可能被忽略)",imageLoadFailed:"图片读取失败:{name}",fileLoadFailed:"文件读取失败:{name}",fileTooLarge:"文件过大已跳过(>{size}MB):{name}",foldersNotSupported:"不支持直接拖入文件夹,请展开后选择文件",placeholderStreaming:"智能体正在工作中…回车插队发送,或点「排队」等回答结束后发送",placeholderIdle:"给 pi 发送消息 — Enter 发送,/ 查看命令",placeholderConnecting:"正在连接服务器…",stopAgent:"停止智能体",stop:"停止",bgTasks:"后台任务",bgTasksTip:"AI 在后台启动的服务(npm run dev & 等)——可逐个停止或全部关闭,对话结束后仍保留",bgTasksEmpty:"暂无后台任务",bgTasksDesc:"AI 运行中启动并仍在监听的进程(按监听端口检测)",bgTaskPort:"端口",bgTaskPid:"PID",bgTaskSince:"启动",bgTaskStop:"停止",bgTaskStopAll:"全部关闭",bgTaskRefresh:"刷新",bgTaskJustNow:"刚刚",bgTaskMinutes:"{n} 分钟前",bgTaskHours:"{n} 小时前",bgTaskDays:"{n} 天前",stopBash:"停止",stopBashTip:"停止正在运行的 bash 命令(对话继续)",supplement:"排队",supplementTip:"加入队列:AI 回答完全结束后才发送(不打断)",queueSteerTag:"插队",queueFollowTag:"排队",sendTip:"发送(Enter)",slashCommands:"命令",slashMenuHint:"↑↓ 选择 · Enter/Tab 补全",slashHelpTitle:"pi 命令",slashHelpHint:"输入 / 随时打开命令列表",slashLoading:"命令列表加载中…(连接服务器后可用)",slashBuiltin:"内置",slashExtension:"扩展",slashPrompt:"模板",slashSkill:"技能",slashPlugin:"插件",slashCopied:"已复制上一条助手回复",slashCopyFailed:"复制失败,请手动复制",slashCopyEmpty:"还没有可复制的助手回复",recentProjects:"最近项目",runningConversations:"运行的对话",historySessions:"历史对话",openHistory:"历史对话",openFiles:"文件列表",streaming:"进行中…",noHistory:"还没有历史对话",current:"当前",messageCount:"{n} 条消息",tuiTip:"pi 终端(TUI)中的对话",deleteProject:"从最近项目移出",deleteProjectConfirm:"确认移出",deleteSession:"删除该对话记录(不可恢复)",deleteSessionConfirm:"确认删除",emptyChat:"空对话",editReask:"编辑重问",editReaskTip:"修改此问题,并从这里重新提问(会新建一个分支对话,原对话保留)",reaskFromHere:"从此处重新提问",editPlaceholder:"修改问题内容…",editHint:"⌘/Ctrl+Enter 提交 · Esc 取消",editAttachmentHint:"原附件已保留,可粘贴/拖入新图片或文件 · ⌘/Ctrl+Enter 提交 · Esc 取消",expandMsg:"展开",collapseMsg:"收起",toolCalls:"工具调用",bashRuns:"终端运行",images:"图片",update:"更新",updateTip:"检查并更新 pi-web-ui",currentVersion:"当前版本",latestVersion:"最新版本",checkingUpdate:"检查中…",checkUpdate:"检查更新",upToDate:"已是最新版本",updateAvailable:"发现新版本 v{version}",updateJustPublished:"v{version} 刚刚发布,npm 缓存可能尚未同步——若未检测到新版本,请稍后重新检查",updateNow:"在终端中更新",updateTabTitle:"更新 pi-web-ui",updateTerminalHint:"点击后会在可见终端中运行 npm i -g pi-web-ui@latest;完成后重启服务生效(pi-web-ui server restart)。",rootDir:"根目录",noFiles:"暂无文件",filesTruncated:"目录过大,列表已截断,仅显示前 2000 项",linkFolderTip:"链接文件夹路径到对话",attachInlineTip:"附加内容到对话",referenceTip:"仅引用路径(AI 按需读取)",previewFile:"预览",downloadFile:"下载文件",downloadFailed:"下载失败:{error}",protocolMismatch:"页面版本与服务器不一致(应用刚更新过),请刷新页面以恢复全部功能。",selectLinesHint:"点击选择行;拖拽或 Shift+点击选择范围",enableWrap:"开启自动换行",disableWrap:"关闭自动换行",selectedRange:"已选 {n} 行(第 {start}-{end} 行)",fileLines:"{n} 行",selectAll:"全选",clearSelection:"清除",addToChat:"添加到对话",addedToChat:"已添加",previewTruncated:"⚠ 文件过大,仅预览前 512KB",previewLinesTruncated:"… 文件行数过多,仅显示前 {n} 行",binaryFile:"🔣 二进制文件,已显示前 4KB 十六进制",binaryHexTruncated:"(文件更大,可下载完整文件)",previewNotSupported:"该类型文件不支持预览(仅图片 / 视频 / 文本)",emptyFile:"(空文件)",editFile:"编辑文件",exitEditFile:"退出编辑",saveFile:"保存文件",discardFileChanges:"放弃未保存的修改?",fileSaved:"已保存",fileEditTruncated:"文件过大,预览不完整,无法编辑",showMarkdownSource:"显示 Markdown 原文",showMarkdownPreview:"显示 Markdown 预览",fullscreen:"全屏",exitFullscreen:"退出全屏",zoomIn:"放大字号",zoomOut:"缩小字号",resetZoom:"重置缩放",pluginRequest:"插件请求",noOptions:"(无选项)",inputPlaceholder:"输入内容",soundHeader:"声音提示",enableSound:"启用声音",preview:"试听",volume:"音量","sound.question":"问卷弹出","sound.question.desc":"ask_user_question 出现时","sound.done":"回复结束","sound.done.desc":"智能体完成一轮回答时","sound.start":"回复开始","sound.start.desc":"智能体开始新一轮时","sound.error":"出错","sound.error.desc":"出现错误提示时",setupTitle:"未检测到 pi agent 配置",setupDesc:"pi-web-ui 需要 pi 的配置目录(~/.pi/agent)和至少一个 API 密钥才能运行智能体。pi 内置了 openai、anthropic、deepseek 等服务商——选一个填密钥即可,全程无需打开终端。",installFailed:"✖ pi agent 安装失败:",retryInstall:"重试安装",skip:"跳过",installDone:"✅ pi agent CLI 已安装。选择服务商并填入 API 密钥即可开始对话:",cliReadyHint:"✅ 本地已检测到 pi agent,选择服务商并填入 API 密钥即可开始对话:",provider:"服务商",configured:"已配置",providerKeyReady:"该服务商已配置密钥,可直接使用或更换新密钥。",apiKey:"API 密钥",saving:"保存中…",saveAndStart:"保存并开始使用",recheck:"重新检测",installing:"正在安装 pi agent CLI…",autoInstall:"自动安装 pi agent",attachment:"附件",plugin:"插件",unknown:"未知",thinkingWait:"正在思考",exitCode:"退出码 {code}",cancelled:"已取消",truncated:"… 内容过长,当前视图已截断",outputTruncated:"… 输出过长,当前视图已截断",refOnlyShort:"仅引用",folderRefShort:"文件夹 · 仅引用",inlineLines:"内联 · {n} 行",inlineLinesRange:"行 {start}-{end}",image:"🖼 图片",bridgedVision:"👁 已转写",bridgedVisionDetail:"图片已由视觉桥转写(当前模型不支持识图)",folderNotExpanded:"文件夹,未展开内容 —— 智能体会按需浏览目录",fileNotExpanded:"文件较大({size}),未展开内容 —— 智能体会按需读取","role.user":"你","role.assistant":"pi","role.tool":"工具","role.bash":"终端","role.branch":"分支摘要","role.compaction":"上下文已压缩",directory:"目录",waitingResponse:"正在等待模型响应…",backToBottom:"回到底部",questionNavTitle:"问题列表",searchPlaceholder:"在对话中搜索…",searchNoResults:"无结果",searchModels:"搜索模型…",noModelMatches:"无匹配模型",modelUsedCount:"已用 {n} 次",searchGlobal:"搜索",searchGlobalTip:"全局搜索:对话 / 项目 / 文件(Ctrl+K)",gsPlaceholder:"搜索项目、历史对话、工作区文件…",gsHint:"输入关键词:同时搜索历史对话、最近项目与当前项目的文件名",gsSessions:"对话",gsProjects:"项目",gsFiles:"文件",gsNoResults:"无匹配结果",gsSearching:"正在搜索文件…",gsTruncated:"匹配过多,仅显示部分结果",gsCurrentProject:"当前",gsOpenPreview:"打开文件预览",gsNavigate:"选择",gsOpen:"打开",gsCloseHint:"关闭",bgTaskCommand:"命令行",searchPrev:"上一个(Shift+Enter)",searchNext:"下一个(Enter)",searchClose:"关闭(Esc)",questionNavTip:"本对话的全部问题,悬浮展开,点击跳转","tpl.title":"提示词模板","tpl.hint":"点击卡片直接填入输入框,✏️ 可编辑或删除 · 也能新增自己的模板","tpl.clickCard":"点击填入输入框","tpl.editTpl":"编辑 / 删除模板","tpl.openPicker":"提示词模板(常用提示词,随时取用)","tpl.pickerTitle":"提示词模板","tpl.pickerHint":"点击卡片直接填入输入框,✏️ 可编辑或删除 · 也能新增自己的模板","tpl.add":"新建模板","tpl.addDesc":"把常用工作流存成模板","tpl.reset":"恢复默认模板","tpl.resetConfirm":"确认恢复默认?","tpl.builtin":"内置","tpl.custom":"自定义","tpl.newTitle":"新建提示词模板","tpl.editTitle":"编辑提示词模板","tpl.fieldIcon":"图标","tpl.fieldTitle":"标题","tpl.fieldTitlePh":"卡片上显示的短标题","tpl.fieldDesc":"说明","tpl.fieldDescPh":"一句话说明,显示在卡片上","tpl.fieldPrompt":"提示词","tpl.fieldPromptPh":"完整提示词 —— 发送给智能体的内容","tpl.required":"标题和提示词不能为空","tpl.save":"保存修改","tpl.fill":"填入输入框","tpl.fillTip":"填入输入框,可再编辑后发送","tpl.sendNow":"直接发送","tpl.sendTip":"立即作为新对话发送","tpl.delete":"删除","tpl.deleteTip":"删除这个自定义模板","tpl.remove":"移出模板库","tpl.removeTip":"把内置模板移出模板库,可在底部「恢复默认模板」找回","tpl.restore":"恢复默认","tpl.restoreTip":"撤掉你的修改,恢复内置默认","tpl.sk.setup":"仓库初始化","tpl.sk.setup.desc":"让仓库了解它的构建与约定","tpl.sk.setup.prompt":`请先扫描这个仓库,建立「其他工作流都能用」的基础上下文,输出一份简明报告:
|
|
3
3
|
|
|
4
4
|
1. 项目类型、技术栈与目录结构
|
|
@@ -316,4 +316,4 @@ Avoid three test anti-patterns: tests coupled to the implementation, tautologica
|
|
|
316
316
|
`)}function ua(t,s){if(typeof t.text=="string"){s.push(t.text);return}switch(t.type){case"thinking":typeof t.thinking=="string"&&s.push(t.thinking);break;case"toolCall":{typeof t.name=="string"&&s.push(t.name),typeof t.argumentsText=="string"&&s.push(t.argumentsText);break}case"bash":typeof t.command=="string"&&s.push(t.command),typeof t.output=="string"&&s.push(t.output);break}}function pa(t,s){const i=s.trim().toLowerCase();if(!i)return 0;const l=t.toLowerCase();let c=0,a=l.indexOf(i);for(;a!==-1;)c++,a=l.indexOf(i,a+i.length);return c}function ma(t,s){const i=s.trim().toLowerCase();if(!i)return[];const l=[];for(const c of t){const a=da(c);if(!a)continue;const n=pa(a,i);for(let o=0;o<n;o++)l.push({messageId:c.id,occurrence:o})}return l}function ha(t,s){var n;const i=new Map,l=[],c=s.toLowerCase();if(!c)return{byMsg:i,all:l};const a=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,{acceptNode(o){const u=o.parentElement;return!u||u.closest(".search-bar")?NodeFilter.FILTER_REJECT:(o.textContent??"").toLowerCase().includes(c)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(let o=a.nextNode();o;o=a.nextNode()){const u=(o.textContent??"").toLowerCase(),p=(n=o.parentElement)==null?void 0:n.closest("[data-msg-id]");if(!p)continue;const h=p.getAttribute("data-msg-id")??"";let g=u.indexOf(c);for(;g!==-1;){const x=document.createRange();x.setStart(o,g),x.setEnd(o,g+c.length),l.push(x);const v=i.get(h);v?v.push(x):i.set(h,[x]),g=u.indexOf(c,g+c.length)}}return{byMsg:i,all:l}}function We(t,s){const i=CSS;if(!i.highlights)return;if(s.length===0){i.highlights.delete(t);return}const l=window.Highlight;l&&i.highlights.set(t,new l(...s))}function ga({containerRef:t,messages:s,open:i,onClose:l,onEnsureExpanded:c}){const a=me(),n=r.useRef(null),[o,u]=r.useState(""),[p,h]=r.useState(0),g=r.useDeferredValue(o),x=i?g.trim():"",v=r.useMemo(()=>i?ma(s,x):[],[s,x,i]),b=r.useRef(v);b.current=v;const L=r.useRef(p);L.current=p,r.useEffect(()=>{i&&(h(0),requestAnimationFrame(()=>{var y;return(y=n.current)==null?void 0:y.select()}))},[i]),r.useEffect(()=>{if(!i)return;const y=P=>{P.key==="Escape"&&(P.preventDefault(),P.stopPropagation(),l())};return window.addEventListener("keydown",y,!0),()=>window.removeEventListener("keydown",y,!0)},[i,l]),r.useEffect(()=>(i||(We("msg-search",[]),We("msg-search-active",[])),()=>{We("msg-search",[]),We("msg-search-active",[])}),[i]);const S=r.useCallback(y=>{const P=t.current;if(!P)return;const I=P.querySelector(`[data-msg-id="${y}"]`);I&&(I.classList.remove("msg-flash"),I.offsetWidth,I.classList.add("msg-flash"))},[t]);r.useLayoutEffect(()=>{if(!i||!x)return;const y=t.current;if(!y)return;let P=!1,I=0;return I=requestAnimationFrame(()=>{var ee;if(P)return;const{byMsg:E,all:j}=ha(y,x);We("msg-search",j);const m=b.current,D=m[Math.min(L.current,m.length-1)];if(!D)return;const W=(ee=E.get(D.messageId))==null?void 0:ee[D.occurrence];if(W){We("msg-search-active",[W]);const X=W.startContainer.parentElement??y.querySelector(`[data-msg-id="${D.messageId}"]`);X==null||X.scrollIntoView({block:"center"})}else S(D.messageId)}),()=>{P=!0,cancelAnimationFrame(I)}},[i,x,v,t,S]);const F=r.useCallback(y=>{const P=b.current;if(P.length===0)return;const I=(L.current+y+P.length)%P.length;h(I),c(P[I].messageId)},[c]);if(!i)return null;const k=v.length;return e.jsxs("div",{className:"search-bar",role:"search",children:[e.jsx("input",{ref:n,className:"search-input",type:"text",value:o,placeholder:a("searchPlaceholder"),onChange:y=>{u(y.target.value),h(0)},onKeyDown:y=>{y.key==="Enter"&&(y.preventDefault(),F(y.shiftKey?-1:1))}}),e.jsx("span",{className:`search-count ${k===0?"empty":""}`,children:k===0?a("searchNoResults"):`${Math.min(p+1,k)}/${k}`}),e.jsx("button",{type:"button",className:"search-btn",title:a("searchPrev"),disabled:k===0,onClick:()=>F(-1),children:e.jsx(ut,{})}),e.jsx("button",{type:"button",className:"search-btn",title:a("searchNext"),disabled:k===0,onClick:()=>F(1),children:e.jsx(Ae,{})}),e.jsx("button",{type:"button",className:"search-btn",title:a("searchClose"),onClick:l,children:e.jsx(je,{})})]})}const tn=[{id:"setup-matt-pocock-skills",icon:"🛠",titleKey:"tpl.sk.setup",descKey:"tpl.sk.setup.desc",promptKey:"tpl.sk.setup.prompt"},{id:"ask-matt",icon:"🧭",titleKey:"tpl.sk.ask",descKey:"tpl.sk.ask.desc",promptKey:"tpl.sk.ask.prompt"},{id:"grill-with-docs",icon:"🗣",titleKey:"tpl.sk.grilldocs",descKey:"tpl.sk.grilldocs.desc",promptKey:"tpl.sk.grilldocs.prompt"},{id:"to-spec",icon:"📝",titleKey:"tpl.sk.tospec",descKey:"tpl.sk.tospec.desc",promptKey:"tpl.sk.tospec.prompt"},{id:"to-tickets",icon:"🎫",titleKey:"tpl.sk.totickets",descKey:"tpl.sk.totickets.desc",promptKey:"tpl.sk.totickets.prompt"},{id:"implement",icon:"🏗",titleKey:"tpl.sk.implement",descKey:"tpl.sk.implement.desc",promptKey:"tpl.sk.implement.prompt"},{id:"code-review",icon:"🧹",titleKey:"tpl.sk.codeview",descKey:"tpl.sk.codeview.desc",promptKey:"tpl.sk.codeview.prompt"},{id:"wayfinder",icon:"🗺",titleKey:"tpl.sk.wayfinder",descKey:"tpl.sk.wayfinder.desc",promptKey:"tpl.sk.wayfinder.prompt"},{id:"prototype",icon:"🔬",titleKey:"tpl.sk.prototype",descKey:"tpl.sk.prototype.desc",promptKey:"tpl.sk.prototype.prompt"},{id:"research",icon:"📚",titleKey:"tpl.sk.research",descKey:"tpl.sk.research.desc",promptKey:"tpl.sk.research.prompt"},{id:"improve-codebase-architecture",icon:"🏛",titleKey:"tpl.sk.arch",descKey:"tpl.sk.arch.desc",promptKey:"tpl.sk.arch.prompt"},{id:"diagnosing-bugs",icon:"🐛",titleKey:"tpl.sk.debug",descKey:"tpl.sk.debug.desc",promptKey:"tpl.sk.debug.prompt"},{id:"resolving-merge-conflicts",icon:"🔀",titleKey:"tpl.sk.merge",descKey:"tpl.sk.merge.desc",promptKey:"tpl.sk.merge.prompt"},{id:"triage",icon:"🗂",titleKey:"tpl.sk.triage",descKey:"tpl.sk.triage.desc",promptKey:"tpl.sk.triage.prompt"},{id:"wizard",icon:"✨",titleKey:"tpl.sk.wizard",descKey:"tpl.sk.wizard.desc",promptKey:"tpl.sk.wizard.prompt"},{id:"grill-me",icon:"🔍",titleKey:"tpl.sk.grillme",descKey:"tpl.sk.grillme.desc",promptKey:"tpl.sk.grillme.prompt"},{id:"handoff",icon:"🤝",titleKey:"tpl.sk.handoff",descKey:"tpl.sk.handoff.desc",promptKey:"tpl.sk.handoff.prompt"},{id:"to-questionnaire",icon:"📋",titleKey:"tpl.sk.questionnaire",descKey:"tpl.sk.questionnaire.desc",promptKey:"tpl.sk.questionnaire.prompt"},{id:"teach",icon:"🎓",titleKey:"tpl.sk.teach",descKey:"tpl.sk.teach.desc",promptKey:"tpl.sk.teach.prompt"},{id:"wait-what",icon:"💬",titleKey:"tpl.sk.ww",descKey:"tpl.sk.ww.desc",promptKey:"tpl.sk.ww.prompt"},{id:"writing-for-agents",icon:"📄",titleKey:"tpl.sk.wfa",descKey:"tpl.sk.wfa.desc",promptKey:"tpl.sk.wfa.prompt"},{id:"codebase-design",icon:"🧱",titleKey:"tpl.sk.codesign",descKey:"tpl.sk.codesign.desc",promptKey:"tpl.sk.codesign.prompt"},{id:"domain-modeling",icon:"🏷",titleKey:"tpl.sk.domain",descKey:"tpl.sk.domain.desc",promptKey:"tpl.sk.domain.prompt"},{id:"grilling",icon:"🔥",titleKey:"tpl.sk.grilling",descKey:"tpl.sk.grilling.desc",promptKey:"tpl.sk.grilling.prompt"},{id:"tdd",icon:"🧪",titleKey:"tpl.sk.tdd",descKey:"tpl.sk.tdd.desc",promptKey:"tpl.sk.tdd.prompt"}],sn="pi-web-ui:prompt-templates";function fa(){try{const t=localStorage.getItem(sn);if(!t)return[];const s=JSON.parse(t);return Array.isArray(s)?s.filter(i=>!!i&&typeof i=="object"&&typeof i.id=="string"):[]}catch{return[]}}function fs(t){return tn.some(s=>s.id===t)}function Ze(t){return typeof t.title=="string"}const nn=r.createContext(null);function an(){const t=r.useContext(nn);if(!t)throw new Error("useTemplates must be used within TemplateProvider");return t}function xa({send:t,children:s}){const i=me(),[l,c]=r.useState(fa),[a,n]=r.useState(!1),[o,u]=r.useState(null),[p,h]=r.useState(!1),[g,x]=r.useState(!1),[v,b]=r.useState(!1);r.useEffect(()=>{try{localStorage.setItem(sn,JSON.stringify(l))}catch{}},[l]);const L=r.useMemo(()=>{const O=new Map,H=new Set;for(const N of l)N.hidden?H.add(N.id):(Ze(N)&&!fs(N.id)||Ze(N))&&O.set(N.id,N);const R=tn.filter(N=>!H.has(N.id)).map(N=>{const U=O.get(N.id);return{id:N.id,icon:(U==null?void 0:U.icon)??N.icon,title:(U==null?void 0:U.title)??i(N.titleKey),desc:(U==null?void 0:U.desc)??i(N.descKey),prompt:(U==null?void 0:U.prompt)??i(N.promptKey),builtin:!0}}),C=l.filter(N=>Ze(N)&&!fs(N.id)).map(N=>({id:N.id,icon:N.icon??"📌",title:N.title??"",desc:N.desc??"",prompt:N.prompt??""}));return[...R,...C]},[l,i]),S=r.useCallback(()=>n(!0),[]),F=r.useCallback(O=>{window.dispatchEvent(new CustomEvent("pi-web:fill",{detail:O}))},[]),k=r.useCallback((O,H=!1)=>{b(H),O?(h(!1),u({...O})):(h(!0),u({id:Be(),icon:"📌",title:"",desc:"",prompt:""}))},[]),y=r.useCallback(()=>{n(!1),u(null),b(!1)},[]),P=r.useCallback(()=>{g?(c([]),x(!1)):(x(!0),setTimeout(()=>x(!1),5e3))},[g]),I=r.useCallback(O=>{n(!1),F(O.prompt)},[F]),E=r.useCallback(O=>{n(!1),k(O,!0)},[k]),j=r.useCallback(()=>{n(!1),k(void 0,!0)},[k]),m=r.useCallback(O=>{c(H=>{const R=H.findIndex(C=>C.id===O.id);if(R>=0){const C=[...H];return C[R]=O,C}return[...H,O]}),u(null),v&&(n(!0),b(!1))},[v]),D=r.useCallback(O=>{c(H=>O.builtin?[...H.filter(C=>C.id!==O.id),{id:O.id,hidden:!0}]:H.filter(R=>R.id!==O.id)),u(null),v&&(n(!0),b(!1))},[v]),W=r.useCallback(O=>{c(H=>H.filter(R=>R.id!==O.id||R.hidden)),u(null),v&&(n(!0),b(!1))},[v]),ee=r.useMemo(()=>({templates:L,fill:F,openPicker:S,openEdit:k,resetConfirm:g,toggleReset:P}),[L,F,S,k,g,P]),X=o?l.some(O=>O.id===o.id&&!O.hidden&&Ze(O)):!1;return e.jsxs(nn.Provider,{value:ee,children:[s,a&&e.jsx(ya,{templates:L,resetConfirm:g,onFill:I,onEditTpl:E,onNew:j,onResetToggle:P,onClose:y}),o&&e.jsx(ka,{editing:o,isNew:p,hasOverride:X,onDraft:u,onSave:m,onRestore:()=>W(o),onRemove:()=>D(o),onFill:()=>{window.dispatchEvent(new CustomEvent("pi-web:fill",{detail:o.prompt})),y()},onSend:()=>{const O=o.prompt.trim();O&&t({type:"prompt",text:O,queue:!1})&&y()},onClose:y})]})}function va(){const t=me(),{templates:s,fill:i,openEdit:l,toggleReset:c,resetConfirm:a}=an();return e.jsxs("div",{className:"empty-templates",children:[e.jsxs("div",{className:"empty-templates-head",children:[e.jsx("span",{className:"empty-templates-title",children:t("tpl.title")}),e.jsx("span",{className:"empty-templates-hint",children:t("tpl.hint")})]}),e.jsxs("div",{className:"empty-templates-grid",children:[s.map(n=>e.jsx(rn,{tpl:n,title:t("tpl.clickCard"),onFill:()=>i(n.prompt),onEdit:()=>l(n),editTitle:t("tpl.editTpl")},n.id)),e.jsxs("button",{type:"button",className:"empty-template add",onClick:()=>l(),title:t("tpl.add"),children:[e.jsx("span",{className:"empty-template-icon",children:e.jsx(De,{})}),e.jsxs("span",{className:"empty-template-main",children:[e.jsx("span",{className:"empty-template-title",children:t("tpl.add")}),e.jsx("span",{className:"empty-template-desc",children:t("tpl.addDesc")})]})]})]}),e.jsx("div",{className:"empty-templates-foot",children:e.jsxs("button",{type:"button",className:"empty-templates-reset",onClick:c,children:[e.jsx(Bs,{}),t(a?"tpl.resetConfirm":"tpl.reset")]})})]})}function rn({tpl:t,title:s,onFill:i,onEdit:l,editTitle:c}){const a=me();return e.jsxs("button",{type:"button",className:"empty-template",title:s,onClick:i,children:[e.jsx("span",{className:"empty-template-icon",children:t.icon}),e.jsxs("span",{className:"empty-template-main",children:[e.jsx("span",{className:"empty-template-title",children:t.title}),e.jsx("span",{className:"empty-template-desc",children:t.desc})]}),e.jsx("span",{className:"template-card-ops",role:"button",title:c??a("tpl.editTpl"),onClick:n=>{n.stopPropagation(),l()},children:e.jsx(Ct,{})})]})}function ya({templates:t,resetConfirm:s,onFill:i,onEditTpl:l,onNew:c,onResetToggle:a,onClose:n}){const o=me();return r.useEffect(()=>{const u=p=>{p.key==="Escape"&&n()};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[n]),e.jsx("div",{className:"modal-backdrop",onClick:n,children:e.jsxs("div",{className:"modal template-picker",onClick:u=>u.stopPropagation(),children:[e.jsxs("div",{className:"template-picker-head",children:[e.jsx("span",{className:"template-picker-title",children:o("tpl.pickerTitle")}),e.jsx("button",{type:"button",className:"btn template-modal-close",title:o("close"),onClick:n,children:e.jsx(je,{})})]}),e.jsx("div",{className:"template-picker-hint",children:o("tpl.pickerHint")}),e.jsxs("div",{className:"template-picker-grid",children:[t.map(u=>e.jsx(rn,{tpl:u,title:o("tpl.clickCard"),onFill:()=>i(u),onEdit:()=>l(u),editTitle:o("tpl.editTpl")},u.id)),e.jsxs("button",{type:"button",className:"empty-template add",onClick:c,title:o("tpl.add"),children:[e.jsx("span",{className:"empty-template-icon",children:e.jsx(De,{})}),e.jsxs("span",{className:"empty-template-main",children:[e.jsx("span",{className:"empty-template-title",children:o("tpl.add")}),e.jsx("span",{className:"empty-template-desc",children:o("tpl.addDesc")})]})]})]}),e.jsx("div",{className:"template-picker-foot",children:e.jsxs("button",{type:"button",className:"empty-templates-reset",onClick:a,children:[e.jsx(Bs,{}),o(s?"tpl.resetConfirm":"tpl.reset")]})})]})})}function ka({editing:t,isNew:s,hasOverride:i,onDraft:l,onSave:c,onRestore:a,onRemove:n,onFill:o,onSend:u,onClose:p}){const h=me(),g=r.useRef(null);r.useEffect(()=>{const b=L=>{L.key==="Escape"&&p()};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[p]),r.useEffect(()=>{const b=g.current;if(!b)return;b.style.height="auto";const L=b.scrollHeight>300;b.style.height=`${Math.min(b.scrollHeight,300)}px`,b.style.overflowY=L?"auto":"hidden"},[t.prompt]);const x=()=>{const b=t.title.trim(),L=t.prompt.trim();if(!b||!L){l({...t,error:h("tpl.required")});return}c({id:t.id,icon:t.icon.trim()||"📌",title:b,desc:t.desc.trim(),prompt:L})},v=!!t.builtin&&!s;return e.jsx("div",{className:"modal-backdrop",onClick:p,children:e.jsxs("div",{className:"modal template-modal",onClick:b=>b.stopPropagation(),children:[e.jsxs("div",{className:"template-modal-head",children:[e.jsx("span",{className:"template-modal-icon",children:t.icon}),e.jsx("span",{className:"template-modal-badge",children:h(v?"tpl.builtin":"tpl.custom")}),e.jsx("span",{className:"template-modal-title",children:h(s?"tpl.newTitle":"tpl.editTitle")}),e.jsx("button",{type:"button",className:"btn template-modal-close",title:h("close"),onClick:p,children:e.jsx(je,{})})]}),e.jsxs("label",{className:"template-field",children:[e.jsx("span",{className:"template-field-label",children:h("tpl.fieldIcon")}),e.jsx("input",{className:"template-field-input icon",value:t.icon,maxLength:4,onChange:b=>l({...t,icon:b.target.value})})]}),e.jsxs("label",{className:"template-field",children:[e.jsx("span",{className:"template-field-label",children:h("tpl.fieldTitle")}),e.jsx("input",{className:"template-field-input",value:t.title,placeholder:h("tpl.fieldTitlePh"),onChange:b=>l({...t,title:b.target.value})})]}),e.jsxs("label",{className:"template-field",children:[e.jsx("span",{className:"template-field-label",children:h("tpl.fieldDesc")}),e.jsx("input",{className:"template-field-input",value:t.desc,placeholder:h("tpl.fieldDescPh"),onChange:b=>l({...t,desc:b.target.value})})]}),e.jsxs("label",{className:"template-field",children:[e.jsx("span",{className:"template-field-label",children:h("tpl.fieldPrompt")}),e.jsx("textarea",{ref:g,className:"template-field-prompt",value:t.prompt,placeholder:h("tpl.fieldPromptPh"),onChange:b=>l({...t,prompt:b.target.value})})]}),t.error&&e.jsx("div",{className:"template-error",children:t.error}),e.jsxs("div",{className:"template-modal-actions",children:[e.jsxs("div",{className:"template-modal-actions-left",children:[!s&&v&&i&&e.jsx("button",{type:"button",className:"btn template-btn ghost",title:h("tpl.restoreTip"),onClick:a,children:h("tpl.restore")}),!s&&v&&e.jsxs("button",{type:"button",className:"btn template-btn ghost danger",title:h("tpl.removeTip"),onClick:n,children:[e.jsx(Me,{})," ",h("tpl.remove")]}),!s&&!v&&e.jsxs("button",{type:"button",className:"btn template-btn ghost danger",title:h("tpl.deleteTip"),onClick:n,children:[e.jsx(Me,{})," ",h("tpl.delete")]})]}),e.jsxs("div",{className:"template-modal-actions-right",children:[e.jsx("button",{type:"button",className:"btn template-btn",onClick:x,children:h("tpl.save")}),e.jsx("button",{type:"button",className:"btn template-btn fill",onClick:o,title:h("tpl.fillTip"),children:h("tpl.fill")}),e.jsxs("button",{type:"button",className:"btn template-btn send",onClick:u,title:h("tpl.sendTip"),children:[e.jsx(Ds,{})," ",h("tpl.sendNow")]})]})]})]})})}const xs=new Map,ba=15,vs=30,ys=250,ks=1200,ja=1600;function bs(t){return t.content.some(s=>s.type==="toolCall")}function wa({state:t,liveOutputs:s,toolStatuses:i,onEdit:l,onKillBash:c,thinkingWrap:a,toolsWrap:n}){const o=me(),u=r.useRef(null),[p,h]=r.useState(!0),g=r.useRef(!0),x=r.useRef(0),v=r.useRef(!1),b=r.useRef(0),[L,S]=r.useState(()=>new Set),[F,k]=r.useState(!1),y=t.streamingMessage?[...t.messages,t.streamingMessage]:t.messages,P=r.useMemo(()=>{const T=new Map;for(const $ of t.messages)$.role==="toolResult"&&$.toolCallId&&T.set($.toolCallId,$);return T},[t.messages]),I=r.useMemo(()=>na(t.messages),[t.messages]),E=y.length>0?y[y.length-1].id:null,j=t.messages.length>vs?Math.max(0,t.messages.length-ba):0,[m,D]=r.useState(()=>new Set),[W,ee]=r.useState(()=>new Set),X=r.useRef(new Map),O=r.useRef(new Map),H=r.useRef(0),R=r.useRef(m);R.current=m;const C=t.messages.length>vs&&!F,N=r.useRef(C);N.current=C;const U=ca(t.messages,X.current,ja),_=r.useRef(U);_.current=U;const q=r.useCallback(()=>{const T=u.current;if(!T)return;if(!N.current){D(G=>G.size?new Set:G);return}const $=T.getBoundingClientRect(),ne={top:$.top-ks,bottom:$.bottom+ks},ae=[];for(const[G,z]of O.current){const xe=z.getBoundingClientRect();ae.push({id:G,top:xe.top,bottom:xe.bottom}),R.current.has(G)||X.current.set(G,xe.bottom-xe.top)}const f=la(ae,ne,_.current,R.current);for(const G of f.hide){const z=O.current.get(G);z&&X.current.set(G,z.offsetHeight)}D(G=>oa(G,f))},[]),w=r.useCallback(()=>{H.current||(H.current=requestAnimationFrame(()=>{H.current=0,q()}))},[q]);r.useLayoutEffect(()=>{q()},[q]);const Z=r.useRef(F);r.useLayoutEffect(()=>{Z.current&&!F&&q(),Z.current=F},[F,q]);const te=r.useCallback((T,$)=>{X.current.set(T,$)},[]),ue=r.useCallback(T=>{T&&O.current.set(T.dataset.lazyId??"",T)},[]);r.useEffect(()=>{const T=new Set(t.messages.map($=>$.id));for(const[$,ne]of O.current)T.has($)||(O.current.delete($),X.current.delete($));D($=>{let ne=!1;const ae=new Set;for(const f of $)T.has(f)?ae.add(f):ne=!0;return ne?ae:$})},[t.messages,L]),r.useEffect(()=>()=>cancelAnimationFrame(H.current),[]);const A=r.useMemo(()=>{const T=[];for(const $ of t.messages){if($.role!=="user")continue;const ne=$.content.map(G=>{var z;return((z=Qe(G))==null?void 0:z.text)??""}).filter(Boolean).join(" "),ae=Bt(ne),f=ae?ae.userMessage??`skill:${ae.name}`:ne.trim();f&&T.push({id:$.id,text:f})}return T},[t.messages]),Q=r.useMemo(()=>{const T=new Map;return A.forEach(($,ne)=>T.set($.id,ne)),T},[A]),[oe,J]=r.useState(-1),de=r.useRef(-1),ie=r.useRef(A);r.useEffect(()=>{ie.current=A},[A]);const d=r.useCallback(()=>{const T=u.current,$=ie.current;if(!T||$.length===0)return;const ne=T.getBoundingClientRect().top,ae=140;let f=-1;for(let G=0;G<$.length;G++){const z=T.querySelector(`[data-msg-id="${$[G].id}"]`);if(z)if(z.getBoundingClientRect().top<=ne+ae)f=G;else break}f!==de.current&&(de.current=f,J(f))},[]);r.useEffect(()=>{d()},[A,d]);const M=r.useCallback(T=>{S($=>$.has(T)?$:new Set($).add(T))},[]),le=r.useCallback(T=>{const $=t.messages.findIndex(ne=>ne.id===T);$>=0&&$<j&&!L.has(T)&&cs.flushSync(()=>M(T))},[t.messages,j,L,M]);r.useEffect(()=>{const T=$=>{if(!($.ctrlKey||$.metaKey)||$.key.toLowerCase()!=="f")return;const ne=$.target;ne&&(ne.tagName==="INPUT"||ne.tagName==="TEXTAREA"||ne.isContentEditable)||($.preventDefault(),k(!0))};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[]);const se=r.useCallback(T=>{S($=>{if(!$.has(T))return $;const ne=new Set($);return ne.delete(T),ne})},[]),ge=r.useCallback(T=>{const $=t.messages.findIndex(ae=>ae.id===T);cs.flushSync(()=>{$>=0&&$<j&&!L.has(T)&&M(T),ee(ae=>ae.has(T)?ae:new Set(ae).add(T))});const ne=ie.current.findIndex(ae=>ae.id===T);de.current=ne,J(ne),requestAnimationFrame(()=>{var f,G,z;const ae=(f=u.current)==null?void 0:f.querySelector(`[data-msg-id="${T}"]`);ae&&((G=u.current)==null||G.querySelectorAll(".msg-flash").forEach(xe=>xe.classList.remove("msg-flash")),ae.scrollIntoView({block:"start"}),ae.classList.remove("msg-flash"),ae.offsetWidth,ae.classList.add("msg-flash"),ae!==((z=u.current)==null?void 0:z.lastElementChild)&&(v.current=!0))})},[t.messages,j,L,M]),Y=r.useCallback(()=>{const T=u.current;if(!T)return;const $=T.scrollTop-x.current;x.current=T.scrollTop;const ne=T.scrollHeight-T.scrollTop-T.clientHeight<80;!(Date.now()<b.current)&&$<-4&&$>-500?v.current=!0:ne&&$>=0&&(v.current=!1),g.current=ne&&!v.current,h(g.current),d(),w()},[d,w]),ce=r.useRef(!1);r.useEffect(()=>{const T=ce.current;if(ce.current=!!t.isStreaming,T&&!t.isStreaming&&!v.current){const $=()=>{const ae=u.current;ae&&!v.current&&(ae.scrollTop=ae.scrollHeight,g.current=!0,h(!0))};requestAnimationFrame(()=>requestAnimationFrame($));const ne=setTimeout($,180);return()=>clearTimeout(ne)}},[t.isStreaming]),r.useEffect(()=>{const T=u.current;T&&g.current&&(T.scrollTop=T.scrollHeight)},[y,t.isStreaming,s]);const fe=t.queue.steering.join("\0")+""+t.queue.followUp.join("\0");r.useEffect(()=>{const T=u.current;T&&g.current&&(T.scrollTop=T.scrollHeight)},[fe]);const pe=r.useCallback(()=>{if(!u.current)return;g.current=!0,v.current=!1,h(!0),b.current=Date.now()+ys;const $=()=>{const ne=u.current;!ne||!g.current||v.current||(b.current=Date.now()+ys,ne.scrollTop=ne.scrollHeight)};$(),requestAnimationFrame(()=>requestAnimationFrame($)),setTimeout($,120),setTimeout($,300),setTimeout($,600)},[]),Se=r.useRef(null);r.useEffect(()=>{const T=Se.current,$=u.current;if(!T||!$)return;const ne=ae=>{ae.preventDefault();const f=T.querySelector(".qn-list");if(f&&f.contains(ae.target)&&f.scrollHeight>f.clientHeight){f.scrollTop+=ae.deltaY;return}$.scrollTop+=ae.deltaY};return T.addEventListener("wheel",ne,{passive:!1}),()=>T.removeEventListener("wheel",ne)},[]);const[Pe,ze]=r.useState(0);r.useEffect(()=>{const T=()=>{var $;ze((($=u.current)==null?void 0:$.clientHeight)??0),w()};return T(),window.addEventListener("resize",T),()=>window.removeEventListener("resize",T)},[w]);const Fe=A.length,_e=r.useMemo(()=>Fe===0?27:Math.max(4,Math.min(27,Math.floor(((Pe||600)-16)/Fe)-3)),[Fe,Pe]),Te=_e<20;return e.jsxs("div",{className:"messages-wrap",children:[e.jsxs("div",{className:"messages",ref:u,onScroll:Y,children:[t.messages.length===0&&!t.streamingMessage&&e.jsx("div",{className:"empty-state",children:e.jsx(va,{})}),t.messages.map((T,$)=>{const ne=$<j,ae=ne&&L.has(T.id);if(ne&&!ae)return T.role==="toolResult"?null:e.jsx(ia,{message:T,onExpand:M},T.id);const f=T.role==="user"?Q.get(T.id):void 0,G=!C||U.has(T.id)||W.has(T.id)||!m.has(T.id);return e.jsx(ra,{id:T.id,show:G,height:X.current.get(T.id)??en(T.role,T.customType),containerRef:u,onMeasured:te,lazyRef:ue,children:e.jsx(ps,{message:T,qnIndex:f,qnActive:f!==void 0?f===oe:void 0,onJump:ge,toolResults:P,liveOutputs:bs(T)?s:xs,toolStatuses:i,streaming:t.isStreaming,onKillBash:c,toolsWrap:n,thinkingWrap:a,isLast:T.id===E,onEdit:l,questionAttachments:I.get(T.id),onCollapse:ae?se:void 0},T.id)},T.id)}),t.streamingMessage&&e.jsx(ps,{message:t.streamingMessage,toolResults:P,liveOutputs:bs(t.streamingMessage)?s:xs,toolStatuses:i,streaming:!0,isLast:!0,onEdit:l,onKillBash:c,toolsWrap:n,thinkingWrap:a},t.streamingMessage.id),t.isStreaming&&y.length===0&&e.jsx("div",{className:"streaming-wait",children:o("waitingResponse")}),t.queue.steering.map((T,$)=>e.jsx("div",{className:"queued-msg",children:e.jsxs("div",{className:"queued-bubble",children:[e.jsx("span",{className:"queued-tag steer",children:o("queueSteerTag")}),e.jsx("div",{className:"queued-text",children:T})]})},`q-steer-${$}`)),t.queue.followUp.map((T,$)=>e.jsx("div",{className:"queued-msg",children:e.jsxs("div",{className:"queued-bubble",children:[e.jsx("span",{className:"queued-tag follow",children:o("queueFollowTag")}),e.jsx("div",{className:"queued-text",children:T})]})},`q-fu-${$}`))]}),!p&&e.jsxs("button",{type:"button",className:"scroll-bottom",onClick:pe,children:[e.jsx(_s,{})," ",o("backToBottom")]}),e.jsx(ga,{containerRef:u,messages:y,open:F,onClose:()=>k(!1),onEnsureExpanded:le}),A.length>0&&e.jsxs("div",{className:`qn-rail ${Te?"many":""}`,ref:Se,"aria-label":o("questionNavTitle"),style:{"--rail-gap":`${_e}px`},children:[A.map((T,$)=>e.jsx("button",{type:"button",className:`qn-bar ${$===oe?"active":""}`,"aria-label":`${$+1}. ${T.text}`,onClick:()=>ge(T.id),children:e.jsxs("span",{className:"qn-bar-text",children:[$+1,". ",T.text]})},T.id)),Te&&e.jsx("div",{className:"qn-list",children:A.map((T,$)=>e.jsxs("button",{type:"button",className:`qn-list-item ${$===oe?"active":""}`,"aria-label":`${$+1}. ${T.text}`,onClick:()=>ge(T.id),children:[e.jsx("span",{className:"qn-list-idx",children:$+1}),e.jsx("span",{className:"qn-list-text",children:T.text})]},T.id))})]})]})}const ln="pi-web-model-usage";function Na(t){if(!t||typeof t!="object")return{};const s={};for(const[i,l]of Object.entries(t)){const c=typeof l=="number"?Math.floor(l):0;Number.isFinite(c)&&c>0&&(s[i]=c)}return s}function Ca(t,s){return s?{...t,[s]:(t[s]??0)+1}:t}function Sa(t,s){const i=s;return t.map((l,c)=>({m:l,i:c,count:i[l.id]??0})).sort((l,c)=>c.count-l.count||l.i-c.i).map(l=>l.m)}function on(){try{const t=localStorage.getItem(ln);return t?Na(JSON.parse(t)):{}}catch{return{}}}function Ta(t){try{localStorage.setItem(ln,JSON.stringify(t))}catch{}}function Ea(t){const s=Ca(on(),t);return Ta(s),s}const Ma=["off","minimal","low","medium","high","xhigh","max"],Ra=r.memo(function({state:s,models:i,modelsLoading:l,send:c,onManageModels:a,compact:n=!1}){const o=me(),u=s==null?void 0:s.model,p=u?`${u.provider}/${u.id}`:null,[h,g]=r.useState(!1),[x,v]=r.useState(!1),[b,L]=r.useState(""),[S,F]=r.useState(null),[k,y]=r.useState({}),P=r.useRef(null),I=r.useRef(null),[E,j]=r.useState(null);r.useEffect(()=>{if(!h){j(null);return}if(i.length===0)return;const C=requestAnimationFrame(()=>{const N=I.current;N&&j(N.offsetWidth)});return()=>cancelAnimationFrame(C)},[h,i.length]),r.useEffect(()=>{h&&y(on())},[h]),r.useEffect(()=>{h||(L(""),F(null))},[h]);const m=r.useMemo(()=>{const C=new Map;for(const N of i)C.set(N.provider,(C.get(N.provider)??0)+1);return[...C.entries()].sort((N,U)=>N[0].localeCompare(U[0])).map(([N,U])=>({name:N,count:U}))},[i]),D=r.useMemo(()=>Sa(i,k),[i,k]),W=r.useMemo(()=>{let C=D;S&&(C=C.filter(U=>U.provider===S));const N=b.trim().toLowerCase();return N?C.filter(U=>U.name.toLowerCase().includes(N)||U.provider.toLowerCase().includes(N)||U.id.toLowerCase().includes(N)):C},[D,b,S]),[ee,X]=r.useState(!1),O=s!=null&&s.availableThinkingLevels&&s.availableThinkingLevels.length>0?new Set(s.availableThinkingLevels):null,H=Ma.map(C=>({value:C,label:o(`thinking.${C}`),supported:O?O.has(C):!0})),R=C=>{var N;return((N=H.find(U=>U.value===C))==null?void 0:N.label)??C};return r.useEffect(()=>{h&&i.length===0&&!ee&&!l&&(X(!0),c({type:"list_models"}))},[h,i.length,ee,l,c]),r.useEffect(()=>{i.length>0&&X(!1)},[i.length]),r.useEffect(()=>{var N;if(!h)return;const C=(N=P.current)==null?void 0:N.querySelector(".dd-item.active");C==null||C.scrollIntoView({block:"nearest"})},[h,p,i.length]),e.jsxs(e.Fragment,{children:[e.jsxs(Le,{trigger:e.jsxs(e.Fragment,{children:[e.jsx(Ye,{}),e.jsx("span",{className:"chip-model",children:u?u.name:o("selectModel")}),!n&&(u==null?void 0:u.vision)&&e.jsx("span",{className:"chip-vision",title:o("vision"),children:"🖼"}),!n&&u&&e.jsx("span",{className:"chip-sub",children:u.provider})]}),open:h,onOpenChange:g,menuClassName:"dd-menu-model",menuRef:I,menuStyle:E!=null?{width:E}:void 0,direction:"up",children:[e.jsx("div",{className:"dd-header",children:o("availableModels")}),e.jsxs("div",{className:"dd-search-row",children:[e.jsx(ot,{}),e.jsx("input",{className:"dd-search",type:"text",placeholder:o("searchModels"),value:b,onChange:C=>L(C.target.value)})]}),e.jsxs("div",{className:"dd-model-body",children:[m.length>1&&e.jsxs("div",{className:"dd-provider-col",children:[e.jsx("div",{className:"dd-provider-head",children:o("providers")}),e.jsx("button",{type:"button",className:`dd-provider-item ${S===null?"active":""}`,onClick:()=>F(null),children:e.jsx("span",{children:o("allProviders")})}),m.map(C=>e.jsxs("button",{type:"button",className:`dd-provider-item ${S===C.name?"active":""}`,onClick:()=>F(S===C.name?null:C.name),title:`${C.name} · ${C.count}`,children:[e.jsx("span",{className:"dd-provider-name",children:C.name}),e.jsx("span",{className:"dd-provider-count",children:C.count})]},C.name))]}),e.jsxs("div",{className:"dd-model-scroll",ref:P,children:[(ee||l)&&e.jsx("div",{className:"dd-loading",children:o("loading")}),i.length===0&&!ee&&!l&&e.jsx("div",{className:"dd-loading",children:o("noModels")}),W.length===0&&i.length>0&&e.jsx("div",{className:"dd-loading",children:o("noModelMatches")}),W.map(C=>e.jsx(we,{active:p===C.id,onClick:()=>{p!==C.id&&c({type:"set_model",modelId:C.id}),g(!1)},children:e.jsxs("span",{className:"dd-model-cell",children:[e.jsx("span",{className:"dd-model-name",children:C.name}),e.jsxs("span",{className:"dd-model-meta",children:[e.jsx("span",{className:"dd-model-provider",children:C.provider}),(k[C.id]??0)>0&&e.jsx("span",{className:"dd-model-usage",children:o("modelUsedCount",{n:k[C.id]})}),(C.reasoning||C.vision)&&e.jsxs("span",{className:"dd-model-badges",children:[C.reasoning&&e.jsx("span",{className:"dd-model-badge",children:o("reasoning")}),C.vision&&e.jsx("span",{className:"dd-model-badge",children:o("vision")})]})]})]})},C.id))]})]}),e.jsxs("div",{className:"dd-footer",children:[e.jsx("button",{type:"button",className:"dd-refresh",onClick:()=>c({type:"list_models"}),children:o("refreshModels")}),e.jsx("button",{type:"button",className:"dd-refresh",onClick:()=>{g(!1),a()},children:o("manageModels")})]})]}),e.jsxs(Le,{trigger:e.jsxs(e.Fragment,{children:[e.jsx(tt,{}),e.jsx("span",{className:"chip-sub",children:o("thinkingChip",{level:s?R(s.thinkingLevel):"—"})})]}),open:x,onOpenChange:v,direction:"up",children:[e.jsx("div",{className:"dd-header",children:o("thinkingLevel")}),H.map(C=>e.jsx(we,{active:(s==null?void 0:s.thinkingLevel)===C.value,disabled:!C.supported,title:C.supported?void 0:o("thinkingUnsupported"),onClick:()=>{(s==null?void 0:s.thinkingLevel)!==C.value&&c({type:"set_thinking",level:C.value}),v(!1)},children:C.label},C.value))]})]})}),Pa=r.memo(function({ready:s,streaming:i,messages:l,slashCommands:c,modelState:a,models:n,modelsLoading:o,send:u,attachments:p,onRemoveAttachment:h,onAddImageFiles:g,onAddLocalFiles:x,onNotice:v,onSent:b,onManageModels:L}){const S=me(),{locale:F}=Lt(),{openPicker:k}=an(),y=d=>F==="en"&&d.descriptionEn?d.descriptionEn:d.description??"",P=d=>F==="en"&&d.argumentHintEn?d.argumentHintEn:d.argumentHint??"",[I,E]=r.useState(""),[j,m]=r.useState(!1),[D,W]=r.useState(null),[ee,X]=r.useState(0),[O,H]=r.useState(!1),[R,C]=r.useState(void 0),N=r.useRef(null),U=r.useRef(null),_=r.useRef(null),q={builtin:S("slashBuiltin"),extension:S("slashExtension"),prompt:S("slashPrompt"),skill:S("slashSkill"),plugin:S("slashPlugin")},w=d=>{const M=d.match(/^\/([^\s]*)$/);if(M&&s){const le=M[1].toLowerCase(),se=c.filter(ge=>ge.name.toLowerCase().startsWith(le));W(se.length>0?se:null),X(0)}else W(null)};r.useEffect(()=>{var M;const d=(M=_.current)==null?void 0:M.querySelector(".slash-item.active");d==null||d.scrollIntoView({block:"nearest"})},[ee,D]);const Z=d=>{var Y;const M=D??[],le=d??M[ee%Math.max(M.length,1)];if(!le){W(null);return}const se=I.match(/^\/([^\s]*)([\s\S]*)$/),ge=se?se[2]:"";E(`/${le.name} ${ge}`),W(null),(Y=N.current)==null||Y.focus()},te=async()=>{const M=[...l].reverse().find(se=>se.role==="assistant"&&se.content.some(ge=>ge.type==="text"&&ge.text)),le=M==null?void 0:M.content.filter(se=>se.type==="text").map(se=>se.text).join(`
|
|
317
317
|
`);if(!le){v("warning",S("slashCopyEmpty"));return}try{await navigator.clipboard.writeText(le),v("info",S("slashCopied"))}catch{v("error",S("slashCopyFailed"))}},ue=d=>{if(!d||d.length===0){v("warning",S("foldersNotSupported"));return}const M=Array.from(d).filter(se=>Re(se.type)),le=Array.from(d).filter(se=>!Re(se.type));M.length>0&&g(M),le.length>0&&x(le)},A=d=>{var se;const M=(se=d.clipboardData)==null?void 0:se.items;if(!M)return;const le=[];for(const ge of M)if(ge.kind==="file"&&Re(ge.type)){const Y=ge.getAsFile();Y&&le.push(Y)}le.length!==0&&(d.preventDefault(),g(le))},Q=s,oe=r.useRef(I);r.useEffect(()=>{oe.current=I},[I]),r.useEffect(()=>{w(oe.current)},[c]),r.useEffect(()=>{const d=M=>{var se;const le=M.detail;E(le),(se=N.current)==null||se.focus()};return window.addEventListener("pi-web:fill",d),()=>window.removeEventListener("pi-web:fill",d)},[]),r.useEffect(()=>{if(!O)return;const d=M=>{M.key==="Escape"&&H(!1)};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[O]),r.useEffect(()=>{const d=N.current;if(!d)return;d.style.height="auto";const M=d.scrollHeight>220;d.style.height=`${Math.min(d.scrollHeight,220)}px`,d.style.overflowY=M?"auto":"hidden"},[I]);const J=(d=!1)=>{var se,ge,Y,ce,fe;const M=I.trim(),le=p.some(pe=>pe.imageData||pe.fileData);if(!(!Q||!M&&!le)){if(M==="/help"){const pe=(ge=(se=N.current)==null?void 0:se.closest(".inputbox"))==null?void 0:ge.getBoundingClientRect();C(pe==null?void 0:pe.width),H(!0),E(""),(Y=N.current)==null||Y.focus();return}if(M==="/copy"){E(""),(ce=N.current)==null||ce.focus(),te();return}if(u({type:"prompt",text:M,queue:d,attachments:p.map(pe=>pe.imageData?{path:"",imageData:pe.imageData,mimeType:pe.mimeType,name:pe.name}:pe.fileData?{path:"",fileData:pe.fileData,mimeType:pe.mimeType,name:pe.name,size:pe.size}:{path:pe.path,mode:pe.mode,...pe.lines?{lines:pe.lines}:{}})})){E(""),b();const pe=a==null?void 0:a.model;pe&&Ea(`${pe.provider}/${pe.id}`),(fe=N.current)==null||fe.focus()}}},de=d=>{if(!d.nativeEvent.isComposing){if(D&&D.length>0)switch(d.key){case"ArrowDown":d.preventDefault(),X(M=>(M+1)%D.length);return;case"ArrowUp":d.preventDefault(),X(M=>(M-1+D.length)%D.length);return;case"Tab":case"Enter":d.preventDefault(),Z();return;case"Escape":d.preventDefault(),W(null);return}d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),J())}},ie=()=>e.jsx("div",{className:"inputbox-actions",children:i?e.jsxs(e.Fragment,{children:[I.trim()!==""&&e.jsxs("button",{type:"button",className:"btn supplement",title:S("supplementTip"),onClick:()=>J(!0),children:[e.jsx(Ds,{})," ",S("supplement")]}),e.jsx("button",{type:"button",className:"btn stop",title:S("stopAgent"),onClick:()=>u({type:"abort"}),children:e.jsx(rt,{})})]}):e.jsx("button",{type:"button",className:"btn send",title:S("sendTip"),disabled:!Q||!I.trim()&&!p.some(d=>d.imageData||d.fileData),onClick:()=>J(),children:e.jsx(As,{})})});return e.jsxs("div",{className:`inputbar${j?" drop-active":""}`,onDragOver:d=>{d.preventDefault(),d.stopPropagation(),m(!0)},onDragLeave:d=>{d.currentTarget.contains(d.relatedTarget)||m(!1)},onDrop:d=>{var M;d.preventDefault(),d.stopPropagation(),m(!1),ue(((M=d.dataTransfer)==null?void 0:M.files)??null)},children:[j&&e.jsx("div",{className:"drop-overlay",children:e.jsxs("span",{children:["📎 ",S("dropHereToAttach")]})}),p.length>0&&e.jsxs("div",{className:"attach-row",children:[p.map(d=>e.jsxs("span",{className:`attach-chip ${d.imageData?"image":d.fileData?"file":d.mode}`,title:d.imageData?S("attachImage",{name:d.name}):d.fileData?S("attachFile",{name:d.name}):d.isDir?S("folderRef",{path:d.path}):d.mode==="reference"?S("refOnly",{path:d.path}):d.mode==="lines"&&d.lines?S("attachLines",{path:d.path,start:d.lines.start,end:d.lines.end}):S("attachContent",{path:d.path}),children:[d.imageData?"🖼":d.fileData?"📄":d.isDir?"📁":d.mode==="reference"?"🔗":"📎"," ",d.name,d.mode==="lines"&&d.lines&&e.jsxs("span",{className:"attach-range",children:["L",d.lines.start,"-",d.lines.end]}),e.jsx("button",{type:"button",className:"attach-remove",title:S("removeAttachment"),onClick:()=>h(d.key??d.path),children:"×"})]},d.key??`${d.path}|${d.mode}|${d.lines?`${d.lines.start}-${d.lines.end}`:""}`)),e.jsx("span",{className:"attach-hint",children:S("attachHint")})]}),D&&D.length>0&&e.jsxs("div",{className:"slash-menu",role:"listbox",ref:_,"aria-label":S("slashCommands"),children:[e.jsxs("div",{className:"slash-menu-hint",children:[e.jsx("span",{children:S("slashMenuHint")}),e.jsx("span",{className:"slash-menu-close",onClick:()=>W(null),children:"Esc"})]}),D.map((d,M)=>e.jsxs("button",{type:"button",className:`slash-item${M===ee?" active":""}`,onMouseEnter:()=>X(M),onClick:()=>Z(d),children:[e.jsxs("span",{className:"slash-name",children:["/",d.name]}),e.jsx("span",{className:`slash-source ${d.source}`,children:q[d.source]}),e.jsxs("span",{className:"slash-desc",children:[y(d),d.argumentHint&&e.jsx("span",{className:"slash-hint",children:P(d)})]})]},d.name))]}),O&&e.jsx("div",{className:"modal-backdrop",onClick:()=>H(!1),children:e.jsxs("div",{className:"slash-help",style:R?{width:R}:void 0,onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"slash-help-head",children:[e.jsxs("span",{children:["⚡ ",S("slashHelpTitle")]}),e.jsx("button",{type:"button",className:"btn",onClick:()=>H(!1),children:S("close")})]}),e.jsx("div",{className:"slash-help-body",children:c.length===0?e.jsx("div",{className:"slash-help-empty",children:S("slashLoading")}):c.map(d=>e.jsxs("div",{className:"slash-help-row",children:[e.jsxs("span",{className:"slash-help-cmd",children:["/",d.name]}),e.jsx("span",{className:`slash-source ${d.source}`,children:q[d.source]}),e.jsxs("span",{className:"slash-help-desc",children:[y(d),d.argumentHint&&e.jsx("span",{className:"slash-hint",children:P(d)})]})]},d.name))})]})}),e.jsxs("div",{className:"inputbox",children:[e.jsx("input",{ref:U,type:"file",multiple:!0,hidden:!0,onChange:d=>{ue(d.target.files),d.target.value=""}}),e.jsx("textarea",{ref:N,value:I,rows:1,placeholder:S(Q?i?"placeholderStreaming":"placeholderIdle":"placeholderConnecting"),disabled:!Q,onChange:d=>{E(d.target.value),w(d.target.value)},onKeyDown:de,onPaste:A}),e.jsxs("div",{className:"composer-tools",children:[e.jsxs("div",{className:"composer-tools-left",children:[e.jsx("button",{type:"button",className:"btn attach-img",title:S("uploadFile"),disabled:!Q,onClick:()=>{var d;return(d=U.current)==null?void 0:d.click()},children:e.jsx($n,{})}),e.jsx("button",{type:"button",className:"btn tpl-open",title:S("tpl.openPicker"),onClick:k,children:e.jsx(Vn,{})}),e.jsx(Ra,{state:a,models:n,modelsLoading:o,send:u,onManageModels:L,compact:!0})]}),e.jsx("div",{className:"composer-tools-right",children:ie()})]})]})]})}),Ia=r.memo(function({goal:s,models:i,modelsLoading:l,activeConversationId:c,send:a}){var ee,X,O,H,R,C;const n=me(),o=!s.conversationId||s.conversationId===c,u=s.goal!==null&&o,[p,h]=r.useState(""),[g,x]=r.useState(s.reviewModel??""),[v,b]=r.useState(s.maxRounds),[L,S]=r.useState(s.locked),[F,k]=r.useState(!1),[y,P]=r.useState(!1),[I,E]=r.useState(!0);r.useEffect(()=>{x(s.reviewModel??""),b(s.maxRounds||0),S(s.locked)},[s.goal,s.reviewModel,s.maxRounds,s.locked]),r.useEffect(()=>{F&&i.length===0&&!y&&!l&&(P(!0),a({type:"list_models"}))},[F,i.length,y,l,a]),r.useEffect(()=>{i.length>0&&P(!1)},[i.length]);const j=()=>{var N;return g?((N=i.find(U=>U.id===g))==null?void 0:N.name)??g:n("goalBarUseMainModel")},m=()=>{const N=p.trim();N&&(a({type:"set_goal",goal:N,...g?{reviewModel:g}:{},maxRounds:v,locked:L}),h(""),E(!1))},D=()=>{const N=p.trim();N&&(a({type:"start_goal_wizard",text:N,...g?{wizardModel:g}:{},maxRounds:v,locked:L}),h(""),E(!1))},W=(((ee=s.wizard)==null?void 0:ee.active)??!1)&&o;return W?e.jsx("div",{className:`goalbar goalbar-active ${W?"wizard":""}`,children:e.jsxs("div",{className:"goalbar-active-row",children:[e.jsx("span",{className:"goalbar-icon",children:e.jsx("span",{className:"goalbar-spin",children:"🔍"})}),e.jsxs("span",{className:"goalbar-text",title:((X=s.wizard)==null?void 0:X.draft)??"",children:[n("goalWizardRunning"),": ",(O=s.wizard)==null?void 0:O.draft]}),e.jsxs("span",{className:"goalbar-chip reviewing",children:[n("goalBarRound",{n:(((H=s.wizard)==null?void 0:H.step)??0)+1})," ","/ ",((R=s.wizard)==null?void 0:R.maxSteps)??6]}),e.jsx("span",{className:"goalbar-detail",children:((C=s.wizard)==null?void 0:C.status)||n("goalBarReviewing")}),e.jsx("button",{type:"button",className:"goalbar-x",title:n("goalBarClear"),onClick:()=>{a({type:"clear_goal"}),E(!0)},children:e.jsx(je,{})})]})}):u?e.jsx("div",{className:`goalbar goalbar-active ${s.reviewing?"reviewing":""}`,children:e.jsxs("div",{className:"goalbar-active-row",children:[e.jsx("span",{className:"goalbar-icon",children:s.reviewing?e.jsx("span",{className:"goalbar-spin",children:"◌"}):"🎯"}),e.jsx("span",{className:"goalbar-text",title:s.goal??"",children:s.goal}),s.reviewing?e.jsxs("span",{className:"goalbar-chip reviewing",children:[n("goalBarReviewing")," ",n("goalBarRound",{n:s.round})]}):e.jsx("span",{className:`goalbar-chip ${s.verdict==="pass"?"pass":s.verdict==="fail"?"fail":""}`,children:s.verdict==="pass"?n("goalBarPassed"):s.verdict==="fail"?n("goalBarFailed"):`${n("goalBarRound",{n:s.round||1})} · ${s.locked?n("goalBarLocked"):n("goalBarUnlocked")}`}),e.jsx("span",{className:"goalbar-detail",children:s.status}),e.jsx("button",{type:"button",className:"goalbar-x",title:n("goalBarClear"),disabled:s.reviewing,onClick:()=>{a({type:"clear_goal"}),E(!0)},children:e.jsx(je,{})})]})}):I?e.jsx("div",{className:"goalbar goalbar-collapsed",children:e.jsxs("button",{type:"button",className:"goalbar-hint",title:n("goalBarPlaceholder"),onClick:()=>E(!1),children:[e.jsx(Xt,{})," ",e.jsx("span",{children:n("goalBarTitle")})]})}):e.jsxs("div",{className:"goalbar",children:[e.jsxs("div",{className:"goalbar-row",children:[e.jsx("span",{className:"goalbar-icon",children:e.jsx(Xt,{})}),e.jsx("input",{className:"goalbar-input",value:p,placeholder:n("goalBarPlaceholder"),onChange:N=>h(N.target.value),onKeyDown:N=>{N.key==="Enter"&&m()}}),e.jsx("button",{type:"button",className:"goalbar-btn",disabled:!p.trim(),onClick:m,children:n("goalBarSet")}),e.jsxs("button",{type:"button",className:"goalbar-btn wizard",disabled:!p.trim(),title:n("goalWizardTip"),onClick:D,children:["🔍 ",n("goalWizardBtn")]}),e.jsx("button",{type:"button",className:"goalbar-icon-btn",title:n(L?"goalBarLocked":"goalBarUnlocked"),onClick:()=>S(N=>(a({type:"set_goal_prefs",locked:!N}),!N)),children:L?e.jsx(qn,{}):e.jsx(Ln,{})}),e.jsx("button",{type:"button",className:"goalbar-icon-btn",title:n("goalBarClear"),onClick:()=>E(!0),children:e.jsx(ut,{})})]}),e.jsxs("div",{className:"goalbar-opts",children:[e.jsxs(Le,{trigger:e.jsxs("span",{className:"goalbar-opt",children:[n("goalBarReviewModel"),": ",e.jsx("b",{children:j()})]}),open:F,onOpenChange:k,direction:"up",children:[e.jsx("div",{className:"dd-header",children:n("goalBarReviewModel")}),(y||l)&&e.jsx("div",{className:"dd-loading",children:n("loading")}),i.length===0&&!y&&!l&&e.jsx("div",{className:"dd-loading",children:n("noModels")}),e.jsx(we,{active:g==="",onClick:()=>{x(""),k(!1),a({type:"set_goal_prefs",reviewModel:""})},children:n("goalBarUseMainModel")}),i.map(N=>e.jsx(we,{active:g===N.id,onClick:()=>{x(N.id),k(!1),a({type:"set_goal_prefs",reviewModel:N.id})},children:e.jsxs("span",{className:"dd-model-cell",children:[e.jsx("span",{className:"dd-model-name",children:N.name}),e.jsx("span",{className:"dd-model-meta",children:e.jsx("span",{className:"dd-model-provider",children:N.provider})})]})},N.id)),e.jsx("button",{type:"button",className:"dd-refresh",onClick:()=>a({type:"list_models"}),children:n("refreshModels")})]}),e.jsxs("label",{className:"goalbar-round",title:n("goalBarMaxRoundsTip"),children:[e.jsx("span",{children:n("goalBarMaxRounds")}),e.jsx("input",{type:"number",min:0,step:1,value:v,placeholder:n("goalBarUnlimitedShort"),onChange:N=>{const U=parseInt(N.target.value,10);if(Number.isNaN(U)||U<0){b(0);return}b(U)},onBlur:()=>a({type:"set_goal_prefs",maxRounds:v}),onKeyDown:N=>{N.key==="Enter"&&(a({type:"set_goal_prefs",maxRounds:v}),N.target.blur())}})]}),e.jsx("span",{className:"goalbar-lock-hint",children:n(L?"goalBarLocked":"goalBarUnlocked")})]})]})});function La({chat:t,send:s}){const i=me(),l=t.state,[c,a]=r.useState(!1),[n,o]=r.useState(""),[u,p]=r.useState(0),h=r.useRef(null),g=t.pathCompletions;if(r.useEffect(()=>{if(!c)return;const m=setTimeout(()=>{s({type:"complete_path",path:n})},150);return()=>clearTimeout(m)},[n,c,s]),r.useEffect(()=>p(0),[g]),r.useEffect(()=>{const m=document.querySelector(`.status-completions .pc-item[data-idx="${u}"]`);m==null||m.scrollIntoView({block:"nearest"})},[u]),!l)return null;const x=l.stats,v=t.ready?"ok":"busy",b=t.ready?i("connected"):i("connecting"),L=x.contextUsage,S=L.tokens!==null&&L.percent!==null?`${js(L.tokens)} / ${js(L.contextWindow)}`:"—",F=L.percent??null,k=F===null?"":F>=80?"warn":F>=50?"mid":"ok",y=l.queue.steering.length+l.queue.followUp.length,P=()=>{o(l.cwd),a(!0)},I=(m,D)=>{var ee;const W=m.includes("\\")?"\\":"/";o(D?`${m}${W}`:m),p(0),(ee=h.current)==null||ee.focus()},E=m=>{const D=m.trim();D&&D!==l.cwd&&s({type:"set_cwd",path:D}),a(!1)},j=m=>{if(m.key==="ArrowDown")m.preventDefault(),p(D=>Math.min(D+1,g.length-1));else if(m.key==="ArrowUp")m.preventDefault(),p(D=>Math.max(D-1,0));else if(m.key==="Tab"&&g.length>0){m.preventDefault();const D=g[Math.min(u,g.length-1)];I(D.path,D.type==="dir")}else if(m.key==="Enter"&&!m.nativeEvent.isComposing){const D=n.trim();if(D.endsWith("/")||D.endsWith("\\"))E(D);else if(g.some(W=>W.path===D))E(D);else if(g.length>0&&g[u]){m.preventDefault();const W=g[u];I(W.path,W.type==="dir")}else E(D)}else m.key==="Escape"&&(g.length>0?(m.stopPropagation(),s({type:"complete_path",path:""})):a(!1))};return e.jsxs("footer",{className:"statusbar",children:[e.jsx("span",{className:`status-dot ${v}`,title:b}),e.jsx("span",{className:"status-item",children:b}),e.jsx("span",{className:"status-sep",children:"·"}),e.jsxs("span",{className:"status-item status-ctx",title:i("contextUsage"),children:[i("context"),e.jsx("span",{className:`ctx-bar ${k}`,children:F!==null&&e.jsx("span",{className:"ctx-bar-fill",style:{width:`${Math.min(F,100)}%`}})}),S]}),e.jsx("span",{className:"status-sep",children:"·"}),e.jsxs("span",{className:"status-item",title:i("cumulativeCost"),children:["$",Da(x.cost)]}),e.jsx("span",{className:"status-sep",children:"·"}),e.jsxs("span",{className:"status-item",title:i("sessionMessages"),children:[i("messages")," ",x.totalMessages]}),t.statuses.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"status-sep",children:"·"}),e.jsx("span",{className:"status-item ext-status",title:i("pluginStatus"),children:t.statuses.map(m=>m.text).join(" · ")})]}),l.isStreaming&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"status-sep",children:"·"}),e.jsxs("span",{className:"status-item working",children:[e.jsx("span",{className:"working-spin"}),i("working"),y>0&&e.jsxs("span",{className:"status-queue",children:["⏳ ",y," ",i("queued")]})]})]}),c?e.jsxs("div",{className:"status-cwd-wrap",children:[e.jsx("input",{ref:h,className:"status-cwd-input",value:n,autoFocus:!0,placeholder:i("enterPath"),onChange:m=>o(m.target.value),onKeyDown:j,onBlur:()=>a(!1)}),g.length>0&&e.jsx("ul",{className:"status-completions",onMouseDown:m=>m.preventDefault(),children:g.map((m,D)=>e.jsx("li",{children:e.jsxs("button",{type:"button","data-idx":D,className:`pc-item ${D===u?"sel":""}`,onMouseEnter:()=>p(D),onClick:()=>I(m.path,m.type==="dir"),children:[e.jsx("span",{className:"pc-icon",children:m.type==="dir"?e.jsx(Ue,{}):e.jsx(Fs,{})}),e.jsxs("span",{className:"pc-body",children:[e.jsx("span",{className:"pc-name",children:m.name}),e.jsx("span",{className:"pc-path",children:m.path})]})]})},m.path))})]}):e.jsxs("button",{type:"button",className:"status-item status-cwd",title:i("cwdTip",{path:l.cwd}),onClick:P,children:["📁 ",l.cwd]})]})}function js(t){return t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}K`:String(t)}function Da(t){return t<=0?"0":t<1e-4?"<0.0001":t.toFixed(4).replace(/\.?0+$/,"")}function Ba({dialog:t,send:s}){const i=me(),[l,c]=r.useState(""),[a,n]=r.useState(0),o=h=>{s({type:"dialog_response",id:t.id,value:h})};r.useEffect(()=>{c(""),n(0);const h=g=>{g.key==="Escape"&&o(null)};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[t.id]);const u=Array.isArray(t.args[0])?t.args[0]:[],p=typeof t.args[0]=="string"?t.args[0]:"";return e.jsxs("div",{className:"dialog-inline","data-dialog-kind":t.kind,children:[e.jsxs("div",{className:"dialog-head",children:[e.jsx("span",{className:"dialog-badge",children:i("pluginRequest")}),t.title&&t.title!==i("pluginRequest")&&e.jsx("span",{className:"dialog-title",children:t.title}),e.jsx("button",{type:"button",className:"dialog-dismiss",title:i("cancel"),onClick:()=>o(null),children:"✕"})]}),t.kind==="select"&&e.jsxs("div",{className:"dialog-options",children:[u.map((h,g)=>e.jsx("button",{type:"button",className:`dialog-option ${g===a?"sel":""}`,onMouseEnter:()=>n(g),onClick:()=>o(h),children:h},g)),u.length===0&&e.jsx("div",{className:"dialog-hint",children:i("noOptions")})]}),t.kind==="confirm"&&e.jsxs("div",{className:"dialog-body",children:[e.jsx("p",{children:p}),e.jsxs("div",{className:"dialog-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:()=>o(!1),children:i("cancel")}),e.jsx("button",{type:"button",className:"btn primary",onClick:()=>o(!0),children:i("ok")})]})]}),t.kind==="input"&&e.jsxs("div",{className:"dialog-body",children:[e.jsx("input",{className:"dialog-input",value:l,placeholder:p||i("inputPlaceholder"),autoFocus:!0,onChange:h=>c(h.target.value),onKeyDown:h=>{h.key==="Enter"&&!h.nativeEvent.isComposing&&o(l)}}),e.jsxs("div",{className:"dialog-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:()=>o(null),children:i("cancel")}),e.jsx("button",{type:"button",className:"btn primary",onClick:()=>o(l),children:i("ok")})]})]})]})}function Fa(t){if(t.x==="?"&&t.y==="?")return"untracked";const s=t.x!==" "&&t.x!=="?",i=t.y!==" "&&t.y!=="?";return s&&i?"both":s?"staged":"unstaged"}function $a({chat:t,send:s,terminal:i,active:l,onSwitchToTerminal:c}){var ne,ae;const a=me(),[n,o]=r.useState(null),[u,p]=r.useState([]),[h,g]=r.useState(""),[x,v]=r.useState(new Map),[b,L]=r.useState("changes"),[S,F]=r.useState([]),[k,y]=r.useState(null),[P,I]=r.useState(""),[E,j]=r.useState(!1),[m,D]=r.useState(null),[W,ee]=r.useState(null),[X,O]=r.useState(!1),[H,R]=r.useState(!1),[C,N]=r.useState(!1),[U,_]=r.useState(null),[q,w]=r.useState(!1),[Z,te]=r.useState(""),ue=r.useRef(0),A=r.useRef(-1),Q=r.useRef(-1),oe=r.useRef(-1),J=r.useRef(-1),de=r.useRef(void 0),ie=r.useRef(null),d=r.useRef([]),M=r.useCallback(f=>{if(f.reqId===A.current){if(A.current=-1,R(!1),_(null),!f.ok){_(f.error??"查询失败");return}if(f.notRepo){w(!0),o(null),p([]),v(new Map),F([]),y(null),I(""),ee(null);return}w(!1);const G={branch:f.branch??"",detached:!!f.detached,upstream:f.upstream??null,ahead:f.ahead??0,behind:f.behind??0,upstreamGone:!!f.upstreamGone,files:(f.files??[]).map(he=>({...he}))},z=(f.branches??[]).map(he=>({...he})),xe=new Map;for(const[he,be]of Object.entries(f.stats??{}))xe.set(he,{add:be[0],del:be[1]});o(G),p(z),v(xe),g(he=>{var be;return G.detached?he||"":G.branch&&z.some(Ce=>Ce.name===G.branch)?G.branch:he&&z.some(Ce=>Ce.name===he)?he:((be=z[0])==null?void 0:be.name)??""}),ee(he=>he&&!G.files.some(be=>be.path===he.file.path)?null:he)}else if(f.reqId===Q.current){if(Q.current=-1,O(!1),!f.ok){_(f.error??"查询失败");return}const G=ie.current;if(!G)return;ee({file:G,staged:f.stagedText??"",worktree:f.worktreeText??"",untracked:!1})}else if(f.reqId===J.current){if(J.current=-1,N(!1),!f.ok){_(f.error??"查询失败");return}F((f.history??[]).map(G=>({...G})))}else if(f.reqId===oe.current){if(oe.current=-1,j(!1),!f.ok){_(f.error??"查询失败");return}I(f.text??"")}},[]);r.useEffect(()=>{const f=t.scmData;f&&f.type==="scm_data"&&M(f)},[t.scmData,M]);const le=r.useCallback((f,G)=>{if(!t.ready||t.status!=="open")return!1;const z=++ue.current;return s({...f,reqId:z})?(G.current=z,!0):(ue.current-=1,!1)},[t.ready,t.status,s]),se=r.useCallback((f=!1,G=!1)=>{var z;!t.ready||t.status!=="open"||(z=t.state)!=null&&z.cwd&&(de.current!==void 0&&de.current!==t.state.cwd&&(o(null),p([]),v(new Map),F([]),N(!1),J.current=-1,y(null),I(""),ee(null),D(null)),de.current=t.state.cwd,_(null),le({type:"scm_status"},A)&&(G||R(!0)))},[t.ready,(ne=t.state)==null?void 0:ne.cwd,t.status,le]),ge=r.useCallback(f=>{if(D(f),y(null),ie.current=f,f.x==="?"&&f.y==="?"){ee({file:f,staged:"",worktree:"",untracked:!0});return}O(!0),_(null),le({type:"scm_filediff",path:f.path},Q)||O(!1)},[le]),Y=r.useCallback(f=>{y(f),D(null),ee(null),I(""),j(!0),_(null),le({type:"scm_commit",hash:f.hash},oe)||j(!1)},[le]),ce=r.useCallback((f,G)=>{var he,be;if(!t.ready)return;const z={name:f,command:G,cwd:"${pwd}"},xe=t.terminals.find(Ce=>Ce.title===f);if(xe)i.restart(xe.id),s({type:"run_command",terminalId:xe.id,conversationId:xe.conversationId,command:z,cols:80,rows:24});else{const Ce=Be();i.create({id:Ce,conversationId:t.activeConversationId||((he=t.state)==null?void 0:he.conversationId)||"",title:f,cwd:((be=t.state)==null?void 0:be.cwd)??"",cols:80,rows:24,running:!0,exitCode:null,command:z})}c()},[t.ready,(ae=t.state)==null?void 0:ae.cwd,t.terminals,c,s,i]),fe=r.useCallback(()=>{const f=Z.trim();if(!f||q)return;const G=f.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/`/g,"\\`").replace(/\$/g,"\\$");ce("git commit",`git add -A && git commit -m "${G}"`),te("")},[Z,q,ce]),pe=f=>`'${f.replace(/'/g,"'\\''")}`,Se=r.useCallback(f=>{q||ce("git add",`git add -- ${pe(f.path)}`)},[q,ce]),Pe=r.useCallback(f=>{q||ce("git reset",`git reset HEAD -- ${pe(f.path)}`)},[q,ce]),ze=r.useCallback(()=>{if(!h||q)return;const f=u.find(G=>G.name===h);if(f!=null&&f.remote&&typeof f.remote=="string"){const G=h.slice(f.remote.length+1);ce("git checkout",`git checkout -b ${G} ${h} || git checkout ${h}`)}else ce("git checkout",`git checkout ${h}`)},[h,u,q,ce]),Fe=r.useCallback(()=>ce("git push","git push"),[ce]),_e=r.useCallback(()=>ce("git pull","git pull"),[ce]),Te=r.useCallback(()=>{le({type:"scm_history"},J)||(J.current=-1)},[le]);r.useEffect(()=>{l&&se()},[l,se]),r.useEffect(()=>{b==="history"&&n&&Te()},[b,n,Te]),r.useEffect(()=>{t.scmDirty>0&&l&&se(!1,!0)},[t.scmDirty]),r.useEffect(()=>{if(!l||!t.ready||t.status!=="open")return;const f=setInterval(()=>{document.visibilityState!=="hidden"&&se(!1,!0)},3e4);return()=>clearInterval(f)},[l,t.ready,t.status,se]),r.useEffect(()=>{const f=d.current;if(d.current=t.terminals,!l)return;t.terminals.some(z=>{var he;return z.running!==!1?!1:((he=f.find(be=>be.id===z.id))==null?void 0:he.running)===!0&&/^git /.test(z.title)})&&t.ready&&t.status==="open"&&(se(!1,!0),b==="history"&&n&&Te())},[t.terminals,l,t.ready,t.status,se,b,n,Te]);const T={staged:a("scmStaged"),unstaged:a("scmUnstaged"),untracked:a("scmUntracked"),both:a("scmStagedUnstaged")},$=f=>{const G=f.split(`
|
|
318
318
|
`);return e.jsx("pre",{className:"scm-diff-pre",children:G.map((z,xe)=>{let he="";return z.startsWith("diff --git")||z.startsWith("index ")||z.startsWith("new file")||z.startsWith("deleted file")||z.startsWith("old mode")||z.startsWith("new mode")||z.startsWith("similarity index")||z.startsWith("rename ")||z.startsWith("copy ")||z.startsWith("Binary files")||z.startsWith("---")||z.startsWith("+++")?he="hdr":z.startsWith("@@")?he="hunk":z.startsWith("+")?he="add":z.startsWith("-")&&(he="del"),e.jsx("div",{className:`scm-diff-line ${he}`,children:z||" "},xe)})})};return e.jsxs("div",{className:"scm-view",children:[e.jsxs("div",{className:"scm-header",children:[e.jsxs("div",{className:"scm-title-row",children:[e.jsxs("span",{className:"scm-title",children:[e.jsx(st,{}),a("scmTitle")]}),e.jsxs("div",{className:"scm-view-tabs",role:"tablist",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":b==="changes",className:b==="changes"?"active":"",onClick:()=>{L("changes"),_(null)},children:a("scmChanges")}),e.jsx("button",{type:"button",role:"tab","aria-selected":b==="history",className:b==="history"?"active":"",onClick:()=>{L("history"),_(null)},children:a("scmHistory")})]}),e.jsx("button",{type:"button",className:"panel-refresh",title:a("scmRefreshTip"),disabled:H,onClick:()=>se(!0),children:e.jsx(dt,{className:H?"scm-spin":""})})]}),e.jsxs("div",{className:"scm-row",children:[e.jsxs("span",{className:"scm-branch-current",title:a("scmCurrentBranch"),children:[e.jsx(st,{}),n?n.detached?a("scmDetached"):n.branch:"…",(n==null?void 0:n.upstream)&&e.jsx("span",{className:"scm-upstream",children:n.upstreamGone?a("scmUpstreamGone"):n.ahead>0||n.behind>0?a("scmAheadBehind",{ahead:n.ahead,behind:n.behind}):n.upstream})]}),e.jsxs("select",{className:"scm-select",value:h,disabled:q||u.length===0,title:a("scmSwitchBranch"),onChange:f=>g(f.target.value),children:[e.jsx("option",{value:"",disabled:!0,children:a("scmSelectBranch")}),u.filter(f=>!f.remote).map(f=>e.jsx("option",{value:f.name,children:f.current?`* ${f.name}`:f.name},f.name)),u.some(f=>f.remote)&&e.jsx("optgroup",{label:a("scmRemoteBranches"),children:u.filter(f=>f.remote).map(f=>e.jsx("option",{value:f.name,children:f.name},f.name))})]}),e.jsxs("button",{type:"button",className:"btn",disabled:!h||h===(n==null?void 0:n.branch)||q,title:a("scmSwitchBranchTip",{branch:h}),onClick:ze,children:[e.jsx(st,{}),a("scmSwitch")]}),e.jsxs("button",{type:"button",className:"btn",disabled:!n||n.detached||q,title:a("scmPushTip"),onClick:Fe,children:[e.jsx(As,{}),a("scmPush")]}),e.jsxs("button",{type:"button",className:"btn",disabled:!n||n.detached||q,title:a("scmPullTip"),onClick:_e,children:[e.jsx(_s,{}),a("scmPull")]}),e.jsx("input",{className:"scm-commit-input",value:Z,placeholder:a("scmCommitPlaceholder"),disabled:q,onChange:f=>te(f.target.value),onKeyDown:f=>{f.key==="Enter"&&!f.nativeEvent.isComposing&&fe()}}),e.jsxs("button",{type:"button",className:"btn primary",disabled:!Z.trim()||q,title:a("scmCommitTip"),onClick:fe,children:[e.jsx(mt,{}),a("scmCommit")]})]})]}),e.jsxs("div",{className:"scm-body",children:[b==="history"?e.jsxs("div",{className:"scm-history",children:[e.jsxs("div",{className:"scm-files-header",children:[e.jsx("span",{children:a("scmHistory")}),S.length>0&&e.jsx("span",{className:"scm-files-count",children:S.length})]}),e.jsx("div",{className:"scm-history-list",children:q?e.jsx("div",{className:"scm-empty",children:a("scmNotGitRepo")}):!n||C?e.jsx("div",{className:"scm-empty",children:t.status==="open"?a("scmLoading"):a("scmConnecting")}):S.length===0?e.jsx("div",{className:"scm-empty",children:a("scmNoHistory")}):S.map(f=>e.jsxs("button",{type:"button",className:`scm-commit ${(k==null?void 0:k.hash)===f.hash?"active":""}`,onClick:()=>Y(f),title:f.hash,children:[e.jsx("span",{className:"scm-commit-graph","aria-hidden":"true",children:f.graph||"* "}),e.jsxs("span",{className:"scm-commit-info",children:[e.jsx("span",{className:"scm-commit-subject",children:f.subject}),e.jsxs("span",{className:"scm-commit-meta",children:[f.shortHash," · ",f.author," · ",f.date]}),f.decorations&&e.jsx("span",{className:"scm-commit-refs",children:f.decorations})]})]},f.hash))})]}):e.jsxs("div",{className:"scm-files",children:[e.jsxs("div",{className:"scm-files-header",children:[e.jsx("span",{children:a("scmChanges")}),n&&n.files.length>0&&e.jsx("span",{className:"scm-files-count",children:n.files.length})]}),e.jsx("div",{className:"scm-files-list",children:q?e.jsx("div",{className:"scm-empty",children:a("scmNotGitRepo")}):n?n.files.length===0?e.jsx("div",{className:"scm-empty",children:a("scmNoChanges")}):n.files.map(f=>{const G=Fa(f),z=x.get(f.path);return e.jsxs("div",{className:`scm-file ${(m==null?void 0:m.path)===f.path?"active":""}`,title:T[G],onClick:()=>ge(f),children:[e.jsx("span",{className:`scm-file-xy ${G==="untracked"?"q":"x"}`,children:f.x!==" "?f.x:" "}),e.jsx("span",{className:`scm-file-xy ${G==="untracked"?"q":"y"}`,children:f.y!==" "?f.y:" "}),e.jsx("span",{className:"scm-file-path",children:f.path}),z&&(z.add>0||z.del>0)&&e.jsxs("span",{className:"scm-file-stat",children:[z.add>0&&e.jsxs("span",{className:"add",children:["+",z.add]}),z.del>0&&e.jsxs("span",{className:"del",children:["-",z.del]})]}),e.jsxs("span",{className:"scm-file-actions",children:[(f.y!==" "||G==="untracked")&&e.jsx("button",{type:"button",className:"scm-act",title:a("scmStageTip",{path:f.path}),onClick:xe=>{xe.stopPropagation(),Se(f)},children:"+"}),G==="staged"||G==="both"?e.jsx("button",{type:"button",className:"scm-act",title:a("scmUnstageTip",{path:f.path}),onClick:xe=>{xe.stopPropagation(),Pe(f)},children:"−"}):null]})]},f.path)}):e.jsx("div",{className:"scm-empty",children:t.status==="open"?a("scmLoading"):a("scmConnecting")})})]}),e.jsxs("div",{className:"scm-diff",children:[e.jsxs("div",{className:"scm-diff-header",children:[e.jsx("span",{children:b==="history"?k?`${k.shortHash} ${k.subject}`:a("scmCommitDetail"):m?m.path:a("scmDiff")}),(b==="history"?E:X)&&e.jsx("span",{className:"scm-diff-loading",children:a("scmLoading")})]}),e.jsx("div",{className:"scm-diff-body",children:b==="history"?e.jsxs(e.Fragment,{children:[U&&e.jsx("div",{className:"scm-error",children:U}),!k&&!U&&e.jsx("div",{className:"scm-empty",children:a("scmSelectCommitHint")}),k&&E&&!U&&e.jsx("div",{className:"scm-empty",children:a("scmLoading")}),k&&!E&&!U&&P?$(P):null]}):e.jsxs(e.Fragment,{children:[U&&e.jsx("div",{className:"scm-error",children:U}),!m&&!U&&e.jsx("div",{className:"scm-empty",children:a("scmSelectFileHint")}),m&&!W&&!U&&e.jsx("div",{className:"scm-empty",children:a("scmLoading")}),m&&W&&W.untracked&&e.jsx("div",{className:"scm-empty",children:a("scmUntrackedNote")}),m&&W&&!W.untracked&&e.jsxs(e.Fragment,{children:[W.staged&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"scm-diff-section",children:a("scmStaged")}),$(W.staged)]}),W.worktree&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"scm-diff-section",children:a("scmUnstaged")}),$(W.worktree)]}),!W.staged&&!W.worktree&&e.jsx("div",{className:"scm-empty",children:a("scmNoDiff")})]})]})})]})]}),e.jsxs("div",{className:"scm-hint",children:[e.jsx(qe,{}),e.jsx("span",{children:a("scmRunsInTerminal")}),e.jsx("button",{type:"button",className:"scm-goto-term",onClick:c,children:a("scmViewTerminal")})]})]})}function Aa({entry:t,send:s}){const i=r.useRef(null);return r.useEffect(()=>{const l=i.current;if(!l)return;let c;try{c=t.module.mount(l,xi(t.info.id,a=>s(a)))}catch(a){console.error(`[plugin:${t.info.id}] mount failed:`,a),l.textContent=`插件 ${t.info.name} 挂载失败`}return()=>{if(typeof c=="function")try{c()}catch(a){console.error(`[plugin:${t.info.id}] cleanup failed:`,a)}l.textContent=""}},[t,s]),e.jsx("div",{className:"plugin-view",ref:i})}function _a({send:t,piConfigured:s,piAgentInstalled:i,providers:l,installResult:c,onClose:a}){const n=me(),[o,u]=r.useState(!1),[p,h]=r.useState(""),[g,x]=r.useState(""),[v,b]=r.useState(!1);r.useEffect(()=>{t({type:"list_providers"})},[t]),r.useEffect(()=>{s&&a()},[s,a]),r.useEffect(()=>{c&&u(!1)},[c]),r.useEffect(()=>{var P;!p&&l.length>0&&h(((P=l.find(I=>!I.configured))==null?void 0:P.id)??l[0].id)},[l,p]);const L=()=>{o||(u(!0),t({type:"install_pi_agent"}))},S=()=>{!g.trim()||v||(b(!0),t({type:"set_provider_api_key",provider:p.trim(),apiKey:g.trim()}),setTimeout(()=>b(!1),3e3))},F=()=>{t({type:"get_state"}),t({type:"list_providers"})},k=l.find(P=>P.id===p),y=c!==null&&!c.ok;return e.jsx("div",{className:"modal-backdrop",children:e.jsxs("div",{className:"modal setup-modal",children:[e.jsx("button",{type:"button",className:"modal-close","aria-label":n("close"),onClick:a,children:e.jsx(je,{})}),e.jsxs("div",{className:"modal-head",children:[e.jsx(Ye,{className:"modal-head-icon"}),e.jsx("h2",{children:n("setupTitle")})]}),e.jsx("p",{className:"modal-desc",children:n("setupDesc")}),y?e.jsxs("div",{className:"setup-failed",children:[e.jsx("div",{className:"setup-done",children:n("installFailed")}),e.jsx("pre",{className:"setup-detail",children:c.detail}),e.jsxs("div",{className:"setup-actions",children:[e.jsx("button",{type:"button",className:"btn primary",disabled:o,onClick:L,children:n("retryInstall")}),e.jsx("button",{type:"button",className:"btn",onClick:a,children:n("skip")})]})]}):i||c!=null&&c.ok?e.jsxs("div",{className:"setup-key-form",children:[e.jsx("div",{className:"setup-done",children:c!=null&&c.ok?n("installDone"):n("cliReadyHint")}),e.jsxs("label",{className:"field",children:[e.jsx("span",{className:"field-label",children:n("provider")}),e.jsxs("select",{value:p,onChange:P=>h(P.target.value),children:[l.length===0&&e.jsx("option",{value:"",children:n("loading")}),l.map(P=>e.jsxs("option",{value:P.id,children:[P.name,"(",P.id,")",P.configured?` · ${n("configured")}`:""]},P.id))]}),(k==null?void 0:k.configured)&&e.jsx("div",{className:"field-hint",children:n("providerKeyReady")})]}),e.jsxs("label",{className:"field",children:[e.jsx("span",{className:"field-label",children:n("apiKey")}),e.jsx("input",{type:"password",value:g,onChange:P=>x(P.target.value),placeholder:"sk-…"})]}),e.jsxs("div",{className:"setup-actions",children:[e.jsx("button",{type:"button",className:"btn primary",disabled:!g.trim()||v||!p,onClick:S,children:n(v?"saving":"saveAndStart")}),e.jsxs("button",{type:"button",className:"btn",onClick:F,children:[e.jsx(dt,{})," ",n("recheck")]})]})]}):e.jsxs("div",{className:"setup-actions",children:[e.jsx("button",{type:"button",className:"btn primary",disabled:o,onClick:L,children:n(o?"installing":"autoInstall")}),e.jsx("button",{type:"button",className:"btn",onClick:a,children:n("skip")})]})]})})}const Oa=["openai-completions","openai-responses","anthropic-messages","google-generative-ai"],Ft=()=>({id:"",name:"",reasoning:!1,input:"text",contextWindow:"",maxTokens:""}),Wa=()=>({providerId:"",name:"",api:"openai-completions",baseUrl:"",apiKey:"",authHeader:!0,models:[Ft()]});function ws(t){return{providerId:t.providerId,name:t.name??"",api:t.api??"openai-completions",baseUrl:t.baseUrl??"",apiKey:t.apiKey??"",authHeader:t.authHeader??!1,models:(t.models.length?t.models:[Ft()]).map(s=>{var i;return{id:s.id,name:s.name??"",reasoning:s.reasoning??!1,input:(i=s.input)!=null&&i.includes("image")?"text-image":"text",contextWindow:s.contextWindow?String(s.contextWindow):"",maxTokens:s.maxTokens?String(s.maxTokens):""}})}}function Ha({send:t,providers:s,providerStatus:i,fetchModelsResult:l,refreshProviderResult:c,cloneProviderResult:a,onClose:n}){const o=me(),[u,p]=r.useState(null),[h,g]=r.useState({}),[x,v]=r.useState(null),[b,L]=r.useState({}),[S,F]=r.useState(!1),[k,y]=r.useState(0),[P,I]=r.useState(null),E=r.useRef(0),[j,m]=r.useState({});r.useRef(0);const D=r.useRef(0),[W,ee]=r.useState(null),X=r.useRef(0),O=r.useRef(0);r.useEffect(()=>{t({type:"list_models_config"}),t({type:"list_providers"})},[t]);const H=()=>{if(!u)return;const w=u.baseUrl.trim();if(!w){I({ok:!1,text:o("fetchModelsNeedBaseUrl")});return}if(S)return;F(!0),I(null);const Z=k+1;y(Z),t({type:"fetch_models",reqId:Z,baseUrl:w,apiKey:u.apiKey.trim()||void 0,authHeader:u.authHeader,api:u.api})};r.useEffect(()=>{var w;if(!(!l||l.reqId===E.current))if(E.current=l.reqId,F(!1),l.ok&&((w=l.models)!=null&&w.length)){const Z=l.models;p(te=>{if(!te)return te;const ue=te.models.map(J=>{var d;if(!J.id.trim())return J;const de=Z.find(M=>M.id===J.id.trim());if(!de)return J;const ie={...J};return!ie.name&&de.name&&(ie.name=de.name),!ie.contextWindow&&de.contextWindow&&(ie.contextWindow=String(de.contextWindow)),!ie.maxTokens&&de.maxTokens&&(ie.maxTokens=String(de.maxTokens)),ie.input==="text"&&((d=de.input)!=null&&d.includes("image"))&&(ie.input="text-image"),!ie.reasoning&&de.reasoning&&(ie.reasoning=!0),ie}),A=new Set(ue.map(J=>J.id.trim()).filter(Boolean)),Q=Z.filter(J=>!A.has(J.id)).map(J=>{var de;return{id:J.id,name:J.name??"",reasoning:J.reasoning??!1,input:(de=J.input)!=null&&de.includes("image")?"text-image":"text",contextWindow:J.contextWindow?String(J.contextWindow):"",maxTokens:J.maxTokens?String(J.maxTokens):""}}),oe=[...ue,...Q];return oe.some(J=>J.id.trim())?{...te,models:oe.filter(J=>J.id.trim())}:te}),I({ok:!0,text:o("fetchModelsOk",{n:Z.length})})}else I({ok:!1,text:l.error||o("fetchModelsEmpty")})},[l]);const R=w=>{const Z=(h[w.id]??"").trim();!Z||x||(v(w.id),t({type:"set_provider_api_key",provider:w.id,apiKey:Z}),setTimeout(()=>{v(null),g(te=>({...te,[w.id]:""})),L(te=>({...te,[w.id]:!1})),t({type:"list_providers"})},1500))},C=()=>{if(!u)return;const w=u.providerId.trim(),Z=u.models.filter(ue=>ue.id.trim()).map(ue=>({id:ue.id.trim(),name:ue.name.trim()||void 0,reasoning:ue.reasoning||void 0,input:ue.input==="text-image"?["text","image"]:void 0,contextWindow:ue.contextWindow?Number(ue.contextWindow):void 0,maxTokens:ue.maxTokens?Number(ue.maxTokens):void 0})),te={providerId:w,name:u.name.trim()||void 0,api:u.api.trim()||void 0,baseUrl:u.baseUrl.trim()||void 0,apiKey:u.apiKey.trim()||void 0,authHeader:u.authHeader||void 0,models:Z};t({type:"save_model_config",providerId:w,config:te}),n()};r.useEffect(()=>{!c||c.reqId===D.current||(D.current=c.reqId,m({}))},[c]);const N=w=>{if(W)return;ee(w.id);const Z=++X.current+Date.now();t({type:"clone_provider",provider:w.id,reqId:Z})};r.useEffect(()=>{!a||a.reqId===O.current||(O.current=a.reqId,ee(null),a.ok&&a.config&&p(ws({...a.config,apiKey:""})))},[a]);const U=w=>{window.confirm(o("clearKeyConfirm",{id:w}))&&t({type:"clear_provider_api_key",provider:w})},_=w=>{window.confirm(o("deleteProviderConfirm",{id:w.providerId,n:w.models.length}))&&t({type:"delete_model_config",providerId:w.providerId})},q=(w,Z)=>{u&&p({...u,models:u.models.map((te,ue)=>ue===w?{...te,...Z}:te)})};return e.jsx("div",{className:"modal-backdrop",onClick:n,children:e.jsxs("div",{className:"modal model-modal",onClick:w=>w.stopPropagation(),children:[e.jsx("button",{type:"button",className:"modal-close","aria-label":o("close"),onClick:n,children:e.jsx(je,{})}),e.jsx("div",{className:"modal-head",children:e.jsx("h2",{children:o(u?"editProvider":"manageModelsTitle")})}),u?e.jsxs("div",{className:"provider-form",children:[e.jsxs("div",{className:"form-grid",children:[e.jsxs("label",{className:"field",children:[e.jsxs("span",{className:"field-label",children:[o("providerId")," ",e.jsx("em",{children:o("providerIdHint")})]}),e.jsx("input",{type:"text",value:u.providerId,disabled:s.some(w=>w.providerId===u.providerId),onChange:w=>p({...u,providerId:w.target.value}),placeholder:"my-proxy"})]}),e.jsxs("label",{className:"field",children:[e.jsx("span",{className:"field-label",children:o("displayName")}),e.jsx("input",{type:"text",value:u.name,onChange:w=>p({...u,name:w.target.value}),placeholder:o("displayNamePh")})]}),e.jsxs("label",{className:"field",children:[e.jsx("span",{className:"field-label",children:o("apiType")}),e.jsx("select",{value:u.api,onChange:w=>p({...u,api:w.target.value}),children:Oa.map(w=>e.jsx("option",{value:w,children:w},w))})]}),e.jsxs("label",{className:"field",children:[e.jsxs("span",{className:"field-label",children:["baseUrl ",e.jsx("em",{children:o("baseUrlHint")})]}),e.jsx("input",{type:"text",value:u.baseUrl,onChange:w=>p({...u,baseUrl:w.target.value}),placeholder:"http://localhost:11434/v1"})]}),e.jsxs("label",{className:"field",children:[e.jsx("span",{className:"field-label",children:o("apiKey")}),e.jsx("input",{type:"password",value:u.apiKey,onChange:w=>p({...u,apiKey:w.target.value}),placeholder:o("apiKeyHint")})]}),e.jsxs("label",{className:"field check",children:[e.jsx("input",{type:"checkbox",checked:u.authHeader,onChange:w=>p({...u,authHeader:w.target.checked})}),e.jsx("span",{children:o("authHeader")})]})]}),e.jsxs("div",{className:"model-section-head",children:[e.jsx("span",{className:"form-section-title",children:o("modelsTitle")}),e.jsxs("span",{className:"model-section-actions",children:[P&&e.jsx("span",{className:`fetch-msg ${P.ok?"ok":"err"}`,title:P.text,children:P.text}),e.jsxs("button",{type:"button",className:"btn sm",disabled:S||!u.baseUrl.trim(),title:o("fetchModelsHint"),onClick:H,children:[e.jsx(Pt,{})," ",o(S?"fetchingModels":"fetchModels")]})]})]}),u.models.map((w,Z)=>e.jsxs("div",{className:"model-row",children:[e.jsx("input",{type:"text",value:w.id,onChange:te=>q(Z,{id:te.target.value}),placeholder:o("modelIdReq")}),e.jsx("input",{type:"text",value:w.name,onChange:te=>q(Z,{name:te.target.value}),placeholder:o("displayName")}),e.jsxs("select",{value:w.input,onChange:te=>q(Z,{input:te.target.value}),children:[e.jsx("option",{value:"text",children:o("text")}),e.jsx("option",{value:"text-image",children:o("textImage")})]}),e.jsxs("label",{className:"check",children:[e.jsx("input",{type:"checkbox",checked:w.reasoning,onChange:te=>q(Z,{reasoning:te.target.checked})}),e.jsx("span",{children:o("reasoning")})]}),e.jsx("input",{type:"number",value:w.contextWindow,onChange:te=>q(Z,{contextWindow:te.target.value}),placeholder:o("contextWindow"),title:"contextWindow"}),e.jsx("input",{type:"number",value:w.maxTokens,onChange:te=>q(Z,{maxTokens:te.target.value}),placeholder:o("maxOutput"),title:"maxTokens"}),e.jsx("button",{type:"button",className:"iconbtn danger",title:o("removeModel"),onClick:()=>p({...u,models:u.models.filter((te,ue)=>ue!==Z)}),children:e.jsx(Me,{})})]},Z)),e.jsxs("button",{type:"button",className:"btn",onClick:()=>p({...u,models:[...u.models,Ft()]}),children:[e.jsx(De,{})," ",o("addModel")]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:()=>p(null),children:o("cancel")}),e.jsx("button",{type:"button",className:"btn primary",disabled:!u.providerId.trim()||!u.models.some(w=>w.id.trim()),onClick:C,children:o("save")})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"form-section-title",children:[o("builtinProviders")," ",e.jsx("em",{className:"section-hint",children:o("hintKeyOnly")})]}),e.jsxs("div",{className:"provider-list",children:[i.length===0&&e.jsx("div",{className:"dd-loading",children:o("loading")}),i.map(w=>e.jsxs("div",{className:"provider-row",children:[e.jsxs("div",{className:"provider-info",children:[e.jsx("span",{className:"provider-name",children:w.name}),e.jsxs("span",{className:"provider-sub",children:[w.id,w.configured&&e.jsx("span",{className:"auth-badge",children:o("configuredBadge")}),w.source&&!w.configured&&e.jsx("span",{className:"auth-badge dim",children:w.source})]})]}),e.jsxs("div",{className:"provider-actions",children:[w.configured&&!b[w.id]?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"auth-badge",children:o("keyReady")}),e.jsxs("button",{type:"button",className:"btn sm",title:o("replaceKeyTitle"),onClick:()=>L(Z=>({...Z,[w.id]:!0})),children:[e.jsx(Ct,{})," ",o("replaceKey")]}),w.source==="stored"&&e.jsxs("button",{type:"button",className:"btn sm danger",title:o("clearKeyTitle"),onClick:()=>U(w.id),children:[e.jsx(Me,{})," ",o("clearKey")]})]}):e.jsxs(e.Fragment,{children:[e.jsx("input",{type:"password",className:"key-input",placeholder:o("pasteKey"),value:h[w.id]??"",onChange:Z=>g(te=>({...te,[w.id]:Z.target.value}))}),e.jsxs("button",{type:"button",className:"btn primary sm",disabled:!(h[w.id]??"").trim()||x===w.id,onClick:()=>R(w),children:[e.jsx(Kn,{})," ",x===w.id?o("savingKey"):o("saveKey")]})]}),e.jsxs("button",{type:"button",className:"btn sm",disabled:W!==null,title:o("cloneProviderTitle"),onClick:()=>N(w),children:[e.jsx(It,{})," ",W===w.id?o("cloning"):o("cloneProvider")]})]})]},w.id))]}),e.jsx("div",{className:"form-section-title",children:o("customProviders")}),e.jsx("p",{className:"modal-desc",children:o("customDesc")}),s.length===0&&e.jsx("div",{className:"dd-loading",children:o("noCustomProviders")}),e.jsx("div",{className:"provider-list",children:s.map(w=>e.jsxs("div",{className:"provider-row",children:[e.jsxs("div",{className:"provider-info",children:[e.jsx("span",{className:"provider-name",children:w.providerId}),e.jsxs("span",{className:"provider-sub",children:[w.api??"—",w.baseUrl?` · ${w.baseUrl}`:"",w.models.length>0&&` · ${o("modelsCount",{n:w.models.length})}`]})]}),e.jsxs("div",{className:"provider-actions",children:[e.jsx("button",{type:"button",className:"iconbtn",title:o("edit"),onClick:()=>p(ws(w)),children:e.jsx(Ct,{})}),e.jsx("button",{type:"button",className:"iconbtn danger",title:o("delete"),onClick:()=>_(w),children:e.jsx(Me,{})})]})]},w.providerId))}),e.jsx("div",{className:"modal-actions",children:e.jsxs("button",{type:"button",className:"btn primary",onClick:()=>p(Wa()),children:[e.jsx(De,{})," ",o("addProvider")]})})]})]})})}function qa({plugin:t,send:s}){const i=me(),l=t.settingsSchema??[],[c,a]=r.useState(()=>({...t.settingsValues??{}})),[n,o]=r.useState(!1);if(l.length===0)return null;const u=(x,v)=>a(b=>({...b,[x]:v})),p=l.some(x=>{var v;return c[x.key]!==((v=t.settingsValues)==null?void 0:v[x.key])}),h=()=>{o(!0),s({type:"plugin_settings",pluginId:t.id,values:c}),setTimeout(()=>o(!1),800)},g=()=>a({...t.settingsValues??{}});return e.jsxs("div",{className:"plugin-settings-form",children:[e.jsx("div",{className:"plugin-settings-fields",children:l.map(x=>e.jsxs("label",{className:"plugin-settings-field",title:x.hint,children:[e.jsx("span",{className:"plugin-settings-label",children:x.label}),x.type==="boolean"?e.jsx("input",{type:"checkbox",checked:!!c[x.key],onChange:v=>u(x.key,v.target.checked)}):x.type==="select"?e.jsx("select",{value:String(c[x.key]??""),onChange:v=>u(x.key,v.target.value),children:(x.options??[]).map(v=>e.jsx("option",{value:v,children:v},v))}):e.jsx("input",{type:x.type==="password"?"password":x.type==="number"?"number":"text",value:String(c[x.key]??""),min:x.min,max:x.max,onChange:v=>u(x.key,x.type==="number"?Number(v.target.value):v.target.value)})]},x.key))}),e.jsxs("div",{className:"plugin-settings-actions",children:[e.jsx("button",{type:"button",className:"btn plugin-settings-save",disabled:!p||n,onClick:h,children:i(n?"pluginSettingsSaving":"pluginSettingsSave")}),e.jsx("button",{type:"button",className:"btn plugin-settings-reset",onClick:g,children:i("pluginSettingsReset")})]})]})}function nt({text:t}){const s=r.useRef(null),[i,l]=r.useState(!1),c=()=>{var n;const a=(n=s.current)==null?void 0:n.getBoundingClientRect();a&&l(window.innerWidth-a.right<340)};return e.jsxs("span",{ref:s,className:`set-tip${i?" flip":""}`,tabIndex:0,"aria-label":t,onMouseEnter:c,onFocus:c,children:["?",e.jsx("span",{className:"set-tip-bubble",role:"tooltip",children:t})]})}function Ee({title:t,subtitle:s,tip:i,enabled:l,onToggle:c,action:a}){const n=me();return e.jsxs("div",{className:"set-row",children:[e.jsxs("div",{className:"set-row-info",children:[e.jsxs("div",{className:"set-row-name",children:[t,i&&e.jsx(nt,{text:i})]}),s&&e.jsx("div",{className:"set-row-desc",children:s})]}),a,e.jsx("button",{type:"button",className:`set-switch ${l?"on":""}`,role:"switch","aria-checked":l,title:n(l?"settingsEnabled":"settingsDisabled"),onClick:c,children:e.jsx("span",{className:"set-switch-knob"})})]})}function Ka({chat:t,send:s,terminal:i,onSwitchToTerminal:l,onClose:c}){const a=me(),n=t.settings,[o,u]=r.useState("prompt"),p=r.useRef(null);r.useEffect(()=>{var d;(d=p.current)==null||d.scrollTo({top:0})},[o]);const[h,g]=r.useState(""),[x,v]=r.useState("append"),b=r.useRef(!1),[L,S]=r.useState(""),[F,k]=r.useState("append"),y=r.useRef(!1),[P,I]=r.useState(""),E=r.useRef(!1),[j,m]=r.useState(""),[D,W]=r.useState(!1),[ee,X]=r.useState(null),[O,H]=r.useState(null);r.useEffect(()=>{n&&(v(n.promptMode),!b.current&&(g(x==="append"||n.customSystemPrompt?n.customSystemPrompt:n.defaultSystemPrompt||""),k(n.visionBridgePromptMode),!y.current&&(S(F==="append"||n.visionBridgePrompt?n.visionBridgePrompt:n.visionBridgeDefaultPrompt||""),E.current||I(n.reviewPrompt))))},[n,x,F]);const[R,C]=r.useState(String((n==null?void 0:n.terminalBashIdleMs)??15e3));if(r.useEffect(()=>{C(String((n==null?void 0:n.terminalBashIdleMs)??15e3))},[n==null?void 0:n.terminalBashIdleMs]),!n)return null;const N=[{id:"prompt",icon:e.jsx($s,{}),label:a("settingsSystemPrompt")},{id:"terminal",icon:e.jsx(qe,{}),label:a("settingsTerminalTools")},{id:"display",icon:e.jsx(Ke,{}),label:a("settingsMessageDisplay")},{id:"skills",icon:e.jsx(Ye,{}),label:a("settingsSkills"),count:n.skills.length},{id:"extensions",icon:e.jsx(Zt,{}),label:a("settingsExtensions"),count:n.extensions.length},{id:"plugins",icon:e.jsx(ts,{}),label:a("settingsUiPlugins"),count:t.plugins.length},{id:"review",icon:e.jsx(tt,{}),label:a("settingsReview"),count:n.reviewSkills.length},{id:"vision",icon:e.jsx(wt,{}),label:a("settingsVisionBridge")},{id:"presets",icon:e.jsx(Bn,{}),label:a("settingsPresets"),count:n.presets.length}],U=new Set(n.disabledSkills),_=new Set(n.disabledExtensions),q=d=>s({type:"set_settings",...d}),w=d=>{const M=new Set(U);M.has(d.name)?M.delete(d.name):M.add(d.name),q({disabledSkills:[...M]})},Z=new Set(n.disabledPlugins??[]),te=d=>{const M=new Set(Z);M.has(d.id)?M.delete(d.id):M.add(d.id),q({disabledPlugins:[...M]})},ue=d=>{const M=new Set(_);M.has(d.id)?M.delete(d.id):M.add(d.id),q({disabledExtensions:[...M]})},A=(d,M)=>{var ge,Y;const le={name:d,command:M,cwd:"${pwd}"},se=t.terminals.find(ce=>ce.title===d);se?(i.restart(se.id),s({type:"run_command",terminalId:se.id,conversationId:se.conversationId,command:le,cols:80,rows:24})):i.create({id:Be(),conversationId:t.activeConversationId||((ge=t.state)==null?void 0:ge.conversationId)||"",title:d,cwd:((Y=t.state)==null?void 0:Y.cwd)??"",cols:80,rows:24,running:!0,exitCode:null,command:le}),l(),c()},Q=d=>{X(null),A(`${a("uninstallTitle")} ${d}`,`pi remove npm:${d}`)},oe=d=>{H(null),A(`${a("uninstallTitle")} ${d}`,`pi-web-ui uninstall ${d}`)},J=(d,M)=>{A(`${a("pluginUpdate")} ${d}`,`pi-web-ui install ${M} --name ${d} --force`)},de=d=>{const M=new Set(n.reviewSkills.filter(le=>!le.enabled).map(le=>le.name));M.has(d.name)?M.delete(d.name):M.add(d.name),q({reviewDisabledSkills:[...M]})},ie=()=>{const d=x==="replace"&&n.defaultSystemPrompt&&h===n.defaultSystemPrompt?"":h;q({promptMode:x,customSystemPrompt:d})};return e.jsx("div",{className:"modal-backdrop",onClick:c,children:e.jsxs("div",{className:"modal settings-modal",onClick:d=>d.stopPropagation(),children:[e.jsx("button",{type:"button",className:"modal-close","aria-label":a("close"),onClick:c,children:e.jsx(je,{})}),e.jsxs("div",{className:"modal-head",children:[e.jsx(lt,{className:"modal-head-icon"}),e.jsx("h2",{children:a("settingsTitle")}),e.jsx(nt,{text:a("settingsDesc")})]}),e.jsxs("div",{className:"settings-layout",children:[e.jsx("nav",{className:"settings-rail","aria-label":a("settingsTitle"),children:N.map(d=>e.jsxs("button",{type:"button",className:`settings-tab${o===d.id?" active":""}`,"aria-current":o===d.id?"true":void 0,title:d.label,onClick:()=>u(d.id),children:[e.jsx("span",{className:"settings-tab-icon",children:d.icon}),e.jsx("span",{className:"settings-tab-label",children:d.label}),d.count!==void 0&&e.jsx("span",{className:"set-count",children:d.count})]},d.id))}),e.jsxs("div",{className:"modal-body",ref:p,children:[o==="prompt"&&e.jsxs("div",{className:"set-section",children:[e.jsxs("div",{className:"set-section-title",children:[e.jsx(tt,{className:"set-section-icon"}),a("settingsSystemPrompt")]}),e.jsxs("div",{className:"set-mode-row",children:[e.jsx("label",{className:"set-field-label",children:a("settingsPromptMode")}),e.jsxs("select",{className:"set-select",value:x,onChange:d=>{const M=d.target.value;v(M),q({promptMode:M})},children:[e.jsx("option",{value:"append",children:a("promptModeAppend")}),e.jsx("option",{value:"replace",children:a("promptModeReplace")})]}),e.jsx(nt,{text:a(x==="append"?"promptAppendHint":"promptReplaceHint")})]}),e.jsx("textarea",{className:"set-prompt-input",rows:6,placeholder:a("promptPlaceholder"),value:h,onFocus:()=>b.current=!0,onBlur:()=>{b.current=!1,ie()},onChange:d=>g(d.target.value)}),e.jsxs("button",{type:"button",className:"set-view-prompt-btn","aria-expanded":D,onClick:()=>W(d=>!d),children:[a("settingsViewPrompt")," ",D?"▴":"▾"]}),D&&e.jsxs("div",{className:"set-prompt-view",children:[e.jsxs("div",{className:"set-prompt-view-head",children:[e.jsx("span",{children:a("settingsViewPromptHint")}),e.jsx(Ks,{text:n.effectiveSystemPrompt})]}),n.effectiveSystemPrompt?e.jsx("pre",{className:"set-prompt-view-text",children:n.effectiveSystemPrompt}):e.jsx("p",{className:"set-empty",children:a("settingsViewPromptEmpty")})]})]}),o==="terminal"&&e.jsxs("div",{className:"set-section",children:[e.jsxs("div",{className:"set-section-title",children:[e.jsx(qe,{className:"set-section-icon"}),a("settingsTerminalTools")]}),e.jsx(Ee,{title:a("terminalToolsEnabled"),tip:a("settingsTerminalToolsDesc"),enabled:n.terminalToolsEnabled,onToggle:()=>q({terminalToolsEnabled:!n.terminalToolsEnabled})}),!n.terminalToolsEnabled&&e.jsx("p",{className:"set-hint",children:a("terminalToolsOffHint")}),e.jsx(Ee,{title:a("terminalBashTakeover"),tip:a("terminalBashTakeoverDesc"),enabled:n.terminalBash,onToggle:()=>q({terminalBash:!n.terminalBash})}),n.terminalBash&&e.jsxs("div",{className:"set-field",children:[e.jsx("label",{className:"set-field-label",htmlFor:"tb-idle-ms",children:a("terminalBashIdleMs")}),e.jsx("input",{id:"tb-idle-ms",className:"set-input",type:"number",min:0,step:1e3,value:R,onChange:d=>C(d.target.value),onBlur:()=>{const d=Math.max(0,Math.floor(Number(R)||0));C(String(d)),d!==n.terminalBashIdleMs&&q({terminalBashIdleMs:d})}})]})]}),o==="display"&&e.jsxs("div",{className:"set-section",children:[e.jsxs("div",{className:"set-section-title",children:[e.jsx(Ke,{className:"set-section-icon"}),a("settingsMessageDisplay")]}),e.jsx(Ee,{title:a("thinkingWrap"),tip:a("thinkingWrapDesc"),enabled:n.thinkingWrap??!0,onToggle:()=>q({thinkingWrap:!(n.thinkingWrap??!0)})}),e.jsx(Ee,{title:a("toolsWrap"),tip:a("toolsWrapDesc"),enabled:n.toolsWrap??!0,onToggle:()=>q({toolsWrap:!(n.toolsWrap??!0)})})]}),o==="skills"&&e.jsxs("div",{className:"set-section",children:[e.jsxs("div",{className:"set-section-title",children:[e.jsx(Ye,{className:"set-section-icon"}),a("settingsSkills"),e.jsx("span",{className:"set-count",children:n.skills.length})]}),n.skills.length===0?e.jsx("p",{className:"set-empty",children:a("noSkills")}):e.jsx("div",{className:"set-list",children:n.skills.map(d=>e.jsx(Ee,{title:d.name,subtitle:d.description,enabled:d.enabled,onToggle:()=>w(d)},d.name))})]}),o==="extensions"&&e.jsxs("div",{className:"set-section",children:[e.jsxs("div",{className:"set-section-title",children:[e.jsx(Zt,{className:"set-section-icon"}),a("settingsExtensions"),e.jsx("span",{className:"set-count",children:n.extensions.length})]}),n.extensions.length===0?e.jsx("p",{className:"set-empty",children:a("noExtensions")}):e.jsx("div",{className:"set-list",children:n.extensions.map(d=>{const M=d.id.startsWith("npm:")?d.id.slice(4):null;return e.jsx(Ee,{title:d.name,subtitle:d.path,enabled:d.enabled,onToggle:()=>ue(d),action:M?ee===d.id?e.jsx("button",{type:"button",className:"set-uninstall confirm",title:a("uninstallConfirmHint"),onClick:()=>Q(M),children:a("uninstallConfirm")}):e.jsxs("button",{type:"button",className:"set-uninstall",title:a("uninstallHint"),onClick:()=>X(d.id),children:[e.jsx(Me,{}),a("uninstallExt")]}):void 0},d.id)})})]}),o==="plugins"&&e.jsxs("div",{className:"set-section",children:[e.jsxs("div",{className:"set-section-title",children:[e.jsx(ts,{className:"set-section-icon"}),a("settingsUiPlugins"),e.jsx("span",{className:"set-count",children:t.plugins.length})]}),t.plugins.length===0?e.jsx("p",{className:"set-empty",children:a("noUiPlugins")}):e.jsx("div",{className:"set-list",children:t.plugins.map(d=>{var M;return e.jsxs(e.Fragment,{children:[e.jsx(Ee,{title:`${d.icon?`${d.icon} `:""}${d.name}`,subtitle:(d.error?`${d.id} · ${d.error}`:d.source?`${d.id} · ${d.source}`:`${d.id} · ${a("uiPluginNoSource")}`)+((M=d.permissions)!=null&&M.length?` · ${a("uiPluginPerms")}: ${d.permissions.join(", ")}`:""),enabled:!Z.has(d.id)&&!d.error,onToggle:()=>!d.error&&te(d),action:e.jsxs("div",{className:"set-row-actions",children:[d.source&&e.jsxs("button",{type:"button",className:"set-uninstall",title:a("pluginUpdateHint"),onClick:()=>J(d.id,d.source),children:[e.jsx(dt,{}),a("pluginUpdate")]}),O===d.id?e.jsx("button",{type:"button",className:"set-uninstall confirm",title:a("pluginUninstallHint"),onClick:()=>oe(d.id),children:a("uninstallConfirm")}):e.jsxs("button",{type:"button",className:"set-uninstall",title:a("pluginUninstallHint"),onClick:()=>H(d.id),children:[e.jsx(Me,{}),a("uninstallExt")]})]})},d.id),d.settingsSchema&&d.settingsSchema.length>0&&e.jsx(qa,{plugin:d,send:s})]})})})]}),o==="review"&&e.jsxs("div",{className:"set-section",children:[e.jsxs("div",{className:"set-section-title",children:[e.jsx(tt,{className:"set-section-icon"}),a("settingsReview"),e.jsx(nt,{text:a("settingsReviewDesc")}),e.jsx("span",{className:"set-count",children:n.reviewSkills.length})]}),e.jsx("textarea",{className:"set-prompt-input",rows:5,placeholder:a("reviewPromptPlaceholder"),value:P,onFocus:()=>E.current=!0,onBlur:()=>{E.current=!1,q({reviewPrompt:P})},onChange:d=>I(d.target.value)}),e.jsx("div",{className:"set-field-label",children:a("settingsReviewSkills")}),n.reviewSkills.length===0?e.jsx("p",{className:"set-empty",children:a("noSkills")}):e.jsx("div",{className:"set-list",children:n.reviewSkills.map(d=>e.jsx(Ee,{title:d.name,subtitle:d.description,enabled:d.enabled,onToggle:()=>de(d)},`review-${d.name}`))})]}),o==="vision"&&e.jsxs("div",{className:"set-section",children:[e.jsxs("div",{className:"set-section-title",children:[e.jsx(wt,{className:"set-section-icon"}),a("settingsVisionBridge")]}),e.jsx(Ee,{title:a("visionBridgeEnabled"),tip:a("settingsVisionBridgeDesc"),enabled:n.visionBridgeEnabled,onToggle:()=>q({visionBridgeEnabled:!n.visionBridgeEnabled})}),!n.visionBridgeEnabled&&e.jsx("p",{className:"set-hint",children:a("visionBridgeOffHint")}),n.visionBridgeEnabled&&e.jsxs("div",{className:"set-mode-row",children:[e.jsx("label",{className:"set-field-label",children:a("visionBridgeModel")}),e.jsxs("select",{className:"set-select",value:n.visionBridgeModel??"",onChange:d=>q({visionBridgeModel:d.target.value||null}),children:[e.jsx("option",{value:"",children:a("visionBridgeAuto")}),n.visionModels.map(d=>e.jsx("option",{value:`${d.provider}/${d.id}`,children:d.label},`${d.provider}/${d.id}`))]})]}),n.visionBridgeEnabled&&e.jsxs("div",{className:"set-mode-row",children:[e.jsx("label",{className:"set-field-label",children:a("visionBridgePromptMode")}),e.jsxs("select",{className:"set-select",value:F,onChange:d=>{const M=d.target.value;k(M),q({visionBridgePromptMode:M})},children:[e.jsx("option",{value:"append",children:a("promptModeAppend")}),e.jsx("option",{value:"replace",children:a("promptModeReplace")})]})]}),n.visionBridgeEnabled&&e.jsx("textarea",{className:"set-prompt-input",rows:4,placeholder:a("visionBridgePromptPlaceholder"),value:L,onFocus:()=>y.current=!0,onBlur:()=>{y.current=!1;const d=F==="replace"&&n.visionBridgeDefaultPrompt&&L===n.visionBridgeDefaultPrompt?"":L;q({visionBridgePromptMode:F,visionBridgePrompt:d})},onChange:d=>S(d.target.value)}),n.visionBridgeEnabled&&(n.visionModels.length===0?e.jsx("p",{className:"set-hint",children:a("visionBridgeNoModels")}):e.jsx("p",{className:"set-hint",children:a("visionBridgeCurrent",{model:n.visionBridgeModel??a("visionBridgeAuto")})}))]}),o==="presets"&&e.jsxs("div",{className:"set-section",children:[e.jsxs("div",{className:"set-section-title",children:[e.jsx(lt,{className:"set-section-icon"}),a("settingsPresets"),e.jsx("span",{className:"set-count",children:n.presets.length})]}),e.jsxs("div",{className:"set-preset-save",children:[e.jsx("input",{className:"set-input",placeholder:a("presetNamePlaceholder"),value:j,onChange:d=>m(d.target.value),onKeyDown:d=>{d.key==="Enter"&&j.trim()&&(s({type:"save_preset",name:j.trim()}),m(""))}}),e.jsxs("button",{type:"button",className:"set-save-btn",disabled:!j.trim(),onClick:()=>{s({type:"save_preset",name:j.trim()}),m("")},children:[e.jsx(De,{})," ",a("saveAsPreset")]})]}),n.presets.length===0?e.jsx("p",{className:"set-empty",children:a("noPresets")}):e.jsx("div",{className:"set-list",children:n.presets.map(d=>e.jsxs("div",{className:"set-row",children:[e.jsxs("div",{className:"set-row-info",children:[e.jsx("div",{className:"set-row-name",children:d.name}),e.jsxs("div",{className:"set-row-desc",children:[d.promptMode==="replace"?a("promptModeReplace"):a("promptModeAppend"),d.disabledSkills.length>0&&` · ${a("settingsSkills")} ${d.disabledSkills.length}`,d.disabledExtensions.length>0&&` · ${a("settingsExtensions")} ${d.disabledExtensions.length}`]})]}),e.jsxs("div",{className:"set-row-actions",children:[e.jsx("button",{type:"button",className:"dd-refresh",onClick:()=>s({type:"apply_preset",name:d.name}),children:a("applyPreset")}),e.jsx("button",{type:"button",className:"set-icon-btn danger",title:a("deletePreset"),onClick:()=>s({type:"delete_preset",name:d.name}),children:e.jsx(Me,{})})]})]},d.name))})]})]})]}),e.jsx("div",{className:"modal-actions",children:e.jsx("button",{type:"button",className:"dd-refresh",onClick:c,children:a("close")})})]})})}function Ua(t,s){const i=Math.max(0,Date.now()-t),l=Math.floor(i/6e4);if(l<1)return s("bgTaskJustNow");if(l<60)return s("bgTaskMinutes",{n:l});const c=Math.floor(l/60);return c<24?s("bgTaskHours",{n:c}):s("bgTaskDays",{n:Math.floor(c/24)})}function za({servers:t,send:s,onClose:i}){const l=me(),[c,a]=r.useState(new Set),n=o=>a(u=>{const p=new Set(u);return p.has(o)?p.delete(o):p.add(o),p});return r.useEffect(()=>{s({type:"list_bg_servers"})},[]),e.jsx("div",{className:"modal-backdrop",onClick:i,children:e.jsxs("div",{className:"bg-task-modal",onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{className:"bg-task-head",children:[e.jsxs("span",{className:"bg-task-title",children:[e.jsx(ct,{})," ",l("bgTasks"),t.length>0&&e.jsx("em",{className:"bg-task-count",children:t.length})]}),e.jsx("button",{type:"button",className:"btn",title:l("close"),onClick:i,children:e.jsx(je,{})})]}),t.length===0?e.jsxs("div",{className:"bg-task-empty",children:[e.jsx(ct,{}),e.jsx("span",{children:l("bgTasksEmpty")}),e.jsx("small",{children:l("bgTasksDesc")})]}):e.jsx("ul",{className:"bg-task-list",children:t.map(o=>{const u=!!o.taskId,p=o.taskId??String(o.port);return e.jsxs("li",{className:"bg-task-item",children:[e.jsx("span",{className:"bg-task-icon",title:u?o.plugin:l("bgTaskPort")}),e.jsxs("div",{className:"bg-task-info",children:[e.jsxs("div",{className:"bg-task-line1",children:[u?e.jsxs("span",{className:"bg-task-port",title:o.taskId,children:["🧩 ",o.plugin]}):e.jsxs("span",{className:"bg-task-port",children:[":",o.port]}),o.name&&e.jsx("span",{className:"bg-task-name",children:o.name})]}),e.jsxs("div",{className:"bg-task-line2",children:[!u&&e.jsxs("span",{children:[l("bgTaskPid")," ",o.pid]}),e.jsxs("span",{children:[l("bgTaskSince")," ",Ua(o.since,l)]}),u&&o.status&&e.jsx("span",{className:"bg-task-status",children:o.status})]}),o.command&&e.jsxs("button",{type:"button",className:`bg-task-cmd ${c.has(p)?"open":""}`,title:`${l("bgTaskCommand")}: ${o.command}`,onClick:()=>n(p),children:[e.jsx(qe,{}),e.jsx("code",{children:o.command})]})]}),e.jsxs("button",{type:"button",className:"btn bg-task-stop",title:l("bgTaskStop"),onClick:()=>s(u?{type:"kill_background_server",taskId:o.taskId}:{type:"kill_background_server",port:o.port}),children:[e.jsx(rt,{}),e.jsx("span",{children:l("bgTaskStop")})]})]},p)})}),e.jsxs("div",{className:"bg-task-foot",children:[e.jsxs("button",{type:"button",className:"btn",title:l("bgTaskRefresh"),onClick:()=>s({type:"list_bg_servers"}),children:[e.jsx(dt,{}),e.jsx("span",{children:l("bgTaskRefresh")})]}),e.jsxs("button",{type:"button",className:"btn bg-task-stopall",disabled:t.length===0,title:l("bgTaskStopAll"),onClick:()=>s({type:"kill_background_servers"}),children:[e.jsx(rt,{}),e.jsx("span",{children:l("bgTaskStopAll")})]})]})]})})}function et(t,s){return t.toLowerCase().includes(s)}function Va({send:t,sessions:s,projects:i,cwd:l,fileSearch:c,onClose:a,onSwitchSession:n,onSwitchProject:o,onPreviewFile:u}){const p=me(),h=r.useRef(null),[g,x]=r.useState(""),v=r.useDeferredValue(g),[b,L]=r.useState(0),S=r.useRef(1),F=r.useRef(0),k=r.useRef(null);r.useEffect(()=>{t({type:"list_sessions"}),t({type:"list_projects"}),requestAnimationFrame(()=>{var R;return(R=h.current)==null?void 0:R.focus()})},[]);const[y,P]=r.useState(!1);r.useEffect(()=>{k.current&&clearTimeout(k.current);const R=v.trim();if(R)return k.current=setTimeout(()=>{const C=++S.current;F.current=C,P(!0),t({type:"search_files",reqId:C,query:R})},300),()=>{k.current&&clearTimeout(k.current)}},[v]);const I=v.trim().toLowerCase(),E=r.useMemo(()=>I?s.filter(R=>et(R.firstMessage??"",I)||et(R.name??"",I)||et(R.path.split(/[\\/]/).pop()??"",I)).slice(0,20):[],[s,I]),j=r.useMemo(()=>I?i.filter(R=>et(R.path,I)).slice(0,10):[],[i,I]),m=r.useMemo(()=>!I||!c||c.reqId!==F.current||!c.ok?[]:c.results,[c,I]);r.useEffect(()=>{c&&c.reqId===F.current&&F.current!==0&&P(!1)},[c]);const D=!!c&&c.ok&&c.truncated,W=r.useMemo(()=>[...E.map(R=>({kind:"session",path:R.path})),...j.map(R=>({kind:"project",path:R.path})),...m.filter(R=>R.type==="file").map(R=>({kind:"file",path:R.path,name:R.name}))],[E,j,m]);r.useEffect(()=>{L(0)},[v]);const ee=r.useCallback(R=>{R&&(R.kind==="session"?n(R.path):R.kind==="project"?o(R.path):u(R.path,R.name),a())},[n,o,u,a]);r.useEffect(()=>{const R=C=>{C.key==="Escape"?(C.preventDefault(),C.stopPropagation(),a()):C.key==="ArrowDown"?(C.preventDefault(),L(N=>Math.min(N+1,W.length-1))):C.key==="ArrowUp"?(C.preventDefault(),L(N=>Math.max(N-1,0))):C.key==="Enter"&&(C.preventDefault(),ee(W[b]))};return window.addEventListener("keydown",R,!0),()=>window.removeEventListener("keydown",R,!0)},[W,b,ee,a]);const X=E.length+j.length+m.length,O=(R,C,N)=>e.jsxs("div",{className:"gs-section-head",children:[N,e.jsx("span",{children:R}),e.jsx("em",{children:C})]});let H=-1;return e.jsx("div",{className:"modal-backdrop gs-backdrop",onClick:a,children:e.jsxs("div",{className:"gs-modal",onClick:R=>R.stopPropagation(),children:[e.jsxs("div",{className:"gs-input-row",children:[e.jsx(ot,{}),e.jsx("input",{ref:h,type:"text",value:g,placeholder:p("gsPlaceholder"),onChange:R=>x(R.target.value)}),e.jsx("button",{type:"button",className:"gs-close",title:p("close"),onClick:a,children:e.jsx(je,{})})]}),e.jsxs("div",{className:"gs-results",children:[!I&&e.jsx("div",{className:"gs-empty",children:p("gsHint")}),I&&X===0&&!D&&e.jsx("div",{className:"gs-empty",children:p(y?"gsSearching":"gsNoResults")}),E.length>0&&e.jsxs("div",{className:"gs-section",children:[O(p("gsSessions"),E.length,e.jsx(Ke,{})),E.map(R=>{H++;const C=H;return e.jsxs("button",{type:"button",className:C===b?"gs-item active":"gs-item",onMouseEnter:()=>L(C),onClick:()=>ee({kind:"session",path:R.path}),children:[e.jsxs("span",{className:"gs-item-title",children:[R.name||R.path.split(/[\\/]/).pop(),e.jsx("em",{className:"gs-item-meta",children:R.messageCount})]}),e.jsx("span",{className:"gs-item-sub",children:R.firstMessage})]},R.path)})]}),j.length>0&&e.jsxs("div",{className:"gs-section",children:[O(p("gsProjects"),j.length,e.jsx(Ue,{})),j.map(R=>{H++;const C=H,N=l&&R.path===l;return e.jsxs("button",{type:"button",className:C===b?"gs-item active":"gs-item",onMouseEnter:()=>L(C),onClick:()=>ee({kind:"project",path:R.path}),children:[e.jsxs("span",{className:"gs-item-title",children:[R.path.split(/[\\/]/).pop(),N&&e.jsx("em",{className:"gs-item-meta",children:p("gsCurrentProject")})]}),e.jsx("span",{className:"gs-item-sub",children:R.path})]},R.path)})]}),(m.length>0||I&&D)&&e.jsxs("div",{className:"gs-section",children:[O(p("gsFiles"),m.length,e.jsx($s,{})),m.map(R=>{H++;const C=H;return e.jsxs("button",{type:"button",className:C===b?"gs-item active":"gs-item",disabled:R.type==="dir",title:R.type==="dir"?void 0:p("gsOpenPreview"),onMouseEnter:()=>L(C),onClick:()=>{R.type==="file"&&ee({kind:"file",path:R.path,name:R.name})},children:[e.jsx("span",{className:"gs-item-title",children:R.name}),e.jsx("span",{className:"gs-item-sub",children:R.path})]},`${R.type}:${R.path}`)}),D&&e.jsx("div",{className:"gs-truncated",children:p("gsTruncated")})]})]}),e.jsxs("div",{className:"gs-foot",children:[e.jsxs("span",{children:["↑↓ ",p("gsNavigate")]}),e.jsxs("span",{children:["Enter ",p("gsOpen")]}),e.jsxs("span",{children:["Esc ",p("gsCloseHint")]})]})]})})}const kt=5e3;function Ga({file:t,content:s,send:i,onAddLines:l,onAttach:c,onClose:a}){const n=me(),[o,u]=r.useState(null),[p,h]=r.useState(!1),[g,x]=r.useState(null),[v,b]=r.useState(!1),[L,S]=r.useState(!1),[F,k]=r.useState(!1),[y,P]=r.useState(""),[I,E]=r.useState(!0),j=r.useRef(!1),[m,D]=r.useState(!0),[W,ee]=r.useState(!1),[X,O]=r.useState(100),H=r.useRef(0),R=r.useRef(!1),C=r.useRef(null);r.useEffect(()=>{h(!0),u(null),x(null),k(!1),P(""),E(!0),j.current=!1,i({type:"read_file",path:t.path})},[t.path,i]),r.useEffect(()=>{s&&s.path===t.path&&(u(s),F||P(s.text),h(!1))},[s,F,t.path]),r.useEffect(()=>{const Y=ce=>{if(ce.key==="Escape"){oe();return}if((ce.ctrlKey||ce.metaKey)&&ce.key.toLowerCase()==="s"&&F){ce.preventDefault(),Q();return}const fe=ce.target,pe=fe&&(fe.tagName==="INPUT"||fe.tagName==="TEXTAREA"||fe.isContentEditable);(ce.ctrlKey||ce.metaKey)&&ce.key.toLowerCase()==="a"&&!pe&&(ce.preventDefault(),w())};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[a,o,F,y]),r.useEffect(()=>{const Y=()=>{R.current=!1,b(!1)};return window.addEventListener("mouseup",Y),()=>window.removeEventListener("mouseup",Y)},[]);const N=r.useMemo(()=>{if(!o)return[];const Y=o.text.split(`
|
|
319
|
-
`);return Y.length>0&&Y[Y.length-1]===""&&Y.pop(),Y.slice(0,kt)},[o]),U=(o==null?void 0:o.lines)??0,_=U>kt,q=(Y,ce)=>{if(ce){const fe=H.current>0?H.current:Y;x({start:Math.min(fe,Y),end:Math.max(fe,Y)})}else H.current=Y,x({start:Y,end:Y})},w=()=>{N.length!==0&&(H.current=1,x({start:1,end:N.length}))},Z=()=>{g&&(l(t.path,t.name,g.start,g.end),S(!0),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>S(!1),1400))},te=o!==null&&o.kind==="text"&&!o.binary&&!o.truncated,ue=()=>{P((o==null?void 0:o.text)??""),k(!1),j.current&&E(!0)},A=()=>{if(F){if(y!==((o==null?void 0:o.text)??"")&&!window.confirm(n("discardFileChanges")))return;ue();return}!te||!o||(j.current=bt(t.name)&&I,bt(t.name)&&E(!1),x(null),P(o.text),k(!0))},Q=()=>{!F||!o||!te||i({type:"write_file",path:t.path,text:y})&&(k(!1),j.current&&E(!0),x(null))},oe=()=>{F&&y!==((o==null?void 0:o.text)??"")&&!window.confirm(n("discardFileChanges"))||a()},J=Y=>{O(Math.min(200,Math.max(50,Y)))},de=g?g.end-g.start+1:0,ie=(o==null?void 0:o.binary)??!1,d=(o==null?void 0:o.truncated)??!1,M=(o==null?void 0:o.kind)??"text",le=bt(t.name),se=le&&I&&!F&&M==="text"&&!ie,ge=Y=>ht(`/api/file?clientId=${encodeURIComponent(Dt())}&path=${encodeURIComponent(Y)}`);return e.jsx("div",{className:`fp-overlay ${W?"fullscreen":""}`,onMouseDown:Y=>{Y.target===Y.currentTarget&&oe()},children:e.jsxs("div",{className:`fp ${W?"fullscreen":""}`,style:{"--fp-zoom":X/100},children:[e.jsxs("div",{className:"fp-head",children:[e.jsx("span",{className:"fp-name",title:t.path,children:t.name}),e.jsx("span",{className:"fp-path",children:t.path}),e.jsxs("span",{className:"fp-meta",children:[o&&M==="text"&&!ie&&n("fileLines",{n:U}),o&&` · ${Ja(o.size)}`]}),e.jsxs("span",{className:"fp-head-actions",children:[le&&M==="text"&&!ie&&o&&e.jsx("button",{type:"button",className:`fp-attach markdown ${I?"on":""}`,"data-tip":n(I?"showMarkdownSource":"showMarkdownPreview"),disabled:F,onClick:()=>E(Y=>!Y),children:I?e.jsx(wt,{}):e.jsx(Yn,{})}),M==="text"&&!ie&&o&&e.jsx("button",{type:"button",className:`fp-attach edit ${F?"on":""}`,"data-tip":n(d?"fileEditTruncated":F?"exitEditFile":"editFile"),disabled:!te&&!F,onClick:A,children:e.jsx(Nt,{})}),M==="text"&&!ie&&!se&&e.jsx("button",{type:"button",className:`fp-attach wrap ${m?"on":""}`,"data-tip":n(m?"disableWrap":"enableWrap"),onClick:()=>D(Y=>!Y),children:e.jsx(Jn,{})}),M==="text"&&o&&e.jsxs("span",{className:"fp-zoom",children:[e.jsx("button",{type:"button",className:"fp-attach zoom-out","data-tip":n("zoomOut"),disabled:X<=50,onClick:()=>J(X-10),children:e.jsx(Pn,{})}),e.jsxs("button",{type:"button",className:"fp-zoom-val",title:n("resetZoom"),onClick:()=>O(100),children:[X,"%"]}),e.jsx("button",{type:"button",className:"fp-attach zoom-in","data-tip":n("zoomIn"),disabled:X>=200,onClick:()=>J(X+10),children:e.jsx(In,{})})]}),M!=="video"&&M!=="none"&&e.jsx("button",{type:"button",className:"fp-attach inline","data-tip":n("attachInlineTip"),onClick:()=>c(t.path,t.name,"inline"),children:e.jsx(De,{})}),e.jsx("button",{type:"button",className:"fp-attach ref","data-tip":n("referenceTip"),onClick:()=>c(t.path,t.name,"reference"),children:e.jsx(jt,{})}),e.jsx("button",{type:"button",className:`fp-attach full ${W?"on":""}`,"data-tip":n(W?"exitFullscreen":"fullscreen"),onClick:()=>ee(Y=>!Y),children:W?e.jsx(_n,{}):e.jsx(Wn,{})}),e.jsx("button",{type:"button",className:"fp-close",title:n("close"),onClick:oe,children:e.jsx(je,{})})]})]}),d&&M==="text"&&!ie&&e.jsx("div",{className:"fp-notice",children:n("previewTruncated")}),p&&!o&&e.jsx("div",{className:"fp-empty",children:n("loading")}),!p&&M==="none"&&!ie&&e.jsx("div",{className:"fp-empty",children:n("previewNotSupported")}),!p&&M==="image"&&e.jsx("div",{className:"fp-media-wrap",children:e.jsx("img",{className:"fp-media",src:ge(t.path),alt:t.name})}),!p&&M==="video"&&e.jsx("div",{className:"fp-media-wrap",children:e.jsx("video",{className:"fp-media",src:ge(t.path),controls:!0,preload:"metadata"})}),!p&&se&&o&&e.jsx("div",{className:"fp-markdown msg-text",children:e.jsx("div",{className:"fp-markdown-zoom",children:e.jsx(gt,{text:o.text})})}),!p&&ie&&M!=="image"&&M!=="video"&&o&&e.jsxs("div",{className:"fp-hex-wrap",children:[e.jsxs("div",{className:"fp-notice",children:[n("binaryFile"),o.truncated&&n("binaryHexTruncated")]}),e.jsx("pre",{className:"fp-hex",children:o.text})]}),!p&&F&&M==="text"&&!ie&&o&&e.jsx("textarea",{className:`fp-editor ${m?"":"no-wrap"}`,value:y,onChange:Y=>P(Y.target.value),wrap:m?"soft":"off",spellCheck:!1,autoFocus:!0}),!p&&!se&&!F&&M==="text"&&!ie&&o&&N.length===0&&e.jsx("div",{className:"fp-empty",children:n("emptyFile")}),!p&&!se&&!F&&M==="text"&&!ie&&N.length>0&&e.jsxs("div",{className:`fp-code ${v?"dragging":""} ${m?"":"no-wrap"}`,onMouseDown:Y=>{Y.button===0&&Y.preventDefault()},children:[N.map((Y,ce)=>{const fe=ce+1,pe=g!==null&&fe>=g.start&&fe<=g.end;return e.jsxs("div",{className:`fp-line ${pe?"sel":""}`,onMouseDown:Se=>{Se.button===0&&(q(fe,Se.shiftKey),R.current=!0,b(!0))},onMouseEnter:()=>{R.current&&q(fe,!0)},children:[e.jsx("span",{className:"fp-num",children:fe}),e.jsx("span",{className:"fp-code-text",children:Y})]},fe)}),_&&e.jsx("div",{className:"fp-lines-note",children:n("previewLinesTruncated",{n:kt})})]}),e.jsx("div",{className:"fp-foot",children:F?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"fp-hint",children:n("editFile")}),e.jsxs("div",{className:"fp-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:A,children:n("cancel")}),e.jsxs("button",{type:"button",className:"btn primary",disabled:y===((o==null?void 0:o.text)??""),onClick:Q,children:[e.jsx(Fn,{})," ",n("saveFile")]})]})]}):!se&&M==="text"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"fp-hint",children:g?n("selectedRange",{n:de,start:g.start,end:g.end}):n("selectLinesHint")}),e.jsxs("div",{className:"fp-actions",children:[e.jsx("button",{type:"button",className:"btn",disabled:N.length===0,onClick:w,children:n("selectAll")}),e.jsx("button",{type:"button",className:"btn",disabled:!g,onClick:()=>x(null),children:n("clearSelection")}),e.jsxs("button",{type:"button",className:"btn primary",disabled:!g||ie,onClick:Z,children:[L?e.jsx(mt,{}):null,n(L?"addedToChat":"addToChat")]})]})]})})]})})}function bt(t){const s=t.toLowerCase();return s.endsWith(".md")||s.endsWith(".markdown")}function Ja(t){return t>=1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:t>=1024?`${Math.round(t/1024)} KB`:`${t} B`}const cn="pi-web-sounds",Ve={enabled:!0,question:!0,done:!0,start:!1,error:!0,volume:100};function dn(){try{const t=localStorage.getItem(cn);if(!t)return{...Ve};const s=JSON.parse(t),i={...Ve,...s};for(const l of["enabled","question","done","start","error"])typeof i[l]!="boolean"&&(i[l]=Ve[l]);return typeof i.volume!="number"||!Number.isFinite(i.volume)?i.volume=Ve.volume:i.volume=Math.round(Math.max(0,Math.min(100,i.volume))/5)*5,i}catch{return{...Ve}}}function Ya(t){try{localStorage.setItem(cn,JSON.stringify(t))}catch{}}let Ge=null;function Qa(){try{if(!Ge){const t=window.AudioContext??window.webkitAudioContext;if(!t)return null;Ge=new t}return Ge.state==="suspended"&&Ge.resume(),Ge}catch{return null}}const Xa=[{type:"sine",freq:587.33,start:0,dur:.13,peak:.5},{type:"sine",freq:880,start:.11,dur:.24,peak:.5}],Za=[{type:"sine",freq:880,start:0,dur:.15,peak:.35},{type:"sine",freq:587.33,start:.15,dur:.32,peak:.35}],er=[{type:"triangle",freq:660,start:0,dur:.08,peak:.22}],tr=[{type:"square",freq:220,start:0,dur:.16,peak:.18},{type:"square",freq:174.61,start:.18,dur:.26,peak:.18}],sr={question:Xa,done:Za,start:er,error:tr};function nr(t,s,i){const l=t.createOscillator(),c=t.createGain();l.type=s.type,l.frequency.value=s.freq;const a=t.currentTime+s.start,n=Math.max(1e-4,s.peak*i);c.gain.setValueAtTime(1e-4,a),c.gain.exponentialRampToValueAtTime(n,a+.012),c.gain.exponentialRampToValueAtTime(1e-4,a+s.dur),l.connect(c),c.connect(t.destination),l.start(a),l.stop(a+s.dur+.05)}function Je(t,s=dn()){if(!s.enabled||!s[t])return;const i=Qa();if(!i)return;const l=Math.max(0,Math.min(1,s.volume/100));for(const c of sr[t])nr(i,c,l)}const Rt="pi-web-ui:theme",un="dark",Ns="theme-stylesheet",Cs="pi-web-ui:theme-change";function pn(){try{const t=localStorage.getItem(Rt);if(t&&t!==un)return t}catch{}return null}function ir(t){try{t?localStorage.setItem(Rt,t):localStorage.removeItem(Rt)}catch{}}function mn(t){let s=document.getElementById(Ns);if(!t){s==null||s.remove(),window.dispatchEvent(new CustomEvent(Cs));return}s||(s=document.createElement("link"),s.id=Ns,s.rel="stylesheet",document.head.appendChild(s)),s.href=`/themes/${encodeURIComponent(t)}.css`,s.onload=()=>window.dispatchEvent(new CustomEvent(Cs))}async function ar(){try{const t=await fetch(ht("/api/themes"));if(!t.ok)return[];const s=await t.json();return Array.isArray(s.themes)?s.themes:[]}catch{return[]}}function rr(){const[t,s]=r.useState([]),[i,l]=r.useState(()=>pn());return r.useEffect(()=>{let a=!1;return ar().then(n=>{a||s(n)}),()=>{a=!0}},[]),r.useEffect(()=>{mn(i),ir(i)},[i]),{themes:t,theme:i,switchTheme:a=>l(a===un?null:a)}}function hr(){const t=getComputedStyle(document.documentElement),s=(i,l)=>t.getPropertyValue(i).trim()||l;return{background:s("--term-bg","#0b0d12"),foreground:s("--term-fg","#e6e8ef"),cursor:s("--term-cursor","#8b5cf6"),cursorAccent:s("--term-cursor-accent","#0b0d12"),selectionBackground:s("--term-selection","rgba(139, 92, 246, 0.35)"),black:s("--term-black","#1a1d26"),red:s("--term-red","#f87171"),green:s("--term-green","#34d399"),yellow:s("--term-yellow","#fbbf24"),blue:s("--term-blue","#60a5fa"),magenta:s("--term-magenta","#c084fc"),cyan:s("--term-cyan","#22d3ee"),white:s("--term-white","#e6e8ef"),brightBlack:s("--term-bright-black","#6b7284"),brightRed:s("--term-bright-red","#f87171"),brightGreen:s("--term-bright-green","#34d399"),brightYellow:s("--term-bright-yellow","#fbbf24"),brightBlue:s("--term-bright-blue","#60a5fa"),brightMagenta:s("--term-bright-magenta","#c084fc"),brightCyan:s("--term-bright-cyan","#22d3ee"),brightWhite:s("--term-bright-white","#ffffff")}}const lr=r.lazy(()=>Rs(()=>import("./TerminalPanel-zmg6ssVv.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.TerminalPanel})));function or({notice:t,onDismiss:s}){const i=me(),[l,c]=r.useState(!1);r.useEffect(()=>{if(l)return;const n=setTimeout(()=>s(t.id),t.level==="error"?12e3:7e3);return()=>clearTimeout(n)},[l,t.id,t.level,s]);const a=t.level==="error"?ei:t.level==="warning"?Zn:Un;return e.jsxs("div",{className:`notice notice-${t.level}${l?" paused":""}`,role:"status",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[e.jsx(a,{className:"notice-icon"}),e.jsx("span",{className:"notice-text",children:t.text}),e.jsx("button",{type:"button",className:"notice-close",title:i("close"),onClick:()=>s(t.id),children:e.jsx(je,{})})]})}const cr=[],hn=180,gn=520,fn=240,xn=t=>`pi-web-ui:${t}-panel-width`;function Ss(t){const s=Number(localStorage.getItem(xn(t)));return Number.isFinite(s)&&s>=hn&&s<=gn?s:fn}function Ts({side:t,width:s,onResize:i}){const l=me(),c=r.useCallback(a=>{a.preventDefault();const n=a.clientX,o=s;let u=o;const p=g=>{const x=t==="left"?g.clientX-n:n-g.clientX;u=Math.min(gn,Math.max(hn,Math.round(o+x))),i(u)},h=()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",h),document.body.classList.remove("panel-resizing"),localStorage.setItem(xn(t),String(u))};window.addEventListener("pointermove",p),window.addEventListener("pointerup",h),document.body.classList.add("panel-resizing")},[t,s,i]);return e.jsx("div",{className:`resize-handle resize-${t}`,title:l("dragToResize"),onPointerDown:c,onDoubleClick:()=>i(fn)})}function dr(){var xe,he,be,Ce,$t,At,_t,Ot,Wt,Ht,qt,Kt,Ut,zt;const t=me(),{chat:s,send:i,dismissNotice:l,pushNotice:c,terminal:a}=Ni(),[n,o]=r.useState([]),[u,p]=r.useState(null),[h,g]=r.useState(!1),[x,v]=r.useState("chat"),b=r.useMemo(()=>s.plugins.filter(B=>{var K,re;return!((re=(K=s.settings)==null?void 0:K.disabledPlugins)!=null&&re.includes(B.id))}),[s.plugins,(xe=s.settings)==null?void 0:xe.disabledPlugins]),[L,S]=r.useState([]);r.useEffect(()=>gi(S),[]),r.useEffect(()=>{fi(b,s.pluginsEpoch)},[b,s.pluginsEpoch]);const[F,k]=r.useState(()=>Ss("left")),[y,P]=r.useState(()=>Ss("right")),I=r.useCallback(B=>k(B),[]),E=r.useCallback(B=>P(B),[]),[j,m]=r.useState(null),[D,W]=r.useState(()=>window.matchMedia("(max-width: 768px)").matches);r.useEffect(()=>{const B=window.matchMedia("(max-width: 768px)"),K=re=>W(re.matches);return B.addEventListener("change",K),()=>B.removeEventListener("change",K)},[]);const[ee,X]=r.useState(!1),[O,H]=r.useState(!1),[R,C]=r.useState(!1),[N,U]=r.useState(!1),[_,q]=r.useState(!1);r.useEffect(()=>{const B=K=>{var Ie,Vt;const re=K.detail,ve=(re==null?void 0:re.title)||"插件命令",ye=re==null?void 0:re.command;if(!ye||!s.ready)return;const Ne={name:ve,command:ye,cwd:"${pwd}"},ke=s.terminals.find(ft=>ft.title===ve);if(ke)a.restart(ke.id),i({type:"run_command",terminalId:ke.id,conversationId:ke.conversationId,command:Ne,cols:80,rows:24});else{const ft=Be();a.create({id:ft,conversationId:s.activeConversationId||((Ie=s.state)==null?void 0:Ie.conversationId)||"",title:ve,cwd:((Vt=s.state)==null?void 0:Vt.cwd)??"",cols:80,rows:24,running:!0,exitCode:null,command:Ne})}v("terminal")};return window.addEventListener("pi-web-ui:plugin-run-command",B),()=>window.removeEventListener("pi-web-ui:plugin-run-command",B)},[s,a,i]),r.useEffect(()=>{const B=K=>{!(K.ctrlKey||K.metaKey)||K.key.toLowerCase()!=="k"||(K.preventDefault(),q(re=>!re))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]);const[w,Z]=r.useState(dn),{themes:te,theme:ue,switchTheme:A}=rr(),Q=r.useRef(null),oe=r.useRef(null),J=r.useRef(0),de=r.useRef(!1),ie=r.useRef(s.terminals);r.useEffect(()=>{Ya(w)},[w]),r.useEffect(()=>{var K;const B=ie.current;ie.current=s.terminals;for(const re of s.terminals){const ve=((K=re.command)==null?void 0:K.command)??"",ye=B.find(Ne=>Ne.id===re.id);!(ye!=null&&ye.running)||re.running||(ve.startsWith("pi remove ")?i({type:"extensions_reload"}):(ve.startsWith("pi-web-ui install ")||ve.startsWith("pi-web-ui uninstall "))&&i({type:"plugins_reload"}))}},[s.terminals,i]),r.useEffect(()=>{var re;const B=((re=s.state)==null?void 0:re.isStreaming)??!1,K=Q.current;Q.current=B,K!==null&&(!K&&B?Je("start",w):K&&!B&&Je("done",w))},[(he=s.state)==null?void 0:he.isStreaming,w]),r.useEffect(()=>{var K;const B=((K=s.dialog)==null?void 0:K.id)??null;B!==null&&B!==oe.current&&Je("question",w),oe.current=B},[s.dialog,w]),r.useEffect(()=>{const B=[...s.notices].reverse().find(K=>K.level==="error");B&&B.id!==J.current&&(J.current=B.id,Je("error",w))},[s.notices,w]);const d=(B,K,re,ve=!1,ye)=>{const Ne=`${B}|${re}|${ye?`${ye.start}-${ye.end}`:""}`;o(ke=>ke.some(Ie=>`${Ie.path}|${Ie.mode}|${Ie.lines?`${Ie.lines.start}-${Ie.lines.end}`:""}`===Ne)?ke:[...ke,{path:B,name:K,mode:re,isDir:ve,...ye?{lines:ye}:{}}])},M=B=>o(K=>K.filter(re=>re.key?re.key!==B:re.path!==B)),le=r.useCallback(B=>(!B.type.startsWith("list_")&&!B.type.startsWith("get_")&&m(null),i(B)),[i]),se=r.useRef(0),ge=r.useRef(0),Y=B=>{var ve;const K=Date.now();(ve=s.state)!=null&&ve.model&&!s.state.model.vision&&K-ge.current>1e4&&(ge.current=K,c("warning",t("imageNotSupported")));const re=`paste-${++se.current}`;o(ye=>[...ye,{path:"",key:re,name:B.name,mode:"inline",imageData:B.data,mimeType:B.mimeType}])},ce=async B=>{for(const K of B){const re=await Gs(K);if(!re){c("error",t("imageLoadFailed",{name:K.name}));continue}Y(re)}},fe=20*1024*1024,pe=r.useRef(0),Se=async B=>{if(B.size>fe){c("warning",t("fileTooLarge",{name:B.name,size:fe/1024/1024}));return}let K;try{K=(await new Promise((ye,Ne)=>{const ke=new FileReader;ke.onload=()=>ye(ke.result),ke.onerror=()=>Ne(ke.error??new Error("read failed")),ke.readAsDataURL(B)})).replace(/^data:[^;]*;base64,/,"")}catch{c("error",t("fileLoadFailed",{name:B.name}));return}const re=`upload-${++pe.current}`;o(ve=>[...ve,{path:"",key:re,name:B.name,mode:"inline",fileData:K,size:B.size,mimeType:B.type||void 0}])},Pe=async B=>{for(const K of B)Re(K.type)?await ce([K]):await Se(K)},ze=r.useCallback((B,K,re)=>{i({type:"edit_message",messageId:B,text:K,attachments:re})},[i]),Fe=r.useCallback(()=>H(!0),[]),_e=r.useCallback(()=>o([]),[]),Te=r.useCallback(M,[]),T=r.useCallback(ce,[ce]),$=r.useCallback(Pe,[Pe]),ne=(be=s.state)==null?void 0:be.model,ae=(Ce=s.state)==null?void 0:Ce.thinkingLevel,f=($t=s.state)==null?void 0:$t.availableThinkingLevels,G=r.useMemo(()=>ne?{model:ne,thinkingLevel:ae??"off",availableThinkingLevels:f??[]}:null,[ne,ae,f]),z=r.useCallback(()=>{var B,K;return!s.ready||s.terminals.length!==0?!1:(a.create({id:Be(),conversationId:s.activeConversationId||((B=s.state)==null?void 0:B.conversationId)||"",title:t("terminalTitle",{n:1}),cwd:((K=s.state)==null?void 0:K.cwd)??"",cols:80,rows:24,running:!0,exitCode:null}),!0)},[s.ready,(At=s.state)==null?void 0:At.cwd,s.terminals.length,t,a]);return r.useEffect(()=>{if(de.current){if(x!=="terminal"||s.terminals.length!==0){de.current=!1;return}z()&&(de.current=!1)}},[s.terminals.length,z,x]),e.jsxs("div",{className:"app",onDragOver:B=>{var K;Array.from(((K=B.dataTransfer)==null?void 0:K.types)??[]).includes("Files")&&(B.preventDefault(),g(!0))},onDragLeave:B=>{B.currentTarget.contains(B.relatedTarget)||g(!1)},onDrop:B=>{var ye,Ne;if(g(!1),!Array.from(((ye=B.dataTransfer)==null?void 0:ye.types)??[]).includes("Files"))return;B.preventDefault();const K=Array.from(((Ne=B.dataTransfer)==null?void 0:Ne.files)??[]);if(K.length===0){c("warning",t("foldersNotSupported"));return}const re=K.filter(ke=>Re(ke.type)),ve=K.filter(ke=>!Re(ke.type));re.length>0&&ce(re),ve.length>0&&Pe(ve)},children:[h&&e.jsx("div",{className:"app-drop-overlay","aria-hidden":!0,children:e.jsxs("span",{children:["📎 ",t("dropHereToAttach")]})}),e.jsx(ri,{chat:s,send:i,terminal:a,view:x,plugins:b,onViewChange:B=>{de.current=B==="terminal"&&s.terminals.length===0,de.current&&z()&&(de.current=!1),v(B),m(null)},onOpenPanel:m,onOpenSettings:()=>C(!0),onOpenBgTasks:()=>U(!0),onOpenGlobalSearch:()=>q(!0),sound:w,onSoundChange:Z,onSoundPreview:B=>Je(B,w),themes:te,theme:ue,onThemeChange:A}),s.protocolMismatch&&e.jsxs("div",{className:"protocol-banner",children:["⚠ ",t("protocolMismatch")]}),e.jsx("div",{className:"notices",children:s.notices.map(B=>e.jsx(or,{notice:B,onDismiss:l},B.id))}),e.jsx(xa,{send:i,children:e.jsxs("div",{className:"layout",style:{"--left-w":`${F}px`,"--right-w":`${y}px`},children:[j&&e.jsx("div",{className:"drawer-backdrop",onClick:()=>m(null)}),e.jsxs("div",{className:`view-pane ${x==="chat"?"":"hidden"}`,children:[e.jsx("div",{className:`panel-drawer drawer-left ${j==="left"?"open":""}`,children:e.jsx(oi,{send:le,active:!D||j==="left",ready:s.ready,status:s.status,cwd:((_t=s.state)==null?void 0:_t.cwd)??"",sessionFile:((Ot=s.state)==null?void 0:Ot.sessionFile)??null,conversations:s.conversations,sessions:s.sessions,projects:s.projects,activeConversationId:s.activeConversationId})}),!D&&e.jsx(Ts,{side:"left",width:F,onResize:I}),e.jsxs("main",{className:"main",children:[s.state?e.jsx(wa,{state:s.state,liveOutputs:s.liveOutputs,toolStatuses:s.toolStatuses,onEdit:ze,onKillBash:()=>i({type:"abort_bash"}),thinkingWrap:((Wt=s.settings)==null?void 0:Wt.thinkingWrap)??!0,toolsWrap:((Ht=s.settings)==null?void 0:Ht.toolsWrap)??!0},s.state.conversationId??"boot"):e.jsx("div",{className:"boot-wait",children:s.ready?t("loadingSession"):t("connectingServer")}),e.jsx(Ia,{send:i,goal:s.goal,models:s.models,modelsLoading:s.modelsLoading,activeConversationId:s.activeConversationId}),s.dialog&&e.jsx(Ba,{dialog:s.dialog,send:i}),e.jsx(Pa,{send:i,ready:s.ready,streaming:((qt=s.state)==null?void 0:qt.isStreaming)??!1,messages:((Kt=s.state)==null?void 0:Kt.messages)??cr,slashCommands:s.slashCommands,modelState:G,models:s.models,modelsLoading:s.modelsLoading,attachments:n,onRemoveAttachment:Te,onAddImageFiles:T,onAddLocalFiles:$,onNotice:c,onManageModels:Fe,onSent:_e})]}),!D&&e.jsx(Ts,{side:"right",width:y,onResize:E}),e.jsx("div",{className:`panel-drawer drawer-right ${j==="right"?"open":""}`,children:e.jsx(Li,{send:le,files:s.files,fileChanged:s.fileChanged,widgets:s.widgets,cwd:((Ut=s.state)==null?void 0:Ut.cwd)??"",onAttach:(B,K,re,ve)=>{m(null),d(B,K,re,ve)},onPreview:(B,K)=>{m(null),p({path:B,name:K})},onNotice:(B,K)=>c(B,K)})})]}),e.jsx("div",{className:`view-pane ${x==="terminal"?"":"hidden"}`,children:e.jsx(r.Suspense,{fallback:null,children:e.jsx(lr,{chat:s,send:i,terminal:a})})}),e.jsx("div",{className:`view-pane ${x==="git"?"":"hidden"}`,children:e.jsx($a,{chat:s,send:i,terminal:a,active:x==="git",onSwitchToTerminal:()=>v("terminal")})}),L.map(B=>{const K=`plugin:${B.info.id}`;return e.jsx("div",{className:`view-pane ${x===K?"":"hidden"}`,children:e.jsx(Aa,{entry:B,send:i})},B.info.id)})]})}),e.jsx(La,{chat:s,send:i}),u&&e.jsx(Ga,{file:u,content:s.fileContent,send:i,onAddLines:(B,K,re,ve)=>d(B,K,"lines",!1,{start:re,end:ve}),onAttach:(B,K,re)=>d(B,K,re),onClose:()=>p(null)}),s.ready&&s.state&&s.state.piConfigured===!1&&!ee&&!O&&e.jsx(_a,{send:i,piConfigured:s.state.piConfigured,piAgentInstalled:s.state.piAgentInstalled,providers:s.providers,installResult:s.installResult,onClose:()=>X(!0)}),O&&e.jsx(Ha,{send:i,providers:s.modelsConfig,providerStatus:s.providers,fetchModelsResult:s.fetchModelsResult,refreshProviderResult:s.refreshProviderResult,cloneProviderResult:s.cloneProviderResult,onClose:()=>H(!1)}),R&&e.jsx(Ka,{chat:s,send:i,terminal:a,onSwitchToTerminal:()=>v("terminal"),onClose:()=>C(!1)}),N&&e.jsx(za,{servers:s.bgServers,send:i,onClose:()=>U(!1)}),_&&e.jsx(Va,{send:i,sessions:s.sessions,projects:s.projects,cwd:((zt=s.state)==null?void 0:zt.cwd)??"",fileSearch:s.fileSearch,onClose:()=>q(!1),onSwitchSession:B=>{i({type:"switch_session",path:B})},onSwitchProject:B=>{i({type:"set_cwd",path:B})},onPreviewFile:(B,K)=>{p({path:B,name:K})}})]})}ci();mn(pn());bn.createRoot(document.getElementById("root")).render(e.jsx(r.StrictMode,{children:e.jsx(ii,{children:e.jsx(dr,{})})}));export{dt as F,Cs as T,De as a,hr as b,mr as c,Ct as d,Me as e,je as f,On as g,qe as h,Be as r,me as u};
|
|
319
|
+
`);return Y.length>0&&Y[Y.length-1]===""&&Y.pop(),Y.slice(0,kt)},[o]),U=(o==null?void 0:o.lines)??0,_=U>kt,q=(Y,ce)=>{if(ce){const fe=H.current>0?H.current:Y;x({start:Math.min(fe,Y),end:Math.max(fe,Y)})}else H.current=Y,x({start:Y,end:Y})},w=()=>{N.length!==0&&(H.current=1,x({start:1,end:N.length}))},Z=()=>{g&&(l(t.path,t.name,g.start,g.end),S(!0),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>S(!1),1400))},te=o!==null&&o.kind==="text"&&!o.binary&&!o.truncated,ue=()=>{P((o==null?void 0:o.text)??""),k(!1),j.current&&E(!0)},A=()=>{if(F){if(y!==((o==null?void 0:o.text)??"")&&!window.confirm(n("discardFileChanges")))return;ue();return}!te||!o||(j.current=bt(t.name)&&I,bt(t.name)&&E(!1),x(null),P(o.text),k(!0))},Q=()=>{!F||!o||!te||i({type:"write_file",path:t.path,text:y})&&(k(!1),j.current&&E(!0),x(null))},oe=()=>{F&&y!==((o==null?void 0:o.text)??"")&&!window.confirm(n("discardFileChanges"))||a()},J=Y=>{O(Math.min(200,Math.max(50,Y)))},de=g?g.end-g.start+1:0,ie=(o==null?void 0:o.binary)??!1,d=(o==null?void 0:o.truncated)??!1,M=(o==null?void 0:o.kind)??"text",le=bt(t.name),se=le&&I&&!F&&M==="text"&&!ie,ge=Y=>ht(`/api/file?clientId=${encodeURIComponent(Dt())}&path=${encodeURIComponent(Y)}`);return e.jsx("div",{className:`fp-overlay ${W?"fullscreen":""}`,onMouseDown:Y=>{Y.target===Y.currentTarget&&oe()},children:e.jsxs("div",{className:`fp ${W?"fullscreen":""}`,style:{"--fp-zoom":X/100},children:[e.jsxs("div",{className:"fp-head",children:[e.jsx("span",{className:"fp-name",title:t.path,children:t.name}),e.jsx("span",{className:"fp-path",children:t.path}),e.jsxs("span",{className:"fp-meta",children:[o&&M==="text"&&!ie&&n("fileLines",{n:U}),o&&` · ${Ja(o.size)}`]}),e.jsxs("span",{className:"fp-head-actions",children:[le&&M==="text"&&!ie&&o&&e.jsx("button",{type:"button",className:`fp-attach markdown ${I?"on":""}`,"data-tip":n(I?"showMarkdownSource":"showMarkdownPreview"),disabled:F,onClick:()=>E(Y=>!Y),children:I?e.jsx(wt,{}):e.jsx(Yn,{})}),M==="text"&&!ie&&o&&e.jsx("button",{type:"button",className:`fp-attach edit ${F?"on":""}`,"data-tip":n(d?"fileEditTruncated":F?"exitEditFile":"editFile"),disabled:!te&&!F,onClick:A,children:e.jsx(Nt,{})}),M==="text"&&!ie&&!se&&e.jsx("button",{type:"button",className:`fp-attach wrap ${m?"on":""}`,"data-tip":n(m?"disableWrap":"enableWrap"),onClick:()=>D(Y=>!Y),children:e.jsx(Jn,{})}),M==="text"&&o&&e.jsxs("span",{className:"fp-zoom",children:[e.jsx("button",{type:"button",className:"fp-attach zoom-out","data-tip":n("zoomOut"),disabled:X<=50,onClick:()=>J(X-10),children:e.jsx(Pn,{})}),e.jsxs("button",{type:"button",className:"fp-zoom-val",title:n("resetZoom"),onClick:()=>O(100),children:[X,"%"]}),e.jsx("button",{type:"button",className:"fp-attach zoom-in","data-tip":n("zoomIn"),disabled:X>=200,onClick:()=>J(X+10),children:e.jsx(In,{})})]}),M!=="video"&&M!=="none"&&e.jsx("button",{type:"button",className:"fp-attach inline","data-tip":n("attachInlineTip"),onClick:()=>c(t.path,t.name,"inline"),children:e.jsx(De,{})}),e.jsx("button",{type:"button",className:"fp-attach ref","data-tip":n("referenceTip"),onClick:()=>c(t.path,t.name,"reference"),children:e.jsx(jt,{})}),e.jsx("button",{type:"button",className:`fp-attach full ${W?"on":""}`,"data-tip":n(W?"exitFullscreen":"fullscreen"),onClick:()=>ee(Y=>!Y),children:W?e.jsx(_n,{}):e.jsx(Wn,{})}),e.jsx("button",{type:"button",className:"fp-close",title:n("close"),onClick:oe,children:e.jsx(je,{})})]})]}),d&&M==="text"&&!ie&&e.jsx("div",{className:"fp-notice",children:n("previewTruncated")}),p&&!o&&e.jsx("div",{className:"fp-empty",children:n("loading")}),!p&&M==="none"&&!ie&&e.jsx("div",{className:"fp-empty",children:n("previewNotSupported")}),!p&&M==="image"&&e.jsx("div",{className:"fp-media-wrap",children:e.jsx("img",{className:"fp-media",src:ge(t.path),alt:t.name})}),!p&&M==="video"&&e.jsx("div",{className:"fp-media-wrap",children:e.jsx("video",{className:"fp-media",src:ge(t.path),controls:!0,preload:"metadata"})}),!p&&se&&o&&e.jsx("div",{className:"fp-markdown msg-text",children:e.jsx("div",{className:"fp-markdown-zoom",children:e.jsx(gt,{text:o.text})})}),!p&&ie&&M!=="image"&&M!=="video"&&o&&e.jsxs("div",{className:"fp-hex-wrap",children:[e.jsxs("div",{className:"fp-notice",children:[n("binaryFile"),o.truncated&&n("binaryHexTruncated")]}),e.jsx("pre",{className:"fp-hex",children:o.text})]}),!p&&F&&M==="text"&&!ie&&o&&e.jsx("textarea",{className:`fp-editor ${m?"":"no-wrap"}`,value:y,onChange:Y=>P(Y.target.value),wrap:m?"soft":"off",spellCheck:!1,autoFocus:!0}),!p&&!se&&!F&&M==="text"&&!ie&&o&&N.length===0&&e.jsx("div",{className:"fp-empty",children:n("emptyFile")}),!p&&!se&&!F&&M==="text"&&!ie&&N.length>0&&e.jsxs("div",{className:`fp-code ${v?"dragging":""} ${m?"":"no-wrap"}`,onMouseDown:Y=>{Y.button===0&&Y.preventDefault()},children:[N.map((Y,ce)=>{const fe=ce+1,pe=g!==null&&fe>=g.start&&fe<=g.end;return e.jsxs("div",{className:`fp-line ${pe?"sel":""}`,onMouseDown:Se=>{Se.button===0&&(q(fe,Se.shiftKey),R.current=!0,b(!0))},onMouseEnter:()=>{R.current&&q(fe,!0)},children:[e.jsx("span",{className:"fp-num",children:fe}),e.jsx("span",{className:"fp-code-text",children:Y})]},fe)}),_&&e.jsx("div",{className:"fp-lines-note",children:n("previewLinesTruncated",{n:kt})})]}),e.jsx("div",{className:"fp-foot",children:F?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"fp-hint",children:n("editFile")}),e.jsxs("div",{className:"fp-actions",children:[e.jsx("button",{type:"button",className:"btn",onClick:A,children:n("cancel")}),e.jsxs("button",{type:"button",className:"btn primary",disabled:y===((o==null?void 0:o.text)??""),onClick:Q,children:[e.jsx(Fn,{})," ",n("saveFile")]})]})]}):!se&&M==="text"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"fp-hint",children:g?n("selectedRange",{n:de,start:g.start,end:g.end}):n("selectLinesHint")}),e.jsxs("div",{className:"fp-actions",children:[e.jsx("button",{type:"button",className:"btn",disabled:N.length===0,onClick:w,children:n("selectAll")}),e.jsx("button",{type:"button",className:"btn",disabled:!g,onClick:()=>x(null),children:n("clearSelection")}),e.jsxs("button",{type:"button",className:"btn primary",disabled:!g||ie,onClick:Z,children:[L?e.jsx(mt,{}):null,n(L?"addedToChat":"addToChat")]})]})]})})]})})}function bt(t){const s=t.toLowerCase();return s.endsWith(".md")||s.endsWith(".markdown")}function Ja(t){return t>=1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:t>=1024?`${Math.round(t/1024)} KB`:`${t} B`}const cn="pi-web-sounds",Ve={enabled:!0,question:!0,done:!0,start:!1,error:!0,volume:100};function dn(){try{const t=localStorage.getItem(cn);if(!t)return{...Ve};const s=JSON.parse(t),i={...Ve,...s};for(const l of["enabled","question","done","start","error"])typeof i[l]!="boolean"&&(i[l]=Ve[l]);return typeof i.volume!="number"||!Number.isFinite(i.volume)?i.volume=Ve.volume:i.volume=Math.round(Math.max(0,Math.min(100,i.volume))/5)*5,i}catch{return{...Ve}}}function Ya(t){try{localStorage.setItem(cn,JSON.stringify(t))}catch{}}let Ge=null;function Qa(){try{if(!Ge){const t=window.AudioContext??window.webkitAudioContext;if(!t)return null;Ge=new t}return Ge.state==="suspended"&&Ge.resume(),Ge}catch{return null}}const Xa=[{type:"sine",freq:587.33,start:0,dur:.13,peak:.5},{type:"sine",freq:880,start:.11,dur:.24,peak:.5}],Za=[{type:"sine",freq:880,start:0,dur:.15,peak:.35},{type:"sine",freq:587.33,start:.15,dur:.32,peak:.35}],er=[{type:"triangle",freq:660,start:0,dur:.08,peak:.22}],tr=[{type:"square",freq:220,start:0,dur:.16,peak:.18},{type:"square",freq:174.61,start:.18,dur:.26,peak:.18}],sr={question:Xa,done:Za,start:er,error:tr};function nr(t,s,i){const l=t.createOscillator(),c=t.createGain();l.type=s.type,l.frequency.value=s.freq;const a=t.currentTime+s.start,n=Math.max(1e-4,s.peak*i);c.gain.setValueAtTime(1e-4,a),c.gain.exponentialRampToValueAtTime(n,a+.012),c.gain.exponentialRampToValueAtTime(1e-4,a+s.dur),l.connect(c),c.connect(t.destination),l.start(a),l.stop(a+s.dur+.05)}function Je(t,s=dn()){if(!s.enabled||!s[t])return;const i=Qa();if(!i)return;const l=Math.max(0,Math.min(1,s.volume/100));for(const c of sr[t])nr(i,c,l)}const Rt="pi-web-ui:theme",un="dark",Ns="theme-stylesheet",Cs="pi-web-ui:theme-change";function pn(){try{const t=localStorage.getItem(Rt);if(t&&t!==un)return t}catch{}return null}function ir(t){try{t?localStorage.setItem(Rt,t):localStorage.removeItem(Rt)}catch{}}function mn(t){let s=document.getElementById(Ns);if(!t){s==null||s.remove(),window.dispatchEvent(new CustomEvent(Cs));return}s||(s=document.createElement("link"),s.id=Ns,s.rel="stylesheet",document.head.appendChild(s)),s.href=`/themes/${encodeURIComponent(t)}.css`,s.onload=()=>window.dispatchEvent(new CustomEvent(Cs))}async function ar(){try{const t=await fetch(ht("/api/themes"));if(!t.ok)return[];const s=await t.json();return Array.isArray(s.themes)?s.themes:[]}catch{return[]}}function rr(){const[t,s]=r.useState([]),[i,l]=r.useState(()=>pn());return r.useEffect(()=>{let a=!1;return ar().then(n=>{a||s(n)}),()=>{a=!0}},[]),r.useEffect(()=>{mn(i),ir(i)},[i]),{themes:t,theme:i,switchTheme:a=>l(a===un?null:a)}}function hr(){const t=getComputedStyle(document.documentElement),s=(i,l)=>t.getPropertyValue(i).trim()||l;return{background:s("--term-bg","#0b0d12"),foreground:s("--term-fg","#e6e8ef"),cursor:s("--term-cursor","#8b5cf6"),cursorAccent:s("--term-cursor-accent","#0b0d12"),selectionBackground:s("--term-selection","rgba(139, 92, 246, 0.35)"),black:s("--term-black","#1a1d26"),red:s("--term-red","#f87171"),green:s("--term-green","#34d399"),yellow:s("--term-yellow","#fbbf24"),blue:s("--term-blue","#60a5fa"),magenta:s("--term-magenta","#c084fc"),cyan:s("--term-cyan","#22d3ee"),white:s("--term-white","#e6e8ef"),brightBlack:s("--term-bright-black","#6b7284"),brightRed:s("--term-bright-red","#f87171"),brightGreen:s("--term-bright-green","#34d399"),brightYellow:s("--term-bright-yellow","#fbbf24"),brightBlue:s("--term-bright-blue","#60a5fa"),brightMagenta:s("--term-bright-magenta","#c084fc"),brightCyan:s("--term-bright-cyan","#22d3ee"),brightWhite:s("--term-bright-white","#ffffff")}}const lr=r.lazy(()=>Rs(()=>import("./TerminalPanel-m1Uq9P_a.js"),__vite__mapDeps([0,1,2,3,4])).then(t=>({default:t.TerminalPanel})));function or({notice:t,onDismiss:s}){const i=me(),[l,c]=r.useState(!1);r.useEffect(()=>{if(l)return;const n=setTimeout(()=>s(t.id),t.level==="error"?12e3:7e3);return()=>clearTimeout(n)},[l,t.id,t.level,s]);const a=t.level==="error"?ei:t.level==="warning"?Zn:Un;return e.jsxs("div",{className:`notice notice-${t.level}${l?" paused":""}`,role:"status",onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),children:[e.jsx(a,{className:"notice-icon"}),e.jsx("span",{className:"notice-text",children:t.text}),e.jsx("button",{type:"button",className:"notice-close",title:i("close"),onClick:()=>s(t.id),children:e.jsx(je,{})})]})}const cr=[],hn=180,gn=520,fn=240,xn=t=>`pi-web-ui:${t}-panel-width`;function Ss(t){const s=Number(localStorage.getItem(xn(t)));return Number.isFinite(s)&&s>=hn&&s<=gn?s:fn}function Ts({side:t,width:s,onResize:i}){const l=me(),c=r.useCallback(a=>{a.preventDefault();const n=a.clientX,o=s;let u=o;const p=g=>{const x=t==="left"?g.clientX-n:n-g.clientX;u=Math.min(gn,Math.max(hn,Math.round(o+x))),i(u)},h=()=>{window.removeEventListener("pointermove",p),window.removeEventListener("pointerup",h),document.body.classList.remove("panel-resizing"),localStorage.setItem(xn(t),String(u))};window.addEventListener("pointermove",p),window.addEventListener("pointerup",h),document.body.classList.add("panel-resizing")},[t,s,i]);return e.jsx("div",{className:`resize-handle resize-${t}`,title:l("dragToResize"),onPointerDown:c,onDoubleClick:()=>i(fn)})}function dr(){var xe,he,be,Ce,$t,At,_t,Ot,Wt,Ht,qt,Kt,Ut,zt;const t=me(),{chat:s,send:i,dismissNotice:l,pushNotice:c,terminal:a}=Ni(),[n,o]=r.useState([]),[u,p]=r.useState(null),[h,g]=r.useState(!1),[x,v]=r.useState("chat"),b=r.useMemo(()=>s.plugins.filter(B=>{var K,re;return!((re=(K=s.settings)==null?void 0:K.disabledPlugins)!=null&&re.includes(B.id))}),[s.plugins,(xe=s.settings)==null?void 0:xe.disabledPlugins]),[L,S]=r.useState([]);r.useEffect(()=>gi(S),[]),r.useEffect(()=>{fi(b,s.pluginsEpoch)},[b,s.pluginsEpoch]);const[F,k]=r.useState(()=>Ss("left")),[y,P]=r.useState(()=>Ss("right")),I=r.useCallback(B=>k(B),[]),E=r.useCallback(B=>P(B),[]),[j,m]=r.useState(null),[D,W]=r.useState(()=>window.matchMedia("(max-width: 768px)").matches);r.useEffect(()=>{const B=window.matchMedia("(max-width: 768px)"),K=re=>W(re.matches);return B.addEventListener("change",K),()=>B.removeEventListener("change",K)},[]);const[ee,X]=r.useState(!1),[O,H]=r.useState(!1),[R,C]=r.useState(!1),[N,U]=r.useState(!1),[_,q]=r.useState(!1);r.useEffect(()=>{const B=K=>{var Ie,Vt;const re=K.detail,ve=(re==null?void 0:re.title)||"插件命令",ye=re==null?void 0:re.command;if(!ye||!s.ready)return;const Ne={name:ve,command:ye,cwd:"${pwd}"},ke=s.terminals.find(ft=>ft.title===ve);if(ke)a.restart(ke.id),i({type:"run_command",terminalId:ke.id,conversationId:ke.conversationId,command:Ne,cols:80,rows:24});else{const ft=Be();a.create({id:ft,conversationId:s.activeConversationId||((Ie=s.state)==null?void 0:Ie.conversationId)||"",title:ve,cwd:((Vt=s.state)==null?void 0:Vt.cwd)??"",cols:80,rows:24,running:!0,exitCode:null,command:Ne})}v("terminal")};return window.addEventListener("pi-web-ui:plugin-run-command",B),()=>window.removeEventListener("pi-web-ui:plugin-run-command",B)},[s,a,i]),r.useEffect(()=>{const B=K=>{!(K.ctrlKey||K.metaKey)||K.key.toLowerCase()!=="k"||(K.preventDefault(),q(re=>!re))};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[]);const[w,Z]=r.useState(dn),{themes:te,theme:ue,switchTheme:A}=rr(),Q=r.useRef(null),oe=r.useRef(null),J=r.useRef(0),de=r.useRef(!1),ie=r.useRef(s.terminals);r.useEffect(()=>{Ya(w)},[w]),r.useEffect(()=>{var K;const B=ie.current;ie.current=s.terminals;for(const re of s.terminals){const ve=((K=re.command)==null?void 0:K.command)??"",ye=B.find(Ne=>Ne.id===re.id);!(ye!=null&&ye.running)||re.running||(ve.startsWith("pi remove ")?i({type:"extensions_reload"}):(ve.startsWith("pi-web-ui install ")||ve.startsWith("pi-web-ui uninstall "))&&i({type:"plugins_reload"}))}},[s.terminals,i]),r.useEffect(()=>{var re;const B=((re=s.state)==null?void 0:re.isStreaming)??!1,K=Q.current;Q.current=B,K!==null&&(!K&&B?Je("start",w):K&&!B&&Je("done",w))},[(he=s.state)==null?void 0:he.isStreaming,w]),r.useEffect(()=>{var K;const B=((K=s.dialog)==null?void 0:K.id)??null;B!==null&&B!==oe.current&&Je("question",w),oe.current=B},[s.dialog,w]),r.useEffect(()=>{const B=[...s.notices].reverse().find(K=>K.level==="error");B&&B.id!==J.current&&(J.current=B.id,Je("error",w))},[s.notices,w]);const d=(B,K,re,ve=!1,ye)=>{const Ne=`${B}|${re}|${ye?`${ye.start}-${ye.end}`:""}`;o(ke=>ke.some(Ie=>`${Ie.path}|${Ie.mode}|${Ie.lines?`${Ie.lines.start}-${Ie.lines.end}`:""}`===Ne)?ke:[...ke,{path:B,name:K,mode:re,isDir:ve,...ye?{lines:ye}:{}}])},M=B=>o(K=>K.filter(re=>re.key?re.key!==B:re.path!==B)),le=r.useCallback(B=>(!B.type.startsWith("list_")&&!B.type.startsWith("get_")&&m(null),i(B)),[i]),se=r.useRef(0),ge=r.useRef(0),Y=B=>{var ve;const K=Date.now();(ve=s.state)!=null&&ve.model&&!s.state.model.vision&&K-ge.current>1e4&&(ge.current=K,c("warning",t("imageNotSupported")));const re=`paste-${++se.current}`;o(ye=>[...ye,{path:"",key:re,name:B.name,mode:"inline",imageData:B.data,mimeType:B.mimeType}])},ce=async B=>{for(const K of B){const re=await Gs(K);if(!re){c("error",t("imageLoadFailed",{name:K.name}));continue}Y(re)}},fe=20*1024*1024,pe=r.useRef(0),Se=async B=>{if(B.size>fe){c("warning",t("fileTooLarge",{name:B.name,size:fe/1024/1024}));return}let K;try{K=(await new Promise((ye,Ne)=>{const ke=new FileReader;ke.onload=()=>ye(ke.result),ke.onerror=()=>Ne(ke.error??new Error("read failed")),ke.readAsDataURL(B)})).replace(/^data:[^;]*;base64,/,"")}catch{c("error",t("fileLoadFailed",{name:B.name}));return}const re=`upload-${++pe.current}`;o(ve=>[...ve,{path:"",key:re,name:B.name,mode:"inline",fileData:K,size:B.size,mimeType:B.type||void 0}])},Pe=async B=>{for(const K of B)Re(K.type)?await ce([K]):await Se(K)},ze=r.useCallback((B,K,re)=>{i({type:"edit_message",messageId:B,text:K,attachments:re})},[i]),Fe=r.useCallback(()=>H(!0),[]),_e=r.useCallback(()=>o([]),[]),Te=r.useCallback(M,[]),T=r.useCallback(ce,[ce]),$=r.useCallback(Pe,[Pe]),ne=(be=s.state)==null?void 0:be.model,ae=(Ce=s.state)==null?void 0:Ce.thinkingLevel,f=($t=s.state)==null?void 0:$t.availableThinkingLevels,G=r.useMemo(()=>ne?{model:ne,thinkingLevel:ae??"off",availableThinkingLevels:f??[]}:null,[ne,ae,f]),z=r.useCallback(()=>{var B,K;return!s.ready||s.terminals.length!==0?!1:(a.create({id:Be(),conversationId:s.activeConversationId||((B=s.state)==null?void 0:B.conversationId)||"",title:t("terminalTitle",{n:1}),cwd:((K=s.state)==null?void 0:K.cwd)??"",cols:80,rows:24,running:!0,exitCode:null}),!0)},[s.ready,(At=s.state)==null?void 0:At.cwd,s.terminals.length,t,a]);return r.useEffect(()=>{if(de.current){if(x!=="terminal"||s.terminals.length!==0){de.current=!1;return}z()&&(de.current=!1)}},[s.terminals.length,z,x]),e.jsxs("div",{className:"app",onDragOver:B=>{var K;Array.from(((K=B.dataTransfer)==null?void 0:K.types)??[]).includes("Files")&&(B.preventDefault(),g(!0))},onDragLeave:B=>{B.currentTarget.contains(B.relatedTarget)||g(!1)},onDrop:B=>{var ye,Ne;if(g(!1),!Array.from(((ye=B.dataTransfer)==null?void 0:ye.types)??[]).includes("Files"))return;B.preventDefault();const K=Array.from(((Ne=B.dataTransfer)==null?void 0:Ne.files)??[]);if(K.length===0){c("warning",t("foldersNotSupported"));return}const re=K.filter(ke=>Re(ke.type)),ve=K.filter(ke=>!Re(ke.type));re.length>0&&ce(re),ve.length>0&&Pe(ve)},children:[h&&e.jsx("div",{className:"app-drop-overlay","aria-hidden":!0,children:e.jsxs("span",{children:["📎 ",t("dropHereToAttach")]})}),e.jsx(ri,{chat:s,send:i,terminal:a,view:x,plugins:b,onViewChange:B=>{de.current=B==="terminal"&&s.terminals.length===0,de.current&&z()&&(de.current=!1),v(B),m(null)},onOpenPanel:m,onOpenSettings:()=>C(!0),onOpenBgTasks:()=>U(!0),onOpenGlobalSearch:()=>q(!0),sound:w,onSoundChange:Z,onSoundPreview:B=>Je(B,w),themes:te,theme:ue,onThemeChange:A}),s.protocolMismatch&&e.jsxs("div",{className:"protocol-banner",children:["⚠ ",t("protocolMismatch")]}),e.jsx("div",{className:"notices",children:s.notices.map(B=>e.jsx(or,{notice:B,onDismiss:l},B.id))}),e.jsx(xa,{send:i,children:e.jsxs("div",{className:"layout",style:{"--left-w":`${F}px`,"--right-w":`${y}px`},children:[j&&e.jsx("div",{className:"drawer-backdrop",onClick:()=>m(null)}),e.jsxs("div",{className:`view-pane ${x==="chat"?"":"hidden"}`,children:[e.jsx("div",{className:`panel-drawer drawer-left ${j==="left"?"open":""}`,children:e.jsx(oi,{send:le,active:!D||j==="left",ready:s.ready,status:s.status,cwd:((_t=s.state)==null?void 0:_t.cwd)??"",sessionFile:((Ot=s.state)==null?void 0:Ot.sessionFile)??null,conversations:s.conversations,sessions:s.sessions,projects:s.projects,activeConversationId:s.activeConversationId})}),!D&&e.jsx(Ts,{side:"left",width:F,onResize:I}),e.jsxs("main",{className:"main",children:[s.state?e.jsx(wa,{state:s.state,liveOutputs:s.liveOutputs,toolStatuses:s.toolStatuses,onEdit:ze,onKillBash:()=>i({type:"abort_bash"}),thinkingWrap:((Wt=s.settings)==null?void 0:Wt.thinkingWrap)??!0,toolsWrap:((Ht=s.settings)==null?void 0:Ht.toolsWrap)??!0},s.state.conversationId??"boot"):e.jsx("div",{className:"boot-wait",children:s.ready?t("loadingSession"):t("connectingServer")}),e.jsx(Ia,{send:i,goal:s.goal,models:s.models,modelsLoading:s.modelsLoading,activeConversationId:s.activeConversationId}),s.dialog&&e.jsx(Ba,{dialog:s.dialog,send:i}),e.jsx(Pa,{send:i,ready:s.ready,streaming:((qt=s.state)==null?void 0:qt.isStreaming)??!1,messages:((Kt=s.state)==null?void 0:Kt.messages)??cr,slashCommands:s.slashCommands,modelState:G,models:s.models,modelsLoading:s.modelsLoading,attachments:n,onRemoveAttachment:Te,onAddImageFiles:T,onAddLocalFiles:$,onNotice:c,onManageModels:Fe,onSent:_e})]}),!D&&e.jsx(Ts,{side:"right",width:y,onResize:E}),e.jsx("div",{className:`panel-drawer drawer-right ${j==="right"?"open":""}`,children:e.jsx(Li,{send:le,files:s.files,fileChanged:s.fileChanged,widgets:s.widgets,cwd:((Ut=s.state)==null?void 0:Ut.cwd)??"",onAttach:(B,K,re,ve)=>{m(null),d(B,K,re,ve)},onPreview:(B,K)=>{m(null),p({path:B,name:K})},onNotice:(B,K)=>c(B,K)})})]}),e.jsx("div",{className:`view-pane ${x==="terminal"?"":"hidden"}`,children:e.jsx(r.Suspense,{fallback:null,children:e.jsx(lr,{chat:s,send:i,terminal:a})})}),e.jsx("div",{className:`view-pane ${x==="git"?"":"hidden"}`,children:e.jsx($a,{chat:s,send:i,terminal:a,active:x==="git",onSwitchToTerminal:()=>v("terminal")})}),L.map(B=>{const K=`plugin:${B.info.id}`;return e.jsx("div",{className:`view-pane ${x===K?"":"hidden"}`,children:e.jsx(Aa,{entry:B,send:i})},B.info.id)})]})}),e.jsx(La,{chat:s,send:i}),u&&e.jsx(Ga,{file:u,content:s.fileContent,send:i,onAddLines:(B,K,re,ve)=>d(B,K,"lines",!1,{start:re,end:ve}),onAttach:(B,K,re)=>d(B,K,re),onClose:()=>p(null)}),s.ready&&s.state&&s.state.piConfigured===!1&&!ee&&!O&&e.jsx(_a,{send:i,piConfigured:s.state.piConfigured,piAgentInstalled:s.state.piAgentInstalled,providers:s.providers,installResult:s.installResult,onClose:()=>X(!0)}),O&&e.jsx(Ha,{send:i,providers:s.modelsConfig,providerStatus:s.providers,fetchModelsResult:s.fetchModelsResult,refreshProviderResult:s.refreshProviderResult,cloneProviderResult:s.cloneProviderResult,onClose:()=>H(!1)}),R&&e.jsx(Ka,{chat:s,send:i,terminal:a,onSwitchToTerminal:()=>v("terminal"),onClose:()=>C(!1)}),N&&e.jsx(za,{servers:s.bgServers,send:i,onClose:()=>U(!1)}),_&&e.jsx(Va,{send:i,sessions:s.sessions,projects:s.projects,cwd:((zt=s.state)==null?void 0:zt.cwd)??"",fileSearch:s.fileSearch,onClose:()=>q(!1),onSwitchSession:B=>{i({type:"switch_session",path:B})},onSwitchProject:B=>{i({type:"set_cwd",path:B})},onPreviewFile:(B,K)=>{p({path:B,name:K})}})]})}ci();mn(pn());bn.createRoot(document.getElementById("root")).render(e.jsx(r.StrictMode,{children:e.jsx(ii,{children:e.jsx(dr,{})})}));export{dt as F,Cs as T,De as a,hr as b,mr as c,Ct as d,Me as e,je as f,On as g,qe as h,Be as r,me as u};
|
package/web/dist/index.html
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
<meta name="color-scheme" content="dark" />
|
|
7
7
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
8
8
|
<title>pi-web-ui — pi 编码智能体</title>
|
|
9
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
+
<script type="module" crossorigin src="/assets/index-Dg-bQ98a.js"></script>
|
|
10
10
|
<link rel="modulepreload" crossorigin href="/assets/markdown-DRBrS2Nf.js">
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/react-C9ovnpIm.js">
|
|
12
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
12
|
+
<link rel="stylesheet" crossorigin href="/assets/index-B8YOHfUN.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
|
15
15
|
<div id="root"></div>
|