import{c as _}from"./router-BiZH2muW.js";import{v as o,ab as D,bB as E,e as j,r as I,aa as F,b,l as s,n as N,g as y,w as l,p as a,am as S,q as u,t as d,bl as V,T as p,k as g,ah as R,ai as U,C as q,aj as H,A as $,s as M,b9 as z,f as G,j as J}from"./jwt-decode.esm-CW-ehmUm.js";import{a as w}from"./project-Fo2FlwgA.js";import"./tables-BzgKolvU.js";import{u as L}from"./projectStore-BxyV_vxa.js";import{S as Q}from"./SaveButton-BduB2ro0.js";import{S as W}from"./index-B1woDf_H.js";import"./ts.worker-BACR3sLa.js";import"./string-DG69OOx2.js";import"./organizationSwitcher-aqSMDQQ_.js";import"./organization-j66jOtof.js";import"./ExclamationCircleOutlined-CoO_M75i.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]="24417e6c-7075-4039-9611-8036da73901c",n._sentryDebugIdIdentifier="sentry-dbid-24417e6c-7075-4039-9611-8036da73901c")}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(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.forEach(function(t){X(n,t,e[t])})}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(D,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,t=I(void 0),v=F.debounce(async()=>{try{const{available:m}=await e.project.checkSubdomain();t.value=m?"available":"unavailable"}catch{t.value=void 0}},500);function C(){if(!e.project.hasChanges("subdomain")){t.value=void 0;return}e.project.subdomain?(t.value="loading",v()):t.value="invalid"}const P=b(()=>t.value!=="available"||!e.project.hasChanges("subdomain")),k=async()=>{await navigator.clipboard.writeText(e.project.getUrl())},O=b(()=>{switch(t.value){case"invalid":return"error";case"loading":return"validating";case"available":return"success";case"unavailable":return"error";default:return}}),x=b(()=>{switch(t.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),C()};function A(){e.project.resetChanges(),t.value=void 0}return(m,c)=>(y(),N(a(W),{direction:"vertical"},{default:l(()=>[o(a(S),{level:2},{default:l(()=>[u(d(a(s).translate("i18n_subdomaineditor_title")),1)]),_:1}),o(a(V),null,{default:l(()=>[u(d(a(s).translate("i18n_subdomaineditor_description")),1)]),_:1}),o(a(_),null,{default:l(()=>[o(a(p),null,{default:l(()=>[u(d(a(s).translate("i18n_subdomaineditor_forms_available")),1)]),_:1}),o(a(p),{code:""},{default:l(()=>[g("span",null,d(n.project.getUrl("[PATH]")),1)]),_:1})]),_:1}),o(a(_),null,{default:l(()=>[o(a(p),null,{default:l(()=>[u(d(a(s).translate("i18n_subdomaineditor_hooks_available")),1)]),_:1}),o(a(p),{code:""},{default:l(()=>[g("span",null,d(n.project.getUrl("_hooks/[PATH]")),1)]),_:1})]),_:1}),o(a(R),null,{default:l(()=>[o(a(U),{"validate-status":O.value,help:x.value,"has-feedback":""},{default:l(()=>[o(a(q),{gap:"middle"},{default:l(()=>[o(a(H),{value:n.project.subdomain,type:"text",loading:t.value==="loading",onBlur:T,onChange:c[0]||(c[0]=B=>i("change-subdomain",B.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(a($),{placement:"top",title:a(s).translate("i18n_subdomaineditor_copy")},{default:l(()=>[o(a(f),{color:"red",onClick:k})]),_: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 t=r.project;t&&!e.value&&(e.value=w.fromDTO(t))});const i=t=>{e.value&&(e.value.subdomain=t)};return(t,v)=>e.value?(y(),G("div",Z,[o(a(S),null,{default:l(()=>[u(d(a(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-BTIpp7by.js.map
