decocms
Version:
Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools
38 lines (31 loc) • 32.4 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/connections-C0U7G-PU.js","assets/index-DoEtSiIe.js","assets/index-DOMlzk_A.css","assets/extract-connection-data-DXA3Rt-s.js","assets/metadata-D72DunRR.js","assets/connection-BxF6Rdiu.js","assets/url-slug-CiUrNKts.js","assets/collection-display-button-CrLnf-_h.js","assets/ArrowUp-s5a8DQxj.js","assets/SwitchHorizontal01-CHtrDs50.js","assets/tooltip-DhlWzeQv.js","assets/index-BFFHlwFA.js","assets/toggle-group-CtXgLS7e.js","assets/active-indicator-CCMhAsc_.js","assets/badge-DONoxQO7.js","assets/search-toggle-CMYcoB9P.js","assets/SearchMd-BGRe_18c.js","assets/icon-button-DFliy54K.js","assets/collection-tabs-9jbbjBDw.js","assets/connection-card-Ca3jxrTD.js","assets/useInfiniteQuery-9vIAXgqG.js","assets/infiniteQueryObserver-BRGiYBJv.js","assets/connection-slug-B7w04sZ1.js","assets/session-runtime-CZKHty5X.js","assets/integration-icon-DvT6X8cI.js","assets/LinkBroken01-CyjdgWmP.js","assets/agent-icon-DoabtHNW.js","assets/AlertCircle-GoAGGV0G.js","assets/UserCheck01-CA8kXGn8.js","assets/Tool01-D90Wr5xR.js","assets/ArrowLeft-DuGHc_Gh.js","assets/ArrowRight-CMJyKdyB.js","assets/BookOpen01-DZs1-yi9.js","assets/Globe04-5yHQa01g.js","assets/CheckCircle-vIQcB0iT.js","assets/ChevronDown-Dm2xO7jf.js","assets/ChevronSelectorVertical-Cvgyclsz.js","assets/ChevronUp-BKdcyIOm.js","assets/UserSquare-dgrNjiXb.js","assets/CreditCard01-BUXydXso.js","assets/File02-Y4Nh84qP.js","assets/MessageCircle01-zc37Krdu.js","assets/Eye-DwRCQHLk.js","assets/Fingerprint04-DlIWxzRc.js","assets/Image01-BRABRo3v.js","assets/Key01-DfLmV_su.js","assets/LayoutLeft-owMYqid0.js","assets/Minus-CFYZtYi9.js","assets/Monitor01-DUhT2Mcw.js","assets/Sun-uwKn4QPm.js","assets/Play-C_9Fb_Ik.js","assets/Plus-BoPsX_T8.js","assets/ShoppingBag01-CoN4FBW5.js","assets/Trash01-Ctp9Olbr.js","assets/Upload01-DgxprpI7.js","assets/Users01-BasqfwpC.js","assets/XClose-BUxhnZ3x.js","assets/Zap-CxPsn4FS.js","assets/empty-state-C4MgLcBg.js","assets/use-delete-connection-BBTdkJYy.js","assets/use-infinite-scroll-uxxC9xbL.js","assets/use-mobile-BjsAkqwr.js","assets/drawer-DO0sMAej.js","assets/form-DwGozYbG.js","assets/label-G4Rj_cXa.js","assets/select-OlcoUSVg.js","assets/index-BdQq_4o_.js","assets/textarea-CP9TQ5HN.js","assets/use-connection-BO-ZUzee.js","assets/use-mcp-client-86j-Nolb.js","assets/auth-IBAsOARn.js","assets/repository-binding-BAQCDq-W.js","assets/types-rurFGFZy.js","assets/use-project-scope-AMUoXt2c.js","assets/schema-C5ZQLddp.js","assets/connection-form-helpers-oAW0sDLm.js","assets/authenticate-and-persist-oauth-BmdGjqM8.js","assets/mcp-oauth-C4zfq49i.js","assets/mcp-oauth-BkAlBGe_.js","assets/checkbox-CkODjqKt.js","assets/skills-BjbKR2I7.js","assets/folder-icon-DC-T6LMD.js","assets/markdown-DeZATUv_.js","assets/use-copy-CjEnyhFT.js","assets/chat-context-vJ6R-Clt.js","assets/use-panel-navigate-DHff9CS9.js","assets/thread-route-D-UE3Db_.js","assets/use-view-draft-kind-hbAZo1QG.js","assets/use-blog-view-DJnS2ipo.js","assets/use-organization-settings-CgKOO7Ms.js","assets/schema-CG6ylG0z.js","assets/task-board-BRF3ZwKz.js","assets/thread-intent-R2KI8ie_.js","assets/delay-CnY5UFtP.js","assets/backoff-CrEUbyZT.js","assets/watch-sse-pool-C0me6Edt.js","assets/use-entitlements-4v7LU4jM.js","assets/use-ai-providers-BwkzkRi2.js","assets/use-current-view-C2fbVQ-O.js","assets/use-in-settings-LMUeu63D.js","assets/use-decopilot-events-DwNDOIa1.js","assets/use-org-fs-C62_MbqW.js","assets/file-preview-BKJnTrOe.js","assets/utils-CzRFs-0R.js","assets/editor-UaRoONxx.js","assets/file-type-icon-R4tsODq6.js","assets/require-capability-FcSdruCZ.js","assets/access-gate-4Yp7vAaA.js","assets/capability-load-error-C6JoLBp9.js","assets/sections-44_mUmcy.js","assets/use-ask-in-chat-CuhqUmC7.js","assets/shell-layout-596_q4a1.js","assets/use-deployment-admin-Bh76rlF7.js","assets/admin-fetch-BhTJlAsX.js","assets/use-org-notice-BzvGZbQ2.js","assets/command-D5O7M-Cf.js","assets/index-DRuy-mDa.js","assets/project-icon-BxqBM24K.js","assets/use-navigate-to-agent-C-BC28kE.js","assets/use-debounced-value-DqHSmPMR.js","assets/new-project-dialog-CT39WKMt.js","assets/repository-picker-BBkgoOlP.js","assets/github-icon-YYYF_UPl.js","assets/collection-search-DL8nJQx4.js","assets/new-project-store-DYc4RZIM.js","assets/legacy-admin-welcome-dialog-BYL3pyxT.js","assets/required-auth-layout-DPL2sBE1.js","assets/use-org-sso-CypQjzG8.js","assets/shell-layout-CE2Eihra.css","assets/memory-ls8FI-ER.js","assets/alert-C5EpdwBA.js","assets/repositories-Bf8CqdKD.js","assets/empty-state-UX_DOq42.js","assets/collapsible-BdVp5Lcb.js","assets/secret-picker-j7H2EK7l.js","assets/use-secrets-DumIaW5z.js"])))=>i.map(i=>d[i]);
import{c as T,b as q,a6 as ge,r as $,j as s,B as O,q as Re,n as _,a_ as Ke,I as Le,ai as ze,aa as Fe,t as L,K as Ae,h as ye,av as Me,dR as Be,m as je,hw as We,P as z,hx as De,bb as G,L as Ue}from"./index-DoEtSiIe.js";import{n as ve}from"./BookOpen01-DZs1-yi9.js";import{b0 as qe,b1 as Ge,aG as Ve,u as He,k as ke,b2 as Je,b3 as Qe}from"./agent-icon-DoabtHNW.js";import{n as Ye,l as Xe}from"./UserCheck01-CA8kXGn8.js";import{t as Ze}from"./Tool01-D90Wr5xR.js";import{R as et}from"./require-capability-FcSdruCZ.js";import{P as U}from"./sections-44_mUmcy.js";import{i as tt}from"./CheckCircle-vIQcB0iT.js";import{i as nt}from"./SearchMd-BGRe_18c.js";import{i as st}from"./UserSquare-dgrNjiXb.js";import{i as ce}from"./Upload01-DgxprpI7.js";import{t as rt}from"./Users01-BasqfwpC.js";import{s as it}from"./XClose-BUxhnZ3x.js";import{J as D,R as N}from"./chat-context-vJ6R-Clt.js";import{T as ot}from"./textarea-CP9TQ5HN.js";import{E as at}from"./empty-state-C4MgLcBg.js";import{u as we}from"./use-ask-in-chat-CuhqUmC7.js";import{u as Ne,l as lt,k as ct,h as de,m as dt,n as ut,o as ft,w as mt}from"./use-org-fs-C62_MbqW.js";function xt(t,e,r){return e?"color":r?"font":/^--brand-(text|fw|leading|tracking)/i.test(t)?"type":/^--brand-space/i.test(t)?"space":/^--brand-radius/i.test(t)?"radius":/^--brand-shadow/i.test(t)?"shadow":/^--brand-(duration|delay|ease)/i.test(t)?"motion":"other"}const pt=/^(rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\(/i,bt=/^#([0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,ht=["svg","png","jpg","jpeg","webp","avif","gif"];function gt(t){return t.split(".").pop()?.toLowerCase()??""}function yt(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Z(t){const e=t.trim();return bt.test(e)||pt.test(e)}function jt(t){const e=t.trim(),r=e.match(/^#([0-9a-f]{3})$/i);return r?.[1]?`#${[...r[1]].map(n=>n+n).join("")}`:e}function vt(t){const e=[],r=new Map,n=/(--brand-[\w-]+)\s*:\s*([^;]+);/g;let i;for(;(i=n.exec(t))!==null;){const o=i[1],a=i[2].trim();r.has(o)||e.push(o),r.set(o,a)}return e.map(o=>{const a=r.get(o),l=Z(a),c=/^--brand-font/i.test(o);return{name:o,value:a,isColor:l,isFont:c,kind:xt(o,l,c)}})}const ue=["primary","secondary","accent","neutral","success","warning","error","info","bg","fg","border","ring"];function kt(t){return t.match(/^--brand-([a-z]+)/i)?.[1]?.toLowerCase()??t}function Cn(t){const e=[],r=new Map;for(const i of t){if(i.kind!=="color")continue;const o=kt(i.name);r.has(o)||(e.push(o),r.set(o,[])),r.get(o).push(i)}return e.map(i=>{const o=r.get(i);return{family:i,tokens:o,isRamp:o.filter(a=>/-\d+$/.test(a.name)).length>=5}}).sort((i,o)=>{const a=ue.indexOf(i.family),l=ue.indexOf(o.family);return a===-1&&l===-1?0:a===-1?1:l===-1?-1:a-l})}function wt(t,e,r){const n=new RegExp(`(${yt(e)}\\s*:\\s*)[^;]+(;)`);if(n.test(t))return t.replace(n,(a,l,c)=>`${l}${r}${c}`);const i=t.search(/:root\s*\{/);if(i!==-1){const a=t.indexOf("{",i)+1;return`${t.slice(0,a)}
${e}: ${r};${t.slice(a)}`}const o=t.length>0&&!t.endsWith(`
`)?`
`:"";return`${t}${o}:root {
${e}: ${r};
}
`}function Nt(t){const e=t.filter(n=>n.kind==="file"),r=e.find(n=>/(^|\/)logo\.(svg|png|jpe?g|webp|avif|gif)$/i.test(n.path));return r?r.path:e.find(n=>ht.includes(gt(n.path)))?.path??null}function $t(t){const e={};for(const r of t.split(`
`)){const n=r.match(/^([A-Za-z][\w-]*):\s*(.*)$/);n?.[1]&&n[2]!==void 0&&(e[n[1].toLowerCase()]=n[2].trim())}return e}function fe(t){for(const e of t.split(/\n\s*\n/)){const r=e.trim();if(!(!r||r.startsWith("#")))return r.replace(/\n/g," ")}return null}function St(t){const e=t.match(/^---\n([\s\S]*?)\n---\n?/);if(!e||e[1]===void 0)return{name:null,description:fe(t),disableModelInvocation:!1,body:t};const r=$t(e[1]),n=t.slice(e[0].length);return{name:r.name||null,description:r.description||fe(n),disableModelInvocation:r["disable-model-invocation"]==="true",body:n}}function ee(t){return t.replace(/^\s*(?:[-*+]|\d+\.|>)\s*/,"").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/[*_`]/g,"").trim()}function $e(t){return t.replace(/^\d+\.\s*/,"").replace(/\s*\(.*\)\s*$/,"").trim()}function Ct(t){const e=t.trim();return e.length>0&&!e.startsWith("#")&&!e.startsWith("|")&&!e.startsWith("```")}function _t(t){const e=[];for(const r of t.split(/^## /m).slice(1)){const[n="",...i]=r.split(`
`),o=$e(n),a=i.find(Ct);o&&e.push({title:o,summary:a?ee(a):""})}return e}function It(t){const e=[];for(const n of t.split(`
`))if(n.trimStart().startsWith(">"))e.push(ee(n));else if(e.length>0)break;return e.join(" ").trim()||null}const Tt=/^\s*[-*]\s*(?:✅|✓|✔)\s*/,Pt=/^\s*[-*]\s*(?:❌|✗|✘)\s*/;function Ot(t){const e=t.split(`
`),r=n=>{const i=e.find(o=>n.test(o));return i?ee(i.replace(n,"")):null};return{doLine:r(Tt),dontLine:r(Pt)}}function X(t){return(t.split(",")[0]??"").replace(/["']/g,"").trim()}function Et(t,e){const r=t.split(",").slice(1).join(",");return r?`"${e}",${r}`:`"${e}"`}const me=[{id:"basics",items:[{id:"voice",match:/voice|tone|\btom\b|\bvoz\b/i},{id:"audience",match:/audience|customer|persona|p[úu]blico/i},{id:"examples",match:/example|phrase|frase/i}]},{id:"rules",items:[{id:"rules",match:/\brules?\b|\bdo'?s\b|instruction|regras?\b/i},{id:"vocabulary",match:/vocab|glossar|vocabul/i}]},{id:"guardrails",items:[{id:"donts",match:/don.?t|avoid|guardrail|never|evitar/i}]},{id:"extra",items:[{id:"values",match:/\bvalues?\b|valores/i},{id:"competitors",match:/competitor|rival|concorrent/i},{id:"keywords",match:/keyword|palavras-chave|\bseo\b/i},{id:"dates",match:/date|campaign|calendar|datas|campanha/i},{id:"policies",match:/polic|shipping|returns?\b|frete|troca/i}]}],Rt=["donts","examples","vocabulary","keywords","voice","audience","rules","values","competitors","dates","policies"];function Kt(t){const e=me.flatMap(i=>i.items),r=new Map,n=[];for(const i of t){const o=Rt.find(a=>e.find(l=>l.id===a)?.match.test(i.title));o?r.set(o,[...r.get(o)??[],i]):n.push(i)}return{groups:me.map(i=>({id:i.id,items:i.items.map(o=>({id:o.id,sections:r.get(o.id)??[]}))})),more:n}}function Se(t){const e=[...t.matchAll(/^## (.*)$/gm)];return e.map((r,n)=>({title:$e(r[1]??""),start:(r.index??0)+r[0].length,end:e[n+1]?.index??t.length}))}function xe(t,e){const r=Se(t).find(n=>n.title===e);return r?t.slice(r.start,r.end).trim():null}function Lt(t,e,r){const n=Se(t).find(a=>a.title===e),i=r.trim();if(!n){const a=t.length===0||t.endsWith(`
`)?"":t.endsWith(`
`)?`
`:`
`;return`${t}${a}## ${e}
${i}
`}const o=n.end<t.length?`
`:`
`;return`${t.slice(0,n.start)}
${i}${o}${t.slice(n.end)}`}function zt(t,e){const r=e.trim().split(`
`).map(a=>`> ${a.trim()}`).join(`
`),n=t.split(`
`),i=n.findIndex(a=>a.trimStart().startsWith(">"));if(i!==-1){let a=i;for(;n[a+1]?.trimStart().startsWith(">");)a++;return r?[...n.slice(0,i),r,...n.slice(a+1)].join(`
`):[...n.slice(0,i),...n.slice(a+2)].join(`
`)}if(!r)return t;const o=t.search(/^## /m);return o===-1?`${t}${t.endsWith(`
`)||!t?"":`
`}
${r}
`:`${t.slice(0,o)}${r}
${t.slice(o)}`}const pe="brands",be=["primary","secondary","accent","bg","fg"],Ft={primary:"library.context.colorPrimary",secondary:"library.context.colorSecondary",accent:"library.context.colorAccent",bg:"library.context.colorBackground",fg:"library.context.colorText"},At={basics:"library.context.groupBasics",rules:"library.context.groupRules",guardrails:"library.context.groupGuardrails",extra:"library.context.groupExtra"},Mt={voice:{labelKey:"library.context.itemVoice",Icon:He},audience:{labelKey:"library.context.itemAudience",Icon:rt},examples:{labelKey:"library.context.itemExamples",Icon:Ve},rules:{labelKey:"library.context.itemRules",Icon:tt},vocabulary:{labelKey:"library.context.itemVocabulary",Icon:Ge},donts:{labelKey:"library.context.itemDonts",Icon:Fe},values:{labelKey:"library.context.itemValues",Icon:qe},competitors:{labelKey:"library.context.itemCompetitors",Icon:st},keywords:{labelKey:"library.context.itemKeywords",Icon:nt},dates:{labelKey:"library.context.itemDates",Icon:Ye},policies:{labelKey:"library.context.itemPolicies",Icon:ze}};function Bt(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Wt(){const t=T.c(23),e=q(),{org:r}=ge(),n=we(),i=Ne(N,pe),o=(i.data??[]).filter(Dt),[a,l]=$.useState(null),c=o.find(m=>m.path===a)??o[0]??null;if(i.isLoading){let m;return t[0]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsx("div",{className:"flex h-64 items-center justify-center",children:s.jsx(ye,{className:"size-5 text-muted-foreground"})}),t[0]=m):m=t[0],m}if(!c){let m;t[1]!==e?(m=e("library.context.brandEmptyTitle"),t[1]=e,t[2]=m):m=t[2];let g;t[3]!==e?(g=e("library.context.brandEmptyDescription"),t[3]=e,t[4]=g):g=t[4];let y;t[5]!==n||t[6]!==r.slug||t[7]!==e?(y=()=>n(e("library.context.fillBrandPrompt",{path:`${N}/${pe}/${r.slug}/brand.md`})),t[5]=n,t[6]=r.slug,t[7]=e,t[8]=y):y=t[8];let j;t[9]!==e?(j=e("library.context.fillFromSite"),t[9]=e,t[10]=j):j=t[10];let w;t[11]!==y||t[12]!==j?(w=s.jsx(O,{size:"sm",onClick:y,children:j}),t[11]=y,t[12]=j,t[13]=w):w=t[13];let I;return t[14]!==m||t[15]!==g||t[16]!==w?(I=s.jsx(at,{image:null,title:m,description:g,actions:w}),t[14]=m,t[15]=g,t[16]=w,t[17]=I):I=t[17],I}const f="flex flex-col gap-6",u=o.length>1&&s.jsx("div",{className:"flex flex-wrap gap-1.5",children:o.map(m=>s.jsx(O,{variant:"outline",size:"sm",onClick:()=>l(m.path),"aria-pressed":m.path===c.path,children:D(m.path)},m.path))});let p;t[18]!==c?(p=s.jsx(Ut,{brand:c},c.path),t[18]=c,t[19]=p):p=t[19];let h;return t[20]!==u||t[21]!==p?(h=s.jsxs("div",{className:f,children:[u,p]}),t[20]=u,t[21]=p,t[22]=h):h=t[22],h}function Dt(t){return t.kind==="dir"}function Ut({brand:t}){const e=q(),r=lt(),n=Re(),i=we(),{org:o}=ge(),{upload:a,remove:l}=ct(N),c=$.useRef(null),[f,u]=$.useState(null),[p,h]=$.useState(!1),m=f!==null,g=Ne(N,t.path),y=g.data??[],j=d=>y.some(x=>x.kind==="file"&&D(x.path)===d),w=r(N,`${t.path}/tokens.css`),I=r(N,`${t.path}/brand.md`),V=de(w,{enabled:j("tokens.css")}),te=de(I,{enabled:j("brand.md")}),ne=g.isSuccess&&(!j("brand.md")||typeof te.data=="string")&&(!j("tokens.css")||typeof V.data=="string"),E=te.data??"",F=St(E),Ce=F.name??Bt(D(t.path)),M=It(F.body)??F.description,{doLine:H,dontLine:J}=Ot(F.body),{groups:_e,more:se}=Kt(_t(F.body)),re=`${N}/${t.path}/brand.md`,P=Nt(y),Ie=vt(V.data??""),R=d=>Ie.find(x=>x.name===`--brand-${d}`)?.value,ie=be.flatMap(d=>{const x=R(d);return x?[{id:d,value:x}]:[]}),Q=d=>f?.tokens[d]??R(d),oe=(d,x)=>u(b=>b&&{...b,tokens:{...b.tokens,[d]:x}}),K=Q("font-display"),B=Q("font-body"),ae=R("primary-900")??R("primary-800")??R("primary"),Te=d=>f?.sections[d]??xe(E,d)??"",Pe=(d,x)=>u(b=>b&&{...b,sections:{...b.sections,[d]:x}}),Oe=async()=>{if(!f)return;let d=E;for(const[k,C]of Object.entries(f.sections)){const A=xe(E,k);C.trim()!==(A??"").trim()&&(A===null&&!C.trim()||(d=Lt(d,k,C)))}if(f.quote!==null&&f.quote.trim()!==(M??"").trim()&&(d=zt(d,f.quote)),Object.entries(f.tokens).some(([k,C])=>be.includes(k)&&!Z(C))){L.error(e("library.brandPreview.invalidColor"));return}const b=V.data??"";let v=b;for(const[k,C]of Object.entries(f.tokens))C!==R(k)&&(v=wt(v,`--brand-${k}`,C));const S=[];d!==E&&S.push({file:"brand.md",base:E,next:d,type:"text/markdown; charset=utf-8",url:I}),v!==b&&S.push({file:"tokens.css",base:b,next:v,type:"text/css; charset=utf-8",url:w}),h(!0);try{for(const k of S){const C=`${t.path}/${k.file}`,A=await Ht(o.slug,C,k);if(await n.invalidateQueries({queryKey:Ae.fileText(k.url)}),dt(n,o.id,N),A!=="saved"){L.error(e(A==="conflict"?"library.brandPreview.brandChanged":"library.brandPreview.failedSaveBrand"));return}}S.length>0&&L.success(e("library.brandPreview.brandSaved")),u(null)}catch(k){L.error(k instanceof Error?k.message:e("library.brandPreview.failedSaveBrand"))}finally{h(!1)}},Ee=async d=>{const x=d?.[0];if(!x)return;const b=`logo.${(x.name.split(".").pop()??"png").toLowerCase()}`;try{await a.mutateAsync({dir:t.path,files:[new File([x],b,{type:x.type})]}),P&&D(P)!==b&&await l.mutateAsync(P),L.success(e("library.brandPreview.logoUpdated"))}catch(v){L.error(v instanceof Error?v.message:e("library.brandPreview.logoUploadFailed"))}finally{c.current&&(c.current.value="")}},Y=(d,x,b,v)=>m?s.jsx(Gt,{label:x,Icon:b,value:Te(d),onChange:S=>Pe(d,S)},d):v!==void 0?s.jsx(Vt,{title:x,summary:v,Icon:b,onOpen:le},d):s.jsxs("div",{className:"flex h-14 items-center gap-3 border-b border-border/70 px-1",children:[s.jsx(b,{size:16,className:"shrink-0 text-muted-foreground"}),s.jsx("span",{className:"w-44 shrink-0 truncate text-sm text-muted-foreground",children:x}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:e("library.context.notWritten")}),s.jsx(O,{variant:"ghost",size:"sm",onClick:()=>i(e("library.context.fillSectionPrompt",{section:x,path:re})),children:e("library.context.fill")})]},d);function le(){ne&&u({sections:{},tokens:{},quote:null})}return s.jsxs(s.Fragment,{children:[s.jsx(_.Actions,{children:m?s.jsxs(s.Fragment,{children:[s.jsx(O,{variant:"ghost",size:"sm",disabled:p,onClick:()=>u(null),children:e("library.brandPreview.cancel")}),s.jsx(O,{size:"sm",disabled:p,onClick:()=>{Oe()},children:e("library.brandPreview.save")})]}):s.jsxs(s.Fragment,{children:[s.jsx(O,{variant:"secondary",size:"sm",onClick:()=>i(e("library.context.fillBrandPrompt",{path:re})),children:e("library.context.fillFromSite")}),s.jsx(O,{size:"sm",disabled:!ne,onClick:le,children:e("library.context.editBrand")})]})}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("input",{ref:c,type:"file",accept:"image/*",className:"hidden",onChange:d=>{Ee(d.target.files)}}),(P||m)&&s.jsxs("button",{type:"button",disabled:!m,onClick:()=>c.current?.click(),"aria-label":e(P?"library.brandPreview.replaceLogo":"library.brandPreview.addLogo"),className:"group relative flex size-10 shrink-0 items-center justify-center overflow-hidden rounded-xl bg-muted/60 text-muted-foreground enabled:cursor-pointer",children:[P?s.jsx("img",{src:r(N,P),alt:"",className:"size-full object-contain"}):s.jsx(ce,{size:16}),P&&m&&s.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-foreground/50 text-background opacity-0 transition-opacity group-hover:opacity-100",children:s.jsx(ce,{size:14})})]}),s.jsx("h1",{className:"min-w-0 text-2xl font-medium text-foreground",children:Ce})]}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1.45fr)_minmax(0,1fr)]",children:[s.jsxs("section",{className:"flex min-h-72 flex-col justify-between gap-8 rounded-2xl bg-foreground p-7 text-background",style:ae?{background:ae}:void 0,children:[s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx("span",{className:"text-xs opacity-70",children:e("library.context.toneOfVoice")}),m?s.jsx("textarea",{"aria-label":e("library.context.toneOfVoice"),value:f.quote??M??"",onChange:d=>u(x=>x&&{...x,quote:d.target.value}),className:"field-sizing-content min-h-24 w-full resize-none rounded-xl bg-background/10 p-3 text-2xl leading-snug font-medium text-background outline-none focus:bg-background/15"}):M?s.jsxs("p",{className:"text-2xl leading-snug font-medium text-pretty",children:["“",M,"”"]}):s.jsx("p",{className:"text-sm opacity-70",children:e("library.brandPreview.noVoiceYet")})]}),(H||J)&&s.jsxs("div",{className:"grid gap-6 sm:grid-cols-2",children:[H&&s.jsx(he,{label:e("library.context.soundsLike"),Icon:Ke,text:H}),J&&s.jsx(he,{label:e("library.context.doesNotSoundLike"),Icon:it,text:J})]})]}),s.jsxs("section",{className:"flex min-h-72 flex-col justify-between gap-8 rounded-2xl bg-muted/50 p-6",children:[s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:e("library.context.look")}),ie.length>0?s.jsx("div",{className:"grid grid-cols-4 gap-2",children:ie.slice(0,4).map(d=>s.jsx(qt,{label:e(Ft[d.id]),value:Q(d.id)??d.value,editable:m,onChange:x=>oe(d.id,x)},d.id))}):s.jsx("p",{className:"text-sm text-muted-foreground",children:e("library.context.noTokens")})]}),(K||B)&&s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("span",{className:"text-4xl text-foreground",style:K?{fontFamily:K}:void 0,children:"Aa"}),m?s.jsx("div",{className:"grid min-w-0 flex-1 gap-2",children:[["font-display",K,"library.context.fontTitles"],["font-body",B,"library.context.fontText"]].map(([d,x,b])=>x&&s.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{className:"w-12 shrink-0",children:e(b)}),s.jsx(Le,{value:X(x),onChange:v=>oe(d,Et(x,v.target.value))})]},d))}):s.jsxs("div",{className:"flex min-w-0 flex-col",children:[K&&s.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e("library.context.fontForTitles",{font:X(K)})}),B&&s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:e("library.context.fontForText",{font:X(B)})})]})]})]})]}),_e.map(d=>s.jsxs("section",{className:"flex flex-col",children:[s.jsx("h2",{className:"pb-1 text-xs text-muted-foreground",children:e(At[d.id])}),d.items.map(x=>{const{labelKey:b,Icon:v}=Mt[x.id];return x.sections.length===0?Y(e(b),e(b),v):x.sections.map(S=>Y(S.title,S.title,v,S.summary))})]},d.id)),se.length>0&&s.jsxs("section",{className:"flex flex-col",children:[s.jsx("h2",{className:"pb-1 text-xs text-muted-foreground",children:e("library.context.groupMore")}),se.map(d=>Y(d.title,d.title,ve,d.summary))]})]})}function qt(t){const e=T.c(22),{label:r,value:n,editable:i,onChange:o}=t;let a;e[0]!==n?(a=s.jsx("span",{className:"h-14 rounded-xl border border-border/60",style:{background:n}}),e[0]=n,e[1]=a):a=e[1];const l=a;let c;e[2]!==n?(c=Z(n)&&n.startsWith("#"),e[2]=n,e[3]=c):c=e[3];const f=c;let u;e[4]!==i||e[5]!==l||e[6]!==r||e[7]!==o||e[8]!==f||e[9]!==n?(u=i&&f?s.jsxs("label",{className:"relative flex cursor-pointer flex-col rounded-xl ring-2 ring-ring/30 transition-shadow hover:ring-ring/60",children:[l,s.jsx("input",{type:"color","aria-label":r,value:jt(n),onChange:g=>o(g.target.value),className:"absolute inset-0 size-full cursor-pointer opacity-0"})]}):l,e[4]=i,e[5]=l,e[6]=r,e[7]=o,e[8]=f,e[9]=n,e[10]=u):u=e[10];let p;e[11]!==r?(p=s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:r}),e[11]=r,e[12]=p):p=e[12];let h;e[13]!==i||e[14]!==r||e[15]!==o||e[16]!==n?(h=i&&s.jsx("input",{"aria-label":r,value:n,spellCheck:!1,onChange:g=>o(g.target.value),className:"-mt-1 w-full rounded-md bg-transparent font-mono text-xs text-foreground focus:bg-background focus-ring"}),e[13]=i,e[14]=r,e[15]=o,e[16]=n,e[17]=h):h=e[17];let m;return e[18]!==u||e[19]!==p||e[20]!==h?(m=s.jsxs("div",{className:"flex min-w-0 flex-col gap-1.5",children:[u,p,h]}),e[18]=u,e[19]=p,e[20]=h,e[21]=m):m=e[21],m}function Gt(t){const e=T.c(13),{label:r,Icon:n,value:i,onChange:o}=t;let a;e[0]!==n?(a=s.jsx(n,{size:16,className:"shrink-0 text-muted-foreground"}),e[0]=n,e[1]=a):a=e[1];let l;e[2]!==r||e[3]!==a?(l=s.jsxs("span",{className:"flex items-center gap-3 text-sm font-medium text-foreground",children:[a,r]}),e[2]=r,e[3]=a,e[4]=l):l=e[4];let c;e[5]!==o?(c=p=>o(p.target.value),e[5]=o,e[6]=c):c=e[6];let f;e[7]!==c||e[8]!==i?(f=s.jsx(ot,{value:i,onChange:c,className:"field-sizing-content min-h-20"}),e[7]=c,e[8]=i,e[9]=f):f=e[9];let u;return e[10]!==l||e[11]!==f?(u=s.jsxs("label",{className:"flex flex-col gap-2 border-b border-border/70 px-1 py-4",children:[l,f]}),e[10]=l,e[11]=f,e[12]=u):u=e[12],u}function Vt(t){const e=T.c(12),{title:r,summary:n,Icon:i,onOpen:o}=t;let a;e[0]!==i?(a=s.jsx(i,{size:16,className:"shrink-0 text-muted-foreground"}),e[0]=i,e[1]=a):a=e[1];let l;e[2]!==r?(l=s.jsx("span",{className:"w-44 shrink-0 truncate text-sm font-medium text-foreground",children:r}),e[2]=r,e[3]=l):l=e[3];let c;e[4]!==n?(c=s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-muted-foreground",children:n}),e[4]=n,e[5]=c):c=e[5];let f;e[6]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(Me,{size:16,className:"shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"}),e[6]=f):f=e[6];let u;return e[7]!==o||e[8]!==a||e[9]!==l||e[10]!==c?(u=s.jsxs("button",{type:"button",onClick:o,className:"group flex h-14 items-center gap-3 border-b border-border/70 px-1 text-left",children:[a,l,c,f]}),e[7]=o,e[8]=a,e[9]=l,e[10]=c,e[11]=u):u=e[11],u}function he(t){const e=T.c(10),{label:r,Icon:n,text:i}=t;let o;e[0]!==r?(o=s.jsx("span",{className:"text-xs opacity-70",children:r}),e[0]=r,e[1]=o):o=e[1];let a;e[2]!==n?(a=s.jsx("span",{className:"inline-flex h-[1lh] shrink-0 items-center",children:s.jsx(n,{size:14})}),e[2]=n,e[3]=a):a=e[3];let l;e[4]!==a||e[5]!==i?(l=s.jsxs("span",{className:"flex items-start gap-2 text-sm",children:[a,i]}),e[4]=a,e[5]=i,e[6]=l):l=e[6];let c;return e[7]!==o||e[8]!==l?(c=s.jsxs("div",{className:"flex flex-col gap-2",children:[o,l]}),e[7]=o,e[8]=l,e[9]=c):c=e[9],c}async function Ht(t,e,r){const n=await ut(t,N,e);if((n?await ft(t,N,e):"")!==r.base)return"conflict";const o=n?n.contentHash?{contentHash:n.contentHash}:null:{absent:!0},a=await mt(t,N,e,r.next,o,r.type);return a.ok?"saved":a.reason}const Jt=$.lazy(()=>G(()=>import("./connections-C0U7G-PU.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79]))),Qt=$.lazy(()=>G(()=>import("./skills-BjbKR2I7.js"),__vite__mapDeps([80,1,2,9,26,27,28,29,8,30,31,32,33,34,35,36,37,38,25,39,40,41,42,43,44,45,46,47,48,49,50,51,16,52,53,54,55,56,57,15,17,10,11,58,18,14,81,82,83,84,85,86,73,71,69,70,87,88,89,90,91,92,93,94,95,23,96,97,98,99,100,101,20,21,61,102,103,104,105,106,107,108,109,67,110,111,112,113,114,115,116,24,117,118,119,120,64,121,122,123,124,125,62,126,127,128]))),Yt=$.lazy(()=>G(()=>import("./memory-ls8FI-ER.js"),__vite__mapDeps([129,1,2,130,10,11,18,14,58,111,33,38,112,113,26,27,28,29,8,30,31,32,34,35,36,37,25,39,40,41,9,42,43,44,45,46,47,48,49,50,51,16,52,53,54,55,56,57,114,92,69,70,93,94,95,91,90,23,73,71,85,86,115,116,24,117,118,119,120,64,121,122,20,21,123,89,124,125,62,61,126,87,88,127,128,101]))),Xt=$.lazy(()=>G(()=>import("./repositories-Bf8CqdKD.js"),__vite__mapDeps([131,1,2,121,30,51,10,11,64,122,20,21,123,16,32,52,119,89,90,91,31,79,47,25,55,132,14,130,17,133,65,66,35,37,67,53,134,135])).then(t=>({default:t.RepositoriesContent})));function _n(t){return t===void 0||t==="instructions"||t==="general"||t==="views"||t==="site"||t==="repository"?"files":t}function In(t){return t==="instructions"||t==="connections"?t:"files"}function Zt(t){return t==="general"||t==="views"||t==="site"||t==="repository"?t:null}function Tn(t){return Zt(t)??"general"}const en=[{items:[{id:"files",labelKey:"library.context.allFiles",Icon:ke},{id:"brand",labelKey:"library.context.brand",Icon:Je},{id:"connections",labelKey:"settings.nav.connections",Icon:Qe},{id:"repositories",labelKey:"settings.nav.repositories",Icon:Be}]},{labelKey:"library.context.agents",items:[{id:"skills",labelKey:"settings.nav.skills",Icon:Ze},{id:"memory",labelKey:"settings.nav.memory",Icon:Xe}]}],tn=[{items:[{id:"files",labelKey:"library.context.allFiles",Icon:ke}]},{labelKey:"library.context.thisProject",items:[{id:"instructions",labelKey:"virtualMcp.virtualMcp.instructions",Icon:ve},{id:"connections",labelKey:U.connections.titleKey,Icon:U.connections.icon}]}],nn=[{items:["general","views","repository","site"].map(t=>({id:t,labelKey:U[t].titleKey,Icon:U[t].icon}))}];function sn(t){const e=t?.closest("nav");!t||!e||e.scrollWidth<=e.clientWidth||(e.scrollLeft=t.offsetLeft-(e.clientWidth-t.offsetWidth)/2)}const rn="flex shrink-0 items-center rounded-lg text-sm transition-colors",on=t=>t?"bg-accent font-medium text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground";function an(t){const e=T.c(9),{groups:r,section:n}=t,i=q();let o;if(e[0]!==r||e[1]!==n||e[2]!==i){let l;e[4]!==n||e[5]!==i?(l=c=>s.jsxs("div",{className:"flex shrink-0 gap-1 md:flex-col md:gap-0.5",children:[c.labelKey&&s.jsx("span",{className:"hidden px-2.5 pb-1 text-xs text-muted-foreground md:block",children:i(c.labelKey)}),c.items.map(f=>{const{id:u,labelKey:p,Icon:h}=f;return s.jsxs(Ue,{ref:u===n?sn:void 0,to:".",search:u==="files"||u==="general"?{section:void 0,path:void 0}:{section:u},activeOptions:{includeSearch:!0,explicitUndefined:!0},className:je(rn,"h-8 gap-2.5 px-2.5",on(u===n)),children:[s.jsx(h,{size:16,className:"shrink-0"}),i(p)]},u)})]},c.labelKey??"main"),e[4]=n,e[5]=i,e[6]=l):l=e[6],o=r.map(l),e[0]=r,e[1]=n,e[2]=i,e[3]=o}else o=e[3];let a;return e[7]!==o?(a=s.jsx("nav",{className:"flex shrink-0 gap-1 overflow-x-auto border-b border-border/60 px-3 py-2 md:w-[216px] md:flex-col md:gap-5 md:overflow-y-auto md:border-b-0 md:pt-4 md:pr-1",children:o}),e[7]=o,e[8]=a):a=e[8],a}function Pn(t){const e=T.c(21),{scope:r,section:n,children:i}=t,o=r===void 0?"org":r,a=q(),l=o==="org"?en:o==="project"?tn:nn;let c,f;if(e[0]!==l||e[1]!==n||e[2]!==a){const w=l.flatMap(ln).find(I=>I.id===n)?.labelKey;c="flex h-full min-h-0 flex-col md:flex-row",f=n!=="files"&&w&&s.jsx(_.Breadcrumbs,{after:"page",parent:{link:{to:".",search:{}}},items:[{key:"context-section",label:a(w)}]}),e[0]=l,e[1]=n,e[2]=a,e[3]=c,e[4]=f}else c=e[3],f=e[4];let u;e[5]!==l||e[6]!==n?(u=s.jsx(an,{groups:l,section:n}),e[5]=l,e[6]=n,e[7]=u):u=e[7];let p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=je(We,"py-0"),e[8]=p):p=e[8];let h;e[9]===Symbol.for("react.memo_cache_sentinel")?(h=s.jsx(z.Toolbar.Left,{children:s.jsx(z.Toolbar.Left.Target,{})}),e[9]=h):h=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=s.jsxs(z.Toolbar,{className:p,children:[h,s.jsx(z.Toolbar.Right,{className:"max-md:grow",children:s.jsx(z.Toolbar.Right.Target,{})})]}),e[10]=m):m=e[10];let g;e[11]!==i||e[12]!==n?(g=n==="files"?i:s.jsx(_.Breadcrumbs.Detached,{children:i}),e[11]=i,e[12]=n,e[13]=g):g=e[13];let y;e[14]!==g?(y=s.jsx(z.Toolbar.Scope,{children:s.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col md:pt-2.5 md:[&:not(:has([data-toolbar-content]:not(:empty)))]:pt-0",children:[m,s.jsx(_.Container.Inset,{value:!0,children:g})]})}),e[14]=g,e[15]=y):y=e[15];let j;return e[16]!==c||e[17]!==f||e[18]!==u||e[19]!==y?(j=s.jsxs("div",{className:c,children:[f,u,y]}),e[16]=c,e[17]=f,e[18]=u,e[19]=y,e[20]=j):j=e[20],j}function ln(t){return t.items}function W(){const t=T.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsx("div",{className:"flex h-64 items-center justify-center",children:s.jsx(ye,{className:"size-5 text-muted-foreground"})}),t[0]=e):e=t[0],e}function On(t){const e=T.c(6),{section:r}=t;switch(r){case"brand":{let n;return e[0]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(_,{children:s.jsx(_.Content,{children:s.jsx(_.Container,{children:s.jsx(Wt,{})})})}),e[0]=n):n=e[0],n}case"connections":{let n;return e[1]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx($.Suspense,{fallback:s.jsx(W,{}),children:s.jsx(Jt,{})}),e[1]=n):n=e[1],n}case"repositories":{let n;e[2]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx(W,{}),e[2]=n):n=e[2];let i;return e[3]===Symbol.for("react.memo_cache_sentinel")?(i=s.jsx(_,{children:s.jsx(_.Content,{children:s.jsx(_.Container,{children:s.jsx(et,{capability:"file-configs:manage",area:"files",children:s.jsx($.Suspense,{fallback:n,children:s.jsx(De,{children:s.jsx(Xt,{guided:!0})})})})})})}),e[3]=i):i=e[3],i}case"skills":{let n;return e[4]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx($.Suspense,{fallback:s.jsx(W,{}),children:s.jsx(Qt,{})}),e[4]=n):n=e[4],n}case"memory":{let n;return e[5]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx($.Suspense,{fallback:s.jsx(W,{}),children:s.jsx(Yt,{})}),e[5]=n):n=e[5],n}default:return r}}export{Pn as C,In as a,vt as b,St as c,On as d,jt as e,Nt as f,Cn as g,Zt as m,_n as o,Tn as p,wt as u};