drill.define(async e=>{await e("./u-menu.css");let t=()=>{let e=$(".u_menu");e&&e.remove(),$("body").off("click",t),window.removeEventListener("resize",t)},n=e=>{let t=$('\n        <div class="u_menu"></div>\n        ');return e.forEach(e=>{let i;switch(e.type){case"menu":i=$('\n                    <div class="munu_block_opts">\n                        <div class="opt_name">更多选项</div>\n                    </div>');let t=n(e.options);i.push(t);break;default:(i=$(`<div class="munu_block">${e.name}</div>`)).on("click",e.click)}i&&t.push(i)}),t};return e=>{let{options:i,event:l,callback:s,title:a="选项"}=e;t(),$("body").on("click",t),window.addEventListener("resize",t);let o=n(i);o.unshift(`<div class="u_menu_title">${a}</div>`);let c,d,{innerHeight:u,innerWidth:m}=window,r=o.clone();r.style.opacity=0,$("body").push(r),c=r.width,d=r.height,r.remove();let v="u_menu_animate1 ease .3s",_=0,p=0;if(l){let{originalEvent:e}=l;_=e.clientX,p=e.clientY}_+c>m&&(_-=c),p+d>u&&(p-=d,v="u_menu_animate2 ease .3s"),_+2*c>m&&o.class.add("menu_to_left"),p+2*d>u&&o.class.add("menu_to_top"),o.style.left=_+"px",o.style.top=p+"px",o.style.animation=v,o.on("click",".munu_block",e=>{let{delegateTarget:t}=e;s&&s({index:t.hostkey-1,value:t.text})}),$("body").push(o)}});