decocms
Version:
Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools
2 lines (1 loc) • 7.47 kB
JavaScript
import{c as y,j as s,u as $,b as S,d as v,B as N,N as w,$ as K,i as C,K as T,h as I}from"./index-ztdGKvBm.js";import{A as F}from"./agent-icon-BYWtutu9.js";import{R as P}from"./required-auth-layout-Cwtu4iIe.js";import"./AlertCircle-BlMH0XE7.js";import"./UserCheck01-k-4bTA2h.js";import"./Tool01-BCJ5kyrz.js";import"./ArrowUp-D5DDc3Cp.js";import"./ArrowLeft-B0PZnf1E.js";import"./ArrowRight-mzMrxxYI.js";import"./BookOpen01-DU-B3R7s.js";import"./Globe04-CeAQ1YNm.js";import"./CheckCircle-DZ8MNpCP.js";import"./ChevronDown-XsLJSrfl.js";import"./ChevronSelectorVertical-CB0fn1Nq.js";import"./ChevronUp-BQktpZWC.js";import"./UserSquare-CafFh5_d.js";import"./LinkBroken01-DfUhihLM.js";import"./CreditCard01-MY4ouqtl.js";import"./File02-DaYek2y9.js";import"./MessageCircle01-BG1RhOiZ.js";import"./SwitchHorizontal01-CMdpIiQk.js";import"./Eye-kjjhS0vP.js";import"./Fingerprint04-B2fDIuT8.js";import"./Image01-BcIZ5mtf.js";import"./Key01-CaJGjh13.js";import"./LayoutLeft-DDtN-od-.js";import"./Minus-hZzPDO0w.js";import"./Monitor01-DMFbvudn.js";import"./Sun-O9TdKcV_.js";import"./Play-BCFOaioW.js";import"./Plus-DWySsEmB.js";import"./SearchMd-BD2qldmS.js";import"./ShoppingBag01-BbjW7cod.js";import"./Trash01-BxBhF2b8.js";import"./Upload01-q-rKSvZf.js";import"./Users01-DM58_gUL.js";import"./XClose-CmTuu4UN.js";import"./Zap-CBJ7My90.js";async function _(t){const e=new URLSearchParams({site:t}),l=await fetch(`/api/_editor-resolve?${e.toString()}`,{headers:{Accept:"application/json"}});if(!l.ok){const r=new Error(`editor-resolve HTTP ${l.status}`);throw r.status=l.status,r}return await l.json()}function R(t){const e=t?.status;return typeof e=="number"&&e>=400&&e<500}function k(t){return{...t.pageId?{contentPageId:t.pageId}:{},...t.path?{contentPath:t.path}:{},...t.pathTemplate?{contentPathTemplate:t.pathTemplate}:{}}}function b(t){const e=y.c(2),{children:l}=t;let r;return e[0]!==l?(r=s.jsx("div",{className:"flex min-h-screen w-full items-center justify-center bg-background p-6",children:s.jsx("div",{className:"flex w-full max-w-md flex-col items-center gap-6 text-center",children:l})}),e[0]=l,e[1]=r):r=e[1],r}function A(){const t=y.c(5),e=S();let l;t[0]===Symbol.for("react.memo_cache_sentinel")?(l=s.jsx(I,{className:"size-6 text-muted-foreground"}),t[0]=l):l=t[0];let r;t[1]!==e?(r=e("chooseEditor.resolving"),t[1]=e,t[2]=r):r=t[2];let i;return t[3]!==r?(i=s.jsxs(b,{children:[l,s.jsx("p",{className:"text-sm text-muted-foreground",children:r})]}),t[3]=r,t[4]=i):i=t[4],i}function E(t){const e=y.c(29),{titleKey:l,descriptionKey:r,onRetry:i}=t,n=S(),m=v();let d;e[0]!==n||e[1]!==l?(d=n(l),e[0]=n,e[1]=l,e[2]=d):d=e[2];let u;e[3]!==d?(u=s.jsx("h1",{className:"text-lg font-medium text-foreground",children:d}),e[3]=d,e[4]=u):u=e[4];let p;e[5]!==r||e[6]!==n?(p=n(r),e[5]=r,e[6]=n,e[7]=p):p=e[7];let a;e[8]!==p?(a=s.jsx("p",{className:"text-sm text-muted-foreground",children:p}),e[8]=p,e[9]=a):a=e[9];let c;e[10]!==u||e[11]!==a?(c=s.jsxs("div",{className:"flex flex-col gap-2",children:[u,a]}),e[10]=u,e[11]=a,e[12]=c):c=e[12];let f;e[13]!==i||e[14]!==n?(f=i?s.jsx(N,{variant:"outline",onClick:i,children:n("chooseEditor.retry")}):null,e[13]=i,e[14]=n,e[15]=f):f=e[15];let o;e[16]!==m?(o=()=>m({to:"/"}),e[16]=m,e[17]=o):o=e[17];let g;e[18]!==n?(g=n("chooseEditor.backToStudio"),e[18]=n,e[19]=g):g=e[19];let j;e[20]!==o||e[21]!==g?(j=s.jsx(N,{onClick:o,children:g}),e[20]=o,e[21]=g,e[22]=j):j=e[22];let x;e[23]!==f||e[24]!==j?(x=s.jsxs("div",{className:"flex items-center gap-2",children:[f,j]}),e[23]=f,e[24]=j,e[25]=x):x=e[25];let h;return e[26]!==x||e[27]!==c?(h=s.jsxs(b,{children:[c,x]}),e[26]=x,e[27]=c,e[28]=h):h=e[28],h}function q(t){const e=y.c(6),{orgSlug:l,projectId:r,pageSearch:i}=t;let n;e[0]!==l||e[1]!==r?(n={org:l,agentId:r},e[0]=l,e[1]=r,e[2]=n):n=e[2];let m;return e[3]!==i||e[4]!==n?(m=s.jsx(w,{to:K.siteEditorContent,params:n,search:i,replace:!0}),e[3]=i,e[4]=n,e[5]=m):m=e[5],m}function L(t){const e=y.c(26),{matches:l,pageSearch:r}=t,i=S(),n=v();let m;e[0]!==n||e[1]!==r?(m=x=>{n({to:K.siteEditorContent,params:{org:x.orgSlug,agentId:x.project.id},search:r})},e[0]=n,e[1]=r,e[2]=m):m=e[2];const d=m;let u;e[3]!==i?(u=i("chooseEditor.chooser.title"),e[3]=i,e[4]=u):u=e[4];let p;e[5]!==u?(p=s.jsx("h1",{className:"text-lg font-medium text-foreground",children:u}),e[5]=u,e[6]=p):p=e[6];let a;e[7]!==i?(a=i("chooseEditor.chooser.subtitle"),e[7]=i,e[8]=a):a=e[8];let c;e[9]!==a?(c=s.jsx("p",{className:"text-sm text-muted-foreground",children:a}),e[9]=a,e[10]=c):c=e[10];let f;e[11]!==p||e[12]!==c?(f=s.jsxs("div",{className:"flex flex-col gap-2",children:[p,c]}),e[11]=p,e[12]=c,e[13]=f):f=e[13];let o;if(e[14]!==l||e[15]!==d||e[16]!==i){let x;e[18]!==d||e[19]!==i?(x=h=>s.jsxs("button",{type:"button",onClick:()=>d(h),"aria-label":i("chooseEditor.chooser.openAriaLabel",{title:h.project.title,org:h.orgName}),className:"flex w-full items-center gap-3 rounded-lg border border-border bg-card p-3 text-left transition-colors hover:bg-accent",children:[s.jsx(F,{icon:h.project.icon,name:h.project.title,size:"sm"}),s.jsxs("div",{className:"flex min-w-0 flex-col",children:[s.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:h.project.title}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:h.orgName})]})]},`${h.orgSlug}/${h.project.id}`),e[18]=d,e[19]=i,e[20]=x):x=e[20],o=l.map(x),e[14]=l,e[15]=d,e[16]=i,e[17]=o}else o=e[17];let g;e[21]!==o?(g=s.jsx("div",{className:"flex w-full flex-col gap-2",children:o}),e[21]=o,e[22]=g):g=e[22];let j;return e[23]!==f||e[24]!==g?(j=s.jsxs(b,{children:[f,g]}),e[23]=f,e[24]=g,e[25]=j):j=e[25],j}function z(){const t=y.c(24);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e={from:"/choose-editor"},t[0]=e):e=t[0];const l=$(e);let r,i,n,m;t[1]!==l?(i=l.site?.trim()??"",r=k(l),m=C,n=T.editorResolve(i),t[1]=l,t[2]=r,t[3]=i,t[4]=n,t[5]=m):(r=t[2],i=t[3],n=t[4],m=t[5]);let d;t[6]!==i?(d=()=>_(i),t[6]=i,t[7]=d):d=t[7];const u=i.length>0;let p;t[8]!==n||t[9]!==d||t[10]!==u?(p={queryKey:n,queryFn:d,enabled:u,staleTime:1/0,retry:B},t[8]=n,t[9]=d,t[10]=u,t[11]=p):p=t[11];const a=m(p);if(!i){let o;return t[12]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(E,{titleKey:"chooseEditor.notFound.title",descriptionKey:"chooseEditor.notFound.description"}),t[12]=o):o=t[12],o}if(a.isError){let o;return t[13]!==a?(o=R(a.error)?s.jsx(E,{titleKey:"chooseEditor.notFound.title",descriptionKey:"chooseEditor.notFound.description"}):s.jsx(E,{titleKey:"chooseEditor.error.title",descriptionKey:"chooseEditor.error.description",onRetry:()=>a.refetch()}),t[13]=a,t[14]=o):o=t[14],o}if(!a.data){let o;return t[15]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(A,{}),t[15]=o):o=t[15],o}const{matches:c}=a.data;if(c.length===0){let o;return t[16]===Symbol.for("react.memo_cache_sentinel")?(o=s.jsx(E,{titleKey:"chooseEditor.notFound.title",descriptionKey:"chooseEditor.notFound.description"}),t[16]=o):o=t[16],o}if(c.length===1&&c[0]){let o;return t[17]!==c[0].orgSlug||t[18]!==c[0].project.id||t[19]!==r?(o=s.jsx(q,{orgSlug:c[0].orgSlug,projectId:c[0].project.id,pageSearch:r}),t[17]=c[0].orgSlug,t[18]=c[0].project.id,t[19]=r,t[20]=o):o=t[20],o}let f;return t[21]!==c||t[22]!==r?(f=s.jsx(L,{matches:c,pageSearch:r}),t[21]=c,t[22]=r,t[23]=f):f=t[23],f}function B(t,e){return!R(e)&&t<2}function Ke(){const t=y.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx(P,{children:s.jsx(z,{})}),t[0]=e):e=t[0],e}export{Ke as default};