@engenty/wizards-runtime 0.20.0 → 0.20.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 (63) hide show
  1. package/README.md +1 -1
  2. package/apps/runtime/dist/cli/main.js +2 -0
  3. package/apps/runtime/dist/docs/dev/licensing.md +5 -2
  4. package/apps/runtime/dist/docs/user-guide/command-line.md +2 -1
  5. package/apps/web/dist/assets/{AboutDialog-QWzpEK8M.js → AboutDialog-CSbCideu.js} +1 -1
  6. package/apps/web/dist/assets/{BlockEditor-C44bI_ih.js → BlockEditor-CgjXTWly.js} +1 -1
  7. package/apps/web/dist/assets/{Bundle-DZyQ1FP7.js → Bundle-C0u5HUZL.js} +1 -1
  8. package/apps/web/dist/assets/CapabilitiesPage-M2s68GkB.js +2 -0
  9. package/apps/web/dist/assets/{ChangelogDialog-CdHqJV2P.js → ChangelogDialog-BG3enhF_.js} +1 -1
  10. package/apps/web/dist/assets/{CodeEditor-BRufUwu0.js → CodeEditor-2LyHbSre.js} +1 -1
  11. package/apps/web/dist/assets/{ConnectorsSection-BO6jHrYU.js → ConnectorsSection-C2ZKAYYg.js} +1 -1
  12. package/apps/web/dist/assets/EditorPage-DrlMr_BY.js +3 -0
  13. package/apps/web/dist/assets/{FlowPreview-aj58c-gH.js → FlowPreview-BXf4EKjU.js} +1 -1
  14. package/apps/web/dist/assets/{LangSwitch-BNkytlus.js → LangSwitch-BLB7dDce.js} +1 -1
  15. package/apps/web/dist/assets/{Marketplace-D3hdvrkz.js → Marketplace-B3NoH5Va.js} +2 -2
  16. package/apps/web/dist/assets/{NewWizardChannels-fveQcQlY.js → NewWizardChannels-5Nz8FBfp.js} +1 -1
  17. package/apps/web/dist/assets/{NewWizardPage-BTX1g2t1.js → NewWizardPage-DZZx49Zp.js} +1 -1
  18. package/apps/web/dist/assets/{OnboardingPage-DwF6KdQy.js → OnboardingPage-RawpCO9J.js} +1 -1
  19. package/apps/web/dist/assets/{ProtocolSection-YnJcMN9E.js → ProtocolSection-D4pst4zv.js} +1 -1
  20. package/apps/web/dist/assets/{PublicRunner-Bp4DxTrD.js → PublicRunner-COatyxMi.js} +1 -1
  21. package/apps/web/dist/assets/{ReadOnly-C6qmTD35.js → ReadOnly-CcHDevY4.js} +1 -1
  22. package/apps/web/dist/assets/{Results-BNuuBiwU.js → Results-DTEHveBZ.js} +1 -1
  23. package/apps/web/dist/assets/{RunDrawer-CMgN-XTB.js → RunDrawer-r6eFEs5D.js} +1 -1
  24. package/apps/web/dist/assets/SettingsPage-DmZdkZJZ.js +2 -0
  25. package/apps/web/dist/assets/{SetupPage-llGzMVeH.js → SetupPage-KE6tcFO2.js} +1 -1
  26. package/apps/web/dist/assets/{SharePage-CgQp_PT6.js → SharePage-Drntg_oj.js} +1 -1
  27. package/apps/web/dist/assets/{SkillEditor-ARx8QPGp.js → SkillEditor-Ca_bzmjD.js} +1 -1
  28. package/apps/web/dist/assets/{Skills-frfXXEcF.js → Skills-BcgxuD15.js} +1 -1
  29. package/apps/web/dist/assets/SpacePage-BdB2lsHC.js +2 -0
  30. package/apps/web/dist/assets/StudioHome-Dc4vCVDX.js +1 -0
  31. package/apps/web/dist/assets/TableEditor-DjIhH4Xp.js +7 -0
  32. package/apps/web/dist/assets/{UpdateCheck-D3QhfI5c.js → UpdateCheck-C82R62Tc.js} +2 -2
  33. package/apps/web/dist/assets/brand-BIT7AumL.js +2 -0
  34. package/apps/web/dist/assets/changelog-BqBrvuEE.js +1 -0
  35. package/apps/web/dist/assets/{code-editor-BLwDuQLI.js → code-editor-CufyaUFC.js} +2 -2
  36. package/apps/web/dist/assets/{host-C-AAp8Bz.js → host-CA1dqZWL.js} +41 -41
  37. package/apps/web/dist/assets/i18n-WXeVnv7i.js +55 -0
  38. package/apps/web/dist/assets/index-BtEYkDXF.js +102 -0
  39. package/apps/web/dist/assets/index-D1iL3986.css +1 -0
  40. package/apps/web/dist/assets/{read-aloud-DGS8mWgC.js → read-aloud-CRFt5q6k.js} +1 -1
  41. package/apps/web/dist/assets/{session-EIDP3Wzc.js → session-RDdtfee2.js} +1 -1
  42. package/apps/web/dist/assets/{theme-B46aPLtX.js → theme-23bNrOQh.js} +2 -2
  43. package/apps/web/dist/assets/{ui-DSgksc1H.js → ui-DkEhb2Rt.js} +1 -1
  44. package/apps/web/dist/assets/{useMutation-fT44ij_b.js → useMutation-BSffqL6W.js} +1 -1
  45. package/apps/web/dist/assets/{viewers-DvA5VsXw.js → viewers-CmGDpBjn.js} +2 -2
  46. package/apps/web/dist/index.html +15 -15
  47. package/apps/web/dist/mcp/flow.html +25 -25
  48. package/bin/bot.mjs +1120 -0
  49. package/bin/wizards.mjs +6 -0
  50. package/package.json +1 -1
  51. package/plugin/.claude-plugin/plugin.json +1 -1
  52. package/plugin/plugin.json +1 -1
  53. package/apps/web/dist/assets/CapabilitiesPage-DAr0-gN1.js +0 -2
  54. package/apps/web/dist/assets/EditorPage-Bx-fKnsY.js +0 -3
  55. package/apps/web/dist/assets/SettingsPage-CuUB26YJ.js +0 -2
  56. package/apps/web/dist/assets/SpacePage-Dv6ocsc_.js +0 -2
  57. package/apps/web/dist/assets/StudioHome-B0bZRm1L.js +0 -1
  58. package/apps/web/dist/assets/TableEditor-CfzTLmJF.js +0 -7
  59. package/apps/web/dist/assets/brand-DKuVyYhH.js +0 -2
  60. package/apps/web/dist/assets/changelog-Db3nvWao.js +0 -1
  61. package/apps/web/dist/assets/i18n-Dyi0kvaA.js +0 -55
  62. package/apps/web/dist/assets/index-CduFlFCp.css +0 -1
  63. package/apps/web/dist/assets/index-CtE0rJEL.js +0 -102
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,Qt as n,Sr as r,an as i,br as a,bt as o,cr as s,gn as c,hr as l,ht as u,mt as d,ot as f,un as p,xn as m,xr as h,yr as g,yt as _}from"./ui-DSgksc1H.js";import{d as v,n as y}from"./marked.esm-BfGIZK7F.js";import{T as b,_ as x,d as S,f as ee,g as C,h as w,m as T,n as te,p as E,v as D}from"./theme-B46aPLtX.js";import{n as O,t as k}from"./jsx-runtime-C3cWAN_r.js";import{l as ne,n as A,r as j,t as M}from"./brand-DKuVyYhH.js";import{a as N,et as P,l as F,s as I}from"./i18n-Dyi0kvaA.js";import{s as re,u as L}from"./read-aloud-DGS8mWgC.js";import{n as R}from"./LangSwitch-BNkytlus.js";var ie={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`}]]};ie.node;var ae=v(ie),oe={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`]};oe.node;var se=v(oe),z=e(O(),1);function ce(){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 B=ce(),le=B?new URLSearchParams(window.location.search).get(`page`):null,V=new URLSearchParams(window.location.search).get(`theme`),H=V?`?theme=${encodeURIComponent(V)}`:``,U=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),ue=()=>U(`close`);function de(e){(0,z.useEffect)(()=>{if(B===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>U(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(B===`modal`||B===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&U(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var W=e(k(),1),G=`wizards.runner.translate`,K=new Set;function fe(){try{return localStorage.getItem(G)===`on`}catch{return!1}}function pe(e){try{localStorage.setItem(G,e?`on`:`off`)}catch{}for(let e of K)e()}function me(){return(0,z.useSyncExternalStore)(e=>(K.add(e),()=>K.delete(e)),fe)}function he(e){let n=me(),[i]=(0,z.useState)(()=>F()),a=e?.lang??`en`,o=e?.translatable&&i&&i!==a?i:null,s=o&&n?o:a,c=e?.token,l=r({queryKey:[`public-translation`,c,s],enabled:!!(c&&s!==a),queryFn:()=>t.post(`/api/public/wizards/${c}/translation${H}`,{lang:s}),staleTime:1/0,retry:!1}),u=r({queryKey:[`public-texts`,c,s],enabled:!(!c||P(s)),queryFn:()=>t.get(`/api/public/wizards/${c}/texts/${s}`),staleTime:1/0,retry:!1}),d=!P(s),f=s===a||l.data&&(!d||u.data),p=s!==a&&(l.isError||d&&u.isError),m=f&&!p?s:a,h=(0,z.useMemo)(()=>!P(m)&&u.data?.lang===m?{lang:u.data.lang,runner:u.data.runner,notes:u.data.notes}:null,[m,u.data]);if((0,z.useEffect)(()=>{e&&N(m,h)},[e,m,h]),(0,z.useEffect)(()=>()=>N(null),[]),!e)return null;let g=m!==a&&l.data?l.data:null;return{own:a,other:o,shown:m,wizard:g??e,translating:s!==a&&!f&&!p,failed:!!p,translated:!!g,machine:g?.translation?.machine??!1,pick:e=>pe(e!==a)}}function q({page:e,tone:t=`ground`}){if(!e?.other)return null;let n=e.translating?e.other:e.shown;return(0,W.jsx)(R,{langs:[e.own,e.other],value:n,onPick:e.pick,tone:t})}function J({page:e,small:t}){if(!e)return null;let n=t?`truncate text-[0.75rem]`:`text-[0.8125rem]`;return e.failed?(0,W.jsx)(`p`,{className:m(`text-ink-3`,n),children:I(`translation.failed`)}):e.translated?(0,W.jsxs)(`p`,{className:m(`text-ink-3`,n),children:[e.machine?(0,W.jsxs)(W.Fragment,{children:[I(`translation.machine`),` · `]}):null,(0,W.jsx)(`button`,{type:`button`,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,onClick:()=>e.pick(e.own),children:I(`translation.showOriginal`)})]}):null}function ge(e,n){let r=(0,z.useRef)(null),i=n&&!n.translating?n.translated?n.shown:null:void 0;(0,z.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 _e(e,t){(0,z.useEffect)(()=>{if(!e||!t)return;let n=d(`/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 ve=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Y=ve||/Android/.test(navigator.userAgent);function ye(){let[e,t]=(0,z.useState)(()=>window.wizardInstall??null),[n,r]=(0,z.useState)(!1);if((0,z.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&&!ve)return null;let i=/Mac/.test(navigator.platform),a=I(Y?`install.ios`:i?`install.bookmark.mac`:`install.bookmark.pc`);return(0,W.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,W.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,W.jsx)(se,{className:`size-4`}):(0,W.jsx)(ae,{className:`size-4`}),I(Y?`install.add`:`install.bookmark`)]}),n?(0,W.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:a}):null]})}function be({brand:e,toggle:t=!0,start:n}){return(0,W.jsx)(`header`,{className:`safe-top`,children:(0,W.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[n?(0,W.jsx)(`div`,{className:`absolute left-3`,children:n}):null,e.logoUrl?(0,W.jsx)(`img`,{src:d(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,W.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,W.jsx)(`div`,{className:`absolute right-3`,children:(0,W.jsx)(j,{})}):null]})})}function xe({siteKey:e,onToken:t}){let n=(0,z.useRef)(null);return(0,z.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,W.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function Se({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||u||B?null:(0,W.jsxs)(`a`,{href:_(`${window.location.origin}${f}/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,W.jsx)(b,{className:`size-4`}),` `,I(`install.app`)]})}var X=e=>`wz.run.${e}`,Z=()=>g().state?.elsewhere===!0,Ce=u&&new URLSearchParams(window.location.search).get(`start`)===`1`,Q=B===`inline`?`min-h-80`:`min-h-dvh`;function $(e,n,r){let i=a(),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(null),[u,d]=(0,z.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:a}=await t.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:u??void 0,embedded:B!==null,origin:le??void 0,lang:r??void 0});try{localStorage.setItem(X(e.token),a)}catch{}i(`${n}/${a}`,{replace:Ce})}catch(e){l(e.message),s(!1)}},resume:f?()=>i(`${n}/${f}`):null}}function we({wizard:e,page:t}){let{busy:n,error:r,captcha:a,setCaptcha:o,start:l,resume:d}=$(e,`/w/${e.token}`,t?.translated?t.shown:null),f=Z(),p=Ce&&e.available&&!e.turnstileSiteKey,m=(0,z.useRef)(!1);return(0,z.useEffect)(()=>{p&&!m.current&&(m.current=!0,l())},[p]),p&&!r?(0,W.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,W.jsx)(c,{})}):(0,W.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:[f?(0,W.jsx)(`p`,{className:`mb-6 rounded-xl bg-paper-2 px-5 py-3 text-[0.875rem] text-ink-2`,children:I(`run.elsewhere`)}):null,(0,W.jsx)(A,{kind:e.avatar,costume:e.costume,size:190,fluffy:!0}),(0,W.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,W.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,(0,W.jsx)(`div`,{className:`mt-3`,children:(0,W.jsx)(J,{page:t})}),e.available?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(i,{size:`lg`,className:`mt-10 min-w-48`,busy:n,disabled:!!e.turnstileSiteKey&&!a,onClick:l,children:[I(`run.start`),` `,(0,W.jsx)(s,{className:`size-4`})]}),e.turnstileSiteKey?(0,W.jsx)(xe,{siteKey:e.turnstileSiteKey,onToken:o}):null,d?(0,W.jsx)(`button`,{type:`button`,onClick:d,className:`mt-4 text-[0.875rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:I(`run.resume`)}):null,(0,W.jsx)(Te,{wizard:e,current:`steps`}),B||u?null:(0,W.jsx)(ye,{}),(0,W.jsx)(Se,{token:e.token})]}):(0,W.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??I(`run.unavailable`)}),r?(0,W.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,W.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,W.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:I(`run.orAs`,{label:e.label})},e.id))}):null}function Ee({wizard:e,page:t}){let n=D();return(0,W.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,W.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,W.jsx)(`span`,{className:m(n?.speaking&&`animate-breathe`),children:(0,W.jsx)(A,{kind:e.avatar,costume:e.costume,size:38})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,W.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null,(0,W.jsx)(J,{page:t,small:!0})]}),e.brand.logoUrl&&B!==`popout`?(0,W.jsx)(`img`,{src:d(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,(0,W.jsx)(q,{page:t,tone:`surface`}),B?null:(0,W.jsx)(j,{}),B===`popout`?(0,W.jsx)(p,{label:I(`common.close`),onClick:ue,children:(0,W.jsx)(y,{className:`size-5`})}):null]})})}function De({door:e,wizard:t,page:n,header:r,footer:i}){let{busy:a,error:o,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:I(`run.elsewhere`)}),p.push({key:`hello`,who:`bot`,node:t.description||t.title}),e!==`chat`&&p.push({key:e,who:`bot`,node:I(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||p.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??I(`run.unavailable`)}),o&&p.push({key:`error`,who:`bot`,node:o,tone:`error`}),t.available&&p.push(x(`start`,(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(w,{primary:!0,busy:a,disabled:!!t.turnstileSiteKey&&!c,onClick:()=>void u(),children:[I(`run.start`),` `,(0,W.jsx)(s,{className:`size-4`})]}),d?(0,W.jsx)(w,{onClick:d,children:I(`run.resume`)}):null,t.turnstileSiteKey?(0,W.jsx)(xe,{siteKey:t.turnstileSiteKey,onToken:l}):null]}))),(0,W.jsxs)(E,{header:r,footer:i,children:[(0,W.jsx)(C,{avatar:t.avatar,costume:t.costume,lines:p}),(0,W.jsx)(T,{})]})}function Oe({className:e}){return(0,W.jsx)(`footer`,{className:m(`text-center text-ink-4`,e),children:(0,W.jsx)(`a`,{href:`${f}/`,target:B?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:I(`run.madeWith`).replace(`engenty wizards`,M.name)})})}function ke({chat:e=!1,steps:s=!1,talk:d=!1,video:p=!1}){let{token:g,runId:_}=h(),v=a(),y=r({queryKey:[`public`,g,H],queryFn:()=>t.get(`/api/public/wizards/${g}${H}`),retry:(e,t)=>n(t)&&e<3}),b=y.data?.runners??[],x=!y.data||b.some(e=>e.id===`talk`),C=!y.data||b.some(e=>e.id===`video`),w=!y.data||b.some(e=>e.id===`chat`)||d&&x||p&&C,T=b[0]?.id,E=e||B===`popout`||!s&&!_&&w&&(T===`chat`||T===`talk`||T===`video`),D=p&&C||!s&&!e&&!d&&T===`video`,O=!D&&(d&&x||!s&&!e&&T===`talk`),k=D?`video`:O?`talk`:`chat`,j=he(y.data);ge(_,j),te(y.data?.brand.theme),ne(y.data?.avatar),_e(g,y.data?.title),de(E);let N=j?.wizard.title??y.data?.title;(0,z.useEffect)(()=>{N&&(document.title=N)},[N]);let P=(0,z.useCallback)(e=>{try{g&&localStorage.getItem(X(g))===_&&localStorage.removeItem(X(g))}catch{}v(e,{replace:!0,state:{elsewhere:!0}})},[v,g,_]);if((0,z.useEffect)(()=>{g&&_&&o(`run`,{token:g,runId:_})},[g,_]),y.isLoading)return(0,W.jsx)(`div`,{className:m(`flex items-center justify-center text-ink-4`,Q),children:(0,W.jsx)(c,{})});if(e&&y.data&&!w||d&&y.data&&!x||p&&y.data&&!C)return(0,W.jsx)(l,{to:`/w/${g}`,replace:!0});if(!y.data){let e=n(y.error);return(0,W.jsxs)(`div`,{className:m(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Q),children:[(0,W.jsx)(A,{kind:`pebble`,size:80}),(0,W.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:I(e?`common.offline`:`run.notFound`)}),e?(0,W.jsx)(i,{variant:`secondary`,onClick:()=>void y.refetch(),children:I(`common.retry`)}):null]})}let F=j?.wizard??y.data,R=j?.translating?(0,W.jsxs)(`div`,{className:m(`flex flex-col items-center justify-center gap-3 text-ink-3`,Q),children:[(0,W.jsx)(c,{}),(0,W.jsx)(`p`,{className:`text-[0.875rem]`,children:I(`translation.working`)})]}):null;if(E){let e=(0,W.jsx)(Ee,{wizard:F,page:j}),t=u?(0,W.jsx)(`div`,{className:`safe-bottom`}):(0,W.jsx)(Oe,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,W.jsxs)(`div`,{className:`wizard-page flex h-dvh flex-col`,children:[(0,W.jsx)(S,{effects:y.data.brand.theme.effects}),B||u?null:(0,W.jsx)(L,{}),R??(_?(0,W.jsx)(ee,{runId:_,talk:O,call:D?`video`:O?`audio`:!1,onRestart:()=>v(`/w/${g}/${k}`),onNotFound:()=>P(`/w/${g}/${k}`),header:D||O?void 0:e,footer:t}):(0,W.jsx)(De,{wizard:F,page:j,header:e,footer:t,door:k}))]})}return(0,W.jsxs)(`div`,{className:m(`wizard-page flex flex-col`,Q),children:[(0,W.jsx)(S,{effects:y.data.brand.theme.effects}),B||u?null:(0,W.jsx)(L,{}),B===`inline`||u?null:(0,W.jsx)(be,{brand:y.data.brand,toggle:!B,start:(0,W.jsx)(q,{page:j})}),B===`inline`||u?(0,W.jsx)(`div`,{className:`flex justify-end px-3 pt-2`,children:(0,W.jsx)(q,{page:j,tone:`surface`})}):null,_&&(j?.translated||j?.failed)?(0,W.jsx)(`div`,{className:`flex justify-center px-5`,children:(0,W.jsx)(J,{page:j})}):null,(0,W.jsx)(`div`,{className:`flex-1`,children:R??(_?(0,W.jsx)(re,{runId:_,onRestart:()=>v(`/w/${g}`),onNotFound:()=>P(`/w/${g}`)}):(0,W.jsx)(we,{wizard:F,page:j}))}),u?(0,W.jsx)(`div`,{className:`safe-bottom`}):(0,W.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,W.jsx)(`a`,{href:`${f}/`,target:B?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:I(`run.madeWith`).replace(`engenty wizards`,M.name)})})]})}export{be as BrandHeader,ke as PublicRunner};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,Qt as n,Sr as r,an as i,br as a,bt as o,cr as s,gn as c,hr as l,ht as u,mt as d,ot as f,un as p,xn as m,xr as h,yr as g,yt as _}from"./ui-DkEhb2Rt.js";import{d as v,n as y}from"./marked.esm-BfGIZK7F.js";import{T as b,_ as x,d as S,f as ee,g as C,h as w,m as T,n as te,p as E,v as D}from"./theme-23bNrOQh.js";import{n as O,t as k}from"./jsx-runtime-C3cWAN_r.js";import{f as ne,n as A,r as j,t as M}from"./brand-BIT7AumL.js";import{a as N,et as P,l as F,s as I}from"./i18n-WXeVnv7i.js";import{s as re,u as L}from"./read-aloud-CRFt5q6k.js";import{n as R}from"./LangSwitch-BLB7dDce.js";var ie={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`}]]};ie.node;var ae=v(ie),oe={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`]};oe.node;var se=v(oe),z=e(O(),1);function ce(){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 B=ce(),le=B?new URLSearchParams(window.location.search).get(`page`):null,V=new URLSearchParams(window.location.search).get(`theme`),H=V?`?theme=${encodeURIComponent(V)}`:``,U=(e,t={})=>window.parent.postMessage({type:`engenty-wizard:${e}`,...t},`*`),ue=()=>U(`close`);function de(e){(0,z.useEffect)(()=>{if(B===`inline`&&!e){let e=document.documentElement;document.getElementById(`root`)?.style.setProperty(`min-height`,`0`),e.style.overflow=`hidden`;let t=new ResizeObserver(()=>U(`height`,{height:Math.ceil(e.getBoundingClientRect().height)}));return t.observe(e),()=>t.disconnect()}if(B===`modal`||B===`popout`){let e=e=>{e.key===`Escape`&&!document.querySelector(`dialog[open]`)&&U(`close`)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)}},[e])}var W=e(k(),1),G=`wizards.runner.translate`,K=new Set;function fe(){try{return localStorage.getItem(G)===`on`}catch{return!1}}function pe(e){try{localStorage.setItem(G,e?`on`:`off`)}catch{}for(let e of K)e()}function me(){return(0,z.useSyncExternalStore)(e=>(K.add(e),()=>K.delete(e)),fe)}function he(e){let n=me(),[i]=(0,z.useState)(()=>F()),a=e?.lang??`en`,o=e?.translatable&&i&&i!==a?i:null,s=o&&n?o:a,c=e?.token,l=r({queryKey:[`public-translation`,c,s],enabled:!!(c&&s!==a),queryFn:()=>t.post(`/api/public/wizards/${c}/translation${H}`,{lang:s}),staleTime:1/0,retry:!1}),u=r({queryKey:[`public-texts`,c,s],enabled:!(!c||P(s)),queryFn:()=>t.get(`/api/public/wizards/${c}/texts/${s}`),staleTime:1/0,retry:!1}),d=!P(s),f=s===a||l.data&&(!d||u.data),p=s!==a&&(l.isError||d&&u.isError),m=f&&!p?s:a,h=(0,z.useMemo)(()=>!P(m)&&u.data?.lang===m?{lang:u.data.lang,runner:u.data.runner,notes:u.data.notes}:null,[m,u.data]);if((0,z.useEffect)(()=>{e&&N(m,h)},[e,m,h]),(0,z.useEffect)(()=>()=>N(null),[]),!e)return null;let g=m!==a&&l.data?l.data:null;return{own:a,other:o,shown:m,wizard:g??e,translating:s!==a&&!f&&!p,failed:!!p,translated:!!g,machine:g?.translation?.machine??!1,pick:e=>pe(e!==a)}}function q({page:e,tone:t=`ground`}){if(!e?.other)return null;let n=e.translating?e.other:e.shown;return(0,W.jsx)(R,{langs:[e.own,e.other],value:n,onPick:e.pick,tone:t})}function J({page:e,small:t}){if(!e)return null;let n=t?`truncate text-[0.75rem]`:`text-[0.8125rem]`;return e.failed?(0,W.jsx)(`p`,{className:m(`text-ink-3`,n),children:I(`translation.failed`)}):e.translated?(0,W.jsxs)(`p`,{className:m(`text-ink-3`,n),children:[e.machine?(0,W.jsxs)(W.Fragment,{children:[I(`translation.machine`),` · `]}):null,(0,W.jsx)(`button`,{type:`button`,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,onClick:()=>e.pick(e.own),children:I(`translation.showOriginal`)})]}):null}function ge(e,n){let r=(0,z.useRef)(null),i=n&&!n.translating?n.translated?n.shown:null:void 0;(0,z.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 _e(e,t){(0,z.useEffect)(()=>{if(!e||!t)return;let n=d(`/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 ve=/iPhone|iPad|iPod/.test(navigator.userAgent)||navigator.platform===`MacIntel`&&navigator.maxTouchPoints>1,Y=ve||/Android/.test(navigator.userAgent);function ye(){let[e,t]=(0,z.useState)(()=>window.wizardInstall??null),[n,r]=(0,z.useState)(!1);if((0,z.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&&!ve)return null;let i=/Mac/.test(navigator.platform),a=I(Y?`install.ios`:i?`install.bookmark.mac`:`install.bookmark.pc`);return(0,W.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,W.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,W.jsx)(se,{className:`size-4`}):(0,W.jsx)(ae,{className:`size-4`}),I(Y?`install.add`:`install.bookmark`)]}),n?(0,W.jsx)(`p`,{className:`max-w-xs leading-relaxed`,children:a}):null]})}function be({brand:e,toggle:t=!0,start:n}){return(0,W.jsx)(`header`,{className:`safe-top`,children:(0,W.jsxs)(`div`,{className:`relative flex h-14 items-center justify-center px-5`,children:[n?(0,W.jsx)(`div`,{className:`absolute left-3`,children:n}):null,e.logoUrl?(0,W.jsx)(`img`,{src:d(e.logoUrl),alt:e.name,className:`h-7 max-w-[160px] object-contain`}):e.name?(0,W.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,W.jsx)(`div`,{className:`absolute right-3`,children:(0,W.jsx)(j,{})}):null]})})}function xe({siteKey:e,onToken:t}){let n=(0,z.useRef)(null);return(0,z.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,W.jsx)(`div`,{ref:n,className:`mt-4 flex justify-center`})}function Se({token:e}){return!/iPhone|iPad|iPod|Android/.test(navigator.userAgent)||u||B?null:(0,W.jsxs)(`a`,{href:_(`${window.location.origin}${f}/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,W.jsx)(b,{className:`size-4`}),` `,I(`install.app`)]})}var X=e=>`wz.run.${e}`,Z=()=>g().state?.elsewhere===!0,Ce=u&&new URLSearchParams(window.location.search).get(`start`)===`1`,Q=B===`inline`?`min-h-80`:`min-h-dvh`;function $(e,n,r){let i=a(),[o,s]=(0,z.useState)(!1),[c,l]=(0,z.useState)(null),[u,d]=(0,z.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:a}=await t.post(`/api/public/wizards/${e.token}/runs`,{turnstileToken:u??void 0,embedded:B!==null,origin:le??void 0,lang:r??void 0});try{localStorage.setItem(X(e.token),a)}catch{}i(`${n}/${a}`,{replace:Ce})}catch(e){l(e.message),s(!1)}},resume:f?()=>i(`${n}/${f}`):null}}function we({wizard:e,page:t}){let{busy:n,error:r,captcha:a,setCaptcha:o,start:l,resume:d}=$(e,`/w/${e.token}`,t?.translated?t.shown:null),f=Z(),p=Ce&&e.available&&!e.turnstileSiteKey,m=(0,z.useRef)(!1);return(0,z.useEffect)(()=>{p&&!m.current&&(m.current=!0,l())},[p]),p&&!r?(0,W.jsx)(`div`,{className:`flex min-h-[60dvh] items-center justify-center text-ink-4`,children:(0,W.jsx)(c,{})}):(0,W.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:[f?(0,W.jsx)(`p`,{className:`mb-6 rounded-xl bg-paper-2 px-5 py-3 text-[0.875rem] text-ink-2`,children:I(`run.elsewhere`)}):null,(0,W.jsx)(A,{kind:e.avatar,costume:e.costume,size:190,fluffy:!0}),(0,W.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,W.jsx)(`p`,{className:`mt-3 text-[1rem] text-ink-2 leading-relaxed`,children:e.description}):null,(0,W.jsx)(`div`,{className:`mt-3`,children:(0,W.jsx)(J,{page:t})}),e.available?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(i,{size:`lg`,className:`mt-10 min-w-48`,busy:n,disabled:!!e.turnstileSiteKey&&!a,onClick:l,children:[I(`run.start`),` `,(0,W.jsx)(s,{className:`size-4`})]}),e.turnstileSiteKey?(0,W.jsx)(xe,{siteKey:e.turnstileSiteKey,onToken:o}):null,d?(0,W.jsx)(`button`,{type:`button`,onClick:d,className:`mt-4 text-[0.875rem] text-ink-3 underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:I(`run.resume`)}):null,(0,W.jsx)(Te,{wizard:e,current:`steps`}),B||u?null:(0,W.jsx)(ye,{}),(0,W.jsx)(Se,{token:e.token})]}):(0,W.jsx)(`p`,{className:`mt-10 rounded-xl bg-paper-2 px-5 py-4 text-[0.9375rem] text-ink-2`,children:e.unavailableReason??I(`run.unavailable`)}),r?(0,W.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,W.jsx)(`p`,{className:`mt-4 flex flex-wrap justify-center gap-x-4 text-[0.875rem] text-ink-3`,children:n.map(e=>(0,W.jsx)(`a`,{href:e.url??void 0,className:`underline-offset-4 hover:text-ink hover:underline coarse:min-h-11`,children:I(`run.orAs`,{label:e.label})},e.id))}):null}function Ee({wizard:e,page:t}){let n=D();return(0,W.jsx)(`header`,{className:`safe-top shrink-0 border-border-soft border-b`,children:(0,W.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,W.jsx)(`span`,{className:m(n?.speaking&&`animate-breathe`),children:(0,W.jsx)(A,{kind:e.avatar,costume:e.costume,size:38})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`truncate font-display font-semibold text-[1rem] leading-tight tracking-tight`,children:e.title}),e.brand.name?(0,W.jsx)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:e.brand.name}):null,(0,W.jsx)(J,{page:t,small:!0})]}),e.brand.logoUrl&&B!==`popout`?(0,W.jsx)(`img`,{src:d(e.brand.logoUrl),alt:e.brand.name,className:`h-6 max-w-[120px] object-contain max-sm:hidden`}):null,(0,W.jsx)(q,{page:t,tone:`surface`}),B?null:(0,W.jsx)(j,{}),B===`popout`?(0,W.jsx)(p,{label:I(`common.close`),onClick:ue,children:(0,W.jsx)(y,{className:`size-5`})}):null]})})}function De({door:e,wizard:t,page:n,header:r,footer:i}){let{busy:a,error:o,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:I(`run.elsewhere`)}),p.push({key:`hello`,who:`bot`,node:t.description||t.title}),e!==`chat`&&p.push({key:e,who:`bot`,node:I(e===`video`?`video.hint`:`talk.joinHint`)}),t.available||p.push({key:`unavailable`,who:`bot`,node:t.unavailableReason??I(`run.unavailable`)}),o&&p.push({key:`error`,who:`bot`,node:o,tone:`error`}),t.available&&p.push(x(`start`,(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(w,{primary:!0,busy:a,disabled:!!t.turnstileSiteKey&&!c,onClick:()=>void u(),children:[I(`run.start`),` `,(0,W.jsx)(s,{className:`size-4`})]}),d?(0,W.jsx)(w,{onClick:d,children:I(`run.resume`)}):null,t.turnstileSiteKey?(0,W.jsx)(xe,{siteKey:t.turnstileSiteKey,onToken:l}):null]}))),(0,W.jsxs)(E,{header:r,footer:i,children:[(0,W.jsx)(C,{avatar:t.avatar,costume:t.costume,lines:p}),(0,W.jsx)(T,{})]})}function Oe({className:e}){return(0,W.jsx)(`footer`,{className:m(`text-center text-ink-4`,e),children:(0,W.jsx)(`a`,{href:`${f}/`,target:B?`_blank`:void 0,rel:`noreferrer`,className:`inline-block hover:text-ink-2`,children:I(`run.madeWith`).replace(`engenty wizards`,M.name)})})}function ke({chat:e=!1,steps:s=!1,talk:d=!1,video:p=!1}){let{token:g,runId:_}=h(),v=a(),y=r({queryKey:[`public`,g,H],queryFn:()=>t.get(`/api/public/wizards/${g}${H}`),retry:(e,t)=>n(t)&&e<3}),b=y.data?.runners??[],x=!y.data||b.some(e=>e.id===`talk`),C=!y.data||b.some(e=>e.id===`video`),w=!y.data||b.some(e=>e.id===`chat`)||d&&x||p&&C,T=b[0]?.id,E=e||B===`popout`||!s&&!_&&w&&(T===`chat`||T===`talk`||T===`video`),D=p&&C||!s&&!e&&!d&&T===`video`,O=!D&&(d&&x||!s&&!e&&T===`talk`),k=D?`video`:O?`talk`:`chat`,j=he(y.data);ge(_,j),te(y.data?.brand.theme),ne(y.data?.avatar),_e(g,y.data?.title),de(E);let N=j?.wizard.title??y.data?.title;(0,z.useEffect)(()=>{N&&(document.title=N)},[N]);let P=(0,z.useCallback)(e=>{try{g&&localStorage.getItem(X(g))===_&&localStorage.removeItem(X(g))}catch{}v(e,{replace:!0,state:{elsewhere:!0}})},[v,g,_]);if((0,z.useEffect)(()=>{g&&_&&o(`run`,{token:g,runId:_})},[g,_]),y.isLoading)return(0,W.jsx)(`div`,{className:m(`flex items-center justify-center text-ink-4`,Q),children:(0,W.jsx)(c,{})});if(e&&y.data&&!w||d&&y.data&&!x||p&&y.data&&!C)return(0,W.jsx)(l,{to:`/w/${g}`,replace:!0});if(!y.data){let e=n(y.error);return(0,W.jsxs)(`div`,{className:m(`flex flex-col items-center justify-center gap-4 px-6 text-center`,Q),children:[(0,W.jsx)(A,{kind:`pebble`,size:80}),(0,W.jsx)(`p`,{className:`max-w-xs text-ink-3`,children:I(e?`common.offline`:`run.notFound`)}),e?(0,W.jsx)(i,{variant:`secondary`,onClick:()=>void y.refetch(),children:I(`common.retry`)}):null]})}let F=j?.wizard??y.data,R=j?.translating?(0,W.jsxs)(`div`,{className:m(`flex flex-col items-center justify-center gap-3 text-ink-3`,Q),children:[(0,W.jsx)(c,{}),(0,W.jsx)(`p`,{className:`text-[0.875rem]`,children:I(`translation.working`)})]}):null;if(E){let e=(0,W.jsx)(Ee,{wizard:F,page:j}),t=u?(0,W.jsx)(`div`,{className:`safe-bottom`}):(0,W.jsx)(Oe,{className:`pb-[max(0.375rem,env(safe-area-inset-bottom))] text-[0.6875rem]`});return(0,W.jsxs)(`div`,{className:`wizard-page flex h-dvh flex-col`,children:[(0,W.jsx)(S,{effects:y.data.brand.theme.effects}),B||u?null:(0,W.jsx)(L,{}),R??(_?(0,W.jsx)(ee,{runId:_,talk:O,call:D?`video`:O?`audio`:!1,onRestart:()=>v(`/w/${g}/${k}`),onNotFound:()=>P(`/w/${g}/${k}`),header:D||O?void 0:e,footer:t}):(0,W.jsx)(De,{wizard:F,page:j,header:e,footer:t,door:k}))]})}return(0,W.jsxs)(`div`,{className:m(`wizard-page flex flex-col`,Q),children:[(0,W.jsx)(S,{effects:y.data.brand.theme.effects}),B||u?null:(0,W.jsx)(L,{}),B===`inline`||u?null:(0,W.jsx)(be,{brand:y.data.brand,toggle:!B,start:(0,W.jsx)(q,{page:j})}),B===`inline`||u?(0,W.jsx)(`div`,{className:`flex justify-end px-3 pt-2`,children:(0,W.jsx)(q,{page:j,tone:`surface`})}):null,_&&(j?.translated||j?.failed)?(0,W.jsx)(`div`,{className:`flex justify-center px-5`,children:(0,W.jsx)(J,{page:j})}):null,(0,W.jsx)(`div`,{className:`flex-1`,children:R??(_?(0,W.jsx)(re,{runId:_,onRestart:()=>v(`/w/${g}`),onNotFound:()=>P(`/w/${g}`)}):(0,W.jsx)(we,{wizard:F,page:j}))}),u?(0,W.jsx)(`div`,{className:`safe-bottom`}):(0,W.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,W.jsx)(`a`,{href:`${f}/`,target:B?`_blank`:void 0,rel:`noreferrer`,className:`inline-block py-3.5 hover:text-ink-2`,children:I(`run.madeWith`).replace(`engenty wizards`,M.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{Jn as r}from"./host-C-AAp8Bz.js";import{s as i}from"./i18n-Dyi0kvaA.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{Yn as r}from"./host-CA1dqZWL.js";import{s as i}from"./i18n-WXeVnv7i.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,Rn as r,Sr as i,dn as a,hn as o,jn as s,ln as c,on as l,sn as u}from"./ui-DSgksc1H.js";import{n as d,t as f}from"./jsx-runtime-C3cWAN_r.js";import{n as p,s as m}from"./i18n-Dyi0kvaA.js";import{s as h}from"./read-aloud-DGS8mWgC.js";import{vn as g}from"./host-C-AAp8Bz.js";import{n as _}from"./RunDrawer-CMgN-XTB.js";var v=e(d(),1),y=e(f(),1),b=`results-search`,x={q:``,mode:``,days:0};function S(e,n,r){let a=new URLSearchParams;n&&a.set(`wizard`,n),r.q.trim()&&a.set(`q`,r.q.trim()),r.mode&&a.set(`mode`,r.mode),r.days&&a.set(`days`,String(r.days));let o=a.toString();return i({queryKey:[`results`,e,o],queryFn:()=>t.get(`/api/studio/spaces/${e}/results${o&&`?${o}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function C({data:e,wizardId:t,onWizard:n,filter:r,onFilter:i}){let[c,l]=(0,v.useState)(r.q);return g({icon:s,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(()=>i({...r,q:c}),250);return()=>clearTimeout(e)},[c,r,i]),(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)(s,{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=>i({...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=>i({...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[s,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)(u,{children:m(`run.testChip`)}):(0,y.jsxs)(u,{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`)})})]}),s?(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(s.wizardId)}),s.mode===`test`?(0,y.jsx)(u,{children:m(`run.testChip`)}):(0,y.jsxs)(u,{tone:`live`,children:[`Live v`,s.version]})]}),onClose:()=>d(null),children:(0,y.jsx)(h,{runId:s.id,compact:!0,studio:!0},s.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,Rn as r,Sr as i,dn as a,hn as o,jn as s,ln as c,on as l,sn as u}from"./ui-DkEhb2Rt.js";import{n as d,t as f}from"./jsx-runtime-C3cWAN_r.js";import{n as p,s as m}from"./i18n-WXeVnv7i.js";import{s as h}from"./read-aloud-CRFt5q6k.js";import{yn as g}from"./host-CA1dqZWL.js";import{n as _}from"./RunDrawer-r6eFEs5D.js";var v=e(d(),1),y=e(f(),1),b=`results-search`,x={q:``,mode:``,days:0};function S(e,n,r){let a=new URLSearchParams;n&&a.set(`wizard`,n),r.q.trim()&&a.set(`q`,r.q.trim()),r.mode&&a.set(`mode`,r.mode),r.days&&a.set(`days`,String(r.days));let o=a.toString();return i({queryKey:[`results`,e,o],queryFn:()=>t.get(`/api/studio/spaces/${e}/results${o&&`?${o}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function C({data:e,wizardId:t,onWizard:n,filter:r,onFilter:i}){let[c,l]=(0,v.useState)(r.q);return g({icon:s,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(()=>i({...r,q:c}),250);return()=>clearTimeout(e)},[c,r,i]),(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)(s,{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=>i({...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=>i({...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[s,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)(u,{children:m(`run.testChip`)}):(0,y.jsxs)(u,{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`)})})]}),s?(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(s.wizardId)}),s.mode===`test`?(0,y.jsx)(u,{children:m(`run.testChip`)}):(0,y.jsxs)(u,{tone:`live`,children:[`Live v`,s.version]})]}),onClose:()=>d(null),children:(0,y.jsx)(h,{runId:s.id,compact:!0,studio:!0},s.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{Hn as n,un as r,xn as i}from"./ui-DSgksc1H.js";import{Vn as a}from"./host-C-AAp8Bz.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-Dyi0kvaA.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:r=[`steps`,`chat`]}){let o=[{id:`steps`,label:u(`chat.steps`),Icon:t},{id:`chat`,label:u(`chat.chat`),Icon:a}].filter(e=>r.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:r,Icon:a})=>(0,m.jsxs)(`button`,{type:`button`,"aria-pressed":e===t,title:r,onClick:()=>n(t),className:i(`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:i(e!==t&&`sr-only`),children:r})]},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:i(`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)(r,{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)(n,{className:`size-4`})}),(0,m.jsx)(r,{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{Hn as n,un as r,xn as i}from"./ui-DkEhb2Rt.js";import{Hn as a}from"./host-CA1dqZWL.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-WXeVnv7i.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:r=[`steps`,`chat`]}){let o=[{id:`steps`,label:u(`chat.steps`),Icon:t},{id:`chat`,label:u(`chat.chat`),Icon:a}].filter(e=>r.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:r,Icon:a})=>(0,m.jsxs)(`button`,{type:`button`,"aria-pressed":e===t,title:r,onClick:()=>n(t),className:i(`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:i(e!==t&&`sr-only`),children:r})]},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:i(`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)(r,{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)(n,{className:`size-4`})}),(0,m.jsx)(r,{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};