import{a as D}from"./asyncComputed-BkrPdfiN.js";import{f as _}from"./router-DyRErWhl.js";import{m as o,I as B,bs as E,e as j,r as F,l as N,b as f,i as s,f as V,h as y,w as i,j as e,ao as S,k as u,t as d,aS as U,T as p,D as g,aj as H,ak as R,J as $,al as q,F as J,y as M,g as z}from"./jwt-decode.esm-C2n6WQ0J.js";import{a as w}from"./project-BWts715N.js";import"./tables-Bfw_MTCm.js";import{u as G}from"./projectStore-DxqJVC72.js";import{S as L}from"./SaveButton-M-hwp7rI.js";import{S as Q}from"./index-BjcMudYN.js";import"./ts.worker-BwqBcqxg.js";import"./string-DePeD5b-.js";import"./organization-Brtl8D5A.js";import"./folder-mjOIyKW7.js";import"./ExclamationCircleOutlined-BX692nwD.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[r]="53c4f9ce-68a5-437e-8189-ba124c26823f",a._sentryDebugIdIdentifier="sentry-dbid-53c4f9ce-68a5-437e-8189-ba124c26823f")}catch{}})();function h(a){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?Object(arguments[r]):{},l=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(l=l.concat(Object.getOwnPropertySymbols(t).filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),l.forEach(function(n){W(a,n,t[n])})}return a}function W(a,r,t){return r in a?Object.defineProperty(a,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[r]=t,a}var b=function(r,t){var l=h({},r,t.attrs);return o(B,h({},l,{icon:E}),null)};b.displayName="CopyOutlined";b.inheritAttrs=!1;const X=j({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(a,{emit:r}){const t=a,l=r,n=F(void 0),v=N.debounce(async()=>{try{const{available:m}=await t.project.checkSubdomain();n.value=m?"available":"unavailable"}catch{n.value=void 0}},500);function k(){if(!t.project.hasChanges("subdomain")){n.value=void 0;return}t.project.subdomain?(n.value="loading",v()):n.value="invalid"}const C=f(()=>n.value!=="available"||!t.project.hasChanges("subdomain")),P=async()=>{await navigator.clipboard.writeText(t.project.getUrl())},O=f(()=>{switch(n.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),x=f(()=>{switch(n.value){case"loading":return s.translate("i18n_subdomaineditor_checking");case"available":return s.translate("i18n_subdomaineditor_available");case"unavailable":return s.translate("i18n_subdomaineditor_unavailable");case"invalid":return s.translate("i18n_subdomaineditor_invalid");default:return}}),I=()=>{const m=w.formatSubdomain(t.project.subdomain);l("change-subdomain",m),k()};function T(){t.project.resetChanges(),n.value=void 0}return(m,c)=>(y(),V(e(Q),{direction:"vertical"},{default:i(()=>[o(e(S),{level:2},{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_title")),1)]),_:1}),o(e(U),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_description")),1)]),_:1}),o(e(_),null,{default:i(()=>[o(e(p),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_forms_available")),1)]),_:1}),o(e(p),{code:""},{default:i(()=>[g("span",null,d(a.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),o(e(_),null,{default:i(()=>[o(e(p),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_hooks_available")),1)]),_:1}),o(e(p),{code:""},{default:i(()=>[g("span",null,d(a.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),o(e(H),null,{default:i(()=>[o(e(R),{"validate-status":O.value,help:x.value,"has-feedback":""},{default:i(()=>[o(e($),{gap:"middle"},{default:i(()=>[o(e(q),{value:a.project.subdomain,type:"text",loading:n.value==="loading",onBlur:I,onChange:c[0]||(c[0]=A=>l("change-subdomain",A.target.value))},{addonBefore:i(()=>[...c[1]||(c[1]=[u("https://",-1)])]),addonAfter:i(()=>[...c[2]||(c[2]=[u(".abstra.app/",-1)])]),_:1},8,["value","loading"]),o(e(J),{placement:"top",title:e(s).translate("i18n_subdomaineditor_copy")},{default:i(()=>[o(e(b),{color:"red",onClick:P})]),_:1},8,["title"])]),_:1})]),_:1},8,["validate-status","help"]),o(L,{model:a.project,disabled:C.value,onError:T},null,8,["model","disabled"])]),_:1})]),_:1}))}}),Y={key:0,class:"project-settings"},ce=j({__name:"ProjectSettings",setup(a){const r=G(),{result:t}=D(()=>w.get(r.projectId)),l=n=>{t.value.subdomain=n};return(n,v)=>e(t)?(y(),M("div",Y,[o(e(S),null,{default:i(()=>[u(d(e(s).translate("i18n_projectsettingsview_title")),1)]),_:1}),o(X,{project:e(t),onChangeSubdomain:l},null,8,["project"])])):z("",!0)}});export{ce as default};
//# sourceMappingURL=ProjectSettings-BYpAOhME.js.map
