drill.define(async e=>{await e("./pre-size");const{getUnit:t,getUnitPx:i,refreshText:l}=await e("./unit");let{pretextCode:a,prepicCode:o}=await e("./p-temp.dcode -inner");const n=e=>{let{w:a,h:o,x:n,y:s}=e,r=i(e);if(r){let i=t(a);switch(i){case"%":a=parseFloat(a)*r.percentW,a+="px";break;default:r[i]&&(a=parseFloat(a)*r[i],a+="px")}let p=t(o);switch(p){case"%":o=parseFloat(o)*r.percentH,o+="px";break;default:r[p]&&(o=parseFloat(o)*r[p],o+="px")}let c=t(n);switch(c){case"%":n=parseFloat(n)*r.percentW,n+="px";break;default:r[c]&&(n=parseFloat(n)*r[c],n+="px")}let h=t(s);switch(h){case"%":s=parseFloat(s)*r.percentH,s+="px";break;default:r[h]&&(s=parseFloat(s)*r[h],s+="px")}"pre-text"==e.tag&&l(e,{unitObj:r})}e.$preEleCon.style.width=a,e.$preEleCon.style.height=o,e.$preEle.style.left=n,e.$preEle.style.bottom=s};let s={w(e,t){n(this)},h(e,t){n(this)},x(e,t){n(this)},y(e,t){n(this)},"background-image"(e,t){this.$preEle.style["background-image"]=`url(${t})`},runAnime(e,t){t?(this.$preEle.class.add(this.animateIn),this.$preEle.style.animationDuration=this.animateInTime+"s",setTimeout(()=>{this.$preEle.class.remove(this.animateIn),this.$preEle.style.animationDuration="",this.runAnime=!1},1e3*this.animateInTime)):this.animateIn&&this.$preEle.class.remove(this.animateIn)}};["background-color","background-position","background-size","background-repeat"].forEach(e=>{s[e]=function(t,i){this.$preEle.style[e]=i}});let r=e=>{e.class.add("pre_ele_outer"),e.$lockSizeBtn.on("click",t=>{1==e.locksize?e.locksize="":e.locksize=1}),e.$lockBoxBtn.on("click",t=>{1==e.lockbox?e.lockbox="":e.lockbox=1}),e.$lockSizeBtn.on("click",t=>{$.nextTick(()=>{if(e.locksize){let t=i(e),{width:l,height:a,left:o,bottom:n}=getComputedStyle(e.$preEle.ele);l=parseFloat(l),a=parseFloat(a),o=parseFloat(o),n=parseFloat(n),l=(l/t.percentW).toFixed(3)+"%",a=(a/t.percentH).toFixed(3)+"%",o=(o/t.percentW).toFixed(3)+"%",n=(n/t.percentH).toFixed(3)+"%",e.x=o,e.y=n,e.w=l,e.lockbox||(e.h=a)}else{let{width:t,height:i,left:l,bottom:a}=getComputedStyle(e.$preEle.ele);e.x=l,e.y=a,e.w=t,e.lockbox||(e.h=i)}})}),e.$lockBoxBtn.on("click",t=>{$.nextTick(()=>{let t=i(e);if(e.lockbox){if(String(e.h).match(/bw$/))return;let i=(e.$preEle.height/e.$preEle.width*100).toFixed(3);if(e.h=i+"bw","pre-text"==e.tag){let{fontSize:i}=getComputedStyle(e.$xvTextCon.ele);e.fontSize=(parseFloat(i)/t.bw).toFixed(3)+"bw"}}else{let i=e.$preEle.height;if(e.locksize?e.h=i/t.percentH+"%":e.h=i+"px","pre-text"==e.tag){let{fontSize:t}=getComputedStyle(e.$xvTextCon.ele);e.fontSize=parseFloat(t).toFixed(3)+"px"}}})})},p={refreshView(){n(this)}},c={intext(e,t){/\n/.test(t)&&(t=t.replace(/\n/g,"<br>")),this.$xvTextCon.html=t}};["fontSize","lineHeight","letterSpacing"].forEach(e=>{c[e]=function(){l(this)}}),Object.assign(c,s),["color","textAlign","textDecoration","fontWeight","fontStyle"].forEach(e=>{c[e]=function(t,i){this.$xvTextCon.style[e]=i,this.$textInpueEle.style[e]=i}}),$.register({tag:"pre-text",data:{target:"safe",w:"150px",h:"100px",hor:"center",ver:"center",x:0,y:0,animateIn:"",animateOut:"",animateInTime:"",animateOutTime:"",animateInDelay:"",selected:0,intext:"aa",color:"#000",fontSize:"16px",lineHeight:"1.6em",letterSpacing:"0em",textAlign:"left",textDecoration:"none",fontWeight:"normal",fontStyle:"normal",lockbox:"",locksize:""},proto:p,props:["intext"],attrs:["hor","ver","selected","x","y","w","h","lockbox","locksize"],temp:a,watch:c,inited(){r(this),this.$presize.on("dblclick",e=>{this.$textInpueEle.display="",this.$presize.display="none",this.$xvTextCon.display="none",this.$textInpueEle.ele.focus()}),this.$textInpueEle.on("blur",e=>{this.$textInpueEle.display="none",this.$presize.display="",this.$xvTextCon.display=""})}});let h={picUrl(e){let{val:t}=e;this.$imgEle.attr("src",t)}};Object.assign(h,s),$.register({tag:"pre-pic",temp:o,data:{target:"safe",hor:"start",ver:"start",x:"0px",y:"0px",animateIn:"",animateOut:"",animateInTime:"",animateOutTime:"",animateInDelay:"",w:"100px",h:"100px",lockbox:"",locksize:""},proto:p,attrs:["hor","ver","selected","x","y","w","h","lockbox","locksize"],props:["picUrl"],watch:h,inited(){r(this)}})});