tarsk 0.5.43 → 0.5.45
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/index.js +1821 -378
- package/dist/public/assets/{account-view-xKotpUyx.js → account-view-CQetjhCu.js} +1 -1
- package/dist/public/assets/api-BiOks4gS.js +1 -0
- package/dist/public/assets/{browser-tab-DxigYzoT.js → browser-tab-CqyQXekj.js} +1 -1
- package/dist/public/assets/commit-dialog-CF1xviwe.js +1 -0
- package/dist/public/assets/context-menu-DcqiR-vK.js +1 -0
- package/dist/public/assets/create-repo-dialog-zVm7eDO3.js +1 -0
- package/dist/public/assets/dialogs-config-Cmwn8AP3.js +51 -0
- package/dist/public/assets/diff-view-CKaqAShe.js +3 -0
- package/dist/public/assets/explorer-tab-view-CDb7lUWX.js +2 -0
- package/dist/public/assets/explorer-tree-C-9BuD8n.js +1 -0
- package/dist/public/assets/{explorer-view-DIM08sdy.js → explorer-view-txWDc-Tg.js} +1 -1
- package/dist/public/assets/git-history-dialog-WU95COhj.js +1 -0
- package/dist/public/assets/git-ops-button-eOAENpwR.js +2 -0
- package/dist/public/assets/history-view-DTJug8Lv.js +9 -0
- package/dist/public/assets/index-CaswO76A.js +89 -0
- package/dist/public/assets/index-WIITae9I.css +1 -0
- package/dist/public/assets/mcp-server-card-BKJl2_RK.js +1 -0
- package/dist/public/assets/merged-pr-dialog-rSHpRiME.js +1 -0
- package/dist/public/assets/model-star-rating-DpF6_FVG.js +1 -0
- package/dist/public/assets/onboarding-ZCm02KNK.js +1 -0
- package/dist/public/assets/project-settings-view-COigmUzh.js +1 -0
- package/dist/public/assets/providers-list-view-BWQJtM6g.js +1 -0
- package/dist/public/assets/pull-request-dialog-DQVVlS8M.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-DtMvqvd8.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-Bi6MHZiO.js +1 -0
- package/dist/public/assets/radio-group-s_ij8p3t.js +1 -0
- package/dist/public/assets/react-vendor-DMQDEfby.js +16 -0
- package/dist/public/assets/settings-general-view-Cgl5v7l-.js +1 -0
- package/dist/public/assets/settings-instructions-view-DrIwhrWJ.js +1 -0
- package/dist/public/assets/settings-list-B6nYThKU.js +1 -0
- package/dist/public/assets/settings-mcp-servers-view-QPaXg_C8.js +5 -0
- package/dist/public/assets/{settings-models-skeleton-DPnYbg69.js → settings-models-skeleton-D44p69YI.js} +1 -1
- package/dist/public/assets/settings-models-view--0zYzSYj.js +1 -0
- package/dist/public/assets/settings-rules-view-DtTJGnIp.js +8 -0
- package/dist/public/assets/settings-skills-view-CHT2EsBm.js +3 -0
- package/dist/public/assets/settings-slash-commands-view-RamAmlbD.js +1 -0
- package/dist/public/assets/settings-subagents-view-BY1e9nax.js +2 -0
- package/dist/public/assets/settings-system-prompt-view-DNR6lOSK.js +1 -0
- package/dist/public/assets/settings-view-XnpSVwUl.js +2 -0
- package/dist/public/assets/skeleton-_77ZLAk1.js +1 -0
- package/dist/public/assets/slug-utils-C0Ke4-ko.js +1 -0
- package/dist/public/assets/{terminal-panel-DTOx74_o.js → terminal-panel-Cp5-H4GS.js} +1 -1
- package/dist/public/assets/{ui-components-Jc6oi6bz.js → ui-components-BMQhWki4.js} +1 -1
- package/dist/public/assets/{use-deferred-search-B7EdyRbt.js → use-deferred-search-D0WCS0gz.js} +1 -1
- package/dist/public/assets/{utils-tgi5ym_d.js → utils-CkwFiI9G.js} +1 -1
- package/dist/public/assets/vosk-speech-CgILeNJR.js +2 -0
- package/dist/public/assets/{web-C3vJZ_3_.js → web-CdlbRaqq.js} +1 -1
- package/dist/public/assets/{web-CUAWBWPy.js → web-zT0ibfrw.js} +1 -1
- package/dist/public/index.html +8 -8
- package/package.json +1 -1
- package/dist/public/assets/api-D6uLdHBQ.js +0 -1
- package/dist/public/assets/commit-dialog-CLQM9ah3.js +0 -1
- package/dist/public/assets/context-menu-rC7iWcty.js +0 -1
- package/dist/public/assets/create-repo-dialog-C6k5wZPW.js +0 -1
- package/dist/public/assets/dialogs-config-CjKh5Rl2.js +0 -51
- package/dist/public/assets/diff-view-DWDWI5nl.js +0 -3
- package/dist/public/assets/explorer-tab-view-B0kT8Hl6.js +0 -2
- package/dist/public/assets/explorer-tree-BC4fBpxi.js +0 -1
- package/dist/public/assets/git-history-dialog-CuxOTngT.js +0 -1
- package/dist/public/assets/git-ops-button-C04zFAnF.js +0 -2
- package/dist/public/assets/history-view-ar7GLZ-R.js +0 -9
- package/dist/public/assets/index--HY4BbcM.js +0 -90
- package/dist/public/assets/index-DKOXV50p.css +0 -1
- package/dist/public/assets/mcp-server-card-Cy4RU2_Q.js +0 -1
- package/dist/public/assets/merged-pr-dialog-Bo07VouF.js +0 -1
- package/dist/public/assets/model-star-rating-BmkpdXfr.js +0 -1
- package/dist/public/assets/onboarding-ClZrOxX7.js +0 -1
- package/dist/public/assets/project-settings-view-Dm9pQAp_.js +0 -1
- package/dist/public/assets/providers-list-view-D5gHsjl_.js +0 -1
- package/dist/public/assets/pull-request-dialog-8AYlOUNX.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-CSa5OE-d.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-D5W_xsqv.js +0 -1
- package/dist/public/assets/radio-group-CbatNaj1.js +0 -1
- package/dist/public/assets/react-vendor-DwQYi7es.js +0 -16
- package/dist/public/assets/settings-general-view-BP5ULy9A.js +0 -1
- package/dist/public/assets/settings-instructions-view-DMAjbi6E.js +0 -1
- package/dist/public/assets/settings-list-B8hiBkBz.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-OimQz-Rd.js +0 -5
- package/dist/public/assets/settings-models-view-Fq3WtdKG.js +0 -1
- package/dist/public/assets/settings-rules-view-DBk7DzV2.js +0 -8
- package/dist/public/assets/settings-skills-view-CmOw-WMM.js +0 -2
- package/dist/public/assets/settings-slash-commands-view-FsrF5FkK.js +0 -1
- package/dist/public/assets/settings-subagents-view-D98Nxoly.js +0 -2
- package/dist/public/assets/settings-system-prompt-view-B6Hy9ZyK.js +0 -1
- package/dist/public/assets/settings-view-J-rjoRcU.js +0 -2
- package/dist/public/assets/skeleton-BHhGML7J.js +0 -1
- package/dist/public/assets/slug-utils-DyRUJ1NS.js +0 -1
- package/dist/public/assets/whisper-wasm-CWcbC1MB.js +0 -2
- package/dist/public/wasm/libmain-CWYJvMY5.js +0 -3318
- package/dist/public/wasm/libmain-D9-QM3iM.mjs +0 -3301
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$ as t,$a as n,$r as r,Ai as i,Co as a,Eo as o,Ft as s,Ha as c,Hn as l,Ir as u,Jo as d,Jr as f,K as p,Mi as m,Nr as h,Pr as g,Qr as _,Xi as v,Xr as ee,Xt as y,Yo as b,c as x,co as S,ei as C,eo as w,io as T,ls as E,lt as D,oo as O,os as k,ss as A,st as j,va as te,wo as M}from"./dialogs-config-Cmwn8AP3.js";import{k as N}from"./react-vendor-DMQDEfby.js";import{t as P}from"./monaco-CZnIWXyV.js";import{I as F,a as ne,l as I,n as L,o as re}from"./history-view-DTJug8Lv.js";import{d as ie}from"./onboarding-ZCm02KNK.js";import{n as ae}from"./utils-CkwFiI9G.js";import{B as oe,H as se,S as ce,V as le,W as ue,f as de,g as fe,m as pe,p as me,s as he,z as R}from"./index-CaswO76A.js";import{a as z,n as ge,r as _e,t as ve}from"./context-menu-DcqiR-vK.js";var B=e(E(),1),V=A(),H=k();function ye(e){let t=(0,V.c)(20),{children:n,title:r,subtitle:i,headerAction:a,footer:o}=e,s;t[0]===r?s=t[1]:(s=r&&(0,H.jsx)(`span`,{className:v.sectionTitle,children:r}),t[0]=r,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:s}),t[2]=s,t[3]=c);let l;t[4]===a?l=t[5]:(l=a&&(0,H.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:a}),t[4]=a,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]!==i||t[10]!==u?(d=(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 border-b border-sidebar-border px-4 py-6`,children:[u,i]}),t[9]=i,t[10]=u,t[11]=d):d=t[11];let f;t[12]===n?f=t[13]:(f=(0,H.jsx)(x,{className:`flex-1`,children:n}),t[12]=n,t[13]=f);let p;t[14]===o?p=t[15]:(p=o&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:o}),t[14]=o,t[15]=p);let m;return t[16]!==d||t[17]!==f||t[18]!==p?(m=(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[d,f,p]}),t[16]=d,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function be(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var U={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},W={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function G(e){return m(m(v.compact,`status-badge font-mono font-semibold`),U[e]??`text-orange-500`)}function xe(e){return W[e]??`M`}var K=F(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,H.jsxs)(`span`,{className:e.v0,children:[e.v1,` file`,e.v2]}),(0,H.jsxs)(`span`,{className:e.v3,children:[`+`,e.v4]}),(0,H.jsxs)(`span`,{className:e.v5,children:[`-`,e.v6]})]}),{name:`JSX_stats_1`,portals:[`v1`,`v2`,`v4`,`v6`]}),Se=F(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),q=F(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),J=F(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Ce=function(e){let t=(0,V.c)(32),{treeData:n,files:r,error:i,selectedFileIndex:s,onFileSelect:l,onRevertFile:u}=e,f;t[0]===r?f=t[1]:(f=r.reduce(Te,0),t[0]=r,t[1]=f);let p=f,h;t[2]===r?h=t[3]:(h=r.reduce(De,0),t[2]=r,t[3]=h);let g=h,_;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(_=m(v.compact,`text-muted-foreground`),t[4]=_):_=t[4];let ee=r.length,y=r.length===1?``:`s`,b;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(b=m(v.compact,`text-green-500`),t[5]=b):b=t[5];let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=m(v.compact,`text-red-500`),t[6]=x):x=t[6];let S;t[7]!==r.length||t[8]!==y||t[9]!==p||t[10]!==g?(S=(0,H.jsx)(K,{v0:_,v1:ee,v2:y,v3:b,v4:p,v5:x,v6:g}),t[7]=r.length,t[8]=y,t[9]=p,t[10]=g,t[11]=S):S=t[11];let C=S;if(i){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=m(v.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===i?n=t[14]:(n=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:e,children:i})}),t[13]=i,t[14]=n);let r;return t[15]!==C||t[16]!==n?(r=(0,H.jsx)(Se,{v0:(0,H.jsx)(ye,{title:`Review Changes`,subtitle:C,children:n})}),t[15]=C,t[16]=n,t[17]=r):r=t[17],r}if(r.length===0){let e;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:m(v.compact,v.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===C?n=t[20]:(n=(0,H.jsx)(q,{v0:(0,H.jsx)(ye,{title:`Review Changes`,subtitle:C,children:e})}),t[19]=C,t[20]=n),n}let w;t[21]!==r||t[22]!==l||t[23]!==u||t[24]!==s?(w=(e,t)=>{let{isOpen:n,toggle:i}=t,f=!!e.children,p=(0,H.jsxs)(ie,{onClick:()=>{f?i():e.fileIndex!==void 0&&l(e.fileIndex)},selected:!f&&e.fileIndex===s,className:`gap-1.5`,children:[f?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(d,{className:m(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,n&&`rotate-90`)}),n?(0,H.jsx)(M,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(a,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!f&&e.status&&(0,H.jsx)(`span`,{className:G(e.status),children:xe(e.status)})]});return f?p:(0,H.jsxs)(ve,{children:[(0,H.jsx)(z,{asChild:!0,children:p}),(0,H.jsx)(ge,{children:(0,H.jsxs)(_e,{onClick:()=>{e.fileIndex!==void 0&&u?.(r[e.fileIndex])},children:[(0,H.jsx)(c,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=r,t[22]=l,t[23]=u,t[24]=s,t[25]=w):w=t[25];let T;t[26]!==w||t[27]!==n?(T=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(R,{nodes:n,defaultOpen:!0,resetKey:n,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:w})}),t[26]=w,t[27]=n,t[28]=T):T=t[28];let E;return t[29]!==C||t[30]!==T?(E=(0,H.jsx)(J,{v0:(0,H.jsx)(ye,{title:`Review Changes`,subtitle:C,children:T})}),t[29]=C,t[30]=T,t[31]=E):E=t[31],E};function Y(e){return e.type===`add`}function we(e,t){return e+t.changes.filter(Y).length}function Te(e,t){return e+t.hunks.reduce(we,0)}function Ee(e){return e.type===`delete`}function X(e,t){return e+t.changes.filter(Ee).length}function De(e,t){return e+t.hunks.reduce(X,0)}var Oe=F(e=>(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,H.jsx)(`div`,{className:e.v0,children:e.v1}),(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 overflow-auto bg-background`,children:(0,H.jsx)(`img`,{src:e.v2,alt:e.v3,className:`max-w-full max-h-full object-contain`})})]}),{name:`DiffImageSingle_1`,portals:[`v1`]}),ke=function(e){let t=(0,V.c)(5),{threadId:n,filePath:r,version:i,label:a}=e,o=je(n,r,i),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=m(v.caption,`px-3 py-1.5 border-b text-muted-foreground bg-muted/30`),t[0]=s):s=t[0];let c=`${a} - ${r}`,l;return t[1]!==a||t[2]!==o||t[3]!==c?(l=(0,H.jsx)(Oe,{v0:s,v1:a,v2:o,v3:c}),t[1]=a,t[2]=o,t[3]=c,t[4]=l):l=t[4],l};function Ae(e,t,n){return`git-media:${e}:${t}:${n}`}function je(e,t,n){let r=(0,V.c)(13),i;r[0]!==t||r[1]!==e||r[2]!==n?(i=Ae(e,t,n),r[0]=t,r[1]=e,r[2]=n,r[3]=i):i=r[3];let a;r[4]!==t||r[5]!==e||r[6]!==n?(a=()=>D(e,t,n),r[4]=t,r[5]=e,r[6]=n,r[7]=a):a=r[7];let o=ne(i,a),s;r[8]===o?s=r[9]:(s=URL.createObjectURL(o),r[8]=o,r[9]=s);let c=s,l,u;return r[10]===c?(l=r[11],u=r[12]):(l=()=>()=>{URL.revokeObjectURL(c)},u=[c],r[10]=c,r[11]=l,r[12]=u),(0,B.useEffect)(l,u),c}function Me(e){let t=(0,V.c)(23),{threadId:n,file:r}=e,i=r.status===`modified`||r.status===`deleted`||r.status===`renamed`,a=r.status===`modified`||r.status===`added`||r.status===`untracked`||r.status===`renamed`;if(i&&a){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(I,{label:`Loading before...`}),t[0]=e):e=t[0];let i=r.status===`renamed`&&r.oldPath?r.oldPath:r.path,a;t[1]!==i||t[2]!==n?(a=(0,H.jsx)(`div`,{className:`flex-1 border-r border-border`,children:(0,H.jsx)(B.Suspense,{fallback:e,children:(0,H.jsx)(ke,{threadId:n,filePath:i,version:`old`,label:`Before`})})}),t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(I,{label:`Loading after...`}),t[4]=o):o=t[4];let s;t[5]!==r.path||t[6]!==n?(s=(0,H.jsx)(`div`,{className:`flex-1`,children:(0,H.jsx)(B.Suspense,{fallback:o,children:(0,H.jsx)(ke,{threadId:n,filePath:r.path,version:`new`,label:`After`})})}),t[5]=r.path,t[6]=n,t[7]=s):s=t[7];let c;return t[8]!==a||t[9]!==s?(c=(0,H.jsxs)(`div`,{className:`flex h-full`,children:[a,s]}),t[8]=a,t[9]=s,t[10]=c):c=t[10],c}let o=a?`new`:`old`,s=a?`Added`:`Deleted`,c;t[11]===s?c=t[12]:(c=s.toLowerCase(),t[11]=s,t[12]=c);let l=`Loading ${c} image...`,u;t[13]===l?u=t[14]:(u=(0,H.jsx)(I,{label:l}),t[13]=l,t[14]=u);let d;t[15]!==r.path||t[16]!==s||t[17]!==n||t[18]!==o?(d=(0,H.jsx)(ke,{threadId:n,filePath:r.path,version:o,label:s}),t[15]=r.path,t[16]=s,t[17]=n,t[18]=o,t[19]=d):d=t[19];let f;return t[20]!==u||t[21]!==d?(f=(0,H.jsx)(`div`,{className:`flex h-full flex-col`,children:(0,H.jsx)(B.Suspense,{fallback:u,children:d})}),t[20]=u,t[21]=d,t[22]=f):f=t[22],f}function Ne(e){let t=(0,V.c)(4),{isOpen:n}=e,r=(n===void 0?!0:n)&&`ml-[-40px]`,i;t[0]===r?i=t[1]:(i=m(`z-10 shrink-0`,r),t[0]=r,t[1]=i);let a;return t[2]===i?a=t[3]:(a=(0,H.jsx)(de,{withHandle:!0,className:i}),t[2]=i,t[3]=a),a}function Pe(e){let t=(0,V.c)(36),{open:n,lineNumber:a,lineContent:o,initialComment:s,isEditing:c,onSave:l,onDelete:u,onClose:d}=e,[p,h]=(0,B.useState)((s===void 0?``:s)??``),g;t[0]!==l||t[1]!==p?(g=()=>{p.trim()&&l(p.trim())},t[0]=l,t[1]=p,t[2]=g):g=t[2];let y=g,b;t[3]===y?b=t[4]:(b=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),y())},t[3]=y,t[4]=b);let x=b,S;t[5]===d?S=t[6]:(S=e=>{e||d()},t[5]=d,t[6]=S);let w;t[7]===a?w=t[8]:(w=(0,H.jsx)(r,{children:(0,H.jsxs)(C,{children:[`Comment on line `,a]})}),t[7]=a,t[8]=w);let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(v.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),t[9]=T):T=t[9];let E=o||` `,D;t[10]===E?D=t[11]:(D=(0,H.jsx)(`div`,{className:T,children:E}),t[10]=E,t[11]=D);let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=e=>h(e.target.value),t[12]=O):O=t[12];let k;t[13]!==x||t[14]!==p?(k=(0,H.jsx)(oe,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:p,onChange:O,onKeyDown:x,rows:12,className:`resize-none text-base`}),t[13]=x,t[14]=p,t[15]=k):k=t[15];let A;t[16]!==c||t[17]!==u?(A=c&&u&&(0,H.jsx)(i,{variant:`destructive`,size:`sm`,onClick:u,className:`mr-auto`,children:`Delete`}),t[16]=c,t[17]=u,t[18]=A):A=t[18];let j;t[19]===p?j=t[20]:(j=p.trim(),t[19]=p,t[20]=j);let te=!j,M;t[21]!==y||t[22]!==te?(M=(0,H.jsx)(i,{size:`sm`,onClick:y,disabled:te,children:`Save`}),t[21]=y,t[22]=te,t[23]=M):M=t[23];let N;t[24]!==A||t[25]!==M?(N=(0,H.jsxs)(_,{className:`gap-2 sm:gap-0`,children:[A,M]}),t[24]=A,t[25]=M,t[26]=N):N=t[26];let P;t[27]!==k||t[28]!==N||t[29]!==w||t[30]!==D?(P=(0,H.jsxs)(ee,{className:`max-w-2xl`,children:[w,D,k,N]}),t[27]=k,t[28]=N,t[29]=w,t[30]=D,t[31]=P):P=t[31];let F;return t[32]!==n||t[33]!==P||t[34]!==S?(F=(0,H.jsx)(f,{open:n,onOpenChange:S,children:P}),t[32]=n,t[33]=P,t[34]=S,t[35]=F):F=t[35],F}var Fe=F(e=>e.v0,{name:`ReviewLoadingFallback_1`,portals:[`v0`]}),Z=F(e=>(0,H.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,H.jsxs)(`div`,{className:`space-y-4 text-center`,children:[(0,H.jsx)(`p`,{className:e.v0,children:`Loading review changes is taking longer than expected.`}),e.v1]})}),{name:`ReviewLoadingFallback_2`,portals:[`v1`]}),Ie=function(e){let t=(0,V.c)(5),{onRetry:n}=e,[r,a]=(0,B.useState)(!1),o,s;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=window.setTimeout(()=>{a(!0)},15e3);return()=>{window.clearTimeout(e)}},s=[],t[0]=o,t[1]=s):(o=t[0],s=t[1]),(0,B.useEffect)(o,s),!r){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(Fe,{v0:(0,H.jsx)(I,{label:`Loading review changes...`})}),t[2]=e):e=t[2],e}let c;return t[3]===n?c=t[4]:(c=(0,H.jsx)(Z,{v0:v.bodyMuted,v1:(0,H.jsx)(i,{variant:`outline`,onClick:n,children:`Retry`})}),t[3]=n,t[4]=c),c};function Le(e,t){return`git-diff:${e}:${t}`}function Re(){return Error(`Loading review changes timed out. Please try again.`)}async function ze(e,t=15e3){return Promise.race([j(e),new Promise((e,n)=>{window.setTimeout(()=>n(Re()),t)})])}function Be({threadId:e,onExit:r,loadVersion:a}){let o=ne(Le(e,a),()=>ze(e)),c=le(),f=se(e=>e.diffComments),_=se(e=>e.projectModelSelections),{resolvedTheme:ee}=ae(),x=ce(),[C,E]=(0,B.useState)(o.files||[]),[D,k]=(0,B.useState)(null),[A,M]=(0,B.useState)(0),[F,I]=(0,B.useState)(!1),[L,re]=(0,B.useState)(!1),[ie,oe]=(0,B.useState)(!1),[de,R]=(0,B.useState)(!0),z=(0,B.useRef)(null);(0,B.useEffect)(()=>{R(!0)},[e]);let ge=(0,B.useCallback)(e=>{M(e),x&&R(!1)},[x]),_e=(0,B.useCallback)(()=>{R(!0)},[]),ve=x&&!de,V=x&&de,ye=x&&!de,U=(0,B.useMemo)(()=>f[e]??[],[f,e]),W=(0,B.useCallback)(t=>{let n=f[e]??[],r=typeof t==`function`?t(n):t;c({type:ue.SetDiffComments,threadId:e,comments:r})},[c,e,f]),[G,xe]=(0,B.useState)(null),[K,Se]=(0,B.useState)(null),[q,J]=(0,B.useState)(null),Y=(0,B.useRef)(null),we=(0,B.useRef)(U),Te=(0,B.useRef)(G),Ee=(0,B.useRef)({isFullView:F,selectedFileIndex:A,files:C}),X=(0,B.useRef)({original:[],modified:[]}),De=(0,B.useRef)(!0);(0,B.useEffect)(()=>{we.current=U},[U]),(0,B.useEffect)(()=>{Te.current=G},[G]),(0,B.useEffect)(()=>{Ee.current={isFullView:F,selectedFileIndex:A,files:C}},[F,A,C]);let Oe=(0,B.useCallback)(()=>{z.current&&(L?z.current.expand():z.current.collapse())},[L]),ke=(0,B.useCallback)(async()=>{if(e){k(null);try{E((await j(e)).files||[]),M(0)}catch(e){k(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),Ae=(0,B.useCallback)(async t=>{try{await y(e,t.path),await ke()}catch(e){k(e instanceof Error?e.message:`Failed to revert file`)}},[e,ke]),je=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((f[e]??[]).length>0){je.current=!0;return}s(e).then(t=>{t.diffComments&&t.diffComments.length>0&&c({type:ue.SetDiffComments,threadId:e,comments:t.diffComments}),je.current=!0}).catch(()=>{je.current=!0})},[e]),(0,B.useEffect)(()=>{je.current&&l(e,{diffComments:U}).catch(()=>{})},[e,U]);let Fe=(0,B.useMemo)(()=>be(C),[C]),Z=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},Ie=(e,t,n)=>e.split(`
|
|
2
|
+
`).slice(t-1,n).join(`
|
|
3
|
+
`),Re=e=>{let t=Z(e);return t?t.startLine<=1:!0},Be=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Q=C[A],Ve=Q?.isBinary??!1,He=Q?F?Q.oldContent:(()=>{let e=Z(Q);return e?Ie(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Ue=Q?F?Q.newContent:(()=>{let e=Z(Q);return e?Ie(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,B.useCallback)(()=>{if(!De.current)return;let e=Y.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=Ee.current,i=we.current,a=Te.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Z(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:P.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:P.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?X.current.original:X.current.modified,m=e.deltaDecorations(p,d);r===`original`?X.current.original=m:X.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,B.useEffect)(()=>{$()},[$,U,G,A,F,Q]),(0,B.useEffect)(()=>()=>{Y.current=null,X.current={original:[],modified:[]}},[A]),(0,B.useEffect)(()=>()=>{De.current=!1,Y.current&&=(Y.current.getOriginalEditor().getModel()?.dispose(),Y.current.getModifiedEditor().getModel()?.dispose(),Y.current.dispose(),null),X.current={original:[],modified:[]}},[]);let We=(0,B.useCallback)(e=>{Y.current=e;let t=e=>e===P.MouseTargetType.GUTTER_GLYPH_MARGIN||e===P.MouseTargetType.GUTTER_LINE_NUMBERS||e===P.MouseTargetType.GUTTER_LINE_DECORATIONS||e===P.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=Ee.current,c=s[o];if(!c)return;let l=a?null:Z(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=we.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?J(f):Se({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{Y.current===e&&$()},150)},[$]),Ge=(0,B.useCallback)(e=>{if(K&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:A,lineNumber:K.lineNumber,lineContent:K.lineContent,comment:e,side:K.side};W(e=>[...e,t]),Se(null)}else q&&(W(t=>t.map(t=>t.id===q.id?{...t,comment:e}:t)),J(null))},[K,q,Q,A,W]),Ke=(0,B.useCallback)(()=>{q&&(W(e=>e.filter(e=>e.id!==q.id)),J(null))},[q,W]),qe=(0,B.useCallback)(e=>{if(U.length===0)return;let t=(e%U.length+U.length)%U.length,n=U[t];xe(t),M(n.fileIndex),x&&R(!1),setTimeout(()=>{let e=Y.current;if(!e)return;let t=C[n.fileIndex];if(!t)return;let r=F?null:Z(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),$()},100)},[U,C,F,$,x]),Je=(0,B.useCallback)(()=>{qe((G??0)-1)},[qe,G]),Ye=(0,B.useCallback)(()=>{qe((G??-1)+1)},[qe,G]),Xe=(0,B.useCallback)(async()=>{let n=_[e];if(!n)try{let e=await t(),r=Object.values(e).flat();if(r.length>0)n=r[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let i=n.id,a=n.provider;try{let{prompt:t}=await p(e,U);W([]),c({type:ue.SetPendingChatMessage,message:{threadId:e,message:t,model:i,provider:a}}),r()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[U,_,c,e,r,W]),Ze={readOnly:!0,renderSideBySide:!x,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(F||Re(Q))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,H.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,H.jsxs)(pe,{direction:`horizontal`,children:[(0,H.jsx)(me,{ref:z,defaultSize:x?100:25,minSize:x?50:12,maxSize:x?100:40,collapsible:!0,collapsedSize:0,onCollapse:()=>re(!0),onExpand:()=>re(!1),className:m(`border-r border-transparent`,ve&&`hidden`),children:(0,H.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,H.jsx)(Ce,{treeData:Fe,files:C,error:D,selectedFileIndex:A,onFileSelect:ge,onRevertFile:Ae})})}),!x&&(0,H.jsx)(Ne,{isOpen:!L}),(0,H.jsx)(me,{className:m(`overflow-hidden border-l border-border bg-transparent`,V&&`hidden`),children:(0,H.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,H.jsxs)(he,{className:m(`bg-transparent`,L&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ye?(0,H.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:_e,children:[(0,H.jsx)(n,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,H.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:Oe,children:[L?(0,H.jsx)(n,{className:`h-4 w-4`}):(0,H.jsx)(w,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,H.jsx)(`span`,{className:m(v.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,H.jsxs)(`div`,{className:m(`flex items-center gap-2`,L&&`ml-0`,!L&&`ml-auto`,`md:ml-auto`),children:[!Ve&&(0,H.jsx)(i,{variant:`ghost`,size:`sm`,onClick:()=>I(e=>!e),disabled:!Q,className:m(v.compact,`h-8 gap-1 px-2`),children:F?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(T,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(S,{className:`h-3 w-3`}),` Show full file`]})}),U.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(h,{children:[(0,H.jsx)(u,{asChild:!0,children:(0,H.jsx)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Je,disabled:(G??0)===0,children:(0,H.jsx)(b,{className:`h-3 w-3`})})}),(0,H.jsx)(g,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:m(v.caption,`whitespace-nowrap`),children:U.length===1?`1 Comment`:`Comment ${(G??0)+1} of ${U.length}`}),(0,H.jsxs)(h,{children:[(0,H.jsx)(u,{asChild:!0,children:(0,H.jsx)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ye,disabled:(G??0)===U.length-1,children:(0,H.jsx)(d,{className:`h-3 w-3`})})}),(0,H.jsx)(g,{children:`Next comment`})]})]}),U.length>0&&(0,H.jsxs)(h,{children:[(0,H.jsx)(u,{asChild:!0,children:(0,H.jsxs)(i,{size:`sm`,onClick:Xe,className:m(v.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,H.jsx)(O,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(g,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[Ve&&Q?(0,H.jsx)(Me,{threadId:e,file:Q}):(0,H.jsx)(N,{height:`100%`,language:Be(Q?.path||``),original:He,modified:Ue,theme:ee===`dark`?`vs-dark`:`vs-light`,onMount:We,options:Ze},`diff-${A}`),(0,H.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[ie&&(0,H.jsxs)(`div`,{className:`pointer-events-auto w-[min(100%,48rem)] rounded-2xl bg-background/50 p-4 backdrop-blur-md`,children:[(0,H.jsx)(`div`,{className:`mb-3 flex items-center justify-end`,children:(0,H.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>oe(!1),children:[(0,H.jsx)(te,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,H.jsx)(fe,{})]}),!ie&&(0,H.jsxs)(h,{children:[(0,H.jsx)(u,{asChild:!0,children:(0,H.jsxs)(i,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>oe(!0),children:[(0,H.jsx)(O,{className:`h-5 w-5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,H.jsx)(g,{children:`Chat about this diff`})]})]})]})]})})]})}),(0,H.jsx)(Pe,{open:K!==null||q!==null,lineNumber:q?.lineNumber??K?.lineNumber??0,lineContent:q?.lineContent??K?.lineContent??``,initialComment:q?.comment,isEditing:q!==null,onSave:Ge,onDelete:Ke,onClose:()=>{Se(null),J(null)}},`${q?.id??``}-${K?.lineNumber??``}-${K?.side??``}`)]})}function Q(e){let t=(0,V.c)(22),[n,r]=(0,B.useState)(0),[i,a]=(0,B.useState)(0),o=(0,B.useRef)(0),s;t[0]===e.threadId?s=t[1]:(s=()=>{r(t=>(re(Le(e.threadId,t)),t+1)),a(He)},t[0]=e.threadId,t[1]=s);let c=s,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{a(0),r(0),o.current=0},t[2]=l):l=t[2];let u;t[3]===e.threadId?u=t[4]:(u=[e.threadId],t[3]=e.threadId,t[4]=u),(0,B.useEffect)(l,u);let d,f;t[5]!==e.refreshTrigger||t[6]!==e.threadId?(d=()=>{!e.refreshTrigger||e.refreshTrigger<=o.current||(o.current=e.refreshTrigger,r(t=>(re(Le(e.threadId,t)),t+1)),a(Ve))},f=[e.refreshTrigger,e.threadId],t[5]=e.refreshTrigger,t[6]=e.threadId,t[7]=d,t[8]=f):(d=t[7],f=t[8]),(0,B.useEffect)(d,f);let p=`${e.threadId}:${i}`,m;t[9]===c?m=t[10]:(m=(0,H.jsx)(Ie,{onRetry:c}),t[9]=c,t[10]=m);let h=`${e.threadId}:${n}`,g;t[11]!==n||t[12]!==e||t[13]!==h?(g=(0,H.jsx)(Be,{...e,loadVersion:n},h),t[11]=n,t[12]=e,t[13]=h,t[14]=g):g=t[14];let _;t[15]!==m||t[16]!==g?(_=(0,H.jsx)(B.Suspense,{fallback:m,children:g}),t[15]=m,t[16]=g,t[17]=_):_=t[17];let v;return t[18]!==c||t[19]!==p||t[20]!==_?(v=(0,H.jsx)(L,{fallbackTitle:`Failed to load review changes`,onRetry:c,children:_},p),t[18]=c,t[19]=p,t[20]=_,t[21]=v):v=t[21],v}function Ve(e){return e+1}function He(e){return e+1}export{Q as DiffView,Q as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-C-9BuD8n.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-CaswO76A.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-DTJug8Lv.js","assets/dialogs-config-Cmwn8AP3.js","assets/onboarding-ZCm02KNK.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-DMQDEfby.js","assets/utils-CkwFiI9G.js","assets/index-WIITae9I.css","assets/api-BiOks4gS.js","assets/context-menu-DcqiR-vK.js","assets/ui-components-BMQhWki4.js","assets/explorer-view-txWDc-Tg.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Mi as t,Xi as ee,c as te,ls as n,os as r,ss as i}from"./dialogs-config-Cmwn8AP3.js";import{r as a}from"./monaco-CZnIWXyV.js";import{l as o,u as s}from"./history-view-DTJug8Lv.js";import{H as c,P as l,S as u,f as d,m as f,p}from"./index-CaswO76A.js";var m=i(),h=e(n(),1),g=r(),ne=(0,h.lazy)(()=>a(()=>import(`./explorer-tree-C-9BuD8n.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),_=(0,h.lazy)(()=>a(()=>import(`./explorer-view-txWDc-Tg.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function v(){let e=(0,m.c)(47),n=c(y),r=u(),[i,a]=(0,h.useState)(null),[v,b]=(0,h.useState)(!0),{pendingExplorerPath:x,setPendingExplorerPath:S,explorerClearPath:C,setExplorerClearPath:w}=l(),T;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{b(!0)},e[0]=T):T=e[0];let E;e[1]===n?E=e[2]:(E=[n],e[1]=n,e[2]=E),(0,h.useEffect)(T,E);let D;e[3]===r?D=e[4]:(D=e=>{a(e),r&&b(!1)},e[3]=r,e[4]=D);let O=D,k;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>{b(!0)},e[5]=k):k=e[5];let A=k,j;e[6]===r?j=e[7]:(j=e=>{a(e),r&&b(!1)},e[6]=r,e[7]=j);let M=j,N,P;e[8]!==r||e[9]!==x||e[10]!==S?(N=()=>{x&&(a({name:x.split(`/`).pop()??x,path:x,type:`file`}),r&&b(!1),S(null))},P=[r,x,S],e[8]=r,e[9]=x,e[10]=S,e[11]=N,e[12]=P):(N=e[11],P=e[12]),(0,h.useEffect)(N,P);let F,I;e[13]!==C||e[14]!==r||e[15]!==i||e[16]!==w?(F=()=>{C&&(i&&(i.path===C||i.path.startsWith(C+`/`))&&(a(null),r&&b(!0)),w(null))},I=[C,r,i,w],e[13]=C,e[14]=r,e[15]=i,e[16]=w,e[17]=F,e[18]=I):(F=e[17],I=e[18]),(0,h.useEffect)(F,I);let L=r&&!v,R=r&&v,z=r?100:25,B=r?50:15,V=r?100:50,H=L&&`hidden`,U;e[19]===H?U=e[20]:(U=t(`overflow-hidden border-r border-border`,H),e[19]=H,e[20]=U);let W;e[21]!==O||e[22]!==i?.path||e[23]!==n?(W=(0,g.jsx)(te,{className:`h-full`,children:n?(0,g.jsx)(h.Suspense,{fallback:(0,g.jsx)(s,{}),children:(0,g.jsx)(ne,{threadId:n,selectedPath:i?.path??null,onNodeSelect:O})}):(0,g.jsx)(`p`,{className:t(ee.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[21]=O,e[22]=i?.path,e[23]=n,e[24]=W):W=e[24];let G;e[25]!==B||e[26]!==V||e[27]!==U||e[28]!==W||e[29]!==z?(G=(0,g.jsx)(p,{defaultSize:z,minSize:B,maxSize:V,className:U,children:W}),e[25]=B,e[26]=V,e[27]=U,e[28]=W,e[29]=z,e[30]=G):G=e[30];let K;e[31]===r?K=e[32]:(K=!r&&(0,g.jsx)(d,{withHandle:!0}),e[31]=r,e[32]=K);let q=R&&`hidden`,J;e[33]===q?J=e[34]:(J=t(`overflow-hidden`,q),e[33]=q,e[34]=J);let Y;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,g.jsx)(o,{}),e[35]=Y):Y=e[35];let X=r&&!v,Z;e[36]!==M||e[37]!==i||e[38]!==X?(Z=(0,g.jsx)(h.Suspense,{fallback:Y,children:(0,g.jsx)(_,{selectedFile:i,showTreeBackButton:X,onShowTree:A,onFileCreated:M})}),e[36]=M,e[37]=i,e[38]=X,e[39]=Z):Z=e[39];let Q;e[40]!==J||e[41]!==Z?(Q=(0,g.jsx)(p,{className:J,children:Z}),e[40]=J,e[41]=Z,e[42]=Q):Q=e[42];let $;return e[43]!==G||e[44]!==K||e[45]!==Q?($=(0,g.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,g.jsxs)(f,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[G,K,Q]})}),e[43]=G,e[44]=K,e[45]=Q,e[46]=$):$=e[46],$}function y(e){return e.selectedThreadId}export{v as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Co as t,Eo as n,Jo as r,Mi as i,Ra as a,Xi as o,Xo as s,ls as c,os as l,qr as u,ss as d,wo as f}from"./dialogs-config-Cmwn8AP3.js";import{A as p,F as m,M as h,O as g,a as _,c as v,j as y,k as b,n as x,o as S,u as C}from"./history-view-DTJug8Lv.js";import{d as w}from"./onboarding-ZCm02KNK.js";import{A as T,M as E,P as D,R as O,j as k}from"./index-CaswO76A.js";import{a as A,i as j,n as M,r as N,t as P}from"./context-menu-DcqiR-vK.js";import{c as F,n as I,o as L,r as R,s as z,t as B}from"./api-BiOks4gS.js";import{t as V}from"./ui-components-BMQhWki4.js";var H=d(),U=e(c(),1),W=l(),G=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,W.jsx)(V,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});G.displayName=V.displayName;var K=U.forwardRef((e,t)=>{let n=(0,H.c)(10),r,o;n[0]===e?(r=n[1],o=n[2]):({className:r,...o}=e,n[0]=e,n[1]=r,n[2]=o);let s;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,W.jsx)(a,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=s):s=n[3];let c;n[4]===r?c=n[5]:(c=i(`flex h-11 w-full rounded-md bg-transparent py-3 text-base outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),n[4]=r,n[5]=c);let l;return n[6]!==o||n[7]!==t||n[8]!==c?(l=(0,W.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[s,(0,W.jsx)(V.Input,{ref:t,className:c,...o})]}),n[6]=o,n[7]=t,n[8]=c,n[9]=l):l=n[9],l});K.displayName=V.Input.displayName;var q=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,W.jsx)(V.List,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});q.displayName=V.List.displayName;var J=U.forwardRef((e,t)=>{let n=(0,H.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=i(o.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let a;return n[1]!==e||n[2]!==t?(a=(0,W.jsx)(V.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=a):a=n[3],a});J.displayName=V.Empty.displayName;var Y=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,W.jsx)(V.Group,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});Y.displayName=V.Group.displayName;var ee=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let o;n[3]===r?o=n[4]:(o=i(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=o);let s;return n[5]!==a||n[6]!==t||n[7]!==o?(s=(0,W.jsx)(V.Separator,{ref:t,className:o,...a}),n[5]=a,n[6]=t,n[7]=o,n[8]=s):s=n[8],s});ee.displayName=V.Separator.displayName;var te=U.forwardRef((e,t)=>{let n=(0,H.c)(9),r,a;n[0]===e?(r=n[1],a=n[2]):({className:r,...a}=e,n[0]=e,n[1]=r,n[2]=a);let s;n[3]===r?s=n[4]:(s=i(i(o.body,`relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`),r),n[3]=r,n[4]=s);let c;return n[5]!==a||n[6]!==t||n[7]!==s?(c=(0,W.jsx)(V.Item,{ref:t,className:s,...a}),n[5]=a,n[6]=t,n[7]=s,n[8]=c):c=n[8],c});te.displayName=V.Item.displayName;var X=e=>{let t=(0,H.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let a;t[3]===n?a=t[4]:(a=i(o.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=a);let s;return t[5]!==r||t[6]!==a?(s=(0,W.jsx)(`span`,{className:a,...r}),t[5]=r,t[6]=a,t[7]=s):s=t[7],s};X.displayName=`CommandShortcut`;var ne=100,Z=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function ie(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function ae(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(ie(n,t)&&(r.push(n.node),r.length>=Z))break;return r.sort((e,t)=>Q(e,t,n)).slice(0,ne)}function Q(e,t,n){let r=n.trim().toLowerCase(),i=e.name.toLowerCase(),a=t.name.toLowerCase(),o=r?i.startsWith(r):!1;return o===(r?a.startsWith(r):!1)?e.type===t.type?e.path.localeCompare(t.path):e.type===`folder`?-1:1:o?-1:1}function oe(e){let r=(0,H.c)(38),{items:a,isReady:s,onRequestIndex:c,onOpenChange:l,onSelect:d}=e,f=s===void 0?!1:s,p=(0,U.useRef)(null),m=(0,U.useRef)(!1),h=(0,U.useRef)(!1),[g,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(``),b=(0,U.useDeferredValue)(v),x;r[0]===c?x=r[1]:(x=function(){h.current||(h.current=!0,c())},r[0]=c,r[1]=x);let S=x,C;r[2]!==b||r[3]!==a?(C=ae(a,re(b),b),r[2]=b,r[3]=a,r[4]=C):C=r[4];let w=C,D,O;r[5]!==l||r[6]!==v?(D=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,l(e))},O=[l,v],r[5]=l,r[6]=v,r[7]=D,r[8]=O):(D=r[7],O=r[8]),(0,U.useEffect)(D,O);let A;r[9]===l?A=r[10]:(A=function(e){e||y(``),_(e),l(e),e&&requestAnimationFrame(()=>p.current?.focus())},r[9]=l,r[10]=A);let j=A,M;r[11]!==l||r[12]!==d?(M=function(e){d(e),_(!1),l(!1),y(``)},r[11]=l,r[12]=d,r[13]=M):M=r[13];let N=M,P;r[14]===S?P=r[15]:(P=e=>{S(),y(e.target.value)},r[14]=S,r[15]=P);let F;r[16]!==v||r[17]!==S||r[18]!==P?(F=(0,W.jsx)(E,{asChild:!0,children:(0,W.jsx)(`div`,{children:(0,W.jsx)(u,{ref:p,value:v,onPointerDown:S,onChange:P,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),r[16]=v,r[17]=S,r[18]=P,r[19]=F):F=r[19];let I;r[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=i(o.compact,`py-4`),r[20]=I):I=r[20];let L=f?`No matches found.`:`Indexing files and folders...`,R;r[21]===L?R=r[22]:(R=(0,W.jsx)(J,{className:I,children:L}),r[21]=L,r[22]=R);let z;if(r[23]!==N||r[24]!==w){let e;r[26]===N?e=r[27]:(e=e=>(0,W.jsxs)(te,{value:e.path,onSelect:()=>N(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,W.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}):(0,W.jsx)(n,{className:`h-4 w-4 text-muted-foreground`}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate`,children:e.name}),(0,W.jsx)(`div`,{className:i(o.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),r[26]=N,r[27]=e),z=w.map(e),r[23]=N,r[24]=w,r[25]=z}else z=r[25];let B;r[28]===z?B=r[29]:(B=(0,W.jsx)(Y,{children:z}),r[28]=z,r[29]=B);let V;r[30]!==R||r[31]!==B?(V=(0,W.jsx)(k,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:se,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,W.jsx)(G,{shouldFilter:!1,children:(0,W.jsxs)(q,{children:[R,B]})})}),r[30]=R,r[31]=B,r[32]=V):V=r[32];let K;return r[33]!==j||r[34]!==g||r[35]!==V||r[36]!==F?(K=(0,W.jsxs)(T,{open:g,onOpenChange:j,children:[F,V]}),r[33]=j,r[34]=g,r[35]=V,r[36]=F,r[37]=K):K=r[37],K}function se(e){return e.preventDefault()}function ce(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function le(e){let t=(0,H.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=ce(n,r,i),t[0]=r,t[1]=n,t[2]=i,t[3]=o):o=t[3];let s;t[4]!==r||t[5]!==n?(s=()=>L(n,r).then($),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=_(o,s),l;t[7]!==a||t[8]!==c?(l=a(c),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,W.jsx)(W.Fragment,{children:l}),t[10]=l,t[11]=u),u}function $(e){return e.entries}function ue(e){let t=(0,H.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,U.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,U.useEffect)(l,u);let d;t[2]!==i||t[3]!==r?(d=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=d):d=t[4];let f=d,p;t[5]!==i||t[6]!==r?(p=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=p):p=t[7];let m=p,h;t[8]!==n||t[9]!==m||t[10]!==f?(h=(0,W.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:m,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:de}),t[8]=n,t[9]=m,t[10]=f,t[11]=h):h=t[11];let g;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==h?(g=(0,W.jsxs)(w,{level:a,basePadding:o,children:[s,h]}),t[12]=o,t[13]=s,t[14]=a,t[15]=h,t[16]=g):g=t[16],g}function de(e){return e.stopPropagation()}function fe(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var pe=(0,U.memo)(function e({node:i,level:a,threadId:o,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:E}){let D=l.has(i.path),O=d===i.path,k=p?.dirPath===i.path&&D;return i.type===`folder`?(0,W.jsxs)(P,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(w,{level:a,basePadding:10,selected:c===i.path,className:i.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),m(i)},children:[(0,W.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:D?(0,W.jsx)(s,{className:`h-3 w-3`}):(0,W.jsx)(r,{className:`h-3 w-3`})}),O?(0,W.jsxs)(W.Fragment,{children:[D?(0,W.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,W.jsx)(`input`,{autoFocus:!0,defaultValue:i.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(i,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(i,t):y()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,W.jsxs)(W.Fragment,{children:[D?(0,W.jsx)(f,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,W.jsx)(`span`,{className:`flex-1 truncate`,children:i.name})]})]}),D&&(0,W.jsx)(`div`,{children:(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(v,{}),children:(0,W.jsx)(le,{threadId:o,dirPath:i.path,version:u(i.path),children:r=>(0,W.jsxs)(W.Fragment,{children:[k&&(0,W.jsx)(ue,{defaultValue:``,level:a+1,basePadding:p.type===`folder`?10:22,icon:p.type===`folder`?(0,W.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(n,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:T,onCancel:E}),r.map(t=>(0,W.jsx)(e,{node:t,level:a+1,threadId:o,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:d,newItemIn:p,onToggleFolder:m,onSelectNode:h,onStartRename:g,onCommitRename:_,onCancelRename:y,onDelete:b,onOpen:x,onNewFile:S,onNewFolder:C,onCommitNewItem:T,onCancelNewItem:E},t.path))]})})})})]})}),(0,W.jsxs)(M,{children:[(0,W.jsx)(N,{onSelect:()=>x(i),children:`Open`}),(0,W.jsx)(j,{}),(0,W.jsx)(N,{onSelect:()=>S(i.path),children:`New File...`}),(0,W.jsx)(N,{onSelect:()=>C(i.path),children:`New Folder...`}),(0,W.jsx)(j,{}),(0,W.jsx)(N,{onSelect:()=>g(i),children:`Rename...`}),(0,W.jsx)(N,{onSelect:()=>b(i),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,W.jsxs)(P,{children:[(0,W.jsx)(A,{asChild:!0,children:(0,W.jsxs)(w,{level:a,basePadding:22,selected:c===i.path,className:i.ignored?`opacity-50`:void 0,onClick:()=>h(i),children:[(0,W.jsx)(n,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),O?(0,W.jsx)(`input`,{autoFocus:!0,defaultValue:i.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?_(i,t):y()}else e.key===`Escape`&&y()},onBlur:e=>{let t=e.target.value.trim();t?_(i,t):y()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,W.jsx)(`span`,{className:`flex-1 truncate`,children:i.name})]})}),(0,W.jsxs)(M,{children:[(0,W.jsx)(N,{onSelect:()=>x(i),children:`Open`}),(0,W.jsx)(j,{}),(0,W.jsx)(N,{onSelect:()=>g(i),children:`Rename...`}),(0,W.jsx)(N,{onSelect:()=>b(i),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),me=new Map;function he({threadId:e,selectedPath:r,onNodeSelect:i}){let[a,o]=(0,U.useState)(()=>new Map([[``,0]])),[s,c]=(0,U.useState)(new Set),[l,u]=(0,U.useState)(null),[d,f]=(0,U.useState)(null),[_,v]=(0,U.useState)(null),[w,T]=(0,U.useState)(!1),[E,k]=(0,U.useState)([]),[j,V]=(0,U.useState)(!1),[H,G]=(0,U.useState)(!1),K=(0,U.useRef)(null),q=(0,U.useRef)(0),J=(0,U.useRef)(null),{explorerRefreshTick:Y,pendingExplorerPath:ee,setExplorerClearPath:te}=D(),X=(0,U.useMemo)(()=>`${e}:${Y}`,[Y,e]),ne=(0,U.useCallback)(e=>{(0,U.startTransition)(()=>{T(t=>t===e?t:e)})},[]),Z=(0,U.useCallback)(async()=>{if(!e)return;let t=me.get(X);if(t){k(t),V(!0);return}if(K.current!==X){K.current=X,k([]),V(!1);try{let t=fe((await L(e,``,!0)).entries);me.set(X,t),k(t),V(!0)}catch{k([]),V(!1)}finally{K.current===X&&(K.current=null)}}},[X,e]),re=(0,U.useCallback)(()=>{G(!0)},[]),ie=(0,U.useCallback)(()=>{me.delete(X),k([]),V(!1)},[X]),ae=(0,U.useCallback)(()=>{ie(),H&&Z()},[ie,Z,H]),Q=(0,U.useCallback)(e=>a.get(e)??0,[a]),se=(0,U.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,U.useCallback)(t=>{e&&(S(ce(e,t,Q(t))),se(t))},[se,Q,e]),de=(0,U.useCallback)(t=>{if(!e)return;let n=t.path.split(`/`);t.type===`file`&&n.pop();let r=[],i=``;for(let e of n)i=i?`${i}/${e}`:e,r.push(i);c(e=>{let t=new Set(e);for(let e of r)t.add(e);return t})},[e]);(0,U.useEffect)(()=>{if(!e)return;let t=J.current!==null&&J.current!==e;J.current=e,t&&(o(new Map([[``,0]])),c(new Set),u(null),f(null),q.current=Y)},[Y,e]),(0,U.useEffect)(()=>{!e||Y<=q.current||(q.current=Y,o(t=>{let n=new Set([``]);for(let e of s)n.add(e);let r=new Map(t);for(let i of n){let n=t.get(i)??0;S(ce(e,i,n)),r.set(i,n+1)}return r}))},[Y,s,e]),(0,U.useEffect)(()=>{k([]),V(!1),G(!1),K.current=null},[X]),(0,U.useEffect)(()=>{!H||!e||Z()},[Z,H,e]),(0,U.useEffect)(()=>{if(!ee||!e)return;let t=ee.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})}},[ee,e]);function he(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),o(t=>{if(t.has(e.path))return t;let n=new Map(t);return n.set(e.path,0),n}))}function ge(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function _e(e){v(e)}async function ve(t){try{await z(e,t.path)}catch{O({title:`Error`,description:`Failed to open "${t.name}"`,variant:`destructive`})}}async function ye(){if(!_)return;let t=_;v(null);try{await R(e,t.path),te(t.path),$(ge(t.path)),ae(),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{O({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function be(e){f(null),u(e.path)}async function xe(t,n){if(n===t.name){u(null);return}u(null);try{await F(e,t.path,n),$(ge(t.path)),ae(),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{O({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function Se(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`file`})}function Ce(e){u(null),s.has(e)||(c(t=>new Set(t).add(e)),o(t=>{if(t.has(e))return t;let n=new Map(t);return n.set(e,0),n})),f({dirPath:e,type:`folder`})}async function we(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await B(e,n,t):await I(e,n,t),$(n),ae()}catch{O({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Te(){f(null)}function Ee(e){de(e),e.type===`file`&&i(e)}let De=d?.dirPath===``?(0,W.jsx)(ue,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,W.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,W.jsx)(n,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:we,onCancel:Te}):null;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(g,{open:_!==null,onOpenChange:e=>!e&&v(null),children:(0,W.jsxs)(y,{children:[(0,W.jsx)(m,{children:`Move to Trash`}),(0,W.jsxs)(h,{children:[`Move “`,_?.name,`” to trash?`]}),(0,W.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,W.jsx)(p,{children:`Cancel`}),(0,W.jsx)(b,{onClick:()=>void ye(),children:`Move to Trash`})]})]})}),(0,W.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,W.jsx)(oe,{items:E,isReady:j,onRequestIndex:re,onOpenChange:ne,onSelect:e=>Ee(e)},X)}),(0,W.jsxs)(P,{children:[(0,W.jsx)(A,{asChild:!0,disabled:w,children:(0,W.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,W.jsx)(x,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(C,{}),children:(0,W.jsx)(le,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,W.jsxs)(W.Fragment,{children:[De,t.map(t=>(0,W.jsx)(pe,{node:t,level:0,threadId:e,selectedPath:r,expandedPaths:s,getDirVersion:Q,renamingPath:l,newItemIn:d,onToggleFolder:he,onSelectNode:i,onStartRename:be,onCommitRename:xe,onCancelRename:()=>u(null),onDelete:_e,onOpen:ve,onNewFile:Se,onNewFolder:Ce,onCommitNewItem:we,onCancelNewItem:Te},t.path))]})})})})})}),(0,W.jsxs)(M,{children:[(0,W.jsx)(N,{onSelect:()=>Se(``),children:`New File...`}),(0,W.jsx)(N,{onSelect:()=>Ce(``),children:`New Folder...`})]})]})]})}export{he as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{$a as t,Ai as n,Bo as r,Do as i,Hi as a,Ka as o,Mi as s,Oo as c,Vi as l,Xi as u,Zo as d,at as ee,jo as f,lo as te,ls as p,os as m,ss as h}from"./dialogs-config-Cmwn8AP3.js";import{O as ne}from"./react-vendor-DMQDEfby.js";import{I as g,a as _,l as v,n as y,o as b}from"./history-view-DTJug8Lv.js";import{n as re}from"./utils-CkwFiI9G.js";import{E as x,H as S,I as C,P as w,R as T,T as E,k as D,s as ie,w as ae}from"./index-CaswO76A.js";import{a as O,i as k,l as oe,o as A,s as se,t as ce}from"./api-BiOks4gS.js";var j=h(),M=m(),N=e(p(),1),P=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,M.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),F=g(e=>(0,M.jsxs)(`div`,{className:`flex flex-col h-full`,children:[e.v0,(0,M.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,M.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:e.v1})}),e.v2]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`,`v2`]}),I=function({selectedFile:e,showTreeBackButton:i=!1,onShowTree:a,onFileCreated:f}){let{resolvedTheme:p}=re(),m=S(e=>e.selectedThreadId),{triggerExplorerRefresh:h}=w(),g=(0,N.useRef)(null),_=(0,N.useRef)(null),O=(0,N.useRef)(!1),[k,A]=(0,N.useState)(null),[j,I]=(0,N.useState)(!1),[W,K]=(0,N.useState)(`edit`),[ue,de]=(0,N.useState)(0),[q,fe]=(0,N.useState)(null),[J,Y]=(0,N.useState)(!1);(0,N.useEffect)(()=>{m&&ee(m).then(fe).catch(()=>{})},[m]);let pe=async()=>{if(!(!q||J)){Y(!0);try{await navigator.clipboard.writeText(q),T({title:`Copied`,description:`Repository folder path copied to clipboard.`})}catch{T({title:`Error`,description:`Failed to copy path to clipboard.`,variant:`destructive`})}finally{Y(!1)}}},me=async()=>{if(m)try{await se(m,`.`)}catch{T({title:`Error`,description:`Failed to open repository folder.`,variant:`destructive`})}},he=(0,N.useCallback)(async e=>{if(m)try{let t=await R(m,e);await ce(m,``,t);let n={name:t,path:t,type:`file`};_.current=t,O.current=!0,f?.(n),h(),T({title:`Created`,description:`${t} created successfully.`})}catch{T({title:`Error`,description:`Failed to create file.`,variant:`destructive`})}},[m,f,h]),X=e?l(e.path,e.name):null,Z=e?.type===`file`&&m&&!X?e:null,Q=k?.content??``,ge=k?.original??``,$=Z?`${m}:${Z.path}:${ue}`:null;(0,N.useEffect)(()=>()=>{g.current&&=(g.current.getModel()?.dispose(),g.current.dispose(),null)},[]),(0,N.useEffect)(()=>{e?.type===`file`?_.current===e.path?(_.current=null,K(`edit`)):K(z(e.path)?`view`:`edit`):K(`edit`),A(null)},[e?.path,m]);async function _e(){if(!(!m||!e)){I(!0);try{await oe(m,e.path,Q),A({content:Q,original:Q}),T({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){T({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{I(!1)}}}function ve(){!m||!Z||(b(V(m,Z.path)),A(null),de(e=>e+1))}return m?(0,M.jsx)(F,{v0:(0,M.jsxs)(ie,{className:`justify-between`,children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[i&&a?(0,M.jsxs)(n,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:a,children:[(0,M.jsx)(t,{className:`h-4 w-4`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,M.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,M.jsx)(`span`,{className:s(u.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,M.jsx)(`span`,{className:s(u.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),(0,M.jsxs)(`div`,{className:`flex gap-2`,children:[Z&&k?(0,M.jsxs)(M.Fragment,{children:[z(Z.path)?(0,M.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,M.jsx)(n,{size:`sm`,variant:W===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>K(`view`),children:`View`}),(0,M.jsx)(n,{size:`sm`,variant:W===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>K(`edit`),children:`Edit`})]}):null,(0,M.jsxs)(n,{size:`sm`,onClick:()=>void _e(),disabled:j||!Q||Q===ge,children:[j?(0,M.jsx)(te,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null,e?null:(0,M.jsxs)(ae,{children:[(0,M.jsx)(D,{asChild:!0,children:(0,M.jsxs)(n,{size:`sm`,className:`gap-1.5`,children:[(0,M.jsx)(o,{className:`h-3.5 w-3.5`}),`New file`]})}),(0,M.jsx)(E,{align:`end`,children:L.map(({label:e,ext:t,icon:n})=>(0,M.jsxs)(x,{onSelect:()=>void he(t),children:[(0,M.jsx)(n,{className:`h-4 w-4`}),e]},t))})]})]})]}),v1:Z?(0,M.jsxs)(y,{fallbackTitle:`Failed to load file`,onRetry:ve,children:[(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(H,{threadId:m,path:Z.path,onContentReady:A},$??void 0)}),k?z(Z.path)&&W===`view`?(0,M.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,M.jsx)(C,{content:Q,enableMermaid:!0})}):(0,M.jsx)(ne,{height:`100%`,language:B(Z.path),value:Q,onChange:e=>A(t=>t&&{...t,content:e??``}),onMount:e=>{g.current=e,O.current&&(O.current=!1,e.focus())},theme:p===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,M.jsx)(v,{})]}):e?.type===`file`&&X===`image`?(0,M.jsx)(y,{fallbackTitle:`Failed to load image`,onRetry:()=>{!m||!e||b(U(m,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(G,{threadId:m,path:e.path,alt:e.name})})}):e?.type===`file`&&X===`video`?(0,M.jsx)(y,{fallbackTitle:`Failed to load video`,onRetry:()=>{!m||!e||b(U(m,e.path))},children:(0,M.jsx)(N.Suspense,{fallback:(0,M.jsx)(v,{}),children:(0,M.jsx)(le,{threadId:m,path:e.path})})}):(0,M.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,M.jsx)(`h2`,{className:s(u.pageTitle,`text-foreground`),children:`File Explorer`}),(0,M.jsx)(`p`,{className:s(u.pageSubtitle),children:`Browse and edit files`})]}),v2:e?null:(0,M.jsx)(`div`,{className:`flex shrink-0 items-center gap-2 px-4 py-2`,children:q?(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(`button`,{type:`button`,onClick:()=>void me(),className:s(u.compact,`min-w-0 flex-1 truncate text-left font-mono text-muted-foreground hover:text-foreground hover:underline`),title:q,children:q}),(0,M.jsxs)(n,{variant:`ghost`,size:`icon`,className:`h-7 w-7 shrink-0`,onClick:()=>void pe(),disabled:J,children:[J?(0,M.jsx)(d,{className:`h-3.5 w-3.5`}):(0,M.jsx)(r,{className:`h-3.5 w-3.5`}),(0,M.jsx)(`span`,{className:`sr-only`,children:`Copy path`})]})]}):(0,M.jsx)(`p`,{className:s(u.compact,`text-muted-foreground/50 italic`),children:`Loading path...`})})}):(0,M.jsx)(P,{v0:(0,M.jsx)(c,{className:`h-8 w-8 text-muted-foreground`}),v1:u.bodyMuted})},L=[{label:`Markdown`,ext:`md`,icon:c},{label:`TypeScript`,ext:`ts`,icon:f},{label:`Text`,ext:`txt`,icon:i}];async function R(e,t){try{let n=await A(e,``),r=new Set(n.entries.map(e=>e.name)),i=`untitled`,a=`${i}.${t}`,o=2;for(;r.has(a);)a=`${i}${o}.${t}`,o++;return a}catch{return`untitled.${t}`}}function z(e){return a(e)===`md`}function B(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[a(e)]??`plaintext`}function V(e,t){return`explorer-file:${e}:${t}`}function H(e){let t=(0,j.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=V(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>O(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=_(a,o),c,l;return t[6]!==i||t[7]!==s.content?(c=()=>{i({content:s.content,original:s.content})},l=[i,s.content],t[6]=i,t[7]=s.content,t[8]=c,t[9]=l):(c=t[8],l=t[9]),(0,N.useLayoutEffect)(c,l),null}function U(e,t){return`explorer-media:${e}:${t}`}function W(e,t){let n=(0,j.c)(11),r;n[0]!==t||n[1]!==e?(r=U(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>k(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=_(r,i),o;n[6]===a?o=n[7]:(o=URL.createObjectURL(a),n[6]=a,n[7]=o);let s=o,c,l;return n[8]===s?(c=n[9],l=n[10]):(c=()=>()=>{URL.revokeObjectURL(s)},l=[s],n[8]=s,n[9]=c,n[10]=l),(0,N.useEffect)(c,l),s}function G(e){let t=(0,j.c)(3),{threadId:n,path:r,alt:i}=e,a=W(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,M.jsx)(`img`,{src:a,alt:i,className:`max-w-full max-h-full object-contain`})}),t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function le(e){let t=(0,j.c)(2),{threadId:n,path:r}=e,i=W(n,r),a;return t[0]===i?a=t[1]:(a=(0,M.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,M.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{I as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$r as e,Ai as t,Jr as n,Mi as r,Qr as i,Xi as a,Xr as o,Zr as s,ei as c,lo as l,os as u,ss as d}from"./dialogs-config-Cmwn8AP3.js";var f=d(),p=u();function m(u){let d=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=u,S;d[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(c,{children:`Commit History`}),d[0]=S):S=d[0];let C;d[1]===x?C=d[2]:(C=(0,p.jsxs)(e,{children:[S,(0,p.jsxs)(s,{children:[`Recent commits on branch `,x]})]}),d[1]=x,d[2]=C);let w;d[3]===v?w=d[4]:(w=v.length>0?v.map(h):(0,p.jsx)(`p`,{className:r(a.bodyMuted,`text-center py-8`),children:`No commits found`}),d[3]=v,d[4]=w);let T;d[5]===y?T=d[6]:(T=y&&(0,p.jsx)(`div`,{className:`p-3 text-center`,children:(0,p.jsx)(l,{className:`h-4 w-4 animate-spin inline`})}),d[5]=y,d[6]=T);let E;d[7]!==_.length||d[8]!==v.length||d[9]!==y?(E=v.length<_.length&&!y&&(0,p.jsx)(`div`,{className:r(a.caption,`p-3 text-center`),children:`Scroll to load more`}),d[7]=_.length,d[8]=v.length,d[9]=y,d[10]=E):E=d[10];let D;d[11]!==w||d[12]!==T||d[13]!==E?(D=(0,p.jsxs)(`div`,{className:`divide-y`,children:[w,T,E]}),d[11]=w,d[12]=T,d[13]=E,d[14]=D):D=d[14];let O;d[15]!==b||d[16]!==D?(O=(0,p.jsx)(`div`,{className:`flex-1 overflow-y-auto border rounded-lg`,onScroll:b,children:D}),d[15]=b,d[16]=D,d[17]=O):O=d[17];let k;d[18]===g?k=d[19]:(k=(0,p.jsx)(i,{children:(0,p.jsx)(t,{onClick:()=>g(!1),children:`Close`})}),d[18]=g,d[19]=k);let A;d[20]!==C||d[21]!==O||d[22]!==k?(A=(0,p.jsxs)(o,{className:`max-w-2xl max-h-[80vh] flex flex-col`,children:[C,O,k]}),d[20]=C,d[21]=O,d[22]=k,d[23]=A):A=d[23];let j;return d[24]!==g||d[25]!==m||d[26]!==A?(j=(0,p.jsx)(n,{open:m,onOpenChange:g,children:A}),d[24]=g,d[25]=m,d[26]=A,d[27]=j):j=d[27],j}function h(e){return(0,p.jsxs)(`div`,{className:`p-3 hover:bg-muted/50 transition-colors`,children:[(0,p.jsx)(`p`,{className:r(a.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:r(a.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:a.mono,children:e.hash.substring(0,7)}),` •`,` `,e.author,` • `,new Date(e.date).toLocaleDateString()]})]},e.hash)}export{m as GitHistoryDialog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/commit-dialog-CF1xviwe.js","assets/index-CaswO76A.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-DTJug8Lv.js","assets/dialogs-config-Cmwn8AP3.js","assets/onboarding-ZCm02KNK.js","assets/vosk-speech-CgILeNJR.js","assets/react-vendor-DMQDEfby.js","assets/utils-CkwFiI9G.js","assets/index-WIITae9I.css","assets/pull-request-dialog-DQVVlS8M.js","assets/create-repo-dialog-zVm7eDO3.js","assets/git-history-dialog-WU95COhj.js","assets/push-before-pr-dialog-Bi6MHZiO.js","assets/pull-with-changes-dialog-DtMvqvd8.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as t,C as n,Et as r,Fo as i,Fr as a,Gt as ee,Hn as o,Ht as te,Ir as ne,Jt as re,Mi as ie,Nr as ae,Po as oe,Pr as se,Sa as ce,Wt as le,Xi as ue,Xo as s,Y as c,Zt as de,_a as l,aa as fe,ct as pe,dt as me,is as u,lo as d,ls as f,mo as he,os as p,q as m,qt as ge,rn as h,ss as g,tn as _,vo as _e,xo as v,yo as ve}from"./dialogs-config-Cmwn8AP3.js";import{r as y}from"./monaco-CZnIWXyV.js";import{D as ye,E as b,H as be,O as xe,R as x,T as Se,V as Ce,W as we,k as Te,v as Ee,w as De,x as Oe,y as ke}from"./index-CaswO76A.js";var S=e(f(),1),C=p();function Ae(e,t){return t?`Creating PR...`:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?`Sync`:e.hasChanges?`Commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`Open PR`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create PR`:e.hasUnpushedCommits&&e.prExists?`Update PR`:`Commit`}function je(e,t,n=!1){return t||n?(0,C.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,C.jsx)(u,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,C.jsx)(v,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,C.jsx)(oe,{className:`h-3.5 w-3.5`}):(0,C.jsx)(ve,{className:`h-3.5 w-3.5`})}function Me(e){if(e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits){let t=e.defaultBranch??`main`;return e.currentBranch===e.defaultBranch?`Your branch is behind the remote. This will pull the latest changes from origin/${t}`:`Your branch "${e.currentBranch}" is behind "${t}". This will rebase and sync with the latest changes`}return e.hasChanges?e.changedFilesCount>0?`Commit ${e.changedFilesCount} changed file${e.changedFilesCount===1?``:`s`}`:`No changes to commit`:e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?`View pull request in GitHub`:e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?`Create pull request for committed changes`:e.hasUnpushedCommits&&e.prExists?`Update pull request with unpushed commits`:`No actions available`}function w(e,t,n=!1){return t||n?!0:e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges?!1:!e.hasChanges&&!e.hasUnpushedCommits}function T(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ne=g();function E(e){let n=(0,Ne.c)(94),{branchStatus:r,remoteUrl:ee,hasRemoteBranch:o,hasUnpushedCommits:te,canCreateRepo:re,repoUrl:le,isRefreshing:c,isBrandState:de,hasChanges:fe,gitUser:pe,isDirectCommitMode:me,autoGenerateCommitMessage:f,isLoading:p,isLoadingHistory:m,isQuickCommitting:ge,onFetch:h,onPull:g,onPush:_,onOpenHistory:v,onCreatePR:y,onCreateRepo:be,onViewInGitHub:x,onQuickCommit:Ce,onOpenChange:we,layout:Ee}=e,Oe=Ee===void 0?`bar`:Ee,ke=Oe===`bar`&&`w-8 rounded-l-none`,S=Oe===`menu`&&`w-full justify-start gap-2 rounded-md`,Ae=de&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,je;n[0]!==ke||n[1]!==S||n[2]!==Ae?(je=ie(`h-8 px-1`,ke,S,Ae),n[0]=ke,n[1]=S,n[2]=Ae,n[3]=je):je=n[3];let Me;n[4]===c?Me=n[5]:(Me=c?(0,C.jsx)(d,{className:`h-3.5 w-3.5 animate-spin`}):(0,C.jsx)(s,{className:`h-3.5 w-3.5`}),n[4]=c,n[5]=Me);let w;n[6]===Oe?w=n[7]:(w=Oe===`menu`&&(0,C.jsx)(`span`,{children:`More git actions`}),n[6]=Oe,n[7]=w);let T;n[8]!==p||n[9]!==je||n[10]!==Me||n[11]!==w?(T=(0,C.jsx)(Te,{asChild:!0,children:(0,C.jsxs)(t,{variant:`outline`,size:`sm`,className:je,disabled:p,children:[Me,w]})}),n[8]=p,n[9]=je,n[10]=Me,n[11]=w,n[12]=T):T=n[12];let E;n[13]!==r||n[14]!==ee?(E=r===`Behind`&&(0,C.jsxs)(`div`,{className:ie(ue.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,ee?`origin`:`remote`]}),n[13]=r,n[14]=ee,n[15]=E):E=n[15];let D;n[16]===pe?D=n[17]:(D=pe&&(0,C.jsxs)(`div`,{className:ie(ue.compact,`px-2 py-1 text-muted-foreground`),children:[(0,C.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,pe]}),n[16]=pe,n[17]=D);let O;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,C.jsx)(ye,{}),n[18]=O):O=n[18];let k;n[19]!==f||n[20]!==fe||n[21]!==p||n[22]!==ge||n[23]!==Ce?(k=fe&&f&&(0,C.jsx)(a,{children:(0,C.jsxs)(ae,{children:[(0,C.jsx)(ne,{asChild:!0,children:(0,C.jsxs)(b,{onClick:Ce,disabled:p||ge,children:[ge?(0,C.jsx)(d,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,C.jsx)(l,{className:`h-3.5 w-3.5 mr-2`}),`Quick Commit`,(0,C.jsx)(xe,{children:`⌘⇧C`})]})}),(0,C.jsx)(se,{side:`right`,children:`Generate the commit message and commit`})]})}),n[19]=f,n[20]=fe,n[21]=p,n[22]=ge,n[23]=Ce,n[24]=k):k=n[24];let Pe;n[25]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=(0,C.jsx)(i,{className:`h-3.5 w-3.5 mr-2`}),n[25]=Pe):Pe=n[25];let A;n[26]!==p||n[27]!==h?(A=(0,C.jsx)(ne,{asChild:!0,children:(0,C.jsxs)(b,{onClick:h,disabled:p,children:[Pe,`Fetch`]})}),n[26]=p,n[27]=h,n[28]=A):A=n[28];let Fe;n[29]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,C.jsx)(se,{side:`right`,children:`Download latest information from remote without merging changes`}),n[29]=Fe):Fe=n[29];let j;n[30]===A?j=n[31]:(j=(0,C.jsx)(a,{children:(0,C.jsxs)(ae,{children:[A,Fe]})}),n[30]=A,n[31]=j);let M;n[32]!==o||n[33]!==p||n[34]!==g?(M=()=>{o&&!p&&g()},n[32]=o,n[33]=p,n[34]=g,n[35]=M):M=n[35];let Ie=!o||p?`opacity-50 cursor-not-allowed`:``,N;n[36]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,C.jsx)(u,{className:`h-3.5 w-3.5 mr-2`}),n[36]=N):N=n[36];let P;n[37]!==M||n[38]!==Ie?(P=(0,C.jsx)(ne,{asChild:!0,children:(0,C.jsxs)(b,{onClick:M,className:Ie,children:[N,`Pull`]})}),n[37]=M,n[38]=Ie,n[39]=P):P=n[39];let Le=o?`Pull latest changes from remote`:`No remote branch to pull from`,F;n[40]===Le?F=n[41]:(F=(0,C.jsx)(se,{side:`right`,children:Le}),n[40]=Le,n[41]=F);let I;n[42]!==P||n[43]!==F?(I=(0,C.jsx)(a,{children:(0,C.jsxs)(ae,{children:[P,F]})}),n[42]=P,n[43]=F,n[44]=I):I=n[44];let L;n[45]!==o||n[46]!==p||n[47]!==_?(L=!o&&(0,C.jsx)(a,{children:(0,C.jsxs)(ae,{children:[(0,C.jsx)(ne,{asChild:!0,children:(0,C.jsxs)(b,{onClick:_,disabled:p,children:[(0,C.jsx)(ce,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,C.jsx)(se,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[45]=o,n[46]=p,n[47]=_,n[48]=L):L=n[48];let R;n[49]!==te||n[50]!==p||n[51]!==_?(R=()=>{te&&!p&&_()},n[49]=te,n[50]=p,n[51]=_,n[52]=R):R=n[52];let Re=!te||p?`opacity-50 cursor-not-allowed`:``,z;n[53]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,C.jsx)(ce,{className:`h-3.5 w-3.5 mr-2`}),n[53]=z):z=n[53];let B;n[54]!==R||n[55]!==Re?(B=(0,C.jsx)(ne,{asChild:!0,children:(0,C.jsxs)(b,{onClick:R,className:Re,children:[z,`Push Commits`]})}),n[54]=R,n[55]=Re,n[56]=B):B=n[56];let ze=te?p?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,V;n[57]===ze?V=n[58]:(V=(0,C.jsx)(se,{side:`right`,children:ze}),n[57]=ze,n[58]=V);let H;n[59]!==B||n[60]!==V?(H=(0,C.jsx)(a,{children:(0,C.jsxs)(ae,{children:[B,V]})}),n[59]=B,n[60]=V,n[61]=H):H=n[61];let Be=p||m,U;n[62]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,C.jsx)(he,{className:`h-3.5 w-3.5 mr-2`}),n[62]=U):U=n[62];let W;n[63]!==v||n[64]!==Be?(W=(0,C.jsxs)(b,{onClick:v,disabled:Be,children:[U,`History`]}),n[63]=v,n[64]=Be,n[65]=W):W=n[65];let G;n[66]!==me||n[67]!==p||n[68]!==y?(G=!me&&(0,C.jsxs)(b,{onClick:y,disabled:p,children:[(0,C.jsx)(ve,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`,(0,C.jsx)(xe,{children:`⌘⇧P`})]}),n[66]=me,n[67]=p,n[68]=y,n[69]=G):G=n[69];let K;n[70]!==re||n[71]!==p||n[72]!==be?(K=re&&(0,C.jsxs)(b,{onClick:be,disabled:p,children:[(0,C.jsx)(_e,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[70]=re,n[71]=p,n[72]=be,n[73]=K):K=n[73];let q;n[74]!==p||n[75]!==x||n[76]!==le?(q=le&&(0,C.jsxs)(b,{onClick:x,disabled:p,children:[(0,C.jsx)(oe,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),n[74]=p,n[75]=x,n[76]=le,n[77]=q):q=n[77];let J;n[78]!==D||n[79]!==k||n[80]!==j||n[81]!==I||n[82]!==L||n[83]!==H||n[84]!==W||n[85]!==G||n[86]!==K||n[87]!==q||n[88]!==E?(J=(0,C.jsxs)(Se,{align:`end`,children:[E,D,O,k,j,I,L,H,W,G,K,q]}),n[78]=D,n[79]=k,n[80]=j,n[81]=I,n[82]=L,n[83]=H,n[84]=W,n[85]=G,n[86]=K,n[87]=q,n[88]=E,n[89]=J):J=n[89];let Ve;return n[90]!==we||n[91]!==J||n[92]!==T?(Ve=(0,C.jsxs)(De,{onOpenChange:we,children:[T,J]}),n[90]=we,n[91]=J,n[92]=T,n[93]=Ve):Ve=n[93],Ve}function D(e){return e?!0:(x({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function O(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function k(e,t,n){let[r,i]=(0,S.useState)(!1),[a,ee]=(0,S.useState)(!1),o=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:O(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,S.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=o();return await m(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),x({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,S.useCallback)(async()=>{if(!e)return null;try{ee(!0);let{provider:t,model:n}=o();return await c(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),x({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{ee(!1)}},[e,n])}}var Pe=(0,S.lazy)(()=>y(()=>import(`./commit-dialog-CF1xviwe.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),A=(0,S.lazy)(()=>y(()=>import(`./pull-request-dialog-DQVVlS8M.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),Fe=(0,S.lazy)(()=>y(()=>import(`./create-repo-dialog-zVm7eDO3.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),j=(0,S.lazy)(()=>y(()=>import(`./git-history-dialog-WU95COhj.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),M=(0,S.lazy)(()=>y(()=>import(`./push-before-pr-dialog-Bi6MHZiO.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),Ie=(0,S.lazy)(()=>y(()=>import(`./pull-with-changes-dialog-DtMvqvd8.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6])));function N(){return null}async function P(e,t,n,r){r&&(await o(e,{title:r}),n({type:we.UpdateThreadTitle,projectId:t,threadId:e,title:r}))}function Le({projectId:e,threadId:i,layout:o=`bar`}){let oe=Ce(),ce=be(e=>e.projectModelSelections[i]),ue=be(t=>t.projects.find(t=>t.projectId===e)),[s,c]=(0,S.useState)(!1),[l,u]=(0,S.useState)(!1),[d,f]=(0,S.useState)(!1),[he,p]=(0,S.useState)(!1),[m,g]=(0,S.useState)(``),[_e,v]=(0,S.useState)(``),[ve,y]=(0,S.useState)(``),[ye,b]=(0,S.useState)(!1),[xe,Se]=(0,S.useState)(null),Te=(0,S.useRef)(!1),De=(0,S.useRef)(!1),Ne=(0,S.useRef)(_e),O=(0,S.useRef)(ve);Ne.current=_e,O.current=ve;let[Le,F]=(0,S.useState)(!1),[I,L]=(0,S.useState)([]),[R,Re]=(0,S.useState)(!1),[z,B]=(0,S.useState)([]),[ze,V]=(0,S.useState)(!1),[H,Be]=(0,S.useState)(!1),[U,W]=(0,S.useState)(``),[G,K]=(0,S.useState)(``),[q,J]=(0,S.useState)(``),[Ve,He]=(0,S.useState)(!1),[Ue,We]=(0,S.useState)(!1),[Ge,Ke]=(0,S.useState)(!1),qe=(0,S.useRef)(!1),Y=Oe(),{fetchUnifiedStatus:Je}=Y,X=k(i,e,ce),Z=(0,S.useRef)(null),Ye=(0,S.useRef)(()=>{}),Xe=(0,S.useRef)(()=>{});(0,S.useEffect)(()=>()=>{Z.current!==null&&(clearInterval(Z.current),Z.current=null)},[]);async function Q(){_();let e=await r();oe({type:we.SetProjects,projects:e.projects})}let[$,Ze]=(0,S.useState)(()=>Ee()),Qe=ue?.commitMethod===fe.Direct;(0,S.useEffect)(()=>{H&&ue?.name&&!U&&W(ue.name)},[H,ue?.name,U]),(0,S.useEffect)(()=>{ke($)},[$]);function $e(){Ve||(He(!0),me().then(e=>J(e)).catch(()=>{}))}(0,S.useEffect)(()=>{if(!d){De.current=!1;return}if(d&&$.autoGenerateCommitMessage&&!m.trim()&&i&&!De.current){De.current=!0;async function e(){let e=await X.generateCommitMessageWithAI();e&&g(e)}e()}},[d,$.autoGenerateCommitMessage,i,X.generateCommitMessageWithAI,m]),(0,S.useEffect)(()=>{if(!he){Te.current=!1;return}if(he&&$.autoGeneratePRInfo&&!Ne.current.trim()&&!O.current.trim()&&i&&!Te.current){Te.current=!0;async function e(){let e=await X.generatePRInfoWithAI();e&&(v(e.title),y(e.description),x({title:`Success`,description:`PR title and description generated`}))}e()}},[he,$.autoGeneratePRInfo,i,X.generatePRInfoWithAI]),Ye.current=rt,Xe.current=()=>p(!0),(0,S.useEffect)(()=>{function e(e){let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&e.shiftKey&&!e.altKey){if(t===`c`){Y.hasChanges&&$.autoGenerateCommitMessage&&!s&&(e.preventDefault(),Ye.current());return}t===`p`&&Y.commitsAheadOfDefault&&!Y.prExists&&!Y.hasChanges&&!s&&!Qe&&(e.preventDefault(),Xe.current())}}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Y.commitsAheadOfDefault,Y.hasChanges,Y.prExists,$.autoGenerateCommitMessage,s,Qe]),(0,S.useEffect)(()=>{l&&Y.prExists&&Y.prState===`OPEN`&&u(!1)},[Y.prExists,Y.prState,l]),(0,S.useEffect)(()=>{if(!l)return;let e=setTimeout(()=>{u(!1)},15e3);return()=>clearTimeout(e)},[l]),(0,S.useEffect)(()=>{let e=Y.prExists&&Y.prState===`OPEN`&&!Y.hasChanges&&!Y.hasUnpushedCommits;e&&!qe.current&&Q(),qe.current=e},[Y.hasChanges,Y.hasUnpushedCommits,Y.prExists,Y.prState]);async function et(){if(m.trim()&&D(i))try{c(!0),await te(i,m),g(``),f(!1),await Y.fetchUnifiedStatus(!0),Q(),x({title:`Changes committed successfully`,description:`Your changes have been committed to '${Y.currentBranch}'.`}),Ge&&(Ke(!1),await st())}catch(e){console.error(`Failed to commit:`,e),x({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{c(!1)}}async function tt(){if(Y.status===`Behind`&&!Y.hasChanges&&!Y.hasUnpushedCommits){await ut();return}if(Y.hasChanges){f(!0);return}if(Y.prExists&&Y.prState===`OPEN`&&!Y.hasChanges&&!Y.hasUnpushedCommits){Y.prUrl&&await h(Y.prUrl);return}if(Y.commitsAheadOfDefault&&!Y.prExists&&!Y.hasChanges){p(!0);return}if(Y.hasUnpushedCommits&&Y.prExists){await at();return}}async function nt(){let e=await X.generateCommitMessageWithAI();e&&g(e)}async function rt(){if(D(i))try{c(!0);let e=await X.generateCommitMessageWithAI();if(!e){x({title:`Quick Commit failed`,description:`Could not generate commit message`,variant:`destructive`});return}await te(i,e),await Y.fetchUnifiedStatus(!0),Q(),x({title:`Changes committed successfully`,description:`Committed: ${e}`})}catch(e){console.error(`Quick commit failed:`,e),x({title:`Quick Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{c(!1)}}async function it(){if(D(i))try{c(!0),await ee(i),await Y.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{c(!1)}}async function at(){if(D(i))try{c(!0),await re(i),await Y.fetchUnifiedStatus(!0),Q(),Y.hasRemoteBranch?x({title:`Branch pushed successfully`,description:`Your branch '${Y.currentBranch}' has been pushed to the remote.`}):x({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),x({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{c(!1)}}async function ot(){if(D(i)){if(Y.hasChanges){We(!0);return}await st()}}async function st(){try{c(!0),await ge(i),await Y.fetchUnifiedStatus(!0),Q(),x({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),x({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{c(!1)}}function ct(){We(!1),Ke(!0),f(!0)}async function lt(){We(!1),await st()}async function ut(){if(D(i))try{c(!0),await de(i),await Y.fetchUnifiedStatus(!0),Q(),x({title:`Branch synced successfully`,description:`Your branch '${Y.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),x({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{c(!1)}}async function dt(){if(D(i))try{c(!0),u(!0);let t=await le(i,_e,ve);await P(i,e,oe,t.title??_e),t.prUrl&&await h(t.prUrl),v(``),y(``),p(!1),await Y.fetchUnifiedStatus(!0),Q();let n=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(n++,n>=6){Z.current!==null&&(clearInterval(Z.current),Z.current=null);return}await Y.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to create PR:`,e);let t=e instanceof Error?e.message:`Failed to create PR`;t.includes(`push the current branch`)||t.includes(`--head flag`)?(p(!1),mt({title:_e,description:ve})):(u(!1),x({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{c(!1)}}async function ft(){if(D(i))try{c(!0);let e=await n(i,U,G,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{h(e.repoUrl)},3e3),W(``),K(``),Be(!1),await Y.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{c(!1)}}async function pt(){let e=await X.generatePRInfoWithAI();e&&(v(e.title),y(e.description),x({title:`Success`,description:`PR title and description generated`}))}async function mt(t){let n=t??xe;if(!(!i||!n))try{c(!0),u(!0);try{await re(i)}catch(e){let t=e?.message??``;if(t.includes(`non-fast-forward`)||t.includes(`Updates were rejected because the tip of your current branch is behind`)){x({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await de(i),await re(i)}catch{throw e}}else throw e}let t=await le(i,n.title,n.description);await P(i,e,oe,t.title??n.title),t.prUrl&&await h(t.prUrl),v(``),y(``),Se(null),b(!1),await Y.fetchUnifiedStatus(!0),Q();let r=0;Z.current!==null&&clearInterval(Z.current),Z.current=setInterval(async()=>{if(r++,r>=6){Z.current!==null&&(clearInterval(Z.current),Z.current=null);return}await Y.fetchUnifiedStatus(!0)},2e3)}catch(e){console.error(`Failed to push and create PR:`,e);let t=e instanceof Error?e.message:`Failed to push and create PR`;u(!1),x({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{c(!1)}}async function ht(){if(D(i))try{Re(!0);let e=await pe(i,100);L(e),B(e.slice(0,10)),F(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{Re(!1)}}function gt(){ze||(V(!0),setTimeout(()=>{let e=z.length+10;B(I.slice(0,e)),V(!1)},300))}function _t(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&z.length<I.length&&!ze&>()}let vt=T(Y);function yt(){Y.repoUrl&&h(Y.repoUrl)}function bt(){b(!1),Se(null)}return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:ie(`flex items-center gap-0`,o===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,C.jsx)(a,{children:(0,C.jsxs)(ae,{children:[(0,C.jsx)(ne,{asChild:!0,children:(0,C.jsxs)(t,{variant:`outline`,size:`sm`,className:ie(`h-8 gap-1.5`,o===`bar`&&`rounded-r-none border-r-0`,o===`menu`&&`rounded-md border`,vt&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:w(Y,s,l),onClick:tt,children:[je(Y,l,s),Ae(Y,l)]})}),(0,C.jsx)(se,{children:Me(Y)})]})}),(0,C.jsx)(E,{branchStatus:Y.status,remoteUrl:Y.remoteUrl,hasRemoteBranch:Y.hasRemoteBranch,hasUnpushedCommits:Y.hasUnpushedCommits,canCreateRepo:Y.canCreateRepo,repoUrl:Y.repoUrl,isRefreshing:Y.isRefreshing,isBrandState:vt,hasChanges:Y.hasChanges,gitUser:q,isDirectCommitMode:Qe,autoGenerateCommitMessage:$.autoGenerateCommitMessage,isLoading:s||l,isLoadingHistory:R,isQuickCommitting:X.isGeneratingMessage&&s,onFetch:()=>void it(),onPull:()=>void ot(),onPush:()=>void at(),onOpenHistory:()=>void ht(),onCreatePR:()=>p(!0),onCreateRepo:()=>Be(!0),onViewInGitHub:yt,onQuickCommit:()=>void rt(),onOpenChange:e=>{e&&($e(),Je(!0))},layout:o})]}),d&&(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(N,{}),children:(0,C.jsx)(Pe,{open:d,onOpenChange:f,commitMessage:m,onCommitMessageChange:g,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Ze(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:X.isGeneratingMessage,isLoading:s,onGenerateMessage:nt,onCommit:et,currentBranch:Y.currentBranch})}),he&&(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(N,{}),children:(0,C.jsx)(A,{open:he,onOpenChange:p,prTitle:_e,onPrTitleChange:v,prDescription:ve,onPrDescriptionChange:y,isGeneratingPRInfo:X.isGeneratingPRInfo,isLoading:s,onGeneratePRInfo:pt,onCreatePR:dt,currentBranch:Y.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Ze(t=>({...t,autoGeneratePRInfo:e}))})}),ye&&(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(N,{}),children:(0,C.jsx)(M,{open:ye,onOpenChange:b,isLoading:s,onPushAndCreatePR:mt,onCancel:bt})}),H&&(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(N,{}),children:(0,C.jsx)(Fe,{open:H,onOpenChange:Be,repoName:U,onRepoNameChange:W,repoDescription:G,onRepoDescriptionChange:K,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Ze(t=>({...t,privateRepositoryDefault:e})),isLoading:s,onCreateRepo:ft})}),Le&&(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(N,{}),children:(0,C.jsx)(j,{open:Le,onOpenChange:F,commits:I,displayedCommits:z,isLoadingMore:ze,onScroll:_t,currentBranch:Y.currentBranch})}),Ue&&(0,C.jsx)(S.Suspense,{fallback:(0,C.jsx)(N,{}),children:(0,C.jsx)(Ie,{open:Ue,onOpenChange:We,onCommitFirst:ct,onStashAndPull:lt,onCancel:()=>We(!1),isLoading:s})})]})}export{Le as GitOpsButton};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{Ai as n,Br as r,Ci as i,Di as a,Ei as o,Fr as s,Hr as c,Ir as l,Jo as u,Lr as d,Mi as f,Nr as p,Oi as m,Pr as h,Ro as g,Ta as _,Ti as v,Ur as y,Vr as b,Xi as x,Xo as S,Yi as C,Yo as w,Zo as T,_ as E,ai as D,bi as O,c as k,ci as A,cs as j,di as M,fi as N,gi as ee,ha as P,hi as F,ii as te,ji as ne,ki as I,l as L,li as R,lo as re,ls as ie,ni as ae,oi as oe,os as se,ot as ce,pi as le,qo as ue,ri as de,s as fe,si as pe,ss as me,ti as he,u as ge,ui as _e,va as ve,vi as ye,wi as be,xi as z,zr as xe}from"./dialogs-config-Cmwn8AP3.js";var B=me(),Se=Object,Ce=Map,we=Set,Te=we.prototype.has,Ee=we.prototype.add,De=Ce.prototype.has,Oe=Ce.prototype.get,ke=Ce.prototype.set,Ae=1,je=2,Me=4,Ne=8,Pe=16,Fe=32,V=`__t`,Ie=`__p`,Le=`__e`,Re=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ze=`http://www.w3.org/1999/xlink`,Be=`http://www.w3.org/2000/xmlns/`,Ve=120,He=new we([`href`,`list`,`form`,`tabIndex`,`download`]),Ue=new we([`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`isindex`,`keygen`,`link`,`menuitem`,`meta`,`nextid`,`param`,`source`,`track`,`wbr`]);if(typeof window>`u`)throw Error(`See http://million.dev/docs/install to install the compiler.`);var H=document;H.createElement(`template`);var We=H.createElement(`template`),Ge=We.content,Ke=H.createElementNS(`http://www.w3.org/2000/svg`,`svg`),qe=Node.prototype,Je=Element.prototype,Ye=CharacterData.prototype,Xe=Se.getOwnPropertyDescriptor,Ze=qe.insertBefore,Qe=qe.cloneNode,$e=qe.replaceChild,et=Je.remove,tt=qe.addEventListener,nt=Je.removeAttribute,rt=Je.setAttribute,it=Je.setAttributeNS,at=Xe(qe,`textContent`).set,ot=Xe(qe,`firstChild`).get,st=Xe(qe,`nextSibling`).get,ct=Xe(Ye,`data`).set,lt=(e,t)=>{let n=t?Ke:We;return n.innerHTML=e,(t?Ke:Ge).firstChild};H[Le]=new we;var ut=(e,t,n)=>{let r=t.toLowerCase(),i=!1;r.endsWith(`capture`)&&(r=r.slice(0,-7),i=!0);let a=`$$${r}`;Te.call(H[Le],r)||(tt.call(H,r,e=>{let t=e.target;for(;t;){let n=t[a];n&&(Se.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t}}),n(e)),t=t.parentNode}},{capture:i}),Ee.call(H[Le],r));let o=t=>{t?`key`in t&&t.key===e[a]?.key||(e[a]=t):e[a]=null};return o(n),o},dt=(e,t)=>{let n=ot.call(e);if(t)for(let e=0;e<t&&n;++e)n=st.call(n);return n},ft=new WeakSet,pt=e=>{if(ft.has(e))return;e.nodeType===8&&e.parentNode?.removeChild(e);let t=ot.call(e);for(;t;)pt(t),t=t.nextSibling;ft.add(e)},mt=(e,t,n)=>{let r=H.createTextNode(t),i=dt(e,n);return Ze.call(e,r,i),r},ht=(e,t)=>{ct.call(e,t)},gt=(e,t,n)=>{typeof n!=`number`||Re.test(t)?e.style[t]=n:typeof n==`string`?e.style.cssText=n:t.startsWith(`-`)?e.style.setProperty(t,String(n)):n==null?e.style[t]=``:e.style[t]=`${String(n)}px`},_t=(e,t,n)=>{t=t.replace(/xlink(?:H|:h)/,`h`).replace(/sName$/,`s`),t.startsWith(`xmlns`)?it.call(e,Be,t,String(n)):t.startsWith(`xlink`)&&it.call(e,ze,`href`,String(n))},vt=(e,t,n)=>{let r=n==null;if(n=r?``:n,t in e&&e[t]!==void 0&&e[t]!==null&&!(e instanceof SVGElement)&&Te.call(He,t))try{e[t]=n}catch{}else !r&&n!==``&&(n!==!1||t.includes(`-`))?rt.call(e,t,String(n)):nt.call(e,t);let i=e instanceof HTMLInputElement,a=e instanceof HTMLSelectElement,o=e instanceof HTMLTextAreaElement;t===`value`&&(i||a||o)&&(rt.call(e,t,String(n)),e.value=n)},yt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]);function bt(e){return yt.get(e)||e}var xt=Object.defineProperty,St=(e,t,n)=>t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t,n)=>(St(e,typeof t==`symbol`?t:t+``,n),n),Ct=class{constructor(){U(this,`r`),U(this,`e`),U(this,`l`),U(this,`g`),U(this,`_u`),U(this,`_t`),U(this,`d`),U(this,`k`),U(this,`c`)}},wt=(e,t=[],n=[])=>{if(typeof e==`string`)return e;if(typeof e==`number`||typeof e==`bigint`||e===!0)return String(e);if(e==null||e===!1)return``;if(typeof e==`object`&&`$`in e)return t.push({p:n,e:[{t:Ae,n:null,v:null,h:e.$,i:0,l:null,p:null,b:null}],i:[]}),`<slot/>`;let r=``,i=``,a={p:n,e:[],i:[]};for(let t in e.props){let n=e.props[t];if(t===`key`||t===`ref`||t===`children`)continue;let i=bt(t);if(i&&(t=i),t===`className`&&(t=`class`),t.startsWith(`on`)){`$`in n?a.e.push({t:Me,n:t.slice(2),v:null,h:n.$,i:null,l:null,p:null,b:null}):a.i.push({t:Me,n:t.slice(2),v:null,h:null,i:null,l:n,p:null,b:null});continue}if(n){if(typeof n==`object`&&`$`in n){t===`style`?a.e.push({t:Ne,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):t.charCodeAt(0)===Ve?a.e.push({t:Pe,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):a.e.push({t:je,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null});continue}if(t===`style`&&typeof n==`object`){let e=``;for(let t in n){if(typeof n[t]==`object`){a.e.push({t:Ne,n:t,v:null,h:n[t].$,i:null,l:null,p:null,b:null});continue}let r=``;for(let e=0,n=t.length;e<n;++e){let n=t.charCodeAt(e);n<97?r+=`-${String.fromCharCode(n+32)}`:r+=t[e]}e+=`${r}:${String(n[t])};`}r+=` style="${e}"`;continue}r+=` ${t}="${String(n)}"`}}if(Te.call(Ue,e.type))return a.e.length&&t.push(a),`<${e.type}${r} />`;let o=!1;for(let r=0,s=e.props.children?.length||0,c=0;r<s;++r){let s=e.props.children?.[r];if(s==null||s===!1)continue;if(typeof s==`object`&&`$`in s){a.e.push({t:Ae,n:null,v:null,h:s.$,i:r,l:null,p:null,b:null});continue}if(s instanceof Ct){a.i.push({t:Fe,n:null,v:null,h:null,i:r,l:null,p:null,b:s});continue}if(typeof s==`string`||typeof s==`number`||typeof s==`bigint`){let e=typeof s==`number`||typeof s==`bigint`?String(s):s;if(o){a.i.push({t:Ae,n:null,v:e,h:null,i:r,l:null,p:null,b:null});continue}o=!0,i+=e,c++;continue}o=!1;let l=n.slice();l.push(c++),i+=wt(s,t,l)}return(a.i.length||a.e.length)&&t.push(a),`<${e.type}${r}>${i}</${e.type}>`},Tt=Object.defineProperty,Et=(e,t,n)=>t in e?Tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dt=(e,t,n)=>(Et(e,typeof t==`symbol`?t:t+``,n),n),Ot=e=>new kt(e),kt=class extends Ct{constructor(e){super(),Dt(this,`b`),this.b=e}v(){}p(e){let t=this.b,n=e.b,r=t.length,i=n.length,a=this.t();if(this===e||i===0&&r===0)return a;if(this.b=n,i===0)return Nt.call(this),a;if(r===0)return jt.call(e,a),a;let o=0,s=0,c=r-1,l=i-1,u=t[0],d=n[0],f=t[c],p=n[l],m;for(;o<=c&&s<=l;){if(!u){u=t[++o];continue}if(!f){f=t[--c];continue}let e=u.k,r=d.k;if(e===r){Vt.call(u,d),n[s]=u,u=t[++o],d=n[++s];continue}let i=f.k,h=p.k;if(i===h){Vt.call(f,p),n[l]=f,f=t[--c],p=n[--l];continue}if(e===h){Vt.call(u,p),n[l]=u;let e=n[l+1];Ht.call(u,e,e?.l||null),u=t[++o],p=n[--l];continue}if(i===r){Vt.call(f,d),n[s]=f;let e=t[o];Ht.call(f,e,e?.l||null),f=t[--c],d=n[++s];continue}if(!m){m=new Ce;for(let e=o;e<=c;e++)ke.call(m,t[e].k,e)}let g=m.get(r);if(g===void 0)Bt.call(d,a,u.l||null);else{let e=t[g];Ht.call(e,u,null),Vt.call(e,d),n[s]=e,t[g]=null}d=n[++s]}if(o<=c||s<=l)if(o>c){let e=n[l+1];for(let t=s;t<=l;++t)Bt.call(n[t],a,e?e.l:null)}else for(let e=o;e<=c;++e)Ut.call(t[e]);return a}m(e,t=null){if(this._t)return this._t;for(let n=0,r=this.b.length;n<r;++n){let r=this.b[n];Bt.call(r,e,t)}return this._t=e,e}x(){let e=this.t();if(e)at.call(e,``);else for(let e=0,t=this.b.length;e<t;++e)Ut.call(this.b[e]);this.b=[]}u(){return!0}s(){return this.b.map(e=>e.s()).join(``)}t(){return this._t||=this.b[0].t(),this._t}},At=kt.prototype,jt=At.m,Mt=At.p,Nt=At.x,Pt=new Proxy({},{get(e,t){return{$:t}}}),Ft=(e,t,n,r)=>{let i=e(Pt),a=[],o=lt(wt(t?t(i):i,a),r);return pt(o),(e,t,r)=>new Lt(o,a,e,t??e?.key??null,r??n??null,null)},It=(e,t)=>{if((`b`in e||`b`in t)&&Mt.call(e,t),e.l||Bt.call(e,void 0,null,null),e.k&&e.k===t.k||e.r===t.r)return Vt.call(e,t);let n=Bt.call(t,e.t(),e.l,null);return Ut.call(e),e.k=t.k,n},Lt=class extends Ct{constructor(e,t,n,r,i,a){super(),this.r=e,this.d=n,this.e=t,this.k=r,this.c=Array(t.length),i?this._u=i:this._u=null,a?this.g=a:this.g=null}m(e,t=null,n){if(this.l)return this.l;let r=n??Qe.call(this.r,!0),i=this.g?.(r);i&&(this.c=i);for(let e=0,t=this.e.length;e<t;++e){let t=this.e[e],a=i?.[e]??Rt(t.p,r,this.c,e);for(let e=0,r=t.e.length;e<r;++e){let i=t.e[e],o=this.d[i.h];if(i.t&Ae){if(o instanceof Ct){let e=dt(a,i.i);n?o.m(a,e,e):o.m(a,e);continue}if(a[V]||(a[V]=Array(r)),o&&typeof o==`object`&&`foreign`in o){if(n){let e=dt(a,i.i);o.reset(e)}let t=o.current;a[V][e]=t,n||Ze.call(a,t,dt(a,i.i));continue}if(n){a[V][e]=dt(a,i.i);continue}a[V][e]=mt(a,o==null||o===!1?``:String(o),i.i)}else if(i.t&Me){let e=ut(a,i.n,o);a[Ie+i.n]=e}else if(i.t&je)vt(a,i.n,o);else if(i.t&Ne)if(typeof o==`string`||typeof o==`number`)gt(a,i.n,o);else for(let e in o)gt(a,e,o[e]);else _t(a,i.n,o)}let o=t.i?.length;if(o)for(let e=0;e<o;++e){let r=t.i[e];if(r.t&Ae)r.v&&!n&&mt(a,r.v,r.i);else if(r.t&Me)ut(a,r.n,r.l);else{let e=dt(a,r.i);n?r.b.m(a,e,e):r.b.m(a,e)}}}return e&&!n&&Ze.call(e,r,t),this.l=r,r}p(e){let t=this.l;if(!e.d)return t;let n=this.d;if(!Wt.call(this,n,e.d))return t;this.d=e.d;for(let r=0,i=this.e.length;r<i;++r){let i=this.e[r],a=this.c[r]??Rt(i.p,t,this.c,r);for(let t=0,o=i.e.length;t<o;++t){let o=i.e[t],s=n[o.h],c=e.d[o.h];if(c!==s){if(o.t&Me){a[Ie+o.n](c);continue}if(o.t&Ae){if(s instanceof Ct){let n=e.e?.[r]?.e[t],i=e.d[n.h];s.p(i);continue}if(c&&typeof c==`object`&&`foreign`in c){let e=a[V][t];if(c.unstable&&s!==c){let n=c.current;a[V][t]=n,$e.call(a,n,e)}else c.current=e;continue}ht(a[V][t],c==null||c===!1?``:String(c))}else if(o.t&je)vt(a,o.n,c);else if(o.t&Ne)if(typeof c==`string`||typeof c==`number`)gt(a,o.n,c);else for(let e in c)c[e]!==s[e]&>(a,e,c[e]);else _t(a,o.n,c)}}}return t}v(e=null,t=null){Ze.call(this.t(),this.l,e?e.l:t)}x(){et.call(this.l),this.l=null}u(e,t){return this._u?this._u(e,t):!0}s(){return String(this.l?.outerHTML)}t(){return this._t||=this.l?.parentElement,this._t}},Rt=(e,t,n,r)=>{let i=e.length;if(!i)return t;let a=n&&r!==void 0;if(a&&n[r])return n[r];for(let n=0;n<i;++n){let r=e[n];t=dt(t,r)}return a&&(n[r]=t),t},zt=Lt.prototype,Bt=zt.m,Vt=zt.p,Ht=zt.v,Ut=zt.x,Wt=zt.u,W=e(ie(),1),Gt={noSlot:!1},Kt=e(j(),1),qt=`slot`,Jt=({effect:e,deps:t})=>((0,W.useEffect)(e,t||[]),null),G=new Map,Yt=(0,W.createContext)(!1),Xt=(e,t,n)=>{let r={ref:t},i=0;for(let t in e){let a=e[t];if((0,W.isValidElement)(a)||Array.isArray(a)&&a.length&&(0,W.isValidElement)(a[0])){r[t]=Qt(a,!1,n,i++);continue}r[t]=e[t]}return r},Zt=(e,t)=>(0,W.createElement)(qt,{suppressHydrationWarning:!0,id:t},e),Qt=(e,t,n,r,i)=>{let a=n?.[r]?.current,o=(0,W.isValidElement)(e)&&typeof e.type==`function`&&`_c`in e.type,s=o&&e.type._c;if(typeof window>`u`)return o?s?e:Zt(Zt(e),i):Zt(e,i);if(s){let t=e.type(e.props);if(G.has(t.type)){let e=G.get(t.type);if(typeof e==`function`)return e(t.props)}}let c=a??(i?document.getElementById(i):null)??document.createElement(`slot`),l={foreign:!0,current:c,portal:(0,Kt.createPortal)((0,W.createElement)(W.Fragment,{children:e}),c,i),reset:e=>{e.childNodes.forEach(t=>e.removeChild(t))},unstable:t};return n&&(n[r]=l),l},$t=e=>{if(typeof e!=`object`||!e||!(`type`in e))return typeof e==`number`?String(e):e;let t=e.type;if(typeof t==`function`)return $t(t(e.props??{}));if(typeof t==`object`&&`$`in t)return t;let n={...e.props};return`css`in n&&`__EMOTION_TYPE_PLEASE_DO_NOT_USE__`in n&&(n.style=n.css.styles,t=n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.__EMOTION_TYPE_PLEASE_DO_NOT_USE__,delete n.css),e.props?.children!=null&&(n.children=en(e.props.children).map(e=>$t(e))),{type:t,props:n}},en=e=>{if(e==null)return[];if(typeof e==`object`&&`type`in e&&e.type===W.Fragment)return en(e.props.children);if(!Array.isArray(e)||typeof e==`object`&&`$`in e)return[e];let t=e.flat(1/0),n=[];for(let e=0,r=t.length;e<r;++e)n.push(...en(t[e]));return n},tn=typeof window>`u`?W.useEffect:W.useLayoutEffect;function nn(e,t,n){if(!e||t(e))return e;let r=n?e.return:e.child;for(;r;){let e=nn(r,t,n);if(e)return e;r=n?null:r.sibling}}function rn(){let e=(0,W.useRef)();return(0,W.useState)(()=>{let t=Function.prototype.bind;Function.prototype.bind=function(n,r){return n===null&&typeof r?.type==`function`&&(e.current=r,Function.prototype.bind=t),t.apply(this,arguments)}}),e.current}function an(e){let t=rn(),n=(0,W.useRef)({el:null,depth:0});return tn(()=>{n.current.el=nn(t,t=>(n.current.depth++,typeof t.type==`string`&&(e===void 0||t.type===e)),!0)?.stateNode},[t]),n}function on(){let e=rn(),t=(0,W.useRef)({el:null,depth:0});return tn(()=>{t.current.el=nn(e,e=>(t.current.depth++,e.stateNode?.containerInfo!=null),!0)?.stateNode.containerInfo},[e]),t}var sn=(e,t={})=>{let n=t?.experimental_noSlot??Gt.noSlot,r=t?.block,i=t?.svg?`g`:qt;e&&(r=Ft(e,$t,t?.shouldUpdate,t?.svg));let a=(e,a)=>{let o=on(),s=an(),c=e._hmr,l=(0,W.useRef)(null),u=(0,W.useRef)(null),d=(0,W.useRef)([]);e=Xt(e,a,d.current),u.current?.(e);let f=(0,W.useCallback)(()=>{if(!l.current&&!n)return;let i=r(e,e.key);return c&&l.current?.textContent&&(l.current.textContent=``),n&&(l.current=s.current?.el??o.current?.el,(e.scoped||s.current&&o.current&&s.current.depth>o.current.depth)&&(l.current=o.current.el),l.current.childNodes.length&&console.error(Error(`\`experimental_options.noSlot\` does not support having siblings at the moment.
|
|
2
|
+
The block element should be the only child of the \`${Qe.call(l.current).outerHTML}\` element.
|
|
3
|
+
To avoid this error, \`experimental_options.noSlot\` should be false`))),(u.current===null||c)&&(Bt.call(i,l.current,null),u.current=e=>{It(i,r(e,e.key,t?.shouldUpdate))}),()=>{Ut.call(i)}},[]),p=(0,W.useMemo)(()=>n?null:(0,W.createElement)(t?.as??i,{ref:l}),[]),m=d.current.length,h=Array(m);for(let e=0;e<m;++e)h[e]=d.current[e]?.portal;return(0,W.createElement)(W.Fragment,{},p,(0,W.createElement)(Jt,{effect:f,deps:c?[c]:[]}),h)};return De.call(G,a)||ke.call(G,a,sn),t?.name&&(e&&(e.displayName=`Million(Render(${t.name}))`),a.displayName=`Million(Block(${t.name}))`),a};(0,W.memo)(({each:e,children:t,memo:n,svg:r,as:i,...a})=>{let o=(0,W.useRef)(null),[s]=(0,W.useState)(()=>({current:Array(e.length)})),c=(0,W.useRef)(null),l=(0,W.useRef)({each:null,children:null,mounted:!1}),[,u]=(0,W.useState)(!1);if(c.current&&(e!==l.current.each||!n)){let r=cn(e,t,l,s,n);Mt.call(c.current,Ot(r))}let d=(0,W.createElement)(W.Fragment,null,(0,W.createElement)(i??(r?`g`:`slot`),{...a,ref:o}),...s.current.map(e=>e.portal));return(0,W.useEffect)(()=>{!o.current||c.current||l.current.mounted||(c.current=Ot(cn(e,t,l,s,n)),De.call(G,d)||ke.call(G,d,c.current),jt.call(c.current,o.current),l.current.mounted=!0,u(!0))},[o.current]),d});var cn=(e,t,n,r,i)=>{let a=Array(e.length),o=n.current;for(let n=0,s=e.length;n<s;++n){if(i&&o.each&&o.each[n]===e[n]){a[n]=o.children?.[n];continue}let s=t(e[n],n);if(De.call(G,s.type)){o.block||=Oe.call(G,s.type),a[n]=o.block(s.props,r,n);continue}if(typeof s.type==`function`&&`_c`in s.type){let e=s.type(s.props);if(De.call(G,e.type)){let t=Oe.call(G,e.type);if(typeof t==`function`){a[n]=t(e.props);continue}}}let c=Ft(e=>e?.scope),l=(e,t,n)=>c({scope:Qt((0,W.createElement)(s.type,e),!1,t.current,n)},s.key?String(s.key):void 0);ke.call(G,s.type,l),o.block=l,a[n]=l(s.props,r,n)}return o.each=e,o.children=a,a};function ln(e,t){return e===t||e!==e&&t!==t}function un(e,t){for(let n in e)if(!ln(e[n],t[n]))return!0;return!1}function dn(e,{portals:t,...n}){let r=`CompiledBlock(Inner(${n.name}))`,i=sn(t=>e(t),{...n,scoped:void 0,name:r,shouldUpdate:un}),a=t?.length||0,o=t&&a>0?e=>{let n=(0,W.useContext)(Yt),[r]=(0,W.useState)(()=>[]),o={...e,scoped:n};for(let e=0;e<a;e++){let n=t[e];o[n]=Qt(o[n],!1,r,e)}let s=[];for(let e=0,t=r.length;e<t;e++)s[e]=r[e].portal;return(0,W.createElement)(W.Fragment,null,(0,W.createElement)(i,o),s)}:e=>(0,W.createElement)(i,e);return n.name&&(o.displayName=`Million(CompiledBlock(Outer(${n.name})))`),o}typeof window<`u`&&(window.__MILLION_DATA__={version:`3.1.11`});var K=se(),fn=`AlertDialog`,[pn,mn]=m(fn,[_e]),q=_e(),hn=e=>{let{__scopeAlertDialog:t,...n}=e,r=q(t);return(0,K.jsx)(oe,{...r,...n,modal:!0})};hn.displayName=fn;var gn=`AlertDialogTrigger`,_n=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(A,{...i,...r,ref:t})});_n.displayName=gn;var vn=`AlertDialogPortal`,yn=e=>{let{__scopeAlertDialog:t,...n}=e,r=q(t);return(0,K.jsx)(D,{...r,...n})};yn.displayName=vn;var bn=`AlertDialogOverlay`,xn=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(te,{...i,...r,ref:t})});xn.displayName=bn;var Sn=`AlertDialogContent`,[Cn,wn]=pn(Sn),Tn=be(`AlertDialogContent`),En=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=q(n),o=W.useRef(null),s=P(t,o),c=W.useRef(null);return(0,K.jsx)(R,{contentName:Sn,titleName:Dn,docsSlug:`alert-dialog`,children:(0,K.jsx)(Cn,{scope:n,cancelRef:c,children:(0,K.jsxs)(ae,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:I(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,K.jsx)(Tn,{children:r}),(0,K.jsx)(Fn,{contentRef:o})]})})})});En.displayName=Sn;var Dn=`AlertDialogTitle`,On=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(pe,{...i,...r,ref:t})});On.displayName=Dn;var kn=`AlertDialogDescription`,An=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(de,{...i,...r,ref:t})});An.displayName=kn;var jn=`AlertDialogAction`,Mn=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=q(n);return(0,K.jsx)(he,{...i,...r,ref:t})});Mn.displayName=jn;var Nn=`AlertDialogCancel`,Pn=W.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=wn(Nn,n),a=q(n),o=P(t,i);return(0,K.jsx)(he,{...a,...r,ref:o})});Pn.displayName=Nn;var Fn=({contentRef:e})=>{let t=`\`${Sn}\` requires a description for the component to be accessible for screen reader users.
|
|
4
|
+
|
|
5
|
+
You can add a description to the \`${Sn}\` by passing a \`${kn}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
6
|
+
|
|
7
|
+
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Sn}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
8
|
+
|
|
9
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return W.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},In=hn,Ln=yn,Rn=xn,zn=En,Bn=Mn,Vn=Pn,Hn=On,Un=An,Wn=In,Gn=Ln,Kn=W.forwardRef((e,t)=>{let n=(0,B.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=f(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Rn,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Kn.displayName=Rn.displayName;var qn=W.forwardRef((e,t)=>{let n=(0,B.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]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(Kn,{}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=f(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,r),n[4]=r,n[5]=o);let s;return n[6]!==i||n[7]!==t||n[8]!==o?(s=(0,K.jsxs)(Gn,{children:[a,(0,K.jsx)(zn,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});qn.displayName=zn.displayName;var Jn=e=>{let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col space-y-2 text-center sm:text-left`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Jn.displayName=`AlertDialogHeader`;var Yn=e=>{let t=(0,B.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=f(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,K.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};Yn.displayName=`AlertDialogFooter`;var Xn=W.forwardRef((e,t)=>{let n=(0,B.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=f(x.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Hn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Xn.displayName=Hn.displayName;var Zn=W.forwardRef((e,t)=>{let n=(0,B.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=f(x.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Un,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Zn.displayName=Un.displayName;var Qn=W.forwardRef((e,t)=>{let n=(0,B.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=f(ne(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Bn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Qn.displayName=Bn.displayName;var $n=W.forwardRef((e,t)=>{let n=(0,B.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=f(ne({variant:`outline`}),`mt-2 sm:mt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Vn,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$n.displayName=Vn.displayName;var er=dn(e=>(0,K.jsxs)(`div`,{className:e.v0,children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`h1`,{className:e.v1,children:e.v2}),e.v3]}),e.v4]}),{name:`PageHeader_1`,portals:[`v2`,`v3`,`v4`]}),tr=function(e){let t=(0,B.c)(12),{title:n,description:r,action:i,className:a,titleClassName:o}=e,s;t[0]===a?s=t[1]:(s=f(`flex items-center justify-between mb-6`,a),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=f(x.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]===r?l=t[5]:(l=r?(0,K.jsx)(`p`,{className:x.pageSubtitle,children:r}):null,t[4]=r,t[5]=l);let u;return t[6]!==i||t[7]!==s||t[8]!==c||t[9]!==l||t[10]!==n?(u=(0,K.jsx)(er,{v0:s,v1:c,v2:n,v3:l,v4:i}),t[6]=i,t[7]=s,t[8]=c,t[9]=l,t[10]=n,t[11]=u):u=t[11],u};function nr(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=f(C.settingsPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,K.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function rr(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=f(C.accountPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,K.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ir(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=f(C.formPage,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,K.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ar(e){let t=(0,B.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=f(x.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,K.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function or(e){let t=(0,B.c)(6),{children:n,variant:r,className:i}=e,a=r===void 0?`info`:r,o;t[0]!==i||t[1]!==a?(o=f(a===`hint`?x.hintBanner:a===`success`?f(x.body,`text-green-700 bg-green-50 dark:text-green-400 dark:bg-green-950/30 rounded-md px-3 py-2 mb-4`):a===`error`?f(x.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):x.infoBanner,i),t[0]=i,t[1]=a,t[2]=o):o=t[2];let s;return t[3]!==n||t[4]!==o?(s=(0,K.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function sr(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=f(`flex-1 overflow-auto`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,K.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function cr(e){let t=(0,B.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,K.jsx)(`h2`,{className:f(x.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,K.jsx)(`p`,{className:x.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,K.jsx)(`div`,{className:`mt-4`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,K.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,K.jsxs)(`div`,{className:`text-center`,children:[a,o,s]})}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function lr(e){let t=(0,B.c)(5),{children:n,className:r}=e,i;t[0]===r?i=t[1]:(i=f(`h-full flex flex-col overflow-hidden`,r),t[0]=r,t[1]=i);let a;return t[2]!==n||t[3]!==i?(a=(0,K.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function ur(e){let t=(0,B.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,K.jsx)(ar,{title:n,className:`mb-1`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,K.jsx)(`p`,{className:x.bodyMuted,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6];let u;t[7]!==i||t[8]!==l?(u=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 mb-3`,children:[l,i]}),t[7]=i,t[8]=l,t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==o||t[12]!==u?(d=(0,K.jsxs)(`div`,{className:o,children:[u,a]}),t[10]=a,t[11]=o,t[12]=u,t[13]=d):d=t[13],d}function dr(e){let t=W.useRef({value:e,previous:e});return W.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var fr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],pr=[` `,`Enter`],mr=`Select`,[hr,gr,_r]=fe(mr),[vr,yr]=m(mr,[_r,y]),br=y(),[xr,J]=vr(mr),[Sr,Cr]=vr(mr),wr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:s,defaultValue:l,onValueChange:u,dir:d,name:f,autoComplete:p,disabled:m,required:h,form:g}=e,_=br(t),[y,b]=W.useState(null),[x,S]=W.useState(null),[C,w]=W.useState(!1),T=ge(d),[E,D]=v({prop:r,defaultProp:i??!1,onChange:a,caller:mr}),[O,k]=v({prop:s,defaultProp:l,onChange:u,caller:mr}),A=W.useRef(null),j=y?g||!!y.closest(`form`):!0,[M,N]=W.useState(new Set),ee=Array.from(M).map(e=>e.props.value).join(`;`);return(0,K.jsx)(c,{..._,children:(0,K.jsxs)(xr,{required:h,scope:t,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:o(),value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:m,children:[(0,K.jsx)(hr.Provider,{scope:t,children:(0,K.jsx)(Sr,{scope:e.__scopeSelect,onNativeOptionAdd:W.useCallback(e=>{N(t=>new Set(t).add(e))},[]),onNativeOptionRemove:W.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),j?(0,K.jsxs)(gi,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:p,value:O,onChange:e=>k(e.target.value),disabled:m,form:g,children:[O===void 0?(0,K.jsx)(`option`,{value:``}):null,Array.from(M)]},ee):null]})})};wr.displayName=mr;var Tr=`SelectTrigger`,Er=W.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=br(n),o=J(Tr,n),s=o.disabled||r,c=P(t,o.onTriggerChange),l=gr(n),u=W.useRef(`touch`),[d,f,p]=vi(e=>{let t=l().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,K.jsx)(xe,{asChild:!0,...a,children:(0,K.jsx)(z.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":_i(o.value)?``:void 0,...i,ref:c,onClick:I(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:I(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:I(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&fr.includes(e.key)&&(m(),e.preventDefault())})})})});Er.displayName=Tr;var Dr=`SelectValue`,Or=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:o,placeholder:s=``,...c}=e,l=J(Dr,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=P(t,l.onValueNodeChange);return a(()=>{u(d)},[u,d]),(0,K.jsx)(z.span,{...c,ref:f,style:{pointerEvents:`none`},children:_i(l.value)?(0,K.jsx)(K.Fragment,{children:s}):o})});Or.displayName=Dr;var kr=`SelectIcon`,Ar=W.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,K.jsx)(z.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Ar.displayName=kr;var jr=`SelectPortal`,Mr=e=>(0,K.jsx)(F,{asChild:!0,...e});Mr.displayName=jr;var Y=`SelectContent`,Nr=W.forwardRef((e,t)=>{let n=J(Y,e.__scopeSelect),[r,i]=W.useState();if(a(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Kt.createPortal((0,K.jsx)(Pr,{scope:e.__scopeSelect,children:(0,K.jsx)(hr.Slot,{scope:e.__scopeSelect,children:(0,K.jsx)(`div`,{children:e.children})})}),t):null}return(0,K.jsx)(Lr,{...e,ref:t})});Nr.displayName=Y;var X=10,[Pr,Z]=vr(Y),Fr=`SelectContentImpl`,Ir=i(`SelectContent.RemoveScroll`),Lr=W.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,v=J(Y,n),[y,b]=W.useState(null),[x,S]=W.useState(null),C=P(t,e=>b(e)),[w,T]=W.useState(null),[E,D]=W.useState(null),O=gr(n),[k,A]=W.useState(!1),j=W.useRef(!1);W.useEffect(()=>{if(y)return M(y)},[y]),le();let F=W.useCallback(e=>{let[t,...n]=O().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&x&&(x.scrollTop=0),n===r&&x&&(x.scrollTop=x.scrollHeight),n?.focus(),document.activeElement!==i))return},[O,x]),te=W.useCallback(()=>F([w,y]),[F,w,y]);W.useEffect(()=>{k&&te()},[k,te]);let{onOpenChange:ne,triggerPointerDownPosRef:L}=v;W.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(L.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(L.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||ne(!1),document.removeEventListener(`pointermove`,t),L.current=null};return L.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[y,ne,L]),W.useEffect(()=>{let e=()=>ne(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ne]);let[R,re]=vi(e=>{let t=O().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ie=W.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&(T(e),r&&(j.current=!0))},[v.value]),ae=W.useCallback(()=>y?.focus(),[y]),oe=W.useCallback((e,t,n)=>{let r=!j.current&&!n;(v.value!==void 0&&v.value===t||r)&&D(e)},[v.value]),se=r===`popper`?Vr:zr,ce=se===Vr?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,K.jsx)(Pr,{scope:n,content:y,viewport:x,onViewportChange:S,itemRefCallback:ie,selectedItem:w,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:te,selectedItemText:E,position:r,isPositioned:k,searchRef:R,children:(0,K.jsx)(N,{as:Ir,allowPinchZoom:!0,children:(0,K.jsx)(ee,{asChild:!0,trapped:v.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:I(i,e=>{v.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,K.jsx)(ye,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:(0,K.jsx)(se,{role:`listbox`,id:v.contentId,"data-state":v.open?`open`:`closed`,dir:v.dir,onContextMenu:e=>e.preventDefault(),..._,...ce,onPlaced:()=>A(!0),ref:C,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:I(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&re(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=O().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>F(t)),e.preventDefault()}})})})})})})});Lr.displayName=Fr;var Rr=`SelectItemAlignedPosition`,zr=W.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,o=J(Y,n),s=Z(Y,n),[c,l]=W.useState(null),[u,d]=W.useState(null),f=P(t,e=>d(e)),p=gr(n),m=W.useRef(!1),h=W.useRef(!0),{viewport:g,selectedItem:_,selectedItemText:v,focusSelectedItem:y}=s,b=W.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&g&&_&&v){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(o.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=L(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=L(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=p(),s=window.innerHeight-X*2,l=g.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),h=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+h+l+b+y,S=Math.min(_.offsetHeight*5,x),C=window.getComputedStyle(g),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=s-E,O=_.offsetHeight/2,k=_.offsetTop+O,A=f+h+k,j=x-A;if(A<=E){let e=a.length>0&&_===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-g.offsetTop-g.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);c.style.height=n+`px`}else{let e=a.length>0&&_===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+g.offsetTop+(e?w:0)+O)+j;c.style.height=t+`px`,g.scrollTop=A-E+g.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,r?.(),requestAnimationFrame(()=>m.current=!0)}},[p,o.trigger,o.valueNode,c,u,g,_,v,o.dir,r]);a(()=>b(),[b]);let[x,S]=W.useState();return a(()=>{u&&S(window.getComputedStyle(u).zIndex)},[u]),(0,K.jsx)(Hr,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:m,onScrollButtonChange:W.useCallback(e=>{e&&h.current===!0&&(b(),y?.(),h.current=!1)},[b,y]),children:(0,K.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,K.jsx)(z.div,{...i,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});zr.displayName=Rr;var Br=`SelectPopperPosition`,Vr=W.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=br(n);return(0,K.jsx)(b,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Vr.displayName=Br;var[Hr,Ur]=vr(Y,{}),Wr=`SelectViewport`,Gr=W.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Z(Wr,n),o=Ur(Wr,n),s=P(t,a.onViewportChange),c=W.useRef(0);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,K.jsx)(hr.Slot,{scope:n,children:(0,K.jsx)(z.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:I(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-X*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Gr.displayName=Wr;var Kr=`SelectGroup`,[qr,Jr]=vr(Kr),Yr=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=o();return(0,K.jsx)(qr,{scope:n,id:i,children:(0,K.jsx)(z.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Yr.displayName=Kr;var Xr=`SelectLabel`,Zr=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Jr(Xr,n);return(0,K.jsx)(z.div,{id:i.id,...r,ref:t})});Zr.displayName=Xr;var Qr=`SelectItem`,[$r,ei]=vr(Qr),ti=W.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...s}=e,c=J(Qr,n),l=Z(Qr,n),u=c.value===r,[d,f]=W.useState(a??``),[p,m]=W.useState(!1),h=P(t,e=>l.itemRefCallback?.(e,r,i)),g=o(),_=W.useRef(`touch`),v=()=>{i||(c.onValueChange(r),c.onOpenChange(!1))};if(r===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,K.jsx)($r,{scope:n,value:r,disabled:i,textId:g,isSelected:u,onItemTextChange:W.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,K.jsx)(hr.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,K.jsx)(z.div,{role:`option`,"aria-labelledby":g,"data-highlighted":p?``:void 0,"aria-selected":u&&p,"data-state":u?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...s,ref:h,onFocus:I(s.onFocus,()=>m(!0)),onBlur:I(s.onBlur,()=>m(!1)),onClick:I(s.onClick,()=>{_.current!==`mouse`&&v()}),onPointerUp:I(s.onPointerUp,()=>{_.current===`mouse`&&v()}),onPointerDown:I(s.onPointerDown,e=>{_.current=e.pointerType}),onPointerMove:I(s.onPointerMove,e=>{_.current=e.pointerType,i?l.onItemLeave?.():_.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:I(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:I(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(pr.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});ti.displayName=Qr;var ni=`SelectItemText`,ri=W.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...o}=e,s=J(ni,n),c=Z(ni,n),l=ei(ni,n),u=Cr(ni,n),[d,f]=W.useState(null),p=P(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),m=d?.textContent,h=W.useMemo(()=>(0,K.jsx)(`option`,{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return a(()=>(g(h),()=>_(h)),[g,_,h]),(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(z.span,{id:l.textId,...o,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Kt.createPortal(o.children,s.valueNode):null]})});ri.displayName=ni;var ii=`SelectItemIndicator`,ai=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return ei(ii,n).isSelected?(0,K.jsx)(z.span,{"aria-hidden":!0,...r,ref:t}):null});ai.displayName=ii;var oi=`SelectScrollUpButton`,si=W.forwardRef((e,t)=>{let n=Z(oi,e.__scopeSelect),r=Ur(oi,e.__scopeSelect),[i,o]=W.useState(!1),s=P(t,r.onScrollButtonChange);return a(()=>{if(n.viewport&&n.isPositioned){let e=function(){o(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,K.jsx)(ui,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});si.displayName=oi;var ci=`SelectScrollDownButton`,li=W.forwardRef((e,t)=>{let n=Z(ci,e.__scopeSelect),r=Ur(ci,e.__scopeSelect),[i,o]=W.useState(!1),s=P(t,r.onScrollButtonChange);return a(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,K.jsx)(ui,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});li.displayName=ci;var ui=W.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,o=Z(`SelectScrollButton`,n),s=W.useRef(null),c=gr(n),l=W.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return W.useEffect(()=>()=>l(),[l]),a(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,K.jsx)(z.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:I(i.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:I(i.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:I(i.onPointerLeave,()=>{l()})})}),di=`SelectSeparator`,fi=W.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,K.jsx)(z.div,{"aria-hidden":!0,...r,ref:t})});fi.displayName=di;var pi=`SelectArrow`,mi=W.forwardRef((e,t)=>{let{__scopeSelect:n,...i}=e,a=br(n),o=J(pi,n),s=Z(pi,n);return o.open&&s.position===`popper`?(0,K.jsx)(r,{...a,...i,ref:t}):null});mi.displayName=pi;var hi=`SelectBubbleInput`,gi=W.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=W.useRef(null),a=P(r,i),o=dr(t);return W.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,K.jsx)(z.select,{...n,style:{...d,...n.style},ref:a,defaultValue:t})});gi.displayName=hi;function _i(e){return e===``||e===void 0}function vi(e){let t=O(e),n=W.useRef(``),r=W.useRef(0),i=W.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=W.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return W.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function yi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=bi(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function bi(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xi=wr,Si=Er,Ci=Or,wi=Ar,Ti=Mr,Ei=Nr,Di=Gr,Oi=Zr,ki=ti,Ai=ri,ji=ai,Mi=si,Ni=li,Pi=fi,Fi=xi,Ii=Ci,Li=W.forwardRef((e,t)=>{let n=(0,B.c)(12),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=f(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(wi,{asChild:!0,children:(0,K.jsx)(S,{className:`h-4 w-4 opacity-50`})}),n[6]=s):s=n[6];let c;return n[7]!==r||n[8]!==a||n[9]!==t||n[10]!==o?(c=(0,K.jsxs)(Si,{ref:t,className:o,...a,children:[r,s]}),n[7]=r,n[8]=a,n[9]=t,n[10]=o,n[11]=c):c=n[11],c});Li.displayName=Si.displayName;var Ri=W.forwardRef((e,t)=>{let n=(0,B.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=f(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(ue,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,K.jsx)(Mi,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});Ri.displayName=Mi.displayName;var zi=W.forwardRef((e,t)=>{let n=(0,B.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=f(`flex cursor-default items-center justify-center py-1`,r),n[3]=r,n[4]=a);let o;n[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(S,{className:`h-4 w-4`}),n[5]=o):o=n[5];let s;return n[6]!==i||n[7]!==t||n[8]!==a?(s=(0,K.jsx)(Ni,{ref:t,className:a,...i,children:o}),n[6]=i,n[7]=t,n[8]=a,n[9]=s):s=n[9],s});zi.displayName=Ni.displayName;var Bi=W.forwardRef((e,t)=>{let n=(0,B.c)(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({className:i,children:r,position:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let s=o===void 0?`popper`:o,c=s===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,l;n[5]!==i||n[6]!==c?(l=f(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,c,i),n[5]=i,n[6]=c,n[7]=l):l=n[7];let u;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(Ri,{}),n[8]=u):u=n[8];let d=s===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,p;n[9]===d?p=n[10]:(p=f(`p-1`,d),n[9]=d,n[10]=p);let m;n[11]!==r||n[12]!==p?(m=(0,K.jsx)(Di,{className:p,children:r}),n[11]=r,n[12]=p,n[13]=m):m=n[13];let h;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(zi,{}),n[14]=h):h=n[14];let g;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==m?(g=(0,K.jsx)(Ti,{children:(0,K.jsxs)(Ei,{ref:t,className:l,position:s,...a,children:[u,m,h]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=m,n[20]=g):g=n[20],g});Bi.displayName=Ei.displayName;var Vi=W.forwardRef((e,t)=>{let n=(0,B.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=f(`py-1.5 pl-8 pr-2 text-base font-semibold`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Oi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Vi.displayName=Oi.displayName;var Hi=W.forwardRef((e,t)=>{let n=(0,B.c)(14),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=f(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-base outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,i),n[4]=i,n[5]=o);let s;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,K.jsx)(ji,{children:(0,K.jsx)(T,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,K.jsx)(Ai,{children:r}),n[7]=r,n[8]=c);let l;return n[9]!==a||n[10]!==t||n[11]!==o||n[12]!==c?(l=(0,K.jsxs)(ki,{ref:t,className:o,...a,children:[s,c]}),n[9]=a,n[10]=t,n[11]=o,n[12]=c,n[13]=l):l=n[13],l});Hi.displayName=ki.displayName;var Ui=W.forwardRef((e,t)=>{let n=(0,B.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=f(`-mx-1 my-1 h-px bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(Pi,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Ui.displayName=Pi.displayName;function Wi(e){let t=(0,B.c)(14),{className:n,label:r,size:i}=e,a=i===void 0?`md`:i,o=a===`sm`?`h-4 w-4`:a===`lg`?`h-8 w-8`:`h-6 w-6`,s;t[0]===n?s=t[1]:(s=f(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=s);let c;t[2]===o?c=t[3]:(c=f(o,`animate-spin mx-auto text-muted-foreground`),t[2]=o,t[3]=c);let l;t[4]===c?l=t[5]:(l=(0,K.jsx)(re,{className:c}),t[4]=c,t[5]=l);let u;t[6]===r?u=t[7]:(u=r?(0,K.jsx)(`p`,{className:f(x.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=u);let d;t[8]!==l||t[9]!==u?(d=(0,K.jsxs)(`div`,{className:`text-center`,children:[l,u]}),t[8]=l,t[9]=u,t[10]=d):d=t[10];let p;return t[11]!==s||t[12]!==d?(p=(0,K.jsx)(`div`,{className:s,children:d}),t[11]=s,t[12]=d,t[13]=p):p=t[13],p}function Gi(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(Ki)}),e[0]=t):t=e[0],t}function Ki(e){return(0,K.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function qi(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}),e[0]=t):t=e[0],t}var Ji=new Map;function Yi(e,t){let n=Ji.get(e);return n||(n={promise:t().catch(t=>{throw Ji.delete(e),t})},Ji.set(e,n)),n.promise}function Xi(e){Ji.delete(e)}function Zi(e){for(let t of Ji.keys())t.startsWith(e)&&Ji.delete(t)}function Qi(e,t){return(0,W.use)(Yi(e,t))}var $i=W.forwardRef((e,t)=>{let n=(0,B.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=f(`rounded-lg border bg-card text-card-foreground shadow-sm`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$i.displayName=`Card`;var ea=W.forwardRef((e,t)=>{let n=(0,B.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=f(`flex flex-col space-y-1.5 p-6`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ea.displayName=`CardHeader`;var ta=W.forwardRef((e,t)=>{let n=(0,B.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=f(x.sectionTitle,`leading-none tracking-tight`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ta.displayName=`CardTitle`;var na=W.forwardRef((e,t)=>{let n=(0,B.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=f(x.bodyMuted,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});na.displayName=`CardDescription`;var ra=W.forwardRef((e,t)=>{let n=(0,B.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=f(`p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ra.displayName=`CardContent`;var ia=W.forwardRef((e,t)=>{let n=(0,B.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=f(`flex items-center p-6 pt-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`div`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ia.displayName=`CardFooter`;var aa=class extends W.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`AsyncErrorBoundary caught an error:`,e,t)}handleRetry=()=>{this.setState({error:null}),this.props.onRetry?.()};render(){let{error:e}=this.state;return e?this.props.renderFallback?this.props.renderFallback(e,this.handleRetry):(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,K.jsxs)($i,{className:`max-w-md`,children:[(0,K.jsx)(ea,{children:(0,K.jsx)(ta,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,K.jsxs)(ra,{className:`space-y-4`,children:[(0,K.jsx)(`p`,{className:x.body,children:e.message}),(0,K.jsx)(n,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},oa=W.forwardRef((e,t)=>{let n=(0,B.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=f(`w-full caption-bottom`,x.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,K.jsx)(`table`,{ref:t,className:a,...i})}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});oa.displayName=`Table`;var sa=W.forwardRef((e,t)=>{let n=(0,B.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=f(`[&_tr]:border-b`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`thead`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});sa.displayName=`TableHeader`;var ca=W.forwardRef((e,t)=>{let n=(0,B.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=f(`[&_tr:last-child]:border-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`tbody`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ca.displayName=`TableBody`;var la=W.forwardRef((e,t)=>{let n=(0,B.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=f(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`tfoot`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});la.displayName=`TableFooter`;var ua=W.forwardRef((e,t)=>{let n=(0,B.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=f(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`tr`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ua.displayName=`TableRow`;var Q=W.forwardRef((e,t)=>{let n=(0,B.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=f(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`th`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Q.displayName=`TableHead`;var $=W.forwardRef((e,t)=>{let n=(0,B.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=f(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`td`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});$.displayName=`TableCell`;var da=W.forwardRef((e,t)=>{let n=(0,B.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=f(x.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,K.jsx)(`caption`,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});da.displayName=`TableCaption`;var fa=t({ConversationHistoryView:()=>Sa,default:()=>Sa}),pa=dn(e=>(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,K.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,K.jsx)(`h3`,{className:e.v0,children:`No history`}),(0,K.jsx)(`p`,{className:e.v1,children:`No conversation history found for this thread.`})]})}),{name:`ConversationHistoryContent_1`}),ma=dn(e=>(0,K.jsxs)(`slot`,{children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.v0,e.v1]}),(0,K.jsxs)(`div`,{className:e.v2,children:[e.v3,` of `,e.v4,` messages`]})]}),e.v5]}),{name:`ConversationHistoryContent_2`,portals:[`v0`,`v1`,`v3`,`v4`,`v5`]}),ha=function(e){let t=(0,B.c)(39),{scope:r,projects:i,loadVersion:a,currentPromptIndex:o,onPromptIndexChange:c}=e,d;t[0]!==a||t[1]!==r?(d=ba(r,a),t[0]=a,t[1]=r,t[2]=d):d=t[2];let m;t[3]!==i||t[4]!==r?(m=()=>xa(r,i),t[3]=i,t[4]=r,t[5]=m):m=t[5];let _=Qi(d,m),v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=function(e){return new Date(e).toLocaleString()},t[6]=v):v=t[6];let y=v,b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(e,t){let n=new Date(e),r=new Date(t).getTime()-n.getTime();if(r<0)return{display:`0:00`,tooltip:`0 seconds`};let i=Math.floor(r/1e3),a=Math.floor(i/60),o=i%60,s=`${a}:${o.toString().padStart(2,`0`)}`,c;return c=a===0?`${o} second${o===1?``:`s`}`:o===0?`${a} minute${a===1?``:`s`}`:`${a} minute${a===1?``:`s`} ${o} second${o===1?``:`s`}`,{display:s,tooltip:c}},t[7]=b):b=t[7];let S=b,C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=C):C=t[8];let T=C,E;t[9]!==o||t[10]!==_.messages||t[11]!==c?(E=function(){_.messages&&o<_.messages.length-1&&c(o+1)},t[9]=o,t[10]=_.messages,t[11]=c,t[12]=E):E=t[12];let D=E,O;t[13]!==o||t[14]!==c?(O=function(){o>0&&c(o-1)},t[13]=o,t[14]=c,t[15]=O):O=t[15];let A=O;if(!_.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(pa,{v0:x.emptyStateTitle,v1:x.bodyMuted}),t[16]=e):e=t[16],e}let j=o===0,M;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,K.jsx)(w,{className:`h-4 w-4 mr-1`}),t[17]=M):M=t[17];let N;t[18]!==A||t[19]!==j?(N=(0,K.jsx)(n,{variant:`outline`,size:`sm`,onClick:A,disabled:j,children:M}),t[18]=A,t[19]=j,t[20]=N):N=t[20];let ee=o>=_.messages.length-1,P;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,K.jsx)(u,{className:`h-4 w-4 ml-1`}),t[21]=P):P=t[21];let F;t[22]!==D||t[23]!==ee?(F=(0,K.jsx)(n,{variant:`outline`,size:`sm`,onClick:D,disabled:ee,children:P}),t[22]=D,t[23]=ee,t[24]=F):F=t[24];let te=o+1,ne=_.messages.length,I;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,K.jsx)(sa,{children:(0,K.jsxs)(ua,{children:[(0,K.jsx)(Q,{children:`Prompt`}),(0,K.jsx)(Q,{children:`Answer`}),(0,K.jsx)(Q,{className:`w-24`,children:`Model`}),(0,K.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,K.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,K.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,K.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[25]=I):I=t[25];let L;if(t[26]!==o||t[27]!==_.messages){let e;t[29]===o?e=t[30]:(e=(e,t)=>{let{inputTokens:n,outputTokens:r}=T(e);return(0,K.jsxs)(ua,{className:t===o?`bg-muted/50`:``,children:[(0,K.jsx)($,{className:`max-w-md`,children:(0,K.jsx)(`div`,{className:x.body,children:(0,K.jsx)(_a,{text:e.request.message})})}),(0,K.jsx)($,{className:`max-w-md`,children:e.response?(0,K.jsx)(`div`,{className:x.body,children:(0,K.jsx)(_a,{text:e.response.content})}):(0,K.jsx)(`span`,{className:f(x.bodyMuted,`italic`),children:`No response`})}),(0,K.jsx)($,{children:(0,K.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(g,{className:`h-3 w-3 text-muted-foreground`}),(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,K.jsx)($,{className:f(x.caption,`text-right`),children:e.response?(0,K.jsx)(s,{children:(0,K.jsxs)(p,{children:[(0,K.jsx)(l,{asChild:!0,children:(0,K.jsx)(`div`,{className:`cursor-help`,children:S(e.timestamp,e.response.completedAt).display})}),(0,K.jsx)(h,{children:(0,K.jsx)(`p`,{children:S(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,K.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,K.jsx)($,{className:f(x.bodyMuted,`text-right`),children:n>0?n.toLocaleString():`-`}),(0,K.jsx)($,{className:f(x.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,K.jsx)($,{className:f(x.bodyMuted,`text-right`),children:y(e.timestamp)})]},e.id)},t[29]=o,t[30]=e),L=_.messages.map(e),t[26]=o,t[27]=_.messages,t[28]=L}else L=t[28];let R;t[31]===L?R=t[32]:(R=(0,K.jsx)(k,{className:`h-full`,children:(0,K.jsx)(`div`,{className:`py-4`,children:(0,K.jsxs)(oa,{children:[I,(0,K.jsx)(ca,{children:L})]})})}),t[31]=L,t[32]=R);let re;return t[33]!==_.messages.length||t[34]!==N||t[35]!==F||t[36]!==te||t[37]!==R?(re=(0,K.jsx)(ma,{v0:N,v1:F,v2:x.bodyMuted,v3:te,v4:ne,v5:R}),t[33]=_.messages.length,t[34]=N,t[35]=F,t[36]=te,t[37]=R,t[38]=re):re=t[38],re},ga=`__ALL_PROJECTS__`;function _a(e){let t=(0,B.c)(8),{text:n,maxLength:r}=e,i=r===void 0?100:r;if(n.length<=i){let e;return t[0]===n?e=t[1]:(e=(0,K.jsx)(K.Fragment,{children:n}),t[0]=n,t[1]=e),e}let a;t[2]!==i||t[3]!==n?(a=n.substring(0,i),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(`span`,{className:`text-muted-foreground ml-2`,children:`...`}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,K.jsxs)(K.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function va(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function ya(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await ce(i.threadId);e?.messages&&(t.push(...e.messages),e.conversationIds&&e.conversationIds.forEach(e=>n.add(e)),e.lastUpdated>r&&(r=e.lastUpdated))}catch(e){console.warn(`Failed to load history for thread ${i.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(n),lastUpdated:r??new Date().toISOString()}}function ba(e,t){return e.type===`thread`?`conversation-history:thread:${e.threadId}:${t}`:e.type===`project`?`conversation-history:project:${e.projectId}:${t}`:`conversation-history:all:${t}`}async function xa(e,t){if(e.type===`thread`)return await ce(e.threadId);if(e.type===`project`){let n=t.find(t=>t.projectId===e.projectId);if(!n||n.threads.length===0)return{threadId:e.projectId,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]};let r=await ya(n.threads);return{threadId:e.projectId,...r}}return{threadId:ga,...await ya(t.flatMap(e=>e.threads))}}var Sa=(0,W.memo)(function({isOpen:e,onClose:t,initialFilter:r,projects:i,inline:a}){let[o,s]=(0,W.useState)(0),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)(``),[f,p]=(0,W.useState)(!1),[m,h]=(0,W.useState)(!1),[g,v]=(0,W.useState)(0),[y,b]=(0,W.useState)(null),[S,C]=(0,W.useState)(null),w=(0,W.useMemo)(()=>u?{type:`thread`,threadId:u}:c===ga?{type:`all`}:c?{type:`project`,projectId:c}:null,[c,u]),T=w?ba(w,g):null;(0,W.useEffect)(()=>{e&&r?r.type===`thread`?(d(r.id),l(``),s(0)):r.type===`project`&&(l(r.id),d(``),s(0)):e&&!r?(l(ga),d(``),s(0)):e||(d(``),l(``),s(0),C(null),b(null))},[e,r]);let D=e=>{d(e),l(``),s(0),b(null),C(null)},O=e=>{l(e),d(``),s(0),b(null),C(null)},k=(0,W.useCallback)(()=>{if(u){let e=i.flatMap(e=>e.threads).find(e=>e.threadId===u),t=i.find(e=>e.threads.some(e=>e.threadId===u)),n=e?va(e,t?.name??t?.projectId??``):u;return{options:{threadId:u},title:`Clear Thread History`,description:`Permanently delete all conversation history for "${n}"? This cannot be undone.`}}if(c&&c!==ga){let e=i.find(e=>e.projectId===c)?.name??c;return{options:{projectId:c},title:`Clear Project History`,description:`Permanently delete all conversation history for "${e}"? This cannot be undone.`}}return{options:void 0,title:`Clear All History`,description:`Permanently delete all conversation history across every project and thread? This cannot be undone.`}},[i,c,u]),A=(0,W.useCallback)(async()=>{let e=k();h(!0),C(null);try{await E(e.options),T&&Xi(T),b(T),s(0),p(!1)}catch(e){C(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{h(!1)}},[k,T]);function j(){w&&Xi(ba(w,g)),v(e=>e+1),b(null),C(null)}let M=k();if(!e)return null;let N=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(Fi,{value:c,onValueChange:O,children:[(0,K.jsx)(Li,{className:`w-48`,children:(0,K.jsx)(Ii,{placeholder:`Select project`})}),(0,K.jsxs)(Bi,{children:[(0,K.jsx)(Hi,{value:ga,children:`All Projects`}),i.map(e=>(0,K.jsx)(Hi,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,K.jsxs)(Fi,{value:u,onValueChange:D,children:[(0,K.jsx)(Li,{className:`w-48`,children:(0,K.jsx)(Ii,{placeholder:`Select thread`})}),(0,K.jsx)(Bi,{children:i.flatMap(e=>e.threads.map(t=>(0,K.jsx)(Hi,{value:t.threadId,children:va(t,e.name??e.projectId)},t.threadId)))})]}),(0,K.jsxs)(n,{variant:`outline`,size:`sm`,onClick:()=>p(!0),disabled:m,children:[(0,K.jsx)(_,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),ee=(0,K.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,K.jsx)(`div`,{className:a?void 0:`border-b px-6 py-4`,children:(0,K.jsx)(tr,{title:`History`,description:a?`View and browse conversation history across projects and threads.`:void 0,action:(0,K.jsxs)(`div`,{className:`flex items-center gap-3`,children:[N,a?null:(0,K.jsx)(n,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,K.jsx)(ve,{})})]})})}),(0,K.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:S?(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,K.jsxs)($i,{className:`max-w-md`,children:[(0,K.jsx)(ea,{children:(0,K.jsx)(ta,{className:`text-destructive`,children:`Error`})}),(0,K.jsxs)(ra,{className:`space-y-4`,children:[(0,K.jsx)(`p`,{children:S}),(0,K.jsx)(n,{onClick:()=>C(null),children:`Dismiss`})]})]})}):y&&y===T?(0,K.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,K.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,K.jsx)(`h3`,{className:x.emptyStateTitle,children:`No history`}),(0,K.jsx)(`p`,{className:x.bodyMuted,children:`No conversation history found for this thread.`})]})}):w?(0,K.jsx)(aa,{fallbackTitle:`Failed to load conversation history`,onRetry:j,children:(0,K.jsx)(W.Suspense,{fallback:(0,K.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`}),children:(0,K.jsx)(ha,{scope:w,projects:i,loadVersion:g,currentPromptIndex:o,onPromptIndexChange:s},T??void 0)})}):(0,K.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`})})]});return(0,K.jsxs)(K.Fragment,{children:[a?(0,K.jsx)(sr,{children:(0,K.jsx)(nr,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:ee})}):(0,K.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:ee}),(0,K.jsx)(Wn,{open:f,onOpenChange:p,children:(0,K.jsxs)(qn,{children:[(0,K.jsxs)(Jn,{children:[(0,K.jsx)(Xn,{children:M.title}),(0,K.jsx)(Zn,{children:M.description})]}),(0,K.jsxs)(Yn,{children:[(0,K.jsx)($n,{disabled:m,children:`Cancel`}),(0,K.jsx)(Qn,{onClick:e=>{e.preventDefault(),A()},disabled:m,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:m?`Clearing...`:`Clear`})]})]})})]})});export{$n as A,ar as C,sr as D,nr as E,Xn as F,dn as I,Zn as M,Yn as N,Wn as O,Jn as P,tr as S,cr as T,dr as _,Qi as a,ur as b,qi as c,Fi as d,Bi as f,Ii as g,Li as h,ra as i,qn as j,Qn as k,Wi as l,Ui as m,aa as n,Xi as o,Hi as p,$i as r,Zi as s,fa as t,Gi as u,rr as v,lr as w,or as x,ir as y};
|