import{a as B}from"./asyncComputed.9805a381.js";import{a as _}from"./router.60675eeb.js";import{d as g,r as b,b as h,c as A,w as o,ar as u,ez as E,u as a,bV as I,cz as D,eL as F,H as j,f as r,e as k,eD as w,bO as P,cF as T,eB as V,ev as H,ex as N}from"./outputWidgets.244ba1c8.js";import"./index.bec3aec1.js";import{P as S}from"./project.9f9d482b.js";import{A as C}from"./Title.eb85429e.js";import{A as U}from"./Paragraph.bffb9dac.js";import{A as f}from"./Text.fbfa9a45.js";import{A as z}from"./FormItem.e7fba2a7.js";import{F as L}from"./Form.f49cd330.js";import"./index.cf4c23b9.js";import"./record.5766e9f8.js";import"./pubsub.f74b1921.js";import"./Base.2351f159.js";import"./Typography.52981f51.js";import"./hasIn.d73516ff.js";(function(){try{var l=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new Error().stack;n&&(l._sentryDebugIds=l._sentryDebugIds||{},l._sentryDebugIds[n]="46b71656-4978-4468-9c65-023e49582327",l._sentryDebugIdIdentifier="sentry-dbid-46b71656-4978-4468-9c65-023e49582327")}catch{}})();const R=g({__name:"SaveButton",props:{model:{},disabled:{type:Boolean}},emits:["error"],setup(l,{emit:n}){const t=l,i=b(!1),p=b(null);async function d(){i.value=!0;try{await t.model.save()}catch(e){e instanceof Error&&(n("error",e),D.error({message:"Error",description:e.message}),p.value=e)}finally{i.value=!1}}return addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&e.key==="s"&&(e.preventDefault(),d())}),addEventListener("beforeunload",e=>{t.model.hasChanges()&&(e.preventDefault(),e.returnValue="")}),(e,m)=>{var v,s,c;return h(),A(a(I),{class:E(["save-button",{changes:(v=e.model)==null?void 0:v.hasChanges()}]),loading:i.value,disabled:(c=e.disabled)!=null?c:!((s=e.model)!=null&&s.hasChanges()),onClick:m[0]||(m[0]=y=>d())},{default:o(()=>[u(" Save ")]),_:1},8,["class","loading","disabled"])}}}),$=g({__name:"SubdomainEditor",props:{project:{}},setup(l){const n=l,t=b(void 0),i=F.exports.debounce(async()=>{try{const{available:s}=await n.project.checkSubdomain();t.value=s?"available":"unavailable"}catch{t.value=void 0}},500);function p(){n.project.subdomain?(t.value="loading",i()):t.value="invalid"}const d=j(()=>{switch(t.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),e=j(()=>{switch(t.value){case"loading":return"Checking availability...";case"available":return"Available";case"unavailable":return"Unavailable";case"invalid":return"Invalid subdomain";default:return}}),m=()=>{n.project.subdomain=S.formatSubdomain(n.project.subdomain),p()};function v(){n.project.resetChanges(),t.value=void 0}return(s,c)=>(h(),A(a(T),{direction:"vertical"},{default:o(()=>[r(a(C),{level:2},{default:o(()=>[u("Subdomain")]),_:1}),r(a(U),null,{default:o(()=>[u(" Every project in Abstra Cloud comes with a default subdomain, which will appear on all shared project links. ")]),_:1}),r(a(_),null,{default:o(()=>[r(a(f),null,{default:o(()=>[u("Forms available at:")]),_:1}),r(a(f),{code:""},{default:o(()=>[k("span",null,w(s.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),r(a(_),null,{default:o(()=>[r(a(f),null,{default:o(()=>[u("Hooks available at:")]),_:1}),r(a(f),{code:""},{default:o(()=>[k("span",null,w(s.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),r(a(L),null,{default:o(()=>[r(a(z),{"validate-status":d.value,help:e.value,"has-feedback":""},{default:o(()=>[r(a(P),{value:s.project.subdomain,"onUpdate:value":c[0]||(c[0]=y=>s.project.subdomain=y),type:"text",loading:t.value==="loading",onBlur:m},{addonBefore:o(()=>[u("https://")]),addonAfter:o(()=>[u(".abstra.app")]),_:1},8,["value","loading"])]),_:1},8,["validate-status","help"]),r(R,{model:s.project,disabled:t.value!=="available",onError:v},null,8,["model","disabled"])]),_:1})]),_:1}))}}),x={key:0,class:"project-settings"},ne=g({__name:"ProjectSettings",setup(l){const t=V().params.projectId,{result:i}=B(()=>S.get(t));return(p,d)=>a(i)?(h(),H("div",x,[r(a(C),null,{default:o(()=>[u("Project Settings")]),_:1}),r($,{project:a(i)},null,8,["project"])])):N("",!0)}});export{ne as default};
//# sourceMappingURL=ProjectSettings.5491dbe8.js.map
