wizards 0.2.4 → 0.2.5
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/routes/api.js +12 -1
- package/apps/runtime/dist/routes/studio.js +11 -3
- package/apps/runtime/dist/services/cloud.js +24 -0
- package/apps/runtime/dist/services/profile.js +18 -3
- package/apps/runtime/dist/services/spaces.js +7 -1
- package/apps/web/dist/assets/Account-BKribBzW.js +1 -0
- package/apps/web/dist/assets/{ChangelogDialog-lGa0JKY1.js → ChangelogDialog-CYQC4l57.js} +1 -1
- package/apps/web/dist/assets/{ChatPanel-Dk_45uca.js → ChatPanel-Cnd_dfF2.js} +1 -1
- package/apps/web/dist/assets/{CreditsDialog-BPMWo6tp.js → CreditsDialog-7nLXWFvP.js} +1 -1
- package/apps/web/dist/assets/EditorPage-BjFAF_4T.js +2 -0
- package/apps/web/dist/assets/{FlowPreview-gwtUv8-X.js → FlowPreview-BT4i-qIF.js} +1 -1
- package/apps/web/dist/assets/HomePage-F04N9Y1Q.js +1 -0
- package/apps/web/dist/assets/{ImportWizard-D6y4bKlF.js → ImportWizard-Cg0l6q88.js} +1 -1
- package/apps/web/dist/assets/{LocalRuntime-BjzPSsHr.js → LocalRuntime-BoVnl1ga.js} +2 -2
- package/apps/web/dist/assets/NewWizardPage-DumPEWtE.js +2 -0
- package/apps/web/dist/assets/{PublicRunner-Dac_e6wg.js → PublicRunner-CllgpTeL.js} +1 -1
- package/apps/web/dist/assets/{RunnerView-BC6crf1p.js → RunnerView-adkYnOSi.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-7EG_dMSP.js +2 -0
- package/apps/web/dist/assets/{SetupPage-CYKVspBJ.js → SetupPage-BzZMf7Oz.js} +1 -1
- package/apps/web/dist/assets/{SharePage-DFIHsNS-.js → SharePage-CONXJnOU.js} +1 -1
- package/apps/web/dist/assets/{api-BTfKh3La.js → api-BC3K8Na8.js} +1 -1
- package/apps/web/dist/assets/changelog-C0GmxRP2.js +1 -0
- package/apps/web/dist/assets/cloud-off-D--dZLDw.js +1 -0
- package/apps/web/dist/assets/index-CJ3iuK8-.js +10 -0
- package/apps/web/dist/assets/index-mpjxO44v.css +1 -0
- package/apps/web/dist/assets/{meta-BbVhbYf6.js → meta-BeYxDfVN.js} +1 -1
- package/apps/web/dist/assets/{outputs-n_yhxmMk.js → outputs-DLmQMIUm.js} +1 -1
- package/apps/web/dist/assets/{session-D_Zggq_t.js → session-_w8H5O_d.js} +1 -1
- package/apps/web/dist/assets/type-DnfgUhpM.js +1 -0
- package/apps/web/dist/assets/ui-Cj3EzOCA.js +1 -0
- package/apps/web/dist/assets/upload-DNRENWzQ.js +1 -0
- package/apps/web/dist/index.html +6 -5
- package/apps/web/dist/mcp/flow.html +2 -2
- package/package.json +1 -1
- package/apps/web/dist/assets/EditorPage-Dt4MCcrU.js +0 -2
- package/apps/web/dist/assets/HomePage-Bi9FK3_1.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-2HbCaPSt.js +0 -2
- package/apps/web/dist/assets/SettingsPage-BfXxa4SU.js +0 -2
- package/apps/web/dist/assets/changelog-CLmll9By.js +0 -1
- package/apps/web/dist/assets/index-CIwJmOjo.css +0 -1
- package/apps/web/dist/assets/index-DOpyzQiU.js +0 -10
- package/apps/web/dist/assets/type-BMJpS6_D.js +0 -1
- package/apps/web/dist/assets/ui-C3bTWmdM.js +0 -1
- package/apps/web/dist/assets/upload--J5bZhEM.js +0 -1
|
@@ -6,7 +6,7 @@ import { allowed } from "../limits.js";
|
|
|
6
6
|
import { authenticate, principalOf } from "../mcp/auth.js";
|
|
7
7
|
import { ServiceError } from "../services/errors.js";
|
|
8
8
|
import { deleteFile, draftFiles, writeFile } from "../services/files.js";
|
|
9
|
-
import { checkOnServer, checkSchema, listSyncedSpaces, patchSyncedWizard, removeSyncedSpace, removeSyncedWizard, syncSettingsSchema, syncWizard, syncWizardSchema, } from "../services/spaces.js";
|
|
9
|
+
import { checkOnServer, checkSchema, listSyncedSpaces, patchSyncedWizard, removeSyncedSpace, removeSyncedWizard, rotateSyncedLink, syncSettingsSchema, syncWizard, syncWizardSchema, } from "../services/spaces.js";
|
|
10
10
|
import { createWizard, ownedWizard, publishWizard, writeDraft } from "../services/wizards.js";
|
|
11
11
|
import { codeOf, tenantStatus } from "../tenants/control.js";
|
|
12
12
|
const importSchema = z.object({
|
|
@@ -95,6 +95,17 @@ export const apiRoutes = new Hono()
|
|
|
95
95
|
}
|
|
96
96
|
const body = syncSettingsSchema.parse(await c.req.json());
|
|
97
97
|
return withTenant(who.tenantId, async () => c.json(await patchSyncedWizard(c.req.param("spaceId"), c.req.param("wizardId"), body)));
|
|
98
|
+
})
|
|
99
|
+
.post("/spaces/:spaceId/wizards/:wizardId/rotate-link", async (c) => {
|
|
100
|
+
const who = await caller(c, ["wizards:publish"]);
|
|
101
|
+
if (who instanceof Response) {
|
|
102
|
+
return who;
|
|
103
|
+
}
|
|
104
|
+
const limited = withinSyncLimit(c, who);
|
|
105
|
+
if (limited) {
|
|
106
|
+
return limited;
|
|
107
|
+
}
|
|
108
|
+
return withTenant(who.tenantId, async () => c.json(await rotateSyncedLink(who.userId, c.req.param("spaceId"), c.req.param("wizardId"))));
|
|
98
109
|
})
|
|
99
110
|
.delete("/spaces/:spaceId/wizards/:wizardId", async (c) => {
|
|
100
111
|
const who = await caller(c, ["wizards:write"]);
|
|
@@ -27,7 +27,7 @@ import { embeddingModel, hasTextModel, LOCAL_KEYS, localModelSettings, ModelUnav
|
|
|
27
27
|
import { HTML_RESPONSE_CSP } from "../render/guard.js";
|
|
28
28
|
import { mayBuild, projectWritable, requireWritable } from "../services/access.js";
|
|
29
29
|
import { architectTurn } from "../services/architect.js";
|
|
30
|
-
import { checkForCloud, cloudLinked, cloudSpaces, cloudState, forgetCloud, publishAndSync, pushSharing, removeFromCloud, replaceCloudSpaces, syncToCloud, } from "../services/cloud.js";
|
|
30
|
+
import { checkForCloud, cloudLinked, cloudSpaces, cloudState, forgetCloud, publishAndSync, pushSharing, removeFromCloud, replaceCloudSpaces, rotateInCloud, syncToCloud, } from "../services/cloud.js";
|
|
31
31
|
import { ServiceError } from "../services/errors.js";
|
|
32
32
|
import { deleteFile, listFiles, readFile, writeFile } from "../services/files.js";
|
|
33
33
|
import { exportWizard, importWizard, PACKAGE_EXTENSION, PACKAGE_MAX_BYTES, PACKAGE_MIME, } from "../services/package.js";
|
|
@@ -340,7 +340,10 @@ export const studio = new Hono()
|
|
|
340
340
|
.get("/projects/:id/wizards", async (c) => {
|
|
341
341
|
const user = c.get("user");
|
|
342
342
|
await ownedProject(user.id, c.req.param("id"));
|
|
343
|
-
|
|
343
|
+
const wizards = await listWizards(user.id, c.req.param("id"));
|
|
344
|
+
// A local install with an account: where each wizard stands in its cloud, for the cards.
|
|
345
|
+
const linked = await cloudLinked();
|
|
346
|
+
return c.json(await Promise.all(wizards.map(async (w) => ({ ...w, cloud: linked ? await cloudState(w.id) : null }))));
|
|
344
347
|
})
|
|
345
348
|
.post("/wizards", async (c) => {
|
|
346
349
|
const body = z
|
|
@@ -417,7 +420,12 @@ export const studio = new Hono()
|
|
|
417
420
|
const w = await ownedWizard(c.get("user").id, c.req.param("id"));
|
|
418
421
|
return c.json({ code: await codeOf(w.shareToken) });
|
|
419
422
|
})
|
|
420
|
-
|
|
423
|
+
// A new link here, and for the copy in the cloud of a linked account: the old ones stop.
|
|
424
|
+
.post("/wizards/:id/rotate-link", async (c) => {
|
|
425
|
+
const rotated = await rotateShareLink(c.get("user").id, c.req.param("id"));
|
|
426
|
+
const cloud = managed ? null : await rotateInCloud(c.get("user").id, c.req.param("id"));
|
|
427
|
+
return c.json({ ...rotated, cloud });
|
|
428
|
+
})
|
|
421
429
|
.post("/wizards/:id/duplicate", async (c) => c.json(await duplicateWizard(c.get("user").id, c.req.param("id"))))
|
|
422
430
|
.delete("/wizards/:id", async (c) => {
|
|
423
431
|
if (!managed) {
|
|
@@ -182,6 +182,30 @@ export async function pushSharing(userId, wizardId) {
|
|
|
182
182
|
dailyRunLimit: w.dailyRunLimit,
|
|
183
183
|
}).catch((err) => console.error("[cloud] sharing not sent:", err.message));
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* A new link was made here: the copy in the cloud gets a new one too, and its old one stops
|
|
187
|
+
* answering. Null where no account is linked; the state as it was where the cloud has no copy.
|
|
188
|
+
*/
|
|
189
|
+
export async function rotateInCloud(userId, wizardId) {
|
|
190
|
+
if (!(await cloudLinked())) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const state = await cloudState(wizardId);
|
|
194
|
+
if (!state.copy) {
|
|
195
|
+
return state;
|
|
196
|
+
}
|
|
197
|
+
const w = await ownedWizard(userId, wizardId);
|
|
198
|
+
const answer = await call("POST", `/spaces/${w.projectId}/wizards/${w.id}/rotate-link`);
|
|
199
|
+
if (!answer.ok || !answer.body.shareUrl) {
|
|
200
|
+
throw refusal(answer, "Der Link in der Cloud ließ sich nicht erneuern.");
|
|
201
|
+
}
|
|
202
|
+
const next = {
|
|
203
|
+
...state,
|
|
204
|
+
copy: { ...state.copy, shareUrl: answer.body.shareUrl, code: answer.body.code },
|
|
205
|
+
};
|
|
206
|
+
await writeSetting(key(w.id), next);
|
|
207
|
+
return next;
|
|
208
|
+
}
|
|
185
209
|
/** A wizard is about to be deleted here: its copy in the cloud goes too. */
|
|
186
210
|
export async function removeFromCloud(userId, wizardId) {
|
|
187
211
|
const state = await cloudState(wizardId);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { linkedAccount } from "../auth/account.js";
|
|
2
3
|
import { managed } from "../manage.js";
|
|
3
4
|
import { readSetting, writeSetting } from "../settings.js";
|
|
4
5
|
export const profileSchema = z.object({
|
|
@@ -8,16 +9,30 @@ export const profileSchema = z.object({
|
|
|
8
9
|
phone: z.string().trim().max(40),
|
|
9
10
|
});
|
|
10
11
|
const key = (user) => `profile:${user.tenantId}:${user.id}`;
|
|
12
|
+
/** The account whose name and e-mail the profile shows; null where the person sets them here. */
|
|
13
|
+
async function accountOf(user) {
|
|
14
|
+
if (managed) {
|
|
15
|
+
return { name: user.name, email: user.email };
|
|
16
|
+
}
|
|
17
|
+
const linked = await linkedAccount();
|
|
18
|
+
return linked ? { name: linked.name, email: linked.email } : null;
|
|
19
|
+
}
|
|
11
20
|
export async function userProfile(user) {
|
|
12
21
|
const stored = (await readSetting(key(user))) ?? {};
|
|
22
|
+
const account = await accountOf(user);
|
|
13
23
|
return {
|
|
14
|
-
name:
|
|
24
|
+
name: account?.name || stored.name || user.name,
|
|
15
25
|
about: stored.about ?? "",
|
|
16
|
-
email:
|
|
26
|
+
email: account ? account.email : stored.email || user.email,
|
|
17
27
|
phone: stored.phone ?? "",
|
|
18
28
|
};
|
|
19
29
|
}
|
|
20
30
|
export async function saveProfile(user, profile) {
|
|
21
|
-
|
|
31
|
+
// Name and e-mail an account gives stay the person's own underneath: they come back unlinked.
|
|
32
|
+
const stored = (await readSetting(key(user))) ?? {};
|
|
33
|
+
const own = (await accountOf(user))
|
|
34
|
+
? { ...profile, name: stored.name ?? "", email: stored.email ?? "" }
|
|
35
|
+
: profile;
|
|
36
|
+
await writeSetting(key(user), own);
|
|
22
37
|
return userProfile(user);
|
|
23
38
|
}
|
|
@@ -15,7 +15,7 @@ import { notFound, ServiceError } from "./errors.js";
|
|
|
15
15
|
import { keepFiles, replaceFiles } from "./files.js";
|
|
16
16
|
import { addProjectFile, projectFiles, removeProjectFile } from "./project-files.js";
|
|
17
17
|
import { brandColorSchema, projectFactSchema, projectLimit, removeProject, } from "./projects.js";
|
|
18
|
-
import { deleteWizard, draftIssues, parseDraft, shareUrl } from "./wizards.js";
|
|
18
|
+
import { deleteWizard, draftIssues, parseDraft, rotateShareLink, shareUrl } from "./wizards.js";
|
|
19
19
|
/**
|
|
20
20
|
* A local install's project on this runtime (docs/manage-contract.md, "Spaces of a local
|
|
21
21
|
* install"). The install sends a wizard when it publishes it: the published version and its
|
|
@@ -348,6 +348,12 @@ export async function patchSyncedWizard(spaceId, wizardId, patch) {
|
|
|
348
348
|
.where(eq(schema.wizard.id, w.id));
|
|
349
349
|
return { ok: true };
|
|
350
350
|
}
|
|
351
|
+
/** The install made a new link for a wizard: its copy here gets one too, the old one stops. */
|
|
352
|
+
export async function rotateSyncedLink(userId, spaceId, wizardId) {
|
|
353
|
+
const w = await syncedWizard(spaceId, wizardId);
|
|
354
|
+
const { shareToken } = await asSync(() => rotateShareLink(userId, w.id));
|
|
355
|
+
return { shareUrl: shareUrl(shareToken), code: await codeOf(shareToken) };
|
|
356
|
+
}
|
|
351
357
|
/** The install deleted a wizard: its copy here goes, with its link and its runs. */
|
|
352
358
|
export async function removeSyncedWizard(userId, spaceId, wizardId) {
|
|
353
359
|
const w = await syncedWizard(spaceId, wizardId);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,j as i,n as a,nt as o}from"./api-BC3K8Na8.js";import{f as s,t as c}from"./session-_w8H5O_d.js";import{t as l}from"./createLucideIcon-q3MZMmnf.js";import{t as u}from"./check-CUpby_J9.js";import{n as d,r as f}from"./upload-DNRENWzQ.js";import{t as p}from"./external-link-MAL7vJYj.js";import{_ as m,c as h,d as g,h as ee,m as _,n as v,o as y,r as b,s as x,t as S,y as C}from"./ui-Cj3EzOCA.js";import{c as w,d as T,g as E,i as D,u as O,y as k}from"./index-CJ3iuK8-.js";import{r as A}from"./LocalRuntime-BoVnl1ga.js";var j={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};j.node;var M=l(j),N={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};N.node;var P=l(N),F={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};F.node;var I=l(F),L=e(t(),1),R=e=>[`project-files`,e];function z(e){return i({queryKey:R(e),queryFn:()=>a.get(`/api/studio/projects/${e}/files`),refetchInterval:e=>e.state.data?.files.some(e=>e.status===`pending`)?2e3:!1})}function B(e,t){return r(`/api/studio/projects/${e}/files/${t}/content`)}function V(e,t=!1){let n=o(),[r,i]=(0,L.useState)(!1),[s,c]=(0,L.useState)(null),l=()=>n.invalidateQueries({queryKey:R(e)}),u=async e=>{c(null);try{await e()}catch(e){c(e.message)}finally{await l()}};return{busy:r,error:s,readOnly:t,upload:async(t,n)=>{i(!0),await u(async()=>{for(let r of n)await a.upload(`/api/studio/projects/${e}/files?kind=${t}`,r),await l()}),i(!1)},describe:(t,n)=>u(()=>a.patch(`/api/studio/projects/${e}/files/${t}`,{description:n})),remove:t=>u(()=>a.del(`/api/studio/projects/${e}/files/${t}`)),reindex:t=>u(()=>a.post(`/api/studio/projects/${e}/files/${t}/reindex`)),order:(t,n)=>u(()=>a.put(`/api/studio/projects/${e}/files/order`,{kind:t,ids:n}))}}function H(e,t){let n=`wz.layout.${e}`,[r,i]=(0,L.useState)(()=>{try{let e=localStorage.getItem(n);return e===`list`||e===`cards`?e:t}catch{return t}});return[r,()=>i(e=>{let t=e===`list`?`cards`:`list`;try{localStorage.setItem(n,t)}catch{}return t})]}function U(e,t,n=700){let[r,i]=(0,L.useState)(`idle`),[a,o]=(0,L.useState)(null),s=JSON.stringify(e),c=(0,L.useRef)(s),l=(0,L.useRef)({value:e,json:s,save:t});l.current={value:e,json:s,save:t};let u=(0,L.useRef)(Promise.resolve()),d=(0,L.useCallback)(()=>{let e=l.current;e.json!==c.current&&(c.current=e.json,i(`saving`),u.current=u.current.then(async()=>{try{await e.save(e.value),o(null),i(`saved`)}catch(e){c.current=``,o(e.message),i(`error`)}}))},[]);return(0,L.useEffect)(()=>{if(s===c.current)return;let e=setTimeout(d,n);return()=>clearTimeout(e)},[s,n,d]),(0,L.useEffect)(()=>d,[d]),{state:r,error:a}}function W(e){return e<1e6?`${Math.max(1,Math.round(e/1e3))} KB`:`${(e/1e6).toFixed(1)} MB`}var G=e(n(),1);function K({title:e,hint:t,save:n,action:r,locked:i,children:a}){return(0,G.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-1`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),n?.state===`saving`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,G.jsx)(g,{className:`size-3`}),` `,C(`project.saving`)]}):n?.state===`saved`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-moss`,children:[(0,G.jsx)(u,{className:`size-3.5`}),` `,C(`settings.saved`)]}):null]}),t?(0,G.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-snug`,children:t}):null]}),r?(0,G.jsx)(`div`,{className:`shrink-0`,children:r}):null]}),(0,G.jsxs)(v,{className:`p-5`,children:[i?(0,G.jsx)(`fieldset`,{disabled:!0,className:`min-w-0`,children:a}):a,n?.state===`error`&&n.error?(0,G.jsx)(`p`,{className:`mt-4 text-[14px] text-rose`,children:n.error}):null]})]})}function q({children:e,layout:t,onToggle:n}){return(0,G.jsxs)(`div`,{className:`mb-3 flex items-start gap-2`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsx)(`div`,{className:`w-56 max-w-full transition-[width] duration-200 focus-within:w-full has-[input:not(:placeholder-shown)]:w-full`,children:e})}),(0,G.jsx)(y,{label:C(t===`list`?`project.viewCards`:`project.viewList`),onClick:n,children:t===`list`?(0,G.jsx)(P,{className:`size-4`}):(0,G.jsx)(I,{className:`size-4`})})]})}function J({value:e,onChange:t,onEnter:n,placeholder:r,busy:i}){return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(d,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-4`}),(0,G.jsx)(`input`,{type:`search`,value:e,placeholder:r,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n?.(),className:`h-9 w-full rounded-lg border border-input bg-card pr-3 pl-9 text-[14px] text-ink outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow`}),i?(0,G.jsx)(g,{className:`-translate-y-1/2 absolute top-1/2 right-3 size-4 text-ink-3`}):null]})}function Y({onFiles:e,accept:t,multiple:n=!0,className:r,children:i}){return(0,G.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),e.currentTarget.dataset.over=`1`},onDragLeave:e=>{delete e.currentTarget.dataset.over},onDrop:t=>{t.preventDefault(),delete t.currentTarget.dataset.over;let r=Array.from(t.dataTransfer.files);r.length&&e(n?r:r.slice(0,1))},className:ee(`flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-input border-dashed text-[14px] text-ink-3 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow hover:border-ink-4 hover:text-ink data-[over]:border-focus data-[over]:bg-paper-2 data-[over]:text-ink`,r),children:[i,(0,G.jsx)(`input`,{className:`sr-only`,type:`file`,accept:t,multiple:n,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length&&e(n)}})]})}var X=`mt-1.5 text-[13px] text-ink-3`;function Z(e){let t=o(),[n,r]=(0,L.useState)(!1),i=s({mutationFn:e=>a.post(`/api/studio/account/link`,e),onSuccess:({url:e})=>{A(e),r(!0)}});return(0,L.useEffect)(()=>{if(!n)return;let e=setInterval(()=>void t.invalidateQueries({queryKey:[`me`]}),2e3),i=setTimeout(()=>r(!1),3e5);return()=>{clearInterval(e),clearTimeout(i)}},[n,t]),(0,L.useEffect)(()=>{e&&r(!1)},[e]),{link:i,waiting:n}}function Q({link:e,waiting:t}){return e.isError?(0,G.jsx)(`p`,{className:`text-[13px] text-rose`,children:C(`local.accountFailed`)}):t?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 text-[13px] text-ink-3`,children:[(0,G.jsx)(g,{className:`size-3.5`}),` `,C(`local.accountWaiting`)]}):null}function te(){let e=Z(!1),{link:t}=e,[n,r]=(0,L.useState)(``);return(0,G.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-4 py-5 first:pt-0 last:pb-0`,children:[(0,G.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2`,children:(0,G.jsx)(M,{className:`size-5`})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-medium text-[15px]`,children:C(`account.local`)}),(0,G.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-relaxed`,children:C(`account.localText`)})]})]}),T.account?(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 py-5 last:pb-0`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-medium text-[15px]`,children:C(`account.with`)}),(0,G.jsxs)(`ul`,{className:`mt-2 flex flex-col gap-2 text-[14px] text-ink-2 leading-snug`,children:[(0,G.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,G.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-amber`}),C(`account.withCredits`)]}),(0,G.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,G.jsx)(k,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),C(`account.withCloud`)]})]})]}),(0,G.jsx)(`div`,{children:(0,G.jsx)(S,{busy:t.isPending&&!t.variables?.signup,onClick:()=>t.mutate({}),children:C(`account.signIn`)})})]}):null,T.account?(0,G.jsxs)(`form`,{className:`flex flex-col gap-3 py-5 last:pb-0`,onSubmit:e=>{e.preventDefault(),t.mutate({signup:!0,code:n.trim()||void 0})},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-medium text-[15px]`,children:C(`account.new`)}),(0,G.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-relaxed`,children:C(`account.newHint`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(x,{value:n,maxLength:64,autoComplete:`off`,spellCheck:!1,placeholder:C(`account.code`),"aria-label":C(`account.code`),onChange:e=>r(e.target.value),className:`w-56 font-mono text-[14px]`}),(0,G.jsx)(S,{type:`submit`,variant:`secondary`,className:`h-11`,busy:t.isPending&&!!t.variables?.signup,children:C(`account.create`)})]}),(0,G.jsx)(Q,{...e})]}):null]})}var $={start:`account.kind.start`,monthly:`account.kind.monthly`,gift:`account.kind.gift`};function ne({account:e}){let t=o(),n=Z(e.signedIn),r=s({mutationFn:()=>a.del(`/api/studio/account`),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})}),i=new Intl.DateTimeFormat(m,{dateStyle:`medium`});return(0,G.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 py-5 first:pt-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-[15px]`,children:e.name||e.email}),e.signedIn?(0,G.jsx)(b,{tone:`live`,children:C(`account.linked`)}):null]}),(0,G.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:e.email})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(S,{variant:`secondary`,onClick:()=>A(e.url),children:[C(`setup.openAccount`),` `,(0,G.jsx)(p,{className:`size-4`})]}),(0,G.jsxs)(S,{variant:`ghost`,busy:r.isPending,onClick:()=>r.mutate(),children:[(0,G.jsx)(E,{className:`size-4`}),` `,C(`nav.logout`)]})]})]}),e.signedIn?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 py-5`,children:[(0,G.jsx)(`p`,{className:`text-[14px] text-ink-2`,children:C(`local.accountExpired`)}),(0,G.jsx)(`div`,{children:(0,G.jsx)(S,{busy:n.link.isPending,onClick:()=>n.link.mutate({}),children:C(`account.signInAgain`)})}),(0,G.jsx)(Q,{...n})]}),e.credits===null?null:(0,G.jsxs)(`div`,{className:`py-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13px] text-ink-3`,children:C(`account.credits`)}),(0,G.jsx)(`div`,{className:`font-display font-semibold text-[22px] tabular-nums leading-tight`,children:C(`nav.credits`,{n:Math.floor(e.credits).toLocaleString()})})]}),(0,G.jsxs)(S,{variant:`secondary`,onClick:()=>A(`${e.url}/billing`),children:[C(`account.topUp`),` `,(0,G.jsx)(p,{className:`size-4`})]})]}),e.expiring.length?(0,G.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1 text-[13px] text-ink-3 tabular-nums`,children:e.expiring.map(e=>(0,G.jsxs)(`li`,{children:[C(`account.expires`,{n:Math.floor(e.credits).toLocaleString(),date:i.format(new Date(e.expiresAt))}),$[e.kind]?(0,G.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,C($[e.kind])]}):null]},`${e.kind}:${e.expiresAt}`))}):null]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 py-5 text-[14px] text-ink-2 leading-snug last:pb-0`,children:[(0,G.jsx)(k,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),(0,G.jsx)(`p`,{children:C(`account.cloud`,{host:D(e.cloudUrl)})})]})]})}function re({me:e,fromAccount:t}){let n=o(),[r,i]=(0,L.useState)(e.profile),s=e=>i(t=>({...t,...e})),l=U(r,async e=>{await a.put(`/api/studio/profile`,e),await n.invalidateQueries({queryKey:[`me`]})});return(0,G.jsx)(K,{title:C(`account.profile`),hint:C(`account.hint`),save:l,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 sm:w-32`,children:[(0,G.jsx)(`div`,{className:`flex size-20 items-center justify-center overflow-hidden rounded-full bg-ember-tint font-semibold text-[28px] text-ember-strong ring-1 ring-border-soft`,children:e.user.image?(0,G.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full object-cover`}):c(r.name)||`?`}),(0,G.jsx)(`p`,{className:`text-center text-[12px] text-ink-3 leading-snug`,children:C(`account.initials`)})]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(h,{children:C(`account.name`)}),(0,G.jsx)(x,{value:r.name,maxLength:80,disabled:t,onChange:e=>s({name:e.target.value})}),(0,G.jsx)(`p`,{className:X,children:C(t?`account.fromAccount`:`account.nameHint`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(h,{children:C(`account.about`)}),(0,G.jsx)(_,{minRows:3,maxLength:2e3,value:r.about,onChange:e=>s({about:e.target.value})}),(0,G.jsx)(`p`,{className:X,children:C(`account.aboutHint`)})]}),(0,G.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(h,{children:C(`account.email`)}),(0,G.jsx)(x,{type:`email`,value:r.email,maxLength:200,disabled:t,onChange:e=>s({email:e.target.value})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(h,{children:C(`account.phone`)}),(0,G.jsx)(x,{type:`tel`,value:r.phone,maxLength:40,onChange:e=>s({phone:e.target.value})})]})]})]})]})})}function ie({me:e}){let t=e.mode===`managed`,n=t||!!e.account;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,G.jsx)(K,{title:C(`account.connection`),hint:C(`account.connectionHint`),children:t?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-[15px]`,children:e.user.name}),(0,G.jsx)(b,{tone:`live`,children:C(`account.linked`)})]}),(0,G.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:e.user.email})]}),e.manageUrl?(0,G.jsxs)(S,{variant:`secondary`,onClick:()=>A(`${e.manageUrl}/account`),children:[C(`setup.openAccount`),` `,(0,G.jsx)(p,{className:`size-4`})]}):null]}):e.account?(0,G.jsx)(ne,{account:e.account}):(0,G.jsx)(te,{})}),(0,G.jsx)(re,{me:e,fromAccount:n},n?`account`:`own`),(0,G.jsx)(K,{title:C(`account.look`),hint:C(`account.lookHint`),children:(0,G.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pb-4`,children:[(0,G.jsx)(`span`,{className:`font-medium text-[14px]`,children:C(`nav.language`)}),(0,G.jsx)(O,{tone:`surface`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-4`,children:[(0,G.jsx)(`span`,{className:`font-medium text-[14px]`,children:C(`nav.theme`)}),(0,G.jsx)(w,{})]})]})})]})}export{q as a,W as c,V as d,H as f,Y as i,B as l,Q as n,J as o,z as p,Z as r,K as s,ie as t,U as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{a as i,d as a,h as o,i as s,s as c,y as l}from"./ui-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{a as i,d as a,h as o,i as s,s as c,y as l}from"./ui-Cj3EzOCA.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}function _({open:e,onClose:t}){let[n,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||n)return;let t=!1;return r(()=>import(`./changelog-C0GmxRP2.js`).then(e=>{t||_(e.default)}),[]),()=>{t=!0}},[e,n]),(0,u.useEffect)(()=>{e||y(``)},[e]);let b=n?g(n,v):[];return(0,d.jsxs)(s,{open:e,onClose:t,title:l(`about.changelog`),wide:!0,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[14px] text-ink-3`,children:l(`about.changelogHint`)}),n===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(a,{})}):n.length===0?(0,d.jsx)(i,{children:l(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c,{type:`search`,value:v,placeholder:l(`about.search`),onChange:e=>y(e.target.value)}),b.length===0?(0,d.jsx)(i,{children:l(`about.noMatches`)}):null,b.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-[16px]`,children:[p(e),(0,d.jsx)(`span`,{className:`font-normal font-sans text-[13px] text-ink-3 tabular-nums`,children:m(e)})]}),(0,d.jsx)(`ul`,{className:`mt-3 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-[14px]`,children:[(0,d.jsx)(`span`,{className:o(`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-[12px] 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-[12px] text-rose`,children:l(`about.breaking`)}):null]})]},e.id)})})]},e.version??`unreleased`))]})]})}export{_ as ChangelogDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,d as i,i as a,n as o,nt as s}from"./api-BTfKh3La.js";import{t as c}from"./createLucideIcon-q3MZMmnf.js";import{t as l}from"./plug-CLjyCoHB.js";import{C as u,D as d,b as f,r as p,x as m}from"./outputs-n_yhxmMk.js";import{r as h}from"./wand-sparkles-CKxArWPY.js";import{t as g}from"./plus-Du-Jx8aI.js";import{t as _}from"./mic-Bvz4mA2j.js";import{_ as v,d as y,h as b,o as x,y as S}from"./ui-C3bTWmdM.js";import{l as C}from"./index-DOpyzQiU.js";var w={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};w.node;var T=c(w),E={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};E.node;var D=c(E),O=e(t(),1),k=!1;function A(){if(!(typeof window>`u`||k))return window.SpeechRecognition??window.webkitSpeechRecognition}var j=typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<`u`;function M(e,t){let n=e.trimEnd(),r=t.trim();return n&&r?`${n} ${r}`:n||r}function N(e,t){let[n,r]=(0,O.useState)(!1),[i,a]=(0,O.useState)(!1),[s,c]=(0,O.useState)(null),l=(0,O.useRef)(e);l.current=e;let u=(0,O.useRef)(t);u.current=t;let d=(0,O.useRef)(null);(0,O.useEffect)(()=>()=>d.current?.stop(),[]);let f=async()=>{let e=l.current,t;try{t=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{c(`denied`);return}let n=[],i=new MediaRecorder(t);i.ondataavailable=e=>e.data.size&&n.push(e.data),i.onstop=async()=>{for(let e of t.getTracks())e.stop();d.current=null,r(!1);let s=(i.mimeType||`audio/webm`).split(`;`)[0],l=new File(n,`dictation`,{type:s});if(l.size){a(!0);try{let{text:t}=await o.upload(`/api/studio/transcribe`,l);t.trim()&&u.current(M(e,t))}catch(e){c(e.message)}finally{a(!1)}}},d.current={stop:()=>i.state!==`inactive`&&i.stop()},i.start(),r(!0)},p=e=>{let t=l.current,n=``,i=new e;i.continuous=!0,i.interimResults=!0,i.lang=v===`de`?`de-DE`:`en-US`,i.onresult=e=>{let r=``;for(let t=Math.max(0,e.resultIndex);t<e.results.length;t++){let i=e.results[t],a=i[0]?.transcript??``;i.isFinal?n=M(n,a):r+=a}u.current(M(t,M(n,r)))},i.onerror=e=>{if(e.error!==`aborted`&&e.error!==`no-speech`){if(e.error===`not-allowed`){c(`denied`);return}k=!0,j&&!n?(i.onend=null,d.current=null,f()):c(e.error)}},i.onend=()=>{d.current=null,r(!1)},d.current={stop:()=>i.stop()},i.start(),r(!0)};return{supported:!!A()||j,listening:n,processing:i,error:s,toggle:()=>{if(i)return;if(d.current){d.current.stop();return}c(null);let e=A();e?p(e):f()}}}var P=e(n(),1),F=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function I(e){let t=e.filter(e=>e.type.startsWith(`image/`));return t.length?Object.fromEntries(t.map(e=>[e.name,URL.createObjectURL(e)])):void 0}function L(e){let t=e.match(/(?:^|\n\n)(?:Angehängt|Attached): ([^\n]+)$/);return t?{text:e.slice(0,t.index).trim(),names:t[1].split(`, `).filter(Boolean)}:{text:e,names:[]}}function R(e,t){if(e.name&&e.name!==`image.png`)return e;let n=e.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`,r=new Date().toISOString().slice(0,19).replace(/[-:]/g,``).replace(`T`,`-`);return new File([e],`paste-${r}${t?`-${t+1}`:``}.${n}`,{type:e.type})}function z({url:e,label:t,children:n}){return(0,P.jsxs)(`div`,{className:`group relative`,title:t,children:[(0,P.jsx)(`img`,{src:e,alt:t,width:64,height:64,className:`size-16 rounded-lg bg-paper-2 object-cover ring-1 ring-border`}),n]})}function B({names:e,previews:t,fileUrl:n}){let r=e.filter(e=>t?.[e]||n&&F.test(e)),i=e.filter(e=>!r.includes(e));return(0,P.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[r.map(e=>{let r=t?.[e]??n?.(e)??``;return(0,P.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,title:e,children:(0,P.jsx)(`img`,{src:r,alt:e,className:`max-h-60 w-auto max-w-full rounded-xl bg-paper-2 object-contain ring-1 ring-border`})},e)}),i.length?(0,P.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:i.map(e=>(0,P.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-paper-2 px-2.5 py-1 text-[12px] text-ink-2`,children:[(0,P.jsx)(u,{className:`size-3 shrink-0 text-ink-4`}),(0,P.jsx)(`span`,{className:`truncate`,children:e})]},e))}):null]})}function V(e,t){let n=s(),[i,o]=(0,O.useState)([]),[c,l]=(0,O.useState)(`idle`),[u,d]=(0,O.useState)(null),[f,p]=(0,O.useState)(null),[m,h]=(0,O.useState)(null),[g,_]=(0,O.useState)(null),v=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(e){if(v.current!==e.id){v.current=e.id,o(e.messages);return}c===`idle`&&o(t=>e.messages.length>=t.length?e.messages:t)}},[e,c]),{messages:i,phase:c,activity:f,thought:m,startedAt:g,error:u,send:async(i,s=[])=>{if(!e||!(i.trim()||s.length)||c!==`idle`)return!1;if(d(null),_(Date.now()),h(null),s.length){l(`thinking`);try{for(let t of s){let n=await fetch(r(`/api/studio/wizards/${e.id}/files/${encodeURIComponent(t.name)}`),{method:`PUT`,credentials:`include`,headers:{"content-type":t.type||`application/octet-stream`},body:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??n.statusText)}}}catch(t){return d(t.message),l(`idle`),_(null),await n.invalidateQueries({queryKey:[`wizard`,e.id]}),!1}let t=`${S(`editor.attached`)}: ${s.map(e=>e.name).join(`, `)}`;i=i.trim()?`${i}\n\n${t}`:t}let u=`p-${Date.now()}`;o(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:i,previews:I(s)},{id:u,role:`assistant`,content:``,pending:!0}]),l(`thinking`),p(null);let f=!1;try{await a(`/api/studio/wizards/${e.id}/chat`,{message:i},(e,n)=>{if(e===`text`){let e=JSON.parse(n);o(t=>t.map(t=>t.id===u?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(n));else if(e===`thought`)h(JSON.parse(n));else if(e===`building`)l(`building`);else if(e===`done`){f=!0;let e=JSON.parse(n);o(t=>t.map(t=>t.id===u?{...t,content:e.reply,changed:e.changed,pending:!1}:t)),e.changed&&t(e.draft,e.revision)}else e===`error`&&(f=!0,d(JSON.parse(n).message))}),f||d(S(`editor.chatBroken`))}catch(e){d(e.message)}finally{p(null),h(null),_(null),o(e=>e.filter(e=>!(e.id===u&&!e.content)).map(e=>({...e,pending:!1}))),l(`idle`),await n.invalidateQueries({queryKey:[`wizard`,e.id]}),await n.invalidateQueries({queryKey:[`me`]})}return!0},fileUrl:t=>r(`/api/studio/wizards/${e?.id}/files/${encodeURIComponent(t)}`)}}function H(e){let[t,n]=(0,O.useState)(()=>Date.now());return(0,O.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?null:Math.max(0,Math.floor((t-e)/1e3))}function U(e){return e<60?`${e} s`:`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)} min`}function W({chat:e,thought:t,className:n,spinner:r=`size-3.5`}){let i=H(e.startedAt);return(0,P.jsxs)(`div`,{className:b(`min-w-0`,n),children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(y,{className:b(`shrink-0`,r)}),(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:e.activity??(e.phase===`building`?S(`editor.building`):S(`editor.thinking`))}),i===null?null:(0,P.jsx)(`span`,{className:`shrink-0 text-ink-4 tabular-nums`,children:U(i)})]}),t&&e.thought?(0,P.jsx)(`p`,{className:`mt-0.5 truncate pl-5.5 text-[12px] text-ink-4`,children:e.thought}):null]})}function G({message:e,fileUrl:t}){let{text:n,names:r}=L(e.content);return(0,P.jsxs)(`div`,{className:`ml-8 flex flex-col items-end gap-1.5 self-end`,children:[r.length?(0,P.jsx)(B,{names:r,previews:e.previews,fileUrl:t}):null,n?(0,P.jsx)(`div`,{className:`rounded-xl rounded-br-md bg-paper-2 px-4 py-2.5 text-[14px] leading-relaxed`,children:(0,P.jsx)(`span`,{className:`whitespace-pre-wrap`,children:n})}):null]})}function K({chat:e,avatar:t,hello:n=S(`editor.chatHello`),placeholder:r=S(`editor.composer`),changedLabel:a=`Ablauf aktualisiert`,compact:o,intro:s,closed:c}){let[v,w]=(0,O.useState)(!1),[E,D]=(0,O.useState)(``),[k,A]=(0,O.useState)([]),j=(0,O.useRef)(null),M=(0,O.useRef)(null),F=(0,O.useRef)(null),I=N(E,D);(0,O.useEffect)(()=>{j.current?.scrollTo({top:j.current.scrollHeight,behavior:`smooth`})},[e.messages,e.phase]),(0,O.useEffect)(()=>{let e=M.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[E]);let L=(E.trim()||k.length>0)&&e.phase===`idle`,B=e=>A(t=>[...t.filter(t=>!e.some(e=>e.name===t.name)),...e]),[V,H]=(0,O.useState)(new Map);(0,O.useEffect)(()=>{let e=new Map(k.filter(e=>e.type.startsWith(`image/`)).map(e=>[e,URL.createObjectURL(e)]));return H(e),()=>{for(let t of e.values())URL.revokeObjectURL(t)}},[k]);let U=async()=>{if(!L)return;I.listening&&I.toggle();let t={text:E,files:k};D(``),A([]),await e.send(t.text.trim(),t.files)||(D(t.text),A(t.files))},K=!o||v,q=e.messages.at(-1);return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[o&&(q||e.error)?(0,P.jsxs)(`button`,{type:`button`,"aria-expanded":v,"aria-label":S(`editor.thread`),onClick:()=>w(e=>!e),className:`flex items-center gap-2 px-4 pt-2.5 pb-0.5 text-left text-[13px] text-ink-3 transition hover:text-ink`,children:[!(e.error||v)&&q?.pending?(0,P.jsx)(W,{chat:e,className:`flex-1`}):(0,P.jsx)(`span`,{className:b(`min-w-0 flex-1 truncate`,e.error&&`text-rose`),children:e.error??(v?S(`editor.thread`):q?.content)}),v?(0,P.jsx)(h,{className:`size-4 shrink-0`}):(0,P.jsx)(T,{className:`size-4 shrink-0`})]}):null,(0,P.jsxs)(`div`,{ref:j,className:b(`min-h-0 flex-1 overflow-y-auto px-5 py-5`,!K&&`hidden`),children:[e.messages.length===0&&!c?s??(0,P.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,P.jsx)(i,{kind:t,size:32,interactive:!1}),(0,P.jsx)(`p`,{className:`pt-1 text-[14px] text-ink-2 leading-relaxed`,children:n})]}):null,(0,P.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.messages.map(n=>n.role===`user`?(0,P.jsx)(G,{message:n,fileUrl:e.fileUrl},n.id):(0,P.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,P.jsx)(`div`,{className:`shrink-0`,children:(0,P.jsx)(i,{kind:t,size:28,interactive:!1})}),(0,P.jsxs)(`div`,{className:`min-w-0 pt-0.5 text-[14px]`,children:[n.source===`mcp`?(0,P.jsxs)(`div`,{className:`mb-1 inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,P.jsx)(l,{className:`size-3`}),` `,S(`editor.viaClient`,{client:n.client??`MCP`})]}):null,n.content?(0,P.jsx)(p,{text:n.content,className:`text-[14px]`}):null,n.pending?(0,P.jsx)(W,{chat:e,thought:!0,className:`mt-1 text-[13px] text-ink-3`}):null,n.changed?(0,P.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-full bg-ember-tint px-2.5 py-0.5 text-[12px] text-ember-strong`,children:[(0,P.jsx)(m,{className:`size-3`}),` `,a]}):null]})]},n.id))}),e.error?(0,P.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-3 py-2 text-[13px] text-rose`,children:e.error}):null]}),c?(0,P.jsx)(`p`,{className:`m-3 rounded-xl bg-paper-2 px-4 py-3 text-[13px] text-ink-2 leading-relaxed`,children:c}):(0,P.jsxs)(`div`,{className:o?`p-2`:`p-3`,children:[(0,P.jsxs)(`div`,{className:`rounded-xl bg-card p-1.5 shadow-soft ring-1 ring-border focus-within:ring-focus`,children:[V.size?(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2 px-1 pt-1 pb-1.5`,children:k.map((e,t)=>{let n=V.get(e);return n?(0,P.jsx)(z,{url:n,label:e.name,children:(0,P.jsx)(`button`,{type:`button`,"aria-label":S(`editor.detach`),onClick:()=>A(e=>e.filter((e,n)=>n!==t)),className:`-top-1.5 -right-1.5 absolute flex size-5 items-center justify-center rounded-full bg-ink text-paper opacity-0 shadow-soft transition focus-visible:opacity-100 group-hover:opacity-100`,children:(0,P.jsx)(C,{className:`size-3`})})},`${e.name}-${t}`):null})}):null,k.some(e=>!V.has(e))?(0,P.jsx)(`ul`,{className:`flex flex-wrap gap-1.5 px-1 pt-1 pb-1.5`,children:k.map((e,t)=>V.has(e)?null:(0,P.jsxs)(`li`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-paper-2 py-1 pr-1 pl-2.5 text-[12px] text-ink-2`,children:[(0,P.jsx)(u,{className:`size-3 shrink-0 text-ink-4`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name}),(0,P.jsx)(`button`,{type:`button`,"aria-label":S(`editor.detach`),onClick:()=>A(e=>e.filter((e,n)=>n!==t)),className:`inline-flex size-5 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-3 hover:text-ink`,children:(0,P.jsx)(C,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,P.jsxs)(`div`,{className:`flex items-end gap-1`,children:[(0,P.jsx)(x,{label:S(`editor.attach`),onClick:()=>F.current?.click(),children:(0,P.jsx)(g,{className:`size-4`})}),(0,P.jsx)(`input`,{ref:F,type:`file`,multiple:!0,hidden:!0,onChange:e=>{let t=Array.from(e.target.files??[]);e.target.value=``,B(t)}}),(0,P.jsx)(`textarea`,{ref:M,rows:1,value:E,onChange:e=>D(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&(e.preventDefault(),B(t.map(R)))},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),U())},placeholder:I.listening?S(`editor.listening`):r,className:`max-h-[200px] min-h-[40px] flex-1 resize-none bg-transparent px-1.5 py-2 text-[14px] outline-none placeholder:text-ink-4`}),I.supported?(0,P.jsx)(x,{label:I.processing?S(`editor.transcribing`):I.listening?S(`editor.voiceStop`):S(`editor.voice`),"aria-pressed":I.listening,disabled:I.processing,onClick:I.toggle,className:b(I.listening&&`bg-rose-tint text-rose hover:bg-rose-tint hover:text-rose`),children:I.processing?(0,P.jsx)(y,{className:`size-4`}):I.listening?(0,P.jsx)(f,{className:`size-3.5 animate-pulse-dot fill-current`}):(0,P.jsx)(_,{className:`size-4`})}):null,(0,P.jsx)(`button`,{type:`button`,onClick:()=>void U(),disabled:!L,className:b(`inline-flex size-9 shrink-0 items-center justify-center rounded-full transition`,L?`bg-primary text-primary-foreground`:`bg-paper-2 text-ink-4`),"aria-label":`Send`,children:(0,P.jsx)(d,{className:`size-4`})})]})]}),I.error?(0,P.jsx)(`p`,{className:`mt-2 px-1 text-[12px] text-rose`,children:I.error===`denied`?S(`editor.micDenied`):I.error}):null]})]})}export{D as a,V as i,W as n,I as r,K as t};
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,d as i,i as a,n as o,nt as s}from"./api-BC3K8Na8.js";import{t as c}from"./createLucideIcon-q3MZMmnf.js";import{t as l}from"./plug-CLjyCoHB.js";import{C as u,D as d,b as f,r as p,x as m}from"./outputs-DLmQMIUm.js";import{r as h}from"./wand-sparkles-CKxArWPY.js";import{t as g}from"./plus-Du-Jx8aI.js";import{t as _}from"./mic-Bvz4mA2j.js";import{_ as v,d as y,h as b,o as x,y as S}from"./ui-Cj3EzOCA.js";import{h as C}from"./index-CJ3iuK8-.js";var w={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};w.node;var T=c(w),E={name:`lock`,size:24,node:[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]};E.node;var D=c(E),O=e(t(),1),k=!1;function A(){if(!(typeof window>`u`||k))return window.SpeechRecognition??window.webkitSpeechRecognition}var j=typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<`u`;function M(e,t){let n=e.trimEnd(),r=t.trim();return n&&r?`${n} ${r}`:n||r}function N(e,t){let[n,r]=(0,O.useState)(!1),[i,a]=(0,O.useState)(!1),[s,c]=(0,O.useState)(null),l=(0,O.useRef)(e);l.current=e;let u=(0,O.useRef)(t);u.current=t;let d=(0,O.useRef)(null);(0,O.useEffect)(()=>()=>d.current?.stop(),[]);let f=async()=>{let e=l.current,t;try{t=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{c(`denied`);return}let n=[],i=new MediaRecorder(t);i.ondataavailable=e=>e.data.size&&n.push(e.data),i.onstop=async()=>{for(let e of t.getTracks())e.stop();d.current=null,r(!1);let s=(i.mimeType||`audio/webm`).split(`;`)[0],l=new File(n,`dictation`,{type:s});if(l.size){a(!0);try{let{text:t}=await o.upload(`/api/studio/transcribe`,l);t.trim()&&u.current(M(e,t))}catch(e){c(e.message)}finally{a(!1)}}},d.current={stop:()=>i.state!==`inactive`&&i.stop()},i.start(),r(!0)},p=e=>{let t=l.current,n=``,i=new e;i.continuous=!0,i.interimResults=!0,i.lang=v===`de`?`de-DE`:`en-US`,i.onresult=e=>{let r=``;for(let t=Math.max(0,e.resultIndex);t<e.results.length;t++){let i=e.results[t],a=i[0]?.transcript??``;i.isFinal?n=M(n,a):r+=a}u.current(M(t,M(n,r)))},i.onerror=e=>{if(e.error!==`aborted`&&e.error!==`no-speech`){if(e.error===`not-allowed`){c(`denied`);return}k=!0,j&&!n?(i.onend=null,d.current=null,f()):c(e.error)}},i.onend=()=>{d.current=null,r(!1)},d.current={stop:()=>i.stop()},i.start(),r(!0)};return{supported:!!A()||j,listening:n,processing:i,error:s,toggle:()=>{if(i)return;if(d.current){d.current.stop();return}c(null);let e=A();e?p(e):f()}}}var P=e(n(),1),F=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function I(e){let t=e.filter(e=>e.type.startsWith(`image/`));return t.length?Object.fromEntries(t.map(e=>[e.name,URL.createObjectURL(e)])):void 0}function L(e){let t=e.match(/(?:^|\n\n)(?:Angehängt|Attached): ([^\n]+)$/);return t?{text:e.slice(0,t.index).trim(),names:t[1].split(`, `).filter(Boolean)}:{text:e,names:[]}}function R(e,t){if(e.name&&e.name!==`image.png`)return e;let n=e.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`,r=new Date().toISOString().slice(0,19).replace(/[-:]/g,``).replace(`T`,`-`);return new File([e],`paste-${r}${t?`-${t+1}`:``}.${n}`,{type:e.type})}function z({url:e,label:t,children:n}){return(0,P.jsxs)(`div`,{className:`group relative`,title:t,children:[(0,P.jsx)(`img`,{src:e,alt:t,width:64,height:64,className:`size-16 rounded-lg bg-paper-2 object-cover ring-1 ring-border`}),n]})}function B({names:e,previews:t,fileUrl:n}){let r=e.filter(e=>t?.[e]||n&&F.test(e)),i=e.filter(e=>!r.includes(e));return(0,P.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[r.map(e=>{let r=t?.[e]??n?.(e)??``;return(0,P.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,title:e,children:(0,P.jsx)(`img`,{src:r,alt:e,className:`max-h-60 w-auto max-w-full rounded-xl bg-paper-2 object-contain ring-1 ring-border`})},e)}),i.length?(0,P.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:i.map(e=>(0,P.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-paper-2 px-2.5 py-1 text-[12px] text-ink-2`,children:[(0,P.jsx)(u,{className:`size-3 shrink-0 text-ink-4`}),(0,P.jsx)(`span`,{className:`truncate`,children:e})]},e))}):null]})}function V(e,t){let n=s(),[i,o]=(0,O.useState)([]),[c,l]=(0,O.useState)(`idle`),[u,d]=(0,O.useState)(null),[f,p]=(0,O.useState)(null),[m,h]=(0,O.useState)(null),[g,_]=(0,O.useState)(null),v=(0,O.useRef)(null);return(0,O.useEffect)(()=>{if(e){if(v.current!==e.id){v.current=e.id,o(e.messages);return}c===`idle`&&o(t=>e.messages.length>=t.length?e.messages:t)}},[e,c]),{messages:i,phase:c,activity:f,thought:m,startedAt:g,error:u,send:async(i,s=[])=>{if(!e||!(i.trim()||s.length)||c!==`idle`)return!1;if(d(null),_(Date.now()),h(null),s.length){l(`thinking`);try{for(let t of s){let n=await fetch(r(`/api/studio/wizards/${e.id}/files/${encodeURIComponent(t.name)}`),{method:`PUT`,credentials:`include`,headers:{"content-type":t.type||`application/octet-stream`},body:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??n.statusText)}}}catch(t){return d(t.message),l(`idle`),_(null),await n.invalidateQueries({queryKey:[`wizard`,e.id]}),!1}let t=`${S(`editor.attached`)}: ${s.map(e=>e.name).join(`, `)}`;i=i.trim()?`${i}\n\n${t}`:t}let u=`p-${Date.now()}`;o(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:i,previews:I(s)},{id:u,role:`assistant`,content:``,pending:!0}]),l(`thinking`),p(null);let f=!1;try{await a(`/api/studio/wizards/${e.id}/chat`,{message:i},(e,n)=>{if(e===`text`){let e=JSON.parse(n);o(t=>t.map(t=>t.id===u?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(n));else if(e===`thought`)h(JSON.parse(n));else if(e===`building`)l(`building`);else if(e===`done`){f=!0;let e=JSON.parse(n);o(t=>t.map(t=>t.id===u?{...t,content:e.reply,changed:e.changed,pending:!1}:t)),e.changed&&t(e.draft,e.revision)}else e===`error`&&(f=!0,d(JSON.parse(n).message))}),f||d(S(`editor.chatBroken`))}catch(e){d(e.message)}finally{p(null),h(null),_(null),o(e=>e.filter(e=>!(e.id===u&&!e.content)).map(e=>({...e,pending:!1}))),l(`idle`),await n.invalidateQueries({queryKey:[`wizard`,e.id]}),await n.invalidateQueries({queryKey:[`me`]})}return!0},fileUrl:t=>r(`/api/studio/wizards/${e?.id}/files/${encodeURIComponent(t)}`)}}function H(e){let[t,n]=(0,O.useState)(()=>Date.now());return(0,O.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?null:Math.max(0,Math.floor((t-e)/1e3))}function U(e){return e<60?`${e} s`:`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)} min`}function W({chat:e,thought:t,className:n,spinner:r=`size-3.5`}){let i=H(e.startedAt);return(0,P.jsxs)(`div`,{className:b(`min-w-0`,n),children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,P.jsx)(y,{className:b(`shrink-0`,r)}),(0,P.jsx)(`span`,{className:`min-w-0 truncate`,children:e.activity??(e.phase===`building`?S(`editor.building`):S(`editor.thinking`))}),i===null?null:(0,P.jsx)(`span`,{className:`shrink-0 text-ink-4 tabular-nums`,children:U(i)})]}),t&&e.thought?(0,P.jsx)(`p`,{className:`mt-0.5 truncate pl-5.5 text-[12px] text-ink-4`,children:e.thought}):null]})}function G({message:e,fileUrl:t}){let{text:n,names:r}=L(e.content);return(0,P.jsxs)(`div`,{className:`ml-8 flex flex-col items-end gap-1.5 self-end`,children:[r.length?(0,P.jsx)(B,{names:r,previews:e.previews,fileUrl:t}):null,n?(0,P.jsx)(`div`,{className:`rounded-xl rounded-br-md bg-paper-2 px-4 py-2.5 text-[14px] leading-relaxed`,children:(0,P.jsx)(`span`,{className:`whitespace-pre-wrap`,children:n})}):null]})}function K({chat:e,avatar:t,hello:n=S(`editor.chatHello`),placeholder:r=S(`editor.composer`),changedLabel:a=`Ablauf aktualisiert`,compact:o,intro:s,closed:c}){let[v,w]=(0,O.useState)(!1),[E,D]=(0,O.useState)(``),[k,A]=(0,O.useState)([]),j=(0,O.useRef)(null),M=(0,O.useRef)(null),F=(0,O.useRef)(null),I=N(E,D);(0,O.useEffect)(()=>{j.current?.scrollTo({top:j.current.scrollHeight,behavior:`smooth`})},[e.messages,e.phase]),(0,O.useEffect)(()=>{let e=M.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,200)}px`)},[E]);let L=(E.trim()||k.length>0)&&e.phase===`idle`,B=e=>A(t=>[...t.filter(t=>!e.some(e=>e.name===t.name)),...e]),[V,H]=(0,O.useState)(new Map);(0,O.useEffect)(()=>{let e=new Map(k.filter(e=>e.type.startsWith(`image/`)).map(e=>[e,URL.createObjectURL(e)]));return H(e),()=>{for(let t of e.values())URL.revokeObjectURL(t)}},[k]);let U=async()=>{if(!L)return;I.listening&&I.toggle();let t={text:E,files:k};D(``),A([]),await e.send(t.text.trim(),t.files)||(D(t.text),A(t.files))},K=!o||v,q=e.messages.at(-1);return(0,P.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[o&&(q||e.error)?(0,P.jsxs)(`button`,{type:`button`,"aria-expanded":v,"aria-label":S(`editor.thread`),onClick:()=>w(e=>!e),className:`flex items-center gap-2 px-4 pt-2.5 pb-0.5 text-left text-[13px] text-ink-3 transition hover:text-ink`,children:[!(e.error||v)&&q?.pending?(0,P.jsx)(W,{chat:e,className:`flex-1`}):(0,P.jsx)(`span`,{className:b(`min-w-0 flex-1 truncate`,e.error&&`text-rose`),children:e.error??(v?S(`editor.thread`):q?.content)}),v?(0,P.jsx)(h,{className:`size-4 shrink-0`}):(0,P.jsx)(T,{className:`size-4 shrink-0`})]}):null,(0,P.jsxs)(`div`,{ref:j,className:b(`min-h-0 flex-1 overflow-y-auto px-5 py-5`,!K&&`hidden`),children:[e.messages.length===0&&!c?s??(0,P.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,P.jsx)(i,{kind:t,size:32,interactive:!1}),(0,P.jsx)(`p`,{className:`pt-1 text-[14px] text-ink-2 leading-relaxed`,children:n})]}):null,(0,P.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.messages.map(n=>n.role===`user`?(0,P.jsx)(G,{message:n,fileUrl:e.fileUrl},n.id):(0,P.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,P.jsx)(`div`,{className:`shrink-0`,children:(0,P.jsx)(i,{kind:t,size:28,interactive:!1})}),(0,P.jsxs)(`div`,{className:`min-w-0 pt-0.5 text-[14px]`,children:[n.source===`mcp`?(0,P.jsxs)(`div`,{className:`mb-1 inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,P.jsx)(l,{className:`size-3`}),` `,S(`editor.viaClient`,{client:n.client??`MCP`})]}):null,n.content?(0,P.jsx)(p,{text:n.content,className:`text-[14px]`}):null,n.pending?(0,P.jsx)(W,{chat:e,thought:!0,className:`mt-1 text-[13px] text-ink-3`}):null,n.changed?(0,P.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-full bg-ember-tint px-2.5 py-0.5 text-[12px] text-ember-strong`,children:[(0,P.jsx)(m,{className:`size-3`}),` `,a]}):null]})]},n.id))}),e.error?(0,P.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-3 py-2 text-[13px] text-rose`,children:e.error}):null]}),c?(0,P.jsx)(`p`,{className:`m-3 rounded-xl bg-paper-2 px-4 py-3 text-[13px] text-ink-2 leading-relaxed`,children:c}):(0,P.jsxs)(`div`,{className:o?`p-2`:`p-3`,children:[(0,P.jsxs)(`div`,{className:`rounded-xl bg-card p-1.5 shadow-soft ring-1 ring-border focus-within:ring-focus`,children:[V.size?(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2 px-1 pt-1 pb-1.5`,children:k.map((e,t)=>{let n=V.get(e);return n?(0,P.jsx)(z,{url:n,label:e.name,children:(0,P.jsx)(`button`,{type:`button`,"aria-label":S(`editor.detach`),onClick:()=>A(e=>e.filter((e,n)=>n!==t)),className:`-top-1.5 -right-1.5 absolute flex size-5 items-center justify-center rounded-full bg-ink text-paper opacity-0 shadow-soft transition focus-visible:opacity-100 group-hover:opacity-100`,children:(0,P.jsx)(C,{className:`size-3`})})},`${e.name}-${t}`):null})}):null,k.some(e=>!V.has(e))?(0,P.jsx)(`ul`,{className:`flex flex-wrap gap-1.5 px-1 pt-1 pb-1.5`,children:k.map((e,t)=>V.has(e)?null:(0,P.jsxs)(`li`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-paper-2 py-1 pr-1 pl-2.5 text-[12px] text-ink-2`,children:[(0,P.jsx)(u,{className:`size-3 shrink-0 text-ink-4`}),(0,P.jsx)(`span`,{className:`truncate`,children:e.name}),(0,P.jsx)(`button`,{type:`button`,"aria-label":S(`editor.detach`),onClick:()=>A(e=>e.filter((e,n)=>n!==t)),className:`inline-flex size-5 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-3 hover:text-ink`,children:(0,P.jsx)(C,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,P.jsxs)(`div`,{className:`flex items-end gap-1`,children:[(0,P.jsx)(x,{label:S(`editor.attach`),onClick:()=>F.current?.click(),children:(0,P.jsx)(g,{className:`size-4`})}),(0,P.jsx)(`input`,{ref:F,type:`file`,multiple:!0,hidden:!0,onChange:e=>{let t=Array.from(e.target.files??[]);e.target.value=``,B(t)}}),(0,P.jsx)(`textarea`,{ref:M,rows:1,value:E,onChange:e=>D(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&(e.preventDefault(),B(t.map(R)))},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),U())},placeholder:I.listening?S(`editor.listening`):r,className:`max-h-[200px] min-h-[40px] flex-1 resize-none bg-transparent px-1.5 py-2 text-[14px] outline-none placeholder:text-ink-4`}),I.supported?(0,P.jsx)(x,{label:I.processing?S(`editor.transcribing`):I.listening?S(`editor.voiceStop`):S(`editor.voice`),"aria-pressed":I.listening,disabled:I.processing,onClick:I.toggle,className:b(I.listening&&`bg-rose-tint text-rose hover:bg-rose-tint hover:text-rose`),children:I.processing?(0,P.jsx)(y,{className:`size-4`}):I.listening?(0,P.jsx)(f,{className:`size-3.5 animate-pulse-dot fill-current`}):(0,P.jsx)(_,{className:`size-4`})}):null,(0,P.jsx)(`button`,{type:`button`,onClick:()=>void U(),disabled:!L,className:b(`inline-flex size-9 shrink-0 items-center justify-center rounded-full transition`,L?`bg-primary text-primary-foreground`:`bg-paper-2 text-ink-4`),"aria-label":`Send`,children:(0,P.jsx)(d,{className:`size-4`})})]})]}),I.error?(0,P.jsx)(`p`,{className:`mt-2 px-1 text-[12px] text-rose`,children:I.error===`denied`?S(`editor.micDenied`):I.error}):null]})]})}export{D as a,V as i,W as n,I as r,K as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{t as i}from"./external-link-MAL7vJYj.js";import{_ as a,a as o,d as s,i as c,s as l,y as u}from"./ui-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{t as i}from"./external-link-MAL7vJYj.js";import{_ as a,a as o,d as s,i as c,s as l,y as u}from"./ui-Cj3EzOCA.js";var d=e(t(),1),f=[{name:`engenty wizards`,description:{de:`KI-Wizards aus einer Beschreibung, mit einem Link geteilt.`,en:`AI wizards built from a description, shared with a link.`},homepage:`https://github.com/engenty/engenty-wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:{de:`Konnektoren, Datentabellen, Suche und die Engenties stammen aus dem engenty-Framework.`,en:`Connectors, data tables, search and the engenties come from the engenty framework.`},homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],p=[{name:`Mastra`,description:{de:`Agent-Framework hinter den KI-Schritten.`,en:`Agent framework behind the AI steps.`},homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:{de:`Modell-Aufrufe für Text, Bild, Video und Sprache.`,en:`Model calls for text, image, video and speech.`},homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:{de:`MCP-Server zum Bauen von Wizards, MCP-Client für Werkzeuge der Schritte.`,en:`MCP server for building wizards, MCP client for the steps' tools.`},homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:{de:`HTTP-API der Runtime.`,en:`The runtime's HTTP API.`},homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:{de:`Schema und Migrationen der Datenbanken.`,en:`Schema and migrations of the databases.`},homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:{de:`Eine Datenbank je Mandant, lokal als Datei oder bei Turso.`,en:`One database per tenant, a local file or at Turso.`},homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:{de:`Browser-Schritte sowie PDF- und PNG-Export.`,en:`Browser steps and the PDF and PNG export.`},homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`agentOS`,description:{de:`Sandbox für Code-Schritte ohne Docker.`,en:`Sandbox for code steps without Docker.`},homepage:`https://github.com/rivet-dev/agentos`,license:`Apache-2.0`},{name:`React`,description:{de:`UI-Bibliothek der Web-App.`,en:`UI library of the web app.`},homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:{de:`Build-Werkzeug der Web-App.`,en:`Build tool of the web app.`},homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:{de:`Styling der Oberfläche.`,en:`Styling of the interface.`},homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:{de:`Das Diagramm der Schritte im Editor.`,en:`The diagram of steps in the editor.`},homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:{de:`Server-Daten in der Web-App.`,en:`Server data in the web app.`},homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:{de:`Das Terminal auf der Seite, in dem sich KI-Clients anmelden.`,en:`The terminal on the page where AI clients sign in.`},homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:{de:`Icons.`,en:`Icons.`},homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:{de:`Schrift der Oberfläche.`,en:`Typeface of the interface.`},homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:{de:`Schrift der Überschriften.`,en:`Typeface of the headings.`},homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:{de:`Erzeugt den Changelog aus den Commits.`,en:`Generates the changelog from the commits.`},homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],m=e(n(),1),h=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function g({name:e,homepage:t,version:n,license:r,description:a}){return(0,m.jsxs)(`li`,{className:`py-2.5`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,m.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[14px] text-ink underline-offset-4 hover:underline`,children:[e,(0,m.jsx)(i,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,m.jsx)(`span`,{className:`font-medium text-[14px] text-ink`,children:e}),n?(0,m.jsx)(`span`,{className:`text-[12px] text-ink-3 tabular-nums`,children:n}):null,(0,m.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:r})]}),a?(0,m.jsx)(`p`,{className:`mt-0.5 text-[13px] text-ink-3`,children:a}):null]})}function _({title:e,hint:t,children:n}){return(0,m.jsxs)(`section`,{className:`mt-6`,children:[(0,m.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[16px]`,children:e}),t?(0,m.jsx)(`p`,{className:`mt-2 text-[13px] text-ink-3`,children:t}):null,n]})}function v({credits:e}){return(0,m.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,m.jsx)(g,{name:e.name,homepage:e.homepage,license:e.license,description:e.description[a]},e.name))})}function y({label:e,packages:t}){return(0,m.jsxs)(`div`,{className:`mt-4`,children:[(0,m.jsx)(`h4`,{className:`font-medium text-[12px] text-ink-3 tracking-wide`,children:e}),(0,m.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,m.jsx)(g,{...e},e.name))})]})}function b({open:e,onClose:t}){let[n,i]=(0,d.useState)(null),[a,g]=(0,d.useState)(``);(0,d.useEffect)(()=>{if(!e||n)return;let t=!1;return r(()=>import(`./oss-credits-Hu4LieLA.js`).then(e=>{t||i(e.default)}),[]),()=>{t=!0}},[e,n]),(0,d.useEffect)(()=>{e||g(``)},[e]);let b=a.trim().toLowerCase(),x=e=>b?e.filter(e=>h(b,e.name,e.license,e.description.de,e.description.en)):e,S=e=>b?e.filter(e=>h(b,e.name,e.license,e.version)):e,C=x(f),w=x(p),T=n?[{id:`shared`,label:u(`about.creditsShared`),packages:S(n.shared)},...n.groups.map(e=>({id:e.id,label:e.label,packages:S(e.packages)}))].filter(e=>e.packages.length>0):[],E=C.length===0&&w.length===0&&T.length===0;return(0,m.jsxs)(c,{open:e,onClose:t,title:u(`about.credits`),wide:!0,children:[(0,m.jsx)(`p`,{className:`-mt-3 mb-4 text-[14px] text-ink-3`,children:u(`about.creditsHint`)}),(0,m.jsx)(l,{type:`search`,value:a,placeholder:u(`about.search`),onChange:e=>g(e.target.value)}),C.length>0?(0,m.jsx)(_,{title:u(`about.creditsProduct`),children:(0,m.jsx)(v,{credits:C})}):null,w.length>0?(0,m.jsx)(_,{title:u(`about.creditsBuiltWith`),children:(0,m.jsx)(v,{credits:w})}):null,n===null?(0,m.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,m.jsx)(s,{})}):T.length>0?(0,m.jsx)(_,{title:u(`about.creditsDeps`),hint:b?void 0:u(`about.creditsDepsHint`),children:T.map(e=>(0,m.jsx)(y,{label:e.label,packages:e.packages},e.id))}):null,n!==null&&E?(0,m.jsx)(o,{children:u(`about.noMatches`)}):null]})}export{b as CreditsDialog};
|