@engenty/wizards-runtime 0.19.0 → 0.19.1

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 (60) hide show
  1. package/apps/runtime/dist/engine/runner.js +20 -7
  2. package/apps/runtime/dist/prompts/architect.md +3 -3
  3. package/apps/runtime/dist/prompts/authoring.md +4 -3
  4. package/apps/runtime/dist/services/work-chats.js +14 -6
  5. package/apps/runtime/dist/sharing/state.js +7 -3
  6. package/apps/web/dist/assets/{AboutDialog-BxT7chz8.js → AboutDialog-BUWu36Mb.js} +1 -1
  7. package/apps/web/dist/assets/{BlockEditor-BX8ZxxIc.js → BlockEditor-1-EvUIta.js} +1 -1
  8. package/apps/web/dist/assets/{Bundle-Dkpi5E6W.js → Bundle-RNkjBwAL.js} +1 -1
  9. package/apps/web/dist/assets/{CapabilitiesPage-CfSb23wy.js → CapabilitiesPage-fgTP28Mn.js} +2 -2
  10. package/apps/web/dist/assets/{ChangelogDialog-j-vHLy-V.js → ChangelogDialog-C_ZZLRZT.js} +1 -1
  11. package/apps/web/dist/assets/{CodeEditor-CfM2A-yS.js → CodeEditor-BEJKIMd0.js} +1 -1
  12. package/apps/web/dist/assets/{ConnectorsSection-fRBZYfZu.js → ConnectorsSection-iLrduYak.js} +1 -1
  13. package/apps/web/dist/assets/EditorPage-CRZte0O1.js +3 -0
  14. package/apps/web/dist/assets/{FlowPreview-E0kuvM5n.js → FlowPreview-ptI86Ogs.js} +1 -1
  15. package/apps/web/dist/assets/{LangSwitch-DhQmCtyY.js → LangSwitch-BNa_H8AR.js} +1 -1
  16. package/apps/web/dist/assets/Marketplace-9aGWG2pJ.js +2 -0
  17. package/apps/web/dist/assets/{NewWizardChannels-BATgI9GR.js → NewWizardChannels-BFDm9vCT.js} +1 -1
  18. package/apps/web/dist/assets/{NewWizardPage-B5V5ScKh.js → NewWizardPage-ueGFlLDo.js} +1 -1
  19. package/apps/web/dist/assets/{OnboardingPage-DWpDqlCi.js → OnboardingPage-DtDd7k_O.js} +1 -1
  20. package/apps/web/dist/assets/{PreviewPane-Br2w92Wh.js → PreviewPane-CEltrf_-.js} +2 -2
  21. package/apps/web/dist/assets/ProtocolSection-Bb3c44Te.js +1 -0
  22. package/apps/web/dist/assets/{PublicRunner-Cjhfeqi3.js → PublicRunner-BaTg24s3.js} +1 -1
  23. package/apps/web/dist/assets/{ReadOnly-CkToYpY5.js → ReadOnly-YF0RkR7P.js} +1 -1
  24. package/apps/web/dist/assets/{Results-C9qxCpUQ.js → Results-DJRLiVo0.js} +1 -1
  25. package/apps/web/dist/assets/{RunDrawer-BRXH71U8.js → RunDrawer-CSpTNJp-.js} +1 -1
  26. package/apps/web/dist/assets/{SettingsPage-Dobd7tAA.js → SettingsPage--_ap3omw.js} +2 -2
  27. package/apps/web/dist/assets/{SetupPage-BkMjwBlV.js → SetupPage-ELKHbmnE.js} +1 -1
  28. package/apps/web/dist/assets/{SharePage-Boj1R928.js → SharePage-OiKEnmL1.js} +1 -1
  29. package/apps/web/dist/assets/{SkillEditor-DtVRUYqS.js → SkillEditor-C1_zwNOQ.js} +1 -1
  30. package/apps/web/dist/assets/{Skills-DK1Pv-Xh.js → Skills-_pLGtOjH.js} +1 -1
  31. package/apps/web/dist/assets/{SpacePage-CjgBRkkw.js → SpacePage-r4EbxEJe.js} +2 -2
  32. package/apps/web/dist/assets/{StudioHome-B5HcJJ4Q.js → StudioHome-CwvxI29m.js} +1 -1
  33. package/apps/web/dist/assets/{UpdateCheck-DFor0F9T.js → UpdateCheck-BpdsLIOc.js} +2 -2
  34. package/apps/web/dist/assets/{brand-Ij-I_Lms.js → brand-ByQY-UcL.js} +1 -1
  35. package/apps/web/dist/assets/changelog-Dt-V-BKp.js +1 -0
  36. package/apps/web/dist/assets/{code-editor-BVgSljQq.js → code-editor-B8zG80PA.js} +2 -2
  37. package/apps/web/dist/assets/{host-BELYIPMT.js → host-Ckjz94Ea.js} +6 -6
  38. package/apps/web/dist/assets/{i18n-DPqdH1PJ.js → i18n-ClCOlfx2.js} +1 -1
  39. package/apps/web/dist/assets/{index-wJZVaKLg.js → index-BHKh0A9F.js} +3 -3
  40. package/apps/web/dist/assets/index-D18zQ05f.css +1 -0
  41. package/apps/web/dist/assets/{read-aloud-pd-PWi_5.js → read-aloud-spC7eEBp.js} +1 -1
  42. package/apps/web/dist/assets/{runners-D9DHhaD9.js → runners-DNqzwMQ0.js} +1 -1
  43. package/apps/web/dist/assets/{session-Mt-n8MI0.js → session-Dd9duhPc.js} +1 -1
  44. package/apps/web/dist/assets/{theme-BQhQx_UL.js → theme-DumM6FI_.js} +1 -1
  45. package/apps/web/dist/assets/{ui-D4qQLcbs.js → ui-BjhZhw8x.js} +1 -1
  46. package/apps/web/dist/assets/{useMutation-CUZC19i3.js → useMutation-CoEdB_9_.js} +1 -1
  47. package/apps/web/dist/assets/{viewers-D-8HZrcq.js → viewers-BmcrgvXX.js} +2 -2
  48. package/apps/web/dist/index.html +13 -13
  49. package/apps/web/dist/mcp/flow.html +3 -3
  50. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +2 -0
  51. package/node_modules/@engenty/wizards-shared/dist/run.js +2 -0
  52. package/node_modules/@engenty/wizards-shared/dist/transition.js +5 -1
  53. package/package.json +1 -1
  54. package/plugin/.claude-plugin/plugin.json +1 -1
  55. package/plugin/plugin.json +1 -1
  56. package/apps/web/dist/assets/EditorPage-CrFyN_Qn.js +0 -3
  57. package/apps/web/dist/assets/Marketplace-BdkNOARm.js +0 -2
  58. package/apps/web/dist/assets/ProtocolSection-DMCojdZu.js +0 -1
  59. package/apps/web/dist/assets/changelog-n9RARUzp.js +0 -1
  60. package/apps/web/dist/assets/index-CVZlO0z3.css +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,Xt as n,_r as r,ar as i,bt as a,fr as o,gr as s,ht as c,mt as l,nn as u,ot as d,pn as f,sn as p,vn as m,vr as h,yr as g,yt as _}from"./ui-D4qQLcbs.js";import{d as v,n as y}from"./marked.esm-BfGIZK7F.js";import{_ as b,d as ee,f as te,g as x,h as S,m as C,n as ne,p as w,v as T,y as E}from"./theme-BQhQx_UL.js";import{n as D,t as O}from"./jsx-runtime-C3cWAN_r.js";import{l as re,n as k,r as A,t as j}from"./brand-Ij-I_Lms.js";import{a as M,et as N,l as P,s as F}from"./i18n-DPqdH1PJ.js";import{s as ie,u as I}from"./read-aloud-pd-PWi_5.js";import{n as L}from"./LangSwitch-DhQmCtyY.js";var ae={name:`bookmark`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};ae.node;var oe=v(ae),se={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`]};se.node;var ce=v(se),R=e(D(),1);function le(){if(window.self===window.top)return null;let e=new URLSearchParams(window.location.search).get(`embed`);return e===`inline`||e===`modal`||e===`popout`?e:null}var z=le(),ue=z?new URLSearchParams(window.location.search).get(`page`):null,B=new URLSearchParams(window.location.search).get(`theme`),V=B?`?theme=${encodeURIComponent(B)}`:``,H=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),de=()=>H(`close`);function fe(e){(0,R.useEffect)(()=>{if(z===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>H(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(z===`modal`||z===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&H(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var U=e(O(),1),W=`wizards.runner.translate`,G=new Set;function pe(){try{return localStorage.getItem(W)===`on`}catch{return!1}}function me(e){try{localStorage.setItem(W,e?`on`:`off`)}catch{}for(let e of G)e()}function he(){return(0,R.useSyncExternalStore)(e=>(G.add(e),()=>G.delete(e)),pe)}function ge(e){let n=he(),[r]=(0,R.useState)(()=>P()),i=e?.lang??`en`,a=e?.translatable&&r&&r!==i?r:null,o=a&&n?a:i,s=e?.token,c=g({queryKey:[`public-translation`,s,o],enabled:!!(s&&o!==i),queryFn:()=>t.post(`/api/public/wizards/${s}/translation${V}`,{lang:o}),staleTime:1/0,retry:!1}),l=g({queryKey:[`public-texts`,s,o],enabled:!(!s||N(o)),queryFn:()=>t.get(`/api/public/wizards/${s}/texts/${o}`),staleTime:1/0,retry:!1}),u=!N(o),d=o===i||c.data&&(!u||l.data),f=o!==i&&(c.isError||u&&l.isError),p=d&&!f?o:i,m=(0,R.useMemo)(()=>!N(p)&&l.data?.lang===p?{lang:l.data.lang,runner:l.data.runner,notes:l.data.notes}:null,[p,l.data]);if((0,R.useEffect)(()=>{e&&M(p,m)},[e,p,m]),(0,R.useEffect)(()=>()=>M(null),[]),!e)return null;let h=p!==i&&c.data?c.data:null;return{own:i,other:a,shown:p,wizard:h??e,translating:o!==i&&!d&&!f,failed:!!f,translated:!!h,machine:h?.translation?.machine??!1,pick:e=>me(e!==i)}}function K({page:e,tone:t=`ground`}){if(!e?.other)return null;let n=e.translating?e.other:e.shown;return(0,U.jsx)(L,{langs:[e.own,e.other],value:n,onPick:e.pick,tone:t})}function q({page:e,small:t}){if(!e)return null;let n=t?`truncate text-[0.75rem]`:`text-[0.8125rem]`;return e.failed?(0,U.jsx)(`p`,{className:m(`text-ink-3`,n),children:F(`translation.failed`)}):e.translated?(0,U.jsxs)(`p`,{className:m(`text-ink-3`,n),children:[e.machine?(0,U.jsxs)(U.Fragment,{children:[F(`translation.machine`),` · `]}):null,(0,U.jsx)(`button`,{type:`button`,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,onClick:()=>e.pick(e.own),children:F(`translation.showOriginal`)})]}):null}function _e(e,n){let r=(0,R.useRef)(null),i=n&&!n.translating?n.translated?n.shown:null:void 0;(0,R.useEffect)(()=>{if(!e||i===void 0)return;let n=`${e}:${i}`;r.current!==n&&(r.current=n,t.post(`/api/runs/${e}/lang`,{lang:i}).catch(()=>void 0))},[e,i])}function ve(e,t){(0,R.useEffect)(()=>{if(!e||!t)return;let n=l(`/api/public/wizards/${e}`),r=[{rel:`manifest`,href:`${n}/manifest.webmanifest`},{rel:`apple-touch-icon`,href:`${n}/icons/apple-touch-icon.png`},{rel:`icon`,href:`${n}/icons/favicon.png`,type:`image/png`}].flatMap(({rel:e,href:t,type:n})=>{let r=document.querySelector(`link[rel="${e}"]`);if(!r)return[];let i={href:r.getAttribute(`href`),type:r.getAttribute(`type`)};return r.setAttribute(`href`,t),n&&r.setAttribute(`type`,n),[{link:r,before:i}]}),i=document.createElement(`meta`);return i.name=`apple-mobile-web-app-title`,i.content=t,document.head.appendChild(i),()=>{for(let{link:e,before:t}of r)for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r);i.remove()}},[e,t])}var J=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Y=J||/Android/.test(navigator.userAgent);function ye(){let[e,t]=(0,R.useState)(()=>window.wizardInstall??null),[n,r]=(0,R.useState)(!1);if((0,R.useEffect)(()=>{let e=()=>t(window.wizardInstall??null);return window.addEventListener(`wizard-install`,e),()=>window.removeEventListener(`wizard-install`,e)},[]),window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0||Y&&!e&&!J)return null;let i=/Mac/.test(navigator.platform),a=F(Y?`install.ios`:i?`install.bookmark.mac`:`install.bookmark.pc`);return(0,U.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{Y&&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:[Y?(0,U.jsx)(ce,{className:`size-4`}):(0,U.jsx)(oe,{className:`size-4`}),F(Y?`install.add`:`install.bookmark`)]}),n?(0,U.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:a}):null]})}function be({brand:e,toggle:t=!0,start:n}){return(0,U.jsx)(`header`,{className:`safe-top`,children:(0,U.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[n?(0,U.jsx)(`div`,{className:`absolute left-3`,children:n}):null,e.logoUrl?(0,U.jsx)(`img`,{src:l(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,U.jsx)(`span`,{className:`max-w-[60%] truncate font-display font-semibold text-[0.9375rem] text-ink-2 tracking-tight`,children:e.name}):null,t?(0,U.jsx)(`div`,{className:`absolute right-3`,children:(0,U.jsx)(A,{})}):null]})})}function xe({siteKey:e,onToken:t}){let n=(0,R.useRef)(null);return(0,R.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,U.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function Se({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||c||z?null:(0,U.jsxs)(`a`,{href:_(`${window.location.origin}${d}/w/${e}`),className:`mt-3 inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[(0,U.jsx)(E,{className:`size-4`}),` `,F(`install.app`)]})}var X=e=>`wz.run.${e}`,Z=()=>s().state?.elsewhere===!0,Ce=c&&new URLSearchParams(window.location.search).get(`start`)===`1`,Q=z===`inline`?`min-h-80`:`min-h-dvh`;function $(e,n,i){let a=r(),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(null),[u,d]=(0,R.useState)(null),f=(()=>{try{return localStorage.getItem(X(e.token))}catch{return null}})();return{busy:o,error:c,captcha:u,setCaptcha:d,start:async()=>{s(!0),l(null);try{let{runId:r}=await t.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:u??void 0,embedded:z!==null,origin:ue??void 0,lang:i??void 0});try{localStorage.setItem(X(e.token),r)}catch{}a(`${n}/${r}`,{replace:Ce})}catch(e){l(e.message),s(!1)}},resume:f?()=>a(`${n}/${f}`):null}}function we({wizard:e,page:t}){let{busy:n,error:r,captcha:a,setCaptcha:o,start:s,resume:l}=$(e,`/w/${e.token}`,t?.translated?t.shown:null),d=Z(),p=Ce&&e.available&&!e.turnstileSiteKey,m=(0,R.useRef)(!1);return(0,R.useEffect)(()=>{p&&!m.current&&(m.current=!0,s())},[p]),p&&!r?(0,U.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,U.jsx)(f,{})}):(0,U.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:[d?(0,U.jsx)(`p`,{className:`mb-6 rounded-xl bg-paper-2 px-5 py-3 text-[0.875rem] text-ink-2`,children:F(`run.elsewhere`)}):null,(0,U.jsx)(k,{kind:e.avatar,costume:e.costume,size:190,fluffy:!0}),(0,U.jsx)(`h1`,{className:`wizard-title mt-2 text-balance font-display font-semibold text-[1.875rem] leading-[1.1] tracking-tight sm:text-[2.125rem]`,children:e.title}),e.description?(0,U.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,(0,U.jsx)(`div`,{className:`mt-3`,children:(0,U.jsx)(q,{page:t})}),e.available?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(u,{size:`lg`,className:`mt-10 min-w-48`,busy:n,disabled:!!e.turnstileSiteKey&&!a,onClick:s,children:[F(`run.start`),` `,(0,U.jsx)(i,{className:`size-4`})]}),e.turnstileSiteKey?(0,U.jsx)(xe,{siteKey:e.turnstileSiteKey,onToken:o}):null,l?(0,U.jsx)(`button`,{type:`button`,onClick:l,className:`mt-4 text-[0.875rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:F(`run.resume`)}):null,(0,U.jsx)(Te,{wizard:e,current:`steps`}),z||c?null:(0,U.jsx)(ye,{}),(0,U.jsx)(Se,{token:e.token})]}):(0,U.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??F(`run.unavailable`)}),r?(0,U.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:r}):null]})}function Te({wizard:e,current:t}){let n=e.runners.filter(e=>e.id!==t&&e.kind===`page`&&e.url);return n.length?(0,U.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,U.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:F(`run.orAs`,{label:e.label})},e.id))}):null}function Ee({wizard:e,page:t}){let n=T();return(0,U.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,U.jsxs)(`div`,{className:`mx-auto flex h-16 w-full max-w-[760px] items-center gap-3 pr-2 pl-4 sm:pr-4 sm:pl-6`,children:[(0,U.jsx)(`span`,{className:m(n?.speaking&&`animate-breathe`),children:(0,U.jsx)(k,{kind:e.avatar,costume:e.costume,size:38})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,U.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null,(0,U.jsx)(q,{page:t,small:!0})]}),e.brand.logoUrl&&z!==`popout`?(0,U.jsx)(`img`,{src:l(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,(0,U.jsx)(K,{page:t,tone:`surface`}),z?null:(0,U.jsx)(A,{}),z===`popout`?(0,U.jsx)(p,{label:F(`common.close`),onClick:de,children:(0,U.jsx)(y,{className:`size-5`})}):null]})})}function De({door:e,wizard:t,page:n,header:r,footer:a}){let{busy:o,error:s,captcha:c,setCaptcha:l,start:u,resume:d}=$(t,`/w/${t.token}/${e}`,n?.translated?n.shown:null),f=Z(),p=[];return f&&p.push({key:`elsewhere`,who:`bot`,node:F(`run.elsewhere`)}),p.push({key:`hello`,who:`bot`,node:t.description||t.title}),e!==`chat`&&p.push({key:e,who:`bot`,node:F(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||p.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??F(`run.unavailable`)}),s&&p.push({key:`error`,who:`bot`,node:s,tone:`error`}),t.available&&p.push(b(`start`,(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(S,{primary:!0,busy:o,disabled:!!t.turnstileSiteKey&&!c,onClick:()=>void u(),children:[F(`run.start`),` `,(0,U.jsx)(i,{className:`size-4`})]}),d?(0,U.jsx)(S,{onClick:d,children:F(`run.resume`)}):null,t.turnstileSiteKey?(0,U.jsx)(xe,{siteKey:t.turnstileSiteKey,onToken:l}):null]}))),(0,U.jsxs)(w,{header:r,footer:a,children:[(0,U.jsx)(x,{avatar:t.avatar,costume:t.costume,lines:p}),(0,U.jsx)(C,{})]})}function Oe({className:e}){return(0,U.jsx)(`footer`,{className:m(`text-center text-ink-4`,e),children:(0,U.jsx)(`a`,{href:`${d}/`,target:z?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:F(`run.madeWith`).replace(`engenty wizards`,j.name)})})}function ke({chat:e=!1,steps:i=!1,talk:s=!1,video:l=!1}){let{token:p,runId:_}=h(),v=r(),y=g({queryKey:[`public`,p,V],queryFn:()=>t.get(`/api/public/wizards/${p}${V}`),retry:(e,t)=>n(t)&&e<3}),b=y.data?.runners??[],x=!y.data||b.some(e=>e.id===`talk`),S=!y.data||b.some(e=>e.id===`video`),C=!y.data||b.some(e=>e.id===`chat`)||s&&x||l&&S,w=b[0]?.id,T=e||z===`popout`||!i&&!_&&C&&(w===`chat`||w===`talk`||w===`video`),E=l&&S||!i&&!e&&!s&&w===`video`,D=!E&&(s&&x||!i&&!e&&w===`talk`),O=E?`video`:D?`talk`:`chat`,A=ge(y.data);_e(_,A),ne(y.data?.brand.theme),re(y.data?.avatar),ve(p,y.data?.title),fe(T);let M=A?.wizard.title??y.data?.title;(0,R.useEffect)(()=>{M&&(document.title=M)},[M]);let N=(0,R.useCallback)(e=>{try{p&&localStorage.getItem(X(p))===_&&localStorage.removeItem(X(p))}catch{}v(e,{replace:!0,state:{elsewhere:!0}})},[v,p,_]);if((0,R.useEffect)(()=>{p&&_&&a(`run`,{token:p,runId:_})},[p,_]),y.isLoading)return(0,U.jsx)(`div`,{className:m(`flex items-center justify-center text-ink-4`,Q),children:(0,U.jsx)(f,{})});if(e&&y.data&&!C||s&&y.data&&!x||l&&y.data&&!S)return(0,U.jsx)(o,{to:`/w/${p}`,replace:!0});if(!y.data){let e=n(y.error);return(0,U.jsxs)(`div`,{className:m(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Q),children:[(0,U.jsx)(k,{kind:`pebble`,size:80}),(0,U.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:F(e?`common.offline`:`run.notFound`)}),e?(0,U.jsx)(u,{variant:`secondary`,onClick:()=>void y.refetch(),children:F(`common.retry`)}):null]})}let P=A?.wizard??y.data,L=A?.translating?(0,U.jsxs)(`div`,{className:m(`flex flex-col items-center justify-center gap-3 text-ink-3`,Q),children:[(0,U.jsx)(f,{}),(0,U.jsx)(`p`,{className:`text-[0.875rem]`,children:F(`translation.working`)})]}):null;if(T){let e=(0,U.jsx)(Ee,{wizard:P,page:A}),t=c?(0,U.jsx)(`div`,{className:`safe-bottom`}):(0,U.jsx)(Oe,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,U.jsxs)(`div`,{className:`wizard-page flex h-dvh flex-col`,children:[(0,U.jsx)(ee,{effects:y.data.brand.theme.effects}),z||c?null:(0,U.jsx)(I,{}),L??(_?(0,U.jsx)(te,{runId:_,talk:D,call:E?`video`:D?`audio`:!1,onRestart:()=>v(`/w/${p}/${O}`),onNotFound:()=>N(`/w/${p}/${O}`),header:E||D?void 0:e,footer:t}):(0,U.jsx)(De,{wizard:P,page:A,header:e,footer:t,door:O}))]})}return(0,U.jsxs)(`div`,{className:m(`wizard-page flex flex-col`,Q),children:[(0,U.jsx)(ee,{effects:y.data.brand.theme.effects}),z||c?null:(0,U.jsx)(I,{}),z===`inline`||c?null:(0,U.jsx)(be,{brand:y.data.brand,toggle:!z,start:(0,U.jsx)(K,{page:A})}),z===`inline`||c?(0,U.jsx)(`div`,{className:`flex justify-end px-3 pt-2`,children:(0,U.jsx)(K,{page:A,tone:`surface`})}):null,_&&(A?.translated||A?.failed)?(0,U.jsx)(`div`,{className:`flex justify-center px-5`,children:(0,U.jsx)(q,{page:A})}):null,(0,U.jsx)(`div`,{className:`flex-1`,children:L??(_?(0,U.jsx)(ie,{runId:_,onRestart:()=>v(`/w/${p}`),onNotFound:()=>N(`/w/${p}`)}):(0,U.jsx)(we,{wizard:P,page:A}))}),c?(0,U.jsx)(`div`,{className:`safe-bottom`}):(0,U.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,U.jsx)(`a`,{href:`${d}/`,target:z?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:F(`run.madeWith`).replace(`engenty wizards`,j.name)})})]})}export{be as BrandHeader,ke as PublicRunner};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,Xt as n,_r as r,ar as i,bt as a,fr as o,gr as s,ht as c,mt as l,nn as u,ot as d,pn as f,sn as p,vn as m,vr as h,yr as g,yt as _}from"./ui-BjhZhw8x.js";import{d as v,n as y}from"./marked.esm-BfGIZK7F.js";import{_ as b,d as ee,f as te,g as x,h as S,m as C,n as ne,p as w,v as T,y as E}from"./theme-DumM6FI_.js";import{n as D,t as O}from"./jsx-runtime-C3cWAN_r.js";import{l as re,n as k,r as A,t as j}from"./brand-ByQY-UcL.js";import{a as M,et as N,l as P,s as F}from"./i18n-ClCOlfx2.js";import{s as ie,u as I}from"./read-aloud-spC7eEBp.js";import{n as L}from"./LangSwitch-BNa_H8AR.js";var ae={name:`bookmark`,size:24,node:[[`path`,{d:`M17 3a2 2 0 0 1 2 2v15a1 1 0 0 1-1.496.868l-4.512-2.578a2 2 0 0 0-1.984 0l-4.512 2.578A1 1 0 0 1 5 20V5a2 2 0 0 1 2-2z`,key:`oz39mx`}]]};ae.node;var oe=v(ae),se={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`]};se.node;var ce=v(se),R=e(D(),1);function le(){if(window.self===window.top)return null;let e=new URLSearchParams(window.location.search).get(`embed`);return e===`inline`||e===`modal`||e===`popout`?e:null}var z=le(),ue=z?new URLSearchParams(window.location.search).get(`page`):null,B=new URLSearchParams(window.location.search).get(`theme`),V=B?`?theme=${encodeURIComponent(B)}`:``,H=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),de=()=>H(`close`);function fe(e){(0,R.useEffect)(()=>{if(z===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>H(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(z===`modal`||z===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&H(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var U=e(O(),1),W=`wizards.runner.translate`,G=new Set;function pe(){try{return localStorage.getItem(W)===`on`}catch{return!1}}function me(e){try{localStorage.setItem(W,e?`on`:`off`)}catch{}for(let e of G)e()}function he(){return(0,R.useSyncExternalStore)(e=>(G.add(e),()=>G.delete(e)),pe)}function ge(e){let n=he(),[r]=(0,R.useState)(()=>P()),i=e?.lang??`en`,a=e?.translatable&&r&&r!==i?r:null,o=a&&n?a:i,s=e?.token,c=g({queryKey:[`public-translation`,s,o],enabled:!!(s&&o!==i),queryFn:()=>t.post(`/api/public/wizards/${s}/translation${V}`,{lang:o}),staleTime:1/0,retry:!1}),l=g({queryKey:[`public-texts`,s,o],enabled:!(!s||N(o)),queryFn:()=>t.get(`/api/public/wizards/${s}/texts/${o}`),staleTime:1/0,retry:!1}),u=!N(o),d=o===i||c.data&&(!u||l.data),f=o!==i&&(c.isError||u&&l.isError),p=d&&!f?o:i,m=(0,R.useMemo)(()=>!N(p)&&l.data?.lang===p?{lang:l.data.lang,runner:l.data.runner,notes:l.data.notes}:null,[p,l.data]);if((0,R.useEffect)(()=>{e&&M(p,m)},[e,p,m]),(0,R.useEffect)(()=>()=>M(null),[]),!e)return null;let h=p!==i&&c.data?c.data:null;return{own:i,other:a,shown:p,wizard:h??e,translating:o!==i&&!d&&!f,failed:!!f,translated:!!h,machine:h?.translation?.machine??!1,pick:e=>me(e!==i)}}function K({page:e,tone:t=`ground`}){if(!e?.other)return null;let n=e.translating?e.other:e.shown;return(0,U.jsx)(L,{langs:[e.own,e.other],value:n,onPick:e.pick,tone:t})}function q({page:e,small:t}){if(!e)return null;let n=t?`truncate text-[0.75rem]`:`text-[0.8125rem]`;return e.failed?(0,U.jsx)(`p`,{className:m(`text-ink-3`,n),children:F(`translation.failed`)}):e.translated?(0,U.jsxs)(`p`,{className:m(`text-ink-3`,n),children:[e.machine?(0,U.jsxs)(U.Fragment,{children:[F(`translation.machine`),` · `]}):null,(0,U.jsx)(`button`,{type:`button`,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,onClick:()=>e.pick(e.own),children:F(`translation.showOriginal`)})]}):null}function _e(e,n){let r=(0,R.useRef)(null),i=n&&!n.translating?n.translated?n.shown:null:void 0;(0,R.useEffect)(()=>{if(!e||i===void 0)return;let n=`${e}:${i}`;r.current!==n&&(r.current=n,t.post(`/api/runs/${e}/lang`,{lang:i}).catch(()=>void 0))},[e,i])}function ve(e,t){(0,R.useEffect)(()=>{if(!e||!t)return;let n=l(`/api/public/wizards/${e}`),r=[{rel:`manifest`,href:`${n}/manifest.webmanifest`},{rel:`apple-touch-icon`,href:`${n}/icons/apple-touch-icon.png`},{rel:`icon`,href:`${n}/icons/favicon.png`,type:`image/png`}].flatMap(({rel:e,href:t,type:n})=>{let r=document.querySelector(`link[rel="${e}"]`);if(!r)return[];let i={href:r.getAttribute(`href`),type:r.getAttribute(`type`)};return r.setAttribute(`href`,t),n&&r.setAttribute(`type`,n),[{link:r,before:i}]}),i=document.createElement(`meta`);return i.name=`apple-mobile-web-app-title`,i.content=t,document.head.appendChild(i),()=>{for(let{link:e,before:t}of r)for(let[n,r]of Object.entries(t))r===null?e.removeAttribute(n):e.setAttribute(n,r);i.remove()}},[e,t])}var J=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Y=J||/Android/.test(navigator.userAgent);function ye(){let[e,t]=(0,R.useState)(()=>window.wizardInstall??null),[n,r]=(0,R.useState)(!1);if((0,R.useEffect)(()=>{let e=()=>t(window.wizardInstall??null);return window.addEventListener(`wizard-install`,e),()=>window.removeEventListener(`wizard-install`,e)},[]),window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0||Y&&!e&&!J)return null;let i=/Mac/.test(navigator.platform),a=F(Y?`install.ios`:i?`install.bookmark.mac`:`install.bookmark.pc`);return(0,U.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{Y&&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:[Y?(0,U.jsx)(ce,{className:`size-4`}):(0,U.jsx)(oe,{className:`size-4`}),F(Y?`install.add`:`install.bookmark`)]}),n?(0,U.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:a}):null]})}function be({brand:e,toggle:t=!0,start:n}){return(0,U.jsx)(`header`,{className:`safe-top`,children:(0,U.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[n?(0,U.jsx)(`div`,{className:`absolute left-3`,children:n}):null,e.logoUrl?(0,U.jsx)(`img`,{src:l(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,U.jsx)(`span`,{className:`max-w-[60%] truncate font-display font-semibold text-[0.9375rem] text-ink-2 tracking-tight`,children:e.name}):null,t?(0,U.jsx)(`div`,{className:`absolute right-3`,children:(0,U.jsx)(A,{})}):null]})})}function xe({siteKey:e,onToken:t}){let n=(0,R.useRef)(null);return(0,R.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,U.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function Se({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||c||z?null:(0,U.jsxs)(`a`,{href:_(`${window.location.origin}${d}/w/${e}`),className:`mt-3 inline-flex items-center gap-1.5 text-[0.8125rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:[(0,U.jsx)(E,{className:`size-4`}),` `,F(`install.app`)]})}var X=e=>`wz.run.${e}`,Z=()=>s().state?.elsewhere===!0,Ce=c&&new URLSearchParams(window.location.search).get(`start`)===`1`,Q=z===`inline`?`min-h-80`:`min-h-dvh`;function $(e,n,i){let a=r(),[o,s]=(0,R.useState)(!1),[c,l]=(0,R.useState)(null),[u,d]=(0,R.useState)(null),f=(()=>{try{return localStorage.getItem(X(e.token))}catch{return null}})();return{busy:o,error:c,captcha:u,setCaptcha:d,start:async()=>{s(!0),l(null);try{let{runId:r}=await t.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:u??void 0,embedded:z!==null,origin:ue??void 0,lang:i??void 0});try{localStorage.setItem(X(e.token),r)}catch{}a(`${n}/${r}`,{replace:Ce})}catch(e){l(e.message),s(!1)}},resume:f?()=>a(`${n}/${f}`):null}}function we({wizard:e,page:t}){let{busy:n,error:r,captcha:a,setCaptcha:o,start:s,resume:l}=$(e,`/w/${e.token}`,t?.translated?t.shown:null),d=Z(),p=Ce&&e.available&&!e.turnstileSiteKey,m=(0,R.useRef)(!1);return(0,R.useEffect)(()=>{p&&!m.current&&(m.current=!0,s())},[p]),p&&!r?(0,U.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,U.jsx)(f,{})}):(0,U.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:[d?(0,U.jsx)(`p`,{className:`mb-6 rounded-xl bg-paper-2 px-5 py-3 text-[0.875rem] text-ink-2`,children:F(`run.elsewhere`)}):null,(0,U.jsx)(k,{kind:e.avatar,costume:e.costume,size:190,fluffy:!0}),(0,U.jsx)(`h1`,{className:`wizard-title mt-2 text-balance font-display font-semibold text-[1.875rem] leading-[1.1] tracking-tight sm:text-[2.125rem]`,children:e.title}),e.description?(0,U.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,(0,U.jsx)(`div`,{className:`mt-3`,children:(0,U.jsx)(q,{page:t})}),e.available?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(u,{size:`lg`,className:`mt-10 min-w-48`,busy:n,disabled:!!e.turnstileSiteKey&&!a,onClick:s,children:[F(`run.start`),` `,(0,U.jsx)(i,{className:`size-4`})]}),e.turnstileSiteKey?(0,U.jsx)(xe,{siteKey:e.turnstileSiteKey,onToken:o}):null,l?(0,U.jsx)(`button`,{type:`button`,onClick:l,className:`mt-4 text-[0.875rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:F(`run.resume`)}):null,(0,U.jsx)(Te,{wizard:e,current:`steps`}),z||c?null:(0,U.jsx)(ye,{}),(0,U.jsx)(Se,{token:e.token})]}):(0,U.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??F(`run.unavailable`)}),r?(0,U.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:r}):null]})}function Te({wizard:e,current:t}){let n=e.runners.filter(e=>e.id!==t&&e.kind===`page`&&e.url);return n.length?(0,U.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,U.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:F(`run.orAs`,{label:e.label})},e.id))}):null}function Ee({wizard:e,page:t}){let n=T();return(0,U.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,U.jsxs)(`div`,{className:`mx-auto flex h-16 w-full max-w-[760px] items-center gap-3 pr-2 pl-4 sm:pr-4 sm:pl-6`,children:[(0,U.jsx)(`span`,{className:m(n?.speaking&&`animate-breathe`),children:(0,U.jsx)(k,{kind:e.avatar,costume:e.costume,size:38})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,U.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null,(0,U.jsx)(q,{page:t,small:!0})]}),e.brand.logoUrl&&z!==`popout`?(0,U.jsx)(`img`,{src:l(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,(0,U.jsx)(K,{page:t,tone:`surface`}),z?null:(0,U.jsx)(A,{}),z===`popout`?(0,U.jsx)(p,{label:F(`common.close`),onClick:de,children:(0,U.jsx)(y,{className:`size-5`})}):null]})})}function De({door:e,wizard:t,page:n,header:r,footer:a}){let{busy:o,error:s,captcha:c,setCaptcha:l,start:u,resume:d}=$(t,`/w/${t.token}/${e}`,n?.translated?n.shown:null),f=Z(),p=[];return f&&p.push({key:`elsewhere`,who:`bot`,node:F(`run.elsewhere`)}),p.push({key:`hello`,who:`bot`,node:t.description||t.title}),e!==`chat`&&p.push({key:e,who:`bot`,node:F(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||p.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??F(`run.unavailable`)}),s&&p.push({key:`error`,who:`bot`,node:s,tone:`error`}),t.available&&p.push(b(`start`,(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(S,{primary:!0,busy:o,disabled:!!t.turnstileSiteKey&&!c,onClick:()=>void u(),children:[F(`run.start`),` `,(0,U.jsx)(i,{className:`size-4`})]}),d?(0,U.jsx)(S,{onClick:d,children:F(`run.resume`)}):null,t.turnstileSiteKey?(0,U.jsx)(xe,{siteKey:t.turnstileSiteKey,onToken:l}):null]}))),(0,U.jsxs)(w,{header:r,footer:a,children:[(0,U.jsx)(x,{avatar:t.avatar,costume:t.costume,lines:p}),(0,U.jsx)(C,{})]})}function Oe({className:e}){return(0,U.jsx)(`footer`,{className:m(`text-center text-ink-4`,e),children:(0,U.jsx)(`a`,{href:`${d}/`,target:z?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:F(`run.madeWith`).replace(`engenty wizards`,j.name)})})}function ke({chat:e=!1,steps:i=!1,talk:s=!1,video:l=!1}){let{token:p,runId:_}=h(),v=r(),y=g({queryKey:[`public`,p,V],queryFn:()=>t.get(`/api/public/wizards/${p}${V}`),retry:(e,t)=>n(t)&&e<3}),b=y.data?.runners??[],x=!y.data||b.some(e=>e.id===`talk`),S=!y.data||b.some(e=>e.id===`video`),C=!y.data||b.some(e=>e.id===`chat`)||s&&x||l&&S,w=b[0]?.id,T=e||z===`popout`||!i&&!_&&C&&(w===`chat`||w===`talk`||w===`video`),E=l&&S||!i&&!e&&!s&&w===`video`,D=!E&&(s&&x||!i&&!e&&w===`talk`),O=E?`video`:D?`talk`:`chat`,A=ge(y.data);_e(_,A),ne(y.data?.brand.theme),re(y.data?.avatar),ve(p,y.data?.title),fe(T);let M=A?.wizard.title??y.data?.title;(0,R.useEffect)(()=>{M&&(document.title=M)},[M]);let N=(0,R.useCallback)(e=>{try{p&&localStorage.getItem(X(p))===_&&localStorage.removeItem(X(p))}catch{}v(e,{replace:!0,state:{elsewhere:!0}})},[v,p,_]);if((0,R.useEffect)(()=>{p&&_&&a(`run`,{token:p,runId:_})},[p,_]),y.isLoading)return(0,U.jsx)(`div`,{className:m(`flex items-center justify-center text-ink-4`,Q),children:(0,U.jsx)(f,{})});if(e&&y.data&&!C||s&&y.data&&!x||l&&y.data&&!S)return(0,U.jsx)(o,{to:`/w/${p}`,replace:!0});if(!y.data){let e=n(y.error);return(0,U.jsxs)(`div`,{className:m(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Q),children:[(0,U.jsx)(k,{kind:`pebble`,size:80}),(0,U.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:F(e?`common.offline`:`run.notFound`)}),e?(0,U.jsx)(u,{variant:`secondary`,onClick:()=>void y.refetch(),children:F(`common.retry`)}):null]})}let P=A?.wizard??y.data,L=A?.translating?(0,U.jsxs)(`div`,{className:m(`flex flex-col items-center justify-center gap-3 text-ink-3`,Q),children:[(0,U.jsx)(f,{}),(0,U.jsx)(`p`,{className:`text-[0.875rem]`,children:F(`translation.working`)})]}):null;if(T){let e=(0,U.jsx)(Ee,{wizard:P,page:A}),t=c?(0,U.jsx)(`div`,{className:`safe-bottom`}):(0,U.jsx)(Oe,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,U.jsxs)(`div`,{className:`wizard-page flex h-dvh flex-col`,children:[(0,U.jsx)(ee,{effects:y.data.brand.theme.effects}),z||c?null:(0,U.jsx)(I,{}),L??(_?(0,U.jsx)(te,{runId:_,talk:D,call:E?`video`:D?`audio`:!1,onRestart:()=>v(`/w/${p}/${O}`),onNotFound:()=>N(`/w/${p}/${O}`),header:E||D?void 0:e,footer:t}):(0,U.jsx)(De,{wizard:P,page:A,header:e,footer:t,door:O}))]})}return(0,U.jsxs)(`div`,{className:m(`wizard-page flex flex-col`,Q),children:[(0,U.jsx)(ee,{effects:y.data.brand.theme.effects}),z||c?null:(0,U.jsx)(I,{}),z===`inline`||c?null:(0,U.jsx)(be,{brand:y.data.brand,toggle:!z,start:(0,U.jsx)(K,{page:A})}),z===`inline`||c?(0,U.jsx)(`div`,{className:`flex justify-end px-3 pt-2`,children:(0,U.jsx)(K,{page:A,tone:`surface`})}):null,_&&(A?.translated||A?.failed)?(0,U.jsx)(`div`,{className:`flex justify-center px-5`,children:(0,U.jsx)(q,{page:A})}):null,(0,U.jsx)(`div`,{className:`flex-1`,children:L??(_?(0,U.jsx)(ie,{runId:_,onRestart:()=>v(`/w/${p}`),onNotFound:()=>N(`/w/${p}`)}):(0,U.jsx)(we,{wizard:P,page:A}))}),c?(0,U.jsx)(`div`,{className:`safe-bottom`}):(0,U.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,U.jsx)(`a`,{href:`${d}/`,target:z?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:F(`run.madeWith`).replace(`engenty wizards`,j.name)})})]})}export{be as BrandHeader,ke as PublicRunner};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./jsx-runtime-C3cWAN_r.js";import{d as n}from"./marked.esm-BfGIZK7F.js";import{Xn as r}from"./host-BELYIPMT.js";import{s as i}from"./i18n-DPqdH1PJ.js";var a={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};a.node;var o=n(a),s=e(t(),1);function c(e){return i(e.origin===`local`?`readonly.space`:`readonly.server`)}function l({children:e}){return(0,s.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-amber-tint px-4 py-3 font-medium text-[0.875rem] text-ink leading-relaxed`,children:[(0,s.jsx)(r,{className:`mt-0.5 size-4 shrink-0 text-amber`}),(0,s.jsx)(`p`,{className:`min-w-0`,children:e})]})}export{c as n,o as r,l as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./jsx-runtime-C3cWAN_r.js";import{d as n}from"./marked.esm-BfGIZK7F.js";import{Xn as r}from"./host-Ckjz94Ea.js";import{s as i}from"./i18n-ClCOlfx2.js";var a={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};a.node;var o=n(a),s=e(t(),1);function c(e){return i(e.origin===`local`?`readonly.space`:`readonly.server`)}function l({children:e}){return(0,s.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl bg-amber-tint px-4 py-3 font-medium text-[0.875rem] text-ink leading-relaxed`,children:[(0,s.jsx)(r,{className:`mt-0.5 size-4 shrink-0 text-amber`}),(0,s.jsx)(`p`,{className:`min-w-0`,children:e})]})}export{c as n,o as r,l as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,C as n,Fn as r,On as i,cn as a,fn as o,in as s,on as c,rn as l,yr as u}from"./ui-D4qQLcbs.js";import{n as d,t as f}from"./jsx-runtime-C3cWAN_r.js";import{n as p,s as m}from"./i18n-DPqdH1PJ.js";import{s as h}from"./read-aloud-pd-PWi_5.js";import{_n as g}from"./host-BELYIPMT.js";import{n as _}from"./RunDrawer-BRXH71U8.js";var v=e(d(),1),y=e(f(),1),b=`results-search`,x={q:``,mode:``,days:0};function S(e,n,r){let i=new URLSearchParams;n&&i.set(`wizard`,n),r.q.trim()&&i.set(`q`,r.q.trim()),r.mode&&i.set(`mode`,r.mode),r.days&&i.set(`days`,String(r.days));let a=i.toString();return u({queryKey:[`results`,e,a],queryFn:()=>t.get(`/api/studio/spaces/${e}/results${a&&`?${a}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function C({data:e,wizardId:t,onWizard:n,filter:r,onFilter:s}){let[c,l]=(0,v.useState)(r.q);return g({icon:i,label:m(`space.resultsSearch`),run:()=>{let e=document.getElementById(b);e?.scrollIntoView({block:`center`,behavior:`smooth`}),e?.focus()}}),(0,v.useEffect)(()=>{if(c===r.q)return;let e=setTimeout(()=>s({...r,q:c}),250);return()=>clearTimeout(e)},[c,r,s]),(0,y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,y.jsx)(o,{value:t??``,onChange:e=>n(e||null),options:[{value:``,label:m(`space.resultsAllWizards`)},...e.wizards.filter(e=>e.results||e.id===t).map(e=>({value:e.id,label:`${e.title} (${e.results})`}))],className:`w-56 max-sm:w-full`}),(0,y.jsxs)(`div`,{className:`relative min-w-0 flex-1 basis-56`,children:[(0,y.jsx)(i,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-3`}),(0,y.jsx)(a,{type:`search`,value:c,onChange:e=>l(e.target.value),id:b,placeholder:m(`space.resultsSearch`),"aria-label":m(`space.resultsSearch`),className:`w-full pl-9`})]}),(0,y.jsx)(o,{value:r.mode,onChange:e=>s({...r,mode:e}),options:[{value:``,label:m(`space.resultsModeAll`)},{value:`live`,label:`Live`},{value:`test`,label:`Test`}],className:`w-32`}),(0,y.jsx)(o,{value:String(r.days),onChange:e=>s({...r,days:Number(e)}),options:[{value:`0`,label:m(`space.resultsAnyTime`)},{value:`1`,label:m(`space.resultsDay`)},{value:`7`,label:m(`space.resultsDays`,{n:7})},{value:`30`,label:m(`space.resultsDays`,{n:30})}],className:`w-44`})]})}function w({data:e,wizardId:t,onWizard:i,filter:a,onFilter:o}){let[u,d]=(0,v.useState)(null),f=t=>e.wizards.find(e=>e.id===t)?.title??``,g=new Intl.DateTimeFormat(p,{dateStyle:`medium`,timeStyle:`short`});return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(n,{title:t?f(t):m(`space.resultsAll`),hint:m(`space.resultsHint`),plain:!0,children:[(0,y.jsx)(C,{data:e,wizardId:t,onWizard:i,filter:a,onFilter:o}),e.runs.length?(0,y.jsx)(l,{className:`flex flex-col p-1.5`,children:e.runs.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>d(e),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:t?g.format(new Date(e.doneAt)):f(e.wizardId)}),(0,y.jsxs)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:[t?null:`${g.format(new Date(e.doneAt))} · `,m(`space.resultCredits`,{n:e.credits})]})]}),e.assets?(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-ink-3 tabular-nums`,title:m(`space.resultFiles`,{n:e.assets}),children:[(0,y.jsx)(r,{className:`size-3.5`}),e.assets]}):null,e.mode===`test`?(0,y.jsx)(s,{children:m(`run.testChip`)}):(0,y.jsxs)(s,{tone:`live`,children:[`Live v`,e.version]})]},e.id))}):(0,y.jsx)(l,{children:(0,y.jsx)(c,{children:a.q.trim()||a.mode||a.days?m(`space.resultsNone`):m(`space.resultsEmpty`)})})]}),u?(0,y.jsx)(_,{header:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-[0.875rem]`,children:f(u.wizardId)}),u.mode===`test`?(0,y.jsx)(s,{children:m(`run.testChip`)}):(0,y.jsxs)(s,{tone:`live`,children:[`Live v`,u.version]})]}),onClose:()=>d(null),children:(0,y.jsx)(h,{runId:u.id,compact:!0,studio:!0},u.id)}):null]})}export{w as n,S as r,x as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,C as n,Fn as r,On as i,cn as a,fn as o,in as s,on as c,rn as l,yr as u}from"./ui-BjhZhw8x.js";import{n as d,t as f}from"./jsx-runtime-C3cWAN_r.js";import{n as p,s as m}from"./i18n-ClCOlfx2.js";import{s as h}from"./read-aloud-spC7eEBp.js";import{_n as g}from"./host-Ckjz94Ea.js";import{n as _}from"./RunDrawer-CSpTNJp-.js";var v=e(d(),1),y=e(f(),1),b=`results-search`,x={q:``,mode:``,days:0};function S(e,n,r){let i=new URLSearchParams;n&&i.set(`wizard`,n),r.q.trim()&&i.set(`q`,r.q.trim()),r.mode&&i.set(`mode`,r.mode),r.days&&i.set(`days`,String(r.days));let a=i.toString();return u({queryKey:[`results`,e,a],queryFn:()=>t.get(`/api/studio/spaces/${e}/results${a&&`?${a}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function C({data:e,wizardId:t,onWizard:n,filter:r,onFilter:s}){let[c,l]=(0,v.useState)(r.q);return g({icon:i,label:m(`space.resultsSearch`),run:()=>{let e=document.getElementById(b);e?.scrollIntoView({block:`center`,behavior:`smooth`}),e?.focus()}}),(0,v.useEffect)(()=>{if(c===r.q)return;let e=setTimeout(()=>s({...r,q:c}),250);return()=>clearTimeout(e)},[c,r,s]),(0,y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,y.jsx)(o,{value:t??``,onChange:e=>n(e||null),options:[{value:``,label:m(`space.resultsAllWizards`)},...e.wizards.filter(e=>e.results||e.id===t).map(e=>({value:e.id,label:`${e.title} (${e.results})`}))],className:`w-56 max-sm:w-full`}),(0,y.jsxs)(`div`,{className:`relative min-w-0 flex-1 basis-56`,children:[(0,y.jsx)(i,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-3`}),(0,y.jsx)(a,{type:`search`,value:c,onChange:e=>l(e.target.value),id:b,placeholder:m(`space.resultsSearch`),"aria-label":m(`space.resultsSearch`),className:`w-full pl-9`})]}),(0,y.jsx)(o,{value:r.mode,onChange:e=>s({...r,mode:e}),options:[{value:``,label:m(`space.resultsModeAll`)},{value:`live`,label:`Live`},{value:`test`,label:`Test`}],className:`w-32`}),(0,y.jsx)(o,{value:String(r.days),onChange:e=>s({...r,days:Number(e)}),options:[{value:`0`,label:m(`space.resultsAnyTime`)},{value:`1`,label:m(`space.resultsDay`)},{value:`7`,label:m(`space.resultsDays`,{n:7})},{value:`30`,label:m(`space.resultsDays`,{n:30})}],className:`w-44`})]})}function w({data:e,wizardId:t,onWizard:i,filter:a,onFilter:o}){let[u,d]=(0,v.useState)(null),f=t=>e.wizards.find(e=>e.id===t)?.title??``,g=new Intl.DateTimeFormat(p,{dateStyle:`medium`,timeStyle:`short`});return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(n,{title:t?f(t):m(`space.resultsAll`),hint:m(`space.resultsHint`),plain:!0,children:[(0,y.jsx)(C,{data:e,wizardId:t,onWizard:i,filter:a,onFilter:o}),e.runs.length?(0,y.jsx)(l,{className:`flex flex-col p-1.5`,children:e.runs.map(e=>(0,y.jsxs)(`button`,{type:`button`,onClick:()=>d(e),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:t?g.format(new Date(e.doneAt)):f(e.wizardId)}),(0,y.jsxs)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:[t?null:`${g.format(new Date(e.doneAt))} · `,m(`space.resultCredits`,{n:e.credits})]})]}),e.assets?(0,y.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-ink-3 tabular-nums`,title:m(`space.resultFiles`,{n:e.assets}),children:[(0,y.jsx)(r,{className:`size-3.5`}),e.assets]}):null,e.mode===`test`?(0,y.jsx)(s,{children:m(`run.testChip`)}):(0,y.jsxs)(s,{tone:`live`,children:[`Live v`,e.version]})]},e.id))}):(0,y.jsx)(l,{children:(0,y.jsx)(c,{children:a.q.trim()||a.mode||a.days?m(`space.resultsNone`):m(`space.resultsEmpty`)})})]}),u?(0,y.jsx)(_,{header:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-[0.875rem]`,children:f(u.wizardId)}),u.mode===`test`?(0,y.jsx)(s,{children:m(`run.testChip`)}):(0,y.jsxs)(s,{tone:`live`,children:[`Live v`,u.version]})]}),onClose:()=>d(null),children:(0,y.jsx)(h,{runId:u.id,compact:!0,studio:!0},u.id)}):null]})}export{w as n,S as r,x as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./list-ordered-B7aUqZdk.js";import{sn as n,vn as r,zn as i}from"./ui-D4qQLcbs.js";import{Un as a}from"./host-BELYIPMT.js";import{d as o,n as s}from"./marked.esm-BfGIZK7F.js";import{n as c,t as l}from"./jsx-runtime-C3cWAN_r.js";import{s as u}from"./i18n-DPqdH1PJ.js";var d={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};d.node;var f=o(d),p=e(c(),1),m=e(l(),1),h=`wizards.runDrawer.width`,g=`wizards.runDrawer.wide`,_=680,v=400,y=()=>Math.max(v,window.innerWidth-120);function b(e){try{return localStorage.getItem(e)}catch{return null}}function x(e,t){try{localStorage.setItem(e,t)}catch{}}function S(){let[e,t]=(0,p.useState)(()=>{let e=Number(b(h));return e?Math.min(Math.max(e,v),y()):_}),[n,r]=(0,p.useState)(()=>b(g)===`1`),i=(0,p.useCallback)(e=>{let n=Math.round(Math.min(Math.max(e,v),y()));t(n),x(h,String(n))},[]);return{width:e,wide:n,toggleWide:()=>{r(!n),x(g,n?`0`:`1`)},onPointerDown:t=>{t.preventDefault();let n=t.clientX,r=e,a=e=>i(r+n-e.clientX),o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},onKeyDown:t=>{let n=t.shiftKey?64:16;t.key===`ArrowLeft`?(t.preventDefault(),i(e+n)):t.key===`ArrowRight`&&(t.preventDefault(),i(e-n))},reset:()=>i(_)}}function C({look:e,onChange:n,ways:i=[`steps`,`chat`]}){let o=[{id:`steps`,label:u(`chat.steps`),Icon:t},{id:`chat`,label:u(`chat.chat`),Icon:a}].filter(e=>i.includes(e.id));return(0,m.jsx)(`fieldset`,{"aria-label":u(`chat.view`),className:`m-0 flex min-w-0 rounded-full border-0 bg-paper-2 p-0.5`,children:o.map(({id:t,label:i,Icon:a})=>(0,m.jsxs)(`button`,{type:`button`,"aria-pressed":e===t,title:i,onClick:()=>n(t),className:r(`inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 font-medium text-[0.75rem] transition coarse:h-9`,e===t?`bg-card text-ink shadow-soft`:`text-ink-3 hover:text-ink`),children:[(0,m.jsx)(a,{className:`size-3.5`}),(0,m.jsx)(`span`,{className:r(e!==t&&`sr-only`),children:i})]},t))})}function w({header:e,actions:t,onClose:a,children:o}){let c=S();return(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex justify-end bg-[oklch(20%_0.01_60/0.22)] backdrop-blur-[1px]`,onClick:a,children:(0,m.jsxs)(`div`,{className:r(`relative flex h-full w-full animate-rise flex-col bg-background shadow-overlay`,!c.wide&&`sm:w-[var(--drawer)]`),style:{"--drawer":`${c.width}px`},onClick:e=>e.stopPropagation(),children:[c.wide?null:(0,m.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u(`editor.resize`),"aria-valuenow":c.width,tabIndex:0,title:u(`editor.resize`),onPointerDown:c.onPointerDown,onKeyDown:c.onKeyDown,onDoubleClick:c.reset,className:`group -left-2.5 absolute inset-y-0 z-10 hidden w-5 cursor-col-resize outline-none sm:block`,children:(0,m.jsx)(`span`,{className:`-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 h-8 w-1 rounded-full bg-ink-4/20 transition group-hover:bg-ember/60 group-focus-visible:bg-ember group-active:h-12 group-active:bg-ember`})}),(0,m.jsxs)(`div`,{className:`kb-hide flex h-14 shrink-0 items-center gap-3 px-4`,children:[(0,m.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:e}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t,(0,m.jsx)(n,{label:u(c.wide?`runDrawer.shrink`:`runDrawer.expand`),onClick:c.toggleWide,className:`max-sm:hidden`,children:c.wide?(0,m.jsx)(f,{className:`size-4`}):(0,m.jsx)(i,{className:`size-4`})}),(0,m.jsx)(n,{label:u(`editor.close`),onClick:a,children:(0,m.jsx)(s,{className:`size-5`})})]})]}),(0,m.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:o})]})})}export{w as n,C as t};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./list-ordered-B7aUqZdk.js";import{sn as n,vn as r,zn as i}from"./ui-BjhZhw8x.js";import{Un as a}from"./host-Ckjz94Ea.js";import{d as o,n as s}from"./marked.esm-BfGIZK7F.js";import{n as c,t as l}from"./jsx-runtime-C3cWAN_r.js";import{s as u}from"./i18n-ClCOlfx2.js";var d={name:`minimize-2`,size:24,node:[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]};d.node;var f=o(d),p=e(c(),1),m=e(l(),1),h=`wizards.runDrawer.width`,g=`wizards.runDrawer.wide`,_=680,v=400,y=()=>Math.max(v,window.innerWidth-120);function b(e){try{return localStorage.getItem(e)}catch{return null}}function x(e,t){try{localStorage.setItem(e,t)}catch{}}function S(){let[e,t]=(0,p.useState)(()=>{let e=Number(b(h));return e?Math.min(Math.max(e,v),y()):_}),[n,r]=(0,p.useState)(()=>b(g)===`1`),i=(0,p.useCallback)(e=>{let n=Math.round(Math.min(Math.max(e,v),y()));t(n),x(h,String(n))},[]);return{width:e,wide:n,toggleWide:()=>{r(!n),x(g,n?`0`:`1`)},onPointerDown:t=>{t.preventDefault();let n=t.clientX,r=e,a=e=>i(r+n-e.clientX),o=()=>{window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),document.body.style.removeProperty(`cursor`),document.body.style.removeProperty(`user-select`)};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o)},onKeyDown:t=>{let n=t.shiftKey?64:16;t.key===`ArrowLeft`?(t.preventDefault(),i(e+n)):t.key===`ArrowRight`&&(t.preventDefault(),i(e-n))},reset:()=>i(_)}}function C({look:e,onChange:n,ways:i=[`steps`,`chat`]}){let o=[{id:`steps`,label:u(`chat.steps`),Icon:t},{id:`chat`,label:u(`chat.chat`),Icon:a}].filter(e=>i.includes(e.id));return(0,m.jsx)(`fieldset`,{"aria-label":u(`chat.view`),className:`m-0 flex min-w-0 rounded-full border-0 bg-paper-2 p-0.5`,children:o.map(({id:t,label:i,Icon:a})=>(0,m.jsxs)(`button`,{type:`button`,"aria-pressed":e===t,title:i,onClick:()=>n(t),className:r(`inline-flex h-7 items-center gap-1.5 rounded-full px-2.5 font-medium text-[0.75rem] transition coarse:h-9`,e===t?`bg-card text-ink shadow-soft`:`text-ink-3 hover:text-ink`),children:[(0,m.jsx)(a,{className:`size-3.5`}),(0,m.jsx)(`span`,{className:r(e!==t&&`sr-only`),children:i})]},t))})}function w({header:e,actions:t,onClose:a,children:o}){let c=S();return(0,m.jsx)(`div`,{className:`fixed inset-0 z-50 flex justify-end bg-[oklch(20%_0.01_60/0.22)] backdrop-blur-[1px]`,onClick:a,children:(0,m.jsxs)(`div`,{className:r(`relative flex h-full w-full animate-rise flex-col bg-background shadow-overlay`,!c.wide&&`sm:w-[var(--drawer)]`),style:{"--drawer":`${c.width}px`},onClick:e=>e.stopPropagation(),children:[c.wide?null:(0,m.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":u(`editor.resize`),"aria-valuenow":c.width,tabIndex:0,title:u(`editor.resize`),onPointerDown:c.onPointerDown,onKeyDown:c.onKeyDown,onDoubleClick:c.reset,className:`group -left-2.5 absolute inset-y-0 z-10 hidden w-5 cursor-col-resize outline-none sm:block`,children:(0,m.jsx)(`span`,{className:`-translate-x-1/2 -translate-y-1/2 absolute top-1/2 left-1/2 h-8 w-1 rounded-full bg-ink-4/20 transition group-hover:bg-ember/60 group-focus-visible:bg-ember group-active:h-12 group-active:bg-ember`})}),(0,m.jsxs)(`div`,{className:`kb-hide flex h-14 shrink-0 items-center gap-3 px-4`,children:[(0,m.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:e}),(0,m.jsxs)(`div`,{className:`flex items-center gap-1`,children:[t,(0,m.jsx)(n,{label:u(c.wide?`runDrawer.shrink`:`runDrawer.expand`),onClick:c.toggleWide,className:`max-sm:hidden`,children:c.wide?(0,m.jsx)(f,{className:`size-4`}):(0,m.jsx)(i,{className:`size-4`})}),(0,m.jsx)(n,{label:u(`editor.close`),onClick:a,children:(0,m.jsx)(s,{className:`size-5`})})]})]}),(0,m.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:o})]})})}export{w as n,C as t};