function StepDetectEngine({sel:t,onTick:a}){const e=t.engineStatus||"checking";React.useEffect(()=>{if(e!=="checking")return;const d=setTimeout(()=>{t.engineStatus="present",a()},900);return()=>clearTimeout(d)},[e]);function i(){t.engineStatus="checking",a()}function o(){t.engineStatus="absent",a()}return e==="absent"?React.createElement("div",{className:"ow-detect"},typeof StateBox=="function"?React.createElement(StateBox,{kind:"error",message:"No engine reachable",hint:"We couldn't reach a companyx-runtime instance on this workspace.",ctaLabel:"Retry detection",onCta:i}):React.createElement("div",{className:"ow-detect-fallback mono"},React.createElement("span",null,"No engine reachable."),React.createElement("button",{type:"button",className:"ow-btn ow-btn-ghost",onClick:i},"Retry detection"))):e==="present"?React.createElement("div",{className:"ow-detect ow-detect-ok"},React.createElement("div",{className:"ow-detect-icon"},React.createElement(MIcon,{name:"check_circle",size:28})),React.createElement("div",{className:"ow-detect-title mono"},"Engine detected"),React.createElement("div",{className:"ow-detect-meta mono"},"local \xB7 companyx-runtime v2.3 \xB7 reachable on :7411"),React.createElement("button",{type:"button",className:"ow-detect-sim mono",onClick:o},"Simulate: no engine found")):React.createElement("div",{className:"ow-detect ow-detect-scanning"},typeof StateBox=="function"?React.createElement(StateBox,{kind:"loading",message:"Scanning for a reachable agent-execution engine\u2026"}):React.createElement("div",{className:"ow-detect-fallback mono"},"Scanning\u2026"))}function StepConnect({sel:t,onTick:a}){const e=t.connectStatus||"default";React.useEffect(()=>{if(e!=="connecting")return;const o=setTimeout(()=>{t.connectStatus="connected",a()},900);return()=>clearTimeout(o)},[e]);function i(){t.connectStatus="connecting",a()}return React.createElement("div",{className:"ow-connect"},React.createElement("div",{className:"act-card","data-status":e},React.createElement("div",{className:"act-head"},React.createElement("div",{className:"act-ic"},React.createElement(MIcon,{name:"bolt",size:18})),React.createElement("div",{className:"act-titles"},React.createElement("div",{className:"act-name"},"companyx-runtime"),React.createElement("div",{className:"act-sub mono"},"workspace engine connector")),React.createElement("div",{className:"status-chip mono"},React.createElement("span",{className:`status-dot ${e==="connected"?"st-ok":e==="connecting"?"st-running":"st-idle"}`}),React.createElement("span",null,e==="connected"?"Connected":e==="connecting"?"Connecting\u2026":"Not connected"))),React.createElement("div",{className:"act-desc"},"Binds this workspace to the detected engine so runs can be spawned and streamed live."),e==="default"&&React.createElement("div",{className:"act-foot"},React.createElement("span",{className:"act-secret mono"},"workspace.engine_key @ GSM"),React.createElement("button",{type:"button",className:"act-connect ow-btn ow-btn-primary",onClick:i},"Connect engine")),e==="connecting"&&React.createElement("div",{className:"act-foot act-connecting mono"},React.createElement(MIcon,{name:"sync",size:14}),React.createElement("span",null,"Binding secret and opening a session\u2026")),e==="connected"&&React.createElement("div",{className:"act-foot act-live mono"},React.createElement(MIcon,{name:"check_circle",size:14}),React.createElement("span",null,"Live \xB7 engine bound to this workspace"))))}function StepSpawnDemo({sel:t,onTick:a}){function e(){t.demoRunId="demo-"+Math.random().toString(36).slice(2,8),a()}return t.demoRunId?React.createElement("div",{className:"ow-demo ow-demo-ok"},React.createElement("div",{className:"ow-demo-icon"},React.createElement(MIcon,{name:"check_circle",size:28})),React.createElement("div",{className:"ow-demo-title mono"},"Run ",t.demoRunId," started"),typeof EntityLink=="function"?React.createElement(EntityLink,{to:"agentWorkspace",label:"Watch the run in Agent Workspace"}):React.createElement("span",{className:"ow-demo-link mono"},"Watch it in Agent Workspace")):React.createElement("div",{className:"ow-demo"},React.createElement("div",{className:"ow-demo-hint mono"},"Spawn a real run against the connected engine \u2014 decisions stream live, nothing is simulated."),React.createElement("button",{type:"button",className:"ow-btn ow-btn-primary",onClick:e},"Spawn demo run"))}function StepLand({sel:t}){return React.createElement("div",{className:"ow-welcome"},React.createElement("div",{className:"ow-welcome-mark"},React.createElement(MIcon,{name:"celebration",size:36})),React.createElement("div",{className:"ow-welcome-title"},"Your workspace is live."),React.createElement("div",{className:"ow-welcome-sub"},t.demoRunId?React.createElement(React.Fragment,null,"Run ",React.createElement("strong",null,t.demoRunId)," is streaming decisions now."):"Setup complete."," ","Canvas is ready \u2014 everything here is reversible later."),React.createElement("div",{className:"ow-welcome-hint mono"},"Finish to open your Canvas dashboard."))}function StepValue({sel:t,onTick:a}){const e=["Google Analytics","Google Ads","Amazon","PostHog","Meta Ads","Stripe","Shopify","Google Search Console"],i={fontSize:"11px",padding:"4px 10px",border:"1px solid currentColor",opacity:.72,borderRadius:"999px"};return React.createElement("div",{className:"ow-welcome"},React.createElement("div",{className:"ow-welcome-mark"},React.createElement(MIcon,{name:"hub",size:36})),React.createElement("div",{className:"ow-welcome-title"},"One canvas for all your business data."),React.createElement("div",{className:"ow-welcome-sub"},"Canvas is a live ",React.createElement("strong",null,"API visualizer")," and"," ",React.createElement("strong",null,"centralizer of business data")," from any programmatically manageable platform \u2014 pulled live, visualized as dashboards, and steered by your agents."),React.createElement("div",{className:"ow-value-chips",style:{display:"flex",flexWrap:"wrap",gap:"6px",justifyContent:"center",marginTop:"14px"}},e.map(o=>React.createElement("span",{key:o,className:"mono",style:i},o)),React.createElement("span",{className:"mono",style:{...i,opacity:1,border:"none",color:"rgb(var(--app-accent))"}},"+ many more")),React.createElement("div",{className:"ow-intake",style:{display:"flex",flexDirection:"column",gap:"8px",maxWidth:"420px",margin:"18px auto 0",textAlign:"left"}},React.createElement("label",{className:"mono",style:{fontSize:"12px",opacity:.8}},"What's your main goal?",React.createElement("input",{className:"ow-intake-input",type:"text",placeholder:"e.g. grow qualified signups",value:t&&t.goal||"",onChange:o=>{t&&(t.goal=o.target.value),a&&a()},style:{width:"100%",marginTop:"4px",padding:"8px"}})),React.createElement("label",{className:"mono",style:{fontSize:"12px",opacity:.8}},"Company / organization",React.createElement("input",{className:"ow-intake-input",type:"text",placeholder:"e.g. Acme Inc",value:t&&t.company||"",onChange:o=>{t&&(t.company=o.target.value),a&&a()},style:{width:"100%",marginTop:"4px",padding:"8px"}}))),React.createElement("div",{className:"ow-welcome-hint mono"},"Next: connect your engine and see it live."))}function StepContext({sel:t,onTick:a}){t.contextDraft||(t.contextDraft={mission:"",oneLiner:"",icp:""});const e=t.contextDraft;function i(o){return d=>{e[o]=d.target.value,a&&a()}}return React.createElement("div",{className:"ow-welcome"},React.createElement("div",{className:"ow-welcome-mark"},React.createElement(MIcon,{name:"account_tree",size:36})),React.createElement("div",{className:"ow-welcome-title"},"Tell us about your business."),React.createElement("div",{className:"ow-welcome-sub"},"This seeds your Context Suite \u2014 the shared business context every agent and dashboard reads from. You can refine it any time later from account settings."),React.createElement("div",{className:"ow-intake",style:{display:"flex",flexDirection:"column",gap:"8px",maxWidth:"420px",margin:"18px auto 0",textAlign:"left"}},React.createElement("label",{className:"mono",style:{fontSize:"12px",opacity:.8}},"Mission \u2014 why does this company exist?",React.createElement("textarea",{className:"ow-intake-input","data-testid":"onb-context-mission",rows:2,placeholder:"e.g. Make autonomous business operation accessible to every founder.",value:e.mission,onChange:i("mission"),style:{width:"100%",marginTop:"4px",padding:"8px"}})),React.createElement("label",{className:"mono",style:{fontSize:"12px",opacity:.8}},"One-liner \u2014 how would you describe it in one sentence?",React.createElement("input",{className:"ow-intake-input","data-testid":"onb-context-oneliner",type:"text",placeholder:"e.g. The one canvas that runs your business.",value:e.oneLiner,onChange:i("oneLiner"),style:{width:"100%",marginTop:"4px",padding:"8px"}})),React.createElement("label",{className:"mono",style:{fontSize:"12px",opacity:.8}},"Ideal customer \u2014 who is this for?",React.createElement("input",{className:"ow-intake-input","data-testid":"onb-context-icp",type:"text",placeholder:"e.g. Founders drowning in point-SaaS tools.",value:e.icp,onChange:i("icp"),style:{width:"100%",marginTop:"4px",padding:"8px"}}))),React.createElement("div",{className:"ow-welcome-hint mono"},"Skip any field \u2014 nothing here blocks setup, and it's editable later."))}function OnboardingWizardViewC12a({kind:t}){const a=t.steps||[],[,e]=React.useState(0),i=typeof window.__onboardingStep=="number"?window.__onboardingStep:0,[o,d]=React.useState(i);React.useEffect(()=>{d(i)},[i]);const r=a[o]||a[a.length-1]||{};(!window.__onboardingSelections||!("engineStatus"in window.__onboardingSelections))&&(window.__onboardingSelections={engineStatus:null,connectStatus:"default",demoRunId:null,goal:"",company:"",contextDraft:{mission:"",oneLiner:"",icp:""}});const s=window.__onboardingSelections;function m(){if(o<a.length-1){const n=o+1;d(n);try{const c=a[n]&&a[n].key;window.CANVAS_ACTIONS&&c&&window.CANVAS_ACTIONS.dispatch("onboarding.advance",{stage:c},{confirm:!0}).catch(l=>console.warn("onboarding.advance dispatch failed (non-blocking):",l))}catch(c){console.warn("onboarding.advance dispatch skipped:",c)}}else u()}function p(){o>0&&d(o-1)}function u(){try{window.CANVAS_ACTIONS&&(s.goal||s.company)&&window.CANVAS_ACTIONS.dispatch("onboarding.intake",{goal:s.goal,company:s.company},{confirm:!0}).catch(n=>console.warn("onboarding.intake dispatch failed (non-blocking):",n))}catch(n){console.warn("onboarding.intake dispatch skipped:",n)}try{const n=s.contextDraft||{},c=[n.mission&&{segment:"identity",subsegment:"positioning",datapoint_id:"mission",patch:{val:n.mission}},n.oneLiner&&{segment:"identity",subsegment:"positioning",datapoint_id:"one_liner",patch:{val:n.oneLiner}},n.icp&&{segment:"market",subsegment:"general",datapoint_id:"icp",patch:{val:n.icp}}].filter(Boolean);window.CANVAS_ACTIONS&&c.length&&c.forEach(l=>{window.CANVAS_ACTIONS.dispatch("context.datapoint.update",l,{confirm:!0}).catch(g=>console.warn("context.datapoint.update dispatch failed (non-blocking):",l.datapoint_id,g))})}catch(n){console.warn("context.datapoint.update dispatch skipped:",n)}try{window.CANVAS_ACTIONS&&window.CANVAS_ACTIONS.dispatch("onboarding.advance",{stage:"complete"},{confirm:!0}).catch(n=>console.warn("onboarding.advance(complete) dispatch failed (non-blocking):",n))}catch(n){console.warn("onboarding.advance(complete) dispatch skipped:",n)}window.__setTweak&&window.__setTweak("onboardingStep",a.length),e(n=>n+1)}return React.createElement("div",{className:"view view-onboardingWizard"},React.createElement(OnboardingStepIndicator,{steps:a,active:o}),React.createElement("div",{className:"ow-stage"},React.createElement("div",{className:"ow-stage-head"},React.createElement("div",{className:"ow-stage-eyebrow mono"},"Step ",o+1," of ",a.length," \xB7 ",r.label),React.createElement("h2",{className:"ow-stage-title"},r.title),React.createElement("p",{className:"ow-stage-tag"},r.tagline)),React.createElement("div",{className:"ow-stage-body"},o===0&&React.createElement(StepValue,{sel:s,onTick:()=>e(n=>n+1)}),o===1&&React.createElement(StepContext,{sel:s,onTick:()=>e(n=>n+1)}),o===2&&React.createElement(StepDetectEngine,{sel:s,onTick:()=>e(n=>n+1)}),o===3&&React.createElement(StepConnect,{sel:s,onTick:()=>e(n=>n+1)}),o===4&&React.createElement(StepSpawnDemo,{sel:s,onTick:()=>e(n=>n+1)}),o===5&&React.createElement(StepLand,{sel:s})),React.createElement("div",{className:"ow-stage-foot"},React.createElement("button",{type:"button",className:"ow-btn ow-btn-ghost",onClick:p,disabled:o===0},React.createElement(MIcon,{name:"chevron_left",size:14}),React.createElement("span",null,"Zur\xFCck")),React.createElement("div",{className:"ow-stage-foot-mid mono"},a.map((n,c)=>React.createElement("span",{key:n.id,className:`ow-foot-dot ${c===o?"on":""} ${c<o?"done":""}`}))),React.createElement("button",{type:"button",className:"ow-btn ow-btn-primary",onClick:m},React.createElement("span",null,o===a.length-1?"Fertig \xB7 Canvas \xF6ffnen":"Weiter"),React.createElement(MIcon,{name:"chevron_right",size:14})))))}(()=>{if(typeof window>"u")return;window.VIEWS=window.VIEWS||{};const t=window.VIEWS.onboardingWizard;window.VIEWS.onboardingWizard=OnboardingWizardViewC12a;const a=[{id:0,key:"value",label:"Canvas",title:"One canvas for all your business data",tagline:"A live API visualizer + centralizer of business data from any programmatically manageable platform."},{id:1,key:"context",label:"Context",title:"Seed your business context",tagline:"A few facts that power every agent and dashboard \u2014 editable any time later."},{id:2,key:"detect-engine",label:"Engine",title:"Detecting your agent-execution engine",tagline:"One quick reachability check \u2014 local or remote."},{id:3,key:"connect",label:"Connect",title:"Connect the engine to your workspace",tagline:"A single GSM-secret binding \u2014 same pattern as every workspace connector."},{id:4,key:"spawn-demo",label:"Demo run",title:"Spawn a real demo run",tagline:"Watch decisions stream live \u2014 no simulated output."},{id:5,key:"land",label:"Dashboard",title:"Land in your dashboard",tagline:"Setup complete \u2014 your Canvas workspace is ready."}];if(window.KIND_REGISTRY?.servicesWizard){const e=window.KIND_REGISTRY.servicesWizard;if(e.steps=a,Array.isArray(e.heroKpis)){const i=e.heroKpis.find(o=>o.label==="Onboarding steps");i&&(i.value=String(a.length))}}window.ONBOARDING_STEPS=a,console.log("[onboarding-patch] canvas#350 canonical 6-step wizard (value \u2192 context \u2192 detect-engine \u2192 connect \u2192 spawn-demo \u2192 land) applied.")})();
