drill.define(async e=>{await e("./source.css","./source-block");let t=await e("util/uploadSource"),a=await e("common/source"),{tags:c,pics:l}=a,{code:o}=await e("./source.dcode"),n=$(o),i=n.que(".viewer_checked_con"),d=n.que(".fenlei");c.sync(d,null,!0);let r=n.que(".allpics");l.sync(r,null,!0);let u=()=>{i.empty(),a.tags.forEach(e=>{let t="tagid_"+e.tagid;i.push(`\n                <div class="checkbox_block">\n                    <input type="checkbox" name="${e.tagid}" id="${t}"/>\n                    <div class="checkbox_block_name">\n                        <label for="${t}">${e.name}</label>\n                    </div>\n                </div>\n            `)});let e=r.que(".selected");e&&e.tagid.forEach(e=>{i.que(`input[name="${e}"]`).ele.checked=!0})};u(),i.on("change",e=>{let{name:t,checked:a}=e.target.ele,c=r.que(".selected");a?c.tagid.add(t):c.tagid.remove(t)});const g=()=>{let e={all:0,notag:0},t={};r.forEach(a=>{e.all++,a.tagid.length?a.tagid.forEach(t=>{e[t]||(e[t]=0),e[t]++}):e.notag++;let c=/.+\.(.+?$)/.exec(a.path)[1];t[c]?t[c]++:t[c]=1}),d.forEach(t=>{let a=e[t.tagid];t._count=a||0}),n.que('.dirblock[data-tagid="all"]')._count=e.all,n.que('.dirblock[data-tagid="notag"]')._count=e.notag,n.que(".filetypegroup").forEach(e=>{let a=e.tagid.replace(".",""),c=t[a];e._count=c||0}),Object.keys(t).forEach(e=>{let a=t[e],c=n.que(`.dirblock[data-tagid=".${e}"]`);c||((c=$(`<source-tag xv-ele name="${e}" tagid=".${e}"></source-tag>`))._count=a,n.que(".filetypegroup").push(c))})};return setTimeout(()=>{g()},100),a.watch(e=>{u(),g();let t=n.que(".dirs .selected");t&&t.ele.click()}),e("./con_right_tool","./tagInit","./mainInit").post(n),n.que(".pic_con").on("dragover",e=>e.preventDefault()).on("drop",e=>{e.preventDefault();let{originalEvent:a}=e,{dataTransfer:c}=a;if(c){let{files:e}=c;Array.from(e).forEach(e=>{t(e)})}}),n});