@engenty/wizards-runtime 0.16.0 → 0.16.1
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/apps/runtime/dist/cli/move-files.js +27 -11
- package/apps/runtime/dist/documents/parse.js +9 -0
- package/apps/runtime/dist/services/work-files.js +25 -1
- package/apps/web/dist/assets/{AboutDialog-0q4P80yv.js → AboutDialog-C9SnsGno.js} +1 -1
- package/apps/web/dist/assets/{CapabilitiesPage-BlZP8DYb.js → CapabilitiesPage-DvSSybt0.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-CDN7kMs1.js → ChangelogDialog-B28TK333.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-CrMVsgUt.js → EditorPage-Duu8swX6.js} +1 -1
- package/apps/web/dist/assets/{NewWizardChannels-Czool7s1.js → NewWizardChannels-B12l2_Jh.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-CfVe_4a2.js → NewWizardPage-B10K8vND.js} +1 -1
- package/apps/web/dist/assets/{PreviewPane-CQDKQO6z.js → PreviewPane-DhhQ06Ic.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-BDZNnlQw.js → PublicRunner-B8ncIxIP.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-B7MUySpC.js → ReadOnly-DwewuYi8.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-Bgurv3l2.js → SettingsPage-C-gGIJLJ.js} +2 -2
- package/apps/web/dist/assets/{SetupPage-C3km8vqv.js → SetupPage-CdsrHW-w.js} +1 -1
- package/apps/web/dist/assets/{SharePage-UwEJBIzq.js → SharePage-CZClatA_.js} +1 -1
- package/apps/web/dist/assets/{SpacePage-D9PXLSU_.js → SpacePage-CYhxcjj0.js} +1 -1
- package/apps/web/dist/assets/{UpdateCheck-C7I43zFZ.js → UpdateCheck-CLPUsKVT.js} +2 -2
- package/apps/web/dist/assets/{changelog-DwgWiSZb.js → changelog-y5oxYzPd.js} +1 -1
- package/apps/web/dist/assets/{connection-sign-in-hI3HXhq4.js → connection-sign-in-DECedzrs.js} +1 -1
- package/apps/web/dist/assets/{host-D5hNHbhF.js → host-CJdLkzfY.js} +4 -4
- package/apps/web/dist/assets/{index-CyBrvupM.js → index-CmonJZHC.js} +3 -3
- package/apps/web/dist/assets/{theme-CdX0marK.js → theme-D6KUBJnh.js} +1 -1
- package/apps/web/dist/index.html +3 -3
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
|
@@ -17,14 +17,16 @@ export async function moveFiles() {
|
|
|
17
17
|
for (const tenant of await knownTenants()) {
|
|
18
18
|
const { moved, missing } = await withTenant(tenant, moveTenantFiles);
|
|
19
19
|
if (moved || missing.length) {
|
|
20
|
-
console.log(`${tenant}: ${moved} moved${missing.length ? `, ${missing.length}
|
|
20
|
+
console.log(`${tenant}: ${moved} moved${missing.length ? `, ${missing.length} not` : ""}`);
|
|
21
21
|
}
|
|
22
22
|
for (const file of missing) {
|
|
23
23
|
console.log(` ${file}`);
|
|
24
24
|
}
|
|
25
25
|
failed += missing.length;
|
|
26
26
|
}
|
|
27
|
-
console.log(failed
|
|
27
|
+
console.log(failed
|
|
28
|
+
? "Done; the files listed did not move: without their bytes, or with the reason given."
|
|
29
|
+
: "Done.");
|
|
28
30
|
return failed ? 1 : 0;
|
|
29
31
|
}
|
|
30
32
|
/**
|
|
@@ -37,11 +39,11 @@ export async function moveFilesAtStart() {
|
|
|
37
39
|
try {
|
|
38
40
|
const { moved, missing } = await withTenant(tenant, moveTenantFiles);
|
|
39
41
|
if (moved || missing.length) {
|
|
40
|
-
console.log(`[move-files] ${tenant}: ${moved} moved${missing.length ? `, ${missing.length}
|
|
42
|
+
console.log(`[move-files] ${tenant}: ${moved} moved${missing.length ? `, ${missing.length} not: ${missing.join("; ")}` : ""}`);
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
catch (err) {
|
|
44
|
-
console.error(`[move-files] ${tenant}:`, err
|
|
46
|
+
console.error(`[move-files] ${tenant}:`, causeOf(err));
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
}
|
|
@@ -56,13 +58,27 @@ async function moveTenantFiles() {
|
|
|
56
58
|
missing.push(`${row.name} (${row.id}, space ${row.spaceId})`);
|
|
57
59
|
continue;
|
|
58
60
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
// One file that fails doesn't keep the others where they are; it is tried again next time.
|
|
62
|
+
try {
|
|
63
|
+
const hash = await putBlob(bytes);
|
|
64
|
+
await db.update(schema.spaceFile).set({ hash }).where(eq(schema.spaceFile.id, row.id));
|
|
65
|
+
// The file reads from the blob now; its asset goes.
|
|
66
|
+
await db.delete(schema.asset).where(eq(schema.asset.id, asset.id));
|
|
67
|
+
await objects.remove(`assets/${asset.path}`);
|
|
68
|
+
await blobThumb(hash, row.mime);
|
|
69
|
+
moved++;
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
missing.push(`${row.name} (${row.id}, space ${row.spaceId}): ${causeOf(err)}`);
|
|
73
|
+
}
|
|
66
74
|
}
|
|
67
75
|
return { moved, missing };
|
|
68
76
|
}
|
|
77
|
+
/** What went wrong, down to the database's own words: a failed query wraps them as its cause. */
|
|
78
|
+
function causeOf(err) {
|
|
79
|
+
let e = err;
|
|
80
|
+
while (e?.cause) {
|
|
81
|
+
e = e.cause;
|
|
82
|
+
}
|
|
83
|
+
return String(e?.message ?? err).slice(0, 300);
|
|
84
|
+
}
|
|
@@ -187,6 +187,15 @@ export async function ownText(input) {
|
|
|
187
187
|
}
|
|
188
188
|
return read({ ...input, mime }, { vision: false });
|
|
189
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* A file's text, read on this computer and without a model: a PDF's own text, scanned pages and
|
|
192
|
+
* pictures by OCR, Word and old Word files, tables. What a Work chat hands a model beside the file
|
|
193
|
+
* (services/work-files.ts), so a model that can't read files gets what they say. Kept by content.
|
|
194
|
+
*/
|
|
195
|
+
export async function localText(input) {
|
|
196
|
+
const mime = documentMime(input.name, input.mime);
|
|
197
|
+
return kept(input.data, `${mime}:local`, () => read({ ...input, mime }, { vision: false }));
|
|
198
|
+
}
|
|
190
199
|
/** What was made of a file, kept by its content: the same bytes are never worked through twice. */
|
|
191
200
|
async function kept(data, variant, make) {
|
|
192
201
|
const file = join(CACHE_DIR, `${createHash("sha256").update(data).update(variant).digest("hex")}.json`);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { and, eq, inArray } from "drizzle-orm";
|
|
2
2
|
import { db, schema } from "../db/client.js";
|
|
3
|
+
import { localText } from "../documents/parse.js";
|
|
3
4
|
import { ServiceError } from "./errors.js";
|
|
4
5
|
import { spaceFileContent } from "./space-files.js";
|
|
5
6
|
/** At most this many files go with one message. */
|
|
@@ -14,6 +15,23 @@ const MODEL_READS = {
|
|
|
14
15
|
};
|
|
15
16
|
/** Where an upload goes among the space's files: pictures and media are assets, the rest documents. */
|
|
16
17
|
export const fileKind = (mime) => /^(image|audio|video)\//.test(mime) ? "asset" : "document";
|
|
18
|
+
/** How much of a file's text a message hands the model; the rest it reads in the space's files. */
|
|
19
|
+
const TEXT_CHARS = 20_000;
|
|
20
|
+
/** Begins the text of a file the model gets beside it; the chat doesn't show it. */
|
|
21
|
+
const TEXT_MARK = "(Text of ";
|
|
22
|
+
/** A file's text for the model, read on this computer (OCR for scans and pictures); none if empty. */
|
|
23
|
+
async function textOf(name, mime, data) {
|
|
24
|
+
const parsed = await localText({ data, name, mime }).catch((err) => {
|
|
25
|
+
console.error("[work-files]", name, err);
|
|
26
|
+
return null;
|
|
27
|
+
});
|
|
28
|
+
const text = parsed?.markdown.trim();
|
|
29
|
+
if (!text) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
const cut = text.length > TEXT_CHARS;
|
|
33
|
+
return `${TEXT_MARK}"${name}", read on this computer${parsed?.via === "ocr" ? " by OCR" : ""}${cut ? ", its start" : ""}:)\n${text.slice(0, TEXT_CHARS)}`;
|
|
34
|
+
}
|
|
17
35
|
/** The line the model gets for files it does not read itself; the chat doesn't show it. */
|
|
18
36
|
const elsewhere = (names) => `(Attached: ${names.join(", ")}. In the space's files; search_space finds what they say once they are read.)`;
|
|
19
37
|
/** The space's files a message names, in its order; one not in the chat's space is refused. */
|
|
@@ -55,6 +73,11 @@ who) {
|
|
|
55
73
|
filename: row.name,
|
|
56
74
|
});
|
|
57
75
|
}
|
|
76
|
+
// Its text as well: a model that takes no files, or a scan, still gets what it says.
|
|
77
|
+
const said = await textOf(row.name, row.mime, data);
|
|
78
|
+
if (said) {
|
|
79
|
+
parts.push({ type: "text", text: said });
|
|
80
|
+
}
|
|
58
81
|
kept.push({ ...file, read });
|
|
59
82
|
}
|
|
60
83
|
const told = kept.filter((f) => !f.read).map((f) => f.name);
|
|
@@ -73,7 +96,8 @@ export function viewParts(spaceId, parts, files) {
|
|
|
73
96
|
}
|
|
74
97
|
const line = elsewhere(files.filter((f) => !f.read).map((f) => f.name));
|
|
75
98
|
return [
|
|
76
|
-
...parts.filter((p) => p.type !== "file" &&
|
|
99
|
+
...parts.filter((p) => p.type !== "file" &&
|
|
100
|
+
!(p.type === "text" && (p.text === line || String(p.text).startsWith(TEXT_MARK)))),
|
|
77
101
|
...files.map((f) => ({
|
|
78
102
|
type: "file",
|
|
79
103
|
fileId: f.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Jn as r,fn as i,in as a,ln as o,mn as s,nn as c,rn as l,tn as u}from"./ui-BCfu5sia.js";import{t as d}from"./preload-helper-DpV6A1kQ.js";import{c as f,n as p}from"./marked.esm-DQ7XA7AC.js";import{t as m}from"./logo-BpnjXTRy.js";import{s as h}from"./i18n-BBzMbGoo.js";import{g,h as _,m as v,t as y,u as b}from"./UpdateCheck-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{Jn as r,fn as i,in as a,ln as o,mn as s,nn as c,rn as l,tn as u}from"./ui-BCfu5sia.js";import{t as d}from"./preload-helper-DpV6A1kQ.js";import{c as f,n as p}from"./marked.esm-DQ7XA7AC.js";import{t as m}from"./logo-BpnjXTRy.js";import{s as h}from"./i18n-BBzMbGoo.js";import{g,h as _,m as v,t as y,u as b}from"./UpdateCheck-CLPUsKVT.js";import{ReleaseNotes as x,loadReleases as S,releaseDate as C,releaseLabel as w}from"./ChangelogDialog-B28TK333.js";var T=e(t(),1),E=[{name:`engenty wizards`,description:`credit.engenty-wizards`,homepage:`https://github.com/engenty/wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:`credit.engenty`,homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],D=[{name:`Mastra`,description:`credit.mastra`,homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:`credit.ai-sdk`,homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:`credit.model-context-protocol`,homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:`credit.hono`,homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:`credit.drizzle-orm`,homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:`credit.libsql`,homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:`credit.playwright`,homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`React`,description:`credit.react`,homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:`credit.vite`,homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:`credit.tailwind-css`,homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:`credit.react-flow`,homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:`credit.tanstack-query`,homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:`credit.xterm-js`,homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:`credit.lucide`,homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:`credit.geist-geist-mono`,homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:`credit.space-grotesk`,homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:`credit.git-cliff`,homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],O=e(n(),1),k=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function A({name:e,homepage:t,version:n,license:r,description:i}){return(0,O.jsxs)(`li`,{className:`py-2.5`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,O.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.875rem] text-ink underline-offset-4 hover:underline`,children:[e,(0,O.jsx)(f,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,O.jsx)(`span`,{className:`font-medium text-[0.875rem] text-ink`,children:e}),n?(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:n}):null,(0,O.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:r})]}),i?(0,O.jsx)(`p`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:i}):null]})}function j({title:e,hint:t,children:n}){return(0,O.jsxs)(`section`,{className:`mt-6`,children:[(0,O.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:e}),t?(0,O.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3`,children:t}):null,n]})}function M({credits:e}){return(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,O.jsx)(A,{name:e.name,homepage:e.homepage,license:e.license,description:h(e.description)},e.name))})}function N({label:e,packages:t}){return(0,O.jsxs)(`div`,{className:`mt-4`,children:[(0,O.jsx)(`h4`,{className:`font-medium text-[0.75rem] text-ink-3 tracking-wide`,children:e}),(0,O.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,O.jsx)(A,{...e},e.name))})]})}function P({active:e}){let[t,n]=(0,T.useState)(null),[r,i]=(0,T.useState)(``);(0,T.useEffect)(()=>{if(!e||t)return;let r=!1;return d(()=>import(`./oss-credits-BrwV0a4F.js`).then(e=>{r||n(e.default)}),[]),()=>{r=!0}},[e,t]),(0,T.useEffect)(()=>{e||i(``)},[e]);let s=r.trim().toLowerCase(),l=e=>s?e.filter(e=>k(s,e.name,e.license,h(e.description))):e,u=e=>s?e.filter(e=>k(s,e.name,e.license,e.version)):e,f=l(E),p=l(D),m=t?[{id:`shared`,label:h(`about.creditsShared`),packages:u(t.shared)},...t.groups.map(e=>({id:e.id,label:e.label,packages:u(e.packages)}))].filter(e=>e.packages.length>0):[],g=f.length===0&&p.length===0&&m.length===0;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`p`,{className:`mb-4 text-[0.875rem] text-ink-3`,children:h(`about.creditsHint`)}),(0,O.jsx)(a,{type:`search`,value:r,placeholder:h(`about.search`),onChange:e=>i(e.target.value)}),f.length>0?(0,O.jsx)(j,{title:h(`about.creditsProduct`),children:(0,O.jsx)(M,{credits:f})}):null,p.length>0?(0,O.jsx)(j,{title:h(`about.creditsBuiltWith`),children:(0,O.jsx)(M,{credits:p})}):null,t===null?(0,O.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,O.jsx)(o,{})}):m.length>0?(0,O.jsx)(j,{title:h(`about.creditsDeps`),hint:s?void 0:h(`about.creditsDepsHint`),children:m.map(e=>(0,O.jsx)(N,{label:e.label,packages:e.packages},e.id))}):null,t!==null&&g?(0,O.jsx)(c,{children:h(`about.noMatches`)}):null]})}var F=[`new`,`earlier`,`credits`],I=e=>h(e===`new`?`about.tab.new`:e===`earlier`?`about.tab.earlier`:`about.credits`),L=e=>e===1?h(`about.change`):h(`about.changes`,{n:e});function R({me:e,active:t,initialTab:n=`new`}){let a=e?.mode===`local`,{data:c,latest:l}=_(a&&t),[u,d]=(0,T.useState)(null),[f,p]=(0,T.useState)(n);(0,T.useEffect)(()=>p(n),[n]);let E=v(F.indexOf(f)),D=c?.newer&&l?l:g;(0,T.useEffect)(()=>{if(!t)return;let e=!1;return d(null),S(D===`0.16.1`?void 0:D).then(t=>{e||d(t)}),()=>{e=!0}},[t,D]);let k=u?.find(e=>e.version===`v${D}`)??u?.[0]??null,A=u?.filter(e=>e!==k)??[],j=a?c?.kind??null:`cloud`;return(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`div`,{className:`flex flex-col items-center pt-4 text-center`,children:[(0,O.jsx)(m,{size:96}),(0,O.jsxs)(`div`,{className:`mt-4 font-display font-semibold text-[1.5rem] tracking-tight`,children:[`engenty`,(0,O.jsx)(`span`,{className:`text-ember`,children:`.`}),(0,O.jsx)(`span`,{className:`ml-1.5 font-normal text-ink-3`,children:`wizards`})]}),(0,O.jsxs)(`div`,{className:`mt-1 text-[0.9375rem] text-ink-3 tabular-nums`,children:[h(`about.version`,{v:g}),j?` · ${h(`about.kind.${j}`)}`:``]})]}),a?(0,O.jsx)(`div`,{className:`mt-5`,children:(0,O.jsx)(y,{enabled:t})}):null,(0,O.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,O.jsx)(i,{value:f,onChange:p,options:F.map(e=>({id:e,label:I(e)})),label:h(`about.title`)})}),(0,O.jsxs)(`div`,{className:s(`mt-5`,b(E)),children:[f===`new`?u===null?(0,O.jsx)(`div`,{className:`flex justify-center py-6 text-ink-3`,children:(0,O.jsx)(o,{})}):k?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[w(k),(0,O.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:C(k)})]}),(0,O.jsx)(`div`,{className:`mt-3`,children:(0,O.jsx)(x,{release:k})})]}):(0,O.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:h(`about.changelogEmpty`)}):null,f===`earlier`?(0,O.jsx)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:A.map(e=>(0,O.jsxs)(`details`,{className:`group/r py-2`,children:[(0,O.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-baseline gap-3 text-[0.875rem] [&::-webkit-details-marker]:hidden`,children:[(0,O.jsx)(r,{className:`size-3.5 shrink-0 self-center text-ink-4 transition group-open/r:rotate-90`}),(0,O.jsx)(`span`,{className:`font-medium text-ink tabular-nums`,children:w(e)}),(0,O.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:C(e)}),(0,O.jsx)(`span`,{className:`ml-auto text-[0.8125rem] text-ink-4`,children:L(e.commits.length)})]}),(0,O.jsx)(`div`,{className:`mt-2 pl-6`,children:(0,O.jsx)(x,{release:e})})]},e.version??`unreleased`))}):null,f===`credits`?(0,O.jsx)(P,{active:!0}):null]},f)]})}function z({open:e,onClose:t,me:n}){return(0,O.jsxs)(u,{open:e,onClose:t,wide:!0,height:`tall`,children:[(0,O.jsx)(`div`,{className:`-mt-2 -mr-2 sticky top-0 z-10 flex h-0 justify-end`,children:(0,O.jsx)(l,{label:h(`common.close`),onClick:t,children:(0,O.jsx)(p,{className:`size-4`})})}),(0,O.jsx)(R,{me:n,active:e})]})}export{z as AboutDialog,R as AboutPanel};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/SkillEditor-BaEiqqXl.js","assets/rolldown-runtime-hePW80VL.js","assets/jsx-runtime-BNakU3Ej.js","assets/ui-BCfu5sia.js","assets/preload-helper-DpV6A1kQ.js","assets/marked.esm-DQ7XA7AC.js","assets/i18n-BBzMbGoo.js","assets/useMutation-1fV4Nnxq.js","assets/Skills-Bv6XbKxc.js","assets/circle-check-DDLzlcXP.js","assets/upload-CAlHC232.js","assets/code-xml-S4IFi5Jc.js","assets/scroll-text-BEnPzQEi.js","assets/eye-TJSuiHHO.js","assets/code-editor-Ca5EAxmd.js","assets/dist-CQpLJoQZ.js","assets/w3c-keyname-BOAvb0qz.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,Br as i,Jn as a,Q as o,Qt as s,S as c,Sn as l,X as u,Xn as d,an as f,ar as p,cn as m,cr as h,en as g,fn as _,fr as v,g as y,hr as b,in as x,ln as S,mn as C,mr as w,nn as T,pr as E,sr as D,tn as O,wn as k}from"./ui-BCfu5sia.js";import{t as A}from"./useMutation-1fV4Nnxq.js";import{t as j}from"./preload-helper-DpV6A1kQ.js";import{d as ee,i as M,u as N}from"./marked.esm-DQ7XA7AC.js";import{In as P,Qn as te,_n as ne,a as re,fn as F,l as ie,m as ae,p as I,pn as oe,t as se,vn as ce}from"./host-D5hNHbhF.js";import{a as le,f as ue,o as de,r as fe,s as L}from"./Skills-Bv6XbKxc.js";import{n as R}from"./volume-2-BqlBtCIJ.js";import{i as pe,n as z,o as me,r as he,s as ge,t as B}from"./connection-sign-in-hI3HXhq4.js";import{t as V}from"./scroll-text-BEnPzQEi.js";import{b as _e,d as H,n as ve,u as U}from"./session-CMQo8P-G.js";import{n as W,s as G}from"./i18n-BBzMbGoo.js";import{a as ye,c as be,d as xe,f as Se,i as Ce,m as we,p as Te,r as Ee,u as K}from"./UpdateCheck-C7I43zFZ.js";var De={name:`compass`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]};De.node;var Oe=ee(De),q=e(t(),1),ke=[`admins`,`members`,`all`],Ae=[`read`,`write`,`destructive`,`send`],je=[`allow`,`ask`,`deny`],Me={name:80,perSpace:200},J=e(n(),1),Y=e=>[`space-connections`,e];function X(e){return b({enabled:!!e,queryKey:Y(e),queryFn:()=>o.get(`/api/studio/spaces/${e}/connections`)})}function Ne(e){return b({enabled:!!e,queryKey:u.connectors(e),queryFn:()=>o.get(`/api/studio/spaces/${e}/connectors`)})}function Pe(e,t,n){let r=new Set(t.map(e=>e.connectorId));return e.filter(e=>e.sourceKind===`builtin`&&!r.has(e.id)&&(e.usable||n))}var Z={admins:`connection.audience.admins`,members:`connection.audience.members`,all:`connection.audience.all`},Fe={admins:`connection.audience.adminsHint`,members:`connection.audience.membersHint`,all:`connection.audience.allHint`},Ie={read:`connection.kind.read`,write:`connection.kind.write`,destructive:`connection.kind.destructive`,send:`connection.kind.send`},Le={read:`connection.kind.readHint`,write:`connection.kind.writeHint`,destructive:`connection.kind.destructiveHint`,send:`connection.kind.sendHint`},Re={allow:`connection.outcome.allow`,ask:`connection.outcome.ask`,deny:`connection.outcome.deny`},ze={space:`connection.signIn.space`,person:`connection.signIn.person`},Be={space:`connection.signIn.spaceHint`,person:`connection.signIn.personHint`},Ve=e=>new Intl.DateTimeFormat(W,{dateStyle:`medium`}).format(new Date(e));function He(e){let t=Math.round((Date.parse(e)-Date.now())/1e3),n=new Intl.RelativeTimeFormat(W,{numeric:`auto`});for(let[e,r]of[[`day`,86400],[`hour`,3600],[`minute`,60]])if(Math.abs(t)>=r)return n.format(Math.round(t/r),e);return n.format(0,`minute`)}function Q(e){let t=e.connector?.name??e.connectorId;return e.name===t?e.name:`${t} · ${e.name}`}function Ue(e){return e.signIn===`space`?e.account?G(`connection.asSpaceAccount`,{label:e.account.label}):G(`connection.asSpaceNotYet`):G(`connection.eachPersonCount`,{n:e.signedIn})}function We(e){return e.lastUsedAt?G(`connection.lastUsed`,{when:He(e.lastUsedAt)}):G(`connection.neverUsed`)}function Ge(e){let t=e.toLowerCase().replace(/^https?:\/\//,``).split(`/`)[0].split(`.`);return t.length>1?t[t.length-2]:t[0]}function Ke(e,t){if(!e)return null;let n=t.find(t=>t.id===e);if(n)return{connectorId:n.id};let r=t.find(t=>t.domain&&t.domain===e.toLowerCase());if(r)return{connectorId:r.id};let i=Ge(e),a=t.find(e=>e.sourceKind===`builtin`&&(e.id===i||e.id.endsWith(`-${i}`)||e.name.toLowerCase()===i));return a?{connectorId:a.id}:e.includes(`.`)?{domain:e}:null}function qe({name:e,large:t}){return(0,J.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex shrink-0 items-center justify-center rounded-lg bg-paper-2 font-semibold text-ink-2`,t?`size-12 text-[0.9375rem]`:`size-9 text-[0.75rem]`),children:ve(e)||`?`})}function Je(){let[e,t]=D(),{space:n}=U(),r=H(),{narrow:a}=Te(),o=i(),s=n?.id??``,c=e.get(`show`),l=e.get(`setup`),u=r&&!n?.readOnly,d=X(s),f=Ne(s),p=d.data?.connections??[],m=p.find(e=>e.id===c)??null;xe(m?Q(m):null),he((0,q.useCallback)(()=>{o.invalidateQueries({queryKey:[`space-connections`]}),o.invalidateQueries({queryKey:[`person-sign-ins`]})},[o])),(0,q.useEffect)(()=>{a||I().scrollTo({top:0})},[a,c]);let h=e=>a?t({show:e}):t(e===`all`?{}:{show:e},{replace:!0});return(0,J.jsx)(J.Fragment,{children:n?(0,J.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:m?(0,J.jsx)(Qe,{connection:m,connector:f.data?.find(e=>e.id===m.connectorId),writable:u,onGone:()=>h(`all`)},m.id):(0,J.jsx)(Ye,{spaceId:n.id,connections:p,loading:d.isPending,error:d.error,connectors:f.data??[],writable:u,setup:l,onOpen:h,onSetUp:e=>{t({setup:e},{replace:!a}),a||I().scrollTo({top:0,behavior:`smooth`})},onSetUpDone:()=>t({},{replace:!0})})}):null})}function Ye({spaceId:e,connections:t,loading:n,error:i,connectors:a,writable:o,setup:l,onOpen:u,onSetUp:d,onSetUpDone:f}){let p=F(`unsetConnectors`),m=(0,q.useRef)(null),h=l&&a.length?Ke(l,a):null,g=h&&`domain`in h?h.domain:null;(0,q.useEffect)(()=>{g&&m.current?.scrollIntoView({block:`start`,behavior:`smooth`})},[g]);let _=Pe(a,t,p);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{title:G(`capabilities.connectors`),hint:G(`capabilities.connectors.hint`),plain:!0,action:o&&l===null?(0,J.jsxs)(s,{size:`sm`,onClick:()=>d(``),children:[(0,J.jsx)(M,{className:`size-4`}),` `,G(`capabilities.connectors.add`)]}):null,children:[o&&l!==null?(0,J.jsx)(Ze,{spaceId:e,connectors:a,initial:h&&`connectorId`in h?h.connectorId:``,onCancel:f,onDone:u},h&&`connectorId`in h?h.connectorId:`new`):null,(0,J.jsx)(`h3`,{className:`px-1 pt-2 font-display font-semibold text-base`,children:G(`capabilities.inSpace`)}),i?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:i.message}):t.length?(0,J.jsx)(r,{className:`flex flex-col divide-y divide-border-soft p-0`,children:t.map(e=>(0,J.jsx)(Xe,{connection:e,onOpen:()=>u(e.id)},e.id))}):n?null:(0,J.jsx)(r,{children:(0,J.jsx)(T,{children:G(o?`capabilities.connectors.noneAdmin`:`capabilities.connectors.none`)})})]}),_.length?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,J.jsx)(`h3`,{className:`font-semibold text-[0.875rem]`,children:G(`capabilities.connectors.builtin`)}),(0,J.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:G(o?`capabilities.connectors.builtinHint`:`capabilities.connectors.builtinHintMember`)}),(0,J.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,J.jsx)(`li`,{children:o&&e.usable?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>d(e.id),title:G(`capabilities.connectors.setUpNamed`,{name:e.name}),className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,J.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),e.name]}):(0,J.jsx)(`span`,{title:e.missingSetup??void 0,className:C(`inline-flex h-8 items-center rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-3`,!e.usable&&`opacity-60`),children:e.name})},e.id))})]}):null,(0,J.jsx)(`div`,{ref:m,className:`scroll-mt-6`,children:(0,J.jsx)(c,{title:G(`capabilities.connectors.more`),hint:G(`capabilities.connectors.moreHint`),children:(0,J.jsx)(ge,{spaceId:e,readOnly:!o,embedded:!0,onSetUp:o?d:void 0,domain:g})})})]})}function Xe({connection:e,onOpen:t}){let n=i(),r=pe(`/api/studio/connections/${encodeURIComponent(e.id)}/my-sign-in`,()=>n.invalidateQueries({queryKey:Y(e.spaceId)})),a=Object.values(e.rules).includes(`ask`),o=e.signIn===`person`;return(0,J.jsxs)(`div`,{className:`px-3.5 py-3 sm:px-5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:t,className:`-my-1 -ml-1 flex min-w-0 flex-1 items-center gap-3 rounded-lg p-1 text-left transition hover:bg-paper-2`,children:[(0,J.jsx)(qe,{name:e.connector?.name??e.connectorId}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-[0.9375rem]`,children:Q(e)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[0.8125rem] text-ink-3`,children:[o?(0,J.jsx)(ne,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}):(0,J.jsx)(te,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`truncate`,children:[Ue(e),` · `,We(e)]})]})]}),(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 max-sm:hidden`,children:[a?(0,J.jsx)(g,{tone:`warn`,children:G(`connection.outcome.ask`)}):null,(0,J.jsx)(g,{children:G(Z[e.audience])})]})]}),o?(0,J.jsx)(B,{s:r,auth:e.connector?.auth,signedIn:!!e.mySignIn}):null]}),o?(0,J.jsx)(z,{s:r,fields:e.connector?.fields??[],signedIn:!!e.mySignIn,confirmText:G(`konto.connectionSignOutConfirm`,{name:Q(e)}),className:`ml-12`}):null]})}function Ze({spaceId:e,connectors:t,initial:n,onCancel:a,onDone:c}){let l=i(),u=t.filter(e=>e.usable),[d,p]=(0,q.useState)(u.some(e=>e.id===n)?n:``),h=u.find(e=>e.id===d),[g,v]=(0,q.useState)(h?.name??``),[y,b]=(0,q.useState)(h?.auth===`oauth2`?`person`:`space`),[S,C]=(0,q.useState)(`members`),w=A({mutationFn:()=>o.post(`/api/studio/spaces/${e}/connections`,{connectorId:d,name:g.trim()||h?.name,signIn:y,audience:S}),onSuccess:async t=>{await l.invalidateQueries({queryKey:Y(e)}),await l.invalidateQueries({queryKey:[`person-sign-ins`]}),c(t.id)}});return(0,J.jsx)(r,{className:`p-3.5 sm:p-5`,children:(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d&&w.mutate()},className:`flex flex-col gap-5`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`font-display font-semibold text-base`,children:G(`capabilities.connectors.add`)}),(0,J.jsx)(`p`,{className:`mt-1 text-[0.8125rem] text-ink-3`,children:G(`connection.setupHint`)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(f,{children:G(`connection.connector`)}),(0,J.jsx)(m,{value:d,onChange:e=>{let t=u.find(t=>t.id===e);(!g.trim()||g===h?.name)&&v(t?.name??``),p(e)},placeholder:G(`connection.connectorPick`),options:u.map(e=>({value:e.id,label:e.name}))})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(f,{hint:G(`connection.nameHint`),children:G(`connection.name`)}),(0,J.jsx)(x,{value:g,maxLength:Me.name,placeholder:G(`connection.namePlaceholder`),onChange:e=>v(e.target.value)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(f,{hint:G(Be[y]),children:G(`connection.signIn`)}),(0,J.jsx)(_,{label:G(`connection.signIn`),value:y,onChange:b,options:[`space`,`person`].map(e=>({id:e,label:G(ze[e])}))}),(0,J.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:G(`connection.signInFixed`)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(f,{hint:G(Fe[S]),children:G(`connection.audience`)}),(0,J.jsx)(_,{label:G(`connection.audience`),value:S,onChange:C,options:ke.map(e=>({id:e,label:G(Z[e])}))})]}),w.error?(0,J.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:w.error.message}):null,(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(s,{type:`submit`,busy:w.isPending,disabled:!d,children:G(`capabilities.connectors.setUp`)}),(0,J.jsx)(s,{type:`button`,variant:`ghost`,onClick:a,children:G(`orgSettings.cancel`)})]})]})})}function Qe({connection:e,connector:t,writable:n,onGone:a}){let c=i(),l=Y(e.spaceId),u=()=>c.invalidateQueries({queryKey:l}),[d,f]=(0,q.useState)(e.name),[p,m]=(0,q.useState)(!1),h=`/api/studio/connections/${encodeURIComponent(e.id)}`,v=A({mutationFn:e=>o.patch(h,e),onSuccess:e=>{c.setQueryData(l,t=>t&&{connections:t.connections.map(t=>t.id===e.id?e:t)}),c.invalidateQueries({queryKey:[`person-sign-ins`]})}}),y=A({mutationFn:()=>o.del(h),onSuccess:async()=>{await u(),c.invalidateQueries({queryKey:[`person-sign-ins`]}),a()}}),b=pe(`${h}/sign-in`,u),S=pe(`${h}/my-sign-in`,u),C=()=>{let t=d.trim();t&&t!==e.name?v.mutate({name:t}):f(e.name)},w=e.connector?.name??e.connectorId,T=e.connector?.fields??[],E=e.setUpByName?G(`konto.connectionSetUpBy`,{name:e.setUpByName,when:Ve(e.setUpAt)}):G(`konto.connectionSetUpAt`,{when:Ve(e.setUpAt)}),D=n=>(t?.actions??[]).filter(e=>e.group===n).filter(t=>!e.actions.length||e.actions.includes(t.id));return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-4 px-1`,children:[(0,J.jsx)(qe,{name:w,large:!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:w}),e.connector?.description?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[0.875rem] text-ink-3`,children:e.connector.description}):null]})]}),(0,J.jsxs)(r,{className:`flex flex-col gap-5 p-3.5 sm:p-5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[n?(0,J.jsx)(x,{"aria-label":G(`connection.name`),className:`max-w-sm font-semibold`,value:d,maxLength:Me.name,onChange:e=>f(e.target.value),onBlur:C,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),C())}}):(0,J.jsx)(`b`,{className:`text-[0.9375rem]`,children:e.name}),(0,J.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:n?E:G(`connection.adminsManage`)})]}),(0,J.jsx)($,{label:G(`connection.signIn`),children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[0.875rem]`,children:[e.signIn===`space`?(0,J.jsx)(te,{className:`size-4 text-ink-3`,"aria-hidden":`true`}):(0,J.jsx)(ne,{className:`size-4 text-ink-3`,"aria-hidden":`true`}),G(ze[e.signIn])]}),(0,J.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:G(Be[e.signIn])})]})}),e.signIn===`space`?(0,J.jsx)($,{label:G(`connection.account`),children:(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`text-[0.875rem]`,children:e.account?G(`connection.accountSignedIn`,{label:e.account.label}):G(n?`connection.accountNotYetAdmin`:`connection.accountNotYet`)}),n?(0,J.jsx)(B,{s:b,auth:e.connector?.auth,signedIn:!!e.account}):null]}),n?(0,J.jsx)(z,{s:b,fields:T,signedIn:!!e.account,confirmText:G(`connection.signOutSpaceConfirm`,{name:Q(e)})}):null]})}):(0,J.jsx)($,{label:G(`connection.people`),children:(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`span`,{className:`text-[0.875rem]`,children:[G(`connection.peopleSignedIn`,{n:e.signedIn}),` · `,e.mySignIn?G(`connection.youSignedIn`,{label:e.mySignIn.label}):G(`connection.youNotYet`)]}),(0,J.jsx)(B,{s:S,auth:e.connector?.auth,signedIn:!!e.mySignIn})]}),(0,J.jsx)(z,{s:S,fields:T,signedIn:!!e.mySignIn,confirmText:G(`konto.connectionSignOutConfirm`,{name:Q(e)})})]})}),(0,J.jsx)($,{label:G(`connection.audience`),children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[n?(0,J.jsx)(`div`,{children:(0,J.jsx)(_,{label:G(`connection.audience`),value:e.audience,onChange:e=>v.mutate({audience:e}),options:ke.map(e=>({id:e,label:G(Z[e])}))})}):(0,J.jsx)(`span`,{children:(0,J.jsx)(g,{children:G(Z[e.audience])})}),(0,J.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:G(Fe[e.audience])})]})}),(0,J.jsx)(`div`,{className:`border-border-soft border-t`}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsx)(`h3`,{className:`font-semibold text-[0.875rem]`,children:G(`connection.rules`)}),Ae.map(t=>{let r=D(t);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-[0.875rem]`,children:G(Ie[t])}),(0,J.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:G(Le[t])}),r.length?(0,J.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[0.6875rem] text-ink-4`,children:r.map(e=>e.id).join(` · `)}):null]}),(0,J.jsx)(`div`,{className:`shrink-0`,children:n?(0,J.jsx)(_,{label:G(Ie[t]),value:e.rules[t],onChange:n=>v.mutate({rules:{...e.rules,[t]:n}}),options:je.map(e=>({id:e,label:G(Re[e])}))}):(0,J.jsx)(g,{tone:e.rules[t]===`ask`?`warn`:`neutral`,children:G(Re[e.rules[t]])})})]},t)}),(0,J.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:G(n?`connection.askHint`:`connection.askHintMember`)})]}),v.error?(0,J.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:v.error.message}):null]}),(0,J.jsx)(r,{className:`flex flex-col gap-1 p-3.5 sm:p-5`,children:(0,J.jsx)($,{label:G(`connection.use`),children:(0,J.jsx)(`span`,{className:`text-[0.875rem]`,children:We(e)})})}),n?(0,J.jsxs)(`div`,{className:`px-1`,children:[p?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-lg bg-paper p-3 text-[0.875rem] ring-1 ring-border-soft`,children:[(0,J.jsx)(`p`,{className:`min-w-48 flex-1`,children:G(`connection.removeConfirm`,{name:Q(e)})}),(0,J.jsx)(s,{variant:`ghost`,onClick:()=>m(!1),children:G(`orgSettings.cancel`)}),(0,J.jsx)(s,{variant:`danger`,busy:y.isPending,onClick:()=>y.mutate(),children:G(`connection.remove`)})]}):(0,J.jsx)(s,{variant:`danger`,size:`sm`,onClick:()=>m(!0),children:G(`connection.remove`)}),y.error?(0,J.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:y.error.message}):null]}):null]})}function $({label:e,children:t}){return(0,J.jsxs)(`div`,{className:`grid gap-1.5 sm:grid-cols-[11rem_minmax(0,1fr)] sm:gap-4`,children:[(0,J.jsx)(`span`,{className:`pt-0.5 text-[0.8125rem] text-ink-3`,children:e}),t]})}var $e=[`discover.example1`,`discover.example2`,`discover.example3`],et=(e,t)=>t===void 0?[`discover`,e]:[`discover`,e,t];function tt(){let[e,t]=D(),n=e.get(`q`)??``,[r,i]=(0,q.useState)(n);return(0,q.useEffect)(()=>i(e=>e.trim()===n.trim()?e:n),[n]),(0,q.useEffect)(()=>{let e=r.trim();if(e===n.trim())return;let i=setTimeout(()=>t(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n},{replace:!0}),350);return()=>clearTimeout(i)},[r,n,t]),[r,i,n.trim()]}function nt({asked:e,onExample:t}){let{space:n}=U(),r=H(),a=F(`skills`),c=i(),[l,d]=(0,q.useState)(null),f=n?.id??``,p=b({queryKey:et(f,e),queryFn:()=>o.get(`/api/studio/spaces/${f}/discover?q=${encodeURIComponent(e)}`),enabled:!!f&&e.length>=2,staleTime:6e4}),m=e=>{c.setQueriesData({queryKey:et(f)},t=>t&&{...t,skills:t.skills.map(t=>t.ref===e?{...t,added:!0}:t)}),c.invalidateQueries({queryKey:u.skills(f)})},h=A({mutationFn:e=>o.post(`/api/studio/spaces/${f}/skills/registry`,{ref:e,mode:`demand`}),onSuccess:(e,t)=>m(t)}),g=p.data,_=g&&!g.skills.length&&!g.connectors.length&&!g.errors.skills&&!g.errors.connectors;return n?(0,J.jsxs)(J.Fragment,{children:[e.length<2?(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 px-1 text-[0.875rem] text-ink-3`,children:[(0,J.jsx)(`p`,{children:G(`discover.start`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:$e.map(e=>(0,J.jsxs)(s,{variant:`secondary`,size:`sm`,onClick:()=>t(G(e)),children:[(0,J.jsx)(k,{className:`size-3.5`}),` `,G(e)]},e))})]}):p.error?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:p.error.message}):g?_?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-ink-3`,children:G(`discover.none`,{q:e})}):(0,J.jsxs)(J.Fragment,{children:[a?(0,J.jsx)(rt,{title:G(`space.skills`),count:g.skills.length,error:g.errors.skills,empty:G(`discover.groupNone`,{directory:`skills.sh`}),children:g.skills.map(e=>(0,J.jsx)(ot,{hit:e,adding:h.isPending&&h.variables===e.ref,failed:h.isError&&h.variables===e.ref?h.error:null,onLook:()=>d(e.ref),onAdd:()=>h.mutate(e.ref)},e.ref))}):null,(0,J.jsx)(rt,{title:G(`capabilities.connectors`),count:g.connectors.length,error:g.errors.connectors,empty:G(`discover.groupNone`,{directory:`integrations.sh`}),children:g.connectors.map(e=>(0,J.jsx)(st,{hit:e,admin:r},e.domain))})]}):(0,J.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,J.jsx)(S,{className:`size-5`})}),(0,J.jsx)(O,{open:l!==null,onClose:()=>d(null),wide:!0,height:`tall`,title:G(`skills.registryTitle`),children:l?(0,J.jsx)(fe,{spaceId:f,skillRef:l,onAdded:()=>{m(l),d(null)}},l):null})]}):null}function rt({title:e,count:t,error:n,empty:i,children:a}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-baseline gap-2 px-1`,children:[(0,J.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),t?(0,J.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:t}):null]}),n?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:n}):t?(0,J.jsx)(r,{className:`divide-y divide-border-soft`,children:a}):(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-ink-3`,children:i})]})}function it({icon:e,name:t,mono:n,chip:r,line:i,source:a,error:o,children:s}){return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 px-3 py-3 sm:flex-nowrap`,children:[(0,J.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-paper-2 text-ink-3`,children:(0,J.jsx)(e,{className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 max-sm:basis-[calc(100%-3.25rem)]`,children:[(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:n?`font-medium font-mono text-[0.8125rem]`:`font-medium`,children:t}),r]}),i?(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-[0.8125rem] text-ink-2`,children:i}):null,(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-[0.75rem] text-ink-3`,children:a}),o?(0,J.jsx)(`span`,{className:`mt-1 block text-[0.8125rem] text-rose`,children:o}):null]}),(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-2 max-sm:ml-[3.25rem]`,children:s})]})}function at(){return(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.8125rem] text-moss`,children:[(0,J.jsx)(N,{className:`size-4`}),` `,G(`capabilities.inSpace`)]})}function ot({hit:e,adding:t,failed:n,onLook:r,onAdd:i}){return(0,J.jsxs)(it,{icon:V,name:e.name,mono:!0,chip:e.official?(0,J.jsx)(g,{tone:`live`,icon:(0,J.jsx)(ue,{className:`size-3`}),children:G(`skills.official`)}):(0,J.jsx)(g,{tone:`warn`,children:G(`skills.unchecked`)}),error:n?.message,source:[`skills.sh`,e.source,G(`skills.installs`,{n:e.installs.toLocaleString(W)})].join(` · `),children:[(0,J.jsx)(s,{variant:`ghost`,size:`sm`,onClick:r,children:G(`skills.open`)}),e.added?(0,J.jsx)(at,{}):(0,J.jsx)(s,{variant:`secondary`,size:`sm`,busy:t,onClick:i,children:G(`skills.add`)})]})}function st({hit:e,admin:t}){let n=E(),r=e.kinds.map(e=>e===`mcp`?`MCP`:`OpenAPI`);return(0,J.jsx)(it,{icon:R,name:e.name,line:e.description||void 0,source:[`integrations.sh`,e.domain,...r].join(` · `),children:e.setUp?(0,J.jsx)(at,{}):t?(0,J.jsx)(s,{variant:`secondary`,size:`sm`,onClick:()=>n(`/capabilities/connectors?setup=${encodeURIComponent(e.domain)}`),children:G(`discover.setUp`)}):null})}var ct={skills:4,connections:5};function lt(){let{space:e}=U(),t=H(),n=E(),i=F(`skills`),a=F(`unsetConnectors`),[o,s]=D(),l=o.get(`tab`)===`discover`?`discover`:`space`,[u,d,f]=tt(),m=e?.id??``,h=L(i?e?.id:void 0),g=X(m),v=Ne(m);if(!e)return null;let y=t&&!e.readOnly,b=u.trim().toLowerCase(),x=h.data?.skills??[],S=g.data?.connections??[],C=x.filter(e=>e.mode!==`off`).sort((e,t)=>e.mode===t.mode?0:e.mode===`always`?-1:1),w=b?x.filter(e=>e.name.includes(b)||e.description.toLowerCase().includes(b)):C,O=b?S.filter(e=>`${e.name} ${e.connector?.name??e.connectorId}`.toLowerCase().includes(b)):S,A=Pe(v.data??[],S,a),j=e=>s(t=>{let n=new URLSearchParams(t);return e===`discover`?n.set(`tab`,`discover`):n.delete(`tab`),n},{replace:!0});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[(0,J.jsx)(c,{title:G(`nav.capabilities`),hint:G(`capabilities.overview.hint`),plain:!0,action:(0,J.jsx)(ft,{entries:[...i&&!h.data?.readOnly?[{icon:V,label:G(`capabilities.overview.addSkill`),hint:G(`capabilities.overview.addSkillHint`),to:`/capabilities/skills`}]:[],...y?[{icon:R,label:G(`capabilities.overview.addConnection`),hint:G(`capabilities.overview.addConnectionHint`),to:`/capabilities/connectors?setup=`}]:[],{icon:Oe,label:G(`capabilities.discover`),hint:G(`capabilities.overview.discoverHint`),to:`/capabilities/overview?tab=discover`}]}),children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(_,{value:l,onChange:j,options:[{id:`space`,label:G(`capabilities.inSpace`)},{id:`discover`,label:G(`capabilities.discover`)}],label:G(`nav.capabilities`)}),(0,J.jsxs)(`form`,{className:`flex h-10 min-w-0 flex-1 basis-60 items-center gap-2 rounded-full border border-input bg-card px-4 focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow`,onSubmit:e=>{e.preventDefault(),l===`space`&&b&&!w.length&&!O.length&&j(`discover`)},children:[(0,J.jsx)(k,{className:`size-4 shrink-0 text-ink-3`}),(0,J.jsx)(`input`,{type:`search`,value:u,"aria-label":G(l===`discover`?`discover.searchLabel`:`capabilities.overview.search`),placeholder:G(l===`discover`?`discover.search`:`capabilities.overview.search`),onChange:e=>d(e.target.value),className:`min-w-0 flex-1 bg-transparent text-[0.875rem] text-ink outline-none placeholder:text-ink-4`})]})]})}),(0,J.jsx)(`div`,{className:`flex animate-rise flex-col gap-9`,children:l===`discover`?(0,J.jsx)(nt,{asked:f,onExample:d}):(0,J.jsxs)(J.Fragment,{children:[i?(0,J.jsx)(ut,{icon:V,title:G(`space.skills`),all:x.length,to:`/capabilities/skills`,children:h.error?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:h.error.message}):w.length?(0,J.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2`,children:w.slice(0,ct.skills).map(e=>(0,J.jsx)(dt,{skill:e,onOpen:()=>n(`/capabilities/skills?show=k:${e.id}`)},e.id))}):h.isPending?null:(0,J.jsx)(r,{children:(0,J.jsx)(T,{children:b?G(`capabilities.overview.nothing`,{q:u.trim()}):G(`capabilities.overview.noSkills`)})})}):null,(0,J.jsxs)(ut,{icon:R,title:G(`capabilities.connectors`),all:S.length,to:`/capabilities/connectors`,children:[g.error?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:g.error.message}):O.length?(0,J.jsx)(r,{className:`flex flex-col divide-y divide-border-soft p-0`,children:O.slice(0,ct.connections).map(e=>(0,J.jsx)(Xe,{connection:e,onOpen:()=>n(`/capabilities/connectors?show=${encodeURIComponent(e.id)}`)},e.id))}):g.isPending?null:(0,J.jsx)(r,{children:(0,J.jsx)(T,{children:b?G(`capabilities.overview.nothing`,{q:u.trim()}):G(`capabilities.overview.noConnections`)})}),A.length&&!b?(0,J.jsxs)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:[G(`capabilities.connectors.builtin`),`:`,` `,A.map((e,t)=>(0,J.jsxs)(`span`,{children:[t?` · `:null,y&&e.usable?(0,J.jsx)(p,{to:`/capabilities/connectors?setup=${encodeURIComponent(e.id)}`,className:`text-ink-2 hover:text-ink hover:underline`,children:e.name}):(0,J.jsx)(`span`,{className:`text-ink-2`,children:e.name})]},e.id))]}):null]})]})},l)]})}function ut({icon:e,title:t,all:n,to:r,children:i}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,J.jsxs)(`h3`,{className:`flex items-center gap-2 font-semibold text-[0.9375rem]`,children:[(0,J.jsx)(e,{className:`size-4 text-ember-strong`,"aria-hidden":`true`}),t]}),(0,J.jsxs)(p,{to:r,className:`inline-flex items-center gap-0.5 text-[0.8125rem] text-ink-3 transition hover:text-ink`,children:[G(`capabilities.overview.all`,{n}),(0,J.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})]})]}),i]})}function dt({skill:e,onOpen:t}){return(0,J.jsxs)(`button`,{type:`button`,onClick:t,className:`flex min-w-0 flex-col gap-1.5 rounded-xl bg-card px-4 py-3 text-left shadow-soft ring-1 ring-border-soft transition hover:ring-border`,children:[(0,J.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:C(`truncate font-medium font-mono text-[0.8125rem]`,e.mode===`off`&&`text-ink-3`),children:e.name}),(0,J.jsx)(g,{tone:e.mode===`always`?`live`:`neutral`,children:G(`skills.mode.${e.mode}`)})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-[0.8125rem] text-ink-2`,children:e.description}),(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[0.75rem] text-ink-3`,children:[(0,J.jsx)(de,{skill:e}),e.runScripts?G(`capabilities.overview.scripts`):null]})]})}function ft({entries:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>e.key===`Escape`&&n(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),(0,J.jsxs)(`div`,{className:`relative`,ref:r,children:[(0,J.jsxs)(s,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,J.jsx)(M,{className:`size-4`}),` `,G(`skills.add`),(0,J.jsx)(d,{className:`-mr-1 size-4`})]}),t?(0,J.jsx)(`div`,{role:`menu`,className:`absolute top-10 right-0 z-50 w-72 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,J.jsxs)(p,{to:e.to,role:`menuitem`,onClick:()=>n(!1),className:`flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left transition hover:bg-accent`,children:[(0,J.jsx)(e.icon,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:e.label}),(0,J.jsx)(`span`,{className:`block text-[0.8125rem] text-ink-3`,children:e.hint})]})]},e.to))}):null]})}var pt=(0,q.lazy)(()=>j(()=>import(`./SkillEditor-BaEiqqXl.js`).then(e=>({default:e.SkillEditor})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function mt(){let[e,t]=D(),{space:n}=U(),r=re(),{narrow:i}=Te(),a=e.get(`show`),o=a?.startsWith(`k:`)?a:null,s=L(n?.id),l=ie(`skills`,r).filter(e=>e.plugin);xe(s.data?.skills.find(e=>`k:${e.id}`===o)?.name??null),(0,q.useEffect)(()=>{i||I().scrollTo({top:0})},[i,o]);let u=e=>i?t({show:e}):t(e===`all`?{}:{show:e},{replace:!0});return(0,J.jsx)(J.Fragment,{children:n?(0,J.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:o?(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(pt,{skillId:o.slice(2),onGone:()=>u(`all`),onOpen:u,filesFirst:!0},o)}):s.data?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(le,{spaceId:n.id,data:s.data,onOpen:u,heading:G(`capabilities.inSpace`)}),l.flatMap(e=>e.sections).map(e=>r.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,J.jsx)(y,{id:e.id,children:(0,J.jsx)(c,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,J.jsx)(se,{of:e,children:(0,J.jsx)(e.component,{})})})},e.serial))]}):s.error?(0,J.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:s.error.message}):null}):null})}var ht=[{id:`overview`,label:`capabilities.overview`,icon:P,element:lt,menu:!1},{id:`skills`,label:`space.skills`,icon:V,element:mt,feature:`skills`,menu:!1},{id:`connectors`,label:`capabilities.connectors`,icon:R,element:Je,menu:!1},{id:`protocol`,label:`capabilities.protocol`,icon:l,element:me,admins:!0,menu:!1}];function gt(e,t=!0){return ht.filter(n=>n.element&&(!n.feature||e(n.feature))&&(t||!n.admins))}function _t(){let[e,t]=(0,q.useState)(null);return(0,q.useEffect)(()=>{let e=I(),n=()=>t(e.clientHeight);n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[]),e}function vt(){let e=F(`capabilities`),t=oe(),{section:n}=w(),[r]=D(),i=E(),a=v(),{space:o,loading:s}=U(),c=Se(),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),g=gt(e=>_e(t,e),H()),_=g.find(e=>e.id===n),y=L(g.some(e=>e.id===`skills`)?o?.id:void 0),b=X(o?.id??``),x={skills:y.data?.skills.length,connectors:b.data?.connections.length},S=g.map(e=>({id:e.id,label:G(e.label),icon:e.icon,to:e.menu===!1&&c?`/capabilities/${e.id}?show=page`:`/capabilities/${e.id}`,count:x[e.id]})),O=S.find(e=>e.id===_?.id),k=r.get(`show`)||r.has(`setup`)?2:1,A=_&&_.menu!==!1&&p!==_.id?1:0,j=we(A),ee=we(k),M=(0,q.useMemo)(()=>({slot:l,narrow:c,setDetail:f}),[l,c]),N=_t();if(ae([{label:G(`nav.capabilities`),to:`/capabilities`},...O?[{label:O.label,to:O.to}]:[],...O&&d?[{label:d}]:[]]),!e)return(0,J.jsx)(h,{to:`/`,replace:!0});if(n===`discover`){let e=new URLSearchParams(a.search);return e.set(`tab`,`discover`),(0,J.jsx)(h,{to:{pathname:`/capabilities/overview`,search:`?${e}`},replace:!0})}if(!_&&g[0])return(0,J.jsx)(h,{to:{pathname:`/capabilities/${g[0].id}`,search:a.search},replace:!0});let P=_?.element;return(0,J.jsx)(be.Provider,{value:M,children:(0,J.jsx)(`div`,{className:`animate-rise`,children:(0,J.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[10.5rem_minmax(0,1fr)] md:gap-5 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,J.jsxs)(`aside`,{className:C(`menu-scroll min-w-0 md:sticky md:top-6 md:self-start md:overflow-y-auto md:overscroll-contain`,c&&k===2&&`hidden`,c&&ee===`back`&&K(`back`)),style:!c&&N?{maxHeight:N-48,paddingBottom:`var(--assistant-dock, 0px)`}:void 0,children:[(0,J.jsx)(Ce,{title:G(`nav.capabilities`),open:A===1?O??null:null,onBack:g.length>1?()=>m(_?.id??null):void 0,root:{icon:ce,label:G(`nav.capabilities`),onOpen:()=>i(c?`/capabilities/overview?show=page`:`/capabilities/overview`),current:_?.id===`overview`}}),(0,J.jsx)(`div`,{className:C(K(j)),children:A===0?(0,J.jsx)(ye,{entries:S.filter(e=>e.id!==`overview`),current:O,onPick:e=>{m(null),_?.menu===!1&&i(e.to)}}):(0,J.jsx)(`div`,{ref:u})},A)]}),(0,J.jsxs)(`div`,{className:C(`min-w-0`,c&&k<2&&`hidden`,c&&ee===`deeper`&&K(`deeper`)),children:[c&&O?(0,J.jsx)(`div`,{className:`mb-3`,children:(0,J.jsx)(Ee,{label:O.label,onBack:()=>i(O.to)})}):null,P?(0,J.jsx)(P,{}):null,o||s?null:(0,J.jsx)(T,{children:G(`settings.noSpace`)})]})]})})})}export{vt as CapabilitiesPage};
|
|
2
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{$t as r,Br as i,Jn as a,Q as o,Qt as s,S as c,Sn as l,X as u,Xn as d,an as f,ar as p,cn as m,cr as h,en as g,fn as _,fr as v,g as y,hr as b,in as x,ln as S,mn as C,mr as w,nn as T,pr as E,sr as D,tn as O,wn as k}from"./ui-BCfu5sia.js";import{t as A}from"./useMutation-1fV4Nnxq.js";import{t as j}from"./preload-helper-DpV6A1kQ.js";import{d as ee,i as M,u as N}from"./marked.esm-DQ7XA7AC.js";import{In as P,Qn as te,_n as ne,a as re,fn as F,l as ie,m as ae,p as I,pn as oe,t as se,vn as ce}from"./host-CJdLkzfY.js";import{a as le,f as ue,o as de,r as fe,s as L}from"./Skills-Bv6XbKxc.js";import{n as R}from"./volume-2-BqlBtCIJ.js";import{i as pe,n as z,o as me,r as he,s as ge,t as B}from"./connection-sign-in-DECedzrs.js";import{t as V}from"./scroll-text-BEnPzQEi.js";import{b as _e,d as H,n as ve,u as U}from"./session-CMQo8P-G.js";import{n as W,s as G}from"./i18n-BBzMbGoo.js";import{a as ye,c as be,d as xe,f as Se,i as Ce,m as we,p as Te,r as Ee,u as K}from"./UpdateCheck-CLPUsKVT.js";var De={name:`compass`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]};De.node;var Oe=ee(De),q=e(t(),1),ke=[`admins`,`members`,`all`],Ae=[`read`,`write`,`destructive`,`send`],je=[`allow`,`ask`,`deny`],Me={name:80,perSpace:200},J=e(n(),1),Y=e=>[`space-connections`,e];function X(e){return b({enabled:!!e,queryKey:Y(e),queryFn:()=>o.get(`/api/studio/spaces/${e}/connections`)})}function Ne(e){return b({enabled:!!e,queryKey:u.connectors(e),queryFn:()=>o.get(`/api/studio/spaces/${e}/connectors`)})}function Pe(e,t,n){let r=new Set(t.map(e=>e.connectorId));return e.filter(e=>e.sourceKind===`builtin`&&!r.has(e.id)&&(e.usable||n))}var Z={admins:`connection.audience.admins`,members:`connection.audience.members`,all:`connection.audience.all`},Fe={admins:`connection.audience.adminsHint`,members:`connection.audience.membersHint`,all:`connection.audience.allHint`},Ie={read:`connection.kind.read`,write:`connection.kind.write`,destructive:`connection.kind.destructive`,send:`connection.kind.send`},Le={read:`connection.kind.readHint`,write:`connection.kind.writeHint`,destructive:`connection.kind.destructiveHint`,send:`connection.kind.sendHint`},Re={allow:`connection.outcome.allow`,ask:`connection.outcome.ask`,deny:`connection.outcome.deny`},ze={space:`connection.signIn.space`,person:`connection.signIn.person`},Be={space:`connection.signIn.spaceHint`,person:`connection.signIn.personHint`},Ve=e=>new Intl.DateTimeFormat(W,{dateStyle:`medium`}).format(new Date(e));function He(e){let t=Math.round((Date.parse(e)-Date.now())/1e3),n=new Intl.RelativeTimeFormat(W,{numeric:`auto`});for(let[e,r]of[[`day`,86400],[`hour`,3600],[`minute`,60]])if(Math.abs(t)>=r)return n.format(Math.round(t/r),e);return n.format(0,`minute`)}function Q(e){let t=e.connector?.name??e.connectorId;return e.name===t?e.name:`${t} · ${e.name}`}function Ue(e){return e.signIn===`space`?e.account?G(`connection.asSpaceAccount`,{label:e.account.label}):G(`connection.asSpaceNotYet`):G(`connection.eachPersonCount`,{n:e.signedIn})}function We(e){return e.lastUsedAt?G(`connection.lastUsed`,{when:He(e.lastUsedAt)}):G(`connection.neverUsed`)}function Ge(e){let t=e.toLowerCase().replace(/^https?:\/\//,``).split(`/`)[0].split(`.`);return t.length>1?t[t.length-2]:t[0]}function Ke(e,t){if(!e)return null;let n=t.find(t=>t.id===e);if(n)return{connectorId:n.id};let r=t.find(t=>t.domain&&t.domain===e.toLowerCase());if(r)return{connectorId:r.id};let i=Ge(e),a=t.find(e=>e.sourceKind===`builtin`&&(e.id===i||e.id.endsWith(`-${i}`)||e.name.toLowerCase()===i));return a?{connectorId:a.id}:e.includes(`.`)?{domain:e}:null}function qe({name:e,large:t}){return(0,J.jsx)(`span`,{"aria-hidden":`true`,className:C(`flex shrink-0 items-center justify-center rounded-lg bg-paper-2 font-semibold text-ink-2`,t?`size-12 text-[0.9375rem]`:`size-9 text-[0.75rem]`),children:ve(e)||`?`})}function Je(){let[e,t]=D(),{space:n}=U(),r=H(),{narrow:a}=Te(),o=i(),s=n?.id??``,c=e.get(`show`),l=e.get(`setup`),u=r&&!n?.readOnly,d=X(s),f=Ne(s),p=d.data?.connections??[],m=p.find(e=>e.id===c)??null;xe(m?Q(m):null),he((0,q.useCallback)(()=>{o.invalidateQueries({queryKey:[`space-connections`]}),o.invalidateQueries({queryKey:[`person-sign-ins`]})},[o])),(0,q.useEffect)(()=>{a||I().scrollTo({top:0})},[a,c]);let h=e=>a?t({show:e}):t(e===`all`?{}:{show:e},{replace:!0});return(0,J.jsx)(J.Fragment,{children:n?(0,J.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:m?(0,J.jsx)(Qe,{connection:m,connector:f.data?.find(e=>e.id===m.connectorId),writable:u,onGone:()=>h(`all`)},m.id):(0,J.jsx)(Ye,{spaceId:n.id,connections:p,loading:d.isPending,error:d.error,connectors:f.data??[],writable:u,setup:l,onOpen:h,onSetUp:e=>{t({setup:e},{replace:!a}),a||I().scrollTo({top:0,behavior:`smooth`})},onSetUpDone:()=>t({},{replace:!0})})}):null})}function Ye({spaceId:e,connections:t,loading:n,error:i,connectors:a,writable:o,setup:l,onOpen:u,onSetUp:d,onSetUpDone:f}){let p=F(`unsetConnectors`),m=(0,q.useRef)(null),h=l&&a.length?Ke(l,a):null,g=h&&`domain`in h?h.domain:null;(0,q.useEffect)(()=>{g&&m.current?.scrollIntoView({block:`start`,behavior:`smooth`})},[g]);let _=Pe(a,t,p);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(c,{title:G(`capabilities.connectors`),hint:G(`capabilities.connectors.hint`),plain:!0,action:o&&l===null?(0,J.jsxs)(s,{size:`sm`,onClick:()=>d(``),children:[(0,J.jsx)(M,{className:`size-4`}),` `,G(`capabilities.connectors.add`)]}):null,children:[o&&l!==null?(0,J.jsx)(Ze,{spaceId:e,connectors:a,initial:h&&`connectorId`in h?h.connectorId:``,onCancel:f,onDone:u},h&&`connectorId`in h?h.connectorId:`new`):null,(0,J.jsx)(`h3`,{className:`px-1 pt-2 font-display font-semibold text-base`,children:G(`capabilities.inSpace`)}),i?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:i.message}):t.length?(0,J.jsx)(r,{className:`flex flex-col divide-y divide-border-soft p-0`,children:t.map(e=>(0,J.jsx)(Xe,{connection:e,onOpen:()=>u(e.id)},e.id))}):n?null:(0,J.jsx)(r,{children:(0,J.jsx)(T,{children:G(o?`capabilities.connectors.noneAdmin`:`capabilities.connectors.none`)})})]}),_.length?(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[(0,J.jsx)(`h3`,{className:`font-semibold text-[0.875rem]`,children:G(`capabilities.connectors.builtin`)}),(0,J.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:G(o?`capabilities.connectors.builtinHint`:`capabilities.connectors.builtinHintMember`)}),(0,J.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,J.jsx)(`li`,{children:o&&e.usable?(0,J.jsxs)(`button`,{type:`button`,onClick:()=>d(e.id),title:G(`capabilities.connectors.setUpNamed`,{name:e.name}),className:`inline-flex h-8 items-center gap-1.5 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,J.jsx)(M,{className:`size-3.5`,"aria-hidden":`true`}),e.name]}):(0,J.jsx)(`span`,{title:e.missingSetup??void 0,className:C(`inline-flex h-8 items-center rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-3`,!e.usable&&`opacity-60`),children:e.name})},e.id))})]}):null,(0,J.jsx)(`div`,{ref:m,className:`scroll-mt-6`,children:(0,J.jsx)(c,{title:G(`capabilities.connectors.more`),hint:G(`capabilities.connectors.moreHint`),children:(0,J.jsx)(ge,{spaceId:e,readOnly:!o,embedded:!0,onSetUp:o?d:void 0,domain:g})})})]})}function Xe({connection:e,onOpen:t}){let n=i(),r=pe(`/api/studio/connections/${encodeURIComponent(e.id)}/my-sign-in`,()=>n.invalidateQueries({queryKey:Y(e.spaceId)})),a=Object.values(e.rules).includes(`ask`),o=e.signIn===`person`;return(0,J.jsxs)(`div`,{className:`px-3.5 py-3 sm:px-5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,J.jsxs)(`button`,{type:`button`,onClick:t,className:`-my-1 -ml-1 flex min-w-0 flex-1 items-center gap-3 rounded-lg p-1 text-left transition hover:bg-paper-2`,children:[(0,J.jsx)(qe,{name:e.connector?.name??e.connectorId}),(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(`div`,{className:`truncate text-[0.9375rem]`,children:Q(e)}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[0.8125rem] text-ink-3`,children:[o?(0,J.jsx)(ne,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}):(0,J.jsx)(te,{className:`size-3.5 shrink-0`,"aria-hidden":`true`}),(0,J.jsxs)(`span`,{className:`truncate`,children:[Ue(e),` · `,We(e)]})]})]}),(0,J.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1.5 max-sm:hidden`,children:[a?(0,J.jsx)(g,{tone:`warn`,children:G(`connection.outcome.ask`)}):null,(0,J.jsx)(g,{children:G(Z[e.audience])})]})]}),o?(0,J.jsx)(B,{s:r,auth:e.connector?.auth,signedIn:!!e.mySignIn}):null]}),o?(0,J.jsx)(z,{s:r,fields:e.connector?.fields??[],signedIn:!!e.mySignIn,confirmText:G(`konto.connectionSignOutConfirm`,{name:Q(e)}),className:`ml-12`}):null]})}function Ze({spaceId:e,connectors:t,initial:n,onCancel:a,onDone:c}){let l=i(),u=t.filter(e=>e.usable),[d,p]=(0,q.useState)(u.some(e=>e.id===n)?n:``),h=u.find(e=>e.id===d),[g,v]=(0,q.useState)(h?.name??``),[y,b]=(0,q.useState)(h?.auth===`oauth2`?`person`:`space`),[S,C]=(0,q.useState)(`members`),w=A({mutationFn:()=>o.post(`/api/studio/spaces/${e}/connections`,{connectorId:d,name:g.trim()||h?.name,signIn:y,audience:S}),onSuccess:async t=>{await l.invalidateQueries({queryKey:Y(e)}),await l.invalidateQueries({queryKey:[`person-sign-ins`]}),c(t.id)}});return(0,J.jsx)(r,{className:`p-3.5 sm:p-5`,children:(0,J.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),d&&w.mutate()},className:`flex flex-col gap-5`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`h3`,{className:`font-display font-semibold text-base`,children:G(`capabilities.connectors.add`)}),(0,J.jsx)(`p`,{className:`mt-1 text-[0.8125rem] text-ink-3`,children:G(`connection.setupHint`)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(f,{children:G(`connection.connector`)}),(0,J.jsx)(m,{value:d,onChange:e=>{let t=u.find(t=>t.id===e);(!g.trim()||g===h?.name)&&v(t?.name??``),p(e)},placeholder:G(`connection.connectorPick`),options:u.map(e=>({value:e.id,label:e.name}))})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(f,{hint:G(`connection.nameHint`),children:G(`connection.name`)}),(0,J.jsx)(x,{value:g,maxLength:Me.name,placeholder:G(`connection.namePlaceholder`),onChange:e=>v(e.target.value)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(f,{hint:G(Be[y]),children:G(`connection.signIn`)}),(0,J.jsx)(_,{label:G(`connection.signIn`),value:y,onChange:b,options:[`space`,`person`].map(e=>({id:e,label:G(ze[e])}))}),(0,J.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:G(`connection.signInFixed`)})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(f,{hint:G(Fe[S]),children:G(`connection.audience`)}),(0,J.jsx)(_,{label:G(`connection.audience`),value:S,onChange:C,options:ke.map(e=>({id:e,label:G(Z[e])}))})]}),w.error?(0,J.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:w.error.message}):null,(0,J.jsxs)(`div`,{className:`flex gap-2`,children:[(0,J.jsx)(s,{type:`submit`,busy:w.isPending,disabled:!d,children:G(`capabilities.connectors.setUp`)}),(0,J.jsx)(s,{type:`button`,variant:`ghost`,onClick:a,children:G(`orgSettings.cancel`)})]})]})})}function Qe({connection:e,connector:t,writable:n,onGone:a}){let c=i(),l=Y(e.spaceId),u=()=>c.invalidateQueries({queryKey:l}),[d,f]=(0,q.useState)(e.name),[p,m]=(0,q.useState)(!1),h=`/api/studio/connections/${encodeURIComponent(e.id)}`,v=A({mutationFn:e=>o.patch(h,e),onSuccess:e=>{c.setQueryData(l,t=>t&&{connections:t.connections.map(t=>t.id===e.id?e:t)}),c.invalidateQueries({queryKey:[`person-sign-ins`]})}}),y=A({mutationFn:()=>o.del(h),onSuccess:async()=>{await u(),c.invalidateQueries({queryKey:[`person-sign-ins`]}),a()}}),b=pe(`${h}/sign-in`,u),S=pe(`${h}/my-sign-in`,u),C=()=>{let t=d.trim();t&&t!==e.name?v.mutate({name:t}):f(e.name)},w=e.connector?.name??e.connectorId,T=e.connector?.fields??[],E=e.setUpByName?G(`konto.connectionSetUpBy`,{name:e.setUpByName,when:Ve(e.setUpAt)}):G(`konto.connectionSetUpAt`,{when:Ve(e.setUpAt)}),D=n=>(t?.actions??[]).filter(e=>e.group===n).filter(t=>!e.actions.length||e.actions.includes(t.id));return(0,J.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-4 px-1`,children:[(0,J.jsx)(qe,{name:w,large:!0}),(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:w}),e.connector?.description?(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[0.875rem] text-ink-3`,children:e.connector.description}):null]})]}),(0,J.jsxs)(r,{className:`flex flex-col gap-5 p-3.5 sm:p-5`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1`,children:[n?(0,J.jsx)(x,{"aria-label":G(`connection.name`),className:`max-w-sm font-semibold`,value:d,maxLength:Me.name,onChange:e=>f(e.target.value),onBlur:C,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),C())}}):(0,J.jsx)(`b`,{className:`text-[0.9375rem]`,children:e.name}),(0,J.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:n?E:G(`connection.adminsManage`)})]}),(0,J.jsx)($,{label:G(`connection.signIn`),children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[0.875rem]`,children:[e.signIn===`space`?(0,J.jsx)(te,{className:`size-4 text-ink-3`,"aria-hidden":`true`}):(0,J.jsx)(ne,{className:`size-4 text-ink-3`,"aria-hidden":`true`}),G(ze[e.signIn])]}),(0,J.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:G(Be[e.signIn])})]})}),e.signIn===`space`?(0,J.jsx)($,{label:G(`connection.account`),children:(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsx)(`span`,{className:`text-[0.875rem]`,children:e.account?G(`connection.accountSignedIn`,{label:e.account.label}):G(n?`connection.accountNotYetAdmin`:`connection.accountNotYet`)}),n?(0,J.jsx)(B,{s:b,auth:e.connector?.auth,signedIn:!!e.account}):null]}),n?(0,J.jsx)(z,{s:b,fields:T,signedIn:!!e.account,confirmText:G(`connection.signOutSpaceConfirm`,{name:Q(e)})}):null]})}):(0,J.jsx)($,{label:G(`connection.people`),children:(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,J.jsxs)(`span`,{className:`text-[0.875rem]`,children:[G(`connection.peopleSignedIn`,{n:e.signedIn}),` · `,e.mySignIn?G(`connection.youSignedIn`,{label:e.mySignIn.label}):G(`connection.youNotYet`)]}),(0,J.jsx)(B,{s:S,auth:e.connector?.auth,signedIn:!!e.mySignIn})]}),(0,J.jsx)(z,{s:S,fields:T,signedIn:!!e.mySignIn,confirmText:G(`konto.connectionSignOutConfirm`,{name:Q(e)})})]})}),(0,J.jsx)($,{label:G(`connection.audience`),children:(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[n?(0,J.jsx)(`div`,{children:(0,J.jsx)(_,{label:G(`connection.audience`),value:e.audience,onChange:e=>v.mutate({audience:e}),options:ke.map(e=>({id:e,label:G(Z[e])}))})}):(0,J.jsx)(`span`,{children:(0,J.jsx)(g,{children:G(Z[e.audience])})}),(0,J.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:G(Fe[e.audience])})]})}),(0,J.jsx)(`div`,{className:`border-border-soft border-t`}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,J.jsx)(`h3`,{className:`font-semibold text-[0.875rem]`,children:G(`connection.rules`)}),Ae.map(t=>{let r=D(t);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`div`,{className:`font-medium text-[0.875rem]`,children:G(Ie[t])}),(0,J.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:G(Le[t])}),r.length?(0,J.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[0.6875rem] text-ink-4`,children:r.map(e=>e.id).join(` · `)}):null]}),(0,J.jsx)(`div`,{className:`shrink-0`,children:n?(0,J.jsx)(_,{label:G(Ie[t]),value:e.rules[t],onChange:n=>v.mutate({rules:{...e.rules,[t]:n}}),options:je.map(e=>({id:e,label:G(Re[e])}))}):(0,J.jsx)(g,{tone:e.rules[t]===`ask`?`warn`:`neutral`,children:G(Re[e.rules[t]])})})]},t)}),(0,J.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:G(n?`connection.askHint`:`connection.askHintMember`)})]}),v.error?(0,J.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:v.error.message}):null]}),(0,J.jsx)(r,{className:`flex flex-col gap-1 p-3.5 sm:p-5`,children:(0,J.jsx)($,{label:G(`connection.use`),children:(0,J.jsx)(`span`,{className:`text-[0.875rem]`,children:We(e)})})}),n?(0,J.jsxs)(`div`,{className:`px-1`,children:[p?(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-lg bg-paper p-3 text-[0.875rem] ring-1 ring-border-soft`,children:[(0,J.jsx)(`p`,{className:`min-w-48 flex-1`,children:G(`connection.removeConfirm`,{name:Q(e)})}),(0,J.jsx)(s,{variant:`ghost`,onClick:()=>m(!1),children:G(`orgSettings.cancel`)}),(0,J.jsx)(s,{variant:`danger`,busy:y.isPending,onClick:()=>y.mutate(),children:G(`connection.remove`)})]}):(0,J.jsx)(s,{variant:`danger`,size:`sm`,onClick:()=>m(!0),children:G(`connection.remove`)}),y.error?(0,J.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:y.error.message}):null]}):null]})}function $({label:e,children:t}){return(0,J.jsxs)(`div`,{className:`grid gap-1.5 sm:grid-cols-[11rem_minmax(0,1fr)] sm:gap-4`,children:[(0,J.jsx)(`span`,{className:`pt-0.5 text-[0.8125rem] text-ink-3`,children:e}),t]})}var $e=[`discover.example1`,`discover.example2`,`discover.example3`],et=(e,t)=>t===void 0?[`discover`,e]:[`discover`,e,t];function tt(){let[e,t]=D(),n=e.get(`q`)??``,[r,i]=(0,q.useState)(n);return(0,q.useEffect)(()=>i(e=>e.trim()===n.trim()?e:n),[n]),(0,q.useEffect)(()=>{let e=r.trim();if(e===n.trim())return;let i=setTimeout(()=>t(t=>{let n=new URLSearchParams(t);return e?n.set(`q`,e):n.delete(`q`),n},{replace:!0}),350);return()=>clearTimeout(i)},[r,n,t]),[r,i,n.trim()]}function nt({asked:e,onExample:t}){let{space:n}=U(),r=H(),a=F(`skills`),c=i(),[l,d]=(0,q.useState)(null),f=n?.id??``,p=b({queryKey:et(f,e),queryFn:()=>o.get(`/api/studio/spaces/${f}/discover?q=${encodeURIComponent(e)}`),enabled:!!f&&e.length>=2,staleTime:6e4}),m=e=>{c.setQueriesData({queryKey:et(f)},t=>t&&{...t,skills:t.skills.map(t=>t.ref===e?{...t,added:!0}:t)}),c.invalidateQueries({queryKey:u.skills(f)})},h=A({mutationFn:e=>o.post(`/api/studio/spaces/${f}/skills/registry`,{ref:e,mode:`demand`}),onSuccess:(e,t)=>m(t)}),g=p.data,_=g&&!g.skills.length&&!g.connectors.length&&!g.errors.skills&&!g.errors.connectors;return n?(0,J.jsxs)(J.Fragment,{children:[e.length<2?(0,J.jsxs)(`div`,{className:`flex flex-col gap-3 px-1 text-[0.875rem] text-ink-3`,children:[(0,J.jsx)(`p`,{children:G(`discover.start`)}),(0,J.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:$e.map(e=>(0,J.jsxs)(s,{variant:`secondary`,size:`sm`,onClick:()=>t(G(e)),children:[(0,J.jsx)(k,{className:`size-3.5`}),` `,G(e)]},e))})]}):p.error?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:p.error.message}):g?_?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-ink-3`,children:G(`discover.none`,{q:e})}):(0,J.jsxs)(J.Fragment,{children:[a?(0,J.jsx)(rt,{title:G(`space.skills`),count:g.skills.length,error:g.errors.skills,empty:G(`discover.groupNone`,{directory:`skills.sh`}),children:g.skills.map(e=>(0,J.jsx)(ot,{hit:e,adding:h.isPending&&h.variables===e.ref,failed:h.isError&&h.variables===e.ref?h.error:null,onLook:()=>d(e.ref),onAdd:()=>h.mutate(e.ref)},e.ref))}):null,(0,J.jsx)(rt,{title:G(`capabilities.connectors`),count:g.connectors.length,error:g.errors.connectors,empty:G(`discover.groupNone`,{directory:`integrations.sh`}),children:g.connectors.map(e=>(0,J.jsx)(st,{hit:e,admin:r},e.domain))})]}):(0,J.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,J.jsx)(S,{className:`size-5`})}),(0,J.jsx)(O,{open:l!==null,onClose:()=>d(null),wide:!0,height:`tall`,title:G(`skills.registryTitle`),children:l?(0,J.jsx)(fe,{spaceId:f,skillRef:l,onAdded:()=>{m(l),d(null)}},l):null})]}):null}function rt({title:e,count:t,error:n,empty:i,children:a}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-baseline gap-2 px-1`,children:[(0,J.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),t?(0,J.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:t}):null]}),n?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:n}):t?(0,J.jsx)(r,{className:`divide-y divide-border-soft`,children:a}):(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-ink-3`,children:i})]})}function it({icon:e,name:t,mono:n,chip:r,line:i,source:a,error:o,children:s}){return(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 px-3 py-3 sm:flex-nowrap`,children:[(0,J.jsx)(`span`,{className:`grid size-9 shrink-0 place-items-center rounded-lg bg-paper-2 text-ink-3`,children:(0,J.jsx)(e,{className:`size-4`})}),(0,J.jsxs)(`span`,{className:`min-w-0 flex-1 max-sm:basis-[calc(100%-3.25rem)]`,children:[(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(`span`,{className:n?`font-medium font-mono text-[0.8125rem]`:`font-medium`,children:t}),r]}),i?(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-[0.8125rem] text-ink-2`,children:i}):null,(0,J.jsx)(`span`,{className:`mt-0.5 block truncate text-[0.75rem] text-ink-3`,children:a}),o?(0,J.jsx)(`span`,{className:`mt-1 block text-[0.8125rem] text-rose`,children:o}):null]}),(0,J.jsx)(`span`,{className:`flex shrink-0 items-center gap-2 max-sm:ml-[3.25rem]`,children:s})]})}function at(){return(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.8125rem] text-moss`,children:[(0,J.jsx)(N,{className:`size-4`}),` `,G(`capabilities.inSpace`)]})}function ot({hit:e,adding:t,failed:n,onLook:r,onAdd:i}){return(0,J.jsxs)(it,{icon:V,name:e.name,mono:!0,chip:e.official?(0,J.jsx)(g,{tone:`live`,icon:(0,J.jsx)(ue,{className:`size-3`}),children:G(`skills.official`)}):(0,J.jsx)(g,{tone:`warn`,children:G(`skills.unchecked`)}),error:n?.message,source:[`skills.sh`,e.source,G(`skills.installs`,{n:e.installs.toLocaleString(W)})].join(` · `),children:[(0,J.jsx)(s,{variant:`ghost`,size:`sm`,onClick:r,children:G(`skills.open`)}),e.added?(0,J.jsx)(at,{}):(0,J.jsx)(s,{variant:`secondary`,size:`sm`,busy:t,onClick:i,children:G(`skills.add`)})]})}function st({hit:e,admin:t}){let n=E(),r=e.kinds.map(e=>e===`mcp`?`MCP`:`OpenAPI`);return(0,J.jsx)(it,{icon:R,name:e.name,line:e.description||void 0,source:[`integrations.sh`,e.domain,...r].join(` · `),children:e.setUp?(0,J.jsx)(at,{}):t?(0,J.jsx)(s,{variant:`secondary`,size:`sm`,onClick:()=>n(`/capabilities/connectors?setup=${encodeURIComponent(e.domain)}`),children:G(`discover.setUp`)}):null})}var ct={skills:4,connections:5};function lt(){let{space:e}=U(),t=H(),n=E(),i=F(`skills`),a=F(`unsetConnectors`),[o,s]=D(),l=o.get(`tab`)===`discover`?`discover`:`space`,[u,d,f]=tt(),m=e?.id??``,h=L(i?e?.id:void 0),g=X(m),v=Ne(m);if(!e)return null;let y=t&&!e.readOnly,b=u.trim().toLowerCase(),x=h.data?.skills??[],S=g.data?.connections??[],C=x.filter(e=>e.mode!==`off`).sort((e,t)=>e.mode===t.mode?0:e.mode===`always`?-1:1),w=b?x.filter(e=>e.name.includes(b)||e.description.toLowerCase().includes(b)):C,O=b?S.filter(e=>`${e.name} ${e.connector?.name??e.connectorId}`.toLowerCase().includes(b)):S,A=Pe(v.data??[],S,a),j=e=>s(t=>{let n=new URLSearchParams(t);return e===`discover`?n.set(`tab`,`discover`):n.delete(`tab`),n},{replace:!0});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[(0,J.jsx)(c,{title:G(`nav.capabilities`),hint:G(`capabilities.overview.hint`),plain:!0,action:(0,J.jsx)(ft,{entries:[...i&&!h.data?.readOnly?[{icon:V,label:G(`capabilities.overview.addSkill`),hint:G(`capabilities.overview.addSkillHint`),to:`/capabilities/skills`}]:[],...y?[{icon:R,label:G(`capabilities.overview.addConnection`),hint:G(`capabilities.overview.addConnectionHint`),to:`/capabilities/connectors?setup=`}]:[],{icon:Oe,label:G(`capabilities.discover`),hint:G(`capabilities.overview.discoverHint`),to:`/capabilities/overview?tab=discover`}]}),children:(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,J.jsx)(_,{value:l,onChange:j,options:[{id:`space`,label:G(`capabilities.inSpace`)},{id:`discover`,label:G(`capabilities.discover`)}],label:G(`nav.capabilities`)}),(0,J.jsxs)(`form`,{className:`flex h-10 min-w-0 flex-1 basis-60 items-center gap-2 rounded-full border border-input bg-card px-4 focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow`,onSubmit:e=>{e.preventDefault(),l===`space`&&b&&!w.length&&!O.length&&j(`discover`)},children:[(0,J.jsx)(k,{className:`size-4 shrink-0 text-ink-3`}),(0,J.jsx)(`input`,{type:`search`,value:u,"aria-label":G(l===`discover`?`discover.searchLabel`:`capabilities.overview.search`),placeholder:G(l===`discover`?`discover.search`:`capabilities.overview.search`),onChange:e=>d(e.target.value),className:`min-w-0 flex-1 bg-transparent text-[0.875rem] text-ink outline-none placeholder:text-ink-4`})]})]})}),(0,J.jsx)(`div`,{className:`flex animate-rise flex-col gap-9`,children:l===`discover`?(0,J.jsx)(nt,{asked:f,onExample:d}):(0,J.jsxs)(J.Fragment,{children:[i?(0,J.jsx)(ut,{icon:V,title:G(`space.skills`),all:x.length,to:`/capabilities/skills`,children:h.error?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:h.error.message}):w.length?(0,J.jsx)(`div`,{className:`grid gap-2.5 sm:grid-cols-2`,children:w.slice(0,ct.skills).map(e=>(0,J.jsx)(dt,{skill:e,onOpen:()=>n(`/capabilities/skills?show=k:${e.id}`)},e.id))}):h.isPending?null:(0,J.jsx)(r,{children:(0,J.jsx)(T,{children:b?G(`capabilities.overview.nothing`,{q:u.trim()}):G(`capabilities.overview.noSkills`)})})}):null,(0,J.jsxs)(ut,{icon:R,title:G(`capabilities.connectors`),all:S.length,to:`/capabilities/connectors`,children:[g.error?(0,J.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:g.error.message}):O.length?(0,J.jsx)(r,{className:`flex flex-col divide-y divide-border-soft p-0`,children:O.slice(0,ct.connections).map(e=>(0,J.jsx)(Xe,{connection:e,onOpen:()=>n(`/capabilities/connectors?show=${encodeURIComponent(e.id)}`)},e.id))}):g.isPending?null:(0,J.jsx)(r,{children:(0,J.jsx)(T,{children:b?G(`capabilities.overview.nothing`,{q:u.trim()}):G(`capabilities.overview.noConnections`)})}),A.length&&!b?(0,J.jsxs)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:[G(`capabilities.connectors.builtin`),`:`,` `,A.map((e,t)=>(0,J.jsxs)(`span`,{children:[t?` · `:null,y&&e.usable?(0,J.jsx)(p,{to:`/capabilities/connectors?setup=${encodeURIComponent(e.id)}`,className:`text-ink-2 hover:text-ink hover:underline`,children:e.name}):(0,J.jsx)(`span`,{className:`text-ink-2`,children:e.name})]},e.id))]}):null]})]})},l)]})}function ut({icon:e,title:t,all:n,to:r,children:i}){return(0,J.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1`,children:[(0,J.jsxs)(`h3`,{className:`flex items-center gap-2 font-semibold text-[0.9375rem]`,children:[(0,J.jsx)(e,{className:`size-4 text-ember-strong`,"aria-hidden":`true`}),t]}),(0,J.jsxs)(p,{to:r,className:`inline-flex items-center gap-0.5 text-[0.8125rem] text-ink-3 transition hover:text-ink`,children:[G(`capabilities.overview.all`,{n}),(0,J.jsx)(a,{className:`size-3.5`,"aria-hidden":`true`})]})]}),i]})}function dt({skill:e,onOpen:t}){return(0,J.jsxs)(`button`,{type:`button`,onClick:t,className:`flex min-w-0 flex-col gap-1.5 rounded-xl bg-card px-4 py-3 text-left shadow-soft ring-1 ring-border-soft transition hover:ring-border`,children:[(0,J.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:C(`truncate font-medium font-mono text-[0.8125rem]`,e.mode===`off`&&`text-ink-3`),children:e.name}),(0,J.jsx)(g,{tone:e.mode===`always`?`live`:`neutral`,children:G(`skills.mode.${e.mode}`)})]}),(0,J.jsx)(`span`,{className:`line-clamp-2 text-[0.8125rem] text-ink-2`,children:e.description}),(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2 text-[0.75rem] text-ink-3`,children:[(0,J.jsx)(de,{skill:e}),e.runScripts?G(`capabilities.overview.scripts`):null]})]})}function ft({entries:e}){let[t,n]=(0,q.useState)(!1),r=(0,q.useRef)(null);return(0,q.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)},i=e=>e.key===`Escape`&&n(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,i),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,i)}},[t]),(0,J.jsxs)(`div`,{className:`relative`,ref:r,children:[(0,J.jsxs)(s,{size:`sm`,"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[(0,J.jsx)(M,{className:`size-4`}),` `,G(`skills.add`),(0,J.jsx)(d,{className:`-mr-1 size-4`})]}),t?(0,J.jsx)(`div`,{role:`menu`,className:`absolute top-10 right-0 z-50 w-72 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,J.jsxs)(p,{to:e.to,role:`menuitem`,onClick:()=>n(!1),className:`flex w-full items-start gap-2.5 rounded-lg px-2.5 py-2 text-left transition hover:bg-accent`,children:[(0,J.jsx)(e.icon,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,J.jsxs)(`span`,{className:`min-w-0`,children:[(0,J.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:e.label}),(0,J.jsx)(`span`,{className:`block text-[0.8125rem] text-ink-3`,children:e.hint})]})]},e.to))}):null]})}var pt=(0,q.lazy)(()=>j(()=>import(`./SkillEditor-BaEiqqXl.js`).then(e=>({default:e.SkillEditor})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16])));function mt(){let[e,t]=D(),{space:n}=U(),r=re(),{narrow:i}=Te(),a=e.get(`show`),o=a?.startsWith(`k:`)?a:null,s=L(n?.id),l=ie(`skills`,r).filter(e=>e.plugin);xe(s.data?.skills.find(e=>`k:${e.id}`===o)?.name??null),(0,q.useEffect)(()=>{i||I().scrollTo({top:0})},[i,o]);let u=e=>i?t({show:e}):t(e===`all`?{}:{show:e},{replace:!0});return(0,J.jsx)(J.Fragment,{children:n?(0,J.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:o?(0,J.jsx)(q.Suspense,{fallback:null,children:(0,J.jsx)(pt,{skillId:o.slice(2),onGone:()=>u(`all`),onOpen:u,filesFirst:!0},o)}):s.data?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(le,{spaceId:n.id,data:s.data,onOpen:u,heading:G(`capabilities.inSpace`)}),l.flatMap(e=>e.sections).map(e=>r.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,J.jsx)(y,{id:e.id,children:(0,J.jsx)(c,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,J.jsx)(se,{of:e,children:(0,J.jsx)(e.component,{})})})},e.serial))]}):s.error?(0,J.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:s.error.message}):null}):null})}var ht=[{id:`overview`,label:`capabilities.overview`,icon:P,element:lt,menu:!1},{id:`skills`,label:`space.skills`,icon:V,element:mt,feature:`skills`,menu:!1},{id:`connectors`,label:`capabilities.connectors`,icon:R,element:Je,menu:!1},{id:`protocol`,label:`capabilities.protocol`,icon:l,element:me,admins:!0,menu:!1}];function gt(e,t=!0){return ht.filter(n=>n.element&&(!n.feature||e(n.feature))&&(t||!n.admins))}function _t(){let[e,t]=(0,q.useState)(null);return(0,q.useEffect)(()=>{let e=I(),n=()=>t(e.clientHeight);n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[]),e}function vt(){let e=F(`capabilities`),t=oe(),{section:n}=w(),[r]=D(),i=E(),a=v(),{space:o,loading:s}=U(),c=Se(),[l,u]=(0,q.useState)(null),[d,f]=(0,q.useState)(null),[p,m]=(0,q.useState)(null),g=gt(e=>_e(t,e),H()),_=g.find(e=>e.id===n),y=L(g.some(e=>e.id===`skills`)?o?.id:void 0),b=X(o?.id??``),x={skills:y.data?.skills.length,connectors:b.data?.connections.length},S=g.map(e=>({id:e.id,label:G(e.label),icon:e.icon,to:e.menu===!1&&c?`/capabilities/${e.id}?show=page`:`/capabilities/${e.id}`,count:x[e.id]})),O=S.find(e=>e.id===_?.id),k=r.get(`show`)||r.has(`setup`)?2:1,A=_&&_.menu!==!1&&p!==_.id?1:0,j=we(A),ee=we(k),M=(0,q.useMemo)(()=>({slot:l,narrow:c,setDetail:f}),[l,c]),N=_t();if(ae([{label:G(`nav.capabilities`),to:`/capabilities`},...O?[{label:O.label,to:O.to}]:[],...O&&d?[{label:d}]:[]]),!e)return(0,J.jsx)(h,{to:`/`,replace:!0});if(n===`discover`){let e=new URLSearchParams(a.search);return e.set(`tab`,`discover`),(0,J.jsx)(h,{to:{pathname:`/capabilities/overview`,search:`?${e}`},replace:!0})}if(!_&&g[0])return(0,J.jsx)(h,{to:{pathname:`/capabilities/${g[0].id}`,search:a.search},replace:!0});let P=_?.element;return(0,J.jsx)(be.Provider,{value:M,children:(0,J.jsx)(`div`,{className:`animate-rise`,children:(0,J.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[10.5rem_minmax(0,1fr)] md:gap-5 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,J.jsxs)(`aside`,{className:C(`menu-scroll min-w-0 md:sticky md:top-6 md:self-start md:overflow-y-auto md:overscroll-contain`,c&&k===2&&`hidden`,c&&ee===`back`&&K(`back`)),style:!c&&N?{maxHeight:N-48,paddingBottom:`var(--assistant-dock, 0px)`}:void 0,children:[(0,J.jsx)(Ce,{title:G(`nav.capabilities`),open:A===1?O??null:null,onBack:g.length>1?()=>m(_?.id??null):void 0,root:{icon:ce,label:G(`nav.capabilities`),onOpen:()=>i(c?`/capabilities/overview?show=page`:`/capabilities/overview`),current:_?.id===`overview`}}),(0,J.jsx)(`div`,{className:C(K(j)),children:A===0?(0,J.jsx)(ye,{entries:S.filter(e=>e.id!==`overview`),current:O,onPick:e=>{m(null),_?.menu===!1&&i(e.to)}}):(0,J.jsx)(`div`,{ref:u})},A)]}),(0,J.jsxs)(`div`,{className:C(`min-w-0`,c&&k<2&&`hidden`,c&&ee===`deeper`&&K(`deeper`)),children:[c&&O?(0,J.jsx)(`div`,{className:`mb-3`,children:(0,J.jsx)(Ee,{label:O.label,onBack:()=>i(O.to)})}):null,P?(0,J.jsx)(P,{}):null,o||s?null:(0,J.jsx)(T,{children:G(`settings.noSpace`)})]})]})})})}export{vt as CapabilitiesPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{in as r,ln as i,mn as a,nn as o,tn as s}from"./ui-BCfu5sia.js";import{t as c}from"./preload-helper-DpV6A1kQ.js";import{s as l}from"./i18n-BBzMbGoo.js";var u=e(t(),1),d=e(n(),1);function f(e){switch(e.group){case`Added`:return{label:`NEW`,dot:`bg-moss`};case`Fixed`:return{label:`FIXED`,dot:`bg-amber`};case`Changed`:return{label:`CHANGED`,dot:`bg-cobalt`};case`Performance`:return{label:`PERFORMANCE`,dot:`bg-ember`};case`Deploy`:return{label:`DEPLOY`,dot:`bg-ink-4`};case`Docs`:return{label:`DOCS`,dot:`bg-ink-4`};default:return{label:`OTHER`,dot:`bg-ink-4`}}}var p=e=>e.version?e.version.replace(/^v/,``):l(`about.unreleased`),m=e=>e.timestamp?new Date(e.timestamp*1e3).toISOString().slice(0,10):``,h=e=>e.charAt(0).toUpperCase()+e.slice(1);function g(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=[];for(let t of e){if(`${p(t)} ${m(t)}`.toLowerCase().includes(n)){r.push(t);continue}let e=t.commits.filter(e=>`${f(e).label} ${e.scope??``} ${e.message}`.toLowerCase().includes(n));e.length>0&&r.push({...t,commits:e})}return r}async function _(e){if(e)try{let t=await fetch(`https://raw.githubusercontent.com/engenty/wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await c(async()=>{let{default:e}=await import(`./changelog-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{in as r,ln as i,mn as a,nn as o,tn as s}from"./ui-BCfu5sia.js";import{t as c}from"./preload-helper-DpV6A1kQ.js";import{s as l}from"./i18n-BBzMbGoo.js";var u=e(t(),1),d=e(n(),1);function f(e){switch(e.group){case`Added`:return{label:`NEW`,dot:`bg-moss`};case`Fixed`:return{label:`FIXED`,dot:`bg-amber`};case`Changed`:return{label:`CHANGED`,dot:`bg-cobalt`};case`Performance`:return{label:`PERFORMANCE`,dot:`bg-ember`};case`Deploy`:return{label:`DEPLOY`,dot:`bg-ink-4`};case`Docs`:return{label:`DOCS`,dot:`bg-ink-4`};default:return{label:`OTHER`,dot:`bg-ink-4`}}}var p=e=>e.version?e.version.replace(/^v/,``):l(`about.unreleased`),m=e=>e.timestamp?new Date(e.timestamp*1e3).toISOString().slice(0,10):``,h=e=>e.charAt(0).toUpperCase()+e.slice(1);function g(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=[];for(let t of e){if(`${p(t)} ${m(t)}`.toLowerCase().includes(n)){r.push(t);continue}let e=t.commits.filter(e=>`${f(e).label} ${e.scope??``} ${e.message}`.toLowerCase().includes(n));e.length>0&&r.push({...t,commits:e})}return r}async function _(e){if(e)try{let t=await fetch(`https://raw.githubusercontent.com/engenty/wizards/v${e}/apps/web/src/about/changelog.json`,{signal:AbortSignal.timeout(5e3)});if(t.ok)return await t.json()}catch{}return(await c(async()=>{let{default:e}=await import(`./changelog-y5oxYzPd.js`);return{default:e}},[])).default}function v({release:e}){return(0,d.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.commits.map(e=>{let t=f(e);return(0,d.jsxs)(`li`,{className:`flex items-start gap-2.5 text-[0.875rem]`,children:[(0,d.jsx)(`span`,{className:a(`mt-[7px] size-1.5 shrink-0 rounded-full`,t.dot)}),(0,d.jsxs)(`span`,{className:`min-w-0 text-ink-2`,children:[(0,d.jsxs)(`span`,{className:`font-semibold text-[0.75rem] text-ink tracking-wide`,children:[t.label,e.scope?` [${e.scope}]`:``]}),` `,h(e.message),e.breaking?(0,d.jsx)(`span`,{className:`ml-1.5 rounded-full bg-rose-tint px-1.5 py-0.5 font-medium text-[0.75rem] text-rose`,children:l(`about.breaking`)}):null]})]},e.id)})})}function y({open:e,onClose:t,version:n}){let[a,c]=(0,u.useState)(null),[f,h]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||a)return;let t=!1;return _(n).then(e=>{t||c(e)}),()=>{t=!0}},[e,a,n]),(0,u.useEffect)(()=>{e||h(``)},[e]);let y=a?g(a,f):[];return(0,d.jsxs)(s,{open:e,onClose:t,title:l(`about.changelog`),wide:!0,height:`tall`,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[0.875rem] text-ink-3`,children:l(`about.changelogHint`)}),a===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(i,{})}):a.length===0?(0,d.jsx)(o,{children:l(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r,{type:`search`,value:f,placeholder:l(`about.search`),onChange:e=>h(e.target.value)}),y.length===0?(0,d.jsx)(o,{children:l(`about.noMatches`)}):null,y.map(e=>(0,d.jsxs)(`section`,{className:`mt-6`,children:[(0,d.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[1rem]`,children:[p(e),(0,d.jsx)(`span`,{className:`font-normal font-sans text-[0.8125rem] text-ink-3 tabular-nums`,children:m(e)})]}),(0,d.jsx)(`div`,{className:`mt-3`,children:(0,d.jsx)(v,{release:e})})]},e.version??`unreleased`))]})]})}export{y as ChangelogDialog,v as ReleaseNotes,_ as loadReleases,m as releaseDate,p as releaseLabel};
|