diff --git a/ee/tabby-webserver/ui/404.html b/ee/tabby-webserver/ui/404.html
index 777279bed7ae..b8b59cd608f5 100644
--- a/ee/tabby-webserver/ui/404.html
+++ b/ee/tabby-webserver/ui/404.html
@@ -1 +1 @@
-
Tabby
\ No newline at end of file
+Tabby
\ No newline at end of file
diff --git a/ee/tabby-webserver/ui/_next/static/KlVqgvGUVxfNkCGGKH8Jr/_buildManifest.js b/ee/tabby-webserver/ui/_next/static/KVhhjoafPJlJLZi-ACDFo/_buildManifest.js
similarity index 100%
rename from ee/tabby-webserver/ui/_next/static/KlVqgvGUVxfNkCGGKH8Jr/_buildManifest.js
rename to ee/tabby-webserver/ui/_next/static/KVhhjoafPJlJLZi-ACDFo/_buildManifest.js
diff --git a/ee/tabby-webserver/ui/_next/static/KlVqgvGUVxfNkCGGKH8Jr/_ssgManifest.js b/ee/tabby-webserver/ui/_next/static/KVhhjoafPJlJLZi-ACDFo/_ssgManifest.js
similarity index 100%
rename from ee/tabby-webserver/ui/_next/static/KlVqgvGUVxfNkCGGKH8Jr/_ssgManifest.js
rename to ee/tabby-webserver/ui/_next/static/KVhhjoafPJlJLZi-ACDFo/_ssgManifest.js
diff --git a/ee/tabby-webserver/ui/_next/static/chunks/6534-2213486f615c8cfb.js b/ee/tabby-webserver/ui/_next/static/chunks/6534-2213486f615c8cfb.js
new file mode 100644
index 000000000000..ecd35757c05b
--- /dev/null
+++ b/ee/tabby-webserver/ui/_next/static/chunks/6534-2213486f615c8cfb.js
@@ -0,0 +1 @@
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6534],{72657:function(e,n,t){"use strict";t.d(n,{K:function(){return o}});var s=t(36164);t(3546);var l=t(12624),a=t(1544),r=t(31458),i=t(81565);function o(e){let{className:n,container:t,offset:o,...d}=e,c=(0,l.e)(o||0,t);return(0,s.jsxs)(r.z,{variant:"outline",size:"icon",className:(0,a.cn)("absolute right-4 top-1 z-10 bg-background transition-opacity duration-300 sm:right-8 md:top-2",c?"opacity-0":"opacity-100",n),onClick:()=>{t?t.scrollTo({top:t.scrollHeight,behavior:"smooth"}):window.scrollTo({top:document.body.offsetHeight,behavior:"smooth"})},...d,children:[(0,s.jsx)(i.IconArrowDown,{}),(0,s.jsx)("span",{className:"sr-only",children:"Scroll to bottom"})]})}},66534:function(e,n,t){"use strict";t.d(n,{e:function(){return eE},p:function(){return eM}});var s=t(36164),l=t(3546),a=t(1853),r=t(78613),i=t(82157),o=t(72940),d=t(70783),c=t(21808),u=t(24449),m=t(16784),h=t(64566),x=t(63484),v=t(17451),f=t(1544),p=t(90379),g=t(54767),j=t(28445),b=t(84837),y=t(2578),N=t(28312),C=t(47241),w=t(11634),k=t(70410),I=t(63795),A=t(31458),M=t(81565),E=t(72657),S=t(45391),L=t(34021),T=t(21454),R=t(3765),_=t(84942),z=t(29),D=t(24685),Z=t(74630),O=t(16234),F=t(23455),U=t(82394);let P=l.createContext({}),H=_.xp,$=l.forwardRef((e,n)=>(0,s.jsx)(_.tW,{...e,ref:n}));$.displayName="SearchableSelectAnchor";let q=l.forwardRef((e,n)=>{let{getInputProps:t}=l.useContext(P),{onKeyDown:a,onChange:r,onInput:i,onBlur:o,onClick:d,...c}=e;return(0,s.jsx)(F.Z,{...t((0,O.Z)({onKeyDown:a,onChange:r,onInput:i,onBlur:o,onClick:d,ref:n},Z.Z)),...c})});q.displayName="SearchableSelectTextarea";let J=l.forwardRef((e,n)=>{let{getInputProps:t}=l.useContext(P),{onKeyDown:a,onChange:r,onInput:i,onBlur:o,onClick:d,...c}=e;return(0,s.jsx)(U.I,{...t((0,O.Z)({onKeyDown:a,onChange:r,onInput:i,onBlur:o,onClick:d,ref:n},Z.Z)),...c})});J.displayName="SearchableSelectInput";let W=l.forwardRef((e,n)=>{let{children:t,style:a,popupMatchAnchorWidth:r,...i}=e,{getMenuProps:o,anchorRef:d}=l.useContext(P),c=l.useRef(void 0);return l.useLayoutEffect(()=>{if(r){let e=d.current;if(e){let n=e.getBoundingClientRect();c.current=n.width}}},[]),(0,s.jsx)(_.i9,{children:(0,s.jsx)(_.yk,{align:"start",onOpenAutoFocus:e=>e.preventDefault(),style:{width:c.current,...a},...o({ref:n},{suppressRefError:!0}),...i,children:t})})});W.displayName="SearchableSelectContent";let G=l.forwardRef((e,n)=>{let{item:t,index:a,className:r,children:i,disabled:o,...d}=e,{highlightedIndex:c,selectedItem:u,getItemProps:m}=l.useContext(P),h=c===a,x=u===t;return(0,s.jsx)(H,{asChild:!0,children:(0,s.jsx)("div",{className:(0,f.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",h&&"bg-accent text-accent-foreground",x&&"font-bold",o&&"pointer-events-none opacity-50",r),...m({item:t,index:a,onMouseLeave:e=>e.preventDefault(),onMouseOut:e=>e.preventDefault()}),...d,children:"function"==typeof i?i({highlighted:h,selected:x}):i})},t.id)});function V(e){let{options:n,onSelect:t,children:a,open:r,onOpenChange:i,stayOpenOnInputClick:o}=e,d=l.useRef(null),c=l.useCallback((e,n)=>{let{type:t,changes:s}=n;switch(t){case D.Kb.stateChangeTypes.MenuMouseLeave:return{...s,highlightedIndex:e.highlightedIndex};case D.Kb.stateChangeTypes.InputClick:let l=!!o||s.isOpen;return{...s,isOpen:l};default:return s}},[o]),u=(0,D.Kb)({items:null!=n?n:[],defaultIsOpen:r,onSelectedItemChange(e){let{selectedItem:n}=e;n&&(null==t||t(n),null==i||i(!1))},onIsOpenChange:e=>{let{isOpen:n}=e;null==i||i(!!n)},stateReducer:c}),{setHighlightedIndex:m,highlightedIndex:h}=u,x=(0,Z.Z)(r)?u.isOpen:u.isOpen&&r;l.useEffect(()=>{x&&(null==n?void 0:n.length)&&-1===h&&m(0)},[x,n]);let v=l.useMemo(()=>({...u,open:x,anchorRef:d}),[u,x,d]);return(0,s.jsx)(P.Provider,{value:v,children:(0,s.jsx)(_.J2,{open:x,children:"function"==typeof a?a(v):a})})}G.displayName="SearchableSelectOption";let Y=l.forwardRef(function(e,n){let{onSubmit:t,input:a,setInput:r,isLoading:i,chatInputRef:o}=e,{formRef:d,onKeyDown:c}=function(){let e=(0,l.useRef)(null);return{formRef:e,onKeyDown:n=>{if("Enter"===n.key&&!n.shiftKey&&!n.nativeEvent.isComposing){var t;null===(t=e.current)||void 0===t||t.requestSubmit(),n.preventDefault()}}}}(),[u,m]=l.useState(null),[h,x]=l.useState(!1),v=l.useRef(),p=l.useRef(),[g,j]=l.useState([]),[b,y]=l.useState({}),{data:N}=(0,T.ZP)(u,R.Z,{revalidateOnFocus:!1,dedupingInterval:0,errorRetryCount:0});l.useEffect(()=>{var e;let n=null!==(e=null==N?void 0:N.hits)&&void 0!==e?e:[];j(n),x(!!(null==n?void 0:n.length))},[null==N?void 0:N.hits]),l.useImperativeHandle(n,()=>({focus:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.focus()}})),l.useEffect(()=>{a&&o.current&&o.current!==document.activeElement&&o.current.focus()},[a,o]),l.useLayoutEffect(()=>{var e,n,t;(null===(e=p.current)||void 0===e?void 0:e.length)&&(null===(t=o.current)||void 0===t||null===(n=t.setSelectionRange)||void 0===n||n.call(t,p.current[0],p.current[1]),p.current=void 0)},[o]),l.useMemo(()=>(0,S.Z)(e=>{var n,t,s,l;let a=null!==(s=null===(n=e.target)||void 0===n?void 0:n.value)&&void 0!==s?s:"",r=null!==(l=null===(t=e.target)||void 0===t?void 0:t.selectionEnd)&&void 0!==l?l:0,i=B(a,r),o=null==i?void 0:i[1];if(o){let e=encodeURIComponent("name:".concat(o," AND kind:function")),n="/v1beta/search?q=".concat(e);m(n)}else j([]),x(!1)},200),[]);let C=async e=>{if(e.preventDefault(),!(null==a?void 0:a.trim())||i)return;let n=a;Object.keys(b).forEach(e=>{var t,s,l;let a=b[e];(null==a?void 0:a.doc)&&(n=n.replaceAll(e,"\n```".concat(null!==(s=null===(t=a.doc)||void 0===t?void 0:t.language)&&void 0!==s?s:"","\n").concat(null!==(l=a.doc.body)&&void 0!==l?l:"","\n","```","\n")))}),r(""),await t(n)},w=(e,n)=>{"Enter"===e.key&&n?e.preventDefault():n&&["ArrowRight","ArrowLeft","Home","End"].includes(e.key)?(j([]),x(!1)):(n||(e.preventDownshiftDefault=!0),c(e))};return(0,s.jsx)("form",{onSubmit:C,ref:d,children:(0,s.jsx)(V,{options:g,onSelect:e=>{var n,t,s;let l=null!==(n=v.current)&&void 0!==n?n:0,i=B(a,l);if(i){y({...b,["@".concat(null===(t=e.doc)||void 0===t?void 0:t.name)]:e});let n="@".concat(null==e?void 0:null===(s=e.doc)||void 0===s?void 0:s.name," "),o=a.substring(0,l).replace(new RegExp(i[0]),""),d=o.length+n.length;p.current=[d,d],r(o+n+a.slice(l))}j([]),x(!1)},open:h,onOpenChange:e=>{e&&(null==g?void 0:g.length)?x(e):(x(!1),j([]))},children:e=>{var n,t,l,d;let{open:c,highlightedIndex:u}=e,m=null==g?void 0:g[u];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)($,{children:(0,s.jsxs)("div",{className:"relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md sm:border sm:px-12",children:[(0,s.jsx)("span",{className:(0,f.cn)((0,A.d)({size:"sm",variant:"ghost"}),"absolute left-0 top-4 h-8 w-8 rounded-full bg-background p-0 hover:bg-background sm:left-4"),children:(0,s.jsx)(M.IconEdit,{})}),(0,s.jsx)(q,{tabIndex:0,rows:1,placeholder:"Ask a question.",spellCheck:!1,className:"min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none",value:a,ref:o,onChange:e=>{(0,L.Z)(e,"target.value")?(v.current=e.target.selectionEnd,r(e.target.value)):v.current=void 0},onKeyDown:e=>w(e,c)}),(0,s.jsx)("div",{className:"absolute right-0 top-4 sm:right-4",children:(0,s.jsxs)(z.u,{children:[(0,s.jsx)(z.aJ,{asChild:!0,children:(0,s.jsxs)(A.z,{type:"submit",size:"icon",disabled:i||""===a,children:[(0,s.jsx)(M.IconArrowElbow,{}),(0,s.jsx)("span",{className:"sr-only",children:"Send message"})]})}),(0,s.jsx)(z._v,{children:"Send message"})]})})]})}),(0,s.jsx)(W,{align:"start",side:"top",onOpenAutoFocus:e=>e.preventDefault(),className:"w-[60vw] md:w-[430px]",children:(0,s.jsxs)(_.J2,{open:c&&!!m,children:[(0,s.jsx)(_.tW,{asChild:!0,children:(0,s.jsx)("div",{className:"max-h-[300px] overflow-y-scroll",children:c&&!!(null==g?void 0:g.length)&&g.map((e,n)=>{var t,l,a;return(0,s.jsx)(G,{item:e,index:n,children:(0,s.jsxs)("div",{className:"flex w-full items-center justify-between gap-8 overflow-x-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(K,{kind:null==e?void 0:null===(t=e.doc)||void 0===t?void 0:t.kind}),(0,s.jsxs)("div",{className:"max-w-[200px] truncate",children:[null==e?void 0:null===(l=e.doc)||void 0===l?void 0:l.name,"(...)"]})]}),(0,s.jsx)("div",{className:"flex-1 truncate text-right text-sm text-muted-foreground",children:null==e?void 0:null===(a=e.doc)||void 0===a?void 0:a.body})]})},null==e?void 0:e.id)})})}),(0,s.jsx)(_.yk,{asChild:!0,align:"start",side:"right",alignOffset:-4,onOpenAutoFocus:e=>e.preventDefault(),onKeyDownCapture:e=>e.preventDefault(),className:"rounded-none",collisionPadding:{bottom:120},children:(0,s.jsxs)("div",{className:"flex max-h-[70vh] w-[20vw] flex-col overflow-y-auto px-2 md:w-[240px] lg:w-[340px]",children:[(0,s.jsxs)("div",{className:"mb-2",children:[(null==m?void 0:null===(n=m.doc)||void 0===n?void 0:n.kind)?"(".concat(null==m?void 0:null===(t=m.doc)||void 0===t?void 0:t.kind,") "):"",null==m?void 0:null===(l=m.doc)||void 0===l?void 0:l.name]}),(0,s.jsx)("div",{className:"flex-1 whitespace-pre-wrap break-all text-muted-foreground",children:null==m?void 0:null===(d=m.doc)||void 0===d?void 0:d.body})]})})]})})]})}})})});function B(e,n){let t=e.substring(0,n),s=/@(\w+)$/.exec(t);return s}function K(e){let{kind:n,...t}=e;return(0,s.jsx)(M.IconSymbolFunction,{...t})}function Q(e){let{href:n,children:t}=e;return(0,s.jsxs)("a",{href:n,target:"_blank",className:"inline-flex flex-1 justify-center gap-1 leading-4 hover:underline",children:[(0,s.jsx)("span",{children:t}),(0,s.jsx)("svg",{"aria-hidden":"true",height:"7",viewBox:"0 0 6 6",width:"7",className:"opacity-70",children:(0,s.jsx)("path",{d:"M1.25215 5.54731L0.622742 4.9179L3.78169 1.75597H1.3834L1.38936 0.890915H5.27615V4.78069H4.40513L4.41109 2.38538L1.25215 5.54731Z",fill:"currentColor"})})]})}function X(e){let{className:n,...t}=e;return(0,s.jsxs)("p",{className:(0,f.cn)("px-2 text-center text-xs leading-normal text-muted-foreground",n),...t,children:[(0,s.jsx)(Q,{href:"https://tabby.tabbyml.com",children:"Tabby"}),", an opensource, self-hosted AI coding assistant ."]})}let ee=l.forwardRef(function(e,n){var t;let{stop:r,reload:i,input:o,setInput:d,className:u,onSubmit:m,chatMaxWidthClass:h,chatInputRef:x}=e,p=l.useRef(null),{threadId:S,container:L,onClearMessages:T,qaPairs:R,isLoading:_,relevantContext:z,removeRelevantContext:D,activeSelection:Z,onCopyContent:O}=l.useContext(eM),F=(0,v.a)(e=>e.enableActiveSelection),[U,P]=(0,l.useState)(!1),H=(0,l.useMemo)(()=>{var e;if(!S)return"";let n=null===(e=R[0])||void 0===e?void 0:e.user.message;if(!n)return S;let t=(0,f.i8)([],n,{maxLength:c.$I}),s=(0,g.Z)(t),l=(0,a.Z)([s,S]).join("-");return l},[null===(t=R[0])||void 0===t?void 0:t.user.message,S]),$=(0,w.Db)(k.md,{onError(e){y.A.error(e.message)}}),{isCopied:q,copyToClipboard:J}=(0,N.m)({timeout:2e3,onCopyContent:O}),W=async()=>{if(S&&!q&&!U)try{var e,n;P(!0);let t=await $({threadId:S});if(null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.setThreadPersisted){let e=new URL(window.location.origin);e.pathname="/search/".concat(H),J(e.toString())}else y.A.error((null==t?void 0:null===(n=t.error)||void 0===n?void 0:n.message)||"Failed to share")}catch(e){}finally{P(!1)}};return l.useImperativeHandle(n,()=>({focus:()=>{var e;null===(e=p.current)||void 0===e||e.focus()}}),[]),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)(E.K,{container:L}),(0,s.jsxs)("div",{className:"mx-auto md:px-4 ".concat(h),children:[(0,s.jsxs)("div",{className:"flex h-10 items-center justify-center gap-2",children:[_?(0,s.jsxs)(A.z,{variant:"outline",onClick:()=>r(),className:"bg-background",children:[(0,s.jsx)(M.IconStop,{className:"mr-2"}),"Stop generating"]}):(null==R?void 0:R.length)>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(A.z,{variant:"outline",onClick:()=>i(),className:"bg-background",children:[(0,s.jsx)(M.IconRefresh,{className:"mr-2"}),"Regenerate"]}),(0,s.jsxs)(A.z,{variant:"outline",className:"gap-2 bg-background",onClick:W,children:[q?(0,s.jsx)(M.IconCheck,{}):(0,s.jsx)(M.IconShare,{}),"Share"]})]}),(null==R?void 0:R.length)>0&&(0,s.jsxs)(A.z,{variant:"outline",onClick:T,className:"bg-background",children:[(0,s.jsx)(M.IconTrash,{className:"mr-2"}),"Clear"]})]}),(0,s.jsxs)("div",{className:"border-t bg-background px-4 py-2 shadow-lg sm:space-y-4 sm:rounded-t-xl sm:border md:py-4",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,s.jsxs)(j.M,{presenceAffectsLayout:!0,children:[Z?(0,s.jsx)(b.E.div,{initial:{opacity:0,scale:.9,y:-5},animate:{opacity:1,scale:1,y:0},transition:{ease:"easeInOut",duration:.1},exit:{opacity:0,scale:.9,y:5},children:(0,s.jsxs)(I.C,{variant:"outline",className:(0,f.cn)("inline-flex h-7 flex-nowrap items-center gap-1.5 overflow-hidden rounded-md pr-0 text-sm font-semibold",{"border-dashed !text-muted-foreground italic line-through":!F}),children:[(0,s.jsx)(en,{context:Z,className:"flex-1 truncate"}),(0,s.jsx)("span",{className:"shrink-0 text-muted-foreground",children:"Current file"}),(0,s.jsx)(A.z,{size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0 rounded-l-none",onClick:e=>{(0,C.qs)(!F)},children:F?(0,s.jsx)(M.IconEye,{}):(0,s.jsx)(M.IconEyeOff,{})})]})}):null,z.map((e,n)=>(0,s.jsx)(b.E.div,{initial:{opacity:0,scale:.9,y:-5},animate:{opacity:1,scale:1,y:0},transition:{ease:"easeInOut",duration:.1},exit:{opacity:0,scale:.9,y:5},layout:!0,children:(0,s.jsxs)(I.C,{variant:"outline",className:"inline-flex h-7 flex-nowrap items-center gap-1 overflow-hidden rounded-md pr-0 text-sm font-semibold",children:[(0,s.jsx)(en,{context:e}),(0,s.jsx)(A.z,{size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0 rounded-l-none",onClick:D.bind(null,n),children:(0,s.jsx)(M.IconRemove,{})})]})},e.filepath+e.range.start+e.range.end))]})}),(0,s.jsx)(Y,{ref:p,onSubmit:m,input:o,setInput:d,isLoading:_,chatInputRef:x}),(0,s.jsx)(X,{className:"hidden sm:block"})]})]})]})});function en(e){let{context:n,className:t}=e,[l]=n.filepath.split("/").slice(-1),a=n.range.start===n.range.end?":".concat(n.range.start):":".concat(n.range.start,"-").concat(n.range.end);return(0,s.jsxs)("span",{className:(0,f.cn)("truncate",t),children:[l,(0,s.jsx)("span",{className:"text-muted-foreground",children:a})]})}var et=t(76297),es=t(12624);function el(e){let{trackVisibility:n}=e,{container:t}=l.useContext(eM),a=(0,es.e)(100,t),{ref:r,entry:i,inView:o}=(0,et.YD)({trackVisibility:n,delay:100,rootMargin:"0px 0px -150px 0px",root:t});return l.useEffect(()=>{a&&n&&!o&&(null==i||i.target.scrollIntoView({block:"start"}))},[o,i,a,n]),(0,s.jsx)("div",{ref:r,className:"h-px w-full"})}let ea=[{heading:"Convert list of string to numbers",message:"How to convert a list of string to numbers in python"},{heading:"How to parse email address",message:"How to parse email address with regex"}];function er(e){let{setInput:n,chatMaxWidthClass:t,welcomeMessage:l}=e;return(0,s.jsx)("div",{className:"mx-auto px-4 ".concat(t),children:(0,s.jsxs)("div",{className:"rounded-lg border bg-background p-8",children:[(0,s.jsx)("h1",{className:"mb-2 text-lg font-semibold",children:l||"Welcome"}),(0,s.jsx)("p",{className:"leading-normal text-muted-foreground",children:"You can start a conversation here or try the following examples:"}),(0,s.jsx)("div",{className:"mt-4 flex flex-col items-start space-y-2",children:ea.map((e,t)=>(0,s.jsxs)(A.z,{variant:"link",className:"h-auto p-0 text-base",onClick:()=>n(e.message),children:[(0,s.jsx)(M.IconArrowRight,{className:"mr-2 text-muted-foreground"}),(0,s.jsx)("p",{className:"text-left",children:e.heading})]},t))})]})})}var ei=t(42891),eo=t.n(ei),ed=t(23342),ec=t(94909),eu=t(74038),em=t(98454),eh=t(48537),ex=t(21540),ev=t(11208),ef=t(3448),ep=t(52569),eg=t(90168);function ej(e){let{messages:n,chatMaxWidthClass:t}=e,{isLoading:a}=l.useContext(eM);return(0,s.jsx)("div",{className:"relative mx-auto px-4 ".concat(t),children:null==n?void 0:n.map((e,t)=>{let r=t===n.length-1;return(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)(eb,{isLoading:!!r&&a,message:e,isLastItem:r}),!r&&(0,s.jsx)(ev.Z,{className:"my-4 md:my-8"})]},e.user.id)})})}function eb(e){let{message:n,isLoading:t,isLastItem:l}=e,{user:a,assistant:r}=n;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ey,{message:a}),!!r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ev.Z,{className:"my-4 md:my-8"}),(0,s.jsx)(eC,{message:r,userMessage:a,isLoading:t,userMessageId:a.id,enableRegenerating:l})]})]})}function ey(e){var n,t,a,r;let{message:i}=e,[{data:o}]=(0,em.P)(),d=i.selectContext,{onNavigateToContext:c,supportsOnApplyInEditorV2:u}=l.useContext(eM),m=l.useMemo(()=>{var e,n;if(!(null==d?void 0:d.content))return"";let t=(null==d?void 0:d.filepath)&&null!==(e=(0,x.U$)(null==d?void 0:d.filepath)[0])&&void 0!==e?e:"";return"\n```".concat(t,"\n").concat(null!==(n=null==d?void 0:d.content)&&void 0!==n?n:"","\n","```","\n")},[d]),h=null;if(m&&i.selectContext){let{range:e,filepath:n}=i.selectContext;h={filepath:n,isMultiLine:!(0,Z.Z)(null==e?void 0:e.start)&&!(0,Z.Z)(null==e?void 0:e.end)&&e.startnull==c?void 0:c(i.selectContext,{openInEditor:!0}),children:[(0,s.jsx)(M.IconFile,{className:"h-3 w-3"}),(0,s.jsxs)("p",{className:"flex-1 truncate pr-1",children:[(0,s.jsx)("span",{children:h.filepath}),(null===(t=i.selectContext)||void 0===t?void 0:null===(n=t.range)||void 0===n?void 0:n.start)&&(0,s.jsxs)("span",{children:[":",null===(a=i.selectContext)||void 0===a?void 0:a.range.start]}),h.isMultiLine&&(0,s.jsxs)("span",{children:["-",null===(r=i.selectContext)||void 0===r?void 0:r.range.end]})]})]})]}),!(null==o?void 0:o.me.name)&&(0,s.jsx)("div",{className:"editor-bg absolute right-0 top-0 -mt-0.5 block opacity-0 transition-opacity group-hover:opacity-100 md:hidden",children:(0,s.jsx)(eN,{...e})})]})]})}function eN(e){let{message:n}=e,{handleMessageAction:t,isLoading:a}=l.useContext(eM);return(0,s.jsxs)(eA,{children:[!a&&(0,s.jsxs)(A.z,{variant:"ghost",size:"icon",onClick:e=>t(n.id,"edit"),children:[(0,s.jsx)(M.IconEdit,{}),(0,s.jsx)("span",{className:"sr-only",children:"Edit message"})]}),!a&&(0,s.jsxs)(A.z,{variant:"ghost",size:"icon",onClick:e=>t(n.id,"delete"),children:[(0,s.jsx)(M.IconTrash,{}),(0,s.jsx)("span",{className:"sr-only",children:"Delete message"})]})]})}function eC(e){let{message:n,userMessage:t,isLoading:r,userMessageId:o,enableRegenerating:c,...u}=e,{onNavigateToContext:m,onApplyInEditor:h,onCopyContent:v,onLookupSymbol:p,openInEditor:g,supportsOnApplyInEditorV2:j}=l.useContext(eM),[b,y]=l.useState(void 0),N=l.useMemo(()=>{var e,t;return null!==(t=null==n?void 0:null===(e=n.relevant_code)||void 0===e?void 0:e.map(e=>{let{startLine:n,endLine:t}=(0,f.OV)(e);return{kind:"file",range:{start:n,end:t},filepath:e.filepath,content:e.content,git_url:e.gitUrl}}))&&void 0!==t?t:[]},[null==n?void 0:n.relevant_code]),C=l.useMemo(()=>{var e;return(0,d.Z)((0,a.Z)([t.activeContext,...null!==(e=null==t?void 0:t.relevantContext)&&void 0!==e?e:[]]),i.Z)},[t.activeContext,t.relevantContext]),w=(0,l.useMemo)(()=>{var e,n;let t=null!==(n=null==C?void 0:C.map(n=>({content:n.content,filepath:n.filepath,gitUrl:n.git_url,startLine:n.range.start,language:(0,x.U$)(null!==(e=n.filepath)&&void 0!==e?e:"")[0],isClient:!0})))&&void 0!==n?n:[];return t},[C]),k=(0,l.useMemo)(()=>{var e,n;let t=null!==(n=null==N?void 0:N.map(n=>({content:n.content,filepath:n.filepath,gitUrl:n.git_url,startLine:n.range.start,language:(0,x.U$)(null!==(e=n.filepath)&&void 0!==e?e:"")[0],isClient:!1})))&&void 0!==n?n:[];return(0,a.Z)([...t])},[N]);return(0,s.jsxs)("div",{className:(0,f.cn)("group relative mb-4 flex flex-col items-start gap-y-2 md:-ml-4 md:flex-row"),...u,children:[(0,s.jsxs)("div",{className:"flex min-h-[2rem] w-full items-center justify-between md:w-auto",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("div",{className:"shrink-0 select-none rounded-full border bg-background shadow",children:(0,s.jsx)(eI,{className:"h-6 w-6 md:h-8 md:w-8"})}),(0,s.jsx)("p",{className:"block text-xs font-bold md:hidden",children:"Tabby"})]}),(0,s.jsx)("div",{className:"block opacity-0 transition-opacity group-hover:opacity-100 md:hidden",children:(0,s.jsx)(ew,{message:n,userMessageId:o,enableRegenerating:c,attachmentCode:k})})]}),(0,s.jsxs)("div",{className:"w-full flex-1 space-y-2 overflow-hidden px-1 md:ml-4",children:[(0,s.jsx)(eg.q,{contexts:N,clientContexts:C,onContextClick:(e,n)=>{null==m||m(e,{openInEditor:n})},showExternalLink:!!h,isInEditor:!!h,showClientCodeIcon:!h,highlightIndex:b,triggerClassname:"md:pt-0"}),!r||(null==n?void 0:n.message)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ex.JG,{message:n.message,onApplyInEditor:h,onCopyContent:v,attachmentClientCode:w,attachmentCode:k,onCodeCitationClick:e=>{let{startLine:n,endLine:t}=(0,f.OV)(e),s={git_url:e.gitUrl,content:e.content,filepath:e.filepath,kind:"file",range:{start:n,end:t}};null==m||m(s,{openInEditor:e.isClient})},onCodeCitationMouseEnter:e=>{y(e-1-0)},onCodeCitationMouseLeave:e=>{y(void 0)},canWrapLongLines:!r,onLookupSymbol:p,openInEditor:g,supportsOnApplyInEditorV2:j,activeSelection:t.activeContext}),!!n.error&&(0,s.jsx)(ex.mE,{error:n.error})]}):(0,s.jsx)(ek,{}),(0,s.jsx)("div",{className:"hidden md:block",children:(0,s.jsx)(ew,{message:n,userMessageId:o,enableRegenerating:c,attachmentCode:k})})]})]})}function ew(e){let{handleMessageAction:n,isLoading:t,onCopyContent:r}=l.useContext(eM),{message:i,userMessageId:o,enableRegenerating:d,attachmentCode:c}=e,u=(0,l.useMemo)(()=>(function(e,n){var t;if(!n||(0,ec.Z)(n))return e;let s=e.replace(eu.H,e=>{let n=null==e?void 0:e.match(/\d+/);return"[".concat(n,"]")}).trim(),l=null!==(t=n.map((e,n)=>{let t=(0,f.tf)(e),s=(0,a.Z)([e.filepath,t]).join(":");return"[".concat(n+1,"] ").concat(s)}).join("\n"))&&void 0!==t?t:"";return"".concat(s,"\n\nCitations:\n").concat(l)})(i.message,c),[i.message,c]);return(0,s.jsxs)(eA,{children:[!t&&d&&(0,s.jsxs)(A.z,{variant:"ghost",size:"icon",onClick:e=>n(o,"regenerate"),children:[(0,s.jsx)(M.IconRefresh,{}),(0,s.jsx)("span",{className:"sr-only",children:"Regenerate message"})]}),(0,s.jsx)(eh.q,{value:u,onCopyContent:r})]})}function ek(){return(0,s.jsxs)("div",{className:"space-y-2 py-2 md:px-1 md:py-0",children:[(0,s.jsx)(ef.O,{className:"h-3 w-full"}),(0,s.jsx)(ef.O,{className:"h-3 w-full"})]})}function eI(e){let{className:n}=e;return(0,s.jsx)(eo(),{style:{backgroundColor:"#E8E2D2"},className:(0,f.cn)("rounded-full p-0.5",n),src:ed.Z,alt:"tabby"})}function eA(e){let{className:n,...t}=e;return(0,s.jsx)("div",{className:(0,f.cn)("flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-[4rem] md:-top-2 md:opacity-0",n),...t})}let eM=l.createContext({}),eE=l.forwardRef(function(e,n){let{className:t,chatId:g,initialMessages:j,onLoaded:b,onThreadUpdates:y,onNavigateToContext:N,container:C,docQuery:w,generateRelevantQuestions:k,maxWidth:I,welcomeMessage:A,promptFormClassname:M,onCopyContent:E,onSubmitMessage:S,onApplyInEditor:L,onLookupSymbol:T,openInEditor:R,chatInputRef:_,supportsOnApplyInEditorV2:z}=e,[D,Z]=l.useState(!1),[O,F]=l.useState(),U=l.useRef(!1),[P,H]=l.useState(null!=j?j:[]),[$,q]=l.useState(""),[J,W]=l.useState([]),[G,V]=l.useState(null),Y=(0,v.a)(e=>e.enableActiveSelection),B=l.useRef(null),{sendUserMessage:K,isLoading:Q,error:X,answer:en,stop:et,regenerate:es,deleteThreadMessagePair:ea}=(0,h.x)({threadId:O}),ei=async e=>{var n;if(!O)return;et();let t=P.find(n=>n.user.id===e);if(!(null==t?void 0:t.user)||!t.assistant)return;let s=P.filter(n=>n.user.id!==e);H(s),ea(O,null==t?void 0:t.user.id,null==t?void 0:null===(n=t.assistant)||void 0===n?void 0:n.id)},eo=async e=>{if(!O)return;let n=(0,r.Z)(P,n=>n.user.id===e);if(n>-1){let e=P[n];if(!e.assistant)return;let t=(0,f.x0)(),s=(0,f.x0)();H([...P.slice(0,n),{user:{...e.user,id:t},assistant:{id:s,message:"",error:void 0}}]);let[l,a]=eh(e.user,Y);return es({threadId:O,userMessageId:e.user.id,assistantMessageId:e.assistant.id,userMessage:l,threadRunOptions:a})}},ed=async e=>{var n,t;if(!O)return;let s=P.find(n=>n.user.id===e);if(!(null==s?void 0:s.user)||!s.assistant)return;let l=s.user,a=[];(null===(n=l.relevantContext)||void 0===n?void 0:n.length)&&(a=a.concat(l.relevantContext)),W((0,d.Z)(a,i.Z));let r=P.filter(n=>n.user.id!==e);H(r),q(l.message),l.activeContext&&N(l.activeContext,{openInEditor:!0}),ea(O,null==s?void 0:s.user.id,null==s?void 0:null===(t=s.assistant)||void 0===t?void 0:t.id)},ec=async()=>{if(!(null==P?void 0:P.length))return;let e=P[P.length-1].user.id;return eo(e)},eu=()=>{et(!0),H([]),F(void 0)};l.useEffect(()=>{if(!Q||!(null==P?void 0:P.length)||!en)return;let e=P[P.length-1];en.threadId&&!O&&F(en.threadId),H(n=>{var t,s;let l=n[n.length-1].assistant,a={...l,id:en.assistantMessageId||(null==l?void 0:l.id)||(0,f.x0)(),message:en.content,error:void 0,relevant_code:null!==(s=null===(t=en.attachmentsCode)||void 0===t?void 0:t.map(e=>e.code))&&void 0!==s?s:[]};return[...n.slice(0,n.length-1),{user:{...e.user,id:(null==en?void 0:en.userMessageId)||e.user.id},assistant:a}]})},[en,Q]);let em=(0,u.S)(()=>{C?C.scrollTo({top:C.scrollHeight,behavior:"smooth"}):window.scrollTo({top:document.body.offsetHeight,behavior:"smooth"})},100);l.useLayoutEffect(()=>{Q&&em.run()},[Q]),l.useEffect(()=>{X&&(null==P?void 0:P.length)&&H(e=>{var n,t,s;let l=e[e.length-1];return[...e.slice(0,e.length-1),{...l,assistant:{...l.assistant,id:(null===(n=l.assistant)||void 0===n?void 0:n.id)||(0,f.x0)(),message:null!==(s=null===(t=l.assistant)||void 0===t?void 0:t.message)&&void 0!==s?s:"",error:X?"401"===X.message?"Unauthorized":(0,o.Z)(X.graphQLErrors,e=>{var n;return(null===(n=e.extensions)||void 0===n?void 0:n.code)===c.ir})?"The thread has expired, please click 'Clear' and try again.":X.message||"Failed to fetch":"Failed to fetch"}}]}),(null==X?void 0:X.message)!=="Thread not found"||(null==P?void 0:P.length)||eu()},[X]);let eh=(e,n)=>{var t,s;let l=e.selectContext;n&&(l=l||e.activeContext),!function(e){if(!e)return!1;let n=e.filepath.startsWith("untitled:")&&!(0,x.U$)(e.filepath)[0];return!n}(l)&&(l=void 0);let r=l?{content:null!==(t=l.content)&&void 0!==t?t:"",filepath:l.filepath,language:l.filepath&&(0,x.U$)(l.filepath)[0]||"plaintext",gitUrl:null!==(s=null==l?void 0:l.git_url)&&void 0!==s?s:""}:null,o=n&&!!e.activeContext,c=(0,d.Z)((0,a.Z)([o&&e.activeContext,...(null==e?void 0:e.relevantContext)||[]]),i.Z),u=c.map(e=>({content:e.content,filepath:e.filepath,startLine:e.range.start})),m=e.message;return[{content:m,attachments:{code:u}},{docQuery:w?{content:m,searchPublic:!1}:null,generateRelevantQuestions:!!k,codeQuery:r}]},ex=(0,m.d)(async e=>{var n,t,s,l,a;if(Q)return;let r="",i=null==e?void 0:null===(n=e.selectContext)||void 0===n?void 0:n.content;if(i){let n=(null==e?void 0:null===(t=e.selectContext)||void 0===t?void 0:t.filepath)&&null!==(l=(0,x.U$)(null==e?void 0:null===(s=e.selectContext)||void 0===s?void 0:s.filepath)[0])&&void 0!==l?l:"";r="\n```".concat(n,"\n").concat(null!=i?i:"","\n","```","\n")}let o=G||e.activeContext,d={...e,message:e.message+r,id:null!==(a=e.id)&&void 0!==a?a:(0,f.x0)(),selectContext:e.selectContext,activeContext:Y&&o?o:void 0},c=[...P,{user:d,assistant:{id:(0,f.x0)(),message:"",error:void 0}}];H(c),K(...eh(d,Y))}),ev=e=>{var n;return null===(n=ex.current)||void 0===n?void 0:n.call(ex,e)},ef=async e=>{S?S(e,J):ev({message:e,relevantContext:J}),W([])},ep=(0,m.d)(e=>{W(n=>n.some(n=>(0,i.Z)(n,e))?n:n.concat([e]))}),eg=e=>{var n;null===(n=ep.current)||void 0===n||n.call(ep,e)};l.useEffect(()=>{U.current&&(null==y||y(P))},[P]);let eb=(0,u.S)(e=>{V(e)},300),ey=e=>{eb.run(e)};l.useImperativeHandle(n,()=>({sendUserChat:ev,stop:et,isLoading:Q,addRelevantContext:eg,focus:()=>{var e;return null===(e=B.current)||void 0===e?void 0:e.focus()},updateActiveSelection:ey}),[]),l.useEffect(()=>{Z(!0),null==b||b()},[]);let eN=I?"max-w-".concat(I):"max-w-2xl";return D?(0,s.jsx)(eM.Provider,{value:{threadId:O,isLoading:Q,qaPairs:P,onNavigateToContext:N,handleMessageAction:(e,n)=>{switch(n){case"delete":ei(e);break;case"regenerate":eo(e);break;case"edit":ed(e)}},onClearMessages:eu,container:C,onCopyContent:E,onApplyInEditor:L,onLookupSymbol:T,openInEditor:R,relevantContext:J,removeRelevantContext:e=>{let n=[...J];n.splice(e,1),W(n)},chatInputRef:_,activeSelection:G,supportsOnApplyInEditorV2:z},children:(0,s.jsx)("div",{className:"flex justify-center overflow-x-hidden",children:(0,s.jsxs)("div",{className:"w-full px-4 md:pl-10 md:pr-[3.75rem] ".concat(eN),children:[(0,s.jsxs)("div",{className:(0,f.cn)("pb-[200px] pt-4 md:pt-10",t),children:[(null==P?void 0:P.length)?(0,s.jsx)(ej,{messages:P,chatMaxWidthClass:eN}):(0,s.jsx)(er,{setInput:q,chatMaxWidthClass:eN,welcomeMessage:A}),(0,s.jsx)(el,{trackVisibility:Q})]}),(0,s.jsx)(ee,{onSubmit:ef,className:(0,f.cn)("fixed inset-x-0 bottom-0",M),id:g,stop:()=>{et()},reload:ec,input:$,setInput:q,chatMaxWidthClass:eN,ref:B,chatInputRef:_})]})})}):(0,s.jsx)(p.cg,{className:"".concat(eN," mx-auto pt-4 md:pt-10")})})},90168:function(e,n,t){"use strict";t.d(n,{q:function(){return v}});var s=t(36164),l=t(3546),a=t(74630),r=t(1544),i=t(29),o=t(43739),d=t(14079);let c=o.fC,u=l.forwardRef((e,n)=>{let{className:t,...l}=e;return(0,s.jsx)(o.ck,{ref:n,className:(0,r.cn)("border-b",t),...l})});u.displayName="AccordionItem";let m=l.forwardRef((e,n)=>{let{className:t,children:l,...a}=e;return(0,s.jsxs)(o.xz,{ref:n,className:(0,r.cn)("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[l,(0,s.jsx)(d.Z,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})});m.displayName=o.xz.displayName;let h=l.forwardRef((e,n)=>{let{className:t,children:l,...a}=e;return(0,s.jsx)(o.VY,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:(0,s.jsx)("div",{className:(0,r.cn)("pb-4 pt-0",t),children:l})})});h.displayName=o.VY.displayName;var x=t(81565);let v=(0,l.forwardRef)((e,n)=>{var t,a;let{contexts:i,clientContexts:o,className:d,triggerClassname:x,onContextClick:v,enableTooltip:p,onTooltipClick:g,highlightIndex:j,showExternalLink:b,showClientCodeIcon:y,isInEditor:N}=e,C=((null==o?void 0:o.length)||0)+i.length,w=null!==(t=null==i?void 0:i.length)&&void 0!==t?t:0,k=null!==(a=null==o?void 0:o.length)&&void 0!==a?a:0,I=w+k,[A,M]=(0,l.useState)(I<=5?"references":void 0);return((0,l.useEffect)(()=>{I<=5?M("references"):M(void 0)},[I]),0===C)?null:(0,s.jsx)(c,{type:"single",collapsible:!0,className:(0,r.cn)("bg-transparent text-foreground",d),ref:n,value:A,onValueChange:M,children:(0,s.jsxs)(u,{value:"references",className:"my-0 border-0",children:[(0,s.jsx)(m,{className:(0,r.cn)("my-0 py-2 font-semibold",x),children:(0,s.jsx)("span",{className:"mr-2",children:"Read ".concat(C," file").concat(C>1?"s":"")})}),(0,s.jsxs)(h,{className:"space-y-2",children:[null==o?void 0:o.map((e,n)=>(0,s.jsx)(f,{context:e,onContextClick:e=>null==v?void 0:v(e,!0),isHighlighted:j===n,clickable:N||!!e.git_url,showClientCodeIcon:y},"user-".concat(n))),i.map((e,n)=>(0,s.jsx)(f,{context:e,onContextClick:e=>null==v?void 0:v(e,!1),enableTooltip:p,onTooltipClick:g,showExternalLinkIcon:b,isHighlighted:j===n+((null==o?void 0:o.length)||0)},"assistant-".concat(n)))]})]})})});function f(e){var n,t,o,d,c,u,m;let{context:h,clickable:v=!0,onContextClick:f,enableTooltip:p,onTooltipClick:g,showExternalLinkIcon:j,showClientCodeIcon:b,isHighlighted:y}=e,[N,C]=(0,l.useState)(!1),w=!(0,a.Z)(null===(n=h.range)||void 0===n?void 0:n.start)&&!(0,a.Z)(null===(t=h.range)||void 0===t?void 0:t.end)&&h.range.start{p&&M&&C(e)},delayDuration:0,children:[(0,s.jsx)(i.aJ,{asChild:!0,children:(0,s.jsx)("div",{className:(0,r.cn)("rounded-md border p-2",{"cursor-pointer hover:bg-accent":v,"cursor-default pointer-events-auto":!v,"bg-accent transition-all":y}),onClick:e=>v&&(null==f?void 0:f(h)),children:(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden",children:[(0,s.jsx)(x.IconFile,{className:"shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 truncate",title:h.filepath,children:[(0,s.jsx)("span",{children:I}),(null===(d=h.range)||void 0===d?void 0:d.start)&&(0,s.jsxs)("span",{className:"text-muted-foreground",children:[":",h.range.start]}),w&&(0,s.jsxs)("span",{className:"text-muted-foreground",children:["-",h.range.end]}),(0,s.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:A})]}),b&&(0,s.jsx)(x.IconFileSearch2,{className:"shrink-0 text-muted-foreground"}),j&&(0,s.jsx)(x.IconExternalLink,{className:"shrink-0 text-muted-foreground"})]})})}),(0,s.jsx)(i._v,{align:"start",onClick:g,className:"cursor-pointer p-2",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-2 font-semibold",children:"Scores"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)("span",{className:"w-20",children:"rrf:"}),null!==(c=null==M?void 0:M.rrf)&&void 0!==c?c:"-"]}),(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)("span",{className:"w-20",children:"bm25:"}),null!==(u=null==M?void 0:M.bm25)&&void 0!==u?u:"-"]}),(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)("span",{className:"w-20",children:"embedding:"}),null!==(m=null==M?void 0:M.embedding)&&void 0!==m?m:"-"]})]})]})})]})}v.displayName="CodeReferences"},73033:function(e,n,t){"use strict";t.d(n,{s:function(){return r}});var s=t(36164),l=t(3546),a=t(52991);let r=(0,l.memo)(e=>(0,s.jsx)(a.D,{linkTarget:"_blank",...e}),(e,n)=>e.children===n.children&&e.className===n.className)},83171:function(e,n,t){"use strict";t.d(n,{p:function(){return o},t:function(){return d}});var s=t(36164);t(3546);var l=t(68035),a=t(18500),r=t(1544),i=t(81565);function o(e){let{kind:n,label:t,className:a}=e;return(0,s.jsxs)(l.T5,{as:"span",className:(0,r.cn)("source-mention rounded-sm px-1",a),children:[(0,s.jsx)(c,{kind:n,className:"self-center"}),(0,s.jsx)("span",{className:"whitespace-nowrap",children:t})]})}function d(e){let{kind:n,label:t,id:l}=e.node.attrs;return(0,s.jsx)(o,{kind:n,label:t,id:l})}function c(e){let{kind:n,...t}=e;switch(n){case a.ri.Doc:return(0,s.jsx)(i.IconEmojiBook,{...t});case a.ri.Web:return(0,s.jsx)(i.IconEmojiGlobe,{...t});case a.ri.Git:return(0,s.jsx)(i.IconCode,{...t});case a.ri.Github:return(0,s.jsx)(i.IconGitHub,{...t});case a.ri.Gitlab:return(0,s.jsx)(i.IconGitLab,{...t});default:return null}}},21540:function(e,n,t){"use strict";t.d(n,{mE:function(){return D},JG:function(){return z},V$:function(){return P}});var s=t(36164),l=t(3546),a=t(42891),r=t.n(a),i={src:"/_next/static/media/default-favicon.a2df8fbb.png",height:16,width:16,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAABAElEQVR42mOAAqaMgrXeIYlL2jwjF7WZey7wBolB5eyZotNX1PdMO/Br466r/89dfvx/w7aLv6LSlteDFem5zPPesPXir20Hbv7ftPfGrz9///969urL/xkLj/0KjlvqzZCct6rt9r3X/w+cvP/r8fOP/0Hg/uN3vzbsvPq/rmVzG0Nk+oq2J8/f///89devOw/f/n/7/uv/T19+/Dpx7uH/3NK1bQwMarO8tu66/Auk89qd17/mrzn/682H7//3H7rxi4FhsheDDYMhU0DC0vqde6/+On/lyf/5q878X7Tq9M+E7JX1cJ/4MpgzMajO9ApNXtoWl7mszc5nvhdMEgB1uZJfA01kRAAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:8},o=t(62226),d=t.n(o),c=t(6797),u=t.n(c),m=t(1853),h=t(74630),x=t(66686),v=t(36982),f=t(93668),p=t(1544),g=t(90615),j=t(73033);t(80804);var b=t(74038),y=t(83171),N=t(63795),C=t(81565),w=t(3448),k=t(94744),I=t(37064),A=t(83008),M=t(28312),E=t(31458),S=t(29);let L=(0,l.memo)(e=>{let{language:n,value:t,onCopyContent:a,onApplyInEditor:r,canWrapLongLines:i,supportsOnApplyInEditorV2:o}=e,[d,c]=(0,l.useState)(!1),{isCopied:u,copyToClipboard:m}=(0,M.m)({timeout:2e3,onCopyContent:a});return(0,s.jsxs)("div",{className:"codeblock relative w-full bg-zinc-950 font-sans",children:[(0,s.jsxs)("div",{className:"flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100",children:[(0,s.jsx)("span",{className:"text-xs lowercase",children:n}),(0,s.jsxs)("div",{className:"flex items-center space-x-1",children:[i&&(0,s.jsxs)(S.u,{children:[(0,s.jsx)(S.aJ,{asChild:!0,children:(0,s.jsx)(E.z,{size:"icon",variant:"ghost",className:"text-xs hover:bg-[#3C382F] hover:text-[#F4F4F5] focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>c(!d),children:d?(0,s.jsx)(C.IconAlignJustify,{}):(0,s.jsx)(C.IconWrapText,{})})}),(0,s.jsx)(S._v,{children:(0,s.jsx)("p",{className:"m-0",children:"Toggle word wrap"})})]}),o&&r&&(0,s.jsxs)(S.u,{children:[(0,s.jsx)(S.aJ,{asChild:!0,children:(0,s.jsxs)(E.z,{variant:"ghost",size:"icon",className:"text-xs hover:bg-[#3C382F] hover:text-[#F4F4F5] focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>r(t,{languageId:n,smart:!0}),children:[(0,s.jsx)(C.IconSmartApplyInEditor,{}),(0,s.jsx)("span",{className:"sr-only",children:"Smart Apply in Editor"})]})}),(0,s.jsx)(S._v,{children:(0,s.jsx)("p",{className:"m-0",children:"Smart Apply in Editor"})})]}),r&&(0,s.jsxs)(S.u,{children:[(0,s.jsx)(S.aJ,{asChild:!0,children:(0,s.jsxs)(E.z,{variant:"ghost",size:"icon",className:"text-xs hover:bg-[#3C382F] hover:text-[#F4F4F5] focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>r(t,void 0),children:[(0,s.jsx)(C.IconApplyInEditor,{}),(0,s.jsx)("span",{className:"sr-only",children:"Apply in Editor"})]})}),(0,s.jsx)(S._v,{children:(0,s.jsx)("p",{className:"m-0",children:"Apply in Editor"})})]}),(0,s.jsxs)(S.u,{children:[(0,s.jsx)(S.aJ,{asChild:!0,children:(0,s.jsxs)(E.z,{variant:"ghost",size:"icon",className:"text-xs hover:bg-[#3C382F] hover:text-[#F4F4F5] focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>{u||m(t)},children:[u?(0,s.jsx)(C.IconCheck,{}):(0,s.jsx)(C.IconCopy,{}),(0,s.jsx)("span",{className:"sr-only",children:"Copy"})]})}),(0,s.jsx)(S._v,{children:(0,s.jsx)("p",{className:"m-0",children:"Copy"})})]})]})]}),(0,s.jsx)(k.Z,{language:"toml"===n?"bash":n,style:A.RY,PreTag:"div",showLineNumbers:!0,wrapLongLines:d,customStyle:{margin:0,width:"100%",background:"transparent",padding:"1.5rem 1rem"},codeTagProps:{style:{fontSize:"0.9rem",fontFamily:"var(--font-mono)"}},renderer:e=>{let{rows:n,stylesheet:t,useInlineStyles:s}=e;return n.map((e,n)=>{let l=e.children,a=null==l?void 0:l.shift();return a&&(e.children=[a,{children:l,properties:{className:[]},tagName:"span",type:"element"}]),(0,I.ZP)({node:e,stylesheet:t,useInlineStyles:s,key:n})})},children:t})]})});L.displayName="CodeBlock";let T=(0,l.createContext)({});function R(e){var n;let{inline:t,className:a,children:r,...i}=e,{lookupSymbol:o,openInEditor:d,canWrapLongLines:c,onApplyInEditor:u,onCopyContent:m,supportsOnApplyInEditorV2:h,symbolPositionMap:x}=(0,l.useContext)(T),v=null===(n=r[0])||void 0===n?void 0:n.toString(),f=v?x.get(v):void 0;if((0,l.useEffect)(()=>{t&&o&&v&&o(v)},[t,v,o]),r.length){if("▍"===r[0])return(0,s.jsx)("span",{className:"mt-1 animate-pulse cursor-default",children:"▍"});r[0]=r[0].replace("`▍`","▍")}if(t){let e=!!(null==f?void 0:f.target);return(0,s.jsxs)("code",{className:(0,p.cn)("group/symbol",a,{symbol:!!o,"bg-muted leading-5 py-0.5":!!o&&!e,"inline-flex items-center gap-1 cursor-pointer hover:bg-muted/50 border":e}),onClick:()=>{e&&d&&(null==f?void 0:f.target)&&d(f.target)},...i,children:[e&&(0,s.jsx)(C.IconSquareChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),(0,s.jsx)("span",{className:(0,p.cn)("self-baseline",{"group-hover/symbol:text-primary":e}),children:r})]})}let g=/language-(\w+)/.exec(a||"");return(0,s.jsx)(L,{language:g&&g[1]||"",value:String(r).replace(/\n$/,""),onApplyInEditor:u,onCopyContent:m,canWrapLongLines:c,supportsOnApplyInEditorV2:h})}let _=e=>{let n=d().sanitize(e,{ALLOWED_TAGS:[],ALLOWED_ATTR:[]}),t=x.TU.parse(n),s=u().decode(t),l=s.replace(/<\/?[^>]+(>|$)/g,"");return l};function z(e){let{message:n,headline:t=!1,attachmentDocs:a,attachmentClientCode:r,attachmentCode:i,onApplyInEditor:o,onCopyContent:d,contextInfo:c,fetchingContextInfo:u,className:x,canWrapLongLines:g,onLookupSymbol:y,openInEditor:N,supportsOnApplyInEditorV2:C,activeSelection:w,...k}=e,[I,A]=(0,l.useState)(new Map),M=(0,l.useMemo)(()=>{var e,n,t;let s=null!==(e=null==a?void 0:a.map(e=>({type:"doc",data:e})))&&void 0!==e?e:[],l=null!==(n=null==r?void 0:r.map(e=>({type:"code",data:e})))&&void 0!==n?n:[],o=null!==(t=null==i?void 0:i.map(e=>({type:"code",data:e})))&&void 0!==t?t:[];return(0,m.Z)([...s,...l,...o])},[a,r,i]),E=e=>{let n;let l=[],a=0,r=e=>{e&&l.push(e)},i=(t,i,o)=>{for(;null!==(n=t.exec(e));)r(e.slice(a,n.index)),l.push((0,s.jsx)(i,{...o(n)},n.index)),a=n.index+n[0].length};return i(b.H,Z,e=>{let n=parseInt(e[1],10),t=(0,h.Z)(n)?void 0:null==M?void 0:M[n-1],s=null==t?void 0:t.type,l=t&&!(0,h.Z)(n);return{citationIndex:n,showcitation:l,citationType:s,citationSource:t}}),i(b.z,O,e=>{let n=e[1];return{sourceId:n,className:t?"text-[1rem] font-semibold":void 0}}),r(e.slice(a)),l},S=async e=>{if(!y||I.has(e))return;A(n=>new Map(n.set(e,void 0)));let n=[];if(w){let e;e=w.git_url.length>1&&!w.filepath.includes(":")?{kind:"git",filepath:w.filepath,gitUrl:w.git_url}:{kind:"uri",uri:w.filepath},n.push({filepath:e,location:{start:w.range.start,end:w.range.end}})}let t=await y(e,n);A(n=>new Map(n.set(e,t)))};return(0,s.jsx)(T.Provider,{value:{onCopyContent:d,onApplyInEditor:o,onCodeCitationClick:k.onCodeCitationClick,onCodeCitationMouseEnter:k.onCodeCitationMouseEnter,onCodeCitationMouseLeave:k.onCodeCitationMouseLeave,contextInfo:c,fetchingContextInfo:!!u,canWrapLongLines:!!g,supportsOnApplyInEditorV2:C,activeSelection:w,symbolPositionMap:I,lookupSymbol:y?S:void 0,openInEditor:N},children:(0,s.jsx)(j.s,{className:(0,p.cn)("message-markdown prose max-w-none break-words dark:prose-invert prose-p:leading-relaxed prose-pre:mt-1 prose-pre:p-0",{"cursor-default":!!o},x),remarkPlugins:[v.Z,f.Z],components:{p(e){let{children:n}=e;return(0,s.jsx)("p",{className:"mb-2 last:mb-0",children:n.map((e,n)=>"string"==typeof e?E(e):(0,s.jsx)("span",{children:e},n))})},li(e){let{children:n}=e;return n&&n.length?(0,s.jsx)("li",{children:n.map((e,n)=>"string"==typeof e?E(e):(0,s.jsx)("span",{children:e},n))}):(0,s.jsx)("li",{children:n})},code(e){let{node:n,inline:t,className:l,children:a,...r}=e;return(0,s.jsx)(R,{node:n,inline:t,className:l,...r,children:a})}},children:n})})}function D(e){let{error:n="Failed to fetch"}=e,t=(0,l.useMemo)(()=>"```\n"+JSON.stringify({error:!0,message:n},null,2)+"\n```",[n]);return(0,s.jsx)(j.s,{className:"prose-full-width prose break-words text-sm dark:prose-invert prose-p:leading-relaxed prose-pre:mt-1 prose-pre:p-0",remarkPlugins:[v.Z,f.Z],components:{code(e){let{node:n,inline:t,className:l,children:a,...r}=e;return(0,s.jsx)("div",{...r,className:(0,p.cn)(l,"bg-zinc-950 p-2"),children:a})}},children:t})}function Z(e){let{citationIndex:n,showcitation:t,citationType:l,citationSource:a}=e;return(0,s.jsx)("div",{className:"inline",children:t&&(0,s.jsx)(s.Fragment,{children:"doc"===l?(0,s.jsx)(F,{relevantDocument:a.data,citationIndex:n}):"code"===l?(0,s.jsx)(U,{relevantCode:a.data,citationIndex:n}):null})})}function O(e){var n;let{sourceId:t,className:a}=e,{contextInfo:r,fetchingContextInfo:i}=(0,l.useContext)(T);if(!t)return null;let o=null==r?void 0:null===(n=r.sources)||void 0===n?void 0:n.find(e=>e.sourceId===t);return o?(0,s.jsx)("span",{className:"node-mention",children:(0,s.jsx)("span",{children:i?(0,s.jsx)(w.O,{className:"w-16"}):(0,s.jsx)(y.p,{id:o.sourceId,label:o.sourceName,kind:o.sourceKind,className:a})})}):null}function F(e){let{relevantDocument:n,citationIndex:t}=e,l=n?new URL(n.link):null,a=(null==n?void 0:n.__typename)==="MessageAttachmentIssueDoc",r=(null==n?void 0:n.__typename)==="MessageAttachmentPullDoc";return(0,s.jsxs)(g.zs,{children:[(0,s.jsx)(g.Yi,{children:(0,s.jsx)("span",{className:"relative -top-2 mr-0.5 inline-block h-4 w-4 cursor-pointer rounded-full bg-muted text-center text-xs font-medium",onClick:()=>window.open(n.link),children:t})}),(0,s.jsx)(g.bZ,{className:"w-96 text-sm",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-y-1",children:[(0,s.jsxs)("div",{className:"m-0 flex items-center space-x-1 text-xs leading-none text-muted-foreground",children:[(0,s.jsx)(P,{hostname:l.hostname,className:"m-0 mr-1 leading-none"}),(0,s.jsx)("p",{className:"m-0 leading-none",children:l.hostname})]}),(0,s.jsx)("p",{className:"m-0 cursor-pointer font-bold leading-none transition-opacity hover:opacity-70",onClick:()=>window.open(n.link),children:n.title}),(0,s.jsxs)("div",{className:"mb-2 w-auto",children:[a&&(0,s.jsx)(H,{closed:n.closed}),r&&(0,s.jsx)($,{merged:n.merged})]}),(0,s.jsx)("p",{className:"m-0 line-clamp-4 leading-none",children:_((0,p.L5)(n))})]})})]})}function U(e){let{relevantCode:n,citationIndex:t}=e,{onCodeCitationClick:a,onCodeCitationMouseEnter:r,onCodeCitationMouseLeave:i}=(0,l.useContext)(T);return(0,s.jsx)("span",{className:"relative -top-2 mr-0.5 inline-block h-4 w-4 cursor-pointer rounded-full bg-muted text-center text-xs font-medium",onClick:()=>{null==a||a(n)},onMouseEnter:()=>{null==r||r(t)},onMouseLeave:()=>{null==i||i(t)},children:t})}function P(e){let{hostname:n,className:t}=e,[a,o]=(0,l.useState)(!1);return(0,s.jsxs)("div",{className:"relative h-3.5 w-3.5 shrink-0",children:[(0,s.jsx)(r(),{src:i,alt:n,width:14,height:14,className:(0,p.cn)("absolute left-0 top-0 z-0 h-3.5 w-3.5 rounded-full leading-none",t)}),(0,s.jsx)(r(),{src:"https://s2.googleusercontent.com/s2/favicons?sz=128&domain_url=".concat(n),alt:n,width:14,height:14,className:(0,p.cn)("relative z-10 h-3.5 w-3.5 rounded-full bg-card leading-none",t,{"opacity-0":!a}),onLoad:()=>{o(!0)}})]})}function H(e){let{closed:n}=e;return(0,s.jsxs)(N.C,{variant:n?"default":"secondary",className:"gap-1 py-1 text-xs",children:[n?(0,s.jsx)(C.IconCheckCircled,{className:"h-3.5 w-3.5"}):(0,s.jsx)(C.IconCircleDot,{className:"h-3.5 w-3.5"}),n?"Closed":"Open"]})}function $(e){let{merged:n}=e;return(0,s.jsxs)(N.C,{variant:n?"default":"secondary",className:"gap-1 py-1 text-xs",children:[n?(0,s.jsx)(C.IconGitMerge,{className:"h-3.5 w-3.5"}):(0,s.jsx)(C.IconGitPullRequest,{className:"h-3.5 w-3.5"}),n?"Merged":"Open"]})}},63795:function(e,n,t){"use strict";t.d(n,{C:function(){return i}});var s=t(36164);t(3546);var l=t(14375),a=t(1544);let r=(0,l.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",successful:"border-transparent bg-successful text-successful-foreground hover:bg-successful/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function i(e){let{className:n,variant:t,...l}=e;return(0,s.jsx)("div",{className:(0,a.cn)(r({variant:t}),n),...l})}},90615:function(e,n,t){"use strict";t.d(n,{Yi:function(){return o},bZ:function(){return d},zs:function(){return i}});var s=t(36164),l=t(3546),a=t(38421),r=t(1544);let i=a.fC,o=a.xz,d=l.forwardRef((e,n)=>{let{className:t,align:l="center",sideOffset:i=4,...o}=e;return(0,s.jsx)(a.VY,{ref:n,align:l,sideOffset:i,className:(0,r.cn)("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...o})});d.displayName=a.VY.displayName},52569:function(e,n,t){"use strict";t.d(n,{SQ:function(){return y},Yt:function(){return b},nY:function(){return j}});var s=t(36164),l=t(3546),a=t(87782),r=t(21454),i=t(36327),o=t(98454),d=t(3765),c=t(1544),u=t(66612);let m=l.forwardRef((e,n)=>{let{className:t,...l}=e;return(0,s.jsx)(u.fC,{ref:n,className:(0,c.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...l})});m.displayName=u.fC.displayName;let h=l.forwardRef((e,n)=>{let{className:t,...l}=e;return(0,s.jsx)(u.Ee,{ref:n,className:(0,c.cn)("aspect-square h-full w-full",t),...l})});h.displayName=u.Ee.displayName;let x=l.forwardRef((e,n)=>{let{className:t,...l}=e;return(0,s.jsx)(u.NY,{ref:n,className:(0,c.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...l})});x.displayName=u.NY.displayName;var v=t(3448),f=t(30410).lW;let p="not_found",g=new Set,j=e=>{g.delete(e),(0,r.JG)("/avatar/".concat(e))};function b(e){var n;let{user:t,className:r,fallback:o}=e,u=null==t?void 0:t.id,j=u?"/avatar/".concat(u):null,{data:b,isLoading:y,error:N}=(0,i.Z)(j,e=>{if(!(!u||g.has(u)))return(0,d.Z)(e,{responseFormatter:async e=>{let n=await e.blob(),t=f.from(await n.arrayBuffer());return"data:image/png;base64,".concat(t.toString("base64"))},errorHandler:e=>{if(404===e.status)throw Error(p)}})}),C=l.useMemo(()=>{if(null==t?void 0:t.email)return(0,a.B)(t.email)},[null==t?void 0:t.email]);return y?(0,s.jsx)(v.O,{className:(0,c.cn)("h-16 w-16 rounded-full",r)}):((null==N?void 0:N.message)===p&&u&&g.add(u),b||C||!o)?!b&&C?(0,s.jsx)(a.Z,{className:(0,c.cn)("h-16 w-16",r),...C}):(0,s.jsxs)(m,{className:(0,c.cn)("h-16 w-16",r),children:[(0,s.jsx)(h,{src:b,alt:null==t?void 0:t.email,className:"object-cover"}),(0,s.jsx)(x,{children:null==t?void 0:null===(n=t.email)||void 0===n?void 0:n.substring(0,2)})]}):o}function y(e){let[{data:n}]=(0,o.P)();return(0,s.jsx)(b,{user:null==n?void 0:n.me,...e})}},21808:function(e,n,t){"use strict";t.d(n,{$6:function(){return a},$I:function(){return r},L8:function(){return l},ir:function(){return i},o0:function(){return s}});let s="name@yourcompany.com",l=20,a={DEMO_AUTO_LOGIN:"_tabby_demo_autologin",SEARCH_INITIAL_MSG:"_tabby_search_initial_msg",SEARCH_INITIAL_CONTEXTS:"_tabby_search_initial_contexts"},r=48,i="NOT_FOUND"},12624:function(e,n,t){"use strict";t.d(n,{e:function(){return a}});var s=t(3546),l=t(62940);function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0,[t,a]=s.useState(!1);return s.useEffect(()=>{if(n)return;let t=(0,l.Z)(()=>{a(window.innerHeight+window.scrollY>=document.body.offsetHeight-e)},100,{leading:!0});return window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),t(),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e,n]),s.useEffect(()=>{if(!n)return;let t=(0,l.Z)(()=>{let{scrollTop:t,clientHeight:s,scrollHeight:l}=n;a(t+s>=l-e)},100,{leading:!0});return n.addEventListener("scroll",t,{passive:!0}),n.addEventListener("resize",t,{passive:!0}),t(),()=>{n.removeEventListener("scroll",t),n.removeEventListener("resize",t)}},[e,n]),t}},64566:function(e,n,t){"use strict";t.d(n,{x:function(){return u}});var s=t(3546),l=t(43240),a=t(11634),r=t(16784);let i=(0,l.BX)("\n subscription CreateThreadAndRun($input: CreateThreadAndRunInput!) {\n createThreadAndRun(input: $input) {\n __typename\n ... on ThreadCreated {\n id\n }\n ... on ThreadUserMessageCreated {\n id\n }\n ... on ThreadAssistantMessageCreated {\n id\n }\n ... on ThreadRelevantQuestions {\n questions\n }\n ... on ThreadAssistantMessageAttachmentsCode {\n hits {\n code {\n gitUrl\n filepath\n language\n content\n startLine\n }\n scores {\n rrf\n bm25\n embedding\n }\n }\n }\n ... on ThreadAssistantMessageAttachmentsDoc {\n hits {\n doc {\n __typename\n ... on MessageAttachmentWebDoc {\n title\n link\n content\n }\n ... on MessageAttachmentIssueDoc {\n title\n link\n body\n closed\n }\n ... on MessageAttachmentPullDoc {\n title\n link\n body\n merged\n }\n }\n score\n }\n }\n ... on ThreadAssistantMessageContentDelta {\n delta\n }\n ... on ThreadAssistantMessageCompleted {\n id\n }\n }\n }\n"),o=(0,l.BX)("\n subscription CreateThreadRun($input: CreateThreadRunInput!) {\n createThreadRun(input: $input) {\n __typename\n ... on ThreadCreated {\n id\n }\n ... on ThreadUserMessageCreated {\n id\n }\n ... on ThreadAssistantMessageCreated {\n id\n }\n ... on ThreadRelevantQuestions {\n questions\n }\n ... on ThreadAssistantMessageAttachmentsCode {\n hits {\n code {\n gitUrl\n filepath\n language\n content\n startLine\n }\n scores {\n rrf\n bm25\n embedding\n }\n }\n }\n ... on ThreadAssistantMessageAttachmentsDoc {\n hits {\n doc {\n __typename\n ... on MessageAttachmentWebDoc {\n title\n link\n content\n }\n ... on MessageAttachmentIssueDoc {\n title\n link\n body\n closed\n }\n ... on MessageAttachmentPullDoc {\n title\n link\n body\n merged\n }\n }\n score\n }\n }\n ... on ThreadAssistantMessageContentDelta {\n delta\n }\n ... on ThreadAssistantMessageCompleted {\n id\n }\n }\n }\n"),d=(0,l.BX)("\n mutation DeleteThreadMessagePair(\n $threadId: ID!\n $userMessageId: ID!\n $assistantMessageId: ID!\n ) {\n deleteThreadMessagePair(\n threadId: $threadId\n userMessageId: $userMessageId\n assistantMessageId: $assistantMessageId\n )\n }\n"),c=()=>({content:"",completed:!1});function u(e){let{threadId:n,onAssistantMessageCompleted:t}=e,[l,u]=s.useState(n),m=s.useRef(),[h,x]=s.useState(!1),[v,f]=s.useState(c()),[p,g]=s.useState(),j=(e,n)=>{let t={...e};switch(n.__typename){case"ThreadCreated":t.threadId=n.id;break;case"ThreadUserMessageCreated":t.userMessageId=n.id;break;case"ThreadAssistantMessageCreated":t.assistantMessageId=n.id;break;case"ThreadRelevantQuestions":t.relevantQuestions=n.questions;break;case"ThreadAssistantMessageAttachmentsCode":t.attachmentsCode=n.hits;break;case"ThreadAssistantMessageAttachmentsDoc":t.attachmentsDoc=n.hits;break;case"ThreadAssistantMessageContentDelta":t.content+=n.delta;break;case"ThreadAssistantMessageCompleted":t.completed=!0;break;default:throw Error("Unknown event "+JSON.stringify(t))}return t},b=(0,r.d)(e=>{var n;null===(n=m.current)||void 0===n||n.call(m),m.current=void 0,x(!1),!e&&l&&(null==t||t(v))});s.useEffect(()=>{n!==l&&u(n)},[n]);let y=(e,n)=>{let{unsubscribe:t}=a.Lp.subscription(i,{input:{thread:{userMessage:e},options:n}}).subscribe(e=>{var n;if(null==e?void 0:e.error){x(!1),g(e.error),t();return}let s=null===(n=e.data)||void 0===n?void 0:n.createThreadAndRun;s&&((null==s?void 0:s.__typename)==="ThreadAssistantMessageCompleted"&&b.current(),(null==s?void 0:s.__typename)==="ThreadCreated"&&s.id!==l&&u(s.id),f(e=>j(e,s)))});return t},N=(e,n)=>{if(!l)return;let{unsubscribe:t}=a.Lp.subscription(o,{input:{threadId:l,additionalUserMessage:e,options:n}}).subscribe(e=>{var n;if(null==e?void 0:e.error){x(!1),g(e.error),t();return}let s=null===(n=e.data)||void 0===n?void 0:n.createThreadRun;s&&("ThreadAssistantMessageCompleted"===s.__typename&&b.current(),f(e=>j(e,s)))});return t},C=(0,a.Db)(d),w=(e,n)=>{h||(x(!0),g(void 0),f(c()),l?m.current=N(e,n):m.current=y(e,n))},k=(e,n,t)=>C({threadId:e,userMessageId:n,assistantMessageId:t}).then(e=>{var n;if(!(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.deleteThreadMessagePair)){if(null==e?void 0:e.error)throw e.error;throw Error("Failed to fetch")}});return{isLoading:h,answer:v,error:p,sendUserMessage:w,stop:b.current,regenerate:e=>l?(x(!0),g(void 0),f(c()),k(e.threadId,e.userMessageId,e.assistantMessageId).then(()=>{w(e.userMessage,e.threadRunOptions)}).catch(e=>{let n=e instanceof Error?e:Error("Failed to fetch");g(n),x(!1)})):Promise.resolve(void 0),deleteThreadMessagePair:k}}},47241:function(e,n,t){"use strict";t.d(n,{Eg:function(){return a},qs:function(){return r}});var s=t(17451);let l=s.a.setState,a=e=>{l(()=>({selectedModel:e}))},r=e=>{l(()=>({enableActiveSelection:e}))}},80804:function(){}}]);
\ No newline at end of file
diff --git a/ee/tabby-webserver/ui/_next/static/chunks/6534-8849c4a27b4b4dd2.js b/ee/tabby-webserver/ui/_next/static/chunks/6534-8849c4a27b4b4dd2.js
deleted file mode 100644
index 39995c741bf6..000000000000
--- a/ee/tabby-webserver/ui/_next/static/chunks/6534-8849c4a27b4b4dd2.js
+++ /dev/null
@@ -1 +0,0 @@
-(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6534],{72657:function(e,n,t){"use strict";t.d(n,{K:function(){return o}});var s=t(36164);t(3546);var l=t(12624),a=t(1544),r=t(31458),i=t(81565);function o(e){let{className:n,container:t,offset:o,...d}=e,c=(0,l.e)(o||0,t);return(0,s.jsxs)(r.z,{variant:"outline",size:"icon",className:(0,a.cn)("absolute right-4 top-1 z-10 bg-background transition-opacity duration-300 sm:right-8 md:top-2",c?"opacity-0":"opacity-100",n),onClick:()=>{t?t.scrollTo({top:t.scrollHeight,behavior:"smooth"}):window.scrollTo({top:document.body.offsetHeight,behavior:"smooth"})},...d,children:[(0,s.jsx)(i.IconArrowDown,{}),(0,s.jsx)("span",{className:"sr-only",children:"Scroll to bottom"})]})}},66534:function(e,n,t){"use strict";t.d(n,{e:function(){return eE},p:function(){return eM}});var s=t(36164),l=t(3546),a=t(1853),r=t(78613),i=t(82157),o=t(72940),d=t(70783),c=t(21808),u=t(24449),m=t(16784),h=t(64566),x=t(63484),v=t(17451),f=t(1544),p=t(90379),g=t(54767),j=t(28445),b=t(84837),y=t(2578),N=t(28312),C=t(47241),w=t(11634),k=t(70410),I=t(63795),A=t(31458),M=t(81565),E=t(72657),S=t(45391),L=t(34021),T=t(21454),R=t(3765),_=t(84942),z=t(29),D=t(24685),Z=t(74630),O=t(16234),F=t(23455),P=t(82394);let U=l.createContext({}),H=_.xp,$=l.forwardRef((e,n)=>(0,s.jsx)(_.tW,{...e,ref:n}));$.displayName="SearchableSelectAnchor";let q=l.forwardRef((e,n)=>{let{getInputProps:t}=l.useContext(U),{onKeyDown:a,onChange:r,onInput:i,onBlur:o,onClick:d,...c}=e;return(0,s.jsx)(F.Z,{...t((0,O.Z)({onKeyDown:a,onChange:r,onInput:i,onBlur:o,onClick:d,ref:n},Z.Z)),...c})});q.displayName="SearchableSelectTextarea";let J=l.forwardRef((e,n)=>{let{getInputProps:t}=l.useContext(U),{onKeyDown:a,onChange:r,onInput:i,onBlur:o,onClick:d,...c}=e;return(0,s.jsx)(P.I,{...t((0,O.Z)({onKeyDown:a,onChange:r,onInput:i,onBlur:o,onClick:d,ref:n},Z.Z)),...c})});J.displayName="SearchableSelectInput";let W=l.forwardRef((e,n)=>{let{children:t,style:a,popupMatchAnchorWidth:r,...i}=e,{getMenuProps:o,anchorRef:d}=l.useContext(U),c=l.useRef(void 0);return l.useLayoutEffect(()=>{if(r){let e=d.current;if(e){let n=e.getBoundingClientRect();c.current=n.width}}},[]),(0,s.jsx)(_.i9,{children:(0,s.jsx)(_.yk,{align:"start",onOpenAutoFocus:e=>e.preventDefault(),style:{width:c.current,...a},...o({ref:n},{suppressRefError:!0}),...i,children:t})})});W.displayName="SearchableSelectContent";let G=l.forwardRef((e,n)=>{let{item:t,index:a,className:r,children:i,disabled:o,...d}=e,{highlightedIndex:c,selectedItem:u,getItemProps:m}=l.useContext(U),h=c===a,x=u===t;return(0,s.jsx)(H,{asChild:!0,children:(0,s.jsx)("div",{className:(0,f.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none",h&&"bg-accent text-accent-foreground",x&&"font-bold",o&&"pointer-events-none opacity-50",r),...m({item:t,index:a,onMouseLeave:e=>e.preventDefault(),onMouseOut:e=>e.preventDefault()}),...d,children:"function"==typeof i?i({highlighted:h,selected:x}):i})},t.id)});function V(e){let{options:n,onSelect:t,children:a,open:r,onOpenChange:i,stayOpenOnInputClick:o}=e,d=l.useRef(null),c=l.useCallback((e,n)=>{let{type:t,changes:s}=n;switch(t){case D.Kb.stateChangeTypes.MenuMouseLeave:return{...s,highlightedIndex:e.highlightedIndex};case D.Kb.stateChangeTypes.InputClick:let l=!!o||s.isOpen;return{...s,isOpen:l};default:return s}},[o]),u=(0,D.Kb)({items:null!=n?n:[],defaultIsOpen:r,onSelectedItemChange(e){let{selectedItem:n}=e;n&&(null==t||t(n),null==i||i(!1))},onIsOpenChange:e=>{let{isOpen:n}=e;null==i||i(!!n)},stateReducer:c}),{setHighlightedIndex:m,highlightedIndex:h}=u,x=(0,Z.Z)(r)?u.isOpen:u.isOpen&&r;l.useEffect(()=>{x&&(null==n?void 0:n.length)&&-1===h&&m(0)},[x,n]);let v=l.useMemo(()=>({...u,open:x,anchorRef:d}),[u,x,d]);return(0,s.jsx)(U.Provider,{value:v,children:(0,s.jsx)(_.J2,{open:x,children:"function"==typeof a?a(v):a})})}G.displayName="SearchableSelectOption";let Y=l.forwardRef(function(e,n){let{onSubmit:t,input:a,setInput:r,isLoading:i,chatInputRef:o}=e,{formRef:d,onKeyDown:c}=function(){let e=(0,l.useRef)(null);return{formRef:e,onKeyDown:n=>{if("Enter"===n.key&&!n.shiftKey&&!n.nativeEvent.isComposing){var t;null===(t=e.current)||void 0===t||t.requestSubmit(),n.preventDefault()}}}}(),[u,m]=l.useState(null),[h,x]=l.useState(!1),v=l.useRef(),p=l.useRef(),[g,j]=l.useState([]),[b,y]=l.useState({}),{data:N}=(0,T.ZP)(u,R.Z,{revalidateOnFocus:!1,dedupingInterval:0,errorRetryCount:0});l.useEffect(()=>{var e;let n=null!==(e=null==N?void 0:N.hits)&&void 0!==e?e:[];j(n),x(!!(null==n?void 0:n.length))},[null==N?void 0:N.hits]),l.useImperativeHandle(n,()=>({focus:()=>{var e;return null===(e=o.current)||void 0===e?void 0:e.focus()}})),l.useEffect(()=>{a&&o.current&&o.current!==document.activeElement&&o.current.focus()},[a,o]),l.useLayoutEffect(()=>{var e,n,t;(null===(e=p.current)||void 0===e?void 0:e.length)&&(null===(t=o.current)||void 0===t||null===(n=t.setSelectionRange)||void 0===n||n.call(t,p.current[0],p.current[1]),p.current=void 0)},[o]),l.useMemo(()=>(0,S.Z)(e=>{var n,t,s,l;let a=null!==(s=null===(n=e.target)||void 0===n?void 0:n.value)&&void 0!==s?s:"",r=null!==(l=null===(t=e.target)||void 0===t?void 0:t.selectionEnd)&&void 0!==l?l:0,i=B(a,r),o=null==i?void 0:i[1];if(o){let e=encodeURIComponent("name:".concat(o," AND kind:function")),n="/v1beta/search?q=".concat(e);m(n)}else j([]),x(!1)},200),[]);let C=async e=>{if(e.preventDefault(),!(null==a?void 0:a.trim())||i)return;let n=a;Object.keys(b).forEach(e=>{var t,s,l;let a=b[e];(null==a?void 0:a.doc)&&(n=n.replaceAll(e,"\n```".concat(null!==(s=null===(t=a.doc)||void 0===t?void 0:t.language)&&void 0!==s?s:"","\n").concat(null!==(l=a.doc.body)&&void 0!==l?l:"","\n","```","\n")))}),r(""),await t(n)},w=(e,n)=>{"Enter"===e.key&&n?e.preventDefault():n&&["ArrowRight","ArrowLeft","Home","End"].includes(e.key)?(j([]),x(!1)):(n||(e.preventDownshiftDefault=!0),c(e))};return(0,s.jsx)("form",{onSubmit:C,ref:d,children:(0,s.jsx)(V,{options:g,onSelect:e=>{var n,t,s;let l=null!==(n=v.current)&&void 0!==n?n:0,i=B(a,l);if(i){y({...b,["@".concat(null===(t=e.doc)||void 0===t?void 0:t.name)]:e});let n="@".concat(null==e?void 0:null===(s=e.doc)||void 0===s?void 0:s.name," "),o=a.substring(0,l).replace(new RegExp(i[0]),""),d=o.length+n.length;p.current=[d,d],r(o+n+a.slice(l))}j([]),x(!1)},open:h,onOpenChange:e=>{e&&(null==g?void 0:g.length)?x(e):(x(!1),j([]))},children:e=>{var n,t,l,d;let{open:c,highlightedIndex:u}=e,m=null==g?void 0:g[u];return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)($,{children:(0,s.jsxs)("div",{className:"relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md sm:border sm:px-12",children:[(0,s.jsx)("span",{className:(0,f.cn)((0,A.d)({size:"sm",variant:"ghost"}),"absolute left-0 top-4 h-8 w-8 rounded-full bg-background p-0 hover:bg-background sm:left-4"),children:(0,s.jsx)(M.IconEdit,{})}),(0,s.jsx)(q,{tabIndex:0,rows:1,placeholder:"Ask a question.",spellCheck:!1,className:"min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none",value:a,ref:o,onChange:e=>{(0,L.Z)(e,"target.value")?(v.current=e.target.selectionEnd,r(e.target.value)):v.current=void 0},onKeyDown:e=>w(e,c)}),(0,s.jsx)("div",{className:"absolute right-0 top-4 sm:right-4",children:(0,s.jsxs)(z.u,{children:[(0,s.jsx)(z.aJ,{asChild:!0,children:(0,s.jsxs)(A.z,{type:"submit",size:"icon",disabled:i||""===a,children:[(0,s.jsx)(M.IconArrowElbow,{}),(0,s.jsx)("span",{className:"sr-only",children:"Send message"})]})}),(0,s.jsx)(z._v,{children:"Send message"})]})})]})}),(0,s.jsx)(W,{align:"start",side:"top",onOpenAutoFocus:e=>e.preventDefault(),className:"w-[60vw] md:w-[430px]",children:(0,s.jsxs)(_.J2,{open:c&&!!m,children:[(0,s.jsx)(_.tW,{asChild:!0,children:(0,s.jsx)("div",{className:"max-h-[300px] overflow-y-scroll",children:c&&!!(null==g?void 0:g.length)&&g.map((e,n)=>{var t,l,a;return(0,s.jsx)(G,{item:e,index:n,children:(0,s.jsxs)("div",{className:"flex w-full items-center justify-between gap-8 overflow-x-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(K,{kind:null==e?void 0:null===(t=e.doc)||void 0===t?void 0:t.kind}),(0,s.jsxs)("div",{className:"max-w-[200px] truncate",children:[null==e?void 0:null===(l=e.doc)||void 0===l?void 0:l.name,"(...)"]})]}),(0,s.jsx)("div",{className:"flex-1 truncate text-right text-sm text-muted-foreground",children:null==e?void 0:null===(a=e.doc)||void 0===a?void 0:a.body})]})},null==e?void 0:e.id)})})}),(0,s.jsx)(_.yk,{asChild:!0,align:"start",side:"right",alignOffset:-4,onOpenAutoFocus:e=>e.preventDefault(),onKeyDownCapture:e=>e.preventDefault(),className:"rounded-none",collisionPadding:{bottom:120},children:(0,s.jsxs)("div",{className:"flex max-h-[70vh] w-[20vw] flex-col overflow-y-auto px-2 md:w-[240px] lg:w-[340px]",children:[(0,s.jsxs)("div",{className:"mb-2",children:[(null==m?void 0:null===(n=m.doc)||void 0===n?void 0:n.kind)?"(".concat(null==m?void 0:null===(t=m.doc)||void 0===t?void 0:t.kind,") "):"",null==m?void 0:null===(l=m.doc)||void 0===l?void 0:l.name]}),(0,s.jsx)("div",{className:"flex-1 whitespace-pre-wrap break-all text-muted-foreground",children:null==m?void 0:null===(d=m.doc)||void 0===d?void 0:d.body})]})})]})})]})}})})});function B(e,n){let t=e.substring(0,n),s=/@(\w+)$/.exec(t);return s}function K(e){let{kind:n,...t}=e;return(0,s.jsx)(M.IconSymbolFunction,{...t})}function Q(e){let{href:n,children:t}=e;return(0,s.jsxs)("a",{href:n,target:"_blank",className:"inline-flex flex-1 justify-center gap-1 leading-4 hover:underline",children:[(0,s.jsx)("span",{children:t}),(0,s.jsx)("svg",{"aria-hidden":"true",height:"7",viewBox:"0 0 6 6",width:"7",className:"opacity-70",children:(0,s.jsx)("path",{d:"M1.25215 5.54731L0.622742 4.9179L3.78169 1.75597H1.3834L1.38936 0.890915H5.27615V4.78069H4.40513L4.41109 2.38538L1.25215 5.54731Z",fill:"currentColor"})})]})}function X(e){let{className:n,...t}=e;return(0,s.jsxs)("p",{className:(0,f.cn)("px-2 text-center text-xs leading-normal text-muted-foreground",n),...t,children:[(0,s.jsx)(Q,{href:"https://tabby.tabbyml.com",children:"Tabby"}),", an opensource, self-hosted AI coding assistant ."]})}let ee=l.forwardRef(function(e,n){var t;let{stop:r,reload:i,input:o,setInput:d,className:u,onSubmit:m,chatMaxWidthClass:h,chatInputRef:x}=e,p=l.useRef(null),{threadId:S,container:L,onClearMessages:T,qaPairs:R,isLoading:_,relevantContext:z,removeRelevantContext:D,activeSelection:Z,onCopyContent:O}=l.useContext(eM),F=(0,v.a)(e=>e.enableActiveSelection),[P,U]=(0,l.useState)(!1),H=(0,l.useMemo)(()=>{var e;if(!S)return"";let n=null===(e=R[0])||void 0===e?void 0:e.user.message;if(!n)return S;let t=(0,f.i8)([],n,{maxLength:c.$I}),s=(0,g.Z)(t),l=(0,a.Z)([s,S]).join("-");return l},[null===(t=R[0])||void 0===t?void 0:t.user.message,S]),$=(0,w.Db)(k.md,{onError(e){y.A.error(e.message)}}),{isCopied:q,copyToClipboard:J}=(0,N.m)({timeout:2e3,onCopyContent:O}),W=async()=>{if(S&&!q&&!P)try{var e,n;U(!0);let t=await $({threadId:S});if(null==t?void 0:null===(e=t.data)||void 0===e?void 0:e.setThreadPersisted){let e=new URL(window.location.origin);e.pathname="/search/".concat(H),J(e.toString())}else y.A.error((null==t?void 0:null===(n=t.error)||void 0===n?void 0:n.message)||"Failed to share")}catch(e){}finally{U(!1)}};return l.useImperativeHandle(n,()=>({focus:()=>{var e;null===(e=p.current)||void 0===e||e.focus()}}),[]),(0,s.jsxs)("div",{className:u,children:[(0,s.jsx)(E.K,{container:L}),(0,s.jsxs)("div",{className:"mx-auto md:px-4 ".concat(h),children:[(0,s.jsxs)("div",{className:"flex h-10 items-center justify-center gap-2",children:[_?(0,s.jsxs)(A.z,{variant:"outline",onClick:()=>r(),className:"bg-background",children:[(0,s.jsx)(M.IconStop,{className:"mr-2"}),"Stop generating"]}):(null==R?void 0:R.length)>0&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(A.z,{variant:"outline",onClick:()=>i(),className:"bg-background",children:[(0,s.jsx)(M.IconRefresh,{className:"mr-2"}),"Regenerate"]}),(0,s.jsxs)(A.z,{variant:"outline",className:"gap-2 bg-background",onClick:W,children:[q?(0,s.jsx)(M.IconCheck,{}):(0,s.jsx)(M.IconShare,{}),"Share"]})]}),(null==R?void 0:R.length)>0&&(0,s.jsxs)(A.z,{variant:"outline",onClick:T,className:"bg-background",children:[(0,s.jsx)(M.IconTrash,{className:"mr-2"}),"Clear"]})]}),(0,s.jsxs)("div",{className:"border-t bg-background px-4 py-2 shadow-lg sm:space-y-4 sm:rounded-t-xl sm:border md:py-4",children:[(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,s.jsxs)(j.M,{presenceAffectsLayout:!0,children:[Z?(0,s.jsx)(b.E.div,{initial:{opacity:0,scale:.9,y:-5},animate:{opacity:1,scale:1,y:0},transition:{ease:"easeInOut",duration:.1},exit:{opacity:0,scale:.9,y:5},children:(0,s.jsxs)(I.C,{variant:"outline",className:(0,f.cn)("inline-flex h-7 flex-nowrap items-center gap-1.5 overflow-hidden rounded-md pr-0 text-sm font-semibold",{"border-dashed !text-muted-foreground italic line-through":!F}),children:[(0,s.jsx)(en,{context:Z,className:"flex-1 truncate"}),(0,s.jsx)("span",{className:"shrink-0 text-muted-foreground",children:"Current file"}),(0,s.jsx)(A.z,{size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0 rounded-l-none",onClick:e=>{(0,C.qs)(!F)},children:F?(0,s.jsx)(M.IconEye,{}):(0,s.jsx)(M.IconEyeOff,{})})]})}):null,z.map((e,n)=>(0,s.jsx)(b.E.div,{initial:{opacity:0,scale:.9,y:-5},animate:{opacity:1,scale:1,y:0},transition:{ease:"easeInOut",duration:.1},exit:{opacity:0,scale:.9,y:5},layout:!0,children:(0,s.jsxs)(I.C,{variant:"outline",className:"inline-flex h-7 flex-nowrap items-center gap-1 overflow-hidden rounded-md pr-0 text-sm font-semibold",children:[(0,s.jsx)(en,{context:e}),(0,s.jsx)(A.z,{size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0 rounded-l-none",onClick:D.bind(null,n),children:(0,s.jsx)(M.IconRemove,{})})]})},e.filepath+e.range.start+e.range.end))]})}),(0,s.jsx)(Y,{ref:p,onSubmit:m,input:o,setInput:d,isLoading:_,chatInputRef:x}),(0,s.jsx)(X,{className:"hidden sm:block"})]})]})]})});function en(e){let{context:n,className:t}=e,[l]=n.filepath.split("/").slice(-1),a=n.range.start===n.range.end?":".concat(n.range.start):":".concat(n.range.start,"-").concat(n.range.end);return(0,s.jsxs)("span",{className:(0,f.cn)("truncate",t),children:[l,(0,s.jsx)("span",{className:"text-muted-foreground",children:a})]})}var et=t(76297),es=t(12624);function el(e){let{trackVisibility:n}=e,{container:t}=l.useContext(eM),a=(0,es.e)(100,t),{ref:r,entry:i,inView:o}=(0,et.YD)({trackVisibility:n,delay:100,rootMargin:"0px 0px -150px 0px",root:t});return l.useEffect(()=>{a&&n&&!o&&(null==i||i.target.scrollIntoView({block:"start"}))},[o,i,a,n]),(0,s.jsx)("div",{ref:r,className:"h-px w-full"})}let ea=[{heading:"Convert list of string to numbers",message:"How to convert a list of string to numbers in python"},{heading:"How to parse email address",message:"How to parse email address with regex"}];function er(e){let{setInput:n,chatMaxWidthClass:t,welcomeMessage:l}=e;return(0,s.jsx)("div",{className:"mx-auto px-4 ".concat(t),children:(0,s.jsxs)("div",{className:"rounded-lg border bg-background p-8",children:[(0,s.jsx)("h1",{className:"mb-2 text-lg font-semibold",children:l||"Welcome"}),(0,s.jsx)("p",{className:"leading-normal text-muted-foreground",children:"You can start a conversation here or try the following examples:"}),(0,s.jsx)("div",{className:"mt-4 flex flex-col items-start space-y-2",children:ea.map((e,t)=>(0,s.jsxs)(A.z,{variant:"link",className:"h-auto p-0 text-base",onClick:()=>n(e.message),children:[(0,s.jsx)(M.IconArrowRight,{className:"mr-2 text-muted-foreground"}),(0,s.jsx)("p",{className:"text-left",children:e.heading})]},t))})]})})}var ei=t(42891),eo=t.n(ei),ed=t(23342),ec=t(94909),eu=t(74038),em=t(98454),eh=t(48537),ex=t(21540),ev=t(11208),ef=t(3448),ep=t(52569),eg=t(90168);function ej(e){let{messages:n,chatMaxWidthClass:t}=e,{isLoading:a}=l.useContext(eM);return(0,s.jsx)("div",{className:"relative mx-auto px-4 ".concat(t),children:null==n?void 0:n.map((e,t)=>{let r=t===n.length-1;return(0,s.jsxs)(l.Fragment,{children:[(0,s.jsx)(eb,{isLoading:!!r&&a,message:e,isLastItem:r}),!r&&(0,s.jsx)(ev.Z,{className:"my-4 md:my-8"})]},e.user.id)})})}function eb(e){let{message:n,isLoading:t,isLastItem:l}=e,{user:a,assistant:r}=n;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ey,{message:a}),!!r&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ev.Z,{className:"my-4 md:my-8"}),(0,s.jsx)(eC,{message:r,userMessage:a,isLoading:t,userMessageId:a.id,enableRegenerating:l})]})]})}function ey(e){var n,t,a,r;let{message:i}=e,[{data:o}]=(0,em.P)(),d=i.selectContext,{onNavigateToContext:c,supportsOnApplyInEditorV2:u}=l.useContext(eM),m=l.useMemo(()=>{var e,n;if(!(null==d?void 0:d.content))return"";let t=(null==d?void 0:d.filepath)&&null!==(e=(0,x.U$)(null==d?void 0:d.filepath)[0])&&void 0!==e?e:"";return"\n```".concat(t,"\n").concat(null!==(n=null==d?void 0:d.content)&&void 0!==n?n:"","\n","```","\n")},[d]),h=null;if(m&&i.selectContext){let{range:e,filepath:n}=i.selectContext;h={filepath:n,isMultiLine:!(0,Z.Z)(null==e?void 0:e.start)&&!(0,Z.Z)(null==e?void 0:e.end)&&e.startnull==c?void 0:c(i.selectContext,{openInEditor:!0}),children:[(0,s.jsx)(M.IconFile,{className:"h-3 w-3"}),(0,s.jsxs)("p",{className:"flex-1 truncate pr-1",children:[(0,s.jsx)("span",{children:h.filepath}),(null===(t=i.selectContext)||void 0===t?void 0:null===(n=t.range)||void 0===n?void 0:n.start)&&(0,s.jsxs)("span",{children:[":",null===(a=i.selectContext)||void 0===a?void 0:a.range.start]}),h.isMultiLine&&(0,s.jsxs)("span",{children:["-",null===(r=i.selectContext)||void 0===r?void 0:r.range.end]})]})]})]}),!(null==o?void 0:o.me.name)&&(0,s.jsx)("div",{className:"editor-bg absolute right-0 top-0 -mt-0.5 block opacity-0 transition-opacity group-hover:opacity-100 md:hidden",children:(0,s.jsx)(eN,{...e})})]})]})}function eN(e){let{message:n}=e,{handleMessageAction:t,isLoading:a}=l.useContext(eM);return(0,s.jsxs)(eA,{children:[!a&&(0,s.jsxs)(A.z,{variant:"ghost",size:"icon",onClick:e=>t(n.id,"edit"),children:[(0,s.jsx)(M.IconEdit,{}),(0,s.jsx)("span",{className:"sr-only",children:"Edit message"})]}),!a&&(0,s.jsxs)(A.z,{variant:"ghost",size:"icon",onClick:e=>t(n.id,"delete"),children:[(0,s.jsx)(M.IconTrash,{}),(0,s.jsx)("span",{className:"sr-only",children:"Delete message"})]})]})}function eC(e){let{message:n,userMessage:t,isLoading:r,userMessageId:o,enableRegenerating:c,...u}=e,{onNavigateToContext:m,onApplyInEditor:h,onCopyContent:v,onLookupSymbol:p,supportsOnApplyInEditorV2:g}=l.useContext(eM),[j,b]=l.useState(void 0),y=l.useMemo(()=>{var e,t;return null!==(t=null==n?void 0:null===(e=n.relevant_code)||void 0===e?void 0:e.map(e=>{let{startLine:n,endLine:t}=(0,f.OV)(e);return{kind:"file",range:{start:n,end:t},filepath:e.filepath,content:e.content,git_url:e.gitUrl}}))&&void 0!==t?t:[]},[null==n?void 0:n.relevant_code]),N=l.useMemo(()=>{var e;return(0,d.Z)((0,a.Z)([t.activeContext,...null!==(e=null==t?void 0:t.relevantContext)&&void 0!==e?e:[]]),i.Z)},[t.activeContext,t.relevantContext]),C=(0,l.useMemo)(()=>{var e,n;let t=null!==(n=null==N?void 0:N.map(n=>({content:n.content,filepath:n.filepath,gitUrl:n.git_url,startLine:n.range.start,language:(0,x.U$)(null!==(e=n.filepath)&&void 0!==e?e:"")[0],isClient:!0})))&&void 0!==n?n:[];return t},[N]),w=(0,l.useMemo)(()=>{var e,n;let t=null!==(n=null==y?void 0:y.map(n=>({content:n.content,filepath:n.filepath,gitUrl:n.git_url,startLine:n.range.start,language:(0,x.U$)(null!==(e=n.filepath)&&void 0!==e?e:"")[0],isClient:!1})))&&void 0!==n?n:[];return(0,a.Z)([...t])},[y]);return(0,s.jsxs)("div",{className:(0,f.cn)("group relative mb-4 flex flex-col items-start gap-y-2 md:-ml-4 md:flex-row"),...u,children:[(0,s.jsxs)("div",{className:"flex min-h-[2rem] w-full items-center justify-between md:w-auto",children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-2",children:[(0,s.jsx)("div",{className:"shrink-0 select-none rounded-full border bg-background shadow",children:(0,s.jsx)(eI,{className:"h-6 w-6 md:h-8 md:w-8"})}),(0,s.jsx)("p",{className:"block text-xs font-bold md:hidden",children:"Tabby"})]}),(0,s.jsx)("div",{className:"block opacity-0 transition-opacity group-hover:opacity-100 md:hidden",children:(0,s.jsx)(ew,{message:n,userMessageId:o,enableRegenerating:c,attachmentCode:w})})]}),(0,s.jsxs)("div",{className:"w-full flex-1 space-y-2 overflow-hidden px-1 md:ml-4",children:[(0,s.jsx)(eg.q,{contexts:y,clientContexts:N,onContextClick:(e,n)=>{null==m||m(e,{openInEditor:n})},showExternalLink:!!h,isInEditor:!!h,showClientCodeIcon:!h,highlightIndex:j,triggerClassname:"md:pt-0"}),!r||(null==n?void 0:n.message)?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ex.JG,{message:n.message,onApplyInEditor:h,onCopyContent:v,attachmentClientCode:C,attachmentCode:w,onCodeCitationClick:e=>{let{startLine:n,endLine:t}=(0,f.OV)(e),s={git_url:e.gitUrl,content:e.content,filepath:e.filepath,kind:"file",range:{start:n,end:t}};null==m||m(s,{openInEditor:e.isClient})},onCodeCitationMouseEnter:e=>{b(e-1-0)},onCodeCitationMouseLeave:e=>{b(void 0)},canWrapLongLines:!r,onLookupSymbol:p,supportsOnApplyInEditorV2:g,activeSelection:t.activeContext,onNavigateToContext:m}),!!n.error&&(0,s.jsx)(ex.mE,{error:n.error})]}):(0,s.jsx)(ek,{}),(0,s.jsx)("div",{className:"hidden md:block",children:(0,s.jsx)(ew,{message:n,userMessageId:o,enableRegenerating:c,attachmentCode:w})})]})]})}function ew(e){let{handleMessageAction:n,isLoading:t,onCopyContent:r}=l.useContext(eM),{message:i,userMessageId:o,enableRegenerating:d,attachmentCode:c}=e,u=(0,l.useMemo)(()=>(function(e,n){var t;if(!n||(0,ec.Z)(n))return e;let s=e.replace(eu.H,e=>{let n=null==e?void 0:e.match(/\d+/);return"[".concat(n,"]")}).trim(),l=null!==(t=n.map((e,n)=>{let t=(0,f.tf)(e),s=(0,a.Z)([e.filepath,t]).join(":");return"[".concat(n+1,"] ").concat(s)}).join("\n"))&&void 0!==t?t:"";return"".concat(s,"\n\nCitations:\n").concat(l)})(i.message,c),[i.message,c]);return(0,s.jsxs)(eA,{children:[!t&&d&&(0,s.jsxs)(A.z,{variant:"ghost",size:"icon",onClick:e=>n(o,"regenerate"),children:[(0,s.jsx)(M.IconRefresh,{}),(0,s.jsx)("span",{className:"sr-only",children:"Regenerate message"})]}),(0,s.jsx)(eh.q,{value:u,onCopyContent:r})]})}function ek(){return(0,s.jsxs)("div",{className:"space-y-2 py-2 md:px-1 md:py-0",children:[(0,s.jsx)(ef.O,{className:"h-3 w-full"}),(0,s.jsx)(ef.O,{className:"h-3 w-full"})]})}function eI(e){let{className:n}=e;return(0,s.jsx)(eo(),{style:{backgroundColor:"#E8E2D2"},className:(0,f.cn)("rounded-full p-0.5",n),src:ed.Z,alt:"tabby"})}function eA(e){let{className:n,...t}=e;return(0,s.jsx)("div",{className:(0,f.cn)("flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-[4rem] md:-top-2 md:opacity-0",n),...t})}let eM=l.createContext({}),eE=l.forwardRef(function(e,n){let{className:t,chatId:g,initialMessages:j,onLoaded:b,onThreadUpdates:y,onNavigateToContext:N,container:C,docQuery:w,generateRelevantQuestions:k,maxWidth:I,welcomeMessage:A,promptFormClassname:M,onCopyContent:E,onSubmitMessage:S,onApplyInEditor:L,onLookupSymbol:T,chatInputRef:R,supportsOnApplyInEditorV2:_}=e,[z,D]=l.useState(!1),[Z,O]=l.useState(),F=l.useRef(!1),[P,U]=l.useState(null!=j?j:[]),[H,$]=l.useState(""),[q,J]=l.useState([]),[W,G]=l.useState(null),V=(0,v.a)(e=>e.enableActiveSelection),Y=l.useRef(null),{sendUserMessage:B,isLoading:K,error:Q,answer:X,stop:en,regenerate:et,deleteThreadMessagePair:es}=(0,h.x)({threadId:Z}),ea=async e=>{var n;if(!Z)return;en();let t=P.find(n=>n.user.id===e);if(!(null==t?void 0:t.user)||!t.assistant)return;let s=P.filter(n=>n.user.id!==e);U(s),es(Z,null==t?void 0:t.user.id,null==t?void 0:null===(n=t.assistant)||void 0===n?void 0:n.id)},ei=async e=>{if(!Z)return;let n=(0,r.Z)(P,n=>n.user.id===e);if(n>-1){let e=P[n];if(!e.assistant)return;let t=(0,f.x0)(),s=(0,f.x0)();U([...P.slice(0,n),{user:{...e.user,id:t},assistant:{id:s,message:"",error:void 0}}]);let[l,a]=em(e.user,V);return et({threadId:Z,userMessageId:e.user.id,assistantMessageId:e.assistant.id,userMessage:l,threadRunOptions:a})}},eo=async e=>{var n,t;if(!Z)return;let s=P.find(n=>n.user.id===e);if(!(null==s?void 0:s.user)||!s.assistant)return;let l=s.user,a=[];(null===(n=l.relevantContext)||void 0===n?void 0:n.length)&&(a=a.concat(l.relevantContext)),J((0,d.Z)(a,i.Z));let r=P.filter(n=>n.user.id!==e);U(r),$(l.message),l.activeContext&&N(l.activeContext,{openInEditor:!0}),es(Z,null==s?void 0:s.user.id,null==s?void 0:null===(t=s.assistant)||void 0===t?void 0:t.id)},ed=async()=>{if(!(null==P?void 0:P.length))return;let e=P[P.length-1].user.id;return ei(e)},ec=()=>{en(!0),U([]),O(void 0)};l.useEffect(()=>{if(!K||!(null==P?void 0:P.length)||!X)return;let e=P[P.length-1];X.threadId&&!Z&&O(X.threadId),U(n=>{var t,s;let l=n[n.length-1].assistant,a={...l,id:X.assistantMessageId||(null==l?void 0:l.id)||(0,f.x0)(),message:X.content,error:void 0,relevant_code:null!==(s=null===(t=X.attachmentsCode)||void 0===t?void 0:t.map(e=>e.code))&&void 0!==s?s:[]};return[...n.slice(0,n.length-1),{user:{...e.user,id:(null==X?void 0:X.userMessageId)||e.user.id},assistant:a}]})},[X,K]);let eu=(0,u.S)(()=>{C?C.scrollTo({top:C.scrollHeight,behavior:"smooth"}):window.scrollTo({top:document.body.offsetHeight,behavior:"smooth"})},100);l.useLayoutEffect(()=>{K&&eu.run()},[K]),l.useEffect(()=>{Q&&(null==P?void 0:P.length)&&U(e=>{var n,t,s;let l=e[e.length-1];return[...e.slice(0,e.length-1),{...l,assistant:{...l.assistant,id:(null===(n=l.assistant)||void 0===n?void 0:n.id)||(0,f.x0)(),message:null!==(s=null===(t=l.assistant)||void 0===t?void 0:t.message)&&void 0!==s?s:"",error:Q?"401"===Q.message?"Unauthorized":(0,o.Z)(Q.graphQLErrors,e=>{var n;return(null===(n=e.extensions)||void 0===n?void 0:n.code)===c.ir})?"The thread has expired, please click 'Clear' and try again.":Q.message||"Failed to fetch":"Failed to fetch"}}]}),(null==Q?void 0:Q.message)!=="Thread not found"||(null==P?void 0:P.length)||ec()},[Q]);let em=(e,n)=>{var t,s;let l=e.selectContext;n&&(l=l||e.activeContext),!function(e){if(!e)return!1;let n=e.filepath.startsWith("untitled:")&&!(0,x.U$)(e.filepath)[0];return!n}(l)&&(l=void 0);let r=l?{content:null!==(t=l.content)&&void 0!==t?t:"",filepath:l.filepath,language:l.filepath&&(0,x.U$)(l.filepath)[0]||"plaintext",gitUrl:null!==(s=null==l?void 0:l.git_url)&&void 0!==s?s:""}:null,o=n&&!!e.activeContext,c=(0,d.Z)((0,a.Z)([o&&e.activeContext,...(null==e?void 0:e.relevantContext)||[]]),i.Z),u=c.map(e=>({content:e.content,filepath:e.filepath,startLine:e.range.start})),m=e.message;return[{content:m,attachments:{code:u}},{docQuery:w?{content:m,searchPublic:!1}:null,generateRelevantQuestions:!!k,codeQuery:r}]},eh=(0,m.d)(async e=>{var n,t,s,l,a;if(K)return;let r="",i=null==e?void 0:null===(n=e.selectContext)||void 0===n?void 0:n.content;if(i){let n=(null==e?void 0:null===(t=e.selectContext)||void 0===t?void 0:t.filepath)&&null!==(l=(0,x.U$)(null==e?void 0:null===(s=e.selectContext)||void 0===s?void 0:s.filepath)[0])&&void 0!==l?l:"";r="\n```".concat(n,"\n").concat(null!=i?i:"","\n","```","\n")}let o=W||e.activeContext,d={...e,message:e.message+r,id:null!==(a=e.id)&&void 0!==a?a:(0,f.x0)(),selectContext:e.selectContext,activeContext:V&&o?o:void 0},c=[...P,{user:d,assistant:{id:(0,f.x0)(),message:"",error:void 0}}];U(c),B(...em(d,V))}),ex=e=>{var n;return null===(n=eh.current)||void 0===n?void 0:n.call(eh,e)},ev=async e=>{S?S(e,q):ex({message:e,relevantContext:q}),J([])},ef=(0,m.d)(e=>{J(n=>n.some(n=>(0,i.Z)(n,e))?n:n.concat([e]))}),ep=e=>{var n;null===(n=ef.current)||void 0===n||n.call(ef,e)};l.useEffect(()=>{F.current&&(null==y||y(P))},[P]);let eg=(0,u.S)(e=>{G(e)},300),eb=e=>{eg.run(e)};l.useImperativeHandle(n,()=>({sendUserChat:ex,stop:en,isLoading:K,addRelevantContext:ep,focus:()=>{var e;return null===(e=Y.current)||void 0===e?void 0:e.focus()},updateActiveSelection:eb}),[]),l.useEffect(()=>{D(!0),null==b||b()},[]);let ey=I?"max-w-".concat(I):"max-w-2xl";return z?(0,s.jsx)(eM.Provider,{value:{threadId:Z,isLoading:K,qaPairs:P,onNavigateToContext:N,handleMessageAction:(e,n)=>{switch(n){case"delete":ea(e);break;case"regenerate":ei(e);break;case"edit":eo(e)}},onClearMessages:ec,container:C,onCopyContent:E,onApplyInEditor:L,onLookupSymbol:T,relevantContext:q,removeRelevantContext:e=>{let n=[...q];n.splice(e,1),J(n)},chatInputRef:R,activeSelection:W,supportsOnApplyInEditorV2:_},children:(0,s.jsx)("div",{className:"flex justify-center overflow-x-hidden",children:(0,s.jsxs)("div",{className:"w-full px-4 md:pl-10 md:pr-[3.75rem] ".concat(ey),children:[(0,s.jsxs)("div",{className:(0,f.cn)("pb-[200px] pt-4 md:pt-10",t),children:[(null==P?void 0:P.length)?(0,s.jsx)(ej,{messages:P,chatMaxWidthClass:ey}):(0,s.jsx)(er,{setInput:$,chatMaxWidthClass:ey,welcomeMessage:A}),(0,s.jsx)(el,{trackVisibility:K})]}),(0,s.jsx)(ee,{onSubmit:ev,className:(0,f.cn)("fixed inset-x-0 bottom-0",M),id:g,stop:()=>{en()},reload:ed,input:H,setInput:$,chatMaxWidthClass:ey,ref:Y,chatInputRef:R})]})})}):(0,s.jsx)(p.cg,{className:"".concat(ey," mx-auto pt-4 md:pt-10")})})},90168:function(e,n,t){"use strict";t.d(n,{q:function(){return v}});var s=t(36164),l=t(3546),a=t(74630),r=t(1544),i=t(29),o=t(43739),d=t(14079);let c=o.fC,u=l.forwardRef((e,n)=>{let{className:t,...l}=e;return(0,s.jsx)(o.ck,{ref:n,className:(0,r.cn)("border-b",t),...l})});u.displayName="AccordionItem";let m=l.forwardRef((e,n)=>{let{className:t,children:l,...a}=e;return(0,s.jsxs)(o.xz,{ref:n,className:(0,r.cn)("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[l,(0,s.jsx)(d.Z,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})});m.displayName=o.xz.displayName;let h=l.forwardRef((e,n)=>{let{className:t,children:l,...a}=e;return(0,s.jsx)(o.VY,{ref:n,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:(0,s.jsx)("div",{className:(0,r.cn)("pb-4 pt-0",t),children:l})})});h.displayName=o.VY.displayName;var x=t(81565);let v=(0,l.forwardRef)((e,n)=>{var t,a;let{contexts:i,clientContexts:o,className:d,triggerClassname:x,onContextClick:v,enableTooltip:p,onTooltipClick:g,highlightIndex:j,showExternalLink:b,showClientCodeIcon:y,isInEditor:N}=e,C=((null==o?void 0:o.length)||0)+i.length,w=null!==(t=null==i?void 0:i.length)&&void 0!==t?t:0,k=null!==(a=null==o?void 0:o.length)&&void 0!==a?a:0,I=w+k,[A,M]=(0,l.useState)(I<=5?"references":void 0);return((0,l.useEffect)(()=>{I<=5?M("references"):M(void 0)},[I]),0===C)?null:(0,s.jsx)(c,{type:"single",collapsible:!0,className:(0,r.cn)("bg-transparent text-foreground",d),ref:n,value:A,onValueChange:M,children:(0,s.jsxs)(u,{value:"references",className:"my-0 border-0",children:[(0,s.jsx)(m,{className:(0,r.cn)("my-0 py-2 font-semibold",x),children:(0,s.jsx)("span",{className:"mr-2",children:"Read ".concat(C," file").concat(C>1?"s":"")})}),(0,s.jsxs)(h,{className:"space-y-2",children:[null==o?void 0:o.map((e,n)=>(0,s.jsx)(f,{context:e,onContextClick:e=>null==v?void 0:v(e,!0),isHighlighted:j===n,clickable:N||!!e.git_url,showClientCodeIcon:y},"user-".concat(n))),i.map((e,n)=>(0,s.jsx)(f,{context:e,onContextClick:e=>null==v?void 0:v(e,!1),enableTooltip:p,onTooltipClick:g,showExternalLinkIcon:b,isHighlighted:j===n+((null==o?void 0:o.length)||0)},"assistant-".concat(n)))]})]})})});function f(e){var n,t,o,d,c,u,m;let{context:h,clickable:v=!0,onContextClick:f,enableTooltip:p,onTooltipClick:g,showExternalLinkIcon:j,showClientCodeIcon:b,isHighlighted:y}=e,[N,C]=(0,l.useState)(!1),w=!(0,a.Z)(null===(n=h.range)||void 0===n?void 0:n.start)&&!(0,a.Z)(null===(t=h.range)||void 0===t?void 0:t.end)&&h.range.start{p&&M&&C(e)},delayDuration:0,children:[(0,s.jsx)(i.aJ,{asChild:!0,children:(0,s.jsx)("div",{className:(0,r.cn)("rounded-md border p-2",{"cursor-pointer hover:bg-accent":v,"cursor-default pointer-events-auto":!v,"bg-accent transition-all":y}),onClick:e=>v&&(null==f?void 0:f(h)),children:(0,s.jsxs)("div",{className:"flex items-center gap-1 overflow-hidden",children:[(0,s.jsx)(x.IconFile,{className:"shrink-0"}),(0,s.jsxs)("div",{className:"flex-1 truncate",title:h.filepath,children:[(0,s.jsx)("span",{children:I}),(null===(d=h.range)||void 0===d?void 0:d.start)&&(0,s.jsxs)("span",{className:"text-muted-foreground",children:[":",h.range.start]}),w&&(0,s.jsxs)("span",{className:"text-muted-foreground",children:["-",h.range.end]}),(0,s.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:A})]}),b&&(0,s.jsx)(x.IconFileSearch2,{className:"shrink-0 text-muted-foreground"}),j&&(0,s.jsx)(x.IconExternalLink,{className:"shrink-0 text-muted-foreground"})]})})}),(0,s.jsx)(i._v,{align:"start",onClick:g,className:"cursor-pointer p-2",children:(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"mb-2 font-semibold",children:"Scores"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)("span",{className:"w-20",children:"rrf:"}),null!==(c=null==M?void 0:M.rrf)&&void 0!==c?c:"-"]}),(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)("span",{className:"w-20",children:"bm25:"}),null!==(u=null==M?void 0:M.bm25)&&void 0!==u?u:"-"]}),(0,s.jsxs)("div",{className:"flex",children:[(0,s.jsx)("span",{className:"w-20",children:"embedding:"}),null!==(m=null==M?void 0:M.embedding)&&void 0!==m?m:"-"]})]})]})})]})}v.displayName="CodeReferences"},73033:function(e,n,t){"use strict";t.d(n,{s:function(){return r}});var s=t(36164),l=t(3546),a=t(52991);let r=(0,l.memo)(e=>(0,s.jsx)(a.D,{linkTarget:"_blank",...e}),(e,n)=>e.children===n.children&&e.className===n.className)},83171:function(e,n,t){"use strict";t.d(n,{p:function(){return o},t:function(){return d}});var s=t(36164);t(3546);var l=t(68035),a=t(18500),r=t(1544),i=t(81565);function o(e){let{kind:n,label:t,className:a}=e;return(0,s.jsxs)(l.T5,{as:"span",className:(0,r.cn)("source-mention rounded-sm px-1",a),children:[(0,s.jsx)(c,{kind:n,className:"self-center"}),(0,s.jsx)("span",{className:"whitespace-nowrap",children:t})]})}function d(e){let{kind:n,label:t,id:l}=e.node.attrs;return(0,s.jsx)(o,{kind:n,label:t,id:l})}function c(e){let{kind:n,...t}=e;switch(n){case a.ri.Doc:return(0,s.jsx)(i.IconEmojiBook,{...t});case a.ri.Web:return(0,s.jsx)(i.IconEmojiGlobe,{...t});case a.ri.Git:return(0,s.jsx)(i.IconCode,{...t});case a.ri.Github:return(0,s.jsx)(i.IconGitHub,{...t});case a.ri.Gitlab:return(0,s.jsx)(i.IconGitLab,{...t});default:return null}}},21540:function(e,n,t){"use strict";t.d(n,{mE:function(){return D},JG:function(){return z},V$:function(){return U}});var s=t(36164),l=t(3546),a=t(42891),r=t.n(a),i={src:"/_next/static/media/default-favicon.a2df8fbb.png",height:16,width:16,blurDataURL:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAYAAADED76LAAABAElEQVR42mOAAqaMgrXeIYlL2jwjF7WZey7wBolB5eyZotNX1PdMO/Br466r/89dfvx/w7aLv6LSlteDFem5zPPesPXir20Hbv7ftPfGrz9///969urL/xkLj/0KjlvqzZCct6rt9r3X/w+cvP/r8fOP/0Hg/uN3vzbsvPq/rmVzG0Nk+oq2J8/f///89devOw/f/n/7/uv/T19+/Dpx7uH/3NK1bQwMarO8tu66/Auk89qd17/mrzn/682H7//3H7rxi4FhsheDDYMhU0DC0vqde6/+On/lyf/5q878X7Tq9M+E7JX1cJ/4MpgzMajO9ApNXtoWl7mszc5nvhdMEgB1uZJfA01kRAAAAABJRU5ErkJggg==",blurWidth:8,blurHeight:8},o=t(62226),d=t.n(o),c=t(6797),u=t.n(c),m=t(1853),h=t(74630),x=t(66686),v=t(36982),f=t(93668),p=t(1544),g=t(90615),j=t(73033);t(80804);var b=t(74038),y=t(83171),N=t(63795),C=t(81565),w=t(3448),k=t(94744),I=t(37064),A=t(83008),M=t(28312),E=t(31458),S=t(29);let L=(0,l.memo)(e=>{let{language:n,value:t,onCopyContent:a,onApplyInEditor:r,canWrapLongLines:i,supportsOnApplyInEditorV2:o}=e,[d,c]=(0,l.useState)(!1),{isCopied:u,copyToClipboard:m}=(0,M.m)({timeout:2e3,onCopyContent:a});return(0,s.jsxs)("div",{className:"codeblock relative w-full bg-zinc-950 font-sans",children:[(0,s.jsxs)("div",{className:"flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100",children:[(0,s.jsx)("span",{className:"text-xs lowercase",children:n}),(0,s.jsxs)("div",{className:"flex items-center space-x-1",children:[i&&(0,s.jsxs)(S.u,{children:[(0,s.jsx)(S.aJ,{asChild:!0,children:(0,s.jsx)(E.z,{size:"icon",variant:"ghost",className:"text-xs hover:bg-[#3C382F] hover:text-[#F4F4F5] focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>c(!d),children:d?(0,s.jsx)(C.IconAlignJustify,{}):(0,s.jsx)(C.IconWrapText,{})})}),(0,s.jsx)(S._v,{children:(0,s.jsx)("p",{className:"m-0",children:"Toggle word wrap"})})]}),o&&r&&(0,s.jsxs)(S.u,{children:[(0,s.jsx)(S.aJ,{asChild:!0,children:(0,s.jsxs)(E.z,{variant:"ghost",size:"icon",className:"text-xs hover:bg-[#3C382F] hover:text-[#F4F4F5] focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>r(t,{languageId:n,smart:!0}),children:[(0,s.jsx)(C.IconSmartApplyInEditor,{}),(0,s.jsx)("span",{className:"sr-only",children:"Smart Apply in Editor"})]})}),(0,s.jsx)(S._v,{children:(0,s.jsx)("p",{className:"m-0",children:"Smart Apply in Editor"})})]}),r&&(0,s.jsxs)(S.u,{children:[(0,s.jsx)(S.aJ,{asChild:!0,children:(0,s.jsxs)(E.z,{variant:"ghost",size:"icon",className:"text-xs hover:bg-[#3C382F] hover:text-[#F4F4F5] focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>r(t,void 0),children:[(0,s.jsx)(C.IconApplyInEditor,{}),(0,s.jsx)("span",{className:"sr-only",children:"Apply in Editor"})]})}),(0,s.jsx)(S._v,{children:(0,s.jsx)("p",{className:"m-0",children:"Apply in Editor"})})]}),(0,s.jsxs)(S.u,{children:[(0,s.jsx)(S.aJ,{asChild:!0,children:(0,s.jsxs)(E.z,{variant:"ghost",size:"icon",className:"text-xs hover:bg-[#3C382F] hover:text-[#F4F4F5] focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",onClick:()=>{u||m(t)},children:[u?(0,s.jsx)(C.IconCheck,{}):(0,s.jsx)(C.IconCopy,{}),(0,s.jsx)("span",{className:"sr-only",children:"Copy"})]})}),(0,s.jsx)(S._v,{children:(0,s.jsx)("p",{className:"m-0",children:"Copy"})})]})]})]}),(0,s.jsx)(k.Z,{language:"toml"===n?"bash":n,style:A.RY,PreTag:"div",showLineNumbers:!0,wrapLongLines:d,customStyle:{margin:0,width:"100%",background:"transparent",padding:"1.5rem 1rem"},codeTagProps:{style:{fontSize:"0.9rem",fontFamily:"var(--font-mono)"}},renderer:e=>{let{rows:n,stylesheet:t,useInlineStyles:s}=e;return n.map((e,n)=>{let l=e.children,a=null==l?void 0:l.shift();return a&&(e.children=[a,{children:l,properties:{className:[]},tagName:"span",type:"element"}]),(0,I.ZP)({node:e,stylesheet:t,useInlineStyles:s,key:n})})},children:t})]})});L.displayName="CodeBlock";let T=(0,l.createContext)({});function R(e){var n;let{inline:t,className:a,children:r,...i}=e,{lookupSymbol:o,canWrapLongLines:d,onApplyInEditor:c,onCopyContent:u,supportsOnApplyInEditorV2:m,onNavigateToContext:h,symbolPositionMap:x}=(0,l.useContext)(T),v=null===(n=r[0])||void 0===n?void 0:n.toString(),f=v?x.get(v):void 0;if((0,l.useEffect)(()=>{t&&o&&v&&o(v)},[t,v,o]),r.length){if("▍"===r[0])return(0,s.jsx)("span",{className:"mt-1 animate-pulse cursor-default",children:"▍"});r[0]=r[0].replace("`▍`","▍")}if(t){let e=!!f;return(0,s.jsxs)("code",{className:(0,p.cn)("group/symbol",a,{symbol:!!o,"bg-muted leading-5 py-0.5":!!o&&!e,"inline-flex items-center gap-1 cursor-pointer hover:bg-muted/50 border":e}),onClick:()=>{e&&f&&h&&h({filepath:f.targetFile,range:{start:f.targetLine,end:f.targetLine},git_url:"",content:"",kind:"file"},{openInEditor:!0})},...i,children:[e&&(0,s.jsx)(C.IconSquareChevronRight,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),(0,s.jsx)("span",{className:(0,p.cn)("self-baseline",{"group-hover/symbol:text-primary":e}),children:r})]})}let g=/language-(\w+)/.exec(a||"");return(0,s.jsx)(L,{language:g&&g[1]||"",value:String(r).replace(/\n$/,""),onApplyInEditor:c,onCopyContent:u,canWrapLongLines:d,supportsOnApplyInEditorV2:m})}let _=e=>{let n=d().sanitize(e,{ALLOWED_TAGS:[],ALLOWED_ATTR:[]}),t=x.TU.parse(n),s=u().decode(t),l=s.replace(/<\/?[^>]+(>|$)/g,"");return l};function z(e){let{message:n,headline:t=!1,attachmentDocs:a,attachmentClientCode:r,attachmentCode:i,onApplyInEditor:o,onCopyContent:d,contextInfo:c,fetchingContextInfo:u,className:x,canWrapLongLines:g,onLookupSymbol:y,supportsOnApplyInEditorV2:N,activeSelection:C,onNavigateToContext:w,...k}=e,[I,A]=(0,l.useState)(new Map),M=(0,l.useMemo)(()=>{var e,n,t;let s=null!==(e=null==a?void 0:a.map(e=>({type:"doc",data:e})))&&void 0!==e?e:[],l=null!==(n=null==r?void 0:r.map(e=>({type:"code",data:e})))&&void 0!==n?n:[],o=null!==(t=null==i?void 0:i.map(e=>({type:"code",data:e})))&&void 0!==t?t:[];return(0,m.Z)([...s,...l,...o])},[a,r,i]),E=e=>{let n;let l=[],a=0,r=e=>{e&&l.push(e)},i=(t,i,o)=>{for(;null!==(n=t.exec(e));)r(e.slice(a,n.index)),l.push((0,s.jsx)(i,{...o(n)},n.index)),a=n.index+n[0].length};return i(b.H,Z,e=>{let n=parseInt(e[1],10),t=(0,h.Z)(n)?void 0:null==M?void 0:M[n-1],s=null==t?void 0:t.type,l=t&&!(0,h.Z)(n);return{citationIndex:n,showcitation:l,citationType:s,citationSource:t}}),i(b.z,O,e=>{let n=e[1];return{sourceId:n,className:t?"text-[1rem] font-semibold":void 0}}),r(e.slice(a)),l},S=async e=>{if(!y||I.has(e))return;A(n=>new Map(n.set(e,void 0)));let n=await y((null==C?void 0:C.filepath)?[null==C?void 0:C.filepath]:[],e);A(t=>new Map(t.set(e,n)))};return(0,s.jsx)(T.Provider,{value:{onCopyContent:d,onApplyInEditor:o,onCodeCitationClick:k.onCodeCitationClick,onCodeCitationMouseEnter:k.onCodeCitationMouseEnter,onCodeCitationMouseLeave:k.onCodeCitationMouseLeave,contextInfo:c,fetchingContextInfo:!!u,canWrapLongLines:!!g,supportsOnApplyInEditorV2:N,activeSelection:C,onNavigateToContext:w,symbolPositionMap:I,lookupSymbol:y?S:void 0},children:(0,s.jsx)(j.s,{className:(0,p.cn)("message-markdown prose max-w-none break-words dark:prose-invert prose-p:leading-relaxed prose-pre:mt-1 prose-pre:p-0",{"cursor-default":!!o},x),remarkPlugins:[v.Z,f.Z],components:{p(e){let{children:n}=e;return(0,s.jsx)("p",{className:"mb-2 last:mb-0",children:n.map((e,n)=>"string"==typeof e?E(e):(0,s.jsx)("span",{children:e},n))})},li(e){let{children:n}=e;return n&&n.length?(0,s.jsx)("li",{children:n.map((e,n)=>"string"==typeof e?E(e):(0,s.jsx)("span",{children:e},n))}):(0,s.jsx)("li",{children:n})},code(e){let{node:n,inline:t,className:l,children:a,...r}=e;return(0,s.jsx)(R,{node:n,inline:t,className:l,...r,children:a})}},children:n})})}function D(e){let{error:n="Failed to fetch"}=e,t=(0,l.useMemo)(()=>"```\n"+JSON.stringify({error:!0,message:n},null,2)+"\n```",[n]);return(0,s.jsx)(j.s,{className:"prose-full-width prose break-words text-sm dark:prose-invert prose-p:leading-relaxed prose-pre:mt-1 prose-pre:p-0",remarkPlugins:[v.Z,f.Z],components:{code(e){let{node:n,inline:t,className:l,children:a,...r}=e;return(0,s.jsx)("div",{...r,className:(0,p.cn)(l,"bg-zinc-950 p-2"),children:a})}},children:t})}function Z(e){let{citationIndex:n,showcitation:t,citationType:l,citationSource:a}=e;return(0,s.jsx)("div",{className:"inline",children:t&&(0,s.jsx)(s.Fragment,{children:"doc"===l?(0,s.jsx)(F,{relevantDocument:a.data,citationIndex:n}):"code"===l?(0,s.jsx)(P,{relevantCode:a.data,citationIndex:n}):null})})}function O(e){var n;let{sourceId:t,className:a}=e,{contextInfo:r,fetchingContextInfo:i}=(0,l.useContext)(T);if(!t)return null;let o=null==r?void 0:null===(n=r.sources)||void 0===n?void 0:n.find(e=>e.sourceId===t);return o?(0,s.jsx)("span",{className:"node-mention",children:(0,s.jsx)("span",{children:i?(0,s.jsx)(w.O,{className:"w-16"}):(0,s.jsx)(y.p,{id:o.sourceId,label:o.sourceName,kind:o.sourceKind,className:a})})}):null}function F(e){let{relevantDocument:n,citationIndex:t}=e,l=n?new URL(n.link):null,a=(null==n?void 0:n.__typename)==="MessageAttachmentIssueDoc",r=(null==n?void 0:n.__typename)==="MessageAttachmentPullDoc";return(0,s.jsxs)(g.zs,{children:[(0,s.jsx)(g.Yi,{children:(0,s.jsx)("span",{className:"relative -top-2 mr-0.5 inline-block h-4 w-4 cursor-pointer rounded-full bg-muted text-center text-xs font-medium",onClick:()=>window.open(n.link),children:t})}),(0,s.jsx)(g.bZ,{className:"w-96 text-sm",children:(0,s.jsxs)("div",{className:"flex w-full flex-col gap-y-1",children:[(0,s.jsxs)("div",{className:"m-0 flex items-center space-x-1 text-xs leading-none text-muted-foreground",children:[(0,s.jsx)(U,{hostname:l.hostname,className:"m-0 mr-1 leading-none"}),(0,s.jsx)("p",{className:"m-0 leading-none",children:l.hostname})]}),(0,s.jsx)("p",{className:"m-0 cursor-pointer font-bold leading-none transition-opacity hover:opacity-70",onClick:()=>window.open(n.link),children:n.title}),(0,s.jsxs)("div",{className:"mb-2 w-auto",children:[a&&(0,s.jsx)(H,{closed:n.closed}),r&&(0,s.jsx)($,{merged:n.merged})]}),(0,s.jsx)("p",{className:"m-0 line-clamp-4 leading-none",children:_((0,p.L5)(n))})]})})]})}function P(e){let{relevantCode:n,citationIndex:t}=e,{onCodeCitationClick:a,onCodeCitationMouseEnter:r,onCodeCitationMouseLeave:i}=(0,l.useContext)(T);return(0,s.jsx)("span",{className:"relative -top-2 mr-0.5 inline-block h-4 w-4 cursor-pointer rounded-full bg-muted text-center text-xs font-medium",onClick:()=>{null==a||a(n)},onMouseEnter:()=>{null==r||r(t)},onMouseLeave:()=>{null==i||i(t)},children:t})}function U(e){let{hostname:n,className:t}=e,[a,o]=(0,l.useState)(!1);return(0,s.jsxs)("div",{className:"relative h-3.5 w-3.5 shrink-0",children:[(0,s.jsx)(r(),{src:i,alt:n,width:14,height:14,className:(0,p.cn)("absolute left-0 top-0 z-0 h-3.5 w-3.5 rounded-full leading-none",t)}),(0,s.jsx)(r(),{src:"https://s2.googleusercontent.com/s2/favicons?sz=128&domain_url=".concat(n),alt:n,width:14,height:14,className:(0,p.cn)("relative z-10 h-3.5 w-3.5 rounded-full bg-card leading-none",t,{"opacity-0":!a}),onLoad:()=>{o(!0)}})]})}function H(e){let{closed:n}=e;return(0,s.jsxs)(N.C,{variant:n?"default":"secondary",className:"gap-1 py-1 text-xs",children:[n?(0,s.jsx)(C.IconCheckCircled,{className:"h-3.5 w-3.5"}):(0,s.jsx)(C.IconCircleDot,{className:"h-3.5 w-3.5"}),n?"Closed":"Open"]})}function $(e){let{merged:n}=e;return(0,s.jsxs)(N.C,{variant:n?"default":"secondary",className:"gap-1 py-1 text-xs",children:[n?(0,s.jsx)(C.IconGitMerge,{className:"h-3.5 w-3.5"}):(0,s.jsx)(C.IconGitPullRequest,{className:"h-3.5 w-3.5"}),n?"Merged":"Open"]})}},63795:function(e,n,t){"use strict";t.d(n,{C:function(){return i}});var s=t(36164);t(3546);var l=t(14375),a=t(1544);let r=(0,l.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",successful:"border-transparent bg-successful text-successful-foreground hover:bg-successful/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function i(e){let{className:n,variant:t,...l}=e;return(0,s.jsx)("div",{className:(0,a.cn)(r({variant:t}),n),...l})}},90615:function(e,n,t){"use strict";t.d(n,{Yi:function(){return o},bZ:function(){return d},zs:function(){return i}});var s=t(36164),l=t(3546),a=t(38421),r=t(1544);let i=a.fC,o=a.xz,d=l.forwardRef((e,n)=>{let{className:t,align:l="center",sideOffset:i=4,...o}=e;return(0,s.jsx)(a.VY,{ref:n,align:l,sideOffset:i,className:(0,r.cn)("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...o})});d.displayName=a.VY.displayName},52569:function(e,n,t){"use strict";t.d(n,{SQ:function(){return y},Yt:function(){return b},nY:function(){return j}});var s=t(36164),l=t(3546),a=t(87782),r=t(21454),i=t(36327),o=t(98454),d=t(3765),c=t(1544),u=t(66612);let m=l.forwardRef((e,n)=>{let{className:t,...l}=e;return(0,s.jsx)(u.fC,{ref:n,className:(0,c.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...l})});m.displayName=u.fC.displayName;let h=l.forwardRef((e,n)=>{let{className:t,...l}=e;return(0,s.jsx)(u.Ee,{ref:n,className:(0,c.cn)("aspect-square h-full w-full",t),...l})});h.displayName=u.Ee.displayName;let x=l.forwardRef((e,n)=>{let{className:t,...l}=e;return(0,s.jsx)(u.NY,{ref:n,className:(0,c.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...l})});x.displayName=u.NY.displayName;var v=t(3448),f=t(30410).lW;let p="not_found",g=new Set,j=e=>{g.delete(e),(0,r.JG)("/avatar/".concat(e))};function b(e){var n;let{user:t,className:r,fallback:o}=e,u=null==t?void 0:t.id,j=u?"/avatar/".concat(u):null,{data:b,isLoading:y,error:N}=(0,i.Z)(j,e=>{if(!(!u||g.has(u)))return(0,d.Z)(e,{responseFormatter:async e=>{let n=await e.blob(),t=f.from(await n.arrayBuffer());return"data:image/png;base64,".concat(t.toString("base64"))},errorHandler:e=>{if(404===e.status)throw Error(p)}})}),C=l.useMemo(()=>{if(null==t?void 0:t.email)return(0,a.B)(t.email)},[null==t?void 0:t.email]);return y?(0,s.jsx)(v.O,{className:(0,c.cn)("h-16 w-16 rounded-full",r)}):((null==N?void 0:N.message)===p&&u&&g.add(u),b||C||!o)?!b&&C?(0,s.jsx)(a.Z,{className:(0,c.cn)("h-16 w-16",r),...C}):(0,s.jsxs)(m,{className:(0,c.cn)("h-16 w-16",r),children:[(0,s.jsx)(h,{src:b,alt:null==t?void 0:t.email,className:"object-cover"}),(0,s.jsx)(x,{children:null==t?void 0:null===(n=t.email)||void 0===n?void 0:n.substring(0,2)})]}):o}function y(e){let[{data:n}]=(0,o.P)();return(0,s.jsx)(b,{user:null==n?void 0:n.me,...e})}},21808:function(e,n,t){"use strict";t.d(n,{$6:function(){return a},$I:function(){return r},L8:function(){return l},ir:function(){return i},o0:function(){return s}});let s="name@yourcompany.com",l=20,a={DEMO_AUTO_LOGIN:"_tabby_demo_autologin",SEARCH_INITIAL_MSG:"_tabby_search_initial_msg",SEARCH_INITIAL_CONTEXTS:"_tabby_search_initial_contexts"},r=48,i="NOT_FOUND"},12624:function(e,n,t){"use strict";t.d(n,{e:function(){return a}});var s=t(3546),l=t(62940);function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1?arguments[1]:void 0,[t,a]=s.useState(!1);return s.useEffect(()=>{if(n)return;let t=(0,l.Z)(()=>{a(window.innerHeight+window.scrollY>=document.body.offsetHeight-e)},100,{leading:!0});return window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t,{passive:!0}),t(),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e,n]),s.useEffect(()=>{if(!n)return;let t=(0,l.Z)(()=>{let{scrollTop:t,clientHeight:s,scrollHeight:l}=n;a(t+s>=l-e)},100,{leading:!0});return n.addEventListener("scroll",t,{passive:!0}),n.addEventListener("resize",t,{passive:!0}),t(),()=>{n.removeEventListener("scroll",t),n.removeEventListener("resize",t)}},[e,n]),t}},64566:function(e,n,t){"use strict";t.d(n,{x:function(){return u}});var s=t(3546),l=t(43240),a=t(11634),r=t(16784);let i=(0,l.BX)("\n subscription CreateThreadAndRun($input: CreateThreadAndRunInput!) {\n createThreadAndRun(input: $input) {\n __typename\n ... on ThreadCreated {\n id\n }\n ... on ThreadUserMessageCreated {\n id\n }\n ... on ThreadAssistantMessageCreated {\n id\n }\n ... on ThreadRelevantQuestions {\n questions\n }\n ... on ThreadAssistantMessageAttachmentsCode {\n hits {\n code {\n gitUrl\n filepath\n language\n content\n startLine\n }\n scores {\n rrf\n bm25\n embedding\n }\n }\n }\n ... on ThreadAssistantMessageAttachmentsDoc {\n hits {\n doc {\n __typename\n ... on MessageAttachmentWebDoc {\n title\n link\n content\n }\n ... on MessageAttachmentIssueDoc {\n title\n link\n body\n closed\n }\n ... on MessageAttachmentPullDoc {\n title\n link\n body\n merged\n }\n }\n score\n }\n }\n ... on ThreadAssistantMessageContentDelta {\n delta\n }\n ... on ThreadAssistantMessageCompleted {\n id\n }\n }\n }\n"),o=(0,l.BX)("\n subscription CreateThreadRun($input: CreateThreadRunInput!) {\n createThreadRun(input: $input) {\n __typename\n ... on ThreadCreated {\n id\n }\n ... on ThreadUserMessageCreated {\n id\n }\n ... on ThreadAssistantMessageCreated {\n id\n }\n ... on ThreadRelevantQuestions {\n questions\n }\n ... on ThreadAssistantMessageAttachmentsCode {\n hits {\n code {\n gitUrl\n filepath\n language\n content\n startLine\n }\n scores {\n rrf\n bm25\n embedding\n }\n }\n }\n ... on ThreadAssistantMessageAttachmentsDoc {\n hits {\n doc {\n __typename\n ... on MessageAttachmentWebDoc {\n title\n link\n content\n }\n ... on MessageAttachmentIssueDoc {\n title\n link\n body\n closed\n }\n ... on MessageAttachmentPullDoc {\n title\n link\n body\n merged\n }\n }\n score\n }\n }\n ... on ThreadAssistantMessageContentDelta {\n delta\n }\n ... on ThreadAssistantMessageCompleted {\n id\n }\n }\n }\n"),d=(0,l.BX)("\n mutation DeleteThreadMessagePair(\n $threadId: ID!\n $userMessageId: ID!\n $assistantMessageId: ID!\n ) {\n deleteThreadMessagePair(\n threadId: $threadId\n userMessageId: $userMessageId\n assistantMessageId: $assistantMessageId\n )\n }\n"),c=()=>({content:"",completed:!1});function u(e){let{threadId:n,onAssistantMessageCompleted:t}=e,[l,u]=s.useState(n),m=s.useRef(),[h,x]=s.useState(!1),[v,f]=s.useState(c()),[p,g]=s.useState(),j=(e,n)=>{let t={...e};switch(n.__typename){case"ThreadCreated":t.threadId=n.id;break;case"ThreadUserMessageCreated":t.userMessageId=n.id;break;case"ThreadAssistantMessageCreated":t.assistantMessageId=n.id;break;case"ThreadRelevantQuestions":t.relevantQuestions=n.questions;break;case"ThreadAssistantMessageAttachmentsCode":t.attachmentsCode=n.hits;break;case"ThreadAssistantMessageAttachmentsDoc":t.attachmentsDoc=n.hits;break;case"ThreadAssistantMessageContentDelta":t.content+=n.delta;break;case"ThreadAssistantMessageCompleted":t.completed=!0;break;default:throw Error("Unknown event "+JSON.stringify(t))}return t},b=(0,r.d)(e=>{var n;null===(n=m.current)||void 0===n||n.call(m),m.current=void 0,x(!1),!e&&l&&(null==t||t(v))});s.useEffect(()=>{n!==l&&u(n)},[n]);let y=(e,n)=>{let{unsubscribe:t}=a.Lp.subscription(i,{input:{thread:{userMessage:e},options:n}}).subscribe(e=>{var n;if(null==e?void 0:e.error){x(!1),g(e.error),t();return}let s=null===(n=e.data)||void 0===n?void 0:n.createThreadAndRun;s&&((null==s?void 0:s.__typename)==="ThreadAssistantMessageCompleted"&&b.current(),(null==s?void 0:s.__typename)==="ThreadCreated"&&s.id!==l&&u(s.id),f(e=>j(e,s)))});return t},N=(e,n)=>{if(!l)return;let{unsubscribe:t}=a.Lp.subscription(o,{input:{threadId:l,additionalUserMessage:e,options:n}}).subscribe(e=>{var n;if(null==e?void 0:e.error){x(!1),g(e.error),t();return}let s=null===(n=e.data)||void 0===n?void 0:n.createThreadRun;s&&("ThreadAssistantMessageCompleted"===s.__typename&&b.current(),f(e=>j(e,s)))});return t},C=(0,a.Db)(d),w=(e,n)=>{h||(x(!0),g(void 0),f(c()),l?m.current=N(e,n):m.current=y(e,n))},k=(e,n,t)=>C({threadId:e,userMessageId:n,assistantMessageId:t}).then(e=>{var n;if(!(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.deleteThreadMessagePair)){if(null==e?void 0:e.error)throw e.error;throw Error("Failed to fetch")}});return{isLoading:h,answer:v,error:p,sendUserMessage:w,stop:b.current,regenerate:e=>l?(x(!0),g(void 0),f(c()),k(e.threadId,e.userMessageId,e.assistantMessageId).then(()=>{w(e.userMessage,e.threadRunOptions)}).catch(e=>{let n=e instanceof Error?e:Error("Failed to fetch");g(n),x(!1)})):Promise.resolve(void 0),deleteThreadMessagePair:k}}},47241:function(e,n,t){"use strict";t.d(n,{Eg:function(){return a},qs:function(){return r}});var s=t(17451);let l=s.a.setState,a=e=>{l(()=>({selectedModel:e}))},r=e=>{l(()=>({enableActiveSelection:e}))}},80804:function(){}}]);
\ No newline at end of file
diff --git a/ee/tabby-webserver/ui/_next/static/chunks/app/chat/page-2779ca4e30ac62b5.js b/ee/tabby-webserver/ui/_next/static/chunks/app/chat/page-2779ca4e30ac62b5.js
deleted file mode 100644
index 3c4a96f56230..000000000000
--- a/ee/tabby-webserver/ui/_next/static/chunks/app/chat/page-2779ca4e30ac62b5.js
+++ /dev/null
@@ -1 +0,0 @@
-(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{78627:function(e,t,n){Promise.resolve().then(n.bind(n,7931))},7931:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return k}});var r=n(36164),o=n(3546),a=n(42891),l=n.n(a),i=n(11978),s=n(23342),u=n(94755),c=n(47190),d=n.n(c),f=n(42450),m=n(36982),p=n(93668),y=n(11075),h=n(14439),w=n(1544),g=n(31458),b=n(81565),v=n(66534),x=n(73033);n(2596);var E=n(66794);let S=e=>d()(e).hsl().toString().replace(/hsla?\(/,"").replace(")","").split(",").slice(0,3).map((e,t)=>0===t?parseFloat(e).toFixed(1):e).join("");function k(){let[e,t]=(0,o.useState)(!1),[n,a]=(0,o.useState)(null),[c,d]=(0,o.useState)(""),[k,j]=(0,o.useState)([]),[C,L]=(0,o.useState)([]),[_,M]=(0,o.useState)(null),[A,K]=(0,o.useState)(null),[I,N]=(0,o.useState)(!1),O=(0,o.useRef)(null),[R,P]=(0,o.useState)(!1),{width:T}=(0,u.iP)(),q=(0,o.useRef)(T),W=(0,o.useRef)(null),F=(0,i.useSearchParams)(),V=F.get("client"),Y=!!V||void 0,$=(0,o.useRef)(),[z,H]=(0,o.useState)(!1),[U,Z]=(0,o.useState)(!1),D=e=>{if(O.current)O.current.sendUserChat(e);else{let t=[...k];t.push(e),j(t)}},X=e=>{if(O.current)O.current.addRelevantContext(e);else{let t=[...C];t.push(e),L(t)}},B=(0,h.H)({init:e=>{O.current||(V&&(0,E.zr)(e.fetcherOptions),d((0,w.x0)()),t(!0),a(e.fetcherOptions),$.current=e.useMacOSKeyboardEventHandler)},sendMessage:e=>D(e),showError:e=>{K(e)},cleanError:()=>{K(null)},addRelevantContext:e=>X(e),updateTheme:(e,t)=>{let n=e.split(";").filter(e=>e).map(e=>{let[t,n]=e.split(":"),r=n.trim(),o=r.startsWith("#")||r.startsWith("rgb");if(!o)return"".concat(t,": ").concat(n);let a=S(r);return"".concat(t,": ").concat(a)}).join(";");document.documentElement.style.cssText=n,document.documentElement.className=t+" client client-".concat(V)},updateActiveSelection:e=>{O.current?O.current.updateActiveSelection(e):e&&M(e)}});(0,o.useEffect)(()=>{let e=()=>{setTimeout(()=>{var e;null===(e=W.current)||void 0===e||e.focus()},0)};return window.addEventListener("focus",e),()=>{window.removeEventListener("focus",e)}}),(0,o.useEffect)(()=>{let e=(e,t)=>{null==B||B.onKeyboardEvent(e,{code:t.code,isComposing:t.isComposing,key:t.key,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey,location:t.location,repeat:t.repeat,keyCode:t.keyCode})},t=t=>{$.current?t.metaKey&&"KeyC"===t.code?document.execCommand("copy"):t.metaKey&&"KeyX"===t.code?document.execCommand("cut"):t.metaKey&&"KeyV"===t.code?document.execCommand("paste"):t.metaKey&&"KeyA"===t.code?document.execCommand("selectAll"):e("keydown",t):e("keydown",t)},n=t=>{e("keyup",t)},r=t=>{e("keypress",t)};return window.addEventListener("keydown",t),window.addEventListener("keyup",n),window.addEventListener("keypress",r),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",n),window.removeEventListener("keypress",r)}},[B,V]),(0,o.useEffect)(()=>{if(B){null==B||B.onLoaded({apiVersion:y.uL});let e=async()=>{null==B||B.hasCapability("onApplyInEditorV2").then(H),null==B||B.hasCapability("onLookupSymbol").then(Z)};e()}},[B]),(0,o.useLayoutEffect)(()=>{if(R){if(T&&e&&n&&!A&&!q.current){var t;null===(t=O.current)||void 0===t||t.focus()}q.current=T}},[T,R]);let G=()=>{L([]),j([]),M(null)},J=async()=>{N(!0),await (null==B?void 0:B.refresh()),N(!1)};function Q(e){let{children:t}=e;return(0,r.jsxs)("div",{className:"h-screen w-screen",style:{padding:"intellij"==V?"20px":"5px 18px"},children:[(0,r.jsxs)("div",{className:"flex items-center",style:{marginBottom:"0.55em"},children:[(0,r.jsx)(l(),{src:s.Z,alt:"logo",className:"rounded-full",style:{background:"rgb(232, 226, 210)",marginRight:"0.375em",padding:"0.15em"},width:18}),(0,r.jsx)("p",{className:"font-semibold",children:"Tabby"})]}),t]})}return A?(0,r.jsx)(Q,{children:(0,r.jsxs)(r.Fragment,{children:[A.title&&(0,r.jsx)("p",{className:"mb-1.5 mt-2 font-semibold",children:A.title}),(0,r.jsx)(x.s,{className:"prose max-w-none break-words dark:prose-invert prose-p:leading-relaxed prose-pre:mt-1 prose-pre:p-0",remarkPlugins:[m.Z,p.Z],children:A.content}),(0,r.jsxs)(g.z,{className:"mt-5 flex items-center gap-x-2 text-sm leading-none",onClick:J,children:[I&&(0,r.jsx)(b.IconSpinner,{}),"Refresh"]})]})}):e&&n?(0,r.jsx)(f.SV,{FallbackComponent:function(e){let{error:t}=e;return(0,r.jsxs)(Q,{children:[(0,r.jsx)("p",{className:"mb-1.5 mt-2 font-semibold",children:"Something went wrong"}),(0,r.jsx)("p",{children:t.message}),(0,r.jsxs)(g.z,{className:"mt-5 flex items-center gap-x-2 text-sm leading-none",onClick:J,children:[I&&(0,r.jsx)(b.IconSpinner,{}),"Refresh"]})]})},children:(0,r.jsx)(v.e,{chatId:c,ref:O,chatInputRef:W,onNavigateToContext:(e,t)=>{null==B||B.navigate(e,t)},onLoaded:()=>{var e;C.forEach(X),k.forEach(D),null===(e=O.current)||void 0===e||e.updateActiveSelection(_),G(),P(!0)},maxWidth:"vscode"===V?"5xl":void 0,onCopyContent:Y&&(null==B?void 0:B.onCopy),onSubmitMessage:Y&&(null==B?void 0:B.onSubmitMessage),onApplyInEditor:Y&&(z?null==B?void 0:B.onApplyInEditorV2:null==B?void 0:B.onApplyInEditor),supportsOnApplyInEditorV2:z,onLookupSymbol:Y&&(U?null==B?void 0:B.onLookupSymbol:void 0)},c)}):(0,r.jsx)(Q,{children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"opacity-80",children:"Welcome to Tabby Chat! Just a moment while we get things ready..."}),(0,r.jsx)(b.IconSpinner,{className:"mx-auto",style:{marginTop:"1.25em",width:"0.875em",height:"0.875em"}})]})})}},2596:function(){},11075:function(e,t,n){"use strict";n.d(t,{eI:function(){return a},n0:function(){return l},uL:function(){return o}});var r=n(44494);let o="0.3.0";function a(e,t){return(0,r.K9)(e,{expose:{navigate:t.navigate,refresh:t.refresh,onSubmitMessage:t.onSubmitMessage,onApplyInEditor:t.onApplyInEditor,onLoaded:t.onLoaded,onCopy:t.onCopy,onKeyboardEvent:t.onKeyboardEvent,onLookupSymbol:t.onLookupSymbol}})}function l(e){return(0,r.cy)({expose:{init:e.init,sendMessage:e.sendMessage,showError:e.showError,cleanError:e.cleanError,addRelevantContext:e.addRelevantContext,updateTheme:e.updateTheme,updateActiveSelection:e.updateActiveSelection}})}},14439:function(e,t,n){"use strict";n.d(t,{H:function(){return l},m:function(){return a}});var r=n(3546),o=n(11075);function a(e,t){let[n,a]=(0,r.useState)(null),l=!1;return(0,r.useEffect)(()=>{e.current&&!l&&(l=!0,a((0,o.eI)(e.current,t)))},[e.current]),n}function l(e){let[t,n]=(0,r.useState)(null),a=!1;return(0,r.useEffect)(()=>{let t=window.self!==window.top;t&&!a&&(a=!0,n((0,o.n0)(e)))},[]),t}n(44494)},44494:function(e,t,n){"use strict";n.d(t,{K9:function(){return g},cy:function(){return b}});let r=Symbol.for("quilt.threads.retain"),o=Symbol.for("quilt.threads.release"),a=Symbol.for("quilt.threads.retained-by"),l=Symbol.for("quilt.threads.encode"),i=Symbol.for("quilt.threads.transferable");class s{memoryManaged=new Set;add(e){this.memoryManaged.add(e),e[a].add(this),e[r]()}release(){for(let e of this.memoryManaged)e[a].delete(this),e[o]();this.memoryManaged.clear()}}function u(e){return!!(e&&e[r]&&e[o])}function c(e){if(null==e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return null==t||t===Object.prototype}function d(e,{expose:t,callable:n,signal:d,uuid:p=m,encoder:y=function({encode:e,decode:t}={}){return{encode:function(e,t){let r={api:t,seen:new Map,encode:e=>n(e,r,!0)};return n(e,r)},decode:function(e,t,n){let o={api:t,decode:e=>r(e,o,n,!0)};return r(e,o)}};function n(t,r,o=!1){let{seen:a,api:s,encode:u}=r;if(!o&&e)return e(t,u);if(null==t)return[t];let d=a.get(t);if(d)return d;if(a.set(t,[void 0]),"object"==typeof t){if(t[i]){let e=[t,[t]];return a.set(t,e),e}let e=[],o=t=>{let[o,a=[]]=n(t,r);return e.push(...a),o};if("function"==typeof t[l]){let n=t[l]({encode:o}),r=[n,e];return a.set(t,r),r}if(Array.isArray(t)){let n=t.map(e=>o(e)),r=[n,e];return a.set(t,r),r}if(t instanceof RegExp){let n={"_@r":[t.source,t.flags]},r=[n,e];return a.set(t,r),r}if(t instanceof URL){let n={"_@u":t.href},r=[n,e];return a.set(t,r),r}if(t instanceof Date){let n={"_@d":t.toISOString()},r=[n,e];return a.set(t,r),r}if(t instanceof Map){let n=[...t.entries()].map(([e,t])=>[o(e),o(t)]),r=[{"_@m":n},e];return a.set(t,r),r}if(t instanceof Set){let n=[...t].map(e=>o(e)),r=[{"_@s":n},e];return a.set(t,r),r}let s=null!=t&&(Symbol.asyncIterator in t||Symbol.iterator in t)&&"function"==typeof t.next;if(c(t)||s){let n={};for(let e of Object.keys(t))n[e]=o(t[e]);s&&(n.next??=o(t.next.bind(t)),n.return??=o(t.return.bind(t)),n.throw??=o(t.throw.bind(t)),n["_@i"]=!0);let r=[n,e];return a.set(t,r),r}}if("function"==typeof t){let e=s.functions?.add(t);if(null==e)return[e];let n=[{"_@f":e}];return a.set(t,n),n}let f=[t];return a.set(t,f),f}function r(e,n,o,a=!1){let{api:l,decode:i}=n;if(!a&&t)return t(e,i,o);if("object"==typeof e){if(null==e)return e;if(Array.isArray(e))return e.map(e=>r(e,n,o));if("_@r"in e)return new RegExp(...e["_@r"]);if("_@u"in e)return new URL(e["_@u"]);if("_@d"in e)return new Date(e["_@d"]);if("_@m"in e)return new Map(e["_@m"].map(([e,t])=>[r(e,n,o),r(t,n,o)]));if("_@s"in e)return new Set(e["_@s"].map(e=>r(e,n,o)));if("_@f"in e){let t=e["_@f"],n=l.functions?.get(t);if(o&&u(n))for(let e of o)e.add(n);return n}if(!c(e))return e;let t={};for(let a of Object.keys(e))"_@i"===a?t[Symbol.asyncIterator]=()=>t:t[a]=r(e[a],n,o);return t}return e}}()}={}){let h=!1,w=new Map,g=new Map,b=new Map,v=new Map;if(t)for(let e of Object.keys(t)){let n=t[e];"function"==typeof n&&w.set(e,n)}let x=new Map,E=function(e,t){let n;if(null==t){if("function"!=typeof Proxy)throw Error("You must pass an array of callable methods in environments without Proxies.");let t=new Map;n=new Proxy({},{get(n,r){if(t.has(r))return t.get(r);let o=e(r);return t.set(r,o),o}})}else for(let r of(n={},t))Object.defineProperty(n,r,{value:e(r),writable:!1,configurable:!0,enumerable:!0});return n}(function(e){return(...t)=>{try{if(h)throw new f;if("string"!=typeof e&&"number"!=typeof e)throw Error(`Can’t call a symbol method on a thread: ${e.toString()}`);if("hasCapability"===e){let e=t[0],n=p(),r=L(n);return j(7,[n,e]),r}let n=p(),r=L(n),[o,a]=y.encode(t,S);return j(0,[n,e,o],a),r}catch(e){return Promise.reject(e)}}},n),S={functions:{add(e){let t=g.get(e);return null==t&&(t=p(),g.set(e,t),b.set(t,e)),t},get(e){let t=v.get(e);if(t)return t;let n=0,l=!1;return Object.defineProperties(t=(...t)=>{if(l)throw Error("You attempted to call a function that was already released.");if(!v.has(e))throw Error("You attempted to call a function that was already revoked.");let[n,r]=y.encode(t,S),o=p(),a=L(o);return j(5,[o,e,n],r),a},{[o]:{value:()=>{0==(n-=1)&&(l=!0,v.delete(e),j(3,[e]))},writable:!1},[r]:{value:()=>{n+=1},writable:!1},[a]:{value:new Set,writable:!1}}),v.set(e,t),t}}},k=()=>{if(!h){for(let e of x.keys())_(e,new f);h=!0,w.clear(),x.clear(),g.clear(),b.clear(),v.clear()}};return d?.addEventListener("abort",()=>{j(2,[]),k()},{once:!0}),e.listen(C,{signal:d}),E;function j(t,n,r){h||e.send([t,n],r)}async function C(e){let t=Array.isArray(e)&&"number"==typeof e[0]&&(null==e[1]||Array.isArray(e[1]));if(t)switch(e[0]){case 2:k();break;case 0:{let t=new s,[n,r,o]=e[1],a=w.get(r);try{if(null==a)throw Error(`No '${r}' method is exposed on this endpoint`);let e=await a(...y.decode(o,S,[t])),[l,i]=y.encode(e,S);j(1,[n,void 0,l],i)}catch(o){let{name:e,message:t,stack:r}=o;j(1,[n,{name:e,message:t,stack:r}])}finally{t.release()}break}case 1:case 6:_(...e[1]);break;case 3:{let[t]=e[1],n=b.get(t);n&&(b.delete(t),g.delete(n));break}case 5:{let[t,n,r]=e[1],o=new s;try{let e=b.get(n);if(null==e)throw Error("You attempted to call a function that was already released.");let l=await e(...y.decode(r,S,u(e)?[...e[a],o]:[o])),[i,s]=y.encode(l,S);j(6,[t,void 0,i],s)}catch(o){let{name:e,message:n,stack:r}=o;j(6,[t,{name:e,message:n,stack:r}])}finally{o.release()}break}case 7:{let[t,n]=e[1],r=w.has(n);j(1,[t,void 0,y.encode(r,S)[0]])}}}function L(e){let t=new Promise((t,n)=>{x.set(e,(e,r,o)=>{if(null==r)t(y.decode(o,S));else{let e=Error();Object.assign(e,r),n(e)}})});return Object.defineProperty(t,Symbol.asyncIterator,{async *value(){let e=await t;Object.defineProperty(e,Symbol.asyncIterator,{value:()=>e}),yield*e}}),t}function _(...e){let t=e[0],n=x.get(t);n&&(n(...e),x.delete(t))}}class f extends Error{constructor(){super("You attempted to call a function on a terminated thread.")}}function m(){return`${p()}-${p()}-${p()}-${p()}`}function p(){return Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)}var y=n(18400);let h="quilt.threads.ping",w="quilt.threads.pong";function g(e,{targetOrigin:t="*",...n}={}){let r=!1,o=function(n,r){e.contentWindow?.postMessage(n,t,r)},a=new Promise(t=>{let a=n.signal?new y.z(n.signal):new AbortController;window.addEventListener("message",n=>{n.source===e.contentWindow&&n.data===w&&(r=!0,a.abort(),t())},{signal:a.signal}),a.signal.addEventListener("abort",()=>{t()},{once:!0}),o(h)});return d({send:(e,t)=>r?o(e,t):a.then(()=>{if(r)return o(e,t)}),listen(t,{signal:n}){self.addEventListener("message",n=>{n.source===e.contentWindow&&n.data!==w&&t(n.data)},{signal:n})}},n)}function b({targetOrigin:e="*",...t}={}){if("undefined"==typeof self||null==self.parent)throw Error("You are not inside an iframe, because there is no parent window.");let{parent:n}=self,r=t.signal?new y.z(t.signal):new AbortController,o=()=>{let r=()=>n.postMessage(w,e);self.addEventListener("message",({data:e})=>{e===h&&r()},{signal:t.signal}),r()};return"complete"===document.readyState?o():document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&(o(),r.abort())},{signal:r.signal}),d({send:(t,r)=>n.postMessage(t,e,r),listen(e,{signal:t}){self.addEventListener("message",t=>{t.data!==h&&e(t.data)},{signal:t})}},t)}}},function(e){e.O(0,[8415,3078,753,1386,55,3126,9643,4752,3449,2578,8511,4421,1454,7070,9610,4546,3299,9275,4405,5083,8756,1266,440,4755,7732,2763,1544,1565,3821,5871,6534,3375,5289,1744],function(){return e(e.s=78627)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/ee/tabby-webserver/ui/_next/static/chunks/app/chat/page-40a9138da93a66dc.js b/ee/tabby-webserver/ui/_next/static/chunks/app/chat/page-40a9138da93a66dc.js
new file mode 100644
index 000000000000..9e319bd88f0f
--- /dev/null
+++ b/ee/tabby-webserver/ui/_next/static/chunks/app/chat/page-40a9138da93a66dc.js
@@ -0,0 +1 @@
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1929],{78627:function(e,t,n){Promise.resolve().then(n.bind(n,7931))},7931:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return k}});var r=n(36164),o=n(3546),a=n(42891),l=n.n(a),i=n(11978),s=n(23342),u=n(94755),c=n(47190),d=n.n(c),f=n(42450),p=n(36982),m=n(93668),y=n(11075),h=n(14439),w=n(1544),g=n(31458),b=n(81565),v=n(66534),E=n(73033);n(2596);var x=n(66794);let S=e=>d()(e).hsl().toString().replace(/hsla?\(/,"").replace(")","").split(",").slice(0,3).map((e,t)=>0===t?parseFloat(e).toFixed(1):e).join("");function k(){let[e,t]=(0,o.useState)(!1),[n,a]=(0,o.useState)(null),[c,d]=(0,o.useState)(""),[k,j]=(0,o.useState)([]),[C,A]=(0,o.useState)([]),[_,M]=(0,o.useState)(null),[I,L]=(0,o.useState)(null),[K,N]=(0,o.useState)(!1),O=(0,o.useRef)(null),[R,P]=(0,o.useState)(!1),{width:T}=(0,u.iP)(),V=(0,o.useRef)(T),q=(0,o.useRef)(null),W=(0,i.useSearchParams)(),F=W.get("client"),Y=!!F||void 0,$=(0,o.useRef)(),[z,H]=(0,o.useState)(!1),[U,Z]=(0,o.useState)(!1),D=e=>{if(O.current)O.current.sendUserChat(e);else{let t=[...k];t.push(e),j(t)}},X=e=>{if(O.current)O.current.addRelevantContext(e);else{let t=[...C];t.push(e),A(t)}},B=(0,h.H)({init:e=>{O.current||(F&&(0,x.zr)(e.fetcherOptions),d((0,w.x0)()),t(!0),a(e.fetcherOptions),$.current=e.useMacOSKeyboardEventHandler)},sendMessage:e=>D(e),showError:e=>{L(e)},cleanError:()=>{L(null)},addRelevantContext:e=>X(e),updateTheme:(e,t)=>{let n=e.split(";").filter(e=>e).map(e=>{let[t,n]=e.split(":"),r=n.trim(),o=r.startsWith("#")||r.startsWith("rgb");if(!o)return"".concat(t,": ").concat(n);let a=S(r);return"".concat(t,": ").concat(a)}).join(";");document.documentElement.style.cssText=n,document.documentElement.className=t+" client client-".concat(F)},updateActiveSelection:e=>{O.current?O.current.updateActiveSelection(e):e&&M(e)}});(0,o.useEffect)(()=>{let e=()=>{setTimeout(()=>{var e;null===(e=q.current)||void 0===e||e.focus()},0)};return window.addEventListener("focus",e),()=>{window.removeEventListener("focus",e)}}),(0,o.useEffect)(()=>{let e=(e,t)=>{null==B||B.onKeyboardEvent(e,{code:t.code,isComposing:t.isComposing,key:t.key,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,shiftKey:t.shiftKey,location:t.location,repeat:t.repeat,keyCode:t.keyCode})},t=t=>{$.current?t.metaKey&&"KeyC"===t.code?document.execCommand("copy"):t.metaKey&&"KeyX"===t.code?document.execCommand("cut"):t.metaKey&&"KeyV"===t.code?document.execCommand("paste"):t.metaKey&&"KeyA"===t.code?document.execCommand("selectAll"):e("keydown",t):e("keydown",t)},n=t=>{e("keyup",t)},r=t=>{e("keypress",t)};return window.addEventListener("keydown",t),window.addEventListener("keyup",n),window.addEventListener("keypress",r),()=>{window.removeEventListener("keydown",t),window.removeEventListener("keyup",n),window.removeEventListener("keypress",r)}},[B,F]),(0,o.useEffect)(()=>{if(B){null==B||B.onLoaded({apiVersion:y.uL});let e=async()=>{null==B||B.hasCapability("onApplyInEditorV2").then(H),null==B||B.hasCapability("lookupSymbol").then(Z)};e()}},[B]),(0,o.useLayoutEffect)(()=>{if(R){if(T&&e&&n&&!I&&!V.current){var t;null===(t=O.current)||void 0===t||t.focus()}V.current=T}},[T,R]);let G=()=>{A([]),j([]),M(null)},J=async()=>{N(!0),await (null==B?void 0:B.refresh()),N(!1)};function Q(e){let{children:t}=e;return(0,r.jsxs)("div",{className:"h-screen w-screen",style:{padding:"intellij"==F?"20px":"5px 18px"},children:[(0,r.jsxs)("div",{className:"flex items-center",style:{marginBottom:"0.55em"},children:[(0,r.jsx)(l(),{src:s.Z,alt:"logo",className:"rounded-full",style:{background:"rgb(232, 226, 210)",marginRight:"0.375em",padding:"0.15em"},width:18}),(0,r.jsx)("p",{className:"font-semibold",children:"Tabby"})]}),t]})}return I?(0,r.jsx)(Q,{children:(0,r.jsxs)(r.Fragment,{children:[I.title&&(0,r.jsx)("p",{className:"mb-1.5 mt-2 font-semibold",children:I.title}),(0,r.jsx)(E.s,{className:"prose max-w-none break-words dark:prose-invert prose-p:leading-relaxed prose-pre:mt-1 prose-pre:p-0",remarkPlugins:[p.Z,m.Z],children:I.content}),(0,r.jsxs)(g.z,{className:"mt-5 flex items-center gap-x-2 text-sm leading-none",onClick:J,children:[K&&(0,r.jsx)(b.IconSpinner,{}),"Refresh"]})]})}):e&&n?(0,r.jsx)(f.SV,{FallbackComponent:function(e){let{error:t}=e;return(0,r.jsxs)(Q,{children:[(0,r.jsx)("p",{className:"mb-1.5 mt-2 font-semibold",children:"Something went wrong"}),(0,r.jsx)("p",{children:t.message}),(0,r.jsxs)(g.z,{className:"mt-5 flex items-center gap-x-2 text-sm leading-none",onClick:J,children:[K&&(0,r.jsx)(b.IconSpinner,{}),"Refresh"]})]})},children:(0,r.jsx)(v.e,{chatId:c,ref:O,chatInputRef:q,onNavigateToContext:(e,t)=>{null==B||B.navigate(e,t)},onLoaded:()=>{var e;C.forEach(X),k.forEach(D),null===(e=O.current)||void 0===e||e.updateActiveSelection(_),G(),P(!0)},maxWidth:"vscode"===F?"5xl":void 0,onCopyContent:Y&&(null==B?void 0:B.onCopy),onSubmitMessage:Y&&(null==B?void 0:B.onSubmitMessage),onApplyInEditor:Y&&(z?null==B?void 0:B.onApplyInEditorV2:null==B?void 0:B.onApplyInEditor),supportsOnApplyInEditorV2:z,onLookupSymbol:Y&&(U?null==B?void 0:B.lookupSymbol:void 0),openInEditor:Y&&(null==B?void 0:B.openInEditor)},c)}):(0,r.jsx)(Q,{children:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"opacity-80",children:"Welcome to Tabby Chat! Just a moment while we get things ready..."}),(0,r.jsx)(b.IconSpinner,{className:"mx-auto",style:{marginTop:"1.25em",width:"0.875em",height:"0.875em"}})]})})}},2596:function(){},11075:function(e,t,n){"use strict";n.d(t,{eI:function(){return a},n0:function(){return l},uL:function(){return o}});var r=n(44494);let o="0.4.0";function a(e,t){return(0,r.K9)(e,{expose:{navigate:t.navigate,refresh:t.refresh,onSubmitMessage:t.onSubmitMessage,onApplyInEditor:t.onApplyInEditor,onApplyInEditorV2:t.onApplyInEditorV2,onLoaded:t.onLoaded,onCopy:t.onCopy,onKeyboardEvent:t.onKeyboardEvent,lookupSymbol:t.lookupSymbol,openInEditor:t.openInEditor}})}function l(e){return(0,r.cy)({expose:{init:e.init,sendMessage:e.sendMessage,showError:e.showError,cleanError:e.cleanError,addRelevantContext:e.addRelevantContext,updateTheme:e.updateTheme,updateActiveSelection:e.updateActiveSelection}})}},14439:function(e,t,n){"use strict";n.d(t,{H:function(){return l},m:function(){return a}});var r=n(3546),o=n(11075);function a(e,t){let[n,a]=(0,r.useState)(null),l=!1;return(0,r.useEffect)(()=>{e.current&&!l&&(l=!0,a((0,o.eI)(e.current,t)))},[e.current]),n}function l(e){let[t,n]=(0,r.useState)(null),a=!1;return(0,r.useEffect)(()=>{let t=window.self!==window.top;t&&!a&&(a=!0,n((0,o.n0)(e)))},[]),t}n(44494)},44494:function(e,t,n){"use strict";n.d(t,{K9:function(){return g},cy:function(){return b}});let r=Symbol.for("quilt.threads.retain"),o=Symbol.for("quilt.threads.release"),a=Symbol.for("quilt.threads.retained-by"),l=Symbol.for("quilt.threads.encode"),i=Symbol.for("quilt.threads.transferable");class s{memoryManaged=new Set;add(e){this.memoryManaged.add(e),e[a].add(this),e[r]()}release(){for(let e of this.memoryManaged)e[a].delete(this),e[o]();this.memoryManaged.clear()}}function u(e){return!!(e&&e[r]&&e[o])}function c(e){if(null==e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return null==t||t===Object.prototype}function d(e,{expose:t,callable:n,signal:d,uuid:m=p,encoder:y=function({encode:e,decode:t}={}){return{encode:function(e,t){let r={api:t,seen:new Map,encode:e=>n(e,r,!0)};return n(e,r)},decode:function(e,t,n){let o={api:t,decode:e=>r(e,o,n,!0)};return r(e,o)}};function n(t,r,o=!1){let{seen:a,api:s,encode:u}=r;if(!o&&e)return e(t,u);if(null==t)return[t];let d=a.get(t);if(d)return d;if(a.set(t,[void 0]),"object"==typeof t){if(t[i]){let e=[t,[t]];return a.set(t,e),e}let e=[],o=t=>{let[o,a=[]]=n(t,r);return e.push(...a),o};if("function"==typeof t[l]){let n=t[l]({encode:o}),r=[n,e];return a.set(t,r),r}if(Array.isArray(t)){let n=t.map(e=>o(e)),r=[n,e];return a.set(t,r),r}if(t instanceof RegExp){let n={"_@r":[t.source,t.flags]},r=[n,e];return a.set(t,r),r}if(t instanceof URL){let n={"_@u":t.href},r=[n,e];return a.set(t,r),r}if(t instanceof Date){let n={"_@d":t.toISOString()},r=[n,e];return a.set(t,r),r}if(t instanceof Map){let n=[...t.entries()].map(([e,t])=>[o(e),o(t)]),r=[{"_@m":n},e];return a.set(t,r),r}if(t instanceof Set){let n=[...t].map(e=>o(e)),r=[{"_@s":n},e];return a.set(t,r),r}let s=null!=t&&(Symbol.asyncIterator in t||Symbol.iterator in t)&&"function"==typeof t.next;if(c(t)||s){let n={};for(let e of Object.keys(t))n[e]=o(t[e]);s&&(n.next??=o(t.next.bind(t)),n.return??=o(t.return.bind(t)),n.throw??=o(t.throw.bind(t)),n["_@i"]=!0);let r=[n,e];return a.set(t,r),r}}if("function"==typeof t){let e=s.functions?.add(t);if(null==e)return[e];let n=[{"_@f":e}];return a.set(t,n),n}let f=[t];return a.set(t,f),f}function r(e,n,o,a=!1){let{api:l,decode:i}=n;if(!a&&t)return t(e,i,o);if("object"==typeof e){if(null==e)return e;if(Array.isArray(e))return e.map(e=>r(e,n,o));if("_@r"in e)return new RegExp(...e["_@r"]);if("_@u"in e)return new URL(e["_@u"]);if("_@d"in e)return new Date(e["_@d"]);if("_@m"in e)return new Map(e["_@m"].map(([e,t])=>[r(e,n,o),r(t,n,o)]));if("_@s"in e)return new Set(e["_@s"].map(e=>r(e,n,o)));if("_@f"in e){let t=e["_@f"],n=l.functions?.get(t);if(o&&u(n))for(let e of o)e.add(n);return n}if(!c(e))return e;let t={};for(let a of Object.keys(e))"_@i"===a?t[Symbol.asyncIterator]=()=>t:t[a]=r(e[a],n,o);return t}return e}}()}={}){let h=!1,w=new Map,g=new Map,b=new Map,v=new Map;if(t)for(let e of Object.keys(t)){let n=t[e];"function"==typeof n&&w.set(e,n)}let E=new Map,x=function(e,t){let n;if(null==t){if("function"!=typeof Proxy)throw Error("You must pass an array of callable methods in environments without Proxies.");let t=new Map;n=new Proxy({},{get(n,r){if(t.has(r))return t.get(r);let o=e(r);return t.set(r,o),o}})}else for(let r of(n={},t))Object.defineProperty(n,r,{value:e(r),writable:!1,configurable:!0,enumerable:!0});return n}(function(e){return(...t)=>{try{if(h)throw new f;if("string"!=typeof e&&"number"!=typeof e)throw Error(`Can’t call a symbol method on a thread: ${e.toString()}`);if("hasCapability"===e){let e=t[0],n=m(),r=A(n);return j(7,[n,e]),r}let n=m(),r=A(n),[o,a]=y.encode(t,S);return j(0,[n,e,o],a),r}catch(e){return Promise.reject(e)}}},n),S={functions:{add(e){let t=g.get(e);return null==t&&(t=m(),g.set(e,t),b.set(t,e)),t},get(e){let t=v.get(e);if(t)return t;let n=0,l=!1;return Object.defineProperties(t=(...t)=>{if(l)throw Error("You attempted to call a function that was already released.");if(!v.has(e))throw Error("You attempted to call a function that was already revoked.");let[n,r]=y.encode(t,S),o=m(),a=A(o);return j(5,[o,e,n],r),a},{[o]:{value:()=>{0==(n-=1)&&(l=!0,v.delete(e),j(3,[e]))},writable:!1},[r]:{value:()=>{n+=1},writable:!1},[a]:{value:new Set,writable:!1}}),v.set(e,t),t}}},k=()=>{if(!h){for(let e of E.keys())_(e,new f);h=!0,w.clear(),E.clear(),g.clear(),b.clear(),v.clear()}};return d?.addEventListener("abort",()=>{j(2,[]),k()},{once:!0}),e.listen(C,{signal:d}),x;function j(t,n,r){h||e.send([t,n],r)}async function C(e){let t=Array.isArray(e)&&"number"==typeof e[0]&&(null==e[1]||Array.isArray(e[1]));if(t)switch(e[0]){case 2:k();break;case 0:{let t=new s,[n,r,o]=e[1],a=w.get(r);try{if(null==a)throw Error(`No '${r}' method is exposed on this endpoint`);let e=await a(...y.decode(o,S,[t])),[l,i]=y.encode(e,S);j(1,[n,void 0,l],i)}catch(o){let{name:e,message:t,stack:r}=o;j(1,[n,{name:e,message:t,stack:r}])}finally{t.release()}break}case 1:case 6:_(...e[1]);break;case 3:{let[t]=e[1],n=b.get(t);n&&(b.delete(t),g.delete(n));break}case 5:{let[t,n,r]=e[1],o=new s;try{let e=b.get(n);if(null==e)throw Error("You attempted to call a function that was already released.");let l=await e(...y.decode(r,S,u(e)?[...e[a],o]:[o])),[i,s]=y.encode(l,S);j(6,[t,void 0,i],s)}catch(o){let{name:e,message:n,stack:r}=o;j(6,[t,{name:e,message:n,stack:r}])}finally{o.release()}break}case 7:{let[t,n]=e[1],r=w.has(n);j(1,[t,void 0,y.encode(r,S)[0]])}}}function A(e){let t=new Promise((t,n)=>{E.set(e,(e,r,o)=>{if(null==r)t(y.decode(o,S));else{let e=Error();Object.assign(e,r),n(e)}})});return Object.defineProperty(t,Symbol.asyncIterator,{async *value(){let e=await t;Object.defineProperty(e,Symbol.asyncIterator,{value:()=>e}),yield*e}}),t}function _(...e){let t=e[0],n=E.get(t);n&&(n(...e),E.delete(t))}}class f extends Error{constructor(){super("You attempted to call a function on a terminated thread.")}}function p(){return`${m()}-${m()}-${m()}-${m()}`}function m(){return Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)}var y=n(18400);let h="quilt.threads.ping",w="quilt.threads.pong";function g(e,{targetOrigin:t="*",...n}={}){let r=!1,o=function(n,r){e.contentWindow?.postMessage(n,t,r)},a=new Promise(t=>{let a=n.signal?new y.z(n.signal):new AbortController;window.addEventListener("message",n=>{n.source===e.contentWindow&&n.data===w&&(r=!0,a.abort(),t())},{signal:a.signal}),a.signal.addEventListener("abort",()=>{t()},{once:!0}),o(h)});return d({send:(e,t)=>r?o(e,t):a.then(()=>{if(r)return o(e,t)}),listen(t,{signal:n}){self.addEventListener("message",n=>{n.source===e.contentWindow&&n.data!==w&&t(n.data)},{signal:n})}},n)}function b({targetOrigin:e="*",...t}={}){if("undefined"==typeof self||null==self.parent)throw Error("You are not inside an iframe, because there is no parent window.");let{parent:n}=self,r=t.signal?new y.z(t.signal):new AbortController,o=()=>{let r=()=>n.postMessage(w,e);self.addEventListener("message",({data:e})=>{e===h&&r()},{signal:t.signal}),r()};return"complete"===document.readyState?o():document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&(o(),r.abort())},{signal:r.signal}),d({send:(t,r)=>n.postMessage(t,e,r),listen(e,{signal:t}){self.addEventListener("message",t=>{t.data!==h&&e(t.data)},{signal:t})}},t)}}},function(e){e.O(0,[8415,3078,753,1386,55,3126,9643,4752,3449,2578,8511,4421,1454,7070,9610,4546,3299,9275,4405,5083,8756,1266,440,4755,7732,2763,1544,1565,3821,5871,6534,3375,5289,1744],function(){return e(e.s=78627)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/ee/tabby-webserver/ui/_next/static/chunks/app/files/page-a2faea2c6b1d22ba.js b/ee/tabby-webserver/ui/_next/static/chunks/app/files/page-a2faea2c6b1d22ba.js
new file mode 100644
index 000000000000..dad5b59a6fb4
--- /dev/null
+++ b/ee/tabby-webserver/ui/_next/static/chunks/app/files/page-a2faea2c6b1d22ba.js
@@ -0,0 +1 @@
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[357],{4755:function(e,t,r){Promise.resolve().then(r.bind(r,31919))},31919:function(e,t,r){"use strict";r.r(t),r.d(t,{SourceCodeBrowser:function(){return tl},SourceCodeBrowserContext:function(){return te}});var n=r(36164),l=r(3546),s=r(11978),a=r(57778),i=r(1853),o=r(94909),c=r(74630),d=r(26165),u=r(21454),f=r(43240),h=r(44645),m=r(80605),p=r(63484),x=r(3765),v=r(11634),g=r(70410),b=r(1544),j=r(53538),y=r(57830),N=r(30601),w=r(90379),k=r(38736),S=r(27064),C=r(50538),I=r(42891),E=r.n(I),R=r(23342),_=r(91655),O=r(2578),P=r(28312),F=r(31458),L=r(81565),D=r(29),M=r(48048);let T=e=>{let{blob:t,className:r,canCopy:s,hideBlobActions:a,contentLength:i,children:o,...c}=e,{chatSideBarVisible:d,setChatSideBarVisible:u,isChatEnabled:f}=l.useContext(te),{activePath:h}=l.useContext(te),{isCopied:m,copyToClipboard:p}=(0,P.m)({timeout:2e3}),x=f&&!d,v=i?(0,_.Z)(i):"",g=async()=>{if(!m&&t)try{let e=await t.text();p(e)}catch(e){O.A.error("Something went wrong. Please try again.")}};return(0,n.jsx)("div",{className:(0,b.cn)("rounded-t-lg border",r),...c,children:!a&&(0,n.jsxs)("div",{className:(0,b.cn)("flex items-center justify-between rounded-t-lg bg-secondary p-2 text-secondary-foreground"),children:[(0,n.jsxs)("div",{className:"flex h-8 items-center gap-4 leading-8",children:[o,(0,n.jsx)("span",{className:"ml-2 text-sm text-muted-foreground",children:v})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,n.jsxs)(D.u,{children:[(0,n.jsx)(D.aJ,{asChild:!0,children:(0,n.jsxs)(F.z,{variant:"ghost",size:"icon",onClick:g,children:[m?(0,n.jsx)(L.IconCheck,{className:"text-green-600"}):(0,n.jsx)(L.IconCopy,{}),(0,n.jsx)("span",{className:"sr-only",children:"Copy"})]})}),(0,n.jsx)(D._v,{children:"Copy raw file"})]}),!!t&&(0,n.jsxs)(D.u,{children:[(0,n.jsx)(D.aJ,{asChild:!0,children:(0,n.jsx)("a",{className:(0,F.d)({variant:"ghost",size:"icon"}),download:(0,M.i3)(null!=h?h:""),href:URL.createObjectURL(t),children:(0,n.jsx)(L.IconDownload,{})})}),(0,n.jsx)(D._v,{children:"Download raw file"})]}),x&&(0,n.jsxs)(D.u,{children:[(0,n.jsx)(D.aJ,{asChild:!0,children:(0,n.jsxs)(F.z,{variant:"ghost",className:"flex shrink-0 items-center gap-1 px-2",onClick:e=>u(!d),children:[(0,n.jsx)(E(),{alt:"Tabby logo",src:R.Z,width:24}),"Ask Tabby"]})}),(0,n.jsx)(D._v,{children:"Open chat panel"})]})]})]})})},A=e=>{let{className:t,blob:r,isImage:s}=e,{activePath:a}=(0,l.useContext)(te);return(0,n.jsx)("div",{className:(0,b.cn)(t),children:(0,n.jsx)("div",{className:"rounded-b-lg border border-t-0 p-2 text-center",children:s?(0,n.jsx)("img",{className:"mx-auto",src:r?URL.createObjectURL(r):void 0}):(0,n.jsx)("a",{className:"text-primary hover:underline",download:(0,M.i3)(null!=a?a:""),href:r?URL.createObjectURL(r):"",target:"_blank",children:"View raw"})})})},U=l.lazy(()=>Promise.all([r.e(9148),r.e(4015)]).then(r.bind(r,44015))),Z=l.lazy(()=>Promise.all([r.e(1266),r.e(5395),r.e(557)]).then(r.bind(r,30557))),z=e=>{var t;let{className:r}=e,{searchParams:s}=(0,h.Z)(),{activePath:a}=(0,l.useContext)(te),{textValue:i}=(0,l.useContext)(Y),o=a?(0,p.U$)(a)[0]:void 0,c=null!=o?o:"plain",d=(null===(t=s.get("plain"))||void 0===t?void 0:t.toString())==="1";return(0,n.jsx)("div",{className:(0,b.cn)(r),children:(0,n.jsx)("div",{className:"rounded-b-lg border border-t-0",children:(0,n.jsx)(l.Suspense,{fallback:(0,n.jsx)(w.cg,{className:"p-2"}),children:i&&"markdown"===c&&!d?(0,n.jsx)(Z,{value:i}):(0,n.jsx)(U,{value:null!=i?i:"",language:c})})})})},Y=l.createContext({}),q=e=>{var t;let{className:r,blob:s,contentLength:a,fileDisplayType:i,loading:o}=e,{searchParams:c,updateUrlComponents:d}=(0,h.Z)(),{activePath:u}=l.useContext(te),{textValue:f}=l.useContext(Y),m="raw"===i||"image"===i,x=u?(0,p.U$)(u)[0]:void 0,v=(null===(t=c.get("plain"))||void 0===t?void 0:t.toString())==="1";return(0,n.jsxs)("div",{className:(0,b.cn)(r),children:[(0,n.jsx)("div",{className:"sticky top-0 z-10 overflow-hidden bg-background",children:(0,n.jsx)(T,{blob:s,contentLength:a,canCopy:!m,children:!!f&&"markdown"===(null!=x?x:"plain")&&(0,n.jsx)(C.mQ,{value:v?"1":"0",onValueChange:e=>{"1"===e?d({searchParams:{set:{plain:"1"}}}):d({searchParams:{del:"plain"}})},children:(0,n.jsxs)(C.dr,{children:[(0,n.jsx)(C.SP,{value:"0",children:"Preview"}),(0,n.jsx)(C.SP,{value:"1",children:"Code"})]})})})}),o&&!s?(0,n.jsx)(w.cg,{className:"p-2"}):m?(0,n.jsx)(A,{blob:s,isImage:"image"===i}):(0,n.jsx)(z,{})]})},V=e=>{let{blob:t,fileDisplayType:r,contentLength:s}=e,[a,i]=l.useState();return l.useEffect(()=>{let e=async e=>{try{let t=await e.text();i(t)}catch(e){i("")}};t&&"text"===r&&e(t)},[t,r]),(0,n.jsx)(Y.Provider,{value:{textValue:a},children:(0,n.jsx)(q,{blob:t,fileDisplayType:r,contentLength:s})})};var G=r(826),$=r(14439),H=r(16784),W=r(98454),B=r(17451);let K=e=>{let{className:t,...r}=e,[{data:s}]=(0,W.P)(),{pendingEvent:a,setPendingEvent:i,repoMap:o,updateActivePath:c}=l.useContext(te),d=(0,B.a)(e=>e.activeChatId),u=l.useRef(null),f=(0,H.d)(o),h=async e=>{if((null==e?void 0:e.filepath)&&(null==e?void 0:e.git_url)){let r=(0,b.nO)(null==e?void 0:e.range),n=f.current,l=(0,G.Z)(Object.keys(n),t=>{var r;return(null==n?void 0:null===(r=n[t])||void 0===r?void 0:r.gitUrl)===e.git_url});if(l){let s=n[l];if(s){var t;let n=(0,M.s8)(s.refs),l=null===(t=(0,M.r2)(n))||void 0===t?void 0:t.name,a=e.filepath?(0,p.U$)(e.filepath)[0]:void 0;c((0,M.I)(s,l,e.filepath,e.kind),{hash:r,replace:!1,plain:"markdown"===a&&!!r});return}}}},m=(0,$.m)(u,{navigate:h,refresh:async()=>{window.location.reload(),await new Promise(e=>{setTimeout(()=>e(null),1e3)})},async onSubmitMessage(e,t){},onApplyInEditor(e){},onLoaded(){},onCopy(e){},onKeyboardEvent(){},openInEditor:async()=>!1}),x=e=>{let{action:t}=e,r="";switch(t){case"explain":r="Explain the selected code:";break;case"generate_unittest":r="Generate a unit test for the selected code:";break;case"generate_doc":r="Generate documentation for the selected code:"}return r};return(l.useEffect(()=>{(null==u?void 0:u.current)&&s&&(null==m||m.init({fetcherOptions:{authorization:s.me.authToken}}))},[null==u?void 0:u.current,m,s]),l.useEffect(()=>{if(a&&m){let{lineFrom:e,lineTo:t,code:r,path:n,gitUrl:l}=a;m.sendMessage({message:x(a),selectContext:{kind:"file",content:r,range:{start:e,end:null!=t?t:e},filepath:n,git_url:l}})}i(void 0)},[a,m]),null==s?void 0:s.me)?(0,n.jsxs)("div",{className:(0,b.cn)("flex h-full flex-col",t),...r,children:[(0,n.jsx)(J,{}),(0,n.jsx)("iframe",{src:"/chat",className:"w-full flex-1 border-0",ref:u},d)]}):(0,n.jsx)(n.Fragment,{})};function J(){let{setChatSideBarVisible:e}=l.useContext(te);return(0,n.jsx)("div",{className:"sticky top-0 flex items-center justify-end px-2 py-1",children:(0,n.jsx)(F.z,{size:"icon",variant:"ghost",onClick:t=>e(!1),children:(0,n.jsx)(L.IconClose,{})})})}var Q=r(24685),X=r(91299),ee=r(40055),et=r(24449),er=r(82394),en=r(11208);let el=e=>{var t;let{className:r}=e,a=(0,s.useRouter)(),i=(0,s.useSearchParams)(),{activeEntryInfo:o,activeRepo:c,activeRepoRef:d,updateActivePath:u}=l.useContext(te),[f,h]=l.useState(null===(t=i.get("q"))||void 0===t?void 0:t.toString()),[m]=(0,et.n)(f,300),p=l.useRef(null),x=null==c?void 0:c.kind,v=null==c?void 0:c.id,j=l.useMemo(()=>{if(m)return(0,X.Z)(m.replace(/-?(f|lang):\S+\s?/g,""))},[m]),[{data:y}]=(0,ee.aM)({query:g.D7,variables:{kind:x,id:v,pattern:null!=j?j:"",rev:null==d?void 0:d.name},pause:!v||!x||!j}),N=l.useMemo(()=>{var e,t;if(!j)return[];let r=null==y?void 0:null===(e=y.repositorySearch)||void 0===e?void 0:e.slice(0,5);return null!==(t=null==r?void 0:r.map(e=>({repositorySearch:e,value:e.path,label:e.path,type:"file"})))&&void 0!==t?t:[]},[null==y?void 0:y.repositorySearch,j]),w=l.useMemo(()=>{let e=[{label:"Include only results from file path matching the given search pattern.",value:"f",type:"tips"},{label:"Exclude results from file path matching the given search pattern.",value:"-f",type:"tips"},{label:"Include only results from the given language.",value:"lang",type:"tips"},{label:"Exclude results from the given language.",value:"-lang",type:"tips"}];if(!f)return[e[0],e[2]];let t=f.match(/(^|\s)-$/),r=f.match(/(^|\s)-?f$/),n=f.match(/(^|\s)-?l(a(n(g)?)?)?$/);return t?[e[1],e[3]]:r||n?r?e.slice(0,2):n?e.slice(2):[]:[]},[f]),{isOpen:k,getMenuProps:S,getInputProps:C,highlightedIndex:I,getItemProps:E,openMenu:R}=(0,Q.Kb)({items:N,onSelectedItemChange(e){let{selectedItem:t}=e;if((null==t?void 0:t.type)==="file"&&t.repositorySearch){let e=(0,M.I)(c,null==d?void 0:d.name,t.repositorySearch.path,t.repositorySearch.type);u(e);return}O(null==t?void 0:t.value)},stateReducer(e,t){let{type:r,changes:n}=t;switch(r){case Q.Kb.stateChangeTypes.InputClick:return{...n,highlightedIndex:void 0,isOpen:!0};case Q.Kb.stateChangeTypes.InputKeyDownArrowDown:{if(!(null==N?void 0:N.length)||!e.isOpen)return n;let t=e.highlightedIndex===N.length-1;return{...n,highlightedIndex:t?void 0:n.highlightedIndex}}case Q.Kb.stateChangeTypes.InputKeyDownArrowUp:{if(!(null==N?void 0:N.length)||!e.isOpen)return n;let t=0===e.highlightedIndex;return{...n,highlightedIndex:t?void 0:n.highlightedIndex}}default:return n}}}),_=e=>{k||R(),h(e)};l.useEffect(()=>{let e=e=>{var t,r;let n=e.target,l=null==n?void 0:null===(t=n.tagName)||void 0===t?void 0:t.toLowerCase();if("input"!==l&&"textarea"!==l&&"select"!==l&&"/"===e.key){e.preventDefault(),null===(r=p.current)||void 0===r||r.focus(),R();return}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[]);let O=e=>{if(!e)return;let t=(0,M.I)(c,null==o?void 0:o.rev,"","search");a.push("/files/".concat(t,"?q=").concat(encodeURIComponent(e)))},P=!(null==w?void 0:w.length)&&!(null==N?void 0:N.length);return(0,n.jsx)("div",{className:(0,b.cn)("flex w-full shrink-0 items-center bg-background px-4 py-3.5 transition duration-500 ease-in-out",r),children:(0,n.jsxs)("div",{className:(0,b.cn)("relative w-full"),children:[(0,n.jsxs)("div",{className:"h-9",children:[(0,n.jsx)("div",{className:(0,b.cn)({"absolute z-10 inset-0":k}),children:(0,n.jsx)(er.I,{className:"w-full",...C({onKeyDown:e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),O(f))},ref:p}),value:f,onChange:e=>_(e.target.value)})}),!f&&(0,n.jsxs)("div",{className:"absolute left-3 top-1.5 cursor-text select-none text-muted-foreground",onClick:e=>{var t;e.preventDefault(),null===(t=p.current)||void 0===t||t.focus(),R()},children:["Type"," ",(0,n.jsx)("kbd",{className:"rounded border border-muted-foreground px-0.5",children:"/"})," ","to search"]})]}),(0,n.jsxs)("div",{className:"absolute right-2 top-0 z-20 flex h-full items-center",children:[f?(0,n.jsx)(F.z,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer",onClick:()=>{var e;h(""),null===(e=p.current)||void 0===e||e.focus()},children:(0,n.jsx)(L.IconClose,{})}):null,(0,n.jsx)("div",{className:"z-20 ml-2 flex items-center border-l border-l-border pl-2",children:(0,n.jsx)(F.z,{variant:"ghost",className:"h-6 w-6 ",size:"icon",onClick:()=>O(f),children:(0,n.jsx)(L.IconSearch,{})})})]}),k&&(0,n.jsxs)("div",{className:(0,b.cn)("absolute -inset-x-3 -top-2.5 flex max-h-[60vh] flex-col overflow-hidden rounded-lg border bg-background p-4 shadow-2xl dark:border-2 dark:border-[#33363c] dark:bg-[hsl(0,0,13.5%)]",{"pb-0.5":P}),...S({suppressRefError:!0}),children:[(0,n.jsx)("div",{className:(0,b.cn)("shrink-0",P?"h-9":"h-12")}),(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[!!(null==w?void 0:w.length)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"text-md mb-2 pl-2 font-semibold",children:"Narrow your search"}),(0,n.jsx)("div",{className:"space-y-2",children:w.map(e=>(0,n.jsx)(ea,{data:e},e.value))})]}),!!(null==N?void 0:N.length)&&(0,n.jsxs)(n.Fragment,{children:[!!(null==w?void 0:w.length)&&(0,n.jsx)(en.Z,{className:"my-2"}),(0,n.jsx)("div",{className:"text-md mb-1 pl-2 font-semibold",children:"Code"}),N.map((e,t)=>{var r,l;let s=e.repositorySearch,a=I===t;return(0,n.jsxs)("div",{className:(0,b.cn)("relative flex cursor-default select-none items-center gap-1 rounded-sm px-2 py-1.5 text-sm",a&&"cursor-pointer bg-accent text-accent-foreground"),...E({item:e,index:t,onMouseLeave:e=>e.preventDefault(),onMouseOut:e=>e.preventDefault()}),children:[(0,n.jsx)("div",{className:"shrink-0",children:(null==e?void 0:null===(r=e.repositorySearch)||void 0===r?void 0:r.type)==="dir"?(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}}):(0,n.jsx)(L.IconFile,{})}),(0,n.jsx)("div",{className:"flex-1 break-all",children:(0,n.jsx)(es,{text:s.path,indices:s.indices})}),(0,n.jsx)("div",{className:"shrink-0 text-sm text-muted-foreground",children:"Jump to"})]},null===(l=e.repositorySearch)||void 0===l?void 0:l.path)})]})]})]})]})})};function es(e){let{text:t,indices:r}=e,s=l.useMemo(()=>new Set(r),[r]);return(0,n.jsx)("p",{className:"text-muted-foreground",children:t.split("").map((e,t)=>s.has(t)?(0,n.jsx)("span",{className:"font-semibold text-foreground",children:e},"".concat(e,"_").concat(t)):e)})}function ea(e){let{data:t}=e,{label:r,value:l}=t;return(0,n.jsxs)("div",{className:"flex items-center gap-1 px-2 text-sm",children:[(0,n.jsx)(L.IconFilter,{className:"shrink-0"}),(0,n.jsxs)("div",{className:"text-secondary-foreground",children:[(0,n.jsxs)("span",{className:"mr-0.5 rounded bg-secondary px-1 py-0.5 text-secondary-foreground",children:[l,":"]}),(0,n.jsx)("span",{children:r})]})]})}var ei=r(97651),eo=r.n(ei),ec=r(39018),ed=r.n(ec),eu=r(3448),ef=r(70652),eh=r.n(ef),em=r(88105),ep=r(58388),ex=r(28242),ev=r(33523),eg=r(85312);let eb=em.tk.theme({".cm-line":{cursor:"pointer"},".cm-line:hover":{opacity:"60%"}});r(55823);let ej=em.p.mark({class:"search-match-mark"}),ey=em.tk.theme({".search-match-mark":{backgroundColor:"hsl(var(--mark-bg))"}});function eN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=e.state.doc,n=r.length;if(!n)return em.p.none;let l=[];for(let e of t){let t=r.line(e.lineNumber),s=t.from,a={start:s+e.bytesStart,end:s+e.bytesEnd};try{a&&a.start<=n&&a.end<=n&&l.push(ej.range(a.start,a.end))}catch(e){}}return l.length?em.p.set(l):em.p.none}let ew=e=>{let t=em.lg.fromClass(class{update(t){(t.docChanged||t.viewportChanged)&&(this.marks=eN(t.view,e))}constructor(t){this.marks=eN(t,e)}},{decorations:e=>e.marks});return[t,ey]},ek=l.memo(e=>{let t,{path:r,pattern:l}=e;if(!l)return r;let s=RegExp((0,ep.Z)(l),"gi"),a=[];for(;null!==(t=s.exec(r));){let e=t.index,r=e+t[0].length;a.push({start:e,end:r})}return(0,n.jsx)(eC,{text:r,matches:a})});ek.displayName="FilePathView";let eS=e=>{let{result:t,query:r}=e,{theme:s}=(0,ex.F)(),{activeRepo:a,activeEntryInfo:i}=l.useContext(te),o=l.useMemo(()=>{var e;return null==r?void 0:null===(e=r.match(/f:(\S+)/))||void 0===e?void 0:e[1]},[r]),d=(0,p.U$)(t.path)[0],u=l.useMemo(()=>{var e;let r;let n=[],l=0,s=0,a=null!==(e=t.lines)&&void 0!==e?e:[];return a.forEach((e,t)=>{0===t?(l=t,s=t,r=e.lineNumber):((0,c.Z)(r)||e.lineNumber!==r+1?(r=e.lineNumber,n.push({start:l,end:s}),l=t):r=e.lineNumber,s=t)}),s!==(null==a?void 0:a.length)&&n.push({start:l,end:s}),n},[t.lines]),f="/files/".concat((0,M.I)(a,i.rev,t.path,"file"));return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"sticky top-9 z-10 border bg-secondary p-2 text-secondary-foreground",children:(0,n.jsx)(eh(),{href:{pathname:f},className:"inline-flex font-medium text-primary hover:underline",children:(0,n.jsx)(ek,{path:t.path,pattern:o})})}),(0,n.jsx)("div",{className:"divide-y-border mb-6 grid divide-y overflow-x-auto border border-t-0",children:u.map((e,r)=>{let l=t.lines.slice(e.start,e.end+1);return(0,n.jsx)(ev.Z,{height:20*l.length+9,offset:300,children:(0,n.jsx)(eI,{language:d,theme:s,lines:l,path:t.path})},"".concat(t.path,"-").concat(e.start))})})]})};function eC(e){let{text:t,matches:r}=e;if(!r||0===r.length)return(0,n.jsx)("span",{children:t});let l=[],s=0;return r.forEach((e,r)=>{e.start>s&&l.push((0,n.jsx)("span",{children:t.substring(s,e.start)},"text-".concat(r))),l.push((0,n.jsx)("span",{className:"bg-[hsl(var(--mark-bg))]",children:t.substring(e.start,e.end)},"match-".concat(r))),s=e.end}),s{var e;let t=null!==(e=null==i?void 0:i.reduce((e,t)=>e+(t.line.text||atob(t.line.base64||"")||""),""))&&void 0!==e?e:"";return t.replace(/\n$/,"")},[]),h=(null==i?void 0:null===(t=i[0])||void 0===t?void 0:t.lineNumber)||0,m=l.useMemo(()=>{if(null==i?void 0:i.length){var e;let t=[];for(let e=0;e{let t="/files/".concat((0,M.I)(d,u.rev,o,"file"));c.push("".concat(t,"?plain=1#L").concat(h+e-1))},[eb,em.tk.domEventHandlers({mousedown(t,r){let n=r.posAtCoords({x:t.clientX,y:t.clientY});if(null!=n){let l=r.state.doc.lineAt(n);e(l.number,t)}}})]),...ew(t)]}return[]},[i]);return(0,n.jsx)(eg.Z,{value:f,theme:r,language:a,readonly:!0,extensions:m})}let eE=e=>{var t,r,a;let i=(0,s.useSearchParams)(),o=null!==(r=null===(t=i.get("q"))||void 0===t?void 0:t.toString())&&void 0!==r?r:"",c=l.useMemo(()=>{var t;let r=e.results;return null!==(t=null==r?void 0:r.map(e=>({...e,blob:e.lines.reduce((e,t)=>{var r;return e+(null!==(r=t.line.text)&&void 0!==r?r:"")},"")})))&&void 0!==t?t:[]},[e.results]),d=l.useMemo(()=>{let t=0;if(!e.results)return"0";for(let r of e.results){let e=r.lines.reduce((e,t)=>{let r=t.subMatches.length;return e+r},0);t+=Math.max(e,1)}let r=t<1e3?"0":"0.0a";return ed()(t).format(r)},[e.results]),u=eo().humanizer({units:["d","h","m","s"],spacer:"",maxDecimalPoints:2,language:"shortEn",languages:{shortEn:{m:()=>"m",s:()=>"s"}}})(null!==(a=e.requestDuration)&&void 0!==a?a:0);return(0,n.jsx)(n.Fragment,{children:e.loading?(0,n.jsx)(eR,{className:"mt-3"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("h1",{className:"sticky top-0 z-20 bg-background pb-2 pt-1 font-semibold",children:[d," results in ",u]}),null==c?void 0:c.map((e,t)=>(0,n.jsx)("div",{children:(0,n.jsx)(eS,{result:e,query:o})},"".concat(e.path,"-").concat(t)))]})})};function eR(e){let{className:t}=e;return(0,n.jsxs)("div",{className:(0,b.cn)("flex flex-col gap-3",t),children:[(0,n.jsx)(eu.O,{className:"h-4 w-[20%]"}),(0,n.jsx)(eu.O,{className:"h-4 w-full"}),(0,n.jsx)(eu.O,{className:"h-8 w-full"})]})}let e_=e=>{let{className:t,error:r}=e,l=(0,n.jsx)(eP,{});switch(null==r?void 0:r.message){case M.l8.REPOSITORY_NOT_FOUND:l=(0,n.jsx)(eO,{});break;case M.l8.REPOSITORY_SYNC_FAILED:l=(0,n.jsx)(eF,{});break;case M.l8.INVALID_URL:l=(0,n.jsx)(eL,{});break;case M.l8.FAILED_TO_FETCH:l=(0,n.jsx)(eD,{})}return(0,n.jsx)("div",{className:(0,b.cn)("flex min-h-[30vh] items-center justify-center",t),children:(0,n.jsx)("div",{className:"flex flex-col items-center gap-4",children:l})})};function eO(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Repository not found"})]}),(0,n.jsxs)(eh(),{href:"/files",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Back to repositories"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}function eP(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Not found"})]}),(0,n.jsxs)(eh(),{href:"/files",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Back to repositories"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}function eF(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Repository is not cloned properly"})]}),(0,n.jsx)("div",{children:"The cloning of the repository has failed. Please verify your settings or attempt to retry the job."}),(0,n.jsxs)(eh(),{href:"/settings/providers/git",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Providers Configuration"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}function eL(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Invalid URL"})]}),(0,n.jsxs)(eh(),{href:"/files",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Back to repositories"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}function eD(){return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Failed to fetch"})]})})}var eM=r(48537);let eT=e=>{let{className:t}=e,{currentFileRoutes:r,activeRepo:s,activeEntryInfo:a}=l.useContext(te),i=null==a?void 0:a.basename,o=l.useMemo(()=>{var e;let t=null==a?void 0:a.basename,r=[{name:null!==(e=null==a?void 0:a.repositoryName)&&void 0!==e?e:"",href:(0,M.I)(s,a.rev,"","dir")}];if(t){let e=decodeURIComponent(t).split("/")||[];for(let t=0;t{let r=0===t&&(null==o?void 0:o.length)>1,s=t===o.length-1,a=(0,b.cn)("whitespace-nowrap",r||s?"font-bold":"font-medium",s?"":"cursor-pointer text-primary hover:underline",r?"hover:underline":void 0);return(0,n.jsxs)(l.Fragment,{children:[s?(0,n.jsx)("div",{className:a,children:e.name}):(0,n.jsx)(eh(),{className:a,href:"/files/".concat(e.href),children:e.name}),!s&&(0,n.jsx)("div",{children:"/"})]},e.href)})]}),!!(null==r?void 0:r.length)&&!!i&&(0,n.jsx)(eM.q,{className:"shrink-0",value:i})]})};var eA=r(76297),eU=r(36327);let eZ=l.createContext({}),ez=e=>{let{onSelectTreeNode:t,children:r,activePath:l,fileMap:s,updateFileMap:a,expandedKeys:i,toggleExpandedKey:o,initialized:c,fileTreeData:d,fetchingTreeEntries:u}=e;return(0,n.jsx)(eZ.Provider,{value:{onSelectTreeNode:t,fileTreeData:d,expandedKeys:i,toggleExpandedKey:o,activePath:l,fileMap:s,updateFileMap:a,initialized:c,fetchingTreeEntries:u},children:r})},eY=e=>{let{level:t}=e,r=l.useMemo(()=>Array(t).fill(1),[t]);return(0,n.jsx)("div",{className:"flex h-full shrink-0 items-stretch",children:r.map((e,t)=>(0,n.jsx)("div",{className:"flex h-8 w-2 border-r border-transparent transition-colors duration-300 group-hover/filetree:border-border"},t))})},eq=()=>{let{ref:e,entry:t,inView:r}=(0,eA.YD)({trackVisibility:!0,delay:500});return l.useEffect(()=>{if((null==t?void 0:t.target)&&!r){var e;null==t||null===(e=t.target)||void 0===e||e.scrollIntoView({block:"center"})}},[null==t?void 0:t.target]),(0,n.jsx)("div",{ref:e,className:"absolute -left-2 h-8 w-1 rounded-md bg-primary"})},eV=e=>{let{isActive:t,level:r,children:l,className:s,...a}=e;return(0,n.jsxs)("div",{className:(0,b.cn)("relative flex h-8 cursor-pointer items-stretch rounded-sm hover:bg-accent focus:bg-accent focus:text-accent-foreground",t&&"bg-accent",s),...a,children:[t&&(0,n.jsx)(eq,{}),(0,n.jsx)(eY,{level:r}),(0,n.jsxs)("div",{className:"flex flex-nowrap items-center gap-2 truncate whitespace-nowrap",children:[(0,n.jsx)("div",{className:"h-4 w-4 shrink-0"}),l]})]})},eG=e=>{let{children:t,level:r,isActive:l,className:s,...a}=e;return(0,n.jsxs)("div",{className:(0,b.cn)("relative flex cursor-pointer items-stretch rounded-sm hover:bg-accent focus:bg-accent focus:text-accent-foreground",l?"bg-accent text-accent-foreground":void 0,s),...a,children:[l&&(0,n.jsx)(eq,{}),(0,n.jsx)(eY,{level:r}),(0,n.jsx)("div",{className:"flex flex-nowrap items-center gap-2 truncate whitespace-nowrap",children:t})]})},e$=e=>{let{node:t,level:r}=e,{activeEntryInfo:s}=l.useContext(te),{onSelectTreeNode:a}=l.useContext(eZ),i="file"===t.file.kind,o=t.fullPath===(null==s?void 0:s.basename);return(0,n.jsxs)(eV,{level:r,onClick:e=>{i&&(null==a||a(t))},isActive:o,children:[(0,n.jsx)(L.IconFile,{className:"shrink-0"}),(0,n.jsx)("div",{className:"truncate",children:null==t?void 0:t.name})]})},eH=e=>{var t,r,s;let{node:a,level:i,root:o}=e,{activeRepo:c,activeEntryInfo:d}=l.useContext(te),{fileMap:u,updateFileMap:f,expandedKeys:h,toggleExpandedKey:m,onSelectTreeNode:p}=l.useContext(eZ),v=l.useRef(!1),g=o?"":a.file.basename,b=h.has(g),j="dir"===a.file.kind&&!(null==u?void 0:null===(t=u[a.fullPath])||void 0===t?void 0:t.treeExpanded)&&b,{data:y,isLoading:N}=(0,eU.Z)(j?(0,M.Vq)(c,d.rev,g):null,x.Z,{revalidateIfStale:!1});l.useEffect(()=>{var e;if(!v.current&&(null==y?void 0:null===(e=y.entries)||void 0===e?void 0:e.length)){let e=y.entries.reduce((e,t)=>{let r=t.basename;return{...e,[r]:{file:t,name:(0,M.i3)(r),fullPath:r,treeExpanded:!1}}},{});f(e),v.current=!0}},[y]);let[w]=(0,et.n)(N,100),k=!!(null==a?void 0:null===(r=a.children)||void 0===r?void 0:r.length);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(eG,{level:i,onClick:e=>{null==p||p(a)},isActive:(null==d?void 0:d.basename)===a.fullPath,children:[(0,n.jsx)("div",{className:"flex h-8 shrink-0 items-center hover:bg-primary/10 hover:text-popover-foreground",onClick:e=>{w||(m(a.fullPath),e.stopPropagation())},children:w&&!v.current?(0,n.jsx)(L.IconSpinner,{}):b?(0,n.jsx)(L.IconChevronDown,{}):(0,n.jsx)(L.IconChevronRight,{})}),(0,n.jsx)("div",{className:"shrink-0",style:{color:"rgb(84, 174, 255)"},children:b?(0,n.jsx)(L.IconDirectoryExpandSolid,{}):(0,n.jsx)(L.IconDirectorySolid,{})}),(0,n.jsx)("div",{className:"truncate",children:null==a?void 0:a.name})]}),(0,n.jsx)(n.Fragment,{children:b&&k?(0,n.jsx)(n.Fragment,{children:null===(s=a.children)||void 0===s?void 0:s.map(e=>{let t=e.file.basename;return"dir"===e.file.kind?(0,n.jsx)(eH,{node:e,level:i+1},t):(0,n.jsx)(e$,{node:e,level:i+1},t)})}):null})]})},eW=()=>{let{repoMap:e,activeEntryInfo:t}=l.useContext(te),{initialized:r,fileTreeData:s,fetchingTreeEntries:a}=l.useContext(eZ),{repositorySpecifier:i}=t,o=!!i,c=o&&!(null==s?void 0:s.length);return r?o?c&&a?(0,n.jsx)(eK,{}):(0,n.jsx)(n.Fragment,{children:null==s?void 0:s.map(e=>{var t;let r=(null==e?void 0:null===(t=e.file)||void 0===t?void 0:t.kind)==="file";return r?(0,n.jsx)(e$,{level:0,node:e},e.fullPath):(0,n.jsx)(eH,{level:0,node:e},e.fullPath)})}):null:(0,n.jsx)(eK,{})},eB=e=>{let{className:t,...r}=e;return(0,n.jsx)("div",{className:(0,b.cn)("group/filetree",t),children:(0,n.jsx)(ez,{...r,children:(0,n.jsx)(eW,{})})})};function eK(){return(0,n.jsxs)("div",{className:"space-y-3 p-2",children:[(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{className:"ml-4"}),(0,n.jsx)(eu.O,{className:"ml-4"}),(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{className:"ml-4"})]})}var eJ=r(62940),eQ=r(36065),eX=r(84942),e0=r(54594),e1=r(18500);function e4(e){let{kind:t,fallback:r}=e;switch(t){case e1.vW.Git:case e1.vW.GitConfig:return(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}});case e1.vW.Github:case e1.vW.GithubSelfHosted:return(0,n.jsx)(L.IconGitHub,{});case e1.vW.Gitlab:case e1.vW.GitlabSelfHosted:return(0,n.jsx)(L.IconGitLab,{});default:return null!=r?r:null}}let e5=e=>{var t,r,s,a,i;let{className:o,...d}=e,{updateActivePath:u,initialized:f,activeRepo:h,activeRepoRef:m,fileMap:p,repoMap:x,activeEntryInfo:v}=(0,l.useContext)(te),g=l.useMemo(()=>(0,M.UR)(x).map(e=>{let t=(0,M.Pj)(e);return{repo:e,repoSpecifier:t}}),[x]),[j,y]=l.useState(!1),[N,w]=l.useState(null!==(s=null==m?void 0:m.kind)&&void 0!==s?s:"branch"),{repositoryKind:k,repositoryName:S,repositorySpecifier:I}=v,E=null==h?void 0:h.refs,R=l.useMemo(()=>(null==E?void 0:E.length)?E.map(e=>(0,M.r2)(e)):[],[E]),_=R.filter(e=>"branch"===e.kind),O=R.filter(e=>"tag"===e.kind),P=f&&!(null==g?void 0:g.length),D=e=>{var t,r,n,l,s;if((0,c.Z)(e))return;let a=null!==(l=null===(t=(0,M.r2)(e))||void 0===t?void 0:t.name)&&void 0!==l?l:"",{basename:i=""}=v,o=null!==(s=null==p?void 0:null===(n=p[i])||void 0===n?void 0:null===(r=n.file)||void 0===r?void 0:r.kind)&&void 0!==s?s:"dir";u((0,M.I)(h,a,i,o))};return(0,n.jsxs)("div",{className:(0,b.cn)(o),...d,children:[(0,n.jsx)("div",{className:"py-4 font-bold leading-8",children:(0,n.jsx)("span",{className:(0,b.cn)("py-1",{"hover:underline cursor-pointer":!!h}),onClick:()=>{h&&u((0,M.I)(h,null==v?void 0:v.rev,"","dir"))},children:"Files"})}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)(e0.Ph,{disabled:!f,onValueChange:e=>{var t;let r=null===(t=g.find(t=>t.repoSpecifier===e))||void 0===t?void 0:t.repo;if(r){let t="".concat(e,"/-/tree/").concat((0,M.r2)((0,M.s8)(r.refs)).name);u(t)}},value:I,children:[(0,n.jsx)(e0.i4,{children:(0,n.jsx)(e0.ki,{asChild:!0,children:(0,n.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,n.jsx)("div",{className:"shrink-0",children:(0,n.jsx)(e4,{kind:k,fallback:(0,n.jsx)(L.IconFolderGit,{})})}),(0,n.jsx)("span",{className:(0,b.cn)("truncate",!S&&"text-muted-foreground"),children:S||"Pick a repository"})]})})}),(0,n.jsx)(e0.Bw,{className:"max-h-[50vh] overflow-y-auto",children:P?(0,n.jsx)(e0.Ql,{isPlaceHolder:!0,value:"",disabled:!0,children:"No repositories"}):(0,n.jsx)(n.Fragment,{children:null==g?void 0:g.map(e=>(0,n.jsx)(e0.Ql,{value:e.repoSpecifier,children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(e4,{kind:e.repo.kind,fallback:(0,n.jsx)(L.IconFolderGit,{})}),e.repo.name]})},e.repoSpecifier))})})]}),!!h&&(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(eX.J2,{open:j,onOpenChange:y,children:[(0,n.jsx)(eX.xo,{asChild:!0,children:(0,n.jsx)(F.z,{className:"w-full justify-start gap-2 px-3",variant:"outline",children:!!m&&(0,n.jsxs)(n.Fragment,{children:["tag"===m.kind?(0,n.jsx)(L.IconTag,{className:"shrink-0"}):(0,n.jsx)(L.IconGitFork,{className:"shrink-0"}),(0,n.jsx)("span",{className:"truncate",title:m.name,children:"commit"===m.kind?null===(r=m.ref)||void 0===r?void 0:null===(t=r.commit)||void 0===t?void 0:t.substring(0,7):m.name})]})})}),(0,n.jsx)(eX.yk,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",side:"bottom",sideOffset:-8,children:(0,n.jsxs)(eQ.mY,{children:[(0,n.jsx)(eQ.sZ,{placeholder:"tag"===N?"Find a tag":"Find a branch"}),(0,n.jsx)(C.mQ,{className:"my-1 border-b",value:N,onValueChange:e=>w(e),children:(0,n.jsxs)(C.dr,{className:"bg-popover py-0",children:[(0,n.jsx)(C.SP,{value:"branch",children:"Branches"}),(0,n.jsx)(C.SP,{value:"tag",children:"Tags"})]})}),(0,n.jsxs)(eQ.e8,{className:"max-h-[30vh]",children:[(0,n.jsx)(eQ.rb,{children:"Nothing to show"}),(0,n.jsx)(eQ.fu,{children:("tag"===N?O:_).map((e,t)=>{var r;return(0,n.jsxs)(eQ.di,{onSelect:()=>{y(!1),D(e.ref)},children:[(0,n.jsx)(L.IconCheck,{className:(0,b.cn)("mr-2 shrink-0",(null==e?void 0:e.name)&&e.name===(null==m?void 0:m.name)?"opacity-100":"opacity-0")}),(0,n.jsx)("span",{className:"truncate",title:e.name,children:null!==(a=e.name)&&void 0!==a?a:""})]},null!==(i=null==e?void 0:null===(r=e.ref)||void 0===r?void 0:r.name)&&void 0!==i?i:t)})})]})]})})]})})]})]})},e2=e=>{let{fetchingTreeEntries:t}=e,{activePath:r,updateActivePath:s,expandedKeys:a,updateFileMap:i,toggleExpandedKey:o,initialized:c,fileTreeData:d,fileMap:u,activeRepo:f,activeEntryInfo:h}=l.useContext(te),m=l.useRef(null),p=function(e,t){var r,n;let[s,a]=(0,l.useState)(null!==(n=null===(r=e.current)||void 0===r?void 0:r.scrollTop)&&void 0!==n?n:0);return(0,l.useEffect)(()=>{if(e.current){let r=(0,eJ.Z)(()=>{var t,r;a(null!==(r=null===(t=e.current)||void 0===t?void 0:t.scrollTop)&&void 0!==r?r:0)},t,{leading:!0}),n=e.current;return n.addEventListener("scroll",r),()=>{n.removeEventListener("scroll",r)}}},[e,t]),s}(m,200);return(0,n.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,n.jsx)(e5,{className:"shrink-0 px-4 pb-3"}),p>0&&(0,n.jsx)("div",{className:"h-0 border-b shadow-[0px_3px_8px_rgba(0,0,0,0.3)] dark:shadow-[0px_3px_8px_rgba(255,255,255,0.3)]"}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto px-4",ref:m,children:(0,n.jsx)(eB,{onSelectTreeNode:e=>{let t=(0,M.I)(f,h.rev,e.file.basename,e.file.kind);s(t)},activePath:r,fileMap:u,updateFileMap:i,expandedKeys:a,toggleExpandedKey:o,initialized:c,fileTreeData:d,fetchingTreeEntries:t})})]})};var e3=r(2899),e8=r(99047);let e6=e=>{var t,r;let{className:s,loading:a,initialized:i}=e,{activePath:c,currentFileRoutes:d,fileTreeData:u,activeRepo:f,repoMap:h,activeEntryInfo:m}=l.useContext(te),p=l.useMemo(()=>(0,o.Z)(h)||f?function(e,t){if(!(null==e?void 0:e.length))return[];if(t){let{basename:r=""}=(0,M.Jt)(t);if(!r)return e;let n=decodeURIComponent(r).split("/"),l=e;for(let e=0;ee.fullPath===t);if(null==r||!r.children)return[];l=null==r?void 0:r.children}return(null==l?void 0:l.map(e=>(0,e3.Z)(e,"children")))||[]}{let t=e.map(e=>(0,e3.Z)(e,"children"))||[];return t}}(u,c):(0,M.UR)(h).map(e=>{var t;return{file:{basename:e.name,kind:"dir"},isRepository:!0,repository:e,fullPath:(0,M.I)(e,null===(t=(0,M.r2)((0,M.s8)(e.refs)))||void 0===t?void 0:t.name,"","dir"),name:e.name}}),[u,c,f,h]),[x]=(0,et.n)(a,300),v=!!(null==m?void 0:m.basename),g=d[(null==d?void 0:d.length)-2];return(0,n.jsx)("div",{className:(0,b.cn)("text-base",s),children:(!x||(null==p?void 0:p.length))&&i?(null==p?void 0:p.length)?(0,n.jsx)(e8.iA,{children:(0,n.jsxs)(e8.RM,{children:[v&&(0,n.jsx)(e8.SC,{className:"cursor-pointer",children:(0,n.jsx)(e8.pj,{className:"p-1 px-4",children:(0,n.jsx)(eh(),{href:"/files/".concat((0,M.I)(f,m.rev,null==g?void 0:null===(t=g.file)||void 0===t?void 0:t.basename,null==g?void 0:null===(r=g.file)||void 0===r?void 0:r.kind)),children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"shrink-0",children:(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}})}),(0,n.jsx)("span",{className:"px-1 py-2",children:".."})]})})})}),(0,n.jsx)(n.Fragment,{children:p.map(e=>{var t;let r=e.isRepository,l=null===(t=e.repository)||void 0===t?void 0:t.kind;return(0,n.jsx)(e8.SC,{children:(0,n.jsx)(e8.pj,{className:"p-1 px-4 text-base",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"shrink-0",children:r?(0,n.jsx)(e4,{kind:l,fallback:(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}})}):"dir"===e.file.kind?(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}}):(0,n.jsx)(L.IconFile,{})}),(0,n.jsx)(eh(),{href:r?"/files/".concat(e.fullPath):"/files/".concat((0,M.I)(null!=f?f:e.repository,m.rev,e.file.basename,e.file.kind)),className:"cursor-pointer px-1 py-2 hover:text-primary hover:underline",children:e.name})]})})},e.fullPath)})})]})}):(0,o.Z)(h)?(0,n.jsx)("div",{className:"flex min-h-[30vh] items-center justify-center",children:(0,n.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"No repositories"})]}),(0,n.jsxs)(eh(),{href:"/settings/providers/git",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Connect"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}):null:(0,n.jsx)(e9,{})})};function e9(){return(0,n.jsxs)("ul",{className:"space-y-3 p-2",children:[(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{})]})}let e7=(0,f.BX)("\n query RepositoryGrep(\n $id: ID!\n $kind: RepositoryKind!\n $rev: String\n $query: String!\n ) {\n repositoryGrep(kind: $kind, id: $id, rev: $rev, query: $query) {\n files {\n path\n lines {\n line {\n text\n base64\n }\n byteOffset\n lineNumber\n subMatches {\n bytesStart\n bytesEnd\n }\n }\n }\n elapsedMs\n }\n }\n"),te=l.createContext({}),tt=e=>{var t;let{children:r}=e,a=(0,s.usePathname)(),{updateUrlComponents:o,searchParams:c}=(0,h.Z)(),d=null===(t=c.get("redirect_git_url"))||void 0===t?void 0:t.toString(),[u,f]=l.useState(!1),[p,x]=l.useState(),v=l.useMemo(()=>(0,M.Jt)(p),[p]),g=(0,m.xG)(),[b,j]=l.useState(!1),[y,N]=l.useState({}),[w,k]=l.useState({}),[S,C]=l.useState(new Set),[I,E]=l.useState(!1),[R,_]=l.useState(),[O,P]=(0,l.useState)(),F=l.useRef(),L=l.useCallback(async(e,t)=>{let r=null==t?void 0:t.replace;if(e){let n={},l=["redirect_filepath","redirect_git_url","line"];(null==t?void 0:t.plain)?n.plain="1":l.push("plain"),o({pathname:"/files/".concat(e),searchParams:{set:n,del:l},replace:r,hash:null==t?void 0:t.hash})}else o({pathname:"/files",searchParams:{del:["path","plain","line"]},hash:null==t?void 0:t.hash,replace:r})},[]),D=l.useMemo(()=>(function e(t){if(!t.length)return[];for(let r of(t.sort((e,t)=>{let r="file"===e.file.kind?1:0,n="file"===t.file.kind?1:0;return r-n||e.name.localeCompare(t.name)}),t))(null==r?void 0:r.children)&&e(r.children);return t})(function(e){let t=[];if(!e)return t;let r=Object.keys(e);for(let n of r){let r=e[n],l=n.split("/"),s=t;for(let e=0;ee.fullPath===t);if(a)s=a.children||[];else{let e={file:r.file,name:r.name,fullPath:n,children:[],isRepository:r.isRepository,repository:r.repository};s.push(e),s=e.children}}}return t}(y)),[y]),T=l.useMemo(()=>{let{repositoryKind:e,repositoryName:t,repositorySpecifier:r}=v;if(e&&t)return r?w[r]:void 0},[w,v]),A=l.useMemo(()=>{var e,t;if(!v||!T)return;let r=null!==(t=null==v?void 0:v.rev)&&void 0!==t?t:"",n=null===(e=T.refs)||void 0===e?void 0:e.find(e=>(null==e?void 0:e.name)==="refs/heads/".concat(r)||(null==e?void 0:e.name)==="refs/tags/".concat(r)||(null==e?void 0:e.commit)===r);if(n){let e;return n.name==="refs/heads/".concat(r)?e="branch":n.name==="refs/tags/".concat(r)?e="tag":n.commit===r&&(e="commit"),(0,M.r2)(n,e)}},[v,T]),U=l.useMemo(()=>{var e;if(!p)return[];let{basename:t=""}=v,r=[{file:{kind:"dir",basename:""},isRepository:!0,repository:T,name:null!==(e=null==T?void 0:T.name)&&void 0!==e?e:"",fullPath:""}],n=(null==t?void 0:t.split("/"))||[];for(let e=0;e{var e;let t=null===(e=a.match(/^\/files\/(.*)/))||void 0===e?void 0:e[1];F.current=p,x(null!=t?t:""),u||f(!0),O&&P(void 0)},[a,d]),(0,n.jsx)(te.Provider,{value:{initialized:b,setInitialized:j,activePath:p,updateActivePath:L,fileMap:y,updateFileMap:(e,t)=>{e&&(t?N(e):N(t=>({...t,...e})))},expandedKeys:S,setExpandedKeys:C,toggleExpandedKey:e=>{let t=S.has(e),r=new Set(S);t?r.delete(e):r.add(e),C(r)},currentFileRoutes:U,fileTreeData:D,chatSideBarVisible:I,setChatSideBarVisible:E,pendingEvent:R,setPendingEvent:_,isChatEnabled:g,repoMap:w,setRepoMap:k,activeRepo:T,activeRepoRef:A,isPathInitialized:u,activeEntryInfo:v,prevActivePath:F,error:O,setError:P},children:r})},tr="application/vnd.directory+json",tn=e=>{var t;let{className:r}=e,{activePath:s,updateActivePath:a,initialized:i,setInitialized:f,chatSideBarVisible:m,setChatSideBarVisible:v,setPendingEvent:g,repoMap:N,setRepoMap:C,activeRepo:I,isPathInitialized:E,activeEntryInfo:R,prevActivePath:_,updateFileMap:O,setExpandedKeys:P,error:F,setError:L}=l.useContext(te),{searchParams:D}=(0,h.Z)(),T=l.useRef(!1),{progress:A,setProgress:U}=(0,k.U)(),Z=l.useRef(null),[z,Y]=l.useState(35),q=null===(t=D.get("q"))||void 0===t?void 0:t.toString(),G=l.useMemo(()=>(0,M.Jt)(s),[s]),$=null==G?void 0:G.basename,H=(null==R?void 0:R.viewMode)==="blob",W=(null==R?void 0:R.viewMode)==="search",B=!!i&&!(0,o.Z)(N)&&!!s&&!W,J=!!i&&!(0,o.Z)(N)&&!!s&&W,Q=!!i&&H&&I,{data:X,isLoading:ee,error:et}=(0,u.ZP)(B?s:null,e=>{let{repositorySpecifier:t}=(0,M.Jt)(e);return ti(e,t?null==N?void 0:N[t]:void 0).then(t=>({entries:t,requestPathname:e}))},{revalidateOnFocus:!1,shouldRetryOnError:!1}),{data:er,isLoading:en,error:es}=(0,u.ZP)(Q?[(0,M.Vq)(I,R.rev,$),$]:null,e=>{let[t,r]=e;return(0,x.Z)(t,{responseFormatter:async e=>{let t=e.headers.get("Content-Type");if(t===tr)throw Error(M.l8.INVALID_URL);let n=(0,d.Z)(e.headers.get("Content-Length")),l=await e.blob(),s=await ta(null!=r?r:"",l);return{contentLength:n,blob:l,fileDisplayType:s}},errorHandler(){throw Error(M.l8.NOT_FOUND)}})},{revalidateOnFocus:!1,shouldRetryOnError:!1}),{data:ea,isLoading:ei,error:eo}=(0,u.ZP)(J&&q?[s,q]:null,e=>{let[t,r]=e,{repositorySpecifier:n}=(0,M.Jt)(t);return to(r,n?null==N?void 0:N[n]:void 0,R.rev)},{revalidateOnFocus:!1,shouldRetryOnError:!1}),ec=null==er?void 0:er.blob,ed=null==er?void 0:er.contentLength,eu=null==er?void 0:er.fileDisplayType,ef=F||es||et,eh=(null==R?void 0:R.viewMode)==="tree"||!(null==R?void 0:R.viewMode);return l.useEffect(()=>{let e=async()=>{if(T.current)return;T.current=!0;let e=await ts(),t=D.get("redirect_filepath"),r=D.get("redirect_git_url");if((null==e?void 0:e.length)&&t&&r){let i=e.find(e=>e.gitUrl===r);if(i){var n,l,s;let e=(0,M.s8)(i.refs),r=(null===(n=(0,M.r2)(e))||void 0===n?void 0:n.name)||"",o=(0,M.kQ)(window.location.hash),d=!(0,c.Z)(null==o?void 0:o.start),u=parseInt(null!==(s=null===(l=D.get("line"))||void 0===l?void 0:l.toString())&&void 0!==s?s:""),f=d?window.location.hash:(0,b.nO)({start:u}),h=t?(0,p.U$)(t)[0]:void 0;a((0,M.I)(i,r,t,"file"),{replace:!0,hash:f,plain:"markdown"===h&&!!f}),T.current=!1;return}L(Error(M.l8.REPOSITORY_NOT_FOUND))}e&&C((0,M.fr)(e)),f(!0)};!i&&E&&e()},[s,i,E]),l.useEffect(()=>{if(!X)return;let{entries:e,requestPathname:t}=X,{repositorySpecifier:r,viewMode:n,basename:l,rev:s}=(0,M.Jt)(t),{repositorySpecifier:a,rev:i}=(0,M.Jt)(_.current),o=(0,M.yH)(l,"tree"===n),c={};if(e.length)for(let t of e){let e=t.basename;c[e]={file:t,name:(0,M.i3)(e),fullPath:e,treeExpanded:o.includes(t.basename)}}let d=o.filter(Boolean),u=r!==a||s!==i;c&&O(c,u),(null==d?void 0:d.length)&&(u?P(new Set(d)):P(e=>{let t=new Set(e);for(let e of d)t.add(e);return t}))},[X]),l.useEffect(()=>{!i||(!A&&(en||ee)?U(!0):en||ee||U(!1))},[en,ee]),l.useEffect(()=>{var e,t,r;m?(null===(e=Z.current)||void 0===e||e.expand(),null===(t=Z.current)||void 0===t||t.resize(z)):null===(r=Z.current)||void 0===r||r.collapse()},[m]),l.useEffect(()=>{if(!(en||ee))return;let{repositorySpecifier:e,rev:t}=R,{repositorySpecifier:r,rev:n}=(0,M.Jt)(_.current);(e!==r||t!==n)&&(O({},!0),P(new Set))},[R]),l.useEffect(()=>{let e=e=>{v(!0),g(e)};return S.u.on("code_browser_quick_action",e),()=>{S.u.off("code_browser_quick_action",e)}},[]),(0,n.jsxs)(j.pO,{direction:"horizontal",className:(0,b.cn)(r),onLayout:e=>{(null==e?void 0:e[2])&&Y(e[2])},children:[(0,n.jsx)(j.ee,{defaultSize:20,minSize:20,maxSize:40,className:"hidden lg:block",children:(0,n.jsx)(e2,{fetchingTreeEntries:ee})}),(0,n.jsx)(j.Dp,{className:"hidden w-1 bg-border/40 hover:bg-border active:bg-blue-500 lg:block"}),(0,n.jsx)(j.ee,{defaultSize:80,minSize:30,children:(0,n.jsxs)("div",{className:"mb-4 flex h-full flex-col",children:[(0,n.jsx)(el,{className:(0,b.cn)("z-40",(null==R?void 0:R.repositorySpecifier)?"block":"hidden")}),(eh||H)&&(0,n.jsx)(eT,{className:(0,b.cn)("px-4 pb-4",{"pt-4":!(null==R?void 0:R.repositorySpecifier)})}),(0,n.jsx)(y.ScrollArea,{children:(0,n.jsx)("div",{className:"flex h-full flex-col px-4 pb-4",children:i?ef?(0,n.jsx)(e_,{className:"rounded-lg border p-4",error:ef}):(0,n.jsxs)(n.Fragment,{children:[eh&&(0,n.jsx)(e6,{loading:ee,initialized:i,className:"rounded-lg border"}),H&&(0,n.jsx)(V,{blob:ec,contentLength:ed,fileDisplayType:eu,loading:en||ee}),W&&(0,n.jsx)(eE,{results:null==ea?void 0:ea.files,requestDuration:null==ea?void 0:ea.elapsedMs,loading:ei})]}):(0,n.jsx)(w.cg,{className:"rounded-lg border p-4"})})})]})}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(j.Dp,{className:(0,b.cn)("hidden w-1 bg-border/40 hover:bg-border active:bg-blue-500",m&&"block")}),(0,n.jsx)(j.ee,{collapsible:!0,collapsedSize:0,defaultSize:0,minSize:25,ref:Z,onCollapse:()=>v(!1),children:(0,n.jsx)(K,{})})]})]})},tl=e=>{let[t]=(0,N.Hb)(),r=t?{height:"calc(100vh - ".concat(N.wt,")")}:{height:"100vh"};return(0,n.jsx)(tt,{children:(0,n.jsx)("div",{className:"transition-all",style:r,children:(0,n.jsx)(tn,{className:"source-code-browser",...e})})})};async function ts(){let e=v.Lp.createRequestOperation("query",(0,a.h)(g.zz,{}));return v.Lp.executeQuery(e).then(e=>{var t;return(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.repositoryList)||[]})}async function ta(e,t){var r;if(!t)return;let n=null==t?void 0:t.type,l=null===(r=(0,p.U$)(e))||void 0===r?void 0:r[0];if(null==n?void 0:n.startsWith("image"))return"image";if(l||(null==n?void 0:n.startsWith("text")))return"text";let s=await new Promise((e,r)=>{let n=t.slice(0,1024),l=new FileReader;l.onloadend=function(t){var r;if((null==t?void 0:null===(r=t.target)||void 0===r?void 0:r.readyState)===FileReader.DONE){let r=t.target.result;"string"!=typeof r?e(!1):/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/.test(r)?e(!1):e(!0)}},l.onerror=function(){e(!1)},l.readAsText(n,"UTF-8")});return s?"text":"raw"}async function ti(e,t){if(!e)return[];if(!t)throw Error(M.l8.REPOSITORY_NOT_FOUND);if((0,o.Z)(t.refs))throw Error(M.l8.REPOSITORY_SYNC_FAILED);let{basename:r,rev:n,viewMode:l}=(0,M.Jt)(e);if(!n||!l)throw Error(M.l8.INVALID_URL);let s=(0,M.yH)(r,"tree"===l),a=s.map(e=>()=>(0,x.Z)((0,M.Vq)(t,n,e),{responseFormatter(e){let t=e.headers.get("Content-Type");if(t!==tr)throw Error(M.l8.INVALID_URL);return e.json()},errorHandler(){throw Error(M.l8.NOT_FOUND)}})),i=await Promise.all(a.map(e=>e())),c=[];for(let e of i){var d;(null==e?void 0:null===(d=e.entries)||void 0===d?void 0:d.length)&&(c=[...c,...e.entries])}return c}async function to(e,t,r){if(!t)throw Error(M.l8.REPOSITORY_NOT_FOUND);let n=v.Lp.query(e7,{id:t.id,kind:t.kind,query:e,rev:r,pause:!t}).toPromise();return null==n?void 0:n.then(e=>{var t;if(null==e?void 0:e.error)throw Error(M.l8.FAILED_TO_FETCH);return null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.repositoryGrep})}},48048:function(e,t,r){"use strict";r.d(t,{BX:function(){return y},I:function(){return N},Jt:function(){return f},Pj:function(){return p},UR:function(){return v},Vq:function(){return w},fr:function(){return x},i3:function(){return h},kQ:function(){return k},l8:function(){return l},p4:function(){return S},r2:function(){return b},s8:function(){return j},yH:function(){return m}});var n,l,s=r(74630),a=r(5035),i=r(64220),o=r(13420),c=r(18500);(n=l||(l={})).FAILED_TO_FETCH="FAILED_TO_FETCH",n.INVALID_URL="INVALID_URL",n.NOT_FOUND="NOT_FOUND",n.REPOSITORY_NOT_FOUND="REPOSITORY_NOT_FOUND",n.REPOSITORY_SYNC_FAILED="REPOSITORY_SYNC_FAILED";let d=Object.keys(c.vW).map(e=>u(e));function u(e){return e.toLowerCase().replaceAll("_","")}function f(e){let t,r,n;let l={};if(!e)return l;let a=e.indexOf("/-/"),i=e.split("/"),u=i[0],f=d.includes(u);if(!f||-1===a)return l;let h=c.vW.Git;switch(u){case"git":h=c.vW.Git;break;case"github":h=c.vW.Github;break;case"gitlab":h=c.vW.Gitlab;break;case"githubselfhosted":h=c.vW.GithubSelfHosted;break;case"gitlabselfhosted":h=c.vW.GitlabSelfHosted;case"gitconfig":h=c.vW.GitConfig}let m=e.indexOf("/-/tree/"),p=e.indexOf("/-/blob/"),x=e.indexOf("/-/search/");if(m>-1){r="tree";let l=e.slice(m+8),s=l.split("/");n=s[0],t=(0,o.Z)(s.slice(1).join("/"),"/")}if(p>-1){r="blob";let l=e.slice(p+8),s=l.split("/");n=s[0],t=(0,o.Z)(s.slice(1).join("/"),"/")}if(x>-1){r="search";let l=e.slice(x+10),s=l.split("/");n=s[0],t=""}let v=e.split("/-/")[0],g=v.split("/").slice(1).join("/");return{repositorySpecifier:e.split("/-/")[0],repositoryName:g,repositoryKind:h,rev:(0,s.Z)(n)?void 0:decodeURIComponent(n),viewMode:r,basename:(0,s.Z)(t)?void 0:decodeURIComponent(t)}}function h(e){if(!e)return"";let t=e.split("/");return t[t.length-1]}function m(e,t){if((0,s.Z)(e))return[];let r=[""],n=e.split("/"),l=t?n.length:n.length-1;for(let e=0;e"".concat(u(e.kind),"/").concat(e.name))}function v(e){let t=(0,i.Z)(e,e=>e);return t.sort((e,t)=>e.name.localeCompare(t.name)),t}function g(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}function b(e,t){if(!e)return{name:"",ref:void 0};let r=e.name.match(/refs\/(\w+)\/(.*)/);if(r){let n="tags"===r[1]?"tag":"branch";return{kind:null!=t?t:n,name:r[2],ref:e}}return"commit"===t?{kind:t,name:e.commit,ref:e}:{name:"",ref:e}}function j(e){let t,r,n,l;for(let s of e){let{name:e}=s;"refs/heads/main"===e?t=s:"refs/heads/master"===e?r=s:!n&&e.startsWith("refs/heads/")?n=s:!l&&e.startsWith("refs/tags/")&&(l=s)}return t||r||n||l}function y(e){return"blob"===e?"file":"dir"}function N(e,t,r,n){let l=p(e);return"".concat(l,"/-/").concat("search"===n?"search":"file"===n?"blob":"tree","/").concat(encodeURIComponent(null!=t?t:""),"/").concat(g(null!=r?r:""))}function w(e,t,r){let n=null==e?void 0:e.id,l=null==e?void 0:e.kind;if(!n||!l||!t)return null;let s="".concat(u(l),"/").concat(n);return"/repositories/".concat(s,"/rev/").concat(encodeURIComponent(t),"/").concat(g(null!=r?r:""))}function k(e){if(!e)return null;let t=/^#L(\d+)(?:-L(\d+))?/.exec(e);if(!t)return null;let[,r,n]=t,l=parseInt(r),s=parseInt(n);return{start:Number.isNaN(l)?void 0:l,end:Number.isNaN(s)?void 0:s}}function S(e){var t;return(null===(t=k(e))||void 0===t?void 0:t.start)!==void 0}},27064:function(e,t,r){"use strict";r.d(t,{u:function(){return l}});var n=r(18366);let l=(0,n.Z)()},85312:function(e,t,r){"use strict";r.d(t,{Z:function(){return v}});var n=r(36164),l=r(3546),s=r(30352),a=r(94559),i=r(14679),o=r(88105),c=r(99641),d=r(21399),u=r(1853),f=r(49776);let h=[(0,o.AE)(),(0,f.sW)(),a.yy.allowMultipleSelections.of(!0),(0,s.nF)(s.R_,{fallback:!0}),(0,o.Zs)()];r(65001);var m=r(1544);let p=a.q6.define(),x=l.forwardRef((e,t)=>{let{value:r,theme:f,language:x,readonly:v=!0,extensions:g,height:b=null,width:j=null,viewDidUpdate:y,className:N}=e,w=l.useRef(!1),k=l.useRef(null),[S,C]=l.useState(null),I=o.tk.theme({"&":{height:b,width:j,outline:"none !important",background:"hsl(var(--background))"},"&.cm-focused":{outline:"none !important"},"& .cm-scroller":{height:"100% !important",outline:"none"},"& .cm-gutters":{background:"hsl(var(--background))"},"&.cm-focused .cm-selectionLayer .cm-selectionBackground":{backgroundColor:"hsl(var(--cm-selection-bg)) !important"},".cm-selectionLayer .cm-selectionBackground":{backgroundColor:"hsl(var(--cm-selection-bg)) !important"}}),E=[I,h,o.tk.baseTheme({".cm-line":{lineHeight:"20px"},".cm-scroller":{fontSize:"14px"},".cm-gutters":{backgroundColor:"transparent",borderRight:"none"}}),a.yy.readOnly.of(v)],R=e=>"graphql"===e?new s.ri(d.Wf):(0,c.vf)(function(e,t){switch(e){case"javascript-typescript":return"tsx";case"shellscript":case"bash":return"shell";default:return e}}(e)),_=()=>{let e=(0,u.Z)([...E,R(x)]);return"dark"===f?(e.push(i.pD),e.push((0,s.nF)(i.VE))):e.push((0,s.nF)(s.R_)),Array.isArray(g)&&(e=e.concat(g)),e};return l.useEffect(()=>{(()=>{if(!w.current&&k.current){w.current=!0;let e=a.yy.create({doc:r,extensions:_()}),t=new o.tk({state:e,parent:k.current});C(t)}})()},[]),l.useEffect(()=>{S&&S.dispatch({effects:a.Py.reconfigure.of(_())})},[b,j,f,x,g]),l.useEffect(()=>{(()=>{if(void 0===r||!S)return;let e=S?S.state.doc.toString():"";S&&r!==e&&S.dispatch({changes:{from:0,to:e.length,insert:r||""},annotations:[p.of(!0)]})})()},[r]),l.useEffect(()=>()=>{S&&(S.destroy(),C(null))},[]),l.useEffect(()=>{null==y||y(S)},[S]),l.useImperativeHandle(t,()=>({getView:()=>S}),[S]),(0,n.jsx)("div",{className:(0,m.cn)("codemirror-editor h-full",N),ref:k})});x.displayName="CodeMirrorEditor";var v=x},30601:function(e,t,r){"use strict";r.d(t,{Hb:function(){return h},wt:function(){return d},xc:function(){return m},yo:function(){return f}});var n=r(36164),l=r(3546),s=r(74630),a=r(36327),i=r(80605),o=r(1544),c=r(81565);let d="3.5rem",u=l.createContext({}),f=e=>{let{children:t}=e,r=(0,i.UA)(),[a,o]=l.useState(!1);return l.useEffect(()=>{let e=window.self!==window.top;e||(0,s.Z)(r)||o(r)},[r]),(0,n.jsx)(u.Provider,{value:{isShowDemoBanner:a,setIsShowDemoBanner:o},children:t})};function h(){let{isShowDemoBanner:e,setIsShowDemoBanner:t}=l.useContext(u);return[e,t]}function m(){let[e,t]=h(),{data:r}=(0,a.Z)("https://api.github.com/repos/TabbyML/tabby",e=>fetch(e).then(e=>e.json()));return(0,n.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between bg-primary px-4 text-primary-foreground transition-[opacity,height] md:px-5",{"opacity-100 pointer-events-auto":e,"opacity-0 pointer-events-none":!e}),style:e?{height:d}:{height:0},children:[(0,n.jsxs)("a",{href:"https://links.tabbyml.com/schedule-a-demo",target:"_blank",className:"flex items-center gap-x-2 text-xs font-semibold underline md:text-sm",children:[(0,n.jsx)("span",{children:"\uD83D\uDCC6"}),(0,n.jsx)("span",{children:"Book a 30-minute product demo."})]}),e&&(0,n.jsx)("img",{referrerPolicy:"no-referrer-when-downgrade",src:"https://static.scarf.sh/a.png?x-pxid=b1d0308a-b3c5-425a-972a-378d883a2bca"}),(0,n.jsxs)("div",{className:"flex items-center gap-x-4 md:gap-x-8",children:[(0,n.jsxs)("a",{href:"https://github.com/TabbyML/tabby",target:"_blank",className:"flex items-center transition-all hover:opacity-70",children:[(0,n.jsx)(c.IconGithub,{}),(0,n.jsxs)("div",{className:"ml-2 hidden md:block",children:[(0,n.jsx)("p",{className:"text-xs font-semibold",children:"TabbyML/tabby"}),(0,n.jsxs)("div",{className:(0,o.cn)("flex items-center text-xs transition-all",{"h-4 opacity-70":r,"h-0 opacity-0":!r}),children:[(0,n.jsx)(c.IconStar,{className:"mr-1 h-2.5 w-2.5"}),(0,n.jsx)("span",{children:null==r?void 0:r.stargazers_count}),(0,n.jsx)(c.IconGitFork,{className:"ml-2 mr-1 h-2.5 w-2.5"}),(0,n.jsx)("span",{children:null==r?void 0:r.forks_count})]})]})]}),(0,n.jsx)(c.IconClose,{className:"cursor-pointer transition-all hover:opacity-70",onClick:()=>t(!1)})]})]})}},38736:function(e,t,r){"use strict";r.d(t,{J:function(){return u},U:function(){return f}});var n=r(36164),l=r(3546),s=r(7062),a=r.n(s),i=r(9010),o=r(24449),c=r(16784);let d=l.createContext({}),u=e=>{let{children:t}=e,{theme:r}=(0,i.X)(),[s,u]=l.useState(!1),[f]=(0,o.n)(s,200,{leading:!0}),h=(0,c.d)(s);l.useEffect(()=>{a().config({barColors:{0:"dark"===r?"#DC981A":"#B7942B"}})},[]);let m=l.useCallback(e=>{e&&e===h.current||u(e)},[]);return(0,n.jsxs)(d.Provider,{value:{progress:f,setProgress:m},children:[f&&(0,n.jsx)(a(),{}),t]})},f=()=>l.useContext(d)},36065:function(e,t,r){"use strict";r.d(t,{di:function(){return m},e8:function(){return d},fu:function(){return f},mY:function(){return o},rb:function(){return u},sZ:function(){return c},zz:function(){return h}});var n=r(36164),l=r(3546),s=r(53241),a=r(93170),i=r(1544);r(30220);let o=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY,{ref:t,className:(0,i.cn)("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",r),...l})});o.displayName=s.mY.displayName;let c=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,n.jsx)(a.Z,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,n.jsx)(s.mY.Input,{ref:t,className:(0,i.cn)("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",r),...l})]})});c.displayName=s.mY.Input.displayName;let d=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY.List,{ref:t,className:(0,i.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",r),...l})});d.displayName=s.mY.List.displayName;let u=l.forwardRef((e,t)=>(0,n.jsx)(s.mY.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));u.displayName=s.mY.Empty.displayName;let f=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY.Group,{ref:t,className:(0,i.cn)("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",r),...l})});f.displayName=s.mY.Group.displayName;let h=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY.Separator,{ref:t,className:(0,i.cn)("-mx-1 h-px bg-border",r),...l})});h.displayName=s.mY.Separator.displayName;let m=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY.Item,{ref:t,className:(0,i.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-accent aria-selected:text-accent-foreground",r),...l})});m.displayName=s.mY.Item.displayName},30220:function(e,t,r){"use strict";r.d(t,{$N:function(){return p},Be:function(){return x},Vq:function(){return o},cN:function(){return m},cZ:function(){return f},fK:function(){return h},hg:function(){return c}});var n=r(36164),l=r(3546),s=r(4318),a=r(1663),i=r(1544);let o=s.fC,c=s.xz,d=s.h_;s.x8;let u=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.aV,{ref:t,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...l})});u.displayName=s.aV.displayName;let f=l.forwardRef((e,t)=>{let{className:r,children:l,...o}=e;return(0,n.jsxs)(d,{children:[(0,n.jsx)(u,{}),(0,n.jsxs)(s.VY,{ref:t,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...o,children:[l,(0,n.jsxs)(s.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,n.jsx)(a.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});f.displayName=s.VY.displayName;let h=e=>{let{className:t,...r}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...r})};h.displayName="DialogHeader";let m=e=>{let{className:t,...r}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};m.displayName="DialogFooter";let p=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.Dx,{ref:t,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",r),...l})});p.displayName=s.Dx.displayName;let x=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.dk,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",r),...l})});x.displayName=s.dk.displayName},53538:function(e,t,r){"use strict";r.d(t,{Dp:function(){return o},ee:function(){return i},pO:function(){return a}});var n=r(36164),l=r(6618),s=r(1544);let a=e=>{let{className:t,...r}=e;return(0,n.jsx)(l.eh,{className:(0,s.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...r})},i=l.s_,o=e=>{let{withHandle:t,className:r,...a}=e;return(0,n.jsx)(l.OT,{className:(0,s.cn)("border-bg relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",r),...a,children:t&&(0,n.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border"})})}},57830:function(e,t,r){"use strict";r.r(t),r.d(t,{ScrollArea:function(){return i},ScrollBar:function(){return o}});var n=r(36164),l=r(3546),s=r(50778),a=r(1544);let i=l.forwardRef((e,t)=>{let{className:r,children:l,...i}=e;return(0,n.jsxs)(s.fC,{className:(0,a.cn)("relative overflow-hidden",r),...i,children:[(0,n.jsx)(s.l_,{ref:t,className:"h-full w-full rounded-[inherit] [&>div]:!block",children:l}),(0,n.jsx)(o,{}),(0,n.jsx)(s.Ns,{})]})});i.displayName=s.fC.displayName;let o=l.forwardRef((e,t)=>{let{className:r,orientation:l="vertical",...i}=e;return(0,n.jsx)(s.gb,{ref:t,orientation:l,className:(0,a.cn)("flex touch-none select-none transition-colors","vertical"===l&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===l&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",r),...i,children:(0,n.jsx)(s.q4,{className:"relative flex-1 rounded-full bg-border"})})});o.displayName=s.gb.displayName},54594:function(e,t,r){"use strict";r.d(t,{Bw:function(){return f},DI:function(){return c},Ph:function(){return o},Ql:function(){return m},U$:function(){return p},i4:function(){return u},ki:function(){return d}});var n=r(36164),l=r(3546),s=r(31889),a=r(1544),i=r(81565);let o=s.fC,c=s.ZA,d=s.B4,u=l.forwardRef((e,t)=>{let{className:r,children:l,...o}=e;return(0,n.jsxs)(s.xz,{ref:t,className:(0,a.cn)("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),...o,children:[l,(0,n.jsx)(s.JO,{asChild:!0,children:(0,n.jsx)(i.IconChevronUpDown,{className:"opacity-50"})})]})});u.displayName=s.xz.displayName;let f=l.forwardRef((e,t)=>{let{className:r,children:l,position:i="popper",...o}=e;return(0,n.jsx)(s.h_,{children:(0,n.jsx)(s.VY,{ref:t,className:(0,a.cn)("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-80","popper"===i&&"translate-y-1",r),position:i,...o,children:(0,n.jsx)(s.l_,{className:(0,a.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l})})})});f.displayName=s.VY.displayName;let h=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.__,{ref:t,className:(0,a.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",r),...l})});h.displayName=s.__.displayName;let m=l.forwardRef((e,t)=>{let{className:r,children:l,isPlaceHolder:o,...c}=e;return(0,n.jsxs)(s.ck,{ref:t,className:(0,a.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...c,children:[!o&&(0,n.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,n.jsx)(s.wU,{children:(0,n.jsx)(i.IconCheck,{className:"h-4 w-4"})})}),(0,n.jsx)(s.eT,{children:l})]})});m.displayName=s.ck.displayName;let p=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.Z0,{ref:t,className:(0,a.cn)("-mx-1 my-1 h-px bg-muted",r),...l})});p.displayName=s.Z0.displayName},99047:function(e,t,r){"use strict";r.d(t,{RM:function(){return o},SC:function(){return d},iA:function(){return a},pj:function(){return f},ss:function(){return u},xD:function(){return i}});var n=r(36164),l=r(3546),s=r(1544);let a=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("table",{ref:t,className:(0,s.cn)("w-full caption-bottom text-sm",r),...l})});a.displayName="Table";let i=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("thead",{ref:t,className:(0,s.cn)("[&_tr]:border-b",r),...l})});i.displayName="TableHeader";let o=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("tbody",{ref:t,className:(0,s.cn)("[&_tr:last-child]:border-0",r),...l})});o.displayName="TableBody";let c=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("tfoot",{ref:t,className:(0,s.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r),...l})});c.displayName="TableFooter";let d=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("tr",{ref:t,className:(0,s.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...l})});d.displayName="TableRow";let u=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("th",{ref:t,className:(0,s.cn)("h-12 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r),...l})});u.displayName="TableHead";let f=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("td",{ref:t,className:(0,s.cn)("p-2 align-middle [&:has([role=checkbox])]:pr-0",r),...l})});f.displayName="TableCell";let h=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("caption",{ref:t,className:(0,s.cn)("mt-4 text-sm text-muted-foreground",r),...l})});h.displayName="TableCaption"},50538:function(e,t,r){"use strict";r.d(t,{SP:function(){return c},dr:function(){return o},mQ:function(){return i}});var n=r(36164),l=r(3546),s=r(6044),a=r(1544);let i=s.fC,o=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.aV,{ref:t,className:(0,a.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",r),...l})});o.displayName=s.aV.displayName;let c=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.xz,{ref:t,className:(0,a.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",r),...l})});c.displayName=s.xz.displayName;let d=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.VY,{ref:t,className:(0,a.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r),...l})});d.displayName=s.VY.displayName},9010:function(e,t,r){"use strict";r.d(t,{X:function(){return l}});var n=r(28242);function l(){let{theme:e,systemTheme:t,setTheme:r}=(0,n.F)();return{theme:e&&"system"!==e?e:t||"light",setTheme:r,systemTheme:t}}},44645:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(3546),l=r(11978);function s(){let e=(0,l.usePathname)(),t=(0,l.useRouter)(),r=(0,l.useSearchParams)(),s=(0,n.useCallback)(e=>{let t=new URLSearchParams(r);e&&Object.entries(e).forEach(e=>{let[r,n]=e;return t.set(r,n)});let n=t.toString();return n.length>0?"?".concat(n):""},[r]),a=(0,n.useCallback)(n=>{let l=function(e,t,r){var n,l;let s=null===(n=r.searchParams)||void 0===n?void 0:n.set,a=null===(l=r.searchParams)||void 0===l?void 0:l.del,i=new URLSearchParams(t);s&&Object.entries(s).forEach(e=>{let[t,r]=e;return i.set(t,r)}),a&&(Array.isArray(a)?a.forEach(e=>i.delete(e)):i.delete(a));let o=i.toString(),c=e;return o.length>0&&(c+="?".concat(o)),r.hash&&(c+="#".concat(r.hash.replace(/^#/,""))),c}((null==n?void 0:n.pathname)||e,r,n);return n.replace?t.replace(l):t.push(l),l},[e,r]);return{pathname:e,router:t,searchParams:r,getQueryString:s,updateUrlComponents:a}}},55823:function(){},65001:function(){},11075:function(e,t,r){"use strict";r.d(t,{eI:function(){return s},n0:function(){return a},uL:function(){return l}});var n=r(44494);let l="0.4.0";function s(e,t){return(0,n.K9)(e,{expose:{navigate:t.navigate,refresh:t.refresh,onSubmitMessage:t.onSubmitMessage,onApplyInEditor:t.onApplyInEditor,onApplyInEditorV2:t.onApplyInEditorV2,onLoaded:t.onLoaded,onCopy:t.onCopy,onKeyboardEvent:t.onKeyboardEvent,lookupSymbol:t.lookupSymbol,openInEditor:t.openInEditor}})}function a(e){return(0,n.cy)({expose:{init:e.init,sendMessage:e.sendMessage,showError:e.showError,cleanError:e.cleanError,addRelevantContext:e.addRelevantContext,updateTheme:e.updateTheme,updateActiveSelection:e.updateActiveSelection}})}},14439:function(e,t,r){"use strict";r.d(t,{H:function(){return a},m:function(){return s}});var n=r(3546),l=r(11075);function s(e,t){let[r,s]=(0,n.useState)(null),a=!1;return(0,n.useEffect)(()=>{e.current&&!a&&(a=!0,s((0,l.eI)(e.current,t)))},[e.current]),r}function a(e){let[t,r]=(0,n.useState)(null),s=!1;return(0,n.useEffect)(()=>{let t=window.self!==window.top;t&&!s&&(s=!0,r((0,l.n0)(e)))},[]),t}r(44494)},44494:function(e,t,r){"use strict";r.d(t,{K9:function(){return g},cy:function(){return b}});let n=Symbol.for("quilt.threads.retain"),l=Symbol.for("quilt.threads.release"),s=Symbol.for("quilt.threads.retained-by"),a=Symbol.for("quilt.threads.encode"),i=Symbol.for("quilt.threads.transferable");class o{memoryManaged=new Set;add(e){this.memoryManaged.add(e),e[s].add(this),e[n]()}release(){for(let e of this.memoryManaged)e[s].delete(this),e[l]();this.memoryManaged.clear()}}function c(e){return!!(e&&e[n]&&e[l])}function d(e){if(null==e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return null==t||t===Object.prototype}function u(e,{expose:t,callable:r,signal:u,uuid:m=h,encoder:p=function({encode:e,decode:t}={}){return{encode:function(e,t){let n={api:t,seen:new Map,encode:e=>r(e,n,!0)};return r(e,n)},decode:function(e,t,r){let l={api:t,decode:e=>n(e,l,r,!0)};return n(e,l)}};function r(t,n,l=!1){let{seen:s,api:o,encode:c}=n;if(!l&&e)return e(t,c);if(null==t)return[t];let u=s.get(t);if(u)return u;if(s.set(t,[void 0]),"object"==typeof t){if(t[i]){let e=[t,[t]];return s.set(t,e),e}let e=[],l=t=>{let[l,s=[]]=r(t,n);return e.push(...s),l};if("function"==typeof t[a]){let r=t[a]({encode:l}),n=[r,e];return s.set(t,n),n}if(Array.isArray(t)){let r=t.map(e=>l(e)),n=[r,e];return s.set(t,n),n}if(t instanceof RegExp){let r={"_@r":[t.source,t.flags]},n=[r,e];return s.set(t,n),n}if(t instanceof URL){let r={"_@u":t.href},n=[r,e];return s.set(t,n),n}if(t instanceof Date){let r={"_@d":t.toISOString()},n=[r,e];return s.set(t,n),n}if(t instanceof Map){let r=[...t.entries()].map(([e,t])=>[l(e),l(t)]),n=[{"_@m":r},e];return s.set(t,n),n}if(t instanceof Set){let r=[...t].map(e=>l(e)),n=[{"_@s":r},e];return s.set(t,n),n}let o=null!=t&&(Symbol.asyncIterator in t||Symbol.iterator in t)&&"function"==typeof t.next;if(d(t)||o){let r={};for(let e of Object.keys(t))r[e]=l(t[e]);o&&(r.next??=l(t.next.bind(t)),r.return??=l(t.return.bind(t)),r.throw??=l(t.throw.bind(t)),r["_@i"]=!0);let n=[r,e];return s.set(t,n),n}}if("function"==typeof t){let e=o.functions?.add(t);if(null==e)return[e];let r=[{"_@f":e}];return s.set(t,r),r}let f=[t];return s.set(t,f),f}function n(e,r,l,s=!1){let{api:a,decode:i}=r;if(!s&&t)return t(e,i,l);if("object"==typeof e){if(null==e)return e;if(Array.isArray(e))return e.map(e=>n(e,r,l));if("_@r"in e)return new RegExp(...e["_@r"]);if("_@u"in e)return new URL(e["_@u"]);if("_@d"in e)return new Date(e["_@d"]);if("_@m"in e)return new Map(e["_@m"].map(([e,t])=>[n(e,r,l),n(t,r,l)]));if("_@s"in e)return new Set(e["_@s"].map(e=>n(e,r,l)));if("_@f"in e){let t=e["_@f"],r=a.functions?.get(t);if(l&&c(r))for(let e of l)e.add(r);return r}if(!d(e))return e;let t={};for(let s of Object.keys(e))"_@i"===s?t[Symbol.asyncIterator]=()=>t:t[s]=n(e[s],r,l);return t}return e}}()}={}){let x=!1,v=new Map,g=new Map,b=new Map,j=new Map;if(t)for(let e of Object.keys(t)){let r=t[e];"function"==typeof r&&v.set(e,r)}let y=new Map,N=function(e,t){let r;if(null==t){if("function"!=typeof Proxy)throw Error("You must pass an array of callable methods in environments without Proxies.");let t=new Map;r=new Proxy({},{get(r,n){if(t.has(n))return t.get(n);let l=e(n);return t.set(n,l),l}})}else for(let n of(r={},t))Object.defineProperty(r,n,{value:e(n),writable:!1,configurable:!0,enumerable:!0});return r}(function(e){return(...t)=>{try{if(x)throw new f;if("string"!=typeof e&&"number"!=typeof e)throw Error(`Can’t call a symbol method on a thread: ${e.toString()}`);if("hasCapability"===e){let e=t[0],r=m(),n=I(r);return S(7,[r,e]),n}let r=m(),n=I(r),[l,s]=p.encode(t,w);return S(0,[r,e,l],s),n}catch(e){return Promise.reject(e)}}},r),w={functions:{add(e){let t=g.get(e);return null==t&&(t=m(),g.set(e,t),b.set(t,e)),t},get(e){let t=j.get(e);if(t)return t;let r=0,a=!1;return Object.defineProperties(t=(...t)=>{if(a)throw Error("You attempted to call a function that was already released.");if(!j.has(e))throw Error("You attempted to call a function that was already revoked.");let[r,n]=p.encode(t,w),l=m(),s=I(l);return S(5,[l,e,r],n),s},{[l]:{value:()=>{0==(r-=1)&&(a=!0,j.delete(e),S(3,[e]))},writable:!1},[n]:{value:()=>{r+=1},writable:!1},[s]:{value:new Set,writable:!1}}),j.set(e,t),t}}},k=()=>{if(!x){for(let e of y.keys())E(e,new f);x=!0,v.clear(),y.clear(),g.clear(),b.clear(),j.clear()}};return u?.addEventListener("abort",()=>{S(2,[]),k()},{once:!0}),e.listen(C,{signal:u}),N;function S(t,r,n){x||e.send([t,r],n)}async function C(e){let t=Array.isArray(e)&&"number"==typeof e[0]&&(null==e[1]||Array.isArray(e[1]));if(t)switch(e[0]){case 2:k();break;case 0:{let t=new o,[r,n,l]=e[1],s=v.get(n);try{if(null==s)throw Error(`No '${n}' method is exposed on this endpoint`);let e=await s(...p.decode(l,w,[t])),[a,i]=p.encode(e,w);S(1,[r,void 0,a],i)}catch(l){let{name:e,message:t,stack:n}=l;S(1,[r,{name:e,message:t,stack:n}])}finally{t.release()}break}case 1:case 6:E(...e[1]);break;case 3:{let[t]=e[1],r=b.get(t);r&&(b.delete(t),g.delete(r));break}case 5:{let[t,r,n]=e[1],l=new o;try{let e=b.get(r);if(null==e)throw Error("You attempted to call a function that was already released.");let a=await e(...p.decode(n,w,c(e)?[...e[s],l]:[l])),[i,o]=p.encode(a,w);S(6,[t,void 0,i],o)}catch(l){let{name:e,message:r,stack:n}=l;S(6,[t,{name:e,message:r,stack:n}])}finally{l.release()}break}case 7:{let[t,r]=e[1],n=v.has(r);S(1,[t,void 0,p.encode(n,w)[0]])}}}function I(e){let t=new Promise((t,r)=>{y.set(e,(e,n,l)=>{if(null==n)t(p.decode(l,w));else{let e=Error();Object.assign(e,n),r(e)}})});return Object.defineProperty(t,Symbol.asyncIterator,{async *value(){let e=await t;Object.defineProperty(e,Symbol.asyncIterator,{value:()=>e}),yield*e}}),t}function E(...e){let t=e[0],r=y.get(t);r&&(r(...e),y.delete(t))}}class f extends Error{constructor(){super("You attempted to call a function on a terminated thread.")}}function h(){return`${m()}-${m()}-${m()}-${m()}`}function m(){return Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)}var p=r(18400);let x="quilt.threads.ping",v="quilt.threads.pong";function g(e,{targetOrigin:t="*",...r}={}){let n=!1,l=function(r,n){e.contentWindow?.postMessage(r,t,n)},s=new Promise(t=>{let s=r.signal?new p.z(r.signal):new AbortController;window.addEventListener("message",r=>{r.source===e.contentWindow&&r.data===v&&(n=!0,s.abort(),t())},{signal:s.signal}),s.signal.addEventListener("abort",()=>{t()},{once:!0}),l(x)});return u({send:(e,t)=>n?l(e,t):s.then(()=>{if(n)return l(e,t)}),listen(t,{signal:r}){self.addEventListener("message",r=>{r.source===e.contentWindow&&r.data!==v&&t(r.data)},{signal:r})}},r)}function b({targetOrigin:e="*",...t}={}){if("undefined"==typeof self||null==self.parent)throw Error("You are not inside an iframe, because there is no parent window.");let{parent:r}=self,n=t.signal?new p.z(t.signal):new AbortController,l=()=>{let n=()=>r.postMessage(v,e);self.addEventListener("message",({data:e})=>{e===x&&n()},{signal:t.signal}),n()};return"complete"===document.readyState?l():document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&(l(),n.abort())},{signal:n.signal}),u({send:(t,n)=>r.postMessage(t,e,n),listen(e,{signal:t}){self.addEventListener("message",t=>{t.data!==x&&e(t.data)},{signal:t})}},t)}}},function(e){e.O(0,[8415,5870,6056,1386,55,3126,4007,9643,4752,3449,2578,8511,2287,4421,1454,7070,4318,3299,1889,4405,4553,5083,440,7651,5019,598,1544,1565,3821,5871,3375,5289,1744],function(){return e(e.s=4755)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/ee/tabby-webserver/ui/_next/static/chunks/app/files/page-fe45fcc064e65dce.js b/ee/tabby-webserver/ui/_next/static/chunks/app/files/page-fe45fcc064e65dce.js
deleted file mode 100644
index e6a3659edf8f..000000000000
--- a/ee/tabby-webserver/ui/_next/static/chunks/app/files/page-fe45fcc064e65dce.js
+++ /dev/null
@@ -1 +0,0 @@
-(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[357],{4755:function(e,t,r){Promise.resolve().then(r.bind(r,31919))},31919:function(e,t,r){"use strict";r.r(t),r.d(t,{SourceCodeBrowser:function(){return tl},SourceCodeBrowserContext:function(){return te}});var n=r(36164),l=r(3546),s=r(11978),a=r(57778),i=r(1853),o=r(94909),c=r(74630),d=r(26165),u=r(21454),f=r(43240),h=r(44645),m=r(80605),p=r(63484),x=r(3765),v=r(11634),g=r(70410),b=r(1544),j=r(53538),y=r(57830),N=r(30601),w=r(90379),k=r(38736),S=r(27064),C=r(50538),I=r(42891),E=r.n(I),R=r(23342),_=r(91655),O=r(2578),P=r(28312),F=r(31458),L=r(81565),D=r(29),M=r(48048);let T=e=>{let{blob:t,className:r,canCopy:s,hideBlobActions:a,contentLength:i,children:o,...c}=e,{chatSideBarVisible:d,setChatSideBarVisible:u,isChatEnabled:f}=l.useContext(te),{activePath:h}=l.useContext(te),{isCopied:m,copyToClipboard:p}=(0,P.m)({timeout:2e3}),x=f&&!d,v=i?(0,_.Z)(i):"",g=async()=>{if(!m&&t)try{let e=await t.text();p(e)}catch(e){O.A.error("Something went wrong. Please try again.")}};return(0,n.jsx)("div",{className:(0,b.cn)("rounded-t-lg border",r),...c,children:!a&&(0,n.jsxs)("div",{className:(0,b.cn)("flex items-center justify-between rounded-t-lg bg-secondary p-2 text-secondary-foreground"),children:[(0,n.jsxs)("div",{className:"flex h-8 items-center gap-4 leading-8",children:[o,(0,n.jsx)("span",{className:"ml-2 text-sm text-muted-foreground",children:v})]}),(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[s&&(0,n.jsxs)(D.u,{children:[(0,n.jsx)(D.aJ,{asChild:!0,children:(0,n.jsxs)(F.z,{variant:"ghost",size:"icon",onClick:g,children:[m?(0,n.jsx)(L.IconCheck,{className:"text-green-600"}):(0,n.jsx)(L.IconCopy,{}),(0,n.jsx)("span",{className:"sr-only",children:"Copy"})]})}),(0,n.jsx)(D._v,{children:"Copy raw file"})]}),!!t&&(0,n.jsxs)(D.u,{children:[(0,n.jsx)(D.aJ,{asChild:!0,children:(0,n.jsx)("a",{className:(0,F.d)({variant:"ghost",size:"icon"}),download:(0,M.i3)(null!=h?h:""),href:URL.createObjectURL(t),children:(0,n.jsx)(L.IconDownload,{})})}),(0,n.jsx)(D._v,{children:"Download raw file"})]}),x&&(0,n.jsxs)(D.u,{children:[(0,n.jsx)(D.aJ,{asChild:!0,children:(0,n.jsxs)(F.z,{variant:"ghost",className:"flex shrink-0 items-center gap-1 px-2",onClick:e=>u(!d),children:[(0,n.jsx)(E(),{alt:"Tabby logo",src:R.Z,width:24}),"Ask Tabby"]})}),(0,n.jsx)(D._v,{children:"Open chat panel"})]})]})]})})},A=e=>{let{className:t,blob:r,isImage:s}=e,{activePath:a}=(0,l.useContext)(te);return(0,n.jsx)("div",{className:(0,b.cn)(t),children:(0,n.jsx)("div",{className:"rounded-b-lg border border-t-0 p-2 text-center",children:s?(0,n.jsx)("img",{className:"mx-auto",src:r?URL.createObjectURL(r):void 0}):(0,n.jsx)("a",{className:"text-primary hover:underline",download:(0,M.i3)(null!=a?a:""),href:r?URL.createObjectURL(r):"",target:"_blank",children:"View raw"})})})},U=l.lazy(()=>Promise.all([r.e(9148),r.e(4015)]).then(r.bind(r,44015))),Z=l.lazy(()=>Promise.all([r.e(1266),r.e(5395),r.e(557)]).then(r.bind(r,30557))),z=e=>{var t;let{className:r}=e,{searchParams:s}=(0,h.Z)(),{activePath:a}=(0,l.useContext)(te),{textValue:i}=(0,l.useContext)(Y),o=a?(0,p.U$)(a)[0]:void 0,c=null!=o?o:"plain",d=(null===(t=s.get("plain"))||void 0===t?void 0:t.toString())==="1";return(0,n.jsx)("div",{className:(0,b.cn)(r),children:(0,n.jsx)("div",{className:"rounded-b-lg border border-t-0",children:(0,n.jsx)(l.Suspense,{fallback:(0,n.jsx)(w.cg,{className:"p-2"}),children:i&&"markdown"===c&&!d?(0,n.jsx)(Z,{value:i}):(0,n.jsx)(U,{value:null!=i?i:"",language:c})})})})},Y=l.createContext({}),q=e=>{var t;let{className:r,blob:s,contentLength:a,fileDisplayType:i,loading:o}=e,{searchParams:c,updateUrlComponents:d}=(0,h.Z)(),{activePath:u}=l.useContext(te),{textValue:f}=l.useContext(Y),m="raw"===i||"image"===i,x=u?(0,p.U$)(u)[0]:void 0,v=(null===(t=c.get("plain"))||void 0===t?void 0:t.toString())==="1";return(0,n.jsxs)("div",{className:(0,b.cn)(r),children:[(0,n.jsx)("div",{className:"sticky top-0 z-10 overflow-hidden bg-background",children:(0,n.jsx)(T,{blob:s,contentLength:a,canCopy:!m,children:!!f&&"markdown"===(null!=x?x:"plain")&&(0,n.jsx)(C.mQ,{value:v?"1":"0",onValueChange:e=>{"1"===e?d({searchParams:{set:{plain:"1"}}}):d({searchParams:{del:"plain"}})},children:(0,n.jsxs)(C.dr,{children:[(0,n.jsx)(C.SP,{value:"0",children:"Preview"}),(0,n.jsx)(C.SP,{value:"1",children:"Code"})]})})})}),o&&!s?(0,n.jsx)(w.cg,{className:"p-2"}):m?(0,n.jsx)(A,{blob:s,isImage:"image"===i}):(0,n.jsx)(z,{})]})},V=e=>{let{blob:t,fileDisplayType:r,contentLength:s}=e,[a,i]=l.useState();return l.useEffect(()=>{let e=async e=>{try{let t=await e.text();i(t)}catch(e){i("")}};t&&"text"===r&&e(t)},[t,r]),(0,n.jsx)(Y.Provider,{value:{textValue:a},children:(0,n.jsx)(q,{blob:t,fileDisplayType:r,contentLength:s})})};var G=r(826),$=r(14439),H=r(16784),W=r(98454),B=r(17451);let K=e=>{let{className:t,...r}=e,[{data:s}]=(0,W.P)(),{pendingEvent:a,setPendingEvent:i,repoMap:o,updateActivePath:c}=l.useContext(te),d=(0,B.a)(e=>e.activeChatId),u=l.useRef(null),f=(0,H.d)(o),h=async e=>{if((null==e?void 0:e.filepath)&&(null==e?void 0:e.git_url)){let r=(0,b.nO)(null==e?void 0:e.range),n=f.current,l=(0,G.Z)(Object.keys(n),t=>{var r;return(null==n?void 0:null===(r=n[t])||void 0===r?void 0:r.gitUrl)===e.git_url});if(l){let s=n[l];if(s){var t;let n=(0,M.s8)(s.refs),l=null===(t=(0,M.r2)(n))||void 0===t?void 0:t.name,a=e.filepath?(0,p.U$)(e.filepath)[0]:void 0;c((0,M.I)(s,l,e.filepath,e.kind),{hash:r,replace:!1,plain:"markdown"===a&&!!r});return}}}},m=(0,$.m)(u,{navigate:h,refresh:async()=>{window.location.reload(),await new Promise(e=>{setTimeout(()=>e(null),1e3)})},async onSubmitMessage(e,t){},onApplyInEditor(e){},onLoaded(){},onCopy(e){},onKeyboardEvent(){},async onLookupSymbol(e,t){}}),x=e=>{let{action:t}=e,r="";switch(t){case"explain":r="Explain the selected code:";break;case"generate_unittest":r="Generate a unit test for the selected code:";break;case"generate_doc":r="Generate documentation for the selected code:"}return r};return(l.useEffect(()=>{(null==u?void 0:u.current)&&s&&(null==m||m.init({fetcherOptions:{authorization:s.me.authToken}}))},[null==u?void 0:u.current,m,s]),l.useEffect(()=>{if(a&&m){let{lineFrom:e,lineTo:t,code:r,path:n,gitUrl:l}=a;m.sendMessage({message:x(a),selectContext:{kind:"file",content:r,range:{start:e,end:null!=t?t:e},filepath:n,git_url:l}})}i(void 0)},[a,m]),null==s?void 0:s.me)?(0,n.jsxs)("div",{className:(0,b.cn)("flex h-full flex-col",t),...r,children:[(0,n.jsx)(J,{}),(0,n.jsx)("iframe",{src:"/chat",className:"w-full flex-1 border-0",ref:u},d)]}):(0,n.jsx)(n.Fragment,{})};function J(){let{setChatSideBarVisible:e}=l.useContext(te);return(0,n.jsx)("div",{className:"sticky top-0 flex items-center justify-end px-2 py-1",children:(0,n.jsx)(F.z,{size:"icon",variant:"ghost",onClick:t=>e(!1),children:(0,n.jsx)(L.IconClose,{})})})}var Q=r(24685),X=r(91299),ee=r(40055),et=r(24449),er=r(82394),en=r(11208);let el=e=>{var t;let{className:r}=e,a=(0,s.useRouter)(),i=(0,s.useSearchParams)(),{activeEntryInfo:o,activeRepo:c,activeRepoRef:d,updateActivePath:u}=l.useContext(te),[f,h]=l.useState(null===(t=i.get("q"))||void 0===t?void 0:t.toString()),[m]=(0,et.n)(f,300),p=l.useRef(null),x=null==c?void 0:c.kind,v=null==c?void 0:c.id,j=l.useMemo(()=>{if(m)return(0,X.Z)(m.replace(/-?(f|lang):\S+\s?/g,""))},[m]),[{data:y}]=(0,ee.aM)({query:g.D7,variables:{kind:x,id:v,pattern:null!=j?j:"",rev:null==d?void 0:d.name},pause:!v||!x||!j}),N=l.useMemo(()=>{var e,t;if(!j)return[];let r=null==y?void 0:null===(e=y.repositorySearch)||void 0===e?void 0:e.slice(0,5);return null!==(t=null==r?void 0:r.map(e=>({repositorySearch:e,value:e.path,label:e.path,type:"file"})))&&void 0!==t?t:[]},[null==y?void 0:y.repositorySearch,j]),w=l.useMemo(()=>{let e=[{label:"Include only results from file path matching the given search pattern.",value:"f",type:"tips"},{label:"Exclude results from file path matching the given search pattern.",value:"-f",type:"tips"},{label:"Include only results from the given language.",value:"lang",type:"tips"},{label:"Exclude results from the given language.",value:"-lang",type:"tips"}];if(!f)return[e[0],e[2]];let t=f.match(/(^|\s)-$/),r=f.match(/(^|\s)-?f$/),n=f.match(/(^|\s)-?l(a(n(g)?)?)?$/);return t?[e[1],e[3]]:r||n?r?e.slice(0,2):n?e.slice(2):[]:[]},[f]),{isOpen:k,getMenuProps:S,getInputProps:C,highlightedIndex:I,getItemProps:E,openMenu:R}=(0,Q.Kb)({items:N,onSelectedItemChange(e){let{selectedItem:t}=e;if((null==t?void 0:t.type)==="file"&&t.repositorySearch){let e=(0,M.I)(c,null==d?void 0:d.name,t.repositorySearch.path,t.repositorySearch.type);u(e);return}O(null==t?void 0:t.value)},stateReducer(e,t){let{type:r,changes:n}=t;switch(r){case Q.Kb.stateChangeTypes.InputClick:return{...n,highlightedIndex:void 0,isOpen:!0};case Q.Kb.stateChangeTypes.InputKeyDownArrowDown:{if(!(null==N?void 0:N.length)||!e.isOpen)return n;let t=e.highlightedIndex===N.length-1;return{...n,highlightedIndex:t?void 0:n.highlightedIndex}}case Q.Kb.stateChangeTypes.InputKeyDownArrowUp:{if(!(null==N?void 0:N.length)||!e.isOpen)return n;let t=0===e.highlightedIndex;return{...n,highlightedIndex:t?void 0:n.highlightedIndex}}default:return n}}}),_=e=>{k||R(),h(e)};l.useEffect(()=>{let e=e=>{var t,r;let n=e.target,l=null==n?void 0:null===(t=n.tagName)||void 0===t?void 0:t.toLowerCase();if("input"!==l&&"textarea"!==l&&"select"!==l&&"/"===e.key){e.preventDefault(),null===(r=p.current)||void 0===r||r.focus(),R();return}};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[]);let O=e=>{if(!e)return;let t=(0,M.I)(c,null==o?void 0:o.rev,"","search");a.push("/files/".concat(t,"?q=").concat(encodeURIComponent(e)))},P=!(null==w?void 0:w.length)&&!(null==N?void 0:N.length);return(0,n.jsx)("div",{className:(0,b.cn)("flex w-full shrink-0 items-center bg-background px-4 py-3.5 transition duration-500 ease-in-out",r),children:(0,n.jsxs)("div",{className:(0,b.cn)("relative w-full"),children:[(0,n.jsxs)("div",{className:"h-9",children:[(0,n.jsx)("div",{className:(0,b.cn)({"absolute z-10 inset-0":k}),children:(0,n.jsx)(er.I,{className:"w-full",...C({onKeyDown:e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),O(f))},ref:p}),value:f,onChange:e=>_(e.target.value)})}),!f&&(0,n.jsxs)("div",{className:"absolute left-3 top-1.5 cursor-text select-none text-muted-foreground",onClick:e=>{var t;e.preventDefault(),null===(t=p.current)||void 0===t||t.focus(),R()},children:["Type"," ",(0,n.jsx)("kbd",{className:"rounded border border-muted-foreground px-0.5",children:"/"})," ","to search"]})]}),(0,n.jsxs)("div",{className:"absolute right-2 top-0 z-20 flex h-full items-center",children:[f?(0,n.jsx)(F.z,{variant:"ghost",size:"icon",className:"h-6 w-6 cursor-pointer",onClick:()=>{var e;h(""),null===(e=p.current)||void 0===e||e.focus()},children:(0,n.jsx)(L.IconClose,{})}):null,(0,n.jsx)("div",{className:"z-20 ml-2 flex items-center border-l border-l-border pl-2",children:(0,n.jsx)(F.z,{variant:"ghost",className:"h-6 w-6 ",size:"icon",onClick:()=>O(f),children:(0,n.jsx)(L.IconSearch,{})})})]}),k&&(0,n.jsxs)("div",{className:(0,b.cn)("absolute -inset-x-3 -top-2.5 flex max-h-[60vh] flex-col overflow-hidden rounded-lg border bg-background p-4 shadow-2xl dark:border-2 dark:border-[#33363c] dark:bg-[hsl(0,0,13.5%)]",{"pb-0.5":P}),...S({suppressRefError:!0}),children:[(0,n.jsx)("div",{className:(0,b.cn)("shrink-0",P?"h-9":"h-12")}),(0,n.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[!!(null==w?void 0:w.length)&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"text-md mb-2 pl-2 font-semibold",children:"Narrow your search"}),(0,n.jsx)("div",{className:"space-y-2",children:w.map(e=>(0,n.jsx)(ea,{data:e},e.value))})]}),!!(null==N?void 0:N.length)&&(0,n.jsxs)(n.Fragment,{children:[!!(null==w?void 0:w.length)&&(0,n.jsx)(en.Z,{className:"my-2"}),(0,n.jsx)("div",{className:"text-md mb-1 pl-2 font-semibold",children:"Code"}),N.map((e,t)=>{var r,l;let s=e.repositorySearch,a=I===t;return(0,n.jsxs)("div",{className:(0,b.cn)("relative flex cursor-default select-none items-center gap-1 rounded-sm px-2 py-1.5 text-sm",a&&"cursor-pointer bg-accent text-accent-foreground"),...E({item:e,index:t,onMouseLeave:e=>e.preventDefault(),onMouseOut:e=>e.preventDefault()}),children:[(0,n.jsx)("div",{className:"shrink-0",children:(null==e?void 0:null===(r=e.repositorySearch)||void 0===r?void 0:r.type)==="dir"?(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}}):(0,n.jsx)(L.IconFile,{})}),(0,n.jsx)("div",{className:"flex-1 break-all",children:(0,n.jsx)(es,{text:s.path,indices:s.indices})}),(0,n.jsx)("div",{className:"shrink-0 text-sm text-muted-foreground",children:"Jump to"})]},null===(l=e.repositorySearch)||void 0===l?void 0:l.path)})]})]})]})]})})};function es(e){let{text:t,indices:r}=e,s=l.useMemo(()=>new Set(r),[r]);return(0,n.jsx)("p",{className:"text-muted-foreground",children:t.split("").map((e,t)=>s.has(t)?(0,n.jsx)("span",{className:"font-semibold text-foreground",children:e},"".concat(e,"_").concat(t)):e)})}function ea(e){let{data:t}=e,{label:r,value:l}=t;return(0,n.jsxs)("div",{className:"flex items-center gap-1 px-2 text-sm",children:[(0,n.jsx)(L.IconFilter,{className:"shrink-0"}),(0,n.jsxs)("div",{className:"text-secondary-foreground",children:[(0,n.jsxs)("span",{className:"mr-0.5 rounded bg-secondary px-1 py-0.5 text-secondary-foreground",children:[l,":"]}),(0,n.jsx)("span",{children:r})]})]})}var ei=r(97651),eo=r.n(ei),ec=r(39018),ed=r.n(ec),eu=r(3448),ef=r(70652),eh=r.n(ef),em=r(88105),ep=r(58388),ex=r(28242),ev=r(33523),eg=r(85312);let eb=em.tk.theme({".cm-line":{cursor:"pointer"},".cm-line:hover":{opacity:"60%"}});r(55823);let ej=em.p.mark({class:"search-match-mark"}),ey=em.tk.theme({".search-match-mark":{backgroundColor:"hsl(var(--mark-bg))"}});function eN(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=e.state.doc,n=r.length;if(!n)return em.p.none;let l=[];for(let e of t){let t=r.line(e.lineNumber),s=t.from,a={start:s+e.bytesStart,end:s+e.bytesEnd};try{a&&a.start<=n&&a.end<=n&&l.push(ej.range(a.start,a.end))}catch(e){}}return l.length?em.p.set(l):em.p.none}let ew=e=>{let t=em.lg.fromClass(class{update(t){(t.docChanged||t.viewportChanged)&&(this.marks=eN(t.view,e))}constructor(t){this.marks=eN(t,e)}},{decorations:e=>e.marks});return[t,ey]},ek=l.memo(e=>{let t,{path:r,pattern:l}=e;if(!l)return r;let s=RegExp((0,ep.Z)(l),"gi"),a=[];for(;null!==(t=s.exec(r));){let e=t.index,r=e+t[0].length;a.push({start:e,end:r})}return(0,n.jsx)(eC,{text:r,matches:a})});ek.displayName="FilePathView";let eS=e=>{let{result:t,query:r}=e,{theme:s}=(0,ex.F)(),{activeRepo:a,activeEntryInfo:i}=l.useContext(te),o=l.useMemo(()=>{var e;return null==r?void 0:null===(e=r.match(/f:(\S+)/))||void 0===e?void 0:e[1]},[r]),d=(0,p.U$)(t.path)[0],u=l.useMemo(()=>{var e;let r;let n=[],l=0,s=0,a=null!==(e=t.lines)&&void 0!==e?e:[];return a.forEach((e,t)=>{0===t?(l=t,s=t,r=e.lineNumber):((0,c.Z)(r)||e.lineNumber!==r+1?(r=e.lineNumber,n.push({start:l,end:s}),l=t):r=e.lineNumber,s=t)}),s!==(null==a?void 0:a.length)&&n.push({start:l,end:s}),n},[t.lines]),f="/files/".concat((0,M.I)(a,i.rev,t.path,"file"));return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"sticky top-9 z-10 border bg-secondary p-2 text-secondary-foreground",children:(0,n.jsx)(eh(),{href:{pathname:f},className:"inline-flex font-medium text-primary hover:underline",children:(0,n.jsx)(ek,{path:t.path,pattern:o})})}),(0,n.jsx)("div",{className:"divide-y-border mb-6 grid divide-y overflow-x-auto border border-t-0",children:u.map((e,r)=>{let l=t.lines.slice(e.start,e.end+1);return(0,n.jsx)(ev.Z,{height:20*l.length+9,offset:300,children:(0,n.jsx)(eI,{language:d,theme:s,lines:l,path:t.path})},"".concat(t.path,"-").concat(e.start))})})]})};function eC(e){let{text:t,matches:r}=e;if(!r||0===r.length)return(0,n.jsx)("span",{children:t});let l=[],s=0;return r.forEach((e,r)=>{e.start>s&&l.push((0,n.jsx)("span",{children:t.substring(s,e.start)},"text-".concat(r))),l.push((0,n.jsx)("span",{className:"bg-[hsl(var(--mark-bg))]",children:t.substring(e.start,e.end)},"match-".concat(r))),s=e.end}),s{var e;let t=null!==(e=null==i?void 0:i.reduce((e,t)=>e+(t.line.text||atob(t.line.base64||"")||""),""))&&void 0!==e?e:"";return t.replace(/\n$/,"")},[]),h=(null==i?void 0:null===(t=i[0])||void 0===t?void 0:t.lineNumber)||0,m=l.useMemo(()=>{if(null==i?void 0:i.length){var e;let t=[];for(let e=0;e{let t="/files/".concat((0,M.I)(d,u.rev,o,"file"));c.push("".concat(t,"?plain=1#L").concat(h+e-1))},[eb,em.tk.domEventHandlers({mousedown(t,r){let n=r.posAtCoords({x:t.clientX,y:t.clientY});if(null!=n){let l=r.state.doc.lineAt(n);e(l.number,t)}}})]),...ew(t)]}return[]},[i]);return(0,n.jsx)(eg.Z,{value:f,theme:r,language:a,readonly:!0,extensions:m})}let eE=e=>{var t,r,a;let i=(0,s.useSearchParams)(),o=null!==(r=null===(t=i.get("q"))||void 0===t?void 0:t.toString())&&void 0!==r?r:"",c=l.useMemo(()=>{var t;let r=e.results;return null!==(t=null==r?void 0:r.map(e=>({...e,blob:e.lines.reduce((e,t)=>{var r;return e+(null!==(r=t.line.text)&&void 0!==r?r:"")},"")})))&&void 0!==t?t:[]},[e.results]),d=l.useMemo(()=>{let t=0;if(!e.results)return"0";for(let r of e.results){let e=r.lines.reduce((e,t)=>{let r=t.subMatches.length;return e+r},0);t+=Math.max(e,1)}let r=t<1e3?"0":"0.0a";return ed()(t).format(r)},[e.results]),u=eo().humanizer({units:["d","h","m","s"],spacer:"",maxDecimalPoints:2,language:"shortEn",languages:{shortEn:{m:()=>"m",s:()=>"s"}}})(null!==(a=e.requestDuration)&&void 0!==a?a:0);return(0,n.jsx)(n.Fragment,{children:e.loading?(0,n.jsx)(eR,{className:"mt-3"}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("h1",{className:"sticky top-0 z-20 bg-background pb-2 pt-1 font-semibold",children:[d," results in ",u]}),null==c?void 0:c.map((e,t)=>(0,n.jsx)("div",{children:(0,n.jsx)(eS,{result:e,query:o})},"".concat(e.path,"-").concat(t)))]})})};function eR(e){let{className:t}=e;return(0,n.jsxs)("div",{className:(0,b.cn)("flex flex-col gap-3",t),children:[(0,n.jsx)(eu.O,{className:"h-4 w-[20%]"}),(0,n.jsx)(eu.O,{className:"h-4 w-full"}),(0,n.jsx)(eu.O,{className:"h-8 w-full"})]})}let e_=e=>{let{className:t,error:r}=e,l=(0,n.jsx)(eP,{});switch(null==r?void 0:r.message){case M.l8.REPOSITORY_NOT_FOUND:l=(0,n.jsx)(eO,{});break;case M.l8.REPOSITORY_SYNC_FAILED:l=(0,n.jsx)(eF,{});break;case M.l8.INVALID_URL:l=(0,n.jsx)(eL,{});break;case M.l8.FAILED_TO_FETCH:l=(0,n.jsx)(eD,{})}return(0,n.jsx)("div",{className:(0,b.cn)("flex min-h-[30vh] items-center justify-center",t),children:(0,n.jsx)("div",{className:"flex flex-col items-center gap-4",children:l})})};function eO(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Repository not found"})]}),(0,n.jsxs)(eh(),{href:"/files",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Back to repositories"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}function eP(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Not found"})]}),(0,n.jsxs)(eh(),{href:"/files",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Back to repositories"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}function eF(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Repository is not cloned properly"})]}),(0,n.jsx)("div",{children:"The cloning of the repository has failed. Please verify your settings or attempt to retry the job."}),(0,n.jsxs)(eh(),{href:"/settings/providers/git",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Providers Configuration"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}function eL(){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Invalid URL"})]}),(0,n.jsxs)(eh(),{href:"/files",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Back to repositories"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}function eD(){return(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"Failed to fetch"})]})})}var eM=r(48537);let eT=e=>{let{className:t}=e,{currentFileRoutes:r,activeRepo:s,activeEntryInfo:a}=l.useContext(te),i=null==a?void 0:a.basename,o=l.useMemo(()=>{var e;let t=null==a?void 0:a.basename,r=[{name:null!==(e=null==a?void 0:a.repositoryName)&&void 0!==e?e:"",href:(0,M.I)(s,a.rev,"","dir")}];if(t){let e=decodeURIComponent(t).split("/")||[];for(let t=0;t{let r=0===t&&(null==o?void 0:o.length)>1,s=t===o.length-1,a=(0,b.cn)("whitespace-nowrap",r||s?"font-bold":"font-medium",s?"":"cursor-pointer text-primary hover:underline",r?"hover:underline":void 0);return(0,n.jsxs)(l.Fragment,{children:[s?(0,n.jsx)("div",{className:a,children:e.name}):(0,n.jsx)(eh(),{className:a,href:"/files/".concat(e.href),children:e.name}),!s&&(0,n.jsx)("div",{children:"/"})]},e.href)})]}),!!(null==r?void 0:r.length)&&!!i&&(0,n.jsx)(eM.q,{className:"shrink-0",value:i})]})};var eA=r(76297),eU=r(36327);let eZ=l.createContext({}),ez=e=>{let{onSelectTreeNode:t,children:r,activePath:l,fileMap:s,updateFileMap:a,expandedKeys:i,toggleExpandedKey:o,initialized:c,fileTreeData:d,fetchingTreeEntries:u}=e;return(0,n.jsx)(eZ.Provider,{value:{onSelectTreeNode:t,fileTreeData:d,expandedKeys:i,toggleExpandedKey:o,activePath:l,fileMap:s,updateFileMap:a,initialized:c,fetchingTreeEntries:u},children:r})},eY=e=>{let{level:t}=e,r=l.useMemo(()=>Array(t).fill(1),[t]);return(0,n.jsx)("div",{className:"flex h-full shrink-0 items-stretch",children:r.map((e,t)=>(0,n.jsx)("div",{className:"flex h-8 w-2 border-r border-transparent transition-colors duration-300 group-hover/filetree:border-border"},t))})},eq=()=>{let{ref:e,entry:t,inView:r}=(0,eA.YD)({trackVisibility:!0,delay:500});return l.useEffect(()=>{if((null==t?void 0:t.target)&&!r){var e;null==t||null===(e=t.target)||void 0===e||e.scrollIntoView({block:"center"})}},[null==t?void 0:t.target]),(0,n.jsx)("div",{ref:e,className:"absolute -left-2 h-8 w-1 rounded-md bg-primary"})},eV=e=>{let{isActive:t,level:r,children:l,className:s,...a}=e;return(0,n.jsxs)("div",{className:(0,b.cn)("relative flex h-8 cursor-pointer items-stretch rounded-sm hover:bg-accent focus:bg-accent focus:text-accent-foreground",t&&"bg-accent",s),...a,children:[t&&(0,n.jsx)(eq,{}),(0,n.jsx)(eY,{level:r}),(0,n.jsxs)("div",{className:"flex flex-nowrap items-center gap-2 truncate whitespace-nowrap",children:[(0,n.jsx)("div",{className:"h-4 w-4 shrink-0"}),l]})]})},eG=e=>{let{children:t,level:r,isActive:l,className:s,...a}=e;return(0,n.jsxs)("div",{className:(0,b.cn)("relative flex cursor-pointer items-stretch rounded-sm hover:bg-accent focus:bg-accent focus:text-accent-foreground",l?"bg-accent text-accent-foreground":void 0,s),...a,children:[l&&(0,n.jsx)(eq,{}),(0,n.jsx)(eY,{level:r}),(0,n.jsx)("div",{className:"flex flex-nowrap items-center gap-2 truncate whitespace-nowrap",children:t})]})},e$=e=>{let{node:t,level:r}=e,{activeEntryInfo:s}=l.useContext(te),{onSelectTreeNode:a}=l.useContext(eZ),i="file"===t.file.kind,o=t.fullPath===(null==s?void 0:s.basename);return(0,n.jsxs)(eV,{level:r,onClick:e=>{i&&(null==a||a(t))},isActive:o,children:[(0,n.jsx)(L.IconFile,{className:"shrink-0"}),(0,n.jsx)("div",{className:"truncate",children:null==t?void 0:t.name})]})},eH=e=>{var t,r,s;let{node:a,level:i,root:o}=e,{activeRepo:c,activeEntryInfo:d}=l.useContext(te),{fileMap:u,updateFileMap:f,expandedKeys:h,toggleExpandedKey:m,onSelectTreeNode:p}=l.useContext(eZ),v=l.useRef(!1),g=o?"":a.file.basename,b=h.has(g),j="dir"===a.file.kind&&!(null==u?void 0:null===(t=u[a.fullPath])||void 0===t?void 0:t.treeExpanded)&&b,{data:y,isLoading:N}=(0,eU.Z)(j?(0,M.Vq)(c,d.rev,g):null,x.Z,{revalidateIfStale:!1});l.useEffect(()=>{var e;if(!v.current&&(null==y?void 0:null===(e=y.entries)||void 0===e?void 0:e.length)){let e=y.entries.reduce((e,t)=>{let r=t.basename;return{...e,[r]:{file:t,name:(0,M.i3)(r),fullPath:r,treeExpanded:!1}}},{});f(e),v.current=!0}},[y]);let[w]=(0,et.n)(N,100),k=!!(null==a?void 0:null===(r=a.children)||void 0===r?void 0:r.length);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(eG,{level:i,onClick:e=>{null==p||p(a)},isActive:(null==d?void 0:d.basename)===a.fullPath,children:[(0,n.jsx)("div",{className:"flex h-8 shrink-0 items-center hover:bg-primary/10 hover:text-popover-foreground",onClick:e=>{w||(m(a.fullPath),e.stopPropagation())},children:w&&!v.current?(0,n.jsx)(L.IconSpinner,{}):b?(0,n.jsx)(L.IconChevronDown,{}):(0,n.jsx)(L.IconChevronRight,{})}),(0,n.jsx)("div",{className:"shrink-0",style:{color:"rgb(84, 174, 255)"},children:b?(0,n.jsx)(L.IconDirectoryExpandSolid,{}):(0,n.jsx)(L.IconDirectorySolid,{})}),(0,n.jsx)("div",{className:"truncate",children:null==a?void 0:a.name})]}),(0,n.jsx)(n.Fragment,{children:b&&k?(0,n.jsx)(n.Fragment,{children:null===(s=a.children)||void 0===s?void 0:s.map(e=>{let t=e.file.basename;return"dir"===e.file.kind?(0,n.jsx)(eH,{node:e,level:i+1},t):(0,n.jsx)(e$,{node:e,level:i+1},t)})}):null})]})},eW=()=>{let{repoMap:e,activeEntryInfo:t}=l.useContext(te),{initialized:r,fileTreeData:s,fetchingTreeEntries:a}=l.useContext(eZ),{repositorySpecifier:i}=t,o=!!i,c=o&&!(null==s?void 0:s.length);return r?o?c&&a?(0,n.jsx)(eK,{}):(0,n.jsx)(n.Fragment,{children:null==s?void 0:s.map(e=>{var t;let r=(null==e?void 0:null===(t=e.file)||void 0===t?void 0:t.kind)==="file";return r?(0,n.jsx)(e$,{level:0,node:e},e.fullPath):(0,n.jsx)(eH,{level:0,node:e},e.fullPath)})}):null:(0,n.jsx)(eK,{})},eB=e=>{let{className:t,...r}=e;return(0,n.jsx)("div",{className:(0,b.cn)("group/filetree",t),children:(0,n.jsx)(ez,{...r,children:(0,n.jsx)(eW,{})})})};function eK(){return(0,n.jsxs)("div",{className:"space-y-3 p-2",children:[(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{className:"ml-4"}),(0,n.jsx)(eu.O,{className:"ml-4"}),(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{className:"ml-4"})]})}var eJ=r(62940),eQ=r(36065),eX=r(84942),e0=r(54594),e1=r(18500);function e4(e){let{kind:t,fallback:r}=e;switch(t){case e1.vW.Git:case e1.vW.GitConfig:return(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}});case e1.vW.Github:case e1.vW.GithubSelfHosted:return(0,n.jsx)(L.IconGitHub,{});case e1.vW.Gitlab:case e1.vW.GitlabSelfHosted:return(0,n.jsx)(L.IconGitLab,{});default:return null!=r?r:null}}let e5=e=>{var t,r,s,a,i;let{className:o,...d}=e,{updateActivePath:u,initialized:f,activeRepo:h,activeRepoRef:m,fileMap:p,repoMap:x,activeEntryInfo:v}=(0,l.useContext)(te),g=l.useMemo(()=>(0,M.UR)(x).map(e=>{let t=(0,M.Pj)(e);return{repo:e,repoSpecifier:t}}),[x]),[j,y]=l.useState(!1),[N,w]=l.useState(null!==(s=null==m?void 0:m.kind)&&void 0!==s?s:"branch"),{repositoryKind:k,repositoryName:S,repositorySpecifier:I}=v,E=null==h?void 0:h.refs,R=l.useMemo(()=>(null==E?void 0:E.length)?E.map(e=>(0,M.r2)(e)):[],[E]),_=R.filter(e=>"branch"===e.kind),O=R.filter(e=>"tag"===e.kind),P=f&&!(null==g?void 0:g.length),D=e=>{var t,r,n,l,s;if((0,c.Z)(e))return;let a=null!==(l=null===(t=(0,M.r2)(e))||void 0===t?void 0:t.name)&&void 0!==l?l:"",{basename:i=""}=v,o=null!==(s=null==p?void 0:null===(n=p[i])||void 0===n?void 0:null===(r=n.file)||void 0===r?void 0:r.kind)&&void 0!==s?s:"dir";u((0,M.I)(h,a,i,o))};return(0,n.jsxs)("div",{className:(0,b.cn)(o),...d,children:[(0,n.jsx)("div",{className:"py-4 font-bold leading-8",children:(0,n.jsx)("span",{className:(0,b.cn)("py-1",{"hover:underline cursor-pointer":!!h}),onClick:()=>{h&&u((0,M.I)(h,null==v?void 0:v.rev,"","dir"))},children:"Files"})}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)(e0.Ph,{disabled:!f,onValueChange:e=>{var t;let r=null===(t=g.find(t=>t.repoSpecifier===e))||void 0===t?void 0:t.repo;if(r){let t="".concat(e,"/-/tree/").concat((0,M.r2)((0,M.s8)(r.refs)).name);u(t)}},value:I,children:[(0,n.jsx)(e0.i4,{children:(0,n.jsx)(e0.ki,{asChild:!0,children:(0,n.jsxs)("div",{className:"flex items-center gap-2 overflow-hidden",children:[(0,n.jsx)("div",{className:"shrink-0",children:(0,n.jsx)(e4,{kind:k,fallback:(0,n.jsx)(L.IconFolderGit,{})})}),(0,n.jsx)("span",{className:(0,b.cn)("truncate",!S&&"text-muted-foreground"),children:S||"Pick a repository"})]})})}),(0,n.jsx)(e0.Bw,{className:"max-h-[50vh] overflow-y-auto",children:P?(0,n.jsx)(e0.Ql,{isPlaceHolder:!0,value:"",disabled:!0,children:"No repositories"}):(0,n.jsx)(n.Fragment,{children:null==g?void 0:g.map(e=>(0,n.jsx)(e0.Ql,{value:e.repoSpecifier,children:(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsx)(e4,{kind:e.repo.kind,fallback:(0,n.jsx)(L.IconFolderGit,{})}),e.repo.name]})},e.repoSpecifier))})})]}),!!h&&(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(eX.J2,{open:j,onOpenChange:y,children:[(0,n.jsx)(eX.xo,{asChild:!0,children:(0,n.jsx)(F.z,{className:"w-full justify-start gap-2 px-3",variant:"outline",children:!!m&&(0,n.jsxs)(n.Fragment,{children:["tag"===m.kind?(0,n.jsx)(L.IconTag,{className:"shrink-0"}):(0,n.jsx)(L.IconGitFork,{className:"shrink-0"}),(0,n.jsx)("span",{className:"truncate",title:m.name,children:"commit"===m.kind?null===(r=m.ref)||void 0===r?void 0:null===(t=r.commit)||void 0===t?void 0:t.substring(0,7):m.name})]})})}),(0,n.jsx)(eX.yk,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",side:"bottom",sideOffset:-8,children:(0,n.jsxs)(eQ.mY,{children:[(0,n.jsx)(eQ.sZ,{placeholder:"tag"===N?"Find a tag":"Find a branch"}),(0,n.jsx)(C.mQ,{className:"my-1 border-b",value:N,onValueChange:e=>w(e),children:(0,n.jsxs)(C.dr,{className:"bg-popover py-0",children:[(0,n.jsx)(C.SP,{value:"branch",children:"Branches"}),(0,n.jsx)(C.SP,{value:"tag",children:"Tags"})]})}),(0,n.jsxs)(eQ.e8,{className:"max-h-[30vh]",children:[(0,n.jsx)(eQ.rb,{children:"Nothing to show"}),(0,n.jsx)(eQ.fu,{children:("tag"===N?O:_).map((e,t)=>{var r;return(0,n.jsxs)(eQ.di,{onSelect:()=>{y(!1),D(e.ref)},children:[(0,n.jsx)(L.IconCheck,{className:(0,b.cn)("mr-2 shrink-0",(null==e?void 0:e.name)&&e.name===(null==m?void 0:m.name)?"opacity-100":"opacity-0")}),(0,n.jsx)("span",{className:"truncate",title:e.name,children:null!==(a=e.name)&&void 0!==a?a:""})]},null!==(i=null==e?void 0:null===(r=e.ref)||void 0===r?void 0:r.name)&&void 0!==i?i:t)})})]})]})})]})})]})]})},e2=e=>{let{fetchingTreeEntries:t}=e,{activePath:r,updateActivePath:s,expandedKeys:a,updateFileMap:i,toggleExpandedKey:o,initialized:c,fileTreeData:d,fileMap:u,activeRepo:f,activeEntryInfo:h}=l.useContext(te),m=l.useRef(null),p=function(e,t){var r,n;let[s,a]=(0,l.useState)(null!==(n=null===(r=e.current)||void 0===r?void 0:r.scrollTop)&&void 0!==n?n:0);return(0,l.useEffect)(()=>{if(e.current){let r=(0,eJ.Z)(()=>{var t,r;a(null!==(r=null===(t=e.current)||void 0===t?void 0:t.scrollTop)&&void 0!==r?r:0)},t,{leading:!0}),n=e.current;return n.addEventListener("scroll",r),()=>{n.removeEventListener("scroll",r)}}},[e,t]),s}(m,200);return(0,n.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,n.jsx)(e5,{className:"shrink-0 px-4 pb-3"}),p>0&&(0,n.jsx)("div",{className:"h-0 border-b shadow-[0px_3px_8px_rgba(0,0,0,0.3)] dark:shadow-[0px_3px_8px_rgba(255,255,255,0.3)]"}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto px-4",ref:m,children:(0,n.jsx)(eB,{onSelectTreeNode:e=>{let t=(0,M.I)(f,h.rev,e.file.basename,e.file.kind);s(t)},activePath:r,fileMap:u,updateFileMap:i,expandedKeys:a,toggleExpandedKey:o,initialized:c,fileTreeData:d,fetchingTreeEntries:t})})]})};var e3=r(2899),e8=r(99047);let e6=e=>{var t,r;let{className:s,loading:a,initialized:i}=e,{activePath:c,currentFileRoutes:d,fileTreeData:u,activeRepo:f,repoMap:h,activeEntryInfo:m}=l.useContext(te),p=l.useMemo(()=>(0,o.Z)(h)||f?function(e,t){if(!(null==e?void 0:e.length))return[];if(t){let{basename:r=""}=(0,M.Jt)(t);if(!r)return e;let n=decodeURIComponent(r).split("/"),l=e;for(let e=0;ee.fullPath===t);if(null==r||!r.children)return[];l=null==r?void 0:r.children}return(null==l?void 0:l.map(e=>(0,e3.Z)(e,"children")))||[]}{let t=e.map(e=>(0,e3.Z)(e,"children"))||[];return t}}(u,c):(0,M.UR)(h).map(e=>{var t;return{file:{basename:e.name,kind:"dir"},isRepository:!0,repository:e,fullPath:(0,M.I)(e,null===(t=(0,M.r2)((0,M.s8)(e.refs)))||void 0===t?void 0:t.name,"","dir"),name:e.name}}),[u,c,f,h]),[x]=(0,et.n)(a,300),v=!!(null==m?void 0:m.basename),g=d[(null==d?void 0:d.length)-2];return(0,n.jsx)("div",{className:(0,b.cn)("text-base",s),children:(!x||(null==p?void 0:p.length))&&i?(null==p?void 0:p.length)?(0,n.jsx)(e8.iA,{children:(0,n.jsxs)(e8.RM,{children:[v&&(0,n.jsx)(e8.SC,{className:"cursor-pointer",children:(0,n.jsx)(e8.pj,{className:"p-1 px-4",children:(0,n.jsx)(eh(),{href:"/files/".concat((0,M.I)(f,m.rev,null==g?void 0:null===(t=g.file)||void 0===t?void 0:t.basename,null==g?void 0:null===(r=g.file)||void 0===r?void 0:r.kind)),children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"shrink-0",children:(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}})}),(0,n.jsx)("span",{className:"px-1 py-2",children:".."})]})})})}),(0,n.jsx)(n.Fragment,{children:p.map(e=>{var t;let r=e.isRepository,l=null===(t=e.repository)||void 0===t?void 0:t.kind;return(0,n.jsx)(e8.SC,{children:(0,n.jsx)(e8.pj,{className:"p-1 px-4 text-base",children:(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)("div",{className:"shrink-0",children:r?(0,n.jsx)(e4,{kind:l,fallback:(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}})}):"dir"===e.file.kind?(0,n.jsx)(L.IconDirectorySolid,{style:{color:"rgb(84, 174, 255)"}}):(0,n.jsx)(L.IconFile,{})}),(0,n.jsx)(eh(),{href:r?"/files/".concat(e.fullPath):"/files/".concat((0,M.I)(null!=f?f:e.repository,m.rev,e.file.basename,e.file.kind)),className:"cursor-pointer px-1 py-2 hover:text-primary hover:underline",children:e.name})]})})},e.fullPath)})})]})}):(0,o.Z)(h)?(0,n.jsx)("div",{className:"flex min-h-[30vh] items-center justify-center",children:(0,n.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[(0,n.jsx)(L.IconFileSearch,{className:"h-6 w-6"}),(0,n.jsx)("div",{className:"text-xl font-semibold",children:"No repositories"})]}),(0,n.jsxs)(eh(),{href:"/settings/providers/git",className:(0,b.cn)((0,F.d)(),"gap-2"),children:[(0,n.jsx)("span",{children:"Connect"}),(0,n.jsx)(L.IconArrowRight,{})]})]})}):null:(0,n.jsx)(e9,{})})};function e9(){return(0,n.jsxs)("ul",{className:"space-y-3 p-2",children:[(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{}),(0,n.jsx)(eu.O,{})]})}let e7=(0,f.BX)("\n query RepositoryGrep(\n $id: ID!\n $kind: RepositoryKind!\n $rev: String\n $query: String!\n ) {\n repositoryGrep(kind: $kind, id: $id, rev: $rev, query: $query) {\n files {\n path\n lines {\n line {\n text\n base64\n }\n byteOffset\n lineNumber\n subMatches {\n bytesStart\n bytesEnd\n }\n }\n }\n elapsedMs\n }\n }\n"),te=l.createContext({}),tt=e=>{var t;let{children:r}=e,a=(0,s.usePathname)(),{updateUrlComponents:o,searchParams:c}=(0,h.Z)(),d=null===(t=c.get("redirect_git_url"))||void 0===t?void 0:t.toString(),[u,f]=l.useState(!1),[p,x]=l.useState(),v=l.useMemo(()=>(0,M.Jt)(p),[p]),g=(0,m.xG)(),[b,j]=l.useState(!1),[y,N]=l.useState({}),[w,k]=l.useState({}),[S,C]=l.useState(new Set),[I,E]=l.useState(!1),[R,_]=l.useState(),[O,P]=(0,l.useState)(),F=l.useRef(),L=l.useCallback(async(e,t)=>{let r=null==t?void 0:t.replace;if(e){let n={},l=["redirect_filepath","redirect_git_url","line"];(null==t?void 0:t.plain)?n.plain="1":l.push("plain"),o({pathname:"/files/".concat(e),searchParams:{set:n,del:l},replace:r,hash:null==t?void 0:t.hash})}else o({pathname:"/files",searchParams:{del:["path","plain","line"]},hash:null==t?void 0:t.hash,replace:r})},[]),D=l.useMemo(()=>(function e(t){if(!t.length)return[];for(let r of(t.sort((e,t)=>{let r="file"===e.file.kind?1:0,n="file"===t.file.kind?1:0;return r-n||e.name.localeCompare(t.name)}),t))(null==r?void 0:r.children)&&e(r.children);return t})(function(e){let t=[];if(!e)return t;let r=Object.keys(e);for(let n of r){let r=e[n],l=n.split("/"),s=t;for(let e=0;ee.fullPath===t);if(a)s=a.children||[];else{let e={file:r.file,name:r.name,fullPath:n,children:[],isRepository:r.isRepository,repository:r.repository};s.push(e),s=e.children}}}return t}(y)),[y]),T=l.useMemo(()=>{let{repositoryKind:e,repositoryName:t,repositorySpecifier:r}=v;if(e&&t)return r?w[r]:void 0},[w,v]),A=l.useMemo(()=>{var e,t;if(!v||!T)return;let r=null!==(t=null==v?void 0:v.rev)&&void 0!==t?t:"",n=null===(e=T.refs)||void 0===e?void 0:e.find(e=>(null==e?void 0:e.name)==="refs/heads/".concat(r)||(null==e?void 0:e.name)==="refs/tags/".concat(r)||(null==e?void 0:e.commit)===r);if(n){let e;return n.name==="refs/heads/".concat(r)?e="branch":n.name==="refs/tags/".concat(r)?e="tag":n.commit===r&&(e="commit"),(0,M.r2)(n,e)}},[v,T]),U=l.useMemo(()=>{var e;if(!p)return[];let{basename:t=""}=v,r=[{file:{kind:"dir",basename:""},isRepository:!0,repository:T,name:null!==(e=null==T?void 0:T.name)&&void 0!==e?e:"",fullPath:""}],n=(null==t?void 0:t.split("/"))||[];for(let e=0;e{var e;let t=null===(e=a.match(/^\/files\/(.*)/))||void 0===e?void 0:e[1];F.current=p,x(null!=t?t:""),u||f(!0),O&&P(void 0)},[a,d]),(0,n.jsx)(te.Provider,{value:{initialized:b,setInitialized:j,activePath:p,updateActivePath:L,fileMap:y,updateFileMap:(e,t)=>{e&&(t?N(e):N(t=>({...t,...e})))},expandedKeys:S,setExpandedKeys:C,toggleExpandedKey:e=>{let t=S.has(e),r=new Set(S);t?r.delete(e):r.add(e),C(r)},currentFileRoutes:U,fileTreeData:D,chatSideBarVisible:I,setChatSideBarVisible:E,pendingEvent:R,setPendingEvent:_,isChatEnabled:g,repoMap:w,setRepoMap:k,activeRepo:T,activeRepoRef:A,isPathInitialized:u,activeEntryInfo:v,prevActivePath:F,error:O,setError:P},children:r})},tr="application/vnd.directory+json",tn=e=>{var t;let{className:r}=e,{activePath:s,updateActivePath:a,initialized:i,setInitialized:f,chatSideBarVisible:m,setChatSideBarVisible:v,setPendingEvent:g,repoMap:N,setRepoMap:C,activeRepo:I,isPathInitialized:E,activeEntryInfo:R,prevActivePath:_,updateFileMap:O,setExpandedKeys:P,error:F,setError:L}=l.useContext(te),{searchParams:D}=(0,h.Z)(),T=l.useRef(!1),{progress:A,setProgress:U}=(0,k.U)(),Z=l.useRef(null),[z,Y]=l.useState(35),q=null===(t=D.get("q"))||void 0===t?void 0:t.toString(),G=l.useMemo(()=>(0,M.Jt)(s),[s]),$=null==G?void 0:G.basename,H=(null==R?void 0:R.viewMode)==="blob",W=(null==R?void 0:R.viewMode)==="search",B=!!i&&!(0,o.Z)(N)&&!!s&&!W,J=!!i&&!(0,o.Z)(N)&&!!s&&W,Q=!!i&&H&&I,{data:X,isLoading:ee,error:et}=(0,u.ZP)(B?s:null,e=>{let{repositorySpecifier:t}=(0,M.Jt)(e);return ti(e,t?null==N?void 0:N[t]:void 0).then(t=>({entries:t,requestPathname:e}))},{revalidateOnFocus:!1,shouldRetryOnError:!1}),{data:er,isLoading:en,error:es}=(0,u.ZP)(Q?[(0,M.Vq)(I,R.rev,$),$]:null,e=>{let[t,r]=e;return(0,x.Z)(t,{responseFormatter:async e=>{let t=e.headers.get("Content-Type");if(t===tr)throw Error(M.l8.INVALID_URL);let n=(0,d.Z)(e.headers.get("Content-Length")),l=await e.blob(),s=await ta(null!=r?r:"",l);return{contentLength:n,blob:l,fileDisplayType:s}},errorHandler(){throw Error(M.l8.NOT_FOUND)}})},{revalidateOnFocus:!1,shouldRetryOnError:!1}),{data:ea,isLoading:ei,error:eo}=(0,u.ZP)(J&&q?[s,q]:null,e=>{let[t,r]=e,{repositorySpecifier:n}=(0,M.Jt)(t);return to(r,n?null==N?void 0:N[n]:void 0,R.rev)},{revalidateOnFocus:!1,shouldRetryOnError:!1}),ec=null==er?void 0:er.blob,ed=null==er?void 0:er.contentLength,eu=null==er?void 0:er.fileDisplayType,ef=F||es||et,eh=(null==R?void 0:R.viewMode)==="tree"||!(null==R?void 0:R.viewMode);return l.useEffect(()=>{let e=async()=>{if(T.current)return;T.current=!0;let e=await ts(),t=D.get("redirect_filepath"),r=D.get("redirect_git_url");if((null==e?void 0:e.length)&&t&&r){let i=e.find(e=>e.gitUrl===r);if(i){var n,l,s;let e=(0,M.s8)(i.refs),r=(null===(n=(0,M.r2)(e))||void 0===n?void 0:n.name)||"",o=(0,M.kQ)(window.location.hash),d=!(0,c.Z)(null==o?void 0:o.start),u=parseInt(null!==(s=null===(l=D.get("line"))||void 0===l?void 0:l.toString())&&void 0!==s?s:""),f=d?window.location.hash:(0,b.nO)({start:u}),h=t?(0,p.U$)(t)[0]:void 0;a((0,M.I)(i,r,t,"file"),{replace:!0,hash:f,plain:"markdown"===h&&!!f}),T.current=!1;return}L(Error(M.l8.REPOSITORY_NOT_FOUND))}e&&C((0,M.fr)(e)),f(!0)};!i&&E&&e()},[s,i,E]),l.useEffect(()=>{if(!X)return;let{entries:e,requestPathname:t}=X,{repositorySpecifier:r,viewMode:n,basename:l,rev:s}=(0,M.Jt)(t),{repositorySpecifier:a,rev:i}=(0,M.Jt)(_.current),o=(0,M.yH)(l,"tree"===n),c={};if(e.length)for(let t of e){let e=t.basename;c[e]={file:t,name:(0,M.i3)(e),fullPath:e,treeExpanded:o.includes(t.basename)}}let d=o.filter(Boolean),u=r!==a||s!==i;c&&O(c,u),(null==d?void 0:d.length)&&(u?P(new Set(d)):P(e=>{let t=new Set(e);for(let e of d)t.add(e);return t}))},[X]),l.useEffect(()=>{!i||(!A&&(en||ee)?U(!0):en||ee||U(!1))},[en,ee]),l.useEffect(()=>{var e,t,r;m?(null===(e=Z.current)||void 0===e||e.expand(),null===(t=Z.current)||void 0===t||t.resize(z)):null===(r=Z.current)||void 0===r||r.collapse()},[m]),l.useEffect(()=>{if(!(en||ee))return;let{repositorySpecifier:e,rev:t}=R,{repositorySpecifier:r,rev:n}=(0,M.Jt)(_.current);(e!==r||t!==n)&&(O({},!0),P(new Set))},[R]),l.useEffect(()=>{let e=e=>{v(!0),g(e)};return S.u.on("code_browser_quick_action",e),()=>{S.u.off("code_browser_quick_action",e)}},[]),(0,n.jsxs)(j.pO,{direction:"horizontal",className:(0,b.cn)(r),onLayout:e=>{(null==e?void 0:e[2])&&Y(e[2])},children:[(0,n.jsx)(j.ee,{defaultSize:20,minSize:20,maxSize:40,className:"hidden lg:block",children:(0,n.jsx)(e2,{fetchingTreeEntries:ee})}),(0,n.jsx)(j.Dp,{className:"hidden w-1 bg-border/40 hover:bg-border active:bg-blue-500 lg:block"}),(0,n.jsx)(j.ee,{defaultSize:80,minSize:30,children:(0,n.jsxs)("div",{className:"mb-4 flex h-full flex-col",children:[(0,n.jsx)(el,{className:(0,b.cn)("z-40",(null==R?void 0:R.repositorySpecifier)?"block":"hidden")}),(eh||H)&&(0,n.jsx)(eT,{className:(0,b.cn)("px-4 pb-4",{"pt-4":!(null==R?void 0:R.repositorySpecifier)})}),(0,n.jsx)(y.ScrollArea,{children:(0,n.jsx)("div",{className:"flex h-full flex-col px-4 pb-4",children:i?ef?(0,n.jsx)(e_,{className:"rounded-lg border p-4",error:ef}):(0,n.jsxs)(n.Fragment,{children:[eh&&(0,n.jsx)(e6,{loading:ee,initialized:i,className:"rounded-lg border"}),H&&(0,n.jsx)(V,{blob:ec,contentLength:ed,fileDisplayType:eu,loading:en||ee}),W&&(0,n.jsx)(eE,{results:null==ea?void 0:ea.files,requestDuration:null==ea?void 0:ea.elapsedMs,loading:ei})]}):(0,n.jsx)(w.cg,{className:"rounded-lg border p-4"})})})]})}),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(j.Dp,{className:(0,b.cn)("hidden w-1 bg-border/40 hover:bg-border active:bg-blue-500",m&&"block")}),(0,n.jsx)(j.ee,{collapsible:!0,collapsedSize:0,defaultSize:0,minSize:25,ref:Z,onCollapse:()=>v(!1),children:(0,n.jsx)(K,{})})]})]})},tl=e=>{let[t]=(0,N.Hb)(),r=t?{height:"calc(100vh - ".concat(N.wt,")")}:{height:"100vh"};return(0,n.jsx)(tt,{children:(0,n.jsx)("div",{className:"transition-all",style:r,children:(0,n.jsx)(tn,{className:"source-code-browser",...e})})})};async function ts(){let e=v.Lp.createRequestOperation("query",(0,a.h)(g.zz,{}));return v.Lp.executeQuery(e).then(e=>{var t;return(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.repositoryList)||[]})}async function ta(e,t){var r;if(!t)return;let n=null==t?void 0:t.type,l=null===(r=(0,p.U$)(e))||void 0===r?void 0:r[0];if(null==n?void 0:n.startsWith("image"))return"image";if(l||(null==n?void 0:n.startsWith("text")))return"text";let s=await new Promise((e,r)=>{let n=t.slice(0,1024),l=new FileReader;l.onloadend=function(t){var r;if((null==t?void 0:null===(r=t.target)||void 0===r?void 0:r.readyState)===FileReader.DONE){let r=t.target.result;"string"!=typeof r?e(!1):/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x9F]/.test(r)?e(!1):e(!0)}},l.onerror=function(){e(!1)},l.readAsText(n,"UTF-8")});return s?"text":"raw"}async function ti(e,t){if(!e)return[];if(!t)throw Error(M.l8.REPOSITORY_NOT_FOUND);if((0,o.Z)(t.refs))throw Error(M.l8.REPOSITORY_SYNC_FAILED);let{basename:r,rev:n,viewMode:l}=(0,M.Jt)(e);if(!n||!l)throw Error(M.l8.INVALID_URL);let s=(0,M.yH)(r,"tree"===l),a=s.map(e=>()=>(0,x.Z)((0,M.Vq)(t,n,e),{responseFormatter(e){let t=e.headers.get("Content-Type");if(t!==tr)throw Error(M.l8.INVALID_URL);return e.json()},errorHandler(){throw Error(M.l8.NOT_FOUND)}})),i=await Promise.all(a.map(e=>e())),c=[];for(let e of i){var d;(null==e?void 0:null===(d=e.entries)||void 0===d?void 0:d.length)&&(c=[...c,...e.entries])}return c}async function to(e,t,r){if(!t)throw Error(M.l8.REPOSITORY_NOT_FOUND);let n=v.Lp.query(e7,{id:t.id,kind:t.kind,query:e,rev:r,pause:!t}).toPromise();return null==n?void 0:n.then(e=>{var t;if(null==e?void 0:e.error)throw Error(M.l8.FAILED_TO_FETCH);return null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.repositoryGrep})}},48048:function(e,t,r){"use strict";r.d(t,{BX:function(){return y},I:function(){return N},Jt:function(){return f},Pj:function(){return p},UR:function(){return v},Vq:function(){return w},fr:function(){return x},i3:function(){return h},kQ:function(){return k},l8:function(){return l},p4:function(){return S},r2:function(){return b},s8:function(){return j},yH:function(){return m}});var n,l,s=r(74630),a=r(5035),i=r(64220),o=r(13420),c=r(18500);(n=l||(l={})).FAILED_TO_FETCH="FAILED_TO_FETCH",n.INVALID_URL="INVALID_URL",n.NOT_FOUND="NOT_FOUND",n.REPOSITORY_NOT_FOUND="REPOSITORY_NOT_FOUND",n.REPOSITORY_SYNC_FAILED="REPOSITORY_SYNC_FAILED";let d=Object.keys(c.vW).map(e=>u(e));function u(e){return e.toLowerCase().replaceAll("_","")}function f(e){let t,r,n;let l={};if(!e)return l;let a=e.indexOf("/-/"),i=e.split("/"),u=i[0],f=d.includes(u);if(!f||-1===a)return l;let h=c.vW.Git;switch(u){case"git":h=c.vW.Git;break;case"github":h=c.vW.Github;break;case"gitlab":h=c.vW.Gitlab;break;case"githubselfhosted":h=c.vW.GithubSelfHosted;break;case"gitlabselfhosted":h=c.vW.GitlabSelfHosted;case"gitconfig":h=c.vW.GitConfig}let m=e.indexOf("/-/tree/"),p=e.indexOf("/-/blob/"),x=e.indexOf("/-/search/");if(m>-1){r="tree";let l=e.slice(m+8),s=l.split("/");n=s[0],t=(0,o.Z)(s.slice(1).join("/"),"/")}if(p>-1){r="blob";let l=e.slice(p+8),s=l.split("/");n=s[0],t=(0,o.Z)(s.slice(1).join("/"),"/")}if(x>-1){r="search";let l=e.slice(x+10),s=l.split("/");n=s[0],t=""}let v=e.split("/-/")[0],g=v.split("/").slice(1).join("/");return{repositorySpecifier:e.split("/-/")[0],repositoryName:g,repositoryKind:h,rev:(0,s.Z)(n)?void 0:decodeURIComponent(n),viewMode:r,basename:(0,s.Z)(t)?void 0:decodeURIComponent(t)}}function h(e){if(!e)return"";let t=e.split("/");return t[t.length-1]}function m(e,t){if((0,s.Z)(e))return[];let r=[""],n=e.split("/"),l=t?n.length:n.length-1;for(let e=0;e"".concat(u(e.kind),"/").concat(e.name))}function v(e){let t=(0,i.Z)(e,e=>e);return t.sort((e,t)=>e.name.localeCompare(t.name)),t}function g(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}function b(e,t){if(!e)return{name:"",ref:void 0};let r=e.name.match(/refs\/(\w+)\/(.*)/);if(r){let n="tags"===r[1]?"tag":"branch";return{kind:null!=t?t:n,name:r[2],ref:e}}return"commit"===t?{kind:t,name:e.commit,ref:e}:{name:"",ref:e}}function j(e){let t,r,n,l;for(let s of e){let{name:e}=s;"refs/heads/main"===e?t=s:"refs/heads/master"===e?r=s:!n&&e.startsWith("refs/heads/")?n=s:!l&&e.startsWith("refs/tags/")&&(l=s)}return t||r||n||l}function y(e){return"blob"===e?"file":"dir"}function N(e,t,r,n){let l=p(e);return"".concat(l,"/-/").concat("search"===n?"search":"file"===n?"blob":"tree","/").concat(encodeURIComponent(null!=t?t:""),"/").concat(g(null!=r?r:""))}function w(e,t,r){let n=null==e?void 0:e.id,l=null==e?void 0:e.kind;if(!n||!l||!t)return null;let s="".concat(u(l),"/").concat(n);return"/repositories/".concat(s,"/rev/").concat(encodeURIComponent(t),"/").concat(g(null!=r?r:""))}function k(e){if(!e)return null;let t=/^#L(\d+)(?:-L(\d+))?/.exec(e);if(!t)return null;let[,r,n]=t,l=parseInt(r),s=parseInt(n);return{start:Number.isNaN(l)?void 0:l,end:Number.isNaN(s)?void 0:s}}function S(e){var t;return(null===(t=k(e))||void 0===t?void 0:t.start)!==void 0}},27064:function(e,t,r){"use strict";r.d(t,{u:function(){return l}});var n=r(18366);let l=(0,n.Z)()},85312:function(e,t,r){"use strict";r.d(t,{Z:function(){return v}});var n=r(36164),l=r(3546),s=r(30352),a=r(94559),i=r(14679),o=r(88105),c=r(99641),d=r(21399),u=r(1853),f=r(49776);let h=[(0,o.AE)(),(0,f.sW)(),a.yy.allowMultipleSelections.of(!0),(0,s.nF)(s.R_,{fallback:!0}),(0,o.Zs)()];r(65001);var m=r(1544);let p=a.q6.define(),x=l.forwardRef((e,t)=>{let{value:r,theme:f,language:x,readonly:v=!0,extensions:g,height:b=null,width:j=null,viewDidUpdate:y,className:N}=e,w=l.useRef(!1),k=l.useRef(null),[S,C]=l.useState(null),I=o.tk.theme({"&":{height:b,width:j,outline:"none !important",background:"hsl(var(--background))"},"&.cm-focused":{outline:"none !important"},"& .cm-scroller":{height:"100% !important",outline:"none"},"& .cm-gutters":{background:"hsl(var(--background))"},"&.cm-focused .cm-selectionLayer .cm-selectionBackground":{backgroundColor:"hsl(var(--cm-selection-bg)) !important"},".cm-selectionLayer .cm-selectionBackground":{backgroundColor:"hsl(var(--cm-selection-bg)) !important"}}),E=[I,h,o.tk.baseTheme({".cm-line":{lineHeight:"20px"},".cm-scroller":{fontSize:"14px"},".cm-gutters":{backgroundColor:"transparent",borderRight:"none"}}),a.yy.readOnly.of(v)],R=e=>"graphql"===e?new s.ri(d.Wf):(0,c.vf)(function(e,t){switch(e){case"javascript-typescript":return"tsx";case"shellscript":case"bash":return"shell";default:return e}}(e)),_=()=>{let e=(0,u.Z)([...E,R(x)]);return"dark"===f?(e.push(i.pD),e.push((0,s.nF)(i.VE))):e.push((0,s.nF)(s.R_)),Array.isArray(g)&&(e=e.concat(g)),e};return l.useEffect(()=>{(()=>{if(!w.current&&k.current){w.current=!0;let e=a.yy.create({doc:r,extensions:_()}),t=new o.tk({state:e,parent:k.current});C(t)}})()},[]),l.useEffect(()=>{S&&S.dispatch({effects:a.Py.reconfigure.of(_())})},[b,j,f,x,g]),l.useEffect(()=>{(()=>{if(void 0===r||!S)return;let e=S?S.state.doc.toString():"";S&&r!==e&&S.dispatch({changes:{from:0,to:e.length,insert:r||""},annotations:[p.of(!0)]})})()},[r]),l.useEffect(()=>()=>{S&&(S.destroy(),C(null))},[]),l.useEffect(()=>{null==y||y(S)},[S]),l.useImperativeHandle(t,()=>({getView:()=>S}),[S]),(0,n.jsx)("div",{className:(0,m.cn)("codemirror-editor h-full",N),ref:k})});x.displayName="CodeMirrorEditor";var v=x},30601:function(e,t,r){"use strict";r.d(t,{Hb:function(){return h},wt:function(){return d},xc:function(){return m},yo:function(){return f}});var n=r(36164),l=r(3546),s=r(74630),a=r(36327),i=r(80605),o=r(1544),c=r(81565);let d="3.5rem",u=l.createContext({}),f=e=>{let{children:t}=e,r=(0,i.UA)(),[a,o]=l.useState(!1);return l.useEffect(()=>{let e=window.self!==window.top;e||(0,s.Z)(r)||o(r)},[r]),(0,n.jsx)(u.Provider,{value:{isShowDemoBanner:a,setIsShowDemoBanner:o},children:t})};function h(){let{isShowDemoBanner:e,setIsShowDemoBanner:t}=l.useContext(u);return[e,t]}function m(){let[e,t]=h(),{data:r}=(0,a.Z)("https://api.github.com/repos/TabbyML/tabby",e=>fetch(e).then(e=>e.json()));return(0,n.jsxs)("div",{className:(0,o.cn)("flex items-center justify-between bg-primary px-4 text-primary-foreground transition-[opacity,height] md:px-5",{"opacity-100 pointer-events-auto":e,"opacity-0 pointer-events-none":!e}),style:e?{height:d}:{height:0},children:[(0,n.jsxs)("a",{href:"https://links.tabbyml.com/schedule-a-demo",target:"_blank",className:"flex items-center gap-x-2 text-xs font-semibold underline md:text-sm",children:[(0,n.jsx)("span",{children:"\uD83D\uDCC6"}),(0,n.jsx)("span",{children:"Book a 30-minute product demo."})]}),e&&(0,n.jsx)("img",{referrerPolicy:"no-referrer-when-downgrade",src:"https://static.scarf.sh/a.png?x-pxid=b1d0308a-b3c5-425a-972a-378d883a2bca"}),(0,n.jsxs)("div",{className:"flex items-center gap-x-4 md:gap-x-8",children:[(0,n.jsxs)("a",{href:"https://github.com/TabbyML/tabby",target:"_blank",className:"flex items-center transition-all hover:opacity-70",children:[(0,n.jsx)(c.IconGithub,{}),(0,n.jsxs)("div",{className:"ml-2 hidden md:block",children:[(0,n.jsx)("p",{className:"text-xs font-semibold",children:"TabbyML/tabby"}),(0,n.jsxs)("div",{className:(0,o.cn)("flex items-center text-xs transition-all",{"h-4 opacity-70":r,"h-0 opacity-0":!r}),children:[(0,n.jsx)(c.IconStar,{className:"mr-1 h-2.5 w-2.5"}),(0,n.jsx)("span",{children:null==r?void 0:r.stargazers_count}),(0,n.jsx)(c.IconGitFork,{className:"ml-2 mr-1 h-2.5 w-2.5"}),(0,n.jsx)("span",{children:null==r?void 0:r.forks_count})]})]})]}),(0,n.jsx)(c.IconClose,{className:"cursor-pointer transition-all hover:opacity-70",onClick:()=>t(!1)})]})]})}},38736:function(e,t,r){"use strict";r.d(t,{J:function(){return u},U:function(){return f}});var n=r(36164),l=r(3546),s=r(7062),a=r.n(s),i=r(9010),o=r(24449),c=r(16784);let d=l.createContext({}),u=e=>{let{children:t}=e,{theme:r}=(0,i.X)(),[s,u]=l.useState(!1),[f]=(0,o.n)(s,200,{leading:!0}),h=(0,c.d)(s);l.useEffect(()=>{a().config({barColors:{0:"dark"===r?"#DC981A":"#B7942B"}})},[]);let m=l.useCallback(e=>{e&&e===h.current||u(e)},[]);return(0,n.jsxs)(d.Provider,{value:{progress:f,setProgress:m},children:[f&&(0,n.jsx)(a(),{}),t]})},f=()=>l.useContext(d)},36065:function(e,t,r){"use strict";r.d(t,{di:function(){return m},e8:function(){return d},fu:function(){return f},mY:function(){return o},rb:function(){return u},sZ:function(){return c},zz:function(){return h}});var n=r(36164),l=r(3546),s=r(53241),a=r(93170),i=r(1544);r(30220);let o=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY,{ref:t,className:(0,i.cn)("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",r),...l})});o.displayName=s.mY.displayName;let c=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsxs)("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[(0,n.jsx)(a.Z,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,n.jsx)(s.mY.Input,{ref:t,className:(0,i.cn)("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",r),...l})]})});c.displayName=s.mY.Input.displayName;let d=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY.List,{ref:t,className:(0,i.cn)("max-h-[300px] overflow-y-auto overflow-x-hidden",r),...l})});d.displayName=s.mY.List.displayName;let u=l.forwardRef((e,t)=>(0,n.jsx)(s.mY.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));u.displayName=s.mY.Empty.displayName;let f=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY.Group,{ref:t,className:(0,i.cn)("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",r),...l})});f.displayName=s.mY.Group.displayName;let h=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY.Separator,{ref:t,className:(0,i.cn)("-mx-1 h-px bg-border",r),...l})});h.displayName=s.mY.Separator.displayName;let m=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.mY.Item,{ref:t,className:(0,i.cn)("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-accent aria-selected:text-accent-foreground",r),...l})});m.displayName=s.mY.Item.displayName},30220:function(e,t,r){"use strict";r.d(t,{$N:function(){return p},Be:function(){return x},Vq:function(){return o},cN:function(){return m},cZ:function(){return f},fK:function(){return h},hg:function(){return c}});var n=r(36164),l=r(3546),s=r(4318),a=r(1663),i=r(1544);let o=s.fC,c=s.xz,d=s.h_;s.x8;let u=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.aV,{ref:t,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...l})});u.displayName=s.aV.displayName;let f=l.forwardRef((e,t)=>{let{className:r,children:l,...o}=e;return(0,n.jsxs)(d,{children:[(0,n.jsx)(u,{}),(0,n.jsxs)(s.VY,{ref:t,className:(0,i.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...o,children:[l,(0,n.jsxs)(s.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,n.jsx)(a.Z,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});f.displayName=s.VY.displayName;let h=e=>{let{className:t,...r}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...r})};h.displayName="DialogHeader";let m=e=>{let{className:t,...r}=e;return(0,n.jsx)("div",{className:(0,i.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...r})};m.displayName="DialogFooter";let p=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.Dx,{ref:t,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",r),...l})});p.displayName=s.Dx.displayName;let x=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.dk,{ref:t,className:(0,i.cn)("text-sm text-muted-foreground",r),...l})});x.displayName=s.dk.displayName},53538:function(e,t,r){"use strict";r.d(t,{Dp:function(){return o},ee:function(){return i},pO:function(){return a}});var n=r(36164),l=r(6618),s=r(1544);let a=e=>{let{className:t,...r}=e;return(0,n.jsx)(l.eh,{className:(0,s.cn)("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",t),...r})},i=l.s_,o=e=>{let{withHandle:t,className:r,...a}=e;return(0,n.jsx)(l.OT,{className:(0,s.cn)("border-bg relative flex w-px items-center justify-center bg-border after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",r),...a,children:t&&(0,n.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-border"})})}},57830:function(e,t,r){"use strict";r.r(t),r.d(t,{ScrollArea:function(){return i},ScrollBar:function(){return o}});var n=r(36164),l=r(3546),s=r(50778),a=r(1544);let i=l.forwardRef((e,t)=>{let{className:r,children:l,...i}=e;return(0,n.jsxs)(s.fC,{className:(0,a.cn)("relative overflow-hidden",r),...i,children:[(0,n.jsx)(s.l_,{ref:t,className:"h-full w-full rounded-[inherit] [&>div]:!block",children:l}),(0,n.jsx)(o,{}),(0,n.jsx)(s.Ns,{})]})});i.displayName=s.fC.displayName;let o=l.forwardRef((e,t)=>{let{className:r,orientation:l="vertical",...i}=e;return(0,n.jsx)(s.gb,{ref:t,orientation:l,className:(0,a.cn)("flex touch-none select-none transition-colors","vertical"===l&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===l&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",r),...i,children:(0,n.jsx)(s.q4,{className:"relative flex-1 rounded-full bg-border"})})});o.displayName=s.gb.displayName},54594:function(e,t,r){"use strict";r.d(t,{Bw:function(){return f},DI:function(){return c},Ph:function(){return o},Ql:function(){return m},U$:function(){return p},i4:function(){return u},ki:function(){return d}});var n=r(36164),l=r(3546),s=r(31889),a=r(1544),i=r(81565);let o=s.fC,c=s.ZA,d=s.B4,u=l.forwardRef((e,t)=>{let{className:r,children:l,...o}=e;return(0,n.jsxs)(s.xz,{ref:t,className:(0,a.cn)("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",r),...o,children:[l,(0,n.jsx)(s.JO,{asChild:!0,children:(0,n.jsx)(i.IconChevronUpDown,{className:"opacity-50"})})]})});u.displayName=s.xz.displayName;let f=l.forwardRef((e,t)=>{let{className:r,children:l,position:i="popper",...o}=e;return(0,n.jsx)(s.h_,{children:(0,n.jsx)(s.VY,{ref:t,className:(0,a.cn)("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md animate-in fade-in-80","popper"===i&&"translate-y-1",r),position:i,...o,children:(0,n.jsx)(s.l_,{className:(0,a.cn)("p-1","popper"===i&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:l})})})});f.displayName=s.VY.displayName;let h=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.__,{ref:t,className:(0,a.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",r),...l})});h.displayName=s.__.displayName;let m=l.forwardRef((e,t)=>{let{className:r,children:l,isPlaceHolder:o,...c}=e;return(0,n.jsxs)(s.ck,{ref:t,className:(0,a.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",r),...c,children:[!o&&(0,n.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,n.jsx)(s.wU,{children:(0,n.jsx)(i.IconCheck,{className:"h-4 w-4"})})}),(0,n.jsx)(s.eT,{children:l})]})});m.displayName=s.ck.displayName;let p=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.Z0,{ref:t,className:(0,a.cn)("-mx-1 my-1 h-px bg-muted",r),...l})});p.displayName=s.Z0.displayName},99047:function(e,t,r){"use strict";r.d(t,{RM:function(){return o},SC:function(){return d},iA:function(){return a},pj:function(){return f},ss:function(){return u},xD:function(){return i}});var n=r(36164),l=r(3546),s=r(1544);let a=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("table",{ref:t,className:(0,s.cn)("w-full caption-bottom text-sm",r),...l})});a.displayName="Table";let i=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("thead",{ref:t,className:(0,s.cn)("[&_tr]:border-b",r),...l})});i.displayName="TableHeader";let o=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("tbody",{ref:t,className:(0,s.cn)("[&_tr:last-child]:border-0",r),...l})});o.displayName="TableBody";let c=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("tfoot",{ref:t,className:(0,s.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",r),...l})});c.displayName="TableFooter";let d=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("tr",{ref:t,className:(0,s.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",r),...l})});d.displayName="TableRow";let u=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("th",{ref:t,className:(0,s.cn)("h-12 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",r),...l})});u.displayName="TableHead";let f=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("td",{ref:t,className:(0,s.cn)("p-2 align-middle [&:has([role=checkbox])]:pr-0",r),...l})});f.displayName="TableCell";let h=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)("caption",{ref:t,className:(0,s.cn)("mt-4 text-sm text-muted-foreground",r),...l})});h.displayName="TableCaption"},50538:function(e,t,r){"use strict";r.d(t,{SP:function(){return c},dr:function(){return o},mQ:function(){return i}});var n=r(36164),l=r(3546),s=r(6044),a=r(1544);let i=s.fC,o=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.aV,{ref:t,className:(0,a.cn)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",r),...l})});o.displayName=s.aV.displayName;let c=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.xz,{ref:t,className:(0,a.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",r),...l})});c.displayName=s.xz.displayName;let d=l.forwardRef((e,t)=>{let{className:r,...l}=e;return(0,n.jsx)(s.VY,{ref:t,className:(0,a.cn)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",r),...l})});d.displayName=s.VY.displayName},9010:function(e,t,r){"use strict";r.d(t,{X:function(){return l}});var n=r(28242);function l(){let{theme:e,systemTheme:t,setTheme:r}=(0,n.F)();return{theme:e&&"system"!==e?e:t||"light",setTheme:r,systemTheme:t}}},44645:function(e,t,r){"use strict";r.d(t,{Z:function(){return s}});var n=r(3546),l=r(11978);function s(){let e=(0,l.usePathname)(),t=(0,l.useRouter)(),r=(0,l.useSearchParams)(),s=(0,n.useCallback)(e=>{let t=new URLSearchParams(r);e&&Object.entries(e).forEach(e=>{let[r,n]=e;return t.set(r,n)});let n=t.toString();return n.length>0?"?".concat(n):""},[r]),a=(0,n.useCallback)(n=>{let l=function(e,t,r){var n,l;let s=null===(n=r.searchParams)||void 0===n?void 0:n.set,a=null===(l=r.searchParams)||void 0===l?void 0:l.del,i=new URLSearchParams(t);s&&Object.entries(s).forEach(e=>{let[t,r]=e;return i.set(t,r)}),a&&(Array.isArray(a)?a.forEach(e=>i.delete(e)):i.delete(a));let o=i.toString(),c=e;return o.length>0&&(c+="?".concat(o)),r.hash&&(c+="#".concat(r.hash.replace(/^#/,""))),c}((null==n?void 0:n.pathname)||e,r,n);return n.replace?t.replace(l):t.push(l),l},[e,r]);return{pathname:e,router:t,searchParams:r,getQueryString:s,updateUrlComponents:a}}},55823:function(){},65001:function(){},11075:function(e,t,r){"use strict";r.d(t,{eI:function(){return s},n0:function(){return a},uL:function(){return l}});var n=r(44494);let l="0.3.0";function s(e,t){return(0,n.K9)(e,{expose:{navigate:t.navigate,refresh:t.refresh,onSubmitMessage:t.onSubmitMessage,onApplyInEditor:t.onApplyInEditor,onLoaded:t.onLoaded,onCopy:t.onCopy,onKeyboardEvent:t.onKeyboardEvent,onLookupSymbol:t.onLookupSymbol}})}function a(e){return(0,n.cy)({expose:{init:e.init,sendMessage:e.sendMessage,showError:e.showError,cleanError:e.cleanError,addRelevantContext:e.addRelevantContext,updateTheme:e.updateTheme,updateActiveSelection:e.updateActiveSelection}})}},14439:function(e,t,r){"use strict";r.d(t,{H:function(){return a},m:function(){return s}});var n=r(3546),l=r(11075);function s(e,t){let[r,s]=(0,n.useState)(null),a=!1;return(0,n.useEffect)(()=>{e.current&&!a&&(a=!0,s((0,l.eI)(e.current,t)))},[e.current]),r}function a(e){let[t,r]=(0,n.useState)(null),s=!1;return(0,n.useEffect)(()=>{let t=window.self!==window.top;t&&!s&&(s=!0,r((0,l.n0)(e)))},[]),t}r(44494)},44494:function(e,t,r){"use strict";r.d(t,{K9:function(){return g},cy:function(){return b}});let n=Symbol.for("quilt.threads.retain"),l=Symbol.for("quilt.threads.release"),s=Symbol.for("quilt.threads.retained-by"),a=Symbol.for("quilt.threads.encode"),i=Symbol.for("quilt.threads.transferable");class o{memoryManaged=new Set;add(e){this.memoryManaged.add(e),e[s].add(this),e[n]()}release(){for(let e of this.memoryManaged)e[s].delete(this),e[l]();this.memoryManaged.clear()}}function c(e){return!!(e&&e[n]&&e[l])}function d(e){if(null==e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return null==t||t===Object.prototype}function u(e,{expose:t,callable:r,signal:u,uuid:m=h,encoder:p=function({encode:e,decode:t}={}){return{encode:function(e,t){let n={api:t,seen:new Map,encode:e=>r(e,n,!0)};return r(e,n)},decode:function(e,t,r){let l={api:t,decode:e=>n(e,l,r,!0)};return n(e,l)}};function r(t,n,l=!1){let{seen:s,api:o,encode:c}=n;if(!l&&e)return e(t,c);if(null==t)return[t];let u=s.get(t);if(u)return u;if(s.set(t,[void 0]),"object"==typeof t){if(t[i]){let e=[t,[t]];return s.set(t,e),e}let e=[],l=t=>{let[l,s=[]]=r(t,n);return e.push(...s),l};if("function"==typeof t[a]){let r=t[a]({encode:l}),n=[r,e];return s.set(t,n),n}if(Array.isArray(t)){let r=t.map(e=>l(e)),n=[r,e];return s.set(t,n),n}if(t instanceof RegExp){let r={"_@r":[t.source,t.flags]},n=[r,e];return s.set(t,n),n}if(t instanceof URL){let r={"_@u":t.href},n=[r,e];return s.set(t,n),n}if(t instanceof Date){let r={"_@d":t.toISOString()},n=[r,e];return s.set(t,n),n}if(t instanceof Map){let r=[...t.entries()].map(([e,t])=>[l(e),l(t)]),n=[{"_@m":r},e];return s.set(t,n),n}if(t instanceof Set){let r=[...t].map(e=>l(e)),n=[{"_@s":r},e];return s.set(t,n),n}let o=null!=t&&(Symbol.asyncIterator in t||Symbol.iterator in t)&&"function"==typeof t.next;if(d(t)||o){let r={};for(let e of Object.keys(t))r[e]=l(t[e]);o&&(r.next??=l(t.next.bind(t)),r.return??=l(t.return.bind(t)),r.throw??=l(t.throw.bind(t)),r["_@i"]=!0);let n=[r,e];return s.set(t,n),n}}if("function"==typeof t){let e=o.functions?.add(t);if(null==e)return[e];let r=[{"_@f":e}];return s.set(t,r),r}let f=[t];return s.set(t,f),f}function n(e,r,l,s=!1){let{api:a,decode:i}=r;if(!s&&t)return t(e,i,l);if("object"==typeof e){if(null==e)return e;if(Array.isArray(e))return e.map(e=>n(e,r,l));if("_@r"in e)return new RegExp(...e["_@r"]);if("_@u"in e)return new URL(e["_@u"]);if("_@d"in e)return new Date(e["_@d"]);if("_@m"in e)return new Map(e["_@m"].map(([e,t])=>[n(e,r,l),n(t,r,l)]));if("_@s"in e)return new Set(e["_@s"].map(e=>n(e,r,l)));if("_@f"in e){let t=e["_@f"],r=a.functions?.get(t);if(l&&c(r))for(let e of l)e.add(r);return r}if(!d(e))return e;let t={};for(let s of Object.keys(e))"_@i"===s?t[Symbol.asyncIterator]=()=>t:t[s]=n(e[s],r,l);return t}return e}}()}={}){let x=!1,v=new Map,g=new Map,b=new Map,j=new Map;if(t)for(let e of Object.keys(t)){let r=t[e];"function"==typeof r&&v.set(e,r)}let y=new Map,N=function(e,t){let r;if(null==t){if("function"!=typeof Proxy)throw Error("You must pass an array of callable methods in environments without Proxies.");let t=new Map;r=new Proxy({},{get(r,n){if(t.has(n))return t.get(n);let l=e(n);return t.set(n,l),l}})}else for(let n of(r={},t))Object.defineProperty(r,n,{value:e(n),writable:!1,configurable:!0,enumerable:!0});return r}(function(e){return(...t)=>{try{if(x)throw new f;if("string"!=typeof e&&"number"!=typeof e)throw Error(`Can’t call a symbol method on a thread: ${e.toString()}`);if("hasCapability"===e){let e=t[0],r=m(),n=I(r);return S(7,[r,e]),n}let r=m(),n=I(r),[l,s]=p.encode(t,w);return S(0,[r,e,l],s),n}catch(e){return Promise.reject(e)}}},r),w={functions:{add(e){let t=g.get(e);return null==t&&(t=m(),g.set(e,t),b.set(t,e)),t},get(e){let t=j.get(e);if(t)return t;let r=0,a=!1;return Object.defineProperties(t=(...t)=>{if(a)throw Error("You attempted to call a function that was already released.");if(!j.has(e))throw Error("You attempted to call a function that was already revoked.");let[r,n]=p.encode(t,w),l=m(),s=I(l);return S(5,[l,e,r],n),s},{[l]:{value:()=>{0==(r-=1)&&(a=!0,j.delete(e),S(3,[e]))},writable:!1},[n]:{value:()=>{r+=1},writable:!1},[s]:{value:new Set,writable:!1}}),j.set(e,t),t}}},k=()=>{if(!x){for(let e of y.keys())E(e,new f);x=!0,v.clear(),y.clear(),g.clear(),b.clear(),j.clear()}};return u?.addEventListener("abort",()=>{S(2,[]),k()},{once:!0}),e.listen(C,{signal:u}),N;function S(t,r,n){x||e.send([t,r],n)}async function C(e){let t=Array.isArray(e)&&"number"==typeof e[0]&&(null==e[1]||Array.isArray(e[1]));if(t)switch(e[0]){case 2:k();break;case 0:{let t=new o,[r,n,l]=e[1],s=v.get(n);try{if(null==s)throw Error(`No '${n}' method is exposed on this endpoint`);let e=await s(...p.decode(l,w,[t])),[a,i]=p.encode(e,w);S(1,[r,void 0,a],i)}catch(l){let{name:e,message:t,stack:n}=l;S(1,[r,{name:e,message:t,stack:n}])}finally{t.release()}break}case 1:case 6:E(...e[1]);break;case 3:{let[t]=e[1],r=b.get(t);r&&(b.delete(t),g.delete(r));break}case 5:{let[t,r,n]=e[1],l=new o;try{let e=b.get(r);if(null==e)throw Error("You attempted to call a function that was already released.");let a=await e(...p.decode(n,w,c(e)?[...e[s],l]:[l])),[i,o]=p.encode(a,w);S(6,[t,void 0,i],o)}catch(l){let{name:e,message:r,stack:n}=l;S(6,[t,{name:e,message:r,stack:n}])}finally{l.release()}break}case 7:{let[t,r]=e[1],n=v.has(r);S(1,[t,void 0,p.encode(n,w)[0]])}}}function I(e){let t=new Promise((t,r)=>{y.set(e,(e,n,l)=>{if(null==n)t(p.decode(l,w));else{let e=Error();Object.assign(e,n),r(e)}})});return Object.defineProperty(t,Symbol.asyncIterator,{async *value(){let e=await t;Object.defineProperty(e,Symbol.asyncIterator,{value:()=>e}),yield*e}}),t}function E(...e){let t=e[0],r=y.get(t);r&&(r(...e),y.delete(t))}}class f extends Error{constructor(){super("You attempted to call a function on a terminated thread.")}}function h(){return`${m()}-${m()}-${m()}-${m()}`}function m(){return Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)}var p=r(18400);let x="quilt.threads.ping",v="quilt.threads.pong";function g(e,{targetOrigin:t="*",...r}={}){let n=!1,l=function(r,n){e.contentWindow?.postMessage(r,t,n)},s=new Promise(t=>{let s=r.signal?new p.z(r.signal):new AbortController;window.addEventListener("message",r=>{r.source===e.contentWindow&&r.data===v&&(n=!0,s.abort(),t())},{signal:s.signal}),s.signal.addEventListener("abort",()=>{t()},{once:!0}),l(x)});return u({send:(e,t)=>n?l(e,t):s.then(()=>{if(n)return l(e,t)}),listen(t,{signal:r}){self.addEventListener("message",r=>{r.source===e.contentWindow&&r.data!==v&&t(r.data)},{signal:r})}},r)}function b({targetOrigin:e="*",...t}={}){if("undefined"==typeof self||null==self.parent)throw Error("You are not inside an iframe, because there is no parent window.");let{parent:r}=self,n=t.signal?new p.z(t.signal):new AbortController,l=()=>{let n=()=>r.postMessage(v,e);self.addEventListener("message",({data:e})=>{e===x&&n()},{signal:t.signal}),n()};return"complete"===document.readyState?l():document.addEventListener("readystatechange",()=>{"complete"===document.readyState&&(l(),n.abort())},{signal:n.signal}),u({send:(t,n)=>r.postMessage(t,e,n),listen(e,{signal:t}){self.addEventListener("message",t=>{t.data!==x&&e(t.data)},{signal:t})}},t)}}},function(e){e.O(0,[8415,5870,6056,1386,55,3126,4007,9643,4752,3449,2578,8511,2287,4421,1454,7070,4318,3299,1889,4405,4553,5083,440,7651,5019,598,1544,1565,3821,5871,3375,5289,1744],function(){return e(e.s=4755)}),_N_E=e.O()}]);
\ No newline at end of file
diff --git a/ee/tabby-webserver/ui/_next/static/chunks/app/search/page-8d592670569cf973.js b/ee/tabby-webserver/ui/_next/static/chunks/app/search/page-8d592670569cf973.js
new file mode 100644
index 000000000000..dfbab605b4cf
--- /dev/null
+++ b/ee/tabby-webserver/ui/_next/static/chunks/app/search/page-8d592670569cf973.js
@@ -0,0 +1 @@
+(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2797],{72845:function(e,t,n){Promise.resolve().then(n.bind(n,32166))},32166:function(e,t,n){"use strict";n.r(t),n.d(t,{SOURCE_CARD_STYLE:function(){return eC},Search:function(){return eR},SearchContext:function(){return eS}});var s=n(36164),l=n(3546),r=n(70652),a=n.n(r),i=n(11978),o=n(54767),c=n(1853),d=n(82030),u=n(72940),m=n(52807),h=n(12978),x=n(56575),f=n(2578),v=n(40055),p=n(21808),g=n(93877),j=n(43240),N=n(18500),w=n(28312),b=n(9010),y=n(24449),I=n(16784),S=n(98454),C=n(31159),k=n(44645),A=n(80605),R=n(64566),M=n(47241),_=n(37266),E=n(11634),L=n(70410),T=n(1544),z=n(31458),D=n(81565),O=n(53538),U=n(57830),F=n(11208),P=n(72657),V=n(30601),Z=n(69579),q=n(24203),G=n(84381),H=n(62226),Q=n.n(H),$=n(6797),W=n.n($),J=n(94909),K=n(66686),X=n(5493),Y=n(23455),B=n(23782),ee=n(74038),et=n(98150),en=n(3448),es=n(29),el=n(66534),er=n(90168),ea=n(48537),ei=n(21540);function eo(e){var t,n,r,a,i,o,d,u,m;let{className:h,message:x,showRelatedQuestion:f,isLoading:v,isLastAssistantMessage:p,isDeletable:g,clientCode:j}=e,{onRegenerateResponse:N,onSubmitSearch:w,setDevPanelOpen:b,setConversationIdForDev:y,enableDeveloperMode:I,contextInfo:S,fetchingContextInfo:C,onDeleteMessage:k,isThreadOwner:A,onUpdateMessage:R}=(0,l.useContext)(eS),{supportsOnApplyInEditorV2:M,onNavigateToContext:_}=(0,l.useContext)(el.p),[E,L]=(0,l.useState)(!1),[O,U]=(0,l.useState)(!1),[F,P]=(0,l.useState)(void 0),V=v?D.IconSpinner:D.IconSparkles,Z=(null==x?void 0:null===(r=x.attachment)||void 0===r?void 0:null===(n=r.code)||void 0===n?void 0:null===(t=n[0])||void 0===t?void 0:t.gitUrl)||"",q=(0,l.useMemo)(()=>{var e;return(null==j?void 0:j.length)&&null!==(e=j.map(e=>{let{startLine:t,endLine:n}=(0,T.OV)(e);return{kind:"file",range:{start:t,end:n},filepath:e.filepath||"",content:e.content,git_url:Z}}))&&void 0!==e?e:[]},[j,Z]),G=(0,l.useMemo)(()=>{var e,t,n;return null!==(n=null==x?void 0:null===(t=x.attachment)||void 0===t?void 0:null===(e=t.code)||void 0===e?void 0:e.map(e=>{var t;let{startLine:n,endLine:s}=(0,T.OV)(e);return{kind:"file",range:{start:n,end:s},filepath:e.filepath,content:e.content,git_url:e.gitUrl,extra:{scores:null==e?void 0:null===(t=e.extra)||void 0===t?void 0:t.scores}}}))&&void 0!==n?n:[]},[j,null==x?void 0:null===(a=x.attachment)||void 0===a?void 0:a.code]),H=(0,l.useMemo)(()=>null==j?void 0:j.map(e=>({...e,gitUrl:Z})),[j,Z]),Q=null==x?void 0:null===(i=x.attachment)||void 0===i?void 0:i.doc,$=((null==H?void 0:H.length)||0)+((null===(d=x.attachment)||void 0===d?void 0:null===(o=d.code)||void 0===o?void 0:o.length)||0),W=(null==Q?void 0:Q.length)?Math.ceil(Q.length/4)*eC.expand+.5*Math.floor(Q.length/4)+.5:0,K=e=>{let{startLine:t,endLine:n}=(0,T.OV)(e);if(!e.filepath)return;let s=new URL("".concat(window.location.origin,"/files")),l=new URLSearchParams;l.append("redirect_filepath",e.filepath),l.append("redirect_git_url",e.gitUrl),s.search=l.toString();let r=(0,T.nO)({start:t,end:n});r&&(s.hash=r),window.open(s.toString())},X=async e=>{let t=await R(e);if(t)return t;L(!1)};return(0,s.jsxs)("div",{className:(0,T.cn)("flex flex-col gap-y-5",h),children:[Q&&Q.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-1 flex items-center gap-x-2",children:[(0,s.jsx)(D.IconBlocks,{className:"relative",style:{top:"-0.04rem"}}),(0,s.jsx)("p",{className:"text-sm font-bold leading-normal",children:"Sources"})]}),(0,s.jsx)("div",{className:"gap-sm -mx-2 grid grid-cols-3 gap-2 overflow-y-hidden px-2 pt-2 md:grid-cols-4",style:{transition:"height 0.25s ease-out",height:O?"".concat(W,"rem"):"".concat(eC.compress+.5,"rem")},children:Q.map((e,t)=>(0,s.jsx)(ec,{conversationId:x.id,source:e,showMore:O,showDevTooltip:I},e.link+t))}),(0,s.jsxs)(z.z,{variant:"ghost",className:"-ml-1.5 mt-1 flex items-center gap-x-1 px-1 py-2 text-sm font-normal text-muted-foreground",onClick:()=>U(!O),children:[(0,s.jsx)(D.IconChevronRight,{className:(0,T.cn)({"-rotate-90":O,"rotate-90":!O})}),(0,s.jsx)("p",{children:O?"Show less":"Show more"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"mb-1 flex h-8 items-center gap-x-1.5",children:[(0,s.jsx)(V,{className:(0,T.cn)({"animate-spinner":v})}),(0,s.jsx)("p",{className:"text-sm font-bold leading-none",children:"Answer"}),I&&(0,s.jsx)(z.z,{variant:"ghost",size:"icon",onClick:()=>{y(x.id),b(!0)},children:(0,s.jsx)(D.IconBug,{})})]}),$>0&&(0,s.jsx)(er.q,{clientContexts:q,contexts:G,className:"mt-1 text-sm",onContextClick:e=>{if(!e.filepath)return;let t=new URL("".concat(window.location.origin,"/files")),n=new URLSearchParams;n.append("redirect_filepath",e.filepath),n.append("redirect_git_url",e.git_url),t.search=n.toString();let s=(0,T.nO)({start:e.range.start,end:e.range.end});s&&(t.hash=s),window.open(t.toString())},enableTooltip:I,showExternalLink:!1,showClientCodeIcon:!0,onTooltipClick:()=>{y(x.id),b(!0)},highlightIndex:F}),v&&!x.content&&(0,s.jsx)(en.O,{className:"mt-1 h-40 w-full"}),E?(0,s.jsx)(eu,{message:x,onCancel:()=>L(!1),onSubmit:X}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(ei.JG,{message:x.content,attachmentDocs:Q,attachmentClientCode:H,attachmentCode:null===(u=x.attachment)||void 0===u?void 0:u.code,onCodeCitationClick:e=>{e.gitUrl&&K(e)},onCodeCitationMouseEnter:e=>{var t,n;P(e-1-((null==x?void 0:null===(n=x.attachment)||void 0===n?void 0:null===(t=n.doc)||void 0===t?void 0:t.length)||0))},onCodeCitationMouseLeave:e=>{P(void 0)},contextInfo:S,fetchingContextInfo:C,canWrapLongLines:!v,supportsOnApplyInEditorV2:M}),x.error&&(0,s.jsx)(ei.mE,{error:x.error}),!v&&!E&&(0,s.jsxs)("div",{className:"mt-3 flex items-center justify-between text-sm",children:[(0,s.jsx)("div",{className:"flex items-center gap-x-3",children:A&&(0,s.jsxs)(s.Fragment,{children:[!v&&!C&&p&&(0,s.jsxs)(z.z,{className:"flex items-center gap-x-1 px-1 font-normal text-muted-foreground",variant:"ghost",onClick:()=>N(x.id),children:[(0,s.jsx)(D.IconRefresh,{}),(0,s.jsx)("p",{children:"Regenerate"})]}),g&&(0,s.jsxs)(z.z,{className:"flex items-center gap-x-1 px-1 font-normal text-muted-foreground",variant:"ghost",onClick:()=>k(x.id),children:[(0,s.jsx)(D.IconTrash,{}),(0,s.jsx)("p",{children:"Delete"})]})]})}),(0,s.jsxs)("div",{className:"flex items-center gap-x-3",children:[(0,s.jsx)(ea.q,{className:"-ml-1.5 gap-x-1 px-1 font-normal text-muted-foreground",value:(e=>{var t,n,s,l,r,a,i,o,d,u,m;if((0,J.Z)(null==e?void 0:null===(t=e.attachment)||void 0===t?void 0:t.doc)&&(0,J.Z)(null==e?void 0:null===(n=e.attachment)||void 0===n?void 0:n.code))return e.content;let h=e.content.replace(ee.H,e=>{let t=null==e?void 0:e.match(/\d+/);return"[".concat(t,"]")}).trim(),x=null!==(d=null===(l=e.attachment)||void 0===l?void 0:null===(s=l.doc)||void 0===s?void 0:s.map((e,t)=>"[".concat(t+1,"] ").concat(e.link)).join("\n"))&&void 0!==d?d:"",f=null!==(u=null===(a=e.attachment)||void 0===a?void 0:null===(r=a.doc)||void 0===r?void 0:r.length)&&void 0!==u?u:0,v=null!==(m=null===(o=e.attachment)||void 0===o?void 0:null===(i=o.code)||void 0===i?void 0:i.map((e,t)=>{let n=(0,T.tf)(e),s=(0,c.Z)([e.filepath,n]).join(":");return"[".concat(t+f+1,"] ").concat(s)}).join("\n"))&&void 0!==m?m:"";return"".concat(h,"\n\nCitations:\n").concat(x+v)})(x),text:"Copy"}),A&&(0,s.jsxs)(z.z,{className:"flex items-center gap-x-1 px-1 font-normal text-muted-foreground",variant:"ghost",onClick:e=>L(!0),children:[(0,s.jsx)(D.IconEdit,{}),(0,s.jsx)("p",{children:"Edit"})]})]})]})]})]}),f&&!E&&!v&&x.threadRelevantQuestions&&x.threadRelevantQuestions.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-x-1.5",children:[(0,s.jsx)(D.IconLayers,{}),(0,s.jsx)("p",{className:"text-sm font-bold leading-none",children:"Suggestions"})]}),(0,s.jsx)("div",{className:"mt-2 flex flex-col gap-y-3",children:null===(m=x.threadRelevantQuestions)||void 0===m?void 0:m.map((e,t)=>(0,s.jsxs)("div",{className:"flex cursor-pointer items-center justify-between rounded-lg border p-4 py-3 transition-opacity hover:opacity-70",onClick:w.bind(null,e),children:[(0,s.jsx)("p",{className:"w-full overflow-hidden text-ellipsis text-sm",children:e}),(0,s.jsx)(D.IconPlus,{})]},t))})]})]})}function ec(e){var t,n;let{conversationId:r,source:a,showMore:i,showDevTooltip:o}=e,{setDevPanelOpen:c,setConversationIdForDev:d}=(0,l.useContext)(eS),[u,m]=(0,l.useState)(!1);return(0,s.jsxs)(es.u,{open:u,onOpenChange:e=>{o&&m(e)},delayDuration:0,children:[(0,s.jsx)(es.aJ,{asChild:!0,children:(0,s.jsx)("div",{className:"relative flex cursor-pointer flex-col justify-between rounded-lg border bg-card p-3 hover:bg-card/60",style:{height:i?"".concat(eC.expand,"rem"):"".concat(eC.compress,"rem"),transition:"all 0.25s ease-out"},onClick:()=>window.open(a.link),children:(0,s.jsx)(ed,{source:a,showMore:i})})}),(0,s.jsx)(es._v,{align:"start",className:"cursor-pointer p-2",onClick:e=>{e.stopPropagation(),d(r),c(!0)},children:(0,s.jsxs)("p",{children:["Score: ",null!==(n=null==a?void 0:null===(t=a.extra)||void 0===t?void 0:t.score)&&void 0!==n?n:"-"]})})]})}function ed(e){let{source:t,showMore:n}=e,{hostname:l}=new URL(t.link),r="MessageAttachmentIssueDoc"===t.__typename,a="MessageAttachmentPullDoc"===t.__typename;return(0,s.jsxs)("div",{className:"flex flex-1 flex-col justify-between gap-y-1",children:[(0,s.jsxs)("div",{className:"flex flex-col gap-y-0.5",children:[(0,s.jsx)("p",{className:"line-clamp-1 w-full overflow-hidden text-ellipsis break-all text-xs font-semibold",children:t.title}),(0,s.jsx)("p",{className:(0,T.cn)(" w-full overflow-hidden text-ellipsis break-all text-xs text-muted-foreground",{"line-clamp-2":n,"line-clamp-1":!n}),children:em((0,T.L5)(t))})]}),(0,s.jsx)("div",{className:"flex items-center text-xs text-muted-foreground",children:(0,s.jsxs)("div",{className:"flex w-full flex-1 items-center justify-between gap-1",children:[(0,s.jsxs)("div",{className:"flex items-center",children:[(0,s.jsx)(ei.V$,{hostname:l}),(0,s.jsx)("p",{className:"ml-1 truncate",children:l.replace("www.","").split("/")[0]})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-1",children:[r&&(0,s.jsxs)(s.Fragment,{children:[t.closed?(0,s.jsx)(D.IconCheckCircled,{className:"h-3.5 w-3.5"}):(0,s.jsx)(D.IconCircleDot,{className:"h-3.5 w-3.5"}),(0,s.jsx)("span",{children:t.closed?"Closed":"Open"})]}),a&&(0,s.jsxs)(s.Fragment,{children:[t.merged?(0,s.jsx)(D.IconGitMerge,{className:"h-3.5 w-3.5"}):(0,s.jsx)(D.IconGitPullRequest,{className:"h-3.5 w-3.5"}),t.merged?"Merged":"Open"]})]})]})})]})}function eu(e){let{message:t,onCancel:n,onSubmit:r}=e,a=B.Ry({content:B.Z_().trim()}),i=(0,X.cI)({resolver:(0,G.F)(a),defaultValues:{content:t.content}}),{isSubmitting:o}=i.formState,[c]=(0,l.useState)(t),d=async e=>{let t=await r({...c,content:e.content});t&&(0,E.zG)(i)(t)};return(0,s.jsx)(et.l0,{...i,children:(0,s.jsxs)("form",{onSubmit:i.handleSubmit(d),children:[(0,s.jsx)(et.Wi,{control:i.control,name:"content",render:e=>{let{field:t}=e;return(0,s.jsxs)(et.xJ,{children:[(0,s.jsx)(et.NI,{children:(0,s.jsx)(Y.Z,{autoFocus:!0,minRows:2,maxRows:20,className:"w-full rounded-lg border bg-background p-4 outline-ring",...t})}),(0,s.jsx)(et.zG,{})]})}}),(0,s.jsxs)("div",{className:"my-4 flex items-center justify-between gap-2 px-2",children:[(0,s.jsx)("div",{children:(0,s.jsx)(et.zG,{})}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(z.z,{type:"button",variant:"outline",onClick:n,className:"min-w-[2rem]",children:"Cancel"}),(0,s.jsxs)(z.z,{type:"submit",disabled:o,children:[o&&(0,s.jsx)(D.IconSpinner,{className:"mr-2 h-4 w-4 animate-spin"}),"Save"]})]})]})]})})}let em=e=>{let t=Q().sanitize(e,{ALLOWED_TAGS:[],ALLOWED_ATTR:[]}),n=K.TU.parse(t),s=W().decode(n),l=s.replace(/<\/?[^>]+(>|$)/g,"");return l};var eh=n(90379);let ex=(0,l.lazy)(()=>n.e(726).then(n.t.bind(n,80726,23))),ef=e=>{let{value:t,isFullScreen:n,onToggleFullScreen:r,onClose:a}=e,[i]=(0,g.m)(),{theme:o}=(0,b.X)(),c=(0,l.useRef)(null);return((0,l.useEffect)(()=>{if(t){var e;null===(e=c.current)||void 0===e||e.scrollTo({top:0,behavior:"smooth"})}},[t]),(null==i?void 0:i.value)&&open)?(0,s.jsxs)("div",{className:"flex h-full flex-col px-3 pt-2",children:[(0,s.jsx)("div",{className:"flex items-center justify-end pb-2",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(z.z,{variant:"ghost",size:"icon",onClick:e=>r(!n),children:(0,s.jsx)(D.IconChevronDown,{className:(0,T.cn)("transition-all",n?"":"rotate-180")})}),(0,s.jsx)(z.z,{variant:"ghost",size:"icon",onClick:a,children:(0,s.jsx)(D.IconClose,{})})]})}),(0,s.jsx)(l.Suspense,{fallback:(0,s.jsx)(eh.cg,{className:"p-2"}),children:t?(0,s.jsx)(U.ScrollArea,{className:"flex-1",ref:c,children:(0,s.jsx)(ex,{theme:"dark"===o?"tomorrow":"rjv-default",src:t,style:{fontSize:"0.75rem"},collapseStringsAfterLength:120})}):null})]}):null};var ev=n(73460),ep=n(68172),eg=n(63743),ej=n(52569),eN=n(7449);let ew=(0,j.BX)("\n mutation DeleteThread($id: ID!) {\n deleteThread(id: $id)\n }\n");function eb(e){let{threadIdFromURL:t,streamingDone:n}=e,r=(0,i.useRouter)(),{isThreadOwner:a}=(0,l.useContext)(eS),[o,c]=(0,l.useState)(!1),[d,u]=(0,l.useState)(!1),m=(0,E.Db)(ew,{onCompleted(e){e.deleteThread?r.replace("/"):(f.A.error("Failed to delete"),u(!1))},onError(e){f.A.error((null==e?void 0:e.message)||"Failed to delete"),u(!1)}}),h=e=>{e&&(0,_.wh)(),r.push("/")};return(0,s.jsxs)("header",{className:"flex h-16 items-center justify-between px-4 lg:px-10",children:[(0,s.jsx)("div",{className:"flex items-center gap-x-6",children:(0,s.jsxs)(z.z,{variant:"ghost",className:"-ml-1 pl-0 text-sm text-muted-foreground",onClick:()=>h(),children:[(0,s.jsx)(D.IconChevronLeft,{className:"mr-1 h-5 w-5"}),"Home"]})}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[n&&t&&(0,s.jsx)(z.z,{variant:"ghost",className:"flex items-center gap-1 px-2 font-normal text-muted-foreground",onClick:()=>h(!0),children:(0,s.jsx)(D.IconPlus,{})}),n&&t&&a&&(0,s.jsxs)(ev.aR,{open:o,onOpenChange:c,children:[(0,s.jsx)(ev.vW,{asChild:!0,children:(0,s.jsx)(z.z,{size:"icon",variant:"hover-destructive",children:(0,s.jsx)(D.IconTrash,{})})}),(0,s.jsxs)(ev._T,{children:[(0,s.jsxs)(ev.fY,{children:[(0,s.jsx)(ev.f$,{children:"Delete this thread"}),(0,s.jsx)(ev.yT,{children:"Are you sure you want to delete this thread? This operation is not revertible."})]}),(0,s.jsxs)(ev.xo,{children:[(0,s.jsx)(ev.le,{children:"Cancel"}),(0,s.jsxs)(ev.OL,{className:(0,z.d)({variant:"destructive"}),onClick:e=>{e.preventDefault(),u(!0),m({id:t})},children:[d&&(0,s.jsx)(D.IconSpinner,{className:"mr-2 h-4 w-4 animate-spin"}),"Yes, delete it"]})]})]})]}),(0,s.jsx)(ep.q,{children:(0,s.jsx)(eg.T,{className:"mr-4"})}),(0,s.jsx)(eN.Z,{showHome:!1,showSetting:!0,beforeRouteChange:()=>{(0,_.wh)()},children:(0,s.jsx)(ej.SQ,{className:"h-10 w-10 border"})})]})]})}function ey(){return(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(en.O,{className:"w-full"}),(0,s.jsx)(en.O,{className:"w-[70%]"})]}),(0,s.jsx)(en.O,{className:"h-40 w-full"})]})}function eI(e){let{message:t,className:n,...r}=e,{contextInfo:a,fetchingContextInfo:i}=(0,l.useContext)(eS),{supportsOnApplyInEditorV2:o}=(0,l.useContext)(el.p);return(0,s.jsx)("div",{className:(0,T.cn)("font-semibold",n),...r,children:(0,s.jsx)(ei.JG,{message:t.content,contextInfo:a,supportsOnApplyInEditorV2:o,fetchingContextInfo:i,className:"text-xl prose-p:mb-2 prose-p:mt-0",headline:!0,canWrapLongLines:!0})})}let eS=(0,l.createContext)({}),eC={compress:5.3,expand:6.3},ek="_temp_msg_",eA=()=>"".concat(ek).concat((0,x.x0)());function eR(){var e,t,n,r,a;let[{data:m}]=(0,S.P)(),{updateUrlComponents:x,pathname:j}=(0,k.Z)(),[Z,G]=(0,l.useState)(),[H,Q]=(0,l.useState)(!1),$=(0,A.xG)(),[W,J]=(0,l.useState)([]),[K,X]=(0,l.useState)(!0),[Y,B]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(""),[en,es]=(0,l.useState)(""),el=(0,l.useRef)(null),[er,ea]=(0,l.useState)(!1),[ei]=(0,V.Hb)(),ec=(0,i.useRouter)(),ed=(0,l.useRef)(!1),{theme:eu}=(0,b.X)(),[em,eh]=(0,l.useState)(!1),[ex,ev]=(0,l.useState)(),ep=(0,l.useRef)(null),[eg,ej]=(0,l.useState)(45),eN=(0,l.useRef)(eg),[ew]=(0,g.m)(),[eC,eR]=(0,l.useState)(),eL=(0,l.useMemo)(()=>{var e,t;if(Z)return null===(t=Z.match(/^\/search\/(.*)/))||void 0===t?void 0:null===(e=t[1])||void 0===e?void 0:e.split("-").pop()},[Z]),eT=(0,E.Db)(eM),ez=async e=>{let t=W.findIndex(t=>t.id===e.id);if(!(t>-1)||!eC)return Error("Failed to save");{var n;let s=await eT({input:{threadId:eC,id:e.id,content:e.content}});if(null==s||null===(n=s.data)||void 0===n||!n.updateThreadMessage)return(null==s?void 0:s.error)||Error("Failed to save");await J(n=>{let s=[...n];return s[t]=e,s})}};(0,l.useEffect)(()=>{eL&&eR(eL)},[eL]);let[{data:eD,fetching:eO}]=(0,v.aM)({query:L.Gx}),[eU,eF]=(0,l.useState)(),[{data:eP,fetching:eV,error:eZ}]=(0,v.aM)({query:L.XL,variables:{ids:[eC]},pause:!eC}),[{data:eq,error:eG,fetching:eH,stale:eQ}]=(0,v.aM)({query:L.r4,variables:{threadId:eC,first:30,after:eU},pause:!eC||Y});(0,l.useEffect)(()=>{var e,t,n,s;if(!eQ){if(null==eq?void 0:null===(t=eq.threadMessages)||void 0===t?void 0:null===(e=t.edges)||void 0===e?void 0:e.length){let e=eq.threadMessages.edges.map(e=>e.node).slice();J(t=>(0,h.Z)([...t,...e],"id"))}if(null==eq?void 0:eq.threadMessages){let e=null==eq?void 0:null===(s=eq.threadMessages)||void 0===s?void 0:null===(n=s.pageInfo)||void 0===n?void 0:n.hasNextPage,t=null==eq?void 0:eq.threadMessages.pageInfo.endCursor;e&&t?eF(t):B(!0)}}},[eq]);let e$=(0,l.useMemo)(()=>{if(!m)return!1;if(!eL)return!0;let e=null==eP?void 0:eP.threads.edges[0];return!!e&&m.me.id===e.node.userId},[m,eP,eL]),eW=null==eD?void 0:eD.contextInfo.sources,eJ=null==W?void 0:null===(e=W[0])||void 0===e?void 0:e.content,eK=(0,l.useMemo)(()=>eW&&eJ?(0,T.i8)(eW,eJ,{maxLength:p.$I}):"",[eW,eJ]);(0,l.useEffect)(()=>{eK&&(document.title=eK)},[eK]),(0,l.useEffect)(()=>{eG&&!Y&&B(!0)},[eG]);let{sendUserMessage:eX,isLoading:eY,error:eB,answer:e0,stop:e1,regenerate:e4,deleteThreadMessagePair:e5}=(0,R.x)({threadId:eC}),e2=(0,I.d)(eY),{selectedModel:e6,isModelLoading:e3,models:e7}=(0,C.Vq)(),e8=(0,l.useMemo)(()=>W.find(e=>e.id===ex),[ex,W]),e9=(0,l.useMemo)(()=>e8?(0,d.Z)(null==e8?void 0:e8.attachment,"doc","code"):{answers:W.filter(e=>e.role===N.uU.Assistant).map(e=>(0,d.Z)(e,"doc","code"))},[ex,null==e8?void 0:null===(t=e8.attachment)||void 0===t?void 0:t.code,null==e8?void 0:null===(n=e8.attachment)||void 0===n?void 0:n.doc]);(0,l.useEffect)(()=>{G(j),H||Q(!0)},[j]),(0,l.useEffect)(()=>{H&&!eL&&(()=>{if(ed.current)return;ed.current=!0;let e=sessionStorage.getItem(p.$6.SEARCH_INITIAL_MSG),t=sessionStorage.getItem(p.$6.SEARCH_INITIAL_CONTEXTS),n=t?JSON.parse(t):void 0;if(e){sessionStorage.removeItem(p.$6.SEARCH_INITIAL_MSG),sessionStorage.removeItem(p.$6.SEARCH_INITIAL_CONTEXTS),B(!0),ts(e,n);return}eC||((0,_.wh)(),ec.replace("/"))})()},[H]),(0,l.useEffect)(()=>{Y&&setTimeout(()=>{ea(!0)},300)},[Y]);let{isCopied:te,onCopy:tt}=function(e){let{threadIdFromURL:t,threadIdFromStreaming:n,streamingDone:s,updateThreadURL:l}=e,{isCopied:r,copyToClipboard:a}=(0,w.m)({timeout:2e3}),i=(0,E.Db)(L.md,{onError(e){f.A.error(e.message)}}),o=!t&&s&&n&&l,c=async()=>{if(r)return;let e=window.location.href;o&&(await i({threadId:n}),e=l(n)),a(e)};return{onCopy:c,isCopied:r}}({threadIdFromURL:eL,threadIdFromStreaming:eC,streamingDone:!eY,updateThreadURL:e=>{let t=(0,o.Z)(eK),n=(0,c.Z)([t,e]).join("-"),s=x({pathname:"/search/".concat(n),searchParams:{del:["q"]},replace:!0});return location.origin+s}});(0,l.useEffect)(()=>{var e,t,n,s;e0.threadId&&e0.threadId!==eC&&eR(e0.threadId);let l=[...W],r=l.findIndex(e=>e.id===ee),a=l.findIndex(e=>e.id===en);if(-1===r||-1===a)return;let i=l[r],o=l[a];o.content=e0.content,(null===(e=o.attachment)||void 0===e?void 0:e.code)||!e0.attachmentsCode||(o.attachment={clientCode:null,doc:(null===(n=o.attachment)||void 0===n?void 0:n.doc)||null,code:e0.attachmentsCode.map(e=>({...e.code,extra:{scores:e.scores}}))||null}),(null===(t=o.attachment)||void 0===t?void 0:t.doc)||!e0.attachmentsDoc||(o.attachment={clientCode:null,doc:e0.attachmentsDoc.map(e=>({...e.doc,extra:{score:e.score}}))||null,code:(null===(s=o.attachment)||void 0===s?void 0:s.code)||null}),o.threadRelevantQuestions=null==e0?void 0:e0.relevantQuestions;let c=e0.userMessageId,d=e0.assistantMessageId;c&&d&&c!==i.id&&d!==o.id&&(i.id=c,o.id=d,et(c),es(d)),J(l)},[eY,e0]),(0,l.useEffect)(()=>{if(eB){let e=[...W],t=e.find(e=>e.id===en);t&&(t.error=eB?"401"===eB.message?"Unauthorized":(0,u.Z)(eB.graphQLErrors,e=>{var t;return(null===(t=e.extensions)||void 0===t?void 0:t.code)===p.ir})?"The thread has expired or does not exist.":eB.message||"Failed to fetch":"Failed to fetch")}},[eB]);let tn=(0,l.useRef)();(0,l.useEffect)(()=>(e2.current&&(tn.current=window.setTimeout(()=>{if(!e2.current)return;X(!0);let e=null==el?void 0:el.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},300)),e2.current||X(!1),()=>{window.clearTimeout(tn.current)}),[eY]),(0,l.useEffect)(()=>{var e,t,n;em?(null===(e=ep.current)||void 0===e||e.expand(),null===(t=ep.current)||void 0===t||t.resize(eg)):null===(n=ep.current)||void 0===n||n.collapse()},[em]);let ts=(e,t)=>{let n=eA(),s=eA(),l={id:n,role:N.uU.User,content:e},r={id:s,role:N.uU.Assistant,content:""},{sourceIdForCodeQuery:a,sourceIdsForDocQuery:i,searchPublic:o}=eE(t),c=a?{sourceId:a,content:e}:null;et(n),es(s),J([...W].concat([l,r])),eX({content:e},{generateRelevantQuestions:!0,codeQuery:c,docQuery:{sourceIds:i,content:e,searchPublic:!!o},modelName:null==t?void 0:t.modelName})},tl=(0,l.useMemo)(()=>{var e,t;if(Y&&!eV&&eL&&(eZ||!(null==eP?void 0:null===(t=eP.threads)||void 0===t?void 0:null===(e=t.edges)||void 0===e?void 0:e.length)))return eZ||Error(p.ir)},[eP,eV,eZ,Y,eL]),[tr]=(0,y.n)(eH||(null==eq?void 0:null===(a=eq.threadMessages)||void 0===a?void 0:null===(r=a.pageInfo)||void 0===r?void 0:r.hasNextPage),200),ta=(0,l.useMemo)(()=>{let e=[],t={question:null,answer:null};return W.forEach(n=>{n.role===N.uU.User?t.question=n:n.role!==N.uU.Assistant||t.answer||(t.answer=n,e.push(t),t={question:null,answer:null})}),e},[W]),ti=ei?{height:"calc(100vh - ".concat(V.wt,")")}:{height:"100vh"};return Y&&(tl||eG)?(0,s.jsx)(e_,{error:tl||eG}):!Y&&(tr||eQ)?(0,s.jsxs)("div",{children:[(0,s.jsx)(eb,{}),(0,s.jsxs)("div",{className:"mx-auto mt-24 w-full space-y-10 px-4 pb-32 lg:max-w-4xl lg:px-0",children:[(0,s.jsx)(ey,{}),(0,s.jsx)(ey,{})]})]}):$&&Y?(0,s.jsx)(eS.Provider,{value:{isLoading:eY,onRegenerateResponse:()=>{var e;if(!eC||eO)return;let t=W.length-1,n=t-1;if(-1===t||n<=-1)return;let s=W[n].id,l=W[t].id,r=W.slice(0,-2),a=W[n],i={...a,id:eA()},o={id:eA(),role:N.uU.Assistant,content:"",attachment:{code:null,doc:null,clientCode:null},error:void 0},c=(0,T.b)(i.content,null==eD?void 0:null===(e=eD.contextInfo)||void 0===e?void 0:e.sources),{sourceIdForCodeQuery:d,sourceIdsForDocQuery:u,searchPublic:m}=eE((0,T.G8)(c)),h=d?{sourceId:d,content:i.content}:null,x={sourceIds:u,content:i.content,searchPublic:m};et(i.id),es(o.id),J([...r,i,o]),e4({threadId:eC,userMessageId:s,assistantMessageId:l,userMessage:{content:i.content},threadRunOptions:{generateRelevantQuestions:!0,codeQuery:h,docQuery:x,modelName:e6}})},onSubmitSearch:ts,setDevPanelOpen:eh,setConversationIdForDev:ev,isPathnameInitialized:H,enableDeveloperMode:ew.value,contextInfo:null==eD?void 0:eD.contextInfo,fetchingContextInfo:eO,onDeleteMessage:e=>{if(!eC)return;let t=W.findIndex(t=>t.id===e),n=t-1,s=W[t-1];if(-1!==t&&(null==s?void 0:s.role)===N.uU.User){if(s.id.startsWith(ek)&&e.startsWith(ek)){let e=W.slice(0,n).concat(W.slice(t+1));J(e);return}e5(eC,s.id,e).then(e=>{if(e){f.A.error(e);return}let s=W.slice(0,n).concat(W.slice(t+1));J(s)})}},isThreadOwner:e$,onUpdateMessage:ez},children:(0,s.jsx)("div",{className:"transition-all",style:ti,children:(0,s.jsxs)(O.pO,{direction:"vertical",onLayout:e=>{(null==e?void 0:e[1])&&ej(e[1])},children:[(0,s.jsxs)(O.ee,{children:[(0,s.jsx)(eb,{threadIdFromURL:eL,streamingDone:!eY}),(0,s.jsxs)("main",{className:"h-[calc(100%-4rem)] pb-8 lg:pb-0",children:[(0,s.jsx)(U.ScrollArea,{className:"h-full",ref:el,children:(0,s.jsx)("div",{className:"mx-auto px-4 pb-32 lg:max-w-4xl lg:px-0",children:(0,s.jsx)("div",{className:"flex flex-col",children:ta.map((e,t)=>{var n,r;let a=t===ta.length-1;return e.question?(0,s.jsxs)(l.Fragment,{children:[!!e.question&&(0,s.jsx)(eI,{className:"pb-2 pt-8",message:e.question},e.question.id),!!e.answer&&(0,s.jsx)(eo,{className:"pb-8 pt-2",message:e.answer,clientCode:null===(r=e.question)||void 0===r?void 0:null===(n=r.attachment)||void 0===n?void 0:n.clientCode,isLoading:eY&&a,isLastAssistantMessage:a,showRelatedQuestion:a,isDeletable:!eY&&W.length>2},e.answer.id),!a&&(0,s.jsx)(F.Z,{})]},e.question.id):null})})})}),(0,s.jsx)(P.K,{className:(0,T.cn)("!fixed !bottom-[5.4rem] !right-4 !top-auto z-40 border-muted-foreground lg:!bottom-[2.85rem]",{hidden:em}),container:el.current,offset:100,style:"dark"===eu?{"--background":"0 0% 12%"}:{}}),(0,s.jsxs)("div",{className:(0,T.cn)("fixed bottom-5 left-0 z-30 flex min-h-[3rem] w-full flex-col items-center gap-y-2",{"opacity-100 translate-y-0":er,"opacity-0 translate-y-10":!er,hidden:em}),style:Object.assign({transition:"all 0.35s ease-out"},"dark"===eu?{"--background":"0 0% 12%"}:{}),children:[(0,s.jsxs)("div",{className:(0,T.cn)("absolute flex items-center gap-4"),style:e$?{top:"-2.5rem"}:void 0,children:[K&&(0,s.jsxs)(z.z,{className:"bg-background",variant:"outline",onClick:()=>e1(),children:[(0,s.jsx)(D.IconStop,{className:"mr-2"}),"Stop generating"]}),!K&&(0,s.jsxs)(z.z,{className:"bg-background",variant:"outline",onClick:tt,children:[te?(0,s.jsx)(D.IconCheck,{className:"mr-2 text-green-600"}):(0,s.jsx)(D.IconShare,{className:"mr-2"}),"Share Link"]})]}),e$&&(0,s.jsx)("div",{className:(0,T.cn)("relative z-20 flex justify-center self-stretch px-4"),children:(0,s.jsx)(q.Z,{onSearch:ts,className:"min-h-[5rem] lg:max-w-4xl",placeholder:"Ask a follow up question",isFollowup:!0,isLoading:eY,contextInfo:null==eD?void 0:eD.contextInfo,fetchingContextInfo:eO,modelName:e6,onModelSelect:e=>{(0,M.Eg)(e)},isModelLoading:e3,models:e7})})]})]})]}),(0,s.jsx)(O.Dp,{className:(0,T.cn)("hidden !h-[4px] border-none bg-background shadow-[0px_-4px_4px_rgba(0,0,0,0.2)] hover:bg-blue-500 active:bg-blue-500 dark:shadow-[0px_-4px_4px_rgba(255,255,255,0.2)]",em&&"block")}),(0,s.jsx)(O.ee,{collapsible:!0,collapsedSize:0,defaultSize:0,ref:ep,onCollapse:()=>eh(!1),className:"z-50",children:(0,s.jsx)(ef,{onClose:()=>eh(!1),value:e9,isFullScreen:100===eg,onToggleFullScreen:e=>{var t;let n=eN.current;e?n=100:100===n&&(n=45),null===(t=ep.current)||void 0===t||t.resize(n),ej(n),eN.current=eg}})})]})})}):(0,s.jsx)(s.Fragment,{})}let eM=(0,j.BX)("\n mutation UpdateThreadMessage($input: UpdateMessageInput!) {\n updateThreadMessage(input: $input)\n }\n");function e_(e){let{error:t}=e;return t.message===p.ir?(0,s.jsx)(Z.default,{}):(0,s.jsxs)("div",{className:"flex h-screen flex-col",children:[(0,s.jsx)(eb,{}),(0,s.jsx)("div",{className:"flex-1",children:(0,s.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(D.IconFileSearch,{className:"h-6 w-6"}),(0,s.jsx)("div",{className:"text-xl font-semibold",children:"Something went wrong"})]}),(0,s.jsx)("div",{children:"Failed to fetch the thread, please refresh the page or start a new thread"}),(0,s.jsxs)(a(),{href:"/",onClick:_.wh,className:(0,T.cn)((0,z.d)(),"mt-4 gap-2"),children:[(0,s.jsx)(D.IconPlus,{}),(0,s.jsx)("span",{children:"New Thread"})]})]})})]})}function eE(e){let t,n=[],s=!1;if(e){var l,r,a,i;n=(0,m.Z)((0,c.Z)([null==e?void 0:null===(l=e.codeSourceIds)||void 0===l?void 0:l[0]].concat(e.docSourceIds))),s=null!==(a=e.searchPublic)&&void 0!==a&&a,t=null!==(i=null===(r=e.codeSourceIds)||void 0===r?void 0:r[0])&&void 0!==i?i:void 0}return{sourceIdsForDocQuery:n,sourceIdForCodeQuery:t,searchPublic:s}}},69579:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return p}});var s=n(36164),l=n(42891),r=n.n(l),a=n(70652),i=n.n(a),o=n(83332),c=n(76531),d=n(1544),u=n(68172),m=n(30601),h=n(63743),x=n(31458),f=n(52569),v=n(7449);function p(){let[e]=(0,m.Hb)(),t=e?{height:"calc(100vh - ".concat(m.wt,")")}:{height:"100vh"};return(0,s.jsxs)("div",{style:t,className:"flex flex-col",children:[(0,s.jsx)(g,{}),(0,s.jsxs)("div",{className:"flex flex-1 flex-col items-center justify-center",children:[(0,s.jsx)("h2",{className:"mt-4 text-6xl font-bold tracking-tight text-foreground sm:text-7xl",children:"404"}),(0,s.jsx)("p",{className:"mt-4 text-lg text-muted-foreground",children:"Oops, it looks like the page you're looking for doesn't exist."}),(0,s.jsx)(i(),{className:(0,d.cn)("mt-6",(0,x.d)()),href:"/",children:"Home"})]})]})}function g(){return(0,s.jsxs)("header",{className:"flex h-16 items-center justify-between border-b px-4 lg:px-10",children:[(0,s.jsx)("div",{className:"flex items-center",children:(0,s.jsxs)(i(),{href:"/",children:[(0,s.jsx)(r(),{src:c.Z,alt:"logo",width:128,className:"dark:hidden"}),(0,s.jsx)(r(),{src:o.Z,alt:"logo",width:96,className:"hidden dark:block"})]})}),(0,s.jsxs)("div",{className:"flex items-center gap-6",children:[(0,s.jsx)(u.q,{children:(0,s.jsx)(h.T,{})}),(0,s.jsx)(v.Z,{showSetting:!0,children:(0,s.jsx)(f.SQ,{className:"h-10 w-10 border"})})]})]})}},73460:function(e,t,n){"use strict";n.d(t,{OL:function(){return p},_T:function(){return m},aR:function(){return o},f$:function(){return f},fY:function(){return h},le:function(){return g},vW:function(){return c},xo:function(){return x},yT:function(){return v}});var s=n(36164),l=n(3546),r=n(28961),a=n(1544),i=n(31458);let o=r.fC,c=r.xz,d=e=>{let{className:t,children:n,...l}=e;return(0,s.jsx)(r.h_,{className:(0,a.cn)(t),...l,children:(0,s.jsx)("div",{className:"fixed inset-0 z-50 flex items-end justify-center sm:items-center",children:n})})};d.displayName=r.h_.displayName;let u=l.forwardRef((e,t)=>{let{className:n,children:l,...i}=e;return(0,s.jsx)(r.aV,{className:(0,a.cn)("fixed inset-0 z-50 bg-background/80 backdrop-blur-sm transition-opacity animate-in fade-in",n),...i,ref:t})});u.displayName=r.aV.displayName;let m=l.forwardRef((e,t)=>{let{className:n,...l}=e;return(0,s.jsxs)(d,{children:[(0,s.jsx)(u,{}),(0,s.jsx)(r.VY,{ref:t,className:(0,a.cn)("fixed z-50 grid w-full max-w-lg scale-100 gap-4 border bg-background p-6 opacity-100 shadow-lg animate-in fade-in-90 slide-in-from-bottom-10 sm:rounded-lg sm:zoom-in-90 sm:slide-in-from-bottom-0 md:w-full",n),...l})]})});m.displayName=r.VY.displayName;let h=e=>{let{className:t,...n}=e;return(0,s.jsx)("div",{className:(0,a.cn)("flex flex-col space-y-2 text-center sm:text-left",t),...n})};h.displayName="AlertDialogHeader";let x=e=>{let{className:t,...n}=e;return(0,s.jsx)("div",{className:(0,a.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...n})};x.displayName="AlertDialogFooter";let f=l.forwardRef((e,t)=>{let{className:n,...l}=e;return(0,s.jsx)(r.Dx,{ref:t,className:(0,a.cn)("text-lg font-semibold",n),...l})});f.displayName=r.Dx.displayName;let v=l.forwardRef((e,t)=>{let{className:n,...l}=e;return(0,s.jsx)(r.dk,{ref:t,className:(0,a.cn)("text-sm text-muted-foreground",n),...l})});v.displayName=r.dk.displayName;let p=l.forwardRef((e,t)=>{let{className:n,...l}=e;return(0,s.jsx)(r.aU,{ref:t,className:(0,a.cn)((0,i.d)(),n),...l})});p.displayName=r.aU.displayName;let g=l.forwardRef((e,t)=>{let{className:n,...l}=e;return(0,s.jsx)(r.$j,{ref:t,className:(0,a.cn)((0,i.d)({variant:"outline"}),"mt-2 sm:mt-0",n),...l})});g.displayName=r.$j.displayName},98150:function(e,t,n){"use strict";n.d(t,{NI:function(){return v},Wi:function(){return u},l0:function(){return c},lX:function(){return f},pf:function(){return p},xJ:function(){return x},zG:function(){return g}});var s=n(36164),l=n(3546),r=n(74047),a=n(5493),i=n(1544),o=n(5266);let c=a.RV,d=l.createContext({}),u=e=>{let{...t}=e;return(0,s.jsx)(d.Provider,{value:{name:t.name},children:(0,s.jsx)(a.Qr,{...t})})},m=()=>{let e=l.useContext(d),t=l.useContext(h),{getFieldState:n,formState:s}=(0,a.Gc)(),r=e.name||"root",i=n(r,s);if(!s)throw Error("useFormField should be used within