wizards 0.2.47 → 0.2.48
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/agents/{project-assistant.js → studio-assistant.js} +199 -69
- package/apps/runtime/dist/agents/website.js +25 -2
- package/apps/runtime/dist/app.js +2 -1
- package/apps/runtime/dist/assistant/browser.js +26 -0
- package/apps/runtime/dist/assistant/docs.js +158 -0
- package/apps/runtime/dist/assistant/knows.js +325 -0
- package/apps/runtime/dist/assistant/primer.js +26 -0
- package/apps/runtime/dist/authoring/guide.js +5 -0
- package/apps/runtime/dist/connectors/plugin-connections.js +123 -29
- package/apps/runtime/dist/db/migrations/tenant/0012_assistant_chat.sql +40 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0012_snapshot.json +3132 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +30 -0
- package/apps/runtime/dist/docs/dev/index.md +34 -0
- package/apps/runtime/dist/docs/dev/meta.json +7 -0
- package/apps/runtime/dist/docs/dev/plugins/connections.md +70 -0
- package/apps/runtime/dist/docs/dev/plugins/events.md +86 -0
- package/apps/runtime/dist/docs/dev/plugins/examples.md +99 -0
- package/apps/runtime/dist/docs/dev/plugins/index.md +72 -0
- package/apps/runtime/dist/docs/dev/plugins/layout.md +88 -0
- package/apps/runtime/dist/docs/dev/plugins/meta.json +29 -0
- package/apps/runtime/dist/docs/dev/plugins/pro-modules.md +59 -0
- package/apps/runtime/dist/docs/dev/plugins/quick-start.md +92 -0
- package/apps/runtime/dist/docs/dev/plugins/reference.md +298 -0
- package/apps/runtime/dist/docs/dev/plugins/reloading.md +75 -0
- package/apps/runtime/dist/docs/dev/plugins/routes.md +123 -0
- package/apps/runtime/dist/docs/dev/plugins/runners.md +184 -0
- package/apps/runtime/dist/docs/dev/plugins/server.md +191 -0
- package/apps/runtime/dist/docs/dev/plugins/shipping.md +98 -0
- package/apps/runtime/dist/docs/dev/plugins/space.md +260 -0
- package/apps/runtime/dist/docs/dev/plugins/starters.md +62 -0
- package/apps/runtime/dist/docs/dev/plugins/studio.md +261 -0
- package/apps/runtime/dist/docs/dev/plugins/styling.md +109 -0
- package/apps/runtime/dist/docs/dev/plugins/tables.md +102 -0
- package/apps/runtime/dist/docs/dev/plugins/tools.md +128 -0
- package/apps/runtime/dist/docs/meta.json +3 -0
- package/apps/runtime/dist/docs/user/ai-apps.md +99 -0
- package/apps/runtime/dist/docs/user/assistant.md +52 -0
- package/apps/runtime/dist/docs/user/build-a-wizard.md +79 -0
- package/apps/runtime/dist/docs/user/command-line.md +76 -0
- package/apps/runtime/dist/docs/user/connectors.md +80 -0
- package/apps/runtime/dist/docs/user/data.md +61 -0
- package/apps/runtime/dist/docs/user/first-start.md +42 -0
- package/apps/runtime/dist/docs/user/index.md +45 -0
- package/apps/runtime/dist/docs/user/install.md +76 -0
- package/apps/runtime/dist/docs/user/meta.json +29 -0
- package/apps/runtime/dist/docs/user/models.md +100 -0
- package/apps/runtime/dist/docs/user/plugins.md +61 -0
- package/apps/runtime/dist/docs/user/run.md +92 -0
- package/apps/runtime/dist/docs/user/server.md +50 -0
- package/apps/runtime/dist/docs/user/space.md +97 -0
- package/apps/runtime/dist/docs/user/steps.md +196 -0
- package/apps/runtime/dist/docs/user/test-and-share.md +210 -0
- package/apps/runtime/dist/docs/user/troubleshooting.md +57 -0
- package/apps/runtime/dist/engine/runner.js +12 -5
- package/apps/runtime/dist/manage.js +11 -0
- package/apps/runtime/dist/plugins/loader.js +2 -0
- package/apps/runtime/dist/routes/studio.js +119 -68
- package/apps/runtime/dist/services/assistant-chats.js +267 -0
- package/apps/runtime/dist/services/project-index.js +1 -1
- package/apps/runtime/dist/services/space-origin.js +45 -2
- package/apps/web/dist/assets/{AboutDialog-t7bpiasT.js → AboutDialog-CuiVGknS.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-B87yS6aN.js → ChangelogDialog-DCEQD3Jd.js} +1 -1
- package/apps/web/dist/assets/ChatView-DFxrG2PD.js +10 -0
- package/apps/web/dist/assets/EditorPage-B5rzKNMy.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-ChXfiMn_.js → FlowPreview-CYoR5DRY.js} +1 -1
- package/apps/web/dist/assets/{Harness-zKMptCzB.js → Harness-DAR1u4Dk.js} +1 -1
- package/apps/web/dist/assets/HomePage-BnYdh_Nx.js +1 -0
- package/apps/web/dist/assets/Marketplace-BDQNwMDB.js +2 -0
- package/apps/web/dist/assets/{NewWizardPage-C3NqEGmg.js → NewWizardPage-DztTEUlG.js} +1 -1
- package/apps/web/dist/assets/ProjectPage-B7-Lqx9a.js +2 -0
- package/apps/web/dist/assets/PublicRunner-CaH3bHHd.js +1 -0
- package/apps/web/dist/assets/{ReadOnly-C9P9aiU6.js → ReadOnly-DnB47DQC.js} +1 -1
- package/apps/web/dist/assets/RunDrawer-Dv0KRqGA.js +4 -0
- package/apps/web/dist/assets/RunnerView-Bzwv1u4j.js +2 -0
- package/apps/web/dist/assets/SettingsPage-oVO7CKvc.js +1 -0
- package/apps/web/dist/assets/{SetupPage-B3IOQLO3.js → SetupPage-D--8cWA0.js} +1 -1
- package/apps/web/dist/assets/{SharePage-C3QEzicl.js → SharePage-DjU08q7T.js} +1 -1
- package/apps/web/dist/assets/{ThemeSwitch-3IzIOlNz.js → ThemeSwitch-C3EJRN06.js} +1 -1
- package/apps/web/dist/assets/arrow-right-F7X_SjK9.js +1 -0
- package/apps/web/dist/assets/changelog-BRoVI_JJ.js +1 -0
- package/apps/web/dist/assets/{circle-alert-CPo3Naay.js → circle-alert-DdpaAYgd.js} +1 -1
- package/apps/web/dist/assets/{definition-CQGiBQ4X.js → definition-CHacJYmI.js} +2 -2
- package/apps/web/dist/assets/{external-link-CpU8aJY2.js → external-link-Dfc1VFvS.js} +1 -1
- package/apps/web/dist/assets/index-CX_yxZVQ.js +79 -0
- package/apps/web/dist/assets/index-Dr0bv52Q.css +1 -0
- package/apps/web/dist/assets/{lock-C_WlXIQ0.js → lock-Bu1wDFs8.js} +1 -1
- package/apps/web/dist/assets/{refresh-cw-Cli5WGnW.js → refresh-cw-BUDPOT39.js} +1 -1
- package/apps/web/dist/assets/{session-miDEdw2c.js → session-Blj2os_v.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-ROT8Lbbj.js → settings-menu-BvxRnNtf.js} +1 -1
- package/apps/web/dist/assets/{sparkles-CP5H-O1E.js → sparkles-DWGJluyV.js} +1 -1
- package/apps/web/dist/assets/{trash-DU-hZpV0.js → trash-D9UB6TtS.js} +1 -1
- package/apps/web/dist/assets/ui-GsuU9WTj.js +9 -0
- package/apps/web/dist/assets/{upload-DMq5N6Fw.js → upload-BngimDBR.js} +1 -1
- package/apps/web/dist/assets/{volume-2-0SfkvOho.js → volume-2-BZju_bOP.js} +1 -1
- package/apps/web/dist/index.html +11 -11
- package/apps/web/dist/mcp/flow.html +51 -51
- package/node_modules/@engenty-wizards/plugin-sdk/dist/index.d.ts +82 -7
- package/node_modules/@engenty-wizards/plugin-sdk/dist/studio.d.ts +58 -4
- package/node_modules/@engenty-wizards/shared/dist/assistant.d.ts +113 -0
- package/node_modules/@engenty-wizards/shared/dist/assistant.js +55 -0
- package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +56 -1
- package/node_modules/@engenty-wizards/shared/dist/definition.js +94 -4
- package/node_modules/@engenty-wizards/shared/dist/run.d.ts +3 -1
- package/package.json +1 -1
- package/apps/web/dist/assets/ChatView-Dm764bYy.js +0 -10
- package/apps/web/dist/assets/EditorPage-BG_Ue2iC.js +0 -3
- package/apps/web/dist/assets/HomePage-BXSg5P5k.js +0 -1
- package/apps/web/dist/assets/Marketplace-BWhUJ4UX.js +0 -2
- package/apps/web/dist/assets/ProjectPage-D6Fy7uTV.js +0 -2
- package/apps/web/dist/assets/PublicRunner-ChgJs0C9.js +0 -1
- package/apps/web/dist/assets/RunDrawer-CvIKLphz.js +0 -4
- package/apps/web/dist/assets/RunnerView-Bmayop7s.js +0 -2
- package/apps/web/dist/assets/SettingsPage-QkwtRFoD.js +0 -1
- package/apps/web/dist/assets/arrow-right-Dpp_mpHe.js +0 -1
- package/apps/web/dist/assets/changelog-Du2gWzlN.js +0 -1
- package/apps/web/dist/assets/index-Cz6c1S5g.js +0 -78
- package/apps/web/dist/assets/index-DKHClEy3.css +0 -1
- package/apps/web/dist/assets/ui-D92EkdEB.js +0 -9
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/qr-scanner.min-C_UI0gH-.js","assets/preload-helper-CNEI7N0N.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
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,B as a,C as o,G as s,I as c,J as l,L as u,M as d,P as f,R as p,S as m,Y as h,_ as g,c as _,d as v,f as y,g as b,i as x,j as S,l as C,m as w,n as T,o as E,p as D,q as O,s as k,t as A,u as j,z as ee}from"./ui-GsuU9WTj.js";import{t as M}from"./arrow-right-F7X_SjK9.js";import{n as N,r as P,t as F}from"./sparkles-DWGJluyV.js";import{t as I}from"./external-link-Dfc1VFvS.js";import{a as L,i as te,n as ne,r as re}from"./volume-2-BZju_bOP.js";import{n as R,t as z}from"./trash-D9UB6TtS.js";import{C as B,O as V,S as ie,b as ae,g as oe,h as se,v as ce,w as le}from"./definition-CHacJYmI.js";import{t as ue}from"./refresh-cw-BUDPOT39.js";import{A as de,C as H,D as fe,E as pe,J as me,N as he,O as ge,P as U,T as _e,j as ve,k as ye,v as be,w as xe,x as Se}from"./index-CX_yxZVQ.js";var Ce={name:`arrow-down`,size:24,node:[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]};Ce.node;var we=h(Ce),Te={name:`bell-ring`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]};Te.node;var Ee=h(Te),De={name:`bell`,size:24,node:[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]};De.node;var Oe=h(De),ke={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};ke.node;var Ae=h(ke),je={name:`corner-down-left`,size:24,node:[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]};je.node;var Me=h(je),Ne={name:`eraser`,size:24,node:[[`path`,{d:`M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21`,key:`g5wo59`}],[`path`,{d:`m5.082 11.09 8.828 8.828`,key:`1wx5vj`}]]};Ne.node;var Pe=h(Ne),Fe={name:`file-headphone`,size:24,node:[[`path`,{d:`M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343`,key:`1vfytu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0`,key:`1etmh7`}]],aliases:[`file-audio`,`file-audio-2`]};Fe.node;var Ie=h(Fe),Le={name:`film`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M7 3v18`,key:`bbkbws`}],[`path`,{d:`M3 7.5h4`,key:`zfgn84`}],[`path`,{d:`M3 12h18`,key:`1i2n21`}],[`path`,{d:`M3 16.5h4`,key:`1230mu`}],[`path`,{d:`M17 3v18`,key:`in4fa5`}],[`path`,{d:`M17 7.5h4`,key:`myr1c1`}],[`path`,{d:`M17 16.5h4`,key:`go4c1d`}]]};Le.node;var Re=h(Le),ze={name:`flashlight-off`,size:24,node:[[`path`,{d:`M11.652 6H18`,key:`voqkpr`}],[`path`,{d:`M12 13v1`,key:`176q98`}],[`path`,{d:`M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-8a4 4 0 0 0-.8-2.4l-.6-.8A3 3 0 0 1 6 7V6`,key:`dzyf92`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M7.649 2H17a1 1 0 0 1 1 1v4a3 3 0 0 1-.6 1.8l-.6.8a4 4 0 0 0-.55 1.007`,key:`1hvcfn`}]]};ze.node;var Be=h(ze),Ve={name:`flashlight`,size:24,node:[[`path`,{d:`M12 13v1`,key:`176q98`}],[`path`,{d:`M17 2a1 1 0 0 1 1 1v4a3 3 0 0 1-.6 1.8l-.6.8A4 4 0 0 0 16 12v8a2 2 0 0 1-2 2H10a2 2 0 0 1-2-2v-8a4 4 0 0 0-.8-2.4l-.6-.8A3 3 0 0 1 6 7V3a1 1 0 0 1 1-1z`,key:`17vh7j`}],[`path`,{d:`M6 6h12`,key:`n6hhss`}]]};Ve.node;var He=h(Ve),Ue={name:`grip-vertical`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]};Ue.node;var We=h(Ue),Ge={name:`image-plus`,size:24,node:[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};Ge.node;var Ke=h(Ge),qe={name:`image-up`,size:24,node:[[`path`,{d:`M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21`,key:`9csbqa`}],[`path`,{d:`m14 19.5 3-3 3 3`,key:`9vmjn0`}],[`path`,{d:`M17 22v-5.5`,key:`1aa6fl`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};qe.node;var Je=h(qe),Ye={name:`locate-fixed`,size:24,node:[[`line`,{x1:`2`,x2:`5`,y1:`12`,y2:`12`,key:`bvdh0s`}],[`line`,{x1:`19`,x2:`22`,y1:`12`,y2:`12`,key:`1tbv5k`}],[`line`,{x1:`12`,x2:`12`,y1:`2`,y2:`5`,key:`11lu5j`}],[`line`,{x1:`12`,x2:`12`,y1:`19`,y2:`22`,key:`x3vr5v`}],[`circle`,{cx:`12`,cy:`12`,r:`7`,key:`fim9np`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};Ye.node;var Xe=h(Ye),Ze={name:`lock-keyhole`,size:24,node:[[`circle`,{cx:`12`,cy:`16`,r:`1`,key:`1au0dj`}],[`rect`,{x:`3`,y:`10`,width:`18`,height:`12`,rx:`2`,key:`6s8ecr`}],[`path`,{d:`M7 10V7a5 5 0 0 1 10 0v3`,key:`1pqi11`}]]};Ze.node;var Qe=h(Ze),$e={name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]};$e.node;var et=h($e),tt={name:`map-pin`,size:24,node:[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]};tt.node;var nt=h(tt),rt={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};rt.node;var it=h(rt),at={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};at.node;var ot=h(at),st={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};st.node;var W=h(st),ct={name:`scan-line`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]};ct.node;var lt=h(ct),ut={name:`share-2`,size:24,node:[[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}],[`circle`,{cx:`6`,cy:`12`,r:`3`,key:`w7nqdw`}],[`circle`,{cx:`18`,cy:`19`,r:`3`,key:`1xt0gg`}],[`line`,{x1:`8.59`,x2:`15.42`,y1:`13.51`,y2:`17.49`,key:`47mynk`}],[`line`,{x1:`15.41`,x2:`8.59`,y1:`6.51`,y2:`10.49`,key:`1n3mei`}]]};ut.node;var dt=h(ut),ft={name:`shield-check`,size:24,node:[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]};ft.node;var pt=h(ft),mt={name:`switch-camera`,size:24,node:[[`path`,{d:`M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5`,key:`mtk2lu`}],[`path`,{d:`M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5`,key:`120jsl`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m18 22-3-3 3-3`,key:`kgdoj7`}],[`path`,{d:`m6 2 3 3-3 3`,key:`1fnbkv`}]]};mt.node;var ht=h(mt),gt={name:`triangle-alert`,size:24,node:[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]],aliases:[`alert-triangle`]};gt.node;var _t=h(gt),vt={name:`unplug`,size:24,node:[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]};vt.node;var yt=h(vt),G=36e5,K=6e4,bt=1e3;function xt(e){return e.fractionDigits===void 0?e.style===`integer`?0:2:e.fractionDigits}function St(e,t,n=`en`){if(typeof e!=`number`||!Number.isFinite(e))return``;let r=xt(t),i=t.grouping!==!1;return t.style===`percent`?new Intl.NumberFormat(n,{maximumFractionDigits:r,minimumFractionDigits:r,style:`percent`,useGrouping:i}).format(e):t.style===`currency`&&t.currency?new Intl.NumberFormat(n,{currency:t.currency,maximumFractionDigits:r,minimumFractionDigits:r,style:`currency`,useGrouping:i}).format(e):new Intl.NumberFormat(n,{maximumFractionDigits:r,minimumFractionDigits:r,useGrouping:i}).format(e)}function Ct(e,t,n=`en`){if(typeof e!=`string`||e.length===0)return``;if(t.kind===`time`)return wt(e,t.timePrecision??`minutes`);if(t.dateStyle===`iso`)return t.kind===`date`?e.slice(0,10):e;let r=t.kind===`date`?new Date(`${e}T00:00:00`):new Date(e);if(Number.isNaN(r.getTime()))return e;let i=t.dateStyle??`medium`;if(t.kind===`date`)return new Intl.DateTimeFormat(n,{dateStyle:i}).format(r);let a=t.timePrecision??`minutes`;return new Intl.DateTimeFormat(n,{dateStyle:i,timeStyle:a===`hours`?`short`:`medium`}).format(r)}function wt(e,t){let[n=`0`,r=`00`,i=`00`]=e.split(`:`);return t===`hours`?`${n.padStart(2,`0`)}:00`:t===`minutes`?`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}`:`${n.padStart(2,`0`)}:${r.padStart(2,`0`)}:${i.padStart(2,`0`)}`}function Tt(e,t){if(typeof e!=`number`||!Number.isFinite(e))return``;let n=Math.max(0,Math.round(e));if(t.display===`iso`)return Et(n);if(t.display===`minutes`)return`${Math.round(n/K)} min`;if(t.display===`hours`)return`${(n/G).toFixed(2)} h`;if(t.display===`decimal-hours`)return(n/G).toFixed(2);let r=Math.floor(n/G),i=Math.floor(n%G/K),a=Math.floor(n%K/bt);return`${r}:${String(i).padStart(2,`0`)}:${String(a).padStart(2,`0`)}`}function Et(e){let t=Math.floor(e/G),n=Math.floor(e%G/K),r=Math.floor(e%K/bt);return`${t>=24?`P${Math.floor(t/24)}D`:`P`}T${t%24}H${n}M${r}S`}function q(e,t,n=`en`){if(t==null)return``;switch(e.type){case`number`:return St(t,e.format,n);case`date`:return Ct(t,e.format,n);case`duration`:return Tt(t,e.format);case`boolean`:return t===!0?`true`:t===!1?`false`:``;case`select`:return Dt(e,t);default:return String(t)}}function Dt(e,t){let n=Array.isArray(t)?t:[t],r=e.format.options.reduce((e,t)=>(e[t.id]=t.label,e),{});return n.filter(e=>typeof e==`string`&&e.length>0).map(e=>r[e]??e).join(`, `)}var J=e(t(),1),Y=e(n(),1);function Ot(e,t){let n=encodeURIComponent(e),r=encodeURIComponent(t);return[{id:`mail`,label:f(`shareRun.email`),href:`mailto:?subject=${r}&body=${r}%0A%0A${n}`},{id:`x`,label:`X`,href:`https://x.com/intent/post?text=${r}&url=${n}`},{id:`linkedin`,label:`LinkedIn`,href:`https://www.linkedin.com/sharing/share-offsite/?url=${n}`},{id:`whatsapp`,label:`WhatsApp`,href:`https://wa.me/?text=${r}%20${n}`},{id:`facebook`,label:`Facebook`,href:`https://www.facebook.com/sharer/sharer.php?u=${n}`}]}var kt={x:`𝕏`,linkedin:`in`,whatsapp:`WA`,facebook:`f`};function At({runId:e,title:t,initial:n}){let[r,i]=(0,J.useState)(!1),[a,c]=(0,J.useState)(n),[l,u]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(null),_=async()=>{if(i(!0),!a){u(!0),g(null);try{c(await o.post(`/api/runs/${e}/share`))}catch(e){g(e.message)}finally{u(!1)}}},v=async()=>{await o.del(`/api/runs/${e}/share`),c(null),i(!1)},b=()=>{a&&(navigator.clipboard.writeText(a.url),m(!0),setTimeout(()=>m(!1),1500))},S=U(`share`)||typeof navigator<`u`&&`share`in navigator,C=a?.expiresAt?new Intl.DateTimeFormat(d,{dateStyle:`long`}).format(new Date(a.expiresAt)):null;return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(A,{variant:`secondary`,onClick:()=>void _(),children:[(0,Y.jsx)(dt,{className:`size-4`}),` `,f(`shareRun.button`)]}),(0,Y.jsx)(x,{open:r,onClose:()=>i(!1),title:f(`shareRun.title`),children:l?(0,Y.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,Y.jsx)(y,{})}):h?(0,Y.jsx)(`p`,{className:`rounded-lg bg-rose-tint px-3 py-2 text-[0.875rem] text-rose`,children:h}):a?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-paper-2 p-1.5 pl-3`,children:[(0,Y.jsx)(R,{className:`size-4 shrink-0 text-ink-3`}),(0,Y.jsx)(`input`,{readOnly:!0,value:a.url,onFocus:e=>e.target.select(),"aria-label":f(`share.link`),className:`min-w-0 flex-1 bg-transparent text-[0.875rem] outline-none coarse:h-11`}),(0,Y.jsxs)(A,{size:`sm`,onClick:b,children:[p?(0,Y.jsx)(s,{className:`size-3.5`}):(0,Y.jsx)(P,{className:`size-3.5`}),f(p?`share.copied`:`share.copy`)]})]}),(0,Y.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 sm:grid-cols-6`,children:[Ot(a.url,t).map(e=>(0,Y.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noreferrer`,className:`flex flex-col items-center gap-1.5 text-[0.75rem] text-ink-2 hover:text-ink`,children:[(0,Y.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-full bg-paper-2 font-semibold text-[0.9375rem] transition hover:bg-paper-3`,children:e.id===`mail`?(0,Y.jsx)(et,{className:`size-5`}):kt[e.id]}),e.label]},e.id)),S?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>void(U(`share`)?he(`share`,{link:a.url,title:t}):navigator.share({title:t,url:a.url})).catch(()=>void 0),className:`flex flex-col items-center gap-1.5 text-[0.75rem] text-ink-2 hover:text-ink`,children:[(0,Y.jsx)(`span`,{className:`inline-flex size-12 items-center justify-center rounded-full bg-paper-2 transition hover:bg-paper-3`,children:(0,Y.jsx)(dt,{className:`size-5`})}),f(`shareRun.more`)]}):null]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-[0.8125rem] text-ink-3`,children:[(0,Y.jsx)(`span`,{children:C?f(`shareRun.until`,{date:C}):f(`shareRun.kept`)}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void v(),className:`shrink-0 hover:text-rose coarse:min-h-11`,children:f(`shareRun.withdraw`)})]})]}):null})]})}var jt=250;function Mt({runId:e,driving:t,caption:n,action:r,hint:a,className:s,onBroken:c}){let l=(0,J.useRef)(null),u=(0,J.useRef)(null),[d,p]=(0,J.useState)(``),[m,h]=(0,J.useState)(!1),[_,v]=(0,J.useState)(null),y=async t=>{v(null);try{await o.post(`/api/runs/${e}/browser/act`,t)}catch(e){v(e.message)}};return(0,J.useEffect)(()=>{t&&u.current?.scrollIntoView({block:`nearest`,behavior:`smooth`})},[t]),(0,J.useEffect)(()=>{let n=l.current;if(!(n&&t))return;let r=0,i=null,a=t=>{t.preventDefault(),r+=t.deltaY,i??=setTimeout(()=>{i=null;let t=Math.max(-2e3,Math.min(2e3,Math.round(r)));r=0,t&&o.post(`/api/runs/${e}/browser/act`,{type:`scroll`,dy:t}).catch(()=>void 0)},jt)};return n.addEventListener(`wheel`,a,{passive:!1}),()=>{n.removeEventListener(`wheel`,a),i&&clearTimeout(i)}},[t,e]),(0,Y.jsxs)(`div`,{className:s,children:[(0,Y.jsxs)(`div`,{className:g(`relative aspect-[1280/900] w-full overflow-hidden rounded-xl bg-paper-2 ring-1`,t?`ring-2 ring-ember`:`ring-border-soft`),children:[(0,Y.jsx)(`img`,{ref:l,src:i(`/api/runs/${e}/browser/live`),alt:``,draggable:!1,onClick:e=>{if(!t)return;let n=e.currentTarget.getBoundingClientRect();y({type:`click`,fx:Math.min(1,Math.max(0,(e.clientX-n.left)/n.width)),fy:Math.min(1,Math.max(0,(e.clientY-n.top)/n.height))})},onError:c,className:g(`size-full object-cover object-top`,t&&`cursor-pointer`)}),r?(0,Y.jsx)(`div`,{className:`absolute top-2 right-2`,children:r}):null,n&&!t?(0,Y.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 flex items-center gap-1.5 bg-gradient-to-t from-black/75 to-transparent px-3 pt-8 pb-2 text-[0.8125rem] text-white`,children:[(0,Y.jsx)(te,{className:`size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`truncate`,children:n})]}):null]}),t?(0,Y.jsxs)(`div`,{ref:u,className:`mt-1.5`,children:[a?(0,Y.jsx)(`p`,{className:`mb-1.5 text-[0.8125rem] text-ink-3`,children:a}):null,(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 rounded-xl bg-card p-2 ring-1 ring-border-soft`,children:[(0,Y.jsx)(k,{type:m?`password`:`text`,autoComplete:`off`,value:d,placeholder:f(`ask.typeInto`),onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),y({type:`type`,text:d}).then(()=>p(``)))},autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:`send`,className:`h-9 min-w-[9rem] flex-1 basis-full text-[0.8125rem] sm:basis-0 coarse:h-11`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),className:g(`h-9 shrink-0 rounded-md px-2.5 text-[0.75rem] coarse:h-11 coarse:px-3.5`,m?`bg-ember-veil text-ink`:`text-ink-3 hover:bg-paper-2`),children:f(`ask.hide`)}),(0,Y.jsx)(Nt,{label:`Enter`,onClick:()=>void y({type:`key`,key:`Enter`}),children:(0,Y.jsx)(Me,{className:`size-4`})}),(0,Y.jsx)(Nt,{label:f(`ask.up`),onClick:()=>void y({type:`scroll`,dy:-500}),children:(0,Y.jsx)(O,{className:`size-4`})}),(0,Y.jsx)(Nt,{label:f(`ask.down`),onClick:()=>void y({type:`scroll`,dy:500}),children:(0,Y.jsx)(we,{className:`size-4`})})]}),_?(0,Y.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:_}):null]}):null]})}function Nt({label:e,onClick:t,children:n}){return(0,Y.jsx)(`button`,{type:`button`,"aria-label":e,title:e,onClick:t,className:`flex size-9 shrink-0 items-center justify-center rounded-md text-ink-3 hover:bg-paper-2 hover:text-ink coarse:size-11`,children:n})}function Pt({runId:e,ask:t}){return t.kind===`confirm`?(0,Y.jsx)(Ft,{runId:e,ask:t}):(0,Y.jsx)(It,{runId:e,ask:t})}function Ft({runId:e,ask:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),l=async n=>{a(!0),c(null);try{await o.post(`/api/runs/${e}/ask/${t.id}`,n)}catch(e){c(e.message),a(!1)}},u=t.action.destructive?_t:N;return(0,Y.jsxs)(`div`,{className:`animate-rise`,children:[(0,Y.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,Y.jsx)(`div`,{className:g(`flex size-10 shrink-0 items-center justify-center rounded-full`,t.action.destructive?`bg-rose-tint text-rose`:`bg-ember-tint text-ember-strong`),children:(0,Y.jsx)(u,{className:`size-5`})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:f(`ask.wants`,{service:t.service})}),(0,Y.jsx)(`h2`,{className:`font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason})]})]}),(0,Y.jsx)(`pre`,{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-paper-2 p-4 text-[0.8125rem] leading-relaxed ring-1 ring-border-soft`,children:t.input}),(0,Y.jsxs)(`div`,{className:`mt-5 flex items-center gap-4`,children:[(0,Y.jsx)(w,{checked:n,onChange:r,label:f(`ask.allowRest`)}),(0,Y.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:f(`ask.allowRest`)})]}),s?(0,Y.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:s}):null,(0,Y.jsxs)(`div`,{className:`action-bar mt-6 flex items-center justify-between gap-3`,children:[(0,Y.jsx)(A,{variant:`ghost`,disabled:i,onClick:()=>void l({type:`skip`}),children:f(`ask.deny`)}),(0,Y.jsx)(A,{busy:i,onClick:()=>void l({type:`done`,remember:n}),children:f(`ask.allow`)})]})]})}function It({runId:e,ask:t}){let[n,r]=(0,J.useState)({}),[i,a]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),d=async n=>{c(!0),u(null);try{await o.post(`/api/runs/${e}/ask/${t.id}`,n)}catch(e){u(e.message),c(!1)}},p=t.fields.some(e=>n[e.id]);return(0,Y.jsxs)(`div`,{className:`animate-rise`,children:[(0,Y.jsxs)(`div`,{className:`mb-5 flex items-start gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-ember-tint text-ember-strong`,children:(0,Y.jsx)(Qe,{className:`size-5`})}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`h2`,{className:`font-display font-semibold text-[1.25rem] leading-snug tracking-tight`,children:t.reason}),(0,Y.jsxs)(`p`,{className:`mt-0.5 truncate text-[0.8125rem] text-ink-3`,children:[t.site.host,t.site.title?` · ${t.site.title}`:``]})]})]}),(0,Y.jsx)(Mt,{runId:e,driving:!0}),(0,Y.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-4`,children:f(`ask.pictureHint`)}),t.fields.length?(0,Y.jsxs)(`form`,{className:`mt-5 flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),d({type:`fill`,values:n,remember:i})},children:[t.fields.map((e,i)=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(_,{children:e.label}),(0,Y.jsx)(k,{autoFocus:i===0,type:e.secret?`password`:`text`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,enterKeyHint:i===t.fields.length-1?`go`:`next`,value:n[e.id]??``,onChange:t=>r(n=>({...n,[e.id]:t.target.value}))})]},e.id)),(0,Y.jsx)(`button`,{type:`submit`,hidden:!0})]}):null,(0,Y.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-4`,children:[(0,Y.jsx)(w,{checked:i,onChange:a,label:f(`ask.remember`)}),(0,Y.jsx)(`span`,{className:`flex-1 text-[0.8125rem] text-ink-2`,children:f(`ask.remember`)})]}),(0,Y.jsxs)(`p`,{className:`mt-3 flex items-start gap-2 text-[0.8125rem] text-ink-3`,children:[(0,Y.jsx)(pt,{className:`mt-0.5 size-4 shrink-0 text-moss`}),` `,f(`ask.private`)]}),l?(0,Y.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:l}):null,(0,Y.jsxs)(`div`,{className:`action-bar mt-6 flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsx)(A,{variant:`ghost`,disabled:s,onClick:()=>void d({type:`skip`}),children:f(`ask.skip`)}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[t.fields.length?(0,Y.jsx)(A,{variant:`secondary`,disabled:s,onClick:()=>void d({type:`done`,remember:i}),children:f(`ask.done`)}):null,t.fields.length?(0,Y.jsx)(A,{busy:s,disabled:!p,onClick:()=>void d({type:`fill`,values:n,remember:i}),children:f(`ask.signIn`)}):(0,Y.jsx)(A,{busy:s,onClick:()=>void d({type:`done`,remember:i}),children:f(`ask.done`)})]})]})]})}async function Lt(e,t=2400){if(!/^image\/(jpeg|png|webp)$/.test(e.type)||e.size<12e5)return e;try{let n=await createImageBitmap(e),r=Math.min(1,t/Math.max(n.width,n.height)),i=document.createElement(`canvas`);i.width=Math.round(n.width*r),i.height=Math.round(n.height*r),i.getContext(`2d`)?.drawImage(n,0,0,i.width,i.height);let a=await new Promise(e=>i.toBlob(e,`image/jpeg`,.86));return a&&a.size<e.size?new File([a],`${e.name.replace(/\.[^.]+$/,``)}.jpg`,{type:`image/jpeg`}):e}catch{return e}}function Rt(){return new Date().toISOString().slice(0,19).replace(/[:T]/g,`-`)}function zt(e){let t=e?.name;return t===`NotFoundError`||t===`OverconstrainedError`?`missing`:t===`NotReadableError`||t===`AbortError`?`busy`:`denied`}function Bt(e){return!!e?.getCapabilities?.()?.torch}function Vt(e,t,n=!1){let r=(0,J.useRef)(null),[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(1),[u,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!e)return;let r=null,i=!1;s(null),a(null),d(!1),p(!1);let o={facingMode:{ideal:t},width:{ideal:2560},height:{ideal:1440}};return(async()=>{if(!navigator.mediaDevices?.getUserMedia)throw new DOMException(`no camera api`,`NotAllowedError`);try{r=await navigator.mediaDevices.getUserMedia({video:o,audio:n})}catch(e){if(!n)throw e;r=await navigator.mediaDevices.getUserMedia({video:o})}if(i){for(let e of r.getTracks())e.stop();return}a(r);let e=r.getVideoTracks()[0],t=()=>!i&&d(Bt(e));t(),setTimeout(t,600);let s=await navigator.mediaDevices.enumerateDevices().catch(()=>[]);i||l(s.filter(e=>e.kind===`videoinput`).length)})().catch(e=>!i&&s(zt(e))),()=>{i=!0;for(let e of r?.getTracks()??[])e.stop()}},[e,t,n]),(0,J.useEffect)(()=>{r.current&&i&&(r.current.srcObject=i)},[i]),{video:r,stream:i,error:o,cameras:c,torchable:u,torch:f,setTorch:async e=>{let t=i?.getVideoTracks()[0];try{await t?.applyConstraints({advanced:[{torch:e}]}),p(e)}catch{d(!1)}},mirrored:i?.getVideoTracks()[0]?.getSettings().facingMode===`user`}}function Ht({open:e,onClose:t,label:n,children:r}){let i=(0,J.useRef)(null);return(0,J.useEffect)(()=>{let t=i.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,Y.jsx)(`dialog`,{ref:i,onClose:t,"aria-label":n,className:`media-sheet`,children:e?(0,Y.jsx)(`div`,{className:`flex h-full flex-col`,children:r}):null})}function Ut({label:e,onClick:t,active:n,children:r}){return(0,Y.jsx)(`button`,{type:`button`,"aria-label":e,title:e,"aria-pressed":n,onClick:t,className:g(`flex size-11 shrink-0 items-center justify-center rounded-full transition`,n?`bg-white text-black`:`bg-white/12 text-white hover:bg-white/20`),children:r})}function Wt({title:e,onClose:t,camera:n,onFlip:r}){return(0,Y.jsx)(`div`,{className:`safe-top`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2`,children:[(0,Y.jsx)(Ut,{label:f(`common.close`),onClick:t,children:(0,Y.jsx)(c,{className:`size-5`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-center font-medium text-[0.9375rem]`,children:e}),n.torchable?(0,Y.jsx)(Ut,{label:f(`camera.torch`),active:n.torch,onClick:()=>void n.setTorch(!n.torch),children:n.torch?(0,Y.jsx)(He,{className:`size-5`}):(0,Y.jsx)(Be,{className:`size-5`})}):null,n.stream&&(n.cameras>1||pe)?(0,Y.jsx)(Ut,{label:f(`camera.flip`),onClick:r,children:(0,Y.jsx)(ht,{className:`size-5`})}):(0,Y.jsx)(`span`,{className:`size-11`})]})})}function Gt({camera:e,asking:t,children:n,actions:r}){return(0,Y.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[(0,Y.jsx)(`video`,{ref:e.video,autoPlay:!0,playsInline:!0,muted:!0,className:g(`absolute inset-0 size-full object-contain`,e.mirrored&&`-scale-x-100`)}),e.error?(0,Y.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-5 bg-black px-8 text-center`,children:[(0,Y.jsx)(`p`,{className:`max-w-sm text-[0.9375rem] text-white/85 leading-relaxed`,children:f(`camera.${e.error}`)}),r]}):e.stream?n:(0,Y.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-4 px-8 text-center text-white/75`,children:[(0,Y.jsx)(y,{}),(0,Y.jsx)(`p`,{className:`max-w-xs text-[0.875rem] leading-relaxed`,children:t})]})]})}var Kt=30;function qt(){if(typeof MediaRecorder<`u`)return[`video/mp4;codecs=avc1.42E01E,mp4a.40.2`,`video/mp4`,`video/webm;codecs=vp9,opus`,`video/webm;codecs=vp8,opus`,`video/webm`].find(e=>MediaRecorder.isTypeSupported(e))}var Jt=!!qt();function Yt({open:e,multiple:t,video:n,onClose:r,onCapture:i,onNative:a}){let[o,c]=(0,J.useState)(`environment`),[l,u]=(0,J.useState)(`photo`),[d,p]=(0,J.useState)(0),[m,h]=(0,J.useState)(!1),[_,v]=(0,J.useState)(null),b=(0,J.useRef)(null),x=Vt(e,o,l===`video`);(0,J.useEffect)(()=>{e&&(p(0),u(`photo`),v(null))},[e]);let S=async e=>{h(!0);try{await i(e),p(e=>e+1),t||r()}finally{h(!1)}},C=async()=>{let e=x.video.current;if(!e?.videoWidth)return;let t=document.createElement(`canvas`);t.width=e.videoWidth,t.height=e.videoHeight,t.getContext(`2d`)?.drawImage(e,0,0);let n=await new Promise(e=>t.toBlob(e,`image/jpeg`,.9));n&&await S(new File([n],`foto-${Rt()}.jpg`,{type:`image/jpeg`}))},w=()=>{b.current?.state===`recording`&&b.current.stop()},T=()=>{let e=qt();if(!x.stream||!e)return;let t=[],n=new MediaRecorder(x.stream,{mimeType:e,videoBitsPerSecond:25e5,audioBitsPerSecond:96e3});n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{v(null),b.current=null;let n=e.split(`;`)[0];if(t.length){let e=n===`video/mp4`?`mp4`:`webm`;S(new File(t,`video-${Rt()}.${e}`,{type:n}))}},b.current=n,n.start(1e3),v(0)};(0,J.useEffect)(()=>{if(_===null)return;if(_>=Kt){b.current?.state===`recording`&&b.current.stop();return}let e=setTimeout(()=>v(e=>e===null?null:e+1),1e3);return()=>clearTimeout(e)},[_]),(0,J.useEffect)(()=>{!e&&b.current&&(b.current.onstop=null,b.current.stop(),b.current=null)},[e]);let E=e=>`0:${String(e).padStart(2,`0`)}`;return(0,Y.jsxs)(Ht,{open:e,onClose:r,label:f(`camera.title`),children:[(0,Y.jsx)(Wt,{title:_===null?d?f(`camera.taken`,{n:d}):f(`camera.title`):`${E(_)} / ${E(Kt)}`,onClose:r,camera:x,onFlip:()=>c(e=>e===`environment`?`user`:`environment`)}),(0,Y.jsx)(Gt,{camera:x,asking:f(`camera.asking`),actions:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a?(0,Y.jsxs)(X,{onClick:()=>{r(),a()},children:[(0,Y.jsx)(Ae,{className:`size-4`}),` `,f(pe?`camera.native`:`camera.pick`)]}):null,(0,Y.jsx)(X,{quiet:!0,onClick:r,children:f(`common.close`)})]})}),(0,Y.jsxs)(`div`,{className:g(`safe-bottom px-4 pt-3`,x.error&&`invisible`),children:[n&&Jt&&_===null?(0,Y.jsx)(`div`,{className:`mb-3 flex justify-center gap-1 text-[0.8125rem]`,children:[`photo`,`video`].map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":l===e,onClick:()=>u(e),className:g(`h-9 rounded-full px-4 font-medium transition`,l===e?`bg-white text-black`:`text-white/70 hover:text-white`),children:f(e===`photo`?`camera.photo`:`camera.video`)},e))}):null,(0,Y.jsxs)(`div`,{className:`grid grid-cols-[1fr_auto_1fr] items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-[0.8125rem] text-white/70 leading-snug`,children:_===null?l===`video`?f(`camera.clipHint`,{s:Kt}):f(t?`camera.hintMany`:`camera.hint`):f(`camera.recording`)}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":f(l===`photo`?`camera.shoot`:_===null?`camera.record`:`camera.stop`),disabled:!x.stream||m,onClick:()=>l===`photo`?void C():_===null?T():w(),className:`flex size-[72px] items-center justify-center rounded-full border-4 border-white transition active:scale-95 disabled:opacity-40`,children:m?(0,Y.jsx)(y,{className:`text-white`}):l===`photo`?(0,Y.jsx)(`span`,{className:`size-[54px] rounded-full bg-white`}):_===null?(0,Y.jsx)(`span`,{className:`flex size-[54px] items-center justify-center rounded-full bg-[#e5484d]`,children:(0,Y.jsx)(ne,{className:`size-6 text-white`})}):(0,Y.jsx)(`span`,{className:`size-7 rounded-md bg-[#e5484d]`})}),(0,Y.jsx)(`div`,{className:`flex justify-end`,children:t&&d&&_===null?(0,Y.jsxs)(X,{onClick:r,children:[(0,Y.jsx)(s,{className:`size-4`}),` `,f(`camera.done`)]}):null})]})]})]})}function X({onClick:e,quiet:t,children:n}){return(0,Y.jsx)(`button`,{type:`button`,onClick:e,className:g(`inline-flex h-11 items-center justify-center gap-2 rounded-full px-5 font-medium text-[0.875rem] transition`,t?`text-white/75 hover:text-white`:`bg-white text-black hover:bg-white/90`),children:n})}var Xt=25,Zt=9e3;function Qt(e){return e.code===e.PERMISSION_DENIED?`denied`:e.code===e.TIMEOUT?`timeout`:`unavailable`}function $t({value:e,runId:t,placeholder:n,onChange:r,onBusy:i}){let a=ce(e)?e:null,[s,l]=(0,J.useState)(!1),[u,p]=(0,J.useState)(null),m=(0,J.useRef)(null),h=(0,J.useRef)(!!a?.label),g=(0,J.useRef)(a);g.current=a;let _=a?.lat!==void 0&&a.lng!==void 0,v=typeof navigator<`u`&&`geolocation`in navigator,y=()=>{m.current!==null&&(navigator.geolocation.clearWatch(m.current),m.current=null),l(!1),i?.(!1)};(0,J.useEffect)(()=>()=>{m.current!==null&&navigator.geolocation.clearWatch(m.current)},[]);let b=async(e,n)=>{try{let{label:i}=await o.post(`/api/runs/${t}/geocode`,{lat:e,lng:n,language:d}),a=g.current;i&&!h.current&&a?.lat===e&&a.lng===n&&r({...a,label:i})}catch{}},x=()=>{p(null),l(!0),i?.(!0);let e=Date.now(),t=1/0;m.current=navigator.geolocation.watchPosition(n=>{let{latitude:i,longitude:a,accuracy:o}=n.coords;if(o<t){t=o;let e=Math.round(i*1e6)/1e6,n=Math.round(a*1e6)/1e6,s=h.current?g.current?.label:void 0,c={lat:e,lng:n,accuracy:Math.round(o),...s?{label:s}:{}};g.current=c,r(c)}if(t<=Xt||Date.now()-e>Zt){y();let e=g.current;e?.lat!==void 0&&e.lng!==void 0&&b(e.lat,e.lng)}},e=>{y(),t===1/0&&p(Qt(e))},{enableHighAccuracy:!0,timeout:15e3,maximumAge:1e4})},S=e=>{h.current=e.trim().length>0;let t={..._?a:{},label:e};r(_||e.trim()?t:void 0)};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[_?(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,Y.jsx)(`div`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,Y.jsx)(nt,{className:`size-5`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`truncate font-medium text-[0.9375rem] tabular-nums`,children:[a.lat?.toFixed(5),`, `,a.lng?.toFixed(5)]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 text-[0.8125rem] text-ink-3`,children:[(0,Y.jsx)(`span`,{children:s?f(`location.refining`):a.accuracy?f(`location.accuracy`,{m:a.accuracy}):null}),(0,Y.jsxs)(`a`,{href:`https://www.openstreetmap.org/?mlat=${a.lat}&mlon=${a.lng}#map=17/${a.lat}/${a.lng}`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 underline-offset-2 hover:text-ink hover:underline coarse:-my-3 coarse:min-h-11 coarse:min-w-11`,children:[f(`location.map`),` `,(0,Y.jsx)(I,{className:`size-3`})]})]})]}),(0,Y.jsx)(E,{label:f(`location.remove`),onClick:()=>{y(),h.current=!1,r(void 0)},children:(0,Y.jsx)(c,{className:`size-4`})})]}):v?(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(A,{variant:`secondary`,size:`lg`,busy:s,onClick:x,className:`w-full sm:w-auto`,children:[s?null:(0,Y.jsx)(Xe,{className:`size-4`}),f(s?`location.locating`:`location.use`)]}),u?(0,Y.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:f(`location.${u}`)}):(0,Y.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:f(`location.why`)})]}):null,(0,Y.jsx)(k,{value:a?.label??``,placeholder:n??f(_?`location.label`:`location.manual`),autoComplete:`street-address`,enterKeyHint:`done`,"aria-label":f(`location.manual`),onChange:e=>S(e.target.value)})]})}var en=null;function tn(){return en??=(async()=>{let e=window.BarcodeDetector;if(e)try{let t=await e.getSupportedFormats();if(t.includes(`qr_code`)){let n=new e({formats:t});return{qrOnly:!1,detect:async e=>(await n.detect(e))[0]?.rawValue||null}}}catch{}let{default:t}=await r(async()=>{let{default:e}=await import(`./qr-scanner.min-C_UI0gH-.js`);return{default:e}},__vite__mapDeps([0,1])),n=t.createQrEngine();return{qrOnly:!0,detect:async e=>{try{return(await t.scanImage(e,{qrEngine:n,returnDetailedScanResult:!0})).data||null}catch{return null}}}})(),en}function nn({open:e,onClose:t,onResult:n}){let r=(0,J.useRef)(n);r.current=n;let i=(0,J.useRef)(t);return i.current=t,(0,J.useEffect)(()=>{e&&he(`scan`).then(e=>{e&&r.current(e)}).catch(()=>void 0).finally(()=>i.current())},[e]),null}function rn(e){return U(`scan`)?(0,Y.jsx)(nn,{...e}):(0,Y.jsx)(an,{...e})}function an({open:e,onClose:t,onResult:n}){let[r,i]=(0,J.useState)(`environment`),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),l=(0,J.useRef)(null),u=Vt(e,r),d=(0,J.useRef)(n);d.current=n;let p=(0,J.useRef)(t);p.current=t,(0,J.useEffect)(()=>{e&&(c(!1),tn().then(e=>o(e.qrOnly)))},[e]),(0,J.useEffect)(()=>{if(!e||!u.stream)return;let t=!1,n,r=async()=>{let e=u.video.current;if(!t&&e&&e.readyState>=2&&e.videoWidth){let n=await(await tn()).detect(e).catch(()=>null);if(n&&!t){navigator.vibrate?.(60),d.current(n),p.current();return}}t||(n=setTimeout(r,200))};return r(),()=>{t=!0,clearTimeout(n)}},[e,u.stream,u.video]);let m=async e=>{if(!e)return;c(!1);let r=await createImageBitmap(e).catch(()=>null),i=r?await(await tn()).detect(r).catch(()=>null):null;i?(n(i),t()):c(!0)};return(0,Y.jsxs)(Ht,{open:e,onClose:t,label:f(`scan.title`),children:[(0,Y.jsx)(Wt,{title:f(`scan.title`),onClose:t,camera:u,onFlip:()=>i(e=>e===`environment`?`user`:`environment`)}),(0,Y.jsx)(Gt,{camera:u,asking:f(`scan.asking`),actions:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsxs)(X,{onClick:()=>l.current?.click(),children:[(0,Y.jsx)(Je,{className:`size-4`}),` `,f(`scan.fromPhoto`)]}),(0,Y.jsx)(X,{quiet:!0,onClick:t,children:f(`scan.typeInstead`)})]}),children:(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center`,children:(0,Y.jsx)(`div`,{className:`aspect-square w-[min(68%,320px)] rounded-3xl border-2 border-white/90 shadow-[0_0_0_100vmax_rgb(0_0_0/0.35)]`})})}),(0,Y.jsxs)(`div`,{className:`safe-bottom flex flex-col items-center gap-3 px-5 pt-3 text-center`,children:[(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-white/75 leading-snug`,children:f(s?`scan.miss`:a?`scan.hintQr`:`scan.hint`)}),u.stream?(0,Y.jsxs)(X,{quiet:!0,onClick:()=>l.current?.click(),children:[(0,Y.jsx)(Je,{className:`size-4`}),` `,f(`scan.fromPhoto`)]}):null]}),(0,Y.jsx)(`input`,{ref:l,type:`file`,hidden:!0,accept:`image/*`,onChange:e=>{m(e.target.files?.[0]),e.target.value=``}})]})}var on=`#1d1a17`,Z={width:1200,height:480};function sn(e,t,n,r,i){e.lineCap=`round`,e.lineJoin=`round`,e.strokeStyle=on,e.fillStyle=on,e.lineWidth=i;for(let a of t){if(a.length===1){e.beginPath(),e.arc(a[0].x*n,a[0].y*r,i/2,0,Math.PI*2),e.fill();continue}e.beginPath(),e.moveTo(a[0].x*n,a[0].y*r);for(let t=1;t<a.length-1;t++){let i=a[t],o=a[t+1];e.quadraticCurveTo(i.x*n,i.y*r,(i.x+o.x)/2*n,(i.y+o.y)/2*r)}let t=a[a.length-1];e.lineTo(t.x*n,t.y*r),e.stroke()}}function cn({strokes:e,onStrokes:t}){let n=(0,J.useRef)(null),r=(0,J.useRef)(null),i=(0,J.useRef)(e);i.current=e;let a=()=>{let e=n.current,t=e?.getContext(`2d`);if(!e||!t)return;let a=window.devicePixelRatio||1,o=Math.round(e.clientWidth*a),s=Math.round(e.clientHeight*a);(e.width!==o||e.height!==s)&&(e.width=o,e.height=s),t.clearRect(0,0,o,s),sn(t,r.current?[...i.current,r.current]:i.current,o,s,2.4*a)};(0,J.useEffect)(()=>{a();let e=n.current;if(!e)return;let t=new ResizeObserver(a);return t.observe(e),()=>t.disconnect()},[e]);let o=e=>{let t=e.currentTarget.getBoundingClientRect();return{x:Math.min(1,Math.max(0,(e.clientX-t.left)/t.width)),y:Math.min(1,Math.max(0,(e.clientY-t.top)/t.height))}};return(0,Y.jsxs)(`div`,{className:`relative overflow-hidden rounded-xl bg-white ring-1 ring-input`,children:[(0,Y.jsx)(`canvas`,{ref:n,"aria-label":f(`sign.pad`),className:`block aspect-[5/2] w-full cursor-crosshair touch-none select-none`,onPointerDown:e=>{e.currentTarget.setPointerCapture(e.pointerId),r.current=[o(e)],a()},onPointerMove:e=>{r.current&&(r.current.push(o(e)),a())},onPointerUp:()=>{if(r.current){let e=r.current;r.current=null,t([...i.current,e])}},onPointerCancel:()=>{r.current=null,a()}}),(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-x-6 bottom-[22%] border-[#1d1a17]/25 border-b`}),e.length?null:(0,Y.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center text-[#1d1a17]/40 text-[0.875rem]`,children:f(`sign.hint`)})]})}async function ln(e){let t=document.createElement(`canvas`);t.width=Z.width,t.height=Z.height;let n=t.getContext(`2d`);if(!n)return null;sn(n,e,Z.width,Z.height,7);let r=await new Promise(e=>t.toBlob(e,`image/png`));return r?new File([r],`unterschrift.png`,{type:`image/png`}):null}function un({label:e,value:t,runId:n,onChange:r}){let[a,s]=(0,J.useState)(!1),[l,u]=(0,J.useState)([]),[d,p]=(0,J.useState)(!1),[m,h]=(0,J.useState)(null),g=typeof t==`string`&&t?t:null,_=async()=>{p(!0),h(null);try{let e=await ln(l);if(!e)return;r((await o.upload(`/api/runs/${n}/uploads`,e)).id),s(!1)}catch(e){h(e.message)}finally{p(!1)}};return(0,Y.jsxs)(`div`,{children:[g?(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{u([]),s(!0)},className:`min-w-0 flex-1 rounded-lg bg-white px-3`,"aria-label":f(`sign.again`),children:(0,Y.jsx)(`img`,{src:i(`/api/runs/${n}/assets/${g}`),alt:e,className:`mx-auto h-20 object-contain`})}),(0,Y.jsx)(E,{label:f(`sign.remove`),onClick:()=>r(void 0),children:(0,Y.jsx)(c,{className:`size-4`})})]}):(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>{u([]),s(!0)},className:`flex w-full flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-4 py-7 text-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,children:[(0,Y.jsx)(re,{className:`size-6`}),f(`sign.open`)]}),(0,Y.jsxs)(x,{open:a,onClose:()=>s(!1),title:e,wide:!0,children:[(0,Y.jsx)(cn,{strokes:l,onStrokes:u}),m?(0,Y.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:m}):null,(0,Y.jsxs)(`div`,{className:`mt-5 flex items-center justify-between gap-3`,children:[(0,Y.jsxs)(A,{variant:`ghost`,disabled:!l.length||d,onClick:()=>u([]),children:[(0,Y.jsx)(Pe,{className:`size-4`}),` `,f(`sign.clear`)]}),(0,Y.jsx)(A,{busy:d,disabled:!l.length,onClick:()=>void _(),children:f(`sign.accept`)})]})]})]})}function dn({runId:e,connectionId:t,connector:n,onCancel:r}){let[i,a]=(0,J.useState)({}),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(null),d=async()=>{c(!0),u(null);try{await o.post(`/api/runs/${e}/connections/${t}/credentials/${n.id}`,{values:i})}catch(e){u(e.message)}finally{c(!1)}};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-xl bg-card p-4 ring-1 ring-input`,children:[(n.fields??[]).map(e=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(_,{children:e.label}),(0,Y.jsx)(k,{type:e.secret?`password`:`text`,autoComplete:`off`,value:i[e.key]??``,placeholder:e.placeholder,onChange:t=>a(n=>({...n,[e.key]:t.target.value})),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),d())}})]},e.key)),n.hint?(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:n.hint}):null,l?(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:l}):null,(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(A,{variant:`ghost`,size:`sm`,onClick:r,children:f(`common.cancel`)}),(0,Y.jsx)(A,{size:`sm`,busy:s,onClick:()=>void d(),children:f(`connect.go`)})]})]})}function fn({runId:e,connection:t}){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null),[c,l]=(0,J.useState)(null);if(!t)return null;if(t.account){let n=t.connectors.find(e=>e.id===t.account?.connector)?.name??``;return(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,Y.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-full bg-moss-tint text-moss`,children:(0,Y.jsx)(s,{className:`size-5`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`truncate font-medium text-[0.9375rem]`,children:t.account.label}),(0,Y.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:f(`connect.connected`,{name:n})})]}),(0,Y.jsx)(E,{label:f(`connect.disconnect`),onClick:()=>void o.del(`/api/runs/${e}/connections/${t.id}`),children:(0,Y.jsx)(yt,{className:`size-4`})})]})}let u=async n=>{if(l(null),a(null),U(`signIn`)){try{let{url:r}=await o.post(`/api/runs/${e}/connections/${t.id}/oauth/${n.id}`);await he(`signIn`,{url:r})}catch(e){l(e.message)}return}let r=window.open(`about:blank`,`wizard-connect`,`width=540,height=700`);try{let{url:i}=await o.post(`/api/runs/${e}/connections/${t.id}/oauth/${n.id}`);r?r.location.replace(i):a(i)}catch(e){r?.close(),l(e.message)}},d=t.connectors.find(e=>e.id===n);return t.connectors.length?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.connectors.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>e.auth===`oauth2`?void u(e):r(n===e.id?null:e.id),className:g(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[0.875rem] ring-1 transition`,n===e.id?`bg-ember-veil text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink hover:ring-ember`),children:[(0,Y.jsx)(R,{className:`size-4`}),` `,e.name]},e.id))}),d?(0,Y.jsx)(dn,{runId:e,connectionId:t.id,connector:d,onCancel:()=>r(null)}):null,i?(0,Y.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,className:`text-[0.875rem] text-ember underline`,children:f(`connect.openLink`)}):null,c?(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:c}):null]}):(0,Y.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:f(`connect.none`)})}function pn(e){return e==null?``:Array.isArray(e)?e.join(`, `):String(e)}function mn(e,t){if(t.trim()===``)return null;if(e.type===`number`){let e=Number(t.replace(/\s/g,``).replace(`,`,`.`));return Number.isFinite(e)?e:t}return e.type===`boolean`?t===`true`:t}function Q({column:e,value:t,boxed:n,onCommit:r}){let[i,a]=(0,J.useState)(pn(t));(0,J.useEffect)(()=>a(pn(t)),[t]);let o=g(`w-full min-w-0 rounded-md border border-transparent px-2 text-[0.8125rem] outline-none focus:border-ember focus:bg-card`,n?`h-11 bg-paper-2`:`h-9 bg-transparent hover:bg-paper-2 coarse:h-11`);return e.type===`boolean`?(0,Y.jsx)(`label`,{className:`flex size-9 cursor-pointer items-center justify-center coarse:size-11`,children:(0,Y.jsx)(`input`,{type:`checkbox`,"aria-label":e.name,checked:t===!0,onChange:e=>r(e.target.checked),className:`size-4 accent-[var(--ember)] coarse:size-6`})}):e.type===`select`&&!e.format.multiple&&!e.format.allowCustom?(0,Y.jsxs)(`select`,{value:i,onChange:e=>r(e.target.value||null),className:o,children:[(0,Y.jsx)(`option`,{value:``}),e.format.options.map(e=>(0,Y.jsx)(`option`,{value:e.id,children:e.label},e.id))]}):(0,Y.jsx)(`input`,{"aria-label":e.name,type:e.type===`date`&&e.format.kind===`date`?`date`:`text`,inputMode:e.type===`number`?`decimal`:void 0,enterKeyHint:`done`,autoComplete:`off`,value:i,onChange:e=>a(e.target.value),onBlur:()=>{i!==pn(t)&&r(mn(e,i))},onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.target.blur())},className:g(o,e.type===`number`&&`text-right tabular-nums`)})}function $({runId:e,list:t,editable:n}){let{def:r,rows:i}=t,[a,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({}),u=`/api/runs/${e}/lists/${r.id}/rows`,h=async e=>{s(null);try{await e()}catch(e){s(e instanceof m?e.message:String(e))}},_=()=>h(async()=>{await o.post(u,{cells:c}),l({})}),v=Object.values(c).some(e=>e!=null&&e!==``);if(!i.length&&!n)return(0,Y.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:f(`list.empty`)});let y=(e,t)=>t===0||e.type===`text`&&e.format?.style===`multiline`,b=(e,t,n)=>void h(()=>o.patch(`${u}/${e}`,{cells:{[t]:n}}));return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 sm:hidden`,children:[i.map(e=>(0,Y.jsxs)(`div`,{className:`rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((t,r)=>(0,Y.jsxs)(`div`,{className:g(`min-w-0`,y(t,r)&&`col-span-2`),children:[(0,Y.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:t.name}),n?(0,Y.jsx)(Q,{boxed:!0,column:t,value:e.cells[t.id],onCommit:n=>b(e.id,t.id,n)}):(0,Y.jsx)(`div`,{className:g(`break-words px-1 text-[0.875rem]`,t.type===`number`&&`tabular-nums`),children:q(t,e.cells[t.id],d)||`—`})]},t.id))}),n?(0,Y.jsx)(`div`,{className:`mt-1 flex justify-end`,children:(0,Y.jsx)(E,{label:f(`list.delete`),onClick:()=>void h(()=>o.del(`${u}/${e.id}`)),children:(0,Y.jsx)(z,{className:`size-4`})})}):null]},e.id)),n?(0,Y.jsxs)(`div`,{className:`rounded-lg border border-input border-dashed p-2`,children:[(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-x-2 gap-y-1.5`,children:r.columns.map((e,t)=>(0,Y.jsxs)(`div`,{className:g(`min-w-0`,y(e,t)&&`col-span-2`),children:[(0,Y.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,Y.jsx)(Q,{boxed:!0,column:e,value:c[e.id],onCommit:t=>l(n=>({...n,[e.id]:t}))})]},e.id))}),(0,Y.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,Y.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>v?void _():void 0,children:[(0,Y.jsx)(p,{className:`size-4`}),` `,f(`run.addRow`)]})})]}):null]}),(0,Y.jsx)(`div`,{className:`hidden overflow-x-auto rounded-lg ring-1 ring-border-soft sm:block`,children:(0,Y.jsxs)(`table`,{className:`w-full text-[0.8125rem]`,children:[(0,Y.jsx)(`thead`,{className:`bg-paper-2 text-ink-2`,children:(0,Y.jsxs)(`tr`,{children:[r.columns.map(e=>(0,Y.jsx)(`th`,{className:`whitespace-nowrap px-3 py-2 text-left font-medium`,children:e.name},e.id)),n?(0,Y.jsx)(`th`,{className:`w-10`}):null]})}),(0,Y.jsxs)(`tbody`,{children:[i.map(e=>(0,Y.jsxs)(`tr`,{className:`border-border-soft border-t align-top`,children:[r.columns.map(t=>(0,Y.jsx)(`td`,{className:g(`min-w-[7.5rem]`,n?`px-1 py-0.5`:`px-3 py-2`),children:n?(0,Y.jsx)(Q,{column:t,value:e.cells[t.id],onCommit:n=>b(e.id,t.id,n)}):(0,Y.jsx)(`span`,{className:g(t.type===`number`&&`tabular-nums`),children:q(t,e.cells[t.id],d)})},t.id)),n?(0,Y.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,Y.jsx)(E,{label:f(`list.delete`),className:`size-9`,onClick:()=>void h(()=>o.del(`${u}/${e.id}`)),children:(0,Y.jsx)(z,{className:`size-3.5`})})}):null]},e.id)),n?(0,Y.jsxs)(`tr`,{className:`border-border-soft border-t bg-paper`,children:[r.columns.map(e=>(0,Y.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,Y.jsx)(Q,{column:e,value:c[e.id],onCommit:t=>l(n=>({...n,[e.id]:t}))})},e.id)),(0,Y.jsx)(`td`,{className:`px-1 py-0.5`,children:(0,Y.jsx)(E,{label:f(`run.addRow`),className:`size-9`,onClick:()=>v?void _():void 0,children:(0,Y.jsx)(p,{className:`size-4`})})})]}):null]})]})}),a?(0,Y.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:a}):null]})}function hn(e,t,n){let r=t.split(`/`).map(encodeURIComponent).join(`/`);return i(`/api/runs/${e}/store/files/${r}${n?`?inline=1`:``}`)}var gn=[`bg-paper-3 text-ink-3`,`bg-moss-tint text-moss`,`bg-rose-tint text-rose`,`bg-ember-tint text-ember-strong`];function _n({runId:e,list:t}){let{def:n,rows:r}=t,i=n.columns.find(e=>e.id===n.check?.file),a=n.columns.find(e=>e.id===n.check?.status),c=a?.type===`select`?a.format.options:[],l=c[0]?.id,u=e=>a?String(e.cells[a.id]??l??``):``,p=e=>!a||u(e)===l,[h,_]=(0,J.useState)(()=>(r.find(p)??r[0])?.id??null),[v,y]=(0,J.useState)(!1),[b,x]=(0,J.useState)(null),S=`/api/runs/${e}/lists/${n.id}/rows`,C=r.find(e=>e.id===h)??r[0],w=v?r.filter(e=>p(e)||e.id===C?.id):r,T=r.filter(e=>!p(e)).length,E=n.columns.filter(e=>e!==i&&e!==a),D=E.filter(e=>e.id!==n.key),O=D.find(e=>e.type===`text`)??D[0],k=D.filter(e=>e!==O),j=async(e,t)=>{x(null);try{await o.patch(`${S}/${e}`,{cells:t})}catch(e){x(e instanceof m?e.message:String(e))}},ee=e=>{let t=w.findIndex(e=>e.id===C?.id),n=w[Math.min(w.length-1,Math.max(0,t+e))];n&&_(n.id)},M=async e=>{if(!C||!a)return;let t=r.findIndex(e=>e.id===C.id),n=[...r.slice(t+1),...r.slice(0,t)].find(p);await j(C.id,{[a.id]:e}),n&&e!==l&&_(n.id)},N=e=>{e.target.closest(`input, textarea, select`)||(e.key===`ArrowDown`||e.key===`ArrowUp`?(e.preventDefault(),ee(e.key===`ArrowDown`?1:-1)):/^[1-9]$/.test(e.key)&&c[Number(e.key)]&&(e.preventDefault(),M(c[Number(e.key)].id)))};if(!r.length)return(0,Y.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:f(`list.empty`)});let P=i&&C?String(C.cells[i.id]??``).trim():``,F=P.split(`.`).pop()?.toLowerCase()??``,I=e=>gn[Math.min(Math.max(0,c.findIndex(t=>t.id===u(e))),3)];return(0,Y.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-[minmax(280px,360px)_minmax(0,1fr)]`,onKeyDown:N,children:[(0,Y.jsxs)(`div`,{className:`flex min-h-0 flex-col`,children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 tabular-nums`,children:f(`check.progress`,{done:T,total:r.length})}),a?(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":v,onClick:()=>y(e=>!e),className:g(`inline-flex h-8 items-center rounded-full px-3 text-[0.8125rem] ring-1 transition coarse:h-11`,v?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:f(`check.onlyOpen`)}):null]}),(0,Y.jsx)(`ul`,{className:`flex max-h-[38vh] flex-col gap-1.5 overflow-y-auto p-0.5 pr-1 lg:max-h-[calc(100vh-15rem)]`,children:w.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>_(e.id),"aria-current":e.id===C?.id,className:g(`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left ring-1 transition`,e.id===C?.id?`bg-card shadow-soft ring-ember`:`bg-paper ring-border-soft hover:bg-card`),children:[(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate font-medium text-[0.875rem]`,children:O&&q(O,e.cells[O.id],d)||`—`}),(0,Y.jsx)(`span`,{className:`block truncate text-[0.75rem] text-ink-3 tabular-nums`,children:k.slice(0,2).map(t=>q(t,e.cells[t.id],d)).filter(Boolean).join(` · `)})]}),a?(0,Y.jsx)(`span`,{className:g(`shrink-0 rounded-full px-2 py-0.5 font-medium text-[0.6875rem]`,I(e)),children:c.find(t=>t.id===u(e))?.label??u(e)}):null]})},e.id))})]}),C?(0,Y.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:[c.length>1?(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c.slice(1).map((e,t)=>(0,Y.jsxs)(A,{size:`md`,variant:u(C)===e.id?`primary`:`secondary`,onClick:()=>void M(e.id),children:[u(C)===e.id?(0,Y.jsx)(s,{className:`size-4`}):null,e.label,(0,Y.jsx)(`kbd`,{className:`ml-1 hidden rounded bg-black/10 px-1.5 text-[0.6875rem] lg:inline`,children:t+1})]},e.id)),u(C)===l?null:(0,Y.jsx)(A,{size:`md`,variant:`ghost`,onClick:()=>void M(l??``),children:f(`check.reopen`)})]}):null,(0,Y.jsx)(`div`,{className:`overflow-hidden rounded-lg bg-paper-2 ring-1 ring-border-soft`,children:P?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 border-border-soft border-b bg-card px-3 py-2 text-[0.8125rem]`,children:[(0,Y.jsx)(L,{className:`size-3.5 shrink-0 text-ink-3`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:P.split(`/`).pop()}),(0,Y.jsx)(`a`,{href:hn(e,P,F===`pdf`),target:`_blank`,rel:`noreferrer`,className:`shrink-0 text-ink-2 underline-offset-2 hover:text-ink hover:underline`,children:f(`run.openFull`)})]}),F===`pdf`?(0,Y.jsx)(`iframe`,{title:P,src:`${hn(e,P,!0)}#toolbar=0&navpanes=0&view=FitH`,className:`h-[46vh] w-full border-0 bg-white lg:h-[calc(100vh-27rem)] lg:min-h-[360px]`},P):[`png`,`jpg`,`jpeg`,`webp`].includes(F)?(0,Y.jsx)(`div`,{className:`flex max-h-[46vh] justify-center overflow-auto bg-white lg:max-h-[calc(100vh-27rem)]`,children:(0,Y.jsx)(`img`,{src:hn(e,P,!0),alt:P,className:`max-w-full object-contain`},P)}):(0,Y.jsx)(`p`,{className:`px-4 py-10 text-center text-[0.875rem] text-ink-3`,children:f(`check.noPreview`)})]}):(0,Y.jsx)(`p`,{className:`px-4 py-14 text-center text-[0.875rem] text-ink-3`,children:f(`check.noFile`)})}),(0,Y.jsx)(`div`,{className:`grid grid-cols-2 gap-x-3 gap-y-2 sm:grid-cols-3`,children:E.map(e=>(0,Y.jsxs)(`div`,{className:g(`min-w-0`,e.type===`text`&&e.format?.style===`multiline`&&`col-span-full`),children:[(0,Y.jsx)(`div`,{className:`px-1 pb-0.5 text-[0.6875rem] text-ink-3`,children:e.name}),(0,Y.jsx)(Q,{boxed:!0,column:e,value:C.cells[e.id],onCommit:t=>void j(C.id,{[e.id]:t})})]},e.id))}),b?(0,Y.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:b}):null]}):null]})}var vn={xlsx:`Excel`,csv:`CSV`,json:`JSON`,md:`Markdown`,zip:`ZIP`};function yn({runId:e,list:t}){return(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.formats.map(n=>(0,Y.jsx)(`a`,{href:i(`/api/runs/${e}/lists/${t.def.id}/download?format=${n}`),className:`inline-flex h-9 items-center rounded-full bg-paper-2 px-3.5 font-medium text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink coarse:h-11 coarse:px-4`,children:vn[n]??n},n))})}function bn(e){return e>1e6?`${(e/1e6).toFixed(1)} MB`:`${Math.max(1,Math.round(e/1e3))} KB`}function xn({runId:e}){let[t,n]=(0,J.useState)(!1),[r,a]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1);(0,J.useEffect)(()=>{t&&(l(!1),o.get(`/api/runs/${e}/store`).then(a))},[t,e]);let u=r&&!r.files.length&&!r.connections.length&&!r.keepsSignIns&&r.lists.every(e=>!e.rows);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-4 transition hover:text-ink-2 coarse:min-h-11`,children:[(0,Y.jsx)(me,{className:`size-3.5`}),` `,f(`store.open`)]}),(0,Y.jsx)(x,{open:t,onClose:()=>n(!1),title:f(`store.title`),wide:!0,children:r?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5 text-[0.875rem]`,children:[(0,Y.jsx)(`p`,{className:`text-ink-3`,children:f(`store.explain`)}),u?(0,Y.jsx)(`p`,{className:`text-ink-2`,children:f(`store.empty`)}):null,r.lists.some(e=>e.rows)?(0,Y.jsx)(`ul`,{className:`flex flex-col gap-1`,children:r.lists.filter(e=>e.rows).map(e=>(0,Y.jsxs)(`li`,{className:`flex justify-between gap-3`,children:[(0,Y.jsx)(`span`,{children:e.title}),(0,Y.jsx)(`span`,{className:`text-ink-3 tabular-nums`,children:f(`store.rows`,{n:e.rows})})]},e.id))}):null,r.connections.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(R,{className:`size-4 text-ink-3`}),` `,e.account?.label]},e.id)),r.keepsSignIns?(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(s,{className:`size-4 text-ink-3`}),` `,f(`store.signIns`)]}):null,r.files.length?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`mb-1 text-ink-3`,children:f(`store.files`,{n:r.files.length,size:bn(r.files.reduce((e,t)=>e+t.size,0))})}),(0,Y.jsx)(`ul`,{className:`max-h-56 overflow-y-auto rounded-lg ring-1 ring-border-soft`,children:r.files.map(t=>(0,Y.jsx)(`li`,{className:`border-border-soft border-b last:border-0`,children:(0,Y.jsxs)(`a`,{href:i(`/api/runs/${e}/store/files/${t.path}`),className:`flex items-center gap-2 px-3 py-2 text-[0.8125rem] hover:bg-paper-2 coarse:min-h-11`,title:t.source??void 0,children:[(0,Y.jsx)(L,{className:`size-3.5 shrink-0 text-ink-3`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.path}),(0,Y.jsx)(`span`,{className:`text-ink-4 tabular-nums`,children:bn(t.size)})]})},t.path))})]}):null,(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[u?(0,Y.jsx)(`span`,{}):c?(0,Y.jsxs)(A,{variant:`secondary`,onClick:async()=>{await o.del(`/api/runs/${e}/store`),a(await o.get(`/api/runs/${e}/store`)),l(!1)},children:[(0,Y.jsx)(z,{className:`size-4`}),` `,f(`store.confirmDelete`)]}):(0,Y.jsxs)(A,{variant:`ghost`,onClick:()=>l(!0),children:[(0,Y.jsx)(z,{className:`size-4`}),` `,f(`store.delete`)]}),(0,Y.jsx)(A,{onClick:()=>n(!1),children:f(`common.close`)})]})]}):(0,Y.jsx)(`div`,{className:`flex justify-center py-8 text-ink-4`,children:(0,Y.jsx)(y,{})})})]})}var Sn=300;function Cn(){if(typeof MediaRecorder<`u`)return[`audio/webm;codecs=opus`,`audio/mp4`,`audio/webm`,`audio/ogg;codecs=opus`].find(e=>MediaRecorder.isTypeSupported(e))}function wn(e){return`${Math.floor(e/60)}:${String(Math.floor(e%60)).padStart(2,`0`)}`}function Tn({value:e,runId:t,onChange:n,onBusy:r}){let i=se(e)?e:null,[s,c]=(0,J.useState)(null),[l,d]=(0,J.useState)(0),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(!1),[b,x]=(0,J.useState)(null),S=(0,J.useRef)(null),C=(0,J.useRef)(null),w=Cn(),T=H&&!!w;(0,J.useEffect)(()=>()=>{S.current&&(S.current.recorder.onstop=null,S.current.stop())},[]),(0,J.useEffect)(()=>()=>{b&&URL.revokeObjectURL(b.url)},[b]);let E=async(e,i)=>{m(!0),r?.(!0),g(null);try{let r=await o.upload(`/api/runs/${t}/uploads`,e);x({asset:r.id,url:URL.createObjectURL(e)}),n({asset:r.id,...i===void 0?{}:{seconds:i}})}catch(e){g(e.message)}finally{m(!1),r?.(!1)}},D=async()=>{g(null),v(!1);let e;try{e=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0}})}catch{v(!0);return}let t=[],n=new MediaRecorder(e,{mimeType:w,audioBitsPerSecond:48e3}),i=Date.now(),a=new AudioContext,o=a.createAnalyser();o.fftSize=256,a.createMediaStreamSource(e).connect(o);let s=new Uint8Array(o.fftSize),l=0,u=()=>{o.getByteTimeDomainData(s);let e=0;for(let t of s)e=Math.max(e,Math.abs(t-128));if(d(Math.min(1,e/64)),c((Date.now()-i)/1e3),(Date.now()-i)/1e3>=Sn){f();return}l=requestAnimationFrame(u)},f=()=>{cancelAnimationFrame(l),n.state!==`inactive`&&n.stop();for(let t of e.getTracks())t.stop();a.close().catch(()=>void 0),S.current=null,c(null),d(0)};n.ondataavailable=e=>e.data.size&&t.push(e.data),n.onstop=()=>{let e=(n.mimeType||w||`audio/webm`).split(`;`)[0],r=e===`audio/mp4`?`m4a`:e===`audio/ogg`?`ogg`:`webm`,a=Math.max(1,Math.round((Date.now()-i)/1e3));E(new File(t,`sprachnotiz-${Rt()}.${r}`,{type:e}),a)},S.current={recorder:n,stop:f},r?.(!0),n.start(1e3),l=requestAnimationFrame(u)},O=s!==null,k=(0,Y.jsxs)(A,{variant:`secondary`,onClick:()=>C.current?.click(),children:[(0,Y.jsx)(Ie,{className:`size-4`}),` `,f(`voice.pick`)]});return(0,Y.jsxs)(`div`,{children:[O?(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-3 ring-1 ring-ember`,children:[(0,Y.jsxs)(`span`,{className:`relative flex size-11 shrink-0 items-center justify-center`,children:[(0,Y.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-rose-tint transition-transform duration-75`,style:{transform:`scale(${.7+l*.5})`}}),(0,Y.jsx)(`span`,{className:`relative size-3.5 animate-pulse-dot rounded-full bg-rose`})]}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`font-medium text-[0.9375rem] tabular-nums`,children:wn(s)}),(0,Y.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:s>270?f(`voice.left`,{s:Math.ceil(Sn-s)}):f(`voice.recording`)})]}),(0,Y.jsxs)(A,{onClick:()=>S.current?.stop(),children:[(0,Y.jsx)(u,{className:`size-3.5 fill-current`}),` `,f(`voice.stop`)]})]}):p?(0,Y.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-card p-4 text-[0.875rem] text-ink-3 ring-1 ring-input`,children:[(0,Y.jsx)(y,{className:`size-4`}),` `,f(`run.uploading`)]}):i?(0,Y.jsxs)(`div`,{className:`rounded-xl bg-card p-3 ring-1 ring-input`,children:[(0,Y.jsx)(`audio`,{controls:!0,preload:`metadata`,src:b?.asset===i.asset?b.url:`/api/runs/${t}/assets/${i.asset}`,className:`h-11 w-full`}),i.transcript?(0,Y.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap px-1 text-[0.875rem] text-ink-2 leading-relaxed`,children:i.transcript}):null,(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:i.seconds?wn(i.seconds):null}),(0,Y.jsxs)(`div`,{className:`flex gap-1`,children:[T?(0,Y.jsxs)(A,{variant:`ghost`,size:`sm`,onClick:()=>void D(),children:[(0,Y.jsx)(W,{className:`size-3.5`}),` `,f(`voice.again`)]}):null,(0,Y.jsx)(A,{variant:`ghost`,size:`sm`,onClick:()=>n(void 0),children:f(`voice.remove`)})]})]})]}):(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[T?(0,Y.jsxs)(A,{variant:`secondary`,size:`lg`,onClick:()=>void D(),className:`w-full sm:w-auto`,children:[(0,Y.jsx)(a,{className:`size-4`}),` `,f(`voice.start`)]}):k,T&&_?k:null]}),_?(0,Y.jsx)(`p`,{className:`mt-2 rounded-lg bg-amber-tint px-3 py-2 text-[0.8125rem] text-ink-2 leading-relaxed`,children:f(`voice.denied`)}):(0,Y.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-ink-3 leading-relaxed`,children:f(T?`voice.why`:`voice.noRecorder`)})]}),(0,Y.jsx)(`input`,{ref:C,type:`file`,hidden:!0,accept:`audio/*`,capture:!0,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&E(t,void 0)}}),h?(0,Y.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:h}):null]})}function En(e,t){try{return new Intl.NumberFormat(void 0,{style:`currency`,currency:t}).format(e)}catch{return`${e.toFixed(2)} ${t}`}}function Dn({field:e,value:t,values:n,onChange:r}){let i=e.columns??[],a=Array.isArray(t)&&t.length?t:[{}],o=ae(e,a,n),s=(e,t,n)=>{r(a.map((r,i)=>i===e?{...r,[t]:n}:r))},c=i.map(e=>e.kind===`text`&&e===i[0]?`minmax(0,3fr)`:`minmax(0,1fr)`).join(` `);return(0,Y.jsxs)(`div`,{className:`rounded-xl bg-card p-2 ring-1 ring-input`,children:[(0,Y.jsx)(`div`,{className:`hidden gap-2 px-2 pt-1 pb-2 text-[0.75rem] text-ink-3 sm:grid`,style:{gridTemplateColumns:`${c} 36px`},children:i.map(e=>(0,Y.jsx)(`div`,{className:e.kind===`text`?``:`text-right`,children:e.label},e.id))}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map((e,t)=>(0,Y.jsxs)(`div`,{className:`grid grid-cols-6 gap-2 rounded-lg bg-paper p-2 sm:bg-transparent sm:p-0 sm:[grid-template-columns:var(--cols)]`,style:{"--cols":`${c} 36px`},children:[i.map((n,r)=>(0,Y.jsxs)(`label`,{className:g(`flex min-w-0 flex-col gap-1 sm:col-span-1`,r===0?`col-span-5`:i.length-1<=2?`col-span-3`:`col-span-2`),children:[(0,Y.jsx)(`span`,{className:`px-0.5 text-[0.6875rem] text-ink-3 sm:hidden`,children:n.label}),(0,Y.jsx)(`input`,{"aria-label":n.label,placeholder:n.label,inputMode:n.kind===`text`?`text`:`decimal`,autoComplete:`off`,value:String(e[n.id]??``),onChange:e=>s(t,n.id,e.target.value),className:g(`h-11 w-full min-w-0 rounded-md border border-transparent bg-paper-2 px-2.5 text-[0.875rem] outline-none placeholder:text-transparent focus:border-focus focus:bg-card sm:placeholder:text-ink-4`,n.kind!==`text`&&`text-right tabular-nums`)})]},n.id)),(0,Y.jsx)(E,{label:f(`list.delete`),onClick:()=>r(a.filter((e,n)=>n!==t)),className:`order-first col-start-6 row-start-1 size-11 justify-self-end self-end sm:order-none sm:col-start-auto sm:row-start-auto`,children:(0,Y.jsx)(z,{className:`size-4`})})]},t))}),(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-end justify-between gap-3 px-2 pb-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>r([...a,{}]),className:`inline-flex h-9 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-2 hover:bg-accent coarse:h-11`,children:[(0,Y.jsx)(p,{className:`size-4`}),` `,f(`run.addRow`)]}),(0,Y.jsxs)(`div`,{className:`text-right text-[0.8125rem] tabular-nums`,children:[(0,Y.jsxs)(`div`,{className:`text-ink-3`,children:[f(`run.net`),` `,En(o.net,o.currency)]}),o.vatRate?(0,Y.jsxs)(`div`,{className:`text-ink-3`,children:[f(`run.vat`,{r:o.vatRate}),` `,En(o.vat,o.currency)]}):null,(0,Y.jsxs)(`div`,{className:`font-semibold text-[0.9375rem] text-ink`,children:[f(`run.total`),` `,En(o.gross,o.currency)]})]})]})]})}function On(e){return!!e?.closest(`input, textarea, [contenteditable='true']`)}function kn({field:e,value:t,runId:n,onChange:r,onBusy:a}){let s=(0,J.useRef)(null),l=(0,J.useRef)(null),u=(0,J.useRef)(null),d=(0,J.useRef)(null),[p,m]=(0,J.useState)(!1),[h,_]=(0,J.useState)({}),[v,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(!1),[S,C]=(0,J.useState)(!1),[w,T]=(0,J.useState)(null),D=(0,J.useRef)(null),O=e=>{D.current=e,T(e)},k=e.kind===`image`,A=!!e.multiple,j=A?e.max??30:1,M=k||!!e.camera||!!e.video,N=!k&&!!e.video,P=Array.isArray(t)?t:typeof t==`string`&&t?[t]:[],F=(0,J.useRef)(P);F.current=P;let I=P.length<j,L=async e=>{let t=(k?e.filter(e=>e.type.startsWith(`image/`)):e).sort((e,t)=>e.name.localeCompare(t.name,void 0,{numeric:!0}));if(!t.length)return;let i=j-(A?F.current.length:0);m(!0),a?.(!0),y(t.length>i&&A?f(`run.maxFiles`,{n:j}):null);try{for(let e of t.slice(0,Math.max(0,i))){let t=await Lt(e),i=await o.upload(`/api/runs/${n}/uploads`,t);_(e=>({...e,[i.id]:{name:i.name,mime:i.mime}}));let a=A?[...F.current,i.id]:i.id;F.current=A?a:[i.id],r(a)}}catch(e){y(e.message)}finally{m(!1),a?.(!1)}},te=(0,J.useRef)(L);te.current=L;let re=e=>{let t=P.filter(t=>t!==e);r(A?t:void 0)},R=(e,t)=>{let n=F.current.indexOf(e),i=Math.min(F.current.length-1,Math.max(0,t));if(n<0||n===i)return;let a=F.current.filter(t=>t!==e);a.splice(i,0,e),F.current=a,r(a)},z=A&&P.length>1;(0,J.useEffect)(()=>{if(!I)return;let e=e=>{let t=Array.from(e.clipboardData?.files??[]),n=s.current;if(!t.length||!n||On(document.activeElement))return;let r=document.querySelectorAll(`[data-upload-field]`);(n.matches(`:hover`)||n.contains(document.activeElement)||r.length===1)&&(e.preventDefault(),te.current(t))};return document.addEventListener(`paste`,e),()=>document.removeEventListener(`paste`,e)},[I]);let B=g(`flex flex-col items-center justify-center gap-2 rounded-xl border border-input border-dashed bg-card px-3 text-[0.875rem] text-ink-3 transition hover:border-ember hover:text-ink`,P.length?`py-4`:`py-8`);return(0,Y.jsxs)(`div`,{ref:s,"data-upload-field":``,onDragOver:e=>{I&&(e.preventDefault(),C(!0))},onDragLeave:()=>C(!1),onDrop:e=>{C(!1),I&&(e.preventDefault(),L(Array.from(e.dataTransfer.files)))},children:[P.length?(0,Y.jsx)(`div`,{className:`mb-2 flex flex-col gap-2`,children:P.map((e,t)=>{let r=h[e],a=r?.mime??(k?`image/`:``);return(0,Y.jsxs)(`div`,{"data-file-id":e,className:g(`flex items-center gap-3 rounded-xl bg-card p-2 ring-1 ring-input transition-shadow`,w===e&&`relative z-10 shadow-elevated ring-2 ring-ember`),children:[z?(0,Y.jsxs)(`button`,{type:`button`,"aria-label":f(`run.moveFile`,{n:t+1}),title:f(`run.moveFileHint`),className:g(`-mr-1 flex h-14 w-9 shrink-0 touch-none flex-col items-center justify-center gap-0.5 rounded-lg text-ink-3 hover:bg-paper-2 hover:text-ink`,w===e?`cursor-grabbing`:`cursor-grab`),onPointerDown:t=>{try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}O(e)},onPointerMove:t=>{if(D.current!==e)return;let n=document.elementFromPoint(t.clientX,t.clientY)?.closest(`[data-file-id]`),r=n?.getAttribute(`data-file-id`);r&&r!==e&&s.current?.contains(n??null)&&R(e,F.current.indexOf(r))},onPointerUp:()=>O(null),onPointerCancel:()=>O(null),onKeyDown:n=>{(n.key===`ArrowUp`||n.key===`ArrowDown`)&&(n.preventDefault(),R(e,t+(n.key===`ArrowUp`?-1:1)))},children:[(0,Y.jsx)(`span`,{className:`font-medium text-[0.75rem] tabular-nums`,children:t+1}),(0,Y.jsx)(We,{className:`size-4`})]}):null,a.startsWith(`image/`)?(0,Y.jsx)(`img`,{src:i(`/api/runs/${n}/assets/${e}`),alt:``,className:`size-14 rounded-lg object-cover`}):(0,Y.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-lg bg-paper-2`,children:a.startsWith(`video/`)?(0,Y.jsx)(Re,{className:`size-5 text-ink-3`}):(0,Y.jsx)(ee,{className:`size-5 text-ink-3`})}),(0,Y.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:r?.name??`✓`}),(0,Y.jsx)(E,{label:f(`run.removeFile`),onClick:()=>re(e),children:(0,Y.jsx)(c,{className:`size-4`})})]},e)})}):null,I?(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>l.current?.click(),className:g(B,`min-w-[9rem] flex-1 px-4`,S&&`border-ember text-ink`),children:[k?(0,Y.jsx)(Ke,{className:`size-6`}):(0,Y.jsx)(ee,{className:`size-6`}),p?f(`run.uploading`):P.length?f(`run.uploadMore`):f(pe?`run.uploadTouch`:`run.upload`)]}),M?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>H?x(!0):u.current?.click(),className:g(B,`w-28`),children:[(0,Y.jsx)(Ae,{className:`size-6`}),f(`run.camera`)]}):null,N&&!(H&&Jt)?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>d.current?.click(),className:g(B,`w-28`),children:[(0,Y.jsx)(ne,{className:`size-6`}),f(`camera.video`)]}):null]}):null,(0,Y.jsx)(`input`,{ref:l,type:`file`,hidden:!0,multiple:A,accept:k?`image/*`:void 0,onChange:e=>{L(Array.from(e.target.files??[])),e.target.value=``}}),(0,Y.jsx)(`input`,{ref:u,type:`file`,hidden:!0,accept:`image/*`,capture:`environment`,onChange:e=>{L(Array.from(e.target.files??[])),e.target.value=``}}),N?(0,Y.jsx)(`input`,{ref:d,type:`file`,hidden:!0,accept:`video/*`,capture:`environment`,onChange:e=>{L(Array.from(e.target.files??[])),e.target.value=``}}):null,(0,Y.jsx)(Yt,{open:b,multiple:A,video:N,onClose:()=>x(!1),onCapture:e=>L([e]),onNative:()=>u.current?.click()}),A&&(e.min||e.max)?(0,Y.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-ink-3 tabular-nums`,children:e.min&&P.length<e.min?f(`run.filesMin`,{n:P.length,min:e.min}):e.max?f(`run.filesOf`,{n:P.length,max:e.max}):null}):null,v?(0,Y.jsx)(`div`,{className:`mt-2 text-[0.8125rem] text-rose`,children:v}):null]})}function An(e){let t=`${e.id} ${e.label}`.toLowerCase();return/telefon|phone|handy|mobil(?!it)|\btel\b|rückruf/.test(t)?{type:`tel`,inputMode:`tel`,autoComplete:`tel`}:/\bplz\b|postleitzahl|postal|zip/.test(t)?{inputMode:`numeric`,autoComplete:`postal-code`}:/iban/.test(t)?{autoCapitalize:`characters`,autoCorrect:`off`,spellCheck:!1}:/vorname|first.?name/.test(t)?{autoComplete:`given-name`,autoCapitalize:`words`}:/nachname|last.?name|surname/.test(t)?{autoComplete:`family-name`,autoCapitalize:`words`}:/firma|unternehmen|company|organi[sz]ation/.test(t)?{autoComplete:`organization`,autoCapitalize:`words`}:/straße|strasse|street|anschrift|adresse|address/.test(t)?{autoComplete:`street-address`,autoCapitalize:`words`}:/\b(ort|stadt|city|town)\b/.test(t)?{autoComplete:`address-level2`,autoCapitalize:`words`}:/\bname\b|ansprechp/.test(t)?{autoComplete:`name`,autoCapitalize:`words`}:{autoCapitalize:`sentences`}}function jn({field:e,value:t,onChange:n}){let[r,i]=(0,J.useState)(!1);return(0,Y.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Y.jsx)(k,{value:t,placeholder:e.placeholder,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>n(e.target.value)}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>i(!0),className:`inline-flex h-11 shrink-0 items-center gap-2 rounded-lg border border-input bg-card px-3.5 font-medium text-[0.875rem] text-ink-2 transition hover:border-ember hover:text-ink`,children:[(0,Y.jsx)(lt,{className:`size-4`}),` `,f(`scan.button`)]}),(0,Y.jsx)(rn,{open:r,onClose:()=>i(!1),onResult:n})]})}var Mn=4;function Nn(e){let t=new Map,n=e.map(e=>({value:e,slot:le(e)})).filter(e=>e.slot).sort((e,t)=>Date.parse(e.value)-Date.parse(t.value));for(let{value:e,slot:r}of n){if(!r)continue;let n=t.get(r.day)??{label:B(e,d),times:[]};n.times.push({value:e,time:r.time}),t.set(r.day,n)}return[...t.values()]}function Pn({name:e,label:t,options:n,value:r,onChange:i,disabled:a}){let o=Nn(n),s=o.findIndex(e=>e.times.some(e=>e.value===r)),[c,l]=(0,J.useState)(s>=Mn);if(!o.length)return(0,Y.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:f(`slot.none`)});let u=c?o:o.slice(0,Mn);return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Y.jsxs)(`fieldset`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Y.jsx)(`legend`,{className:`sr-only`,children:t}),u.map(t=>(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`mb-2 font-medium text-[0.75rem] text-ink-3`,children:t.label}),(0,Y.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.times.map(n=>(0,Y.jsxs)(`label`,{className:`relative`,children:[(0,Y.jsx)(`input`,{type:`radio`,name:`slot-${e}`,value:n.value,checked:n.value===r,disabled:a.has(n.value),"aria-label":`${t.label}, ${n.time}`,onChange:()=>i(n.value),className:`peer sr-only`}),(0,Y.jsx)(`span`,{className:g(`inline-flex h-10 cursor-pointer items-center rounded-full border px-4 text-sm tabular-nums transition coarse:h-11`,`border-input bg-card text-ink-2 hover:border-ink-4 hover:text-ink`,`peer-checked:border-ember peer-checked:bg-ember-tint peer-checked:text-ink`,`peer-disabled:pointer-events-none peer-disabled:line-through peer-disabled:opacity-60`,`peer-focus-visible:outline-[1.5px] peer-focus-visible:outline-offset-2 peer-focus-visible:outline-(--focus-line) peer-focus-visible:outline-solid`),children:n.time})]},n.value))})]},t.label))]}),o.length>u.length?(0,Y.jsx)(`button`,{type:`button`,onClick:()=>l(!0),className:`self-start text-[0.8125rem] text-ink-3 underline-offset-4 transition hover:text-ink hover:underline coarse:min-h-11`,children:f(`slot.later`)}):null]})}function Fn({cards:e,value:t,multi:n,runId:r,onChange:a,disabled:o}){let s=new Set(n?Array.isArray(t)?t.map(String):[]:t==null||t===``?[]:[String(t)]),c=e=>{a(n?s.has(e)?[...s].filter(t=>t!==e):[...s,e]:s.has(e)?``:e)},l=e=>/^(https?:|data:|\/)/.test(e)?e:i(`/api/runs/${r}/assets/${e}`);return(0,Y.jsx)(`div`,{className:`grid gap-3`,style:{gridTemplateColumns:`repeat(auto-fill, minmax(min(100%, 10.5rem), 1fr))`},children:e.map(e=>{let t=s.has(e.value),n=o.has(e.value);return(0,Y.jsxs)(`div`,{className:g(`flex flex-col overflow-hidden rounded-xl bg-card ring-1 ring-border-soft transition`,t&&`ring-2 ring-ember`,n&&`opacity-50`),children:[e.image?(0,Y.jsx)(`img`,{src:l(e.image),alt:``,className:`aspect-square w-full object-cover`}):null,(0,Y.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1 p-3`,children:[(0,Y.jsx)(`div`,{className:`font-medium text-[0.9375rem] leading-snug`,children:e.label}),e.subtitle?(0,Y.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:e.subtitle}):null,e.meta?(0,Y.jsx)(`div`,{className:`mt-auto pt-1 font-display font-semibold text-[0.9375rem] tabular-nums`,children:e.meta}):null,(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":t,disabled:n,onClick:()=>c(e.value),className:g(`inline-flex h-9 flex-1 items-center justify-center rounded-full px-3 text-[0.8125rem] transition coarse:h-11`,t?`bg-ember text-ember-on`:`bg-paper-2 text-ink-2 hover:text-ink`),children:f(t?`cards.picked`:`cards.pick`)}),e.link?(0,Y.jsx)(`a`,{href:e.link,target:`_blank`,rel:`noopener`,className:`inline-flex h-9 items-center rounded-full px-3 text-[0.8125rem] text-ink-2 ring-1 ring-border-soft hover:text-ink coarse:h-11`,children:f(`cards.open`)}):null]})]})]},e.value)})})}function In({field:e,value:t,values:n,runId:r,view:i,onChange:a,onBusy:o,error:s,closed:c}){let l=t==null?``:String(t),u=new Set(c?.values.map(String)),d;switch(e.kind){case`textarea`:d=(0,Y.jsx)(b,{value:l,placeholder:e.placeholder,autoCapitalize:`sentences`,enterKeyHint:`enter`,onChange:e=>a(e.target.value)});break;case`number`:d=(0,Y.jsx)(k,{inputMode:`decimal`,autoComplete:`off`,value:l,placeholder:e.placeholder,onChange:e=>a(e.target.value)});break;case`select`:{let n=e.options??[],o=i?.cards?.[e.id];d=o?.length?(0,Y.jsx)(Fn,{cards:o,value:t,multi:!1,runId:r,onChange:a,disabled:u}):n.length<=5&&n.every(e=>e.length<=28)?(0,Y.jsx)(j,{value:l,options:n,onChange:a,disabled:[...u]}):(0,Y.jsx)(v,{value:l,placeholder:`—`,onChange:a,options:n.map(e=>({value:e,label:e,disabled:u.has(e)}))});break}case`slot`:d=(0,Y.jsx)(Pn,{name:e.id,label:e.label,options:e.options??[],value:l,onChange:a,disabled:u});break;case`multiselect`:{let n=i?.cards?.[e.id];d=n?.length?(0,Y.jsx)(Fn,{cards:n,value:t,multi:!0,runId:r,onChange:a,disabled:u}):(0,Y.jsx)(j,{multi:!0,value:Array.isArray(t)?t:[],options:e.options??[],onChange:a});break}case`date`:d=(0,Y.jsx)(k,{type:`date`,value:l,onChange:e=>a(e.target.value),className:`w-full sm:w-56`});break;case`email`:d=(0,Y.jsx)(k,{type:`email`,inputMode:`email`,autoComplete:`email`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:l,placeholder:e.placeholder,onChange:e=>a(e.target.value)});break;case`url`:d=(0,Y.jsx)(k,{type:`url`,inputMode:`url`,autoComplete:`url`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,value:l,placeholder:e.placeholder??`https://`,onChange:e=>a(e.target.value)});break;case`toggle`:d=(0,Y.jsx)(w,{checked:t===!0,onChange:a,label:e.label,disabled:u.has(String(t!==!0))});break;case`color`:d=(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(D,{value:l||`#e0531b`,onChange:e=>a(e.target.value)}),(0,Y.jsx)(k,{value:l,placeholder:`#e0531b`,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:!1,onChange:e=>a(e.target.value),className:`w-36`})]});break;case`image`:case`file`:d=(0,Y.jsx)(kn,{field:e,value:t,runId:r,onChange:a,onBusy:o});break;case`items`:d=(0,Y.jsx)(Dn,{field:e,value:t,values:n,onChange:a});break;case`connection`:d=(0,Y.jsx)(fn,{runId:r,connection:i?.connections.find(t=>t.id===e.connection)});break;case`list`:{let t=i?.lists.find(t=>t.def.id===e.list);d=t?(0,Y.jsx)($,{runId:r,list:t,editable:!0}):null;break}case`location`:d=(0,Y.jsx)($t,{value:t,runId:r,placeholder:e.placeholder,onChange:a,onBusy:o});break;case`audio`:d=c?null:(0,Y.jsx)(Tn,{value:t,runId:r,onChange:a,onBusy:o});break;case`signature`:d=(0,Y.jsx)(un,{label:e.label,value:t,runId:r,onChange:a});break;default:d=e.scan?(0,Y.jsx)(jn,{field:e,value:l,onChange:a}):(0,Y.jsx)(k,{...An(e),value:l,placeholder:e.placeholder,onChange:e=>a(e.target.value)})}return(0,Y.jsxs)(`div`,{children:[e.kind===`toggle`?(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-6`,children:[(0,Y.jsx)(_,{hint:e.help,children:e.label}),d]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(_,{hint:e.help,required:e.required,children:e.label}),d]}),c?(0,Y.jsx)(`div`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:f(`run.closed`,{list:c.classes.map(e=>f(`run.cls.${Ln[e]}`)).join(`, `)})}):null,s?(0,Y.jsx)(`div`,{className:`mt-1.5 text-[0.8125rem] text-rose`,children:s}):null]})}var Ln={classifier:`text`,standard:`text`,high:`text`,highest:`text`,image:`image`,video:`video`,speech:`speech`,audio:`audio`},Rn=45e3;function zn(e){let[t,n]=(0,J.useState)(null),[r,a]=(0,J.useState)(null),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)({});(0,J.useEffect)(()=>{if(n(null),c(!1),!e)return;let t=!1,r=0,a,s=null,l=Date.now(),u=()=>{t=!0,s?.close(),c(!0)},d=async()=>{try{let r=await o.get(`/api/runs/${e}`);t||n(r)}catch(e){e instanceof m&&e.status===404&&u()}},f=()=>{if(clearTimeout(a),s?.close(),t)return;let o=new EventSource(i(`/api/runs/${e}/stream`),{withCredentials:!0});s=o,l=Date.now(),o.addEventListener(`view`,e=>{r=0,l=Date.now(),n(JSON.parse(e.data))}),o.addEventListener(`ping`,()=>{l=Date.now()}),o.onerror=()=>{o.close(),!(t||s!==o)&&(s=null,d(),r=Math.min(r+1,6),a=setTimeout(f,500*2**r))}},p=()=>{t||document.visibilityState!==`visible`||(!s||s.readyState===EventSource.CLOSED||Date.now()-l>Rn?(r=0,f()):d())},h=setInterval(()=>{!t&&s&&Date.now()-l>Rn&&(r=0,f())},15e3);return f(),document.addEventListener(`visibilitychange`,p),window.addEventListener(`pageshow`,p),window.addEventListener(`online`,p),()=>{t=!0,clearTimeout(a),clearInterval(h),document.removeEventListener(`visibilitychange`,p),window.removeEventListener(`pageshow`,p),window.removeEventListener(`online`,p),s?.close()}},[e]);let p=(0,J.useCallback)(async(t,n)=>{if(!e)return!1;u(!0),a(null),f({});try{return await o.post(`/api/runs/${e}/${t}`,n),!0}catch(e){return e instanceof m&&e.status===422&&Array.isArray(e.body?.fields)&&f(Object.fromEntries(e.body.fields.map(e=>[e.field,e.message]))),a(e.message),!1}finally{u(!1)}},[e]);return{view:t,notFound:s,error:r,busy:l,fieldErrors:d,submitPage:(e,t)=>p(`pages/${e}`,{values:t}),accept:(e,t)=>p(`reviews/${e}`,{type:`accept`,edits:t}),regenerate:(e,t,n,r)=>p(`reviews/${e}`,{type:`regenerate`,target:t,note:n,items:r?.length?r:void 0}),back:()=>p(`back`),retry:()=>p(`retry`)}}function Bn({view:e}){let t=Math.round(Math.min(e.progress.done,e.progress.total)/Math.max(1,e.progress.total)*100);return(0,Y.jsx)(`div`,{className:`h-[3px] w-full bg-paper-2`,children:(0,Y.jsx)(`div`,{className:`h-full bg-ember transition-[width] duration-700 ease-out`,style:{width:`${t}%`}})})}function Vn({title:e,description:t,kicker:n}){return(0,Y.jsxs)(`div`,{className:`mb-8`,children:[n?(0,Y.jsx)(`p`,{className:`mb-4 text-[0.9375rem] text-ink-2 leading-relaxed`,children:n}):null,(0,Y.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] leading-[1.15] tracking-tight sm:text-[2rem]`,children:e}),t?(0,Y.jsx)(`p`,{className:`mt-2 text-[0.9375rem] text-ink-3 leading-relaxed`,children:t}):null]})}function Hn(e,t){let n={};for(let r of e.fields)n[r.id]=t.values[r.id]??t.prefill?.[r.id]??r.default??(r.kind===`multiselect`?[]:void 0);return n}function Un(e){return Array.from(e.querySelectorAll(`input:not([type="hidden"], [type="file"], [type="checkbox"], [type="color"], [type="range"], [disabled]), textarea:not([disabled])`)).filter(e=>!e.closest(`dialog`)&&e.offsetParent!==null)}function Wn({view:e,run:t,step:n}){let[r,i]=(0,J.useState)(()=>Hn(n,e)),[a,o]=(0,J.useState)(new Set),s=(0,J.useRef)(null),c=e.progress.done===0,l=(0,J.useMemo)(()=>n.fields.filter(t=>!oe(t)||e.decidedFields?.includes(t.id)).map(t=>e.options?.[t.id]?.length?{...t,options:e.options[t.id]}:t),[n.fields,e.options,e.decidedFields]),u=ie(l,e.known??{},r),d=()=>void t.submitPage(n.id,r);return(0,J.useEffect)(()=>{if(!s.current)return;let e=Un(s.current).filter(e=>e instanceof HTMLInputElement);for(let[t,n]of e.entries())(n.dataset.hint||!n.hasAttribute(`enterkeyhint`))&&(n.dataset.hint=`1`,n.setAttribute(`enterkeyhint`,t===e.length-1?`go`:`next`))}),(0,Y.jsxs)(`form`,{ref:s,className:`animate-rise`,onSubmit:e=>{e.preventDefault(),a.size||d()},onKeyDown:e=>{let t=e.target;if(e.key!==`Enter`||e.defaultPrevented||e.nativeEvent.isComposing||!(t instanceof HTMLInputElement)||t.closest(`dialog`))return;let n=Un(e.currentTarget),r=n[n.indexOf(t)+1];r&&(e.preventDefault(),r.focus())},children:[(0,Y.jsx)(Vn,{title:n.title,description:n.description,kicker:c?e.wizard.intro:null}),(0,Y.jsx)(`div`,{className:`flex flex-col gap-7`,children:u.map(n=>(0,Y.jsx)(In,{field:n,value:r[n.id],values:r,runId:e.id,view:e,error:t.fieldErrors[n.id],closed:e.closed?.[n.id],onChange:e=>i(t=>({...t,[n.id]:e})),onBusy:e=>o(t=>{if(t.has(n.id)===e)return t;let r=new Set(t);return e?r.add(n.id):r.delete(n.id),r})},n.id))}),(0,Y.jsx)(Gn,{view:e,run:t,sticky:!0,children:(0,Y.jsxs)(A,{type:`submit`,size:`lg`,busy:t.busy,disabled:a.size>0,children:[n.cta||f(`run.next`),` `,(0,Y.jsx)(M,{className:`size-4`})]})})]})}function Gn({view:e,run:t,sticky:n,children:r}){return(0,Y.jsxs)(`div`,{className:g(`mt-10 flex items-center justify-between gap-3`,n&&`action-bar`),children:[e.canBack?(0,Y.jsxs)(A,{variant:`ghost`,onClick:()=>void t.back(),disabled:t.busy,children:[(0,Y.jsx)(l,{className:`size-4`}),` `,f(`run.back`)]}):(0,Y.jsx)(`span`,{}),r]})}function Kn(){let e=de(),[t,n]=(0,J.useState)(!1),r=e!==`off`;return(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2`,children:[(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":r,disabled:t,onClick:async()=>{if(r){xe();return}n(!0),await _e(),n(!1)},className:g(`inline-flex h-11 items-center gap-2 rounded-full px-4 font-medium text-[0.875rem] ring-1 transition`,r?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink hover:ring-ink-4`),children:[r?(0,Y.jsx)(Ee,{className:`size-4 text-ember-strong`}):(0,Y.jsx)(Oe,{className:`size-4`}),f(r?`notify.on`:`notify.ask`)]}),(0,Y.jsx)(`p`,{className:`max-w-xs text-[0.75rem] text-ink-4 leading-relaxed`,children:f(e===`off`?`notify.why`:e===`on`?`notify.onHint`:fe()?`notify.blocked`:`notify.quiet`)})]})}function qn({view:e,compact:t,awake:n}){let r=(0,J.useMemo)(()=>{let t=[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id);return t?new Date(t.at).getTime():Date.now()},[e.events,e.step?.id]),[a,o]=(0,J.useState)(Date.now());(0,J.useEffect)(()=>{let e=setInterval(()=>o(Date.now()),1e3);return()=>clearInterval(e)},[]);let s=[...e.events].reverse().find(t=>t.type===`step_started`&&t.stepId===e.step?.id)?.message??e.step?.title??f(`run.working`),c=e.events.filter(e=>(e.type===`tool`||e.type===`info`)&&new Date(e.at).getTime()>=r-500),l=c.slice(-4),u=[...new Set(c.map(e=>e.asset).filter(e=>!!e))],d=[...c].reverse().find(e=>e.asset)?.asset;return(0,Y.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-6 text-center`,children:[(0,Y.jsx)(V,{kind:e.wizard.avatar,size:t?130:170,fluffy:!0}),(0,Y.jsx)(`h2`,{className:`mt-4 font-display font-semibold text-[1.375rem] tracking-tight`,children:s}),(0,Y.jsx)(`div`,{className:`mt-1 text-[0.8125rem] text-ink-4 tabular-nums`,children:f(`run.elapsed`,{s:Math.max(0,Math.round((a-r)/1e3))})}),u.length?(0,Y.jsx)(`div`,{className:`mt-5 flex max-w-full flex-wrap justify-center gap-2`,children:u.slice(-8).map(t=>(0,Y.jsx)(`img`,{src:i(`/api/runs/${e.id}/assets/${t}`),alt:``,className:g(`size-16 animate-rise rounded-lg bg-paper-2 object-cover ring-1 ring-border-soft transition sm:size-20`,t===d?`ring-2 ring-ember`:`opacity-70`)},t))}):null,(0,Y.jsx)(`div`,{className:`mt-6 flex min-h-[7rem] w-full max-w-sm flex-col gap-1.5`,children:l.map((e,t)=>(0,Y.jsxs)(`div`,{className:g(`flex items-center justify-center gap-2 text-[0.8125rem] transition-opacity`,t===l.length-1?`text-ink-2`:`text-ink-4`),children:[t===l.length-1?(0,Y.jsx)(F,{className:`size-3.5 animate-breathe text-ember`}):null,(0,Y.jsx)(`span`,{className:`truncate`,children:S(e)})]},e.id))}),t?null:(0,Y.jsx)(Kn,{}),n?(0,Y.jsx)(`p`,{className:`mt-3 text-[0.75rem] text-ink-4`,children:f(`run.awake`)}):null]})}function Jn(e){let t=(0,J.useRef)({running:!1,since:0,ask:null});(0,J.useEffect)(()=>{if(!e)return;let n=t.current,r=e.status===`running`,i=r?n.running?n.since:Date.now():0,a=t=>{document.visibilityState!==`visible`&&!document.title.startsWith(`● `)&&(document.title=`● ${document.title}`),ge({title:e.wizard.title,body:t,tag:e.id})};r&&e.ask&&e.ask.id!==n.ask?a(f(`notify.needsYou`)):!r&&n.running&&Date.now()-n.since>8e3&&a(e.status===`failed`?f(`run.failed`):e.status===`done`?f(`notify.done`):f(`notify.next`)),t.current={running:r,since:i,ask:e.ask?.id??null}},[e]),(0,J.useEffect)(()=>{let e=()=>{document.visibilityState===`visible`&&document.title.startsWith(`● `)&&(document.title=document.title.slice(2))};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[])}function Yn({view:e,run:t,step:n}){let[r,i]=(0,J.useState)({}),[a,o]=(0,J.useState)({}),[s,c]=(0,J.useState)(``),l=e.shown.filter(e=>e.output),[u,d]=(0,J.useState)(l.length===1?l[0].step.id:null),[p,m]=(0,J.useState)({}),h=(0,J.useRef)(null),_=l.find(e=>e.step.id===u),v=_?.step.type===`generate`&&(_.output?.assets?.length??0)>1,y=()=>{_&&s.trim()&&t.regenerate(n.id,_.step.id,s.trim(),p[_.step.id])};return(0,Y.jsxs)(`div`,{className:`animate-rise`,children:[(0,Y.jsx)(Vn,{title:n.title,description:n.description}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[e.shown.filter(e=>e.output).map(({step:t,output:s})=>{let c=!!n.edit&&t.type===`agent`&&t.output.format!==`json`;return(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.06em]`,children:t.title}),(0,Y.jsx)(`div`,{className:`flex items-center`,children:c&&!a[t.id]?(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>({...e,[t.id]:!0})),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-2 hover:bg-accent hover:text-ink coarse:h-11`,children:[(0,Y.jsx)(it,{className:`size-3.5`}),` `,f(`run.edit`)]}):null})]}),(0,Y.jsx)(Se,{base:`/api/runs/${e.id}`,step:t,output:s,editable:c&&a[t.id],draft:r[t.id],onDraft:e=>i(n=>({...n,[t.id]:e})),picked:p[t.id],onPick:n.regenerate?e=>{d(t.id),m(n=>{let r=n[t.id]??[];return{...n,[t.id]:r.includes(e)?r.filter(t=>t!==e):[...r,e]}}),h.current?.focus()}:void 0,onSurfaceAction:n.regenerate?()=>{d(t.id),h.current?.focus()}:void 0})]},t.id)}),e.lists.map(t=>(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h3`,{className:`mb-2 font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.06em]`,children:t.def.title}),t.def.check?(0,Y.jsx)(_n,{runId:e.id,list:t}):(0,Y.jsx)($,{runId:e.id,list:t,editable:!0})]},t.def.id)),n.regenerate&&l.length?(0,Y.jsxs)(T,{className:`p-3`,children:[l.length>1?(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 pb-2`,children:[(0,Y.jsx)(`span`,{className:`mr-1 text-[0.8125rem] text-ink-3`,children:f(`run.feedbackTarget`)}),l.map(({step:e})=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":u===e.id,onClick:()=>{d(e.id),h.current?.focus()},className:g(`inline-flex h-8 items-center rounded-full px-3 text-[0.8125rem] ring-1 transition coarse:h-11`,u===e.id?`bg-ember-tint text-ink ring-ember`:`bg-card text-ink-2 ring-input hover:text-ink`),children:e.title},e.id))]}):null,(0,Y.jsx)(b,{ref:h,minRows:2,maxRows:8,value:s,placeholder:f(`run.feedbackPlaceholder`),onChange:e=>c(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),y())},className:`border-0 bg-transparent shadow-none focus:ring-0`}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-1 pt-1`,children:[(0,Y.jsx)(`span`,{className:`min-w-0 text-[0.75rem] text-ink-3`,children:v?p[_.step.id]?.length?f(`run.regeneratePicked`,{n:[...p[_.step.id]].sort((e,t)=>e-t).map(e=>e+1).join(`, `)}):f(`run.regenerateAll`):!_&&s.trim()?f(`run.feedbackPick`):null}),(0,Y.jsxs)(A,{size:`sm`,variant:`secondary`,busy:t.busy,disabled:!s.trim()||!_,onClick:y,children:[(0,Y.jsx)(ue,{className:`size-3.5`}),` `,f(`run.regenerateGo`)]})]})]}):null]}),(0,Y.jsx)(Gn,{view:e,run:t,sticky:!0,children:(0,Y.jsxs)(A,{size:`lg`,busy:t.busy,onClick:()=>void t.accept(n.id,Object.keys(r).length?r:void 0),children:[f(`run.accept`),` `,(0,Y.jsx)(M,{className:`size-4`})]})})]})}function Xn({view:e,run:t,step:n,onRestart:r}){let i=e.shown.filter(e=>e.output);return(0,Y.jsxs)(`div`,{className:`animate-rise`,children:[(0,Y.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-x-4 gap-y-5`,children:[(0,Y.jsx)(V,{kind:e.wizard.avatar,size:64}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1 basis-[12rem]`,children:[(0,Y.jsx)(`h1`,{className:`text-balance font-display font-semibold text-[1.75rem] leading-tight tracking-tight sm:text-[2rem]`,children:n.title}),n.message?(0,Y.jsx)(`p`,{className:`mt-1 text-[0.9375rem] text-ink-3`,children:n.message}):null]}),e.shown.some(e=>e.output)?(0,Y.jsx)(`div`,{className:`max-sm:basis-full`,children:(0,Y.jsx)(At,{runId:e.id,title:`${n.title} · ${e.wizard.title}`,initial:e.shareUrl?{url:e.shareUrl,expiresAt:e.expiresAt}:null})}):null]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i.map(({step:t,output:n,formats:r,label:i})=>(0,Y.jsxs)(T,{className:`p-4 sm:p-5`,children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem]`,children:i??t.title}),(0,Y.jsx)(be,{base:`/api/runs/${e.id}`,stepId:t.id,formats:r,title:i??t.title})]}),(0,Y.jsx)(Se,{base:`/api/runs/${e.id}`,step:t,output:n}),n?.assets?.some(e=>e.ai)?(0,Y.jsx)(`p`,{className:`mt-3 text-[0.75rem] text-ink-3 leading-relaxed`,children:f(`ai.publish`)}):null]},t.id)),e.lists.map(t=>(0,Y.jsxs)(T,{className:`p-4 sm:p-5`,children:[(0,Y.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,Y.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem]`,children:t.label??t.def.title}),(0,Y.jsx)(yn,{runId:e.id,list:t})]}),(0,Y.jsx)($,{runId:e.id,list:t,editable:!0})]},t.def.id))]}),(0,Y.jsx)(Gn,{view:e,run:t,children:r?(0,Y.jsxs)(A,{variant:`secondary`,onClick:r,children:[(0,Y.jsx)(W,{className:`size-4`}),` `,f(`run.again`)]}):(0,Y.jsx)(`span`,{})})]})}function Zn({view:e,run:t}){return(0,Y.jsxs)(`div`,{className:`flex animate-rise flex-col items-center pt-8 text-center`,children:[(0,Y.jsx)(V,{kind:e.wizard.avatar,size:90}),(0,Y.jsx)(`h2`,{className:`mt-4 font-display font-semibold text-[1.375rem]`,children:f(`run.failed`)}),(0,Y.jsx)(`p`,{className:`mt-2 max-w-md text-[0.9375rem] text-ink-3`,children:(0,Y.jsx)(C,{text:e.error??``})}),(0,Y.jsxs)(`div`,{className:`mt-8 flex gap-3`,children:[e.canBack?(0,Y.jsxs)(A,{variant:`ghost`,onClick:()=>void t.back(),children:[(0,Y.jsx)(l,{className:`size-4`}),` `,f(`run.back`)]}):null,(0,Y.jsxs)(A,{onClick:()=>void t.retry(),busy:t.busy,children:[(0,Y.jsx)(W,{className:`size-4`}),` `,f(`run.retry`)]})]})]})}function Qn({runId:e,compact:t,onRestart:n,onView:r,stickyProgress:i}){let a=zn(e),{view:o}=a;(0,J.useEffect)(()=>{r?.(o)},[o,r]),ye();let s=ve(o?.status===`running`&&!o.ask);if(Jn(o),a.notFound)return(0,Y.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:f(`run.notFound`)});if(!o)return(0,Y.jsx)(`div`,{className:`flex justify-center py-24 text-ink-4`,children:(0,Y.jsx)(y,{})});let c=o.step,l=null;if(o.status===`running`&&o.ask)l=(0,Y.jsx)(Pt,{runId:o.id,ask:o.ask},o.ask.id);else if(o.status===`running`)l=(0,Y.jsx)(qn,{view:o,compact:t,awake:s});else if(o.status===`failed`)l=(0,Y.jsx)(Zn,{view:o,run:a});else if(o.status===`cancelled`)l=(0,Y.jsx)(`div`,{className:`py-24 text-center text-ink-3`,children:f(`run.cancelled`)});else if(c?.type===`page`)l=(0,Y.jsx)(Wn,{view:o,run:a,step:c},c.id);else if(c?.type===`review`){let e=o.shown.map(e=>e.output?.at??``).join(`|`);l=(0,Y.jsx)(Yn,{view:o,run:a,step:c},`${c.id}:${e}`)}else c?.type===`result`&&(l=(0,Y.jsx)(Xn,{view:o,run:a,step:c,onRestart:n}));let u=c?.type===`review`&&o.status===`waiting_input`&&o.lists.some(e=>e.def.check);return(0,Y.jsxs)(`div`,{className:`flex min-h-full flex-col`,children:[i?(0,Y.jsx)(`div`,{className:`sticky top-0 z-10`,children:(0,Y.jsx)(Bn,{view:o})}):(0,Y.jsx)(Bn,{view:o}),(0,Y.jsxs)(`div`,{className:g(`safe-x mx-auto w-full flex-1`,u?`max-w-[1240px] py-8`:t?`max-w-[620px] py-8`:`max-w-[640px] py-8 sm:py-16`),children:[l,a.error&&o.status!==`failed`?(0,Y.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-4 py-3 text-[0.875rem] text-rose`,children:a.error}):null,o.keeps&&o.status!==`running`?(0,Y.jsx)(`div`,{className:`mt-10 flex justify-center`,children:(0,Y.jsx)(xn,{runId:o.id})}):null]})]})}export{ot as _,In as a,Re as b,yn as c,Pt as d,Mt as f,W as g,dt as h,zn as i,$ as l,ht as m,Hn as n,An as o,At as p,Jn as r,_n as s,Qn as t,xn as u,it as v,we as x,et as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,r as i}from"./logo-C80CWCDM.js";import{S as a,_ as o,b as s,f as c,m as l,v as u,w as d}from"./Marketplace-BDQNwMDB.js";import{t as f}from"./useMutation-DKcIz55V.js";import{$ as p,C as m,G as h,M as g,P as _,R as v,W as y,Y as b,Z as x,_ as S,a as ee,at as C,d as w,f as T,it as te,l as E,m as D,n as O,o as k,r as A,rt as ne,s as j,t as M}from"./ui-GsuU9WTj.js";import{t as re}from"./arrow-right-F7X_SjK9.js";import{E as ie,g as ae,i as oe,r as se}from"./HomePage-BnYdh_Nx.js";import{t as ce}from"./circle-alert-DdpaAYgd.js";import{r as le}from"./sparkles-DWGJluyV.js";import{t as N}from"./external-link-Dfc1VFvS.js";import{r as ue,t as de}from"./volume-2-BZju_bOP.js";import{n as fe,t as pe}from"./trash-D9UB6TtS.js";import{c as me}from"./definition-CHacJYmI.js";import{t as he}from"./refresh-cw-BUDPOT39.js";import{f as ge,l as _e,s as ve,t as ye}from"./session-Blj2os_v.js";import{o as be,r as xe}from"./ThemeSwitch-C3EJRN06.js";import{U as Se,V as Ce,d as we,l as Te,m as Ee,n as De,p as Oe,r as ke,t as Ae}from"./index-CX_yxZVQ.js";import{a as P,c as je,d as Me,f as Ne,i as F,l as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze,u as Be}from"./settings-menu-BvxRnNtf.js";import{n as Ve,t as He}from"./ReadOnly-DnB47DQC.js";import{t as Ue}from"./Harness-DAR1u4Dk.js";var We={name:`ear`,size:24,node:[[`path`,{d:`M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0`,key:`1dfaln`}],[`path`,{d:`M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4`,key:`1qnva7`}]]};We.node;var Ge=b(We),Ke={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};Ke.node;var I=b(Ke),qe={name:`mail-plus`,size:24,node:[[`path`,{d:`M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8`,key:`12jkf8`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`M19 16v6`,key:`tddt3s`}],[`path`,{d:`M16 19h6`,key:`xwg31i`}]]};qe.node;var Je=b(qe),Ye={name:`rotate-cw`,size:24,node:[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]};Ye.node;var Xe=b(Ye),Ze={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};Ze.node;var Qe=b(Ze),L=e(t(),1),R=e(n(),1);function $e(){let e=ke(),[t,n]=(0,L.useState)(null),[r,i]=(0,L.useState)(null),a=async e=>{n(e??`*`),i(null);try{await De(e)}catch(e){i(e.message)}finally{n(null)}};return(0,R.jsxs)(ae,{title:_(`plugins.title`),hint:e.canReload?_(`plugins.hint`):_(`plugins.hintManaged`),action:e.canReload?(0,R.jsx)(M,{variant:`secondary`,busy:t===`*`,onClick:()=>void a(),children:_(`plugins.rescan`)}):null,children:[e.plugins.length||e.problems.length?null:(0,R.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`plugins.none`)}),(0,R.jsxs)(`ul`,{className:`divide-y divide-border-soft`,children:[e.plugins.map(n=>{let r=e.failed[n.id];return(0,R.jsxs)(`li`,{className:`flex items-start gap-4 py-4 first:pt-0 last:pb-0`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,R.jsx)(`span`,{className:`font-medium text-[0.9375rem]`,children:n.name}),n.name===n.id?null:(0,R.jsxs)(`span`,{className:`font-mono text-[0.75rem] text-ink-4`,children:[n.id,` · `,n.version]})]}),n.description?(0,R.jsx)(`p`,{className:`mt-0.5 text-[0.875rem] text-ink-3`,children:n.description}):null,n.tools.length?(0,R.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[_(`plugins.tools`),n.tools.map(e=>(0,R.jsx)(A,{children:e.id},e.id))]}):null,n.error?(0,R.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:_(`plugins.serverFailed`,{error:n.error})}):null,r?(0,R.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:_(`plugins.studioFailed`,{error:r})}):null]}),e.canReload?(0,R.jsx)(k,{label:_(`plugins.reload`),disabled:t!==null,onClick:()=>void a(n.id),children:(0,R.jsx)(Xe,{className:t===n.id?`size-4 animate-spin`:`size-4`})}):null]},n.id)}),e.problems.map(e=>(0,R.jsxs)(`li`,{className:`py-4 first:pt-0 last:pb-0`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,R.jsx)(A,{tone:`warn`,children:_(`plugins.problems`)}),(0,R.jsx)(`span`,{className:`break-all font-mono text-[0.75rem] text-ink-3`,children:e.path})]}),(0,R.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:e.message})]},e.path))]}),r?(0,R.jsx)(`p`,{className:`mt-4 text-[0.8125rem] text-rose`,children:r}):null]})}var et=[`pro-modules`],tt=`/api/studio/plugins/-/pro`,nt={managed:`pro.held.plan`,not_installed:`pro.held.release`,release:`pro.held.release`,unconfirmed:`pro.held.unconfirmed`,plan:`pro.held.plan`},rt=e=>new Date(e).toLocaleDateString(g===`de`?`de-AT`:`en-GB`,{day:`numeric`,month:`long`});function it(){let e=r(),{canReload:t}=ke(),n=i({queryKey:et,queryFn:()=>m.get(tt),enabled:t}),a=t=>e.setQueryData(et,t),o=f({mutationFn:()=>m.post(`${tt}/refresh`),onSuccess:a}),s=f({mutationFn:e=>m.post(`${tt}/${e}`),onSuccess:a}),c=f({mutationFn:e=>m.del(`${tt}/${e}`),onSuccess:a}),l=n.data,u=s.isPending||c.isPending,d=s.error??c.error??o.error;return t?(0,R.jsx)(ae,{title:_(`pro.title`),hint:_(`pro.hint`),action:l?.linked?(0,R.jsx)(M,{variant:`secondary`,busy:o.isPending,onClick:()=>o.mutate(),children:_(`pro.check`)}):null,children:l?l.linked?(0,R.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 text-[0.8125rem] text-ink-3`,children:[(0,R.jsxs)(`span`,{children:[l.plan?_(`pro.plan`,{plan:l.plan.name}):null,l.plan&&l.expiresAt?` · `:null,l.expiresAt?_(`pro.confirmedUntil`,{date:rt(l.expiresAt)}):null]}),(0,R.jsxs)(M,{variant:`ghost`,onClick:()=>xe(`${l.accountUrl}/billing`),children:[_(`pro.plans`),` `,(0,R.jsx)(N,{className:`size-4`})]})]}),l.error?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:l.error}):null,l.modules.length?(0,R.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:l.modules.map(e=>(0,R.jsxs)(`li`,{className:`flex items-start gap-4 py-4 first:pt-0 last:pb-0`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,R.jsx)(`span`,{className:`font-medium text-[0.9375rem]`,children:e.name}),(0,R.jsxs)(`span`,{className:`font-mono text-[0.75rem] text-ink-4`,children:[e.id,` · `,e.installed?.version??e.version]}),e.loaded?(0,R.jsx)(A,{tone:`live`,children:_(`pro.on`)}):null,e.included?null:(0,R.jsx)(A,{children:_(`pro.notInPlan`)}),e.installed&&e.heldBack&&e.included?(0,R.jsx)(A,{tone:`warn`,children:_(nt[e.heldBack])}):null]}),e.description?(0,R.jsx)(`p`,{className:`mt-0.5 text-[0.875rem] text-ink-3`,children:e.description}):null]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[e.included&&(!e.installed||e.update)?(0,R.jsx)(M,{busy:s.isPending&&s.variables===e.id,disabled:u,onClick:()=>s.mutate(e.id),children:e.installed?_(`pro.update`):_(`pro.install`)}):null,e.installed?(0,R.jsx)(M,{variant:`secondary`,busy:c.isPending&&c.variables===e.id,disabled:u,onClick:()=>c.mutate(e.id),children:_(`pro.remove`)}):null]})]},e.id))}):(0,R.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`pro.none`,{runtime:l.runtime})}),d?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:d.message}):null]}):(0,R.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:_(`pro.notLinked`)}):(0,R.jsx)(T,{})}):null}function at({connector:e}){let[t,n]=(0,L.useState)(!1);return(0,R.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-3 px-3 py-2 text-left`,children:[(0,R.jsx)(`span`,{className:S(`size-2 shrink-0 rounded-full`,e.usable?`bg-moss`:`bg-ink-4`)}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[0.8125rem]`,children:[e.name,` `,(0,R.jsx)(`span`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:e.id})]}),(0,R.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3`,children:e.usable?_(`connectors.actions`,{n:e.actions.length,r:e.actions.filter(e=>e.group===`read`).length}):_(`connectors.notSetUp`)})]}),t?(0,R.jsxs)(`div`,{className:`border-border-soft border-t px-3 py-2 text-[0.75rem]`,children:[e.missingSetup?(0,R.jsxs)(`p`,{className:`mb-1 text-ink-3`,children:[_(`connectors.setup`),` `,(0,R.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.missingSetup})]}):null,(0,R.jsx)(`p`,{className:`text-ink-4`,children:e.actions.map(e=>e.group===`read`?e.id:`${e.id} (${_(`connectors.group.${e.group}`)})`).join(` · `)})]}):null]})}var ot={none:`connectors.authNone`,oauth2:`connectors.authOauth`,api_key:`connectors.authKey`};function st({projectId:e,connector:t,readOnly:n}){let i=r(),[a,o]=(0,L.useState)(!1),s=()=>i.invalidateQueries({queryKey:[`connectors`,e]}),c=`/api/studio/projects/${e}/connectors/${t.id}`,u=f({mutationFn:()=>m.post(`${c}/refresh`),onSuccess:s}),d=f({mutationFn:()=>m.del(c),onSuccess:s}),p=t.actions.filter(e=>e.group===`read`).length;return(0,R.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,R.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-paper-2 text-ink-2`,children:(0,R.jsx)(l,{className:`size-4`})}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`min-w-0 flex-1 text-left`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`truncate font-medium text-[0.875rem]`,children:t.name}),(0,R.jsx)(`span`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:t.id})]}),(0,R.jsxs)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:[t.domain,` · `,t.sourceKind===`mcp`?`MCP`:`OpenAPI`,` ·`,` `,_(ot[t.auth]),` ·`,` `,t.toolsPending?_(`connectors.pending`):_(`connectors.actions`,{n:t.actions.length,r:p})]})]}),n?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(k,{label:_(`connectors.refresh`),onClick:()=>u.mutate(),children:u.isPending?(0,R.jsx)(T,{className:`size-4`}):(0,R.jsx)(he,{className:`size-4`})}),(0,R.jsx)(k,{label:_(`connectors.remove`),className:`hover:text-rose`,onClick:()=>confirm(`${t.name}: ${_(`connectors.remove`)}?`)&&d.mutate(),children:(0,R.jsx)(pe,{className:`size-4`})})]})]}),t.needsOAuthClient?(0,R.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[0.75rem] text-rose`,children:_(`connectors.needsClient`)}):null,u.error??d.error?(0,R.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[0.75rem] text-rose`,children:(u.error??d.error).message}):null,a&&t.actions.length?(0,R.jsx)(`ul`,{className:`max-h-64 overflow-y-auto border-border-soft border-t px-3 py-2`,children:t.actions.map(e=>(0,R.jsxs)(`li`,{className:`flex items-baseline gap-2 py-1 text-[0.75rem]`,children:[(0,R.jsx)(`span`,{className:S(`w-14 shrink-0 text-[0.6875rem] uppercase tracking-wide`,e.group===`read`?`text-moss`:e.group===`write`?`text-ink-3`:`text-rose`),children:_(`connectors.group.${e.group}`)}),(0,R.jsx)(`span`,{className:`shrink-0 font-mono text-ink-2`,children:e.id}),(0,R.jsx)(`span`,{className:`min-w-0 truncate text-ink-4`,children:e.summary})]},e.id))}):null]})}function ct({projectId:e,domain:t,source:n,taken:i,onDone:a}){let o=r(),[s,c]=(0,L.useState)({id:``,secret:``}),[l,u]=(0,L.useState)(!1),d=i.includes(n.suggestedId),p=f({mutationFn:()=>m.post(`/api/studio/projects/${e}/connectors`,{domain:t,sourceKind:n.sourceKind,sourceUrl:n.sourceUrl,id:n.suggestedId,toolPrefix:n.suggestedToolPrefix,...n.name?{name:n.name}:{},...s.id&&s.secret?{oauthClientId:s.id,oauthClientSecret:s.secret}:{}}),onSuccess:async t=>{await o.invalidateQueries({queryKey:[`connectors`,e]}),a(t.warnings)}});return(0,R.jsxs)(`div`,{className:`rounded-lg bg-card p-3 ring-1 ring-border-soft`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,R.jsx)(A,{tone:n.sourceKind===`mcp`?`ember`:`neutral`,children:n.sourceKind===`mcp`?`MCP`:`OpenAPI`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`truncate text-[0.8125rem]`,children:n.name??n.suggestedId}),(0,R.jsx)(`div`,{className:`truncate font-mono text-[0.6875rem] text-ink-4`,children:n.sourceUrl})]}),n.blocked||d?null:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`text-[0.75rem] text-ink-3 hover:text-ink`,children:_(`connectors.ownClient`)}),(0,R.jsx)(M,{size:`sm`,busy:p.isPending,onClick:()=>p.mutate(),children:_(`connectors.import`)})]})]}),n.blocked?(0,R.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:n.blocked}):null,d?(0,R.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-ink-3`,children:_(`connectors.exists`)}):null,l?(0,R.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,R.jsx)(j,{placeholder:`OAuth Client-ID`,value:s.id,onChange:e=>c(t=>({...t,id:e.target.value}))}),(0,R.jsx)(j,{type:`password`,autoComplete:`off`,placeholder:`OAuth Client-Secret`,value:s.secret,onChange:e=>c(t=>({...t,secret:e.target.value}))})]}):null,p.error?(0,R.jsx)(`p`,{className:`mt-2 text-[0.75rem] text-rose`,children:p.error.message}):null]})}function lt({projectId:e,readOnly:t}){let n=be(`unsetConnectors`),[r,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(null),[l,u]=(0,L.useState)(null),[d,p]=(0,L.useState)([]),h=i({queryKey:[`connectors`,e],queryFn:()=>m.get(`/api/studio/projects/${e}/connectors`)}),g=f({mutationFn:()=>m.post(`/api/studio/connectors/search`,{query:r}),onSuccess:e=>{s(e),u(null),p([])}}),v=f({mutationFn:e=>m.get(`/api/studio/connectors/registry/${encodeURIComponent(e)}`),onSuccess:u}),b=h.data??[],x=b.filter(e=>e.sourceKind===`builtin`&&(n||e.usable)),S=b.filter(e=>e.sourceKind!==`builtin`);return(0,R.jsxs)(O,{className:`p-4 sm:p-6`,children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:_(`connectors.title`)}),(0,R.jsx)(`p`,{className:`mt-1 mb-5 text-[0.875rem] text-ink-3`,children:_(`connectors.hint`)}),x.length?(0,R.jsx)(`div`,{className:`mb-5 grid gap-1.5 sm:grid-cols-2`,children:x.map(e=>(0,R.jsx)(at,{connector:e},e.id))}):null,(0,R.jsx)(`h3`,{className:`mb-2 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.07em]`,children:_(`connectors.imported`)}),S.length?(0,R.jsx)(`div`,{className:`mb-4 flex flex-col gap-2`,children:S.map(n=>(0,R.jsx)(st,{projectId:e,connector:n,readOnly:t},n.id))}):null,t?S.length?null:(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:_(`connectors.noneImported`)}):(0,R.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),r.trim()&&g.mutate()},children:[(0,R.jsx)(j,{value:r,placeholder:_(`connectors.search`),onChange:e=>a(e.target.value)}),(0,R.jsxs)(M,{type:`submit`,variant:`secondary`,busy:g.isPending,children:[(0,R.jsx)(c,{className:`size-4`}),` `,_(`connectors.find`)]})]}),g.error?(0,R.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-rose`,children:g.error.message}):null,o&&!l?(0,R.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1`,children:[o.length?null:(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:_(`connectors.none`)}),o.map(e=>(0,R.jsxs)(`button`,{type:`button`,disabled:!e.kinds.length,onClick:()=>v.mutate(e.domain),className:`flex items-center gap-3 rounded-lg px-3 py-2 text-left transition hover:bg-paper-2 disabled:opacity-50`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:e.domain}),(0,R.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.description})]}),(0,R.jsx)(`span`,{className:`text-[0.6875rem] text-ink-4 uppercase`,children:e.kinds.join(` · `)}),(0,R.jsx)(y,{className:`-rotate-90 size-4 text-ink-4`})]},e.domain)),v.isPending?(0,R.jsx)(T,{className:`mx-auto mt-2 size-4 text-ink-4`}):null,v.error?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:v.error.message}):null]}):null,l?(0,R.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`div`,{className:`font-medium text-[0.875rem]`,children:l.domain}),(0,R.jsx)(`button`,{type:`button`,onClick:()=>u(null),className:`text-[0.75rem] text-ink-3 hover:text-ink`,children:_(`run.back`)})]}),l.summary?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:l.summary}):null,l.sources.map(t=>(0,R.jsx)(ct,{projectId:e,domain:l.domain,source:t,taken:b.map(e=>e.id),onDone:p},`${t.sourceKind}:${t.sourceUrl}`)),l.credentials.filter(e=>e.setup||e.url).map(e=>(0,R.jsxs)(`p`,{className:`text-[0.75rem] text-ink-3`,children:[(0,R.jsxs)(`span`,{className:`text-ink-2`,children:[e.label,`:`]}),` `,e.setup,` `,e.url?(0,R.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-ember underline`,children:e.url}):null]},e.label)),d.map(e=>(0,R.jsx)(`p`,{className:`text-[0.75rem] text-ink-3`,children:e},e))]}):null]})}var z=`engenty-wizards`,ut=`ENGENTY_WIZARDS_KEY`,dt=[{id:`claude-desktop`,name:`Claude Desktop`,widgets:!0},{id:`claude-code`,name:`Claude Code`,widgets:!1},{id:`codex`,name:`Codex · ChatGPT app`,widgets:!1},{id:`cursor`,name:`Cursor`,widgets:!0},{id:`vscode`,name:`VS Code (Copilot)`,widgets:!0},{id:`windsurf`,name:`Windsurf`,widgets:!1},{id:`gemini`,name:`Gemini CLI`,widgets:!1},{id:`goose`,name:`Goose`,widgets:!0},{id:`openclaw`,name:`OpenClaw`,widgets:!1},{id:`lm-studio`,name:`LM Studio`,widgets:!1},{id:`claude-ai`,name:`claude.ai`,widgets:!0,oauth:!0},{id:`chatgpt`,name:`ChatGPT`,widgets:!0,oauth:!0}];function B({text:e}){let[t,n]=(0,L.useState)(!1);return(0,R.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-paper-2 p-3`,children:[(0,R.jsx)(`code`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-[0.75rem] leading-relaxed`,children:e}),(0,R.jsx)(k,{label:_(t?`settings.copied`:`settings.copy`),onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,R.jsx)(h,{className:`size-4`}):(0,R.jsx)(le,{className:`size-4`})})]})}function ft(e){try{let t=new URL(e);return t.protocol===`https:`&&!/(^|\.)localhost$/.test(t.hostname)&&!/^(127\.|10\.|192\.168\.|\[::1\])/.test(t.hostname)}catch{return!1}}function V({children:e}){return(0,R.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:e})}function H({title:e,children:t}){return(0,R.jsxs)(`section`,{className:`flex flex-col gap-2.5 border-border-soft border-t pt-5 first:border-t-0 first:pt-0`,children:[(0,R.jsx)(`h3`,{className:`font-medium text-[0.9375rem]`,children:e}),t]})}function pt(e,t){return JSON.stringify({[e]:{[z]:t}},null,2)}function mt({id:e,url:t,apiKey:n}){let r=n?`Authorization: Bearer ${n}`:null,i=n?{headers:{Authorization:`Bearer ${n}`}}:{};switch(e){case`claude-code`:{let e=t.replace(/\/api\/mcp$/,`/api/claude-plugin`);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`mcp.terminal`)}),(0,R.jsx)(B,{text:`claude mcp add --transport http --scope user ${z} ${t}${r?` --header "${r}"`:``}`}),!n&&ft(t)?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`mcp.ccPlugin`)}),(0,R.jsx)(B,{text:`claude plugin marketplace add ${e}/marketplace.json`}),(0,R.jsx)(B,{text:`claude plugin install ${z}@engenty`})]}):null]})}case`codex`:return n?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`mcp.codexKey`)}),(0,R.jsx)(B,{text:`echo 'export ${ut}=${n}' >> ~/.zshrc && source ~/.zshrc`}),(0,R.jsx)(B,{text:`codex mcp add ${z} --url ${t} --bearer-token-env-var ${ut}`})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`mcp.terminal`)}),(0,R.jsx)(B,{text:`codex mcp add ${z} --url ${t}`}),(0,R.jsx)(B,{text:`codex mcp login ${z}`})]});case`gemini`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`mcp.terminal`)}),(0,R.jsx)(B,{text:`gemini mcp add --scope user --transport http ${z} ${t}${r?` -H "${r}"`:``}`})]});case`cursor`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`integrate.file`,{file:`~/.cursor/mcp.json`})}),(0,R.jsx)(B,{text:pt(`mcpServers`,{url:t,...i})})]});case`vscode`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`integrate.vscode`)}),(0,R.jsx)(B,{text:pt(`servers`,{type:`http`,url:t,...i})})]});case`windsurf`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`integrate.file`,{file:`~/.codeium/windsurf/mcp_config.json`})}),(0,R.jsx)(B,{text:pt(`mcpServers`,{serverUrl:t,...i})})]});case`lm-studio`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`integrate.file`,{file:`~/.lmstudio/mcp.json`})}),(0,R.jsx)(B,{text:pt(`mcpServers`,{url:t,...i})})]});case`claude-desktop`:case`claude-ai`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`mcp.claudeAi`)}),(0,R.jsx)(B,{text:t})]});case`chatgpt`:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`integrate.chatgpt`)}),(0,R.jsx)(B,{text:t})]});default:return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`integrate.generic`)}),(0,R.jsx)(B,{text:t}),r?(0,R.jsx)(B,{text:r}):null]})}}function ht(){let e=r(),t=i({queryKey:[`api-keys`],queryFn:()=>m.get(`/api/studio/api-keys`)}),n=f({mutationFn:e=>m.del(`/api/studio/api-keys/${e}`),onSuccess:()=>e.invalidateQueries({queryKey:[`api-keys`]})});return t.data?.length?(0,R.jsxs)(`section`,{children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:_(`mcp.keys`)}),(0,R.jsx)(`p`,{className:`mt-1 mb-4 text-[0.875rem] text-ink-3`,children:_(`mcp.keysHint`)}),(0,R.jsx)(O,{className:`flex flex-col gap-2 p-3`,children:t.data.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-3 py-2`,children:[(0,R.jsx)(I,{className:`size-4 shrink-0 text-ink-4`}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:e.name}),(0,R.jsxs)(`div`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:[e.start,`… ·`,` `,e.lastRequest?_(`settings.lastUsed`,{when:new Date(e.lastRequest).toLocaleString()}):_(`settings.neverUsed`)]})]}),(0,R.jsx)(k,{label:_(`settings.revoke`),onClick:()=>n.mutate(e.id),className:`hover:text-rose`,children:(0,R.jsx)(pe,{className:`size-4`})})]},e.id))})]}):null}function gt({state:e,title:t,children:n}){return(0,R.jsxs)(`li`,{className:`grid grid-cols-[22px_minmax(0,1fr)] gap-x-3`,children:[(0,R.jsx)(`span`,{className:S(`mt-0.5 grid size-[22px] place-items-center rounded-full`,e===`done`&&`bg-moss text-white`,e===`now`&&`bg-amber-tint text-ink-2`,e===`later`&&`bg-paper-2 ring-1 ring-border-soft`),children:e===`done`?(0,R.jsx)(h,{className:`size-3.5`,strokeWidth:3}):e===`now`?(0,R.jsx)(T,{className:`size-3`}):null}),(0,R.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 pb-4`,children:[(0,R.jsx)(`span`,{className:S(`text-[0.875rem]`,e===`later`?`text-ink-3`:`font-medium`),children:t}),e===`now`?n:null]})]})}function _t({widgets:e}){return(0,R.jsxs)(`p`,{className:`mt-1 flex flex-wrap items-center gap-x-4 gap-y-1 text-[0.8125rem] text-ink-3`,children:[(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:_(`integrate.kindMcp`),children:[(0,R.jsx)(Qe,{className:`size-3.5 text-ember-strong`}),(0,R.jsx)(`span`,{className:`font-medium text-ink-2`,children:`MCP`}),` `,_(`integrate.kindMcpShort`)]}),(0,R.jsxs)(`span`,{className:S(`inline-flex items-center gap-1.5`,e?null:`opacity-60`),title:_(e?`integrate.kindApp`:`integrate.kindAppNo`),children:[(0,R.jsx)(d,{className:S(`size-3.5`,e?`text-ember-strong`:`text-ink-4`)}),(0,R.jsx)(`span`,{className:`font-medium text-ink-2`,children:`MCP App`}),` `,_(e?`integrate.kindAppShort`:`integrate.kindAppNoShort`)]})]})}function vt({at:e,done:t}){let n=[_(`setup.stage.connect`),_(`setup.stage.test`),_(`setup.stage.done`)];return(0,R.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-medium text-[0.6875rem] uppercase tracking-[0.14em]`,children:n.map((n,r)=>{let i=t||r<e;return(0,R.jsxs)(`li`,{"aria-current":!i&&r===e?`step`:void 0,className:S(`flex items-center gap-1`,i?`text-moss`:r===e?`text-ember-strong`:`text-ink-4`),children:[i?(0,R.jsx)(h,{className:`size-3`,strokeWidth:3}):null,n]},n)})})}function yt({client:e,local:t,seen:n,managed:i,url:a}){let o=r(),s=ft(a),c=!i&&!!t&&!e.oauth,[l,d]=(0,L.useState)(c&&t?.installed!==!1?`here`:`address`),[p,g]=(0,L.useState)(null),[y,b]=(0,L.useState)(),x=f({mutationFn:t=>m.post(`/api/studio/local/apps/${e.id}`,{connect:t}),onSuccess:e=>g(e),onError:e=>g({ok:!1,message:e.message}),onSettled:()=>o.invalidateQueries({queryKey:[`local-apps`]})}),ee=f({mutationFn:()=>m.post(`/api/studio/api-keys`,{name:e.name.slice(0,32)}),onSuccess:async e=>{b(e.key),await o.invalidateQueries({queryKey:[`api-keys`]})}}),C=e.oauth===!0||e.id===`claude-desktop`,w=l===`address`&&C&&!(i&&s),T=l===`here`?!!t?.connected:i||!!y,te=!!n?.toolAt,E=te?2:T||n?1:0,D=e=>(0,R.jsx)(B,{text:e});return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight`,children:e.name}),(0,R.jsx)(_t,{widgets:e.widgets})]}),(0,R.jsx)(vt,{at:E,done:te})]}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[c||!e.oauth?(0,R.jsx)(`fieldset`,{"aria-label":_(`integrate.where`),className:`min-w-0`,children:(0,R.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[`here`,`address`].map(e=>{let t=e===`here`&&!c;return(0,R.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>d(e),"aria-pressed":l===e,className:S(`flex items-start gap-3 rounded-xl px-3.5 py-2.5 text-left ring-1 transition`,l===e?`bg-ember-tint/50 ring-ember-strong/40`:`ring-border-soft hover:bg-accent`,t&&`cursor-not-allowed opacity-50 hover:bg-transparent`),children:[e===`here`?(0,R.jsx)(Se,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}):(0,R.jsx)(u,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,R.jsxs)(`span`,{className:`min-w-0`,children:[(0,R.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:_(e===`here`?`integrate.here`:`integrate.address`)}),(0,R.jsx)(`span`,{className:`block text-[0.75rem] text-ink-3`,children:_(e===`here`?i?`integrate.hereManaged`:`integrate.hereHint`:`integrate.addressHint`)})]})]},e)})})}):null,w?(0,R.jsx)(H,{title:_(`mcp.notHere`),children:(0,R.jsx)(V,{children:_(i?`mcp.needsPublic`:`integrate.oauthLocal`)})}):l===`here`?(0,R.jsxs)(H,{title:_(`integrate.connectTitle`),children:[t?.installed===!1&&!t.connected?(0,R.jsx)(V,{children:_(`integrate.notInstalled`,{app:e.name})}):null,t?.connected?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2 text-[0.875rem] text-ink-2`,children:[(0,R.jsx)(h,{className:`size-4 text-moss`}),_(`integrate.connected`,{app:e.name})]}),(0,R.jsx)(M,{size:`sm`,variant:`ghost`,busy:x.isPending&&x.variables===!1,onClick:()=>x.mutate(!1),children:_(`mcp.appsDisconnect`)})]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`integrate.connectHint`,{app:e.name})}),(0,R.jsx)(`div`,{children:(0,R.jsxs)(M,{busy:x.isPending,onClick:()=>x.mutate(!0),children:[(0,R.jsx)(v,{className:`size-4`}),` `,_(`integrate.connect`,{app:e.name})]})})]}),p&&!p.ok?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:p.message}):null,p?.snippet?(0,R.jsx)(B,{text:p.snippet}):null,t?.where?(0,R.jsx)(`p`,{className:`font-mono text-[0.6875rem] text-ink-4`,children:t.where}):null]}):(0,R.jsxs)(R.Fragment,{children:[i||C?null:(0,R.jsx)(H,{title:_(`mcp.keyTitle`),children:y?(0,R.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.875rem] text-ink-2`,children:[(0,R.jsx)(h,{className:`size-4 text-moss`}),` `,_(`mcp.keyReady`)]}):(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(V,{children:_(`mcp.keyHint`)}),(0,R.jsx)(`div`,{children:(0,R.jsxs)(M,{variant:`secondary`,busy:ee.isPending,onClick:()=>ee.mutate(),children:[(0,R.jsx)(v,{className:`size-4`}),` `,_(`mcp.keyCreate`,{client:e.name})]})})]})}),(0,R.jsxs)(H,{title:_(`mcp.add`),children:[i||y||C?(0,R.jsx)(mt,{id:e.id,url:a,apiKey:y}):(0,R.jsx)(V,{children:_(`mcp.keyFirst`)}),i?(0,R.jsx)(V,{children:_(`mcp.oauth`)}):null,(0,R.jsx)(`p`,{className:`text-[0.75rem] text-ink-4`,children:_(s?`mcp.addressPublic`:`mcp.addressLocal`)})]})]}),w?null:(0,R.jsxs)(H,{title:_(`integrate.test`),children:[(0,R.jsxs)(`ol`,{className:`flex flex-col`,children:[(0,R.jsx)(gt,{state:n?`done`:T?`now`:`later`,title:_(`integrate.seen`,{app:e.name}),children:(0,R.jsx)(V,{children:_(l===`here`?`integrate.restart`:`integrate.reload`,{app:e.name})})}),(0,R.jsxs)(gt,{state:n?.toolAt?`done`:n?`now`:`later`,title:_(`integrate.tool`),children:[(0,R.jsx)(V,{children:_(`integrate.askHint`,{app:e.name})}),D(_(`integrate.askTool`))]}),e.widgets?(0,R.jsxs)(gt,{state:n?.widgetAt?`done`:n?.toolAt?`now`:`later`,title:_(`integrate.widget`),children:[(0,R.jsx)(V,{children:_(`integrate.widgetHint`)}),D(_(`integrate.askWidget`))]}):null]}),te?(0,R.jsxs)(`p`,{className:`flex items-center gap-2 font-medium text-[0.875rem] text-moss`,children:[(0,R.jsx)(h,{className:`size-4`,strokeWidth:3}),_(`integrate.works`,{app:e.name})]}):null]})]})]})}function bt(){let e=ge(),t=e.data?.mode===`managed`,n=i({queryKey:[`local-apps`],queryFn:()=>m.get(`/api/studio/local/apps`),enabled:e.data?.mode===`local`}),r=i({queryKey:[`integrations-seen`],queryFn:()=>m.get(`/api/studio/integrations/seen`),refetchInterval:2500}),[a,o]=C(),{narrow:s}=Me(),c=a.get(`show`),l=e=>n.data?.find(t=>t.id===e),f=e=>r.data?.[e],p=e=>{let t=l(e);return t?.installed||t?.connected?0:1},h=[...dt].sort((e,t)=>p(e.id)-p(t.id)),g=h.find(e=>e.id===c)??h[0];if(Pe(c||!s?g.name:null),!e.data||!t&&!n.data)return null;let v=e.data.mcpUrl??``,y=e=>{let t=l(e);return f(e)?.toolAt?{tone:`done`,toneLabel:_(`integrate.stateWorks`)}:t?.connected?{tone:`on`,toneLabel:_(`integrate.stateConnected`)}:t?.installed?{tone:`off`,toneLabel:_(`integrate.stateInstalled`)}:{}},b=e=>!(!c&&s)&&e===g.id;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-10`,children:[(0,R.jsxs)(Re,{children:[(0,R.jsx)(F,{label:_(`integrate.groupApps`),children:h.map(e=>(0,R.jsx)(P,{icon:e.widgets?d:Qe,label:e.name,...y(e.id),selected:b(e.id),onPick:()=>o({show:e.id},{replace:!s})},e.id))}),(0,R.jsxs)(F,{label:_(`integrate.groupShare`),children:[(0,R.jsx)(P,{icon:fe,label:_(`integrate.shareLink`),badge:(0,R.jsx)(`span`,{className:`text-[0.6875rem] text-ink-4`,children:_(`integrate.soon`)}),selected:!1,disabled:!0}),(0,R.jsx)(P,{icon:u,label:_(`integrate.shareSite`),badge:(0,R.jsx)(`span`,{className:`text-[0.6875rem] text-ink-4`,children:_(`integrate.soon`)}),selected:!1,disabled:!0})]})]}),(0,R.jsx)(yt,{client:g,local:l(g.id),seen:f(g.id),managed:t,url:v},g.id),t?null:(0,R.jsx)(ht,{}),(0,R.jsxs)(`p`,{className:`flex items-start gap-2 text-[0.8125rem] text-ink-3`,children:[(0,R.jsx)(fe,{className:`mt-0.5 size-3.5 shrink-0`}),_(`mcp.notReverse`)]})]})}var xt=[`text`,`image`,`video`,`speech`,`listening`],St={text:[`classifier`,`standard`,`high`,`highest`],image:[`image`],video:[`video`],speech:[`speech`],listening:[`audio`]},Ct=`credits`,wt=`${Ct}:`;function Tt(e){return e===`credits`||!!e?.startsWith(wt)}function Et(e){return e?.startsWith(wt)&&e.slice(wt.length)||null}function Dt(e){return e?`${wt}${e}`:Ct}function Ot(e){return e===`transcription`?`listening`:e}var kt=[`openai`,`anthropic`,`google`,`fal`,`elevenlabs`,`replicate`,`gateway`],U=(e,t)=>({de:e,en:t}),W=[{id:`openai`,name:`OpenAI`,about:U(`GPT-Modelle, GPT Image und Stimmen.`,`GPT models, GPT Image and voices.`),keyUrl:`https://platform.openai.com/api-keys`,keyPlaceholder:`sk-…`,text:{classifier:`openai:gpt-5.4-mini`,standard:`openai:gpt-5.4-mini`,high:`openai:gpt-5.5`,highest:`openai:gpt-5.5`},models:{text:[{ref:`openai:gpt-5.4-mini`,label:`GPT-5.4 mini`,note:U(`schnell`,`fast`)},{ref:`openai:gpt-5.5`,label:`GPT-5.5`,note:U(`gründlich`,`thorough`)}],image:[{ref:`openai:gpt-image-2`,label:`GPT Image 2`,note:U(`vielseitig`,`versatile`)},{ref:`openai:gpt-image-1-mini`,label:`GPT Image 1 mini`,note:U(`günstig`,`low cost`)}],speech:[{ref:`openai:gpt-4o-mini-tts`,label:`GPT-4o mini TTS`,note:U(`günstig`,`low cost`)}],listening:[{ref:`openai:gpt-4o-mini-transcribe`,label:`GPT-4o mini Transcribe`,note:U(`schnell, günstig`,`fast, low cost`)},{ref:`openai:whisper-1`,label:`Whisper`}]}},{id:`anthropic`,name:`Anthropic`,about:U(`Die Claude-Modelle.`,`The Claude models.`),keyUrl:`https://console.anthropic.com/settings/keys`,keyPlaceholder:`sk-ant-…`,text:{classifier:`anthropic:claude-haiku-4-5`,standard:`anthropic:claude-haiku-4-5`,high:`anthropic:claude-sonnet-5-5`,highest:`anthropic:claude-opus-5-5`},models:{text:[{ref:`anthropic:claude-haiku-4-5`,label:`Claude Haiku 4.5`,note:U(`schnell`,`fast`)},{ref:`anthropic:claude-sonnet-5-5`,label:`Claude Sonnet 5.5`},{ref:`anthropic:claude-opus-5-5`,label:`Claude Opus 5.5`,note:U(`am stärksten`,`strongest`)}]}},{id:`google`,name:`Google Gemini`,about:U(`Gemini, Veo für Videos und Stimmen – ein Key aus dem AI Studio.`,`Gemini, Veo for video and voices – one key from AI Studio.`),keyUrl:`https://aistudio.google.com/apikey`,keyPlaceholder:`AIza…`,text:{classifier:`google:gemini-flash-lite-latest`,standard:`google:gemini-flash-latest`,high:`google:gemini-pro-latest`,highest:`google:gemini-pro-latest`},models:{text:[{ref:`google:gemini-flash-lite-latest`,label:`Gemini Flash-Lite`,note:U(`günstig`,`low cost`)},{ref:`google:gemini-flash-latest`,label:`Gemini Flash`},{ref:`google:gemini-pro-latest`,label:`Gemini Pro`,note:U(`gründlich`,`thorough`)}],image:[{ref:`google:gemini-3.1-flash-image-preview`,label:`Gemini 3.1 Flash Image`,note:U(`schnell, bearbeitet Fotos`,`fast, edits photos`)},{ref:`google:gemini-3-pro-image-preview`,label:`Gemini 3 Pro Image`,note:U(`beste Qualität`,`best quality`)}],video:[{ref:`google:veo-3.1-fast-generate-preview`,label:`Veo 3.1 Fast`,note:U(`mit Ton`,`with sound`)},{ref:`google:veo-3.1-generate-preview`,label:`Veo 3.1`,note:U(`beste Qualität`,`best quality`)}],speech:[{ref:`google:gemini-3.8-flash-tts`,label:`Gemini Flash TTS`}],listening:[{ref:`google:gemini-flash-lite-latest`,label:`Gemini Flash-Lite`}]}},{id:`fal`,name:`fal.ai`,about:U(`Hunderte Bild-, Video- und Audio-Modelle mit einem Key: FLUX, Recraft, Veo, Luma, MiniMax.`,`Hundreds of image, video and audio models with one key: FLUX, Recraft, Veo, Luma, MiniMax.`),keyUrl:`https://fal.ai/dashboard/keys`,keyPlaceholder:`xxxxxxxx-…:…`,models:{image:[{ref:`fal:fal-ai/flux/schnell`,label:`FLUX.1 schnell`,note:U(`schnell, günstig`,`fast, low cost`)},{ref:`fal:fal-ai/flux-pro/v1.1`,label:`FLUX 1.1 pro`,note:U(`hohe Qualität`,`high quality`)},{ref:`fal:fal-ai/recraft/v3/text-to-image`,label:`Recraft V3`,note:U(`Grafiken, Logos, Text im Bild`,`graphics, logos, text in images`)},{ref:`fal:fal-ai/imagen4/preview`,label:`Imagen 4`,note:U(`fotorealistisch`,`photorealistic`)}],video:[{ref:`fal:veo3/fast`,label:`Veo 3 Fast`,note:U(`mit Ton`,`with sound`)},{ref:`fal:luma-ray-2-flash`,label:`Luma Ray 2 Flash`,note:U(`schnell`,`fast`)},{ref:`fal:minimax-video`,label:`MiniMax Hailuo`}],speech:[{ref:`fal:fal-ai/minimax/speech-02-turbo`,label:`MiniMax Speech-02 Turbo`,note:U(`schnell`,`fast`)},{ref:`fal:fal-ai/minimax/speech-02-hd`,label:`MiniMax Speech-02 HD`}],listening:[{ref:`fal:wizper`,label:`Wizper`,note:U(`schnell`,`fast`)},{ref:`fal:whisper`,label:`Whisper`}]}},{id:`elevenlabs`,name:`ElevenLabs`,about:U(`Natürliche Stimmen in vielen Sprachen und genaue Transkripte.`,`Natural voices in many languages and accurate transcripts.`),keyUrl:`https://elevenlabs.io/app/settings/api-keys`,keyPlaceholder:`sk_…`,models:{speech:[{ref:`elevenlabs:eleven_multilingual_v2`,label:`Multilingual v2`,note:U(`natürlich, viele Sprachen`,`natural, many languages`)},{ref:`elevenlabs:eleven_flash_v2_5`,label:`Flash v2.5`,note:U(`schnell, günstig`,`fast, low cost`)},{ref:`elevenlabs:eleven_v3`,label:`Eleven v3`,note:U(`ausdrucksstark`,`expressive`)}],listening:[{ref:`elevenlabs:scribe_v2`,label:`Scribe v2`,note:U(`sehr genau`,`very accurate`)}]}},{id:`replicate`,name:`Replicate`,about:U(`Offene Bild- und Video-Modelle, abgerechnet pro Lauf.`,`Open image and video models, billed per run.`),keyUrl:`https://replicate.com/account/api-tokens`,keyPlaceholder:`r8_…`,models:{image:[{ref:`replicate:black-forest-labs/flux-schnell`,label:`FLUX.1 schnell`,note:U(`schnell, günstig`,`fast, low cost`)},{ref:`replicate:black-forest-labs/flux-1.1-pro`,label:`FLUX 1.1 pro`},{ref:`replicate:recraft-ai/recraft-v3`,label:`Recraft V3`}],video:[{ref:`replicate:minimax/video-01`,label:`MiniMax Video-01`}]}},{id:`gateway`,name:`Vercel AI Gateway`,about:U(`Ein Key für die Modelle vieler Anbieter, abgerechnet bei Vercel.`,`One key for many providers' models, billed by Vercel.`),keyUrl:`https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai-gateway%2Fapi-keys`,keyPlaceholder:`vck_…`,text:{classifier:`anthropic/claude-haiku-4.5`,standard:`anthropic/claude-haiku-4.5`,high:`anthropic/claude-sonnet-5.5`,highest:`anthropic/claude-sonnet-5.5`},models:{text:[{ref:`anthropic/claude-haiku-4.5`,label:`Claude Haiku 4.5`,note:U(`schnell`,`fast`)},{ref:`anthropic/claude-sonnet-5.5`,label:`Claude Sonnet 5.5`},{ref:`openai/gpt-5.5`,label:`GPT-5.5`},{ref:`google/gemini-3.5-flash`,label:`Gemini 3.5 Flash`}],image:[{ref:`google/gemini-3.1-flash-image`,label:`Gemini 3.1 Flash Image`}],video:[{ref:`google/veo-3.1-fast-generate-001`,label:`Veo 3.1 Fast`,note:U(`mit Ton`,`with sound`)}],speech:[{ref:`google/gemini-3.8-flash-tts`,label:`Gemini Flash TTS`}],listening:[{ref:`google/gemini-3.5-flash-lite`,label:`Gemini 3.5 Flash-Lite`}]}}];function G(e){return W.find(t=>t.id===e)??null}function At(e){if(Tt(e))return null;let t=/^([a-z]+):/.exec(e)?.[1];return t?kt.includes(t)?t:null:e?.includes(`/`)?`gateway`:null}function K(e){for(let t of W)for(let n of Object.values(t.models)){let t=n?.find(t=>t.ref===e);if(t)return t.label}return e.replace(/^[a-z]+:/,``)}function jt(e,t){let n=t===`auto`?e.mode===`managed`:t===`cloud`,r=t===`auto`||t===`linked`?e.account??(t===`linked`?{name:e.user.name,email:e.user.email,credits:1250,expiring:[],url:``,cloudUrl:``,signedIn:!0}:null):null;return{cloud:n,account:n?null:r,credits:n||!!r?.signedIn,balance:n?e.credits??(t===`cloud`?1250:null):r?.credits??null,topUp:Te(e),harnesses:n?[]:e.harnesses,canEdit:!n||e.tenant.role!==`member`,ownKeys:!n||e.features.ownKeys!==!1}}var q={text:ue,image:o,video:a,speech:de,listening:Ge},J={text:`standard`,image:`image`,video:`video`,speech:`speech`,listening:`audio`},Y=e=>e===`text`,Mt=(e,t)=>e?.[t]??``;function Nt(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Pt(e,t,n){let r=J[t];if(Y(t)&&!n.cloud){if(e.source===`account`)return{kind:`credits`};if(e.source!==`own`)return{kind:`client`,id:e.source}}let i=e.bindings[r];if(Tt(i))return{kind:`credits`};if(i?.startsWith(`ollama:`))return{kind:`local`};let a=i?At(i):null;if(a)return{kind:`key`,provider:a};if(i&&/^(claude|codex|gemini|cursor)\//.test(i))return{kind:`client`,id:i.split(`/`)[0]};let o=e.ways[r];switch(o.kind){case`client`:return{kind:`client`,id:o.by};case`key`:return G(o.by??``)?{kind:`key`,provider:o.by}:null;case`local`:return{kind:`local`};case`credits`:return{kind:`credits`};default:return null}}function Ft(e,t,n){if(Y(t)&&e.text)return e.text;let r=J[t],i=n.bindings[r],a=i&&At(i)===e.id?i:e.models[t]?.[0]?.ref;return a?{[r]:a}:{}}function It(e){return e.version===null?{note:_(`models.noteMissing`),noteTone:`warn`}:e.auth===`none`?{note:_(`models.noteSignedOut`),noteTone:`warn`}:e.auth===`api_key`?{note:_(`models.noteShellKey`)}:{note:_(`models.noteIncluded`),noteTone:`done`}}function Lt(e,t){switch(e.kind){case`client`:return{text:t.harnesses.find(t=>t.id===e.by)?.name??e.by??``,tone:`done`};case`key`:return{text:G(e.by??``)?.name??e.by??``,tone:`done`};case`local`:return{text:_(`models.way.local`),tone:`done`};case`credits`:return{text:t.cloud?_(`models.way.creditsTeam`):_(`models.way.credits`),tone:`ok`};default:return{text:_(`models.way.none`),tone:`warn`}}}function Rt(){return i({queryKey:[`models`],queryFn:()=>m.get(`/api/studio/models`)})}function X(){let e=r();return f({mutationFn:e=>m.put(`/api/studio/models`,e),onSuccess:async t=>{e.setQueryData([`models`],t),await e.invalidateQueries({queryKey:[`me`]})}})}function Z({title:e,aside:t,children:n}){return(0,R.jsxs)(`section`,{className:`flex flex-col gap-3 border-border-soft border-t pt-5 first:border-t-0 first:pt-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,R.jsx)(`h3`,{className:`font-medium text-[0.875rem]`,children:e}),t]}),n]})}function Q({children:e}){return(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:e})}function zt({text:e,tone:t}){return(0,R.jsxs)(`span`,{className:S(`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full px-3 font-medium text-[0.75rem]`,t===`done`&&`bg-moss-tint text-moss`,t===`ok`&&`bg-amber-tint text-ink-2`,t===`warn`&&`bg-paper-2 text-ink-3`),children:[t===`done`?(0,R.jsx)(h,{className:`size-3.5`,strokeWidth:3}):null,t===`ok`?(0,R.jsx)(s,{className:`size-3.5`}):null,t===`warn`?(0,R.jsx)(ce,{className:`size-3.5`}):null,e]})}function $({icon:e,title:t,lead:n,status:r}){return(0,R.jsxs)(`div`,{className:`flex items-start gap-3 sm:gap-4`,children:[(0,R.jsx)(`span`,{className:`grid size-10 shrink-0 place-items-center rounded-xl bg-ember-tint text-ember-strong`,children:(0,R.jsx)(e,{className:`size-5`})}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight`,children:t}),r]}),(0,R.jsx)(`p`,{className:`mt-0.5 text-[0.875rem] text-ink-3`,children:n})]})]})}function Bt({label:e,children:t}){return(0,R.jsxs)(`div`,{className:`grid items-start gap-x-4 gap-y-1.5 sm:grid-cols-[7.5rem_minmax(0,1fr)]`,children:[(0,R.jsx)(`span`,{className:`pt-2 text-[0.75rem] text-ink-3`,children:e}),(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t})]})}function Vt({selected:e,title:t,note:n,noteTone:r,disabled:i,onPick:a}){return(0,R.jsxs)(`button`,{type:`button`,onClick:a,disabled:i,"aria-pressed":e,title:n,className:S(`inline-flex h-9 items-center gap-1.5 rounded-full border px-3.5 text-[0.8125rem] transition coarse:h-11`,e?`border-ember bg-ember-tint font-medium text-ink`:r===`done`?`border-input bg-card text-ink hover:border-ink-4`:`border-border-soft border-dashed text-ink-3 hover:border-ink-4 hover:text-ink`,i&&`cursor-not-allowed opacity-50`),children:[r===`done`?(0,R.jsx)(h,{className:`size-3.5 text-moss`,strokeWidth:3}):null,t,(0,R.jsxs)(`span`,{className:`sr-only`,children:[`: `,n]})]})}function Ht({provider:e,stored:t,place:n}){let r=X(),[i,a]=(0,L.useState)(``),[o,s]=(0,L.useState)(!1),[c,l]=(0,L.useState)(null),u=f({mutationFn:t=>m.post(`/api/studio/models/keys/${e.id}/check`,t?{key:t}:{})}),d=async()=>{l(null);let t=await u.mutateAsync(i.trim());if(!t.ok){l({ok:!1,message:t.message??_(`models.keyBad`)});return}await r.mutateAsync({keys:{[e.id]:i.trim()}}),a(``),s(!1),l({ok:!0,message:_(`models.keyOk`)})},p=!t||o;return n.ownKeys?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[p?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(j,{type:`password`,autoComplete:`off`,className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,placeholder:e.keyPlaceholder,value:i,disabled:!n.canEdit,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&i.trim()&&d()}}),(0,R.jsx)(M,{busy:u.isPending||r.isPending,disabled:!i.trim()||!n.canEdit,onClick:()=>void d(),children:_(`models.keySave`)}),o?(0,R.jsx)(M,{variant:`ghost`,onClick:()=>s(!1),children:_(`common.cancel`)}):null]}):(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,R.jsxs)(`span`,{className:`flex items-center gap-2 text-[0.875rem] text-ink-2`,children:[(0,R.jsx)(I,{className:`size-4 text-moss`}),` `,_(`models.keyStored`)]}),(0,R.jsx)(M,{size:`sm`,variant:`ghost`,busy:u.isPending,onClick:async()=>{let e=await u.mutateAsync(void 0);l(e.ok?{ok:!0,message:_(`models.keyOk`)}:{ok:!1,message:e.message??_(`models.keyBad`)})},children:_(`models.keyCheck`)}),n.canEdit?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(M,{size:`sm`,variant:`ghost`,onClick:()=>s(!0),children:_(`models.keyReplace`)}),(0,R.jsx)(M,{size:`sm`,variant:`danger`,busy:r.isPending,onClick:()=>{l(null),r.mutate({keys:{[e.id]:``}})},children:_(`models.keyRemove`)})]}):null]}),c?(0,R.jsxs)(`p`,{className:S(`flex items-center gap-1.5 text-[0.8125rem]`,c.ok?`text-moss`:`text-rose`),children:[c.ok?(0,R.jsx)(h,{className:`size-3.5`,strokeWidth:3}):null,c.message]}):null,(0,R.jsxs)(`p`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[0.75rem] text-ink-4`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>xe(e.keyUrl),className:`inline-flex items-center gap-1 font-medium text-ember-strong hover:underline`,children:[_(`models.keyGet`,{name:e.name}),` `,(0,R.jsx)(N,{className:`size-3`})]}),(0,R.jsx)(`span`,{children:n.cloud?_(`models.keyWhereCloud`):_(`models.keyWhereLocal`)})]})]}):(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:_(`models.ownKeysPlan`)})}var Ut=`__custom__`;function Wt({provider:e,cap:t,value:n,onPick:r,disabled:i}){let a=g,o=e.models[t]??[],s=o.some(e=>e.ref===n),[c,l]=(0,L.useState)(!s&&!!n),[u,d]=(0,L.useState)(s?``:n.replace(/^[a-z]+:/,``)),f=e.id===`gateway`?``:`${e.id}:`;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsx)(w,{value:c?Ut:n,onChange:e=>{if(e===Ut){l(!0);return}l(!1),r(e)},options:[...o.map(e=>({value:e.ref,label:e.note?`${e.label} – ${Mt(e.note,a)}`:e.label})),{value:Ut,label:_(`models.modelCustom`)}]}),c?(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsx)(j,{className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,value:u,disabled:i,placeholder:o[0]?.ref.replace(/^[a-z]+:/,``)??``,onChange:e=>d(e.target.value)}),(0,R.jsx)(M,{variant:`secondary`,disabled:!u.trim()||i,onClick:()=>r(`${f}${u.trim()}`),children:_(`settings.save`)})]}):null]})}function Gt({provider:e,state:t}){let n=n=>K(t.bindings[n]??e.text?.[n]??``);return(0,R.jsxs)(`dl`,{className:`grid grid-cols-[auto_minmax(0,1fr)] gap-x-4 gap-y-1 text-[0.875rem]`,children:[(0,R.jsx)(`dt`,{className:`text-ink-3`,children:_(`models.textSimple`)}),(0,R.jsx)(`dd`,{className:`truncate font-medium`,children:n(`standard`)}),(0,R.jsx)(`dt`,{className:`text-ink-3`,children:_(`models.textDemanding`)}),(0,R.jsx)(`dd`,{className:`truncate font-medium`,children:n(`high`)})]})}function Kt({provider:e,state:t,onPick:n,disabled:r}){return(0,R.jsxs)(`details`,{className:`group rounded-lg ring-1 ring-border-soft`,children:[(0,R.jsx)(`summary`,{className:`cursor-pointer list-none px-3 py-2.5 text-[0.8125rem] text-ink-2 hover:text-ink`,children:(0,R.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,R.jsx)(re,{className:`size-3.5 transition group-open:rotate-90`}),_(`models.perClass`)]})}),(0,R.jsx)(`div`,{className:`flex flex-col gap-3 px-3 pt-1 pb-3`,children:me.map(i=>(0,R.jsxs)(`div`,{className:`grid items-center gap-2 sm:grid-cols-[9rem_minmax(0,1fr)]`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[0.8125rem] text-ink-2`,children:_(`class.${i}`)}),(0,R.jsx)(`div`,{className:`text-[0.6875rem] text-ink-4 leading-snug`,children:_(`class.${i}.hint`)})]}),(0,R.jsx)(Wt,{provider:e,cap:`text`,value:t.bindings[i]??e.text?.[i]??``,disabled:r,onPick:e=>n(i,e)})]},i))})]})}function qt({cap:e,disabled:t}){let n=J[e],r=f({mutationFn:()=>m.post(`/api/studio/models/test`,{cls:n,lang:g})}),i=r.data;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,R.jsx)(M,{variant:`secondary`,busy:r.isPending,disabled:t,onClick:()=>r.mutate(),children:_(`models.try.${e}`)}),(0,R.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:e===`video`?_(`models.tryCostVideo`):Y(e)?null:_(`models.tryCost`)})]}),r.isPending&&e!==`text`?(0,R.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,R.jsx)(T,{className:`size-3.5`}),` `,_(e===`video`?`models.tryWaitVideo`:`models.tryWait`)]}):null,i?.ok?(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[i.media&&e===`image`?(0,R.jsx)(`img`,{src:i.media,alt:``,className:`size-48 rounded-lg object-cover ring-1 ring-border-soft`}):null,i.media&&e===`speech`?(0,R.jsx)(`audio`,{src:i.media,controls:!0,autoPlay:!0,className:`w-full max-w-sm`}):null,i.media&&e===`video`?(0,R.jsx)(`video`,{src:i.media,controls:!0,autoPlay:!0,muted:!0,className:`w-full max-w-md rounded-lg`}):null,(0,R.jsxs)(`p`,{className:`flex items-start gap-2 text-[0.8125rem] text-ink-2`,children:[(0,R.jsx)(h,{className:`mt-0.5 size-3.5 shrink-0 text-moss`,strokeWidth:3}),(0,R.jsx)(`span`,{children:e===`listening`?i.reply?_(`models.tryHeard`,{text:i.reply}):_(`models.tryHeardNothing`):Y(e)?_(`local.testOk`,{s:(i.ms/1e3).toFixed(1),ref:K(i.ref??``),reply:i.reply??``}):_(`models.tryOk`,{s:(i.ms/1e3).toFixed(1),model:K(i.ref??``)})})]})]}):null,i&&!i.ok?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:_(`models.tryFailed`,{error:i.error??``})}):null,r.isError?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:_(`models.tryFailed`,{error:r.error.message})}):null]})}function Jt(e){let t=e=>(e<10?Math.round(e*10)/10:Math.ceil(e)).toLocaleString();return e?.creditsPerImage?_(`models.notePerImage`,{n:t(e.creditsPerImage)}):e?.creditsPerSecond?_(`models.notePerSecond`,{n:t(e.creditsPerSecond)}):e?.creditsPer1kCharacters?_(`models.notePer1k`,{n:t(e.creditsPer1kCharacters)}):e?.creditsPerMinute?_(`models.notePerMinute`,{n:t(e.creditsPerMinute)}):_(`models.noteUsage`)}function Yt(e,t){let n=Et(t.bindings[J[e]]);return Jt((n?t.creditModels.find(e=>e.id===n):null)??t.prices?.[J[e]])}function Xt(e,t,n){return e.creditModels.filter(e=>Ot(e.kind)===t&&(!n||e.source===n||e.provider===n))}function Zt({cap:e,state:t,disabled:n}){let r=X(),i=J[e],a=Et(t.bindings[i]),o=Xt(t,e),s=t.prices?.[i]?.model,c=e=>e.source===`ai-gateway`?G(e.provider)?.name??e.provider:G(e.source)?.name??e.source;return(0,R.jsx)(w,{value:a??``,onChange:e=>r.mutate({bindings:{[i]:Dt(e||null)}}),options:[{value:``,label:s?_(`models.creditsAuto`,{model:K(s)}):_(`models.creditsAutoNone`)},...o.map(e=>({value:e.id,label:`${e.name} · ${c(e)} – ${Jt(e)}`,disabled:n}))]})}function Qt({models:e,state:t,place:n}){let r=X();return(0,R.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:e.map(e=>{let i=Ot(e.kind),a=J[i],o=t.bindings[a]===Dt(e.id);return(0,R.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 py-2.5`,children:[(0,R.jsx)(s,{className:`size-4 shrink-0 text-ink-3`}),(0,R.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:e.name}),(0,R.jsxs)(`span`,{className:`block text-[0.75rem] text-ink-3`,children:[_(`models.cap.${i}`),` · `,Jt(e)]})]}),o?(0,R.jsxs)(`span`,{className:`flex items-center gap-1 font-medium text-[0.75rem] text-moss`,children:[(0,R.jsx)(h,{className:`size-3.5`,strokeWidth:3}),` `,_(`models.inUse`)]}):(0,R.jsx)(M,{size:`sm`,variant:`secondary`,disabled:!n.canEdit||!n.credits,busy:r.isPending&&r.variables?.bindings?.[a]===Dt(e.id),onClick:()=>r.mutate({bindings:{[a]:Dt(e.id)}}),children:_(`models.useFor`)})]},e.id)})})}function $t({cap:e,state:t,place:n,me:r,onOpen:i}){let a=X(),o=J[e],c=t.ways[o],l=Pt(t,e,n),[u,d]=(0,L.useState)(!1),f=Lt(c,n),p=n.harnesses.filter(t=>(Y(e)||e===`image`&&t.images)&&(t.version!==null||l?.kind===`client`&&l.id===t.id)),m=W.filter(t=>t.models[e]?.length),h=r=>{if(d(!1),r.kind===`credits`&&!n.credits){d(!0);return}if(Nt(r,l))return;let i=St[e],s=e=>Object.fromEntries(i.map(t=>[t,e]));switch(r.kind){case`client`:a.mutate(Y(e)?{source:r.id}:{bindings:{[o]:`${r.id}/image`}});return;case`key`:{let i=G(r.provider);a.mutate({...Y(e)&&!n.cloud?{source:`own`}:{},bindings:Ft(i,e,t)});return}case`local`:a.mutate({source:`own`,bindings:s(`ollama:qwen3`)});return;case`credits`:a.mutate(Y(e)&&!n.cloud?{source:`account`}:{bindings:s(Ct)});return}},g=l?.kind===`key`?G(l.provider):null,v=g?!t.keys[g.id]:!1,y=l?.kind===`client`?n.harnesses.find(e=>e.id===l.id):null,b=c.kind!==`none`;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)($,{icon:q[e],title:_(`models.cap.${e}`),lead:_(`models.cap.${e}.hint`),status:(0,R.jsx)(zt,{...f})}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[(0,R.jsxs)(Z,{title:_(`models.who`),children:[(0,R.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p.length?(0,R.jsx)(Bt,{label:_(`models.optSubscription`),children:p.map(e=>(0,R.jsx)(Vt,{title:e.name,...It(e),selected:l?.kind===`client`&&l.id===e.id,disabled:!n.canEdit,onPick:()=>h({kind:`client`,id:e.id})},e.id))}):null,(0,R.jsx)(Bt,{label:_(`models.optKey`),children:m.map(e=>(0,R.jsx)(Vt,{title:e.name,note:t.keys[e.id]?_(`models.noteKey`):_(`models.noteNoKey`),noteTone:t.keys[e.id]?`done`:void 0,selected:l?.kind===`key`&&l.provider===e.id,disabled:!n.canEdit,onPick:()=>h({kind:`key`,provider:e.id})},e.id))}),(0,R.jsxs)(Bt,{label:Y(e)&&!n.cloud?_(`models.optOther`):_(`models.optCreditsGroup`),children:[Y(e)&&!n.cloud?(0,R.jsx)(Vt,{title:_(`models.optLocal`),note:_(`models.optLocalNote`),selected:l?.kind===`local`,disabled:!n.canEdit,onPick:()=>h({kind:`local`})}):null,(0,R.jsx)(Vt,{title:n.cloud?_(`models.creditsTeam`):_(`models.creditsName`),note:n.credits?Yt(e,t):_(`models.noteNeedsAccount`),noteTone:n.credits?`done`:void 0,selected:l?.kind===`credits`,disabled:!n.canEdit,onPick:()=>h({kind:`credits`})})]})]}),u?(0,R.jsxs)(`p`,{className:`text-[0.8125rem] text-ink-2`,children:[_(`local.sourceNeedsAccount`),` `,(0,R.jsx)(an,{})]}):null,a.isError?(0,R.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:a.error.message}):null]}),g?(0,R.jsxs)(R.Fragment,{children:[v?(0,R.jsxs)(Z,{title:_(`models.keyFor`,{name:g.name}),children:[(0,R.jsx)(Ht,{provider:g,stored:!1,place:n}),n.credits?(0,R.jsxs)(Q,{children:[(0,R.jsx)(s,{className:`mr-1 inline size-3.5 align-[-2px]`}),_(`models.keyFallback`)]}):null]}):null,v&&n.credits&&Xt(t,e,g.id).length?(0,R.jsx)(Z,{title:_(`models.viaCredits`,{name:g.name}),children:(0,R.jsx)(Qt,{models:Xt(t,e,g.id),state:t,place:n})}):null,(0,R.jsx)(Z,{title:_(`models.model`),aside:v?null:(0,R.jsx)(`button`,{type:`button`,onClick:()=>i({type:`provider`,id:g.id}),className:`text-[0.75rem] text-ink-3 hover:text-ink`,children:_(`models.manageKey`,{name:g.name})}),children:Y(e)&&g.text?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Gt,{provider:g,state:t}),(0,R.jsx)(Kt,{provider:g,state:t,disabled:!n.canEdit,onPick:(e,t)=>a.mutate({bindings:{[e]:t}})})]}):(0,R.jsx)(Wt,{provider:g,cap:e,value:t.bindings[o]??g.models[e]?.[0]?.ref??``,disabled:!n.canEdit,onPick:e=>a.mutate({bindings:{[o]:e}})},`${g.id}:${t.bindings[o]??``}`)})]}):null,l?.kind===`client`&&y?Y(e)?(0,R.jsx)(Z,{title:y.name,children:(0,R.jsx)(Ue,{me:r,id:y.id})}):(0,R.jsx)(Z,{title:y.name,children:(0,R.jsx)(Q,{children:_(`models.clientImages`,{name:y.name,sub:_(`harness.sub.${y.id}`)})})}):null,l?.kind===`local`?(0,R.jsx)(en,{state:t,disabled:!n.canEdit}):null,l?.kind===`credits`&&n.credits?Y(e)?(0,R.jsx)(Z,{title:_(`models.creditsName`),children:(0,R.jsxs)(Q,{children:[_(`models.creditsPicks`),c.kind===`credits`&&c.ref?` ${_(`models.creditsModel`,{model:K(c.ref)})}`:``]})}):(0,R.jsxs)(Z,{title:_(`models.model`),children:[(0,R.jsx)(Zt,{cap:e,state:t,disabled:!n.canEdit}),(0,R.jsx)(Q,{children:_(`models.creditsPickHint`)})]}):null,c.problem?(0,R.jsxs)(`p`,{className:`flex items-start gap-2 rounded-lg bg-paper-2 px-3 py-2.5 text-[0.8125rem] text-ink-2`,children:[(0,R.jsx)(ce,{className:`mt-0.5 size-3.5 shrink-0 text-ink-3`}),(0,R.jsx)(`span`,{children:(0,R.jsx)(E,{text:c.problem})})]}):null,l?.kind===`client`&&Y(e)?null:(0,R.jsx)(Z,{title:_(`models.try`),children:(0,R.jsx)(qt,{cap:e,disabled:!b||!n.canEdit},`${e}:${c.ref}`)}),Y(e)&&r.subscriptions.includes(`claude`)&&!n.cloud?(0,R.jsx)(tn,{me:r}):null]})]})}function en({state:e,disabled:t}){let n=X(),[r,i]=(0,L.useState)(e.ollamaUrl),[a,o]=(0,L.useState)((e.bindings.standard??`ollama:qwen3`).replace(/^ollama:/,``));return(0,R.jsxs)(Z,{title:_(`models.optLocal`),children:[(0,R.jsx)(Q,{children:_(`models.ollamaHint`)}),(0,R.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[minmax(0,1fr)_12rem_auto]`,children:[(0,R.jsx)(j,{className:`font-mono text-[0.8125rem]`,value:r,disabled:t,onChange:e=>i(e.target.value)}),(0,R.jsx)(j,{className:`font-mono text-[0.8125rem]`,value:a,disabled:t,onChange:e=>o(e.target.value)}),(0,R.jsx)(M,{variant:`secondary`,busy:n.isPending,disabled:t||!a.trim(),onClick:()=>n.mutate({ollamaUrl:r,bindings:Object.fromEntries(me.map(e=>[e,`ollama:${a.trim()}`]))}),children:_(`settings.save`)})]})]})}function tn({me:e}){let t=r(),n=f({mutationFn:e=>m.put(`/api/studio/local/chat`,{engine:e}),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})});return(0,R.jsxs)(Z,{title:_(`local.chat`),children:[(0,R.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:[`models`,`claude`].map(t=>(0,R.jsx)(`button`,{type:`button`,"aria-pressed":e.chatEngine===t,onClick:()=>n.mutate(t),className:S(`h-9 rounded-full border px-3.5 text-[0.8125rem] transition`,e.chatEngine===t?`border-ember bg-ember-tint text-ink`:`border-input bg-card text-ink-2 hover:text-ink`),children:_(t===`claude`?`local.chatClaude`:`local.chatModels`)},t))}),(0,R.jsx)(Q,{children:_(`local.subscription`)})]})}function nn({provider:e,state:t,place:n,onOpen:r}){let i=X(),a=xt.filter(t=>e.models[t]?.length),o=t.keys[e.id],s=e.id===`gateway`?[]:t.creditModels.filter(t=>t.source===e.id||t.provider===e.id);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)($,{icon:I,title:e.name,lead:Mt(e.about,g),status:(0,R.jsx)(zt,{text:_(o?`models.keyStored`:`models.keyNone`),tone:o?`done`:`warn`})}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[(0,R.jsx)(Z,{title:_(`models.key`),children:(0,R.jsx)(Ht,{provider:e,stored:o,place:n})}),(0,R.jsx)(Z,{title:_(`models.uses`),children:(0,R.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:a.map(a=>{let o=q[a],s=Pt(t,a,n),c=s?.kind===`key`&&s.provider===e.id;return(0,R.jsxs)(`li`,{className:`flex flex-wrap items-center gap-3 py-2.5`,children:[(0,R.jsx)(o,{className:`size-4 shrink-0 text-ink-3`}),(0,R.jsxs)(`button`,{type:`button`,onClick:()=>r({type:`cap`,id:a}),className:`min-w-0 flex-1 text-left`,children:[(0,R.jsx)(`span`,{className:`block font-medium text-[0.875rem]`,children:_(`models.cap.${a}`)}),(0,R.jsx)(`span`,{className:`block truncate text-[0.75rem] text-ink-3`,children:(e.models[a]??[]).map(e=>e.label).join(` · `)})]}),c?(0,R.jsxs)(`span`,{className:`flex items-center gap-1 font-medium text-[0.75rem] text-moss`,children:[(0,R.jsx)(h,{className:`size-3.5`,strokeWidth:3}),` `,_(`models.inUse`)]}):(0,R.jsx)(M,{size:`sm`,variant:`secondary`,disabled:!n.canEdit,busy:i.isPending&&i.variables?.bindings!==void 0,onClick:()=>i.mutate({...Y(a)&&!n.cloud?{source:`own`}:{},bindings:Ft(e,a,t)}),children:_(`models.useFor`)})]},a)})})}),s.length?(0,R.jsxs)(Z,{title:_(`models.viaCredits`,{name:e.name}),children:[(0,R.jsx)(Q,{children:n.credits?_(`models.viaCreditsHint`):_(`models.viaCreditsNeedsAccount`)}),(0,R.jsx)(Qt,{models:s,state:t,place:n})]}):null]})]})}function rn({me:e,id:t,state:n,place:r}){let i=X(),a=r.harnesses.find(e=>e.id===t);if(!a)return null;let o=n.source===t,s=a.version!==null&&a.auth!==`none`;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)($,{icon:ie,title:a.name,lead:_(`harness.desc.${t}`),status:(0,R.jsx)(zt,{text:It(a).note,tone:s?`done`:`warn`})}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[(0,R.jsx)(Z,{title:_(`models.clientSignIn`),children:(0,R.jsx)(Ue,{me:e,id:t})}),(0,R.jsxs)(Z,{title:_(`models.uses`),children:[(0,R.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:[`text`,...a.images?[`image`]:[]].map(e=>{let a=q[e],o=Pt(n,e,r),s=o?.kind===`client`&&o.id===t;return(0,R.jsxs)(`li`,{className:`flex items-center gap-3 py-2.5`,children:[(0,R.jsx)(a,{className:`size-4 shrink-0 text-ink-3`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 font-medium text-[0.875rem]`,children:_(`models.cap.${e}`)}),s?(0,R.jsxs)(`span`,{className:`flex items-center gap-1 font-medium text-[0.75rem] text-moss`,children:[(0,R.jsx)(h,{className:`size-3.5`,strokeWidth:3}),` `,_(`models.inUse`)]}):(0,R.jsx)(M,{size:`sm`,variant:`secondary`,busy:i.isPending,onClick:()=>i.mutate(e===`text`?{source:t}:{bindings:{image:`${t}/image`}}),children:_(`models.useFor`)})]},e)})}),o?null:(0,R.jsx)(Q,{children:_(`models.clientNotChosen`,{name:a.name})})]})]})]})}function an(){return(0,R.jsx)(x,{to:`/settings/account`,className:`font-medium text-ember-strong underline-offset-2 hover:underline`,children:_(`local.toAccount`)})}function on({state:e,place:t,onOpen:n}){let r=X(),i=xt.filter(t=>e.ways[J[t]].kind===`credits`),a=t.cloud?_(`models.creditsTeam`):_(`models.creditsName`);return(0,R.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,R.jsx)($,{icon:s,title:a,lead:t.cloud?_(`models.creditsCloudHint`):_(`models.creditsLocalLead`),status:t.balance===null?void 0:(0,R.jsx)(`span`,{className:`font-display font-semibold text-[1.25rem] tabular-nums`,children:_(`nav.credits`,{n:Math.floor(t.balance).toLocaleString()})})}),(0,R.jsxs)(O,{className:`flex flex-col gap-6 p-3.5 sm:p-5 sm:p-6`,children:[!t.cloud&&!t.account?(0,R.jsxs)(Z,{title:_(`models.creditsConnectTitle`),children:[(0,R.jsx)(Q,{children:_(`models.creditsLocalHint`)}),(0,R.jsx)(`div`,{children:(0,R.jsx)(x,{to:`/settings/account`,children:(0,R.jsx)(M,{children:_(`models.creditsConnect`)})})})]}):null,t.account&&!t.account.signedIn?(0,R.jsxs)(`p`,{className:`text-[0.8125rem] text-rose`,children:[_(`local.accountExpired`),` `,(0,R.jsx)(an,{})]}):null,t.account?(0,R.jsx)(Z,{title:_(`models.creditsFallback`),children:(0,R.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,R.jsx)(D,{checked:e.creditFallback,disabled:!t.canEdit,onChange:e=>r.mutate({creditFallback:e}),label:_(`models.creditsFallback`)}),(0,R.jsx)(Q,{children:e.creditFallback?_(`models.creditsFallbackOn`):_(`models.creditsFallbackOff`)})]})}):null,t.credits?(0,R.jsx)(Z,{title:_(`models.creditsOn`),aside:t.topUp?(0,R.jsxs)(`a`,{href:t.topUp,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[0.8125rem] text-ember-strong hover:underline`,children:[_(`models.creditsTopUp`),` `,(0,R.jsx)(N,{className:`size-3`})]}):null,children:i.length?(0,R.jsx)(`ul`,{className:`flex flex-col divide-y divide-border-soft`,children:i.map(t=>{let r=q[t],i=e.ways[J[t]];return(0,R.jsx)(`li`,{children:(0,R.jsxs)(`button`,{type:`button`,onClick:()=>n({type:`cap`,id:t}),className:`flex w-full items-center gap-3 py-2.5 text-left`,children:[(0,R.jsx)(r,{className:`size-4 shrink-0 text-ink-3`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 font-medium text-[0.875rem]`,children:_(`models.cap.${t}`)}),(0,R.jsxs)(`span`,{className:`truncate text-[0.75rem] text-ink-3`,children:[i.ref?K(i.ref):``,` · `,Yt(t,e)]})]})},t)})}):(0,R.jsx)(Q,{children:_(`models.creditsNone`)})}):null]})]})}function sn(e){return e?e===`credits`?{type:`credits`}:xt.includes(e)?{type:`cap`,id:e}:G(e)?{type:`provider`,id:e}:{type:`client`,id:e}:{type:`cap`,id:`text`}}var cn=e=>e.type===`credits`?`credits`:e.id;function ln({view:e,onView:t}){return null}function un(e){return e.kind===`none`?`off`:e.kind===`credits`?`credits`:`done`}function dn(e,t){switch(e.type){case`cap`:return _(`models.cap.${e.id}`);case`provider`:return G(e.id)?.name??e.id;case`client`:return t?.harnesses.find(t=>t.id===e.id)?.name??e.id;default:return t?.mode===`managed`?_(`models.creditsTeam`):_(`models.creditsName`)}}function fn(){let e=ge(),t=Rt(),[n,r]=C(),[i,a]=(0,L.useState)(`auto`),{narrow:o}=Me(),c=n.get(`show`),l=sn(c);if(Pe(c||!o?dn(l,e.data):null),!e.data||!t.data)return t.isError?(0,R.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:t.error.message}):null;let u=t.data,d=jt(e.data,i),f=e=>r({show:cn(e)},{replace:!o}),p=e=>!(!c&&o)&&cn(e)===cn(l),m=d.harnesses.filter(e=>e.version!==null||u.source===e.id),h=W.filter(e=>u.keys[e.id]),g=W.filter(e=>!u.keys[e.id]);return(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(Re,{children:[(0,R.jsx)(F,{label:_(`models.groupCaps`),children:xt.map(e=>{let t=u.ways[J[e]];return(0,R.jsx)(P,{icon:q[e],label:_(`models.cap.${e}`),tone:un(t),toneLabel:Lt(t,d).text,selected:p({type:`cap`,id:e}),onPick:()=>f({type:`cap`,id:e})},e)})}),(0,R.jsxs)(F,{label:_(`models.groupAccess`),children:[(0,R.jsx)(P,{icon:s,label:d.cloud?_(`models.creditsTeam`):_(`models.creditsName`),badge:d.balance===null?null:(0,R.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:Math.floor(d.balance).toLocaleString()}),tone:d.credits?void 0:`off`,toneLabel:d.credits?void 0:_(`models.noteNeedsAccount`),selected:p({type:`credits`}),onPick:()=>f({type:`credits`})}),m.map(e=>(0,R.jsx)(P,{icon:ie,label:e.name,tone:e.version!==null&&e.auth===`subscription`?`done`:e.auth===`api_key`?`on`:`off`,toneLabel:It(e).note,selected:p({type:`client`,id:e.id}),onPick:()=>f({type:`client`,id:e.id})},e.id)),h.map(e=>(0,R.jsx)(P,{icon:I,label:e.name,tone:`done`,toneLabel:_(`models.noteKey`),selected:p({type:`provider`,id:e.id}),onPick:()=>f({type:`provider`,id:e.id})},e.id))]}),g.length?(0,R.jsx)(F,{label:_(`models.groupMore`),collapsible:!0,open:g.some(e=>p({type:`provider`,id:e.id})),count:g.length,children:g.map(e=>(0,R.jsx)(P,{icon:I,label:e.name,selected:p({type:`provider`,id:e.id}),onPick:()=>f({type:`provider`,id:e.id})},e.id))}):null,(0,R.jsx)(ln,{view:i,onView:a})]}),d.canEdit?null:(0,R.jsx)(`p`,{className:`mb-4 rounded-lg bg-paper-2 px-3 py-2 text-[0.8125rem] text-ink-2`,children:_(`models.readOnly`)}),l.type===`cap`?(0,R.jsx)($t,{cap:l.id,state:u,place:d,me:e.data,onOpen:f},l.id):l.type===`provider`&&G(l.id)?(0,R.jsx)(nn,{provider:G(l.id),state:u,place:d,onOpen:f},l.id):l.type===`client`?(0,R.jsx)(rn,{me:e.data,id:l.id,state:u,place:d},l.id):(0,R.jsx)(on,{state:u,place:d,onOpen:f})]})}function pn({name:e,image:t}){return t?(0,R.jsx)(`img`,{src:t,alt:``,className:`size-9 shrink-0 rounded-full object-cover`}):(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-paper-2 font-medium text-[0.75rem] text-ink-2`,children:ye(e)})}function mn({me:e}){let t=i({queryKey:[`team`,e.tenant.id],queryFn:()=>m.get(`/api/studio/team`)}),n=t.data,r=n?.plan??e.tenant.plan,a=n?.seats;return(0,R.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,R.jsxs)(ae,{title:_(`team.title`),hint:_(`team.hint`),children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:_(`team.plan`)}),(0,R.jsxs)(`div`,{className:`mt-0.5 flex items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`font-medium text-[0.9375rem]`,children:r?.name??_(`team.planFree`)}),a?(0,R.jsx)(A,{children:a.limit===null?_(`team.seatsUnlimited`):_(`team.seats`,{taken:a.taken,limit:a.limit})}):null]})]}),(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,R.jsxs)(M,{variant:`secondary`,onClick:()=>xe(`${e.manageUrl}/billing`),children:[_(`team.changePlan`),` `,(0,R.jsx)(N,{className:`size-4`})]}),n?.canManage?(0,R.jsxs)(M,{onClick:()=>xe(`${e.manageUrl}/`),children:[_(`team.manage`),` `,(0,R.jsx)(N,{className:`size-4`})]}):null]})]}),(0,R.jsx)(`p`,{className:`mt-4 text-[0.8125rem] text-ink-3 leading-relaxed`,children:e.tenant.role===`member`?_(`team.memberNote`):_(`team.roles`)})]}),(0,R.jsx)(ae,{title:_(`team.members`),children:t.isPending?(0,R.jsx)(T,{}):t.isError||!n?(0,R.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:_(`team.failed`)}):(0,R.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[n.members.map(t=>(0,R.jsxs)(`div`,{className:`flex items-center gap-3 py-3 first:pt-0 last:pb-0`,children:[(0,R.jsx)(pn,{name:t.name,image:t.image}),(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`truncate text-[0.9375rem]`,children:[t.name,t.userId===e.user.id?(0,R.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,_(`team.you`)]}):null]}),(0,R.jsx)(`div`,{className:`truncate text-[0.8125rem] text-ink-3`,children:t.email})]}),(0,R.jsx)(A,{tone:t.role===`member`?void 0:`live`,children:_(`team.role.${t.role}`)})]},t.userId)),n.invitations.map(e=>(0,R.jsxs)(`div`,{className:`flex items-center gap-3 py-3 first:pt-0 last:pb-0`,children:[(0,R.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-3`,children:(0,R.jsx)(Je,{className:`size-4`})}),(0,R.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[0.9375rem]`,children:e.email}),(0,R.jsxs)(A,{tone:`warn`,children:[_(`team.invited`),` · `,_(`team.role.${e.role}`)]})]},e.id)),n.members.length===0&&n.invitations.length===0?(0,R.jsxs)(`div`,{className:`flex items-center gap-3 text-[0.875rem] text-ink-3`,children:[(0,R.jsx)(Ce,{className:`size-4`}),` –`]}):null]})})]})}function hn(e,t){let n=e.toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^[^a-z]+/,``).slice(0,24)||`system`,r=n,i=2;for(;t.includes(r);)r=`${n}_${i++}`;return r}function gn({project:e}){let t=r(),[n,i]=(0,L.useState)(e.mcpServers.map(e=>({...e,auth:e.headers?.Authorization??e.headers?.authorization??``}))),[a,o]=(0,L.useState)(!1),s=e.readOnly,c=f({mutationFn:()=>m.patch(`/api/studio/projects/${e.id}`,{mcpServers:n.filter(e=>e.name&&e.url).map(({auth:e,headers:t,...n})=>({...n,headers:e?{...t,Authorization:e}:void 0}))}),onSuccess:async()=>{await t.invalidateQueries({queryKey:[`projects`]}),o(!0),setTimeout(()=>o(!1),1800)}});return(0,R.jsxs)(O,{className:`p-4 sm:p-6`,children:[(0,R.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:_(`settings.mcp`)}),(0,R.jsx)(`p`,{className:`mt-1 mb-5 text-[0.875rem] text-ink-3`,children:_(`settings.mcpHint`)}),(0,R.jsxs)(`fieldset`,{disabled:s,className:`flex min-w-0 flex-col gap-3`,children:[n.map((e,t)=>(0,R.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-paper p-3 ring-1 ring-border-soft sm:grid-cols-[1fr_2fr_auto]`,children:[(0,R.jsx)(j,{placeholder:_(`settings.serverName`),value:e.name,onChange:e=>i(n=>n.map((r,i)=>i===t?{...r,name:e.target.value,id:r.id||hn(e.target.value,n.map(e=>e.id))}:r))}),(0,R.jsx)(j,{placeholder:`${_(`settings.serverUrl`)} (https://…/mcp)`,value:e.url,onChange:e=>i(n=>n.map((n,r)=>r===t?{...n,url:e.target.value}:n))}),s?(0,R.jsx)(`span`,{}):(0,R.jsx)(k,{label:`Entfernen`,onClick:()=>i(e=>e.filter((e,n)=>n!==t)),className:`hover:text-rose`,children:(0,R.jsx)(pe,{className:`size-4`})}),(0,R.jsx)(j,{className:`sm:col-span-2`,placeholder:_(`settings.serverHeader`),value:e.auth??``,onChange:e=>i(n=>n.map((n,r)=>r===t?{...n,auth:e.target.value}:n))}),e.id?(0,R.jsx)(`span`,{className:`self-center font-mono text-[0.6875rem] text-ink-4`,children:e.id}):null]},t)),s?null:(0,R.jsxs)(M,{variant:`secondary`,className:`self-start`,onClick:()=>i(e=>[...e,{id:``,name:``,url:``,auth:``}]),children:[(0,R.jsx)(v,{className:`size-4`}),` `,_(`settings.addServer`)]})]}),s?null:(0,R.jsxs)(`div`,{className:`mt-5 flex items-center justify-end gap-3`,children:[c.error?(0,R.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:c.error.message}):null,(0,R.jsx)(M,{busy:c.isPending,onClick:()=>c.mutate(),children:_(a?`settings.saved`:`settings.save`)})]})]})}var _n=new Set([`models`,`integrate`]);function vn(){let{section:e}=te(),[t]=C(),n=ne(),r=ge(),{project:i,loading:a}=ve(),o=_e(),[s,c]=(0,L.useState)(i?.id);(0,L.useEffect)(()=>c(i?.id),[i?.id]);let l=ke(),u=Be(),[d,f]=(0,L.useState)(null),[m,h]=(0,L.useState)(null),[g,v]=(0,L.useState)(null),y=Ee(r.data,l),b=y.find(t=>t.id===e),x=y.map(e=>({...e,to:`/settings/${e.id}`})),w=x.find(t=>t.id===e),T=b?_n.has(b.id):!1,E=b?T&&!t.get(`show`)?1:2:0,D=u?Math.min(E,1):T&&g!==e?1:0,O=Ne(D),k=Ne(E),A=(0,L.useMemo)(()=>({slot:d,narrow:u,setDetail:h}),[d,u]);if(Oe(b?.id===`models`?{suggestions:[{label:_(`assistant.suggest.modelsNow`)},{label:_(`assistant.suggest.modelsMissing`)},{label:_(`assistant.suggest.modelsCost`)}]}:b?.id===`account`?{suggestions:[{label:_(`assistant.suggest.credits`)},{label:_(`assistant.suggest.accountWhy`)},{label:_(`assistant.suggest.plans`)}]}:b?.id===`integrate`?{suggestions:[{label:_(`assistant.suggest.integrateWhat`)},{label:_(`assistant.suggest.integrateClaude`)},{label:_(`assistant.suggest.what`)}]}:b?.id===`connectors`?{suggestions:[{label:_(`assistant.suggest.connectorsWhat`)},{label:_(`assistant.suggest.connectorsAdd`),fill:!0},{label:_(`assistant.suggest.what`)}]}:{}),we([{label:_(`settings.title`),to:`/settings`},...b?[{label:b.label,to:`/settings/${b.id}`}]:[],...b&&m?[{label:m}]:[]]),!b){if(e===`build`)return(0,R.jsx)(p,{to:`/settings/integrate`,replace:!0});if(e===`project`)return(0,R.jsx)(p,{to:`/space`,replace:!0});if(e!==void 0||!u)return l.status===`ready`||e===void 0?(0,R.jsx)(p,{to:`/settings/account`,replace:!0}):null}let j=b?.id===`connectors`&&o;return(0,R.jsx)(Ie.Provider,{value:A,children:(0,R.jsx)(`div`,{className:`animate-rise`,children:(0,R.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[13.5rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,R.jsxs)(`aside`,{className:S(`min-w-0 md:sticky md:top-6 md:self-start`,u&&E===2&&`hidden`,u&&k===`back`&&je(`back`)),children:[(0,R.jsx)(Fe,{title:_(`settings.title`),open:D===1?w??null:null,onBack:()=>u?n(`/settings`):v(e??null)}),(0,R.jsx)(`div`,{className:S(je(O)),children:D===0?(0,R.jsx)(Le,{entries:x,current:u?void 0:w,onPick:()=>v(null)}):(0,R.jsx)(`div`,{ref:f})},D)]}),b?(0,R.jsxs)(`div`,{className:S(`min-w-0`,![`integrate`,`models`].includes(b.id)&&`max-w-2xl`,u&&E<2&&`hidden`,u&&k===`deeper`&&je(`deeper`)),children:[u?(0,R.jsx)(`div`,{className:`mb-3`,children:(0,R.jsx)(ze,{label:T?b.label:_(`settings.title`),onBack:()=>n(T?`/settings/${b.id}`:`/settings`)})}):null,j?(0,R.jsx)(`div`,{className:`mb-6`,children:(0,R.jsx)(se,{})}):null,b.id===`connectors`&&i?(0,R.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[i.readOnly?(0,R.jsx)(He,{children:Ve(i)}):null,(0,R.jsx)(lt,{projectId:i.id,readOnly:i.readOnly},s),(0,R.jsx)(gn,{project:i},s)]}):null,b.id===`connectors`&&!i&&!a?(0,R.jsx)(ee,{children:_(`settings.noProject`)}):null,b.id===`models`?(0,R.jsx)(fn,{}):null,b.id===`integrate`?(0,R.jsx)(bt,{}):null,b.id===`account`&&r.data?(0,R.jsx)(oe,{me:r.data}):null,b.id===`team`&&r.data?(0,R.jsx)(mn,{me:r.data}):null,b.id===`plugins`?(0,R.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,R.jsx)($e,{}),(0,R.jsx)(it,{})]}):null,b.plugin?(0,R.jsx)(Ae,{of:b.plugin,children:(0,R.jsx)(b.plugin.component,{})}):null]}):null]})})})}export{vn as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,t as i}from"./logo-C80CWCDM.js";import{t as a}from"./useMutation-DKcIz55V.js";import{C as o,G as s,P as c,_ as l,nt as u,q as d,t as f}from"./ui-D92EkdEB.js";import{t as p}from"./arrow-right-Dpp_mpHe.js";import{M as m,O as h,j as ee}from"./definition-CQGiBQ4X.js";import{t as te}from"./refresh-cw-Cli5WGnW.js";import{f as ne}from"./session-miDEdw2c.js";import{a as re,i as g,n as _,o as v,r as y,t as ie}from"./ThemeSwitch-3IzIOlNz.js";import{n as ae,t as oe}from"./Harness-zKMptCzB.js";var b=e(t(),1),x=e(n(),1),S=`oklch(50% 0.2 262)`,C=`oklch(32% 0.15 262)`,w=`oklch(90% 0.1 80)`,T=`var(--step-done)`,E=`var(--step-now)`,D=`color-mix(in oklab, var(--on) 38%, transparent)`,O={"--on":`white`,"--tile":`rgb(255 255 255 / 0.1)`,"--tile-hover":`rgb(255 255 255 / 0.15)`,"--tile-ring":`rgb(255 255 255 / 0.15)`,"--panel":`rgb(255 255 255 / 0.07)`,"--panel-ring":`rgb(255 255 255 / 0.12)`,"--pick":`white`,"--pick-ink":C,"--pick-mark":C,"--dot":w,"--step-done":`oklch(88% 0.17 150)`,"--step-now":`oklch(88% 0.14 80)`,"--ready-ink":`oklch(27% 0.09 150)`,"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},se={"--on":`var(--ink)`,"--tile":`var(--card)`,"--tile-hover":`var(--paper-2)`,"--tile-ring":`var(--border-soft)`,"--panel":`var(--card)`,"--panel-ring":`var(--border-soft)`,"--pick":S,"--pick-ink":`white`,"--pick-mark":`white`,"--dot":S,"--step-done":`oklch(52% 0.15 150)`,"--step-now":`oklch(60% 0.15 65)`,"--ready-ink":`white`},k=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,ce=220,le={codex:`dome`,claude:`oval`,gemini:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`},A=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,j=`left-1/2 -translate-x-1/2 text-center`,M=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function N(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var P=`wizards.setup.own`;function F(){try{return sessionStorage.getItem(P)===`1`}catch{return!1}}function I(e){try{e?sessionStorage.setItem(P,`1`):sessionStorage.removeItem(P)}catch{}}function L(){return(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,x.jsx)(i,{size:28}),(0,x.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight`,children:[`engenty`,(0,x.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-(color:--dot)`,children:`.`}),(0,x.jsx)(`span`,{className:`font-normal text-(color:--on)/70`,children:`wizards`})]})]})}function R({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,x.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:l(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-(color:--pick) text-(color:--pick-ink) shadow-elevated`:`bg-(color:--tile) ring-(color:--tile-ring) ring-1 hover:bg-(color:--tile-hover)`),children:[r?(0,x.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[0.6875rem] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:w,color:C},children:r}):null,(0,x.jsx)(`span`,{className:l(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent bg-(color:--pick-mark)`:`border-(color:--on)/40`),children:e?(0,x.jsx)(s,{className:`size-3.5 text-(color:--pick)`}):null}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`span`,{className:`block font-medium text-[0.9375rem]`,children:t}),(0,x.jsx)(`span`,{className:l(`mt-0.5 block truncate text-[0.8125rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:n})]}),i?(0,x.jsx)(`span`,{className:l(`shrink-0 text-[0.75rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:i}):null,(0,x.jsx)(p,{className:l(`size-4 shrink-0 transition`,e?`opacity-70`:`text-(color:--on)/40 group-hover:translate-x-0.5 group-hover:text-(color:--on)/80`)})]})}function z({name:e,at:t,done:n}){let r=[c(`setup.stage.connect`),c(`setup.stage.test`),c(`setup.stage.done`)],i=n?r.length:t+1;return(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[0.75rem] uppercase tracking-[0.14em]`,children:[(0,x.jsx)(`span`,{className:`text-(color:--on)/70`,children:e}),(0,x.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,x.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?T:r===t?E:D},children:[i?(0,x.jsx)(s,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,x.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?T:E:`color-mix(in oklab, var(--on) 22%, transparent)`}},e))})]})}function B({href:e,children:t}){return(0,x.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-(color:--on)`,onClick:t=>{t.preventDefault(),y(e)},children:t})}function V(){let e=v(`site`),t=m()===`dark`;ee(t?S:null);let n=ne(),i=r(),p=u(),y=re(),[w,E]=(0,b.useState)(F),[D,P]=(0,b.useState)(!1),V=a({mutationFn:e=>o.put(`/api/studio/local/models`,{source:e}),onSuccess:async(e,t)=>{await i.invalidateQueries({queryKey:[`me`]}),E(!0),P(!1),N(),I(t===`own`)}}),H=a({mutationFn:()=>Promise.all((n.data?.harnesses??[]).map(e=>o.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>i.invalidateQueries({queryKey:[`me`]})});if(!n.data?.models)return null;let U=n.data.models,W=e=>(e.version===null?2:0)+ +!e.app,G=[...n.data.harnesses].sort((e,t)=>W(e)-W(t)),ue=G.filter(e=>e.version!==null),K=w||n.data.setupDone||U.source!==`own`?U.source:null,q=n.data.harnesses.find(e=>e.id===K),J=n.data.setupDone,Y=Object.values(U.keys).some(Boolean),de=J?2:q?q.auth===`none`?0:1:+!!Y,X=J?c(`setup.h.done`):q?q.version===null?c(`setup.h.install`,{name:q.name}):q.auth===`none`?c(`setup.h.signIn`,{name:q.name}):c(`setup.h.test`):c(Y?`setup.h.test`:`setup.h.keys`),Z=e?y.data?.site:null,Q=K!==null&&!D,$=V.isPending?V.variables??K:K;return(0,x.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-(color:--on) sm:px-10`,style:t?O:se,children:[(0,x.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,x.jsx)(L,{}),(0,x.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(ie,{tone:t?`ground`:`surface`}),(0,x.jsx)(g,{tone:t?`ground`:`surface`,ink:C})]})]}),(0,x.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[(0,x.jsx)(`div`,{"aria-hidden":`true`,className:l(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,k,K?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Q?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,x.jsx)(`div`,{className:`animate-rise`,children:(0,x.jsx)(h,{kind:`drop`,size:ce,fluffy:!0,coat:`fur`})})}),(0,x.jsx)(`div`,{"aria-hidden":`true`,className:l(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,k,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,children:[(0,x.jsxs)(`section`,{className:l(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,k,K?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Q?`max-lg:hidden`:``),children:[(0,x.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,x.jsx)(`p`,{className:l(A,`font-medium text-(color:--on)/70 text-[0.75rem] uppercase tracking-[0.16em]`,K?M:j),children:c(`setup.title`)}),(0,x.jsx)(`h1`,{className:l(A,`mt-2 font-display font-semibold text-[1.625rem] leading-[1.08] tracking-[-0.02em] sm:text-[1.75rem]`,K?M:j),children:c(`setup.source`)}),(0,x.jsx)(`p`,{className:l(A,`mt-2.5 text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,K?M:j),children:c(`setup.sub`)})]}),(0,x.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[G.map((e,t)=>(0,x.jsx)(R,{selected:$===e.id,title:e.name,description:c(`harness.desc.${e.id}`),badge:t===0?c(`setup.recommended`):void 0,note:e.version===null?c(`harness.notInstalled`):e.auth===`subscription`?c(`harness.ready`):void 0,onPick:()=>V.mutate(e.id)},e.id)),(0,x.jsx)(R,{selected:$===`own`,title:c(`local.sourceOwn`),description:c(`setup.ownDesc`),onPick:()=>V.mutate(`own`)})]}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-(color:--on)/60 text-[0.8125rem]`,children:[(0,x.jsx)(`span`,{children:ue.length?null:c(`setup.noHarness`)}),(0,x.jsxs)(f,{variant:`ghost`,size:`sm`,busy:H.isPending,onClick:()=>H.mutate(),children:[(0,x.jsx)(te,{className:`size-3.5`}),` `,c(`local.recheck`)]})]})]}),K?(0,x.jsxs)(`section`,{className:l(`min-w-0 flex-1 animate-settle`,D?`max-lg:hidden`:``),children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>{P(!0),N()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-(color:--on)/80 text-[0.875rem] transition hover:text-(color:--on) lg:hidden`,children:[(0,x.jsx)(d,{className:`size-4`}),` `,c(`run.back`)]}),(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,x.jsx)(h,{kind:le[K],size:120,fluffy:!0,coat:`fur`})}),(0,x.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,x.jsx)(z,{name:q?.name??c(`local.sourceOwn`),at:de,done:J}),(0,x.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:X},X)]}),(0,x.jsx)(`div`,{className:`mt-5 rounded-2xl bg-(color:--panel) p-5 ring-(color:--panel-ring) ring-1 sm:p-6`,children:q?(0,x.jsx)(oe,{me:n.data,id:q.id,autoTest:!J}):(0,x.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,x.jsx)(_,{models:U}),(0,x.jsx)(ae,{})]})}),(0,x.jsxs)(`div`,{className:`mt-9`,children:[J?(0,x.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[0.9375rem]`,style:{color:T},children:[(0,x.jsx)(s,{className:`size-4`,strokeWidth:3}),c(`setup.ready`)]}):null,(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,x.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>p(`/`,{replace:!0}),className:l(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[1rem] transition-[background-color,color,box-shadow,filter] duration-300`,J?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-(color:--on)/20 text-(color:--on)/65`),style:J?{background:T,color:`var(--ready-ink)`}:void 0,children:[c(`setup.done`),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,x.jsx)(`span`,{className:`text-(color:--on)/65 text-[0.8125rem]`,children:c(`setup.untilWorks`)})]})]})]})]},K):null]})]}),(0,x.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-(color:--on)/55 text-[0.75rem] sm:pb-8`,children:[(0,x.jsxs)(`span`,{children:[`© `,new Date().getFullYear(),` engenty · `,c(`setup.local`)]}),(0,x.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,x.jsx)(B,{href:Z,children:new URL(Z).host}):null,(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px] bg-(color:--dot)`})]})]})]})}export{V as SetupPage};
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,t as i}from"./logo-C80CWCDM.js";import{t as a}from"./useMutation-DKcIz55V.js";import{C as o,G as s,J as c,P as l,_ as u,rt as d,t as f}from"./ui-GsuU9WTj.js";import{t as p}from"./arrow-right-F7X_SjK9.js";import{M as m,O as h,j as ee}from"./definition-CHacJYmI.js";import{t as te}from"./refresh-cw-BUDPOT39.js";import{f as ne}from"./session-Blj2os_v.js";import{a as re,i as g,n as _,o as v,r as y,t as ie}from"./ThemeSwitch-C3EJRN06.js";import{n as ae,t as oe}from"./Harness-DAR1u4Dk.js";var b=e(t(),1),x=e(n(),1),S=`oklch(50% 0.2 262)`,C=`oklch(32% 0.15 262)`,w=`oklch(90% 0.1 80)`,T=`var(--step-done)`,E=`var(--step-now)`,D=`color-mix(in oklab, var(--on) 38%, transparent)`,O={"--on":`white`,"--tile":`rgb(255 255 255 / 0.1)`,"--tile-hover":`rgb(255 255 255 / 0.15)`,"--tile-ring":`rgb(255 255 255 / 0.15)`,"--panel":`rgb(255 255 255 / 0.07)`,"--panel-ring":`rgb(255 255 255 / 0.12)`,"--pick":`white`,"--pick-ink":C,"--pick-mark":C,"--dot":w,"--step-done":`oklch(88% 0.17 150)`,"--step-now":`oklch(88% 0.14 80)`,"--ready-ink":`oklch(27% 0.09 150)`,"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},se={"--on":`var(--ink)`,"--tile":`var(--card)`,"--tile-hover":`var(--paper-2)`,"--tile-ring":`var(--border-soft)`,"--panel":`var(--card)`,"--panel-ring":`var(--border-soft)`,"--pick":S,"--pick-ink":`white`,"--pick-mark":`white`,"--dot":S,"--step-done":`oklch(52% 0.15 150)`,"--step-now":`oklch(60% 0.15 65)`,"--ready-ink":`white`},k=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,ce=220,le={codex:`dome`,claude:`oval`,gemini:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`},A=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,j=`left-1/2 -translate-x-1/2 text-center`,M=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function N(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var P=`wizards.setup.own`;function F(){try{return sessionStorage.getItem(P)===`1`}catch{return!1}}function I(e){try{e?sessionStorage.setItem(P,`1`):sessionStorage.removeItem(P)}catch{}}function L(){return(0,x.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,x.jsx)(i,{size:28}),(0,x.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight`,children:[`engenty`,(0,x.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-(color:--dot)`,children:`.`}),(0,x.jsx)(`span`,{className:`font-normal text-(color:--on)/70`,children:`wizards`})]})]})}function R({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,x.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:u(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-(color:--pick) text-(color:--pick-ink) shadow-elevated`:`bg-(color:--tile) ring-(color:--tile-ring) ring-1 hover:bg-(color:--tile-hover)`),children:[r?(0,x.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[0.6875rem] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:w,color:C},children:r}):null,(0,x.jsx)(`span`,{className:u(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent bg-(color:--pick-mark)`:`border-(color:--on)/40`),children:e?(0,x.jsx)(s,{className:`size-3.5 text-(color:--pick)`}):null}),(0,x.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,x.jsx)(`span`,{className:`block font-medium text-[0.9375rem]`,children:t}),(0,x.jsx)(`span`,{className:u(`mt-0.5 block truncate text-[0.8125rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:n})]}),i?(0,x.jsx)(`span`,{className:u(`shrink-0 text-[0.75rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:i}):null,(0,x.jsx)(p,{className:u(`size-4 shrink-0 transition`,e?`opacity-70`:`text-(color:--on)/40 group-hover:translate-x-0.5 group-hover:text-(color:--on)/80`)})]})}function z({name:e,at:t,done:n}){let r=[l(`setup.stage.connect`),l(`setup.stage.test`),l(`setup.stage.done`)],i=n?r.length:t+1;return(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[0.75rem] uppercase tracking-[0.14em]`,children:[(0,x.jsx)(`span`,{className:`text-(color:--on)/70`,children:e}),(0,x.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,x.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?T:r===t?E:D},children:[i?(0,x.jsx)(s,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,x.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?T:E:`color-mix(in oklab, var(--on) 22%, transparent)`}},e))})]})}function B({href:e,children:t}){return(0,x.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-(color:--on)`,onClick:t=>{t.preventDefault(),y(e)},children:t})}function V(){let e=v(`site`),t=m()===`dark`;ee(t?S:null);let n=ne(),i=r(),p=d(),y=re(),[w,E]=(0,b.useState)(F),[D,P]=(0,b.useState)(!1),V=a({mutationFn:e=>o.put(`/api/studio/local/models`,{source:e}),onSuccess:async(e,t)=>{await i.invalidateQueries({queryKey:[`me`]}),E(!0),P(!1),N(),I(t===`own`)}}),H=a({mutationFn:()=>Promise.all((n.data?.harnesses??[]).map(e=>o.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>i.invalidateQueries({queryKey:[`me`]})});if(!n.data?.models)return null;let U=n.data.models,W=e=>(e.version===null?2:0)+ +!e.app,G=[...n.data.harnesses].sort((e,t)=>W(e)-W(t)),ue=G.filter(e=>e.version!==null),K=w||n.data.setupDone||U.source!==`own`?U.source:null,q=n.data.harnesses.find(e=>e.id===K),J=n.data.setupDone,Y=Object.values(U.keys).some(Boolean),de=J?2:q?q.auth===`none`?0:1:+!!Y,X=J?l(`setup.h.done`):q?q.version===null?l(`setup.h.install`,{name:q.name}):q.auth===`none`?l(`setup.h.signIn`,{name:q.name}):l(`setup.h.test`):l(Y?`setup.h.test`:`setup.h.keys`),Z=e?y.data?.site:null,Q=K!==null&&!D,$=V.isPending?V.variables??K:K;return(0,x.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-(color:--on) sm:px-10`,style:t?O:se,children:[(0,x.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,x.jsx)(L,{}),(0,x.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(ie,{tone:t?`ground`:`surface`}),(0,x.jsx)(g,{tone:t?`ground`:`surface`,ink:C})]})]}),(0,x.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[(0,x.jsx)(`div`,{"aria-hidden":`true`,className:u(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,k,K?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Q?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,x.jsx)(`div`,{className:`animate-rise`,children:(0,x.jsx)(h,{kind:`drop`,size:ce,fluffy:!0,coat:`fur`})})}),(0,x.jsx)(`div`,{"aria-hidden":`true`,className:u(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,k,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,x.jsxs)(`div`,{className:`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,children:[(0,x.jsxs)(`section`,{className:u(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,k,K?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Q?`max-lg:hidden`:``),children:[(0,x.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,x.jsx)(`p`,{className:u(A,`font-medium text-(color:--on)/70 text-[0.75rem] uppercase tracking-[0.16em]`,K?M:j),children:l(`setup.title`)}),(0,x.jsx)(`h1`,{className:u(A,`mt-2 font-display font-semibold text-[1.625rem] leading-[1.08] tracking-[-0.02em] sm:text-[1.75rem]`,K?M:j),children:l(`setup.source`)}),(0,x.jsx)(`p`,{className:u(A,`mt-2.5 text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,K?M:j),children:l(`setup.sub`)})]}),(0,x.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[G.map((e,t)=>(0,x.jsx)(R,{selected:$===e.id,title:e.name,description:l(`harness.desc.${e.id}`),badge:t===0?l(`setup.recommended`):void 0,note:e.version===null?l(`harness.notInstalled`):e.auth===`subscription`?l(`harness.ready`):void 0,onPick:()=>V.mutate(e.id)},e.id)),(0,x.jsx)(R,{selected:$===`own`,title:l(`local.sourceOwn`),description:l(`setup.ownDesc`),onPick:()=>V.mutate(`own`)})]}),(0,x.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-(color:--on)/60 text-[0.8125rem]`,children:[(0,x.jsx)(`span`,{children:ue.length?null:l(`setup.noHarness`)}),(0,x.jsxs)(f,{variant:`ghost`,size:`sm`,busy:H.isPending,onClick:()=>H.mutate(),children:[(0,x.jsx)(te,{className:`size-3.5`}),` `,l(`local.recheck`)]})]})]}),K?(0,x.jsxs)(`section`,{className:u(`min-w-0 flex-1 animate-settle`,D?`max-lg:hidden`:``),children:[(0,x.jsxs)(`button`,{type:`button`,onClick:()=>{P(!0),N()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-(color:--on)/80 text-[0.875rem] transition hover:text-(color:--on) lg:hidden`,children:[(0,x.jsx)(c,{className:`size-4`}),` `,l(`run.back`)]}),(0,x.jsxs)(`div`,{className:`relative`,children:[(0,x.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,x.jsx)(h,{kind:le[K],size:120,fluffy:!0,coat:`fur`})}),(0,x.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,x.jsx)(z,{name:q?.name??l(`local.sourceOwn`),at:de,done:J}),(0,x.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:X},X)]}),(0,x.jsx)(`div`,{className:`mt-5 rounded-2xl bg-(color:--panel) p-5 ring-(color:--panel-ring) ring-1 sm:p-6`,children:q?(0,x.jsx)(oe,{me:n.data,id:q.id,autoTest:!J}):(0,x.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,x.jsx)(_,{models:U}),(0,x.jsx)(ae,{})]})}),(0,x.jsxs)(`div`,{className:`mt-9`,children:[J?(0,x.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[0.9375rem]`,style:{color:T},children:[(0,x.jsx)(s,{className:`size-4`,strokeWidth:3}),l(`setup.ready`)]}):null,(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,x.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>p(`/`,{replace:!0}),className:u(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[1rem] transition-[background-color,color,box-shadow,filter] duration-300`,J?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-(color:--on)/20 text-(color:--on)/65`),style:J?{background:T,color:`var(--ready-ink)`}:void 0,children:[l(`setup.done`),(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,x.jsx)(`span`,{className:`text-(color:--on)/65 text-[0.8125rem]`,children:l(`setup.untilWorks`)})]})]})]})]},K):null]})]}),(0,x.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-(color:--on)/55 text-[0.75rem] sm:pb-8`,children:[(0,x.jsxs)(`span`,{children:[`© `,new Date().getFullYear(),` engenty · `,l(`setup.local`)]}),(0,x.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,x.jsx)(B,{href:Z,children:new URL(Z).host}):null,(0,x.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px] bg-(color:--dot)`})]})]})]})}export{V as SetupPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{r}from"./logo-C80CWCDM.js";import{C as i,D as a,M as o,P as s,f as c,
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{r}from"./logo-C80CWCDM.js";import{C as i,D as a,M as o,P as s,f as c,it as l,n as u,t as d,w as f}from"./ui-GsuU9WTj.js";import{t as p}from"./arrow-right-F7X_SjK9.js";import{E as m,N as h,O as g}from"./definition-CHacJYmI.js";import{v as _,x as v}from"./index-CX_yxZVQ.js";import{BrandHeader as y,useBrandAccent as b}from"./PublicRunner-CaH3bHHd.js";var x=e(t(),1),S=e(n(),1);function C(){let{token:e}=l(),t=r({queryKey:[`share`,e],queryFn:()=>i.get(`/api/shares/${e}`),retry:(e,t)=>f(t)&&e<3});if(b(t.data?.brand.accent),h(t.data?.wizard.avatar),(0,x.useEffect)(()=>{t.data&&(document.title=`${t.data.title} · ${t.data.wizard.title}`)},[t.data]),t.isLoading)return(0,S.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center text-ink-4`,children:(0,S.jsx)(c,{})});let n=t.data;if(!n)return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col items-center justify-center gap-4 px-6 text-center`,children:[(0,S.jsx)(g,{kind:`pebble`,size:80}),(0,S.jsx)(`p`,{className:`max-w-sm text-ink-3`,children:s(f(t.error)?`common.offline`:`sharePage.gone`)}),f(t.error)?(0,S.jsx)(d,{variant:`secondary`,onClick:()=>void t.refetch(),children:s(`common.retry`)}):null]});let C=`/api/shares/${n.token}`,w=e=>new Intl.DateTimeFormat(o,{dateStyle:`long`}).format(new Date(e));return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col`,children:[(0,S.jsx)(y,{brand:n.brand}),(0,S.jsxs)(`main`,{className:`mx-auto w-full max-w-3xl flex-1 animate-rise px-4 pt-6 pb-12 sm:px-6`,children:[(0,S.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-4`,children:[(0,S.jsx)(g,{kind:n.wizard.avatar,size:64}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`text-[0.8125rem] text-ink-4`,children:n.expiresAt?s(`sharePage.until`,{date:w(n.expiresAt)}):s(`sharePage.shared`,{date:w(n.createdAt)})}),(0,S.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] leading-tight tracking-tight sm:text-[2rem]`,children:n.title}),n.message?(0,S.jsx)(`p`,{className:`mt-1 text-[0.9375rem] text-ink-3`,children:n.message}):null]})]}),(0,S.jsx)(`div`,{className:`flex flex-col gap-6`,children:n.shown.map(({step:e,output:t,formats:n,label:r})=>(0,S.jsxs)(u,{className:`p-4 sm:p-5`,children:[(0,S.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,S.jsx)(`h2`,{className:`font-display font-semibold text-[1.0625rem]`,children:r??e.title}),(0,S.jsx)(_,{base:C,stepId:e.id,formats:n,title:r??e.title})]}),(0,S.jsx)(v,{base:C,step:e,output:t})]},e.id))}),n.wizardUrl?(0,S.jsxs)(`a`,{href:n.wizardUrl,className:`mt-10 flex items-center gap-4 rounded-2xl bg-card p-5 shadow-soft ring-1 ring-border-soft transition hover:shadow-elevated`,children:[(0,S.jsx)(g,{kind:n.wizard.avatar,size:44,interactive:!1}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`font-display font-semibold text-[1rem]`,children:n.wizard.title}),n.wizard.description?(0,S.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:n.wizard.description}):null]}),(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-[0.875rem] text-ember-strong`,children:[s(`sharePage.own`),` `,(0,S.jsx)(p,{className:`size-4`})]})]}):null]}),(0,S.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,S.jsx)(`a`,{href:`${a}/`,className:`inline-block py-3.5 hover:text-ink-2`,children:s(`run.madeWith`).replace(`engenty wizards`,m.name)})})]})}export{C as SharePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,r as i}from"./logo-C80CWCDM.js";import{t as a}from"./useMutation-DKcIz55V.js";import{C as o,F as s,G as c,N as l,P as u,_ as d,c as f,s as p,t as m}from"./ui-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,r as i}from"./logo-C80CWCDM.js";import{t as a}from"./useMutation-DKcIz55V.js";import{C as o,F as s,G as c,N as l,P as u,_ as d,c as f,s as p,t as m}from"./ui-GsuU9WTj.js";import{A as h,I as g,L as _,M as v,P as y,s as b}from"./definition-CHacJYmI.js";import{f as x}from"./session-Blj2os_v.js";var S={account:{kind:`release`,default:!0,label:`Account in a local install`,hint:`Linking, Settings → Account, the offer to sign in.`},unsetConnectors:{kind:`release`,default:!1,label:`Connectors without an OAuth client`,hint:`Built-in connectors are shown although their client is not set up.`},site:{kind:`release`,default:!1,label:`Link to the website in the setup`,hint:`The local install's setup links the product's site.`},teamPlans:{kind:`release`,default:!1,label:`Team plans`,hint:`The team page in the cloud studio, and plans that carry this switch on the account pages.`},ownKeys:{kind:`plan`,default:!0,label:`Own API keys`,hint:`The team puts its providers' keys into the cloud studio instead of running on credits.`}};Object.keys(S);function C(e=S){let t={};for(let[n,r]of Object.entries(e))t[n]=r.default;return t}function w(){return i({queryKey:[`config`],queryFn:()=>o.get(`/api/config`),staleTime:6e4})}function T(){let e=x(),t=w();return e.data?.features??t.data?.features??C()}function E(e){return T()[e]===!0}var D=e(t(),1),O=e(n(),1),k={en:`English`,de:`Deutsch`},A=[`en`,`de`],j=`cubic-bezier(0.3, 0.7, 0.2, 1)`,M=`(max-width: 639px)`;function N(){return(0,D.useSyncExternalStore)(e=>{let t=window.matchMedia(M);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>window.matchMedia(M).matches,()=>!1)}function P({tone:e=`ground`,ink:t}){let n=s(),r=N(),i=(0,D.useRef)({}),[a,o]=(0,D.useState)(null);(0,D.useLayoutEffect)(()=>{let e=()=>{let e={};for(let[t,n]of Object.entries(i.current))e[t]=n?Math.ceil(n.getBoundingClientRect().width):0;o(e)};e(),document.fonts?.ready.then(e)},[]);let c=e=>a?a[e===n&&!r?`${e}-full`:`${e}-short`]+24:void 0,f=a?A.slice(0,A.indexOf(n)).reduce((e,t)=>e+(c(t)??0),0):0,p=`300ms ${j}`,m=e===`ground`;return(0,O.jsxs)(`fieldset`,{className:d(`relative inline-flex items-center rounded-full border-0 p-0.5 ring-1`,m?`bg-white/10 ring-white/15`:`bg-paper-2 ring-border-soft`),children:[(0,O.jsx)(`legend`,{className:`sr-only`,children:u(`nav.language`)}),a?(0,O.jsx)(`span`,{"aria-hidden":`true`,className:d(`absolute top-0.5 bottom-0.5 left-0.5 rounded-full shadow-sm motion-reduce:transition-none`,m?`bg-white`:`bg-card`),style:{width:c(n),transform:`translateX(${f}px)`,transition:`transform ${p}, width ${p}`}}):null,A.map(e=>{let a=e===n;return(0,O.jsxs)(`button`,{"aria-pressed":a,className:d(`relative h-7 cursor-pointer overflow-hidden whitespace-nowrap rounded-full font-medium text-[0.75rem] motion-reduce:transition-none`,m?a?`text-[oklch(32%_0.15_262)]`:`text-white/70`:a?`text-ink`:`text-ink-3`),lang:e,onClick:()=>{l(e)},style:{width:c(e),transition:`width ${p}, color ${p}`,...m&&a&&t?{color:t}:{}},title:k[e],type:`button`,children:[[k[e],e.toUpperCase()].map((e,t)=>{let n=a&&!r?t===0:t===1;return(0,O.jsx)(`span`,{"aria-hidden":!n,className:`absolute inset-0 grid place-items-center motion-reduce:transition-none`,style:{opacity:+!!n,transition:`opacity 220ms ${j}`},children:e},e)}),(0,O.jsx)(`span`,{ref:t=>{i.current[`${e}-full`]=t},"aria-hidden":`true`,className:`invisible absolute`,children:k[e]}),(0,O.jsx)(`span`,{ref:t=>{i.current[`${e}-short`]=t},"aria-hidden":`true`,className:`invisible absolute`,children:e.toUpperCase()}),(0,O.jsx)(`span`,{className:`invisible px-3`,children:a?k[e]:e.toUpperCase()})]},e)})]})}function F(e){let t=window.engentyDesktop;t?t.open(e):window.open(e,`_blank`,`noopener`)}var I={gateway:`Vercel AI Gateway`,anthropic:`Anthropic`,openai:`OpenAI`};function L({models:e}){let t=r(),[n,i]=(0,D.useState)({}),[s,l]=(0,D.useState)(e.bindings),[d,h]=(0,D.useState)(e.ollamaUrl),[g,_]=(0,D.useState)(!1),v=a({mutationFn:()=>o.put(`/api/studio/local/models`,{keys:n,bindings:s,ollamaUrl:d}),onSuccess:async()=>{i({}),_(!0),setTimeout(()=>_(!1),1500),await t.invalidateQueries({queryKey:[`me`]})}});return(0,O.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(f,{children:u(`local.keys`)}),(0,O.jsx)(`p`,{className:`mb-3 text-[0.8125rem] text-ink-3`,children:u(`local.keysHint`)}),(0,O.jsx)(`div`,{className:`flex flex-col gap-2`,children:Object.keys(I).map(r=>(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`w-40 text-[0.875rem] text-ink-2`,children:I[r]}),(0,O.jsx)(p,{type:`password`,autoComplete:`off`,className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,placeholder:e.keys[r]?u(`local.keySet`):u(`local.keyEmpty`),value:n[r]??``,onChange:e=>i({...n,[r]:e.target.value})}),e.keys[r]?(0,O.jsx)(m,{variant:`ghost`,size:`sm`,onClick:()=>{i({...n,[r]:``}),o.put(`/api/studio/local/models`,{keys:{[r]:``}}).then(()=>t.invalidateQueries({queryKey:[`me`]}))},children:u(`local.keyRemove`)}):null]},r))})]}),(0,O.jsxs)(`div`,{children:[(0,O.jsx)(f,{children:u(`local.classes`)}),(0,O.jsx)(`p`,{className:`mb-3 text-[0.8125rem] text-ink-3`,children:u(`local.classesHint`)}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[b.map(e=>(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`w-40 text-[0.875rem] text-ink-2`,children:u(`class.${e}`)}),(0,O.jsx)(p,{className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,value:s[e]??``,onChange:t=>l({...s,[e]:t.target.value})})]},e)),(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`w-40 text-[0.875rem] text-ink-2`,children:`Ollama`}),(0,O.jsx)(p,{className:`min-w-0 flex-1 font-mono text-[0.8125rem]`,value:d,onChange:e=>h(e.target.value)})]})]})]}),(0,O.jsx)(`div`,{children:(0,O.jsxs)(m,{variant:`secondary`,busy:v.isPending,onClick:()=>v.mutate(),children:[g?(0,O.jsx)(c,{className:`size-4`}):null,u(g?`local.saved`:`local.save`)]})})]})}var R=[{theme:`light`,icon:g,label:`theme.light`},{theme:`dark`,icon:_,label:`theme.dark`}],z=`cubic-bezier(0.3, 0.7, 0.2, 1)`;function B({tone:e=`surface`}){let t=y(),n=v(),r=e===`ground`,i=r?n:t,a=R.findIndex(e=>e.theme===i);return(0,O.jsxs)(`fieldset`,{className:d(`relative inline-flex items-center rounded-full border-0 p-0.5 ring-1`,r?`bg-white/10 ring-white/15`:`bg-paper-2 ring-border-soft`),children:[(0,O.jsx)(`legend`,{className:`sr-only`,children:u(`nav.theme`)}),(0,O.jsx)(`span`,{"aria-hidden":`true`,className:d(`absolute top-0.5 bottom-0.5 left-0.5 w-9 rounded-full shadow-sm motion-reduce:transition-none`,r?`bg-white`:`bg-card`),style:{transform:`translateX(${a*36}px)`,transition:`transform 300ms ${z}`}}),R.map(({theme:e,icon:t,label:n})=>(0,O.jsx)(`button`,{"aria-label":u(n),"aria-pressed":e===i,className:d(`relative grid h-7 w-9 cursor-pointer place-items-center rounded-full transition-colors motion-reduce:transition-none`,r?e===i?`text-[oklch(32%_0.15_262)]`:`text-white/70 hover:text-white`:e===i?`text-ink`:`text-ink-3 hover:text-ink-2`),onClick:()=>h(e),title:u(n),type:`button`,children:(0,O.jsx)(t,{className:`size-3.5`})},e))]})}export{w as a,P as i,L as n,E as o,F as r,B as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Y as e}from"./ui-GsuU9WTj.js";var t={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};t.node;var n=e(t);export{n as t};
|