"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3785],{42557:function(e,s,r){r.d(s,{I:function(){return l}});var t=r(85893),a=r(67294),n=r(32350);let l=a.forwardRef((e,s)=>{let{className:r,type:a,...l}=e;return(0,t.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",r),ref:s,...l})});l.displayName="Input"},36185:function(e,s,r){r.d(s,{_:function(){return c}});var t=r(85893),a=r(67294),n=r(49102),l=r(12003),o=r(32350);let i=(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:r,...a}=e;return(0,t.jsx)(n.f,{ref:s,className:(0,o.cn)(i(),r),...a})});c.displayName=n.f.displayName},33785:function(e,s,r){r.r(s),r.d(s,{NewWorkspace:function(){return b}});var t=r(85893),a=r(67294),n=r(11163),l=r(41664),o=r.n(l),i=r(5152),c=r.n(i),u=r(17324),d=r(30803),f=r(42557),m=r(36185),p=r(37673);let x=c()(()=>Promise.all([r.e(616),r.e(5739),r.e(7411),r.e(1272),r.e(7359),r.e(6989),r.e(3850),r.e(8969),r.e(9353),r.e(2260),r.e(3800),r.e(7615),r.e(1141)]).then(r.bind(r,11141)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[11141]},ssr:!1});function b(){(0,n.useRouter)();let[e,s]=(0,a.useState)(""),[r,l]=(0,a.useState)(!1),[i,c]=(0,a.useState)({}),[b,h]=(0,a.useState)(!0);(0,a.useEffect)(()=>{v()},[]);let v=async()=>{try{let e=await (0,u.getWorkspaces)();c(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{h(!1)}},k=()=>{e.trim()&&!y&&l(!0)},y=e.trim()&&i.hasOwnProperty(e.trim()),w=e.trim()&&!y;return r?(0,t.jsx)(x,{workspaceName:e,isNewWorkspace:!0}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4 h-5",children:(0,t.jsxs)("div",{className:"text-base flex items-center",children:[(0,t.jsx)(o(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,t.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,t.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,t.jsxs)(p.Zb,{className:"max-w-md",children:[(0,t.jsx)(p.Ol,{children:(0,t.jsx)(p.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,t.jsxs)(p.aY,{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(m._,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,t.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&&w&&k()}}),y?(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,t.jsx)(o(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,t.jsx)(d.z,{onClick:k,disabled:!w||b,className:"w-full bg-sky-600 hover:bg-sky-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:b?"Loading...":"Next: Configure Workspace"})]})]})]})}},49102:function(e,s,r){r.d(s,{f:function(){return o}});var t=r(67294),a=r(75320),n=r(85893),l=t.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 o=l},12003:function(e,s,r){r.d(s,{j:function(){return l}});var t=r(90512);let a=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=t.W,l=(e,s)=>r=>{var t;if((null==s?void 0:s.variants)==null)return n(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:l,defaultVariants:o}=s,i=Object.keys(l).map(e=>{let s=null==r?void 0:r[e],t=null==o?void 0:o[e];if(null===s)return null;let n=a(s)||a(t);return l[e][n]}),c=r&&Object.entries(r).reduce((e,s)=>{let[r,t]=s;return void 0===t||(e[r]=t),e},{});return n(e,i,null==s?void 0:null===(t=s.compoundVariants)||void 0===t?void 0:t.reduce((e,s)=>{let{class:r,className:t,...a}=s;return Object.entries(a).every(e=>{let[s,r]=e;return Array.isArray(r)?r.includes({...o,...c}[s]):({...o,...c})[s]===r})?[...e,r,t]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}}}]);