drill.define(async e=>{const t=e=>{let t=/[\d\.]+(.+)/.exec(e);return t?t[1]:""};let a=$(".p_main"),s=await e("data -r"),c=s.mainPage.width,i=s.mainPage.height,r=c>i;if(!r){const e=()=>{let e=$("body").height(),t=$("body").width();t/e>1?a.css({width:c/i*e+"px",height:e+"px",left:(t-c/i*e)/2+"px"}):a.css({width:"",height:"",left:""})};let t;$(window).on("resize",a=>{clearTimeout(t),t=setTimeout(e,300)}),e()}const h=e=>{let{pageData:s,eleData:c}=e,i=$(e);if(s)i.children().each((e,t)=>{h(t)});else if(c){let e=i.find(".p_ele"),s=a.width(),h=a.height();switch(c.target){case"safe":let e=s/h;r&&(e>2?(i.css({left:(s-2*h)/2+"px",width:2*h+"px",height:h+"px"}),s=2*h):e<1?(i.css({top:(h-s)/2+"px",width:s+"px",height:s+"px"}),h=s):i.css({left:"",top:"",width:"",height:""}))}let l,p,o,w,{w:n,h:x,hor:d,ver:b,x:g,y:f}=c;switch(t(n)){case"px":l=parseFloat(n);break;case"%":l=parseFloat(n)/100*s}let F=l/100;switch(t(x)){case"px":p=parseFloat(x);break;case"%":p=parseFloat(x)/100*h;break;case"bw":p=parseFloat(x)*F}switch(d){case"start":o=0;break;case"center":o=(s-l)/2;break;case"end":o=s-l}switch(t(g)){case"px":o+=parseFloat(g);break;case"%":o+=parseFloat(g)/100*s;break;case"bw":o+=parseFloat(g)*F}switch(b){case"start":w=h-p;break;case"center":w=(h-p)/2;break;case"end":w=0}switch(t(f)){case"px":w+=parseFloat(f);break;case"%":w+=parseFloat(f)/100*h;break;case"bw":w+=parseFloat(f)*F}l+="px",p+="px",o+="px",w+="px",e.length&&(e.css({width:l,height:p,left:o,bottom:w}),[["letterSpacing","letterSpacing"],["fontSize","fontSize"]].forEach(a=>{let[s,i]=a,r=c[i];"bw"==t(r)&&(r=(parseFloat(r)*F).toFixed(3)+"px"),e.css(s,r)}),["textAlign"].forEach(t=>{let a=c[t];e.css(t,a)}))}};return{refreshView:h}});