drill.define(async e=>{await e("./p-previewer.css","./pre-ele");let t={runAnime(e,t){switch(t){case 1:case 3:let e=500,i=0;1==t?this.style.animation=`${this.pageIn} ease-in-out .5s`:3==t&&(this.style.animation=`${this.pageOut} ease-in-out .5s`,this.style["animation-direction"]="reverse"),this.style["animation-fill-mode"]="both",this.forEach(t=>{if(t.animateIn){t.$preEle.style.animation=`${t.animateIn} ease-in-out ${t.animateInTime}s`,t.$preEle.style["animation-fill-mode"]="both",t.$preEle.style["animation-delay"]=t.animateInDelay+e/1e3+"s";let a=1e3*t.animateInDelay+1e3*t.animateInTime;a>i&&(i=a)}}),setTimeout(e=>{this.runAnime=!1},i+e+200);break;case 2:case 4:2==t?this.style.animation=`${this.pageOut} ease-in-out .5s`:(this.style.animation=`${this.pageIn} ease-in-out .5s`,this.style["animation-direction"]="reverse"),this.style["animation-fill-mode"]="both",setTimeout(()=>{this.runAnime=!1},700);break;case!1:this.style.animation="",this.style["animation-fill-mode"]="",this.style["animation-direction"]="",this.forEach(e=>{e.$preEle.style.animation="",e.$preEle.style["animation-fill-mode"]="",e.$preEle.style["animation-delay"]=""});break;default:this.runAnime=!1}},"background-image"(e,t){this.style["background-image"]=`url(${t})`}};["background-color","background-position","background-size","background-repeat"].forEach(e=>{t[e]=function(t,i){this.style[e]=i}}),$.register({tag:"pre-page",data:{selected:0,pageIn:"",pageOut:"",thumbnail:""},temp:"\n        <div xv-content></div>\n        ",watch:t,attrs:["selected"],proto:{updateThumbnail(){clearTimeout(this._thumbnail_timer),this._thumbnail_timer=setTimeout(()=>{e("util/getLayerImg.frame").post({html:this.ele.outerHTML}).then(e=>{this.thumbnail=e.b64})},1e3)}},inited(){this.on("mousedown",e=>{let{target:t}=e;if(!t.is("pre-page"))return;let i=this.seek("[selected=1]")[0];if(i){if(i==t)return;i.selected=0}t.selected=1})},attached(){window.process&&(this.thumbnail.length<100&&setTimeout(()=>{this.updateThumbnail()},400*this.hostkey),this.watch(e=>{let t=0;e.modifys.some(e=>{if("selected"!=e.key&&"thumbnail"!=e.key)return t=1,!0}),t&&this.updateThumbnail()}))}}),$.register({tag:"p-previewer",data:{w:"700px",h:"480px"},temp:"\n        <div xv-content></div>\n        ",proto:{addAnimeClass(){this.class.add("changeScreen"),clearTimeout(this._animeTimeout),this._animeTimeout=setTimeout(()=>{this.class.remove("changeScreen")},300)}},watch:{w(e,t){this.style.width=t,this.addAnimeClass(),this.forEach(e=>{e.forEach(e=>e.refreshView())})},h(e,t){this.style.height=t,this.addAnimeClass(),this.forEach(e=>{e.forEach(e=>e.refreshView())})}},inited(e,t){this.on("mousedown",".pre_ele_outer",e=>{let t=e.delegateTarget,i=this.seek("[selected=1]")[0];if(i){if(i==t)return;i.selected=0}t.selected=1}),this.watch("[selected=1]",(e,t)=>{let i=t[0];i&&(i.is("pre-page")||(i=i.parent),this.forEach(e=>{e.display=""}),i.display="block")})}})});