1import"../chunks/Bzak7iHL.js";import{p as Pe,j as W,k as r,l as R,m as He,g as e,u as w,f as x,t as b,b as s,c as ke,s as m,d as f,r as c,q as oe,a as ne,h as $,i as E}from"../chunks/BQx8BoPF.js";import{d as we,s as S,a as Te}from"../chunks/6-l-Ba4g.js";import{i as N}from"../chunks/DZX2ANdS.js";import{e as De,i as Ne}from"../chunks/BTxk6pGq.js";import{s as Re,b as Fe}from"../chunks/GA1fRzuV.js";import{p as le}from"../chunks/DNpxQQjt.js";import{g as Z}from"../chunks/F0bQJh7H.js";import{a as F,C as ee,p as Ie}from"../chunks/BpTKuQXx.js";import{c as Ue}from"../chunks/DiXoSfCI.js";import{s as ie}from"../chunks/zXQsi5bH.js";import{c as Ve,n as de,r as Ae}from"../chunks/KHCy8H30.js";import{r as Me}from"../chunks/CjMEpYls.js";import{A as L}from"../chunks/C13om8hL.js";import{B as ae}from"../chunks/Br_C5BUA.js";import{I as je}from"../chunks/CxuaKni4.js";import{L as Ee}from"../chunks/DOnOCBHk.js";import{I as te}from"../chunks/BZaVT8Uf.js";import{S as Ye}from"../chunks/BeC3vnOe.js";var Ce=x("<button> </button>"),Le=x("<div> </div>"),ze=x('<div class="flex justify-center py-8"><!></div>'),Be=x(`<div>Your ATProto handle <!> is being 2 used for this space.</div>`),Qe=x(`<div>Your ATProto handle <!> is being 3 used for a <a class="text-accent-500 underline">different space</a>. 4 Using your handle for this space will disconnect it from the other 5 one.</div>`),Xe=x(`<div>Your ATProto handle <!> is not 6 being used for any space.</div>`),qe=x('<div class="flex flex-col gap-4"><!> <div class="flex flex-col items-start gap-2"><!></div></div>'),Ge=x('<pre class="font-bold p-3 rounded-xl bg-base-100 dark:bg-base-900 font-mono text-xs text-base-900 dark:text-base-100 overflow-x-auto"> </pre>'),Oe=x('<span class="flex items-center gap-1 text-sm text-base-500"><!> Verifyingâ¦</span>'),Je=x('<span class="text-sm text-green-600">Verified</span>'),Ke=x('<span class="text-sm text-red-600">DNS Resolution Failed</span>'),We=x(`<div class="flex flex-col gap-4"><p class="text-sm text-base-700 dark:text-base-300">In order to set a space handle you must create a DNS TXT record for your 7 domain:</p> <!> <!> <div class="flex items-center justify-end gap-3"><!> <!></div></div>`),Ze=x(`<div class="max-w-2xl"><p class="mb-3 text-sm text-base-700 dark:text-base-300">Setting a space handle allows your space to be accessed with a nicer URL 8 such as:</p> <div class="font-bold my-3 font-mono text-sm text-base-900 dark:text-base-100"> </div> <p class="mb-4 text-sm text-base-700 dark:text-base-300">A space admin can use their handle for the space, or you can configure a 9 handle using DNS.</p> <div class="flex gap-1 mb-4 border-b border-base-200 dark:border-base-800"></div> <!> <!></div>`);function ga(ce,ve){Pe(ve,!0);const l=w(()=>le.params.space),fe=Ue(()=>e(l)),pe=w(()=>fe.data),I=w(()=>{var a;return((a=e(pe))==null?void 0:a.handle)??""});let P=R(void 0);W(()=>{const a=F.agent;a&&(r(P,void 0),a.com.atproto.repo.getRecord({collection:ee.profileSpaceNsid,repo:a.assertDid,rkey:"self"}).then(t=>{const i=t.data.value;r(P,(i==null?void 0:i.id)??null,!0)}).catch(t=>{t.error==="RecordNotFound"?r(P,null):(console.error("Failed to resolve profile space record",t),r(P,null))}))});const z=w(()=>{var a;return((a=F.agent)==null?void 0:a.assertDid)??""}),ue=w(()=>{var a;return((a=F.agent)==null?void 0:a.assertDid)??""}),me=["Use My Handle","Use DNS"];let C=R("Use My Handle"),p=R(He(e(I))),U=R(void 0),B=R(!1);W(()=>{e(I)&&r(p,e(I),!0)}),W(()=>{const a=e(p);if(!a||a.split(".").length<2){r(U,void 0);return}r(B,!0),r(U,void 0),Me(a).then(t=>{r(U,t===e(l))}).catch(()=>{r(U,!1)}).finally(()=>{r(B,!1)})});let h=R(!1),T=R(null);async function xe(){const a=F.agent;if(!(!a||!e(l))){r(h,!0),r(T,null);try{await Ve(a,e(l),{collection:ee.profileSpaceNsid}),await ie(e(l),[{$type:"space.roomy.space.setHandleProvider.v0",id:de(),did:e(ue)}]),Z(`/${e(l)}/settings/handle`)}catch(t){r(T,t instanceof Error?t.message:"Failed to set handle",!0),console.error("setHandleViaProfile error",t)}finally{r(h,!1)}}}async function _e(){const a=F.agent;if(!(!a||!e(l))){r(h,!0),r(T,null);try{await ie(e(l),[{$type:"space.roomy.space.setHandleProvider.v0",id:de(),did:null}]),await Ae(a,{collection:ee.profileSpaceNsid}),Z(`/${e(l)}/settings/handle`)}catch(t){r(T,t instanceof Error?t.message:"Failed to remove handle",!0),console.error("removeHandleViaProfile error",t)}finally{r(h,!1)}}}async function he(){if(!(!e(p)||!e(l))){r(h,!0),r(T,null);try{await Ie().procedure("space.roomy.space.setHandle",{spaceId:e(l),handle:e(p)}),Z(`/${e(p)}
9/settings/handle`)}catch(a){r(T,a instanceof Error?a.message:"Failed to set handle via DNS",!0)}finally{r(h,!1)}}}var Q=Ze(),X=m(f(Q),2),ge=f(X);c(X);var q=m(X,4);De(q,21,()=>me,Ne,(a,t)=>{var i=Ce(),H=f(i,!0);c(i),b(()=>{Re(i,1,`px-4 py-2 text-sm font-medium transition-colors 10 ${e(C)===e(t)?"text-accent-600 dark:text-accent-400 border-b-2 border-accent-500":"text-base-500 hover:text-base-700 dark:hover:text-base-300"}`),S(H,e(t))}),Te("click",i,()=>r(C,e(t),!0)),s(a,i)}),c(q);var re=m(q,2);{var be=a=>{L(a,{type:"error",class:"mb-4",children:(t,i)=>{var H=Le(),V=f(H,!0);c(H),b(()=>S(V,e(T))),s(t,H)},$$slots:{default:!0}})};N(re,a=>{e(T)&&a(be)})}var ye=m(re,2);{var $e=a=>{var t=oe(),i=ne(t);{var H=k=>{var y=ze(),A=f(y);Ee(A,{size:32}),c(y),s(k,y)},V=k=>{var y=qe(),A=f(y);{var G=n=>{L(n,{type:"info",children:(o,v)=>{var d=Be(),_=m(f(d));te(_,{children:(Y,K)=>{$();var j=E();b(()=>S(j,e(z))),s(Y,j)}}),$(),c(d),s(o,d)},$$slots:{default:!0}})},O=n=>{L(n,{type:"warning",children:(o,v)=>{var d=Qe(),_=m(f(d));te(_,{children:(K,j)=>{$();var se=E();b(()=>S(se,e(z))),s(K,se)}});var Y=m(_,2);$(),c(d),b(()=>Fe(Y,"href",`/${e(P)??""}/settings/handle`)),s(o,d)},$$slots:{default:!0}})},u=n=>{L(n,{type:"info",children:(o,v)=>{var d=Xe(),_=m(f(d));te(_,{children:(Y,K)=>{$();var j=E();b(()=>S(j,`@${e(z)??""}`)),s(Y,j)}}),$(),c(d),s(o,d)},$$slots:{default:!0}})};N(A,n=>{e(l)===e(P)?n(G):e(P)?n(O,1):n(u,!1)})}var g=m(A,2),M=f(g);{var D=n=>{{let o=w(()=>e(h)||!F.agent);ae(n,{onclick:xe,get disabled(){return e(o)},children:(v,d)=>{$();var _=E();b(()=>S(_,e(h)?"Settingâ¦":"Use My Handle For This Space")),s(v,_)},$$slots:{default:!0}})}},J=n=>{{let o=w(()=>e(h)||!F.agent);ae(n,{onclick:_e,variant:"secondary",get disabled(){return e(o)},children:(v,d)=>{$();var _=E();b(()=>S(_,e(h)?"Removingâ¦":"Remove Your Handle From This Space")),s(v,_)},$$slots:{default:!0}})}};N(M,n=>{e(l)!==e(P)?n(D):n(J,!1)})}c(g),c(y),s(k,y)};N(i,k=>{e(P)===void 0?k(H):k(V,!1)})}s(a,t)},Se=a=>{var t=We(),i=m(f(t),2);{var H=u=>{var g=Ge(),M=f(g);c(g),b(D=>S(M,`TXT _leaf.${D??""} "did=${e(l)??""}"`),[()=>e(p).split(".").slice(0,-1).join(".")]),s(u,g)};N(i,u=>{(e(I)||e(p))&&u(H)})}var V=m(i,2);je(V,{placeholder:"example.com",class:"w-full",get value(){return e(p)},set value(u){r(p,u,!0)}});var k=m(V,2),y=f(k);{var A=u=>{var g=oe(),M=ne(g);{var D=o=>{var v=Oe(),d=f(v);Ye(d,{class:"animate-spin size-4"}),$(),c(v),s(o,v)},J=o=>{var v=Je();s(o,v)},n=o=>{var v=Ke();s(o,v)};N(M,o=>{e(B)?o(D):e(U)===!0?o(J,1):e(U)===!1&&o(n,2)})}s(u,g)},G=w(()=>e(p)&&e(p).split(".").length>=2);N(y,u=>{e(G)&&u(A)})}var O=m(y,2);{let u=w(()=>e(h)||!e(p));ae(O,{onclick:he,get disabled(){return e(u)},children:(g,M)=>{$();var D=E();b(()=>S(D,!e(p)&&e(I)?"Remove Current Handle":"Set Handle")),s(g,D)},$$slots:{default:!0}})}c(k),c(t),s(a,t)};N(ye,a=>{e(C)==="Use My Handle"?a($e):e(C)==="Use DNS"&&a(Se,1)})}c(Q),b(()=>S(ge,`${le.url.host??""}/${(e(I)||e(l))??""}`)),s(ce,Q),ke()}we(["click"]);export{ga as component};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.