wizards 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/runtime/dist/agents/project-assistant.js +3 -3
- package/apps/web/dist/assets/Account-DLLeEwJL.js +1 -0
- package/apps/web/dist/assets/{ChangelogDialog-Bj4bclMv.js → ChangelogDialog-DEfZRDK3.js} +1 -1
- package/apps/web/dist/assets/ChatPanel-CNiFyu_w.js +1 -0
- package/apps/web/dist/assets/{CreditsDialog-Dn7uevkp.js → CreditsDialog-CUvc2iPM.js} +1 -1
- package/apps/web/dist/assets/EditorPage-CZuCz7lB.js +2 -0
- package/apps/web/dist/assets/{FlowPreview-Cx8WOBr7.js → FlowPreview-BC25OUH0.js} +1 -1
- package/apps/web/dist/assets/HomePage-DQKuhMFZ.js +1 -0
- package/apps/web/dist/assets/{ImportWizard-B1kfyd-n.js → ImportWizard-BockXJXm.js} +1 -1
- package/apps/web/dist/assets/{LocalRuntime-DwCJawPW.js → LocalRuntime-C199bg_B.js} +1 -1
- package/apps/web/dist/assets/NewWizardPage-C4cde8FO.js +2 -0
- package/apps/web/dist/assets/ProjectPage-DJC1K4w_.js +2 -0
- package/apps/web/dist/assets/{PublicRunner-D3uBfK35.js → PublicRunner-BCrmXPkr.js} +1 -1
- package/apps/web/dist/assets/ReadOnly-CvmN9XW4.js +1 -0
- package/apps/web/dist/assets/RunnerView-CCe8-k9Q.js +2 -0
- package/apps/web/dist/assets/SettingsPage-BuocMkLt.js +1 -0
- package/apps/web/dist/assets/{SetupPage-DyC2so9b.js → SetupPage-o6Jim2Pu.js} +1 -1
- package/apps/web/dist/assets/{SharePage-CWM_8lGl.js → SharePage-BqwqI3Ga.js} +1 -1
- package/apps/web/dist/assets/{api-C7nO5qT8.js → api-Bf-l9Sd8.js} +1 -1
- package/apps/web/dist/assets/changelog-CFeEzKqb.js +1 -0
- package/apps/web/dist/assets/chevron-down-DymW-2BP.js +1 -0
- package/apps/web/dist/assets/globe-ffVj8XwO.js +1 -0
- package/apps/web/dist/assets/index-B8n2AYO0.css +1 -0
- package/apps/web/dist/assets/index-BR5ELbeZ.js +10 -0
- package/apps/web/dist/assets/lock-CzNXAYdi.js +1 -0
- package/apps/web/dist/assets/meta-CKE9QceT.js +1 -0
- package/apps/web/dist/assets/outputs-CsESg-Eg.js +69 -0
- package/apps/web/dist/assets/{session-C44_g_hY.js → session-C7LDDcj7.js} +1 -1
- package/apps/web/dist/assets/trash-0IafyhZB.js +1 -0
- package/apps/web/dist/assets/type-BqbppSsp.js +1 -0
- package/apps/web/dist/assets/ui-BT0Y_Hci.js +1 -0
- package/apps/web/dist/assets/wand-sparkles-Clj3VRB5.js +1 -0
- package/apps/web/dist/index.html +5 -6
- package/apps/web/dist/mcp/flow.html +2 -2
- package/package.json +1 -1
- package/apps/web/dist/assets/Account-knfyfyOq.js +0 -1
- package/apps/web/dist/assets/ChatPanel-Dnpk2feK.js +0 -1
- package/apps/web/dist/assets/EditorPage-Q4ogvKEI.js +0 -2
- package/apps/web/dist/assets/HomePage-C29lUDnZ.js +0 -1
- package/apps/web/dist/assets/NewWizardPage-GNxcj0KW.js +0 -2
- package/apps/web/dist/assets/RunnerView-B8QFy6Sw.js +0 -2
- package/apps/web/dist/assets/SettingsPage-DAkSf8E6.js +0 -2
- package/apps/web/dist/assets/changelog-C257tJV1.js +0 -1
- package/apps/web/dist/assets/index-Dp8RnbHf.js +0 -10
- package/apps/web/dist/assets/index-mpjxO44v.css +0 -1
- package/apps/web/dist/assets/meta-DWFege7H.js +0 -1
- package/apps/web/dist/assets/outputs-Cy_I6D0i.js +0 -69
- package/apps/web/dist/assets/plug-CLjyCoHB.js +0 -1
- package/apps/web/dist/assets/type-DnfgUhpM.js +0 -1
- package/apps/web/dist/assets/ui-BHAxG0j4.js +0 -1
- package/apps/web/dist/assets/wand-sparkles-CKxArWPY.js +0 -1
|
@@ -11,12 +11,12 @@ import { brandColorSchema, ownedProject, updateProject } from "../services/proje
|
|
|
11
11
|
import { safeFetch } from "../tools/net-guard.js";
|
|
12
12
|
import { readWebsite } from "./website.js";
|
|
13
13
|
const MAX_STEPS = 24;
|
|
14
|
-
const SYSTEM = `You help the admin of "engenty wizards" set up a
|
|
14
|
+
const SYSTEM = `You help the admin of "engenty wizards" set up a SPACE: what every wizard of the space draws on — who they are (title, about), the brand (logos, colours), assets (images, graphics, videos), documents, and facts (label → value: address, VAT id, phone, opening hours — anything).
|
|
15
15
|
|
|
16
|
-
You talk to the admin. Answer in the admin's language, briefly and warmly. Never mention JSON, ids, keys or tool names.
|
|
16
|
+
You talk to the admin. Answer in the admin's language, briefly and warmly. Never mention JSON, ids, keys or tool names. Call it a space (German „Space“), never a project: the tools say project, the app says space.
|
|
17
17
|
|
|
18
18
|
HOW YOU WORK
|
|
19
|
-
- The
|
|
19
|
+
- The space as it is now comes with every message. You change it ONLY through tools.
|
|
20
20
|
- A website: read_website it first. You get the page's text, colours from its stylesheet, logo candidates and the links to imprint / contact / about. Read those pages too (at most four more) for address, VAT id, register number, phone, email, bank details, who runs it.
|
|
21
21
|
- Facts: one fact per thing, a short label in the admin's language ("Adresse", "UID", "Telefon"), the value on one line where it fits. Only what a source or the admin states — never guess, never invent. Keep the facts that are there; a fact with a known label is updated.
|
|
22
22
|
- About: two to five sentences — what they do, for whom, what sets them apart, the tone they write in. Rewrite it only when you learned something new or the admin asks.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,j as i,n as a,nt as o}from"./api-Bf-l9Sd8.js";import{f as s,t as c}from"./session-C7LDDcj7.js";import{t as l}from"./createLucideIcon-q3MZMmnf.js";import{t as u}from"./check-CUpby_J9.js";import{n as d,r as f}from"./upload-DNRENWzQ.js";import{t as p}from"./external-link-MAL7vJYj.js";import{_ as m,c as h,d as g,h as _,m as ee,n as v,o as y,r as b,s as x,t as S,y as C}from"./ui-BT0Y_Hci.js";import{_ as w,b as T,c as E,d as D,i as O,u as k}from"./index-BR5ELbeZ.js";import{r as A}from"./LocalRuntime-C199bg_B.js";var j={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};j.node;var M=l(j),N={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};N.node;var P=l(N),F={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};F.node;var I=l(F),L=e(t(),1),R=e=>[`project-files`,e];function z(e){return i({queryKey:R(e),queryFn:()=>a.get(`/api/studio/projects/${e}/files`),refetchInterval:e=>e.state.data?.files.some(e=>e.status===`pending`)?2e3:!1})}function B(e,t){return r(`/api/studio/projects/${e}/files/${t}/content`)}function V(e,t=!1){let n=o(),[r,i]=(0,L.useState)(!1),[s,c]=(0,L.useState)(null),l=()=>n.invalidateQueries({queryKey:R(e)}),u=async e=>{c(null);try{await e()}catch(e){c(e.message)}finally{await l()}};return{busy:r,error:s,readOnly:t,upload:async(t,n)=>{i(!0),await u(async()=>{for(let r of n)await a.upload(`/api/studio/projects/${e}/files?kind=${t}`,r),await l()}),i(!1)},describe:(t,n)=>u(()=>a.patch(`/api/studio/projects/${e}/files/${t}`,{description:n})),remove:t=>u(()=>a.del(`/api/studio/projects/${e}/files/${t}`)),reindex:t=>u(()=>a.post(`/api/studio/projects/${e}/files/${t}/reindex`)),order:(t,n)=>u(()=>a.put(`/api/studio/projects/${e}/files/order`,{kind:t,ids:n}))}}function H(e,t){let n=`wz.layout.${e}`,[r,i]=(0,L.useState)(()=>{try{let e=localStorage.getItem(n);return e===`list`||e===`cards`?e:t}catch{return t}});return[r,()=>i(e=>{let t=e===`list`?`cards`:`list`;try{localStorage.setItem(n,t)}catch{}return t})]}function U(e,t,n=700){let[r,i]=(0,L.useState)(`idle`),[a,o]=(0,L.useState)(null),s=JSON.stringify(e),c=(0,L.useRef)(s),l=(0,L.useRef)({value:e,json:s,save:t});l.current={value:e,json:s,save:t};let u=(0,L.useRef)(Promise.resolve()),d=(0,L.useCallback)(()=>{let e=l.current;e.json!==c.current&&(c.current=e.json,i(`saving`),u.current=u.current.then(async()=>{try{await e.save(e.value),o(null),i(`saved`)}catch(e){c.current=``,o(e.message),i(`error`)}}))},[]);return(0,L.useEffect)(()=>{if(s===c.current)return;let e=setTimeout(d,n);return()=>clearTimeout(e)},[s,n,d]),(0,L.useEffect)(()=>d,[d]),{state:r,error:a}}function W(e){return e<1e6?`${Math.max(1,Math.round(e/1e3))} KB`:`${(e/1e6).toFixed(1)} MB`}var G=e(n(),1);function K({title:e,hint:t,save:n,action:r,locked:i,children:a}){return(0,G.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-1`,children:[(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),n?.state===`saving`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,G.jsx)(g,{className:`size-3`}),` `,C(`project.saving`)]}):n?.state===`saved`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[12px] text-moss`,children:[(0,G.jsx)(u,{className:`size-3.5`}),` `,C(`settings.saved`)]}):null]}),t?(0,G.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-snug`,children:t}):null]}),r?(0,G.jsx)(`div`,{className:`shrink-0`,children:r}):null]}),(0,G.jsxs)(v,{className:`p-5`,children:[i?(0,G.jsx)(`fieldset`,{disabled:!0,className:`min-w-0`,children:a}):a,n?.state===`error`&&n.error?(0,G.jsx)(`p`,{className:`mt-4 text-[14px] text-rose`,children:n.error}):null]})]})}function q({children:e,layout:t,onToggle:n}){return(0,G.jsxs)(`div`,{className:`mb-3 flex items-start gap-2`,children:[(0,G.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,G.jsx)(`div`,{className:`w-56 max-w-full transition-[width] duration-200 focus-within:w-full has-[input:not(:placeholder-shown)]:w-full`,children:e})}),(0,G.jsx)(y,{label:C(t===`list`?`project.viewCards`:`project.viewList`),onClick:n,children:t===`list`?(0,G.jsx)(P,{className:`size-4`}):(0,G.jsx)(I,{className:`size-4`})})]})}function J({value:e,onChange:t,onEnter:n,placeholder:r,busy:i}){return(0,G.jsxs)(`div`,{className:`relative`,children:[(0,G.jsx)(d,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-4`}),(0,G.jsx)(`input`,{type:`search`,value:e,placeholder:r,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n?.(),className:`h-9 w-full rounded-lg border border-input bg-card pr-3 pl-9 text-[14px] text-ink outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow`}),i?(0,G.jsx)(g,{className:`-translate-y-1/2 absolute top-1/2 right-3 size-4 text-ink-3`}):null]})}function Y({onFiles:e,accept:t,multiple:n=!0,className:r,children:i}){return(0,G.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),e.currentTarget.dataset.over=`1`},onDragLeave:e=>{delete e.currentTarget.dataset.over},onDrop:t=>{t.preventDefault(),delete t.currentTarget.dataset.over;let r=Array.from(t.dataTransfer.files);r.length&&e(n?r:r.slice(0,1))},className:_(`flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-input border-dashed text-[14px] text-ink-3 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow hover:border-ink-4 hover:text-ink data-[over]:border-focus data-[over]:bg-paper-2 data-[over]:text-ink`,r),children:[i,(0,G.jsx)(`input`,{className:`sr-only`,type:`file`,accept:t,multiple:n,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length&&e(n)}})]})}var X=`mt-1.5 text-[13px] text-ink-3`;function Z(e){let t=o(),[n,r]=(0,L.useState)(!1),i=s({mutationFn:e=>a.post(`/api/studio/account/link`,e),onSuccess:({url:e})=>{A(e),r(!0)}});return(0,L.useEffect)(()=>{if(!n)return;let e=setInterval(()=>void t.invalidateQueries({queryKey:[`me`]}),2e3),i=setTimeout(()=>r(!1),3e5);return()=>{clearInterval(e),clearTimeout(i)}},[n,t]),(0,L.useEffect)(()=>{e&&r(!1)},[e]),{link:i,waiting:n}}function Q({link:e,waiting:t}){return e.isError?(0,G.jsx)(`p`,{className:`text-[13px] text-rose`,children:C(`local.accountFailed`)}):t?(0,G.jsxs)(`p`,{className:`flex items-center gap-2 text-[13px] text-ink-3`,children:[(0,G.jsx)(g,{className:`size-3.5`}),` `,C(`local.accountWaiting`)]}):null}function te(){let e=Z(!1),{link:t}=e,[n,r]=(0,L.useState)(``);return(0,G.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-4 py-5 first:pt-0 last:pb-0`,children:[(0,G.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2`,children:(0,G.jsx)(M,{className:`size-5`})}),(0,G.jsxs)(`div`,{className:`min-w-0`,children:[(0,G.jsx)(`div`,{className:`font-medium text-[15px]`,children:C(`account.local`)}),(0,G.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-relaxed`,children:C(`account.localText`)})]})]}),D.account?(0,G.jsxs)(`div`,{className:`flex flex-col gap-4 py-5 last:pb-0`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-medium text-[15px]`,children:C(`account.with`)}),(0,G.jsxs)(`ul`,{className:`mt-2 flex flex-col gap-2 text-[14px] text-ink-2 leading-snug`,children:[(0,G.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,G.jsx)(f,{className:`mt-0.5 size-4 shrink-0 text-amber`}),C(`account.withCredits`)]}),(0,G.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,G.jsx)(T,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),C(`account.withCloud`)]})]})]}),(0,G.jsx)(`div`,{children:(0,G.jsx)(S,{busy:t.isPending&&!t.variables?.signup,onClick:()=>t.mutate({}),children:C(`account.signIn`)})})]}):null,D.account?(0,G.jsxs)(`form`,{className:`flex flex-col gap-3 py-5 last:pb-0`,onSubmit:e=>{e.preventDefault(),t.mutate({signup:!0,code:n.trim()||void 0})},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`font-medium text-[15px]`,children:C(`account.new`)}),(0,G.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-3 leading-relaxed`,children:C(`account.newHint`)})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,G.jsx)(x,{value:n,maxLength:64,autoComplete:`off`,spellCheck:!1,placeholder:C(`account.code`),"aria-label":C(`account.code`),onChange:e=>r(e.target.value),className:`w-56 font-mono text-[14px]`}),(0,G.jsx)(S,{type:`submit`,variant:`secondary`,className:`h-11`,busy:t.isPending&&!!t.variables?.signup,children:C(`account.create`)})]}),(0,G.jsx)(Q,{...e})]}):null]})}var $={start:`account.kind.start`,monthly:`account.kind.monthly`,gift:`account.kind.gift`};function ne({account:e}){let t=o(),n=Z(e.signedIn),r=s({mutationFn:()=>a.del(`/api/studio/account`),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})}),i=new Intl.DateTimeFormat(m,{dateStyle:`medium`});return(0,G.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 py-5 first:pt-0`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-[15px]`,children:e.name||e.email}),e.signedIn?(0,G.jsx)(b,{tone:`live`,children:C(`account.linked`)}):null]}),(0,G.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:e.email})]}),(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsxs)(S,{variant:`secondary`,onClick:()=>A(e.url),children:[C(`setup.openAccount`),` `,(0,G.jsx)(p,{className:`size-4`})]}),(0,G.jsxs)(S,{variant:`ghost`,busy:r.isPending,onClick:()=>r.mutate(),children:[(0,G.jsx)(w,{className:`size-4`}),` `,C(`nav.logout`)]})]})]}),e.signedIn?null:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3 py-5`,children:[(0,G.jsx)(`p`,{className:`text-[14px] text-ink-2`,children:C(`local.accountExpired`)}),(0,G.jsx)(`div`,{children:(0,G.jsx)(S,{busy:n.link.isPending,onClick:()=>n.link.mutate({}),children:C(`account.signInAgain`)})}),(0,G.jsx)(Q,{...n})]}),e.credits===null?null:(0,G.jsxs)(`div`,{className:`py-5`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-[13px] text-ink-3`,children:C(`account.credits`)}),(0,G.jsx)(`div`,{className:`font-display font-semibold text-[22px] tabular-nums leading-tight`,children:C(`nav.credits`,{n:Math.floor(e.credits).toLocaleString()})})]}),(0,G.jsxs)(S,{variant:`secondary`,onClick:()=>A(`${e.url}/billing`),children:[C(`account.topUp`),` `,(0,G.jsx)(p,{className:`size-4`})]})]}),e.expiring.length?(0,G.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1 text-[13px] text-ink-3 tabular-nums`,children:e.expiring.map(e=>(0,G.jsxs)(`li`,{children:[C(`account.expires`,{n:Math.floor(e.credits).toLocaleString(),date:i.format(new Date(e.expiresAt))}),$[e.kind]?(0,G.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,C($[e.kind])]}):null]},`${e.kind}:${e.expiresAt}`))}):null]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2.5 py-5 text-[14px] text-ink-2 leading-snug last:pb-0`,children:[(0,G.jsx)(T,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),(0,G.jsx)(`p`,{children:C(`account.cloud`,{host:O(e.cloudUrl)})})]})]})}function re({me:e,fromAccount:t}){let n=o(),[r,i]=(0,L.useState)(e.profile),s=e=>i(t=>({...t,...e})),l=U(r,async e=>{await a.put(`/api/studio/profile`,e),await n.invalidateQueries({queryKey:[`me`]})});return(0,G.jsx)(K,{title:C(`account.profile`),hint:C(`account.hint`),save:l,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[(0,G.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 sm:w-32`,children:[(0,G.jsx)(`div`,{className:`flex size-20 items-center justify-center overflow-hidden rounded-full bg-ember-tint font-semibold text-[28px] text-ember-strong ring-1 ring-border-soft`,children:e.user.image?(0,G.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full object-cover`}):c(r.name)||`?`}),(0,G.jsx)(`p`,{className:`text-center text-[12px] text-ink-3 leading-snug`,children:C(`account.initials`)})]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(h,{children:C(`account.name`)}),(0,G.jsx)(x,{value:r.name,maxLength:80,disabled:t,onChange:e=>s({name:e.target.value})}),(0,G.jsx)(`p`,{className:X,children:C(t?`account.fromAccount`:`account.nameHint`)})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(h,{children:C(`account.about`)}),(0,G.jsx)(ee,{minRows:3,maxLength:2e3,value:r.about,onChange:e=>s({about:e.target.value})}),(0,G.jsx)(`p`,{className:X,children:C(`account.aboutHint`)})]}),(0,G.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(h,{children:C(`account.email`)}),(0,G.jsx)(x,{type:`email`,value:r.email,maxLength:200,disabled:t,onChange:e=>s({email:e.target.value})})]}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(h,{children:C(`account.phone`)}),(0,G.jsx)(x,{type:`tel`,value:r.phone,maxLength:40,onChange:e=>s({phone:e.target.value})})]})]})]})]})})}function ie({me:e}){let t=e.mode===`managed`,n=t||!!e.account;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,G.jsx)(K,{title:C(`account.connection`),hint:C(`account.connectionHint`),children:t?(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`truncate font-medium text-[15px]`,children:e.user.name}),(0,G.jsx)(b,{tone:`live`,children:C(`account.linked`)})]}),(0,G.jsx)(`div`,{className:`truncate text-[14px] text-ink-3`,children:e.user.email})]}),e.manageUrl?(0,G.jsxs)(S,{variant:`secondary`,onClick:()=>A(`${e.manageUrl}/account`),children:[C(`setup.openAccount`),` `,(0,G.jsx)(p,{className:`size-4`})]}):null]}):e.account?(0,G.jsx)(ne,{account:e.account}):(0,G.jsx)(te,{})}),(0,G.jsx)(re,{me:e,fromAccount:n},n?`account`:`own`),(0,G.jsx)(K,{title:C(`account.look`),hint:C(`account.lookHint`),children:(0,G.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pb-4`,children:[(0,G.jsx)(`span`,{className:`font-medium text-[14px]`,children:C(`nav.language`)}),(0,G.jsx)(k,{tone:`surface`})]}),(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-4`,children:[(0,G.jsx)(`span`,{className:`font-medium text-[14px]`,children:C(`nav.theme`)}),(0,G.jsx)(E,{})]})]})})]})}export{q as a,W as c,V as d,H as f,Y as i,B as l,Q as n,J as o,z as p,Z as r,K as s,ie as t,U as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{a as i,d as a,h as o,i as s,s as c,y as l}from"./ui-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{a as i,d as a,h as o,i as s,s as c,y as l}from"./ui-BT0Y_Hci.js";var u=e(t(),1),d=e(n(),1);function f(e){switch(e.group){case`Added`:return{label:`NEW`,dot:`bg-moss`};case`Fixed`:return{label:`FIXED`,dot:`bg-amber`};case`Changed`:return{label:`CHANGED`,dot:`bg-cobalt`};case`Performance`:return{label:`PERFORMANCE`,dot:`bg-ember`};case`Deploy`:return{label:`DEPLOY`,dot:`bg-ink-4`};case`Docs`:return{label:`DOCS`,dot:`bg-ink-4`};default:return{label:`OTHER`,dot:`bg-ink-4`}}}var p=e=>e.version?e.version.replace(/^v/,``):l(`about.unreleased`),m=e=>e.timestamp?new Date(e.timestamp*1e3).toISOString().slice(0,10):``,h=e=>e.charAt(0).toUpperCase()+e.slice(1);function g(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=[];for(let t of e){if(`${p(t)} ${m(t)}`.toLowerCase().includes(n)){r.push(t);continue}let e=t.commits.filter(e=>`${f(e).label} ${e.scope??``} ${e.message}`.toLowerCase().includes(n));e.length>0&&r.push({...t,commits:e})}return r}function _({open:e,onClose:t}){let[n,_]=(0,u.useState)(null),[v,y]=(0,u.useState)(``);(0,u.useEffect)(()=>{if(!e||n)return;let t=!1;return r(()=>import(`./changelog-CFeEzKqb.js`).then(e=>{t||_(e.default)}),[]),()=>{t=!0}},[e,n]),(0,u.useEffect)(()=>{e||y(``)},[e]);let b=n?g(n,v):[];return(0,d.jsxs)(s,{open:e,onClose:t,title:l(`about.changelog`),wide:!0,children:[(0,d.jsx)(`p`,{className:`-mt-3 mb-4 text-[14px] text-ink-3`,children:l(`about.changelogHint`)}),n===null?(0,d.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,d.jsx)(a,{})}):n.length===0?(0,d.jsx)(i,{children:l(`about.changelogEmpty`)}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(c,{type:`search`,value:v,placeholder:l(`about.search`),onChange:e=>y(e.target.value)}),b.length===0?(0,d.jsx)(i,{children:l(`about.noMatches`)}):null,b.map(e=>(0,d.jsxs)(`section`,{className:`mt-6`,children:[(0,d.jsxs)(`h3`,{className:`flex items-baseline gap-3 border-border-soft border-b pb-2 font-display font-semibold text-[16px]`,children:[p(e),(0,d.jsx)(`span`,{className:`font-normal font-sans text-[13px] text-ink-3 tabular-nums`,children:m(e)})]}),(0,d.jsx)(`ul`,{className:`mt-3 flex flex-col gap-2`,children:e.commits.map(e=>{let t=f(e);return(0,d.jsxs)(`li`,{className:`flex items-start gap-2.5 text-[14px]`,children:[(0,d.jsx)(`span`,{className:o(`mt-[7px] size-1.5 shrink-0 rounded-full`,t.dot)}),(0,d.jsxs)(`span`,{className:`min-w-0 text-ink-2`,children:[(0,d.jsxs)(`span`,{className:`font-semibold text-[12px] text-ink tracking-wide`,children:[t.label,e.scope?` [${e.scope}]`:``]}),` `,h(e.message),e.breaking?(0,d.jsx)(`span`,{className:`ml-1.5 rounded-full bg-rose-tint px-1.5 py-0.5 font-medium text-[12px] text-rose`,children:l(`about.breaking`)}):null]})]},e.id)})})]},e.version??`unreleased`))]})]})}export{_ as ChangelogDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,d as i,i as a,n as o,nt as s}from"./api-Bf-l9Sd8.js";import{t as c}from"./createLucideIcon-q3MZMmnf.js";import{S as l,T as u,b as d,r as f,y as p}from"./outputs-CsESg-Eg.js";import{t as m}from"./chevron-down-DymW-2BP.js";import{t as h}from"./plus-Du-Jx8aI.js";import{t as g}from"./mic-Bvz4mA2j.js";import{_,d as v,h as y,o as b,y as x}from"./ui-BT0Y_Hci.js";import{g as S,h as C}from"./index-BR5ELbeZ.js";var w={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};w.node;var T=c(w),E=e(t(),1),D=!1;function O(){if(!(typeof window>`u`||D))return window.SpeechRecognition??window.webkitSpeechRecognition}var k=typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<`u`;function A(e,t){let n=e.trimEnd(),r=t.trim();return n&&r?`${n} ${r}`:n||r}function j(e,t){let[n,r]=(0,E.useState)(!1),[i,a]=(0,E.useState)(!1),[s,c]=(0,E.useState)(null),l=(0,E.useRef)(e);l.current=e;let u=(0,E.useRef)(t);u.current=t;let d=(0,E.useRef)(null);(0,E.useEffect)(()=>()=>d.current?.stop(),[]);let f=async()=>{let e=l.current,t;try{t=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{c(`denied`);return}let n=[],i=new MediaRecorder(t);i.ondataavailable=e=>e.data.size&&n.push(e.data),i.onstop=async()=>{for(let e of t.getTracks())e.stop();d.current=null,r(!1);let s=(i.mimeType||`audio/webm`).split(`;`)[0],l=new File(n,`dictation`,{type:s});if(l.size){a(!0);try{let{text:t}=await o.upload(`/api/studio/transcribe`,l);t.trim()&&u.current(A(e,t))}catch(e){c(e.message)}finally{a(!1)}}},d.current={stop:()=>i.state!==`inactive`&&i.stop()},i.start(),r(!0)},p=e=>{let t=l.current,n=``,i=new e;i.continuous=!0,i.interimResults=!0,i.lang=_===`de`?`de-DE`:`en-US`,i.onresult=e=>{let r=``;for(let t=Math.max(0,e.resultIndex);t<e.results.length;t++){let i=e.results[t],a=i[0]?.transcript??``;i.isFinal?n=A(n,a):r+=a}u.current(A(t,A(n,r)))},i.onerror=e=>{if(e.error!==`aborted`&&e.error!==`no-speech`){if(e.error===`not-allowed`){c(`denied`);return}D=!0,k&&!n?(i.onend=null,d.current=null,f()):c(e.error)}},i.onend=()=>{d.current=null,r(!1)},d.current={stop:()=>i.stop()},i.start(),r(!0)};return{supported:!!O()||k,listening:n,processing:i,error:s,toggle:()=>{if(i)return;if(d.current){d.current.stop();return}c(null);let e=O();e?p(e):f()}}}var M=e(n(),1),N=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function P(e){let t=e.filter(e=>e.type.startsWith(`image/`));return t.length?Object.fromEntries(t.map(e=>[e.name,URL.createObjectURL(e)])):void 0}function F(e){let t=e.match(/(?:^|\n\n)(?:Angehängt|Attached): ([^\n]+)$/);return t?{text:e.slice(0,t.index).trim(),names:t[1].split(`, `).filter(Boolean)}:{text:e,names:[]}}function I(e,t){if(e.name&&e.name!==`image.png`)return e;let n=e.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`,r=new Date().toISOString().slice(0,19).replace(/[-:]/g,``).replace(`T`,`-`);return new File([e],`paste-${r}${t?`-${t+1}`:``}.${n}`,{type:e.type})}function L({url:e,label:t,children:n}){return(0,M.jsxs)(`div`,{className:`group relative`,title:t,children:[(0,M.jsx)(`img`,{src:e,alt:t,width:64,height:64,className:`size-16 rounded-lg bg-paper-2 object-cover ring-1 ring-border`}),n]})}function R({names:e,previews:t,fileUrl:n}){let r=e.filter(e=>t?.[e]||n&&N.test(e)),i=e.filter(e=>!r.includes(e));return(0,M.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[r.map(e=>{let r=t?.[e]??n?.(e)??``;return(0,M.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,title:e,children:(0,M.jsx)(`img`,{src:r,alt:e,className:`max-h-60 w-auto max-w-full rounded-xl bg-paper-2 object-contain ring-1 ring-border`})},e)}),i.length?(0,M.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:i.map(e=>(0,M.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-paper-2 px-2.5 py-1 text-[12px] text-ink-2`,children:[(0,M.jsx)(l,{className:`size-3 shrink-0 text-ink-4`}),(0,M.jsx)(`span`,{className:`truncate`,children:e})]},e))}):null]})}function z(e,t){let n=s(),[i,o]=(0,E.useState)([]),[c,l]=(0,E.useState)(`idle`),[u,d]=(0,E.useState)(null),[f,p]=(0,E.useState)(null),[m,h]=(0,E.useState)(null),[g,_]=(0,E.useState)(null),v=(0,E.useRef)(null);return(0,E.useEffect)(()=>{if(e){if(v.current!==e.id){v.current=e.id,o(e.messages);return}c===`idle`&&o(t=>e.messages.length>=t.length?e.messages:t)}},[e,c]),{messages:i,phase:c,activity:f,thought:m,startedAt:g,error:u,send:async(i,s=[])=>{if(!e||!(i.trim()||s.length)||c!==`idle`)return!1;if(d(null),_(Date.now()),h(null),s.length){l(`thinking`);try{for(let t of s){let n=await fetch(r(`/api/studio/wizards/${e.id}/files/${encodeURIComponent(t.name)}`),{method:`PUT`,credentials:`include`,headers:{"content-type":t.type||`application/octet-stream`},body:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??n.statusText)}}}catch(t){return d(t.message),l(`idle`),_(null),await n.invalidateQueries({queryKey:[`wizard`,e.id]}),!1}let t=`${x(`editor.attached`)}: ${s.map(e=>e.name).join(`, `)}`;i=i.trim()?`${i}\n\n${t}`:t}let u=`p-${Date.now()}`;o(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:i,previews:P(s)},{id:u,role:`assistant`,content:``,pending:!0}]),l(`thinking`),p(null);let f=!1;try{await a(`/api/studio/wizards/${e.id}/chat`,{message:i},(e,n)=>{if(e===`text`){let e=JSON.parse(n);o(t=>t.map(t=>t.id===u?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(n));else if(e===`thought`)h(JSON.parse(n));else if(e===`building`)l(`building`);else if(e===`done`){f=!0;let e=JSON.parse(n);o(t=>t.map(t=>t.id===u?{...t,content:e.reply,changed:e.changed,pending:!1}:t)),e.changed&&t(e.draft,e.revision)}else e===`error`&&(f=!0,d(JSON.parse(n).message))}),f||d(x(`editor.chatBroken`))}catch(e){d(e.message)}finally{p(null),h(null),_(null),o(e=>e.filter(e=>!(e.id===u&&!e.content)).map(e=>({...e,pending:!1}))),l(`idle`),await n.invalidateQueries({queryKey:[`wizard`,e.id]}),await n.invalidateQueries({queryKey:[`me`]})}return!0},fileUrl:t=>r(`/api/studio/wizards/${e?.id}/files/${encodeURIComponent(t)}`)}}function B(e){let[t,n]=(0,E.useState)(()=>Date.now());return(0,E.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?null:Math.max(0,Math.floor((t-e)/1e3))}function V(e){return e<60?`${e} s`:`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)} min`}function H({chat:e,thought:t,className:n,spinner:r=`size-3.5`}){let i=B(e.startedAt);return(0,M.jsxs)(`div`,{className:y(`min-w-0`,n),children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,M.jsx)(v,{className:y(`shrink-0`,r)}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:e.activity??(e.phase===`building`?x(`editor.building`):x(`editor.thinking`))}),i===null?null:(0,M.jsx)(`span`,{className:`shrink-0 text-ink-4 tabular-nums`,children:V(i)})]}),t&&e.thought?(0,M.jsx)(`p`,{className:`mt-0.5 truncate pl-5.5 text-[12px] text-ink-4`,children:e.thought}):null]})}function U({message:e,fileUrl:t}){let{text:n,names:r}=F(e.content);return(0,M.jsxs)(`div`,{className:`ml-8 flex flex-col items-end gap-1.5 self-end`,children:[r.length?(0,M.jsx)(R,{names:r,previews:e.previews,fileUrl:t}):null,n?(0,M.jsx)(`div`,{className:`rounded-xl rounded-br-md bg-paper-2 px-4 py-2.5 text-[14px] leading-relaxed`,children:(0,M.jsx)(`span`,{className:`whitespace-pre-wrap`,children:n})}):null]})}function W({chat:e,avatar:t,hello:n=x(`editor.chatHello`),placeholder:r=x(`editor.composer`),changedLabel:a=`Ablauf aktualisiert`,compact:o,intro:s,closed:c}){let[_,w]=(0,E.useState)(!1),[D,O]=(0,E.useState)(``),[k,A]=(0,E.useState)([]),N=(0,E.useRef)(null),P=(0,E.useRef)(null),F=(0,E.useRef)(null),R=j(D,O);(0,E.useEffect)(()=>{N.current?.scrollTo({top:N.current.scrollHeight,behavior:`smooth`})},[e.messages,e.phase]),(0,E.useEffect)(()=>{let e=P.current;if(!e)return;let t=()=>{e.style.height=`auto`,e.style.height=D?`${Math.min(e.scrollHeight,200)}px`:``};t();let n=e.clientWidth,r=new ResizeObserver(()=>{e.clientWidth!==n&&(n=e.clientWidth,t())});return r.observe(e),()=>r.disconnect()},[D]);let z=(D.trim()||k.length>0)&&e.phase===`idle`,B=e=>A(t=>[...t.filter(t=>!e.some(e=>e.name===t.name)),...e]),[V,W]=(0,E.useState)(new Map);(0,E.useEffect)(()=>{let e=new Map(k.filter(e=>e.type.startsWith(`image/`)).map(e=>[e,URL.createObjectURL(e)]));return W(e),()=>{for(let t of e.values())URL.revokeObjectURL(t)}},[k]);let G=async()=>{if(!z)return;R.listening&&R.toggle();let t={text:D,files:k};O(``),A([]),await e.send(t.text.trim(),t.files)||(O(t.text),A(t.files))},K=!o||_,q=e.messages.at(-1);return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[o&&(q||e.error)?(0,M.jsxs)(`button`,{type:`button`,"aria-expanded":_,"aria-label":x(`editor.thread`),onClick:()=>w(e=>!e),className:`flex items-center gap-2 px-4 pt-2.5 pb-0.5 text-left text-[13px] text-ink-3 transition hover:text-ink`,children:[!(e.error||_)&&q?.pending?(0,M.jsx)(H,{chat:e,className:`flex-1`}):(0,M.jsx)(`span`,{className:y(`min-w-0 flex-1 truncate`,e.error&&`text-rose`),children:e.error??(_?x(`editor.thread`):q?.content)}),_?(0,M.jsx)(m,{className:`size-4 shrink-0`}):(0,M.jsx)(T,{className:`size-4 shrink-0`})]}):null,(0,M.jsxs)(`div`,{ref:N,className:y(`min-h-0 flex-1 overflow-y-auto px-5 py-5`,!K&&`hidden`),children:[e.messages.length===0&&!c?s??(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(i,{kind:t,size:32,interactive:!1}),(0,M.jsx)(`p`,{className:`pt-1 text-[14px] text-ink-2 leading-relaxed`,children:n})]}):null,(0,M.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.messages.map(n=>n.role===`user`?(0,M.jsx)(U,{message:n,fileUrl:e.fileUrl},n.id):(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(`div`,{className:`shrink-0`,children:(0,M.jsx)(i,{kind:t,size:28,interactive:!1})}),(0,M.jsxs)(`div`,{className:`min-w-0 pt-0.5 text-[14px]`,children:[n.source===`mcp`?(0,M.jsxs)(`div`,{className:`mb-1 inline-flex items-center gap-1.5 text-[12px] text-ink-3`,children:[(0,M.jsx)(S,{className:`size-3`}),` `,x(`editor.viaClient`,{client:n.client??`MCP`})]}):null,n.content?(0,M.jsx)(f,{text:n.content,className:`text-[14px]`}):null,n.pending?(0,M.jsx)(H,{chat:e,thought:!0,className:`mt-1 text-[13px] text-ink-3`}):null,n.changed?(0,M.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-full bg-ember-tint px-2.5 py-0.5 text-[12px] text-ember-strong`,children:[(0,M.jsx)(d,{className:`size-3`}),` `,a]}):null]})]},n.id))}),e.error?(0,M.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-3 py-2 text-[13px] text-rose`,children:e.error}):null]}),c?(0,M.jsx)(`p`,{className:`m-3 rounded-xl bg-paper-2 px-4 py-3 text-[13px] text-ink-2 leading-relaxed`,children:c}):(0,M.jsxs)(`div`,{className:o?`p-2`:`p-3`,children:[(0,M.jsxs)(`div`,{className:`rounded-xl bg-card p-1.5 shadow-soft ring-1 ring-border focus-within:ring-focus`,children:[V.size?(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2 px-1 pt-1 pb-1.5`,children:k.map((e,t)=>{let n=V.get(e);return n?(0,M.jsx)(L,{url:n,label:e.name,children:(0,M.jsx)(`button`,{type:`button`,"aria-label":x(`editor.detach`),onClick:()=>A(e=>e.filter((e,n)=>n!==t)),className:`-top-1.5 -right-1.5 absolute flex size-5 items-center justify-center rounded-full bg-ink text-paper opacity-0 shadow-soft transition focus-visible:opacity-100 group-hover:opacity-100`,children:(0,M.jsx)(C,{className:`size-3`})})},`${e.name}-${t}`):null})}):null,k.some(e=>!V.has(e))?(0,M.jsx)(`ul`,{className:`flex flex-wrap gap-1.5 px-1 pt-1 pb-1.5`,children:k.map((e,t)=>V.has(e)?null:(0,M.jsxs)(`li`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-paper-2 py-1 pr-1 pl-2.5 text-[12px] text-ink-2`,children:[(0,M.jsx)(l,{className:`size-3 shrink-0 text-ink-4`}),(0,M.jsx)(`span`,{className:`truncate`,children:e.name}),(0,M.jsx)(`button`,{type:`button`,"aria-label":x(`editor.detach`),onClick:()=>A(e=>e.filter((e,n)=>n!==t)),className:`inline-flex size-5 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-3 hover:text-ink`,children:(0,M.jsx)(C,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,M.jsxs)(`div`,{className:`flex items-end gap-1`,children:[(0,M.jsx)(b,{label:x(`editor.attach`),onClick:()=>F.current?.click(),children:(0,M.jsx)(h,{className:`size-4`})}),(0,M.jsx)(`input`,{ref:F,type:`file`,multiple:!0,hidden:!0,onChange:e=>{let t=Array.from(e.target.files??[]);e.target.value=``,B(t)}}),(0,M.jsx)(`textarea`,{ref:P,rows:1,value:D,onChange:e=>O(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&(e.preventDefault(),B(t.map(I)))},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),G())},placeholder:R.listening?x(`editor.listening`):r,className:`max-h-[200px] min-h-[40px] flex-1 resize-none bg-transparent px-1.5 py-2 text-[14px] outline-none placeholder:text-ink-4`}),R.supported?(0,M.jsx)(b,{label:R.processing?x(`editor.transcribing`):R.listening?x(`editor.voiceStop`):x(`editor.voice`),"aria-pressed":R.listening,disabled:R.processing,onClick:R.toggle,className:y(R.listening&&`bg-rose-tint text-rose hover:bg-rose-tint hover:text-rose`),children:R.processing?(0,M.jsx)(v,{className:`size-4`}):R.listening?(0,M.jsx)(p,{className:`size-3.5 animate-pulse-dot fill-current`}):(0,M.jsx)(g,{className:`size-4`})}):null,(0,M.jsx)(`button`,{type:`button`,onClick:()=>void G(),disabled:!z,className:y(`inline-flex size-9 shrink-0 items-center justify-center rounded-full transition`,z?`bg-primary text-primary-foreground`:`bg-paper-2 text-ink-4`),"aria-label":`Send`,children:(0,M.jsx)(u,{className:`size-4`})})]})]}),R.error?(0,M.jsx)(`p`,{className:`mt-2 px-1 text-[12px] text-rose`,children:R.error===`denied`?x(`editor.micDenied`):R.error}):null]})]})}export{z as i,H as n,P as r,W as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{t as i}from"./external-link-MAL7vJYj.js";import{_ as a,a as o,d as s,i as c,s as l,y as u}from"./ui-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{t as r}from"./preload-helper-CNEI7N0N.js";import{t as i}from"./external-link-MAL7vJYj.js";import{_ as a,a as o,d as s,i as c,s as l,y as u}from"./ui-BT0Y_Hci.js";var d=e(t(),1),f=[{name:`engenty wizards`,description:{de:`KI-Wizards aus einer Beschreibung, mit einem Link geteilt.`,en:`AI wizards built from a description, shared with a link.`},homepage:`https://github.com/engenty/engenty-wizards`,license:`FSL-1.1-MIT`},{name:`engenty`,description:{de:`Konnektoren, Datentabellen, Suche und die Engenties stammen aus dem engenty-Framework.`,en:`Connectors, data tables, search and the engenties come from the engenty framework.`},homepage:`https://github.com/engenty/engenty`,license:`FSL-1.1-MIT`}],p=[{name:`Mastra`,description:{de:`Agent-Framework hinter den KI-Schritten.`,en:`Agent framework behind the AI steps.`},homepage:`https://github.com/mastra-ai/mastra`,license:`Apache-2.0`},{name:`AI SDK`,description:{de:`Modell-Aufrufe für Text, Bild, Video und Sprache.`,en:`Model calls for text, image, video and speech.`},homepage:`https://github.com/vercel/ai`,license:`Apache-2.0`},{name:`Model Context Protocol`,description:{de:`MCP-Server zum Bauen von Wizards, MCP-Client für Werkzeuge der Schritte.`,en:`MCP server for building wizards, MCP client for the steps' tools.`},homepage:`https://github.com/modelcontextprotocol/typescript-sdk`,license:`MIT`},{name:`Hono`,description:{de:`HTTP-API der Runtime.`,en:`The runtime's HTTP API.`},homepage:`https://github.com/honojs/hono`,license:`MIT`},{name:`Drizzle ORM`,description:{de:`Schema und Migrationen der Datenbanken.`,en:`Schema and migrations of the databases.`},homepage:`https://github.com/drizzle-team/drizzle-orm`,license:`Apache-2.0`},{name:`libSQL`,description:{de:`Eine Datenbank je Mandant, lokal als Datei oder bei Turso.`,en:`One database per tenant, a local file or at Turso.`},homepage:`https://github.com/tursodatabase/libsql`,license:`MIT`},{name:`Playwright`,description:{de:`Browser-Schritte sowie PDF- und PNG-Export.`,en:`Browser steps and the PDF and PNG export.`},homepage:`https://github.com/microsoft/playwright`,license:`Apache-2.0`},{name:`agentOS`,description:{de:`Sandbox für Code-Schritte ohne Docker.`,en:`Sandbox for code steps without Docker.`},homepage:`https://github.com/rivet-dev/agentos`,license:`Apache-2.0`},{name:`React`,description:{de:`UI-Bibliothek der Web-App.`,en:`UI library of the web app.`},homepage:`https://github.com/facebook/react`,license:`MIT`},{name:`Vite`,description:{de:`Build-Werkzeug der Web-App.`,en:`Build tool of the web app.`},homepage:`https://github.com/vitejs/vite`,license:`MIT`},{name:`Tailwind CSS`,description:{de:`Styling der Oberfläche.`,en:`Styling of the interface.`},homepage:`https://github.com/tailwindlabs/tailwindcss`,license:`MIT`},{name:`React Flow`,description:{de:`Das Diagramm der Schritte im Editor.`,en:`The diagram of steps in the editor.`},homepage:`https://github.com/xyflow/xyflow`,license:`MIT`},{name:`TanStack Query`,description:{de:`Server-Daten in der Web-App.`,en:`Server data in the web app.`},homepage:`https://github.com/TanStack/query`,license:`MIT`},{name:`xterm.js`,description:{de:`Das Terminal auf der Seite, in dem sich KI-Clients anmelden.`,en:`The terminal on the page where AI clients sign in.`},homepage:`https://github.com/xtermjs/xterm.js`,license:`MIT`},{name:`Lucide`,description:{de:`Icons.`,en:`Icons.`},homepage:`https://github.com/lucide-icons/lucide`,license:`ISC`},{name:`Geist & Geist Mono`,description:{de:`Schrift der Oberfläche.`,en:`Typeface of the interface.`},homepage:`https://github.com/vercel/geist-font`,license:`OFL-1.1`},{name:`Space Grotesk`,description:{de:`Schrift der Überschriften.`,en:`Typeface of the headings.`},homepage:`https://github.com/floriankarsten/space-grotesk`,license:`OFL-1.1`},{name:`git-cliff`,description:{de:`Erzeugt den Changelog aus den Commits.`,en:`Generates the changelog from the commits.`},homepage:`https://github.com/orhun/git-cliff`,license:`MIT OR Apache-2.0`}],m=e(n(),1),h=(e,...t)=>t.some(t=>t?.toLowerCase().includes(e));function g({name:e,homepage:t,version:n,license:r,description:a}){return(0,m.jsxs)(`li`,{className:`py-2.5`,children:[(0,m.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5`,children:[t?(0,m.jsxs)(`a`,{href:t,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 font-medium text-[14px] text-ink underline-offset-4 hover:underline`,children:[e,(0,m.jsx)(i,{"aria-hidden":!0,className:`size-3 text-ink-4`})]}):(0,m.jsx)(`span`,{className:`font-medium text-[14px] text-ink`,children:e}),n?(0,m.jsx)(`span`,{className:`text-[12px] text-ink-3 tabular-nums`,children:n}):null,(0,m.jsx)(`span`,{className:`text-[12px] text-ink-3`,children:r})]}),a?(0,m.jsx)(`p`,{className:`mt-0.5 text-[13px] text-ink-3`,children:a}):null]})}function _({title:e,hint:t,children:n}){return(0,m.jsxs)(`section`,{className:`mt-6`,children:[(0,m.jsx)(`h3`,{className:`border-border-soft border-b pb-2 font-display font-semibold text-[16px]`,children:e}),t?(0,m.jsx)(`p`,{className:`mt-2 text-[13px] text-ink-3`,children:t}):null,n]})}function v({credits:e}){return(0,m.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:e.map(e=>(0,m.jsx)(g,{name:e.name,homepage:e.homepage,license:e.license,description:e.description[a]},e.name))})}function y({label:e,packages:t}){return(0,m.jsxs)(`div`,{className:`mt-4`,children:[(0,m.jsx)(`h4`,{className:`font-medium text-[12px] text-ink-3 tracking-wide`,children:e}),(0,m.jsx)(`ul`,{className:`divide-y divide-border-soft`,children:t.map(e=>(0,m.jsx)(g,{...e},e.name))})]})}function b({open:e,onClose:t}){let[n,i]=(0,d.useState)(null),[a,g]=(0,d.useState)(``);(0,d.useEffect)(()=>{if(!e||n)return;let t=!1;return r(()=>import(`./oss-credits-C-U2Tlpn.js`).then(e=>{t||i(e.default)}),[]),()=>{t=!0}},[e,n]),(0,d.useEffect)(()=>{e||g(``)},[e]);let b=a.trim().toLowerCase(),x=e=>b?e.filter(e=>h(b,e.name,e.license,e.description.de,e.description.en)):e,S=e=>b?e.filter(e=>h(b,e.name,e.license,e.version)):e,C=x(f),w=x(p),T=n?[{id:`shared`,label:u(`about.creditsShared`),packages:S(n.shared)},...n.groups.map(e=>({id:e.id,label:e.label,packages:S(e.packages)}))].filter(e=>e.packages.length>0):[],E=C.length===0&&w.length===0&&T.length===0;return(0,m.jsxs)(c,{open:e,onClose:t,title:u(`about.credits`),wide:!0,children:[(0,m.jsx)(`p`,{className:`-mt-3 mb-4 text-[14px] text-ink-3`,children:u(`about.creditsHint`)}),(0,m.jsx)(l,{type:`search`,value:a,placeholder:u(`about.search`),onChange:e=>g(e.target.value)}),C.length>0?(0,m.jsx)(_,{title:u(`about.creditsProduct`),children:(0,m.jsx)(v,{credits:C})}):null,w.length>0?(0,m.jsx)(_,{title:u(`about.creditsBuiltWith`),children:(0,m.jsx)(v,{credits:w})}):null,n===null?(0,m.jsx)(`div`,{className:`flex justify-center py-10 text-ink-3`,children:(0,m.jsx)(s,{})}):T.length>0?(0,m.jsx)(_,{title:u(`about.creditsDeps`),hint:b?void 0:u(`about.creditsDepsHint`),children:T.map(e=>(0,m.jsx)(y,{label:e.label,packages:e.packages},e.id))}):null,n!==null&&E?(0,m.jsx)(o,{children:u(`about.noMatches`)}):null]})}export{b as CreditsDialog};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{A as r,O as i,S as a,c as o,d as s,j as c,k as l,n as u,nt as d,t as f}from"./api-Bf-l9Sd8.js";import{d as p,f as m,n as h,o as g,u as _}from"./session-C7LDDcj7.js";import{t as v}from"./createLucideIcon-q3MZMmnf.js";import{n as ee,r as te,t as ne}from"./RunnerView-CCe8-k9Q.js";import{t as re}from"./arrow-left-hTN1VoH1.js";import{T as y,n as b}from"./outputs-CsESg-Eg.js";import{a as x,i as ie,n as S,r as ae,s as oe,t as se}from"./meta-CKE9QceT.js";import{t as ce}from"./check-CUpby_J9.js";import{t as le}from"./chevron-down-DymW-2BP.js";import{i as ue,n as de,t as fe}from"./ChatPanel-CNiFyu_w.js";import{t as pe}from"./upload-DNRENWzQ.js";import{n as me,t as C}from"./plus-Du-Jx8aI.js";import{t as he}from"./external-link-MAL7vJYj.js";import{t as ge}from"./wand-sparkles-Clj3VRB5.js";import{n as _e}from"./mic-Bvz4mA2j.js";import{n as w,r as ve}from"./Account-DLLeEwJL.js";import{t as T}from"./trash-0IafyhZB.js";import{t as ye}from"./lock-CzNXAYdi.js";import{c as be,i as xe,l as Se,n as E,o as D,p as Ce,r as O,s as k,t as A}from"./definition-DndaH5Ow.js";import{_ as j,a as we,c as M,d as Te,h as N,i as Ee,l as P,m as F,o as I,p as L,r as R,s as z,t as B,u as V,y as H}from"./ui-BT0Y_Hci.js";import{a as De,b as Oe,d as ke,g as Ae,h as je,i as Me,m as Ne,n as Pe,o as Fe,r as Ie,s as Le,t as Re,v as ze,y as Be}from"./index-BR5ELbeZ.js";import{a as Ve,c as He,i as Ue,l as We,o as Ge,r as Ke,s as qe,t as Je}from"./esm-rJY59Ixx.js";import{r as Ye}from"./LocalRuntime-C199bg_B.js";var Xe={name:`chevron-left`,size:24,node:[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]};Xe.node;var Ze=v(Xe),Qe={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};Qe.node;var $e=v(Qe),et={name:`circle-alert`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]],aliases:[`alert-circle`]};et.node;var tt=v(et),nt={name:`cloud-check`,size:24,node:[[`path`,{d:`m17 15-5.5 5.5L9 18`,key:`15q87x`}],[`path`,{d:`M5.516 16.07A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 3.501 7.327`,key:`1xtj56`}]]};nt.node;var rt=v(nt),it={name:`cloud-upload`,size:24,node:[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]],aliases:[`upload-cloud`]};it.node;var at=v(it),ot={name:`code`,size:24,node:[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]};ot.node;var st=v(ot),ct={name:`file-braces`,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:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]],aliases:[`file-json`]};ct.node;var lt=v(ct),ut={name:`file-code-corner`,size:24,node:[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]],aliases:[`file-code-2`]};ut.node;var dt=v(ut),ft={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};ft.node;var pt=v(ft),mt={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};mt.node;var ht=v(mt),gt={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};gt.node;var _t=v(gt),vt={name:`qr-code`,size:24,node:[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]};vt.node;var yt=v(vt),bt={name:`scan`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}]]};bt.node;var xt=v(bt),U=e(t(),1),W=e(n(),1);function St(e){return e.mime.startsWith(`image/`)?oe:e.mime.includes(`json`)?lt:e.mime===`text/html`||e.mime.includes(`javascript`)||e.mime===`text/css`?dt:_e}function Ct(e){return e<1024?`${e} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1048576).toFixed(1)} MB`}function wt({wizardId:e,files:t,readOnly:n}){let r=d(),i=(0,U.useRef)(null),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(!1),[l,f]=(0,U.useState)(null),p=`/api/studio/wizards/${e}/files`,m=()=>r.invalidateQueries({queryKey:[`wizard`,e]}),h=async e=>{if(e?.length){o(!0),f(null);try{for(let t of Array.from(e)){let e=await fetch(`${p}/${encodeURIComponent(t.name).replace(/%2F/g,`/`)}`,{method:`PUT`,credentials:`include`,headers:{"content-type":t.type||`application/octet-stream`},body:t});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??e.statusText)}}}catch(e){f(e.message)}finally{o(!1),await m()}}},g=async e=>{if(window.confirm(H(`files.confirmDelete`,{path:e}))){f(null);try{await u.del(`${p}/${e}`)}catch(e){f(e.message)}await m()}},_=t.reduce((e,t)=>e+t.size,0);return(0,W.jsxs)(`div`,{className:N(`flex min-h-full flex-col px-5 py-5`,s&&`bg-ember-veil`),onDragOver:e=>{e.preventDefault(),c(!n)},onDragLeave:()=>c(!1),onDrop:e=>{e.preventDefault(),c(!1),n||h(e.dataTransfer.files)},children:[n?null:(0,W.jsx)(`p`,{className:`mb-4 text-[13px] text-ink-3 leading-relaxed`,children:H(`files.explain`)}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n?null:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>i.current?.click(),className:`inline-flex h-9 items-center gap-1.5 rounded-full bg-paper-2 px-3.5 font-medium text-[13px] text-ink-2 hover:bg-paper-3 hover:text-ink`,children:[a?(0,W.jsx)(Te,{className:`size-3.5`}):(0,W.jsx)(pe,{className:`size-3.5`}),H(`files.upload`)]}),(0,W.jsx)(`span`,{className:`ml-auto text-[12px] text-ink-4`,children:H(`files.count`,{n:t.length,size:Ct(_)})}),(0,W.jsx)(`input`,{ref:i,type:`file`,multiple:!0,hidden:!0,onChange:e=>void h(e.target.files)})]}),l?(0,W.jsx)(`div`,{className:`mt-3 rounded-lg bg-rose-tint px-3 py-2 text-[13px] text-rose`,children:l}):null,(0,W.jsx)(`ul`,{className:`mt-4 flex flex-col`,children:t.map(e=>{let t=St(e);return(0,W.jsxs)(`li`,{className:`group flex items-center gap-3 rounded-lg px-2 py-1.5 hover:bg-paper-2`,children:[(0,W.jsx)(t,{className:`size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[12px]`,children:e.path}),(0,W.jsx)(`span`,{className:`text-[12px] text-ink-4 tabular-nums`,children:Ct(e.size)}),(0,W.jsx)(`a`,{href:`${p}/${e.path}`,className:`inline-flex size-8 items-center justify-center rounded-full text-ink-3 opacity-0 hover:text-ink group-hover:opacity-100`,"aria-label":H(`files.download`),children:(0,W.jsx)(Be,{className:`size-4`})}),n?null:(0,W.jsx)(I,{label:H(`files.delete`),className:`opacity-0 hover:text-rose group-hover:opacity-100`,onClick:()=>void g(e.path),children:(0,W.jsx)(T,{className:`size-4`})})]},e.path)})}),t.length===0?(0,W.jsx)(`div`,{className:`mt-6 rounded-xl border border-border border-dashed px-4 py-8 text-center text-[13px] text-ink-4`,children:H(n?`files.none`:`files.empty`)}):null]})}var Tt=Object.defineProperty,Et=(e,t,n)=>t in e?Tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dt=(e,t)=>{for(var n in t)Tt(e,n,{get:t[n],enumerable:!0})},Ot=(e,t,n)=>Et(e,typeof t==`symbol`?t:t+``,n),kt={};Dt(kt,{Graph:()=>G,alg:()=>Ht});var At=Object.defineProperty,jt=(e,t)=>{for(var n in t)At(e,n,{get:t[n],enumerable:!0})},Mt=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected=`directed`in e?e.directed:!0,this._isMultigraph=`multigraph`in e&&e.multigraph,this._isCompound=`compound`in e&&e.compound),this._isCompound&&(this._parent={},this._children={},this._children[`\0`]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=typeof e==`function`?e:()=>e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(e=>{t===void 0?this.setNode(e):this.setNode(e,t)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]=`\0`,this._children[e]={},this._children[`\0`][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=e=>this.removeEdge(this._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(e=>{this.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw Error(`Cannot set parent in a non-compound graph`);if(t===void 0)t=`\0`;else{t+=``;for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw Error(`Setting `+t+` as parent of `+e+` would create a cycle`);this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!==`\0`)return t}}children(e=`\0`){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e===`\0`)return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t),r=this.successors(e);if(r)for(let e of r)n.add(e);return Array.from(n.values())}}isLeaf(e){let t;return t=this.isDirected()?this.successors(e):this.neighbors(e),(t?.length??0)===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([n,r])=>{e(n)&&t.setNode(n,r)}),Object.values(this._edgeObjs).forEach(e=>{t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,this.edge(e))});let n={},r=e=>{let i=this.parent(e);return!i||t.hasNode(i)?(n[e]=i,i):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=typeof e==`function`?e:()=>e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((e,n)=>(t===void 0?this.setEdge(e,n):this.setEdge(e,n,t),n)),this}setEdge(e,t,n,r){let i,a,o,s,c=!1;typeof e==`object`&&e&&`v`in e?(i=e.v,a=e.w,o=e.name,arguments.length===2&&(s=t,c=!0)):(i=e,a=t,o=r,arguments.length>2&&(s=n,c=!0)),i=``+i,a=``+a,o!==void 0&&(o=``+o);let l=Ft(this._isDirected,i,a,o);if(l in this._edgeLabels)return c&&(this._edgeLabels[l]=s),this;if(o!==void 0&&!this._isMultigraph)throw Error(`Cannot set a named edge when isMultigraph = false`);this.setNode(i),this.setNode(a),this._edgeLabels[l]=c?s:this._defaultEdgeLabelFn(i,a,o);let u=It(this._isDirected,i,a,o);return i=u.v,a=u.w,Object.freeze(u),this._edgeObjs[l]=u,Nt(this._preds[a],i),Nt(this._sucs[i],a),this._in[a][l]=u,this._out[i][l]=u,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?Lt(this._isDirected,e):Ft(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!=`object`||!r?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?Lt(this._isDirected,e):Ft(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Lt(this._isDirected,e):Ft(this._isDirected,e,t,n),i=this._edgeObjs[r];if(i){let e=i.v,t=i.w;delete this._edgeLabels[r],delete this._edgeObjs[r],Pt(this._preds[t],e),Pt(this._sucs[e],t),delete this._in[t][r],delete this._out[e][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(e=>e.v===t&&e.w===n||e.v===n&&e.w===t):r}};function Nt(e,t){e[t]?e[t]++:e[t]=1}function Pt(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function Ft(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}return i+``+a+``+(r===void 0?`\0`:r)}function It(e,t,n,r){let i=``+t,a=``+n;if(!e&&i>a){let e=i;i=a,a=e}let o={v:i,w:a};return r&&(o.name=r),o}function Lt(e,t){return Ft(e,t.v,t.w,t.name)}jt({},{read:()=>Vt,write:()=>Rt});function Rt(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:zt(e),edges:Bt(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function zt(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function Bt(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Vt(e){let t=new Mt(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(e=>{t.setNode(e.v,e.value),e.parent&&t.setParent(e.v,e.parent)}),e.edges.forEach(e=>{t.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),t}var Ht={};jt(Ht,{CycleException:()=>rn,bellmanFord:()=>Wt,components:()=>Kt,dijkstra:()=>Yt,dijkstraAll:()=>Zt,findCycles:()=>$t,floydWarshall:()=>tn,isAcyclic:()=>on,postorder:()=>un,preorder:()=>dn,prim:()=>fn,shortestPaths:()=>pn,tarjan:()=>Qt,topsort:()=>an});var Ut=()=>1;function Wt(e,t,n,r){return Gt(e,String(t),n||Ut,r||function(t){return e.outEdges(t)??[]})}function Gt(e,t,n,r){let i={},a,o=0,s=e.nodes(),c=function(e){let t=i[e.v],r=i[e.w];if(!t||!r)return;let o=n(e);t.distance+o<r.distance&&(i[e.w]={distance:t.distance+o,predecessor:e.v},a=!0)},l=function(){s.forEach(function(e){r(e).forEach(function(t){let n=t.v===e?t.v:t.w,r=n===t.v?t.w:t.v;c({v:n,w:r})})})};s.forEach(function(e){i[e]={distance:e===t?0:1/0,predecessor:``}});let u=s.length;for(let e=1;e<u&&(a=!1,o++,l(),a);e++);if(o===u-1&&(a=!1,l(),a))throw Error(`The graph contains a negative weight cycle`);return i}function Kt(e){let t={},n=[],r;function i(n){var a,o;n in t||(t[n]=!0,r.push(n),(a=e.successors(n))==null||a.forEach(i),(o=e.predecessors(n))==null||o.forEach(i))}return e.nodes().forEach(function(e){r=[],i(e),r.length&&n.push(r)}),n}var qt=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw Error(`Queue underflow`);return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let e=this._arr,i=e.length;return n[r]=i,e.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){if(this.size()===0)throw Error(`Queue underflow`);this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,i=e;n<t.length&&(i=t[n].priority<t[i].priority?n:i,r<t.length&&(i=t[r].priority<t[i].priority?r:i),i!==e&&(this._swap(e,i),this._heapify(i)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,i=n[e],a=n[t];n[e]=a,n[t]=i,r[a.key]=e,r[i.key]=t}},Jt=()=>1;function Yt(e,t,n,r){return Xt(e,String(t),n||Jt,r||function(t){return e.outEdges(t)??[]})}function Xt(e,t,n,r){let i={},a=new qt,o,s,c=function(e){let t=e.v===o?e.w:e.v,r=i[t];if(!r)return;let c=n(e),l=s.distance+c;if(c<0)throw Error(`dijkstra does not allow negative edge weights. Bad edge: `+e+` Weight: `+c);l<r.distance&&(r.distance=l,r.predecessor=o,a.decrease(t,l))};for(e.nodes().forEach(function(e){let n=e===t?0:1/0;i[e]={distance:n,predecessor:``},a.add(e,n)});a.size()>0;){o=a.removeMin();let e=i[o];if(!e||e.distance===1/0)break;s=e,r(o).forEach(c)}return i}function Zt(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=Yt(e,i,t,n),r},{})}function Qt(e){let t=0,n=[],r={},i=[];function a(o){var s;let c=r[o]={onStack:!0,lowlink:t,index:t++};if(n.push(o),(s=e.successors(o))==null||s.forEach(function(e){if(e in r){let t=r[e];t!=null&&t.onStack&&(c.lowlink=Math.min(c.lowlink,t.index))}else{a(e);let t=r[e];t&&(c.lowlink=Math.min(c.lowlink,t.lowlink))}}),c.lowlink===c.index){let e=[],t;do{t=n.pop();let i=r[t];i&&(i.onStack=!1),e.push(t)}while(o!==t);i.push(e)}}return e.nodes().forEach(function(e){e in r||a(e)}),i}function $t(e){return Qt(e).filter(function(t){let n=t[0];return n?t.length>1||t.length===1&&(e.outEdges(n,n)??[]).length>0:!1})}var en=()=>1;function tn(e,t,n){return nn(e,t||en,n||function(t){return e.outEdges(t)??[]})}function nn(e,t,n){let r={},i=e.nodes();return i.forEach(function(e){let a={};r[e]=a,a[e]={distance:0,predecessor:``},i.forEach(function(t){e!==t&&(a[t]={distance:1/0,predecessor:``})}),n(e).forEach(function(n){let r=n.v===e?n.w:n.v,i=t(n);a[r]={distance:i,predecessor:e}})}),i.forEach(function(e){let t=r[e];t&&i.forEach(function(n){let a=r[n];a&&i.forEach(function(n){let r=a[e],i=t[n],o=a[n];if(r&&i&&o){let e=r.distance+i.distance;e<o.distance&&(o.distance=e,o.predecessor=i.predecessor)}})})}),r}var rn=class extends Error{constructor(e){super(e),this.name=`CycleException`}};function an(e){let t={},n={},r=[];function i(a){var o;if(a in n)throw new rn;a in t||(n[a]=!0,t[a]=!0,(o=e.predecessors(a))==null||o.forEach(i),delete n[a],r.push(a))}if(e.sinks().forEach(i),Object.keys(t).length!==e.nodeCount())throw new rn;return r}function on(e){try{an(e)}catch(e){if(e instanceof rn)return!1;throw e}return!0}function sn(e,t,n,r,i){Array.isArray(t)||(t=[t]);let a=(t=>(e.isDirected()?e.successors(t):e.neighbors(t))??[]),o={};return t.forEach(function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);i=cn(e,t,n===`post`,o,a,r,i)}),i}function cn(e,t,n,r,i,a,o){return t in r||(r[t]=!0,n||(o=a(o,t)),i(t).forEach(function(t){o=cn(e,t,n,r,i,a,o)}),n&&(o=a(o,t))),o}function ln(e,t,n){return sn(e,t,n,function(e,t){return e.push(t),e},[])}function un(e,t){return ln(e,t,`post`)}function dn(e,t){return ln(e,t,`pre`)}function fn(e,t){var n;let r=new Mt,i={},a=new qt,o;function s(e){let n=e.v===o?e.w:e.v,r=a.priority(n);if(r!==void 0){let s=t(e);s<r&&(i[n]=o,a.decrease(n,s))}}if(e.nodeCount()===0)return r;e.nodes().forEach(function(e){a.add(e,1/0),r.setNode(e)});let c=e.nodes()[0];c!==void 0&&a.decrease(c,0);let l=!1;for(;a.size()>0;){if(o=a.removeMin(),o in i)r.setEdge(o,i[o]);else{if(l)throw Error(`Input graph is not connected: `+e);l=!0}(n=e.nodeEdges(o))==null||n.forEach(s)}return r}function pn(e,t,n,r){return mn(e,t,n,r??(t=>e.outEdges(t)??[]))}function mn(e,t,n,r){if(n===void 0)return Yt(e,t,n,r);let i=!1,a=e.nodes();for(let o=0;o<a.length;o++){let s=a[o];if(s===void 0)continue;let c=r(s);for(let e=0;e<c.length;e++){let t=c[e];if(!t)continue;let r=t.v===s?t.v:t.w;n({v:r,w:r===t.v?t.w:t.v})<0&&(i=!0)}if(i)return Wt(e,t,n,r)}return Yt(e,t,n,r)}var G=Mt;function K(e,t,n,r){let i=r;for(;e.hasNode(i);)i=kn(r);return n.dummy=t,e.setNode(i,n),i}function hn(e){let t=new G().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function gn(e){let t=new G({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function _n(e,t){let n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);let c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function vn(e){let t=An(wn(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),i=r.rank;i!==void 0&&(t[i]||(t[i]=[]),t[i][r.order]=n)}),t}function yn(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MAX_VALUE:n}),n=q(Math.min,t);e.nodes().forEach(t=>{let r=e.node(t);Object.hasOwn(r,`rank`)&&(r.rank-=n)})}function bn(e){let t=e.nodes().map(t=>e.node(t).rank).filter(e=>e!==void 0),n=q(Math.min,t),r=[];e.nodes().forEach(t=>{let i=e.node(t).rank-n;r[i]||(r[i]=[]),r[i].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{t===void 0&&n%a!==0?--i:t!==void 0&&i&&t.forEach(t=>e.node(t).rank+=i)})}function xn(e,t,n,r){let i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),K(e,`border`,i,t)}function Sn(e,t=Cn){let n=[];for(let r=0;r<e.length;r+=t){let i=e.slice(r,r+t);n.push(i)}return n}var Cn=65535;function q(e,t){return t.length>Cn?e(...Sn(t).map(t=>e(...t))):e(...t)}function wn(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return n===void 0?Number.MIN_VALUE:n});return q(Math.max,t)}function Tn(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function En(e,t){let n=Date.now();try{return t()}finally{console.log(e+` time: `+(Date.now()-n)+`ms`)}}function Dn(e,t){return t()}var On=0;function kn(e){return e+(``+ ++On)}function An(e,t,n=1){t??(t=e,e=0);let r=e=>e<t;n<0&&(r=e=>t<e);let i=[];for(let t=e;r(t);t+=n)i.push(t);return i}function jn(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function Mn(e,t){let n;return n=typeof t==`string`?e=>e[t]:t,Object.entries(e).reduce((e,[t,r])=>(e[t]=n(r,t),e),{})}function Nn(e,t){return e.reduce((e,n,r)=>(e[n]=t[r],e),{})}var Pn=`\0`;function Fn(e,t,n){if(!(e&&t&&n&&t.dummy===`edge`&&n.dummy===`edge`&&t.edgeObj&&n.edgeObj&&e[t.edgeObj.v]&&e[n.edgeObj.v]&&e[t.edgeObj.w]&&e[n.edgeObj.w]))return 0;let r=!0;t.edgeObj.w===n.edgeObj.w&&(r=!1);let i=r?e[t.edgeObj.v]?.rank??NaN:e[t.edgeObj.w]?.rank??NaN,a=Object.entries(e).find(e=>e[1].edgeObj?.v===t.edgeObj.v&&e[1].edgeObj?.w===t.edgeObj.w&&e[1].rank===i),o=Object.entries(e).find(e=>e[1].edgeObj?.v===n.edgeObj.v&&e[1].edgeObj?.w===n.edgeObj.w&&e[1].rank===i);if(!a||!o)return 0;let s=a[1].order??NaN,c=o[1].order??NaN;return isNaN(s-c)?0:s-c}var In=`3.1.1`,Ln=class{constructor(){Ot(this,`_sentinel`);let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Rn(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Rn(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,zn)),n=n._prev;return`[`+e.join(`, `)+`]`}};function Rn(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function zn(e,t){if(e!==`_next`&&e!==`_prev`)return t}var Bn=Ln,Vn=()=>1;function Hn(e,t){if(e.nodeCount()<=1)return[];let n=Gn(e,t||Vn);return Un(n.graph,n.buckets,n.zeroIdx).flatMap(t=>e.outEdges(t.v,t.w)||[])}function Un(e,t,n){let r=[],i=t[t.length-1],a=t[0],o;for(;e.nodeCount();){for(;o=a.dequeue();)Wn(e,t,n,o);for(;o=i.dequeue();)Wn(e,t,n,o);if(e.nodeCount()){for(let i=t.length-2;i>0;--i)if(o=t[i]?.dequeue(),o){r=r.concat(Wn(e,t,n,o,!0)||[]);break}}}return r}function Wn(e,t,n,r,i){let a=[],o=i?a:void 0;return(e.inEdges(r.v)||[]).forEach(r=>{let o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,Kn(t,n,s)}),(e.outEdges(r.v)||[]).forEach(r=>{let i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,Kn(t,n,o)}),e.removeNode(r.v),o}function Gn(e,t){let n=new G,r=0,i=0;e.nodes().forEach(e=>{n.setNode(e,{v:e,in:0,out:0})}),e.edges().forEach(e=>{let a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s);let c=n.node(e.v),l=n.node(e.w);i=Math.max(i,c.out+=o),r=Math.max(r,l.in+=o)});let a=qn(i+r+3).map(()=>new Bn),o=r+1;return n.nodes().forEach(e=>{Kn(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function Kn(e,t,n){var r,i,a;n.out?n.in?(a=e[n.out-n.in+t])==null||a.enqueue(n):(i=e[e.length-1])==null||i.enqueue(n):(r=e[0])==null||r.enqueue(n)}function qn(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function Jn(e,t){(e.graph().acyclicer===`greedy`?Hn(e,n(e)):Yn(e,t??null)).forEach(t=>{let n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,kn(`rev`))});function n(e){return t=>e.edge(t).weight}}function Yn(e,t){let n=[],r={},i={};function a(t){Object.hasOwn(i,t)||(i[t]=!0,r[t]=!0,e.outEdges(t).forEach(e=>{Object.hasOwn(r,e.w)?n.push(e):a(e.w)}),delete r[t])}function o(a){var s;Object.hasOwn(i,a)||(i[a]=!0,r[a]=!0,(s=e.outEdges(a))==null||s.forEach(i=>{Object.hasOwn(r,i.w)||t.node(a)?.rank>t.node(i.w)?.rank&&Zn(e,i.w,i)?n.push(i):o(i.w)}),delete r[a])}let s=a;return t&&typeof t.node==`function`&&(s=o),e.sources().forEach(s),e.nodes().forEach(s),n}function Xn(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Zn(e,t,n){let r=new Set;function i(t){if(e.sources().includes(t))return!0;r.add(t);for(let a of e.inEdges(t)??[])if((a.v!==n.v||a.w!==n.w)&&!r.has(a.v)&&i(a.v))return!0;return!1}return i(t)}function Qn(e){e.graph().dummyChains=[],e.edges().forEach(t=>$n(e,t))}function $n(e,t){let n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a===r+1)return;e.removeEdge(t);let l,u,d=0;for(++r;r<a;++d,++r)s.points=[],u={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},l=K(e,`edge`,u,`_d`),r===c&&(u.width=s.width,u.height=s.height,u.dummy=`edge-label`,u.labelpos=s.labelpos),e.setEdge(n,l,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(l),n=l;e.setEdge(n,i,{weight:s.weight},o)}function er(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function tr(e){let t={};function n(r){let i=e.node(r);if(Object.hasOwn(t,r))return i.rank;t[r]=!0;let a=e.outEdges(r),o=a?a.map(t=>t==null?1/0:n(t.w)-e.edge(t).minlen):[],s=q(Math.min,o);return s===1/0&&(s=0),i.rank=s}e.sources().forEach(n)}function J(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var nr=rr;function rr(e){let t=new G({directed:!1}),n=e.nodes();if(n.length===0)throw Error(`Graph must have at least one node`);let r=n[0],i=e.nodeCount();t.setNode(r,{});let a,o;for(;ir(t,e)<i&&(a=ar(t,e),a);)o=t.hasNode(a.v)?J(e,a):-J(e,a),or(t,e,o);return t}function ir(e,t){function n(r){let i=t.nodeEdges(r);i&&i.forEach(i=>{let a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!J(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return e.nodes().forEach(n),e.nodeCount()}function ar(e,t){return t.edges().reduce((n,r)=>{let i=1/0;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=J(t,r)),i<n[0]?[i,r]:n},[1/0,null])[1]}function or(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}var{preorder:sr,postorder:cr}=Ht,lr=Y;Y.initLowLimValues=pr,Y.initCutValues=ur,Y.calcCutValue=fr,Y.leaveEdge=hr,Y.enterEdge=gr,Y.exchangeEdges=_r;function Y(e){e=hn(e),tr(e);let t=nr(e);pr(t),ur(t,e);let n,r;for(;n=hr(t);)r=gr(t,e,n),_r(t,e,n,r)}function ur(e,t){let n=cr(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(n=>dr(e,t,n))}function dr(e,t,n){let r=e.node(n).parent,i=e.edge(n,r);i.cutvalue=fr(e,t,n)}function fr(e,t,n){let r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;a||=(i=!1,t.edge(r,n)),o=a.weight;let s=t.nodeEdges(n);return s&&s.forEach(a=>{let s=a.v===n,c=s?a.w:a.v;if(c!==r){let r=s===i,l=t.edge(a).weight;if(o+=r?l:-l,yr(e,n,c)){let t=e.edge(n,c).cutvalue;o+=r?-t:t}}}),o}function pr(e,t){arguments.length<2&&(t=e.nodes()[0]),mr(e,{},1,t)}function mr(e,t,n,r,i){let a=n,o=e.node(r);t[r]=!0;let s=e.neighbors(r);return s&&s.forEach(i=>{Object.hasOwn(t,i)||(n=mr(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function hr(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function gr(e,t,n){let r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);let a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),t.edges().filter(t=>c===br(e,e.node(t.v),s)&&c!==br(e,e.node(t.w),s)).reduce((e,n)=>J(t,n)<J(t,e)?n:e)}function _r(e,t,n,r){let i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),pr(e),ur(e,t),vr(e,t)}function vr(e,t){let n=e.nodes().find(t=>!e.node(t).parent);if(!n)return;let r=sr(e,[n]);r=r.slice(1),r.forEach(n=>{let r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function yr(e,t,n){return e.hasEdge(t,n)}function br(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var xr=Sr;function Sr(e){let t=e.graph().ranker;if(typeof t==`function`)return t(e);switch(t){case`network-simplex`:Tr(e);break;case`tight-tree`:wr(e);break;case`longest-path`:Cr(e);break;case`none`:break;default:Tr(e)}}var Cr=tr;function wr(e){tr(e),nr(e)}function Tr(e){lr(e)}var Er=Dr;function Dr(e){let t=kr(e),n=e.graph();Array.isArray(n.dummyChains)&&n.dummyChains.forEach(n=>{let r=e.node(n),i=r.edgeObj,a=Or(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;for(;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(o[c+1]).minRank<=r.rank;)c++;l=o[c]}l!==void 0&&e.setParent(n,l),n=e.successors(n)[0]}})}function Or(e,t,n,r){let i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));let l=c,u=r;for(;(u=e.parent(u))!==l;)a.push(u);return{path:i.concat(a.reverse()),lca:l}}function kr(e){let t={},n=0;function r(i){let a=n;e.children(i).forEach(r),t[i]={low:a,lim:n++}}return e.children(Pn).forEach(r),t}function Ar(e){let t=K(e,`root`,{},`_root`),n=Mr(e),r=Object.values(n),i=q(Math.max,r)-1,a=2*i+1;e.graph().nestingRoot=t,e.edges().forEach(t=>e.edge(t).minlen*=a);let o=Nr(e)+1;e.children(Pn).forEach(r=>{jr(e,t,a,o,i,n,r)}),e.graph().nodeRankFactor=a}function jr(e,t,n,r,i,a,o){let s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}let c=xn(e,`_bt`),l=xn(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,s.forEach(s=>{jr(e,t,n,r,i,a,s);let u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-(a[o]??0)+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+(a[o]??0)})}function Mr(e){let t={};function n(r,i){let a=e.children(r);a&&a.length&&a.forEach(e=>n(e,i+1)),t[r]=i}return e.children(Pn).forEach(e=>n(e,1)),t}function Nr(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Pr(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}var Fr=Ir;function Ir(e){function t(n){let r=e.children(n),i=e.node(n);if(r.length&&r.forEach(t),i&&Object.hasOwn(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(let t=i.minRank,r=i.maxRank+1;t<r;++t)Lr(e,`borderLeft`,`_bl`,n,i,t),Lr(e,`borderRight`,`_br`,n,i,t)}}e.children(Pn).forEach(t)}function Lr(e,t,n,r,i,a){let o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=K(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Rr(e){let t=e.graph().rankdir?.toLowerCase();(t===`lr`||t===`rl`)&&Br(e)}function zr(e){let t=e.graph().rankdir?.toLowerCase();(t===`bt`||t===`rl`)&&Hr(e),(t===`lr`||t===`rl`)&&(Wr(e),Br(e))}function Br(e){e.nodes().forEach(t=>Vr(e.node(t))),e.edges().forEach(t=>Vr(e.edge(t)))}function Vr(e){let t=e.width;e.width=e.height,e.height=t}function Hr(e){e.nodes().forEach(t=>Ur(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Ur),Object.hasOwn(r,`y`)&&Ur(r)})}function Ur(e){e.y=-e.y}function Wr(e){e.nodes().forEach(t=>Gr(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Gr),Object.hasOwn(r,`x`)&&Gr(r)})}function Gr(e){let t=e.x;e.x=e.y,e.y=t}function Kr(e,t=null){let n={},r=e.nodes().filter(t=>!e.children(t).length),i=r.map(t=>e.node(t).rank),a=An(q(Math.max,i)+1).map(()=>[]);function o(t){if(n[t])return;n[t]=!0;let r=e.node(t);a[r.rank].push(t);let i=e.successors(t);i&&[...i].sort((e,t)=>s(e,t)).forEach(o)}r.sort((t,n)=>e.node(t).rank-e.node(n).rank).forEach(o);function s(n,r){return Fn(t,e.node(n),e.node(r))}return a}function qr(e,t){let n=0;for(let r=1;r<t.length;++r)n+=Jr(e,t[r-1],t[r]);return n}function Jr(e,t,n){let r=Nn(n,n.map((e,t)=>t)),i=t.flatMap(t=>{let n=e.outEdges(t);return n?n.map(t=>({pos:r[t.w],weight:e.edge(t).weight})).sort((e,t)=>e.pos-t.pos):[]}),a=1;for(;a<n.length;)a<<=1;let o=2*a-1;--a;let s=Array(o).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;s[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n}),c}function Yr(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(!n||!n.length)return{v:t};{let r=n.reduce((t,n)=>{let r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}})}function Xr(e,t){let n={};return e.forEach((e,t)=>{let r={indegree:0,in:[],out:[],vs:[e.v],i:t};e.barycenter!==void 0&&(r.barycenter=e.barycenter,r.weight=e.weight),n[e.v]=r}),t.edges().forEach(e=>{let t=n[e.v],r=n[e.w];t!==void 0&&r!==void 0&&(r.indegree++,t.out.push(r))}),Zr(Object.values(n).filter(e=>!e.indegree))}function Zr(e){let t=[];function n(e){return t=>{t.merged||(t.barycenter===void 0||e.barycenter===void 0||t.barycenter>=e.barycenter)&&Qr(e,t)}}function r(t){return n=>{n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){let i=e.pop();t.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return t.filter(e=>!e.merged).map(e=>jn(e,[`vs`,`i`,`barycenter`,`weight`]))}function Qr(e,t){let n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function $r(e,t,n,r,i){let a={},o=null,s=null,c=i;typeof t==`boolean`?(c=t,a={}):t&&(a=t,o=n??null,s=r??null);let l=Tn(e,e=>Object.hasOwn(e,`barycenter`)),u=l.lhs,d=l.rhs.sort((e,t)=>t.i-e.i),f=[],p=0,m=0,h=0;u.sort(ti(s,o,!!c));for(let[e,t]of Object.entries(a)){let n=u.findIndex(t=>t.vs[0]===e);u.splice(n+1,0,t)}h=ei(f,d,h),u.forEach(e=>{h+=e.vs.length,f.push(e.vs),p+=e.barycenter*e.weight,m+=e.weight,h=ei(f,d,h)});let g={vs:f.flat(1)};return m&&(g.barycenter=p/m,g.weight=m),g}function ei(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function ti(e,t,n){return(r,i)=>{if(r.barycenter<i.barycenter)return-1;if(r.barycenter>i.barycenter)return 1;if(e&&(typeof r.vs[0]==`string`||typeof i.vs[0]==`string`)){let n=Fn(t,e.node(r.vs[0]),e.node(i.vs[0]));if(n!==0)return n}return n?i.i-r.i:r.i-i.i}}function ni(e,t,n,r,i){var a,o;let s=null,c=i;typeof r==`boolean`?(c=r,s=null):r!==void 0&&(s=r);let l=e.children(t),u=e.node(t),d=u?u.borderLeft:void 0,f=u?u.borderRight:void 0,p={};d&&(l=l.filter(e=>e!==d&&e!==f));let m=Yr(e,l);m.forEach(t=>{if(e.children(t.v).length){let{result:r}=ni(e,t.v,n,s,c);p[t.v]=r,Object.hasOwn(r,`barycenter`)&&ii(t,r)}});let h=Xr(m,n);ri(h,p);let g={},_=!1;for(let t=0;t<h.length;t++)for(let n=t+1;n<h.length;n++)if(h[t]&&h[n]&&(a=h[t])!=null&&a.barycenter&&(o=h[n])!=null&&o.barycenter&&h[t]?.barycenter===h[n].barycenter){let r=h[t]?.vs[0]??``,i=h[n]?.vs[0]??``,a=e.node(r),o=e.node(i);if(a.dummy===`edge`&&o.dummy===`edge`&&a.edgeObj?.v===o.edgeObj?.v&&a.edgeObj?.w===o.edgeObj?.w){if(a.edgeLabel.reversed){g[i]=h[t],h.splice(t,1),t--;break}g[r]=h[n],h.splice(n,1),n--}else _=!0}let v=$r(h,g,s,e,c);if(d&&f){v.vs=[d,v.vs,f].flat(1);let t=e.predecessors(d);if(t&&t.length){let n=e.node(t[0]),r=e.predecessors(f),i=e.node(r[0]);Object.hasOwn(v,`barycenter`)||(v.barycenter=0,v.weight=0),v.barycenter=(v.barycenter*v.weight+n.order+i.order)/(v.weight+2),v.weight+=2}}return Object.defineProperty(v,"result",{value:v,enumerable:!1,configurable:!0,writable:!0}),Object.defineProperty(v,"usedBias",{value:_,enumerable:!1,configurable:!0,writable:!0}),v}function ri(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}function ii(e,t){e.barycenter===void 0?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function ai(e,t,n,r){r||=e.nodes();let i=oi(e),a=new G({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(t=>e.node(t));return r.forEach(r=>{let o=e.node(r),s=e.parent(r);if(o.rank===t||o.minRank<=t&&t<=o.maxRank){a.setNode(r),a.setParent(r,s||i);let c=e[n](r);c&&c.forEach(t=>{let n=t.v===r?t.w:t.v,i=a.edge(n,r),o=i===void 0?0:i.weight;a.setEdge(n,r,{weight:e.edge(t).weight+o})}),Object.hasOwn(o,`minRank`)&&a.setNode(r,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]})}}),a}function oi(e){let t;for(;e.hasNode(t=kn(`_root`)););return t}function si(e,t,n){let r={},i;n.forEach(n=>{let a=e.parent(n),o,s;for(;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function ci(e,t={},n=null){if(typeof t.customOrder==`function`){t.customOrder(e,ci);return}let r=wn(e),i=li(e,An(1,r+1),`inEdges`),a=li(e,An(r-1,-1,-1),`outEdges`),o=Kr(e,n);if(di(e,o),t.disableOptimalOrderHeuristic)return;let s=1/0,c,l=t.constraints||[];for(let t=0,r=0;r<4;++t,++r){ui(t%2?i:a,t%4>=2,l,n),o=vn(e);let u=qr(e,o);u<s?(r=0,c=Object.assign({},o),s=u):u===s&&(c=structuredClone(o))}di(e,c)}function li(e,t,n){let r=new Map,i=(e,t)=>{r.has(e)||r.set(e,[]),r.get(e).push(t)};for(let t of e.nodes()){let n=e.node(t);if(typeof n.rank==`number`&&i(n.rank,t),typeof n.minRank==`number`&&typeof n.maxRank==`number`)for(let e=n.minRank;e<=n.maxRank;e++)e!==n.rank&&i(e,t)}return t.map(function(t){return ai(e,t,n,r.get(t)||[])})}function ui(e,t,n,r){let i=!0,a=new G;e.forEach(function(e){n.forEach(e=>a.setEdge(e.left,e.right));let o=e.graph().root,{result:s,usedBias:c}=ni(e,o,a,r,i);t&&c&&(i=!i),s.vs.forEach((t,n)=>e.node(t).order=n),si(e,a,s.vs)})}function di(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}function fi(e,t){let n={};function r(t,r){let i=0,a=0,o=t.length,s=r[r.length-1];return r.forEach((t,c)=>{let l=mi(e,t),u=l?e.node(l).order:o;(l||t===s)&&(r.slice(a,c+1).forEach(t=>{let r=e.predecessors(t);r&&r.forEach(r=>{let a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&hi(n,r,t)})}),a=c+1,i=u)}),r}return t.length&&t.reduce(r),n}function pi(e,t){let n={};function r(t,r,i,a,o){An(r,i).forEach(r=>{let i=t[r];if(i!==void 0&&e.node(i).dummy){let t=e.predecessors(i);t&&t.forEach(t=>{if(t===void 0)return;let r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&hi(n,t,i)})}})}function i(t,n){let i=-1,a=-1,o=0;return n.forEach((s,c)=>{if(e.node(s).dummy===`border`){let t=e.predecessors(s);if(t&&t.length){let s=t[0];if(s===void 0)return;a=e.node(s).order,r(n,o,c,i,a),o=c,i=a}}r(n,o,n.length,a,t.length)}),n}return t.length&&t.reduce(i),n}function mi(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(t=>e.node(t).dummy)}}function hi(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];r||(e[t]=r={}),r[n]=!0}function gi(e,t,n){if(t>n){let e=t;t=n,n=e}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function _i(e,t,n,r,i){let a={},o={},s={};return t.forEach(e=>{e.forEach((e,t)=>{a[e]=e,o[e]=e,s[e]=t})}),t.forEach(t=>{let c=-1,l=-1,u=!1,d=t,f=t.findIndex(t=>i?.includes(t)||Ei(t,e,i));f>0&&(d=[t[f],...t.slice(0,f),...t.slice(f+1)],u=!0),d.forEach(t=>{let d=r(t);if(d&&d.length){i!=null&&i.includes(t)&&(d=d.filter(t=>Ei(t,e,i)));let r=d.sort((e,t)=>{let n=s[e],r=s[t];return(n===void 0?0:n)-(r===void 0?0:r)}),f=(r.length-1)/2;for(let e=Math.floor(f),i=Math.ceil(f);e<=i;++e){let i=r[e];if(i===void 0)continue;let d=s[i];if(d!==void 0&&o[t]===t&&c<d&&s[i]!==l&&!gi(n,t,i)){let e=a[i];e!==void 0&&(o[i]=t,o[t]=a[t]=e,c=d,u&&=(c=-1,l=s[i]??-1,!1))}}}})}),{root:a,align:o}}function vi(e,t,n,r,i=!1){let a={},o=yi(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){let n=o.nodes().slice(),r={},i=n.pop();for(;i;){if(r[i])e(i);else{r[i]=!0,n.push(i);for(let e of t(i))n.push(e)}i=n.pop()}}function l(e){let t=o.inEdges(e);t?a[e]=t.reduce((e,t)=>{let n=a[t.v]??0,r=o.edge(t);return Math.max(e,n+(r===void 0?0:r))},0):a[e]=0}function u(t){let n=o.outEdges(t),r=1/0;n&&(r=n.reduce((e,t)=>{let n=a[t.w],r=o.edge(t);return Math.min(e,(n===void 0?0:n)-(r===void 0?0:r))},1/0));let i=e.node(t);r!==1/0&&i.borderType!==s&&(a[t]=Math.max(a[t]===void 0?0:a[t],r))}function d(e){return o.predecessors(e)||[]}function f(e){return o.successors(e)||[]}return c(l,d),c(u,f),Object.keys(r).forEach(e=>{let t=n[e];t!==void 0&&(a[e]=a[t]??0)}),a}function yi(e,t,n,r){let i=new G,a=e.graph(),o=wi(a.nodesep,a.edgesep,r);return t.forEach(t=>{let r;t.forEach(t=>{let a=n[t];if(a!==void 0){if(i.setNode(a),r!==void 0){let s=n[r];if(s!==void 0){let n=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),n||0))}}r=t}})}),i}function bi(e,t){return Object.values(t).reduce((t,n)=>{let r=-1/0,i=1/0;Object.entries(n).forEach(([t,n])=>{let a=Ti(e,t)/2;r=Math.max(n+a,r),i=Math.min(n-a,i)});let a=r-i;return a<t[0]&&(t=[a,n]),t},[1/0,null])[1]}function xi(e,t){let n=Object.values(t),r=q(Math.min,n),i=q(Math.max,n);[`u`,`d`].forEach(n=>{[`l`,`r`].forEach(a=>{let o=n+a,s=e[o];if(!s||s===t)return;let c=Object.values(s),l=r-q(Math.min,c);a!==`l`&&(l=i-q(Math.max,c)),l&&(e[o]=Mn(s,e=>e+l))})})}function Si(e,t=void 0){let n=e.ul;return n?Mn(n,(n,r)=>{if(t){let n=e[t.toLowerCase()];if(n&&n[r]!==void 0)return n[r]}let i=Object.values(e).map(e=>{let t=e[r];return t===void 0?0:t}).sort((e,t)=>e-t);return((i[1]??0)+(i[2]??0))/2}):{}}function Ci(e,t){let n=vn(e),r=Object.assign(fi(e,n),pi(e,n)),i={},a;return[`u`,`d`].forEach(o=>{a=o===`u`?n:Object.values(n).reverse(),[`l`,`r`].forEach(n=>{n===`r`&&(a=a.map(e=>Object.values(e).reverse()));let s=_i(e,a,r,t=>(o===`u`?e.predecessors(t):e.successors(t))||[],t),c=vi(e,a,s.root,s.align,n===`r`);n===`r`&&(c=Mn(c,e=>-e)),i[o+n]=c})}),xi(i,bi(e,i)),Si(i,e.graph().align)}function wi(e,t,n){return(r,i,a)=>{let o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.hasOwn(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=void 0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.hasOwn(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),c}}function Ti(e,t){return e.node(t).width}function Ei(e,t,n){if(!n)return!1;let r=t.node(e)?.edgeObj;if(!r||t.node(e).edgeLabel.reversed)return!1;let i=n.indexOf(r?.v),a=n.indexOf(r?.w);return i!==-1&&a!==-1&&i===(a+1)%n.length||i===(a-1)%n.length}function Di(e,t){e=gn(e),Oi(e),Object.entries(Ci(e,t)).forEach(([t,n])=>e.node(t).x=n)}function Oi(e){let t=vn(e),n=e.graph(),r=n.ranksep,i=n.rankalign,a=0;t.forEach(t=>{let n=t.reduce((t,n)=>{let r=e.node(n).height??0;return t>r?t:r},0);t.forEach(t=>{let r=e.node(t);r.y=i===`top`?a+r.height/2:i===`bottom`?a+n-r.height/2:a+n/2}),a+=n+r})}var ki=new WeakMap;function Ai(e,t={}){return Mi(e,Dn,t),e}function ji(e,t,n){let r=t;for(;r!==void 0;){let t=e.parent(r);if(t===n)return r;r=t}}function Mi(e,t,n){let r=e.nodes().filter(t=>e.children(t).length),i={};r.forEach(r=>{let a=e.node(r);if(a&&a.rankdir){let o=new G({multigraph:!0,compound:!0});o.setGraph({rankdir:a.rankdir});let s=e.children(r);s.forEach(t=>{let n={...e.node(t)};o.setNode(t,n);let i=e.parent(t);i&&i!==r&&s.includes(i)&&o.setParent(t,i)});let c=new Set;e.edges().forEach(t=>{let n=ji(e,t.v,r),i=ji(e,t.w,r);if(n&&i&&n!==i){let r=`${n}\0${i}`;c.has(r)||(c.add(r),o.setEdge(n,i,{...e.edge(t)}))}}),Mi(o,t,n);let l=Ui(o);Ni(l,t,n,null),Pi(o,l);let u=1/0,d=1/0,f=-1/0,p=-1/0;o.nodes().forEach(e=>{if(e===r)return;let t=o.node(e);t&&typeof t.x==`number`&&typeof t.y==`number`&&typeof t.width==`number`&&typeof t.height==`number`&&(u=Math.min(u,t.x-t.width/2),f=Math.max(f,t.x+t.width/2),d=Math.min(d,t.y-t.height/2),p=Math.max(p,t.y+t.height/2))}),(!isFinite(u)||!isFinite(d)||!isFinite(f)||!isFinite(p))&&(u=d=0,f=p=0);let m=f-u,h=p-d;i[r]={minX:u,minY:d,maxX:f,maxY:p,width:m,height:h,offsetX:u,offsetY:d},a._dagreClusterSubgraph=o}});let a=[],o=t=>{let n=[],r=(e.children(t)||[]).filter(e=>e!==t);for(;r.length>0;){let t=r.shift();n.push(t),(e.children(t)||[]).filter(e=>e!==t).forEach(e=>r.push(e))}return n},s=new Map;r.forEach(t=>{let n=e.node(t);n&&n.rankdir&&i[t]&&s.set(t,(e.children(t)||[]).filter(e=>e!==t))});let c=new Set([...s.values()].flat()),l=new Map;s.forEach((e,t)=>{c.has(t)||l.set(t,o(t))});let u=new Set([...l.values()].flat()),d=e=>{for(let[t,n]of l)if(n.includes(e))return t;return e},f=[];e.edges().forEach(t=>{(u.has(t.v)||u.has(t.w))&&f.push({edge:t,label:e.edge(t)})});let p=new Map;u.forEach(t=>{let n=e.parent(t);p.set(t,typeof n==`string`?n:void 0)}),l.forEach((t,n)=>{let r=e.node(n),o=[];t.forEach(t=>{let n=e.node(t);n&&(o.push({id:t,node:n,parent:p.get(t)}),e.removeNode(t))});let s=f.filter(({edge:e})=>t.includes(e.v)||t.includes(e.w)),c=i[n];r&&(a.push({clusterId:n,subgraph:r._dagreClusterSubgraph,bounds:c,children:t,removedNodes:o,removedEdges:s}),r.width=c.width,r.height=c.height)});let m=new Set;f.forEach(({edge:t,label:n})=>{let r=d(t.v),i=d(t.w);if(r!==i&&e.hasNode(r)&&e.hasNode(i)){let t=`${r}\0${i}`;m.has(t)||(m.add(t),e.setEdge(r,i,{...n,width:0,height:0}))}});let h=Ui(e),g=Ni(h,t,n,ki.get(e)??null);ki.set(e,g),Pi(e,h),m.forEach(t=>{let n=t.indexOf(`\0`),r=t.slice(0,n),i=t.slice(n+1);e.hasEdge(r,i)&&e.removeEdge(r,i)}),a.forEach(({clusterId:t,subgraph:n,bounds:r,removedNodes:i,removedEdges:a})=>{let o=e.node(t),s=o?.x??0,c=o?.y??0,l=(r.minX+r.maxX)/2,u=(r.minY+r.maxY)/2;i.forEach(({id:t,node:n,parent:r})=>{e.setNode(t,n),r!==void 0&&e.setParent(t,r)}),a.forEach(({edge:t,label:n})=>{e.setEdge(t,n)}),n.nodes().forEach(r=>{if(r===t)return;let i=n.node(r),a=e.node(r);a&&i&&typeof i.x==`number`&&typeof i.y==`number`&&(a.x=s+(i.x-l),a.y=c+(i.y-u))}),delete o._dagreClusterSubgraph}),r.forEach(t=>{let n=e.node(t),r=i[t];if(n&&n.rankdir&&n._dagreClusterSubgraph&&r){let i=n._dagreClusterSubgraph,a=n.x??0,o=n.y??0,s=(r.minX+r.maxX)/2,c=(r.minY+r.maxY)/2;i.nodes().forEach(n=>{if(n===t)return;let r=i.node(n),l=e.node(n);if(l&&r&&typeof r.x==`number`&&typeof r.y==`number`){let e=r.x-s,t=r.y-c;l.x=a+e,l.y=o+t}}),delete n._dagreClusterSubgraph}})}function Ni(e,t,n,r=null){var i,a;let o=n?.useDynamic!==!1,s=o&&(i=r?.graph)!=null?i:null,c=o&&(a=r?.rawNodes)!=null?a:null;t(` makeSpaceForEdgeLabels`,()=>Wi(e)),t(` removeSelfEdges`,()=>$i(e)),t(` acyclic`,()=>Jn(e,s)),t(` nestingGraph.run`,()=>Ar(e)),t(` rank`,()=>xr(gn(e))),t(` injectEdgeLabelProxies`,()=>Gi(e)),t(` removeEmptyRanks`,()=>bn(e)),t(` nestingGraph.cleanup`,()=>Pr(e)),t(` normalizeRanks`,()=>yn(e)),t(` assignRankMinMax`,()=>Ki(e)),t(` removeEdgeLabelProxies`,()=>qi(e)),t(` normalize.run`,()=>Qn(e)),t(` parentDummyChains`,()=>Er(e)),t(` addBorderSegments`,()=>Fr(e)),t(` order`,()=>ci(e,n,c)),t(` insertSelfEdges`,()=>ea(e)),t(` adjustCoordinateSystem`,()=>Rr(e)),t(` position`,()=>Di(e,n.corePath)),t(` positionSelfEdges`,()=>ta(e));let l=JSON.parse(JSON.stringify(e._nodes));return t(` removeBorderNodes`,()=>Qi(e)),t(` normalize.undo`,()=>er(e)),t(` fixupEdgeLabelCoords`,()=>Xi(e)),t(` undoCoordinateSystem`,()=>zr(e)),t(` translateGraph`,()=>Ji(e)),t(` assignNodeIntersects`,()=>Yi(e)),t(` reversePoints`,()=>Zi(e)),t(` acyclic.undo`,()=>Xn(e)),{graph:e,rawNodes:l}}function Pi(e,t){e.nodes().forEach(n=>{let r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,r.order=i.order,r.rank=i.rank,t.children(n).length&&(r.width=i.width,r.height=i.height))}),e.edges().forEach(n=>{let r=e.edge(n),i=t.edge(n);r.points=i.points,Object.hasOwn(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var Fi=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],Ii={ranksep:50,edgesep:20,nodesep:50,rankdir:`TB`,rankalign:`center`},Li=[`acyclicer`,`ranker`,`rankdir`,`align`,`rankalign`],Ri=[`width`,`height`,`rank`],zi={width:0,height:0},Bi=[`minlen`,`weight`,`width`,`height`,`labeloffset`],Vi={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},Hi=[`labelpos`];function Ui(e){let t=new G({multigraph:!0,compound:!0}),n=ra(e.graph());return t.setGraph(Object.assign({},Ii,na(n,Fi),jn(n,Li))),e.nodes().forEach(n=>{let r=na(ra(e.node(n)),Ri);Object.keys(zi).forEach(e=>{r[e]===void 0&&(r[e]=zi[e])}),t.setNode(n,r);let i=e.parent(n);i!==void 0&&t.setParent(n,i)}),e.edges().forEach(n=>{let r=ra(e.edge(n));t.setEdge(n,Object.assign({},Vi,na(r,Bi),jn(r,Hi)))}),t}function Wi(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let r=e.edge(n);r.minlen*=2,(r.labelpos??`r`).toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function Gi(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v);K(e,`edge-proxy`,{rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t},`_ep`)}})}function Ki(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function qi(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy===`edge-proxy`){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Ji(e){let t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){let a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}e.nodes().forEach(t=>c(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,`x`)&&c(n)}),t-=o,r-=s,e.nodes().forEach(n=>{let i=e.node(n);i.x-=t,i.y-=r}),e.edges().forEach(n=>{let i=e.edge(n);i.points.forEach(e=>{e.x-=t,e.y-=r}),Object.hasOwn(i,`x`)&&(i.x-=t),Object.hasOwn(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function Yi(e){e.edges().forEach(t=>{if(t.v===t.w)return;let n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(_n(r,a)),n.points.push(_n(i,o))})}function Xi(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function Zi(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Qi(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(n.borderLeft[n.borderLeft.length-1]),o=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy===`border`&&e.removeNode(t)})}function $i(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function ea(e){vn(e).forEach(t=>{let n=0;t.forEach((t,r)=>{let i=e.node(t);typeof i.rank!=`number`&&(i.rank=0),i.order=r+n,(i.selfEdges||[]).forEach(t=>{K(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,edgeLabel:t.label},`_se`),(!Array.isArray(t.label.points)||t.label.points.length!==7)&&(t.label.points=[{x:0,y:-10},{x:0,y:-10},{x:0,y:0},{x:0,y:10},{x:0,y:10},{x:0,y:0},{x:0,y:0}])}),delete i.selfEdges})})}function ta(e){e.nodes().forEach(t=>{let n=e.node(t),r=e=>typeof e==`number`&&isFinite(e);if(n.dummy===`selfedge`){let i=n,a=e.node(i.e.v),o=r(a?.x)?a.x:0,s=r(a?.y)?a.y:0,c=r(a?.width)?a.width:0,l=r(a?.height)?a.height:0,u=r(n.x)?n.x:o,d=r(n.y)?n.y:s,f=c/2,p=l/2;i.edgeLabel.points=[{x:u+f,y:d-p},{x:u+f,y:d-p},{x:u,y:d},{x:u-f,y:d+p},{x:u-f,y:d+p},{x:u,y:d},{x:u,y:d}],i.edgeLabel.x=u,i.edgeLabel.y=d,e.setEdge(i.e,i.edgeLabel),e.removeNode(t)}else n&&Array.isArray(n.selfEdges)&&n.selfEdges.forEach(e=>{if(!Array.isArray(e.label.points)||e.label.points.length!==7){let t=r(n.x)?n.x:0,i=r(n.y)?n.y:0,a=r(n.width)?n.width:0,o=r(n.height)?n.height:0,s=a/2,c=o/2;e.label.points=[{x:t+s,y:i-c},{x:t+s,y:i-c},{x:t,y:i},{x:t-s,y:i+c},{x:t-s,y:i+c},{x:t,y:i},{x:t,y:i}]}})})}function na(e,t){return Mn(jn(e,t),Number)}function ra(e){let t={};return e&&Object.entries(e).forEach(([e,n])=>{typeof e==`string`&&(e=e.toLowerCase()),t[e]=n}),t}function ia(e){let t=vn(e),n=new G({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(t=>{n.setNode(t,{label:t}),n.setParent(t,`layer`+e.node(t).rank)}),e.edges().forEach(e=>n.setEdge(e.v,e.w,{},e.name)),t.forEach((e,t)=>{let r=`layer`+t;n.setNode(r,{rank:`same`}),e.reduce((e,t)=>(n.setEdge(e,t,{style:`invis`}),t))}),n}var aa={graphlib:kt,version:In,layout:Ai,debug:ia,util:{time:En,notime:Dn}};function oa(e,t){let n=t.steps.map(e=>e.type===`agent`?`${e.id}:${e.model??``}:${e.tools.join(`+`)}:${e.output.format}`:e.type===`generate`?`${e.id}:${e.asset}:${e.model??``}:${e.options?.duration??``}`:e.id).join(`|`);return c({queryKey:[`estimate`,e,n],queryFn:()=>u.get(`/api/studio/wizards/${e}/estimate`),staleTime:3e4,refetchOnMount:`always`})}var sa=e=>e<10?e.toLocaleString(void 0,{maximumFractionDigits:1}):Math.round(e).toLocaleString();function ca({estimate:e,stepId:t}){let n=e?.available?e.steps[t]:void 0;return n?(0,W.jsxs)(`p`,{className:`text-[12px] text-ink-3 tabular-nums`,children:[H(`estimate.step`,{n:sa(n.credits),high:sa(n.high)}),` · `,n.measured?H(`estimate.measured`):H(`estimate.formula`)]}):null}function la({model:e,effort:t,onChange:n}){let r=H(`class.effortAuto`);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(M,{children:H(`class.label`)}),(0,W.jsx)(V,{value:e??`high`,onChange:e=>n({model:e,effort:t}),options:D.map(e=>({value:e,label:H(`class.${e}`)}))}),(0,W.jsx)(`p`,{className:`text-[12px] text-ink-3`,children:H(`class.${e??`high`}.hint`)}),(0,W.jsx)(M,{children:H(`class.effort`)}),(0,W.jsx)(P,{value:t?H(`class.effort.${t}`):r,options:[r,...E.map(e=>H(`class.effort.${e}`))],onChange:t=>n({model:e,effort:E.find(e=>H(`class.effort.${e}`)===t)})})]})}var ua=280,da=92;function fa({data:e}){let{step:t,selected:n,issue:r,active:i,pulse:a,cost:o,passed:s}=e,c=S(t);return(0,W.jsxs)(`div`,{className:N(`relative w-[280px] cursor-pointer rounded-xl bg-card px-4 py-3 text-left shadow-soft ring-1 transition`,n?`shadow-elevated ring-2 ring-ember`:i?`ring-2 ring-moss`:a?`ring-2 ring-ember/60`:`ring-border-soft hover:shadow-elevated`),children:[i?(0,W.jsx)(`span`,{className:`-top-1 -right-1 absolute size-3 animate-breathe rounded-full bg-moss`}):a?(0,W.jsx)(`span`,{className:`-top-1 -right-1 absolute size-3 animate-breathe rounded-full bg-ember`}):null,(0,W.jsx)(Ke,{type:`target`,position:He.Top}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:N(`inline-flex size-6 items-center justify-center rounded-md`,se[t.type]),children:(0,W.jsx)(c,{className:`size-3.5`})}),(0,W.jsx)(`span`,{className:`font-medium text-[11px] text-ink-3 uppercase tracking-[0.07em]`,children:x(t)}),r?(0,W.jsx)(tt,{className:`ml-auto size-4 text-rose`}):s&&!i?(0,W.jsx)(ce,{className:`ml-auto size-4 text-moss`}):o===null?null:(0,W.jsxs)(`span`,{className:`ml-auto text-[11px] text-ink-3 tabular-nums`,children:[`≈`,` `,o<10?o.toLocaleString(void 0,{maximumFractionDigits:1}):Math.round(o),` `,`cr`]})]}),(0,W.jsx)(`div`,{className:`mt-1.5 truncate font-display font-semibold text-[15px] text-ink`,children:t.title}),(0,W.jsx)(`div`,{className:`truncate text-[12px] text-ink-3`,children:ae(t)||`\xA0`}),(0,W.jsx)(Ke,{type:`source`,position:He.Bottom})]})}function pa({data:e}){return(0,W.jsxs)(`div`,{className:N(`flex w-[280px] cursor-pointer items-center gap-3 rounded-full bg-paper-2 py-1.5 pr-5 pl-2 transition`,e.selected?`ring-2 ring-ember`:`hover:bg-paper-3`),children:[(0,W.jsx)(s,{kind:e.avatar,size:40,interactive:!1}),(0,W.jsx)(`span`,{className:`truncate font-display font-semibold text-[15px]`,children:e.title}),(0,W.jsx)(Ke,{type:`source`,position:He.Bottom})]})}function ma(e){let{data:t,sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s}=e,c={label:e.label,labelStyle:e.labelStyle,labelBgStyle:e.labelBgStyle,labelBgPadding:e.labelBgPadding,labelBgBorderRadius:e.labelBgBorderRadius,style:e.style,markerEnd:e.markerEnd};if(!t?.points.length){let[e,t,l]=We({sourceX:n,sourceY:r,targetX:i,targetY:a,sourcePosition:o,targetPosition:s});return(0,W.jsx)(Je,{path:e,labelX:t,labelY:l,...c})}let l=[{x:n,y:r},...t.points,{x:i,y:a}],u=l.map((e,t)=>{let n=l[t-1];if(!n)return`M ${e.x} ${e.y}`;let r=(n.y+e.y)/2;return`C ${n.x} ${r} ${e.x} ${r} ${e.x} ${e.y}`}).join(` `);return(0,W.jsx)(Je,{path:u,labelX:t.labelX,labelY:t.labelY,...c})}var ha={step:fa,start:pa},ga={branch:ma},_a=34,va={};function ya(e){let t=Array.isArray(e.when.value)?e.when.value.join(` / `):String(e.when.value??``);switch(e.when.op){case`equals`:return`${e.when.field} = ${t}`;case`notEquals`:return`${e.when.field} ≠ ${t}`;case`in`:return`${e.when.field} ∈ ${t}`;case`notEmpty`:return H(`editor.whenFilled`,{field:e.when.field});case`empty`:return H(`editor.whenEmpty`,{field:e.when.field})}}function ba(e,t,n,r,i,a,o){let s=new aa.graphlib.Graph;s.setGraph({rankdir:`TB`,nodesep:48,ranksep:46,marginx:20,marginy:20}),s.setDefaultEdgeLabel(()=>({})),s.setNode(`__start`,{width:ua,height:52});for(let t of e.steps)s.setNode(t.id,{width:ua,height:da});let c=[],l={markerEnd:{type:qe.ArrowClosed,width:14,height:14,color:`var(--ink-4)`}};e.steps[0]&&(s.setEdge(`__start`,e.steps[0].id),c.push({id:`e-start`,source:`__start`,target:e.steps[0].id,...l})),e.steps.forEach((t,n)=>{let r=e.steps[n+1],i=new Map;for(let n of t.next??[])n.goto!==`end`&&e.steps.some(e=>e.id===n.goto)&&i.set(n.goto,[...i.get(n.goto)??[],ya(n)]);for(let[e,n]of i){let r=n.join(` · `),i=r.length>_a?`${r.slice(0,33)}…`:r;s.setEdge(t.id,e,{width:i.length*6.2+16,height:22,labelpos:`c`}),c.push({id:`b-${t.id}-${e}`,type:`branch`,source:t.id,target:e,label:i,labelStyle:{fontSize:11,fill:`var(--ink-2)`},labelBgStyle:{fill:`var(--paper-2)`},labelBgPadding:[6,3],labelBgBorderRadius:8,style:{strokeDasharray:`5 4`},...l})}r&&t.type!==`result`&&(s.hasEdge(t.id,r.id)||s.setEdge(t.id,r.id),c.push({id:`n-${t.id}`,source:t.id,target:r.id,...t.next?.length?{label:H(`editor.otherwise`),labelStyle:{fontSize:11,fill:`var(--ink-3)`},labelBgStyle:{fill:`var(--background)`}}:{},...l}))}),aa.layout(s);for(let e of c){if(e.type!==`branch`)continue;let t=s.edge(e.source,e.target),n=(t.points??[]).slice(1,-1);n.length&&t.x!==void 0&&t.y!==void 0&&(e.data={points:n,labelX:t.x,labelY:t.y})}return{nodes:[{id:`__start`,type:`start`,position:{x:s.node(`__start`).x-ua/2,y:s.node(`__start`).y-26},data:{title:e.title,avatar:e.avatar,selected:t===`__wizard`},draggable:!1},...e.steps.map((e,c)=>{let l=s.node(e.id);return{id:e.id,type:`step`,position:{x:l.x-ua/2,y:l.y-da/2},data:{step:e,selected:t===e.id,issue:n.has(e.id),index:c,active:r===e.id,pulse:i.includes(e.id),cost:a[e.id]?.credits??null,passed:o.has(e.id)},draggable:!1}})],edges:c}}function xa(){let e=Ge(),t=`inline-flex size-8 items-center justify-center rounded-full text-ink-3 hover:bg-accent hover:text-ink`;return(0,W.jsxs)(`div`,{className:`absolute bottom-4 left-4 z-10 flex items-center gap-0.5 rounded-full bg-card p-1 shadow-soft ring-1 ring-border-soft`,children:[(0,W.jsx)(`button`,{type:`button`,className:t,onClick:()=>e.zoomOut(),"aria-label":`Zoom out`,children:(0,W.jsx)(ht,{className:`size-4`})}),(0,W.jsx)(`button`,{type:`button`,className:t,onClick:()=>e.fitView({padding:.2,duration:300}),"aria-label":`Fit`,children:(0,W.jsx)(xt,{className:`size-4`})}),(0,W.jsx)(`button`,{type:`button`,className:t,onClick:()=>e.zoomIn(),"aria-label":`Zoom in`,children:(0,W.jsx)(C,{className:`size-4`})})]})}var Sa=.8,Ca=new Set;function wa({def:e,selected:t,onSelect:n,issueSteps:r,activeStep:i,pulse:a,costs:o=va,passed:s=Ca,minFitZoom:c=Sa,fitKey:l}){let{nodes:u,edges:d}=(0,U.useMemo)(()=>ba(e,t,r,i,a??[],o,s),[e,t,r,i,a,o,s]),f=Ge(),p=(0,U.useRef)(null),m=e.steps.map(e=>e.id).join(`|`);return(0,U.useEffect)(()=>{let e=requestAnimationFrame(()=>{let e=p.current;if(!e||!u.length)return;let t=u.map(e=>e.position.x),n=u.map(e=>e.position.y),r={x:Math.min(...t),y:Math.min(...n),width:Math.max(...t)+ua-Math.min(...t),height:Math.max(...n)+da-Math.min(...n)},i=Math.min(e.clientWidth/(r.width*1.2),e.clientHeight/(r.height*1.15),1),a=Math.max(i,c),o=(e.clientWidth-r.width*a)/2-r.x*a,s=i>=c?(e.clientHeight-r.height*a)/2-r.y*a:24-r.y*a;f.setViewport({x:o,y:s,zoom:a},{duration:400})});return()=>cancelAnimationFrame(e)},[m,l,f]),(0,W.jsx)(`div`,{ref:p,className:`h-full w-full`,children:(0,W.jsx)(Ve,{nodes:u,edges:d,nodeTypes:ha,edgeTypes:ga,onNodeClick:(e,t)=>n(t.id===`__start`?`__wizard`:t.id),onPaneClick:()=>n(null),nodesConnectable:!1,nodesDraggable:!1,elementsSelectable:!1,panOnScroll:!0,zoomOnScroll:!1,zoomOnPinch:!0,minZoom:.3,maxZoom:1.4,proOptions:{hideAttribution:!0},children:(0,W.jsx)(xa,{})})})}function Ta(e){return(0,W.jsx)(Ue,{children:(0,W.jsx)(wa,{...e})})}function Ea({wizardId:e,...t}){let n=oa(e,t.def);return(0,W.jsx)(Ta,{...t,costs:n.data?.available?n.data.steps:va})}var Da={text:`Kurzer Text`,textarea:`Langer Text`,number:`Zahl`,select:`Auswahl`,multiselect:`Mehrfachauswahl`,date:`Datum`,email:`E-Mail`,url:`Link`,toggle:`Ja/Nein`,color:`Farbe`,image:`Bild-Upload`,file:`Datei-Upload`,items:`Positionen (Tabelle)`,connection:`Konto verbinden`,list:`Gespeicherte Liste`,location:`Standort`,audio:`Sprachnotiz`,signature:`Unterschrift`};function Oa(e,t){let n=t===`image`||t===`file`;return{...e,kind:t,multiple:n?e.multiple:void 0,camera:t===`file`?e.camera:void 0,video:t===`file`?e.video:void 0,scan:t===`text`?e.scan:void 0}}var ka=(0,U.createContext)(!1);function Aa({className:e,children:t}){return(0,U.useContext)(ka)?(0,W.jsx)(`fieldset`,{disabled:!0,className:N(`min-w-0`,e),children:t}):(0,W.jsx)(`div`,{className:e,children:t})}function X({title:e,children:t,loose:n}){let r=`flex flex-col gap-4`;return(0,W.jsxs)(`div`,{className:`border-border-soft border-t px-5 py-5 first:border-t-0`,children:[e?(0,W.jsx)(`h4`,{className:`mb-3 font-medium text-[12px] text-ink-3 uppercase tracking-[0.07em]`,children:e}):null,n?(0,W.jsx)(`div`,{className:r,children:t}):(0,W.jsx)(Aa,{className:r,children:t})]})}function ja(e,t){let n=new Set([...e.steps.map(e=>e.id),...e.steps.flatMap(e=>e.type===`page`?e.fields.map(e=>e.id):[])]),r=1,i=t;for(;n.has(i);)r+=1,i=`${t}${r}`;return i}function Ma({def:e,field:t,onChange:n,onRemove:r,onMove:i}){let[a,o]=(0,U.useState)(!1);return(0,W.jsxs)(`div`,{className:`rounded-lg bg-paper ring-1 ring-border-soft`,children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`flex w-full items-center gap-2 px-3 py-2.5 text-left`,children:[(0,W.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[14px]`,children:[t.label,t.required?(0,W.jsx)(`span`,{className:`ml-1 text-ember`,children:`*`}):null]}),(0,W.jsx)(`span`,{className:`text-[12px] text-ink-4`,children:Da[t.kind]}),(0,W.jsx)(le,{className:N(`size-4 text-ink-4 transition`,a&&`rotate-180`)})]}),a?(0,W.jsxs)(Aa,{className:`flex flex-col gap-3 border-border-soft border-t px-3 py-3`,children:[(0,W.jsx)(z,{value:t.label,onChange:e=>n({...t,label:e.target.value})}),(0,W.jsx)(V,{value:t.kind,onChange:e=>n(Oa(t,e)),options:xe.filter(e=>e!==`items`||t.kind===`items`).map(e=>({value:e,label:Da[e]}))}),t.kind===`select`||t.kind===`multiselect`?(0,W.jsx)(z,{placeholder:`Option A, Option B, Option C`,value:(t.options??[]).join(`, `),onChange:e=>n({...t,options:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})}):null,t.kind===`connection`?(0,W.jsx)(V,{value:t.connection??``,placeholder:`Welches Konto?`,onChange:e=>n({...t,connection:e}),options:(e.connections??[]).map(e=>({value:e.id,label:e.title??e.id}))}):null,t.kind===`list`?(0,W.jsx)(V,{value:t.list??``,placeholder:`Welche Liste?`,onChange:e=>n({...t,list:e}),options:(e.lists??[]).map(e=>({value:e.id,label:e.title}))}):null,t.kind===`image`||t.kind===`file`?(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Mehrere Dateien`}),(0,W.jsx)(L,{checked:!!t.multiple,onChange:e=>n({...t,multiple:e||void 0,...e?{}:{min:void 0,max:void 0}})})]}):null,(t.kind===`image`||t.kind===`file`)&&t.multiple?(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Wie viele?`}),(0,W.jsx)(`div`,{className:`flex items-center gap-1.5`,children:[`min`,`max`].map(e=>(0,W.jsx)(z,{type:`number`,min:1,max:30,"aria-label":e===`min`?`Mindestens`:`Höchstens`,placeholder:e===`min`?`min.`:`max.`,value:t[e]??``,onChange:r=>{let i=Math.round(Number(r.target.value));n({...t,[e]:r.target.value&&i>=1?Math.min(i,30):void 0})},className:`h-8 w-16 text-right`},e))})]}):null,t.kind===`file`?(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Auch mit der Kamera aufnehmen`}),(0,W.jsx)(L,{checked:!!t.camera,onChange:e=>n({...t,camera:e||void 0})})]}):null,t.kind===`file`?(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Kamera nimmt auch kurze Videos auf`}),(0,W.jsx)(L,{checked:!!t.video,onChange:e=>n({...t,video:e||void 0})})]}):null,t.kind===`text`?(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`QR- oder Barcode scannen`}),(0,W.jsx)(L,{checked:!!t.scan,onChange:e=>n({...t,scan:e||void 0})})]}):null,[`text`,`textarea`,`number`,`email`,`url`,`location`].includes(t.kind)?(0,W.jsx)(z,{placeholder:`Platzhalter`,value:t.placeholder??``,onChange:e=>n({...t,placeholder:e.target.value||void 0})}):null,(0,W.jsx)(z,{placeholder:`Hilfetext`,value:t.help??``,onChange:e=>n({...t,help:e.target.value||void 0})}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:H(`run.required`)}),(0,W.jsx)(L,{checked:!!t.required,onChange:e=>n({...t,required:e})})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`font-mono text-[11px] text-ink-4`,children:`{{${t.id}}}`}),(0,W.jsxs)(`div`,{className:`flex`,children:[(0,W.jsx)(I,{label:H(`editor.moveUp`),onClick:()=>i(-1),className:`size-8`,children:(0,W.jsx)(y,{className:`size-3.5`})}),(0,W.jsx)(I,{label:H(`editor.moveDown`),onClick:()=>i(1),className:`size-8`,children:(0,W.jsx)(te,{className:`size-3.5`})}),(0,W.jsx)(I,{label:`Entfernen`,onClick:r,className:`size-8 hover:text-rose`,children:(0,W.jsx)(T,{className:`size-3.5`})})]})]})]}):null]})}var Na=[{label:`16:9`,width:1280,height:720},{label:`1:1`,width:1080,height:1080},{label:`4:5`,width:1080,height:1350},{label:`9:16`,width:1080,height:1920}];function Pa(e,t){let n=[];for(let r of e.steps.slice(0,t))r.type===`page`?n.push(...r.fields.map(e=>e.id)):r.type===`agent`?n.push(`steps.${r.id}`,...(r.output.fields??[]).map(e=>`steps.${r.id}.${e.id}`)):(r.type===`generate`||r.type===`widget`)&&n.push(`steps.${r.id}`);return[...n,`brand.name`,`today`]}function Fa({def:e,step:t,set:n,files:r,wizardId:i}){let a=r.filter(e=>e.mime===`text/html`),s=r.filter(e=>e.mime===`application/json`),c=t.size??Na[0],l=Pa(e,e.steps.indexOf(t)),u=Object.entries(t.data),d=e=>n({...t,data:Object.fromEntries(e)}),f=[r.find(e=>e.path===t.entry)?.hash.slice(0,8),r.find(e=>e.path===t.sample)?.hash.slice(0,8),c.width,c.height].join(`-`),p=r.some(e=>e.path===t.entry);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{title:`Vorschau mit Beispieldaten`,children:p?(0,W.jsx)(b,{src:o(`/api/studio/wizards/${i}/widgets/${t.id}/preview?v=${f}`),page:c.width,height:c.height,fit:!0}):(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:`Das Widget ist noch nicht gebaut. Bitte im Gespräch darum – oder lade eine HTML-Datei unter „Dateien“ hoch.`})}),(0,W.jsxs)(X,{title:`Widget`,children:[(0,W.jsx)(M,{children:`HTML-Datei`}),(0,W.jsx)(V,{value:t.entry,onChange:e=>n({...t,entry:e}),options:(a.some(e=>e.path===t.entry)?a:[{path:t.entry},...a]).map(e=>({value:e.path,label:e.path}))}),(0,W.jsx)(M,{children:`Beispieldaten`}),(0,W.jsx)(V,{value:t.sample??``,onChange:e=>n({...t,sample:e||void 0}),options:[{value:``,label:`keine`},...s.map(e=>({value:e.path,label:e.path}))]}),(0,W.jsx)(M,{children:`Größe`}),(0,W.jsx)(P,{value:Na.find(e=>e.width===c.width&&e.height===c.height)?.label??``,options:Na.map(e=>e.label),onChange:e=>{let r=Na.find(t=>t.label===e);r&&n({...t,size:{width:r.width,height:r.height}})}})]}),(0,W.jsxs)(X,{title:`Daten für das Widget`,children:[(0,W.jsx)(`datalist`,{id:`sources-${t.id}`,children:l.map(e=>(0,W.jsx)(`option`,{value:e},e))}),u.map(([e,n],r)=>(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(z,{value:e,className:`w-28 font-mono text-[12px]`,onChange:e=>d(u.map((t,n)=>n===r?[e.target.value,t[1]]:t))}),(0,W.jsx)(`span`,{className:`text-ink-4`,children:`←`}),(0,W.jsx)(z,{value:n,list:`sources-${t.id}`,className:`flex-1 font-mono text-[12px]`,onChange:e=>d(u.map((t,n)=>n===r?[t[0],e.target.value]:t))}),(0,W.jsx)(I,{label:H(`editor.deleteStep`),onClick:()=>d(u.filter((e,t)=>t!==r)),children:(0,W.jsx)(T,{className:`size-4`})})]},r)),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>d([...u,[`wert${u.length+1}`,l[0]??`today`]]),className:`inline-flex h-8 items-center gap-1 self-start rounded-full px-2.5 text-[12px] text-ink-2 hover:bg-accent`,children:[(0,W.jsx)(C,{className:`size-3.5`}),` Wert`]})]})]})}function Ia({def:e,step:t,set:n,mcpServers:r,files:i,wizardId:a}){let o=e.steps.indexOf(t),s=(0,U.useContext)(ka),c=Ne().plugins.flatMap(e=>e.tools),l=e.steps.slice(0,o).filter(e=>e.type===`agent`||e.type===`generate`||e.type===`widget`);switch(t.type){case`widget`:return(0,W.jsx)(Fa,{def:e,step:t,set:n,files:i,wizardId:a});case`page`:return(0,W.jsxs)(X,{title:`Fragen`,loose:!0,children:[(0,W.jsx)(`div`,{className:`flex flex-col gap-2`,children:t.fields.map((r,i)=>(0,W.jsx)(Ma,{def:e,field:r,onChange:e=>n({...t,fields:t.fields.map((t,n)=>n===i?e:t)}),onRemove:()=>t.fields.length>1&&n({...t,fields:t.fields.filter((e,t)=>t!==i)}),onMove:e=>{let r=i+e;if(r<0||r>=t.fields.length)return;let a=[...t.fields];[a[i],a[r]]=[a[r],a[i]],n({...t,fields:a})}},r.id))}),s?null:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>n({...t,fields:[...t.fields,{id:ja(e,`frage`),label:`Neue Frage`,kind:`text`}]}),className:`inline-flex h-9 items-center gap-1.5 self-start rounded-full px-3 text-[13px] text-ink-2 hover:bg-accent`,children:[(0,W.jsx)(C,{className:`size-4`}),` Frage hinzufügen`]})]});case`agent`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(X,{title:`Auftrag`,children:[(0,W.jsx)(F,{value:t.instructions,minRows:6,maxRows:20,onChange:e=>n({...t,instructions:e.target.value}),className:`text-[14px]`}),(0,W.jsxs)(`p`,{className:`text-[12px] text-ink-4`,children:[`Antworten einsetzen mit `,(0,W.jsx)(`code`,{className:`font-mono`,children:`{{feld}}`}),`, frühere Ergebnisse mit `,(0,W.jsx)(`code`,{className:`font-mono`,children:`{{steps.id}}`}),`.`]})]}),(0,W.jsxs)(X,{title:`Werkzeuge`,children:[(0,W.jsx)(P,{multi:!0,value:t.tools,options:[...new Set([...k,...c.map(e=>e.id),...t.tools])],onChange:e=>n({...t,tools:e})}),(0,W.jsxs)(`div`,{className:`-mt-2 flex flex-wrap gap-x-3 text-[12px] text-ink-4`,children:[k.map(e=>(0,W.jsxs)(`span`,{children:[e,` = `,ie(e)]},e)),c.map(e=>(0,W.jsxs)(`span`,{children:[e.id,` = `,e.title]},e.id))]}),e.connections?.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(M,{hint:`Konten, die die Person im Durchlauf verbindet. Der Schritt liest darin, er schreibt nie.`,children:`Konten der Person`}),(0,W.jsx)(P,{multi:!0,value:t.connections??[],options:e.connections.map(e=>e.id),onChange:e=>n({...t,connections:e.length?e:void 0})})]}):null,r.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(M,{hint:`Nur freigegebene Systeme sind in diesem Schritt erreichbar.`,children:`Verbundene Systeme`}),(0,W.jsx)(P,{multi:!0,value:t.mcp??[],options:r.map(e=>e.id),onChange:e=>n({...t,mcp:e.length?e:void 0})})]}):null]}),(0,W.jsxs)(X,{title:`Ergebnis`,children:[(0,W.jsx)(P,{value:t.output.format,options:[`text`,`markdown`,`json`],onChange:e=>n({...t,output:{...t.output,format:e}})}),(0,W.jsx)(la,{model:t.model,effort:t.effort,onChange:e=>n({...t,...e})}),(0,W.jsx)(z,{placeholder:`Text während der Arbeit, z. B. „Recherchiert …“`,value:t.working??``,onChange:e=>n({...t,working:e.target.value||void 0})})]})]});case`generate`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(X,{title:`Was wird erzeugt?`,children:[(0,W.jsx)(P,{value:t.asset,options:[`image`,`video`,`voice`,`document`,`dashboard`],onChange:e=>n({...t,asset:e})}),(0,W.jsx)(F,{value:t.prompt,minRows:5,maxRows:18,onChange:e=>n({...t,prompt:e.target.value}),className:`text-[14px]`})]}),(0,W.jsxs)(X,{title:`Optionen`,children:[t.asset===`document`||t.asset===`dashboard`?(0,W.jsx)(la,{model:t.model,effort:t.effort,onChange:e=>n({...t,...e})}):null,t.asset===`image`||t.asset===`video`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(M,{children:`Format`}),(0,W.jsx)(P,{value:t.options?.aspectRatio??``,options:[...A],onChange:e=>n({...t,options:{...t.options,aspectRatio:e}})}),(0,W.jsx)(z,{placeholder:`Stil, z. B. „helle Fotografie, minimalistisch“`,value:t.options?.style??``,onChange:e=>n({...t,options:{...t.options,style:e.target.value||void 0}})})]}):null,t.asset===`video`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(M,{children:`Länge (Sekunden)`}),(0,W.jsx)(P,{value:String(t.options?.duration??8),options:[`4`,`6`,`8`,`10`],onChange:e=>n({...t,options:{...t.options,duration:Number(e)}})}),(0,W.jsx)(M,{children:`Auflösung`}),(0,W.jsx)(P,{value:t.options?.resolution??`720p`,options:[...be],onChange:e=>n({...t,options:{...t.options,resolution:e}})})]}):null,t.asset===`document`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(M,{children:`Vorlage`}),(0,W.jsx)(V,{value:t.options?.template??`free`,onChange:e=>n({...t,options:{...t.options,template:e}}),options:[`free`,`invoice`,`offer`,`briefing`,`letter`,`report`].map(e=>({value:e,label:e}))})]}):null]})]});case`review`:return(0,W.jsxs)(X,{title:`Was wird gezeigt?`,children:[(0,W.jsx)(P,{multi:!0,value:t.show,options:l.map(e=>e.id),onChange:e=>e.length&&n({...t,show:e})}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Text direkt bearbeitbar`}),(0,W.jsx)(L,{checked:!!t.edit,onChange:e=>n({...t,edit:e})})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-2`,children:`Neue Variante anfordern`}),(0,W.jsx)(L,{checked:!!t.regenerate,onChange:e=>n({...t,regenerate:e})})]})]});case`result`:return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{title:`Abschluss`,children:(0,W.jsx)(F,{minRows:2,placeholder:`Nachricht am Ende`,value:t.message??``,onChange:e=>n({...t,message:e.target.value||void 0})})}),(0,W.jsx)(X,{title:`Downloads`,children:l.map(e=>{let r=t.deliverables.find(t=>t.from===e.id),i=Se(e);return(0,W.jsxs)(`div`,{className:`rounded-lg bg-paper p-3 ring-1 ring-border-soft`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`truncate text-[14px]`,children:e.title}),(0,W.jsx)(L,{checked:!!r,onChange:r=>n({...t,deliverables:r?[...t.deliverables,{from:e.id,label:e.title,formats:[i[0]]}]:t.deliverables.filter(t=>t.from!==e.id)})})]}),r?(0,W.jsx)(P,{multi:!0,value:r.formats,options:i,onChange:r=>r.length&&n({...t,deliverables:t.deliverables.map(t=>t.from===e.id?{...t,formats:r}:t)})}):null]},e.id)})})]})}}function La({def:e,update:t}){return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(X,{children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(M,{children:`Titel`}),(0,W.jsx)(z,{value:e.title,onChange:n=>t({...e,title:n.target.value})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(M,{children:`Beschreibung`}),(0,W.jsx)(F,{minRows:2,value:e.description,onChange:n=>t({...e,description:n.target.value})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(M,{hint:`Steht über der ersten Seite.`,children:`Begrüßung`}),(0,W.jsx)(F,{minRows:2,value:e.intro??``,onChange:n=>t({...e,intro:n.target.value||void 0})})]})]}),(0,W.jsx)(X,{title:`Avatar`,children:(0,W.jsx)(`div`,{className:`grid grid-cols-5 gap-2`,children:O.map(n=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>t({...e,avatar:n}),className:N(`flex aspect-square items-center justify-center rounded-xl transition`,e.avatar===n?`bg-ember-tint ring-2 ring-ember`:`bg-paper hover:bg-paper-2`),"aria-label":n,children:(0,W.jsx)(s,{kind:n,size:44,interactive:!1})},n))})}),e.lists?.length||e.connections?.length?(0,W.jsxs)(X,{title:`Merkt sich für jede Person`,children:[(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:`Bleibt zwischen den Durchläufen erhalten – getrennt für jede Person, die den Wizard nutzt. Ändern kannst du das im Gespräch.`}),(e.connections??[]).map(e=>(0,W.jsxs)(`div`,{className:`rounded-lg bg-paper px-3 py-2.5 ring-1 ring-border-soft`,children:[(0,W.jsx)(`div`,{className:`text-[14px]`,children:e.title??e.id}),(0,W.jsxs)(`div`,{className:`text-[12px] text-ink-4`,children:[`Konto · `,e.kind]})]},e.id)),(e.lists??[]).map(e=>(0,W.jsxs)(`div`,{className:`rounded-lg bg-paper px-3 py-2.5 ring-1 ring-border-soft`,children:[(0,W.jsx)(`div`,{className:`text-[14px]`,children:e.title}),(0,W.jsxs)(`div`,{className:`text-[12px] text-ink-4`,children:[`Liste · `,e.columns.map(e=>e.name).join(`, `)]}),(0,W.jsx)(`div`,{className:`mt-1 font-mono text-[11px] text-ink-4`,children:`{{lists.${e.id}}}`})]},e.id))]}):null]})}var Ra={page:e=>({id:e,type:`page`,title:`Neue Seite`,fields:[{id:`${e}Text`,label:`Neue Frage`,kind:`text`}]}),agent:e=>({id:e,type:`agent`,title:`KI-Schritt`,instructions:`Beschreibe die Aufgabe …`,tools:[],output:{format:`markdown`}}),generate:e=>({id:e,type:`generate`,title:`Bild erzeugen`,asset:`image`,prompt:`Beschreibe das Bild …`}),widget:e=>({id:e,type:`widget`,title:`Widget`,entry:`${e}/index.html`,data:{},sample:`${e}/sample.json`})},za=`__wizard`;function Ba({def:e,selected:t,onSelect:n,issues:r}){let i=[za,...e.steps.map(e=>e.id)],a=t?i.indexOf(t):-1,o=(0,U.useRef)(null);(0,U.useEffect)(()=>{o.current?.scrollIntoView({block:`nearest`,inline:`center`,behavior:`smooth`})},[t]);let s=e=>{let t=a===-1?e===1?1:i.length-1:a+e;t>=0&&t<i.length&&n(i[t])},c=(0,U.useRef)(s);c.current=s,(0,U.useEffect)(()=>{let e=e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.defaultPrevented||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||e.target?.closest(`input, textarea, select, [contenteditable=""], [contenteditable="true"], [role="separator"], [role="slider"], [role="dialog"], .react-flow`)||(e.preventDefault(),c.current(e.key===`ArrowLeft`?-1:1)))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let l=`inline-flex size-8 shrink-0 items-center justify-center rounded-full transition`;return(0,W.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-1 border-border-soft border-b bg-card/95 px-2 py-2 backdrop-blur`,children:[(0,W.jsx)(I,{label:H(`editor.prevStep`),className:`size-8 shrink-0`,disabled:a===0,onClick:()=>s(-1),children:(0,W.jsx)(Ze,{className:`size-4`})}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center overflow-x-auto p-1 [scrollbar-width:none]`,children:[(0,W.jsx)(`button`,{ref:t===za?o:void 0,type:`button`,title:e.title,"aria-label":e.title,"aria-current":t===za?`step`:void 0,onClick:()=>n(za),className:N(l,`bg-paper-2 text-ink-2`,t===za?`ring-2 ring-ember`:`hover:ring-2 hover:ring-border-soft`),children:(0,W.jsx)(ge,{className:`size-4`})}),e.steps.map((e,i)=>{let a=S(e),s=e.id===t,c=r.some(t=>t.stepId===e.id);return(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[(0,W.jsx)(`span`,{className:`h-px w-3 bg-border-soft`}),(0,W.jsxs)(`button`,{ref:s?o:void 0,type:`button`,title:`${i+1}. ${e.title}`,"aria-label":`${i+1}. ${e.title}`,"aria-current":s?`step`:void 0,onClick:()=>n(e.id),className:N(l,`relative`,se[e.type],s?`ring-2 ring-ember`:`opacity-70 hover:opacity-100`),children:[(0,W.jsx)(a,{className:`size-4`}),c?(0,W.jsx)(`span`,{className:`-top-0.5 -right-0.5 absolute size-2.5 rounded-full bg-rose ring-2 ring-card`}):null]})]},e.id)})]}),(0,W.jsx)(`span`,{className:`shrink-0 px-1 text-[12px] text-ink-4 tabular-nums`,children:a>0?`${a} / ${e.steps.length}`:``}),(0,W.jsx)(I,{label:H(`editor.nextStep`),className:`size-8 shrink-0`,disabled:a===i.length-1,onClick:()=>s(1),children:(0,W.jsx)($e,{className:`size-4`})})]})}function Va({def:e,onSelect:t,issues:n}){return(0,W.jsx)(`div`,{className:`flex flex-col gap-1 p-3`,children:e.steps.map((e,r)=>{let i=S(e),a=n.some(t=>t.stepId===e.id);return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-paper-2`,children:[(0,W.jsx)(`span`,{className:`w-4 text-right text-[12px] text-ink-4 tabular-nums`,children:r+1}),(0,W.jsx)(`span`,{className:N(`inline-flex size-7 shrink-0 items-center justify-center rounded-md`,se[e.type]),children:(0,W.jsx)(i,{className:`size-4`})}),(0,W.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`span`,{className:`block truncate text-[14px]`,children:e.title}),(0,W.jsx)(`span`,{className:`block text-[12px] text-ink-4`,children:x(e)})]}),a?(0,W.jsx)(`span`,{className:`size-2 shrink-0 rounded-full bg-rose`}):null]},e.id)})})}function Ha(e){let{def:t,selected:n,onSelect:r,issues:i,readOnly:a=!1}=e,o=a?()=>{}:e.update,s=t.steps.find(e=>e.id===n);return(0,W.jsx)(ka,{value:a,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Ba,{def:t,selected:n,onSelect:r,issues:i}),n===za?(0,W.jsx)(La,{def:t,update:o}):s?(0,W.jsx)(Ua,{...e,update:o,step:s}):(0,W.jsx)(Va,{def:t,onSelect:r,issues:i})]})})}function Ua({def:e,step:t,update:n,onSelect:r,issues:i,mcpServers:a,files:o,wizardId:s}){let c=e.steps.indexOf(t),l=S(t),u=r=>n({...e,steps:e.steps.map(e=>e.id===t.id?r:e)}),d=r=>{let i=c+r;if(i<0||i>=e.steps.length-(t.type===`result`?0:1)||e.steps[i].type===`result`)return;let a=[...e.steps];[a[c],a[i]]=[a[i],a[c]],n({...e,steps:a})},f=i=>{let a=ja(e,i===`page`?`seite`:i===`agent`?`ki`:i===`widget`?`widget`:`erzeugen`),o=[...e.steps];o.splice(t.type===`result`?c:c+1,0,Ra[i](a)),n({...e,steps:o}),r(a)},p=i.filter(e=>e.stepId===t.id),m=oa(s,e),h=(0,U.useContext)(ka);return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 px-5 py-4`,children:[(0,W.jsx)(`span`,{className:N(`inline-flex size-7 items-center justify-center rounded-md`,se[t.type]),children:(0,W.jsx)(l,{className:`size-4`})}),(0,W.jsx)(`span`,{className:`font-medium text-[12px] text-ink-3 uppercase tracking-[0.07em]`,children:x(t)}),(0,W.jsx)(`span`,{className:`ml-auto font-mono text-[11px] text-ink-4`,children:t.id})]}),p.length?(0,W.jsx)(`div`,{className:`mx-5 mb-4 rounded-lg bg-rose-tint px-3 py-2 text-[13px] text-rose`,children:p.map((e,t)=>(0,W.jsx)(`div`,{children:e.message},t))}):null,(0,W.jsxs)(X,{children:[(0,W.jsx)(z,{value:t.title,onChange:e=>u({...t,title:e.target.value}),className:`font-display font-semibold text-[16px]`}),t.type===`page`||t.type===`review`?(0,W.jsx)(F,{minRows:1,placeholder:`Erklärung unter dem Titel (optional)`,value:t.description??``,onChange:e=>u({...t,description:e.target.value||void 0})}):null,(0,W.jsx)(ca,{estimate:m.data,stepId:t.id})]}),(0,W.jsx)(Ia,{def:e,step:t,set:u,mcpServers:a,files:o,wizardId:s}),h?null:(0,W.jsx)(X,{children:(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[t.type===`result`?null:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(I,{label:H(`editor.moveUp`),onClick:()=>d(-1),children:(0,W.jsx)(y,{className:`size-4`})}),(0,W.jsx)(I,{label:H(`editor.moveDown`),onClick:()=>d(1),children:(0,W.jsx)(te,{className:`size-4`})}),(0,W.jsx)(I,{label:H(`editor.deleteStep`),className:`hover:text-rose`,onClick:()=>{n({...e,steps:e.steps.filter(e=>e.id!==t.id)}),r(null)},children:(0,W.jsx)(T,{className:`size-4`})})]}),(0,W.jsx)(`span`,{className:`ml-auto text-[12px] text-ink-4`,children:`Danach einfügen:`}),[`page`,`agent`,`generate`,`widget`].map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>f(e),className:`inline-flex h-8 items-center gap-1 rounded-full px-2.5 text-[12px] text-ink-2 hover:bg-accent`,children:[(0,W.jsx)(C,{className:`size-3.5`}),` `,H(`type.${e}`)]},e))]})})]})}var Wa={waiting_input:`wartet`,running:`läuft`,done:`fertig`,failed:`Fehler`,cancelled:`abgebrochen`};function Ga({wizardId:e,onOpen:t}){let n=c({queryKey:[`runs`,e],queryFn:()=>u.get(`/api/studio/wizards/${e}/runs`),refetchInterval:1e4});if(n.data&&!n.data.length)return(0,W.jsx)(we,{children:H(`editor.noRuns`)});let r=new Intl.DateTimeFormat(j,{dateStyle:`short`,timeStyle:`short`});return(0,W.jsx)(`div`,{className:`flex flex-col p-2`,children:n.data?.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id),className:`flex items-center gap-3 rounded-lg px-3 py-3 text-left hover:bg-accent`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-[14px]`,children:[r.format(new Date(e.createdAt)),e.mode===`test`?(0,W.jsx)(R,{children:`Test`}):(0,W.jsxs)(R,{tone:`live`,children:[`Live v`,e.version]})]}),(0,W.jsxs)(`div`,{className:`truncate text-[12px] text-ink-3`,children:[Wa[e.status]??e.status,e.stepTitle&&e.status!==`done`?` · ${e.stepTitle}`:``]})]}),(0,W.jsxs)(`span`,{className:`text-[12px] text-ink-4 tabular-nums`,children:[e.credits,` cr`]})]},e.id))})}var Z=(e=>(e[e.Border=-1]=`Border`,e[e.Data=0]=`Data`,e[e.Function=1]=`Function`,e[e.Position=2]=`Position`,e[e.Timing=3]=`Timing`,e[e.Alignment=4]=`Alignment`,e))(Z||{}),Ka=[0,1],qa=[1,0],Ja=[2,3],Ya=[3,2],Xa={L:Ka,M:qa,Q:Ja,H:Ya},Za=/^\d*$/,Qa=/^[A-Z0-9 $%*+./:-]*$/,$a=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`,eo=1,to=40,no=3,ro=3,io=40,ao=10,oo=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],so=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],co=class{constructor(e,t,n,r){if(this.version=e,this.ecc=t,e<eo||e>to)throw RangeError(`Version value out of range`);if(r<-1||r>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let i=Array.from({length:this.size}).fill(!1);for(let e=0;e<this.size;e++)this.modules.push(i.slice()),this.types.push(i.map(()=>0));this.drawFunctionPatterns();let a=this.addEccAndInterleave(n);if(this.drawCodewords(a),r===-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(r=t,e=n),this.applyMask(t)}}this.mask=r,this.applyMask(r),this.drawFormatBits(r)}size;mask;modules=[];types=[];getModule(e,t){return e>=0&&e<this.size&&t>=0&&t<this.size&&this.modules[t][e]}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0,Z.Timing),this.setFunctionModule(e,6,e%2==0,Z.Timing);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n===0&&r===0||n===0&&r===t-1||n===t-1&&r===0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.ecc[1]<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let r=(t<<10|n)^21522;for(let e=0;e<=5;e++)this.setFunctionModule(8,e,$(r,e));this.setFunctionModule(8,7,$(r,6)),this.setFunctionModule(8,8,$(r,7)),this.setFunctionModule(7,8,$(r,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,$(r,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,$(r,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,$(r,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;for(let e=0;e<18;e++){let n=$(t,e),r=this.size-11+e%3,i=Math.floor(e/3);this.setFunctionModule(r,i,n),this.setFunctionModule(i,r,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;a>=0&&a<this.size&&o>=0&&o<this.size&&this.setFunctionModule(a,o,i!==2&&i!==4,Z.Position)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!==1,Z.Alignment)}setFunctionModule(e,t,n,r=Z.Function){this.modules[t][e]=n,this.types[t][e]=r}addEccAndInterleave(e){let t=this.version,n=this.ecc;if(e.length!==wo(t,n))throw RangeError(`Invalid argument`);let r=so[n[0]][t],i=oo[n[0]][t],a=Math.floor(Co(t)/8),o=r-a%r,s=Math.floor(a/r),c=[],l=To(i);for(let t=0,n=0;t<r;t++){let r=e.slice(n,n+s-i+(t<o?0:1));n+=r.length;let a=Eo(r,l);t<o&&r.push(0),c.push(r.concat(a))}let u=[];for(let e=0;e<c[0].length;e++)c.forEach((t,n)=>{(e!==s-i||n>=o)&&u.push(t[e])});return u}drawCodewords(e){if(e.length!==Math.floor(Co(this.version)/8))throw RangeError(`Invalid argument`);let t=0;for(let n=this.size-1;n>=1;n-=2){n===6&&(n=5);for(let r=0;r<this.size;r++)for(let i=0;i<2;i++){let a=n-i,o=n+1&2?r:this.size-1-r;!this.types[o][a]&&t<e.length*8&&(this.modules[o][a]=$(e[t>>>3],7-(t&7)),t++)}}}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.types[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[t][a]===n?(r++,r===5?e+=no:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*io),n=this.modules[t][a],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*io}for(let t=0;t<this.size;t++){let n=!1,r=0,i=[0,0,0,0,0,0,0];for(let a=0;a<this.size;a++)this.modules[a][t]===n?(r++,r===5?e+=no:r>5&&e++):(this.finderPenaltyAddHistory(r,i),n||(e+=this.finderPenaltyCountPatterns(i)*io),n=this.modules[a][t],r=1);e+=this.finderPenaltyTerminateAndCount(n,r,i)*io}for(let t=0;t<this.size-1;t++)for(let n=0;n<this.size-1;n++){let r=this.modules[t][n];r===this.modules[t][n+1]&&r===this.modules[t+1][n]&&r===this.modules[t+1][n+1]&&(e+=ro)}let t=0;for(let e of this.modules)t=e.reduce((e,t)=>e+ +!!t,t);let n=this.size*this.size,r=Math.ceil(Math.abs(t*20-n*10)/n)-1;return e+=r*ao,e}getAlignmentPatternPositions(){if(this.version===1)return[];{let e=Math.floor(this.version/7)+2,t=this.version===32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}finderPenaltyCountPatterns(e){let t=e[1],n=t>0&&e[2]===t&&e[3]===t*3&&e[4]===t&&e[5]===t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]===0&&(e+=this.size),t.pop(),t.unshift(e)}};function Q(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function $(e,t){return!!(e>>>t&1)}var lo=class{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}getData(){return this.bitData.slice()}},uo=[1,10,12,14],fo=[2,9,11,13],po=[4,8,16,16];function mo(e,t){return e[Math.floor((t+7)/17)+1]}function ho(e){let t=[];for(let n of e)Q(n,8,t);return new lo(po,e.length,t)}function go(e){if(!yo(e))throw RangeError(`String contains non-numeric characters`);let t=[];for(let n=0;n<e.length;){let r=Math.min(e.length-n,3);Q(Number.parseInt(e.substring(n,n+r),10),r*3+1,t),n+=r}return new lo(uo,e.length,t)}function _o(e){if(!bo(e))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let t=[],n=0;for(;n+2<=e.length;n+=2){let r=$a.indexOf(e.charAt(n))*45;r+=$a.indexOf(e.charAt(n+1)),Q(r,11,t)}return n<e.length&&Q($a.indexOf(e.charAt(n)),6,t),new lo(fo,e.length,t)}function vo(e){return e===``?[]:yo(e)?[go(e)]:bo(e)?[_o(e)]:[ho(So(e))]}function yo(e){return Za.test(e)}function bo(e){return Qa.test(e)}function xo(e,t){let n=0;for(let r of e){let e=mo(r.mode,t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}function So(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)===`%`?(t.push(Number.parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}function Co(e){if(e<eo||e>to)throw RangeError(`Version number out of range`);let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function wo(e,t){return Math.floor(Co(e)/8)-oo[t[0]][e]*so[t[0]][e]}function To(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let t=[];for(let n=0;n<e-1;n++)t.push(0);t.push(1);let n=1;for(let r=0;r<e;r++){for(let e=0;e<t.length;e++)t[e]=Do(t[e],n),e+1<t.length&&(t[e]^=t[e+1]);n=Do(n,2)}return t}function Eo(e,t){let n=t.map(e=>0);for(let r of e){let e=r^n.shift();n.push(0),t.forEach((t,r)=>n[r]^=Do(t,e))}return n}function Do(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return n}function Oo(e,t,n=1,r=40,i=-1,a=!0){if(!(eo<=n&&n<=r&&r<=to)||i<-1||i>7)throw RangeError(`Invalid value`);let o,s;for(o=n;;o++){let n=wo(o,t)*8,i=xo(e,o);if(i<=n){s=i;break}if(o>=r)throw RangeError(`Data too long`)}for(let e of[qa,Ja,Ya])a&&s<=wo(o,e)*8&&(t=e);let c=[];for(let t of e){Q(t.mode[0],4,c),Q(t.numChars,mo(t.mode,o),c);for(let e of t.getData())c.push(e)}let l=wo(o,t)*8;Q(0,Math.min(4,l-c.length),c),Q(0,(8-c.length%8)%8,c);for(let e=236;c.length<l;e^=253)Q(e,8,c);let u=Array.from({length:Math.ceil(c.length/8)},()=>0);return c.forEach((e,t)=>u[t>>>3]|=e<<7-(t&7)),new co(o,t,u,i)}function ko(e,t){let{ecc:n=`L`,boostEcc:r=!1,minVersion:i=1,maxVersion:a=40,maskPattern:o=-1,border:s=1}=t||{},c=typeof e==`string`?vo(e):Array.isArray(e)?[ho(e)]:void 0;if(!c)throw Error(`uqr only supports encoding string and binary data, but got: ${typeof e}`);let l=Oo(c,Xa[n],i,a,o,r),u=Ao({version:l.version,maskPattern:l.mask,size:l.size,data:l.modules,types:l.types},s);return t?.invert&&(u.data=u.data.map(e=>e.map(e=>!e))),t?.onEncoded?.(u),u}function Ao(e,t=1){if(!t)return e;let{size:n}=e,r=n+t*2;e.size=r,e.data.forEach(e=>{for(let n=0;n<t;n++)e.unshift(!1),e.push(!1)});for(let n=0;n<t;n++)e.data.unshift(Array.from({length:r},e=>!1)),e.data.push(Array.from({length:r},e=>!1));let i=Z.Border;e.types.forEach(e=>{for(let n=0;n<t;n++)e.unshift(i),e.push(i)});for(let n=0;n<t;n++)e.types.unshift(Array.from({length:r},e=>i)),e.types.push(Array.from({length:r},e=>i));return e}function jo(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function Mo(e,t={}){let n=ko(e,t),{pixelSize:r=10,whiteColor:i=`white`,blackColor:a=`black`}=t,o=n.size*r,s=n.size*r,c=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${s} ${o}">`,l=[];for(let e=0;e<n.size;e++)for(let t=0;t<n.size;t++){let i=t*r,a=e*r;n.data[e][t]&&l.push(`M${i},${a}h${r}v${r}h-${r}z`)}return c+=`<rect fill="${jo(i)}" width="${s}" height="${o}"/>`,c+=`<path fill="${jo(a)}" d="${l.join(``)}"/>`,c+=`</svg>`,c}var No=e=>`${e.slice(0,4)} ${e.slice(4)}`;function Po(e,t){let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}async function Fo(e,t){let n=new Image,r=URL.createObjectURL(new Blob([e],{type:`image/svg+xml`}));try{n.src=r,await n.decode();let e=document.createElement(`canvas`);e.width=1024,e.height=1024;let i=e.getContext(`2d`);if(!i)return;i.imageSmoothingEnabled=!1,i.drawImage(n,0,0,1024,1024);let a=await new Promise(t=>e.toBlob(t,`image/png`));a&&Po(a,t)}finally{URL.revokeObjectURL(r)}}function Io({url:e,code:t,title:n}){let r=(0,U.useMemo)(()=>Mo(e,{ecc:`M`,border:2,pixelSize:8}),[e]),i=(n.trim()||`wizard`).replace(/[^\p{L}\p{N}]+/gu,`-`).toLowerCase();return(0,W.jsxs)(`div`,{className:`flex gap-4`,children:[(0,W.jsx)(`div`,{role:`img`,"aria-label":H(`share.qr`),className:`size-28 shrink-0 overflow-hidden rounded-lg bg-white [&>svg]:size-full`,dangerouslySetInnerHTML:{__html:r}}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`share.qrHint`)}),t?(0,W.jsxs)(`p`,{className:`text-[13px] text-ink-3`,children:[H(`share.code`),` `,(0,W.jsx)(`span`,{className:`select-all font-mono text-[15px] text-ink tracking-wider`,children:No(t)})]}):null,(0,W.jsxs)(`div`,{className:`mt-auto flex gap-2`,children:[(0,W.jsxs)(B,{variant:`secondary`,size:`sm`,onClick:()=>void Fo(r,`${i}-qr.png`),children:[(0,W.jsx)(Be,{className:`size-3.5`}),` PNG`]}),(0,W.jsxs)(B,{variant:`secondary`,size:`sm`,onClick:()=>Po(new Blob([r],{type:`image/svg+xml`}),`${i}-qr.svg`),children:[(0,W.jsx)(Be,{className:`size-3.5`}),` SVG`]})]})]})]})}var Lo=e=>e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`),Ro=()=>new Intl.DateTimeFormat(j,{timeStyle:`short`});function zo({url:e,title:t}){let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(!1),[,o,s]=e.match(/^(.*)\/w\/([^/]+)$/)??[];if(!s)return null;let c=`<script async src="${o}/embed.js" data-wizard="${s}"${n?` data-mode="modal" data-label="${Lo(t)}"`:``}><\/script>`,l=[H(`embed.inline`),H(`embed.modal`)];return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(n?`embed.modalHint`:`embed.inlineHint`)}),(0,W.jsxs)(B,{variant:`secondary`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(c),a(!0),setTimeout(()=>a(!1),1500)},children:[i?(0,W.jsx)(ce,{className:`size-3.5`}):(0,W.jsx)(me,{className:`size-3.5`}),H(i?`share.copied`:`share.copy`)]})]}),(0,W.jsx)(P,{value:l[+!!n],onChange:e=>r(e===l[1]),options:l}),(0,W.jsx)(`pre`,{className:`select-all whitespace-pre-wrap break-all rounded-lg bg-paper-2 px-3 py-2.5 font-mono text-[12px] text-ink-2 leading-relaxed`,children:c})]})}var Bo=e=>N(`inline-flex h-8 items-center gap-1.5 rounded-full px-3 font-medium text-[13px] transition`,e?`bg-paper-2 text-ink`:`text-ink-3 hover:text-ink`);function Vo({url:e,code:t,title:n}){let[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(null),s=e=>o(t=>t===e?null:e);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(z,{readOnly:!0,value:e,onFocus:e=>e.target.select(),className:`font-mono text-[13px]`}),(0,W.jsxs)(B,{variant:`secondary`,onClick:()=>{navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),1500)},children:[r?(0,W.jsx)(ce,{className:`size-4`}):(0,W.jsx)(me,{className:`size-4`}),H(r?`share.copied`:`share.copy`)]})]}),(0,W.jsxs)(`div`,{className:`-ml-3 flex flex-wrap gap-1`,children:[(0,W.jsxs)(`button`,{type:`button`,className:Bo(!1),onClick:()=>Ye(e),children:[(0,W.jsx)(he,{className:`size-3.5`}),` `,H(`share.open`)]}),(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":a===`website`,className:Bo(a===`website`),onClick:()=>s(`website`),children:[(0,W.jsx)(st,{className:`size-3.5`}),` `,H(`share.website`)]}),(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":a===`qr`,className:Bo(a===`qr`),onClick:()=>s(`qr`),children:[(0,W.jsx)(yt,{className:`size-3.5`}),` `,H(`share.qr`)]})]}),a===`website`?(0,W.jsx)(zo,{url:e,title:n}):null,a===`qr`?(0,W.jsx)(Io,{url:e,code:t,title:n}):null]})}var Ho={sandbox:`cloud.problem.sandbox`,mcp:`cloud.problem.mcp`,model:`cloud.problem.model`,connector:`cloud.problem.connector`,invalid:`cloud.problem.invalid`};function Uo({problems:e,quiet:t}){return(0,W.jsx)(`ul`,{className:N(`flex flex-col gap-2 text-[13px]`,t?`text-ink-3`:`text-ink-2`),children:e.map((e,n)=>(0,W.jsxs)(`li`,{children:[e.steps.length?(0,W.jsxs)(`span`,{className:N(`font-medium`,t?`text-ink-2`:`text-ink`),children:[e.steps.map(e=>H(`cloud.stepName`,{title:e.title})).join(`, `),`:`,` `]}):null,H(Ho[e.code]??`cloud.problem.invalid`,{detail:e.detail}),e.detail&&e.code!==`mcp`&&e.code!==`sandbox`?(0,W.jsxs)(`details`,{className:`mt-0.5`,children:[(0,W.jsx)(`summary`,{className:`cursor-pointer text-[12px] text-ink-4 hover:text-ink-3`,children:H(`share.details`)}),(0,W.jsx)(`span`,{className:`mt-0.5 block break-words font-mono text-[11px] text-ink-4`,children:e.detail})]}):null]},n))})}function Wo({error:e}){let t=d(),n=e.reason===`space_limit`,r=c({queryKey:[`cloud-spaces`],queryFn:()=>u.get(`/api/studio/cloud/spaces`),enabled:n,retry:!1}),i=m({mutationFn:()=>u.post(`/api/studio/cloud/replace`),onSettled:()=>Promise.all([t.invalidateQueries({queryKey:[`cloud`]}),t.invalidateQueries({queryKey:[`cloud-spaces`]}),t.invalidateQueries({queryKey:[`wizards`]})])});if(!n)return(0,W.jsxs)(`p`,{children:[e.message,` `,e.reason===`signed_out`?(0,W.jsx)(a,{to:`/settings/account`,className:`font-medium underline underline-offset-2`,children:H(`local.toAccount`)}):null,e.again?(0,W.jsx)(`span`,{className:`text-ink-3`,children:H(`cloud.again`,{when:Ro().format(new Date(e.again))})}):null]});let o=(r.data?.spaces??[]).map(e=>e.name);return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(`p`,{children:e.message}),(0,W.jsx)(`p`,{className:`text-ink-2`,children:H(`cloud.spaceLimit`)}),o.length?(0,W.jsx)(`ul`,{className:`list-disc pl-5`,children:o.map((e,t)=>(0,W.jsx)(`li`,{children:e},t))}):null,(0,W.jsx)(`div`,{children:(0,W.jsx)(B,{variant:`secondary`,size:`sm`,busy:i.isPending,onClick:()=>window.confirm(H(`cloud.replaceConfirm`))&&i.mutate(),children:H(`cloud.replace`)})}),i.error?(0,W.jsx)(`p`,{className:`text-rose`,children:i.error.message}):null]})}function Go({wizard:e,where:t,me:n,cloud:r}){let i=d(),a=m({mutationFn:()=>u.post(`/api/studio/wizards/${e.id}/cloud`),onSuccess:t=>{i.setQueryData([`cloud`,e.id],t),i.invalidateQueries({queryKey:[`wizards`]})}}),o=`flex items-start gap-2 text-[14px] text-ink-2`;switch(t.kind){case`draft`:return null;case`unknown`:return(0,W.jsx)(Te,{className:`size-4 text-ink-4`});case`here`:return(0,W.jsxs)(`p`,{className:o,children:[(0,W.jsx)(ze,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),` `,H(`where.hereHint`)]});case`live`:return(0,W.jsxs)(`p`,{className:o,title:r?.copy?H(`cloud.sent`,{v:r.copy.version,when:new Intl.DateTimeFormat(j,{dateStyle:`short`,timeStyle:`short`}).format(new Date(r.copy.syncedAt))}):void 0,children:[t.cloud?(0,W.jsx)(rt,{className:`mt-0.5 size-4 shrink-0 text-moss`}):(0,W.jsx)(`span`,{className:`mt-[7px] size-1.5 shrink-0 rounded-full bg-moss`}),t.cloud?H(`where.liveAt`,{host:Me(n.account?.cloudUrl??``),v:t.runs}):H(`editor.published`,{v:t.runs})]})}let s=r?.copy??null,c=r?.error??null,l=s&&!s.runnable?s.problems.filter(e=>e.blocking):[],f=e.published&&(!s||s.version<(e.publishedVersion??0)||c)&&c?.reason!==`space_limit`&&c?.reason!==`signed_out`;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-amber-tint px-3 py-2.5 text-[14px]`,children:[c?(0,W.jsx)(Wo,{error:c}):t.kind===`missing`?(0,W.jsx)(`p`,{children:t.why}):null,c&&t.runs!==null?(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`cloud.keepsRunning`,{v:t.runs})}):null,l.length?(0,W.jsx)(Uo,{problems:l}):null,f?(0,W.jsx)(`div`,{children:(0,W.jsxs)(B,{variant:`secondary`,size:`sm`,busy:a.isPending,onClick:()=>a.mutate(),children:[(0,W.jsx)(at,{className:`size-3.5`}),H(s||c?`cloud.resend`:`cloud.send`)]})}):null,a.error?(0,W.jsx)(`p`,{className:`text-[13px] text-rose`,children:a.error.message}):null]})}function Ko({wizard:e,cloud:t}){let n=t?.copy??null,r=e.publishedVersion,i=n!==null&&r!==null&&n.version<r,a=!n||e.dirty||i,o=c({queryKey:[`cloud-check`,e.id,e.revision],queryFn:()=>u.get(`/api/studio/wizards/${e.id}/cloud/check`),enabled:t?.linked===!0&&a,retry:!1,staleTime:3e4}),s=!a&&n?n.problems.filter(e=>!e.blocking):[],l=a?o.data?.problems??[]:[];return s.length||l.length||a&&o.data?.documents?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[s.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`cloud.notes`)}),(0,W.jsx)(Uo,{problems:s,quiet:!0})]}):null,l.length?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`text-[13px] text-ink-2`,children:H(l.some(e=>e.blocking)?`cloud.checkBlocking`:`cloud.check`)}),(0,W.jsx)(Uo,{problems:l,quiet:!0})]}):null,a&&o.data?.documents?(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`cloud.documents`)}):null]}):a&&o.error&&!t?.error?(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:o.error.message}):null}function qo({way:e}){let t=i(),n=ve(!1);return(0,W.jsxs)(`div`,{className:N(`flex flex-col gap-3`,e?`rounded-lg bg-cobalt-tint px-3 py-3`:`border-border-soft border-t pt-5`),children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-medium text-[14px]`,children:H(`share.others`)}),(0,W.jsx)(`p`,{className:`mt-1 text-[13px] text-ink-2 leading-relaxed`,children:H(e===`website`?`teaser.website`:e===`qr`?`teaser.qr`:`share.othersHint`)})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(B,{size:`sm`,busy:n.link.isPending,onClick:()=>n.link.mutate({}),children:H(`account.signIn`)}),(0,W.jsx)(B,{size:`sm`,variant:`secondary`,onClick:()=>t(`/settings/account`),children:H(`account.create`)})]}),(0,W.jsx)(w,{...n})]})}function Jo({wizard:e,cloud:t}){let n=d(),[r,i]=(0,U.useState)(!1),[a,o]=(0,U.useState)(String(e.dailyRunLimit)),s=()=>Promise.all([n.invalidateQueries({queryKey:[`wizard`,e.id]}),n.invalidateQueries({queryKey:[`wizards`]})]),c=m({mutationFn:t=>u.patch(`/api/studio/wizards/${e.id}`,t),onSuccess:s}),l=m({mutationFn:()=>u.post(`/api/studio/wizards/${e.id}/rotate-link`),onSuccess:({cloud:t})=>(t&&n.setQueryData([`cloud`,e.id],{linked:!0,...t}),s())}),f=e.readOnly,p=c.error??l.error,h=oa(e.id,e.draft),g=h.data?.available&&h.data.reserve>0?Math.round(h.data.reserve*e.dailyRunLimit):null,_=r||!!p;return(0,W.jsxs)(`div`,{className:`border-border-soft border-t pt-4`,children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":_,onClick:()=>i(e=>!e),className:`flex w-full items-center justify-between gap-4 text-left text-[14px]`,children:[(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)($e,{className:N(`size-4 text-ink-3 transition`,_&&`rotate-90`)}),H(`share.settings`)]}),(0,W.jsxs)(`span`,{className:`text-[13px] text-ink-3 tabular-nums`,children:[H(e.shareEnabled?`share.on`:`share.off`),` ·`,` `,H(`share.perDay`,{n:e.dailyRunLimit})]})]}),_?(0,W.jsxs)(`div`,{className:`mt-4 flex flex-col gap-5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,W.jsx)(`span`,{className:`text-[14px]`,children:H(`share.enabled`)}),(0,W.jsx)(L,{checked:e.shareEnabled,disabled:f,onChange:e=>c.mutate({shareEnabled:e})})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,W.jsx)(`span`,{className:`whitespace-nowrap text-[14px]`,children:H(`share.limit`)}),(0,W.jsx)(`div`,{className:`w-24`,children:(0,W.jsx)(z,{inputMode:`numeric`,className:`text-right`,disabled:f,value:a,onChange:e=>o(e.target.value.replace(/\D/g,``)),onBlur:()=>{let t=Number(a);t>=1&&t!==e.dailyRunLimit&&c.mutate({dailyRunLimit:t})}})})]}),g!==null&&h.data?(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3 tabular-nums`,children:H(`estimate.share`,{run:Math.round(h.data.credits).toLocaleString(),day:g.toLocaleString()})}):null,(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,W.jsx)(`span`,{className:`text-[13px] text-ink-3`,children:H(t?.copy?`share.rotateCloud`:`share.rotateHint`)}),(0,W.jsxs)(B,{variant:`ghost`,size:`sm`,busy:l.isPending,disabled:f,onClick:()=>l.mutate(),children:[(0,W.jsx)(Ce,{className:`size-3.5`}),` `,H(`share.rotate`)]})]}),p?(0,W.jsx)(`p`,{className:`text-[13px] text-rose`,children:p.message}):null]}):null,f?(0,W.jsx)(`p`,{className:`mt-3 text-[13px] text-ink-3`,children:H(`share.readOnly`)}):null]})}function Yo({wizard:e,open:t,onClose:n,publish:r}){let i=_(),a=i.data?.mode===`local`,o=a&&!!i.data?.account,s=g(e.id,t&&o),l=i.data?Le(e,i.data,o?s.data:null):{kind:`unknown`},d=Fe(l),f=i.data?.mode===`managed`&&e.published,p=c({queryKey:[`wizard-code`,e.id,e.shareToken],queryFn:()=>u.get(`/api/studio/wizards/${e.id}/code`),enabled:t&&f}),m=!e.published||e.dirty&&!e.readOnly,[h,v]=(0,U.useState)(null);return(0,W.jsx)(Ee,{open:t,onClose:n,title:H(`share.title`),children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[m?(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-amber-tint px-3 py-2.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`p`,{className:`text-[14px]`,children:H(e.published?`share.unpublished`:`share.publishFirst`)}),r?(0,W.jsx)(B,{size:`sm`,busy:r.busy,disabled:r.disabled,onClick:r.run,children:H(`editor.publish`)}):null]}),o&&!e.published?(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`cloud.onPublish`)}):null]}):null,i.data&&e.published?(0,W.jsx)(Go,{wizard:e,where:l,me:i.data,cloud:s.data}):null,s.isError?(0,W.jsx)(`p`,{className:`text-[13px] text-rose`,children:s.error.message}):null,d?(0,W.jsx)(Vo,{url:d,code:f?p.data?.code:s.data?.copy?.code,title:e.draft.title}):null,a&&!o&&e.published?(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.jsx)(z,{readOnly:!0,value:De(e),onFocus:e=>e.target.select(),className:`font-mono text-[13px] text-ink-3`}),(0,W.jsxs)(B,{variant:`secondary`,onClick:()=>Ye(De(e)),children:[(0,W.jsx)(he,{className:`size-4`}),` `,H(`share.open`)]})]}),ke.account?(0,W.jsx)(`div`,{className:`-ml-3 flex flex-wrap gap-1`,children:[`website`,`qr`].map(e=>(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":h===e,className:Bo(h===e),onClick:()=>v(t=>t===e?null:e),children:[e===`website`?(0,W.jsx)(st,{className:`size-3.5`}):(0,W.jsx)(yt,{className:`size-3.5`}),H(e===`website`?`share.website`:`share.qr`),(0,W.jsx)(Oe,{className:`size-3 text-cobalt`})]},e))}):null]}):null,o?(0,W.jsx)(Ko,{wizard:e,cloud:s.data}):null,a&&!o&&ke.account?(0,W.jsx)(qo,{way:h}):null,(0,W.jsx)(Jo,{wizard:e,cloud:o?s.data:void 0}),o&&e.published?(0,W.jsxs)(`button`,{type:`button`,onClick:()=>Ye(De(e)),className:`inline-flex items-center gap-1.5 self-start text-[13px] text-ink-3 hover:text-ink`,children:[(0,W.jsx)(ze,{className:`size-3.5`}),` `,H(`share.openHere`),(0,W.jsx)(he,{className:`size-3`})]}):null]})})}var Xo=[`title`,`description`,`avatar`,`intro`,`lists`,`connections`],Zo=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Qo(e,t,n){let r={...n};for(let n of Xo)Zo(t[n],e[n])||Object.assign(r,{[n]:t[n]});let i=new Map(e.steps.map(e=>[e.id,e])),a=new Set(t.steps.map(e=>e.id)),o=n.steps.filter(e=>{let t=i.get(e.id);return a.has(e.id)||!t||!Zo(t,e)});return t.steps.forEach((e,n)=>{let r=i.get(e.id);if(r&&Zo(r,e))return;let a=o.findIndex(t=>t.id===e.id);if(a!==-1){o[a]=e;return}let s=t.steps.slice(0,n).reverse().find(e=>o.some(t=>t.id===e.id));o.splice(s?o.findIndex(e=>e.id===s.id)+1:0,0,e)}),{...r,steps:o}}function $o(e){let t=d(),n=(0,U.useMemo)(()=>[`wizard`,e],[e]),r=`/api/studio/wizards/${e}`,i=(0,U.useRef)(null),a=(0,U.useRef)(Promise.resolve()),s=(0,U.useRef)(null),c=(0,U.useRef)(null),l=(0,U.useRef)(!1),[p,m]=(0,U.useState)(!1),[g,_]=(0,U.useState)(0),[v,ee]=(0,U.useState)(null),[te,ne]=(0,U.useState)(null),re=(0,U.useCallback)(()=>!!(i.current||l.current||s.current),[]),y=(0,U.useCallback)(async()=>{let e=await u.get(r);t.setQueryData(n,t=>t&&re()?{...e,draft:t.draft,title:t.title,revision:t.revision,dirty:!0}:e)},[t,n,r,re]),b=(0,U.useCallback)(()=>{a.current=a.current.then(async()=>{let e=s.current,i=t.getQueryData(n);if(e&&i){s.current=null,l.current=!0,m(!0);try{let a=await u.put(`${r}/draft`,{definition:e,baseRevision:i.revision});c.current=s.current?e:null,t.setQueryData(n,e=>e&&{...e,revision:a.revision,issues:a.issues})}catch(i){let a=h(i);if(a){s.current=null,c.current=null,ne(a);let e=await u.get(r).catch(()=>null);e&&t.setQueryData(n,e);return}if(!(i instanceof f&&i.status===409)){s.current??=e,console.error(`[draft] save failed`,i);return}let o=await u.get(r),l=Qo(c.current??o.draft,s.current??e,o.draft);c.current=o.draft,s.current=l,t.setQueryData(n,{...o,draft:l,title:l.title,dirty:!0}),_(Date.now()),b()}finally{l.current=!1,m(!1)}}})},[t,n,r]),x=(0,U.useCallback)(r=>{e&&(re()||(c.current=t.getQueryData(n)?.draft??null),s.current=r,t.setQueryData(n,e=>e&&{...e,draft:r,title:r.title,dirty:!0}),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{i.current=null,b()},600))},[t,n,e,re,b]);return(0,U.useEffect)(()=>{if(!e)return;let r=new EventSource(o(`/api/studio/wizards/${e}/stream`));return r.addEventListener(`change`,e=>{let r=JSON.parse(e.data),i=t.getQueryData(n);r.kind===`draft`&&i&&r.revision<=i.revision||(y(),r.kind===`draft`&&r.source===`mcp`&&ee({client:r.client??`MCP`,steps:r.touched,at:Date.now()}))}),r.addEventListener(`hello`,e=>{let{revision:r}=JSON.parse(e.data),i=t.getQueryData(n);i&&r!==i.revision&&y()}),()=>r.close()},[t,n,e,y]),(0,U.useEffect)(()=>{if(!v)return;let e=setTimeout(()=>ee(null),6e3);return()=>clearTimeout(e)},[v]),(0,U.useEffect)(()=>{if(!g)return;let e=setTimeout(()=>_(0),4e3);return()=>clearTimeout(e)},[g]),{save:x,saving:p,remote:v,merged:g>0,refused:te}}function es({remote:e,merged:t}){return e?(0,W.jsxs)(R,{tone:`ember`,children:[(0,W.jsx)(Ae,{className:`size-3`}),` `,H(`editor.changedVia`,{client:e.client})]}):t?(0,W.jsxs)(R,{children:[(0,W.jsx)(pt,{className:`size-3`}),` `,H(`editor.merged`)]}):null}var ts=[...D,`image`,`video`],ns={chat:`editor.chat`,step:`editor.step`,files:`editor.files`,runs:`editor.runs`},rs=`wizards.editor.pane`,is=420,as=340,os=()=>Math.max(as,window.innerWidth-480);function ss(){try{let e=Number(localStorage.getItem(rs));return e?Math.min(Math.max(e,as),os()):is}catch{return is}}function cs(){let[e,t]=(0,U.useState)(ss),n=(0,U.useCallback)(e=>{let n=Math.round(Math.min(Math.max(e,as),os()));t(n);try{localStorage.setItem(rs,String(n))}catch{}},[]);return{width:e,onPointerDown:t=>{t.preventDefault();let r=t.clientX,i=e,a=e=>n(i+r-e.clientX),o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},onKeyDown:t=>{let r=t.shiftKey?64:16;t.key===`ArrowLeft`?(t.preventDefault(),n(e+r)):t.key===`ArrowRight`&&(t.preventDefault(),n(e-r))},reset:()=>n(is)}}function ls(){let{id:e}=l(),t=i(),n=d(),a=_(),[s,f]=r(),h=c({queryKey:[`wizard`,e],queryFn:()=>u.get(`/api/studio/wizards/${e}`),refetchOnWindowFocus:!1}),[v,te]=(0,U.useState)(null),[y,b]=(0,U.useState)(`chat`),x=cs(),[ie,S]=(0,U.useState)(!1),[ae,oe]=(0,U.useState)(null),[se,ce]=(0,U.useState)(null),le=(0,U.useCallback)(e=>ce(e&&e.status!==`done`?e.step?.id??null:null),[]),{save:pe,saving:me,remote:C,merged:he,refused:ge}=$o(e),_e=p(),w=ue(h.data,(t,r)=>{n.setQueryData([`wizard`,e],e=>e&&{...e,draft:t,revision:r,title:t.title,blank:!1})}),ve=(0,U.useRef)(!1);(0,U.useEffect)(()=>{let e=s.get(`prompt`);e&&h.data&&!ve.current&&(ve.current=!0,f({},{replace:!0}),w.send(e))},[s,h.data,w,f]);let T=c({queryKey:[`wizard-models`,e,h.data?.revision],queryFn:()=>u.get(`/api/studio/wizards/${e}/models`),enabled:!!h.data}).data?.missing??[],be=a.data?.mode===`local`&&!!a.data.account,xe=g(e??``,!!e&&be),Se=T.some(e=>e.blocking),E=m({mutationFn:()=>u.post(`/api/studio/wizards/${e}/test-runs`),onSuccess:({runId:e})=>oe(e)}),D=m({mutationFn:()=>u.post(`/api/studio/wizards/${e}/publish`),onSuccess:async({cloud:t})=>{t&&n.setQueryData([`cloud`,e],{linked:!0,...t}),await Promise.all([n.invalidateQueries({queryKey:[`wizard`,e]}),n.invalidateQueries({queryKey:[`cloud`,e]}),n.invalidateQueries({queryKey:[`wizards`]})]),S(!0)}}),Ce=(0,U.useMemo)(()=>new Set((h.data?.issues??[]).map(e=>e.stepId).filter(Boolean)),[h.data?.issues]);if(h.isLoading||!a.data)return(0,W.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center text-ink-4`,children:(0,W.jsx)(Te,{})});if(!h.data)return(0,W.jsx)(`div`,{className:`p-10 text-center text-ink-3`,children:H(`run.notFound`)});let O=h.data,k=O.draft,A=w.phase!==`idle`&&O.blank,j=O.issues.length>0,we=_e.data?.find(e=>e.id===O.projectId),M=we?we.origin===`local`:a.data.limits.build||_e.isLoading,Ee=O.readOnly?H(M?`readonly.wizard`:`readonly.server`):null,P=a.data.mode===`local`&&ke.account&&T.some(e=>ts.includes(e.cls))?a.data.account?a.data.models?.source===`account`?null:`use`:`connect`:null,F=ge??(D.error?D.error.message:null),L=e=>{te(e),e&&b(`step`)};return(0,W.jsxs)(`div`,{className:`flex h-dvh flex-col`,children:[Ee?(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-border-soft border-b bg-paper-2 px-4 py-2 text-[13px] text-ink-2 sm:px-6`,children:[(0,W.jsx)(ye,{className:`size-4 shrink-0 text-ink-3`}),(0,W.jsx)(`p`,{className:`min-w-0 flex-1`,children:Ee})]}):null,F?(0,W.jsx)(`div`,{className:`shrink-0 bg-rose-tint px-4 py-2 text-[13px] text-rose sm:px-6`,children:F}):null,(0,W.jsxs)(`header`,{className:`flex h-16 shrink-0 items-center gap-2 px-3 sm:px-4`,children:[(0,W.jsx)(I,{label:`Zurück`,onClick:()=>t(`/`),children:(0,W.jsx)(re,{className:`size-5`})}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>L(`__wizard`),className:`min-w-0 truncate rounded-md px-2 py-1 text-left hover:bg-accent`,children:(0,W.jsx)(`span`,{className:`font-display font-semibold text-[17px] tracking-tight`,children:k.title})}),(0,W.jsx)(`span`,{className:`hidden sm:inline-flex`,children:O.published?O.dirty?(0,W.jsx)(R,{tone:`warn`,children:H(`editor.unpublishedChanges`)}):(0,W.jsx)(Ie,{where:Le(O,a.data,be?xe.data:null),me:a.data,version:O.publishedVersion}):(0,W.jsx)(R,{children:H(`editor.notPublished`)})}),me?(0,W.jsx)(Te,{className:`size-4 text-ink-4`}):null,(0,W.jsx)(`span`,{className:`hidden md:inline-flex`,children:(0,W.jsx)(es,{remote:C,merged:he})}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,W.jsx)(`a`,{href:o(`/api/studio/wizards/${O.id}/export`),download:!0,"aria-label":H(`editor.export`),title:H(`editor.export`),className:`hidden size-9 shrink-0 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink sm:inline-flex`,children:(0,W.jsx)(Be,{className:`size-4`})}),(0,W.jsxs)(B,{variant:`secondary`,size:`sm`,disabled:j||A||Se,busy:E.isPending,onClick:()=>E.mutate(),children:[(0,W.jsx)(_t,{className:`size-3.5`}),` `,H(`editor.test`)]}),O.published&&(!O.dirty||O.readOnly)?(0,W.jsxs)(B,{size:`sm`,onClick:()=>S(!0),children:[(0,W.jsx)(ee,{className:`size-3.5`}),` `,H(`editor.share`)]}):O.readOnly?null:(0,W.jsxs)(W.Fragment,{children:[be?(0,W.jsx)(I,{label:H(`editor.share`),className:`max-sm:hidden`,onClick:()=>S(!0),children:(0,W.jsx)(ee,{className:`size-4`})}):null,(0,W.jsx)(B,{size:`sm`,disabled:j||A,busy:D.isPending,onClick:()=>D.mutate(),children:H(`editor.publish`)})]}),(0,W.jsx)(`span`,{className:`ml-2 hidden md:inline-flex`,children:(0,W.jsx)(Re,{me:a.data})}),(0,W.jsx)(`span`,{className:`hidden sm:inline-flex`,children:(0,W.jsx)(Pe,{me:a.data})})]})]}),(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col lg:flex-row`,children:[(0,W.jsxs)(`section`,{className:`relative min-h-[45vh] flex-1 overflow-hidden lg:min-h-0`,children:[j&&!A?(0,W.jsxs)(`div`,{className:`absolute top-3 right-3 left-3 z-10 mx-auto max-w-xl animate-rise rounded-xl bg-card p-4 shadow-elevated ring-1 ring-rose/30`,children:[(0,W.jsx)(`p`,{className:`text-[14px]`,children:H(`editor.issues`)}),(0,W.jsx)(`ul`,{className:`mt-2 list-disc pl-5 text-[13px] text-ink-2`,children:O.issues.slice(0,4).map((e,t)=>(0,W.jsx)(`li`,{children:e.message},t))}),O.readOnly?null:(0,W.jsx)(B,{size:`sm`,variant:`quiet`,className:`mt-3`,disabled:w.phase!==`idle`,onClick:()=>{b(`chat`),w.send(`Bitte behebe diese Probleme im Wizard:\n${O.issues.map(e=>`- ${e.message}`).join(`
|
|
2
|
+
`)}`)},children:H(`editor.fixWithChat`)})]}):null,!j&&!A&&T.length?(0,W.jsxs)(`div`,{className:N(`absolute top-3 right-3 left-3 z-10 mx-auto max-w-xl animate-rise rounded-xl bg-card p-4 shadow-elevated ring-1`,Se?`ring-rose/30`:`ring-amber/30`),children:[(0,W.jsx)(`p`,{className:`text-[14px]`,children:H(Se?`editor.models.blocking`:`editor.models.optional`)}),(0,W.jsx)(`ul`,{className:`mt-2 list-disc pl-5 text-[13px] text-ink-2`,children:T.map(e=>(0,W.jsxs)(`li`,{children:[(0,W.jsx)(`span`,{className:`text-ink`,children:H(`class.${e.cls}`)}),` (`,e.steps.map(e=>`„${e.title}“`).join(`, `),`): `,e.problem]},e.cls))}),(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,W.jsx)(B,{size:`sm`,variant:`quiet`,onClick:()=>t(`/settings/models`),children:H(`editor.models.settings`)}),P===`connect`?(0,W.jsxs)(`p`,{className:`text-[13px] text-ink-3`,children:[H(`teaser.models`),` `,(0,W.jsx)(`button`,{type:`button`,className:`font-medium text-ink underline underline-offset-2`,onClick:()=>t(`/settings/account`),children:H(`teaser.connect`)})]}):P===`use`?(0,W.jsx)(`p`,{className:`text-[13px] text-ink-3`,children:H(`teaser.modelsLinked`)}):null]})]}):null,A?(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center px-6 text-[14px] text-ink-3`,children:(0,W.jsx)(de,{chat:w,spinner:`size-4 text-ember`})}):(0,W.jsx)(Ea,{def:k,selected:v,onSelect:L,issueSteps:Ce,activeStep:ae?se:null,pulse:C?.steps,wizardId:O.id})]}),(0,W.jsxs)(`aside`,{className:`relative flex h-[55vh] min-h-0 w-full shrink-0 flex-col bg-card shadow-[0_0_0_1px_var(--border-soft)] lg:h-auto lg:w-(--pane) lg:rounded-tl-3xl`,style:{"--pane":`${x.width}px`},children:[(0,W.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":H(`editor.resize`),"aria-valuenow":x.width,tabIndex:0,title:H(`editor.resize`),onPointerDown:x.onPointerDown,onKeyDown:x.onKeyDown,onDoubleClick:x.reset,className:`group -left-1.5 absolute inset-y-0 z-10 hidden w-5 cursor-col-resize outline-none lg:block`,children:(0,W.jsx)(`span`,{className:`-translate-y-1/2 absolute top-1/2 left-[9px] h-12 w-1.5 rounded-full bg-ink-4/40 transition group-hover:bg-ember/70 group-focus-visible:bg-ember group-active:h-16 group-active:bg-ember`})}),(0,W.jsx)(`nav`,{className:`flex shrink-0 gap-1 px-3 pt-3`,children:[`chat`,`step`,`files`,`runs`].map(e=>(0,W.jsx)(`button`,{type:`button`,onClick:()=>b(e),className:N(`h-9 rounded-full px-4 font-medium text-[13px] transition`,y===e?`bg-paper-2 text-ink`:`text-ink-3 hover:text-ink`),children:H(ns[e])},e))}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:y===`chat`?(0,W.jsx)(fe,{chat:w,avatar:k.avatar,closed:Ee??void 0}):y===`step`?(0,W.jsx)(Ha,{def:k,selected:v,update:pe,onSelect:L,issues:O.issues,mcpServers:O.mcpServers,files:O.files,wizardId:O.id,readOnly:O.readOnly}):y===`files`?(0,W.jsx)(wt,{wizardId:O.id,files:O.files,readOnly:O.readOnly}):(0,W.jsx)(Ga,{wizardId:O.id,onOpen:oe})})]})]}),ae?(0,W.jsx)(`div`,{className:`fixed inset-0 z-50 flex justify-end bg-[oklch(20%_0.01_60/0.22)] backdrop-blur-[1px]`,onClick:()=>oe(null),children:(0,W.jsxs)(`div`,{className:`flex h-full w-full max-w-[680px] animate-rise flex-col bg-background shadow-overlay`,onClick:e=>e.stopPropagation(),children:[(0,W.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center justify-between px-4`,children:[(0,W.jsx)(R,{children:`Test`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(B,{variant:`ghost`,size:`sm`,busy:E.isPending,disabled:j,onClick:()=>E.mutate(),children:H(`editor.restart`)}),(0,W.jsx)(I,{label:H(`editor.close`),onClick:()=>oe(null),children:(0,W.jsx)(je,{className:`size-5`})})]})]}),(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,W.jsx)(ne,{runId:ae,compact:!0,onRestart:()=>E.mutate(),onView:le},ae)})]})}):null,(0,W.jsx)(Yo,{wizard:O,open:ie,onClose:()=>S(!1),publish:O.readOnly?void 0:{run:()=>D.mutate(),busy:D.isPending,disabled:j||A}})]})}export{ls as EditorPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{h as r}from"./ui-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{h as r}from"./ui-BT0Y_Hci.js";import{a as i,c as a,i as o,n as s,r as c,s as l,t as u}from"./esm-rJY59Ixx.js";var d=e(t(),1),f=e(n(),1),p=208,m=42,h=26,g=22,_=132;function v({data:e}){let t=e.icon;return(0,f.jsxs)(`div`,{style:{width:p,height:m},className:r(`flex cursor-default items-center gap-2.5 rounded-xl px-2.5`,e.optional?`border border-ink-4 border-dashed`:`bg-paper-2 ring-1 ring-border-soft`),children:[(0,f.jsx)(c,{type:`target`,position:a.Top}),(0,f.jsx)(c,{type:`target`,id:`in`,position:a.Right}),(0,f.jsx)(`span`,{className:r(`inline-flex size-6 shrink-0 items-center justify-center rounded-md`,e.tone),children:(0,f.jsx)(t,{className:`size-3.5`})}),(0,f.jsx)(`span`,{className:`truncate font-medium text-[13px] text-ink`,children:e.title}),(0,f.jsx)(c,{type:`source`,position:a.Bottom}),(0,f.jsx)(c,{type:`source`,id:`out`,position:a.Right})]})}function y({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,markerEnd:a}){let o=Math.max(e,n)+g,c=[`M ${e} ${t}`,`H ${o-8}`,`Q ${o} ${t} ${o} ${t+8}`,`V ${r-8}`,`Q ${o} ${r} ${o-8} ${r}`,`H ${n}`].join(` `);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u,{path:c,markerEnd:a,style:{strokeDasharray:`5 4`}}),(0,f.jsx)(s,{children:(0,f.jsx)(`div`,{style:{width:_,transform:`translate(${o+8}px, ${(t+r)/2}px) translateY(-50%)`},className:`absolute text-[11px] text-ink-2 leading-snug`,children:i})})]})}var b={step:v},x={branch:y};function S(e){let t={markerEnd:{type:l.ArrowClosed,width:14,height:14,color:`var(--ink-4)`}},n=e.map((e,t)=>({id:e.id,type:`step`,position:{x:0,y:t*68},data:{title:e.title,icon:e.icon,tone:e.tone,optional:e.optional},draggable:!1})),r=[],i=!1;return e.forEach((n,a)=>{let o=e[a+1];for(let[a,o]of(n.branches??[]).entries())e.some(e=>e.id===o.to)&&(i=!0,r.push({id:`b-${n.id}-${a}`,type:`branch`,source:n.id,sourceHandle:`out`,target:o.to,targetHandle:`in`,label:o.when,...t}));o&&r.push({id:`n-${n.id}`,type:`straight`,source:n.id,target:o.id,...t})}),{nodes:n,edges:r,width:p+(i?162:0),height:e.length*68-h}}function C({steps:e}){let{nodes:t,edges:n,width:r,height:a}=(0,d.useMemo)(()=>S(e),[e]);return e.length?(0,f.jsx)(`div`,{className:`max-w-full`,style:{width:r,height:a+4},children:(0,f.jsx)(o,{children:(0,f.jsx)(i,{nodes:t,edges:n,nodeTypes:b,edgeTypes:x,defaultViewport:{x:1,y:2,zoom:1},minZoom:1,maxZoom:1,nodesConnectable:!1,nodesDraggable:!1,nodesFocusable:!1,edgesFocusable:!1,elementsSelectable:!1,panOnDrag:!1,panOnScroll:!1,zoomOnScroll:!1,zoomOnPinch:!1,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0}})})}):null}export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,t as r}from"./jsx-runtime-D3jfb0Ew.js";import{O as i,d as a,j as o,n as s,nt as c,w as l}from"./api-Bf-l9Sd8.js";import{f as u,l as d,s as f,u as p}from"./session-C7LDDcj7.js";import{t as m}from"./createLucideIcon-q3MZMmnf.js";import{t as h}from"./check-CUpby_J9.js";import{n as g,t as _}from"./plus-Du-Jx8aI.js";import{n as v,r as y}from"./Account-DLLeEwJL.js";import{_ as b,a as x,i as S,n as C,o as w,r as T,s as E,t as D,u as O,y as k}from"./ui-BT0Y_Hci.js";import{a as A,d as j,o as M,r as N,s as P}from"./index-BR5ELbeZ.js";import{r as F}from"./LocalRuntime-C199bg_B.js";import{t as I}from"./ImportWizard-BockXJXm.js";var L={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};L.node;var R=m(L),z=t({HomePage:()=>J,ProjectSwitcher:()=>H}),B=e(n(),1),V=e(r(),1);function H(){let{project:e,projects:t,select:n}=f(),r=p().data?.limits.projects??1,i=d(),a=c(),[o,l]=(0,B.useState)(!1),[m,h]=(0,B.useState)(``),g=u({mutationFn:()=>s.post(`/api/studio/projects`,{name:m}),onSuccess:async({id:e})=>{await a.invalidateQueries({queryKey:[`projects`]}),n(e),l(!1),h(``)}});return!e||r<=1?null:(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(O,{className:`w-56`,value:e.id,onChange:e=>e===`__new`?l(!0):n(e),options:[...t.map(e=>({value:e.id,label:e.name})),...i?[t.length<r?{value:`__new`,label:`+ ${k(`home.newProject`)}`}:{value:`__new`,label:k(`home.projectLimit`,{n:r}),disabled:!0}]:[]]}),(0,V.jsx)(S,{open:o,onClose:()=>l(!1),title:k(`home.newProject`),children:(0,V.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),m.trim()&&g.mutate()},children:[(0,V.jsx)(E,{autoFocus:!0,placeholder:k(`home.projectName`),value:m,onChange:e=>h(e.target.value)}),(0,V.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,V.jsx)(D,{variant:`ghost`,onClick:()=>l(!1),children:k(`common.cancel`)}),(0,V.jsx)(D,{type:`submit`,busy:g.isPending,disabled:!m.trim(),children:k(`home.newProject`)})]})]})})]})}function U({url:e}){let[t,n]=(0,B.useState)(!1);return(0,V.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[13px] text-ink-3 hover:bg-accent hover:text-ink`,children:[t?(0,V.jsx)(h,{className:`size-3.5`}):(0,V.jsx)(g,{className:`size-3.5`}),k(t?`share.copied`:`share.link`)]})}function W(){let e=i(),t=y(!1),[n,r]=(0,B.useState)(!1),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!n)return;let e=e=>{a.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,V.jsxs)(`div`,{className:`relative`,ref:a,onClick:e=>e.stopPropagation(),children:[(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[13px] text-ink-3 hover:bg-accent hover:text-ink`,children:[(0,V.jsx)(g,{className:`size-3.5`}),` `,k(`share.link`)]}),n?(0,V.jsxs)(`div`,{className:`absolute right-0 bottom-10 z-20 flex w-72 animate-rise flex-col gap-3 rounded-xl bg-card p-3.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,V.jsx)(`p`,{className:`text-[13px] text-ink-2 leading-relaxed`,children:k(`teaser.link`)}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsx)(D,{size:`sm`,busy:t.link.isPending,onClick:()=>t.link.mutate({}),children:k(`account.signIn`)}),(0,V.jsx)(D,{size:`sm`,variant:`secondary`,onClick:()=>e(`/settings/account`),children:k(`account.create`)})]}),(0,V.jsx)(v,{...t})]}):null]})}function G({w:e,me:t}){let n=i(),r=P(e,t,e.cloud),o=M(r),s=o??(e.published?A(e):null);return(0,V.jsxs)(`div`,{className:`relative pt-6`,children:[(0,V.jsx)(`div`,{className:`pointer-events-none absolute top-0 left-4 z-10`,children:(0,V.jsx)(a,{kind:e.avatar,size:52,interactive:!1})}),(0,V.jsxs)(C,{className:`relative flex h-full cursor-pointer flex-col px-5 pt-10 pb-3 transition hover:shadow-elevated`,onClick:()=>n(`/edit/${e.id}`),children:[(0,V.jsx)(`div`,{className:`absolute top-3 right-3`,children:e.published?(0,V.jsx)(N,{where:r,me:t}):(0,V.jsx)(T,{children:k(`home.draft`)})}),(0,V.jsx)(`h3`,{className:`font-display font-semibold text-[17px] leading-snug`,children:e.title}),(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[14px] text-ink-3`,children:e.description}),(0,V.jsxs)(`div`,{className:`mt-auto flex min-h-8 items-center justify-between pt-3`,children:[(0,V.jsx)(`span`,{className:`text-[12px] text-ink-4`,children:k(`home.steps`,{n:e.stepCount})}),(0,V.jsxs)(`div`,{className:`flex items-center`,children:[o?(0,V.jsx)(U,{url:o}):r.kind===`here`&&j.account?(0,V.jsx)(W,{}):null,s?(0,V.jsx)(w,{label:k(o?`share.open`:`share.openHere`),className:`ml-1 size-8`,onClick:e=>{e.stopPropagation(),F(s)},children:(0,V.jsx)(R,{className:`size-4`})}):null]})]})]})]})}var K=`curl -fsSL https://engenty.ai/install.sh | bash`;function q(){let[e,t]=(0,B.useState)(!1),n=[k(`home.local.install`),k(`home.local.signIn`),k(`home.local.publish`)];return(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-xl animate-rise flex-col items-center pt-4 text-center`,children:[(0,V.jsx)(a,{kind:`round`,size:120}),(0,V.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[28px] leading-tight tracking-tight`,children:k(`home.local.title`)}),(0,V.jsx)(`p`,{className:`mt-3 text-[15px] text-ink-2 leading-relaxed`,children:k(`home.local.text`)}),(0,V.jsx)(`ol`,{className:`mt-8 flex w-full flex-col gap-4 text-left`,children:n.map((n,r)=>(0,V.jsxs)(`li`,{className:`flex gap-3`,children:[(0,V.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-paper-2 font-medium text-[13px] text-ink-2`,children:r+1}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,V.jsx)(`p`,{className:`text-[15px] leading-snug`,children:n}),r===0?(0,V.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-lg bg-paper-2 py-1.5 pr-1.5 pl-3`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 select-all overflow-x-auto whitespace-nowrap font-mono text-[13px] text-ink-2`,children:K}),(0,V.jsxs)(D,{variant:`secondary`,size:`sm`,onClick:()=>{navigator.clipboard.writeText(K),t(!0),setTimeout(()=>t(!1),1500)},children:[e?(0,V.jsx)(h,{className:`size-3.5`}):(0,V.jsx)(g,{className:`size-3.5`}),k(e?`share.copied`:`share.copy`)]})]}):null]})]},n))})]})}function J(){let e=i(),{project:t,projects:n,loading:r}=f(),a=p().data,c=d(),u=o({queryKey:[`wizards`,t?.id,!!a?.account],queryFn:()=>s.get(`/api/studio/projects/${t.id}/wizards`),enabled:!!t}),m=n.reduce((e,t)=>e+t.wizardCount,0),h=c&&!t?.readOnly;return!r&&h&&n.length&&m===0?(0,V.jsx)(l,{to:`/new`,replace:!0}):!r&&!c&&n.length===0?(0,V.jsx)(q,{}):(0,V.jsxs)(`div`,{className:`animate-rise`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,V.jsx)(`div`,{children:(0,V.jsx)(H,{})}),h?(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(I,{}),(0,V.jsxs)(D,{onClick:()=>e(`/new`),children:[(0,V.jsx)(_,{className:`size-4`}),` `,k(`home.new`)]})]}):null]}),(0,V.jsx)(`h1`,{className:`mt-10 font-display font-semibold text-[28px] tracking-tight`,children:k(`home.title`)}),t?.origin===`local`?(0,V.jsxs)(`p`,{className:`mt-2 text-[14px] text-ink-3`,children:[k(`home.fromLocal`),` `,t.syncedAt?k(`home.syncedAt`,{when:new Intl.DateTimeFormat(b,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(t.syncedAt))}):null]}):null,u.data&&u.data.length===0?(0,V.jsx)(x,{children:k(`home.empty`)}):null,(0,V.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:a?u.data?.map(e=>(0,V.jsx)(G,{w:e,me:a},e.id)):null})]})}export{H as n,z as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,n as i,nt as a,t as o}from"./api-
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,n as i,nt as a,t as o}from"./api-Bf-l9Sd8.js";import{f as s,l as c,s as l}from"./session-C7LDDcj7.js";import{t as u}from"./upload-DNRENWzQ.js";import{i as d,t as f,y as p}from"./ui-BT0Y_Hci.js";var m=e(t(),1),h=e(n(),1);function g({variant:e=`secondary`,label:t=p(`home.import`)}){let n=r(),g=a(),{project:_}=l(),v=c(),y=(0,m.useRef)(null),b=s({mutationFn:e=>i.upload(`/api/studio/projects/${_.id}/wizards/import`,e),onSuccess:async({id:e})=>{await g.invalidateQueries({queryKey:[`projects`]}),await g.invalidateQueries({queryKey:[`wizards`]}),n(`/edit/${e}`)}}),x=b.error instanceof o?b.error.body?.issues??[]:[];return!v||_?.readOnly?null:(0,h.jsxs)(h.Fragment,{children:[(0,h.jsxs)(f,{variant:e,busy:b.isPending,disabled:!_,onClick:()=>y.current?.click(),children:[(0,h.jsx)(u,{className:`size-4`}),` `,t]}),(0,h.jsx)(`input`,{ref:y,hidden:!0,type:`file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&b.mutate(t)}}),(0,h.jsxs)(d,{open:b.isError,onClose:b.reset,title:p(`import.failed`),children:[(0,h.jsx)(`p`,{className:`text-[14px] text-ink-2`,children:b.error?.message}),x.length?(0,h.jsx)(`ul`,{className:`mt-3 flex list-disc flex-col gap-1 pl-5 text-[13px] text-ink-2`,children:x.slice(0,8).map(e=>(0,h.jsx)(`li`,{children:e.message},e.message))}):null,(0,h.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,h.jsx)(f,{variant:`secondary`,onClick:b.reset,children:p(`common.close`)})})]})]})}export{g as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{S as r,c as i,n as a,nt as o}from"./api-C7nO5qT8.js";import{f as s,u as c}from"./session-C44_g_hY.js";import{t as l}from"./check-CUpby_J9.js";import{a as u,p as d}from"./definition-DndaH5Ow.js";import{c as f,h as p,l as m,n as h,s as g,t as _,y as v}from"./ui-BHAxG0j4.js";import{d as ee}from"./index-Dp8RnbHf.js";var te=2,ne=1,re=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(te,Math.floor(u/e.css.cell.width)),rows:Math.max(ne,Math.floor(l/e.css.cell.height))}}},ie=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=oe.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function ae(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var oe=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!ae(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},se=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function y(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ce=class{constructor(e=y,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||se;this._linkProvider=this._terminal.registerLinkProvider(new ie(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},b=Object.defineProperty,le=Object.getOwnPropertyDescriptor,ue=(e,t)=>{for(var n in t)b(e,n,{get:t[n],enumerable:!0})},x=(e,t,n,r)=>{for(var i=r>1?void 0:r?le(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&b(t,n,i),i},S=(e,t)=>(n,r)=>t(n,r,e),de=`Terminal input`,fe={get:()=>de,set:e=>de=e},pe=`Too much output to announce, navigate to rows manually to read`,me={get:()=>pe,set:e=>pe=e};function he(e){return e.replace(/\r?\n/g,`\r`)}function C(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ge(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function _e(e,t,n,r){e.stopPropagation(),e.clipboardData&&ve(e.clipboardData.getData(`text/plain`),t,n,r)}function ve(e,t,n,r){e=he(e),e=C(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ye(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function be(e,t,n,r,i){ye(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function xe(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Se(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Ce=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},we=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Te=``,Ee=` `,De=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Oe}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Oe=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ke=class e extends De{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Oe,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?xe(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ae=`di$target`,je=`di$dependencies`,Me=new Map;function Ne(e){return e[je]||[]}function w(e){if(Me.has(e))return Me.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Pe(t,e,r)};return t._id=e,Me.set(e,t),t}function Pe(e,t,n){t[Ae]===t?t[je].push({id:e,index:n}):(t[je]=[{id:e,index:n}],t[Ae]=t)}var T=w(`BufferService`),Fe=w(`CoreMouseService`),Ie=w(`CoreService`),Le=w(`CharsetService`),Re=w(`InstantiationService`),ze=w(`LogService`),E=w(`OptionsService`),Be=w(`OscLinkService`),Ve=w(`UnicodeService`),He=w(`DecorationService`),Ue=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new ke,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):We(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Ue=x([S(0,T),S(1,E),S(2,Be)],Ue);function We(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1
|
+
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{S as r,c as i,n as a,nt as o}from"./api-Bf-l9Sd8.js";import{f as s,u as c}from"./session-C7LDDcj7.js";import{t as l}from"./check-CUpby_J9.js";import{a as u,p as d}from"./definition-DndaH5Ow.js";import{c as f,h as p,l as m,n as h,s as g,t as _,y as v}from"./ui-BT0Y_Hci.js";import{d as ee}from"./index-BR5ELbeZ.js";var te=2,ne=1,re=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(te,Math.floor(u/e.css.cell.width)),rows:Math.max(ne,Math.floor(l/e.css.cell.height))}}},ie=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=oe.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function ae(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var oe=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!ae(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},se=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function y(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ce=class{constructor(e=y,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||se;this._linkProvider=this._terminal.registerLinkProvider(new ie(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},b=Object.defineProperty,le=Object.getOwnPropertyDescriptor,ue=(e,t)=>{for(var n in t)b(e,n,{get:t[n],enumerable:!0})},x=(e,t,n,r)=>{for(var i=r>1?void 0:r?le(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&b(t,n,i),i},S=(e,t)=>(n,r)=>t(n,r,e),de=`Terminal input`,fe={get:()=>de,set:e=>de=e},pe=`Too much output to announce, navigate to rows manually to read`,me={get:()=>pe,set:e=>pe=e};function he(e){return e.replace(/\r?\n/g,`\r`)}function C(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function ge(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function _e(e,t,n,r){e.stopPropagation(),e.clipboardData&&ve(e.clipboardData.getData(`text/plain`),t,n,r)}function ve(e,t,n,r){e=he(e),e=C(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function ye(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function be(e,t,n,r,i){ye(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function xe(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Se(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var Ce=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},we=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},Te=``,Ee=` `,De=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Oe}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Oe=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},ke=class e extends De{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Oe,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?xe(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Ae=`di$target`,je=`di$dependencies`,Me=new Map;function Ne(e){return e[je]||[]}function w(e){if(Me.has(e))return Me.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Pe(t,e,r)};return t._id=e,Me.set(e,t),t}function Pe(e,t,n){t[Ae]===t?t[je].push({id:e,index:n}):(t[je]=[{id:e,index:n}],t[Ae]=t)}var T=w(`BufferService`),Fe=w(`CoreMouseService`),Ie=w(`CoreService`),Le=w(`CharsetService`),Re=w(`InstantiationService`),ze=w(`LogService`),E=w(`OptionsService`),Be=w(`OscLinkService`),Ve=w(`UnicodeService`),He=w(`DecorationService`),Ue=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new ke,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):We(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Ue=x([S(0,T),S(1,E),S(2,Be)],Ue);function We(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
2
2
|
|
|
3
3
|
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var Ge=w(`CharSizeService`),Ke=w(`CoreBrowserService`),qe=w(`MouseService`),Je=w(`RenderService`),Ye=w(`SelectionService`),Xe=w(`CharacterJoinerService`),Ze=w(`ThemeService`),Qe=w(`LinkProviderService`),$e=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?at.isErrorNoTelemetry(e)?new at(e.message+`
|
|
4
4
|
|