UNPKG

decocms

Version:

Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools

5 lines (4 loc) • 32.2 kB
import{c as L,b as K,r as U,j as i,e3 as re,B as V,t as B,gl as ne,gm as Z,gZ as fe,n as ie,hx as Re,a6 as oe,d as Ae,hn as ue,L as ge,I as le,F as xe,aL as $e,aM as Te,aN as Le,aO as Ee,bc as Ke,aP as De,aQ as ze,aR as Fe,a_ as pe,m as Ue}from"./index-DoEtSiIe.js";import{C as Me}from"./checkbox-CkODjqKt.js";import{T as je}from"./textarea-CP9TQ5HN.js";import{i as Be}from"./ChevronSelectorVertical-Cvgyclsz.js";import{i as Je}from"./Play-C_9Fb_Ik.js";import{s as Oe}from"./Plus-BoPsX_T8.js";import{C as Ve}from"./combobox-B9eEiOM0.js";import{M as Ze}from"./multi-select-D3r33Eqf.js";import{d as he,c as be,b as Se,a as ye,S as ve}from"./select-OlcoUSVg.js";import{S as Ne}from"./switch-C5tCt-1T.js";import{J as He,a as We,u as qe,b as ke,c as Ye,d as ce,e as Ge,f as de,g as Qe}from"./jira-icon-pZDG9IEF.js";import{R as Xe,A as et}from"./review-settings-X9fyjheP.js";import{u as tt}from"./use-debounced-value-DqHSmPMR.js";import{u as Ce,a as st}from"./use-automations-CLa8yUdj.js";import{h as it}from"./task-board-BRF3ZwKz.js";import{b as nt,d as lt,S as at}from"./use-task-board-prompts-C468T8Y7.js";import{R as rt}from"./require-capability-FcSdruCZ.js";import"./Minus-CFYZtYi9.js";import"./command-D5O7M-Cf.js";import"./index-DRuy-mDa.js";import"./SearchMd-BGRe_18c.js";import"./popover-mrQ4T9ru.js";import"./badge-DONoxQO7.js";import"./ChevronDown-Dm2xO7jf.js";import"./index-BdQq_4o_.js";import"./index-BFFHlwFA.js";import"./ChevronUp-BKdcyIOm.js";import"./BookOpen01-DZs1-yi9.js";import"./UserSquare-dgrNjiXb.js";import"./use-organization-settings-CgKOO7Ms.js";import"./schema-CG6ylG0z.js";import"./use-connection-BO-ZUzee.js";import"./use-mcp-client-86j-Nolb.js";import"./auth-IBAsOARn.js";import"./XClose-BUxhnZ3x.js";import"./Zap-CxPsn4FS.js";import"./icon-button-DFliy54K.js";import"./tooltip-DhlWzeQv.js";import"./sheet-De8qzGNI.js";import"./use-org-fs-C62_MbqW.js";import"./useInfiniteQuery-9vIAXgqG.js";import"./infiniteQueryObserver-BRGiYBJv.js";import"./use-project-scope-AMUoXt2c.js";import"./repository-binding-BAQCDq-W.js";import"./watch-sse-pool-C0me6Edt.js";import"./backoff-CrEUbyZT.js";import"./access-gate-4Yp7vAaA.js";import"./capability-load-error-C6JoLBp9.js";const ot=/^([A-Za-z][A-Za-z0-9_]*-\d+)$/;function ct(t){const e=t.trim();if(e==="")return null;const s=/(?:\/(?:browse|issues)\/|[?&]selectedIssue=)([A-Za-z][A-Za-z0-9_]*-\d+)/.exec(e)?.[1]??e.split(/[?#]/)[0]??"",l=ot.exec(s);return l?.[1]?l[1].toUpperCase():null}function we(t){const e=[],a=[],s=new Set;for(const l of t.split(/[\n,;]+/)){const n=l.trim();if(n==="")continue;const c=ct(n);if(!c){a.push(n);continue}s.has(c)||(s.add(c),e.push(c))}return{keys:e,invalid:a}}function _e(t){const e=t.projectName?.replace(/\s+/g," ").trim(),a=t.name.trim();return e?{primary:e,secondary:[a,t.projectKey].filter(Boolean).join(" · ")}:{primary:a,secondary:t.projectKey??""}}function dt(t){const{primary:e,secondary:a}=_e(t);return[e,a,`#${t.id}`].filter(Boolean).join(" ")}function me(t){return t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),"").toLowerCase()}function mt(t,e){const a=me(e).trim();if(!a)return 1;const s=me(t);return a.split(/\s+/).every(l=>s.includes(l))?1:0}function ft(){const t=L.c(17),e=K(),{data:a,isPending:s}=nt(),l=lt(),n=a?.find(ut),c=n?.prompt??"",o=n?.skills??[],[u,m]=U.useState({prompt:c,skills:o}),[f,r]=U.useState(n);f!==n&&(r(n),m({prompt:c,skills:o}));const d=u.prompt!==c||u.skills.join(` `)!==o.join(` `);let g;t[0]!==e?(g=e("settings.taskPrompt.title"),t[0]=e,t[1]=g):g=t[1];let j;t[2]!==e?(j=e("settings.taskPrompt.fieldLabel"),t[2]=e,t[3]=j):j=t[3];let x;t[4]!==d||t[5]!==u||t[6]!==s||t[7]!==l||t[8]!==m||t[9]!==e?(x=s?i.jsx(re,{className:"h-44 w-full"}):i.jsxs("div",{className:"flex flex-col items-start gap-3",children:[i.jsx(je,{value:u.prompt,rows:10,maxLength:it,placeholder:e("settings.taskPrompt.placeholder"),onChange:h=>m({...u,prompt:h.target.value})}),i.jsxs("div",{className:"flex w-full flex-col gap-2",children:[i.jsx("span",{className:"text-sm font-medium text-foreground",children:e("settings.taskPrompt.skillsLabel")}),i.jsx(at,{value:u.skills,onChange:h=>m({...u,skills:h})})]}),i.jsx(V,{size:"sm",disabled:!d||l.isPending,onClick:()=>l.mutate({columnKey:null,rules:u},{onSuccess:()=>B.success(e("settings.taskPrompt.saved")),onError:()=>B.error(e("settings.taskPrompt.failed"))}),children:e("settings.taskPrompt.save")})]}),t[4]=d,t[5]=u,t[6]=s,t[7]=l,t[8]=m,t[9]=e,t[10]=x):x=t[10];let p;t[11]!==j||t[12]!==x?(p=i.jsx(ne,{children:i.jsx(Z,{title:j,children:x})}),t[11]=j,t[12]=x,t[13]=p):p=t[13];let b;return t[14]!==g||t[15]!==p?(b=i.jsx(fe,{title:g,children:p}),t[14]=g,t[15]=p,t[16]=b):b=t[16],b}function ut(t){return t.columnKey===null}function X(t,e){return t instanceof Error?t.message:e}const gt="https://id.atlassian.com/manage-profile/security/api-tokens";function xt(t){const e=L.c(7),{stepKeys:a}=t,s=K();let l;if(e[0]!==a||e[1]!==s){let c;e[3]!==s?(c=o=>i.jsx("li",{children:s(o)},o),e[3]=s,e[4]=c):c=e[4],l=a.map(c),e[0]=a,e[1]=s,e[2]=l}else l=e[2];let n;return e[5]!==l?(n=i.jsx("ol",{className:"list-decimal pl-5 flex flex-col gap-1 text-xs text-muted-foreground",children:l}),e[5]=l,e[6]=n):n=e[6],n}function pt(){const t=L.c(69),e=K(),a=ce(),[s,l]=U.useState(""),[n,c]=U.useState(""),[o,u]=U.useState("");let m;t[0]!==o||t[1]!==n||t[2]!==s?(m=s.trim()!==""&&n.trim()!==""&&o.trim()!=="",t[0]=o,t[1]=n,t[2]=s,t[3]=m):m=t[3];const f=m;let r;t[4]!==e?(r=e("settings.jira.siteLabel"),t[4]=e,t[5]=r):r=t[5];let d;t[6]!==r?(d=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r}),t[6]=r,t[7]=d):d=t[7];let g;t[8]===Symbol.for("react.memo_cache_sentinel")?(g=F=>l(F.target.value),t[8]=g):g=t[8];let j;t[9]!==e?(j=e("settings.jira.sitePlaceholder"),t[9]=e,t[10]=j):j=t[10];let x;t[11]!==s||t[12]!==j?(x=i.jsx(le,{value:s,onChange:g,placeholder:j,autoComplete:"off"}),t[11]=s,t[12]=j,t[13]=x):x=t[13];let p;t[14]!==d||t[15]!==x?(p=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[d,x]}),t[14]=d,t[15]=x,t[16]=p):p=t[16];let b;t[17]!==e?(b=e("settings.jira.emailLabel"),t[17]=e,t[18]=b):b=t[18];let h;t[19]!==b?(h=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:b}),t[19]=b,t[20]=h):h=t[20];let S;t[21]===Symbol.for("react.memo_cache_sentinel")?(S=F=>c(F.target.value),t[21]=S):S=t[21];let v;t[22]!==e?(v=e("settings.jira.emailPlaceholder"),t[22]=e,t[23]=v):v=t[23];let N;t[24]!==n||t[25]!==v?(N=i.jsx(le,{value:n,onChange:S,placeholder:v,autoComplete:"off"}),t[24]=n,t[25]=v,t[26]=N):N=t[26];let k;t[27]!==N||t[28]!==h?(k=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[h,N]}),t[27]=N,t[28]=h,t[29]=k):k=t[29];let C;t[30]!==e?(C=e("settings.jira.tokenLabel"),t[30]=e,t[31]=C):C=t[31];let y;t[32]!==C?(y=i.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:C}),t[32]=C,t[33]=y):y=t[33];let w;t[34]!==e?(w=e("settings.jira.createTokenLink"),t[34]=e,t[35]=w):w=t[35];let _;t[36]===Symbol.for("react.memo_cache_sentinel")?(_=i.jsx(xe,{size:12}),t[36]=_):_=t[36];let I;t[37]!==w?(I=i.jsxs("a",{href:gt,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-0.5 text-xs text-foreground hover:underline",children:[w,_]}),t[37]=w,t[38]=I):I=t[38];let R;t[39]!==y||t[40]!==I?(R=i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[y,I]}),t[39]=y,t[40]=I,t[41]=R):R=t[41];let D;t[42]===Symbol.for("react.memo_cache_sentinel")?(D=F=>u(F.target.value),t[42]=D):D=t[42];let A;t[43]!==e?(A=e("settings.jira.tokenPlaceholder"),t[43]=e,t[44]=A):A=t[44];let $;t[45]!==o||t[46]!==A?($=i.jsx(le,{type:"password",value:o,onChange:D,placeholder:A,autoComplete:"off"}),t[45]=o,t[46]=A,t[47]=$):$=t[47];let E;t[48]!==R||t[49]!==$?(E=i.jsxs("div",{className:"flex flex-col gap-1.5",children:[R,$]}),t[48]=R,t[49]=$,t[50]=E):E=t[50];const z=!f||a.isPending;let T;t[51]!==o||t[52]!==n||t[53]!==s||t[54]!==e||t[55]!==a?(T=()=>a.mutate({siteUrl:s.trim(),email:n.trim(),apiToken:o.trim()},{onSuccess:()=>B.success(e("settings.jira.connected")),onError:F=>B.error(X(F,e("settings.jira.connectFailed")))}),t[51]=o,t[52]=n,t[53]=s,t[54]=e,t[55]=a,t[56]=T):T=t[56];let P;t[57]!==e||t[58]!==a.isPending?(P=a.isPending?e("settings.jira.connecting"):e("settings.jira.connect"),t[57]=e,t[58]=a.isPending,t[59]=P):P=t[59];let M;t[60]!==z||t[61]!==T||t[62]!==P?(M=i.jsx(V,{size:"sm",className:"w-fit",disabled:z,onClick:T,children:P}),t[60]=z,t[61]=T,t[62]=P,t[63]=M):M=t[63];let J;return t[64]!==k||t[65]!==E||t[66]!==M||t[67]!==p?(J=i.jsxs("div",{className:"flex flex-col gap-4 mt-3 max-w-md",children:[p,k,E,M]}),t[64]=k,t[65]=E,t[66]=M,t[67]=p,t[68]=J):J=t[68],J}function jt(t){const e=L.c(44),{integration:a}=t,s=K(),l=Ge(),[n,c]=U.useState(!1),o=a.siteUrl,u=a.email;let m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=()=>c(!0),e[0]=m):m=e[0];let f;e[1]!==s?(f=s("settings.jira.disconnect"),e[1]=s,e[2]=f):f=e[2];let r;e[3]!==f?(r=i.jsx(V,{variant:"outline",size:"sm",onClick:m,children:f}),e[3]=f,e[4]=r):r=e[4];let d;e[5]!==a.email||e[6]!==a.siteUrl||e[7]!==r?(d=i.jsx(Z,{title:o,description:u,action:r}),e[5]=a.email,e[6]=a.siteUrl,e[7]=r,e[8]=d):d=e[8];let g;e[9]!==s?(g=s("settings.jira.disconnectTitle"),e[9]=s,e[10]=g):g=e[10];let j;e[11]!==g?(j=i.jsx($e,{children:g}),e[11]=g,e[12]=j):j=e[12];let x;e[13]!==s?(x=s("settings.jira.disconnectDescription"),e[13]=s,e[14]=x):x=e[14];let p;e[15]!==x?(p=i.jsx(Te,{children:x}),e[15]=x,e[16]=p):p=e[16];let b;e[17]!==p||e[18]!==j?(b=i.jsxs(Le,{children:[j,p]}),e[17]=p,e[18]=j,e[19]=b):b=e[19];let h;e[20]!==s?(h=s("settings.jira.cancel"),e[20]=s,e[21]=h):h=e[21];let S;e[22]!==h?(S=i.jsx(Ee,{children:h}),e[22]=h,e[23]=S):S=e[23];let v;e[24]!==l||e[25]!==s?(v=()=>l.mutate(void 0,{onSuccess:()=>B.success(s("settings.jira.disconnected")),onError:I=>B.error(X(I,s("settings.jira.saveFailed")))}),e[24]=l,e[25]=s,e[26]=v):v=e[26];let N;e[27]!==s?(N=s("settings.jira.disconnect"),e[27]=s,e[28]=N):N=e[28];let k;e[29]!==v||e[30]!==N?(k=i.jsx(Ke,{onClick:v,children:N}),e[29]=v,e[30]=N,e[31]=k):k=e[31];let C;e[32]!==S||e[33]!==k?(C=i.jsxs(De,{children:[S,k]}),e[32]=S,e[33]=k,e[34]=C):C=e[34];let y;e[35]!==b||e[36]!==C?(y=i.jsxs(ze,{children:[b,C]}),e[35]=b,e[36]=C,e[37]=y):y=e[37];let w;e[38]!==n||e[39]!==y?(w=i.jsx(Fe,{open:n,onOpenChange:c,children:y}),e[38]=n,e[39]=y,e[40]=w):w=e[40];let _;return e[41]!==w||e[42]!==d?(_=i.jsxs(i.Fragment,{children:[d,w]}),e[41]=w,e[42]=d,e[43]=_):_=e[43],_}function ht(t){const e=L.c(40),{integration:a}=t,s=K(),l=ce(),n=de(!0),[c,o]=U.useState("");let u;e[0]!==c?(u=c.trim(),e[0]=c,e[1]=u):u=e[1];const m=tt(u,300),f=de(m!=="",m);let r;if(e[2]!==n.data||e[3]!==m||e[4]!==f){const y=n.data??[],w=new Set(y.map(yt)),_=m?(f.data??[]).filter(I=>!w.has(I.id)):[];r=[...y,..._].map(St),e[2]=n.data,e[3]=m,e[4]=f,e[5]=r}else r=e[5];const d=r,g=a.boardId?d.find(y=>y.value===a.boardId)?.primary??a.boardName??a.boardId:null;let j;e[6]!==s?(j=s("settings.jira.boardLabel"),e[6]=s,e[7]=j):j=e[7];let x;e[8]!==s?(x=s("settings.jira.boardDescription"),e[8]=s,e[9]=x):x=e[9];const p=a.boardId??"";let b;e[10]!==s?(b=s("settings.jira.boardPlaceholder"),e[10]=s,e[11]=b):b=e[11];let h;e[12]!==s?(h=s("settings.jira.boardSearchPlaceholder"),e[12]=s,e[13]=h):h=e[13];let S;e[14]!==n.isPending||e[15]!==m||e[16]!==c||e[17]!==f||e[18]!==s?(S=n.isPending||c.trim()!==m||m!==""&&f.isFetching?s("settings.jira.loadingBoards"):s("settings.jira.noBoardsMatch"),e[14]=n.isPending,e[15]=m,e[16]=c,e[17]=f,e[18]=s,e[19]=S):S=e[19];let v;e[20]!==g||e[21]!==s?(v=()=>i.jsxs(V,{variant:"outline",role:"combobox",className:"w-72 justify-between font-normal",children:[i.jsx("span",{className:"truncate",children:g??s("settings.jira.boardPlaceholder")}),i.jsx(Be,{className:"opacity-50 shrink-0"})]}),e[20]=g,e[21]=s,e[22]=v):v=e[22];let N;e[23]!==d||e[24]!==a.boardId||e[25]!==s||e[26]!==l?(N=y=>{!y||y===a.boardId||l.mutate({boardId:y,boardName:d.find(w=>w.value===y)?.primary??null},{onError:w=>B.error(X(w,s("settings.jira.saveFailed")))})},e[23]=d,e[24]=a.boardId,e[25]=s,e[26]=l,e[27]=N):N=e[27];let k;e[28]!==d||e[29]!==N||e[30]!==p||e[31]!==b||e[32]!==h||e[33]!==S||e[34]!==v?(k=i.jsx(Ve,{options:d,value:p,width:"w-72",triggerClassName:"shrink-0",placeholder:b,searchPlaceholder:h,filter:mt,onSearchChange:o,emptyMessage:S,renderTrigger:v,renderItem:bt,onChange:N}),e[28]=d,e[29]=N,e[30]=p,e[31]=b,e[32]=h,e[33]=S,e[34]=v,e[35]=k):k=e[35];let C;return e[36]!==k||e[37]!==j||e[38]!==x?(C=i.jsx(Z,{title:j,description:x,action:k}),e[36]=k,e[37]=j,e[38]=x,e[39]=C):C=e[39],C}function bt(t,e){return i.jsxs("div",{className:"flex items-start gap-2 min-w-0 w-full",children:[i.jsxs("div",{className:"min-w-0 flex-1",children:[i.jsx("p",{className:"truncate",children:t.primary}),i.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.secondary})]}),i.jsx(pe,{className:Ue("mt-0.5 shrink-0",e?"opacity-100":"opacity-0")})]})}function St(t){const{primary:e,secondary:a}=_e(t);return{value:String(t.id),label:dt(t),primary:e,secondary:a}}function yt(t){return t.id}function vt(t){const e=L.c(28),{boardId:a}=t,s=K(),l=qe(a),n=ke();let c;if(l.isPending||n.isPending){let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(re,{className:"h-40 w-full"}),e[0]=r):r=e[0],c=r}else if(l.isError){let r;e[1]!==s?(r=s("settings.jira.columnsFailed"),e[1]=s,e[2]=r):r=e[2];let d;e[3]!==r?(d=i.jsx("p",{className:"text-xs text-muted-foreground",children:r}),e[3]=r,e[4]=d):d=e[4],c=d}else if((l.data??[]).length===0){let r;e[5]!==s?(r=s("settings.jira.noColumnsYet"),e[5]=s,e[6]=r):r=e[6];let d;e[7]!==r?(d=i.jsx("p",{className:"text-xs text-muted-foreground",children:r}),e[7]=r,e[8]=d):d=e[8],c=d}else{let r;if(e[9]!==n.data){r=new Map;for(const x of n.data??[])r.set(x.jiraStatus,[...r.get(x.jiraStatus)??[],x]);e[9]=n.data,e[10]=r}else r=e[10];let d,g;if(e[11]!==l.data||e[12]!==r){const x=(l.data??[]).flatMap(Nt);d="flex w-full flex-col gap-3",g=(l.data??[]).flatMap(p=>p.statuses.map(b=>i.jsx(It,{columnName:p.name,status:b,showStatus:b!==p.name||p.statuses.length>1,rules:r.get(b)??[],otherStatuses:x.filter(h=>h!==b)},`${p.name}:${b}`))),e[11]=l.data,e[12]=r,e[13]=d,e[14]=g}else d=e[13],g=e[14];let j;e[15]!==d||e[16]!==g?(j=i.jsx("div",{className:d,children:g}),e[15]=d,e[16]=g,e[17]=j):j=e[17],c=j}let o;e[18]!==s?(o=s("settings.jira.automationsLabel"),e[18]=s,e[19]=o):o=e[19];let u;e[20]!==s?(u=s("settings.jira.automationsDescription"),e[20]=s,e[21]=u):u=e[21];let m;e[22]!==c?(m=i.jsx("div",{className:"mt-3",children:c}),e[22]=c,e[23]=m):m=e[23];let f;return e[24]!==o||e[25]!==u||e[26]!==m?(f=i.jsx(Z,{title:o,description:u,children:m}),e[24]=o,e[25]=u,e[26]=m,e[27]=f):f=e[27],f}function Nt(t){return t.statuses}function kt(t){const e=L.c(16),{value:a,onChange:s,disabled:l,ariaLabel:n}=t,c=K();let o;if(e[0]!==n||e[1]!==l||e[2]!==s||e[3]!==c||e[4]!==a){const{keys:u,invalid:m}=we(a);let f;e[6]!==s?(f=g=>s(g.target.value),e[6]=s,e[7]=f):f=e[7];let r;e[8]!==c?(r=c("settings.jira.issueKeysPlaceholder"),e[8]=c,e[9]=r):r=e[9];let d;e[10]!==n||e[11]!==l||e[12]!==f||e[13]!==r||e[14]!==a?(d=i.jsx(je,{value:a,rows:3,disabled:l,onChange:f,placeholder:r,"aria-label":n,className:"font-mono text-xs",spellCheck:!1}),e[10]=n,e[11]=l,e[12]=f,e[13]=r,e[14]=a,e[15]=d):d=e[15],o=i.jsxs("div",{className:"flex w-full flex-col gap-1.5",children:[d,a.trim()!==""&&i.jsxs("p",{className:"text-xs text-muted-foreground",children:[c("settings.jira.issueKeysCount",{count:String(u.length)}),m.length>0&&i.jsxs("span",{className:"text-destructive",children:[" · ",c("settings.jira.issueKeysUnreadable",{items:m.slice(0,3).join(", ")})]})]})]}),e[0]=n,e[1]=l,e[2]=s,e[3]=c,e[4]=a,e[5]=o}else o=e[5];return o}function Ct(t){const e=L.c(8),{started:a,failed:s,startedLabel:l}=t;if(a.length===0&&s.length===0)return null;let n;e[0]!==a||e[1]!==l?(n=a.length>0&&i.jsxs("p",{children:[i.jsx(pe,{size:12,className:"mr-1 inline text-success"}),l,i.jsx("span",{className:"ml-1 font-mono",children:a.join(", ")})]}),e[0]=a,e[1]=l,e[2]=n):n=e[2];let c;e[3]!==s?(c=s.map(wt),e[3]=s,e[4]=c):c=e[4];let o;return e[5]!==n||e[6]!==c?(o=i.jsxs("div",{className:"flex flex-col gap-1 rounded-lg bg-muted/40 p-2.5 text-xs",children:[n,c]}),e[5]=n,e[6]=c,e[7]=o):o=e[7],o}function wt(t){return i.jsxs("p",{className:"text-destructive",children:[i.jsx("span",{className:"font-mono",children:t.issueKey})," — ",t.error]},t.issueKey)}function Ie(t){return t.kind!=="statuses"?t.kind:`statuses:${[...new Set(t.statuses.map(a=>a.trim().toLowerCase()))].sort().join(` `)}`}function _t(t){const e=L.c(17),{from:a}=t,s=K();switch(a.kind){case"any":{let l;e[0]!==s?(l=s("settings.jira.fromAny"),e[0]=s,e[1]=l):l=e[1];let n;return e[2]!==l?(n=i.jsx(i.Fragment,{children:l}),e[2]=l,e[3]=n):n=e[3],n}case"earlier":{let l;e[4]!==s?(l=s("settings.jira.fromEarlier"),e[4]=s,e[5]=l):l=e[5];let n;return e[6]!==l?(n=i.jsx(i.Fragment,{children:l}),e[6]=l,e[7]=n):n=e[7],n}case"later":{let l;e[8]!==s?(l=s("settings.jira.fromLater"),e[8]=s,e[9]=l):l=e[9];let n;return e[10]!==l?(n=i.jsx(i.Fragment,{children:l}),e[10]=l,e[11]=n):n=e[11],n}case"statuses":{let l;e[12]!==a.statuses||e[13]!==s?(l=s("settings.jira.fromStatuses",{statuses:a.statuses.join(", ")}),e[12]=a.statuses,e[13]=s,e[14]=l):l=e[14];let n;return e[15]!==l?(n=i.jsx(i.Fragment,{children:l}),e[15]=l,e[16]=n):n=e[16],n}}}function It(t){const e=L.c(32),{columnName:a,status:s,showStatus:l,rules:n,otherStatuses:c}=t,o=K(),{org:u}=oe(),m=Ae(),f=Ye(),[r,d]=U.useState(!1);let g;e[0]!==f||e[1]!==m||e[2]!==u||e[3]!==s||e[4]!==o?(g=C=>f.mutate({jiraStatus:s,from:C},{onSuccess:y=>{d(!1),m({to:"/$org/projects/$agentId/automations/$automationId",params:{org:u.slug,agentId:ue(u.id),automationId:y.automationId}})},onError:y=>B.error(X(y,o("settings.jira.saveFailed")))}),e[0]=f,e[1]=m,e[2]=u,e[3]=s,e[4]=o,e[5]=g):g=e[5];const j=g;let x;e[6]!==a?(x=i.jsx("span",{className:"truncate text-sm font-medium",children:a}),e[6]=a,e[7]=x):x=e[7];let p;e[8]!==l||e[9]!==s?(p=l&&i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:s}),e[8]=l,e[9]=s,e[10]=p):p=e[10];let b;e[11]!==x||e[12]!==p?(b=i.jsxs("div",{className:"flex flex-col min-w-0",children:[x,p]}),e[11]=x,e[12]=p,e[13]=b):b=e[13];let h;e[14]!==r||e[15]!==o?(h=!r&&i.jsxs(V,{variant:"outline",size:"sm",className:"shrink-0",onClick:()=>d(!0),children:[i.jsx(Oe,{size:14}),o("settings.jira.addAutomation")]}),e[14]=r,e[15]=o,e[16]=h):h=e[16];let S;e[17]!==b||e[18]!==h?(S=i.jsxs("div",{className:"flex items-start justify-between gap-2",children:[b,h]}),e[17]=b,e[18]=h,e[19]=S):S=e[19];let v;e[20]!==r||e[21]!==j||e[22]!==f.isPending||e[23]!==c||e[24]!==n?(v=r&&i.jsx(At,{taken:new Set(n.map(Rt)),otherStatuses:c,pending:f.isPending,onCreate:j,onCancel:()=>d(!1)}),e[20]=r,e[21]=j,e[22]=f.isPending,e[23]=c,e[24]=n,e[25]=v):v=e[25];let N;e[26]!==n?(N=n.map(Pt),e[26]=n,e[27]=N):N=e[27];let k;return e[28]!==S||e[29]!==v||e[30]!==N?(k=i.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border p-3",children:[S,v,N]}),e[28]=S,e[29]=v,e[30]=N,e[31]=k):k=e[31],k}function Pt(t){return i.jsx(Tt,{rule:t},t.automationId)}function Rt(t){return Ie(t.from)}function At(t){const e=L.c(51),{taken:a,otherStatuses:s,pending:l,onCreate:n,onCancel:c}=t,o=K();let u;e[0]!==a?(u=["any","earlier","later","statuses"].filter(P=>P==="statuses"||!a.has(P)),e[0]=a,e[1]=u):u=e[1];const m=u,[f,r]=U.useState(m[0]??"statuses");let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[2]=d):d=e[2];const[g,j]=U.useState(d);let x,p;e[3]!==f||e[4]!==g||e[5]!==a?(x=f==="statuses"?{kind:f,statuses:g}:{kind:f},p=(f!=="statuses"||g.length>0)&&!a.has(Ie(x)),e[3]=f,e[4]=g,e[5]=a,e[6]=x,e[7]=p):(x=e[6],p=e[7]);const b=p;let h;e[8]!==o?(h=o("settings.jira.originLabel"),e[8]=o,e[9]=h):h=e[9];let S;e[10]!==h?(S=i.jsx("span",{className:"text-xs font-medium",children:h}),e[10]=h,e[11]=S):S=e[11];let v;e[12]===Symbol.for("react.memo_cache_sentinel")?(v=P=>r(P),e[12]=v):v=e[12];let N;e[13]===Symbol.for("react.memo_cache_sentinel")?(N=i.jsx(Se,{size:"sm",className:"w-fit min-w-56",children:i.jsx(ye,{})}),e[13]=N):N=e[13];let k;e[14]!==m||e[15]!==o?(k=i.jsx(he,{children:m.map(P=>i.jsx(be,{value:P,className:"text-xs",children:P==="any"?o("settings.jira.fromAny"):P==="earlier"?o("settings.jira.fromEarlier"):P==="later"?o("settings.jira.fromLater"):o("settings.jira.fromStatuses",{statuses:"…"})},P))}),e[14]=m,e[15]=o,e[16]=k):k=e[16];let C;e[17]!==f||e[18]!==k?(C=i.jsxs(ve,{value:f,onValueChange:v,children:[N,k]}),e[17]=f,e[18]=k,e[19]=C):C=e[19];let y;e[20]!==f||e[21]!==s||e[22]!==o?(y=f==="statuses"&&i.jsx(Ze,{options:s.map($t),onValueChange:j,placeholder:o("settings.jira.originStatusesPlaceholder"),className:"text-xs"}),e[20]=f,e[21]=s,e[22]=o,e[23]=y):y=e[23];let w;e[24]!==o?(w=o("settings.jira.originHelp"),e[24]=o,e[25]=w):w=e[25];let _;e[26]!==w?(_=i.jsx("p",{className:"text-xs text-muted-foreground",children:w}),e[26]=w,e[27]=_):_=e[27];let I;e[28]!==o?(I=o("settings.jira.cancelRule"),e[28]=o,e[29]=I):I=e[29];let R;e[30]!==c||e[31]!==I?(R=i.jsx(V,{variant:"ghost",size:"sm",onClick:c,children:I}),e[30]=c,e[31]=I,e[32]=R):R=e[32];const D=!b||l;let A;e[33]!==x||e[34]!==n?(A=()=>n(x),e[33]=x,e[34]=n,e[35]=A):A=e[35];let $;e[36]!==o?($=o("settings.jira.createRule"),e[36]=o,e[37]=$):$=e[37];let E;e[38]!==D||e[39]!==A||e[40]!==$?(E=i.jsx(V,{size:"sm",disabled:D,onClick:A,children:$}),e[38]=D,e[39]=A,e[40]=$,e[41]=E):E=e[41];let z;e[42]!==R||e[43]!==E?(z=i.jsxs("div",{className:"flex items-center justify-end gap-2",children:[R,E]}),e[42]=R,e[43]=E,e[44]=z):z=e[44];let T;return e[45]!==y||e[46]!==_||e[47]!==z||e[48]!==S||e[49]!==C?(T=i.jsxs("div",{className:"flex flex-col gap-2 rounded-lg border border-dashed border-border p-2.5",children:[S,C,y,_,z]}),e[45]=y,e[46]=_,e[47]=z,e[48]=S,e[49]=C,e[50]=T):T=e[50],T}function $t(t){return{label:t,value:t}}function Tt(t){const e=L.c(29),{rule:a}=t,s=K(),{org:l}=oe(),n=Ce().data?.find(S=>S.id===a.automationId),{update:c}=st(),o=n?.active??a.active,u=n?.name??a.jiraStatus;let m;e[0]!==n?.virtual_mcp_id||e[1]!==l.id?(m=n?.virtual_mcp_id??ue(l.id),e[0]=n?.virtual_mcp_id,e[1]=l.id,e[2]=m):m=e[2];let f;e[3]!==l.slug||e[4]!==a.automationId||e[5]!==m?(f={org:l.slug,agentId:m,automationId:a.automationId},e[3]=l.slug,e[4]=a.automationId,e[5]=m,e[6]=f):f=e[6];let r;e[7]!==u?(r=i.jsx("span",{className:"truncate text-sm text-foreground",children:u}),e[7]=u,e[8]=r):r=e[8];let d;e[9]!==a.from?(d=i.jsx("span",{className:"truncate text-xs text-muted-foreground",children:i.jsx(_t,{from:a.from})}),e[9]=a.from,e[10]=d):d=e[10];let g;e[11]!==f||e[12]!==r||e[13]!==d?(g=i.jsxs(ge,{to:"/$org/projects/$agentId/automations/$automationId",params:f,className:"flex min-w-0 flex-1 flex-col hover:underline",children:[r,d]}),e[11]=f,e[12]=r,e[13]=d,e[14]=g):g=e[14];const j=c.isPending;let x;e[15]!==a.automationId||e[16]!==c?(x=S=>c.mutate({id:a.automationId,active:S}),e[15]=a.automationId,e[16]=c,e[17]=x):x=e[17];let p;e[18]!==u||e[19]!==s?(p=s("settings.jira.toggleAutomation",{name:u}),e[18]=u,e[19]=s,e[20]=p):p=e[20];let b;e[21]!==o||e[22]!==x||e[23]!==p||e[24]!==c.isPending?(b=i.jsx(Ne,{checked:o,disabled:j,onCheckedChange:x,"aria-label":p}),e[21]=o,e[22]=x,e[23]=p,e[24]=c.isPending,e[25]=b):b=e[25];let h;return e[26]!==g||e[27]!==b?(h=i.jsxs("div",{className:"flex items-center gap-3 rounded-lg bg-muted/40 px-2.5 py-2",children:[g,b]}),e[26]=g,e[27]=b,e[28]=h):h=e[28],h}function Lt(){const t=L.c(77),e=K(),{org:a}=oe(),s=Qe(),l=ke(),[n,c]=U.useState(""),[o,u]=U.useState(null),[m,f]=U.useState(!1),[r,d]=U.useState(null),g=Ce().data;let j;t[0]!==l.data?(j=[...new Map((l.data??[]).map(Kt)).values()],t[0]=l.data,t[1]=j):j=t[1];const x=j,p=o??x[0]?.automationId??null;let b;t[2]!==n?(b=we(n),t[2]=n,t[3]=b):b=t[3];const h=b,S=p!==null&&h.keys.length>0&&!s.isPending,v=m&&h.keys.length>1;let N;t[4]!==p||t[5]!==v||t[6]!==S||t[7]!==n||t[8]!==s||t[9]!==e?(N=()=>{!S||!p||(d(null),s.mutate({automationId:p,issueKey:n,...v?{together:!0}:{}},{onSuccess:O=>d({started:O.started.map(Et),failed:O.failed,together:v}),onError:O=>B.error(X(O,e("settings.jira.testRunFailed")))}))},t[4]=p,t[5]=v,t[6]=S,t[7]=n,t[8]=s,t[9]=e,t[10]=N):N=t[10];const k=N;let C;t[11]!==e?(C=e("settings.jira.testRunLabel"),t[11]=e,t[12]=C):C=t[12];let y;t[13]!==e?(y=e("settings.jira.testRunDescription"),t[13]=e,t[14]=y):y=t[14];const w=s.isPending;let _;t[15]!==e?(_=e("settings.jira.testRunIssueAriaLabel"),t[15]=e,t[16]=_):_=t[16];let I;t[17]!==n||t[18]!==s.isPending||t[19]!==_?(I=i.jsx(kt,{value:n,onChange:c,disabled:w,ariaLabel:_}),t[17]=n,t[18]=s.isPending,t[19]=_,t[20]=I):I=t[20];let R;t[21]!==p||t[22]!==g||t[23]!==x||t[24]!==e?(R=x.length===0?i.jsx("p",{className:"text-xs text-muted-foreground",children:e("settings.jira.testRunNoAutomations")}):i.jsxs(ve,{value:p??void 0,onValueChange:u,children:[i.jsx(Se,{size:"sm",className:"w-fit min-w-56","aria-label":e("settings.jira.testRunAutomation"),children:i.jsx(ye,{})}),i.jsx(he,{children:x.map(O=>i.jsx(be,{value:O.automationId,className:"text-xs",children:g?.find(Pe=>Pe.id===O.automationId)?.name??O.jiraStatus},O.automationId))})]}),t[21]=p,t[22]=g,t[23]=x,t[24]=e,t[25]=R):R=t[25];let D;t[26]!==h.keys.length||t[27]!==e||t[28]!==m?(D=h.keys.length>1&&i.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 text-xs",children:[i.jsx(Me,{checked:m,onCheckedChange:O=>f(O===!0)}),e("settings.jira.together")]}),t[26]=h.keys.length,t[27]=e,t[28]=m,t[29]=D):D=t[29];let A;t[30]!==e?(A=e("settings.jira.testRunHelp"),t[30]=e,t[31]=A):A=t[31];let $;t[32]!==A?($=i.jsx("p",{className:"text-xs text-muted-foreground",children:A}),t[32]=A,t[33]=$):$=t[33];const E=!S;let z;t[34]===Symbol.for("react.memo_cache_sentinel")?(z=i.jsx(Je,{size:14}),t[34]=z):z=t[34];let T;t[35]!==h.keys.length||t[36]!==s.isPending||t[37]!==e?(T=s.isPending?e("settings.jira.testRunRunning"):e("settings.jira.testRun",{count:String(h.keys.length||"")}),t[35]=h.keys.length,t[36]=s.isPending,t[37]=e,t[38]=T):T=t[38];let P;t[39]!==k||t[40]!==E||t[41]!==T?(P=i.jsxs(V,{size:"sm",className:"shrink-0",disabled:E,onClick:k,children:[z,T]}),t[39]=k,t[40]=E,t[41]=T,t[42]=P):P=t[42];let M;t[43]!==$||t[44]!==P?(M=i.jsxs("div",{className:"flex items-center justify-between gap-2",children:[$,P]}),t[43]=$,t[44]=P,t[45]=M):M=t[45];let J;t[46]!==r?.started?(J=r?.started??[],t[46]=r?.started,t[47]=J):J=t[47];let F;t[48]!==r?.failed?(F=r?.failed??[],t[48]=r?.failed,t[49]=F):F=t[49];const ae=r?.together?"settings.jira.togetherStarted":"settings.jira.testRunStarted";let H;t[50]!==e||t[51]!==ae?(H=e(ae),t[50]=e,t[51]=ae,t[52]=H):H=t[52];let W;t[53]!==J||t[54]!==F||t[55]!==H?(W=i.jsx(Ct,{started:J,failed:F,startedLabel:H}),t[53]=J,t[54]=F,t[55]=H,t[56]=W):W=t[56];let q;t[57]!==a.slug?(q={org:a.slug},t[57]=a.slug,t[58]=q):q=t[58];let ee;t[59]===Symbol.for("react.memo_cache_sentinel")?(ee={tab:"threads"},t[59]=ee):ee=t[59];let Y;t[60]!==e?(Y=e("settings.jira.testRunWatch"),t[60]=e,t[61]=Y):Y=t[61];let te;t[62]===Symbol.for("react.memo_cache_sentinel")?(te=i.jsx(xe,{size:12}),t[62]=te):te=t[62];let G;t[63]!==q||t[64]!==Y?(G=i.jsxs(ge,{to:"/$org/settings/monitor",params:q,search:ee,className:"flex w-fit items-center gap-1 text-xs text-muted-foreground underline hover:text-foreground",children:[Y,te]}),t[63]=q,t[64]=Y,t[65]=G):G=t[65];let Q;t[66]!==M||t[67]!==W||t[68]!==G||t[69]!==I||t[70]!==R||t[71]!==D?(Q=i.jsxs("div",{className:"mt-3 flex w-full flex-col gap-3",children:[I,R,D,M,W,G]}),t[66]=M,t[67]=W,t[68]=G,t[69]=I,t[70]=R,t[71]=D,t[72]=Q):Q=t[72];let se;return t[73]!==Q||t[74]!==C||t[75]!==y?(se=i.jsx(Z,{title:C,description:y,children:Q}),t[73]=Q,t[74]=C,t[75]=y,t[76]=se):se=t[76],se}function Et(t){return t.issueKey}function Kt(t){return[t.automationId,t]}function Dt(t){const e=L.c(16),{integration:a}=t,s=K(),l=ce();let n;e[0]!==s?(n=s("settings.jira.enabledLabel"),e[0]=s,e[1]=n):n=e[1];let c;e[2]!==s?(c=s("settings.jira.enabledDescription"),e[2]=s,e[3]=c):c=e[3];let o;e[4]!==a.boardId||e[5]!==s||e[6]!==l?(o=f=>{if(f&&!a.boardId){B.error(s("settings.jira.enableRequirements"));return}l.mutate({enabled:f},{onError:r=>B.error(X(r,s("settings.jira.saveFailed")))})},e[4]=a.boardId,e[5]=s,e[6]=l,e[7]=o):o=e[7];let u;e[8]!==a.enabled||e[9]!==o||e[10]!==l.isPending?(u=i.jsx(Ne,{checked:a.enabled,disabled:l.isPending,onCheckedChange:o}),e[8]=a.enabled,e[9]=o,e[10]=l.isPending,e[11]=u):u=e[11];let m;return e[12]!==n||e[13]!==c||e[14]!==u?(m=i.jsx(Z,{title:n,description:c,action:u}),e[12]=n,e[13]=c,e[14]=u,e[15]=m):m=e[15],m}function zt(t){const e=L.c(24),{integration:a}=t,s=K(),l=`${window.location.origin}/api/_jira/webhook/${a.webhookSecret}`;let n;e[0]!==s?(n=s("settings.jira.webhookTitle"),e[0]=s,e[1]=n):n=e[1];let c;e[2]!==s?(c=s("settings.jira.webhookDescription"),e[2]=s,e[3]=c):c=e[3];let o;e[4]!==l?(o=i.jsx(le,{readOnly:!0,value:l,className:"font-mono text-xs"}),e[4]=l,e[5]=o):o=e[5];let u;e[6]!==s||e[7]!==l?(u=()=>{navigator.clipboard.writeText(l),B.success(s("settings.jira.webhookCopied"))},e[6]=s,e[7]=l,e[8]=u):u=e[8];let m;e[9]!==s?(m=s("settings.jira.webhookCopy"),e[9]=s,e[10]=m):m=e[10];let f;e[11]!==u||e[12]!==m?(f=i.jsx(V,{variant:"outline",size:"sm",className:"shrink-0",onClick:u,children:m}),e[11]=u,e[12]=m,e[13]=f):f=e[13];let r;e[14]!==o||e[15]!==f?(r=i.jsxs("div",{className:"flex items-center gap-2",children:[o,f]}),e[14]=o,e[15]=f,e[16]=r):r=e[16];let d;e[17]===Symbol.for("react.memo_cache_sentinel")?(d=i.jsx(xt,{stepKeys:["settings.jira.webhookStep1","settings.jira.webhookStep2","settings.jira.webhookStep3","settings.jira.webhookStep4","settings.jira.webhookStep5"]}),e[17]=d):d=e[17];let g;e[18]!==r?(g=i.jsxs("div",{className:"flex flex-col gap-3 mt-3",children:[r,d]}),e[18]=r,e[19]=g):g=e[19];let j;return e[20]!==n||e[21]!==c||e[22]!==g?(j=i.jsx(Z,{title:n,description:c,children:g}),e[20]=n,e[21]=c,e[22]=g,e[23]=j):j=e[23],j}function Ft(){const t=L.c(24),e=K(),a=We();if(a.isPending){let r;return t[0]===Symbol.for("react.memo_cache_sentinel")?(r=i.jsx(ne,{children:i.jsx("div",{className:"p-4",children:i.jsx(re,{className:"h-40 w-full"})})}),t[0]=r):r=t[0],r}if(!a.data){let r;t[1]!==e?(r=e("settings.jira.connectTitle"),t[1]=e,t[2]=r):r=t[2];let d;t[3]!==e?(d=e("settings.jira.connectDescription"),t[3]=e,t[4]=d):d=t[4];let g;t[5]===Symbol.for("react.memo_cache_sentinel")?(g=i.jsx(pt,{}),t[5]=g):g=t[5];let j;return t[6]!==r||t[7]!==d?(j=i.jsx(ne,{children:i.jsx(Z,{title:r,description:d,children:g})}),t[6]=r,t[7]=d,t[8]=j):j=t[8],j}const s=a.data;let l,n;t[9]!==s?(l=i.jsx(jt,{integration:s}),n=i.jsx(ht,{integration:s}),t[9]=s,t[10]=l,t[11]=n):(l=t[10],n=t[11]);let c;t[12]!==s.boardId?(c=s.boardId&&i.jsx(vt,{boardId:s.boardId}),t[12]=s.boardId,t[13]=c):c=t[13];let o;t[14]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(Lt,{}),t[14]=o):o=t[14];let u,m;t[15]!==s?(u=i.jsx(Dt,{integration:s}),m=i.jsx(zt,{integration:s}),t[15]=s,t[16]=u,t[17]=m):(u=t[16],m=t[17]);let f;return t[18]!==l||t[19]!==n||t[20]!==c||t[21]!==u||t[22]!==m?(f=i.jsxs(ne,{children:[l,n,c,o,u,m]}),t[18]=l,t[19]=n,t[20]=c,t[21]=u,t[22]=m,t[23]=f):f=t[23],f}function Ut(){const t=L.c(18),e=K();let a;t[0]!==e?(a=e("settings.nav.tasks"),t[0]=e,t[1]=a):a=t[1];let s;t[2]!==a?(s=i.jsx(ie.Title,{children:a}),t[2]=a,t[3]=s):s=t[3];let l,n,c;t[4]===Symbol.for("react.memo_cache_sentinel")?(l=i.jsx(Xe,{}),n=i.jsx(ft,{}),c=i.jsx(et,{}),t[4]=l,t[5]=n,t[6]=c):(l=t[4],n=t[5],c=t[6]);let o;t[7]===Symbol.for("react.memo_cache_sentinel")?(o=i.jsx(He,{size:18}),t[7]=o):o=t[7];let u;t[8]!==e?(u=e("settings.jira.sectionTitle"),t[8]=e,t[9]=u):u=t[9];let m;t[10]!==u?(m=i.jsxs("span",{className:"flex items-center gap-2",children:[o,u]}),t[10]=u,t[11]=m):m=t[11];let f;t[12]===Symbol.for("react.memo_cache_sentinel")?(f=i.jsx(Ft,{}),t[12]=f):f=t[12];let r;t[13]!==m?(r=i.jsx(fe,{title:m,children:f}),t[13]=m,t[14]=r):r=t[14];let d;return t[15]!==s||t[16]!==r?(d=i.jsx(ie,{children:i.jsx(ie.Content,{children:i.jsx(ie.Container,{children:i.jsxs(Re,{children:[s,l,n,c,r]})})})}),t[15]=s,t[16]=r,t[17]=d):d=t[17],d}function Es(){const t=L.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=i.jsx(rt,{capability:"org:manage",area:"settings",children:i.jsx(Ut,{})}),t[0]=e):e=t[0],e}export{Es as default};