@jait/gateway 0.1.101 → 0.1.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -667,7 +667,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
|
|
|
667
667
|
`,_,e.status==="running"&&f.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[#cccccc] dark:bg-[#c9d1d9] animate-pulse ml-0.5 align-text-bottom"})]}):H==="browserSnapshot"?f.jsx(Nte,{snapshot:x}):H==="browserScreenshot"?f.jsx(Tte,{path:C}):H==="editDiff"?f.jsx(mte,{filePath:String(e.args.path??""),oldText:c==="file.patch"||c==="edit"&&e.args.search!=null?String(e.args.search??""):void 0,newText:c==="file.patch"||c==="edit"&&e.args.replace!=null?String(e.args.replace??""):void 0,writtenContent:c==="file.write"||c==="edit"&&e.args.content!=null?String(e.args.content??""):void 0,isNewFile:c==="file.write"}):H==="output"?f.jsxs("pre",{className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap break-all","bg-[#1e1e1e] text-[#cccccc] dark:bg-[#0d1117] dark:text-[#c9d1d9]",e.result&&!e.result.ok&&"text-red-400 dark:text-red-400"),children:[_,e.status==="running"&&f.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[#cccccc] dark:bg-[#c9d1d9] animate-pulse ml-0.5 align-text-bottom"})]}):H==="runningHint"?f.jsxs("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-[#1e1e1e] text-[#cccccc] dark:bg-[#0d1117] dark:text-[#c9d1d9]"),children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(St,{className:"h-3 w-3 animate-spin"}),f.jsx("span",{children:N})]}),f.jsxs("div",{className:"mt-1 text-[11px] opacity-75",children:["Elapsed: ",f.jsx(M7,{startedAt:e.startedAt,completedAt:e.completedAt,now:s})]})]}):null;return f.jsxs(EA,{open:Y?r:!1,onOpenChange:i,children:[f.jsxs("div",{className:"group flex items-center gap-2 rounded-md px-3 py-2 hover:bg-muted/50 transition-colors",children:[Y?f.jsxs(OA,{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[f.jsx(Oo,{className:Ve("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",r&&"rotate-90")}),U]}):f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[f.jsx("span",{className:"h-3.5 w-3.5 shrink-0"}),U]}),E&&n&&f.jsxs(Qn,{children:[f.jsx(er,{asChild:!0,children:f.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:I=>{I.preventDefault(),I.stopPropagation(),n(O)},children:f.jsx(QE,{className:"h-3.5 w-3.5"})})}),f.jsx(Vn,{side:"top",children:"Open terminal"})]})]}),Y&&f.jsx(NA,{children:f.jsx("div",{className:"ml-[3.25rem] mr-3 mb-2",children:G})})]})}const C1=y.memo(Dte);C1.displayName="ToolCallCard";const n2=6;function zte({calls:e,onOpenTerminal:n}){const[r,i]=y.useState(!1);if(e.length===0)return null;const s=e.filter(p=>p.status==="running"||p.status==="pending"),o=e.filter(p=>p.status!=="running"&&p.status!=="pending"),a=!r&&o.length>n2,c=a?o.length-n2:0,d=a?o.slice(-n2):o,h=a?o.slice(0,c).filter(p=>p.status==="success").length:0,g=c-h;return f.jsxs("div",{className:"rounded-lg border bg-card my-2 divide-y",children:[a&&f.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[f.jsx(Oo,{className:"h-3 w-3"}),f.jsxs("span",{children:[c," earlier tool call",c!==1?"s":"",h>0&&f.jsxs("span",{className:"text-green-500 ml-1",children:["(",h," passed)"]}),g>0&&f.jsxs("span",{className:"text-red-500 ml-1",children:["(",g," failed)"]})]})]}),r&&o.slice(0,c).map(p=>f.jsx(C1,{call:p,onOpenTerminal:n},p.callId)),d.map(p=>f.jsx(C1,{call:p,onOpenTerminal:n},p.callId)),s.map(p=>f.jsx(C1,{call:p,onOpenTerminal:n},p.callId))]})}const rw=y.memo(zte);rw.displayName="ToolCallGroup";const iw=/^[A-Za-z]:[\\/]/,Lte=/^\//;function R7(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function $te(e){return iw.test(e)||Lte.test(e)}function Ite(e){if(!e)return null;const n=e.trim();if(!n)return null;let r=n,i="";const s=n.indexOf("#");s>=0&&(r=n.slice(0,s),i=n.slice(s+1));const o=decodeURIComponent(r);if(!$te(o))return null;const a={path:o},c=i.match(/^L(\d+)(?:C(\d+))?$/i);return c&&(a.line=Number.parseInt(c[1],10),c[2]&&(a.column=Number.parseInt(c[2],10))),a}function Bte(e,n){if(!n)return!1;const r=R7(e),i=R7(n);if(!r||!i)return!1;const s=iw.test(r)?r.toLowerCase():r,o=iw.test(i)?i.toLowerCase():i;return s===o||s.startsWith(`${o}/`)}function Fte(e){const n=e.replace(/\\/g,"/"),r=n.lastIndexOf("/");return r<=0?null:n.slice(0,r)}function Hte(e){const n=`
|
|
668
668
|
Referenced files:
|
|
669
669
|
`,r=e.indexOf(n);if(r===-1)return{text:e,files:[]};const i=e.slice(0,r).trimEnd(),s=e.slice(r+n.length),o=[];for(const a of s.split(`
|
|
670
|
-
`)){const c=a.match(/^- (.+)$/);if(c){const d=c[1].trim();o.push({path:d,name:d.split("/").pop()??d})}}return{text:i,files:o}}function AA(e){return e?"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-sm prose-p:leading-normal":"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-base prose-p:leading-relaxed"}function MA(e){if(e)return{a:({href:n,children:r,...
|
|
670
|
+
`)){const c=a.match(/^- (.+)$/);if(c){const d=c[1].trim();o.push({path:d,name:d.split("/").pop()??d})}}return{text:i,files:o}}function AA(e){return e?"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-sm prose-p:leading-normal":"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-base prose-p:leading-relaxed"}function MA(e){if(e)return{a:({href:n,children:r,ref:i,...s})=>{const o=Ite(n);return o?f.jsx("a",{href:n,...s,onClick:a=>{a.preventDefault(),e(o.path,o.line,o.column)},children:r}):f.jsx("a",{href:n,...s,children:r})}}}function Ute({content:e,compact:n,onOpenPath:r}){const i=y.useMemo(()=>MA(r),[r]);return f.jsx("div",{className:AA(n),children:f.jsx(bA,{remarkPlugins:[xA],components:i,children:e})})}function Vte({content:e,compact:n,onOpenPath:r}){const i=y.useMemo(()=>MA(r),[r]),s=({blockMatch:a})=>f.jsx(bA,{remarkPlugins:[xA],components:i,children:a.output}),{blockMatches:o}=BZ({llmOutput:e,blocks:[],fallbackBlock:{component:s,lookBack:NZ()},isStreamFinished:!1});return f.jsx("div",{className:AA(n),children:o.map((a,c)=>{const d=a.block.component;return f.jsx(d,{blockMatch:a},c)})})}function D7({content:e,compact:n,isStreaming:r,preferLlmUi:i,onOpenPath:s}){return i&&r?f.jsx(Vte,{content:e,compact:n,onOpenPath:s}):f.jsx(Ute,{content:e,compact:n,onOpenPath:s})}function Wte({messageId:e,messageIndex:n,messageFromEnd:r,role:i,content:s,displayContent:o,referencedFiles:a,thinking:c,thinkingDuration:d,toolCalls:h,segments:g,isStreaming:p,compact:_,preferLlmUi:b,onOpenTerminal:x,onEditMessage:C,onOpenPath:k}){const S=i==="user",{userDisplayText:E,userFiles:O}=y.useMemo(()=>{if(!S)return{userDisplayText:s,userFiles:[]};if(o)return{userDisplayText:o,userFiles:a??[]};const ee=Hte(s);return{userDisplayText:ee.text,userFiles:ee.files}},[S,s,o,a]),[N,T]=y.useState(!1),[P,D]=y.useState(!1),[H,Y]=y.useState(E),[M,B]=y.useState(!1),[U,G]=y.useState(!1),[F,I]=y.useState(null),A=y.useRef(null),W=y.useRef(null);y.useEffect(()=>()=>{A.current!==null&&window.clearTimeout(A.current)},[]),y.useEffect(()=>{P||Y(E)},[E,P]);const V=()=>{var ue;const ee=[];if(h&&h.length>0)for(const de of h){const We=de.tool.replace(/_/g,"."),Se=Object.entries(de.args).filter(([,De])=>De!=null&&De!=="").map(([De,at])=>`${De}: ${typeof at=="string"?at:JSON.stringify(at)}`).join(", "),ye=de.status==="success"?"✓":de.status==="error"?"✗":"…",me=de.completedAt&&de.startedAt?`${((de.completedAt-de.startedAt)/1e3).toFixed(1)}s`:"";if(ee.push(`[${ye} ${We}] ${Se}`),(ue=de.result)!=null&&ue.message){const De=de.result.message.length>500?de.result.message.slice(0,500)+"…":de.result.message;ee.push(De)}me&&ee.push(`Duration: ${me}`),ee.push("")}return s&&ee.push(s),ee.join(`
|
|
671
671
|
`).trim()},X=async()=>{const ee=V();if(ee){try{await navigator.clipboard.writeText(ee)}catch{const ue=document.createElement("textarea");ue.value=ee,ue.style.position="fixed",ue.style.opacity="0",document.body.appendChild(ue),ue.focus(),ue.select(),document.execCommand("copy"),document.body.removeChild(ue)}T(!0),A.current!==null&&window.clearTimeout(A.current),A.current=window.setTimeout(()=>T(!1),1200)}},L=S&&!!e&&!!C,z=L,Z=()=>{var ue;const ee=(ue=W.current)==null?void 0:ue.getBoundingClientRect().width;ee&&Number.isFinite(ee)?I(Math.round(ee)):I(null),Y(s),D(!0)},$=async ee=>{if(!L||!e||!C)return;const ue=ee.trim();ue&&await C(e,ue,n,r)},Q=async()=>{B(!0);try{await $(H),D(!1)}finally{B(!1)}},J=async()=>{if(z){G(!0);try{await $(s)}finally{G(!1)}}},re=()=>!s||P?null:f.jsxs("div",{className:Ve("absolute bottom-1.5 right-1.5 z-10 flex items-center gap-1 rounded-md border bg-background/90 p-0.5 shadow-sm","opacity-0 transition-opacity group-hover/message:opacity-100 focus-within:opacity-100",N&&"opacity-100"),children:[L&&f.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:Z,"aria-label":"Edit message",title:"Edit message",children:f.jsx(k3,{className:"h-3.5 w-3.5"})}),z&&f.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:ee=>{ee.preventDefault(),ee.stopPropagation(),J()},disabled:U,"aria-label":"Retry from this message",title:"Retry from this message",children:f.jsx(sO,{className:Ve("h-3.5 w-3.5",U&&"animate-spin")})}),f.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:X,className:"h-6 w-6 rounded-sm","aria-label":N?"Copied":"Copy message",title:N?"Copied":"Copy message",children:N?f.jsx(Lr,{className:"h-3.5 w-3.5"}):f.jsx(ZE,{className:"h-3.5 w-3.5"})})]});return f.jsx("div",{className:Ve("group/message flex gap-3",_?"py-2":"py-4",S&&"justify-end"),children:f.jsxs("div",{className:Ve("max-w-[85%] space-y-2",S&&"order-1"),children:[!S&&c&&f.jsx(hte,{content:c,isStreaming:!!p&&!s,duration:d}),!S&&g&&g.length>0?f.jsxs(f.Fragment,{children:[g.map((ee,ue)=>{if(ee.type==="toolGroup"){const de=(h??[]).filter(We=>ee.callIds.includes(We.callId));return de.length>0?f.jsx(rw,{calls:de,onOpenTerminal:x},`tg-${ue}`):null}return ee.content.trim()?f.jsx("div",{children:f.jsx(D7,{content:ee.content,compact:_,isStreaming:!!p&&ue===g.length-1,preferLlmUi:b,onOpenPath:k})},`ts-${ue}`):null}),p&&!s&&!g.some(ee=>ee.type==="text"&&ee.content.trim())&&f.jsxs("div",{className:"flex gap-1 py-2",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:0ms]"}),f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:150ms]"}),f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:300ms]"})]}),re()]}):f.jsxs(f.Fragment,{children:[h&&h.length>0&&f.jsx(rw,{calls:h,onOpenTerminal:x}),s?S&&P?f.jsxs("div",{className:"max-w-full rounded-lg border bg-muted/40 p-3",style:F?{width:`${F}px`}:void 0,children:[f.jsx("textarea",{value:H,onChange:ee=>Y(ee.target.value),rows:Math.max(3,Math.min(10,H.split(`
|
|
672
672
|
`).length+1)),className:"w-full resize-y rounded-md border bg-background p-2 text-sm leading-relaxed focus:outline-none focus:ring-1 focus:ring-ring"}),f.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[f.jsx(Ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>{D(!1),Y(s),I(null)},disabled:M,children:"Cancel"}),f.jsx(Ae,{type:"button",size:"sm",onClick:()=>{Q()},disabled:M||!H.trim(),children:M?"Sending…":"Send"})]})]}):S?f.jsxs("div",{ref:W,className:Ve("relative rounded-lg px-4 py-3 bg-muted",_?"text-sm leading-normal":"text-base leading-relaxed"),children:[f.jsx("div",{className:"whitespace-pre-wrap",children:E}),O.length>0&&f.jsx("div",{className:"flex flex-wrap gap-1 mt-2 pt-2 border-t border-foreground/5",children:O.map(ee=>f.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] leading-tight px-1.5 py-0.5 rounded bg-background/60 text-muted-foreground select-none",title:ee.path,children:[f.jsx(Rl,{filename:ee.name,className:"h-3.5 w-3.5 shrink-0"}),f.jsx("span",{className:"truncate max-w-[180px]",children:ee.name})]},ee.path))}),re()]}):f.jsxs("div",{className:"relative",children:[f.jsx(D7,{content:s,compact:_,isStreaming:p,preferLlmUi:b,onOpenPath:k}),re()]}):p&&!c?f.jsxs("div",{className:"flex gap-1 py-2",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:0ms]"}),f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:150ms]"}),f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:300ms]"})]}):null]})]})})}const sw=y.memo(Wte);sw.displayName="Message";const r2=[{value:"ask",label:"Ask",icon:iO,description:"Read-only — questions, explanations, analysis"},{value:"agent",label:"Agent",icon:j3,description:"Full agentic — reads, writes, runs commands"},{value:"plan",label:"Plan",icon:aI,description:"Propose changes — review before executing"}];function qte({mode:e,onChange:n,disabled:r,className:i}){const s=r2.find(a=>a.value===e)??r2[1],o=s.icon;return f.jsxs(Ul,{children:[f.jsx(Vl,{asChild:!0,disabled:r,children:f.jsxs("button",{type:"button",className:Ve("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",i),title:`Mode: ${s.label}`,children:[f.jsx(o,{className:"h-4 w-4"}),f.jsx("span",{children:s.label}),f.jsx(Ks,{className:"h-3 w-3 opacity-60"})]})}),f.jsx(Oa,{align:"start",side:"top",className:"w-64",children:r2.map(a=>{const c=a.icon,d=e===a.value;return f.jsxs(xs,{onClick:()=>n(a.value),className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[f.jsx(c,{className:"h-4 w-4 mt-0.5 shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium",children:a.label}),f.jsx("div",{className:"text-xs text-muted-foreground",children:a.description})]}),d&&f.jsx(Lr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},a.value)})})]})}const i2=[{value:"developer",label:"Developer",icon:_1,description:"Chat with the AI assistant — ask, plan, and execute"},{value:"manager",label:"Manager",icon:Rx,description:"Automation — delegate tasks to agent threads on repos"}];function Kte({mode:e,onChange:n,disabled:r,className:i,compact:s=!1}){const o=i2.find(c=>c.value===e)??i2[0],a=o.icon;return f.jsxs(Ul,{children:[f.jsx(Vl,{asChild:!0,disabled:r,children:f.jsxs("button",{type:"button",className:Ve("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",i),title:`Mode: ${o.label}`,"aria-label":`Mode: ${o.label}`,children:[f.jsx(a,{className:"h-4 w-4"}),!s&&f.jsx("span",{children:o.label}),f.jsx(Ks,{className:"h-3 w-3 opacity-60"})]})}),f.jsx(Oa,{align:"start",side:"top",className:"w-72",children:i2.map(c=>{const d=c.icon,h=e===c.value;return f.jsxs(xs,{onClick:()=>{requestAnimationFrame(()=>n(c.value))},className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[f.jsx(d,{className:"h-4 w-4 mt-0.5 shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium",children:c.label}),f.jsx("div",{className:"text-xs text-muted-foreground",children:c.description})]}),h&&f.jsx(Lr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},c.value)})})]})}var Gte=function(n){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(n,")")):{matches:!1}},s2,Yte=y.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(s2=Gte("dark"))!==null&&s2!==void 0&&s2.matches?"dark":"light"}),Xte=function(){return y.useContext(Yte)};const RA=(e,n)=>{if(n)return"row";switch(e){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},Jte=e=>{if(e)return["space-between","space-around","space-evenly"].includes(e)},Zte=(e,n)=>RA(e,n)==="row",sf=e=>typeof e=="number"?`${e}px`:e,Qte=({visible:e,flex:n,gap:r,direction:i,horizontal:s,align:o,justify:a,distribution:c,height:d,width:h,allowShrink:g,padding:p,paddingInline:_,paddingBlock:b,prefixCls:x,as:C="div",className:k,style:S,children:E,wrap:O,ref:N,...T})=>{const P=a||c,H=Zte(i,s)&&!h&&Jte(P)?"100%":sf(h),Y={...n!==void 0?{"--lobe-flex":String(n)}:{},...i||s?{"--lobe-flex-direction":RA(i,s)}:{},...O!==void 0?{"--lobe-flex-wrap":O}:{},...P!==void 0?{"--lobe-flex-justify":P}:{},...o!==void 0?{"--lobe-flex-align":o}:{},...H!==void 0?{"--lobe-flex-width":H}:{},...d!==void 0?{"--lobe-flex-height":sf(d)}:{},...p!==void 0?{"--lobe-flex-padding":sf(p)}:{},..._!==void 0?{"--lobe-flex-padding-inline":sf(_)}:{},...b!==void 0?{"--lobe-flex-padding-block":sf(b)}:{},...r!==void 0?{"--lobe-flex-gap":sf(r)}:{},...g?{minWidth:0}:{},...S},M="lobe-flex",B=[M,e===!1?`${M}--hidden`:void 0,x?`${x}-flex`:void 0,k].filter(Boolean).join(" ");return f.jsx(C,{ref:N,...T,className:B,style:Y,children:E})};var DA=y.memo(Qte);const ene=({children:e,ref:n,...r})=>f.jsx(DA,{...r,align:"center",justify:"center",ref:n,children:e});var tne=ene;const nne=new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+","gu");function rne(e){return Array.from(e.match(nne)??[])}function zA(e){return rne(e).map(r=>r.toLowerCase()).join("-")}y.createContext(null);var ine=function(n,r){if(r){if(n&&r==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!n&&r==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function cp(e){"@babel/helpers - typeof";return cp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},cp(e)}var sne=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function z7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function G0(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?z7(Object(r),!0).forEach(function(i){one(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function one(e,n,r){return n=ane(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ane(e){var n=lne(e,"string");return cp(n)=="symbol"?n:String(n)}function lne(e,n){if(cp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(cp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function cne(e,n){if(e==null)return{};var r=une(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function une(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var gi=y.memo(function(e){var n=e.shape,r=n===void 0?"circle":n,i=e.color,s=i===void 0?"#fff":i,o=e.background,a=e.size,c=e.style,d=e.iconMultiple,h=d===void 0?.75:d,g=e.Icon,p=e.iconStyle,_=e.iconClassName,b=cne(e,sne),x=Xte(),C=x.isDarkMode;return f.jsx(tne,G0(G0({flex:"none",style:G0({background:o,borderRadius:r==="circle"?"50%":Math.floor(a*.1),boxShadow:ine(C,o),color:s,height:a,width:a},c)},b),{},{children:g&&f.jsx(g,{className:_,color:s,size:a,style:G0({transform:"scale(".concat(h,")")},p)})}))}),Xm="OpenAI",fne=.75,dne=.1,LA="#000",$A="#19C37D",IA="#AB68FF",BA="#F86AA4",AS="#F9C322",FA="#0099FF",HA="#0000FE",hne=LA,pne="#fff",mne=.75;function up(e){"@babel/helpers - typeof";return up=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},up(e)}var gne=["size","style"];function L7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function o2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?L7(Object(r),!0).forEach(function(i){yne(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function yne(e,n,r){return n=vne(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function vne(e){var n=_ne(e,"string");return up(n)=="symbol"?n:String(n)}function _ne(e,n){if(up(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(up(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function bne(e,n){if(e==null)return{};var r=xne(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function xne(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var MS=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=bne(e,gne);return f.jsxs("svg",o2(o2({fill:"currentColor",fillRule:"evenodd",height:r,style:o2({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Xm}),f.jsx("path",{d:"M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"})]}))});function fp(e){"@babel/helpers - typeof";return fp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},fp(e)}var wne=["type"];function $7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function Sne(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?$7(Object(r),!0).forEach(function(i){Cne(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Cne(e,n,r){return n=jne(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function jne(e){var n=kne(e,"string");return fp(n)=="symbol"?n:String(n)}function kne(e,n){if(fp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(fp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Ene(e,n){if(e==null)return{};var r=One(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function One(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Nne=y.memo(function(e){var n=e.type,r=n===void 0?"normal":n,i=Ene(e,wne),s=y.useMemo(function(){switch(r){case"gpt3":return $A;case"gpt4":return IA;case"gpt5":return BA;case"o3":case"o1":return AS;case"oss":return FA;case"platform":return HA;default:return hne}},[r]);return f.jsx(gi,Sne({Icon:MS,"aria-label":Xm,background:s,color:pne,iconMultiple:mne},i))});function dp(e){"@babel/helpers - typeof";return dp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},dp(e)}var Tne=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function I7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function yl(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?I7(Object(r),!0).forEach(function(i){Pne(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Pne(e,n,r){return n=Ane(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Ane(e){var n=Mne(e,"string");return dp(n)=="symbol"?n:String(n)}function Mne(e,n){if(dp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(dp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Rne(e,n){if(e==null)return{};var r=Dne(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Dne(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var yi=y.memo(function(e){var n=e.Icon,r=e.style,i=e.Text,s=e.color,o=e.size,a=o===void 0?24:o,c=e.spaceMultiple,d=c===void 0?1:c,h=e.textMultiple,g=h===void 0?1:h,p=e.extra,_=e.extraStyle,b=e.showText,x=b===void 0?!0:b,C=e.showLogo,k=C===void 0?!0:C,S=e.extraClassName,E=e.iconProps,O=e.inverse,N=Rne(e,Tne),T=n&&k&&f.jsx(n,yl(yl({size:a},E),{},{style:yl(O?{marginLeft:a*d}:{marginRight:a*d},E==null?void 0:E.style)})),P=x&&i&&f.jsx(i,{size:a*g});return f.jsxs(DA,yl(yl({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:yl({color:s},r)},N),{},{children:[O?f.jsxs(f.Fragment,{children:[P,T]}):f.jsxs(f.Fragment,{children:[T,P]}),p&&f.jsx("span",{className:S,style:yl({fontSize:a*g*.95,lineHeight:1},_),children:p})]}))});function hp(e){"@babel/helpers - typeof";return hp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},hp(e)}var zne=["size","style"];function B7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function a2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?B7(Object(r),!0).forEach(function(i){Lne(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Lne(e,n,r){return n=$ne(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function $ne(e){var n=Ine(e,"string");return hp(n)=="symbol"?n:String(n)}function Ine(e,n){if(hp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(hp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Bne(e,n){if(e==null)return{};var r=Fne(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Fne(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var UA=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=Bne(e,zne);return f.jsxs("svg",a2(a2({fill:"currentColor",fillRule:"evenodd",height:r,style:a2({flex:"none",lineHeight:1},i),viewBox:"0 0 86 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Xm}),f.jsx("path",{d:"M10.703 2C5.916 2 2 5.916 2 10.703c0 4.787 3.916 8.704 8.703 8.704 4.787 0 8.704-3.893 8.704-8.704A8.698 8.698 0 0010.703 2zm0 14.288c-2.973 0-5.367-2.442-5.367-5.585S7.73 5.12 10.703 5.12c2.974 0 5.367 2.441 5.367 5.584s-2.393 5.585-5.367 5.585zM28.206 6.835c-1.57 0-3.094.629-3.892 1.693v-1.45h-3.143V24h3.143v-6.116c.798.99 2.273 1.523 3.892 1.523 3.385 0 6.045-2.66 6.045-6.286 0-3.626-2.66-6.286-6.044-6.286zm-.531 9.84c-1.79 0-3.385-1.402-3.385-3.554s1.596-3.554 3.385-3.554c1.789 0 3.384 1.402 3.384 3.554s-1.595 3.554-3.384 3.554zM41.649 6.835c-3.433 0-6.141 2.684-6.141 6.286 0 3.602 2.37 6.286 6.237 6.286 3.167 0 5.198-1.91 5.827-4.062h-3.07c-.388.895-1.475 1.523-2.78 1.523-1.62 0-2.854-1.136-3.144-2.756h9.139V12.88c0-3.288-2.297-6.044-6.068-6.044zm-3.047 5.053c.339-1.523 1.596-2.514 3.12-2.514 1.619 0 2.852 1.064 2.997 2.514h-6.117zM56.081 6.835c-1.402 0-2.877.629-3.553 1.669V7.077h-3.143v12.088h3.143v-6.503c0-1.886 1.015-3.119 2.659-3.119 1.523 0 2.345 1.16 2.345 2.78v6.842h3.143v-7.35c0-2.997-1.838-4.98-4.594-4.98zM68.724 2.242l-6.841 16.923h3.36l1.45-3.699h7.785l1.45 3.7h3.41L72.543 2.241h-3.82zm-.943 10.42l2.805-7.084 2.78 7.084H67.78zM83.81 2.242h-3.191v16.923h3.19V2.242z"})]}))});function pp(e){"@babel/helpers - typeof";return pp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},pp(e)}var Hne=["extraStyle"];function F7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function H7(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?F7(Object(r),!0).forEach(function(i){Une(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Une(e,n,r){return n=Vne(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Vne(e){var n=Wne(e,"string");return pp(n)=="symbol"?n:String(n)}function Wne(e,n){if(pp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(pp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function qne(e,n){if(e==null)return{};var r=Kne(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Kne(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Gne=y.memo(function(e){var n=e.extraStyle,r=qne(e,Hne);return f.jsx(yi,H7({Icon:MS,Text:UA,"aria-label":Xm,extraStyle:H7({fontWeight:600},n),spaceMultiple:dne,textMultiple:fne},r))}),_n=MS;_n.Text=UA;_n.Combine=Gne;_n.Avatar=Nne;_n.colorPrimary=LA;_n.colorGpt3=$A;_n.colorGpt4=IA;_n.colorGpt5=BA;_n.colorO1=AS;_n.colorO3=AS;_n.colorOss=FA;_n.colorPlatform=HA;_n.title=Xm;var Vf="Claude",Yne=.8,Xne=.1,VA="#D97757",Jne=VA,Zne="#fff",Qne=.75;function mp(e){"@babel/helpers - typeof";return mp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},mp(e)}var ere=["size","style"];function U7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function l2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?U7(Object(r),!0).forEach(function(i){tre(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function tre(e,n,r){return n=nre(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function nre(e){var n=rre(e,"string");return mp(n)=="symbol"?n:String(n)}function rre(e,n){if(mp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(mp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function ire(e,n){if(e==null)return{};var r=sre(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function sre(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var RS=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=ire(e,ere);return f.jsxs("svg",l2(l2({fill:"currentColor",fillRule:"evenodd",height:r,style:l2({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Vf}),f.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})]}))});function gp(e){"@babel/helpers - typeof";return gp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},gp(e)}function V7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function ore(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?V7(Object(r),!0).forEach(function(i){are(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function are(e,n,r){return n=lre(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function lre(e){var n=cre(e,"string");return gp(n)=="symbol"?n:String(n)}function cre(e,n){if(gp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(gp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function ure(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var fre=y.memo(function(e){var n=Object.assign({},(ure(e),e));return f.jsx(gi,ore({Icon:RS,"aria-label":Vf,background:Jne,color:Zne,iconMultiple:Qne},n))});function yp(e){"@babel/helpers - typeof";return yp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},yp(e)}var dre=["size","style"];function W7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function c2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?W7(Object(r),!0).forEach(function(i){hre(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function hre(e,n,r){return n=pre(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function pre(e){var n=mre(e,"string");return yp(n)=="symbol"?n:String(n)}function mre(e,n){if(yp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(yp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function gre(e,n){if(e==null)return{};var r=yre(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function yre(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var WA=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=gre(e,dre);return f.jsxs("svg",c2(c2({height:r,style:c2({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Vf}),f.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})]}))});function vp(e){"@babel/helpers - typeof";return vp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},vp(e)}var vre=["size","style"];function q7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function u2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?q7(Object(r),!0).forEach(function(i){_re(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function _re(e,n,r){return n=bre(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function bre(e){var n=xre(e,"string");return vp(n)=="symbol"?n:String(n)}function xre(e,n){if(vp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(vp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function wre(e,n){if(e==null)return{};var r=Sre(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Sre(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var qA=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=wre(e,vre);return f.jsxs("svg",u2(u2({fill:"currentColor",fillRule:"nonzero",height:r,style:u2({flex:"none",lineHeight:1},i),viewBox:"0 0 97 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Vf}),f.jsx("path",{d:"M13.623 20.222c-3.417 0-5.753-1.901-6.855-4.827a12.992 12.992 0 01-.838-4.772c0-4.907 2.206-8.315 7.08-8.315 3.275 0 5.297 1.425 6.448 4.826h1.402l-.19-4.69C18.709 1.18 16.258.543 13.276.543c-4.2 0-7.775 1.874-9.763 5.254a11.357 11.357 0 00-1.511 5.872c0 3.753 1.777 7.08 5.113 8.926a11.95 11.95 0 005.943 1.398c3.254 0 5.835-.617 8.122-1.697l.593-5.172h-1.43c-.858 2.362-1.88 3.78-3.574 4.534-.831.373-1.88.564-3.146.564zm14.74-17.914L28.499 0h-.967L23.23 1.29v.699l1.907.882v16.142c0 1.1-.565 1.344-2.043 1.528v1.18h7.319v-1.18c-1.484-.184-2.042-.428-2.042-1.528V2.315l-.007-.007zm29.104 19.685h.565l4.95-.937v-1.208l-.695-.054c-1.157-.109-1.457-.346-1.457-1.29V9.897l.137-2.763h-.783l-4.678.672v1.181l.457.082c1.266.183 1.64.536 1.64 1.419v7.67c-1.212.937-2.369 1.527-3.744 1.527-1.525 0-2.471-.774-2.471-2.58V9.905l.136-2.763h-.804l-4.684.672v1.181l.484.082c1.266.183 1.64.536 1.64 1.418v7.08c0 3 1.703 4.426 4.412 4.426 2.07 0 3.765-1.1 5.038-2.627L57.474 22l-.007-.007zm-13.602-9.55c0-3.836-2.043-5.309-5.733-5.309-3.254 0-5.616 1.344-5.616 3.57 0 .666.238 1.175.721 1.528l2.478-.326c-.109-.746-.163-1.201-.163-1.391 0-1.263.674-1.901 2.042-1.901 2.022 0 3.044 1.419 3.044 3.7v.746l-5.106 1.527c-1.702.462-2.67.863-3.316 1.8a3.386 3.386 0 00-.476 1.9c0 2.172 1.497 3.706 4.057 3.706 1.852 0 3.493-.835 4.922-2.416.51 1.581 1.294 2.416 2.69 2.416 1.13 0 2.15-.455 3.063-1.344l-.272-.937a4.363 4.363 0 01-1.178.163c-.783 0-1.157-.617-1.157-1.826v-5.607zm-6.536 7.378c-1.396 0-2.26-.808-2.26-2.226 0-.964.456-1.528 1.43-1.854l4.139-1.31v3.965c-1.321.997-2.097 1.425-3.31 1.425zm43.095 1.235v-1.208l-.701-.054c-1.158-.109-1.45-.346-1.45-1.29V2.308L78.409 0h-.974l-4.302 1.29v.699l1.906.882V8.18a6.024 6.024 0 00-3.656-1.046c-4.276 0-7.612 3.245-7.612 8.098 0 3.998 2.397 6.761 6.346 6.761 2.042 0 3.819-.99 4.922-2.525l-.136 2.525h.571l4.95-.937zm-8.96-12.313c2.043 0 3.575 1.181 3.575 3.353v6.11a4.91 4.91 0 01-3.547 1.425c-2.928 0-4.412-2.308-4.412-5.39 0-3.462 1.695-5.498 4.385-5.498zm19.424 3.055c-.381-1.792-1.484-2.81-3.016-2.81-2.288 0-3.874 1.717-3.874 4.18 0 3.646 1.934 6.008 5.059 6.008a5.858 5.858 0 005.03-2.953l.913.245c-.408 3.163-3.281 5.525-6.808 5.525-4.14 0-6.992-3.054-6.992-7.399 0-4.378 3.098-7.46 7.237-7.46 3.09 0 5.27 1.853 5.97 5.07l-10.783 3.3V14.05l7.264-2.247v-.006z"})]}))});function _p(e){"@babel/helpers - typeof";return _p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},_p(e)}var Cre=["type"];function K7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function jre(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?K7(Object(r),!0).forEach(function(i){kre(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function kre(e,n,r){return n=Ere(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Ere(e){var n=Ore(e,"string");return _p(n)=="symbol"?n:String(n)}function Ore(e,n){if(_p(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(_p(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Nre(e,n){if(e==null)return{};var r=Tre(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Tre(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Pre=y.memo(function(e){var n=e.type,r=n===void 0?"mono":n,i=Nre(e,Cre),s=r==="color"?WA:RS;return f.jsx(yi,jre({Icon:s,Text:qA,"aria-label":Vf,spaceMultiple:Xne,textMultiple:Yne},i))}),hi=RS;hi.Color=WA;hi.Text=qA;hi.Combine=Pre;hi.Avatar=fre;hi.colorPrimary=VA;hi.title=Vf;const ow="jait-gateway-url";function Are(){var e;return typeof window<"u"&&((e=window.location)!=null&&e.origin)&&window.location.origin!=="null"?window.location.origin:"http://localhost:8000"}function bp(e){return e.endsWith("/")?e.slice(0,-1):e}function G7(e){return e.replace(/^http/,"ws")}function Dl(){try{const e=localStorage.getItem(ow);return e&&e.trim()?e.trim():null}catch{return null}}function j1(e){try{e&&e.trim()?localStorage.setItem(ow,bp(e.trim())):localStorage.removeItem(ow)}catch{}window.dispatchEvent(new Event("jait-gateway-url-changed"))}function wn(){var r;const e=Dl();if(e)return bp(e);const n=(r=window.jaitDesktop)==null?void 0:r.gatewayUrl;return n?bp(n):Are()}function Jm(){const e=Dl();if(e)return bp(G7(e));const n=wn();return bp(G7(n))}function Y7(){var e;return!!(Dl()||(e=window.jaitDesktop)!=null&&e.gatewayUrl)}wn();Jm();const nn=wn();class Mre{getToken(){return localStorage.getItem("token")}getHeaders(n=!1){const r={};n&&(r["Content-Type"]="application/json");const i=this.getToken();return i&&(r.Authorization=`Bearer ${i}`),r}async listProviders(){const n=await fetch(`${nn}/api/providers`,{headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to list providers: ${n.statusText}`);const r=await n.json();return{providers:r.providers,remoteProviders:r.remoteProviders??[]}}async listProviderModels(n){const r=await fetch(`${nn}/api/providers/${n}/models`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to list models: ${r.statusText}`);return(await r.json()).models}async listThreads(n){const r=n?`?sessionId=${encodeURIComponent(n)}`:"",i=await fetch(`${nn}/api/threads${r}`,{headers:this.getHeaders()});if(!i.ok)throw new Error(`Failed to list threads: ${i.statusText}`);return(await i.json()).threads}async getThread(n){const r=await fetch(`${nn}/api/threads/${n}`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to get thread: ${r.statusText}`);return r.json()}async createThread(n){const r=await fetch(`${nn}/api/threads`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to create thread: ${r.statusText}`);return r.json()}async updateThread(n,r){const i=await fetch(`${nn}/api/threads/${n}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok)throw new Error(`Failed to update thread: ${i.statusText}`);return i.json()}async deleteThread(n){const r=await fetch(`${nn}/api/threads/${n}`,{method:"DELETE",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to delete thread: ${r.statusText}`)}async startThread(n,r){const i=typeof r=="string"?{message:r}:r??{},s=await fetch(`${nn}/api/threads/${n}/start`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(i)});if(!s.ok){const o=await s.json().catch(()=>({})),a=new Error(o.error||`Failed to start thread: ${s.statusText}`);throw o.code&&(a.code=o.code),a}return s.json()}async sendTurn(n,r){const i=typeof r=="string"?{message:r}:r,s=await fetch(`${nn}/api/threads/${n}/send`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(i)});if(!s.ok)throw new Error(`Failed to send turn: ${s.statusText}`)}async stopThread(n){const r=await fetch(`${nn}/api/threads/${n}/stop`,{method:"POST",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to stop thread: ${r.statusText}`)}async interruptThread(n){const r=await fetch(`${nn}/api/threads/${n}/interrupt`,{method:"POST",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to interrupt thread: ${r.statusText}`)}async approveToolCall(n,r,i){const s=await fetch(`${nn}/api/threads/${n}/approve`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({requestId:r,approved:i})});if(!s.ok)throw new Error(`Failed to approve: ${s.statusText}`)}async createPullRequest(n,r){const i=await fetch(`${nn}/api/threads/${n}/create-pr`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok){const s=await i.json().catch(()=>({}));throw new Error(s.error||`Failed to create pull request: ${i.statusText}`)}return i.json()}async getActivities(n,r){const i=typeof r=="number"?`?limit=${r}`:"",s=await fetch(`${nn}/api/threads/${n}/activities${i}`,{headers:this.getHeaders()});if(!s.ok)throw new Error(`Failed to get activities: ${s.statusText}`);return(await s.json()).activities}async listRepos(){const n=await fetch(`${nn}/api/repos`,{headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to list repos: ${n.statusText}`);return(await n.json()).repos}async createRepo(n){const r=await fetch(`${nn}/api/repos`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to create repo: ${r.statusText}`);return(await r.json()).repo}async updateRepo(n,r){const i=await fetch(`${nn}/api/repos/${n}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok)throw new Error(`Failed to update repo: ${i.statusText}`);return(await i.json()).repo}async deleteRepo(n){const r=await fetch(`${nn}/api/repos/${n}`,{method:"DELETE",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to delete repo: ${r.statusText}`)}async getRepoStrategy(n){const r=await fetch(`${nn}/api/repos/${n}/strategy`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to get strategy: ${r.statusText}`);return(await r.json()).strategy}async updateRepoStrategy(n,r){const i=await fetch(`${nn}/api/repos/${n}/strategy`,{method:"PUT",headers:this.getHeaders(!0),body:JSON.stringify({strategy:r})});if(!i.ok)throw new Error(`Failed to update strategy: ${i.statusText}`);return(await i.json()).strategy}async generateRepoStrategy(n){const r=await fetch(`${nn}/api/repos/${n}/strategy/generate`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({})});if(!r.ok){const s=await r.json().catch(()=>({error:r.statusText}));throw new Error(s.error||`Failed to generate strategy: ${r.statusText}`)}return(await r.json()).strategy}async listPlans(n){const r=await fetch(`${nn}/api/repos/${n}/plans`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to list plans: ${r.statusText}`);return(await r.json()).plans}async createPlan(n,r){const i=await fetch(`${nn}/api/repos/${n}/plans`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(r??{})});if(!i.ok)throw new Error(`Failed to create plan: ${i.statusText}`);return(await i.json()).plan}async getPlan(n){const r=await fetch(`${nn}/api/plans/${n}`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to get plan: ${r.statusText}`);return(await r.json()).plan}async updatePlan(n,r){const i=await fetch(`${nn}/api/plans/${n}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok)throw new Error(`Failed to update plan: ${i.statusText}`);return(await i.json()).plan}async deletePlan(n){const r=await fetch(`${nn}/api/plans/${n}`,{method:"DELETE",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to delete plan: ${r.statusText}`)}async generatePlanTasks(n,r){const i=await fetch(`${nn}/api/plans/${n}/generate`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({prompt:r})});if(!i.ok){const s=await i.json().catch(()=>({error:i.statusText}));throw new Error(s.error||`Failed to generate tasks: ${i.statusText}`)}return await i.json()}async startPlanTask(n,r){const i=await fetch(`${nn}/api/plans/${n}/tasks/${r}/start`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({})});if(!i.ok)throw new Error(`Failed to start task: ${i.statusText}`);return await i.json()}async startAllPlanTasks(n){const r=await fetch(`${nn}/api/plans/${n}/start`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({})});if(!r.ok){const i=await r.json().catch(()=>({error:r.statusText}));throw new Error(i.error||`Failed to start tasks: ${r.statusText}`)}return await r.json()}}const It=new Mre,Rre=({className:e})=>f.jsx(_n,{size:16,className:e}),Dre=({className:e})=>f.jsx(hi,{size:16,className:e}),f2=[{value:"jait",label:"Jait",icon:j3,description:"Native Jait agent loop with full tool access"},{value:"codex",label:"Codex",icon:Rre,description:"OpenAI Codex CLI — coding agent with MCP tools"},{value:"claude-code",label:"Claude Code",icon:Dre,description:"Anthropic Claude Code CLI — coding agent with MCP tools"}];function zre(e){const n=e.toLowerCase();return n.includes("not installed")||n.includes("not found")?"not installed":n.includes("not authenticated")||n.includes("login")?"not authenticated":"unavailable"}function Lre({provider:e,onChange:n,disabled:r,className:i,iconOnly:s=!1,repoRuntime:o,onMoveToGateway:a,sessionInfo:c,workspaceNodeId:d}){const[h,g]=y.useState({}),[p,_]=y.useState([]);y.useEffect(()=>{It.listProviders().then(({providers:H,remoteProviders:Y})=>{const M={};for(const B of H)M[B.id]=B;g(M),_(Y)}).catch(()=>{})},[]);const b=o!=null,x=(o==null?void 0:o.availableProviders)??[],C=(o==null?void 0:o.online)??!0,k=(o==null?void 0:o.loading)??!1,S=(o==null?void 0:o.hostType)==="gateway",E=!!(d&&d!=="gateway"),O=E?p.find(H=>H.nodeId===d):void 0,N=E&&!b,T=f2.find(H=>H.value===e)??f2[0],P=T.icon,D=b?S?"Gateway":o==null?void 0:o.locationLabel:N?(O==null?void 0:O.nodeName)??d:c!=null&&c.isRemote&&c.remoteNode?c.remoteNode.nodeName:void 0;return f.jsxs(Ul,{children:[f.jsx(Vl,{asChild:!0,disabled:r,children:f.jsxs("button",{type:"button",className:Ve("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",i),title:`Provider: ${T.label}${D?` · ${D}`:""}`,"aria-label":`Provider: ${T.label}${D?` on ${D}`:""}`,children:[f.jsx(P,{className:"h-4 w-4"}),!s&&f.jsx("span",{children:T.label}),!s&&D&&f.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-blue-500",children:[f.jsx(Hi,{className:"h-3 w-3"}),D]}),f.jsx(Ks,{className:"h-3 w-3 opacity-60"})]})}),f.jsxs(Oa,{align:"start",side:"top",className:"w-72",children:[b&&!S&&!C&&!k&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"px-2 py-1.5 text-xs text-amber-600 dark:text-amber-400",children:"Device is offline — only Jait (gateway) is available"}),f.jsx(_o,{})]}),b&&k&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground",children:[f.jsx(St,{className:"h-3 w-3 animate-spin"}),"Connecting to device…"]}),f.jsx(_o,{})]}),N&&!O&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"px-2 py-1.5 text-xs text-amber-600 dark:text-amber-400",children:"Device is offline — only Jait (gateway) is available"}),f.jsx(_o,{})]}),f2.map(H=>{const Y=H.icon,M=e===H.value,B=h[H.value];let U,G,F,I;if(b)H.value==="jait"?(U=!0,I="Gateway"):S?(U=(B==null?void 0:B.available)!==!1,G=B==null?void 0:B.unavailableReason,I="Gateway"):k?(U=!1,G="Checking device…"):C?(U=x.includes(H.value),G=U?void 0:"Not available on this device",I=(o==null?void 0:o.locationLabel)??"device"):(U=!1,G="Device is offline");else if(N)H.value==="jait"?(U=!0,I="Gateway"):O?(U=O.providers.includes(H.value),G=U?void 0:"Not available on this device",I=O.nodeName):(U=!1,G="Device is offline");else{const A=(B==null?void 0:B.available)!==!1;G=B==null?void 0:B.unavailableReason,F=A?void 0:p.find(W=>W.providers.includes(H.value)),U=A||!!F,I=!(B!=null&&B.available)&&F?F.nodeName:"Gateway"}return f.jsxs(xs,{onClick:()=>n(H.value),disabled:!U,className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[f.jsx(Y,{className:"h-4 w-4 mt-0.5 shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"text-sm font-medium flex items-center gap-1.5",children:[H.label,U&&I&&f.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-0.5",children:[f.jsx(Hi,{className:"h-3 w-3"}),I]}),!U&&f.jsxs("span",{className:"text-[10px] text-destructive/80 flex items-center gap-0.5",children:[f.jsx(mf,{className:"h-3 w-3"}),G?zre(G):"unavailable"]})]}),f.jsx("div",{className:"text-xs text-muted-foreground leading-snug",children:!U&&G?G:H.description})]}),M&&f.jsx(Lr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},H.value)}),b&&!S&&!C&&!k&&a&&f.jsxs(f.Fragment,{children:[f.jsx(_o,{}),f.jsxs(xs,{onClick:a,className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[f.jsx(fs,{className:"h-4 w-4 mt-0.5 shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium",children:"Move to Gateway"}),f.jsx("div",{className:"text-xs text-muted-foreground leading-snug",children:"Run this repo on the gateway server instead"})]})]})]})]})]})}function $re({provider:e,model:n,onChange:r,disabled:i,className:s}){var g;const[o,a]=y.useState([]),[c,d]=y.useState(!1);y.useEffect(()=>{if(a([]),e==="jait"){d(!1);return}let p=!1;return d(!0),It.listProviderModels(e).then(_=>{p||a(_)}).catch(()=>{p||a([])}).finally(()=>{p||d(!1)}),()=>{p=!0}},[e]),y.useEffect(()=>{if(e==="jait"||c||o.length===0||n&&o.some(b=>b.id===n))return;const p=o.find(b=>b.isDefault)??o[0]??null,_=(p==null?void 0:p.id)??null;_!==n&&r(_)},[e,c,n,o,r]);const h=n?((g=o.find(p=>p.id===n))==null?void 0:g.name)??n:"model";return f.jsxs(Ul,{children:[f.jsx(Vl,{asChild:!0,disabled:i||c,children:f.jsxs("button",{type:"button",className:Ve("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",s),title:`Model: ${n??"none"}`,children:[c?f.jsx(St,{className:"h-3 w-3 animate-spin"}):f.jsx("span",{className:"font-mono text-[11px]",children:h}),f.jsx(Ks,{className:"h-3 w-3 opacity-60"})]})}),f.jsxs(Oa,{align:"start",side:"top",className:"w-64",children:[f.jsx(Vy,{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Model"}),f.jsx(_o,{}),o.map(p=>f.jsxs(xs,{onClick:()=>r(p.id),className:"flex items-start gap-2 py-1.5 cursor-pointer",children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"text-sm font-medium",children:[p.name,p.isDefault&&f.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground font-normal",children:"(default)"})]}),p.description&&f.jsx("div",{className:"text-[11px] text-muted-foreground leading-snug",children:p.description})]}),n===p.id&&f.jsx(Lr,{className:"h-3.5 w-3.5 mt-0.5 text-primary shrink-0"})]},p.id)),o.length===0&&!c&&f.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No models available"})]})]})}const Ire=768;function DS(){const e=()=>window.innerWidth<Ire,[n,r]=y.useState(e);return y.useEffect(()=>{const i=()=>r(e());return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),n}const Bre="https://cdn.jsdelivr.net/gh/vscode-icons/vscode-icons@12.9.0/icons/",X7=[];function Y0(e,n){const r=document.createElement("span");r.contentEditable="false",r.setAttribute("data-file-path",e.path),r.setAttribute("data-file-name",e.name),r.className="inline-flex items-center gap-0.5 align-baseline text-[12px] leading-tight pl-0.5 pr-0 py-[1px] mx-[2px] rounded bg-muted text-foreground select-none cursor-default whitespace-nowrap";const i=document.createElement("span");i.className="inline-flex items-center shrink-0",i.innerHTML=`<img src="${Bre}${Fre(e.name)}" alt="" class="h-3.5 w-3.5" draggable="false" />`,r.appendChild(i);const s=document.createElement("span");s.className="truncate max-w-[140px]",s.textContent=e.name,r.appendChild(s);const o=document.createElement("button");return o.type="button",o.className="inline-flex items-center p-0.5 rounded hover:bg-foreground/10 transition-colors",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',o.addEventListener("mousedown",a=>{a.preventDefault(),a.stopPropagation()}),o.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),r.remove(),n==null||n(e.path)}),r.appendChild(o),r}function Fre(e){return Tl.getIconForFile(e)??Tl.DEFAULT_FILE}function fo(e){let n="";for(const r of e.childNodes)if(r.nodeType===Node.TEXT_NODE)n+=r.textContent??"";else if(r instanceof HTMLElement){if(r.hasAttribute("data-file-path"))continue;r.tagName==="BR"?n+=`
|
|
673
673
|
`:n+=fo(r)}return n}function Hre(e){const n=[];return e.querySelectorAll("[data-file-path]").forEach(r=>{n.push(r.getAttribute("data-file-path"))}),n}function oh(e){const n=[];return e.querySelectorAll("[data-file-path]").forEach(r=>{n.push({path:r.getAttribute("data-file-path"),name:r.getAttribute("data-file-name")||r.getAttribute("data-file-path").split("/").pop()})}),n}function d2(e){const n=window.getSelection();if(n){const r=document.createRange();r.selectNodeContents(e),r.collapse(!1),n.removeAllRanges(),n.addRange(r)}}function Ure({levels:e=[]}){const n=e.length>0?e:Array.from({length:18},()=>.08);return f.jsx("span",{className:"flex h-7 items-end gap-1 rounded-full border border-red-500/20 bg-red-500/10 px-2.5 py-1",children:n.map((r,i)=>f.jsx("span",{className:"w-1 rounded-full bg-red-500 transition-[height,opacity] duration-100 ease-out",style:{height:`${6+r*16}px`,opacity:.35+r*.65}},i))})}const X0=y.forwardRef(function({value:n,onChange:r,onSubmit:i,onStop:s,onQueue:o,isLoading:a,disabled:c,controlsDisabled:d,placeholder:h="Ask anything...",className:g,footerLeadingContent:p,onVoiceInput:_,voiceRecording:b,voiceLevels:x,voiceTranscribing:C,onVoiceStop:k,viewMode:S,onViewModeChange:E,mode:O,onModeChange:N,provider:T,onProviderChange:P,cliModel:D,onCliModelChange:H,repoRuntime:Y,onMoveToGateway:M,sessionInfo:B,workspaceNodeId:U,availableFiles:G=X7,onSearchFiles:F,workspaceOpen:I=!1},A){const W=y.useRef(null),V=y.useRef(null),X=DS(),[L,z]=y.useState(!1),Z=y.useRef(0),[$,Q]=y.useState(!n),[J,re]=y.useState(!1),[ee,ue]=y.useState(""),[de,We]=y.useState(0),Se=y.useRef(!1);y.useEffect(()=>{Se.current=J},[J]);const ye=y.useRef(G);y.useEffect(()=>{ye.current=G},[G]);const me=y.useRef(r);y.useEffect(()=>{me.current=r},[r]);const De=y.useRef(F);y.useEffect(()=>{De.current=F},[F]);const at=y.useRef(I);y.useEffect(()=>{at.current=I},[I]);const[ht,Ne]=y.useState([]),[qe,ze]=y.useState(!1),Fe=y.useRef(null),Ze=!!c,Te=!!(d??c??!1)||!!a,ce=!!(S&&E),_e=!!(T&&P),Oe=!!(T&&T!=="jait"&&H),ie=!!(O&&N&&(!T||T==="jait")&&S!=="manager"),ae=ce||_e||Oe||ie||!!p,xe=y.useRef(!1),Ce=y.useCallback(He=>{var st;const $e=W.current;$e&&((st=$e.querySelector(`[data-file-path="${CSS.escape(He)}"]`))==null||st.remove(),xe.current=!0,me.current(fo($e)),xe.current=!1,Q(!fo($e).trim()&&!$e.querySelector("[data-file-path]")))},[]);y.useImperativeHandle(A,()=>({insertChip:He=>{const $e=W.current;if(!$e||$e.querySelector(`[data-file-path="${CSS.escape(He.path)}"]`))return;const st=Y0(He,Ce);$e.appendChild(st),$e.appendChild(document.createTextNode(" ")),d2($e),xe.current=!0,me.current(fo($e)),xe.current=!1,Q(!1)}}),[Ce]),y.useEffect(()=>{var Ot;if(!J){Ne(Je=>Je.length===0?Je:X7);return}(Ot=Fe.current)==null||Ot.abort();const He=new Set(W.current?Hre(W.current):[]),$e=ye.current;if(!ee){const Je=$e.filter(ct=>!He.has(ct.path)).slice(0,15);Ne(Je),ze(!1);return}const st=$e.filter(Je=>{if(He.has(Je.path))return!1;const ct=ee.toLowerCase();return Je.name.toLowerCase().includes(ct)||Je.path.toLowerCase().includes(ct)}).slice(0,10);Ne(st);const rn=De.current;if(!rn){ze(!1);return}ze(!0);const Dt=new AbortController;Fe.current=Dt;const Kt=setTimeout(async()=>{try{const Je=await rn(ee,15,Dt.signal);if(Dt.signal.aborted)return;const ct=new Set,lt=[];for(const dt of Je)He.has(dt.path)||ct.has(dt.path)||(ct.add(dt.path),lt.push(dt));for(const dt of st)ct.has(dt.path)||(ct.add(dt.path),lt.push(dt));Ne(lt.slice(0,15))}catch{}finally{Dt.signal.aborted||ze(!1)}},150);return()=>{clearTimeout(Kt),Dt.abort()}},[J,ee]),y.useEffect(()=>{var st;const He=W.current;if(!He||xe.current)return;fo(He)!==n&&(xe.current=!0,He.innerHTML="",n&&He.appendChild(document.createTextNode(n)),Q(!n&&!((st=W.current)!=null&&st.querySelector("[data-file-path]"))),xe.current=!1)},[n]),y.useEffect(()=>{if(!J)return;const He=$e=>{V.current&&!V.current.contains($e.target)&&re(!1)};return document.addEventListener("mousedown",He),()=>document.removeEventListener("mousedown",He)},[J]),y.useEffect(()=>{We(0)},[ee]);const je=y.useCallback(He=>{const $e=W.current;if(!$e)return;const st=window.getSelection();if(st&&st.rangeCount>0){const rn=st.getRangeAt(0),Dt=rn.startContainer;if(Dt.nodeType===Node.TEXT_NODE&&Dt.textContent){const Kt=Dt.textContent,Ot=rn.startOffset,Je=Kt.lastIndexOf("@",Ot-1);if(Je>=0){Dt.textContent=Kt.slice(0,Je)+Kt.slice(Ot);const ct=Dt.textContent.slice(0,Je),lt=Dt.textContent.slice(Je);Dt.textContent=ct;const dt=Y0(He,Ce),yn=document.createTextNode(lt||" "),Xe=Dt.parentNode;Dt.nextSibling?(Xe.insertBefore(yn,Dt.nextSibling),Xe.insertBefore(dt,yn)):(Xe.appendChild(dt),Xe.appendChild(yn));const _t=document.createRange();_t.setStart(yn,lt?0:1),_t.collapse(!0),st.removeAllRanges(),st.addRange(_t)}}}re(!1),ue(""),xe.current=!0,r(fo($e)),xe.current=!1},[r]);y.useEffect(()=>{const He=W.current;if(!He)return;const $e=()=>{xe.current=!0;const st=fo(He);me.current(st),Q(!st.trim()&&!He.querySelector("[data-file-path]")),xe.current=!1;const rn=window.getSelection();if(!rn||rn.rangeCount===0)return;const Dt=rn.getRangeAt(0);let Kt=Dt.startContainer,Ot=Dt.startOffset;if(Kt.nodeType!==Node.TEXT_NODE){const lt=Kt.childNodes[Ot-1]??Kt.childNodes[Ot];if((lt==null?void 0:lt.nodeType)===Node.TEXT_NODE)Kt=lt,Ot=lt.length;else if(Ot>0&&Kt.childNodes[Ot-1]){let dt=Kt.childNodes[Ot-1];for(;dt&&dt.nodeType!==Node.TEXT_NODE&&dt.lastChild;)dt=dt.lastChild;if((dt==null?void 0:dt.nodeType)===Node.TEXT_NODE)Kt=dt,Ot=dt.length;else return}else return}const Je=Kt.textContent??"";if(Se.current){const lt=Je.lastIndexOf("@",Ot-1);if(lt<0||Ot<=lt){re(!1);return}const dt=Je.slice(lt+1,Ot);dt.includes(" ")||dt.includes(`
|
|
@@ -667,7 +667,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${n.do
|
|
|
667
667
|
`,_,e.status==="running"&&f.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[#cccccc] dark:bg-[#c9d1d9] animate-pulse ml-0.5 align-text-bottom"})]}):H==="browserSnapshot"?f.jsx(Nte,{snapshot:x}):H==="browserScreenshot"?f.jsx(Tte,{path:C}):H==="editDiff"?f.jsx(mte,{filePath:String(e.args.path??""),oldText:c==="file.patch"||c==="edit"&&e.args.search!=null?String(e.args.search??""):void 0,newText:c==="file.patch"||c==="edit"&&e.args.replace!=null?String(e.args.replace??""):void 0,writtenContent:c==="file.write"||c==="edit"&&e.args.content!=null?String(e.args.content??""):void 0,isNewFile:c==="file.write"}):H==="output"?f.jsxs("pre",{className:Ve("text-xs font-mono leading-5 rounded-md px-3 py-2 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap break-all","bg-[#1e1e1e] text-[#cccccc] dark:bg-[#0d1117] dark:text-[#c9d1d9]",e.result&&!e.result.ok&&"text-red-400 dark:text-red-400"),children:[_,e.status==="running"&&f.jsx("span",{className:"inline-block w-1.5 h-3.5 bg-[#cccccc] dark:bg-[#c9d1d9] animate-pulse ml-0.5 align-text-bottom"})]}):H==="runningHint"?f.jsxs("div",{className:Ve("rounded-md border px-3 py-2 text-xs","bg-[#1e1e1e] text-[#cccccc] dark:bg-[#0d1117] dark:text-[#c9d1d9]"),children:[f.jsxs("div",{className:"flex items-center gap-2",children:[f.jsx(St,{className:"h-3 w-3 animate-spin"}),f.jsx("span",{children:N})]}),f.jsxs("div",{className:"mt-1 text-[11px] opacity-75",children:["Elapsed: ",f.jsx(M7,{startedAt:e.startedAt,completedAt:e.completedAt,now:s})]})]}):null;return f.jsxs(EA,{open:Y?r:!1,onOpenChange:i,children:[f.jsxs("div",{className:"group flex items-center gap-2 rounded-md px-3 py-2 hover:bg-muted/50 transition-colors",children:[Y?f.jsxs(OA,{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[f.jsx(Oo,{className:Ve("h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform duration-200",r&&"rotate-90")}),U]}):f.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 text-left",children:[f.jsx("span",{className:"h-3.5 w-3.5 shrink-0"}),U]}),E&&n&&f.jsxs(Qn,{children:[f.jsx(er,{asChild:!0,children:f.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:I=>{I.preventDefault(),I.stopPropagation(),n(O)},children:f.jsx(QE,{className:"h-3.5 w-3.5"})})}),f.jsx(Vn,{side:"top",children:"Open terminal"})]})]}),Y&&f.jsx(NA,{children:f.jsx("div",{className:"ml-[3.25rem] mr-3 mb-2",children:G})})]})}const C1=y.memo(Dte);C1.displayName="ToolCallCard";const n2=6;function zte({calls:e,onOpenTerminal:n}){const[r,i]=y.useState(!1);if(e.length===0)return null;const s=e.filter(p=>p.status==="running"||p.status==="pending"),o=e.filter(p=>p.status!=="running"&&p.status!=="pending"),a=!r&&o.length>n2,c=a?o.length-n2:0,d=a?o.slice(-n2):o,h=a?o.slice(0,c).filter(p=>p.status==="success").length:0,g=c-h;return f.jsxs("div",{className:"rounded-lg border bg-card my-2 divide-y",children:[a&&f.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex w-full items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground hover:bg-muted/50 transition-colors",children:[f.jsx(Oo,{className:"h-3 w-3"}),f.jsxs("span",{children:[c," earlier tool call",c!==1?"s":"",h>0&&f.jsxs("span",{className:"text-green-500 ml-1",children:["(",h," passed)"]}),g>0&&f.jsxs("span",{className:"text-red-500 ml-1",children:["(",g," failed)"]})]})]}),r&&o.slice(0,c).map(p=>f.jsx(C1,{call:p,onOpenTerminal:n},p.callId)),d.map(p=>f.jsx(C1,{call:p,onOpenTerminal:n},p.callId)),s.map(p=>f.jsx(C1,{call:p,onOpenTerminal:n},p.callId))]})}const rw=y.memo(zte);rw.displayName="ToolCallGroup";const iw=/^[A-Za-z]:[\\/]/,Lte=/^\//;function R7(e){return e.replace(/\\/g,"/").replace(/\/+$/,"")}function $te(e){return iw.test(e)||Lte.test(e)}function Ite(e){if(!e)return null;const n=e.trim();if(!n)return null;let r=n,i="";const s=n.indexOf("#");s>=0&&(r=n.slice(0,s),i=n.slice(s+1));const o=decodeURIComponent(r);if(!$te(o))return null;const a={path:o},c=i.match(/^L(\d+)(?:C(\d+))?$/i);return c&&(a.line=Number.parseInt(c[1],10),c[2]&&(a.column=Number.parseInt(c[2],10))),a}function Bte(e,n){if(!n)return!1;const r=R7(e),i=R7(n);if(!r||!i)return!1;const s=iw.test(r)?r.toLowerCase():r,o=iw.test(i)?i.toLowerCase():i;return s===o||s.startsWith(`${o}/`)}function Fte(e){const n=e.replace(/\\/g,"/"),r=n.lastIndexOf("/");return r<=0?null:n.slice(0,r)}function Hte(e){const n=`
|
|
668
668
|
Referenced files:
|
|
669
669
|
`,r=e.indexOf(n);if(r===-1)return{text:e,files:[]};const i=e.slice(0,r).trimEnd(),s=e.slice(r+n.length),o=[];for(const a of s.split(`
|
|
670
|
-
`)){const c=a.match(/^- (.+)$/);if(c){const d=c[1].trim();o.push({path:d,name:d.split("/").pop()??d})}}return{text:i,files:o}}function AA(e){return e?"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-sm prose-p:leading-normal":"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-base prose-p:leading-relaxed"}function MA(e){if(e)return{a:({href:n,children:r,...
|
|
670
|
+
`)){const c=a.match(/^- (.+)$/);if(c){const d=c[1].trim();o.push({path:d,name:d.split("/").pop()??d})}}return{text:i,files:o}}function AA(e){return e?"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-sm prose-p:leading-normal":"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-code:before:content-none prose-code:after:content-none prose-base prose-p:leading-relaxed"}function MA(e){if(e)return{a:({href:n,children:r,ref:i,...s})=>{const o=Ite(n);return o?f.jsx("a",{href:n,...s,onClick:a=>{a.preventDefault(),e(o.path,o.line,o.column)},children:r}):f.jsx("a",{href:n,...s,children:r})}}}function Ute({content:e,compact:n,onOpenPath:r}){const i=y.useMemo(()=>MA(r),[r]);return f.jsx("div",{className:AA(n),children:f.jsx(bA,{remarkPlugins:[xA],components:i,children:e})})}function Vte({content:e,compact:n,onOpenPath:r}){const i=y.useMemo(()=>MA(r),[r]),s=({blockMatch:a})=>f.jsx(bA,{remarkPlugins:[xA],components:i,children:a.output}),{blockMatches:o}=BZ({llmOutput:e,blocks:[],fallbackBlock:{component:s,lookBack:NZ()},isStreamFinished:!1});return f.jsx("div",{className:AA(n),children:o.map((a,c)=>{const d=a.block.component;return f.jsx(d,{blockMatch:a},c)})})}function D7({content:e,compact:n,isStreaming:r,preferLlmUi:i,onOpenPath:s}){return i&&r?f.jsx(Vte,{content:e,compact:n,onOpenPath:s}):f.jsx(Ute,{content:e,compact:n,onOpenPath:s})}function Wte({messageId:e,messageIndex:n,messageFromEnd:r,role:i,content:s,displayContent:o,referencedFiles:a,thinking:c,thinkingDuration:d,toolCalls:h,segments:g,isStreaming:p,compact:_,preferLlmUi:b,onOpenTerminal:x,onEditMessage:C,onOpenPath:k}){const S=i==="user",{userDisplayText:E,userFiles:O}=y.useMemo(()=>{if(!S)return{userDisplayText:s,userFiles:[]};if(o)return{userDisplayText:o,userFiles:a??[]};const ee=Hte(s);return{userDisplayText:ee.text,userFiles:ee.files}},[S,s,o,a]),[N,T]=y.useState(!1),[P,D]=y.useState(!1),[H,Y]=y.useState(E),[M,B]=y.useState(!1),[U,G]=y.useState(!1),[F,I]=y.useState(null),A=y.useRef(null),W=y.useRef(null);y.useEffect(()=>()=>{A.current!==null&&window.clearTimeout(A.current)},[]),y.useEffect(()=>{P||Y(E)},[E,P]);const V=()=>{var ue;const ee=[];if(h&&h.length>0)for(const de of h){const We=de.tool.replace(/_/g,"."),Se=Object.entries(de.args).filter(([,De])=>De!=null&&De!=="").map(([De,at])=>`${De}: ${typeof at=="string"?at:JSON.stringify(at)}`).join(", "),ye=de.status==="success"?"✓":de.status==="error"?"✗":"…",me=de.completedAt&&de.startedAt?`${((de.completedAt-de.startedAt)/1e3).toFixed(1)}s`:"";if(ee.push(`[${ye} ${We}] ${Se}`),(ue=de.result)!=null&&ue.message){const De=de.result.message.length>500?de.result.message.slice(0,500)+"…":de.result.message;ee.push(De)}me&&ee.push(`Duration: ${me}`),ee.push("")}return s&&ee.push(s),ee.join(`
|
|
671
671
|
`).trim()},X=async()=>{const ee=V();if(ee){try{await navigator.clipboard.writeText(ee)}catch{const ue=document.createElement("textarea");ue.value=ee,ue.style.position="fixed",ue.style.opacity="0",document.body.appendChild(ue),ue.focus(),ue.select(),document.execCommand("copy"),document.body.removeChild(ue)}T(!0),A.current!==null&&window.clearTimeout(A.current),A.current=window.setTimeout(()=>T(!1),1200)}},L=S&&!!e&&!!C,z=L,Z=()=>{var ue;const ee=(ue=W.current)==null?void 0:ue.getBoundingClientRect().width;ee&&Number.isFinite(ee)?I(Math.round(ee)):I(null),Y(s),D(!0)},$=async ee=>{if(!L||!e||!C)return;const ue=ee.trim();ue&&await C(e,ue,n,r)},Q=async()=>{B(!0);try{await $(H),D(!1)}finally{B(!1)}},J=async()=>{if(z){G(!0);try{await $(s)}finally{G(!1)}}},re=()=>!s||P?null:f.jsxs("div",{className:Ve("absolute bottom-1.5 right-1.5 z-10 flex items-center gap-1 rounded-md border bg-background/90 p-0.5 shadow-sm","opacity-0 transition-opacity group-hover/message:opacity-100 focus-within:opacity-100",N&&"opacity-100"),children:[L&&f.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:Z,"aria-label":"Edit message",title:"Edit message",children:f.jsx(k3,{className:"h-3.5 w-3.5"})}),z&&f.jsx(Ae,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 rounded-sm",onClick:ee=>{ee.preventDefault(),ee.stopPropagation(),J()},disabled:U,"aria-label":"Retry from this message",title:"Retry from this message",children:f.jsx(sO,{className:Ve("h-3.5 w-3.5",U&&"animate-spin")})}),f.jsx(Ae,{type:"button",variant:"ghost",size:"icon",onClick:X,className:"h-6 w-6 rounded-sm","aria-label":N?"Copied":"Copy message",title:N?"Copied":"Copy message",children:N?f.jsx(Lr,{className:"h-3.5 w-3.5"}):f.jsx(ZE,{className:"h-3.5 w-3.5"})})]});return f.jsx("div",{className:Ve("group/message flex gap-3",_?"py-2":"py-4",S&&"justify-end"),children:f.jsxs("div",{className:Ve("max-w-[85%] space-y-2",S&&"order-1"),children:[!S&&c&&f.jsx(hte,{content:c,isStreaming:!!p&&!s,duration:d}),!S&&g&&g.length>0?f.jsxs(f.Fragment,{children:[g.map((ee,ue)=>{if(ee.type==="toolGroup"){const de=(h??[]).filter(We=>ee.callIds.includes(We.callId));return de.length>0?f.jsx(rw,{calls:de,onOpenTerminal:x},`tg-${ue}`):null}return ee.content.trim()?f.jsx("div",{children:f.jsx(D7,{content:ee.content,compact:_,isStreaming:!!p&&ue===g.length-1,preferLlmUi:b,onOpenPath:k})},`ts-${ue}`):null}),p&&!s&&!g.some(ee=>ee.type==="text"&&ee.content.trim())&&f.jsxs("div",{className:"flex gap-1 py-2",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:0ms]"}),f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:150ms]"}),f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:300ms]"})]}),re()]}):f.jsxs(f.Fragment,{children:[h&&h.length>0&&f.jsx(rw,{calls:h,onOpenTerminal:x}),s?S&&P?f.jsxs("div",{className:"max-w-full rounded-lg border bg-muted/40 p-3",style:F?{width:`${F}px`}:void 0,children:[f.jsx("textarea",{value:H,onChange:ee=>Y(ee.target.value),rows:Math.max(3,Math.min(10,H.split(`
|
|
672
672
|
`).length+1)),className:"w-full resize-y rounded-md border bg-background p-2 text-sm leading-relaxed focus:outline-none focus:ring-1 focus:ring-ring"}),f.jsxs("div",{className:"mt-2 flex items-center justify-end gap-2",children:[f.jsx(Ae,{type:"button",size:"sm",variant:"ghost",onClick:()=>{D(!1),Y(s),I(null)},disabled:M,children:"Cancel"}),f.jsx(Ae,{type:"button",size:"sm",onClick:()=>{Q()},disabled:M||!H.trim(),children:M?"Sending…":"Send"})]})]}):S?f.jsxs("div",{ref:W,className:Ve("relative rounded-lg px-4 py-3 bg-muted",_?"text-sm leading-normal":"text-base leading-relaxed"),children:[f.jsx("div",{className:"whitespace-pre-wrap",children:E}),O.length>0&&f.jsx("div",{className:"flex flex-wrap gap-1 mt-2 pt-2 border-t border-foreground/5",children:O.map(ee=>f.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] leading-tight px-1.5 py-0.5 rounded bg-background/60 text-muted-foreground select-none",title:ee.path,children:[f.jsx(Rl,{filename:ee.name,className:"h-3.5 w-3.5 shrink-0"}),f.jsx("span",{className:"truncate max-w-[180px]",children:ee.name})]},ee.path))}),re()]}):f.jsxs("div",{className:"relative",children:[f.jsx(D7,{content:s,compact:_,isStreaming:p,preferLlmUi:b,onOpenPath:k}),re()]}):p&&!c?f.jsxs("div",{className:"flex gap-1 py-2",children:[f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:0ms]"}),f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:150ms]"}),f.jsx("span",{className:"w-1.5 h-1.5 bg-muted-foreground/40 rounded-full animate-bounce [animation-delay:300ms]"})]}):null]})]})})}const sw=y.memo(Wte);sw.displayName="Message";const r2=[{value:"ask",label:"Ask",icon:iO,description:"Read-only — questions, explanations, analysis"},{value:"agent",label:"Agent",icon:j3,description:"Full agentic — reads, writes, runs commands"},{value:"plan",label:"Plan",icon:aI,description:"Propose changes — review before executing"}];function qte({mode:e,onChange:n,disabled:r,className:i}){const s=r2.find(a=>a.value===e)??r2[1],o=s.icon;return f.jsxs(Ul,{children:[f.jsx(Vl,{asChild:!0,disabled:r,children:f.jsxs("button",{type:"button",className:Ve("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",i),title:`Mode: ${s.label}`,children:[f.jsx(o,{className:"h-4 w-4"}),f.jsx("span",{children:s.label}),f.jsx(Ks,{className:"h-3 w-3 opacity-60"})]})}),f.jsx(Oa,{align:"start",side:"top",className:"w-64",children:r2.map(a=>{const c=a.icon,d=e===a.value;return f.jsxs(xs,{onClick:()=>n(a.value),className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[f.jsx(c,{className:"h-4 w-4 mt-0.5 shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium",children:a.label}),f.jsx("div",{className:"text-xs text-muted-foreground",children:a.description})]}),d&&f.jsx(Lr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},a.value)})})]})}const i2=[{value:"developer",label:"Developer",icon:_1,description:"Chat with the AI assistant — ask, plan, and execute"},{value:"manager",label:"Manager",icon:Rx,description:"Automation — delegate tasks to agent threads on repos"}];function Kte({mode:e,onChange:n,disabled:r,className:i,compact:s=!1}){const o=i2.find(c=>c.value===e)??i2[0],a=o.icon;return f.jsxs(Ul,{children:[f.jsx(Vl,{asChild:!0,disabled:r,children:f.jsxs("button",{type:"button",className:Ve("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",i),title:`Mode: ${o.label}`,"aria-label":`Mode: ${o.label}`,children:[f.jsx(a,{className:"h-4 w-4"}),!s&&f.jsx("span",{children:o.label}),f.jsx(Ks,{className:"h-3 w-3 opacity-60"})]})}),f.jsx(Oa,{align:"start",side:"top",className:"w-72",children:i2.map(c=>{const d=c.icon,h=e===c.value;return f.jsxs(xs,{onClick:()=>{requestAnimationFrame(()=>n(c.value))},className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[f.jsx(d,{className:"h-4 w-4 mt-0.5 shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium",children:c.label}),f.jsx("div",{className:"text-xs text-muted-foreground",children:c.description})]}),h&&f.jsx(Lr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},c.value)})})]})}var Gte=function(n){return typeof window<"u"?matchMedia&&matchMedia("(prefers-color-scheme: ".concat(n,")")):{matches:!1}},s2,Yte=y.createContext({appearance:"light",setAppearance:function(){},isDarkMode:!1,themeMode:"light",setThemeMode:function(){},browserPrefers:(s2=Gte("dark"))!==null&&s2!==void 0&&s2.matches?"dark":"light"}),Xte=function(){return y.useContext(Yte)};const RA=(e,n)=>{if(n)return"row";switch(e){case"horizontal":return"row";case"horizontal-reverse":return"row-reverse";case"vertical":default:return"column";case"vertical-reverse":return"column-reverse"}},Jte=e=>{if(e)return["space-between","space-around","space-evenly"].includes(e)},Zte=(e,n)=>RA(e,n)==="row",sf=e=>typeof e=="number"?`${e}px`:e,Qte=({visible:e,flex:n,gap:r,direction:i,horizontal:s,align:o,justify:a,distribution:c,height:d,width:h,allowShrink:g,padding:p,paddingInline:_,paddingBlock:b,prefixCls:x,as:C="div",className:k,style:S,children:E,wrap:O,ref:N,...T})=>{const P=a||c,H=Zte(i,s)&&!h&&Jte(P)?"100%":sf(h),Y={...n!==void 0?{"--lobe-flex":String(n)}:{},...i||s?{"--lobe-flex-direction":RA(i,s)}:{},...O!==void 0?{"--lobe-flex-wrap":O}:{},...P!==void 0?{"--lobe-flex-justify":P}:{},...o!==void 0?{"--lobe-flex-align":o}:{},...H!==void 0?{"--lobe-flex-width":H}:{},...d!==void 0?{"--lobe-flex-height":sf(d)}:{},...p!==void 0?{"--lobe-flex-padding":sf(p)}:{},..._!==void 0?{"--lobe-flex-padding-inline":sf(_)}:{},...b!==void 0?{"--lobe-flex-padding-block":sf(b)}:{},...r!==void 0?{"--lobe-flex-gap":sf(r)}:{},...g?{minWidth:0}:{},...S},M="lobe-flex",B=[M,e===!1?`${M}--hidden`:void 0,x?`${x}-flex`:void 0,k].filter(Boolean).join(" ");return f.jsx(C,{ref:N,...T,className:B,style:Y,children:E})};var DA=y.memo(Qte);const ene=({children:e,ref:n,...r})=>f.jsx(DA,{...r,align:"center",justify:"center",ref:n,children:e});var tne=ene;const nne=new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+","gu");function rne(e){return Array.from(e.match(nne)??[])}function zA(e){return rne(e).map(r=>r.toLowerCase()).join("-")}y.createContext(null);var ine=function(n,r){if(r){if(n&&r==="#000")return"0 0 0 1px rgba(255,255,255,0.1) inset";if(!n&&r==="#fff")return"0 0 0 1px rgba(0,0,0,0.05) inset"}};function cp(e){"@babel/helpers - typeof";return cp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},cp(e)}var sne=["shape","color","background","size","style","iconMultiple","Icon","iconStyle","iconClassName"];function z7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function G0(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?z7(Object(r),!0).forEach(function(i){one(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function one(e,n,r){return n=ane(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ane(e){var n=lne(e,"string");return cp(n)=="symbol"?n:String(n)}function lne(e,n){if(cp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(cp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function cne(e,n){if(e==null)return{};var r=une(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function une(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var gi=y.memo(function(e){var n=e.shape,r=n===void 0?"circle":n,i=e.color,s=i===void 0?"#fff":i,o=e.background,a=e.size,c=e.style,d=e.iconMultiple,h=d===void 0?.75:d,g=e.Icon,p=e.iconStyle,_=e.iconClassName,b=cne(e,sne),x=Xte(),C=x.isDarkMode;return f.jsx(tne,G0(G0({flex:"none",style:G0({background:o,borderRadius:r==="circle"?"50%":Math.floor(a*.1),boxShadow:ine(C,o),color:s,height:a,width:a},c)},b),{},{children:g&&f.jsx(g,{className:_,color:s,size:a,style:G0({transform:"scale(".concat(h,")")},p)})}))}),Xm="OpenAI",fne=.75,dne=.1,LA="#000",$A="#19C37D",IA="#AB68FF",BA="#F86AA4",AS="#F9C322",FA="#0099FF",HA="#0000FE",hne=LA,pne="#fff",mne=.75;function up(e){"@babel/helpers - typeof";return up=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},up(e)}var gne=["size","style"];function L7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function o2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?L7(Object(r),!0).forEach(function(i){yne(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function yne(e,n,r){return n=vne(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function vne(e){var n=_ne(e,"string");return up(n)=="symbol"?n:String(n)}function _ne(e,n){if(up(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(up(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function bne(e,n){if(e==null)return{};var r=xne(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function xne(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var MS=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=bne(e,gne);return f.jsxs("svg",o2(o2({fill:"currentColor",fillRule:"evenodd",height:r,style:o2({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Xm}),f.jsx("path",{d:"M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"})]}))});function fp(e){"@babel/helpers - typeof";return fp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},fp(e)}var wne=["type"];function $7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function Sne(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?$7(Object(r),!0).forEach(function(i){Cne(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Cne(e,n,r){return n=jne(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function jne(e){var n=kne(e,"string");return fp(n)=="symbol"?n:String(n)}function kne(e,n){if(fp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(fp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Ene(e,n){if(e==null)return{};var r=One(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function One(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Nne=y.memo(function(e){var n=e.type,r=n===void 0?"normal":n,i=Ene(e,wne),s=y.useMemo(function(){switch(r){case"gpt3":return $A;case"gpt4":return IA;case"gpt5":return BA;case"o3":case"o1":return AS;case"oss":return FA;case"platform":return HA;default:return hne}},[r]);return f.jsx(gi,Sne({Icon:MS,"aria-label":Xm,background:s,color:pne,iconMultiple:mne},i))});function dp(e){"@babel/helpers - typeof";return dp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},dp(e)}var Tne=["Icon","style","Text","color","size","spaceMultiple","textMultiple","extra","extraStyle","showText","showLogo","extraClassName","iconProps","inverse"];function I7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function yl(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?I7(Object(r),!0).forEach(function(i){Pne(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Pne(e,n,r){return n=Ane(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Ane(e){var n=Mne(e,"string");return dp(n)=="symbol"?n:String(n)}function Mne(e,n){if(dp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(dp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Rne(e,n){if(e==null)return{};var r=Dne(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Dne(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var yi=y.memo(function(e){var n=e.Icon,r=e.style,i=e.Text,s=e.color,o=e.size,a=o===void 0?24:o,c=e.spaceMultiple,d=c===void 0?1:c,h=e.textMultiple,g=h===void 0?1:h,p=e.extra,_=e.extraStyle,b=e.showText,x=b===void 0?!0:b,C=e.showLogo,k=C===void 0?!0:C,S=e.extraClassName,E=e.iconProps,O=e.inverse,N=Rne(e,Tne),T=n&&k&&f.jsx(n,yl(yl({size:a},E),{},{style:yl(O?{marginLeft:a*d}:{marginRight:a*d},E==null?void 0:E.style)})),P=x&&i&&f.jsx(i,{size:a*g});return f.jsxs(DA,yl(yl({align:"center",flex:"none",horizontal:!0,justify:"flex-start",style:yl({color:s},r)},N),{},{children:[O?f.jsxs(f.Fragment,{children:[P,T]}):f.jsxs(f.Fragment,{children:[T,P]}),p&&f.jsx("span",{className:S,style:yl({fontSize:a*g*.95,lineHeight:1},_),children:p})]}))});function hp(e){"@babel/helpers - typeof";return hp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},hp(e)}var zne=["size","style"];function B7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function a2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?B7(Object(r),!0).forEach(function(i){Lne(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Lne(e,n,r){return n=$ne(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function $ne(e){var n=Ine(e,"string");return hp(n)=="symbol"?n:String(n)}function Ine(e,n){if(hp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(hp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Bne(e,n){if(e==null)return{};var r=Fne(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Fne(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var UA=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=Bne(e,zne);return f.jsxs("svg",a2(a2({fill:"currentColor",fillRule:"evenodd",height:r,style:a2({flex:"none",lineHeight:1},i),viewBox:"0 0 86 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Xm}),f.jsx("path",{d:"M10.703 2C5.916 2 2 5.916 2 10.703c0 4.787 3.916 8.704 8.703 8.704 4.787 0 8.704-3.893 8.704-8.704A8.698 8.698 0 0010.703 2zm0 14.288c-2.973 0-5.367-2.442-5.367-5.585S7.73 5.12 10.703 5.12c2.974 0 5.367 2.441 5.367 5.584s-2.393 5.585-5.367 5.585zM28.206 6.835c-1.57 0-3.094.629-3.892 1.693v-1.45h-3.143V24h3.143v-6.116c.798.99 2.273 1.523 3.892 1.523 3.385 0 6.045-2.66 6.045-6.286 0-3.626-2.66-6.286-6.044-6.286zm-.531 9.84c-1.79 0-3.385-1.402-3.385-3.554s1.596-3.554 3.385-3.554c1.789 0 3.384 1.402 3.384 3.554s-1.595 3.554-3.384 3.554zM41.649 6.835c-3.433 0-6.141 2.684-6.141 6.286 0 3.602 2.37 6.286 6.237 6.286 3.167 0 5.198-1.91 5.827-4.062h-3.07c-.388.895-1.475 1.523-2.78 1.523-1.62 0-2.854-1.136-3.144-2.756h9.139V12.88c0-3.288-2.297-6.044-6.068-6.044zm-3.047 5.053c.339-1.523 1.596-2.514 3.12-2.514 1.619 0 2.852 1.064 2.997 2.514h-6.117zM56.081 6.835c-1.402 0-2.877.629-3.553 1.669V7.077h-3.143v12.088h3.143v-6.503c0-1.886 1.015-3.119 2.659-3.119 1.523 0 2.345 1.16 2.345 2.78v6.842h3.143v-7.35c0-2.997-1.838-4.98-4.594-4.98zM68.724 2.242l-6.841 16.923h3.36l1.45-3.699h7.785l1.45 3.7h3.41L72.543 2.241h-3.82zm-.943 10.42l2.805-7.084 2.78 7.084H67.78zM83.81 2.242h-3.191v16.923h3.19V2.242z"})]}))});function pp(e){"@babel/helpers - typeof";return pp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},pp(e)}var Hne=["extraStyle"];function F7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function H7(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?F7(Object(r),!0).forEach(function(i){Une(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function Une(e,n,r){return n=Vne(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Vne(e){var n=Wne(e,"string");return pp(n)=="symbol"?n:String(n)}function Wne(e,n){if(pp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(pp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function qne(e,n){if(e==null)return{};var r=Kne(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Kne(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Gne=y.memo(function(e){var n=e.extraStyle,r=qne(e,Hne);return f.jsx(yi,H7({Icon:MS,Text:UA,"aria-label":Xm,extraStyle:H7({fontWeight:600},n),spaceMultiple:dne,textMultiple:fne},r))}),_n=MS;_n.Text=UA;_n.Combine=Gne;_n.Avatar=Nne;_n.colorPrimary=LA;_n.colorGpt3=$A;_n.colorGpt4=IA;_n.colorGpt5=BA;_n.colorO1=AS;_n.colorO3=AS;_n.colorOss=FA;_n.colorPlatform=HA;_n.title=Xm;var Vf="Claude",Yne=.8,Xne=.1,VA="#D97757",Jne=VA,Zne="#fff",Qne=.75;function mp(e){"@babel/helpers - typeof";return mp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},mp(e)}var ere=["size","style"];function U7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function l2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?U7(Object(r),!0).forEach(function(i){tre(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):U7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function tre(e,n,r){return n=nre(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function nre(e){var n=rre(e,"string");return mp(n)=="symbol"?n:String(n)}function rre(e,n){if(mp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(mp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function ire(e,n){if(e==null)return{};var r=sre(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function sre(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var RS=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=ire(e,ere);return f.jsxs("svg",l2(l2({fill:"currentColor",fillRule:"evenodd",height:r,style:l2({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Vf}),f.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"})]}))});function gp(e){"@babel/helpers - typeof";return gp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},gp(e)}function V7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function ore(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?V7(Object(r),!0).forEach(function(i){are(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function are(e,n,r){return n=lre(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function lre(e){var n=cre(e,"string");return gp(n)=="symbol"?n:String(n)}function cre(e,n){if(gp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(gp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function ure(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var fre=y.memo(function(e){var n=Object.assign({},(ure(e),e));return f.jsx(gi,ore({Icon:RS,"aria-label":Vf,background:Jne,color:Zne,iconMultiple:Qne},n))});function yp(e){"@babel/helpers - typeof";return yp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},yp(e)}var dre=["size","style"];function W7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function c2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?W7(Object(r),!0).forEach(function(i){hre(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):W7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function hre(e,n,r){return n=pre(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function pre(e){var n=mre(e,"string");return yp(n)=="symbol"?n:String(n)}function mre(e,n){if(yp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(yp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function gre(e,n){if(e==null)return{};var r=yre(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function yre(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var WA=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=gre(e,dre);return f.jsxs("svg",c2(c2({height:r,style:c2({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:r,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Vf}),f.jsx("path",{d:"M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z",fill:"#D97757",fillRule:"nonzero"})]}))});function vp(e){"@babel/helpers - typeof";return vp=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},vp(e)}var vre=["size","style"];function q7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function u2(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?q7(Object(r),!0).forEach(function(i){_re(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):q7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function _re(e,n,r){return n=bre(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function bre(e){var n=xre(e,"string");return vp(n)=="symbol"?n:String(n)}function xre(e,n){if(vp(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(vp(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function wre(e,n){if(e==null)return{};var r=Sre(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Sre(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var qA=y.memo(function(e){var n=e.size,r=n===void 0?"1em":n,i=e.style,s=wre(e,vre);return f.jsxs("svg",u2(u2({fill:"currentColor",fillRule:"nonzero",height:r,style:u2({flex:"none",lineHeight:1},i),viewBox:"0 0 97 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[f.jsx("title",{children:Vf}),f.jsx("path",{d:"M13.623 20.222c-3.417 0-5.753-1.901-6.855-4.827a12.992 12.992 0 01-.838-4.772c0-4.907 2.206-8.315 7.08-8.315 3.275 0 5.297 1.425 6.448 4.826h1.402l-.19-4.69C18.709 1.18 16.258.543 13.276.543c-4.2 0-7.775 1.874-9.763 5.254a11.357 11.357 0 00-1.511 5.872c0 3.753 1.777 7.08 5.113 8.926a11.95 11.95 0 005.943 1.398c3.254 0 5.835-.617 8.122-1.697l.593-5.172h-1.43c-.858 2.362-1.88 3.78-3.574 4.534-.831.373-1.88.564-3.146.564zm14.74-17.914L28.499 0h-.967L23.23 1.29v.699l1.907.882v16.142c0 1.1-.565 1.344-2.043 1.528v1.18h7.319v-1.18c-1.484-.184-2.042-.428-2.042-1.528V2.315l-.007-.007zm29.104 19.685h.565l4.95-.937v-1.208l-.695-.054c-1.157-.109-1.457-.346-1.457-1.29V9.897l.137-2.763h-.783l-4.678.672v1.181l.457.082c1.266.183 1.64.536 1.64 1.419v7.67c-1.212.937-2.369 1.527-3.744 1.527-1.525 0-2.471-.774-2.471-2.58V9.905l.136-2.763h-.804l-4.684.672v1.181l.484.082c1.266.183 1.64.536 1.64 1.418v7.08c0 3 1.703 4.426 4.412 4.426 2.07 0 3.765-1.1 5.038-2.627L57.474 22l-.007-.007zm-13.602-9.55c0-3.836-2.043-5.309-5.733-5.309-3.254 0-5.616 1.344-5.616 3.57 0 .666.238 1.175.721 1.528l2.478-.326c-.109-.746-.163-1.201-.163-1.391 0-1.263.674-1.901 2.042-1.901 2.022 0 3.044 1.419 3.044 3.7v.746l-5.106 1.527c-1.702.462-2.67.863-3.316 1.8a3.386 3.386 0 00-.476 1.9c0 2.172 1.497 3.706 4.057 3.706 1.852 0 3.493-.835 4.922-2.416.51 1.581 1.294 2.416 2.69 2.416 1.13 0 2.15-.455 3.063-1.344l-.272-.937a4.363 4.363 0 01-1.178.163c-.783 0-1.157-.617-1.157-1.826v-5.607zm-6.536 7.378c-1.396 0-2.26-.808-2.26-2.226 0-.964.456-1.528 1.43-1.854l4.139-1.31v3.965c-1.321.997-2.097 1.425-3.31 1.425zm43.095 1.235v-1.208l-.701-.054c-1.158-.109-1.45-.346-1.45-1.29V2.308L78.409 0h-.974l-4.302 1.29v.699l1.906.882V8.18a6.024 6.024 0 00-3.656-1.046c-4.276 0-7.612 3.245-7.612 8.098 0 3.998 2.397 6.761 6.346 6.761 2.042 0 3.819-.99 4.922-2.525l-.136 2.525h.571l4.95-.937zm-8.96-12.313c2.043 0 3.575 1.181 3.575 3.353v6.11a4.91 4.91 0 01-3.547 1.425c-2.928 0-4.412-2.308-4.412-5.39 0-3.462 1.695-5.498 4.385-5.498zm19.424 3.055c-.381-1.792-1.484-2.81-3.016-2.81-2.288 0-3.874 1.717-3.874 4.18 0 3.646 1.934 6.008 5.059 6.008a5.858 5.858 0 005.03-2.953l.913.245c-.408 3.163-3.281 5.525-6.808 5.525-4.14 0-6.992-3.054-6.992-7.399 0-4.378 3.098-7.46 7.237-7.46 3.09 0 5.27 1.853 5.97 5.07l-10.783 3.3V14.05l7.264-2.247v-.006z"})]}))});function _p(e){"@babel/helpers - typeof";return _p=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},_p(e)}var Cre=["type"];function K7(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,i)}return r}function jre(e){for(var n=1;n<arguments.length;n++){var r=arguments[n]!=null?arguments[n]:{};n%2?K7(Object(r),!0).forEach(function(i){kre(e,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):K7(Object(r)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i))})}return e}function kre(e,n,r){return n=Ere(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function Ere(e){var n=Ore(e,"string");return _p(n)=="symbol"?n:String(n)}function Ore(e,n){if(_p(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n);if(_p(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)}function Nre(e,n){if(e==null)return{};var r=Tre(e,n),i,s;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(s=0;s<o.length;s++)i=o[s],!(n.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function Tre(e,n){if(e==null)return{};var r={},i=Object.keys(e),s,o;for(o=0;o<i.length;o++)s=i[o],!(n.indexOf(s)>=0)&&(r[s]=e[s]);return r}var Pre=y.memo(function(e){var n=e.type,r=n===void 0?"mono":n,i=Nre(e,Cre),s=r==="color"?WA:RS;return f.jsx(yi,jre({Icon:s,Text:qA,"aria-label":Vf,spaceMultiple:Xne,textMultiple:Yne},i))}),hi=RS;hi.Color=WA;hi.Text=qA;hi.Combine=Pre;hi.Avatar=fre;hi.colorPrimary=VA;hi.title=Vf;const ow="jait-gateway-url";function Are(){var e;return typeof window<"u"&&((e=window.location)!=null&&e.origin)&&window.location.origin!=="null"?window.location.origin:"http://localhost:8000"}function bp(e){return e.endsWith("/")?e.slice(0,-1):e}function G7(e){return e.replace(/^http/,"ws")}function Dl(){try{const e=localStorage.getItem(ow);return e&&e.trim()?e.trim():null}catch{return null}}function j1(e){try{e&&e.trim()?localStorage.setItem(ow,bp(e.trim())):localStorage.removeItem(ow)}catch{}window.dispatchEvent(new Event("jait-gateway-url-changed"))}function wn(){var r;const e=Dl();if(e)return bp(e);const n=(r=window.jaitDesktop)==null?void 0:r.gatewayUrl;return n?bp(n):Are()}function Jm(){const e=Dl();if(e)return bp(G7(e));const n=wn();return bp(G7(n))}function Y7(){var e;return!!(Dl()||(e=window.jaitDesktop)!=null&&e.gatewayUrl)}wn();Jm();const nn=wn();class Mre{getToken(){return localStorage.getItem("token")}getHeaders(n=!1){const r={};n&&(r["Content-Type"]="application/json");const i=this.getToken();return i&&(r.Authorization=`Bearer ${i}`),r}async listProviders(){const n=await fetch(`${nn}/api/providers`,{headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to list providers: ${n.statusText}`);const r=await n.json();return{providers:r.providers,remoteProviders:r.remoteProviders??[]}}async listProviderModels(n){const r=await fetch(`${nn}/api/providers/${n}/models`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to list models: ${r.statusText}`);return(await r.json()).models}async listThreads(n){const r=n?`?sessionId=${encodeURIComponent(n)}`:"",i=await fetch(`${nn}/api/threads${r}`,{headers:this.getHeaders()});if(!i.ok)throw new Error(`Failed to list threads: ${i.statusText}`);return(await i.json()).threads}async getThread(n){const r=await fetch(`${nn}/api/threads/${n}`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to get thread: ${r.statusText}`);return r.json()}async createThread(n){const r=await fetch(`${nn}/api/threads`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to create thread: ${r.statusText}`);return r.json()}async updateThread(n,r){const i=await fetch(`${nn}/api/threads/${n}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok)throw new Error(`Failed to update thread: ${i.statusText}`);return i.json()}async deleteThread(n){const r=await fetch(`${nn}/api/threads/${n}`,{method:"DELETE",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to delete thread: ${r.statusText}`)}async startThread(n,r){const i=typeof r=="string"?{message:r}:r??{},s=await fetch(`${nn}/api/threads/${n}/start`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(i)});if(!s.ok){const o=await s.json().catch(()=>({})),a=new Error(o.error||`Failed to start thread: ${s.statusText}`);throw o.code&&(a.code=o.code),a}return s.json()}async sendTurn(n,r){const i=typeof r=="string"?{message:r}:r,s=await fetch(`${nn}/api/threads/${n}/send`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(i)});if(!s.ok)throw new Error(`Failed to send turn: ${s.statusText}`)}async stopThread(n){const r=await fetch(`${nn}/api/threads/${n}/stop`,{method:"POST",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to stop thread: ${r.statusText}`)}async interruptThread(n){const r=await fetch(`${nn}/api/threads/${n}/interrupt`,{method:"POST",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to interrupt thread: ${r.statusText}`)}async approveToolCall(n,r,i){const s=await fetch(`${nn}/api/threads/${n}/approve`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({requestId:r,approved:i})});if(!s.ok)throw new Error(`Failed to approve: ${s.statusText}`)}async createPullRequest(n,r){const i=await fetch(`${nn}/api/threads/${n}/create-pr`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok){const s=await i.json().catch(()=>({}));throw new Error(s.error||`Failed to create pull request: ${i.statusText}`)}return i.json()}async getActivities(n,r){const i=typeof r=="number"?`?limit=${r}`:"",s=await fetch(`${nn}/api/threads/${n}/activities${i}`,{headers:this.getHeaders()});if(!s.ok)throw new Error(`Failed to get activities: ${s.statusText}`);return(await s.json()).activities}async listRepos(){const n=await fetch(`${nn}/api/repos`,{headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to list repos: ${n.statusText}`);return(await n.json()).repos}async createRepo(n){const r=await fetch(`${nn}/api/repos`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!r.ok)throw new Error(`Failed to create repo: ${r.statusText}`);return(await r.json()).repo}async updateRepo(n,r){const i=await fetch(`${nn}/api/repos/${n}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok)throw new Error(`Failed to update repo: ${i.statusText}`);return(await i.json()).repo}async deleteRepo(n){const r=await fetch(`${nn}/api/repos/${n}`,{method:"DELETE",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to delete repo: ${r.statusText}`)}async getRepoStrategy(n){const r=await fetch(`${nn}/api/repos/${n}/strategy`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to get strategy: ${r.statusText}`);return(await r.json()).strategy}async updateRepoStrategy(n,r){const i=await fetch(`${nn}/api/repos/${n}/strategy`,{method:"PUT",headers:this.getHeaders(!0),body:JSON.stringify({strategy:r})});if(!i.ok)throw new Error(`Failed to update strategy: ${i.statusText}`);return(await i.json()).strategy}async generateRepoStrategy(n){const r=await fetch(`${nn}/api/repos/${n}/strategy/generate`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({})});if(!r.ok){const s=await r.json().catch(()=>({error:r.statusText}));throw new Error(s.error||`Failed to generate strategy: ${r.statusText}`)}return(await r.json()).strategy}async listPlans(n){const r=await fetch(`${nn}/api/repos/${n}/plans`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to list plans: ${r.statusText}`);return(await r.json()).plans}async createPlan(n,r){const i=await fetch(`${nn}/api/repos/${n}/plans`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(r??{})});if(!i.ok)throw new Error(`Failed to create plan: ${i.statusText}`);return(await i.json()).plan}async getPlan(n){const r=await fetch(`${nn}/api/plans/${n}`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to get plan: ${r.statusText}`);return(await r.json()).plan}async updatePlan(n,r){const i=await fetch(`${nn}/api/plans/${n}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!i.ok)throw new Error(`Failed to update plan: ${i.statusText}`);return(await i.json()).plan}async deletePlan(n){const r=await fetch(`${nn}/api/plans/${n}`,{method:"DELETE",headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to delete plan: ${r.statusText}`)}async generatePlanTasks(n,r){const i=await fetch(`${nn}/api/plans/${n}/generate`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({prompt:r})});if(!i.ok){const s=await i.json().catch(()=>({error:i.statusText}));throw new Error(s.error||`Failed to generate tasks: ${i.statusText}`)}return await i.json()}async startPlanTask(n,r){const i=await fetch(`${nn}/api/plans/${n}/tasks/${r}/start`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({})});if(!i.ok)throw new Error(`Failed to start task: ${i.statusText}`);return await i.json()}async startAllPlanTasks(n){const r=await fetch(`${nn}/api/plans/${n}/start`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({})});if(!r.ok){const i=await r.json().catch(()=>({error:r.statusText}));throw new Error(i.error||`Failed to start tasks: ${r.statusText}`)}return await r.json()}}const It=new Mre,Rre=({className:e})=>f.jsx(_n,{size:16,className:e}),Dre=({className:e})=>f.jsx(hi,{size:16,className:e}),f2=[{value:"jait",label:"Jait",icon:j3,description:"Native Jait agent loop with full tool access"},{value:"codex",label:"Codex",icon:Rre,description:"OpenAI Codex CLI — coding agent with MCP tools"},{value:"claude-code",label:"Claude Code",icon:Dre,description:"Anthropic Claude Code CLI — coding agent with MCP tools"}];function zre(e){const n=e.toLowerCase();return n.includes("not installed")||n.includes("not found")?"not installed":n.includes("not authenticated")||n.includes("login")?"not authenticated":"unavailable"}function Lre({provider:e,onChange:n,disabled:r,className:i,iconOnly:s=!1,repoRuntime:o,onMoveToGateway:a,sessionInfo:c,workspaceNodeId:d}){const[h,g]=y.useState({}),[p,_]=y.useState([]);y.useEffect(()=>{It.listProviders().then(({providers:H,remoteProviders:Y})=>{const M={};for(const B of H)M[B.id]=B;g(M),_(Y)}).catch(()=>{})},[]);const b=o!=null,x=(o==null?void 0:o.availableProviders)??[],C=(o==null?void 0:o.online)??!0,k=(o==null?void 0:o.loading)??!1,S=(o==null?void 0:o.hostType)==="gateway",E=!!(d&&d!=="gateway"),O=E?p.find(H=>H.nodeId===d):void 0,N=E&&!b,T=f2.find(H=>H.value===e)??f2[0],P=T.icon,D=b?S?"Gateway":o==null?void 0:o.locationLabel:N?(O==null?void 0:O.nodeName)??d:c!=null&&c.isRemote&&c.remoteNode?c.remoteNode.nodeName:void 0;return f.jsxs(Ul,{children:[f.jsx(Vl,{asChild:!0,disabled:r,children:f.jsxs("button",{type:"button",className:Ve("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",i),title:`Provider: ${T.label}${D?` · ${D}`:""}`,"aria-label":`Provider: ${T.label}${D?` on ${D}`:""}`,children:[f.jsx(P,{className:"h-4 w-4"}),!s&&f.jsx("span",{children:T.label}),!s&&D&&f.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] text-blue-500",children:[f.jsx(Hi,{className:"h-3 w-3"}),D]}),f.jsx(Ks,{className:"h-3 w-3 opacity-60"})]})}),f.jsxs(Oa,{align:"start",side:"top",className:"w-72",children:[b&&!S&&!C&&!k&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"px-2 py-1.5 text-xs text-amber-600 dark:text-amber-400",children:"Device is offline — only Jait (gateway) is available"}),f.jsx(_o,{})]}),b&&k&&f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"flex items-center gap-1.5 px-2 py-1.5 text-xs text-muted-foreground",children:[f.jsx(St,{className:"h-3 w-3 animate-spin"}),"Connecting to device…"]}),f.jsx(_o,{})]}),N&&!O&&f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"px-2 py-1.5 text-xs text-amber-600 dark:text-amber-400",children:"Device is offline — only Jait (gateway) is available"}),f.jsx(_o,{})]}),f2.map(H=>{const Y=H.icon,M=e===H.value,B=h[H.value];let U,G,F,I;if(b)H.value==="jait"?(U=!0,I="Gateway"):S?(U=(B==null?void 0:B.available)!==!1,G=B==null?void 0:B.unavailableReason,I="Gateway"):k?(U=!1,G="Checking device…"):C?(U=x.includes(H.value),G=U?void 0:"Not available on this device",I=(o==null?void 0:o.locationLabel)??"device"):(U=!1,G="Device is offline");else if(N)H.value==="jait"?(U=!0,I="Gateway"):O?(U=O.providers.includes(H.value),G=U?void 0:"Not available on this device",I=O.nodeName):(U=!1,G="Device is offline");else{const A=(B==null?void 0:B.available)!==!1;G=B==null?void 0:B.unavailableReason,F=A?void 0:p.find(W=>W.providers.includes(H.value)),U=A||!!F,I=!(B!=null&&B.available)&&F?F.nodeName:"Gateway"}return f.jsxs(xs,{onClick:()=>n(H.value),disabled:!U,className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[f.jsx(Y,{className:"h-4 w-4 mt-0.5 shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"text-sm font-medium flex items-center gap-1.5",children:[H.label,U&&I&&f.jsxs("span",{className:"text-[10px] text-muted-foreground flex items-center gap-0.5",children:[f.jsx(Hi,{className:"h-3 w-3"}),I]}),!U&&f.jsxs("span",{className:"text-[10px] text-destructive/80 flex items-center gap-0.5",children:[f.jsx(mf,{className:"h-3 w-3"}),G?zre(G):"unavailable"]})]}),f.jsx("div",{className:"text-xs text-muted-foreground leading-snug",children:!U&&G?G:H.description})]}),M&&f.jsx(Lr,{className:"h-4 w-4 mt-0.5 shrink-0 text-primary"})]},H.value)}),b&&!S&&!C&&!k&&a&&f.jsxs(f.Fragment,{children:[f.jsx(_o,{}),f.jsxs(xs,{onClick:a,className:"flex items-start gap-2.5 py-2 cursor-pointer",children:[f.jsx(fs,{className:"h-4 w-4 mt-0.5 shrink-0"}),f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsx("div",{className:"text-sm font-medium",children:"Move to Gateway"}),f.jsx("div",{className:"text-xs text-muted-foreground leading-snug",children:"Run this repo on the gateway server instead"})]})]})]})]})]})}function $re({provider:e,model:n,onChange:r,disabled:i,className:s}){var g;const[o,a]=y.useState([]),[c,d]=y.useState(!1);y.useEffect(()=>{if(a([]),e==="jait"){d(!1);return}let p=!1;return d(!0),It.listProviderModels(e).then(_=>{p||a(_)}).catch(()=>{p||a([])}).finally(()=>{p||d(!1)}),()=>{p=!0}},[e]),y.useEffect(()=>{if(e==="jait"||c||o.length===0||n&&o.some(b=>b.id===n))return;const p=o.find(b=>b.isDefault)??o[0]??null,_=(p==null?void 0:p.id)??null;_!==n&&r(_)},[e,c,n,o,r]);const h=n?((g=o.find(p=>p.id===n))==null?void 0:g.name)??n:"model";return f.jsxs(Ul,{children:[f.jsx(Vl,{asChild:!0,disabled:i||c,children:f.jsxs("button",{type:"button",className:Ve("flex h-8 items-center gap-1 rounded-md px-1.5 py-1 text-xs font-medium text-muted-foreground","hover:text-foreground hover:bg-muted/60 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:pointer-events-none disabled:opacity-50",s),title:`Model: ${n??"none"}`,children:[c?f.jsx(St,{className:"h-3 w-3 animate-spin"}):f.jsx("span",{className:"font-mono text-[11px]",children:h}),f.jsx(Ks,{className:"h-3 w-3 opacity-60"})]})}),f.jsxs(Oa,{align:"start",side:"top",className:"w-64",children:[f.jsx(Vy,{className:"text-[10px] uppercase tracking-wider text-muted-foreground",children:"Model"}),f.jsx(_o,{}),o.map(p=>f.jsxs(xs,{onClick:()=>r(p.id),className:"flex items-start gap-2 py-1.5 cursor-pointer",children:[f.jsxs("div",{className:"flex-1 min-w-0",children:[f.jsxs("div",{className:"text-sm font-medium",children:[p.name,p.isDefault&&f.jsx("span",{className:"ml-1.5 text-[10px] text-muted-foreground font-normal",children:"(default)"})]}),p.description&&f.jsx("div",{className:"text-[11px] text-muted-foreground leading-snug",children:p.description})]}),n===p.id&&f.jsx(Lr,{className:"h-3.5 w-3.5 mt-0.5 text-primary shrink-0"})]},p.id)),o.length===0&&!c&&f.jsx("div",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No models available"})]})]})}const Ire=768;function DS(){const e=()=>window.innerWidth<Ire,[n,r]=y.useState(e);return y.useEffect(()=>{const i=()=>r(e());return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),n}const Bre="https://cdn.jsdelivr.net/gh/vscode-icons/vscode-icons@12.9.0/icons/",X7=[];function Y0(e,n){const r=document.createElement("span");r.contentEditable="false",r.setAttribute("data-file-path",e.path),r.setAttribute("data-file-name",e.name),r.className="inline-flex items-center gap-0.5 align-baseline text-[12px] leading-tight pl-0.5 pr-0 py-[1px] mx-[2px] rounded bg-muted text-foreground select-none cursor-default whitespace-nowrap";const i=document.createElement("span");i.className="inline-flex items-center shrink-0",i.innerHTML=`<img src="${Bre}${Fre(e.name)}" alt="" class="h-3.5 w-3.5" draggable="false" />`,r.appendChild(i);const s=document.createElement("span");s.className="truncate max-w-[140px]",s.textContent=e.name,r.appendChild(s);const o=document.createElement("button");return o.type="button",o.className="inline-flex items-center p-0.5 rounded hover:bg-foreground/10 transition-colors",o.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>',o.addEventListener("mousedown",a=>{a.preventDefault(),a.stopPropagation()}),o.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),r.remove(),n==null||n(e.path)}),r.appendChild(o),r}function Fre(e){return Tl.getIconForFile(e)??Tl.DEFAULT_FILE}function fo(e){let n="";for(const r of e.childNodes)if(r.nodeType===Node.TEXT_NODE)n+=r.textContent??"";else if(r instanceof HTMLElement){if(r.hasAttribute("data-file-path"))continue;r.tagName==="BR"?n+=`
|
|
673
673
|
`:n+=fo(r)}return n}function Hre(e){const n=[];return e.querySelectorAll("[data-file-path]").forEach(r=>{n.push(r.getAttribute("data-file-path"))}),n}function oh(e){const n=[];return e.querySelectorAll("[data-file-path]").forEach(r=>{n.push({path:r.getAttribute("data-file-path"),name:r.getAttribute("data-file-name")||r.getAttribute("data-file-path").split("/").pop()})}),n}function d2(e){const n=window.getSelection();if(n){const r=document.createRange();r.selectNodeContents(e),r.collapse(!1),n.removeAllRanges(),n.addRange(r)}}function Ure({levels:e=[]}){const n=e.length>0?e:Array.from({length:18},()=>.08);return f.jsx("span",{className:"flex h-7 items-end gap-1 rounded-full border border-red-500/20 bg-red-500/10 px-2.5 py-1",children:n.map((r,i)=>f.jsx("span",{className:"w-1 rounded-full bg-red-500 transition-[height,opacity] duration-100 ease-out",style:{height:`${6+r*16}px`,opacity:.35+r*.65}},i))})}const X0=y.forwardRef(function({value:n,onChange:r,onSubmit:i,onStop:s,onQueue:o,isLoading:a,disabled:c,controlsDisabled:d,placeholder:h="Ask anything...",className:g,footerLeadingContent:p,onVoiceInput:_,voiceRecording:b,voiceLevels:x,voiceTranscribing:C,onVoiceStop:k,viewMode:S,onViewModeChange:E,mode:O,onModeChange:N,provider:T,onProviderChange:P,cliModel:D,onCliModelChange:H,repoRuntime:Y,onMoveToGateway:M,sessionInfo:B,workspaceNodeId:U,availableFiles:G=X7,onSearchFiles:F,workspaceOpen:I=!1},A){const W=y.useRef(null),V=y.useRef(null),X=DS(),[L,z]=y.useState(!1),Z=y.useRef(0),[$,Q]=y.useState(!n),[J,re]=y.useState(!1),[ee,ue]=y.useState(""),[de,We]=y.useState(0),Se=y.useRef(!1);y.useEffect(()=>{Se.current=J},[J]);const ye=y.useRef(G);y.useEffect(()=>{ye.current=G},[G]);const me=y.useRef(r);y.useEffect(()=>{me.current=r},[r]);const De=y.useRef(F);y.useEffect(()=>{De.current=F},[F]);const at=y.useRef(I);y.useEffect(()=>{at.current=I},[I]);const[ht,Ne]=y.useState([]),[qe,ze]=y.useState(!1),Fe=y.useRef(null),Ze=!!c,Te=!!(d??c??!1)||!!a,ce=!!(S&&E),_e=!!(T&&P),Oe=!!(T&&T!=="jait"&&H),ie=!!(O&&N&&(!T||T==="jait")&&S!=="manager"),ae=ce||_e||Oe||ie||!!p,xe=y.useRef(!1),Ce=y.useCallback(He=>{var st;const $e=W.current;$e&&((st=$e.querySelector(`[data-file-path="${CSS.escape(He)}"]`))==null||st.remove(),xe.current=!0,me.current(fo($e)),xe.current=!1,Q(!fo($e).trim()&&!$e.querySelector("[data-file-path]")))},[]);y.useImperativeHandle(A,()=>({insertChip:He=>{const $e=W.current;if(!$e||$e.querySelector(`[data-file-path="${CSS.escape(He.path)}"]`))return;const st=Y0(He,Ce);$e.appendChild(st),$e.appendChild(document.createTextNode(" ")),d2($e),xe.current=!0,me.current(fo($e)),xe.current=!1,Q(!1)}}),[Ce]),y.useEffect(()=>{var Ot;if(!J){Ne(Je=>Je.length===0?Je:X7);return}(Ot=Fe.current)==null||Ot.abort();const He=new Set(W.current?Hre(W.current):[]),$e=ye.current;if(!ee){const Je=$e.filter(ct=>!He.has(ct.path)).slice(0,15);Ne(Je),ze(!1);return}const st=$e.filter(Je=>{if(He.has(Je.path))return!1;const ct=ee.toLowerCase();return Je.name.toLowerCase().includes(ct)||Je.path.toLowerCase().includes(ct)}).slice(0,10);Ne(st);const rn=De.current;if(!rn){ze(!1);return}ze(!0);const Dt=new AbortController;Fe.current=Dt;const Kt=setTimeout(async()=>{try{const Je=await rn(ee,15,Dt.signal);if(Dt.signal.aborted)return;const ct=new Set,lt=[];for(const dt of Je)He.has(dt.path)||ct.has(dt.path)||(ct.add(dt.path),lt.push(dt));for(const dt of st)ct.has(dt.path)||(ct.add(dt.path),lt.push(dt));Ne(lt.slice(0,15))}catch{}finally{Dt.signal.aborted||ze(!1)}},150);return()=>{clearTimeout(Kt),Dt.abort()}},[J,ee]),y.useEffect(()=>{var st;const He=W.current;if(!He||xe.current)return;fo(He)!==n&&(xe.current=!0,He.innerHTML="",n&&He.appendChild(document.createTextNode(n)),Q(!n&&!((st=W.current)!=null&&st.querySelector("[data-file-path]"))),xe.current=!1)},[n]),y.useEffect(()=>{if(!J)return;const He=$e=>{V.current&&!V.current.contains($e.target)&&re(!1)};return document.addEventListener("mousedown",He),()=>document.removeEventListener("mousedown",He)},[J]),y.useEffect(()=>{We(0)},[ee]);const je=y.useCallback(He=>{const $e=W.current;if(!$e)return;const st=window.getSelection();if(st&&st.rangeCount>0){const rn=st.getRangeAt(0),Dt=rn.startContainer;if(Dt.nodeType===Node.TEXT_NODE&&Dt.textContent){const Kt=Dt.textContent,Ot=rn.startOffset,Je=Kt.lastIndexOf("@",Ot-1);if(Je>=0){Dt.textContent=Kt.slice(0,Je)+Kt.slice(Ot);const ct=Dt.textContent.slice(0,Je),lt=Dt.textContent.slice(Je);Dt.textContent=ct;const dt=Y0(He,Ce),yn=document.createTextNode(lt||" "),Xe=Dt.parentNode;Dt.nextSibling?(Xe.insertBefore(yn,Dt.nextSibling),Xe.insertBefore(dt,yn)):(Xe.appendChild(dt),Xe.appendChild(yn));const _t=document.createRange();_t.setStart(yn,lt?0:1),_t.collapse(!0),st.removeAllRanges(),st.addRange(_t)}}}re(!1),ue(""),xe.current=!0,r(fo($e)),xe.current=!1},[r]);y.useEffect(()=>{const He=W.current;if(!He)return;const $e=()=>{xe.current=!0;const st=fo(He);me.current(st),Q(!st.trim()&&!He.querySelector("[data-file-path]")),xe.current=!1;const rn=window.getSelection();if(!rn||rn.rangeCount===0)return;const Dt=rn.getRangeAt(0);let Kt=Dt.startContainer,Ot=Dt.startOffset;if(Kt.nodeType!==Node.TEXT_NODE){const lt=Kt.childNodes[Ot-1]??Kt.childNodes[Ot];if((lt==null?void 0:lt.nodeType)===Node.TEXT_NODE)Kt=lt,Ot=lt.length;else if(Ot>0&&Kt.childNodes[Ot-1]){let dt=Kt.childNodes[Ot-1];for(;dt&&dt.nodeType!==Node.TEXT_NODE&&dt.lastChild;)dt=dt.lastChild;if((dt==null?void 0:dt.nodeType)===Node.TEXT_NODE)Kt=dt,Ot=dt.length;else return}else return}const Je=Kt.textContent??"";if(Se.current){const lt=Je.lastIndexOf("@",Ot-1);if(lt<0||Ot<=lt){re(!1);return}const dt=Je.slice(lt+1,Ot);dt.includes(" ")||dt.includes(`
|
package/web-dist/dist/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="apple-touch-icon" sizes="256x256" href="./apple-touch-icon.png" />
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover, interactive-widget=resizes-content" />
|
|
10
10
|
<title>Jait</title>
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-B6S819w2.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-Gk9MVz3J.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|
package/web-dist/index.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<link rel="apple-touch-icon" sizes="256x256" href="./apple-touch-icon.png" />
|
|
9
9
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover, interactive-widget=resizes-content" />
|
|
10
10
|
<title>Jait</title>
|
|
11
|
-
<script type="module" crossorigin src="./assets/index-
|
|
11
|
+
<script type="module" crossorigin src="./assets/index-B6S819w2.js"></script>
|
|
12
12
|
<link rel="stylesheet" crossorigin href="./assets/index-Gk9MVz3J.css">
|
|
13
13
|
</head>
|
|
14
14
|
<body>
|