import{c as _}from"./router-B6Ze-x5P.js";import{v as o,ac as B,bB as E,e as j,r as I,ab as F,b,l as s,n as N,g as y,w as l,p as t,an as S,q as u,t as d,bl as V,T as p,k as g,ai as R,aj as U,D as q,ak as H,A as $,s as M,b9 as z,f as G,j as J}from"./jwt-decode.esm-CkJiA_gX.js";import{a as w}from"./project-BtYWr401.js";import"./tables-sSnhImKu.js";import{u as L}from"./projectStore-CaU5japp.js";import{S as Q}from"./SaveButton-Deq1g1zA.js";import{S as W}from"./index-DMoxlcAU.js";import"./ts.worker-BKJNydn3.js";import"./string-BZFbN__X.js";import"./organizationSwitcher-BfYB4d0S.js";import"./organization-BKprXTif.js";import"./ExclamationCircleOutlined-D6GOHp0_.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[r]="4734451d-41eb-4c1e-96ed-94ceec199094",n._sentryDebugIdIdentifier="sentry-dbid-4734451d-41eb-4c1e-96ed-94ceec199094")}catch{}})();function h(n){for(var r=1;r<arguments.length;r++){var e=arguments[r]!=null?Object(arguments[r]):{},i=Object.keys(e);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(e).filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),i.forEach(function(a){X(n,a,e[a])})}return n}function X(n,r,e){return r in n?Object.defineProperty(n,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):n[r]=e,n}var f=function(r,e){var i=h({},r,e.attrs);return o(B,h({},i,{icon:E}),null)};f.displayName="CopyOutlined";f.inheritAttrs=!1;const Y=j({__name:"SubdomainEditor",props:{project:{}},emits:["change-subdomain"],setup(n,{emit:r}){const e=n,i=r,a=I(void 0),v=F.debounce(async()=>{try{const{available:m}=await e.project.checkSubdomain();a.value=m?"available":"unavailable"}catch{a.value=void 0}},500);function k(){if(!e.project.hasChanges("subdomain")){a.value=void 0;return}e.project.subdomain?(a.value="loading",v()):a.value="invalid"}const P=b(()=>a.value!=="available"||!e.project.hasChanges("subdomain")),C=async()=>{await navigator.clipboard.writeText(e.project.getUrl())},O=b(()=>{switch(a.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),x=b(()=>{switch(a.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}}),T=()=>{const m=w.formatSubdomain(e.project.subdomain);i("change-subdomain",m),k()};function A(){e.project.resetChanges(),a.value=void 0}return(m,c)=>(y(),N(t(W),{direction:"vertical"},{default:l(()=>[o(t(S),{level:2},{default:l(()=>[u(d(t(s).translate("i18n_subdomaineditor_title")),1)]),_:1}),o(t(V),null,{default:l(()=>[u(d(t(s).translate("i18n_subdomaineditor_description")),1)]),_:1}),o(t(_),null,{default:l(()=>[o(t(p),null,{default:l(()=>[u(d(t(s).translate("i18n_subdomaineditor_forms_available")),1)]),_:1}),o(t(p),{code:""},{default:l(()=>[g("span",null,d(n.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),o(t(_),null,{default:l(()=>[o(t(p),null,{default:l(()=>[u(d(t(s).translate("i18n_subdomaineditor_hooks_available")),1)]),_:1}),o(t(p),{code:""},{default:l(()=>[g("span",null,d(n.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),o(t(R),null,{default:l(()=>[o(t(U),{"validate-status":O.value,help:x.value,"has-feedback":""},{default:l(()=>[o(t(q),{gap:"middle"},{default:l(()=>[o(t(H),{value:n.project.subdomain,type:"text",loading:a.value==="loading",onBlur:T,onChange:c[0]||(c[0]=D=>i("change-subdomain",D.target.value))},{addonBefore:l(()=>[...c[1]||(c[1]=[u("https://",-1)])]),addonAfter:l(()=>[...c[2]||(c[2]=[u(".abstra.app/",-1)])]),_:1},8,["value","loading"]),o(t($),{placement:"top",title:t(s).translate("i18n_subdomaineditor_copy")},{default:l(()=>[o(t(f),{color:"red",onClick:C})]),_:1},8,["title"])]),_:1})]),_:1},8,["validate-status","help"]),o(Q,{model:n.project,disabled:P.value,onError:A},null,8,["model","disabled"])]),_:1})]),_:1}))}}),Z={key:0,class:"project-settings"},ce=j({__name:"ProjectSettings",setup(n){const r=L(),e=M(null);z(()=>{const a=r.project;a&&!e.value&&(e.value=w.fromDTO(a))});const i=a=>{e.value&&(e.value.subdomain=a)};return(a,v)=>e.value?(y(),G("div",Z,[o(t(S),null,{default:l(()=>[u(d(t(s).translate("i18n_projectsettingsview_title")),1)]),_:1}),o(Y,{project:e.value,onChangeSubdomain:i},null,8,["project"])])):J("",!0)}});export{ce as default};
//# sourceMappingURL=ProjectSettings-B86hRkrR.js.map
