import{k as se,j as o,t as re,m as p,n as d,p as l,f as $,i as h,v as R,A as g,w as oe,x as j,s as ce,z as F,F as H,S as I}from"./web.Os7kOAdY.js";import{g as N,t as pe}from"./i18n-runtime._BAkvU05.js";var de=g("<pre class=tool-pre>"),ge=g("<div><span class=tool-label></span><div style=display:flex;flex-wrap:wrap;gap:6px;margin-top:4px>"),ue=g('<div class=panel style=display:flex;flex-direction:column;gap:14px><div><span class=tool-label></span><div style=display:flex;flex-wrap:wrap;gap:8px;margin-top:6px></div></div><div class=tool-field><span class=tool-label></span><textarea class=tool-input style=min-height:60px;resize:vertical></textarea></div><p class=tool-hint><!$><!/><!$><!/> <!$><!/></p><button class=tool-btn style="padding:14px 28px;font-size:18px;cursor:pointer;align-self:center"></button><!$><!/><!$><!/>'),fe=g("<button class=tool-btn>"),xe=g('<span style="background:var(--c-surface,#f5f5f5);padding:2px 10px;border-radius:4px;font-size:13px">');const S={中餐:["红烧肉","宫保鸡丁","麻婆豆腐","糖醋排骨","鱼香肉丝","回锅肉","水煮鱼","酸菜鱼","番茄炒蛋","蛋炒饭","炸酱面","兰州拉面","小笼包","饺子","煎饼果子"],西餐:["意大利面","披萨","汉堡","牛排","凯撒沙拉","三明治","薯条","烤鸡","奶油蘑菇汤","法棍面包"],日韩:["寿司","拉面","天妇罗","咖喱饭","章鱼烧","石锅拌饭","韩式炸鸡","部队锅","紫菜包饭","味增汤"],小吃:["烧烤","麻辣烫","火锅","串串","臭豆腐","炸鸡","奶茶","关东煮","凉皮","肉夹馍","螺蛳粉","酸辣粉"],快餐:["肯德基","麦当劳","必胜客","沙县小吃","黄焖鸡","兰州拉面","盖浇饭","便当","轻食沙拉"]};function _e(){const[O,y]=o(N(),{equals:!1}),s=e=>pe(e,O());re(()=>{const e=n=>{const a=n.detail?.locale;a&&y(a)};window.addEventListener("taitan:locale-change",e),y(N()),ce(()=>window.removeEventListener("taitan:locale-change",e))});const[_,q]=o(""),[w,B]=o(["中餐","小吃"]),[C,v]=o(""),[b,E]=o(!1),[k,W]=o([]);function M(){const e=[];for(const n of w())S[n]&&e.push(...S[n]);return _().trim()&&e.push(..._().split(/[,，、\n]/).map(n=>n.trim()).filter(Boolean)),[...new Set(e)]}function D(){const e=M();if(e.length===0){v("请先选择分类或输入选项！");return}E(!0);let n=0;const a=setInterval(()=>{if(v(e[Math.floor(Math.random()*e.length)]),n++,n>15){clearInterval(a);const u=e[Math.floor(Math.random()*e.length)];v(u),E(!1),W(f=>[u,...f.slice(0,9)])}},80)}function G(e){B(n=>n.includes(e)?n.filter(a=>a!==e):[...n,e])}return(()=>{var e=p(ue),n=e.firstChild,a=n.firstChild,u=a.nextSibling,f=n.nextSibling,z=f.firstChild,m=z.nextSibling,c=f.nextSibling,J=c.firstChild,[P,K]=d(J.nextSibling),Q=P.nextSibling,[L,U]=d(Q.nextSibling),V=L.nextSibling,X=V.nextSibling,[Y,Z]=d(X.nextSibling),x=c.nextSibling,ee=x.nextSibling,[T,te]=d(ee.nextSibling),ne=T.nextSibling,[le,ie]=d(ne.nextSibling);return l(a,()=>s("选择分类：")),l(u,$(H,{get each(){return Object.keys(S)},children:t=>(()=>{var i=p(fe);return i.$$click=()=>G(t),l(i,t),h(r=>F(i,`padding:6px 14px;cursor:pointer;${w().includes(t)?"background:var(--c-primary,#4f46e5);color:#fff;":""}`,r)),R(),i})()})),l(z,()=>s("自定义选项（逗号/顿号/换行分隔）")),m.$$input=t=>q(t.currentTarget.value),l(c,()=>s("当前共"),P,K),l(c,()=>M().length,L,U),l(c,()=>s("个选项"),Y,Z),x.$$click=D,l(x,()=>b()?"🎲 选择中...":"🎲 今天吃什么？"),l(e,$(I,{get when(){return C()},get children(){var t=p(de);return l(t,C),h(i=>F(t,`font-size:24px;text-align:center;padding:20px;${b()?"opacity:0.5;":""}`,i)),t}}),T,te),l(e,$(I,{get when(){return k().length>0},get children(){var t=p(ge),i=t.firstChild,r=i.nextSibling;return l(i,()=>s("历史记录：")),l(r,$(H,{get each(){return k()},children:ae=>(()=>{var A=p(xe);return l(A,ae),A})()})),t}}),le,ie),h(t=>{var i=s("烤鱼, 冒菜, 黄焖鸡..."),r=b();return i!==t.e&&oe(m,"placeholder",t.e=i),r!==t.t&&j(x,"disabled",t.t=r),t},{e:void 0,t:void 0}),h(()=>j(m,"value",_())),R(),e})()}se(["input","click"]);export{_e as default};
