import{k as ft,j as b,t as $t,m as p,n as v,p as e,f as h,q as Q,i as z,v as re,A as m,e as ye,x as H,s as ht,F as Z,S as R,w as K,g as he,z as xe}from"./web.Os7kOAdY.js";import{g as Fe,t as Ye}from"./i18n-runtime._BAkvU05.js";var xt=m('<div style="text-align:center;padding:12px;border-radius:8px;background:var(--c-surface, rgba(255,255,255,0.05))"><div class=tool-label style=margin-bottom:8px></div><div style="font-size:1.4em;font-weight:700;color:var(--c-accent, #f59e0b)">'),bt=m('<div style="display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:8px;background:var(--c-surface, rgba(255,255,255,0.05))"><div class=tool-label></div><!$><!/>'),pt=m('<div style="padding:8px 12px;border-radius:6px;background:var(--c-accent-bg, rgba(96,165,250,0.1));border:1px solid var(--c-accent, #60a5fa)"><!$><!/><strong></strong>（<!$><!/> <!$><!/>'),mt=m('<div style="padding:8px 12px;border-radius:6px;background:rgba(52,211,153,0.1);border:1px solid #34d399;color:#34d399;font-weight:600">'),vt=m("<div style=display:flex;flex-direction:column;gap:8px><div class=tool-label></div><!$><!/><button class=tool-btn type=button></button><!$><!/><!$><!/>"),_t=m("<div style=display:flex;gap:16px;align-items:center;flex-wrap:wrap><label style=display:flex;align-items:center;gap:6px><span class=tool-label style=margin:0></span><input class=tool-input type=number min=1 max=10 style=width:60px;text-align:center><span class=tool-label style=margin:0></span></label><label style=display:flex;align-items:center;gap:6px;cursor:pointer><input type=checkbox><span class=tool-label style=margin:0>"),yt=m('<div style="font-size:0.85em;color:var(--c-muted, #888)"><!$><!/><!$><!/>'),St=m('<div class=panel style=display:flex;flex-direction:column;gap:18px><div class=tool-actions style=flex-wrap:wrap></div><div style=min-height:220px;display:flex;align-items:center;justify-content:center><!$><!/><!$><!/><!$><!/><!$><!/></div><!$><!/><!$><!/><div style=display:flex;gap:8px><button type=button></button><button type=button></button></div><div style=display:flex;flex-direction:column;gap:8px><div class=tool-label></div><textarea class=tool-input rows=6 style=resize:vertical;font-family:inherit></textarea></div><!$><!/><!$><!/><div class=tool-actions><button class="tool-btn is-primary"type=button></button><button class=tool-btn type=button></button></div><!$><!/>'),wt=m("<button type=button>"),Mt=m("<div style=display:flex;gap:8px;align-items:baseline><span style=font-weight:600;min-width:60px><!$><!/>:</span><span>"),Ct=m('<div style="display:grid;grid-template-columns:1fr 80px 36px;gap:8px;align-items:center"><input class=tool-input type=text><input class=tool-input type=number min=1 max=100 style=text-align:center><button class="tool-btn is-ghost"type=button style="padding:4px 8px">&times;'),kt=m('<div style=position:relative><svg viewBox="0 0 280 280"width=280 height=280 style=display:block><g></g><polygon points="140,2 132,22 148,22"fill="var(--c-text, #fff)"stroke="var(--c-bg, #1a1a2e)"stroke-width=1></polygon><circle cx=140 cy=140 r=12 fill="var(--c-text, #fff)">'),zt=m('<svg><path stroke="var(--c-bg, #1a1a2e)"stroke-width=1.5></svg>',!1,!0,!1),Tt=m("<svg><text text-anchor=middle dominant-baseline=middle fill=#fff font-size=11 font-weight=600></svg>",!1,!0,!1),It=m("<div style=display:flex;gap:8px;align-items:center>"),At=m('<div style="width:90px;height:50px;overflow:hidden;border-radius:8px;border:2px solid var(--c-border, rgba(255,255,255,0.15));background:var(--c-surface, rgba(0,0,0,0.2))"><div>'),Et=m('<div style="height:50px;display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:600;color:var(--c-text, #fff)">'),Pt=m("<div style=display:flex;flex-wrap:wrap;gap:10px;justify-content:center>"),Rt=m('<div style=width:70px;height:90px;perspective:400px;cursor:default><div><div style="position:absolute;width:100%;height:100%;backface-visibility:hidden;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:24px;background:var(--c-accent, #60a5fa);color:#fff;font-weight:700">?</div><div style="position:absolute;width:100%;height:100%;backface-visibility:hidden;border-radius:8px;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:600;background:var(--c-surface, #2a2a4e);color:var(--c-text, #fff);transform:rotateY(180deg);padding:4px;text-align:center;border:2px solid var(--c-accent, #f59e0b)">'),Lt=m("<div style=text-align:center><div>");const jt=[{id:"wheel",label:"转盘"},{id:"slot",label:"老虎机"},{id:"flip",label:"翻牌"},{id:"scroll",label:"滚动"}],Se=`张三
李四
王五
赵六
钱七
孙八
周九
吴十`,Dt=[{name:"一等奖",count:1},{name:"二等奖",count:3},{name:"三等奖",count:5}];function qt(){const[c,L]=b(Fe(),{equals:!1}),f=i=>Ye(i,c());let I=Se;$t(()=>{const i=S=>{const C=S.detail?.locale;if(C){L(C);const w=Se.split(`
`).map(j=>Ye(j,C)).join(`
`);r()===I&&_(w),I=w}};window.addEventListener("taitan:locale-change",i),L(Fe()),ht(()=>window.removeEventListener("taitan:locale-change",i))});const[u,$]=b("simple"),[r,_]=b(Se),[o,d]=b(structuredClone(Dt)),[s,y]=b("wheel"),[g,a]=b(1),[t,l]=b(!0),[M,N]=b(!1),[B,be]=b([]),[se,V]=b([]),[U,ae]=b([]),[oe,ce]=b(0),[Y,we]=b([]),W=()=>r().split(`
`).map(i=>i.trim()).filter(Boolean),Me=()=>t()?W().filter(i=>!U().includes(i)):W(),ee=()=>{if(u()!=="tiered")return null;const i=o(),S=oe();return S<i.length?i[S]:null},pe=()=>u()==="tiered"&&oe()>=o().length;function Oe(){const i=Me();if(i.length===0||M())return;let S;if(u()==="tiered"){const F=ee();if(!F)return;S=Math.min(F.count,i.length)}else S=Math.min(g(),i.length);const w=[...i].sort(()=>Math.random()-.5).slice(0,S);V([]),be(w),N(!0);const j=s()==="wheel"?3e3:s()==="slot"?2500:s()==="flip"?1500:2e3;setTimeout(()=>{if(V(w),N(!1),t()&&ae(F=>[...F,...w]),u()==="tiered"){const F=ee();F&&(we(te=>[...te,{prize:F.name,winners:w}]),ce(te=>te+1))}},j)}function He(){V([]),ae([]),ce(0),we([])}function Ne(){o().length>=10||d(i=>[...i,{name:`${i.length+1}等奖`,count:1}])}function Xe(i){o().length<=1||d(S=>S.filter((C,w)=>w!==i))}function qe(i,S){d(C=>C.map((w,j)=>j===i?{...w,name:S}:w))}function Ze(i,S){d(C=>C.map((w,j)=>j===i?{...w,count:Math.max(1,S)}:w))}return(()=>{var i=p(St),S=i.firstChild,C=S.nextSibling,w=C.firstChild,[j,F]=v(w.nextSibling),te=j.nextSibling,[Ce,Be]=v(te.nextSibling),Ue=Ce.nextSibling,[ke,We]=v(Ue.nextSibling),Ge=ke.nextSibling,[Je,Ke]=v(Ge.nextSibling),Qe=C.nextSibling,[ze,Ve]=v(Qe.nextSibling),et=ze.nextSibling,[Te,tt]=v(et.nextSibling),Ie=Te.nextSibling,de=Ie.firstChild,me=de.nextSibling,Ae=Ie.nextSibling,Ee=Ae.firstChild,Pe=Ee.nextSibling,nt=Ae.nextSibling,[Re,lt]=v(nt.nextSibling),it=Re.nextSibling,[Le,rt]=v(it.nextSibling),je=Le.nextSibling,ge=je.firstChild,De=ge.nextSibling,st=je.nextSibling,[at,ot]=v(st.nextSibling);return e(S,h(Z,{each:jt,children:n=>(()=>{var x=p(wt);return x.$$click=()=>y(n.id),e(x,()=>n.label),z(()=>ye(x,`tool-btn${s()===n.id?" is-primary":""}`)),re(),x})()})),e(C,h(R,{get when(){return s()==="wheel"},get children(){return h(Ft,{get items(){return W()},get spinning(){return M()},get target(){return B()}})}}),j,F),e(C,h(R,{get when(){return s()==="slot"},get children(){return h(Yt,{get items(){return W()},get spinning(){return M()},get target(){return B()}})}}),Ce,Be),e(C,h(R,{get when(){return s()==="flip"},get children(){return h(Ot,{get items(){return W()},get spinning(){return M()},get target(){return B()}})}}),ke,We),e(C,h(R,{get when(){return s()==="scroll"},get children(){return h(Ht,{get items(){return W()},get spinning(){return M()},get target(){return B()}})}}),Je,Ke),e(i,h(R,{get when(){return se().length>0},get children(){var n=p(xt),x=n.firstChild,T=x.nextSibling;return e(x,(()=>{var k=Q(()=>u()==="tiered"&&Y().length>0);return()=>k()?`${Y()[Y().length-1].prize} 中奖结果`:"中奖结果"})()),e(T,()=>se().join("、")),n}}),ze,Ve),e(i,h(R,{get when(){return Q(()=>u()==="tiered")()&&Y().length>0},get children(){var n=p(bt),x=n.firstChild,T=x.nextSibling,[k,X]=v(T.nextSibling);return e(x,()=>f("全部抽奖结果")),e(n,h(Z,{get each(){return Y()},children:A=>(()=>{var D=p(Mt),O=D.firstChild,q=O.firstChild,[ue,ve]=v(q.nextSibling);ue.nextSibling;var _e=O.nextSibling;return e(O,()=>A.prize,ue,ve),e(_e,()=>A.winners.join("、")),D})()}),k,X),n}}),Te,tt),de.$$click=()=>$("simple"),e(de,()=>f("简单模式")),me.$$click=()=>$("tiered"),e(me,()=>f("分级抽奖")),e(Ee,()=>f("参与人员 / 奖品池（每行一个）")),Pe.$$input=n=>_(n.currentTarget.value),e(i,h(R,{get when(){return u()==="tiered"},get children(){var n=p(vt),x=n.firstChild,T=x.nextSibling,[k,X]=v(T.nextSibling),A=k.nextSibling,D=A.nextSibling,[O,q]=v(D.nextSibling),ue=O.nextSibling,[ve,_e]=v(ue.nextSibling);return e(x,()=>f("奖项等级设置")),e(n,h(Z,{get each(){return o()},children:(E,ne)=>(()=>{var le=p(Ct),G=le.firstChild,J=G.nextSibling,fe=J.nextSibling;return G.$$input=P=>qe(ne(),P.currentTarget.value),J.$$input=P=>Ze(ne(),parseInt(P.currentTarget.value)||1),fe.$$click=()=>Xe(ne()),z(P=>{var ie=f("奖项名称"),$e=o().length<=1;return ie!==P.e&&K(G,"placeholder",P.e=ie),$e!==P.t&&H(fe,"disabled",P.t=$e),P},{e:void 0,t:void 0}),z(()=>H(G,"value",E.name)),z(()=>H(J,"value",E.count)),re(),le})()}),k,X),A.$$click=Ne,e(A,()=>f("+ 添加奖项")),e(n,h(R,{get when(){return ee()},get children(){var E=p(pt),ne=E.firstChild,[le,G]=v(ne.nextSibling),J=le.nextSibling,fe=J.nextSibling,P=fe.nextSibling,[ie,$e]=v(P.nextSibling),ct=ie.nextSibling,dt=ct.nextSibling,[gt,ut]=v(dt.nextSibling);return e(E,()=>f("当前抽取："),le,G),e(J,()=>ee().name),e(E,()=>ee().count,ie,$e),e(E,()=>f("个）"),gt,ut),E}}),O,q),e(n,h(R,{get when(){return pe()},get children(){var E=p(mt);return e(E,()=>f("所有奖项已抽取完毕")),E}}),ve,_e),z(()=>H(A,"disabled",o().length>=10)),re(),n}}),Re,lt),e(i,h(R,{get when(){return u()==="simple"},get children(){var n=p(_t),x=n.firstChild,T=x.firstChild,k=T.nextSibling,X=k.nextSibling,A=x.nextSibling,D=A.firstChild,O=D.nextSibling;return e(T,()=>f("每次抽取")),k.$$input=q=>a(Math.max(1,parseInt(q.currentTarget.value)||1)),e(X,()=>f("个")),D.addEventListener("change",q=>l(q.currentTarget.checked)),e(O,()=>f("已中奖不重复")),z(()=>H(k,"value",g())),z(()=>H(D,"checked",t())),re(),n}}),Le,rt),ge.$$click=Oe,e(ge,(()=>{var n=Q(()=>!!M());return()=>n()?"抽奖中...":pe()?"已完成":"开始抽奖"})()),De.$$click=He,e(De,()=>f("重置")),e(i,h(R,{get when(){return Q(()=>U().length>0)()&&u()==="simple"},get children(){var n=p(yt),x=n.firstChild,[T,k]=v(x.nextSibling),X=T.nextSibling,[A,D]=v(X.nextSibling);return e(n,()=>f("已中奖："),T,k),e(n,()=>U().join("、"),A,D),n}}),at,ot),z(n=>{var x=`tool-btn${u()==="simple"?" is-primary":""}`,T=`tool-btn${u()==="tiered"?" is-primary":""}`,k=M()||Me().length===0||pe();return x!==n.e&&ye(de,n.e=x),T!==n.t&&ye(me,n.t=T),k!==n.a&&H(ge,"disabled",n.a=k),n},{e:void 0,t:void 0,a:void 0}),z(()=>H(Pe,"value",r())),re(),i})()}function Ft(c){const[L,f]=b(0),I=280,u=I/2,$=I/2,r=120,_=()=>{const o=c.items.length>0?c.items:["?"],s=360/o.length;return o.map((y,g)=>{const a=g*s-90,t=a+s,l=a*Math.PI/180,M=t*Math.PI/180,N=u+r*Math.cos(l),B=$+r*Math.sin(l),be=u+r*Math.cos(M),se=$+r*Math.sin(M),V=s>180?1:0,U=(a+s/2)*Math.PI/180,ae=u+r*.65*Math.cos(U),oe=$+r*.65*Math.sin(U),ce=a+s/2+90,Y=["#f87171","#fb923c","#fbbf24","#34d399","#60a5fa","#a78bfa","#f472b6","#2dd4bf"];return{item:y,path:`M${u},${$} L${N},${B} A${r},${r} 0 ${V},1 ${be},${se} Z`,labelX:ae,labelY:oe,labelRotation:ce,color:Y[g%Y.length]}})};return he(()=>{if(c.spinning){const o=c.items.length>0?c.items:["?"],d=c.target[0]||o[0],s=o.indexOf(d),y=360/o.length,g=-(s*y+y/2),a=5+Math.random()*3;f(t=>Math.ceil(t/360)*360+a*360+g)}}),(()=>{var o=p(kt),d=o.firstChild,s=d.firstChild,y=s.nextSibling;return y.nextSibling,e(s,h(Z,{get each(){return _()},children:g=>[(()=>{var a=p(zt);return z(t=>{var l=g.path,M=g.color;return l!==t.e&&K(a,"d",t.e=l),M!==t.t&&K(a,"fill",t.t=M),t},{e:void 0,t:void 0}),a})(),(()=>{var a=p(Tt);return e(a,(()=>{var t=Q(()=>g.item.length>5);return()=>t()?g.item.slice(0,5)+"..":g.item})()),z(t=>{var l=g.labelX,M=g.labelY,N=`rotate(${g.labelRotation}, ${g.labelX}, ${g.labelY})`;return l!==t.e&&K(a,"x",t.e=l),M!==t.t&&K(a,"y",t.t=M),N!==t.a&&K(a,"transform",t.a=N),t},{e:void 0,t:void 0,a:void 0}),a})()]})),z(g=>xe(s,`transform:rotate(${L()}deg);transform-origin:center;transition:transform ${c.spinning?"3s":"0s"} cubic-bezier(0.2,0.8,0.3,1);`,g)),o})()}function Yt(c){const[L,f]=b([[],[],[]]),[I,u]=b([0,0,0]),[$,r]=b([!1,!1,!1]),_=50,o=30;return he(()=>{if(c.spinning){const d=c.items.length>0?c.items:["?"],s=c.target.length>0?c.target[0]:d[Math.floor(Math.random()*d.length)],y=a=>{const t=[];for(let l=0;l<o-1;l++)t.push(d[Math.floor(Math.random()*d.length)]);return t.push(a),t},g=[y(s),y(s),y(s)];f(g),u([0,0,0]),r([!1,!1,!1]),requestAnimationFrame(()=>{const a=-29*_;setTimeout(()=>{u(t=>{const l=[...t];return l[0]=a,l}),r(t=>{const l=[...t];return l[0]=!0,l})},50),setTimeout(()=>{u(t=>{const l=[...t];return l[1]=a,l}),r(t=>{const l=[...t];return l[1]=!0,l})},600),setTimeout(()=>{u(t=>{const l=[...t];return l[2]=a,l}),r(t=>{const l=[...t];return l[2]=!0,l})},1200)})}}),(()=>{var d=p(It);return e(d,h(Z,{each:[0,1,2],children:s=>(()=>{var y=p(At),g=y.firstChild;return e(g,h(Z,{get each(){return L()[s]},children:a=>(()=>{var t=p(Et);return e(t,(()=>{var l=Q(()=>a.length>4);return()=>l()?a.slice(0,4)+"..":a})()),t})()})),z(a=>xe(g,`transform:translateY(${I()[s]}px);transition:transform ${$()[s]?"1.2s":"0s"} cubic-bezier(0.1,0.7,0.3,1);`,a)),y})()})),d})()}function Ot(c){const[L,f]=b([]),[I,u]=b([]);return he(()=>{if(c.spinning){const $=c.items.length>0?c.items:["?"],r=[...$].sort(()=>Math.random()-.5).slice(0,Math.min(8,$.length));if(c.target.length>0){const d=Math.floor(Math.random()*r.length);r[d]=c.target[0]}u(r),f([]);const _=r.findIndex(d=>c.target.includes(d)),o=_>=0?_:Math.floor(Math.random()*r.length);setTimeout(()=>f([o]),1200)}}),(()=>{var $=p(Pt);return e($,h(Z,{get each(){return I()},children:(r,_)=>(()=>{var o=p(Rt),d=o.firstChild,s=d.firstChild,y=s.nextSibling;return e(y,r),z(g=>xe(d,`width:100%;height:100%;position:relative;transform-style:preserve-3d;transition:transform 0.6s;${L().includes(_())?"transform:rotateY(180deg);":""}`,g)),o})()})),$})()}function Ht(c){const[L,f]=b(""),[I,u]=b(!1);return he(()=>{if(c.spinning){u(!1);const $=c.items.length>0?c.items:["?"],r=c.target[0]||$[Math.floor(Math.random()*$.length)];let _=0,o=30;const d=()=>{_=(_+1)%$.length,f($[_]),o+=3,o<200?setTimeout(d,o):(f(r),u(!0))};d()}}),(()=>{var $=p(Lt),r=$.firstChild;return e(r,()=>L()||"—"),z(_=>xe(r,`font-size:2.2em;font-weight:800;padding:30px 40px;border-radius:12px;border:3px solid ${I()?"var(--c-accent, #f59e0b)":"var(--c-border, rgba(255,255,255,0.15))"};background:var(--c-surface, rgba(0,0,0,0.2));color:var(--c-text, #fff);transition:border-color 0.3s;min-width:160px;`,_)),$})()}ft(["click","input"]);export{qt as default};
