wizards 0.2.1 → 0.2.2

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.
Files changed (23) hide show
  1. package/README.md +4 -1
  2. package/apps/runtime/dist/env.js +1 -1
  3. package/apps/runtime/dist/plugins/loader.js +23 -1
  4. package/apps/web/dist/assets/{ChangelogDialog-Co_9fs61.js → ChangelogDialog-4HCt88rf.js} +1 -1
  5. package/apps/web/dist/assets/{ChatPanel-Br3nYkUc.js → ChatPanel-B91fTrzg.js} +1 -1
  6. package/apps/web/dist/assets/{EditorPage-BSjQC6FE.js → EditorPage-ZZjb9mGV.js} +1 -1
  7. package/apps/web/dist/assets/{HomePage-8v4HqIbP.js → HomePage-Cn5TCZk7.js} +1 -1
  8. package/apps/web/dist/assets/{LocalRuntime-CTyLGC98.js → LocalRuntime-DupxjXff.js} +1 -1
  9. package/apps/web/dist/assets/{NewWizardPage-BBL2yenw.js → NewWizardPage-Bz3PIQGp.js} +1 -1
  10. package/apps/web/dist/assets/{PublicRunner-BwtoEVlE.js → PublicRunner-Axs1zwqe.js} +1 -1
  11. package/apps/web/dist/assets/{RunnerView-DOizlTad.js → RunnerView-Bhv6RNME.js} +1 -1
  12. package/apps/web/dist/assets/{SettingsPage-CBDv04YS.js → SettingsPage-in_RmI8i.js} +1 -1
  13. package/apps/web/dist/assets/{SetupPage-CfXTOaIm.js → SetupPage-xiqJMR0J.js} +1 -1
  14. package/apps/web/dist/assets/{SharePage-CgByqrAF.js → SharePage-C8B9BUSU.js} +1 -1
  15. package/apps/web/dist/assets/changelog-C2LDEzLQ.js +1 -0
  16. package/apps/web/dist/assets/{index-BmpnE7IO.js → index-2Ktgo6f1.js} +2 -2
  17. package/apps/web/dist/assets/{outputs-COE_nvAw.js → outputs-Dhqtf-SA.js} +1 -1
  18. package/apps/web/dist/index.html +1 -1
  19. package/modules/README.md +1 -1
  20. package/node_modules/@engenty-wizards/plugin-sdk/dist/index.d.ts +24 -1
  21. package/node_modules/@engenty-wizards/plugin-sdk/dist/studio.d.ts +1 -1
  22. package/package.json +1 -1
  23. package/apps/web/dist/assets/changelog-03JgixQA.js +0 -1
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-CjUK5046.js","assets/jsx-runtime-D3jfb0Ew.js","assets/ui-Cs6lpsmj.js","assets/esm-rJY59Ixx.js","assets/react-dom-DenslgJm.js"])))=>i.map(i=>d[i]);
2
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{A as r,F as i,I as a,K as o,M as s,N as c,O as l,d as u,g as d,j as f,n as p,nt as m}from"./api-KMi35npD.js";import{a as h,c as g}from"./session-B6-6VomQ.js";import{t as _}from"./preload-helper-CNEI7N0N.js";import{t as v}from"./createLucideIcon-q3MZMmnf.js";import{n as y,t as b}from"./plug-CLjyCoHB.js";import{t as ee}from"./arrow-right-6FyN3e7D.js";import{c as x,l as S,o as C,s as w,t as te}from"./meta-4R1Lnr25.js";import{t as T}from"./check-CUpby_J9.js";import{n as ne,r as re,t as ie}from"./wand-sparkles-CKxArWPY.js";import{n as ae,t as oe}from"./mic-Bvz4mA2j.js";import{i as se,n as E,r as ce,t as le}from"./type-Bj9H3eOK.js";import{n as ue,t as D}from"./video-CjgmvRDk.js";import{l as de,u as fe}from"./engenty-Cm8yZLON.js";import{_ as O,d as k,h as A,i as pe,m as me,n as he,r as ge,t as j,y as M}from"./ui-Cs6lpsmj.js";import{l as N}from"./index-BmpnE7IO.js";import{t as _e}from"./ImportWizard-DiV62Uno.js";var ve=class extends c{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:o,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:i(t,n.data),hasPreviousPage:a(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function ye(e,t){return s(e,ve,t)}var P={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};P.node;var be=v(P),F={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`]};F.node;var I=v(F),L={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`}]]};L.node;var xe=v(L),R={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`}]]};R.node;var Se=v(R),z={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`}]]};z.node;var Ce=v(z),B={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};B.node;var V=v(B),H={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`}]]};H.node;var we=v(H),Te={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`}]]};Te.node;var Ee=v(Te),De={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};De.node;var Oe=v(De),ke={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`}]]};ke.node;var Ae=v(ke),je={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};je.node;var Me=v(je),Ne={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Ne.node;var Pe=v(Ne),Fe={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};Fe.node;var Ie=v(Fe),U=e(t(),1),W={text:{de:`Text`,en:`Text`},document:{de:`Dokument (PDF, Word)`,en:`Document (PDF, Word)`},table:{de:`Tabelle`,en:`Table`},image:{de:`Bild`,en:`Image`},video:{de:`Video`,en:`Video`},audio:{de:`Audio`,en:`Audio`},dashboard:{de:`Dashboard`,en:`Dashboard`}},Le={any:{de:`Jede Branche`,en:`Any industry`},trades:{de:`Handwerk`,en:`Trades`},gastronomy:{de:`Gastronomie`,en:`Food service`},hospitality:{de:`Hotel & Tourismus`,en:`Hotels & tourism`},realEstate:{de:`Immobilien`,en:`Real estate`},retail:{de:`Handel`,en:`Retail`},health:{de:`Gesundheit`,en:`Health`},professional:{de:`Kanzlei & Beratung`,en:`Professional services`},agency:{de:`Agentur & Marketing`,en:`Agency & marketing`},events:{de:`Veranstaltungen`,en:`Events`},publicSector:{de:`Vereine & Öffentliches`,en:`Associations & public sector`}},Re={marketing:{de:`Marketing & Social Media`,en:`Marketing & social media`},sales:{de:`Angebote & Verkauf`,en:`Offers & sales`},accounting:{de:`Buchhaltung & Belege`,en:`Accounting & receipts`},service:{de:`Kundenservice`,en:`Customer service`},research:{de:`Recherche & Analyse`,en:`Research & analysis`},hr:{de:`Personal & Bewerbungen`,en:`HR & applications`},operations:{de:`Planung & Abläufe`,en:`Planning & operations`},website:{de:`Helfer für die Website`,en:`Website helpers`}},G={text:{de:`Text schreiben`,en:`Writes text`},web:{de:`Websuche`,en:`Web search`},browser:{de:`Browser bedienen`,en:`Drives a browser`},documents:{de:`Dokumente & Fotos lesen`,en:`Reads documents & photos`},image:{de:`Bilder erzeugen`,en:`Makes images`},video:{de:`Videos erzeugen`,en:`Makes video`},speech:{de:`Sprachausgabe`,en:`Speech output`},listening:{de:`Sprachnotizen verstehen`,en:`Understands voice notes`},code:{de:`Code ausführen`,en:`Runs code`},connectors:{de:`Verbundene Konten & Systeme`,en:`Connected accounts & systems`}},ze={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},K=e=>Object.keys(e);K(W),K(Le),K(Re),K(G);var q=e(n(),1),Be=(0,U.lazy)(()=>_(()=>import(`./FlowPreview-CjUK5046.js`),__vite__mapDeps([0,1,2,3,4]))),Ve={useCase:``,industry:``,format:``,capability:``},J=(e,t)=>e[t]?.[O]??t;function He(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function Ue(e){return e.credits?M(`market.credits`,{n:He(e.credits.credits)}):ze[e.costTier][O]}var We={text:le,document:ae,table:Me,image:w,video:D,audio:be,dashboard:I};function Y({format:e,className:t}){let n=We[e],r=J(W,e);return(0,q.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,q.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var Ge=[`low`,`medium`,`high`];function X({entry:e}){let t=Ge.indexOf(e.costTier)+1,n=O===`de`?Se:xe;return(0,q.jsxs)(`span`,{title:Ue(e),className:`inline-flex items-center gap-1`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:Ge.slice(0,t).map((e,t)=>(0,q.jsx)(`span`,{className:A(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,q.jsx)(n,{className:`size-4`})},e))}),ze[e.costTier][O]]})}function Ke({entry:e,onOpen:t}){return(0,q.jsxs)(he,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:A(`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.missing.length>0)&&`opacity-60`),children:[(0,q.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,q.jsx)(u,{kind:e.avatar,size:68,interactive:!1})}),(0,q.jsxs)(`div`,{className:`min-w-0 pr-20`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 font-display font-semibold text-[15px]`,children:[e.title,e.starred?(0,q.jsx)(E,{className:`size-3.5 shrink-0 fill-amber text-amber`,"aria-label":M(`market.starred`)}):null]}),(0,q.jsx)(`div`,{className:`mt-0.5 text-[13px] text-ink-3 leading-snug`,children:e.pitch})]}),(0,q.jsx)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[12px] text-ink-3`,children:e.usable&&e.missing.length?(0,q.jsx)(ge,{tone:`warn`,children:M(`market.missing`,{list:qe(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)(V,{className:`size-3.5`}),` `,M(`market.minutes`,{n:e.effort.minutes})]}),(0,q.jsx)(X,{entry:e}),(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)(ge,{tone:`warn`,children:M(`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-[12px] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var qe=e=>e.map(e=>J(G,e)).join(`, `),Je={text:ue,web:se,browser:Oe,documents:Ae,image:w,video:D,speech:Ie,listening:oe,code:Pe,connectors:b};function Ye(e){switch(e.type){case`page`:return C;case`agent`:return S;case`generate`:return e.asset===`image`?w:e.asset===`video`?D:e.asset===`voice`?Ie:e.asset===`dashboard`?I:ae;case`widget`:return e.video?Ce:y;case`review`:return ne;case`result`:return x}return ie}function Xe(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 Ze(e){let t=Xe(e);return e.map(e=>({id:e.id,title:e.title,icon:Ye(e),tone:te[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function Q({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 $({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-[14px] text-ink leading-snug`,children:t}),n?(0,q.jsx)(`div`,{className:`text-[12px] text-ink-3 leading-snug`,children:n}):null]})]})}function Qe({className:e,children:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)({above:!1,below:!1});(0,U.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})})}function $e({id:e,fallback:t,onClose:n,onUse:r,busy:i}){let a=m(),o=l(),s=f({queryKey:[`marketplace-entry`,e,O],queryFn:()=>p.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${O}`),enabled:!!e,retry:!1}),c=s.data??t,h=g({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?p.put(n):p.del(n)},onSuccess:()=>Promise.all([a.invalidateQueries({queryKey:[`marketplace`]}),a.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),_=d()===`dark`,v=de[fe[c?.avatar||`round`]],y=_?`var(--card)`:`color-mix(in oklch, ${v??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,q.jsx)(pe,{open:!!e,onClose:n,wide:!0,bare:!0,children:c?(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":M(`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)(N,{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:y,"--coin-bg":y},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:A(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,_?`opacity-[0.14]`:`opacity-80`)})}),(0,q.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,q.jsx)(u,{kind:c.avatar,size:104})}),(0,q.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,q.jsx)(`h2`,{className:`font-display font-semibold text-[22px] leading-tight tracking-tight max-sm:pr-10`,children:c.title}),(0,q.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-2 leading-snug`,children:s.data?.description||c.pitch})]}),c.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-[14px] sm:px-7 sm:pr-40`,children:[(0,q.jsxs)(Q,{title:M(`market.duration`),children:[(0,q.jsx)(V,{className:`size-4 text-ink-3`}),M(`market.minutes`,{n:c.effort.minutes})]}),(0,q.jsx)(Q,{title:M(`market.cost`),children:(0,q.jsx)(X,{entry:c})}),(0,q.jsx)(Q,{title:M(`market.result`),children:c.formats.map(e=>(0,q.jsx)(Y,{format:e,className:`size-4`},e))})]}):null]}),c.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:M(`market.duration`),children:(0,q.jsx)($,{icon:(0,q.jsx)(V,{className:`size-4 text-moss`}),more:M(`market.durationHint`,{n:c.effort.fields}),children:M(`market.minutes`,{n:c.effort.minutes})})}),(0,q.jsx)(Z,{title:M(`market.cost`),children:(0,q.jsx)($,{icon:(0,q.jsx)(Ee,{className:`size-4 text-amber`}),more:c.credits?M(`market.creditsHint`):void 0,children:(0,q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,q.jsx)(X,{entry:c}),c.credits?(0,q.jsx)(`span`,{className:`text-ink-2`,children:M(`market.creditsRange`,{n:He(c.credits.credits)})}):null]})})}),(0,q.jsx)(Z,{title:M(`market.result`),children:(0,q.jsx)(`div`,{className:`flex flex-col gap-2`,children:(s.data?.results??[]).map(e=>(0,q.jsx)($,{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.jsx)(Z,{title:M(`market.needs`),children:(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:c.capabilities.map(e=>{let t=Je[e],n=c.missing.includes(e);return(0,q.jsxs)(`li`,{className:A(`flex items-center gap-2.5 text-[14px]`,n?`text-ink-3`:`text-ink-2`),children:[(0,q.jsx)(t,{className:A(`size-4 shrink-0`,n?`text-rose`:`text-cobalt`)}),J(G,e),n?(0,q.jsx)(`span`,{className:`text-[12px] text-rose`,children:M(`market.unavailable`)}):null]},e)})})})]}),(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-[12px] text-ink-3 uppercase tracking-[0.06em]`,children:M(`market.steps`)}),(0,q.jsx)(Qe,{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`}):(0,q.jsx)(U.Suspense,{fallback:(0,q.jsx)(k,{className:`size-5 text-ink-3`}),children:(0,q.jsx)(Be,{steps:Ze(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-[14px] text-ink-2`,children:M(`market.needsUpdateHint`)})}),(0,q.jsxs)(`div`,{className:`flex shrink-0 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:[(0,q.jsxs)(j,{variant:`ghost`,className:`mr-auto`,title:M(`market.starHint`),"aria-pressed":c.starred,busy:h.isPending,onClick:()=>h.mutate(!c.starred),children:[(0,q.jsx)(E,{className:A(`size-4`,c.starred&&`fill-amber text-amber`)}),(0,q.jsx)(`span`,{className:`max-sm:sr-only`,children:M(c.starred?`market.starred`:`market.star`)})]}),(0,q.jsx)(j,{variant:`secondary`,onClick:n,children:M(`common.close`)}),c.usable&&c.missing.length?(0,q.jsx)(j,{variant:`secondary`,onClick:()=>o(`/settings/models`),children:M(`editor.models.settings`)}):null,(0,q.jsx)(j,{disabled:!c.usable||c.missing.length>0,title:c.missing.length?M(`market.missingHint`,{list:qe(c.missing)}):void 0,busy:i,onClick:()=>r(c),children:M(`market.use`)})]})]}):(0,q.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[14px] 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:M(`market.notFound`)}),(0,q.jsx)(j,{variant:`secondary`,onClick:n,children:M(`common.close`)})]})})})}function et({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(null);(0,U.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:A(`flex h-8 items-center rounded-full text-[13px] 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:A(`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)(re,{className:A(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,q.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${M(`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)(N,{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:A(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[14px] 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)(T,{className:`size-4 text-ember`}):e.unavailable?(0,q.jsx)(`span`,{className:`whitespace-nowrap text-[12px] text-ink-4`,children:M(`market.unavailable`)}):(0,q.jsx)(`span`,{className:`text-[12px] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function tt(e,t){let[n,r]=(0,U.useState)(e);return(0,U.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var nt=60;function rt({onUse:e,busy:t,open:n}){let[r,i]=(0,U.useState)(``),[a,s]=(0,U.useState)(Ve),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(n??null),f=tt(r.trim(),250),m=ye({queryKey:[`marketplace`,O,f,a,c],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:O,limit:String(nt),offset:String(e)});f&&t.set(`q`,f);for(let[e,n]of Object.entries(a))n&&t.set(e,n);return c&&t.set(`starred`,`1`),p.get(`/api/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:o}),h=m.data?.pages[0],g=m.data?.pages.flatMap(e=>e.entries)??[],_=h?.all??0,v=r.trim()!==f||m.isFetching&&!m.isFetchingNextPage,y=(e,t,n)=>Object.keys(t).filter(t=>h?.facets[e]?.[t]!==void 0).map(r=>({value:r,label:J(t,r),icon:n?.(r),count:(h?.facets[e])[r]??0,unavailable:e===`capability`&&b.has(r)})),b=new Set(h?.unavailable??[]),ee=y(`useCase`,Re),x=[{key:`industry`,name:M(`market.industry`),options:y(`industry`,Le)},{key:`format`,name:M(`market.format`),options:y(`format`,W,e=>(0,q.jsx)(Y,{format:e,className:`size-4 text-ink-3`}))},{key:`capability`,name:M(`market.capability`),options:y(`capability`,G,e=>{let t=Je[e];return(0,q.jsx)(t,{className:`size-4 text-ink-3`})})}],S=!!r.trim()||c||Object.values(a).some(Boolean),C=()=>{s(Ve),i(``),l(!1)};if(m.isLoading)return(0,q.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,q.jsx)(k,{className:`size-6 text-ink-3`})});let w=h?.offline?(0,q.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[13px] text-ink-3`,children:[(0,q.jsx)(we,{className:`size-4 shrink-0`}),M(`market.offline`)]}):null;if(!_&&!S)return w;let te=r?(0,q.jsx)(`button`,{type:`button`,"aria-label":M(`market.reset`),onClick:()=>i(``),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)(N,{className:`size-4`})}):null,T=e=>A(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[12.5px] 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`,{className:`relative mx-auto flex h-10 max-w-md 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:[v?(0,q.jsx)(k,{className:`size-4 shrink-0 text-ink-3`}):(0,q.jsx)(ce,{className:`size-4 shrink-0 text-ink-3`}),(0,q.jsx)(`input`,{type:`search`,value:r,onChange:e=>i(e.target.value),placeholder:M(`market.search`),"aria-label":M(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[15px] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),te]}),w,(0,q.jsxs)(`div`,{className:`max-sm:-mx-4 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-4 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:M(`market.all`)},...ee].map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":!c&&a.useCase===e.value,onClick:()=>{l(!1),s({...a,useCase:e.value})},className:T(!c&&a.useCase===e.value),children:e.label},e.value)),(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>l(!c),className:T(c),children:[(0,q.jsx)(E,{className:A(`size-3.5`,c&&`fill-amber text-amber`)}),M(`market.starred`)]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[c?null:x.map(e=>(0,q.jsx)(et,{name:e.name,value:a[e.key],options:e.options,onChange:t=>s({...a,[e.key]:t})},e.key)),(0,q.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[13px] text-ink-3`,children:[S?(0,q.jsxs)(`button`,{type:`button`,onClick:C,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,q.jsx)(N,{className:`size-3.5 max-sm:size-4`}),(0,q.jsx)(`span`,{className:`max-sm:sr-only`,children:M(`market.resetShort`)})]}):null,S?(0,q.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:M(`market.countOfShort`,{n:h?.total??0,all:_})}):null,(0,q.jsx)(`span`,{className:A(`tabular-nums`,S&&`max-sm:hidden`),children:S?M(`market.countOf`,{n:h?.total??0,all:_}):M(`market.count`,{n:_})})]})]}),g.length?(0,q.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:g.map(e=>(0,q.jsx)(Ke,{entry:e,onOpen:()=>d(e.id)},e.id))}):(0,q.jsxs)(`div`,{className:`py-10 text-center text-[14px] text-ink-3`,children:[(0,q.jsx)(`p`,{children:M(c?`market.noneStarred`:`market.none`)}),(0,q.jsx)(j,{variant:`ghost`,className:`mt-2`,onClick:C,children:M(`market.reset`)})]}),m.hasNextPage?(0,q.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,q.jsx)(j,{variant:`secondary`,busy:m.isFetchingNextPage,onClick:()=>void m.fetchNextPage(),children:M(`market.more`)})}):null,(0,q.jsx)($e,{id:u,fallback:g.find(e=>e.id===u)??null,onClose:()=>d(null),onUse:e,busy:t})]})}var it={de:[`Stellenanzeige aus ein paar Stichworten, als PDF und LinkedIn-Post`,`Produktbeschreibung für den Onlineshop mit drei Bildvarianten`,`Wettbewerbsanalyse zu einer Firma mit Quellen`,`Lead aus einem Formular in unser CRM eintragen`],en:[`A job ad from a few keywords, as PDF and LinkedIn post`,`A shop product description with three image variants`,`A competitor analysis for a company, with sources`,`Put a lead from a form into our CRM`]};function at(){let e=l(),t=m(),{project:n}=h(),[i,a]=(0,U.useState)(``),[o]=r(),s=g({mutationFn:e=>p.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:O}),onSuccess:async({id:n},r)=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(r?`/edit/${n}`:`/edit/${n}?prompt=${encodeURIComponent(i.trim())}`)}}),c=()=>{i.trim()&&n&&s.mutate(void 0)};return(0,q.jsxs)(`div`,{className:`animate-rise pt-4`,children:[(0,q.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,q.jsx)(u,{kind:`sprout`,size:150,fluffy:!0}),(0,q.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[32px] leading-tight tracking-tight sm:text-[38px]`,children:M(`new.title`)})]}),(0,q.jsxs)(`div`,{className:`mt-8 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus`,children:[(0,q.jsx)(me,{autoFocus:!0,minRows:4,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&c()},placeholder:M(`new.placeholder`),className:`border-0 bg-transparent text-[16px] shadow-none focus:ring-0`}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-1`,children:[(0,q.jsx)(`span`,{className:`hidden text-[12px] text-ink-4 sm:block`,children:M(`new.hint`)}),(0,q.jsxs)(j,{size:`md`,onClick:c,busy:s.isPending&&!s.variables,disabled:!i.trim(),children:[M(`new.build`),` `,(0,q.jsx)(ee,{className:`size-4`})]})]})]}),(0,q.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:it[O].map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:`rounded-full bg-paper-2 px-3.5 py-1.5 text-[13px] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e))})]}),(0,q.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,q.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[13px] text-ink-3 uppercase tracking-[0.08em]`,children:M(`new.orStarter`)}),(0,q.jsx)(rt,{open:o.get(`starter`),busy:s.isPending&&!!s.variables,onUse:e=>n&&!s.isPending&&s.mutate(e.id)}),s.error?(0,q.jsx)(`p`,{className:`mt-3 text-center text-[14px] text-rose`,children:s.error.message}):null]}),(0,q.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,q.jsx)(_e,{variant:`ghost`,label:M(`new.import`)})})]})}export{at as NewWizardPage};
2
+ import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{A as r,F as i,I as a,K as o,M as s,N as c,O as l,d as u,g as d,j as f,n as p,nt as m}from"./api-KMi35npD.js";import{a as h,c as g}from"./session-B6-6VomQ.js";import{t as _}from"./preload-helper-CNEI7N0N.js";import{t as v}from"./createLucideIcon-q3MZMmnf.js";import{n as y,t as b}from"./plug-CLjyCoHB.js";import{t as ee}from"./arrow-right-6FyN3e7D.js";import{c as x,l as S,o as C,s as w,t as te}from"./meta-4R1Lnr25.js";import{t as T}from"./check-CUpby_J9.js";import{n as ne,r as re,t as ie}from"./wand-sparkles-CKxArWPY.js";import{n as ae,t as oe}from"./mic-Bvz4mA2j.js";import{i as se,n as E,r as ce,t as le}from"./type-Bj9H3eOK.js";import{n as ue,t as D}from"./video-CjgmvRDk.js";import{l as de,u as fe}from"./engenty-Cm8yZLON.js";import{_ as O,d as k,h as A,i as pe,m as me,n as he,r as ge,t as j,y as M}from"./ui-Cs6lpsmj.js";import{l as N}from"./index-2Ktgo6f1.js";import{t as _e}from"./ImportWizard-DiV62Uno.js";var ve=class extends c{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:o,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:i(t,n.data),hasPreviousPage:a(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function ye(e,t){return s(e,ve,t)}var P={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};P.node;var be=v(P),F={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`]};F.node;var I=v(F),L={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`}]]};L.node;var xe=v(L),R={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`}]]};R.node;var Se=v(R),z={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`}]]};z.node;var Ce=v(z),B={name:`clock`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]};B.node;var V=v(B),H={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`}]]};H.node;var we=v(H),Te={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`}]]};Te.node;var Ee=v(Te),De={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};De.node;var Oe=v(De),ke={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`}]]};ke.node;var Ae=v(ke),je={name:`table-2`,size:24,node:[[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}]]};je.node;var Me=v(je),Ne={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Ne.node;var Pe=v(Ne),Fe={name:`volume-2`,size:24,node:[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]};Fe.node;var Ie=v(Fe),U=e(t(),1),W={text:{de:`Text`,en:`Text`},document:{de:`Dokument (PDF, Word)`,en:`Document (PDF, Word)`},table:{de:`Tabelle`,en:`Table`},image:{de:`Bild`,en:`Image`},video:{de:`Video`,en:`Video`},audio:{de:`Audio`,en:`Audio`},dashboard:{de:`Dashboard`,en:`Dashboard`}},Le={any:{de:`Jede Branche`,en:`Any industry`},trades:{de:`Handwerk`,en:`Trades`},gastronomy:{de:`Gastronomie`,en:`Food service`},hospitality:{de:`Hotel & Tourismus`,en:`Hotels & tourism`},realEstate:{de:`Immobilien`,en:`Real estate`},retail:{de:`Handel`,en:`Retail`},health:{de:`Gesundheit`,en:`Health`},professional:{de:`Kanzlei & Beratung`,en:`Professional services`},agency:{de:`Agentur & Marketing`,en:`Agency & marketing`},events:{de:`Veranstaltungen`,en:`Events`},publicSector:{de:`Vereine & Öffentliches`,en:`Associations & public sector`}},Re={marketing:{de:`Marketing & Social Media`,en:`Marketing & social media`},sales:{de:`Angebote & Verkauf`,en:`Offers & sales`},accounting:{de:`Buchhaltung & Belege`,en:`Accounting & receipts`},service:{de:`Kundenservice`,en:`Customer service`},research:{de:`Recherche & Analyse`,en:`Research & analysis`},hr:{de:`Personal & Bewerbungen`,en:`HR & applications`},operations:{de:`Planung & Abläufe`,en:`Planning & operations`},website:{de:`Helfer für die Website`,en:`Website helpers`}},G={text:{de:`Text schreiben`,en:`Writes text`},web:{de:`Websuche`,en:`Web search`},browser:{de:`Browser bedienen`,en:`Drives a browser`},documents:{de:`Dokumente & Fotos lesen`,en:`Reads documents & photos`},image:{de:`Bilder erzeugen`,en:`Makes images`},video:{de:`Videos erzeugen`,en:`Makes video`},speech:{de:`Sprachausgabe`,en:`Speech output`},listening:{de:`Sprachnotizen verstehen`,en:`Understands voice notes`},code:{de:`Code ausführen`,en:`Runs code`},connectors:{de:`Verbundene Konten & Systeme`,en:`Connected accounts & systems`}},ze={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},K=e=>Object.keys(e);K(W),K(Le),K(Re),K(G);var q=e(n(),1),Be=(0,U.lazy)(()=>_(()=>import(`./FlowPreview-CjUK5046.js`),__vite__mapDeps([0,1,2,3,4]))),Ve={useCase:``,industry:``,format:``,capability:``},J=(e,t)=>e[t]?.[O]??t;function He(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function Ue(e){return e.credits?M(`market.credits`,{n:He(e.credits.credits)}):ze[e.costTier][O]}var We={text:le,document:ae,table:Me,image:w,video:D,audio:be,dashboard:I};function Y({format:e,className:t}){let n=We[e],r=J(W,e);return(0,q.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,q.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var Ge=[`low`,`medium`,`high`];function X({entry:e}){let t=Ge.indexOf(e.costTier)+1,n=O===`de`?Se:xe;return(0,q.jsxs)(`span`,{title:Ue(e),className:`inline-flex items-center gap-1`,children:[(0,q.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:Ge.slice(0,t).map((e,t)=>(0,q.jsx)(`span`,{className:A(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,q.jsx)(n,{className:`size-4`})},e))}),ze[e.costTier][O]]})}function Ke({entry:e,onOpen:t}){return(0,q.jsxs)(he,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:A(`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.missing.length>0)&&`opacity-60`),children:[(0,q.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,q.jsx)(u,{kind:e.avatar,size:68,interactive:!1})}),(0,q.jsxs)(`div`,{className:`min-w-0 pr-20`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 font-display font-semibold text-[15px]`,children:[e.title,e.starred?(0,q.jsx)(E,{className:`size-3.5 shrink-0 fill-amber text-amber`,"aria-label":M(`market.starred`)}):null]}),(0,q.jsx)(`div`,{className:`mt-0.5 text-[13px] text-ink-3 leading-snug`,children:e.pitch})]}),(0,q.jsx)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[12px] text-ink-3`,children:e.usable&&e.missing.length?(0,q.jsx)(ge,{tone:`warn`,children:M(`market.missing`,{list:qe(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)(V,{className:`size-3.5`}),` `,M(`market.minutes`,{n:e.effort.minutes})]}),(0,q.jsx)(X,{entry:e}),(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)(ge,{tone:`warn`,children:M(`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-[12px] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var qe=e=>e.map(e=>J(G,e)).join(`, `),Je={text:ue,web:se,browser:Oe,documents:Ae,image:w,video:D,speech:Ie,listening:oe,code:Pe,connectors:b};function Ye(e){switch(e.type){case`page`:return C;case`agent`:return S;case`generate`:return e.asset===`image`?w:e.asset===`video`?D:e.asset===`voice`?Ie:e.asset===`dashboard`?I:ae;case`widget`:return e.video?Ce:y;case`review`:return ne;case`result`:return x}return ie}function Xe(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 Ze(e){let t=Xe(e);return e.map(e=>({id:e.id,title:e.title,icon:Ye(e),tone:te[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function Q({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 $({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-[14px] text-ink leading-snug`,children:t}),n?(0,q.jsx)(`div`,{className:`text-[12px] text-ink-3 leading-snug`,children:n}):null]})]})}function Qe({className:e,children:t}){let n=(0,U.useRef)(null),[r,i]=(0,U.useState)({above:!1,below:!1});(0,U.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})})}function $e({id:e,fallback:t,onClose:n,onUse:r,busy:i}){let a=m(),o=l(),s=f({queryKey:[`marketplace-entry`,e,O],queryFn:()=>p.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${O}`),enabled:!!e,retry:!1}),c=s.data??t,h=g({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?p.put(n):p.del(n)},onSuccess:()=>Promise.all([a.invalidateQueries({queryKey:[`marketplace`]}),a.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),_=d()===`dark`,v=de[fe[c?.avatar||`round`]],y=_?`var(--card)`:`color-mix(in oklch, ${v??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,q.jsx)(pe,{open:!!e,onClose:n,wide:!0,bare:!0,children:c?(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":M(`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)(N,{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:y,"--coin-bg":y},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:A(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,_?`opacity-[0.14]`:`opacity-80`)})}),(0,q.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,q.jsx)(u,{kind:c.avatar,size:104})}),(0,q.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,q.jsx)(`h2`,{className:`font-display font-semibold text-[22px] leading-tight tracking-tight max-sm:pr-10`,children:c.title}),(0,q.jsx)(`p`,{className:`mt-1 text-[14px] text-ink-2 leading-snug`,children:s.data?.description||c.pitch})]}),c.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-[14px] sm:px-7 sm:pr-40`,children:[(0,q.jsxs)(Q,{title:M(`market.duration`),children:[(0,q.jsx)(V,{className:`size-4 text-ink-3`}),M(`market.minutes`,{n:c.effort.minutes})]}),(0,q.jsx)(Q,{title:M(`market.cost`),children:(0,q.jsx)(X,{entry:c})}),(0,q.jsx)(Q,{title:M(`market.result`),children:c.formats.map(e=>(0,q.jsx)(Y,{format:e,className:`size-4`},e))})]}):null]}),c.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:M(`market.duration`),children:(0,q.jsx)($,{icon:(0,q.jsx)(V,{className:`size-4 text-moss`}),more:M(`market.durationHint`,{n:c.effort.fields}),children:M(`market.minutes`,{n:c.effort.minutes})})}),(0,q.jsx)(Z,{title:M(`market.cost`),children:(0,q.jsx)($,{icon:(0,q.jsx)(Ee,{className:`size-4 text-amber`}),more:c.credits?M(`market.creditsHint`):void 0,children:(0,q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,q.jsx)(X,{entry:c}),c.credits?(0,q.jsx)(`span`,{className:`text-ink-2`,children:M(`market.creditsRange`,{n:He(c.credits.credits)})}):null]})})}),(0,q.jsx)(Z,{title:M(`market.result`),children:(0,q.jsx)(`div`,{className:`flex flex-col gap-2`,children:(s.data?.results??[]).map(e=>(0,q.jsx)($,{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.jsx)(Z,{title:M(`market.needs`),children:(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:c.capabilities.map(e=>{let t=Je[e],n=c.missing.includes(e);return(0,q.jsxs)(`li`,{className:A(`flex items-center gap-2.5 text-[14px]`,n?`text-ink-3`:`text-ink-2`),children:[(0,q.jsx)(t,{className:A(`size-4 shrink-0`,n?`text-rose`:`text-cobalt`)}),J(G,e),n?(0,q.jsx)(`span`,{className:`text-[12px] text-rose`,children:M(`market.unavailable`)}):null]},e)})})})]}),(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-[12px] text-ink-3 uppercase tracking-[0.06em]`,children:M(`market.steps`)}),(0,q.jsx)(Qe,{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`}):(0,q.jsx)(U.Suspense,{fallback:(0,q.jsx)(k,{className:`size-5 text-ink-3`}),children:(0,q.jsx)(Be,{steps:Ze(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-[14px] text-ink-2`,children:M(`market.needsUpdateHint`)})}),(0,q.jsxs)(`div`,{className:`flex shrink-0 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:[(0,q.jsxs)(j,{variant:`ghost`,className:`mr-auto`,title:M(`market.starHint`),"aria-pressed":c.starred,busy:h.isPending,onClick:()=>h.mutate(!c.starred),children:[(0,q.jsx)(E,{className:A(`size-4`,c.starred&&`fill-amber text-amber`)}),(0,q.jsx)(`span`,{className:`max-sm:sr-only`,children:M(c.starred?`market.starred`:`market.star`)})]}),(0,q.jsx)(j,{variant:`secondary`,onClick:n,children:M(`common.close`)}),c.usable&&c.missing.length?(0,q.jsx)(j,{variant:`secondary`,onClick:()=>o(`/settings/models`),children:M(`editor.models.settings`)}):null,(0,q.jsx)(j,{disabled:!c.usable||c.missing.length>0,title:c.missing.length?M(`market.missingHint`,{list:qe(c.missing)}):void 0,busy:i,onClick:()=>r(c),children:M(`market.use`)})]})]}):(0,q.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[14px] 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:M(`market.notFound`)}),(0,q.jsx)(j,{variant:`secondary`,onClick:n,children:M(`common.close`)})]})})})}function et({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,U.useState)(!1),o=(0,U.useRef)(null);(0,U.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:A(`flex h-8 items-center rounded-full text-[13px] 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:A(`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)(re,{className:A(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,q.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${M(`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)(N,{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:A(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[14px] 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)(T,{className:`size-4 text-ember`}):e.unavailable?(0,q.jsx)(`span`,{className:`whitespace-nowrap text-[12px] text-ink-4`,children:M(`market.unavailable`)}):(0,q.jsx)(`span`,{className:`text-[12px] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function tt(e,t){let[n,r]=(0,U.useState)(e);return(0,U.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var nt=60;function rt({onUse:e,busy:t,open:n}){let[r,i]=(0,U.useState)(``),[a,s]=(0,U.useState)(Ve),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(n??null),f=tt(r.trim(),250),m=ye({queryKey:[`marketplace`,O,f,a,c],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:O,limit:String(nt),offset:String(e)});f&&t.set(`q`,f);for(let[e,n]of Object.entries(a))n&&t.set(e,n);return c&&t.set(`starred`,`1`),p.get(`/api/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:o}),h=m.data?.pages[0],g=m.data?.pages.flatMap(e=>e.entries)??[],_=h?.all??0,v=r.trim()!==f||m.isFetching&&!m.isFetchingNextPage,y=(e,t,n)=>Object.keys(t).filter(t=>h?.facets[e]?.[t]!==void 0).map(r=>({value:r,label:J(t,r),icon:n?.(r),count:(h?.facets[e])[r]??0,unavailable:e===`capability`&&b.has(r)})),b=new Set(h?.unavailable??[]),ee=y(`useCase`,Re),x=[{key:`industry`,name:M(`market.industry`),options:y(`industry`,Le)},{key:`format`,name:M(`market.format`),options:y(`format`,W,e=>(0,q.jsx)(Y,{format:e,className:`size-4 text-ink-3`}))},{key:`capability`,name:M(`market.capability`),options:y(`capability`,G,e=>{let t=Je[e];return(0,q.jsx)(t,{className:`size-4 text-ink-3`})})}],S=!!r.trim()||c||Object.values(a).some(Boolean),C=()=>{s(Ve),i(``),l(!1)};if(m.isLoading)return(0,q.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,q.jsx)(k,{className:`size-6 text-ink-3`})});let w=h?.offline?(0,q.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[13px] text-ink-3`,children:[(0,q.jsx)(we,{className:`size-4 shrink-0`}),M(`market.offline`)]}):null;if(!_&&!S)return w;let te=r?(0,q.jsx)(`button`,{type:`button`,"aria-label":M(`market.reset`),onClick:()=>i(``),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)(N,{className:`size-4`})}):null,T=e=>A(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[12.5px] 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`,{className:`relative mx-auto flex h-10 max-w-md 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:[v?(0,q.jsx)(k,{className:`size-4 shrink-0 text-ink-3`}):(0,q.jsx)(ce,{className:`size-4 shrink-0 text-ink-3`}),(0,q.jsx)(`input`,{type:`search`,value:r,onChange:e=>i(e.target.value),placeholder:M(`market.search`),"aria-label":M(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[15px] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),te]}),w,(0,q.jsxs)(`div`,{className:`max-sm:-mx-4 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-4 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:M(`market.all`)},...ee].map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":!c&&a.useCase===e.value,onClick:()=>{l(!1),s({...a,useCase:e.value})},className:T(!c&&a.useCase===e.value),children:e.label},e.value)),(0,q.jsxs)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>l(!c),className:T(c),children:[(0,q.jsx)(E,{className:A(`size-3.5`,c&&`fill-amber text-amber`)}),M(`market.starred`)]})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[c?null:x.map(e=>(0,q.jsx)(et,{name:e.name,value:a[e.key],options:e.options,onChange:t=>s({...a,[e.key]:t})},e.key)),(0,q.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[13px] text-ink-3`,children:[S?(0,q.jsxs)(`button`,{type:`button`,onClick:C,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,q.jsx)(N,{className:`size-3.5 max-sm:size-4`}),(0,q.jsx)(`span`,{className:`max-sm:sr-only`,children:M(`market.resetShort`)})]}):null,S?(0,q.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:M(`market.countOfShort`,{n:h?.total??0,all:_})}):null,(0,q.jsx)(`span`,{className:A(`tabular-nums`,S&&`max-sm:hidden`),children:S?M(`market.countOf`,{n:h?.total??0,all:_}):M(`market.count`,{n:_})})]})]}),g.length?(0,q.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:g.map(e=>(0,q.jsx)(Ke,{entry:e,onOpen:()=>d(e.id)},e.id))}):(0,q.jsxs)(`div`,{className:`py-10 text-center text-[14px] text-ink-3`,children:[(0,q.jsx)(`p`,{children:M(c?`market.noneStarred`:`market.none`)}),(0,q.jsx)(j,{variant:`ghost`,className:`mt-2`,onClick:C,children:M(`market.reset`)})]}),m.hasNextPage?(0,q.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,q.jsx)(j,{variant:`secondary`,busy:m.isFetchingNextPage,onClick:()=>void m.fetchNextPage(),children:M(`market.more`)})}):null,(0,q.jsx)($e,{id:u,fallback:g.find(e=>e.id===u)??null,onClose:()=>d(null),onUse:e,busy:t})]})}var it={de:[`Stellenanzeige aus ein paar Stichworten, als PDF und LinkedIn-Post`,`Produktbeschreibung für den Onlineshop mit drei Bildvarianten`,`Wettbewerbsanalyse zu einer Firma mit Quellen`,`Lead aus einem Formular in unser CRM eintragen`],en:[`A job ad from a few keywords, as PDF and LinkedIn post`,`A shop product description with three image variants`,`A competitor analysis for a company, with sources`,`Put a lead from a form into our CRM`]};function at(){let e=l(),t=m(),{project:n}=h(),[i,a]=(0,U.useState)(``),[o]=r(),s=g({mutationFn:e=>p.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:O}),onSuccess:async({id:n},r)=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(r?`/edit/${n}`:`/edit/${n}?prompt=${encodeURIComponent(i.trim())}`)}}),c=()=>{i.trim()&&n&&s.mutate(void 0)};return(0,q.jsxs)(`div`,{className:`animate-rise pt-4`,children:[(0,q.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,q.jsx)(u,{kind:`sprout`,size:150,fluffy:!0}),(0,q.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[32px] leading-tight tracking-tight sm:text-[38px]`,children:M(`new.title`)})]}),(0,q.jsxs)(`div`,{className:`mt-8 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus`,children:[(0,q.jsx)(me,{autoFocus:!0,minRows:4,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&c()},placeholder:M(`new.placeholder`),className:`border-0 bg-transparent text-[16px] shadow-none focus:ring-0`}),(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-1`,children:[(0,q.jsx)(`span`,{className:`hidden text-[12px] text-ink-4 sm:block`,children:M(`new.hint`)}),(0,q.jsxs)(j,{size:`md`,onClick:c,busy:s.isPending&&!s.variables,disabled:!i.trim(),children:[M(`new.build`),` `,(0,q.jsx)(ee,{className:`size-4`})]})]})]}),(0,q.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:it[O].map(e=>(0,q.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:`rounded-full bg-paper-2 px-3.5 py-1.5 text-[13px] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e))})]}),(0,q.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,q.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[13px] text-ink-3 uppercase tracking-[0.08em]`,children:M(`new.orStarter`)}),(0,q.jsx)(rt,{open:o.get(`starter`),busy:s.isPending&&!!s.variables,onUse:e=>n&&!s.isPending&&s.mutate(e.id)}),s.error?(0,q.jsx)(`p`,{className:`mt-3 text-center text-[14px] text-rose`,children:s.error.message}):null]}),(0,q.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,q.jsx)(_e,{variant:`ghost`,label:M(`new.import`)})})]})}export{at as NewWizardPage};
@@ -1 +1 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,a as i,c as a,d as o,f as s,h as c,j as l,k as u,l as d,n as f,r as p}from"./api-KMi35npD.js";import{t as m}from"./createLucideIcon-q3MZMmnf.js";import{t as h}from"./RunnerView-DOizlTad.js";import{t as g}from"./arrow-right-6FyN3e7D.js";import{d as _,h as v,t as y,y as b}from"./ui-Cs6lpsmj.js";var x={name:`square-plus`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-square`]};x.node;var S=m(x),C=e(t(),1);function w(){if(window.self===window.top)return null;let e=new URLSearchParams(window.location.search).get(`embed`);return e===`inline`||e===`modal`?e:null}var T=w(),E=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`);function D(){(0,C.useEffect)(()=>{if(T===`inline`){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>E(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(T===`modal`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&E(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[])}var O=e(n(),1);function k(e){(0,C.useEffect)(()=>{if(!e)return;let t=document.documentElement;return t.style.setProperty(`--raw-primary`,e),()=>{t.style.removeProperty(`--raw-primary`)}},[e])}function A(e,t){(0,C.useEffect)(()=>{let n=document.querySelector(`link[rel="manifest"]`);if(!e||!t||!n)return;let r=n.getAttribute(`href`)??`/manifest.webmanifest`;n.setAttribute(`href`,`/api/public/wizards/${e}/manifest.webmanifest`);let i=document.createElement(`meta`);return i.name=`apple-mobile-web-app-title`,i.content=t,document.head.appendChild(i),()=>{n.setAttribute(`href`,r),i.remove()}},[e,t])}function j(){let[e,t]=(0,C.useState)(()=>window.wizardInstall??null),[n,r]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=()=>t(window.wizardInstall??null);return window.addEventListener(`wizard-install`,e),()=>window.removeEventListener(`wizard-install`,e)},[]);let i=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,a=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;return i||!e&&!a?null:(0,O.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[13px] text-ink-3`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>{e?(e.prompt(),window.wizardInstall=null,t(null)):r(e=>!e)},className:`inline-flex items-center gap-1.5 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[(0,O.jsx)(S,{className:`size-4`}),` `,b(`install.add`)]}),n?(0,O.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:b(`install.ios`)}):null]})}function M({brand:e,toggle:t=!0}){return(0,O.jsx)(`header`,{className:`safe-top`,children:(0,O.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[e.logoUrl?(0,O.jsx)(`img`,{src:a(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,O.jsx)(`span`,{className:`max-w-[60%] truncate font-display font-semibold text-[15px] text-ink-2 tracking-tight`,children:e.name}):null,t?(0,O.jsx)(`div`,{className:`absolute right-3`,children:(0,O.jsx)(s,{})}):null]})})}function N({siteKey:e,onToken:t}){let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{let r=()=>{n.current&&window.turnstile&&!n.current.childElementCount&&window.turnstile.render(n.current,{sitekey:e,callback:t,appearance:`interaction-only`})};if(window.turnstile){r();return}let i=document.createElement(`script`);i.src=`https://challenges.cloudflare.com/turnstile/v0/api.js`,i.async=!0,i.onload=r,document.head.appendChild(i)},[e,t]),(0,O.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}var P=e=>`wz.run.${e}`,F=T===`inline`?`min-h-80`:`min-h-dvh`;function I({wizard:e}){let t=r(),[n,i]=(0,C.useState)(!1),[a,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(null),u=(()=>{try{return localStorage.getItem(P(e.token))}catch{return null}})();return(0,O.jsxs)(`div`,{className:`mx-auto flex max-w-lg animate-rise flex-col items-center px-6 pt-6 pb-12 text-center sm:pt-16 sm:pb-16`,children:[(0,O.jsx)(o,{kind:e.avatar,size:190,fluffy:!0}),(0,O.jsx)(`h1`,{className:`mt-2 text-balance font-display font-semibold text-[30px] leading-[1.1] tracking-tight sm:text-[34px]`,children:e.title}),e.description?(0,O.jsx)(`p`,{className:`mt-3 text-[16px] text-ink-2 leading-relaxed`,children:e.description}):null,e.available?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(y,{size:`lg`,className:`mt-10 min-w-48`,busy:n,disabled:!!e.turnstileSiteKey&&!c,onClick:async()=>{i(!0),s(null);try{let{runId:n}=await f.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:c??void 0,embedded:T!==null});try{localStorage.setItem(P(e.token),n)}catch{}t(`/w/${e.token}/${n}`)}catch(e){s(e.message),i(!1)}},children:[b(`run.start`),` `,(0,O.jsx)(g,{className:`size-4`})]}),e.turnstileSiteKey?(0,O.jsx)(N,{siteKey:e.turnstileSiteKey,onToken:l}):null,u?(0,O.jsx)(`button`,{type:`button`,onClick:()=>t(`/w/${e.token}/${u}`),className:`mt-4 text-[14px] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:b(`run.resume`)}):null,T?null:(0,O.jsx)(j,{})]}):(0,O.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[15px] text-ink-2`,children:e.unavailableReason??b(`run.unavailable`)}),a?(0,O.jsx)(`p`,{className:`mt-4 text-[14px] text-rose`,children:a}):null]})}function L(){let{token:e,runId:t}=u(),n=r(),a=l({queryKey:[`public`,e],queryFn:()=>f.get(`/api/public/wizards/${e}`),retry:(e,t)=>p(t)&&e<3});if(k(a.data?.brand.accent),c(a.data?.avatar),A(e,a.data?.title),D(),(0,C.useEffect)(()=>{a.data&&(document.title=a.data.title)},[a.data]),a.isLoading)return(0,O.jsx)(`div`,{className:v(`flex items-center justify-center text-ink-4`,F),children:(0,O.jsx)(_,{})});if(!a.data){let e=p(a.error);return(0,O.jsxs)(`div`,{className:v(`flex flex-col items-center justify-center gap-4 px-6 text-center`,F),children:[(0,O.jsx)(o,{kind:`pebble`,size:80}),(0,O.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:b(e?`common.offline`:`run.notFound`)}),e?(0,O.jsx)(y,{variant:`secondary`,onClick:()=>void a.refetch(),children:b(`common.retry`)}):null]})}return(0,O.jsxs)(`div`,{className:v(`flex flex-col`,F),children:[T===`inline`?null:(0,O.jsx)(M,{brand:a.data.brand,toggle:!T}),(0,O.jsx)(`div`,{className:`flex-1`,children:t?(0,O.jsx)(h,{runId:t,onRestart:()=>n(`/w/${e}`)}):(0,O.jsx)(I,{wizard:a.data})}),(0,O.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[12px] text-ink-4`,children:(0,O.jsx)(`a`,{href:`${i}/`,target:T?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:b(`run.madeWith`).replace(`engenty wizards`,d.name)})})]})}export{M as BrandHeader,L as PublicRunner,k as useBrandAccent};
1
+ import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{O as r,a as i,c as a,d as o,f as s,h as c,j as l,k as u,l as d,n as f,r as p}from"./api-KMi35npD.js";import{t as m}from"./createLucideIcon-q3MZMmnf.js";import{t as h}from"./RunnerView-Bhv6RNME.js";import{t as g}from"./arrow-right-6FyN3e7D.js";import{d as _,h as v,t as y,y as b}from"./ui-Cs6lpsmj.js";var x={name:`square-plus`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]],aliases:[`plus-square`]};x.node;var S=m(x),C=e(t(),1);function w(){if(window.self===window.top)return null;let e=new URLSearchParams(window.location.search).get(`embed`);return e===`inline`||e===`modal`?e:null}var T=w(),E=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`);function D(){(0,C.useEffect)(()=>{if(T===`inline`){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>E(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(T===`modal`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&E(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[])}var O=e(n(),1);function k(e){(0,C.useEffect)(()=>{if(!e)return;let t=document.documentElement;return t.style.setProperty(`--raw-primary`,e),()=>{t.style.removeProperty(`--raw-primary`)}},[e])}function A(e,t){(0,C.useEffect)(()=>{let n=document.querySelector(`link[rel="manifest"]`);if(!e||!t||!n)return;let r=n.getAttribute(`href`)??`/manifest.webmanifest`;n.setAttribute(`href`,`/api/public/wizards/${e}/manifest.webmanifest`);let i=document.createElement(`meta`);return i.name=`apple-mobile-web-app-title`,i.content=t,document.head.appendChild(i),()=>{n.setAttribute(`href`,r),i.remove()}},[e,t])}function j(){let[e,t]=(0,C.useState)(()=>window.wizardInstall??null),[n,r]=(0,C.useState)(!1);(0,C.useEffect)(()=>{let e=()=>t(window.wizardInstall??null);return window.addEventListener(`wizard-install`,e),()=>window.removeEventListener(`wizard-install`,e)},[]);let i=window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,a=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1;return i||!e&&!a?null:(0,O.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[13px] text-ink-3`,children:[(0,O.jsxs)(`button`,{type:`button`,onClick:()=>{e?(e.prompt(),window.wizardInstall=null,t(null)):r(e=>!e)},className:`inline-flex items-center gap-1.5 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[(0,O.jsx)(S,{className:`size-4`}),` `,b(`install.add`)]}),n?(0,O.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:b(`install.ios`)}):null]})}function M({brand:e,toggle:t=!0}){return(0,O.jsx)(`header`,{className:`safe-top`,children:(0,O.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[e.logoUrl?(0,O.jsx)(`img`,{src:a(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,O.jsx)(`span`,{className:`max-w-[60%] truncate font-display font-semibold text-[15px] text-ink-2 tracking-tight`,children:e.name}):null,t?(0,O.jsx)(`div`,{className:`absolute right-3`,children:(0,O.jsx)(s,{})}):null]})})}function N({siteKey:e,onToken:t}){let n=(0,C.useRef)(null);return(0,C.useEffect)(()=>{let r=()=>{n.current&&window.turnstile&&!n.current.childElementCount&&window.turnstile.render(n.current,{sitekey:e,callback:t,appearance:`interaction-only`})};if(window.turnstile){r();return}let i=document.createElement(`script`);i.src=`https://challenges.cloudflare.com/turnstile/v0/api.js`,i.async=!0,i.onload=r,document.head.appendChild(i)},[e,t]),(0,O.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}var P=e=>`wz.run.${e}`,F=T===`inline`?`min-h-80`:`min-h-dvh`;function I({wizard:e}){let t=r(),[n,i]=(0,C.useState)(!1),[a,s]=(0,C.useState)(null),[c,l]=(0,C.useState)(null),u=(()=>{try{return localStorage.getItem(P(e.token))}catch{return null}})();return(0,O.jsxs)(`div`,{className:`mx-auto flex max-w-lg animate-rise flex-col items-center px-6 pt-6 pb-12 text-center sm:pt-16 sm:pb-16`,children:[(0,O.jsx)(o,{kind:e.avatar,size:190,fluffy:!0}),(0,O.jsx)(`h1`,{className:`mt-2 text-balance font-display font-semibold text-[30px] leading-[1.1] tracking-tight sm:text-[34px]`,children:e.title}),e.description?(0,O.jsx)(`p`,{className:`mt-3 text-[16px] text-ink-2 leading-relaxed`,children:e.description}):null,e.available?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsxs)(y,{size:`lg`,className:`mt-10 min-w-48`,busy:n,disabled:!!e.turnstileSiteKey&&!c,onClick:async()=>{i(!0),s(null);try{let{runId:n}=await f.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:c??void 0,embedded:T!==null});try{localStorage.setItem(P(e.token),n)}catch{}t(`/w/${e.token}/${n}`)}catch(e){s(e.message),i(!1)}},children:[b(`run.start`),` `,(0,O.jsx)(g,{className:`size-4`})]}),e.turnstileSiteKey?(0,O.jsx)(N,{siteKey:e.turnstileSiteKey,onToken:l}):null,u?(0,O.jsx)(`button`,{type:`button`,onClick:()=>t(`/w/${e.token}/${u}`),className:`mt-4 text-[14px] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:b(`run.resume`)}):null,T?null:(0,O.jsx)(j,{})]}):(0,O.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[15px] text-ink-2`,children:e.unavailableReason??b(`run.unavailable`)}),a?(0,O.jsx)(`p`,{className:`mt-4 text-[14px] text-rose`,children:a}):null]})}function L(){let{token:e,runId:t}=u(),n=r(),a=l({queryKey:[`public`,e],queryFn:()=>f.get(`/api/public/wizards/${e}`),retry:(e,t)=>p(t)&&e<3});if(k(a.data?.brand.accent),c(a.data?.avatar),A(e,a.data?.title),D(),(0,C.useEffect)(()=>{a.data&&(document.title=a.data.title)},[a.data]),a.isLoading)return(0,O.jsx)(`div`,{className:v(`flex items-center justify-center text-ink-4`,F),children:(0,O.jsx)(_,{})});if(!a.data){let e=p(a.error);return(0,O.jsxs)(`div`,{className:v(`flex flex-col items-center justify-center gap-4 px-6 text-center`,F),children:[(0,O.jsx)(o,{kind:`pebble`,size:80}),(0,O.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:b(e?`common.offline`:`run.notFound`)}),e?(0,O.jsx)(y,{variant:`secondary`,onClick:()=>void a.refetch(),children:b(`common.retry`)}):null]})}return(0,O.jsxs)(`div`,{className:v(`flex flex-col`,F),children:[T===`inline`?null:(0,O.jsx)(M,{brand:a.data.brand,toggle:!T}),(0,O.jsx)(`div`,{className:`flex-1`,children:t?(0,O.jsx)(h,{runId:t,onRestart:()=>n(`/w/${e}`)}):(0,O.jsx)(I,{wizard:a.data})}),(0,O.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[12px] text-ink-4`,children:(0,O.jsx)(`a`,{href:`${i}/`,target:T?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:b(`run.madeWith`).replace(`engenty wizards`,d.name)})})]})}export{M as BrandHeader,L as PublicRunner,k as useBrandAccent};