tarsk 0.5.73 → 0.5.75
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/bundled-skills/skill-creator/scripts/__tests__/quick_validate.test.js +79 -0
- package/dist/bundled-skills/skill-creator/scripts/quick_validate.js +78 -65
- package/dist/index.js +160278 -184830
- package/dist/jelly.webp +0 -0
- package/dist/public/assets/account-view-DvyhZGLB.js +1 -0
- package/dist/public/assets/alert-dialog-BxMfaLuO.js +7 -0
- package/dist/public/assets/api-DX1ny6q-.js +2 -0
- package/dist/public/assets/async-error-boundary-BX1G17o9.js +1 -0
- package/dist/public/assets/async-loading-fallback-V0EaQ_Kn.js +1 -0
- package/dist/public/assets/browser-tab-5rqpwS93.js +12 -0
- package/dist/public/assets/button-kWtLAMpB.js +1 -0
- package/dist/public/assets/card-B_EASkic.js +1 -0
- package/dist/public/assets/chat-dock-context-BJNNRoZC.js +1 -0
- package/dist/public/assets/commit-dialog-BUfbvG6F.js +1 -0
- package/dist/public/assets/commit-error-dialog-D1XRPBOc.js +1 -0
- package/dist/public/assets/commit-method-fields-CVQjrJ_O.js +1 -0
- package/dist/public/assets/context-menu-BcM6I0Sx.js +1 -0
- package/dist/public/assets/conversation-history-view-CzRrC6cJ.js +1 -0
- package/dist/public/assets/create-project-dialog-Bqm_qC2v.js +2 -0
- package/dist/public/assets/create-project-workspace-Dv_lEfZx.js +2 -0
- package/dist/public/assets/create-repo-dialog-D2H1eZic.js +1 -0
- package/dist/public/assets/{delete-confirm-dialog-C9NASyh6.js → delete-confirm-dialog-Dl76vaxb.js} +1 -1
- package/dist/public/assets/diff-view-zXlCXzER.js +4 -0
- package/dist/public/assets/dist-C2G92uPn.js +1 -0
- package/dist/public/assets/dist-CHhgoHp6.js +1 -0
- package/dist/public/assets/dist-CTLFS4dn.js +2 -0
- package/dist/public/assets/dist-D-2G8xGB.js +5 -0
- package/dist/public/assets/dist-DD4GtbiM.js +1 -0
- package/dist/public/assets/{dist-mdooLpmq.js → dist-DoxvnNEY.js} +1 -1
- package/dist/public/assets/dist-DsmF-KJ-.js +1 -0
- package/dist/public/assets/dist-c_QADQ5u.js +1 -0
- package/dist/public/assets/dist-yM5kyz9Q.js +1 -0
- package/dist/public/assets/es2015-BlPKkFZZ.js +41 -0
- package/dist/public/assets/explorer-monaco-editor-BdZ_bBqh.js +1 -0
- package/dist/public/assets/explorer-tab-view-BOc5FPFg.js +2 -0
- package/dist/public/assets/explorer-tree-m1u3VhWL.js +1 -0
- package/dist/public/assets/explorer-view-DFjt0DXO.js +76 -0
- package/dist/public/assets/git-history-dialog-CFoZcBB0.js +1 -0
- package/dist/public/assets/index-BLNUy5nZ.css +1 -0
- package/dist/public/assets/index-u8UbWjXL.js +3658 -0
- package/dist/public/assets/merged-pr-dialog-BMqHRow2.js +1 -0
- package/dist/public/assets/model-list-controls-CNrps9Ys.js +1 -0
- package/dist/public/assets/onboarding-dialog-BFJftu2O.js +1 -0
- package/dist/public/assets/project-coding-view-DG1D8-z4.js +1 -0
- package/dist/public/assets/project-danger-zone-view-6HEDGyUj.js +1 -0
- package/dist/public/assets/project-env-vars-view-TblkryyN.js +1 -0
- package/dist/public/assets/project-model-aliases-view-Ct0v4NQm.js +1 -0
- package/dist/public/assets/project-settings-view-Dd3QPujg.js +1 -0
- package/dist/public/assets/project-tools-view-DdsKSUDp.js +1 -0
- package/dist/public/assets/providers-list-view-BUNk2E8O.js +1 -0
- package/dist/public/assets/pull-request-dialog-BRiR5Qz8.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-BCIWOzvE.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-BEr0QZlO.js +1 -0
- package/dist/public/assets/radio-group-Dn_pN-pn.js +1 -0
- package/dist/public/assets/scroll-area-lkVMElz5.js +1 -0
- package/dist/public/assets/settings-general-view-CKvkG8C5.js +1 -0
- package/dist/public/assets/settings-list-B9a61wMg.js +1 -0
- package/dist/public/assets/settings-logs-view-4Uoa1-Dx.js +5 -0
- package/dist/public/assets/settings-mcp-servers-view-CaAy6iV4.js +5 -0
- package/dist/public/assets/settings-models-view-Ef404r4H.js +1 -0
- package/dist/public/assets/settings-skills-view-DLrG4E_U.js +3 -0
- package/dist/public/assets/settings-slack-view-C32in2Wg.js +1 -0
- package/dist/public/assets/settings-slash-commands-view-CpBMV_5D.js +1 -0
- package/dist/public/assets/settings-statistics-view-CxW2KB56.js +1 -0
- package/dist/public/assets/settings-storage-view-BzT8k6yE.js +1 -0
- package/dist/public/assets/settings-subagents-view-StdmEn-E.js +2 -0
- package/dist/public/assets/settings-system-prompt-view-DizAjXjo.js +1 -0
- package/dist/public/assets/settings-view-CTQgFmjM.js +2 -0
- package/dist/public/assets/slug-utils-CQ8PMWUL.js +1 -0
- package/dist/public/assets/store-BSzKIu5G.js +9 -0
- package/dist/public/assets/suspense-resource-BFrb_XJX.js +1 -0
- package/dist/public/assets/table-A3cgauiZ.js +1 -0
- package/dist/public/assets/tasks-view-z93aMoQp.js +1 -0
- package/dist/public/assets/terminal-panel-DSfDZzBk.js +38 -0
- package/dist/public/assets/toggle-group-Q36wRGKA.js +1 -0
- package/dist/public/assets/tooltip-Db8UeYxm.js +1 -0
- package/dist/public/assets/{use-active-dock-panel-instance-BSch6-Fx.js → use-active-dock-panel-instance-DNExGWVs.js} +1 -1
- package/dist/public/assets/use-installed-ai-files-BuuVI3sM.js +1 -0
- package/dist/public/assets/{use-suspense-resource-Dkz6ddFN.js → use-suspense-resource-Dakt9lfT.js} +1 -1
- package/dist/public/assets/useBaseQuery-GJoj38pA.js +1 -0
- package/dist/public/assets/{web-W5CC9Cq4.js → web-BmpJHrzY.js} +1 -1
- package/dist/public/assets/{web-DaiDQ9WA.js → web-CliOgvKf.js} +1 -1
- package/dist/public/assets/{web-BKpP7kYB.js → web-DyYrh5r4.js} +1 -1
- package/dist/public/assets/{web-CtDn8Ggo.js → web-Dzci4edU.js} +1 -1
- package/dist/public/browser-preview-rpc.js +107 -82
- package/dist/public/index.html +26 -33
- package/dist/recommended-models.txt +3 -3
- package/package.json +9 -8
- package/dist/public/assets/Combination-lwI_j-mU.js +0 -41
- package/dist/public/assets/account-view-DKQdyGPK.js +0 -1
- package/dist/public/assets/alert-dialog-Cb1PEgra.js +0 -7
- package/dist/public/assets/api-BMo_Lz8f.js +0 -2
- package/dist/public/assets/async-error-boundary-J8P6NVvc.js +0 -1
- package/dist/public/assets/async-loading-fallback-B_JNgWJR.js +0 -1
- package/dist/public/assets/browser-tab-D_GXZ93G.js +0 -12
- package/dist/public/assets/button-DeNw35VZ.js +0 -1
- package/dist/public/assets/card-B4eI0NI-.js +0 -1
- package/dist/public/assets/chat-dock-context-BXoAs38w.js +0 -1
- package/dist/public/assets/commit-dialog-DDLaQVzY.js +0 -1
- package/dist/public/assets/commit-error-dialog-Cp0Aic7I.js +0 -1
- package/dist/public/assets/commit-method-fields-CD3PTIox.js +0 -1
- package/dist/public/assets/context-menu-Dx5Jy21w.js +0 -1
- package/dist/public/assets/conversation-history-view-JymxZFJ2.js +0 -1
- package/dist/public/assets/create-project-dialog-qbwqSqGU.js +0 -6
- package/dist/public/assets/create-project-workspace-BcIx6FNf.js +0 -1
- package/dist/public/assets/create-repo-dialog-DcvSMy3g.js +0 -1
- package/dist/public/assets/dialog-Do98zzAW.js +0 -1
- package/dist/public/assets/diff-view-ePD0sdsW.js +0 -4
- package/dist/public/assets/dist-BWuYHVi8.js +0 -2
- package/dist/public/assets/dist-BZvmHCxP.js +0 -5
- package/dist/public/assets/dist-CWnEmdyL.js +0 -1
- package/dist/public/assets/dist-CWq9XRXF.js +0 -1
- package/dist/public/assets/dist-CjhvxqFU.js +0 -1
- package/dist/public/assets/dist-DIjomljy.js +0 -1
- package/dist/public/assets/dist-DiMgghKn.js +0 -1
- package/dist/public/assets/dist-DjKXDRW7.js +0 -1
- package/dist/public/assets/explorer-tab-view-D6hsKrXY.js +0 -2
- package/dist/public/assets/explorer-tree-BG8ShRwn.js +0 -1
- package/dist/public/assets/explorer-view-BZcNnLd9.js +0 -75
- package/dist/public/assets/git-history-dialog-DWhJ1-ba.js +0 -1
- package/dist/public/assets/index-DhOeeft5.css +0 -1
- package/dist/public/assets/index-DjaVbFDB.js +0 -3386
- package/dist/public/assets/is-macos-client-BIb4ZSEa.js +0 -1
- package/dist/public/assets/markdown-renderer-qLede1zH.js +0 -8
- package/dist/public/assets/mcp-server-card-zm-ss-7h.js +0 -1
- package/dist/public/assets/merged-pr-dialog-Due9WdB4.js +0 -1
- package/dist/public/assets/model-list-controls-D86_87E4.js +0 -1
- package/dist/public/assets/ndjson-stream-DeGpE5o5.js +0 -2
- package/dist/public/assets/onboarding-dialog-DlqbPvG0.js +0 -1
- package/dist/public/assets/project-env-vars-view-N1Io1Pau.js +0 -1
- package/dist/public/assets/project-model-aliases-view-B4FEze4g.js +0 -1
- package/dist/public/assets/project-settings-view-BalZ6Fe1.js +0 -1
- package/dist/public/assets/project-tools-view-OnCN0jKz.js +0 -1
- package/dist/public/assets/providers-list-view-DXvcxXDM.js +0 -1
- package/dist/public/assets/pull-request-dialog-BeeTNIN_.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-B9y2_lt_.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-D3pMFe9A.js +0 -1
- package/dist/public/assets/query-keys-5QPW6Dv-.js +0 -1
- package/dist/public/assets/radio-group-CU59hGiA.js +0 -1
- package/dist/public/assets/scenic-chrome-CbN3vum7.js +0 -1
- package/dist/public/assets/scroll-area-nbNFO91g.js +0 -1
- package/dist/public/assets/settings-general-view-CAYlYs3J.js +0 -1
- package/dist/public/assets/settings-instructions-view-GjQivhLy.js +0 -1
- package/dist/public/assets/settings-list-DU82HNPX.js +0 -1
- package/dist/public/assets/settings-logs-view-DnQ_4O9b.js +0 -5
- package/dist/public/assets/settings-mcp-servers-view-C6OZHR3K.js +0 -5
- package/dist/public/assets/settings-models-view-CTjnBd74.js +0 -1
- package/dist/public/assets/settings-rules-view-DiTC-cBE.js +0 -8
- package/dist/public/assets/settings-skills-view-DHoSorOw.js +0 -3
- package/dist/public/assets/settings-slack-view-CiuJZ-9i.js +0 -1
- package/dist/public/assets/settings-slash-commands-view-CnXff39A.js +0 -1
- package/dist/public/assets/settings-statistics-view-D8SvAGE_.js +0 -1
- package/dist/public/assets/settings-storage-view-CUsa7Lwv.js +0 -1
- package/dist/public/assets/settings-subagents-view-B4HugfzU.js +0 -2
- package/dist/public/assets/settings-system-prompt-view-DNQKxcFg.js +0 -1
- package/dist/public/assets/settings-view-DoZmXguf.js +0 -2
- package/dist/public/assets/skeleton-DvLd14RU.js +0 -1
- package/dist/public/assets/store-BaMSfYoJ.js +0 -9
- package/dist/public/assets/suspense-resource-DnYnmTbs.js +0 -1
- package/dist/public/assets/switch-pIBaqatj.js +0 -1
- package/dist/public/assets/table-B3fLagUj.js +0 -1
- package/dist/public/assets/tasks-view-BaMd8ZM0.js +0 -2
- package/dist/public/assets/terminal-panel-BjD6z-3y.js +0 -38
- package/dist/public/assets/toggle-group-5tREtjoW.js +0 -1
- package/dist/public/assets/tooltip-B6ziVyTv.js +0 -1
- package/dist/public/assets/use-installed-ai-files-E4BAFIPG.js +0 -1
- package/dist/public/assets/use-open-chat-dock-panel-Cr1bQYOH.js +0 -1
- package/dist/public/assets/useInfiniteQuery-DUeUxDcu.js +0 -1
- package/dist/public/assets/utils-CT-Dw22R.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function e(){return typeof navigator>`u`?!1:navigator.userAgentData?.platform===`macOS`?!0:navigator.platform.startsWith(`Mac`)}export{e as t};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-IeRYu0zQ.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,o as r,r as i,t as a}from"./react-vendor-Ee0-5T4I.js";import{a as o,n as s,t as c}from"./query-keys-5QPW6Dv-.js";import{S as l,dt as u,ft as d,lt as f,ot as p,st as m,z as h}from"./dist-BWuYHVi8.js";import{$t as g,An as _,Z as v,_t as y,it as b,mn as x,rn as S,rt as C,vt as w,wt as T,y as E,yn as D}from"./dist-DIjomljy.js";import{t as O}from"./utils-CT-Dw22R.js";import{t as k}from"./button-DeNw35VZ.js";import{Ar as A,Ht as j,Lr as M,Ur as N,Xt as P,g as F,mn as I}from"./api-BMo_Lz8f.js";import{i as L,n as R,r as z,t as B}from"./tooltip-B6ziVyTv.js";import{t as V}from"./use-toast-xpb5jNtN.js";import{i as ee,n as H,r as te,s as ne,t as U}from"./dialog-Do98zzAW.js";import{n as W}from"./explorer-tab-context-BxUVwWQQ.js";import{t as G}from"./use-open-chat-dock-panel-Cr1bQYOH.js";function K(e,t){return s(e,o,t)}var q=n(),J=e(r(),1);function re(e,t){let n=(0,q.c)(6),[r,i]=(0,J.useState)(e),a=(0,J.useRef)(-1/0),o=(0,J.useRef)(null),s=(0,J.useRef)(e),c;n[0]!==r||n[1]!==t||n[2]!==e?(c=()=>{if(s.current=e,Object.is(e,r))return;let n=function(){o.current=null,a.current=Date.now(),i(s.current)},c=Date.now()-a.current;if(c>=t){n();return}o.current||=setTimeout(n,t-c)},n[0]=r,n[1]=t,n[2]=e,n[3]=c):c=n[3],(0,J.useEffect)(c);let l,u;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>{o.current&&=(clearTimeout(o.current),null)},u=[],n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,J.useEffect)(l,u),r}var ie=e(t(),1),ae=.1,Y=10,oe=1.25,X=.001;function se(){let e=(0,q.c)(15),[t,n]=(0,J.useState)(1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={x:0,y:0},e[0]=r):r=e[0];let[i,a]=(0,J.useState)(r),[o,s]=(0,J.useState)(!1),c=(0,J.useRef)(null),l=Z,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>n(e=>l(e*oe)),e[1]=u):u=e[1];let d=u,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>n(e=>l(e/oe)),e[2]=f):f=e[2];let p=f,m;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{n(1),a({x:0,y:0})},e[3]=m):m=e[3];let h=m,g;e[4]===i?g=e[5]:(g=e=>{e.preventDefault(),s(!0),c.current={x:e.clientX,y:e.clientY,ox:i.x,oy:i.y}},e[4]=i,e[5]=g);let _=g,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{c.current&&a({x:c.current.ox+(e.clientX-c.current.x),y:c.current.oy+(e.clientY-c.current.y)})},e[6]=v):v=e[6];let y=v,b;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{s(!1),c.current=null},e[7]=b):b=e[7];let x=b,S=(0,J.useRef)(null),C,w;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{let e=S.current;if(!e)return;let t=function(e){e.preventDefault();let t=-e.deltaY*X;n(e=>l(e*(1+t)))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},w=[],e[8]=C,e[9]=w):(C=e[8],w=e[9]),(0,J.useEffect)(C,w);let T;return e[10]!==o||e[11]!==i||e[12]!==_||e[13]!==t?(T={scale:t,offset:i,isDragging:o,containerRef:S,zoomIn:d,zoomOut:p,reset:h,onMouseDown:_,onMouseMove:y,onMouseUp:x},e[10]=o,e[11]=i,e[12]=_,e[13]=t,e[14]=T):T=e[14],T}function Z(e){return Math.min(Math.max(e,ae),Y)}var Q=a(),ce=l(`app.mermaid-renderer.ui`);function le(){let e=(0,q.c)(2),[t,n]=(0,J.useState)(!1),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){n(document.documentElement.classList.contains(`dark`))};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,J.useEffect)(r,i),t}var ue=null;function de(){return ue||=i(()=>import(`./dist-IeRYu0zQ.js`),__vite__mapDeps([0,1])),ue}function fe(e,t){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let n=!1,i=setTimeout(()=>{let i=n=>{try{let i=n(e,{bg:t?`#18181B`:`#FFFFFF`,fg:t?`#FAFAFA`:`#27272A`,transparent:!1,padding:32});if(typeof i!=`string`||i.length===0)throw Error(`Mermaid renderer returned no SVG`);r(i),a(null)}catch(e){ce.error(`Mermaid render error:`,e),r(null),a(e instanceof Error?e.message:String(e))}};de().then(e=>{n||i(e.renderMermaidSVG)},e=>{n||(ce.error(`Mermaid renderer failed to load:`,e),a(e instanceof Error?e.message:String(e)))})},200);return()=>{n=!0,clearTimeout(i)}},[e,t]),{svgOutput:n,errorMessage:i}}function pe(e){let t=(0,q.c)(70),{svgOutput:n,onClose:r}=e,{scale:i,offset:a,isDragging:o,containerRef:s,zoomIn:c,zoomOut:l,reset:u,onMouseDown:d,onMouseMove:f,onMouseUp:m}=se(),h,g;t[0]===r?(h=t[1],g=t[2]):(h=()=>{let e=function(e){e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},g=[r],t[0]=r,t[1]=h,t[2]=g),(0,J.useEffect)(h,g);let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[3]=_):_=t[3],(0,J.useEffect)(me,_);let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{className:O(p.compact,`font-mono text-muted-foreground`),children:`mermaid diagram`}),t[4]=b):b=t[4];let x,S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(y,{className:`h-3.5 w-3.5`}),S=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Zoom out`}),t[5]=x,t[6]=S):(x=t[5],S=t[6]);let w;t[7]===l?w=t[8]:(w=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:l,children:[x,S]})}),t[7]=l,t[8]=w);let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(R,{children:`Zoom out`}),t[9]=T):T=t[9];let D;t[10]===w?D=t[11]:(D=(0,Q.jsxs)(B,{children:[w,T]}),t[10]=w,t[11]=D);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=O(p.compact,`min-w-[3rem] px-2 py-1 font-mono text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors`),t[12]=A):A=t[12];let j;t[13]===i?j=t[14]:(j=Math.round(i*100),t[13]=i,t[14]=j);let M;t[15]!==u||t[16]!==j?(M=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:u,className:A,children:[j,`%`]})}),t[15]=u,t[16]=j,t[17]=M):M=t[17];let N;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(R,{children:`Reset zoom`}),t[18]=N):N=t[18];let P;t[19]===M?P=t[20]:(P=(0,Q.jsxs)(B,{children:[M,N]}),t[19]=M,t[20]=P);let F,I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(C,{className:`h-3.5 w-3.5`}),I=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Zoom in`}),t[21]=F,t[22]=I):(F=t[21],I=t[22]);let V;t[23]===c?V=t[24]:(V=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:c,children:[F,I]})}),t[23]=c,t[24]=V);let ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(R,{children:`Zoom in`}),t[25]=ee):ee=t[25];let H;t[26]===V?H=t[27]:(H=(0,Q.jsxs)(B,{children:[V,ee]}),t[26]=V,t[27]=H);let te,ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(v,{className:`h-3.5 w-3.5`}),ne=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Reset view`}),t[28]=te,t[29]=ne):(te=t[28],ne=t[29]);let U;t[30]===u?U=t[31]:(U=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:u,children:[te,ne]})}),t[30]=u,t[31]=U);let W;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(R,{children:`Reset view`}),t[32]=W):W=t[32];let G;t[33]===U?G=t[34]:(G=(0,Q.jsxs)(B,{children:[U,W]}),t[33]=U,t[34]=G);let K;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),t[35]=K):K=t[35];let re,ae;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(E,{className:`h-3.5 w-3.5`}),ae=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`}),t[36]=re,t[37]=ae):(re=t[36],ae=t[37]);let Y;t[38]===r?Y=t[39]:(Y=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:r,children:[re,ae]})}),t[38]=r,t[39]=Y);let oe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(R,{children:`Close (Esc)`}),t[40]=oe):oe=t[40];let X;t[41]===Y?X=t[42]:(X=(0,Q.jsxs)(B,{children:[Y,oe]}),t[41]=Y,t[42]=X);let Z;t[43]!==P||t[44]!==H||t[45]!==G||t[46]!==X||t[47]!==D?(Z=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 bg-background/90 border-b border-border shrink-0`,children:[b,(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[D,P,H,G,K,X]})]}),t[43]=P,t[44]=H,t[45]=G,t[46]=X,t[47]=D,t[48]=Z):Z=t[48];let ce=o?`cursor-grabbing`:`cursor-grab`,le;t[49]===ce?le=t[50]:(le=O(`flex-1 overflow-hidden select-none`,ce),t[49]=ce,t[50]=le);let ue=`translate(${a.x}px, ${a.y}px) scale(${i})`,de=o?`none`:`transform 0.1s ease-out`,fe;t[51]!==ue||t[52]!==de?(fe={transform:ue,transformOrigin:`center center`,transition:de},t[51]=ue,t[52]=de,t[53]=fe):fe=t[53];let pe;t[54]===n?pe=t[55]:(pe={__html:n},t[54]=n,t[55]=pe);let he;t[56]!==fe||t[57]!==pe?(he=(0,Q.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,style:fe,dangerouslySetInnerHTML:pe}),t[56]=fe,t[57]=pe,t[58]=he):he=t[58];let ge;t[59]!==s||t[60]!==d||t[61]!==f||t[62]!==m||t[63]!==le||t[64]!==he?(ge=(0,Q.jsx)(`div`,{ref:s,className:le,onMouseDown:d,onMouseMove:f,onMouseUp:m,onMouseLeave:m,children:he}),t[59]=s,t[60]=d,t[61]=f,t[62]=m,t[63]=le,t[64]=he,t[65]=ge):ge=t[65];let $;t[66]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,Q.jsx)(`div`,{className:O(p.compact,`shrink-0 px-4 py-2 text-center text-muted-foreground/60 bg-background/60 border-t border-border`),children:`Scroll to zoom · Drag to pan · Esc to close`}),t[66]=$):$=t[66];let _e;return t[67]!==Z||t[68]!==ge?(_e=(0,ie.createPortal)((0,Q.jsx)(z,{children:(0,Q.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,"aria-label":`Diagram fullscreen view`,children:[Z,ge,$]})}),document.body),t[67]=Z,t[68]=ge,t[69]=_e):_e=t[69],_e}function me(){return document.body.style.overflow=`hidden`,he}function he(){document.body.style.overflow=``}function ge(e){let t=(0,q.c)(57),{content:n,className:r}=e,[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),{svgOutput:c,errorMessage:l}=fe(n,le()),u=l!==null,d;t[0]===n?d=t[1]:(d=async function(){await navigator.clipboard.writeText(n),a(!0),setTimeout(()=>a(!1),2e3)},t[0]=n,t[1]=d);let f=d,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=O(p.compact,`font-mono text-muted-foreground`),t[2]=m):m=t[2];let h=u?`mermaid (render error)`:`mermaid diagram`,g;t[3]===h?g=t[4]:(g=(0,Q.jsx)(`span`,{className:m,children:h}),t[3]=h,t[4]=g);let v;t[5]!==u||t[6]!==c?(v=c&&!u&&(0,Q.jsxs)(B,{children:[(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`action`,size:`icon-xs`,onClick:()=>s(!0),children:[(0,Q.jsx)(T,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`View fullscreen`})]})}),(0,Q.jsx)(R,{children:`View fullscreen`})]}),t[5]=u,t[6]=c,t[7]=v):v=t[7];let y;t[8]===i?y=t[9]:(y=i?(0,Q.jsx)(_,{}):(0,Q.jsx)(D,{}),t[8]=i,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Copy mermaid code`}),t[10]=b):b=t[10];let x;t[11]!==f||t[12]!==y?(x=(0,Q.jsxs)(k,{variant:`action`,size:`icon-xs`,onClick:f,children:[y,b]}),t[11]=f,t[12]=y,t[13]=x):x=t[13];let S;t[14]!==v||t[15]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v,x]}),t[14]=v,t[15]=x,t[16]=S):S=t[16];let C;t[17]!==g||t[18]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/80 px-4 py-2`,children:[g,S]}),t[17]=g,t[18]=S,t[19]=C):C=t[19];let w=C;if(u){let e;t[20]===r?e=t[21]:(e=O(`group relative overflow-hidden rounded-lg border border-border bg-muted`,r),t[20]=r,t[21]=e);let i;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(i=O(p.compact,`border-b border-border bg-background/50 px-4 py-2 text-destructive`),t[22]=i):i=t[22];let a;t[23]===l?a=t[24]:(a=(0,Q.jsx)(`div`,{className:i,role:`alert`,children:l}),t[23]=l,t[24]=a);let o;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(o=O(p.compact,`font-mono text-foreground leading-relaxed`),t[25]=o):o=t[25];let s;t[26]===n?s=t[27]:(s=(0,Q.jsx)(`pre`,{className:`overflow-x-auto p-4 max-w-full`,children:(0,Q.jsx)(`code`,{className:o,children:n})}),t[26]=n,t[27]=s);let c;return t[28]!==w||t[29]!==e||t[30]!==a||t[31]!==s?(c=(0,Q.jsxs)(`div`,{className:e,children:[w,a,s]}),t[28]=w,t[29]=e,t[30]=a,t[31]=s,t[32]=c):c=t[32],c}if(!c){let e;t[33]===r?e=t[34]:(e=O(`group relative overflow-hidden rounded-lg border border-border bg-muted`,r),t[33]=r,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`div`,{className:O(p.compact,`p-4 text-muted-foreground`),children:`Rendering diagram…`}),t[35]=n):n=t[35];let i;return t[36]!==w||t[37]!==e?(i=(0,Q.jsxs)(`div`,{className:e,children:[w,n]}),t[36]=w,t[37]=e,t[38]=i):i=t[38],i}let E;t[39]===r?E=t[40]:(E=O(`group relative overflow-hidden rounded-lg border border-border bg-muted`,r),t[39]=r,t[40]=E);let A;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>s(!0),t[41]=A):A=t[41];let j;t[42]===c?j=t[43]:(j=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`block w-full text-left cursor-zoom-in p-4 max-w-full overflow-hidden [&_svg]:max-w-full [&_svg]:h-auto hover:bg-muted/70 transition-colors`,onClick:A,dangerouslySetInnerHTML:{__html:c}})}),t[42]=c,t[43]=j);let M;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(R,{children:`Click to view fullscreen`}),t[44]=M):M=t[44];let N;t[45]===j?N=t[46]:(N=(0,Q.jsxs)(B,{children:[j,M]}),t[45]=j,t[46]=N);let P;t[47]!==w||t[48]!==E||t[49]!==N?(P=(0,Q.jsxs)(`div`,{className:E,children:[w,N]}),t[47]=w,t[48]=E,t[49]=N,t[50]=P):P=t[50];let F;t[51]!==o||t[52]!==c?(F=o&&(0,Q.jsx)(pe,{svgOutput:c,onClose:()=>s(!1)}),t[51]=o,t[52]=c,t[53]=F):F=t[53];let I;return t[54]!==P||t[55]!==F?(I=(0,Q.jsxs)(z,{children:[P,F]}),t[54]=P,t[55]=F,t[56]=I):I=t[56],I}function $(e){let t=e.trim();if(t.startsWith(`/`)){let e=A().replace(/\/$/,``);return u(`${e}${t}`,e)}return u(t,A())}function _e(e){let t=e.trim();if(t.startsWith(`/api/`))return!0;if(!/^https?:\/\//i.test(t))return!1;try{let e=new URL(t);if(f(e.hostname))return!0;let n=new URL(A());return e.origin===n.origin&&e.pathname.startsWith(`/api/`)}catch{return!1}}function ve(e){let t=e.trim();return!t||t.startsWith(`mailto:`)||t.startsWith(`tel:`)?!1:M()?/^https?:\/\//i.test(t)||t.startsWith(`/api/`):_e(t)}function ye(e){let t=$(e);return N()&&!M()?(window.open(t,`_blank`,`noopener,noreferrer`),Promise.resolve()):P(t)}function be(e){return!!(f(e.hostname)||typeof window<`u`&&e.origin===window.location.origin)}function xe(e){return decodeURIComponent(e.replace(/^\/+/,``))}function Se(e){let t=e.trim();if(!t||t.includes(`
|
|
3
|
-
`))return null;let n=h(t);if(!n)return null;let r=t.toLowerCase();return r.startsWith(`http://`)||r.startsWith(`https://`)||r.startsWith(`/`)||r.includes(`/explorer/media`)||t.includes(`/`)||t.includes(`\\`)?{kind:n,src:t}:null}function Ce(e,t){let n=e.trim();if(!n||n.startsWith(`data:`)||n.includes(`/explorer/media`))return null;let r;if(/^https?:\/\//i.test(n)){let e;try{e=new URL(n)}catch{return null}if(!be(e))return null;r=xe(e.pathname)}else r=xe(n);let i=h(r);return!i||t&&i!==t?null:{path:r,kind:i}}function we(e,t){return $(`/api/threads/${encodeURIComponent(e)}/explorer/media?path=${encodeURIComponent(t)}`)}function Te(e){if(!e.startsWith(`/`))return!1;let t=e.split(`/`)[1]??``;return[`Users`,`tmp`,`var`,`private`,`Volumes`,`home`].includes(t)}function Ee(e,t){if(!e||e.startsWith(`data:`))return e;if(t){if(Te(e)&&h(e))return we(t,e);let n=Ce(e);if(n)return we(t,n.path)}return e.startsWith(`/`)?$(e):u(e,A())}function De(e,t){return Ee(e,t)}function Oe(e){let t=d(e);if(!t?.imageUrl&&!t?.imageData)return null;let n;if(typeof e==`object`&&e){let t=e;if(typeof t.model==`string`)n=t.model;else if(typeof t.content==`string`)try{let e=JSON.parse(t.content);typeof e.model==`string`&&(n=e.model)}catch{}}else if(typeof e==`string`)try{let t=JSON.parse(e.trim());typeof t.model==`string`&&(n=t.model)}catch{}return{imageUrl:t.imageUrl,imageData:t.imageData,model:n}}function ke(e,t){let n=Oe(e)??Oe(t);if(!n?.imageUrl&&!n?.imageData)return null;let r,i=[e,t.content,t];for(let e of i)if(typeof e==`string`&&e.trim().startsWith(`{`))try{let t=JSON.parse(e);if(typeof t.savedPath==`string`){r=t.savedPath;break}}catch{}else if(e&&typeof e==`object`){let t=e;if(typeof t.savedPath==`string`){r=t.savedPath;break}if(typeof t.content==`string`)try{let e=JSON.parse(t.content);if(typeof e.savedPath==`string`){r=e.savedPath;break}}catch{}}return{...n,savedPath:r}}function Ae(e){let t=(0,q.c)(34),{imageUrl:n,imageData:r,alt:i,threadId:a}=e,o=i===void 0?`Generated image`:i,[s,c]=(0,J.useState)(!1),l;t[0]!==r||t[1]!==n||t[2]!==a?(l=r?`data:image/png;base64,${r}`:De(n??``,a),t[0]=r,t[1]=n,t[2]=a,t[3]=l):l=t[3];let u=l,d;t[4]===u?d=t[5]:(d=async()=>{let e=m(u)??`generated-image-${Date.now()}.png`,{path:t}=await I(u.startsWith(`data:`)?{imageData:u.replace(/^data:[^;]+;base64,/,``),filename:e}:{imageUrl:u,filename:e});V({title:`Saved to downloads: ${t.split(`/`).pop()}`})},t[4]=u,t[5]=d);let f=d,p;t[6]===u?p=t[7]:(p=async()=>{await F(u.startsWith(`data:`)?{imageData:u.replace(/^data:[^;]+;base64,/,``)}:{imageUrl:u}),c(!0),setTimeout(()=>c(!1),2e3)},t[6]=u,t[7]=p);let h=p;if(!u)return null;let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g={maxHeight:`512px`},t[8]=g):g=t[8];let v;t[9]!==o||t[10]!==u?(v=(0,Q.jsx)(`img`,{src:u,alt:o,className:`max-w-full rounded-lg block`,style:g}),t[9]=o,t[10]=u,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(x,{className:`h-3.5 w-3.5`}),t[12]=y):y=t[12];let b;t[13]===f?b=t[14]:(b=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsx)(`button`,{onClick:f,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:y})}),t[13]=f,t[14]=b);let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(R,{children:`Save image`}),t[15]=S):S=t[15];let C;t[16]===b?C=t[17]:(C=(0,Q.jsxs)(B,{children:[b,S]}),t[16]=b,t[17]=C);let w;t[18]===s?w=t[19]:(w=s?(0,Q.jsx)(_,{className:`h-3.5 w-3.5 text-green-500`}):(0,Q.jsx)(D,{className:`h-3.5 w-3.5`}),t[18]=s,t[19]=w);let T;t[20]!==h||t[21]!==w?(T=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsx)(`button`,{onClick:h,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:w})}),t[20]=h,t[21]=w,t[22]=T):T=t[22];let E=s?`Copied!`:`Copy to clipboard`,O;t[23]===E?O=t[24]:(O=(0,Q.jsx)(R,{children:E}),t[23]=E,t[24]=O);let k;t[25]!==T||t[26]!==O?(k=(0,Q.jsxs)(B,{children:[T,O]}),t[25]=T,t[26]=O,t[27]=k):k=t[27];let A;t[28]!==C||t[29]!==k?(A=(0,Q.jsx)(`div`,{className:`absolute top-2 right-2 flex gap-1 opacity-0 group-hover/img:opacity-100 transition-opacity`,children:(0,Q.jsxs)(z,{children:[C,k]})}),t[28]=C,t[29]=k,t[30]=A):A=t[30];let j;return t[31]!==A||t[32]!==v?(j=(0,Q.jsxs)(`div`,{className:`mb-3 relative group/img inline-block max-w-full`,children:[v,A]}),t[31]=A,t[32]=v,t[33]=j):j=t[33],j}var je=l(`chat.media`);function Me(e){if(!e)return`Unknown media error`;switch(e.code){case MediaError.MEDIA_ERR_ABORTED:return`Playback aborted`;case MediaError.MEDIA_ERR_NETWORK:return`Network error while fetching media`;case MediaError.MEDIA_ERR_DECODE:return`Media decode error`;case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:return`Unsupported media format or inaccessible source`;default:return`Media error (code ${e.code})`}}async function Ne(e){try{let t=await fetch(e,{method:`GET`,headers:{Range:`bytes=0-0`}}),n=t.headers.get(`content-type`)??`unknown`,r=t.headers.get(`accept-ranges`)??`none`,i=t.headers.get(`content-range`),a=i?`, content-range=${i}`:``;return`HTTP ${t.status} ${t.statusText}, content-type=${n}, accept-ranges=${r}${a}`}catch(e){return e instanceof Error?e.message:`Fetch failed`}}function Pe(e){je.error(`Failed to load media`,{kind:e.kind,src:e.src,label:e.label,mediaError:e.mediaError?{code:e.mediaError.code,message:e.mediaError.message,label:Me(e.mediaError)}:void 0,probeResult:e.probeResult})}function Fe(e,t,n,r){let[i,a]=(0,J.useState)({objectUrl:null,loadError:null,loading:!1});return(0,J.useEffect)(()=>{if(!t){a(e=>(e.objectUrl&&URL.revokeObjectURL(e.objectUrl),{objectUrl:null,loadError:null,loading:!1}));return}let i=!1;a(e=>(e.objectUrl&&URL.revokeObjectURL(e.objectUrl),{objectUrl:null,loadError:null,loading:!0}));async function o(){try{let t=await fetch(e);if(!t.ok){let t=await Ne(e);throw Error(t)}let n=await t.blob();if(i)return;let r=URL.createObjectURL(n);if(i){URL.revokeObjectURL(r);return}a({objectUrl:r,loadError:null,loading:!1})}catch(t){if(i)return;let o=t instanceof Error?t.message:await Ne(e);Pe({kind:n,src:e,label:r,probeResult:o}),a({objectUrl:null,loadError:o,loading:!1})}}return o(),()=>{i=!0,a(e=>(e.objectUrl&&URL.revokeObjectURL(e.objectUrl),{objectUrl:null,loadError:null,loading:!1}))}},[e,t,n,r]),i}function Ie(e){let t=(0,q.c)(44),{src:n,label:r}=e,[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=(0,J.useRef)(null),{objectUrl:l,loadError:u,loading:d}=Fe(n,i,`video`,r),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=function(e){a(e),e||(s(!1),c.current&&c.current.pause())},t[0]=f):f=t[0];let m=f,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(){s(Le)},t[1]=h):h=t[1];let g=h,_;t[2]!==r||t[3]!==n?(_=async function(e){let t=e.currentTarget.error;Pe({kind:`video`,src:n,label:r,mediaError:t,probeResult:await Ne(n)})},t[2]=r,t[3]=n,t[4]=_):_=t[4];let v=_,y=r??`Video`,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>a(!0),t[5]=x):x=t[5];let S=r?`Play ${r}`:`Play video`,C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`span`,{className:`flex h-14 w-14 items-center justify-center rounded-full bg-background/90 text-foreground shadow-sm`,children:(0,Q.jsx)(b,{className:`h-7 w-7 fill-current`})}),t[6]=C):C=t[6];let D;t[7]===S?D=t[8]:(D=(0,Q.jsx)(`button`,{type:`button`,onClick:x,"aria-label":S,className:`flex min-h-32 w-full items-center justify-center rounded-md bg-muted/30 transition-colors hover:bg-muted/50`,children:C}),t[7]=S,t[8]=D);let k=o?`h-dvh w-dvw max-w-none rounded-none`:`max-w-[min(92vw,960px)]`,A;t[9]===k?A=t[10]:(A=O(`gap-0 overflow-hidden border-none bg-black p-0 sm:rounded-lg`,k),t[9]=k,t[10]=A);let j;t[11]===y?j=t[12]:(j=(0,Q.jsx)(ne,{className:`sr-only`,children:y}),t[11]=y,t[12]=j);let M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(ee,{className:`sr-only`,children:`Video player`}),t[13]=M):M=t[13];let N=o?`Shrink video`:`Expand video`,P;t[14]===o?P=t[15]:(P=o?(0,Q.jsx)(w,{className:`h-4 w-4`}):(0,Q.jsx)(T,{className:`h-4 w-4`}),t[14]=o,t[15]=P);let F;t[16]!==N||t[17]!==P?(F=(0,Q.jsx)(`button`,{type:`button`,onClick:g,"aria-label":N,className:`flex h-7 w-7 items-center justify-center rounded-full text-white/90 transition-colors hover:bg-white/15 hover:text-white`,children:P}),t[16]=N,t[17]=P,t[18]=F):F=t[18];let I;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsxs)(H,{className:`flex h-7 w-7 items-center justify-center rounded-full text-white/90 transition-colors hover:bg-white/15 hover:text-white`,children:[(0,Q.jsx)(E,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[19]=I):I=t[19];let L;t[20]===F?L=t[21]:(L=(0,Q.jsxs)(`div`,{className:`absolute right-4 top-4 z-10 flex items-center gap-1`,children:[F,I]}),t[20]=F,t[21]=L);let R=o?`h-full`:`min-h-[240px]`,z;t[22]===R?z=t[23]:(z=O(`flex items-center justify-center p-3 pt-12 sm:p-4`,R),t[22]=R,t[23]=z);let B;t[24]!==o||t[25]!==v||t[26]!==u||t[27]!==d||t[28]!==l?(B=d?(0,Q.jsx)(`p`,{className:O(p.compact,`text-white/80`),children:`Loading video...`}):u?(0,Q.jsxs)(`p`,{className:O(p.compact,`px-4 text-center text-destructive`),children:[`Could not load video: `,u]}):l?(0,Q.jsx)(`video`,{ref:c,src:l,controls:!0,autoPlay:!0,playsInline:!0,className:O(`max-w-full rounded`,o?`max-h-full`:`max-h-[80vh]`),onError:v}):null,t[24]=o,t[25]=v,t[26]=u,t[27]=d,t[28]=l,t[29]=B):B=t[29];let V;t[30]!==z||t[31]!==B?(V=(0,Q.jsx)(`div`,{className:z,children:B}),t[30]=z,t[31]=B,t[32]=V):V=t[32];let W;t[33]!==j||t[34]!==L||t[35]!==V||t[36]!==A?(W=(0,Q.jsxs)(te,{hideClose:!0,className:A,children:[j,M,L,V]}),t[33]=j,t[34]=L,t[35]=V,t[36]=A,t[37]=W):W=t[37];let G;t[38]!==i||t[39]!==W?(G=(0,Q.jsx)(U,{open:i,onOpenChange:m,children:W}),t[38]=i,t[39]=W,t[40]=G):G=t[40];let K;return t[41]!==G||t[42]!==D?(K=(0,Q.jsxs)(Q.Fragment,{children:[D,G]}),t[41]=G,t[42]=D,t[43]=K):K=t[43],K}function Le(e){return!e}function Re(e){let t=(0,q.c)(12),{src:n,label:r}=e,{objectUrl:i,loadError:a,loading:o}=Fe(n,!0,`audio`,r),s;t[0]!==r||t[1]!==n?(s=async function(e){let t=e.currentTarget.error;Pe({kind:`audio`,src:n,label:r,mediaError:t,probeResult:await Ne(n)})},t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s,l;t[3]!==c||t[4]!==o||t[5]!==i?(l=o?(0,Q.jsx)(`p`,{className:O(p.compact,`text-muted-foreground`),children:`Loading audio...`}):i?(0,Q.jsx)(`audio`,{src:i,controls:!0,preload:`metadata`,className:`w-full`,onError:c}):null,t[3]=c,t[4]=o,t[5]=i,t[6]=l):l=t[6];let u;t[7]===a?u=t[8]:(u=a?(0,Q.jsxs)(`p`,{className:O(p.compact,`mt-2 text-destructive`),children:[`Could not load audio: `,a]}):null,t[7]=a,t[8]=u);let d;return t[9]!==l||t[10]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function ze(e){let t=(0,q.c)(13),{src:n,kind:r,label:i}=e;if(!n)return null;let a=r===`video`?g:S,o=r===`video`?`p-2`:`p-3`,s;t[0]===o?s=t[1]:(s=O(`mt-2 max-w-full overflow-hidden rounded-lg border border-border bg-background`,o),t[0]=o,t[1]=s);let c;t[2]!==a||t[3]!==i?(c=i?(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:O(p.compact,`truncate`),children:i})]}):null,t[2]=a,t[3]=i,t[4]=c):c=t[4];let l;t[5]!==r||t[6]!==i||t[7]!==n?(l=r===`video`?(0,Q.jsx)(Ie,{src:n,label:i}):(0,Q.jsx)(Re,{src:n,label:i}),t[5]=r,t[6]=i,t[7]=n,t[8]=l):l=t[8];let u;return t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,Q.jsxs)(`div`,{className:s,children:[c,l]}),t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}var Be=[`graph`,`flowchart`,`sequenceDiagram`,`classDiagram`,`stateDiagram`,`erDiagram`,`journey`,`gantt`,`pie`,`quadrantChart`,`requirementDiagram`,`gitgraph`,`mindmap`,`timeline`,`zenuml`,`sankey`,`block`,`architecture`,`c4`,`packet`,`circuit`],Ve=/```mermaid\s*\n([\s\S]*?)\n```/;function He(e){return e.split(`
|
|
4
|
-
`).find(e=>e.trim().length>0)??``}function Ue(e){let t=e.trim().toLowerCase();return t.length===0?!1:Be.some(e=>t===e.toLowerCase()||t.startsWith(e.toLowerCase()+` `))}function We(e){return!e||typeof e!=`string`?!1:Ve.test(e)?!0:Ue(He(e))}function Ge(e){let t=Ve.exec(e);return t?t[1].trim():Ue(He(e))?e.trim():null}function Ke(e){let t=(0,q.c)(14),{href:n,children:r}=e,i;t[0]===n?i=t[1]:(i=$(n),t[0]=n,t[1]=i);let a=i,o;t[2]===n?o=t[3]:(o=ve(n),t[2]=n,t[3]=o);let s=o,c;t[4]!==n||t[5]!==s?(c=function(e){s&&(e.preventDefault(),ye(n))},t[4]=n,t[5]=s,t[6]=c):c=t[6];let l=c,u;t[7]===s?u=t[8]:(u=s?{}:{target:`_blank`,rel:`noopener noreferrer`},t[7]=s,t[8]=u);let d;return t[9]!==r||t[10]!==l||t[11]!==a||t[12]!==u?(d=(0,Q.jsx)(`a`,{href:a,onClick:l,className:`text-inherit underline underline-offset-2 hover:text-inherit/80`,...u,children:r}),t[9]=r,t[10]=l,t[11]=a,t[12]=u,t[13]=d):d=t[13],d}function qe(e){let t=(0,q.c)(11),{path:n,children:r,className:i}=e,{openChatDockPanel:a}=G(),{setPendingExplorerPath:o}=W(),s;t[0]!==a||t[1]!==n||t[2]!==o?(s=function(e){e.preventDefault(),e.stopPropagation(),o(n),a(`explorer`)},t[0]=a,t[1]=n,t[2]=o,t[3]=s):s=t[3];let c=s,l;t[4]===i?l=t[5]:(l=O(`cursor-pointer underline decoration-border underline-offset-2 transition-colors hover:text-foreground hover:decoration-foreground/60`,i),t[4]=i,t[5]=l);let u;return t[6]!==r||t[7]!==c||t[8]!==n||t[9]!==l?(u=(0,Q.jsx)(`a`,{href:`#`,onClick:c,"data-file-path":n,className:l,children:r}),t[6]=r,t[7]=c,t[8]=n,t[9]=l,t[10]=u):u=t[10],u}var Je=`[a-z0-9_@~./\\\\+-]*[a-z0-9_@~-]\\.[a-z][a-z0-9-]{0,11}`,Ye=RegExp(`^(?:${Je})$`,`i`),Xe=/[:#]L?\d+(?:-\d+)?$/,Ze=/[.,;:!?)\]}'"]+$/;function Qe(e){let t=new Set,n=new Map;for(let r of e){let e=r.replace(/\\/g,`/`);if(!e||e.endsWith(`/`))continue;t.add(e);let i=e.slice(e.lastIndexOf(`/`)+1),a=n.get(i);a?a.push(e):n.set(i,[e])}for(let e of n.values())e.sort(nt);return{exact:t,byBasename:n}}function $e(e){let t=e.trim().replace(/\\/g,`/`);return t=t.replace(Ze,``),t=t.replace(Xe,``),t.startsWith(`@`)&&(t=t.slice(1)),t.startsWith(`./`)&&(t=t.slice(2)),t=t.replace(/^\/+/,``),t.length===0||t.length>512||/\s/.test(t)||t.includes(`://`)||!Ye.test(t)?null:t}function et(e,t){let n=$e(e);if(!n)return null;if(t.exact.has(n))return n;let r=n.slice(n.lastIndexOf(`/`)+1),i=t.byBasename.get(r);if(!i||i.length===0)return null;if(!n.includes(`/`))return i[0];let a=`/${n}`;return i.find(e=>e.endsWith(a))??null}function tt(e,t){let n=new RegExp(Je,`gi`),r=[],i=0,a;for(;(a=n.exec(e))!==null;)a.index>i&&r.push({text:e.slice(i,a.index),path:null}),r.push({text:a[0],path:et(a[0],t)}),i=a.index+a[0].length;return i<e.length&&r.push({text:e.slice(i),path:null}),r.length>0?r:[{text:e,path:null}]}function nt(e,t){let n=rt(e)-rt(t);return n===0?e.length-t.length||e.localeCompare(t):n}function rt(e){let t=1;for(let n=0;n<e.length;n+=1)e.charCodeAt(n)===47&&(t+=1);return t}var it=15e3,at=2e4;function ot(e){let t=(0,q.c)(10),n;t[0]===e?n=t[1]:(n=c.threads.files(e??``),t[0]=e,t[1]=n);let r;t[2]===e?r=t[3]:(r=()=>j(e),t[2]=e,t[3]=r);let i=!!e,a;t[4]!==n||t[5]!==r||t[6]!==i?(a={queryKey:n,queryFn:r,enabled:i,staleTime:it,refetchInterval:at},t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7];let o=K(a),s;return t[8]===o.data?s=t[9]:(s=o.data?Qe(o.data):null,t[8]=o.data,t[9]=s),s}var st=/^(\s*)([-*+]|\d+\.)\s+(.*)$/,ct=100,lt=/^!\[([^\]]*)\]\(([^)]+)\)\s*$/,ut=/[.,!?;:]+$/,dt=(0,J.memo)(function({content:e,className:t,enableMermaid:n=!1,threadId:r,compact:i=!1,bodyClassName:a,revealAnimation:o=!1}){let s=re(e,ct),c=ot(r),l=(0,J.useRef)(null),u=(0,J.useMemo)(()=>{if(!s||typeof s!=`string`)return l.current=null,[];let e=It(s,n,l.current);return l.current=e,e.blocks},[s,n]);return u.length===0?null:(0,Q.jsx)(`div`,{className:O(`prose-custom min-w-0 break-words`,t),children:u.map((e,t)=>(0,Q.jsx)(`div`,{className:O(Tt(t,u,i),o&&`animate-in fade-in duration-300 motion-reduce:animate-none`),children:(0,Q.jsx)(zt,{block:e,threadId:r,chatFileIndex:c,compact:i,bodyClassName:a})},t))})});function ft(e){let t=e.match(lt);return t?{alt:t[1],src:t[2]}:null}function pt(e,t,n){let r=e?`mt-0 space-y-0.5`:`mt-0 space-y-1`,i=n?`mt-1`:``;return t?O(r,i,`pl-6`):O(r,i,`pl-6 list-outside overflow-visible list-disc`)}function mt(e){return e.replace(/\t/g,` `).length}function ht(e){return/^\d+\.$/.test(e)?Number.parseInt(e,10):1}function gt(e,t){return mt(e)>t}function _t(e,t){let n=e[t]?.match(st);if(!n)return{block:{type:`paragraph`,text:``},nextIndex:t+1};let[,r,i,a]=n,o={ordered:/^\d+\.$/.test(i),start:ht(i),items:[{text:a,children:[]}]},s=[{indent:mt(r),item:o.items[0]}],c=t+1;for(;c<e.length;){let t=vt(e,c,s,o);if(c=t.nextIndex,t.stop)break}return{block:{type:`list`,list:o},nextIndex:c}}function vt(e,t,n,r){let i=e[t];return st.test(i)?yt(e,t,n,r):i.trim()===``?Ct(e,t):wt(e,t,n)}function yt(e,t,n,r){let[,i,a,o]=e[t].match(st),s=mt(i),c=/^\d+\.$/.test(a),l={text:o,children:[]};if(bt(n,s),n.length===0)return{nextIndex:t,stop:!0};let u=n[n.length-1],d=s===u.indent,f=gt(i,u.indent);return d?xt(n,r,c,s,l,t):f?St(n,u,c,a,s,l,t):{nextIndex:t,stop:!0}}function bt(e,t){for(;e.length>0&&t<e[e.length-1].indent;)e.pop()}function xt(e,t,n,r,i,a){let o=e[e.length-2]?.childList??t;return o.ordered===n?(o.items.push(i),e[e.length-1]={indent:r,item:i},{nextIndex:a+1,stop:!1}):{nextIndex:a,stop:!0}}function St(e,t,n,r,i,a,o){let s=t.childList;return(!s||s.ordered!==n)&&(s={ordered:n,start:ht(r),items:[]},t.item.children.push(s),t.childList=s),s.items.push(a),e.push({indent:i,item:a}),{nextIndex:o+1,stop:!1}}function Ct(e,t){let n=e[t+1];return!n||!st.test(n)?{nextIndex:t,stop:!0}:{nextIndex:t+1,stop:!1}}function wt(e,t,n){let r=mt(e[t].match(/^(\s*)/)?.[1]??``),i=n[n.length-1];return r>i.indent?(i.item.text=`${i.item.text}\n${e[t].trim()}`,{nextIndex:t+1,stop:!1}):{nextIndex:t,stop:!0}}function Tt(e,t,n=!1){if(e===0)return``;let r=t[e-1],i=t[e];return r.type===`list`||i.type===`list`?``:n?`mt-2`:`mt-3`}function Et(e,t,n){let r=e[t].trimStart().slice(3).trim(),i=[],a=t+1;for(;a<e.length&&!e[a].trimStart().startsWith("```");)i.push(e[a]),a++;let o=i.join(`
|
|
5
|
-
`);return n&&(r===`mermaid`||r===``&&We(o))?{block:{type:`mermaid`,code:o},nextIndex:a+1}:{block:{type:`code`,language:r,code:o},nextIndex:a+1}}function Dt(e){let t=e.match(/^(#{1,6})(\s.*)?$/);return t?{type:`heading`,level:t[1].length,text:t[2]?t[2].trim():``}:null}function Ot(e){return/^(---|\*\*\*|___)/.test(e.trim())}function kt(e,t){let n=e[t];if(!n.includes(`|`)||t+1>=e.length||!e[t+1].match(/^\|?\s*[-:]+/))return null;let r=n.split(`|`).map(e=>e.trim()).filter(Boolean),i=t+2,a=[];for(;i<e.length&&e[i].includes(`|`);)a.push(e[i].split(`|`).map(e=>e.trim()).filter(Boolean)),i++;return{block:{type:`table`,headers:r,rows:a},nextIndex:i}}function At(e,t){let n=[],r=t;for(;r<e.length&&e[r].startsWith(`> `);)n.push(e[r].slice(2)),r++;return{block:{type:`blockquote`,text:n.join(`
|
|
6
|
-
`)},nextIndex:r}}function jt(e){let t=ft(e);return t?{type:`image`,...t}:null}function Mt(e){let t=Se(e);return t?{type:`media`,kind:t.kind,src:t.src}:null}function Nt(e,t,n){let r=t,i=[];for(;r<e.length&&e[r].trim()!==``&&!e[r].startsWith(`#`)&&!e[r].startsWith("```")&&!e[r].startsWith(`> `)&&!st.test(e[r]);)i.push(e[r]),r++;let a=i.join(`
|
|
7
|
-
`);if(n&&We(a)){let e=Ge(a);if(e)return{block:{type:`mermaid`,code:e},nextIndex:r}}return{block:{type:`paragraph`,text:a},nextIndex:r}}function Pt(e){let t=[],n=0;for(let r=0;r<e.length;r++)t.push(n),n+=e[r].length+ +(r<e.length-1);return t}function Ft(e,t=!1){let n=e.split(`
|
|
8
|
-
`),r=Pt(n),i=[],a=[],o=0;for(;o<n.length;){let e=n[o],s=r[o]??0;if(e.trimStart().startsWith("```")){let{block:e,nextIndex:r}=Et(n,o,t);i.push(e),a.push(s),o=r;continue}let c=Dt(e);if(c){i.push(c),a.push(s),o++;continue}if(Ot(e)){i.push({type:`hr`}),a.push(s),o++;continue}let l=kt(n,o);if(l){i.push(l.block),a.push(s),o=l.nextIndex;continue}if(e.startsWith(`> `)){let{block:e,nextIndex:t}=At(n,o);i.push(e),a.push(s),o=t;continue}if(st.test(e)){let{block:e,nextIndex:t}=_t(n,o);i.push(e),a.push(s),o=t;continue}if(e.trim()===``){o++;continue}let u=jt(e);if(u){i.push(u),a.push(s),o++;continue}let d=Mt(e);if(d){i.push(d),a.push(s),o++;continue}let{block:f,nextIndex:p}=Nt(n,o,t);i.push(f),a.push(s),o=p}return{blocks:i,blockStarts:a}}function It(e,t,n){if(n&&n.enableMermaid===t&&n.md===e&&n.blocks.length>0)return n;if(n&&n.enableMermaid===t&&n.blocks.length>0&&e.startsWith(n.md)){let r=n.blockStarts[n.blockStarts.length-1]??0,i=n.blocks.slice(0,-1),a=n.blockStarts.slice(0,-1),o=Ft(e.slice(r),t);return{md:e,enableMermaid:t,blocks:[...i,...o.blocks],blockStarts:[...a,...o.blockStarts.map(e=>e+r)]}}let r=Ft(e,t);return{md:e,enableMermaid:t,blocks:r.blocks,blockStarts:r.blockStarts}}function Lt(e,t){return`${t}-${e.text}`}function Rt(e){let t=(0,q.c)(23),{list:n,compact:r,threadId:i,chatFileIndex:a,inlineCodeClass:o,bodyClassName:s,nested:c}=e,l=a===void 0?null:a,u=c===void 0?!1:c,d=s??(r?p.caption:p.body),f=n.ordered?`ol`:`ul`,m;t[0]!==d||t[1]!==r||t[2]!==n.ordered||t[3]!==u?(m=O(d,pt(r,n.ordered,u)),t[0]=d,t[1]=r,t[2]=n.ordered,t[3]=u,t[4]=m):m=t[4];let h=n.ordered?n.start:void 0,g;if(t[5]!==s||t[6]!==l||t[7]!==r||t[8]!==o||t[9]!==n.items||t[10]!==i){let e;t[12]!==s||t[13]!==l||t[14]!==r||t[15]!==o||t[16]!==i?(e=(e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(Bt,{text:e.text,threadId:i,chatFileIndex:l,inlineCodeClass:o}),e.children.map((n,a)=>(0,Q.jsx)(Rt,{list:n,compact:r,threadId:i,chatFileIndex:l,inlineCodeClass:o,bodyClassName:s,nested:!0},`${Lt(e,t)}-child-${a}`))]})},Lt(e,t)),t[12]=s,t[13]=l,t[14]=r,t[15]=o,t[16]=i,t[17]=e):e=t[17],g=n.items.map(e),t[5]=s,t[6]=l,t[7]=r,t[8]=o,t[9]=n.items,t[10]=i,t[11]=g}else g=t[11];let _;return t[18]!==f||t[19]!==m||t[20]!==h||t[21]!==g?(_=(0,Q.jsx)(f,{className:m,start:h,children:g}),t[18]=f,t[19]=m,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}var zt=(0,J.memo)(function(e){let t=(0,q.c)(96),{block:n,threadId:r,chatFileIndex:i,compact:a,bodyClassName:o}=e,s=i===void 0?null:i,c=a===void 0?!1:a,l=o??(c?p.caption:p.body),u;t[0]!==o||t[1]!==c?(u=o?O(o,`font-mono`):c?O(p.compact,`font-mono`):p.mono,t[0]=o,t[1]=c,t[2]=u):u=t[2];let d=u;switch(n.type){case`heading`:{let e=`h${n.level}`,i,a;if(t[3]!==e||t[4]!==n.level||t[5]!==c){let r=c?{1:O(p.caption,`font-semibold`),2:O(p.caption,`font-semibold`),3:O(p.body,`font-semibold`),4:O(p.body,`font-semibold`),5:O(p.compact,`font-semibold`),6:O(p.compact,`font-semibold`)}:{1:p.sectionTitle,2:p.subSectionTitle,3:p.subSectionTitle,4:p.subSectionTitle,5:p.sectionSubtitle,6:p.sectionSubtitle};i=e,a=O(r[n.level]),t[3]=e,t[4]=n.level,t[5]=c,t[6]=i,t[7]=a}else i=t[6],a=t[7];let o;t[8]!==n.text||t[9]!==s||t[10]!==d||t[11]!==r?(o=(0,Q.jsx)(Bt,{text:n.text,threadId:r,chatFileIndex:s,inlineCodeClass:d}),t[8]=n.text,t[9]=s,t[10]=d,t[11]=r,t[12]=o):o=t[12];let l;return t[13]!==i||t[14]!==a||t[15]!==o?(l=(0,Q.jsx)(i,{className:a,children:o}),t[13]=i,t[14]=a,t[15]=o,t[16]=l):l=t[16],l}case`code`:{let e;return t[17]!==n.code||t[18]!==n.language||t[19]!==c?(e=(0,Q.jsx)(Ut,{language:n.language,code:n.code,compact:c}),t[17]=n.code,t[18]=n.language,t[19]=c,t[20]=e):e=t[20],e}case`blockquote`:{let e;t[21]===l?e=t[22]:(e=O(l,`border-l-2 border-border pl-4 text-muted-foreground italic`),t[21]=l,t[22]=e);let i;t[23]!==n.text||t[24]!==s||t[25]!==d||t[26]!==r?(i=(0,Q.jsx)(Bt,{text:n.text,threadId:r,chatFileIndex:s,inlineCodeClass:d}),t[23]=n.text,t[24]=s,t[25]=d,t[26]=r,t[27]=i):i=t[27];let a;return t[28]!==e||t[29]!==i?(a=(0,Q.jsx)(`blockquote`,{className:e,children:i}),t[28]=e,t[29]=i,t[30]=a):a=t[30],a}case`list`:{let e;return t[31]!==n.list||t[32]!==o||t[33]!==s||t[34]!==c||t[35]!==d||t[36]!==r?(e=(0,Q.jsx)(Rt,{list:n.list,compact:c,threadId:r,chatFileIndex:s,inlineCodeClass:d,bodyClassName:o}),t[31]=n.list,t[32]=o,t[33]=s,t[34]=c,t[35]=d,t[36]=r,t[37]=e):e=t[37],e}case`paragraph`:{let e;t[38]===l?e=t[39]:(e=O(l,`mt-0 whitespace-pre-wrap break-words`),t[38]=l,t[39]=e);let i;t[40]!==n.text||t[41]!==s||t[42]!==d||t[43]!==r?(i=(0,Q.jsx)(Bt,{text:n.text,threadId:r,chatFileIndex:s,inlineCodeClass:d}),t[40]=n.text,t[41]=s,t[42]=d,t[43]=r,t[44]=i):i=t[44];let a;return t[45]!==e||t[46]!==i?(a=(0,Q.jsx)(`p`,{className:e,children:i}),t[45]=e,t[46]=i,t[47]=a):a=t[47],a}case`hr`:{let e;return t[48]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`hr`,{className:`border-border`}),t[48]=e):e=t[48],e}case`table`:{let e;t[49]===l?e=t[50]:(e=O(l,`w-full`),t[49]=l,t[50]=e);let i;if(t[51]!==n.headers||t[52]!==s||t[53]!==d||t[54]!==r){let e;t[56]!==s||t[57]!==d||t[58]!==r?(e=(e,t)=>(0,Q.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:(0,Q.jsx)(Bt,{text:e,threadId:r,chatFileIndex:s,inlineCodeClass:d})},t),t[56]=s,t[57]=d,t[58]=r,t[59]=e):e=t[59],i=n.headers.map(e),t[51]=n.headers,t[52]=s,t[53]=d,t[54]=r,t[55]=i}else i=t[55];let a;t[60]===i?a=t[61]:(a=(0,Q.jsx)(`thead`,{children:(0,Q.jsx)(`tr`,{className:`border-b border-table-border`,children:i})}),t[60]=i,t[61]=a);let o;if(t[62]!==n.rows||t[63]!==s||t[64]!==d||t[65]!==r){let e;t[67]!==s||t[68]!==d||t[69]!==r?(e=(e,t)=>(0,Q.jsx)(`tr`,{children:e.map((e,t)=>(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(Bt,{text:e,threadId:r,chatFileIndex:s,inlineCodeClass:d})},t))},t),t[67]=s,t[68]=d,t[69]=r,t[70]=e):e=t[70],o=n.rows.map(e),t[62]=n.rows,t[63]=s,t[64]=d,t[65]=r,t[66]=o}else o=t[66];let c;t[71]===o?c=t[72]:(c=(0,Q.jsx)(`tbody`,{children:o}),t[71]=o,t[72]=c);let u;return t[73]!==e||t[74]!==a||t[75]!==c?(u=(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-table-border max-w-full`,children:(0,Q.jsxs)(`table`,{className:e,children:[a,c]})}),t[73]=e,t[74]=a,t[75]=c,t[76]=u):u=t[76],u}case`mermaid`:{let e;return t[77]===n.code?e=t[78]:(e=(0,Q.jsx)(ge,{content:n.code}),t[77]=n.code,t[78]=e),e}case`image`:{let e;t[79]!==n.src||t[80]!==r?(e=De(n.src,r),t[79]=n.src,t[80]=r,t[81]=e):e=t[81];let i=n.alt||`Image`,a;return t[82]!==e||t[83]!==i?(a=(0,Q.jsx)(Ae,{imageUrl:e,alt:i}),t[82]=e,t[83]=i,t[84]=a):a=t[84],a}case`media`:{let e;t[85]!==n.src||t[86]!==r?(e=Ee(n.src,r),t[85]=n.src,t[86]=r,t[87]=e):e=t[87];let i=e;if(n.kind===`image`){let e;return t[88]===i?e=t[89]:(e=(0,Q.jsx)(Ae,{imageUrl:i,alt:`Image`}),t[88]=i,t[89]=e),e}let a;t[90]===n.src?a=t[91]:(a=n.src.split(/[/\\]/).pop(),t[90]=n.src,t[91]=a);let o=a,s;return t[92]!==n.kind||t[93]!==o||t[94]!==i?(s=(0,Q.jsx)(ze,{src:i,kind:n.kind,label:o}),t[92]=n.kind,t[93]=o,t[94]=i,t[95]=s):s=t[95],s}default:return null}}),Bt=(0,J.memo)(function(e){let t=(0,q.c)(13),{text:n,threadId:r,chatFileIndex:i,inlineCodeClass:a}=e,o=i===void 0?null:i,s=a===void 0?p.mono:a,c;t[0]===n?c=t[1]:(c=Ht(n),t[0]=n,t[1]=c);let l=c,u;if(t[2]!==o||t[3]!==s||t[4]!==l||t[5]!==r){let e;t[7]!==o||t[8]!==s||t[9]!==r?(e=(e,t)=>{switch(e.type){case`bold`:return(0,Q.jsx)(`strong`,{className:`font-semibold`,children:e.text},t);case`italic`:return(0,Q.jsx)(`em`,{children:e.text},t);case`strikethrough`:return(0,Q.jsx)(`del`,{className:`text-muted-foreground`,children:e.text},t);case`code`:{let n=o?et(e.text,o):null;return n?(0,Q.jsx)(qe,{path:n,className:O(s,`rounded bg-muted/20 py-0.5`),children:e.text},t):(0,Q.jsx)(`code`,{className:O(s,`rounded bg-muted/20 py-0.5`),children:e.text},t)}case`link`:return(0,Q.jsx)(Ke,{href:e.href,children:e.text},t);case`image`:return(0,Q.jsx)(Ae,{imageUrl:De(e.src,r),alt:e.alt||`Image`},t);case`text`:return(0,Q.jsx)(J.Fragment,{children:Vt(e.text,o,s)},t);default:return null}},t[7]=o,t[8]=s,t[9]=r,t[10]=e):e=t[10],u=l.map(e),t[2]=o,t[3]=s,t[4]=l,t[5]=r,t[6]=u}else u=t[6];let d;return t[11]===u?d=t[12]:(d=(0,Q.jsx)(Q.Fragment,{children:u}),t[11]=u,t[12]=d),d});function Vt(e,t,n){return t?tt(e,t).map((e,t)=>e.path?(0,Q.jsx)(qe,{path:e.path,className:O(n,`rounded bg-muted/20 py-0.5`),children:e.text},t):(0,Q.jsx)(`span`,{children:e.text},t)):(0,Q.jsx)(`span`,{children:e})}function Ht(e){let t=[],n=/(`[^`]+`)|(!\[[^\]]*\]\([^)]+\))|(\*\*[^*]+\*\*)|(\*[^*]+\*)|(__[^_]+__)|(_[^_]+_)|(~~[^~]+~~)|(\[[^\]]+\]\([^)]+\))|(https?:\/\/[^\s<>"`]+)/gi,r=0,i;for(;(i=n.exec(e))!==null;){i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)});let n=i[0];if(n.startsWith("`"))t.push({type:`code`,text:n.slice(1,-1)});else if(n.startsWith(`![`)){let e=n.match(/!\[([^\]]*)\]\(([^)]+)\)/);e&&t.push({type:`image`,alt:e[1],src:e[2]})}else if(n.startsWith(`**`)||n.startsWith(`__`))t.push({type:`bold`,text:n.slice(2,-2)});else if(n.startsWith(`~~`))t.push({type:`strikethrough`,text:n.slice(2,-2)});else if(n.startsWith(`*`)||n.startsWith(`_`))t.push({type:`italic`,text:n.slice(1,-1)});else if(n.startsWith(`[`)){let e=n.match(/\[([^\]]+)\]\(([^)]+)\)/);e&&t.push({type:`link`,text:e[1],href:e[2]})}else if(/^https?:\/\//i.test(n)){let e=n.replace(ut,``),r=n.slice(e.length);e&&t.push({type:`link`,text:e,href:e}),r&&t.push({type:`text`,text:r})}r=i.index+n.length}return r<e.length&&t.push({type:`text`,text:e.slice(r)}),t.length>0?t:[{type:`text`,text:e}]}function Ut(e){let t=(0,q.c)(27),{language:n,code:r,compact:i}=e,a=i===void 0?!1:i,[o,s]=(0,J.useState)(!1),c;t[0]===r?c=t[1]:(c=async function(){await navigator.clipboard.writeText(r),s(!0),setTimeout(()=>s(!1),2e3)},t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=O(p.compact,`text-muted-foreground font-mono`),t[2]=u):u=t[2];let d=n||`text`,f;t[3]===d?f=t[4]:(f=(0,Q.jsx)(`span`,{className:u,children:d}),t[3]=d,t[4]=f);let m;t[5]===o?m=t[6]:(m=o?(0,Q.jsx)(_,{}):(0,Q.jsx)(D,{}),t[5]=o,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Copy code`}),t[7]=h):h=t[7];let g;t[8]!==l||t[9]!==m?(g=(0,Q.jsxs)(k,{variant:`action`,size:`icon-xs`,onClick:l,children:[m,h]}),t[8]=l,t[9]=m,t[10]=g):g=t[10];let v;t[11]!==f||t[12]!==g?(v=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/80 px-4 py-2`,children:[f,g]}),t[11]=f,t[12]=g,t[13]=v):v=t[13];let y=a?`p-2`:`p-4`,b;t[14]===y?b=t[15]:(b=O(`overflow-x-auto max-w-full`,y),t[14]=y,t[15]=b);let x;t[16]===a?x=t[17]:(x=O(a?O(p.compact,`font-mono`):p.mono,`text-foreground leading-relaxed`),t[16]=a,t[17]=x);let S;t[18]!==r||t[19]!==x?(S=(0,Q.jsx)(`code`,{className:x,children:r}),t[18]=r,t[19]=x,t[20]=S):S=t[20];let C;t[21]!==b||t[22]!==S?(C=(0,Q.jsx)(`pre`,{className:b,children:S}),t[21]=b,t[22]=S,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==v?(w=(0,Q.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border border-border bg-muted`,children:[v,C]}),t[24]=C,t[25]=v,t[26]=w):w=t[26],w}export{Oe as a,Se as c,ke as i,K as l,ze as n,De as o,Ae as r,Ee as s,dt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{ot as n}from"./dist-BWuYHVi8.js";import{An as r,D as i,Dn as a,Et as o,dn as s}from"./dist-DIjomljy.js";import{t as c}from"./utils-CT-Dw22R.js";import{t as l}from"./button-DeNw35VZ.js";import{i as u,n as d,r as f,t as p}from"./tooltip-B6ziVyTv.js";var m=e(),h=t();function g(e){let t=(0,m.c)(6),{onContinue:n,disabled:r,creating:i}=e,s=r||i,c;t[0]===i?c=t[1]:(c=i?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,h.jsxs)(h.Fragment,{children:[`Continue`,(0,h.jsx)(a,{className:`ml-2 h-4 w-4`})]}),t[0]=i,t[1]=c);let u;return t[2]!==n||t[3]!==s||t[4]!==c?(u=(0,h.jsx)(`div`,{className:`mt-6 border-t pt-4 flex justify-end`,children:(0,h.jsx)(l,{onClick:n,disabled:s,children:c})}),t[2]=n,t[3]=s,t[4]=c,t[5]=u):u=t[5],u}function _(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function v(e){return e.replace(/-/g,` `).split(/\s+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function y(e){return e.length>0&&e.length<=64}function b(e){let t=(0,m.c)(29),{name:a,description:o,installed:g,onClick:_,onOpen:v,onUninstall:y,showInstalledControls:b,className:x}=e,S=b===void 0?!0:b,C=!g&&`cursor-pointer hover:bg-accent/50`,w;t[0]!==x||t[1]!==C?(w=c(`flex w-full flex-col gap-2 rounded-lg border border-border bg-card p-2.5 text-left transition-colors`,C,x),t[0]=x,t[1]=C,t[2]=w):w=t[2];let T=g?void 0:_,E=g?void 0:`button`,D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=c(n.label,`truncate leading-normal`),t[3]=D):D=t[3];let O;t[4]===a?O=t[5]:(O=(0,h.jsx)(`span`,{className:D,children:a}),t[4]=a,t[5]=O);let k;t[6]!==g||t[7]!==S?(k=g&&S&&(0,h.jsx)(f,{delayDuration:300,children:(0,h.jsxs)(p,{children:[(0,h.jsx)(u,{asChild:!0,children:(0,h.jsx)(`span`,{className:`flex-shrink-0 h-4 w-4 rounded-full bg-green-500/15 flex items-center justify-center`,children:(0,h.jsx)(r,{className:`h-2.5 w-2.5 text-green-600 dark:text-green-400`})})}),(0,h.jsx)(d,{children:`Installed`})]})}),t[6]=g,t[7]=S,t[8]=k):k=t[8];let A;t[9]!==O||t[10]!==k?(A=(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[O,k]}),t[9]=O,t[10]=k,t[11]=A):A=t[11];let j;t[12]!==g||t[13]!==v||t[14]!==y||t[15]!==S?(j=g&&S&&(0,h.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[v&&(0,h.jsx)(f,{delayDuration:300,children:(0,h.jsxs)(p,{children:[(0,h.jsx)(u,{asChild:!0,children:(0,h.jsx)(l,{variant:`ghost`,size:`icon-sm`,onClick:e=>{e.stopPropagation(),v()},children:(0,h.jsx)(s,{className:`h-3.5 w-3.5`})})}),(0,h.jsx)(d,{children:`Open in Explorer`})]})}),y&&(0,h.jsx)(f,{delayDuration:300,children:(0,h.jsxs)(p,{children:[(0,h.jsx)(u,{asChild:!0,children:(0,h.jsx)(l,{variant:`ghost`,size:`icon-sm`,onClick:e=>{e.stopPropagation(),y()},className:`text-destructive hover:text-destructive`,children:(0,h.jsx)(i,{className:`h-3.5 w-3.5`})})}),(0,h.jsx)(d,{children:`Remove`})]})})]}),t[12]=g,t[13]=v,t[14]=y,t[15]=S,t[16]=j):j=t[16];let M;t[17]!==j||t[18]!==A?(M=(0,h.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[A,j]}),t[17]=j,t[18]=A,t[19]=M):M=t[19];let N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(N=c(n.caption,`line-clamp-3 select-text`),t[20]=N):N=t[20];let P;t[21]===o?P=t[22]:(P=(0,h.jsx)(`p`,{className:N,children:o}),t[21]=o,t[22]=P);let F;return t[23]!==M||t[24]!==P||t[25]!==w||t[26]!==T||t[27]!==E?(F=(0,h.jsxs)(`div`,{className:w,onClick:T,role:E,children:[M,P]}),t[23]=M,t[24]=P,t[25]=w,t[26]=T,t[27]=E,t[28]=F):F=t[28],F}export{g as a,_ as i,v as n,y as r,b as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{ot as n}from"./dist-BWuYHVi8.js";import{t as r}from"./button-DeNw35VZ.js";import{a as i,i as a,o,r as s,s as c,t as l}from"./dialog-Do98zzAW.js";import{Pt as u,o as d}from"./index-DjaVbFDB.js";var f=e(),p=t();function m(e){let t=(0,f.c)(30),{open:m,onOpenChange:h,onNewBranch:g,onJustOpen:_,newChatOnNewBranch:v,onNewChatOnNewBranchChange:y,isLoading:b,projectName:x}=e,S=b===void 0?!1:b,C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,p.jsx)(c,{children:`Pull Request Merged`}),t[0]=C):C=t[0];let w=x?` for ${x}`:``,T;t[1]===w?T=t[2]:(T=(0,p.jsxs)(o,{children:[C,(0,p.jsxs)(a,{children:[`The PR has already been merged`,w,`. Create a new branch and PR?`]})]}),t[1]=w,t[2]=T);let E;t[3]===y?E=t[4]:(E=e=>y(e===!0),t[3]=y,t[4]=E);let D;t[5]!==v||t[6]!==E?(D=(0,p.jsx)(d,{id:`new-chat-on-new-branch`,checked:v,onCheckedChange:E}),t[5]=v,t[6]=E,t[7]=D):D=t[7];let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,p.jsx)(u,{htmlFor:`new-chat-on-new-branch`,className:n.labelNormal,children:`New Chat`}),t[8]=O):O=t[8];let k;t[9]===D?k=t[10]:(k=(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[D,O]}),t[9]=D,t[10]=k);let A;t[11]!==S||t[12]!==_?(A=(0,p.jsx)(r,{variant:`ghost`,onClick:_,disabled:S,children:`Just Open`}),t[11]=S,t[12]=_,t[13]=A):A=t[13];let j;t[14]!==S||t[15]!==g?(j=(0,p.jsx)(r,{onClick:g,disabled:S,children:`New Branch`}),t[14]=S,t[15]=g,t[16]=j):j=t[16];let M;t[17]!==j||t[18]!==A?(M=(0,p.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[A,j]}),t[17]=j,t[18]=A,t[19]=M):M=t[19];let N;t[20]!==M||t[21]!==k?(N=(0,p.jsxs)(i,{className:`flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[k,M]}),t[20]=M,t[21]=k,t[22]=N):N=t[22];let P;t[23]!==N||t[24]!==T?(P=(0,p.jsxs)(s,{children:[T,N]}),t[23]=N,t[24]=T,t[25]=P):P=t[25];let F;return t[26]!==h||t[27]!==m||t[28]!==P?(F=(0,p.jsx)(l,{open:m,onOpenChange:h,children:P}),t[26]=h,t[27]=m,t[28]=P,t[29]=F):F=t[29],F}export{m as MergedPRDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{n as e,o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{ot as r}from"./dist-BWuYHVi8.js";import{Bn as i,P as a,Y as o,gn as s}from"./dist-DIjomljy.js";import{t as c}from"./button-DeNw35VZ.js";import"./api-BMo_Lz8f.js";import{i as l,n as u,r as d,t as f}from"./tooltip-B6ziVyTv.js";import{o as p}from"./index-DjaVbFDB.js";import{n as m}from"./sorting-DqwxPMRN.js";var h=e(),g=n();function _(e){let t=(0,h.c)(9),{codingIndex:n,modelName:i}=e,o=m(n);if(o===0)return null;let s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[1,2,3,4,5],t[0]=s):s=t[0];let c;t[1]===o?c=t[2]:(c=(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(`div`,{className:`flex items-center gap-0.5`,children:s.map(e=>(0,g.jsx)(a,{className:`h-3 w-3 ${e<=o?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),t[1]=o,t[2]=c);let p;t[3]!==n||t[4]!==i?(p=(0,g.jsx)(u,{children:(0,g.jsxs)(`p`,{className:r.body,children:[i,` was indexed `,n,` for coding intelligence`]})}),t[3]=n,t[4]=i,t[5]=p):p=t[5];let _;return t[6]!==c||t[7]!==p?(_=(0,g.jsx)(d,{children:(0,g.jsxs)(f,{children:[c,p]})}),t[6]=c,t[7]=p,t[8]=_):_=t[8],_}t();function v(e){let t=(0,h.c)(10),{id:n,checked:r,disabled:i,onChange:a}=e,o=i===void 0?!1:i,s;t[0]===a?s=t[1]:(s=e=>a(e===!0),t[0]=a,t[1]=s);let c;t[2]!==r||t[3]!==o||t[4]!==n||t[5]!==s?(c=(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(`span`,{className:`inline-flex`,children:(0,g.jsx)(p,{id:n,disabled:o,checked:r,onCheckedChange:s,"aria-label":`Select All Models`})})}),t[2]=r,t[3]=o,t[4]=n,t[5]=s,t[6]=c):c=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,g.jsx)(u,{children:`Select All Models`}),t[7]=m):m=t[7];let _;return t[8]===c?_=t[9]:(_=(0,g.jsx)(d,{children:(0,g.jsxs)(f,{children:[c,m]})}),t[8]=c,t[9]=_),_}function y(e){let t=(0,h.c)(31),{sortBy:n,onSortByChange:r,showCodingIndex:p,showIntelligenceByPrice:m}=e,_=p===void 0?!1:p,v=m===void 0?!1:m,y=n===`alphabetical`?`secondary`:`ghost`,b;t[0]===r?b=t[1]:(b=()=>r(`alphabetical`),t[0]=r,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,g.jsx)(i,{className:`h-4 w-4`}),t[2]=x):x=t[2];let S;t[3]!==y||t[4]!==b?(S=(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(c,{type:`button`,variant:y,size:`icon`,className:`h-8 w-8`,onClick:b,children:x})}),t[3]=y,t[4]=b,t[5]=S):S=t[5];let C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,g.jsx)(u,{children:`Sort A–Z`}),t[6]=C):C=t[6];let w;t[7]===S?w=t[8]:(w=(0,g.jsxs)(f,{children:[S,C]}),t[7]=S,t[8]=w);let T=n===`price-low`||n===`price-high`?`secondary`:`ghost`,E;t[9]===r?E=t[10]:(E=()=>r(`price-low`),t[9]=r,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,g.jsx)(s,{className:`h-4 w-4`}),t[11]=D):D=t[11];let O;t[12]!==E||t[13]!==T?(O=(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(c,{type:`button`,variant:T,size:`icon`,className:`h-8 w-8`,onClick:E,children:D})}),t[12]=E,t[13]=T,t[14]=O):O=t[14];let k;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,g.jsx)(u,{children:`Sort by price`}),t[15]=k):k=t[15];let A;t[16]===O?A=t[17]:(A=(0,g.jsxs)(f,{children:[O,k]}),t[16]=O,t[17]=A);let j;t[18]!==r||t[19]!==_||t[20]!==n?(j=_?(0,g.jsxs)(f,{children:[(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(c,{type:`button`,variant:n===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(`coding-index`),children:(0,g.jsx)(a,{className:`h-4 w-4`})})}),(0,g.jsx)(u,{children:`Sort by coding intelligence`})]}):null,t[18]=r,t[19]=_,t[20]=n,t[21]=j):j=t[21];let M;t[22]!==r||t[23]!==v||t[24]!==n?(M=v?(0,g.jsxs)(f,{children:[(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(c,{type:`button`,variant:n===`intelligence-by-price`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(`intelligence-by-price`),children:(0,g.jsx)(o,{className:`h-4 w-4`})})}),(0,g.jsx)(u,{children:`Sort by price/intelligence`})]}):null,t[22]=r,t[23]=v,t[24]=n,t[25]=M):M=t[25];let N;return t[26]!==A||t[27]!==j||t[28]!==M||t[29]!==w?(N=(0,g.jsx)(d,{children:(0,g.jsxs)(`div`,{className:`flex items-center rounded-md p-0.5`,children:[w,A,j,M]})}),t[26]=A,t[27]=j,t[28]=M,t[29]=w,t[30]=N):N=t[30],N}export{y as n,_ as r,v as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
async function e(e,t){let n=e.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:a}=await n.read();if(e)break;i+=r.decode(a,{stream:!0});let o=i.split(`
|
|
2
|
-
`);i=o.pop()??``;for(let e of o){let n=e.trim();if(n)try{await t(JSON.parse(n),n)}catch{await t(n,n)}}}if(i.trim())try{await t(JSON.parse(i),i)}catch{await t(i,i)}}finally{n.releaseLock()}}async function t(t,n){await e(t,e=>{if(typeof e==`string`){n.onOutput(e);return}if(!e||typeof e!=`object`)return;let t=e;t.type===`error`&&typeof t.message==`string`&&n.onError(t.message)})}export{t as n,e as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{G as i,S as a,ot as o}from"./dist-BWuYHVi8.js";import{An as s,Bn as c,Et as l,Ln as u,Tn as d,dn as f,gn as p,q as m}from"./dist-DIjomljy.js";import{n as h,t as g}from"./utils-CT-Dw22R.js";import{t as _}from"./button-DeNw35VZ.js";import{G as v,V as y,h as b,jt as x,kt as S,s as C,vn as w,yn as T}from"./api-BMo_Lz8f.js";import{i as E,n as D,r as O,t as k}from"./tooltip-B6ziVyTv.js";import{n as A}from"./scroll-area-nbNFO91g.js";import{a as j,i as M,o as N,r as P,s as F,t as I}from"./dialog-Do98zzAW.js";import{Ct as L,Ft as R,On as z,Pn as B,Pt as V,St as H,Tt as U,o as W,pn as G,wt as K,xt as ee,yt as q}from"./index-DjaVbFDB.js";import{n as J,t as Y}from"./toggle-group-5tREtjoW.js";import{t as te}from"./sorting-DqwxPMRN.js";import{t as ne}from"./pending-changes-Bn-0ak1d.js";function re(e){let t=/^[^:]+:\s+(.+)$/.exec(e);return(t?t[1]:e).trim()}function ie(e){return[G(e.id),e.name,re(e.name)]}function ae(e,t){let n=new Set(t.map(e=>e.toLowerCase()));return ie(e).some(e=>n.has(e.toLowerCase()))}function oe(e,t){return e.filter(e=>ae(e,t)).map(e=>e.id)}var X=t(),Z=e(n(),1),Q=r(),se=a(`app.model-selector.ui`),ce=`rounded-full border-0 px-3 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`;function le({provider:e,onModelsChange:t,isLoading:n,disabled:r,displayMode:i=`grid`,autoSelectRecommended:a=!1}){let[s,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(new Set),[_,y]=(0,Z.useState)(new Set),[b,S]=(0,Z.useState)(new Map),[C,w]=(0,Z.useState)(!1),[T,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(`alphabetical`);(0,Z.useEffect)(()=>{N()},[e]);let N=async()=>{w(!0),A(``),M(`alphabetical`);try{let t=await v(e);u(t.models);let n=new Set(t.enabledModelIds);f(n);let r=new Map,i=new Set;if(a)try{let{models:e}=await x();i=new Set(oe(t.models,e)),r=new Map([...i].filter(e=>!n.has(e)).map(e=>[e,!0]))}catch(e){se.error(`Failed to load recommended models:`,e)}y(i),S(r),P(n,r,t.models)}catch(t){se.error(`Failed to load models for ${e}:`,t),u([]),f(new Set),y(new Set)}finally{w(!1)}},P=(e,n,r=s)=>{let i=new Set(e);r.forEach(e=>{n.has(e.id)&&(n.get(e.id)?i.add(e.id):i.delete(e.id))}),t?.(i)},F=e=>{S(t=>{let n=ne(t,e,d);return P(d,n),n})},I=e=>{S(t=>{let n=new Map(t);return s.forEach(t=>{let r=d.has(t.id);e?r?n.delete(t.id):n.set(t.id,!0):r?n.set(t.id,!1):n.delete(t.id)}),P(d,n),n})},L=e=>G(e.id);function z(e,t=b){let n=t.has(e),r=t.get(e);return n?!!r:d.has(e)}let B=te({models:s,query:T,sortBy:j,getDisplayName:L,getPriority:e=>+!z(e.id)}),V=j===`alphabetical`?`alphabetical`:`price`;function H(e){if(e===`alphabetical`){M(`alphabetical`);return}e===`price`&&M(`price-low`)}function U(){j!==`alphabetical`&&M(e=>e===`price-low`?`price-high`:`price-low`)}return C||n?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(l,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):s.length===0?(0,Q.jsx)(`div`,{className:`text-center py-8`,children:(0,Q.jsx)(`p`,{className:o.bodyMuted,children:`No models available for this provider.`})}):i===`compact`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:g(`flex items-center justify-between gap-3`,r&&`opacity-25`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Q.jsx)(W,{id:`select-all-models`,disabled:r,checked:s.every(e=>z(e.id)),onCheckedChange:e=>I(e===!0)}),(0,Q.jsx)(`label`,{htmlFor:`select-all-models`,className:g(o.body,`cursor-pointer`),children:`Select all models`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Q.jsxs)(`div`,{className:`relative w-44 sm:w-52`,children:[(0,Q.jsx)(m,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,Q.jsx)(R,{placeholder:`Search models...`,value:T,onChange:e=>A(e.target.value),disabled:r,className:`pl-8 h-9`})]}),(0,Q.jsxs)(Y,{type:`single`,value:V,onValueChange:H,"aria-label":`Sort models`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:[(0,Q.jsx)(J,{value:`alphabetical`,"aria-label":`Sort A–Z`,disabled:r,className:ce,children:(0,Q.jsx)(c,{className:`h-4 w-4`})}),(0,Q.jsx)(J,{value:`price`,"aria-label":`Sort by price`,disabled:r,className:ce,onClick:U,children:(0,Q.jsx)(p,{className:`h-4 w-4`})})]})]})]}),(0,Q.jsx)(O,{children:(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-0 overflow-hidden rounded-md border border-table-border`,children:B.length===0?(0,Q.jsx)(`div`,{className:`text-center py-4`,children:(0,Q.jsx)(`p`,{className:o.bodyMuted,children:T?`No models match your search.`:`No models available.`})}):B.map(e=>{let t=z(e.id),n=e.pricing,i=t&&_.has(e.id);return(0,Q.jsxs)(k,{children:[(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:g(`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default`,r&&`opacity-25`),children:[(0,Q.jsx)(W,{id:e.id,disabled:r,checked:t??!1,onCheckedChange:()=>F(e.id),className:`mt-0`}),(0,Q.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Q.jsxs)(`label`,{htmlFor:e.id,className:g(o.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1 w-0`),children:[L(e),i&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` (Recommended)`})]}),n&&(0,Q.jsx)(`span`,{className:g(o.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(n.prompt??0)<=0&&(n.completion??0)<=0?`Free`:`${h(n.prompt??0)} in | ${h(n.completion??0)} out`})]})]})}),e.description&&(0,Q.jsx)(D,{side:`top`,className:`max-w-xs`,children:(0,Q.jsx)(`p`,{className:o.body,children:e.description})})]},e.id)})})})]}):null}var $=a(`app.onboarding-dialog.ui`);function ue(e){let t=(0,X.c)(26),{currentStep:n}=e,r=e=>e===`provider-selection`&&n===`provider-selection`||n===`model-selection`,i=e=>n===e,a=i(`git-check`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,s;t[0]===a?s=t[1]:(s=g(`flex items-center justify-center h-8 w-8 rounded-full`,o.label,a),t[0]=a,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(`div`,{className:s,children:`1`}),t[2]=s,t[3]=c);let l=r(`provider-selection`)?`bg-primary`:`bg-muted`,u;t[4]===l?u=t[5]:(u=g(`h-0.5 flex-1`,l),t[4]=l,t[5]=u);let d;t[6]===u?d=t[7]:(d=(0,Q.jsx)(`div`,{className:u}),t[6]=u,t[7]=d);let f=i(`provider-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,p;t[8]===f?p=t[9]:(p=g(`flex items-center justify-center h-8 w-8 rounded-full`,o.label,f),t[8]=f,t[9]=p);let m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`div`,{className:p,children:`2`}),t[10]=p,t[11]=m);let h=r(`model-selection`)?`bg-primary`:`bg-muted`,_;t[12]===h?_=t[13]:(_=g(`h-0.5 flex-1`,h),t[12]=h,t[13]=_);let v;t[14]===_?v=t[15]:(v=(0,Q.jsx)(`div`,{className:_}),t[14]=_,t[15]=v);let y=i(`model-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,b;t[16]===y?b=t[17]:(b=g(`flex items-center justify-center h-8 w-8 rounded-full`,o.label,y),t[16]=y,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,Q.jsx)(`div`,{className:b,children:`3`}),t[18]=b,t[19]=x);let S;return t[20]!==v||t[21]!==x||t[22]!==c||t[23]!==d||t[24]!==m?(S=(0,Q.jsxs)(`div`,{className:`w-1/2 mx-auto flex items-center gap-2 mb-6`,children:[c,d,m,v,x]}),t[20]=v,t[21]=x,t[22]=c,t[23]=d,t[24]=m,t[25]=S):S=t[25],S}function de(e){let t=(0,X.c)(3),{currentStep:n}=e;if(n===`provider-selection`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Select an AI Provider`}),(0,Q.jsx)(M,{children:`Choose your preferred AI provider and enter your API key.`})]}),t[0]=e):e=t[0],e}if(n===`model-selection`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Select Models`}),(0,Q.jsx)(M,{children:`Choose which models you want to use with this provider.`})]}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Let's get started`}),(0,Q.jsx)(M,{children:`First, we need to check that Git is installed on your system.`})]}),t[2]=r):r=t[2],r}function fe(e){let t=(0,X.c)(7),{gitLoading:n,gitInstalled:r}=e;if(n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(l,{className:`h-5 w-5 animate-spin text-muted-foreground`})}),t[0]=e):e=t[0],e}if(r){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(z,{variant:`success`,className:`mb-0 flex items-start gap-3`,children:[(0,Q.jsx)(s,{className:`h-5 w-5 text-green-600 flex-shrink-0 mt-0.5`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:g(o.label,`text-green-900`),children:`Git is installed`}),(0,Q.jsx)(`p`,{className:o.bodyMuted,children:`You're all set to use Git features in Tarsk.`})]})]}),t[1]=e):e=t[1],e}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(d,{className:`h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5`}),t[2]=i):i=t[2];let a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`p`,{className:o.label,children:`Git is not installed`}),c=(0,Q.jsx)(`p`,{className:o.bodyMuted,children:`Git is required for some features in Tarsk. You can continue without it, but we recommend installing it.`}),t[3]=a,t[4]=c):(a=t[3],c=t[4]);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=g(o.caption,`text-brand hover:underline mt-2 inline-flex items-center gap-1`),t[5]=u):u=t[5];let p;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsxs)(z,{variant:`hint`,className:`mb-0 flex items-start gap-3`,children:[i,(0,Q.jsxs)(`div`,{className:`flex-1`,children:[a,c,(0,Q.jsxs)(`a`,{href:`https://git-scm.com/downloads`,target:`_blank`,rel:`noreferrer`,className:u,children:[`Download Git `,(0,Q.jsx)(f,{className:`h-3 w-3`})]})]})]}),t[6]=p):p=t[6],p}function pe(e){let t=(0,X.c)(16),{selectedProvider:n,onProviderChange:r,apiKey:a,onApiKeyChange:s,validatingKey:c,providerEnvValues:l,onProviderEnvChange:u,keyError:d}=e,f;t[0]!==a||t[1]!==s||t[2]!==r||t[3]!==n||t[4]!==c?(f=(0,Q.jsx)(q,{selectedProvider:n,onProviderChange:r,showApiKeyInput:!0,apiKey:a,onApiKeyChange:s,variant:`dropdown`,isLoading:c}),t[0]=a,t[1]=s,t[2]=r,t[3]=n,t[4]=c,t[5]=f):f=t[5];let p;t[6]!==u||t[7]!==l||t[8]!==n?(p=n&&L(n).map(e=>(0,Q.jsx)(B,{label:(0,Q.jsx)(V,{htmlFor:e,children:H(e)}),control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{id:e,value:l[e]??``,onChange:t=>u(e,t.target.value),className:`h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base`,placeholder:i(n.slug)&&e===`LOCAL_API_URL`?n.api:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),n.slug===`azure`&&e===K(n)||i(n.slug)&&e===`LOCAL_API_URL`?(0,Q.jsx)(`p`,{className:g(o.bodyMuted,`mt-2 break-all`),children:U(n,l)||n.api}):null]}),align:`start`},e)),t[6]=u,t[7]=l,t[8]=n,t[9]=p):p=t[9];let m;t[10]===d?m=t[11]:(m=d&&(0,Q.jsx)(z,{variant:`error`,className:`mb-0`,children:d}),t[10]=d,t[11]=m);let h;return t[12]!==f||t[13]!==p||t[14]!==m?(h=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[f,p,m]}),t[12]=f,t[13]=p,t[14]=m,t[15]=h):h=t[15],h}function me(e){let t=(0,X.c)(4),{providerSlug:n,modelsLoading:r,onModelsChange:i}=e,a;return t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(le,{provider:n,isLoading:r,displayMode:`compact`,disabled:!1,autoSelectRecommended:!0,onModelsChange:i})}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3],a}function he(e){let t=(0,X.c)(32),{currentStep:n,savingOnboarding:r,gitLoading:i,validatingKey:a,apiKey:o,hasProvider:c,onSkip:d,onBack:f,onContinue:p,onValidate:m,onFinish:h}=e,g;t[0]!==n||t[1]!==d||t[2]!==r?(g=n===`provider-selection`&&(0,Q.jsx)(_,{variant:`ghost`,onClick:d,disabled:r,children:`Skip for now`}),t[0]=n,t[1]=d,t[2]=r,t[3]=g):g=t[3];let v;t[4]===g?v=t[5]:(v=(0,Q.jsx)(`div`,{children:g}),t[4]=g,t[5]=v);let y;t[6]!==n||t[7]!==f||t[8]!==r?(y=n!==`git-check`&&(0,Q.jsx)(_,{variant:`outline`,onClick:f,disabled:r,children:`Back`}),t[6]=n,t[7]=f,t[8]=r,t[9]=y):y=t[9];let b;t[10]!==n||t[11]!==i||t[12]!==p?(b=n===`git-check`&&(0,Q.jsxs)(_,{onClick:p,disabled:i,className:`gap-2`,children:[`Continue `,(0,Q.jsx)(u,{className:`h-4 w-4`})]}),t[10]=n,t[11]=i,t[12]=p,t[13]=b):b=t[13];let x;t[14]!==o||t[15]!==n||t[16]!==c||t[17]!==m||t[18]!==a?(x=n===`provider-selection`&&(0,Q.jsx)(_,{onClick:m,disabled:a||!o.trim()||!c,className:`gap-2`,children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`h-4 w-4 animate-spin`}),`Validating...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Next `,(0,Q.jsx)(u,{className:`h-4 w-4`})]})}),t[14]=o,t[15]=n,t[16]=c,t[17]=m,t[18]=a,t[19]=x):x=t[19];let S;t[20]!==n||t[21]!==h||t[22]!==r?(S=n===`model-selection`&&(0,Q.jsx)(_,{onClick:h,disabled:r,className:`gap-2`,children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`h-4 w-4 animate-spin`}),`Finishing...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Finish `,(0,Q.jsx)(s,{className:`h-4 w-4`})]})}),t[20]=n,t[21]=h,t[22]=r,t[23]=S):S=t[23];let C;t[24]!==y||t[25]!==b||t[26]!==x||t[27]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[y,b,x,S]}),t[24]=y,t[25]=b,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;return t[29]!==v||t[30]!==C?(w=(0,Q.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10`,children:(0,Q.jsxs)(j,{className:`flex items-center justify-between`,children:[v,C]})}),t[29]=v,t[30]=C,t[31]=w):w=t[31],w}function ge({open:e,onOpenChange:t,onComplete:n}){let[r,i]=(0,Z.useState)(`git-check`),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)({}),[_,x]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(new Set),[j,M]=(0,Z.useState)(!1),[F,R]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&r===`git-check`&&z()},[e,r]),(0,Z.useEffect)(()=>{e&&r===`provider-selection`&&l.length===0&&B()},[e,r,l.length]),(0,Z.useEffect)(()=>{e&&r===`model-selection`&&d&&V()},[e,r,d]);let z=async()=>{c(!0);try{let e=await C();o(e.gitInstalled),e.gitInstalled&&i(`provider-selection`)}catch(e){$.error(`Failed to check git installation:`,e),o(!1)}finally{c(!1)}},B=async()=>{try{let e=await S();if(u(e),e.length>0&&!d){let t=ee(e);t&&(f(t),m(t.apiKey??``),g(t.envValues??{}))}}catch(e){$.error(`Failed to load providers:`,e)}},V=async()=>{if(d){M(!0);try{await v(d.name),k(new Set)}catch(e){$.error(`Failed to load models:`,e)}finally{M(!1)}}},U=async()=>{if(!d||!p.trim()){D(`Please enter an API key`);return}let e=L(d),t=e.find(e=>!h[e]?.trim());if(t){D(`Please enter ${H(t)}`);return}x(!0),D(``);try{e.length>0&&await w(Object.fromEntries(e.map(e=>[e,h[e].trim()]))),await T(d.slug,p),i(`model-selection`)}catch(e){D(e instanceof Error?e.message:`Failed to validate API key`)}finally{x(!1)}},W=async()=>{if(d){R(!0);try{for(let e of O)await y(d.slug,e);await b(),n?.(),t(!1)}catch(e){$.error(`Failed to complete onboarding:`,e)}finally{R(!1)}}},G=async()=>{R(!0);try{await b(),n?.(),t(!1)}catch(e){$.error(`Failed to skip onboarding:`,e)}finally{R(!1)}},K=e=>{f(e),m(e.apiKey??``),g(e.envValues??{}),D(``)},q=(e,t)=>{g(n=>({...n,[e]:t}))},J=()=>{i(`provider-selection`)};function Y(){r===`provider-selection`?i(`git-check`):r===`model-selection`&&i(`provider-selection`)}return(0,Q.jsx)(I,{open:e,onOpenChange:t,children:(0,Q.jsxs)(P,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,Q.jsx)(ue,{currentStep:r}),(0,Q.jsx)(N,{children:(0,Q.jsx)(de,{currentStep:r})})]}),(0,Q.jsx)(A,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`px-6 py-4`,children:[r===`git-check`&&(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(fe,{gitLoading:s,gitInstalled:a})}),r===`provider-selection`&&(0,Q.jsx)(pe,{selectedProvider:d,onProviderChange:K,apiKey:p,onApiKeyChange:m,validatingKey:_,providerEnvValues:h,onProviderEnvChange:q,keyError:E}),r===`model-selection`&&d&&(0,Q.jsx)(me,{providerSlug:d.slug,modelsLoading:j,onModelsChange:k})]})}),(0,Q.jsx)(he,{currentStep:r,savingOnboarding:F,gitLoading:s,validatingKey:_,apiKey:p,hasProvider:!!d,onSkip:()=>void G(),onBack:Y,onContinue:J,onValidate:()=>void U(),onFinish:()=>void W()})]})})}export{ge as OnboardingDialog,ge as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{L as a,ot as o}from"./dist-BWuYHVi8.js";import{Et as s,ln as c,un as l,y as u}from"./dist-DIjomljy.js";import{t as d}from"./utils-CT-Dw22R.js";import{t as f}from"./button-DeNw35VZ.js";import{Ln as p,xt as m}from"./api-BMo_Lz8f.js";import{t as h}from"./use-toast-xpb5jNtN.js";import{Bn as g,Ft as _,In as v,Ln as y,Nn as b,kn as x}from"./index-DjaVbFDB.js";import{t as S}from"./use-settings-page-loading-BTySlInF.js";var C=t(),w=e(n(),1),T=r();function E(e){let t=(0,C.c)(20),{entry:n,index:r,loading:i,onValueChange:o}=e,s=a(n.name),[u,p]=(0,w.useState)(!1),m=n.value.length>0||n.hasExistingValue,h=n.hasExistingValue&&!n.value?`••••••••`:`value`;(0,w.useEffect)(()=>{s||p(!1)},[s]);let g=_,v=s&&!u?`password`:`text`,y=n.value,b;t[0]!==r||t[1]!==o?(b=e=>o(r,e.target.value),t[0]=r,t[1]=o,t[2]=b):b=t[2];let x=d(`font-mono`,s&&`pr-10`),S;t[3]!==g||t[4]!==n.value||t[5]!==i||t[6]!==h||t[7]!==v||t[8]!==b||t[9]!==x?(S=(0,T.jsx)(g,{type:v,placeholder:h,value:y,onChange:b,className:x,disabled:i}),t[3]=g,t[4]=n.value,t[5]=i,t[6]=h,t[7]=v,t[8]=b,t[9]=x,t[10]=S):S=t[10];let E;t[11]!==m||t[12]!==s||t[13]!==i||t[14]!==p||t[15]!==u?(E=s?(0,T.jsx)(f,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 h-8 w-8 -translate-y-1/2 p-0`,onClick:()=>p(D),disabled:i||!m,children:u?(0,T.jsx)(l,{className:`h-4 w-4 text-muted-foreground`}):(0,T.jsx)(c,{className:`h-4 w-4 text-muted-foreground`})}):null,t[11]=m,t[12]=s,t[13]=i,t[14]=p,t[15]=u,t[16]=E):E=t[16];let O;return t[17]!==S||t[18]!==E?(O=(0,T.jsxs)(`div`,{className:`relative flex-1`,children:[S,E]}),t[17]=S,t[18]=E,t[19]=O):O=t[19],O}function D(e){return!e}function O({projectId:e}){let t=i(),[n,r]=(0,w.useState)([]),[a,c]=(0,w.useState)([]),[l,d]=(0,w.useState)(!0),[C,D]=(0,w.useState)(!1),O=(0,w.useCallback)(async()=>{if(!e){d(!1);return}d(!0);try{let t=(await m(e)).vars.map(e=>({name:e.name,value:e.value??``,hasExistingValue:e.hasValue&&e.value===void 0}));r(t),c(t)}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to load environment variables`,variant:`destructive`})}finally{d(!1)}},[e]);(0,w.useLayoutEffect)(()=>{e&&d(!0)},[e]),(0,w.useEffect)(()=>{O()},[O]);let k=S(e,[l]);function A(){r(e=>[...e,{name:``,value:``,hasExistingValue:!1}])}function j(e,t){r(n=>n.map((n,r)=>r===e?{...n,name:t.toUpperCase()}:n))}function M(e,t){r(n=>n.map((n,r)=>r===e?{...n,value:t}:n))}function N(e){r(t=>t.filter((t,n)=>n!==e))}function P(){if(n.length!==a.length)return!0;for(let e=0;e<n.length;e+=1){let t=n[e],r=a[e];if(!r||t.name!==r.name||t.value!==r.value||t.hasExistingValue!==r.hasExistingValue)return!0}return!1}async function F(){if(!(!e||!P())){D(!0);try{let r=n.map(e=>({name:e.name.trim(),value:e.value,hasExistingValue:e.hasExistingValue})).filter(e=>e.name.length>0),i=r.find((e,t)=>r.findIndex(t=>t.name===e.name)!==t);if(i)throw Error(`Duplicate environment variable name: ${i.name}`);let a=r.find(e=>!e.hasExistingValue&&!e.value.trim());if(a)throw Error(`Value is required for environment variable: ${a.name}`);await p(e,r.map(e=>({name:e.name,value:e.value.trim()||void 0}))),c(n.map(e=>({...e,value:``}))),await O(),t(`/`)}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to save environment variables`,variant:`destructive`})}finally{D(!1)}}}return e?(0,T.jsx)(b,{loading:k,children:(0,T.jsxs)(g,{className:`shrink-0`,children:[(0,T.jsx)(x,{title:`Environment Variables`,description:`Encrypted in Tarsk and injected for bash commands and MCP tools.`,action:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(f,{variant:`ghost`,size:`sm`,onClick:A,disabled:l,children:`Add variable`}),(0,T.jsx)(f,{onClick:()=>void F(),disabled:C||l,children:C?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})]}),sticky:!1}),(0,T.jsx)(y,{className:`max-w-none pt-6`,children:n.length===0?(0,T.jsx)(`p`,{className:o.caption,children:`No environment variables configured`}):(0,T.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(_,{placeholder:`API_KEY`,value:e.name,onChange:e=>j(t,e.target.value),className:`w-[35%] font-mono`,disabled:l}),(0,T.jsx)(E,{entry:e,index:t,loading:l,onValueChange:M}),(0,T.jsx)(f,{variant:`ghost`,size:`icon`,onClick:()=>N(t),className:`h-9 w-9 shrink-0`,disabled:l||C,children:(0,T.jsx)(u,{className:`h-3.5 w-3.5`})})]},t))})})]})}):(0,T.jsx)(v,{title:`No project selected`,children:`Please select a project from the sidebar to manage environment variables.`})}export{O as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Bt as a,It as o,Jt as s,Kt as c,Lt as l,Rt as u,ot as d,qt as f,zt as p}from"./dist-BWuYHVi8.js";import{Et as m}from"./dist-DIjomljy.js";import{t as h}from"./utils-CT-Dw22R.js";import{t as g}from"./button-DeNw35VZ.js";import{tt as _,yt as v,zn as y}from"./api-BMo_Lz8f.js";import{t as b}from"./use-toast-xpb5jNtN.js";import{At as x,Bn as S,Dn as C,Fn as w,In as T,Ln as E,Mt as D,Nn as O,Nt as k,Ot as A,jt as j,kn as M,kt as N,pn as P}from"./index-DjaVbFDB.js";import{t as F}from"./use-settings-page-loading-BTySlInF.js";var I=e(n(),1),L=t(),R=r(),z=`__unspecified__`,B=`__default__`;function V(e){let t=(0,L.c)(20),{value:n,onChange:r,enabledModels:i,disabled:c}=e,d=c===void 0?!1:c,m;if(t[0]!==i){m=new Map;for(let e of i){let t=e.provider??`other`,n=m.get(t);n?n.push(e):m.set(t,[e])}t[0]=i,t[1]=m}else m=t[1];let h=m,g;t[2]!==r||t[3]!==n?(g=function(e,t){let i={...n};if(t===z){delete i[e],r(i);return}let a=p(t);a&&(i[e]=a,r(i))},t[2]=r,t[3]=n,t[4]=g):g=t[4];let _=g,v;t[5]===i?v=t[6]:(v=function(e){if(!e)return;let t=e.provider.toLowerCase();return i.find(n=>n.id===e.model&&(n.provider??`other`).toLowerCase()===t)},t[5]=i,t[6]=v);let y=v,b;t[7]!==r||t[8]!==n?(b=function(e,t){let i=n[e];if(!i)return;let a={...i};if(t===B)delete a.reasoningEffort;else if(s(t))a.reasoningEffort=t;else return;r({...n,[e]:a})},t[7]=r,t[8]=n,t[9]=b):b=t[9];let S=b,T;t[10]!==d||t[11]!==i||t[12]!==y||t[13]!==_||t[14]!==S||t[15]!==h||t[16]!==n?(T=u.map(e=>{let t=n[e],r=t?a(t):z,s=y(t)?.supportedReasoningEfforts??[];return(0,R.jsx)(C,{title:l[e],description:o[e],children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(A,{value:r,onValueChange:t=>_(e,t),disabled:d,children:[(0,R.jsx)(D,{id:`model-alias-${e}`,className:`w-full min-w-0`,children:(0,R.jsx)(k,{placeholder:`Unspecified`})}),(0,R.jsxs)(N,{children:[(0,R.jsx)(x,{value:z,children:`Unspecified`}),i.length>0&&(0,R.jsx)(j,{}),[...h.entries()].map(U)]})]}),t&&s.length>0&&(0,R.jsxs)(A,{value:t.reasoningEffort??B,onValueChange:t=>S(e,t),disabled:d,children:[(0,R.jsx)(D,{id:`model-alias-${e}-reasoning`,className:`w-full min-w-0`,children:(0,R.jsx)(k,{placeholder:`Model default`})}),(0,R.jsxs)(N,{children:[(0,R.jsx)(x,{value:B,children:`Model default`}),(0,R.jsx)(x,{value:`off`,children:f(`off`)}),s.map(H)]})]})]})},e)}),t[10]=d,t[11]=i,t[12]=y,t[13]=_,t[14]=S,t[15]=h,t[16]=n,t[17]=T):T=t[17];let E;return t[18]===T?E=t[19]:(E=(0,R.jsx)(w,{id:`model-aliases`,children:T}),t[18]=T,t[19]=E),E}function H(e){return(0,R.jsx)(x,{value:e,children:f(e)},e)}function U(e){let[t,n]=e;return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:h(d.dropdownGroupHeading,`px-2 py-1.5 uppercase`),children:t}),n.map(e=>{let n=a({provider:e.provider??t,model:e.id});return(0,R.jsx)(x,{value:n,children:P(e.id)},n)})]},t)}function W(e){return[...e].sort((e,t)=>{let n=(e.provider??``).localeCompare(t.provider??``);return n===0?P(e.id).localeCompare(P(t.id)):n})}function G({projectId:e,onProjectUpdated:t}){let n=i(),[r,a]=(0,I.useState)({}),[o,s]=(0,I.useState)({}),[l,u]=(0,I.useState)([]),[d,f]=(0,I.useState)(!0),[p,h]=(0,I.useState)(!1),x=(0,I.useCallback)(async()=>{if(!e){f(!1);return}f(!0);try{let[t,n]=await Promise.all([v(e),_().catch(()=>({}))]),r=t.modelAliases??{};u(W(Object.values(n).flat())),a(r),s(r)}catch(e){b({title:`Error`,description:e instanceof Error?e.message:`Failed to load model aliases`,variant:`destructive`})}finally{f(!1)}},[e]);(0,I.useLayoutEffect)(()=>{e&&f(!0)},[e]),(0,I.useEffect)(()=>{x()},[x]);let C=F(e,[d]);function w(){return JSON.stringify(r)!==JSON.stringify(o)}async function D(){if(!(!e||!w())){h(!0);try{let i=Object.keys(r).length>0?r:void 0;if(i){let e=await _();c(i,Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.map(e=>e.id)])))}await y(e,{modelAliases:i??null}),s(r),t&&await t(),await x(),n(`/`)}catch(e){b({title:`Error`,description:e instanceof Error?e.message:`Failed to save model aliases`,variant:`destructive`})}finally{h(!1)}}}return e?(0,R.jsx)(O,{loading:C,children:(0,R.jsxs)(S,{className:`shrink-0`,children:[(0,R.jsx)(M,{title:`Model Aliases`,description:`Map short names (fast, local, cheap, smart) to enabled models. Subagents can reference these aliases in AGENT.md. Set Cheap to enable Orchestrate mode.`,action:(0,R.jsx)(g,{onClick:()=>void D(),disabled:p||d,children:p?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`}),sticky:!1}),(0,R.jsx)(E,{className:`max-w-none pt-6`,children:(0,R.jsx)(V,{value:r,onChange:a,enabledModels:l,disabled:d||p})})]})}):(0,R.jsx)(T,{title:`No project selected`,children:`Please select a project from the sidebar to configure model aliases.`})}export{G as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Dt as a,ot as o}from"./dist-BWuYHVi8.js";import{Et as s,Gt as c}from"./dist-DIjomljy.js";import{t as l}from"./utils-CT-Dw22R.js";import{t as u}from"./button-DeNw35VZ.js";import{Bn as d,In as f,Lr as p,yt as m,zn as h}from"./api-BMo_Lz8f.js";import{t as g}from"./use-toast-xpb5jNtN.js";import{An as ee,Bn as te,Dn as _,Fn as ne,Ft as re,In as ie,Ln as ae,Nn as oe,Pt as se,Y as ce,i as le,kn as ue,s as v,vt as de}from"./index-DjaVbFDB.js";import{i as fe}from"./commit-method-fields-CD3PTIox.js";import{a as pe,n as y,r as me,t as b}from"./context-menu-Dx5Jy21w.js";import{t as he}from"./use-settings-page-loading-BTySlInF.js";var x=t(),S=e(n(),1),C=r();function ge(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`The selected file is not a readable image.`)),r.src=e})}async function _e(e,t){if(!e){t.setLoading(!1);return}t.setLoading(!0);try{let n=await m(e);t.setProjectPath(n.projectPath??null),t.setName(n.name??``),t.setValue(n.setupScript??``),t.setValidationScript(n.validationScript??``),t.setRunCmd(n.runCommand??``),t.setCommitMethod(n.commitMethod??a.PullRequest),t.setAllowAllCommands(n.allowAllCommands!==!1),t.setAllowedCommandPatterns(n.allowedCommandPatterns??[]),t.setUseBuiltInBrowser(n.useBuiltInBrowser!==!1),t.setProjectIcon(n.projectIcon??null),t.setOriginalName(n.name??``),t.setOriginalAllowAllCommands(n.allowAllCommands!==!1),t.setOriginalAllowedCommandPatterns(n.allowedCommandPatterns??[]),t.setOriginalUseBuiltInBrowser(n.useBuiltInBrowser!==!1),t.setOriginalProjectIcon(n.projectIcon??null)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{t.setLoading(!1)}}async function w(e,t){try{let n=await ge(e),r=document.createElement(`canvas`);r.width=256,r.height=256;let i=r.getContext(`2d`);if(!i)throw Error(`Could not prepare image conversion`);i.imageSmoothingEnabled=!0,i.imageSmoothingQuality=`high`;let a=Math.max(256/n.naturalWidth,256/n.naturalHeight),o=n.naturalWidth*a,s=n.naturalHeight*a;i.drawImage(n,(256-o)/2,(256-s)/2,o,s),t(r.toDataURL(`image/png`))}catch(e){g({title:`Could not use image`,description:e instanceof Error?e.message:`The selected file could not be read.`,variant:`destructive`})}}async function ve(e,t){let n=e.target.files?.[0];if(e.target.value=``,!n)return;let r=URL.createObjectURL(n);try{await w(r,t)}finally{URL.revokeObjectURL(r)}}async function ye(e,t,n){n(!0);try{let n=await f(e);n.runCommand?(t(n.runCommand),g({title:`Success`,description:`Suggested: ${n.runCommand}`})):g({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{n(!1)}}async function T(e,t,n){t!==n&&await d(e,t)}async function be(e,t,n,r,i){await h(e,{setupScript:t.trim()||null,validationScript:n.trim()||null,runCommand:r.trim()||null,commitMethod:i})}async function xe(e,t,n,r,i){(t!==r||JSON.stringify(n)!==JSON.stringify(i))&&await h(e,{allowAllCommands:t,allowedCommandPatterns:n})}async function Se(e,t,n){t!==n&&await h(e,{useBuiltInBrowser:t})}async function E(e,t,n){t!==n&&await h(e,{projectIcon:t})}async function Ce(e,t,n,r,i,a){n.setSaving(!0);try{await T(e,t.name,t.originalName),await be(e,t.value,t.validationScript,t.runCmd,t.commitMethod),await xe(e,t.allowAllCommands,t.allowedCommandPatterns,t.originalAllowAllCommands,t.originalAllowedCommandPatterns),await Se(e,t.useBuiltInBrowser,t.originalUseBuiltInBrowser),await E(e,t.projectIcon,t.originalProjectIcon),n.setOriginalName(t.name),n.setOriginalAllowAllCommands(t.allowAllCommands),n.setOriginalAllowedCommandPatterns(t.allowedCommandPatterns),n.setOriginalUseBuiltInBrowser(t.useBuiltInBrowser),n.setOriginalProjectIcon(t.projectIcon),r&&await r(),await a(),i(`/`)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{n.setSaving(!1)}}function we(e){let t=(0,x.c)(10),{allowAllCommands:n,patterns:r,disabled:i,onRemove:a}=e;if(n||r.length===0)return null;let s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,C.jsx)(se,{children:`Allowed command patterns`}),t[0]=s):s=t[0];let c;if(t[1]!==i||t[2]!==a||t[3]!==r){let e;t[5]!==i||t[6]!==a?(e=e=>(0,C.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,C.jsx)(`code`,{className:l(o.mono,o.bodyMuted),children:e}),(0,C.jsx)(u,{type:`button`,variant:`ghost`,size:`sm`,disabled:i,onClick:()=>a(e),children:`Remove`})]},e),t[5]=i,t[6]=a,t[7]=e):e=t[7],c=r.map(e),t[1]=i,t[2]=a,t[3]=r,t[4]=c}else c=t[4];let d;return t[8]===c?d=t[9]:(d=(0,C.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[s,(0,C.jsx)(`ul`,{className:`space-y-1`,children:c})]}),t[8]=c,t[9]=d),d}function Te(e){let t=(0,x.c)(21),{projectIcon:n,disabled:r,inputRef:i,onFileChange:a,onButtonClick:o,onRemove:s}=e,l;t[0]!==r||t[1]!==i||t[2]!==a?(l=(0,C.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,className:`sr-only`,onChange:a,disabled:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=l):l=t[3];let u=n?`Change project icon`:`Choose project icon`,d;t[4]===n?d=t[5]:(d=n?(0,C.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`}):(0,C.jsx)(c,{className:`h-4 w-4 text-muted-foreground`,strokeWidth:1.5}),t[4]=n,t[5]=d);let f;t[6]!==r||t[7]!==o||t[8]!==u||t[9]!==d?(f=(0,C.jsx)(pe,{asChild:!0,children:(0,C.jsx)(`button`,{type:`button`,className:`flex h-8 w-8 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/40 outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:o,disabled:r,"aria-label":u,children:d})}),t[6]=r,t[7]=o,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==r||t[12]!==s||t[13]!==n?(p=n&&(0,C.jsx)(y,{children:(0,C.jsx)(me,{disabled:r,onSelect:s,children:`Remove`})}),t[11]=r,t[12]=s,t[13]=n,t[14]=p):p=t[14];let m;t[15]!==f||t[16]!==p?(m=(0,C.jsxs)(b,{children:[f,p]}),t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;return t[18]!==l||t[19]!==m?(h=(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,m]}),t[18]=l,t[19]=m,t[20]=h):h=t[20],h}function Ee(e){let t=(0,x.c)(6),{saving:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=n?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`,t[0]=n,t[1]=a);let o;return t[2]!==r||t[3]!==i||t[4]!==a?(o=(0,C.jsx)(u,{onClick:i,disabled:r,children:a}),t[2]=r,t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function De(e,t,n){let r=(0,x.c)(13),i;r[0]===e?i=r[1]:(i=function(t){return w(t,e)},r[0]=e,r[1]=i);let a=i,o,s;r[2]===a?(o=r[3],s=r[4]):(o=()=>{if(!p())return;let e=function(e){let t=e.detail.dataUrl;a(t)};return window.addEventListener(`tarsk:project-icon-selected`,e),()=>{window.removeEventListener(`tarsk:project-icon-selected`,e)}},s=[a],r[2]=a,r[3]=o,r[4]=s),(0,S.useEffect)(o,s);let c;r[5]===e?c=r[6]:(c=function(t){return ve(t,e)},r[5]=e,r[6]=c);let l=c,u;r[7]!==n||r[8]!==t?(u=function(){p()&&t?v(t):n.current?.click()},r[7]=n,r[8]=t,r[9]=u):u=r[9];let d=u,f;return r[10]!==d||r[11]!==l?(f={handleProjectIconChange:l,handleProjectIconButtonClick:d},r[10]=d,r[11]=l,r[12]=f):f=r[12],f}function Oe(e){let t=(0,x.c)(117),{projectId:n,onProjectUpdated:r}=e,c=i(),d=le(),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(``),[g,se]=(0,S.useState)(``),[v,pe]=(0,S.useState)(a.PullRequest),[y,me]=(0,S.useState)(``),[b,ge]=(0,S.useState)(!1),[w,ve]=(0,S.useState)(!1),[T,be]=(0,S.useState)(!0),[xe,Se]=(0,S.useState)(``),[E,Oe]=(0,S.useState)(!0),D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[0]=D):D=t[0];let[O,ke]=(0,S.useState)(D),[Ae,je]=(0,S.useState)(!0),Me;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(Me=[],t[1]=Me):Me=t[1];let[Ne,Pe]=(0,S.useState)(Me),[k,Fe]=(0,S.useState)(!0),[Ie,Le]=(0,S.useState)(!0),[A,Re]=(0,S.useState)(null),[ze,Be]=(0,S.useState)(null),[Ve,He]=(0,S.useState)(null),Ue=(0,S.useRef)(null),We;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(We={setProjectPath:He,setName:p,setValue:h,setRunCmd:se,setCommitMethod:pe,setValidationScript:me,setAllowAllCommands:Oe,setAllowedCommandPatterns:ke,setUseBuiltInBrowser:Fe,setProjectIcon:Re,setOriginalName:Se,setOriginalAllowAllCommands:je,setOriginalAllowedCommandPatterns:Pe,setOriginalUseBuiltInBrowser:Le,setOriginalProjectIcon:Be,setLoading:be,setSaving:ge},t[2]=We):We=t[2];let Ge=We,Ke;t[3]===n?Ke=t[4]:(Ke=()=>_e(n,Ge),t[3]=n,t[4]=Ke);let j=Ke,qe,M;t[5]===n?(qe=t[6],M=t[7]):(qe=()=>{n&&be(!0)},M=[n],t[5]=n,t[6]=qe,t[7]=M),(0,S.useLayoutEffect)(qe,M);let Je,Ye;t[8]===j?(Je=t[9],Ye=t[10]):(Je=()=>{j()},Ye=[j],t[8]=j,t[9]=Je,t[10]=Ye),(0,S.useEffect)(Je,Ye);let Xe;t[11]===T?Xe=t[12]:(Xe=[T],t[11]=T,t[12]=Xe);let Ze=he(n,Xe),Qe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=function(e){pe(e)},t[13]=Qe):Qe=t[13];let $e=Qe,{handleProjectIconChange:et,handleProjectIconButtonClick:tt}=De(Re,Ve,Ue),nt;t[14]===n?nt=t[15]:(nt=async()=>{n&&await ye(n,se,ve)},t[14]=n,t[15]=nt);let rt=nt,it;t[16]!==E||t[17]!==O||t[18]!==v||t[19]!==j||t[20]!==f||t[21]!==c||t[22]!==r||t[23]!==Ae||t[24]!==Ne||t[25]!==xe||t[26]!==ze||t[27]!==Ie||t[28]!==A||t[29]!==n||t[30]!==g||t[31]!==k||t[32]!==y||t[33]!==m?(it=async()=>{n&&await Ce(n,{name:f,value:m,runCmd:g,commitMethod:v,validationScript:y,allowAllCommands:E,allowedCommandPatterns:O,useBuiltInBrowser:k,projectIcon:A,originalName:xe,originalAllowAllCommands:Ae,originalAllowedCommandPatterns:Ne,originalUseBuiltInBrowser:Ie,originalProjectIcon:ze},Ge,r,c,j)},t[16]=E,t[17]=O,t[18]=v,t[19]=j,t[20]=f,t[21]=c,t[22]=r,t[23]=Ae,t[24]=Ne,t[25]=xe,t[26]=ze,t[27]=Ie,t[28]=A,t[29]=n,t[30]=g,t[31]=k,t[32]=y,t[33]=m,t[34]=it):it=t[34];let at=it,N=T||b,ot=T||w;if(!n){let e;return t[35]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,C.jsx)(ie,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`}),t[35]=e):e=t[35],e}let P;t[36]!==N||t[37]!==at||t[38]!==b?(P=(0,C.jsx)(ue,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,C.jsx)(Ee,{saving:b,disabled:N,onClick:at}),sticky:!1}),t[36]=N,t[37]=at,t[38]=b,t[39]=P):P=t[39];let st;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(st=e=>p(e.target.value),t[40]=st):st=t[40];let F;t[41]!==T||t[42]!==f?(F=(0,C.jsx)(_,{title:`Project Name`,children:(0,C.jsx)(re,{id:`projectName`,value:f,onChange:st,placeholder:`Enter project name`,disabled:T})}),t[41]=T,t[42]=f,t[43]=F):F=t[43];let ct;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>h(e.target.value),t[44]=ct):ct=t[44];let I;t[45]!==T||t[46]!==m?(I=(0,C.jsx)(_,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,C.jsx)(ce,{id:`setupScript`,value:m,onChange:ct,placeholder:`e.g. npm install`,className:`font-mono min-h-[80px] resize-none`,disabled:T})}),t[45]=T,t[46]=m,t[47]=I):I=t[47];let lt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(lt=e=>me(e.target.value),t[48]=lt):lt=t[48];let L;t[49]!==T||t[50]!==y?(L=(0,C.jsx)(_,{title:`Validation Script`,description:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`,children:(0,C.jsx)(ce,{id:`validationScript`,value:y,onChange:lt,placeholder:`e.g. npm run lint && npm test`,className:`font-mono min-h-[80px] resize-none`,disabled:T})}),t[49]=T,t[50]=y,t[51]=L):L=t[51];let ut;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>se(e.target.value),t[52]=ut):ut=t[52];let R;t[53]!==T||t[54]!==g?(R=(0,C.jsx)(re,{id:`runCommand`,value:g,onChange:ut,placeholder:`e.g. npm run dev`,className:`font-mono pr-28`,disabled:T}),t[53]=T,t[54]=g,t[55]=R):R=t[55];let z;t[56]===w?z=t[57]:(z=w?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):`Suggest`,t[56]=w,t[57]=z);let B;t[58]!==rt||t[59]!==ot||t[60]!==z?(B=(0,C.jsx)(u,{variant:`ghost`,size:`sm`,className:`absolute right-1 top-1 h-8`,onClick:rt,disabled:ot,children:z}),t[58]=rt,t[59]=ot,t[60]=z,t[61]=B):B=t[61];let V;t[62]!==R||t[63]!==B?(V=(0,C.jsx)(_,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,children:(0,C.jsxs)(`div`,{className:`relative`,children:[R,B]})}),t[62]=R,t[63]=B,t[64]=V):V=t[64];let dt=v===a.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,H;t[65]!==v||t[66]!==T?(H=(0,C.jsx)(fe,{commitMethod:v,onCommitMethodChange:$e,disabled:T}),t[65]=v,t[66]=T,t[67]=H):H=t[67];let U;t[68]!==dt||t[69]!==H?(U=(0,C.jsx)(_,{title:`Commit Method`,description:dt,controlLayout:`row-end`,action:H}),t[68]=dt,t[69]=H,t[70]=U):U=t[70];let ft=!E,pt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(pt=e=>Oe(!e),t[71]=pt):pt=t[71];let W;t[72]!==T||t[73]!==ft?(W=(0,C.jsx)(de,{value:ft,onChange:pt,disabled:T,ariaLabel:`Confirm Commands`}),t[72]=T,t[73]=ft,t[74]=W):W=t[74];let G;t[75]!==E||t[76]!==O||t[77]!==N?(G=!E&&O.length>0&&(0,C.jsx)(we,{allowAllCommands:E,patterns:O,disabled:N,onRemove:e=>ke(t=>t.filter(t=>t!==e))}),t[75]=E,t[76]=O,t[77]=N,t[78]=G):G=t[78];let K;t[79]!==W||t[80]!==G?(K=(0,C.jsx)(_,{title:`Confirm Commands`,description:`When enabled, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,controlLayout:`row-end`,action:W,children:G}),t[79]=W,t[80]=G,t[81]=K):K=t[81];let q;t[82]!==N||t[83]!==k?(q=(0,C.jsx)(_,{title:`Built-in Browser`,description:`When enabled, Tarsk shows the Browser tab and opens detected dev URLs in the app. When disabled, the tab is hidden and URLs open in your system browser.`,controlLayout:`row-end`,action:(0,C.jsx)(de,{value:k,onChange:Fe,disabled:N,ariaLabel:`Built-in Browser`})}),t[82]=N,t[83]=k,t[84]=q):q=t[84];let mt;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(mt=()=>Re(null),t[85]=mt):mt=t[85];let J;t[86]!==N||t[87]!==tt||t[88]!==et||t[89]!==A?(J=(0,C.jsx)(_,{title:`Project Icon`,description:`Choose an image to use for this project on the Projects page. It will be center-cropped to a 256×256 PNG.`,controlLayout:`row-end`,action:(0,C.jsx)(Te,{projectIcon:A,disabled:N,inputRef:Ue,onFileChange:et,onButtonClick:tt,onRemove:mt})}),t[86]=N,t[87]=tt,t[88]=et,t[89]=A,t[90]=J):J=t[90];let Y;t[91]!==F||t[92]!==I||t[93]!==L||t[94]!==V||t[95]!==U||t[96]!==K||t[97]!==q||t[98]!==J?(Y=(0,C.jsx)(ae,{className:`max-w-none pt-6`,children:(0,C.jsxs)(ne,{children:[F,I,L,V,U,K,q,J]})}),t[91]=F,t[92]=I,t[93]=L,t[94]=V,t[95]=U,t[96]=K,t[97]=q,t[98]=J,t[99]=Y):Y=t[99];let X;t[100]!==P||t[101]!==Y?(X=(0,C.jsxs)(te,{className:`shrink-0`,children:[P,Y]}),t[100]=P,t[101]=Y,t[102]=X):X=t[102];let ht;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,C.jsx)(ee,{title:`Delete Project`}),t[103]=ht):ht=t[103];let gt;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,C.jsx)(`div`,{className:`min-w-0`,children:(0,C.jsx)(`p`,{className:l(o.bodyMuted),children:`Permanently removes the project, its threads, and all associated storage. This action cannot be undone.`})}),t[104]=gt):gt=t[104];let Z;t[105]!==f||t[106]!==n||t[107]!==d?(Z=()=>{n&&d({id:n,name:f})},t[105]=f,t[106]=n,t[107]=d,t[108]=Z):Z=t[108];let Q;t[109]!==N||t[110]!==Z?(Q=(0,C.jsxs)(te,{className:`shrink-0 rounded-none border-t border-table-border pt-6 mt-8`,children:[ht,(0,C.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[gt,(0,C.jsx)(u,{type:`button`,variant:`destructive`,disabled:N,onClick:Z,children:`Delete Project`})]})]}),t[109]=N,t[110]=Z,t[111]=Q):Q=t[111];let $;return t[112]!==Ze||t[113]!==n||t[114]!==X||t[115]!==Q?($=(0,C.jsxs)(oe,{loading:Ze,children:[X,Q]},n),t[112]=Ze,t[113]=n,t[114]=X,t[115]=Q,t[116]=$):$=t[116],$}export{Oe as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{X as a,ot as o}from"./dist-BWuYHVi8.js";import{Et as s}from"./dist-DIjomljy.js";import{t as c}from"./utils-CT-Dw22R.js";import{t as l}from"./button-DeNw35VZ.js";import{yt as u,zn as d}from"./api-BMo_Lz8f.js";import{t as f}from"./use-toast-xpb5jNtN.js";import{Bn as p,Dn as m,In as h,Ln as g,Nn as _,kn as v,vt as y}from"./index-DjaVbFDB.js";import{t as b}from"./use-settings-page-loading-BTySlInF.js";var x=e(n(),1),S=t(),C=r(),w=a(),T=Math.ceil(w.length/2),E=[w.slice(0,T),w.slice(T)];function D(e){let t=(0,S.c)(14),{tool:n,enabled:r,disabled:i,onToggle:a}=e,s;t[0]!==a||t[1]!==n.name?(s=e=>a(n.name,e),t[0]=a,t[1]=n.name,t[2]=s):s=t[2];let l;t[3]!==i||t[4]!==r||t[5]!==s||t[6]!==n.displayName?(l=(0,C.jsx)(y,{value:r,onChange:s,disabled:i,ariaLabel:n.displayName}),t[3]=i,t[4]=r,t[5]=s,t[6]=n.displayName,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=c(o.body,`truncate`),t[8]=u):u=t[8];let d;t[9]===n.displayName?d=t[10]:(d=(0,C.jsx)(`span`,{className:u,children:n.displayName}),t[9]=n.displayName,t[10]=d);let f;return t[11]!==l||t[12]!==d?(f=(0,C.jsxs)(`div`,{className:`grid min-h-10 grid-cols-[auto_minmax(0,1fr)] items-center gap-3 px-3 py-2`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13],f}function O(e){let t=(0,S.c)(13),{tools:n,disabledTools:r,disabled:i,forceEnabledTools:a,onToggle:o}=e,s;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==o||t[4]!==n){let e;t[6]!==i||t[7]!==r||t[8]!==a||t[9]!==o?(e=e=>(0,C.jsx)(D,{tool:e,enabled:!r.includes(e.name),disabled:i||a.has(e.name),onToggle:o},e.name),t[6]=i,t[7]=r,t[8]=a,t[9]=o,t[10]=e):e=t[10],s=n.map(e),t[0]=i,t[1]=r,t[2]=a,t[3]=o,t[4]=n,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,C.jsx)(`div`,{className:`divide-y divide-table-border`,children:s}),t[11]=s,t[12]=c),c}function k(e){let t=(0,S.c)(23),{disabledTools:n,onChange:r,disabled:i,forceEnabledTools:a}=e,o=i===void 0?!1:i,s;t[0]===a?s=t[1]:(s=new Set((a??[]).map(A)),t[0]=a,t[1]=s);let c=s,l;t[2]!==n||t[3]!==c||t[4]!==r?(l=function(e,t){let i=e.toLowerCase();if(!(c.has(i)&&!t)){if(t){r(n.filter(e=>e!==i));return}n.includes(i)||r([...n,i].sort())}},t[2]=n,t[3]=c,t[4]=r,t[5]=l):l=t[5];let u=l,d;t[6]!==o||t[7]!==n||t[8]!==c||t[9]!==u?(d=w.map(e=>(0,C.jsx)(D,{tool:e,enabled:!n.includes(e.name),disabled:o||c.has(e.name),onToggle:u},e.name)),t[6]=o,t[7]=n,t[8]=c,t[9]=u,t[10]=d):d=t[10];let f;t[11]===d?f=t[12]:(f=(0,C.jsx)(`div`,{className:`divide-y divide-table-border @md/settings-page:hidden`,children:d}),t[11]=d,t[12]=f);let p;t[13]!==o||t[14]!==n||t[15]!==c||t[16]!==u?(p=E.map((e,t)=>(0,C.jsx)(O,{tools:e,disabledTools:n,disabled:o,forceEnabledTools:c,onToggle:u},t)),t[13]=o,t[14]=n,t[15]=c,t[16]=u,t[17]=p):p=t[17];let m;t[18]===p?m=t[19]:(m=(0,C.jsx)(`div`,{className:`hidden @md/settings-page:grid @md/settings-page:grid-cols-2 divide-x divide-table-border`,children:p}),t[18]=p,t[19]=m);let h;return t[20]!==f||t[21]!==m?(h=(0,C.jsxs)(C.Fragment,{children:[f,m]}),t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function A(e){return e.toLowerCase()}function j({projectId:e,onProjectUpdated:t}){let n=i(),[r,a]=(0,x.useState)([]),[o,c]=(0,x.useState)([]),[S,w]=(0,x.useState)(!1),[T,E]=(0,x.useState)(!1),[D,O]=(0,x.useState)(!0),[A,j]=(0,x.useState)(!1),M=(0,x.useCallback)(async()=>{if(!e){O(!1);return}O(!0);try{let t=await u(e),n=t.disabledTools??[],r=t.smartJsEnabled===!0;a(n),c(n),w(r),E(r)}catch(e){f({title:`Error`,description:e instanceof Error?e.message:`Failed to load tools settings`,variant:`destructive`})}finally{O(!1)}},[e]);(0,x.useLayoutEffect)(()=>{e&&O(!0)},[e]),(0,x.useEffect)(()=>{M()},[M]);let N=b(e,[D]);function P(){return JSON.stringify([...r].sort())!==JSON.stringify([...o].sort())}function F(){return P()||S!==T}async function I(){if(!(!e||!F())){j(!0);try{let i={};P()&&(i.disabledTools=r.length>0?r:null),S!==T&&(i.smartJsEnabled=S),await d(e,i),c(r),E(S),t&&await t(),await M(),n(`/`)}catch(e){f({title:`Error`,description:e instanceof Error?e.message:`Failed to save tools settings`,variant:`destructive`})}finally{j(!1)}}}function L(e){w(e),e&&a(e=>e.filter(e=>e!==`run_js`))}return e?(0,C.jsx)(_,{loading:N,children:(0,C.jsxs)(p,{className:`shrink-0`,children:[(0,C.jsx)(v,{title:`Tools`,description:`Control which tools the agent can use in this project. Disabled tools are hidden from the agent.`,action:(0,C.jsx)(l,{onClick:()=>void I(),disabled:A||D,children:A?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`}),sticky:!1}),(0,C.jsxs)(g,{className:`max-w-none pt-6`,children:[(0,C.jsx)(m,{title:`Smart JS`,description:`When enabled, the agent orchestrates tools by writing JavaScript for Run JS (except Ask, Write, and Subagent). Other tools stay available through callTool inside the worker.`,controlLayout:`row-end`,action:(0,C.jsx)(y,{value:S,onChange:L,disabled:D||A,ariaLabel:`Smart JS`})}),(0,C.jsx)(`div`,{className:`mt-8`,children:(0,C.jsx)(k,{disabledTools:r,onChange:a,disabled:D||A,forceEnabledTools:S?[`run_js`]:void 0})})]})]})}):(0,C.jsx)(h,{title:`No project selected`,children:`Please select a project from the sidebar to configure tools.`})}export{j as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{c as i,s as a}from"./chunk-QFMPRPBF-COsSkB7x.js";import{G as o,S as s,at as c,ot as l}from"./dist-BWuYHVi8.js";import{Q as u,n as d}from"./store-BaMSfYoJ.js";import{$ as f,Et as p,Mt as m,On as h,ln as g,q as _,un as v,y}from"./dist-DIjomljy.js";import{n as b,o as x,t as S}from"./utils-CT-Dw22R.js";import{t as C}from"./button-DeNw35VZ.js";import{B as ee,Et as te,G as w,L as T,R as E,V as ne,W as re,an as ie,kt as ae,tt as D,vn as oe,yn as se}from"./api-BMo_Lz8f.js";import{i as ce,n as O,r as k,t as A}from"./tooltip-B6ziVyTv.js";import{n as le}from"./async-loading-fallback-B_JNgWJR.js";import{t as j}from"./suspense-resource-DnYnmTbs.js";import{t as M}from"./use-suspense-resource-Dkz6ddFN.js";import{Bn as ue,Ct as N,Et as P,Fn as F,Ft as I,I as de,In as fe,L as pe,Ln as L,On as R,Pn as z,R as B,St as me,bt as V,kn as H,o as he,pn as ge,z as U}from"./index-DjaVbFDB.js";import{t as W}from"./async-error-boundary-J8P6NVvc.js";import{t as G}from"./sorting-DqwxPMRN.js";import{t as _e}from"./pending-changes-Bn-0ak1d.js";import{o as K}from"./settings-list-DU82HNPX.js";import{t as q}from"./use-deferred-search-Dgxosq55.js";import{n as J,r as Y,t as X}from"./model-list-controls-D86_87E4.js";var Z=t(),Q=e(n(),1),$=r(),ve=x(S(l.compact,`inline-flex items-center rounded-full border px-2.5 py-0.5 font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`),{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function ye(e){let t=(0,Z.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,variant:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]!==n||t[5]!==i?(a=S(ve({variant:i}),n),t[4]=n,t[5]=i,t[6]=a):a=t[6];let o;return t[7]!==r||t[8]!==a?(o=(0,$.jsx)(`div`,{className:a,...r}),t[7]=r,t[8]=a,t[9]=o):o=t[9],o}var be=s(`app.use-provider-details.hook`);function xe(e,t,n){return n?e.find(e=>e.slug===n)??null:t?e.find(e=>e.name===t)??null:null}function Se({selectedProviderName:e=null,selectedProviderSlug:t=null,providerData:n}){let r=d(),[i,a]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(``),[l,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)([]),[y,b]=(0,Q.useState)(new Set),[x,S]=(0,Q.useState)(new Set),[C,D]=(0,Q.useState)(new Map),{query:ce,setQuery:O,deferredQuery:k}=q(),[A,le]=(0,Q.useState)(`alphabetical`),[j,M]=(0,Q.useState)(`all`),[ue,N]=(0,Q.useState)(!1),[P,F]=(0,Q.useState)(``),[I,de]=(0,Q.useState)(``),[fe,pe]=(0,Q.useState)(``),[L,R]=(0,Q.useState)(`coding`),[z,B]=(0,Q.useState)([]),[V,H]=(0,Q.useState)(new Set),[he,U]=(0,Q.useState)(new Set),[W,K]=(0,Q.useState)(new Map),[J,Y]=(0,Q.useState)({}),X=e=>ge(e.id);(0,Q.useEffect)(()=>{(async()=>{if(g(``),n&&(t&&n.slug===t||e&&n.name===e)){a(n),pe(n.apiKey??``),c(n.apiKey??``),Y(n.envValues??{}),ye(n.slug),Z(n.slug);return}try{let n=xe(await ae(),e,t);a(n),pe(n?.apiKey??``),c(n?.apiKey??``),Y(n?.envValues??{}),n&&(ye(n.slug),Z(n.slug))}catch(e){g(e instanceof Error?e.message:`Failed to load providers`)}})()},[e,t,n]);let Z=async e=>{m(null);try{let t=await te(e);t.status===`success`&&m(t.balance)}catch(t){be.error(`Failed to load balance for ${e}:`,t)}};function $(){v([]),B([]),b(new Set),S(new Set),H(new Set),U(new Set),D(new Map),K(new Map)}function ve(e){return e instanceof Error?e.message:`Failed to load models from local API`}let ye=async e=>{f(!0),de(``),O(``),le(`alphabetical`),M(`all`),R(`coding`);try{let[t,n]=await Promise.all([w(e),re(e)]);v(t.models),B(n.models);let r=new Set(t.enabledModelIds);b(r),S(r);let i=new Set(n.enabledModelIds);H(i),U(i),D(new Map),K(new Map)}catch(t){be.error(`Failed to load models for ${e}:`,t),$(),de(ve(t))}finally{f(!1)}};async function Se(e){f(!0),de(``);try{await ie(e),await ye(e),r({type:u.ConfigUpdated})}catch(t){be.error(`Failed to refresh models for ${e}:`,t),$(),de(ve(t)),f(!1)}}let Ce=(e,t)=>{i?.name===e&&(c(t),Te(t))},we=(e,t)=>{Y(n=>({...n,[e]:t})),i&&(async()=>{try{await oe({[e]:t}),r({type:u.ConfigUpdated}),F(`${me(e)} saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save provider settings`);return}o(i.slug)&&e===`LOCAL_API_URL`&&t.trim()&&await Se(i.slug)})()},Te=async e=>{if(!(!i||e===fe))try{await se(i.slug,e),r({type:u.ConfigUpdated}),pe(e),F(`API key saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save API key`)}},Ee=(e,t)=>{t===`image`?K(t=>{let n=new Map(t),r=V.has(e),i=n.has(e),a=n.get(e),o=!(i?a:r);return o===r?n.delete(e):n.set(e,o),De(e,(n.has(e)?n.get(e):r)??!1,`image`),n}):D(t=>{let n=_e(t,e,y);return De(e,(n.has(e)?n.get(e):y.has(e))??!1,`coding`),n})},De=async(e,t,n=`coding`)=>{if(i)try{n===`image`?(t?(await ee(i.slug,e),H(t=>new Set([...t,e]))):(await T(i.slug,e),H(t=>{let n=new Set(t);return n.delete(e),n})),K(t=>{let n=new Map(t);return n.delete(e),n})):(t?(await ne(i.slug,e),b(t=>new Set([...t,e]))):(await E(i.slug,e),b(t=>{let n=new Set(t);return n.delete(e),n})),D(t=>{let n=new Map(t);return n.delete(e),n})),r({type:u.ConfigUpdated}),F(`Model preferences saved successfully`),setTimeout(()=>F(``),3e3)}catch(e){F(e instanceof Error?e.message:`Failed to save model changes`)}};async function Oe(e,t=`coding`){let n=t===`image`?z:_,r=t===`image`?V:y;(t===`image`?K:D)(t=>{let i=new Map(t);for(let t of n)r.has(t.id)===e?i.delete(t.id):i.set(t.id,e);return i});for(let i of n)r.has(i.id)!==e&&await De(i.id,e,t)}let ke=s!==void 0&&s.trim().length>0;return{selectedProvider:i,error:h,balance:p,displayApiKey:s,showApiKey:ue,setShowApiKey:N,providerEnvValues:J,modelsLoading:l,modelsError:I,saveStatus:P,modelTab:L,setModelTab:R,modelSearchQuery:ce,setModelSearchQuery:O,modelSortBy:A,setModelSortBy:le,modelFilter:j,setModelFilter:M,availableModels:_,enabledModelIds:y,pendingChanges:C,filteredAndSortedModels:(0,Q.useMemo)(()=>G({models:_,query:k,sortBy:A,getDisplayName:X,freeOnly:j===`free`,groupByProvider:!0,getPriority:e=>+!x.has(e.id)}),[_,k,j,x,A,X]),availableImageModels:z,enabledImageModelIds:V,pendingImageChanges:W,filteredAndSortedImageModels:(0,Q.useMemo)(()=>G({models:z,query:k,sortBy:A===`coding-index`||A===`intelligence-by-price`?`alphabetical`:A,getDisplayName:X,freeOnly:j===`free`,groupByProvider:!0,getPriority:e=>+!he.has(e.id)}),[z,k,j,he,A,X]),hasApiKey:ke,getModelDisplayName:X,handleUpdateKeyLocal:Ce,handleUpdateProviderEnv:we,refreshLocalProviderModels:Se,handleToggleModel:Ee,handleToggleAllModels:Oe}}function Ce(e){let t=(0,Z.c)(7),{provider:n,onBack:r}=e;if(!r&&!n.url)return null;let i;t[0]===n.url?i=t[1]:(i=n.url?(0,$.jsx)(V,{url:n.url,className:S(l.compact,`p-3`)}):null,t[0]=n.url,t[1]=i);let a;t[2]===r?a=t[3]:(a=r?(0,$.jsxs)(C,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:r,children:[(0,$.jsx)(y,{className:`h-4 w-4`}),(0,$.jsx)(`span`,{className:`sr-only`,children:`Close provider details`})]}):null,t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function we(e){let t=(0,Z.c)(6),{balance:n}=e;if(n===null)return null;let r,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=S(l.compact,`inline-flex shrink-0 items-center gap-1.5 font-medium`),i=(0,$.jsx)(`div`,{className:`h-1.5 w-1.5 rounded-full bg-green-500`}),t[0]=r,t[1]=i):(r=t[0],i=t[1]);let a;t[2]===n?a=t[3]:(a=b(n),t[2]=n,t[3]=a);let o;return t[4]===a?o=t[5]:(o=(0,$.jsxs)(`span`,{className:r,children:[i,`$`,a,` balance`]}),t[4]=a,t[5]=o),o}function Te(e){let t=(0,Z.c)(8),{title:n,tooltip:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=S(l.label,`cursor-help`),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,$.jsx)(ce,{asChild:!0,children:(0,$.jsx)(`span`,{className:i,children:n})}),t[1]=n,t[2]=a);let o;t[3]===r?o=t[4]:(o=(0,$.jsx)(O,{children:r}),t[3]=r,t[4]=o);let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsx)(k,{children:(0,$.jsxs)(A,{children:[a,o]})}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}function Ee(e){let t=(0,Z.c)(10),{provider:n,displayApiKey:r,showApiKey:i,onToggleShowApiKey:a,onUpdateKey:s,providerEnvValues:c,onUpdateEnv:l,modelsLoading:u,onRefreshModels:d}=e,h;return t[0]!==r||t[1]!==u||t[2]!==d||t[3]!==a||t[4]!==l||t[5]!==s||t[6]!==n||t[7]!==c||t[8]!==i?(h=(0,$.jsx)($.Fragment,{children:n.authType===`APIKey`?(0,$.jsx)($.Fragment,{children:(0,$.jsxs)(F,{children:[(0,$.jsx)(z,{label:(0,$.jsx)(Te,{title:`API Key`,tooltip:`Your API key is stored locally and never shared.`}),control:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(m,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,$.jsx)(I,{type:i?`text`:`password`,placeholder:n.keyName||`Enter API Key`,className:`pl-10 pr-10`,value:r,onChange:e=>{s(n.name,e.target.value)}}),(0,$.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:a,disabled:!r,children:i?(0,$.jsx)(v,{className:`h-4 w-4 text-muted-foreground`}):(0,$.jsx)(g,{className:`h-4 w-4 text-muted-foreground`})})]})}),N(n).map(e=>(0,$.jsx)(z,{label:(0,$.jsx)(Te,{title:me(e),tooltip:e}),control:o(n.slug)&&e===`LOCAL_API_URL`?(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(I,{id:e,value:c[e]??``,onChange:t=>l(e,t.target.value),placeholder:n.api,className:`pr-10`,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),(0,$.jsx)(k,{children:(0,$.jsxs)(A,{children:[(0,$.jsx)(ce,{asChild:!0,children:(0,$.jsx)(C,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 -translate-y-1/2 h-8 w-8 p-0`,onClick:()=>{d(n.slug)},disabled:u,children:u?(0,$.jsx)(p,{className:`h-4 w-4 animate-spin text-muted-foreground`}):(0,$.jsx)(f,{className:`h-4 w-4 text-muted-foreground`})})}),(0,$.jsx)(O,{children:`Refresh models`})]})})]}):(0,$.jsx)(I,{id:e,value:c[e]??``,onChange:t=>l(e,t.target.value),placeholder:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`})},e))]})}):(0,$.jsxs)(`div`,{className:`space-y-2 text-center`,children:[(0,$.jsx)(R,{className:`mb-0`,children:`This provider uses OAuth for authentication.`}),(0,$.jsxs)(C,{variant:`outline`,size:`sm`,disabled:!0,children:[`Sign in with `,n.name]})]})}),t[0]=r,t[1]=u,t[2]=d,t[3]=a,t[4]=l,t[5]=s,t[6]=n,t[7]=c,t[8]=i,t[9]=h):h=t[9],h}function De(e){let t=(0,Z.c)(22),{tab:n,model:r,displayName:i,willBeEnabled:a,hasApiKey:o,showStarRating:s,onToggle:c}=e,u=r.pricing,d=n===`image`?`image-${r.id}`:r.id,f=r.id,p=!o&&`opacity-25`,m;t[0]===p?m=t[1]:(m=S(`flex cursor-default items-center space-x-3 p-3 transition-colors hover:bg-muted/30`,p),t[0]=p,t[1]=m);let h=!o,g=a??!1,_;t[2]!==r.id||t[3]!==c?(_=()=>c(r.id),t[2]=r.id,t[3]=c,t[4]=_):_=t[4];let v;t[5]!==d||t[6]!==h||t[7]!==g||t[8]!==_?(v=(0,$.jsx)(he,{id:d,disabled:h,checked:g,onCheckedChange:_,className:`mt-0`}),t[5]=d,t[6]=h,t[7]=g,t[8]=_,t[9]=v):v=t[9];let y;t[10]!==d||t[11]!==i||t[12]!==r.coding_index||t[13]!==u||t[14]!==s||t[15]!==n?(y=n===`coding`?(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:d,className:S(l.body,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:i})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[s&&(0,$.jsx)(Y,{codingIndex:r.coding_index,modelName:i}),u&&(0,$.jsx)(`span`,{className:S(l.caption,`whitespace-nowrap`),children:(u.prompt??0)===0&&(u.completion??0)===0?``:`$${b(u.prompt??0)} in | $${b(u.completion??0)} out`})]})]}):(0,$.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:(0,$.jsx)(`label`,{htmlFor:d,className:S(l.label,`leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate`),children:i})}),u&&(0,$.jsx)(`span`,{className:S(l.caption,`whitespace-nowrap flex-shrink-0`),children:(u.prompt??0)===0&&(u.completion??0)===0?``:`$${b(u.prompt??0)} in | $${b(u.completion??0)} out`})]}),t[10]=d,t[11]=i,t[12]=r.coding_index,t[13]=u,t[14]=s,t[15]=n,t[16]=y):y=t[16];let x;return t[17]!==r.id||t[18]!==m||t[19]!==v||t[20]!==y?(x=(0,$.jsxs)(`div`,{className:m,children:[v,y]},f),t[17]=r.id,t[18]=m,t[19]=v,t[20]=y,t[21]=x):x=t[21],x}function Oe(e){let t=(0,Z.c)(13),{tab:n,models:r,filteredModels:i,modelsLoading:a,modelsError:o,hasApiKey:s,enabledModelIds:u,pendingChanges:d,modelSortBy:f,getModelDisplayName:m,onToggleModel:h}=e,g=n===`coding`,_=g?o?`No models loaded.`:`No models available for this provider.`:`No image models available for this provider.`,v;return t[0]!==_||t[1]!==u||t[2]!==i||t[3]!==m||t[4]!==s||t[5]!==g||t[6]!==f||t[7]!==r||t[8]!==a||t[9]!==h||t[10]!==d||t[11]!==n?(v=(0,$.jsx)(`div`,{className:`flex flex-col gap-4`,children:a?(0,$.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,$.jsx)(p,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):r.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:l.bodyMuted,children:_})}):(0,$.jsx)(k,{children:(0,$.jsx)(`div`,{className:S(`grid grid-cols-1 gap-0`,c.tableWrapper),children:i.length===0?(0,$.jsx)(`div`,{className:`text-center py-8`,children:(0,$.jsx)(`p`,{className:l.bodyMuted,children:`No models matching your filters.`})}):i.map(e=>{let t=u.has(e.id),r=d.has(e.id),i=d.get(e.id),a=(r?i:t)??!1;return(0,$.jsx)(De,{tab:n,model:e,displayName:m(e),willBeEnabled:a,hasApiKey:s,showStarRating:g&&(f===`coding-index`||f===`intelligence-by-price`),onToggle:e=>h(e,n)},e.id)})})})}),t[0]=_,t[1]=u,t[2]=i,t[3]=m,t[4]=s,t[5]=g,t[6]=f,t[7]=r,t[8]=a,t[9]=h,t[10]=d,t[11]=n,t[12]=v):v=t[12],v}function ke(e){let t=(0,Z.c)(22),{tab:n,showImageTab:r,modelsLoading:i,models:a,hasApiKey:o,enabledModelIds:s,pendingChanges:c,modelSearchQuery:l,onModelSearchQueryChange:u,modelSortBy:d,onModelSortByChange:f,onToggleAllModels:p}=e,m=n===`coding`,h=m?`select-all-models`:`select-all-image-models`,g=!i&&a.length>0,v=g&&!o&&`opacity-25`,y;t[0]===v?y=t[1]:(y=S(`flex flex-col gap-2 md:flex-row md:items-center`,v),t[0]=v,t[1]=y);let b;t[2]===r?b=t[3]:(b=r?(0,$.jsxs)(B,{className:`w-fit shrink-0 self-start`,children:[(0,$.jsx)(U,{value:`coding`,children:`Coding`}),(0,$.jsx)(U,{value:`image`,children:`Image`})]}):null,t[2]=r,t[3]=b);let x;t[4]!==s||t[5]!==o||t[6]!==m||t[7]!==l||t[8]!==d||t[9]!==a||t[10]!==u||t[11]!==f||t[12]!==p||t[13]!==c||t[14]!==h||t[15]!==g||t[16]!==n?(x=g?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`relative w-full md:w-52 flex-shrink-0`,children:[(0,$.jsx)(_,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground pointer-events-none`}),(0,$.jsx)(I,{placeholder:`Search`,className:`pl-10 h-8`,value:l,onChange:e=>u(e.target.value),disabled:!o})]}),(0,$.jsxs)(`div`,{className:`flex flex-shrink-0 items-center gap-2 self-end md:ml-auto md:self-auto`,children:[(0,$.jsx)(X,{id:h,disabled:!o,checked:a.every(e=>{let t=c.has(e.id),n=c.get(e.id);return t?n:s.has(e.id)}),onChange:e=>{p(e,n)}}),(0,$.jsx)(J,{sortBy:d,showCodingIndex:m,showIntelligenceByPrice:m,onSortByChange:f})]})]}):null,t[4]=s,t[5]=o,t[6]=m,t[7]=l,t[8]=d,t[9]=a,t[10]=u,t[11]=f,t[12]=p,t[13]=c,t[14]=h,t[15]=g,t[16]=n,t[17]=x):x=t[17];let C;return t[18]!==y||t[19]!==b||t[20]!==x?(C=(0,$.jsxs)(`div`,{className:y,children:[b,x]}),t[18]=y,t[19]=b,t[20]=x,t[21]=C):C=t[21],C}function Ae(e){let t=(0,Z.c)(10),{title:n,description:r,action:i,tableHeader:a,children:o}=e,s;t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==n?(s=(0,$.jsx)(H,{title:n,description:r,action:i,sticky:!1,tableHeader:a}),t[0]=i,t[1]=r,t[2]=a,t[3]=n,t[4]=s):s=t[4];let c;t[5]===o?c=t[6]:(c=(0,$.jsx)(`div`,{className:`px-6 pb-6`,children:o}),t[5]=o,t[6]=c);let l;return t[7]!==s||t[8]!==c?(l=(0,$.jsxs)(ue,{className:`shrink-0`,children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function je(e){let t=(0,Z.c)(111),{selectedProviderName:n,selectedProviderSlug:r,providerData:i,onBack:a,className:o}=e,s=n===void 0?null:n,c=r===void 0?null:r,l;t[0]!==i||t[1]!==s||t[2]!==c?(l={selectedProviderName:s,selectedProviderSlug:c,providerData:i},t[0]=i,t[1]=s,t[2]=c,t[3]=l):l=t[3];let{selectedProvider:u,error:d,balance:f,displayApiKey:p,showApiKey:m,setShowApiKey:g,providerEnvValues:_,modelsLoading:v,modelsError:y,saveStatus:b,modelTab:x,setModelTab:ee,modelSearchQuery:te,setModelSearchQuery:w,modelSortBy:T,setModelSortBy:E,availableModels:ne,enabledModelIds:re,pendingChanges:ie,filteredAndSortedModels:ae,availableImageModels:D,enabledImageModelIds:oe,pendingImageChanges:se,filteredAndSortedImageModels:ce,hasApiKey:O,getModelDisplayName:k,handleUpdateKeyLocal:A,handleUpdateProviderEnv:le,refreshLocalProviderModels:j,handleToggleModel:M,handleToggleAllModels:ue}=Se(l);if(d){let e;t[4]===o?e=t[5]:(e=S(`flex h-full min-h-0 flex-col items-center justify-center gap-4 p-6`,o),t[4]=o,t[5]=e);let n;t[6]===d?n=t[7]:(n=(0,$.jsx)(R,{variant:`error`,className:`mb-0`,children:d}),t[6]=d,t[7]=n);let r;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsx)(C,{variant:`outline`,size:`sm`,onClick:Me,children:`Retry`}),t[8]=r):r=t[8];let i;return t[9]!==e||t[10]!==n?(i=(0,$.jsxs)(`div`,{className:e,children:[n,r]}),t[9]=e,t[10]=n,t[11]=i):i=t[11],i}if(!u){let e;t[12]===o?e=t[13]:(e=S(`flex h-full min-h-0 items-center justify-center`,o),t[12]=o,t[13]=e);let n=s||c?`Provider not found`:`Select a Provider`,r;t[14]===a?r=t[15]:(r=a?(0,$.jsxs)(C,{variant:`outline`,size:`sm`,onClick:a,children:[(0,$.jsx)(h,{className:`h-4 w-4 mr-1`}),`Back to Providers`]}):void 0,t[14]=a,t[15]=r);let i=a?`This provider could not be found.`:`Choose a provider from the list to configure its settings.`,l;t[16]!==n||t[17]!==r||t[18]!==i?(l=(0,$.jsx)(fe,{title:n,action:r,children:i}),t[16]=n,t[17]=r,t[18]=i,t[19]=l):l=t[19];let u;return t[20]!==e||t[21]!==l?(u=(0,$.jsx)(`div`,{className:e,children:l}),t[20]=e,t[21]=l,t[22]=u):u=t[22],u}let N;t[23]===o?N=t[24]:(N=S(`h-full min-h-0`,o),t[23]=o,t[24]=N);let P;t[25]!==a||t[26]!==u?(P=(0,$.jsx)(Ce,{provider:u,onBack:a}),t[25]=a,t[26]=u,t[27]=P):P=t[27];let F;t[28]!==g||t[29]!==m?(F=()=>g(!m),t[28]=g,t[29]=m,t[30]=F):F=t[30];let I;t[31]!==p||t[32]!==A||t[33]!==le||t[34]!==v||t[35]!==_||t[36]!==j||t[37]!==u||t[38]!==m||t[39]!==F?(I=(0,$.jsx)(`div`,{className:`pt-6`,children:(0,$.jsx)(Ee,{provider:u,displayApiKey:p,showApiKey:m,onToggleShowApiKey:F,onUpdateKey:A,providerEnvValues:_,onUpdateEnv:le,modelsLoading:v,onRefreshModels:j})}),t[31]=p,t[32]=A,t[33]=le,t[34]=v,t[35]=_,t[36]=j,t[37]=u,t[38]=m,t[39]=F,t[40]=I):I=t[40];let L;t[41]!==u.name||t[42]!==P||t[43]!==I?(L=(0,$.jsx)(Ae,{title:u.name,description:`Configure API keys and connection settings for this provider.`,action:P,children:I}),t[41]=u.name,t[42]=P,t[43]=I,t[44]=L):L=t[44];let z;t[45]!==w||t[46]!==E||t[47]!==ee?(z=e=>{ee(e),w(``),E(`alphabetical`)},t[45]=w,t[46]=E,t[47]=ee,t[48]=z):z=t[48];let B;t[49]===f?B=t[50]:(B=(0,$.jsx)(we,{balance:f}),t[49]=f,t[50]=B);let me;t[51]===u.name?me=t[52]:(me=u.name.toLowerCase(),t[51]=u.name,t[52]=me);let V=me===`openrouter`,H=x===`coding`?ne:D,he=x===`coding`?re:oe,ge=x===`coding`?ie:se,U;t[53]!==ue||t[54]!==O||t[55]!==te||t[56]!==T||t[57]!==x||t[58]!==v||t[59]!==w||t[60]!==E||t[61]!==V||t[62]!==H||t[63]!==he||t[64]!==ge?(U=(0,$.jsx)(ke,{tab:x,showImageTab:V,modelsLoading:v,models:H,hasApiKey:O,enabledModelIds:he,pendingChanges:ge,modelSearchQuery:te,onModelSearchQueryChange:w,modelSortBy:T,onModelSortByChange:E,onToggleAllModels:ue}),t[53]=ue,t[54]=O,t[55]=te,t[56]=T,t[57]=x,t[58]=v,t[59]=w,t[60]=E,t[61]=V,t[62]=H,t[63]=he,t[64]=ge,t[65]=U):U=t[65];let W;t[66]===y?W=t[67]:(W=y?(0,$.jsx)(R,{variant:`error`,className:`mb-4`,children:y}):null,t[66]=y,t[67]=W);let G;t[68]!==ne||t[69]!==re||t[70]!==ae||t[71]!==k||t[72]!==M||t[73]!==O||t[74]!==T||t[75]!==y||t[76]!==v||t[77]!==ie||t[78]!==u?(G=(0,$.jsx)(pe,{value:`coding`,children:(0,$.jsx)(Oe,{tab:`coding`,provider:u,models:ne,filteredModels:ae,modelsLoading:v,modelsError:y,hasApiKey:O,enabledModelIds:re,pendingChanges:ie,modelSortBy:T,getModelDisplayName:k,onToggleModel:M})}),t[68]=ne,t[69]=re,t[70]=ae,t[71]=k,t[72]=M,t[73]=O,t[74]=T,t[75]=y,t[76]=v,t[77]=ie,t[78]=u,t[79]=G):G=t[79];let _e;t[80]!==D||t[81]!==oe||t[82]!==ce||t[83]!==k||t[84]!==M||t[85]!==O||t[86]!==T||t[87]!==y||t[88]!==v||t[89]!==se||t[90]!==u?(_e=(0,$.jsx)(pe,{value:`image`,children:(0,$.jsx)(Oe,{tab:`image`,provider:u,models:D,filteredModels:ce,modelsLoading:v,modelsError:y,hasApiKey:O,enabledModelIds:oe,pendingChanges:se,modelSortBy:T,getModelDisplayName:k,onToggleModel:M})}),t[80]=D,t[81]=oe,t[82]=ce,t[83]=k,t[84]=M,t[85]=O,t[86]=T,t[87]=y,t[88]=v,t[89]=se,t[90]=u,t[91]=_e):_e=t[91];let K;t[92]===b?K=t[93]:(K=b?(0,$.jsx)(R,{variant:b.includes(`error`)||b.includes(`Failed`)?`error`:`success`,className:`mt-4`,children:b}):null,t[92]=b,t[93]=K);let q;t[94]!==B||t[95]!==U||t[96]!==W||t[97]!==G||t[98]!==_e||t[99]!==K?(q=(0,$.jsxs)(Ae,{title:`Models`,description:`Enable coding and image models for this provider.`,action:B,tableHeader:U,children:[W,G,_e,K]}),t[94]=B,t[95]=U,t[96]=W,t[97]=G,t[98]=_e,t[99]=K,t[100]=q):q=t[100];let J;t[101]!==x||t[102]!==q||t[103]!==z?(J=(0,$.jsx)(de,{value:x,onValueChange:z,children:q}),t[101]=x,t[102]=q,t[103]=z,t[104]=J):J=t[104];let Y;t[105]!==J||t[106]!==L?(Y=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[L,J]})}),t[105]=J,t[106]=L,t[107]=Y):Y=t[107];let X;return t[108]!==Y||t[109]!==N?(X=(0,$.jsx)(`div`,{className:N,children:Y}),t[108]=Y,t[109]=N,t[110]=X):X=t[110],X}function Me(){return window.location.reload()}function Ne(e){return`providers:list:${e}`}async function Pe(){let[e,t]=await Promise.all([ae(),D().catch(()=>({}))]),n={};for(let[e,r]of Object.entries(t))n[e]=r.length;return{providers:e,enabledModelCounts:n}}var Fe=`grid min-h-10 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 px-3 py-2 hover:bg-muted/30 cursor-pointer`,Ie=`[&>*+*]:border-t [&>*+*]:border-table-border`;function Le(e){let t=(0,Z.c)(9),{title:n,description:r,action:i,children:a}=e,o;t[0]!==i||t[1]!==r||t[2]!==n?(o=(0,$.jsx)(H,{title:n,description:r,action:i,sticky:!1}),t[0]=i,t[1]=r,t[2]=n,t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=(0,$.jsx)(L,{className:`pt-6`,children:a}),t[4]=a,t[5]=s);let c;return t[6]!==o||t[7]!==s?(c=(0,$.jsxs)(ue,{className:`shrink-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Re(e){let t=(0,Z.c)(33),{loadVersion:n,onProviderClick:r}=e,{query:i,setQuery:a,deferredQuery:o}=q(),s;t[0]===n?s=t[1]:(s=Ne(n),t[0]=n,t[1]=s);let{providers:c,enabledModelCounts:u}=M(s,Pe),d;if(t[2]!==o||t[3]!==u||t[4]!==c){let e;t[6]===o?e=t[7]:(e=e=>{let t=o.toLowerCase();return e.name.toLowerCase().includes(t)},t[6]=o,t[7]=e);let n;t[8]===u?n=t[9]:(n=(e,t)=>{let n=(u[e.slug]??0)>0,r=(u[t.slug]??0)>0;return n&&!r?-1:!n&&r?1:e.name.localeCompare(t.name)},t[8]=u,t[9]=n),d=c.filter(Ve).filter(e).sort(n),t[2]=o,t[3]=u,t[4]=c,t[5]=d}else d=t[5];let f=d,p;if(t[10]!==o||t[11]!==c){let e;t[13]===o?e=t[14]:(e=e=>{let t=o.toLowerCase();return e.name.toLowerCase().includes(t)},t[13]=o,t[14]=e),p=c.filter(Be).filter(e).sort(ze),t[10]=o,t[11]=c,t[12]=p}else p=t[12];let m=p,h;t[15]!==i||t[16]!==a?(h=(0,$.jsx)(K,{placeholder:`Search`,value:i,onChange:a,className:`mb-0 w-64`}),t[15]=i,t[16]=a,t[17]=h):h=t[17];let g;t[18]!==f||t[19]!==u||t[20]!==r||t[21]!==i?(g=f.length===0?(0,$.jsx)(`p`,{className:S(l.bodyMuted,`py-4`),children:i?`No connected providers match your search.`:`No providers connected yet. Add an API key to get started.`}):(0,$.jsx)(`div`,{className:Ie,children:f.map(e=>(0,$.jsx)(Je,{provider:e,modelCount:u[e.slug]??0,onClick:r},e.name))}),t[18]=f,t[19]=u,t[20]=r,t[21]=i,t[22]=g):g=t[22];let _;t[23]!==h||t[24]!==g?(_=(0,$.jsx)(Le,{title:`Connected Providers`,description:`Providers you've connected with an API key or environment variable.`,action:h,children:g}),t[23]=h,t[24]=g,t[25]=_):_=t[25];let v;t[26]!==m||t[27]!==r||t[28]!==i?(v=(0,$.jsx)(Le,{title:`Available Providers`,description:`Connect additional providers by adding your API key.`,children:m.length===0?(0,$.jsx)(`p`,{className:S(l.bodyMuted,`py-4`),children:i?`No available providers match your search.`:`All providers are connected.`}):(0,$.jsx)(`div`,{className:Ie,children:m.map(e=>(0,$.jsx)(Ye,{provider:e,onClick:r},e.name))})}),t[26]=m,t[27]=r,t[28]=i,t[29]=v):v=t[29];let y;return t[30]!==_||t[31]!==v?(y=(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[_,v]})}),t[30]=_,t[31]=v,t[32]=y):y=t[32],y}function ze(e,t){return e.name.localeCompare(t.name)}function Be(e){return!e.apiKey}function Ve(e){return e.apiKey}function He(){let e=(0,Z.c)(21),t=a(),{providerSlug:n}=i(),[r,o]=(0,Q.useState)(0),s=(0,Q.useRef)(n),c,l;e[0]!==r||e[1]!==n?(c=()=>{s.current&&!n&&(j(Ne(r)),o(Ke)),s.current=n},l=[n,r],e[0]=r,e[1]=n,e[2]=c,e[3]=l):(c=e[2],l=e[3]),(0,Q.useEffect)(c,l);let u;e[4]===t?u=e[5]:(u=e=>{t(`/settings/providers/${encodeURIComponent(e.slug)}`)},e[4]=t,e[5]=u);let d=u,f;e[6]!==r||e[7]!==t?(f=()=>{t(`/settings/providers`),j(Ne(r)),o(Ge)},e[6]=r,e[7]=t,e[8]=f):f=e[8];let p=f,m;e[9]===r?m=e[10]:(m=function(){j(Ne(r)),o(We)},e[9]=r,e[10]=m);let h=m;if(n){let t=decodeURIComponent(n),r;return e[11]!==p||e[12]!==t?(r=(0,$.jsx)(je,{selectedProviderSlug:t,onBack:p}),e[11]=p,e[12]=t,e[13]=r):r=e[13],r}let g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsx)(le,{label:`Loading providers...`,size:`lg`}),e[14]=g):g=e[14];let _;e[15]!==d||e[16]!==r?(_=(0,$.jsx)(Q.Suspense,{fallback:g,children:(0,$.jsx)(Re,{loadVersion:r,onProviderClick:d},r)}),e[15]=d,e[16]=r,e[17]=_):_=e[17];let v;return e[18]!==h||e[19]!==_?(v=(0,$.jsx)(`div`,{className:`h-full min-h-0`,children:(0,$.jsx)(W,{fallbackTitle:`Failed to load providers`,onRetry:h,renderFallback:Ue,children:_})}),e[18]=h,e[19]=_,e[20]=v):v=e[20],v}function Ue(e,t){return(0,$.jsx)(`div`,{className:`frosted-scrollbar h-full min-h-0 overflow-auto`,children:(0,$.jsxs)(ue,{className:`shrink-0`,children:[(0,$.jsx)(H,{title:`Providers`,description:`Manage your AI provider connections and API keys.`,sticky:!1}),(0,$.jsx)(`div`,{className:`flex items-center justify-center px-6 pb-6 pt-6`,children:(0,$.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,$.jsx)(R,{variant:`error`,className:`mb-4`,children:e.message}),(0,$.jsx)(C,{variant:`outline`,size:`sm`,onClick:t,children:`Retry`})]})})]})})}function We(e){return e+1}function Ge(e){return e+1}function Ke(e){return e+1}function qe(e,t){(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())}function Je(e){let t=(0,Z.c)(25),{provider:n,modelCount:r,onClick:i}=e,a;t[0]!==i||t[1]!==n?(a=function(){i(n)},t[0]=i,t[1]=n,t[2]=a):a=t[2];let o=a,s;t[3]===o?s=t[4]:(s=e=>qe(e,o),t[3]=o,t[4]=s);let c;t[5]===n?c=t[6]:(c=(0,$.jsx)(P,{provider:n}),t[5]=n,t[6]=c);let u;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=S(l.label,`truncate leading-normal`),t[7]=u):u=t[7];let d;t[8]===n.name?d=t[9]:(d=(0,$.jsx)(`span`,{className:u,children:n.name}),t[8]=n.name,t[9]=d);let f;t[10]!==c||t[11]!==d?(f=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[c,d]}),t[10]=c,t[11]=d,t[12]=f):f=t[12];let p;t[13]===n.isEnv?p=t[14]:(p=n.isEnv?(0,$.jsx)(ye,{variant:`secondary`,className:S(l.compact,`px-2 py-0.5`),children:`Environment`}):(0,$.jsx)(ye,{variant:`secondary`,className:S(l.compact,`px-2 py-0.5`),children:`API Key`}),t[13]=n.isEnv,t[14]=p);let m;t[15]===r?m=t[16]:(m=r>0&&(0,$.jsxs)(ye,{variant:`default`,className:S(l.compact,`px-2 py-0.5`),children:[r,` `,r===1?`Model`:`Models`]}),t[15]=r,t[16]=m);let h;t[17]!==p||t[18]!==m?(h=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-1.5`,children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==o||t[21]!==s||t[22]!==f||t[23]!==h?(g=(0,$.jsxs)(`div`,{className:Fe,role:`button`,tabIndex:0,onClick:o,onKeyDown:s,children:[f,h]}),t[20]=o,t[21]=s,t[22]=f,t[23]=h,t[24]=g):g=t[24],g}function Ye(e){let t=(0,Z.c)(18),{provider:n,onClick:r}=e,i;t[0]!==r||t[1]!==n?(i=function(){r(n)},t[0]=r,t[1]=n,t[2]=i):i=t[2];let a=i,o;t[3]===a?o=t[4]:(o=e=>qe(e,a),t[3]=a,t[4]=o);let s;t[5]===n?s=t[6]:(s=(0,$.jsx)(P,{provider:n}),t[5]=n,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=S(l.label,`truncate leading-normal`),t[7]=c):c=t[7];let u;t[8]===n.name?u=t[9]:(u=(0,$.jsx)(`span`,{className:c,children:n.name}),t[8]=n.name,t[9]=u);let d;t[10]!==s||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12];let f;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{className:S(l.compact,`shrink-0 text-muted-foreground`),children:`Configure`}),t[13]=f):f=t[13];let p;return t[14]!==a||t[15]!==o||t[16]!==d?(p=(0,$.jsxs)(`div`,{className:Fe,role:`button`,tabIndex:0,onClick:a,onKeyDown:o,children:[d,f]}),t[14]=a,t[15]=o,t[16]=d,t[17]=p):p=t[17],p}export{He as ProvidersListView,He as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{ot as ee}from"./dist-BWuYHVi8.js";import{I as te}from"./dist-DIjomljy.js";import{t as n}from"./button-DeNw35VZ.js";import{i as r,n as i,r as a,t as o}from"./tooltip-B6ziVyTv.js";import{a as s,i as ne,o as re,r as ie,s as c,t as l}from"./dialog-Do98zzAW.js";import{Ft as u,Pt as d,Y as f,un as p,vt as ae}from"./index-DjaVbFDB.js";var oe=e(),m=t();function h(e){let t=(0,oe.c)(58),{open:h,onOpenChange:g,prTitle:_,onPrTitleChange:v,prDescription:y,onPrDescriptionChange:b,isGeneratingPRInfo:x,isLoading:S,onGeneratePRInfo:C,onCreatePR:w,currentBranch:T,createWorkspaceAfterPR:E,onCreateWorkspaceAfterPRChange:D}=e,O;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,m.jsx)(c,{children:`Create Pull Request`}),t[0]=O):O=t[0];let k;t[1]===T?k=t[2]:(k=(0,m.jsxs)(re,{children:[O,(0,m.jsxs)(ne,{children:[`Create a pull request for branch `,T]})]}),t[1]=T,t[2]=k);let A;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,m.jsx)(d,{htmlFor:`pr-title`,children:`Title`}),t[3]=A):A=t[3];let j=T||`Enter PR title...`,M;t[4]===v?M=t[5]:(M=e=>v(e.target.value),t[4]=v,t[5]=M);let N;t[6]!==x||t[7]!==_||t[8]!==j||t[9]!==M?(N=(0,m.jsxs)(`div`,{className:`grid gap-2`,children:[A,(0,m.jsx)(u,{id:`pr-title`,placeholder:j,value:_,onChange:M,disabled:x})]}),t[6]=x,t[7]=_,t[8]=j,t[9]=M,t[10]=N):N=t[10];let P;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,m.jsx)(d,{htmlFor:`pr-description`,children:`Description`}),t[11]=P):P=t[11];let F;t[12]===b?F=t[13]:(F=e=>b(e.target.value),t[12]=b,t[13]=F);let I;t[14]!==x||t[15]!==y||t[16]!==F?(I=(0,m.jsx)(f,{id:`pr-description`,placeholder:`Enter PR description...`,value:y,onChange:F,disabled:x,className:`pr-10 h-full min-h-[14rem] resize-none`}),t[14]=x,t[15]=y,t[16]=F,t[17]=I):I=t[17];let L=x||S,R;t[18]===x?R=t[19]:(R=x?(0,m.jsx)(p,{}):(0,m.jsx)(te,{className:`h-3.5 w-3.5`}),t[18]=x,t[19]=R);let z;t[20]!==C||t[21]!==L||t[22]!==R?(z=(0,m.jsx)(r,{asChild:!0,children:(0,m.jsx)(n,{type:`button`,variant:`ghost`,size:`icon`,className:`absolute top-2 right-2 h-6 w-6`,onClick:C,disabled:L,children:R})}),t[20]=C,t[21]=L,t[22]=R,t[23]=z):z=t[23];let B=x?`Generating PR description...`:`Generate PR title and description with AI`,V;t[24]===B?V=t[25]:(V=(0,m.jsx)(i,{children:B}),t[24]=B,t[25]=V);let H;t[26]!==z||t[27]!==V?(H=(0,m.jsx)(a,{children:(0,m.jsxs)(o,{children:[z,V]})}),t[26]=z,t[27]=V,t[28]=H):H=t[28];let U;t[29]!==H||t[30]!==I?(U=(0,m.jsxs)(`div`,{className:`grid gap-2 flex-1 min-h-0`,children:[P,(0,m.jsxs)(`div`,{className:`relative flex-1 min-h-0`,children:[I,H]})]}),t[29]=H,t[30]=I,t[31]=U):U=t[31];let W;t[32]!==U||t[33]!==N?(W=(0,m.jsxs)(`div`,{className:`grid gap-4 py-4 flex-1 min-h-0`,children:[N,U]}),t[32]=U,t[33]=N,t[34]=W):W=t[34];let G;t[35]!==E||t[36]!==D?(G=(0,m.jsx)(ae,{value:E,onChange:D,ariaLabel:`Also create new workspace`}),t[35]=E,t[36]=D,t[37]=G):G=t[37];let K;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,m.jsx)(d,{className:ee.labelNormal,children:`Also create new workspace`}),t[38]=K):K=t[38];let q;t[39]===G?q=t[40]:(q=(0,m.jsxs)(`div`,{className:`mr-auto flex items-center gap-3`,children:[G,K]}),t[39]=G,t[40]=q);let J=S||x,Y;t[41]===S?Y=t[42]:(Y=S?(0,m.jsxs)(m.Fragment,{children:[`Create PR`,(0,m.jsx)(p,{size:`sm`})]}):`Create PR`,t[41]=S,t[42]=Y);let X;t[43]!==w||t[44]!==J||t[45]!==Y?(X=(0,m.jsx)(n,{className:`ml-auto`,onClick:w,disabled:J,children:Y}),t[43]=w,t[44]=J,t[45]=Y,t[46]=X):X=t[46];let Z;t[47]!==q||t[48]!==X?(Z=(0,m.jsxs)(s,{className:`w-full items-center gap-4`,children:[q,X]}),t[47]=q,t[48]=X,t[49]=Z):Z=t[49];let Q;t[50]!==W||t[51]!==k||t[52]!==Z?(Q=(0,m.jsxs)(ie,{className:`flex max-w-2xl flex-col max-md:top-[max(1rem,env(safe-area-inset-top,0px))] max-md:max-h-[calc(100dvh-2rem)] max-md:translate-y-0 max-md:overflow-y-auto max-md:data-[state=closed]:slide-out-to-top max-md:data-[state=open]:slide-in-from-top max-md:data-[state=closed]:slide-out-to-left-0 max-md:data-[state=open]:slide-in-from-left-0 max-md:data-[state=closed]:zoom-out-100 max-md:data-[state=open]:zoom-in-100 md:h-[min(36rem,85dvh)]`,children:[k,W,Z]}),t[50]=W,t[51]=k,t[52]=Z,t[53]=Q):Q=t[53];let $;return t[54]!==g||t[55]!==h||t[56]!==Q?($=(0,m.jsx)(l,{open:h,onOpenChange:g,children:Q}),t[54]=g,t[55]=h,t[56]=Q,t[57]=$):$=t[57],$}export{h as PullRequestDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{ot as n}from"./dist-BWuYHVi8.js";import{E as r,Ut as i,pt as a}from"./dist-DIjomljy.js";import{t as o}from"./button-DeNw35VZ.js";import{a as s,i as c,o as l,r as u,s as d,t as f}from"./dialog-Do98zzAW.js";import{On as p}from"./index-DjaVbFDB.js";var m=e(),h=t();function g(e){let t=(0,m.c)(27),{open:g,onOpenChange:_,onCommitFirst:v,onStashAndPull:y,onCancel:b,isLoading:x}=e,S=x===void 0?!1:x,C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,h.jsxs)(l,{children:[(0,h.jsxs)(d,{className:`flex items-center gap-2`,children:[(0,h.jsx)(r,{className:`h-5 w-5 text-amber-500`}),`Uncommitted Changes Detected`]}),(0,h.jsx)(c,{children:`You have uncommitted changes. You need to handle them before pulling from the remote branch.`})]}),t[0]=C):C=t[0];let w;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,h.jsx)(`div`,{className:n.bodyMuted,children:`Choose how you want to proceed:`}),t[1]=w):w=t[1];let T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,h.jsx)(i,{className:`h-4 w-4 mr-2`}),t[2]=T):T=t[2];let E;t[3]!==S||t[4]!==v?(E=(0,h.jsxs)(o,{onClick:v,disabled:S,className:`w-full justify-start`,variant:`outline`,children:[T,`Commit changes first, then pull`]}),t[3]=S,t[4]=v,t[5]=E):E=t[5];let D;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsx)(a,{className:`h-4 w-4 mr-2`}),t[6]=D):D=t[6];let O;t[7]!==S||t[8]!==y?(O=(0,h.jsxs)(o,{onClick:y,disabled:S,className:`w-full justify-start`,variant:`outline`,children:[D,`Stash changes → Pull → Restore changes`]}),t[7]=S,t[8]=y,t[9]=O):O=t[9];let k;t[10]!==E||t[11]!==O?(k=(0,h.jsxs)(`div`,{className:`space-y-2`,children:[E,O]}),t[10]=E,t[11]=O,t[12]=k):k=t[12];let A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,h.jsx)(`strong`,{children:`Commit first:`}),t[13]=A):A=t[13];let j;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,h.jsxs)(p,{variant:`hint`,className:`mt-4 mb-0`,children:[A,` Safe option, preserves changes in your commit history.`,(0,h.jsx)(`br`,{}),(0,h.jsx)(`strong`,{children:`Stash and pull:`}),` Temporary option, changes will be restored after pulling.`]}),t[14]=j):j=t[14];let M;t[15]===k?M=t[16]:(M=(0,h.jsx)(`div`,{className:`py-4`,children:(0,h.jsxs)(`div`,{className:`space-y-3`,children:[w,k,j]})}),t[15]=k,t[16]=M);let N;t[17]!==S||t[18]!==b?(N=(0,h.jsx)(s,{children:(0,h.jsx)(o,{variant:`ghost`,onClick:b,disabled:S,children:`Cancel`})}),t[17]=S,t[18]=b,t[19]=N):N=t[19];let P;t[20]!==M||t[21]!==N?(P=(0,h.jsxs)(u,{className:`sm:max-w-[425px]`,children:[C,M,N]}),t[20]=M,t[21]=N,t[22]=P):P=t[22];let F;return t[23]!==_||t[24]!==g||t[25]!==P?(F=(0,h.jsx)(f,{open:g,onOpenChange:_,children:P}),t[23]=_,t[24]=g,t[25]=P,t[26]=F):F=t[26],F}export{g as PullWithChangesDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{t as n}from"./button-DeNw35VZ.js";import{a as r,i,o as a,r as o,s,t as c}from"./dialog-Do98zzAW.js";var l=e(),u=t();function d(e){let t=(0,l.c)(15),{open:d,onOpenChange:f,isLoading:p,onPushAndCreatePR:m,onCancel:h}=e,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,u.jsxs)(a,{children:[(0,u.jsx)(s,{children:`Push Branch First`}),(0,u.jsx)(i,{children:`Your branch needs to be pushed to the remote before creating a pull request. Would you like to push it now?`})]}),t[0]=g):g=t[0];let _;t[1]!==p||t[2]!==h?(_=(0,u.jsx)(n,{variant:`outline`,onClick:h,disabled:p,children:`Cancel`}),t[1]=p,t[2]=h,t[3]=_):_=t[3];let v=p?`Pushing...`:`Push & Create PR`,y;t[4]!==p||t[5]!==m||t[6]!==v?(y=(0,u.jsx)(n,{onClick:m,disabled:p,children:v}),t[4]=p,t[5]=m,t[6]=v,t[7]=y):y=t[7];let b;t[8]!==_||t[9]!==y?(b=(0,u.jsxs)(o,{children:[g,(0,u.jsxs)(r,{children:[_,y]})]}),t[8]=_,t[9]=y,t[10]=b):b=t[10];let x;return t[11]!==f||t[12]!==d||t[13]!==b?(x=(0,u.jsx)(c,{open:d,onOpenChange:f,children:b}),t[11]=f,t[12]=d,t[13]=b,t[14]=x):x=t[14],x}export{d as PushBeforePRDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{o as t,t as n}from"./react-vendor-Ee0-5T4I.js";var r=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},i=new class extends r{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},a={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},o=new class{#e=a;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function s(e){setTimeout(e,0)}var c=typeof window>`u`||`Deno`in globalThis;function l(){}function u(e,t){return typeof e==`function`?e(t):e}function d(e){return typeof e==`number`&&e>=0&&e!==1/0}function f(e,t){return Math.max(e+(t||0)-Date.now(),0)}function p(e,t){return typeof e==`function`?e(t):e}function m(e,t){return typeof e==`function`?e(t):e}function h(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==_(o,t.options))return!1}else if(!y(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function g(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(v(t.options.mutationKey)!==v(a))return!1}else if(!y(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function _(e,t){return(t?.queryKeyHashFn||v)(e)}function v(e){return JSON.stringify(e,(e,t)=>w(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function y(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>y(e[n],t[n])):!1}var b=Object.prototype.hasOwnProperty;function x(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=C(e)&&C(t);if(!r&&!(w(e)&&w(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l<o;l++){let o=r?l:a[l],u=e[o],d=t[o];if(u===d){s[o]=u,(r?l<i:b.call(e,o))&&c++;continue}if(u===null||d===null||typeof u!=`object`||typeof d!=`object`){s[o]=d;continue}let f=x(u,d,n+1);s[o]=f,f===u&&c++}return i===o&&c===i?e:s}function S(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function C(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function w(e){if(!T(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!T(n)||!n.hasOwnProperty(`isPrototypeOf`)||Object.getPrototypeOf(e)!==Object.prototype)}function T(e){return Object.prototype.toString.call(e)===`[object Object]`}function ee(e){return new Promise(t=>{o.setTimeout(t,e)})}function E(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:x(e,t)}function te(e){return e}function ne(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function re(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var D=Symbol();function O(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===D?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function k(e,t){return typeof e==`function`?e(...t):!!e}function ie(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var A=(()=>{let e=()=>c;return{isServer(){return e()},setIsServer(t){e=t}}})();function j(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var M=s;function ae(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=M,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var N=ae(),P=new class extends r{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function oe(e){return Math.min(1e3*2**e,3e4)}function F(e){return(e??`online`)===`online`?P.isOnline():!0}var I=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function L(e){let t=!1,n=0,r,a=j(),o=()=>a.status!==`pending`,s=t=>{if(!o()){let n=new I(t);p(n),e.onCancel?.(n)}},c=()=>{t=!0},l=()=>{t=!1},u=()=>i.isFocused()&&(e.networkMode===`always`||P.isOnline())&&e.canRun(),d=()=>F(e.networkMode)&&e.canRun(),f=e=>{o()||(r?.(),a.resolve(e))},p=e=>{o()||(r?.(),a.reject(e))},m=()=>new Promise(t=>{r=e=>{(o()||u())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,o()||e.onContinue?.()}),h=()=>{if(o())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(f).catch(r=>{if(o())return;let i=e.retry??(A.isServer()?0:3),a=e.retryDelay??oe,s=typeof a==`function`?a(n,r):a,c=i===!0||typeof i==`number`&&n<i||typeof i==`function`&&i(n,r);if(t||!c){p(r);return}n++,e.onFail?.(n,r),ee(s).then(()=>u()?void 0:m()).then(()=>{t?p(r):h()})})};return{promise:a,status:()=>a.status,cancel:s,continue:()=>(r?.(),a),cancelRetry:c,continueRetry:l,canStart:d,start:()=>(d()?h():m().then(h),a)}}var R=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),d(this.gcTime)&&(this.#e=o.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(A.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(o.clearTimeout(this.#e),this.#e=void 0)}};function se(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{ie(e,()=>t.signal,()=>n=!0)},u=O(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?re:ne;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?B:z,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:z(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(c<t)}return s};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function z(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function B(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}function ce(e,t){return t?z(e,t)!=null:!1}function le(e,t){return!t||!e.getPreviousPageParam?!1:B(e,t)!=null}var ue=class extends R{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=U(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=U(this.options);e.data!==void 0&&(this.setState(H(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=E(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(l).catch(l):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>m(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===D||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>p(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!f(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=O(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?se(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=L({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof I&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof I){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...V(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...H(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),N.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function V(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:F(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function H(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function U(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var de=class extends r{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=j(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),G(this.#t,this.options)?this.#h():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return K(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return K(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof m(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!S(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&q(this.#t,n,this.options,t)&&this.#h(),this.updateResult(),r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||p(this.options.staleTime,this.#t)!==p(t.staleTime,this.#t))&&this.#g();let i=this.#_();r&&(this.#t!==n||m(this.options.enabled,this.#t)!==m(t.enabled,this.#t)||i!==this.#p)&&this.#v(i)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return fe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),n===`promise`&&(this.trackProp(`data`),!this.options.experimental_prefetchInRender&&this.#o.status===`pending`&&this.#o.reject(Error(`experimental_prefetchInRender feature flag is not enabled`))),Reflect.get(e,n))})}trackProp(e){this.#m.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(l)),t}#g(){this.#b();let e=p(this.options.staleTime,this.#t);if(A.isServer()||this.#r.isStale||!d(e))return;let t=f(this.#r.dataUpdatedAt,e)+1;this.#d=o.setTimeout(()=>{this.#r.isStale||this.updateResult()},t)}#_(){return(typeof this.options.refetchInterval==`function`?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#x(),this.#p=e,!(A.isServer()||m(this.options.enabled,this.#t)===!1||!d(this.#p)||this.#p===0)&&(this.#f=o.setInterval(()=>{(this.options.refetchIntervalInBackground||i.isFocused())&&this.#h()},this.#p))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#d!==void 0&&(o.clearTimeout(this.#d),this.#d=void 0)}#x(){this.#f!==void 0&&(o.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){let n=this.#t,r=this.options,i=this.#r,a=this.#i,o=this.#a,s=e===n?this.#n:e.state,{state:c}=e,l={...c},u=!1,d;if(t._optimisticResults){let i=this.hasListeners(),a=!i&&G(e,t),o=i&&q(e,n,t,r);(a||o)&&(l={...l,...V(c.data,e.options)}),t._optimisticResults===`isRestoring`&&(l.fetchStatus=`idle`)}let{error:f,errorUpdatedAt:p,status:h}=l;d=l.data;let g=!1;if(t.placeholderData!==void 0&&d===void 0&&h===`pending`){let e;i?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(e=i.data,g=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#u?.state.data,this.#u):t.placeholderData,e!==void 0&&(h=`success`,d=E(i?.data,e,t),u=!0)}if(t.select&&d!==void 0&&!g)if(i&&d===a?.data&&t.select===this.#c)d=this.#l;else try{this.#c=t.select,d=t.select(d),d=E(i?.data,d,t),this.#l=d,this.#s=null}catch(e){this.#s=e}this.#s&&(f=this.#s,d=this.#l,p=Date.now(),h=`error`);let _=l.fetchStatus===`fetching`,v=h===`pending`,y=h===`error`,b=v&&_,x=d!==void 0,S={status:h,fetchStatus:l.fetchStatus,isPending:v,isSuccess:h===`success`,isError:y,isInitialLoading:b,isLoading:b,data:d,dataUpdatedAt:l.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:l.fetchFailureCount,failureReason:l.fetchFailureReason,errorUpdateCount:l.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:l.dataUpdateCount>s.dataUpdateCount||l.errorUpdateCount>s.errorUpdateCount,isFetching:_,isRefetching:_&&!v,isLoadingError:y&&!x,isPaused:l.fetchStatus===`paused`,isPlaceholderData:u,isRefetchError:y&&x,isStale:J(e,t),refetch:this.refetch,promise:this.#o,isEnabled:m(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){let t=S.data!==void 0,r=S.status===`error`&&!t,i=e=>{r?e.reject(S.error):t&&e.resolve(S.data)},a=()=>{i(this.#o=S.promise=j())},o=this.#o;switch(o.status){case`pending`:e.queryHash===n.queryHash&&i(o);break;case`fulfilled`:(r||S.data!==o.value)&&a();break;case`rejected`:(!r||S.error!==o.reason)&&a();break}}return S}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#u=this.#t),!S(t,e)&&(this.#r=t,this.#C({listeners:(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#m.size)return!0;let r=new Set(n??this.#m);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})()}))}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}#C(e){N.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}};function W(e,t){return m(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&m(t.retryOnMount,e)===!1)}function G(e,t){return W(e,t)||e.state.data!==void 0&&K(e,t,t.refetchOnMount)}function K(e,t,n){if(m(t.enabled,e)!==!1&&p(t.staleTime,e)!==`static`){let r=typeof n==`function`?n(e):n;return r===`always`||r!==!1&&J(e,t)}return!1}function q(e,t,n,r){return(e!==t||m(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&J(e,n)}function J(e,t){return m(t.enabled,e)!==!1&&e.isStaleByTime(p(t.staleTime,e))}function fe(e,t){return!S(e.getCurrentResult(),t)}var Y=e(t(),1),pe=n(),X=Y.createContext(void 0),Z=e=>{let t=Y.useContext(X);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},me=({client:e,children:t})=>(Y.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,pe.jsx)(X.Provider,{value:e,children:t})),Q=Y.createContext(!1),he=()=>Y.useContext(Q);Q.Provider;function ge(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var _e=Y.createContext(ge()),ve=()=>Y.useContext(_e),ye=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?k(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||r)&&(t.isReset()||(e.retryOnMount=!1))},be=e=>{Y.useEffect(()=>{e.clearReset()},[e])},xe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||k(n,[e.error,r])),Se=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},Ce=(e,t)=>e.isLoading&&e.isFetching&&!t,we=(e,t)=>e?.suspense&&t.isPending,$=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Te(e,t,n){let r=he(),i=ve(),a=Z(n),o=a.defaultQueryOptions(e);a.getDefaultOptions().queries?._experimental_beforeQuery?.(o);let s=a.getQueryCache().get(o.queryHash),c=e.subscribed!==!1;o._optimisticResults=r?`isRestoring`:c?`optimistic`:void 0,Se(o),ye(o,i,s),be(i);let u=!a.getQueryCache().get(o.queryHash),[d]=Y.useState(()=>new t(a,o)),f=d.getOptimisticResult(o),p=!r&&c;if(Y.useSyncExternalStore(Y.useCallback(e=>{let t=p?d.subscribe(N.batchCalls(e)):l;return d.updateResult(),t},[d,p]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),Y.useEffect(()=>{d.setOptions(o)},[o,d]),we(o,f))throw $(o,d,i);if(xe({result:f,errorResetBoundary:i,throwOnError:o.throwOnError,query:s,suspense:o.suspense}))throw f.error;return a.getDefaultOptions().queries?._experimental_afterQuery?.(o,f),o.experimental_prefetchInRender&&!A.isServer()&&Ce(f,r)&&(u?$(o,d,i):s?.promise)?.catch(l).finally(()=>{d.updateResult()}),o.notifyOnChangeProps?f:d.trackResult(f)}var Ee={onboarding:{status:()=>[`onboarding`,`status`]},app:{update:()=>[`app`,`update`]},models:{enabled:e=>[`models`,`enabled`,e],enabledImage:e=>[`models`,`enabled-image`,e]},userTasks:e=>[`user-tasks`,e],threads:{files:e=>[`threads`,`files`,e]},conversations:{recent:()=>[`conversations`,`recent`]}};export{i as C,D as S,g as _,de as a,y as b,le as c,P as d,N as f,te as g,_ as h,Z as i,R as l,v as m,Te as n,ue as o,u as p,me as r,ce as s,Ee as t,L as u,h as v,r as w,p as x,l as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{g as i,h as a,n as o,t as s,u as c,xn as l}from"./dist-DIjomljy.js";import{c as u,t as d}from"./utils-CT-Dw22R.js";import{t as f}from"./dist-mdooLpmq.js";import{t as p}from"./dist-OixawqbU.js";import{n as m,r as h,t as g}from"./dist-CWnEmdyL.js";import{t as _}from"./dist-CSssbxDI.js";var v=t(),y=e(n(),1),b=r(),x=`Radio`,[S,C]=a(x),[w,T]=S(x),E=y.forwardRef((e,t)=>{let{__scopeRadio:n,name:r,checked:a=!1,required:o,disabled:s,value:l=`on`,onCheck:d,form:f,...p}=e,[m,h]=y.useState(null),g=u(t,e=>h(e)),_=y.useRef(!1),v=m?f||!!m.closest(`form`):!0;return(0,b.jsxs)(w,{scope:n,checked:a,disabled:s,children:[(0,b.jsx)(c.button,{type:`button`,role:`radio`,"aria-checked":a,"data-state":j(a),"data-disabled":s?``:void 0,disabled:s,value:l,...p,ref:g,onClick:i(e.onClick,e=>{a||d?.(),v&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),v&&(0,b.jsx)(A,{control:m,bubbles:!_.current,name:r,value:l,checked:a,required:o,disabled:s,form:f,style:{transform:`translateX(-100%)`}})]})});E.displayName=x;var D=`RadioIndicator`,O=y.forwardRef((e,t)=>{let{__scopeRadio:n,forceMount:r,...i}=e,a=T(D,n);return(0,b.jsx)(o,{present:r||a.checked,children:(0,b.jsx)(c.span,{"data-state":j(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})})});O.displayName=D;var k=`RadioBubbleInput`,A=y.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=y.useRef(null),s=u(o,a),l=_(n),d=f(t);return y.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(l!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[l,n,r]),(0,b.jsx)(c.input,{type:`radio`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...d,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});A.displayName=k;function j(e){return e?`checked`:`unchecked`}var M=[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`],N=`RadioGroup`,[P,F]=a(N,[h,C]),I=h(),L=C(),[R,z]=P(N),B=y.forwardRef((e,t)=>{let{__scopeRadioGroup:n,name:r,defaultValue:i,value:a,required:o=!1,disabled:l=!1,orientation:u,dir:d,loop:f=!0,onValueChange:h,...g}=e,_=I(n),v=p(d),[y,x]=s({prop:a,defaultProp:i??null,onChange:h,caller:N});return(0,b.jsx)(R,{scope:n,name:r,required:o,disabled:l,value:y,onValueChange:x,children:(0,b.jsx)(m,{asChild:!0,..._,orientation:u,dir:v,loop:f,children:(0,b.jsx)(c.div,{role:`radiogroup`,"aria-required":o,"aria-orientation":u,"data-disabled":l?``:void 0,dir:v,...g,ref:t})})})});B.displayName=N;var V=`RadioGroupItem`,H=y.forwardRef((e,t)=>{let{__scopeRadioGroup:n,disabled:r,...a}=e,o=z(V,n),s=o.disabled||r,c=I(n),l=L(n),d=y.useRef(null),f=u(t,d),p=o.value===a.value,m=y.useRef(!1);return y.useEffect(()=>{let e=e=>{M.includes(e.key)&&(m.current=!0)},t=()=>m.current=!1;return document.addEventListener(`keydown`,e),document.addEventListener(`keyup`,t),()=>{document.removeEventListener(`keydown`,e),document.removeEventListener(`keyup`,t)}},[]),(0,b.jsx)(g,{asChild:!0,...c,focusable:!s,active:p,children:(0,b.jsx)(E,{disabled:s,required:o.required,checked:p,...l,...a,name:o.name,ref:f,onCheck:()=>o.onValueChange(a.value),onKeyDown:i(e=>{e.key===`Enter`&&e.preventDefault()}),onFocus:i(a.onFocus,()=>{m.current&&d.current?.click()})})})});H.displayName=V;var U=`RadioGroupIndicator`,W=y.forwardRef((e,t)=>{let{__scopeRadioGroup:n,...r}=e;return(0,b.jsx)(O,{...L(n),...r,ref:t})});W.displayName=U;var G=B,K=H,q=W,J=y.forwardRef((e,t)=>{let n=(0,v.c)(9),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`grid gap-2`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,b.jsx)(G,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});J.displayName=G.displayName;var Y=y.forwardRef((e,t)=>{let n=(0,v.c)(10),r,i;n[0]===e?(r=n[1],i=n[2]):({className:r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=d(`aspect-square h-4 w-4 rounded-full border border-brand text-brand ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,b.jsx)(q,{className:`flex items-center justify-center`,children:(0,b.jsx)(l,{className:`h-2.5 w-2.5 fill-current text-current`})}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,b.jsx)(K,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Y.displayName=K.displayName;export{Y as n,J as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=`scenic-chrome-button hover:!bg-[hsl(var(--scenic-foreground))] hover:!text-[hsl(var(--scenic-foreground-inverse))]`,t=`0 0% 9%`,n=`0 0% 98%`;function r(e){let r=e<=140;return{foreground:r?n:t,inverse:r?t:n}}function i(e,t){document.documentElement.style.setProperty(`--scenic-foreground`,e),document.documentElement.style.setProperty(`--scenic-foreground-inverse`,t)}export{e as n,r,i as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{a as i,g as a,h as o,l as s,n as c,u as l}from"./dist-DIjomljy.js";import{c as u,t as d}from"./utils-CT-Dw22R.js";import{t as f}from"./dist-OixawqbU.js";var p=e(n(),1),m=t();function h(e,[t,n]){return Math.min(n,Math.max(t,e))}var g=r();function _(e,t){return p.useReducer((e,n)=>t[e][n]??e,e)}var v=`ScrollArea`,[y,b]=o(v),[x,S]=y(v),C=p.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,c]=p.useState(null),[d,m]=p.useState(null),[h,_]=p.useState(null),[v,y]=p.useState(null),[b,S]=p.useState(null),[C,w]=p.useState(0),[T,E]=p.useState(0),[D,O]=p.useState(!1),[k,A]=p.useState(!1),j=u(t,e=>c(e)),M=f(i);return(0,g.jsx)(x,{scope:n,type:r,dir:M,scrollHideDelay:a,scrollArea:s,viewport:d,onViewportChange:m,content:h,onContentChange:_,scrollbarX:v,onScrollbarXChange:y,scrollbarXEnabled:D,onScrollbarXEnabledChange:O,scrollbarY:b,onScrollbarYChange:S,scrollbarYEnabled:k,onScrollbarYEnabledChange:A,onCornerWidthChange:w,onCornerHeightChange:E,children:(0,g.jsx)(l.div,{dir:M,...o,ref:j,style:{position:`relative`,"--radix-scroll-area-corner-width":C+`px`,"--radix-scroll-area-corner-height":T+`px`,...e.style}})})});C.displayName=v;var w=`ScrollAreaViewport`,T=p.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=S(w,n),s=u(t,p.useRef(null),o.onViewportChange);return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,g.jsx)(l.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,g.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});T.displayName=w;var E=`ScrollAreaScrollbar`,D=p.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=S(E,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return p.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,g.jsx)(O,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,g.jsx)(k,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,g.jsx)(A,{...r,ref:t,forceMount:n}):i.type===`always`?(0,g.jsx)(j,{...r,ref:t}):null});D.displayName=E;var O=p.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=S(E,e.__scopeScrollArea),[a,o]=p.useState(!1);return p.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,g.jsx)(c,{present:n||a,children:(0,g.jsx)(A,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),k=p.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=S(E,e.__scopeScrollArea),o=e.orientation===`horizontal`,s=G(()=>u(`SCROLL_END`),100),[l,u]=_(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return p.useEffect(()=>{if(l===`idle`){let e=window.setTimeout(()=>u(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[l,i.scrollHideDelay,u]),p.useEffect(()=>{let e=i.viewport,t=o?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(u(`SCROLL`),s()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,o,u,s]),(0,g.jsx)(c,{present:n||l!==`hidden`,children:(0,g.jsx)(j,{"data-state":l===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:a(e.onPointerEnter,()=>u(`POINTER_ENTER`)),onPointerLeave:a(e.onPointerLeave,()=>u(`POINTER_LEAVE`))})})}),A=p.forwardRef((e,t)=>{let n=S(E,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=p.useState(!1),s=e.orientation===`horizontal`,l=G(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return K(n.viewport,l),K(n.content,l),(0,g.jsx)(c,{present:r||a,children:(0,g.jsx)(j,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),j=p.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=S(E,e.__scopeScrollArea),a=p.useRef(null),o=p.useRef(0),[s,c]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=B(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return ie(e,o.current,s,t)}return n===`horizontal`?(0,g.jsx)(M,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=H(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,g.jsx)(ee,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=H(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),M=p.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=S(E,e.__scopeScrollArea),[o,s]=p.useState(),c=p.useRef(null),l=u(t,c,a.onScrollbarXChange);return p.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,g.jsx)(P,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":V(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),W(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:z(o.paddingLeft),paddingEnd:z(o.paddingRight)}})}})}),ee=p.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=S(E,e.__scopeScrollArea),[o,s]=p.useState(),c=p.useRef(null),l=u(t,c,a.onScrollbarYChange);return p.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,g.jsx)(P,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":V(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),W(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:z(o.paddingTop),paddingEnd:z(o.paddingBottom)}})}})}),[te,N]=y(E),P=p.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:o,onThumbPointerUp:c,onThumbPointerDown:d,onThumbPositionChange:f,onDragScroll:m,onWheelScroll:h,onResize:_,...v}=e,y=S(E,n),[b,x]=p.useState(null),C=u(t,e=>x(e)),w=p.useRef(null),T=p.useRef(``),D=y.viewport,O=r.content-r.viewport,k=s(h),A=s(f),j=G(_,10);function M(e){w.current&&m({x:e.clientX-w.current.left,y:e.clientY-w.current.top})}return p.useEffect(()=>{let e=e=>{let t=e.target;b?.contains(t)&&k(e,O)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[D,b,O,k]),p.useEffect(A,[r,A]),K(b,j),K(y.content,j),(0,g.jsx)(te,{scope:n,scrollbar:b,hasThumb:i,onThumbChange:s(o),onThumbPointerUp:s(c),onThumbPositionChange:A,onThumbPointerDown:s(d),children:(0,g.jsx)(l.div,{...v,ref:C,style:{position:`absolute`,...v.style},onPointerDown:a(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),w.current=b.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,y.viewport&&(y.viewport.style.scrollBehavior=`auto`),M(e))}),onPointerMove:a(e.onPointerMove,M),onPointerUp:a(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=T.current,y.viewport&&(y.viewport.style.scrollBehavior=``),w.current=null})})})}),F=`ScrollAreaThumb`,I=p.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=N(F,e.__scopeScrollArea);return(0,g.jsx)(c,{present:n||i.hasThumb,children:(0,g.jsx)(ne,{ref:t,...r})})}),ne=p.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,o=S(F,n),s=N(F,n),{onThumbPositionChange:c}=s,d=u(t,e=>s.onThumbChange(e)),f=p.useRef(void 0),m=G(()=>{f.current&&=(f.current(),void 0)},100);return p.useEffect(()=>{let e=o.viewport;if(e){let t=()=>{m(),f.current||(f.current=ae(e,c),c())};return c(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[o.viewport,m,c]),(0,g.jsx)(l.div,{"data-state":s.hasThumb?`visible`:`hidden`,...i,ref:d,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:a(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;s.onThumbPointerDown({x:n,y:r})}),onPointerUp:a(e.onPointerUp,s.onThumbPointerUp)})});I.displayName=F;var L=`ScrollAreaCorner`,R=p.forwardRef((e,t)=>{let n=S(L,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,g.jsx)(re,{...e,ref:t}):null});R.displayName=L;var re=p.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=S(L,n),[a,o]=p.useState(0),[s,c]=p.useState(0),u=!!(a&&s);return K(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),K(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),u?(0,g.jsx)(l.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function z(e){return e?parseInt(e,10):0}function B(e,t){let n=e/t;return isNaN(n)?0:n}function V(e){let t=B(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function ie(e,t,n,r=`ltr`){let i=V(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return U([c,l],d)(e)}function H(e,t,n=`ltr`){let r=V(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,o=t.content-t.viewport,s=a-r,c=h(e,n===`ltr`?[0,o]:[o*-1,0]);return U([0,o],[0,s])(c)}function U(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function W(e,t){return e>0&&e<t}var ae=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function G(e,t){let n=s(e),r=p.useRef(0);return p.useEffect(()=>()=>window.clearTimeout(r.current),[]),p.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function K(e,t){let n=s(t);i(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var q=C,J=T,Y=R,X=p.forwardRef((e,t)=>{let n=(0,m.c)(15),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=d(`relative overflow-hidden`,i),n[4]=i,n[5]=o);let s;n[6]===r?s=n[7]:(s=(0,g.jsx)(J,{className:`h-full w-full rounded-[inherit]`,children:r}),n[6]=r,n[7]=s);let c,l;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,g.jsx)(Z,{}),l=(0,g.jsx)(Y,{}),n[8]=c,n[9]=l):(c=n[8],l=n[9]);let u;return n[10]!==a||n[11]!==t||n[12]!==o||n[13]!==s?(u=(0,g.jsxs)(q,{ref:t,className:o,...a,children:[s,c,l]}),n[10]=a,n[11]=t,n[12]=o,n[13]=s,n[14]=u):u=n[14],u});X.displayName=q.displayName;var Z=p.forwardRef((e,t)=>{let n=(0,m.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,orientation:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?`vertical`:a,s=o===`vertical`&&`h-full w-2.5 border-l border-l-transparent p-[1px]`,c=o===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent p-[1px]`,l;n[4]!==r||n[5]!==s||n[6]!==c?(l=d(`flex touch-none select-none transition-colors`,s,c,r),n[4]=r,n[5]=s,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,g.jsx)(I,{className:`relative flex-1 rounded-full bg-border`}),n[8]=u):u=n[8];let f;return n[9]!==o||n[10]!==i||n[11]!==t||n[12]!==l?(f=(0,g.jsx)(D,{ref:t,orientation:o,className:l,...i,children:u}),n[9]=o,n[10]=i,n[11]=t,n[12]=l,n[13]=f):f=n[13],f});Z.displayName=D.displayName;var oe=`[&>div]:!box-border [&>div]:!pr-4`,Q=p.forwardRef((e,t)=>{let n=(0,m.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,orientation:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?`vertical`:a,s=o===`vertical`&&`right-0 h-full w-2.5 p-0.5`,c=o===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent p-[1px]`,l;n[4]!==r||n[5]!==s||n[6]!==c?(l=d(`flex touch-none select-none transition-colors`,s,c,r),n[4]=r,n[5]=s,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,g.jsx)(I,{className:`relative flex-1 rounded-full bg-foreground/20 can-hover:hover:bg-foreground/35`}),n[8]=u):u=n[8];let f;return n[9]!==o||n[10]!==i||n[11]!==t||n[12]!==l?(f=(0,g.jsx)(D,{ref:t,orientation:o,className:l,...i,children:u}),n[9]=o,n[10]=i,n[11]=t,n[12]=l,n[13]=f):f=n[13],f});Q.displayName=`SettingsScrollBar`;var $=p.forwardRef((e,t)=>{let n=(0,m.c)(20),r,i,a,o,s;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4],s=n[5]):({className:i,children:r,viewportRef:s,onViewportScroll:a,...o}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o,n[5]=s);let c;n[6]===i?c=n[7]:(c=d(`relative overflow-hidden`,i),n[6]=i,n[7]=c);let l;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(l=d(`h-full w-full rounded-[inherit]`,oe),n[8]=l):l=n[8];let u;n[9]!==r||n[10]!==a||n[11]!==s?(u=(0,g.jsx)(J,{ref:s,onScroll:a,className:l,children:r}),n[9]=r,n[10]=a,n[11]=s,n[12]=u):u=n[12];let f,p;n[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,g.jsx)(Q,{}),p=(0,g.jsx)(Y,{}),n[13]=f,n[14]=p):(f=n[13],p=n[14]);let h;return n[15]!==o||n[16]!==t||n[17]!==c||n[18]!==u?(h=(0,g.jsxs)(q,{ref:t,className:c,...o,children:[u,f,p]}),n[15]=o,n[16]=t,n[17]=c,n[18]=u,n[19]=h):h=n[19],h});$.displayName=`SettingsScrollArea`;var se=p.forwardRef((e,t)=>{let n=(0,m.c)(14),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:r,orientation:a,...i}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o=a===void 0?`vertical`:a,s=o===`vertical`&&`h-full w-2 p-0.5`,c=o===`horizontal`&&`h-2 w-full flex-col p-0.5`,l;n[4]!==r||n[5]!==s||n[6]!==c?(l=d(`flex touch-none select-none bg-transparent`,s,c,r),n[4]=r,n[5]=s,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,g.jsx)(I,{className:`relative flex-1 rounded-full bg-foreground/35 can-hover:hover:bg-foreground/50`}),n[8]=u):u=n[8];let f;return n[9]!==o||n[10]!==i||n[11]!==t||n[12]!==l?(f=(0,g.jsx)(D,{ref:t,orientation:o,className:l,...i,children:u}),n[9]=o,n[10]=i,n[11]=t,n[12]=l,n[13]=f):f=n[13],f});se.displayName=`FrostedScrollBar`;var ce=p.forwardRef((e,t)=>{let n=(0,m.c)(15),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({className:i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let o;n[4]===i?o=n[5]:(o=d(`relative overflow-hidden`,i),n[4]=i,n[5]=o);let s;n[6]===r?s=n[7]:(s=(0,g.jsx)(J,{className:`h-full w-full rounded-[inherit]`,children:r}),n[6]=r,n[7]=s);let c,l;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,g.jsx)(se,{}),l=(0,g.jsx)(Y,{}),n[8]=c,n[9]=l):(c=n[8],l=n[9]);let u;return n[10]!==a||n[11]!==t||n[12]!==o||n[13]!==s?(u=(0,g.jsxs)(q,{ref:t,className:o,...a,children:[s,c,l]}),n[10]=a,n[11]=t,n[12]=o,n[13]=s,n[14]=u):u=n[14],u});ce.displayName=`FrostedScrollArea`;export{h as i,X as n,$ as r,ce as t};
|