(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3785,430],{2557:function(e,s,t){"use strict";t.d(s,{I:function(){return l}});var r=t(5893),a=t(7294),n=t(2350);let l=a.forwardRef((e,s)=>{let{className:t,type:a,...l}=e;return(0,r.jsx)("input",{type:a,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:s,...l})});l.displayName="Input"},6185:function(e,s,t){"use strict";t.d(s,{_:function(){return c}});var r=t(5893),a=t(7294),n=t(9102),l=t(2003),i=t(2350);let o=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),c=a.forwardRef((e,s)=>{let{className:t,...a}=e;return(0,r.jsx)(n.f,{ref:s,className:(0,i.cn)(o(),t),...a})});c.displayName=n.f.displayName},3785:function(e,s,t){"use strict";t.r(s),t.d(s,{NewWorkspace:function(){return b}});var r=t(5893),a=t(7294),n=t(1163),l=t(1664),i=t.n(l),o=t(5152),c=t.n(o),u=t(7324),d=t(803),f=t(2557),m=t(6185),p=t(7673);let x=c()(()=>Promise.all([t.e(616),t.e(5739),t.e(804),t.e(1272),t.e(3947),t.e(6989),t.e(3698),t.e(9470),t.e(8969),t.e(1043),t.e(6601),t.e(938),t.e(1141)]).then(t.bind(t,1141)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[1141]},ssr:!1});function b(){(0,n.useRouter)();let[e,s]=(0,a.useState)(""),[t,l]=(0,a.useState)(!1),[o,c]=(0,a.useState)({}),[b,h]=(0,a.useState)(!0);(0,a.useEffect)(()=>{v()},[]);let v=async()=>{try{let e=await (0,u.fX)();c(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{h(!1)}},w=()=>{e.trim()&&!k&&l(!0)},k=e.trim()&&o.hasOwnProperty(e.trim()),y=e.trim()&&!k;return t?(0,r.jsx)(x,{workspaceName:e,isNewWorkspace:!0}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"flex items-center justify-between mb-4 h-5",children:(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)(i(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,r.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,r.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,r.jsxs)(p.Zb,{className:"max-w-md",children:[(0,r.jsx)(p.Ol,{children:(0,r.jsx)(p.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,r.jsxs)(p.aY,{className:"space-y-4",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(m._,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,r.jsx)(f.I,{id:"workspace-name",value:e,onChange:e=>s(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&y&&w()}}),k?(0,r.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,r.jsx)(i(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,r.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,r.jsx)(d.z,{onClick:w,disabled:!y||b,className:"w-full bg-blue-600 hover:bg-blue-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:b?"Loading...":"Next: Configure Workspace"})]})]})]})}},1163:function(e,s,t){e.exports=t(6036)},9102:function(e,s,t){"use strict";t.d(s,{f:function(){return i}});var r=t(7294),a=t(5320),n=t(5893),l=r.forwardRef((e,s)=>(0,n.jsx)(a.WV.label,{...e,ref:s,onMouseDown:s=>{s.target.closest("button, input, select, textarea")||(e.onMouseDown?.(s),!s.defaultPrevented&&s.detail>1&&s.preventDefault())}}));l.displayName="Label";var i=l},2003:function(e,s,t){"use strict";t.d(s,{j:function(){return l}});var r=t(512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=r.W,l=(e,s)=>t=>{var r;if((null==s?void 0:s.variants)==null)return n(e,null==t?void 0:t.class,null==t?void 0:t.className);let{variants:l,defaultVariants:i}=s,o=Object.keys(l).map(e=>{let s=null==t?void 0:t[e],r=null==i?void 0:i[e];if(null===s)return null;let n=a(s)||a(r);return l[e][n]}),c=t&&Object.entries(t).reduce((e,s)=>{let[t,r]=s;return void 0===r||(e[t]=r),e},{});return n(e,o,null==s?void 0:null===(r=s.compoundVariants)||void 0===r?void 0:r.reduce((e,s)=>{let{class:t,className:r,...a}=s;return Object.entries(a).every(e=>{let[s,t]=e;return Array.isArray(t)?t.includes({...i,...c}[s]):({...i,...c})[s]===t})?[...e,t,r]:e},[]),null==t?void 0:t.class,null==t?void 0:t.className)}}}]);