import{r as a,j as e}from"./@radix-C7hRs6Kx.js";import{n as g,V as C,aO as y,h as i,ac as c,r as h}from"./index-D2iSHVZq.js";import{H as p,B as u,F as b,W as v}from"./Wizard-CMI6Ksgz.js";import{S as f}from"./arrow-left-CwgF2MEM.js";import{C as N}from"./configuration-form-BtI2Y4eX.js";import{c as S,L as k}from"./@react-router-CNP6g_RL.js";import{S as F}from"./flavor-select-BnPxvQDN.js";import{C as w}from"./ComponentIcon-ils7uNAk.js";import{s as B}from"./constants-DP3ZEnXH.js";import"./@tanstack-CSxjHCME.js";import"./@reactflow-CQi1Z1Wq.js";import"./index-CmLcvK2z.js";import"./plus-COjQg3AG.js";import"./trash-BWSZ7NRK.js";import"./index.esm-D7jFlf5N.js";import"./type-guards-CaeD8wHO.js";import"./index-CFESYpe4.js";import"./zod-C0xYeTvL.js";import"./check-DK77doTf.js";import"./CodeSnippet-CvI6D0wx.js";import"./file-text-BdxZdjP_.js";import"./terminal-square-DMtel8mb.js";import"./layout-h3cbx8WZ.js";import"./rocket-Cf-B-XOR.js";function T(){const{setCurrentBreadcrumbData:s}=g();return a.useEffect(()=>{s({segment:"createComponent",data:null})},[]),e.jsx(C,{children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(y,{className:"h-5 w-5 fill-turquoise-400"}),e.jsx("h1",{className:"text-display-xs font-semibold",children:"Register new Component"})]})})}function z({flavor:s,type:t,handleBack:r}){const l=a.useId(),o=S();function m(d){o(h.components.detail(d))}return e.jsxs(e.Fragment,{children:[e.jsxs(p,{className:"flex items-center gap-2",children:[e.jsxs(i,{intent:"secondary",emphasis:"subtle",className:"flex aspect-square size-6 items-center justify-center",onClick:()=>r(),children:[e.jsx(f,{className:"size-5 shrink-0"}),e.jsx("span",{className:"sr-only",children:"Go step back"})]}),e.jsxs("span",{children:["Configure your ",c(s.name)," ",c(t)]})]}),e.jsx(u,{className:"p-0",children:e.jsx(N,{flavorId:s.id,formId:l,successHandler:m,FooterComponent:H})})]})}function H({formId:s,isPending:t}){return e.jsxs(b,{children:[e.jsx(i,{asChild:!0,intent:"secondary",size:"md",children:e.jsx(k,{to:h.components.overview,children:"Cancel"})}),e.jsxs(i,{size:"md",disabled:t,type:"submit",form:s,children:[t&&e.jsx("div",{role:"alert","aria-busy":"true",className:"full h-[20px] w-[20px] animate-spin rounded-rounded border-2 border-theme-text-negative border-b-theme-text-brand"}),"Register Component"]})]})}function I({type:s,handleFlavorSelect:t,handleBack:r}){return e.jsxs(e.Fragment,{children:[e.jsxs(p,{className:"flex items-center gap-2",children:[e.jsxs(i,{intent:"secondary",emphasis:"subtle",className:"flex aspect-square size-6 items-center justify-center",onClick:()=>r(),children:[e.jsx(f,{className:"size-5 shrink-0"}),e.jsx("span",{className:"sr-only",children:"Go step back"})]}),e.jsxs("span",{children:["Select your ",c(s)," Flavor"]})," "]}),e.jsx(u,{children:e.jsx(F,{type:s,setSelectedFlavor:t})})]})}function L({selectTypeHandler:s}){return e.jsxs(e.Fragment,{children:[e.jsx(p,{children:"Select your Component Type"}),e.jsx(u,{children:e.jsx("ul",{className:"grid grid-cols-1 gap-3 md:grid-cols-2 xl:grid-cols-4",children:B.map(t=>e.jsx(R,{type:t,selectTypeHandler:s},t))})})]})}function R({type:s,selectTypeHandler:t}){return e.jsxs("button",{onClick:()=>t(s),className:"flex h-[110px] flex-col items-center justify-center space-y-2 truncate whitespace-nowrap rounded-md border border-theme-border-moderate bg-theme-surface-secondary py-5 text-center text-text-sm text-theme-text-secondary transition-all duration-150 hover:bg-theme-surface-primary hover:shadow-sm",children:[e.jsx(w,{className:"h-5 w-5 shrink-0 fill-theme-text-tertiary group-data-[state=active]/trigger:fill-theme-surface-strong",type:s}),e.jsx("span",{children:c(s)})]})}function q(){const[s,t]=a.useState(0),[r,l]=a.useState(null),[o,m]=a.useState();function d(n){l(n),t(1)}function j(n){m(n),t(2)}function x(){t(n=>n-1)}return e.jsxs(v,{children:[s===0&&e.jsx(L,{selectTypeHandler:d}),s===1&&r&&e.jsx(I,{type:r,handleFlavorSelect:j,handleBack:x}),s===2&&o&&r&&e.jsx(z,{flavor:o,type:r,handleBack:x})]})}function oe(){return e.jsxs("div",{className:"space-y-5",children:[e.jsx(T,{}),e.jsx("section",{className:"layout-container pb-5",children:e.jsx(q,{})})]})}export{oe as default};
