@tryglen/review 0.2.5 → 0.2.6

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.
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-shell-Cnt0r4V7.js","assets/rolldown-runtime-XKyaHtl9.js","assets/button-DizkG3Et.js","assets/bundle-mjs-IMkwHZOK.js","assets/reviewer-connection-B1irBiYS.js","assets/terminal-shell-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{c as t,l as n,t as r}from"./button-DizkG3Et.js";import{S as i,n as a,r as o,t as s,w as c}from"./query-error-DAke5it8.js";import{a as l,o as u}from"./bundle-mjs-IMkwHZOK.js";import{l as d}from"./schemas-BCcEJklu.js";import{P as f,R as p,U as m,V as h,o as g}from"./card-DKSHVMIl.js";import{a as _}from"./reviewer-connection-B1irBiYS.js";import{_ as v,c as y,d as b,f as x,i as S,l as C,o as w,p as T,r as E,s as ee,t as te,u as ne}from"./command-CNdHAw1i.js";import{o as re}from"./input-group-U_GsVv_E.js";import{_ as ie,a as ae,c as oe,d as se,f as ce,g as le,h as ue,i as de,l as fe,m as pe,n as me,o as he,p as ge,r as _e,s as ve,t as ye,u as be,v as xe,y as Se}from"./agent-list-query-DpS41IBK.js";import{t as Ce}from"./preload-helper-B0Qg_vqV.js";import{F as we,I as Te,M as Ee,Ot as D,P as De,Tt as Oe,V as ke,a as Ae,bt as je,i as Me,n as Ne,r as O}from"./index-4Oe9F1aD.js";var k=e(u(),1),Pe=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M72.5,150.63,100.79,128,72.5,105.37a12,12,0,1,1,15-18.74l40,32a12,12,0,0,1,0,18.74l-40,32a12,12,0,0,1-15-18.74ZM144,172h32a12,12,0,0,0,0-24H144a12,12,0,0,0,0,24ZM236,56V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V196H212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm-91,94.25-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32a8,8,0,0,1,0,12.5ZM176,168H136a8,8,0,0,1,0-16h40a8,8,0,0,1,0,16Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M126,128a6,6,0,0,1-2.25,4.69l-40,32a6,6,0,0,1-7.5-9.38L110.4,128,76.25,100.69a6,6,0,1,1,7.5-9.38l40,32A6,6,0,0,1,126,128Zm50,26H136a6,6,0,0,0,0,12h40a6,6,0,0,0,0-12Zm54-98V200a14,14,0,0,1-14,14H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V200a2,2,0,0,0,2,2H216a2,2,0,0,0,2-2Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M122.5,124.88a4,4,0,0,1,0,6.24l-40,32a4,4,0,0,1-5-6.24L113.6,128,77.5,99.12a4,4,0,0,1,5-6.24ZM176,156H136a4,4,0,0,0,0,8h40a4,4,0,0,0,0-8ZM228,56V200a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H216a4,4,0,0,0,4-4Z`}))]]),Fe=k.forwardRef((e,n)=>k.createElement(t,{ref:n,...e,weights:Pe}));Fe.displayName=`TerminalWindowIcon`;var Ie=24,A={start:{top:0,gap:0,pinned:!0,unseen:!1},scrolled:(e,t)=>{let n=t.top<e.top?t.gap<=1:e.pinned||t.gap<=Ie;return{...t,pinned:n,unseen:!n&&e.unseen}},grew:(e,t)=>e.pinned?{state:{...e,unseen:!1},toBottom:!0}:{state:{...e,gap:t.gap,unseen:e.unseen||t.gap>e.gap+1},toBottom:!1},pin:e=>({state:{...e,pinned:!0,unseen:!1},toBottom:!0})},Le=(e,t,n)=>{let r=t?document.scrollingElement:e.parentElement;if(!r)return{pin:()=>void 0,stop:()=>void 0};let i=()=>t?0:r.getBoundingClientRect().top,a=()=>({top:r.scrollTop,gap:r.scrollHeight-r.scrollTop-r.clientHeight}),o=()=>{let t=Array.from(e.children).find(e=>e.getBoundingClientRect().bottom>i());return t?{row:t,offset:t.getBoundingClientRect().top-i()}:null},s={state:A.start,anchor:o()},c=()=>{s.anchor=o(),n(s.state.unseen)},l=({state:e,toBottom:t})=>{t&&(r.scrollTop=r.scrollHeight),s.state=t?{...e,...a()}:e,c()},u=()=>{s.state=A.scrolled(s.state,a()),c()},d=()=>{let e=s.anchor;if(s.state.pinned||!e?.row.isConnected)return;let t=e.row.getBoundingClientRect().top-i()-e.offset;t!==0&&(r.scrollTop+=t)},f=new ResizeObserver(()=>{d(),l(A.grew(s.state,a()))}),p=t?window:r;return f.observe(e),p.addEventListener(`scroll`,u,{passive:!0}),{pin:()=>l(A.pin(s.state)),stop:()=>{f.disconnect(),p.removeEventListener(`scroll`,u)}}},j=l();function Re({sent:e,page:t=!1,className:i,emptyState:a,footer:o,bottomContent:s,bottomClassName:c,children:l}){let[u,d]=(0,k.useState)(!1),f=(0,k.useRef)(null),[p]=(0,k.useState)(()=>e=>{if(!e)return;let n=Le(e,t,d);return f.current=n,()=>{n.stop(),f.current=null}});(0,k.useLayoutEffect)(()=>f.current?.pin(),[e]);let m=(0,j.jsxs)(`div`,{ref:p,className:n(`flex flex-col`,i),children:[a,l,o]});return(0,j.jsxs)(j.Fragment,{children:[t?m:(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:m}),(0,j.jsxs)(`div`,{className:n(`relative shrink-0`,c),children:[u?(0,j.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full flex justify-center pb-2`,children:(0,j.jsxs)(r,{size:`sm`,variant:`secondary`,className:`pointer-events-auto shadow-md`,onClick:()=>f.current?.pin(),children:[(0,j.jsx)(v,{}),`Jump to latest`]})}):null,s]})]})}var ze=({contextItems:e,onRemoveContextItem:t,onClearContextItems:n})=>e.length===0?null:(0,j.jsxs)(`div`,{className:`border-edge bg-muted/50 flex flex-wrap gap-1.5 border-t px-3 py-2`,children:[e.map(e=>(0,j.jsx)(pe,{item:e,onRemove:t},e.id)),(0,j.jsx)(r,{variant:`ghost`,size:`xs`,className:`ml-auto`,onClick:n,children:(0,j.jsxs)(`span`,{className:`text-muted-foreground group-hover/button:text-foreground group-focus-visible/button:text-foreground contents`,children:[(0,j.jsx)(o,{className:`size-3.5`}),`Clear all`]})})]});function M(e){return Array.isArray?Array.isArray(e):We(e)===`[object Array]`}function Be(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function N(e){return e==null?``:Be(e)}function P(e){return typeof e==`string`}function F(e){return typeof e==`number`}function Ve(e){return e===!0||e===!1||Ue(e)&&We(e)==`[object Boolean]`}function He(e){return typeof e==`object`}function Ue(e){return He(e)&&e!==null}function I(e){return e!=null}function L(e){return!e.trim().length}function We(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Ge=`Incorrect 'index' type`,R=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,Ke=e=>`Invalid value for key ${e}`,qe=e=>`Pattern length exceeds max of ${e}.`,Je=e=>`Missing ${e} property in key`,Ye=e=>`Property 'weight' in key '${e}' must be a positive integer`,Xe=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,Ze=Object.prototype.hasOwnProperty,Qe=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=$e(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function $e(e){let t=null,n=null,r=null,i=1,a=null;if(P(e)||M(e))r=e,t=et(e),n=z(e);else{if(!Ze.call(e,`name`))throw Error(Je(`name`));let o=e.name;if(r=o,Ze.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(Ye(z(o)));t=et(o),n=z(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function et(e){return M(e)?e:e.split(`.`)}function z(e){return M(e)?e.join(`.`):e}function tt(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(I(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!I(s))return;if(a===t.length-1&&(P(s)||F(s)||Ve(s)||typeof s==`bigint`))n.push(o===void 0?N(s):{v:N(s),i:o});else if(M(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}}};return i(e,P(t)?t.split(`.`):t,0),r?n:n[0]}var nt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},rt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},it={location:0,threshold:.6,distance:100},at={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:tt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},B=Object.freeze({...rt,...nt,...it,...at});function ot(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=1,a=!1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===32?a||=(i++,!0):a=!1;if(n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var V=class{constructor({getFn:e=B.getFn,fieldNormWeight:t=B.fieldNormWeight}={}){this.norm=ot(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(P(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(R);if(P(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(R);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!I(e)||L(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(I(i)){if(M(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(I(n)){if(P(n)){if(!L(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(I(n.v)){let t=P(n.v)?n.v:N(n.v);if(!L(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(P(i)&&!L(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function st(e,t,{getFn:n=B.getFn,fieldNormWeight:r=B.fieldNormWeight}={}){let i=new V({getFn:n,fieldNormWeight:r});return i.setKeys(e.map($e)),i.setSources(t),i.create(),i}function ct(e,{getFn:t=B.getFn,fieldNormWeight:n=B.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new V({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function lt(e=[],t=B.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}var H=32;function ut(e,t,n,{location:r=B.location,distance:i=B.distance,threshold:a=B.threshold,findAllMatches:o=B.findAllMatches,minMatchCharLength:s=B.minMatchCharLength,includeMatches:c=B.includeMatches,ignoreLocation:l=B.ignoreLocation}={}){if(t.length>H)throw Error(qe(H));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=lt(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function dt(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function U(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var ft={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},pt=RegExp(`[`+Object.keys(ft).join(``)+`]`,`g`),W=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(pt,e=>ft[e]):e=>e,G=class{constructor(e,{location:t=B.location,threshold:n=B.threshold,distance:r=B.distance,includeMatches:i=B.includeMatches,findAllMatches:a=B.findAllMatches,minMatchCharLength:o=B.minMatchCharLength,isCaseSensitive:s=B.isCaseSensitive,ignoreDiacritics:c=B.ignoreDiacritics,ignoreLocation:l=B.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?W(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:dt(e),startIndex:t})},d=this.pattern.length;if(d>H){let e=0,t=d%H,n=d-t;for(;e<n;)u(this.pattern.substr(e,H),e),e+=H;if(t){let e=d-H;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?W(e):e,this.pattern===e){let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=ut(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=U(u)),p}},mt=new Set([`fuzzy`,`include`]);function ht(e){return e.startsWith(`inverse`)}var K=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new G(e,{location:t.location??B.location,threshold:t.threshold??B.threshold,distance:t.distance??B.distance,includeMatches:t.includeMatches??B.includeMatches,findAllMatches:t.findAllMatches??B.findAllMatches,minMatchCharLength:t.minMatchCharLength??B.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??B.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??B.ignoreDiacritics,ignoreLocation:t.ignoreLocation??B.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],gt=K.length,_t=`\0`,vt=`|`;function yt(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function bt(e,t){let n=e.match(t);return n?n[1]:null}function xt(e,t={}){return e.replace(/\\\|/g,_t).split(vt).map(e=>{let n=yt(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<gt;){let e=K[o],n=bt(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<gt;){let e=K[o],n=bt(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var St=class{constructor(e,{isCaseSensitive:t=B.isCaseSensitive,ignoreDiacritics:n=B.ignoreDiacritics,includeMatches:r=B.includeMatches,minMatchCharLength:i=B.minMatchCharLength,ignoreLocation:a=B.ignoreLocation,findAllMatches:o=B.findAllMatches,location:s=B.location,threshold:c=B.threshold,distance:l=B.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?W(e):e,this.pattern=e,this.query=xt(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?W(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,ht(r.type)&&(c=!0),n&&(mt.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=U(o)),e}}return{isMatch:!1,score:1}}},q=[];function J(...e){q.push(...e)}function Y(e,t){for(let n=0,r=q.length;n<r;n+=1){let r=q[n];if(r.condition(e,t))return new r(e,t)}return new G(e,t)}var X={AND:`$and`,OR:`$or`},Z={PATH:`$path`,PATTERN:`$val`},Ct=e=>!!(e[X.AND]||e[X.OR]),wt=e=>!!e[Z.PATH],Tt=e=>!M(e)&&He(e)&&!Ct(e),Et=e=>({[X.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Dt(e,t,{auto:n=!0}={}){let r=e=>{if(P(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=Y(e,t)),r}let i=Object.keys(e),a=wt(e);if(!a&&i.length>1&&!Ct(e))return r(Et(e));if(Tt(e)){let r=a?e[Z.PATH]:i[0],o=a?e[Z.PATTERN]:e[r];if(!P(o))throw Error(Ke(r));let s={keyId:z(r),pattern:o};return n&&(s.searcher=Y(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];M(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return Ct(e)||(e=Et(e)),r(e)}function Ot(e,{ignoreFieldNorm:t=B.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function kt(e,{ignoreFieldNorm:t=B.ignoreFieldNorm}){e.forEach(e=>{e.score=Ot(e.matches,{ignoreFieldNorm:t})})}var At=class{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):e.score<this.heap[0].score&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(t[e].score<=t[n].score)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&t[i].score>t[r].score&&(r=i),a<n&&t[a].score>t[r].score&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function jt(e){let t=[];return e.matches.forEach(e=>{if(!I(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function Mt(e,t,{includeMatches:n=B.includeMatches,includeScore:r=B.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=jt(e)),r&&(a.score=e.score),a})}var Nt=/[\p{L}\p{M}\p{N}_]+/gu,Pt=new WeakSet;function Ft(e){Pt.has(e)||(Pt.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function It(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||Ft(e),t=>t.match(e)||[]):e=>e.match(Nt)||[]}function Lt({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=It(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=W(n)),r(n)}}}var Rt=31,zt=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=Lt({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new G(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=Rt}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=U(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function Q(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function Bt(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)Q(e,a,i,r);else if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)Q(e,t.v,i,r);else Q(e,n.v,i,r)}}}function Vt(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)Bt(r,i,t,n);return r}function Ht(e,t,n,r){Bt(e,t,n,r)}function Ut(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function Wt(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)Ut(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var $=class{constructor(e,t,n){this.options={...B,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new Qe(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=Y(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof V))throw Error(Ge);if(this._myIndex=t||st(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=Lt({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=Vt(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!I(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=Lt({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});Ht(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&Wt(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(R);this._invertedIndex&&Wt(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(P(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return F(n)&&n>-1&&(e=e.slice(0,n)),e}let c=F(n)&&n>0&&P(e),l;if(c){let t=new At(n);P(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),l=t.extractSorted(o)}else l=P(e)?P(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),kt(l,{ignoreFieldNorm:s}),a&&l.sort(o),F(n)&&n>-1&&(l=l.slice(0,n));return Mt(l,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!I(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=Ot(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=Dt(e,this.options),n=(e,t,r)=>{if(!(`children`in e)){let{keyId:n,searcher:i}=e,a;return n===null?(a=[],this._myIndex.keys.forEach((e,n)=>{a.push(...this._findMatches({key:e,value:t[n],searcher:i}))})):a=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:i}),a&&a.length?[{idx:r,item:t,matches:a}]:[]}let{children:i,operator:a}=e,o=[];for(let e=0,s=i.length;e<s;e+=1){let s=i[e],c=n(s,t,r);if(c.length)o.push(...c);else if(a===X.AND)return[]}return o},r=this._myIndex.records,i=new Map,a=[];return r.forEach(({$:e,i:r})=>{if(I(e)){let o=n(t,e,r);o.length&&(i.has(r)||(i.set(r,{idx:r,item:e,matches:[]}),a.push(i.get(r))),o.forEach(({matches:e})=>{i.get(r).matches.push(...e)}))}}),a}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{keys:a,records:o}=this._myIndex,s=t?null:[];return o.forEach(({$:e,i:o})=>{if(!I(e))return;let c=[],l=!1,u=!1;if(a.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:o,item:e,matches:c};t?(r.score=Ot(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!I(t))return[];let r=[];if(M(t))t.forEach(({v:t,i,n:a})=>{if(!I(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=Rt){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};$.version=`7.4.0`,$.createIndex=st,$.parseIndex=ct,$.config=B,$.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(Xe);return Y(e,{...B,...n}).searchIn(t)},$.parseQuery=Dt,J(St),J(zt),$.use=function(...e){e.forEach(e=>J(e))};var Gt=e=>e.kind===`selection`||e.kind===`symbol`?(0,j.jsx)(re,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`file`?(0,j.jsx)(xe,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`pr-description`?(0,j.jsx)(je,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`check`?(0,j.jsx)(Se,{className:`text-muted-foreground size-3.5 shrink-0`}):(0,j.jsx)(p,{className:`text-muted-foreground size-3.5 shrink-0`}),Kt=(e,t)=>e===`Comments`&&t.comments===`pending`?`Comments (loading...)`:e===`Comments`&&t.comments===`error`?`Comments (unavailable)`:e===`Checks`&&t.checks===`pending`?`Checks (loading...)`:e===`Checks`&&t.checks===`error`?`Checks (unavailable)`:e===`Symbols`&&t.symbols===`pending`?`Symbols (loading...)`:e===`Symbols`&&t.symbols===`error`?`Symbols (unavailable)`:e,qt=({mentionGroups:e,contextGroups:t,onSelectCandidate:n})=>{let r=new Set(e.map(e=>e.group)),i=[`Comments`,`Checks`,`Symbols`].filter(e=>r.has(e)?!1:e===`Comments`?t.comments!==`idle`:e===`Checks`?t.checks!==`idle`:t.symbols!==`idle`);return(0,j.jsx)(`div`,{className:`border-edge bg-popover absolute right-2 bottom-full left-2 mb-2 rounded-lg border shadow-sm`,children:(0,j.jsx)(te,{shouldFilter:!1,children:(0,j.jsxs)(ee,{children:[(0,j.jsx)(E,{children:`No matching context.`}),e.map(e=>(0,j.jsx)(S,{heading:Kt(e.group,t),children:e.items.map(e=>(0,j.jsxs)(w,{value:e.item.id,onSelect:()=>n(e),children:[Gt(e.item),(0,j.jsx)(`span`,{className:`truncate`,children:e.label}),e.detail?(0,j.jsx)(`span`,{className:`text-muted-foreground truncate text-xs`,children:e.detail}):null]},e.item.id))},e.group)),i.map(e=>(0,j.jsx)(S,{heading:Kt(e,t)},e))]})})})},Jt=/(^|\s)@([^\s@]*)$/,Yt=({contextItems:e,contextCandidates:t,contextGroups:n,busy:r,blocked:i,onAsk:a,onStop:o,onAddContextItem:s,onContextIntent:c})=>{let[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(0),p=(0,k.useId)(),m=(0,k.useRef)(!1),h=Jt.exec(l.slice(0,d)),g=h?.[2]??null,_=h?{query:g??``,start:d-(g?.length??0)-1}:null,v=(e,t)=>{let n=Jt.test(e.slice(0,t));n&&!m.current&&c(),m.current=n},y=new Set(e.map(e=>e.id)),b=t.filter(e=>!y.has(e.item.id)),x=_?.query?new $(b,{keys:[`label`,`detail`,`searchText`,`group`],threshold:.3,ignoreLocation:!0}).search(_.query).map(e=>e.item).slice(0,12):b.slice(0,12),S=[`PR`,`Files`,`Comments`,`Checks`,`Symbols`].flatMap(e=>{let t=x.filter(t=>t.group===e);return t.length===0?[]:[{group:e,items:t}]}),C=()=>{a(l)&&(u(``),f(0),m.current=!1)},w=e=>{if(!_)return;s(e.item);let t=l.slice(0,_.start)+l.slice(d);u(t),m.current=!1,v(t,_.start),requestAnimationFrame(()=>{let e=document.getElementById(p);e?.focus(),e?.setSelectionRange(_.start,_.start),f(_.start)})},T=e=>{f(e),v(l,e)};return(0,j.jsxs)(j.Fragment,{children:[_&&(0,j.jsx)(qt,{mentionGroups:S,contextGroups:n,onSelectCandidate:w}),(0,j.jsx)(ie,{id:p,value:l,onValueChange:(e,t)=>{u(e),f(t),v(e,t)},onClick:e=>T(e.currentTarget.selectionStart??0),onSelect:e=>T(e.currentTarget.selectionStart??0),onEnter:()=>{let e=_?x[0]:void 0;e?w(e):C()},onSend:C,onStop:o,busy:r,canSend:!i&&l.trim().length>0,placeholder:e.length>0?`Ask about this PR and context...`:`Ask about this PR...`})]})},Xt=({chatId:e,agent:t,label:n,context:r,onSignIn:i})=>{let a=me(e),o=(0,k.useSyncExternalStore)(a.subscribe,a.getSnapshot),s=D({mutationFn:t=>g.local.agent.prompt.mutate({chatId:e,...t}),onError:e=>_.error(e.message)}),c=D({mutationFn:()=>g.local.agent.cancel.mutate({chatId:e}),onError:e=>_.error(e.message)}),l=D({mutationFn:()=>g.local.agent.restart.mutate({chatId:e}),onError:e=>_.error(e.message)}),u=o.busy||s.isPending;return(0,j.jsx)(Re,{sent:o.rows.filter(e=>e.type===`user`).length,className:`min-h-full gap-3 p-3`,emptyState:o.rows.length===0?(0,j.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4 text-center`,children:(0,j.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Ask `,n,` about this PR. It reads the worktree; select diff lines with `,(0,j.jsx)(y,{keys:[`mod`,`L`]}),` or type @ to add context.`]})}):null,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ue,{label:o.status===`starting`?`Starting ${n}`:`${n} is working`,thinking:u}),o.status===`failed`||o.status===`closed`?(0,j.jsx)(le,{message:o.status===`failed`?`${n} didn't start`:`${n} stopped`,detail:o.reason??void 0,onRetry:()=>l.mutate(),retryDisabled:l.isPending}):null,o.status===`failed`&&o.signIn?(0,j.jsx)(`div`,{children:(0,j.jsx)(ge,{agent:t,label:n,onSignIn:i})}):null,(0,j.jsx)(_e,{chatId:e,queue:o.queue})]}),bottomContent:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ze,{contextItems:r.contextItems,onRemoveContextItem:r.removeContextItem,onClearContextItems:r.clearContextItems}),(0,j.jsx)(`div`,{className:`border-edge relative border-t p-2`,children:(0,j.jsx)(Yt,{contextItems:r.contextItems,contextCandidates:r.contextCandidates,contextGroups:r.contextGroups,busy:u,blocked:!1,onAsk:e=>{let t=e.trim();return t?(s.mutate({text:t,contextItems:r.contextItems}),r.clearContextItems(),!0):!1},onStop:()=>c.mutate(),onAddContextItem:r.addContextItem,onContextIntent:r.onContextIntent})})]}),children:o.rows.map(r=>(0,j.jsx)(ce,{chatId:e,agent:t,label:n,row:r,onSignIn:i},r.id))})},Zt=({chatId:e,agent:t,context:n,onSettled:r,onSignIn:i})=>t.available?(0,j.jsx)(Xt,{chatId:e,agent:t.id,label:t.label,context:n,onSignIn:i},`${e}:${t.id}`):(0,j.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,j.jsx)(be,{agents:[t],onSettled:r,onSignIn:i})}),Qt=({chats:e,current:t,onPick:n})=>{let i=D({mutationFn:e=>g.local.agent.close.mutate({chatId:e}),onError:e=>_.error(e.message)});return(0,j.jsxs)(Ee,{children:[(0,j.jsx)(ke,{asChild:!0,children:(0,j.jsxs)(r,{size:`sm`,variant:`ghost`,"aria-label":`Chats`,className:`max-w-48 min-w-0 shrink`,children:[(0,j.jsx)(ae,{agent:t.agent,className:`size-3.5`}),(0,j.jsx)(`span`,{className:`truncate`,children:t.title}),t.busy?(0,j.jsx)(f,{}):null,(0,j.jsx)(h,{})]})}),(0,j.jsxs)(De,{align:`start`,className:`w-72`,children:[(0,j.jsx)(Te,{children:`Chats`}),e.map(e=>(0,j.jsxs)(we,{onSelect:()=>n(e.id),className:`pr-0.5`,children:[(0,j.jsx)(ae,{agent:e.agent,className:`size-3.5`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.busy?(0,j.jsx)(f,{}):null,e.queued>0?(0,j.jsx)(d,{variant:`secondary`,title:`Queued messages`,children:e.queued}):null,(0,j.jsx)(r,{size:`icon-xs`,variant:`ghost`,"aria-label":`Close ${e.title}`,disabled:i.isPending&&i.variables===e.id,onClick:t=>{t.stopPropagation(),i.mutate(e.id)},children:(0,j.jsx)(o,{})})]},e.id))]})]})},$t=2e3,en=(0,k.lazy)(()=>Ce(()=>import(`./terminal-shell-Cnt0r4V7.js`).then(e=>({default:e.TerminalShell})),__vite__mapDeps([0,1,2,3,4,5]))),tn=()=>(0,j.jsx)(`div`,{className:`flex-1 p-2`,children:(0,j.jsx)(a,{className:`h-full w-full`})}),nn=e=>{let t=i({queryKey:[`local`,`addon`,`status`,`terminal`],queryFn:()=>g.local.addon.status.query({addon:`terminal`}),refetchInterval:e=>e.state.data?.state===`installing`&&$t});return t.isPending?(0,j.jsx)(tn,{}):t.isError?(0,j.jsx)(`div`,{className:`p-3`,children:(0,j.jsx)(s,{message:`Couldn't check the terminal.`,refetch:()=>void t.refetch()})}):t.data.state===`installed`?(0,j.jsx)(k.Suspense,{fallback:(0,j.jsx)(tn,{}),children:(0,j.jsx)(en,{...e})}):(0,j.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,j.jsx)(m,{variant:`quiet`,size:`sm`,title:`Set up the terminal`,description:t.data.error??`The terminal installs the first time you use it: a shell in the PR worktree.`,action:(0,j.jsx)(se,{addon:`terminal`,label:`the terminal`,status:t.data,onSettled:()=>void t.refetch()})})})},rn=({context:e})=>{let t=c(),n=(0,k.useSyncExternalStore)(O.subscribe,O.getSnapshot),a=(0,k.useSyncExternalStore)(Ae.subscribe,Ae.getSnapshot),o=i(ye()),l=D({mutationFn:e=>g.local.agent.create.mutate({agent:e,placement:{kind:`panel`}}),onSuccess:e=>O.showChat(e.id),onError:e=>_.error(e.message)}),u=D({mutationFn:e=>g.local.agent.setAgent.mutate(e),onError:e=>_.error(e.message)}),d=a?.filter(e=>e.placement.kind===`panel`)??[],p=d.find(e=>e.id===n.chatId)??d[0],m=p?o.data?.find(e=>e.id===p.agent):void 0,h=o.data?Me(o.data,a?.[0]?.agent??null)?.id:void 0,v=a!==null&&d.length===0,{mutate:y,isPending:S,isError:w}=l;(0,k.useEffect)(()=>{v&&h&&!S&&!w&&y(h)},[v,h,S,w,y]);let E=()=>void o.refetch();return(0,j.jsx)(`div`,{className:`relative h-full`,children:(0,j.jsxs)(he,{value:n.tab,onValueChange:e=>O.showTab(e===`terminal`?`terminal`:`agent`),className:`absolute inset-0 flex min-h-0 flex-col gap-0`,children:[(0,j.jsxs)(`div`,{className:`border-edge @container flex shrink-0 items-center gap-2 border-b p-2`,children:[(0,j.jsxs)(oe,{children:[(0,j.jsxs)(fe,{value:`agent`,"aria-label":`Agent`,children:[(0,j.jsx)(Oe,{}),(0,j.jsx)(`span`,{className:`hidden @xs:inline`,children:`Agent`})]}),(0,j.jsxs)(fe,{value:`terminal`,"aria-label":`Terminal`,children:[(0,j.jsx)(Fe,{}),(0,j.jsx)(`span`,{className:`hidden @xs:inline`,children:`Terminal`})]})]}),n.tab===`agent`&&o.data&&p?(0,j.jsx)(Qt,{chats:d,current:p,onPick:O.showChat}):null,n.tab===`agent`&&o.data&&p?(0,j.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,j.jsx)(de,{agents:o.data,value:p.agent,onValueChange:e=>{p&&e!==p.agent&&(p.turns===0&&p.queued===0&&!p.busy?u.mutate({chatId:p.id,agent:e}):l.mutate(e))},disabled:u.isPending}),(0,j.jsx)(b,{children:(0,j.jsxs)(C,{children:[(0,j.jsx)(x,{asChild:!0,children:(0,j.jsx)(r,{size:`icon-sm`,variant:`ghost`,"aria-label":`New chat`,disabled:l.isPending,onClick:()=>l.mutate(p.agent),children:l.isPending?(0,j.jsx)(f,{}):(0,j.jsx)(T,{})})}),(0,j.jsx)(ne,{side:`bottom`,children:`New chat`})]})})]}):null]}),(0,j.jsx)(ve,{value:`agent`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:o.isError?(0,j.jsx)(`div`,{className:`p-3`,children:(0,j.jsx)(s,{message:`Couldn't list the agents.`,refetch:E})}):!p&&w&&h?(0,j.jsx)(`div`,{className:`p-3`,children:(0,j.jsx)(s,{message:`Couldn't start a chat.`,refetch:()=>l.mutate(h)})}):!p||!m?(0,j.jsx)(Ne,{}):(0,j.jsx)(Zt,{chatId:p.id,agent:m,context:e,onSettled:E,onSignIn:(e,t)=>O.signIn(e,t,p.id)})}),(0,j.jsx)(ve,{value:`terminal`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:n.terminalOpened?(0,j.jsx)(nn,{signIn:n.signIn,onSignInExit:e=>{let r=n.signIn;r&&e===0&&(t.invalidateQueries({queryKey:ye().queryKey}),O.showTab(`agent`),g.local.agent.restart.mutate({chatId:r.chatId}).catch(e=>_.error(e.message)))},onRestart:O.clearSignIn}):null})]})})};export{rn as LocalSidePanel};
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{c as t,l as n,t as r}from"./button-DizkG3Et.js";import{S as i,n as a,r as o,t as s,w as c}from"./query-error-DAke5it8.js";import{a as l,o as u}from"./bundle-mjs-IMkwHZOK.js";import{l as d}from"./schemas-BCcEJklu.js";import{P as f,R as p,U as m,V as h,o as g}from"./card-DKSHVMIl.js";import{a as _}from"./reviewer-connection-B1irBiYS.js";import{_ as v,c as y,d as b,f as x,i as S,l as C,o as w,p as T,r as E,s as ee,t as te,u as ne}from"./command-CgTrYgTX.js";import{o as re}from"./input-group-U_GsVv_E.js";import{_ as ie,a as ae,c as oe,d as se,f as ce,g as le,h as ue,i as de,l as fe,m as pe,n as me,o as he,p as ge,r as _e,s as ve,t as ye,u as be,v as xe,y as Se}from"./agent-list-query-BMjRH3m5.js";import{t as Ce}from"./preload-helper-B0Qg_vqV.js";import{F as we,I as Te,M as Ee,Ot as D,P as De,Tt as Oe,V as ke,a as Ae,bt as je,i as Me,n as Ne,r as O}from"./index-DKOFiQ-E.js";var k=e(u(),1),Pe=new Map([[`bold`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M72.5,150.63,100.79,128,72.5,105.37a12,12,0,1,1,15-18.74l40,32a12,12,0,0,1,0,18.74l-40,32a12,12,0,0,1-15-18.74ZM144,172h32a12,12,0,0,0,0-24H144a12,12,0,0,0,0,24ZM236,56V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V196H212Z`}))],[`duotone`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z`,opacity:`0.2`}),k.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`fill`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm-91,94.25-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32a8,8,0,0,1,0,12.5ZM176,168H136a8,8,0,0,1,0-16h40a8,8,0,0,1,0,16Z`}))],[`light`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M126,128a6,6,0,0,1-2.25,4.69l-40,32a6,6,0,0,1-7.5-9.38L110.4,128,76.25,100.69a6,6,0,1,1,7.5-9.38l40,32A6,6,0,0,1,126,128Zm50,26H136a6,6,0,0,0,0,12h40a6,6,0,0,0,0-12Zm54-98V200a14,14,0,0,1-14,14H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V200a2,2,0,0,0,2,2H216a2,2,0,0,0,2-2Z`}))],[`regular`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`thin`,k.createElement(k.Fragment,null,k.createElement(`path`,{d:`M122.5,124.88a4,4,0,0,1,0,6.24l-40,32a4,4,0,0,1-5-6.24L113.6,128,77.5,99.12a4,4,0,0,1,5-6.24ZM176,156H136a4,4,0,0,0,0,8h40a4,4,0,0,0,0-8ZM228,56V200a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H216a4,4,0,0,0,4-4Z`}))]]),Fe=k.forwardRef((e,n)=>k.createElement(t,{ref:n,...e,weights:Pe}));Fe.displayName=`TerminalWindowIcon`;var Ie=24,A={start:{top:0,gap:0,pinned:!0,unseen:!1},scrolled:(e,t)=>{let n=t.top<e.top?t.gap<=1:e.pinned||t.gap<=Ie;return{...t,pinned:n,unseen:!n&&e.unseen}},grew:(e,t)=>e.pinned?{state:{...e,unseen:!1},toBottom:!0}:{state:{...e,gap:t.gap,unseen:e.unseen||t.gap>e.gap+1},toBottom:!1},pin:e=>({state:{...e,pinned:!0,unseen:!1},toBottom:!0})},Le=(e,t,n)=>{let r=t?document.scrollingElement:e.parentElement;if(!r)return{pin:()=>void 0,stop:()=>void 0};let i=()=>t?0:r.getBoundingClientRect().top,a=()=>({top:r.scrollTop,gap:r.scrollHeight-r.scrollTop-r.clientHeight}),o=()=>{let t=Array.from(e.children).find(e=>e.getBoundingClientRect().bottom>i());return t?{row:t,offset:t.getBoundingClientRect().top-i()}:null},s={state:A.start,anchor:o()},c=()=>{s.anchor=o(),n(s.state.unseen)},l=({state:e,toBottom:t})=>{t&&(r.scrollTop=r.scrollHeight),s.state=t?{...e,...a()}:e,c()},u=()=>{s.state=A.scrolled(s.state,a()),c()},d=()=>{let e=s.anchor;if(s.state.pinned||!e?.row.isConnected)return;let t=e.row.getBoundingClientRect().top-i()-e.offset;t!==0&&(r.scrollTop+=t)},f=new ResizeObserver(()=>{d(),l(A.grew(s.state,a()))}),p=t?window:r;return f.observe(e),p.addEventListener(`scroll`,u,{passive:!0}),{pin:()=>l(A.pin(s.state)),stop:()=>{f.disconnect(),p.removeEventListener(`scroll`,u)}}},j=l();function Re({sent:e,page:t=!1,className:i,emptyState:a,footer:o,bottomContent:s,bottomClassName:c,children:l}){let[u,d]=(0,k.useState)(!1),f=(0,k.useRef)(null),[p]=(0,k.useState)(()=>e=>{if(!e)return;let n=Le(e,t,d);return f.current=n,()=>{n.stop(),f.current=null}});(0,k.useLayoutEffect)(()=>f.current?.pin(),[e]);let m=(0,j.jsxs)(`div`,{ref:p,className:n(`flex flex-col`,i),children:[a,l,o]});return(0,j.jsxs)(j.Fragment,{children:[t?m:(0,j.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:m}),(0,j.jsxs)(`div`,{className:n(`relative shrink-0`,c),children:[u?(0,j.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full flex justify-center pb-2`,children:(0,j.jsxs)(r,{size:`sm`,variant:`secondary`,className:`pointer-events-auto shadow-md`,onClick:()=>f.current?.pin(),children:[(0,j.jsx)(v,{}),`Jump to latest`]})}):null,s]})]})}var ze=({contextItems:e,onRemoveContextItem:t,onClearContextItems:n})=>e.length===0?null:(0,j.jsxs)(`div`,{className:`border-edge bg-muted/50 flex flex-wrap gap-1.5 border-t px-3 py-2`,children:[e.map(e=>(0,j.jsx)(pe,{item:e,onRemove:t},e.id)),(0,j.jsx)(r,{variant:`ghost`,size:`xs`,className:`ml-auto`,onClick:n,children:(0,j.jsxs)(`span`,{className:`text-muted-foreground group-hover/button:text-foreground group-focus-visible/button:text-foreground contents`,children:[(0,j.jsx)(o,{className:`size-3.5`}),`Clear all`]})})]});function M(e){return Array.isArray?Array.isArray(e):We(e)===`[object Array]`}function Be(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function N(e){return e==null?``:Be(e)}function P(e){return typeof e==`string`}function F(e){return typeof e==`number`}function Ve(e){return e===!0||e===!1||Ue(e)&&We(e)==`[object Boolean]`}function He(e){return typeof e==`object`}function Ue(e){return He(e)&&e!==null}function I(e){return e!=null}function L(e){return!e.trim().length}function We(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Ge=`Incorrect 'index' type`,R=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,Ke=e=>`Invalid value for key ${e}`,qe=e=>`Pattern length exceeds max of ${e}.`,Je=e=>`Missing ${e} property in key`,Ye=e=>`Property 'weight' in key '${e}' must be a positive integer`,Xe=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,Ze=Object.prototype.hasOwnProperty,Qe=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=$e(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function $e(e){let t=null,n=null,r=null,i=1,a=null;if(P(e)||M(e))r=e,t=et(e),n=z(e);else{if(!Ze.call(e,`name`))throw Error(Je(`name`));let o=e.name;if(r=o,Ze.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(Ye(z(o)));t=et(o),n=z(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function et(e){return M(e)?e:e.split(`.`)}function z(e){return M(e)?e.join(`.`):e}function tt(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(I(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!I(s))return;if(a===t.length-1&&(P(s)||F(s)||Ve(s)||typeof s==`bigint`))n.push(o===void 0?N(s):{v:N(s),i:o});else if(M(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}}};return i(e,P(t)?t.split(`.`):t,0),r?n:n[0]}var nt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},rt={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},it={location:0,threshold:.6,distance:100},at={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:tt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},B=Object.freeze({...rt,...nt,...it,...at});function ot(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=1,a=!1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===32?a||=(i++,!0):a=!1;if(n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var V=class{constructor({getFn:e=B.getFn,fieldNormWeight:t=B.fieldNormWeight}={}){this.norm=ot(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(P(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(R);if(P(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(R);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!I(e)||L(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(I(i)){if(M(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(I(n)){if(P(n)){if(!L(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(I(n.v)){let t=P(n.v)?n.v:N(n.v);if(!L(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(P(i)&&!L(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function st(e,t,{getFn:n=B.getFn,fieldNormWeight:r=B.fieldNormWeight}={}){let i=new V({getFn:n,fieldNormWeight:r});return i.setKeys(e.map($e)),i.setSources(t),i.create(),i}function ct(e,{getFn:t=B.getFn,fieldNormWeight:n=B.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new V({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function lt(e=[],t=B.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}var H=32;function ut(e,t,n,{location:r=B.location,distance:i=B.distance,threshold:a=B.threshold,findAllMatches:o=B.findAllMatches,minMatchCharLength:s=B.minMatchCharLength,includeMatches:c=B.includeMatches,ignoreLocation:l=B.ignoreLocation}={}){if(t.length>H)throw Error(qe(H));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=lt(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function dt(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function U(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var ft={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},pt=RegExp(`[`+Object.keys(ft).join(``)+`]`,`g`),W=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(pt,e=>ft[e]):e=>e,G=class{constructor(e,{location:t=B.location,threshold:n=B.threshold,distance:r=B.distance,includeMatches:i=B.includeMatches,findAllMatches:a=B.findAllMatches,minMatchCharLength:o=B.minMatchCharLength,isCaseSensitive:s=B.isCaseSensitive,ignoreDiacritics:c=B.ignoreDiacritics,ignoreLocation:l=B.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?W(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:dt(e),startIndex:t})},d=this.pattern.length;if(d>H){let e=0,t=d%H,n=d-t;for(;e<n;)u(this.pattern.substr(e,H),e),e+=H;if(t){let e=d-H;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?W(e):e,this.pattern===e){let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=ut(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=U(u)),p}},mt=new Set([`fuzzy`,`include`]);function ht(e){return e.startsWith(`inverse`)}var K=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new G(e,{location:t.location??B.location,threshold:t.threshold??B.threshold,distance:t.distance??B.distance,includeMatches:t.includeMatches??B.includeMatches,findAllMatches:t.findAllMatches??B.findAllMatches,minMatchCharLength:t.minMatchCharLength??B.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??B.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??B.ignoreDiacritics,ignoreLocation:t.ignoreLocation??B.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],gt=K.length,_t=`\0`,vt=`|`;function yt(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function bt(e,t){let n=e.match(t);return n?n[1]:null}function xt(e,t={}){return e.replace(/\\\|/g,_t).split(vt).map(e=>{let n=yt(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<gt;){let e=K[o],n=bt(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<gt;){let e=K[o],n=bt(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var St=class{constructor(e,{isCaseSensitive:t=B.isCaseSensitive,ignoreDiacritics:n=B.ignoreDiacritics,includeMatches:r=B.includeMatches,minMatchCharLength:i=B.minMatchCharLength,ignoreLocation:a=B.ignoreLocation,findAllMatches:o=B.findAllMatches,location:s=B.location,threshold:c=B.threshold,distance:l=B.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?W(e):e,this.pattern=e,this.query=xt(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?W(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,ht(r.type)&&(c=!0),n&&(mt.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=U(o)),e}}return{isMatch:!1,score:1}}},q=[];function J(...e){q.push(...e)}function Y(e,t){for(let n=0,r=q.length;n<r;n+=1){let r=q[n];if(r.condition(e,t))return new r(e,t)}return new G(e,t)}var X={AND:`$and`,OR:`$or`},Z={PATH:`$path`,PATTERN:`$val`},Ct=e=>!!(e[X.AND]||e[X.OR]),wt=e=>!!e[Z.PATH],Tt=e=>!M(e)&&He(e)&&!Ct(e),Et=e=>({[X.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Dt(e,t,{auto:n=!0}={}){let r=e=>{if(P(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=Y(e,t)),r}let i=Object.keys(e),a=wt(e);if(!a&&i.length>1&&!Ct(e))return r(Et(e));if(Tt(e)){let r=a?e[Z.PATH]:i[0],o=a?e[Z.PATTERN]:e[r];if(!P(o))throw Error(Ke(r));let s={keyId:z(r),pattern:o};return n&&(s.searcher=Y(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];M(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return Ct(e)||(e=Et(e)),r(e)}function Ot(e,{ignoreFieldNorm:t=B.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function kt(e,{ignoreFieldNorm:t=B.ignoreFieldNorm}){e.forEach(e=>{e.score=Ot(e.matches,{ignoreFieldNorm:t})})}var At=class{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):e.score<this.heap[0].score&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(t[e].score<=t[n].score)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&t[i].score>t[r].score&&(r=i),a<n&&t[a].score>t[r].score&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function jt(e){let t=[];return e.matches.forEach(e=>{if(!I(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function Mt(e,t,{includeMatches:n=B.includeMatches,includeScore:r=B.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=jt(e)),r&&(a.score=e.score),a})}var Nt=/[\p{L}\p{M}\p{N}_]+/gu,Pt=new WeakSet;function Ft(e){Pt.has(e)||(Pt.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function It(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||Ft(e),t=>t.match(e)||[]):e=>e.match(Nt)||[]}function Lt({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=It(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=W(n)),r(n)}}}var Rt=31,zt=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=Lt({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new G(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=Rt}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=U(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function Q(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function Bt(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)Q(e,a,i,r);else if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)Q(e,t.v,i,r);else Q(e,n.v,i,r)}}}function Vt(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)Bt(r,i,t,n);return r}function Ht(e,t,n,r){Bt(e,t,n,r)}function Ut(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function Wt(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)Ut(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var $=class{constructor(e,t,n){this.options={...B,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new Qe(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=Y(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof V))throw Error(Ge);if(this._myIndex=t||st(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=Lt({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=Vt(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!I(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=Lt({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});Ht(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&Wt(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(R);this._invertedIndex&&Wt(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(P(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return F(n)&&n>-1&&(e=e.slice(0,n)),e}let c=F(n)&&n>0&&P(e),l;if(c){let t=new At(n);P(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),l=t.extractSorted(o)}else l=P(e)?P(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),kt(l,{ignoreFieldNorm:s}),a&&l.sort(o),F(n)&&n>-1&&(l=l.slice(0,n));return Mt(l,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!I(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=Ot(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=Dt(e,this.options),n=(e,t,r)=>{if(!(`children`in e)){let{keyId:n,searcher:i}=e,a;return n===null?(a=[],this._myIndex.keys.forEach((e,n)=>{a.push(...this._findMatches({key:e,value:t[n],searcher:i}))})):a=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:i}),a&&a.length?[{idx:r,item:t,matches:a}]:[]}let{children:i,operator:a}=e,o=[];for(let e=0,s=i.length;e<s;e+=1){let s=i[e],c=n(s,t,r);if(c.length)o.push(...c);else if(a===X.AND)return[]}return o},r=this._myIndex.records,i=new Map,a=[];return r.forEach(({$:e,i:r})=>{if(I(e)){let o=n(t,e,r);o.length&&(i.has(r)||(i.set(r,{idx:r,item:e,matches:[]}),a.push(i.get(r))),o.forEach(({matches:e})=>{i.get(r).matches.push(...e)}))}}),a}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{keys:a,records:o}=this._myIndex,s=t?null:[];return o.forEach(({$:e,i:o})=>{if(!I(e))return;let c=[],l=!1,u=!1;if(a.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:o,item:e,matches:c};t?(r.score=Ot(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!I(t))return[];let r=[];if(M(t))t.forEach(({v:t,i,n:a})=>{if(!I(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=Rt){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};$.version=`7.4.0`,$.createIndex=st,$.parseIndex=ct,$.config=B,$.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(Xe);return Y(e,{...B,...n}).searchIn(t)},$.parseQuery=Dt,J(St),J(zt),$.use=function(...e){e.forEach(e=>J(e))};var Gt=e=>e.kind===`selection`||e.kind===`symbol`?(0,j.jsx)(re,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`file`?(0,j.jsx)(xe,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`pr-description`?(0,j.jsx)(je,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`check`?(0,j.jsx)(Se,{className:`text-muted-foreground size-3.5 shrink-0`}):(0,j.jsx)(p,{className:`text-muted-foreground size-3.5 shrink-0`}),Kt=(e,t)=>e===`Comments`&&t.comments===`pending`?`Comments (loading...)`:e===`Comments`&&t.comments===`error`?`Comments (unavailable)`:e===`Checks`&&t.checks===`pending`?`Checks (loading...)`:e===`Checks`&&t.checks===`error`?`Checks (unavailable)`:e===`Symbols`&&t.symbols===`pending`?`Symbols (loading...)`:e===`Symbols`&&t.symbols===`error`?`Symbols (unavailable)`:e,qt=({mentionGroups:e,contextGroups:t,onSelectCandidate:n})=>{let r=new Set(e.map(e=>e.group)),i=[`Comments`,`Checks`,`Symbols`].filter(e=>r.has(e)?!1:e===`Comments`?t.comments!==`idle`:e===`Checks`?t.checks!==`idle`:t.symbols!==`idle`);return(0,j.jsx)(`div`,{className:`border-edge bg-popover absolute right-2 bottom-full left-2 mb-2 rounded-lg border shadow-sm`,children:(0,j.jsx)(te,{shouldFilter:!1,children:(0,j.jsxs)(ee,{children:[(0,j.jsx)(E,{children:`No matching context.`}),e.map(e=>(0,j.jsx)(S,{heading:Kt(e.group,t),children:e.items.map(e=>(0,j.jsxs)(w,{value:e.item.id,onSelect:()=>n(e),children:[Gt(e.item),(0,j.jsx)(`span`,{className:`truncate`,children:e.label}),e.detail?(0,j.jsx)(`span`,{className:`text-muted-foreground truncate text-xs`,children:e.detail}):null]},e.item.id))},e.group)),i.map(e=>(0,j.jsx)(S,{heading:Kt(e,t)},e))]})})})},Jt=/(^|\s)@([^\s@]*)$/,Yt=({contextItems:e,contextCandidates:t,contextGroups:n,busy:r,blocked:i,onAsk:a,onStop:o,onAddContextItem:s,onContextIntent:c})=>{let[l,u]=(0,k.useState)(``),[d,f]=(0,k.useState)(0),p=(0,k.useId)(),m=(0,k.useRef)(!1),h=Jt.exec(l.slice(0,d)),g=h?.[2]??null,_=h?{query:g??``,start:d-(g?.length??0)-1}:null,v=(e,t)=>{let n=Jt.test(e.slice(0,t));n&&!m.current&&c(),m.current=n},y=new Set(e.map(e=>e.id)),b=t.filter(e=>!y.has(e.item.id)),x=_?.query?new $(b,{keys:[`label`,`detail`,`searchText`,`group`],threshold:.3,ignoreLocation:!0}).search(_.query).map(e=>e.item).slice(0,12):b.slice(0,12),S=[`PR`,`Files`,`Comments`,`Checks`,`Symbols`].flatMap(e=>{let t=x.filter(t=>t.group===e);return t.length===0?[]:[{group:e,items:t}]}),C=()=>{a(l)&&(u(``),f(0),m.current=!1)},w=e=>{if(!_)return;s(e.item);let t=l.slice(0,_.start)+l.slice(d);u(t),m.current=!1,v(t,_.start),requestAnimationFrame(()=>{let e=document.getElementById(p);e?.focus(),e?.setSelectionRange(_.start,_.start),f(_.start)})},T=e=>{f(e),v(l,e)};return(0,j.jsxs)(j.Fragment,{children:[_&&(0,j.jsx)(qt,{mentionGroups:S,contextGroups:n,onSelectCandidate:w}),(0,j.jsx)(ie,{id:p,value:l,onValueChange:(e,t)=>{u(e),f(t),v(e,t)},onClick:e=>T(e.currentTarget.selectionStart??0),onSelect:e=>T(e.currentTarget.selectionStart??0),onEnter:()=>{let e=_?x[0]:void 0;e?w(e):C()},onSend:C,onStop:o,busy:r,canSend:!i&&l.trim().length>0,placeholder:e.length>0?`Ask about this PR and context...`:`Ask about this PR...`})]})},Xt=({chatId:e,agent:t,label:n,context:r,onSignIn:i})=>{let a=me(e),o=(0,k.useSyncExternalStore)(a.subscribe,a.getSnapshot),s=D({mutationFn:t=>g.local.agent.prompt.mutate({chatId:e,...t}),onError:e=>_.error(e.message)}),c=D({mutationFn:()=>g.local.agent.cancel.mutate({chatId:e}),onError:e=>_.error(e.message)}),l=D({mutationFn:()=>g.local.agent.restart.mutate({chatId:e}),onError:e=>_.error(e.message)}),u=o.busy||s.isPending;return(0,j.jsx)(Re,{sent:o.rows.filter(e=>e.type===`user`).length,className:`min-h-full gap-3 p-3`,emptyState:o.rows.length===0?(0,j.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4 text-center`,children:(0,j.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Ask `,n,` about this PR. It reads the worktree; select diff lines with `,(0,j.jsx)(y,{keys:[`mod`,`L`]}),` or type @ to add context.`]})}):null,footer:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ue,{label:o.status===`starting`?`Starting ${n}`:`${n} is working`,thinking:u}),o.status===`failed`||o.status===`closed`?(0,j.jsx)(le,{message:o.status===`failed`?`${n} didn't start`:`${n} stopped`,detail:o.reason??void 0,onRetry:()=>l.mutate(),retryDisabled:l.isPending}):null,o.status===`failed`&&o.signIn?(0,j.jsx)(`div`,{children:(0,j.jsx)(ge,{agent:t,label:n,onSignIn:i})}):null,(0,j.jsx)(_e,{chatId:e,queue:o.queue})]}),bottomContent:(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(ze,{contextItems:r.contextItems,onRemoveContextItem:r.removeContextItem,onClearContextItems:r.clearContextItems}),(0,j.jsx)(`div`,{className:`border-edge relative border-t p-2`,children:(0,j.jsx)(Yt,{contextItems:r.contextItems,contextCandidates:r.contextCandidates,contextGroups:r.contextGroups,busy:u,blocked:!1,onAsk:e=>{let t=e.trim();return t?(s.mutate({text:t,contextItems:r.contextItems}),r.clearContextItems(),!0):!1},onStop:()=>c.mutate(),onAddContextItem:r.addContextItem,onContextIntent:r.onContextIntent})})]}),children:o.rows.map(r=>(0,j.jsx)(ce,{chatId:e,agent:t,label:n,row:r,onSignIn:i},r.id))})},Zt=({chatId:e,agent:t,context:n,onSettled:r,onSignIn:i})=>t.available?(0,j.jsx)(Xt,{chatId:e,agent:t.id,label:t.label,context:n,onSignIn:i},`${e}:${t.id}`):(0,j.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,j.jsx)(be,{agents:[t],onSettled:r,onSignIn:i})}),Qt=({chats:e,current:t,onPick:n})=>{let i=D({mutationFn:e=>g.local.agent.close.mutate({chatId:e}),onError:e=>_.error(e.message)});return(0,j.jsxs)(Ee,{children:[(0,j.jsx)(ke,{asChild:!0,children:(0,j.jsxs)(r,{size:`sm`,variant:`ghost`,"aria-label":`Chats`,className:`max-w-48 min-w-0 shrink`,children:[(0,j.jsx)(ae,{agent:t.agent,className:`size-3.5`}),(0,j.jsx)(`span`,{className:`truncate`,children:t.title}),t.busy?(0,j.jsx)(f,{}):null,(0,j.jsx)(h,{})]})}),(0,j.jsxs)(De,{align:`start`,className:`w-72`,children:[(0,j.jsx)(Te,{children:`Chats`}),e.map(e=>(0,j.jsxs)(we,{onSelect:()=>n(e.id),className:`pr-0.5`,children:[(0,j.jsx)(ae,{agent:e.agent,className:`size-3.5`}),(0,j.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.busy?(0,j.jsx)(f,{}):null,e.queued>0?(0,j.jsx)(d,{variant:`secondary`,title:`Queued messages`,children:e.queued}):null,(0,j.jsx)(r,{size:`icon-xs`,variant:`ghost`,"aria-label":`Close ${e.title}`,disabled:i.isPending&&i.variables===e.id,onClick:t=>{t.stopPropagation(),i.mutate(e.id)},children:(0,j.jsx)(o,{})})]},e.id))]})]})},$t=2e3,en=(0,k.lazy)(()=>Ce(()=>import(`./terminal-shell-Cnt0r4V7.js`).then(e=>({default:e.TerminalShell})),__vite__mapDeps([0,1,2,3,4,5]))),tn=()=>(0,j.jsx)(`div`,{className:`flex-1 p-2`,children:(0,j.jsx)(a,{className:`h-full w-full`})}),nn=e=>{let t=i({queryKey:[`local`,`addon`,`status`,`terminal`],queryFn:()=>g.local.addon.status.query({addon:`terminal`}),refetchInterval:e=>e.state.data?.state===`installing`&&$t});return t.isPending?(0,j.jsx)(tn,{}):t.isError?(0,j.jsx)(`div`,{className:`p-3`,children:(0,j.jsx)(s,{message:`Couldn't check the terminal.`,refetch:()=>void t.refetch()})}):t.data.state===`installed`?(0,j.jsx)(k.Suspense,{fallback:(0,j.jsx)(tn,{}),children:(0,j.jsx)(en,{...e})}):(0,j.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,j.jsx)(m,{variant:`quiet`,size:`sm`,title:`Set up the terminal`,description:t.data.error??`The terminal installs the first time you use it: a shell in the PR worktree.`,action:(0,j.jsx)(se,{addon:`terminal`,label:`the terminal`,status:t.data,onSettled:()=>void t.refetch()})})})},rn=({context:e})=>{let t=c(),n=(0,k.useSyncExternalStore)(O.subscribe,O.getSnapshot),a=(0,k.useSyncExternalStore)(Ae.subscribe,Ae.getSnapshot),o=i(ye()),l=D({mutationFn:e=>g.local.agent.create.mutate({agent:e,placement:{kind:`panel`}}),onSuccess:e=>O.showChat(e.id),onError:e=>_.error(e.message)}),u=D({mutationFn:e=>g.local.agent.setAgent.mutate(e),onError:e=>_.error(e.message)}),d=a?.filter(e=>e.placement.kind===`panel`)??[],p=d.find(e=>e.id===n.chatId)??d[0],m=p?o.data?.find(e=>e.id===p.agent):void 0,h=o.data?Me(o.data,a?.[0]?.agent??null)?.id:void 0,v=a!==null&&d.length===0,{mutate:y,isPending:S,isError:w}=l;(0,k.useEffect)(()=>{v&&h&&!S&&!w&&y(h)},[v,h,S,w,y]);let E=()=>void o.refetch();return(0,j.jsx)(`div`,{className:`relative h-full`,children:(0,j.jsxs)(he,{value:n.tab,onValueChange:e=>O.showTab(e===`terminal`?`terminal`:`agent`),className:`absolute inset-0 flex min-h-0 flex-col gap-0`,children:[(0,j.jsxs)(`div`,{className:`border-edge @container flex shrink-0 items-center gap-2 border-b p-2`,children:[(0,j.jsxs)(oe,{children:[(0,j.jsxs)(fe,{value:`agent`,"aria-label":`Agent`,children:[(0,j.jsx)(Oe,{}),(0,j.jsx)(`span`,{className:`hidden @xs:inline`,children:`Agent`})]}),(0,j.jsxs)(fe,{value:`terminal`,"aria-label":`Terminal`,children:[(0,j.jsx)(Fe,{}),(0,j.jsx)(`span`,{className:`hidden @xs:inline`,children:`Terminal`})]})]}),n.tab===`agent`&&o.data&&p?(0,j.jsx)(Qt,{chats:d,current:p,onPick:O.showChat}):null,n.tab===`agent`&&o.data&&p?(0,j.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,j.jsx)(de,{agents:o.data,value:p.agent,onValueChange:e=>{p&&e!==p.agent&&(p.turns===0&&p.queued===0&&!p.busy?u.mutate({chatId:p.id,agent:e}):l.mutate(e))},disabled:u.isPending}),(0,j.jsx)(b,{children:(0,j.jsxs)(C,{children:[(0,j.jsx)(x,{asChild:!0,children:(0,j.jsx)(r,{size:`icon-sm`,variant:`ghost`,"aria-label":`New chat`,disabled:l.isPending,onClick:()=>l.mutate(p.agent),children:l.isPending?(0,j.jsx)(f,{}):(0,j.jsx)(T,{})})}),(0,j.jsx)(ne,{side:`bottom`,children:`New chat`})]})})]}):null]}),(0,j.jsx)(ve,{value:`agent`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:o.isError?(0,j.jsx)(`div`,{className:`p-3`,children:(0,j.jsx)(s,{message:`Couldn't list the agents.`,refetch:E})}):!p&&w&&h?(0,j.jsx)(`div`,{className:`p-3`,children:(0,j.jsx)(s,{message:`Couldn't start a chat.`,refetch:()=>l.mutate(h)})}):!p||!m?(0,j.jsx)(Ne,{}):(0,j.jsx)(Zt,{chatId:p.id,agent:m,context:e,onSettled:E,onSignIn:(e,t)=>O.signIn(e,t,p.id)})}),(0,j.jsx)(ve,{value:`terminal`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:n.terminalOpened?(0,j.jsx)(nn,{signIn:n.signIn,onSignInExit:e=>{let r=n.signIn;r&&e===0&&(t.invalidateQueries({queryKey:ye().queryKey}),O.showTab(`agent`),g.local.agent.restart.mutate({chatId:r.chatId}).catch(e=>_.error(e.message)))},onRestart:O.clearSignIn}):null})]})})};export{rn as LocalSidePanel};
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
7
7
  <title>glen review</title>
8
- <script type="module" crossorigin src="/assets/index-4Oe9F1aD.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-DKOFiQ-E.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-IMkwHZOK.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/button-DizkG3Et.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryglen/review",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "Glen's PR reviewer, served locally from a git worktree of the PR head.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -50,5 +50,5 @@
50
50
  "node": ">=20"
51
51
  },
52
52
  "license": "UNLICENSED",
53
- "gitHead": "a84edb6676a9e22793dc7514018da82d0f02d3bc"
53
+ "gitHead": "3dbedd16c3caf8b1e68c7a5fcefef990e4b46378"
54
54
  }