import{a as I}from"./asyncComputed.c75b06d6.js";import{P as S}from"./project.fda53dcc.js";import"./router.88734ca5.js";import{d as k,r as y,b as h,c as D,w as a,aq as r,ey as T,u as e,bU as P,cz as F,eH as H,G as A,f as t,e as m,eD as f,bN as U,eu as B,ew as E,cF as N,eB as V}from"./outputWidgets.c4f3de67.js";import"./columns.aa61756c.js";import{A as j}from"./Title.345a4775.js";import{b as C,c as d,A as _}from"./Text.fcf8f28f.js";import{A as $,F as R}from"./Base.9ed9c296.js";import"./gateway.5578a098.js";import"./record.685c8ba7.js";import"./pubsub.1842fa2d.js";import"./index.db3809d7.js";import"./transButton.ebe60b80.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]="63029c5e-d876-48b4-8ccd-de43dda1eba5",u._sentryDebugIdIdentifier="sentry-dbid-63029c5e-d876-48b4-8ccd-de43dda1eba5")}catch{}})();const q=k({__name:"SaveButton",props:{model:{},disabled:{type:Boolean}},emits:["error"],setup(u,{emit:s}){const l=u,i=y(!1),v=y(null);async function c(){i.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{i.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 h(),D(e(P),{class:T(["save-button",{changes:(g=o.model)==null?void 0:g.hasChanges()}]),loading:i.value,disabled:(p=o.disabled)!=null?p:!((n=o.model)!=null&&n.hasChanges()),onClick:b[0]||(b[0]=w=>c())},{default:a(()=>[r(" Save ")]),_:1},8,["class","loading","disabled"])}}}),z={key:0},K=k({__name:"SubdomainEditor",props:{project:{}},setup(u){const s=u,l=y(void 0),i=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",i()):l.value="invalid"}const c=A(()=>{switch(l.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),o=A(()=>{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=S.formatSubdomain(s.project.subdomain),v()};function g(){s.project.resetChanges(),l.value=void 0}return(n,p)=>(h(),D(e(N),{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(_),null,{default:a(()=>[t(e(d),null,{default:a(()=>[r("Forms available at:")]),_:1}),t(e(d),{code:""},{default:a(()=>[m("span",null,f(n.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),t(e(_),null,{default:a(()=>[t(e(d),null,{default:a(()=>[r("Hooks available at:")]),_:1}),t(e(d),{code:""},{default:a(()=>[m("span",null,f(n.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),t(e(R),null,{default:a(()=>[t(e($),{"validate-status":c.value,help:o.value,"has-feedback":""},{default:a(()=>[t(e(U),{value:n.project.subdomain,"onUpdate:value":p[0]||(p[0]=w=>n.project.subdomain=w),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(q,{model:n.project,disabled:l.value!=="available",onError:g},null,8,["model","disabled"])]),_:1}),n.project.customDomain?(h(),B("div",z,[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(d),{code:""},{default:a(()=>[m("span",null,f(n.project.customDomain),1)]),_:1})]),_:1}),t(e(_),null,{default:a(()=>[t(e(d),null,{default:a(()=>[r("Forms available at:")]),_:1}),t(e(d),{code:""},{default:a(()=>[m("span",null,f(n.project.getCustomDomainUrl("[PATH]")),1)]),_:1})]),_:1}),t(e(_),null,{default:a(()=>[t(e(d),null,{default:a(()=>[r("Hooks available at:")]),_:1}),t(e(d),{code:""},{default:a(()=>[m("span",null,f(n.project.getCustomDomainUrl("_hooks/[PATH]")),1)]),_:1})]),_:1})])):E("",!0)]),_:1}))}}),L={key:0,class:"project-settings"},oe=k({__name:"ProjectSettings",setup(u){const l=V().params.projectId,{result:i}=I(()=>S.get(l));return(v,c)=>e(i)?(h(),B("div",L,[t(e(j),null,{default:a(()=>[r("Project Settings")]),_:1}),t(K,{project:e(i)},null,8,["project"])])):E("",!0)}});export{oe as default};
//# sourceMappingURL=ProjectSettings.adb7f642.js.map
