import{k as ne,j as x,t as ae,h as q,m as S,n as g,p as e,q as oe,i as f,v as re,A as y,x as d,w as ce,s as de}from"./web.Os7kOAdY.js";import{c as Y}from"./clipboard.BNxbz_oK.js";import{g as pe,b as ue}from"./utils.BiOoVwDh.js";import{g as D,t as $e}from"./i18n-runtime._BAkvU05.js";var xe=y('<div class=panel style=display:flex;flex-direction:column;gap:18px><section><h3 style="margin:0 0 10px;font-size:14px;color:var(--muted)"></h3><div class=tool-grid-2><div class=tool-field><span class=tool-label></span><input class=tool-input autocomplete=off></div><div class=tool-field><span class=tool-label></span><input class=tool-input type=password autocomplete=off></div></div><div style=margin-top:10px><span class=tool-label>Authorization Header</span><pre class=tool-pre></pre><div class=tool-actions style=margin-top:8px><button class="tool-btn is-primary"></button><button class=tool-btn></button></div></div></section><section><h3 style="margin:0 0 10px;font-size:14px;color:var(--muted)"></h3><div class=tool-field><span class=tool-label>Header / Base64</span><input class=tool-input></div><!$><!/></section><p class=tool-hint><!$><!/><strong></strong><!$><!/>'),ge=y("<dl class=tool-kv style=margin-top:10px><dt></dt><dd style=font-family:ui-monospace,monospace></dd><dt></dt><dd style=font-family:ui-monospace,monospace>"),fe=y("<div class=tool-error style=margin-top:10px>× <!$><!/>");function he(){const[O,w]=x(D(),{equals:!1}),s=l=>$e(l,O());ae(()=>{const l=i=>{const n=i.detail?.locale;n&&w(n)};window.addEventListener("taitan:locale-change",l),w(D()),de(()=>window.removeEventListener("taitan:locale-change",l))});const[C,R]=x("alice"),[k,V]=x("s3cret"),[B,W]=x("Basic YWxpY2U6czNjcmV0"),c=q(()=>{const l=C(),i=k();return!l&&!i?"":`Basic ${pe(`${l}:${i}`)}`}),p=q(()=>{const l=B().replace(/^\s*Basic\s+/i,"").trim();if(!l)return{ok:!0,user:"",pwd:""};try{const i=ue(l),n=i.indexOf(":");return n<0?{ok:!1,user:"",pwd:"",err:'解码后未找到 ":" 分隔符'}:{ok:!0,user:i.slice(0,n),pwd:i.slice(n+1)}}catch(i){return{ok:!1,user:"",pwd:"",err:i.message}}});return(()=>{var l=S(xe),i=l.firstChild,n=i.firstChild,T=n.nextSibling,E=T.firstChild,A=E.firstChild,H=A.nextSibling,F=E.nextSibling,z=F.firstChild,L=z.nextSibling,G=T.nextSibling,I=G.firstChild,M=I.nextSibling,J=M.nextSibling,u=J.firstChild,_=u.nextSibling,v=i.nextSibling,N=v.firstChild,P=N.nextSibling,K=P.firstChild,b=K.nextSibling,Q=P.nextSibling,[X,Z]=g(Q.nextSibling),m=v.nextSibling,ee=m.firstChild,[U,te]=g(ee.nextSibling),j=U.nextSibling,le=j.nextSibling,[ie,se]=g(le.nextSibling);return e(n,()=>s("编码")),e(A,()=>s("用户名")),H.$$input=t=>R(t.currentTarget.value),e(z,()=>s("密码")),L.$$input=t=>V(t.currentTarget.value),e(M,c),u.$$click=()=>Y(c()),e(u,()=>s("复制 Header")),_.$$click=()=>Y(c().replace(/^Basic\s+/,"")),e(_,()=>s("仅复制 Base64 部分")),e(N,()=>s("解码")),b.$$input=t=>W(t.currentTarget.value),e(v,(()=>{var t=oe(()=>!!p().ok);return()=>t()?(()=>{var a=S(ge),o=a.firstChild,r=o.nextSibling,$=r.nextSibling,h=$.nextSibling;return e(o,()=>s("用户名")),e(r,()=>p().user||"(空)"),e($,()=>s("密码")),e(h,()=>p().pwd||"(空)"),a})():(()=>{var a=S(fe),o=a.firstChild,r=o.nextSibling,[$,h]=g(r.nextSibling);return e(a,()=>p().err,$,h),a})()})(),X,Z),e(m,()=>s("Basic Auth 仅 base64 编码，"),U,te),e(j,()=>s("不是加密")),e(m,()=>s("，必须配 HTTPS 使用。"),ie,se),f(t=>{var a=!c(),o=!c(),r=s("Basic xxxxxx 或仅 base64 部分");return a!==t.e&&d(u,"disabled",t.e=a),o!==t.t&&d(_,"disabled",t.t=o),r!==t.a&&ce(b,"placeholder",t.a=r),t},{e:void 0,t:void 0,a:void 0}),f(()=>d(H,"value",C())),f(()=>d(L,"value",k())),f(()=>d(b,"value",B())),re(),l})()}ne(["input","click"]);export{he as default};
