import{a as I}from"./asyncComputed.492220e2.js";import{d as h,e as D,em as P,f as p,c as B,w as t,u as e,o as _,b as o,aF as l,d9 as j,d7 as E,d8 as d,a as v,ec as f,cv as F,bH as T,cu as x,ed as H,X as N,R}from"./vue-router.c5124aea.js";import"./gateway.f0a8a4c2.js";import{P as y}from"./project.0a5e591f.js";import"./tables.e3d4a0cb.js";import{S as V}from"./SaveButton.489ca336.js";import{a as g}from"./router.09f8c7fd.js";import{A as U}from"./index.31f5d814.js";import"./popupNotifcation.13f7057e.js";import"./record.3c40de6b.js";import"./string.243c4431.js";import"./UnsavedChangesHandler.64f4045a.js";import"./ExclamationCircleOutlined.1a9a7b13.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},u=new Error().stack;u&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[u]="bb6711fa-416c-4e7a-ab41-ee215e9b5a15",s._sentryDebugIdIdentifier="sentry-dbid-bb6711fa-416c-4e7a-ab41-ee215e9b5a15")}catch{}})();const q=h({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(s,{emit:u}){const n=s,a=D(void 0),c=P.exports.debounce(async()=>{try{const{available:r}=await n.project.checkSubdomain();a.value=r?"available":"unavailable"}catch{a.value=void 0}},500);function i(){if(!n.project.hasChangesDeep("subdomain")){a.value=void 0;return}n.project.subdomain?(a.value="loading",c()):a.value="invalid"}const m=p(()=>a.value!=="available"||!n.project.hasChangesDeep("subdomain")),S=p(()=>{switch(a.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),k=p(()=>{switch(a.value){case"loading":return"Checking availability...";case"available":return"Available";case"unavailable":return"Unavailable";case"invalid":return"Invalid subdomain";default:return}}),w=()=>{const r=y.formatSubdomain(n.project.subdomain);u("change-subdomain",r),i()};function A(){n.project.resetChanges(),a.value=void 0}return(r,b)=>(_(),B(e(U),{direction:"vertical"},{default:t(()=>[o(e(j),{level:2},{default:t(()=>[l("Subdomain")]),_:1}),o(e(E),null,{default:t(()=>[l(" Every project in Abstra Cloud comes with a default subdomain, which will appear on all shared project links. ")]),_:1}),o(e(g),null,{default:t(()=>[o(e(d),null,{default:t(()=>[l("Forms available at:")]),_:1}),o(e(d),{code:""},{default:t(()=>[v("span",null,f(r.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),o(e(g),null,{default:t(()=>[o(e(d),null,{default:t(()=>[l("Hooks available at:")]),_:1}),o(e(d),{code:""},{default:t(()=>[v("span",null,f(r.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),o(e(x),null,{default:t(()=>[o(e(F),{"validate-status":S.value,help:k.value,"has-feedback":""},{default:t(()=>[o(e(T),{value:r.project.subdomain,type:"text",loading:a.value==="loading",onBlur:w,onChange:b[0]||(b[0]=C=>u("change-subdomain",C.target.value))},{addonBefore:t(()=>[l("https://")]),addonAfter:t(()=>[l(".abstra.app")]),_:1},8,["value","loading"])]),_:1},8,["validate-status","help"]),o(V,{model:r.project,disabled:m.value,onError:A},null,8,["model","disabled"])]),_:1})]),_:1}))}}),M={key:0,class:"project-settings"},ae=h({__name:"ProjectSettings",setup(s){const n=H().params.projectId,{result:a}=I(()=>y.get(n)),c=i=>{a.value.subdomain=i};return(i,m)=>e(a)?(_(),N("div",M,[o(e(j),null,{default:t(()=>[l("Project Settings")]),_:1}),o(q,{project:e(a),onChangeSubdomain:c},null,8,["project"])])):R("",!0)}});export{ae as default};
//# sourceMappingURL=ProjectSettings.c9860f48.js.map
