import{n as j,u as g,b as N,l as i,d as v,j as e,L as m,I as x,B as n,k as h}from"./index-O0BQoyzo.js";import{r as c}from"./react-Cb2sDjhD.js";import{L as w}from"./loader-circle-9VUMGitw.js";import{R as k}from"./refresh-ccw-D2CWiyU_.js";import{Q as b}from"./qr-code-DgU5aiM6.js";import{E as y,a as L}from"./eye-CFhg5BTa.js";import{C}from"./copy-DxSHRdbc.js";import{S as U}from"./shield-alert-CKFVsGgI.js";/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S=j("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);function Q(){const{t:s}=g(["settings","common"]),[t,u]=c.useState(null),[r,d]=c.useState(!1),[o,p]=c.useState(""),l=N({mutationFn:()=>v.generateMobileQR(o.trim()?{host:o.trim()}:void 0),onSuccess:a=>{u(a),d(!1),i.success(s("mobile.generatedToast"))},onError:a=>i.error(a.message)});async function f(){if(t)try{await navigator.clipboard.writeText(t.loginUrl),i.success(s("mobile.copied"))}catch{i.error(s("mobile.copyFailed"))}}return e.jsxs("div",{className:"mx-auto flex max-w-4xl flex-col gap-6",children:[e.jsx("header",{className:"flex items-center gap-3",children:e.jsx("h1",{className:"text-xl font-semibold",children:s("mobile.title")})}),e.jsx("p",{className:"text-sm text-text-dim",children:s("mobile.subtitle")}),e.jsxs("section",{className:"rounded-md border border-border bg-surface p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(S,{className:"h-4 w-4 text-text-dim"}),e.jsx("h2",{className:"text-sm font-semibold",children:s("mobile.generateCard")})]}),e.jsx("p",{className:"mt-1 text-xs text-text-dim",children:s("mobile.generateDesc")}),e.jsxs("div",{className:"mt-4 flex flex-col gap-2",children:[e.jsx(m,{className:"text-xs font-medium",children:s("mobile.hostLabel")}),e.jsx(x,{value:o,onChange:a=>p(a.target.value),placeholder:s("mobile.hostPlaceholder",{defaultValue:"auto-detect (leave blank)"}),className:"font-mono text-xs"}),e.jsx("p",{className:"text-[11px] text-text-dim",children:s("mobile.hostHint")})]}),e.jsxs("div",{className:"mt-4 flex items-center gap-2",children:[e.jsxs(n,{onClick:()=>l.mutate(),disabled:l.isPending,size:"sm",children:[l.isPending?e.jsx(w,{className:"h-4 w-4 animate-spin"}):t?e.jsx(k,{className:"h-4 w-4"}):e.jsx(b,{className:"h-4 w-4"}),e.jsx("span",{className:"ml-1",children:s(t?"mobile.regenerate":"mobile.generate")})]}),l.isPending&&e.jsx(h,{variant:"info",children:s("mobile.generating")})]})]}),t&&e.jsxs("section",{className:"rounded-md border border-border bg-surface p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b,{className:"h-4 w-4 text-text-dim"}),e.jsx("h2",{className:"text-sm font-semibold",children:s("mobile.scanCard")}),e.jsxs(h,{variant:"success",className:"ml-auto",children:[s("mobile.tokenLabel"),": ",e.jsx("span",{className:"ml-1 font-mono",children:t.label})]})]}),e.jsx("p",{className:"mt-1 text-xs text-text-dim",children:s("mobile.scanDesc")}),e.jsxs("div",{className:"mt-4 flex flex-col items-center gap-3 sm:flex-row sm:items-start",children:[e.jsx("div",{className:"shrink-0 rounded-md border border-border bg-white p-2",children:e.jsx("img",{src:t.qrDataUrl,alt:s("mobile.qrAlt",{defaultValue:"QR code for mobile chat"}),width:280,height:280,className:"block h-[280px] w-[280px]"})}),e.jsxs("div",{className:"flex w-full flex-col gap-3",children:[e.jsxs("div",{children:[e.jsx(m,{className:"text-xs font-medium",children:s("mobile.urlLabel")}),e.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[e.jsx(x,{type:r?"text":"password",readOnly:!0,value:t.loginUrl,className:"font-mono text-[11px]"}),e.jsx(n,{size:"sm",variant:"ghost",onClick:()=>d(a=>!a),"aria-label":r?s("mobile.hideUrl",{defaultValue:"Hide URL"}):s("mobile.showUrl",{defaultValue:"Show URL"}),children:r?e.jsx(y,{className:"h-4 w-4"}):e.jsx(L,{className:"h-4 w-4"})}),e.jsx(n,{size:"sm",variant:"ghost",onClick:()=>void f(),"aria-label":s("mobile.copyUrl",{defaultValue:"Copy URL"}),children:e.jsx(C,{className:"h-4 w-4"})})]}),e.jsx("p",{className:"mt-1 text-[11px] text-text-dim",children:s("mobile.urlHint")})]}),e.jsxs("div",{children:[e.jsx(m,{className:"text-xs font-medium",children:s("mobile.tokenIdLabel")}),e.jsx("div",{className:"mt-1 font-mono text-xs",children:t.tokenId}),e.jsx("p",{className:"mt-1 text-[11px] text-text-dim",children:s("mobile.tokenIdHint")})]})]})]}),e.jsxs("div",{className:"mt-4 flex items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3",children:[e.jsx(U,{className:"mt-0.5 h-4 w-4 shrink-0 text-warning"}),e.jsxs("div",{className:"text-xs",children:[e.jsx("div",{className:"font-medium",children:s("mobile.warningTitle")}),e.jsx("p",{className:"mt-1 text-text-dim",children:s("mobile.warningBody")}),e.jsx("a",{href:t.revokeHint,className:"mt-1 inline-block underline text-accent",children:s("mobile.revokeLink")})]})]})]})]})}export{Q as default};
//# sourceMappingURL=mobile-CV5b6D2W.js.map
