wizards 0.2.3 → 0.2.4
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/db/client.js +24 -3
- package/apps/runtime/dist/index.js +6 -0
- package/apps/runtime/dist/routes/api.js +1 -1
- package/apps/runtime/dist/services/cloud.js +60 -3
- package/apps/runtime/dist/services/files.js +50 -1
- package/apps/runtime/dist/services/spaces.js +84 -84
- package/apps/runtime/dist/update.js +3 -3
- package/apps/web/dist/assets/{ChangelogDialog-CbZBUMRu.js → ChangelogDialog-lGa0JKY1.js} +1 -1
- package/apps/web/dist/assets/{ChatPanel-zurtfj6A.js → ChatPanel-Dk_45uca.js} +1 -1
- package/apps/web/dist/assets/{CreditsDialog-BewZHZTR.js → CreditsDialog-BPMWo6tp.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-B7ZOoW5h.js → EditorPage-Dt4MCcrU.js} +1 -1
- package/apps/web/dist/assets/{FlowPreview-DHrhPps0.js → FlowPreview-gwtUv8-X.js} +1 -1
- package/apps/web/dist/assets/{HomePage-CBvWxXsq.js → HomePage-Bi9FK3_1.js} +1 -1
- package/apps/web/dist/assets/{ImportWizard-CKjVJMaG.js → ImportWizard-D6y4bKlF.js} +1 -1
- package/apps/web/dist/assets/{LocalRuntime-Brkvbzzg.js → LocalRuntime-BjzPSsHr.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-B3XePMlp.js → NewWizardPage-2HbCaPSt.js} +2 -2
- package/apps/web/dist/assets/{PublicRunner-Bn1g6HG9.js → PublicRunner-Dac_e6wg.js} +1 -1
- package/apps/web/dist/assets/{RunnerView-CO1Nk3jn.js → RunnerView-BC6crf1p.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-BIY4kHZl.js → SettingsPage-BfXxa4SU.js} +1 -1
- package/apps/web/dist/assets/{SetupPage-BvLwZH9i.js → SetupPage-CYKVspBJ.js} +1 -1
- package/apps/web/dist/assets/{SharePage-CDESJ11B.js → SharePage-DFIHsNS-.js} +1 -1
- package/apps/web/dist/assets/{api-9sHuNTkp.js → api-BTfKh3La.js} +1 -1
- package/apps/web/dist/assets/changelog-CLmll9By.js +1 -0
- package/apps/web/dist/assets/{index-VsRgvimv.js → index-DOpyzQiU.js} +3 -3
- package/apps/web/dist/assets/{meta-B4mZqEso.js → meta-BbVhbYf6.js} +1 -1
- package/apps/web/dist/assets/{outputs-boPx5ngv.js → outputs-n_yhxmMk.js} +1 -1
- package/apps/web/dist/assets/{session-CJGuo1Tv.js → session-D_Zggq_t.js} +1 -1
- package/apps/web/dist/assets/ui-C3bTWmdM.js +1 -0
- package/apps/web/dist/index.html +4 -4
- package/apps/web/dist/mcp/flow.html +1 -1
- package/package.json +1 -1
- package/apps/web/dist/assets/changelog-Cto0j5-V.js +0 -1
- package/apps/web/dist/assets/ui-iTYHqwvY.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,S as i,c as a,d as o,i as s,j as c,k as l,n as u,nt as d,w as f}from"./api-9sHuNTkp.js";import{d as p,l as m,o as h,s as g,t as _}from"./session-CJGuo1Tv.js";import{t as v}from"./createLucideIcon-q3MZMmnf.js";import{n as y,t as ee}from"./plug-CLjyCoHB.js";import{t as te}from"./arrow-right-6FyN3e7D.js";import{D as b,E as ne,S as x,T as re,r as ie,w as ae,x as oe,y as S}from"./outputs-boPx5ngv.js";import{t as C}from"./check-CUpby_J9.js";import{n as w,r as se,t as ce}from"./wand-sparkles-CKxArWPY.js";import{a as le,r as ue,t as de}from"./ChatPanel-zurtfj6A.js";import{a as fe,i as pe,n as me,r as he,t as ge}from"./type-BMJpS6_D.js";import{n as _e,t as T}from"./plus-Du-Jx8aI.js";import{t as E}from"./external-link-MAL7vJYj.js";import{n as ve}from"./mic-Bvz4mA2j.js";import{p as ye}from"./definition-DndaH5Ow.js";import{t as be}from"./upload--J5bZhEM.js";import{_ as D,a as xe,c as O,d as k,f as Se,h as A,i as j,m as M,n as N,o as P,p as Ce,r as F,s as I,t as L,u as we,y as R}from"./ui-iTYHqwvY.js";import{a as Te,c as Ee,i as De,o as Oe,r as ke,s as Ae,u as je}from"./index-VsRgvimv.js";import{o as z,r as B,t as Me}from"./LocalRuntime-Brkvbzzg.js";import{ProjectSwitcher as Ne}from"./HomePage-CBvWxXsq.js";var Pe={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Pe.node;var Fe=v(Pe),Ie={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};Ie.node;var Le=v(Ie),Re={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};Re.node;var ze=v(Re),Be={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};Be.node;var Ve=v(Be),He={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};He.node;var Ue=v(He),We={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`}]]};We.node;var Ge=v(We),Ke={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};Ke.node;var qe=v(Ke),Je={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};Je.node;var Ye=v(Je),Xe={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Xe.node;var Ze=v(Xe),Qe={name:`music`,size:24,node:[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]};Qe.node;var $e=v(Qe),et={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`}]]};et.node;var tt=v(et),nt={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`}]]};nt.node;var rt=v(nt),it={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};it.node;var at=v(it),ot={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};ot.node;var st=v(ot),ct={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`}]]};ct.node;var lt=v(ct),V=e(t(),1),H=e(n(),1);function U({title:e,hint:t,save:n,action:r,locked:i,children:a}){return(0,H.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-1`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),n?.state===`saving`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,H.jsx)(k,{className:`size-3`}),` `,R(`project.saving`)]}):n?.state===`saved`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-moss`,children:[(0,H.jsx)(C,{className:`size-3.5`}),` `,R(`settings.saved`)]}):null]}),t?(0,H.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-snug`,children:t}):null]}),r?(0,H.jsx)(`div`,{className:`shrink-0`,children:r}):null]}),(0,H.jsxs)(N,{className:`p-5`,children:[i?(0,H.jsx)(`fieldset`,{disabled:!0,className:`min-w-0`,children:a}):a,n?.state===`error`&&n.error?(0,H.jsx)(`p`,{className:`mt-4 text-[14px] text-rose`,children:n.error}):null]})]})}function ut({children:e,layout:t,onToggle:n}){return(0,H.jsxs)(`div`,{className:`mb-3 flex items-start gap-2`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(`div`,{className:`w-56 max-w-full transition-[width] duration-200 focus-within:w-full has-[input:not(:placeholder-shown)]:w-full`,children:e})}),(0,H.jsx)(P,{label:R(t===`list`?`project.viewCards`:`project.viewList`),onClick:n,children:t===`list`?(0,H.jsx)(qe,{className:`size-4`}):(0,H.jsx)(Ye,{className:`size-4`})})]})}function dt({value:e,onChange:t,onEnter:n,placeholder:r,busy:i}){return(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(he,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-4`}),(0,H.jsx)(`input`,{type:`search`,value:e,placeholder:r,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n?.(),className:`h-9 w-full rounded-lg border border-input bg-card pr-3 pl-9 text-[14px] text-ink outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow`}),i?(0,H.jsx)(k,{className:`-translate-y-1/2 absolute top-1/2 right-3 size-4 text-ink-3`}):null]})}function W({onFiles:e,accept:t,multiple:n=!0,className:r,children:i}){return(0,H.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),e.currentTarget.dataset.over=`1`},onDragLeave:e=>{delete e.currentTarget.dataset.over},onDrop:t=>{t.preventDefault(),delete t.currentTarget.dataset.over;let r=Array.from(t.dataTransfer.files);r.length&&e(n?r:r.slice(0,1))},className:A(`flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-input border-dashed text-[14px] text-ink-3 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow hover:border-ink-4 hover:text-ink data-[over]:border-focus data-[over]:bg-paper-2 data-[over]:text-ink`,r),children:[i,(0,H.jsx)(`input`,{className:`sr-only`,type:`file`,accept:t,multiple:n,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length&&e(n)}})]})}function ft(){let e=Ee(),[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(null),a=async e=>{n(e??`*`),i(null);try{await Ae(e)}catch(e){i(e.message)}finally{n(null)}};return(0,H.jsxs)(U,{title:R(`plugins.title`),hint:e.canReload?R(`plugins.hint`):R(`plugins.hintManaged`),action:e.canReload?(0,H.jsx)(L,{variant:`secondary`,busy:t===`*`,onClick:()=>void a(),children:R(`plugins.rescan`)}):null,children:[(0,H.jsxs)(`ul`,{className:`divide-y divide-border-soft`,children:[e.plugins.map(n=>{let r=e.failed[n.id];return(0,H.jsxs)(`li`,{className:`flex items-start gap-4 py-4 first:pt-0 last:pb-0`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,H.jsx)(`span`,{className:`font-medium text-[15px]`,children:n.name}),n.name===n.id?null:(0,H.jsxs)(`span`,{className:`font-mono text-[12px] text-ink-4`,children:[n.id,` · `,n.version]})]}),n.description?(0,H.jsx)(`p`,{className:`mt-0.5 text-[14px] text-ink-3`,children:n.description}):null,n.tools.length?(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[12px] text-ink-3`,children:[R(`plugins.tools`),n.tools.map(e=>(0,H.jsx)(F,{children:e.id},e.id))]}):null,n.error?(0,H.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:R(`plugins.serverFailed`,{error:n.error})}):null,r?(0,H.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:R(`plugins.studioFailed`,{error:r})}):null]}),e.canReload?(0,H.jsx)(P,{label:R(`plugins.reload`),disabled:t!==null,onClick:()=>void a(n.id),children:(0,H.jsx)(rt,{className:t===n.id?`size-4 animate-spin`:`size-4`})}):null]},n.id)}),e.problems.map(e=>(0,H.jsxs)(`li`,{className:`py-4 first:pt-0 last:pb-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,H.jsx)(F,{tone:`warn`,children:R(`plugins.problems`)}),(0,H.jsx)(`span`,{className:`break-all font-mono text-[12px] text-ink-3`,children:e.path})]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:e.message})]},e.path))]}),r?(0,H.jsx)(`p`,{className:`mt-4 text-[13px] text-rose`,children:r}):null]})}var pt=e=>[`project-files`,e];function mt(e){return c({queryKey:pt(e),queryFn:()=>u.get(`/api/studio/projects/${e}/files`),refetchInterval:e=>e.state.data?.files.some(e=>e.status===`pending`)?2e3:!1})}function G(e,t){return a(`/api/studio/projects/${e}/files/${t}/content`)}function K(e,t=!1){let n=d(),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(null),s=()=>n.invalidateQueries({queryKey:pt(e)}),c=async e=>{o(null);try{await e()}catch(e){o(e.message)}finally{await s()}};return{busy:r,error:a,readOnly:t,upload:async(t,n)=>{i(!0),await c(async()=>{for(let r of n)await u.upload(`/api/studio/projects/${e}/files?kind=${t}`,r),await s()}),i(!1)},describe:(t,n)=>c(()=>u.patch(`/api/studio/projects/${e}/files/${t}`,{description:n})),remove:t=>c(()=>u.del(`/api/studio/projects/${e}/files/${t}`)),reindex:t=>c(()=>u.post(`/api/studio/projects/${e}/files/${t}/reindex`)),order:(t,n)=>c(()=>u.put(`/api/studio/projects/${e}/files/order`,{kind:t,ids:n}))}}function ht(e,t){let n=`wz.layout.${e}`,[r,i]=(0,V.useState)(()=>{try{let e=localStorage.getItem(n);return e===`list`||e===`cards`?e:t}catch{return t}});return[r,()=>i(e=>{let t=e===`list`?`cards`:`list`;try{localStorage.setItem(n,t)}catch{}return t})]}function q(e,t,n=700){let[r,i]=(0,V.useState)(`idle`),[a,o]=(0,V.useState)(null),s=JSON.stringify(e),c=(0,V.useRef)(s),l=(0,V.useRef)({value:e,json:s,save:t});l.current={value:e,json:s,save:t};let u=(0,V.useRef)(Promise.resolve()),d=(0,V.useCallback)(()=>{let e=l.current;e.json!==c.current&&(c.current=e.json,i(`saving`),u.current=u.current.then(async()=>{try{await e.save(e.value),o(null),i(`saved`)}catch(e){c.current=``,o(e.message),i(`error`)}}))},[]);return(0,V.useEffect)(()=>{if(s===c.current)return;let e=setTimeout(d,n);return()=>clearTimeout(e)},[s,n,d]),(0,V.useEffect)(()=>d,[d]),{state:r,error:a}}function gt(e){return e<1e6?`${Math.max(1,Math.round(e/1e3))} KB`:`${(e/1e6).toFixed(1)} MB`}var _t=`mt-1.5 text-[13px] text-ink-3`;function vt(e){let t=d(),[n,r]=(0,V.useState)(!1),i=p({mutationFn:e=>u.post(`/api/studio/account/link`,e),onSuccess:({url:e})=>{B(e),r(!0)}});return(0,V.useEffect)(()=>{if(!n)return;let e=setInterval(()=>void t.invalidateQueries({queryKey:[`me`]}),2e3),i=setTimeout(()=>r(!1),3e5);return()=>{clearInterval(e),clearTimeout(i)}},[n,t]),(0,V.useEffect)(()=>{e&&r(!1)},[e]),{link:i,waiting:n}}function yt({link:e,waiting:t}){return e.isError?(0,H.jsx)(`p`,{className:`text-[13px] text-rose`,children:R(`local.accountFailed`)}):t?(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-[13px] text-ink-3`,children:[(0,H.jsx)(k,{className:`size-3.5`}),` `,R(`local.accountWaiting`)]}):null}function bt(){let e=vt(!1),{link:t}=e,[n,r]=(0,V.useState)(``);return(0,H.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-4 py-5 first:pt-0 last:pb-0`,children:[(0,H.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2`,children:(0,H.jsx)(Ve,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`font-medium text-[15px]`,children:R(`account.local`)}),(0,H.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-relaxed`,children:R(`account.localText`)})]})]}),z.account?(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 py-5 last:pb-0`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`font-medium text-[15px]`,children:R(`account.with`)}),(0,H.jsxs)(`ul`,{className:`mt-2 flex flex-col gap-2 text-[14px] text-ink-2 leading-snug`,children:[(0,H.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,H.jsx)(fe,{className:`mt-0.5 size-4 shrink-0 text-amber`}),R(`account.withCredits`)]}),(0,H.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,H.jsx)(Le,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),R(`account.withCloud`)]})]})]}),(0,H.jsx)(`div`,{children:(0,H.jsx)(L,{busy:t.isPending&&!t.variables?.signup,onClick:()=>t.mutate({}),children:R(`account.signIn`)})})]}):null,z.account?(0,H.jsxs)(`form`,{className:`flex flex-col gap-3 py-5 last:pb-0`,onSubmit:e=>{e.preventDefault(),t.mutate({signup:!0,code:n.trim()||void 0})},children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`font-medium text-[15px]`,children:R(`account.new`)}),(0,H.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-relaxed`,children:R(`account.newHint`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(I,{value:n,maxLength:64,autoComplete:`off`,spellCheck:!1,placeholder:R(`account.code`),"aria-label":R(`account.code`),onChange:e=>r(e.target.value),className:`w-56 font-mono text-[14px]`}),(0,H.jsx)(L,{type:`submit`,variant:`secondary`,className:`h-11`,busy:t.isPending&&!!t.variables?.signup,children:R(`account.create`)})]}),(0,H.jsx)(yt,{...e})]}):null]})}var xt={start:`account.kind.start`,monthly:`account.kind.monthly`,gift:`account.kind.gift`};function St(e){try{return new URL(e).host}catch{return e}}function Ct({account:e}){let t=d(),n=vt(e.signedIn),r=p({mutationFn:()=>u.del(`/api/studio/account`),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})}),i=new Intl.DateTimeFormat(D,{dateStyle:`medium`});return(0,H.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 py-5 first:pt-0`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-[15px]`,children:e.name||e.email}),e.signedIn?(0,H.jsx)(F,{tone:`live`,children:R(`account.linked`)}):null]}),(0,H.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:e.email})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(L,{variant:`secondary`,onClick:()=>B(e.url),children:[R(`setup.openAccount`),` `,(0,H.jsx)(E,{className:`size-4`})]}),(0,H.jsxs)(L,{variant:`ghost`,busy:r.isPending,onClick:()=>r.mutate(),children:[(0,H.jsx)(je,{className:`size-4`}),` `,R(`nav.logout`)]})]})]}),e.signedIn?null:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 py-5`,children:[(0,H.jsx)(`p`,{className:`text-[14px] text-ink-2`,children:R(`local.accountExpired`)}),(0,H.jsx)(`div`,{children:(0,H.jsx)(L,{busy:n.link.isPending,onClick:()=>n.link.mutate({}),children:R(`account.signInAgain`)})}),(0,H.jsx)(yt,{...n})]}),e.credits===null?null:(0,H.jsxs)(`div`,{className:`py-5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`text-[13px] text-ink-3`,children:R(`account.credits`)}),(0,H.jsx)(`div`,{className:`font-display font-semibold text-[22px] tabular-nums leading-tight`,children:R(`nav.credits`,{n:Math.floor(e.credits).toLocaleString()})})]}),(0,H.jsxs)(L,{variant:`secondary`,onClick:()=>B(`${e.url}/billing`),children:[R(`account.topUp`),` `,(0,H.jsx)(E,{className:`size-4`})]})]}),e.expiring.length?(0,H.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1 text-[13px] text-ink-3 tabular-nums`,children:e.expiring.map(e=>(0,H.jsxs)(`li`,{children:[R(`account.expires`,{n:Math.floor(e.credits).toLocaleString(),date:i.format(new Date(e.expiresAt))}),xt[e.kind]?(0,H.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,R(xt[e.kind])]}):null]},`${e.kind}:${e.expiresAt}`))}):null]}),(0,H.jsxs)(`div`,{className:`flex items-start gap-2.5 py-5 text-[14px] text-ink-2 leading-snug last:pb-0`,children:[(0,H.jsx)(Le,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),(0,H.jsx)(`p`,{children:R(`account.cloud`,{host:St(e.cloudUrl)})})]})]})}function wt({me:e}){let t=d(),n=e.mode===`managed`,[r,i]=(0,V.useState)(e.profile),a=e=>i(t=>({...t,...e})),o=q(r,async e=>{await u.put(`/api/studio/profile`,e),await t.invalidateQueries({queryKey:[`me`]})});return(0,H.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,H.jsx)(U,{title:R(`account.title`),hint:R(`account.hint`),save:o,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 sm:w-32`,children:[(0,H.jsx)(`div`,{className:`flex size-20 items-center justify-center overflow-hidden rounded-full bg-ember-tint font-semibold text-[28px] text-ember-strong ring-1 ring-border-soft`,children:e.user.image?(0,H.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full object-cover`}):_(r.name)||`?`}),(0,H.jsx)(`p`,{className:`text-center text-[12px] text-ink-3 leading-snug`,children:R(`account.initials`)})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`account.name`)}),(0,H.jsx)(I,{value:r.name,maxLength:80,disabled:n,onChange:e=>a({name:e.target.value})}),(0,H.jsx)(`p`,{className:_t,children:R(n?`account.fromAccount`:`account.nameHint`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`account.about`)}),(0,H.jsx)(M,{minRows:3,maxLength:2e3,value:r.about,onChange:e=>a({about:e.target.value})}),(0,H.jsx)(`p`,{className:_t,children:R(`account.aboutHint`)})]}),(0,H.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`account.email`)}),(0,H.jsx)(I,{type:`email`,value:r.email,maxLength:200,disabled:n,onChange:e=>a({email:e.target.value})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`account.phone`)}),(0,H.jsx)(I,{type:`tel`,value:r.phone,maxLength:40,onChange:e=>a({phone:e.target.value})})]})]})]})]})}),(0,H.jsx)(U,{title:R(`account.connection`),hint:R(`account.connectionHint`),children:n?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-[15px]`,children:e.user.name}),(0,H.jsx)(F,{tone:`live`,children:R(`account.linked`)})]}),(0,H.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:e.user.email})]}),e.manageUrl?(0,H.jsxs)(L,{variant:`secondary`,onClick:()=>B(`${e.manageUrl}/account`),children:[R(`setup.openAccount`),` `,(0,H.jsx)(E,{className:`size-4`})]}):null]}):e.account?(0,H.jsx)(Ct,{account:e.account}):(0,H.jsx)(bt,{})}),(0,H.jsx)(U,{title:R(`account.look`),hint:R(`account.lookHint`),children:(0,H.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pb-4`,children:[(0,H.jsx)(`span`,{className:`font-medium text-[14px]`,children:R(`nav.language`)}),(0,H.jsx)(Te,{tone:`surface`})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-4`,children:[(0,H.jsx)(`span`,{className:`font-medium text-[14px]`,children:R(`nav.theme`)}),(0,H.jsx)(ke,{})]})]})})]})}function Tt({connector:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-3 px-3 py-2 text-left`,children:[(0,H.jsx)(`span`,{className:A(`size-2 shrink-0 rounded-full`,e.usable?`bg-moss`:`bg-ink-4`)}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:[e.name,` `,(0,H.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:e.id})]}),(0,H.jsx)(`span`,{className:`shrink-0 text-[12px] text-ink-3`,children:e.usable?R(`connectors.actions`,{n:e.actions.length,r:e.actions.filter(e=>e.group===`read`).length}):R(`connectors.notSetUp`)})]}),t?(0,H.jsxs)(`div`,{className:`border-border-soft border-t px-3 py-2 text-[12px]`,children:[e.missingSetup?(0,H.jsxs)(`p`,{className:`mb-1 text-ink-3`,children:[R(`connectors.setup`),` `,(0,H.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.missingSetup})]}):null,(0,H.jsx)(`p`,{className:`text-ink-4`,children:e.actions.map(e=>e.group===`read`?e.id:`${e.id} (${R(`connectors.group.${e.group}`)})`).join(` · `)})]}):null]})}var Et={none:`connectors.authNone`,oauth2:`connectors.authOauth`,api_key:`connectors.authKey`};function Dt({projectId:e,connector:t,readOnly:n}){let r=d(),[i,a]=(0,V.useState)(!1),o=()=>r.invalidateQueries({queryKey:[`connectors`,e]}),s=`/api/studio/projects/${e}/connectors/${t.id}`,c=p({mutationFn:()=>u.post(`${s}/refresh`),onSuccess:o}),l=p({mutationFn:()=>u.del(s),onSuccess:o}),f=t.actions.filter(e=>e.group===`read`).length;return(0,H.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,H.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-paper-2 text-ink-2`,children:(0,H.jsx)(ee,{className:`size-4`})}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`min-w-0 flex-1 text-left`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-[14px]`,children:t.name}),(0,H.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:t.id})]}),(0,H.jsxs)(`div`,{className:`truncate text-[12px] text-ink-3`,children:[t.domain,` · `,t.sourceKind===`mcp`?`MCP`:`OpenAPI`,` ·`,` `,R(Et[t.auth]),` ·`,` `,t.toolsPending?R(`connectors.pending`):R(`connectors.actions`,{n:t.actions.length,r:f})]})]}),n?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(P,{label:R(`connectors.refresh`),onClick:()=>c.mutate(),children:c.isPending?(0,H.jsx)(k,{className:`size-4`}):(0,H.jsx)(ye,{className:`size-4`})}),(0,H.jsx)(P,{label:R(`connectors.remove`),className:`hover:text-rose`,onClick:()=>confirm(`${t.name}: ${R(`connectors.remove`)}?`)&&l.mutate(),children:(0,H.jsx)(S,{className:`size-4`})})]})]}),t.needsOAuthClient?(0,H.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:R(`connectors.needsClient`)}):null,c.error??l.error?(0,H.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:(c.error??l.error).message}):null,i&&t.actions.length?(0,H.jsx)(`ul`,{className:`max-h-64 overflow-y-auto border-border-soft border-t px-3 py-2`,children:t.actions.map(e=>(0,H.jsxs)(`li`,{className:`flex items-baseline gap-2 py-1 text-[12px]`,children:[(0,H.jsx)(`span`,{className:A(`w-14 shrink-0 text-[11px] uppercase tracking-wide`,e.group===`read`?`text-moss`:e.group===`write`?`text-ink-3`:`text-rose`),children:R(`connectors.group.${e.group}`)}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-ink-2`,children:e.id}),(0,H.jsx)(`span`,{className:`min-w-0 truncate text-ink-4`,children:e.summary})]},e.id))}):null]})}function Ot({projectId:e,domain:t,source:n,taken:r,onDone:i}){let a=d(),[o,s]=(0,V.useState)({id:``,secret:``}),[c,l]=(0,V.useState)(!1),f=r.includes(n.suggestedId),m=p({mutationFn:()=>u.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}:{},...o.id&&o.secret?{oauthClientId:o.id,oauthClientSecret:o.secret}:{}}),onSuccess:async t=>{await a.invalidateQueries({queryKey:[`connectors`,e]}),i(t.warnings)}});return(0,H.jsxs)(`div`,{className:`rounded-lg bg-card p-3 ring-1 ring-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(F,{tone:n.sourceKind===`mcp`?`ember`:`neutral`,children:n.sourceKind===`mcp`?`MCP`:`OpenAPI`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-[13px]`,children:n.name??n.suggestedId}),(0,H.jsx)(`div`,{className:`truncate font-mono text-[11px] text-ink-4`,children:n.sourceUrl})]}),n.blocked||f?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`text-[12px] text-ink-3 hover:text-ink`,children:R(`connectors.ownClient`)}),(0,H.jsx)(L,{size:`sm`,busy:m.isPending,onClick:()=>m.mutate(),children:R(`connectors.import`)})]})]}),n.blocked?(0,H.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:n.blocked}):null,f?(0,H.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:R(`connectors.exists`)}):null,c?(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,H.jsx)(I,{placeholder:`OAuth Client-ID`,value:o.id,onChange:e=>s(t=>({...t,id:e.target.value}))}),(0,H.jsx)(I,{type:`password`,autoComplete:`off`,placeholder:`OAuth Client-Secret`,value:o.secret,onChange:e=>s(t=>({...t,secret:e.target.value}))})]}):null,m.error?(0,H.jsx)(`p`,{className:`mt-2 text-[12px] text-rose`,children:m.error.message}):null]})}function kt({projectId:e,readOnly:t}){let[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[l,d]=(0,V.useState)([]),f=c({queryKey:[`connectors`,e],queryFn:()=>u.get(`/api/studio/projects/${e}/connectors`)}),m=p({mutationFn:()=>u.post(`/api/studio/connectors/search`,{query:n}),onSuccess:e=>{a(e),s(null),d([])}}),h=p({mutationFn:e=>u.get(`/api/studio/connectors/registry/${encodeURIComponent(e)}`),onSuccess:s}),g=f.data??[],_=g.filter(e=>e.sourceKind===`builtin`&&(z.unsetConnectors||e.usable)),v=g.filter(e=>e.sourceKind!==`builtin`);return(0,H.jsxs)(N,{className:`p-6`,children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:R(`connectors.title`)}),(0,H.jsx)(`p`,{className:`mt-1 mb-5 text-[14px] text-ink-3`,children:R(`connectors.hint`)}),_.length?(0,H.jsx)(`div`,{className:`mb-5 grid gap-1.5 sm:grid-cols-2`,children:_.map(e=>(0,H.jsx)(Tt,{connector:e},e.id))}):null,(0,H.jsx)(`h3`,{className:`mb-2 font-medium text-[12px] text-ink-3 uppercase tracking-[0.07em]`,children:R(`connectors.imported`)}),v.length?(0,H.jsx)(`div`,{className:`mb-4 flex flex-col gap-2`,children:v.map(n=>(0,H.jsx)(Dt,{projectId:e,connector:n,readOnly:t},n.id))}):null,t?v.length?null:(0,H.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:R(`connectors.noneImported`)}):(0,H.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),n.trim()&&m.mutate()},children:[(0,H.jsx)(I,{value:n,placeholder:R(`connectors.search`),onChange:e=>r(e.target.value)}),(0,H.jsxs)(L,{type:`submit`,variant:`secondary`,busy:m.isPending,children:[(0,H.jsx)(he,{className:`size-4`}),` `,R(`connectors.find`)]})]}),m.error?(0,H.jsx)(`p`,{className:`mt-3 text-[13px] text-rose`,children:m.error.message}):null,i&&!o?(0,H.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1`,children:[i.length?null:(0,H.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:R(`connectors.none`)}),i.map(e=>(0,H.jsxs)(`button`,{type:`button`,disabled:!e.kinds.length,onClick:()=>h.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,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-[14px]`,children:e.domain}),(0,H.jsx)(`div`,{className:`truncate text-[12px] text-ink-3`,children:e.description})]}),(0,H.jsx)(`span`,{className:`text-[11px] text-ink-4 uppercase`,children:e.kinds.join(` · `)}),(0,H.jsx)(se,{className:`-rotate-90 size-4 text-ink-4`})]},e.domain)),h.isPending?(0,H.jsx)(k,{className:`mx-auto mt-2 size-4 text-ink-4`}):null,h.error?(0,H.jsx)(`p`,{className:`text-[13px] text-rose`,children:h.error.message}):null]}):null,o?(0,H.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,H.jsx)(`div`,{className:`font-medium text-[14px]`,children:o.domain}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(null),className:`text-[12px] text-ink-3 hover:text-ink`,children:R(`run.back`)})]}),o.summary?(0,H.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:o.summary}):null,o.sources.map(t=>(0,H.jsx)(Ot,{projectId:e,domain:o.domain,source:t,taken:g.map(e=>e.id),onDone:d},`${t.sourceKind}:${t.sourceUrl}`)),o.credentials.filter(e=>e.setup||e.url).map(e=>(0,H.jsxs)(`p`,{className:`text-[12px] text-ink-3`,children:[(0,H.jsxs)(`span`,{className:`text-ink-2`,children:[e.label,`:`]}),` `,e.setup,` `,e.url?(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-ember underline`,children:e.url}):null]},e.label)),l.map(e=>(0,H.jsx)(`p`,{className:`text-[12px] text-ink-3`,children:e},e))]}):null]})}var J=`engenty-wizards`,At=`ENGENTY_WIZARDS_KEY`,jt=[{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 Y({text:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-paper-2 p-3`,children:[(0,H.jsx)(`code`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-[12px] leading-relaxed`,children:e}),(0,H.jsx)(P,{label:R(t?`settings.copied`:`settings.copy`),onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,H.jsx)(C,{className:`size-4`}):(0,H.jsx)(_e,{className:`size-4`})})]})}function Mt(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 X({children:e}){return(0,H.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:e})}function Z({title:e,children:t}){return(0,H.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,H.jsx)(`h3`,{className:`font-medium text-[15px]`,children:e}),t]})}function Q(e,t){return JSON.stringify({[e]:{[J]:t}},null,2)}function Nt({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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.terminal`)}),(0,H.jsx)(Y,{text:`claude mcp add --transport http --scope user ${J} ${t}${r?` --header "${r}"`:``}`}),!n&&Mt(t)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.ccPlugin`)}),(0,H.jsx)(Y,{text:`claude plugin marketplace add ${e}/marketplace.json`}),(0,H.jsx)(Y,{text:`claude plugin install ${J}@engenty`})]}):null]})}case`codex`:return n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.codexKey`)}),(0,H.jsx)(Y,{text:`echo 'export ${At}=${n}' >> ~/.zshrc && source ~/.zshrc`}),(0,H.jsx)(Y,{text:`codex mcp add ${J} --url ${t} --bearer-token-env-var ${At}`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.terminal`)}),(0,H.jsx)(Y,{text:`codex mcp add ${J} --url ${t}`}),(0,H.jsx)(Y,{text:`codex mcp login ${J}`})]});case`gemini`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.terminal`)}),(0,H.jsx)(Y,{text:`gemini mcp add --scope user --transport http ${J} ${t}${r?` -H "${r}"`:``}`})]});case`cursor`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.file`,{file:`~/.cursor/mcp.json`})}),(0,H.jsx)(Y,{text:Q(`mcpServers`,{url:t,...i})})]});case`vscode`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.vscode`)}),(0,H.jsx)(Y,{text:Q(`servers`,{type:`http`,url:t,...i})})]});case`windsurf`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.file`,{file:`~/.codeium/windsurf/mcp_config.json`})}),(0,H.jsx)(Y,{text:Q(`mcpServers`,{serverUrl:t,...i})})]});case`lm-studio`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.file`,{file:`~/.lmstudio/mcp.json`})}),(0,H.jsx)(Y,{text:Q(`mcpServers`,{url:t,...i})})]});case`claude-desktop`:case`claude-ai`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.claudeAi`)}),(0,H.jsx)(Y,{text:t})]});case`chatgpt`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.chatgpt`)}),(0,H.jsx)(Y,{text:t})]});default:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.generic`)}),(0,H.jsx)(Y,{text:t}),r?(0,H.jsx)(Y,{text:r}):null]})}}function Pt(){let e=d(),t=c({queryKey:[`api-keys`],queryFn:()=>u.get(`/api/studio/api-keys`)}),n=p({mutationFn:e=>u.del(`/api/studio/api-keys/${e}`),onSuccess:()=>e.invalidateQueries({queryKey:[`api-keys`]})});return t.data?.length?(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:R(`mcp.keys`)}),(0,H.jsx)(`p`,{className:`mt-1 mb-4 text-[14px] text-ink-3`,children:R(`mcp.keysHint`)}),(0,H.jsx)(N,{className:`flex flex-col gap-2 p-3`,children:t.data.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-3 py-2`,children:[(0,H.jsx)(Ge,{className:`size-4 shrink-0 text-ink-4`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-[14px]`,children:e.name}),(0,H.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-4`,children:[e.start,`… ·`,` `,e.lastRequest?R(`settings.lastUsed`,{when:new Date(e.lastRequest).toLocaleString()}):R(`settings.neverUsed`)]})]}),(0,H.jsx)(P,{label:R(`settings.revoke`),onClick:()=>n.mutate(e.id),className:`hover:text-rose`,children:(0,H.jsx)(S,{className:`size-4`})})]},e.id))})]}):null}function Ft({state:e,title:t,children:n}){return(0,H.jsxs)(`li`,{className:`grid grid-cols-[22px_minmax(0,1fr)] gap-x-3`,children:[(0,H.jsx)(`span`,{className:A(`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,H.jsx)(C,{className:`size-3.5`,strokeWidth:3}):e===`now`?(0,H.jsx)(k,{className:`size-3`}):null}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 pb-4`,children:[(0,H.jsx)(`span`,{className:A(`text-[14px]`,e===`later`?`text-ink-3`:`font-medium`),children:t}),e===`now`?n:null]})]})}function It({widgets:e}){return(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`rounded-xl bg-paper p-4 ring-1 ring-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-[14px]`,children:[(0,H.jsx)(lt,{className:`size-4 text-ember-strong`}),` MCP`]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:R(`integrate.kindMcp`)})]}),(0,H.jsxs)(`div`,{className:A(`rounded-xl p-4 ring-1`,e?`bg-paper ring-border-soft`:`bg-paper-2/60 ring-border-soft/60`),children:[(0,H.jsxs)(`div`,{className:A(`flex items-center gap-2 font-medium text-[14px]`,e?null:`text-ink-3`),children:[(0,H.jsx)(y,{className:A(`size-4`,e?`text-ember-strong`:`text-ink-4`)}),` MCP App`]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:R(e?`integrate.kindApp`:`integrate.kindAppNo`)})]})]})}function Lt({selected:e,title:t,note:n,tone:r,widgets:i,disabled:a,onPick:o}){return(0,H.jsxs)(`button`,{type:`button`,disabled:a,onClick:o,"aria-pressed":e,className:A(`group flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left transition`,e?`bg-card shadow-soft ring-1 ring-border-soft`:`hover:bg-accent`,a&&`cursor-default opacity-55 hover:bg-transparent`),children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-[14px]`,children:t}),i?(0,H.jsx)(`span`,{title:`MCP App`,className:`rounded bg-ember-tint px-1 font-semibold text-[10px] text-ember-strong leading-4`,children:`APP`}):null]}),n?(0,H.jsxs)(`span`,{className:A(`flex items-center gap-1 text-[12px]`,r===`done`?`text-moss`:r===`ok`?`text-ink-2`:`text-ink-4`),children:[r===`done`?(0,H.jsx)(C,{className:`size-3`,strokeWidth:3}):null,n]}):null]}),a?null:(0,H.jsx)(te,{className:A(`size-3.5 shrink-0 transition`,e?`text-ink-3`:`text-ink-4 opacity-0 group-hover:opacity-100`)})]})}function Rt({at:e,done:t}){let n=[R(`setup.stage.connect`),R(`setup.stage.test`),R(`setup.stage.done`)];return(0,H.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-medium text-[11px] uppercase tracking-[0.14em]`,children:n.map((n,r)=>{let i=t||r<e;return(0,H.jsxs)(`li`,{"aria-current":!i&&r===e?`step`:void 0,className:A(`flex items-center gap-1`,i?`text-moss`:r===e?`text-ember-strong`:`text-ink-4`),children:[i?(0,H.jsx)(C,{className:`size-3`,strokeWidth:3}):null,n]},n)})})}function zt({client:e,local:t,seen:n,managed:r,url:i}){let a=d(),o=Mt(i),s=!r&&!!t&&!e.oauth,[c,l]=(0,V.useState)(s&&t?.installed!==!1?`here`:`address`),[f,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(),_=p({mutationFn:t=>u.post(`/api/studio/local/apps/${e.id}`,{connect:t}),onSuccess:e=>m(e),onError:e=>m({ok:!1,message:e.message}),onSettled:()=>a.invalidateQueries({queryKey:[`local-apps`]})}),v=p({mutationFn:()=>u.post(`/api/studio/api-keys`,{name:e.name.slice(0,32)}),onSuccess:async e=>{g(e.key),await a.invalidateQueries({queryKey:[`api-keys`]})}}),y=e.oauth===!0||e.id===`claude-desktop`,ee=c===`address`&&y&&!(r&&o),te=c===`here`?!!t?.connected:r||!!h,b=!!n?.toolAt,ne=b?2:te||n?1:0,x=e=>(0,H.jsx)(Y,{text:e});return(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Rt,{at:ne,done:b}),(0,H.jsx)(`h2`,{className:`mt-1.5 font-display font-semibold text-[26px] leading-tight tracking-tight`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3`,children:e.widgets?R(`integrate.leadApp`):R(`integrate.leadMcp`)})]}),(0,H.jsx)(It,{widgets:e.widgets}),(0,H.jsxs)(N,{className:`flex flex-col gap-6 p-6`,children:[s||!e.oauth?(0,H.jsx)(Z,{title:R(`integrate.where`),children:(0,H.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[`here`,`address`].map(e=>{let t=e===`here`&&!s;return(0,H.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>l(e),"aria-pressed":c===e,className:A(`flex items-start gap-3 rounded-xl p-3.5 text-left ring-1 transition`,c===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,H.jsx)(Ze,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}):(0,H.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block font-medium text-[14px]`,children:R(e===`here`?`integrate.here`:`integrate.address`)}),(0,H.jsx)(`span`,{className:`block text-[12px] text-ink-3`,children:R(e===`here`?r?`integrate.hereManaged`:`integrate.hereHint`:`integrate.addressHint`)})]})]},e)})})}):null,ee?(0,H.jsx)(Z,{title:R(`mcp.notHere`),children:(0,H.jsx)(X,{children:R(r?`mcp.needsPublic`:`integrate.oauthLocal`)})}):c===`here`?(0,H.jsxs)(Z,{title:R(`integrate.connectTitle`),children:[t?.installed===!1&&!t.connected?(0,H.jsx)(X,{children:R(`integrate.notInstalled`,{app:e.name})}):null,t?.connected?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] text-ink-2`,children:[(0,H.jsx)(C,{className:`size-4 text-moss`}),R(`integrate.connected`,{app:e.name})]}),(0,H.jsx)(L,{size:`sm`,variant:`ghost`,busy:_.isPending&&_.variables===!1,onClick:()=>_.mutate(!1),children:R(`mcp.appsDisconnect`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.connectHint`,{app:e.name})}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(L,{busy:_.isPending,onClick:()=>_.mutate(!0),children:[(0,H.jsx)(T,{className:`size-4`}),` `,R(`integrate.connect`,{app:e.name})]})})]}),f&&!f.ok?(0,H.jsx)(`p`,{className:`text-[13px] text-rose`,children:f.message}):null,f?.snippet?(0,H.jsx)(Y,{text:f.snippet}):null,t?.where?(0,H.jsx)(`p`,{className:`font-mono text-[11px] text-ink-4`,children:t.where}):null]}):(0,H.jsxs)(H.Fragment,{children:[r||y?null:(0,H.jsx)(Z,{title:R(`mcp.keyTitle`),children:h?(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-[14px] text-ink-2`,children:[(0,H.jsx)(C,{className:`size-4 text-moss`}),` `,R(`mcp.keyReady`)]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.keyHint`)}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(L,{variant:`secondary`,busy:v.isPending,onClick:()=>v.mutate(),children:[(0,H.jsx)(T,{className:`size-4`}),` `,R(`mcp.keyCreate`,{client:e.name})]})})]})}),(0,H.jsxs)(Z,{title:R(`mcp.add`),children:[r||h||y?(0,H.jsx)(Nt,{id:e.id,url:i,apiKey:h}):(0,H.jsx)(X,{children:R(`mcp.keyFirst`)}),r?(0,H.jsx)(X,{children:R(`mcp.oauth`)}):null,(0,H.jsx)(`p`,{className:`text-[12px] text-ink-4`,children:R(o?`mcp.addressPublic`:`mcp.addressLocal`)})]})]}),ee?null:(0,H.jsxs)(Z,{title:R(`integrate.test`),children:[(0,H.jsxs)(`ol`,{className:`flex flex-col`,children:[(0,H.jsx)(Ft,{state:n?`done`:te?`now`:`later`,title:R(`integrate.seen`,{app:e.name}),children:(0,H.jsx)(X,{children:R(c===`here`?`integrate.restart`:`integrate.reload`,{app:e.name})})}),(0,H.jsxs)(Ft,{state:n?.toolAt?`done`:n?`now`:`later`,title:R(`integrate.tool`),children:[(0,H.jsx)(X,{children:R(`integrate.askHint`,{app:e.name})}),x(R(`integrate.askTool`))]}),e.widgets?(0,H.jsxs)(Ft,{state:n?.widgetAt?`done`:n?.toolAt?`now`:`later`,title:R(`integrate.widget`),children:[(0,H.jsx)(X,{children:R(`integrate.widgetHint`)}),x(R(`integrate.askWidget`))]}):null]}),b?(0,H.jsxs)(`p`,{className:`flex items-center gap-2 font-medium text-[14px] text-moss`,children:[(0,H.jsx)(C,{className:`size-4`,strokeWidth:3}),R(`integrate.works`,{app:e.name})]}):null]})]})]})}function Bt(){let e=m(),t=e.data?.mode===`managed`,n=c({queryKey:[`local-apps`],queryFn:()=>u.get(`/api/studio/local/apps`),enabled:e.data?.mode===`local`}),r=c({queryKey:[`integrations-seen`],queryFn:()=>u.get(`/api/studio/integrations/seen`),refetchInterval:2500}),[i,a]=(0,V.useState)(null);if(!e.data||!t&&!n.data)return null;let o=e.data.mcpUrl??``,s=e=>n.data?.find(t=>t.id===e),l=e=>r.data?.[e],d=e=>{let t=s(e);return t?.installed||t?.connected?0:1},f=[...jt].sort((e,t)=>d(e.id)-d(t.id)),p=f.find(e=>e.id===i)??f[0],h=e=>{let t=s(e);return l(e)?.toolAt?{note:R(`integrate.stateWorks`),tone:`done`}:t?.connected?{note:R(`integrate.stateConnected`),tone:`ok`}:t?.installed?{note:R(`integrate.stateInstalled`),tone:`dim`}:{}};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-10`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-[22px] tracking-tight`,children:R(`integrate.title`)}),(0,H.jsx)(`p`,{className:`mt-1 max-w-2xl text-[14px] text-ink-2`,children:R(`integrate.lead`)})]}),(0,H.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-[16rem_minmax(0,1fr)]`,children:[(0,H.jsxs)(`nav`,{className:`flex flex-col gap-5 lg:sticky lg:top-24 lg:self-start`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-1.5 px-3 font-medium text-[11px] text-ink-4 uppercase tracking-[0.14em]`,children:R(`integrate.groupApps`)}),(0,H.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:f.map(e=>(0,H.jsx)(Lt,{selected:e.id===p.id,title:e.name,widgets:e.widgets,onPick:()=>a(e.id),...h(e.id)},e.id))})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-1.5 px-3 font-medium text-[11px] text-ink-4 uppercase tracking-[0.14em]`,children:R(`integrate.groupShare`)}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(Lt,{selected:!1,disabled:!0,title:R(`integrate.shareLink`),note:R(`integrate.soon`)}),(0,H.jsx)(Lt,{selected:!1,disabled:!0,title:R(`integrate.shareSite`),note:R(`integrate.soon`)})]})]})]}),(0,H.jsx)(zt,{client:p,local:s(p.id),seen:l(p.id),managed:t,url:o},p.id)]}),t?null:(0,H.jsx)(Pt,{}),(0,H.jsxs)(`p`,{className:`flex items-start gap-2 text-[13px] text-ink-3`,children:[(0,H.jsx)(re,{className:`mt-0.5 size-3.5 shrink-0`}),R(`mcp.notReverse`)]})]})}function Vt(e){return R(e.origin===`local`?`readonly.project`:`readonly.server`)}function Ht({children:e}){return(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-paper-2 px-4 py-3 text-[14px] text-ink-2 leading-relaxed`,children:[(0,H.jsx)(le,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,H.jsx)(`p`,{className:`min-w-0`,children:e})]})}function Ut(e){return e.type.startsWith(`image/`)&&/logo/i.test(e.name)?`logo`:/^(image|video|audio)\//.test(e.type)?`asset`:`document`}function Wt(e,t){let n=d(),[r,i]=(0,V.useState)([]),[a,o]=(0,V.useState)(`idle`),[c,l]=(0,V.useState)(null),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(null),g=(0,V.useRef)(null),_=()=>(g.current??=(async()=>{await Promise.all([n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`project-files`,e]})]),t(),g.current=null})(),g.current);return{messages:r,phase:a,activity:f,startedAt:m,error:c,send:async(t,c=[])=>{if(!(t.trim()||c.length)||a!==`idle`)return!1;if(l(null),o(`thinking`),h(Date.now()),c.length){try{for(let t of c)await u.upload(`/api/studio/projects/${e}/files?kind=${Ut(t)}`,t)}catch(e){return l(e.message),o(`idle`),h(null),await _(),!1}await _();let n=`${R(`editor.attached`)}: ${c.map(e=>e.name).join(`, `)}`;t=t.trim()?`${t}\n\n${n}`:n}let d=r.map(({role:e,content:t})=>({role:e,content:t})).slice(-12),f=`p-${Date.now()}`;i(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:t,previews:ue(c)},{id:f,role:`assistant`,content:``,pending:!0}]),p(null);let m=!1;try{await s(`/api/studio/projects/${e}/assist`,{message:t,history:d},(e,t)=>{if(e===`text`){let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(t));else if(e===`changed`)o(`building`),_();else if(e===`done`){m=!0;let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:e.reply,changed:e.changed,pending:!1}:t))}else e===`error`&&(m=!0,l(JSON.parse(t).message))}),m||l(R(`editor.chatBroken`))}catch(e){l(e.message)}finally{p(null),h(null),i(e=>e.filter(e=>!(e.id===f&&!e.content)).map(e=>({...e,pending:!1}))),o(`idle`),await g.current,await _(),await n.invalidateQueries({queryKey:[`me`]})}return!0}}}function Gt(){return(0,H.jsxs)(`div`,{className:`sm:pr-36`,children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-[20px] leading-tight tracking-tight`,children:R(`project.assistantTitle`)}),(0,H.jsx)(`p`,{className:`mt-1.5 max-w-2xl text-[15px] text-ink-2 leading-relaxed`,children:R(`project.assistantHello`)})]})}var Kt=72,qt=720;function Jt({projectId:e,onChanged:t}){let n=Wt(e,t),r=(0,V.useRef)(null),[i,a]=(0,V.useState)(null);return(0,V.useEffect)(()=>{let e=()=>{let e=r.current?.getBoundingClientRect();e&&a(t=>{if(e.bottom>=Kt)return null;let n=Math.min(e.width,qt),r=e.left+(e.width-n)/2;return t&&t.left===r&&t.width===n?t:{left:r,width:n,height:t?.height??e.height}})};return e(),window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[]),(0,H.jsxs)(`div`,{ref:r,style:i?{minHeight:i.height}:void 0,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-1 font-medium text-[12px] text-ember-strong uppercase tracking-[0.07em]`,children:[(0,H.jsx)(oe,{className:`size-3.5`}),` `,R(`project.assistant`)]}),(0,H.jsxs)(`div`,{className:`relative`,children:[!i&&n.messages.length===0?(0,H.jsx)(`div`,{className:`absolute -top-14 right-10 z-10 max-sm:hidden`,children:(0,H.jsx)(o,{kind:`round`,size:104})}):null,(0,H.jsx)(`div`,{className:A(`flex flex-col overflow-hidden bg-card`,i?`fixed bottom-4 z-30 max-h-[70dvh] animate-dock rounded-2xl shadow-overlay ring-1 ring-border`:`max-h-[520px] rounded-xl bg-linear-to-br from-ember-tint via-card to-card shadow-soft ring-1 ring-ember-veil`),style:i?{left:i.left,width:i.width}:void 0,children:(0,H.jsx)(de,{chat:n,avatar:`round`,compact:!!i,intro:(0,H.jsx)(Gt,{}),placeholder:R(`project.assistantComposer`),changedLabel:R(`project.assistantChanged`)})})]})]})}var Yt=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],Xt=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,Zt=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,Qt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,$t=/^(https?:\/\/|www\.)\S+$/i,en=/^\+?[\d\s()/.-]{7,20}$/,tn=/^(ja|nein|yes|no|true|false)$/i;function nn(e){let t=e.trim();return t?t.includes(`
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,S as i,c as a,d as o,i as s,j as c,k as l,n as u,nt as d,w as f}from"./api-BTfKh3La.js";import{d as p,l as m,o as h,s as g,t as _}from"./session-D_Zggq_t.js";import{t as v}from"./createLucideIcon-q3MZMmnf.js";import{n as y,t as ee}from"./plug-CLjyCoHB.js";import{t as te}from"./arrow-right-6FyN3e7D.js";import{D as b,E as ne,S as x,T as re,r as ie,w as ae,x as oe,y as S}from"./outputs-n_yhxmMk.js";import{t as C}from"./check-CUpby_J9.js";import{n as w,r as se,t as ce}from"./wand-sparkles-CKxArWPY.js";import{a as le,r as ue,t as de}from"./ChatPanel-Dk_45uca.js";import{a as fe,i as pe,n as me,r as he,t as ge}from"./type-BMJpS6_D.js";import{n as _e,t as T}from"./plus-Du-Jx8aI.js";import{t as E}from"./external-link-MAL7vJYj.js";import{n as ve}from"./mic-Bvz4mA2j.js";import{p as ye}from"./definition-DndaH5Ow.js";import{t as be}from"./upload--J5bZhEM.js";import{_ as D,a as xe,c as O,d as k,f as Se,h as A,i as j,m as M,n as N,o as P,p as Ce,r as F,s as I,t as L,u as we,y as R}from"./ui-C3bTWmdM.js";import{a as Te,c as Ee,i as De,o as Oe,r as ke,s as Ae,u as je}from"./index-DOpyzQiU.js";import{o as z,r as B,t as Me}from"./LocalRuntime-BjzPSsHr.js";import{ProjectSwitcher as Ne}from"./HomePage-Bi9FK3_1.js";var Pe={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Pe.node;var Fe=v(Pe),Ie={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};Ie.node;var Le=v(Ie),Re={name:`file-spreadsheet`,size:24,node:[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]};Re.node;var ze=v(Re),Be={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};Be.node;var Ve=v(Be),He={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};He.node;var Ue=v(He),We={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`}]]};We.node;var Ge=v(We),Ke={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};Ke.node;var qe=v(Ke),Je={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};Je.node;var Ye=v(Je),Xe={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};Xe.node;var Ze=v(Xe),Qe={name:`music`,size:24,node:[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]};Qe.node;var $e=v(Qe),et={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`}]]};et.node;var tt=v(et),nt={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`}]]};nt.node;var rt=v(nt),it={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};it.node;var at=v(it),ot={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};ot.node;var st=v(ot),ct={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`}]]};ct.node;var lt=v(ct),V=e(t(),1),H=e(n(),1);function U({title:e,hint:t,save:n,action:r,locked:i,children:a}){return(0,H.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-1`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),n?.state===`saving`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,H.jsx)(k,{className:`size-3`}),` `,R(`project.saving`)]}):n?.state===`saved`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-moss`,children:[(0,H.jsx)(C,{className:`size-3.5`}),` `,R(`settings.saved`)]}):null]}),t?(0,H.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-snug`,children:t}):null]}),r?(0,H.jsx)(`div`,{className:`shrink-0`,children:r}):null]}),(0,H.jsxs)(N,{className:`p-5`,children:[i?(0,H.jsx)(`fieldset`,{disabled:!0,className:`min-w-0`,children:a}):a,n?.state===`error`&&n.error?(0,H.jsx)(`p`,{className:`mt-4 text-[14px] text-rose`,children:n.error}):null]})]})}function ut({children:e,layout:t,onToggle:n}){return(0,H.jsxs)(`div`,{className:`mb-3 flex items-start gap-2`,children:[(0,H.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,H.jsx)(`div`,{className:`w-56 max-w-full transition-[width] duration-200 focus-within:w-full has-[input:not(:placeholder-shown)]:w-full`,children:e})}),(0,H.jsx)(P,{label:R(t===`list`?`project.viewCards`:`project.viewList`),onClick:n,children:t===`list`?(0,H.jsx)(qe,{className:`size-4`}):(0,H.jsx)(Ye,{className:`size-4`})})]})}function dt({value:e,onChange:t,onEnter:n,placeholder:r,busy:i}){return(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(he,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-4`}),(0,H.jsx)(`input`,{type:`search`,value:e,placeholder:r,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n?.(),className:`h-9 w-full rounded-lg border border-input bg-card pr-3 pl-9 text-[14px] text-ink outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow`}),i?(0,H.jsx)(k,{className:`-translate-y-1/2 absolute top-1/2 right-3 size-4 text-ink-3`}):null]})}function W({onFiles:e,accept:t,multiple:n=!0,className:r,children:i}){return(0,H.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),e.currentTarget.dataset.over=`1`},onDragLeave:e=>{delete e.currentTarget.dataset.over},onDrop:t=>{t.preventDefault(),delete t.currentTarget.dataset.over;let r=Array.from(t.dataTransfer.files);r.length&&e(n?r:r.slice(0,1))},className:A(`flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-input border-dashed text-[14px] text-ink-3 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow hover:border-ink-4 hover:text-ink data-[over]:border-focus data-[over]:bg-paper-2 data-[over]:text-ink`,r),children:[i,(0,H.jsx)(`input`,{className:`sr-only`,type:`file`,accept:t,multiple:n,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length&&e(n)}})]})}function ft(){let e=Ee(),[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(null),a=async e=>{n(e??`*`),i(null);try{await Ae(e)}catch(e){i(e.message)}finally{n(null)}};return(0,H.jsxs)(U,{title:R(`plugins.title`),hint:e.canReload?R(`plugins.hint`):R(`plugins.hintManaged`),action:e.canReload?(0,H.jsx)(L,{variant:`secondary`,busy:t===`*`,onClick:()=>void a(),children:R(`plugins.rescan`)}):null,children:[(0,H.jsxs)(`ul`,{className:`divide-y divide-border-soft`,children:[e.plugins.map(n=>{let r=e.failed[n.id];return(0,H.jsxs)(`li`,{className:`flex items-start gap-4 py-4 first:pt-0 last:pb-0`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,H.jsx)(`span`,{className:`font-medium text-[15px]`,children:n.name}),n.name===n.id?null:(0,H.jsxs)(`span`,{className:`font-mono text-[12px] text-ink-4`,children:[n.id,` · `,n.version]})]}),n.description?(0,H.jsx)(`p`,{className:`mt-0.5 text-[14px] text-ink-3`,children:n.description}):null,n.tools.length?(0,H.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5 text-[12px] text-ink-3`,children:[R(`plugins.tools`),n.tools.map(e=>(0,H.jsx)(F,{children:e.id},e.id))]}):null,n.error?(0,H.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:R(`plugins.serverFailed`,{error:n.error})}):null,r?(0,H.jsx)(`p`,{className:`mt-2 text-[13px] text-rose`,children:R(`plugins.studioFailed`,{error:r})}):null]}),e.canReload?(0,H.jsx)(P,{label:R(`plugins.reload`),disabled:t!==null,onClick:()=>void a(n.id),children:(0,H.jsx)(rt,{className:t===n.id?`size-4 animate-spin`:`size-4`})}):null]},n.id)}),e.problems.map(e=>(0,H.jsxs)(`li`,{className:`py-4 first:pt-0 last:pb-0`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1`,children:[(0,H.jsx)(F,{tone:`warn`,children:R(`plugins.problems`)}),(0,H.jsx)(`span`,{className:`break-all font-mono text-[12px] text-ink-3`,children:e.path})]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:e.message})]},e.path))]}),r?(0,H.jsx)(`p`,{className:`mt-4 text-[13px] text-rose`,children:r}):null]})}var pt=e=>[`project-files`,e];function mt(e){return c({queryKey:pt(e),queryFn:()=>u.get(`/api/studio/projects/${e}/files`),refetchInterval:e=>e.state.data?.files.some(e=>e.status===`pending`)?2e3:!1})}function G(e,t){return a(`/api/studio/projects/${e}/files/${t}/content`)}function K(e,t=!1){let n=d(),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(null),s=()=>n.invalidateQueries({queryKey:pt(e)}),c=async e=>{o(null);try{await e()}catch(e){o(e.message)}finally{await s()}};return{busy:r,error:a,readOnly:t,upload:async(t,n)=>{i(!0),await c(async()=>{for(let r of n)await u.upload(`/api/studio/projects/${e}/files?kind=${t}`,r),await s()}),i(!1)},describe:(t,n)=>c(()=>u.patch(`/api/studio/projects/${e}/files/${t}`,{description:n})),remove:t=>c(()=>u.del(`/api/studio/projects/${e}/files/${t}`)),reindex:t=>c(()=>u.post(`/api/studio/projects/${e}/files/${t}/reindex`)),order:(t,n)=>c(()=>u.put(`/api/studio/projects/${e}/files/order`,{kind:t,ids:n}))}}function ht(e,t){let n=`wz.layout.${e}`,[r,i]=(0,V.useState)(()=>{try{let e=localStorage.getItem(n);return e===`list`||e===`cards`?e:t}catch{return t}});return[r,()=>i(e=>{let t=e===`list`?`cards`:`list`;try{localStorage.setItem(n,t)}catch{}return t})]}function q(e,t,n=700){let[r,i]=(0,V.useState)(`idle`),[a,o]=(0,V.useState)(null),s=JSON.stringify(e),c=(0,V.useRef)(s),l=(0,V.useRef)({value:e,json:s,save:t});l.current={value:e,json:s,save:t};let u=(0,V.useRef)(Promise.resolve()),d=(0,V.useCallback)(()=>{let e=l.current;e.json!==c.current&&(c.current=e.json,i(`saving`),u.current=u.current.then(async()=>{try{await e.save(e.value),o(null),i(`saved`)}catch(e){c.current=``,o(e.message),i(`error`)}}))},[]);return(0,V.useEffect)(()=>{if(s===c.current)return;let e=setTimeout(d,n);return()=>clearTimeout(e)},[s,n,d]),(0,V.useEffect)(()=>d,[d]),{state:r,error:a}}function gt(e){return e<1e6?`${Math.max(1,Math.round(e/1e3))} KB`:`${(e/1e6).toFixed(1)} MB`}var _t=`mt-1.5 text-[13px] text-ink-3`;function vt(e){let t=d(),[n,r]=(0,V.useState)(!1),i=p({mutationFn:e=>u.post(`/api/studio/account/link`,e),onSuccess:({url:e})=>{B(e),r(!0)}});return(0,V.useEffect)(()=>{if(!n)return;let e=setInterval(()=>void t.invalidateQueries({queryKey:[`me`]}),2e3),i=setTimeout(()=>r(!1),3e5);return()=>{clearInterval(e),clearTimeout(i)}},[n,t]),(0,V.useEffect)(()=>{e&&r(!1)},[e]),{link:i,waiting:n}}function yt({link:e,waiting:t}){return e.isError?(0,H.jsx)(`p`,{className:`text-[13px] text-rose`,children:R(`local.accountFailed`)}):t?(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-[13px] text-ink-3`,children:[(0,H.jsx)(k,{className:`size-3.5`}),` `,R(`local.accountWaiting`)]}):null}function bt(){let e=vt(!1),{link:t}=e,[n,r]=(0,V.useState)(``);return(0,H.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-4 py-5 first:pt-0 last:pb-0`,children:[(0,H.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2`,children:(0,H.jsx)(Ve,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsx)(`div`,{className:`font-medium text-[15px]`,children:R(`account.local`)}),(0,H.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-relaxed`,children:R(`account.localText`)})]})]}),z.account?(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 py-5 last:pb-0`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`font-medium text-[15px]`,children:R(`account.with`)}),(0,H.jsxs)(`ul`,{className:`mt-2 flex flex-col gap-2 text-[14px] text-ink-2 leading-snug`,children:[(0,H.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,H.jsx)(fe,{className:`mt-0.5 size-4 shrink-0 text-amber`}),R(`account.withCredits`)]}),(0,H.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,H.jsx)(Le,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),R(`account.withCloud`)]})]})]}),(0,H.jsx)(`div`,{children:(0,H.jsx)(L,{busy:t.isPending&&!t.variables?.signup,onClick:()=>t.mutate({}),children:R(`account.signIn`)})})]}):null,z.account?(0,H.jsxs)(`form`,{className:`flex flex-col gap-3 py-5 last:pb-0`,onSubmit:e=>{e.preventDefault(),t.mutate({signup:!0,code:n.trim()||void 0})},children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`font-medium text-[15px]`,children:R(`account.new`)}),(0,H.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-relaxed`,children:R(`account.newHint`)})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,H.jsx)(I,{value:n,maxLength:64,autoComplete:`off`,spellCheck:!1,placeholder:R(`account.code`),"aria-label":R(`account.code`),onChange:e=>r(e.target.value),className:`w-56 font-mono text-[14px]`}),(0,H.jsx)(L,{type:`submit`,variant:`secondary`,className:`h-11`,busy:t.isPending&&!!t.variables?.signup,children:R(`account.create`)})]}),(0,H.jsx)(yt,{...e})]}):null]})}var xt={start:`account.kind.start`,monthly:`account.kind.monthly`,gift:`account.kind.gift`};function St(e){try{return new URL(e).host}catch{return e}}function Ct({account:e}){let t=d(),n=vt(e.signedIn),r=p({mutationFn:()=>u.del(`/api/studio/account`),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})}),i=new Intl.DateTimeFormat(D,{dateStyle:`medium`});return(0,H.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 py-5 first:pt-0`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-[15px]`,children:e.name||e.email}),e.signedIn?(0,H.jsx)(F,{tone:`live`,children:R(`account.linked`)}):null]}),(0,H.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:e.email})]}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsxs)(L,{variant:`secondary`,onClick:()=>B(e.url),children:[R(`setup.openAccount`),` `,(0,H.jsx)(E,{className:`size-4`})]}),(0,H.jsxs)(L,{variant:`ghost`,busy:r.isPending,onClick:()=>r.mutate(),children:[(0,H.jsx)(je,{className:`size-4`}),` `,R(`nav.logout`)]})]})]}),e.signedIn?null:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 py-5`,children:[(0,H.jsx)(`p`,{className:`text-[14px] text-ink-2`,children:R(`local.accountExpired`)}),(0,H.jsx)(`div`,{children:(0,H.jsx)(L,{busy:n.link.isPending,onClick:()=>n.link.mutate({}),children:R(`account.signInAgain`)})}),(0,H.jsx)(yt,{...n})]}),e.credits===null?null:(0,H.jsxs)(`div`,{className:`py-5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`text-[13px] text-ink-3`,children:R(`account.credits`)}),(0,H.jsx)(`div`,{className:`font-display font-semibold text-[22px] tabular-nums leading-tight`,children:R(`nav.credits`,{n:Math.floor(e.credits).toLocaleString()})})]}),(0,H.jsxs)(L,{variant:`secondary`,onClick:()=>B(`${e.url}/billing`),children:[R(`account.topUp`),` `,(0,H.jsx)(E,{className:`size-4`})]})]}),e.expiring.length?(0,H.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1 text-[13px] text-ink-3 tabular-nums`,children:e.expiring.map(e=>(0,H.jsxs)(`li`,{children:[R(`account.expires`,{n:Math.floor(e.credits).toLocaleString(),date:i.format(new Date(e.expiresAt))}),xt[e.kind]?(0,H.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,R(xt[e.kind])]}):null]},`${e.kind}:${e.expiresAt}`))}):null]}),(0,H.jsxs)(`div`,{className:`flex items-start gap-2.5 py-5 text-[14px] text-ink-2 leading-snug last:pb-0`,children:[(0,H.jsx)(Le,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),(0,H.jsx)(`p`,{children:R(`account.cloud`,{host:St(e.cloudUrl)})})]})]})}function wt({me:e}){let t=d(),n=e.mode===`managed`,[r,i]=(0,V.useState)(e.profile),a=e=>i(t=>({...t,...e})),o=q(r,async e=>{await u.put(`/api/studio/profile`,e),await t.invalidateQueries({queryKey:[`me`]})});return(0,H.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,H.jsx)(U,{title:R(`account.title`),hint:R(`account.hint`),save:o,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[(0,H.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 sm:w-32`,children:[(0,H.jsx)(`div`,{className:`flex size-20 items-center justify-center overflow-hidden rounded-full bg-ember-tint font-semibold text-[28px] text-ember-strong ring-1 ring-border-soft`,children:e.user.image?(0,H.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full object-cover`}):_(r.name)||`?`}),(0,H.jsx)(`p`,{className:`text-center text-[12px] text-ink-3 leading-snug`,children:R(`account.initials`)})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`account.name`)}),(0,H.jsx)(I,{value:r.name,maxLength:80,disabled:n,onChange:e=>a({name:e.target.value})}),(0,H.jsx)(`p`,{className:_t,children:R(n?`account.fromAccount`:`account.nameHint`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`account.about`)}),(0,H.jsx)(M,{minRows:3,maxLength:2e3,value:r.about,onChange:e=>a({about:e.target.value})}),(0,H.jsx)(`p`,{className:_t,children:R(`account.aboutHint`)})]}),(0,H.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`account.email`)}),(0,H.jsx)(I,{type:`email`,value:r.email,maxLength:200,disabled:n,onChange:e=>a({email:e.target.value})})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`account.phone`)}),(0,H.jsx)(I,{type:`tel`,value:r.phone,maxLength:40,onChange:e=>a({phone:e.target.value})})]})]})]})]})}),(0,H.jsx)(U,{title:R(`account.connection`),hint:R(`account.connectionHint`),children:n?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-[15px]`,children:e.user.name}),(0,H.jsx)(F,{tone:`live`,children:R(`account.linked`)})]}),(0,H.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:e.user.email})]}),e.manageUrl?(0,H.jsxs)(L,{variant:`secondary`,onClick:()=>B(`${e.manageUrl}/account`),children:[R(`setup.openAccount`),` `,(0,H.jsx)(E,{className:`size-4`})]}):null]}):e.account?(0,H.jsx)(Ct,{account:e.account}):(0,H.jsx)(bt,{})}),(0,H.jsx)(U,{title:R(`account.look`),hint:R(`account.lookHint`),children:(0,H.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pb-4`,children:[(0,H.jsx)(`span`,{className:`font-medium text-[14px]`,children:R(`nav.language`)}),(0,H.jsx)(Te,{tone:`surface`})]}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-4`,children:[(0,H.jsx)(`span`,{className:`font-medium text-[14px]`,children:R(`nav.theme`)}),(0,H.jsx)(ke,{})]})]})})]})}function Tt({connector:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,H.jsxs)(`button`,{type:`button`,onClick:()=>n(e=>!e),className:`flex w-full items-center gap-3 px-3 py-2 text-left`,children:[(0,H.jsx)(`span`,{className:A(`size-2 shrink-0 rounded-full`,e.usable?`bg-moss`:`bg-ink-4`)}),(0,H.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:[e.name,` `,(0,H.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:e.id})]}),(0,H.jsx)(`span`,{className:`shrink-0 text-[12px] text-ink-3`,children:e.usable?R(`connectors.actions`,{n:e.actions.length,r:e.actions.filter(e=>e.group===`read`).length}):R(`connectors.notSetUp`)})]}),t?(0,H.jsxs)(`div`,{className:`border-border-soft border-t px-3 py-2 text-[12px]`,children:[e.missingSetup?(0,H.jsxs)(`p`,{className:`mb-1 text-ink-3`,children:[R(`connectors.setup`),` `,(0,H.jsx)(`span`,{className:`font-mono text-ink-2`,children:e.missingSetup})]}):null,(0,H.jsx)(`p`,{className:`text-ink-4`,children:e.actions.map(e=>e.group===`read`?e.id:`${e.id} (${R(`connectors.group.${e.group}`)})`).join(` · `)})]}):null]})}var Et={none:`connectors.authNone`,oauth2:`connectors.authOauth`,api_key:`connectors.authKey`};function Dt({projectId:e,connector:t,readOnly:n}){let r=d(),[i,a]=(0,V.useState)(!1),o=()=>r.invalidateQueries({queryKey:[`connectors`,e]}),s=`/api/studio/projects/${e}/connectors/${t.id}`,c=p({mutationFn:()=>u.post(`${s}/refresh`),onSuccess:o}),l=p({mutationFn:()=>u.del(s),onSuccess:o}),f=t.actions.filter(e=>e.group===`read`).length;return(0,H.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 p-3`,children:[(0,H.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-paper-2 text-ink-2`,children:(0,H.jsx)(ee,{className:`size-4`})}),(0,H.jsxs)(`button`,{type:`button`,onClick:()=>a(e=>!e),className:`min-w-0 flex-1 text-left`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-[14px]`,children:t.name}),(0,H.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:t.id})]}),(0,H.jsxs)(`div`,{className:`truncate text-[12px] text-ink-3`,children:[t.domain,` · `,t.sourceKind===`mcp`?`MCP`:`OpenAPI`,` ·`,` `,R(Et[t.auth]),` ·`,` `,t.toolsPending?R(`connectors.pending`):R(`connectors.actions`,{n:t.actions.length,r:f})]})]}),n?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(P,{label:R(`connectors.refresh`),onClick:()=>c.mutate(),children:c.isPending?(0,H.jsx)(k,{className:`size-4`}):(0,H.jsx)(ye,{className:`size-4`})}),(0,H.jsx)(P,{label:R(`connectors.remove`),className:`hover:text-rose`,onClick:()=>confirm(`${t.name}: ${R(`connectors.remove`)}?`)&&l.mutate(),children:(0,H.jsx)(S,{className:`size-4`})})]})]}),t.needsOAuthClient?(0,H.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:R(`connectors.needsClient`)}):null,c.error??l.error?(0,H.jsx)(`p`,{className:`border-border-soft border-t px-3 py-2 text-[12px] text-rose`,children:(c.error??l.error).message}):null,i&&t.actions.length?(0,H.jsx)(`ul`,{className:`max-h-64 overflow-y-auto border-border-soft border-t px-3 py-2`,children:t.actions.map(e=>(0,H.jsxs)(`li`,{className:`flex items-baseline gap-2 py-1 text-[12px]`,children:[(0,H.jsx)(`span`,{className:A(`w-14 shrink-0 text-[11px] uppercase tracking-wide`,e.group===`read`?`text-moss`:e.group===`write`?`text-ink-3`:`text-rose`),children:R(`connectors.group.${e.group}`)}),(0,H.jsx)(`span`,{className:`shrink-0 font-mono text-ink-2`,children:e.id}),(0,H.jsx)(`span`,{className:`min-w-0 truncate text-ink-4`,children:e.summary})]},e.id))}):null]})}function Ot({projectId:e,domain:t,source:n,taken:r,onDone:i}){let a=d(),[o,s]=(0,V.useState)({id:``,secret:``}),[c,l]=(0,V.useState)(!1),f=r.includes(n.suggestedId),m=p({mutationFn:()=>u.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}:{},...o.id&&o.secret?{oauthClientId:o.id,oauthClientSecret:o.secret}:{}}),onSuccess:async t=>{await a.invalidateQueries({queryKey:[`connectors`,e]}),i(t.warnings)}});return(0,H.jsxs)(`div`,{className:`rounded-lg bg-card p-3 ring-1 ring-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(F,{tone:n.sourceKind===`mcp`?`ember`:`neutral`,children:n.sourceKind===`mcp`?`MCP`:`OpenAPI`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-[13px]`,children:n.name??n.suggestedId}),(0,H.jsx)(`div`,{className:`truncate font-mono text-[11px] text-ink-4`,children:n.sourceUrl})]}),n.blocked||f?null:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>l(e=>!e),className:`text-[12px] text-ink-3 hover:text-ink`,children:R(`connectors.ownClient`)}),(0,H.jsx)(L,{size:`sm`,busy:m.isPending,onClick:()=>m.mutate(),children:R(`connectors.import`)})]})]}),n.blocked?(0,H.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:n.blocked}):null,f?(0,H.jsx)(`p`,{className:`mt-2 text-[12px] text-ink-3`,children:R(`connectors.exists`)}):null,c?(0,H.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,H.jsx)(I,{placeholder:`OAuth Client-ID`,value:o.id,onChange:e=>s(t=>({...t,id:e.target.value}))}),(0,H.jsx)(I,{type:`password`,autoComplete:`off`,placeholder:`OAuth Client-Secret`,value:o.secret,onChange:e=>s(t=>({...t,secret:e.target.value}))})]}):null,m.error?(0,H.jsx)(`p`,{className:`mt-2 text-[12px] text-rose`,children:m.error.message}):null]})}function kt({projectId:e,readOnly:t}){let[n,r]=(0,V.useState)(``),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(null),[l,d]=(0,V.useState)([]),f=c({queryKey:[`connectors`,e],queryFn:()=>u.get(`/api/studio/projects/${e}/connectors`)}),m=p({mutationFn:()=>u.post(`/api/studio/connectors/search`,{query:n}),onSuccess:e=>{a(e),s(null),d([])}}),h=p({mutationFn:e=>u.get(`/api/studio/connectors/registry/${encodeURIComponent(e)}`),onSuccess:s}),g=f.data??[],_=g.filter(e=>e.sourceKind===`builtin`&&(z.unsetConnectors||e.usable)),v=g.filter(e=>e.sourceKind!==`builtin`);return(0,H.jsxs)(N,{className:`p-6`,children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:R(`connectors.title`)}),(0,H.jsx)(`p`,{className:`mt-1 mb-5 text-[14px] text-ink-3`,children:R(`connectors.hint`)}),_.length?(0,H.jsx)(`div`,{className:`mb-5 grid gap-1.5 sm:grid-cols-2`,children:_.map(e=>(0,H.jsx)(Tt,{connector:e},e.id))}):null,(0,H.jsx)(`h3`,{className:`mb-2 font-medium text-[12px] text-ink-3 uppercase tracking-[0.07em]`,children:R(`connectors.imported`)}),v.length?(0,H.jsx)(`div`,{className:`mb-4 flex flex-col gap-2`,children:v.map(n=>(0,H.jsx)(Dt,{projectId:e,connector:n,readOnly:t},n.id))}):null,t?v.length?null:(0,H.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:R(`connectors.noneImported`)}):(0,H.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),n.trim()&&m.mutate()},children:[(0,H.jsx)(I,{value:n,placeholder:R(`connectors.search`),onChange:e=>r(e.target.value)}),(0,H.jsxs)(L,{type:`submit`,variant:`secondary`,busy:m.isPending,children:[(0,H.jsx)(he,{className:`size-4`}),` `,R(`connectors.find`)]})]}),m.error?(0,H.jsx)(`p`,{className:`mt-3 text-[13px] text-rose`,children:m.error.message}):null,i&&!o?(0,H.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1`,children:[i.length?null:(0,H.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:R(`connectors.none`)}),i.map(e=>(0,H.jsxs)(`button`,{type:`button`,disabled:!e.kinds.length,onClick:()=>h.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,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-[14px]`,children:e.domain}),(0,H.jsx)(`div`,{className:`truncate text-[12px] text-ink-3`,children:e.description})]}),(0,H.jsx)(`span`,{className:`text-[11px] text-ink-4 uppercase`,children:e.kinds.join(` · `)}),(0,H.jsx)(se,{className:`-rotate-90 size-4 text-ink-4`})]},e.domain)),h.isPending?(0,H.jsx)(k,{className:`mx-auto mt-2 size-4 text-ink-4`}):null,h.error?(0,H.jsx)(`p`,{className:`text-[13px] text-rose`,children:h.error.message}):null]}):null,o?(0,H.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,H.jsx)(`div`,{className:`font-medium text-[14px]`,children:o.domain}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>s(null),className:`text-[12px] text-ink-3 hover:text-ink`,children:R(`run.back`)})]}),o.summary?(0,H.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:o.summary}):null,o.sources.map(t=>(0,H.jsx)(Ot,{projectId:e,domain:o.domain,source:t,taken:g.map(e=>e.id),onDone:d},`${t.sourceKind}:${t.sourceUrl}`)),o.credentials.filter(e=>e.setup||e.url).map(e=>(0,H.jsxs)(`p`,{className:`text-[12px] text-ink-3`,children:[(0,H.jsxs)(`span`,{className:`text-ink-2`,children:[e.label,`:`]}),` `,e.setup,` `,e.url?(0,H.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noreferrer`,className:`text-ember underline`,children:e.url}):null]},e.label)),l.map(e=>(0,H.jsx)(`p`,{className:`text-[12px] text-ink-3`,children:e},e))]}):null]})}var J=`engenty-wizards`,At=`ENGENTY_WIZARDS_KEY`,jt=[{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 Y({text:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg bg-paper-2 p-3`,children:[(0,H.jsx)(`code`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-all font-mono text-[12px] leading-relaxed`,children:e}),(0,H.jsx)(P,{label:R(t?`settings.copied`:`settings.copy`),onClick:async()=>{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},children:t?(0,H.jsx)(C,{className:`size-4`}):(0,H.jsx)(_e,{className:`size-4`})})]})}function Mt(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 X({children:e}){return(0,H.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:e})}function Z({title:e,children:t}){return(0,H.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,H.jsx)(`h3`,{className:`font-medium text-[15px]`,children:e}),t]})}function Q(e,t){return JSON.stringify({[e]:{[J]:t}},null,2)}function Nt({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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.terminal`)}),(0,H.jsx)(Y,{text:`claude mcp add --transport http --scope user ${J} ${t}${r?` --header "${r}"`:``}`}),!n&&Mt(t)?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.ccPlugin`)}),(0,H.jsx)(Y,{text:`claude plugin marketplace add ${e}/marketplace.json`}),(0,H.jsx)(Y,{text:`claude plugin install ${J}@engenty`})]}):null]})}case`codex`:return n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.codexKey`)}),(0,H.jsx)(Y,{text:`echo 'export ${At}=${n}' >> ~/.zshrc && source ~/.zshrc`}),(0,H.jsx)(Y,{text:`codex mcp add ${J} --url ${t} --bearer-token-env-var ${At}`})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.terminal`)}),(0,H.jsx)(Y,{text:`codex mcp add ${J} --url ${t}`}),(0,H.jsx)(Y,{text:`codex mcp login ${J}`})]});case`gemini`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.terminal`)}),(0,H.jsx)(Y,{text:`gemini mcp add --scope user --transport http ${J} ${t}${r?` -H "${r}"`:``}`})]});case`cursor`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.file`,{file:`~/.cursor/mcp.json`})}),(0,H.jsx)(Y,{text:Q(`mcpServers`,{url:t,...i})})]});case`vscode`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.vscode`)}),(0,H.jsx)(Y,{text:Q(`servers`,{type:`http`,url:t,...i})})]});case`windsurf`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.file`,{file:`~/.codeium/windsurf/mcp_config.json`})}),(0,H.jsx)(Y,{text:Q(`mcpServers`,{serverUrl:t,...i})})]});case`lm-studio`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.file`,{file:`~/.lmstudio/mcp.json`})}),(0,H.jsx)(Y,{text:Q(`mcpServers`,{url:t,...i})})]});case`claude-desktop`:case`claude-ai`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.claudeAi`)}),(0,H.jsx)(Y,{text:t})]});case`chatgpt`:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.chatgpt`)}),(0,H.jsx)(Y,{text:t})]});default:return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.generic`)}),(0,H.jsx)(Y,{text:t}),r?(0,H.jsx)(Y,{text:r}):null]})}}function Pt(){let e=d(),t=c({queryKey:[`api-keys`],queryFn:()=>u.get(`/api/studio/api-keys`)}),n=p({mutationFn:e=>u.del(`/api/studio/api-keys/${e}`),onSuccess:()=>e.invalidateQueries({queryKey:[`api-keys`]})});return t.data?.length?(0,H.jsxs)(`section`,{children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:R(`mcp.keys`)}),(0,H.jsx)(`p`,{className:`mt-1 mb-4 text-[14px] text-ink-3`,children:R(`mcp.keysHint`)}),(0,H.jsx)(N,{className:`flex flex-col gap-2 p-3`,children:t.data.map(e=>(0,H.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg px-3 py-2`,children:[(0,H.jsx)(Ge,{className:`size-4 shrink-0 text-ink-4`}),(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsx)(`div`,{className:`truncate text-[14px]`,children:e.name}),(0,H.jsxs)(`div`,{className:`font-mono text-[11px] text-ink-4`,children:[e.start,`… ·`,` `,e.lastRequest?R(`settings.lastUsed`,{when:new Date(e.lastRequest).toLocaleString()}):R(`settings.neverUsed`)]})]}),(0,H.jsx)(P,{label:R(`settings.revoke`),onClick:()=>n.mutate(e.id),className:`hover:text-rose`,children:(0,H.jsx)(S,{className:`size-4`})})]},e.id))})]}):null}function Ft({state:e,title:t,children:n}){return(0,H.jsxs)(`li`,{className:`grid grid-cols-[22px_minmax(0,1fr)] gap-x-3`,children:[(0,H.jsx)(`span`,{className:A(`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,H.jsx)(C,{className:`size-3.5`,strokeWidth:3}):e===`now`?(0,H.jsx)(k,{className:`size-3`}):null}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-2 pb-4`,children:[(0,H.jsx)(`span`,{className:A(`text-[14px]`,e===`later`?`text-ink-3`:`font-medium`),children:t}),e===`now`?n:null]})]})}function It({widgets:e}){return(0,H.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,H.jsxs)(`div`,{className:`rounded-xl bg-paper p-4 ring-1 ring-border-soft`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 font-medium text-[14px]`,children:[(0,H.jsx)(lt,{className:`size-4 text-ember-strong`}),` MCP`]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:R(`integrate.kindMcp`)})]}),(0,H.jsxs)(`div`,{className:A(`rounded-xl p-4 ring-1`,e?`bg-paper ring-border-soft`:`bg-paper-2/60 ring-border-soft/60`),children:[(0,H.jsxs)(`div`,{className:A(`flex items-center gap-2 font-medium text-[14px]`,e?null:`text-ink-3`),children:[(0,H.jsx)(y,{className:A(`size-4`,e?`text-ember-strong`:`text-ink-4`)}),` MCP App`]}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:R(e?`integrate.kindApp`:`integrate.kindAppNo`)})]})]})}function Lt({selected:e,title:t,note:n,tone:r,widgets:i,disabled:a,onPick:o}){return(0,H.jsxs)(`button`,{type:`button`,disabled:a,onClick:o,"aria-pressed":e,className:A(`group flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left transition`,e?`bg-card shadow-soft ring-1 ring-border-soft`:`hover:bg-accent`,a&&`cursor-default opacity-55 hover:bg-transparent`),children:[(0,H.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate font-medium text-[14px]`,children:t}),i?(0,H.jsx)(`span`,{title:`MCP App`,className:`rounded bg-ember-tint px-1 font-semibold text-[10px] text-ember-strong leading-4`,children:`APP`}):null]}),n?(0,H.jsxs)(`span`,{className:A(`flex items-center gap-1 text-[12px]`,r===`done`?`text-moss`:r===`ok`?`text-ink-2`:`text-ink-4`),children:[r===`done`?(0,H.jsx)(C,{className:`size-3`,strokeWidth:3}):null,n]}):null]}),a?null:(0,H.jsx)(te,{className:A(`size-3.5 shrink-0 transition`,e?`text-ink-3`:`text-ink-4 opacity-0 group-hover:opacity-100`)})]})}function Rt({at:e,done:t}){let n=[R(`setup.stage.connect`),R(`setup.stage.test`),R(`setup.stage.done`)];return(0,H.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 font-medium text-[11px] uppercase tracking-[0.14em]`,children:n.map((n,r)=>{let i=t||r<e;return(0,H.jsxs)(`li`,{"aria-current":!i&&r===e?`step`:void 0,className:A(`flex items-center gap-1`,i?`text-moss`:r===e?`text-ember-strong`:`text-ink-4`),children:[i?(0,H.jsx)(C,{className:`size-3`,strokeWidth:3}):null,n]},n)})})}function zt({client:e,local:t,seen:n,managed:r,url:i}){let a=d(),o=Mt(i),s=!r&&!!t&&!e.oauth,[c,l]=(0,V.useState)(s&&t?.installed!==!1?`here`:`address`),[f,m]=(0,V.useState)(null),[h,g]=(0,V.useState)(),_=p({mutationFn:t=>u.post(`/api/studio/local/apps/${e.id}`,{connect:t}),onSuccess:e=>m(e),onError:e=>m({ok:!1,message:e.message}),onSettled:()=>a.invalidateQueries({queryKey:[`local-apps`]})}),v=p({mutationFn:()=>u.post(`/api/studio/api-keys`,{name:e.name.slice(0,32)}),onSuccess:async e=>{g(e.key),await a.invalidateQueries({queryKey:[`api-keys`]})}}),y=e.oauth===!0||e.id===`claude-desktop`,ee=c===`address`&&y&&!(r&&o),te=c===`here`?!!t?.connected:r||!!h,b=!!n?.toolAt,ne=b?2:te||n?1:0,x=e=>(0,H.jsx)(Y,{text:e});return(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(Rt,{at:ne,done:b}),(0,H.jsx)(`h2`,{className:`mt-1.5 font-display font-semibold text-[26px] leading-tight tracking-tight`,children:e.name}),(0,H.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3`,children:e.widgets?R(`integrate.leadApp`):R(`integrate.leadMcp`)})]}),(0,H.jsx)(It,{widgets:e.widgets}),(0,H.jsxs)(N,{className:`flex flex-col gap-6 p-6`,children:[s||!e.oauth?(0,H.jsx)(Z,{title:R(`integrate.where`),children:(0,H.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:[`here`,`address`].map(e=>{let t=e===`here`&&!s;return(0,H.jsxs)(`button`,{type:`button`,disabled:t,onClick:()=>l(e),"aria-pressed":c===e,className:A(`flex items-start gap-3 rounded-xl p-3.5 text-left ring-1 transition`,c===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,H.jsx)(Ze,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}):(0,H.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,H.jsxs)(`span`,{className:`min-w-0`,children:[(0,H.jsx)(`span`,{className:`block font-medium text-[14px]`,children:R(e===`here`?`integrate.here`:`integrate.address`)}),(0,H.jsx)(`span`,{className:`block text-[12px] text-ink-3`,children:R(e===`here`?r?`integrate.hereManaged`:`integrate.hereHint`:`integrate.addressHint`)})]})]},e)})})}):null,ee?(0,H.jsx)(Z,{title:R(`mcp.notHere`),children:(0,H.jsx)(X,{children:R(r?`mcp.needsPublic`:`integrate.oauthLocal`)})}):c===`here`?(0,H.jsxs)(Z,{title:R(`integrate.connectTitle`),children:[t?.installed===!1&&!t.connected?(0,H.jsx)(X,{children:R(`integrate.notInstalled`,{app:e.name})}):null,t?.connected?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2 text-[14px] text-ink-2`,children:[(0,H.jsx)(C,{className:`size-4 text-moss`}),R(`integrate.connected`,{app:e.name})]}),(0,H.jsx)(L,{size:`sm`,variant:`ghost`,busy:_.isPending&&_.variables===!1,onClick:()=>_.mutate(!1),children:R(`mcp.appsDisconnect`)})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`integrate.connectHint`,{app:e.name})}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(L,{busy:_.isPending,onClick:()=>_.mutate(!0),children:[(0,H.jsx)(T,{className:`size-4`}),` `,R(`integrate.connect`,{app:e.name})]})})]}),f&&!f.ok?(0,H.jsx)(`p`,{className:`text-[13px] text-rose`,children:f.message}):null,f?.snippet?(0,H.jsx)(Y,{text:f.snippet}):null,t?.where?(0,H.jsx)(`p`,{className:`font-mono text-[11px] text-ink-4`,children:t.where}):null]}):(0,H.jsxs)(H.Fragment,{children:[r||y?null:(0,H.jsx)(Z,{title:R(`mcp.keyTitle`),children:h?(0,H.jsxs)(`p`,{className:`flex items-center gap-2 text-[14px] text-ink-2`,children:[(0,H.jsx)(C,{className:`size-4 text-moss`}),` `,R(`mcp.keyReady`)]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(X,{children:R(`mcp.keyHint`)}),(0,H.jsx)(`div`,{children:(0,H.jsxs)(L,{variant:`secondary`,busy:v.isPending,onClick:()=>v.mutate(),children:[(0,H.jsx)(T,{className:`size-4`}),` `,R(`mcp.keyCreate`,{client:e.name})]})})]})}),(0,H.jsxs)(Z,{title:R(`mcp.add`),children:[r||h||y?(0,H.jsx)(Nt,{id:e.id,url:i,apiKey:h}):(0,H.jsx)(X,{children:R(`mcp.keyFirst`)}),r?(0,H.jsx)(X,{children:R(`mcp.oauth`)}):null,(0,H.jsx)(`p`,{className:`text-[12px] text-ink-4`,children:R(o?`mcp.addressPublic`:`mcp.addressLocal`)})]})]}),ee?null:(0,H.jsxs)(Z,{title:R(`integrate.test`),children:[(0,H.jsxs)(`ol`,{className:`flex flex-col`,children:[(0,H.jsx)(Ft,{state:n?`done`:te?`now`:`later`,title:R(`integrate.seen`,{app:e.name}),children:(0,H.jsx)(X,{children:R(c===`here`?`integrate.restart`:`integrate.reload`,{app:e.name})})}),(0,H.jsxs)(Ft,{state:n?.toolAt?`done`:n?`now`:`later`,title:R(`integrate.tool`),children:[(0,H.jsx)(X,{children:R(`integrate.askHint`,{app:e.name})}),x(R(`integrate.askTool`))]}),e.widgets?(0,H.jsxs)(Ft,{state:n?.widgetAt?`done`:n?.toolAt?`now`:`later`,title:R(`integrate.widget`),children:[(0,H.jsx)(X,{children:R(`integrate.widgetHint`)}),x(R(`integrate.askWidget`))]}):null]}),b?(0,H.jsxs)(`p`,{className:`flex items-center gap-2 font-medium text-[14px] text-moss`,children:[(0,H.jsx)(C,{className:`size-4`,strokeWidth:3}),R(`integrate.works`,{app:e.name})]}):null]})]})]})}function Bt(){let e=m(),t=e.data?.mode===`managed`,n=c({queryKey:[`local-apps`],queryFn:()=>u.get(`/api/studio/local/apps`),enabled:e.data?.mode===`local`}),r=c({queryKey:[`integrations-seen`],queryFn:()=>u.get(`/api/studio/integrations/seen`),refetchInterval:2500}),[i,a]=(0,V.useState)(null);if(!e.data||!t&&!n.data)return null;let o=e.data.mcpUrl??``,s=e=>n.data?.find(t=>t.id===e),l=e=>r.data?.[e],d=e=>{let t=s(e);return t?.installed||t?.connected?0:1},f=[...jt].sort((e,t)=>d(e.id)-d(t.id)),p=f.find(e=>e.id===i)??f[0],h=e=>{let t=s(e);return l(e)?.toolAt?{note:R(`integrate.stateWorks`),tone:`done`}:t?.connected?{note:R(`integrate.stateConnected`),tone:`ok`}:t?.installed?{note:R(`integrate.stateInstalled`),tone:`dim`}:{}};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-10`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-[22px] tracking-tight`,children:R(`integrate.title`)}),(0,H.jsx)(`p`,{className:`mt-1 max-w-2xl text-[14px] text-ink-2`,children:R(`integrate.lead`)})]}),(0,H.jsxs)(`div`,{className:`grid gap-8 lg:grid-cols-[16rem_minmax(0,1fr)]`,children:[(0,H.jsxs)(`nav`,{className:`flex flex-col gap-5 lg:sticky lg:top-24 lg:self-start`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-1.5 px-3 font-medium text-[11px] text-ink-4 uppercase tracking-[0.14em]`,children:R(`integrate.groupApps`)}),(0,H.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:f.map(e=>(0,H.jsx)(Lt,{selected:e.id===p.id,title:e.name,widgets:e.widgets,onPick:()=>a(e.id),...h(e.id)},e.id))})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`p`,{className:`mb-1.5 px-3 font-medium text-[11px] text-ink-4 uppercase tracking-[0.14em]`,children:R(`integrate.groupShare`)}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(Lt,{selected:!1,disabled:!0,title:R(`integrate.shareLink`),note:R(`integrate.soon`)}),(0,H.jsx)(Lt,{selected:!1,disabled:!0,title:R(`integrate.shareSite`),note:R(`integrate.soon`)})]})]})]}),(0,H.jsx)(zt,{client:p,local:s(p.id),seen:l(p.id),managed:t,url:o},p.id)]}),t?null:(0,H.jsx)(Pt,{}),(0,H.jsxs)(`p`,{className:`flex items-start gap-2 text-[13px] text-ink-3`,children:[(0,H.jsx)(re,{className:`mt-0.5 size-3.5 shrink-0`}),R(`mcp.notReverse`)]})]})}function Vt(e){return R(e.origin===`local`?`readonly.project`:`readonly.server`)}function Ht({children:e}){return(0,H.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-paper-2 px-4 py-3 text-[14px] text-ink-2 leading-relaxed`,children:[(0,H.jsx)(le,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,H.jsx)(`p`,{className:`min-w-0`,children:e})]})}function Ut(e){return e.type.startsWith(`image/`)&&/logo/i.test(e.name)?`logo`:/^(image|video|audio)\//.test(e.type)?`asset`:`document`}function Wt(e,t){let n=d(),[r,i]=(0,V.useState)([]),[a,o]=(0,V.useState)(`idle`),[c,l]=(0,V.useState)(null),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(null),g=(0,V.useRef)(null),_=()=>(g.current??=(async()=>{await Promise.all([n.invalidateQueries({queryKey:[`projects`]}),n.invalidateQueries({queryKey:[`project-files`,e]})]),t(),g.current=null})(),g.current);return{messages:r,phase:a,activity:f,startedAt:m,error:c,send:async(t,c=[])=>{if(!(t.trim()||c.length)||a!==`idle`)return!1;if(l(null),o(`thinking`),h(Date.now()),c.length){try{for(let t of c)await u.upload(`/api/studio/projects/${e}/files?kind=${Ut(t)}`,t)}catch(e){return l(e.message),o(`idle`),h(null),await _(),!1}await _();let n=`${R(`editor.attached`)}: ${c.map(e=>e.name).join(`, `)}`;t=t.trim()?`${t}\n\n${n}`:n}let d=r.map(({role:e,content:t})=>({role:e,content:t})).slice(-12),f=`p-${Date.now()}`;i(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:t,previews:ue(c)},{id:f,role:`assistant`,content:``,pending:!0}]),p(null);let m=!1;try{await s(`/api/studio/projects/${e}/assist`,{message:t,history:d},(e,t)=>{if(e===`text`){let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(t));else if(e===`changed`)o(`building`),_();else if(e===`done`){m=!0;let e=JSON.parse(t);i(t=>t.map(t=>t.id===f?{...t,content:e.reply,changed:e.changed,pending:!1}:t))}else e===`error`&&(m=!0,l(JSON.parse(t).message))}),m||l(R(`editor.chatBroken`))}catch(e){l(e.message)}finally{p(null),h(null),i(e=>e.filter(e=>!(e.id===f&&!e.content)).map(e=>({...e,pending:!1}))),o(`idle`),await g.current,await _(),await n.invalidateQueries({queryKey:[`me`]})}return!0}}}function Gt(){return(0,H.jsxs)(`div`,{className:`sm:pr-36`,children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-[20px] leading-tight tracking-tight`,children:R(`project.assistantTitle`)}),(0,H.jsx)(`p`,{className:`mt-1.5 max-w-2xl text-[15px] text-ink-2 leading-relaxed`,children:R(`project.assistantHello`)})]})}var Kt=72,qt=720;function Jt({projectId:e,onChanged:t}){let n=Wt(e,t),r=(0,V.useRef)(null),[i,a]=(0,V.useState)(null);return(0,V.useEffect)(()=>{let e=()=>{let e=r.current?.getBoundingClientRect();e&&a(t=>{if(e.bottom>=Kt)return null;let n=Math.min(e.width,qt),r=e.left+(e.width-n)/2;return t&&t.left===r&&t.width===n?t:{left:r,width:n,height:t?.height??e.height}})};return e(),window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[]),(0,H.jsxs)(`div`,{ref:r,style:i?{minHeight:i.height}:void 0,children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-1 font-medium text-[12px] text-ember-strong uppercase tracking-[0.07em]`,children:[(0,H.jsx)(oe,{className:`size-3.5`}),` `,R(`project.assistant`)]}),(0,H.jsxs)(`div`,{className:`relative`,children:[!i&&n.messages.length===0?(0,H.jsx)(`div`,{className:`absolute -top-14 right-10 z-10 max-sm:hidden`,children:(0,H.jsx)(o,{kind:`round`,size:104})}):null,(0,H.jsx)(`div`,{className:A(`flex flex-col overflow-hidden bg-card`,i?`fixed bottom-4 z-30 max-h-[70dvh] animate-dock rounded-2xl shadow-overlay ring-1 ring-border`:`max-h-[520px] rounded-xl bg-linear-to-br from-ember-tint via-card to-card shadow-soft ring-1 ring-ember-veil`),style:i?{left:i.left,width:i.width}:void 0,children:(0,H.jsx)(de,{chat:n,avatar:`round`,compact:!!i,intro:(0,H.jsx)(Gt,{}),placeholder:R(`project.assistantComposer`),changedLabel:R(`project.assistantChanged`)})})]})]})}var Yt=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],Xt=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,Zt=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,Qt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,$t=/^(https?:\/\/|www\.)\S+$/i,en=/^\+?[\d\s()/.-]{7,20}$/,tn=/^(ja|nein|yes|no|true|false)$/i;function nn(e){let t=e.trim();return t?t.includes(`
|
|
2
2
|
`)||t.length>140?`longtext`:tn.test(t)?`boolean`:Qt.test(t)?`email`:$t.test(t)?`url`:Xt.test(t)?`date`:Zt.test(t)&&!/^(\+|0\d)/.test(t)?`number`:en.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function rn(e,t=[]){let n=e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFD`).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`fakt`,r=n;for(let e=2;t.includes(r);e++)r=`${n}_${e}`;return r}var an=[{key:`adresse`,de:`Adresse`,en:`Address`},{key:`plz`,de:`PLZ`,en:`Postcode`},{key:`ort`,de:`Ort`,en:`City`},{key:`uid`,de:`UID`,en:`VAT id`},{key:`telefon`,de:`Telefon`,en:`Phone`},{key:`e_mail`,de:`E-Mail`,en:`Email`},{key:`website`,de:`Website`,en:`Website`},{key:`iban`,de:`IBAN`,en:`IBAN`}],on={facts:100,colors:12,files:{logo:8,asset:100,document:50},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},sn=/^#[0-9a-fA-F]{6}$/;function cn({onAdd:e,onClose:t}){let[n,r]=(0,V.useState)(`#e0531b`),[i,a]=(0,V.useState)(``),o=sn.test(n);return(0,H.jsx)(j,{open:!0,onClose:t,title:R(`project.colorAddTitle`),children:(0,H.jsxs)(`form`,{onSubmit:r=>{r.preventDefault(),o&&(e({name:i.trim(),value:n.toLowerCase()}),t())},className:`flex flex-col gap-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`project.colorValue`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Se,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,H.jsx)(I,{value:n,placeholder:`#e0531b`,spellCheck:!1,onChange:e=>r(e.target.value.trim()),className:`font-mono text-[14px]`})]})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`project.colorUseLabel`)}),(0,H.jsx)(I,{autoFocus:!0,value:i,maxLength:120,placeholder:R(`project.colorName`),onChange:e=>a(e.target.value)}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:R(`project.colorUse`)})]}),(0,H.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,H.jsx)(L,{variant:`ghost`,onClick:t,children:R(`common.cancel`)}),(0,H.jsx)(L,{type:`submit`,disabled:!o,children:R(`project.add`)})]})]})})}function ln({colors:e,save:t,readOnly:n}){let r=(0,V.useRef)(0),[i,a]=(0,V.useState)(()=>e.map(e=>({...e,id:`c${r.current++}`}))),[o,s]=(0,V.useState)(!1),c=q(i.filter(e=>sn.test(e.value)).map(({name:e,value:t})=>({name:e.trim(),value:t})),t),l=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n));return(0,H.jsxs)(U,{title:R(`project.colors`),hint:R(`project.colorsHint`),save:c,locked:n,children:[(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map((e,t)=>(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(Se,{value:sn.test(e.value)?e.value:`#888888`,onChange:t=>l(e.id,{value:t.target.value})}),(0,H.jsx)(I,{value:e.name,placeholder:R(`project.colorName`),maxLength:120,onChange:t=>l(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,H.jsx)(I,{value:e.value,placeholder:`#e0531b`,spellCheck:!1,onChange:t=>l(e.id,{value:t.target.value.trim()}),className:`w-28 font-mono text-[13px]`}),(0,H.jsxs)(`div`,{className:`flex w-24 shrink-0 items-center justify-end max-sm:w-auto`,children:[t===0?(0,H.jsx)(`span`,{className:`mr-1 max-sm:hidden`,children:(0,H.jsx)(F,{tone:`ember`,children:R(`project.colorAccent`)})}):n?null:(0,H.jsx)(P,{label:R(`project.colorFirst`),onClick:()=>a(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,H.jsx)(b,{className:`size-4`})}),n?null:(0,H.jsx)(P,{label:R(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,H.jsx)(S,{className:`size-4`})})]})]},e.id))}),i.length&&!n?(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:R(`project.colorUse`)}):null,i.length<on.colors&&!n?(0,H.jsxs)(L,{variant:`secondary`,size:`sm`,className:i.length?`mt-3`:void 0,onClick:()=>s(!0),children:[(0,H.jsx)(T,{className:`size-4`}),` `,R(`project.colorAdd`)]}):null,o?(0,H.jsx)(cn,{onClose:()=>s(!1),onAdd:e=>a(t=>[...t,{...e,id:`c${r.current++}`}])}):null]})}var un={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function $({file:e,actions:t}){let[n,r]=(0,V.useState)(e.description),i=(0,V.useRef)(e.description),a=(0,V.useRef)(null);(0,V.useEffect)(()=>{e.description!==i.current&&(r(t=>t===i.current?e.description:t),i.current=e.description)},[e.description]),(0,V.useLayoutEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[n]);let o=e.status===`pending`&&!n;return t.readOnly?n?(0,H.jsx)(`p`,{className:`text-[13px] text-ink-2 leading-snug`,children:n}):null:(0,H.jsx)(`textarea`,{ref:a,rows:1,value:n,maxLength:600,placeholder:R(o?`project.describing`:`project.description`),onChange:e=>r(e.target.value),onBlur:()=>{n.trim()!==e.description&&(i.current=n.trim(),t.describe(e.id,n.trim()))},className:`-mx-1 block w-[calc(100%+0.5rem)] resize-none overflow-hidden rounded-md bg-transparent px-1 py-0.5 text-[13px] text-ink-2 leading-snug outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`})}function dn(e,t){confirm(R(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function fn({projectId:e,file:t,small:n}){let r=G(e,t.id);return t.mime.startsWith(`image/`)?(0,H.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:A(`size-full`,t.kind===`logo`?`object-contain p-3`:`object-cover`)}):t.mime.startsWith(`video/`)?(0,H.jsx)(`video`,{src:`${r}#t=0.1`,preload:`metadata`,controls:!n,className:`size-full object-cover`}):(0,H.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-3`,children:t.mime.startsWith(`audio/`)?(0,H.jsx)($e,{className:n?`size-5`:`size-7`}):(0,H.jsx)(ne,{className:n?`size-5`:`size-7`})})}function pn({projectId:e,kind:t,files:n,actions:r,accept:i,addLabel:a,onPreview:o}){return(0,H.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(184px,1fr))] gap-3`,children:[n.map((i,a)=>(0,H.jsxs)(`div`,{className:`group relative flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[t===`logo`&&a===0?(0,H.jsx)(`span`,{className:`absolute -top-3 left-3 z-10 rounded-full ring-2 ring-card`,children:(0,H.jsx)(F,{tone:`ember`,children:R(`project.logoMain`)})}):null,(0,H.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?un:void 0,children:[o&&i.mime.startsWith(`image/`)?(0,H.jsx)(`button`,{type:`button`,"aria-label":`${R(`project.preview`)}: ${i.name}`,onClick:()=>o(i),className:`block size-full cursor-zoom-in`,children:(0,H.jsx)(fn,{projectId:e,file:i})}):(0,H.jsx)(fn,{projectId:e,file:i}),(0,H.jsxs)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100`,children:[o?(0,H.jsx)(P,{label:R(`project.preview`),onClick:()=>o(i),className:`size-8 bg-card shadow-soft`,children:(0,H.jsx)(w,{className:`size-4`})}):null,t===`logo`&&a>0&&!r.readOnly?(0,H.jsx)(P,{label:R(`project.logoMakeMain`),onClick:()=>r.order(`logo`,[i.id,...n.filter(e=>e.id!==i.id).map(e=>e.id)]),className:`size-8 bg-card shadow-soft`,children:(0,H.jsx)(me,{className:`size-4`})}):null,r.readOnly?null:(0,H.jsx)(P,{label:R(`project.remove`),onClick:()=>dn(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,H.jsx)(S,{className:`size-4`})})]})]}),t===`asset`?(0,H.jsx)(`div`,{className:`truncate px-0.5 text-[12px] text-ink-3`,title:i.name,children:i.name}):null,(0,H.jsx)($,{file:i,actions:r})]},i.id)),a&&!r.readOnly?(0,H.jsxs)(W,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,H.jsx)(k,{className:`size-5`}):(0,H.jsx)(T,{className:`size-5`}),a]}):null]})}function mn({projectId:e,data:t,readOnly:n}){let r=K(e,n);return(0,H.jsxs)(U,{title:R(`project.logos`),hint:R(`project.logosHint`),children:[(0,H.jsx)(pn,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:r,accept:`image/*`,addLabel:R(`project.logoAdd`)}),r.error?(0,H.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:r.error}):null]})}var hn=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),gt(e.size)].filter(Boolean).join(` · `);function gn({projectId:e,file:t,actions:n,onClose:r}){let i=G(e,t.id);return(0,H.jsxs)(j,{open:!0,onClose:r,wide:`page`,title:t.name,children:[(0,H.jsxs)(`div`,{className:`-mt-2 mb-4 flex items-center justify-between gap-3`,children:[(0,H.jsx)(`span`,{className:`text-[13px] text-ink-3`,children:hn(t)}),(0,H.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":R(`project.openOriginal`),title:R(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,H.jsx)(E,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,H.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:un,children:(0,H.jsx)(`img`,{src:i,alt:``,className:`mx-auto max-h-[68dvh] object-contain`})}):t.mime.startsWith(`video/`)?(0,H.jsx)(`video`,{src:i,controls:!0,className:`max-h-[68dvh] w-full rounded-lg bg-black`}):(0,H.jsx)(`audio`,{src:i,controls:!0,className:`w-full`}),(0,H.jsx)(`div`,{className:`mt-4`,children:(0,H.jsx)($,{file:t,actions:n})})]})}function _n({projectId:e,file:t,actions:n,onPreview:r}){return(0,H.jsxs)(`li`,{className:`flex items-start gap-3 rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":`${R(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,H.jsx)(fn,{projectId:e,file:t,small:!0})}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 py-0.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:r,title:t.name,className:`min-w-0 truncate font-medium text-[14px] hover:underline`,children:t.name}),(0,H.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:hn(t)})]}),(0,H.jsx)($,{file:t,actions:n})]}),(0,H.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,H.jsx)(P,{label:R(`project.preview`),onClick:r,children:(0,H.jsx)(w,{className:`size-4`})}),n.readOnly?null:(0,H.jsx)(P,{label:R(`project.remove`),onClick:()=>dn(t,n),className:`hover:text-rose`,children:(0,H.jsx)(S,{className:`size-4`})})]})]})}function vn({projectId:e,data:t,readOnly:n}){let r=K(e,n),[i,a]=ht(`assets`,`cards`),[o,s]=(0,V.useState)(``),[c,l]=(0,V.useState)(null),u=t.files.filter(e=>e.kind===`asset`),d=u.find(e=>e.id===c),f=o.trim().toLowerCase(),p=f?u.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(f)):u;return(0,H.jsxs)(U,{title:R(`project.assets`),hint:R(`project.assetsHint`),children:[u.length?(0,H.jsx)(ut,{layout:i,onToggle:a,children:(0,H.jsx)(dt,{value:o,onChange:s,placeholder:R(`project.assetSearch`)})}):null,p.length?(0,H.jsx)(`div`,{className:`mb-3`,children:i===`cards`?(0,H.jsx)(pn,{projectId:e,kind:`asset`,files:p,actions:r,onPreview:e=>l(e.id)}):(0,H.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map(t=>(0,H.jsx)(_n,{projectId:e,file:t,actions:r,onPreview:()=>l(t.id)},t.id))})}):null,n?u.length?null:(0,H.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:R(`project.staysLocal`)}):(0,H.jsxs)(W,{accept:`image/*,video/*,audio/*`,onFiles:e=>r.upload(`asset`,e),className:`h-16 w-full`,children:[r.busy?(0,H.jsx)(k,{className:`size-4`}):(0,H.jsx)(be,{className:`size-4`}),R(`project.drop`),` `,(0,H.jsx)(`span`,{className:`underline`,children:R(`project.assetAdd`)})]}),r.error?(0,H.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:r.error}):null,d?(0,H.jsx)(gn,{projectId:e,file:d,actions:r,onClose:()=>l(null)}):null]})}function yn(e,t,n){return c({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>u.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function bn(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var xn=e=>[bn(e),e.pages?R(`project.pages`,{n:e.pages}):null,gt(e.size)].filter(Boolean).join(` · `);function Sn({file:e}){return e.status===`pending`?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,H.jsx)(k,{className:`size-3`}),` `,R(`project.reading`)]}):e.status===`failed`?(0,H.jsx)(`span`,{className:`text-[12px] text-rose`,children:e.error}):e.indexed?(0,H.jsx)(F,{tone:`live`,children:e.indexed===`embeddings`?R(`project.indexed`):R(`project.indexedKeywords`)}):(0,H.jsx)(F,{tone:`warn`,children:R(`project.notIndexed`)})}function Cn({file:e,actions:t,onPreview:n}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(P,{label:R(`project.preview`),onClick:n,children:(0,H.jsx)(w,{className:`size-4`})}),e.status!==`pending`&&!t.readOnly?(0,H.jsx)(P,{label:R(`project.reindex`),onClick:()=>t.reindex(e.id),children:(0,H.jsx)(ye,{className:`size-4`})}):null,t.readOnly?null:(0,H.jsx)(P,{label:R(`project.remove`),onClick:()=>dn(e,t),className:`hover:text-rose`,children:(0,H.jsx)(S,{className:`size-4`})})]})}function wn({file:e,actions:t,onPreview:n}){let r=/sheet|csv|excel/.test(e.mime);return(0,H.jsxs)(`li`,{className:`flex gap-3 rounded-lg bg-paper p-3 ring-1 ring-border-soft`,children:[(0,H.jsx)(`div`,{className:`mt-0.5 text-ink-3`,children:r?(0,H.jsx)(ze,{className:`size-5`}):(0,H.jsx)(ve,{className:`size-5`})}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1.5`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:n,title:e.name,className:`min-w-0 truncate font-medium text-[14px] hover:underline`,children:e.name}),(0,H.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:xn(e)}),(0,H.jsx)(Sn,{file:e})]}),(0,H.jsx)($,{file:e,actions:t})]}),(0,H.jsx)(`div`,{className:`-my-1 flex shrink-0 items-start`,children:(0,H.jsx)(Cn,{file:e,actions:t,onPreview:n})})]})}function Tn({projectId:e,file:t}){let n=yn(e,t,1500);return t.mime.startsWith(`image/`)?(0,H.jsx)(`img`,{src:G(e,t.id),alt:``,className:`size-full object-cover`}):t.status===`pending`||n.isLoading?(0,H.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-4`,children:(0,H.jsx)(k,{className:`size-5`})}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`w-[222%] origin-top-left scale-[0.45] p-6`,children:(0,H.jsx)(ie,{text:n.data?.text??``})}),(0,H.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 h-12 bg-linear-to-t from-card to-transparent`})]})}function En({projectId:e,file:t,actions:n,onPreview:r}){return(0,H.jsxs)(`li`,{className:`group flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`${R(`project.preview`)}: ${t.name}`,className:`relative block h-44 w-full overflow-hidden rounded-md bg-card text-left ring-1 ring-border-soft transition hover:ring-border`,children:(0,H.jsx)(Tn,{projectId:e,file:t})}),(0,H.jsx)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100 [&>button]:size-8 [&>button]:bg-card [&>button]:shadow-soft`,children:(0,H.jsx)(Cn,{file:t,actions:n,onPreview:r})})]}),(0,H.jsxs)(`div`,{className:`mt-1 flex flex-col gap-1 px-0.5`,children:[(0,H.jsx)(`div`,{className:`truncate font-medium text-[13px]`,title:t.name,children:t.name}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,H.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:xn(t)}),(0,H.jsx)(Sn,{file:t})]})]}),(0,H.jsx)($,{file:t,actions:n})]})}var Dn=2e5;function On({projectId:e,file:t,onClose:n}){let r=t.mime===`application/pdf`||t.mime.startsWith(`image/`),[i,a]=(0,V.useState)(r?`original`:`text`),o=yn(e,t,Dn),s=G(e,t.id),c=(e,t)=>(0,H.jsx)(`button`,{type:`button`,"aria-pressed":i===e,onClick:()=>a(e),className:A(`h-8 rounded-full px-3 text-[13px] transition`,i===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,H.jsxs)(j,{open:!0,onClose:n,wide:`page`,title:t.name,children:[(0,H.jsxs)(`div`,{className:`-mt-2 mb-4 flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,H.jsx)(`span`,{className:`text-[13px] text-ink-3`,children:xn(t)}),(0,H.jsx)(Sn,{file:t}),(0,H.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[r?(0,H.jsxs)(H.Fragment,{children:[c(`original`,R(`project.original`)),c(`text`,R(`project.readText`))]}):null,(0,H.jsx)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,"aria-label":R(`project.openOriginal`),title:R(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,H.jsx)(E,{className:`size-4`})})]})]}),i===`original`?t.mime===`application/pdf`?(0,H.jsx)(`iframe`,{src:s,title:t.name,className:`h-[70dvh] w-full rounded-lg bg-paper-2 ring-1 ring-border-soft`}):(0,H.jsx)(`img`,{src:s,alt:``,className:`mx-auto max-h-[70dvh] rounded-lg object-contain`}):o.isLoading?(0,H.jsx)(`div`,{className:`flex h-40 items-center justify-center text-ink-3`,children:(0,H.jsx)(k,{})}):o.data?.text?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`overflow-x-auto rounded-lg bg-paper p-5 ring-1 ring-border-soft`,children:(0,H.jsx)(ie,{text:o.data.text,className:`text-[14px]`})}),o.data.chars>o.data.text.length?(0,H.jsx)(`p`,{className:`mt-3 text-[13px] text-ink-3`,children:R(`project.textCut`,{shown:o.data.text.length.toLocaleString(),total:o.data.chars.toLocaleString()})}):null]}):(0,H.jsx)(`p`,{className:`py-8 text-center text-[14px] text-ink-3`,children:R(`project.noText`)})]})}function kn({projectId:e}){let[t,n]=(0,V.useState)(``),[r,i]=(0,V.useState)(null),[a,o]=(0,V.useState)(!1),s=async()=>{if(!t.trim()){i(null);return}o(!0);try{let n=await u.post(`/api/studio/projects/${e}/search`,{query:t});i(n.hits)}catch{i([])}finally{o(!1)}};return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(dt,{value:t,placeholder:R(`project.searchTest`),busy:a,onEnter:()=>void s(),onChange:e=>{n(e),e.trim()||i(null)}}),r?r.length?(0,H.jsx)(`ul`,{className:`mt-2 flex flex-col gap-2`,children:r.map((e,t)=>(0,H.jsxs)(`li`,{className:`rounded-lg bg-paper-2 px-3 py-2 text-[13px]`,children:[(0,H.jsx)(`div`,{className:`mb-0.5 font-medium text-[12px] text-ink-3`,children:e.name}),(0,H.jsx)(`p`,{className:`line-clamp-3 whitespace-pre-line text-ink-2`,children:e.text})]},t))}):(0,H.jsx)(`p`,{className:`mt-2 text-[13px] text-ink-3`,children:R(`project.searchNone`)}):null]})}function An({projectId:e,data:t,readOnly:n}){let r=K(e,n),[i,a]=ht(`documents`,`list`),[o,s]=(0,V.useState)(null),c=t.files.filter(e=>e.kind===`document`),l=c.find(e=>e.id===o),u=i===`cards`?En:wn;return(0,H.jsxs)(U,{title:R(`project.documents`),hint:R(`project.documentsHint`),children:[c.length?(0,H.jsx)(ut,{layout:i,onToggle:a,children:(0,H.jsx)(kn,{projectId:e})}):null,c.length?(0,H.jsx)(`ul`,{className:A(`mb-3`,i===`cards`?`grid grid-cols-[repeat(auto-fill,minmax(220px,1fr))] gap-3`:`flex flex-col gap-2`),children:c.map(t=>(0,H.jsx)(u,{projectId:e,file:t,actions:r,onPreview:()=>s(t.id)},t.id))}):null,n?c.length?null:(0,H.jsx)(`p`,{className:`text-[14px] text-ink-3`,children:R(`project.staysLocal`)}):(0,H.jsxs)(W,{accept:`.pdf,.docx,.doc,.xlsx,.csv,.tsv,.txt,.md,.json,.html,.eml,image/*`,onFiles:e=>r.upload(`document`,e),className:`h-16 w-full`,children:[r.busy?(0,H.jsx)(k,{className:`size-4`}):(0,H.jsx)(be,{className:`size-4`}),R(`project.drop`),` `,(0,H.jsx)(`span`,{className:`underline`,children:R(`project.documentAdd`)})]}),r.error?(0,H.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:r.error}):null,c.length&&!t.embeddings?(0,H.jsx)(`p`,{className:`mt-3 text-[13px] text-ink-3`,children:R(`project.keywordsOnly`)}):null,l?(0,H.jsx)(On,{projectId:e,file:l,onClose:()=>s(null)}):null]})}var jn=e=>/^(ja|yes|true)$/i.test(e.trim()),Mn={text:ge,longtext:at,number:Ue,date:Fe,url:re,email:ae,phone:tt,boolean:st};function Nn({type:e,detected:t,onChange:n}){let[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(!1),s=(0,V.useRef)(null);(0,V.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||i(!1)},t=e=>e.key===`Escape`&&i(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]);let c=Mn[e??t],l=`${R(`project.factType`)}: ${R(`project.type.${e??t}`)}`,u=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[14px] text-ink-2 hover:bg-accent hover:text-ink`,d=e=>{n(e),i(!1)};return(0,H.jsxs)(`div`,{className:`relative`,ref:s,children:[(0,H.jsx)(`button`,{type:`button`,"aria-label":l,title:l,"aria-haspopup":`menu`,"aria-expanded":r,onClick:e=>{o(window.innerHeight-e.currentTarget.getBoundingClientRect().bottom<400),i(e=>!e)},className:A(`inline-flex size-11 items-center justify-center rounded-lg transition hover:bg-accent hover:text-ink`,r?`bg-accent text-ink`:e?`text-ink-2`:`text-ink-4`),children:(0,H.jsx)(c,{className:`size-4`})}),r?(0,H.jsxs)(`div`,{role:`menu`,className:A(`absolute right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,a?`bottom-12`:`top-12`),children:[(0,H.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!e,className:u,onClick:()=>d(void 0),children:[(0,H.jsx)(ce,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:`flex-1`,children:R(`project.factAuto`)}),(0,H.jsx)(`span`,{className:`text-[12px] text-ink-4`,children:R(`project.type.${t}`)}),(0,H.jsx)(C,{className:A(`size-4 shrink-0`,e&&`invisible`)})]}),(0,H.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),Yt.map(t=>{let n=Mn[t];return(0,H.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t,className:u,onClick:()=>d(t),children:[(0,H.jsx)(n,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:`flex-1`,children:R(`project.type.${t}`)}),(0,H.jsx)(C,{className:A(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function Pn({facts:e,save:t,readOnly:n}){let r=(0,V.useRef)(0),i=(0,V.useRef)(null),[a,o]=(0,V.useState)(()=>e.map(e=>({...e,id:`f${r.current++}`}))),s=q(a.filter(e=>e.key&&e.label.trim()).map(({key:e,label:t,value:n,type:r})=>({key:e,label:t.trim(),value:n,...r?{type:r}:{}})),t),c=(e,t)=>o(n=>n.map(n=>n.id===e?{...n,...t}:n)),l=(e,t,n=!1)=>{let a=`f${r.current++}`;i.current=`${a}:${t}`;let s={id:a,key:``,label:``,value:``,...e};o(e=>n?[s,...e]:[...e,s])},u=e=>t=>{t&&i.current===e&&(i.current=null,t.focus())},d=an.filter(e=>!a.some(t=>t.key===e.key));return(0,H.jsxs)(U,{title:R(`project.facts`),hint:R(`project.factsHint`),save:s,locked:n,action:a.length<on.facts&&!n?(0,H.jsxs)(L,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`,!0),children:[(0,H.jsx)(T,{className:`size-4`}),` `,R(`project.factAdd`)]}):null,children:[(0,H.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>{let t=nn(e.value),r=e.type??t;return(0,H.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-x-1 gap-y-2 sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto_auto]`,children:[(0,H.jsx)(I,{ref:u(`${e.id}:label`),value:e.label,placeholder:R(`project.factLabel`),title:e.key?`{{facts.${e.key}}}`:void 0,onChange:t=>c(e.id,{label:t.target.value}),onBlur:()=>{!e.key&&e.label.trim()&&c(e.id,{key:rn(e.label,a.map(e=>e.key))})},className:`max-sm:col-span-3 max-sm:font-medium sm:mr-1`}),e.type===`boolean`?(0,H.jsxs)(`div`,{className:`flex h-11 items-center gap-3`,children:[(0,H.jsx)(Ce,{checked:jn(e.value),label:e.label,onChange:t=>c(e.id,{value:R(t?`project.yes`:`project.no`)})}),(0,H.jsx)(`span`,{className:`text-[14px] text-ink-2`,children:jn(e.value)?R(`project.yes`):R(`project.no`)})]}):(0,H.jsx)(M,{ref:u(`${e.id}:value`),rows:1,minRows:r===`longtext`?2:1,maxRows:10,value:e.value,placeholder:R(`project.factValue`),onChange:t=>c(e.id,{value:t.target.value}),className:`min-h-11`}),(0,H.jsx)(Nn,{type:e.type,detected:t,onChange:t=>c(e.id,{type:t})}),n?null:(0,H.jsx)(P,{label:R(`project.remove`),onClick:()=>o(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,H.jsx)(S,{className:`size-4`})})]},e.id)})}),a.length<on.facts&&!n?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${a.length?`mt-4`:``}`,children:[(0,H.jsxs)(L,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`),children:[(0,H.jsx)(T,{className:`size-4`}),` `,R(`project.factAdd`)]}),d.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:()=>l({key:e.key,label:D===`en`?e.en:e.de},`value`),className:`inline-flex h-8 items-center gap-1 rounded-full bg-paper-2 px-3 text-[13px] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,H.jsx)(T,{className:`size-3.5`}),` `,D===`en`?e.en:e.de]},e.key))]}):null]})}function Fn({project:e,save:t}){let[n,r]=(0,V.useState)(e.brand.name??``),[i,a]=(0,V.useState)(e.brand.about??``),o=q({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,H.jsx)(U,{title:R(`project.base`),hint:R(`project.baseHint`),save:o,locked:e.readOnly,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`project.title`)}),(0,H.jsx)(I,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:R(`project.titleHint`)})]}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(O,{children:R(`project.about`)}),(0,H.jsx)(M,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,H.jsx)(`p`,{className:`mt-1.5 text-[13px] text-ink-3`,children:R(`project.aboutHint`)})]})]})})}function In({project:e,save:t}){let[n,r]=(0,V.useState)(!1),[i,a]=(0,V.useState)(e.name),o=p({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(P,{label:R(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,H.jsx)(x,{className:`size-4`})}),(0,H.jsx)(j,{open:n,onClose:()=>r(!1),title:R(`project.rename`),children:(0,H.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,H.jsx)(I,{autoFocus:!0,value:i,maxLength:80,onChange:e=>a(e.target.value)}),o.error?(0,H.jsx)(`p`,{className:`mt-3 text-[14px] text-rose`,children:o.error.message}):null,(0,H.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,H.jsx)(L,{variant:`ghost`,onClick:()=>r(!1),children:R(`common.cancel`)}),(0,H.jsx)(L,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:R(`settings.save`)})]})]})})]})}function Ln({project:e}){let t=d(),n=mt(e.id),[r,i]=(0,V.useState)(0),a=async n=>{await u.patch(`/api/studio/projects/${e.id}`,n),await t.invalidateQueries({queryKey:[`projects`]})},o=p({mutationFn:()=>u.del(`/api/studio/projects/${e.id}`),onSuccess:()=>t.invalidateQueries({queryKey:[`projects`]})}),s=g(),c=n.data??{files:[],embeddings:!0},l=`${e.id}:${r}`,f=e.readOnly;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[s?(0,H.jsxs)(`div`,{className:`-mb-3 flex items-center gap-1`,children:[(0,H.jsx)(Ne,{}),f?null:(0,H.jsx)(In,{project:e,save:a})]}):null,f?(0,H.jsx)(Ht,{children:Vt(e)}):(0,H.jsx)(Jt,{projectId:e.id,onChanged:()=>i(e=>e+1)},e.id),(0,H.jsx)(Fn,{project:e,save:a},`base:${l}`),(0,H.jsx)(mn,{projectId:e.id,data:c,readOnly:f}),(0,H.jsx)(ln,{colors:e.brand.colors??[],save:e=>a({brand:{colors:e}}),readOnly:f},`colors:${l}`),(0,H.jsx)(vn,{projectId:e.id,data:c,readOnly:f}),(0,H.jsx)(An,{projectId:e.id,data:c,readOnly:f}),(0,H.jsx)(Pn,{facts:e.facts,save:e=>a({facts:e}),readOnly:f},`facts:${l}`),s&&!f?(0,H.jsxs)(`div`,{children:[(0,H.jsx)(L,{variant:`danger`,busy:o.isPending,onClick:()=>confirm(`${R(`settings.delete`)}?`)&&o.mutate(),children:R(`settings.delete`)}),o.error?(0,H.jsx)(`p`,{className:`mt-2 text-[14px] text-rose`,children:o.error.message}):null]}):null]})}function Rn(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 zn({project:e}){let t=d(),[n,r]=(0,V.useState)(e.mcpServers.map(e=>({...e,auth:e.headers?.Authorization??e.headers?.authorization??``}))),[i,a]=(0,V.useState)(!1),o=e.readOnly,s=p({mutationFn:()=>u.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`]}),a(!0),setTimeout(()=>a(!1),1800)}});return(0,H.jsxs)(N,{className:`p-6`,children:[(0,H.jsx)(`h2`,{className:`font-display font-semibold text-lg`,children:R(`settings.mcp`)}),(0,H.jsx)(`p`,{className:`mt-1 mb-5 text-[14px] text-ink-3`,children:R(`settings.mcpHint`)}),(0,H.jsxs)(`fieldset`,{disabled:o,className:`flex min-w-0 flex-col gap-3`,children:[n.map((e,t)=>(0,H.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,H.jsx)(I,{placeholder:R(`settings.serverName`),value:e.name,onChange:e=>r(n=>n.map((r,i)=>i===t?{...r,name:e.target.value,id:r.id||Rn(e.target.value,n.map(e=>e.id))}:r))}),(0,H.jsx)(I,{placeholder:`${R(`settings.serverUrl`)} (https://…/mcp)`,value:e.url,onChange:e=>r(n=>n.map((n,r)=>r===t?{...n,url:e.target.value}:n))}),o?(0,H.jsx)(`span`,{}):(0,H.jsx)(P,{label:`Entfernen`,onClick:()=>r(e=>e.filter((e,n)=>n!==t)),className:`hover:text-rose`,children:(0,H.jsx)(S,{className:`size-4`})}),(0,H.jsx)(I,{className:`sm:col-span-2`,placeholder:R(`settings.serverHeader`),value:e.auth??``,onChange:e=>r(n=>n.map((n,r)=>r===t?{...n,auth:e.target.value}:n))}),e.id?(0,H.jsx)(`span`,{className:`self-center font-mono text-[11px] text-ink-4`,children:e.id}):null]},t)),o?null:(0,H.jsxs)(L,{variant:`secondary`,className:`self-start`,onClick:()=>r(e=>[...e,{id:``,name:``,url:``,auth:``}]),children:[(0,H.jsx)(T,{className:`size-4`}),` `,R(`settings.addServer`)]})]}),o?null:(0,H.jsxs)(`div`,{className:`mt-5 flex items-center justify-end gap-3`,children:[s.error?(0,H.jsx)(`p`,{className:`text-[14px] text-rose`,children:s.error.message}):null,(0,H.jsx)(L,{busy:s.isPending,onClick:()=>s.mutate(),children:R(i?`settings.saved`:`settings.save`)})]})]})}function Bn(){let{section:e}=l(),t=r(),n=m(),{project:a,loading:o}=h(),s=g(),[c,u]=(0,V.useState)(a?.id);(0,V.useEffect)(()=>u(a?.id),[a?.id]);let d=Ee(),p=De(n.data,d),_=p.find(t=>t.id===e);if(!_)return e===`build`?(0,H.jsx)(f,{to:`/settings/integrate`,replace:!0}):d.status===`ready`?(0,H.jsx)(f,{to:`/settings/project`,replace:!0}):null;let v=_.id===`connectors`&&s;return(0,H.jsxs)(`div`,{className:`animate-rise`,children:[(0,H.jsx)(`h1`,{className:`font-display font-semibold text-[28px] tracking-tight`,children:R(`settings.title`)}),(0,H.jsxs)(`div`,{className:`mt-6 grid gap-6 md:mt-8 md:grid-cols-[200px_minmax(0,1fr)] md:gap-10`,children:[(0,H.jsx)(`nav`,{className:`max-md:hidden`,children:(0,H.jsx)(`ul`,{className:`sticky top-24 flex flex-col gap-0.5`,children:p.map(e=>(0,H.jsx)(`li`,{children:(0,H.jsx)(i,{to:`/settings/${e.id}`,"aria-current":e.id===_.id?`page`:void 0,className:A(`block rounded-lg px-3 py-2 text-[14px] transition`,e.id===_.id?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:bg-accent hover:text-ink`),children:e.label})},e.id))})}),(0,H.jsx)(we,{className:`md:hidden`,value:_.id,onChange:e=>t(`/settings/${e}`),options:p.map(e=>({value:e.id,label:e.label}))}),(0,H.jsxs)(`div`,{className:A(`min-w-0`,_.id!==`project`&&_.id!==`integrate`&&`max-w-2xl`),children:[v?(0,H.jsx)(`div`,{className:`mb-6`,children:(0,H.jsx)(Ne,{})}):null,_.id===`project`&&a?(0,H.jsx)(Ln,{project:a},c):null,_.id===`connectors`&&a?(0,H.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[a.readOnly?(0,H.jsx)(Ht,{children:Vt(a)}):null,(0,H.jsx)(kt,{projectId:a.id,readOnly:a.readOnly},c),(0,H.jsx)(zn,{project:a},c)]}):null,(_.id===`project`||_.id===`connectors`)&&!a&&!o?(0,H.jsx)(xe,{children:R(`settings.noProject`)}):null,_.id===`models`?(0,H.jsx)(Me,{}):null,_.id===`integrate`?(0,H.jsx)(Bt,{}):null,_.id===`account`&&n.data?(0,H.jsx)(wt,{me:n.data}):null,_.id===`plugins`?(0,H.jsx)(ft,{}):null,_.plugin?(0,H.jsx)(Oe,{of:_.plugin,children:(0,H.jsx)(_.plugin.component,{})}):null]})]})]})}export{Bn as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,_ as i,d as a,j as o,m as s,n as c,nt as l}from"./api-9sHuNTkp.js";import{d as u,l as d}from"./session-CJGuo1Tv.js";import{t as ee}from"./arrow-left-hTN1VoH1.js";import{t as f}from"./arrow-right-6FyN3e7D.js";import{t as p}from"./check-CUpby_J9.js";import{p as te}from"./definition-DndaH5Ow.js";import{h as m,t as ne,y as h}from"./ui-iTYHqwvY.js";import{a as g}from"./index-VsRgvimv.js";import{a as _,i as v,n as y,o as re,r as b}from"./LocalRuntime-Brkvbzzg.js";var x=e(t(),1),S=e(n(),1),C=`oklch(50% 0.2 262)`,w=`oklch(32% 0.15 262)`,T=`oklch(90% 0.1 80)`,E=`oklch(88% 0.17 150)`,D=`oklch(88% 0.14 80)`,O=`rgb(255 255 255 / 0.38)`,ie={"--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)`},k=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,ae=220,oe={codex:`dome`,claude:`oval`,gemini:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`},se=`oklch(27% 0.09 150)`,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,S.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,S.jsx)(i,{size:28}),(0,S.jsxs)(`span`,{className:`font-display font-semibold text-[17px] tracking-tight`,children:[`engenty`,(0,S.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em]`,style:{color:T},children:`.`}),(0,S.jsx)(`span`,{className:`font-normal text-white/70`,children:`wizards`})]})]})}function R({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,S.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:m(`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-white shadow-elevated`:`bg-white/10 ring-1 ring-white/15 hover:bg-white/15`),style:e?{color:w}:void 0,children:[r?(0,S.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[11px] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:T,color:w},children:r}):null,(0,S.jsx)(`span`,{className:m(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent`:`border-white/40`),style:e?{background:w}:void 0,children:e?(0,S.jsx)(p,{className:`size-3.5 text-white`}):null}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`span`,{className:`block font-medium text-[15px]`,children:t}),(0,S.jsx)(`span`,{className:m(`mt-0.5 block truncate text-[13px]`,e?`opacity-70`:`text-white/65`),children:n})]}),i?(0,S.jsx)(`span`,{className:m(`shrink-0 text-[12px]`,e?`opacity-70`:`text-white/65`),children:i}):null,(0,S.jsx)(f,{className:m(`size-4 shrink-0 transition`,e?`opacity-70`:`text-white/40 group-hover:translate-x-0.5 group-hover:text-white/80`)})]})}function z({name:e,at:t,done:n}){let r=[h(`setup.stage.connect`),h(`setup.stage.test`),h(`setup.stage.done`)],i=n?r.length:t+1;return(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[12px] uppercase tracking-[0.14em]`,children:[(0,S.jsx)(`span`,{className:`text-white/70`,children:e}),(0,S.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,S.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?E:r===t?D:O},children:[i?(0,S.jsx)(p,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,S.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?E:D:`rgb(255 255 255 / 0.22)`}},e))})]})}function B({href:e,children:t}){return(0,S.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-white`,onClick:t=>{t.preventDefault(),b(e)},children:t})}function V(){s(C);let e=d(),t=l(),n=r(),i=o({queryKey:[`config`],queryFn:()=>c.get(`/api/config`)}),[f,b]=(0,x.useState)(F),[D,O]=(0,x.useState)(!1),P=u({mutationFn:e=>c.put(`/api/studio/local/models`,{source:e}),onSuccess:async(e,n)=>{await t.invalidateQueries({queryKey:[`me`]}),b(!0),O(!1),N(),I(n===`own`)}}),V=u({mutationFn:()=>Promise.all((e.data?.harnesses??[]).map(e=>c.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})});if(!e.data?.models)return null;let H=e.data.models,U=e=>(e.version===null?2:0)+ +!e.app,W=[...e.data.harnesses].sort((e,t)=>U(e)-U(t)),G=W.filter(e=>e.version!==null),K=f||e.data.setupDone||H.source!==`own`?H.source:null,q=e.data.harnesses.find(e=>e.id===K),J=e.data.setupDone,Y=Object.values(H.keys).some(Boolean),ce=J?2:q?q.auth===`none`?0:1:+!!Y,X=J?h(`setup.h.done`):q?q.version===null?h(`setup.h.install`,{name:q.name}):q.auth===`none`?h(`setup.h.signIn`,{name:q.name}):h(`setup.h.test`):h(Y?`setup.h.test`:`setup.h.keys`),Z=re.site?i.data?.site:null,Q=K!==null&&!D,$=P.isPending?P.variables??K:K;return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-white sm:px-10`,style:ie,children:[(0,S.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,S.jsx)(L,{}),(0,S.jsx)(g,{ink:w})]}),(0,S.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,S.jsx)(`div`,{"aria-hidden":`true`,className:m(`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,S.jsx)(`div`,{className:`animate-rise`,children:(0,S.jsx)(a,{kind:`drop`,size:ae,fluffy:!0,coat:`fur`})})}),(0,S.jsx)(`div`,{"aria-hidden":`true`,className:m(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,k,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,children:[(0,S.jsxs)(`section`,{className:m(`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,S.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,S.jsx)(`p`,{className:m(A,`font-medium text-[12px] text-white/70 uppercase tracking-[0.16em]`,K?M:j),children:h(`setup.title`)}),(0,S.jsx)(`h1`,{className:m(A,`mt-2 font-display font-semibold text-[26px] leading-[1.08] tracking-[-0.02em] sm:text-[28px]`,K?M:j),children:h(`setup.source`)}),(0,S.jsx)(`p`,{className:m(A,`mt-2.5 text-[15px] text-white/75 leading-relaxed`,K?M:j),children:h(`setup.sub`)})]}),(0,S.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[W.map((e,t)=>(0,S.jsx)(R,{selected:$===e.id,title:e.name,description:h(`harness.desc.${e.id}`),badge:t===0?h(`setup.recommended`):void 0,note:e.version===null?h(`harness.notInstalled`):e.auth===`subscription`?h(`harness.ready`):void 0,onPick:()=>P.mutate(e.id)},e.id)),(0,S.jsx)(R,{selected:$===`own`,title:h(`local.sourceOwn`),description:h(`setup.ownDesc`),onPick:()=>P.mutate(`own`)})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-[13px] text-white/60`,children:[(0,S.jsx)(`span`,{children:G.length?null:h(`setup.noHarness`)}),(0,S.jsxs)(ne,{variant:`ghost`,size:`sm`,busy:V.isPending,onClick:()=>V.mutate(),children:[(0,S.jsx)(te,{className:`size-3.5`}),` `,h(`local.recheck`)]})]})]}),K?(0,S.jsxs)(`section`,{className:m(`min-w-0 flex-1 animate-settle`,D?`max-lg:hidden`:``),children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{O(!0),N()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-[14px] text-white/80 transition hover:text-white lg:hidden`,children:[(0,S.jsx)(ee,{className:`size-4`}),` `,h(`run.back`)]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,S.jsx)(a,{kind:oe[K],size:120,fluffy:!0,coat:`fur`})}),(0,S.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,S.jsx)(z,{name:q?.name??h(`local.sourceOwn`),at:ce,done:J}),(0,S.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,S.jsx)(`div`,{className:`mt-5 rounded-2xl bg-white/[0.07] p-5 ring-1 ring-white/12 sm:p-6`,children:q?(0,S.jsx)(v,{me:e.data,id:q.id,autoTest:!J}):(0,S.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,S.jsx)(y,{models:H}),(0,S.jsx)(_,{})]})}),(0,S.jsxs)(`div`,{className:`mt-9`,children:[J?(0,S.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[15px]`,style:{color:E},children:[(0,S.jsx)(p,{className:`size-4`,strokeWidth:3}),h(`setup.ready`)]}):null,(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,S.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>n(`/`,{replace:!0}),className:m(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[16px] 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-white/20 text-white/65`),style:J?{background:E,color:se}:void 0,children:[h(`setup.done`),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,S.jsx)(`span`,{className:`text-[13px] text-white/65`,children:h(`setup.untilWorks`)})]})]})]})]},K):null]})]}),(0,S.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-[12px] text-white/55 sm:pb-8`,children:[(0,S.jsxs)(`span`,{children:[`© `,new Date().getFullYear(),` engenty · `,h(`setup.local`)]}),(0,S.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,S.jsx)(B,{href:Z,children:new URL(Z).host}):null,(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px]`,style:{background:T}})]})]})]})}export{V as SetupPage};
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,_ as i,d as a,j as o,m as s,n as c,nt as l}from"./api-BTfKh3La.js";import{d as u,l as d}from"./session-D_Zggq_t.js";import{t as ee}from"./arrow-left-hTN1VoH1.js";import{t as f}from"./arrow-right-6FyN3e7D.js";import{t as p}from"./check-CUpby_J9.js";import{p as te}from"./definition-DndaH5Ow.js";import{h as m,t as ne,y as h}from"./ui-C3bTWmdM.js";import{a as g}from"./index-DOpyzQiU.js";import{a as _,i as v,n as y,o as re,r as b}from"./LocalRuntime-BjzPSsHr.js";var x=e(t(),1),S=e(n(),1),C=`oklch(50% 0.2 262)`,w=`oklch(32% 0.15 262)`,T=`oklch(90% 0.1 80)`,E=`oklch(88% 0.17 150)`,D=`oklch(88% 0.14 80)`,O=`rgb(255 255 255 / 0.38)`,ie={"--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)`},k=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,ae=220,oe={codex:`dome`,claude:`oval`,gemini:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`},se=`oklch(27% 0.09 150)`,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,S.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,S.jsx)(i,{size:28}),(0,S.jsxs)(`span`,{className:`font-display font-semibold text-[17px] tracking-tight`,children:[`engenty`,(0,S.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em]`,style:{color:T},children:`.`}),(0,S.jsx)(`span`,{className:`font-normal text-white/70`,children:`wizards`})]})]})}function R({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,S.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:m(`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-white shadow-elevated`:`bg-white/10 ring-1 ring-white/15 hover:bg-white/15`),style:e?{color:w}:void 0,children:[r?(0,S.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[11px] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:T,color:w},children:r}):null,(0,S.jsx)(`span`,{className:m(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent`:`border-white/40`),style:e?{background:w}:void 0,children:e?(0,S.jsx)(p,{className:`size-3.5 text-white`}):null}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`span`,{className:`block font-medium text-[15px]`,children:t}),(0,S.jsx)(`span`,{className:m(`mt-0.5 block truncate text-[13px]`,e?`opacity-70`:`text-white/65`),children:n})]}),i?(0,S.jsx)(`span`,{className:m(`shrink-0 text-[12px]`,e?`opacity-70`:`text-white/65`),children:i}):null,(0,S.jsx)(f,{className:m(`size-4 shrink-0 transition`,e?`opacity-70`:`text-white/40 group-hover:translate-x-0.5 group-hover:text-white/80`)})]})}function z({name:e,at:t,done:n}){let r=[h(`setup.stage.connect`),h(`setup.stage.test`),h(`setup.stage.done`)],i=n?r.length:t+1;return(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[12px] uppercase tracking-[0.14em]`,children:[(0,S.jsx)(`span`,{className:`text-white/70`,children:e}),(0,S.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,S.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?E:r===t?D:O},children:[i?(0,S.jsx)(p,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,S.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?E:D:`rgb(255 255 255 / 0.22)`}},e))})]})}function B({href:e,children:t}){return(0,S.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-white`,onClick:t=>{t.preventDefault(),b(e)},children:t})}function V(){s(C);let e=d(),t=l(),n=r(),i=o({queryKey:[`config`],queryFn:()=>c.get(`/api/config`)}),[f,b]=(0,x.useState)(F),[D,O]=(0,x.useState)(!1),P=u({mutationFn:e=>c.put(`/api/studio/local/models`,{source:e}),onSuccess:async(e,n)=>{await t.invalidateQueries({queryKey:[`me`]}),b(!0),O(!1),N(),I(n===`own`)}}),V=u({mutationFn:()=>Promise.all((e.data?.harnesses??[]).map(e=>c.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})});if(!e.data?.models)return null;let H=e.data.models,U=e=>(e.version===null?2:0)+ +!e.app,W=[...e.data.harnesses].sort((e,t)=>U(e)-U(t)),G=W.filter(e=>e.version!==null),K=f||e.data.setupDone||H.source!==`own`?H.source:null,q=e.data.harnesses.find(e=>e.id===K),J=e.data.setupDone,Y=Object.values(H.keys).some(Boolean),ce=J?2:q?q.auth===`none`?0:1:+!!Y,X=J?h(`setup.h.done`):q?q.version===null?h(`setup.h.install`,{name:q.name}):q.auth===`none`?h(`setup.h.signIn`,{name:q.name}):h(`setup.h.test`):h(Y?`setup.h.test`:`setup.h.keys`),Z=re.site?i.data?.site:null,Q=K!==null&&!D,$=P.isPending?P.variables??K:K;return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-white sm:px-10`,style:ie,children:[(0,S.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,S.jsx)(L,{}),(0,S.jsx)(g,{ink:w})]}),(0,S.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,S.jsx)(`div`,{"aria-hidden":`true`,className:m(`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,S.jsx)(`div`,{className:`animate-rise`,children:(0,S.jsx)(a,{kind:`drop`,size:ae,fluffy:!0,coat:`fur`})})}),(0,S.jsx)(`div`,{"aria-hidden":`true`,className:m(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,k,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,S.jsxs)(`div`,{className:`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,children:[(0,S.jsxs)(`section`,{className:m(`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,S.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,S.jsx)(`p`,{className:m(A,`font-medium text-[12px] text-white/70 uppercase tracking-[0.16em]`,K?M:j),children:h(`setup.title`)}),(0,S.jsx)(`h1`,{className:m(A,`mt-2 font-display font-semibold text-[26px] leading-[1.08] tracking-[-0.02em] sm:text-[28px]`,K?M:j),children:h(`setup.source`)}),(0,S.jsx)(`p`,{className:m(A,`mt-2.5 text-[15px] text-white/75 leading-relaxed`,K?M:j),children:h(`setup.sub`)})]}),(0,S.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[W.map((e,t)=>(0,S.jsx)(R,{selected:$===e.id,title:e.name,description:h(`harness.desc.${e.id}`),badge:t===0?h(`setup.recommended`):void 0,note:e.version===null?h(`harness.notInstalled`):e.auth===`subscription`?h(`harness.ready`):void 0,onPick:()=>P.mutate(e.id)},e.id)),(0,S.jsx)(R,{selected:$===`own`,title:h(`local.sourceOwn`),description:h(`setup.ownDesc`),onPick:()=>P.mutate(`own`)})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-[13px] text-white/60`,children:[(0,S.jsx)(`span`,{children:G.length?null:h(`setup.noHarness`)}),(0,S.jsxs)(ne,{variant:`ghost`,size:`sm`,busy:V.isPending,onClick:()=>V.mutate(),children:[(0,S.jsx)(te,{className:`size-3.5`}),` `,h(`local.recheck`)]})]})]}),K?(0,S.jsxs)(`section`,{className:m(`min-w-0 flex-1 animate-settle`,D?`max-lg:hidden`:``),children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{O(!0),N()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-[14px] text-white/80 transition hover:text-white lg:hidden`,children:[(0,S.jsx)(ee,{className:`size-4`}),` `,h(`run.back`)]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,S.jsx)(a,{kind:oe[K],size:120,fluffy:!0,coat:`fur`})}),(0,S.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,S.jsx)(z,{name:q?.name??h(`local.sourceOwn`),at:ce,done:J}),(0,S.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,S.jsx)(`div`,{className:`mt-5 rounded-2xl bg-white/[0.07] p-5 ring-1 ring-white/12 sm:p-6`,children:q?(0,S.jsx)(v,{me:e.data,id:q.id,autoTest:!J}):(0,S.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,S.jsx)(y,{models:H}),(0,S.jsx)(_,{})]})}),(0,S.jsxs)(`div`,{className:`mt-9`,children:[J?(0,S.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[15px]`,style:{color:E},children:[(0,S.jsx)(p,{className:`size-4`,strokeWidth:3}),h(`setup.ready`)]}):null,(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,S.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>n(`/`,{replace:!0}),className:m(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[16px] 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-white/20 text-white/65`),style:J?{background:E,color:se}:void 0,children:[h(`setup.done`),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,S.jsx)(`span`,{className:`text-[13px] text-white/65`,children:h(`setup.untilWorks`)})]})]})]})]},K):null]})]}),(0,S.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-[12px] text-white/55 sm:pb-8`,children:[(0,S.jsxs)(`span`,{children:[`© `,new Date().getFullYear(),` engenty · `,h(`setup.local`)]}),(0,S.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,S.jsx)(B,{href:Z,children:new URL(Z).host}):null,(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px]`,style:{background:T}})]})]})]})}export{V as SetupPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{a as r,d as i,h as a,j as o,k as s,l as c,n as l,r as u}from"./api-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{a as r,d as i,h as a,j as o,k as s,l as c,n as l,r as u}from"./api-BTfKh3La.js";import{t as d}from"./arrow-right-6FyN3e7D.js";import{i as f,t as p}from"./outputs-n_yhxmMk.js";import{_ as m,d as h,n as g,t as _,y as v}from"./ui-C3bTWmdM.js";import{BrandHeader as y,useBrandAccent as b}from"./PublicRunner-Dac_e6wg.js";var x=e(t(),1),S=e(n(),1);function C(){let{token:e}=s(),t=o({queryKey:[`share`,e],queryFn:()=>l.get(`/api/shares/${e}`),retry:(e,t)=>u(t)&&e<3});if(b(t.data?.brand.accent),a(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)(h,{})});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)(i,{kind:`pebble`,size:80}),(0,S.jsx)(`p`,{className:`max-w-sm text-ink-3`,children:v(u(t.error)?`common.offline`:`sharePage.gone`)}),u(t.error)?(0,S.jsx)(_,{variant:`secondary`,onClick:()=>void t.refetch(),children:v(`common.retry`)}):null]});let C=`/api/shares/${n.token}`,w=e=>new Intl.DateTimeFormat(m,{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)(i,{kind:n.wizard.avatar,size:64}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`p`,{className:`text-[13px] text-ink-4`,children:n.expiresAt?v(`sharePage.until`,{date:w(n.expiresAt)}):v(`sharePage.shared`,{date:w(n.createdAt)})}),(0,S.jsx)(`h1`,{className:`font-display font-semibold text-[28px] leading-tight tracking-tight sm:text-[32px]`,children:n.title}),n.message?(0,S.jsx)(`p`,{className:`mt-1 text-[15px] 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)(g,{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-[17px]`,children:r??e.title}),(0,S.jsx)(p,{base:C,stepId:e.id,formats:n,title:r??e.title})]}),(0,S.jsx)(f,{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)(i,{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-[16px]`,children:n.wizard.title}),n.wizard.description?(0,S.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:n.wizard.description}):null]}),(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-[14px] text-ember-strong`,children:[v(`sharePage.own`),` `,(0,S.jsx)(d,{className:`size-4`})]})]}):null]}),(0,S.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[12px] text-ink-4`,children:(0,S.jsx)(`a`,{href:`${r}/`,className:`inline-block py-3.5 hover:text-ink-2`,children:v(`run.madeWith`).replace(`engenty wizards`,c.name)})})]})}export{C as SharePage};
|