tarsk 0.4.23 → 0.4.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/public/assets/{alert-dialog-2Kcr7vcf.js → alert-dialog-JOYww-on.js} +1 -1
- package/dist/public/assets/{browser-tab-CgLMsYM8.js → browser-tab-xojjEFYj.js} +1 -1
- package/dist/public/assets/chat-input-container-fUw0AY1R.js +1 -0
- package/dist/public/assets/{context-menu-sx0fb5uQ.js → context-menu-5lS4H_pS.js} +1 -1
- package/dist/public/assets/{diff-view-v-bVp3Zf.js → diff-view-DWNDi8zT.js} +1 -1
- package/dist/public/assets/{explorer-tab-view-CsPSJADk.js → explorer-tab-view-BtTXy75I.js} +2 -2
- package/dist/public/assets/{explorer-tree-DXXm8_b9.js → explorer-tree-DdPiBm7Y.js} +1 -1
- package/dist/public/assets/{explorer-view-8g0_dmv4.js → explorer-view-06kjYKL2.js} +1 -1
- package/dist/public/assets/index-CoryOY5D.css +1 -0
- package/dist/public/assets/index-DJNTxm7E.js +50 -0
- package/dist/public/assets/{project-settings-view-CVYvsVWo.js → project-settings-view-DF-F7P8K.js} +1 -1
- package/dist/public/assets/{provider-details-view-Cp_INkPg.js → provider-details-view-CbGbbmaI.js} +1 -1
- package/dist/public/assets/{react-vendor-4OUTOTE0.js → react-vendor-BX34Jw0L.js} +1 -1
- package/dist/public/assets/{resizable-D62plzWh.js → resizable-asBmgm9X.js} +1 -1
- package/dist/public/assets/{run-stop-button-ClYpPnNG.js → run-stop-button-MczHUMXL.js} +1 -1
- package/dist/public/assets/{settings-view-BWQrM94z.js → settings-view-CtiXQd-N.js} +2 -2
- package/dist/public/assets/{side-panel-container-Bkpb7_cb.js → side-panel-container-5txNmqNe.js} +1 -1
- package/dist/public/assets/store-xK3nfJ3V.js +2 -0
- package/dist/public/assets/tabs-B7OXJglU.js +1 -0
- package/dist/public/assets/{terminal-panel-4EVJwsCQ.js → terminal-panel-D3OZDoCd.js} +1 -1
- package/dist/public/assets/todos-view-CzW8DtQ9.js +1 -0
- package/dist/public/index.html +11 -11
- package/package.json +1 -1
- package/dist/public/assets/chat-input-container-VXGAcgnU.js +0 -1
- package/dist/public/assets/index-BPF49zet.css +0 -1
- package/dist/public/assets/index-DsX2aOD3.js +0 -50
- package/dist/public/assets/store-CJdxpohI.js +0 -2
- package/dist/public/assets/tabs-DI_KCGYt.js +0 -1
- package/dist/public/assets/todos-view-D3JYa8fa.js +0 -1
package/dist/public/assets/{project-settings-view-CVYvsVWo.js → project-settings-view-DF-F7P8K.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Mn as n,Nn as r,Or as i,Pn as a,da as o,gi as s,gn as c,hn as l,mn as u,o as d,vn as f,yn as p,yt as m}from"./dialogs-config-3Hr2GRdt.js";import{gt as h}from"./react-vendor-
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Mn as n,Nn as r,Or as i,Pn as a,da as o,gi as s,gn as c,hn as l,mn as u,o as d,vn as f,yn as p,yt as m}from"./dialogs-config-3Hr2GRdt.js";import{gt as h}from"./react-vendor-BX34Jw0L.js";import{t as g}from"./textarea-Dg4M60Yx.js";import{t as _}from"./use-toast-C3jyoS6i.js";var v=e(o(),1),y=t();function b({projectId:e,onProjectUpdated:t}){let o=h(),[b,x]=(0,v.useState)(``),[S,C]=(0,v.useState)(``),[w,T]=(0,v.useState)(``),[E,D]=(0,v.useState)(d.PullRequest),[O,k]=(0,v.useState)(``),[A,j]=(0,v.useState)(!1),[M,N]=(0,v.useState)(!1),[P,F]=(0,v.useState)(!1),[I,L]=(0,v.useState)(``),[R,z]=(0,v.useState)(``),[B,V]=(0,v.useState)(``),[H,U]=(0,v.useState)(``),[W,G]=(0,v.useState)(d.PullRequest),K=(0,v.useCallback)(async()=>{if(e){F(!0);try{let t=await m(e),n=t.name??``,r=t.setupScript??``,i=t.validationScript??``,a=t.runCommand??``,o=t.commitMethod??d.PullRequest;x(n),C(r),k(i),T(a),D(o),L(n),z(r),V(i),U(a),G(o)}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{F(!1)}}},[e]);return(0,v.useEffect)(()=>{K()},[K]),e?(0,y.jsxs)(`div`,{className:`p-6`,children:[(0,y.jsxs)(`div`,{className:`mb-6`,children:[(0,y.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Project Settings`}),(0,y.jsx)(`p`,{className:`text-muted-foreground`,children:`Configure settings for your project.`})]}),(0,y.jsxs)(`div`,{className:`space-y-6`,children:[(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(n,{htmlFor:`projectName`,children:`Project Name`}),(0,y.jsx)(r,{id:`projectName`,value:b,onChange:e=>x(e.target.value),placeholder:`Enter project name`,className:`text-sm`,disabled:P})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(n,{htmlFor:`setupScript`,children:`Setup Script`}),(0,y.jsx)(g,{id:`setupScript`,value:S,onChange:e=>C(e.target.value),placeholder:`e.g. npm install`,className:`font-mono text-sm min-h-[80px] resize-none`,disabled:P}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This script runs automatically after cloning the repo for new threads.`})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(n,{htmlFor:`validationScript`,children:`Validation Script`}),(0,y.jsx)(g,{id:`validationScript`,value:O,onChange:e=>k(e.target.value),placeholder:`e.g. npm run lint && npm test`,className:`font-mono text-sm min-h-[80px] resize-none`,disabled:P}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(n,{htmlFor:`runCommand`,children:`Run Command`}),(0,y.jsx)(a,{variant:`ghost`,size:`sm`,onClick:async()=>{if(e){N(!0);try{let t=await u(e);t.runCommand?(T(t.runCommand),_({title:`Success`,description:`Suggested: ${t.runCommand}`})):_({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{N(!1)}}},disabled:M||P,className:`text-xs h-6 px-2 gap-1`,children:M?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(s,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(i,{className:`h-3 w-3`}),`Suggest`]})})]}),(0,y.jsx)(r,{id:`runCommand`,value:w,onChange:e=>T(e.target.value),placeholder:`e.g. npm run dev`,className:`font-mono text-sm`,disabled:P}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The command to start the dev server. Leave empty to disable run functionality.`})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(n,{children:`Commit Method`}),(0,y.jsxs)(`div`,{className:`flex gap-4`,children:[(0,y.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`radio`,name:`commitMethod`,value:d.PullRequest,checked:E===d.PullRequest,onChange:e=>D(e.target.value),disabled:P}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Pull Requests`})]}),(0,y.jsxs)(`label`,{className:`flex items-center gap-2 cursor-pointer`,children:[(0,y.jsx)(`input`,{type:`radio`,name:`commitMethod`,value:d.Direct,checked:E===d.Direct,onChange:e=>D(e.target.value),disabled:P}),(0,y.jsx)(`span`,{className:`text-sm`,children:`Direct Commits`})]})]}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:E===d.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`})]}),(0,y.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,y.jsx)(a,{onClick:async()=>{if(e){j(!0);try{b!==I&&await c(e,b),S!==R&&await f(e,S.trim()||null,!1),O!==B&&await l(e,{validationScript:O.trim()||null}),w!==H&&await p(e,w.trim()||null),E!==W&&await l(e,{commitMethod:E}),_({title:`Success`,description:`Project settings saved`}),t?.(),o(`/`),L(b),z(S),V(O),U(w),G(E)}catch(e){_({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{j(!1)}}},disabled:A||P,children:A?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):P?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Loading...`]}):`Save`})})]})]}):(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Project Selected`}),(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a project from the sidebar to view its settings.`})]})})}export{b as default};
|
package/dist/public/assets/{provider-details-view-Cp_INkPg.js → provider-details-view-CbGbbmaI.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,Bi as n,Br as r,Cr as i,Ct as a,G as o,Gn as s,Gt as c,H as ee,Ii as te,Jr as ne,K as re,Li as ie,Nn as l,Pn as u,Q as ae,Ri as oe,St as se,U as ce,V as le,W as ue,Wn as d,ca as f,da as p,gi as m,kn as de,rn as fe,yi as pe}from"./dialogs-config-3Hr2GRdt.js";import{c as h,l as g,s as _,u as v}from"./history-view-Cyhu-ped.js";import{n as y,r as me}from"./onboarding-DzgFi5ix.js";import{i as he,n as ge,r as _e,t as ve}from"./tabs-DI_KCGYt.js";var b=e(p(),1),x=i();function S({selectedProviderName:e,className:i}){let[p,S]=(0,b.useState)(null),[C,ye]=(0,b.useState)(``),[w,T]=(0,b.useState)(!1),[E,D]=(0,b.useState)(null),[O,k]=(0,b.useState)(``),[A,j]=(0,b.useState)([]),[M,N]=(0,b.useState)(new Set),[P,F]=(0,b.useState)(new Set),[I,L]=(0,b.useState)(new Map),[R,z]=(0,b.useState)(``),[B,V]=(0,b.useState)(`alphabetical`),[H,be]=(0,b.useState)(`all`),[U,xe]=(0,b.useState)(!1),[W,G]=(0,b.useState)(``),[Se,Ce]=(0,b.useState)(``),[we,Te]=(0,b.useState)(`coding`),[K,Ee]=(0,b.useState)([]),[q,J]=(0,b.useState)(new Set),[De,Oe]=(0,b.useState)(new Set),[Y,X]=(0,b.useState)(new Map),Z=e=>me(e.id);(0,b.useEffect)(()=>{(async()=>{k(``);try{let t=await a();if(e){let n=t.find(t=>t.name===e);S(n??null),Ce(n?.apiKey??``),ye(n?.apiKey??``),n&&(Ae(n.slug),ke(n.slug))}}catch(e){k(e instanceof Error?e.message:`Failed to load providers`)}})()},[e]);let ke=async e=>{D(null);try{let t=await se(e);t.status===`success`&&D(t.balance)}catch(t){console.error(`Failed to load balance for ${e}:`,t)}},Ae=async e=>{T(!0),z(``),V(`alphabetical`),be(`all`),Te(`coding`);try{let[n,r,i,a]=await Promise.all([re(e),o(e),t(),ae()]);j(n),Ee(r);let s=new Set((i[e]||[]).map(e=>e.id));N(s),F(s);let c=new Set((a[e]||[]).map(e=>e.id));J(c),Oe(c),L(new Map),X(new Map)}catch(t){console.error(`Failed to load models for ${e}:`,t),j([]),Ee([]),N(new Set),F(new Set),J(new Set),Oe(new Set)}finally{T(!1)}},je=(e,t)=>{p?.name===e&&(ye(t),Me(t))},Me=async e=>{if(!(!p||e===Se))try{await fe(p.slug,e),Ce(e),G(`API key saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save API key`)}},Ne=(e,t)=>{t===`image`?X(t=>{let n=new Map(t),r=q.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),Q(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):L(t=>{let n=new Map(t),r=M.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),Q(e,(n.has(e)?n.get(e):r)??!1,`coding`),n})},Q=async(e,t,n=`coding`)=>{if(p)try{n===`image`?(t?(await ce(p.slug,e),J(t=>new Set([...t,e]))):(await le(p.slug,e),J(t=>{let n=new Set(t);return n.delete(e),n})),X(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await ue(p.slug,e),N(t=>new Set([...t,e]))):(await ee(p.slug,e),N(t=>{let n=new Set(t);return n.delete(e),n})),L(t=>{let n=new Map(t);return n.delete(e),n})),G(`Model preferences saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save model changes`)}},Pe=(e,t=`coding`)=>{let n=t===`image`?K:A,r=t===`image`?q:M;n.forEach(n=>{r.has(n.id)!==e&&Q(n.id,e,t)}),t===`image`?X(new Map):L(new Map)},Fe=async e=>{try{await c(e)}catch(e){console.error(`Failed to open provider website:`,e)}},$=C!==void 0&&C.trim().length>0,Ie=e=>e?e<20?1:e<30?2:e<40?3:e<50?4:5:0,Le=({codingIndex:e,modelName:t})=>{let n=Ie(e);return n===0?null:(0,x.jsx)(g,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(`div`,{className:`flex items-center gap-0.5`,children:[1,2,3,4,5].map(e=>(0,x.jsx)(r,{className:`h-3 w-3 ${e<=n?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),(0,x.jsx)(h,{children:(0,x.jsxs)(`p`,{className:`text-sm`,children:[t,` was indexed `,e,` for coding intelligence`]})})]})})},Re=A.filter(e=>{let t=R.toLowerCase(),n=Z(e),r=e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||n.toLowerCase().includes(t);if(H===`free`){let t=e.pricing?.prompt===0&&e.pricing?.completion===0;return r&&t}return r}).sort((e,t)=>{let n=+!P.has(e.id),r=+!P.has(t.id);if(n!==r)return n-r;if(B===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((t.pricing.prompt??0)+(t.pricing.completion??0))/2:n?-1:1}if(B===`price-high`){let n=!!e.pricing;if(n!==!!t.pricing)return n?-1:1;if(!e.pricing||!t.pricing)return 0;let r=((e.pricing.prompt??0)+(e.pricing.completion??0))/2;return((t.pricing.prompt??0)+(t.pricing.completion??0))/2-r}if(B===`coding-index`){let n=e.coding_index!==void 0&&e.coding_index!==null;return n===(t.coding_index!==void 0&&t.coding_index!==null)?!e.coding_index||!t.coding_index?0:t.coding_index-e.coding_index:n?-1:1}return Z(e).localeCompare(Z(t))}),ze=K.filter(e=>{let t=R.toLowerCase(),n=Z(e),r=e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||n.toLowerCase().includes(t);if(H===`free`){let t=e.pricing?.prompt===0&&e.pricing?.completion===0;return r&&t}return r}).sort((e,t)=>{let n=+!De.has(e.id),r=+!De.has(t.id);if(n!==r)return n-r;if(B===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((t.pricing.prompt??0)+(t.pricing.completion??0))/2:n?-1:1}if(B===`price-high`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((t.pricing.prompt??0)+(t.pricing.completion??0))/2-((e.pricing.prompt??0)+(e.pricing.completion??0))/2:n?-1:1}return Z(e).localeCompare(Z(t))});return O?(0,x.jsxs)(`div`,{className:d(`flex flex-1 flex-col items-center justify-center gap-2`,i),children:[(0,x.jsx)(`p`,{className:`text-sm text-destructive`,children:O}),(0,x.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>window.location.reload(),children:`Retry`})]}):p?(0,x.jsx)(de,{className:d(`flex-1`,i),children:(0,x.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,x.jsxs)(`div`,{className:`mb-6`,children:[(0,x.jsxs)(`h1`,{className:`text-2xl font-bold`,children:[p.name,` Settings`]}),(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:`Configure API keys and models for this provider.`})]}),(0,x.jsxs)(`div`,{className:`space-y-6`,children:[(0,x.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-between min-h-[20px]`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-2`,children:E===null?(0,x.jsx)(`div`,{className:`h-[20px] w-[1px]`}):(0,x.jsxs)(`span`,{className:`text-xs font-medium text-green-600 bg-green-50 px-2.5 py-1 rounded-full border border-green-100 flex items-center gap-1.5`,children:[(0,x.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),`$`,s(E),` `,`balance`]})}),p.url?(0,x.jsx)(g,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsxs)(u,{variant:`ghost`,size:`sm`,onClick:()=>Fe(p.url),className:`flex items-center gap-1 text-xs text-brand h-auto p-3`,children:[`Visit provider website `,(0,x.jsx)(oe,{className:`h-3 w-3`})]})}),(0,x.jsx)(h,{children:(0,x.jsx)(`p`,{children:p.url})})]})}):(0,x.jsx)(`div`,{className:`h-[20px] w-[1px]`})]})}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,x.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,x.jsx)(g,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(`span`,{className:`text-sm font-medium cursor-help`,children:`API Key`})}),(0,x.jsx)(h,{children:`Your API key is stored locally and never shared.`})]})})}),p.authType===`APIKey`?(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(pe,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,x.jsx)(l,{type:U?`text`:`password`,placeholder:p.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:C,onChange:e=>{je(p.name,e.target.value)}}),(0,x.jsx)(u,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>xe(!U),disabled:!C,children:U?(0,x.jsx)(ie,{className:`h-4 w-4 text-muted-foreground`}):(0,x.jsx)(te,{className:`h-4 w-4 text-muted-foreground`})})]}):(0,x.jsxs)(`div`,{className:`rounded-md bg-muted/30 p-4 text-center`,children:[(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This provider uses OAuth for authentication.`}),(0,x.jsxs)(u,{variant:`outline`,size:`sm`,className:`mt-2`,disabled:!0,children:[`Sign in with `,p.name]})]})]}),(0,x.jsxs)(ve,{value:we,onValueChange:e=>{Te(e),z(``),V(`alphabetical`)},children:[(0,x.jsxs)(_e,{className:`mb-4`,children:[(0,x.jsx)(he,{value:`coding`,children:`Coding`}),p?.name.toLowerCase()===`openrouter`&&(0,x.jsx)(he,{value:`image`,children:`Image`})]}),(0,x.jsx)(ge,{value:`coding`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!w&&A.length>0&&(0,x.jsxs)(`div`,{className:d(`flex items-center justify-between gap-3`,!$&&`opacity-25`),children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(y,{id:`select-all-models`,disabled:!$,checked:A.every(e=>{let t=I.has(e.id),n=I.get(e.id);return t?n:M.has(e.id)}),onCheckedChange:e=>Pe(e===!0,`coding`)}),(0,x.jsx)(`label`,{htmlFor:`select-all-models`,className:`text-sm cursor-pointer whitespace-nowrap`,children:`Select all models`})]}),(0,x.jsxs)(`div`,{className:`flex-1 relative`,children:[(0,x.jsx)(ne,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,x.jsx)(l,{placeholder:`Search models...`,className:`pl-10 h-8`,value:R,onChange:e=>z(e.target.value),disabled:!$})]}),(0,x.jsx)(g,{children:(0,x.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`alphabetical`),children:(0,x.jsx)(f,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort A–Z`})]}),(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`price-low`||B===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`price-low`),children:(0,x.jsx)(n,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort by price`})]}),(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`coding-index`),children:(0,x.jsx)(r,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort by coding intelligence`})]})]})})]}),w?(0,x.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,x.jsx)(m,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):A.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models available for this provider.`})}):(0,x.jsx)(g,{children:(0,x.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:Re.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models matching your filters.`})}):Re.map(e=>{let t=M.has(e.id),n=I.has(e.id),r=I.get(e.id),i=n?r:t,a=e.pricing;return(0,x.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,x.jsx)(y,{id:e.id,disabled:!$,checked:i??!1,onCheckedChange:()=>Ne(e.id,`coding`),className:`mt-0`}),(0,x.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,x.jsx)(`label`,{htmlFor:e.id,className:`text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`,children:Z(e)})}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[B===`coding-index`&&(0,x.jsx)(Le,{codingIndex:e.coding_index,modelName:Z(e)}),a&&(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${s(a.prompt??0)} in | $${s(a.completion??0)} out`})]})]})]},e.id)})})})]})}),(0,x.jsx)(ge,{value:`image`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!w&&K.length>0&&(0,x.jsxs)(`div`,{className:d(`flex items-center justify-between gap-3`,!$&&`opacity-25`),children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(y,{id:`select-all-image-models`,disabled:!$,checked:K.every(e=>{let t=Y.has(e.id),n=Y.get(e.id);return t?n:q.has(e.id)}),onCheckedChange:e=>Pe(e===!0,`image`)}),(0,x.jsx)(`label`,{htmlFor:`select-all-image-models`,className:`text-sm cursor-pointer whitespace-nowrap`,children:`Select all models`})]}),(0,x.jsxs)(`div`,{className:`flex-1 relative`,children:[(0,x.jsx)(ne,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,x.jsx)(l,{placeholder:`Search models...`,className:`pl-10 h-8`,value:R,onChange:e=>z(e.target.value),disabled:!$})]}),(0,x.jsx)(g,{children:(0,x.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`alphabetical`),children:(0,x.jsx)(f,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort A–Z`})]}),(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`price-low`||B===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`price-low`),children:(0,x.jsx)(n,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort by price`})]})]})})]}),w?(0,x.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,x.jsx)(m,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):K.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No image models available for this provider.`})}):(0,x.jsx)(g,{children:(0,x.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:ze.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models matching your filters.`})}):ze.map(e=>{let t=q.has(e.id),n=Y.has(e.id),r=Y.get(e.id),i=n?r:t,a=e.pricing;return(0,x.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,x.jsx)(y,{id:`image-${e.id}`,disabled:!$,checked:i??!1,onCheckedChange:()=>Ne(e.id,`image`),className:`mt-0`}),(0,x.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,x.jsx)(`label`,{htmlFor:`image-${e.id}`,className:`text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`,children:Z(e)})}),a&&(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap flex-shrink-0`,children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${s(a.prompt??0)} in | $${s(a.completion??0)} out`})]})]},e.id)})})})]})})]}),W&&(0,x.jsx)(`div`,{className:`text-sm p-2 rounded-md ${W.includes(`error`)||W.includes(`Failed`)?`text-destructive bg-destructive/10`:`text-green-600 bg-green-50`}`,children:W})]})]})}):(0,x.jsx)(`div`,{className:d(`flex flex-1 items-center justify-center h-screen`,i),children:(0,x.jsxs)(`div`,{className:`text-center`,children:[(0,x.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`Select a Provider`}),(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Choose a provider from the sidebar to configure its settings.`})]})})}export{S as ProviderDetailsView,S as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{$ as t,Bi as n,Br as r,Cr as i,Ct as a,G as o,Gn as s,Gt as c,H as ee,Ii as te,Jr as ne,K as re,Li as ie,Nn as l,Pn as u,Q as ae,Ri as oe,St as se,U as ce,V as le,W as ue,Wn as d,ca as f,da as p,gi as m,kn as de,rn as fe,yi as pe}from"./dialogs-config-3Hr2GRdt.js";import{c as h,l as g,s as _,u as v}from"./history-view-Cyhu-ped.js";import{n as y,r as me}from"./onboarding-DzgFi5ix.js";import{i as he,n as ge,r as _e,t as ve}from"./tabs-B7OXJglU.js";var b=e(p(),1),x=i();function S({selectedProviderName:e,className:i}){let[p,S]=(0,b.useState)(null),[C,ye]=(0,b.useState)(``),[w,T]=(0,b.useState)(!1),[E,D]=(0,b.useState)(null),[O,k]=(0,b.useState)(``),[A,j]=(0,b.useState)([]),[M,N]=(0,b.useState)(new Set),[P,F]=(0,b.useState)(new Set),[I,L]=(0,b.useState)(new Map),[R,z]=(0,b.useState)(``),[B,V]=(0,b.useState)(`alphabetical`),[H,be]=(0,b.useState)(`all`),[U,xe]=(0,b.useState)(!1),[W,G]=(0,b.useState)(``),[Se,Ce]=(0,b.useState)(``),[we,Te]=(0,b.useState)(`coding`),[K,Ee]=(0,b.useState)([]),[q,J]=(0,b.useState)(new Set),[De,Oe]=(0,b.useState)(new Set),[Y,X]=(0,b.useState)(new Map),Z=e=>me(e.id);(0,b.useEffect)(()=>{(async()=>{k(``);try{let t=await a();if(e){let n=t.find(t=>t.name===e);S(n??null),Ce(n?.apiKey??``),ye(n?.apiKey??``),n&&(Ae(n.slug),ke(n.slug))}}catch(e){k(e instanceof Error?e.message:`Failed to load providers`)}})()},[e]);let ke=async e=>{D(null);try{let t=await se(e);t.status===`success`&&D(t.balance)}catch(t){console.error(`Failed to load balance for ${e}:`,t)}},Ae=async e=>{T(!0),z(``),V(`alphabetical`),be(`all`),Te(`coding`);try{let[n,r,i,a]=await Promise.all([re(e),o(e),t(),ae()]);j(n),Ee(r);let s=new Set((i[e]||[]).map(e=>e.id));N(s),F(s);let c=new Set((a[e]||[]).map(e=>e.id));J(c),Oe(c),L(new Map),X(new Map)}catch(t){console.error(`Failed to load models for ${e}:`,t),j([]),Ee([]),N(new Set),F(new Set),J(new Set),Oe(new Set)}finally{T(!1)}},je=(e,t)=>{p?.name===e&&(ye(t),Me(t))},Me=async e=>{if(!(!p||e===Se))try{await fe(p.slug,e),Ce(e),G(`API key saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save API key`)}},Ne=(e,t)=>{t===`image`?X(t=>{let n=new Map(t),r=q.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),Q(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):L(t=>{let n=new Map(t),r=M.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),Q(e,(n.has(e)?n.get(e):r)??!1,`coding`),n})},Q=async(e,t,n=`coding`)=>{if(p)try{n===`image`?(t?(await ce(p.slug,e),J(t=>new Set([...t,e]))):(await le(p.slug,e),J(t=>{let n=new Set(t);return n.delete(e),n})),X(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await ue(p.slug,e),N(t=>new Set([...t,e]))):(await ee(p.slug,e),N(t=>{let n=new Set(t);return n.delete(e),n})),L(t=>{let n=new Map(t);return n.delete(e),n})),G(`Model preferences saved successfully`),setTimeout(()=>G(``),3e3)}catch(e){G(e instanceof Error?e.message:`Failed to save model changes`)}},Pe=(e,t=`coding`)=>{let n=t===`image`?K:A,r=t===`image`?q:M;n.forEach(n=>{r.has(n.id)!==e&&Q(n.id,e,t)}),t===`image`?X(new Map):L(new Map)},Fe=async e=>{try{await c(e)}catch(e){console.error(`Failed to open provider website:`,e)}},$=C!==void 0&&C.trim().length>0,Ie=e=>e?e<20?1:e<30?2:e<40?3:e<50?4:5:0,Le=({codingIndex:e,modelName:t})=>{let n=Ie(e);return n===0?null:(0,x.jsx)(g,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(`div`,{className:`flex items-center gap-0.5`,children:[1,2,3,4,5].map(e=>(0,x.jsx)(r,{className:`h-3 w-3 ${e<=n?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),(0,x.jsx)(h,{children:(0,x.jsxs)(`p`,{className:`text-sm`,children:[t,` was indexed `,e,` for coding intelligence`]})})]})})},Re=A.filter(e=>{let t=R.toLowerCase(),n=Z(e),r=e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||n.toLowerCase().includes(t);if(H===`free`){let t=e.pricing?.prompt===0&&e.pricing?.completion===0;return r&&t}return r}).sort((e,t)=>{let n=+!P.has(e.id),r=+!P.has(t.id);if(n!==r)return n-r;if(B===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((t.pricing.prompt??0)+(t.pricing.completion??0))/2:n?-1:1}if(B===`price-high`){let n=!!e.pricing;if(n!==!!t.pricing)return n?-1:1;if(!e.pricing||!t.pricing)return 0;let r=((e.pricing.prompt??0)+(e.pricing.completion??0))/2;return((t.pricing.prompt??0)+(t.pricing.completion??0))/2-r}if(B===`coding-index`){let n=e.coding_index!==void 0&&e.coding_index!==null;return n===(t.coding_index!==void 0&&t.coding_index!==null)?!e.coding_index||!t.coding_index?0:t.coding_index-e.coding_index:n?-1:1}return Z(e).localeCompare(Z(t))}),ze=K.filter(e=>{let t=R.toLowerCase(),n=Z(e),r=e.name.toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||n.toLowerCase().includes(t);if(H===`free`){let t=e.pricing?.prompt===0&&e.pricing?.completion===0;return r&&t}return r}).sort((e,t)=>{let n=+!De.has(e.id),r=+!De.has(t.id);if(n!==r)return n-r;if(B===`price-low`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((e.pricing.prompt??0)+(e.pricing.completion??0))/2-((t.pricing.prompt??0)+(t.pricing.completion??0))/2:n?-1:1}if(B===`price-high`){let n=!!e.pricing;return n===!!t.pricing?!e.pricing||!t.pricing?0:((t.pricing.prompt??0)+(t.pricing.completion??0))/2-((e.pricing.prompt??0)+(e.pricing.completion??0))/2:n?-1:1}return Z(e).localeCompare(Z(t))});return O?(0,x.jsxs)(`div`,{className:d(`flex flex-1 flex-col items-center justify-center gap-2`,i),children:[(0,x.jsx)(`p`,{className:`text-sm text-destructive`,children:O}),(0,x.jsx)(u,{variant:`outline`,size:`sm`,onClick:()=>window.location.reload(),children:`Retry`})]}):p?(0,x.jsx)(de,{className:d(`flex-1`,i),children:(0,x.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,x.jsxs)(`div`,{className:`mb-6`,children:[(0,x.jsxs)(`h1`,{className:`text-2xl font-bold`,children:[p.name,` Settings`]}),(0,x.jsx)(`p`,{className:`text-muted-foreground`,children:`Configure API keys and models for this provider.`})]}),(0,x.jsxs)(`div`,{className:`space-y-6`,children:[(0,x.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-between min-h-[20px]`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-2`,children:E===null?(0,x.jsx)(`div`,{className:`h-[20px] w-[1px]`}):(0,x.jsxs)(`span`,{className:`text-xs font-medium text-green-600 bg-green-50 px-2.5 py-1 rounded-full border border-green-100 flex items-center gap-1.5`,children:[(0,x.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),`$`,s(E),` `,`balance`]})}),p.url?(0,x.jsx)(g,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsxs)(u,{variant:`ghost`,size:`sm`,onClick:()=>Fe(p.url),className:`flex items-center gap-1 text-xs text-brand h-auto p-3`,children:[`Visit provider website `,(0,x.jsx)(oe,{className:`h-3 w-3`})]})}),(0,x.jsx)(h,{children:(0,x.jsx)(`p`,{children:p.url})})]})}):(0,x.jsx)(`div`,{className:`h-[20px] w-[1px]`})]})}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,x.jsx)(`div`,{className:`flex items-center justify-between`,children:(0,x.jsx)(g,{children:(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(`span`,{className:`text-sm font-medium cursor-help`,children:`API Key`})}),(0,x.jsx)(h,{children:`Your API key is stored locally and never shared.`})]})})}),p.authType===`APIKey`?(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(pe,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,x.jsx)(l,{type:U?`text`:`password`,placeholder:p.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:C,onChange:e=>{je(p.name,e.target.value)}}),(0,x.jsx)(u,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>xe(!U),disabled:!C,children:U?(0,x.jsx)(ie,{className:`h-4 w-4 text-muted-foreground`}):(0,x.jsx)(te,{className:`h-4 w-4 text-muted-foreground`})})]}):(0,x.jsxs)(`div`,{className:`rounded-md bg-muted/30 p-4 text-center`,children:[(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This provider uses OAuth for authentication.`}),(0,x.jsxs)(u,{variant:`outline`,size:`sm`,className:`mt-2`,disabled:!0,children:[`Sign in with `,p.name]})]})]}),(0,x.jsxs)(ve,{value:we,onValueChange:e=>{Te(e),z(``),V(`alphabetical`)},children:[(0,x.jsxs)(_e,{className:`mb-4`,children:[(0,x.jsx)(he,{value:`coding`,children:`Coding`}),p?.name.toLowerCase()===`openrouter`&&(0,x.jsx)(he,{value:`image`,children:`Image`})]}),(0,x.jsx)(ge,{value:`coding`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!w&&A.length>0&&(0,x.jsxs)(`div`,{className:d(`flex items-center justify-between gap-3`,!$&&`opacity-25`),children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(y,{id:`select-all-models`,disabled:!$,checked:A.every(e=>{let t=I.has(e.id),n=I.get(e.id);return t?n:M.has(e.id)}),onCheckedChange:e=>Pe(e===!0,`coding`)}),(0,x.jsx)(`label`,{htmlFor:`select-all-models`,className:`text-sm cursor-pointer whitespace-nowrap`,children:`Select all models`})]}),(0,x.jsxs)(`div`,{className:`flex-1 relative`,children:[(0,x.jsx)(ne,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,x.jsx)(l,{placeholder:`Search models...`,className:`pl-10 h-8`,value:R,onChange:e=>z(e.target.value),disabled:!$})]}),(0,x.jsx)(g,{children:(0,x.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`alphabetical`),children:(0,x.jsx)(f,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort A–Z`})]}),(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`price-low`||B===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`price-low`),children:(0,x.jsx)(n,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort by price`})]}),(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`coding-index`),children:(0,x.jsx)(r,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort by coding intelligence`})]})]})})]}),w?(0,x.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,x.jsx)(m,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):A.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models available for this provider.`})}):(0,x.jsx)(g,{children:(0,x.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:Re.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models matching your filters.`})}):Re.map(e=>{let t=M.has(e.id),n=I.has(e.id),r=I.get(e.id),i=n?r:t,a=e.pricing;return(0,x.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,x.jsx)(y,{id:e.id,disabled:!$,checked:i??!1,onCheckedChange:()=>Ne(e.id,`coding`),className:`mt-0`}),(0,x.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,x.jsx)(`label`,{htmlFor:e.id,className:`text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`,children:Z(e)})}),(0,x.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[B===`coding-index`&&(0,x.jsx)(Le,{codingIndex:e.coding_index,modelName:Z(e)}),a&&(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${s(a.prompt??0)} in | $${s(a.completion??0)} out`})]})]})]},e.id)})})})]})}),(0,x.jsx)(ge,{value:`image`,children:(0,x.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[!w&&K.length>0&&(0,x.jsxs)(`div`,{className:d(`flex items-center justify-between gap-3`,!$&&`opacity-25`),children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(y,{id:`select-all-image-models`,disabled:!$,checked:K.every(e=>{let t=Y.has(e.id),n=Y.get(e.id);return t?n:q.has(e.id)}),onCheckedChange:e=>Pe(e===!0,`image`)}),(0,x.jsx)(`label`,{htmlFor:`select-all-image-models`,className:`text-sm cursor-pointer whitespace-nowrap`,children:`Select all models`})]}),(0,x.jsxs)(`div`,{className:`flex-1 relative`,children:[(0,x.jsx)(ne,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,x.jsx)(l,{placeholder:`Search models...`,className:`pl-10 h-8`,value:R,onChange:e=>z(e.target.value),disabled:!$})]}),(0,x.jsx)(g,{children:(0,x.jsxs)(`div`,{className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`alphabetical`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`alphabetical`),children:(0,x.jsx)(f,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort A–Z`})]}),(0,x.jsxs)(_,{children:[(0,x.jsx)(v,{asChild:!0,children:(0,x.jsx)(u,{type:`button`,variant:B===`price-low`||B===`price-high`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>V(`price-low`),children:(0,x.jsx)(n,{className:`h-4 w-4`})})}),(0,x.jsx)(h,{children:`Sort by price`})]})]})})]}),w?(0,x.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,x.jsx)(m,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):K.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No image models available for this provider.`})}):(0,x.jsx)(g,{children:(0,x.jsx)(`div`,{className:`grid grid-cols-1 gap-0 border border-border rounded-md overflow-hidden`,children:ze.length===0?(0,x.jsx)(`div`,{className:`text-center py-8`,children:(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No models matching your filters.`})}):ze.map(e=>{let t=q.has(e.id),n=Y.has(e.id),r=Y.get(e.id),i=n?r:t,a=e.pricing;return(0,x.jsxs)(`div`,{className:`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default border-b border-border last:border-b-0 ${$?``:`opacity-25`}`,children:[(0,x.jsx)(y,{id:`image-${e.id}`,disabled:!$,checked:i??!1,onCheckedChange:()=>Ne(e.id,`image`),className:`mt-0`}),(0,x.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,x.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,x.jsx)(`label`,{htmlFor:`image-${e.id}`,className:`text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`,children:Z(e)})}),a&&(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap flex-shrink-0`,children:(a.prompt??0)===0&&(a.completion??0)===0?``:`$${s(a.prompt??0)} in | $${s(a.completion??0)} out`})]})]},e.id)})})})]})})]}),W&&(0,x.jsx)(`div`,{className:`text-sm p-2 rounded-md ${W.includes(`error`)||W.includes(`Failed`)?`text-destructive bg-destructive/10`:`text-green-600 bg-green-50`}`,children:W})]})]})}):(0,x.jsx)(`div`,{className:d(`flex flex-1 items-center justify-center h-screen`,i),children:(0,x.jsxs)(`div`,{className:`text-center`,children:[(0,x.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`Select a Provider`}),(0,x.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Choose a provider from the sidebar to configure its settings.`})]})})}export{S as ProviderDetailsView,S as default};
|