@engenty/wizards-runtime 0.20.1 → 0.20.3
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/README.md +1 -1
- package/apps/runtime/dist/docs/dev/licensing.md +8 -2
- package/apps/web/dist/assets/{AboutDialog-BFi6vOyJ.js → AboutDialog-yRjyXFhD.js} +1 -1
- package/apps/web/dist/assets/{BlockEditor-C44bI_ih.js → BlockEditor-CgjXTWly.js} +1 -1
- package/apps/web/dist/assets/{Bundle-DZyQ1FP7.js → Bundle-C0u5HUZL.js} +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-BBwxihnJ.js +2 -0
- package/apps/web/dist/assets/{ChangelogDialog-CdchxTO8.js → ChangelogDialog-BxtnRjNY.js} +1 -1
- package/apps/web/dist/assets/{CodeEditor-BRufUwu0.js → CodeEditor-2LyHbSre.js} +1 -1
- package/apps/web/dist/assets/{ConnectorsSection-CNpieoyT.js → ConnectorsSection-uN3ROkh7.js} +1 -1
- package/apps/web/dist/assets/EditorPage-CKIfeYsN.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-aj58c-gH.js → FlowPreview-BXf4EKjU.js} +1 -1
- package/apps/web/dist/assets/{LangSwitch-BNkytlus.js → LangSwitch-BLB7dDce.js} +1 -1
- package/apps/web/dist/assets/{Marketplace-D3hdvrkz.js → Marketplace-B3NoH5Va.js} +2 -2
- package/apps/web/dist/assets/{NewWizardChannels-0aZoziks.js → NewWizardChannels-AlhLVY20.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-Bn2BPaUB.js → NewWizardPage-BDcuWOj8.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-DwF6KdQy.js → OnboardingPage-RawpCO9J.js} +1 -1
- package/apps/web/dist/assets/{ProtocolSection-Ce5LBBzL.js → ProtocolSection-CitqePxZ.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-Bp4DxTrD.js → PublicRunner-COatyxMi.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-BFVaKM3w.js → ReadOnly-DdZkxi3i.js} +1 -1
- package/apps/web/dist/assets/{Results--mJFsNH2.js → Results-8Gg0SaKt.js} +1 -1
- package/apps/web/dist/assets/{RunDrawer-DtbxGBIm.js → RunDrawer-CMH1croV.js} +1 -1
- package/apps/web/dist/assets/SettingsPage-C8wt06Yg.js +2 -0
- package/apps/web/dist/assets/{SetupPage-B5zCrIKT.js → SetupPage-CaFQY_A-.js} +1 -1
- package/apps/web/dist/assets/{SharePage-CgQp_PT6.js → SharePage-Drntg_oj.js} +1 -1
- package/apps/web/dist/assets/{SkillEditor-ARx8QPGp.js → SkillEditor-Ca_bzmjD.js} +1 -1
- package/apps/web/dist/assets/{Skills-frfXXEcF.js → Skills-BcgxuD15.js} +1 -1
- package/apps/web/dist/assets/SpacePage-Di7_gp23.js +2 -0
- package/apps/web/dist/assets/StudioHome-D79RHQ6J.js +1 -0
- package/apps/web/dist/assets/TableEditor-DyBlN8W3.js +7 -0
- package/apps/web/dist/assets/{UpdateCheck-BEruHgs0.js → UpdateCheck-BLh3mrOW.js} +2 -2
- package/apps/web/dist/assets/brand-BIT7AumL.js +2 -0
- package/apps/web/dist/assets/changelog-BpRXMahN.js +1 -0
- package/apps/web/dist/assets/{code-editor-BLwDuQLI.js → code-editor-CufyaUFC.js} +2 -2
- package/apps/web/dist/assets/{host-B2ZzDrkc.js → host-DCRX0zfY.js} +41 -41
- package/apps/web/dist/assets/i18n-WXeVnv7i.js +55 -0
- package/apps/web/dist/assets/index-9KCPALMX.js +102 -0
- package/apps/web/dist/assets/index-D1iL3986.css +1 -0
- package/apps/web/dist/assets/{read-aloud-DGS8mWgC.js → read-aloud-CRFt5q6k.js} +1 -1
- package/apps/web/dist/assets/{session-EIDP3Wzc.js → session-RDdtfee2.js} +1 -1
- package/apps/web/dist/assets/{theme-B46aPLtX.js → theme-23bNrOQh.js} +2 -2
- package/apps/web/dist/assets/{ui-DSgksc1H.js → ui-DkEhb2Rt.js} +1 -1
- package/apps/web/dist/assets/{useMutation-fT44ij_b.js → useMutation-BSffqL6W.js} +1 -1
- package/apps/web/dist/assets/{viewers-DvA5VsXw.js → viewers-CmGDpBjn.js} +2 -2
- package/apps/web/dist/index.html +15 -15
- package/apps/web/dist/mcp/flow.html +25 -25
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/CapabilitiesPage-DAX03vkY.js +0 -2
- package/apps/web/dist/assets/EditorPage-CxABBMqo.js +0 -3
- package/apps/web/dist/assets/SettingsPage-Cytcl_9w.js +0 -2
- package/apps/web/dist/assets/SpacePage-Bd5-wBUc.js +0 -2
- package/apps/web/dist/assets/StudioHome-DzVpWMrD.js +0 -1
- package/apps/web/dist/assets/TableEditor-CRhc6jI6.js +0 -7
- package/apps/web/dist/assets/brand-DKuVyYhH.js +0 -2
- package/apps/web/dist/assets/changelog-BgFhbmMa.js +0 -1
- package/apps/web/dist/assets/i18n-Dyi0kvaA.js +0 -55
- package/apps/web/dist/assets/index-C1m_S1ls.js +0 -102
- package/apps/web/dist/assets/index-CduFlFCp.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{a as t,c as n,i as r,n as i,r as a,s as o,t as s}from"./esm-CpFD3UPd.js";import{n as c,t as l}from"./jsx-runtime-C3cWAN_r.js";import{xn as u}from"./ui-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{a as t,c as n,i as r,n as i,r as a,s as o,t as s}from"./esm-CpFD3UPd.js";import{n as c,t as l}from"./jsx-runtime-C3cWAN_r.js";import{xn as u}from"./ui-DkEhb2Rt.js";var d=e(c(),1),f=e(l(),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:u(`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)(a,{type:`target`,position:n.Top}),(0,f.jsx)(a,{type:`target`,id:`in`,position:n.Right}),(0,f.jsx)(`span`,{className:u(`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-[0.8125rem] text-ink`,children:e.title}),(0,f.jsx)(a,{type:`source`,position:n.Bottom}),(0,f.jsx)(a,{type:`source`,id:`out`,position:n.Right})]})}function y({sourceX:e,sourceY:t,targetX:n,targetY:r,label:a,markerEnd:o}){let c=Math.max(e,n)+g,l=[`M ${e} ${t}`,`H ${c-8}`,`Q ${c} ${t} ${c} ${t+8}`,`V ${r-8}`,`Q ${c} ${r} ${c-8} ${r}`,`H ${n}`].join(` `);return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(s,{path:l,markerEnd:o,style:{strokeDasharray:`5 4`}}),(0,f.jsx)(i,{children:(0,f.jsx)(`div`,{style:{width:_,transform:`translate(${c+8}px, ${(t+r)/2}px) translateY(-50%)`},className:`absolute text-[0.6875rem] text-ink-2 leading-snug`,children:a})})]})}var b={step:v},x={branch:y};function S(e){let t={markerEnd:{type:o.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:n,edges:i,width:a,height:o}=(0,d.useMemo)(()=>S(e),[e]);return e.length?(0,f.jsx)(`div`,{className:`max-w-full`,style:{width:a,height:o+4},children:(0,f.jsx)(r,{children:(0,f.jsx)(t,{nodes:n,edges:i,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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,at as n,c as r,et as i,j as a,r as o,s}from"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,at as n,c as r,et as i,j as a,r as o,s}from"./i18n-WXeVnv7i.js";import{n as c,t as l}from"./jsx-runtime-C3cWAN_r.js";import{t as u}from"./media-gjOIWMWK.js";import{g as d}from"./session-RDdtfee2.js";import{hn as f,xn as p}from"./ui-DkEhb2Rt.js";var m=e(c(),1),h=e(l(),1),g=`cubic-bezier(0.3, 0.7, 0.2, 1)`,_=`(max-width: 639px)`;function v({tone:e=`ground`,ink:t}){let n=r(),a=d(),s=o();return s?(0,h.jsx)(y,{langs:[`en`,s],value:n,onPick:e=>{i(e)&&a(e)},tone:e,ink:t}):null}function y({langs:e,value:t,onPick:r,tone:i=`ground`,ink:a,label:o}){let c=u(_),l=(0,m.useRef)({}),[d,f]=(0,m.useState)(null),v=e=>o?o(e):n(e),y=e.join(`|`);(0,m.useLayoutEffect)(()=>{let e=()=>{let e={};for(let[t,n]of Object.entries(l.current))e[t]=n?Math.ceil(n.getBoundingClientRect().width):0;f(e)};e(),document.fonts?.ready.then(e)},[y]);let b=e=>d?(d[e===t&&!c?`${e}-full`:`${e}-short`]??0)+24:void 0,x=d?e.slice(0,e.indexOf(t)).reduce((e,t)=>e+(b(t)??0),0):0,S=`300ms ${g}`,C=i===`ground`;return(0,h.jsxs)(`fieldset`,{className:p(`relative inline-flex items-center rounded-full border-0 p-0.5 ring-1`,C?`bg-white/10 ring-white/15`:`bg-paper-2 ring-border-soft`),children:[(0,h.jsx)(`legend`,{className:`sr-only`,children:s(`nav.language`)}),d?(0,h.jsx)(`span`,{"aria-hidden":`true`,className:p(`absolute top-0.5 bottom-0.5 left-0.5 rounded-full shadow-sm motion-reduce:transition-none`,C?`bg-white`:`bg-card`),style:{width:b(t),transform:`translateX(${x}px)`,transition:`transform ${S}, width ${S}`}}):null,e.map(e=>{let n=e===t;return(0,h.jsxs)(`button`,{"aria-pressed":n,className:p(`relative h-7 cursor-pointer overflow-hidden whitespace-nowrap rounded-full font-medium text-[0.75rem] motion-reduce:transition-none`,C?n?`text-[oklch(32%_0.15_262)]`:`text-white/70`:n?`text-ink`:`text-ink-3`),lang:e,onClick:()=>{n||r(e)},style:{width:b(e),transition:`width ${S}, color ${S}`,...C&&n&&a?{color:a}:{}},title:v(e),type:`button`,children:[[v(e),e.toUpperCase()].map((e,t)=>{let r=n&&!c?t===0:t===1;return(0,h.jsx)(`span`,{"aria-hidden":!r,className:`absolute inset-0 grid place-items-center motion-reduce:transition-none`,style:{opacity:+!!r,transition:`opacity 220ms ${g}`},children:e},`${t}:${e}`)}),(0,h.jsx)(`span`,{ref:t=>{l.current[`${e}-full`]=t},"aria-hidden":`true`,className:`invisible absolute`,children:v(e)}),(0,h.jsx)(`span`,{ref:t=>{l.current[`${e}-short`]=t},"aria-hidden":`true`,className:`invisible absolute`,children:e.toUpperCase()}),(0,h.jsx)(`span`,{className:`invisible px-3`,children:n?v(e):e.toUpperCase()})]},e)})]})}function b(){let e=r(),n=d();return(0,h.jsx)(f,{className:`w-44`,value:e,onChange:e=>{i(e)&&n(e)},options:t.map(e=>({value:e,label:a[e]}))})}export{y as n,v as r,b as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-
|
|
2
|
-
import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{Dt as n,J as r,V as i,b as a,bt as o,ft as s,n as c,nt as l,ot as u,pt as d,s as f,wt as p}from"./i18n-Dyi0kvaA.js";import{$ as m,Bn as h,Cn as g,Cr as _,Fr as v,Gr as ee,Ln as y,Mr as b,Pr as x,Sn as S,Sr as C,Tn as w,Z as te,an as T,br as E,cn as ne,er as D,ft as O,gn as k,ir as A,jn as re,ni as j,on as M,or as ie,rr as ae,sn as N,xn as P,zn as oe}from"./ui-DSgksc1H.js";import{t as se}from"./useMutation-fT44ij_b.js";import{d as F,n as I,s as L,u as ce}from"./marked.esm-BfGIZK7F.js";import{n as le,r as ue,t as de}from"./volume-2-Br71vpS5.js";import{t as fe}from"./eye-CG1LzvNI.js";import{n as R,t as pe}from"./list-checks-D1zkXlZa.js";import{t as me}from"./plug-CHvl1GhO.js";import{n as he,t as ge}from"./jsx-runtime-C3cWAN_r.js";import{n as _e,u as ve}from"./brand-DKuVyYhH.js";import{c as ye,s as be}from"./engenty-Cy7MbUxR.js";import{b as xe,h as Se,m as Ce,u as we,y as Te}from"./session-EIDP3Wzc.js";import{t as Ee}from"./preload-helper-Cj7BV335.js";var De=class extends b{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:x(t,n.data),hasPreviousPage:v(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function Oe(e,t){return _(e,De,t)}var ke={name:`app-window`,size:24,node:[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]};ke.node;var z=F(ke),Ae={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};Ae.node;var B=F(Ae),je={name:`circle-dollar-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};je.node;var Me=F(je),Ne={name:`circle-euro`,size:24,node:[[`path`,{d:`M15 9.4a4 4 0 1 0 0 5.2`,key:`1makmb`}],[`path`,{d:`M7 12h5`,key:`gblrwe`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Ne.node;var Pe=F(Ne),Fe={name:`clapperboard`,size:24,node:[[`path`,{d:`m12.296 3.464 3.02 3.956`,key:`qash78`}],[`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z`,key:`1h7j8b`}],[`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`4lm6w1`}],[`path`,{d:`m6.18 5.276 3.1 3.899`,key:`zjj9t3`}]]};Fe.node;var V=F(Fe),Ie={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Ie.node;var Le=F(Ie),Re={name:`coins`,size:24,node:[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]};Re.node;var ze=F(Re),Be={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Be.node;var H=F(Be),Ve={name:`git-fork`,size:24,node:[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]};Ve.node;var U=F(Ve),He={name:`hourglass`,size:24,node:[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]};He.node;var W=F(He),Ue={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};Ue.node;var We=F(Ue),Ge={name:`layout-template`,size:24,node:[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]};Ge.node;var Ke=F(Ge),qe={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};qe.node;var Je=F(qe),Ye={name:`scan-text`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}]]};Ye.node;var Xe=F(Ye),Ze={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};Ze.node;var G=F(Ze),Qe={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Qe.node;var $e=F(Qe),et={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};et.node;var tt=F(et),K=t(he(),1);function nt(){return C({queryKey:[`config`],queryFn:async()=>{let e=await m.get(`/api/config`);return O(e.publicUrl),e},staleTime:6e4})}function rt(){let e=Se(),t=nt();return e.data?.features??t.data?.features??Te()}function it(e){return xe(rt(),e)}var at=[`text`,`web`,`browser`,`documents`,`image`,`video`,`speech`,`listening`,`code`,`connectors`,`motion-graphics`],ot=new Set([`html`,`md`,`txt`,`csv`,`json`]),st=new Set([`code`]),ct=new Set([`web_search`,`browser`,`sandbox`,`image`]),lt=new Set([`web_fetch`,`http`]),ut=/\{\{\s*memory\b/;function dt(e){switch(e.type){case`agent`:return[e.instructions];case`tool`:return[...e.call?[JSON.stringify(e.call.input)]:[],...Object.values(e.data?.params??{}).map(e=>e.includes(`{{`)?e:`{{${r(e)}}}`)];case`code`:return[...Object.values(e.code.input),...Object.values(e.data?.params??{})].map(e=>e.includes(`{{`)?e:`{{${r(e)}}}`);case`decision`:return[e.instructions];case`generate`:return[e.prompt,e.options?.style??``];case`motion-graphics`:return[e.brief];case`widget`:case`surface`:return Object.values(e.data).map(e=>`{{${r(e)}}}`);case`form`:return Object.values(e.data??{}).map(e=>`{{${r(e)}}}`);default:return[]}}function ft(e,t){return e.steps.slice(t+1).some(e=>e.type===`agent`||e.type===`decision`||e.type===`generate`||e.type===`motion-graphics`)}function pt(e,t){let i=[],a=(t,n)=>{let r=i.find(e=>e.need===t);r?r.hard||=n:i.push({stepId:e.id,need:t,hard:n})},c=t.steps.indexOf(e);for(let t of dt(e))ut.test(t)&&a(`memory`,!0),o(t).some(e=>e.startsWith(`lists.`))&&a(`lists`,!0);switch(e.type){case`form`:(e.timeout||e.remind)&&a(`wait`,!0),Object.values(e.data??{}).some(e=>u(r(e)))&&a(`lists`,!0);for(let n of e.fields){switch(n.kind){case`audio`:a(`field:audio`,!!n.required);break;case`connection`:a(`field:connection`,!0);break;case`slot`:a(`field:slot`,!0);break;case`list`:a(`lists`,!0);break;case`location`:a(`field:location`,!1);break;case`image`:a(`field:image`,!1);break;case`file`:ft(t,c)?a(`field:file-read`,!0):a(`field:file`,!1)}n.optionsFrom&&u(r(n.optionsFrom).split(`.`).slice(0,2).join(`.`))&&a(`lists`,!0)}break;case`tool`:{let t=e.call&&`tool`in e.call?s(e.call.tool):null;t&&a(`plugin:${t.plugin}`,!0);break}case`agent`:for(let t of e.tools){let e=s(t);e?a(`plugin:${e.plugin}`,!0):n(t)?a(`wizard-code`,!0):lt.has(t)||st.has(t)||(ct.has(t)?a(`tool:${t}`,!0):a(`tool:${t}`,!1))}e.connections?.length&&a(`connections`,!0),e.foreach&&(u(r(e.foreach))?a(`lists`,!0):a(`each`,!1));break;case`generate`:e.asset!==`document`&&e.asset!==`dashboard`&&a(`asset:${e.asset}`,!0);break;case`motion-graphics`:a(`motion-graphics`,!0);break;case`widget`:a(e.video?`widget:video`:`widget`,!0);break;case`surface`:Object.values(e.data).some(e=>u(r(e)))&&a(`lists`,!0);break;case`wait`:a(`wait`,!0);break;case`review`:e.show.some(e=>u(e))&&a(`lists`,!0),(e.timeout||e.remind||e.approve)&&a(`wait`,!0);break;case`result`:for(let n of e.deliverables){if(u(n.from)){a(`lists`,!0);continue}let e=t.steps.find(e=>e.id===n.from);if(e?.type!==`agent`&&e?.type!==`decision`&&(e?.type!==`generate`||e.asset!==`document`&&e.asset!==`dashboard`))continue;let r=n.formats.some(e=>ot.has(e));for(let t of n.formats)ot.has(t)||(t!==`pdf`||e?.type!==`agent`&&e?.type!==`decision`)&&a(`format:${t}`,t!==`pdf`&&!r)}}return i}function mt(e){let t=e.steps.flatMap(t=>pt(t,e));e.lists?.length&&!t.some(e=>e.need===`lists`)&&t.push({stepId:e.steps[0]?.id??``,need:`lists`,hard:!0}),e.connections?.length&&!t.some(e=>e.need===`connections`)&&t.push({stepId:e.steps[0]?.id??``,need:`connections`,hard:!0});let n=_t(e);return{fit:t.some(e=>e.hard&&n.has(e.stepId))?`no`:t.length?`less`:`full`,notes:t}}function ht(e){switch(e){case`tool:web_search`:case`tool:web_fetch`:return`web`;case`tool:browser`:return`browser`;case`tool:sandbox`:case`wizard-code`:return`code`;case`tool:image`:case`asset:image`:return`image`;case`asset:video`:case`motion-graphics`:case`widget:video`:return`video`;case`asset:voice`:return`speech`;case`field:audio`:return`listening`;case`tool:http`:case`connections`:case`field:connection`:return`connectors`;case`field:image`:case`field:file`:case`field:file-read`:return`documents`;default:return null}}function gt(e){let t=mt(e),n=_t(e),r=new Set,i=new Set,a=new Set,o=new Set;for(let e of t.notes){if(e.need.startsWith(`plugin:`)){a.add(e.need.slice(7));continue}if(e.need.startsWith(`format:`)){o.add(e.need.slice(7));continue}let t=ht(e.need);t&&(e.hard&&n.has(e.stepId)?r.add(t):i.add(t))}for(let e of r)i.delete(e);return{...t,missing:[...r],optional:[...i],needs:[...a].sort(),without:[...o]}}function _t(e){return e.steps.length?vt(e,e.steps[0].id,{}):new Set}function vt(e,t,n){let r=new Map(e.steps.map((e,t)=>[e.id,t])),i=r.get(t)??0,a=t=>{let i=[];for(let a of e.steps[t].next??[]){if(l(a))continue;let t=a.goto===`end`?e.steps.length:r.get(a.goto)??-1;if(a.ask||!p(a.when).every(e=>e in n))t>=0&&i.push(t);else if(d(a,n))return t>=0?[...i,t]:i}return i.push(yt(e,t,r)),i},o=t=>{if(t===i)return!1;let n=new Set([i]),r=[i];for(;r.length;){let i=r.shift();if(i>=e.steps.length)return!0;for(let e of a(i))e!==t&&!n.has(e)&&(n.add(e),r.push(e))}return!1};return new Set(e.steps.filter((e,t)=>!o(t)).map(e=>e.id))}function yt(e,t,n){let r=e.steps[t].next?.find(l)?.goto;return r===void 0?t+1:r===`end`?e.steps.length:n.get(r)??t+1}new Set(i);var bt=[`text`,`document`,`table`,`image`,`video`,`audio`,`dashboard`],xt=[`any`,`trades`,`gastronomy`,`hospitality`,`realEstate`,`retail`,`health`,`professional`,`agency`,`events`,`publicSector`],St=[`marketing`,`sales`,`accounting`,`service`,`research`,`hr`,`operations`,`website`,`visuals`,`inquiries`,`advice`],Ct=[`free`,`pro`],wt={"format.text":`Text`,"format.document":`Document (PDF, Word)`,"format.table":`Table`,"format.image":`Image`,"format.video":`Video`,"format.audio":`Audio`,"format.dashboard":`Dashboard`,"industry.any":`Any industry`,"industry.trades":`Trades`,"industry.gastronomy":`Food service`,"industry.hospitality":`Hotels & tourism`,"industry.realEstate":`Real estate`,"industry.retail":`Retail`,"industry.health":`Health`,"industry.professional":`Professional services`,"industry.agency":`Agency & marketing`,"industry.events":`Events`,"industry.publicSector":`Associations & public sector`,"useCase.marketing":`Marketing & social media`,"useCase.sales":`Offers & sales`,"useCase.accounting":`Accounting & receipts`,"useCase.service":`Customer service`,"useCase.research":`Research & analysis`,"useCase.hr":`HR & applications`,"useCase.operations":`Planning & operations`,"useCase.website":`Website helpers`,"useCase.visuals":`Images & video`,"useCase.inquiries":`Inquiries & bookings`,"useCase.advice":`Advice & pricing`,"capability.text":`Writes text`,"capability.web":`Web search`,"capability.browser":`Drives a browser`,"capability.documents":`Reads documents & photos`,"capability.image":`Makes images`,"capability.video":`Makes video`,"capability.speech":`Speech output`,"capability.listening":`Understands voice notes`,"capability.code":`Runs code`,"capability.connectors":`Connected accounts & systems`,"capability.motion-graphics":`Motion graphics with Claude Code (on your subscription)`,"cost.low":`low cost`,"cost.medium":`medium cost`,"cost.high":`high cost`,"plan.free":`Free`,"plan.pro":`Pro`,"outline.otherwise":`otherwise`,"outline.and":`{first} and {second}`,"outline.or":`{first} or {second}`,"outline.not":`not {condition}`,"outline.with":`with {name}`,"outline.without":`without {name}`,"outline.contains":`{name} contains {value}`},Tt={en:wt,de:{"format.text":`Text`,"format.document":`Dokument (PDF, Word)`,"format.table":`Tabelle`,"format.image":`Bild`,"format.video":`Video`,"format.audio":`Audio`,"format.dashboard":`Dashboard`,"industry.any":`Jede Branche`,"industry.trades":`Handwerk`,"industry.gastronomy":`Gastronomie`,"industry.hospitality":`Hotel & Tourismus`,"industry.realEstate":`Immobilien`,"industry.retail":`Handel`,"industry.health":`Gesundheit`,"industry.professional":`Kanzlei & Beratung`,"industry.agency":`Agentur & Marketing`,"industry.events":`Veranstaltungen`,"industry.publicSector":`Vereine & Öffentliches`,"useCase.marketing":`Marketing & Social Media`,"useCase.sales":`Angebote & Verkauf`,"useCase.accounting":`Buchhaltung & Belege`,"useCase.service":`Kundenservice`,"useCase.research":`Recherche & Analyse`,"useCase.hr":`Personal & Bewerbungen`,"useCase.operations":`Planung & Abläufe`,"useCase.website":`Helfer für die Website`,"useCase.visuals":`Bilder & Video`,"useCase.inquiries":`Anfragen & Termine`,"useCase.advice":`Beratung & Preise`,"capability.text":`Text schreiben`,"capability.web":`Websuche`,"capability.browser":`Browser bedienen`,"capability.documents":`Dokumente & Fotos lesen`,"capability.image":`Bilder erzeugen`,"capability.video":`Videos erzeugen`,"capability.speech":`Sprachausgabe`,"capability.listening":`Sprachnotizen verstehen`,"capability.code":`Code ausführen`,"capability.connectors":`Verbundene Konten & Systeme`,"capability.motion-graphics":`Motion-Grafik mit Claude Code (auf deinem Abo)`,"cost.low":`günstig`,"cost.medium":`mittel`,"cost.high":`teuer`,"plan.free":`Kostenlos`,"plan.pro":`Pro`,"outline.otherwise":`sonst`,"outline.and":`{first} und {second}`,"outline.or":`{first} oder {second}`,"outline.not":`nicht {condition}`,"outline.with":`mit {name}`,"outline.without":`ohne {name}`,"outline.contains":`{name} enthält {value}`}};function Et(e,t,n,r){let i=`${e}.${t}`;return i in wt?a(Tt,i,n,r):t}function Dt(e,t){return e?`connection`in e?`${e.connection} · ${e.action}`:e.tool:t?t.sql.replace(/\s+/g,` `).slice(0,90):``}function Ot(e){switch(e.type){case`form`:return pe;case`agent`:return ue;case`tool`:return me;case`code`:return A;case`decision`:return U;case`generate`:return e.asset===`image`?R:e.asset===`video`?g:e.asset===`dashboard`?We:L;case`widget`:return z;case`surface`:return Ke;case`motion-graphics`:return V;case`review`:return fe;case`wait`:return W;case`result`:return H}return S}var kt={form:`bg-cobalt-tint text-cobalt`,agent:`bg-ember-tint text-ember-strong`,decision:`bg-ember-tint text-ember-strong`,tool:`bg-ember-tint text-ember-strong`,code:`bg-ember-tint text-ember-strong`,generate:`bg-amber-tint text-ink-2`,widget:`bg-ember-veil text-ember-strong`,surface:`bg-ember-veil text-ember-strong`,"motion-graphics":`bg-amber-tint text-ink-2`,review:`bg-moss-tint text-moss`,wait:`bg-cobalt-tint text-cobalt`,result:`bg-paper-2 text-ink-2`},At={m:`wait.minutes`,h:`wait.hours`,d:`wait.days`};function jt(e){let t=/^(\d+)([mhd])$/.exec(e??``);return t?t[0]===`1d`?f(`wait.day`):f(At[t[2]],{n:t[1]}):null}function Mt(e){if(e.signal){let{key:t,name:n,timeout:r}=e.signal,i=n===`message.received`?f(`inspector.waitFromPerson`):n===`mail.received`?t.startsWith(`thread:`)?f(`wait.mailThread`):f(`wait.mail`,{key:t}):f(`wait.signal`,{key:t});return r?f(`wait.signalTimeout`,{waits:i,time:jt(r)??r}):i}let t=jt(e.for);if(t)return t;let n=Date.parse(e.until??``),r=Number.isNaN(n)?e.until??``:new Intl.DateTimeFormat(c,{dateStyle:`medium`,timeStyle:`short`}).format(n);return f(`wait.until`,{date:r})}function Nt(e){return f(`type.${e.type}`)}var Pt=[`web_search`,`web_fetch`,`browser`,`sandbox`,`image`,`http`,`pages`,`code`];function Ft(e){return Pt.includes(e)?f(`tool.${e}`):e}function It(e){switch(e.type){case`form`:return e.fields.map(e=>e.label).join(` · `);case`agent`:return e.tools.map(Ft).join(` · `)||e.instructions.slice(0,90);case`tool`:return Dt(e.call,e.data);case`code`:return e.code.entry;case`decision`:return e.output.fields.map(e=>e.description??e.id).join(` · `);case`generate`:{let t=[e.asset];return e.options?.aspectRatio&&t.push(e.options.aspectRatio),e.options?.duration&&t.push(`${e.options.duration}s`),e.options?.resolution&&t.push(e.options.resolution),e.options?.template&&t.push(e.options.template),t.join(` · `)}case`widget`:return[e.entry,Object.keys(e.data).join(`, `)].filter(Boolean).join(` · `);case`surface`:return e.candidates?e.candidates.map(e=>e.id).join(` · `):Object.keys(e.data).join(`, `);case`motion-graphics`:return[e.format,e.seconds?`${e.seconds}s`:null,e.skills.join(`, `)].filter(Boolean).join(` · `);case`review`:return[e.edit?f(`editor.reviewEditable`):null,e.regenerate?f(`editor.reviewRedo`):null].filter(Boolean).join(` · `);case`wait`:return Mt(e);case`result`:return e.deliverables.map(e=>`${e.label??e.from} (${e.formats.join(`, `)})`).join(` · `)}return``}var Lt=e({MarketplaceCards:()=>pn}),q=t(ge(),1),Rt=(0,K.lazy)(()=>Ee(()=>import(`./FlowPreview-aj58c-gH.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),zt={useCase:``,industry:``,format:``,capability:``,plan:``,version:``},J=(e,t)=>Et(e,t,c),Bt={en:Me,de:Pe};function Vt(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function Ht(e){return e.credits?f(`market.credits`,{n:Vt(e.credits.credits)}):J(`cost`,e.costTier)}var Ut={text:tt,document:L,table:w,image:R,video:g,audio:ie,dashboard:B};function Y({format:e,className:t}){let n=Ut[e],r=J(`format`,e);return(0,q.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,q.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var Wt=[`low`,`medium`,`high`];function Gt({entry:e}){let t=Wt.indexOf(e.costTier)+1,n=Bt[c];return(0,q.jsxs)(`span`,{title:Ht(e),className:`inline-flex items-center gap-1`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:Wt.slice(0,t).map((e,t)=>(0,q.jsx)(`span`,{className:P(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,q.jsx)(n,{className:`size-4`})},e))}),J(`cost`,e.costTier)]})}function Kt(){return(0,q.jsx)(N,{tone:`ember`,title:f(`market.proHint`),children:f(`market.pro`)})}function qt({plugin:e}){return(0,q.jsx)(N,{icon:(0,q.jsx)(Je,{className:`size-3.5`}),title:f(`market.fromPlugin`,{name:e.name}),children:e.name})}function X({entry:e,onOpen:t,why:n}){let r=e.usable&&e.missing.length>0&&!e.needs?.length;return(0,q.jsxs)(M,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:P(`relative flex min-h-[124px] cursor-pointer flex-col gap-5 p-4 text-left transition sm:min-h-[136px] sm:p-5 hover:shadow-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,(!e.usable||!!e.needs?.length)&&`opacity-60`),children:[(0,q.jsx)(`span`,{className:P(`-top-4 pointer-events-none absolute right-4`,r&&`opacity-60`),children:(0,q.jsx)(_e,{kind:e.avatar,costume:e.costume,size:68})}),(0,q.jsxs)(`div`,{className:P(`min-w-0 pr-20`,r&&`opacity-60`),children:[(0,q.jsxs)(`div`,{className:`font-display font-semibold text-[0.9375rem]`,children:[e.title,e.plan===`pro`?(0,q.jsx)(`span`,{className:`ml-1.5 inline-flex align-middle`,children:(0,q.jsx)(Kt,{})}):null,e.starred?(0,q.jsx)(G,{className:`ml-1.5 inline size-3.5 fill-amber align-[-2px] text-amber`,"aria-label":f(`market.starred`)}):null]}),e.featured?(0,q.jsx)(`div`,{className:`mt-1`,children:(0,q.jsx)(N,{tone:`ember`,children:f(`market.recommended`)})}):null,(0,q.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3 leading-snug`,children:e.pitch})]}),(0,q.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[0.75rem] text-ink-3`,children:[n?(0,q.jsx)(N,{children:n}):null,e.plugin?(0,q.jsx)(qt,{plugin:e.plugin}):null,e.needs?.length?(0,q.jsx)(N,{tone:`warn`,children:f(`market.needsPro`,{list:e.needs.join(`, `)})}):e.usable&&e.missing.length?(0,q.jsx)(Zt,{missing:e.missing}):e.usable?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,q.jsx)(D,{className:`size-3.5`}),` `,f(`market.minutes`,{n:e.effort.minutes})]}),(0,q.jsx)(Gt,{entry:e}),e.optional?.length?(0,q.jsx)(N,{title:f(`market.optionalHint`,{list:Q(e.optional)}),children:f(`market.without`,{list:Q(e.optional)})}):null,(0,q.jsx)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:e.formats.map(e=>(0,q.jsx)(Y,{format:e,className:`size-4`},e))})]}):(0,q.jsx)(N,{tone:`warn`,children:f(`market.needsUpdate`)})]})]})}function Z({title:e,children:t}){return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var Q=e=>e.map(e=>J(`capability`,e)).join(`, `),Jt={text:`text`,documents:`text`,image:`image`,video:`video`,speech:`speech`,listening:`listening`,"motion-graphics":`claude`};function Yt(e,t){let n=Q(e),r=e.includes(`motion-graphics`),i=e.filter(e=>e!==`motion-graphics`);if(r&&t&&!i.length)return{path:null,action:`market.setUpModels`,hint:f(`market.motionCloud`)};let a=r&&!t?`motion-graphics`:i[0],o=a?Jt[a]:void 0;return{path:o?`/settings/models?show=${o}`:`/settings/models`,action:a===`motion-graphics`?`market.setUpClaude`:`market.setUpModels`,hint:a===`motion-graphics`?f(`market.motionHint`):f(`market.missingHint`,{list:n})}}function Xt(e){return Yt(e,Se().data?.mode===`managed`)}function Zt({missing:e}){let t=E(),n=Xt(e);return(0,q.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,q.jsx)(`span`,{title:n.hint,className:`min-w-0 rounded-xl bg-amber-tint px-2.5 py-1 font-medium text-[0.75rem] text-ink-2 leading-snug [overflow-wrap:anywhere]`,children:n.path?f(`market.missing`,{list:Q(e)}):f(`market.motionCloudShort`)}),n.path?(0,q.jsx)(T,{size:`sm`,variant:`secondary`,onClick:e=>{e.stopPropagation(),t(n.path)},onKeyDown:e=>e.stopPropagation(),children:f(n.action)}):null]})}var Qt={text:y,web:le,browser:oe,documents:Xe,image:R,video:g,speech:de,listening:h,code:$e,connectors:me,"motion-graphics":V};function $t(e){switch(e.type){case`form`:return pe;case`agent`:return ue;case`decision`:return U;case`generate`:return e.asset===`image`?R:e.asset===`video`?g:e.asset===`voice`?de:e.asset===`dashboard`?B:L;case`widget`:return e.video?V:z;case`surface`:return z;case`motion-graphics`:return V;case`review`:return fe;case`wait`:return W;case`result`:return H}return S}function en(e){let t=new Set;for(let[n,r]of e.entries())for(let i of r.branches??[]){let r=i.to===`end`?e.length:e.findIndex(e=>e.id===i.to);for(let i=n+1;i<r;i++)t.add(e[i].id)}return t}function tn(e){let t=en(e);return e.map(e=>({id:e.id,title:e.title,icon:$t(e),tone:kt[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function nn({title:e,children:t}){return(0,q.jsx)(`span`,{title:e,className:`inline-flex items-center gap-2 border-border border-l px-4 first:border-l-0 first:pl-0`,children:t})}function rn({icon:e,children:t,more:n}){return(0,q.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`div`,{className:`text-[0.875rem] text-ink leading-snug`,children:t}),n?(0,q.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:n}):null]})]})}function an({className:e,children:t}){let n=(0,K.useRef)(null),[r,i]=(0,K.useState)({above:!1,below:!1});(0,K.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=e.scrollTop>1,n=e.scrollTop+e.clientHeight<e.scrollHeight-1;i(e=>e.above===t&&e.below===n?e:{above:t,below:n})};t(),e.addEventListener(`scroll`,t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),()=>{e.removeEventListener(`scroll`,t),r.disconnect()}},[]);let a=`linear-gradient(to bottom, ${r.above?`transparent`:`black`} 0, black 28px, black calc(100% - 44px), ${r.below?`transparent`:`black`} 100%)`;return(0,q.jsx)(`div`,{ref:n,className:e,style:{maskImage:a,WebkitMaskImage:a},children:(0,q.jsx)(`div`,{children:t})})}var on=2e4;function $({id:e,fallback:t,onClose:n,onUse:r,busy:i}){let a=j(),o=E(),s=C({queryKey:[`marketplace-entry`,e,c],queryFn:({signal:t})=>m.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${c}`,AbortSignal.any([t,AbortSignal.timeout(on)])),enabled:!!e,retry:!1}),l=s.data??t,u=Xt(l?.missing??[]),d=se({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?m.put(n):m.del(n)},onSuccess:()=>Promise.all([a.invalidateQueries({queryKey:[`marketplace`]}),a.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),p=ve()===`dark`,h=be[ye[l?.avatar||`round`]],g=p?`var(--card)`:`color-mix(in oklch, ${h??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,q.jsx)(ne,{open:!!e,onClose:n,wide:!0,bare:!0,children:l?(0,q.jsxs)(`div`,{className:`relative flex max-h-[calc(100dvh-48px)] flex-col rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:max-h-none max-sm:rounded-none`,children:[(0,q.jsx)(`button`,{type:`button`,"aria-label":f(`common.close`),onClick:n,className:`sm:-top-3.5 sm:-right-3.5 absolute top-3 right-3 z-20 flex size-9 items-center justify-center rounded-full bg-card text-ink-2 shadow-elevated ring-1 ring-border-soft transition hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,children:(0,q.jsx)(I,{className:`size-4`})}),(0,q.jsxs)(`header`,{className:`relative shrink-0 border-border-soft border-b px-5 pt-5 pb-4 text-ink sm:rounded-t-2xl sm:px-7`,style:{background:g,"--coin-bg":g},children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 overflow-hidden sm:rounded-t-2xl`,children:(0,q.jsx)(`span`,{className:P(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,p?`opacity-[0.14]`:`opacity-80`)})}),(0,q.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,q.jsx)(_e,{kind:l.avatar,costume:l.costume,size:104})}),(0,q.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,q.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight max-sm:pr-10`,children:l.title}),(0,q.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-2 leading-snug`,children:s.data?.description||l.pitch})]}),l.usable?(0,q.jsxs)(`div`,{className:`-mx-5 sm:-mx-7 relative mt-3.5 flex flex-wrap items-center gap-y-2 border-border-soft border-t px-5 pt-3 font-medium text-[0.875rem] sm:px-7 sm:pr-40`,children:[(0,q.jsxs)(nn,{title:f(`market.duration`),children:[(0,q.jsx)(D,{className:`size-4 text-ink-3`}),f(`market.minutes`,{n:l.effort.minutes})]}),(0,q.jsx)(nn,{title:f(`market.cost`),children:(0,q.jsx)(Gt,{entry:l})}),(0,q.jsx)(nn,{title:f(`market.result`),children:l.formats.map(e=>(0,q.jsx)(Y,{format:e,className:`size-4`},e))})]}):null]}),l.usable?(0,q.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-7 gap-y-6 px-5 pt-6 max-sm:overflow-y-auto max-sm:pb-4 sm:grid-cols-[230px_minmax(0,1fr)] sm:grid-rows-[minmax(0,1fr)] sm:px-7`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-5 sm:min-h-0 sm:overflow-y-auto`,children:[(0,q.jsx)(Z,{title:f(`market.duration`),children:(0,q.jsx)(rn,{icon:(0,q.jsx)(D,{className:`size-4 text-moss`}),more:f(`market.durationHint`,{n:l.effort.fields}),children:f(`market.minutes`,{n:l.effort.minutes})})}),(0,q.jsx)(Z,{title:f(`market.cost`),children:(0,q.jsx)(rn,{icon:(0,q.jsx)(ze,{className:`size-4 text-amber`}),more:l.credits?f(`market.creditsHint`):void 0,children:(0,q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,q.jsx)(Gt,{entry:l}),l.credits?(0,q.jsx)(`span`,{className:`text-ink-2`,children:f(`market.creditsRange`,{n:Vt(l.credits.credits)})}):null]})})}),(0,q.jsx)(Z,{title:f(`market.result`),children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[s.isLoading?(0,q.jsx)(k,{className:`size-4 text-ink-3`}):null,(s.data?.results??[]).map(e=>(0,q.jsx)(rn,{icon:(0,q.jsx)(Y,{format:e.kind,className:`size-4 text-ember-strong`}),more:e.formats.map(e=>e.toUpperCase()).join(` · `),children:e.title},e.title))]})}),(0,q.jsxs)(Z,{title:f(`market.needs`),children:[(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.capabilities.map(e=>{let t=Qt[e],n=l.missing.includes(e),r=l.optional?.includes(e);return(0,q.jsxs)(`li`,{className:P(`flex items-center gap-2.5 text-[0.875rem]`,n?`text-ink-3`:`text-ink-2`),children:[(0,q.jsx)(t,{className:P(`size-4 shrink-0`,n?`text-rose`:r?`text-amber`:`text-cobalt`)}),J(`capability`,e),n?(0,q.jsx)(`span`,{className:`text-[0.75rem] text-rose`,children:f(`market.unavailable`)}):r?(0,q.jsx)(`span`,{className:`text-[0.75rem] text-amber`,children:f(`market.optional`)}):null]},e)})}),l.missing.length?(0,q.jsx)(`p`,{className:`mt-2.5 text-[0.8125rem] text-ink-3 leading-snug`,children:u.hint}):null]})]}),(0,q.jsxs)(`div`,{className:`flex flex-col sm:min-h-0`,children:[(0,q.jsx)(`div`,{className:`mb-1.5 shrink-0 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:f(`market.steps`)}),(0,q.jsx)(an,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:s.isLoading?(0,q.jsx)(k,{className:`size-5 text-ink-3`}):s.isError?(0,q.jsxs)(`div`,{className:`flex flex-col items-start gap-2 text-[0.875rem] text-ink-2`,children:[(0,q.jsx)(`p`,{children:f(`market.detailFailed`)}),(0,q.jsx)(T,{variant:`secondary`,size:`sm`,busy:s.isFetching,onClick:()=>void s.refetch(),children:f(`market.retry`)})]}):(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(k,{className:`size-5 text-ink-3`}),children:(0,q.jsx)(Rt,{steps:tn(s.data?.outline??[])})})})]})]}):(0,q.jsx)(`div`,{className:`flex-1 px-5 pt-6 sm:px-7`,children:(0,q.jsx)(`p`,{className:`rounded-lg bg-amber-tint p-3 text-[0.875rem] text-ink-2`,children:f(`market.needsUpdateHint`)})}),(0,q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 px-5 pt-4 pb-5 max-sm:border-border-soft max-sm:border-t sm:px-7 sm:pb-6`,children:[l.plugin?(0,q.jsx)(`span`,{className:`mr-auto flex items-center`,children:(0,q.jsx)(qt,{plugin:l.plugin})}):(0,q.jsxs)(T,{variant:`ghost`,className:`mr-auto`,title:f(`market.starHint`),"aria-pressed":l.starred,busy:d.isPending,onClick:()=>d.mutate(!l.starred),children:[(0,q.jsx)(G,{className:P(`size-4`,l.starred&&`fill-amber text-amber`)}),(0,q.jsx)(`span`,{className:`max-sm:sr-only`,children:f(l.starred?`market.starred`:`market.star`)})]}),(0,q.jsx)(T,{variant:`secondary`,onClick:n,children:f(`common.close`)}),l.usable&&l.missing.length&&u.path?(0,q.jsx)(T,{variant:`secondary`,onClick:()=>o(u.path),children:f(u.action)}):null,r?(0,q.jsx)(T,{disabled:!l.usable||l.missing.length>0||!!l.needs?.length,title:l.needs?.length?f(`market.needsProHint`,{list:l.needs.join(`, `)}):l.missing.length?u.hint:l.optional?.length?f(`market.optionalHint`,{list:Q(l.optional)}):void 0,busy:i,onClick:()=>r(l),children:f(`market.use`)}):null]})]}):(0,q.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[0.875rem] text-ink-2 shadow-overlay`,children:s.isLoading?(0,q.jsx)(k,{className:`size-6 text-ink-3`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{children:f(`market.notFound`)}),(0,q.jsx)(T,{variant:`secondary`,onClick:n,children:f(`common.close`)})]})})})}function sn({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,K.useState)(!1),o=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=n.find(e=>e.value===t);return(0,q.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,q.jsxs)(`div`,{className:P(`flex h-8 items-center rounded-full text-[0.8125rem] transition`,s?`bg-ember-tint text-ink`:`text-ink-2 hover:bg-paper-2 hover:text-ink`,i&&!s&&`bg-paper-2 text-ink`),children:[(0,q.jsx)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":i,onClick:()=>a(!i),className:P(`flex h-full items-center gap-1.5 rounded-full pl-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,s?`pr-1`:`pr-2.5`),children:s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,q.jsx)(`span`,{className:`font-medium`,children:s.label})]}):(0,q.jsxs)(q.Fragment,{children:[e,(0,q.jsx)(ae,{className:P(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,q.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${f(`market.reset`)}`,onClick:()=>r(``),className:`mr-1 flex size-6 items-center justify-center rounded-full text-ink-3 hover:bg-card hover:text-ink`,children:(0,q.jsx)(I,{className:`size-3.5`})}):null]}),i?(0,q.jsx)(`div`,{role:`listbox`,"aria-label":e,className:`absolute top-full left-0 z-30 mt-1.5 max-h-80 min-w-60 overflow-y-auto rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:n.map(e=>(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:!e.count||e.unavailable,onClick:()=>{r(e.value===t?``:e.value),a(!1)},className:P(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] transition coarse:py-2.5`,e.count&&!e.unavailable?`text-ink-2 hover:bg-paper-2 hover:text-ink`:`text-ink-4`,e.value===t&&`font-medium text-ink`),children:[e.icon,(0,q.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:e.label}),e.value===t?(0,q.jsx)(ce,{className:`size-4 text-ember`}):e.unavailable?(0,q.jsx)(`span`,{className:`whitespace-nowrap text-[0.75rem] text-ink-4`,children:f(`market.unavailable`)}):(0,q.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function cn(e,t){let[n,r]=(0,K.useState)(e);return(0,K.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var ln=60;function un({query:e,onUse:t,busy:n,limit:r=6}){let[i,a]=(0,K.useState)(null),o=cn(e.trim(),250),s=C({queryKey:[`marketplace`,c,o,`hits`,r],queryFn:()=>m.get(`/api/studio/marketplace?${new URLSearchParams({lang:c,limit:String(r),offset:`0`,q:o})}`),enabled:!!o,placeholderData:ee}),l=o?s.data?.entries??[]:[];return l.length?(0,q.jsxs)(`section`,{className:`mt-10`,children:[(0,q.jsxs)(`h2`,{className:`mb-5 flex items-center gap-2 font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:[f(`market.hits`),s.isFetching?(0,q.jsx)(k,{className:`size-3.5`}):null]}),(0,q.jsx)(`div`,{className:`flex flex-col gap-4 sm:grid sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>(0,q.jsx)(X,{entry:e,onOpen:()=>a(e.id)},e.id))}),(0,q.jsx)($,{id:i,fallback:l.find(e=>e.id===i)??null,onClose:()=>a(null),onUse:t,busy:n})]}):null}function dn(){let e=C({queryKey:[`marketplace`,c,`fit`],queryFn:()=>m.get(`/api/studio/marketplace?${new URLSearchParams({lang:c,limit:`12`,offset:`0`,fit:`1`})}`)});return e.data?.context&&e.data.entries.some(e=>e.fit)?e.data:null}function fn({page:e,organization:t,onUse:n,busy:r,onAll:i}){let[a,o]=(0,K.useState)(null),s=e.context??{sector:null,sectorName:null},c=e.entries,l=e=>e.fit===`sector`||e.fit===`industry`?s.sectorName:e.fit===`wish`?f(`market.fitWish`):null;return(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h2`,{className:`mt-16 text-center font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:f(`market.fitTitle`,{organization:t})}),(0,q.jsx)(`p`,{className:`mt-2 mb-5 text-center text-[0.875rem] text-ink-3`,children:s.sectorName?f(`market.fitLine`,{sector:s.sectorName}):f(`market.fitLinePlain`)}),(0,q.jsx)(`div`,{className:`flex flex-col gap-4 sm:grid sm:grid-cols-2 lg:grid-cols-3`,children:c.map((e,t)=>(0,q.jsx)(`div`,{className:P(`contents`,t>=4&&`max-sm:hidden`,t>=8&&`sm:max-lg:hidden`),children:(0,q.jsx)(X,{entry:e,why:l(e),onOpen:()=>o(e.id)})},e.id))}),(0,q.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,q.jsx)(T,{variant:`secondary`,onClick:i,children:f(`market.fitAll`,{n:e.all||e.total})})}),(0,q.jsx)($,{id:a,fallback:c.find(e=>e.id===a)??null,onClose:()=>o(null),onUse:n,busy:r})]})}function pn({entries:e}){let t=j(),n=E(),{space:r}=we(),i=Ce()&&!!r&&!r?.readOnly,[a,o]=(0,K.useState)(null),s=se({mutationFn:e=>m.post(`/api/studio/wizards`,{spaceId:r.id,starterId:e,lang:c}),onSuccess:async({id:e})=>{await t.invalidateQueries({queryKey:te.spaces()}),await t.invalidateQueries({queryKey:[`wizards`]}),o(null),n(`/edit/${e}`)}});return(0,q.jsxs)(`div`,{className:`@container mt-3`,children:[(0,q.jsx)(`div`,{className:`flex flex-col gap-4 @xl:grid @xl:grid-cols-2`,children:e.map(e=>(0,q.jsx)(X,{entry:e,onOpen:()=>o(e.id)},e.id))}),s.error?(0,q.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:s.error.message}):null,(0,q.jsx)($,{id:a,fallback:e.find(e=>e.id===a)??null,onClose:()=>o(null),onUse:i?e=>!s.isPending&&s.mutate(e.id):void 0,busy:s.isPending})]})}function mn({onUse:e,busy:t,open:n,search:r,onGuestOpen:i}){let[a,o]=(0,K.useState)(``);(0,K.useEffect)(()=>{r&&o(r.text)},[r]);let[s,l]=(0,K.useState)(zt),u=it(`kernel`),[d,p]=(0,K.useState)(!1),[h,g]=(0,K.useState)(n??null),_=cn(a.trim(),250),v=(0,K.useRef)(null);(0,K.useEffect)(()=>{let e=v.current;_&&e&&window.matchMedia(`(max-width: 639px)`).matches&&e.scrollIntoView({behavior:`smooth`,block:`start`})},[_]);let y=Oe({queryKey:[`marketplace`,c,_,s,d],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:c,limit:String(ln),offset:String(e)});_&&t.set(`q`,_);for(let[e,n]of Object.entries(s))n&&t.set(e,n);return d&&t.set(`starred`,`1`),m.get(`/api/${i?`guest`:`studio`}/marketplace?${t}`)},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.entries.length,0);return n<e.total?n:void 0},placeholderData:ee}),b=y.data?.pages[0],x=y.data?.pages.flatMap(e=>e.entries)??[],S=b?.all??0,C=a.trim()!==_||y.isFetching&&!y.isFetchingNextPage,w=(e,t,n,r)=>n.filter(t=>b?.facets[e]?.[t]!==void 0).map(n=>({value:n,label:J(t,n),icon:r?.(n),count:(b?.facets[e])[n]??0,unavailable:e===`capability`&&te.has(n)})),te=new Set(b?.unavailable??[]),E=w(`useCase`,`useCase`,St),ne=[{key:`industry`,name:f(`market.industry`),options:w(`industry`,`industry`,xt)},{key:`format`,name:f(`market.format`),options:w(`format`,`format`,bt,e=>(0,q.jsx)(Y,{format:e,className:`size-4 text-ink-3`}))},{key:`plan`,name:f(`market.plan`),options:w(`plan`,`plan`,Ct)},{key:`capability`,name:f(`market.capability`),options:w(`capability`,`capability`,at,e=>{let t=Qt[e];return(0,q.jsx)(t,{className:`size-4 text-ink-3`})})},...u&&Object.keys(b?.facets.version??{}).length?[{key:`version`,name:f(`market.version`),options:Object.entries(b?.facets.version??{}).sort(([e],[t])=>t.localeCompare(e,void 0,{numeric:!0})).map(([e,t])=>({value:e,label:e,count:t??0}))}]:[]],D=!!a.trim()||d||Object.values(s).some(Boolean),O=()=>{l(zt),o(``),p(!1)};if(y.isLoading)return(0,q.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,q.jsx)(k,{className:`size-6 text-ink-3`})});let A=b?.offline?(0,q.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,q.jsx)(Le,{className:`size-4 shrink-0`}),f(`market.offline`)]}):null;if(!S&&!D)return A;let j=a?(0,q.jsx)(`button`,{type:`button`,"aria-label":f(`market.reset`),onClick:()=>o(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,q.jsx)(I,{className:`size-4`})}):null,M=e=>P(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.78125rem] transition`,e?`bg-card font-medium text-ink shadow-soft ring-1 ring-border-soft`:`text-ink-3 hover:bg-card/60 hover:text-ink`);return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`label`,{ref:v,className:`relative mx-auto flex h-10 max-w-md scroll-mt-4 items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[C?(0,q.jsx)(k,{className:`size-4 shrink-0 text-ink-3`}):(0,q.jsx)(re,{className:`size-4 shrink-0 text-ink-3`}),(0,q.jsx)(`input`,{type:`search`,value:a,onChange:e=>o(e.target.value),placeholder:f(`market.search`),"aria-label":f(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),j]}),A,(0,q.jsxs)(`div`,{className:`max-sm:-mx-3 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-3 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:f(`market.all`)},...E].map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":!d&&s.useCase===e.value,onClick:()=>{p(!1),l({...s,useCase:e.value})},className:M(!d&&s.useCase===e.value),children:e.label},e.value)),i?null:(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>p(!d),className:M(d),children:[(0,q.jsx)(G,{className:P(`size-3.5`,d&&`fill-amber text-amber`)}),f(`market.starred`)]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[d?null:ne.map(e=>(0,q.jsx)(sn,{name:e.name,value:s[e.key],options:e.options,onChange:t=>l({...s,[e.key]:t})},e.key)),(0,q.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[0.8125rem] text-ink-3`,children:[D?(0,q.jsxs)(`button`,{type:`button`,onClick:O,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,q.jsx)(I,{className:`size-3.5 max-sm:size-4`}),(0,q.jsx)(`span`,{className:`max-sm:sr-only`,children:f(`market.resetShort`)})]}):null,D?(0,q.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:f(`market.countOfShort`,{n:b?.total??0,all:S})}):null,(0,q.jsx)(`span`,{className:P(`tabular-nums`,D&&`max-sm:hidden`),children:D?f(`market.countOf`,{n:b?.total??0,all:S}):f(`market.count`,{n:S})})]})]}),x.length?(0,q.jsx)(`div`,{className:`mt-4 flex flex-col gap-4 sm:grid sm:grid-cols-2 lg:grid-cols-3`,children:x.map(e=>(0,q.jsx)(X,{entry:e,onOpen:()=>i?i(e):g(e.id)},e.id))}):(0,q.jsxs)(`div`,{className:`py-10 text-center text-[0.875rem] text-ink-3`,children:[(0,q.jsx)(`p`,{children:f(d?`market.noneStarred`:`market.none`)}),(0,q.jsx)(T,{variant:`ghost`,className:`mt-2`,onClick:O,children:f(`market.reset`)})]}),y.hasNextPage?(0,q.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,q.jsx)(T,{variant:`secondary`,busy:y.isFetchingNextPage,onClick:()=>void y.fetchNextPage(),children:f(`market.more`)})}):null,(0,q.jsx)($,{id:h,fallback:x.find(e=>e.id===h)??null,onClose:()=>g(null),onUse:e,busy:t})]})}export{Le as A,Je as C,U as D,W as E,B as M,z as N,H as O,Oe as P,G as S,We as T,gt as _,Lt as a,rt as b,cn as c,It as d,Ft as f,ht as g,Et as h,un as i,V as j,ze as k,kt as l,Mt as m,mn as n,Kt as o,Nt as p,fn as r,dn as s,$ as t,Ot as u,nt as v,Ke as w,tt as x,it as y};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-BXf4EKjU.js","assets/rolldown-runtime-XKyaHtl9.js","assets/esm-CpFD3UPd.js","assets/jsx-runtime-C3cWAN_r.js","assets/with-selector-DNNxLmGI.js","assets/react-dom-BwXff0Px.js","assets/ui-DkEhb2Rt.js","assets/i18n-WXeVnv7i.js","assets/marked.esm-BfGIZK7F.js","assets/preload-helper-Cj7BV335.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{Dt as n,J as r,V as i,b as a,bt as o,ft as s,n as c,nt as l,ot as u,pt as d,s as f,wt as p}from"./i18n-WXeVnv7i.js";import{$ as m,Bn as h,Cn as g,Cr as _,Fr as v,Gr as ee,Ln as y,Mr as b,Pr as x,Sn as S,Sr as C,Tn as w,Z as te,an as T,br as E,cn as ne,er as D,ft as O,gn as k,ir as A,jn as re,ni as j,on as M,or as ie,rr as ae,sn as N,xn as P,zn as oe}from"./ui-DkEhb2Rt.js";import{t as se}from"./useMutation-BSffqL6W.js";import{d as F,n as I,s as L,u as ce}from"./marked.esm-BfGIZK7F.js";import{n as le,r as ue,t as de}from"./volume-2-Br71vpS5.js";import{t as fe}from"./eye-CG1LzvNI.js";import{n as R,t as pe}from"./list-checks-D1zkXlZa.js";import{t as me}from"./plug-CHvl1GhO.js";import{n as he,t as ge}from"./jsx-runtime-C3cWAN_r.js";import{n as _e,p as ve}from"./brand-BIT7AumL.js";import{c as ye,s as be}from"./engenty-Cy7MbUxR.js";import{b as xe,h as Se,m as Ce,u as we,y as Te}from"./session-RDdtfee2.js";import{t as Ee}from"./preload-helper-Cj7BV335.js";var De=class extends b{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:o,isRefetchError:s}=r,c=n.fetchMeta?.fetchMore?.direction,l=o&&c===`forward`,u=i&&c===`forward`,d=o&&c===`backward`,f=i&&c===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:x(t,n.data),hasPreviousPage:v(t,n.data),isFetchNextPageError:l,isFetchingNextPage:u,isFetchPreviousPageError:d,isFetchingPreviousPage:f,isRefetchError:s&&!l&&!d,isRefetching:a&&!u&&!f}}};function Oe(e,t){return _(e,De,t)}var ke={name:`app-window`,size:24,node:[[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}],[`path`,{d:`M10 4v4`,key:`pp8u80`}],[`path`,{d:`M2 8h20`,key:`d11cs7`}],[`path`,{d:`M6 4v4`,key:`1svtjw`}]]};ke.node;var z=F(ke),Ae={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};Ae.node;var B=F(Ae),je={name:`circle-dollar-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};je.node;var Me=F(je),Ne={name:`circle-euro`,size:24,node:[[`path`,{d:`M15 9.4a4 4 0 1 0 0 5.2`,key:`1makmb`}],[`path`,{d:`M7 12h5`,key:`gblrwe`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Ne.node;var Pe=F(Ne),Fe={name:`clapperboard`,size:24,node:[[`path`,{d:`m12.296 3.464 3.02 3.956`,key:`qash78`}],[`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z`,key:`1h7j8b`}],[`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`4lm6w1`}],[`path`,{d:`m6.18 5.276 3.1 3.899`,key:`zjj9t3`}]]};Fe.node;var V=F(Fe),Ie={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};Ie.node;var Le=F(Ie),Re={name:`coins`,size:24,node:[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]};Re.node;var ze=F(Re),Be={name:`flag`,size:24,node:[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]};Be.node;var H=F(Be),Ve={name:`git-fork`,size:24,node:[[`circle`,{cx:`12`,cy:`18`,r:`3`,key:`1mpf1b`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`path`,{d:`M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9`,key:`1uq4wg`}],[`path`,{d:`M12 12v3`,key:`158kv8`}]]};Ve.node;var U=F(Ve),He={name:`hourglass`,size:24,node:[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]};He.node;var W=F(He),Ue={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};Ue.node;var We=F(Ue),Ge={name:`layout-template`,size:24,node:[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]};Ge.node;var Ke=F(Ge),qe={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};qe.node;var Je=F(qe),Ye={name:`scan-text`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}]]};Ye.node;var Xe=F(Ye),Ze={name:`star`,size:24,node:[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]};Ze.node;var G=F(Ze),Qe={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Qe.node;var $e=F(Qe),et={name:`type`,size:24,node:[[`path`,{d:`M12 4v16`,key:`1654pz`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`,key:`e0r10z`}],[`path`,{d:`M9 20h6`,key:`s66wpe`}]]};et.node;var tt=F(et),K=t(he(),1);function nt(){return C({queryKey:[`config`],queryFn:async()=>{let e=await m.get(`/api/config`);return O(e.publicUrl),e},staleTime:6e4})}function rt(){let e=Se(),t=nt();return e.data?.features??t.data?.features??Te()}function it(e){return xe(rt(),e)}var at=[`text`,`web`,`browser`,`documents`,`image`,`video`,`speech`,`listening`,`code`,`connectors`,`motion-graphics`],ot=new Set([`html`,`md`,`txt`,`csv`,`json`]),st=new Set([`code`]),ct=new Set([`web_search`,`browser`,`sandbox`,`image`]),lt=new Set([`web_fetch`,`http`]),ut=/\{\{\s*memory\b/;function dt(e){switch(e.type){case`agent`:return[e.instructions];case`tool`:return[...e.call?[JSON.stringify(e.call.input)]:[],...Object.values(e.data?.params??{}).map(e=>e.includes(`{{`)?e:`{{${r(e)}}}`)];case`code`:return[...Object.values(e.code.input),...Object.values(e.data?.params??{})].map(e=>e.includes(`{{`)?e:`{{${r(e)}}}`);case`decision`:return[e.instructions];case`generate`:return[e.prompt,e.options?.style??``];case`motion-graphics`:return[e.brief];case`widget`:case`surface`:return Object.values(e.data).map(e=>`{{${r(e)}}}`);case`form`:return Object.values(e.data??{}).map(e=>`{{${r(e)}}}`);default:return[]}}function ft(e,t){return e.steps.slice(t+1).some(e=>e.type===`agent`||e.type===`decision`||e.type===`generate`||e.type===`motion-graphics`)}function pt(e,t){let i=[],a=(t,n)=>{let r=i.find(e=>e.need===t);r?r.hard||=n:i.push({stepId:e.id,need:t,hard:n})},c=t.steps.indexOf(e);for(let t of dt(e))ut.test(t)&&a(`memory`,!0),o(t).some(e=>e.startsWith(`lists.`))&&a(`lists`,!0);switch(e.type){case`form`:(e.timeout||e.remind)&&a(`wait`,!0),Object.values(e.data??{}).some(e=>u(r(e)))&&a(`lists`,!0);for(let n of e.fields){switch(n.kind){case`audio`:a(`field:audio`,!!n.required);break;case`connection`:a(`field:connection`,!0);break;case`slot`:a(`field:slot`,!0);break;case`list`:a(`lists`,!0);break;case`location`:a(`field:location`,!1);break;case`image`:a(`field:image`,!1);break;case`file`:ft(t,c)?a(`field:file-read`,!0):a(`field:file`,!1)}n.optionsFrom&&u(r(n.optionsFrom).split(`.`).slice(0,2).join(`.`))&&a(`lists`,!0)}break;case`tool`:{let t=e.call&&`tool`in e.call?s(e.call.tool):null;t&&a(`plugin:${t.plugin}`,!0);break}case`agent`:for(let t of e.tools){let e=s(t);e?a(`plugin:${e.plugin}`,!0):n(t)?a(`wizard-code`,!0):lt.has(t)||st.has(t)||(ct.has(t)?a(`tool:${t}`,!0):a(`tool:${t}`,!1))}e.connections?.length&&a(`connections`,!0),e.foreach&&(u(r(e.foreach))?a(`lists`,!0):a(`each`,!1));break;case`generate`:e.asset!==`document`&&e.asset!==`dashboard`&&a(`asset:${e.asset}`,!0);break;case`motion-graphics`:a(`motion-graphics`,!0);break;case`widget`:a(e.video?`widget:video`:`widget`,!0);break;case`surface`:Object.values(e.data).some(e=>u(r(e)))&&a(`lists`,!0);break;case`wait`:a(`wait`,!0);break;case`review`:e.show.some(e=>u(e))&&a(`lists`,!0),(e.timeout||e.remind||e.approve)&&a(`wait`,!0);break;case`result`:for(let n of e.deliverables){if(u(n.from)){a(`lists`,!0);continue}let e=t.steps.find(e=>e.id===n.from);if(e?.type!==`agent`&&e?.type!==`decision`&&(e?.type!==`generate`||e.asset!==`document`&&e.asset!==`dashboard`))continue;let r=n.formats.some(e=>ot.has(e));for(let t of n.formats)ot.has(t)||(t!==`pdf`||e?.type!==`agent`&&e?.type!==`decision`)&&a(`format:${t}`,t!==`pdf`&&!r)}}return i}function mt(e){let t=e.steps.flatMap(t=>pt(t,e));e.lists?.length&&!t.some(e=>e.need===`lists`)&&t.push({stepId:e.steps[0]?.id??``,need:`lists`,hard:!0}),e.connections?.length&&!t.some(e=>e.need===`connections`)&&t.push({stepId:e.steps[0]?.id??``,need:`connections`,hard:!0});let n=_t(e);return{fit:t.some(e=>e.hard&&n.has(e.stepId))?`no`:t.length?`less`:`full`,notes:t}}function ht(e){switch(e){case`tool:web_search`:case`tool:web_fetch`:return`web`;case`tool:browser`:return`browser`;case`tool:sandbox`:case`wizard-code`:return`code`;case`tool:image`:case`asset:image`:return`image`;case`asset:video`:case`motion-graphics`:case`widget:video`:return`video`;case`asset:voice`:return`speech`;case`field:audio`:return`listening`;case`tool:http`:case`connections`:case`field:connection`:return`connectors`;case`field:image`:case`field:file`:case`field:file-read`:return`documents`;default:return null}}function gt(e){let t=mt(e),n=_t(e),r=new Set,i=new Set,a=new Set,o=new Set;for(let e of t.notes){if(e.need.startsWith(`plugin:`)){a.add(e.need.slice(7));continue}if(e.need.startsWith(`format:`)){o.add(e.need.slice(7));continue}let t=ht(e.need);t&&(e.hard&&n.has(e.stepId)?r.add(t):i.add(t))}for(let e of r)i.delete(e);return{...t,missing:[...r],optional:[...i],needs:[...a].sort(),without:[...o]}}function _t(e){return e.steps.length?vt(e,e.steps[0].id,{}):new Set}function vt(e,t,n){let r=new Map(e.steps.map((e,t)=>[e.id,t])),i=r.get(t)??0,a=t=>{let i=[];for(let a of e.steps[t].next??[]){if(l(a))continue;let t=a.goto===`end`?e.steps.length:r.get(a.goto)??-1;if(a.ask||!p(a.when).every(e=>e in n))t>=0&&i.push(t);else if(d(a,n))return t>=0?[...i,t]:i}return i.push(yt(e,t,r)),i},o=t=>{if(t===i)return!1;let n=new Set([i]),r=[i];for(;r.length;){let i=r.shift();if(i>=e.steps.length)return!0;for(let e of a(i))e!==t&&!n.has(e)&&(n.add(e),r.push(e))}return!1};return new Set(e.steps.filter((e,t)=>!o(t)).map(e=>e.id))}function yt(e,t,n){let r=e.steps[t].next?.find(l)?.goto;return r===void 0?t+1:r===`end`?e.steps.length:n.get(r)??t+1}new Set(i);var bt=[`text`,`document`,`table`,`image`,`video`,`audio`,`dashboard`],xt=[`any`,`trades`,`gastronomy`,`hospitality`,`realEstate`,`retail`,`health`,`professional`,`agency`,`events`,`publicSector`],St=[`marketing`,`sales`,`accounting`,`service`,`research`,`hr`,`operations`,`website`,`visuals`,`inquiries`,`advice`],Ct=[`free`,`pro`],wt={"format.text":`Text`,"format.document":`Document (PDF, Word)`,"format.table":`Table`,"format.image":`Image`,"format.video":`Video`,"format.audio":`Audio`,"format.dashboard":`Dashboard`,"industry.any":`Any industry`,"industry.trades":`Trades`,"industry.gastronomy":`Food service`,"industry.hospitality":`Hotels & tourism`,"industry.realEstate":`Real estate`,"industry.retail":`Retail`,"industry.health":`Health`,"industry.professional":`Professional services`,"industry.agency":`Agency & marketing`,"industry.events":`Events`,"industry.publicSector":`Associations & public sector`,"useCase.marketing":`Marketing & social media`,"useCase.sales":`Offers & sales`,"useCase.accounting":`Accounting & receipts`,"useCase.service":`Customer service`,"useCase.research":`Research & analysis`,"useCase.hr":`HR & applications`,"useCase.operations":`Planning & operations`,"useCase.website":`Website helpers`,"useCase.visuals":`Images & video`,"useCase.inquiries":`Inquiries & bookings`,"useCase.advice":`Advice & pricing`,"capability.text":`Writes text`,"capability.web":`Web search`,"capability.browser":`Drives a browser`,"capability.documents":`Reads documents & photos`,"capability.image":`Makes images`,"capability.video":`Makes video`,"capability.speech":`Speech output`,"capability.listening":`Understands voice notes`,"capability.code":`Runs code`,"capability.connectors":`Connected accounts & systems`,"capability.motion-graphics":`Motion graphics with Claude Code (on your subscription)`,"cost.low":`low cost`,"cost.medium":`medium cost`,"cost.high":`high cost`,"plan.free":`Free`,"plan.pro":`Pro`,"outline.otherwise":`otherwise`,"outline.and":`{first} and {second}`,"outline.or":`{first} or {second}`,"outline.not":`not {condition}`,"outline.with":`with {name}`,"outline.without":`without {name}`,"outline.contains":`{name} contains {value}`},Tt={en:wt,de:{"format.text":`Text`,"format.document":`Dokument (PDF, Word)`,"format.table":`Tabelle`,"format.image":`Bild`,"format.video":`Video`,"format.audio":`Audio`,"format.dashboard":`Dashboard`,"industry.any":`Jede Branche`,"industry.trades":`Handwerk`,"industry.gastronomy":`Gastronomie`,"industry.hospitality":`Hotel & Tourismus`,"industry.realEstate":`Immobilien`,"industry.retail":`Handel`,"industry.health":`Gesundheit`,"industry.professional":`Kanzlei & Beratung`,"industry.agency":`Agentur & Marketing`,"industry.events":`Veranstaltungen`,"industry.publicSector":`Vereine & Öffentliches`,"useCase.marketing":`Marketing & Social Media`,"useCase.sales":`Angebote & Verkauf`,"useCase.accounting":`Buchhaltung & Belege`,"useCase.service":`Kundenservice`,"useCase.research":`Recherche & Analyse`,"useCase.hr":`Personal & Bewerbungen`,"useCase.operations":`Planung & Abläufe`,"useCase.website":`Helfer für die Website`,"useCase.visuals":`Bilder & Video`,"useCase.inquiries":`Anfragen & Termine`,"useCase.advice":`Beratung & Preise`,"capability.text":`Text schreiben`,"capability.web":`Websuche`,"capability.browser":`Browser bedienen`,"capability.documents":`Dokumente & Fotos lesen`,"capability.image":`Bilder erzeugen`,"capability.video":`Videos erzeugen`,"capability.speech":`Sprachausgabe`,"capability.listening":`Sprachnotizen verstehen`,"capability.code":`Code ausführen`,"capability.connectors":`Verbundene Konten & Systeme`,"capability.motion-graphics":`Motion-Grafik mit Claude Code (auf deinem Abo)`,"cost.low":`günstig`,"cost.medium":`mittel`,"cost.high":`teuer`,"plan.free":`Kostenlos`,"plan.pro":`Pro`,"outline.otherwise":`sonst`,"outline.and":`{first} und {second}`,"outline.or":`{first} oder {second}`,"outline.not":`nicht {condition}`,"outline.with":`mit {name}`,"outline.without":`ohne {name}`,"outline.contains":`{name} enthält {value}`}};function Et(e,t,n,r){let i=`${e}.${t}`;return i in wt?a(Tt,i,n,r):t}function Dt(e,t){return e?`connection`in e?`${e.connection} · ${e.action}`:e.tool:t?t.sql.replace(/\s+/g,` `).slice(0,90):``}function Ot(e){switch(e.type){case`form`:return pe;case`agent`:return ue;case`tool`:return me;case`code`:return A;case`decision`:return U;case`generate`:return e.asset===`image`?R:e.asset===`video`?g:e.asset===`dashboard`?We:L;case`widget`:return z;case`surface`:return Ke;case`motion-graphics`:return V;case`review`:return fe;case`wait`:return W;case`result`:return H}return S}var kt={form:`bg-cobalt-tint text-cobalt`,agent:`bg-ember-tint text-ember-strong`,decision:`bg-ember-tint text-ember-strong`,tool:`bg-ember-tint text-ember-strong`,code:`bg-ember-tint text-ember-strong`,generate:`bg-amber-tint text-ink-2`,widget:`bg-ember-veil text-ember-strong`,surface:`bg-ember-veil text-ember-strong`,"motion-graphics":`bg-amber-tint text-ink-2`,review:`bg-moss-tint text-moss`,wait:`bg-cobalt-tint text-cobalt`,result:`bg-paper-2 text-ink-2`},At={m:`wait.minutes`,h:`wait.hours`,d:`wait.days`};function jt(e){let t=/^(\d+)([mhd])$/.exec(e??``);return t?t[0]===`1d`?f(`wait.day`):f(At[t[2]],{n:t[1]}):null}function Mt(e){if(e.signal){let{key:t,name:n,timeout:r}=e.signal,i=n===`message.received`?f(`inspector.waitFromPerson`):n===`mail.received`?t.startsWith(`thread:`)?f(`wait.mailThread`):f(`wait.mail`,{key:t}):f(`wait.signal`,{key:t});return r?f(`wait.signalTimeout`,{waits:i,time:jt(r)??r}):i}let t=jt(e.for);if(t)return t;let n=Date.parse(e.until??``),r=Number.isNaN(n)?e.until??``:new Intl.DateTimeFormat(c,{dateStyle:`medium`,timeStyle:`short`}).format(n);return f(`wait.until`,{date:r})}function Nt(e){return f(`type.${e.type}`)}var Pt=[`web_search`,`web_fetch`,`browser`,`sandbox`,`image`,`http`,`pages`,`code`];function Ft(e){return Pt.includes(e)?f(`tool.${e}`):e}function It(e){switch(e.type){case`form`:return e.fields.map(e=>e.label).join(` · `);case`agent`:return e.tools.map(Ft).join(` · `)||e.instructions.slice(0,90);case`tool`:return Dt(e.call,e.data);case`code`:return e.code.entry;case`decision`:return e.output.fields.map(e=>e.description??e.id).join(` · `);case`generate`:{let t=[e.asset];return e.options?.aspectRatio&&t.push(e.options.aspectRatio),e.options?.duration&&t.push(`${e.options.duration}s`),e.options?.resolution&&t.push(e.options.resolution),e.options?.template&&t.push(e.options.template),t.join(` · `)}case`widget`:return[e.entry,Object.keys(e.data).join(`, `)].filter(Boolean).join(` · `);case`surface`:return e.candidates?e.candidates.map(e=>e.id).join(` · `):Object.keys(e.data).join(`, `);case`motion-graphics`:return[e.format,e.seconds?`${e.seconds}s`:null,e.skills.join(`, `)].filter(Boolean).join(` · `);case`review`:return[e.edit?f(`editor.reviewEditable`):null,e.regenerate?f(`editor.reviewRedo`):null].filter(Boolean).join(` · `);case`wait`:return Mt(e);case`result`:return e.deliverables.map(e=>`${e.label??e.from} (${e.formats.join(`, `)})`).join(` · `)}return``}var Lt=e({MarketplaceCards:()=>pn}),q=t(ge(),1),Rt=(0,K.lazy)(()=>Ee(()=>import(`./FlowPreview-BXf4EKjU.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),zt={useCase:``,industry:``,format:``,capability:``,plan:``,version:``},J=(e,t)=>Et(e,t,c),Bt={en:Me,de:Pe};function Vt(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function Ht(e){return e.credits?f(`market.credits`,{n:Vt(e.credits.credits)}):J(`cost`,e.costTier)}var Ut={text:tt,document:L,table:w,image:R,video:g,audio:ie,dashboard:B};function Y({format:e,className:t}){let n=Ut[e],r=J(`format`,e);return(0,q.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,q.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var Wt=[`low`,`medium`,`high`];function Gt({entry:e}){let t=Wt.indexOf(e.costTier)+1,n=Bt[c];return(0,q.jsxs)(`span`,{title:Ht(e),className:`inline-flex items-center gap-1`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:Wt.slice(0,t).map((e,t)=>(0,q.jsx)(`span`,{className:P(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,q.jsx)(n,{className:`size-4`})},e))}),J(`cost`,e.costTier)]})}function Kt(){return(0,q.jsx)(N,{tone:`ember`,title:f(`market.proHint`),children:f(`market.pro`)})}function qt({plugin:e}){return(0,q.jsx)(N,{icon:(0,q.jsx)(Je,{className:`size-3.5`}),title:f(`market.fromPlugin`,{name:e.name}),children:e.name})}function X({entry:e,onOpen:t,why:n}){let r=e.usable&&e.missing.length>0&&!e.needs?.length;return(0,q.jsxs)(M,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:P(`relative flex min-h-[124px] cursor-pointer flex-col gap-5 p-4 text-left transition sm:min-h-[136px] sm:p-5 hover:shadow-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,(!e.usable||!!e.needs?.length)&&`opacity-60`),children:[(0,q.jsx)(`span`,{className:P(`-top-4 pointer-events-none absolute right-4`,r&&`opacity-60`),children:(0,q.jsx)(_e,{kind:e.avatar,costume:e.costume,size:68})}),(0,q.jsxs)(`div`,{className:P(`min-w-0 pr-20`,r&&`opacity-60`),children:[(0,q.jsxs)(`div`,{className:`font-display font-semibold text-[0.9375rem]`,children:[e.title,e.plan===`pro`?(0,q.jsx)(`span`,{className:`ml-1.5 inline-flex align-middle`,children:(0,q.jsx)(Kt,{})}):null,e.starred?(0,q.jsx)(G,{className:`ml-1.5 inline size-3.5 fill-amber align-[-2px] text-amber`,"aria-label":f(`market.starred`)}):null]}),e.featured?(0,q.jsx)(`div`,{className:`mt-1`,children:(0,q.jsx)(N,{tone:`ember`,children:f(`market.recommended`)})}):null,(0,q.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3 leading-snug`,children:e.pitch})]}),(0,q.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[0.75rem] text-ink-3`,children:[n?(0,q.jsx)(N,{children:n}):null,e.plugin?(0,q.jsx)(qt,{plugin:e.plugin}):null,e.needs?.length?(0,q.jsx)(N,{tone:`warn`,children:f(`market.needsPro`,{list:e.needs.join(`, `)})}):e.usable&&e.missing.length?(0,q.jsx)(Zt,{missing:e.missing}):e.usable?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,q.jsx)(D,{className:`size-3.5`}),` `,f(`market.minutes`,{n:e.effort.minutes})]}),(0,q.jsx)(Gt,{entry:e}),e.optional?.length?(0,q.jsx)(N,{title:f(`market.optionalHint`,{list:Q(e.optional)}),children:f(`market.without`,{list:Q(e.optional)})}):null,(0,q.jsx)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:e.formats.map(e=>(0,q.jsx)(Y,{format:e,className:`size-4`},e))})]}):(0,q.jsx)(N,{tone:`warn`,children:f(`market.needsUpdate`)})]})]})}function Z({title:e,children:t}){return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var Q=e=>e.map(e=>J(`capability`,e)).join(`, `),Jt={text:`text`,documents:`text`,image:`image`,video:`video`,speech:`speech`,listening:`listening`,"motion-graphics":`claude`};function Yt(e,t){let n=Q(e),r=e.includes(`motion-graphics`),i=e.filter(e=>e!==`motion-graphics`);if(r&&t&&!i.length)return{path:null,action:`market.setUpModels`,hint:f(`market.motionCloud`)};let a=r&&!t?`motion-graphics`:i[0],o=a?Jt[a]:void 0;return{path:o?`/settings/models?show=${o}`:`/settings/models`,action:a===`motion-graphics`?`market.setUpClaude`:`market.setUpModels`,hint:a===`motion-graphics`?f(`market.motionHint`):f(`market.missingHint`,{list:n})}}function Xt(e){return Yt(e,Se().data?.mode===`managed`)}function Zt({missing:e}){let t=E(),n=Xt(e);return(0,q.jsxs)(`div`,{className:`flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,q.jsx)(`span`,{title:n.hint,className:`min-w-0 rounded-xl bg-amber-tint px-2.5 py-1 font-medium text-[0.75rem] text-ink-2 leading-snug [overflow-wrap:anywhere]`,children:n.path?f(`market.missing`,{list:Q(e)}):f(`market.motionCloudShort`)}),n.path?(0,q.jsx)(T,{size:`sm`,variant:`secondary`,onClick:e=>{e.stopPropagation(),t(n.path)},onKeyDown:e=>e.stopPropagation(),children:f(n.action)}):null]})}var Qt={text:y,web:le,browser:oe,documents:Xe,image:R,video:g,speech:de,listening:h,code:$e,connectors:me,"motion-graphics":V};function $t(e){switch(e.type){case`form`:return pe;case`agent`:return ue;case`decision`:return U;case`generate`:return e.asset===`image`?R:e.asset===`video`?g:e.asset===`voice`?de:e.asset===`dashboard`?B:L;case`widget`:return e.video?V:z;case`surface`:return z;case`motion-graphics`:return V;case`review`:return fe;case`wait`:return W;case`result`:return H}return S}function en(e){let t=new Set;for(let[n,r]of e.entries())for(let i of r.branches??[]){let r=i.to===`end`?e.length:e.findIndex(e=>e.id===i.to);for(let i=n+1;i<r;i++)t.add(e[i].id)}return t}function tn(e){let t=en(e);return e.map(e=>({id:e.id,title:e.title,icon:$t(e),tone:kt[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function nn({title:e,children:t}){return(0,q.jsx)(`span`,{title:e,className:`inline-flex items-center gap-2 border-border border-l px-4 first:border-l-0 first:pl-0`,children:t})}function rn({icon:e,children:t,more:n}){return(0,q.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,q.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`div`,{className:`text-[0.875rem] text-ink leading-snug`,children:t}),n?(0,q.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:n}):null]})]})}function an({className:e,children:t}){let n=(0,K.useRef)(null),[r,i]=(0,K.useState)({above:!1,below:!1});(0,K.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=e.scrollTop>1,n=e.scrollTop+e.clientHeight<e.scrollHeight-1;i(e=>e.above===t&&e.below===n?e:{above:t,below:n})};t(),e.addEventListener(`scroll`,t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),()=>{e.removeEventListener(`scroll`,t),r.disconnect()}},[]);let a=`linear-gradient(to bottom, ${r.above?`transparent`:`black`} 0, black 28px, black calc(100% - 44px), ${r.below?`transparent`:`black`} 100%)`;return(0,q.jsx)(`div`,{ref:n,className:e,style:{maskImage:a,WebkitMaskImage:a},children:(0,q.jsx)(`div`,{children:t})})}var on=2e4;function $({id:e,fallback:t,onClose:n,onUse:r,busy:i}){let a=j(),o=E(),s=C({queryKey:[`marketplace-entry`,e,c],queryFn:({signal:t})=>m.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${c}`,AbortSignal.any([t,AbortSignal.timeout(on)])),enabled:!!e,retry:!1}),l=s.data??t,u=Xt(l?.missing??[]),d=se({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?m.put(n):m.del(n)},onSuccess:()=>Promise.all([a.invalidateQueries({queryKey:[`marketplace`]}),a.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),p=ve()===`dark`,h=be[ye[l?.avatar||`round`]],g=p?`var(--card)`:`color-mix(in oklch, ${h??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,q.jsx)(ne,{open:!!e,onClose:n,wide:!0,bare:!0,children:l?(0,q.jsxs)(`div`,{className:`relative flex max-h-[calc(100dvh-48px)] flex-col rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:max-h-none max-sm:rounded-none`,children:[(0,q.jsx)(`button`,{type:`button`,"aria-label":f(`common.close`),onClick:n,className:`sm:-top-3.5 sm:-right-3.5 absolute top-3 right-3 z-20 flex size-9 items-center justify-center rounded-full bg-card text-ink-2 shadow-elevated ring-1 ring-border-soft transition hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,children:(0,q.jsx)(I,{className:`size-4`})}),(0,q.jsxs)(`header`,{className:`relative shrink-0 border-border-soft border-b px-5 pt-5 pb-4 text-ink sm:rounded-t-2xl sm:px-7`,style:{background:g,"--coin-bg":g},children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 overflow-hidden sm:rounded-t-2xl`,children:(0,q.jsx)(`span`,{className:P(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,p?`opacity-[0.14]`:`opacity-80`)})}),(0,q.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,q.jsx)(_e,{kind:l.avatar,costume:l.costume,size:104})}),(0,q.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,q.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight max-sm:pr-10`,children:l.title}),(0,q.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-2 leading-snug`,children:s.data?.description||l.pitch})]}),l.usable?(0,q.jsxs)(`div`,{className:`-mx-5 sm:-mx-7 relative mt-3.5 flex flex-wrap items-center gap-y-2 border-border-soft border-t px-5 pt-3 font-medium text-[0.875rem] sm:px-7 sm:pr-40`,children:[(0,q.jsxs)(nn,{title:f(`market.duration`),children:[(0,q.jsx)(D,{className:`size-4 text-ink-3`}),f(`market.minutes`,{n:l.effort.minutes})]}),(0,q.jsx)(nn,{title:f(`market.cost`),children:(0,q.jsx)(Gt,{entry:l})}),(0,q.jsx)(nn,{title:f(`market.result`),children:l.formats.map(e=>(0,q.jsx)(Y,{format:e,className:`size-4`},e))})]}):null]}),l.usable?(0,q.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-7 gap-y-6 px-5 pt-6 max-sm:overflow-y-auto max-sm:pb-4 sm:grid-cols-[230px_minmax(0,1fr)] sm:grid-rows-[minmax(0,1fr)] sm:px-7`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-5 sm:min-h-0 sm:overflow-y-auto`,children:[(0,q.jsx)(Z,{title:f(`market.duration`),children:(0,q.jsx)(rn,{icon:(0,q.jsx)(D,{className:`size-4 text-moss`}),more:f(`market.durationHint`,{n:l.effort.fields}),children:f(`market.minutes`,{n:l.effort.minutes})})}),(0,q.jsx)(Z,{title:f(`market.cost`),children:(0,q.jsx)(rn,{icon:(0,q.jsx)(ze,{className:`size-4 text-amber`}),more:l.credits?f(`market.creditsHint`):void 0,children:(0,q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,q.jsx)(Gt,{entry:l}),l.credits?(0,q.jsx)(`span`,{className:`text-ink-2`,children:f(`market.creditsRange`,{n:Vt(l.credits.credits)})}):null]})})}),(0,q.jsx)(Z,{title:f(`market.result`),children:(0,q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[s.isLoading?(0,q.jsx)(k,{className:`size-4 text-ink-3`}):null,(s.data?.results??[]).map(e=>(0,q.jsx)(rn,{icon:(0,q.jsx)(Y,{format:e.kind,className:`size-4 text-ember-strong`}),more:e.formats.map(e=>e.toUpperCase()).join(` · `),children:e.title},e.title))]})}),(0,q.jsxs)(Z,{title:f(`market.needs`),children:[(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.capabilities.map(e=>{let t=Qt[e],n=l.missing.includes(e),r=l.optional?.includes(e);return(0,q.jsxs)(`li`,{className:P(`flex items-center gap-2.5 text-[0.875rem]`,n?`text-ink-3`:`text-ink-2`),children:[(0,q.jsx)(t,{className:P(`size-4 shrink-0`,n?`text-rose`:r?`text-amber`:`text-cobalt`)}),J(`capability`,e),n?(0,q.jsx)(`span`,{className:`text-[0.75rem] text-rose`,children:f(`market.unavailable`)}):r?(0,q.jsx)(`span`,{className:`text-[0.75rem] text-amber`,children:f(`market.optional`)}):null]},e)})}),l.missing.length?(0,q.jsx)(`p`,{className:`mt-2.5 text-[0.8125rem] text-ink-3 leading-snug`,children:u.hint}):null]})]}),(0,q.jsxs)(`div`,{className:`flex flex-col sm:min-h-0`,children:[(0,q.jsx)(`div`,{className:`mb-1.5 shrink-0 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:f(`market.steps`)}),(0,q.jsx)(an,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:s.isLoading?(0,q.jsx)(k,{className:`size-5 text-ink-3`}):s.isError?(0,q.jsxs)(`div`,{className:`flex flex-col items-start gap-2 text-[0.875rem] text-ink-2`,children:[(0,q.jsx)(`p`,{children:f(`market.detailFailed`)}),(0,q.jsx)(T,{variant:`secondary`,size:`sm`,busy:s.isFetching,onClick:()=>void s.refetch(),children:f(`market.retry`)})]}):(0,q.jsx)(K.Suspense,{fallback:(0,q.jsx)(k,{className:`size-5 text-ink-3`}),children:(0,q.jsx)(Rt,{steps:tn(s.data?.outline??[])})})})]})]}):(0,q.jsx)(`div`,{className:`flex-1 px-5 pt-6 sm:px-7`,children:(0,q.jsx)(`p`,{className:`rounded-lg bg-amber-tint p-3 text-[0.875rem] text-ink-2`,children:f(`market.needsUpdateHint`)})}),(0,q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap justify-end gap-2 px-5 pt-4 pb-5 max-sm:border-border-soft max-sm:border-t sm:px-7 sm:pb-6`,children:[l.plugin?(0,q.jsx)(`span`,{className:`mr-auto flex items-center`,children:(0,q.jsx)(qt,{plugin:l.plugin})}):(0,q.jsxs)(T,{variant:`ghost`,className:`mr-auto`,title:f(`market.starHint`),"aria-pressed":l.starred,busy:d.isPending,onClick:()=>d.mutate(!l.starred),children:[(0,q.jsx)(G,{className:P(`size-4`,l.starred&&`fill-amber text-amber`)}),(0,q.jsx)(`span`,{className:`max-sm:sr-only`,children:f(l.starred?`market.starred`:`market.star`)})]}),(0,q.jsx)(T,{variant:`secondary`,onClick:n,children:f(`common.close`)}),l.usable&&l.missing.length&&u.path?(0,q.jsx)(T,{variant:`secondary`,onClick:()=>o(u.path),children:f(u.action)}):null,r?(0,q.jsx)(T,{disabled:!l.usable||l.missing.length>0||!!l.needs?.length,title:l.needs?.length?f(`market.needsProHint`,{list:l.needs.join(`, `)}):l.missing.length?u.hint:l.optional?.length?f(`market.optionalHint`,{list:Q(l.optional)}):void 0,busy:i,onClick:()=>r(l),children:f(`market.use`)}):null]})]}):(0,q.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[0.875rem] text-ink-2 shadow-overlay`,children:s.isLoading?(0,q.jsx)(k,{className:`size-6 text-ink-3`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{children:f(`market.notFound`)}),(0,q.jsx)(T,{variant:`secondary`,onClick:n,children:f(`common.close`)})]})})})}function sn({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,K.useState)(!1),o=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=n.find(e=>e.value===t);return(0,q.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,q.jsxs)(`div`,{className:P(`flex h-8 items-center rounded-full text-[0.8125rem] transition`,s?`bg-ember-tint text-ink`:`text-ink-2 hover:bg-paper-2 hover:text-ink`,i&&!s&&`bg-paper-2 text-ink`),children:[(0,q.jsx)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":i,onClick:()=>a(!i),className:P(`flex h-full items-center gap-1.5 rounded-full pl-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,s?`pr-1`:`pr-2.5`),children:s?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,q.jsx)(`span`,{className:`font-medium`,children:s.label})]}):(0,q.jsxs)(q.Fragment,{children:[e,(0,q.jsx)(ae,{className:P(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,q.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${f(`market.reset`)}`,onClick:()=>r(``),className:`mr-1 flex size-6 items-center justify-center rounded-full text-ink-3 hover:bg-card hover:text-ink`,children:(0,q.jsx)(I,{className:`size-3.5`})}):null]}),i?(0,q.jsx)(`div`,{role:`listbox`,"aria-label":e,className:`absolute top-full left-0 z-30 mt-1.5 max-h-80 min-w-60 overflow-y-auto rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:n.map(e=>(0,q.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:!e.count||e.unavailable,onClick:()=>{r(e.value===t?``:e.value),a(!1)},className:P(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] transition coarse:py-2.5`,e.count&&!e.unavailable?`text-ink-2 hover:bg-paper-2 hover:text-ink`:`text-ink-4`,e.value===t&&`font-medium text-ink`),children:[e.icon,(0,q.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:e.label}),e.value===t?(0,q.jsx)(ce,{className:`size-4 text-ember`}):e.unavailable?(0,q.jsx)(`span`,{className:`whitespace-nowrap text-[0.75rem] text-ink-4`,children:f(`market.unavailable`)}):(0,q.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function cn(e,t){let[n,r]=(0,K.useState)(e);return(0,K.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var ln=60;function un({query:e,onUse:t,busy:n,limit:r=6}){let[i,a]=(0,K.useState)(null),o=cn(e.trim(),250),s=C({queryKey:[`marketplace`,c,o,`hits`,r],queryFn:()=>m.get(`/api/studio/marketplace?${new URLSearchParams({lang:c,limit:String(r),offset:`0`,q:o})}`),enabled:!!o,placeholderData:ee}),l=o?s.data?.entries??[]:[];return l.length?(0,q.jsxs)(`section`,{className:`mt-10`,children:[(0,q.jsxs)(`h2`,{className:`mb-5 flex items-center gap-2 font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:[f(`market.hits`),s.isFetching?(0,q.jsx)(k,{className:`size-3.5`}):null]}),(0,q.jsx)(`div`,{className:`flex flex-col gap-4 sm:grid sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>(0,q.jsx)(X,{entry:e,onOpen:()=>a(e.id)},e.id))}),(0,q.jsx)($,{id:i,fallback:l.find(e=>e.id===i)??null,onClose:()=>a(null),onUse:t,busy:n})]}):null}function dn(){let e=C({queryKey:[`marketplace`,c,`fit`],queryFn:()=>m.get(`/api/studio/marketplace?${new URLSearchParams({lang:c,limit:`12`,offset:`0`,fit:`1`})}`)});return e.data?.context&&e.data.entries.some(e=>e.fit)?e.data:null}function fn({page:e,organization:t,onUse:n,busy:r,onAll:i}){let[a,o]=(0,K.useState)(null),s=e.context??{sector:null,sectorName:null},c=e.entries,l=e=>e.fit===`sector`||e.fit===`industry`?s.sectorName:e.fit===`wish`?f(`market.fitWish`):null;return(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h2`,{className:`mt-16 text-center font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:f(`market.fitTitle`,{organization:t})}),(0,q.jsx)(`p`,{className:`mt-2 mb-5 text-center text-[0.875rem] text-ink-3`,children:s.sectorName?f(`market.fitLine`,{sector:s.sectorName}):f(`market.fitLinePlain`)}),(0,q.jsx)(`div`,{className:`flex flex-col gap-4 sm:grid sm:grid-cols-2 lg:grid-cols-3`,children:c.map((e,t)=>(0,q.jsx)(`div`,{className:P(`contents`,t>=4&&`max-sm:hidden`,t>=8&&`sm:max-lg:hidden`),children:(0,q.jsx)(X,{entry:e,why:l(e),onOpen:()=>o(e.id)})},e.id))}),(0,q.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,q.jsx)(T,{variant:`secondary`,onClick:i,children:f(`market.fitAll`,{n:e.all||e.total})})}),(0,q.jsx)($,{id:a,fallback:c.find(e=>e.id===a)??null,onClose:()=>o(null),onUse:n,busy:r})]})}function pn({entries:e}){let t=j(),n=E(),{space:r}=we(),i=Ce()&&!!r&&!r?.readOnly,[a,o]=(0,K.useState)(null),s=se({mutationFn:e=>m.post(`/api/studio/wizards`,{spaceId:r.id,starterId:e,lang:c}),onSuccess:async({id:e})=>{await t.invalidateQueries({queryKey:te.spaces()}),await t.invalidateQueries({queryKey:[`wizards`]}),o(null),n(`/edit/${e}`)}});return(0,q.jsxs)(`div`,{className:`@container mt-3`,children:[(0,q.jsx)(`div`,{className:`flex flex-col gap-4 @xl:grid @xl:grid-cols-2`,children:e.map(e=>(0,q.jsx)(X,{entry:e,onOpen:()=>o(e.id)},e.id))}),s.error?(0,q.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:s.error.message}):null,(0,q.jsx)($,{id:a,fallback:e.find(e=>e.id===a)??null,onClose:()=>o(null),onUse:i?e=>!s.isPending&&s.mutate(e.id):void 0,busy:s.isPending})]})}function mn({onUse:e,busy:t,open:n,search:r,onGuestOpen:i}){let[a,o]=(0,K.useState)(``);(0,K.useEffect)(()=>{r&&o(r.text)},[r]);let[s,l]=(0,K.useState)(zt),u=it(`kernel`),[d,p]=(0,K.useState)(!1),[h,g]=(0,K.useState)(n??null),_=cn(a.trim(),250),v=(0,K.useRef)(null);(0,K.useEffect)(()=>{let e=v.current;_&&e&&window.matchMedia(`(max-width: 639px)`).matches&&e.scrollIntoView({behavior:`smooth`,block:`start`})},[_]);let y=Oe({queryKey:[`marketplace`,c,_,s,d],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:c,limit:String(ln),offset:String(e)});_&&t.set(`q`,_);for(let[e,n]of Object.entries(s))n&&t.set(e,n);return d&&t.set(`starred`,`1`),m.get(`/api/${i?`guest`:`studio`}/marketplace?${t}`)},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.entries.length,0);return n<e.total?n:void 0},placeholderData:ee}),b=y.data?.pages[0],x=y.data?.pages.flatMap(e=>e.entries)??[],S=b?.all??0,C=a.trim()!==_||y.isFetching&&!y.isFetchingNextPage,w=(e,t,n,r)=>n.filter(t=>b?.facets[e]?.[t]!==void 0).map(n=>({value:n,label:J(t,n),icon:r?.(n),count:(b?.facets[e])[n]??0,unavailable:e===`capability`&&te.has(n)})),te=new Set(b?.unavailable??[]),E=w(`useCase`,`useCase`,St),ne=[{key:`industry`,name:f(`market.industry`),options:w(`industry`,`industry`,xt)},{key:`format`,name:f(`market.format`),options:w(`format`,`format`,bt,e=>(0,q.jsx)(Y,{format:e,className:`size-4 text-ink-3`}))},{key:`plan`,name:f(`market.plan`),options:w(`plan`,`plan`,Ct)},{key:`capability`,name:f(`market.capability`),options:w(`capability`,`capability`,at,e=>{let t=Qt[e];return(0,q.jsx)(t,{className:`size-4 text-ink-3`})})},...u&&Object.keys(b?.facets.version??{}).length?[{key:`version`,name:f(`market.version`),options:Object.entries(b?.facets.version??{}).sort(([e],[t])=>t.localeCompare(e,void 0,{numeric:!0})).map(([e,t])=>({value:e,label:e,count:t??0}))}]:[]],D=!!a.trim()||d||Object.values(s).some(Boolean),O=()=>{l(zt),o(``),p(!1)};if(y.isLoading)return(0,q.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,q.jsx)(k,{className:`size-6 text-ink-3`})});let A=b?.offline?(0,q.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,q.jsx)(Le,{className:`size-4 shrink-0`}),f(`market.offline`)]}):null;if(!S&&!D)return A;let j=a?(0,q.jsx)(`button`,{type:`button`,"aria-label":f(`market.reset`),onClick:()=>o(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,q.jsx)(I,{className:`size-4`})}):null,M=e=>P(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.78125rem] transition`,e?`bg-card font-medium text-ink shadow-soft ring-1 ring-border-soft`:`text-ink-3 hover:bg-card/60 hover:text-ink`);return(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`label`,{ref:v,className:`relative mx-auto flex h-10 max-w-md scroll-mt-4 items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[C?(0,q.jsx)(k,{className:`size-4 shrink-0 text-ink-3`}):(0,q.jsx)(re,{className:`size-4 shrink-0 text-ink-3`}),(0,q.jsx)(`input`,{type:`search`,value:a,onChange:e=>o(e.target.value),placeholder:f(`market.search`),"aria-label":f(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),j]}),A,(0,q.jsxs)(`div`,{className:`max-sm:-mx-3 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-3 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:f(`market.all`)},...E].map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":!d&&s.useCase===e.value,onClick:()=>{p(!1),l({...s,useCase:e.value})},className:M(!d&&s.useCase===e.value),children:e.label},e.value)),i?null:(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":d,onClick:()=>p(!d),className:M(d),children:[(0,q.jsx)(G,{className:P(`size-3.5`,d&&`fill-amber text-amber`)}),f(`market.starred`)]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[d?null:ne.map(e=>(0,q.jsx)(sn,{name:e.name,value:s[e.key],options:e.options,onChange:t=>l({...s,[e.key]:t})},e.key)),(0,q.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[0.8125rem] text-ink-3`,children:[D?(0,q.jsxs)(`button`,{type:`button`,onClick:O,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,q.jsx)(I,{className:`size-3.5 max-sm:size-4`}),(0,q.jsx)(`span`,{className:`max-sm:sr-only`,children:f(`market.resetShort`)})]}):null,D?(0,q.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:f(`market.countOfShort`,{n:b?.total??0,all:S})}):null,(0,q.jsx)(`span`,{className:P(`tabular-nums`,D&&`max-sm:hidden`),children:D?f(`market.countOf`,{n:b?.total??0,all:S}):f(`market.count`,{n:S})})]})]}),x.length?(0,q.jsx)(`div`,{className:`mt-4 flex flex-col gap-4 sm:grid sm:grid-cols-2 lg:grid-cols-3`,children:x.map(e=>(0,q.jsx)(X,{entry:e,onOpen:()=>i?i(e):g(e.id)},e.id))}):(0,q.jsxs)(`div`,{className:`py-10 text-center text-[0.875rem] text-ink-3`,children:[(0,q.jsx)(`p`,{children:f(d?`market.noneStarred`:`market.none`)}),(0,q.jsx)(T,{variant:`ghost`,className:`mt-2`,onClick:O,children:f(`market.reset`)})]}),y.hasNextPage?(0,q.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,q.jsx)(T,{variant:`secondary`,busy:y.isFetchingNextPage,onClick:()=>void y.fetchNextPage(),children:f(`market.more`)})}):null,(0,q.jsx)($,{id:h,fallback:x.find(e=>e.id===h)??null,onClose:()=>g(null),onUse:e,busy:t})]})}export{Le as A,Je as C,U as D,W as E,B as M,z as N,H as O,Oe as P,G as S,We as T,gt as _,Lt as a,rt as b,cn as c,It as d,Ft as f,ht as g,Et as h,un as i,V as j,ze as k,kt as l,Mt as m,mn as n,Kt as o,Nt as p,fn as r,dn as s,$ as t,Ot as u,nt as v,Ke as w,tt as x,it as y};
|
package/apps/web/dist/assets/{NewWizardChannels-0aZoziks.js → NewWizardChannels-AlhLVY20.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{y as t}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{y as t}from"./index-9KCPALMX.js";import{Cn as n,Vn as r,or as i,xn as a}from"./ui-DkEhb2Rt.js";import{i as o,u as s}from"./marked.esm-BfGIZK7F.js";import{n as c}from"./volume-2-Br71vpS5.js";import{t as l}from"./list-checks-D1zkXlZa.js";import{Un as u,Wn as d}from"./host-DCRX0zfY.js";import{t as f}from"./phone-CG7Bz_ZL.js";import{n as p,t as m}from"./jsx-runtime-C3cWAN_r.js";import{s as h}from"./i18n-WXeVnv7i.js";var g=e(p(),1),_=e(m(),1),v=[{id:`steps`,group:`web`,runner:`steps`,label:`new.ch.steps`,icon:l},{id:`chat`,group:`web`,runner:`chat`,label:`new.ch.chat`,icon:d},{id:`talk`,group:`web`,runner:`talk`,label:`new.ch.talk`,icon:i},{id:`video`,group:`web`,runner:`video`,label:`new.ch.video`,icon:n},{id:`call`,group:`phone`,runner:`call`,label:`new.ch.call`,icon:f},{id:`wacall`,group:`phone`,runner:`call`,label:`new.ch.whatsapp`,icon:null},{id:`sms`,group:`message`,runner:`sms`,label:`new.ch.sms`,icon:r},{id:`whatsapp`,group:`message`,runner:`whatsapp`,label:`new.ch.whatsapp`,icon:null}],y=[{id:`web`,label:`new.web`,icon:c},{id:`phone`,label:`new.phone`,icon:f},{id:`message`,label:`new.messages`,icon:u}],b=v.filter(e=>t.enabled.includes(e.id)).map(e=>e.id),x=e=>v.filter(t=>e.includes(t.id));function S(e){return e.length===b.length&&b.every(t=>e.includes(t))}function C(e){let n=x(e),r=[...new Set(n.map(e=>e.runner))];return{default:n.find(e=>e.group===`web`)?.runner??r[0]??t.default,enabled:r}}var w=e=>e.map(e=>h(e.label));function T(e){return v.find(t=>t.runner===e)}function E(e){return v.filter(t=>t.id!==`wacall`&&e.includes(t.runner)).map(e=>e.id)}function D(e){let t=x(e),n=y.flatMap(e=>{let n=w(t.filter(t=>t.group===e.id));return n.length?[e.id===`web`?n.join(`, `):`${h(e.label)}: ${n.join(`, `)}`]:[]});return`${h(`new.runsAs`)}: ${n.join(` · `)}`}function O(e){return e.length<=2?e.join(`, `):`${e.slice(0,2).join(`, `)} +${e.length-2}`}function k({channel:e,className:t}){let n=e.icon;return n?(0,_.jsx)(n,{className:t??`size-4`}):(0,_.jsx)(`span`,{"aria-hidden":`true`,className:`font-semibold text-[0.625rem] tracking-wide`,children:`WA`})}function A(e){let t=new Set(e?.map(e=>e.id)??[`steps`,`chat`]);return v.filter(e=>t.has(e.runner))}function j({value:e,onChange:t,runners:n,without:r,disabled:i}){let o=A(n).filter(e=>!r?.includes(e.id)),c=t=>e.includes(t.id),l=n=>{i||c(n)&&e.length===1||t(c(n)?e.filter(e=>e!==n.id):[...e,n.id])},u=t=>{let n=y.find(e=>e.id===t),r=o.filter(e=>e.group===t);if(!(n&&r.length))return null;let u=n.icon;return(0,_.jsxs)(`fieldset`,{className:`m-0 flex min-w-0 flex-col gap-0.5 border-0 p-0`,children:[(0,_.jsxs)(`legend`,{className:`flex items-center gap-1.5 px-2 pt-2 pb-1 text-[0.75rem] text-ink-3`,children:[(0,_.jsx)(u,{className:`size-3.5`}),` `,h(n.label)]}),r.map(t=>(0,_.jsxs)(`div`,{children:[(0,_.jsxs)(`label`,{className:a(`flex h-10 w-full cursor-pointer items-center gap-2.5 rounded-lg px-2 text-[0.875rem] transition hover:bg-accent has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-focus coarse:h-11`,c(t)&&`bg-paper-2`),children:[(0,_.jsx)(`span`,{className:`flex w-5 justify-center text-ink-3`,children:(0,_.jsx)(k,{channel:t})}),(0,_.jsx)(`span`,{className:`flex-1`,children:h(t.label)}),(0,_.jsx)(`input`,{type:`checkbox`,className:`sr-only`,"aria-label":h(t.label),checked:c(t),disabled:i,"aria-disabled":c(t)&&e.length===1,onChange:()=>l(t)}),(0,_.jsx)(`span`,{"aria-hidden":`true`,className:a(`flex size-[1.125rem] items-center justify-center rounded-md ring-1`,c(t)?`bg-ink text-paper ring-ink`:`ring-border`),children:c(t)?(0,_.jsx)(s,{className:`size-3`,strokeWidth:3}):null})]}),t.id===`call`&&c(t)?(0,_.jsx)(`p`,{className:`px-2 pb-1.5 pl-9 text-[0.75rem] text-ink-3`,children:h(`new.callHandoff`)}):null]},t.id))]})};return(0,_.jsxs)(`div`,{className:`grid gap-x-4 sm:grid-cols-2`,children:[u(`web`),(0,_.jsxs)(`div`,{className:`flex flex-col`,children:[u(`phone`),u(`message`)]})]})}function M({value:e,onChange:t,runners:n,className:r}){let[i,s]=(0,g.useState)(!1),[c,l]=(0,g.useState)(0),u=(0,g.useRef)(null);(0,g.useEffect)(()=>{if(!i)return;let e=e=>{u.current?.contains(e.target)||s(!1)},t=e=>{e.key===`Escape`&&s(!1)};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[i]);let d=A(n),f=y.filter(e=>d.some(t=>t.group===e.id)),p=t=>e.includes(t.id);return(0,_.jsxs)(`div`,{ref:u,className:a(`relative flex flex-wrap items-center gap-1.5`,r),children:[(0,_.jsx)(`span`,{className:`mr-0.5 px-1 text-[0.8125rem] text-ink-3`,children:h(`new.runsAs`)}),f.map(e=>{let t=w(d.filter(t=>t.group===e.id&&p(t))),n=e.icon;return(0,_.jsxs)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-label":`${h(e.label)}: ${t.length?t.join(`, `):h(`new.off`)}`,onClick:e=>{let t=e.currentTarget;l(t.offsetLeft+t.offsetWidth/2),s(e=>!e)},className:a(`inline-flex h-9 items-center justify-center gap-1.5 rounded-full font-medium text-[0.8125rem] transition coarse:h-11`,t.length?`bg-ink px-3 text-paper`:`w-9 text-ink-3 ring-1 ring-border hover:text-ink coarse:w-11`),children:[(0,_.jsx)(n,{className:`size-4 shrink-0`}),t.length?(0,_.jsx)(`span`,{className:`truncate`,children:O(t)}):null]},e.id)}),(0,_.jsx)(`button`,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-label":h(`new.where`),onClick:e=>{let t=e.currentTarget;l(t.offsetLeft+t.offsetWidth/2),s(e=>!e)},className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 ring-1 ring-border transition hover:text-ink coarse:size-11`,children:(0,_.jsx)(o,{className:`size-4`})}),i?(0,_.jsxs)(`div`,{role:`dialog`,"aria-label":h(`new.where`),style:{transformOrigin:`${c}px top`},className:`absolute top-full left-0 z-20 mt-2 w-[min(32rem,calc(100vw-2rem))] animate-unfold rounded-2xl bg-card p-3 text-left shadow-overlay ring-1 ring-border`,children:[(0,_.jsx)(`p`,{className:`px-2 pt-1 font-semibold text-[0.9375rem]`,children:h(`new.where`)}),(0,_.jsx)(j,{value:e,onChange:t,runners:n})]}):null]})}export{D as a,S as c,M as i,C as l,k as n,T as o,j as r,E as s,y as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,s as n}from"./i18n-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{n as t,s as n}from"./i18n-WXeVnv7i.js";import{c as r,n as i,o as a,r as o,s,t as c}from"./Marketplace-B3NoH5Va.js";import{$ as l,Gr as u,Sr as d,Z as f,Zt as p,an as m,bn as h,br as g,cn as _,cr as v,d as y,f as b,hr as x,l as S,m as C,mr as w,mt as T,ni as E,p as ee,s as te,sn as D,u as ne,xn as re}from"./ui-DkEhb2Rt.js";import{t as O}from"./useMutation-BSffqL6W.js";import{i as ie}from"./marked.esm-BfGIZK7F.js";import{n as k,t as A}from"./jsx-runtime-C3cWAN_r.js";import{n as ae}from"./brand-BIT7AumL.js";import{h as oe,i as se,m as j,t as ce,u as M}from"./session-RDdtfee2.js";import{Wt as le}from"./host-DCRX0zfY.js";import{t as N}from"./upload-BZThm-R6.js";import{a as ue,c as P,i as de,l as fe}from"./NewWizardChannels-AlhLVY20.js";var F=[[`id`,8],[`toolId`,10],[`moduleId`,7],[`pluginId`,6],[`title`,6],[`description`,4],[`tags`,3],[`path`,3],[`inputSchema`,2],[`outputSchema`,2],[`request`,1],[`response`,1]];function I(e){return e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase()}function L(e){return I(e).split(/[^a-z0-9]+/).map(e=>e.trim()).filter(e=>e.length>1)}function R(e){return e==null?``:Array.isArray(e)?e.map(R).filter(Boolean).join(` `):typeof e==`object`?Object.values(e).map(R).filter(Boolean).join(` `):String(e)}function z(e,t){let n=t.map(([t,n])=>({text:R(e[t]),weight:n})).filter(e=>e.text.length>0);return{fields:n,tokens:n.flatMap(e=>L(e.text))}}function B(e){let t=[e];if(e.length<5)return t;if(e.endsWith(`ing`)){let n=e.slice(0,-3);n.length>=3&&t.push(n,`${n}e`)}else if(e.endsWith(`ies`)&&e.length>=6)t.push(`${e.slice(0,-3)}y`);else if(e.endsWith(`es`))t.push(e.slice(0,-2),e.slice(0,-1));else if(e.endsWith(`ed`)){let n=e.slice(0,-2);t.push(n,`${n}e`)}else e.endsWith(`s`)&&!e.endsWith(`ss`)&&t.push(e.slice(0,-1));return[...new Set(t)]}function V(e,t){if(e===t)return 1;let n=0;for(let r of B(e))for(let i of B(t))r===i?n=Math.max(n,r===e&&i===t?1:.75):(r.length>=2&&i.startsWith(r)&&(n=Math.max(n,.55*(r.length/i.length))),i.length>=4&&r.startsWith(i)&&(n=Math.max(n,.4*(i.length/r.length))));return n}function H(e,t){return e.reduce((e,n)=>e+V(t,n),0)}function U(e,t,n=F){if(!t?.trim())return 0;let r=L(t);if(r.length===0)return 0;let i=z(e,n);return i.tokens.length===0?0:r.reduce((e,t)=>H(i.tokens,t)===0?e:e+i.fields.reduce((e,n)=>{let r=L(n.text),i=H(r,t);if(i===0)return e;let a=i*2.2/(i+1.2+r.length/16);return e+n.weight*a},0),0)}var W=new Set(L(`aber als also am an auch auf aus bei bin bitte brauche brauchen braucht das dass dem den der
|
|
2
2
|
des die dies diese dieser doch du ein eine einem einen einer eines er es etwas fuer für gerne
|
|
3
3
|
habe haben hat ich ihr im in ist kann können koennen mache machen mag mein meine meinem meinen
|
|
4
4
|
meiner mich mir mit möchte moechte nach nicht noch nur oder sich sie sind soll suche suchen
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./useMutation-fT44ij_b.js";import{$ as n,Sr as r,Z as i,br as a,cr as o,m as s,mr as c,ni as ee,p as l,s as u,xn as d}from"./ui-DSgksc1H.js";import{s as te,u as f}from"./marked.esm-BfGIZK7F.js";import{t as ne}from"./upload-BZThm-R6.js";import{n as p,t as m}from"./jsx-runtime-C3cWAN_r.js";import{a as h,n as re}from"./brand-DKuVyYhH.js";import{t as g}from"./logo-xL-sneZz.js";import{n as _,s as v}from"./i18n-Dyi0kvaA.js";import{_ as y,h as ie,i as ae,n as b,u as oe}from"./session-EIDP3Wzc.js";import{r as se}from"./LangSwitch-BNkytlus.js";var x=new Set([`gmail.com`,`googlemail.com`,`gmx.at`,`gmx.de`,`gmx.net`,`web.de`,`outlook.com`,`hotmail.com`,`live.com`,`icloud.com`,`me.com`,`yahoo.com`,`yahoo.de`,`aon.at`,`a1.net`,`chello.at`,`t-online.de`,`proton.me`,`protonmail.com`]),ce={website:`Website`,blog:`Blog`,linkedin:`LinkedIn`,instagram:`Instagram`,facebook:`Facebook`,youtube:`YouTube`,x:`X`,xing:`XING`,tiktok:`TikTok`},le=[[`linkedin`,/(^|\.)linkedin\.com$/],[`instagram`,/(^|\.)instagram\.com$/],[`facebook`,/(^|\.)(facebook|fb)\.com$/],[`youtube`,/(^|\.)(youtube\.com|youtu\.be)$/],[`x`,/(^|\.)(x|twitter)\.com$/],[`xing`,/(^|\.)xing\.com$/],[`tiktok`,/(^|\.)tiktok\.com$/]];function ue(e){let t=e.trim();if(!t||/\s/.test(t))return null;try{let e=new URL(/^https?:\/\//i.test(t)?t:`https://${t}`);return e.hostname.includes(`.`)?e.href:null}catch{return null}}function de(e){let t=ue(e);if(!t)return`website`;let{hostname:n,pathname:r}=new URL(t),i=n.toLowerCase().replace(/^www\./,``);for(let[e,t]of le)if(t.test(i))return e;return/^blog\./.test(i)||/^\/blog(\/|$)/.test(r)||/(^|\.)(medium|substack)\.com$/.test(i)?`blog`:`website`}var S=[{id:`bakeries`,industry:`gastronomy`,name:{de:`Bäckereien`,en:`Bakeries`},words:[`bäckerei`,`bäcker`,`backstube`,`brot`,`gebäck`,`konditorei`,`bakery`,`bread`,`pastry`]},{id:`cafes`,industry:`gastronomy`,name:{de:`Cafés`,en:`Cafés`},words:[`café`,`cafe`,`kaffeehaus`,`kaffee`,`coffee`,`espresso`]},{id:`restaurants`,industry:`gastronomy`,name:{de:`Restaurants`,en:`Restaurants`},words:[`restaurant`,`gasthaus`,`gasthof`,`wirtshaus`,`pizzeria`,`küche`,`speisekarte`,`menu`,`bistro`]},{id:`hotels`,industry:`hospitality`,name:{de:`Hotels und Pensionen`,en:`Hotels and guesthouses`},words:[`hotel`,`pension`,`zimmer`,`übernachtung`,`ferienwohnung`,`guesthouse`,`booking`,`rooms`]},{id:`architects`,industry:`professional`,name:{de:`Architekturbüros`,en:`Architects`},words:[`architekt`,`architektur`,`planung`,`entwurf`,`architect`,`architecture`]},{id:`lawFirms`,industry:`professional`,name:{de:`Kanzleien`,en:`Law firms`},words:[`rechtsanwalt`,`anwalt`,`kanzlei`,`recht`,`notar`,`law firm`,`lawyer`,`attorney`,`legal`]},{id:`taxAdvisors`,industry:`professional`,name:{de:`Steuerberatung`,en:`Tax advisors`},words:[`steuerberatung`,`steuerberater`,`steuer`,`buchhaltung`,`lohnverrechnung`,`bilanz`,`tax`,`accounting`,`bookkeeping`]},{id:`consultants`,industry:`professional`,name:{de:`Beratung`,en:`Consultants`},words:[`beratung`,`berater`,`consulting`,`coaching`,`consultant`]},{id:`physiotherapy`,industry:`health`,name:{de:`Physiotherapie`,en:`Physiotherapy`},words:[`physiotherapie`,`physio`,`massage`,`therapie`,`physiotherapy`]},{id:`practices`,industry:`health`,name:{de:`Arztpraxen`,en:`Doctors’ practices`},words:[`arzt`,`ärztin`,`praxis`,`ordination`,`zahnarzt`,`doctor`,`clinic`,`dentist`]},{id:`hairdressers`,industry:`retail`,name:{de:`Friseur und Kosmetik`,en:`Hair and beauty`},words:[`friseur`,`frisör`,`kosmetik`,`nagelstudio`,`beauty`,`hairdresser`,`salon`]},{id:`joiners`,industry:`trades`,name:{de:`Tischlereien`,en:`Joiners`},words:[`tischlerei`,`tischler`,`schreiner`,`möbel`,`holz`,`joinery`,`carpenter`,`furniture`]},{id:`electricians`,industry:`trades`,name:{de:`Elektrotechnik`,en:`Electricians`},words:[`elektriker`,`elektro`,`elektrotechnik`,`photovoltaik`,`electrician`,`electrical`]},{id:`plumbing`,industry:`trades`,name:{de:`Installateure`,en:`Plumbing and heating`},words:[`installateur`,`sanitär`,`heizung`,`klima`,`plumber`,`plumbing`,`heating`]},{id:`windows`,industry:`trades`,name:{de:`Fensterbau`,en:`Window makers`},words:[`fenster`,`türen`,`fensterbau`,`sonnenschutz`,`windows`,`doors`]},{id:`construction`,industry:`trades`,name:{de:`Bau und Handwerk`,en:`Building and trades`},words:[`bau`,`baumeister`,`maler`,`dachdecker`,`handwerk`,`construction`,`builder`,`painter`,`roofer`]},{id:`realEstate`,industry:`realEstate`,name:{de:`Immobilien`,en:`Real estate`},words:[`immobilien`,`makler`,`wohnung`,`miete`,`hausverwaltung`,`real estate`,`property`,`estate agent`]},{id:`onlineShops`,industry:`retail`,name:{de:`Online-Shops`,en:`Online shops`},words:[`online-shop`,`onlineshop`,`shop`,`versand`,`e-commerce`,`webshop`,`online store`]},{id:`retail`,industry:`retail`,name:{de:`Handel`,en:`Retail`},words:[`geschäft`,`handel`,`laden`,`boutique`,`retail`,`store`]},{id:`agencies`,industry:`agency`,name:{de:`Agenturen`,en:`Agencies`},words:[`agentur`,`werbung`,`marketing`,`design`,`kommunikation`,`agency`,`advertising`,`branding`]},{id:`photographers`,industry:`agency`,name:{de:`Fotografie`,en:`Photographers`},words:[`fotograf`,`fotografie`,`foto`,`photographer`,`photography`]},{id:`events`,industry:`events`,name:{de:`Veranstaltungen`,en:`Events`},words:[`event`,`veranstaltung`,`hochzeit`,`catering`,`konferenz`,`wedding`,`conference`]},{id:`itServices`,industry:`professional`,name:{de:`IT-Dienstleister`,en:`IT services`},words:[`it-dienstleister`,`it-service`,`software`,`webentwicklung`,`hosting`,`netzwerk`,`development`,`web design`]},{id:`cleaning`,industry:`trades`,name:{de:`Reinigung`,en:`Cleaning`},words:[`reinigung`,`gebäudereinigung`,`putz`,`cleaning`,`janitorial`]},{id:`footballClubs`,industry:`any`,name:{de:`Fußballvereine`,en:`Football clubs`},words:[`fußball`,`fussball`,`fc`,`sv`,`kicker`,`football`,`soccer`]},{id:`sportsClubs`,industry:`any`,name:{de:`Sportvereine`,en:`Sports clubs`},words:[`sportverein`,`verein`,`turnen`,`tennis`,`laufen`,`sport`,`club`]},{id:`musicClubs`,industry:`events`,name:{de:`Musikvereine und Chöre`,en:`Music clubs and choirs`},words:[`musikverein`,`blasmusik`,`chor`,`kapelle`,`orchester`,`band`,`choir`,`music`]},{id:`fireBrigades`,industry:`publicSector`,name:{de:`Feuerwehren`,en:`Fire brigades`},words:[`feuerwehr`,`rettung`,`rotes kreuz`,`fire brigade`,`rescue`]},{id:`schools`,industry:`publicSector`,name:{de:`Schulen und Bildung`,en:`Schools and education`},words:[`schule`,`kurs`,`weiterbildung`,`akademie`,`nachhilfe`,`school`,`course`,`training`]},{id:`municipalities`,industry:`publicSector`,name:{de:`Gemeinden`,en:`Municipalities`},words:[`gemeinde`,`stadt`,`bürgerservice`,`amt`,`municipality`,`council`,`town`]},{id:`associations`,industry:`any`,name:{de:`Vereine und Initiativen`,en:`Associations`},words:[`verein`,`initiative`,`ehrenamt`,`verband`,`association`,`nonprofit`,`charity`]}],C=e=>S.find(t=>t.id===e)??null;function fe(e,t=3){let n=` ${e.toLowerCase().normalize(`NFC`).replace(/[^\p{L}\p{N}-]+/gu,` `)} `;return S.map(e=>({id:e.id,score:e.words.reduce((e,t)=>e+(n.includes(` ${t}`)?Math.min(3,t.length/4):0),0)})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,t).map(e=>e.id)}var w=e(p(),1),T=e(m(),1),pe=`oklch(50% 0.2 262)`,E=`oklch(32% 0.15 262)`,D=`oklch(90% 0.1 80)`,me={"--on":`white`,"--dot":D,"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},O={kind:1,organization:1,site:2,details:3,know:4,space:5},he=e=>e!==null&&Object.hasOwn(O,e),ge=`w-full rounded-[18px] border border-white/30 bg-white/15 px-6 py-5 text-[1.375rem] text-white outline-none placeholder:text-white/55 focus:border-white/60`;function _e(){return(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,T.jsx)(g,{size:28}),(0,T.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight`,children:[`engenty`,(0,T.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-(color:--dot)`,children:`.`}),(0,T.jsx)(`span`,{className:`font-normal text-white/70`,children:`wizards`})]})]})}function k({children:e,busy:t,onClick:n,type:r=`button`}){return(0,T.jsxs)(`button`,{type:r,disabled:t,onClick:n,className:`inline-flex h-13 cursor-pointer items-center gap-2.5 rounded-full bg-white px-7 font-semibold text-[1rem] transition hover:bg-white/90 disabled:cursor-default disabled:opacity-70`,style:{color:E},children:[e,(0,T.jsx)(o,{className:`size-[18px]`})]})}function A({children:e,onClick:t}){return(0,T.jsx)(`button`,{type:`button`,onClick:t,className:`cursor-pointer font-semibold text-[0.9375rem] text-white/85 transition hover:text-white`,children:e})}function j({step:e,total:t=4}){return(0,T.jsx)(`span`,{className:`ml-auto inline-flex gap-1.5`,role:`img`,"aria-label":v(`onboard.step`,{n:e,total:t}),children:Array.from({length:t},(e,t)=>t+1).map(t=>(0,T.jsx)(`span`,{className:d(`size-2 rounded-full`,t===e?`bg-white`:`bg-white/40`)},t))})}var ve=[{kind:`personal`,label:`onboard.kindPersonal`,sub:`onboard.kindPersonalSub`},{kind:`club`,label:`onboard.kindClub`,sub:`onboard.kindClubSub`},{kind:`small`,label:`onboard.kindSmall`,sub:`onboard.kindSmallSub`},{kind:`corp`,label:`onboard.kindCorp`,sub:`onboard.kindCorpSub`}];function ye(e){let t=(e.split(`@`)[1]??``).trim().toLowerCase();return t?x.has(t)?{kind:`personal`,domain:t}:/(verein|club|klub|^sv-|^fc-|^ff-|feuerwehr|musik|chor)/.test(t)?{kind:`club`,domain:t}:{kind:`small`,domain:t}:{kind:null,domain:t}}var be={club:[`0-50`,`50-250`,`250-1000`,`1000+`],small:[`1`,`2-9`,`10-49`],corp:[`50-249`,`250-999`,`1000+`]},M=e=>Number(e).toLocaleString(_),xe=e=>{if(e===`1`)return v(`onboard.justMe`);if(e.endsWith(`+`))return`${M(e.slice(0,-1))}+`;let[t,n]=e.split(`-`);return t===`0`?`≤ ${M(n)}`:`${M(t)}–${M(n)}`},Se=[`sport`,`culture`,`social`,`education`,`environment`,`rescue`,`other`],Ce=[`chair`,`board`,`treasurer`,`secretary`,`member`],we=[`management`,`it`,`marketing`,`sales`,`operations`,`other`],Te=`w-full rounded-[14px] border border-white/30 bg-white/15 px-4 py-3 text-[1.0625rem] text-white outline-none placeholder:text-white/55 focus:border-white/60`;function Ee({picked:e,label:t,sub:n,onClick:r}){return(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:r,className:d(`flex cursor-pointer flex-col gap-1 rounded-[18px] border px-5 py-4 text-left transition`,e?`border-white bg-white/25`:`border-white/30 bg-white/10 hover:bg-white/15`),children:[(0,T.jsx)(`span`,{className:`font-display font-semibold text-[1.125rem]`,children:t}),(0,T.jsx)(`span`,{className:`text-[0.875rem] text-white/80`,children:n})]})}function N({label:e,options:t,value:n,text:r,onChange:i}){return(0,T.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,T.jsx)(`legend`,{className:`mb-2 text-[0.9375rem] text-white/85`,children:e}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>(0,T.jsx)(`button`,{type:`button`,"aria-pressed":n===e,onClick:()=>i(e),className:d(`cursor-pointer rounded-full border px-4 py-2 text-[0.9375rem] transition`,n===e?`border-white bg-white`:`border-white/30 hover:bg-white/15`),style:n===e?{color:E}:void 0,children:r(e)},e))})]})}function P(e,t,n){let r=`${De}${e}:${t}`,[i,a]=(0,w.useState)(()=>{try{let e=sessionStorage.getItem(r);return e===null?n:JSON.parse(e)}catch{return n}});return(0,w.useEffect)(()=>{try{sessionStorage.setItem(r,JSON.stringify(i))}catch{}},[r,i]),[i,a]}var De=`wizards.onboarding:`;function Oe(){try{for(let e of Object.keys(sessionStorage))e.startsWith(De)&&sessionStorage.removeItem(e)}catch{}}function F(){return h(pe),ie().data?.onboarding===`welcome`?(0,T.jsx)(Me,{}):(0,T.jsx)(I,{})}function I(){let e=ie(),o=ee(),s=a(),{space:l}=oe(),u=e.data?.user.id??``,p=e.data?.onboarding===`organization`,m=p?4:5,h=e.data?.startingName?null:e.data?.tenant.name??null,[g,y]=P(u,`organization`,``),[b,x]=P(u,`line`,null),[le,S]=P(u,`ticked`,null),[C,O]=P(u,`own`,[``]),[M,De]=(0,w.useState)(null),[F,I]=(0,w.useState)([]),Me=(0,w.useRef)(null),[Pe]=(0,w.useState)(ae),[B]=(0,w.useState)(()=>p?{kind:null,domain:``}:ye(e.data?.user.email??``)),[V,Fe]=P(u,`profile`,{kind:B.kind,size:null,sector:``,role:null,need:``,questions:``,phone:``}),[Ie,Le]=c(),H=Ie.get(`page`),U=he(H)&&(H===`kind`||V.kind)&&!(p&&H===`space`)?H:`kind`,W=e=>Le(t=>{let n=new URLSearchParams(t);return n.set(`page`,e),n}),G=e=>Fe(t=>({...t,...e})),K=V.kind===`personal`,q=h??(g.trim()||null),J=r({queryKey:[`onboarding`,`suggest`],queryFn:()=>n.get(`/api/studio/onboarding/suggest`),enabled:!p&&!h&&!!V.kind&&!K,staleTime:1/0}).data?.site??null;(0,w.useEffect)(()=>{J&&!g&&y(J.name)},[J,g,y]);let Re=r({queryKey:[`onboarding`,`find`,q],queryFn:()=>n.post(`/api/studio/onboarding/find`,{name:q,lang:_}),enabled:U===`site`&&!K&&!!q,staleTime:1/0}),Y=Re.data?.addresses??[],X=le??Y.filter((e,t)=>e.kind!==`website`||!Y.slice(0,t).some(e=>e.kind===`website`)).map(e=>e.url),ze=C.map(e=>e.trim()).filter(e=>ue(e)),Z=[...X,...ze],Be=!K&&Re.isSuccess&&Y.length===0,[Ve,He]=P(u,`anyway`,!1),Ue=b!==null||Be&&!ze.length&&!Ve,We=t({mutationFn:()=>n.put(`/api/studio/organization/profile`,{kind:V.kind,size:V.size,sector:V.sector.trim()||null,role:V.role,need:V.need.trim()||null,questions:(V.questions??``).trim()||null,phone:V.phone.trim()||null,website:Z.find(e=>de(e)===`website`)??null,links:Z})}),Ge=t({mutationFn:e=>n.put(`/api/studio/organization`,{name:e})}),Ke=()=>{W(`site`),o.invalidateQueries({queryKey:[`organization`]}),o.invalidateQueries({queryKey:[`me`]})},Q=t({mutationFn:e=>n.post(`/api/studio/spaces/${l?.id}/website`,{urls:e,lang:_}),onSuccess:async e=>{let t=e?.sectors?.[0];t&&Fe(e=>e.sector?e:{...e,sector:t}),De(e??{name:``,about:!1,colors:0,fonts:0,logo:!1,facts:0,assets:0}),await o.invalidateQueries({queryKey:i.spaces()})}}),qe=t({mutationFn:e=>n.patch(`/api/studio/spaces/${l?.id}`,{brand:{about:e}}),onSuccess:()=>o.invalidateQueries({queryKey:i.spaces()})}),$=t({mutationFn:()=>n.post(`/api/studio/onboarding/done`),onSuccess:async()=>{Oe(),await o.invalidateQueries({queryKey:[`me`]}),s(`/new`,{replace:!0})}}),Je=e.data?.user.name??``,Ye=Je.includes(`@`)?``:Je.split(` `)[0],Xe=p&&h?v(`onboard.kickerNew`,{organization:h}):Ye?v(`onboard.kicker1`,{name:Ye}):v(`onboard.kicker1Anon`),Ze=(e,t)=>q&&!K?v(e,{organization:q}):v(t),Qe=async e=>{if(e&&l){for(let t of Array.from(e)){I(e=>[...e,{name:t.name,state:`uploading`}]);try{await n.upload(`/api/studio/spaces/${l.id}/files?kind=document`,t),I(e=>e.map(e=>e.name===t.name?{...e,state:`done`}:e))}catch{I(e=>e.map(e=>e.name===t.name?{...e,state:`failed`}:e))}}await o.invalidateQueries({queryKey:i.spaces()})}},$e=M?[M.about?v(`onboard.readAbout`):``,M.colors?v(`onboard.readColors`,{n:M.colors}):``,M.fonts?v(`onboard.readFonts`,{n:M.fonts}):``,M.logo?v(`onboard.readLogo`):``,M.facts?v(`onboard.readFacts`,{n:M.facts}):``,M.assets?v(`onboard.readAssets`,{n:M.assets}):``].join(``):``,et=[...new Set([...M?.sectors??[],...fe(`${q??``} ${b??``} ${V.questions??``}`,4)])].slice(0,4),tt=e=>`${window.location.host}/studio/${je(e)}`;return(0,T.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-white sm:px-10`,style:{...me,background:pe},children:[(0,T.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,T.jsx)(_e,{}),(0,T.jsx)(se,{tone:`ground`,ink:E})]}),(0,T.jsxs)(`main`,{className:`mx-auto grid w-full max-w-6xl flex-1 items-center gap-10 py-10 lg:grid-cols-[5fr_7fr] lg:gap-12`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col items-center gap-8 max-lg:order-first`,children:[(0,T.jsx)(re,{kind:`drop`,size:240,fluffy:!0,coat:`fur`}),Pe?(0,T.jsxs)(`figure`,{className:`w-full max-w-sm rounded-[18px] bg-white/15 px-5 py-4`,children:[(0,T.jsx)(`figcaption`,{className:`font-medium text-[0.75rem] text-white/85 uppercase tracking-[0.14em]`,children:v(`onboard.wish`)}),(0,T.jsx)(`blockquote`,{className:`mt-1.5 line-clamp-6 whitespace-pre-line break-words text-[1rem] leading-relaxed`,children:Pe}),(0,T.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-white/75`,children:v(`onboard.wishNext`)})]}):null]}),(0,T.jsxs)(`div`,{className:`flex min-w-0 max-w-2xl animate-rise flex-col gap-5`,children:[U===`kind`?(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),V.kind&&W(V.kind===`personal`||h?`site`:`organization`)},children:[(0,T.jsx)(L,{children:Xe}),(0,T.jsx)(R,{children:v(`onboard.kind`)}),(0,T.jsx)(z,{children:p&&h?v(`onboard.kindSubOrganization`,{organization:h}):v(`onboard.kindSub`)}),B.kind?(0,T.jsx)(`p`,{className:`text-[0.9375rem] text-white/80`,children:v(`onboard.guess`,{domain:B.domain,kind:v(ve.find(e=>e.kind===B.kind)?.label??`onboard.kindSmall`)})}):null,(0,T.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:ve.map(e=>(0,T.jsx)(Ee,{picked:V.kind===e.kind,label:v(e.label),sub:v(e.sub),onClick:()=>G({kind:e.kind,size:e.kind===V.kind?V.size:null})},e.kind))}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{type:`submit`,children:v(`onboard.continue`)}),(0,T.jsx)(j,{step:1,total:m})]})]}):null,U===`organization`?(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault();let t=g.trim();t?Ge.mutate(t,{onSuccess:Ke}):W(`site`)},children:[(0,T.jsx)(L,{children:Xe}),(0,T.jsx)(R,{children:v(`onboard.organization`)}),(0,T.jsx)(z,{children:v(`onboard.organizationSub`)}),(0,T.jsx)(`input`,{value:g,onChange:e=>y(e.target.value),placeholder:v(`onboard.organizationPlaceholder`),maxLength:80,"aria-label":v(`onboard.organization`),className:ge}),g.trim()?(0,T.jsxs)(`p`,{className:`-mt-2 text-[0.9375rem] text-white/85`,children:[J&&g===J.name?`${v(`onboard.nameFrom`,{domain:new URL(J.url).host})} `:``,v(`onboard.address`),` `,(0,T.jsx)(`span`,{className:`font-mono text-[0.875rem]`,style:{color:D},children:tt(g)})]}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{type:`submit`,busy:Ge.isPending,children:v(`onboard.continue`)}),(0,T.jsx)(j,{step:1,total:m})]})]}):null,U===`site`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(L,{children:K?v(`onboard.kicker2Personal`):Ze(`onboard.kicker2Named`,`onboard.kicker2`)}),(0,T.jsx)(R,{children:K?v(`onboard.linksPersonal`):Be&&!Ve&&q?v(`onboard.noneFound`,{name:q}):q?v(`onboard.siteNamed`,{organization:q}):v(`onboard.site`)}),(0,T.jsx)(z,{children:K?v(`onboard.linksPersonalSub`):Be&&!Ve&&q?v(`onboard.noneFoundSub`,{name:q}):Re.isPending?v(`onboard.searching`,{name:q??``}):v(`onboard.foundSub`)}),Ue?(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault();let t=(b??``).trim();t?qe.mutate(t,{onSuccess:()=>W(`details`)}):W(`details`)},children:[(0,T.jsx)(ke,{value:b??``,onChange:x,rows:4,label:v(`onboard.line`),placeholder:v(K?`onboard.linePlaceholderPersonal`:`onboard.linePlaceholder`)}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>{x(null),He(!0),O(e=>e.length?e:[``])},className:`-mt-1 cursor-pointer self-start font-semibold text-[0.9375rem] text-white/85 hover:text-white`,children:[`+ `,v(`onboard.addressAfterAll`)]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{type:`submit`,busy:qe.isPending,children:v(`onboard.continue`)}),(0,T.jsx)(A,{onClick:()=>W(`details`),children:v(`onboard.skip`)}),(0,T.jsx)(j,{step:2,total:m})]})]}):(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),M?W(`details`):Z.length&&!Q.isPending&&Q.mutate(Z)},children:[Y.length?(0,T.jsx)(`div`,{className:`flex flex-col gap-2`,children:Y.map(e=>(0,T.jsx)(Ae,{address:e,picked:X.includes(e.url),onToggle:()=>S(X.includes(e.url)?X.filter(t=>t!==e.url):[...X,e.url])},e.url))}):null,!K&&Y.length?(0,T.jsx)(`p`,{className:`-mb-2 text-[0.9375rem] text-white/85`,children:v(`onboard.own`)}):null,C.map((e,t)=>(0,T.jsxs)(`div`,{className:`relative`,children:[(0,T.jsx)(`input`,{value:e,onChange:e=>O(n=>n.map((n,r)=>r===t?e.target.value:n)),placeholder:v(K?`onboard.linkPlaceholderPersonal`:`onboard.ownPlaceholder`),autoCapitalize:`none`,"aria-label":v(`onboard.own`),className:d(Te,`pr-28`)}),ue(e)?(0,T.jsx)(`span`,{className:`-translate-y-1/2 absolute top-1/2 right-3 rounded-full bg-white/20 px-2.5 py-0.5 font-semibold text-[0.75rem]`,children:ce[de(e)]}):null]},t)),C.length+Y.length<10?(0,T.jsxs)(`button`,{type:`button`,onClick:()=>O(e=>[...e,``]),className:`-mt-1 cursor-pointer self-start font-semibold text-[0.9375rem] text-white/85 hover:text-white`,children:[`+ `,v(`onboard.addAddress`)]}):null,M?(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.9375rem] text-(color:--moss)`,children:[(0,T.jsx)(f,{className:`size-4`}),M.name?v(`onboard.readDone`,{name:M.name,details:$e}):v(`onboard.readKept`,{n:Z.length})]}):Q.isError?(0,T.jsx)(`p`,{className:`text-[0.9375rem] text-(color:--rose)`,children:v(`onboard.readFailed`)}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[M?(0,T.jsx)(k,{type:`submit`,children:v(`onboard.continue`)}):(0,T.jsx)(k,{type:`submit`,busy:Q.isPending,children:Q.isPending?v(`onboard.reading`):v(`onboard.read`)}),(0,T.jsx)(A,{onClick:()=>x(``),children:v(`onboard.line`)}),(0,T.jsx)(A,{onClick:()=>W(`details`),children:v(`onboard.skip`)}),(0,T.jsx)(j,{step:2,total:m})]})]})]}):null,U===`details`&&V.kind?(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),We.mutate(),W(`know`)},children:[(0,T.jsx)(L,{children:K||!q?Xe:q}),(0,T.jsx)(R,{small:!0,children:K?v(`onboard.personalTitle`):q?v(`onboard.aboutOrganization`,{organization:q}):v(V.kind===`club`?`onboard.clubTitle`:`onboard.businessTitle`)}),K?(0,T.jsx)(ke,{value:V.need,onChange:e=>G({need:e}),rows:4,label:v(`onboard.personalTitle`),placeholder:v(`onboard.personalPlaceholder`)}):null,V.kind===`club`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(N,{label:v(`onboard.clubKind`),options:Se,value:V.sector,text:e=>v(`onboard.club.${e}`),onChange:e=>G({sector:e})}),(0,T.jsx)(N,{label:v(`onboard.members`),options:be.club,value:V.size,text:xe,onChange:e=>G({size:e})}),(0,T.jsx)(N,{label:v(`onboard.yourRole`),options:Ce,value:V.role,text:e=>v(`onboard.role.${e}`),onChange:e=>G({role:e})})]}):null,V.kind===`small`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(N,{label:v(`onboard.people`),options:be.small,value:V.size,text:xe,onChange:e=>G({size:e})}),(0,T.jsx)(Ne,{value:V.sector,onChange:e=>G({sector:e}),suggested:et})]}):null,V.kind===`corp`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(N,{label:v(`onboard.people`),options:be.corp,value:V.size,text:xe,onChange:e=>G({size:e})}),(0,T.jsx)(Ne,{value:V.sector,onChange:e=>G({sector:e}),suggested:et}),(0,T.jsx)(N,{label:v(`onboard.yourRole`),options:we,value:V.role,text:e=>v(`onboard.role.${e}`),onChange:e=>G({role:e})}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-2 text-[0.9375rem] text-white/85`,children:[(0,T.jsxs)(`span`,{children:[v(`onboard.phone`),` `,(0,T.jsx)(`span`,{className:`text-white/60`,children:v(`onboard.phoneWhy`)})]}),(0,T.jsx)(`input`,{type:`tel`,value:V.phone,onChange:e=>G({phone:e.target.value.replace(/[^+0-9 ()/.-]/g,``)}),placeholder:`+43 …`,maxLength:40,autoComplete:`tel`,className:Te})]})]}):null,K?null:(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`span`,{className:`text-[0.9375rem] text-white/85`,children:[v(`onboard.questions`),` `,(0,T.jsx)(`span`,{className:`text-white/60`,children:v(`onboard.optional`)})]}),(0,T.jsx)(ke,{value:V.questions??``,onChange:e=>G({questions:e}),rows:3,label:v(`onboard.questions`),placeholder:v(`onboard.questionsPlaceholder`)}),(0,T.jsx)(`span`,{className:`text-[0.8125rem] text-white/70`,children:v(`onboard.questionsHint`)})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{type:`submit`,busy:We.isPending,children:v(`onboard.continue`)}),(0,T.jsx)(A,{onClick:()=>window.history.state?.idx>0?s(-1):W(`site`),children:v(`onboard.back`)}),(0,T.jsx)(j,{step:3,total:m})]})]}):null,U===`know`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(L,{children:Ze(`onboard.kicker3Named`,`onboard.kicker3`)}),(0,T.jsx)(R,{children:v(`onboard.know`)}),(0,T.jsx)(z,{children:v(`onboard.knowSub`)}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>Me.current?.click(),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),Qe(e.dataTransfer.files)},className:`flex cursor-pointer flex-col items-center gap-2 rounded-[18px] border-2 border-white/45 border-dashed bg-white/10 px-6 py-7 text-center transition hover:bg-white/15`,children:[(0,T.jsx)(ne,{className:`size-7`}),(0,T.jsx)(`span`,{className:`font-semibold text-[1.0625rem]`,children:v(`onboard.drop`)}),(0,T.jsx)(`span`,{className:`text-[0.875rem] text-white/80`,children:`PDF · Word · Excel · Markdown`}),(0,T.jsx)(`input`,{ref:Me,type:`file`,multiple:!0,className:`sr-only`,onChange:e=>{Qe(e.target.files),e.target.value=``}})]}),F.length?(0,T.jsx)(`ul`,{className:`flex flex-col gap-2`,children:F.map(e=>(0,T.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-xl bg-white/15 px-3.5 py-2.5 text-[0.875rem]`,children:[(0,T.jsx)(te,{className:`size-4 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,T.jsx)(`span`,{className:d(`text-white/80`,e.state===`failed`?`text-(color:--rose)`:``),children:e.state===`uploading`?v(`onboard.uploading`):e.state===`done`?v(`onboard.uploaded`):v(`onboard.uploadFailed`)})]},e.name))}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{busy:F.some(e=>e.state===`uploading`)||$.isPending,onClick:()=>p?$.mutate():W(`space`),children:v(p?`onboard.buildFirst`:`onboard.continue`)}),F.length||p?null:(0,T.jsx)(A,{onClick:()=>W(`space`),children:v(`onboard.skip`)}),(0,T.jsx)(j,{step:4,total:m})]})]}):null,U===`space`&&!p?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(L,{children:Ze(`onboard.kicker4Named`,`onboard.kicker4`)}),(0,T.jsx)(R,{children:q&&!K?v(`onboard.spaceNamed`,{organization:q}):v(`onboard.space`)}),(0,T.jsx)(z,{children:v(`onboard.spaceSub`,{space:l?.name??``})}),(0,T.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[[`partInfo`,`partInfoText`,!!(M||b)],[`partKnow`,`partKnowText`,F.some(e=>e.state===`done`)],[`partData`,`partDataText`,!1],[`partResults`,`partResultsText`,!1]].map(([e,t,n])=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-2xl border border-white/20 bg-white/10 px-4.5 py-4`,children:[(0,T.jsxs)(`span`,{className:`flex items-center gap-2 font-semibold text-[1rem]`,children:[n?(0,T.jsx)(f,{className:`size-4 text-(color:--moss)`}):null,v(`onboard.${e}`)]}),(0,T.jsx)(`span`,{className:`text-[0.84375rem] text-white/85 leading-snug`,children:v(`onboard.${t}`)})]},e))}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{busy:$.isPending,onClick:()=>$.mutate(),children:v(`onboard.build`)}),(0,T.jsx)(j,{step:5,total:m})]})]}):null]},U)]}),(0,T.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between pb-6 text-[0.75rem] text-white/55 sm:pb-8`,children:[(0,T.jsx)(`span`,{children:`engenty.wizards`}),(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px] bg-(color:--dot)`})]})]})}function L({children:e}){return(0,T.jsx)(`p`,{className:`font-medium text-[0.75rem] text-white/85 uppercase tracking-[0.14em]`,children:e})}function R({children:e,small:t}){return(0,T.jsx)(`h1`,{className:d(`font-display font-bold leading-[1.05] tracking-[-0.02em]`,t?`text-[2.25rem] sm:text-[2.75rem]`:`text-[2.5rem] sm:text-[3.25rem]`),children:e})}function z({children:e}){return(0,T.jsx)(`p`,{className:`text-[1.0625rem] text-white/90 leading-relaxed`,children:e})}function ke({value:e,onChange:t,rows:n,label:r,placeholder:i}){let[a]=s(),o=l(e,t,{deviceId:a.deviceId});return(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[18px] border border-white/30 bg-white/15 px-4 pt-3 pb-3 focus-within:border-white/60`,children:[(0,T.jsx)(`textarea`,{value:e,onChange:e=>t(e.target.value),placeholder:o.listening?v(`editor.listening`):i,rows:n,maxLength:4e3,"aria-label":r,className:`w-full resize-none bg-transparent text-[1.0625rem] text-white leading-relaxed outline-none placeholder:text-white/55`}),o.supported?(0,T.jsx)(`div`,{className:`self-end`,style:{"--ink":`white`,"--border":`rgb(255 255 255 / 0.55)`},children:(0,T.jsx)(u,{speech:o,labelled:!0})}):null]})}function Ae({address:e,picked:t,onToggle:n}){return(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":t,onClick:n,className:d(`flex cursor-pointer items-center gap-3.5 rounded-[14px] border px-4 py-2.5 text-left transition`,t?`border-white bg-white/22`:`border-white/30 bg-white/8 hover:bg-white/12`),children:[(0,T.jsx)(`span`,{className:d(`flex size-5 shrink-0 items-center justify-center rounded-md border-2`,t?`border-white bg-white`:`border-white/60`),style:t?{color:E}:void 0,children:t?(0,T.jsx)(f,{className:`size-3.5`,strokeWidth:3}):null}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-[0.6875rem] text-white/70 uppercase tracking-[0.1em]`,children:ce[e.kind]}),(0,T.jsx)(`span`,{className:`truncate font-mono text-[0.9375rem]`,children:e.url.replace(/^https?:\/\/(www\.)?/,``).replace(/\/$/,``)}),(0,T.jsx)(`span`,{className:`truncate text-[0.8125rem] text-white/80`,children:e.title})]}),(0,T.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-white/70 max-sm:hidden`,children:v(e.source===`email`?`onboard.fromEmail`:`onboard.fromWeb`)})]})}function je(e){return e.toLowerCase().replace(/['’]/g,``).replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFKD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,35).replace(/-+$/,``)}function Me(){let e=ie(),i=ee(),o=a(),s=y(),c=e.data?.tenant,l=r({queryKey:[`organization`,c?.id],queryFn:()=>n.get(`/api/studio/organization`),enabled:!!c}),u=t({mutationFn:()=>n.post(`/api/studio/onboarding/done`),onSuccess:async()=>{await i.invalidateQueries({queryKey:[`me`]}),o(`/`,{replace:!0})}});if(!(e.data&&c))return null;let d=c.name??``,te=e.data.user.name,f=te.includes(`@`)?``:te.split(` `)[0],ne=e.data.organizations.find(e=>e.id===c.id)?.invitedBy?.name,p=l.data?.members.find(t=>t.role===`owner`&&t.userId!==e.data?.user.id)?.name,m=c.role!==`member`,h=c.slug?`${window.location.host}/studio/${c.slug}`:null;return(0,T.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-white sm:px-10`,style:{...me,background:pe},children:[(0,T.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,T.jsx)(_e,{}),(0,T.jsx)(se,{tone:`ground`,ink:E})]}),(0,T.jsxs)(`main`,{className:`mx-auto grid w-full max-w-6xl flex-1 items-center gap-10 py-10 lg:grid-cols-[5fr_7fr] lg:gap-12`,children:[(0,T.jsx)(`div`,{className:`flex flex-col items-center gap-8 max-lg:order-first`,children:(0,T.jsx)(re,{kind:`drop`,size:240,fluffy:!0,coat:`fur`})}),(0,T.jsxs)(`div`,{className:`flex min-w-0 max-w-2xl animate-rise flex-col gap-5`,children:[(0,T.jsx)(`p`,{className:`font-medium text-[0.75rem] text-white/85 uppercase tracking-[0.14em]`,children:f?v(`onboard.kicker1`,{name:f}):v(`onboard.kicker1Anon`)}),(0,T.jsx)(`h1`,{className:`font-display font-bold text-[2.5rem] leading-[1.05] tracking-[-0.02em] sm:text-[3.25rem]`,children:v(`welcome.title`,{organization:d})}),(0,T.jsx)(`p`,{className:`text-[1.0625rem] text-white/90 leading-relaxed`,children:ne?v(`welcome.invited`,{name:ne}):p?v(`welcome.setUp`,{name:p,organization:d}):v(`welcome.plain`)}),(0,T.jsxs)(`div`,{className:`overflow-hidden rounded-[18px] bg-white/12 ring-1 ring-white/20`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3.5 px-4.5 py-3.5`,children:[(0,T.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl font-bold font-display`,style:{background:D,color:E},children:b(d)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,T.jsx)(`span`,{className:`truncate font-semibold text-[1.0625rem]`,children:d}),h?(0,T.jsx)(`span`,{className:`truncate font-mono text-[0.8125rem] text-white/75`,children:h}):null]}),(0,T.jsx)(`span`,{className:`rounded-full bg-white/20 px-2.5 py-1 font-semibold text-[0.75rem]`,children:v(`organization.role.${c.role}`)})]}),s.data?.some(e=>e.wizardCount>0)?s.data.map(e=>(0,T.jsxs)(`div`,{className:`flex justify-between gap-3 border-white/15 border-t px-4.5 py-2.5 text-[0.9375rem]`,children:[(0,T.jsx)(`span`,{className:`truncate`,children:e.name}),(0,T.jsx)(`span`,{className:`shrink-0 text-white/75`,children:v(`welcome.wizards`,{n:e.wizardCount})})]},e.id)):(0,T.jsx)(`p`,{className:`border-white/15 border-t px-4.5 py-3 text-[0.9375rem] text-white/80`,children:v(`welcome.noWizards`)})]}),(0,T.jsx)(`p`,{className:`text-[0.9375rem] text-white/80`,children:v(m?`welcome.canBuild`:`welcome.canMember`)}),(0,T.jsx)(`div`,{className:`flex flex-wrap items-center gap-5`,children:(0,T.jsx)(k,{busy:u.isPending,onClick:()=>u.mutate(),children:v(`welcome.go`)})})]})]})]})}function Ne({value:e,onChange:t,suggested:n}){let[r,i]=(0,w.useState)(!1),a=C(e),o=[...new Set([...a?[a.id]:[],...n])].slice(0,4),s=e=>C(e)?.name[_===`de`?`de`:`en`]??e;return(0,T.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,T.jsx)(`legend`,{className:`mb-2 text-[0.9375rem] text-white/85`,children:v(`onboard.sector`)}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[o.map(n=>(0,T.jsx)(`button`,{type:`button`,"aria-pressed":e===n,onClick:()=>t(n),className:d(`cursor-pointer rounded-full border px-4 py-2 text-[0.9375rem] transition`,e===n?`border-white bg-white`:`border-white/30 hover:bg-white/15`),style:e===n?{color:E}:void 0,children:s(n)},n)),(0,T.jsx)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>i(e=>!e),className:`cursor-pointer rounded-full border border-white/40 border-dashed px-4 py-2 text-[0.9375rem] hover:bg-white/15`,children:v(`onboard.sectorOther`)})]}),r?(0,T.jsxs)(`select`,{value:a?e:``,onChange:e=>{t(e.target.value),i(!1)},"aria-label":v(`onboard.sector`),className:d(Te,`[&>option]:text-black`),children:[(0,T.jsx)(`option`,{value:``,children:v(`onboard.sectorPick`)}),[...S].sort((e,t)=>s(e.id).localeCompare(s(t.id),_)).map(e=>(0,T.jsx)(`option`,{value:e.id,children:s(e.id)},e.id))]}):null,a?(0,T.jsxs)(`span`,{className:`text-[0.8125rem] text-white/75`,children:[v(`onboard.sectorHint`),` `,(0,T.jsx)(`b`,{style:{color:D},children:v(`onboard.catalog`,{sector:s(a.id)})})]}):null]})}export{F as OnboardingPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./useMutation-BSffqL6W.js";import{$ as n,Sr as r,Z as i,br as a,cr as o,m as s,mr as c,ni as ee,p as l,s as u,xn as d}from"./ui-DkEhb2Rt.js";import{s as te,u as f}from"./marked.esm-BfGIZK7F.js";import{t as ne}from"./upload-BZThm-R6.js";import{n as p,t as m}from"./jsx-runtime-C3cWAN_r.js";import{c as h,n as re}from"./brand-BIT7AumL.js";import{t as g}from"./logo-xL-sneZz.js";import{n as _,s as v}from"./i18n-WXeVnv7i.js";import{_ as y,h as ie,i as ae,n as b,u as oe}from"./session-RDdtfee2.js";import{r as se}from"./LangSwitch-BLB7dDce.js";var x=new Set([`gmail.com`,`googlemail.com`,`gmx.at`,`gmx.de`,`gmx.net`,`web.de`,`outlook.com`,`hotmail.com`,`live.com`,`icloud.com`,`me.com`,`yahoo.com`,`yahoo.de`,`aon.at`,`a1.net`,`chello.at`,`t-online.de`,`proton.me`,`protonmail.com`]),ce={website:`Website`,blog:`Blog`,linkedin:`LinkedIn`,instagram:`Instagram`,facebook:`Facebook`,youtube:`YouTube`,x:`X`,xing:`XING`,tiktok:`TikTok`},le=[[`linkedin`,/(^|\.)linkedin\.com$/],[`instagram`,/(^|\.)instagram\.com$/],[`facebook`,/(^|\.)(facebook|fb)\.com$/],[`youtube`,/(^|\.)(youtube\.com|youtu\.be)$/],[`x`,/(^|\.)(x|twitter)\.com$/],[`xing`,/(^|\.)xing\.com$/],[`tiktok`,/(^|\.)tiktok\.com$/]];function ue(e){let t=e.trim();if(!t||/\s/.test(t))return null;try{let e=new URL(/^https?:\/\//i.test(t)?t:`https://${t}`);return e.hostname.includes(`.`)?e.href:null}catch{return null}}function de(e){let t=ue(e);if(!t)return`website`;let{hostname:n,pathname:r}=new URL(t),i=n.toLowerCase().replace(/^www\./,``);for(let[e,t]of le)if(t.test(i))return e;return/^blog\./.test(i)||/^\/blog(\/|$)/.test(r)||/(^|\.)(medium|substack)\.com$/.test(i)?`blog`:`website`}var S=[{id:`bakeries`,industry:`gastronomy`,name:{de:`Bäckereien`,en:`Bakeries`},words:[`bäckerei`,`bäcker`,`backstube`,`brot`,`gebäck`,`konditorei`,`bakery`,`bread`,`pastry`]},{id:`cafes`,industry:`gastronomy`,name:{de:`Cafés`,en:`Cafés`},words:[`café`,`cafe`,`kaffeehaus`,`kaffee`,`coffee`,`espresso`]},{id:`restaurants`,industry:`gastronomy`,name:{de:`Restaurants`,en:`Restaurants`},words:[`restaurant`,`gasthaus`,`gasthof`,`wirtshaus`,`pizzeria`,`küche`,`speisekarte`,`menu`,`bistro`]},{id:`hotels`,industry:`hospitality`,name:{de:`Hotels und Pensionen`,en:`Hotels and guesthouses`},words:[`hotel`,`pension`,`zimmer`,`übernachtung`,`ferienwohnung`,`guesthouse`,`booking`,`rooms`]},{id:`architects`,industry:`professional`,name:{de:`Architekturbüros`,en:`Architects`},words:[`architekt`,`architektur`,`planung`,`entwurf`,`architect`,`architecture`]},{id:`lawFirms`,industry:`professional`,name:{de:`Kanzleien`,en:`Law firms`},words:[`rechtsanwalt`,`anwalt`,`kanzlei`,`recht`,`notar`,`law firm`,`lawyer`,`attorney`,`legal`]},{id:`taxAdvisors`,industry:`professional`,name:{de:`Steuerberatung`,en:`Tax advisors`},words:[`steuerberatung`,`steuerberater`,`steuer`,`buchhaltung`,`lohnverrechnung`,`bilanz`,`tax`,`accounting`,`bookkeeping`]},{id:`consultants`,industry:`professional`,name:{de:`Beratung`,en:`Consultants`},words:[`beratung`,`berater`,`consulting`,`coaching`,`consultant`]},{id:`physiotherapy`,industry:`health`,name:{de:`Physiotherapie`,en:`Physiotherapy`},words:[`physiotherapie`,`physio`,`massage`,`therapie`,`physiotherapy`]},{id:`practices`,industry:`health`,name:{de:`Arztpraxen`,en:`Doctors’ practices`},words:[`arzt`,`ärztin`,`praxis`,`ordination`,`zahnarzt`,`doctor`,`clinic`,`dentist`]},{id:`hairdressers`,industry:`retail`,name:{de:`Friseur und Kosmetik`,en:`Hair and beauty`},words:[`friseur`,`frisör`,`kosmetik`,`nagelstudio`,`beauty`,`hairdresser`,`salon`]},{id:`joiners`,industry:`trades`,name:{de:`Tischlereien`,en:`Joiners`},words:[`tischlerei`,`tischler`,`schreiner`,`möbel`,`holz`,`joinery`,`carpenter`,`furniture`]},{id:`electricians`,industry:`trades`,name:{de:`Elektrotechnik`,en:`Electricians`},words:[`elektriker`,`elektro`,`elektrotechnik`,`photovoltaik`,`electrician`,`electrical`]},{id:`plumbing`,industry:`trades`,name:{de:`Installateure`,en:`Plumbing and heating`},words:[`installateur`,`sanitär`,`heizung`,`klima`,`plumber`,`plumbing`,`heating`]},{id:`windows`,industry:`trades`,name:{de:`Fensterbau`,en:`Window makers`},words:[`fenster`,`türen`,`fensterbau`,`sonnenschutz`,`windows`,`doors`]},{id:`construction`,industry:`trades`,name:{de:`Bau und Handwerk`,en:`Building and trades`},words:[`bau`,`baumeister`,`maler`,`dachdecker`,`handwerk`,`construction`,`builder`,`painter`,`roofer`]},{id:`realEstate`,industry:`realEstate`,name:{de:`Immobilien`,en:`Real estate`},words:[`immobilien`,`makler`,`wohnung`,`miete`,`hausverwaltung`,`real estate`,`property`,`estate agent`]},{id:`onlineShops`,industry:`retail`,name:{de:`Online-Shops`,en:`Online shops`},words:[`online-shop`,`onlineshop`,`shop`,`versand`,`e-commerce`,`webshop`,`online store`]},{id:`retail`,industry:`retail`,name:{de:`Handel`,en:`Retail`},words:[`geschäft`,`handel`,`laden`,`boutique`,`retail`,`store`]},{id:`agencies`,industry:`agency`,name:{de:`Agenturen`,en:`Agencies`},words:[`agentur`,`werbung`,`marketing`,`design`,`kommunikation`,`agency`,`advertising`,`branding`]},{id:`photographers`,industry:`agency`,name:{de:`Fotografie`,en:`Photographers`},words:[`fotograf`,`fotografie`,`foto`,`photographer`,`photography`]},{id:`events`,industry:`events`,name:{de:`Veranstaltungen`,en:`Events`},words:[`event`,`veranstaltung`,`hochzeit`,`catering`,`konferenz`,`wedding`,`conference`]},{id:`itServices`,industry:`professional`,name:{de:`IT-Dienstleister`,en:`IT services`},words:[`it-dienstleister`,`it-service`,`software`,`webentwicklung`,`hosting`,`netzwerk`,`development`,`web design`]},{id:`cleaning`,industry:`trades`,name:{de:`Reinigung`,en:`Cleaning`},words:[`reinigung`,`gebäudereinigung`,`putz`,`cleaning`,`janitorial`]},{id:`footballClubs`,industry:`any`,name:{de:`Fußballvereine`,en:`Football clubs`},words:[`fußball`,`fussball`,`fc`,`sv`,`kicker`,`football`,`soccer`]},{id:`sportsClubs`,industry:`any`,name:{de:`Sportvereine`,en:`Sports clubs`},words:[`sportverein`,`verein`,`turnen`,`tennis`,`laufen`,`sport`,`club`]},{id:`musicClubs`,industry:`events`,name:{de:`Musikvereine und Chöre`,en:`Music clubs and choirs`},words:[`musikverein`,`blasmusik`,`chor`,`kapelle`,`orchester`,`band`,`choir`,`music`]},{id:`fireBrigades`,industry:`publicSector`,name:{de:`Feuerwehren`,en:`Fire brigades`},words:[`feuerwehr`,`rettung`,`rotes kreuz`,`fire brigade`,`rescue`]},{id:`schools`,industry:`publicSector`,name:{de:`Schulen und Bildung`,en:`Schools and education`},words:[`schule`,`kurs`,`weiterbildung`,`akademie`,`nachhilfe`,`school`,`course`,`training`]},{id:`municipalities`,industry:`publicSector`,name:{de:`Gemeinden`,en:`Municipalities`},words:[`gemeinde`,`stadt`,`bürgerservice`,`amt`,`municipality`,`council`,`town`]},{id:`associations`,industry:`any`,name:{de:`Vereine und Initiativen`,en:`Associations`},words:[`verein`,`initiative`,`ehrenamt`,`verband`,`association`,`nonprofit`,`charity`]}],C=e=>S.find(t=>t.id===e)??null;function fe(e,t=3){let n=` ${e.toLowerCase().normalize(`NFC`).replace(/[^\p{L}\p{N}-]+/gu,` `)} `;return S.map(e=>({id:e.id,score:e.words.reduce((e,t)=>e+(n.includes(` ${t}`)?Math.min(3,t.length/4):0),0)})).filter(e=>e.score>0).sort((e,t)=>t.score-e.score).slice(0,t).map(e=>e.id)}var w=e(p(),1),T=e(m(),1),pe=`oklch(50% 0.2 262)`,E=`oklch(32% 0.15 262)`,D=`oklch(90% 0.1 80)`,me={"--on":`white`,"--dot":D,"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},O={kind:1,organization:1,site:2,details:3,know:4,space:5},he=e=>e!==null&&Object.hasOwn(O,e),ge=`w-full rounded-[18px] border border-white/30 bg-white/15 px-6 py-5 text-[1.375rem] text-white outline-none placeholder:text-white/55 focus:border-white/60`;function _e(){return(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,T.jsx)(g,{size:28}),(0,T.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight`,children:[`engenty`,(0,T.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-(color:--dot)`,children:`.`}),(0,T.jsx)(`span`,{className:`font-normal text-white/70`,children:`wizards`})]})]})}function k({children:e,busy:t,onClick:n,type:r=`button`}){return(0,T.jsxs)(`button`,{type:r,disabled:t,onClick:n,className:`inline-flex h-13 cursor-pointer items-center gap-2.5 rounded-full bg-white px-7 font-semibold text-[1rem] transition hover:bg-white/90 disabled:cursor-default disabled:opacity-70`,style:{color:E},children:[e,(0,T.jsx)(o,{className:`size-[18px]`})]})}function A({children:e,onClick:t}){return(0,T.jsx)(`button`,{type:`button`,onClick:t,className:`cursor-pointer font-semibold text-[0.9375rem] text-white/85 transition hover:text-white`,children:e})}function j({step:e,total:t=4}){return(0,T.jsx)(`span`,{className:`ml-auto inline-flex gap-1.5`,role:`img`,"aria-label":v(`onboard.step`,{n:e,total:t}),children:Array.from({length:t},(e,t)=>t+1).map(t=>(0,T.jsx)(`span`,{className:d(`size-2 rounded-full`,t===e?`bg-white`:`bg-white/40`)},t))})}var ve=[{kind:`personal`,label:`onboard.kindPersonal`,sub:`onboard.kindPersonalSub`},{kind:`club`,label:`onboard.kindClub`,sub:`onboard.kindClubSub`},{kind:`small`,label:`onboard.kindSmall`,sub:`onboard.kindSmallSub`},{kind:`corp`,label:`onboard.kindCorp`,sub:`onboard.kindCorpSub`}];function ye(e){let t=(e.split(`@`)[1]??``).trim().toLowerCase();return t?x.has(t)?{kind:`personal`,domain:t}:/(verein|club|klub|^sv-|^fc-|^ff-|feuerwehr|musik|chor)/.test(t)?{kind:`club`,domain:t}:{kind:`small`,domain:t}:{kind:null,domain:t}}var be={club:[`0-50`,`50-250`,`250-1000`,`1000+`],small:[`1`,`2-9`,`10-49`],corp:[`50-249`,`250-999`,`1000+`]},M=e=>Number(e).toLocaleString(_),xe=e=>{if(e===`1`)return v(`onboard.justMe`);if(e.endsWith(`+`))return`${M(e.slice(0,-1))}+`;let[t,n]=e.split(`-`);return t===`0`?`≤ ${M(n)}`:`${M(t)}–${M(n)}`},Se=[`sport`,`culture`,`social`,`education`,`environment`,`rescue`,`other`],Ce=[`chair`,`board`,`treasurer`,`secretary`,`member`],we=[`management`,`it`,`marketing`,`sales`,`operations`,`other`],Te=`w-full rounded-[14px] border border-white/30 bg-white/15 px-4 py-3 text-[1.0625rem] text-white outline-none placeholder:text-white/55 focus:border-white/60`;function Ee({picked:e,label:t,sub:n,onClick:r}){return(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":e,onClick:r,className:d(`flex cursor-pointer flex-col gap-1 rounded-[18px] border px-5 py-4 text-left transition`,e?`border-white bg-white/25`:`border-white/30 bg-white/10 hover:bg-white/15`),children:[(0,T.jsx)(`span`,{className:`font-display font-semibold text-[1.125rem]`,children:t}),(0,T.jsx)(`span`,{className:`text-[0.875rem] text-white/80`,children:n})]})}function N({label:e,options:t,value:n,text:r,onChange:i}){return(0,T.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,T.jsx)(`legend`,{className:`mb-2 text-[0.9375rem] text-white/85`,children:e}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.map(e=>(0,T.jsx)(`button`,{type:`button`,"aria-pressed":n===e,onClick:()=>i(e),className:d(`cursor-pointer rounded-full border px-4 py-2 text-[0.9375rem] transition`,n===e?`border-white bg-white`:`border-white/30 hover:bg-white/15`),style:n===e?{color:E}:void 0,children:r(e)},e))})]})}function P(e,t,n){let r=`${De}${e}:${t}`,[i,a]=(0,w.useState)(()=>{try{let e=sessionStorage.getItem(r);return e===null?n:JSON.parse(e)}catch{return n}});return(0,w.useEffect)(()=>{try{sessionStorage.setItem(r,JSON.stringify(i))}catch{}},[r,i]),[i,a]}var De=`wizards.onboarding:`;function Oe(){try{for(let e of Object.keys(sessionStorage))e.startsWith(De)&&sessionStorage.removeItem(e)}catch{}}function F(){return h(pe),ie().data?.onboarding===`welcome`?(0,T.jsx)(Me,{}):(0,T.jsx)(I,{})}function I(){let e=ie(),o=ee(),s=a(),{space:l}=oe(),u=e.data?.user.id??``,p=e.data?.onboarding===`organization`,m=p?4:5,h=e.data?.startingName?null:e.data?.tenant.name??null,[g,y]=P(u,`organization`,``),[b,x]=P(u,`line`,null),[le,S]=P(u,`ticked`,null),[C,O]=P(u,`own`,[``]),[M,De]=(0,w.useState)(null),[F,I]=(0,w.useState)([]),Me=(0,w.useRef)(null),[Pe]=(0,w.useState)(ae),[B]=(0,w.useState)(()=>p?{kind:null,domain:``}:ye(e.data?.user.email??``)),[V,Fe]=P(u,`profile`,{kind:B.kind,size:null,sector:``,role:null,need:``,questions:``,phone:``}),[Ie,Le]=c(),H=Ie.get(`page`),U=he(H)&&(H===`kind`||V.kind)&&!(p&&H===`space`)?H:`kind`,W=e=>Le(t=>{let n=new URLSearchParams(t);return n.set(`page`,e),n}),G=e=>Fe(t=>({...t,...e})),K=V.kind===`personal`,q=h??(g.trim()||null),J=r({queryKey:[`onboarding`,`suggest`],queryFn:()=>n.get(`/api/studio/onboarding/suggest`),enabled:!p&&!h&&!!V.kind&&!K,staleTime:1/0}).data?.site??null;(0,w.useEffect)(()=>{J&&!g&&y(J.name)},[J,g,y]);let Re=r({queryKey:[`onboarding`,`find`,q],queryFn:()=>n.post(`/api/studio/onboarding/find`,{name:q,lang:_}),enabled:U===`site`&&!K&&!!q,staleTime:1/0}),Y=Re.data?.addresses??[],X=le??Y.filter((e,t)=>e.kind!==`website`||!Y.slice(0,t).some(e=>e.kind===`website`)).map(e=>e.url),ze=C.map(e=>e.trim()).filter(e=>ue(e)),Z=[...X,...ze],Be=!K&&Re.isSuccess&&Y.length===0,[Ve,He]=P(u,`anyway`,!1),Ue=b!==null||Be&&!ze.length&&!Ve,We=t({mutationFn:()=>n.put(`/api/studio/organization/profile`,{kind:V.kind,size:V.size,sector:V.sector.trim()||null,role:V.role,need:V.need.trim()||null,questions:(V.questions??``).trim()||null,phone:V.phone.trim()||null,website:Z.find(e=>de(e)===`website`)??null,links:Z})}),Ge=t({mutationFn:e=>n.put(`/api/studio/organization`,{name:e})}),Ke=()=>{W(`site`),o.invalidateQueries({queryKey:[`organization`]}),o.invalidateQueries({queryKey:[`me`]})},Q=t({mutationFn:e=>n.post(`/api/studio/spaces/${l?.id}/website`,{urls:e,lang:_}),onSuccess:async e=>{let t=e?.sectors?.[0];t&&Fe(e=>e.sector?e:{...e,sector:t}),De(e??{name:``,about:!1,colors:0,fonts:0,logo:!1,facts:0,assets:0}),await o.invalidateQueries({queryKey:i.spaces()})}}),qe=t({mutationFn:e=>n.patch(`/api/studio/spaces/${l?.id}`,{brand:{about:e}}),onSuccess:()=>o.invalidateQueries({queryKey:i.spaces()})}),$=t({mutationFn:()=>n.post(`/api/studio/onboarding/done`),onSuccess:async()=>{Oe(),await o.invalidateQueries({queryKey:[`me`]}),s(`/new`,{replace:!0})}}),Je=e.data?.user.name??``,Ye=Je.includes(`@`)?``:Je.split(` `)[0],Xe=p&&h?v(`onboard.kickerNew`,{organization:h}):Ye?v(`onboard.kicker1`,{name:Ye}):v(`onboard.kicker1Anon`),Ze=(e,t)=>q&&!K?v(e,{organization:q}):v(t),Qe=async e=>{if(e&&l){for(let t of Array.from(e)){I(e=>[...e,{name:t.name,state:`uploading`}]);try{await n.upload(`/api/studio/spaces/${l.id}/files?kind=document`,t),I(e=>e.map(e=>e.name===t.name?{...e,state:`done`}:e))}catch{I(e=>e.map(e=>e.name===t.name?{...e,state:`failed`}:e))}}await o.invalidateQueries({queryKey:i.spaces()})}},$e=M?[M.about?v(`onboard.readAbout`):``,M.colors?v(`onboard.readColors`,{n:M.colors}):``,M.fonts?v(`onboard.readFonts`,{n:M.fonts}):``,M.logo?v(`onboard.readLogo`):``,M.facts?v(`onboard.readFacts`,{n:M.facts}):``,M.assets?v(`onboard.readAssets`,{n:M.assets}):``].join(``):``,et=[...new Set([...M?.sectors??[],...fe(`${q??``} ${b??``} ${V.questions??``}`,4)])].slice(0,4),tt=e=>`${window.location.host}/studio/${je(e)}`;return(0,T.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-white sm:px-10`,style:{...me,background:pe},children:[(0,T.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,T.jsx)(_e,{}),(0,T.jsx)(se,{tone:`ground`,ink:E})]}),(0,T.jsxs)(`main`,{className:`mx-auto grid w-full max-w-6xl flex-1 items-center gap-10 py-10 lg:grid-cols-[5fr_7fr] lg:gap-12`,children:[(0,T.jsxs)(`div`,{className:`flex flex-col items-center gap-8 max-lg:order-first`,children:[(0,T.jsx)(re,{kind:`drop`,size:240,fluffy:!0,coat:`fur`}),Pe?(0,T.jsxs)(`figure`,{className:`w-full max-w-sm rounded-[18px] bg-white/15 px-5 py-4`,children:[(0,T.jsx)(`figcaption`,{className:`font-medium text-[0.75rem] text-white/85 uppercase tracking-[0.14em]`,children:v(`onboard.wish`)}),(0,T.jsx)(`blockquote`,{className:`mt-1.5 line-clamp-6 whitespace-pre-line break-words text-[1rem] leading-relaxed`,children:Pe}),(0,T.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-white/75`,children:v(`onboard.wishNext`)})]}):null]}),(0,T.jsxs)(`div`,{className:`flex min-w-0 max-w-2xl animate-rise flex-col gap-5`,children:[U===`kind`?(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),V.kind&&W(V.kind===`personal`||h?`site`:`organization`)},children:[(0,T.jsx)(L,{children:Xe}),(0,T.jsx)(R,{children:v(`onboard.kind`)}),(0,T.jsx)(z,{children:p&&h?v(`onboard.kindSubOrganization`,{organization:h}):v(`onboard.kindSub`)}),B.kind?(0,T.jsx)(`p`,{className:`text-[0.9375rem] text-white/80`,children:v(`onboard.guess`,{domain:B.domain,kind:v(ve.find(e=>e.kind===B.kind)?.label??`onboard.kindSmall`)})}):null,(0,T.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:ve.map(e=>(0,T.jsx)(Ee,{picked:V.kind===e.kind,label:v(e.label),sub:v(e.sub),onClick:()=>G({kind:e.kind,size:e.kind===V.kind?V.size:null})},e.kind))}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{type:`submit`,children:v(`onboard.continue`)}),(0,T.jsx)(j,{step:1,total:m})]})]}):null,U===`organization`?(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault();let t=g.trim();t?Ge.mutate(t,{onSuccess:Ke}):W(`site`)},children:[(0,T.jsx)(L,{children:Xe}),(0,T.jsx)(R,{children:v(`onboard.organization`)}),(0,T.jsx)(z,{children:v(`onboard.organizationSub`)}),(0,T.jsx)(`input`,{value:g,onChange:e=>y(e.target.value),placeholder:v(`onboard.organizationPlaceholder`),maxLength:80,"aria-label":v(`onboard.organization`),className:ge}),g.trim()?(0,T.jsxs)(`p`,{className:`-mt-2 text-[0.9375rem] text-white/85`,children:[J&&g===J.name?`${v(`onboard.nameFrom`,{domain:new URL(J.url).host})} `:``,v(`onboard.address`),` `,(0,T.jsx)(`span`,{className:`font-mono text-[0.875rem]`,style:{color:D},children:tt(g)})]}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{type:`submit`,busy:Ge.isPending,children:v(`onboard.continue`)}),(0,T.jsx)(j,{step:1,total:m})]})]}):null,U===`site`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(L,{children:K?v(`onboard.kicker2Personal`):Ze(`onboard.kicker2Named`,`onboard.kicker2`)}),(0,T.jsx)(R,{children:K?v(`onboard.linksPersonal`):Be&&!Ve&&q?v(`onboard.noneFound`,{name:q}):q?v(`onboard.siteNamed`,{organization:q}):v(`onboard.site`)}),(0,T.jsx)(z,{children:K?v(`onboard.linksPersonalSub`):Be&&!Ve&&q?v(`onboard.noneFoundSub`,{name:q}):Re.isPending?v(`onboard.searching`,{name:q??``}):v(`onboard.foundSub`)}),Ue?(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault();let t=(b??``).trim();t?qe.mutate(t,{onSuccess:()=>W(`details`)}):W(`details`)},children:[(0,T.jsx)(ke,{value:b??``,onChange:x,rows:4,label:v(`onboard.line`),placeholder:v(K?`onboard.linePlaceholderPersonal`:`onboard.linePlaceholder`)}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>{x(null),He(!0),O(e=>e.length?e:[``])},className:`-mt-1 cursor-pointer self-start font-semibold text-[0.9375rem] text-white/85 hover:text-white`,children:[`+ `,v(`onboard.addressAfterAll`)]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{type:`submit`,busy:qe.isPending,children:v(`onboard.continue`)}),(0,T.jsx)(A,{onClick:()=>W(`details`),children:v(`onboard.skip`)}),(0,T.jsx)(j,{step:2,total:m})]})]}):(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),M?W(`details`):Z.length&&!Q.isPending&&Q.mutate(Z)},children:[Y.length?(0,T.jsx)(`div`,{className:`flex flex-col gap-2`,children:Y.map(e=>(0,T.jsx)(Ae,{address:e,picked:X.includes(e.url),onToggle:()=>S(X.includes(e.url)?X.filter(t=>t!==e.url):[...X,e.url])},e.url))}):null,!K&&Y.length?(0,T.jsx)(`p`,{className:`-mb-2 text-[0.9375rem] text-white/85`,children:v(`onboard.own`)}):null,C.map((e,t)=>(0,T.jsxs)(`div`,{className:`relative`,children:[(0,T.jsx)(`input`,{value:e,onChange:e=>O(n=>n.map((n,r)=>r===t?e.target.value:n)),placeholder:v(K?`onboard.linkPlaceholderPersonal`:`onboard.ownPlaceholder`),autoCapitalize:`none`,"aria-label":v(`onboard.own`),className:d(Te,`pr-28`)}),ue(e)?(0,T.jsx)(`span`,{className:`-translate-y-1/2 absolute top-1/2 right-3 rounded-full bg-white/20 px-2.5 py-0.5 font-semibold text-[0.75rem]`,children:ce[de(e)]}):null]},t)),C.length+Y.length<10?(0,T.jsxs)(`button`,{type:`button`,onClick:()=>O(e=>[...e,``]),className:`-mt-1 cursor-pointer self-start font-semibold text-[0.9375rem] text-white/85 hover:text-white`,children:[`+ `,v(`onboard.addAddress`)]}):null,M?(0,T.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.9375rem] text-(color:--moss)`,children:[(0,T.jsx)(f,{className:`size-4`}),M.name?v(`onboard.readDone`,{name:M.name,details:$e}):v(`onboard.readKept`,{n:Z.length})]}):Q.isError?(0,T.jsx)(`p`,{className:`text-[0.9375rem] text-(color:--rose)`,children:v(`onboard.readFailed`)}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[M?(0,T.jsx)(k,{type:`submit`,children:v(`onboard.continue`)}):(0,T.jsx)(k,{type:`submit`,busy:Q.isPending,children:Q.isPending?v(`onboard.reading`):v(`onboard.read`)}),(0,T.jsx)(A,{onClick:()=>x(``),children:v(`onboard.line`)}),(0,T.jsx)(A,{onClick:()=>W(`details`),children:v(`onboard.skip`)}),(0,T.jsx)(j,{step:2,total:m})]})]})]}):null,U===`details`&&V.kind?(0,T.jsxs)(`form`,{className:`contents`,onSubmit:e=>{e.preventDefault(),We.mutate(),W(`know`)},children:[(0,T.jsx)(L,{children:K||!q?Xe:q}),(0,T.jsx)(R,{small:!0,children:K?v(`onboard.personalTitle`):q?v(`onboard.aboutOrganization`,{organization:q}):v(V.kind===`club`?`onboard.clubTitle`:`onboard.businessTitle`)}),K?(0,T.jsx)(ke,{value:V.need,onChange:e=>G({need:e}),rows:4,label:v(`onboard.personalTitle`),placeholder:v(`onboard.personalPlaceholder`)}):null,V.kind===`club`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(N,{label:v(`onboard.clubKind`),options:Se,value:V.sector,text:e=>v(`onboard.club.${e}`),onChange:e=>G({sector:e})}),(0,T.jsx)(N,{label:v(`onboard.members`),options:be.club,value:V.size,text:xe,onChange:e=>G({size:e})}),(0,T.jsx)(N,{label:v(`onboard.yourRole`),options:Ce,value:V.role,text:e=>v(`onboard.role.${e}`),onChange:e=>G({role:e})})]}):null,V.kind===`small`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(N,{label:v(`onboard.people`),options:be.small,value:V.size,text:xe,onChange:e=>G({size:e})}),(0,T.jsx)(Ne,{value:V.sector,onChange:e=>G({sector:e}),suggested:et})]}):null,V.kind===`corp`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(N,{label:v(`onboard.people`),options:be.corp,value:V.size,text:xe,onChange:e=>G({size:e})}),(0,T.jsx)(Ne,{value:V.sector,onChange:e=>G({sector:e}),suggested:et}),(0,T.jsx)(N,{label:v(`onboard.yourRole`),options:we,value:V.role,text:e=>v(`onboard.role.${e}`),onChange:e=>G({role:e})}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-2 text-[0.9375rem] text-white/85`,children:[(0,T.jsxs)(`span`,{children:[v(`onboard.phone`),` `,(0,T.jsx)(`span`,{className:`text-white/60`,children:v(`onboard.phoneWhy`)})]}),(0,T.jsx)(`input`,{type:`tel`,value:V.phone,onChange:e=>G({phone:e.target.value.replace(/[^+0-9 ()/.-]/g,``)}),placeholder:`+43 …`,maxLength:40,autoComplete:`tel`,className:Te})]})]}):null,K?null:(0,T.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,T.jsxs)(`span`,{className:`text-[0.9375rem] text-white/85`,children:[v(`onboard.questions`),` `,(0,T.jsx)(`span`,{className:`text-white/60`,children:v(`onboard.optional`)})]}),(0,T.jsx)(ke,{value:V.questions??``,onChange:e=>G({questions:e}),rows:3,label:v(`onboard.questions`),placeholder:v(`onboard.questionsPlaceholder`)}),(0,T.jsx)(`span`,{className:`text-[0.8125rem] text-white/70`,children:v(`onboard.questionsHint`)})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{type:`submit`,busy:We.isPending,children:v(`onboard.continue`)}),(0,T.jsx)(A,{onClick:()=>window.history.state?.idx>0?s(-1):W(`site`),children:v(`onboard.back`)}),(0,T.jsx)(j,{step:3,total:m})]})]}):null,U===`know`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(L,{children:Ze(`onboard.kicker3Named`,`onboard.kicker3`)}),(0,T.jsx)(R,{children:v(`onboard.know`)}),(0,T.jsx)(z,{children:v(`onboard.knowSub`)}),(0,T.jsxs)(`button`,{type:`button`,onClick:()=>Me.current?.click(),onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),Qe(e.dataTransfer.files)},className:`flex cursor-pointer flex-col items-center gap-2 rounded-[18px] border-2 border-white/45 border-dashed bg-white/10 px-6 py-7 text-center transition hover:bg-white/15`,children:[(0,T.jsx)(ne,{className:`size-7`}),(0,T.jsx)(`span`,{className:`font-semibold text-[1.0625rem]`,children:v(`onboard.drop`)}),(0,T.jsx)(`span`,{className:`text-[0.875rem] text-white/80`,children:`PDF · Word · Excel · Markdown`}),(0,T.jsx)(`input`,{ref:Me,type:`file`,multiple:!0,className:`sr-only`,onChange:e=>{Qe(e.target.files),e.target.value=``}})]}),F.length?(0,T.jsx)(`ul`,{className:`flex flex-col gap-2`,children:F.map(e=>(0,T.jsxs)(`li`,{className:`flex items-center gap-2.5 rounded-xl bg-white/15 px-3.5 py-2.5 text-[0.875rem]`,children:[(0,T.jsx)(te,{className:`size-4 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,T.jsx)(`span`,{className:d(`text-white/80`,e.state===`failed`?`text-(color:--rose)`:``),children:e.state===`uploading`?v(`onboard.uploading`):e.state===`done`?v(`onboard.uploaded`):v(`onboard.uploadFailed`)})]},e.name))}):null,(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{busy:F.some(e=>e.state===`uploading`)||$.isPending,onClick:()=>p?$.mutate():W(`space`),children:v(p?`onboard.buildFirst`:`onboard.continue`)}),F.length||p?null:(0,T.jsx)(A,{onClick:()=>W(`space`),children:v(`onboard.skip`)}),(0,T.jsx)(j,{step:4,total:m})]})]}):null,U===`space`&&!p?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(L,{children:Ze(`onboard.kicker4Named`,`onboard.kicker4`)}),(0,T.jsx)(R,{children:q&&!K?v(`onboard.spaceNamed`,{organization:q}):v(`onboard.space`)}),(0,T.jsx)(z,{children:v(`onboard.spaceSub`,{space:l?.name??``})}),(0,T.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[[`partInfo`,`partInfoText`,!!(M||b)],[`partKnow`,`partKnowText`,F.some(e=>e.state===`done`)],[`partData`,`partDataText`,!1],[`partResults`,`partResultsText`,!1]].map(([e,t,n])=>(0,T.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-2xl border border-white/20 bg-white/10 px-4.5 py-4`,children:[(0,T.jsxs)(`span`,{className:`flex items-center gap-2 font-semibold text-[1rem]`,children:[n?(0,T.jsx)(f,{className:`size-4 text-(color:--moss)`}):null,v(`onboard.${e}`)]}),(0,T.jsx)(`span`,{className:`text-[0.84375rem] text-white/85 leading-snug`,children:v(`onboard.${t}`)})]},e))}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-5`,children:[(0,T.jsx)(k,{busy:$.isPending,onClick:()=>$.mutate(),children:v(`onboard.build`)}),(0,T.jsx)(j,{step:5,total:m})]})]}):null]},U)]}),(0,T.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between pb-6 text-[0.75rem] text-white/55 sm:pb-8`,children:[(0,T.jsx)(`span`,{children:`engenty.wizards`}),(0,T.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px] bg-(color:--dot)`})]})]})}function L({children:e}){return(0,T.jsx)(`p`,{className:`font-medium text-[0.75rem] text-white/85 uppercase tracking-[0.14em]`,children:e})}function R({children:e,small:t}){return(0,T.jsx)(`h1`,{className:d(`font-display font-bold leading-[1.05] tracking-[-0.02em]`,t?`text-[2.25rem] sm:text-[2.75rem]`:`text-[2.5rem] sm:text-[3.25rem]`),children:e})}function z({children:e}){return(0,T.jsx)(`p`,{className:`text-[1.0625rem] text-white/90 leading-relaxed`,children:e})}function ke({value:e,onChange:t,rows:n,label:r,placeholder:i}){let[a]=s(),o=l(e,t,{deviceId:a.deviceId});return(0,T.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[18px] border border-white/30 bg-white/15 px-4 pt-3 pb-3 focus-within:border-white/60`,children:[(0,T.jsx)(`textarea`,{value:e,onChange:e=>t(e.target.value),placeholder:o.listening?v(`editor.listening`):i,rows:n,maxLength:4e3,"aria-label":r,className:`w-full resize-none bg-transparent text-[1.0625rem] text-white leading-relaxed outline-none placeholder:text-white/55`}),o.supported?(0,T.jsx)(`div`,{className:`self-end`,style:{"--ink":`white`,"--border":`rgb(255 255 255 / 0.55)`},children:(0,T.jsx)(u,{speech:o,labelled:!0})}):null]})}function Ae({address:e,picked:t,onToggle:n}){return(0,T.jsxs)(`button`,{type:`button`,"aria-pressed":t,onClick:n,className:d(`flex cursor-pointer items-center gap-3.5 rounded-[14px] border px-4 py-2.5 text-left transition`,t?`border-white bg-white/22`:`border-white/30 bg-white/8 hover:bg-white/12`),children:[(0,T.jsx)(`span`,{className:d(`flex size-5 shrink-0 items-center justify-center rounded-md border-2`,t?`border-white bg-white`:`border-white/60`),style:t?{color:E}:void 0,children:t?(0,T.jsx)(f,{className:`size-3.5`,strokeWidth:3}):null}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,T.jsx)(`span`,{className:`font-semibold text-[0.6875rem] text-white/70 uppercase tracking-[0.1em]`,children:ce[e.kind]}),(0,T.jsx)(`span`,{className:`truncate font-mono text-[0.9375rem]`,children:e.url.replace(/^https?:\/\/(www\.)?/,``).replace(/\/$/,``)}),(0,T.jsx)(`span`,{className:`truncate text-[0.8125rem] text-white/80`,children:e.title})]}),(0,T.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-white/70 max-sm:hidden`,children:v(e.source===`email`?`onboard.fromEmail`:`onboard.fromWeb`)})]})}function je(e){return e.toLowerCase().replace(/['’]/g,``).replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFKD`).replace(/[̀-ͯ]/g,``).replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``).slice(0,35).replace(/-+$/,``)}function Me(){let e=ie(),i=ee(),o=a(),s=y(),c=e.data?.tenant,l=r({queryKey:[`organization`,c?.id],queryFn:()=>n.get(`/api/studio/organization`),enabled:!!c}),u=t({mutationFn:()=>n.post(`/api/studio/onboarding/done`),onSuccess:async()=>{await i.invalidateQueries({queryKey:[`me`]}),o(`/`,{replace:!0})}});if(!(e.data&&c))return null;let d=c.name??``,te=e.data.user.name,f=te.includes(`@`)?``:te.split(` `)[0],ne=e.data.organizations.find(e=>e.id===c.id)?.invitedBy?.name,p=l.data?.members.find(t=>t.role===`owner`&&t.userId!==e.data?.user.id)?.name,m=c.role!==`member`,h=c.slug?`${window.location.host}/studio/${c.slug}`:null;return(0,T.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-white sm:px-10`,style:{...me,background:pe},children:[(0,T.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,T.jsx)(_e,{}),(0,T.jsx)(se,{tone:`ground`,ink:E})]}),(0,T.jsxs)(`main`,{className:`mx-auto grid w-full max-w-6xl flex-1 items-center gap-10 py-10 lg:grid-cols-[5fr_7fr] lg:gap-12`,children:[(0,T.jsx)(`div`,{className:`flex flex-col items-center gap-8 max-lg:order-first`,children:(0,T.jsx)(re,{kind:`drop`,size:240,fluffy:!0,coat:`fur`})}),(0,T.jsxs)(`div`,{className:`flex min-w-0 max-w-2xl animate-rise flex-col gap-5`,children:[(0,T.jsx)(`p`,{className:`font-medium text-[0.75rem] text-white/85 uppercase tracking-[0.14em]`,children:f?v(`onboard.kicker1`,{name:f}):v(`onboard.kicker1Anon`)}),(0,T.jsx)(`h1`,{className:`font-display font-bold text-[2.5rem] leading-[1.05] tracking-[-0.02em] sm:text-[3.25rem]`,children:v(`welcome.title`,{organization:d})}),(0,T.jsx)(`p`,{className:`text-[1.0625rem] text-white/90 leading-relaxed`,children:ne?v(`welcome.invited`,{name:ne}):p?v(`welcome.setUp`,{name:p,organization:d}):v(`welcome.plain`)}),(0,T.jsxs)(`div`,{className:`overflow-hidden rounded-[18px] bg-white/12 ring-1 ring-white/20`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3.5 px-4.5 py-3.5`,children:[(0,T.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl font-bold font-display`,style:{background:D,color:E},children:b(d)}),(0,T.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,T.jsx)(`span`,{className:`truncate font-semibold text-[1.0625rem]`,children:d}),h?(0,T.jsx)(`span`,{className:`truncate font-mono text-[0.8125rem] text-white/75`,children:h}):null]}),(0,T.jsx)(`span`,{className:`rounded-full bg-white/20 px-2.5 py-1 font-semibold text-[0.75rem]`,children:v(`organization.role.${c.role}`)})]}),s.data?.some(e=>e.wizardCount>0)?s.data.map(e=>(0,T.jsxs)(`div`,{className:`flex justify-between gap-3 border-white/15 border-t px-4.5 py-2.5 text-[0.9375rem]`,children:[(0,T.jsx)(`span`,{className:`truncate`,children:e.name}),(0,T.jsx)(`span`,{className:`shrink-0 text-white/75`,children:v(`welcome.wizards`,{n:e.wizardCount})})]},e.id)):(0,T.jsx)(`p`,{className:`border-white/15 border-t px-4.5 py-3 text-[0.9375rem] text-white/80`,children:v(`welcome.noWizards`)})]}),(0,T.jsx)(`p`,{className:`text-[0.9375rem] text-white/80`,children:v(m?`welcome.canBuild`:`welcome.canMember`)}),(0,T.jsx)(`div`,{className:`flex flex-wrap items-center gap-5`,children:(0,T.jsx)(k,{busy:u.isPending,onClick:()=>u.mutate(),children:v(`welcome.go`)})})]})]})]})}function Ne({value:e,onChange:t,suggested:n}){let[r,i]=(0,w.useState)(!1),a=C(e),o=[...new Set([...a?[a.id]:[],...n])].slice(0,4),s=e=>C(e)?.name[_===`de`?`de`:`en`]??e;return(0,T.jsxs)(`fieldset`,{className:`flex flex-col gap-2`,children:[(0,T.jsx)(`legend`,{className:`mb-2 text-[0.9375rem] text-white/85`,children:v(`onboard.sector`)}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[o.map(n=>(0,T.jsx)(`button`,{type:`button`,"aria-pressed":e===n,onClick:()=>t(n),className:d(`cursor-pointer rounded-full border px-4 py-2 text-[0.9375rem] transition`,e===n?`border-white bg-white`:`border-white/30 hover:bg-white/15`),style:e===n?{color:E}:void 0,children:s(n)},n)),(0,T.jsx)(`button`,{type:`button`,"aria-pressed":r,onClick:()=>i(e=>!e),className:`cursor-pointer rounded-full border border-white/40 border-dashed px-4 py-2 text-[0.9375rem] hover:bg-white/15`,children:v(`onboard.sectorOther`)})]}),r?(0,T.jsxs)(`select`,{value:a?e:``,onChange:e=>{t(e.target.value),i(!1)},"aria-label":v(`onboard.sector`),className:d(Te,`[&>option]:text-black`),children:[(0,T.jsx)(`option`,{value:``,children:v(`onboard.sectorPick`)}),[...S].sort((e,t)=>s(e.id).localeCompare(s(t.id),_)).map(e=>(0,T.jsx)(`option`,{value:e.id,children:s(e.id)},e.id))]}):null,a?(0,T.jsxs)(`span`,{className:`text-[0.8125rem] text-white/75`,children:[v(`onboard.sectorHint`),` `,(0,T.jsx)(`b`,{style:{color:D},children:v(`onboard.catalog`,{sector:s(a.id)})})]}):null]})}export{F as OnboardingPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{P as t}from"./Marketplace-D3hdvrkz.js";import{t as n}from"./useMutation-fT44ij_b.js";import{$ as r,C as i,S as a,Sr as o,Z as s,a as c,an as l,ar as u,cn as d,er as f,fr as p,gn as m,hn as h,mr as g,ni as _,rr as v,sn as y,vn as b,wn as x,xn as S,yn as ee}from"./ui-DSgksc1H.js";import{m as C}from"./Skills-frfXXEcF.js";import{d as w}from"./marked.esm-BfGIZK7F.js";import{Mn as T,Nn as E}from"./host-B2ZzDrkc.js";import{n as D,t as O}from"./jsx-runtime-C3cWAN_r.js";import{n as k,s as A}from"./i18n-Dyi0kvaA.js";import{d as j,u as te}from"./session-EIDP3Wzc.js";import{s as ne}from"./ConnectorsSection-CNpieoyT.js";var M={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};M.node;var N=w(M),P=e(D(),1),F={not_connected:`protocol.refused.not_connected`,no_action:`protocol.refused.no_action`,not_in_grant:`protocol.refused.not_in_grant`,denied:`protocol.refused.denied`,declined:`protocol.refused.declined`,nobody:`protocol.refused.nobody`,needs_approval:`protocol.refused.needs_approval`,ai_step_writes:`protocol.refused.ai_step_writes`,not_allowed_recipient:`protocol.refused.not_allowed_recipient`,channel_not_fixed:`protocol.refused.channel_not_fixed`,run_limit:`protocol.refused.run_limit`,day_limit:`protocol.refused.day_limit`,calls_per_run:`protocol.refused.calls_per_run`,calls_per_day:`protocol.refused.calls_per_day`,run_ended:`protocol.refused.run_ended`,paused:`protocol.refused.paused`,may_have_happened:`protocol.refused.may_have_happened`},I={"run.cancelled":`protocol.why.runStopped`,"run.done":`protocol.why.runDone`,"run.failed":`protocol.why.runFailed`},L={read:`protocol.kind.read`,write:`protocol.kind.write`,destructive:`protocol.kind.destructive`,send:`protocol.kind.send`},re={read:`protocol.verb.read`,write:`protocol.verb.write`,destructive:`protocol.verb.destructive`,send:`protocol.verb.send`},R={refused_write:`work.critical.refused_write`,outside_audience:`work.critical.outside_audience`,host_not_in_grant:`work.critical.host_not_in_grant`,limit_reached:`work.critical.limit_reached`,sign_in_failed:`work.critical.sign_in_failed`,first_use:`work.critical.first_use`,rule_changed:`work.critical.rule_changed`},z={grant:`protocol.rule.grant`,audience:`protocol.rule.audience`,actions:`protocol.rule.actions`,ai_step_writes:`protocol.rule.ai_step_writes`,destructive:`protocol.rule.destructive`,policy:`protocol.rule.policy`,read:`protocol.rule.read`,own_job:`protocol.rule.own_job`,autonomous_mode:`protocol.rule.autonomous_mode`,guest_send:`protocol.rule.guest_send`,run:`protocol.rule.run`,paused:`protocol.rule.paused`,limits:`protocol.rule.limits`},B={admins:`protocol.audience.admins`,members:`protocol.audience.members`,all:`protocol.audience.all`};function V(e){return e in L}function H(e){return V(e)?A(L[e]):e}function ie(e){return V(e)?A(re[e]):e}function U(e){return e&&e in R?A(R[e]):``}function W(e){if(!e)return A(`protocol.rule.none`);if(e.startsWith(`rules.`))return A(`protocol.rule.rules`,{kind:H(e.slice(6))});let t=z[e]??z[e.split(`.`)[0]??``];return t?A(t):e}function G(e,t,n){return e===`run_ended`&&t&&t in I?A(I[t]):e&&e!==`denied`&&e in F?A(F[e]):t===`audience`?n&&n in B?A(`protocol.why.audienceFor`,{audience:A(B[n])}):A(`protocol.why.audience`):t===`actions`?A(`protocol.why.actions`):t===`grant`?A(`protocol.refused.not_in_grant`):t?.startsWith(`rules.`)?A(`protocol.why.rule`):A(`protocol.refused.denied`)}var ae={waiting_input:`runs.status.waiting_input`,sleeping:`runs.status.sleeping`,waiting_signal:`runs.status.waiting_signal`,running:`runs.status.running`,done:`runs.status.done`,failed:`runs.status.failed`,cancelled:`protocol.detail.runStopped`};function oe(e){let t=ae[e];return t?A(t):e}function se(e){return e===`running`||e===`waiting_input`||e===`sleeping`||e===`waiting_signal`}function ce(e){let{outcome:t,result:n,rule:r}=e;return n===null&&t!==`deny`?{tone:`held`,text:A(`protocol.outcome.running`)}:n===`ok`?{tone:`done`,text:A(t===`ask`?`protocol.outcome.doneApproved`:`protocol.outcome.done`)}:n===`already_done`?{tone:`done`,text:A(`protocol.outcome.alreadyDone`)}:n===`needs_approval`?{tone:`held`,text:A(`protocol.outcome.held`)}:n===`sign_in_failed`?{tone:`failed`,text:A(`protocol.outcome.signInFailed`)}:n===`nobody`||n===`not_connected`?{tone:`failed`,text:A(`protocol.outcome.notDone`,{why:A(F[n])})}:t===`deny`||n===`declined`?{tone:`refused`,text:A(`protocol.outcome.refused`,{why:G(n,r)})}:{tone:`failed`,text:A(`protocol.outcome.failed`,{error:n??``})}}function le(e){switch(e.kind){case`guest`:return A(`protocol.who.guest`);case`person`:return e.name??A(`protocol.who.person`);case`admin`:return e.name?A(`protocol.who.adminNamed`,{name:e.name}):A(`protocol.who.admin`);case`goose`:return e.name?A(`protocol.who.gooseFor`,{name:e.name}):A(`protocol.who.goose`);case`plugin`:return A(`protocol.who.plugin`,{name:e.id??``});case`runtime`:return A(`protocol.who.runtime`);case`step`:return e.for?e.for.kind===`guest`?A(`protocol.who.stepForGuest`):A(`protocol.who.stepFor`,{name:e.for.name??A(`protocol.who.person`)}):A(`protocol.who.step`);default:return e.kind}}function ue(e){return e.runId?e.wizardName?A(e.runMode===`test`?`protocol.where.testRunOf`:`protocol.where.runOf`,{wizard:e.wizardName}):A(`protocol.where.run`):e.chatId?e.chatTitle?A(`protocol.where.chatNamed`,{title:e.chatTitle}):A(`protocol.where.chat`):e.who.kind===`goose`?A(`protocol.where.goose`):e.who.kind===`plugin`?A(`protocol.where.plugin`):``}function de(e){let{connectionId:t}=e;return e.connectionName?e.connectorName&&!e.connectionName.includes(e.connectorName)?`${e.connectorName} · ${e.connectionName}`:e.connectionName:t.startsWith(`host:`)?A(`protocol.connection.host`,{host:t.slice(5)}):t===`mail:server`?A(`protocol.connection.serverMail`):t===`rwx`?A(`protocol.connection.rwx`):e.connectorName?`${e.connectorName} · ${t}`:t}function fe(e){switch(e.actionId){case`change_rules`:return e.input?.fields&&`paused`in e.input.fields?A(e.input.sample===`paused: yes`?`protocol.action.paused`:`protocol.action.resumed`):e.input?.fields&&Object.keys(e.input.fields).join()===`limits`?A(`protocol.action.limits`):A(`protocol.action.changeRules`);case`http_request`:return A(`protocol.action.request`);case`read_secret`:return A(`protocol.action.readSecret`);case`pull_stream`:return A(`protocol.action.pullStream`);case`send_message`:return e.actionName??A(`protocol.action.sendMail`);default:return e.actionName??e.actionId}}function pe(e,t){let n={who:t.who,connection:t.connection,verb:ie(e.action.kind)};return e.outcome===`allow`?A(`protocol.ask.allow`,n):e.outcome===`ask`?A(e.admins?`protocol.ask.askAdmins`:`protocol.ask.askPerson`,n):A(`protocol.ask.deny`,{...n,why:G(e.refused??null,e.rule,t.audience)})}function me(e){return e.fixedChannel?A(`protocol.ask.fixedChannel`):null}var K=e(O(),1);function he(){let[e,t]=g(),{space:n}=te(),i=j(),a=e.get(`show`),s=i&&(a===`ask`||a===`notify`)?a:null,c=e=>t(e?{show:e}:{},{replace:!0}),f=e.get(`connection`)??``,p=o({queryKey:[`broker-choices`,n?.id],queryFn:()=>r.get(`/api/studio/spaces/${n?.id}/broker/choices`),enabled:!!n&&i});return n?i?(0,K.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[(0,K.jsx)(q,{spaceId:n.id,connection:f,action:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(l,{variant:`secondary`,size:`sm`,onClick:()=>c(`ask`),children:[(0,K.jsx)(T,{className:`size-4`}),` `,A(`protocol.ask.title`)]}),(0,K.jsx)(l,{variant:`secondary`,size:`sm`,onClick:()=>c(`notify`),"aria-label":A(`protocol.notify.title`),title:A(`protocol.notify.title`),children:(0,K.jsx)(u,{className:`size-4`})})]})}),(0,K.jsxs)(d,{open:s===`ask`,onClose:()=>c(null),wide:!0,title:A(`protocol.ask.title`),children:[(0,K.jsx)(`p`,{className:`-mt-2 mb-4 text-[0.875rem] text-ink-3`,children:A(`protocol.ask.hint`)}),(0,K.jsx)(we,{choices:p.data,spaceId:n.id})]}),(0,K.jsxs)(d,{open:s===`notify`,onClose:()=>c(null),title:A(`protocol.notify.title`),children:[(0,K.jsx)(`p`,{className:`-mt-2 mb-4 text-[0.875rem] text-ink-3`,children:A(`protocol.notify.hint`)}),(0,K.jsx)(Ee,{space:n})]})]}):(0,K.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:(0,K.jsx)(q,{spaceId:n.id,own:!0,connection:f})}):null}var ge={hour:36e5,day:864e5,week:6048e5,month:2592e6},_e=[`guest`,`person`,`admin`,`goose`,`plugin`,`step`,`runtime`],ve=50;function ye(e,t=300){let[n,r]=(0,P.useState)(e);return(0,P.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function q({spaceId:e,own:n=!1,connection:o=``,action:s}){let[c,u]=(0,P.useState)(`all`),[d,f]=(0,P.useState)(``),[p,g]=(0,P.useState)(o),[_,v]=(0,P.useState)(`week`),[y,b]=(0,P.useState)(``),x=ye(y).trim(),[C,w]=(0,P.useState)(null),T=ne(e).data?.connections??[],E=t({queryKey:[`broker-log`,e,{outcome:c,who:d,connection:p,range:_,q:x}],initialPageParam:null,queryFn:({pageParam:t})=>{let n=new URLSearchParams({limit:String(ve)});return c===`refused`?n.set(`refused`,`true`):c===`critical`?n.set(`critical`,`true`):c===`held`&&n.set(`result`,`needs_approval`),d&&n.set(`who`,d),p&&n.set(`connection`,p),_!==`all`&&n.set(`since`,new Date(Date.now()-ge[_]).toISOString()),x&&n.set(`q`,x),t&&n.set(`cursor`,t),r.get(`/api/studio/spaces/${e}/broker/log?${n}`)},getNextPageParam:e=>e.next}),D=E.data?.pages.flatMap(e=>e.lines)??[],O=c!==`all`||d!==``||p!==``||_!==`all`||x!==``,k=new Set(T.map(e=>e.id));return(0,K.jsx)(i,{title:A(`capabilities.protocol`),hint:A(n?`protocol.own.hint`:`protocol.hint`),action:s,plain:!0,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:(0,K.jsx)(ee,{value:c,onChange:u,label:A(`protocol.filter.outcome`),options:[{id:`all`,label:A(`protocol.filter.all`)},{id:`refused`,label:A(`protocol.filter.refused`)},{id:`critical`,label:A(`protocol.filter.critical`)},{id:`held`,label:A(`protocol.filter.held`)}]})}),(0,K.jsxs)(`div`,{className:S(`grid gap-2`,n?`sm:grid-cols-2`:`sm:grid-cols-3`),children:[n?null:(0,K.jsx)(h,{value:d,onChange:f,placeholder:A(`protocol.filter.everyone`),options:_e.map(e=>({value:e,label:A(`protocol.filter.who.${e}`)}))}),(0,K.jsx)(h,{value:p,onChange:g,placeholder:A(`protocol.filter.everyConnection`),options:T.map(e=>({value:e.id,label:e.connector?`${e.connector.name} · ${e.name}`:e.name}))}),(0,K.jsx)(h,{value:_,onChange:e=>v(e),options:[`hour`,`day`,`week`,`month`,`all`].map(e=>({value:e,label:A(`protocol.range.${e}`)}))})]}),(0,K.jsx)(a,{value:y,onChange:b,placeholder:A(n?`protocol.own.search`:`protocol.search`),busy:E.isFetching&&!E.isFetchingNextPage}),E.error?(0,K.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:E.error.message}):E.isPending?(0,K.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,K.jsx)(m,{className:`text-ink-3`})}):D.length===0?(0,K.jsx)(`p`,{className:`py-12 text-center text-[0.9375rem] text-ink-3`,children:A(O?`protocol.emptyFiltered`:n?`protocol.own.empty`:`protocol.empty`)}):(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:D.map(t=>(0,K.jsx)(`li`,{children:(0,K.jsx)(be,{line:t,spaceId:e,open:C===t.id,onToggle:()=>w(C===t.id?null:t.id),ofSpace:k.has(t.connectionId)})},t.id))}),E.hasNextPage?(0,K.jsx)(`div`,{className:`flex justify-center`,children:(0,K.jsx)(l,{variant:`quiet`,size:`sm`,busy:E.isFetchingNextPage,onClick:()=>void E.fetchNextPage(),children:A(`protocol.more`)})}):null]})})}var J={done:C,refused:N,held:f,failed:x},Y={done:`text-moss`,refused:`text-rose`,held:`text-ember`,failed:`text-ink-3`};function X(e,t=!1){return new Date(e).toLocaleString(k,{dateStyle:t?`medium`:`short`,timeStyle:t?`medium`:`short`})}function be({line:e,spaceId:t,open:n,onToggle:r,ofSpace:i}){let a=ce(e),o=J[a.tone],s=ue(e),c=e.critical||a.tone===`refused`;return(0,K.jsxs)(`div`,{className:S(`rounded-xl bg-card ring-1 transition`,e.critical?`ring-ember/50`:a.tone===`refused`?`ring-rose/40`:`ring-border-soft`),children:[(0,K.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,className:`flex w-full items-start gap-3 px-3.5 py-3 text-left`,children:[(0,K.jsx)(o,{className:S(`mt-0.5 size-4 shrink-0`,Y[a.tone])}),(0,K.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,K.jsxs)(`span`,{className:`text-[0.9375rem] text-ink leading-snug`,children:[(0,K.jsx)(`b`,{className:`font-medium`,children:le(e.who)}),` · `,H(e.kind),`: `,fe(e),` · `,de(e)]}),(0,K.jsxs)(`span`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:[X(e.at),s?` · ${s}`:``,` · `,(0,K.jsx)(`span`,{className:S(c&&Y[a.tone],c&&`font-medium`),children:a.text})]})]}),e.critical?(0,K.jsx)(`span`,{className:`shrink-0`,children:(0,K.jsx)(y,{tone:`ember`,icon:(0,K.jsx)(E,{className:`size-3`}),title:U(e.criticalKind),children:A(`protocol.critical`)})}):null,(0,K.jsx)(v,{className:S(`mt-0.5 size-4 shrink-0 text-ink-4 transition-transform`,n&&`rotate-180`)})]}),n?(0,K.jsx)(xe,{line:e,spaceId:t,ofSpace:i}):null]})}function Z({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`grid gap-0.5 sm:grid-cols-[11rem_minmax(0,1fr)] sm:gap-3`,children:[(0,K.jsx)(`dt`,{className:`text-[0.8125rem] text-ink-3`,children:e}),(0,K.jsx)(`dd`,{className:`min-w-0 break-words text-[0.875rem] text-ink-2`,children:t})]})}function xe({line:e,spaceId:t,ofSpace:i}){let a=o({queryKey:[`broker-line`,t,e.id],queryFn:()=>r.get(`/api/studio/spaces/${t}/broker/log/${e.id}`)}),s=a.data?.run,u=j(),d=_(),f=n({mutationFn:()=>r.post(`/api/runs/${e.runId}/cancel`),onSuccess:()=>d.invalidateQueries({queryKey:[`broker-line`,t]})}),p=e.input,h=Object.keys(p?.fields??{}),g=e.connectionId.startsWith(`host:`);return(0,K.jsxs)(`div`,{className:`border-border-soft border-t px-3.5 py-3`,children:[(0,K.jsxs)(`dl`,{className:`grid gap-2`,children:[(0,K.jsxs)(Z,{label:A(`protocol.detail.when`),children:[X(e.at,!0),` · `,A(`protocol.detail.duration`,{ms:e.durationMs})]}),e.critical?(0,K.jsx)(Z,{label:A(`protocol.critical`),children:U(e.criticalKind)}):null,(0,K.jsxs)(Z,{label:A(`protocol.detail.input`),children:[h.length?A(`protocol.detail.inputFields`,{fields:h.join(`, `),size:p?.size??0}):A(`protocol.detail.inputEmpty`),p?.sample?(0,K.jsx)(`span`,{className:`mt-0.5 block font-mono text-[0.8125rem] text-ink-3`,children:p.sample}):null]}),(0,K.jsx)(Z,{label:A(`protocol.detail.result`),children:e.resultSize===null?A(`protocol.detail.resultNone`):A(`protocol.detail.resultSize`,{size:e.resultSize})}),(0,K.jsxs)(Z,{label:A(`protocol.detail.rule`),children:[W(e.rule),e.reason?(0,K.jsx)(`span`,{className:`mt-0.5 block text-[0.8125rem] text-ink-3`,children:e.reason}):null]}),s?(0,K.jsx)(Z,{label:A(`protocol.detail.run`),children:oe(s.status)}):null,e.runId?(0,K.jsx)(Z,{label:A(`protocol.detail.grant`),children:a.isPending?(0,K.jsx)(m,{className:`size-4 text-ink-3`}):i?A(`protocol.detail.grantSpace`):s?.grant?g?s.grant.hosts.length?A(`protocol.detail.grantHosts`,{hosts:s.grant.hosts.join(`, `)}):A(`protocol.detail.grantNoHosts`):s.grant.actions?.length?A(`protocol.detail.grantActions`,{actions:s.grant.actions.join(`, `)}):A(`protocol.detail.grantNoActions`):A(`protocol.detail.grantNone`)}):null]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[e.runId&&e.wizardId?(0,K.jsx)(Q,{to:`/edit/${e.wizardId}?run=${e.runId}`,children:A(`protocol.detail.openRun`)}):null,e.chatId?(0,K.jsx)(Q,{to:`/work/c/${e.chatId}`,children:A(`protocol.detail.openChat`)}):null,i?(0,K.jsx)(Q,{to:`/capabilities/connectors?show=${e.connectionId}`,children:A(`protocol.detail.openConnection`)}):null,u&&s&&se(s.status)?(0,K.jsx)(`span`,{className:`sm:ml-auto`,children:(0,K.jsx)(l,{variant:`danger`,size:`sm`,busy:f.isPending,onClick:async()=>{await c(A(`protocol.detail.stopRunAsk`),{detail:A(`protocol.detail.stopRunDetail`),action:A(`protocol.detail.stopRun`)})&&f.mutate()},children:A(`protocol.detail.stopRun`)})}):null]}),f.error?(0,K.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:f.error.message}):null]})}function Q({to:e,children:t}){return(0,K.jsx)(p,{to:e,className:`inline-flex h-8 items-center rounded-full bg-paper-2 px-3 font-medium text-[0.8125rem] text-ink transition hover:bg-paper-3 coarse:h-11 coarse:px-4`,children:t})}function Se(e,t){if(e.startsWith(`person:`)){let n=t.people.find(t=>`person:${t.id}`===e);return{who:n&&n.role!==`member`?`admin`:`person`}}return e.startsWith(`step:`)?{who:`step`,for:e.slice(5)}:{who:e}}function Ce(e,t){return e.startsWith(`person:`)?t.people.find(t=>`person:${t.id}`===e)?.name??``:A(e===`guest`?`protocol.ask.who.guest`:e===`goose`?`protocol.ask.who.goose`:`protocol.ask.who.step`)}function we({choices:e,spaceId:t}){let[n,i]=(0,P.useState)(``),[a,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(`run`),f=e?.connections.find(e=>e.id===a),p=f?.actions.find(e=>e.id===c),g=n.startsWith(`step:`)?`run`:u,_=!!(e&&n&&f&&p),v=o({queryKey:[`broker-ask`,t,n,a,c,g],queryFn:()=>{let i=new URLSearchParams({...Se(n,e),resource:a,action:c,in:g});return r.get(`/api/studio/spaces/${t}/broker/ask?${i}`)},enabled:_});if(!e)return(0,K.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,K.jsx)(m,{className:`text-ink-3`})});let y=[...e.people.map(e=>({value:`person:${e.id}`,label:e.role===`member`?e.name:A(`protocol.who.adminNamed`,{name:e.name})})),{value:`guest`,label:A(`protocol.ask.who.guest`)},{value:`goose`,label:A(`protocol.ask.who.goose`)},{value:`step:guest`,label:A(`protocol.ask.who.stepGuest`)},{value:`step:person`,label:A(`protocol.ask.who.stepPerson`)}];return(0,K.jsx)(K.Fragment,{children:e.connections.length===0?(0,K.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:A(`protocol.ask.noConnections`)}):(0,K.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsx)($,{label:A(`protocol.ask.who`),children:(0,K.jsx)(h,{value:n,onChange:e=>i(e),placeholder:A(`protocol.ask.choose`),options:y})}),(0,K.jsx)($,{label:A(`protocol.ask.connection`),children:(0,K.jsx)(h,{value:a,onChange:e=>{s(e),l(``)},placeholder:A(`protocol.ask.choose`),options:e.connections.map(e=>({value:e.id,label:e.connector?`${e.connector.name} · ${e.name}`:e.name}))})}),(0,K.jsx)($,{label:A(`protocol.ask.action`),children:(0,K.jsx)(h,{value:c,onChange:l,placeholder:A(`protocol.ask.choose`),options:(f?.actions??[]).map(e=>({value:e.id,label:`${e.name} (${H(e.kind)})`}))})}),(0,K.jsx)($,{label:A(`protocol.ask.where`),children:(0,K.jsx)(h,{value:g,onChange:e=>d(e),options:[{value:`run`,label:A(`protocol.ask.inRun`)},{value:`chat`,label:A(`protocol.ask.inChat`),disabled:n.startsWith(`step:`)}]})})]}),(0,K.jsx)(`div`,{className:`rounded-xl bg-paper-2 px-4 py-3.5`,children:_?v.error?(0,K.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:v.error.message}):v.data?(0,K.jsx)(Te,{answer:v.data,who:Ce(n,e),connection:f?f.connector?`${f.connector.name} · ${f.name}`:f.name:``,audience:f?.audience}):(0,K.jsx)(m,{className:`size-4 text-ink-3`}):(0,K.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:A(`protocol.ask.pick`)})})]})})}function Te({answer:e,who:t,connection:n,audience:r}){let i=e.outcome===`allow`?`done`:e.outcome===`ask`?`held`:`refused`,a=J[i],o=me(e);return(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(a,{className:S(`mt-1 size-4 shrink-0`,Y[i])}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,K.jsx)(`p`,{className:`font-medium text-[0.9375rem] text-ink leading-snug`,children:pe(e,{who:t,connection:n,audience:r})}),o?(0,K.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2`,children:o}):null,(0,K.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:A(`protocol.ask.rule`,{rule:W(e.rule)})}),(0,K.jsx)(`div`,{children:(0,K.jsx)(Q,{to:`/capabilities/connectors?show=${e.connection.id}`,children:A(`protocol.ask.change`)})})]})]})}function $({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-medium text-[0.8125rem] text-ink-2`,children:e}),t]})}function Ee({space:e}){let t=_(),[n,i]=(0,P.useState)(!1),[a,o]=(0,P.useState)(null),c=e.notify??{bell:!0,mail:`hourly`},l=async n=>{i(!0),o(null);try{await r.patch(`/api/studio/spaces/${e.id}`,{notify:n}),await t.invalidateQueries({queryKey:s.spaces()})}catch(e){o(e.message)}finally{i(!1)}},u=e.readOnly||n;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsx)(De,{label:A(`protocol.notify.bell`),hint:A(`protocol.notify.bellHint`),checked:c.bell,disabled:u,onChange:e=>void l({...c,bell:e})}),(0,K.jsx)(De,{label:A(`protocol.notify.mail`),hint:A(`protocol.notify.mailHint`),checked:c.mail===`hourly`,disabled:u,onChange:e=>void l({...c,mail:e?`hourly`:`off`})}),a?(0,K.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:a}):null]})}function De({label:e,hint:t,checked:n,disabled:r,onChange:i}){return(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`font-medium text-[0.9375rem] text-ink`,children:e}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:t})]}),(0,K.jsx)(b,{checked:n,onChange:i,label:e,disabled:r})]})}export{he as n,N as r,Ee as t};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{P as t}from"./Marketplace-B3NoH5Va.js";import{t as n}from"./useMutation-BSffqL6W.js";import{$ as r,C as i,S as a,Sr as o,Z as s,a as c,an as l,ar as u,cn as d,er as f,fr as p,gn as m,hn as h,mr as g,ni as _,rr as v,sn as y,vn as b,wn as x,xn as S,yn as ee}from"./ui-DkEhb2Rt.js";import{m as C}from"./Skills-BcgxuD15.js";import{d as w}from"./marked.esm-BfGIZK7F.js";import{Nn as T,Pn as E}from"./host-DCRX0zfY.js";import{n as D,t as O}from"./jsx-runtime-C3cWAN_r.js";import{n as k,s as A}from"./i18n-WXeVnv7i.js";import{d as j,u as te}from"./session-RDdtfee2.js";import{s as ne}from"./ConnectorsSection-uN3ROkh7.js";var M={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};M.node;var N=w(M),P=e(D(),1),F={not_connected:`protocol.refused.not_connected`,no_action:`protocol.refused.no_action`,not_in_grant:`protocol.refused.not_in_grant`,denied:`protocol.refused.denied`,declined:`protocol.refused.declined`,nobody:`protocol.refused.nobody`,needs_approval:`protocol.refused.needs_approval`,ai_step_writes:`protocol.refused.ai_step_writes`,not_allowed_recipient:`protocol.refused.not_allowed_recipient`,channel_not_fixed:`protocol.refused.channel_not_fixed`,run_limit:`protocol.refused.run_limit`,day_limit:`protocol.refused.day_limit`,calls_per_run:`protocol.refused.calls_per_run`,calls_per_day:`protocol.refused.calls_per_day`,run_ended:`protocol.refused.run_ended`,paused:`protocol.refused.paused`,may_have_happened:`protocol.refused.may_have_happened`},I={"run.cancelled":`protocol.why.runStopped`,"run.done":`protocol.why.runDone`,"run.failed":`protocol.why.runFailed`},L={read:`protocol.kind.read`,write:`protocol.kind.write`,destructive:`protocol.kind.destructive`,send:`protocol.kind.send`},re={read:`protocol.verb.read`,write:`protocol.verb.write`,destructive:`protocol.verb.destructive`,send:`protocol.verb.send`},R={refused_write:`work.critical.refused_write`,outside_audience:`work.critical.outside_audience`,host_not_in_grant:`work.critical.host_not_in_grant`,limit_reached:`work.critical.limit_reached`,sign_in_failed:`work.critical.sign_in_failed`,first_use:`work.critical.first_use`,rule_changed:`work.critical.rule_changed`},z={grant:`protocol.rule.grant`,audience:`protocol.rule.audience`,actions:`protocol.rule.actions`,ai_step_writes:`protocol.rule.ai_step_writes`,destructive:`protocol.rule.destructive`,policy:`protocol.rule.policy`,read:`protocol.rule.read`,own_job:`protocol.rule.own_job`,autonomous_mode:`protocol.rule.autonomous_mode`,guest_send:`protocol.rule.guest_send`,run:`protocol.rule.run`,paused:`protocol.rule.paused`,limits:`protocol.rule.limits`},B={admins:`protocol.audience.admins`,members:`protocol.audience.members`,all:`protocol.audience.all`};function V(e){return e in L}function H(e){return V(e)?A(L[e]):e}function ie(e){return V(e)?A(re[e]):e}function U(e){return e&&e in R?A(R[e]):``}function W(e){if(!e)return A(`protocol.rule.none`);if(e.startsWith(`rules.`))return A(`protocol.rule.rules`,{kind:H(e.slice(6))});let t=z[e]??z[e.split(`.`)[0]??``];return t?A(t):e}function G(e,t,n){return e===`run_ended`&&t&&t in I?A(I[t]):e&&e!==`denied`&&e in F?A(F[e]):t===`audience`?n&&n in B?A(`protocol.why.audienceFor`,{audience:A(B[n])}):A(`protocol.why.audience`):t===`actions`?A(`protocol.why.actions`):t===`grant`?A(`protocol.refused.not_in_grant`):t?.startsWith(`rules.`)?A(`protocol.why.rule`):A(`protocol.refused.denied`)}var ae={waiting_input:`runs.status.waiting_input`,sleeping:`runs.status.sleeping`,waiting_signal:`runs.status.waiting_signal`,running:`runs.status.running`,done:`runs.status.done`,failed:`runs.status.failed`,cancelled:`protocol.detail.runStopped`};function oe(e){let t=ae[e];return t?A(t):e}function se(e){return e===`running`||e===`waiting_input`||e===`sleeping`||e===`waiting_signal`}function ce(e){let{outcome:t,result:n,rule:r}=e;return n===null&&t!==`deny`?{tone:`held`,text:A(`protocol.outcome.running`)}:n===`ok`?{tone:`done`,text:A(t===`ask`?`protocol.outcome.doneApproved`:`protocol.outcome.done`)}:n===`already_done`?{tone:`done`,text:A(`protocol.outcome.alreadyDone`)}:n===`needs_approval`?{tone:`held`,text:A(`protocol.outcome.held`)}:n===`sign_in_failed`?{tone:`failed`,text:A(`protocol.outcome.signInFailed`)}:n===`nobody`||n===`not_connected`?{tone:`failed`,text:A(`protocol.outcome.notDone`,{why:A(F[n])})}:t===`deny`||n===`declined`?{tone:`refused`,text:A(`protocol.outcome.refused`,{why:G(n,r)})}:{tone:`failed`,text:A(`protocol.outcome.failed`,{error:n??``})}}function le(e){switch(e.kind){case`guest`:return A(`protocol.who.guest`);case`person`:return e.name??A(`protocol.who.person`);case`admin`:return e.name?A(`protocol.who.adminNamed`,{name:e.name}):A(`protocol.who.admin`);case`goose`:return e.name?A(`protocol.who.gooseFor`,{name:e.name}):A(`protocol.who.goose`);case`plugin`:return A(`protocol.who.plugin`,{name:e.id??``});case`runtime`:return A(`protocol.who.runtime`);case`step`:return e.for?e.for.kind===`guest`?A(`protocol.who.stepForGuest`):A(`protocol.who.stepFor`,{name:e.for.name??A(`protocol.who.person`)}):A(`protocol.who.step`);default:return e.kind}}function ue(e){return e.runId?e.wizardName?A(e.runMode===`test`?`protocol.where.testRunOf`:`protocol.where.runOf`,{wizard:e.wizardName}):A(`protocol.where.run`):e.chatId?e.chatTitle?A(`protocol.where.chatNamed`,{title:e.chatTitle}):A(`protocol.where.chat`):e.who.kind===`goose`?A(`protocol.where.goose`):e.who.kind===`plugin`?A(`protocol.where.plugin`):``}function de(e){let{connectionId:t}=e;return e.connectionName?e.connectorName&&!e.connectionName.includes(e.connectorName)?`${e.connectorName} · ${e.connectionName}`:e.connectionName:t.startsWith(`host:`)?A(`protocol.connection.host`,{host:t.slice(5)}):t===`mail:server`?A(`protocol.connection.serverMail`):t===`rwx`?A(`protocol.connection.rwx`):e.connectorName?`${e.connectorName} · ${t}`:t}function fe(e){switch(e.actionId){case`change_rules`:return e.input?.fields&&`paused`in e.input.fields?A(e.input.sample===`paused: yes`?`protocol.action.paused`:`protocol.action.resumed`):e.input?.fields&&Object.keys(e.input.fields).join()===`limits`?A(`protocol.action.limits`):A(`protocol.action.changeRules`);case`http_request`:return A(`protocol.action.request`);case`read_secret`:return A(`protocol.action.readSecret`);case`pull_stream`:return A(`protocol.action.pullStream`);case`send_message`:return e.actionName??A(`protocol.action.sendMail`);default:return e.actionName??e.actionId}}function pe(e,t){let n={who:t.who,connection:t.connection,verb:ie(e.action.kind)};return e.outcome===`allow`?A(`protocol.ask.allow`,n):e.outcome===`ask`?A(e.admins?`protocol.ask.askAdmins`:`protocol.ask.askPerson`,n):A(`protocol.ask.deny`,{...n,why:G(e.refused??null,e.rule,t.audience)})}function me(e){return e.fixedChannel?A(`protocol.ask.fixedChannel`):null}var K=e(O(),1);function he(){let[e,t]=g(),{space:n}=te(),i=j(),a=e.get(`show`),s=i&&(a===`ask`||a===`notify`)?a:null,c=e=>t(e?{show:e}:{},{replace:!0}),f=e.get(`connection`)??``,p=o({queryKey:[`broker-choices`,n?.id],queryFn:()=>r.get(`/api/studio/spaces/${n?.id}/broker/choices`),enabled:!!n&&i});return n?i?(0,K.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[(0,K.jsx)(q,{spaceId:n.id,connection:f,action:(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsxs)(l,{variant:`secondary`,size:`sm`,onClick:()=>c(`ask`),children:[(0,K.jsx)(T,{className:`size-4`}),` `,A(`protocol.ask.title`)]}),(0,K.jsx)(l,{variant:`secondary`,size:`sm`,onClick:()=>c(`notify`),"aria-label":A(`protocol.notify.title`),title:A(`protocol.notify.title`),children:(0,K.jsx)(u,{className:`size-4`})})]})}),(0,K.jsxs)(d,{open:s===`ask`,onClose:()=>c(null),wide:!0,title:A(`protocol.ask.title`),children:[(0,K.jsx)(`p`,{className:`-mt-2 mb-4 text-[0.875rem] text-ink-3`,children:A(`protocol.ask.hint`)}),(0,K.jsx)(we,{choices:p.data,spaceId:n.id})]}),(0,K.jsxs)(d,{open:s===`notify`,onClose:()=>c(null),title:A(`protocol.notify.title`),children:[(0,K.jsx)(`p`,{className:`-mt-2 mb-4 text-[0.875rem] text-ink-3`,children:A(`protocol.notify.hint`)}),(0,K.jsx)(Ee,{space:n})]})]}):(0,K.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:(0,K.jsx)(q,{spaceId:n.id,own:!0,connection:f})}):null}var ge={hour:36e5,day:864e5,week:6048e5,month:2592e6},_e=[`guest`,`person`,`admin`,`goose`,`plugin`,`step`,`runtime`],ve=50;function ye(e,t=300){let[n,r]=(0,P.useState)(e);return(0,P.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function q({spaceId:e,own:n=!1,connection:o=``,action:s}){let[c,u]=(0,P.useState)(`all`),[d,f]=(0,P.useState)(``),[p,g]=(0,P.useState)(o),[_,v]=(0,P.useState)(`week`),[y,b]=(0,P.useState)(``),x=ye(y).trim(),[C,w]=(0,P.useState)(null),T=ne(e).data?.connections??[],E=t({queryKey:[`broker-log`,e,{outcome:c,who:d,connection:p,range:_,q:x}],initialPageParam:null,queryFn:({pageParam:t})=>{let n=new URLSearchParams({limit:String(ve)});return c===`refused`?n.set(`refused`,`true`):c===`critical`?n.set(`critical`,`true`):c===`held`&&n.set(`result`,`needs_approval`),d&&n.set(`who`,d),p&&n.set(`connection`,p),_!==`all`&&n.set(`since`,new Date(Date.now()-ge[_]).toISOString()),x&&n.set(`q`,x),t&&n.set(`cursor`,t),r.get(`/api/studio/spaces/${e}/broker/log?${n}`)},getNextPageParam:e=>e.next}),D=E.data?.pages.flatMap(e=>e.lines)??[],O=c!==`all`||d!==``||p!==``||_!==`all`||x!==``,k=new Set(T.map(e=>e.id));return(0,K.jsx)(i,{title:A(`capabilities.protocol`),hint:A(n?`protocol.own.hint`:`protocol.hint`),action:s,plain:!0,children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-3`,children:(0,K.jsx)(ee,{value:c,onChange:u,label:A(`protocol.filter.outcome`),options:[{id:`all`,label:A(`protocol.filter.all`)},{id:`refused`,label:A(`protocol.filter.refused`)},{id:`critical`,label:A(`protocol.filter.critical`)},{id:`held`,label:A(`protocol.filter.held`)}]})}),(0,K.jsxs)(`div`,{className:S(`grid gap-2`,n?`sm:grid-cols-2`:`sm:grid-cols-3`),children:[n?null:(0,K.jsx)(h,{value:d,onChange:f,placeholder:A(`protocol.filter.everyone`),options:_e.map(e=>({value:e,label:A(`protocol.filter.who.${e}`)}))}),(0,K.jsx)(h,{value:p,onChange:g,placeholder:A(`protocol.filter.everyConnection`),options:T.map(e=>({value:e.id,label:e.connector?`${e.connector.name} · ${e.name}`:e.name}))}),(0,K.jsx)(h,{value:_,onChange:e=>v(e),options:[`hour`,`day`,`week`,`month`,`all`].map(e=>({value:e,label:A(`protocol.range.${e}`)}))})]}),(0,K.jsx)(a,{value:y,onChange:b,placeholder:A(n?`protocol.own.search`:`protocol.search`),busy:E.isFetching&&!E.isFetchingNextPage}),E.error?(0,K.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:E.error.message}):E.isPending?(0,K.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,K.jsx)(m,{className:`text-ink-3`})}):D.length===0?(0,K.jsx)(`p`,{className:`py-12 text-center text-[0.9375rem] text-ink-3`,children:A(O?`protocol.emptyFiltered`:n?`protocol.own.empty`:`protocol.empty`)}):(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:D.map(t=>(0,K.jsx)(`li`,{children:(0,K.jsx)(be,{line:t,spaceId:e,open:C===t.id,onToggle:()=>w(C===t.id?null:t.id),ofSpace:k.has(t.connectionId)})},t.id))}),E.hasNextPage?(0,K.jsx)(`div`,{className:`flex justify-center`,children:(0,K.jsx)(l,{variant:`quiet`,size:`sm`,busy:E.isFetchingNextPage,onClick:()=>void E.fetchNextPage(),children:A(`protocol.more`)})}):null]})})}var J={done:C,refused:N,held:f,failed:x},Y={done:`text-moss`,refused:`text-rose`,held:`text-ember`,failed:`text-ink-3`};function X(e,t=!1){return new Date(e).toLocaleString(k,{dateStyle:t?`medium`:`short`,timeStyle:t?`medium`:`short`})}function be({line:e,spaceId:t,open:n,onToggle:r,ofSpace:i}){let a=ce(e),o=J[a.tone],s=ue(e),c=e.critical||a.tone===`refused`;return(0,K.jsxs)(`div`,{className:S(`rounded-xl bg-card ring-1 transition`,e.critical?`ring-ember/50`:a.tone===`refused`?`ring-rose/40`:`ring-border-soft`),children:[(0,K.jsxs)(`button`,{type:`button`,onClick:r,"aria-expanded":n,className:`flex w-full items-start gap-3 px-3.5 py-3 text-left`,children:[(0,K.jsx)(o,{className:S(`mt-0.5 size-4 shrink-0`,Y[a.tone])}),(0,K.jsxs)(`span`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,K.jsxs)(`span`,{className:`text-[0.9375rem] text-ink leading-snug`,children:[(0,K.jsx)(`b`,{className:`font-medium`,children:le(e.who)}),` · `,H(e.kind),`: `,fe(e),` · `,de(e)]}),(0,K.jsxs)(`span`,{className:`text-[0.8125rem] text-ink-3 leading-snug`,children:[X(e.at),s?` · ${s}`:``,` · `,(0,K.jsx)(`span`,{className:S(c&&Y[a.tone],c&&`font-medium`),children:a.text})]})]}),e.critical?(0,K.jsx)(`span`,{className:`shrink-0`,children:(0,K.jsx)(y,{tone:`ember`,icon:(0,K.jsx)(E,{className:`size-3`}),title:U(e.criticalKind),children:A(`protocol.critical`)})}):null,(0,K.jsx)(v,{className:S(`mt-0.5 size-4 shrink-0 text-ink-4 transition-transform`,n&&`rotate-180`)})]}),n?(0,K.jsx)(xe,{line:e,spaceId:t,ofSpace:i}):null]})}function Z({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`grid gap-0.5 sm:grid-cols-[11rem_minmax(0,1fr)] sm:gap-3`,children:[(0,K.jsx)(`dt`,{className:`text-[0.8125rem] text-ink-3`,children:e}),(0,K.jsx)(`dd`,{className:`min-w-0 break-words text-[0.875rem] text-ink-2`,children:t})]})}function xe({line:e,spaceId:t,ofSpace:i}){let a=o({queryKey:[`broker-line`,t,e.id],queryFn:()=>r.get(`/api/studio/spaces/${t}/broker/log/${e.id}`)}),s=a.data?.run,u=j(),d=_(),f=n({mutationFn:()=>r.post(`/api/runs/${e.runId}/cancel`),onSuccess:()=>d.invalidateQueries({queryKey:[`broker-line`,t]})}),p=e.input,h=Object.keys(p?.fields??{}),g=e.connectionId.startsWith(`host:`);return(0,K.jsxs)(`div`,{className:`border-border-soft border-t px-3.5 py-3`,children:[(0,K.jsxs)(`dl`,{className:`grid gap-2`,children:[(0,K.jsxs)(Z,{label:A(`protocol.detail.when`),children:[X(e.at,!0),` · `,A(`protocol.detail.duration`,{ms:e.durationMs})]}),e.critical?(0,K.jsx)(Z,{label:A(`protocol.critical`),children:U(e.criticalKind)}):null,(0,K.jsxs)(Z,{label:A(`protocol.detail.input`),children:[h.length?A(`protocol.detail.inputFields`,{fields:h.join(`, `),size:p?.size??0}):A(`protocol.detail.inputEmpty`),p?.sample?(0,K.jsx)(`span`,{className:`mt-0.5 block font-mono text-[0.8125rem] text-ink-3`,children:p.sample}):null]}),(0,K.jsx)(Z,{label:A(`protocol.detail.result`),children:e.resultSize===null?A(`protocol.detail.resultNone`):A(`protocol.detail.resultSize`,{size:e.resultSize})}),(0,K.jsxs)(Z,{label:A(`protocol.detail.rule`),children:[W(e.rule),e.reason?(0,K.jsx)(`span`,{className:`mt-0.5 block text-[0.8125rem] text-ink-3`,children:e.reason}):null]}),s?(0,K.jsx)(Z,{label:A(`protocol.detail.run`),children:oe(s.status)}):null,e.runId?(0,K.jsx)(Z,{label:A(`protocol.detail.grant`),children:a.isPending?(0,K.jsx)(m,{className:`size-4 text-ink-3`}):i?A(`protocol.detail.grantSpace`):s?.grant?g?s.grant.hosts.length?A(`protocol.detail.grantHosts`,{hosts:s.grant.hosts.join(`, `)}):A(`protocol.detail.grantNoHosts`):s.grant.actions?.length?A(`protocol.detail.grantActions`,{actions:s.grant.actions.join(`, `)}):A(`protocol.detail.grantNoActions`):A(`protocol.detail.grantNone`)}):null]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[e.runId&&e.wizardId?(0,K.jsx)(Q,{to:`/edit/${e.wizardId}?run=${e.runId}`,children:A(`protocol.detail.openRun`)}):null,e.chatId?(0,K.jsx)(Q,{to:`/work/c/${e.chatId}`,children:A(`protocol.detail.openChat`)}):null,i?(0,K.jsx)(Q,{to:`/capabilities/connectors?show=${e.connectionId}`,children:A(`protocol.detail.openConnection`)}):null,u&&s&&se(s.status)?(0,K.jsx)(`span`,{className:`sm:ml-auto`,children:(0,K.jsx)(l,{variant:`danger`,size:`sm`,busy:f.isPending,onClick:async()=>{await c(A(`protocol.detail.stopRunAsk`),{detail:A(`protocol.detail.stopRunDetail`),action:A(`protocol.detail.stopRun`)})&&f.mutate()},children:A(`protocol.detail.stopRun`)})}):null]}),f.error?(0,K.jsx)(`p`,{className:`mt-2 text-[0.8125rem] text-rose`,children:f.error.message}):null]})}function Q({to:e,children:t}){return(0,K.jsx)(p,{to:e,className:`inline-flex h-8 items-center rounded-full bg-paper-2 px-3 font-medium text-[0.8125rem] text-ink transition hover:bg-paper-3 coarse:h-11 coarse:px-4`,children:t})}function Se(e,t){if(e.startsWith(`person:`)){let n=t.people.find(t=>`person:${t.id}`===e);return{who:n&&n.role!==`member`?`admin`:`person`}}return e.startsWith(`step:`)?{who:`step`,for:e.slice(5)}:{who:e}}function Ce(e,t){return e.startsWith(`person:`)?t.people.find(t=>`person:${t.id}`===e)?.name??``:A(e===`guest`?`protocol.ask.who.guest`:e===`goose`?`protocol.ask.who.goose`:`protocol.ask.who.step`)}function we({choices:e,spaceId:t}){let[n,i]=(0,P.useState)(``),[a,s]=(0,P.useState)(``),[c,l]=(0,P.useState)(``),[u,d]=(0,P.useState)(`run`),f=e?.connections.find(e=>e.id===a),p=f?.actions.find(e=>e.id===c),g=n.startsWith(`step:`)?`run`:u,_=!!(e&&n&&f&&p),v=o({queryKey:[`broker-ask`,t,n,a,c,g],queryFn:()=>{let i=new URLSearchParams({...Se(n,e),resource:a,action:c,in:g});return r.get(`/api/studio/spaces/${t}/broker/ask?${i}`)},enabled:_});if(!e)return(0,K.jsx)(`div`,{className:`flex justify-center py-12`,children:(0,K.jsx)(m,{className:`text-ink-3`})});let y=[...e.people.map(e=>({value:`person:${e.id}`,label:e.role===`member`?e.name:A(`protocol.who.adminNamed`,{name:e.name})})),{value:`guest`,label:A(`protocol.ask.who.guest`)},{value:`goose`,label:A(`protocol.ask.who.goose`)},{value:`step:guest`,label:A(`protocol.ask.who.stepGuest`)},{value:`step:person`,label:A(`protocol.ask.who.stepPerson`)}];return(0,K.jsx)(K.Fragment,{children:e.connections.length===0?(0,K.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:A(`protocol.ask.noConnections`)}):(0,K.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,K.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,K.jsx)($,{label:A(`protocol.ask.who`),children:(0,K.jsx)(h,{value:n,onChange:e=>i(e),placeholder:A(`protocol.ask.choose`),options:y})}),(0,K.jsx)($,{label:A(`protocol.ask.connection`),children:(0,K.jsx)(h,{value:a,onChange:e=>{s(e),l(``)},placeholder:A(`protocol.ask.choose`),options:e.connections.map(e=>({value:e.id,label:e.connector?`${e.connector.name} · ${e.name}`:e.name}))})}),(0,K.jsx)($,{label:A(`protocol.ask.action`),children:(0,K.jsx)(h,{value:c,onChange:l,placeholder:A(`protocol.ask.choose`),options:(f?.actions??[]).map(e=>({value:e.id,label:`${e.name} (${H(e.kind)})`}))})}),(0,K.jsx)($,{label:A(`protocol.ask.where`),children:(0,K.jsx)(h,{value:g,onChange:e=>d(e),options:[{value:`run`,label:A(`protocol.ask.inRun`)},{value:`chat`,label:A(`protocol.ask.inChat`),disabled:n.startsWith(`step:`)}]})})]}),(0,K.jsx)(`div`,{className:`rounded-xl bg-paper-2 px-4 py-3.5`,children:_?v.error?(0,K.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:v.error.message}):v.data?(0,K.jsx)(Te,{answer:v.data,who:Ce(n,e),connection:f?f.connector?`${f.connector.name} · ${f.name}`:f.name:``,audience:f?.audience}):(0,K.jsx)(m,{className:`size-4 text-ink-3`}):(0,K.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:A(`protocol.ask.pick`)})})]})})}function Te({answer:e,who:t,connection:n,audience:r}){let i=e.outcome===`allow`?`done`:e.outcome===`ask`?`held`:`refused`,a=J[i],o=me(e);return(0,K.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,K.jsx)(a,{className:S(`mt-1 size-4 shrink-0`,Y[i])}),(0,K.jsxs)(`div`,{className:`grid min-w-0 gap-1.5`,children:[(0,K.jsx)(`p`,{className:`font-medium text-[0.9375rem] text-ink leading-snug`,children:pe(e,{who:t,connection:n,audience:r})}),o?(0,K.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2`,children:o}):null,(0,K.jsx)(`p`,{className:`text-[0.8125rem] text-ink-3`,children:A(`protocol.ask.rule`,{rule:W(e.rule)})}),(0,K.jsx)(`div`,{children:(0,K.jsx)(Q,{to:`/capabilities/connectors?show=${e.connection.id}`,children:A(`protocol.ask.change`)})})]})]})}function $({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsx)(`span`,{className:`font-medium text-[0.8125rem] text-ink-2`,children:e}),t]})}function Ee({space:e}){let t=_(),[n,i]=(0,P.useState)(!1),[a,o]=(0,P.useState)(null),c=e.notify??{bell:!0,mail:`hourly`},l=async n=>{i(!0),o(null);try{await r.patch(`/api/studio/spaces/${e.id}`,{notify:n}),await t.invalidateQueries({queryKey:s.spaces()})}catch(e){o(e.message)}finally{i(!1)}},u=e.readOnly||n;return(0,K.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,K.jsx)(De,{label:A(`protocol.notify.bell`),hint:A(`protocol.notify.bellHint`),checked:c.bell,disabled:u,onChange:e=>void l({...c,bell:e})}),(0,K.jsx)(De,{label:A(`protocol.notify.mail`),hint:A(`protocol.notify.mailHint`),checked:c.mail===`hourly`,disabled:u,onChange:e=>void l({...c,mail:e?`hourly`:`off`})}),a?(0,K.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:a}):null]})}function De({label:e,hint:t,checked:n,disabled:r,onChange:i}){return(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`font-medium text-[0.9375rem] text-ink`,children:e}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3`,children:t})]}),(0,K.jsx)(b,{checked:n,onChange:i,label:e,disabled:r})]})}export{he as n,N as r,Ee as t};
|