openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
1 lines • 4.38 kB
JavaScript
import{n as e}from"./rolldown-runtime-CNOWq4Kh.js";import{AN as t,EN as n,GN as r,JN as i,ck as a,fk as o,mk as s,qN as c,uk as l,vt as u,yt as d}from"./_2_____________________________.js";import{B as f,O as p,U as m,d as h,f as g,g as _,gt as v,j as y,l as b,m as x,s as S,u as C,x as w}from"./_6____________________.js";import{n as T,t as E}from"./en-openclaw-id-dialogs-BFGCHK4v.js";import{t as D}from"./claw-name-Dq5hFb9H.js";import{n as O,r as k,t as A}from"./avatar-processing-CIFdZoi2.js";function j(e){let[t,r]=f(``),[a,o]=f(null),[c,u]=f(!1),[m,S]=f(null),C;v(()=>C?.focus());let w=t=>{t&&s({severity:`success`,message:i(`openclawId.welcomeDone`,{name:t})}),e.onAnswered()},T=async(e,t)=>{u(!0),S(null);try{await e}catch(e){S(e instanceof A?i(e.code===`source-too-large`?`openclawId.welcomePhotoSourceTooLarge`:e.code===`too-large`?`openclawId.welcomePhotoTooLarge`:`openclawId.welcomePhotoInvalid`):n(e,t))}finally{u(!1)}};async function E(t){await e.due.client.request(`users.setDisplayName`,{profileId:e.due.self.id,displayName:t}),e.context.gateway.updateSelfUser?.({name:t}),l(e.context.config)?o(t):w(t)}async function O(t,n){let r=await k(t),i=await e.due.client.request(`users.setAvatar`,{profileId:e.due.self.id,mime:r.mime,avatarBase64:r.avatarBase64}),a=d(e.context.gateway.connection.gatewayUrl,i.profile.id,i.avatarRevision,e.context.resourceBasePath);a&&e.context.gateway.updateSelfUser?.({avatarUrl:a}),w(n)}var j=M(),B=j.firstChild,V=B.nextSibling;return h(j,y(p,{get when(){return a()},get fallback(){return[(()=>{var t=N(),n=t.firstChild,r=n.nextSibling;return h(t,(()=>{var t=g(()=>!!e.due.welcome.hostname);return()=>t()?i(`openclawId.welcomeTitle`,{name:D(e.due.welcome.hostname)}):i(`openclawId.welcomeTitlePlain`)})(),n),h(t,y(p,{get when(){return e.due.welcome.inviter},children:e=>[` `,g(()=>i(`openclawId.welcomeInvitedBy`,{inviter:e()}))]}),r),t})(),y(p,{get when(){return e.due.welcome.email},children:e=>(()=>{var t=I();return h(t,()=>i(`openclawId.welcomeAccount`,{account:e()})),t})()}),(()=>{var e=P();return h(e,()=>i(`openclawId.welcomeAskName`)),e})(),(()=>{var n=F(),a=n.firstChild,o=a.nextSibling,s=o.nextSibling;return n.addEventListener(`submit`,e=>{e.preventDefault();let n=t().trim();n&&!c()&&T(E(n),i(`openclawId.welcomeNameFailed`))}),a._$$input=e=>r(e.currentTarget.value),x(()=>e=>{C=e},a),h(o,()=>i(`common.continue`)),s._$$click=()=>w(e.due.welcome.currentName),h(s,()=>i(`openclawId.welcomeSkip`)),b(()=>({e:i(`openclawId.welcomeName`),t:i(`openclawId.welcomeName`),a:t(),o:!t().trim()||c(),i:c()}),({e,t,a:n,o:r,i},c)=>{e!==c?.e&&_(a,`aria-label`,e),t!==c?.t&&_(a,`placeholder`,t),a.value=n??``,r!==c?.o&&_(o,`disabled`,r),i!==c?.i&&_(s,`disabled`,i)}),n})()]},children:e=>[(()=>{var t=P();return h(t,()=>i(`openclawId.welcomeAskPhoto`,{name:e()})),t})(),(()=>{var t=R(),n=t.firstChild,r=n.firstChild,a=r.nextSibling,o=n.nextSibling,s=o.nextSibling;return n._$$click=e=>{let t=e.currentTarget.nextElementSibling;t instanceof HTMLInputElement&&t.click()},h(n,y(p,{get when(){return c()},get children(){return L()}}),r),h(n,()=>i(`openclawId.welcomePhoto`),a),o.addEventListener(`change`,t=>{let n=t.currentTarget.files?.[0];t.currentTarget.value=``,n&&T(O(n,e()),i(`openclawId.welcomePhotoFailed`))}),s._$$click=()=>w(e()),h(s,()=>i(`openclawId.welcomePhotoSkip`)),b(()=>({e:c(),t:c(),a:c()}),({e,t,a:r},i)=>{e!==i?.e&&_(n,`disabled`,e),t!==i?.t&&_(o,`disabled`,t),r!==i?.a&&_(s,`disabled`,r)}),t})()]}),B),h(j,y(p,{get when(){return m()},children:e=>(()=>{var t=z();return h(t,e),t})()}),V),j}var M,N,P,F,I,L,R,z;function B(){return(B=e((()=>{C(),m(),E(),t(),r(),o(),a(),O(),u(),M=w(`<section class=openclaw-id-welcome-step aria-live=polite><!><!>`),N=w(`<p><!><!>`),P=w(`<p class=openclaw-id-welcome-step__ask>`),F=w(`<form class=openclaw-id-welcome-step__row><input type=text name=name maxlength=256 autocomplete=name><button type=submit class="btn primary"></button><button type=button class=btn>`),I=w(`<p class=openclaw-id-welcome-step__account>`),L=w(`<span class=btn__spinner aria-hidden=true>`),R=w(`<div class=openclaw-id-welcome-step__row><button type=button class="btn primary"><!><!></button><input type=file accept=image/png,image/jpeg,image/webp hidden><button type=button class=btn>`),z=w(`<p class=openclaw-id-welcome-step__error role=alert>`),c(T),S([`input`,`click`])})))()}B();export{j as MemberWelcomeStep};