import{k as Y,j as f,t as Z,m as p,n as k,p as o,f as tt,q as I,i as b,v as h,A as g,x as m,s as nt,e as et,F as lt}from"./web.Os7kOAdY.js";import{c as it,d as at}from"./clipboard.BNxbz_oK.js";import{g as B,t as ot}from"./i18n-runtime._BAkvU05.js";var st=g('<div class=panel style=display:flex;flex-direction:column;gap:14px><div class=tool-tabs role=tablist></div><div class=tool-grid-3><div class=tool-field><span class=tool-label></span><input class=tool-input type=number min=1 max=1000></div><!$><!/><!$><!/></div><div class=tool-actions><button class="tool-btn is-primary"></button><button class=tool-btn></button><button class=tool-btn></button><button class="tool-btn is-ghost"></button></div><!$><!/><p class=tool-hint>'),rt=g("<button>"),ct=g("<div class=tool-field><span class=tool-label></span><input class=tool-input type=number min=1 max=64>"),ut=g("<div class=tool-field><span class=tool-label>Worker ID (0-1023)</span><input class=tool-input type=number min=0 max=1023>"),$t=g("<pre class=tool-pre>");function ft(){const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const n=Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}function dt(){const e=BigInt(Date.now()),n=new Uint8Array(10);crypto.getRandomValues(n);const t=new Uint8Array(16);t[0]=Number(e>>40n&0xffn),t[1]=Number(e>>32n&0xffn),t[2]=Number(e>>24n&0xffn),t[3]=Number(e>>16n&0xffn),t[4]=Number(e>>8n&0xffn),t[5]=Number(e&0xffn),t[6]=112|n[0]&15,t[7]=n[1],t[8]=128|n[2]&63,t[9]=n[3],t[10]=n[4],t[11]=n[5],t[12]=n[6],t[13]=n[7],t[14]=n[8],t[15]=n[9];const l=Array.from(t).map(S=>S.toString(16).padStart(2,"0")).join("");return`${l.slice(0,8)}-${l.slice(8,12)}-${l.slice(12,16)}-${l.slice(16,20)}-${l.slice(20)}`}const pt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";function bt(e=21){const n=new Uint8Array(e);crypto.getRandomValues(n);let t="";for(let l=0;l<e;l++)t+=pt[n[l]&63];return t}let v=0n,V=0n;function mt(e=1n,n=1577836800000n){let t=BigInt(Date.now());if(t===V){if(v=v+1n&0xfffn,v===0n){for(;BigInt(Date.now())<=t;);t=BigInt(Date.now())}}else v=0n;return V=t,(t-n<<22n|(e&0x3ffn)<<12n|v).toString()}function _t(){const[e,n]=f(B(),{equals:!1}),t=r=>ot(r,e());Z(()=>{const r=c=>{const u=c.detail?.locale;u&&n(u)};window.addEventListener("taitan:locale-change",r),n(B()),nt(()=>window.removeEventListener("taitan:locale-change",r))});const[l,S]=f("v4"),[N,F]=f(10),[U,q]=f(21),[C,W]=f("1"),[$,D]=f([]),z=()=>{const r=Math.min(Math.max(1,Math.floor(N())),1e3),c=[];for(let u=0;u<r;u++)l()==="v4"?c.push(ft()):l()==="v7"?c.push(dt()):l()==="nanoid"?c.push(bt(Math.max(1,Math.min(64,U())))):c.push(mt(BigInt(parseInt(C(),10)||1)));D(c)};return(()=>{var r=p(st),c=r.firstChild,u=c.nextSibling,A=u.firstChild,M=A.firstChild,L=M.nextSibling,H=A.nextSibling,[j,O]=k(H.nextSibling),P=j.nextSibling,[G,J]=k(P.nextSibling),E=u.nextSibling,w=E.firstChild,x=w.nextSibling,_=x.nextSibling,R=_.nextSibling,K=E.nextSibling,[T,Q]=k(K.nextSibling),X=T.nextSibling;return o(c,tt(lt,{each:[["v4","UUID v4"],["v7","UUID v7"],["nanoid","NanoID"],["snowflake","Snowflake"]],children:([i,a])=>(()=>{var s=p(rt);return s.$$click=()=>S(i),o(s,a),b(()=>et(s,`tool-tab ${l()===i?"is-active":""}`)),h(),s})()})),o(M,()=>t("数量")),L.$$input=i=>F(parseInt(i.currentTarget.value,10)||1),o(u,(()=>{var i=I(()=>l()==="nanoid");return()=>i()&&(()=>{var a=p(ct),s=a.firstChild,d=s.nextSibling;return o(s,()=>t("长度")),d.$$input=y=>q(parseInt(y.currentTarget.value,10)||21),b(()=>m(d,"value",U())),h(),a})()})(),j,O),o(u,(()=>{var i=I(()=>l()==="snowflake");return()=>i()&&(()=>{var a=p(ut),s=a.firstChild,d=s.nextSibling;return d.$$input=y=>W(y.currentTarget.value),b(()=>m(d,"value",C())),h(),a})()})(),G,J),w.$$click=z,o(w,()=>t("生成")),x.$$click=()=>it($().join(`
`)),o(x,()=>t("复制全部")),_.$$click=()=>at($().join(`
`),`${l()}-${$().length}.txt`),o(_,()=>t("下载 .txt")),R.$$click=()=>D([]),o(R,()=>t("清空")),o(r,(()=>{var i=I(()=>$().length>0);return()=>i()&&(()=>{var a=p($t);return o(a,()=>$().join(`
`)),a})()})(),T,Q),o(X,()=>t("UUID v4 = 全随机；v7 = 时间戳前缀 (RFC 9562)，可排序；NanoID = URL 安全；Snowflake = 64 位时间戳 + 机器号 + 序列。")),b(i=>{var a=!$().length,s=!$().length;return a!==i.e&&m(x,"disabled",i.e=a),s!==i.t&&m(_,"disabled",i.t=s),i},{e:void 0,t:void 0}),b(()=>m(L,"value",N())),h(),r})()}Y(["input","click"]);export{_t as default};
