var c=(s,e,r)=>new Promise((t,f)=>{var n=i=>{try{a(r.next(i))}catch(h){f(h)}},l=i=>{try{a(r.throw(i))}catch(h){f(h)}},a=i=>i.done?t(i.value):Promise.resolve(i.value).then(n,l);a((r=r.apply(s,e)).next())});function u(s){return s.replace(/[A-Z]/g,e=>"_"+e.toLowerCase()).replace(/^_/,"")}function m(s){let e={};for(let t in s)t.startsWith("on")&&(e[u(t.slice(2))]=s[t],e[t]=s[t]);let r=f=>c(this,[f],function*({data:t}){if(e[t.type])try{let n=yield e[t.type](t.data);if(n!=null&&n.$transfer&&Array.isArray(n.$transfer)){let l=n.$transfer;delete n.$transfer,self.postMessage({type:`${t.type}_result`,key:t.key,data:n},l)}else self.postMessage({type:`${t.type}_result`,key:t.key,data:n})}catch(n){self.postMessage({type:`${t.type}_result`,key:t.key,error:n})}else self.postMessage({type:`${t.type}_result`,key:t.key,error:"no_event"})});return self.addEventListener("message",r),()=>{self.removeEventListener("message",r)}}function d(s,e){return new OffscreenCanvas(s,e)}function k(s){return s.getContext("2d",{willReadFrequently:!0})}function C(s,e,r){s.width=r.width,s.height=r.height,e.font=r.font,e.textBaseline=r.textBaseline,e.lineWidth=r.lineWidth,e.fillStyle=r.fillStyle,e.strokeStyle=r.strokeStyle}m({onGetTextureByTexts({texts:s,options:e,originHeight:r}){let t=d(e.width,e.height),f=k(t);C(t,f,e),f.clearRect(0,0,t.width,t.height);let n=[],l=0,a=0,i={};s.forEach(y=>{let o=Math.ceil(f.measureText(y).width);if(o=o%2===0?o:o+1,o+=2,o+l>e.width&&(l=0,a+=r,r+a>e.height)){let v=f.getImageData(0,0,e.width,a);n.push({data:v.data,offsetMap:i,height:a}),a=0,f.clearRect(0,0,e.width,e.height),i={}}let g=8;e.lineWidth&&f.strokeText(y,2+l,g+a),f.fillText(y,2+l,g+a),i[y]={width:o,height:r,x:l,y:a},l+=o});let h=f.getImageData(0,0,e.width,r+a);return n.push({data:h.data,offsetMap:i,height:a+r}),{data:n,$transfer:n.map(y=>y.data.buffer)}}});
