import{a as B}from"./asyncComputed-Cb5wd5Zz.js";import{c as g}from"./router-R9B5jljo.js";import{h as n,I as D,br as E,a as y,r as F,l as N,c as f,i as s,b as V,f as S,w as i,u as e,ao as w,g as u,t as d,aS as R,T as b,n as h,ag as U,ah as H,F as $,ai as q,A as M,ak as z,k as G,e as J}from"./jwt-decode.esm-hSyeFKIL.js";import{a as k}from"./project-DO1klFDv.js";import"./tables-3agQu9af.js";import{S as L}from"./SaveButton-D6INC-KR.js";import{S as Q}from"./index-D0FLve96.js";import"./ts.worker-PiITTiGk.js";import"./record-BuQ9Rfg9.js";import"./string-jJ6EbKQI.js";import"./ExclamationCircleOutlined-D87pi5ms.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[r]="f53426c3-0877-4f8d-b68c-06162919c991",t._sentryDebugIdIdentifier="sentry-dbid-f53426c3-0877-4f8d-b68c-06162919c991")}catch{}})();function j(t){for(var r=1;r<arguments.length;r++){var a=arguments[r]!=null?Object(arguments[r]):{},l=Object.keys(a);typeof Object.getOwnPropertySymbols=="function"&&(l=l.concat(Object.getOwnPropertySymbols(a).filter(function(o){return Object.getOwnPropertyDescriptor(a,o).enumerable}))),l.forEach(function(o){W(t,o,a[o])})}return t}function W(t,r,a){return r in t?Object.defineProperty(t,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[r]=a,t}var v=function(r,a){var l=j({},r,a.attrs);return n(D,j({},l,{icon:E}),null)};v.displayName="CopyOutlined";v.inheritAttrs=!1;const X=y({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(t,{emit:r}){const a=t,l=r,o=F(void 0),p=N.debounce(async()=>{try{const{available:m}=await a.project.checkSubdomain();o.value=m?"available":"unavailable"}catch{o.value=void 0}},500);function _(){if(!a.project.hasChanges("subdomain")){o.value=void 0;return}a.project.subdomain?(o.value="loading",p()):o.value="invalid"}const C=f(()=>o.value!=="available"||!a.project.hasChanges("subdomain")),O=async()=>{await navigator.clipboard.writeText(a.project.getUrl())},P=f(()=>{switch(o.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),I=f(()=>{switch(o.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}}),x=()=>{const m=k.formatSubdomain(a.project.subdomain);l("change-subdomain",m),_()};function A(){a.project.resetChanges(),o.value=void 0}return(m,c)=>(S(),V(e(Q),{direction:"vertical"},{default:i(()=>[n(e(w),{level:2},{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_title")),1)]),_:1}),n(e(R),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_description")),1)]),_:1}),n(e(g),null,{default:i(()=>[n(e(b),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_forms_available")),1)]),_:1}),n(e(b),{code:""},{default:i(()=>[h("span",null,d(t.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),n(e(g),null,{default:i(()=>[n(e(b),null,{default:i(()=>[u(d(e(s).translate("i18n_subdomaineditor_hooks_available")),1)]),_:1}),n(e(b),{code:""},{default:i(()=>[h("span",null,d(t.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),n(e(U),null,{default:i(()=>[n(e(H),{"validate-status":P.value,help:I.value,"has-feedback":""},{default:i(()=>[n(e($),{gap:"middle"},{default:i(()=>[n(e(q),{value:t.project.subdomain,type:"text",loading:o.value==="loading",onBlur:x,onChange:c[0]||(c[0]=T=>l("change-subdomain",T.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"]),n(e(M),{placement:"top",title:e(s).translate("i18n_subdomaineditor_copy")},{default:i(()=>[n(e(v),{color:"red",onClick:O})]),_:1},8,["title"])]),_:1})]),_:1},8,["validate-status","help"]),n(L,{model:t.project,disabled:C.value,onError:A},null,8,["model","disabled"])]),_:1})]),_:1}))}}),Y={key:0,class:"project-settings"},ue=y({__name:"ProjectSettings",setup(t){const a=z().params.projectId,{result:l}=B(()=>k.get(a)),o=p=>{l.value.subdomain=p};return(p,_)=>e(l)?(S(),G("div",Y,[n(e(w),null,{default:i(()=>[u(d(e(s).translate("i18n_projectsettingsview_title")),1)]),_:1}),n(X,{project:e(l),onChangeSubdomain:o},null,8,["project"])])):J("",!0)}});export{ue as default};
//# sourceMappingURL=ProjectSettings-CnwCAZ50.js.map
