import{a as E}from"./asyncComputed.fb8b9ba6.js";import{P as D}from"./project.b861b2fe.js";import"./router.ab2ac3ba.js";import{d as k,r as y,b as _,c as S,w as a,aI as r,ex as T,u as e,c0 as P,cC as F,eF as H,H as w,f as t,e as m,eB as f,bV as U,et as I,ev as B,ez as V}from"./outputWidgets.a4629ff8.js";import"./columns.464a3bb5.js";import{c as j,A as N}from"./Title.cf2a531e.js";import{A as C,a as i}from"./Text.eb216708.js";import{A as h}from"./index.46db6cb2.js";import{F as $}from"./Form.ab59726f.js";import{A as R}from"./index.fda4c602.js";import"./gateway.68939de7.js";import"./activeRecord.a2b7d343.js";import"./pubsub.25dc8c41.js";import"./index.339c7421.js";import"./index.f4ac7424.js";(function(){try{var u=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new Error().stack;s&&(u._sentryDebugIds=u._sentryDebugIds||{},u._sentryDebugIds[s]="6ffe92c3-b377-4010-86be-274d01e4fcc5",u._sentryDebugIdIdentifier="sentry-dbid-6ffe92c3-b377-4010-86be-274d01e4fcc5")}catch{}})();const z=k({__name:"SaveButton",props:{model:{},disabled:{type:Boolean}},emits:["error"],setup(u,{emit:s}){const l=u,d=y(!1),v=y(null);async function c(){d.value=!0;try{await l.model.save()}catch(o){o instanceof Error&&(s("error",o),F.error({message:"Error",description:o.message}),v.value=o)}finally{d.value=!1}}return addEventListener("keydown",o=>{(o.metaKey||o.ctrlKey)&&o.key==="s"&&(o.preventDefault(),c())}),addEventListener("beforeunload",o=>{l.model.hasChanges()&&(o.preventDefault(),o.returnValue="")}),(o,b)=>{var g,n,p;return _(),S(e(P),{class:T(["save-button",{changes:(g=o.model)==null?void 0:g.hasChanges()}]),loading:d.value,disabled:(p=o.disabled)!=null?p:!((n=o.model)!=null&&n.hasChanges()),onClick:b[0]||(b[0]=A=>c())},{default:a(()=>[r(" Save ")]),_:1},8,["class","loading","disabled"])}}}),K={key:0},L=k({__name:"SubdomainEditor",props:{project:{}},setup(u){const s=u,l=y(void 0),d=H.exports.debounce(async()=>{try{const{available:n}=await s.project.checkSubdomain();l.value=n?"available":"unavailable"}catch{l.value=void 0}},500);function v(){s.project.subdomain?(l.value="loading",d()):l.value="invalid"}const c=w(()=>{switch(l.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),o=w(()=>{switch(l.value){case"loading":return"Checking availability...";case"available":return"Available";case"unavailable":return"Unavailable";case"invalid":return"Invalid subdomain";default:return}}),b=()=>{s.project.subdomain=D.formatSubdomain(s.project.subdomain),v()};function g(){s.project.resetChanges(),l.value=void 0}return(n,p)=>(_(),S(e(R),{direction:"vertical"},{default:a(()=>[t(e(j),{level:2},{default:a(()=>[r("Subdomain")]),_:1}),t(e(C),null,{default:a(()=>[r(" Every project in Abstra Cloud comes with a default subdomain, which will appear on all shared project links. ")]),_:1}),t(e(h),null,{default:a(()=>[t(e(i),null,{default:a(()=>[r("Forms and Dashes available at:")]),_:1}),t(e(i),{code:""},{default:a(()=>[m("span",null,f(n.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),t(e(h),null,{default:a(()=>[t(e(i),null,{default:a(()=>[r("Hooks available at:")]),_:1}),t(e(i),{code:""},{default:a(()=>[m("span",null,f(n.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),t(e($),null,{default:a(()=>[t(e(N),{"validate-status":c.value,help:o.value,"has-feedback":""},{default:a(()=>[t(e(U),{value:n.project.subdomain,"onUpdate:value":p[0]||(p[0]=A=>n.project.subdomain=A),type:"text",loading:l.value==="loading",onBlur:b},{addonBefore:a(()=>[r("https://")]),addonAfter:a(()=>[r(".abstra.app")]),_:1},8,["value","loading"])]),_:1},8,["validate-status","help"]),t(z,{model:n.project,disabled:l.value!=="available",onError:g},null,8,["model","disabled"])]),_:1}),n.project.customDomain?(_(),I("div",K,[t(e(j),{level:2},{default:a(()=>[r("Custom Domain")]),_:1}),t(e(C),null,{default:a(()=>[r(" Your project also has a custom domain: "),t(e(i),{code:""},{default:a(()=>[m("span",null,f(n.project.customDomain),1)]),_:1})]),_:1}),t(e(h),null,{default:a(()=>[t(e(i),null,{default:a(()=>[r("Forms and Dashes available at:")]),_:1}),t(e(i),{code:""},{default:a(()=>[m("span",null,f(n.project.getCustomDomainUrl("[PATH]")),1)]),_:1})]),_:1}),t(e(h),null,{default:a(()=>[t(e(i),null,{default:a(()=>[r("Hooks available at:")]),_:1}),t(e(i),{code:""},{default:a(()=>[m("span",null,f(n.project.getCustomDomainUrl("_hooks/[PATH]")),1)]),_:1})]),_:1})])):B("",!0)]),_:1}))}}),q={key:0,class:"project-settings"},ne=k({__name:"ProjectSettings",setup(u){const l=V().params.projectId,{result:d}=E(()=>D.get(l));return(v,c)=>e(d)?(_(),I("div",q,[t(e(j),null,{default:a(()=>[r("Project Settings")]),_:1}),t(L,{project:e(d)},null,8,["project"])])):B("",!0)}});export{ne as default};
//# sourceMappingURL=ProjectSettings.02e43146.js.map
