1import"../chunks/Bzak7iHL.js";import"../chunks/Dy8_1lpM.js";import{y as se,z as g,D as w,a as r,E as ee,b1 as ae,A as o,B as a,aa as s,m as V,C as t,aA as G,b4 as x,c as os,f as is,ak as ks,ae as f,b6 as ps}from"../chunks/CX_zZMjm.js";import{a as te,s as _,e as as}from"../chunks/D4Z8F5rQ.js";import{i as q}from"../chunks/CaLzNw32.js";import{e as oe,i as ie}from"../chunks/D6_QWsFN.js";import{r as H,s as ne}from"../chunks/NnKBK7I5.js";import{s as F}from"../chunks/BzMFJDWJ.js";import{s as re}from"../chunks/BJlllxCQ.js";import{b as fs,a as _s}from"../chunks/x3peJm6Q.js";import{i as le}from"../chunks/Jg18y7WP.js";import{s as ve,a as ce}from"../chunks/Dk73FpUL.js";import{u as de}from"../chunks/w_sl3LRh.js";import"../chunks/Cus8ndQc.js";var ue=g('<span class="error-text svelte-142s4qf"> </span>'),me=g('<span class="error-text svelte-142s4qf"> </span>'),pe=g('<div class="step-content svelte-142s4qf"><h2 class="svelte-142s4qf">Account Information</h2> <p class="svelte-142s4qf">Enter the basic information for the new account.</p> <div class="form-group svelte-142s4qf"><label for="org-name" class="svelte-142s4qf">Organization Name *</label> <input id="org-name" type="text" placeholder="e.g., Acme Corporation"/> <!></div> <div class="form-group svelte-142s4qf"><label for="account-id" class="svelte-142s4qf">Account ID *</label> <input id="account-id" type="text" placeholder="e.g., acme-corp"/> <small class="svelte-142s4qf">Used for site naming and internal identification. Only lowercase letters, numbers, and hyphens.</small> <!></div> <div class="step-actions svelte-142s4qf"><button class="btn btn-primary svelte-142s4qf">Next: Domain Setup â</button></div></div>'),fe=g('<span class="error-text svelte-142s4qf"> </span>'),_e=g('<div class="form-group svelte-142s4qf"><label for="custom-domain" class="svelte-142s4qf">Custom Domain *</label> <input id="custom-domain" type="text" placeholder="e.g., client-domain.com"/> <!></div>'),be=g('<span class="error-text svelte-142s4qf"> </span>'),qe=g('<div class="form-group svelte-142s4qf"><label for="subdomain" class="svelte-142s4qf">Subdomain *</label> <input id="subdomain" type="text" placeholder="e.g., client.yourdomain.com"/> <!></div>'),ge=g('<div class="step-content svelte-142s4qf"><h2 class="svelte-142s4qf">Domain Configuration</h2> <p class="svelte-142s4qf">Choose how you want to set up the domain for this account.</p> <div class="domain-options svelte-142s4qf"><label class="radio-option svelte-142s4qf"><input type="radio" class="svelte-142s4qf"/> <div class="option-content svelte-142s4qf"><h3 class="svelte-142s4qf">ð Default Netlify Domain</h3> <p class="svelte-142s4qf">Use the default .netlify.app domain</p> <small class="svelte-142s4qf"> </small></div></label> <label class="radio-option svelte-142s4qf"><input type="radio" class="svelte-142s4qf"/> <div class="option-content svelte-142s4qf"><h3 class="svelte-142s4qf">ð¯ Custom Domain</h3> <p class="svelte-142s4qf">Use a custom domain owned by the client</p> <small class="svelte-142s4qf">Example: client-domain.com</small></div></label> <label class="radio-option svelte-142s4qf"><input type="radio" class="svelte-142s4qf"/> <div class="option-content svelte-142s4qf"><h3 class="svelte-142s4qf">ð Subdomain</h3> <p class="svelte-142s4qf">Use a subdomain of your main domain</p> <small class="svelte-142s4qf">Example: client.yourdomain.com</small></div></label> <label class="radio-option svelte-142s4qf"><input type="radio" class="svelte-142s4qf"/> <div class="option-content svelte-142s4qf"><h3 class="svelte-142s4qf">ð¯ð Both Custom & Subdomain</h3> <p class="svelte-142s4qf">Set up both a custom domain and subdomain</p> <small class="svelte-142s4qf">Maximum flexibility for the client</small></div></label></div> <!> <!> <div class="step-actions svelte-142s4qf"><button class="btn btn-secondary svelte-142s4qf">â Back</button> <button class="btn btn-primary svelte-142s4qf"> </button></div></div>'),he=g('<small class="svelte-142s4qf"> </small>'),ye=g('<div><span class="progress-icon svelte-142s4qf"><!></span> <div class="progress-content svelte-142s4qf"><h4 class="svelte-142s4qf"> </h4> <p class="svelte-142s4qf"> </p> <!></div></div>'),xe=g('<div class="progress-item in_progress svelte-142s4qf"><span class="progress-icon svelte-142s4qf">ð</span> <div class="progress-content svelte-142s4qf"><h4 class="svelte-142s4qf">Initializing</h4> <p class="svelte-142s4qf">Starting account creation process...</p></div></div>'),we=g('<div class="error-message svelte-142s4qf"><h3>â Deployment Failed</h3> <p class="svelte-142s4qf"> </p> <button class="btn btn-secondary svelte-142s4qf">â Back to Configuration</button></div>'),Se=g('<div class="step-content svelte-142s4qf"><h2 class="svelte-142s4qf">ð Creating Account</h2> <p class="svelte-142s4qf">Please wait while we set up your account. This may take a few minutes.</p> <div class="progress-container svelte-142s4qf"><!> <!></div> <!></div>'),ze=g('<div class="detail-item svelte-142s4qf"><strong>Custom Domain:</strong> </div>'),Ce=g('<div class="detail-item svelte-142s4qf"><strong>Subdomain:</strong> </div>'),Ae=g('<div class="step-content success-content svelte-142s4qf"><div class="success-icon svelte-142s4qf">ð</div> <h2 class="svelte-142s4qf">Account Created Successfully!</h2> <p class="svelte-142s4qf">Your new account <strong> </strong> has been created and deployed.</p>
1 <div class="success-details svelte-142s4qf"><div class="detail-item svelte-142s4qf"><strong>Account ID:</strong> </div> <!> <!> <div class="detail-item svelte-142s4qf"><strong>Netlify URL:</strong> </div></div> <div class="success-actions svelte-142s4qf"><a class="btn btn-primary svelte-142s4qf">âï¸ Manage Account</a> <a href="/internal/dashboard" class="btn btn-secondary svelte-142s4qf">ð Back to Dashboard</a> <button class="btn btn-outline svelte-142s4qf">â Create Another Account</button></div></div>'),De=g('<div class="create-account svelte-142s4qf"><div class="wizard-header svelte-142s4qf"><h1 class="svelte-142s4qf">â Create New Account</h1> <div class="progress-bar svelte-142s4qf"><div class="progress-fill svelte-142s4qf"></div></div></div> <div class="step-indicators svelte-142s4qf"><div><span class="step-icon svelte-142s4qf"> </span> <span class="step-label svelte-142s4qf">Account Info</span></div> <div><span class="step-icon svelte-142s4qf"> </span> <span class="step-label svelte-142s4qf">Domain Setup</span></div> <div><span class="step-icon svelte-142s4qf"> </span> <span class="step-label svelte-142s4qf">Deployment</span></div> <div><span class="step-icon svelte-142s4qf"> </span> <span class="step-label svelte-142s4qf">Complete</span></div></div> <div class="wizard-content svelte-142s4qf"><!></div></div>');function Le(Es,Is){se(Is,!1);const Ns=()=>ce(de,"$user",Os),[Os,Bs]=ve(),ns=[];let e=V({organization_name:"",account_id:"",custom_domain:"",subdomain:"",domain_type:"default"}),l=V(1),Us=4,rs=V(!1),W=V(null),xs=V(!1),X=V([]),i=V({});function ws(c){switch(f(i,{}),c){case 1:s(e).organization_name.trim()||x(i,s(i).organization_name="Organization name is required"),s(e).account_id.trim()?/^[a-z0-9-]+$/.test(s(e).account_id)||x(i,s(i).account_id="Account ID must contain only lowercase letters, numbers, and hyphens"):x(i,s(i).account_id="Account ID is required");break;case 2:s(e).domain_type==="custom"&&!s(e).custom_domain.trim()&&x(i,s(i).custom_domain="Custom domain is required"),s(e).domain_type==="subdomain"&&!s(e).subdomain.trim()&&x(i,s(i).subdomain="Subdomain is required"),s(e).domain_type==="both"&&(s(e).custom_domain.trim()||x(i,s(i).custom_domain="Custom domain is required"),s(e).subdomain.trim()||x(i,s(i).subdomain="Subdomain is required"));break}return Object.keys(s(i)).length===0}function js(){ws(s(l))&&ks(l)}function Ts(){s(l)>1&&ks(l,-1)}function Ms(){const c=s(e).organization_name.toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"-").substring(0,20);x(e,s(e).account_id=c)}async function Ps(){if(ws(2)){f(rs,!0),f(W,null),f(X,[]),f(l,3);try{const c={organization_name:s(e).organization_name,account_id:s(e).account_id,custom_domain:s(e).domain_type==="custom"||s(e).domain_type==="both"?s(e).custom_domain:null,subdomain:s(e).domain_type==="subdomain"||s(e).domain_type==="both"?s(e).subdomain:null},b=await fetch("/api/internal/accounts/create",{method:"POST",headers:{Authorization:`Bearer ${Ns().accessToken}`,"Content-Type":"application/json"},body:JSON.stringify(c)});if(!b.ok){const h=await b.json();throw new Error(h.message||"Failed to create account")}const $=await b.json();await Fs($.deployment_id)}catch(c){f(W,c.message),f(l,2)}finally{f(rs,!1)}}}async function Fs(c){const b=new EventSource(`/api/internal/deploy/progress/${c}`);b.onmessage=function($){const h=JSON.parse($.data);f(X,[...s(X),h]),h.status==="completed"?(f(xs,!0),f(l,4),b.close()):h.status==="failed"&&(f(W,h.message),f(l,2),b.close())},b.onerror=function(){f(W,"Connection lost while monitoring deployment"),b.close()}}function ls(c){return c<s(l)?"â
":c===s(l)?"ð":"â"}le();var bs=De();te(c=>{ae.title="Create Account - SaaS Empire Management"});var qs=a(bs),Ss=o(a(qs),2),Js=a(Ss);t(Ss),t(qs);var gs=o(qs,2),vs=a(gs),zs=a(vs),Ls=a(zs,!0);t(zs),G(2),t(vs);var cs=o(vs,2),Cs=a(cs),Rs=a(Cs,!0);t(Cs),G(2),t(cs);var ds=o(cs,2),As=a(ds),Ys=a(As,!0);t(As),G(2),t(ds);var hs=o(ds,2),Ds=a(hs),Gs=a(Ds,!0);t(Ds),G(2),t(hs),t(gs);var $s=o(gs,2),Hs=a($s);{var Ks=c=>{var b=pe(),$=o(a(b),4),h=o(a($),2);H(h);let us;var J=o(h,2);{var L=v=>{var m=ue(),S=a(m,!0);t(m),w(()=>_(S,s(i).organization_name)),r(v,m)};q(J,v=>{s(i).organization_name&&v(L)})}t($);var T=o($,2),N=o(a(T),2);H(N);let O;var k=o(N,4);{var E=v=>{var m=me(),S=a(m,!0);t(m),w(()=>_(S,s(i).account_id)),r(v,m)};q(k,v=>{s(i).account_id&&v(E)})}t(T);var B=o(T,2),U=a(B);t(B),t(b),w((v,m)=>{us=F(h,1,"svelte-142s4qf",null,us,v),O=F(N,1,"svelte-142s4qf",null,O,m)},[()=>({error:s(i).organization_name}),()=>({error:s(i).account_id})]),fs(h,()=>s(e).organization_name,v=>x(e,s(e).organization_name=v)),as("input",h,Ms),fs(N,()=>s(e).account_id,v=>x(e,s(e).account_id=v)),as("click",U,js),r(c,b)},Qs=c=>{var b=os(),$=is(b);{var h=J=>{var L=ge(),T=o(a(L),4),N=a(T),O=a(N);H(O),O.value=O.__value="default";var k=o(O,2),E=o(a(k),4),B=a(E);t(E),t(k),t(N);var U=o(N,2),v=a(U);H(v),v.value=v.__value="custom",G(2),t(U);var m=o(U,2),S=a(m);H(S),S.value=S.__value="subdomain",G(2),t(m);var K=o(m,2),y=a(K);H(y),y.value=y.__value="both",G(2),t(K),t(T);var u=o(T,2);{var z=p=>{var C=_e(),A=o(a(C),2);H(A);let P;var D=o(A,2);{var d=n=>{var I=fe(),ts=a(I,!0);t(I),w(()=>_(ts,s(i).custom_domain)),r(n,I)};q(D,n=>{s(i).custom_domain&&n(d)})}t(C),w(n=>P=F(A,1,"svelte-142s4qf",null,P,n),[()=>({error:s(i).custom_domain})]),fs(A,()=>s(e).custom_domain,n=>x(e,s(e).custom_domain=n)),r(p,C)};q(u,p=>{(s(e).domain_type==="custom"||s(e).domain_type==="both")&&p(z)})}var j=o(u,2);{var R=p=>{var C=qe(),A=o(a(C),2);H(A);let P;var D=o(A,2);{var d=n=>{var I=be(),ts=a(I,!0);t(I),w(()=>_(ts,s(i).subdomain)),r(n,I)};q(D,n=>{s(i).subdomain&&n(d)})}t(C),w(n=>P=F(A,1,"svelte-142s4qf",null,P,n),[()=>({error:s(i).subdomain})]),fs(A,()=>s(e).subdomain,n=>x(e,s(e).subdomain=n)),r(p,C)};q(j,p=>{(s(e).domain_type==="subdomain"||s(e).domain_type==="both")&&p(R)})}var Z=o(j,2),Q=a(Z),M=o(Q,2),Y=a(M,!0);t(M),t(Z),t(L),w(()=>{_(B,`Example: ${s(e).account_id??""}-app.netlify.app`),M.disabled=s(rs),_(Y,s(rs)?"ð Creating Account...":"ð Create Account")}
1),_s(ns,[],O,()=>s(e).domain_type,p=>x(e,s(e).domain_type=p)),_s(ns,[],v,()=>s(e).domain_type,p=>x(e,s(e).domain_type=p)),_s(ns,[],S,()=>s(e).domain_type,p=>x(e,s(e).domain_type=p)),_s(ns,[],y,()=>s(e).domain_type,p=>x(e,s(e).domain_type=p)),as("click",Q,Ts),as("click",M,Ps),r(J,L)},us=J=>{var L=os(),T=is(L);{var N=k=>{var E=Se(),B=o(a(E),4),U=a(B);oe(U,1,()=>s(X),ie,(y,u)=>{var z=ye(),j=a(z),R=a(j);{var Z=d=>{var n=ps("â
");r(d,n)},Q=d=>{var n=os(),I=is(n);{var ts=ss=>{var ms=ps("â");r(ss,ms)},Vs=ss=>{var ms=os(),Ws=is(ms);{var Xs=es=>{var ys=ps("ð");r(es,ys)},Zs=es=>{var ys=ps("â³");r(es,ys)};q(Ws,es=>{s(u).status==="in_progress"?es(Xs):es(Zs,!1)},!0)}r(ss,ms)};q(I,ss=>{s(u).status==="failed"?ss(ts):ss(Vs,!1)},!0)}r(d,n)};q(R,d=>{s(u).status==="completed"?d(Z):d(Q,!1)})}t(j);var M=o(j,2),Y=a(M),p=a(Y,!0);t(Y);var C=o(Y,2),A=a(C,!0);t(C);var P=o(C,2);{var D=d=>{var n=he(),I=a(n,!0);t(n),w(()=>_(I,s(u).details)),r(d,n)};q(P,d=>{s(u).details&&d(D)})}t(M),t(z),w(()=>{F(z,1,`progress-item ${s(u).status??""}`,"svelte-142s4qf"),_(p,s(u).step),_(A,s(u).message)}),r(y,z)});var v=o(U,2);{var m=y=>{var u=xe();r(y,u)};q(v,y=>{s(X).length===0&&y(m)})}t(B);var S=o(B,2);{var K=y=>{var u=we(),z=o(a(u),2),j=a(z,!0);t(z);var R=o(z,2);t(u),w(()=>_(j,s(W))),as("click",R,()=>f(l,2)),r(y,u)};q(S,y=>{s(W)&&y(K)})}t(E),r(k,E)},O=k=>{var E=os(),B=is(E);{var U=v=>{var m=Ae(),S=o(a(m),4),K=o(a(S)),y=a(K,!0);t(K),G(),t(S);var u=o(S,2),z=a(u),j=o(a(z));t(z);var R=o(z,2);{var Z=D=>{var d=ze(),n=o(a(d));t(d),w(()=>_(n,` ${s(e).custom_domain??""}`)),r(D,d)};q(R,D=>{s(e).custom_domain&&D(Z)})}var Q=o(R,2);{var M=D=>{var d=Ce(),n=o(a(d));t(d),w(()=>_(n,` ${s(e).subdomain??""}`)),r(D,d)};q(Q,D=>{s(e).subdomain&&D(M)})}var Y=o(Q,2),p=o(a(Y));t(Y),t(u);var C=o(u,2),A=a(C),P=o(A,4);t(C),t(m),w(()=>{_(y,s(e).organization_name),_(j,` ${s(e).account_id??""}`),_(p,` ${s(e).account_id??""}-app.netlify.app`),ne(A,"href",`/internal/manage/${s(e).account_id??""}`)}),as("click",P,()=>{f(e,{organization_name:"",account_id:"",custom_domain:"",subdomain:"",domain_type:"default"}),f(l,1),f(xs,!1),f(X,[])}),r(v,m)};q(B,v=>{s(l)===4&&v(U)},!0)}r(k,E)};q(T,k=>{s(l)===3?k(N):k(O,!1)},!0)}r(J,L)};q($,J=>{s(l)===2?J(h):J(us,!1)},!0)}r(c,b)};q(Hs,c=>{s(l)===1?c(Ks):c(Qs,!1)})}t($s),t(bs),w((c,b,$,h)=>{re(Js,`width: ${s(l)/Us*100}%`),F(vs,1,`step ${s(l)>=1?"active":""} ${s(l)>1?"completed":""}`,"svelte-142s4qf"),_(Ls,c),F(cs,1,`step ${s(l)>=2?"active":""} ${s(l)>2?"completed":""}`,"svelte-142s4qf"),_(Rs,b),F(ds,1,`step ${s(l)>=3?"active":""} ${s(l)>3?"completed":""}`,"svelte-142s4qf"),_(Ys,$),F(hs,1,`step ${s(l)>=4?"active":""} ${s(l)>4?"completed":""}`,"svelte-142s4qf"),_(Gs,h)},[()=>ls(1),()=>ls(2),()=>ls(3),()=>ls(4)]),r(Es,bs),ee(),Bs()}export{Le as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.