tarsk 0.5.35 → 0.5.37
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 +28 -15
- package/dist/public/assets/{account-view-k5jIArY-.js → account-view-Cn4P1srV.js} +1 -1
- package/dist/public/assets/api-DWU0D34A.js +1 -0
- package/dist/public/assets/{browser-tab-C9kJT-C5.js → browser-tab-DeoHDVON.js} +1 -1
- package/dist/public/assets/commit-dialog-CWb_KVrD.js +1 -0
- package/dist/public/assets/context-menu-C7FTMa2c.js +1 -0
- package/dist/public/assets/create-repo-dialog-BCPrWkIv.js +1 -0
- package/dist/public/assets/{dialogs-config-B4TDFSrS.js → dialogs-config-DZKtVbNK.js} +14 -14
- package/dist/public/assets/diff-view-DL3hFREY.js +3 -0
- package/dist/public/assets/explorer-tab-view-DAs4rpHu.js +2 -0
- package/dist/public/assets/{explorer-tree-uXbr6cCI.js → explorer-tree-BV1LcznV.js} +1 -1
- package/dist/public/assets/explorer-view-BGSxs_-F.js +1 -0
- package/dist/public/assets/git-history-dialog-Bqv0bD41.js +1 -0
- package/dist/public/assets/git-ops-button-DZzOCOr8.js +2 -0
- package/dist/public/assets/history-view-jX3PPID6.js +9 -0
- package/dist/public/assets/index-CbJ3v0Sr.js +65 -0
- package/dist/public/assets/index-jIBJk8xl.css +1 -0
- package/dist/public/assets/mcp-server-card-CTCrhFIS.js +1 -0
- package/dist/public/assets/merged-pr-dialog-B2qqrQ1g.js +1 -0
- package/dist/public/assets/onboarding-CxtzQldG.js +1 -0
- package/dist/public/assets/project-settings-view-B7RBOfiB.js +1 -0
- package/dist/public/assets/providers-list-view-BQFttbEU.js +1 -0
- package/dist/public/assets/pull-request-dialog-BIRSLJAA.js +1 -0
- package/dist/public/assets/pull-with-changes-dialog-LUgd2a4S.js +1 -0
- package/dist/public/assets/push-before-pr-dialog-CFmgu9H_.js +1 -0
- package/dist/public/assets/radio-group-Bd8YbtFD.js +1 -0
- package/dist/public/assets/{react-vendor-unlDVFpU.js → react-vendor-Ba8DSNiO.js} +5 -5
- package/dist/public/assets/settings-general-view-CH-51vI0.js +1 -0
- package/dist/public/assets/settings-instructions-view-D9HZldUk.js +1 -0
- package/dist/public/assets/settings-list-CKPEGohm.js +1 -0
- package/dist/public/assets/settings-mcp-servers-view-o2gqb0qo.js +5 -0
- package/dist/public/assets/{settings-models-skeleton-B_56ozbA.js → settings-models-skeleton-l966LEN8.js} +1 -1
- package/dist/public/assets/{settings-models-view-ms828HDa.js → settings-models-view-m-MDG6JH.js} +1 -1
- package/dist/public/assets/settings-rules-view-tG9JJQzK.js +8 -0
- package/dist/public/assets/settings-skills-view-DLyWp1pq.js +2 -0
- package/dist/public/assets/settings-slash-commands-view-B7OCA_J1.js +1 -0
- package/dist/public/assets/settings-subagents-view-CSkVwd-J.js +2 -0
- package/dist/public/assets/settings-system-prompt-view-Br6r4RXb.js +1 -0
- package/dist/public/assets/settings-view-rUCFRiPR.js +2 -0
- package/dist/public/assets/skeleton-qzmFgKhS.js +1 -0
- package/dist/public/assets/{terminal-panel-Bm5ECpK_.js → terminal-panel-D3Ru16FT.js} +2 -2
- package/dist/public/assets/{ui-components-BZYnvMGc.js → ui-components-f8jJJzEo.js} +1 -1
- package/dist/public/assets/{utils-umVhs9to.js → utils-BlXPFbY9.js} +1 -1
- package/dist/public/assets/{whisper-wasm-Cq5Ofwpd.js → whisper-wasm-EGutPGND.js} +2 -2
- package/dist/public/index.html +12 -9
- package/package.json +1 -1
- package/dist/public/assets/api-OCjPhv01.js +0 -1
- package/dist/public/assets/commit-dialog-8Ce6d3H8.js +0 -1
- package/dist/public/assets/context-menu-CMsWrzLD.js +0 -1
- package/dist/public/assets/create-repo-dialog-CVUtteNS.js +0 -1
- package/dist/public/assets/diff-view-DGfmGlB_.js +0 -3
- package/dist/public/assets/explorer-tab-view-CCXVTkVu.js +0 -2
- package/dist/public/assets/explorer-view-CupxzDId.js +0 -1
- package/dist/public/assets/git-history-dialog-BCGOZ6ua.js +0 -1
- package/dist/public/assets/git-ops-button-BV9X3fo-.js +0 -2
- package/dist/public/assets/history-view-Ds_0e_bx.js +0 -7
- package/dist/public/assets/index-C0lTt0ZK.css +0 -1
- package/dist/public/assets/index-DOsSr4dl.js +0 -65
- package/dist/public/assets/mcp-server-card-DrUUKNXv.js +0 -1
- package/dist/public/assets/merged-pr-dialog-DqWSFdCH.js +0 -1
- package/dist/public/assets/onboarding-DfL8a0LZ.js +0 -1
- package/dist/public/assets/project-settings-view-Cd_l3Lfy.js +0 -1
- package/dist/public/assets/providers-list-view-VXhgM3vp.js +0 -1
- package/dist/public/assets/pull-request-dialog-DZXTHHuh.js +0 -1
- package/dist/public/assets/pull-with-changes-dialog-CYQrwzcw.js +0 -1
- package/dist/public/assets/push-before-pr-dialog-D-ZnRpJi.js +0 -1
- package/dist/public/assets/radio-group-c0sU992r.js +0 -1
- package/dist/public/assets/settings-general-view-DI-lvP0L.js +0 -1
- package/dist/public/assets/settings-instructions-view-kUG32_dT.js +0 -1
- package/dist/public/assets/settings-list-CUbZrggr.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-DmxUO42I.js +0 -5
- package/dist/public/assets/settings-rules-view-Xx0ymfnQ.js +0 -8
- package/dist/public/assets/settings-skills-view-DvPPdsi_.js +0 -2
- package/dist/public/assets/settings-slash-commands-view-BULIAW2o.js +0 -1
- package/dist/public/assets/settings-subagents-view-B7FcLaZT.js +0 -2
- package/dist/public/assets/settings-system-prompt-view-66zf0gRc.js +0 -1
- package/dist/public/assets/settings-view-B4CMq7it.js +0 -2
- package/dist/public/assets/skeleton-BvSNJL9q.js +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ar as t,Ba as n,Ca as r,Dr as i,G as a,Ii as o,Mr as s,Or as c,Q as l,Ta as u,Ua as d,Ut as f,Va as p,c as m,ci as h,co as ee,fr as g,ga as _,ha as v,hr as y,it as b,ji as x,jr as S,kn as C,kt as w,pr as T,sa as E,so as D,ui as O,wi as k,xa as A,xo as j,yo as M}from"./dialogs-config-DZKtVbNK.js";import{C as N}from"./react-vendor-Ba8DSNiO.js";import{t as P}from"./monaco-CZnIWXyV.js";import{c as F}from"./onboarding-CxtzQldG.js";import{O as I,a as te,l as ne,n as L,o as re}from"./history-view-jX3PPID6.js";import{n as ie}from"./utils-BlXPFbY9.js";import{A as ae,D as oe,O as se,a as ce,i as le,j as ue,k as de,n as fe,p as pe,r as me,u as he}from"./index-CbJ3v0Sr.js";import{a as R,n as z,r as ge,t as _e}from"./context-menu-C7FTMa2c.js";var B=e(j(),1),V=M(),H=x();function ve(e){let t=(0,V.c)(17),{children:n,title:r,headerAction:i,footer:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,H.jsx)(`span`,{className:k.sectionTitle,children:r}),t[0]=r,t[1]=o);let s;t[2]===o?s=t[3]:(s=(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:o}),t[2]=o,t[3]=s);let c;t[4]===i?c=t[5]:(c=i&&(0,H.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:i}),t[4]=i,t[5]=c);let l;t[6]!==s||t[7]!==c?(l=(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-6`,children:[s,c]}),t[6]=s,t[7]=c,t[8]=l):l=t[8];let u;t[9]===n?u=t[10]:(u=(0,H.jsx)(m,{className:`flex-1`,children:n}),t[9]=n,t[10]=u);let d;t[11]===a?d=t[12]:(d=a&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:a}),t[11]=a,t[12]=d);let f;return t[13]!==l||t[14]!==u||t[15]!==d?(f=(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[l,u,d]}),t[13]=l,t[14]=u,t[15]=d,t[16]=f):f=t[16],f}function ye(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 be={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},U={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function W(e){return O(O(k.compact,`status-badge font-mono font-semibold`),be[e]??`text-orange-500`)}function G(e){return U[e]??`M`}var xe=I(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`]}),K=I(e=>e.v0,{name:`DiffTree_1`,portals:[`v0`]}),Se=I(e=>e.v0,{name:`DiffTree_2`,portals:[`v0`]}),q=I(e=>e.v0,{name:`DiffTree_3`,portals:[`v0`]}),Ce=function(e){let t=(0,V.c)(32),{treeData:r,files:i,error:a,selectedFileIndex:o,onFileSelect:s,onRevertFile:c}=e,l;t[0]===i?l=t[1]:(l=i.reduce(we,0),t[0]=i,t[1]=l);let u=l,f;t[2]===i?f=t[3]:(f=i.reduce(X,0),t[2]=i,t[3]=f);let m=f,h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=O(k.compact,`text-muted-foreground`),t[4]=h):h=t[4];let ee=i.length,g=i.length===1?``:`s`,_;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=O(k.compact,`text-green-500`),t[5]=_):_=t[5];let v;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=O(k.compact,`text-red-500`),t[6]=v):v=t[6];let y;t[7]!==i.length||t[8]!==g||t[9]!==u||t[10]!==m?(y=(0,H.jsx)(xe,{v0:h,v1:ee,v2:g,v3:_,v4:u,v5:v,v6:m}),t[7]=i.length,t[8]=g,t[9]=u,t[10]=m,t[11]=y):y=t[11];let b=y;if(a){let e;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(e=O(k.compact,`text-destructive text-center`),t[12]=e):e=t[12];let n;t[13]===a?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:a})}),t[13]=a,t[14]=n);let r;return t[15]!==b||t[16]!==n?(r=(0,H.jsx)(K,{v0:(0,H.jsx)(ve,{title:`Review Changes`,headerAction:b,children:n})}),t[15]=b,t[16]=n,t[17]=r):r=t[17],r}if(i.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:O(k.compact,k.bodyMuted,`text-center`),children:`No changes to review`})}),t[18]=e):e=t[18];let n;return t[19]===b?n=t[20]:(n=(0,H.jsx)(Se,{v0:(0,H.jsx)(ve,{title:`Review Changes`,headerAction:b,children:e})}),t[19]=b,t[20]=n),n}let x;t[21]!==i||t[22]!==s||t[23]!==c||t[24]!==o?(x=(e,t)=>{let{isOpen:r,toggle:a}=t,l=!!e.children,u=(0,H.jsxs)(F,{onClick:()=>{l?a():e.fileIndex!==void 0&&s(e.fileIndex)},selected:!l&&e.fileIndex===o,className:`gap-1.5`,children:[l?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(D,{className:O(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-90`)}),r?(0,H.jsx)(p,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(n,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(d,{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}),!l&&e.status&&(0,H.jsx)(`span`,{className:W(e.status),children:G(e.status)})]});return l?u:(0,H.jsxs)(_e,{children:[(0,H.jsx)(R,{asChild:!0,children:u}),(0,H.jsx)(z,{children:(0,H.jsxs)(ge,{onClick:()=>{e.fileIndex!==void 0&&c?.(i[e.fileIndex])},children:[(0,H.jsx)(E,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},t[21]=i,t[22]=s,t[23]=c,t[24]=o,t[25]=x):x=t[25];let S;t[26]!==x||t[27]!==r?(S=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(oe,{nodes:r,defaultOpen:!0,resetKey:r,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:x})}),t[26]=x,t[27]=r,t[28]=S):S=t[28];let C;return t[29]!==b||t[30]!==S?(C=(0,H.jsx)(q,{v0:(0,H.jsx)(ve,{title:`Review Changes`,headerAction:b,children:S})}),t[29]=b,t[30]=S,t[31]=C):C=t[31],C};function J(e){return e.type===`add`}function Y(e,t){return e+t.changes.filter(J).length}function we(e,t){return e+t.hunks.reduce(Y,0)}function Te(e){return e.type===`delete`}function Ee(e,t){return e+t.changes.filter(Te).length}function X(e,t){return e+t.hunks.reduce(Ee,0)}function De(e){let t=(0,V.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,H.jsx)(fe,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function Oe(e){let n=(0,V.c)(36),{open:r,lineNumber:a,lineContent:o,initialComment:l,isEditing:u,onSave:d,onDelete:f,onClose:p}=e,[m,ee]=(0,B.useState)((l===void 0?``:l)??``),g;n[0]!==d||n[1]!==m?(g=()=>{m.trim()&&d(m.trim())},n[0]=d,n[1]=m,n[2]=g):g=n[2];let _=g,v;n[3]===_?v=n[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_())},n[3]=_,n[4]=v);let y=v,b;n[5]===p?b=n[6]:(b=e=>{e||p()},n[5]=p,n[6]=b);let x;n[7]===a?x=n[8]:(x=(0,H.jsx)(S,{children:(0,H.jsxs)(s,{children:[`Comment on line `,a]})}),n[7]=a,n[8]=x);let C;n[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=O(k.compact,`font-mono rounded bg-muted px-3 py-2 text-muted-foreground overflow-x-auto whitespace-pre`),n[9]=C):C=n[9];let w=o||` `,T;n[10]===w?T=n[11]:(T=(0,H.jsx)(`div`,{className:C,children:w}),n[10]=w,n[11]=T);let E;n[12]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>ee(e.target.value),n[12]=E):E=n[12];let D;n[13]!==y||n[14]!==m?(D=(0,H.jsx)(se,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:m,onChange:E,onKeyDown:y,rows:12,className:`resize-none text-base`}),n[13]=y,n[14]=m,n[15]=D):D=n[15];let A;n[16]!==u||n[17]!==f?(A=u&&f&&(0,H.jsx)(h,{variant:`destructive`,size:`sm`,onClick:f,className:`mr-auto`,children:`Delete`}),n[16]=u,n[17]=f,n[18]=A):A=n[18];let j;n[19]===m?j=n[20]:(j=m.trim(),n[19]=m,n[20]=j);let M=!j,N;n[21]!==_||n[22]!==M?(N=(0,H.jsx)(h,{size:`sm`,onClick:_,disabled:M,children:`Save`}),n[21]=_,n[22]=M,n[23]=N):N=n[23];let P;n[24]!==A||n[25]!==N?(P=(0,H.jsxs)(t,{className:`gap-2 sm:gap-0`,children:[A,N]}),n[24]=A,n[25]=N,n[26]=P):P=n[26];let F;n[27]!==D||n[28]!==P||n[29]!==x||n[30]!==T?(F=(0,H.jsxs)(c,{className:`max-w-2xl`,children:[x,T,D,P]}),n[27]=D,n[28]=P,n[29]=x,n[30]=T,n[31]=F):F=n[31];let I;return n[32]!==r||n[33]!==F||n[34]!==b?(I=(0,H.jsx)(i,{open:r,onOpenChange:b,children:F}),n[32]=r,n[33]=F,n[34]=b,n[35]=I):I=n[35],I}function ke(e,t){return`git-diff:${e}:${t}`}function Ae({threadId:e,onExit:t,loadVersion:n}){let i=te(ke(e,n),()=>b(e)),s=ae(),c=ue(e=>e.diffComments),d=ue(e=>e.projectModelSelections),{resolvedTheme:p}=ie(),m=pe(),[x,S]=(0,B.useState)(i.files||[]),[E,j]=(0,B.useState)(null),[M,F]=(0,B.useState)(0),[I,ne]=(0,B.useState)(!1),[L,re]=(0,B.useState)(!1),[oe,se]=(0,B.useState)(!1),[fe,R]=(0,B.useState)(!0),z=(0,B.useRef)(null);(0,B.useEffect)(()=>{R(!0)},[e]);let ge=(0,B.useCallback)(e=>{F(e),m&&R(!1)},[m]),_e=(0,B.useCallback)(()=>{R(!0)},[]),V=m&&!fe,ve=m&&fe,be=m&&!fe,U=(0,B.useMemo)(()=>c[e]??[],[c,e]),W=(0,B.useCallback)(t=>{let n=c[e]??[],r=typeof t==`function`?t(n):t;s({type:de.SetDiffComments,threadId:e,comments:r})},[s,e,c]),[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:I,selectedFileIndex:M,files:x}),X=(0,B.useRef)({original:[],modified:[]}),Ae=(0,B.useRef)(!0);(0,B.useEffect)(()=>{we.current=U},[U]),(0,B.useEffect)(()=>{Te.current=G},[G]),(0,B.useEffect)(()=>{Ee.current={isFullView:I,selectedFileIndex:M,files:x}},[I,M,x]);let je=(0,B.useCallback)(()=>{z.current&&(L?z.current.expand():z.current.collapse())},[L]),Me=(0,B.useCallback)(async()=>{if(e){j(null);try{S((await b(e)).files||[]),F(0)}catch(e){j(e instanceof Error?e.message:`Failed to load diff`)}}},[e]),Ne=(0,B.useCallback)(async t=>{try{await f(e,t.path),await Me()}catch(e){j(e instanceof Error?e.message:`Failed to revert file`)}},[e,Me]),Pe=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((c[e]??[]).length>0){Pe.current=!0;return}w(e).then(t=>{t.diffComments&&t.diffComments.length>0&&s({type:de.SetDiffComments,threadId:e,comments:t.diffComments}),Pe.current=!0}).catch(()=>{Pe.current=!0})},[e]),(0,B.useEffect)(()=>{Pe.current&&C(e,{diffComments:U}).catch(()=>{})},[e,U]);let Fe=(0,B.useMemo)(()=>ye(x),[x]),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
|
+
`),Le=e=>{let t=Z(e);return t?t.startLine<=1:!0},Re=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=x[M],ze=Q?I?Q.oldContent:(()=>{let e=Z(Q);return e?Ie(Q.oldContent,e.startLine,e.endLine):Q.oldContent})():``,Be=Q?I?Q.newContent:(()=>{let e=Z(Q);return e?Ie(Q.newContent,e.startLine,e.endLine):Q.newContent})():``,$=(0,B.useCallback)(()=>{if(!Ae.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,M,I,Q]),(0,B.useEffect)(()=>()=>{Y.current=null,X.current={original:[],modified:[]}},[M]),(0,B.useEffect)(()=>()=>{Ae.current=!1,Y.current&&=(Y.current.getOriginalEditor().getModel()?.dispose(),Y.current.getModifiedEditor().getModel()?.dispose(),Y.current.dispose(),null),X.current={original:[],modified:[]}},[]);let Ve=(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)},[$]),He=(0,B.useCallback)(e=>{if(K&&Q){let t={id:`comment-${Date.now()}`,filePath:Q.path,fileIndex:M,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,M,W]),Ue=(0,B.useCallback)(()=>{q&&(W(e=>e.filter(e=>e.id!==q.id)),J(null))},[q,W]),We=(0,B.useCallback)(e=>{if(U.length===0)return;let t=(e%U.length+U.length)%U.length,n=U[t];xe(t),F(n.fileIndex),m&&R(!1),setTimeout(()=>{let e=Y.current;if(!e)return;let t=x[n.fileIndex];if(!t)return;let r=I?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,x,I,$,m]),Ge=(0,B.useCallback)(()=>{We((G??0)-1)},[We,G]),Ke=(0,B.useCallback)(()=>{We((G??-1)+1)},[We,G]),qe=(0,B.useCallback)(async()=>{let n=d[e];if(!n)try{let e=await l(),t=Object.values(e).flat();if(t.length>0)n=t[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let r=n.id,i=n.provider;try{let{prompt:n}=await a(e,U);W([]),s({type:de.SetPendingChatMessage,message:{threadId:e,message:n,model:r,provider:i}}),t()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[U,d,s,e,t,W]),Je={readOnly:!0,renderSideBySide:!m,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Q&&(I||Le(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)(le,{direction:`horizontal`,children:[(0,H.jsx)(me,{ref:z,defaultSize:m?100:25,minSize:m?50:12,maxSize:m?100:40,collapsible:!0,collapsedSize:0,onCollapse:()=>re(!0),onExpand:()=>re(!1),className:O(`border-r border-transparent`,V&&`hidden`),children:(0,H.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,H.jsx)(Ce,{treeData:Fe,files:x,error:E,selectedFileIndex:M,onFileSelect:ge,onRevertFile:Ne})})}),!m&&(0,H.jsx)(De,{isOpen:!L}),(0,H.jsx)(me,{className:O(`overflow-hidden bg-transparent`,ve&&`hidden`),children:(0,H.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,H.jsxs)(ce,{className:O(`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:[be?(0,H.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:_e,children:[(0,H.jsx)(v,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):(0,H.jsxs)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:je,children:[L?(0,H.jsx)(v,{className:`h-4 w-4`}):(0,H.jsx)(_,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,H.jsx)(`span`,{className:O(k.label,`text-foreground`),children:Q?Q.path:`Review Changes`})]}),(0,H.jsxs)(`div`,{className:O(`flex items-center gap-2`,L&&`ml-0`,!L&&`ml-auto`,`md:ml-auto`),children:[(0,H.jsx)(h,{variant:`ghost`,size:`sm`,onClick:()=>ne(e=>!e),disabled:!Q,className:O(k.compact,`h-8 gap-1 px-2`),children:I?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(A,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(u,{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)(g,{children:[(0,H.jsx)(y,{asChild:!0,children:(0,H.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ge,disabled:(G??0)===0,children:(0,H.jsx)(ee,{className:`h-3 w-3`})})}),(0,H.jsx)(T,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:O(k.caption,`whitespace-nowrap`),children:U.length===1?`1 Comment`:`Comment ${(G??0)+1} of ${U.length}`}),(0,H.jsxs)(g,{children:[(0,H.jsx)(y,{asChild:!0,children:(0,H.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Ke,disabled:(G??0)===U.length-1,children:(0,H.jsx)(D,{className:`h-3 w-3`})})}),(0,H.jsx)(T,{children:`Next comment`})]})]}),U.length>0&&(0,H.jsxs)(g,{children:[(0,H.jsx)(y,{asChild:!0,children:(0,H.jsxs)(h,{size:`sm`,onClick:qe,className:O(k.compact,`h-8 gap-1 px-3 bg-foreground text-background hover:bg-foreground/90`),children:[(0,H.jsx)(r,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(T,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,H.jsx)(N,{height:`100%`,language:Re(Q?.path||``),original:ze,modified:Be,theme:p===`dark`?`vs-dark`:`vs-light`,onMount:Ve,options:Je},`diff-${M}`),(0,H.jsxs)(`div`,{className:`pointer-events-none absolute bottom-4 right-4 z-20 flex flex-col items-end gap-3`,children:[oe&&(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)(h,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>se(!1),children:[(0,H.jsx)(o,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close chat`})]})}),(0,H.jsx)(he,{})]}),!oe&&(0,H.jsxs)(g,{children:[(0,H.jsx)(y,{asChild:!0,children:(0,H.jsxs)(h,{size:`icon`,className:`pointer-events-auto h-12 w-12 rounded-full shadow-lg`,onClick:()=>se(!0),children:[(0,H.jsx)(r,{className:`h-5 w-5`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Open review chat`})]})}),(0,H.jsx)(T,{children:`Chat about this diff`})]})]})]})]})})]})}),(0,H.jsx)(Oe,{open:K!==null||q!==null,lineNumber:q?.lineNumber??K?.lineNumber??0,lineContent:q?.lineContent??K?.lineContent??``,initialComment:q?.comment,isEditing:q!==null,onSave:He,onDelete:Ue,onClose:()=>{Se(null),J(null)}},`${q?.id??``}-${K?.lineNumber??``}-${K?.side??``}`)]})}function je(e){let t=(0,V.c)(11),[n,r]=(0,B.useState)(0),i;t[0]!==n||t[1]!==e.threadId?(i=function(){re(ke(e.threadId,n)),r(Me)},t[0]=n,t[1]=e.threadId,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(ne,{}),t[3]=o):o=t[3];let s=`${e.threadId}:${n}`,c;t[4]!==n||t[5]!==e||t[6]!==s?(c=(0,H.jsx)(B.Suspense,{fallback:o,children:(0,H.jsx)(Ae,{...e,loadVersion:n},s)}),t[4]=n,t[5]=e,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==a||t[9]!==c?(l=(0,H.jsx)(L,{fallbackTitle:`Failed to load review changes`,onRetry:a,children:c}),t[8]=a,t[9]=c,t[10]=l):l=t[10],l}function Me(e){return e+1}export{je as DiffView,je as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-BV1LcznV.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-CbJ3v0Sr.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-jX3PPID6.js","assets/dialogs-config-DZKtVbNK.js","assets/onboarding-CxtzQldG.js","assets/whisper-wasm-EGutPGND.js","assets/react-vendor-Ba8DSNiO.js","assets/utils-BlXPFbY9.js","assets/index-jIBJk8xl.css","assets/api-DWU0D34A.js","assets/context-menu-C7FTMa2c.js","assets/ui-components-f8jJJzEo.js","assets/explorer-view-BGSxs_-F.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{c as ee,ji as t,ui as n,wi as r,xo as i,yo as a}from"./dialogs-config-DZKtVbNK.js";import{r as o}from"./monaco-CZnIWXyV.js";import{l as s,u as c}from"./history-view-jX3PPID6.js";import{C as l,i as u,j as d,n as f,p,r as m}from"./index-CbJ3v0Sr.js";var h=a(),g=e(i(),1),_=t(),v=(0,g.lazy)(()=>o(()=>import(`./explorer-tree-BV1LcznV.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),y=(0,g.lazy)(()=>o(()=>import(`./explorer-view-BGSxs_-F.js`),__vite__mapDeps([15,1,2,3,4,5,6,7,8,9,10,11,12])));function b(){let e=(0,h.c)(44),t=d(x),i=p(),[a,o]=(0,g.useState)(null),[b,S]=(0,g.useState)(!0),{pendingExplorerPath:C,setPendingExplorerPath:w,explorerClearPath:T,setExplorerClearPath:E}=l(),D;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{S(!0)},e[0]=D):D=e[0];let O;e[1]===t?O=e[2]:(O=[t],e[1]=t,e[2]=O),(0,g.useEffect)(D,O);let k;e[3]===i?k=e[4]:(k=e=>{o(e),i&&S(!1)},e[3]=i,e[4]=k);let A=k,j;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>{S(!0)},e[5]=j):j=e[5];let M=j,N,P;e[6]!==i||e[7]!==C||e[8]!==w?(N=()=>{C&&(o({name:C.split(`/`).pop()??C,path:C,type:`file`}),i&&S(!1),w(null))},P=[i,C,w],e[6]=i,e[7]=C,e[8]=w,e[9]=N,e[10]=P):(N=e[9],P=e[10]),(0,g.useEffect)(N,P);let F,I;e[11]!==T||e[12]!==i||e[13]!==a||e[14]!==E?(F=()=>{T&&(a&&(a.path===T||a.path.startsWith(T+`/`))&&(o(null),i&&S(!0)),E(null))},I=[T,i,a,E],e[11]=T,e[12]=i,e[13]=a,e[14]=E,e[15]=F,e[16]=I):(F=e[15],I=e[16]),(0,g.useEffect)(F,I);let L=i&&!b,R=i&&b,z=i?100:25,B=i?50:15,V=i?100:50,H=L&&`hidden`,U;e[17]===H?U=e[18]:(U=n(`overflow-hidden border-r border-border`,H),e[17]=H,e[18]=U);let W;e[19]!==A||e[20]!==a?.path||e[21]!==t?(W=(0,_.jsx)(ee,{className:`h-full`,children:t?(0,_.jsx)(g.Suspense,{fallback:(0,_.jsx)(c,{}),children:(0,_.jsx)(v,{threadId:t,selectedPath:a?.path??null,onNodeSelect:A})}):(0,_.jsx)(`p`,{className:n(r.caption,`px-3 py-4 text-center`),children:`No thread selected.`})}),e[19]=A,e[20]=a?.path,e[21]=t,e[22]=W):W=e[22];let G;e[23]!==V||e[24]!==U||e[25]!==W||e[26]!==z||e[27]!==B?(G=(0,_.jsx)(m,{defaultSize:z,minSize:B,maxSize:V,className:U,children:W}),e[23]=V,e[24]=U,e[25]=W,e[26]=z,e[27]=B,e[28]=G):G=e[28];let K;e[29]===i?K=e[30]:(K=!i&&(0,_.jsx)(f,{withHandle:!0}),e[29]=i,e[30]=K);let q=R&&`hidden`,J;e[31]===q?J=e[32]:(J=n(`overflow-hidden`,q),e[31]=q,e[32]=J);let Y;e[33]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,_.jsx)(s,{}),e[33]=Y):Y=e[33];let X=i&&!b,Z;e[34]!==a||e[35]!==X?(Z=(0,_.jsx)(g.Suspense,{fallback:Y,children:(0,_.jsx)(y,{selectedFile:a,showTreeBackButton:X,onShowTree:M})}),e[34]=a,e[35]=X,e[36]=Z):Z=e[36];let Q;e[37]!==J||e[38]!==Z?(Q=(0,_.jsx)(m,{className:J,children:Z}),e[37]=J,e[38]=Z,e[39]=Q):Q=e[39];let $;return e[40]!==G||e[41]!==K||e[42]!==Q?($=(0,_.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,_.jsxs)(u,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[G,K,Q]})}),e[40]=G,e[41]=K,e[42]=Q,e[43]=$):$=e[43],$}function x(e){return e.selectedThreadId}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ia as t,Na as n,Pa as r,Ti as i,Zi as a,br as o,eo as s,fo as c,ii as l,mo as u,no as d,vi as f}from"./dialogs-config-B4TDFSrS.js";import{u as p}from"./onboarding-DfL8a0LZ.js";import{A as m,F as h,M as g,O as _,a as v,c as y,j as b,k as x,n as S,o as C,u as w}from"./history-view-Ds_0e_bx.js";import{C as T,E,b as D,x as ee,y as O}from"./index-DOsSr4dl.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-CMsWrzLD.js";import{n as P,o as F,r as I,s as L,t as R}from"./api-OCjPhv01.js";import{t as z}from"./ui-components-BZYnvMGc.js";var B=c(),V=e(u(),1),H=i(),U=V.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=l(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});U.displayName=z.displayName;var W=V.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 o;n[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,H.jsx)(a,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=o):o=n[3];let s;n[4]===r?s=n[5]:(s=l(`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]=s);let c;return n[6]!==i||n[7]!==t||n[8]!==s?(c=(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[o,(0,H.jsx)(z.Input,{ref:t,className:s,...i})]}),n[6]=i,n[7]=t,n[8]=s,n[9]=c):c=n[9],c});W.displayName=z.Input.displayName;var G=V.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=l(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});G.displayName=z.List.displayName;var K=V.forwardRef((e,t)=>{let n=(0,B.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=l(f.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,H.jsx)(z.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});K.displayName=z.Empty.displayName;var q=V.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=l(`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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=z.Group.displayName;var J=V.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=l(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});J.displayName=z.Separator.displayName;var Y=V.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=l(l(f.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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=z.Item.displayName;var te=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=l(f.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,H.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};te.displayName=`CommandShortcut`;var X=100,ne=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function Z(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function Q(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(Z(n,t)&&(r.push(n.node),r.length>=ne))break;return r.sort((e,t)=>ie(e,t,n)).slice(0,X)}function ie(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 ae(e){let r=(0,B.c)(38),{items:i,isReady:a,onRequestIndex:s,onOpenChange:c,onSelect:u}=e,d=a===void 0?!1:a,p=(0,V.useRef)(null),m=(0,V.useRef)(!1),h=(0,V.useRef)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),b=(0,V.useDeferredValue)(v),x;r[0]===s?x=r[1]:(x=function(){h.current||(h.current=!0,s())},r[0]=s,r[1]=x);let S=x,C;r[2]!==b||r[3]!==i?(C=Q(i,re(b),b),r[2]=b,r[3]=i,r[4]=C):C=r[4];let w=C,T,E;r[5]!==c||r[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},E=[c,v],r[5]=c,r[6]=v,r[7]=T,r[8]=E):(T=r[7],E=r[8]),(0,V.useEffect)(T,E);let k;r[9]===c?k=r[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},r[9]=c,r[10]=k);let A=k,j;r[11]!==c||r[12]!==u?(j=function(e){u(e),_(!1),c(!1),y(``)},r[11]=c,r[12]=u,r[13]=j):j=r[13];let M=j,N;r[14]===S?N=r[15]:(N=e=>{S(),y(e.target.value)},r[14]=S,r[15]=N);let P;r[16]!==v||r[17]!==S||r[18]!==N?(P=(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(o,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),r[16]=v,r[17]=S,r[18]=N,r[19]=P):P=r[19];let F;r[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=l(f.compact,`py-4`),r[20]=F):F=r[20];let I=d?`No matches found.`:`Indexing files and folders...`,L;r[21]===I?L=r[22]:(L=(0,H.jsx)(K,{className:F,children:I}),r[21]=I,r[22]=L);let R;if(r[23]!==M||r[24]!==w){let e;r[26]===M?e=r[27]:(e=e=>(0,H.jsxs)(Y,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,H.jsx)(n,{className:`h-4 w-4 text-muted-foreground`}):(0,H.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate`,children:e.name}),(0,H.jsx)(`div`,{className:l(f.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),r[26]=M,r[27]=e),R=w.map(e),r[23]=M,r[24]=w,r[25]=R}else R=r[25];let z;r[28]===R?z=r[29]:(z=(0,H.jsx)(q,{children:R}),r[28]=R,r[29]=z);let W;r[30]!==L||r[31]!==z?(W=(0,H.jsx)(D,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:$,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,H.jsx)(U,{shouldFilter:!1,children:(0,H.jsxs)(G,{children:[L,z]})})}),r[30]=L,r[31]=z,r[32]=W):W=r[32];let J;return r[33]!==A||r[34]!==g||r[35]!==W||r[36]!==P?(J=(0,H.jsxs)(O,{open:g,onOpenChange:A,children:[P,W]}),r[33]=A,r[34]=g,r[35]=W,r[36]=P,r[37]=J):J=r[37],J}function $(e){return e.preventDefault()}function oe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function se(e){let t=(0,B.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=oe(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=()=>F(n,r).then(ce),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=v(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,H.jsx)(H.Fragment,{children:l}),t[10]=l,t[11]=u),u}function ce(e){return e.entries}function le(e){let t=(0,B.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,V.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,V.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,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==f?(g=(0,H.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:ue}),t[8]=n,t[9]=h,t[10]=f,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,H.jsxs)(p,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function ue(e){return e.stopPropagation()}function de(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var fe=(0,V.memo)(function e({node:i,level:a,threadId:o,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T}){let E=l.has(i.path),D=f===i.path,ee=m?.dirPath===i.path&&E;return i.type===`folder`?(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(p,{level:a,basePadding:10,selected:c===i.path,className:i.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(i)},children:[(0,H.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,H.jsx)(d,{className:`h-3 w-3`}):(0,H.jsx)(s,{className:`h-3 w-3`})}),D?(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:i.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(i,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(i,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:i.name})]})]}),E&&(0,H.jsx)(`div`,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(y,{}),children:(0,H.jsx)(se,{threadId:o,dirPath:i.path,version:u(i.path),children:r=>(0,H.jsxs)(H.Fragment,{children:[ee&&(0,H.jsx)(le,{defaultValue:``,level:a+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:w,onCancel:T}),r.map(t=>(0,H.jsx)(e,{node:t,level:a+1,threadId:o,selectedPath:c,expandedPaths:l,getDirVersion:u,renamingPath:f,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T},t.path))]})})})})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>S(i.path),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>C(i.path),children:`New Folder...`}),(0,H.jsx)(A,{}),(0,H.jsx)(M,{onSelect:()=>_(i),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(i),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(p,{level:a,basePadding:22,selected:c===i.path,className:i.ignored?`opacity-50`:void 0,onClick:()=>g(i),children:[(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:i.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(i,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(i,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:i.name})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>_(i),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(i),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),pe=new Map;function me({threadId:e,selectedPath:r,onNodeSelect:i}){let[a,o]=(0,V.useState)(()=>new Map([[``,0]])),[s,c]=(0,V.useState)(new Set),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),[p,v]=(0,V.useState)(null),[y,D]=(0,V.useState)(!1),[ee,O]=(0,V.useState)([]),[A,z]=(0,V.useState)(!1),[B,U]=(0,V.useState)(!1),W=(0,V.useRef)(null),G=(0,V.useRef)(0),K=(0,V.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J}=T(),Y=(0,V.useMemo)(()=>`${e}:${q}`,[q,e]),te=(0,V.useCallback)(e=>{(0,V.startTransition)(()=>{D(t=>t===e?t:e)})},[]),X=(0,V.useCallback)(async()=>{if(!e)return;let t=pe.get(Y);if(t){O(t),z(!0);return}if(W.current!==Y){W.current=Y,O([]),z(!1);try{let t=de((await F(e,``,!0)).entries);pe.set(Y,t),O(t),z(!0)}catch{O([]),z(!1)}finally{W.current===Y&&(W.current=null)}}},[Y,e]),ne=(0,V.useCallback)(()=>{U(!0)},[]),re=(0,V.useCallback)(()=>{pe.delete(Y),O([]),z(!1)},[Y]),Z=(0,V.useCallback)(()=>{re(),B&&X()},[re,X,B]),Q=(0,V.useCallback)(e=>a.get(e)??0,[a]),ie=(0,V.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,V.useCallback)(t=>{e&&(C(oe(e,t,Q(t))),ie(t))},[ie,Q,e]),ce=(0,V.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,V.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(o(new Map([[``,0]])),c(new Set),u(null),f(null),G.current=q)},[q,e]),(0,V.useEffect)(()=>{!e||q<=G.current||(G.current=q,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;C(oe(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,V.useEffect)(()=>{O([]),z(!1),U(!1),W.current=null},[Y]),(0,V.useEffect)(()=>{!B||!e||X()},[X,B,e]),(0,V.useEffect)(()=>{if(!J||!e)return;let t=J.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})}},[J,e]);function ue(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 me(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function he(e){v(e)}async function ge(){if(!p)return;let t=p;v(null);try{await I(e,t.path),$(me(t.path)),Z(),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{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function _e(e){f(null),u(e.path)}async function ve(t,n){if(n===t.name){u(null);return}u(null);try{await L(e,t.path,n),$(me(t.path)),Z(),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{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function ye(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 be(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 xe(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await R(e,n,t):await P(e,n,t),$(n),Z()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Se(){f(null)}function Ce(e){ce(e),e.type===`file`&&i(e)}let we=d?.dirPath===``?(0,H.jsx)(le,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,H.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:xe,onCancel:Se}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,H.jsxs)(b,{children:[(0,H.jsx)(h,{children:`Move to Trash`}),(0,H.jsxs)(g,{children:[`Move “`,p?.name,`” to trash?`]}),(0,H.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,H.jsx)(m,{children:`Cancel`}),(0,H.jsx)(x,{onClick:()=>void ge(),children:`Move to Trash`})]})]})}),(0,H.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,H.jsx)(ae,{items:ee,isReady:A,onRequestIndex:ne,onOpenChange:te,onSelect:e=>Ce(e)},Y)}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,disabled:y,children:(0,H.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,H.jsx)(S,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(w,{}),children:(0,H.jsx)(se,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,H.jsxs)(H.Fragment,{children:[we,t.map(t=>(0,H.jsx)(fe,{node:t,level:0,threadId:e,selectedPath:r,expandedPaths:s,getDirVersion:Q,renamingPath:l,newItemIn:d,onToggleFolder:ue,onSelectNode:i,onStartRename:_e,onCommitRename:ve,onCancelRename:()=>u(null),onDelete:he,onNewFile:ye,onNewFolder:be,onCommitNewItem:xe,onCancelNewItem:Se},t.path))]})})})})})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>ye(``),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>be(``),children:`New Folder...`})]})]})]})}export{me as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ba as t,Er as n,Ua as r,Va as i,ji as a,lo as o,ra as s,so as c,ui as l,wi as u,xo as d,yo as f}from"./dialogs-config-DZKtVbNK.js";import{c as p}from"./onboarding-CxtzQldG.js";import{A as m,I as h,M as g,N as _,a as v,c as y,j as b,k as x,n as S,o as C,u as w}from"./history-view-jX3PPID6.js";import{C as T,E,b as D,x as ee,y as O}from"./index-CbJ3v0Sr.js";import{a as k,i as A,n as j,r as M,t as N}from"./context-menu-C7FTMa2c.js";import{n as P,o as F,r as I,s as L,t as R}from"./api-DWU0D34A.js";import{t as z}from"./ui-components-f8jJJzEo.js";var B=f(),V=e(d(),1),H=a(),U=V.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=l(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});U.displayName=z.displayName;var W=V.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,H.jsx)(s,{className:`mr-2 h-4 w-4 shrink-0 opacity-50`}),n[3]=a):a=n[3];let o;n[4]===r?o=n[5]:(o=l(`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]=o);let c;return n[6]!==i||n[7]!==t||n[8]!==o?(c=(0,H.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[a,(0,H.jsx)(z.Input,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=c):c=n[9],c});W.displayName=z.Input.displayName;var G=V.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=l(`max-h-[300px] overflow-y-auto overflow-x-hidden`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.List,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});G.displayName=z.List.displayName;var K=V.forwardRef((e,t)=>{let n=(0,B.c)(4),r;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=l(u.bodyMuted,`py-6 text-center`),n[0]=r):r=n[0];let i;return n[1]!==e||n[2]!==t?(i=(0,H.jsx)(z.Empty,{ref:t,className:r,...e}),n[1]=e,n[2]=t,n[3]=i):i=n[3],i});K.displayName=z.Empty.displayName;var q=V.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=l(`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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Group,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});q.displayName=z.Group.displayName;var J=V.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=l(`-mx-1 h-px bg-border`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Separator,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});J.displayName=z.Separator.displayName;var Y=V.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=l(l(u.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]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,H.jsx)(z.Item,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});Y.displayName=z.Item.displayName;var te=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=l(u.compact,`ml-auto tracking-widest text-muted-foreground`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,H.jsx)(`span`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};te.displayName=`CommandShortcut`;var X=100,ne=500;function re(e){return e.trim().toLowerCase().split(/\s+/).filter(Boolean)}function Z(e,t){return t.length===0?!0:t.every(t=>e.haystack.includes(t))}function Q(e,t,n){if(t.length===0)return[];let r=[];for(let n of e)if(Z(n,t)&&(r.push(n.node),r.length>=ne))break;return r.sort((e,t)=>ie(e,t,n)).slice(0,X)}function ie(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 ae(e){let i=(0,B.c)(38),{items:a,isReady:o,onRequestIndex:s,onOpenChange:c,onSelect:d}=e,f=o===void 0?!1:o,p=(0,V.useRef)(null),m=(0,V.useRef)(!1),h=(0,V.useRef)(!1),[g,_]=(0,V.useState)(!1),[v,y]=(0,V.useState)(``),b=(0,V.useDeferredValue)(v),x;i[0]===s?x=i[1]:(x=function(){h.current||(h.current=!0,s())},i[0]=s,i[1]=x);let S=x,C;i[2]!==b||i[3]!==a?(C=Q(a,re(b),b),i[2]=b,i[3]=a,i[4]=C):C=i[4];let w=C,T,E;i[5]!==c||i[6]!==v?(T=()=>{let e=v.trim().length>0;_(e),m.current!==e&&(m.current=e,c(e))},E=[c,v],i[5]=c,i[6]=v,i[7]=T,i[8]=E):(T=i[7],E=i[8]),(0,V.useEffect)(T,E);let k;i[9]===c?k=i[10]:(k=function(e){e||y(``),_(e),c(e),e&&requestAnimationFrame(()=>p.current?.focus())},i[9]=c,i[10]=k);let A=k,j;i[11]!==c||i[12]!==d?(j=function(e){d(e),_(!1),c(!1),y(``)},i[11]=c,i[12]=d,i[13]=j):j=i[13];let M=j,N;i[14]===S?N=i[15]:(N=e=>{S(),y(e.target.value)},i[14]=S,i[15]=N);let P;i[16]!==v||i[17]!==S||i[18]!==N?(P=(0,H.jsx)(ee,{asChild:!0,children:(0,H.jsx)(`div`,{children:(0,H.jsx)(n,{ref:p,value:v,onPointerDown:S,onChange:N,placeholder:`Search files and folders`,className:`pr-[4px]`})})}),i[16]=v,i[17]=S,i[18]=N,i[19]=P):P=i[19];let F;i[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=l(u.compact,`py-4`),i[20]=F):F=i[20];let I=f?`No matches found.`:`Indexing files and folders...`,L;i[21]===I?L=i[22]:(L=(0,H.jsx)(K,{className:F,children:I}),i[21]=I,i[22]=L);let R;if(i[23]!==M||i[24]!==w){let e;i[26]===M?e=i[27]:(e=e=>(0,H.jsxs)(Y,{value:e.path,onSelect:()=>M(e),className:e.ignored?`opacity-50`:void 0,children:[e.type===`folder`?(0,H.jsx)(t,{className:`h-4 w-4 text-muted-foreground`}):(0,H.jsx)(r,{className:`h-4 w-4 text-muted-foreground`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate`,children:e.name}),(0,H.jsx)(`div`,{className:l(u.compact,`truncate text-muted-foreground`),children:e.path})]})]},e.path),i[26]=M,i[27]=e),R=w.map(e),i[23]=M,i[24]=w,i[25]=R}else R=i[25];let z;i[28]===R?z=i[29]:(z=(0,H.jsx)(q,{children:R}),i[28]=R,i[29]=z);let W;i[30]!==L||i[31]!==z?(W=(0,H.jsx)(D,{align:`start`,side:`bottom`,sideOffset:4,onOpenAutoFocus:$,className:`w-[var(--radix-popover-trigger-width)] p-0`,children:(0,H.jsx)(U,{shouldFilter:!1,children:(0,H.jsxs)(G,{children:[L,z]})})}),i[30]=L,i[31]=z,i[32]=W):W=i[32];let J;return i[33]!==A||i[34]!==g||i[35]!==W||i[36]!==P?(J=(0,H.jsxs)(O,{open:g,onOpenChange:A,children:[P,W]}),i[33]=A,i[34]=g,i[35]=W,i[36]=P,i[37]=J):J=i[37],J}function $(e){return e.preventDefault()}function oe(e,t,n){return`explorer-dir:${e}:${t}:${n}`}function se(e){let t=(0,B.c)(12),{threadId:n,dirPath:r,version:i,children:a}=e,o;t[0]!==r||t[1]!==n||t[2]!==i?(o=oe(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=()=>F(n,r).then(ce),t[4]=r,t[5]=n,t[6]=s):s=t[6];let c=v(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,H.jsx)(H.Fragment,{children:l}),t[10]=l,t[11]=u),u}function ce(e){return e.entries}function le(e){let t=(0,B.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,V.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,V.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,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==f?(g=(0,H.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:f,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`,onClick:ue}),t[8]=n,t[9]=h,t[10]=f,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,H.jsxs)(p,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function ue(e){return e.stopPropagation()}function de(e){return e.map(e=>({node:e,haystack:`${e.name} ${e.path}`.toLowerCase()}))}var fe=(0,V.memo)(function e({node:n,level:a,threadId:s,selectedPath:l,expandedPaths:u,getDirVersion:d,renamingPath:f,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T}){let E=u.has(n.path),D=f===n.path,ee=m?.dirPath===n.path&&E;return n.type===`folder`?(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(p,{level:a,basePadding:10,selected:l===n.path,className:n.ignored?`opacity-50`:void 0,onClick:e=>{e.stopPropagation(),h(n)},children:[(0,H.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:E?(0,H.jsx)(o,{className:`h-3 w-3`}):(0,H.jsx)(c,{className:`h-3 w-3`})}),D?(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(n,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`})]}):(0,H.jsxs)(H.Fragment,{children:[E?(0,H.jsx)(i,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}),(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:n.name})]})]}),E&&(0,H.jsx)(`div`,{children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(y,{}),children:(0,H.jsx)(se,{threadId:s,dirPath:n.path,version:d(n.path),children:n=>(0,H.jsxs)(H.Fragment,{children:[ee&&(0,H.jsx)(le,{defaultValue:``,level:a+1,basePadding:m.type===`folder`?10:22,icon:m.type===`folder`?(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:w,onCancel:T}),n.map(t=>(0,H.jsx)(e,{node:t,level:a+1,threadId:s,selectedPath:l,expandedPaths:u,getDirVersion:d,renamingPath:f,newItemIn:m,onToggleFolder:h,onSelectNode:g,onStartRename:_,onCommitRename:v,onCancelRename:b,onDelete:x,onNewFile:S,onNewFolder:C,onCommitNewItem:w,onCancelNewItem:T},t.path))]})})})})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>S(n.path),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>C(n.path),children:`New Folder...`}),(0,H.jsx)(A,{}),(0,H.jsx)(M,{onSelect:()=>_(n),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(n),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]}):(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,children:(0,H.jsxs)(p,{level:a,basePadding:22,selected:l===n.path,className:n.ignored?`opacity-50`:void 0,onClick:()=>g(n),children:[(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),D?(0,H.jsx)(`input`,{autoFocus:!0,defaultValue:n.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?v(n,t):b()}else e.key===`Escape`&&b()},onBlur:e=>{let t=e.target.value.trim();t?v(n,t):b()},onClick:e=>e.stopPropagation(),className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-base`}):(0,H.jsx)(`span`,{className:`flex-1 truncate`,children:n.name})]})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>_(n),children:`Rename...`}),(0,H.jsx)(M,{onSelect:()=>x(n),className:`text-destructive focus:text-destructive`,children:`Delete`})]})]})}),pe=new Map;function me({threadId:e,selectedPath:n,onNodeSelect:i}){let[a,o]=(0,V.useState)(()=>new Map([[``,0]])),[s,c]=(0,V.useState)(new Set),[l,u]=(0,V.useState)(null),[d,f]=(0,V.useState)(null),[p,v]=(0,V.useState)(null),[y,D]=(0,V.useState)(!1),[ee,O]=(0,V.useState)([]),[A,z]=(0,V.useState)(!1),[B,U]=(0,V.useState)(!1),W=(0,V.useRef)(null),G=(0,V.useRef)(0),K=(0,V.useRef)(null),{explorerRefreshTick:q,pendingExplorerPath:J}=T(),Y=(0,V.useMemo)(()=>`${e}:${q}`,[q,e]),te=(0,V.useCallback)(e=>{(0,V.startTransition)(()=>{D(t=>t===e?t:e)})},[]),X=(0,V.useCallback)(async()=>{if(!e)return;let t=pe.get(Y);if(t){O(t),z(!0);return}if(W.current!==Y){W.current=Y,O([]),z(!1);try{let t=de((await F(e,``,!0)).entries);pe.set(Y,t),O(t),z(!0)}catch{O([]),z(!1)}finally{W.current===Y&&(W.current=null)}}},[Y,e]),ne=(0,V.useCallback)(()=>{U(!0)},[]),re=(0,V.useCallback)(()=>{pe.delete(Y),O([]),z(!1)},[Y]),Z=(0,V.useCallback)(()=>{re(),B&&X()},[re,X,B]),Q=(0,V.useCallback)(e=>a.get(e)??0,[a]),ie=(0,V.useCallback)(e=>{o(t=>{let n=new Map(t);return n.set(e,(t.get(e)??0)+1),n})},[]),$=(0,V.useCallback)(t=>{e&&(C(oe(e,t,Q(t))),ie(t))},[ie,Q,e]),ce=(0,V.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,V.useEffect)(()=>{if(!e)return;let t=K.current!==null&&K.current!==e;K.current=e,t&&(o(new Map([[``,0]])),c(new Set),u(null),f(null),G.current=q)},[q,e]),(0,V.useEffect)(()=>{!e||q<=G.current||(G.current=q,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;C(oe(e,i,n)),r.set(i,n+1)}return r}))},[q,s,e]),(0,V.useEffect)(()=>{O([]),z(!1),U(!1),W.current=null},[Y]),(0,V.useEffect)(()=>{!B||!e||X()},[X,B,e]),(0,V.useEffect)(()=>{if(!J||!e)return;let t=J.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})}},[J,e]);function ue(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 me(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function he(e){v(e)}async function ge(){if(!p)return;let t=p;v(null);try{await I(e,t.path),$(me(t.path)),Z(),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{E({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function _e(e){f(null),u(e.path)}async function ve(t,n){if(n===t.name){u(null);return}u(null);try{await L(e,t.path,n),$(me(t.path)),Z(),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{E({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function ye(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 be(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 xe(t){if(!d)return;let{dirPath:n,type:r}=d;f(null);try{r===`file`?await R(e,n,t):await P(e,n,t),$(n),Z()}catch{E({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function Se(){f(null)}function Ce(e){ce(e),e.type===`file`&&i(e)}let we=d?.dirPath===``?(0,H.jsx)(le,{defaultValue:``,level:0,basePadding:d.type===`folder`?10:22,icon:d.type===`folder`?(0,H.jsx)(t,{className:`h-4 w-4 flex-shrink-0`}):(0,H.jsx)(r,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:xe,onCancel:Se}):null;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(x,{open:p!==null,onOpenChange:e=>!e&&v(null),children:(0,H.jsxs)(g,{children:[(0,H.jsx)(h,{children:`Move to Trash`}),(0,H.jsxs)(_,{children:[`Move “`,p?.name,`” to trash?`]}),(0,H.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,H.jsx)(b,{children:`Cancel`}),(0,H.jsx)(m,{onClick:()=>void ge(),children:`Move to Trash`})]})]})}),(0,H.jsx)(`div`,{className:`border-b border-border bg-background px-2 py-2`,children:(0,H.jsx)(ae,{items:ee,isReady:A,onRequestIndex:ne,onOpenChange:te,onSelect:e=>Ce(e)},Y)}),(0,H.jsxs)(N,{children:[(0,H.jsx)(k,{asChild:!0,disabled:y,children:(0,H.jsx)(`div`,{className:`py-2 min-h-full`,children:(0,H.jsx)(S,{fallbackTitle:`Failed to load files`,onRetry:()=>$(``),children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(w,{}),children:(0,H.jsx)(se,{threadId:e,dirPath:``,version:Q(``),children:t=>(0,H.jsxs)(H.Fragment,{children:[we,t.map(t=>(0,H.jsx)(fe,{node:t,level:0,threadId:e,selectedPath:n,expandedPaths:s,getDirVersion:Q,renamingPath:l,newItemIn:d,onToggleFolder:ue,onSelectNode:i,onStartRename:_e,onCommitRename:ve,onCancelRename:()=>u(null),onDelete:he,onNewFile:ye,onNewFolder:be,onCommitNewItem:xe,onCancelNewItem:Se},t.path))]})})})})})}),(0,H.jsxs)(j,{children:[(0,H.jsx)(M,{onSelect:()=>ye(``),children:`New File...`}),(0,H.jsx)(M,{onSelect:()=>be(``),children:`New Folder...`})]})]})]})}export{me as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Ea as t,Wa as n,ci as r,gi as i,ha as a,hi as o,ji as s,ui as c,wi as l,xo as u,yo as d}from"./dialogs-config-DZKtVbNK.js";import{S as f}from"./react-vendor-Ba8DSNiO.js";import{O as p,a as m,l as h,n as g,o as _}from"./history-view-jX3PPID6.js";import{n as v}from"./utils-BlXPFbY9.js";import{E as y,a as b,j as x,w as S}from"./index-CbJ3v0Sr.js";import{a as C,c as w,i as T}from"./api-DWU0D34A.js";var E=d(),D=s(),O=e(u(),1),k=p(e=>(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[e.v0,(0,D.jsx)(`p`,{className:e.v1,children:`Select a thread to browse its files`})]}),{name:`ExplorerView_1`,portals:[`v0`]}),A=p(e=>(0,D.jsxs)(`div`,{className:`flex flex-col h-full`,children:[e.v0,(0,D.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,D.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:e.v1})})]}),{name:`ExplorerView_2`,portals:[`v0`,`v1`]}),j=function({selectedFile:e,showTreeBackButton:i=!1,onShowTree:s}){let{resolvedTheme:u}=v(),d=x(e=>e.selectedThreadId),p=(0,O.useRef)(null),[m,C]=(0,O.useState)(null),[T,E]=(0,O.useState)(!1),[j,L]=(0,O.useState)(`edit`),[B,V]=(0,O.useState)(0),H=e?o(e.path,e.name):null,U=e?.type===`file`&&d&&!H?e:null,W=m?.content??``,G=m?.original??``,K=U?`${d}:${U.path}:${B}`:null;(0,O.useEffect)(()=>()=>{p.current&&=(p.current.getModel()?.dispose(),p.current.dispose(),null)},[]),(0,O.useEffect)(()=>{e?.type===`file`?L(M(e.path)?`view`:`edit`):L(`edit`),C(null)},[e?.path,d]);async function q(){if(!(!d||!e)){E(!0);try{await w(d,e.path,W),C({content:W,original:W}),y({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){y({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{E(!1)}}}function J(){!d||!U||(_(P(d,U.path)),C(null),V(e=>e+1))}return d?(0,D.jsx)(A,{v0:(0,D.jsxs)(b,{className:`justify-between`,children:[(0,D.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[i&&s?(0,D.jsxs)(r,{variant:`ghost`,size:`icon`,className:`h-8 w-8 shrink-0 text-muted-foreground electrobun-webkit-app-region-no-drag`,onClick:s,children:[(0,D.jsx)(a,{className:`h-4 w-4`}),(0,D.jsx)(`span`,{className:`sr-only`,children:`Show file tree`})]}):null,(0,D.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,D.jsx)(`span`,{className:c(l.label,`truncate text-foreground`),children:e?e.name:`Select a file to edit`}),(0,D.jsx)(`span`,{className:c(l.compact,`truncate text-muted-foreground`),children:e?e.path:`Browse and edit repository files`})]})]}),U&&m?(0,D.jsxs)(`div`,{className:`flex gap-2`,children:[M(U.path)?(0,D.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,D.jsx)(r,{size:`sm`,variant:j===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>L(`view`),children:`View`}),(0,D.jsx)(r,{size:`sm`,variant:j===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>L(`edit`),children:`Edit`})]}):null,(0,D.jsxs)(r,{size:`sm`,onClick:()=>void q(),disabled:T||!W||W===G,children:[T?(0,D.jsx)(t,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]}):null]}),v1:U?(0,D.jsxs)(g,{fallbackTitle:`Failed to load file`,onRetry:J,children:[(0,D.jsx)(O.Suspense,{fallback:(0,D.jsx)(h,{}),children:(0,D.jsx)(F,{threadId:d,path:U.path,onContentReady:C},K??void 0)}),m?M(U.path)&&j===`view`?(0,D.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,D.jsx)(S,{content:W,enableMermaid:!0})}):(0,D.jsx)(f,{height:`100%`,language:N(U.path),value:W,onChange:e=>C(t=>t&&{...t,content:e??``}),onMount:e=>{p.current=e},theme:u===`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,D.jsx)(h,{})]}):e?.type===`file`&&H===`image`?(0,D.jsx)(g,{fallbackTitle:`Failed to load image`,onRetry:()=>{!d||!e||_(I(d,e.path))},children:(0,D.jsx)(O.Suspense,{fallback:(0,D.jsx)(h,{}),children:(0,D.jsx)(R,{threadId:d,path:e.path,alt:e.name})})}):e?.type===`file`&&H===`video`?(0,D.jsx)(g,{fallbackTitle:`Failed to load video`,onRetry:()=>{!d||!e||_(I(d,e.path))},children:(0,D.jsx)(O.Suspense,{fallback:(0,D.jsx)(h,{}),children:(0,D.jsx)(z,{threadId:d,path:e.path})})}):(0,D.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,D.jsx)(n,{className:`h-10 w-10 text-muted-foreground/50`}),(0,D.jsxs)(`div`,{children:[(0,D.jsx)(`p`,{className:c(l.label,`text-muted-foreground`),children:`No file selected`}),(0,D.jsx)(`p`,{className:c(l.bodyMuted,`mt-1`),children:`Select a file from the tree to edit it`})]})]})}):(0,D.jsx)(k,{v0:(0,D.jsx)(n,{className:`h-8 w-8 text-muted-foreground`}),v1:l.bodyMuted})};function M(e){return i(e)===`md`}function N(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`}[i(e)]??`plaintext`}function P(e,t){return`explorer-file:${e}:${t}`}function F(e){let t=(0,E.c)(10),{threadId:n,path:r,onContentReady:i}=e,a;t[0]!==r||t[1]!==n?(a=P(n,r),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;t[3]!==r||t[4]!==n?(o=()=>C(n,r),t[3]=r,t[4]=n,t[5]=o):o=t[5];let s=m(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,O.useLayoutEffect)(c,l),null}function I(e,t){return`explorer-media:${e}:${t}`}function L(e,t){let n=(0,E.c)(11),r;n[0]!==t||n[1]!==e?(r=I(e,t),n[0]=t,n[1]=e,n[2]=r):r=n[2];let i;n[3]!==t||n[4]!==e?(i=()=>T(e,t),n[3]=t,n[4]=e,n[5]=i):i=n[5];let a=m(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,O.useEffect)(c,l),s}function R(e){let t=(0,E.c)(3),{threadId:n,path:r,alt:i}=e,a=L(n,r),o;return t[0]!==i||t[1]!==a?(o=(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,D.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 z(e){let t=(0,E.c)(2),{threadId:n,path:r}=e,i=L(n,r),a;return t[0]===i?a=t[1]:(a=(0,D.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,D.jsx)(`video`,{src:i,controls:!0,className:`max-w-full max-h-full`})}),t[0]=i,t[1]=a),a}export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ar as e,Dr as t,Ea as n,Mr as r,Or as i,ci as a,ji as o,jr as s,kr as c,ui as l,wi as u,yo as d}from"./dialogs-config-DZKtVbNK.js";var f=d(),p=o();function m(o){let d=(0,f.c)(28),{open:m,onOpenChange:g,commits:_,displayedCommits:v,isLoadingMore:y,onScroll:b,currentBranch:x}=o,S;d[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,p.jsx)(r,{children:`Commit History`}),d[0]=S):S=d[0];let C;d[1]===x?C=d[2]:(C=(0,p.jsxs)(s,{children:[S,(0,p.jsxs)(c,{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:l(u.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)(n,{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:l(u.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)(e,{children:(0,p.jsx)(a,{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)(i,{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)(t,{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:l(u.label,`break-words`),children:e.message}),(0,p.jsxs)(`p`,{className:l(u.bodyMuted,`mt-1`),children:[(0,p.jsx)(`span`,{className:u.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-CWb_KVrD.js","assets/index-CbJ3v0Sr.js","assets/rolldown-runtime-aKtaBQYM.js","assets/monaco-CZnIWXyV.js","assets/monaco-Br_kD0ds.css","assets/history-view-jX3PPID6.js","assets/dialogs-config-DZKtVbNK.js","assets/onboarding-CxtzQldG.js","assets/whisper-wasm-EGutPGND.js","assets/react-vendor-Ba8DSNiO.js","assets/utils-BlXPFbY9.js","assets/index-jIBJk8xl.css","assets/pull-request-dialog-BIRSLJAA.js","assets/create-repo-dialog-BCPrWkIv.js","assets/git-history-dialog-Bqv0bD41.js","assets/push-before-pr-dialog-CFmgu9H_.js","assets/pull-with-changes-dialog-LUgd2a4S.js","assets/merged-pr-dialog-B2qqrQ1g.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{Bi as t,C as n,Ea as r,Fa as i,Ht as a,Ia as ee,It as o,J as s,Ja as c,Jt as l,K as u,Kt as te,Lt as ne,Ra as d,Rt as re,St as ie,Vt as f,Wt as ae,Xn as p,Ya as m,Yn as h,_o as g,ar as _,at as oe,ci as se,cr as v,er as y,fr as ce,hr as le,ir as b,ja as ue,ji as x,ki as de,lo as fe,mr as pe,pr as me,st as he,ui as ge,wi as _e,xo as S,yo as ve,zt as ye}from"./dialogs-config-DZKtVbNK.js";import{r as C}from"./monaco-CZnIWXyV.js";import{A as w,E as T,_ as be,f as E,g as D,h as xe,j as O,k,m as Se,v as Ce}from"./index-CbJ3v0Sr.js";var A=e(S(),1),j=x();function we(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 M(e,t){return t?(0,j.jsx)(r,{className:`h-3.5 w-3.5 animate-spin`}):e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(g,{className:`h-3.5 w-3.5`}):e.hasChanges?(0,j.jsx)(d,{className:`h-3.5 w-3.5`}):e.prExists&&e.prState===`OPEN`&&!e.hasChanges&&!e.hasUnpushedCommits?(0,j.jsx)(c,{className:`h-3.5 w-3.5`}):(0,j.jsx)(ee,{className:`h-3.5 w-3.5`})}function Te(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 N(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 P(e){return e.hasChanges||e.status===`Behind`&&!e.hasChanges&&!e.hasUnpushedCommits||e.commitsAheadOfDefault&&!e.prExists&&!e.hasChanges}var Ee=ve();function De(e){let n=(0,Ee.c)(87),{branchStatus:a,remoteUrl:o,hasRemoteBranch:s,hasUnpushedCommits:l,canCreateRepo:u,repoUrl:te,isRefreshing:ne,isBrandState:d,gitUser:re,isDirectCommitMode:ie,isLoading:f,isLoadingHistory:ae,onFetch:p,onPull:h,onPush:_,onOpenHistory:oe,onCreatePR:v,onCreateRepo:y,onViewInGitHub:b,onOpenChange:x,layout:de}=e,he=de===void 0?`bar`:de,S=he===`bar`&&`w-8 rounded-l-none`,ve=he===`menu`&&`w-full justify-start gap-2 rounded-md`,ye=d&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`,C;n[0]!==S||n[1]!==ve||n[2]!==ye?(C=ge(`h-8 px-1`,S,ve,ye),n[0]=S,n[1]=ve,n[2]=ye,n[3]=C):C=n[3];let w;n[4]===ne?w=n[5]:(w=ne?(0,j.jsx)(r,{className:`h-3.5 w-3.5 animate-spin`}):(0,j.jsx)(fe,{className:`h-3.5 w-3.5`}),n[4]=ne,n[5]=w);let T;n[6]===he?T=n[7]:(T=he===`menu`&&(0,j.jsx)(`span`,{children:`More git actions`}),n[6]=he,n[7]=T);let E;n[8]!==f||n[9]!==C||n[10]!==w||n[11]!==T?(E=(0,j.jsx)(Ce,{asChild:!0,children:(0,j.jsxs)(se,{variant:`outline`,size:`sm`,className:C,disabled:f,children:[w,T]})}),n[8]=f,n[9]=C,n[10]=w,n[11]=T,n[12]=E):E=n[12];let O;n[13]!==a||n[14]!==o?(O=a===`Behind`&&(0,j.jsxs)(`div`,{className:ge(_e.compact,`px-2 py-1 text-amber-600`),children:[`Branch is behind `,o?`origin`:`remote`]}),n[13]=a,n[14]=o,n[15]=O):O=n[15];let k;n[16]===re?k=n[17]:(k=re&&(0,j.jsxs)(`div`,{className:ge(_e.compact,`px-2 py-1 text-muted-foreground`),children:[(0,j.jsx)(`span`,{className:`font-medium`,children:`User:`}),` `,re]}),n[16]=re,n[17]=k);let A;n[18]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,j.jsx)(be,{}),n[18]=A):A=n[18];let we;n[19]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,j.jsx)(m,{className:`h-3.5 w-3.5 mr-2`}),n[19]=we):we=n[19];let M;n[20]!==f||n[21]!==p?(M=(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:p,disabled:f,children:[we,`Fetch`]})}),n[20]=f,n[21]=p,n[22]=M):M=n[22];let Te;n[23]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,j.jsx)(me,{side:`right`,children:`Download latest information from remote without merging changes`}),n[23]=Te):Te=n[23];let N;n[24]===M?N=n[25]:(N=(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[M,Te]})}),n[24]=M,n[25]=N);let P;n[26]!==s||n[27]!==f||n[28]!==h?(P=()=>{s&&!f&&h()},n[26]=s,n[27]=f,n[28]=h,n[29]=P):P=n[29];let De=!s||f?`opacity-50 cursor-not-allowed`:``,Oe;n[30]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,j.jsx)(g,{className:`h-3.5 w-3.5 mr-2`}),n[30]=Oe):Oe=n[30];let F;n[31]!==P||n[32]!==De?(F=(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:P,className:De,children:[Oe,`Pull`]})}),n[31]=P,n[32]=De,n[33]=F):F=n[33];let I=s?`Pull latest changes from remote`:`No remote branch to pull from`,L;n[34]===I?L=n[35]:(L=(0,j.jsx)(me,{side:`right`,children:I}),n[34]=I,n[35]=L);let R;n[36]!==F||n[37]!==L?(R=(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[F,L]})}),n[36]=F,n[37]=L,n[38]=R):R=n[38];let z;n[39]!==s||n[40]!==f||n[41]!==_?(z=!s&&(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:_,disabled:f,children:[(0,j.jsx)(t,{className:`h-3.5 w-3.5 mr-2`}),`Push Branch to Remote`]})}),(0,j.jsx)(me,{side:`right`,children:`Create remote branch and push local commits`})]})}),n[39]=s,n[40]=f,n[41]=_,n[42]=z):z=n[42];let B;n[43]!==l||n[44]!==f||n[45]!==_?(B=()=>{l&&!f&&_()},n[43]=l,n[44]=f,n[45]=_,n[46]=B):B=n[46];let ke=!l||f?`opacity-50 cursor-not-allowed`:``,Ae;n[47]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,j.jsx)(t,{className:`h-3.5 w-3.5 mr-2`}),n[47]=Ae):Ae=n[47];let V;n[48]!==B||n[49]!==ke?(V=(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(D,{onClick:B,className:ke,children:[Ae,`Push Commits`]})}),n[48]=B,n[49]=ke,n[50]=V):V=n[50];let je=l?f?`Push in progress...`:`Push your uncommitted commits to the remote branch`:`No commits to push - your branch is up to date with remote`,H;n[51]===je?H=n[52]:(H=(0,j.jsx)(me,{side:`right`,children:je}),n[51]=je,n[52]=H);let U;n[53]!==V||n[54]!==H?(U=(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[V,H]})}),n[53]=V,n[54]=H,n[55]=U):U=n[55];let Me=f||ae,Ne;n[56]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,j.jsx)(ue,{className:`h-3.5 w-3.5 mr-2`}),n[56]=Ne):Ne=n[56];let W;n[57]!==oe||n[58]!==Me?(W=(0,j.jsxs)(D,{onClick:oe,disabled:Me,children:[Ne,`History`]}),n[57]=oe,n[58]=Me,n[59]=W):W=n[59];let G;n[60]!==ie||n[61]!==f||n[62]!==v?(G=!ie&&(0,j.jsxs)(D,{onClick:v,disabled:f,children:[(0,j.jsx)(ee,{className:`h-3.5 w-3.5 mr-2`}),`Create Pull Request`]}),n[60]=ie,n[61]=f,n[62]=v,n[63]=G):G=n[63];let K;n[64]!==u||n[65]!==f||n[66]!==y?(K=u&&(0,j.jsxs)(D,{onClick:y,disabled:f,children:[(0,j.jsx)(i,{className:`h-3.5 w-3.5 mr-2`}),`Create Repo`]}),n[64]=u,n[65]=f,n[66]=y,n[67]=K):K=n[67];let q;n[68]!==f||n[69]!==b||n[70]!==te?(q=te&&(0,j.jsxs)(D,{onClick:b,disabled:f,children:[(0,j.jsx)(c,{className:`h-3.5 w-3.5 mr-2`}),`View in GitHub`]}),n[68]=f,n[69]=b,n[70]=te,n[71]=q):q=n[71];let J;n[72]!==k||n[73]!==N||n[74]!==R||n[75]!==z||n[76]!==U||n[77]!==W||n[78]!==G||n[79]!==K||n[80]!==q||n[81]!==O?(J=(0,j.jsxs)(xe,{align:`end`,children:[O,k,A,N,R,z,U,W,G,K,q]}),n[72]=k,n[73]=N,n[74]=R,n[75]=z,n[76]=U,n[77]=W,n[78]=G,n[79]=K,n[80]=q,n[81]=O,n[82]=J):J=n[82];let Y;return n[83]!==x||n[84]!==J||n[85]!==E?(Y=(0,j.jsxs)(Se,{onOpenChange:x,children:[E,J]}),n[83]=x,n[84]=J,n[85]=E,n[86]=Y):Y=n[86],Y}function Oe(){return{autoGenerateCommitMessage:h(),autoGeneratePRInfo:p(),privateRepositoryDefault:y()}}function F(e){e.autoGenerateCommitMessage!==void 0&&b(e.autoGenerateCommitMessage),e.autoGeneratePRInfo!==void 0&&_(e.autoGeneratePRInfo),e.privateRepositoryDefault!==void 0&&v(e.privateRepositoryDefault)}function I(e){return e?!0:(T({title:`Error`,description:`No thread selected`,variant:`destructive`}),!1)}function L(e){let t=e.split(`/`);return t.length>=2?{provider:t[0],model:t.slice(1).join(`/`)}:{provider:void 0,model:e}}function R(e,t,n){let[r,i]=(0,A.useState)(!1),[a,ee]=(0,A.useState)(!1),o=()=>n?.id?n.provider?{provider:n.provider,model:n.id}:L(n.id):{provider:void 0,model:void 0};return{isGeneratingMessage:r,isGeneratingPRInfo:a,generateCommitMessageWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{i(!0);let{provider:t,model:n}=o();return await u(e,n,t)}catch(e){return console.error(`Failed to generate commit message:`,e),T({title:`Error`,description:e instanceof Error?e.message:`Failed to generate commit message`,variant:`destructive`}),null}finally{i(!1)}},[e,n]),generatePRInfoWithAI:(0,A.useCallback)(async()=>{if(!e)return null;try{ee(!0);let{provider:t,model:n}=o();return await s(e,n,t)}catch(e){return console.error(`Failed to generate PR info:`,e),T({title:`Error`,description:e instanceof Error?e.message:`Failed to generate PR info`,variant:`destructive`}),null}finally{ee(!1)}},[e,n])}}var z=(0,A.lazy)(()=>C(()=>import(`./commit-dialog-CWb_KVrD.js`).then(e=>({default:e.CommitDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),B=(0,A.lazy)(()=>C(()=>import(`./pull-request-dialog-BIRSLJAA.js`).then(e=>({default:e.PullRequestDialog})),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),ke=(0,A.lazy)(()=>C(()=>import(`./create-repo-dialog-BCPrWkIv.js`).then(e=>({default:e.CreateRepoDialog})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11]))),Ae=(0,A.lazy)(()=>C(()=>import(`./git-history-dialog-Bqv0bD41.js`).then(e=>({default:e.GitHistoryDialog})),__vite__mapDeps([14,6,2]))),V=(0,A.lazy)(()=>C(()=>import(`./push-before-pr-dialog-CFmgu9H_.js`).then(e=>({default:e.PushBeforePRDialog})),__vite__mapDeps([15,6,2]))),je=(0,A.lazy)(()=>C(()=>import(`./pull-with-changes-dialog-LUgd2a4S.js`).then(e=>({default:e.PullWithChangesDialog})),__vite__mapDeps([16,5,2,6]))),H=(0,A.lazy)(()=>C(()=>import(`./merged-pr-dialog-B2qqrQ1g.js`).then(e=>({default:e.MergedPRDialog})),__vite__mapDeps([17,6,2])));function U(){return null}function Me({projectId:e,threadId:t,layout:r=`bar`}){let i=w(),ee=O(e=>e.projectModelSelections[t]),s=O(t=>t.projects.find(t=>t.projectId===e)),[c,u]=(0,A.useState)(!1),[d,p]=(0,A.useState)(!1),[m,h]=(0,A.useState)(!1),[g,_]=(0,A.useState)(!1),[v,y]=(0,A.useState)(``),[b,ue]=(0,A.useState)(``),[x,fe]=(0,A.useState)(``),[_e,S]=(0,A.useState)(!1),[ve,C]=(0,A.useState)(null),be=(0,A.useRef)(!1),D=(0,A.useRef)(!1),xe=(0,A.useRef)(b),Se=(0,A.useRef)(x);xe.current=b,Se.current=x;let[Ce,Ee]=(0,A.useState)(!1),[L,Me]=(0,A.useState)([]),[Ne,W]=(0,A.useState)(!1),[G,K]=(0,A.useState)([]),[q,J]=(0,A.useState)(!1),[Y,Pe]=(0,A.useState)(!1),[Fe,Ie]=(0,A.useState)(``),[Le,Re]=(0,A.useState)(``),[ze,Be]=(0,A.useState)(``),[Ve,He]=(0,A.useState)(!1),[Ue,We]=(0,A.useState)(!1),[Ge,Ke]=(0,A.useState)(!1),[qe,Je]=(0,A.useState)(!1),X=E(),{fetchUnifiedStatus:Ye}=X,Z=R(t,e,ee);async function Q(){te();let e=await ie();i({type:k.SetProjects,projects:e.projects})}let[$,Xe]=(0,A.useState)(()=>Oe()),Ze=s?.commitMethod===de.Direct;(0,A.useEffect)(()=>{Y&&s?.name&&!Fe&&Ie(s.name)},[Y,s?.name,Fe]),(0,A.useEffect)(()=>{F($)},[$]);function Qe(){Ve||(He(!0),he().then(e=>Be(e)).catch(()=>{}))}(0,A.useEffect)(()=>{if(!m){D.current=!1;return}if(m&&$.autoGenerateCommitMessage&&!v.trim()&&t&&!D.current){D.current=!0;async function e(){let e=await Z.generateCommitMessageWithAI();e&&y(e)}e()}},[m,$.autoGenerateCommitMessage,t,Z.generateCommitMessageWithAI,v]),(0,A.useEffect)(()=>{if(!g){be.current=!1;return}if(g&&$.autoGeneratePRInfo&&!xe.current.trim()&&!Se.current.trim()&&t&&!be.current){be.current=!0;async function e(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),fe(e.description),T({title:`Success`,description:`PR title and description generated`}))}e()}},[g,$.autoGeneratePRInfo,t,Z.generatePRInfoWithAI]),(0,A.useEffect)(()=>{X.prExists&&X.prState===`MERGED`&&Je(!0),d&&X.prExists&&X.prState===`OPEN`&&p(!1)},[X.prExists,X.prState,t,d]),(0,A.useEffect)(()=>{if(!d)return;let e=setTimeout(()=>{p(!1)},15e3);return()=>clearTimeout(e)},[d]);async function $e(){if(v.trim()&&I(t))try{u(!0),await o(t,v),y(``),h(!1),await X.fetchUnifiedStatus(!0),Q(),T({title:`Changes committed successfully`,description:`Your changes have been committed to '${X.currentBranch}'.`}),Ge&&(Ke(!1),await at())}catch(e){console.error(`Failed to commit:`,e),T({title:`Commit failed`,description:e instanceof Error?e.message:`Failed to commit changes`,variant:`destructive`})}finally{u(!1)}}async function et(){if(X.status===`Behind`&&!X.hasChanges&&!X.hasUnpushedCommits){await lt();return}if(X.hasChanges){h(!0);return}if(X.prExists&&X.prState===`OPEN`&&!X.hasChanges&&!X.hasUnpushedCommits){X.prUrl&&await l(X.prUrl);return}if(X.commitsAheadOfDefault&&!X.prExists&&!X.hasChanges){_(!0);return}if(X.hasUnpushedCommits&&X.prExists){await rt();return}}async function tt(){let e=await Z.generateCommitMessageWithAI();e&&y(e)}async function nt(){if(I(t))try{u(!0),await ye(t),await X.fetchUnifiedStatus()}catch(e){console.error(`Failed to fetch:`,e)}finally{u(!1)}}async function rt(){if(I(t))try{u(!0),await a(t),await X.fetchUnifiedStatus(!0),Q(),X.hasRemoteBranch?T({title:`Branch pushed successfully`,description:`Your branch '${X.currentBranch}' has been pushed to the remote.`}):T({title:`Push completed`,description:`Changes have been pushed successfully.`})}catch(e){console.error(`Failed to push:`,e),T({title:`Push failed`,description:e instanceof Error?e.message:`Failed to push to remote`,variant:`destructive`})}finally{u(!1)}}async function it(){if(I(t)){if(X.hasChanges){We(!0);return}await at()}}async function at(){try{u(!0),await f(t),await X.fetchUnifiedStatus(!0),Q(),T({title:`Pull successful`,description:`Latest changes have been pulled from remote.`})}catch(e){console.error(`Failed to pull:`,e),T({title:`Pull failed`,description:e instanceof Error?e.message:`Failed to pull from remote`,variant:`destructive`})}finally{u(!1)}}function ot(){We(!1),Ke(!0),h(!0)}async function st(){We(!1),await at()}async function ct(){if(t)try{u(!0);let e=await ne(t);te();let n=await ie();i({type:k.SetProjects,projects:n.projects}),T({title:`New branch created`,description:`Created new branch "${e.branchName}" on current thread`}),Je(!1),await X.fetchUnifiedStatus(!0),setTimeout(()=>void X.fetchUnifiedStatus(!0),1500)}catch(e){console.error(`Failed to create new branch:`,e),T({title:`Failed to create new branch`,description:e instanceof Error?e.message:`Unknown error occurred`,variant:`destructive`})}finally{u(!1)}}async function lt(){if(I(t))try{u(!0),await ae(t),await X.fetchUnifiedStatus(!0),Q(),T({title:`Branch synced successfully`,description:`Your branch '${X.currentBranch}' has been synced with the latest changes`})}catch(e){console.error(`[sync] ✗ Failed to sync branch:`,e),T({title:`Sync failed`,description:e instanceof Error?e.message:`Failed to sync with default branch`,variant:`destructive`})}finally{u(!1)}}async function ut(){if(I(t))try{u(!0),p(!0);let e=await re(t,b,x);e.prUrl&&await l(e.prUrl),ue(``),fe(``),_(!1),await X.fetchUnifiedStatus(!0),Q();let n=0,r=setInterval(async()=>{if(n++,n>=6){clearInterval(r);return}await X.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`)?(_(!1),pt({title:b,description:x})):(p(!1),T({title:`Create PR Failed`,description:t,variant:`destructive`}))}finally{u(!1)}}async function dt(){if(I(t))try{u(!0);let e=await n(t,Fe,Le,$.privateRepositoryDefault);e.repoUrl&&setTimeout(()=>{l(e.repoUrl)},3e3),Ie(``),Re(``),Pe(!1),await X.fetchUnifiedStatus(),Q()}catch(e){console.error(`Failed to create repo:`,e)}finally{u(!1)}}async function ft(){let e=await Z.generatePRInfoWithAI();e&&(ue(e.title),fe(e.description),T({title:`Success`,description:`PR title and description generated`}))}async function pt(e){let n=e??ve;if(!(!t||!n))try{u(!0),p(!0);try{await a(t)}catch(e){let n=e?.message??``;if(n.includes(`non-fast-forward`)||n.includes(`Updates were rejected because the tip of your current branch is behind`)){T({title:`Syncing branch before push`,description:`Your branch is behind remote. Pulling latest changes first...`});try{await ae(t),await a(t)}catch{throw e}}else throw e}let e=await re(t,n.title,n.description);e.prUrl&&await l(e.prUrl),ue(``),fe(``),C(null),S(!1),await X.fetchUnifiedStatus(!0),Q();let r=0,i=setInterval(async()=>{if(r++,r>=6){clearInterval(i);return}await X.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`;p(!1),T({title:`Push & Create PR Failed`,description:t,variant:`destructive`})}finally{u(!1)}}async function mt(){if(I(t))try{W(!0);let e=await oe(t,100);Me(e),K(e.slice(0,10)),Ee(!0)}catch(e){console.error(`Failed to fetch git history:`,e)}finally{W(!1)}}function ht(){q||(J(!0),setTimeout(()=>{let e=G.length+10;K(L.slice(0,e)),J(!1)},300))}function gt(e){let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight<100&&G.length<L.length&&!q&&ht()}let _t=P(X);function vt(){X.repoUrl&&l(X.repoUrl)}function yt(){S(!1),C(null)}function bt(){Je(!1),X.fetchUnifiedStatus(!0)}return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:ge(`flex items-center gap-0`,r===`menu`&&`w-full flex-col gap-1 [&_button]:w-full [&_button]:justify-start`),children:[(0,j.jsx)(pe,{children:(0,j.jsxs)(ce,{children:[(0,j.jsx)(le,{asChild:!0,children:(0,j.jsxs)(se,{variant:`outline`,size:`sm`,className:ge(`h-8 gap-1.5`,r===`bar`&&`rounded-r-none border-r-0`,r===`menu`&&`rounded-md border`,_t&&` border-transparent bg-brand text-brand-foreground hover:bg-brand/90 hover:text-brand-foreground`),disabled:N(X,c,d),onClick:et,children:[M(X,d),we(X,d)]})}),(0,j.jsx)(me,{children:Te(X)})]})}),(0,j.jsx)(De,{branchStatus:X.status,remoteUrl:X.remoteUrl,hasRemoteBranch:X.hasRemoteBranch,hasUnpushedCommits:X.hasUnpushedCommits,canCreateRepo:X.canCreateRepo,repoUrl:X.repoUrl,isRefreshing:X.isRefreshing,isBrandState:_t,gitUser:ze,isDirectCommitMode:Ze,isLoading:c||d,isLoadingHistory:Ne,onFetch:()=>void nt(),onPull:()=>void it(),onPush:()=>void rt(),onOpenHistory:()=>void mt(),onCreatePR:()=>_(!0),onCreateRepo:()=>Pe(!0),onViewInGitHub:vt,onOpenChange:e=>{e&&(Qe(),Ye(!0))},layout:r})]}),m&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(z,{open:m,onOpenChange:h,commitMessage:v,onCommitMessageChange:y,autoGenerateCommitMessage:$.autoGenerateCommitMessage,onAutoGenerateChange:e=>Xe(t=>({...t,autoGenerateCommitMessage:e})),isGeneratingMessage:Z.isGeneratingMessage,isLoading:c,onGenerateMessage:tt,onCommit:$e,currentBranch:X.currentBranch})}),g&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(B,{open:g,onOpenChange:_,prTitle:b,onPrTitleChange:ue,prDescription:x,onPrDescriptionChange:fe,isGeneratingPRInfo:Z.isGeneratingPRInfo,isLoading:c,onGeneratePRInfo:ft,onCreatePR:ut,currentBranch:X.currentBranch,autoGeneratePRInfo:$.autoGeneratePRInfo,onAutoGeneratePRInfoChange:e=>Xe(t=>({...t,autoGeneratePRInfo:e}))})}),_e&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(V,{open:_e,onOpenChange:S,isLoading:c,onPushAndCreatePR:pt,onCancel:yt})}),Y&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(ke,{open:Y,onOpenChange:Pe,repoName:Fe,onRepoNameChange:Ie,repoDescription:Le,onRepoDescriptionChange:Re,isPrivateRepo:$.privateRepositoryDefault,onPrivateRepoChange:e=>Xe(t=>({...t,privateRepositoryDefault:e})),isLoading:c,onCreateRepo:dt})}),Ce&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(Ae,{open:Ce,onOpenChange:Ee,commits:L,displayedCommits:G,isLoadingMore:q,onScroll:gt,currentBranch:X.currentBranch})}),Ue&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(je,{open:Ue,onOpenChange:We,onCommitFirst:ot,onStashAndPull:st,onCancel:()=>We(!1),isLoading:c})}),qe&&(0,j.jsx)(A.Suspense,{fallback:(0,j.jsx)(U,{}),children:(0,j.jsx)(H,{open:qe,onOpenChange:Je,onNewBranch:ct,onJustOpen:bt,isLoading:c})})]})}export{Me as GitOpsButton};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{i as e,n as t}from"./rolldown-runtime-aKtaBQYM.js";import{$r as n,Br as r,Ci as i,Ea as a,Fr as o,Gr as s,Hr as c,Ii as l,Ir as u,Jr as d,Lr as f,Ni as p,Nr as m,Pr as h,Qa as g,Qr as _,Rr as v,Sr as y,Ui as b,Ur as x,Vr as S,Wr as C,Xr as w,_ as T,ai as E,bo as D,br as O,c as ee,ci as k,co as te,fr as ne,gr as A,hr as re,ii as j,ji as M,l as N,li as ie,lo as ae,mr as oe,ni as se,oi as ce,oo as le,pr as ue,qr as de,ri as fe,rt as pe,s as me,si as P,so as he,ti as ge,u as _e,ui as F,uo as ve,vr as ye,wi as I,xo as be,xr as xe,yo as Se,yr as Ce,zr as we}from"./dialogs-config-DZKtVbNK.js";var Te=e(D(),1),L=Se(),R=e(be(),1),z=M(),Ee=`AlertDialog`,[De,Oe]=ce(Ee,[c]),B=c(),ke=e=>{let{__scopeAlertDialog:t,...n}=e,r=B(t);return(0,z.jsx)(v,{...r,...n,modal:!0})};ke.displayName=Ee;var Ae=`AlertDialogTrigger`,je=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...i}=e,a=B(n);return(0,z.jsx)(r,{...a,...i,ref:t})});je.displayName=Ae;var Me=`AlertDialogPortal`,Ne=e=>{let{__scopeAlertDialog:t,...n}=e,r=B(t);return(0,z.jsx)(f,{...r,...n})};Ne.displayName=Me;var Pe=`AlertDialogOverlay`,Fe=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=B(n);return(0,z.jsx)(u,{...i,...r,ref:t})});Fe.displayName=Pe;var Ie=`AlertDialogContent`,[Le,Re]=De(Ie),ze=se(`AlertDialogContent`),Be=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=B(n),o=R.useRef(null),s=p(t,o),c=R.useRef(null);return(0,z.jsx)(S,{contentName:Ie,titleName:Ve,docsSlug:`alert-dialog`,children:(0,z.jsx)(Le,{scope:n,cancelRef:c,children:(0,z.jsxs)(h,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:P(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,z.jsx)(ze,{children:r}),(0,z.jsx)(Ye,{contentRef:o})]})})})});Be.displayName=Ie;var Ve=`AlertDialogTitle`,He=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=B(n);return(0,z.jsx)(we,{...i,...r,ref:t})});He.displayName=Ve;var Ue=`AlertDialogDescription`,We=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=B(n);return(0,z.jsx)(o,{...i,...r,ref:t})});We.displayName=Ue;var Ge=`AlertDialogAction`,Ke=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=B(n);return(0,z.jsx)(m,{...i,...r,ref:t})});Ke.displayName=Ge;var qe=`AlertDialogCancel`,Je=R.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=Re(qe,n),a=B(n),o=p(t,i);return(0,z.jsx)(m,{...a,...r,ref:o})});Je.displayName=qe;var Ye=({contentRef:e})=>{let t=`\`${Ie}\` requires a description for the component to be accessible for screen reader users.
|
|
2
|
+
|
|
3
|
+
You can add a description to the \`${Ie}\` by passing a \`${Ue}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
4
|
+
|
|
5
|
+
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 \`${Ie}\`. 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.
|
|
6
|
+
|
|
7
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return R.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},Xe=ke,Ze=Ne,Qe=Fe,$e=Be,et=Ke,tt=Je,nt=He,rt=We,it=Xe,at=Ze,ot=R.forwardRef((e,t)=>{let n=(0,L.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,z.jsx)(Qe,{className:a,...i,ref:t}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ot.displayName=Qe.displayName;var st=R.forwardRef((e,t)=>{let n=(0,L.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,z.jsx)(ot,{}),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,z.jsxs)(at,{children:[a,(0,z.jsx)($e,{ref:t,className:o,...i})]}),n[6]=i,n[7]=t,n[8]=o,n[9]=s):s=n[9],s});st.displayName=$e.displayName;var ct=e=>{let t=(0,L.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,z.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};ct.displayName=`AlertDialogHeader`;var lt=e=>{let t=(0,L.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,z.jsx)(`div`,{className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a};lt.displayName=`AlertDialogFooter`;var ut=R.forwardRef((e,t)=>{let n=(0,L.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(I.dialogTitle,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,z.jsx)(nt,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ut.displayName=nt.displayName;var dt=R.forwardRef((e,t)=>{let n=(0,L.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(I.dialogDescription,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,z.jsx)(rt,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});dt.displayName=rt.displayName;var ft=R.forwardRef((e,t)=>{let n=(0,L.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(ie(),r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,z.jsx)(et,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});ft.displayName=et.displayName;var pt=R.forwardRef((e,t)=>{let n=(0,L.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(ie({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,z.jsx)(tt,{ref:t,className:a,...i}),n[5]=i,n[6]=t,n[7]=a,n[8]=o):o=n[8],o});pt.displayName=tt.displayName;var mt=Object,ht=Map,gt=Set,_t=gt.prototype.has,vt=gt.prototype.add,yt=ht.prototype.has,bt=ht.prototype.get,xt=ht.prototype.set,St=1,Ct=2,wt=4,Tt=8,Et=16,Dt=32,V=`__t`,Ot=`__p`,kt=`__e`,At=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,jt=`http://www.w3.org/1999/xlink`,Mt=`http://www.w3.org/2000/xmlns/`,Nt=120,Pt=new gt([`href`,`list`,`form`,`tabIndex`,`download`]),Ft=new gt([`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 It=H.createElement(`template`),Lt=It.content,Rt=H.createElementNS(`http://www.w3.org/2000/svg`,`svg`),U=Node.prototype,zt=Element.prototype,Bt=CharacterData.prototype,Vt=mt.getOwnPropertyDescriptor,Ht=U.insertBefore,Ut=U.cloneNode,Wt=U.replaceChild,Gt=zt.remove,Kt=U.addEventListener,qt=zt.removeAttribute,Jt=zt.setAttribute,Yt=zt.setAttributeNS,Xt=Vt(U,`textContent`).set,Zt=Vt(U,`firstChild`).get,Qt=Vt(U,`nextSibling`).get,$t=Vt(Bt,`data`).set,en=(e,t)=>{let n=t?Rt:It;return n.innerHTML=e,(t?Rt:Lt).firstChild};H[kt]=new gt;var tn=(e,t,n)=>{let r=t.toLowerCase(),i=!1;r.endsWith(`capture`)&&(r=r.slice(0,-7),i=!0);let a=`$$${r}`;_t.call(H[kt],r)||(Kt.call(H,r,e=>{let t=e.target;for(;t;){let n=t[a];n&&(mt.defineProperty(e,`currentTarget`,{configurable:!0,get(){return t}}),n(e)),t=t.parentNode}},{capture:i}),vt.call(H[kt],r));let o=t=>{t?`key`in t&&t.key===e[a]?.key||(e[a]=t):e[a]=null};return o(n),o},W=(e,t)=>{let n=Zt.call(e);if(t)for(let e=0;e<t&&n;++e)n=Qt.call(n);return n},nn=new WeakSet,rn=e=>{if(nn.has(e))return;e.nodeType===8&&e.parentNode?.removeChild(e);let t=Zt.call(e);for(;t;)rn(t),t=t.nextSibling;nn.add(e)},an=(e,t,n)=>{let r=H.createTextNode(t),i=W(e,n);return Ht.call(e,r,i),r},on=(e,t)=>{$t.call(e,t)},sn=(e,t,n)=>{typeof n!=`number`||At.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`},cn=(e,t,n)=>{t=t.replace(/xlink(?:H|:h)/,`h`).replace(/sName$/,`s`),t.startsWith(`xmlns`)?Yt.call(e,Mt,t,String(n)):t.startsWith(`xlink`)&&Yt.call(e,jt,`href`,String(n))},ln=(e,t,n)=>{let r=n==null;if(n=r?``:n,t in e&&e[t]!==void 0&&e[t]!==null&&!(e instanceof SVGElement)&&_t.call(Pt,t))try{e[t]=n}catch{}else !r&&n!==``&&(n!==!1||t.includes(`-`))?Jt.call(e,t,String(n)):qt.call(e,t);let i=e instanceof HTMLInputElement,a=e instanceof HTMLSelectElement,o=e instanceof HTMLTextAreaElement;t===`value`&&(i||a||o)&&(Jt.call(e,t,String(n)),e.value=n)},un=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 dn(e){return un.get(e)||e}var fn=Object.defineProperty,pn=(e,t,n)=>t in e?fn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t,n)=>(pn(e,typeof t==`symbol`?t:t+``,n),n),mn=class{constructor(){G(this,`r`),G(this,`e`),G(this,`l`),G(this,`g`),G(this,`_u`),G(this,`_t`),G(this,`d`),G(this,`k`),G(this,`c`)}},hn=(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:St,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=dn(t);if(i&&(t=i),t===`className`&&(t=`class`),t.startsWith(`on`)){`$`in n?a.e.push({t:wt,n:t.slice(2),v:null,h:n.$,i:null,l:null,p:null,b:null}):a.i.push({t:wt,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:Tt,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):t.charCodeAt(0)===Nt?a.e.push({t:Et,n:t,v:null,h:n.$,i:null,l:null,p:null,b:null}):a.e.push({t:Ct,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:Tt,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(_t.call(Ft,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:St,n:null,v:null,h:s.$,i:r,l:null,p:null,b:null});continue}if(s instanceof mn){a.i.push({t:Dt,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:St,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+=hn(s,t,l)}return(a.i.length||a.e.length)&&t.push(a),`<${e.type}${r}>${i}</${e.type}>`},gn=Object.defineProperty,_n=(e,t,n)=>t in e?gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vn=(e,t,n)=>(_n(e,typeof t==`symbol`?t:t+``,n),n),yn=e=>new bn(e),bn=class extends mn{constructor(e){super(),vn(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 wn.call(this),a;if(r===0)return Sn.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){Mn.call(u,d),n[s]=u,u=t[++o],d=n[++s];continue}let i=f.k,h=p.k;if(i===h){Mn.call(f,p),n[l]=f,f=t[--c],p=n[--l];continue}if(e===h){Mn.call(u,p),n[l]=u;let e=n[l+1];Nn.call(u,e,e?.l||null),u=t[++o],p=n[--l];continue}if(i===r){Mn.call(f,d),n[s]=f;let e=t[o];Nn.call(f,e,e?.l||null),f=t[--c],d=n[++s];continue}if(!m){m=new ht;for(let e=o;e<=c;e++)xt.call(m,t[e].k,e)}let g=m.get(r);if(g===void 0)jn.call(d,a,u.l||null);else{let e=t[g];Nn.call(e,u,null),Mn.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)jn.call(n[t],a,e?e.l:null)}else for(let e=o;e<=c;++e)Pn.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];jn.call(r,e,t)}return this._t=e,e}x(){let e=this.t();if(e)Xt.call(e,``);else for(let e=0,t=this.b.length;e<t;++e)Pn.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}},xn=bn.prototype,Sn=xn.m,Cn=xn.p,wn=xn.x,Tn=new Proxy({},{get(e,t){return{$:t}}}),En=(e,t,n,r)=>{let i=e(Tn),a=[],o=en(hn(t?t(i):i,a),r);return rn(o),(e,t,r)=>new On(o,a,e,t??e?.key??null,r??n??null,null)},Dn=(e,t)=>{if((`b`in e||`b`in t)&&Cn.call(e,t),e.l||jn.call(e,void 0,null,null),e.k&&e.k===t.k||e.r===t.r)return Mn.call(e,t);let n=jn.call(t,e.t(),e.l,null);return Pn.call(e),e.k=t.k,n},On=class extends mn{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??Ut.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]??kn(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&St){if(o instanceof mn){let e=W(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=W(a,i.i);o.reset(e)}let t=o.current;a[V][e]=t,n||Ht.call(a,t,W(a,i.i));continue}if(n){a[V][e]=W(a,i.i);continue}a[V][e]=an(a,o==null||o===!1?``:String(o),i.i)}else if(i.t&wt){let e=tn(a,i.n,o);a[Ot+i.n]=e}else if(i.t&Ct)ln(a,i.n,o);else if(i.t&Tt)if(typeof o==`string`||typeof o==`number`)sn(a,i.n,o);else for(let e in o)sn(a,e,o[e]);else cn(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&St)r.v&&!n&&an(a,r.v,r.i);else if(r.t&wt)tn(a,r.n,r.l);else{let e=W(a,r.i);n?r.b.m(a,e,e):r.b.m(a,e)}}}return e&&!n&&Ht.call(e,r,t),this.l=r,r}p(e){let t=this.l;if(!e.d)return t;let n=this.d;if(!Fn.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]??kn(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&wt){a[Ot+o.n](c);continue}if(o.t&St){if(s instanceof mn){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,Wt.call(a,n,e)}else c.current=e;continue}on(a[V][t],c==null||c===!1?``:String(c))}else if(o.t&Ct)ln(a,o.n,c);else if(o.t&Tt)if(typeof c==`string`||typeof c==`number`)sn(a,o.n,c);else for(let e in c)c[e]!==s[e]&&sn(a,e,c[e]);else cn(a,o.n,c)}}}return t}v(e=null,t=null){Ht.call(this.t(),this.l,e?e.l:t)}x(){Gt.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}},kn=(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=W(t,r)}return a&&(n[r]=t),t},An=On.prototype,jn=An.m,Mn=An.p,Nn=An.v,Pn=An.x,Fn=An.u,In={noSlot:!1},Ln=`slot`,Rn=({effect:e,deps:t})=>((0,R.useEffect)(e,t||[]),null),K=new Map,zn=(0,R.createContext)(!1),Bn=(e,t,n)=>{let r={ref:t},i=0;for(let t in e){let a=e[t];if((0,R.isValidElement)(a)||Array.isArray(a)&&a.length&&(0,R.isValidElement)(a[0])){r[t]=Hn(a,!1,n,i++);continue}r[t]=e[t]}return r},Vn=(e,t)=>(0,R.createElement)(Ln,{suppressHydrationWarning:!0,id:t},e),Hn=(e,t,n,r,i)=>{let a=n?.[r]?.current,o=(0,R.isValidElement)(e)&&typeof e.type==`function`&&`_c`in e.type,s=o&&e.type._c;if(typeof window>`u`)return o?s?e:Vn(Vn(e),i):Vn(e,i);if(s){let t=e.type(e.props);if(K.has(t.type)){let e=K.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,Te.createPortal)((0,R.createElement)(R.Fragment,{children:e}),c,i),reset:e=>{e.childNodes.forEach(t=>e.removeChild(t))},unstable:t};return n&&(n[r]=l),l},Un=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 Un(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=Wn(e.props.children).map(e=>Un(e))),{type:t,props:n}},Wn=e=>{if(e==null)return[];if(typeof e==`object`&&`type`in e&&e.type===R.Fragment)return Wn(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(...Wn(t[e]));return n},Gn=typeof window>`u`?R.useEffect:R.useLayoutEffect;function Kn(e,t,n){if(!e||t(e))return e;let r=n?e.return:e.child;for(;r;){let e=Kn(r,t,n);if(e)return e;r=n?null:r.sibling}}function qn(){let e=(0,R.useRef)();return(0,R.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 Jn(e){let t=qn(),n=(0,R.useRef)({el:null,depth:0});return Gn(()=>{n.current.el=Kn(t,t=>(n.current.depth++,typeof t.type==`string`&&(e===void 0||t.type===e)),!0)?.stateNode},[t]),n}function Yn(){let e=qn(),t=(0,R.useRef)({el:null,depth:0});return Gn(()=>{t.current.el=Kn(e,e=>(t.current.depth++,e.stateNode?.containerInfo!=null),!0)?.stateNode.containerInfo},[e]),t}var Xn=(e,t={})=>{let n=t?.experimental_noSlot??In.noSlot,r=t?.block,i=t?.svg?`g`:Ln;e&&(r=En(e,Un,t?.shouldUpdate,t?.svg));let a=(e,a)=>{let o=Yn(),s=Jn(),c=e._hmr,l=(0,R.useRef)(null),u=(0,R.useRef)(null),d=(0,R.useRef)([]);e=Bn(e,a,d.current),u.current?.(e);let f=(0,R.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.
|
|
8
|
+
The block element should be the only child of the \`${Ut.call(l.current).outerHTML}\` element.
|
|
9
|
+
To avoid this error, \`experimental_options.noSlot\` should be false`))),(u.current===null||c)&&(jn.call(i,l.current,null),u.current=e=>{Dn(i,r(e,e.key,t?.shouldUpdate))}),()=>{Pn.call(i)}},[]),p=(0,R.useMemo)(()=>n?null:(0,R.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,R.createElement)(R.Fragment,{},p,(0,R.createElement)(Rn,{effect:f,deps:c?[c]:[]}),h)};return yt.call(K,a)||xt.call(K,a,Xn),t?.name&&(e&&(e.displayName=`Million(Render(${t.name}))`),a.displayName=`Million(Block(${t.name}))`),a};(0,R.memo)(({each:e,children:t,memo:n,svg:r,as:i,...a})=>{let o=(0,R.useRef)(null),[s]=(0,R.useState)(()=>({current:Array(e.length)})),c=(0,R.useRef)(null),l=(0,R.useRef)({each:null,children:null,mounted:!1}),[,u]=(0,R.useState)(!1);if(c.current&&(e!==l.current.each||!n)){let r=Zn(e,t,l,s,n);Cn.call(c.current,yn(r))}let d=(0,R.createElement)(R.Fragment,null,(0,R.createElement)(i??(r?`g`:`slot`),{...a,ref:o}),...s.current.map(e=>e.portal));return(0,R.useEffect)(()=>{!o.current||c.current||l.current.mounted||(c.current=yn(Zn(e,t,l,s,n)),yt.call(K,d)||xt.call(K,d,c.current),Sn.call(c.current,o.current),l.current.mounted=!0,u(!0))},[o.current]),d});var Zn=(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(yt.call(K,s.type)){o.block||=bt.call(K,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(yt.call(K,e.type)){let t=bt.call(K,e.type);if(typeof t==`function`){a[n]=t(e.props);continue}}}let c=En(e=>e?.scope),l=(e,t,n)=>c({scope:Hn((0,R.createElement)(s.type,e),!1,t.current,n)},s.key?String(s.key):void 0);xt.call(K,s.type,l),o.block=l,a[n]=l(s.props,r,n)}return o.each=e,o.children=a,a};function Qn(e,t){return e===t||e!==e&&t!==t}function $n(e,t){for(let n in e)if(!Qn(e[n],t[n]))return!0;return!1}function er(e,{portals:t,...n}){let r=`CompiledBlock(Inner(${n.name}))`,i=Xn(t=>e(t),{...n,scoped:void 0,name:r,shouldUpdate:$n}),a=t?.length||0,o=t&&a>0?e=>{let n=(0,R.useContext)(zn),[r]=(0,R.useState)(()=>[]),o={...e,scoped:n};for(let e=0;e<a;e++){let n=t[e];o[n]=Hn(o[n],!1,r,e)}let s=[];for(let e=0,t=r.length;e<t;e++)s[e]=r[e].portal;return(0,R.createElement)(R.Fragment,null,(0,R.createElement)(i,o),s)}:e=>(0,R.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 tr=er(e=>(0,z.jsxs)(`div`,{className:e.v0,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:e.v1,children:e.v2}),e.v3]}),e.v4]}),{name:`PageHeader_1`,portals:[`v2`,`v3`,`v4`]}),nr=function(e){let t=(0,L.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(I.pageTitle,o),t[2]=o,t[3]=c);let l;t[4]===r?l=t[5]:(l=r?(0,z.jsx)(`p`,{className:I.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,z.jsx)(tr,{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 rr(e){let t=(0,L.c)(5),{children:n,className:r}=e,a;t[0]===r?a=t[1]:(a=F(i.settingsPage,r),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,z.jsx)(`div`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function ir(e){let t=(0,L.c)(5),{children:n,className:r}=e,a;t[0]===r?a=t[1]:(a=F(i.accountPage,r),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,z.jsx)(`div`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function ar(e){let t=(0,L.c)(5),{children:n,className:r}=e,a;t[0]===r?a=t[1]:(a=F(i.formPage,r),t[0]=r,t[1]=a);let o;return t[2]!==n||t[3]!==a?(o=(0,z.jsx)(`div`,{className:a,children:n}),t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function or(e){let t=(0,L.c)(5),{title:n,className:r}=e,i;t[0]===r?i=t[1]:(i=F(I.sectionTitle,`mb-3`,r),t[0]=r,t[1]=i);let a;return t[2]!==i||t[3]!==n?(a=(0,z.jsx)(`h2`,{className:i,children:n}),t[2]=i,t[3]=n,t[4]=a):a=t[4],a}function sr(e){let t=(0,L.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`?I.hintBanner:a===`success`?F(I.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(I.error,`bg-destructive/10 rounded-md px-3 py-2 mb-4`):I.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,z.jsx)(`div`,{className:o,children:n}),t[3]=n,t[4]=o,t[5]=s):s=t[5],s}function cr(e){let t=(0,L.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,z.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function lr(e){let t=(0,L.c)(10),{children:n,title:r,action:i}=e,a;t[0]===r?a=t[1]:(a=r?(0,z.jsx)(`h2`,{className:F(I.emptyStateTitle,`mb-2`),children:r}):null,t[0]=r,t[1]=a);let o;t[2]===n?o=t[3]:(o=(0,z.jsx)(`p`,{className:I.bodyMuted,children:n}),t[2]=n,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,z.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,z.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,z.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 ur(e){let t=(0,L.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,z.jsx)(`div`,{className:i,children:n}),t[2]=n,t[3]=i,t[4]=a):a=t[4],a}function dr(e){let t=(0,L.c)(14),{title:n,description:r,action:i,children:a,className:o}=e,s;t[0]===n?s=t[1]:(s=(0,z.jsx)(or,{title:n,className:`mb-1`}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=r?(0,z.jsx)(`p`,{className:I.bodyMuted,children:r}):null,t[2]=r,t[3]=c);let l;t[4]!==s||t[5]!==c?(l=(0,z.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,z.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,z.jsxs)(`div`,{className:o,children:[u,a]}),t[10]=a,t[11]=o,t[12]=u,t[13]=d):d=t[13],d}function fr(e){let t=R.useRef({value:e,previous:e});return R.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var pr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],mr=[` `,`Enter`],q=`Select`,[hr,gr,_r]=me(q),[vr,yr]=ce(q,[_r,y]),br=y(),[xr,J]=vr(q),[Sr,Cr]=vr(q),wr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=br(t),[g,_]=R.useState(null),[v,y]=R.useState(null),[b,x]=R.useState(!1),S=_e(l),[C,w]=fe({prop:r,defaultProp:i??!1,onChange:a,caller:q}),[T,E]=fe({prop:o,defaultProp:s,onChange:c,caller:q}),D=R.useRef(null),O=g?m||!!g.closest(`form`):!0,[ee,k]=R.useState(new Set),te=Array.from(ee).map(e=>e.props.value).join(`;`);return(0,z.jsx)(xe,{...h,children:(0,z.jsxs)(xr,{required:p,scope:t,trigger:g,onTriggerChange:_,valueNode:v,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:x,contentId:j(),value:T,onValueChange:E,open:C,onOpenChange:w,dir:S,triggerPointerDownPosRef:D,disabled:f,children:[(0,z.jsx)(hr.Provider,{scope:t,children:(0,z.jsx)(Sr,{scope:e.__scopeSelect,onNativeOptionAdd:R.useCallback(e=>{k(t=>new Set(t).add(e))},[]),onNativeOptionRemove:R.useCallback(e=>{k(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),O?(0,z.jsxs)(gi,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:T,onChange:e=>E(e.target.value),disabled:f,form:m,children:[T===void 0?(0,z.jsx)(`option`,{value:``}):null,Array.from(ee)]},te):null]})})};wr.displayName=q;var Tr=`SelectTrigger`,Er=R.forwardRef((e,t)=>{let{__scopeSelect:r,disabled:i=!1,...a}=e,o=br(r),s=J(Tr,r),c=s.disabled||i,l=p(t,s.onTriggerChange),u=gr(r),d=R.useRef(`touch`),[f,m,h]=vi(e=>{let t=u().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.value===s.value));n!==void 0&&s.onValueChange(n.value)}),g=e=>{c||(s.onOpenChange(!0),h()),e&&(s.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,z.jsx)(ye,{asChild:!0,...o,children:(0,z.jsx)(n.button,{type:`button`,role:`combobox`,"aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":`none`,dir:s.dir,"data-state":s.open?`open`:`closed`,disabled:c,"data-disabled":c?``:void 0,"data-placeholder":_i(s.value)?``:void 0,...a,ref:l,onClick:P(a.onClick,e=>{e.currentTarget.focus(),d.current!==`mouse`&&g(e)}),onPointerDown:P(a.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:P(a.onKeyDown,e=>{let t=f.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&pr.includes(e.key)&&(g(),e.preventDefault())})})})});Er.displayName=Tr;var Dr=`SelectValue`,Or=R.forwardRef((e,t)=>{let{__scopeSelect:r,className:i,style:a,children:o,placeholder:s=``,...c}=e,l=J(Dr,r),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=p(t,l.onValueNodeChange);return E(()=>{u(d)},[u,d]),(0,z.jsx)(n.span,{...c,ref:f,style:{pointerEvents:`none`},children:_i(l.value)?(0,z.jsx)(z.Fragment,{children:s}):o})});Or.displayName=Dr;var kr=`SelectIcon`,Ar=R.forwardRef((e,t)=>{let{__scopeSelect:r,children:i,...a}=e;return(0,z.jsx)(n.span,{"aria-hidden":!0,...a,ref:t,children:i||`▼`})});Ar.displayName=kr;var jr=`SelectPortal`,Mr=e=>(0,z.jsx)(de,{asChild:!0,...e});Mr.displayName=jr;var Y=`SelectContent`,Nr=R.forwardRef((e,t)=>{let n=J(Y,e.__scopeSelect),[r,i]=R.useState();if(E(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Te.createPortal((0,z.jsx)(Pr,{scope:e.__scopeSelect,children:(0,z.jsx)(hr.Slot,{scope:e.__scopeSelect,children:(0,z.jsx)(`div`,{children:e.children})})}),t):null}return(0,z.jsx)(Lr,{...e,ref:t})});Nr.displayName=Y;var X=10,[Pr,Z]=vr(Y),Fr=`SelectContentImpl`,Ir=ge(`SelectContent.RemoveScroll`),Lr=R.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:m,collisionBoundary:h,collisionPadding:g,sticky:_,hideWhenDetached:v,avoidCollisions:y,...b}=e,S=J(Y,n),[T,E]=R.useState(null),[D,O]=R.useState(null),ee=p(t,e=>E(e)),[k,te]=R.useState(null),[ne,A]=R.useState(null),re=gr(n),[j,M]=R.useState(!1),N=R.useRef(!1);R.useEffect(()=>{if(T)return x(T)},[T]),s();let ie=R.useCallback(e=>{let[t,...n]=re().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&&D&&(D.scrollTop=0),n===r&&D&&(D.scrollTop=D.scrollHeight),n?.focus(),document.activeElement!==i))return},[re,D]),ae=R.useCallback(()=>ie([k,T]),[ie,k,T]);R.useEffect(()=>{j&&ae()},[j,ae]);let{onOpenChange:oe,triggerPointerDownPosRef:se}=S;R.useEffect(()=>{if(T){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(se.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(se.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():T.contains(n.target)||oe(!1),document.removeEventListener(`pointermove`,t),se.current=null};return se.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[T,oe,se]),R.useEffect(()=>{let e=()=>oe(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[oe]);let[ce,le]=vi(e=>{let t=re().filter(e=>!e.disabled),n=yi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ue=R.useCallback((e,t,n)=>{let r=!N.current&&!n;(S.value!==void 0&&S.value===t||r)&&(te(e),r&&(N.current=!0))},[S.value]),de=R.useCallback(()=>T?.focus(),[T]),fe=R.useCallback((e,t,n)=>{let r=!N.current&&!n;(S.value!==void 0&&S.value===t||r)&&A(e)},[S.value]),pe=r===`popper`?Vr:zr,me=pe===Vr?{side:c,sideOffset:l,align:u,alignOffset:f,arrowPadding:m,collisionBoundary:h,collisionPadding:g,sticky:_,hideWhenDetached:v,avoidCollisions:y}:{};return(0,z.jsx)(Pr,{scope:n,content:T,viewport:D,onViewportChange:O,itemRefCallback:ue,selectedItem:k,onItemLeave:de,itemTextRefCallback:fe,focusSelectedItem:ae,selectedItemText:ne,position:r,isPositioned:j,searchRef:ce,children:(0,z.jsx)(C,{as:Ir,allowPinchZoom:!0,children:(0,z.jsx)(d,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:P(i,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,z.jsx)(w,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,z.jsx)(pe,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...b,...me,onPlaced:()=>M(!0),ref:ee,style:{display:`flex`,flexDirection:`column`,outline:`none`,...b.style},onKeyDown:P(b.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&le(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=re().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(()=>ie(t)),e.preventDefault()}})})})})})})});Lr.displayName=Fr;var Rr=`SelectItemAlignedPosition`,zr=R.forwardRef((e,t)=>{let{__scopeSelect:r,onPlaced:i,...a}=e,o=J(Y,r),s=Z(Y,r),[c,l]=R.useState(null),[u,d]=R.useState(null),f=p(t,e=>d(e)),m=gr(r),h=R.useRef(!1),g=R.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=s,x=R.useCallback(()=>{if(o.trigger&&o.valueNode&&c&&u&&_&&v&&y){let e=o.trigger.getBoundingClientRect(),t=u.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if(o.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=N(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.left=d+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,s=e.width+o,l=Math.max(s,t.width),u=window.innerWidth-X,d=N(a,[X,Math.max(X,u-l)]);c.style.minWidth=s+`px`,c.style.right=d+`px`}let a=m(),s=window.innerHeight-X*2,l=_.scrollHeight,d=window.getComputedStyle(u),f=parseInt(d.borderTopWidth,10),p=parseInt(d.paddingTop,10),g=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=f+p+l+b+g,S=Math.min(v.offsetHeight*5,x),C=window.getComputedStyle(_),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-X,D=s-E,O=v.offsetHeight/2,ee=v.offsetTop+O,k=f+p+ee,te=x-k;if(k<=E){let e=a.length>0&&v===a[a.length-1].ref.current;c.style.bottom=`0px`;let t=u.clientHeight-_.offsetTop-_.offsetHeight,n=k+Math.max(D,O+(e?T:0)+t+g);c.style.height=n+`px`}else{let e=a.length>0&&v===a[0].ref.current;c.style.top=`0px`;let t=Math.max(E,f+_.offsetTop+(e?w:0)+O)+te;c.style.height=t+`px`,_.scrollTop=k-E+_.offsetTop}c.style.margin=`${X}px 0`,c.style.minHeight=S+`px`,c.style.maxHeight=s+`px`,i?.(),requestAnimationFrame(()=>h.current=!0)}},[m,o.trigger,o.valueNode,c,u,_,v,y,o.dir,i]);E(()=>x(),[x]);let[S,C]=R.useState();return E(()=>{u&&C(window.getComputedStyle(u).zIndex)},[u]),(0,z.jsx)(Hr,{scope:r,contentWrapper:c,shouldExpandOnScrollRef:h,onScrollButtonChange:R.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,z.jsx)(`div`,{ref:l,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:S},children:(0,z.jsx)(n.div,{...a,ref:f,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});zr.displayName=Rr;var Br=`SelectPopperPosition`,Vr=R.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=X,...a}=e,o=br(n);return(0,z.jsx)(O,{...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=R.forwardRef((e,t)=>{let{__scopeSelect:r,nonce:i,...a}=e,o=Z(Wr,r),s=Ur(Wr,r),c=p(t,o.onViewportChange),l=R.useRef(0);return(0,z.jsxs)(z.Fragment,{children:[(0,z.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:i}),(0,z.jsx)(hr.Slot,{scope:r,children:(0,z.jsx)(n.div,{"data-radix-select-viewport":``,role:`presentation`,...a,ref:c,style:{position:`relative`,flex:1,overflow:`hidden auto`,...a.style},onScroll:P(a.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=s;if(r?.current&&n){let e=Math.abs(l.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`)}}}l.current=t.scrollTop})})})]})});Gr.displayName=Wr;var Kr=`SelectGroup`,[qr,Jr]=vr(Kr),Yr=R.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e,a=j();return(0,z.jsx)(qr,{scope:r,id:a,children:(0,z.jsx)(n.div,{role:`group`,"aria-labelledby":a,...i,ref:t})})});Yr.displayName=Kr;var Xr=`SelectLabel`,Zr=R.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e,a=Jr(Xr,r);return(0,z.jsx)(n.div,{id:a.id,...i,ref:t})});Zr.displayName=Xr;var Qr=`SelectItem`,[$r,ei]=vr(Qr),ti=R.forwardRef((e,t)=>{let{__scopeSelect:r,value:i,disabled:a=!1,textValue:o,...s}=e,c=J(Qr,r),l=Z(Qr,r),u=c.value===i,[d,f]=R.useState(o??``),[m,h]=R.useState(!1),g=p(t,e=>l.itemRefCallback?.(e,i,a)),_=j(),v=R.useRef(`touch`),y=()=>{a||(c.onValueChange(i),c.onOpenChange(!1))};if(i===``)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,z.jsx)($r,{scope:r,value:i,disabled:a,textId:_,isSelected:u,onItemTextChange:R.useCallback(e=>{f(t=>t||(e?.textContent??``).trim())},[]),children:(0,z.jsx)(hr.ItemSlot,{scope:r,value:i,disabled:a,textValue:d,children:(0,z.jsx)(n.div,{role:`option`,"aria-labelledby":_,"data-highlighted":m?``:void 0,"aria-selected":u&&m,"data-state":u?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:g,onFocus:P(s.onFocus,()=>h(!0)),onBlur:P(s.onBlur,()=>h(!1)),onClick:P(s.onClick,()=>{v.current!==`mouse`&&y()}),onPointerUp:P(s.onPointerUp,()=>{v.current===`mouse`&&y()}),onPointerDown:P(s.onPointerDown,e=>{v.current=e.pointerType}),onPointerMove:P(s.onPointerMove,e=>{v.current=e.pointerType,a?l.onItemLeave?.():v.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:P(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:P(s.onKeyDown,e=>{l.searchRef?.current!==``&&e.key===` `||(mr.includes(e.key)&&y(),e.key===` `&&e.preventDefault())})})})})});ti.displayName=Qr;var ni=`SelectItemText`,ri=R.forwardRef((e,t)=>{let{__scopeSelect:r,className:i,style:a,...o}=e,s=J(ni,r),c=Z(ni,r),l=ei(ni,r),u=Cr(ni,r),[d,f]=R.useState(null),m=p(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),h=d?.textContent,g=R.useMemo(()=>(0,z.jsx)(`option`,{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:_,onNativeOptionRemove:v}=u;return E(()=>(_(g),()=>v(g)),[_,v,g]),(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(n.span,{id:l.textId,...o,ref:m}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Te.createPortal(o.children,s.valueNode):null]})});ri.displayName=ni;var ii=`SelectItemIndicator`,ai=R.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e;return ei(ii,r).isSelected?(0,z.jsx)(n.span,{"aria-hidden":!0,...i,ref:t}):null});ai.displayName=ii;var oi=`SelectScrollUpButton`,si=R.forwardRef((e,t)=>{let n=Z(oi,e.__scopeSelect),r=Ur(oi,e.__scopeSelect),[i,a]=R.useState(!1),o=p(t,r.onScrollButtonChange);return E(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,z.jsx)(ui,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});si.displayName=oi;var ci=`SelectScrollDownButton`,li=R.forwardRef((e,t)=>{let n=Z(ci,e.__scopeSelect),r=Ur(ci,e.__scopeSelect),[i,a]=R.useState(!1),o=p(t,r.onScrollButtonChange);return E(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,z.jsx)(ui,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});li.displayName=ci;var ui=R.forwardRef((e,t)=>{let{__scopeSelect:r,onAutoScroll:i,...a}=e,o=Z(`SelectScrollButton`,r),s=R.useRef(null),c=gr(r),l=R.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return R.useEffect(()=>()=>l(),[l]),E(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,z.jsx)(n.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:P(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(i,50))}),onPointerMove:P(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(i,50))}),onPointerLeave:P(a.onPointerLeave,()=>{l()})})}),di=`SelectSeparator`,fi=R.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e;return(0,z.jsx)(n.div,{"aria-hidden":!0,...i,ref:t})});fi.displayName=di;var pi=`SelectArrow`,mi=R.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=br(n),a=J(pi,n),o=Z(pi,n);return a.open&&o.position===`popper`?(0,z.jsx)(Ce,{...i,...r,ref:t}):null});mi.displayName=pi;var hi=`SelectBubbleInput`,gi=R.forwardRef(({__scopeSelect:e,value:t,...r},i)=>{let a=R.useRef(null),o=p(i,a),s=fr(t);return R.useEffect(()=>{let e=a.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,z.jsx)(n.select,{...r,style:{...A,...r.style},ref:o,defaultValue:t})});gi.displayName=hi;function _i(e){return e===``||e===void 0}function vi(e){let t=_(e),n=R.useRef(``),r=R.useRef(0),i=R.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=R.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return R.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.jsx)(wi,{asChild:!0,children:(0,z.jsx)(ae,{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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.jsx)(le,{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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.jsx)(ae,{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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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)]`,f;n[9]===d?f=n[10]:(f=F(`p-1`,d),n[9]=d,n[10]=f);let p;n[11]!==r||n[12]!==f?(p=(0,z.jsx)(Di,{className:f,children:r}),n[11]=r,n[12]=f,n[13]=p):p=n[13];let m;n[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,z.jsx)(zi,{}),n[14]=m):m=n[14];let h;return n[15]!==s||n[16]!==a||n[17]!==t||n[18]!==l||n[19]!==p?(h=(0,z.jsx)(Ti,{children:(0,z.jsxs)(Ei,{ref:t,className:l,position:s,...a,children:[u,p,m]})}),n[15]=s,n[16]=a,n[17]=t,n[18]=l,n[19]=p,n[20]=h):h=n[20],h});Bi.displayName=Ei.displayName;var Vi=R.forwardRef((e,t)=>{let n=(0,L.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,z.jsx)(ji,{children:(0,z.jsx)(ve,{className:`h-4 w-4`})})}),n[6]=s):s=n[6];let c;n[7]===r?c=n[8]:(c=(0,z.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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,L.c)(14),{className:n,label:r,size:i}=e,o=i===void 0?`md`:i,s=o===`sm`?`h-4 w-4`:o===`lg`?`h-8 w-8`:`h-6 w-6`,c;t[0]===n?c=t[1]:(c=F(`flex h-full items-center justify-center`,n),t[0]=n,t[1]=c);let l;t[2]===s?l=t[3]:(l=F(s,`animate-spin mx-auto text-muted-foreground`),t[2]=s,t[3]=l);let u;t[4]===l?u=t[5]:(u=(0,z.jsx)(a,{className:l}),t[4]=l,t[5]=u);let d;t[6]===r?d=t[7]:(d=r?(0,z.jsx)(`p`,{className:F(I.bodyMuted,`mt-2`),children:r}):null,t[6]=r,t[7]=d);let f;t[8]!==u||t[9]!==d?(f=(0,z.jsxs)(`div`,{className:`text-center`,children:[u,d]}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;return t[11]!==c||t[12]!==f?(p=(0,z.jsx)(`div`,{className:c,children:f}),t[11]=c,t[12]=f,t[13]=p):p=t[13],p}function Gi(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.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,z.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}function qi(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,z.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,R.use)(Yi(e,t))}var $i=R.forwardRef((e,t)=>{let n=(0,L.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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(I.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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(I.bodyMuted,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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 R.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,z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,z.jsxs)($i,{className:`max-w-md`,children:[(0,z.jsx)(ea,{children:(0,z.jsx)(ta,{className:`text-destructive`,children:this.props.fallbackTitle??`Something went wrong`})}),(0,z.jsxs)(ra,{className:`space-y-4`,children:[(0,z.jsx)(`p`,{className:I.body,children:e.message}),(0,z.jsx)(k,{variant:`outline`,onClick:this.handleRetry,children:`Retry`})]})]})}):this.props.children}},oa=R.forwardRef((e,t)=>{let n=(0,L.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`,I.body,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,z.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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,z.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 $=R.forwardRef((e,t)=>{let n=(0,L.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,z.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=R.forwardRef((e,t)=>{let n=(0,L.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(I.caption,`mt-4`,r),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==t||n[7]!==a?(o=(0,z.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=er(e=>(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,z.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,z.jsx)(`h3`,{className:e.v0,children:`No history`}),(0,z.jsx)(`p`,{className:e.v1,children:`No conversation history found for this thread.`})]})}),{name:`ConversationHistoryContent_1`}),ma=er(e=>(0,z.jsxs)(`slot`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between border-b py-3 px-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.v0,e.v1]}),(0,z.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,L.c)(39),{scope:n,projects:r,loadVersion:i,currentPromptIndex:a,onPromptIndexChange:o}=e,s;t[0]!==i||t[1]!==n?(s=ba(n,i),t[0]=i,t[1]=n,t[2]=s):s=t[2];let c;t[3]!==r||t[4]!==n?(c=()=>xa(n,r),t[3]=r,t[4]=n,t[5]=c):c=t[5];let l=Qi(s,c),u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=function(e){return new Date(e).toLocaleString()},t[6]=u):u=t[6];let d=u,f;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(f=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]=f):f=t[7];let p=f,m;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(m=function(e){return{inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0}},t[8]=m):m=t[8];let h=m,_;t[9]!==a||t[10]!==l.messages||t[11]!==o?(_=function(){l.messages&&a<l.messages.length-1&&o(a+1)},t[9]=a,t[10]=l.messages,t[11]=o,t[12]=_):_=t[12];let v=_,y;t[13]!==a||t[14]!==o?(y=function(){a>0&&o(a-1)},t[13]=a,t[14]=o,t[15]=y):y=t[15];let b=y;if(!l.messages?.length){let e;return t[16]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,z.jsx)(pa,{v0:I.emptyStateTitle,v1:I.bodyMuted}),t[16]=e):e=t[16],e}let x=a===0,S;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,z.jsx)(te,{className:`h-4 w-4 mr-1`}),t[17]=S):S=t[17];let C;t[18]!==b||t[19]!==x?(C=(0,z.jsx)(k,{variant:`outline`,size:`sm`,onClick:b,disabled:x,children:S}),t[18]=b,t[19]=x,t[20]=C):C=t[20];let w=a>=l.messages.length-1,T;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,z.jsx)(he,{className:`h-4 w-4 ml-1`}),t[21]=T):T=t[21];let E;t[22]!==v||t[23]!==w?(E=(0,z.jsx)(k,{variant:`outline`,size:`sm`,onClick:v,disabled:w,children:T}),t[22]=v,t[23]=w,t[24]=E):E=t[24];let D=a+1,O=l.messages.length,A;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,z.jsx)(sa,{children:(0,z.jsxs)(ua,{children:[(0,z.jsx)(Q,{children:`Prompt`}),(0,z.jsx)(Q,{children:`Answer`}),(0,z.jsx)(Q,{className:`w-24`,children:`Model`}),(0,z.jsx)(Q,{className:`w-24 text-right`,children:`Duration`}),(0,z.jsx)(Q,{className:`w-20 text-right`,children:`Input Tokens`}),(0,z.jsx)(Q,{className:`w-20 text-right`,children:`Output Tokens`}),(0,z.jsx)(Q,{className:`w-32 text-right`,children:`Timestamp`})]})}),t[25]=A):A=t[25];let j;if(t[26]!==a||t[27]!==l.messages){let e;t[29]===a?e=t[30]:(e=(e,t)=>{let{inputTokens:n,outputTokens:r}=h(e);return(0,z.jsxs)(ua,{className:t===a?`bg-muted/50`:``,children:[(0,z.jsx)($,{className:`max-w-md`,children:(0,z.jsx)(`div`,{className:I.body,children:(0,z.jsx)(_a,{text:e.request.message})})}),(0,z.jsx)($,{className:`max-w-md`,children:e.response?(0,z.jsx)(`div`,{className:I.body,children:(0,z.jsx)(_a,{text:e.response.content})}):(0,z.jsx)(`span`,{className:F(I.bodyMuted,`italic`),children:`No response`})}),(0,z.jsx)($,{children:(0,z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(g,{className:`h-3 w-3 text-muted-foreground`}),(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,z.jsx)($,{className:F(I.caption,`text-right`),children:e.response?(0,z.jsx)(oe,{children:(0,z.jsxs)(ne,{children:[(0,z.jsx)(re,{asChild:!0,children:(0,z.jsx)(`div`,{className:`cursor-help`,children:p(e.timestamp,e.response.completedAt).display})}),(0,z.jsx)(ue,{children:(0,z.jsx)(`p`,{children:p(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,z.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,z.jsx)($,{className:F(I.bodyMuted,`text-right`),children:n>0?n.toLocaleString():`-`}),(0,z.jsx)($,{className:F(I.bodyMuted,`text-right`),children:r>0?r.toLocaleString():`-`}),(0,z.jsx)($,{className:F(I.bodyMuted,`text-right`),children:d(e.timestamp)})]},e.id)},t[29]=a,t[30]=e),j=l.messages.map(e),t[26]=a,t[27]=l.messages,t[28]=j}else j=t[28];let M;t[31]===j?M=t[32]:(M=(0,z.jsx)(ee,{className:`h-full`,children:(0,z.jsx)(`div`,{className:`py-4`,children:(0,z.jsxs)(oa,{children:[A,(0,z.jsx)(ca,{children:j})]})})}),t[31]=j,t[32]=M);let N;return t[33]!==l.messages.length||t[34]!==C||t[35]!==E||t[36]!==D||t[37]!==M?(N=(0,z.jsx)(ma,{v0:C,v1:E,v2:I.bodyMuted,v3:D,v4:O,v5:M}),t[33]=l.messages.length,t[34]=C,t[35]=E,t[36]=D,t[37]=M,t[38]=N):N=t[38],N},ga=`__ALL_PROJECTS__`;function _a(e){let t=(0,L.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,z.jsx)(z.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,z.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,z.jsxs)(z.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 pe(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 pe(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,R.memo)(function({isOpen:e,onClose:t,initialFilter:n,projects:r,inline:i}){let[a,o]=(0,R.useState)(0),[s,c]=(0,R.useState)(``),[u,d]=(0,R.useState)(``),[f,p]=(0,R.useState)(!1),[m,h]=(0,R.useState)(!1),[g,_]=(0,R.useState)(0),[v,y]=(0,R.useState)(null),[x,S]=(0,R.useState)(null),C=(0,R.useMemo)(()=>u?{type:`thread`,threadId:u}:s===ga?{type:`all`}:s?{type:`project`,projectId:s}:null,[s,u]),w=C?ba(C,g):null;(0,R.useEffect)(()=>{e&&n?n.type===`thread`?(d(n.id),c(``),o(0)):n.type===`project`&&(c(n.id),d(``),o(0)):e&&!n?(c(ga),d(``),o(0)):e||(d(``),c(``),o(0),S(null),y(null))},[e,n]);let E=e=>{d(e),c(``),o(0),y(null),S(null)},D=e=>{c(e),d(``),o(0),y(null),S(null)},O=(0,R.useCallback)(()=>{if(u){let e=r.flatMap(e=>e.threads).find(e=>e.threadId===u),t=r.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(s&&s!==ga){let e=r.find(e=>e.projectId===s)?.name??s;return{options:{projectId:s},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.`}},[r,s,u]),ee=(0,R.useCallback)(async()=>{let e=O();h(!0),S(null);try{await T(e.options),w&&Xi(w),y(w),o(0),p(!1)}catch(e){S(e instanceof Error?e.message:`Failed to clear conversation history`)}finally{h(!1)}},[O,w]);function te(){C&&Xi(ba(C,g)),_(e=>e+1),y(null),S(null)}let ne=O();if(!e)return null;let A=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(Fi,{value:s,onValueChange:D,children:[(0,z.jsx)(Li,{className:`w-48`,children:(0,z.jsx)(Ii,{placeholder:`Select project`})}),(0,z.jsxs)(Bi,{children:[(0,z.jsx)(Hi,{value:ga,children:`All Projects`}),r.map(e=>(0,z.jsx)(Hi,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,z.jsxs)(Fi,{value:u,onValueChange:E,children:[(0,z.jsx)(Li,{className:`w-48`,children:(0,z.jsx)(Ii,{placeholder:`Select thread`})}),(0,z.jsx)(Bi,{children:r.flatMap(e=>e.threads.map(t=>(0,z.jsx)(Hi,{value:t.threadId,children:va(t,e.name??e.projectId)},t.threadId)))})]}),(0,z.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>p(!0),disabled:m,children:[(0,z.jsx)(b,{className:`h-4 w-4 mr-2`}),`Clear`]})]}),re=(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsx)(`div`,{className:i?void 0:`border-b px-6 py-4`,children:(0,z.jsx)(nr,{title:`History`,description:i?`View and browse conversation history across projects and threads.`:void 0,action:(0,z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[A,i?null:(0,z.jsx)(k,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,z.jsx)(l,{})})]})})}),(0,z.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:x?(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,z.jsxs)($i,{className:`max-w-md`,children:[(0,z.jsx)(ea,{children:(0,z.jsx)(ta,{className:`text-destructive`,children:`Error`})}),(0,z.jsxs)(ra,{className:`space-y-4`,children:[(0,z.jsx)(`p`,{children:x}),(0,z.jsx)(k,{onClick:()=>S(null),children:`Dismiss`})]})]})}):v&&v===w?(0,z.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,z.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,z.jsx)(`h3`,{className:I.emptyStateTitle,children:`No history`}),(0,z.jsx)(`p`,{className:I.bodyMuted,children:`No conversation history found for this thread.`})]})}):C?(0,z.jsx)(aa,{fallbackTitle:`Failed to load conversation history`,onRetry:te,children:(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`}),children:(0,z.jsx)(ha,{scope:C,projects:r,loadVersion:g,currentPromptIndex:a,onPromptIndexChange:o},w??void 0)})}):(0,z.jsx)(Wi,{label:`Loading conversation history...`,size:`lg`})})]});return(0,z.jsxs)(z.Fragment,{children:[i?(0,z.jsx)(cr,{children:(0,z.jsx)(rr,{className:`max-w-none w-full h-full flex flex-col min-h-0`,children:re})}):(0,z.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:re}),(0,z.jsx)(it,{open:f,onOpenChange:p,children:(0,z.jsxs)(st,{children:[(0,z.jsxs)(ct,{children:[(0,z.jsx)(ut,{children:ne.title}),(0,z.jsx)(dt,{children:ne.description})]}),(0,z.jsxs)(lt,{children:[(0,z.jsx)(pt,{disabled:m,children:`Cancel`}),(0,z.jsx)(ft,{onClick:e=>{e.preventDefault(),ee()},disabled:m,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:m?`Clearing...`:`Clear`})]})]})})]})});export{ft as A,or as C,cr as D,rr as E,ct as F,ut as I,st as M,dt as N,er as O,lt as P,nr as S,lr as T,fr as _,Qi as a,dr as b,qi as c,Fi as d,Bi as f,Ii as g,Li as h,ra as i,pt as j,it 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,ir as v,ur as w,sr as x,ar as y};
|