@next2d/player 2.13.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/next2d.js +1795 -115
  2. package/package.json +35 -25
  3. package/src/index.js +1 -1
package/next2d.js CHANGED
@@ -1,8 +1,8 @@
1
- const es="__next2d__",Ge=Math.min(2,window.devicePixelRatio),Lt=(e,t,u,s=null)=>{const n=+e;return isNaN(n)&&s!==null?s:Math.min(Math.max(t,isNaN(n)?0:n),u)},Mu=document.createElement("canvas");Mu.width=Mu.height=1;const pu=Mu.getContext("2d");let un=null;const Or=e=>{un=e};let sn=null;const Fr=e=>{sn=e},nn=()=>sn,xt=()=>un,ct=new Float32Array([1,0,0,1,0,0]),dt=new Float32Array([1,0,0,1,0,0]),Q={x:0,y:0,pointer:"",hit:null};let rn=null;const Ms=e=>{rn=e},an=()=>rn,Cr=(e,t=1)=>{let u="";u+="-webkit-tap-highlight-color: rgba(0,0,0,0);",u+="backface-visibility: hidden;",u+="touch-action: none;",t>1&&(u+=`transform: scale(${1/t});`),e.width=1,e.height=1,e.setAttribute("style",u)},cn=`(function(){"use strict";let rt=2048;const Pc=t=>{rt=Math.min(4096,t/2)};let Se=4;const Uc=t=>{Se=t};let c;const Dc=t=>{c=t};let A;const Xc=t=>{A=t},Zt=(t,e,s,n=null)=>{const o=+t;return isNaN(o)&&n!==null?n:Math.min(Math.max(e,isNaN(o)?0:o),s)},As=[],be=(...t)=>{const e=As.pop()||[];return t.length&&e.push(...t),e},_c=(t=null)=>{t&&(t.length&&(t.length=0),As.push(t))},$e=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t),xs=[],vs=(t=0,e=0,s=0,n=0)=>{const o=xs.pop()||new Float32Array(4);return o[0]=t,o[1]=e,o[2]=s,o[3]=n,o},Ms=t=>{xs.push(t)},ys=[],we=(t=0,e=0,s=0,n=0,o=0,r=0,a=0,l=0,h=0)=>{const f=ys.pop()||new Float32Array(9);return f[0]=t,f[1]=e,f[2]=s,f[3]=n,f[4]=o,f[5]=r,f[6]=a,f[7]=l,f[8]=h,f},Yc=t=>{ys.push(t)},Rs=[],St=(t=0,e=0,s=0,n=0,o=0,r=0)=>{const a=Rs.pop()||new Float32Array(6);return a[0]=t,a[1]=e,a[2]=s,a[3]=n,a[4]=o,a[5]=r,a},Qt=t=>{Rs.push(t)},Be=t=>{const e=1/(t[0]*t[4]-t[3]*t[1]),s=t[3]*t[7]-t[4]*t[6],n=t[1]*t[6]-t[0]*t[7];return we(t[4]*e,0-t[1]*e,0,0-t[3]*e,t[0]*e,0,s*e,n*e,1)};let gs=0,ps=0;const it=()=>gs,ut=()=>ps,Gc=(t,e)=>{gs=t,ps=e},zc=t=>{const e=-819.2*t[0]-819.2*t[2]+t[4],s=819.2*t[0]-819.2*t[2]+t[4],n=-819.2*t[0]+819.2*t[2]+t[4],o=-819.2*t[1]-819.2*t[3]+t[5],r=819.2*t[1]-819.2*t[3]+t[5],a=-819.2*t[1]+819.2*t[3]+t[5];let l=n-e,h=a-o;const f=Math.sqrt(l*l+h*h);f?(l=l/f,h=h/f):(l=0,h=0);const i=(s-e)*l+(r-o)*h;return vs(e+i*l,o+i*h,s,r)};let Os=1;const Vc=t=>{Os=t},gt=()=>Os,Wc=(t,e)=>{const s=t[0],n=t[1],o=t[2],r=t[3],a=t[4],l=t[5],h=e[0],f=e[1],i=e[2],E=e[3],$=e[4],v=e[5];return St(s*h+o*f,n*h+r*f,s*i+o*E,n*i+r*E,s*$+o*v+a,n*$+r*v+l)},jc=()=>typeof crypto?.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),X=be(),Jt=be(),wt=(t=!1)=>{const e=t?4:10;return X.length<e&&(X.length=0),X.length&&(Jt.push(X.slice(0)),X.length=0),Jt},Hc=()=>{for(X.length=0;Jt.length;)_c(Jt.pop())},Bt=(t,e,s)=>{X.push(t,e,s)},qt=(t,e)=>{const s=X.length,n=+X[s-3],o=+X[s-2];return t===n&&e===o},Kc=(t=!1)=>{const e=t?4:10;if(X.length<e){X.length=0;return}Jt.push(X.slice(0)),X.length=0},Ee=(t,e)=>{if(!X.length){Bt(t,e,!1);return}qt(t,e)||(Kc(),Bt(t,e,!1))},Zc=(t,e)=>{X.length||Ee(t,e),!qt(t,e)&&Bt(t,e,!1)},ms=(t,e,s,n)=>{X.length||Ee(0,0),!qt(s,n)&&(Bt(t,e,!0),Bt(s,n,!1))},Qc=()=>{if(X.length<7)return;const t=+X[0],e=+X[1];qt(t,e)||Bt(t,e,!1)},F=new Float32Array(32),Ie=(t,e,s,n,o,r,a,l,h,f)=>{const i=(t+3*(s+o)+a)*.125,E=(e+3*(n+r)+l)*.125,$=(a+o-s-t)*.125,v=(l+r-n-e)*.125;F[h]=t,F[h+1]=e,F[h+2]=(t+s)*.5,F[h+3]=(e+n)*.5,F[h+4]=i-$,F[h+5]=E-v,F[h+6]=i,F[h+7]=E,F[f]=i,F[f+1]=E,F[f+2]=i+$,F[f+3]=E+v,F[f+4]=(o+a)*.5,F[f+5]=(r+l)*.5,F[f+6]=a,F[f+7]=l},Te=(t,e,s,n,o,r,a,l,h)=>{const f=(t+3*(s+o)+a)*.125,i=(e+3*(n+r)+l)*.125;F[h]=t*.25+s*.75,F[h+1]=e*.25+n*.75,F[h+2]=f,F[h+3]=i,F[h+4]=o*.75+a*.25,F[h+5]=r*.75+l*.25,F[h+6]=a,F[h+7]=l},Jc=(t,e,s,n,o,r,a,l)=>(Ie(t,e,s,n,o,r,a,l,0,16),Ie(F[0],F[1],F[2],F[3],F[4],F[5],F[6],F[7],0,8),Ie(F[16],F[17],F[18],F[19],F[20],F[21],F[22],F[23],16,24),Te(F[0],F[1],F[2],F[3],F[4],F[5],F[6],F[7],0),Te(F[8],F[9],F[10],F[11],F[12],F[13],F[14],F[15],8),Te(F[16],F[17],F[18],F[19],F[20],F[21],F[22],F[23],16),Te(F[24],F[25],F[26],F[27],F[28],F[29],F[30],F[31],24),F),te=(t,e,s,n,o,r)=>{if(X.length||Ee(0,0),qt(o,r))return;const a=X.length,l=+X[a-3],h=+X[a-2],f=Jc(l,h,t,e,s,n,o,r);for(let i=0;32>i;)ms(f[i++],f[i++],f[i++],f[i++])},qc=(t,e,s)=>{const n=s,o=s*.5522847498307936;te(t+n,e+o,t+o,e+n,t,e+n),te(t-o,e+n,t-n,e+o,t-n,e),te(t-n,e-o,t-o,e-n,t,e-n),te(t+o,e-n,t+n,e-o,t+n,e)},tn=(t,e,s,n,o)=>{t.$clearColorR=Zt(e,0,1,0),t.$clearColorG=Zt(s,0,1,0),t.$clearColorB=Zt(n,0,1,0),t.$clearColorA=Zt(o,0,1,0)},en=(t,e,s,n)=>{c.clearColor(t,e,s,n),c.clear(c.COLOR_BUFFER_BIT|c.STENCIL_BUFFER_BIT),c.clearColor(0,0,0,0)},ht=[],Fs=t=>{let e=-1,s=ht.length;for(;Math.abs(s-e)>1;){const n=Math.floor((s+e)/2);t<=ht[n].area?s=n:e=n}return s},sn=t=>{if(ht.indexOf(t)>-1)return;const e=Fs(t.area);t.dirty=!0,ht.splice(e,0,t)},D=t=>{c.deleteTexture(t.resource)},vt=[],cn=t=>{if(!(vt.indexOf(t)>-1)){if(vt.length>10){c.deleteRenderbuffer(t.resource);return}t.dirty=!0,vt.push(t)}},Ce=[];let ft;const nn=t=>{ft=t.createFramebuffer()};let ds=null;const on=t=>{ds=t.createFramebuffer()};let Ae=null;const rn=(t,e)=>{Ae=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,Ae),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e.resource,0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,Ae)};let Ss=null;const ws=t=>{Ss=t},Bs=()=>Ss;let Is=!1;const Le=t=>{Is=t},Cs=()=>Is;let Ls=null,ks=null,Ns=null,Ps=null;const an=t=>{ks=t.createFramebuffer(),Ls=t.createFramebuffer(),Ns=t.createFramebuffer(),Ps=t.createBuffer(),t.bindBuffer(t.PIXEL_PACK_BUFFER,Ps)},ln=()=>Ls,Us=()=>ks,un=()=>Ns,V=(t,e=!0)=>{t.msaa?(sn(t.color),t.color=null,t.stencil=null):(e&&D(t.texture),t.texture=null,cn(t.stencil),t.stencil=null),Ce.push(t)};let hn=0;const fn=()=>({id:hn++,width:0,height:0,clipLevel:0,msaa:!1,mask:!1,color:null,texture:null,stencil:null}),bn=()=>{const t={id:0,resource:c.createRenderbuffer(),width:0,height:0,area:0,dirty:!1};return{resource:c.createRenderbuffer(),stencil:t,width:0,height:0,area:0,dirty:!1}},$n=t=>{if(!ht.length)return bn();const e=Fs(t);if(e<ht.length){const n=ht[e];return ht.splice(e,1),n}const s=ht.shift();if(!s)throw new Error("the color buffer is void.");return s},En=(t,e)=>{t=Math.max(256,$e(t)),e=Math.max(256,$e(e));const s=$n(t*e);return(s.width<t||s.height<e)&&(t=Math.max(t,s.width),e=Math.max(e,s.height),s.width=t,s.height=e,s.area=t*e,c.bindRenderbuffer(c.RENDERBUFFER,s.resource),c.renderbufferStorageMultisample(c.RENDERBUFFER,Se,c.RGBA8,t,e),c.bindRenderbuffer(c.RENDERBUFFER,s.stencil.resource),c.renderbufferStorageMultisample(c.RENDERBUFFER,Se,c.STENCIL_INDEX8,t,e)),s.dirty=!0,s};let Tn=0;const An=()=>({id:Tn++,resource:c.createRenderbuffer(),width:0,height:0,area:0,dirty:!1}),xn=(t,e)=>{if(!vt.length)return An();for(let s=0;s<vt.length;++s){const n=vt[s];if(!(n.width!==t||n.height!==e))return vt.splice(s,1),n}return vt.shift()},vn=(t,e)=>{const s=xn(t,e);return(s.width!==t||s.height!==e)&&(s.width=t,s.height=e,s.area=t*e,s.dirty=!1,c.bindRenderbuffer(c.RENDERBUFFER,s.resource),c.renderbufferStorage(c.RENDERBUFFER,c.STENCIL_INDEX8,t,e)),s};let Mn=0;const Ds=(t,e)=>({id:Mn++,resource:c.createTexture(),width:t,height:e,area:t*e,smooth:!1});let It=-1;const Xs=t=>{It=t},ke=[null,null,null],yn=(t,e=!1)=>{It!==c.TEXTURE0&&(Xs(c.TEXTURE0),c.activeTexture(c.TEXTURE0)),ke[0]=t,c.bindTexture(c.TEXTURE_2D,t.resource),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,e?c.LINEAR:c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,e?c.LINEAR:c.NEAREST),c.texStorage2D(c.TEXTURE_2D,1,c.RGBA8,t.width,t.height)},ee=(t,e,s=!1)=>{const n=Ds(t,e);return yn(n,s),n},W=(t,e,s=!1)=>{const n=Ce.length?Ce.shift():fn();return n.width=t,n.height=e,s?(n.msaa=!0,n.texture=null,n.color=En(t,e),n.stencil=n.color.stencil):(n.msaa=!1,n.texture=ee(t,e),n.color=null,n.stencil=vn(t,e)),n.mask=!1,n.clipLevel=0,n},Rn=()=>{ws(null),Cs()&&(Le(!1),c.bindFramebuffer(c.FRAMEBUFFER,null))},gn=()=>{const t=Ds(rt,rt);return c.activeTexture(c.TEXTURE3),c.bindTexture(c.TEXTURE_2D,t.resource),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,c.CLAMP_TO_EDGE),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,c.LINEAR),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,c.NEAREST),c.texStorage2D(c.TEXTURE_2D,1,c.RGBA8,t.width,t.height),c.activeTexture(It!==-1?It:c.TEXTURE0),t},Ct=Number.MAX_VALUE,Lt=-Number.MAX_VALUE;let se=0;const pt=t=>{se=t},kt=()=>se,xe=[],pn=()=>xe,On=t=>{xe[se]=t},mn=()=>(se in xe||On(W(rt,rt,!0)),xe[se]),ce=[];let Ne=null;const _s=()=>(Ne||(Ne=gn()),Ne),ne=[],Ys=t=>(t in ne||(ne[t]=new Float32Array([Ct,Ct,Lt,Lt])),ne[t]),oe=[],Gs=t=>(t in oe||(oe[t]=new Float32Array([Ct,Ct,Lt,Lt])),oe[t]),Fn=()=>{for(let t=0;t<ne.length;++t){const e=ne[t];e&&(e[0]=e[1]=Ct,e[2]=e[3]=Lt)}for(let t=0;t<oe.length;++t){const e=oe[t];e&&(e[0]=e[1]=Ct,e[2]=e[3]=Lt)}};let zs=0;const Vs=t=>{zs=t},Ws=()=>zs,dn=()=>{ce.length=0,pt(0);const t=pn();for(let e=0;e<t.length;e++)V(t[e]);t.length=0},Sn=(t,e,s,n=!0)=>{if(t.clearArraysInstanced(),t.$stackAttachmentObject.length)for(let o=0;o<t.$stackAttachmentObject.length;++o){const r=t.$stackAttachmentObject[o];r&&V(r)}else t.$mainAttachmentObject&&V(t.$mainAttachmentObject);n&&dn(),Rn(),t.$mainAttachmentObject=W(e,s,!0),t.bind(t.$mainAttachmentObject)},wn=(t,e,s,n)=>{c.enable(c.SCISSOR_TEST),c.scissor(t,e,s,n),c.clear(c.COLOR_BUFFER_BIT|c.STENCIL_BUFFER_BIT),c.disable(c.SCISSOR_TEST)},st=(t,e,s=null,n=!1)=>{(It===-1||e!==It)&&(Xs(e),c.activeTexture(e));const o=ke[t];o!==null&&s!==null&&o.id===s.id||s===o||(ke[t]=s,c.bindTexture(c.TEXTURE_2D,s?s.resource:null),s&&s.smooth!==n&&(s.smooth=n,c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,n?c.LINEAR:c.NEAREST),c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,n?c.LINEAR:c.NEAREST)))},z=(t,e=!1)=>{st(2,c.TEXTURE2,null),st(1,c.TEXTURE1,null),st(0,c.TEXTURE0,t,e)},Bn=t=>{ws(t),Cs()||(Le(!0),c.bindFramebuffer(c.FRAMEBUFFER,ft)),t.msaa?(c.bindRenderbuffer(c.RENDERBUFFER,t.color.resource),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.RENDERBUFFER,t.color.resource)):(z(t.texture),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,t.texture.resource,0)),c.bindRenderbuffer(c.RENDERBUFFER,t.stencil.resource),c.framebufferRenderbuffer(c.FRAMEBUFFER,c.STENCIL_ATTACHMENT,c.RENDERBUFFER,t.stencil.resource)},Pe=()=>{const t=A.currentAttachmentObject;if(!t)return;const e=t.clipLevel;let s=0;for(let n=0;n<e;++n)s|=(1<<e-n)-1;c.stencilMask(255),c.stencilFunc(c.EQUAL,s&255,s),c.stencilOp(c.KEEP,c.KEEP,c.KEEP),c.colorMask(!0,!0,!0,!0),c.disable(c.SAMPLE_ALPHA_TO_COVERAGE),c.disable(c.SCISSOR_TEST)};let js=!1;const ve=t=>{js=t},Ue=()=>js,re=new Map,ae=new Map,In=t=>{!t&&Ue()?(ve(!1),c.disable(c.STENCIL_TEST),c.disable(c.SCISSOR_TEST)):t&&!Ue()&&(ve(!0),c.enable(c.STENCIL_TEST),Pe())},Cn=(t,e)=>{const s=Bs();if(s&&e.id===s.id)return;Bn(e),(!s||s.width!==e.width||s.height!==e.height)&&(Gc(e.width,e.height),c.viewport(0,0,e.width,e.height));const n=e.msaa?e.color:e.stencil;n.dirty&&(n.dirty=!1,t.clearRect(0,0,e.width,e.height)),In(e.mask)},Ln=t=>{t.$stack.push(we(...t.$matrix))},kn=t=>{if(!t.$stack.length)return;const e=t.$stack.pop();t.$matrix[0]=e[0],t.$matrix[1]=e[1],t.$matrix[3]=e[3],t.$matrix[4]=e[4],t.$matrix[6]=e[6],t.$matrix[7]=e[7],Yc(e)},Nn=(t,e,s,n,o,r,a)=>{t[0]=e,t[1]=s,t[3]=n,t[4]=o,t[6]=r,t[7]=a},Pn=(t,e,s,n,o,r,a)=>{const l=t.$matrix[0],h=t.$matrix[1],f=t.$matrix[3],i=t.$matrix[4],E=t.$matrix[6],$=t.$matrix[7];t.$matrix[0]=e*l+s*f,t.$matrix[1]=e*h+s*i,t.$matrix[3]=n*l+o*f,t.$matrix[4]=n*h+o*i,t.$matrix[6]=r*l+a*f+E,t.$matrix[7]=r*h+a*i+$},Un=t=>{t.globalAlpha=1,t.globalCompositeOperation="normal",t.imageSmoothingEnabled=!1},Dn=t=>{t.$fillStyle.fill(1),t.$strokeStyle.fill(1)},Xn=(t,e,s,n)=>{c.enable(c.SCISSOR_TEST),c.scissor(t,e,s+1,n+1),c.clear(c.COLOR_BUFFER_BIT|c.STENCIL_BUFFER_BIT),c.scissor(t,e,s,n)},_n=()=>{c.disable(c.SCISSOR_TEST)},Yn=(t,e,s,n,o,r,a,l,h,f,i,E,$)=>{const v=t.length-5;for(let T=3;T<v;T+=3){let u=s*17;t[T+2]?(e[u++]=t[T-3],e[u++]=t[T-2],e[u++]=0,e[u++]=0,e[u++]=f,e[u++]=i,e[u++]=E,e[u++]=$,e[u++]=n,e[u++]=o,e[u++]=0,e[u++]=r,e[u++]=a,e[u++]=0,e[u++]=l,e[u++]=h,e[u++]=0,e[u++]=t[T],e[u++]=t[T+1],e[u++]=.5,e[u++]=0,e[u++]=f,e[u++]=i,e[u++]=E,e[u++]=$,e[u++]=n,e[u++]=o,e[u++]=0,e[u++]=r,e[u++]=a,e[u++]=0,e[u++]=l,e[u++]=h,e[u++]=0,e[u++]=t[T+3],e[u++]=t[T+4],e[u++]=1,e[u++]=1,e[u++]=f,e[u++]=i,e[u++]=E,e[u++]=$,e[u++]=n,e[u++]=o,e[u++]=0,e[u++]=r,e[u++]=a,e[u++]=0,e[u++]=l,e[u++]=h,e[u++]=0):t[T+5]?(e[u++]=t[0],e[u++]=t[1],e[u++]=.5,e[u++]=.5,e[u++]=f,e[u++]=i,e[u++]=E,e[u++]=$,e[u++]=n,e[u++]=o,e[u++]=0,e[u++]=r,e[u++]=a,e[u++]=0,e[u++]=l,e[u++]=h,e[u++]=0,e[u++]=t[T],e[u++]=t[T+1],e[u++]=.5,e[u++]=.5,e[u++]=f,e[u++]=i,e[u++]=E,e[u++]=$,e[u++]=n,e[u++]=o,e[u++]=0,e[u++]=r,e[u++]=a,e[u++]=0,e[u++]=l,e[u++]=h,e[u++]=0,e[u++]=t[T+6],e[u++]=t[T+7],e[u++]=.5,e[u++]=.5,e[u++]=f,e[u++]=i,e[u++]=E,e[u++]=$,e[u++]=n,e[u++]=o,e[u++]=0,e[u++]=r,e[u++]=a,e[u++]=0,e[u++]=l,e[u++]=h,e[u++]=0):(e[u++]=t[0],e[u++]=t[1],e[u++]=.5,e[u++]=.5,e[u++]=f,e[u++]=i,e[u++]=E,e[u++]=$,e[u++]=n,e[u++]=o,e[u++]=0,e[u++]=r,e[u++]=a,e[u++]=0,e[u++]=l,e[u++]=h,e[u++]=0,e[u++]=t[T],e[u++]=t[T+1],e[u++]=.5,e[u++]=.5,e[u++]=f,e[u++]=i,e[u++]=E,e[u++]=$,e[u++]=n,e[u++]=o,e[u++]=0,e[u++]=r,e[u++]=a,e[u++]=0,e[u++]=l,e[u++]=h,e[u++]=0,e[u++]=t[T+3],e[u++]=t[T+4],e[u++]=.5,e[u++]=.5,e[u++]=f,e[u++]=i,e[u++]=E,e[u++]=$,e[u++]=n,e[u++]=o,e[u++]=0,e[u++]=r,e[u++]=a,e[u++]=0,e[u++]=l,e[u++]=h,e[u++]=0),s+=3}return s},Me=(t,e="fill")=>{const s=e==="fill"?A.$fillStyle:A.$strokeStyle,n=s[0],o=s[1],r=s[2],a=s[3],l=A.$matrix,h=it(),f=ut(),i=l[0]/h,E=l[3]/h,$=l[6]/h,v=l[1]/f,T=l[4]/f,u=l[7]/f;let g=0;for(let C=0;C<t.length;++C)g+=(t[C].length/3-2)*51;const I=new Float32Array(g);let d=0;for(let C=0;C<t.length;++C)d=Yn(t[C],I,d,i,v,E,T,$,u,n,o,r,a);return{buffer:I,indexCount:d}},Gn=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t);let le=new Float32Array(128),Nt=0;const zn=()=>le,Vn=()=>Nt,Pt=t=>{const e=t.length+Nt;if(e>le.length){const s=new Float32Array(Gn(e));s.set(le),s.set(t,Nt),le=s}else le.set(t,Nt);Nt+=t.length},q=[],bt=[],Hs=()=>{bt.length=0,Nt=0,q.length=0},Wn=t=>{const e=wt();if(!e.length)return;bt.push(t);const s=Me(e);Pt(s.buffer),q.push(s.indexCount)},tt=[],jn=(t,e,s,n,o,r)=>{const a=wt();if(!a.length)return;bt.push(t===0?"linear":"radial");const l=Me(a);Pt(l.buffer),q.push(l.indexCount),tt.push(e,s,n,o),t===1&&tt.push(r)},Hn=(t,e,s)=>{const n=Math.sqrt(t*t+e*e);return{x:-(e/n)*s,y:t/n*s}},Kn=(t,e,s)=>{const n={x:e.x-t.x,y:e.y-t.y},o=Hn(n.x,n.y,s),r={x:t.x+o.x,y:t.y+o.y},a={x:e.x+o.x,y:e.y+o.y},l={x:t.x-o.x,y:t.y-o.y},h={x:e.x-o.x,y:e.y-o.y};return[r.x,r.y,!1,a.x,a.y,!1,h.x,h.y,!1,l.x,l.y,!1,r.x,r.y,!1]},De=(t,e,s)=>({x:t.x+(e.x-t.x)*s,y:t.y+(e.y-t.y)*s}),Zn=(t,e,s,n=.5)=>{const o=De(t,e,n),r=De(e,s,n),a=De(o,r,n);return[[t,o,a],[a,r,s]]},Qn=(t,e,s,n=4)=>{let o=[[t,e,s]];for(let r=0;r<n;++r){const a=[];for(let l=0;l<o.length;++l){const h=o[l];if(!h)continue;const f=Zn(h[0],h[1],h[2],.5);a.push(f[0],f[1])}o=a}return o},Jn=(t,e,s,n)=>({x:(1-t)**2*e.x+2*(1-t)*t*s.x+t**2*n.x,y:(1-t)**2*e.y+2*(1-t)*t*s.y+t**2*n.y}),qn=(t,e,s,n)=>({x:2*(1-t)*(s.x-e.x)+2*t*(n.x-s.x),y:2*(1-t)*(s.y-e.y)+2*t*(n.y-s.y)}),to=t=>{const e=Math.sqrt(t.x*t.x+t.y*t.y);return e===0?{x:0,y:0}:{x:t.x/e,y:t.y/e}},Ks=(t,e,s,n)=>{const o=[0,.5,1],r=[];for(let a=0;a<o.length;++a){const l=o[a],h=Jn(l,t,e,s),f=qn(l,t,e,s),i=to({x:-f.y,y:f.x});r.push({x:h.x+i.x*n,y:h.y+i.y*n})}return r},eo=(t,e,s,n)=>{const o=Qn(t,e,s,5),r=[],a=[];for(let E=0;E<o.length;++E){const[$,v,T]=o[E];r.push(Ks($,v,T,+n)),a.push(Ks($,v,T,-n))}const l=r[0][0],h=[l.x,l.y,!1];for(let E=0;E<r.length;++E){const $=r[E];h.push($[1].x,$[1].y,!0,$[2].x,$[2].y,!1)}const f=[...a].reverse();for(let E=0;E<f.length;++E){const[$,v,T]=f[E];f[E]=[T,v,$]}const i=f[0][0];h.push(i.x,i.y,!1);for(let E=0;E<f.length;++E){const $=f[E];h.push($[1].x,$[1].y,!0,$[2].x,$[2].y,!1)}return h},Ut=(t,e,s,n)=>{const o=[];for(let r=0;r<n.length;r+=3){if(n[r+2])continue;const a=n[r],l=n[r+1];Math.sqrt(Math.pow(a-t,2)+Math.pow(l-e,2))===s&&o.push(a,l)}return o},Dt=new OffscreenCanvas(1,1).getContext("2d"),Xt=(t,e)=>{Dt.beginPath(),Dt.moveTo(e[0],e[1]);for(let s=3;s<e.length;s+=3)e[s+2]?(Dt.quadraticCurveTo(e[s],e[s+1],e[s+3],e[s+4]),s+=3):Dt.lineTo(e[s],e[s+1]);Dt.closePath();for(let s=0;s<t.length;s+=2){const n=t[s],o=t[s+1];if(!Dt.isPointInPath(n,o))return[n,o]}return null},Zs=(t,e,s,n,o=!1)=>{const r=o?0:n.length-1,a=o?n.length-1:n.length-2,l=Ut(t,e,s,n[r]),h=Ut(t,e,s,n[a]),f=Xt(l,n[a]);if(!f)return;const i=Xt(h,n[r]);if(!i)return;const E=Math.atan2(f[1]-e,f[0]-t);let v=Math.atan2(i[1]-e,i[0]-t)-E;v>Math.PI?v-=2*Math.PI:v<-Math.PI&&(v+=2*Math.PI);const T=8,u=v/T,g=[t,e,!1];for(let I=0;I<=T;I++){const d=E+I*u,C=t+s*Math.cos(d),m=e+s*Math.sin(d);g.push(C,m,!1)}n.splice(-1,0,g)},Qs=(t,e,s,n,o=!1)=>{const r=o?0:n.length-1,a=o?n.length-1:n.length-2,l=Ut(t,e,s,n[r]),h=Ut(t,e,s,n[a]);if(l[0]===h[0]&&l[1]===h[1]||l[0]===h[2]&&l[1]===h[3])return;const f=Xt(l,n[a]);if(!f)return;const i=Xt(h,n[r]);i&&n.splice(-1,0,[t,e,!1,f[0],f[1],!1,i[0],i[1],!1,t,e,!1])},so=(t,e,s)=>{for(let n=0;n<2;++n){let o=0,r=0,a=0,l=0;n===0?(o=t[0],r=t[1],a=t[3],l=t[4]):(o=t[t.length-3],r=t[t.length-2],a=t[t.length-6],l=t[t.length-5]);const h=a-o,f=l-r,i=Math.atan2(f,h),E=i+Math.PI/2,$=i-Math.PI/2,v=16,T=($-E)/v,u=[];for(let g=0;g<=v;g++){const I=$+T*g,d=o+e*Math.cos(I),C=r+e*Math.sin(I);u.push(d,C,!1)}n===0?s.unshift(u):s.push(u)}},co=(t,e,s)=>{for(let n=0;n<2;++n){let o=0,r=0,a=0,l=0;n===0?(o=t[0],r=t[1],a=t[3],l=t[4]):(o=t[t.length-3],r=t[t.length-2],a=t[t.length-6],l=t[t.length-5]);const h=-(a-o),f=-(l-r),i=Math.sqrt(h*h+f*f);if(i===0)continue;const E=h/i,$=f/i,v=o+e*E,T=r+e*$,u=-$,g=E,I=[v+e*E+e*u,T+e*$+e*g,!1,v+e*E-e*u,T+e*$-e*g,!1,v-e*E-e*u,T-e*$-e*g,!1,v+e*E+e*u,T+e*$+e*g,!1,v-e*E-e*u,T-e*$-e*g,!1,v-e*E+e*u,T-e*$+e*g,!1];n===0?s.unshift(I):s.push(I)}},Js=(t,e,s,n,o,r=!1)=>{const a=r?0:o.length-1,l=r?o.length-1:o.length-2,h=Ut(t.x,t.y,n,o[a]),f=Ut(t.x,t.y,n,o[l]);if(h[0]===f[0]&&h[1]===f[1]||h[0]===f[2]&&h[1]===f[3])return;const i=Xt(h,o[l]);if(!i)return;const E=Xt(f,o[a]);if(!E)return;const $=e.x-t.x,v=e.y-t.y,T=Math.hypot($,v),u={x:$/T,y:v/T},g=s.x-t.x,I=s.y-t.y,d=Math.hypot(g,I),C={x:g/d,y:I/d},m=u.x,y=u.y,M=C.x,S=C.y,w=m*S-y*M;w===0&&o.splice(-1,0,[t.x,t.y,!1,i[0],i[1],!1,E[0],E[1],!1]);const O=((E[0]-i[0])*S-(E[1]-i[1])*M)/w,p=i[0]+O*m,R=i[1]+O*y;o.splice(-1,0,[t.x,t.y,!1,i[0],i[1],!1,p,R,!1,t.x,t.y,!1,E[0],E[1],!1,p,R,!1])},no=(t,e)=>{const s={x:t[0],y:t[1]},n={x:0,y:0},o={x:0,y:0},r={x:0,y:0},a=[];for(let l=3;l<t.length;l+=3){const h=t[l],f=t[l+1];if(t[l+2]){n.x=h,n.y=f;continue}if(o.x=h,o.y=f,t[l-1]?a.push(eo(s,n,o,e)):a.push(Kn(s,o,e)),a.length>1)switch(A.joints){case 0:Qs(s.x,s.y,e,a);break;case 1:r.x=t[l-6],r.y=t[l-5],Js(s,o,r,e,a);break;case 2:Zs(s.x,s.y,e,a);break}s.x=o.x,s.y=o.y}if(t[0]===t[t.length-3]&&t[1]===t[t.length-2])switch(A.joints){case 0:Qs(s.x,s.y,e,a,!0);break;case 1:s.x=t[0],s.y=t[1],o.x=t[3],o.y=t[4],r.x=t[t.length-6],r.y=t[t.length-5],Js(s,o,r,e,a,!0);break;case 2:Zs(s.x,s.y,e,a,!0);break}else switch(A.caps){case 1:so(t,e,a);break;case 2:co(t,e,a);break}return a},Xe=t=>{const e=A.thickness/2,s=[];for(let n=0;n<t.length;++n){const o=no(t[n],e);s.push(...o)}return Me(s,"stroke")},oo=(t,e,s,n,o,r)=>{const a=wt();if(!a.length)return;bt.push(t===0?"linear":"radial");const l=Xe(a);Pt(l.buffer),q.push(l.indexCount),tt.push(e,s,n,o),t===1&&tt.push(r)},_t=new Map,qs=()=>{_t.clear()},ro=t=>{_t.set(q.length,t)},ye=()=>({id:jc(),resource:c.createVertexArray(),vertexBuffer:c.createBuffer(),vertexLength:0});let _e;const $t=t=>{_e&&_e.id===t.id||(_e=t,c.bindVertexArray(t.resource))},ao=()=>{const t=ye();$t(t),c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer);const e=new Float32Array([0,0,1,0,1,1,0,0,1,1,0,1]);return c.bufferData(c.ARRAY_BUFFER,e,c.STATIC_DRAW),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,c.FLOAT,!1,0,0),t},Re=[],ct=new Float32Array([0,0,0,1,1,0,1,1]);let Ye;const lo=t=>{Ye=t.createBuffer()};let tc;const io=t=>{tc=t};let Ge;const ge=()=>(Ge||(Ge=ao()),Ge),uo=()=>{if(Re.length)return Re.pop();const t=ye();return $t(t),c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer),c.enableVertexAttribArray(0),c.enableVertexAttribArray(1),c.enableVertexAttribArray(2),c.enableVertexAttribArray(3),c.enableVertexAttribArray(4),c.enableVertexAttribArray(5),c.vertexAttribPointer(0,2,c.FLOAT,!1,68,0),c.vertexAttribPointer(1,2,c.FLOAT,!1,68,8),c.vertexAttribPointer(2,4,c.FLOAT,!1,68,16),c.vertexAttribPointer(3,3,c.FLOAT,!1,68,32),c.vertexAttribPointer(4,3,c.FLOAT,!1,68,44),c.vertexAttribPointer(5,3,c.FLOAT,!1,68,56),t},ec=()=>{const t=uo();$t(t);const e=zn(),s=Vn();return c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer),t.vertexLength<e.length&&(t.vertexLength=$e(e.length),c.bufferData(c.ARRAY_BUFFER,t.vertexLength*4,c.DYNAMIC_DRAW)),c.bufferSubData(c.ARRAY_BUFFER,0,e.subarray(0,s)),t},sc=t=>{Re.indexOf(t)>-1||Re.push(t)};let ho=0;const fo=(t,e)=>{const s=c.createProgram(),n=c.createShader(c.VERTEX_SHADER);c.shaderSource(n,t),c.compileShader(n);const o=c.createShader(c.FRAGMENT_SHADER);return c.shaderSource(o,e),c.compileShader(o),c.attachShader(s,n),c.attachShader(s,o),c.linkProgram(s),c.detachShader(s,n),c.detachShader(s,o),c.deleteShader(n),c.deleteShader(o),{id:ho++,resource:s}},bo=(t,e,s=!1)=>{const n=c.getProgramParameter(t,c.ACTIVE_UNIFORMS);for(let o=0;o<n;++o){const r=c.getActiveUniform(t,o),a=r.name.endsWith("[0]")?r.name.slice(0,-3):r.name,l=c.getUniformLocation(t,a);if(r.type===c.SAMPLER_2D&&r.size===1&&!s)continue;const h={};switch(r.type){case c.FLOAT_VEC4:h.method=c.uniform4fv.bind(c,l),h.array=new Float32Array(4*r.size),h.assign=-1;break;case c.INT_VEC4:h.method=c.uniform4iv.bind(c,l),h.array=new Int32Array(4*r.size),h.assign=-1;break;case c.SAMPLER_2D:h.method=s?c.uniform1i.bind(c,l,3):c.uniform1iv.bind(c,l),h.array=new Int32Array(r.size),h.assign=1;break;case c.FLOAT:case c.FLOAT_VEC2:case c.FLOAT_VEC3:case c.FLOAT_MAT2:case c.FLOAT_MAT3:case c.FLOAT_MAT4:case c.INT:case c.INT_VEC2:case c.INT_VEC3:default:throw new Error("Use gl.FLOAT_VEC4 or gl.INT_VEC4 instead")}e.set(a,h)}};let cc=-1;const $o=t=>{cc!==t.id&&(cc=t.id,c.useProgram(t.resource))},Eo=t=>{for(const e of t.values())e.method===void 0||e.assign===void 0||(e.assign<0?e.method(e.array):e.assign>0&&(e.assign--,e.method(e.array)))};class Z{_$programObject;_$uniformMap;constructor(e,s,n=!1){this._$programObject=fo(e,s),this._$uniformMap=new Map,bo(this._$programObject.resource,this._$uniformMap,n)}useProgram(){$o(this._$programObject)}bindUniform(){Eo(this._$uniformMap)}get highp(){return this._$uniformMap.get("u_highp").array}get mediump(){return this._$uniformMap.get("u_mediump").array}get textures(){return this._$uniformMap.get("u_textures").array}}const Et=new Map,To=()=>\`
1
+ const on="__next2d__",Ze=Math.min(2,window.devicePixelRatio),Vt=(e,t,r,n=null)=>{const i=+e;return isNaN(i)&&n!==null?n:Math.min(Math.max(t,isNaN(i)?0:i),r)},Er=document.createElement("canvas");Er.width=Er.height=1;const Tr=Er.getContext("2d");let ci=null;const _s=e=>{ci=e};let li=null;const Ds=e=>{li=e},ui=()=>li,vt=()=>ci,ft=new Float32Array([1,0,0,1,0,0]),gt=new Float32Array([1,0,0,1,0,0]),ie={x:0,y:0,pointer:"",hit:null};let hi=null;const Cn=e=>{hi=e},fi=()=>hi,Ls=(e,t=1)=>{let r="";r+="-webkit-tap-highlight-color: rgba(0,0,0,0);",r+="backface-visibility: hidden;",r+="touch-action: none;",r+="user-select: none;",r+="-webkit-user-select: none;",r+="-webkit-touch-callout: none;",t>1&&(r+=`transform: scale(${1/t});`),e.width=1,e.height=1,e.setAttribute("style",r)},di=`(function(){"use strict";let ut=2048;const Xc=t=>{ut=Math.max(2048,t/2)};let bs=4;const Yc=t=>{bs=t};let p;const Wc=t=>{p=t};let O;const jc=t=>{O=t};let Pn=!1;const It=()=>{Pn||(Pn=!0,p.enable(p.SCISSOR_TEST))},yt=()=>{Pn&&(Pn=!1,p.disable(p.SCISSOR_TEST))};let An=!1;const Yr=()=>{An||(An=!0,p.enable(p.STENCIL_TEST))},Wr=()=>{An&&(An=!1,p.disable(p.STENCIL_TEST))},jr=(t,e,r,n=null)=>{const s=+t;return isNaN(s)&&n!==null?n:Math.min(Math.max(e,isNaN(s)?0:s),r)},li=[],Hr=(...t)=>{const e=li.pop()||[];return t.length&&e.push(...t),e},ui=(t=null)=>{t&&(t.length&&(t.length=0),li.push(t))},Fn=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t),fi=[],hi=(t=0,e=0,r=0,n=0)=>{const s=fi.pop()||new Float32Array(4);return s[0]=t,s[1]=e,s[2]=r,s[3]=n,s},di=t=>{fi.push(t)},pi=[],xs=(t=0,e=0,r=0,n=0,s=0,o=0,i=0,l=0,c=0)=>{const u=pi.pop()||new Float32Array(9);return u[0]=t,u[1]=e,u[2]=r,u[3]=n,u[4]=s,u[5]=o,u[6]=i,u[7]=l,u[8]=c,u},Hc=t=>{pi.push(t)},mi=[],dr=(t=0,e=0,r=0,n=0,s=0,o=0)=>{const i=mi.pop()||new Float32Array(6);return i[0]=t,i[1]=e,i[2]=r,i[3]=n,i[4]=s,i[5]=o,i},Kr=t=>{mi.push(t)},ys=t=>{const e=1/(t[0]*t[4]-t[3]*t[1]),r=t[3]*t[7]-t[4]*t[6],n=t[1]*t[6]-t[0]*t[7];return xs(t[4]*e,0-t[1]*e,0,0-t[3]*e,t[0]*e,0,r*e,n*e,1)};let pt=0,mt=0;const Kc=(t,e)=>{pt=t,mt=e},qc=t=>{const e=-819.2*t[0]-819.2*t[2]+t[4],r=819.2*t[0]-819.2*t[2]+t[4],n=-819.2*t[0]+819.2*t[2]+t[4],s=-819.2*t[1]-819.2*t[3]+t[5],o=819.2*t[1]-819.2*t[3]+t[5],i=-819.2*t[1]+819.2*t[3]+t[5];let l=n-e,c=i-s;const u=Math.sqrt(l*l+c*c);u?(l=l/u,c=c/u):(l=0,c=0);const a=(r-e)*l+(o-s)*c;return hi(e+a*l,s+a*c,r,o)};let vt=1;const Qc=t=>{vt=t},Zc=(t,e)=>{const r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],l=t[5],c=e[0],u=e[1],a=e[2],h=e[3],d=e[4],g=e[5];return dr(r*c+s*u,n*c+o*u,r*a+s*h,n*a+o*h,r*d+s*g+i,n*d+o*g+l)},Jc=()=>typeof crypto?.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)}),me=Hr(),Kt=Hr(),pr=(t=!1)=>{const e=t?6:9;me.length>=e&&Kt.push(me.slice(0)),me.length=0;const r=[];for(let n=0;n<Kt.length;n++){const s=Kt[n];s.length>=e&&r.push(s)}return Kt.length=0,r},el=()=>{for(me.length=0;Kt.length;)ui(Kt.pop())},mr=(t,e,r)=>{me.push(t,e,r)},qr=(t,e)=>{const r=me.length,n=+me[r-3],s=+me[r-2];return t===n&&e===s},tl=()=>{if(me.length<3){me.length=0;return}Kt.push(me.slice(0)),me.length=0},wn=(t,e)=>{if(!me.length){mr(t,e,!1);return}qr(t,e)||(tl(),mr(t,e,!1))},rl=(t,e)=>{me.length||wn(t,e),!qr(t,e)&&mr(t,e,!1)},gi=(t,e,r,n)=>{me.length||wn(0,0),!qr(r,n)&&(mr(t,e,!0),mr(r,n,!1))},nl=()=>{if(me.length<7)return;const t=+me[0],e=+me[1];qr(t,e)||mr(t,e,!1)};let Re=new Float32Array(64),bi=0;const vs=.5,Ms=2,sl=8,ol=(t,e,r,n,s,o,i,l)=>{const c=3*r-2*t-i,u=3*n-2*e-l,a=3*s-2*i-t,h=3*o-2*l-e;return Math.max(c*c+u*u,a*a+h*h)},il=(t,e,r,n,s,o,i,l)=>{const c=ol(t,e,r,n,s,o,i,l);if(c<vs*vs)return Ms;const u=Math.ceil(Math.log2(Math.sqrt(c)/vs)/2);return Math.min(Math.max(u+Ms,Ms),sl)},al=t=>{Re.length<t&&(Re=new Float32Array(t*2))},cl=t=>{bi=t},Ss=[];let $s=0;const xi=()=>{$s=0},Se=()=>($s>=Ss.length&&Ss.push(new Float32Array(8)),Ss[$s++]),ft=(t,e,r,n,s,o,i,l,c,u,a)=>{const h=1-c,d=h*t+c*r,g=h*e+c*n,m=h*r+c*s,f=h*n+c*o,b=h*s+c*i,x=h*o+c*l,y=h*d+c*m,P=h*g+c*f,S=h*m+c*b,M=h*f+c*x,$=h*y+c*S,T=h*P+c*M;u[0]=t,u[1]=e,u[2]=d,u[3]=g,u[4]=y,u[5]=P,u[6]=$,u[7]=T,a[0]=$,a[1]=T,a[2]=S,a[3]=M,a[4]=b,a[5]=x,a[6]=i,a[7]=l},Ye=(t,e,r,n,s,o,i,l,c,u)=>{const a=(3*r+3*s-t-i)*.25,h=(3*n+3*o-e-l)*.25;c[u]=a,c[u+1]=h,c[u+2]=i,c[u+3]=l},Mt=new Float32Array(8),St=new Float32Array(8),ll=(t,e,r,n,s,o,i,l)=>{const c=il(t,e,r,n,s,o,i,l),u=c*4;al(u);let a=0;if(c<=2)ft(t,e,r,n,s,o,i,l,.5,Mt,St),Ye(Mt[0],Mt[1],Mt[2],Mt[3],Mt[4],Mt[5],Mt[6],Mt[7],Re,a),a+=4,Ye(St[0],St[1],St[2],St[3],St[4],St[5],St[6],St[7],Re,a),a+=4;else if(c<=4){xi();const h=Se(),d=Se();ft(t,e,r,n,s,o,i,l,.5,h,d);const g=Se(),m=Se(),f=Se(),b=Se();ft(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],.5,g,m),ft(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],.5,f,b),Ye(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],Re,a),a+=4,Ye(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],Re,a),a+=4,Ye(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],Re,a),a+=4,Ye(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],Re,a),a+=4}else{xi();const h=Se(),d=Se();ft(t,e,r,n,s,o,i,l,.5,h,d);const g=Se(),m=Se(),f=Se(),b=Se();ft(h[0],h[1],h[2],h[3],h[4],h[5],h[6],h[7],.5,g,m),ft(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],.5,f,b);const x=Se(),y=Se(),P=Se(),S=Se(),M=Se(),$=Se(),T=Se(),w=Se();ft(g[0],g[1],g[2],g[3],g[4],g[5],g[6],g[7],.5,x,y),ft(m[0],m[1],m[2],m[3],m[4],m[5],m[6],m[7],.5,P,S),ft(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],.5,M,$),ft(b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7],.5,T,w),Ye(x[0],x[1],x[2],x[3],x[4],x[5],x[6],x[7],Re,a),a+=4,Ye(y[0],y[1],y[2],y[3],y[4],y[5],y[6],y[7],Re,a),a+=4,Ye(P[0],P[1],P[2],P[3],P[4],P[5],P[6],P[7],Re,a),a+=4,Ye(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],Re,a),a+=4,Ye(M[0],M[1],M[2],M[3],M[4],M[5],M[6],M[7],Re,a),a+=4,Ye($[0],$[1],$[2],$[3],$[4],$[5],$[6],$[7],Re,a),a+=4,Ye(T[0],T[1],T[2],T[3],T[4],T[5],T[6],T[7],Re,a),a+=4,Ye(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],Re,a),a+=4}return cl(a/4),{buffer:Re,count:bi}},Qr=(t,e,r,n,s,o)=>{if(me.length||wn(0,0),qr(s,o))return;const i=me.length,l=+me[i-3],c=+me[i-2],u=ll(l,c,t,e,r,n,s,o),a=u.buffer,h=u.count;for(let d=0;d<h*4;)gi(a[d++],a[d++],a[d++],a[d++])},ul=(t,e,r)=>{const n=r,s=r*.5522847498307936;Qr(t+n,e+s,t+s,e+n,t,e+n),Qr(t-s,e+n,t-n,e+s,t-n,e),Qr(t-n,e-s,t-s,e-n,t,e-n),Qr(t+s,e-n,t+n,e-s,t+n,e)},fl=(t,e,r,n,s)=>{t.$clearColorR=jr(e,0,1,0),t.$clearColorG=jr(r,0,1,0),t.$clearColorB=jr(n,0,1,0),t.$clearColorA=jr(s,0,1,0)},hl=(t,e,r,n)=>{p.clearColor(t,e,r,n),p.clear(p.COLOR_BUFFER_BIT|p.STENCIL_BUFFER_BIT),p.clearColor(0,0,0,0)},$t=[],yi=t=>{let e=-1,r=$t.length;for(;Math.abs(r-e)>1;){const n=Math.floor((r+e)/2);t<=$t[n].area?r=n:e=n}return r},dl=t=>{if($t.indexOf(t)>-1)return;const e=yi(t.area);t.dirty=!0,$t.splice(e,0,t)},ae=t=>{p.deleteTexture(t.resource)},et=[],pl=t=>{if(!(et.indexOf(t)>-1)){if(et.length>10){p.deleteRenderbuffer(t.resource);return}t.dirty=!0,et.push(t)}},Ts=[];let Tt;const ml=t=>{Tt=t.createFramebuffer()};let vi=null;const gl=t=>{vi=t.createFramebuffer()};let On=null;const bl=(t,e)=>{On=t.createFramebuffer(),t.bindFramebuffer(t.FRAMEBUFFER,On),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e.resource,0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,On)};let Bs=null;const Mi=t=>{Bs=t};let Ps=!1;const As=t=>{Ps=t};let Fs=null,Zr=null,Si=null,$i=null;const xl=t=>{Zr=t.createFramebuffer(),Fs=t.createFramebuffer(),Si=t.createFramebuffer(),$i=t.createBuffer(),t.bindBuffer(t.PIXEL_PACK_BUFFER,$i)},be=(t,e=!0)=>{t.msaa?(dl(t.color),t.color=null,t.stencil=null):(e&&ae(t.texture),t.texture=null,pl(t.stencil),t.stencil=null),Ts.push(t)};let yl=0;const vl=()=>({id:yl++,width:0,height:0,clipLevel:0,msaa:!1,mask:!1,color:null,texture:null,stencil:null}),Ml=()=>{const t={id:0,resource:p.createRenderbuffer(),width:0,height:0,area:0,dirty:!1};return{resource:p.createRenderbuffer(),stencil:t,width:0,height:0,area:0,dirty:!1}},Sl=t=>{if(!$t.length)return Ml();const e=yi(t);if(e<$t.length){const n=$t[e];return $t.splice(e,1),n}const r=$t.shift();if(!r)throw new Error("the color buffer is void.");return r},$l=(t,e)=>{t=Math.max(256,Fn(t)),e=Math.max(256,Fn(e));const r=Sl(t*e);return(r.width<t||r.height<e)&&(t=Math.max(t,r.width),e=Math.max(e,r.height),r.width=t,r.height=e,r.area=t*e,p.bindRenderbuffer(p.RENDERBUFFER,r.resource),p.renderbufferStorageMultisample(p.RENDERBUFFER,bs,p.RGBA8,t,e),p.bindRenderbuffer(p.RENDERBUFFER,r.stencil.resource),p.renderbufferStorageMultisample(p.RENDERBUFFER,bs,p.STENCIL_INDEX8,t,e)),r.dirty=!0,r};let Tl=0;const Bl=()=>({id:Tl++,resource:p.createRenderbuffer(),width:0,height:0,area:0,dirty:!1}),Pl=(t,e)=>{if(!et.length)return Bl();let r=-1,n=1/0;for(let s=0;s<et.length;++s){const o=et[s];o.width>=t&&o.height>=e&&o.area<n&&(n=o.area,r=s)}if(r!==-1){const s=et[r];return et[r]=et[et.length-1],et.pop(),s}return et.pop()},Al=(t,e)=>{const r=Pl(t,e);return(r.width!==t||r.height!==e)&&(r.width=t,r.height=e,r.area=t*e,r.dirty=!1,p.bindRenderbuffer(p.RENDERBUFFER,r.resource),p.renderbufferStorage(p.RENDERBUFFER,p.STENCIL_INDEX8,t,e)),r};let Fl=0;const Ti=(t,e)=>({id:Fl++,resource:p.createTexture(),width:t,height:e,area:t*e,smooth:!1});let gr=-1;const Bi=t=>{gr=t},ws=[null,null,null],wl=(t,e=!1)=>{gr!==p.TEXTURE0&&(Bi(p.TEXTURE0),p.activeTexture(p.TEXTURE0)),ws[0]=t,p.bindTexture(p.TEXTURE_2D,t.resource),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,e?p.LINEAR:p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,e?p.LINEAR:p.NEAREST),p.texStorage2D(p.TEXTURE_2D,1,p.RGBA8,t.width,t.height)},Jr=(t,e,r=!1)=>{const n=Ti(t,e);return wl(n,r),n},we=(t,e,r=!1)=>{const n=Ts.length?Ts.pop():vl();return n.width=t,n.height=e,r?(n.msaa=!0,n.texture=null,n.color=$l(t,e),n.stencil=n.color.stencil):(n.msaa=!1,n.texture=Jr(t,e),n.color=null,n.stencil=Al(t,e)),n.mask=!1,n.clipLevel=0,n},Ol=()=>{Mi(null),Ps&&(As(!1),p.bindFramebuffer(p.FRAMEBUFFER,null))},El=()=>{const t=Ti(ut,ut);return p.activeTexture(p.TEXTURE3),p.bindTexture(p.TEXTURE_2D,t.resource),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_S,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_WRAP_T,p.CLAMP_TO_EDGE),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,p.LINEAR),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,p.NEAREST),p.texStorage2D(p.TEXTURE_2D,1,p.RGBA8,t.width,t.height),p.activeTexture(gr!==-1?gr:p.TEXTURE0),t},Os=Number.MAX_VALUE,Es=-Number.MAX_VALUE;let qt=0;const Qt=t=>{qt=t},En=[],Rl=()=>En,Cl=t=>{En[qt]=t},Ul=()=>(qt in En||Cl(we(ut,ut,!0)),En[qt]),br=[];let Rs=null;const Pi=()=>(Rs||(Rs=El()),Rs),en=[],Ai=t=>(t in en||(en[t]=new Float32Array([Os,Os,Es,Es])),en[t]),Gl=()=>{for(let t=0;t<en.length;++t){const e=en[t];e&&(e[0]=e[1]=Os,e[2]=e[3]=Es)}};let Cs=0;const Fi=t=>{Cs=t},Ll=()=>{br.length=0,Qt(0);const t=Rl();for(let e=0;e<t.length;e++)be(t[e]);t.length=0},kl=(t,e,r,n=!0)=>{if(t.clearArraysInstanced(),t.$stackAttachmentObject.length)for(let s=0;s<t.$stackAttachmentObject.length;++s){const o=t.$stackAttachmentObject[s];o&&be(o)}else t.$mainAttachmentObject&&be(t.$mainAttachmentObject);n&&Ll(),Ol(),t.$mainAttachmentObject=we(e,r,!0),t.bind(t.$mainAttachmentObject)},Il=(t,e,r,n)=>{It(),p.scissor(t,e,r,n),p.clear(p.COLOR_BUFFER_BIT|p.STENCIL_BUFFER_BIT),yt()},Ke=(t,e,r=null,n=!1)=>{(gr===-1||e!==gr)&&(Bi(e),p.activeTexture(e));const s=ws[t];s!==null&&r!==null&&s.id===r.id||r===s||(ws[t]=r,p.bindTexture(p.TEXTURE_2D,r?r.resource:null),r&&r.smooth!==n&&(r.smooth=n,p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MIN_FILTER,n?p.LINEAR:p.NEAREST),p.texParameteri(p.TEXTURE_2D,p.TEXTURE_MAG_FILTER,n?p.LINEAR:p.NEAREST)))},$e=(t,e=!1)=>{Ke(2,p.TEXTURE2,null),Ke(1,p.TEXTURE1,null),Ke(0,p.TEXTURE0,t,e)},_l=t=>{Mi(t),Ps||(As(!0),p.bindFramebuffer(p.FRAMEBUFFER,Tt)),t.msaa?(p.bindRenderbuffer(p.RENDERBUFFER,t.color.resource),p.framebufferRenderbuffer(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.RENDERBUFFER,t.color.resource)):($e(t.texture),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,t.texture.resource,0),Ke(0,p.TEXTURE0,null)),p.bindRenderbuffer(p.RENDERBUFFER,t.stencil.resource),p.framebufferRenderbuffer(p.FRAMEBUFFER,p.STENCIL_ATTACHMENT,p.RENDERBUFFER,t.stencil.resource)},Us=()=>{const t=O.currentAttachmentObject;if(!t)return;const e=t.clipLevel;let r=0;for(let n=0;n<e;++n)r|=(1<<e-n)-1;p.stencilMask(255),p.stencilFunc(p.EQUAL,r&255,r),p.stencilOp(p.KEEP,p.KEEP,p.KEEP),p.colorMask(!0,!0,!0,!0),p.disable(p.SAMPLE_ALPHA_TO_COVERAGE),yt()};let wi=!1;const Rn=t=>{wi=t},Gs=()=>wi,tn=new Map,rn=new Map,Vl=t=>{!t&&Gs()?(Rn(!1),Wr(),yt()):t&&!Gs()&&(Rn(!0),Yr(),Us())},Dl=(t,e)=>{const r=Bs;if(r&&e.id===r.id)return;_l(e),(!r||r.width!==e.width||r.height!==e.height)&&(Kc(e.width,e.height),p.viewport(0,0,e.width,e.height));const n=e.msaa?e.color:e.stencil;n.dirty&&(n.dirty=!1,t.clearRect(0,0,e.width,e.height)),Vl(e.mask)},Nl=t=>{t.$stack.push(xs(...t.$matrix))},zl=t=>{if(!t.$stack.length)return;const e=t.$stack.pop();t.$matrix[0]=e[0],t.$matrix[1]=e[1],t.$matrix[3]=e[3],t.$matrix[4]=e[4],t.$matrix[6]=e[6],t.$matrix[7]=e[7],Hc(e)},Xl=(t,e,r,n,s,o,i)=>{t[0]=e,t[1]=r,t[3]=n,t[4]=s,t[6]=o,t[7]=i},Yl=(t,e,r,n,s,o,i)=>{const l=t.$matrix[0],c=t.$matrix[1],u=t.$matrix[3],a=t.$matrix[4],h=t.$matrix[6],d=t.$matrix[7];t.$matrix[0]=e*l+r*u,t.$matrix[1]=e*c+r*a,t.$matrix[3]=n*l+s*u,t.$matrix[4]=n*c+s*a,t.$matrix[6]=o*l+i*u+h,t.$matrix[7]=o*c+i*a+d},Wl=t=>{t.globalAlpha=1,t.globalCompositeOperation="normal",t.imageSmoothingEnabled=!1},jl=t=>{t.$fillStyle.fill(1),t.$strokeStyle.fill(1)},Hl=(t,e,r,n)=>{It(),p.scissor(t,e,r+1,n+1),p.clear(p.COLOR_BUFFER_BIT|p.STENCIL_BUFFER_BIT),p.scissor(t,e,r,n)},Kl=()=>{yt()},ql=(t,e,r,n,s,o,i,l,c,u,a,h,d)=>{const g=t.length-5;for(let m=3;m<g;m+=3){let f=r*17;t[m+2]?(e[f++]=t[m-3],e[f++]=t[m-2],e[f++]=0,e[f++]=0,e[f++]=u,e[f++]=a,e[f++]=h,e[f++]=d,e[f++]=n,e[f++]=s,e[f++]=0,e[f++]=o,e[f++]=i,e[f++]=0,e[f++]=l,e[f++]=c,e[f++]=0,e[f++]=t[m],e[f++]=t[m+1],e[f++]=.5,e[f++]=0,e[f++]=u,e[f++]=a,e[f++]=h,e[f++]=d,e[f++]=n,e[f++]=s,e[f++]=0,e[f++]=o,e[f++]=i,e[f++]=0,e[f++]=l,e[f++]=c,e[f++]=0,e[f++]=t[m+3],e[f++]=t[m+4],e[f++]=1,e[f++]=1,e[f++]=u,e[f++]=a,e[f++]=h,e[f++]=d,e[f++]=n,e[f++]=s,e[f++]=0,e[f++]=o,e[f++]=i,e[f++]=0,e[f++]=l,e[f++]=c,e[f++]=0):t[m+5]?(e[f++]=t[0],e[f++]=t[1],e[f++]=.5,e[f++]=.5,e[f++]=u,e[f++]=a,e[f++]=h,e[f++]=d,e[f++]=n,e[f++]=s,e[f++]=0,e[f++]=o,e[f++]=i,e[f++]=0,e[f++]=l,e[f++]=c,e[f++]=0,e[f++]=t[m],e[f++]=t[m+1],e[f++]=.5,e[f++]=.5,e[f++]=u,e[f++]=a,e[f++]=h,e[f++]=d,e[f++]=n,e[f++]=s,e[f++]=0,e[f++]=o,e[f++]=i,e[f++]=0,e[f++]=l,e[f++]=c,e[f++]=0,e[f++]=t[m+6],e[f++]=t[m+7],e[f++]=.5,e[f++]=.5,e[f++]=u,e[f++]=a,e[f++]=h,e[f++]=d,e[f++]=n,e[f++]=s,e[f++]=0,e[f++]=o,e[f++]=i,e[f++]=0,e[f++]=l,e[f++]=c,e[f++]=0):(e[f++]=t[0],e[f++]=t[1],e[f++]=.5,e[f++]=.5,e[f++]=u,e[f++]=a,e[f++]=h,e[f++]=d,e[f++]=n,e[f++]=s,e[f++]=0,e[f++]=o,e[f++]=i,e[f++]=0,e[f++]=l,e[f++]=c,e[f++]=0,e[f++]=t[m],e[f++]=t[m+1],e[f++]=.5,e[f++]=.5,e[f++]=u,e[f++]=a,e[f++]=h,e[f++]=d,e[f++]=n,e[f++]=s,e[f++]=0,e[f++]=o,e[f++]=i,e[f++]=0,e[f++]=l,e[f++]=c,e[f++]=0,e[f++]=t[m+3],e[f++]=t[m+4],e[f++]=.5,e[f++]=.5,e[f++]=u,e[f++]=a,e[f++]=h,e[f++]=d,e[f++]=n,e[f++]=s,e[f++]=0,e[f++]=o,e[f++]=i,e[f++]=0,e[f++]=l,e[f++]=c,e[f++]=0),r+=3}return r},Oi=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t);let nn=new Float32Array(128),xr=0;const Ql=()=>nn,Zl=()=>xr,yr=t=>{const e=t.length+xr;if(e>nn.length){const r=new Float32Array(Oi(e));r.set(nn),r.set(t,xr),nn=r}else nn.set(t,xr);xr+=t.length},We=[],Bt=[],Ei=()=>{Bt.length=0,xr=0,We.length=0};let Ls=new Float32Array(32);const Jl=t=>(Ls.length<t&&(Ls=new Float32Array(Oi(t))),Ls),Cn=(t,e="fill")=>{const r=e==="fill"?O.$fillStyle:O.$strokeStyle,n=r[0],s=r[1],o=r[2],i=r[3],l=O.$matrix,c=pt,u=mt,a=l[0]/c,h=l[3]/c,d=l[6]/c,g=l[1]/u,m=l[4]/u,f=l[7]/u;let b=0;for(let P=0;P<t.length;++P)b+=(t[P].length/3-2)*51;const x=Jl(b);let y=0;for(let P=0;P<t.length;++P)y=ql(t[P],x,y,a,g,h,m,d,f,n,s,o,i);return{buffer:x.subarray(0,b),indexCount:y}},eu=t=>{const e=pr();if(!e.length)return;Bt.push(t);const r=Cn(e);yr(r.buffer),We.push(r.indexCount)},qe=[],tu=(t,e,r,n,s,o)=>{const i=pr();if(!i.length)return;Bt.push(t===0?"linear":"radial");const l=Cn(i);yr(l.buffer),We.push(l.indexCount),qe.push(e,r,n,s),t===1&&qe.push(o)},ru=(t,e,r)=>{const n=Math.sqrt(t*t+e*e);return{x:-(e/n)*r,y:t/n*r}},nu=(t,e,r)=>{const n={x:e.x-t.x,y:e.y-t.y},s=ru(n.x,n.y,r),o={x:t.x+s.x,y:t.y+s.y},i={x:e.x+s.x,y:e.y+s.y},l={x:t.x-s.x,y:t.y-s.y},c={x:e.x-s.x,y:e.y-s.y};return[o.x,o.y,!1,i.x,i.y,!1,c.x,c.y,!1,l.x,l.y,!1,o.x,o.y,!1]},ks=(t,e,r)=>({x:t.x+(e.x-t.x)*r,y:t.y+(e.y-t.y)*r}),su=(t,e,r,n=.5)=>{const s=ks(t,e,n),o=ks(e,r,n),i=ks(s,o,n);return[[t,s,i],[i,o,r]]},ou=(t,e,r,n=4)=>{let s=[[t,e,r]];for(let o=0;o<n;++o){const i=[];for(let l=0;l<s.length;++l){const c=s[l];if(!c)continue;const u=su(c[0],c[1],c[2],.5);i.push(u[0],u[1])}s=i}return s},iu=(t,e,r,n)=>({x:(1-t)**2*e.x+2*(1-t)*t*r.x+t**2*n.x,y:(1-t)**2*e.y+2*(1-t)*t*r.y+t**2*n.y}),au=(t,e,r,n)=>({x:2*(1-t)*(r.x-e.x)+2*t*(n.x-r.x),y:2*(1-t)*(r.y-e.y)+2*t*(n.y-r.y)}),cu=t=>{const e=Math.sqrt(t.x*t.x+t.y*t.y);return e===0?{x:0,y:0}:{x:t.x/e,y:t.y/e}},Ri=(t,e,r,n)=>{const s=[0,.5,1],o=[];for(let i=0;i<s.length;++i){const l=s[i],c=iu(l,t,e,r),u=au(l,t,e,r),a=cu({x:-u.y,y:u.x});o.push({x:c.x+a.x*n,y:c.y+a.y*n})}return o},lu=(t,e,r,n)=>{const s=ou(t,e,r,5),o=[],i=[];for(let h=0;h<s.length;++h){const[d,g,m]=s[h];o.push(Ri(d,g,m,+n)),i.push(Ri(d,g,m,-n))}const l=o[0][0],c=[l.x,l.y,!1];for(let h=0;h<o.length;++h){const d=o[h];c.push(d[1].x,d[1].y,!0,d[2].x,d[2].y,!1)}const u=[...i].reverse();for(let h=0;h<u.length;++h){const[d,g,m]=u[h];u[h]=[m,g,d]}const a=u[0][0];c.push(a.x,a.y,!1);for(let h=0;h<u.length;++h){const d=u[h];c.push(d[1].x,d[1].y,!0,d[2].x,d[2].y,!1)}return c},vr=(t,e,r,n)=>{const s=[];for(let i=0;i<n.length;i+=3){if(n[i+2])continue;const l=n[i],c=n[i+1],u=Math.sqrt(Math.pow(l-t,2)+Math.pow(c-e,2));Math.abs(u-r)>1e-4||s.push(l,c)}return s},Mr=new OffscreenCanvas(1,1).getContext("2d"),Sr=(t,e)=>{Mr.beginPath(),Mr.moveTo(e[0],e[1]);for(let r=3;r<e.length;r+=3)e[r+2]?(Mr.quadraticCurveTo(e[r],e[r+1],e[r+3],e[r+4]),r+=3):Mr.lineTo(e[r],e[r+1]);Mr.closePath();for(let r=0;r<t.length;r+=2){const n=t[r],s=t[r+1];if(!Mr.isPointInPath(n,s))return[n,s]}return null},Ci=(t,e,r,n,s=!1)=>{const o=s?0:n.length-1,i=s?n.length-1:n.length-2,l=n[o].length>15,c=n[i].length>15;if(l&&c)return;const u=vr(t,e,r,n[o]),a=vr(t,e,r,n[i]),h=Sr(u,n[i]);if(!h)return;const d=Sr(a,n[o]);if(!d)return;const g=Math.atan2(h[1]-e,h[0]-t);let f=Math.atan2(d[1]-e,d[0]-t)-g;f>Math.PI?f-=2*Math.PI:f<-Math.PI&&(f+=2*Math.PI);const b=Math.abs(f);if(b<.1||b>Math.PI-.1)return;const x=8,y=f/x,P=[t,e,!1];for(let S=0;S<=x;S++){const M=g+S*y,$=t+r*Math.cos(M),T=e+r*Math.sin(M);P.push($,T,!1)}n.splice(-1,0,P)},Ui=(t,e,r,n,s=!1)=>{const o=s?0:n.length-1,i=s?n.length-1:n.length-2,l=n[o].length>15,c=n[i].length>15;if(l&&c)return;const u=vr(t,e,r,n[o]),a=vr(t,e,r,n[i]);if(u[0]===a[0]&&u[1]===a[1]||u[0]===a[2]&&u[1]===a[3])return;const h=Sr(u,n[i]);if(!h)return;const d=Sr(a,n[o]);d&&n.splice(-1,0,[t,e,!1,h[0],h[1],!1,d[0],d[1],!1,t,e,!1])},uu=(t,e,r)=>{for(let n=0;n<2;++n){let s=0,o=0,i=0,l=0;n===0?(s=t[0],o=t[1],i=t[3],l=t[4]):(s=t[t.length-3],o=t[t.length-2],i=t[t.length-6],l=t[t.length-5]);const c=i-s,u=l-o,a=Math.atan2(u,c),h=a+Math.PI/2,d=a-Math.PI/2,g=16,m=(d-h)/g,f=[];for(let b=0;b<=g;b++){const x=d+m*b,y=s+e*Math.cos(x),P=o+e*Math.sin(x);f.push(y,P,!1)}n===0?r.unshift(f):r.push(f)}},fu=(t,e,r)=>{for(let n=0;n<2;++n){let s=0,o=0,i=0,l=0;n===0?(s=t[0],o=t[1],i=t[3],l=t[4]):(s=t[t.length-3],o=t[t.length-2],i=t[t.length-6],l=t[t.length-5]);const c=-(i-s),u=-(l-o),a=Math.sqrt(c*c+u*u);if(a===0)continue;const h=c/a,d=u/a,g=s+e*h,m=o+e*d,f=-d,b=h,x=[g+e*h+e*f,m+e*d+e*b,!1,g+e*h-e*f,m+e*d-e*b,!1,g-e*h-e*f,m-e*d-e*b,!1,g+e*h+e*f,m+e*d+e*b,!1,g-e*h-e*f,m-e*d-e*b,!1,g-e*h+e*f,m-e*d+e*b,!1];n===0?r.unshift(x):r.push(x)}},Gi=(t,e,r,n,s,o=!1)=>{const i=o?0:s.length-1,l=o?s.length-1:s.length-2,c=s[i].length>15,u=s[l].length>15;if(c&&u)return;const a=vr(t.x,t.y,n,s[i]),h=vr(t.x,t.y,n,s[l]);if(a[0]===h[0]&&a[1]===h[1]||a[0]===h[2]&&a[1]===h[3])return;const d=Sr(a,s[l]);if(!d)return;const g=Sr(h,s[i]);if(!g)return;const m=e.x-t.x,f=e.y-t.y,b=Math.hypot(m,f),x={x:m/b,y:f/b},y=r.x-t.x,P=r.y-t.y,S=Math.hypot(y,P),M={x:y/S,y:P/S},$=x.x,T=x.y,w=M.x,E=M.y,F=$*E-T*w;if(F===0){s.splice(-1,0,[t.x,t.y,!1,d[0],d[1],!1,g[0],g[1],!1]);return}const A=((g[0]-d[0])*E-(g[1]-d[1])*w)/F,R=d[0]+A*$,v=d[1]+A*T;s.splice(-1,0,[t.x,t.y,!1,d[0],d[1],!1,R,v,!1,t.x,t.y,!1,g[0],g[1],!1,R,v,!1])},hu={x:0,y:0},du={x:0,y:0},pu={x:0,y:0},mu={x:0,y:0},gu=(t,e)=>{const r=hu;r.x=t[0],r.y=t[1];const n=du;n.x=0,n.y=0;const s=pu;s.x=0,s.y=0;const o=mu;o.x=0,o.y=0;const i=[];for(let g=3;g<t.length;g+=3){const m=t[g],f=t[g+1];if(t[g+2]){n.x=m,n.y=f;continue}if(s.x=m,s.y=f,t[g-1]?i.push(lu(r,n,s,e)):i.push(nu(r,s,e)),i.length>1)switch(O.joints){case 0:Ui(r.x,r.y,e,i);break;case 1:o.x=t[g-6],o.y=t[g-5],Gi(r,s,o,e,i);break;case 2:Ci(r.x,r.y,e,i);break}r.x=s.x,r.y=s.y}const l=t[0],c=t[1],u=t[t.length-3],a=t[t.length-2],h=1e-4;if(Math.abs(l-u)<h&&Math.abs(c-a)<h&&i.length>1)switch(O.joints){case 0:Ui(l,c,e,i,!0);break;case 1:r.x=l,r.y=c,s.x=t[3],s.y=t[4],o.x=t[t.length-6],o.y=t[t.length-5],Gi(r,s,o,e,i,!0);break;case 2:Ci(l,c,e,i,!0);break}else switch(O.caps){case 1:uu(t,e,i);break;case 2:fu(t,e,i);break}return i},Is=t=>{const e=O.thickness/2,r=Hr();for(let s=0;s<t.length;++s){const o=gu(t[s],e);for(let i=0;i<o.length;++i)r.push(o[i])}const n=Cn(r,"stroke");return r.length=0,ui(r),n},bu=(t,e,r,n,s,o)=>{const i=pr(!0);if(!i.length)return;Bt.push(t===0?"linear":"radial");const l=Is(i);yr(l.buffer),We.push(l.indexCount),qe.push(e,r,n,s),t===1&&qe.push(o)},$r=new Map,Li=()=>{$r.clear()},xu=t=>{$r.set(We.length,t)},Un=()=>({id:Jc(),resource:p.createVertexArray(),vertexBuffer:p.createBuffer(),vertexLength:0});let _s;const Pt=t=>{_s&&_s.id===t.id||(_s=t,p.bindVertexArray(t.resource))},yu=()=>{const t=Un();Pt(t),p.bindBuffer(p.ARRAY_BUFFER,t.vertexBuffer);const e=new Float32Array([0,0,1,0,1,1,0,0,1,1,0,1]);return p.bufferData(p.ARRAY_BUFFER,e,p.STATIC_DRAW),p.enableVertexAttribArray(0),p.vertexAttribPointer(0,2,p.FLOAT,!1,0,0),t},Gn=[],tt=new Float32Array([0,0,0,1,1,0,1,1]);let Vs;const vu=t=>{Vs=t.createBuffer()};let ki;const Mu=t=>{ki=t};let Ds;const Ln=()=>(Ds||(Ds=yu()),Ds),Su=()=>{if(Gn.length)return Gn.pop();const t=Un();return Pt(t),p.bindBuffer(p.ARRAY_BUFFER,t.vertexBuffer),p.enableVertexAttribArray(0),p.enableVertexAttribArray(1),p.enableVertexAttribArray(2),p.enableVertexAttribArray(3),p.enableVertexAttribArray(4),p.enableVertexAttribArray(5),p.vertexAttribPointer(0,2,p.FLOAT,!1,68,0),p.vertexAttribPointer(1,2,p.FLOAT,!1,68,8),p.vertexAttribPointer(2,4,p.FLOAT,!1,68,16),p.vertexAttribPointer(3,3,p.FLOAT,!1,68,32),p.vertexAttribPointer(4,3,p.FLOAT,!1,68,44),p.vertexAttribPointer(5,3,p.FLOAT,!1,68,56),t},Ii=()=>{const t=Su();Pt(t);const e=Ql(),r=Zl();return p.bindBuffer(p.ARRAY_BUFFER,t.vertexBuffer),t.vertexLength<e.length&&(t.vertexLength=Fn(e.length),p.bufferData(p.ARRAY_BUFFER,t.vertexLength*4,p.STREAM_DRAW)),p.bufferSubData(p.ARRAY_BUFFER,0,e.subarray(0,r)),t},_i=t=>{Gn.indexOf(t)>-1||Gn.push(t)};let $u=0;const Tu=(t,e)=>{const r=p.createProgram(),n=p.createShader(p.VERTEX_SHADER);p.shaderSource(n,t),p.compileShader(n);const s=p.createShader(p.FRAGMENT_SHADER);return p.shaderSource(s,e),p.compileShader(s),p.attachShader(r,n),p.attachShader(r,s),p.linkProgram(r),p.detachShader(r,n),p.detachShader(r,s),p.deleteShader(n),p.deleteShader(s),{id:$u++,resource:r}},Bu=(t,e,r=!1)=>{const n=p.getProgramParameter(t,p.ACTIVE_UNIFORMS);for(let s=0;s<n;++s){const o=p.getActiveUniform(t,s),i=o.name.endsWith("[0]")?o.name.slice(0,-3):o.name,l=p.getUniformLocation(t,i);if(o.type===p.SAMPLER_2D&&o.size===1&&!r)continue;const c={};switch(o.type){case p.FLOAT_VEC4:c.method=p.uniform4fv.bind(p,l),c.array=new Float32Array(4*o.size),c.assign=-1;break;case p.INT_VEC4:c.method=p.uniform4iv.bind(p,l),c.array=new Int32Array(4*o.size),c.assign=-1;break;case p.SAMPLER_2D:c.method=r?p.uniform1i.bind(p,l,3):p.uniform1iv.bind(p,l),c.array=new Int32Array(o.size),c.assign=1;break;case p.FLOAT:case p.FLOAT_VEC2:case p.FLOAT_VEC3:case p.FLOAT_MAT2:case p.FLOAT_MAT3:case p.FLOAT_MAT4:case p.INT:case p.INT_VEC2:case p.INT_VEC3:default:throw new Error("Use gl.FLOAT_VEC4 or gl.INT_VEC4 instead")}e.set(i,c)}};let Vi=-1;const Pu=t=>{Vi!==t.id&&(Vi=t.id,p.useProgram(t.resource))},Au=t=>{for(const e of t.values())e.method===void 0||e.assign===void 0||(e.assign<0?e.method(e.array):e.assign>0&&(e.assign--,e.method(e.array)))};class _e{_$programObject;_$uniformMap;highp;mediump;textures;constructor(e,r,n=!1){this._$programObject=Tu(e,r),this._$uniformMap=new Map,Bu(this._$programObject.resource,this._$uniformMap,n);const s=new Float32Array(0);this.highp=this._$uniformMap.get("u_highp")?.array??s,this.mediump=this._$uniformMap.get("u_mediump")?.array??s,this.textures=this._$uniformMap.get("u_textures")?.array??s}useProgram(){Pu(this._$programObject)}bindUniform(){Au(this._$uniformMap)}}const At=new Map,Fu=()=>\`
2
2
  vec2 applyMatrix(in vec2 vertex) {
3
3
  mat3 matrix = mat3(a_matrix0, a_matrix1, a_matrix2);
4
4
  return (matrix * vec3(vertex, 1.0)).xy;
5
- }\`,Ao=t=>\`
5
+ }\`,wu=t=>\`
6
6
  vec2 applyMatrix(in vec2 vertex) {
7
7
  mat3 parent_matrix = mat3(
8
8
  u_highp[\${t}].xyz,
@@ -19,7 +19,7 @@ vec2 applyMatrix(in vec2 vertex) {
19
19
  vec2 parent_size = vec2(u_highp[\${t+4}].w, u_highp[\${t+5}].w);
20
20
  vec4 grid_min = u_highp[\${t+6}];
21
21
  vec4 grid_max = u_highp[\${t+7}];
22
-
22
+
23
23
  vec2 position = (parent_matrix * vec3(vertex, 1.0)).xy;
24
24
  position = (position - parent_offset) / parent_size;
25
25
 
@@ -40,9 +40,9 @@ vec2 applyMatrix(in vec2 vertex) {
40
40
 
41
41
  position = position + vec2(u_highp[\${t+8}].x, u_highp[\${t+8}].y);
42
42
  return position / vec2(u_highp[0].w, u_highp[1].w);
43
- }\`,xo=()=>"layout (location = 1) in vec2 a_bezier;",vo=()=>\`layout (location = 3) in vec3 a_matrix0;
43
+ }\`,Ou=()=>"layout (location = 1) in vec2 a_bezier;",Eu=()=>\`layout (location = 3) in vec3 a_matrix0;
44
44
  layout (location = 4) in vec3 a_matrix1;
45
- layout (location = 5) in vec3 a_matrix2;\`,Mo=()=>"out vec2 v_uv;",yo=()=>"out vec2 v_bezier;",Ro=()=>\`
45
+ layout (location = 5) in vec3 a_matrix2;\`,Ru=()=>"out vec2 v_uv;",Cu=()=>"out vec2 v_bezier;",Uu=()=>\`
46
46
  mat3 uv_matrix = mat3(
47
47
  u_highp[0].xyz,
48
48
  u_highp[1].xyz,
@@ -53,30 +53,30 @@ layout (location = 5) in vec3 a_matrix2;\`,Mo=()=>"out vec2 v_uv;",yo=()=>"out v
53
53
  u_highp[4].xyz,
54
54
  vec3(u_highp[2].w, u_highp[3].w, u_highp[4].w)
55
55
  );
56
- v_uv = (inverse_matrix * uv_matrix * vec3(a_vertex, 1.0)).xy;\`,go=()=>"v_bezier = a_bezier;",po=()=>"layout (location = 2) in vec4 a_color;",Oo=()=>"out vec4 v_color;",mo=()=>"v_color = a_color;",pe=(t,e,s,n)=>{const o=s?xo():"",r=s?yo():e?Mo():"",a=s?go():e?Ro():"",l=n?Ao(e?5:0):To(),h=s?"":po(),f=s?"":Oo(),i=s?"":mo(),E=n?"":vo(),$=t>1?\`uniform vec4 u_highp[\${t}];\`:"";return\`#version 300 es
56
+ v_uv = (inverse_matrix * uv_matrix * vec3(a_vertex, 1.0)).xy;\`,Gu=()=>"v_bezier = a_bezier;",Lu=()=>"layout (location = 2) in vec4 a_color;",ku=()=>"out vec4 v_color;",Iu=()=>"v_color = a_color;",kn=(t,e,r,n)=>{const s=r?Ou():"",o=r?Cu():e?Ru():"",i=r?Gu():e?Uu():"",l=n?wu(e?5:0):Fu(),c=r?"":Lu(),u=r?"":ku(),a=r?"":Iu(),h=n?"":Eu(),d=t>1?\`uniform vec4 u_highp[\${t}];\`:"";return\`#version 300 es
57
57
 
58
58
  layout (location = 0) in vec2 a_vertex;
59
- \${o}
59
+ \${s}
60
+ \${c}
60
61
  \${h}
61
- \${E}
62
62
 
63
- \${$}
64
- \${r}
65
- \${f}
63
+ \${d}
64
+ \${o}
65
+ \${u}
66
66
  \${l}
67
67
 
68
68
  void main() {
69
- \${i}
70
69
  \${a}
70
+ \${i}
71
71
  vec2 pos = applyMatrix(a_vertex);
72
72
  pos = pos * 2.0 - 1.0;
73
73
  gl_Position = vec4(pos.x, -pos.y, 0.0, 1.0);
74
- }\`},Fo=()=>\`#version 300 es
74
+ }\`},_u=()=>\`#version 300 es
75
75
  layout (location = 0) in vec2 a_vertex;
76
76
  void main() {
77
77
  vec2 pos = a_vertex * 2.0 - 1.0;
78
78
  gl_Position = vec4(pos.x, -pos.y, 0.0, 1.0);
79
- }\`,So=()=>\`#version 300 es
79
+ }\`,Vu=()=>\`#version 300 es
80
80
  precision mediump float;
81
81
 
82
82
  in vec4 v_color;
@@ -84,7 +84,7 @@ out vec4 o_color;
84
84
 
85
85
  void main() {
86
86
  o_color = vec4(v_color.rgb * v_color.a, v_color.a);
87
- }\`,wo=()=>\`#version 300 es
87
+ }\`,Du=()=>\`#version 300 es
88
88
  precision mediump float;
89
89
 
90
90
  uniform sampler2D u_texture;
@@ -98,7 +98,7 @@ void main() {
98
98
 
99
99
  vec4 src = texture(u_texture, uv);
100
100
  o_color = src;
101
- }\`,Bo=()=>\`#version 300 es
101
+ }\`,Nu=()=>\`#version 300 es
102
102
  precision mediump float;
103
103
 
104
104
  uniform sampler2D u_texture;
@@ -109,36 +109,38 @@ out vec4 o_color;
109
109
 
110
110
  void main() {
111
111
  vec2 uv = fract(vec2(v_uv.x, -v_uv.y) / u_mediump[0].xy);
112
-
112
+
113
113
  vec4 src = texture(u_texture, uv);
114
114
  o_color = src;
115
- }\`,Io=()=>\`#version 300 es
115
+ }\`,zu=()=>\`#version 300 es
116
116
  precision mediump float;
117
117
 
118
118
  in vec2 v_bezier;
119
119
  out vec4 o_color;
120
120
 
121
121
  void main() {
122
- vec2 px = dFdx(v_bezier);
123
- vec2 py = dFdy(v_bezier);
122
+ float f_val = v_bezier.x * v_bezier.x - v_bezier.y;
123
+
124
+ float dx = dFdx(f_val);
125
+ float dy = dFdy(f_val);
124
126
 
125
- vec2 f = (2.0 * v_bezier.x) * vec2(px.x, py.x) - vec2(px.y, py.y);
126
- float alpha = 0.5 - (v_bezier.x * v_bezier.x - v_bezier.y) / length(f);
127
+ float dist = f_val / length(vec2(dx, dy));
128
+ float alpha = smoothstep(0.5, -0.5, dist);
127
129
 
128
- if (alpha > 0.0) {
130
+ if (alpha > 0.001) {
129
131
  o_color = vec4(min(alpha, 1.0));
130
132
  } else {
131
133
  discard;
132
- }
133
- }\`,Co=()=>\`#version 300 es
134
+ }
135
+ }\`,Xu=()=>\`#version 300 es
134
136
  precision mediump float;
135
137
  out vec4 o_color;
136
138
  void main() {
137
139
  o_color = vec4(1.0);
138
- }\`,ie=t=>{const e=\`m\${t?"y":"n"}\`;if(Et.has(e))return Et.get(e);const s=new Z(pe(t?9:0,!1,!0,t),Io());return Et.set(e,s),s},ue=(t,e)=>{const s=t.highp;s[0]=e[0],s[1]=e[1],s[2]=0,s[4]=e[2],s[5]=e[3],s[6]=0,s[8]=e[4],s[9]=e[5],s[10]=1,s[12]=e[6],s[13]=e[7],s[14]=0,s[16]=e[8],s[17]=e[9],s[18]=0,s[20]=e[10],s[21]=e[11],s[22]=1,s[3]=it(),s[7]=ut(),s[11]=e[12],s[15]=e[13],s[19]=e[14],s[23]=e[15],s[24]=e[16],s[25]=e[17],s[26]=e[18],s[27]=e[19],s[28]=e[20],s[29]=e[21],s[30]=e[22],s[31]=e[23],s[32]=e[24],s[33]=e[25]};let nc="normal";const oc=t=>{nc=t},rc=()=>nc;let ac=600;const Mt=t=>{ac=t},yt=()=>ac,j=()=>{yt()!==613&&(Mt(613),c.blendFunc(c.ONE,c.ONE_MINUS_SRC_ALPHA))},nt=(t,e,s,n)=>{t.useProgram(),t.bindUniform(),j(),$t(e),c.drawArrays(c.TRIANGLES,s,n)},ze=()=>{const t="rmnn";if(Et.has(t))return Et.get(t);const e=new Z(Fo(),Co());return Et.set(t,e),e},Lo=()=>{const t=A.currentAttachmentObject;if(!t)return;const e=1<<t.clipLevel-1;c.stencilMask(~e-1),c.stencilFunc(c.LEQUAL,e,255),c.stencilOp(c.ZERO,c.REPLACE,c.REPLACE),nt(ze(),ge(),0,6),c.stencilMask(1<<t.clipLevel),c.stencilFunc(c.ALWAYS,0,255),c.stencilOp(c.REPLACE,c.REPLACE,c.REPLACE),nt(ze(),ge(),0,6),c.stencilMask(255),c.stencilOp(c.ZERO,c.INVERT,c.INVERT)},ko=()=>{const t=A.currentAttachmentObject;if(!t)return;const e=re.get(t.clipLevel),s=e[0],n=e[1],o=e[2],r=e[3],a=Math.ceil(Math.abs(o-s)),l=Math.ceil(Math.abs(r-n));c.enable(c.SCISSOR_TEST),c.scissor(s,t.height-n-l,a,l);const h=ec();let f=ae.get(t.clipLevel),i=0,E=null;const $=q.length;for(let v=0;v<$;v++){c.stencilMask(1<<f-1);const T=q[v];_t.has(v)&&(E=_t.get(v));const g=ie(!!E);E&&ue(g,E),nt(g,h,i,T),i+=T,++f,f>7&&(Lo(),f=t.clipLevel+1)}ae.set(t.clipLevel,f),sc(h),Hs(),qs(),c.disable(c.SCISSOR_TEST)},No=(t,e,s)=>{if(t.used){const l=t.left?.insert(e,s);return l||t.right?.insert(e,s)||null}const n=e+1,o=s+1;if(n>t.w||o>t.h)return null;if(n===t.w&&o===t.h)return t.used=!0,t.w=e,t.h=s,t;const r=t.w-n,a=t.h-o;return r>a?(t.left=t.create(t.index,t.x,t.y,n,t.h),t.right=t.create(t.index,t.x+n,t.y,r,t.h)):(t.left=t.create(t.index,t.x,t.y,t.w,o),t.right=t.create(t.index,t.x,t.y+o,t.w,a)),t.used=!0,t.left.insert(e,s)},Po=(t,e,s,n,o)=>t.left?.dispose(e,s,n,o)?(!t.left.used&&!t.right?.used&&(t.left&&t.left.release(),t.right&&t.right.release(),t.left=t.right=null,t.used=!1),!0):t.right?.dispose(e,s,n,o)?(!t.right.used&&!t.left?.used&&(t.left&&t.left.release(),t.right&&t.right.release(),t.left=t.right=null,t.used=!1),!0):e===t.x&&s===t.y&&n===t.w&&o===t.h?(t.used=!1,!0):!1,Ve=[];class We{index;x;y;w;h;left;right;used;constructor(e,s,n,o,r){this.index=e,this.x=s,this.y=n,this.w=o,this.h=r,this.left=null,this.right=null,this.used=!1}insert(e,s){return No(this,e,s)}dispose(e,s,n,o){return Po(this,e,s,n,o)}create(e,s,n,o,r){let a;return Ve.length>0?(a=Ve.pop(),a.index=e,a.x=s,a.y=n,a.w=o,a.h=r,a.left=null,a.right=null,a.used=!1):a=new We(e,s,n,o,r),a}release(){this.left&&(this.left.release(),this.left=null),this.right&&(this.right.release(),this.right=null),this.used=!1,Ve.push(this)}}class Uo{_$root;constructor(e,s,n){this._$root=new We(e,0,0,s,n)}insert(e,s){return this._$root.insert(e,s)}dispose(e,s,n,o){return this._$root.dispose(e,s,n,o)}}const lc=(t,e)=>{const s=kt();ce[s]||(ce[s]=new Uo(s,rt,rt));const o=ce[s].insert(t,e);return o||(pt(s+1),lc(t,e))},Do=t=>{const e=ce[t.index];e&&e.dispose(t.x,t.y,t.w,t.h)},je=()=>\`
140
+ }\`,sn=t=>{const e=\`m\${t?"y":"n"}\`;if(At.has(e))return At.get(e);const r=new _e(kn(t?9:0,!1,!0,t),zu());return At.set(e,r),r},on=(t,e)=>{const r=t.highp;r[0]=e[0],r[1]=e[1],r[2]=0,r[4]=e[2],r[5]=e[3],r[6]=0,r[8]=e[4],r[9]=e[5],r[10]=1,r[12]=e[6],r[13]=e[7],r[14]=0,r[16]=e[8],r[17]=e[9],r[18]=0,r[20]=e[10],r[21]=e[11],r[22]=1,r[3]=pt,r[7]=mt,r[11]=e[12],r[15]=e[13],r[19]=e[14],r[23]=e[15],r[24]=e[16],r[25]=e[17],r[26]=e[18],r[27]=e[19],r[28]=e[20],r[29]=e[21],r[30]=e[22],r[31]=e[23],r[32]=e[24],r[33]=e[25]};let In="normal";const Di=t=>{In=t};let Ft=600;const _t=t=>{Ft=t},Ce=()=>{Ft!==613&&(_t(613),p.blendFunc(p.ONE,p.ONE_MINUS_SRC_ALPHA))},rt=(t,e,r,n)=>{t.useProgram(),t.bindUniform(),Ce(),Pt(e),p.drawArrays(p.TRIANGLES,r,n)},Ns=()=>{const t="rmnn";if(At.has(t))return At.get(t);const e=new _e(_u(),Xu());return At.set(t,e),e},Yu=()=>{const t=O.currentAttachmentObject;if(!t)return;const e=1<<t.clipLevel-1;p.stencilMask(~e-1),p.stencilFunc(p.LEQUAL,e,255),p.stencilOp(p.ZERO,p.REPLACE,p.REPLACE),rt(Ns(),Ln(),0,6),p.stencilMask(1<<t.clipLevel),p.stencilFunc(p.ALWAYS,0,255),p.stencilOp(p.REPLACE,p.REPLACE,p.REPLACE),rt(Ns(),Ln(),0,6),p.stencilMask(255),p.stencilOp(p.ZERO,p.INVERT,p.INVERT)},Wu=()=>{const t=O.currentAttachmentObject;if(!t)return;const e=tn.get(t.clipLevel),r=e[0],n=e[1],s=e[2],o=e[3],i=Math.ceil(Math.abs(s-r)),l=Math.ceil(Math.abs(o-n));It(),p.scissor(r,t.height-n-l,i,l);const c=Ii();let u=rn.get(t.clipLevel),a=0,h=null;const d=We.length;for(let g=0;g<d;g++){p.stencilMask(1<<u-1);const m=We[g];$r.has(g)&&(h=$r.get(g));const b=sn(!!h);h&&on(b,h),rt(b,c,a,m),a+=m,++u,u>7&&(Yu(),u=t.clipLevel+1)}rn.set(t.clipLevel,u),_i(c),Ei(),Li(),yt()},ju=(t,e,r)=>{if(t.used){const l=t.left?.insert(e,r);return l||t.right?.insert(e,r)||null}if(e>t.w||r>t.h)return null;if(e===t.w&&r===t.h)return t.used=!0,t;const n=e+1,s=r+1,o=t.w-n,i=t.h-s;return o>i?(t.left=t.create(t.index,t.x,t.y,e,t.h),t.right=t.create(t.index,t.x+n,t.y,o,t.h)):(t.left=t.create(t.index,t.x,t.y,t.w,r),t.right=t.create(t.index,t.x,t.y+s,t.w,i)),t.used=!0,t.left.insert(e,r)},Hu=(t,e,r,n,s)=>t.left?.dispose(e,r,n,s)?(!t.left.used&&!t.right?.used&&(t.left&&t.left.release(),t.right&&t.right.release(),t.left=t.right=null,t.used=!1),!0):t.right?.dispose(e,r,n,s)?(!t.right.used&&!t.left?.used&&(t.left&&t.left.release(),t.right&&t.right.release(),t.left=t.right=null,t.used=!1),!0):e===t.x&&r===t.y&&n===t.w&&s===t.h?(t.used=!1,!0):!1,zs=[];class Xs{index;x;y;w;h;left;right;used;constructor(e,r,n,s,o){this.index=e,this.x=r,this.y=n,this.w=s,this.h=o,this.left=null,this.right=null,this.used=!1}insert(e,r){return ju(this,e,r)}dispose(e,r,n,s){return Hu(this,e,r,n,s)}create(e,r,n,s,o){const i=zs.length?zs.pop():new Xs(e,0,0,0,0);return i.index=e,i.x=r,i.y=n,i.w=s,i.h=o,i.left=null,i.right=null,i.used=!1,i}release(){this.left&&(this.left.release(),this.left=null),this.right&&(this.right.release(),this.right=null),this.used=!1,zs.push(this)}}class Ni{_$root;constructor(e,r,n){this._$root=new Xs(e,0,0,r,n)}insert(e,r){return this._$root.insert(e,r)}dispose(e,r,n,s){return this._$root.dispose(e,r,n,s)}}const Ys=(t,e)=>{const r=qt;br[r]||(br[r]=new Ni(r,ut,ut));const s=br[r].insert(t,e);if(s)return s;for(let o=0;o<10;o++){if(r===o)continue;Qt(o);const i=br[o];if(!i)return Ys(t,e);const l=i.insert(t,e);if(l)return l}return Ys(t,e)},Ku=t=>{const e=br[t.index];e&&e.dispose(t.x,t.y,t.w,t.h)},Ws=()=>\`
139
141
  float isInside(in vec2 uv) {
140
142
  return step(4.0, dot(step(vec4(0.0, uv.x, 0.0, uv.y), vec4(uv.x, 1.0, uv.y, 1.0)), vec4(1.0)));
141
- }\`,ic=t=>\`
143
+ }\`,zi=t=>\`
142
144
  vec4 mul = u_mediump[\${t}];
143
145
  vec4 add = u_mediump[\${t+1}];
144
146
 
@@ -149,7 +151,7 @@ float isInside(in vec2 uv) {
149
151
  src = clamp(src * mul + add, 0.0, 1.0);
150
152
  src.rgb *= src.a;
151
153
  }
152
- \`,uc=t=>{const e=t?"uniform vec4 u_mediump[2];":"",s=t?ic(0):"";return\`#version 300 es
154
+ \`,Xi=t=>{const e=t?"uniform vec4 u_mediump[2];":"",r=t?zi(0):"";return\`#version 300 es
153
155
  precision mediump float;
154
156
 
155
157
  uniform sampler2D u_texture;
@@ -160,9 +162,9 @@ out vec4 o_color;
160
162
 
161
163
  void main() {
162
164
  vec4 src = texture(u_texture, v_coord);
163
- \${s}
165
+ \${r}
164
166
  o_color = src;
165
- }\`},Xo=()=>\`#version 300 es
167
+ }\`},qu=()=>\`#version 300 es
166
168
  precision mediump float;
167
169
 
168
170
  uniform sampler2D u_texture;
@@ -184,7 +186,7 @@ void main() {
184
186
  }
185
187
 
186
188
  o_color = src;
187
- }\`,_o=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t);class Yo{buffer;offset;constructor(){this.buffer=new Float32Array(256),this.offset=0}push(...e){this.buffer.length<this.offset+e.length&&this.resize(e.length);for(let s=0;s<e.length;s++)this.buffer[this.offset++]=e[s]}set(e){this.buffer.length<this.offset+e.length&&this.resize(e.length),this.buffer.set(e,this.offset),this.offset+=e.length}resize(e){const s=new Float32Array(_o(this.offset+e));this.buffer.length&&s.set(this.buffer),this.buffer=s}}const Ot=new Yo;class Go extends Z{count;constructor(e,s,n=!0){super(e,s,n),this.count=0}clear(){this.count=Ot.offset=0}}const mt=()=>\`#version 300 es
189
+ }\`,Qu=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t);class Zu{buffer;offset;constructor(){this.buffer=new Float32Array(256),this.offset=0}push(...e){this.buffer.length<this.offset+e.length&&this.resize(e.length);for(let r=0;r<e.length;r++)this.buffer[this.offset++]=e[r]}pushDisplayObjectBuffer(e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b,x,y,P,S,M,$){this.buffer.length<this.offset+22&&this.resize(22),this.buffer[this.offset++]=e,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=s,this.buffer[this.offset++]=o,this.buffer[this.offset++]=i,this.buffer[this.offset++]=l,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=a,this.buffer[this.offset++]=h,this.buffer[this.offset++]=d,this.buffer[this.offset++]=g,this.buffer[this.offset++]=m,this.buffer[this.offset++]=f,this.buffer[this.offset++]=b,this.buffer[this.offset++]=x,this.buffer[this.offset++]=y,this.buffer[this.offset++]=P,this.buffer[this.offset++]=S,this.buffer[this.offset++]=M,this.buffer[this.offset++]=$}pushInstanceBuffer(e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b,x,y,P,S,M,$,T,w){this.buffer.length<this.offset+24&&this.resize(24),this.buffer[this.offset++]=e,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=s,this.buffer[this.offset++]=o,this.buffer[this.offset++]=i,this.buffer[this.offset++]=l,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=a,this.buffer[this.offset++]=h,this.buffer[this.offset++]=d,this.buffer[this.offset++]=g,this.buffer[this.offset++]=m,this.buffer[this.offset++]=f,this.buffer[this.offset++]=b,this.buffer[this.offset++]=x,this.buffer[this.offset++]=y,this.buffer[this.offset++]=P,this.buffer[this.offset++]=S,this.buffer[this.offset++]=M,this.buffer[this.offset++]=$,this.buffer[this.offset++]=T,this.buffer[this.offset++]=w}pushShapeBuffer(e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b,x,y,P,S,M,$,T,w,E,F,A,R,v,U,L,D){this.buffer.length<this.offset+32&&this.resize(32),this.buffer[this.offset++]=e,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=s,this.buffer[this.offset++]=o,this.buffer[this.offset++]=i,this.buffer[this.offset++]=l,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=a,this.buffer[this.offset++]=h,this.buffer[this.offset++]=d,this.buffer[this.offset++]=g,this.buffer[this.offset++]=m,this.buffer[this.offset++]=f,this.buffer[this.offset++]=b,this.buffer[this.offset++]=x,this.buffer[this.offset++]=y,this.buffer[this.offset++]=P,this.buffer[this.offset++]=S,this.buffer[this.offset++]=M,this.buffer[this.offset++]=$,this.buffer[this.offset++]=T,this.buffer[this.offset++]=w,this.buffer[this.offset++]=E,this.buffer[this.offset++]=F,this.buffer[this.offset++]=A,this.buffer[this.offset++]=R,this.buffer[this.offset++]=v,this.buffer[this.offset++]=U,this.buffer[this.offset++]=L,this.buffer[this.offset++]=D}pushTextFieldBuffer(e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b,x,y,P,S,M,$,T,w,E,F,A,R,v,U){this.buffer.length<this.offset+30&&this.resize(30),this.buffer[this.offset++]=e,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=s,this.buffer[this.offset++]=o,this.buffer[this.offset++]=i,this.buffer[this.offset++]=l,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=a,this.buffer[this.offset++]=h,this.buffer[this.offset++]=d,this.buffer[this.offset++]=g,this.buffer[this.offset++]=m,this.buffer[this.offset++]=f,this.buffer[this.offset++]=b,this.buffer[this.offset++]=x,this.buffer[this.offset++]=y,this.buffer[this.offset++]=P,this.buffer[this.offset++]=S,this.buffer[this.offset++]=M,this.buffer[this.offset++]=$,this.buffer[this.offset++]=T,this.buffer[this.offset++]=w,this.buffer[this.offset++]=E,this.buffer[this.offset++]=F,this.buffer[this.offset++]=A,this.buffer[this.offset++]=R,this.buffer[this.offset++]=v,this.buffer[this.offset++]=U}pushVideoBuffer(e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b,x,y,P,S,M,$,T,w,E,F,A){this.buffer.length<this.offset+27&&this.resize(27),this.buffer[this.offset++]=e,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=s,this.buffer[this.offset++]=o,this.buffer[this.offset++]=i,this.buffer[this.offset++]=l,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=a,this.buffer[this.offset++]=h,this.buffer[this.offset++]=d,this.buffer[this.offset++]=g,this.buffer[this.offset++]=m,this.buffer[this.offset++]=f,this.buffer[this.offset++]=b,this.buffer[this.offset++]=x,this.buffer[this.offset++]=y,this.buffer[this.offset++]=P,this.buffer[this.offset++]=S,this.buffer[this.offset++]=M,this.buffer[this.offset++]=$,this.buffer[this.offset++]=T,this.buffer[this.offset++]=w,this.buffer[this.offset++]=E,this.buffer[this.offset++]=F,this.buffer[this.offset++]=A}set(e){this.buffer.length<this.offset+e.length&&this.resize(e.length),this.buffer.set(e,this.offset),this.offset+=e.length}resize(e){const r=new Float32Array(Qu(this.offset+e));this.buffer.length&&r.set(this.buffer),this.buffer=r}}const Ve=new Zu;let Ju=class extends _e{count;constructor(e,r,n=!0){super(e,r,n),this.count=0}clear(){this.count=Ve.offset=0}};const Zt=()=>\`#version 300 es
188
190
 
189
191
  layout (location = 0) in vec2 a_vertex;
190
192
 
@@ -195,7 +197,7 @@ void main() {
195
197
 
196
198
  vec2 position = a_vertex * 2.0 - 1.0;
197
199
  gl_Position = vec4(position, 0.0, 1.0);
198
- }\`,zo=()=>\`#version 300 es
200
+ }\`,ef=()=>\`#version 300 es
199
201
 
200
202
  layout (location = 0) in vec2 a_vertex;
201
203
  uniform vec4 u_highp[3];
@@ -221,7 +223,7 @@ void main() {
221
223
 
222
224
  position = position * 2.0 - 1.0;
223
225
  gl_Position = vec4(position.x, -position.y, 0.0, 1.0);
224
- }\`,Vo=()=>\`#version 300 es
226
+ }\`,tf=()=>\`#version 300 es
225
227
 
226
228
  layout (location = 0) in vec2 a_vertex;
227
229
  uniform vec4 u_highp[2];
@@ -241,7 +243,7 @@ void main() {
241
243
 
242
244
  position = position * 2.0 - 1.0;
243
245
  gl_Position = vec4(position.x, -position.y, 0.0, 1.0);
244
- }\`,Wo=()=>\`#version 300 es
246
+ }\`,rf=()=>\`#version 300 es
245
247
 
246
248
  layout (location = 0) in vec2 a_vertex;
247
249
  layout (location = 1) in vec4 a_rect;
@@ -274,10 +276,10 @@ void main() {
274
276
 
275
277
  position = position * 2.0 - 1.0;
276
278
  gl_Position = vec4(position.x, -position.y, 0.0, 1.0);
277
- }\`,ot=new Map,He=()=>{if(ot.has("i"))return ot.get("i");const e=new Go(Wo(),Xo());return ot.set("i",e),e},jo=()=>\`
279
+ }\`,nt=new Map,js=()=>{if(nt.has("i"))return nt.get("i");const e=new Ju(rf(),qu());return nt.set("i",e),e},nf=()=>\`
278
280
  vec4 blend (in vec4 src, in vec4 dst) {
279
281
  return src + dst - dst * src.a;
280
- }\`,Ho=()=>\`
282
+ }\`,sf=()=>\`
281
283
  vec4 blend (in vec4 src, in vec4 dst) {
282
284
  if (src.a == 0.0) { return dst; }
283
285
  if (dst.a == 0.0) { return src; }
@@ -292,14 +294,14 @@ vec4 blend (in vec4 src, in vec4 dst) {
292
294
  c.rgb *= c.a;
293
295
 
294
296
  return a + b + c;
295
- }\`,Ko=()=>\`
297
+ }\`,of=()=>\`
296
298
  vec4 blend (in vec4 src, in vec4 dst) {
297
299
  vec4 a = src - src * dst.a;
298
300
  vec4 b = dst - dst * src.a;
299
301
  vec4 c = src * dst;
300
302
 
301
303
  return a + b + c;
302
- }\`,Zo=()=>\`
304
+ }\`,af=()=>\`
303
305
  vec4 blend (in vec4 src, in vec4 dst) {
304
306
  if (src.a == 0.0) { return dst; }
305
307
  if (dst.a == 0.0) { return src; }
@@ -314,7 +316,7 @@ vec4 blend (in vec4 src, in vec4 dst) {
314
316
  c.rgb *= c.a;
315
317
 
316
318
  return a + b + c;
317
- }\`,Qo=()=>\`
319
+ }\`,cf=()=>\`
318
320
  vec4 blend (in vec4 src, in vec4 dst) {
319
321
  if (src.a == 0.0) { return dst; }
320
322
  if (dst.a == 0.0) { return src; }
@@ -329,7 +331,7 @@ vec4 blend (in vec4 src, in vec4 dst) {
329
331
  c.rgb *= c.a;
330
332
 
331
333
  return a + b + c;
332
- }\`,Jo=()=>\`
334
+ }\`,lf=()=>\`
333
335
  vec4 blend (in vec4 src, in vec4 dst) {
334
336
  if (src.a == 0.0) { return dst; }
335
337
  if (dst.a == 0.0) { return src; }
@@ -347,7 +349,7 @@ vec4 blend (in vec4 src, in vec4 dst) {
347
349
  c.rgb *= c.a;
348
350
 
349
351
  return a + b + c;
350
- }\`,qo=()=>\`
352
+ }\`,uf=()=>\`
351
353
  vec4 blend (in vec4 src, in vec4 dst) {
352
354
  if (src.a == 0.0) { return dst; }
353
355
  if (dst.a == 0.0) { return src; }
@@ -365,7 +367,7 @@ vec4 blend (in vec4 src, in vec4 dst) {
365
367
  c.rgb *= c.a;
366
368
 
367
369
  return a + b + c;
368
- }\`,tr=()=>\`
370
+ }\`,ff=()=>\`
369
371
  vec4 blend (in vec4 src, in vec4 dst) {
370
372
  if (src.a == 0.0) { return dst; }
371
373
  if (dst.a == 0.0) { return src; }
@@ -380,7 +382,7 @@ vec4 blend (in vec4 src, in vec4 dst) {
380
382
  c.rgb *= c.a;
381
383
 
382
384
  return a + b + c;
383
- }\`,er=()=>\`
385
+ }\`,hf=()=>\`
384
386
  vec4 blend (in vec4 src, in vec4 dst) {
385
387
  if (src.a == 0.0) { return dst; }
386
388
  if (dst.a == 0.0) { return src; }
@@ -389,7 +391,7 @@ vec4 blend (in vec4 src, in vec4 dst) {
389
391
  vec4 c = vec4(src.a - dst.rgb * src.a, src.a);
390
392
 
391
393
  return b + c;
392
- }\`,sr=(t,e)=>{let s;switch(t){case"subtract":s=Ho();break;case"multiply":s=Ko();break;case"lighten":s=Zo();break;case"darken":s=Qo();break;case"overlay":s=Jo();break;case"hardlight":s=qo();break;case"difference":s=tr();break;case"invert":s=er();break;default:s=jo();break}const n="uniform vec4 u_mediump[2];",o=ic(0);return\`#version 300 es
394
+ }\`,df=(t,e)=>{let r;switch(t){case"subtract":r=sf();break;case"multiply":r=of();break;case"lighten":r=af();break;case"darken":r=cf();break;case"overlay":r=lf();break;case"hardlight":r=uf();break;case"difference":r=ff();break;case"invert":r=hf();break;default:r=nf();break}const n="uniform vec4 u_mediump[2];",s=zi(0);return\`#version 300 es
393
395
  precision mediump float;
394
396
 
395
397
  uniform sampler2D u_textures[2];
@@ -398,14 +400,14 @@ uniform sampler2D u_textures[2];
398
400
  in vec2 v_coord;
399
401
  out vec4 o_color;
400
402
 
401
- \${s}
403
+ \${r}
402
404
 
403
405
  void main() {
404
406
  vec4 dst = texture(u_textures[0], v_coord);
405
407
  vec4 src = texture(u_textures[1], v_coord);
406
- \${o}
408
+ \${s}
407
409
  o_color = blend(src, dst);
408
- }\`},hc=(t,e)=>{const s=\`i\${t}y\`;if(ot.has(s))return ot.get(s);const n=new Z(mt(),sr(t));return ot.set(s,n),n};let fc=0;const bc=()=>{const t=A.currentAttachmentObject,e=A.atlasAttachmentObject;if(A.bind(e),c.bindFramebuffer(c.DRAW_FRAMEBUFFER,Ae),Le(!1),fc===kt()){const s=Ys(kt());s[2]!==-Number.MAX_VALUE&&s[3]!==-Number.MAX_VALUE&&(c.enable(c.SCISSOR_TEST),c.scissor(s[0],s[1],s[2],s[3]),c.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,c.COLOR_BUFFER_BIT,c.NEAREST),c.disable(c.SCISSOR_TEST))}else{const s=Gs(kt());c.enable(c.SCISSOR_TEST),c.scissor(s[0],s[1],s[2],s[3]),c.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,c.COLOR_BUFFER_BIT,c.NEAREST),c.disable(c.SCISSOR_TEST),fc=kt()}t&&A.bind(t)},$c=t=>{const e=kt();pt(t.index),bc();const s=ln();c.bindFramebuffer(c.FRAMEBUFFER,s);const n=_s();c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,n.resource,0);const o=Us();c.bindFramebuffer(c.FRAMEBUFFER,o);const r=ee(t.w,t.h);return c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,r.resource,0),c.bindFramebuffer(c.FRAMEBUFFER,null),c.bindFramebuffer(c.READ_FRAMEBUFFER,s),c.bindFramebuffer(c.DRAW_FRAMEBUFFER,o),c.blitFramebuffer(t.x,t.y,t.x+t.w,t.y+t.h,0,0,t.w,t.h,c.COLOR_BUFFER_BIT,c.NEAREST),pt(e),c.bindFramebuffer(c.READ_FRAMEBUFFER,ft),c.bindFramebuffer(c.FRAMEBUFFER,ft),r},Oe=(t,e,s=!1)=>{st(2,c.TEXTURE2,null,s),st(1,c.TEXTURE1,e,s),st(0,c.TEXTURE0,t,s)},Ft=()=>{if(ot.has("p"))return ot.get("p");const e=new Z(Vo(),uc(!1));return ot.set("p",e),e},Tt=(t,e,s)=>{const n=t.highp,o=A.$matrix;n[0]=o[6],n[1]=o[7],n[2]=e,n[3]=s,n[4]=it(),n[5]=ut()},G=t=>{t.useProgram(),t.bindUniform(),$t(ge()),c.drawArrays(c.TRIANGLES,0,6)};let dt=null;const Ec=(t,e,s,n)=>{const o=A.currentAttachmentObject,r=A.$mainAttachmentObject;A.bind(r);const a=Us();return c.bindFramebuffer(c.FRAMEBUFFER,a),(!dt||dt.width!==r.width||dt.height!==r.height)&&(dt=ee(r.width,r.height)),z(dt),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,dt.resource,0),c.bindFramebuffer(c.FRAMEBUFFER,null),c.bindFramebuffer(c.READ_FRAMEBUFFER,ft),c.bindFramebuffer(c.DRAW_FRAMEBUFFER,a),c.enable(c.SCISSOR_TEST),c.scissor(t,r.height-e-n,s+1,n+1),c.blitFramebuffer(0,0,r.width,r.height,0,0,r.width,r.height,c.COLOR_BUFFER_BIT,c.NEAREST),c.disable(c.SCISSOR_TEST),c.bindFramebuffer(c.FRAMEBUFFER,ft),o&&A.bind(o),dt},Tc=(t,e,s,n)=>{const o=A.currentAttachmentObject,r=Ec(t,e,s,n),a=W(s,n,!1);A.bind(a),A.save(),A.setTransform(1,0,0,1,-t,-e);const l=Ft();Tt(l,r.width,r.height),j(),z(r),G(l);const h=a.texture;return A.restore(),V(a,!1),o&&A.bind(o),h},Yt=()=>{yt()!==610&&(Mt(610),c.blendFunc(c.ONE,c.ZERO))},Ac=t=>{z(t),Yt();const e=Ft();Tt(e,t.width,t.height),G(e),j()},xc=(t,e,s,n,o,r,a,l,h)=>{const f=t.textures;f[0]=0,f[1]=1;const i=t.mediump;i[0]=e,i[1]=s,i[2]=n,i[3]=o,i[4]=r,i[5]=a,i[6]=l,i[7]=h},me=(t=!1)=>{const e=\`m\${t?"y":"n"}\`;if(ot.has(e))return ot.get(e);const s=new Z(zo(),uc(t));return ot.set(e,s),s},Fe=(t,e,s)=>{const n=t.highp,o=A.$matrix;n[0]=o[0],n[1]=o[1],n[2]=o[3],n[3]=o[4],n[4]=o[6],n[5]=o[7],n[6]=e,n[7]=s,n[8]=it(),n[9]=ut()},cr=(t,e,s,n,o,r)=>{const a=r[0],l=r[1],h=r[2],f=A.globalAlpha,i=r[4]/255,E=r[5]/255,$=r[6]/255,v=0,T=A.$matrix;switch(A.globalCompositeOperation){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":{if(rc()!==A.globalCompositeOperation||Ws()!==t.index){pt(Ws());const g=A.globalCompositeOperation;A.globalCompositeOperation=rc(),A.drawArraysInstanced(),A.globalCompositeOperation=g,oc(A.globalCompositeOperation),Vs(t.index),pt(t.index)}const u=He();Ot.push(t.x/rt,t.y/rt,t.w/rt,t.h/rt,t.w,t.h,it(),ut(),T[6],T[7],T[0],T[1],T[3],T[4],a,l,h,f,i,E,$,v),u.count++}break;default:{const u=A.currentAttachmentObject;A.drawArraysInstanced();const g=Math.ceil(Math.abs(n-e)),I=Math.ceil(Math.abs(o-s));let d=0,C=0,m=$c(t);if(T[0]!==1||T[1]!==0||T[3]!==0||T[4]!==1){const w=W(g,I,!1),O=St(T[0],T[1],T[3],T[4],g/2,I/2),p=St(1,0,0,1,-t.w/2,-t.h/2),R=St(O[0]*p[0]+O[2]*p[1],O[1]*p[0]+O[3]*p[1],O[0]*p[2]+O[2]*p[3],O[1]*p[2]+O[3]*p[3],O[0]*p[4]+O[2]*p[5]+O[4],O[1]*p[4]+O[3]*p[5]+O[5]);A.save(),A.bind(w),A.setTransform(R[0],R[1],R[2],R[3],R[4],R[5]),d=R[4],C=R[5];const B=me();Fe(B,m.width,m.height),z(m,!0),G(B),D(m),m=w.texture,V(w,!1),u&&A.bind(u),A.restore()}(d||C)&&(T[6]-=d,T[7]-=C);const y=Tc(T[6],T[7],g,I),M=W(g,I,!1);A.bind(M),Oe(y,m);const S=hc(A.globalCompositeOperation);xc(S,a,l,h,f,i,E,$,v),G(S),u&&A.bind(u),Ac(M.texture),(d||C)&&(T[6]+=d,T[7]+=C),D(m),D(y),V(M),oc(A.globalCompositeOperation),Vs(t.index),pt(t.index)}break}},nr=()=>{He().clear()};let Ke=0;const or=()=>{$t(tc),c.bindBuffer(c.ARRAY_BUFFER,Ye),Ot.buffer.length>Ke&&(Ke=Ot.buffer.length,c.bufferData(c.ARRAY_BUFFER,Ke*4,c.DYNAMIC_DRAW)),c.bufferSubData(c.ARRAY_BUFFER,0,Ot.buffer.subarray(0,Ot.offset))},rr=t=>{t.useProgram(),t.bindUniform(),or(),c.drawArraysInstanced(c.TRIANGLES,0,6,t.count)},ar=()=>{yt()!==611&&(Mt(611),c.blendFunc(c.ONE,c.ONE))},lr=()=>{yt()!==641&&(Mt(641),c.blendFunc(c.ONE_MINUS_DST_COLOR,c.ONE))},ir=()=>{yt()!==606&&(Mt(606),c.blendFunc(c.ZERO,c.SRC_ALPHA))},Ze=()=>{yt()!==603&&(Mt(603),c.blendFunc(c.ZERO,c.ONE_MINUS_SRC_ALPHA))},vc=t=>{switch(t){case"add":ar();break;case"screen":lr();break;case"alpha":ir();break;case"erase":Ze();break;case"copy":Yt();break;default:j();break}},ur=()=>{const t=He();t.count&&(bc(),vc(A.globalCompositeOperation),rr(t),t.clear())},hr=()=>{const t=ye();return $t(t),c.bindBuffer(c.ARRAY_BUFFER,t.vertexBuffer),c.bufferData(c.ARRAY_BUFFER,new Float32Array([0,0,1,0,1,1,0,0,1,1,0,1]),c.STATIC_DRAW),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,c.FLOAT,!1,0,0),c.bindBuffer(c.ARRAY_BUFFER,Ye),c.bufferData(c.ARRAY_BUFFER,Ot.buffer.length,c.DYNAMIC_DRAW),c.enableVertexAttribArray(1),c.vertexAttribPointer(1,4,c.FLOAT,!1,88,0),c.vertexAttribDivisor(1,1),c.enableVertexAttribArray(2),c.vertexAttribPointer(2,4,c.FLOAT,!1,88,16),c.vertexAttribDivisor(2,1),c.enableVertexAttribArray(3),c.vertexAttribPointer(3,2,c.FLOAT,!1,88,32),c.vertexAttribDivisor(3,1),c.enableVertexAttribArray(4),c.vertexAttribPointer(4,4,c.FLOAT,!1,88,40),c.vertexAttribDivisor(4,1),c.enableVertexAttribArray(5),c.vertexAttribPointer(5,4,c.FLOAT,!1,88,56),c.vertexAttribDivisor(5,1),c.enableVertexAttribArray(6),c.vertexAttribPointer(6,4,c.FLOAT,!1,88,72),c.vertexAttribDivisor(6,1),t},fr=t=>{lo(t),io(hr())},br=()=>{const t=A.$mainAttachmentObject;A.bind(t),c.bindFramebuffer(c.READ_FRAMEBUFFER,ft),c.bindFramebuffer(c.DRAW_FRAMEBUFFER,null);const e=t.width,s=t.height;c.blitFramebuffer(0,0,e,s,0,0,e,s,c.COLOR_BUFFER_BIT,c.NEAREST),c.bindFramebuffer(c.DRAW_FRAMEBUFFER,ds),c.bindFramebuffer(c.FRAMEBUFFER,ft)},$r=()=>{c.enable(c.BLEND),j()},Er=()=>{const t=A.currentAttachmentObject;t&&(t.mask=!0,t.clipLevel++,ae.set(t.clipLevel,t.clipLevel),Ue()||(ve(!0),c.enable(c.STENCIL_TEST),c.enable(c.SAMPLE_ALPHA_TO_COVERAGE),c.stencilFunc(c.ALWAYS,0,255),c.stencilOp(c.ZERO,c.INVERT,c.INVERT),c.colorMask(!1,!1,!1,!1)))},Tr=(t,e,s,n)=>{const o=A.currentAttachmentObject;if(!o)return;re.set(o.clipLevel,vs(t,e,s,n));const r=Math.ceil(Math.abs(s-t)),a=Math.ceil(Math.abs(n-e));c.enable(c.SCISSOR_TEST),c.scissor(t,o.height-e-a,r,a)},Ar=()=>{const t=A.currentAttachmentObject;if(!t)return;const e=t.clipLevel,s=re.get(e),n=s[0],o=s[1],r=s[2],a=s[3];re.delete(e),ae.delete(e),Ms(s);const l=Math.ceil(Math.abs(r-n)),h=Math.ceil(Math.abs(a-o));if(c.enable(c.SCISSOR_TEST),c.scissor(n,t.height-o-h,l,h),--t.clipLevel,!t.clipLevel){t.mask=!1,ve(!1),c.clear(c.STENCIL_BUFFER_BIT),c.disable(c.STENCIL_TEST),c.disable(c.SCISSOR_TEST),ae.clear(),re.clear();return}c.stencilMask(1<<t.clipLevel),c.stencilFunc(c.ALWAYS,0,255),c.stencilOp(c.REPLACE,c.REPLACE,c.REPLACE),c.colorMask(!1,!1,!1,!1),nt(ze(),ge(),0,6),Pe()},Qe=(t,e,s,n=!1)=>{const o=ee(t,e,n);return c.texSubImage2D(c.TEXTURE_2D,0,0,0,t,e,c.RGBA,c.UNSIGNED_BYTE,s),o},xr=(t,e)=>{const s=Qe(t.w,t.h,e),n=Ft();Tt(n,t.w,t.h),j(),G(n),D(s)},vr=(t,e,s,n=!1)=>{const o=ee(t,e,n);return c.texSubImage2D(c.TEXTURE_2D,0,0,0,c.RGBA,c.UNSIGNED_BYTE,s),o},Mr=(t,e)=>{const s=vr(t.w,t.h,e),n=Ft();Tt(n,t.w,t.h),j(),G(n),D(s)},Rt=[],yr=(t,e,s,n,o,r)=>{const a=wt();if(!a.length)return;bt.push("bitmap");const l=Me(a);Pt(l.buffer),q.push(l.indexCount),Rt.push(t,e,s,n,o,r)},Rr=(t,e,s,n,o,r)=>{const a=wt(!0);if(!a.length)return;bt.push("bitmap");const l=Xe(a);Pt(l.buffer),q.push(l.indexCount),Rt.push(t,e,s,n,o,r)},gr=()=>{const t=wt(!0);if(!t.length)return;bt.push("fill");const e=Xe(t);Pt(e.buffer),q.push(e.indexCount)},pr=t=>{const e=t.toFixed(1);return\`#version 300 es
410
+ }\`},Yi=(t,e)=>{const r=\`i\${t}y\`;if(nt.has(r))return nt.get(r);const n=new _e(Zt(),df(t));return nt.set(r,n),n},Wi=()=>{if(!O.newDrawState)return;const t=O.currentAttachmentObject,e=O.atlasAttachmentObject;O.bind(e),p.bindFramebuffer(p.DRAW_FRAMEBUFFER,On),As(!1);const n=Ai(qt);It(),p.scissor(n[0],n[1],n[2]-n[0],n[3]-n[1]),p.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,p.COLOR_BUFFER_BIT,p.NEAREST),yt(),t&&O.bind(t),O.newDrawState=!1},ji=t=>{const e=qt;Qt(t.index),Wi(),p.bindFramebuffer(p.FRAMEBUFFER,Fs);const r=Pi();p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,r.resource,0),p.bindFramebuffer(p.FRAMEBUFFER,Zr);const n=Jr(t.w,t.h);return p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,n.resource,0),p.bindFramebuffer(p.FRAMEBUFFER,null),p.bindFramebuffer(p.READ_FRAMEBUFFER,Fs),p.bindFramebuffer(p.DRAW_FRAMEBUFFER,Zr),p.blitFramebuffer(t.x,t.y,t.x+t.w,t.y+t.h,0,0,t.w,t.h,p.COLOR_BUFFER_BIT,p.NEAREST),Qt(e),p.bindFramebuffer(p.READ_FRAMEBUFFER,Tt),p.bindFramebuffer(p.FRAMEBUFFER,Tt),n},_n=(t,e,r=!1)=>{Ke(2,p.TEXTURE2,null,r),Ke(1,p.TEXTURE1,e,r),Ke(0,p.TEXTURE0,t,r)},Jt=()=>{if(nt.has("p"))return nt.get("p");const e=new _e(tf(),Xi(!1));return nt.set("p",e),e},wt=(t,e,r)=>{const n=t.highp,s=O.$matrix;n[0]=s[6],n[1]=s[7],n[2]=e,n[3]=r,n[4]=pt,n[5]=mt},xe=t=>{t.useProgram(),t.bindUniform(),Pt(Ln()),p.drawArrays(p.TRIANGLES,0,6)};let er=null;const Hi=(t,e,r,n)=>{const s=O.currentAttachmentObject,o=O.$mainAttachmentObject;return O.bind(o),p.bindFramebuffer(p.FRAMEBUFFER,Zr),(!er||er.width!==o.width||er.height!==o.height)&&(er=Jr(o.width,o.height)),$e(er),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,er.resource,0),p.bindFramebuffer(p.FRAMEBUFFER,null),p.bindFramebuffer(p.READ_FRAMEBUFFER,Tt),p.bindFramebuffer(p.DRAW_FRAMEBUFFER,Zr),It(),p.scissor(t,o.height-e-n,r+1,n+1),p.blitFramebuffer(0,0,o.width,o.height,0,0,o.width,o.height,p.COLOR_BUFFER_BIT,p.NEAREST),yt(),p.bindFramebuffer(p.FRAMEBUFFER,Tt),s&&O.bind(s),er},Vn=(t,e,r,n)=>{const s=O.currentAttachmentObject,o=Hi(t,e,r,n),i=we(r,n,!1);O.bind(i),O.save(),O.setTransform(1,0,0,1,-t,-e);const l=Jt();wt(l,o.width,o.height),Ce(),$e(o),xe(l);const c=i.texture;return O.restore(),be(i,!1),s&&O.bind(s),c},Tr=()=>{Ft!==610&&(_t(610),p.blendFunc(p.ONE,p.ZERO))},Ki=t=>{$e(t),Tr();const e=Jt();wt(e,t.width,t.height),xe(e),Ce()},qi=(t,e,r,n,s,o,i,l,c)=>{const u=t.textures;u[0]=0,u[1]=1;const a=t.mediump;a[0]=e,a[1]=r,a[2]=n,a[3]=s,a[4]=o,a[5]=i,a[6]=l,a[7]=c},Dn=(t=!1)=>{const e=\`m\${t?"y":"n"}\`;if(nt.has(e))return nt.get(e);const r=new _e(ef(),Xi(t));return nt.set(e,r),r},Nn=(t,e,r)=>{const n=t.highp,s=O.$matrix;n[0]=s[0],n[1]=s[1],n[2]=s[3],n[3]=s[4],n[4]=s[6],n[5]=s[7],n[6]=e,n[7]=r,n[8]=pt,n[9]=mt},pf=(t,e,r,n,s,o)=>{const i=o[0],l=o[1],c=o[2],u=O.globalAlpha,a=o[4]/255,h=o[5]/255,d=o[6]/255,g=0,m=O.$matrix;switch(O.globalCompositeOperation){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":{if(In!==O.globalCompositeOperation||Cs!==t.index){Qt(Cs);const b=O.globalCompositeOperation;O.globalCompositeOperation=In,O.newDrawState=!0,O.drawArraysInstanced(),O.newDrawState=!0,O.globalCompositeOperation=b,Di(O.globalCompositeOperation),Fi(t.index),Qt(t.index)}const f=js();Ve.pushDisplayObjectBuffer((t.x+.5)/ut,(t.y+.5)/ut,(t.w-1)/ut,(t.h-1)/ut,t.w,t.h,pt,mt,m[6],m[7],m[0],m[1],m[3],m[4],i,l,c,u,a,h,d,g),f.count++}break;default:{const f=O.currentAttachmentObject;O.drawArraysInstanced();const b=Math.ceil(Math.abs(n-e)),x=Math.ceil(Math.abs(s-r));let y=0,P=0,S=ji(t);if(m[0]!==1||m[1]!==0||m[3]!==0||m[4]!==1){const w=we(b,x,!1),E=dr(m[0],m[1],m[3],m[4],b/2,x/2),F=dr(1,0,0,1,-t.w/2,-t.h/2),A=dr(E[0]*F[0]+E[2]*F[1],E[1]*F[0]+E[3]*F[1],E[0]*F[2]+E[2]*F[3],E[1]*F[2]+E[3]*F[3],E[0]*F[4]+E[2]*F[5]+E[4],E[1]*F[4]+E[3]*F[5]+E[5]);O.save(),O.bind(w),O.setTransform(A[0],A[1],A[2],A[3],A[4],A[5]),y=A[4],P=A[5];const R=Dn();Nn(R,S.width,S.height),$e(S,!0),xe(R),ae(S),S=w.texture,be(w,!1),f&&O.bind(f),O.restore()}(y||P)&&(m[6]-=y,m[7]-=P);const M=Vn(m[6],m[7],b,x),$=we(b,x,!1);O.bind($),_n(M,S);const T=Yi(O.globalCompositeOperation);qi(T,i,l,c,u,a,h,d,g),xe(T),f&&O.bind(f),Ki($.texture),(y||P)&&(m[6]+=y,m[7]+=P),ae(S),ae(M),be($),Di(O.globalCompositeOperation),Fi(t.index),Qt(t.index)}break}},mf=()=>{js().clear()};let Hs=0;const gf=()=>{Pt(ki),p.bindBuffer(p.ARRAY_BUFFER,Vs),Ve.buffer.length>Hs&&(Hs=Ve.buffer.length,p.bufferData(p.ARRAY_BUFFER,Hs*4,p.STREAM_DRAW)),p.bufferSubData(p.ARRAY_BUFFER,0,Ve.buffer,0,Ve.offset)},bf=t=>{t.useProgram(),t.bindUniform(),gf(),p.drawArraysInstanced(p.TRIANGLES,0,6,t.count)},xf=()=>{Ft!==611&&(_t(611),p.blendFunc(p.ONE,p.ONE))},yf=()=>{Ft!==641&&(_t(641),p.blendFunc(p.ONE_MINUS_DST_COLOR,p.ONE))},vf=()=>{Ft!==606&&(_t(606),p.blendFunc(p.ZERO,p.SRC_ALPHA))},Ks=()=>{Ft!==603&&(_t(603),p.blendFunc(p.ZERO,p.ONE_MINUS_SRC_ALPHA))},Qi=t=>{switch(t){case"add":xf();break;case"screen":yf();break;case"alpha":vf();break;case"erase":Ks();break;case"copy":Tr();break;default:Ce();break}},Mf=()=>{const t=js();t.count&&(Wi(),Qi(In),bf(t),t.clear())},Sf=()=>{const t=Un();return Pt(t),p.bindBuffer(p.ARRAY_BUFFER,t.vertexBuffer),p.bufferData(p.ARRAY_BUFFER,new Float32Array([0,0,1,0,1,1,0,0,1,1,0,1]),p.STATIC_DRAW),p.enableVertexAttribArray(0),p.vertexAttribPointer(0,2,p.FLOAT,!1,0,0),p.bindBuffer(p.ARRAY_BUFFER,Vs),p.bufferData(p.ARRAY_BUFFER,Ve.buffer.length,p.STREAM_DRAW),p.enableVertexAttribArray(1),p.vertexAttribPointer(1,4,p.FLOAT,!1,88,0),p.vertexAttribDivisor(1,1),p.enableVertexAttribArray(2),p.vertexAttribPointer(2,4,p.FLOAT,!1,88,16),p.vertexAttribDivisor(2,1),p.enableVertexAttribArray(3),p.vertexAttribPointer(3,2,p.FLOAT,!1,88,32),p.vertexAttribDivisor(3,1),p.enableVertexAttribArray(4),p.vertexAttribPointer(4,4,p.FLOAT,!1,88,40),p.vertexAttribDivisor(4,1),p.enableVertexAttribArray(5),p.vertexAttribPointer(5,4,p.FLOAT,!1,88,56),p.vertexAttribDivisor(5,1),p.enableVertexAttribArray(6),p.vertexAttribPointer(6,4,p.FLOAT,!1,88,72),p.vertexAttribDivisor(6,1),t},$f=t=>{vu(t),Mu(Sf())},Tf=()=>{const t=O.$mainAttachmentObject;O.bind(t),p.bindFramebuffer(p.READ_FRAMEBUFFER,Tt),p.bindFramebuffer(p.DRAW_FRAMEBUFFER,null);const e=t.width,r=t.height;p.blitFramebuffer(0,0,e,r,0,0,e,r,p.COLOR_BUFFER_BIT,p.NEAREST),p.bindFramebuffer(p.DRAW_FRAMEBUFFER,vi),p.bindFramebuffer(p.FRAMEBUFFER,Tt)},Bf=()=>{p.enable(p.BLEND),Ce()},Pf=()=>{const t=O.currentAttachmentObject;t&&(t.mask=!0,t.clipLevel++,rn.set(t.clipLevel,t.clipLevel),Gs()||(Rn(!0),Yr(),p.enable(p.SAMPLE_ALPHA_TO_COVERAGE),p.stencilFunc(p.ALWAYS,0,255),p.stencilOp(p.ZERO,p.INVERT,p.INVERT),p.colorMask(!1,!1,!1,!1)))},Af=(t,e,r,n)=>{const s=O.currentAttachmentObject;if(!s)return;tn.set(s.clipLevel,hi(t,e,r,n));const o=Math.ceil(Math.abs(r-t)),i=Math.ceil(Math.abs(n-e));It(),p.scissor(t,s.height-e-i,o,i)},Ff=()=>{const t=O.currentAttachmentObject;if(!t)return;const e=t.clipLevel,r=tn.get(e),n=r[0],s=r[1],o=r[2],i=r[3];tn.delete(e),rn.delete(e),di(r);const l=Math.ceil(Math.abs(o-n)),c=Math.ceil(Math.abs(i-s));if(It(),p.scissor(n,t.height-s-c,l,c),--t.clipLevel,!t.clipLevel){t.mask=!1,Rn(!1),p.clear(p.STENCIL_BUFFER_BIT),Wr(),yt(),rn.clear(),tn.clear();return}p.stencilMask(1<<t.clipLevel),p.stencilFunc(p.ALWAYS,0,255),p.stencilOp(p.REPLACE,p.REPLACE,p.REPLACE),p.colorMask(!1,!1,!1,!1),rt(Ns(),Ln(),0,6),Us()},qs=(t,e,r,n=!1)=>{const s=Jr(t,e,n);return p.texSubImage2D(p.TEXTURE_2D,0,0,0,t,e,p.RGBA,p.UNSIGNED_BYTE,r),s},wf=(t,e)=>{const r=qs(t.w,t.h,e),n=Jt();wt(n,t.w,t.h),Ce(),xe(n),ae(r)},Of=(t,e,r,n=!1)=>{const s=Jr(t,e,n);return p.texSubImage2D(p.TEXTURE_2D,0,0,0,p.RGBA,p.UNSIGNED_BYTE,r),s},Ef=(t,e)=>{const r=Of(t.w,t.h,e),n=Jt();wt(n,t.w,t.h),Ce(),xe(n),ae(r)},Vt=[],Rf=(t,e,r,n,s,o)=>{const i=pr();if(!i.length)return;Bt.push("bitmap");const l=Cn(i);yr(l.buffer),We.push(l.indexCount),Vt.push(t,e,r,n,s,o)},Cf=(t,e,r,n,s,o)=>{const i=pr(!0);if(!i.length)return;Bt.push("bitmap");const l=Is(i);yr(l.buffer),We.push(l.indexCount),Vt.push(t,e,r,n,s,o)},Uf=()=>{const t=pr(!0);if(!t.length)return;Bt.push("fill");const e=Is(t);yr(e.buffer),We.push(e.indexCount)},Gf=t=>{const e=t.toFixed(1);return\`#version 300 es
409
411
  precision mediump float;
410
412
 
411
413
  uniform sampler2D u_texture;
@@ -430,7 +432,7 @@ void main() {
430
432
  color /= samples;
431
433
 
432
434
  o_color = color;
433
- }\`},Q=new Map,Or=t=>{const e=\`b\${t}\`;if(Q.has(e))return Q.get(e);const s=new Z(mt(),pr(t));return Q.set(e,s),s},mr=(t,e,s,n,o,r)=>{const a=t.mediump;n?(a[0]=1/e,a[1]=0):(a[0]=0,a[1]=1/s),a[2]=o,a[3]=r},Mc=(t,e,s)=>{z(t,!0);const n=Math.ceil(s*.5),o=1-(n-s*.5),r=1+s,a=Or(n);mr(a,t.width,t.height,e,o,r),G(a)},U={x:0,y:0},Gt=(t,e,s)=>(t>>16)*(s?e:1)/255,zt=(t,e,s)=>(t>>8&255)*(s?e:1)/255,Vt=(t,e,s)=>(t&255)*(s?e:1)/255,Fr=[.5,1.05,1.4,1.55,1.75,1.9,2,2.15,2.2,2.3,2.5,3,3,3.5,3.5],Wt=(t,e,s=4,n=4,o=1,r=!0)=>{const a=A.currentAttachmentObject,l=Math.sqrt(e[0]*e[0]+e[1]*e[1]),h=Math.sqrt(e[2]*e[2]+e[3]*e[3]),f=gt(),i=s*(l/f),E=n*(h/f),$=Fr[o-1],v=Math.round(i*$),T=Math.round(E*$);U.x+=v,U.y+=T;const u=t.width+v*2,g=t.height+T*2;let I=1,d=1;i>128?I=.0625:i>64?I=.125:i>32?I=.25:i>16&&(I=.5),E>128?d=.0625:E>64?d=.125:E>32?d=.25:E>16&&(d=.5);const C=Math.ceil(u*I),m=Math.ceil(g*d),y=W(C,m,!1),M=W(C,m,!1),S=[y,M];A.bind(y),A.reset(),A.setTransform(I,0,0,d,v*I,T*d),z(t);const w=me();Fe(w,t.width,t.height),G(w),r&&D(t);const O=i*I,p=E*d;let R=0,B=y.texture;z(B,!0),Yt();for(let b=0;b<o;++b){if(s>0){R=(R+1)%2;const L=S[R];A.bind(L),Mc(B,!0,O),B=L.texture}if(n>0){R=(R+1)%2;const L=S[R];A.bind(L),Mc(B,!1,p),B=L.texture}}if(j(),I!==1||d!==1){const b=W(u,g,!1);A.bind(b),A.setTransform(1/I,0,0,1/d,0,0),z(B,!0),Fe(w,B.width,B.height),G(w),B=b.texture,V(S[0]),V(S[1]),V(b,!1)}else R=(R+1)%2,V(S[R]),R=(R+1)%2,V(S[R],!1);return a&&A.bind(a),B},dr=()=>\`#version 300 es
435
+ }\`},De=new Map,Lf=t=>{const e=\`b\${t}\`;if(De.has(e))return De.get(e);const r=new _e(Zt(),Gf(t));return De.set(e,r),r},kf=(t,e,r,n,s,o)=>{const i=t.mediump;n?(i[0]=1/e,i[1]=0):(i[0]=0,i[1]=1/r),i[2]=s,i[3]=o},Zi=(t,e,r)=>{$e(t,!0);const n=Math.ceil(r*.5),s=1-(n-r*.5),o=1+r,i=Lf(n);kf(i,t.width,t.height,e,s,o),xe(i)},re={x:0,y:0},Br=(t,e,r)=>(t>>16)*(r?e:1)/255,Pr=(t,e,r)=>(t>>8&255)*(r?e:1)/255,Ar=(t,e,r)=>(t&255)*(r?e:1)/255,If=[.5,1.05,1.4,1.55,1.75,1.9,2,2.15,2.2,2.3,2.5,3,3,3.5,3.5],tr=(t,e,r=4,n=4,s=1,o=!0)=>{const i=O.currentAttachmentObject,l=Math.sqrt(e[0]*e[0]+e[1]*e[1]),c=Math.sqrt(e[2]*e[2]+e[3]*e[3]),u=vt,a=r*(l/u),h=n*(c/u),d=If[s-1],g=Math.round(a*d),m=Math.round(h*d);re.x+=g,re.y+=m;const f=t.width+g*2,b=t.height+m*2;let x=1,y=1;a>128?x=.0625:a>64?x=.125:a>32?x=.25:a>16&&(x=.5),h>128?y=.0625:h>64?y=.125:h>32?y=.25:h>16&&(y=.5);const P=Math.ceil(f*x),S=Math.ceil(b*y),M=we(P,S,!1),$=we(P,S,!1),T=[M,$];O.bind(M),O.reset(),O.setTransform(x,0,0,y,g*x,m*y),$e(t);const w=Dn();Nn(w,t.width,t.height),xe(w),o&&ae(t);const E=a*x,F=h*y;let A=0,R=M.texture;$e(R,!0),Tr();for(let v=0;v<s;++v){if(r>0){A=(A+1)%2;const U=T[A];O.bind(U),Zi(R,!0,E),R=U.texture}if(n>0){A=(A+1)%2;const U=T[A];O.bind(U),Zi(R,!1,F),R=U.texture}}if(Ce(),x!==1||y!==1){const v=we(f,b,!1);O.bind(v),O.setTransform(1/x,0,0,1/y,0,0),$e(R,!0),Nn(w,R.width,R.height),xe(w),R=v.texture,be(T[0]),be(T[1]),be(v,!1)}else A=(A+1)%2,be(T[A]),A=(A+1)%2,be(T[A],!1);return i&&O.bind(i),R},_f=()=>\`#version 300 es
434
436
  precision mediump float;
435
437
 
436
438
  uniform sampler2D u_texture;
@@ -450,51 +452,51 @@ void main() {
450
452
  color.rgb *= color.a;
451
453
 
452
454
  o_color = color;
453
- }\`,Sr=()=>{if(Q.has("m"))return Q.get("m");const e=new Z(mt(),dr());return Q.set("m",e),e},wr=(t,e)=>{const s=t.mediump;s[0]=e[0],s[1]=e[1],s[2]=e[2],s[3]=e[3],s[4]=e[5],s[5]=e[6],s[6]=e[7],s[7]=e[8],s[8]=e[10],s[9]=e[11],s[10]=e[12],s[11]=e[13],s[12]=e[15],s[13]=e[16],s[14]=e[17],s[15]=e[18],s[16]=e[4]/255,s[17]=e[9]/255,s[18]=e[14]/255,s[19]=e[19]/255},Br=(t,e)=>{const s=A.currentAttachmentObject,n=W(t.width,t.height,!1);A.bind(n),A.reset(),A.setTransform(1,0,0,1,0,0),z(t),j();const o=Sr();wr(o,e),G(o);const r=n.texture;return D(t),V(n,!1),s&&A.bind(s),r},Ir=(t,e,s=!1)=>{st(2,c.TEXTURE2,e,s),st(1,c.TEXTURE1,null),st(0,c.TEXTURE0,t,s)},Cr=(t,e,s,n=!1)=>{st(2,c.TEXTURE2,s,n),st(1,c.TEXTURE1,e,n),st(0,c.TEXTURE0,t,n)},Lr=()=>{yt()!==670&&(Mt(670),c.blendFunc(c.DST_ALPHA,c.ZERO))},kr=()=>{yt()!==673&&(Mt(673),c.blendFunc(c.DST_ALPHA,c.ONE_MINUS_SRC_ALPHA))},Nr=t=>\`
455
+ }\`,Vf=()=>{if(De.has("m"))return De.get("m");const e=new _e(Zt(),_f());return De.set("m",e),e},Df=(t,e)=>{const r=t.mediump;r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[5],r[5]=e[6],r[6]=e[7],r[7]=e[8],r[8]=e[10],r[9]=e[11],r[10]=e[12],r[11]=e[13],r[12]=e[15],r[13]=e[16],r[14]=e[17],r[15]=e[18],r[16]=e[4]/255,r[17]=e[9]/255,r[18]=e[14]/255,r[19]=e[19]/255},Ji=(t,e)=>{const r=O.currentAttachmentObject,n=we(t.width,t.height,!1);O.bind(n),O.reset(),O.setTransform(1,0,0,1,0,0),$e(t),Ce();const s=Vf();Df(s,e),xe(s);const o=n.texture;return ae(t),be(n,!1),r&&O.bind(r),o},Nf=(t,e,r=!1)=>{Ke(2,p.TEXTURE2,e,r),Ke(1,p.TEXTURE1,null),Ke(0,p.TEXTURE0,t,r)},zf=(t,e,r,n=!1)=>{Ke(2,p.TEXTURE2,r,n),Ke(1,p.TEXTURE1,e,n),Ke(0,p.TEXTURE0,t,n)},Xf=()=>{Ft!==670&&(_t(670),p.blendFunc(p.DST_ALPHA,p.ZERO))},Yf=()=>{Ft!==673&&(_t(673),p.blendFunc(p.DST_ALPHA,p.ONE_MINUS_SRC_ALPHA))},Wf=t=>\`
454
456
  vec2 base_scale = u_mediump[\${t}].xy;
455
457
  vec2 base_offset = u_mediump[\${t}].zw;
456
458
 
457
459
  vec2 uv = v_coord * base_scale - base_offset;
458
460
  vec4 base = mix(vec4(0.0), texture(u_textures[1], uv), isInside(uv));
459
- \`,Pr=()=>\`
461
+ \`,jf=()=>\`
460
462
  vec4 blur = texture(u_textures[0], v_coord);
461
- \`,Ur=t=>\`
463
+ \`,Hf=t=>\`
462
464
  vec2 blur_scale = u_mediump[\${t}].xy;
463
465
  vec2 blur_offset = u_mediump[\${t}].zw;
464
466
 
465
467
  vec2 st = v_coord * blur_scale - blur_offset;
466
468
  vec4 blur = mix(vec4(0.0), texture(u_textures[0], st), isInside(st));
467
- \`,Dr=t=>{const e=Math.floor(t/4),s=t%4;return\`
468
- float strength = u_mediump[\${e}][\${s}];
469
+ \`,Kf=t=>{const e=Math.floor(t/4),r=t%4;return\`
470
+ float strength = u_mediump[\${e}][\${r}];
469
471
  blur.a = clamp(blur.a * strength, 0.0, 1.0);
470
- \`},Xr=t=>\`
472
+ \`},qf=t=>\`
471
473
  vec4 color = u_mediump[\${t}];
472
474
  blur = color * blur.a;
473
- \`,_r=t=>\`
475
+ \`,Qf=t=>\`
474
476
  blur = texture(u_textures[\${t?2:1}], vec2(blur.a, 0.5));
475
- \`,yc=(t,e,s,n,o,r)=>{const a=t?"blur.a = 1.0 - blur.a;":"",l=s?Dr(r):"",h=n?_r(e):Xr(o);return\`
476
- \${a}
477
+ \`,ea=(t,e,r,n,s,o)=>{const i=t?"blur.a = 1.0 - blur.a;":"",l=r?Kf(o):"",c=n?Qf(e):qf(s);return\`
478
+ \${i}
477
479
  \${l}
478
- \${h}
479
- \`},Yr=()=>\`
480
+ \${c}
481
+ \`},Zf=()=>\`
480
482
  vec4 blur2 = texture(u_textures[0], 1.0 - v_coord);
481
- \`,Gr=()=>\`
483
+ \`,Jf=()=>\`
482
484
  vec2 pq = (1.0 - v_coord) * blur_scale - blur_offset;
483
485
  vec4 blur2 = mix(vec4(0.0), texture(u_textures[0], pq), isInside(pq));
484
- \`,zr=t=>{const e=Math.floor(t/4),s=t%4;return\`
485
- float strength = u_mediump[\${e}][\${s}];
486
+ \`,eh=t=>{const e=Math.floor(t/4),r=t%4;return\`
487
+ float strength = u_mediump[\${e}][\${r}];
486
488
  highlight_alpha *= strength;
487
489
  shadow_alpha *= strength;
488
- \`},Vr=t=>\`
490
+ \`},th=t=>\`
489
491
  vec4 highlight_color = u_mediump[\${t}];
490
492
  vec4 shadow_color = u_mediump[\${t+1}];
491
493
  blur = highlight_color * highlight_alpha + shadow_color * shadow_alpha;
492
- \`,Wr=t=>\`
494
+ \`,rh=t=>\`
493
495
  blur = texture(u_textures[\${t?2:1}], vec2(
494
496
  0.5019607843137255 - 0.5019607843137255 * shadow_alpha + 0.4980392156862745 * highlight_alpha,
495
497
  0.5
496
498
  ));
497
- \`,jr=(t,e,s,n,o,r,a,l,h)=>{let f=0;const i=s?Nr(f++):"",E=n?Ur(f++):Pr(),$=r==="inner",v=f;let T=f*4,u;h?u=o?yc(!1,s,l,h,v,T):Rc(s,n,l,h,v,T):o?(T+=4,u=yc($,s,l,h,v,T)):(T+=8,u=Rc(s,n,l,h,v,T));let g;switch(r){case"outer":g=a?"blur - blur * base.a":"base + blur - blur * base.a";break;case"full":g=a?"blur":"base - base * blur.a + blur";break;case"inner":default:g="blur";break}return\`#version 300 es
499
+ \`,nh=(t,e,r,n,s,o,i,l,c)=>{let u=0;const a=r?Wf(u++):"",h=n?Hf(u++):jf(),d=o==="inner",g=u;let m=u*4,f;c?f=s?ea(!1,r,l,c,g,m):ta(r,n,l,c,g,m):s?(m+=4,f=ea(d,r,l,c,g,m)):(m+=8,f=ta(r,n,l,c,g,m));let b;switch(o){case"outer":b=i?"blur - blur * base.a":"base + blur - blur * base.a";break;case"full":b=i?"blur":"base - base * blur.a + blur";break;default:b="blur";break}return\`#version 300 es
498
500
  precision mediump float;
499
501
 
500
502
  uniform sampler2D u_textures[\${t}];
@@ -503,26 +505,26 @@ uniform vec4 u_mediump[\${e}];
503
505
  in vec2 v_coord;
504
506
  out vec4 o_color;
505
507
 
506
- \${je()}
508
+ \${Ws()}
507
509
 
508
510
  void main() {
509
- \${i}
510
- \${E}
511
- \${u}
512
- o_color = \${g};
513
- }\`},Rc=(t,e,s,n,o,r)=>{const a=e?Gr():Yr(),l=s?zr(r):"",h=n?Wr(t):Vr(o);return\`
514
511
  \${a}
512
+ \${h}
513
+ \${f}
514
+ o_color = \${b};
515
+ }\`},ta=(t,e,r,n,s,o)=>{const i=e?Jf():Zf(),l=r?eh(o):"",c=n?rh(t):th(s);return\`
516
+ \${i}
515
517
  float highlight_alpha = blur.a - blur2.a;
516
518
  float shadow_alpha = blur2.a - blur.a;
517
519
  \${l}
518
520
  highlight_alpha = clamp(highlight_alpha, 0.0, 1.0);
519
521
  shadow_alpha = clamp(shadow_alpha, 0.0, 1.0);
520
- \${h}
521
- \`},Hr=(t,e,s,n,o,r,a)=>{const $=\`f\${t?"y":"n"}\${e?"y":"n"}\${s?"y":"n"}\${n}\${o?"y":"n"}\${r?"y":"n"}\`;if(Q.has($))return Q.get($);let v=1;t&&v++,a&&v++;let T=(t?4:0)+(e?4:0)+(r?1:0);a||(T+=s?4:8),T=Math.ceil(T/4);const u=new Z(mt(),jr(v,T,t,e,s,n,o,r,a));return Q.set($,u),u},Kr=(t,e,s,n,o,r,a,l,h,f,i,E,$,v,T,u,g,I,d,C,m,y,M,S,w)=>{let O;y?(O=t.textures,O[0]=0,O[1]=1,w&&(O[2]=2)):w&&(O=t.textures,O[0]=0,O[1]=2);const p=t.mediump;let R=0;y&&(p[R++]=e/n,p[R++]=s/o,p[R++]=r/n,p[R++]=(s-o-a)/o),M&&(p[R++]=e/l,p[R++]=s/h,p[R++]=f/l,p[R++]=(s-h-i)/h),w||(E?(p[R++]=v,p[R++]=T,p[R++]=u,p[R++]=g):(p[R++]=v,p[R++]=T,p[R++]=u,p[R++]=g,p[R++]=I,p[R++]=d,p[R++]=C,p[R++]=m)),S&&(p[R]=$)},Je=new Map,Zr=(t,e,s)=>{let n="";for(let r=1;r<e;++r){const a=r-1,l=r,h=\`u_mediump[\${e+Math.floor(a/4)}][\${a%4}]\`,f=\`u_mediump[\${e+Math.floor(l/4)}][\${l%4}]\`,i=\`u_mediump[\${a}]\`,E=\`u_mediump[\${l}]\`;n+=\`
522
- if (t <= \${f}) {
523
- return mix(\${i}, \${E}, (t - \${h}) / (\${f} - \${h}));
522
+ \${c}
523
+ \`},sh=(t,e,r,n,s,o,i)=>{const g=\`f\${t?"y":"n"}\${e?"y":"n"}\${r?"y":"n"}\${n}\${s?"y":"n"}\${o?"y":"n"}\${i?"y":"n"}\`;if(De.has(g))return De.get(g);let m=1;t&&m++,i&&m++;let f=(t?4:0)+(e?4:0)+(o?1:0);i||(f+=r?4:8),f=Math.ceil(f/4);const b=new _e(Zt(),nh(m,f,t,e,r,n,s,o,i));return De.set(g,b),b},oh=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b,x,y,P,S,M,$,T,w)=>{let E;M?(E=t.textures,E[0]=0,E[1]=1,w&&(E[2]=2)):w&&(E=t.textures,E[0]=0,E[1]=2);const F=t.mediump;let A=0;M&&(F[A++]=e/n,F[A++]=r/s,F[A++]=o/n,F[A++]=(r-s-i)/s),$&&(F[A++]=e/l,F[A++]=r/c,F[A++]=u/l,F[A++]=(r-c-a)/c),w||(h?(F[A++]=g,F[A++]=m,F[A++]=f,F[A++]=b):(F[A++]=g,F[A++]=m,F[A++]=f,F[A++]=b,F[A++]=x,F[A++]=y,F[A++]=P,F[A++]=S)),T&&(F[A]=d)},ih=16,zn=new Map,Dt=[],ah=(t,e)=>{const r=Dt.indexOf(t);for(r!==-1&&Dt.splice(r,1);zn.size>=ih&&Dt.length>0;){const n=Dt.shift();n&&zn.delete(n)}zn.set(t,e),Dt.push(t)},ch=t=>{const e=zn.get(t);if(e){const r=Dt.indexOf(t);r!==-1&&(Dt.splice(r,1),Dt.push(t))}return e},lh=(t,e,r)=>{let n="";for(let o=1;o<e;++o){const i=o-1,l=o,c=\`u_mediump[\${e+Math.floor(i/4)}][\${i%4}]\`,u=\`u_mediump[\${e+Math.floor(l/4)}][\${l%4}]\`,a=\`u_mediump[\${i}]\`,h=\`u_mediump[\${l}]\`;n+=\`
524
+ if (t <= \${u}) {
525
+ return mix(\${a}, \${h}, (t - \${c}) / (\${u} - \${c}));
524
526
  }
525
- \`}const o=s?"color = pow(color, vec4(0.45454545));":"";return\`#version 300 es
527
+ \`}const s=r?"color = pow(color, vec4(0.45454545));":"";return\`#version 300 es
526
528
  precision mediump float;
527
529
 
528
530
  uniform vec4 u_mediump[\${t}];
@@ -540,13 +542,13 @@ vec4 getGradientColor(in float t) {
540
542
 
541
543
  void main() {
542
544
  vec4 color = getGradientColor(v_coord.x);
543
- \${o}
545
+ \${s}
544
546
  color.rgb *= color.a;
545
547
 
546
548
  o_color = color;
547
- }\`},gc=(t,e)=>{const o=\`l\${("00"+t).slice(-3)}\${e?"y":"n"}\`;if(Je.has(o))return Je.get(o);const r=Math.ceil(t*5/4),a=new Z(mt(),Zr(r,t,e));return Je.set(o,a),a},Qr=(t,e,s,n,o,r)=>{const a=t.mediump;let l=0;for(let h=o;h<r;h++){const f=s[h];a[l++]=(f>>16)/255,a[l++]=(f>>8&255)/255,a[l++]=(f&255)/255,a[l++]=n[h]}for(let h=o;h<r;h++)a[l++]=e[h]/255},Jr=(t,e)=>{const s=ye();return $t(s),c.bindBuffer(c.ARRAY_BUFFER,s.vertexBuffer),ct[0]=t,ct[2]=t,ct[4]=e,ct[6]=e,c.bufferData(c.ARRAY_BUFFER,ct,c.STATIC_DRAW),c.enableVertexAttribArray(0),c.vertexAttribPointer(0,2,c.FLOAT,!1,0,0),s};let qe;const qr=(t,e)=>(qe?(ct[0]!==t||ct[4]!==e)&&(ct[0]=t,ct[2]=t,ct[4]=e,ct[6]=e,c.bufferSubData(c.ARRAY_BUFFER,0,ct)):qe=Jr(t,e),qe),pc=(t,e,s)=>{t.useProgram(),t.bindUniform(),$t(qr(e,s)),c.drawArrays(c.TRIANGLE_STRIP,0,4)};let ts=null;const Oc=()=>(ts||(ts=W(512,1,!1)),ts);let mc=0;const Fc=()=>mc,ta=t=>{mc=Math.floor(t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS)*.75)},dc=new Float32Array(256),Sc=new Float32Array(256);for(let t=0;t<256;++t){const e=t/255;dc[t]=Math.pow(e,2.23333333),Sc[t]=e}const ea=(t,e,s)=>{const n=A.currentAttachmentObject,o=Oc();A.bind(o);const r=t.length;Yt();const a=Fc();for(let l=0;l<r;l+=a-1){const h=Math.min(l+a,r),f=gc(h-l,!1);Qr(f,t,e,s,l,h),pc(f,t[l]/255,t[h-1]/255)}return j(),n&&A.bind(n),o.texture},he=(t,e,s,n,o,r,a,l,h,f,i,E,$,v,T,u,g=null,I=null,d=null,C=0,m=0,y=0,M=0,S=0,w=0,O=0,p=0)=>{const R=A.currentAttachmentObject,B=W(s,n,!1);A.bind(B);const b=v==="inner",L=g!==null&&I!==null&&d!==null;let N=null;if(L&&(N=ea(g,I,d)),b){A.reset(),A.setTransform(1,0,0,1,0,0),z(t,!0);const et=Ft();Tt(et,t.width,t.height),G(et),L&&N?Ir(e,N,!0):z(e,!0)}else L&&N?Cr(e,t,N,!0):Oe(e,t,!0);const P=!(b||v==="full"&&T),k=!(s===h&&n===f&&i===0&&E===0),Y=u!==1;b?T?Lr():kr():Yt();const H=Hr(P,k,$,v,T,Y,L);Kr(H,s,n,o,r,a,l,h,f,i,E,$,u,C,m,y,M,S,w,O,p,P,k,Y,L),G(H);const K=B.texture;return V(B,!1),j(),R&&A.bind(R),K},sa=(t,e,s=0,n=1,o=4,r=4,a=1,l=1,h=!1,f=!1)=>{const i=A.currentAttachmentObject,E=t.width,$=t.height,v=U.x,T=U.y,u=Wt(t,e,o,r,l,!1),g=u.width,I=u.height,d=U.x,C=U.y,m=h?E:g,y=h?$:I,M=d-v,S=C-T,w=h?0:M,O=h?0:S,p=h?-M:0,R=h?-S:0,b=he(t,u,m,y,E,$,w,O,g,I,p,R,!0,h?"inner":"outer",f,a,null,null,null,Gt(s,n,!0),zt(s,n,!0),Vt(s,n,!0),n,0,0,0,0);return D(t),D(u),i&&A.bind(i),b},ca=Math.PI/180,na=(t,e,s=4,n=45,o=0,r=1,a=4,l=4,h=1,f=1,i=!1,E=!1,$=!1)=>{const v=A.currentAttachmentObject,T=t.width,u=t.height,g=U.x,I=U.y,d=Wt(t,e,a,l,f,!1),C=d.width,m=d.height,y=U.x,M=U.y,S=y-g,w=M-I,O=Math.sqrt(e[0]*e[0]+e[1]*e[1]),p=Math.sqrt(e[2]*e[2]+e[3]*e[3]),R=gt(),B=n*ca,b=Math.cos(B)*s*(O/R),L=Math.sin(B)*s*(p/R),N=i?T:C+Math.max(0,Math.abs(b)-S),P=i?u:m+Math.max(0,Math.abs(L)-w),k=Math.ceil(N),Y=Math.ceil(P),H=(k-N)/2,K=(Y-P)/2,et=i?0:Math.max(0,S-b)+H,lt=i?0:Math.max(0,w-L)+K,At=i?b-y:(b>0?Math.max(0,b-S):0)+H,xt=i?L-M:(L>0?Math.max(0,L-w):0)+K;let J="",at;i?(J="inner",at=E||$):!E&&$?(J="full",at=!0):(J="outer",at=E);const fe=he(t,d,k,Y,T,u,et,lt,C,m,At,xt,!0,J,at,h,null,null,null,Gt(o,r,!0),zt(o,r,!0),Vt(o,r,!0),r,0,0,0,0);return D(t),D(d),v&&A.bind(v),fe},oa=Math.PI/180,ra=(t,e,s=4,n=45,o=16777215,r=1,a=0,l=1,h=4,f=4,i=1,E=1,$=0,v=!1)=>{const T=t.width,u=t.height,g=U.x,I=U.y,d=Math.sqrt(e[0]*e[0]+e[1]*e[1]),C=Math.sqrt(e[2]*e[2]+e[3]*e[3]),m=gt(),y=n*oa,M=Math.cos(y)*s*(d/m),S=Math.sin(y)*s*(C/m),w=A.currentAttachmentObject,O=W(T,u,!1);A.bind(O),A.reset(),A.setTransform(1,0,0,1,0,0),z(t);const p=Ft();Tt(p,t.width,t.height),G(p),A.setTransform(1,0,0,1,M*2,S*2),Ze(),Tt(p,t.width,t.height),G(p),j();const R=O.texture;w&&A.bind(w);const B=Wt(R,e,h,f,E,!1);V(O);const b=B.width,L=B.height,N=Math.ceil(b+Math.abs(M)*2),P=Math.ceil(L+Math.abs(S)*2);let k="";switch($){case 0:k="full";break;case 1:k="inner";break;case 2:k="outer";break}const Y=k==="inner",H=Y?T:N,K=Y?u:P,et=Math.abs(M),lt=Math.abs(S),At=(b-T)/2,xt=(L-u)/2,J=Y?0:et+At,at=Y?0:lt+xt,fe=Y?-At-M:et-M,Ts=Y?-xt-S:lt-S,Ll=he(t,B,H,K,T,u,J,at,b,L,fe,Ts,!1,k,v,i,null,null,null,Gt(o,r,!0),zt(o,r,!0),Vt(o,r,!0),r,Gt(a,l,!0),zt(a,l,!0),Vt(a,l,!0),l);return U.x=g+J,U.y=I+at,D(t),D(B),Ll},aa=Math.PI/180,la=(t,e,s=4,n=45,o,r,a,l=4,h=4,f=1,i=1,E=0,$=!1)=>{const v=t.width,T=t.height,u=U.x,g=U.y,I=Math.sqrt(e[0]*e[0]+e[1]*e[1]),d=Math.sqrt(e[2]*e[2]+e[3]*e[3]),C=gt(),m=n*aa,y=Math.cos(m)*s*(I/C),M=Math.sin(m)*s*(d/C),S=A.currentAttachmentObject,w=W(v,T,!1);A.bind(w),A.reset(),A.setTransform(1,0,0,1,0,0),z(t);const O=Ft();Tt(O,t.width,t.height),G(O),A.setTransform(1,0,0,1,y*2,M*2),Ze(),Tt(O,t.width,t.height),G(O),j();const p=w.texture;S&&A.bind(S);const R=Wt(p,e,l,h,i,!1);V(w);const B=R.width,b=R.height,L=Math.ceil(B+Math.abs(y)*2),N=Math.ceil(b+Math.abs(M)*2);let P="";switch(E){case 0:P="full";break;case 1:P="inner";break;case 2:P="outer";break}const k=P==="inner",Y=k?v:L,H=k?T:N,K=Math.abs(y),et=Math.abs(M),lt=(B-v)/2,At=(b-T)/2,xt=k?0:K+lt,J=k?0:et+At,at=k?-lt-y:K-y,fe=k?-At-M:et-M,Ts=he(t,R,Y,H,v,T,xt,J,B,b,at,fe,!1,P,$,f,a,o,r,0,0,0,0,0,0,0,0);return U.x=u+xt,U.y=g+J,D(t),D(R),Ts},ia=Math.PI/180,ua=(t,e,s=4,n=45,o,r,a,l=4,h=4,f=1,i=1,E=0,$=!1)=>{const v=t.width,T=t.height,u=U.x,g=U.y,I=Wt(t,e,l,h,i,!1),d=I.width,C=I.height,m=U.x,y=U.y,M=m-u,S=y-g,w=Math.sqrt(e[0]*e[0]+e[1]*e[1]),O=Math.sqrt(e[2]*e[2]+e[3]*e[3]),p=gt(),R=n*ia,B=Math.cos(R)*s*(w/p),b=Math.sin(R)*s*(O/p),L=E===1,N=L?v:d+Math.max(0,Math.abs(B)-M),P=L?T:C+Math.max(0,Math.abs(b)-S),k=Math.ceil(N),Y=Math.ceil(P),H=(k-N)/2,K=(Y-P)/2,et=L?0:Math.max(0,M-B)+H,lt=L?0:Math.max(0,S-b)+K,At=L?B-m:(B>0?Math.max(0,B-M):0)+H,xt=L?b-y:(b>0?Math.max(0,b-S):0)+K;let J="";switch(E){case 0:J="full";break;case 1:J="inner";break;case 2:J="outer";break}const at=he(t,I,k,Y,v,T,et,lt,d,C,At,xt,!0,J,$,f,a,o,r,0,0,0,0,0,0,0,0);return U.x=u+et,U.y=g+lt,D(t),D(I),at},ha=(t,e,s,n,o)=>{const r=Math.floor(e*.5),a=Math.floor(s*.5),l=e*s;let h="";const f=o?1:2;for(let $=0;$<l;++$){const v=f+Math.floor($/4),T=$%4;h+=\`
548
- result += getWeightedColor(\${$}, u_mediump[\${v}][\${T}]);
549
- \`}const i=n?"result.a = texture(u_texture, v_coord).a;":"",E=o?"":\`
549
+ }\`},ra=(t,e)=>{const s=\`l\${("00"+t).slice(-3)}\${e?"y":"n"}\`,o=ch(s);if(o)return o;const i=Math.ceil(t*5/4),l=new _e(Zt(),lh(i,t,e));return ah(s,l),l},uh=(t,e,r,n,s,o)=>{const i=t.mediump;let l=0;for(let c=s;c<o;c++){const u=r[c];i[l++]=(u>>16)/255,i[l++]=(u>>8&255)/255,i[l++]=(u&255)/255,i[l++]=n[c]}for(let c=s;c<o;c++)i[l++]=e[c]/255},fh=(t,e)=>{const r=Un();return Pt(r),p.bindBuffer(p.ARRAY_BUFFER,r.vertexBuffer),tt[0]=t,tt[2]=t,tt[4]=e,tt[6]=e,p.bufferData(p.ARRAY_BUFFER,tt,p.STATIC_DRAW),p.enableVertexAttribArray(0),p.vertexAttribPointer(0,2,p.FLOAT,!1,0,0),r};let Qs;const hh=(t,e)=>(Qs?(tt[0]!==t||tt[4]!==e)&&(tt[0]=t,tt[2]=t,tt[4]=e,tt[6]=e,p.bufferSubData(p.ARRAY_BUFFER,0,tt)):Qs=fh(t,e),Qs),na=(t,e,r)=>{t.useProgram(),t.bindUniform(),Pt(hh(e,r)),p.drawArrays(p.TRIANGLE_STRIP,0,4)},Zs=new Map,dh=t=>t<=4?256:t<=8?512:1024,sa=t=>{if(!Zs.has(t)){const e=we(t,1,!1);Zs.set(t,e)}return Zs.get(t)},ph=()=>sa(512);let oa=0;const ia=()=>oa,mh=t=>{oa=Math.floor(t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS)*.75)},aa=new Float32Array(256),ca=new Float32Array(256);for(let t=0;t<256;++t){const e=t/255;aa[t]=Math.pow(e,2.23333333),ca[t]=e}const gh=(t,e,r)=>{const n=O.currentAttachmentObject,s=ph();O.bind(s);const o=t.length;Tr();const i=ia();for(let l=0;l<o;l+=i-1){const c=Math.min(l+i,o),u=ra(c-l,!1);uh(u,t,e,r,l,c),na(u,t[l]/255,t[c-1]/255)}return Ce(),n&&O.bind(n),s.texture},an=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b=null,x=null,y=null,P=0,S=0,M=0,$=0,T=0,w=0,E=0,F=0)=>{const A=O.currentAttachmentObject,R=we(r,n,!1);O.bind(R);const v=g==="inner",U=b!==null&&x!==null&&y!==null;let L=null;if(U&&(L=gh(b,x,y)),v){O.reset(),O.setTransform(1,0,0,1,0,0),$e(t,!0);const _=Jt();wt(_,t.width,t.height),xe(_),U&&L?Nf(e,L,!0):$e(e,!0)}else U&&L?zf(e,t,L,!0):_n(e,t,!0);const D=!(v||g==="full"&&m),G=!(r===c&&n===u&&a===0&&h===0),B=f!==1;v?m?Xf():Yf():Tr();const z=sh(D,G,d,g,m,B,U);oh(z,r,n,s,o,i,l,c,u,a,h,d,f,P,S,M,$,T,w,E,F,D,G,B,U),xe(z);const k=R.texture;return be(R,!1),Ce(),A&&O.bind(A),k},la=(t,e,r=0,n=1,s=4,o=4,i=1,l=1,c=!1,u=!1)=>{const a=O.currentAttachmentObject,h=t.width,d=t.height,g=re.x,m=re.y,f=tr(t,e,s,o,l,!1),b=f.width,x=f.height,y=re.x,P=re.y,S=c?h:b,M=c?d:x,$=y-g,T=P-m,w=c?0:$,E=c?0:T,F=c?-$:0,A=c?-T:0,v=an(t,f,S,M,h,d,w,E,b,x,F,A,!0,c?"inner":"outer",u,i,null,null,null,Br(r,n,!0),Pr(r,n,!0),Ar(r,n,!0),n,0,0,0,0);return ae(t),ae(f),a&&O.bind(a),v},bh=Math.PI/180,ua=(t,e,r=4,n=45,s=0,o=1,i=4,l=4,c=1,u=1,a=!1,h=!1,d=!1)=>{const g=O.currentAttachmentObject,m=t.width,f=t.height,b=re.x,x=re.y,y=tr(t,e,i,l,u,!1),P=y.width,S=y.height,M=re.x,$=re.y,T=M-b,w=$-x,E=Math.sqrt(e[0]*e[0]+e[1]*e[1]),F=Math.sqrt(e[2]*e[2]+e[3]*e[3]),A=vt,R=n*bh,v=Math.cos(R)*r*(E/A),U=Math.sin(R)*r*(F/A),L=a?m:P+Math.max(0,Math.abs(v)-T),D=a?f:S+Math.max(0,Math.abs(U)-w),G=Math.ceil(L),B=Math.ceil(D),z=(G-L)/2,k=(B-D)/2,_=a?0:Math.max(0,T-v)+z,I=a?0:Math.max(0,w-U)+k,V=a?v-M:(v>0?Math.max(0,v-T):0)+z,X=a?U-$:(U>0?Math.max(0,U-w):0)+k;let Y="",W;a?(Y="inner",W=h||d):!h&&d?(Y="full",W=!0):(Y="outer",W=h);const K=an(t,y,G,B,m,f,_,I,P,S,V,X,!0,Y,W,c,null,null,null,Br(s,o,!0),Pr(s,o,!0),Ar(s,o,!0),o,0,0,0,0);return ae(t),ae(y),g&&O.bind(g),K},xh=Math.PI/180,fa=(t,e,r=4,n=45,s=16777215,o=1,i=0,l=1,c=4,u=4,a=1,h=1,d=0,g=!1)=>{const m=t.width,f=t.height,b=re.x,x=re.y,y=Math.sqrt(e[0]*e[0]+e[1]*e[1]),P=Math.sqrt(e[2]*e[2]+e[3]*e[3]),S=vt,M=n*xh,$=Math.cos(M)*r*(y/S),T=Math.sin(M)*r*(P/S),w=O.currentAttachmentObject,E=we(m,f,!1);O.bind(E),O.reset(),O.setTransform(1,0,0,1,0,0),$e(t);const F=Jt();wt(F,t.width,t.height),xe(F),O.setTransform(1,0,0,1,$*2,T*2),Ks(),wt(F,t.width,t.height),xe(F),Ce();const A=E.texture;w&&O.bind(w);const R=tr(A,e,c,u,h,!1);be(E);const v=R.width,U=R.height,L=Math.ceil(v+Math.abs($)*2),D=Math.ceil(U+Math.abs(T)*2);let G="";switch(d){case 0:G="full";break;case 1:G="inner";break;case 2:G="outer";break}const B=G==="inner",z=B?m:L,k=B?f:D,_=Math.abs($),I=Math.abs(T),V=(v-m)/2,X=(U-f)/2,Y=B?0:_+V,W=B?0:I+X,K=B?-V-$:_-$,q=B?-X-T:I-T,ce=an(t,R,z,k,m,f,Y,W,v,U,K,q,!1,G,g,a,null,null,null,Br(s,o,!0),Pr(s,o,!0),Ar(s,o,!0),o,Br(i,l,!0),Pr(i,l,!0),Ar(i,l,!0),l);return re.x=b+Y,re.y=x+W,ae(t),ae(R),ce},yh=Math.PI/180,ha=(t,e,r=4,n=45,s,o,i,l=4,c=4,u=1,a=1,h=0,d=!1)=>{const g=t.width,m=t.height,f=re.x,b=re.y,x=Math.sqrt(e[0]*e[0]+e[1]*e[1]),y=Math.sqrt(e[2]*e[2]+e[3]*e[3]),P=vt,S=n*yh,M=Math.cos(S)*r*(x/P),$=Math.sin(S)*r*(y/P),T=O.currentAttachmentObject,w=we(g,m,!1);O.bind(w),O.reset(),O.setTransform(1,0,0,1,0,0),$e(t);const E=Jt();wt(E,t.width,t.height),xe(E),O.setTransform(1,0,0,1,M*2,$*2),Ks(),wt(E,t.width,t.height),xe(E),Ce();const F=w.texture;T&&O.bind(T);const A=tr(F,e,l,c,a,!1);be(w);const R=A.width,v=A.height,U=Math.ceil(R+Math.abs(M)*2),L=Math.ceil(v+Math.abs($)*2);let D="";switch(h){case 0:D="full";break;case 1:D="inner";break;case 2:D="outer";break}const G=D==="inner",B=G?g:U,z=G?m:L,k=Math.abs(M),_=Math.abs($),I=(R-g)/2,V=(v-m)/2,X=G?0:k+I,Y=G?0:_+V,W=G?-I-M:k-M,K=G?-V-$:_-$,q=an(t,A,B,z,g,m,X,Y,R,v,W,K,!1,D,d,u,i,s,o,0,0,0,0,0,0,0,0);return re.x=f+X,re.y=b+Y,ae(t),ae(A),q},vh=Math.PI/180,da=(t,e,r=4,n=45,s,o,i,l=4,c=4,u=1,a=1,h=0,d=!1)=>{const g=t.width,m=t.height,f=re.x,b=re.y,x=tr(t,e,l,c,a,!1),y=x.width,P=x.height,S=re.x,M=re.y,$=S-f,T=M-b,w=Math.sqrt(e[0]*e[0]+e[1]*e[1]),E=Math.sqrt(e[2]*e[2]+e[3]*e[3]),F=vt,A=n*vh,R=Math.cos(A)*r*(w/F),v=Math.sin(A)*r*(E/F),U=h===1,L=U?g:y+Math.max(0,Math.abs(R)-$),D=U?m:P+Math.max(0,Math.abs(v)-T),G=Math.ceil(L),B=Math.ceil(D),z=(G-L)/2,k=(B-D)/2,_=U?0:Math.max(0,$-R)+z,I=U?0:Math.max(0,T-v)+k,V=U?R-S:(R>0?Math.max(0,R-$):0)+z,X=U?v-M:(v>0?Math.max(0,v-T):0)+k;let Y="";switch(h){case 0:Y="full";break;case 1:Y="inner";break;case 2:Y="outer";break}const W=an(t,x,G,B,g,m,_,I,y,P,V,X,!0,Y,d,u,i,s,o,0,0,0,0,0,0,0,0);return re.x=f+_,re.y=b+I,ae(t),ae(x),W},Mh=(t,e,r,n,s)=>{const o=Math.floor(e*.5),i=Math.floor(r*.5),l=e*r;let c="";const u=s?1:2;for(let d=0;d<l;++d){const g=u+Math.floor(d/4),m=d%4;c+=\`
550
+ result += getWeightedColor(\${d}, u_mediump[\${g}][\${m}]);
551
+ \`}const a=n?"result.a = texture(u_texture, v_coord).a;":"",h=s?"":\`
550
552
  vec4 substitute_color = u_mediump[1];
551
553
  color = mix(substitute_color, color, isInside(uv));
552
554
  \`;return\`#version 300 es
@@ -558,19 +560,19 @@ uniform vec4 u_mediump[\${t}];
558
560
  in vec2 v_coord;
559
561
  out vec4 o_color;
560
562
 
561
- \${je()}
563
+ \${Ws()}
562
564
 
563
565
  vec4 getWeightedColor (in int i, in float weight) {
564
566
  vec2 rcp_size = u_mediump[0].xy;
565
567
 
566
568
  int i_div_x = i / \${e};
567
569
  int i_mod_x = i - \${e} * i_div_x;
568
- vec2 offset = vec2(i_mod_x - \${r}, \${a} - i_div_x);
570
+ vec2 offset = vec2(i_mod_x - \${o}, \${i} - i_div_x);
569
571
  vec2 uv = v_coord + offset * rcp_size;
570
572
 
571
573
  vec4 color = texture(u_texture, uv);
572
574
  color.rgb /= max(0.0001, color.a);
573
- \${E}
575
+ \${h}
574
576
 
575
577
  return color * weight;
576
578
  }
@@ -580,20 +582,20 @@ void main() {
580
582
  float bias = u_mediump[0].w;
581
583
 
582
584
  vec4 result = vec4(0.0);
583
- \${h}
585
+ \${c}
584
586
  result = clamp(result * rcp_divisor + bias, 0.0, 1.0);
585
- \${i}
587
+ \${a}
586
588
 
587
589
  result.rgb *= result.a;
588
590
  o_color = result;
589
- }\`},fa=(t,e,s,n)=>{const o=("0"+t).slice(-2),r=("0"+e).slice(-2),h=\`c\${o}\${r}\${s?"y":"n"}\${n?"y":"n"}\`;if(Q.has(h))return Q.get(h);const f=(n?1:2)+Math.ceil(t*e/4),i=new Z(mt(),ha(f,t,e,s,n));return Q.set(h,i),i},ba=(t,e,s,n,o,r,a,l,h,f,i)=>{const E=t.mediump;E[0]=1/e,E[1]=1/s,E[2]=1/o,E[3]=r/255;let $=4;a||(E[$++]=l,E[$++]=h,E[$++]=f,E[$++]=i);const v=n.length;for(let T=0;T<v;T++)E[$++]=n[T]},$a=(t,e=0,s=0,n,o=1,r=0,a=!0,l=!0,h=0,f=0)=>{const i=A.currentAttachmentObject,E=t.width,$=t.height,v=W(E,$,!1);A.bind(v),A.reset(),A.setTransform(1,0,0,1,0,0),z(t,!0),j();const T=fa(e,s,a,l);ba(T,E,$,n,o,r,l,Gt(h,f,!1),zt(h,f,!1),Vt(h,f,!1),f),G(T);const u=v.texture;return D(t),V(v,!1),i&&A.bind(i),u},Ea=(t,e,s,n)=>{let o,r,a;switch(e){case 1:o="map_color.r";break;case 2:o="map_color.g";break;case 4:o="map_color.b";break;case 8:o="map_color.a";break;default:o="0.5";break}switch(s){case 1:r="map_color.r";break;case 2:r="map_color.g";break;case 4:r="map_color.b";break;case 8:r="map_color.a";break;default:r="0.5";break}switch(n){case 0:a=\`
591
+ }\`},Sh=(t,e,r,n)=>{const s=("0"+t).slice(-2),o=("0"+e).slice(-2),c=\`c\${s}\${o}\${r?"y":"n"}\${n?"y":"n"}\`;if(De.has(c))return De.get(c);const u=(n?1:2)+Math.ceil(t*e/4),a=new _e(Zt(),Mh(u,t,e,r,n));return De.set(c,a),a},$h=(t,e,r,n,s,o,i,l,c,u,a)=>{const h=t.mediump;h[0]=1/e,h[1]=1/r,h[2]=1/s,h[3]=o/255;let d=4;i||(h[d++]=l,h[d++]=c,h[d++]=u,h[d++]=a);const g=n.length;for(let m=0;m<g;m++)h[d++]=n[m]},pa=(t,e=0,r=0,n,s=1,o=0,i=!0,l=!0,c=0,u=0)=>{const a=O.currentAttachmentObject,h=t.width,d=t.height,g=we(h,d,!1);O.bind(g),O.reset(),O.setTransform(1,0,0,1,0,0),$e(t,!0),Ce();const m=Sh(e,r,i,l);$h(m,h,d,n,s,o,l,Br(c,u,!1),Pr(c,u,!1),Ar(c,u,!1),u),xe(m);const f=g.texture;return ae(t),be(g,!1),a&&O.bind(a),f},Th=(t,e,r,n)=>{let s,o,i;switch(e){case 1:s="map_color.r";break;case 2:s="map_color.g";break;case 4:s="map_color.b";break;case 8:s="map_color.a";break;default:s="0.5";break}switch(r){case 1:o="map_color.r";break;case 2:o="map_color.g";break;case 4:o="map_color.b";break;case 8:o="map_color.a";break;default:o="0.5";break}switch(n){case 0:i=\`
590
592
  vec4 source_color = texture(u_textures[0], uv);
591
- \`;break;case 3:a=\`
593
+ \`;break;case 3:i=\`
592
594
  vec4 source_color =texture(u_textures[0], mix(v_coord, uv, step(abs(uv - vec2(0.5)), vec2(0.5))));
593
- \`;break;case 1:a=\`
595
+ \`;break;case 1:i=\`
594
596
  vec4 substitute_color = u_mediump[2];
595
597
  vec4 source_color = mix(substitute_color, texture(u_textures[0], uv), isInside(uv));
596
- \`;break;case 2:default:a=\`
598
+ \`;break;default:i=\`
597
599
  vec4 source_color = texture(u_textures[0], fract(uv));
598
600
  \`;break}return\`#version 300 es
599
601
  precision mediump float;
@@ -604,7 +606,7 @@ uniform vec4 u_mediump[\${t}];
604
606
  in vec2 v_coord;
605
607
  out vec4 o_color;
606
608
 
607
- \${je()}
609
+ \${Ws()}
608
610
 
609
611
  void main() {
610
612
  vec2 uv_to_st_scale = u_mediump[0].xy;
@@ -614,55 +616,1733 @@ void main() {
614
616
  vec2 st = v_coord * uv_to_st_scale - uv_to_st_offset;
615
617
  vec4 map_color = texture(u_textures[1], st);
616
618
 
617
- vec2 offset = vec2(\${o}, \${r}) - 0.5;
619
+ vec2 offset = vec2(\${s}, \${o}) - 0.5;
618
620
  vec2 uv = v_coord + offset * scale;
619
- \${a}
621
+ \${i}
620
622
 
621
623
  o_color = mix(texture(u_textures[0], v_coord), source_color, isInside(st));
622
- }\`},Ta=(t,e,s)=>{const n=\`d\${t}\${e}\${s}\`;if(Q.has(n))return Q.get(n);const o=s===1?3:2,r=new Z(mt(),Ea(o,t,e,s));return Q.set(n,r),r},Aa=(t,e,s,n,o,r,a,l,h,f,i,E,$,v)=>{const T=t.textures;T[0]=0,T[1]=1;const u=t.mediump;u[0]=n/e,u[1]=o/s,u[2]=r/e,u[3]=(o-s-a)/s,u[4]=l/n,u[5]=-h/o,f===1&&(u[8]=i,u[9]=E,u[10]=$,u[11]=v)},xa=(t,e,s,n=0,o=0,r=0,a=0,l=0,h=0,f=0,i=0,E=2,$=0,v=0)=>{const T=A.currentAttachmentObject,u=gt(),g=Math.sqrt(e[0]*e[0]+e[1]*e[1])/u,I=Math.sqrt(e[2]*e[2]+e[3]*e[3])/u,d=t.width,C=t.height,m=d/g,y=C/I,M=W(d,C,!1);A.bind(M);const S=Qe(n,o,s);Oe(t,S);const w=Ta(l,h,E);Aa(w,d,C,m,y,r,a,f,i,E,Gt($,v,!0),zt($,v,!0),Vt($,v,!0),v),j(),G(w);const O=M.texture;return T&&A.bind(T),D(t),D(S),V(M,!1),O},va=(t,e,s,n)=>{const o=t.highp,r=A.$matrix;o[0]=r[0],o[1]=r[1],o[2]=r[3],o[3]=r[4],o[4]=r[6],o[5]=r[7],o[6]=s,o[7]=n,o[8]=it(),o[9]=ut();const a=t.mediump;a[0]=e[0],a[1]=e[1],a[2]=e[2],a[3]=e[3],a[4]=e[4],a[5]=e[5],a[6]=e[6],a[7]=e[7]},Ma=(t,e,s,n)=>{const o=A.currentAttachmentObject,r=t.width,a=t.height;switch(A.globalCompositeOperation){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":{A.bind(A.$mainAttachmentObject),A.setTransform(1,0,0,1,s,n);const l=me(!0);va(l,e,r,a),z(t),vc(A.globalCompositeOperation),G(l)}break;default:{const l=Tc(s,n,r,a),h=W(r,a,!1);A.bind(h),Oe(l,t);const f=hc(A.globalCompositeOperation);xc(f,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]),G(f),A.bind(A.$mainAttachmentObject),A.reset(),A.setTransform(1,0,0,1,s,n),Ac(h.texture),D(l),V(h)}break}o&&A.bind(o),j()},wc=[],de=t=>{t.size&&t.clear(),wc.push(t)},ya=()=>wc.pop()||new Map,Ra=(t,e,s)=>{s.clear(),t.$timerId!==null&&clearTimeout(t.$timerId);for(const n of e.values()){for(const o of n.values())o&&t.destroy(o);de(n)}e.clear()},ga=(t,e)=>{if(!(!e||typeof e!="object")&&"canvas"in e){const s=e.canvas,n=s.width,o=s.height;e.clearRect(0,0,n+1,o+1),s.width=s.height=1,t.push(s)}},pa=(t,e,s)=>{if(!t.has(e))return;const n=t.get(e);n.has(s)&&(n.delete(s),n.size||(de(n),t.delete(e)))},Oa=(t,e,s)=>{if(!e.has(s))return;const n=e.get(s);for(const o of n.values())t.destroy(o);e.delete(s),de(n)},ma=(t,e,s)=>{const n=t.get(e)||null;return n?(n.delete("trash"),n.get(s)||null):null},Fa=(t,e,s,n,o=null)=>{e.has(s)||e.set(s,ya());const r=e.get(s);if(o===null){if(!r.has(n))return;t.destroy(r.get(n)),r.delete(n),r.size||(e.delete(s),de(r));return}r.set(n,o)},da=(t,e,s="")=>s?t.has(e)?t.get(e).has(s):!1:t.has(e),Sa=(t,e,s)=>{const n=[t*100,e*100];s&&n.push(s*100);let o=2166136261;for(let r=0;r<n.length;++r){let a=n[r]|0;for(let l=0;l<4;l++){const h=a&255;o^=h,o=Math.imul(o,16777619),a>>>=8}}return(o>>>0)%16777216},wa=(t,e,s,n)=>\`\${t}\${e}\${s}\${n}\`,Ba=(t,e,s,n)=>{if(s.has(n))return;const o=e.get(n);o&&(o.set("trash",!0),s.set(n,o),t.$timerId!==null&&clearTimeout(t.$timerId),t.$removeCache=!1,t.$timerId=setTimeout(()=>{t.$removeCache=!0,t.$timerId=null},1e3))},Ia=(t,e)=>{if(e.size){for(const[s,n]of e)n.has("trash")&&(t.removeById(s),t.$removeIds.push(+s));e.clear(),t.$removeCache=!1}};class Ca{_$pool;_$store;_$trash;$timerId;$removeCache;$removeIds;constructor(){this._$pool=[],this._$store=new Map,this._$trash=new Map,this.$timerId=null,this.$removeIds=[],this.$removeCache=!1}reset(){Ra(this,this._$store,this._$trash)}destroy(e=null){ga(this._$pool,e)}getCanvas(){return this._$pool.pop()||document.createElement("canvas")}remove(e,s){pa(this._$store,e,s)}removeTimer(e){Ba(this,this._$store,this._$trash,e)}removeTimerScheduledCache(){Ia(this,this._$trash)}removeById(e){Oa(this,this._$store,e)}getById(e){return this._$store.get(e)}get(e,s){return ma(this._$store,e,s)}set(e,s,n=null){Fa(this,this._$store,e,s,n)}has(e,s=""){return da(this._$store,e,s)}generateKeys(e,s,n){return Sa(e,s,n)}generateFilterKeys(e,s,n,o){return wa(e,s,n,o)}}const _=new Ca,La=(t,e,s,n,o,r,a,l,h,f,i)=>{const E=A.currentAttachmentObject;let $=null;const v=Math.sqrt(a[0]*a[0]+a[1]*a[1]),T=Math.sqrt(a[2]*a[2]+a[3]*a[3]),u=_.generateFilterKeys(a[0],a[1],a[2],a[3]);let g=!1;if(_.get(e,"fKey")===u){const m=_.get(e,"fTexture");s?D(m):(g=!0,$=m)}let d=0,C=0;if(g)d=_.get(e,"offsetX"),C=_.get(e,"offsetY");else{$=$c(t);const m=Math.atan2(a[1],a[0]),y=Math.atan2(-a[2],a[3]),M=r?v*Math.cos(m):Math.cos(m),S=r?v*Math.sin(m):Math.sin(m),w=r?-T*Math.sin(y):-Math.sin(y),O=r?T*Math.cos(y):Math.cos(y),p=St(M,S,w,O,n/2,o/2),R=St(1,0,0,1,-t.w/2,-t.h/2),B=Wc(p,R);if(Qt(p),Qt(R),B[0]!==1||B[1]!==0||B[2]!==0||B[3]!==1){const b=W(n,o,!1);A.bind(b),A.reset(),A.setTransform(B[0],B[1],B[2],B[3],B[4],B[5]),d=B[4],C=B[5],z($);const L=me();Fe(L,$.width,$.height),G(L),D($),$=b.texture,V(b,!1),E&&A.bind(E)}Qt(B),U.x=0,U.y=0;for(let b=0;i.length>b;)switch(i[b++]){case 0:$=ra($,a,i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],!!i[b++]);break;case 1:$=Wt($,a,i[b++],i[b++],i[b++]);break;case 2:$=Br($,new Float32Array([i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++]]));break;case 3:{const N=i[b++],P=i[b++],k=N*P,Y=i.subarray(b,b+k);b+=k,$=$a($,N,P,Y,i[b++],i[b++],!!i[b++],!!i[b++],i[b++],i[b++])}break;case 4:{const N=i[b++],P=new Uint8Array(N);P.set(i.subarray(b,b+N)),b+=N,$=xa($,a,P,i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++])}break;case 5:$=na($,a,i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],!!i[b++],!!i[b++],!!i[b++]);break;case 6:$=sa($,a,i[b++],i[b++],i[b++],i[b++],i[b++],i[b++],!!i[b++],!!i[b++]);break;case 7:{const N=i[b++],P=i[b++];let k=i[b++];const Y=i.subarray(b,b+k);b+=k,k=i[b++];const H=i.subarray(b,b+k);b+=k,k=i[b++];const K=i.subarray(b,b+k);b+=k,$=la($,a,N,P,Y,H,K,i[b++],i[b++],i[b++],i[b++],i[b++],!!i[b++])}break;case 8:{const N=i[b++],P=i[b++];let k=i[b++];const Y=i.subarray(b,b+k);b+=k,k=i[b++];const H=i.subarray(b,b+k);b+=k,k=i[b++];const K=i.subarray(b,b+k);b+=k,$=ua($,a,N,P,Y,H,K,i[b++],i[b++],i[b++],i[b++],i[b++],!!i[b++])}break}}if($){const m=gt(),y=f[0]*(v/m),M=f[1]*(T/m);A.reset(),A.setTransform(1,0,0,1,0,0),A.globalCompositeOperation=h,Ma($,l,-d+y+a[4],-C+M+a[5])}g||(_.set(e,"fKey",u),_.set(e,"fTexture",$),_.set(e,"offsetX",d),_.set(e,"offsetY",C)),E&&A.bind(E)},ka=t=>{const e=Ys(t.index),s=e[0],n=e[1],o=e[2],r=e[3];e[0]=Math.min(t.x,s),e[1]=Math.min(t.y,n),e[2]=Math.max(t.x+t.w,o),e[3]=Math.max(t.y+t.h,r)},Na=t=>{const e=Gs(t.index),s=e[0],n=e[1],o=e[2],r=e[3];e[0]=Math.min(t.x,s),e[1]=Math.min(t.y,n),e[2]=Math.max(t.x+t.w,o),e[3]=Math.max(t.y+t.h,r)},Pa=t=>{const e=\`s\${t?"y":"n"}\`;if(Et.has(e))return Et.get(e);const s=new Z(pe(t?9:0,!1,!1,t),So());return Et.set(e,s),s},Ua=(t,e)=>{const s=t.highp;s[0]=e[0],s[1]=e[1],s[2]=0,s[4]=e[2],s[5]=e[3],s[6]=0,s[8]=e[4],s[9]=e[5],s[10]=1,s[12]=e[6],s[13]=e[7],s[14]=0,s[16]=e[8],s[17]=e[9],s[18]=0,s[20]=e[10],s[21]=e[11],s[22]=1,s[3]=it(),s[7]=ut(),s[11]=e[12],s[15]=e[13],s[19]=e[14],s[23]=e[15],s[24]=e[16],s[25]=e[17],s[26]=e[18],s[27]=e[19],s[28]=e[20],s[29]=e[21],s[30]=e[22],s[31]=e[23],s[32]=e[24],s[33]=e[25]},Da=(t,e,s,n)=>{c.stencilFunc(c.ALWAYS,0,255),c.stencilOpSeparate(c.FRONT,c.KEEP,c.KEEP,c.INCR_WRAP),c.stencilOpSeparate(c.BACK,c.KEEP,c.KEEP,c.DECR_WRAP),c.colorMask(!1,!1,!1,!1);const o=!!n,r=ie(o);n&&ue(r,n),c.enable(c.SAMPLE_ALPHA_TO_COVERAGE),nt(r,t,e,s),c.disable(c.SAMPLE_ALPHA_TO_COVERAGE),c.stencilFunc(c.NOTEQUAL,0,255),c.stencilOp(c.KEEP,c.ZERO,c.ZERO),c.colorMask(!0,!0,!0,!0);const a=Pa(o);n&&Ua(a,n),nt(a,t,e,s)},Xa=(t,e,s,n,o)=>{const r=t.mediump;let a=0;for(let l=s;l<n;++l){const h=l*5;r[a++]=o[e[h+1]],r[a++]=o[e[h+2]],r[a++]=o[e[h+3]],r[a++]=o[e[h+4]]}for(let l=s;l<n;++l)r[a++]=e[l*5]},Bc=(t,e)=>{const s=A.currentAttachmentObject,n=c.getParameter(c.SCISSOR_BOX);c.disable(c.SCISSOR_TEST);const o=Oc();A.bind(o);const r=e===0,a=t.length/5,l=r?dc:Sc;Yt();const h=Fc();for(let f=0;f<a;f+=h-1){const i=Math.min(f+h,a),E=gc(i-f,r);Xa(E,t,f,i,l),pc(E,t[0],t[t.length-5])}return j(),s&&A.bind(s),c.enable(c.SCISSOR_TEST),c.scissor(n[0],n[1],n[2],n[3]),o.texture},es=new Map,_a=(t,e,s,n)=>{const o=t?"y":"n",r=e?"y":"n",a=e&&s?"y":"n",l=\`\${n}\`;return\`\${o}\${r}\${a}\${l}\`},Ya=t=>\`
624
+ }\`},Bh=(t,e,r)=>{const n=\`d\${t}\${e}\${r}\`;if(De.has(n))return De.get(n);const s=r===1?3:2,o=new _e(Zt(),Th(s,t,e,r));return De.set(n,o),o},Ph=(t,e,r,n,s,o,i,l,c,u,a,h,d,g)=>{const m=t.textures;m[0]=0,m[1]=1;const f=t.mediump;f[0]=n/e,f[1]=s/r,f[2]=o/e,f[3]=(s-r-i)/r,f[4]=l/n,f[5]=-c/s,u===1&&(f[8]=a,f[9]=h,f[10]=d,f[11]=g)},ma=(t,e,r=0,n=0,s=0,o=0,i=0,l=0,c=0,u=0,a=2,h=0,d=0)=>{const g=O.currentAttachmentObject,m=t.width,f=t.height,b=we(m,f,!1);O.bind(b);const x=qs(r,n,e);_n(t,x);const y=Bh(i,l,a);Ph(y,r,n,r,n,s,o,c,u,a,Br(h,d,!0),Pr(h,d,!0),Ar(h,d,!0),d),Ce(),xe(y);const P=b.texture;return g&&O.bind(g),ae(t),ae(x),be(b,!1),P},Ah=(t,e,r,n)=>{const s=t.highp,o=O.$matrix;s[0]=o[0],s[1]=o[1],s[2]=o[3],s[3]=o[4],s[4]=o[6],s[5]=o[7],s[6]=r,s[7]=n,s[8]=pt,s[9]=mt;const i=t.mediump;i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7]},Xn=(t,e,r,n)=>{const s=O.currentAttachmentObject,o=t.width,i=t.height;switch(O.globalCompositeOperation){case"normal":case"layer":case"add":case"screen":case"alpha":case"erase":case"copy":{O.bind(O.$mainAttachmentObject),O.setTransform(1,0,0,1,r,n);const l=Dn(!0);Ah(l,e,o,i),$e(t),Qi(O.globalCompositeOperation),xe(l)}break;default:{const l=Vn(r,n,o,i),c=we(o,i,!1);O.bind(c),_n(l,t);const u=Yi(O.globalCompositeOperation);qi(u,e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7]),xe(u),O.bind(O.$mainAttachmentObject),O.reset(),O.setTransform(1,0,0,1,r,n),Ki(c.texture),ae(l),be(c)}break}s&&O.bind(s),Ce()},ga=[],Yn=t=>{t.size&&t.clear(),ga.push(t)},Fh=()=>ga.pop()||new Map,wh=(t,e,r)=>{r.clear(),t.$timerId!==null&&clearTimeout(t.$timerId);for(const n of e.values()){for(const s of n.values())s&&t.destroy(s);Yn(n)}e.clear()},Oh=(t,e)=>{if(!(!e||typeof e!="object")&&"canvas"in e){const r=e.canvas,n=r.width,s=r.height;e.clearRect(0,0,n+1,s+1),r.width=r.height=1,t.push(r)}},Eh=(t,e,r)=>{if(!t.has(e))return;const n=t.get(e);n.has(r)&&(n.delete(r),n.size||(Yn(n),t.delete(e)))},Rh=(t,e,r)=>{if(!e.has(r))return;const n=e.get(r);for(const s of n.values())t.destroy(s);e.delete(r),Yn(n)},Ch=(t,e,r)=>{const n=t.get(e)||null;return n?(n.delete("trash"),n.get(r)||null):null},Uh=(t,e,r,n,s=null)=>{e.has(r)||e.set(r,Fh());const o=e.get(r);if(s===null){if(!o.has(n))return;t.destroy(o.get(n)),o.delete(n),o.size||(e.delete(r),Yn(o));return}o.set(n,s)},Gh=(t,e,r="")=>r?t.has(e)?t.get(e).has(r):!1:t.has(e),Lh=(t,e,r)=>{let n=2166136261,s=t*100|0;return n^=s&255,n=Math.imul(n,16777619),n^=s>>>8&255,n=Math.imul(n,16777619),n^=s>>>16&255,n=Math.imul(n,16777619),n^=s>>>24,n=Math.imul(n,16777619),s=e*100|0,n^=s&255,n=Math.imul(n,16777619),n^=s>>>8&255,n=Math.imul(n,16777619),n^=s>>>16&255,n=Math.imul(n,16777619),n^=s>>>24,n=Math.imul(n,16777619),r&&(s=r*100|0,n^=s&255,n=Math.imul(n,16777619),n^=s>>>8&255,n=Math.imul(n,16777619),n^=s>>>16&255,n=Math.imul(n,16777619),n^=s>>>24,n=Math.imul(n,16777619)),(n>>>0)%16777216},kh=(t,e,r,n)=>{let s=2166136261,o=t*100|0;return s^=o&255,s=Math.imul(s,16777619),s^=o>>>8&255,s=Math.imul(s,16777619),s^=o>>>16&255,s=Math.imul(s,16777619),s^=o>>>24,s=Math.imul(s,16777619),o=e*100|0,s^=o&255,s=Math.imul(s,16777619),s^=o>>>8&255,s=Math.imul(s,16777619),s^=o>>>16&255,s=Math.imul(s,16777619),s^=o>>>24,s=Math.imul(s,16777619),o=r*100|0,s^=o&255,s=Math.imul(s,16777619),s^=o>>>8&255,s=Math.imul(s,16777619),s^=o>>>16&255,s=Math.imul(s,16777619),s^=o>>>24,s=Math.imul(s,16777619),o=n*100|0,s^=o&255,s=Math.imul(s,16777619),s^=o>>>8&255,s=Math.imul(s,16777619),s^=o>>>16&255,s=Math.imul(s,16777619),s^=o>>>24,s=Math.imul(s,16777619),(s>>>0)%16777216},Ih=(t,e,r,n)=>{if(r.has(n))return;const s=e.get(n);s&&(s.set("trash",!0),r.set(n,s),t.$timerId!==null&&clearTimeout(t.$timerId),t.$removeCache=!1,t.$timerId=setTimeout(()=>{t.$removeCache=!0,t.$timerId=null},1e3))},_h=(t,e)=>{if(e.size){for(const[r,n]of e)n.has("trash")&&(t.removeById(r),t.$removeIds.push(+r));e.clear(),t.$removeCache=!1}};class Vh{_$pool;_$store;_$trash;$timerId;$removeCache;$removeIds;constructor(){this._$pool=[],this._$store=new Map,this._$trash=new Map,this.$timerId=null,this.$removeIds=[],this.$removeCache=!1}reset(){wh(this,this._$store,this._$trash)}destroy(e=null){Oh(this._$pool,e)}getCanvas(){return this._$pool.pop()||document.createElement("canvas")}remove(e,r){Eh(this._$store,e,r)}removeTimer(e){Ih(this,this._$store,this._$trash,e)}removeTimerScheduledCache(){_h(this,this._$trash)}removeById(e){Rh(this,this._$store,e)}getById(e){return this._$store.get(e)}get(e,r){return Ch(this._$store,e,r)}set(e,r,n=null){Uh(this,this._$store,e,r,n)}has(e,r=""){return Gh(this._$store,e,r)}generateKeys(e,r,n){return Lh(e,r,n)}generateFilterKeys(e,r,n,s){return kh(e,r,n,s)}}const ee=new Vh,ba=new Float32Array(20),Dh=(t,e,r,n,s,o,i,l,c,u,a)=>{const h=O.currentAttachmentObject;let d=null;const g=Math.sqrt(i[0]*i[0]+i[1]*i[1]),m=Math.sqrt(i[2]*i[2]+i[3]*i[3]),f=ee.generateFilterKeys(i[0],i[1],i[2],i[3]);let b=!1;if(ee.get(e,"fKey")===f){const S=ee.get(e,"fTexture");r?ae(S):(b=!0,d=S)}let y=0,P=0;if(b)y=ee.get(e,"offsetX"),P=ee.get(e,"offsetY");else{d=ji(t);const S=Math.atan2(i[1],i[0]),M=Math.atan2(-i[2],i[3]),$=o?g*Math.cos(S):Math.cos(S),T=o?g*Math.sin(S):Math.sin(S),w=o?-m*Math.sin(M):-Math.sin(M),E=o?m*Math.cos(M):Math.cos(M),F=dr($,T,w,E,n/2,s/2),A=dr(1,0,0,1,-t.w/2,-t.h/2),R=Zc(F,A);if(Kr(F),Kr(A),R[0]!==1||R[1]!==0||R[2]!==0||R[3]!==1){const v=we(n,s,!1);O.bind(v),O.reset(),O.setTransform(R[0],R[1],R[2],R[3],R[4],R[5]),y=R[4],P=R[5],$e(d);const U=Dn();Nn(U,d.width,d.height),xe(U),ae(d),d=v.texture,be(v,!1),h&&O.bind(h)}Kr(R),re.x=0,re.y=0;for(let v=0;a.length>v;)switch(a[v++]){case 0:d=fa(d,i,a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],!!a[v++]);break;case 1:d=tr(d,i,a[v++],a[v++],a[v++]);break;case 2:for(let L=0;L<20;++L)ba[L]=a[v++];d=Ji(d,ba);break;case 3:{const L=a[v++],D=a[v++],G=L*D,B=a.subarray(v,v+G);v+=G,d=pa(d,L,D,B,a[v++],a[v++],!!a[v++],!!a[v++],a[v++],a[v++])}break;case 4:{const L=a[v++],D=new Uint8Array(L);D.set(a.subarray(v,v+L)),v+=L,d=ma(d,D,a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++])}break;case 5:d=ua(d,i,a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],!!a[v++],!!a[v++],!!a[v++]);break;case 6:d=la(d,i,a[v++],a[v++],a[v++],a[v++],a[v++],a[v++],!!a[v++],!!a[v++]);break;case 7:{const L=a[v++],D=a[v++];let G=a[v++];const B=a.subarray(v,v+G);v+=G,G=a[v++];const z=a.subarray(v,v+G);v+=G,G=a[v++];const k=a.subarray(v,v+G);v+=G,d=ha(d,i,L,D,B,z,k,a[v++],a[v++],a[v++],a[v++],a[v++],!!a[v++])}break;case 8:{const L=a[v++],D=a[v++];let G=a[v++];const B=a.subarray(v,v+G);v+=G,G=a[v++];const z=a.subarray(v,v+G);v+=G,G=a[v++];const k=a.subarray(v,v+G);v+=G,d=da(d,i,L,D,B,z,k,a[v++],a[v++],a[v++],a[v++],a[v++],!!a[v++])}break}}if(d){const S=vt,M=u[0]*(g/S),$=u[1]*(m/S);O.reset(),O.setTransform(1,0,0,1,0,0),O.globalCompositeOperation=c,Xn(d,l,-y+M+i[4],-P+$+i[5])}b||(ee.set(e,"fKey",f),ee.set(e,"fTexture",d),ee.set(e,"offsetX",y),ee.set(e,"offsetY",P)),h&&O.bind(h)},Js=[],Nh=(t,e)=>{O.drawArraysInstanced();const r=O.$mainAttachmentObject;Js.push(r);const n=we(t,e,!1);O.$mainAttachmentObject=n,O.bind(n)},xa=new Float32Array(20),zh=(t,e,r,n,s,o,i,l)=>{O.drawArraysInstanced();const c=O.$mainAttachmentObject;let u=null;if(n&&s&&o){u=Vn(0,0,c.width,c.height),O.$mainAttachmentObject=Js.pop(),be(c),O.bind(O.$mainAttachmentObject),re.x=0,re.y=0;for(let a=0;o.length>a;)switch(o[a++]){case 0:u=fa(u,e,o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],!!o[a++]);break;case 1:u=tr(u,e,o[a++],o[a++],o[a++]);break;case 2:for(let d=0;d<20;++d)xa[d]=o[a++];u=Ji(u,xa);break;case 3:{const d=o[a++],g=o[a++],m=d*g,f=o.subarray(a,a+m);a+=m,u=pa(u,d,g,f,o[a++],o[a++],!!o[a++],!!o[a++],o[a++],o[a++])}break;case 4:{const d=o[a++],g=new Uint8Array(d);g.set(o.subarray(a,a+d)),a+=d,u=ma(u,g,o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++])}break;case 5:u=ua(u,e,o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],!!o[a++],!!o[a++],!!o[a++]);break;case 6:u=la(u,e,o[a++],o[a++],o[a++],o[a++],o[a++],o[a++],!!o[a++],!!o[a++]);break;case 7:{const d=o[a++],g=o[a++];let m=o[a++];const f=o.subarray(a,a+m);a+=m,m=o[a++];const b=o.subarray(a,a+m);a+=m,m=o[a++];const x=o.subarray(a,a+m);a+=m,u=ha(u,e,d,g,f,b,x,o[a++],o[a++],o[a++],o[a++],o[a++],!!o[a++])}break;case 8:{const d=o[a++],g=o[a++];let m=o[a++];const f=o.subarray(a,a+m);a+=m,m=o[a++];const b=o.subarray(a,a+m);a+=m,m=o[a++];const x=o.subarray(a,a+m);a+=m,u=da(u,e,d,g,f,b,x,o[a++],o[a++],o[a++],o[a++],o[a++],!!o[a++])}break}if(i&&(ee.set(i,"fKey",l),ee.set(i,"fTexture",u)),u){const a=Math.sqrt(e[0]*e[0]+e[1]*e[1]),h=Math.sqrt(e[2]*e[2]+e[3]*e[3]),d=vt,g=s[0]*(a/d),m=s[1]*(h/d);O.reset(),O.globalCompositeOperation=t,Xn(u,r,g+e[4],m+e[5])}}else u=Vn(0,0,c.width,c.height),O.$mainAttachmentObject=Js.pop(),be(c),O.bind(O.$mainAttachmentObject),u&&(O.reset(),O.globalCompositeOperation=t,Xn(u,r,e[4],e[5]),ae(u));O.bind(O.$mainAttachmentObject)},Xh=(t,e,r,n,s,o)=>{if(ee.get(s,"fKey")!==o)return;const l=ee.get(s,"fTexture");if(!l)return;const c=Math.sqrt(e[0]*e[0]+e[1]*e[1]),u=Math.sqrt(e[2]*e[2]+e[3]*e[3]),a=vt,h=n[0]*(c/a),d=n[1]*(u/a);O.drawArraysInstanced(),O.reset(),O.globalCompositeOperation=t,Xn(l,r,h+e[4],d+e[5])},ya=t=>{const e=Ai(t.index),r=e[0],n=e[1],s=e[2],o=e[3];e[0]=Math.min(t.x,r),e[1]=Math.min(t.y,n),e[2]=Math.max(t.x+t.w+1,s),e[3]=Math.max(t.y+t.h+1,o)},Yh=t=>{const e=\`s\${t?"y":"n"}\`;if(At.has(e))return At.get(e);const r=new _e(kn(t?9:0,!1,!1,t),Vu());return At.set(e,r),r},Wh=(t,e)=>{const r=t.highp;r[0]=e[0],r[1]=e[1],r[2]=0,r[4]=e[2],r[5]=e[3],r[6]=0,r[8]=e[4],r[9]=e[5],r[10]=1,r[12]=e[6],r[13]=e[7],r[14]=0,r[16]=e[8],r[17]=e[9],r[18]=0,r[20]=e[10],r[21]=e[11],r[22]=1,r[3]=pt,r[7]=mt,r[11]=e[12],r[15]=e[13],r[19]=e[14],r[23]=e[15],r[24]=e[16],r[25]=e[17],r[26]=e[18],r[27]=e[19],r[28]=e[20],r[29]=e[21],r[30]=e[22],r[31]=e[23],r[32]=e[24],r[33]=e[25]};let Wn=0;const va=1,Ma=2,Sa=t=>{Wn=t},jh=()=>{Wn=0};let eo=!0;const to=t=>{eo=t};let ro=!1;const no=t=>{ro=t},jn=()=>{Wn!==va&&(Sa(va),p.stencilFunc(p.ALWAYS,0,255),p.stencilOpSeparate(p.FRONT,p.KEEP,p.KEEP,p.INCR_WRAP),p.stencilOpSeparate(p.BACK,p.KEEP,p.KEEP,p.DECR_WRAP)),eo&&(to(!1),p.colorMask(!1,!1,!1,!1))},Hn=()=>{Wn!==Ma&&(Sa(Ma),p.stencilFunc(p.NOTEQUAL,0,255),p.stencilOp(p.KEEP,p.ZERO,p.ZERO)),eo||(to(!0),p.colorMask(!0,!0,!0,!0))},Kn=()=>{ro||(no(!0),p.enable(p.SAMPLE_ALPHA_TO_COVERAGE))},qn=()=>{ro&&(no(!1),p.disable(p.SAMPLE_ALPHA_TO_COVERAGE))},Hh=(t,e,r,n)=>{jn();const s=!!n,o=sn(s);n&&on(o,n),Kn(),rt(o,t,e,r),qn(),Hn();const i=Yh(s);n&&Wh(i,n),rt(i,t,e,r)},Kh=(t,e,r,n,s)=>{const o=t.mediump;let i=0;for(let l=r;l<n;++l){const c=l*5;o[i++]=s[e[c+1]],o[i++]=s[e[c+2]],o[i++]=s[e[c+3]],o[i++]=s[e[c+4]]}for(let l=r;l<n;++l)o[i++]=e[l*5]},$a=(t,e)=>{const r=O.currentAttachmentObject,n=p.getParameter(p.SCISSOR_BOX);yt();const s=e===0,o=t.length/5,i=dh(o),l=sa(i);O.bind(l);const c=s?aa:ca;Tr();const u=ia();for(let a=0;a<o;a+=u-1){const h=Math.min(a+u,o),d=ra(h-a,s);Kh(d,t,a,h,c),na(d,t[0],t[t.length-5])}return Ce(),r&&O.bind(r),It(),p.scissor(n[0],n[1],n[2],n[3]),l.texture},so=new Map,qh=(t,e,r,n)=>{const s=t?"y":"n",o=e?"y":"n",i=e&&r?"y":"n",l=\`\${n}\`;return\`\${s}\${o}\${i}\${l}\`},Qh=t=>\`
623
625
  vec2 focal = vec2(u_highp[\${t}][1], 0.0);
624
626
 
625
- vec2 dir = normalize(coord - focal);
626
-
627
- float a = dot(dir, dir);
627
+ vec2 diff = coord - focal;
628
+ float lenDiff = length(diff);
629
+ vec2 dir = diff / lenDiff;
628
630
  float b = 2.0 * dot(dir, focal);
629
631
  float c = dot(focal, focal) - 1.0;
630
- float x = (-b + sqrt(b * b - 4.0 * a * c)) / (2.0 * a);
632
+ float x = (-b + sqrt(max(b * b - 4.0 * c, 0.0))) * 0.5;
631
633
 
632
- float t = distance(focal, coord) / distance(focal, focal + dir * x);\`,Ga=()=>"float t = length(coord);",za=(t,e)=>{const s=e?Ya(t):Ga();return\`
634
+ float t = lenDiff / abs(x);\`,Zh=()=>"float t = length(coord);",Jh=(t,e)=>{const r=e?Qh(t):Zh();return\`
633
635
  float radius = u_highp[\${t}][0];
634
636
  vec2 coord = p / radius;
635
- \${s}
636
- \`},Va=t=>\`
637
+ \${r}
638
+ \`},ed=t=>\`
637
639
  vec2 a = u_highp[\${t}].xy;
638
640
  vec2 b = u_highp[\${t}].zw;
639
641
 
640
642
  vec2 ab = b - a;
641
643
  vec2 ap = p - a;
642
644
 
643
- float t = dot(ab, ap) / dot(ab, ab);\`,Wa=(t,e,s,n,o)=>{const r=s?za(e,n):Va(e);let a;switch(o){case 0:a="1.0 - abs(fract(t * 0.5) * 2.0 - 1.0)";break;case 1:a="fract(t)";break;default:a="clamp(t, 0.0, 1.0)";break}return\`#version 300 es
645
+ float t = dot(ab, ap) / dot(ab, ab);\`,td=(t,e,r,n,s)=>{const o=r?Jh(e,n):ed(e);let i;switch(s){case 0:i="1.0 - abs(fract(t * 0.5) * 2.0 - 1.0)";break;case 1:i="fract(t)";break;default:i="clamp(t, 0.0, 1.0)";break}return\`#version 300 es
644
646
  precision highp float;
645
647
 
646
648
  uniform sampler2D u_texture;
647
649
  uniform vec4 u_highp[\${t}];
648
-
650
+
649
651
  in vec2 v_uv;
650
652
  out vec4 o_color;
651
-
653
+
652
654
  void main() {
653
655
  vec2 p = v_uv;
654
- \${r}
655
- t = \${a};
656
+ \${o}
657
+ t = \${i};
656
658
  o_color = texture(u_texture, vec2(t, 0.5));
657
- }\`},Ic=(t,e,s,n)=>{const o=_a(n,t,e,s);if(es.has(o))return es.get(o);const r=(n?14:5)+1,a=r-1,l=new Z(pe(r,!0,!1,n),Wa(r,a,t,e,s));return es.set(o,l),l},Cc=(t,e,s,n,o=0,r=null,a=null)=>{const l=t.highp;l[0]=s[0],l[1]=s[1],l[2]=s[2],l[4]=s[3],l[5]=s[4],l[6]=s[5],l[8]=s[6],l[9]=s[7],l[10]=s[8],l[12]=n[0],l[13]=n[1],l[14]=n[2],l[16]=n[3],l[17]=n[4],l[18]=n[5],l[11]=n[6],l[15]=n[7],l[19]=n[8],l[3]=it(),l[7]=ut();let h=20;a&&(l[20]=a[0],l[21]=a[1],l[22]=0,l[24]=a[2],l[25]=a[3],l[26]=0,l[28]=a[4],l[29]=a[5],l[30]=1,l[32]=a[6],l[33]=a[7],l[34]=0,l[36]=a[8],l[37]=a[9],l[38]=0,l[40]=a[10],l[41]=a[11],l[42]=1,l[31]=a[12],l[35]=a[13],l[39]=a[14],l[43]=a[15],l[44]=a[16],l[45]=a[17],l[46]=a[18],l[47]=a[19],l[48]=a[20],l[49]=a[21],l[50]=a[22],l[51]=a[23],l[52]=a[24],l[53]=a[25],h=56),e===0?(l[h++]=r[0],l[h++]=r[1],l[h++]=r[2],l[h]=r[3]):(l[h++]=819.2,l[h]=Zt(o,-.975,.975,0))},ja=(t,e,s,n)=>{const o=tt.shift(),r=tt.shift(),a=tt.shift(),l=tt.shift();c.disable(c.STENCIL_TEST);const h=Bc(o,l);z(h),c.enable(c.STENCIL_TEST),c.frontFace(c.CCW),c.stencilMask(255),c.stencilFunc(c.ALWAYS,0,255),c.stencilOpSeparate(c.FRONT,c.KEEP,c.KEEP,c.INCR_WRAP),c.stencilOpSeparate(c.BACK,c.KEEP,c.KEEP,c.DECR_WRAP),c.colorMask(!1,!1,!1,!1);const f=!!n,i=ie(f);n&&ue(i,n),c.enable(c.SAMPLE_ALPHA_TO_COVERAGE),nt(i,t,e,s),c.disable(c.SAMPLE_ALPHA_TO_COVERAGE),c.stencilFunc(c.NOTEQUAL,0,255),c.stencilOp(c.KEEP,c.ZERO,c.ZERO),c.colorMask(!0,!0,!0,!0);const E=Ic(!1,!1,a,f),$=zc(r),v=Be(A.$matrix);Cc(E,0,A.$matrix,v,0,$,n),Ms($),Qt(v),nt(E,t,e,s)},Ha=(t,e,s,n)=>{const o=tt.shift(),r=tt.shift(),a=tt.shift(),l=tt.shift(),h=tt.shift();c.disable(c.STENCIL_TEST);const f=Bc(o,l);z(f),c.enable(c.STENCIL_TEST),c.frontFace(c.CCW),c.stencilMask(255),c.stencilFunc(c.ALWAYS,0,255),c.stencilOpSeparate(c.FRONT,c.KEEP,c.KEEP,c.INCR_WRAP),c.stencilOpSeparate(c.BACK,c.KEEP,c.KEEP,c.DECR_WRAP),c.colorMask(!1,!1,!1,!1);const i=!!n,E=ie(i);n&&ue(E,n),c.enable(c.SAMPLE_ALPHA_TO_COVERAGE),nt(E,t,e,s),c.disable(c.SAMPLE_ALPHA_TO_COVERAGE),c.stencilFunc(c.NOTEQUAL,0,255),c.stencilOp(c.KEEP,c.ZERO,c.ZERO),c.colorMask(!0,!0,!0,!0),A.save(),A.transform(r[0],r[1],r[2],r[3],r[4],r[5]);const $=A.$stack[A.$stack.length-1],v=Be(A.$matrix),T=Ic(!0,!!h,a,i);Cc(T,1,$,v,h,n),A.restore(),Qt(v),nt(T,t,e,s)},ss=new Map,Ka=(t,e)=>{const s=\`b\${t?"y":"n"}\${e?"y":"n"}\`;if(ss.has(s))return ss.get(s);const n=t?Bo():wo(),o=new Z(pe(e?14:5,!0,!1,e),n);return ss.set(s,o),o},Za=(t,e,s,n)=>{const o=t.highp,r=A.$stack[A.$stack.length-1];o[0]=r[0],o[1]=r[1],o[2]=r[2],o[4]=r[3],o[5]=r[4],o[6]=r[5],o[8]=r[6],o[9]=r[7],o[10]=r[8];const a=Be(A.$matrix);o[12]=a[0],o[13]=a[1],o[14]=a[2],o[16]=a[3],o[17]=a[4],o[18]=a[5],o[11]=a[6],o[15]=a[7],o[19]=a[8],o[3]=it(),o[7]=ut(),n&&(o[20]=n[0],o[21]=n[1],o[22]=0,o[24]=n[2],o[25]=n[3],o[26]=0,o[28]=n[4],o[29]=n[5],o[30]=1,o[32]=n[6],o[33]=n[7],o[34]=0,o[36]=n[8],o[37]=n[9],o[38]=0,o[40]=n[10],o[41]=n[11],o[42]=1,o[31]=n[12],o[35]=n[13],o[39]=n[14],o[43]=n[15],o[44]=n[16],o[45]=n[17],o[46]=n[18],o[47]=n[19],o[48]=n[20],o[49]=n[21],o[50]=n[22],o[51]=n[23],o[52]=n[24],o[53]=n[25]);const l=t.mediump;l[0]=e,l[1]=s},Qa=(t,e,s,n)=>{c.stencilFunc(c.ALWAYS,0,255),c.stencilOpSeparate(c.FRONT,c.KEEP,c.KEEP,c.INCR_WRAP),c.stencilOpSeparate(c.BACK,c.KEEP,c.KEEP,c.DECR_WRAP),c.colorMask(!1,!1,!1,!1);const o=!!n,r=ie(o);n&&ue(r,n),c.enable(c.SAMPLE_ALPHA_TO_COVERAGE),nt(r,t,e,s),c.disable(c.SAMPLE_ALPHA_TO_COVERAGE);const a=Rt.shift(),l=Rt.shift(),h=Rt.shift(),f=Rt.shift(),i=Rt.shift(),E=Rt.shift(),$=Qe(h,f,a,E);A.save(),A.transform(l[0],l[1],l[2],l[3],l[4],l[5]),c.stencilFunc(c.NOTEQUAL,0,255),c.stencilOp(c.KEEP,c.ZERO,c.ZERO),c.colorMask(!0,!0,!0,!0);const v=Ka(i,o);Za(v,h,f,n),nt(v,t,e,s),A.restore(),D($)},Ja=()=>{const t=ec();c.enable(c.STENCIL_TEST),c.frontFace(c.CCW),c.stencilMask(255);let e=0,s=null;for(let n=0;n<bt.length;n++)switch(_t.has(n)&&(s=_t.get(n)),bt[n]){case"fill":{const r=q.shift();Da(t,e,r,s),e+=r}break;case"linear":{const r=q.shift();ja(t,e,r,s),e+=r}break;case"radial":{const r=q.shift();Ha(t,e,r,s),e+=r}break;case"bitmap":{const r=q.shift();Qa(t,e,r,s),e+=r}break}c.disable(c.STENCIL_TEST),sc(t),Hs(),qs()};let cs=0;const Lc=new Float32Array(256);for(let t=1;t<256;t++)Lc[t]=255/t;const qa=async(t,e)=>{const s=Ec(0,0,t,e);z(s),c.bindFramebuffer(c.FRAMEBUFFER,un()),c.framebufferTexture2D(c.FRAMEBUFFER,c.COLOR_ATTACHMENT0,c.TEXTURE_2D,s.resource,0);const n=new Uint8Array(t*e*4),o=A.$mainAttachmentObject;n.byteLength>cs&&(cs=$e(n.byteLength),c.bufferData(c.PIXEL_PACK_BUFFER,cs,c.STREAM_READ)),c.readPixels(0,o.height-e,t,e,c.RGBA,c.UNSIGNED_BYTE,0);const r=c.fenceSync(c.SYNC_GPU_COMMANDS_COMPLETE,0);await new Promise(a=>{const l=()=>{if(c.clientWaitSync(r,c.SYNC_FLUSH_COMMANDS_BIT,0)===c.TIMEOUT_EXPIRED){requestAnimationFrame(l);return}return c.deleteSync(r),c.getBufferSubData(c.PIXEL_PACK_BUFFER,0,n),a()};l()}),c.bindFramebuffer(c.FRAMEBUFFER,ft);for(let a=0;a<n.length;a+=4){const l=n[a+3];if(l===0||l===255)continue;const h=Lc[l];n[a]=Math.min(255,Math.round(n[a]*h)),n[a+1]=Math.min(255,Math.round(n[a+1]*h)),n[a+2]=Math.min(255,Math.round(n[a+2]*h))}return await createImageBitmap(new ImageData(new Uint8ClampedArray(n),t,e),{imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"})};class tl{$stack;$matrix;$clearColorR;$clearColorG;$clearColorB;$clearColorA;$mainAttachmentObject;$stackAttachmentObject;globalAlpha;globalCompositeOperation;imageSmoothingEnabled;$fillStyle;$strokeStyle;maskBounds;thickness;caps;joints;miterLimit;constructor(e,s,n=1){Dc(e),Pc(e.getParameter(e.MAX_TEXTURE_SIZE)),Uc(s),Vc(n),this.$stack=be(),this.$stackAttachmentObject=be(),this.$matrix=we(1,0,0,0,1,0,0,0,1),this.$clearColorR=0,this.$clearColorG=0,this.$clearColorB=0,this.$clearColorA=0,this.thickness=1,this.caps=1,this.joints=2,this.miterLimit=0,this.$mainAttachmentObject=null,this.globalAlpha=1,this.globalCompositeOperation="normal",this.imageSmoothingEnabled=!1,this.$fillStyle=new Float32Array([1,1,1,1]),this.$strokeStyle=new Float32Array([1,1,1,1]),this.maskBounds={xMin:0,yMin:0,xMax:0,yMax:0},e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),nn(e),on(e),rn(e,_s()),an(e),fr(e),$r(),ta(e),Xc(this)}clearTransferBounds(){Fn()}updateBackgroundColor(e,s,n,o){tn(this,e,s,n,o)}fillBackgroundColor(){en(this.$clearColorR,this.$clearColorG,this.$clearColorB,this.$clearColorA)}resize(e,s,n=!0){Sn(this,e,s,n)}clearRect(e,s,n,o){wn(e,s,n,o)}bind(e){Cn(this,e)}save(){Ln(this)}restore(){kn(this)}setTransform(e,s,n,o,r,a){Nn(this.$matrix,e,s,n,o,r,a)}transform(e,s,n,o,r,a){Pn(this,e,s,n,o,r,a)}reset(){Un(this)}beginPath(){Dn(this),Hc()}moveTo(e,s){Ee(e,s)}lineTo(e,s){Zc(e,s)}quadraticCurveTo(e,s,n,o){ms(e,s,n,o)}fillStyle(e,s,n,o){this.$fillStyle[0]=e,this.$fillStyle[1]=s,this.$fillStyle[2]=n,this.$fillStyle[3]=o}strokeStyle(e,s,n,o){this.$strokeStyle[0]=e,this.$strokeStyle[1]=s,this.$strokeStyle[2]=n,this.$strokeStyle[3]=o}closePath(){Qc()}arc(e,s,n){qc(e,s,n)}bezierCurveTo(e,s,n,o,r,a){te(e,s,n,o,r,a)}fill(){Wn("fill")}gradientFill(e,s,n,o,r,a){jn(e,s,n,o,r,a)}bitmapFill(e,s,n,o,r,a){yr(e,s,n,o,r,a)}stroke(){gr()}gradientStroke(e,s,n,o,r,a){oo(e,s,n,o,r,a)}bitmapStroke(e,s,n,o,r,a){Rr(e,s,n,o,r,a)}clip(){ko()}get currentAttachmentObject(){return Bs()}get atlasAttachmentObject(){return mn()}createNode(e,s){return lc(e,s)}removeNode(e){Do(e)}beginNodeRendering(e){ka(e),Xn(e.x,e.y,e.w,e.h)}endNodeRendering(){_n()}drawFill(){Ja()}drawDisplayObject(e,s,n,o,r,a){Na(e),cr(e,s,n,o,r,a)}drawArraysInstanced(){ur()}clearArraysInstanced(){nr()}transferMainCanvas(){br()}drawPixels(e,s){xr(e,s)}drawElement(e,s){Mr(e,s)}beginMask(){Er()}setMaskBounds(e,s,n,o){Tr(e,s,n,o)}endMask(){Pe()}leaveMask(){this.drawArraysInstanced(),Ar()}useGrid(e){ro(e)}applyFilter(e,s,n,o,r,a,l,h,f,i,E){this.drawArraysInstanced(),La(e,s,n,o,r,a,l,h,f,i,E)}async createImageBitmap(e,s){return await qa(e,s)}}const el=4;let x;const sl=t=>{x=t};let ns;const cl=t=>{ns=t};let os=0;const nl=()=>os;let rs=0;const ol=()=>rs;let as=!1;const rl=(t,e)=>{as=!0,os=t,rs=e},al=()=>as,ll=()=>{ns.width=os,ns.height=rs,as=!1},il=[],kc=(...t)=>{const e=il.pop()||[];return t.length&&e.push(...t),e},jt=(t,e=1)=>({R:(t&16711680)>>16,G:(t&65280)>>8,B:t&255,A:e*255}),ul=(t,e)=>{cl(t);const s=t.getContext("webgl2",{stencil:!0,premultipliedAlpha:!0,antialias:!1,depth:!1});if(!s)throw new Error("webgl2 is not supported.");sl(new tl(s,el,e))},hl=(t,e,s=!0)=>{nl()===t&&ol()===e||(rl(t,e),x.resize(t,e,s),s&&_.reset())},fl=0,bl=1,$l=2,El=3,Tl=4,Al=5,xl=6,vl=7,Ml=8,yl=9,Rl=10,gl=11,pl=12,Ol=13,ml=14,ls=(t,e=!1)=>{let s=0;for(;t.length>s;)switch(t[s++]){case yl:x.beginPath();break;case fl:x.moveTo(t[s++],t[s++]);break;case $l:x.lineTo(t[s++],t[s++]);break;case bl:x.quadraticCurveTo(t[s++],t[s++],t[s++],t[s++]);break;case Al:if(e){s+=4;break}x.fillStyle(t[s++]/255,t[s++]/255,t[s++]/255,t[s++]/255);break;case vl:x.fill();break;case xl:if(e){s+=8;break}x.thickness=t[s++],x.caps=t[s++],x.joints=t[s++],x.miterLimit=t[s++],x.strokeStyle(t[s++]/255,t[s++]/255,t[s++]/255,t[s++]/255);break;case Ml:if(e)break;x.stroke();break;case pl:x.closePath();break;case Tl:x.arc(t[s++],t[s++],t[s++]);break;case El:x.bezierCurveTo(t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]);break;case Rl:{if(e){s+=1;const i=t[s++];s+=i*5,s+=9,x.fill();break}const n=t[s++],o=kc(),r=t[s++];for(let i=0;i<r;++i)o.push(t[s++],t[s++],t[s++],t[s++],t[s++]);const a=new Float32Array([t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]]),l=t[s++],h=t[s++],f=t[s++];x.gradientFill(n,o,a,l,h,f)}break;case Ol:{if(e){s+=2;const h=t[s++];s+=h,s+=8,x.fill();break}const n=t[s++],o=t[s++],r=t[s++],a=new Uint8Array(t.subarray(s,s+r));s+=r;const l=new Float32Array([t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]]);x.bitmapFill(a,l,n,o,!!t[s++],!!t[s++])}break;case gl:{if(e){s+=20,x.fill();break}x.thickness=t[s++],x.caps=t[s++],x.joints=t[s++],x.miterLimit=t[s++];const n=t[s++],o=kc(),r=t[s++];for(let i=0;i<r;++i)o.push(t[s++],t[s++],t[s++],t[s++],t[s++]);const a=new Float32Array([t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]]),l=t[s++],h=t[s++],f=t[s++];x.gradientStroke(n,o,a,l,h,f)}break;case ml:{if(e){s+=6;const h=t[s++];s+=h,s+=8,x.fill();break}x.thickness=t[s++],x.caps=t[s++],x.joints=t[s++],x.miterLimit=t[s++];const n=t[s++],o=t[s++],r=t[s++],a=new Uint8Array(t.subarray(s,s+r));s+=r;const l=new Float32Array([t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]]);x.bitmapStroke(a,l,n,o,!!t[s++],!!t[s++])}break}},Ht=t=>{switch(t){case 0:return"copy";case 1:return"add";case 2:return"alpha";case 3:return"darken";case 4:return"difference";case 5:return"erase";case 6:return"hardlight";case 7:return"invert";case 8:return"layer";case 9:return"lighten";case 10:return"multiply";case 11:return"normal";case 12:return"overlay";case 13:return"screen";case 14:return"subtract";default:return"normal"}},is=(t,e)=>{const s=t.subarray(e,e+6);e+=6;const n=t.subarray(e,e+8);e+=8;const o=t.subarray(e,e+4);e+=4;const r=t[e++],a=t[e++],l=t[e++],h=t[e++],f=!!t[e++],i=!!t[e++],E=!!t[e++],$=\`\${t[e++]}\`,v=t[e++],T=Math.sqrt(s[0]*s[0]+s[1]*s[1]),u=Math.sqrt(s[2]*s[2]+s[3]*s[3]);let g;if(t[e++]){if(g=_.get($,\`\${v}\`),!g)return e}else{const m=f?new Float32Array(28):null;m&&(m.set(t.subarray(e,e+24)),e+=24),x.useGrid(m);const y=t[e++],M=t.subarray(e,e+y);if(E&&!f){const S=Math.ceil(Math.abs(l-r)),w=Math.ceil(Math.abs(h-a));g=x.createNode(S,w),_.set($,\`\${v}\`,g);const O=x.currentAttachmentObject;x.bind(x.atlasAttachmentObject),x.reset(),x.beginNodeRendering(g);const p=x.atlasAttachmentObject.height-g.y-w;x.setTransform(1,0,0,1,g.x,p),i?(ls(M),x.drawFill()):x.drawPixels(g,new Uint8Array(M)),x.endNodeRendering(),O&&x.bind(O)}else{const S=Math.ceil(Math.abs(l-r)*T),w=Math.ceil(Math.abs(h-a)*u);g=x.createNode(S,w),_.set($,\`\${v}\`,g);const O=x.currentAttachmentObject;x.bind(x.atlasAttachmentObject),x.reset(),x.beginNodeRendering(g);const p=x.atlasAttachmentObject.height-g.y-w;x.setTransform(T,0,0,u,-r*T+g.x,-a*u+p),m&&(m[24]=g.x,m[25]=p),ls(M),x.drawFill(),x.endNodeRendering(),O&&x.bind(O)}e+=y}const d=t[e++];if(!!t[e++]){const m=!!t[e++],y=t.subarray(e,e+4);e+=4;const M=t[e++],S=t.subarray(e,e+M),w=Math.ceil(Math.abs(o[2]-o[0])),O=Math.ceil(Math.abs(o[3]-o[1]));return x.applyFilter(g,$,m,w,O,E,s,n,Ht(d),y,S),e+=M,e}if(x.globalAlpha=Math.min(Math.max(0,n[3]+n[7]/255),1),x.imageSmoothingEnabled=!0,x.globalCompositeOperation=Ht(d),E&&!f)x.setTransform(s[0],s[1],s[2],s[3],s[4],s[5]),x.drawDisplayObject(g,o[0],o[1],o[2],o[3],n);else{const m=Math.atan2(s[1],s[0]),y=Math.atan2(-s[2],s[3]);if(m||y){const M=r*T,S=a*u,w=Math.cos(m),O=Math.sin(m),p=Math.cos(y),R=Math.sin(y);x.setTransform(w,O,-R,p,M*w-S*R+s[4],M*O+S*p+s[5])}else x.setTransform(1,0,0,1,o[0],o[1]);x.drawDisplayObject(g,o[0],o[1],o[2],o[3],n)}return e},us=(t,e)=>{const s=t.subarray(e,e+6);e+=6,x.reset(),x.setTransform(s[0],s[1],s[2],s[3],s[4],s[5]);const o=!!t[e++]?new Float32Array(28):null;x.useGrid(o),o&&(o.set(t.subarray(e,e+24)),e+=24);const r=t[e++],a=t.subarray(e,e+r);return ls(a,!0),e+=r,x.clip(),e},Nc=(t,e,s)=>{const n=t.widthTable[e.line]||0,o=e.textFormat,r=o.leftMargin||0;if(!s.wordWrap&&n>s.rawWidth)return Math.max(0,r);const a=o.rightMargin||0;return o.align==="center"||s.autoSize==="center"?Math.max(0,s.rawWidth/2-r-a-n/2-2):o.align==="right"||s.autoSize==="right"?Math.max(0,s.rawWidth-r-n-a-4):Math.max(0,r)},Fl=t=>{let e="";return t.italic&&(e+="italic "),t.bold&&(e+="bold "),\`\${e}\${t.size}px '\${t.font}','sans-serif'\`},dl=(t,e,s,n)=>{const o=new OffscreenCanvas(e.width,e.height),r=o.getContext("2d");if(!r)return o;const a=Math.min(1,Math.max(s,n));if(e.background||e.border){if(r.beginPath(),r.moveTo(0,0),r.lineTo(e.width,0),r.lineTo(e.width,e.height),r.lineTo(0,e.height),r.lineTo(0,0),e.background){const y=jt(e.backgroundColor);r.fillStyle=\`rgba(\${y.R},\${y.G},\${y.B},\${y.A})\`,r.fill()}if(e.border){const y=jt(e.borderColor);r.lineWidth=a,r.strokeStyle=\`rgba(\${y.R},\${y.G},\${y.B},\${y.A})\`,r.stroke()}}if(!t)return o;r.save(),r.beginPath(),r.moveTo(2,2),r.lineTo(e.width-2,2),r.lineTo(e.width-2,e.height-2),r.lineTo(2,e.height-2),r.lineTo(2,2),r.clip();let l=2;if(e.scrollX>0){const y=(e.textWidth+4-e.rawWidth)/e.rawWidth;l+=-e.scrollX*y}let h=2;if(e.scrollY>0){const y=(e.textHeight+2-e.rawHeight)/e.rawHeight;h+=-e.scrollY*y}if(r.setTransform(s,0,0,n,l*s,h*n),r.beginPath(),e.selectIndex>-1&&e.focusIndex>-1){const y=t.textTable.length-1;let M=0,S=0;e.focusIndex<=e.selectIndex?(M=Math.min(e.focusIndex,y),S=Math.min(e.selectIndex,y)):(M=Math.min(e.selectIndex,y),S=Math.min(e.focusIndex-1,y));const w=t.textTable[M],O=t.lineTable[w.line],p=Nc(t,O,e);let R=0;if(M&&w.mode==="text"){let b=M;for(;b;){const L=t.textTable[--b];if(L.mode!=="text")break;R+=L.w}}r.fillStyle="#b4d7ff";let B=0;for(let b=M;b<=S;++b){const L=t.textTable[b];if(L.mode==="text"&&(B+=L.w,b!==S))continue;let N=0;const P=L.mode==="text"?L.line:L.line-1;for(let k=0;k<P;++k)N+=t.heightTable[k];r.beginPath(),r.rect(R,N,B+p,t.heightTable[P]),r.fill(),R=0,B=0}}const f=e.rawWidth;let i=0;if(e.scrollX>0){const y=(e.textWidth-f)/f;i=e.scrollX*y}const E=f+i,$=e.rawHeight;let v=0;if(e.scrollY>0){const y=(e.textHeight-$)/$;v=e.scrollY*y}const T=$+v;let u=0,g=0,I=0,d=0,C=!1,m=-1;for(let y=0;y<t.textTable.length;++y){const M=t.textTable[y];if(!M)continue;if((M.mode==="text"||M.mode==="break")&&(m++,e.stopIndex>-1&&m>e.stopIndex))break;if(C&&M.mode==="text")continue;const S=M.textFormat;if(e.autoSize==="none"){if(g>T)break;if(M.mode==="text"&&(i>u+M.w||u>E)){u+=M.w;continue}}const w=jt(S.color||0);if(r.fillStyle=\`rgba(\${w.R},\${w.G},\${w.B},\${w.A})\`,e.focusVisible&&e.focusIndex===y){const p=u+I+.1;let R=M.line,B=M.y,b=t.ascentTable[R];M.mode!=="text"&&(B=M.mode==="break"?M.h:t.ascentTable[R-1],R>0?(R=M.line-1,b=t.ascentTable[R]):b=M.h),R>0&&t.ascentTable[R]===0&&R++;for(let L=0;L<R;++L)b+=t.heightTable[L];r.strokeStyle=\`rgba(\${w.R},\${w.G},\${w.B},\${w.A})\`,r.beginPath(),r.moveTo(p,b),r.lineTo(p,b-B),r.stroke()}if(e.thickness){const p=jt(e.thicknessColor);r.lineWidth=e.thickness,r.strokeStyle=\`rgba(\${p.R},\${p.G},\${p.B},\${p.A})\`}const O=M.line|0;switch(M.mode){case"break":case"wrap":if(u=0,O&&(g+=t.heightTable[O-1]),v>g+t.heightTable[O]){C=!0;continue}d=t.ascentTable[O],I=Nc(t,M,e),C=!1;break;case"text":{r.beginPath(),r.font=Fl(S);const p=u+I,R=g+d;if(S.underline){const B=jt(S.color||0);r.lineWidth=a,r.strokeStyle=\`rgba(\${B.R},\${B.G},\${B.B},\${B.A})\`,r.beginPath(),r.moveTo(p,R+2),r.lineTo(p+M.w,R+2),r.stroke()}e.thickness&&r.strokeText(M.text,p,R),r.fillText(M.text,p,R),u+=M.w}break}}if(e.focusVisible&&e.focusIndex>=t.textTable.length){const y=t.textTable[e.focusIndex-1];if(y){const M=jt(y.textFormat.color||0);r.strokeStyle=\`rgba(\${M.R},\${M.G},\${M.B},\${M.A})\`;const S=u+I+.1,w=g+d;r.beginPath(),y.mode==="text"?r.moveTo(S,w-y.y):r.moveTo(S,w+y.h),r.lineTo(S,w),r.stroke()}}return r.restore(),o},Sl=new TextDecoder,hs=(t,e)=>{const s=t.subarray(e,e+6);e+=6;const n=t.subarray(e,e+8);e+=8;const o=t.subarray(e,e+4);e+=4;const r=t[e++],a=t[e++],l=t[e++],h=t[e++],f=\`\${t[e++]}\`,i=t[e++],E=!!t[e++],$=Math.sqrt(s[0]*s[0]+s[1]*s[1]),v=Math.sqrt(s[2]*s[2]+s[3]*s[3]);let T;if(t[e++]){if(T=_.get(f,\`\${i}\`),!T)return e}else{const m=Math.ceil(Math.abs(l-r)*$),y=Math.ceil(Math.abs(h-a)*v),M=!!t[e++];T=M?_.get(f,\`\${i}\`):x.createNode(m,y),M||_.set(f,\`\${i}\`,T);const S=t[e++],w=new Uint8Array(t.subarray(e,e+S));e+=S;let O="none";switch(t[e++]){case 0:O="center";break;case 1:O="left";break;case 2:O="none";break;case 3:O="right";break}const p={width:m,height:y,autoSize:O,stopIndex:t[e++],scrollX:t[e++],scrollY:t[e++],textWidth:t[e++],textHeight:t[e++],rawWidth:t[e++],rawHeight:t[e++],focusIndex:t[e++],selectIndex:t[e++],focusVisible:!!t[e++],thickness:t[e++],thicknessColor:t[e++],wordWrap:!!t[e++],border:!!t[e++],borderColor:t[e++],background:!!t[e++],backgroundColor:t[e++],defaultColor:t[e++],defaultSize:t[e++]},R=dl(JSON.parse(Sl.decode(w)),p,$,v),B=x.currentAttachmentObject;x.bind(x.atlasAttachmentObject),x.reset(),x.beginNodeRendering(T);const b=x.atlasAttachmentObject.height-T.y-y;x.setTransform(1,0,0,1,T.x,b),x.drawElement(T,R),x.endNodeRendering(),B&&x.bind(B)}const g=t[e++];if(!!t[e++]){const m=!!t[e++],y=t.subarray(e,e+4);e+=4;const M=t[e++],S=t.subarray(e,e+M),w=Math.ceil(Math.abs(o[2]-o[0])),O=Math.ceil(Math.abs(o[3]-o[1]));return x.applyFilter(T,f,!!Math.max(+E,+m),w,O,!1,s,n,Ht(g),y,S),e+=M,e}x.globalAlpha=Math.min(Math.max(0,n[3]+n[7]/255),1),x.imageSmoothingEnabled=!0,x.globalCompositeOperation=Ht(g);const d=Math.atan2(s[1],s[0]),C=Math.atan2(-s[2],s[3]);if(d||C){const m=r*$,y=a*v,M=Math.cos(d),S=Math.sin(d),w=Math.cos(C),O=Math.sin(C);x.setTransform(M,S,-O,w,m*M-y*O+s[4],m*S+y*w+s[5])}else x.setTransform(1,0,0,1,o[0],o[1]);return x.drawDisplayObject(T,o[0],o[1],o[2],o[3],n),e},fs=(t,e,s)=>{const n=t.subarray(e,e+6);e+=6;const o=t.subarray(e,e+8);e+=8;const r=t.subarray(e,e+4);e+=4;const a=t[e++],l=t[e++],h=t[e++],f=t[e++],i=\`\${t[e++]}\`,E="0",$=!!t[e++];let v;if(t[e++]){if(v=_.get(i,\`\${E}\`),!v)return e}else{const I=Math.abs(h-a),d=Math.abs(f-l),C=!!t[e++];if(v=C?_.get(i,\`\${E}\`):x.createNode(I,d),C||_.set(i,\`\${E}\`,v),s&&s.length){const m=x.currentAttachmentObject;x.bind(x.atlasAttachmentObject),x.reset(),x.beginNodeRendering(v);const y=x.atlasAttachmentObject.height-v.y-d;x.setTransform(1,0,0,1,v.x,y);const M=s.shift();x.drawElement(v,M),x.endNodeRendering(),m&&x.bind(m)}}const u=t[e++];if(!!t[e++]){const I=!!t[e++],d=t.subarray(e,e+4);e+=4;const C=t[e++],m=t.subarray(e,e+C),y=Math.ceil(Math.abs(r[2]-r[0])),M=Math.ceil(Math.abs(r[3]-r[1]));return x.applyFilter(v,i,!!Math.max(+$,+I),y,M,!0,n,o,Ht(u),d,m),e+=C,e}return x.globalAlpha=Math.min(Math.max(0,o[3]+o[7]/255),1),x.imageSmoothingEnabled=!0,x.globalCompositeOperation=Ht(u),x.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),x.drawDisplayObject(v,r[0],r[1],r[2],r[3],o),e},bs=(t,e)=>{const s=t[e++];for(let n=0;n<s;++n)switch(t[e++]){case 0:e=bs(t,e);break;case 1:e=us(t,e);break}return e},$s=(t,e,s)=>{const n=!!t[e++];if(n){switch(x.drawArraysInstanced(),x.save(),x.beginMask(),x.setMaskBounds(t[e++],t[e++],t[e++],t[e++]),t[e++]){case 0:e=bs(t,e);break;case 1:e=us(t,e);break}x.endMask()}let o=0,r=!0;const a=t[e++];for(let l=0;a>l;l++){const h=t[e++],f=t[e++];if(o&&h>o&&(r&&(x.restore(),x.leaveMask()),o=0,r=!0),!r)continue;if(f){if(o=f,r=!!t[e++],!r)continue;switch(x.drawArraysInstanced(),x.save(),x.beginMask(),x.setMaskBounds(t[e++],t[e++],t[e++],t[e++]),t[e++]){case 0:e=bs(t,e);break;case 1:e=us(t,e);break}x.endMask();continue}if(!t[e++])continue;const i=t[e++];switch(i){case 0:e=$s(t,e,s);break;case 1:e=is(t,e);break;case 2:e=hs(t,e);break;case 3:e=fs(t,e,s);break;default:console.error("unknown type",i);break}}return(o||n)&&(x.restore(),x.leaveMask()),e};let Kt=-1;const wl=(t,e)=>{x.clearTransferBounds();let s=0;const n=t[s++];for(Kt!==n&&(Kt=n,Kt===-1?x.updateBackgroundColor(0,0,0,0):x.updateBackgroundColor((Kt>>16&255)/255,(Kt>>8&255)/255,(Kt&255)/255,1)),x.reset(),x.setTransform(1,0,0,1,0,0),x.fillBackgroundColor();t.length>s;){if(!t[s++])continue;const o=t[s++];switch(o){case 0:s=$s(t,s,e);break;case 1:s=is(t,s);break;case 2:s=hs(t,s);break;case 3:s=fs(t,s,e);break;default:console.error("unknown type",o);break}}x.drawArraysInstanced(),al()&&ll(),x.transferMainCanvas()},Bl=t=>{for(let e=0;e<t.length;++e){const s=\`\${t[e]}\`;if(!_.has(s))continue;const n=_.getById(s);for(const o of n.values())x.removeNode(o);_.removeById(s)}},Il=async(t,e,s,n=0,o=0,r)=>{x.clearTransferBounds();let a=1;for(x.reset(),x.setTransform(1,0,0,1,0,0),x.updateBackgroundColor((n>>16&255)/255,(n>>8&255)/255,(n&255)/255,o),x.fillBackgroundColor();t.length>a;){if(!t[a++])continue;const l=t[a++];switch(l){case 0:a=$s(t,a,r);break;case 1:a=is(t,a);break;case 2:a=hs(t,a);break;case 3:a=fs(t,a,r);break;default:console.error("unknown type",l);break}}return x.drawArraysInstanced(),await x.createImageBitmap(e,s)};class Cl{state;queue;constructor(){this.state="deactivate",this.queue=[]}async execute(){for(this.state="active";this.queue.length;){const e=this.queue.shift();if(e)switch(e.command){case"render":wl(e.buffer.subarray(0,e.length),e.imageBitmaps),globalThis.postMessage({message:"render",buffer:e.buffer},[e.buffer.buffer]);break;case"resize":hl(e.buffer[0],e.buffer[1],!!e.buffer[2]);break;case"initialize":ul(e.canvas,e.devicePixelRatio);break;case"removeCache":Bl(e.buffer);break;case"cacheClear":_.reset();break;case"capture":{const s=await Il(e.buffer.subarray(0,e.length),e.width,e.height,e.bgColor,e.bgAlpha,e.imageBitmaps);globalThis.postMessage({message:"capture",buffer:e.buffer,imageBitmap:s},[e.buffer.buffer,s])}break}}this.state="deactivate"}}const Es=new Cl;self.addEventListener("message",async t=>{Es.queue.push(t.data),Es.state==="deactivate"&&await Es.execute()})})();
658
- `,As=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",cn],{type:"text/javascript;charset=utf-8"});function Lr(e){let t;try{if(t=As&&(self.URL||self.webkitURL).createObjectURL(As),!t)throw"";const u=new Worker(t,{name:e?.name});return u.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),u}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(cn),{name:e?.name})}}const Me=new Lr,Nr=e=>{const t=e.transferControlToOffscreen();Me.postMessage({command:"initialize",canvas:t,devicePixelRatio:window.devicePixelRatio},[t])};class We{static get AT_TARGET(){return 2}static get BUBBLING_PHASE(){return 3}static get CAPTURING_PHASE(){return 1}}let g=class{type;bubbles;listener;target;currentTarget;eventPhase;_$stopImmediatePropagation;_$stopPropagation;constructor(t,u=!1){this.type=`${t}`,this.bubbles=u,this.target=null,this.currentTarget=null,this.eventPhase=We.AT_TARGET,this.listener=null,this._$stopImmediatePropagation=!1,this._$stopPropagation=!1}static get ADDED(){return"added"}static get ADDED_TO_STAGE(){return"addedToStage"}static get CHANGE(){return"change"}static get COMPLETE(){return"complete"}static get ENDED(){return"ended"}static get ENTER_FRAME(){return"enterFrame"}static get FRAME_LABEL(){return"frameLabel"}static get INPUT(){return"input"}static get OPEN(){return"open"}static get REMOVED(){return"removed"}static get REMOVED_FROM_STAGE(){return"removedFromStage"}static get RESIZE(){return"resize"}static get SCROLL(){return"scroll"}stopImmediatePropagation(){this._$stopImmediatePropagation=!0}stopPropagation(){this._$stopPropagation=!0}};const W=new Map,Nt=[],Pt=()=>Nt.length?Nt.pop():[],Ie=e=>{10>Nt.length&&(e.length=0,Nt.push(e))};let on=null;const Ue=e=>{on=e},Vt=()=>on;class B extends g{constructor(t,u=!0){return super(t,u),new Proxy(this,{get:(s,n)=>{if(n in s)return s[n];const r=Vt();if(r)switch(r.type){case B.KEY_DOWN:case B.KEY_UP:return n in r?$event[n]:void 0;default:return}}})}static get KEY_DOWN(){return"keydown"}static get KEY_UP(){return"keyup"}}const Pr=(e,t,u,s=!1,n=0)=>{let r;switch(t){case g.ENTER_FRAME:case B.KEY_DOWN:case B.KEY_UP:(!W.size||!W.has(t))&&W.set(t,Pt()),r=W.get(t);break;default:e._$events||(e._$events=new Map),(!e._$events.size||!e._$events.has(t))&&e._$events.set(t,Pt()),r=e._$events.get(t);break}const a=r.length;let i=0;for(;i<a;++i){const c=r[i];if(s===c.useCapture&&c.target===e&&c.listener===u)break}if(a===i)r.push({listener:u,priority:n,useCapture:s,target:e});else{const c=r[i];c.listener=u,c.priority=n,c.useCapture=s,c.target=e}r.length>1&&r.sort((c,o)=>{switch(!0){case c.priority>o.priority:return-1;case c.priority<o.priority:return 1;default:return 0}})},Br=(e,t)=>{switch(t){case g.ENTER_FRAME:case B.KEY_DOWN:case B.KEY_UP:return!!(W.size&&W.has(t));default:return!!(e._$events&&e._$events.size&&e._$events.has(t))}},Dr=(e,t,u,s=!1)=>{let n;switch(t){case g.ENTER_FRAME:case B.KEY_DOWN:case B.KEY_UP:if(!W.size||!W.has(t))return;n=W.get(t);break;default:if(!e._$events||!e._$events.size||!e._$events.has(t))return;n=e._$events.get(t);break}if(n){for(let r=0;r<n.length;++r){const a=n[r];if(s===a.useCapture&&a.listener===u){n.splice(r,1);break}}if(!n.length){W.has(t)&&W.delete(t),e._$events&&e._$events.has(t)&&(e._$events.delete(t),e._$events.size||(e._$events=null)),Ie(n);return}n.length>1&&n.sort((r,a)=>{switch(!0){case r.priority>a.priority:return-1;case r.priority<a.priority:return 1;default:return 0}})}},_r=(e,t,u=!1)=>{let s;switch(t){case g.ENTER_FRAME:case B.KEY_DOWN:case B.KEY_UP:if(!W.size||!W.has(t))return;s=W.get(t);break;default:if(!e._$events||!e._$events.size||!e._$events.has(t))return;s=e._$events.get(t);break}if(!s)return;const n=Pt();for(let r=0;r<s.length;++r){const a=s[r];u!==a.useCapture&&n.push(a)}if(!n.length){W.has(t)&&W.delete(t),e._$events&&e._$events.has(t)&&(e._$events.delete(t),e._$events.size||(e._$events=null)),Ie(n),Ie(s);return}n.length>1&&n.sort((r,a)=>{switch(!0){case r.priority>a.priority:return-1;case r.priority<a.priority:return 1;default:return 0}}),W.has(t)?W.set(t,n):e._$events?.set(t,n),Ie(s)},Ur=(e,t)=>{if(e.hasEventListener(t))return!0;if("parent"in e){let u=e.parent;for(;u;){if(u.hasEventListener(t))return!0;if(!("parent"in u))break;u=u.parent}}return!1},qr=(e,t)=>{switch(t.type){case g.ENTER_FRAME:case B.KEY_DOWN:case B.KEY_UP:{if(!W.size||!W.has(t.type))return!1;const u=W.get(t.type);if(!u.length)return!1;for(let s=0;s<u.length;++s){const n=u[s];t.eventPhase=We.AT_TARGET,t.target=t.currentTarget=n.target;try{t.listener=n.listener,n.listener(t)}catch(r){return console.error(r),!1}}}return!0;default:{t.target=e;let u=null;if(e._$events&&e._$events.size&&e._$events.has(t.type)){const n=e._$events.get(t.type);n&&(u=n.slice(0))}const s=Pt();if("parent"in e){let n=e.parent;for(;n;){if(n.hasEventListener(t.type)){const r=n._$events&&n._$events.has(t.type)?n._$events.get(t.type):null;r&&s.push(r)}if(!("parent"in n))break;n=n.parent}}if(!u&&!s.length)return u&&Ie(u),Ie(s),!1;if(s.length)switch(t.eventPhase=We.CAPTURING_PHASE,!0){case t._$stopImmediatePropagation:case t._$stopPropagation:break;default:for(let n=s.length-1;n>-1;--n){const r=s[n];for(let a=0;a<r.length;++a){const i=r[a];if(i.useCapture){t.currentTarget=i.target;try{t.listener=i.listener,i.listener.call(null,t)}catch(c){return console.error(c),!1}if(t._$stopImmediatePropagation)break}}if(t._$stopImmediatePropagation)break}break}if(u&&!t._$stopImmediatePropagation&&!t._$stopPropagation){t.eventPhase=We.AT_TARGET;for(let n=0;n<u.length;++n){const r=u[n];if(!r.useCapture){t.currentTarget=r.target;try{t.listener=r.listener,r.listener.call(null,t)}catch(a){return console.error(a),!1}if(t._$stopImmediatePropagation)break}}Ie(u)}if(s.length){switch(t.eventPhase=We.BUBBLING_PHASE,!0){case t._$stopImmediatePropagation:case t._$stopPropagation:case!t.bubbles:break;default:for(let n=0;n<s.length;++n){const r=s[n];for(let a=0;a<r.length;++a){const i=r[a];if(!i.useCapture){t.currentTarget=i.target;try{t.listener=i.listener,i.listener.call(null,t)}catch(c){return console.error(c),!1}if(t._$stopImmediatePropagation)break}}if(t._$stopImmediatePropagation)break}break}Ie(s)}}return!0}};class je{_$events;constructor(){this._$events=null}addEventListener(t,u,s=!1,n=0){this._$events||(this._$events=new Map),Pr(this,t,u,s,n)}dispatchEvent(t){return qr(this,t)}hasEventListener(t){return Br(this,t)}removeEventListener(t,u,s=!1){Dr(this,t,u,s)}removeAllEventListener(t,u=!1){_r(this,t,u)}willTrigger(t){return Ur(this,t)}}class De extends g{constructor(t,u=!0){return super(t,u),new Proxy(this,{get:(s,n)=>{if(n in s)return s[n];const r=Vt();if(r)switch(r.type){case De.FOCUS_IN:case De.FOCUS_OUT:return n in r?$event[n]:void 0;default:return}}})}static get FOCUS_IN(){return"focusin"}static get FOCUS_OUT(){return"focusout"}}class St extends g{status;responseHeaders;responseURL;constructor(t,u=!1,s=0,n="",r=[]){super(t,u),this.status=s|0,this.responseHeaders=r,this.responseURL=n}static get HTTP_STATUS(){return"httpStatus"}}class Re extends g{text;constructor(t,u=!1,s=""){super(t,u),this.text=`${s}`}static get IO_ERROR(){return"ioError"}}class M extends g{constructor(t,u=!0){return super(t,u),new Proxy(this,{get:(s,n)=>{if(n in s)return s[n];const r=Vt();if(r)switch(r.type){case M.POINTER_DOWN:case M.POINTER_MOVE:case M.POINTER_UP:case M.POINTER_LEAVE:case M.POINTER_OVER:case M.POINTER_OUT:return n in r?$event[n]:void 0;default:return}}})}static get DOUBLE_CLICK(){return"dblclick"}static get POINTER_DOWN(){return"pointerdown"}static get POINTER_LEAVE(){return"pointerleave"}static get POINTER_MOVE(){return"pointermove"}static get POINTER_OUT(){return"pointerout"}static get POINTER_OVER(){return"pointerover"}static get POINTER_UP(){return"pointerup"}static get POINTER_CANCEL(){return"pointercancel"}}class X extends g{bytesLoaded;bytesTotal;constructor(t,u=!1,s=0,n=0){super(t,u),this.bytesLoaded=s|0,this.bytesTotal=n|0}static get PROGRESS(){return"progress"}}class oe extends g{static get PLAY(){return"play"}static get PLAYING(){return"playing"}static get PAUSE(){return"pause"}static get SEEK(){return"seek"}}class xe extends g{static get UPDATE(){return"jobupdate"}static get STOP(){return"jobstop"}}class Ke extends g{constructor(t,u=!0){return super(t,u),new Proxy(this,{get:(s,n)=>{if(n in s)return s[n];const r=Vt();if(r&&r.type===Ke.WHEEL)return n in r?$event[n]:void 0}})}static get WHEEL(){return"wheel"}}const ln=[],Wt=e=>{e.size&&e.clear(),ln.push(e)},Xr=()=>ln.pop()||new Map,Yr=(e,t,u)=>{u.clear(),e.$timerId!==null&&clearTimeout(e.$timerId);for(const s of t.values()){for(const n of s.values())n&&e.destroy(n);Wt(s)}t.clear()},Vr=(e,t)=>{if(!(!t||typeof t!="object")&&"canvas"in t){const u=t.canvas,s=u.width,n=u.height;t.clearRect(0,0,s+1,n+1),u.width=u.height=1,e.push(u)}},Wr=(e,t,u)=>{if(!e.has(t))return;const s=e.get(t);s.has(u)&&(s.delete(u),s.size||(Wt(s),e.delete(t)))},Hr=(e,t,u)=>{if(!t.has(u))return;const s=t.get(u);for(const n of s.values())e.destroy(n);t.delete(u),Wt(s)},zr=(e,t,u)=>{const s=e.get(t)||null;return s?(s.delete("trash"),s.get(u)||null):null},Gr=(e,t,u,s,n=null)=>{t.has(u)||t.set(u,Xr());const r=t.get(u);if(n===null){if(!r.has(s))return;e.destroy(r.get(s)),r.delete(s),r.size||(t.delete(u),Wt(r));return}r.set(s,n)},Kr=(e,t,u="")=>u?e.has(t)?e.get(t).has(u):!1:e.has(t),Qr=(e,t,u)=>{const s=[e*100,t*100];u&&s.push(u*100);let n=2166136261;for(let r=0;r<s.length;++r){let a=s[r]|0;for(let i=0;i<4;i++){const c=a&255;n^=c,n=Math.imul(n,16777619),a>>>=8}}return(n>>>0)%16777216},Zr=(e,t,u,s)=>`${e}${t}${u}${s}`,Jr=(e,t,u,s)=>{if(u.has(s))return;const n=t.get(s);n&&(n.set("trash",!0),u.set(s,n),e.$timerId!==null&&clearTimeout(e.$timerId),e.$removeCache=!1,e.$timerId=setTimeout(()=>{e.$removeCache=!0,e.$timerId=null},1e3))},jr=(e,t)=>{if(t.size){for(const[u,s]of t)s.has("trash")&&(e.removeById(u),e.$removeIds.push(+u));t.clear(),e.$removeCache=!1}};class ea{_$pool;_$store;_$trash;$timerId;$removeCache;$removeIds;constructor(){this._$pool=[],this._$store=new Map,this._$trash=new Map,this.$timerId=null,this.$removeIds=[],this.$removeCache=!1}reset(){Yr(this,this._$store,this._$trash)}destroy(t=null){Vr(this._$pool,t)}getCanvas(){return this._$pool.pop()||document.createElement("canvas")}remove(t,u){Wr(this._$store,t,u)}removeTimer(t){Jr(this,this._$store,this._$trash,t)}removeTimerScheduledCache(){jr(this,this._$trash)}removeById(t){Hr(this,this._$store,t)}getById(t){return this._$store.get(t)}get(t,u){return zr(this._$store,t,u)}set(t,u,s=null){Gr(this,this._$store,t,u,s)}has(t,u=""){return Kr(this._$store,t,u)}generateKeys(t,u,s){return Qr(t,u,s)}generateFilterKeys(t,u,s,n){return Zr(t,u,s,n)}}const O=new ea,ta=e=>{const t=O.getCanvas();t.width=e.width,t.height=e.height;const u=t.getContext("2d",{willReadFrequently:!0});u.drawImage(e,0,0);const s=u.getImageData(0,0,e.width,e.height),n=new Uint8Array(s.data.buffer);return O.destroy(u),n},ua=e=>{const t=O.getCanvas();t.width=e.width,t.height=e.height;const u=t.getContext("2d");u.setTransform(1,0,0,1,0,0),u.drawImage(e,0,0);const s=u.getImageData(0,0,e.width,e.height),n=new Uint8Array(s.data.buffer);return O.destroy(u),n};class Ne{width;height;buffer;constructor(t=0,u=0){this.width=t|0,this.height=u|0,this.buffer=null}set image(t){if(!t){this.width=0,this.height=0,this.buffer=null;return}this.buffer=ta(t),this.width=t.width,this.height=t.height}set canvas(t){if(!t){this.width=0,this.height=0,this.buffer=null;return}this.buffer=ua(t),this.width=t.width,this.height=t.height}clone(){const t=new Ne(this.width,this.height);return this.buffer!==null&&(t.buffer=this.buffer.slice()),t}}class sa{static get ADD(){return"add"}static get ALPHA(){return"alpha"}static get DARKEN(){return"darken"}static get DIFFERENCE(){return"difference"}static get ERASE(){return"erase"}static get HARDLIGHT(){return"hardlight"}static get INVERT(){return"invert"}static get LAYER(){return"layer"}static get LIGHTEN(){return"lighten"}static get MULTIPLY(){return"multiply"}static get NORMAL(){return"normal"}static get OVERLAY(){return"overlay"}static get SCREEN(){return"screen"}static get SUBTRACT(){return"subtract"}}const Y=e=>{e.changed=!0;const t=e.parent;t&&!t.changed&&Y(t)},na=(e,t)=>{const u=C.multiply(e._$colorTransform,t._$colorTransform);e._$colorTransform[0]=u[0],e._$colorTransform[1]=u[1],e._$colorTransform[2]=u[2],e._$colorTransform[3]=u[3],e._$colorTransform[4]=u[4],e._$colorTransform[5]=u[5],e._$colorTransform[6]=u[6],e._$colorTransform[7]=u[7],C.release(u)},hn=[],vs=(e=1,t=0,u=0,s=1,n=0,r=0)=>{const a=hn.pop()||new Float32Array(6);return a[0]=e,a[1]=t,a[2]=u,a[3]=s,a[4]=n,a[5]=r,a},ra=e=>{hn.push(e)},dn=[],Is=(e=1,t=1,u=1,s=1,n=0,r=0,a=0,i=0)=>{const c=dn.pop()||new Float32Array(8);return c[0]=e,c[1]=t,c[2]=u,c[3]=s,c[4]=n,c[5]=r,c[6]=a,c[7]=i,c},aa=e=>{dn.push(e)},ve=(e,t,u,s=null)=>{const n=+e;return isNaN(n)&&s!==null?s:Math.min(Math.max(t,isNaN(n)?0:n),u)};class C{_$colorTransform;constructor(t=1,u=1,s=1,n=1,r=0,a=0,i=0,c=0){this._$colorTransform=Is(t,u,s,n,r,a,i,c)}get rawData(){return this._$colorTransform}get alphaMultiplier(){return this._$colorTransform[3]}set alphaMultiplier(t){this._$colorTransform[3]=ve(t,0,1,1)}get alphaOffset(){return this._$colorTransform[7]}set alphaOffset(t){this._$colorTransform[7]=ve(t,-255,255,0)}get blueMultiplier(){return this._$colorTransform[2]}set blueMultiplier(t){this._$colorTransform[2]=ve(t,0,1,1)}get blueOffset(){return this._$colorTransform[6]}set blueOffset(t){this._$colorTransform[6]=ve(t,-255,255,0)}get greenMultiplier(){return this._$colorTransform[1]}set greenMultiplier(t){this._$colorTransform[1]=ve(t,0,1,1)}get greenOffset(){return this._$colorTransform[5]}set greenOffset(t){this._$colorTransform[5]=ve(t,-255,255,0)}get redMultiplier(){return this._$colorTransform[0]}set redMultiplier(t){this._$colorTransform[0]=ve(t,0,1,1)}get redOffset(){return this._$colorTransform[4]}set redOffset(t){this._$colorTransform[4]=ve(t,-255,255,0)}clone(){return new C(...this._$colorTransform)}concat(t){na(this,t)}static multiply(t,u){return Is(t[0]*u[0],t[1]*u[1],t[2]*u[2],t[3]*u[3],t[0]*u[4]+t[4],t[1]*u[5]+t[5],t[2]*u[6]+t[6],t[3]*u[7]+t[7])}static release(t){aa(t)}}const ia=e=>new A(e._$matrix[0],e._$matrix[1],e._$matrix[2],e._$matrix[3],e._$matrix[4],e._$matrix[5]),ca=(e,t)=>{const u=e._$matrix,s=t._$matrix;let n=u[0]*s[0],r=0,a=0,i=u[3]*s[3],c=u[4]*s[0]+s[4],o=u[5]*s[3]+s[5];(u[1]||u[2]||s[1]||s[2])&&(n+=u[1]*s[2],i+=u[2]*s[1],r+=u[0]*s[1]+u[1]*s[3],a+=u[2]*s[0]+u[3]*s[2],c+=u[5]*s[2],o+=u[4]*s[1]),u[0]=n,u[1]=r,u[2]=a,u[3]=i,u[4]=c,u[5]=o},oa=(e,t)=>{e._$matrix[0]=t._$matrix[0],e._$matrix[1]=t._$matrix[1],e._$matrix[2]=t._$matrix[2],e._$matrix[3]=t._$matrix[3],e._$matrix[4]=t._$matrix[4],e._$matrix[5]=t._$matrix[5]},la=(e,t,u,s=0,n=0,r=0)=>{e.identity(),e.rotate(s),e.scale(t,u),e.translate(n,r)},ha=(e,t,u,s=0,n=0,r=0)=>{const a=e._$matrix;if(a[0]=t/1638.4,a[3]=u/1638.4,s){const i=Math.cos(s),c=Math.sin(s);a[1]=c*a[3],a[2]=-c*a[0],a[0]*=i,a[3]*=i}else a[1]=0,a[2]=0;a[4]=n+t/2,a[5]=r+u/2},da=(e,t)=>new J(e.x+t.x,e.y+t.y),fa=e=>new J(e.x,e.y),ba=(e,t)=>{e.x=t.x,e.y=t.y},$a=(e,t)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),xa=(e,t)=>e.x===t.x&&e.y===t.y,ga=(e,t,u)=>new J(e.x+(t.x-e.x)*(1-u),e.y+(t.y-e.y)*(1-u)),ma=(e,t)=>{const u=t/e.length;e.x*=u,e.y*=u},pa=(e,t,u)=>{e.x+=t,e.y+=u},Ta=(e,t)=>new J(e*Math.cos(t),e*Math.sin(t)),Ea=(e,t,u)=>{e.x=t,e.y=u},ya=(e,t)=>new J(e.x-t.x,e.y-t.y);class J{x;y;constructor(t=0,u=0){this.x=t,this.y=u}get length(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))}add(t){return da(this,t)}clone(){return fa(this)}copyFrom(t){ba(this,t)}static distance(t,u){return $a(t,u)}equals(t){return xa(this,t)}static interpolate(t,u,s){return ga(t,u,s)}normalize(t){ma(this,t)}offset(t,u){pa(this,t,u)}static polar(t,u){return Ta(t,u)}setTo(t,u){Ea(this,t,u)}subtract(t){return ya(this,t)}}const wa=(e,t)=>new J(t.x*e._$matrix[0]+t.y*e._$matrix[2],t.x*e._$matrix[1]+t.y*e._$matrix[3]),Ma=e=>{e._$matrix[0]=1,e._$matrix[1]=0,e._$matrix[2]=0,e._$matrix[3]=1,e._$matrix[4]=0,e._$matrix[5]=0},Aa=e=>{const t=e._$matrix[0],u=e._$matrix[1],s=e._$matrix[2],n=e._$matrix[3],r=e._$matrix[4],a=e._$matrix[5];if(u===0&&s===0)e._$matrix[0]=1/t,e._$matrix[1]=0,e._$matrix[2]=0,e._$matrix[3]=1/n,e._$matrix[4]=-e._$matrix[0]*r,e._$matrix[5]=-e._$matrix[3]*a;else{const i=t*n-u*s;if(i){const c=1/i;e._$matrix[0]=n*c,e._$matrix[1]=-u*c,e._$matrix[2]=-s*c,e._$matrix[3]=t*c,e._$matrix[4]=-(e._$matrix[0]*r+e._$matrix[2]*a),e._$matrix[5]=-(e._$matrix[1]*r+e._$matrix[3]*a)}}},va=(e,t)=>{const u=e._$matrix,s=u[0],n=u[1],r=u[2],a=u[3],i=u[4],c=u[5];u[0]=s*Math.cos(t)-n*Math.sin(t),u[1]=s*Math.sin(t)+n*Math.cos(t),u[2]=r*Math.cos(t)-a*Math.sin(t),u[3]=r*Math.sin(t)+a*Math.cos(t),u[4]=i*Math.cos(t)-c*Math.sin(t),u[5]=i*Math.sin(t)+c*Math.cos(t)},Ia=(e,t,u)=>{const s=e._$matrix;s[0]*=t,s[2]*=t,s[4]*=t,s[1]*=u,s[3]*=u,s[5]*=u},Sa=(e,t,u,s,n,r,a)=>{const i=e._$matrix;i[0]=t,i[1]=u,i[2]=s,i[3]=n,i[4]=r,i[5]=a},Ra=(e,t)=>{const u=t.x,s=t.y,n=e._$matrix;return new J(u*n[0]+s*n[2]+n[4],u*n[1]+s*n[3]+n[5])},ka=(e,t,u)=>{e.tx+=t,e.ty+=u};class A{_$matrix;constructor(t=1,u=0,s=0,n=1,r=0,a=0){this._$matrix=vs(t,u,s,n,r,a)}get a(){return this._$matrix[0]}set a(t){this._$matrix[0]=t}get b(){return this._$matrix[1]}set b(t){this._$matrix[1]=t}get c(){return this._$matrix[2]}set c(t){this._$matrix[2]=t}get d(){return this._$matrix[3]}set d(t){this._$matrix[3]=t}get tx(){return this._$matrix[4]}set tx(t){this._$matrix[4]=t}get ty(){return this._$matrix[5]}set ty(t){this._$matrix[5]=t}get rawData(){return this._$matrix}clone(){return ia(this)}concat(t){ca(this,t)}copyFrom(t){oa(this,t)}createBox(t,u,s=0,n=0,r=0){la(this,t,u,s,n,r)}createGradientBox(t,u,s=0,n=0,r=0){ha(this,t,u,s,n,r)}deltaTransformPoint(t){return wa(this,t)}identity(){Ma(this)}invert(){Aa(this)}rotate(t){va(this,t)}scale(t,u){Ia(this,t,u)}setTo(t,u,s,n,r,a){Sa(this,t,u,s,n,r,a)}transformPoint(t){return Ra(this,t)}translate(t,u){ka(this,t,u)}static multiply(t,u){const s=t[0],n=t[1],r=t[2],a=t[3],i=t[4],c=t[5],o=u[0],d=u[1],l=u[2],h=u[3],b=u[4],f=u[5];return vs(s*o+r*d,n*o+a*d,s*l+r*h,n*l+a*h,s*b+r*f+i,n*b+a*f+c)}static release(t){ra(t)}}const Oa=e=>new be(e.x,e.y,e.width,e.height),Fa=(e,t,u)=>e.x<=t&&e.y<=u&&e.right>t&&e.bottom>u,Ca=(e,t)=>e.x<=t.x&&e.y<=t.y&&e.right>t.x&&e.bottom>t.y,La=(e,t)=>e.x<=t.x&&e.y<=t.y&&e.right>=t.right&&e.bottom>=t.bottom,Na=(e,t)=>{e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},Pa=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Ba=(e,t,u)=>{e.x-=t,e.width+=2*t,e.y-=u,e.height+=2*u},Da=(e,t)=>{e.x-=t.x,e.width+=2*t.x,e.y-=t.y,e.height+=2*t.y},_a=(e,t)=>{const u=Math.max(e.x,t.x),s=Math.max(e.y,t.y),n=Math.min(e.right,t.right),r=Math.min(e.bottom,t.bottom),a=n-u,i=r-s;return a>0&&i>0?new be(u,s,a,i):new be(0,0,0,0)},Ua=(e,t)=>{const u=Math.max(e.x,t.x),s=Math.max(e.y,t.y),n=Math.min(e.right,t.right),r=Math.min(e.bottom,t.bottom);return n-u>0&&r-s>0},qa=e=>e.width<=0||e.height<=0,Xa=(e,t,u)=>{e.x+=t,e.y+=u},Ya=(e,t)=>{e.x+=t.x,e.y+=t.y},Va=e=>{e.x=e.y=e.width=e.height=0},Wa=(e,t,u,s,n)=>{e.x=t,e.y=u,e.width=s,e.height=n},Ha=(e,t)=>e.isEmpty()?t.clone():t.isEmpty()?e.clone():new be(Math.min(e.x,t.x),Math.min(e.y,t.y),Math.max(e.right-t.left,t.right-e.left),Math.max(e.bottom-t.top,t.bottom-e.top));class be{x;y;width;height;constructor(t=0,u=0,s=0,n=0){this.x=t,this.y=u,this.width=s,this.height=n}get bottom(){return this.y+this.height}set bottom(t){this.height=t-this.y}get bottomRight(){return new J(this.right,this.bottom)}set bottomRight(t){this.right=t.x,this.bottom=t.y}get left(){return this.x}set left(t){this.width=this.right-t,this.x=t}get right(){return this.x+this.width}set right(t){this.width=t-this.x}get size(){return new J(this.width,this.height)}set size(t){this.width=t.x,this.height=t.y}get top(){return this.y}set top(t){this.height=this.bottom-t,this.y=t}get topLeft(){return new J(this.x,this.y)}set topLeft(t){this.left=t.x,this.top=t.y}clone(){return Oa(this)}contains(t,u){return Fa(this,t,u)}containsPoint(t){return Ca(this,t)}containsRect(t){return La(this,t)}copyFrom(t){Na(this,t)}equals(t){return Pa(this,t)}inflate(t,u){Ba(this,t,u)}inflatePoint(t){Da(this,t)}intersection(t){return _a(this,t)}intersects(t){return Ua(this,t)}isEmpty(){return qa(this)}offset(t,u){Xa(this,t,u)}offsetPoint(t){Ya(this,t)}setEmpty(){Va(this)}setTo(t,u,s,n){Wa(this,t,u,s,n)}union(t){return Ha(this,t)}}const Ht=e=>{if(e.placeObject)return e.placeObject;const t=e.placeId;if(t===-1)return null;const u=e.parent;if(!u)return null;const s=u.loaderInfo;if(!s||!s.data)return null;const n=s.data.characters[u.characterId],r=u.isTimelineEnabled?u.currentFrame:1,a=n.placeMap[r];if(!a||!(t in a))return null;const i=a[t],c=n.placeObjects[i];return c?(e.placeObject=c,c):null},ft=new J,fn=0,bn=1,za=2,Ga=3,bt=new Float32Array([1,0,0,1,0,0]);let Ka=0;const $n=()=>Ka++,xn=[],Au=[],gn=[],Qa=[],vu=(e=0,t=0,u=0,s=0,n=0,r=0)=>{const a=gn.pop()||new Float32Array(6);return a[0]=e,a[1]=t,a[2]=u,a[3]=s,a[4]=n,a[5]=r,a},Et=e=>{gn.push(e)},Za=(e=1,t=1,u=1,s=1,n=0,r=0,a=0,i=0)=>{const c=Qa.pop()||new Float32Array(8);return c[0]=e,c[1]=t,c[2]=u,c[3]=s,c[4]=n,c[5]=r,c[6]=a,c[7]=i,c},mn=[],Ja=()=>mn.pop()||new Map,ja=e=>{e.clear(),mn.push(e)},U=(...e)=>{const t=xn.pop()||[];return e.length&&t.push(...e),t},ee=e=>{e.length&&(e.length=0),xn.push(e)},he=(e,t,u,s)=>{const n=Au.length?Au.pop():new Float32Array(4);return n[0]=e,n[1]=t,n[2]=u,n[3]=s,n},F=e=>{Au.push(e)},ei=e=>{let t=null;switch(e.method.toUpperCase()){case"GET":if(e.data){const s=e.url.split("?");s[1]=s.length===1?e.data.toString():`${s[1]}&${e.data.toString()}`,e.url=s.join("?")}break;case"PUT":case"POST":e.data&&(t=e.data.toString());break}const u=new XMLHttpRequest;if(u.open(e.method,e.url,!0),u.responseType=e.format,u.withCredentials=e.withCredentials,e.event){const s=Object.keys(e.event);for(let n=0;n<s.length;++n){const r=s[n];u.addEventListener(r,e.event[r])}}for(let s=0;s<e.headers.length;++s){const n=e.headers[s];n&&u.setRequestHeader(n.name,n.value)}u.send(t)},ti=e=>{const t=U();if(e){const u=e.trim().split(`
659
- `);for(let s=0;s<u.length;++s){const n=u[s].split(":");t.push({name:n[0].trim(),value:n[1].trim()})}}return t},Rt=new WeakMap,ke=new WeakMap,fe=new Set,ui=new WeakMap,Iu=document.createElement("canvas");Iu.width=Iu.height=1;const we=Iu.getContext("2d"),Su=e=>we?(we.fillStyle=e,+`0x${we.fillStyle.slice(1)}`):0,de=(e,t,u,s=null)=>{const n=+e;return isNaN(n)&&s!==null?s:Math.min(Math.max(t,isNaN(n)?0:n),u)},Ru=[],ku=[],Ce=new Map;let pn=null;const Tn=e=>{pn=e},si=()=>pn,N=e=>{if(e.$matrix)return e.$matrix.rawData;const t=Ht(e);if(!t||!t.matrix)return null;if(!t.typedMatrix){const u=t.matrix;t.typedMatrix=vu(u[0],u[1],u[2],u[3],u[4],u[5])}return t.typedMatrix},ni=e=>{const t=N(e);let u=t||bt,s=e.parent;for(;s;){const n=N(s);n&&(u=A.multiply(n,u)),s=s.parent}return new A(u[0],u[1],u[2],u[3],u[4],u[5])},qe=e=>{if(e.$colorTransform)return e.$colorTransform.rawData;const t=Ht(e);if(!t||!t.colorTransform)return null;if(!t.typedColorTransform){const u=t.colorTransform;t.typedColorTransform=Za(u[0],u[1],u[2],u[3],u[4],u[5],u[6],u[7])}return t.typedColorTransform},ri=e=>{if(e.$alpha!==null)return e.$alpha;if(e.$colorTransform){const u=e.$colorTransform.rawData;return u[3]+u[7]/255}const t=qe(e);return t?t[3]+t[7]/255:1},ai=(e,t)=>{if(t=de(t,0,1),e.$alpha===t)return;e.$alpha=t;let u=e.$colorTransform;if(!u){const s=qe(e);u=s?new C(...s):new C}u.alphaMultiplier=t,u.alphaOffset=0,e.$colorTransform=u,Y(e)};class Ae{$updated;constructor(){this.$updated=!0}canApplyFilter(){return!0}getBounds(t){return t}}const v=(e,t,u,s=null)=>{const n=+e;return isNaN(n)&&s!==null?s:Math.min(Math.max(t,isNaN(n)?0:n),u)},Ou=document.createElement("canvas");Ou.width=Ou.height=1;const Tu=Ou.getContext("2d"),Oe=e=>Tu?(Tu.fillStyle=e,+`0x${Tu.fillStyle.slice(1)}`):0,ts=Math.PI/180,us=e=>{switch(e){case"full":return 0;case"inner":return 1;case"outer":return 2;default:return 0}},En=e=>e.strength>0&&e.distance!==0&&e.blurX>0&&e.blurY>0&&e.quality>0,yn=e=>e.blurX>0&&e.blurY>0&&e.quality>0,ii=[.5,1.05,1.4,1.55,1.75,1.9,2,2.15,2.2,2.3,2.5,3,3,3.5,3.5],et=(e,t)=>{if(!yn(e))return t;const u=ii[e.quality-1],s=Math.round(e.blurX*u),n=Math.round(e.blurY*u);return t[0]-=s,t[2]+=s,t[1]-=n,t[3]+=n,t},ci=(e,t)=>{if(!En(e)||e.type==="inner")return t;et(e,t);const u=e.angle*ts,s=e.distance,n=Math.abs(Math.cos(u)*s),r=Math.abs(Math.sin(u)*s);return t[0]-=n,t[2]+=n,t[1]-=r,t[3]+=r,t},oi=e=>[e.$filterType,e.distance,e.angle,e.highlightColor,e.highlightAlpha,e.shadowColor,e.shadowAlpha,e.blurX,e.blurY,e.strength,e.quality,e.type,e.knockout],li=e=>new Float32Array([e.$filterType,e.distance,e.angle,e.highlightColor,e.highlightAlpha,e.shadowColor,e.shadowAlpha,e.blurX,e.blurY,e.strength,e.quality,us(e.type),+e.knockout]);class zt extends Ae{$filterType=0;_$blurX;_$blurY;_$quality;_$distance;_$angle;_$highlightColor;_$highlightAlpha;_$shadowColor;_$shadowAlpha;_$strength;_$type;_$knockout;constructor(t=4,u=45,s=16777215,n=1,r=0,a=1,i=4,c=4,o=1,d=1,l="inner",h=!1){super(),this._$distance=4,this._$angle=45,this._$highlightColor=16777215,this._$highlightAlpha=1,this._$blurX=4,this._$blurY=4,this._$quality=1,this._$shadowColor=0,this._$shadowAlpha=1,this._$strength=1,this._$type="inner",this._$knockout=!1,this.blurX=i,this.blurY=c,this.quality=d,this.distance=t,this.angle=u,this.highlightColor=s,this.highlightAlpha=n,this.shadowColor=r,this.shadowAlpha=a,this.strength=o,this.type=l,this.knockout=h}get angle(){return this._$angle}set angle(t){t=v(t%360,-360,360,45),t!==this._$angle&&(this._$angle=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=v(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=v(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get distance(){return this._$distance}set distance(t){t=v(+t,-255,255,4),t!==this._$distance&&(this._$distance=t,this.$updated=!0)}get highlightAlpha(){return this._$highlightAlpha}set highlightAlpha(t){t=v(+t,0,1,0),t!==this._$highlightAlpha&&(this._$highlightAlpha=t,this.$updated=!0)}get highlightColor(){return this._$highlightColor}set highlightColor(t){t=v(typeof t=="string"?Oe(t):t,0,16777215,16777215),t!==this._$highlightColor&&(this._$highlightColor=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=v(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get shadowAlpha(){return this._$shadowAlpha}set shadowAlpha(t){t=v(t,0,1,0),t!==this._$shadowAlpha&&(this._$shadowAlpha=t,this.$updated=!0)}get shadowColor(){return this._$shadowColor}set shadowColor(t){t=v(typeof t=="string"?Oe(t):t,0,16777215,0),t!==this._$shadowColor&&(this._$shadowColor=t,this.$updated=!0)}get strength(){return this._$strength}set strength(t){t=v(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}get type(){return this._$type}set type(t){if(t=`${t}`.toLowerCase(),t!==this._$type){switch(t){case"inner":case"outer":case"full":break;default:return}this._$type=t,this.$updated=!0}}clone(){return new zt(this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$type,this._$knockout)}toArray(){return oi(this)}toNumberArray(){return li(this)}canApplyFilter(){return En(this)}getBounds(t){return ci(this,t)}}const hi=e=>[e.$filterType,e.blurX,e.blurY,e.quality],di=e=>new Float32Array([e.$filterType,e.blurX,e.blurY,e.quality]);class Gt extends Ae{$filterType=1;_$blurX;_$blurY;_$quality;constructor(t=4,u=4,s=1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this.blurX=t,this.blurY=u,this.quality=s}get blurX(){return this._$blurX}set blurX(t){t=v(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=v(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=v(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}clone(){return new Gt(this._$blurX,this._$blurY,this._$quality)}toArray(){return hi(this)}toNumberArray(){return di(this)}canApplyFilter(){return yn(this)}getBounds(t){return et(this,t)}}const fi=e=>[e.$filterType,e.matrix],bi=e=>new Float32Array([e.$filterType,...e.matrix]);class Kt extends Ae{$filterType=2;_$matrix;constructor(t=null){super(),this._$matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],t&&t.length===20&&(this.matrix=t)}get matrix(){return this._$matrix}set matrix(t){if(this._$matrix!==t&&!(!Array.isArray(t)||t.length!==20)){for(let u=0;u<20;u++)if(t[u]!==this._$matrix[u]){this.$updated=!0;break}this.$updated&&(this._$matrix=t)}}clone(){return new Kt(this._$matrix)}toArray(){return fi(this)}toNumberArray(){return bi(this)}}const $i=e=>e.matrix!==null&&e.matrixX*e.matrixY===e.matrix.length,xi=e=>[e.$filterType,e.matrixX,e.matrixY,e.matrix,e.divisor,e.bias,e.preserveAlpha,e.clamp,e.color,e.alpha],gi=e=>{const t=e.matrix||[];return new Float32Array([e.$filterType,e.matrixX,e.matrixY,...t,e.divisor,e.bias,+e.preserveAlpha,+e.clamp,e.color,e.alpha])};class Qt extends Ae{$filterType=3;_$matrixX;_$matrixY;_$matrix;_$divisor;_$bias;_$preserveAlpha;_$clamp;_$color;_$alpha;constructor(t=0,u=0,s=null,n=1,r=0,a=!0,i=!0,c=0,o=0){super(),this._$matrixX=0,this._$matrixY=0,this._$matrix=null,this._$divisor=1,this._$bias=0,this._$preserveAlpha=!0,this._$clamp=!0,this._$color=0,this._$alpha=0,this.matrixX=t,this.matrixY=u,this.matrix=s,this.divisor=n,this.bias=r,this.preserveAlpha=a,this.clamp=i,this.color=c,this.alpha=o}get alpha(){return this._$alpha}set alpha(t){t=v(+t,0,1,0),t!==this._$alpha&&(this._$alpha=t,this.$updated=!0)}get bias(){return this._$bias}set bias(t){t|=0,t!==this._$bias&&(this._$bias=t,this.$updated=!0)}get clamp(){return this._$clamp}set clamp(t){t=!!t,t!==this._$clamp&&(this._$clamp=t,this.$updated=!0)}get color(){return this._$color}set color(t){t=v(typeof t=="string"?Oe(t):t,0,16777215,0),t!==this._$color&&(this._$color=t,this.$updated=!0)}get divisor(){return this._$divisor}set divisor(t){t|=0,t!==this._$divisor&&(this._$divisor=t,this.$updated=!0)}get matrix(){return this._$matrix}set matrix(t){this._$matrix!==t&&(this._$matrix=t,this.$updated=!0)}get matrixX(){return this._$matrixX}set matrixX(t){t=v(t|0,0,15,0)|0,t!==this._$matrixX&&(this._$matrixX=t,this.$updated=!0)}get matrixY(){return this._$matrixY}set matrixY(t){t=v(t|0,0,15,0)|0,t!==this._$matrixY&&(this._$matrixY=t,this.$updated=!0)}get preserveAlpha(){return this._$preserveAlpha}set preserveAlpha(t){t=!!t,t!==this._$preserveAlpha&&(this._$preserveAlpha=t,this.$updated=!0)}clone(){return new Qt(this._$matrixX,this._$matrixY,this._$matrix?this._$matrix.slice():null,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}toArray(){return xi(this)}toNumberArray(){return gi(this)}canApplyFilter(){return $i(this)}}const mi=e=>e.bitmapBuffer!==null&&e.componentX>0&&e.componentY>0&&e.scaleX!==0&&e.scaleY!==0,pi=e=>[e.$filterType,e.bitmapBuffer?Array.from(e.bitmapBuffer):null,e.bitmapWidth,e.bitmapHeight,e.mapPointX,e.mapPointY,e.componentX,e.componentY,e.scaleX,e.scaleY,e.mode,e.color,e.alpha],Ti=e=>{let t=2;switch(e.mode){case"clamp":t=0;break;case"color":t=1;break;case"wrap":t=2;break;case"ignore":t=3;break;default:t=2;break}const u=e.bitmapBuffer||new Uint8Array,s=[e.$filterType,u.length];for(let n=0;n<u.length;n+=4096)s.push(...u.subarray(n,n+4096));return s.push(e.bitmapWidth,e.bitmapHeight,e.mapPointX,e.mapPointY,e.componentX,e.componentY,e.scaleX,e.scaleY,t,e.color,e.alpha),new Float32Array(s)};class Zt extends Ae{$filterType=4;_$bitmapBuffer;_$bitmapWidth;_$bitmapHeight;_$mapPointX;_$mapPointY;_$componentX;_$componentY;_$scaleX;_$scaleY;_$mode;_$color;_$alpha;constructor(t=null,u=0,s=0,n=0,r=0,a=0,i=0,c=0,o=0,d="wrap",l=0,h=0){super(),this._$bitmapBuffer=null,this._$bitmapWidth=0,this._$bitmapHeight=0,this._$mapPointX=0,this._$mapPointY=0,this._$componentX=0,this._$componentY=0,this._$scaleX=0,this._$scaleY=0,this._$mode="wrap",this._$color=0,this._$alpha=0,this.bitmapBuffer=t,this.bitmapWidth=u,this.bitmapHeight=s,this.mapPointX=n,this.mapPointY=r,this.componentX=a,this.componentY=i,this.scaleX=c,this.scaleY=o,this.mode=d,this.color=l,this.alpha=h}get alpha(){return this._$alpha}set alpha(t){t=v(+t,0,1,0),t!==this._$alpha&&(this._$alpha=t,this.$updated=!0)}get color(){return this._$color}set color(t){t=v(typeof t=="string"?Oe(t):t,0,16777215,0),t!==this._$color&&(this._$color=t,this.$updated=!0)}get componentX(){return this._$componentX}set componentX(t){t!==this._$componentX&&(this._$componentX=t,this.$updated=!0)}get componentY(){return this._$componentY}set componentY(t){t!==this._$componentY&&(this._$componentY=t,this.$updated=!0)}get bitmapBuffer(){return this._$bitmapBuffer}set bitmapBuffer(t){t!==this._$bitmapBuffer&&(this._$bitmapBuffer=t,this.$updated=!0)}get bitmapWidth(){return this._$bitmapWidth}set bitmapWidth(t){t!==this._$bitmapWidth&&(this._$bitmapWidth=t,this.$updated=!0)}get bitmapHeight(){return this._$bitmapHeight}set bitmapHeight(t){t!==this._$bitmapHeight&&(this._$bitmapHeight=t,this.$updated=!0)}get mapPointX(){return this._$mapPointX}set mapPointX(t){t!==this._$mapPointX&&(this._$mapPointX=t,this.$updated=!0)}get mapPointY(){return this._$mapPointY}set mapPointY(t){t!==this._$mapPointY&&(this._$mapPointY=t,this.$updated=!0)}get mode(){return this._$mode}set mode(t){t!==this._$mode&&(this._$mode=t,this.$updated=!0)}get scaleX(){return this._$scaleX}set scaleX(t){t=v(+t,-65535,65535,0),t!==this._$scaleX&&(this._$scaleX=t,this.$updated=!0)}get scaleY(){return this._$scaleY}set scaleY(t){t=v(+t,-65535,65535,0),t!==this._$scaleY&&(this._$scaleY=t,this.$updated=!0)}clone(){return new Zt(this._$bitmapBuffer?this._$bitmapBuffer.slice():null,this._$bitmapWidth,this._$bitmapHeight,this._$mapPointX,this._$mapPointX,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}toArray(){return pi(this)}toNumberArray(){return Ti(this)}canApplyFilter(){return mi(this)}}const Ei=e=>[e.$filterType,e.distance,e.angle,e.color,e.alpha,e.blurX,e.blurY,e.strength,e.quality,e.inner,e.knockout,e.hideObject],yi=e=>new Float32Array([e.$filterType,e.distance,e.angle,e.color,e.alpha,e.blurX,e.blurY,e.strength,e.quality,+e.inner,+e.knockout,+e.hideObject]),wn=e=>e.alpha>0&&e.strength!==0&&e.blurX>0&&e.blurY>0&&e.quality>0,wi=(e,t)=>{if(!wn(e)||e.inner)return t;et(e,t);const u=e.angle*ts,s=e.distance,n=Math.cos(u)*s,r=Math.sin(u)*s;return t[0]=Math.min(t[0],n),n>0&&(t[2]+=n),t[1]=Math.min(t[1],r),r>0&&(t[3]+=r),t};class Jt extends Ae{$filterType=5;_$blurX;_$blurY;_$quality;_$distance;_$angle;_$color;_$alpha;_$strength;_$inner;_$knockout;_$hideObject;constructor(t=4,u=45,s=0,n=1,r=4,a=4,i=1,c=1,o=!1,d=!1,l=!1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this._$distance=4,this._$angle=45,this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this._$hideObject=!1,this.blurX=r,this.blurY=a,this.quality=c,this.distance=t,this.angle=u,this.color=s,this.alpha=n,this.strength=i,this.inner=o,this.knockout=d,this.hideObject=l}get alpha(){return this._$alpha}set alpha(t){t=v(+t,0,1,0),t!==this._$alpha&&(this._$alpha=t,this.$updated=!0)}get angle(){return this._$angle}set angle(t){t=v(t%360,-360,360,45),t!==this._$angle&&(this._$angle=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=v(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=v(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get color(){return this._$color}set color(t){t=v(typeof t=="string"?Oe(t):t,0,16777215,0),t!==this._$color&&(this._$color=t,this.$updated=!0)}get distance(){return this._$distance}set distance(t){t=v(+t,-255,255,4),t!==this._$distance&&(this._$distance=t,this.$updated=!0)}get hideObject(){return this._$hideObject}set hideObject(t){t=!!t,t!==this._$hideObject&&(this._$hideObject=t,this.$updated=!0)}get inner(){return this._$inner}set inner(t){t=!!t,t!==this._$inner&&(this._$inner=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=v(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get strength(){return this._$strength}set strength(t){t=v(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}clone(){return new Jt(this._$distance,this._$angle,this._$color,this._$alpha,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$inner,this._$knockout,this._$hideObject)}toArray(){return Ei(this)}toNumberArray(){return yi(this)}canApplyFilter(){return wn(this)}getBounds(t){return wi(this,t)}}const Mi=e=>[e.$filterType,e.color,e.alpha,e.blurX,e.blurY,e.strength,e.quality,e.inner,e.knockout],Ai=e=>new Float32Array([e.$filterType,e.color,e.alpha,e.blurX,e.blurY,e.strength,e.quality,+e.inner,+e.knockout]),Mn=e=>e.alpha>0&&e.strength!==0&&e.blurX>0&&e.blurY>0&&e.quality>0,vi=(e,t)=>!Mn(e)||e.inner?t:et(e,t);class jt extends Ae{$filterType=6;_$blurX;_$blurY;_$quality;_$color;_$alpha;_$strength;_$inner;_$knockout;constructor(t=0,u=1,s=4,n=4,r=1,a=1,i=!1,c=!1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this.blurX=s,this.blurY=n,this.quality=a,this.color=t,this.alpha=u,this.strength=r,this.inner=i,this.knockout=c}get alpha(){return this._$alpha}set alpha(t){t=v(+t,0,1,0),t!==this._$alpha&&(this._$alpha=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=v(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=v(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get color(){return this._$color}set color(t){t=v(typeof t=="string"?Oe(t):t,0,16777215,4),t!==this._$color&&(this._$color=t,this.$updated=!0)}get inner(){return this._$inner}set inner(t){t=!!t,t!==this._$inner&&(this._$inner=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=v(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get strength(){return this._$strength}set strength(t){t=v(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}clone(){return new jt(this._$color,this._$alpha,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$inner,this._$knockout)}toArray(){return Mi(this)}toNumberArray(){return Ai(this)}canApplyFilter(){return Mn(this)}getBounds(t){return vi(this,t)}}const An=e=>e.strength>0&&e.distance>0&&e.alphas!==null&&e.ratios!==null&&e.colors!==null&&e.blurX>0&&e.blurY>0&&e.quality>0,Ii=e=>[e.$filterType,e.distance,e.angle,e.colors,e.alphas,e.ratios,e.blurX,e.blurY,e.strength,e.quality,e.type,e.knockout],Si=e=>{const t=e.colors?e.colors:[],u=e.alphas?e.alphas:[],s=e.ratios?e.ratios:[];return new Float32Array([e.$filterType,e.distance,e.angle,t.length,...t,u.length,...u,s.length,...s,e.blurX,e.blurY,e.strength,e.quality,us(e.type),+e.knockout])},Ri=(e,t)=>{if(!An(e)||e.type==="inner")return t;et(e,t);const u=e.angle*ts,s=e.distance,n=Math.abs(Math.cos(u)*s),r=Math.abs(Math.sin(u)*s);return t[0]-=n,t[2]+=n,t[1]-=r,t[3]+=r,t};class eu extends Ae{$filterType=7;_$blurX;_$blurY;_$quality;_$distance;_$angle;_$colors;_$alphas;_$ratios;_$strength;_$type;_$knockout;constructor(t=4,u=45,s=null,n=null,r=null,a=4,i=4,c=1,o=1,d="inner",l=!1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.blurX=a,this.blurY=i,this.quality=o,this.distance=t,this.angle=u,this.colors=s,this.alphas=n,this.ratios=r,this.strength=c,this.type=d,this.knockout=l}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(Array.isArray(t))for(let u=0;u<t.length;++u){const s=t[u];t[u]=v(+s,0,1,0)}this._$alphas=t,this.$updated=!0}}get angle(){return this._$angle}set angle(t){t=v(t%360,-360,360,45),t!==this._$angle&&(this._$angle=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=v(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=v(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(Array.isArray(t))for(let u=0;u<t.length;++u){const s=t[u];t[u]=v(typeof s=="string"?Oe(s):s,0,16777215,0)}this._$colors=t,this.$updated=!0}}get distance(){return this._$distance}set distance(t){t=v(+t,-255,255,4),t!==this._$distance&&(this._$distance=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=v(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(Array.isArray(t))for(let u=0;u<t.length;++u){const s=t[u];t[u]=v(+s,0,255,0)}this._$ratios=t,this.$updated=!0}}get strength(){return this._$strength}set strength(t){t=v(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this.$updated=!0)}clone(){return new eu(this._$distance,this._$angle,this._$colors?this._$colors.slice():null,this._$alphas?this._$alphas.slice():null,this._$ratios?this._$ratios.slice():null,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$type,this._$knockout)}toArray(){return Ii(this)}toNumberArray(){return Si(this)}canApplyFilter(){return An(this)}getBounds(t){return Ri(this,t)}}const ki=e=>[e.$filterType,e.distance,e.angle,e.colors,e.alphas,e.ratios,e.blurX,e.blurY,e.strength,e.quality,e.type,e.knockout],vn=e=>e.strength>0&&e.distance>0&&e.alphas!==null&&e.ratios!==null&&e.colors!==null&&e.blurX>0&&e.blurY>0&&e.quality>0,Oi=e=>{const t=e.colors?e.colors:[],u=e.alphas?e.alphas:[],s=e.ratios?e.ratios:[];return new Float32Array([e.$filterType,e.distance,e.angle,t.length,...t,u.length,...u,s.length,...s,e.blurX,e.blurY,e.strength,e.quality,us(e.type),+e.knockout])},Fi=(e,t)=>!vn(e)||e.type==="inner"?t:et(e,t);class tu extends Ae{$filterType=8;_$blurX;_$blurY;_$quality;_$distance;_$angle;_$colors;_$alphas;_$ratios;_$strength;_$type;_$knockout;constructor(t=4,u=45,s=null,n=null,r=null,a=4,i=4,c=1,o=1,d="outer",l=!1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="outer",this._$knockout=!1,this.blurX=a,this.blurY=i,this.quality=o,this.distance=t,this.angle=u,this.colors=s,this.alphas=n,this.ratios=r,this.strength=c,this.type=d,this.knockout=l}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(Array.isArray(t))for(let u=0;u<t.length;++u){const s=t[u];t[u]=v(+s,0,1,0)}this._$alphas=t,this.$updated=!0}}get angle(){return this._$angle}set angle(t){t=v(t%360,-360,360,45),t!==this._$angle&&(this._$angle=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=v(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=v(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(Array.isArray(t))for(let u=0;u<t.length;++u){const s=t[u];t[u]=v(typeof s=="string"?Oe(s):s,0,16777215,0)}this._$colors=t,this.$updated=!0}}get distance(){return this._$distance}set distance(t){t=v(+t,-255,255,4),t!==this._$distance&&(this._$distance=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=v(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(Array.isArray(t))for(let u=0;u<t.length;++u)t[u]=v(+t[u],0,255,0);this._$ratios=t,this.$updated=!0}}get strength(){return this._$strength}set strength(t){t=v(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this.$updated=!0)}clone(){return new tu(this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$type,this._$knockout)}toArray(){return ki(this)}toNumberArray(){return Oi(this)}canApplyFilter(){return vn(this)}getBounds(t){return Fi(this,t)}}const Ci=e=>{const t=U();for(let u=0;u<e.length;++u){const s=e[u];if(s)switch(s.params[0]===null&&s.params.shift(),s.class){case"BevelFilter":t.push(new zt(...s.params));break;case"BlurFilter":t.push(new Gt(...s.params));break;case"ColorMatrixFilter":t.push(new Kt(...s.params));break;case"ConvolutionFilter":t.push(new Qt(...s.params));break;case"DisplacementMapFilter":t.push(new Zt(...s.params));break;case"DropShadowFilter":t.push(new Jt(...s.params));break;case"GlowFilter":t.push(new jt(...s.params));break;case"GradientBevelFilter":t.push(new eu(...s.params));break;case"GradientGlowFilter":t.push(new tu(...s.params));break}}return t},Li=e=>{if(e.$filters)return e.$filters;const t=Ht(e);return t&&t.surfaceFilterList?(t.filters||(t.filters=Ci(t.surfaceFilterList)),t.filters):null},Ni=(e,t)=>{e.$filters=t,Y(e)},Pi=e=>{if(e.$blendMode)return e.$blendMode;const t=Ht(e);return t&&t.blendMode?t.blendMode:"normal"},Bi=(e,t)=>{e.$blendMode!==t&&(e.$blendMode=t,Y(e))},Di=180/Math.PI,_i=e=>{const t=e.$matrix?e.$matrix.rawData:N(e);return t?Math.atan2(t[1],t[0])*Di:0},Ui=Math.PI/180,qi=(e,t)=>{if(t=de(t%360,-360,360,0),e.$rotation===t)return;let u=e.$matrix;if(!u){const r=N(e);e.$matrix=u=r?new A(...r):new A}const s=Math.sqrt(u.a*u.a+u.b*u.b),n=Math.sqrt(u.c*u.c+u.d*u.d);if(t===0)u.a=s,u.b=0,u.c=0,u.d=n;else{let r=Math.atan2(u.b,u.a),a=Math.atan2(-u.c,u.d);const i=t*Ui;a=a+i-r,r=i,u.b=s*Math.sin(r),u.b===1||u.b===-1?u.a=0:u.a=s*Math.cos(r),u.c=-n*Math.sin(a),u.c===1||u.c===-1?u.d=0:u.d=n*Math.cos(a)}e.$scaleX=null,e.$scaleY=null,e.$rotation=t,Y(e)},Xi=e=>{const t=e.$matrix?e.$matrix.rawData:N(e);if(!t)return 1;const s=(Math.abs(t[0])>=1e-12?Math.sign(t[0]):Math.sign(t[1]))||1,n=Math.hypot(t[0],t[1]);return Math.round(n*s*1e4)/1e4},In=(e,t)=>{t=de(t,-Number.MAX_VALUE,Number.MAX_VALUE,1);const u=Math.round(t*1e4)/1e4;if(e.$scaleX===u)return;let s=e.$matrix;if(!s){const n=N(e);e.$matrix=s=n?new A(...n):new A}if(s.b===0||isNaN(s.b))s.a=u;else{const r=Math.atan2(s.b,s.a),a=Math.hypot(s.a,s.b),i=(Math.abs(s.a)>=1e-12?Math.sign(s.a):Math.sign(s.b))||1,d=(a*i>=0?r:r-Math.PI)+(u<0?Math.PI:0),l=Math.abs(u);s.a=l*Math.cos(d),s.b=l*Math.sin(d)}e.$scaleX=u,e.$rotation=null,Y(e)},Yi=e=>{const t=e.$matrix?e.$matrix.rawData:N(e);if(!t)return 1;const u=1e-12,s=Math.hypot(t[0],t[1]),n=(Math.abs(t[0])>=u?Math.sign(t[0]):Math.sign(t[1]))||1;return Math.round((t[0]*t[3]-t[1]*t[2])/(s*n)*1e4)/1e4},Sn=(e,t)=>{t=de(t,-Number.MAX_VALUE,Number.MAX_VALUE,1);const u=Math.round(t*1e4)/1e4;if(e.$scaleY===u)return;let s=e.$matrix;if(!s){const n=N(e);e.$matrix=s=n?new A(...n):new A}if(s.c===0||isNaN(s.c))s.d=u;else{const n=Math.max(0,Math.abs(u)),r=1e-12;let a=Math.atan2(s.b,s.a);(s.a<0||Math.abs(s.a)<r&&s.b<0)&&(a-=Math.PI),a<=-Math.PI&&(a+=2*Math.PI),a>Math.PI&&(a-=2*Math.PI);const i=a+(u<0?Math.PI:0);s.c=-n*Math.sin(i),s.d=n*Math.cos(i)}e.$scaleY=u,e.$rotation=null,Y(e)},Vi=e=>{const t=e.$matrix?e.$matrix.rawData:N(e);return t?t[4]:0},Wi=(e,t)=>{let u=e.$matrix;if(!u){const s=N(e);e.$matrix=u=s?new A(...s):new A}e.$x!==t&&(e.$x=u.tx=t,Y(e))},Hi=e=>{const t=e.$matrix?e.$matrix.rawData:N(e);return t?t[5]:0},zi=(e,t)=>{let u=e.$matrix;if(!u){const s=N(e);e.$matrix=u=s?new A(...s):new A}e.$y!==t&&(e.$y=u.ty=t,Y(e))},ne=(e,t,u,s,n)=>{const r=n[0],a=n[1],i=n[2],c=n[3],o=n[4],d=n[5],l=u*r+s*i+o,h=u*r+t*i+o,b=e*r+s*i+o,f=e*r+t*i+o,p=u*a+s*c+d,$=u*a+t*c+d,m=e*a+s*c+d,R=e*a+t*c+d;return he(Math.min(l,h,b,f),Math.min(p,$,m,R),Math.max(l,h,b,f),Math.max(p,$,m,R))},Rn=e=>{const t=e.graphics;return he(t.xMin,t.yMin,t.xMax,t.yMax)},uu=(e,t=null)=>{const u=Rn(e),s=N(e);if(!s){if(t){const r=ne(u[0],u[1],u[2],u[3],t);return F(u),r}return u}const n=ne(u[0],u[1],u[2],u[3],t?A.multiply(t,s):s);return F(u),n},kn=e=>he(0,0,e.videoWidth,e.videoHeight),su=(e,t=null)=>{const u=kn(e),s=N(e);if(!s){if(t){const r=ne(u[0],u[1],u[2],u[3],t);return F(u),r}return u}const n=ne(u[0],u[1],u[2],u[3],t?A.multiply(t,s):s);return F(u),n},On=e=>he(e.xMin,e.yMin,e.xMax,e.yMax),nu=(e,t=null)=>{const u=On(e),s=N(e);if(!s){if(t){const r=ne(u[0],u[1],u[2],u[3],t);return F(u),r}return u}const n=ne(u[0],u[1],u[2],u[3],t?A.multiply(t,s):s);return F(u),n},ss=(e,t=null)=>{const u=e.children;if(!u.length)return he(0,0,0,0);const s=N(e),n=s?t?A.multiply(t,s):s:t,r=Number.MAX_VALUE;let a=r,i=-r,c=r,o=-r;for(let d=0;d<u.length;d++){const l=u[d];if(!l.visible)continue;let h=null;switch(!0){case l.isContainerEnabled:h=ss(l,n);break;case l.isShape:h=uu(l,n);break;case l.isText:h=nu(l,n);break;case l.isVideo:h=su(l,n);break}h&&(a=Math.min(a,h[0]),c=Math.min(c,h[1]),i=Math.max(i,h[2]),o=Math.max(o,h[3]),F(h))}return he(a,c,i,o)},Fn=e=>{switch(!0){case e.isContainerEnabled:return ss(e);case e.isShape:return uu(e);case e.isText:return nu(e);case e.isVideo:return su(e);default:return he(0,0,0,0)}},Gi=e=>{const t=Fn(e),u=Math.abs(t[2]-t[0]);switch(F(t),!0){case u===0:case u===1/0:case u===-1/0:return 0;default:return Math.round(u*100)/100}},Cn=(e,t=null)=>{const u=e.children;if(!u.length)return he(0,0,0,0);const s=N(e);let n=t;s&&(n=t?A.multiply(t,s):s);const r=Number.MAX_VALUE;let a=r,i=-r,c=r,o=-r;for(let d=0;d<u.length;d++){const l=u[d];if(!l.visible)continue;let h=null;switch(!0){case l.isContainerEnabled:h=Cn(l,n);break;case l.isShape:h=uu(l,n);break;case l.isText:h=nu(l,n);break;case l.isVideo:h=su(l,n);break}h&&(a=Math.min(a,h[0]),c=Math.min(c,h[1]),i=Math.max(i,h[2]),o=Math.max(o,h[3]),F(h))}return he(a,c,i,o)},Ze=e=>{switch(!0){case e.isContainerEnabled:return Cn(e);case e.isShape:return Rn(e);case e.isText:return On(e);case e.isVideo:return kn(e);default:return he(0,0,0,0)}},Ki=(e,t)=>{if(t=+t,isNaN(t)||0>t)return;const u=Ze(e);let s=Math.abs(u[2]-u[0]);switch(!0){case s===0:case s===1/0:case s===-1/0:return;default:s=Math.round(s*100)/100;break}In(e,t/s)},Qi=(e,t)=>{const u=e.concatenatedMatrix,s=new J(t.x*u.a+t.y*u.c+u.tx,t.x*u.b+t.y*u.d+u.ty);return A.release(u.rawData),s},Zi=(e,t)=>{const u=e.concatenatedMatrix;u.invert();const s=new J(t.x*u.a+t.y*u.c+u.tx,t.x*u.b+t.y*u.d+u.ty);return A.release(u.rawData),s},Ji=e=>{const t=Fn(e),u=Math.abs(t[3]-t[1]);switch(F(t),!0){case u===0:case u===1/0:case u===-1/0:return 0;default:return Math.round(u*100)/100}},ji=(e,t)=>{if(t=+t,isNaN(t)||0>t)return;const u=Ze(e);let s=Math.abs(u[3]-u[1]);switch(!0){case s===0:case s===1/0:case s===-1/0:return;default:s=Math.round(s*100)/100;break}Sn(e,t/s)},ec=e=>{const t=e.parent;t&&t.removeChild(e)},tc=(e,t=null)=>{const u=e.concatenatedMatrix,s=Ze(e),n=ne(s[0],s[1],s[2],s[3],u.rawData);if(F(s),A.release(u.rawData),!t){const c=new be(n[0],n[1],Math.abs(n[2]-n[0]),Math.abs(n[3]-n[1]));return F(n),c}const r=t.concatenatedMatrix;r.invert();const a=ne(n[0],n[1],n[2],n[3],r.rawData);F(n),A.release(r.rawData);const i=new be(a[0],a[1],Math.abs(a[2]-a[0]),Math.abs(a[3]-a[1]));return F(a),i},uc=(e,t)=>{const u=Ze(e),s=e.concatenatedMatrix,n=ne(u[0],u[1],u[2],u[3],s.rawData);F(u),A.release(s.rawData);const r=Ze(t),a=t.concatenatedMatrix,i=ne(r[0],r[1],r[2],r[3],a.rawData);F(r),A.release(a.rawData);const c=Math.max(n[0],i[0]),o=Math.max(n[1],i[1]),d=Math.min(n[2],i[2]),l=Math.min(n[3],i[3]);return F(n),F(i),d-c>=0&&l-o>=0};class Bt{_$bitmapData;_$matrix;_$repeat;_$smooth;constructor(t,u=null,s=!0,n=!1){this._$bitmapData=t,this._$matrix=u,this._$repeat=s,this._$smooth=n}clone(){return new Bt(this._$bitmapData.clone(),this._$matrix?this._$matrix.clone():null,this._$repeat,this._$smooth)}toArray(){return U(this._$bitmapData,this._$matrix,this._$repeat,this._$smooth)}}class Dt{_$type;_$colors;_$alphas;_$ratios;_$matrix;_$spreadMethod;_$interpolationMethod;_$focalPointRatio;_$colorStops;constructor(t,u,s,n,r=null,a="pad",i="rgb",c=0){this._$type=t,this._$colors=u,this._$alphas=s,this._$ratios=n,this._$matrix=r,this._$spreadMethod=a,this._$interpolationMethod=i,this._$focalPointRatio=c,this._$colorStops=U()}get colorStops(){if(!this._$colorStops.length){const t=Math.min(Math.min(this._$alphas.length,this._$colors.length),this._$ratios.length);for(let u=0;u<t;++u){const s=this._$colors[u],n=typeof s=="string"?Su(s):s;this._$colorStops[u]={ratio:this._$ratios[u]/255,R:n>>>16&255,G:n>>>8&255,B:n&255,A:this._$alphas[u]*255&255}}}return this._$colorStops}toArray(){return U(this._$type,this.colorStops,this._$matrix?this._$matrix.rawData:bt,this._$spreadMethod,this._$interpolationMethod,this._$focalPointRatio)}clone(){return new Dt(this._$type,this._$colors.slice(),this._$alphas.slice(),this._$ratios.slice(),this._$matrix?this._$matrix.clone():null,this._$spreadMethod,this._$interpolationMethod,this._$focalPointRatio)}}const sc=(e,t=0,u=0)=>{e.xMin=Math.min(e.xMin,t),e.xMax=Math.max(e.xMax,t),e.yMin=Math.min(e.yMin,u),e.yMax=Math.max(e.yMax,u)},Ss=(e,t=0,u=0,s=0,n=0,r=0,a="none")=>{e.xMin=Math.min(e.xMin,Math.min(t,s)),e.xMax=Math.max(e.xMax,Math.max(t,s)),e.yMin=Math.min(e.yMin,Math.min(u,n)),e.yMax=Math.max(e.yMax,Math.max(u,n));const i=s-t,c=n-u,o=Math.sqrt(i*i+c*c);if(!o)return;const d=i/o,l=c/o,h=-l,b=d,f=r/2,p=Math.min(t+h*f,t-h*f,s+h*f,s-h*f),$=Math.max(t+h*f,t-h*f,s+h*f,s-h*f),m=Math.min(u+b*f,u-b*f,n+b*f,n-b*f),R=Math.max(u+b*f,u-b*f,n+b*f,n-b*f);if(e.xMin=Math.min(e.xMin,p),e.xMax=Math.max(e.xMax,$),e.yMin=Math.min(e.yMin,m),e.yMax=Math.max(e.yMax,R),a==="round"||a==="square"){const S=t+f*-d,k=u+f*-l,D=Math.min(S+f*d+f*h,S-f*d+f*h,S+f*d-f*h,S-f*d-f*h),re=Math.max(S+f*d+f*h,S-f*d+f*h,S+f*d-f*h,S-f*d-f*h),ce=Math.min(k+f*l+f*b,k+f*l-f*b,k-f*l-f*b,k-f*l+f*b),H=Math.max(k+f*l+f*b,k+f*l-f*b,k-f*l-f*b,k-f*l+f*b);e.xMin=Math.min(e.xMin,D),e.xMax=Math.max(e.xMax,re),e.yMin=Math.min(e.yMin,ce),e.yMax=Math.max(e.yMax,H)}},st=(e,t,u=0,s=0,n=0,r="none",...a)=>{for(let i=0;i<a.length;){const c=a[i++],o=a[i++];sc(e,c,o),t&&(Ss(e,c,o,u,s,n,r),Ss(e,u,s,c,o,n,r))}},nt=(e,t,u,s,n,...r)=>{e.isConfirmed=!1,t&&s&&s.push(...r),u&&n&&n.push(...r)},nc=(e,t,u,s,n)=>{t=+t||0,u=+u||0,s=+s||0,n=+n||0,s=Math.round(s),n=Math.round(n);const r=s/2,a=n/2,i=t+r,c=u+a,o=t+s,d=u+n,l=4/3*(Math.SQRT2-1),h=l*r,b=l*a;return e.moveTo(i,u).cubicCurveTo(i+h,u,o,c-b,o,c).cubicCurveTo(o,c+b,i+h,d,i,d).cubicCurveTo(i-h,d,t,c+b,t,c).cubicCurveTo(t,c-b,i-h,u,i,u)},rc=(e,t,u,s,n)=>{t=+t||0,u=+u||0,s=+s||0,n=+n||0;const r=Math.round(t+s),a=Math.round(u+n);return e.moveTo(t,u).lineTo(t,a).lineTo(r,a).lineTo(r,u).lineTo(t,u)},ac=(e,t,u,s,n,r,a=NaN)=>{t=+t||0,u=+u||0,s=+s||0,n=+n||0,r=+r||0,a=+a||r,s=Math.round(s),n=Math.round(n),r=Math.round(r),a=Math.round(a);const i=r/2,c=a/2,o=4/3*(Math.SQRT2-1),d=o*i,l=o*c,h=t+i,b=t+s,f=b-i,p=u+c,$=u+n,m=$-c;return e.moveTo(h,u).lineTo(f,u).cubicCurveTo(f+d,u,b,p-l,b,p).lineTo(b,m).cubicCurveTo(b,m+l,f+d,$,f,$).lineTo(h,$).cubicCurveTo(h-d,$,t,m+l,t,m).lineTo(t,p).cubicCurveTo(t,p-l,h-d,u,h,u)},kt=e=>{if(!e)return[];const t=U();for(let u=0;u<e.length;){const s=e[u++];switch(t.push(s),s){case y.BEGIN_PATH:case y.END_FILL:case y.END_STROKE:case y.CLOSE_PATH:break;case y.MOVE_TO:case y.LINE_TO:t.push(e[u++],e[u++]);break;case y.CURVE_TO:case y.FILL_STYLE:t.push(e[u++],e[u++],e[u++],e[u++]);break;case y.CUBIC:t.push(e[u++],e[u++],e[u++],e[u++],e[u++],e[u++]);break;case y.STROKE_STYLE:{switch(t.push(e[u++]),e[u++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2);break}switch(e[u++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2);break}t.push(e[u++],e[u++],e[u++],e[u++],e[u++])}break;case y.ARC:t.push(e[u++],e[u++],e[u++]);break;case y.GRADIENT_FILL:{const n=e[u++],r=e[u++],a=e[u++],i=e[u++],c=e[u++],o=e[u++];t.push(n==="linear"?0:1),t.push(r.length);const d=r.sort((l,h)=>l.ratio-h.ratio);for(let l=0;l<d.length;++l){const h=d[l];t.push(h.ratio,h.R,h.G,h.B,h.A)}switch(t.push(...a),i){case"reflect":t.push(0);break;case"repeat":t.push(1);break;default:t.push(2);break}t.push(c==="linearRGB"?0:1),t.push(o)}break;case y.GRADIENT_STROKE:{switch(t.push(e[u++]),e[u++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2);break}switch(e[u++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2);break}t.push(e[u++]);const a=e[u++],i=e[u++],c=e[u++],o=e[u++],d=e[u++],l=e[u++];t.push(a==="linear"?0:1),t.push(i.length);for(let h=0;h<i.length;++h){const b=i[h];t.push(b.ratio,b.R,b.G,b.B,b.A)}switch(t.push(...c),o){case"reflect":t.push(0);break;case"repeat":t.push(1);break;default:t.push(2);break}t.push(d==="linearRGB"?0:1),t.push(l)}break;case y.BITMAP_FILL:{const n=e[u++],r=n.buffer;if(!r){u+=3;break}t.push(n.width,n.height,r.length);for(let o=0;o<r.length;o+=4096)t.push(...r.subarray(o,o+4096));const a=e[u++];a?t.push(...a.rawData):t.push(1,0,0,1,0,0);const i=e[u++];t.push(i?1:0);const c=e[u++];t.push(c?1:0)}break;case y.BITMAP_STROKE:{switch(t.push(e[u++]),e[u++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2);break}switch(e[u++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2);break}t.push(e[u++]);const a=e[u++],i=a.buffer;if(!i){u+=3;break}t.push(a.width,a.height,i.length);for(let l=0;l<i.length;l+=4096)t.push(...i.subarray(l,l+4096));const c=e[u++];c?t.push(...c):t.push(1,0,0,1,0,0);const o=e[u++];t.push(o?1:0);const d=e[u++];t.push(d?1:0)}break}}return t};class y{isConfirmed;xMin;yMin;xMax;yMax;$recodes;_$buffer;_$maxAlpha;_$isBeginning;_$positionX;_$positionY;_$hasFillEnabled;_$fillType;_$fillColor;_$fillGradient;_$fillBitmap;_$fills;_$hasLineEnabled;_$lineType;_$lineColor;_$lineGradient;_$joints;_$miterLimit;_$caps;_$lineWidth;_$lines;constructor(){this.isConfirmed=!1,this.xMin=Number.MAX_VALUE,this.yMin=Number.MAX_VALUE,this.xMax=-Number.MAX_VALUE,this.yMax=-Number.MAX_VALUE,this.$recodes=null,this._$buffer=null,this._$positionX=0,this._$positionY=0,this._$maxAlpha=0,this._$isBeginning=!1,this._$fills=null,this._$hasFillEnabled=!1,this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillColor=0,this._$caps="none",this._$lineWidth=1,this._$lines=null,this._$hasLineEnabled=!1,this._$lineType=0,this._$lineGradient=null,this._$joints="round",this._$miterLimit=0,this._$lineColor=0}static get MOVE_TO(){return 0}static get CURVE_TO(){return 1}static get LINE_TO(){return 2}static get CUBIC(){return 3}static get ARC(){return 4}static get FILL_STYLE(){return 5}static get STROKE_STYLE(){return 6}static get END_FILL(){return 7}static get END_STROKE(){return 8}static get BEGIN_PATH(){return 9}static get GRADIENT_FILL(){return 10}static get GRADIENT_STROKE(){return 11}static get CLOSE_PATH(){return 12}static get BITMAP_FILL(){return 13}static get BITMAP_STROKE(){return 14}get isDrawable(){if(!this._$isBeginning||!this._$maxAlpha)return!1;const t=Math.abs(this.xMax-this.xMin),u=Math.abs(this.yMax-this.yMin);return t>0&&u>0}beginBitmapFill(t,u=null,s=!0,n=!1){return this._$hasFillEnabled&&this.endFill(),this._$fills||(this._$fills=U()),this._$maxAlpha=1,this._$hasFillEnabled=!0,this._$isBeginning=!0,this._$fills.push(y.BEGIN_PATH),this._$fillType=y.BITMAP_FILL,this._$fillBitmap=new Bt(t,u,s,n),this}beginFill(t=0,u=1){this._$hasFillEnabled&&this.endFill(),this._$fills||(this._$fills=U()),typeof t=="string"&&(t=Su(t)),t=de(t,0,16777215,0),u=de(u,0,1,1),this._$maxAlpha=Math.max(this._$maxAlpha,u),this._$hasFillEnabled=!0,this._$isBeginning=!0,this._$fills.push(y.BEGIN_PATH),this._$fillType=y.FILL_STYLE;const s=t>>>16&255,n=t>>>8&255,r=t&255;return this._$fillColor=s<<24|n<<16|r<<8|u*255,this}beginGradientFill(t,u,s,n,r=null,a="pad",i="rgb",c=0){this._$hasFillEnabled&&this.endFill(),this._$fills||(this._$fills=U());for(let o=0;o<s.length;++o)this._$maxAlpha=Math.max(this._$maxAlpha,s[o]);return this._$hasFillEnabled=!0,this._$isBeginning=!0,this._$fills.push(y.BEGIN_PATH),this._$fillType=y.GRADIENT_FILL,this._$fillGradient=new Dt(t,u,s,n,r,a,i,c),this}clear(){return this._$maxAlpha=0,this._$isBeginning=!1,this._$positionX=0,this._$positionY=0,this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillColor=0,this._$hasFillEnabled=!1,this._$caps="none",this._$lineWidth=1,this._$lineType=0,this._$lineGradient=null,this._$joints="round",this._$miterLimit=0,this._$lineColor=0,this._$hasLineEnabled=!1,this.xMin=Number.MAX_VALUE,this.xMax=-Number.MAX_VALUE,this.yMin=Number.MAX_VALUE,this.yMax=-Number.MAX_VALUE,this.$recodes&&ee(this.$recodes),this._$fills&&ee(this._$fills),this._$lines&&ee(this._$lines),this._$buffer=null,this.$recodes=null,this._$fills=null,this._$lines=null,this}clone(){const t=new y;return t.copyFrom(this),t}copyFrom(t){t._$fillGradient&&(this._$fillGradient=t._$fillGradient.clone()),t._$fillBitmap&&(this._$fillBitmap=t._$fillBitmap.clone()),this._$hasFillEnabled=t._$hasFillEnabled,this._$fillType=t._$fillType,this._$fillColor=t._$fillColor,t._$lineGradient&&(this._$lineGradient=t._$lineGradient.clone()),this._$hasLineEnabled=t._$hasLineEnabled,this._$lineType=t._$lineType,this._$caps=t._$caps,this._$joints=t._$joints,this._$miterLimit=t._$miterLimit,this._$lineWidth=t._$lineWidth,this._$lineColor=t._$lineColor,this.xMin=t.xMin,this.xMax=t.xMax,this.yMin=t.yMin,this.yMax=t.yMax,this._$maxAlpha=t._$maxAlpha,this._$positionX=t._$positionX,this._$positionY=t._$positionY,this._$isBeginning=t._$isBeginning,t._$fills&&(this._$fills=t._$fills.slice(0)),t._$lines&&(this._$lines=t._$lines.slice(0)),t.$recodes&&(this.$recodes=t.$recodes.slice(0)),this._$buffer=null}cubicCurveTo(t,u,s,n,r,a){return r=+r||0,a=+a||0,this._$positionX===r&&this._$positionY===a?this:(t=+t||0,u=+u||0,s=+s||0,n=+n||0,st(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t,u,s,n,r,a),nt(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,y.CUBIC,t,u,s,n,r,a),this._$positionX=r,this._$positionY=a,this)}curveTo(t,u,s,n){return s=+s||0,n=+n||0,this._$positionX===s&&this._$positionY===n?this:(t=+t||0,u=+u||0,st(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t,u,s,n),nt(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,y.CURVE_TO,t,u,s,n),this._$positionX=s,this._$positionY=n,this)}drawCircle(t,u,s){return t=+t||0,u=+u||0,s=+s||0,s=Math.round(s),st(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t-s,u-s,t+s,u+s),nt(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,y.MOVE_TO,t+s,u,y.ARC,t,u,s),this._$positionX=t,this._$positionY=u,this}drawEllipse(t,u,s,n){return nc(this,t,u,s,n)}drawRect(t,u,s,n){return rc(this,t,u,s,n)}drawRoundRect(t,u,s,n,r,a=NaN){return ac(this,t,u,s,n,r,a)}endFill(){if(!this._$hasFillEnabled||!this._$fills||8>this._$fills.length)return this;switch(this.$recodes||(this.$recodes=U()),(this._$fills[2]!==this._$fills[this._$fills.length-2]||this._$fills[3]!==this._$fills[this._$fills.length-1])&&this._$fills.push(y.LINE_TO,this._$fills[2],this._$fills[3]),this.$recodes.push(...this._$fills),ee(this._$fills),this._$fills=null,this._$fillType){case y.FILL_STYLE:this.$recodes.push(this._$fillType,this._$fillColor>>>24&255,this._$fillColor>>>16&255,this._$fillColor>>>8&255,this._$fillColor&255,y.END_FILL);break;case y.GRADIENT_FILL:this._$fillGradient&&this.$recodes.push(this._$fillType,...this._$fillGradient.toArray());break;case y.BITMAP_FILL:this._$fillBitmap&&this.$recodes.push(this._$fillType,...this._$fillBitmap.toArray());break}return this._$fillType=0,this._$fillColor=0,this._$fillGradient=null,this._$fillBitmap=null,this._$hasFillEnabled=!1,this}endLine(){if(!this._$hasLineEnabled||!this._$lines)return this;switch(this.$recodes||(this.$recodes=U()),this.$recodes.push(...this._$lines),ee(this._$lines),this._$lines=null,this._$lineType){case y.STROKE_STYLE:this.$recodes.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,this._$lineColor>>>24&255,this._$lineColor>>>16&255,this._$lineColor>>>8&255,this._$lineColor&255,y.END_STROKE);break;case y.GRADIENT_STROKE:this._$lineGradient&&this.$recodes.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,...this._$lineGradient.toArray());break;case y.BITMAP_STROKE:this._$fillBitmap&&this.$recodes.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,...this._$fillBitmap.toArray());break}return this._$lineType=0,this._$lineWidth=0,this._$lineGradient=null,this._$lineColor=0,this._$caps="none",this._$joints="round",this._$miterLimit=0,this._$hasLineEnabled=!1,this}lineBitmapStyle(t,u=null,s=!0,n=!1){return this._$hasLineEnabled?(this._$lines||(this._$lines=U()),this._$maxAlpha=1,this._$hasLineEnabled=!0,this._$isBeginning=!0,this._$lines.push(y.BEGIN_PATH),this._$lineType=y.BITMAP_STROKE,this._$fillBitmap=new Bt(t,u,s,n),this):this}lineGradientStyle(t,u,s,n,r=null,a="pad",i="rgb",c=0){if(!this._$hasLineEnabled)return this;this._$lines||(this._$lines=U());for(let o=0;o<s.length;++o)this._$maxAlpha=Math.max(this._$maxAlpha,s[o]);return this._$lines.push(y.BEGIN_PATH),this._$lineType=y.GRADIENT_STROKE,this._$lineGradient=new Dt(t,u,s,n,r,a,i,c),this}lineStyle(t=1,u=0,s=1,n="round",r="round",a=3){this._$hasLineEnabled&&this.endLine(),this._$lines||(this._$lines=U()),this._$maxAlpha=Math.max(this._$maxAlpha,s),this._$hasLineEnabled=!0,this._$isBeginning=!0,this._$positionX||this._$positionY?this._$lines.push(y.BEGIN_PATH,y.MOVE_TO,this._$positionX,this._$positionY):this._$lines.push(y.BEGIN_PATH),this._$lineType=y.STROKE_STYLE,typeof u=="string"&&(u=Su(u)),u=de(u,0,16777215,0),s=de(s,0,1,1);const i=u>>>16&255,c=u>>>8&255,o=u&255;return this._$lineColor=i<<24|c<<16|o<<8|s*255,this._$lineWidth=t,this._$caps=`${n}`,this._$joints=`${r}`,this._$joints==="miter"&&(this._$miterLimit=a),this}lineTo(t,u){return t=+t||0,u=+u||0,this._$positionX===t&&this._$positionY===u?this:(st(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t,u),nt(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,y.LINE_TO,t,u),this._$positionX=t,this._$positionY=u,this)}moveTo(t,u){t=+t||0,u=+u||0,this._$positionX=t,this._$positionY=u,st(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t,u);let s=!1;return this._$hasFillEnabled&&this._$fills&&this._$fills[this._$fills.length-3]===y.MOVE_TO&&(s=!0,this._$fills[this._$fills.length-2]=t,this._$fills[this._$fills.length-1]=u),this._$hasLineEnabled&&this._$lines&&this._$lines[this._$lines.length-3]===y.MOVE_TO&&(s=!0,this._$lines[this._$lines.length-2]=t,this._$lines[this._$lines.length-1]=u),s||nt(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,y.MOVE_TO,t,u),this}get buffer(){if(this.isConfirmed&&this._$buffer)return this._$buffer;this._$hasLineEnabled&&this.endLine(),this._$hasFillEnabled&&this.endFill();const t=kt(this.$recodes);return this._$buffer=new Float32Array(t),ee(t),this.isConfirmed=!0,this._$buffer}set buffer(t){this._$buffer=t,this.isConfirmed=!0,this._$isBeginning=!0,this._$maxAlpha=1}}const ic=(e,t,u)=>{for(let s=0;s<t.length;)switch(t[s++]){case y.BEGIN_PATH:e.beginPath();break;case y.MOVE_TO:e.moveTo(t[s++],t[s++]);break;case y.LINE_TO:e.lineTo(t[s++],t[s++]);break;case y.CURVE_TO:e.quadraticCurveTo(t[s++],t[s++],t[s++],t[s++]);break;case y.FILL_STYLE:s+=4;continue;case y.END_FILL:if(e.isPointInPath(u.x,u.y))return!0;break;case y.STROKE_STYLE:s+=8;continue;case y.END_STROKE:break;case y.CLOSE_PATH:e.closePath();break;case y.CUBIC:e.bezierCurveTo(t[s++],t[s++],t[s++],t[s++],t[s++],t[s++]);break;case y.ARC:e.arc(t[s++],t[s++],t[s++],0,2*Math.PI);break;case y.GRADIENT_FILL:if(e.isPointInPath(u.x,u.y))return!0;s+=6;continue;case y.GRADIENT_STROKE:s+=12;continue;case y.BITMAP_FILL:if(e.isPointInPath(u.x,u.y))return!0;s+=6;continue;case y.BITMAP_STROKE:s+=9;continue}return!1},Ot=(e,t,u,s)=>{const n=e.graphics,r=n.xMax-n.xMin,a=n.yMax-n.yMin;if(r<=0||a<=0)return!1;const i=N(e),c=i?A.multiply(u,i):u;t.beginPath(),t.setTransform(c[0],c[1],c[2],c[3],c[4],c[5]);let o=!1;return n.buffer.length?o=ic(t,n.buffer,s):(t.moveTo(0,0),t.lineTo(r,0),t.lineTo(r,a),t.lineTo(0,a),t.lineTo(0,0),o=t.isPointInPath(s.x,s.y)),c!==u&&A.release(c),o},Ft=(e,t,u,s)=>{const n=Math.ceil(Math.abs(e.xMax-e.xMin)),r=Math.ceil(Math.abs(e.yMax-e.yMin));if(n<=0||r<=0)return!1;const a=N(e),i=a?A.multiply(u,a):u;return t.setTransform(i[0],i[1],i[2],i[3],i[4],i[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(n,0),t.lineTo(n,r),t.lineTo(0,r),t.lineTo(0,0),i!==u&&A.release(i),t.isPointInPath(s.x,s.y)},Ct=(e,t,u,s)=>{const n=e.videoWidth,r=e.videoHeight;if(n<=0||r<=0)return!1;const a=N(e),i=a?A.multiply(u,a):u;return t.beginPath(),t.setTransform(i[0],i[1],i[2],i[3],i[4],i[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(n,0),t.lineTo(n,r),t.lineTo(0,r),t.lineTo(0,0),i!==u&&A.release(i),t.isPointInPath(s.x,s.y)},He=(e,t,u,s,n=!0)=>{const r=e.children;if(!r.length)return!1;const a=N(e),i=a?A.multiply(u,a):u,c=U(),o=U(),d=Ja();let l=0,h=0;for(let $=0;$<r.length;++$){const m=r[$];if(m&&!m.isMask){if(m.clipDepth){h=c.length,l=m.clipDepth,c.push(m);continue}m.visible&&(l&&m.placeId>l&&(h=0,l=0),h&&d.set(m.instanceId,h),o.push(m))}}const b=e.mouseChildren&&n;if(e.isSprite&&e.hitArea){const $=He(e.hitArea,t,i,s,b);return $&&b&&e.mouseEnabled&&(e.buttonMode&&e.useHandCursor&&(s.pointer="pointer"),s.hit||(s.hit=e)),$}let f=!1;const p=e.mask;if(p){let $=!1;switch(!0){case p.isContainerEnabled:$=He(p,t,i,s,b);break;case p.isShape:$=Ot(p,t,i,s);break;case p.isText:$=Ft(p,t,i,s);break;case p.isVideo:$=Ct(p,t,i,s);break}if(!$)return!1}for(;o.length;){const $=o.pop();if(!$||$.isMask)continue;if(d.has($.instanceId)){const R=d.get($.instanceId);if(!R)continue;const S=c[R];if(!S)continue;let k=!1;switch(!0){case S.isContainerEnabled:k=He(S,t,i,s,b);break;case S.isShape:k=Ot(S,t,i,s);break;case S.isText:k=Ft(S,t,i,s);break;case S.isVideo:k=Ct(S,t,i,s);break}if(!k)continue}let m=!1;switch(!0){case $.isContainerEnabled:m=He($,t,i,s,b);break;case $.isShape:m=Ot($,t,i,s);break;case $.isText:m=Ft($,t,i,s);break;case $.isVideo:m=Ct($,t,i,s);break}if(m){if(f=!0,!b)break;if($.isInteractive&&$.mouseEnabled){if(s.pointer==="auto")switch(!0){case $.isText:$.type==="input"&&(s.pointer="text");break;case $.isSprite:$.buttonMode&&$.useHandCursor&&(s.pointer="pointer");break;default:s.pointer="pointer";break}s.hit||(s.hit=$);break}}}return ee(c),ee(o),ja(d),i!==u&&A.release(i),f},Le={x:0,y:0,pointer:"",hit:null},cc=(e,t,u,s=!1)=>{if(s){const d=e.parent,l=d?d.concatenatedMatrix.rawData:bt;switch(we.setTransform(1,0,0,1,0,0),we.beginPath(),Le.x=t,Le.y=u,Le.hit=null,!0){case e.isContainerEnabled:return He(e,we,l,Le);case e.isShape:return Ot(e,we,l,Le);case e.isText:return Ft(e,we,l,Le);case e.isVideo:return Ct(e,we,l,Le);default:return!1}}const n=Ze(e),r=N(e),a=ne(n[0],n[1],n[2],n[3],r||bt);F(n);const i=new be(a[0],a[1],Math.abs(a[2]-a[0]),Math.abs(a[3]-a[1]));F(a);const c=e.parent,o=c?c.globalToLocal(new J(t,u)):new J(t,u);return i.containsPoint(o)},oc=e=>{const t=N(e);return t?new A(t[0],t[1],t[2],t[3],t[4],t[5]):new A},lc=e=>{const t=qe(e);return t?new C(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]):new C};class ru extends je{instanceId;dictionaryId;isSprite;isInteractive;isContainerEnabled;isTimelineEnabled;isShape;isVideo;isText;placeId;placeObject;characterId;clipDepth;name;startFrame;endFrame;changed;$added;$addedToStage;uniqueKey;$matrix;$colorTransform;$filters;$blendMode;$scaleX;$scaleY;$rotation;$x;$y;$alpha;$cache;_$scale9Grid;_$visible;_$variables;isMask;parent;constructor(){super(),this.instanceId=$n(),this.dictionaryId=-1,this.uniqueKey="",this.isSprite=!1,this.isContainerEnabled=!1,this.isTimelineEnabled=!1,this.isShape=!1,this.isVideo=!1,this.isText=!1,this.isInteractive=!1,this.placeId=-1,this.placeObject=null,this.characterId=-1,this.clipDepth=0,this.name="",this.startFrame=1,this.endFrame=0,this.parent=null,this.isMask=!1,this.changed=!0,this.$added=!1,this.$addedToStage=!1,this.$matrix=null,this.$colorTransform=null,this.$filters=null,this.$blendMode=null,this._$visible=!0,this._$scale9Grid=null,this._$variables=null,this.$x=null,this.$y=null,this.$alpha=null,this.$scaleX=null,this.$scaleY=null,this.$rotation=null,this.$cache=null}get concatenatedMatrix(){return ni(this)}get alpha(){return ri(this)}set alpha(t){ai(this,t)}get blendMode(){return Pi(this)}set blendMode(t){Bi(this,t)}get filters(){return Li(this)}set filters(t){Ni(this,t)}get dropTarget(){return si()}get height(){return Ji(this)}set height(t){ji(this,t)}get loaderInfo(){return Rt.has(this)?Rt.get(this):null}get colorTransform(){return lc(this)}set colorTransform(t){this.$colorTransform=t}get matrix(){return oc(this)}set matrix(t){this.$matrix=t}get mouseX(){return this.globalToLocal(ft).x}get mouseY(){return this.globalToLocal(ft).y}get root(){return ke.has(this)?ke.get(this):null}get rotation(){return this.$rotation===null?_i(this):this.$rotation}set rotation(t){qi(this,t)}get scale9Grid(){return this._$scale9Grid}set scale9Grid(t){this._$scale9Grid!==t&&(this._$scale9Grid=t,Y(this))}get scaleX(){return this.$scaleX===null?Xi(this):this.$scaleX}set scaleX(t){In(this,t)}get scaleY(){return this.$scaleY===null?Yi(this):this.$scaleY}set scaleY(t){Sn(this,t)}get visible(){return this._$visible}set visible(t){this._$visible!==t&&(this._$visible=!!t,Y(this))}get width(){return Gi(this)}set width(t){Ki(this,t)}get x(){return this.$x===null?Vi(this):this.$x}set x(t){Wi(this,t)}get y(){return this.$y===null?Hi(this):this.$y}set y(t){zi(this,t)}getBounds(t=null){return tc(this,t)}globalToLocal(t){return Zi(this,t)}hitTestObject(t){return uc(this,t)}hitTestPoint(t,u,s=!1){return cc(this,t,u,s)}localToGlobal(t){return Qi(this,t)}getLocalVariable(t){if(!this._$variables)return null;if(this._$variables.has(t))return this._$variables.get(t)}setLocalVariable(t,u){this._$variables||(this._$variables=new Map),this._$variables.set(t,u)}hasLocalVariable(t){return this._$variables?this._$variables.has(t):!1}deleteLocalVariable(t){this._$variables&&this._$variables.has(t)&&(this._$variables.delete(t),this._$variables.size||(this._$variables=null))}getGlobalVariable(t){return Ce.has(t)?Ce.get(t):null}setGlobalVariable(t,u){Ce.set(t,u)}hasGlobalVariable(t){return Ce.has(t)}deleteGlobalVariable(t){Ce.has(t)&&Ce.delete(t)}clearGlobalVariable(){return Ce.clear()}remove(){ec(this)}$syncLoaderInfo(t){Rt.set(this,t)}}const Ln=e=>{const t=e.children;for(let u=0;u<t.length;++u){const s=t[u];s&&(ke.set(s,e.root),fe.add(s.instanceId),s.isContainerEnabled&&Ln(s))}},Nn=e=>{e.$addedToStage||!fe.has(e.instanceId)||(e.$addedToStage=!0,e.willTrigger(g.ADDED_TO_STAGE)&&e.dispatchEvent(new g(g.ADDED_TO_STAGE)))},Pn=e=>{const t=e.children;for(let u=0;u<t.length;++u){const s=t[u];s&&(Nn(s),s.isContainerEnabled&&Pn(s))}},hc=e=>{e.$added||(e.$added=!0,e.willTrigger(g.ADDED)&&e.dispatchEvent(new g(g.ADDED,!0)))},Rs=(e,t,u=-1)=>{const s=t.parent;s&&s.removeChild(t);const n=e.children;return 0>u?n.push(t):n.splice(u,0,t),e.$container=null,t.parent=e,fe.has(e.instanceId)&&(ke.set(t,e.root),fe.add(t.instanceId),t.isContainerEnabled&&Ln(t)),hc(t),fe.has(e.instanceId)&&(Nn(t),t.isContainerEnabled&&Pn(t)),Y(t),t},Bn=e=>{const t=e.children;for(let u=0;u<t.length;++u){const s=t[u];s&&(ke.delete(s),fe.delete(s.instanceId),s.isVideo&&s.pause(),s.isContainerEnabled&&Bn(s))}},dc=e=>{e.$added&&(e.$added=!1,e.willTrigger(g.REMOVED)&&e.dispatchEvent(new g(g.REMOVED,!0)))},Dn=e=>{!e.$addedToStage||!fe.has(e.instanceId)||(e.$addedToStage=!1,e.willTrigger(g.REMOVED_FROM_STAGE)&&e.dispatchEvent(new g(g.REMOVED_FROM_STAGE)),e.uniqueKey&&O.has(e.uniqueKey)&&O.removeTimer(e.uniqueKey))},ns=e=>{const t=e.children;for(let u=0;u<t.length;++u){const s=t[u];s&&(Dn(s),s.isContainerEnabled&&ns(s))}},rs=(e,t)=>{const u=t.parent;if(u&&u.instanceId!==e.instanceId)return;const s=e.children,n=s.indexOf(t);n>-1&&s.splice(n,1),e.$container=null,t.hasEventListener(g.ENTER_FRAME)&&t.removeAllEventListener(g.ENTER_FRAME),t.hasEventListener(B.KEY_DOWN)&&t.removeAllEventListener(B.KEY_DOWN),t.hasEventListener(B.KEY_UP)&&t.removeAllEventListener(B.KEY_UP),dc(t),fe.has(e.instanceId)&&(Dn(t),t.isContainerEnabled&&ns(t)),fe.has(e.instanceId)&&(ke.delete(t),fe.delete(t.instanceId),t.isVideo&&t.pause(),t.isContainerEnabled&&Bn(t)),t.parent=null,Y(e)},_n=(e,t)=>{const u=e.children;return t in u?u[t]:null},fc=(e,t)=>{const u=_n(e,t);u&&rs(e,u)},bc=(e,t)=>{if(e.instanceId===t.instanceId)return!0;const u=e.children;for(let s=0;s<u.length;++s){const n=u[s];if(n){if(n.instanceId===t.instanceId)return!0;if(n.isContainerEnabled&&n.contains(t))return!0}}return!1},$c=(e,t)=>{if(!t)return null;const u=e.children;for(let s=0;s<u.length;++s){const n=u[s];if(!(!n.name||n.name!==t))return n}return null},xc=(e,t)=>{const u=e.children.slice();if(u.length)for(let s=0;s<t.length;s++){const n=t[s],r=u[n];r&&rs(e,r)}},gc=(e,t,u)=>{const s=e.getChildIndex(t);if(s===-1||s===u)return;const n=e.children;n.splice(s,1),n.splice(u,0,t),Y(e)},mc=(e,t,u)=>{const s=e.getChildIndex(t),n=e.getChildIndex(u);if(s===-1||n===-1)return;const r=e.children;r[s]=u,r[n]=t,Y(e)},pc=(e,t,u)=>{const s=e.children,n=s[t],r=s[u];!n||!r||(s[t]=r,s[u]=n,Y(e))};class as extends ru{mouseEnabled;isInteractive;constructor(){super(),this.isInteractive=!0,this.mouseEnabled=!0}}class is extends as{_$children;_$mask;mouseChildren;$container;isContainerEnabled;constructor(){super(),this.isContainerEnabled=!0,this.mouseChildren=!0,this._$mask=null,this._$children=U(),this.$container=null}get children(){return this._$children}get numChildren(){return this.children.length}get mask(){return this._$mask}set mask(t){t!==this._$mask&&(this._$mask&&(this._$mask.isMask=!1,this._$mask=null),t&&(t.isMask=!0,this._$mask=t),Y(this))}addChild(t){return Rs(this,t)}addChildAt(t,u){return Rs(this,t,u)}contains(t){return bc(this,t)}getChildAt(t){return _n(this,t)}getChildByName(t){return $c(this,t)}getChildIndex(t){return this.children.indexOf(t)}removeChild(t){rs(this,t)}removeChildAt(t){fc(this,t)}removeChildren(...t){xc(this,t)}setChildIndex(t,u){gc(this,t,u)}swapChildren(t,u){mc(this,t,u)}swapChildrenAt(t,u){pc(this,t,u)}}class Un extends je{name;frame;constructor(t,u){super(),this.name=`${t}`,this.frame=u|0}}class Tc extends je{id;content;data;url;format;constructor(){super(),this.id=$n(),this.url="",this.content=null,this.data=null,this.format="json"}}const Ec=(e,t=!1,u=null)=>{const s=e.parent?e.parent.globalToLocal(ft):e.globalToLocal(ft);e.$lockCenter=t,e.$offsetX=e.x-s.x,e.$offsetY=e.y-s.y,e.$boundedRect=u,Tn(e)},yc=e=>{e.$lockCenter=!1,e.$offsetX=0,e.$offsetY=0,e.$boundedRect=null,Tn(null)};class cs extends is{buttonMode;useHandCursor;isSprite;hitArea;_$soundTransform;$offsetX=0;$offsetY=0;$lockCenter=!1;$boundedRect=null;constructor(){super(),this.isSprite=!0,this.buttonMode=!1,this.useHandCursor=!0,this.hitArea=null,this.$offsetX=0,this.$offsetY=0,this.$lockCenter=!1,this.$boundedRect=null,this._$soundTransform=null}get soundTransform(){return this._$soundTransform}set soundTransform(t){this._$soundTransform=t}startDrag(t=!1,u=null){Ec(this,t,u)}stopDrag(){yc(this)}}const qn=e=>{e.isBitmap=!1,e.$bitmapBuffer=null,e.graphics.clear(),e.uniqueKey!==""&&O.has(e.uniqueKey)&&(O.removeById(e.uniqueKey),O.$removeIds.push(+e.uniqueKey)),Y(e)},Xn=(e,t,u,s)=>{qn(e),e.isBitmap=!0,e.$bitmapBuffer=s,e.graphics.xMin=0,e.graphics.yMin=0,e.graphics.xMax=t,e.graphics.yMax=u},wc=(e,t)=>{const u=new Image;u.crossOrigin="anonymous",u.addEventListener("load",()=>{const s=u.width,n=u.height,r=O.getCanvas();r.width=s,r.height=n;const a=r.getContext("2d",{willReadFrequently:!0});a.drawImage(u,0,0,s,n),Xn(e,s,n,new Uint8Array(a.getImageData(0,0,s,n).data)),O.destroy(a),e.hasEventListener(g.COMPLETE)&&e.dispatchEvent(new g(g.COMPLETE))}),u.src=t},Mc=(e,t)=>{const u=e.graphics,s=Math.ceil(Math.abs(t.bounds.xMax-t.bounds.xMin)),n=Math.ceil(Math.abs(t.bounds.yMax-t.bounds.yMin));switch(!0){case t.bitmapId>0:{const a=e.loaderInfo.data?.characters[t.bitmapId];if(!a)break;e.isBitmap=!0,a.imageBuffer||(a.imageBuffer=new Uint8Array(a.buffer),a.buffer=null);const i=Math.ceil(Math.abs(a.bounds.xMax-a.bounds.xMin)),c=Math.ceil(Math.abs(a.bounds.yMax-a.bounds.yMin));if(t.grid){if(t.recodes){const o=t.recodes.slice(0);o.splice(-6,6);const d=new Ne(i,c);d.buffer=a.imageBuffer,o.push(y.BITMAP_FILL,d,null,!0,!1,9);const l=kt(o);u.buffer=new Float32Array(l),ee(o),ee(l)}}else if(s===i&&n===c)e.setBitmapBuffer(Math.ceil(Math.abs(a.bounds.xMax-a.bounds.xMin)),Math.ceil(Math.abs(a.bounds.yMax-a.bounds.yMin)),a.imageBuffer);else{const o=new Ne(i,c);if(o.buffer=a.imageBuffer,t.recodes)if(t.recodes[t.recodes.length-10]===y.BITMAP_STROKE){const l=t.recodes.slice(0);l.splice(-5,5),l.push(o,null,!0,!1);const h=kt(l);u.buffer=new Float32Array(h),ee(l),ee(h)}else u.beginBitmapFill(o).drawRect(0,0,s,n)}}break;case t.inBitmap:{e.isBitmap=!0;const r=t.recodes,a=r[r.length-4];if(s===a.width&&n===a.height)e.setBitmapBuffer(a.width,a.height,a.buffer);else{const i=new Ne(a.width,a.height);i.buffer=a.buffer,u.beginBitmapFill(i).drawRect(0,0,s,n)}}break;case"buffer"in t:t.imageBuffer||(t.imageBuffer=new Uint8Array(t.buffer),t.buffer=null),e.setBitmapBuffer(Math.ceil(Math.abs(u.xMax-u.xMin)),Math.ceil(Math.abs(u.yMax-u.yMin)),t.imageBuffer);break;default:t.recodes&&(t.recodeBuffer=new Float32Array(kt(t.recodes)),ee(t.recodes),t.recodes=null),t.recodeBuffer&&(u.buffer=t.recodeBuffer);break}u.xMin=t.bounds.xMin,u.xMax=t.bounds.xMax,u.yMin=t.bounds.yMin,u.yMax=t.bounds.yMax,t.grid&&(e.scale9Grid=new be(t.grid.x,t.grid.y,t.grid.w,t.grid.h))};class $t extends ru{_$graphics;_$src;isShape;cacheKey;cacheParams;isBitmap;$bitmapBuffer;constructor(){super(),this.isShape=!0,this.cacheKey=0,this.cacheParams=U(0,0,0),this._$graphics=null,this._$src="",this.$bitmapBuffer=null,this.isBitmap=!1}static get namespace(){return"next2d.display.Shape"}get namespace(){return"next2d.display.Shape"}get graphics(){return this._$graphics||(this._$graphics=new y,ui.set(this._$graphics,this)),this._$graphics}get src(){return this._$src}set src(t){this._$src!==t&&(this._$src=t,wc(this,t))}get bitmapData(){const t=new Ne(this.width,this.height);return this.$bitmapBuffer&&(t.buffer=this.$bitmapBuffer),t}clearBitmapBuffer(){qn(this)}setBitmapBuffer(t,u,s){Xn(this,t,u,s)}$sync(t,u=null){u&&super.$syncLoaderInfo(u),Mc(this,t)}}let Yn=null;const ks=e=>{Yn=e},Fe=()=>Yn,ie=document.createElement("textarea");ie.tabIndex=-1;let pe="";pe+="position: fixed;";pe+="top: 0;";pe+="left: 0;";pe+="font-size: 16px;";pe+="border: 0;";pe+="resize: none;";pe+="opacity: 0;";pe+="z-index: -1;";pe+="pointer-events: none;";ie.setAttribute("style",pe);const Fu=document.createElement("canvas");Fu.width=Fu.height=1;const Pe=Fu.getContext("2d");let Vn=0;const yt=()=>Vn,ot=e=>{Vn=e},Ac=e=>Pe?(Pe.fillStyle=e,+`0x${Pe.fillStyle.slice(1)}`):0,Qe=e=>isNaN(+e)?Ac(`${e}`):+e,vc=(e,t=1)=>({R:(e&16711680)>>16,G:(e&65280)>>8,B:e&255,A:t*255}),ht=(e,t,u,s=null)=>{const n=+e;return isNaN(n)&&s!==null?s:Math.min(Math.max(t,isNaN(n)?0:n),u)};let Wn;const _t=()=>Wn,Hn=e=>{Wn=e},ze={x:0,y:0};class se{align;bold;color;font;italic;leading;leftMargin;letterSpacing;rightMargin;size;underline;constructor(t=null,u=null,s=null,n=null,r=null,a=null,i=null,c=null,o=null,d=null,l=null){this.font=t,this.size=u,this.color=s,this.bold=n,this.italic=r,this.underline=a,this.align=i,this.leftMargin=c,this.rightMargin=o,this.leading=d,this.letterSpacing=l}clone(){return new se(this.font,this.size,this.color,this.bold,this.italic,this.underline,this.align,this.leftMargin,this.rightMargin,this.leading,this.letterSpacing)}toObject(){return{font:this.font,size:this.size,color:Qe(this.color),bold:this.bold,italic:this.italic,underline:this.underline,align:this.align,leftMargin:this.leftMargin,rightMargin:this.rightMargin,leading:this.leading,letterSpacing:this.letterSpacing}}}const Ic=e=>{e.align="left",e.bold=!1,e.color=0,e.font="Times New Roman",e.italic=!1,e.leading=0,e.leftMargin=0,e.letterSpacing=0,e.rightMargin=0,e.size=12,e.underline=!1},Sc=e=>{let t="";if(e.font&&(t+=`font-family: ${e.font};`),e.size&&(t+=`font-size: ${e.size}px;`),e.color){const u=vc(Qe(e.color)),s=u.R.toString(16).padStart(2,"0"),n=u.G.toString(16).padStart(2,"0"),r=u.B.toString(16).padStart(2,"0");t+=`color: #${s}${n}${r};`}return e.bold&&(t+="font-weight: bold;"),e.italic&&(t+="font-style: italic;"),e.underline&&(t+="text-decoration: underline;"),e.align&&(t+=`text-align: ${e.align};`),e.leftMargin&&(t+=`margin-left: ${e.leftMargin}px;`),e.rightMargin&&(t+=`margin-right: ${e.rightMargin}px;`),e.leading&&(t+=`margin-bottom: ${e.leading}px;`),e.letterSpacing&&(t+=`letter-spacing: ${e.letterSpacing}px;`),t};class Rc{_$textWidth;_$textHeight;heightTable;ascentTable;widthTable;textTable;lineTable;constructor(){this._$textWidth=-1,this._$textHeight=-1,this.widthTable=[],this.heightTable=[],this.ascentTable=[],this.textTable=[],this.lineTable=[]}get textWidth(){if(this._$textWidth!==-1)return this._$textWidth;this._$textWidth=0;for(let t=0;t<this.widthTable.length;++t)this._$textWidth=Math.max(this._$textWidth,this.widthTable[t]);return this._$textWidth}get textHeight(){if(this._$textHeight!==-1)return this._$textHeight;this._$textHeight=0;for(let t=0;t<this.heightTable.length;++t)this._$textHeight+=this.heightTable[t];return this._$textHeight}getLineWidth(t){return t in this.widthTable?this.widthTable[t]:0}getLineHeight(t){return t in this.heightTable?this.heightTable[t]:0}clear(){this._$textWidth=-1,this._$textHeight=-1,this.widthTable.length=0,this.heightTable.length=0,this.ascentTable.length=0,this.textTable.length=0,this.lineTable.length=0}}const kc=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(e=>e.charCodeAt(0))),Oc=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(e=>e.charCodeAt(0)));var Eu;const Fc=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Os=(Eu=String.fromCodePoint)!==null&&Eu!==void 0?Eu:function(e){let t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function Cc(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=Fc.get(e))!==null&&t!==void 0?t:e}var Z;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Z||(Z={}));const Lc=32;var Se;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Se||(Se={}));function Cu(e){return e>=Z.ZERO&&e<=Z.NINE}function Nc(e){return e>=Z.UPPER_A&&e<=Z.UPPER_F||e>=Z.LOWER_A&&e<=Z.LOWER_F}function Pc(e){return e>=Z.UPPER_A&&e<=Z.UPPER_Z||e>=Z.LOWER_A&&e<=Z.LOWER_Z||Cu(e)}function Bc(e){return e===Z.EQUALS||Pc(e)}var K;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(K||(K={}));var ge;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(ge||(ge={}));class Dc{constructor(t,u,s){this.decodeTree=t,this.emitCodePoint=u,this.errors=s,this.state=K.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=ge.Strict}startEntity(t){this.decodeMode=t,this.state=K.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,u){switch(this.state){case K.EntityStart:return t.charCodeAt(u)===Z.NUM?(this.state=K.NumericStart,this.consumed+=1,this.stateNumericStart(t,u+1)):(this.state=K.NamedEntity,this.stateNamedEntity(t,u));case K.NumericStart:return this.stateNumericStart(t,u);case K.NumericDecimal:return this.stateNumericDecimal(t,u);case K.NumericHex:return this.stateNumericHex(t,u);case K.NamedEntity:return this.stateNamedEntity(t,u)}}stateNumericStart(t,u){return u>=t.length?-1:(t.charCodeAt(u)|Lc)===Z.LOWER_X?(this.state=K.NumericHex,this.consumed+=1,this.stateNumericHex(t,u+1)):(this.state=K.NumericDecimal,this.stateNumericDecimal(t,u))}addToNumericResult(t,u,s,n){if(u!==s){const r=s-u;this.result=this.result*Math.pow(n,r)+Number.parseInt(t.substr(u,r),n),this.consumed+=r}}stateNumericHex(t,u){const s=u;for(;u<t.length;){const n=t.charCodeAt(u);if(Cu(n)||Nc(n))u+=1;else return this.addToNumericResult(t,s,u,16),this.emitNumericEntity(n,3)}return this.addToNumericResult(t,s,u,16),-1}stateNumericDecimal(t,u){const s=u;for(;u<t.length;){const n=t.charCodeAt(u);if(Cu(n))u+=1;else return this.addToNumericResult(t,s,u,10),this.emitNumericEntity(n,2)}return this.addToNumericResult(t,s,u,10),-1}emitNumericEntity(t,u){var s;if(this.consumed<=u)return(s=this.errors)===null||s===void 0||s.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===Z.SEMI)this.consumed+=1;else if(this.decodeMode===ge.Strict)return 0;return this.emitCodePoint(Cc(this.result),this.consumed),this.errors&&(t!==Z.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,u){const{decodeTree:s}=this;let n=s[this.treeIndex],r=(n&Se.VALUE_LENGTH)>>14;for(;u<t.length;u++,this.excess++){const a=t.charCodeAt(u);if(this.treeIndex=_c(s,n,this.treeIndex+Math.max(1,r),a),this.treeIndex<0)return this.result===0||this.decodeMode===ge.Attribute&&(r===0||Bc(a))?0:this.emitNotTerminatedNamedEntity();if(n=s[this.treeIndex],r=(n&Se.VALUE_LENGTH)>>14,r!==0){if(a===Z.SEMI)return this.emitNamedEntityData(this.treeIndex,r,this.consumed+this.excess);this.decodeMode!==ge.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;const{result:u,decodeTree:s}=this,n=(s[u]&Se.VALUE_LENGTH)>>14;return this.emitNamedEntityData(u,n,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,u,s){const{decodeTree:n}=this;return this.emitCodePoint(u===1?n[t]&~Se.VALUE_LENGTH:n[t+1],s),u===3&&this.emitCodePoint(n[t+2],s),s}end(){var t;switch(this.state){case K.NamedEntity:return this.result!==0&&(this.decodeMode!==ge.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case K.NumericDecimal:return this.emitNumericEntity(0,2);case K.NumericHex:return this.emitNumericEntity(0,3);case K.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case K.EntityStart:return 0}}}function _c(e,t,u,s){const n=(t&Se.BRANCH_LENGTH)>>7,r=t&Se.JUMP_TABLE;if(n===0)return r!==0&&s===r?u:-1;if(r){const c=s-r;return c<0||c>=n?-1:e[u+c]-1}let a=u,i=a+n-1;for(;a<=i;){const c=a+i>>>1,o=e[c];if(o<s)a=c+1;else if(o>s)i=c-1;else return e[c+n]}return-1}var I;(function(e){e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.Number=35]="Number",e[e.Amp=38]="Amp",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Dash=45]="Dash",e[e.Slash=47]="Slash",e[e.Zero=48]="Zero",e[e.Nine=57]="Nine",e[e.Semi=59]="Semi",e[e.Lt=60]="Lt",e[e.Eq=61]="Eq",e[e.Gt=62]="Gt",e[e.Questionmark=63]="Questionmark",e[e.UpperA=65]="UpperA",e[e.LowerA=97]="LowerA",e[e.UpperF=70]="UpperF",e[e.LowerF=102]="LowerF",e[e.UpperZ=90]="UpperZ",e[e.LowerZ=122]="LowerZ",e[e.LowerX=120]="LowerX",e[e.OpeningSquareBracket=91]="OpeningSquareBracket"})(I||(I={}));var x;(function(e){e[e.Text=1]="Text",e[e.BeforeTagName=2]="BeforeTagName",e[e.InTagName=3]="InTagName",e[e.InSelfClosingTag=4]="InSelfClosingTag",e[e.BeforeClosingTagName=5]="BeforeClosingTagName",e[e.InClosingTagName=6]="InClosingTagName",e[e.AfterClosingTagName=7]="AfterClosingTagName",e[e.BeforeAttributeName=8]="BeforeAttributeName",e[e.InAttributeName=9]="InAttributeName",e[e.AfterAttributeName=10]="AfterAttributeName",e[e.BeforeAttributeValue=11]="BeforeAttributeValue",e[e.InAttributeValueDq=12]="InAttributeValueDq",e[e.InAttributeValueSq=13]="InAttributeValueSq",e[e.InAttributeValueNq=14]="InAttributeValueNq",e[e.BeforeDeclaration=15]="BeforeDeclaration",e[e.InDeclaration=16]="InDeclaration",e[e.InProcessingInstruction=17]="InProcessingInstruction",e[e.BeforeComment=18]="BeforeComment",e[e.CDATASequence=19]="CDATASequence",e[e.InSpecialComment=20]="InSpecialComment",e[e.InCommentLike=21]="InCommentLike",e[e.BeforeSpecialS=22]="BeforeSpecialS",e[e.BeforeSpecialT=23]="BeforeSpecialT",e[e.SpecialStartSequence=24]="SpecialStartSequence",e[e.InSpecialTag=25]="InSpecialTag",e[e.InEntity=26]="InEntity"})(x||(x={}));function ye(e){return e===I.Space||e===I.NewLine||e===I.Tab||e===I.FormFeed||e===I.CarriageReturn}function wt(e){return e===I.Slash||e===I.Gt||ye(e)}function Uc(e){return e>=I.LowerA&&e<=I.LowerZ||e>=I.UpperA&&e<=I.UpperZ}var me;(function(e){e[e.NoValue=0]="NoValue",e[e.Unquoted=1]="Unquoted",e[e.Single=2]="Single",e[e.Double=3]="Double"})(me||(me={}));const z={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97]),XmpEnd:new Uint8Array([60,47,120,109,112])};class qc{constructor({xmlMode:t=!1,decodeEntities:u=!0},s){this.cbs=s,this.state=x.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=x.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=t,this.decodeEntities=u,this.entityDecoder=new Dc(t?Oc:kc,(n,r)=>this.emitCodePoint(n,r))}reset(){this.state=x.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=x.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(t){this.offset+=this.buffer.length,this.buffer=t,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(t){t===I.Lt||!this.decodeEntities&&this.fastForwardTo(I.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=x.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&t===I.Amp&&this.startEntity()}stateSpecialStartSequence(t){const u=this.sequenceIndex===this.currentSequence.length;if(!(u?wt(t):(t|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!u){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=x.InTagName,this.stateInTagName(t)}stateInSpecialTag(t){if(this.sequenceIndex===this.currentSequence.length){if(t===I.Gt||ye(t)){const u=this.index-this.currentSequence.length;if(this.sectionStart<u){const s=this.index;this.index=u,this.cbs.ontext(this.sectionStart,u),this.index=s}this.isSpecial=!1,this.sectionStart=u+2,this.stateInClosingTagName(t);return}this.sequenceIndex=0}(t|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===z.TitleEnd?this.decodeEntities&&t===I.Amp&&this.startEntity():this.fastForwardTo(I.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(t===I.Lt)}stateCDATASequence(t){t===z.Cdata[this.sequenceIndex]?++this.sequenceIndex===z.Cdata.length&&(this.state=x.InCommentLike,this.currentSequence=z.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=x.InDeclaration,this.stateInDeclaration(t))}fastForwardTo(t){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===t)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(t){t===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===z.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=x.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):t!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(t){return this.xmlMode?!wt(t):Uc(t)}startSpecial(t,u){this.isSpecial=!0,this.currentSequence=t,this.sequenceIndex=u,this.state=x.SpecialStartSequence}stateBeforeTagName(t){if(t===I.ExclamationMark)this.state=x.BeforeDeclaration,this.sectionStart=this.index+1;else if(t===I.Questionmark)this.state=x.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(t)){const u=t|32;this.sectionStart=this.index,this.xmlMode?this.state=x.InTagName:u===z.ScriptEnd[2]?this.state=x.BeforeSpecialS:u===z.TitleEnd[2]||u===z.XmpEnd[2]?this.state=x.BeforeSpecialT:this.state=x.InTagName}else t===I.Slash?this.state=x.BeforeClosingTagName:(this.state=x.Text,this.stateText(t))}stateInTagName(t){wt(t)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=x.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateBeforeClosingTagName(t){ye(t)||(t===I.Gt?this.state=x.Text:(this.state=this.isTagStartChar(t)?x.InClosingTagName:x.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(t){(t===I.Gt||ye(t))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=x.AfterClosingTagName,this.stateAfterClosingTagName(t))}stateAfterClosingTagName(t){(t===I.Gt||this.fastForwardTo(I.Gt))&&(this.state=x.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(t){t===I.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=x.InSpecialTag,this.sequenceIndex=0):this.state=x.Text,this.sectionStart=this.index+1):t===I.Slash?this.state=x.InSelfClosingTag:ye(t)||(this.state=x.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(t){t===I.Gt?(this.cbs.onselfclosingtag(this.index),this.state=x.Text,this.sectionStart=this.index+1,this.isSpecial=!1):ye(t)||(this.state=x.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateInAttributeName(t){(t===I.Eq||wt(t))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=x.AfterAttributeName,this.stateAfterAttributeName(t))}stateAfterAttributeName(t){t===I.Eq?this.state=x.BeforeAttributeValue:t===I.Slash||t===I.Gt?(this.cbs.onattribend(me.NoValue,this.sectionStart),this.sectionStart=-1,this.state=x.BeforeAttributeName,this.stateBeforeAttributeName(t)):ye(t)||(this.cbs.onattribend(me.NoValue,this.sectionStart),this.state=x.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(t){t===I.DoubleQuote?(this.state=x.InAttributeValueDq,this.sectionStart=this.index+1):t===I.SingleQuote?(this.state=x.InAttributeValueSq,this.sectionStart=this.index+1):ye(t)||(this.sectionStart=this.index,this.state=x.InAttributeValueNq,this.stateInAttributeValueNoQuotes(t))}handleInAttributeValue(t,u){t===u||!this.decodeEntities&&this.fastForwardTo(u)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(u===I.DoubleQuote?me.Double:me.Single,this.index+1),this.state=x.BeforeAttributeName):this.decodeEntities&&t===I.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(t){this.handleInAttributeValue(t,I.DoubleQuote)}stateInAttributeValueSingleQuotes(t){this.handleInAttributeValue(t,I.SingleQuote)}stateInAttributeValueNoQuotes(t){ye(t)||t===I.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(me.Unquoted,this.index),this.state=x.BeforeAttributeName,this.stateBeforeAttributeName(t)):this.decodeEntities&&t===I.Amp&&this.startEntity()}stateBeforeDeclaration(t){t===I.OpeningSquareBracket?(this.state=x.CDATASequence,this.sequenceIndex=0):this.state=t===I.Dash?x.BeforeComment:x.InDeclaration}stateInDeclaration(t){(t===I.Gt||this.fastForwardTo(I.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=x.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(t){(t===I.Gt||this.fastForwardTo(I.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=x.Text,this.sectionStart=this.index+1)}stateBeforeComment(t){t===I.Dash?(this.state=x.InCommentLike,this.currentSequence=z.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=x.InDeclaration}stateInSpecialComment(t){(t===I.Gt||this.fastForwardTo(I.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=x.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(t){const u=t|32;u===z.ScriptEnd[3]?this.startSpecial(z.ScriptEnd,4):u===z.StyleEnd[3]?this.startSpecial(z.StyleEnd,4):(this.state=x.InTagName,this.stateInTagName(t))}stateBeforeSpecialT(t){switch(t|32){case z.TitleEnd[3]:{this.startSpecial(z.TitleEnd,4);break}case z.TextareaEnd[3]:{this.startSpecial(z.TextareaEnd,4);break}case z.XmpEnd[3]:{this.startSpecial(z.XmpEnd,4);break}default:this.state=x.InTagName,this.stateInTagName(t)}}startEntity(){this.baseState=this.state,this.state=x.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?ge.Strict:this.baseState===x.Text||this.baseState===x.InSpecialTag?ge.Legacy:ge.Attribute)}stateInEntity(){const t=this.entityDecoder.write(this.buffer,this.index-this.offset);t>=0?(this.state=this.baseState,t===0&&(this.index=this.entityStart)):this.index=this.offset+this.buffer.length-1}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===x.Text||this.state===x.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===x.InAttributeValueDq||this.state===x.InAttributeValueSq||this.state===x.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const t=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case x.Text:{this.stateText(t);break}case x.SpecialStartSequence:{this.stateSpecialStartSequence(t);break}case x.InSpecialTag:{this.stateInSpecialTag(t);break}case x.CDATASequence:{this.stateCDATASequence(t);break}case x.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(t);break}case x.InAttributeName:{this.stateInAttributeName(t);break}case x.InCommentLike:{this.stateInCommentLike(t);break}case x.InSpecialComment:{this.stateInSpecialComment(t);break}case x.BeforeAttributeName:{this.stateBeforeAttributeName(t);break}case x.InTagName:{this.stateInTagName(t);break}case x.InClosingTagName:{this.stateInClosingTagName(t);break}case x.BeforeTagName:{this.stateBeforeTagName(t);break}case x.AfterAttributeName:{this.stateAfterAttributeName(t);break}case x.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(t);break}case x.BeforeAttributeValue:{this.stateBeforeAttributeValue(t);break}case x.BeforeClosingTagName:{this.stateBeforeClosingTagName(t);break}case x.AfterClosingTagName:{this.stateAfterClosingTagName(t);break}case x.BeforeSpecialS:{this.stateBeforeSpecialS(t);break}case x.BeforeSpecialT:{this.stateBeforeSpecialT(t);break}case x.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(t);break}case x.InSelfClosingTag:{this.stateInSelfClosingTag(t);break}case x.InDeclaration:{this.stateInDeclaration(t);break}case x.BeforeDeclaration:{this.stateBeforeDeclaration(t);break}case x.BeforeComment:{this.stateBeforeComment(t);break}case x.InProcessingInstruction:{this.stateInProcessingInstruction(t);break}case x.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===x.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const t=this.buffer.length+this.offset;this.sectionStart>=t||(this.state===x.InCommentLike?this.currentSequence===z.CdataEnd?this.cbs.oncdata(this.sectionStart,t,0):this.cbs.oncomment(this.sectionStart,t,0):this.state===x.InTagName||this.state===x.BeforeAttributeName||this.state===x.BeforeAttributeValue||this.state===x.AfterAttributeName||this.state===x.InAttributeName||this.state===x.InAttributeValueSq||this.state===x.InAttributeValueDq||this.state===x.InAttributeValueNq||this.state===x.InClosingTagName||this.cbs.ontext(this.sectionStart,t))}emitCodePoint(t,u){this.baseState!==x.Text&&this.baseState!==x.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+u,this.index=this.sectionStart-1,this.cbs.onattribentity(t)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+u,this.index=this.sectionStart-1,this.cbs.ontextentity(t,this.sectionStart))}}const Ve=new Set(["input","option","optgroup","select","button","datalist","textarea"]),P=new Set(["p"]),Fs=new Set(["thead","tbody"]),Cs=new Set(["dd","dt"]),Ls=new Set(["rt","rp"]),Xc=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",P],["h1",P],["h2",P],["h3",P],["h4",P],["h5",P],["h6",P],["select",Ve],["input",Ve],["output",Ve],["button",Ve],["datalist",Ve],["textarea",Ve],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",Cs],["dt",Cs],["address",P],["article",P],["aside",P],["blockquote",P],["details",P],["div",P],["dl",P],["fieldset",P],["figcaption",P],["figure",P],["footer",P],["form",P],["header",P],["hr",P],["main",P],["nav",P],["ol",P],["pre",P],["section",P],["table",P],["ul",P],["rt",Ls],["rp",Ls],["tbody",Fs],["tfoot",Fs]]),Yc=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),Ns=new Set(["math","svg"]),Ps=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),Vc=/\s|\//;class Wc{constructor(t,u={}){var s,n,r,a,i,c;this.options=u,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=t??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(s=u.lowerCaseTags)!==null&&s!==void 0?s:this.htmlMode,this.lowerCaseAttributeNames=(n=u.lowerCaseAttributeNames)!==null&&n!==void 0?n:this.htmlMode,this.recognizeSelfClosing=(r=u.recognizeSelfClosing)!==null&&r!==void 0?r:!this.htmlMode,this.tokenizer=new((a=u.Tokenizer)!==null&&a!==void 0?a:qc)(this.options,this),this.foreignContext=[!this.htmlMode],(c=(i=this.cbs).onparserinit)===null||c===void 0||c.call(i,this)}ontext(t,u){var s,n;const r=this.getSlice(t,u);this.endIndex=u-1,(n=(s=this.cbs).ontext)===null||n===void 0||n.call(s,r),this.startIndex=u}ontextentity(t,u){var s,n;this.endIndex=u-1,(n=(s=this.cbs).ontext)===null||n===void 0||n.call(s,Os(t)),this.startIndex=u}isVoidElement(t){return this.htmlMode&&Yc.has(t)}onopentagname(t,u){this.endIndex=u;let s=this.getSlice(t,u);this.lowerCaseTagNames&&(s=s.toLowerCase()),this.emitOpenTag(s)}emitOpenTag(t){var u,s,n,r;this.openTagStart=this.startIndex,this.tagname=t;const a=this.htmlMode&&Xc.get(t);if(a)for(;this.stack.length>0&&a.has(this.stack[0]);){const i=this.stack.shift();(s=(u=this.cbs).onclosetag)===null||s===void 0||s.call(u,i,!0)}this.isVoidElement(t)||(this.stack.unshift(t),this.htmlMode&&(Ns.has(t)?this.foreignContext.unshift(!0):Ps.has(t)&&this.foreignContext.unshift(!1))),(r=(n=this.cbs).onopentagname)===null||r===void 0||r.call(n,t),this.cbs.onopentag&&(this.attribs={})}endOpenTag(t){var u,s;this.startIndex=this.openTagStart,this.attribs&&((s=(u=this.cbs).onopentag)===null||s===void 0||s.call(u,this.tagname,this.attribs,t),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(t){this.endIndex=t,this.endOpenTag(!1),this.startIndex=t+1}onclosetag(t,u){var s,n,r,a,i,c,o,d;this.endIndex=u;let l=this.getSlice(t,u);if(this.lowerCaseTagNames&&(l=l.toLowerCase()),this.htmlMode&&(Ns.has(l)||Ps.has(l))&&this.foreignContext.shift(),this.isVoidElement(l))this.htmlMode&&l==="br"&&((a=(r=this.cbs).onopentagname)===null||a===void 0||a.call(r,"br"),(c=(i=this.cbs).onopentag)===null||c===void 0||c.call(i,"br",{},!0),(d=(o=this.cbs).onclosetag)===null||d===void 0||d.call(o,"br",!1));else{const h=this.stack.indexOf(l);if(h!==-1)for(let b=0;b<=h;b++){const f=this.stack.shift();(n=(s=this.cbs).onclosetag)===null||n===void 0||n.call(s,f,b!==h)}else this.htmlMode&&l==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=u+1}onselfclosingtag(t){this.endIndex=t,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=t+1):this.onopentagend(t)}closeCurrentTag(t){var u,s;const n=this.tagname;this.endOpenTag(t),this.stack[0]===n&&((s=(u=this.cbs).onclosetag)===null||s===void 0||s.call(u,n,!t),this.stack.shift())}onattribname(t,u){this.startIndex=t;const s=this.getSlice(t,u);this.attribname=this.lowerCaseAttributeNames?s.toLowerCase():s}onattribdata(t,u){this.attribvalue+=this.getSlice(t,u)}onattribentity(t){this.attribvalue+=Os(t)}onattribend(t,u){var s,n;this.endIndex=u,(n=(s=this.cbs).onattribute)===null||n===void 0||n.call(s,this.attribname,this.attribvalue,t===me.Double?'"':t===me.Single?"'":t===me.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(t){const u=t.search(Vc);let s=u<0?t:t.substr(0,u);return this.lowerCaseTagNames&&(s=s.toLowerCase()),s}ondeclaration(t,u){this.endIndex=u;const s=this.getSlice(t,u);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(s);this.cbs.onprocessinginstruction(`!${n}`,`!${s}`)}this.startIndex=u+1}onprocessinginstruction(t,u){this.endIndex=u;const s=this.getSlice(t,u);if(this.cbs.onprocessinginstruction){const n=this.getInstructionName(s);this.cbs.onprocessinginstruction(`?${n}`,`?${s}`)}this.startIndex=u+1}oncomment(t,u,s){var n,r,a,i;this.endIndex=u,(r=(n=this.cbs).oncomment)===null||r===void 0||r.call(n,this.getSlice(t,u-s)),(i=(a=this.cbs).oncommentend)===null||i===void 0||i.call(a),this.startIndex=u+1}oncdata(t,u,s){var n,r,a,i,c,o,d,l,h,b;this.endIndex=u;const f=this.getSlice(t,u-s);!this.htmlMode||this.options.recognizeCDATA?((r=(n=this.cbs).oncdatastart)===null||r===void 0||r.call(n),(i=(a=this.cbs).ontext)===null||i===void 0||i.call(a,f),(o=(c=this.cbs).oncdataend)===null||o===void 0||o.call(c)):((l=(d=this.cbs).oncomment)===null||l===void 0||l.call(d,`[CDATA[${f}]]`),(b=(h=this.cbs).oncommentend)===null||b===void 0||b.call(h)),this.startIndex=u+1}onend(){var t,u;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let s=0;s<this.stack.length;s++)this.cbs.onclosetag(this.stack[s],!0)}(u=(t=this.cbs).onend)===null||u===void 0||u.call(t)}reset(){var t,u,s,n;(u=(t=this.cbs).onreset)===null||u===void 0||u.call(t),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(n=(s=this.cbs).onparserinit)===null||n===void 0||n.call(s,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(t){this.reset(),this.end(t)}getSlice(t,u){for(;t-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let s=this.buffers[0].slice(t-this.bufferOffset,u-this.bufferOffset);for(;u-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),s+=this.buffers[0].slice(0,u-this.bufferOffset);return s}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(t){var u,s;if(this.ended){(s=(u=this.cbs).onerror)===null||s===void 0||s.call(u,new Error(".write() after done!"));return}this.buffers.push(t),this.tokenizer.running&&(this.tokenizer.write(t),this.writeIndex++)}end(t){var u,s;if(this.ended){(s=(u=this.cbs).onerror)===null||s===void 0||s.call(u,new Error(".end() after done!"));return}t&&this.write(t),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(t){this.write(t)}done(t){this.end(t)}}var L;(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(L||(L={}));function Hc(e){return e.type===L.Tag||e.type===L.Script||e.type===L.Style}L.Root;L.Text;L.Directive;L.Comment;L.Script;L.Style;L.Tag;L.CDATA;L.Doctype;class zn{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return Jn(this,t)}}class os extends zn{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}}class Lu extends os{constructor(){super(...arguments),this.type=L.Text}get nodeType(){return 3}}class Gn extends os{constructor(){super(...arguments),this.type=L.Comment}get nodeType(){return 8}}class Kn extends os{constructor(t,u){super(u),this.name=t,this.type=L.Directive}get nodeType(){return 1}}class ls extends zn{constructor(t){super(),this.children=t}get firstChild(){var t;return(t=this.children[0])!==null&&t!==void 0?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}}class Qn extends ls{constructor(){super(...arguments),this.type=L.CDATA}get nodeType(){return 4}}class Nu extends ls{constructor(){super(...arguments),this.type=L.Root}get nodeType(){return 9}}class Zn extends ls{constructor(t,u,s=[],n=t==="script"?L.Script:t==="style"?L.Style:L.Tag){super(s),this.name=t,this.attribs=u,this.type=n}get nodeType(){return 1}get tagName(){return this.name}set tagName(t){this.name=t}get attributes(){return Object.keys(this.attribs).map(t=>{var u,s;return{name:t,value:this.attribs[t],namespace:(u=this["x-attribsNamespace"])===null||u===void 0?void 0:u[t],prefix:(s=this["x-attribsPrefix"])===null||s===void 0?void 0:s[t]}})}}function zc(e){return Hc(e)}function Gc(e){return e.type===L.CDATA}function Kc(e){return e.type===L.Text}function Qc(e){return e.type===L.Comment}function Zc(e){return e.type===L.Directive}function Jc(e){return e.type===L.Root}function Jn(e,t=!1){let u;if(Kc(e))u=new Lu(e.data);else if(Qc(e))u=new Gn(e.data);else if(zc(e)){const s=t?yu(e.children):[],n=new Zn(e.name,{...e.attribs},s);s.forEach(r=>r.parent=n),e.namespace!=null&&(n.namespace=e.namespace),e["x-attribsNamespace"]&&(n["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(n["x-attribsPrefix"]={...e["x-attribsPrefix"]}),u=n}else if(Gc(e)){const s=t?yu(e.children):[],n=new Qn(s);s.forEach(r=>r.parent=n),u=n}else if(Jc(e)){const s=t?yu(e.children):[],n=new Nu(s);s.forEach(r=>r.parent=n),e["x-mode"]&&(n["x-mode"]=e["x-mode"]),u=n}else if(Zc(e)){const s=new Kn(e.name,e.data);e["x-name"]!=null&&(s["x-name"]=e["x-name"],s["x-publicId"]=e["x-publicId"],s["x-systemId"]=e["x-systemId"]),u=s}else throw new Error(`Not implemented yet: ${e.type}`);return u.startIndex=e.startIndex,u.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(u.sourceCodeLocation=e.sourceCodeLocation),u}function yu(e){const t=e.map(u=>Jn(u,!0));for(let u=1;u<t.length;u++)t[u].prev=t[u-1],t[u-1].next=t[u];return t}const Bs={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};class jc{constructor(t,u,s){this.dom=[],this.root=new Nu(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof u=="function"&&(s=u,u=Bs),typeof t=="object"&&(u=t,t=void 0),this.callback=t??null,this.options=u??Bs,this.elementCB=s??null}onparserinit(t){this.parser=t}onreset(){this.dom=[],this.root=new Nu(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(t){this.handleCallback(t)}onclosetag(){this.lastNode=null;const t=this.tagStack.pop();this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(t)}onopentag(t,u){const s=this.options.xmlMode?L.Tag:void 0,n=new Zn(t,u,void 0,s);this.addNode(n),this.tagStack.push(n)}ontext(t){const{lastNode:u}=this;if(u&&u.type===L.Text)u.data+=t,this.options.withEndIndices&&(u.endIndex=this.parser.endIndex);else{const s=new Lu(t);this.addNode(s),this.lastNode=s}}oncomment(t){if(this.lastNode&&this.lastNode.type===L.Comment){this.lastNode.data+=t;return}const u=new Gn(t);this.addNode(u),this.lastNode=u}oncommentend(){this.lastNode=null}oncdatastart(){const t=new Lu(""),u=new Qn([t]);this.addNode(u),t.parent=u,this.lastNode=t}oncdataend(){this.lastNode=null}onprocessinginstruction(t,u){const s=new Kn(t,u);this.addNode(s)}handleCallback(t){if(typeof this.callback=="function")this.callback(t,this.dom);else if(t)throw t}addNode(t){const u=this.tagStack[this.tagStack.length-1],s=u.children[u.children.length-1];this.options.withStartIndices&&(t.startIndex=this.parser.startIndex),this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),u.children.push(t),s&&(t.prev=s,s.next=t),t.parent=u,this.lastNode=null}}function eo(e,t){const u=new jc(void 0,t);return new Wc(u,t).end(e),u.root}const jn=e=>{let t="";return e.italic&&(t="italic "),e.bold&&(t+="bold "),`${t}${e.size}px '${e.font}',sans-serif`},Pu=(e,t)=>{ot(0);const u=e.lineTable.length;Pe.font=jn(t);const s=Pe.measureText(""),n={mode:"break",text:"",x:0,y:0,w:0,h:s.fontBoundingBoxAscent+s.fontBoundingBoxDescent,line:u,textFormat:t.toObject()};e.heightTable[u]=0,e.ascentTable[u]=0,e.widthTable[u]=0,e.lineTable.push(n),e.textTable.push(n)},to=e=>{const t=e.heightTable.length-1;for(let u=1;u<t;++u){if(e.heightTable[u]>0)continue;const n=e.lineTable[u];n&&(e.heightTable[u]=n.h=e.heightTable[u-1])}},er=e=>{let t=0;return e.leftMargin&&(t+=e.leftMargin),e.rightMargin&&(t+=e.rightMargin),t},uo=(e,t,u,s)=>{let n=u.lineTable.length-1;const r=s.width-er(t)-4;for(let a=0;a<e.length;++a){const i=s.textFormats?s.textFormats.shift():t,c=e[a],o={mode:"text",text:c,x:0,y:0,w:0,h:0,line:n,textFormat:i.toObject()};Pe.font=jn(i);const d=Pe.measureText(c||""),l=i.letterSpacing?d.width+i.letterSpacing:d.width,h=i.leading?d.fontBoundingBoxAscent+d.fontBoundingBoxDescent+i.leading:d.fontBoundingBoxAscent+d.fontBoundingBoxDescent;if(o.x=0,o.y=d.fontBoundingBoxAscent,o.w=l,o.h=h,ot(yt()+l),s.wordWrap&&yt()>r){ot(l),n++,o.line=n;const b={mode:"wrap",text:"",x:0,y:0,w:0,h:0,line:n,textFormat:i.toObject()};let f=1,p=!0;const $=/[0-9a-zA-Z?!;:.,?!。、;:〜]/g;for(;;){const m=u.textTable.length-f;if(0>=m){p=!1,f=0;break}const R=u.textTable[m];if(!R){p=!1,f=0;break}if(R.mode!=="text"){p=!1;break}if(R.text===" "){f--;break}if(!R.text.match($)){f--;break}f++}if(u.widthTable[n]=0,u.heightTable[n]=0,u.ascentTable[n]=0,f>0&&p){const m=u.textTable.length-f;u.textTable.splice(m,0,b),u.lineTable.push(b);const R=n-1;u.widthTable[R]=0,u.heightTable[R]=0,u.ascentTable[R]=0;for(let S=0;S<m;++S){const k=u.textTable[S];k&&k.line===R&&k.mode==="text"&&(u.widthTable[R]+=k.w,u.heightTable[R]=Math.max(u.heightTable[R],k.h),u.ascentTable[R]=Math.max(u.ascentTable[R],k.y))}ot(0);for(let S=m+1;S<u.textTable.length;++S){const k=u.textTable[S];k.line=n,ot(yt()+k.w)}}else u.textTable.push(b),u.lineTable.push(b)}u.widthTable[n]=yt(),u.heightTable[n]=Math.max(u.heightTable[n],h),u.ascentTable[n]=Math.max(u.ascentTable[n],o.y),u.textTable.push(o)}},so=e=>{const t=e.trim().split(";"),u=[];for(let s=0;s<t.length;++s){const n=t[s];if(!n)continue;const r=n.split(":"),a=r[0].trim(),i=r[1].trim();switch(a){case"font-size":u.push({name:"size",value:parseInt(i)});break;case"font-family":u.push({name:"face",value:i.replace(/'|"/g,"")});break;case"letter-spacing":u.push({name:"letterSpacing",value:parseInt(i)});break;case"margin-bottom":u.push({name:"leading",value:parseInt(i)});break;case"margin-left":u.push({name:"leftMargin",value:parseInt(i)});break;case"margin-right":u.push({name:"rightMargin",value:parseInt(i)});break;case"color":case"align":u.push({name:a,value:i});break;case"text-decoration":case"font-weight":case"font-style":u.push({name:i,value:!0});break}}return u},Bu=(e,t,u)=>{for(let s=0;s<e.length;++s){const n=e[s];switch(n.name){case"style":Bu(so(n.value),t,u);break;case"align":t.align=n.value;break;case"face":t.font=n.value;break;case"size":t.size=+n.value,u.subFontSize&&(t.size-=u.subFontSize,1>t.size&&(t.size=1));break;case"color":t.color=Qe(n.value);break;case"letterSpacing":t.letterSpacing=parseInt(n.value);break;case"leading":t.leading=parseInt(n.value);break;case"leftMargin":t.leftMargin=parseInt(n.value);break;case"rightMargin":t.rightMargin=parseInt(n.value);break;case"underline":t.underline=!0;break;case"bold":t.bold=!0;break;case"italic":t.italic=!0;break}}},Du=(e,t,u,s)=>{for(let n=0;n<e.children.length;++n){const r=e.children[n];if(r.nodeType===3){uo(r.nodeValue||"",t,u,s);continue}const a=t.clone();switch(r.name.toUpperCase()){case"DIV":case"P":Bu(r.attributes,a,s),s.multiline&&Pu(u,a),Du(r,a,u,s);continue;case"U":a.underline=!0;break;case"B":a.bold=!0;break;case"I":a.italic=!0;break;case"FONT":case"SPAN":Bu(r.attributes,a,s);break;case"BR":if(!s.multiline)continue;Pu(u,a);break}Du(r,a,u,s)}},no=(e,t,u)=>{const s=new Rc;if(!e)return s;const n=e.trim().replace(/\r?\n/g,"").replace(/\t/g,""),r=t.clone();return u.subFontSize&&u.subFontSize>0&&r.size&&(r.size-=u.subFontSize,1>r.size&&(r.size=1)),Pu(s,r),Du(eo(n),r,s,u),to(s),s},q=(e,t=0)=>(e.$textData||(e.$textData=no(e.htmlText,e.defaultTextFormat,{width:e.width,multiline:e.multiline,wordWrap:e.wordWrap,subFontSize:t,textFormats:e.$textFormats})),e.$textData),_=e=>{e.changed=!0;const t=e.parent;t&&!t.changed&&_(t)},_u=e=>{e.$textData=null,_(e),e.uniqueKey!==""&&O.has(e.uniqueKey)&&(O.removeById(e.uniqueKey),O.$removeIds.push(+e.uniqueKey))},ro=e=>{if(_(e),e.autoSize==="none"){e.xMin=e.bounds.xMin,e.yMin=e.bounds.yMin,e.xMax=e.bounds.xMax,e.yMax=e.bounds.yMax;return}const t=e.defaultTextFormat,u=e.textWidth+4+er(t);if(e.wordWrap)e.xMin=e.bounds.xMin,e.xMax=e.bounds.xMax;else switch(e.autoSize){case"left":e.xMax=u+e.xMin;break;case"center":e.xMax=u+e.xMin;break;case"right":e.xMax=e.bounds.xMax-(e.bounds.xMax-e.bounds.xMin-(u-e.bounds.xMin));break}e.yMax=e.textHeight+e.bounds.yMin+4},ao=e=>{let t=0;const u=q(e);for(let n=0;n<u.textTable.length;++n){const r=u.textTable[n];t=Math.max(t,r.textFormat.size||0)}let s=1;if(e.width&&e.textWidth)for(;t>s&&e.textWidth+4>e.width;)_u(e),q(e,s++);if(e.height&&e.textHeight)for(;t>s&&e.textHeight+4>e.height;)_u(e),q(e,s++);_(e)},Te=e=>{_u(e),q(e),e.autoSize==="none"&&e.autoFontSize&&ao(e),ro(e)},io=(e,t)=>{const u=q(e);if(2>u.textTable.length)return;let s=2,n=0;for(let h=1;h<u.textTable.length;++h){const b=u.textTable[h];if(!b)continue;let f=!1;if(b.mode==="text"&&(f=!0,s+=b.w),n>=t){n=h;break}b.mode==="break"&&(f=!0,s=2),f&&n++}const r=u.textTable[n];if(!r)return;e.$scrollX=e.$scrollY=0;const a=r.line;let i=0;for(let h=0;h<=a;++h)i+=u.heightTable[h];const c=Math.abs(e.yMax-e.yMin);let o=0;for(let h=a;h>-1;--h){const b=u.heightTable[h];if(c<o+b)break;o+=b}if(i>c){const h=(e.textHeight-c)/c;e.$scrollY=Math.max(0,Math.min((i-o)/h,c))}const d=Math.abs(e.xMax-e.xMin);let l=0;for(let h=n;h>0;--h){const b=u.textTable[h];if(b.mode==="text"){if(d<l+b.w)break;l+=b.w}}if(s>d){const h=(e.textWidth-d)/d;e.$scrollX=Math.max(0,Math.min((s-l)/h,d+.5))}_(e)},ae=()=>{const e=_t();e!==void 0&&clearTimeout(e),Hn(void 0)},co=window.devicePixelRatio,oo=e=>{const t=e.localToGlobal(new J),u=e.$textData;if(u){const n=u.textTable[e.focusIndex];if(n){for(let a=e.focusIndex-1;a>-1;--a){const i=u.textTable[a];if(!i||i.line!==n.line)break;t.x+=i.w}const r=n.mode==="break"?n.line-1:n.line;for(let a=0;a<r;++a)t.y+=u.heightTable[a]}}const s=T.rendererScale/co;ie.style.left=`${ze.x+t.x*s}px`,ie.style.top=`${ze.y+t.y*s}px`},le=e=>{e.focusVisible=!e.focusVisible,_(e),Hn(setTimeout(()=>le(e),500)),oo(e)},lo=(e,t)=>{e.willTrigger(t)&&e.dispatchEvent(new De(t)),ie.value="",e.focus?(setTimeout(()=>{ie.focus()},300),_t()===void 0&&(e.focusIndex===-1&&(e.focusIndex=1,e.selectIndex=-1),le(e))):(e.focusIndex=-1,e.selectIndex=-1,e.focusVisible=!1,ae(),ie.blur()),_(e)},ho=(e,t,u,s)=>e/s*u+t,fo=(e,t,u,s)=>(e/=s)*e*u+t,bo=(e,t,u,s)=>-(e/=s)*(e-2)*u+t,$o=(e,t,u,s)=>(e/=s/2)<1?e*e*u/2+t:-((e-=1)*(e-2)-1)*u/2+t,xo=(e,t,u,s)=>(e/=s)*e*e*u+t,go=(e,t,u,s)=>(e/=s,(--e*e*e+1)*u+t),mo=(e,t,u,s)=>(e/=s/2)<1?e*e*e*u/2+t:((e-=2)*e*e+2)*u/2+t,po=(e,t,u,s)=>(e/=s)*e*e*e*u+t,To=(e,t,u,s)=>(e/=s,(--e*e*e*e-1)*-u+t),Eo=(e,t,u,s)=>(e/=s/2)<1?e*e*e*e*u/2+t:((e-=2)*e*e*e-2)*-u/2+t,yo=(e,t,u,s)=>(e/=s)*e*e*e*e*u+t,wo=(e,t,u,s)=>(e/=s,(--e*e*e*e*e+1)*u+t),Mo=(e,t,u,s)=>(e/=s/2)<1?e*e*e*e*e*u/2+t:((e-=2)*e*e*e*e+2)*u/2+t,Ao=(e,t,u,s)=>-u*Math.cos(e/s*(Math.PI/2))+u+t,vo=(e,t,u,s)=>u*Math.sin(e/s*(Math.PI/2))+t,Io=(e,t,u,s)=>-u/2*(Math.cos(Math.PI*e/s)-1)+t,So=(e,t,u,s)=>u*Math.pow(2,10*(e/s-1))+t,Ro=(e,t,u,s)=>u*(-Math.pow(2,-10*e/s)+1)+t,ko=(e,t,u,s)=>(e/=s/2)<1?u/2*Math.pow(2,10*(e-1))+t:u/2*(-Math.pow(2,-10*(e-1))+2)+t,Oo=(e,t,u,s)=>(1-Math.sqrt(1-(e/=s)*e))*u+t,Fo=(e,t,u,s)=>(e/=s,Math.sqrt(1- --e*e)*u+t),Co=(e,t,u,s)=>(e/=s*2)<1?(Math.sqrt(1-e*e)-1)/-2*u+t:(Math.sqrt(1-(e-=2)*e)+1)/2*u+t,Lo=(e,t,u,s)=>(2.70158*(e/=s)*e*e-1.70158*e*e)*u+t,No=(e,t,u,s)=>(1+2.70158*Math.pow((e/=s)-1,3)+1.70158*Math.pow(e-1,2))*u+t,Po=(e,t,u,s)=>{let n=1.70158;return(e/=s/2)<1?e*e*(((n*=1.525)+1)*e-n)*u/2+t:((e-=2)*e*(((n*=1.525)+1)*e+n)+2)*u/2+t},Bo=(e,t,u,s)=>(e/=s)===0?t:e===1?u+t:-Math.pow(2,(e*=10)-10)*Math.sin((e-10.75)*(2*Math.PI/3))*u+t,Do=(e,t,u,s)=>(e/=s)===0?t:e===1?u+t:(Math.pow(2,-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1)*u+t,_o=(e,t,u,s)=>(e/=s)===0?t:e===1?u+t:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*(2*Math.PI/4.5)))/2*u+t:(Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*(2*Math.PI/4.5))/2+1)*u+t,Uo=(e,t,u,s)=>(e/=s)<1/2.75?7.5625*e*e*u+t:e<2/2.75?(7.5625*(e-=1.5/2.75)*e+.75)*u+t:e<2.5/2.75?(7.5625*(e-=2.25/2.75)*e+.9375)*u+t:(7.5625*(e-=2.625/2.75)*e+.984375)*u+t,qo=(e,t,u,s)=>u-_e.outBounce(s-e,0,u,s)+t,Xo=(e,t,u,s)=>e<s/2?_e.inBounce(e*2,t,u/2,s):_e.outBounce(e*2-s,t+u/2,u/2,s);class _e{static linear(t,u,s,n){return ho(t,u,s,n)}static inQuad(t,u,s,n){return fo(t,u,s,n)}static outQuad(t,u,s,n){return bo(t,u,s,n)}static inOutQuad(t,u,s,n){return $o(t,u,s,n)}static inCubic(t,u,s,n){return xo(t,u,s,n)}static outCubic(t,u,s,n){return go(t,u,s,n)}static inOutCubic(t,u,s,n){return mo(t,u,s,n)}static inQuart(t,u,s,n){return po(t,u,s,n)}static outQuart(t,u,s,n){return To(t,u,s,n)}static inOutQuart(t,u,s,n){return Eo(t,u,s,n)}static inQuint(t,u,s,n){return yo(t,u,s,n)}static outQuint(t,u,s,n){return wo(t,u,s,n)}static inOutQuint(t,u,s,n){return Mo(t,u,s,n)}static inSine(t,u,s,n){return Ao(t,u,s,n)}static outSine(t,u,s,n){return vo(t,u,s,n)}static inOutSine(t,u,s,n){return Io(t,u,s,n)}static inExpo(t,u,s,n){return So(t,u,s,n)}static outExpo(t,u,s,n){return Ro(t,u,s,n)}static inOutExpo(t,u,s,n){return ko(t,u,s,n)}static inCirc(t,u,s,n){return Oo(t,u,s,n)}static outCirc(t,u,s,n){return Fo(t,u,s,n)}static inOutCirc(t,u,s,n){return Co(t,u,s,n)}static inBack(t,u,s,n){return Lo(t,u,s,n)}static outBack(t,u,s,n){return No(t,u,s,n)}static inOutBack(t,u,s,n){return Po(t,u,s,n)}static inElastic(t,u,s,n){return Bo(t,u,s,n)}static outElastic(t,u,s,n){return Do(t,u,s,n)}static inOutElastic(t,u,s,n){return _o(t,u,s,n)}static outBounce(t,u,s,n){return Uo(t,u,s,n)}static inBounce(t,u,s,n){return qo(t,u,s,n)}static inOutBounce(t,u,s,n){return Xo(t,u,s,n)}}const Yo=e=>{cancelAnimationFrame(e.$timerId),e.hasEventListener(xe.STOP)&&e.dispatchEvent(new xe(xe.STOP)),e.entries=null,e.stopFlag=!0},tr=e=>{const t=[];for(const[u,s]of Object.entries(e))t.push({name:u,value:typeof s=="number"?s:tr(s)});return t},ur=(e,t,u,s,n)=>{for(let r=0;r<n.length;++r){const a=n[r];if(!a)continue;const i=a.name;if(!(i in t)||!(i in s))continue;if(typeof a.value!="number"){ur(e,t[i],u[i],s[i],a.value);continue}const c=u[i];e.duration>e.currentTime?t[i]=e.ease(e.currentTime,c,s[i]-c,e.duration):t[i]=s[i]}},sr=(e,t)=>e.stopFlag||!e.entries?-1:(e.currentTime=(t-e.startTime)/1e3,ur(e,e.target,e.from,e.to,e.entries),e.hasEventListener(xe.UPDATE)&&e.dispatchEvent(new xe(xe.UPDATE)),e.currentTime>=e.duration?(e.hasEventListener(xe.COMPLETE)&&e.dispatchEvent(new xe(xe.COMPLETE)),e.nextJob&&e.nextJob.start(),-1):requestAnimationFrame(u=>{sr(e,u)})),Ds=e=>{e.stopFlag||(e.entries=tr(e.from),e.entries&&(e.startTime=performance.now(),e.$timerId=sr(e,e.startTime)))},Vo=e=>{cancelAnimationFrame(e.$timerId),e.stopFlag=!1,e.delay?setTimeout(()=>{Ds(e)},e.delay*1e3):Ds(e)};class Wo extends je{target;entries;startTime;stopFlag;$timerId;delay;duration;ease;from;to;currentTime;nextJob;constructor(t,u,s,n=0,r=1,a=null){super(),this.target=t,this.from=u,this.to=s,this.delay=n,this.duration=r,this.ease=a||_e.linear,this.currentTime=0,this.nextJob=null,this.entries=null,this.startTime=0,this.stopFlag=!1,this.$timerId=-1}chain(t){return this.nextJob=t,t}start(){Vo(this)}stop(){Yo(this)}}class hs{static add(t,u,s,n=0,r=1,a=null){return new Wo(t,u,s,n,r,a)}}const Ho=(e,t)=>{if(!e.scrollEnabled||e.autoSize!=="none"||e.yScrollShape.hasLocalVariable("job"))return;const u=e.width;if(t=ht(t,0,u,0),e.scrollX!==t){if(e.textWidth>u){_(e);const s=e.xScrollShape;s.width=u*u/e.textWidth;const n=e.parent;if(n){s.hasLocalVariable("job")&&s.getLocalVariable("job").stop(),s.alpha=.9,s.x=e.x+1+(u-1-s.width)/(u-1)*(t-1),s.y=e.y+e.height-s.height-.5,n.addChildAt(s,n.getChildIndex(e)+1);const r=hs.add(s,{alpha:.9},{alpha:0},.5,.2,_e.outQuad);r.addEventListener(g.COMPLETE,a=>{const i=a.target.target;i.deleteLocalVariable("job"),i.parent&&i.parent.removeChild(i)}),r.start(),s.setLocalVariable("job",r)}e.$scrollX=t}e.willTrigger(g.SCROLL)&&e.dispatchEvent(new g(g.SCROLL,!0))}},zo=(e,t)=>{if(!e.scrollEnabled||e.autoSize!=="none"||!e.multiline&&!e.wordWrap||e.xScrollShape.hasLocalVariable("job"))return;const u=e.height;if(t=ht(t,0,u,0),e.scrollY!==t){if(e.textHeight>u){_(e);const s=e.yScrollShape;s.height=u*u/e.textHeight;const n=e.parent;if(n){s.hasLocalVariable("job")&&s.getLocalVariable("job").stop(),s.alpha=.9,s.x=e.x+e.width-s.width-.5,s.y=e.y+.5+(u-1-s.height)/(u-1)*(t-1),n.addChildAt(s,n.getChildIndex(e)+1);const r=hs.add(s,{alpha:.9},{alpha:0},.5,.2,_e.outQuad);r.addEventListener(g.COMPLETE,a=>{const i=a.target.target;i.deleteLocalVariable("job"),i.parent&&i.parent.removeChild(i)}),r.start(),s.setLocalVariable("job",r),e.$scrollY=t}}e.willTrigger(g.SCROLL)&&e.dispatchEvent(new g(g.SCROLL,!0))}},Go=e=>{let t="";const u=q(e);for(let s=1;s<u.textTable.length;++s){const n=u.textTable[s];if(n)switch(n.mode){case"text":t+=n.text;break;case"break":t+="\r";break;default:continue}}return t},Ko=(e,t)=>{let u="";const s=q(e);for(let n=1;n<s.textTable.length;n++){const r=s.textTable[n];if(r){if(r.line>t)break;r.line===t&&r.mode==="text"&&(u+=r.text)}}return u},Qo=(e,t,u,s)=>{if(0>u||u>s)return;const n=e.text,r=u?n.slice(0,u):"";e.text=r+t+n.slice(s,n.length)},Zo=async e=>{if(e.focusIndex===-1||e.selectIndex===-1)return;let t="";const u=Math.min(e.focusIndex,e.selectIndex),s=Math.max(e.focusIndex,e.selectIndex)+1,n=q(e);for(let r=u;r<s;++r){const a=n.textTable[r];if(a)switch(a.mode){case"text":t+=a.text;break;case"break":t+=`
660
- `;break}}await navigator.clipboard.writeText(t)},Jo=async e=>{const t=await navigator.clipboard.readText();t===""||e.focusIndex===-1||e.insertText(t)},ds=e=>{if(e.compositionStartIndex>-1)return;let t=0,u=0;if(e.selectIndex>-1)t=Math.min(e.focusIndex,e.selectIndex),u=Math.max(e.focusIndex,e.selectIndex)+1,e.focusIndex=t;else{if(2>e.focusIndex)return;e.focusIndex--}const s=q(e),n=s.textTable[e.focusIndex];n&&n.mode==="wrap"&&e.focusIndex--;const r=[];let a="";for(let i=1;i<s.textTable.length;++i){const c=s.textTable[i];if(c&&!(e.focusIndex===i||t<=i&&u>i))switch(c.mode){case"break":r.push(new se(...Object.values(c.textFormat))),a+=`
661
- `;break;case"text":r.push(new se(...Object.values(c.textFormat))),a+=c.text;break;default:continue}}if(s.textTable.length===e.focusIndex&&(r.pop(),a=a.slice(0,-1)),e.selectIndex=-1,!a)e.text="",e.focusIndex=1;else{const i=e.textWidth,c=e.textHeight;if(e.$textFormats=r,e.text=a,e.scrollX>0){const o=e.textWidth,d=e.width;switch(!0){case d>o:e.$scrollX=0;break;case i!==o:e.$scrollX-=(i-o)/(o/d);break}}if(e.scrollY>0){const o=e.textHeight,d=e.height;switch(!0){case d>o:e.$scrollY=0;break;case c!==o:e.$scrollY-=(c-o)/(o/d);break}}e.$textFormats=null}},nr=(e,t)=>{if(e.focusIndex===-1||e.compositionStartIndex>-1)return;e.selectIndex>-1&&ds(e);const u=q(e);if(2>u.textTable.length){e.focusIndex=2,e.appendText(t);return}const s=[];let n="";for(let r=1;r<u.textTable.length;++r){const a=u.textTable[r];if(a){if(e.focusIndex===r)for(let i=0;i<t.length;++i)s.push(new se(...Object.values(a.textFormat))),n+=t[i];switch(a.mode){case"break":s.push(new se(...Object.values(a.textFormat))),n+=`
662
- `;break;case"text":s.push(new se(...Object.values(a.textFormat))),n+=a.text;break;default:continue}}}if(u.textTable.length===e.focusIndex){let r;if(u.textTable.length){const a=u.textTable[u.textTable.length-1];r=new se(...Object.values(a.textFormat))}else r=e.defaultTextFormat,e.focusIndex++;for(let a=0;a<t.length;++a)s.push(new se(...Object.values(r.toObject()))),n+=t[a]}e.$textFormats=s,e.text=n,e.$textFormats=null,e.focusIndex+=t.length,e.selectIndex=-1,ie.value=""},_s=e=>{if(e.selectIndex===-1)return;const t=q(e);if(2>t.textTable.length)return;const u=t.textTable[e.selectIndex];if(!u)return;const s=u.mode==="text"?u.line:u.line-1,n=e.height,r=(e.textHeight-n)/n;let a=-e.scrollY*r-2,i=0;for(let f=0;f<t.heightTable.length&&(a+=t.heightTable[f],!(a>n));++f)i++;a=-e.scrollY*r-2;let c=0;for(let f=0;f<t.heightTable.length&&(a+=t.heightTable[f],!(a>0));++f)c++;c>=u.line&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY-=t.heightTable[u.line]/r),u.line>=i&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY+=t.heightTable[u.line]/r);const o=e.width,d=(e.textWidth-o)/o;let l=2,h=e.scrollX*d-2+o;for(let f=1;e.selectIndex>=f;++f){const p=t.textTable[f];if(!p||p.line>s)break;if(p.line===s&&(e.selectIndex!==f&&(l+=p.w),h-=p.w,!(h>0))){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX+=p.w/d;break}}e.scrollX*d-2>l&&(e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((l-2)/e.textWidth))},jo=(e,t,u,s=!1)=>{if(e.type!=="input")return;const n=q(e);if(2>n.textTable.length){e.focusIndex=1,e.selectIndex=-1,_t()===void 0&&le(e);return}const r=e.width,a=e.height;let i=0;e.scrollX>0&&(i+=e.scrollX*(e.textWidth-r)/r);let c=0;e.scrollY>0&&(c+=e.scrollY*(e.textHeight-a)/a);const o=e.globalToLocal(new J(t,u)),d=o.x+i,l=o.y+c;let h=2,b=2,f=b+n.heightTable[0];for(let p=1;p<n.textTable.length;++p){const $=n.textTable[p];if($){switch($.mode){case"break":case"wrap":if(d>h&&l>b&&f>l&&r>d){const m=p;s?e.selectIndex!==m&&(e.selectIndex=m,e.focusVisible&&(e.focusVisible=!1,ae()),_s(e),_(e)):(e.focusIndex!==m||e.selectIndex>-1)&&(e.focusIndex=m,e.selectIndex=-1,_(e));return}h=2,b+=n.heightTable[$.line-1],f=b+n.heightTable[$.line];break;case"text":if(d>h&&l>b&&f>l&&h+$.w>d){let m=p;if(s)e.focusIndex>m?e.focusIndex===m+1?h+$.w/2<d&&(m=-1):h+$.w/2<d&&(m+=1):e.focusIndex===m?h+$.w/2>d&&(m=-1):h+$.w/2>d&&(m-=1),e.selectIndex!==m&&(e.selectIndex=m,e.selectIndex>-1&&(e.focusVisible=!1,ae()),_s(e),_(e));else{if(h+$.w/2<d){const R=n.textTable[m+1];(!R||R.mode==="text")&&(m+=1)}(e.focusIndex!==m||e.selectIndex>-1)&&(e.focusIndex=m,e.selectIndex=-1,_(e))}return}if(p===n.textTable.length-1&&d>h&&l>b&&f>l&&r>d){const m=n.textTable.length;s?e.selectIndex!==m&&(e.selectIndex=m,e.focusVisible&&(e.focusVisible=!1,ae()),_(e)):(e.focusIndex!==m||e.selectIndex>-1)&&(e.focusIndex=m,e.selectIndex=-1,_(e));return}h+=$.w;break}if(!s)e.focusIndex=n.textTable.length,e.selectIndex=-1,_t()===void 0?le(e):_(e);else{let m=0;for(let R=0;n.heightTable.length>R;++R)m+=n.heightTable[R];(l>m||2>l)&&(e.selectIndex=2>l?1:n.textTable.length,e.focusVisible&&(e.focusVisible=!1,ae()),_(e))}}}},e0=(e,t)=>{if(e.focusIndex===-1)return;const u=q(e);if(2>u.textTable.length)return;const s=u.textTable[e.focusIndex];if(!s)return;const n=s.mode==="text"?s.line:s.line-1;if(n===u.lineTable.length-1){t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,e.focusVisible=!1,e.focusIndex=u.textTable.length;const h=e.width,b=(e.textWidth-h)/h;let f=0;for(let p=1;e.focusIndex>=p;++p){const $=u.textTable[p];if(!$||$.line>n)break;$.line===n&&(f+=$.w)}e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=(f-h)/b,ae(),le(e);return}const r=e.height,a=(e.textHeight-r)/r;let i=-e.scrollY*a-2,c=0;for(let h=0;h<u.heightTable.length&&(i+=u.heightTable[h],!(i>r));++h)c++;let o=2;for(let h=1;h<u.textTable.length;++h){const b=u.textTable[h];if(b){if(e.focusIndex===h){b.mode==="text"&&(o+=b.w/2);break}if(b.line>n)break;b.line!==n||b.mode!=="text"||(o+=b.w)}}let d=2;const l=n+1;for(let h=1;h<u.textTable.length;++h){const b=u.textTable[h];if(b){if(b.line>l){t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,b.line>=c&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY+=u.heightTable[b.line]/a),e.focusVisible=!1,e.focusIndex=b.mode==="text"?h-1:h,e.scrollX&&d<o&&(e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((d-2)/e.textWidth)),ae(),le(e);return}if(!(b.line!==l||b.mode!=="text")&&(d+=b.w,d>o)){if(t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===h-1&&(e.selectIndex=-1):e.selectIndex=-1,b.line>=c&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY+=u.heightTable[b.line]/a),e.scrollX){const f=e.width,p=(e.textWidth-f)/f;e.scrollX*p-2>d&&(e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((d-2)/e.textWidth))}e.focusVisible=!1,e.focusIndex=h,ae(),le(e);return}}}t?e.selectIndex===-1&&(e.selectIndex=e.focusIndex):e.selectIndex=-1,e.focusVisible=!1,e.focusIndex=u.textTable.length,ae(),le(e)},t0=(e,t)=>{if(e.focusIndex===-1)return;const u=q(e);if(2>u.textTable.length)return;const s=u.textTable.length===e.focusIndex?e.focusIndex-1:e.focusIndex,n=u.textTable[s];if(!n||!n.line){t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.focusVisible=!1,e.focusIndex=1,e.scrollX=0,ae(),le(e);return}const r=n.mode==="text"?n.line:n.line-1,a=e.height,i=(e.textHeight-a)/a;let c=0,o=-e.scrollY*i-2;for(let b=0;b<u.heightTable.length&&(o+=u.heightTable[b],!(o>0));++b)c++;let d=2;for(let b=1;b<u.textTable.length;++b){const f=u.textTable[b];if(f){if(e.focusIndex===b){f.mode==="text"&&(d+=f.w/2);break}if(f.line>r)break;f.line!==r||f.mode!=="text"||(d+=f.w)}}let l=2;const h=r-1;for(let b=1;b<u.textTable.length;++b){const f=u.textTable[b];if(f){if(f.line>h){t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,c>=f.line&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY-=u.heightTable[f.line]/i),e.scrollX&&(e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((l-2)/e.textWidth)),e.focusVisible=!1,e.focusIndex=f.mode==="text"?b-1:b,ae(),le(e);return}if(!(f.line!==h||f.mode!=="text")&&(l+=f.w,l>d)){t?e.selectIndex===-1?e.selectIndex=e.focusIndex-1:e.selectIndex===b+1&&(e.selectIndex=-1):e.selectIndex=-1,c>f.line&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY-=u.heightTable[f.line]/i),e.focusVisible=!1,e.focusIndex=b,ae(),le(e);return}}}},u0=(e,t)=>{if(!e.focusIndex)return;const u=q(e);if(u.textTable.length&&e.focusIndex<2){e.focusIndex=1;return}e.focusIndex--,t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1;const s=u.textTable[e.focusIndex];if(s){const n=s.mode==="text"?s.line:s.line-1,r=e.height,a=(e.textHeight-r)/r;let i=-e.scrollY*a-2,c=0;for(let d=0;d<u.heightTable.length&&(i+=u.heightTable[d],!(i>0));++d)c++;c>n&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY-=u.heightTable[s.line]/a);const o=u.textTable[e.focusIndex+1];if(o){const d=o.mode==="text"?o.line:o.line-1;let l=2;for(let p=1;e.focusIndex>p;++p){const $=u.textTable[p];if(!$||$.line>n)break;$.line===n&&(l+=$.w)}const h=e.width,b=(e.textWidth-h)/h,f=e.scrollX*b-2;if(l>h&&o&&n<d){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width;return}if(f>l){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((l-2)/e.textWidth);return}}}e.focusVisible=!1,ae(),le(e)},s0=(e,t)=>{const u=q(e);if(u.textTable.length===e.focusIndex)return;t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,e.focusVisible=!1,e.focusIndex++,ae(),le(e);const s=u.textTable[e.focusIndex];if(s){const n=s.mode==="text"?s.line:s.line-1,r=e.height,a=(e.textHeight-r)/r;let i=-e.scrollY*a-2,c=0;for(let f=0;f<u.heightTable.length&&(i+=u.heightTable[f],!(i>r));++f)c++;n>=c&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY+=u.heightTable[n]/a);const o=u.textTable[e.focusIndex-1],d=o.mode==="text"?o.line:o.line-1;if(o&&n>d){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=0;return}const l=e.width,h=(e.textWidth-l)/l;let b=e.scrollX*h-2+l;for(let f=1;e.focusIndex>=f;++f){const p=u.textTable[f];if(!p||p.line>n)break;if(p.line===n&&(b-=p.w,!(b>0))){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX+=p.w/h;break}}}},n0=(e,t)=>{if(e.focusIndex!==-1)switch(t.key){case"Backspace":case"Delete":e.deleteText();break;case"Enter":e.insertText(`
663
- `);break;case"ArrowLeft":u0(e,t.shiftKey);break;case"ArrowRight":s0(e,t.shiftKey);break;case"ArrowUp":t0(e,t.shiftKey);break;case"ArrowDown":e0(e,t.shiftKey);break;case"a":(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e.selectAll());break;case"c":(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e.copy());break;case"v":(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e.paste());break}},r0=e=>{const t=q(e);2>t.textTable.length||(e.selectIndex=1,e.focusIndex=t.textTable.length,_(e))},a0=(e,t)=>{const u=e.defaultTextFormat;switch(u.font=t.font,u.size=t.size,u.align=t.align,u.color=t.color,u.leading=t.leading,u.letterSpacing=t.letterSpacing,u.leftMargin=t.leftMargin,u.rightMargin=t.rightMargin,t.fontType){case 1:u.bold=!0;break;case 2:u.italic=!0;break;case 3:u.bold=!0,u.italic=!0;break}switch(e.defaultTextFormat=u,e.type=t.inputType,e.multiline=t.multiline,e.wordWrap=t.wordWrap,e.border=t.border,e.scrollEnabled=t.scroll,e.thickness=t.thickness,e.thicknessColor=t.thicknessColor,t.autoSize){case 1:e.autoSize=t.align;break;case 2:e.autoFontSize=!0;break}e.xMin=e.bounds.xMin=t.bounds.xMin,e.xMax=e.bounds.xMax=t.bounds.xMax,e.yMin=e.bounds.yMin=t.bounds.yMin,e.yMax=e.bounds.yMax=t.bounds.yMax+4,e.text=t.text};class Uu extends as{isText;$textData;_$isHTML;xMin;yMin;xMax;yMax;bounds;scrollEnabled;xScrollShape;yScrollShape;focusVisible;focusIndex;selectIndex;maxChars;restrict;type;compositionStartIndex;compositionEndIndex;$textFormats;$scrollX;$scrollY;cacheKey;cacheParams;_$background;_$backgroundColor;_$border;_$borderColor;_$htmlText;_$multiline;_$text;_$wordWrap;_$defaultTextFormat;_$rawHtmlText;_$autoSize;_$autoFontSize;_$focus;_$thickness;_$thicknessColor;_$stopIndex;constructor(){super(),this.isText=!0,this.$textData=null,this._$background=!1,this._$backgroundColor=16777215,this._$border=!1,this._$borderColor=0,this._$htmlText="",this._$multiline=!1,this._$text="",this._$wordWrap=!1,this.$scrollX=0,this.$scrollY=0,this.$textFormats=null,this.maxChars=0,this._$stopIndex=-1,this.compositionStartIndex=-1,this.compositionEndIndex=-1;const t=new se;Ic(t),this._$defaultTextFormat=t,this._$rawHtmlText="",this.xMin=0,this.yMin=0,this.xMax=100,this.yMax=100,this.bounds={xMin:0,xMax:this.xMax,yMin:0,yMax:this.yMax},this.restrict="",this._$isHTML=!1,this._$autoSize="none",this._$autoFontSize=!1,this.focusVisible=!1,this.focusIndex=-1,this.selectIndex=-1,this.scrollEnabled=!0,this.xScrollShape=new $t,this.xScrollShape.graphics.beginFill("#000",.3).drawRoundRect(0,0,3,3,3),this.xScrollShape.scale9Grid=new be(1.5,1.5,.1,.1),this.yScrollShape=new $t,this.yScrollShape.graphics.beginFill("#000",.3).drawRoundRect(0,0,3,3,3),this.yScrollShape.scale9Grid=new be(1.5,1.5,.1,.1),this.type="static",this._$focus=!1,this._$thickness=0,this._$thicknessColor=0,this.cacheKey=0,this.cacheParams=[0,0,0]}static get namespace(){return"next2d.display.TextField"}get namespace(){return"next2d.display.TextField"}get autoFontSize(){return this._$autoFontSize}set autoFontSize(t){t!==this._$autoFontSize&&(this._$autoFontSize=!!t,Te(this))}get autoSize(){return this._$autoSize}set autoSize(t){t!==this._$autoSize&&(this._$autoSize=t,Te(this))}get background(){return this._$background}set background(t){t!==this._$background&&(this._$background=!!t,_(this))}get backgroundColor(){return this._$backgroundColor}set backgroundColor(t){t=ht(Qe(t),0,16777215,16777215),t!==this._$backgroundColor&&(this._$backgroundColor=t,_(this))}get border(){return this._$border}set border(t){t!==this._$border&&(this._$border=!!t,_(this))}get borderColor(){return this._$borderColor}set borderColor(t){t=ht(Qe(t),0,16777215,0),t!==this._$borderColor&&(this._$borderColor=t,_(this))}get stopIndex(){return this._$stopIndex}set stopIndex(t){t|=0,this._$stopIndex!==t&&(this._$stopIndex=t,io(this,t))}get defaultTextFormat(){return this._$defaultTextFormat.clone()}set defaultTextFormat(t){this._$rawHtmlText="",this._$isHTML?this._$text="":this._$htmlText="",this._$defaultTextFormat=t,Te(this)}get focus(){return this._$focus}set focus(t){this._$focus!==t&&this.type==="input"&&(this._$focus=!!t,lo(this,this._$focus?De.FOCUS_IN:De.FOCUS_OUT))}get htmlText(){if(this._$htmlText)return this._$htmlText;const t=Sc(this.defaultTextFormat);return this._$htmlText=`<span style="${t}">${this._$text.replace(/\n/g,"<br>")}</span>`,this._$htmlText}set htmlText(t){this._$htmlText!==t&&(this._$htmlText=`${t}`,this._$rawHtmlText="",this._$text="",this._$isHTML=!0,Te(this),this.hasEventListener(g.CHANGE)&&this.dispatchEvent(new g(g.CHANGE)))}get length(){return this.text.length}get multiline(){return this._$multiline}set multiline(t){t!==this._$multiline&&(this._$multiline=!!t,Te(this))}get numLines(){return q(this).lineTable.length}get scrollX(){return this.$scrollX}set scrollX(t){Ho(this,t)}get scrollY(){return this.$scrollY}set scrollY(t){zo(this,t)}get text(){return this._$isHTML?(this._$rawHtmlText||(this._$rawHtmlText=Go(this)),this._$rawHtmlText):this._$text}set text(t){t=`${t}`,t===""&&(this.scrollX&&(this.scrollX=0),this.scrollY&&(this.scrollY=0)),t!==this._$text&&(this._$htmlText="",this._$rawHtmlText="",this._$isHTML=!1,this._$text=t,Te(this),this.hasEventListener(g.CHANGE)&&this.dispatchEvent(new g(g.CHANGE)))}get textHeight(){return q(this).textHeight}get textWidth(){return q(this).textWidth}get thickness(){return this._$thickness}set thickness(t){t|=0,t!==this._$thickness&&(this._$thickness=t,_(this))}get thicknessColor(){return this._$thicknessColor}set thicknessColor(t){t=ht(Qe(t),0,16777215,0),t!==this._$thicknessColor&&(this._$thicknessColor=t,_(this))}get wordWrap(){return this._$wordWrap}set wordWrap(t){this._$wordWrap!==t&&(this._$wordWrap=!!t,Te(this))}get width(){return super.width}set width(t){if(t=+t,!isNaN(t)&&0>t)return;const u=t+this.bounds.xMin;u!==this.bounds.xMax&&(this.bounds.xMax=u,Te(this))}get height(){return super.height}set height(t){if(t=+t,!isNaN(t)&&0>t)return;const u=t+this.bounds.yMin;u!==this.bounds.yMax&&(this.bounds.yMax=u,Te(this))}appendText(t){const u=this.text;this.text=u+`${t}`}insertText(t){nr(this,t)}deleteText(){ds(this)}getLineText(t){return this._$text||this._$htmlText?Ko(this,t|0):""}replaceText(t,u,s){Qo(this,t,u|0,s|0)}selectAll(){r0(this)}copy(){Zo(this)}paste(){Jo(this)}setFocusIndex(t,u,s=!1){jo(this,t,u,s)}keyDown(t){n0(this,t)}$sync(t,u=null){u&&super.$syncLoaderInfo(u),a0(this,t)}}const i0=e=>{e.compositionStartIndex=e.focusIndex},c0=()=>{const e=Fe();e&&i0(e)},o0=(e,t)=>{if(e.compositionEndIndex>-1){const i=e.compositionStartIndex;e.focusIndex=e.compositionStartIndex,e.selectIndex=e.compositionEndIndex-1,e.compositionStartIndex=-1,ds(e),e.compositionStartIndex=i,e.selectIndex=-1}let u=q(e);const s=[],n=t.length;let r="";if(2>u.textTable.length)r=t,e.focusIndex=1,e.compositionStartIndex=1;else{for(let i=1;i<u.textTable.length;++i){const c=u.textTable[i];if(c){if(e.compositionStartIndex===i)for(let o=0;o<n;++o)s.push(new se(...Object.values(c.textFormat))),r+=t[o];switch(c.mode){case"break":s.push(new se(...Object.values(c.textFormat))),r+=`
664
- `;break;case"text":s.push(new se(...Object.values(c.textFormat))),r+=c.text;break;default:continue}}}if(e.compositionStartIndex===u.textTable.length){const i=u.textTable[e.compositionStartIndex-1];if(!i)return;for(let c=0;c<n;++c)s.push(new se(...Object.values(i.textFormat))),r+=t[c]}}s.length&&(e.$textFormats=s),e.text=r,e.$textFormats=null,u=q(e);let a=e.compositionStartIndex+n;for(let i=e.compositionStartIndex;i<a;++i){const c=u.textTable[i];if(!c)break;if(c.textFormat.underline=!0,c.mode==="wrap"){if(i===e.compositionStartIndex){let o=1;for(;;){const d=u.textTable[i-o];if(!d)break;if(d.mode==="text"){d.textFormat.underline=!0;break}o++}}i>e.compositionStartIndex&&a++}}e.compositionEndIndex=e.focusIndex=a},l0=e=>{const t=Fe();t&&o0(t,e.data)},h0=e=>{if(e.compositionEndIndex>-1){const t=q(e);for(let u=e.compositionStartIndex;u<e.compositionEndIndex;++u){const s=t.textTable[u];s&&(s.textFormat.underline=!1)}e.focusIndex=e.compositionEndIndex}ie.blur(),ie.value="",e.focus&&ie.focus(),e.selectIndex=-1,e.compositionStartIndex=-1,e.compositionEndIndex=-1},d0=()=>{const e=Fe();e&&h0(e)},f0=e=>{if(!e.data)return;const t=Fe();t&&(nr(t,e.data),t.hasEventListener(g.INPUT)&&t.dispatchEvent(new g(g.INPUT)))},b0=e=>{e.addEventListener("compositionstart",c0),e.addEventListener("compositionupdate",l0),e.addEventListener("compositionend",d0),e.addEventListener("input",f0)};b0(ie);const rr=[],$0=()=>rr,x0=e=>{rr.push(e)};let Be=null;const g0=()=>!!Be,m0=()=>{Be||(Be=new AudioContext),Be.resume()},ar=()=>(Be||(Be=new AudioContext),Be),p0=e=>{let t=null;switch(e.method.toUpperCase()){case"GET":if(e.data){const s=e.url.split("?");s[1]=s.length===1?e.data.toString():`${s[1]}&${e.data.toString()}`,e.url=s.join("?")}break;case"PUT":case"POST":e.data&&(t=e.data.toString());break}const u=new XMLHttpRequest;if(u.open(e.method,e.url,!0),u.responseType=e.format,u.withCredentials=e.withCredentials,e.event){const s=Object.keys(e.event);for(let n=0;n<s.length;++n){const r=s[n];u.addEventListener(r,e.event[r])}}for(let s=0;s<e.headers.length;++s){const n=e.headers[s];n&&u.setRequestHeader(n.name,n.value)}u.send(t)},fs=(e,t,u,s=null)=>{const n=+e;return isNaN(n)&&s!==null?s:Math.min(Math.max(t,isNaN(n)?0:n),u)};let ir=1;const T0=()=>ir,E0=e=>{ir=fs(e,0,1,1)},y0=[],Ut=()=>y0,w0=[],au=()=>w0,M0=e=>{E0(e);const t=Ut();for(let s=0;s<t.length;++s){const n=t[s];n&&(n.volume=e)}const u=au();for(let s=0;s<u.length;++s){const n=u[s];n&&(n.volume=e)}},A0=()=>{const e=Ut();for(let u=0;u<e.length;++u){const s=e[u];s&&s.stop()}const t=au();for(let u=0;u<t.length;++u){const s=t[u];s&&s.pause()}e.length=0,t.length=0};class Je{static get volume(){return T0()}static set volume(t){M0(t)}static stopAll(){A0()}}const v0=e=>{e.canLoop?e.play():(e.stop(),e.willTrigger(g.COMPLETE)&&e.dispatchEvent(new g(g.COMPLETE)))},I0=(e,t)=>{e.willTrigger(g.OPEN)&&e.dispatchEvent(new g(g.OPEN)),e.willTrigger(X.PROGRESS)&&e.dispatchEvent(new X(X.PROGRESS,!1,t.loaded,t.total))},S0=(e,t)=>{e.willTrigger(X.PROGRESS)&&e.dispatchEvent(new X(X.PROGRESS,!1,t.loaded,t.total))},bs=async e=>{if(e.byteLength)try{return await ar().decodeAudioData(e)}catch{const t=new Uint8Array(e);let u=0;for(;u>t.byteLength&&(u=t.indexOf(255,u),!(u===-1||(t[u+1]&224)===224));)++u;return await bs(t.subarray(u).buffer)}},R0=async(e,t)=>{const u=t.target;if(u)if(e.willTrigger(X.PROGRESS)&&e.dispatchEvent(new X(X.PROGRESS,!1,t.loaded,t.total)),199<u.status&&400>u.status){const s=await bs(u.response);s&&(e.audioBuffer=s,e.willTrigger(g.COMPLETE)&&e.dispatchEvent(new g(g.COMPLETE)))}else e.willTrigger(Re.IO_ERROR)&&e.dispatchEvent(new Re(Re.IO_ERROR,!1,u.statusText))},k0=async(e,t)=>{await new Promise(u=>{p0({format:"arraybuffer",url:t.url,method:t.method,data:t.data,headers:t.headers,withCredentials:t.withCredentials,event:{loadstart:s=>{I0(e,s)},progress:s=>{S0(e,s)},loadend:async s=>{await R0(e,s),u()}}})})},O0=async(e,t)=>{if(!t.audioBuffer){const u=new Uint8Array(t.buffer),s=await bs(u.buffer);if(!s)return;t.audioBuffer=s}e.audioBuffer=t.audioBuffer};class iu extends je{_$source;_$gainNode;_$stopFlag;_$currentCount;_$volume;audioBuffer;loopCount;constructor(){super(),this.loopCount=0,this.audioBuffer=null,this._$volume=1,this._$currentCount=0,this._$stopFlag=!0,this._$source=null,this._$gainNode=null}get volume(){return this._$volume}set volume(t){this._$volume=fs(Math.min(Je.volume,t),0,1,1),this._$gainNode&&(this._$gainNode.gain.value=this._$volume)}get canLoop(){return!this._$stopFlag&&this.loopCount>=this._$currentCount}clone(){const t=new iu;return t.volume=this._$volume,t.loopCount=this.loopCount,t.audioBuffer=this.audioBuffer,t}async load(t){await k0(this,t)}play(t=0){if(!this._$stopFlag||!this.audioBuffer)return;this.stop();const u=ar();this._$gainNode=u.createGain(),this._$gainNode.connect(u.destination),this._$gainNode.gain.value=Math.min(Je.volume,this._$volume),this._$source=u.createBufferSource(),this._$source.addEventListener("ended",()=>{v0(this)}),this._$source.buffer=this.audioBuffer,this._$source.connect(this._$gainNode),this._$source.start(t),this._$stopFlag=!1,this._$currentCount++,Ut().push(this)}stop(){if(this._$stopFlag)return;this._$stopFlag=!0,this._$currentCount=0,this._$source&&(this._$source.disconnect(),this._$source=null),this._$gainNode&&(this._$gainNode.gain.value=0,this._$gainNode.disconnect(),this._$gainNode=null);const t=Ut(),u=t.indexOf(this);u>-1&&t.splice(u,1)}async $build(t){await O0(this,t)}}class F0{volume;loopCount;constructor(t=1,u=0){this.volume=t,this.loopCount=u}}const C0=()=>{const e=document.createElement("video");return e.autoplay=!1,e.crossOrigin="anonymous",e.setAttribute("playsinline",""),e},$s=e=>{e.changed=!0;const t=e.parent;t&&!t.changed&&$s(t)},L0=async e=>{e.autoPlay&&(g0()||(e.muted=!0,x0(e)),await e.play()),e.loaded=!0,$s(e),e.willTrigger(g.COMPLETE)&&e.dispatchEvent(new g(g.COMPLETE))},N0=(e,t)=>{t.currentTime=0,t.duration=e.duration,t.videoWidth=e.videoWidth,t.videoHeight=e.videoHeight;const u=new OffscreenCanvas(t.videoWidth,t.videoHeight);t.$context=u.getContext("2d"),t.$offscreenCanvas=u},P0=(e,t)=>{e.willTrigger(X.PROGRESS)&&e.dispatchEvent(new X(X.PROGRESS,!1,t.loaded,t.total))},B0=e=>{if(e.willTrigger(oe.ENDED)&&e.dispatchEvent(new oe(oe.ENDED)),e.loop){e.currentTime=0;return}e.ended=!0,e.changed=!1,e.pause()},D0=(e,t)=>{e.addEventListener("loadedmetadata",()=>{N0(e,t)},{once:!0}),e.addEventListener("progress",u=>{P0(t,u)}),e.addEventListener("canplaythrough",async()=>{await L0(t),e.volume=t.volume},{once:!0}),e.addEventListener("ended",()=>{B0(t)})},cr=e=>{if(e.paused||!e.loaded)return 0;e.willTrigger(oe.PLAY)&&e.dispatchEvent(new oe(oe.PLAY)),$s(e);const t=au();return t.indexOf(e)===-1&&t.push(e),e.$context&&e.$videoElement&&e.$context.drawImage(e.$videoElement,0,0,e.videoWidth,e.videoHeight),requestAnimationFrame(()=>{cr(e)})},_0=(e,t)=>{t.videoData||(t.videoData=new Uint8Array(t.buffer),t.buffer=null),e.loop=t.loop,e.autoPlay=t.autoPlay,e.videoWidth=t.bounds.xMax,e.videoHeight=t.bounds.yMax,e.volume=t.volume,e.src=URL.createObjectURL(new Blob([t.videoData.buffer],{type:"video/mp4"}))};class qu extends ru{duration;smoothing;loop;autoPlay;currentTime;videoWidth;videoHeight;loaded;ended;isVideo;$videoElement;$offscreenCanvas;$context;paused;_$timerId;_$volume;_$src;constructor(t=0,u=0){super(),this.videoWidth=t,this.videoHeight=u,this.isVideo=!0,this.duration=0,this.smoothing=!0,this.loop=!1,this.loaded=!1,this.ended=!1,this.paused=!0,this.autoPlay=!0,this.currentTime=0,this._$src="",this._$timerId=-1,this._$volume=1,this.$videoElement=null,this.$offscreenCanvas=null,this.$context=null}static get namespace(){return"next2d.media.Video"}get namespace(){return"next2d.media.Video"}get src(){return this._$src}set src(t){this._$src!==t&&(this.loaded=!1,this.currentTime=0,this.$videoElement=null,this.$offscreenCanvas=null,this.$context=null,this.$videoElement=C0(),D0(this.$videoElement,this),this._$src=this.$videoElement.src=t,this.$videoElement.load())}get muted(){return this.$videoElement?this.$videoElement.muted:!1}set muted(t){this.$videoElement&&(this.$videoElement.muted=t)}get volume(){return this._$volume}set volume(t){this._$volume=fs(Math.min(Je.volume,t),0,1,1),this.$videoElement&&(this.$videoElement.volume=this._$volume)}pause(){if(!this.$videoElement||this.paused)return;this.paused=!0,this.$videoElement.pause(),cancelAnimationFrame(this._$timerId),this.willTrigger(oe.PAUSE)&&this.dispatchEvent(new oe(oe.PAUSE));const t=au(),u=t.indexOf(this);u>-1&&t.splice(u,1)}async play(){!this.$videoElement||!this.paused||(this.paused=!1,this.ended=!1,this.$videoElement.volume=this._$volume,await this.$videoElement.play(),this._$timerId=cr(this))}seek(t){this.$videoElement&&(this.currentTime=this.$videoElement.currentTime=Math.min(this.duration,t),this.willTrigger(oe.SEEK)&&this.dispatchEvent(new oe(oe.SEEK)))}$sync(t,u=null){u&&super.$syncLoaderInfo(u),_0(this,t)}}const lt=(e,t,u,s,n=-1)=>{const r=s.loaderInfo;if(!r)throw new Error("the loaderInfo or data is null.");e.parent=s,ke.set(e,s.root),Rt.set(e,r),e.dictionaryId=t,e.characterId=u.characterId,e.clipDepth=u.clipDepth,e.startFrame=u.startFrame,e.endFrame=u.endFrame,e.name=u.name||"",e.placeId=n},Us=(e,t,u,s,n=-1)=>{switch(u.extends){case Xt.namespace:{const r=new Xt;return lt(r,e,t,s,n),r.$sync(u),r}case $t.namespace:{const r=new $t;return lt(r,e,t,s,n),r.$sync(u),r}case Uu.namespace:{const r=new Uu;return lt(r,e,t,s,n),r.$sync(u),r}case qu.namespace:{const r=new qu;return lt(r,e,t,s,n),r.$sync(u),r}default:throw new Error(`Character extends not found: ${u.extends}`)}},Mt=new Map,U0=(e,t)=>{const u=e.loaderInfo;if(!u||!u.data)return t;const s=u.data.characters[e.characterId];if(!s)return t;const n=e.currentFrame,r=s.controller[n];if(!r)return t;const a=[],i=s.dictionary;if(!t.length){for(let c=0;c<r.length;++c){if(!(c in r))continue;const o=r[c];if(typeof o!="number")continue;const d=i[o];if(!d)continue;const l=u.data.characters[d.characterId];if(!l)continue;const h=Us(o,d,l,e,c);h&&(t.push(h),h.isContainerEnabled&&a.push(h))}return e.$container=a,t}for(let c=0;c<t.length;++c){const o=t[c];if(!o)continue;const d=o.startFrame,l=o.endFrame;if(d===1&&l===0||d<=n&&l>n){Mt.set(o.dictionaryId,o);continue}o.uniqueKey&&O.has(o.uniqueKey)&&O.removeTimer(o.uniqueKey),o.willTrigger(g.REMOVED)&&o.dispatchEvent(new g(g.REMOVED,!0)),o.willTrigger(g.REMOVED_FROM_STAGE)&&o.dispatchEvent(new g(g.REMOVED_FROM_STAGE,!0)),o.isVideo&&o.pause(),o.isContainerEnabled&&ns(o)}t.length=0;for(let c=0;c<r.length;++c){if(!(c in r))continue;const o=r[c];if(typeof o!="number")continue;if(Mt.has(o)){const b=Mt.get(o);b.placeId=c,b.placeObject=null,t.push(b);continue}const d=i[o];if(!d)continue;const l=u.data.characters[d.characterId];if(!l)continue;const h=Us(o,d,l,e,c);h&&(t.push(h),h.isContainerEnabled&&a.push(h))}return e.$container=a,Mt.clear(),t},q0=(e,t)=>{e.$labels||(e.$labels=new Map),e.$labels.set(t.frame,t)},X0=e=>{if(!e.$labels)return null;const t=e.currentFrame;return e.$labels.has(t)&&e.$labels.get(t)||null},Y0=e=>!e.$labels||!e.$labels.size?null:Array.from(e.$labels.values()),V0=(e,t)=>{if(!e.$labels||!e.$labels.size)return 0;for(const[u,s]of e.$labels)if(s.name===t)return u;return 0},W0=(e,t=null)=>{if(!t||!t.size)return;const u=e.currentFrame;if(!t.has(u))return;const s=t.get(u);s.willTrigger(g.FRAME_LABEL)&&s.dispatchEvent(new g(g.FRAME_LABEL))},H0=(e,t=null)=>{if(!t||!t.size)return;const u=e.currentFrame;t.has(u)&&Ru.push(e)},qt=e=>{e.$canAction&&(e.$canAction=!1,W0(e,e.$labels),H0(e,e.$actions))},cu=(e,t)=>{if(e.totalFrames===1)return;let u=+t;if(isNaN(u)&&(u=V0(e,`${t}`)),1>u&&(u=1),e.currentFrame!==u){if(u>e.totalFrames){if(e.currentFrame===e.totalFrames)return;e.$wait=!0,e.$canSound=!0,e.$canAction=!0,e.$hasTimelineHeadMoved=!0,e.currentFrame=e.totalFrames,qt(e),Y(e);return}e.currentFrame=u,e.$wait=!0,e.$canSound=!0,e.$canAction=!0,e.$hasTimelineHeadMoved=!0,Y(e),qt(e)}},z0=(e,t)=>{e.play(),cu(e,t)},G0=(e,t)=>{e.stop(),cu(e,t),e.$wait=!1},K0=e=>{e.totalFrames<=e.currentFrame||(e.stop(),cu(e,e.currentFrame+1))},Q0=e=>{2>e.currentFrame||(e.stop(),cu(e,e.currentFrame-1))},Z0=(e,t)=>{for(let u=0;u<t.length;++u){const s=t[u];if(!s)continue;s.script||(s.script=Function(s.action));const n=s.frame;e.has(n)||e.set(n,U()),e.get(n)?.push(s.script)}},J0=(e,t)=>{for(let u=0;u<t.length;++u){const s=t[u];s&&e.set(s.frame,new Un(s.name,s.frame))}},j0=async(e,t,u)=>{const s=e.loaderInfo;if(!s)return;const n=s.data;if(!n)return;const r=n.characters;for(let a=0;a<u.length;++a){const i=u[a];if(!i)continue;const c=U();for(let o=0;o<i.sound.length;++o){const d=i.sound[o];if(!d)continue;const l=r[d.characterId];if(!l)continue;const h=new iu;h.loopCount=d.loopCount|0,h.volume=Math.min(Je.volume,d.volume),await h.$build(l),c.push(h)}t.set(i.frame,c)}},el=(e,t)=>{t.actions&&(e.$actions||(e.$actions=new Map),Z0(e.$actions,t.actions)),t.sounds&&(e.$sounds||(e.$sounds=new Map),j0(e,e.$sounds,t.sounds)),t.labels&&(e.$labels||(e.$labels=new Map),J0(e.$labels,t.labels)),e.totalFrames=t.totalFrame||1};class Xt extends cs{$labels;$actions;$sounds;$canAction;$wait;totalFrames;currentFrame;_$stopFlag;$canSound;$hasTimelineHeadMoved;isTimelineEnabled;constructor(){super(),this.currentFrame=1,this.totalFrames=1,this.isTimelineEnabled=!0,this.$actions=null,this.$labels=null,this.$sounds=null,this.$canAction=!0,this.$wait=!1,this.$canSound=!0,this.$hasTimelineHeadMoved=!0,this._$stopFlag=!1}static get namespace(){return"next2d.display.MovieClip"}get namespace(){return"next2d.display.MovieClip"}get children(){return!this.$hasTimelineHeadMoved||this.characterId===-1?this._$children:(this.$hasTimelineHeadMoved=!1,U0(this,this._$children))}get currentFrameLabel(){return X0(this)}get currentLabels(){return Y0(this)}get isPlaying(){return!this._$stopFlag}gotoAndPlay(t){z0(this,t)}gotoAndStop(t){G0(this,t)}nextFrame(){K0(this)}play(){this._$stopFlag=!1,Y(this)}prevFrame(){Q0(this)}stop(){this._$stopFlag=!0}addFrameLabel(t){q0(this,t)}$sync(t,u=null){u&&super.$syncLoaderInfo(u),el(this,t)}}const qs=async(e,t)=>{const u=new Map;if(t.symbols.length)for(let a=0;a<t.symbols.length;++a){const i=t.symbols[a];u.set(i[0],i[1])}const s=e.contentLoaderInfo;s.data={stage:t.stage,characters:t.characters,symbols:u};const n=new Xt,r=t.characters[0];lt(n,-1,{characterId:0,name:"main",clipDepth:0,endFrame:r.controller.length,startFrame:1},e),n.$sync(r,s),n.parent=null,s.content=n,s.willTrigger(g.COMPLETE)&&s.dispatchEvent(new g(g.COMPLETE))},or=`(function(){"use strict";var l=Uint8Array,k=Uint16Array,tr=Int32Array,W=new l([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),X=new l([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ur=new l([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Y=function(r,e){for(var n=new k(31),i=0;i<31;++i)n[i]=e+=1<<r[i-1];for(var f=new tr(n[30]),i=1;i<30;++i)for(var g=n[i];g<n[i+1];++g)f[g]=g-n[i]<<5|i;return{b:n,r:f}},Z=Y(W,2),$=Z.b,cr=Z.r;$[28]=258,cr[258]=28;for(var wr=Y(X,0),gr=wr.b,O=new k(32768),v=0;v<32768;++v){var b=(v&43690)>>1|(v&21845)<<1;b=(b&52428)>>2|(b&13107)<<2,b=(b&61680)>>4|(b&3855)<<4,O[v]=((b&65280)>>8|(b&255)<<8)>>1}for(var m=(function(r,e,n){for(var i=r.length,f=0,g=new k(e);f<i;++f)r[f]&&++g[r[f]-1];var s=new k(e);for(f=1;f<e;++f)s[f]=s[f-1]+g[f-1]<<1;var h;if(n){h=new k(1<<e);var p=15-e;for(f=0;f<i;++f)if(r[f])for(var C=f<<4|r[f],y=e-r[f],a=s[r[f]-1]++<<y,o=a|(1<<y)-1;a<=o;++a)h[O[a]>>p]=C}else for(h=new k(i),f=0;f<i;++f)r[f]&&(h[f]=O[s[r[f]-1]++]>>15-r[f]);return h}),A=new l(288),v=0;v<144;++v)A[v]=8;for(var v=144;v<256;++v)A[v]=9;for(var v=256;v<280;++v)A[v]=7;for(var v=280;v<288;++v)A[v]=8;for(var j=new l(32),v=0;v<32;++v)j[v]=5;var hr=m(A,9,1),br=m(j,5,1),B=function(r){for(var e=r[0],n=1;n<r.length;++n)r[n]>e&&(e=r[n]);return e},c=function(r,e,n){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&n},J=function(r,e){var n=e/8|0;return(r[n]|r[n+1]<<8|r[n+2]<<16)>>(e&7)},sr=function(r){return(r+7)/8|0},yr=function(r,e,n){return(n==null||n>r.length)&&(n=r.length),new l(r.subarray(e,n))},zr=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],t=function(r,e,n){var i=new Error(e||zr[r]);if(i.code=r,Error.captureStackTrace&&Error.captureStackTrace(i,t),!n)throw i;return i},N=function(r,e,n,i){var f=r.length,g=0;if(!f||e.f&&!e.l)return n||new l(0);var s=!n,h=s||e.i!=2,p=e.i;s&&(n=new l(f*3));var C=function(vr){var or=n.length;if(vr>or){var lr=new l(Math.max(or*2,vr));lr.set(n),n=lr}},y=e.f||0,a=e.p||0,o=e.b||0,F=e.l,D=e.d,E=e.m,T=e.n,R=f*8;do{if(!F){y=c(r,a,1);var _=c(r,a+1,3);if(a+=3,_)if(_==1)F=hr,D=br,E=9,T=5;else if(_==2){var H=c(r,a,31)+257,L=c(r,a+10,15)+4,d=H+c(r,a+5,31)+1;a+=14;for(var M=new l(d),K=new l(19),u=0;u<L;++u)K[ur[u]]=c(r,a+u*3,7);a+=L*3;for(var rr=B(K),Mr=(1<<rr)-1,Ur=m(K,rr,1),u=0;u<d;){var er=Ur[c(r,a,Mr)];a+=er&15;var w=er>>4;if(w<16)M[u++]=w;else{var x=0,I=0;for(w==16?(I=3+c(r,a,3),a+=2,x=M[u-1]):w==17?(I=3+c(r,a,7),a+=3):w==18&&(I=11+c(r,a,127),a+=7);I--;)M[u++]=x}}var nr=M.subarray(0,H),z=M.subarray(H);E=B(nr),T=B(z),F=m(nr,E,1),D=m(z,T,1)}else t(1);else{var w=sr(a)+4,q=r[w-4]|r[w-3]<<8,G=w+q;if(G>f){p&&t(0);break}h&&C(o+q),n.set(r.subarray(w,G),o),e.b=o+=q,e.p=a=G*8,e.f=y;continue}if(a>R){p&&t(0);break}}h&&C(o+131072);for(var Dr=(1<<E)-1,Ir=(1<<T)-1,P=a;;P=a){var x=F[J(r,a)&Dr],S=x>>4;if(a+=x&15,a>R){p&&t(0);break}if(x||t(2),S<256)n[o++]=S;else if(S==256){P=a,F=null;break}else{var ar=S-254;if(S>264){var u=S-257,U=W[u];ar=c(r,a,(1<<U)-1)+$[u],a+=U}var Q=D[J(r,a)&Ir],V=Q>>4;Q||t(3),a+=Q&15;var z=gr[V];if(V>3){var U=X[V];z+=J(r,a)&(1<<U)-1,a+=U}if(a>R){p&&t(0);break}h&&C(o+131072);var ir=o+ar;if(o<z){var fr=g-z,Or=Math.min(z,ir);for(fr+o<0&&t(3);o<Or;++o)n[o]=i[fr+o]}for(;o<ir;++o)n[o]=n[o-z]}}e.l=F,e.p=P,e.b=o,e.f=y,F&&(y=1,e.m=E,e.d=D,e.n=T)}while(!y);return o!=n.length&&s?yr(n,0,o):n.subarray(0,o)},Fr=new l(0),kr=function(r){(r[0]!=31||r[1]!=139||r[2]!=8)&&t(6,"invalid gzip data");var e=r[3],n=10;e&4&&(n+=(r[10]|r[11]<<8)+2);for(var i=(e>>3&1)+(e>>4&1);i>0;i-=!r[n++]);return n+(e&2)},pr=function(r){var e=r.length;return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0},xr=function(r,e){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&t(6,"invalid zlib data"),(r[1]>>5&1)==1&&t(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function Sr(r,e){return N(r,{i:2},e,e)}function mr(r,e){var n=kr(r);return n+8>r.length&&t(6,"invalid gzip data"),N(r.subarray(n,-8),{i:2},new l(pr(r)),e)}function Ar(r,e){return N(r.subarray(xr(r),-4),{i:2},e,e)}function Cr(r,e){return r[0]==31&&r[1]==139&&r[2]==8?mr(r,e):(r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31?Sr(r,e):Ar(r,e)}var Er=typeof TextDecoder<"u"&&new TextDecoder,Tr=0;try{Er.decode(Fr,{stream:!0}),Tr=1}catch{}self.addEventListener("message",r=>{const e=Cr(r.data);let n="";for(let i=0;i<e.length;i+=4096)n+=String.fromCharCode(...e.subarray(i,i+4096));self.postMessage(JSON.parse(decodeURIComponent(n)))})})();
665
- `,Xs=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",or],{type:"text/javascript;charset=utf-8"});function tl(e){let t;try{if(t=Xs&&(self.URL||self.webkitURL).createObjectURL(Xs),!t)throw"";const u=new Worker(t,{name:e?.name});return u.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),u}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(or),{name:e?.name})}}const Ys=new tl,lr=async(e,t)=>{t.type==="zlib"?await new Promise(u=>{Ys.onmessage=n=>{qs(e,n.data),u()};const s=new Uint8Array(t.buffer);Ys.postMessage(s,[s.buffer])}):qs(e,t)},ul=(e,t)=>{e.willTrigger(g.OPEN)&&e.dispatchEvent(new g(g.OPEN)),e.willTrigger(X.PROGRESS)&&e.dispatchEvent(new X(X.PROGRESS,!1,t.loaded,t.total))},sl=(e,t)=>{e.willTrigger(X.PROGRESS)&&e.dispatchEvent(new X(X.PROGRESS,!1,t.loaded,t.total))},nl=async(e,t)=>{const u=t.target;if(!u)return;const s=e.contentLoaderInfo;if(s.willTrigger(X.PROGRESS)&&s.dispatchEvent(new X(X.PROGRESS,!1,t.loaded,t.total)),s.willTrigger(St.HTTP_STATUS)){const n=ti(u.getAllResponseHeaders());s.dispatchEvent(new St(St.HTTP_STATUS,!1,u.status,u.responseURL,n))}199<u.status&&400>u.status?(await lr(e,u.response),s.willTrigger(g.COMPLETE)&&s.dispatchEvent(new g(g.COMPLETE))):s.willTrigger(Re.IO_ERROR)&&s.dispatchEvent(new Re(Re.IO_ERROR,!1,u.statusText))},rl=async(e,t)=>{await new Promise(u=>{ei({format:t.responseDataFormat,url:t.url,method:t.method,data:t.data,headers:t.headers,withCredentials:t.withCredentials,event:{loadstart:s=>{ul(e.contentLoaderInfo,s)},progress:s=>{sl(e.contentLoaderInfo,s)},loadend:async s=>{await nl(e,s),u()}}})})};class hr{contentLoaderInfo;root;constructor(){this.root=null,this.contentLoaderInfo=new Tc}get content(){return this.contentLoaderInfo.content}get loaderInfo(){return this.contentLoaderInfo}async load(t){if(t.responseDataFormat!=="json")throw new Error("The only format that can be loaded by this function is `json` format.");this.contentLoaderInfo.url=t.url,this.contentLoaderInfo.format=t.responseDataFormat,await rl(this,t)}async loadJSON(t){await lr(this,t)}}const dr=()=>{for(;Ru.length;){const e=Ru.pop(),t=e.$actions;if(!t)continue;const u=e.currentFrame;if(!t.has(u))continue;const s=t.get(u);if(s)for(let n=0;n<s.length;n++)try{s[n].apply(e)}catch(r){console.error(r)}}},fr=()=>{for(;ku.length;){const e=ku.pop(),t=e.$sounds;if(!t)continue;const u=e.currentFrame;if(!t.has(u))continue;const s=t.get(u),n=e.soundTransform;for(let r=0;r<s.length;r++){const a=s[r];a&&(n&&(a.volume=n.volume,a.loopCount=n.loopCount),a.play())}}},al=(e,t=null)=>{if(!t||!t.size)return;const u=e.currentFrame;t.has(u)&&ku.push(e)},br=e=>{e.$canSound&&(e.$canSound=!1,al(e,e.$sounds))},$r=e=>{const t=e.children;for(let u=t.length-1;u>-1;--u){const s=t[u];s&&s.isContainerEnabled&&($r(s),s.isTimelineEnabled&&(br(s),qt(s)))}},il=e=>{$r(e),fr(),dr()},cl=e=>(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e);class ol{buffer;offset;constructor(){this.buffer=new Float32Array(256),this.offset=0}push(...t){this.buffer.length<this.offset+t.length&&this.resize(t.length);for(let u=0;u<t.length;u++)this.buffer[this.offset++]=t[u]}set(t){this.buffer.length<this.offset+t.length&&this.resize(t.length),this.buffer.set(t,this.offset),this.offset+=t.length}resize(t){const u=new Float32Array(cl(this.offset+t));this.buffer.length&&u.set(this.buffer),this.buffer=u}}const E=new ol,Yt=e=>{let t=2166136261;for(let u=0;u<e.length;++u){let s=e[u]|0;for(let n=0;n<4;n++){const r=s&255;t^=r,t=Math.imul(t,16777619),s>>>=8}}return(t>>>0)%16777216},xs=e=>{switch(e){case"copy":return 0;case"add":return 1;case"alpha":return 2;case"darken":return 3;case"difference":return 4;case"erase":return 5;case"hardlight":return 6;case"invert":return 7;case"layer":return 8;case"lighten":return 9;case"multiply":return 10;case"normal":return 11;case"overlay":return 12;case"screen":return 13;case"subtract":return 14;default:return 11}},xr=(e,t,u,s,n)=>{if(!e.visible){E.push(0);return}const r=e.graphics,a=r.isDrawable;if(!a&&!e.isBitmap){E.push(0);return}const i=qe(e),c=i?C.multiply(u,i):u;if(!de(c[3]+c[7]/255,0,1,0)){c!==u&&C.release(c),E.push(0);return}const d=N(e),l=d?A.multiply(t,d):t,h=ne(r.xMin,r.yMin,r.xMax,r.yMax,l),b=h[0],f=h[1],p=h[2],$=h[3];F(h);const m=Math.ceil(Math.abs(p-b)),R=Math.ceil(Math.abs($-f));switch(!0){case m===0:case R===0:case m===-1/0:case R===-1/0:case m===1/0:case R===1/0:c!==u&&C.release(c),l!==t&&A.release(l),F(h),E.push(0);return}if(0>b+m||0>f+R||b>s||f>n){c!==u&&C.release(c),l!==t&&A.release(l),F(h),E.push(0);return}const S=d&&e.scale9Grid?Math.abs(d[1])<.001&&Math.abs(d[2])<1e-4:!1;if(!e.uniqueKey)if(e.characterId&&e.loaderInfo){const H=U(e.loaderInfo.id,e.characterId);e.uniqueKey=`${Yt(new Float32Array(H))}`,ee(H)}else e.uniqueKey=e.isBitmap?`${e.instanceId}`:`${Yt(r.buffer)}`;const k=Math.round(Math.sqrt(l[0]*l[0]+l[1]*l[1])*100)/100,D=Math.round(Math.sqrt(l[2]*l[2]+l[3]*l[3])*100)/100;(!e.isBitmap&&!e.cacheKey||e.cacheParams[0]!==k||e.cacheParams[1]!==D||e.cacheParams[2]!==c[7])&&(e.cacheKey=O.generateKeys(k,D,c[7]),e.cacheParams[0]=k,e.cacheParams[1]=D,e.cacheParams[2]=c[7]);const re=e.isBitmap?0:e.cacheKey;if(E.push(1,bn,l[0],l[1],l[2],l[3],l[4],l[5],c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],b,f,p,$,r.xMin,r.yMin,r.xMax,r.yMax,+S,+a,+e.isBitmap,+e.uniqueKey,re),e.$cache&&!e.$cache.has(e.uniqueKey)&&(e.$cache=null),e.$cache?e.$cache.get(`${re}`):O.get(e.uniqueKey,`${re}`))e.$cache||(e.$cache=O.getById(e.uniqueKey),e.$cache.set(e.uniqueKey,!0)),E.push(1);else{if(E.push(0),S){const G=T.rendererScale,V=vu(G,0,0,G,0,0),te=A.multiply(V,d||bt);Et(V);const j=e.parent.concatenatedMatrix.rawData,ue=vu(j[0],j[1],j[2],j[3],j[4]*G-b,j[5]*G-f);A.release(j);const Xe=A.multiply(ue,te),Ye=Xe[4]-(l[4]-b),Sr=Xe[5]-(l[5]-f);Et(Xe);const tt=ne(r.xMin,r.yMin,r.xMax,r.yMax,te),Ts=tt[0],Es=tt[1],Rr=tt[2],kr=tt[3];F(tt);const gt=Math.ceil(Math.abs(Rr-Ts)),mt=Math.ceil(Math.abs(kr-Es)),$e=e.scale9Grid,hu=Math.abs(r.xMax-r.xMin),du=Math.abs(r.yMax-r.yMin),pt=$e.width>0?($e.x-r.xMin)/hu:1e-5,Tt=$e.height>0?($e.y-r.yMin)/du:1e-5,fu=$e.width>0?($e.x+$e.width-r.xMin)/hu:.99999,bu=$e.height>0?($e.y+$e.height-r.yMin)/du:.99999,ys=Math.ceil(hu*G),ws=Math.ceil(du*G);let $u=ys*pt/gt,xu=ws*Tt/mt,gu=(gt-ys*(1-fu))/gt,mu=(mt-ws*(1-bu))/mt;if($u>=gu){const ut=pt/(pt+(1-fu));$u=Math.max(ut-1e-5,0),gu=Math.min(ut+1e-5,1)}if(xu>=mu){const ut=Tt/(Tt+(1-bu));xu=Math.max(ut-1e-5,0),mu=Math.min(ut+1e-5,1)}E.push(te[0],te[1],te[2],te[3],te[4],te[5],ue[0],ue[1],ue[2],ue[3],ue[4]-Ye,ue[5]-Sr,Ts,Es,gt,mt,pt,Tt,$u,xu,fu,bu,gu,mu),Et(ue),Et(te)}const H=a||S?r.buffer:e.$bitmapBuffer;E.push(H.length),E.set(H),O.set(e.uniqueKey,`${re}`,!0),e.$cache&&(e.$cache=null)}if(E.push(xs(e.blendMode)),e.filters?.length){let H=!1;const G=[],V=he(0,0,0,0);for(let j=0;j<e.filters.length;j++){const ue=e.filters[j];if(!ue||!ue.canApplyFilter())continue;ue.$updated&&(H=!0),ue.$updated=!1,ue.getBounds(V);const Xe=ue.toNumberArray();for(let Ye=0;Ye<Xe.length;Ye+=4096)G.push(...Xe.subarray(Ye,Ye+4096))}const te=G.length>0;te&&(E.push(+te,+H,V[0],V[1],V[2],V[3],G.length),E.set(new Float32Array(G))),F(V)}else E.push(0);c!==u&&C.release(c),l!==t&&A.release(l)},Xu=(e,t)=>{const u=N(e),s=u?A.multiply(t,u):t;s!==t&&A.release(s);const n=u&&e.scale9Grid?Math.abs(u[1])<.001&&Math.abs(u[2])<1e-4:!1,r=e.graphics.buffer;E.push(bn,s[0],s[1],s[2],s[3],s[4],s[5],+n,r.length),E.set(r)},ll=new TextEncoder,gr=(e,t,u,s,n)=>{if(!e.visible){E.push(0);return}const r=qe(e),a=r?C.multiply(u,r):u;if(!de(a[3]+a[7]/255,0,1,0)){a!==u&&C.release(a),E.push(0);return}const c=N(e),o=c?A.multiply(t,c):t,d=ne(e.xMin,e.yMin,e.xMax,e.yMax,o),l=d[0],h=d[1],b=d[2],f=d[3];F(d);const p=Math.ceil(Math.abs(b-l)),$=Math.ceil(Math.abs(f-h));switch(!0){case p===0:case $===0:case p===-1/0:case $===-1/0:case p===1/0:case $===1/0:a!==u&&C.release(a),o!==t&&A.release(o),F(d),E.push(0);return}if(0>l+p||0>h+$||l>s||h>n){a!==u&&C.release(a),o!==t&&A.release(o),F(d),E.push(0);return}if(!e.uniqueKey)if(e.characterId&&e.loaderInfo){const D=U(e.loaderInfo.id,e.characterId);e.uniqueKey=`${Yt(new Float32Array(D))}`,ee(D)}else e.uniqueKey=`${e.instanceId}`;const m=Math.round(Math.sqrt(o[0]*o[0]+o[1]*o[1])*100)/100,R=Math.round(Math.sqrt(o[2]*o[2]+o[3]*o[3])*100)/100;(e.changed&&!e.cacheKey||e.cacheParams[0]!==m||e.cacheParams[1]!==R||e.cacheParams[2]!==a[7])&&(e.cacheKey=O.generateKeys(m,R,a[7]),e.cacheParams[0]=m,e.cacheParams[1]=R,e.cacheParams[2]=a[7]);const S=e.cacheKey;E.push(1,za,o[0],o[1],o[2],o[3],o[4],o[5],a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],l,h,b,f,e.xMin,e.yMin,e.xMax,e.yMax,+e.uniqueKey,S,+e.changed),e.$cache&&!e.$cache.has(e.uniqueKey)&&(e.$cache=null);const k=e.$cache?e.$cache.get(`${S}`):O.get(e.uniqueKey,`${S}`);if(!k||e.changed){E.push(0,+k);const D=ll.encode(JSON.stringify(e.$textData));switch(E.push(D.length),E.set(D),e.autoSize){case"center":E.push(0);break;case"left":E.push(1);break;case"none":E.push(2);break;case"right":E.push(3);break}E.push(e.stopIndex,e.scrollX,e.scrollY,e.textWidth,e.textHeight,Math.abs(e.xMax-e.xMin),Math.abs(e.yMax-e.yMin),e.focusIndex,e.selectIndex,+e.focusVisible,e.thickness,e.thicknessColor,+e.wordWrap,+e.border,e.borderColor,+e.background,e.backgroundColor,e.defaultTextFormat.color||0,e.defaultTextFormat.size||0),k||O.set(e.uniqueKey,`${S}`,!0),e.$cache&&(e.$cache=null)}else e.$cache||(e.$cache=O.getById(e.uniqueKey),e.$cache.set(e.uniqueKey,!0)),E.push(1);if(E.push(xs(e.blendMode)),e.filters?.length){let D=!1;const re=[],ce=he(0,0,0,0);for(let G=0;G<e.filters.length;G++){const V=e.filters[G];if(!V||!V.canApplyFilter())continue;V.$updated&&(D=!0),V.$updated=!1,V.getBounds(ce);const te=V.toNumberArray();for(let j=0;j<te.length;j+=4096)re.push(...te.subarray(j,j+4096))}const H=re.length>0;H&&(E.push(+H,+D,ce[0],ce[1],ce[2],ce[3],re.length),E.set(new Float32Array(re))),F(ce)}else E.push(0);a!==u&&C.release(a),o!==t&&A.release(o)},mr=(e,t,u,s,n,r)=>{if(!e.visible||!e.$videoElement||!e.$offscreenCanvas||!e.loaded){E.push(0);return}const a=qe(e),i=a?C.multiply(s,a):s;if(!de(i[3]+i[7]/255,0,1,0)){i!==s&&C.release(i),E.push(0);return}const o=N(e),d=o?A.multiply(u,o):u,l=ne(0,0,e.videoWidth,e.videoHeight,d),h=l[0],b=l[1],f=l[2],p=l[3];F(l);const $=Math.ceil(Math.abs(f-h)),m=Math.ceil(Math.abs(p-b));switch(!0){case $===0:case m===0:case $===-1/0:case m===-1/0:case $===1/0:case m===1/0:i!==s&&C.release(i),d!==u&&A.release(d),E.push(0);return}if(0>h+$||0>b+m||h>n||b>r){i!==s&&C.release(i),d!==u&&A.release(d),E.push(0);return}if(!e.uniqueKey)if(e.characterId&&e.loaderInfo){const S=U(e.loaderInfo.id,e.characterId);e.uniqueKey=`${Yt(new Float32Array(S))}`,ee(S)}else e.uniqueKey=`${e.instanceId}`;E.push(1,Ga,d[0],d[1],d[2],d[3],d[4],d[5],i[0],i[1],i[2],i[3],i[4],i[5],i[6],i[7],h,b,f,p,0,0,e.videoWidth,e.videoHeight,+e.uniqueKey,+e.changed),e.$cache&&!e.$cache.has(e.uniqueKey)&&(e.$cache=null);const R=e.$cache?e.$cache.get("0"):O.get(e.uniqueKey,"0");if(!R||e.changed){E.push(0,+R);const S=e.$context;if(S){const k=e.videoWidth/2,D=e.videoHeight/2;S.save(),S.translate(k,D),S.rotate(Math.PI),S.scale(-1,1),S.drawImage(e.$videoElement,-k,-D,e.videoWidth,e.videoHeight),S.restore(),t.push(e.$offscreenCanvas.transferToImageBitmap())}R||O.set(e.uniqueKey,"0",!0),e.$cache&&(e.$cache=null)}else e.$cache||(e.$cache=O.getById(e.uniqueKey),e.$cache.set(e.uniqueKey,!0)),E.push(1);if(E.push(xs(e.blendMode)),e.filters?.length){let S=!1;const k=[],D=he(0,0,0,0);for(let ce=0;ce<e.filters.length;ce++){const H=e.filters[ce];if(!H||!H.canApplyFilter())continue;H.$updated&&(S=!0),H.$updated=!1,H.getBounds(D);const G=H.toNumberArray();for(let V=0;V<G.length;V+=4096)k.push(...G.subarray(V,V+4096))}const re=k.length>0;re&&(E.push(+re,+S,D[0],D[1],D[2],D[3],k.length),E.set(new Float32Array(k))),F(D)}else E.push(0);i!==s&&C.release(i),d!==u&&A.release(d)},Vs=(e,t,u,s)=>{let n=null;switch(!0){case e.isContainerEnabled:n=ss(e,t);break;case e.isShape:n=uu(e,t);break;case e.isText:n=nu(e,t);break;case e.isVideo:n=su(e,t);break}if(!n)return null;const r=n[0],a=n[2],i=Math.abs(a-r);if(!i)return null;const c=n[1],o=n[3],d=Math.abs(o-c);return!d||0>r+i||0>c+d||r>u||c>s?null:n},Yu=(e,t)=>{const u=N(e),s=u?A.multiply(t,u):t,n=e.children;E.push(fn,n.length);for(let r=0;r<n.length;r++){const a=n[r];if(a&&!a.isMask)switch(!0){case a.isContainerEnabled:Yu(a,s);break;case a.isShape:Xu(a,s);break}}s!==t&&A.release(s)},pr=(e,t,u,s,n,r)=>{if(!e.visible){E.push(0);return}const a=qe(e),i=a?C.multiply(s,a):s;if(!de(i[3]+i[7]/255,0,1,0)){i!==s&&C.release(i),E.push(0);return}const o=e.children;if(!o.length){i!==s&&C.release(i),E.push(0);return}const d=N(e),l=d?A.multiply(u,d):u;if(!l[0]&&!l[1]||!l[2]&&!l[3]){i!==s&&C.release(i),l!==u&&A.release(l),E.push(0);return}E.push(1,fn);const h=e.mask;if(h){const p=Vs(h,l,n,r);if(!p)E.push(0);else switch(E.push(1,p[0],p[1],p[2],p[3]),!0){case h.isContainerEnabled:Yu(h,l);break;case h.isShape:Xu(h,l);break}h.changed=!1}else E.push(0);E.push(o.length);let b=0,f=!0;for(let p=0;p<o.length;++p){const $=o[p];if(!$.isMask){if(E.push($.placeId,$.clipDepth),b&&$.placeId>b&&(b=0,f=!0),!f){$.changed=!1;continue}if($.clipDepth){b=$.clipDepth;const m=Vs($,l,n,r);if(f=!!m,E.push(+f),!m){$.changed=!1;continue}switch(E.push(m[0],m[1],m[2],m[3]),!0){case $.isContainerEnabled:Yu($,l);break;case $.isShape:Xu($,l);break}$.changed=!1;continue}switch(!0){case $.isContainerEnabled:pr($,t,l,i,n,r);break;case $.isShape:xr($,l,i,n,r);break;case $.isText:gr($,l,i,n,r);break;case $.isVideo:mr($,t,l,i,n,r);break}$.changed=!1}}i!==s&&C.release(i),l!==u&&A.release(l)},hl=(e,t,u,s,n,r)=>{switch(E.push(T.backgroundColor),!0){case e.isContainerEnabled:pr(e,t,u,s,n,r);break;case e.isShape:xr(e,u,s,n,r);break;case e.isText:gr(e,u,s,n,r);break;case e.isVideo:mr(e,t,u,s,n,r);break}e.changed=!1},Ws=e=>{e.totalFrames===1||!e.isPlaying||(e.$wait||(++e.currentFrame,e.currentFrame>e.totalFrames&&(e.currentFrame=1)),e.$wait=!1,e.$canSound=!0,e.$canAction=!0,e.$hasTimelineHeadMoved=!0,e.$container=null,br(e),qt(e),Y(e))},Vu=e=>{const t=e.$container;if(t)for(let u=0;t.length>u;++u){const s=t[u];s.isTimelineEnabled&&Ws(s),Vu(s)}else{const u=[],s=e.children;for(let n=0;s.length>n;++n){const r=s[n];r.isContainerEnabled&&(r.isTimelineEnabled&&Ws(r),Vu(r),u.push(r))}e.$container=u}},dl=()=>{Vu(T),fr(),dr()};class fl extends is{_$ready;stageWidth;stageHeight;frameRate;rendererScale;rendererWidth;rendererHeight;_$backgroundColor;constructor(){super(),this.stageWidth=0,this.stageHeight=0,this.frameRate=1,this.rendererScale=1,this.rendererWidth=0,this.rendererHeight=0,this._$ready=!1,this._$backgroundColor=-1}get backgroundColor(){return this._$backgroundColor}set backgroundColor(t){this._$backgroundColor=t==="transparent"?-1:parseInt(t.replace("#",""),16)}get pointer(){return ft}set ready(t){!t||this._$ready||(this._$ready=t,il(this))}addChild(t){return fe.add(t.instanceId),super.addChild(t),ke.set(t,t),t}$ticker(){dl()}$generateRenderQueue(t,u,s,n){hl(t,u,s,n,this.rendererWidth,this.rendererHeight)}$mouseHit(t,u,s){He(this,t,u,s,!0)}}const T=new fl;fe.add(T.instanceId);const wu={command:"resize",buffer:null},Hs=[],Wu=(e=!0)=>{wu.buffer=new Float32Array([w.rendererWidth,w.rendererHeight,e?1:0]),Hs[0]=wu.buffer.buffer,Me.postMessage(wu,Hs)},zs=window.devicePixelRatio||1,gs=()=>{ze.x=0,ze.y=0;const e=xt();if(!e)return;const t=e.children[0];!t||t.localName!=="canvas"||(ze.x=(e.clientWidth-T.rendererWidth/zs)/2,ze.y=(e.clientHeight-T.rendererHeight/zs)/2)},ou=()=>{const e=xt();if(!e)return;const t=e.parentElement;if(!t)return;const u=w.fullScreen||t.tagName==="BODY"?window.innerWidth:t.clientWidth,s=w.fullScreen||t.tagName==="BODY"?window.innerHeight:t.clientHeight,n=e.style;if(n.width=`${u}px`,n.height=`${s}px`,!T.stageWidth||!T.stageHeight)return;const r=Math.min(u/T.stageWidth,s/T.stageHeight)*Ge,a=w.fullScreen?window.innerWidth*Ge:T.stageWidth*r|0,i=w.fullScreen?window.innerHeight*Ge:T.stageHeight*r|0;a===w.screenWidth&&i===w.screenHeight||(w.screenWidth=u,w.screenHeight=s,T.changed=!0,e.children.length>1&&e.children[1].dispatchEvent(new Event(`${es}_blur`)),gs(),!(a===w.rendererWidth&&i===w.rendererHeight)&&(T.rendererScale=w.rendererScale=r,T.rendererWidth=w.rendererWidth=a,T.rendererHeight=w.rendererHeight=i,ct[0]=ct[3]=r,ct[4]=(w.rendererWidth-T.stageWidth*r)/2,ct[5]=(w.rendererHeight-T.stageHeight*r)/2,O.reset(),Wu(),T.hasEventListener(g.RESIZE)&&T.dispatchEvent(new g(g.RESIZE))))},bl=new Float32Array([1,1,1,1,0,0,0,0]),rt=[],at={command:"render",buffer:null,length:0,imageBitmaps:null},At=[];Me.addEventListener("message",e=>{if(e.data.message!=="render")return;const t=e.data.buffer;E.buffer.length>t.length||(E.buffer=t)});const Tr=()=>{E.offset=0,At.length=0,rt.length=0,T.$generateRenderQueue(T,rt,ct,bl),E.offset&&(at.buffer=E.buffer,at.length=E.offset,At.push(E.buffer.buffer),at.imageBitmaps=null,rt.length&&(at.imageBitmaps=rt,At.push(...rt)),Me.postMessage(at,At))},Gs={command:"removeCache",buffer:null},Ks=[],Qs=()=>{const e=new Float32Array(O.$removeIds);O.$removeIds.length=0,Gs.buffer=e,Ks[0]=e.buffer,Me.postMessage(Gs,Ks)},Er=e=>{if(w.stopFlag)return;O.$removeIds.length&&Qs();const t=e-w.startTime;t>w.fps&&(w.startTime=e-t%w.fps,T.$ticker(),T.hasEventListener(g.ENTER_FRAME)&&T.dispatchEvent(new g(g.ENTER_FRAME)),T.changed&&Tr(),O.$removeCache&&(O.removeTimerScheduledCache(),O.$removeIds.length&&Qs())),w.timerId=requestAnimationFrame(u=>{Er(u)})},$l=()=>{w.stopFlag&&(w.stopFlag=!1,T.changed=!0,w.timerId>-1&&cancelAnimationFrame(w.timerId),w.fps=1e3/T.frameRate|0,w.startTime=performance.now(),w.timerId=requestAnimationFrame(e=>{Er(e)}))},xl=()=>{w.timerId>-1&&cancelAnimationFrame(w.timerId),w.stopFlag=!0,w.timerId=-1,Je.stopAll()},gl=e=>{const t=Fe();if(t){t.keyDown(e);return}T.hasEventListener(B.KEY_DOWN)&&(Ue(e),T.dispatchEvent(new B(B.KEY_DOWN)))},ml=e=>{Fe()||T.hasEventListener(B.KEY_UP)&&(Ue(e),T.dispatchEvent(new B(B.KEY_UP)))},pl=()=>{window.addEventListener(B.KEY_DOWN,gl),window.addEventListener(B.KEY_UP,ml)};class Tl{rendererWidth;rendererHeight;screenWidth;screenHeight;rendererScale;fixedWidth;fixedHeight;stopFlag;startTime;fps;tagId;_$fullScreen;timerId;mouseState;constructor(){this.rendererWidth=0,this.rendererHeight=0,this.rendererScale=1,this.screenWidth=0,this.screenHeight=0,this.stopFlag=!0,this.startTime=0,this.fps=16,this.timerId=-1,this.mouseState="up",this.fixedWidth=0,this.fixedHeight=0,this.tagId="",this._$fullScreen=!1,pl()}get fullScreen(){return this._$fullScreen}set fullScreen(t){this._$fullScreen!==t&&(this._$fullScreen=t,ou())}play(){$l()}stop(){xl()}cacheClear(){O.reset(),Me.postMessage({command:"cacheClear"})}setOptions(t=null){t&&(this.fixedWidth=t.width||this.fixedWidth,this.fixedHeight=t.height||this.fixedHeight,this.tagId=t.tagId||this.tagId,this._$fullScreen=!!t.fullScreen,t.bgColor&&(T.backgroundColor=t.bgColor))}}const w=new Tl;let Zs="auto";const ms=()=>{w.stopFlag||(Q.x=T.pointer.x,Q.y=T.pointer.y,Q.pointer="auto",Q.hit=null,pu.beginPath(),pu.setTransform(1,0,0,1,0,0),T.$mouseHit(pu,dt,Q),w.mouseState==="up"&&Zs!==Q.pointer&&(nn().style.cursor=Zs=Q.pointer))},ps=e=>{let t=window.scrollX,u=window.scrollY;const s=xt();if(s){const c=s.getBoundingClientRect();t+=c.left,u+=c.top}const n=e.target;if(n){const c=n.getBoundingClientRect();t+=c.left,u+=c.top}const r=(w.rendererWidth-T.stageWidth*w.rendererScale)/2,a=(w.rendererHeight-T.stageHeight*w.rendererScale)/2,i=w.rendererScale/Ge;T.pointer.x=(e.pageX-t)/i-r/w.rendererScale,T.pointer.y=(e.pageY-u)/i-a/w.rendererScale},El=()=>{const e=Q.hit,t=Fe();t&&(!e||t.instanceId!==e.instanceId)&&(t.focus=!1,ks(null)),e?(e.isText&&(e.focus?setTimeout(()=>{ie.focus()},300):(e.focus=!0,ks(e)),e.setFocusIndex(Q.x-dt[4],Q.y-dt[5])),e.willTrigger(M.POINTER_DOWN)&&e.dispatchEvent(new M(M.POINTER_DOWN))):T.willTrigger(M.POINTER_DOWN)&&T.dispatchEvent(new M(M.POINTER_DOWN))},yl=()=>{const e=Q.hit;e?e.willTrigger(M.DOUBLE_CLICK)&&e.dispatchEvent(new M(M.DOUBLE_CLICK)):T.willTrigger(M.DOUBLE_CLICK)&&T.dispatchEvent(new M(M.DOUBLE_CLICK))};let Js,vt=!1;const wl=e=>{const t=e.target;t&&(w.mouseState="down",t.setPointerCapture(e.pointerId),Ue(e),ps(e),ms(),Q.hit&&e.preventDefault(),clearTimeout(Js),vt?(vt=!1,yl()):(vt=!0,Js=setTimeout(()=>{vt=!1},300),El()))},Ml=()=>{const e=T.dropTarget,t=Q.hit;t?(t.willTrigger(M.POINTER_UP)&&t.dispatchEvent(new M(M.POINTER_UP)),e&&e.instanceId!==t.instanceId&&e.willTrigger(M.POINTER_UP)&&e.dispatchEvent(new M(M.POINTER_UP))):e&&e.willTrigger(M.POINTER_UP)?e.dispatchEvent(new M(M.POINTER_UP)):T.willTrigger(M.POINTER_UP)&&T.dispatchEvent(new M(M.POINTER_UP))},js=e=>{const t=e.target;t&&(w.mouseState="up",t.releasePointerCapture(e.pointerId),Ue(e),ps(e),ms(),Ml())},Al=()=>{const e=T.dropTarget;if(e){const n=e.parent?e.parent.globalToLocal(T.pointer):e.globalToLocal(T.pointer);let r=0,a=0;e.$lockCenter?(r=n.x-e.width/2,a=n.y-e.height/2):(r=n.x+e.$offsetX,a=n.y+e.$offsetY);const i=e.$boundedRect;i&&(r=Lt(r,i.left,i.right),a=Lt(a,i.top,i.bottom)),e.x=r,e.y=a}const t=Fe();if(t&&w.mouseState==="down"){t.setFocusIndex(Q.x-dt[4],Q.y-dt[5],!0);return}const u=an(),s=Q.hit;s?(s.willTrigger(M.POINTER_MOVE)&&s.dispatchEvent(new M(M.POINTER_MOVE)),u?u.instanceId!==s.instanceId&&(u.willTrigger(M.POINTER_OUT)&&u.dispatchEvent(new M(M.POINTER_OUT)),s.willTrigger(M.POINTER_OVER)&&s.dispatchEvent(new M(M.POINTER_OVER))):s.willTrigger(M.POINTER_OVER)&&s.dispatchEvent(new M(M.POINTER_OVER)),Ms(s)):(u&&(u.willTrigger(M.POINTER_OUT)&&u.dispatchEvent(new M(M.POINTER_OUT)),Ms(null)),T.hasEventListener(M.POINTER_MOVE)&&T.dispatchEvent(new M(M.POINTER_MOVE)))},vl=e=>{e.target&&(Ue(e),ps(e),ms(),Q.hit&&e.preventDefault(),Al())},Il=e=>{Ue(e);const t=an();t&&t.willTrigger(M.POINTER_LEAVE)&&(e.preventDefault(),t.dispatchEvent(new M(M.POINTER_LEAVE)))},Sl=e=>{Ue(e);const t=Q.hit;if(t&&t.isText&&t.scrollEnabled){e.preventDefault(),e.deltaX&&(t.scrollX+=e.deltaX/(t.textWidth/t.width)),e.deltaY&&(t.scrollY+=e.deltaY/(t.textHeight/t.height));return}T.willTrigger(Ke.WHEEL)&&(e.preventDefault(),T.dispatchEvent(new Ke(Ke.WHEEL)))},Rl=e=>{const t=()=>{m0();const u=$0();for(let s=0;s<u.length;++s){const n=u[s];n&&(n.muted=!1)}u.length=0,e.removeEventListener(M.POINTER_UP,t)};e.addEventListener(M.POINTER_UP,t),e.addEventListener(M.POINTER_DOWN,wl,{passive:!1}),e.addEventListener(M.POINTER_UP,js),e.addEventListener(M.POINTER_CANCEL,js),e.addEventListener(M.POINTER_MOVE,vl,{passive:!1}),e.addEventListener(M.POINTER_LEAVE,Il),e.addEventListener(Ke.WHEEL,Sl)},lu=document.createElement("canvas");Fr(lu);Cr(lu,Ge);Rl(lu);Nr(lu);const Hu={Event:g,EventDispatcher:je,EventPhase:We,FocusEvent:De,HTTPStatusEvent:St,IOErrorEvent:Re,PointerEvent:M,JobEvent:xe,ProgressEvent:X,VideoEvent:oe};Object.entries(Hu).forEach(([e,t])=>{Object.defineProperty(Hu,e,{get(){return t}})});const zu={Sprite:cs,MovieClip:Xt,BitmapData:Ne,BlendMode:sa,DisplayObject:ru,DisplayObjectContainer:is,FrameLabel:Un,Graphics:y,InteractiveObject:as,Loader:hr,Shape:$t,stage:T};Object.entries(zu).forEach(([e,t])=>{Object.defineProperty(zu,e,{get(){return t}})});const Gu={BevelFilter:zt,BlurFilter:Gt,ColorMatrixFilter:Kt,ConvolutionFilter:Qt,DisplacementMapFilter:Zt,DropShadowFilter:Jt,GlowFilter:jt,GradientBevelFilter:eu,GradientGlowFilter:tu};Object.entries(Gu).forEach(([e,t])=>{Object.defineProperty(Gu,e,{get(){return t}})});const Ku={ColorTransform:C,Matrix:A,Point:J,Rectangle:be};Object.entries(Ku).forEach(([e,t])=>{Object.defineProperty(Ku,e,{get(){return t}})});const Qu={Sound:iu,SoundMixer:Je,SoundTransform:F0,Video:qu};Object.entries(Qu).forEach(([e,t])=>{Object.defineProperty(Qu,e,{get(){return t}})});class yr{requestHeaders;url;contentType;data;method;responseDataFormat;withCredentials;constructor(t=""){this.url=`${t}`,this.contentType="application/json",this.data=null,this.method="GET",this.requestHeaders=[],this.responseDataFormat="json",this.withCredentials=!1}get headers(){const t=[];return t.push({name:"Content-Type",value:this.contentType}),this.requestHeaders.length&&t.push(...this.requestHeaders),t}}const Zu={URLRequest:yr};Object.entries(Zu).forEach(([e,t])=>{Object.defineProperty(Zu,e,{get(){return t}})});const Ju={TextFormat:se,TextField:Uu};Object.entries(Ju).forEach(([e,t])=>{Object.defineProperty(Ju,e,{get(){return t}})});const ju={Easing:_e,Tween:hs};Object.entries(ju).forEach(([e,t])=>{Object.defineProperty(ju,e,{get(){return t}})});const wr=()=>{const e=xt();if(e)for(;e.firstChild;)e.removeChild(e.firstChild)},Mr=()=>{const e=xt();if(!e)return;const t=nn();t&&(e.appendChild(t),e.appendChild(ie))},Ar=()=>{T.ready=!0,Tr(),w.play(),T.changed=!1},kl=()=>{const e=document.createElement("div");if(Or(e),e.id=es,e.tabIndex=-1,!w.tagId)document.body.appendChild(e);else{const t=document.getElementById(w.tagId);if(!t)return alert(`Element not found with tag ID: ${w.tagId}`),e;t.appendChild(e)}return e},Ol=(e,t=0,u=0)=>{let s="";if(s+="display:flex;",s+="align-items:center;",s+="justify-content:center;",s+="background-color:transparent;",s+="overflow:hidden;",s+="padding:0;",s+="margin:0;",s+="user-select:none;",s+="outline:none;",t&&u)s+=`width:${t}px;`,s+=`height:${u}px;`;else{const n=e.parentElement;if(!n)throw new Error("parent element is null.");n.tagName==="BODY"?(s+=`width:${window.innerWidth}px;`,s+=`height:${window.innerHeight}px;`):(s+=`width:${n.clientWidth}px;`,s+=`height:${n.clientHeight}px;`)}e.setAttribute("style",s)},Fl=e=>{const t=`${es}_loading`;e.innerHTML=`<style>
659
+ }\`},Ta=(t,e,r,n)=>{const s=qh(n,t,e,r);if(so.has(s))return so.get(s);const o=(n?14:5)+1,i=o-1,l=new _e(kn(o,!0,!1,n),td(o,i,t,e,r));return so.set(s,l),l},Ba=(t,e,r,n,s=0,o=null,i=null)=>{const l=t.highp;l[0]=r[0],l[1]=r[1],l[2]=r[2],l[4]=r[3],l[5]=r[4],l[6]=r[5],l[8]=r[6],l[9]=r[7],l[10]=r[8],l[12]=n[0],l[13]=n[1],l[14]=n[2],l[16]=n[3],l[17]=n[4],l[18]=n[5],l[11]=n[6],l[15]=n[7],l[19]=n[8],l[3]=pt,l[7]=mt;let c=20;i&&(l[20]=i[0],l[21]=i[1],l[22]=0,l[24]=i[2],l[25]=i[3],l[26]=0,l[28]=i[4],l[29]=i[5],l[30]=1,l[32]=i[6],l[33]=i[7],l[34]=0,l[36]=i[8],l[37]=i[9],l[38]=0,l[40]=i[10],l[41]=i[11],l[42]=1,l[31]=i[12],l[35]=i[13],l[39]=i[14],l[43]=i[15],l[44]=i[16],l[45]=i[17],l[46]=i[18],l[47]=i[19],l[48]=i[20],l[49]=i[21],l[50]=i[22],l[51]=i[23],l[52]=i[24],l[53]=i[25],c=56),e===0?(l[c++]=o[0],l[c++]=o[1],l[c++]=o[2],l[c]=o[3]):(l[c++]=819.2,l[c]=jr(s,-.975,.975,0))},Qn=()=>{jh(),to(!0),no(!1)},rd=(t,e,r,n)=>{const s=qe.shift(),o=qe.shift(),i=qe.shift(),l=qe.shift();Qn(),Wr();const c=$a(s,l);$e(c),Yr(),p.stencilMask(255),jn();const u=!!n,a=sn(u);n&&on(a,n),Kn(),rt(a,t,e,r),qn(),Hn();const h=Ta(!1,!1,i,u),d=qc(o),g=ys(O.$matrix);Ba(h,0,O.$matrix,g,0,d,n),di(d),Kr(g),rt(h,t,e,r)},nd=(t,e,r,n)=>{const s=qe.shift(),o=qe.shift(),i=qe.shift(),l=qe.shift(),c=qe.shift();Qn(),Wr();const u=$a(s,l);$e(u),Yr(),p.stencilMask(255),jn();const a=!!n,h=sn(a);n&&on(h,n),Kn(),rt(h,t,e,r),qn(),Hn(),O.save(),O.transform(o[0],o[1],o[2],o[3],o[4],o[5]);const d=O.$stack[O.$stack.length-1],g=ys(O.$matrix),m=Ta(!0,!!c,i,a);Ba(m,1,d,g,c,n),O.restore(),Kr(g),rt(m,t,e,r)},oo=new Map,sd=(t,e)=>{const r=\`b\${t?"y":"n"}\${e?"y":"n"}\`;if(oo.has(r))return oo.get(r);const n=t?Nu():Du(),s=new _e(kn(e?14:5,!0,!1,e),n);return oo.set(r,s),s},od=(t,e,r,n)=>{const s=t.highp,o=O.$stack[O.$stack.length-1];s[0]=o[0],s[1]=o[1],s[2]=o[2],s[4]=o[3],s[5]=o[4],s[6]=o[5],s[8]=o[6],s[9]=o[7],s[10]=o[8];const i=ys(O.$matrix);s[12]=i[0],s[13]=i[1],s[14]=i[2],s[16]=i[3],s[17]=i[4],s[18]=i[5],s[11]=i[6],s[15]=i[7],s[19]=i[8],s[3]=pt,s[7]=mt,n&&(s[20]=n[0],s[21]=n[1],s[22]=0,s[24]=n[2],s[25]=n[3],s[26]=0,s[28]=n[4],s[29]=n[5],s[30]=1,s[32]=n[6],s[33]=n[7],s[34]=0,s[36]=n[8],s[37]=n[9],s[38]=0,s[40]=n[10],s[41]=n[11],s[42]=1,s[31]=n[12],s[35]=n[13],s[39]=n[14],s[43]=n[15],s[44]=n[16],s[45]=n[17],s[46]=n[18],s[47]=n[19],s[48]=n[20],s[49]=n[21],s[50]=n[22],s[51]=n[23],s[52]=n[24],s[53]=n[25]);const l=t.mediump;l[0]=e,l[1]=r},id=(t,e,r,n)=>{jn();const s=!!n,o=sn(s);n&&on(o,n),Kn(),rt(o,t,e,r),qn();const i=Vt.shift(),l=Vt.shift(),c=Vt.shift(),u=Vt.shift(),a=Vt.shift(),h=Vt.shift(),d=qs(c,u,i,h);O.save(),O.transform(l[0],l[1],l[2],l[3],l[4],l[5]),Hn();const g=sd(a,s);od(g,c,u,n),rt(g,t,e,r),O.restore(),ae(d)},ad=()=>{const t=Ii();Yr(),p.stencilMask(255),Qn();let e=0,r=null;for(let n=0;n<Bt.length;n++)switch($r.has(n)&&(r=$r.get(n)),Bt[n]){case"fill":{const o=We.shift();Hh(t,e,o,r),e+=o}break;case"linear":{const o=We.shift();rd(t,e,o,r),e+=o}break;case"radial":{const o=We.shift();nd(t,e,o,r),e+=o}break;case"bitmap":{const o=We.shift();id(t,e,o,r),e+=o}break}Wr(),Qn(),_i(t),Ei(),Li()};let io=0;const Pa=new Float32Array(256);for(let t=1;t<256;t++)Pa[t]=255/t;const cd=async(t,e)=>{const r=Hi(0,0,t,e);$e(r),p.bindFramebuffer(p.FRAMEBUFFER,Si),p.framebufferTexture2D(p.FRAMEBUFFER,p.COLOR_ATTACHMENT0,p.TEXTURE_2D,r.resource,0);const n=new Uint8Array(t*e*4),s=O.$mainAttachmentObject;n.byteLength>io&&(io=Fn(n.byteLength),p.bufferData(p.PIXEL_PACK_BUFFER,io,p.STREAM_READ)),p.readPixels(0,s.height-e,t,e,p.RGBA,p.UNSIGNED_BYTE,0);const o=p.fenceSync(p.SYNC_GPU_COMMANDS_COMPLETE,0);await new Promise(i=>{const l=()=>{if(p.clientWaitSync(o,p.SYNC_FLUSH_COMMANDS_BIT,0)===p.TIMEOUT_EXPIRED){requestAnimationFrame(l);return}return p.deleteSync(o),p.getBufferSubData(p.PIXEL_PACK_BUFFER,0,n),i()};l()}),p.bindFramebuffer(p.FRAMEBUFFER,Tt);for(let i=0;i<n.length;i+=4){const l=n[i+3];if(l===0||l===255)continue;const c=Pa[l];n[i]=Math.min(255,Math.round(n[i]*c)),n[i+1]=Math.min(255,Math.round(n[i+1]*c)),n[i+2]=Math.min(255,Math.round(n[i+2]*c))}return await createImageBitmap(new ImageData(new Uint8ClampedArray(n),t,e),{imageOrientation:"flipY",premultiplyAlpha:"none",colorSpaceConversion:"none"})};let ld=class{$stack;$matrix;$clearColorR;$clearColorG;$clearColorB;$clearColorA;$mainAttachmentObject;$stackAttachmentObject;globalAlpha;globalCompositeOperation;imageSmoothingEnabled;$fillStyle;$strokeStyle;maskBounds;thickness;caps;joints;miterLimit;newDrawState=!1;constructor(e,r,n=1){Wc(e),Xc(e.getParameter(e.MAX_TEXTURE_SIZE)),Yc(r),Qc(n),this.$stack=Hr(),this.$stackAttachmentObject=Hr(),this.$matrix=xs(1,0,0,0,1,0,0,0,1),this.$clearColorR=0,this.$clearColorG=0,this.$clearColorB=0,this.$clearColorA=0,this.thickness=1,this.caps=0,this.joints=2,this.miterLimit=0,this.$mainAttachmentObject=null,this.globalAlpha=1,this.globalCompositeOperation="normal",this.imageSmoothingEnabled=!1,this.$fillStyle=new Float32Array([1,1,1,1]),this.$strokeStyle=new Float32Array([1,1,1,1]),this.maskBounds={xMin:0,yMin:0,xMax:0,yMax:0},e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0),e.clearColor(0,0,0,0),e.frontFace(e.CCW),ml(e),gl(e),bl(e,Pi()),xl(e),$f(e),Bf(),mh(e),jc(this)}clearTransferBounds(){Gl()}updateBackgroundColor(e,r,n,s){fl(this,e,r,n,s)}fillBackgroundColor(){hl(this.$clearColorR,this.$clearColorG,this.$clearColorB,this.$clearColorA)}resize(e,r,n=!0){kl(this,e,r,n)}clearRect(e,r,n,s){Il(e,r,n,s)}bind(e){Dl(this,e)}save(){Nl(this)}restore(){zl(this)}setTransform(e,r,n,s,o,i){Xl(this.$matrix,e,r,n,s,o,i)}transform(e,r,n,s,o,i){Yl(this,e,r,n,s,o,i)}reset(){Wl(this)}beginPath(){jl(this),el()}moveTo(e,r){wn(e,r)}lineTo(e,r){rl(e,r)}quadraticCurveTo(e,r,n,s){gi(e,r,n,s)}fillStyle(e,r,n,s){this.$fillStyle[0]=e,this.$fillStyle[1]=r,this.$fillStyle[2]=n,this.$fillStyle[3]=s}strokeStyle(e,r,n,s){this.$strokeStyle[0]=e,this.$strokeStyle[1]=r,this.$strokeStyle[2]=n,this.$strokeStyle[3]=s}closePath(){nl()}arc(e,r,n){ul(e,r,n)}bezierCurveTo(e,r,n,s,o,i){Qr(e,r,n,s,o,i)}fill(){eu("fill")}gradientFill(e,r,n,s,o,i){tu(e,r,n,s,o,i)}bitmapFill(e,r,n,s,o,i){Rf(e,r,n,s,o,i)}stroke(){Uf()}gradientStroke(e,r,n,s,o,i){bu(e,r,n,s,o,i)}bitmapStroke(e,r,n,s,o,i){Cf(e,r,n,s,o,i)}clip(){Wu()}get currentAttachmentObject(){return Bs}get atlasAttachmentObject(){return Ul()}createNode(e,r){return Ys(e,r)}removeNode(e){Ku(e)}beginNodeRendering(e){this.newDrawState=!0,ya(e),Hl(e.x,e.y,e.w,e.h)}endNodeRendering(){Kl()}drawFill(){ad()}drawDisplayObject(e,r,n,s,o,i){ya(e),pf(e,r,n,s,o,i)}drawArraysInstanced(){Mf()}clearArraysInstanced(){mf()}transferMainCanvas(){Tf()}drawPixels(e,r){wf(e,r)}drawElement(e,r,n=!1){Ef(e,r)}beginMask(){Pf()}setMaskBounds(e,r,n,s){Af(e,r,n,s)}endMask(){Us()}leaveMask(){this.drawArraysInstanced(),Ff()}useGrid(e){xu(e)}applyFilter(e,r,n,s,o,i,l,c,u,a,h){this.drawArraysInstanced(),Dh(e,r,n,s,o,i,l,c,u,a,h)}containerBeginLayer(e,r){this.drawArraysInstanced(),Nh(e,r)}containerEndLayer(e,r,n,s,o,i,l,c){zh(e,r,n,s,o,i,l,c)}containerDrawCachedFilter(e,r,n,s,o,i){Xh(e,r,n,s,o,i)}async createImageBitmap(e,r){return await cd(e,r)}},ao=4;class le{static device=null;static devicePixelRatio=1;static renderMaxSize=8192;static float32Array4Pool=[];static setDevice(e){le.device=e}static getDevice(){if(!le.device)throw new Error("GPUDevice is not initialized");return le.device}static setDevicePixelRatio(e){le.devicePixelRatio=e}static getDevicePixelRatio(){return le.devicePixelRatio}static setRenderMaxSize(e){le.renderMaxSize=e}static getRenderMaxSize(){return le.renderMaxSize}static createFloat32Array(e){return new Float32Array(e)}static createArray(){return[]}static getFloat32Array4(){return le.float32Array4Pool.length>0?le.float32Array4Pool.pop():new Float32Array(4)}static poolFloat32Array4(e){e.length===4&&le.float32Array4Pool.push(e)}}let st=null;const ud=t=>{st=t},fd=()=>le.getFloat32Array4(),hd=t=>{le.poolFloat32Array4(t)},dd=(t,e,r,n)=>{const s=n.x-t.x,o=n.y-t.y,i=s*s+o*o;if(i<1e-10){const h=(e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y),d=(r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y);return Math.max(h,d)}const l=(e.x-t.x)*o-(e.y-t.y)*s,c=l*l/i,u=(r.x-t.x)*o-(r.y-t.y)*s,a=u*u/i;return Math.max(c,a)},pd=(t,e,r,n)=>{const s={x:(t.x+e.x)*.5,y:(t.y+e.y)*.5},o={x:(e.x+r.x)*.5,y:(e.y+r.y)*.5},i={x:(r.x+n.x)*.5,y:(r.y+n.y)*.5},l={x:(s.x+o.x)*.5,y:(s.y+o.y)*.5},c={x:(o.x+i.x)*.5,y:(o.y+i.y)*.5},u={x:(l.x+c.x)*.5,y:(l.y+c.y)*.5};return{first:[t,s,l,u],second:[u,c,i,n]}},Aa=.25,md=8,gd=(t,e,r,n,s=Aa)=>{const o=[],i=(l,c,u,a,h)=>{if(dd(l,c,u,a)<=s||h>=md){const m={x:(c.x+u.x)*.5,y:(c.y+u.y)*.5};o.push({ctrl:m,end:a});return}const g=pd(l,c,u,a);i(g.first[0],g.first[1],g.first[2],g.first[3],h+1),i(g.second[0],g.second[1],g.second[2],g.second[3],h+1)};return i(t,e,r,n,0),o},bd=t=>{const r=Aa/(t*t);return Math.max(.0625,Math.min(4,r))};class xd{$currentPath;$vertices;$currentX;$currentY;$startX;$startY;constructor(){this.$currentPath=[],this.$vertices=[],this.$currentX=0,this.$currentY=0,this.$startX=0,this.$startY=0}beginPath(){this.$currentPath=[],this.$vertices=[],this.$currentX=0,this.$currentY=0,this.$startX=0,this.$startY=0}moveTo(e,r){this.$currentPath.length>=6&&this.$vertices.push(this.$currentPath),this.$currentPath=[e,r,!1],this.$currentX=e,this.$currentY=r,this.$startX=e,this.$startY=r}lineTo(e,r){e===this.$currentX&&r===this.$currentY||(this.$currentPath.push(e,r,!1),this.$currentX=e,this.$currentY=r)}quadraticCurveTo(e,r,n,s){this.$currentPath.push(e,r,!0),this.$currentPath.push(n,s,!1),this.$currentX=n,this.$currentY=s}$flatnessThreshold=.25;setScale(e){this.$flatnessThreshold=bd(e)}bezierCurveTo(e,r,n,s,o,i){const l={x:this.$currentX,y:this.$currentY},h=gd(l,{x:e,y:r},{x:n,y:s},{x:o,y:i},this.$flatnessThreshold);for(const d of h)this.$currentPath.push(d.ctrl.x,d.ctrl.y,!0),this.$currentPath.push(d.end.x,d.end.y,!1);this.$currentX=o,this.$currentY=i}arc(e,r,n){const s=n,o=n*.5522847498307936;this.bezierCurveTo(e+s,r+o,e+o,r+s,e,r+s),this.bezierCurveTo(e-o,r+s,e-s,r+o,e-s,r),this.bezierCurveTo(e-s,r-o,e-o,r-s,e,r-s),this.bezierCurveTo(e+o,r-s,e+s,r-o,e+s,r);const i=this.$currentPath.length;i>=3&&(this.$currentPath[i-3]=this.$startX,this.$currentPath[i-2]=this.$startY),this.$currentX=this.$startX,this.$currentY=this.$startY}closePath(){this.$currentPath.length>=3&&(this.$currentX!==this.$startX||this.$currentY!==this.$startY)&&this.$currentPath.push(this.$startX,this.$startY,!1)}get $getVertices(){const e=[...this.$vertices];return this.$currentPath.length>=9&&e.push(this.$currentPath),e}generateVertices(){const e=this.$getVertices,r=[];for(const n of e){if(n.length<9)continue;const s=[];for(let o=0;o<n.length;o+=3)s.push({x:n[o],y:n[o+1]});for(let o=1;o<s.length-1;o++)r.push(s[0].x,s[0].y,s[o].x,s[o].y,s[o+1].x,s[o+1].y)}return new Float32Array(r)}getCurrentPath(){const e=[];for(let r=0;r<this.$currentPath.length;r+=3)e.push({x:this.$currentPath[r],y:this.$currentPath[r+1]});return e}getAllPaths(){const e=[];for(const r of this.$vertices){const n=[];for(let s=0;s<r.length;s+=3)n.push({x:r[s],y:r[s+1]});n.length>0&&e.push(n)}if(this.$currentPath.length>=3){const r=[];for(let n=0;n<this.$currentPath.length;n+=3)r.push({x:this.$currentPath[n],y:this.$currentPath[n+1]});r.length>0&&e.push(r)}return e}getVerticesForStroke(){const e=[...this.$vertices];return this.$currentPath.length>=6&&e.push(this.$currentPath),e}reset(){this.$currentPath=[],this.$vertices=[],this.$currentX=0,this.$currentY=0,this.$startX=0,this.$startY=0}}const yd=(t,e,r,n)=>new Float32Array([t,e,0,0,t+r,e,1,0,t,e+n,0,1,t+r,e,1,0,t+r,e+n,1,1,t,e+n,0,1]),vd=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t+1),Md=(t,e,r,n)=>{const s=vd(r),o=e.get(s);let i;return o&&o.length>0?(i=o.pop(),n&&t.queue.writeBuffer(i,0,n.buffer,n.byteOffset,n.byteLength)):n?(i=t.createBuffer({size:s,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),new Float32Array(i.getMappedRange()).set(n),i.unmap()):i=t.createBuffer({size:s,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST}),i},Sd=(t,e,r)=>{const n=Math.ceil(r/16)*16,s=e.get(n);return s&&s.length>0?s.pop():t.createBuffer({size:n,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})},$d=32,Fa=(t,e)=>{const r=e.size;let n=t.get(r);if(n||(n=[],t.set(r,n)),n.length>=$d){e.destroy();return}n.push(e)},Td=32,wa=(t,e)=>{const r=e.size;let n=t.get(r);if(n||(n=[],t.set(r,n)),n.length>=Td){e.destroy();return}n.push(e)},Bd=(t,e)=>t.createBuffer({size:e.size,usage:e.usage|GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,label:e.label||"storage_buffer"}),Pd=(t,e,r,n)=>{const s=Math.ceil(r/256)*256;let o=null,i=1/0;for(const u of e)if(!u.inUse&&u.size>=s){const a=u.size-s;a<i&&(o=u,i=a)}if(o)return o.inUse=!0,o.lastUsedFrame=n,o.buffer;const l=Math.max(s,16384),c=Bd(t,{size:l,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST|GPUBufferUsage.VERTEX,label:\`storage_buffer_\${e.length}\`});return e.push({buffer:c,size:l,inUse:!0,lastUsedFrame:n}),c},Ad=(t,e)=>{for(const r of t)if(r.buffer===e){r.inUse=!1;return}},Fd=(t,e,r=60)=>{for(let n=t.length-1;n>=0;n--){const s=t[n];!s.inUse&&e-s.lastUsedFrame>r&&(s.buffer.destroy(),t.splice(n,1))}},Oa=(t,e,r,n=0,s=0)=>{const o=new Uint32Array([e,r,n,s]),i=t.createBuffer({size:o.byteLength,usage:GPUBufferUsage.INDIRECT|GPUBufferUsage.COPY_DST,mappedAtCreation:!0,label:"indirect_buffer"});return new Uint32Array(i.getMappedRange()).set(o),i.unmap(),i},Ea=(t,e,r,n,s=0,o=0)=>{const i=new Uint32Array([r,n,s,o]);t.queue.writeBuffer(e,0,i)};class wd{device;buffer=null;offset=0;capacity;alignment=256;pendingDestroyBuffers=[];stagingBuffer;stagingFloat32;dirtyEnd=0;constructor(e,r=65536){this.device=e,this.capacity=r,this.stagingBuffer=new ArrayBuffer(r),this.stagingFloat32=new Float32Array(this.stagingBuffer)}resetFrame(){this.offset=0,this.dirtyEnd=0;for(const e of this.pendingDestroyBuffers)e.destroy();this.pendingDestroyBuffers.length=0}getBuffer(){return this.buffer||(this.buffer=this.device.createBuffer({size:this.capacity,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})),this.buffer}allocate(e){this.buffer||this.getBuffer();const r=this.offset,n=e.byteLength;if(r+n>this.capacity){this.flush(),this.capacity*=2;const o=this.buffer;this.buffer=this.device.createBuffer({size:this.capacity,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),o&&this.pendingDestroyBuffers.push(o),this.stagingBuffer=new ArrayBuffer(this.capacity),this.stagingFloat32=new Float32Array(this.stagingBuffer)}this.stagingFloat32.set(e,r/4);const s=r+n;return s>this.dirtyEnd&&(this.dirtyEnd=s),this.offset=r+Math.ceil(n/this.alignment)*this.alignment,r}flush(){this.dirtyEnd>0&&this.buffer&&(this.device.queue.writeBuffer(this.buffer,0,this.stagingBuffer,0,this.dirtyEnd),this.dirtyEnd=0)}dispose(){this.buffer&&(this.buffer.destroy(),this.buffer=null);for(const e of this.pendingDestroyBuffers)e.destroy();this.pendingDestroyBuffers.length=0}}class Od{device;vertexBuffers;uniformBuffers;vertexBufferBuckets;uniformBufferBuckets;storageBufferPool;indirectBuffer;indirectBufferPool;frameIndirectBuffers;frameNumber;unitRectBuffer;frameVertexPoolBuffers;frameUniformPoolBuffers;dynamicUniform;constructor(e){this.device=e,this.vertexBuffers=new Map,this.uniformBuffers=new Map,this.vertexBufferBuckets=new Map,this.uniformBufferBuckets=new Map,this.storageBufferPool=[],this.indirectBuffer=null,this.indirectBufferPool=[],this.frameIndirectBuffers=[],this.frameNumber=0,this.unitRectBuffer=null,this.frameVertexPoolBuffers=[],this.frameUniformPoolBuffers=[],this.dynamicUniform=new wd(e)}createVertexBuffer(e,r){const n=this.device.createBuffer({size:r.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:!0});return new Float32Array(n.getMappedRange()).set(r),n.unmap(),this.vertexBuffers.set(e,n),n}createUniformBuffer(e,r){const n=this.device.createBuffer({size:r,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});return this.uniformBuffers.set(e,n),n}updateUniformBuffer(e,r){const n=this.uniformBuffers.get(e);n&&this.device.queue.writeBuffer(n,0,r.buffer,r.byteOffset,r.byteLength)}getVertexBuffer(e){return this.vertexBuffers.get(e)}getUniformBuffer(e){return this.uniformBuffers.get(e)}createRectVertices(e,r,n,s){return yd(e,r,n,s)}acquireVertexBuffer(e,r){const n=Md(this.device,this.vertexBufferBuckets,e,r);return this.frameVertexPoolBuffers.push(n),n}releaseVertexBuffer(e){Fa(this.vertexBufferBuckets,e)}acquireUniformBuffer(e){const r=Sd(this.device,this.uniformBufferBuckets,e);return this.frameUniformPoolBuffers.push(r),r}acquireAndWriteUniformBuffer(e,r){const n=r??e.byteLength,s=this.acquireUniformBuffer(n);return this.device.queue.writeBuffer(s,0,e.buffer,e.byteOffset,n),s}releaseUniformBuffer(e){wa(this.uniformBufferBuckets,e)}destroyBuffer(e){const r=this.vertexBuffers.get(e);r&&(r.destroy(),this.vertexBuffers.delete(e));const n=this.uniformBuffers.get(e);n&&(n.destroy(),this.uniformBuffers.delete(e))}dispose(){for(const e of this.vertexBuffers.values())e.destroy();this.vertexBuffers.clear();for(const e of this.uniformBuffers.values())e.destroy();this.uniformBuffers.clear();for(const e of this.vertexBufferBuckets.values())for(const r of e)r.destroy();this.vertexBufferBuckets.clear();for(const e of this.uniformBufferBuckets.values())for(const r of e)r.destroy();this.uniformBufferBuckets.clear();for(const e of this.storageBufferPool)e.buffer.destroy();this.storageBufferPool=[],this.indirectBuffer&&(this.indirectBuffer.destroy(),this.indirectBuffer=null);for(const e of this.indirectBufferPool)e.destroy();this.indirectBufferPool=[];for(const e of this.frameIndirectBuffers)e.destroy();this.frameIndirectBuffers=[],this.unitRectBuffer&&(this.unitRectBuffer.destroy(),this.unitRectBuffer=null),this.frameVertexPoolBuffers.length=0,this.frameUniformPoolBuffers.length=0,this.dynamicUniform.dispose()}getPoolStats(){let e=0;for(const n of this.vertexBufferBuckets.values())e+=n.length;let r=0;for(const n of this.uniformBufferBuckets.values())r+=n.length;return{vertexPoolSize:e,uniformPoolSize:r}}clearFrameBuffers(){for(const e of this.vertexBuffers.values())e.destroy();this.vertexBuffers.clear();for(const e of this.uniformBuffers.values())e.destroy();this.uniformBuffers.clear();for(const e of this.frameVertexPoolBuffers)Fa(this.vertexBufferBuckets,e);this.frameVertexPoolBuffers.length=0;for(const e of this.frameUniformPoolBuffers)wa(this.uniformBufferBuckets,e);this.frameUniformPoolBuffers.length=0;for(const e of this.frameIndirectBuffers)this.indirectBufferPool.push(e);this.frameIndirectBuffers.length=0,this.releaseAllStorageBuffers(),this.dynamicUniform.resetFrame(),this.frameNumber++,this.frameNumber%60===0&&Fd(this.storageBufferPool,this.frameNumber)}releaseAllStorageBuffers(){for(const e of this.storageBufferPool)e.inUse=!1}acquireStorageBuffer(e){return Pd(this.device,this.storageBufferPool,e,this.frameNumber)}releaseStorageBuffer(e){Ad(this.storageBufferPool,e)}writeStorageBuffer(e,r){this.device.queue.writeBuffer(e,0,r.buffer,r.byteOffset,r.byteLength)}getOrCreateIndirectBuffer(e,r,n=0,s=0){return this.indirectBuffer?Ea(this.device,this.indirectBuffer,e,r,n,s):this.indirectBuffer=Oa(this.device,e,r,n,s),this.indirectBuffer}createIndirectBuffer(e,r,n=0,s=0){let o=this.indirectBufferPool.pop();return o?Ea(this.device,o,e,r,n,s):o=Oa(this.device,e,r,n,s),this.frameIndirectBuffers.push(o),o}getUnitRectBuffer(){if(!this.unitRectBuffer){const e=this.createRectVertices(0,0,1,1);this.unitRectBuffer=this.device.createBuffer({size:e.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:!0}),new Float32Array(this.unitRectBuffer.getMappedRange()).set(e),this.unitRectBuffer.unmap()}return this.unitRectBuffer}getFrameNumber(){return this.frameNumber}getStoragePoolStats(){const e=this.storageBufferPool.filter(r=>r.inUse).length;return{storagePoolSize:this.storageBufferPool.length,storagePoolInUse:e}}}const Ed=(t,e)=>{const r=t.createSampler({magFilter:"linear",minFilter:"linear",mipmapFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"});e.set("linear",r);const n=t.createSampler({magFilter:"nearest",minFilter:"nearest",mipmapFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"});e.set("nearest",n);const s=t.createSampler({magFilter:"nearest",minFilter:"linear",mipmapFilter:"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"});e.set("atlas_instanced_sampler",s);const o=t.createSampler({magFilter:"linear",minFilter:"linear",mipmapFilter:"linear",addressModeU:"repeat",addressModeV:"repeat"});e.set("repeat",o)},Rd=(t,e,r,n,s,o)=>{const i=t.createTexture({size:{width:s,height:o},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});return t.queue.writeTexture({texture:i},n.buffer,{bytesPerRow:s*4,offset:n.byteOffset},{width:s,height:o}),e.set(r,i),i},Cd=(t,e,r,n)=>{const s=t.createTexture({size:{width:n.width,height:n.height},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});return t.queue.copyExternalImageToTexture({source:n,flipY:!0},{texture:s,premultipliedAlpha:!0},{width:n.width,height:n.height}),e.set(r,s),s};class Ud{device;textures;samplers;constructor(e){this.device=e,this.textures=new Map,this.samplers=new Map,Ed(e,this.samplers)}createTexture(e,r,n,s="rgba8unorm"){const o=this.device.createTexture({size:{width:r,height:n},format:s,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT});return this.textures.set(e,o),o}createTextureFromPixels(e,r,n,s){return Rd(this.device,this.textures,e,r,n,s)}createTextureFromImageBitmap(e,r){return Cd(this.device,this.textures,e,r)}updateTexture(e,r,n,s){const o=this.textures.get(e);o&&this.device.queue.writeTexture({texture:o},r.buffer,{bytesPerRow:n*4,offset:r.byteOffset},{width:n,height:s})}getTexture(e){return this.textures.get(e)}getSampler(e){return this.samplers.get(e)}createSampler(e,r=!0){const n=this.samplers.get(e);if(n)return n;const s=this.device.createSampler({magFilter:r?"linear":"nearest",minFilter:r?"linear":"nearest",mipmapFilter:r?"linear":"nearest",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"});return this.samplers.set(e,s),s}destroyTexture(e){const r=this.textures.get(e);r&&(r.destroy(),this.textures.delete(e))}dispose(){for(const e of this.textures.values())e.destroy();this.textures.clear(),this.samplers.clear()}}const Gd=(t,e,r,n,s,o,i,l,c)=>{const u=n==="atlas"||n.startsWith("atlas_"),a=u||n.startsWith("temp_")?"rgba8unorm":e,h=i||u&&ao>1,d=h?ao:1,g=t.createTexture({size:{width:s,height:o},format:a,usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST}),m=g.createView(),f={id:c.textureId++,resource:g,view:m,width:s,height:o,area:s*o,smooth:!0};let b=null;if(h){const S=t.createTexture({size:{width:s,height:o},format:a,sampleCount:d,usage:GPUTextureUsage.RENDER_ATTACHMENT}),M=S.createView();b={id:c.textureId++,resource:S,view:M,width:s,height:o,area:s*o,smooth:!0}}let x=null,y=null;if(u||n==="main"||l){const S=t.createTexture({size:{width:s,height:o},format:"stencil8",usage:GPUTextureUsage.RENDER_ATTACHMENT}),M=S.createView();if(x={id:c.stencilId++,resource:S,view:M,width:s,height:o,area:s*o,dirty:!1},h){const $=t.createTexture({size:{width:s,height:o},format:"stencil8",sampleCount:d,usage:GPUTextureUsage.RENDER_ATTACHMENT}),T=$.createView();y={id:c.stencilId++,resource:$,view:T,width:s,height:o,area:s*o,dirty:!1}}}const P={id:c.nextId++,width:s,height:o,clipLevel:0,msaa:h,mask:l,color:null,texture:f,stencil:x,msaaTexture:b,msaaStencil:y};return r.set(n,P),P},Ld=(t,e,r)=>{for(const[n,s]of t.entries())if(s.id===r.id){t.delete(n),e.push(s);break}},cn={r:0,g:0,b:0,a:0},Zn={view:null,clearValue:cn,loadOp:"clear",storeOp:"store"},kd={colorAttachments:[Zn]},Id=(t,e=0,r=0,n=0,s=0,o="clear",i=null)=>(Zn.view=t,cn.r=e,cn.g=r,cn.b=n,cn.a=s,Zn.loadOp=o,Zn.resolveTarget=i??void 0,kd),Jn={view:null,clearValue:{r:0,g:0,b:0,a:0},loadOp:"load",storeOp:"store"},co={view:null,stencilClearValue:0,stencilLoadOp:"clear",stencilStoreOp:"store"},_d={colorAttachments:[Jn],depthStencilAttachment:co},Vd=(t,e,r="load",n="clear",s=null)=>(Jn.view=t,Jn.loadOp=r,Jn.resolveTarget=s??void 0,co.view=e,co.stencilLoadOp=n,_d),Dd=(t,e,r)=>\`\${t}_\${e}_\${r}\`,Nd=(t,e,r,n,s,o,i,l,c)=>{const u=Dd(r,n,s),a=e.get(u);if(a)for(let g=0;g<a.length;g++){const m=a[g];if(!m.inUse)return m.inUse=!0,m.lastUsedFrame=i,m.texture}if(c[0]>=l){let g=1/0,m="",f=-1;for(const[b,x]of e)for(let y=0;y<x.length;y++){const P=x[y];!P.inUse&&P.lastUsedFrame<g&&(g=P.lastUsedFrame,m=b,f=y)}if(f>=0){const b=e.get(m);b[f].texture.destroy(),b.splice(f,1),b.length===0&&e.delete(m),c[0]--}}const h=t.createTexture({size:{width:r,height:n},format:s,usage:o}),d={texture:h,width:r,height:n,format:s,lastUsedFrame:i,inUse:!0};return a?a.push(d):e.set(u,[d]),c[0]++,h},zd=(t,e,r)=>{for(const n of t.values())for(let s=0;s<n.length;s++)if(n[s].texture===e){n[s].inUse=!1,n[s].lastUsedFrame=r;return}},Xd=(t,e,r,n)=>{const s=e-r;for(const[o,i]of t){for(let l=i.length-1;l>=0;l--){const c=i[l];!c.inUse&&c.lastUsedFrame<s&&(c.texture.destroy(),i.splice(l,1),n[0]--)}i.length===0&&t.delete(o)}},Yd=32,Wd=180;class jd{device;buckets;currentFrame;totalCount;constructor(e){this.device=e,this.buckets=new Map,this.currentFrame=0,this.totalCount=[0]}beginFrame(){this.currentFrame++,this.currentFrame%60===0&&Xd(this.buckets,this.currentFrame,Wd,this.totalCount)}acquire(e,r,n="rgba8unorm",s=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT){return Nd(this.device,this.buckets,e,r,n,s,this.currentFrame,Yd,this.totalCount)}release(e){zd(this.buckets,e,this.currentFrame)}getStats(){let e=0,r=0;for(const n of this.buckets.values())for(const s of n)s.inUse?e++:r++;return{total:this.totalCount[0],inUse:e,available:r}}dispose(){for(const e of this.buckets.values())for(const r of e)r.texture.destroy();this.buckets.clear(),this.totalCount[0]=0}}class Hd{device;format;attachments;currentAttachment;idCounter;texturePool;pendingReleases=[];constructor(e,r){this.device=e,this.format=r,this.attachments=new Map,this.currentAttachment=null,this.idCounter={nextId:1,textureId:1,stencilId:1},this.texturePool=new jd(e)}beginFrame(){this.texturePool.beginFrame()}createAttachment(e,r,n,s=!1,o=!1){return Gd(this.device,this.format,this.attachments,e,r,n,s,o,this.idCounter)}getAttachment(e){return this.attachments.get(e)}setCurrentAttachment(e){this.currentAttachment=e}getCurrentAttachment(){return this.currentAttachment}createRenderPassDescriptor(e,r=0,n=0,s=0,o=0,i="clear",l=null){return Id(e,r,n,s,o,i,l)}createStencilRenderPassDescriptor(e,r,n="load",s="clear",o=null){return Vd(e,r,n,s,o)}destroyAttachment(e){const r=this.attachments.get(e);r&&(r.texture&&r.texture.resource.destroy(),r.stencil&&r.stencil.resource.destroy(),this.attachments.delete(e))}resizeAttachment(e,r,n){return this.destroyAttachment(e),this.createAttachment(e,r,n)}createTemporaryAttachment(e,r){const n=\`temp_\${this.idCounter.nextId}\`,s=GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST|GPUTextureUsage.STORAGE_BINDING,o=this.texturePool.acquire(e,r,"rgba8unorm",s),i=o.createView(),l={id:this.idCounter.textureId++,resource:o,view:i,width:e,height:r,area:e*r,smooth:!0},c={id:this.idCounter.nextId++,width:e,height:r,clipLevel:0,msaa:!1,mask:!1,color:null,texture:l,stencil:null,msaaTexture:null,msaaStencil:null};return this.attachments.set(n,c),c}releaseTemporaryAttachment(e){Ld(this.attachments,this.pendingReleases,e)}flushPendingReleases(){for(const e of this.pendingReleases)e.texture&&this.texturePool.release(e.texture.resource),e.msaaTexture&&e.msaaTexture.resource.destroy(),e.stencil&&e.stencil.resource.destroy(),e.msaaStencil&&e.msaaStencil.resource.destroy();this.pendingReleases=[]}dispose(){for(const e of this.attachments.values())e.texture&&e.texture.resource.destroy(),e.stencil&&e.stencil.resource.destroy();this.attachments.clear(),this.currentAttachment=null,this.texturePool.dispose()}}const Kd=t=>({id:t.attachmentId++,width:0,height:0,clipLevel:0,msaa:!1,mask:!1,color:null,texture:null,stencil:null,msaaTexture:null,msaaStencil:null}),qd=(t,e,r,n)=>{const s=t.createTexture({size:{width:e,height:r},format:"depth24plus-stencil8",usage:GPUTextureUsage.RENDER_ATTACHMENT});return{id:n.stencilId++,resource:s,view:s.createView(),width:e,height:r,area:e*r,dirty:!1}},Qd=(t,e,r,n,s)=>{for(let o=0;o<e.length;o++){const i=e[o];if(i.width>=r&&i.height>=n)return e.splice(o,1),i.dirty=!1,i}return qd(t,r,n,s)},Zd=(t,e,r,n)=>{const s=t.createTexture({size:{width:e,height:r},format:"rgba8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST});return{resource:s,view:s.createView(),stencil:n,width:e,height:r,area:e*r,dirty:!1}},Jd=(t,e,r,n,s)=>{for(let o=0;o<e.length;o++){const i=e[o];if(i.width>=r&&i.height>=n)return e.splice(o,1),i.stencil=s,i.dirty=!1,i}return Zd(t,r,n,s)},ep=(t,e,r,n,s)=>{const o=t.createTexture({size:{width:e,height:r},format:"rgba8unorm",usage:GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.COPY_DST}),i=o.createView();return{id:s.textureId++,resource:o,view:i,width:e,height:r,area:e*r,smooth:n}},tp=(t,e,r,n,s,o)=>{const i=\`\${r}x\${n}_smooth\`;if(e.has(i)){const l=e.get(i);if(l.length>0)return l.pop()}return ep(t,r,n,s,o)},rp=(t,e,r,n,s,o,i,l,c)=>{const u=e.length>0?e.pop():Kd(c);u.width=o,u.height=i,u.msaa=l,u.mask=!1,u.clipLevel=0;const a=Qd(t,s,o,i,c),h=Jd(t,n,o,i,a);u.color=h,u.stencil=a;const d=tp(t,r,o,i,!0,c);return u.texture=d,u},np=(t,e)=>{const r=\`\${e.width}x\${e.height}_\${e.smooth?"smooth":"nearest"}\`;t.has(r)||t.set(r,[]),t.get(r).push(e)},sp=(t,e,r,n,s)=>{s.texture&&(np(e,s.texture),s.texture=null),s.color&&(r.push(s.color),s.color=null),s.stencil&&(n.push(s.stencil),s.stencil=null),t.push(s)},ln={r:0,g:0,b:0,a:0},lo={view:null,loadOp:"clear",storeOp:"store",clearValue:ln},Ra={view:null,depthLoadOp:"clear",depthStoreOp:"store",depthClearValue:1,stencilLoadOp:"clear",stencilStoreOp:"store",stencilClearValue:0},uo={colorAttachments:[lo]},op=(t,e,r,n,s,o="clear")=>{const i=t.color?.view??t.texture?.view;if(!i)throw new Error("No color view available for render pass");return lo.view=i,lo.loadOp=o,ln.r=e,ln.g=r,ln.b=n,ln.a=s,t.stencil?.view?(Ra.view=t.stencil.view,uo.depthStencilAttachment=Ra):uo.depthStencilAttachment=void 0,uo};class ip{device;attachmentPool;texturePool;colorBufferPool;stencilBufferPool;idCounter;currentAttachment;constructor(e){this.device=e,this.attachmentPool=[],this.texturePool=new Map,this.colorBufferPool=[],this.stencilBufferPool=[],this.idCounter={attachmentId:0,textureId:0,stencilId:0},this.currentAttachment=null}getAttachmentObject(e,r,n=!1){return rp(this.device,this.attachmentPool,this.texturePool,this.colorBufferPool,this.stencilBufferPool,e,r,n,this.idCounter)}bindAttachment(e){this.currentAttachment=e}getCurrentAttachment(){return this.currentAttachment}get currentAttachmentObject(){return this.currentAttachment}unbindAttachment(){this.currentAttachment=null}releaseAttachment(e){sp(this.attachmentPool,this.texturePool,this.colorBufferPool,this.stencilBufferPool,e)}createRenderPassDescriptor(e,r,n,s,o,i="clear"){return op(e,r,n,s,o,i)}dispose(){for(const e of this.texturePool.values())for(const r of e)r.resource.destroy();this.texturePool.clear();for(const e of this.colorBufferPool)e.resource.destroy();this.colorBufferPool=[];for(const e of this.stencilBufferPool)e.resource.destroy();this.stencilBufferPool=[];for(const e of this.attachmentPool)e.texture&&e.texture.resource.destroy(),e.color&&e.color.resource.destroy(),e.stencil&&e.stencil.resource.destroy();this.attachmentPool=[]}}const Ca=\`
660
+ override yFlipSign: f32 = 1.0;
661
+
662
+ struct VertexInput {
663
+ @location(0) position: vec2<f32>,
664
+ @location(1) bezier: vec2<f32>,
665
+ }
666
+
667
+ struct VertexOutput {
668
+ @builtin(position) position: vec4<f32>,
669
+ @location(0) bezier: vec2<f32>,
670
+ @location(1) color: vec4<f32>,
671
+ }
672
+
673
+ struct FillUniforms {
674
+ color: vec4<f32>,
675
+ matrix0: vec4<f32>,
676
+ matrix1: vec4<f32>,
677
+ matrix2: vec4<f32>,
678
+ }
679
+
680
+ @group(0) @binding(0) var<uniform> uniforms: FillUniforms;
681
+
682
+ @vertex
683
+ fn main(input: VertexInput) -> VertexOutput {
684
+ var output: VertexOutput;
685
+ let matrix = mat3x3<f32>(uniforms.matrix0.xyz, uniforms.matrix1.xyz, uniforms.matrix2.xyz);
686
+ let transformed = matrix * vec3<f32>(input.position, 1.0);
687
+ let ndc = transformed.xy * 2.0 - 1.0;
688
+ output.position = vec4<f32>(ndc.x, ndc.y * yFlipSign, 0.0, 1.0);
689
+ output.bezier = input.bezier;
690
+ output.color = uniforms.color;
691
+ return output;
692
+ }
693
+ \`,Ua=\`
694
+ override yFlipSign: f32 = 1.0;
695
+
696
+ struct VertexInput {
697
+ @location(0) position: vec2<f32>,
698
+ @location(1) bezier: vec2<f32>,
699
+ }
700
+
701
+ struct VertexOutput {
702
+ @builtin(position) position: vec4<f32>,
703
+ @location(0) bezier: vec2<f32>,
704
+ }
705
+
706
+ struct FillUniforms {
707
+ color: vec4<f32>,
708
+ matrix0: vec4<f32>,
709
+ matrix1: vec4<f32>,
710
+ matrix2: vec4<f32>,
711
+ }
712
+
713
+ @group(0) @binding(0) var<uniform> uniforms: FillUniforms;
714
+
715
+ @vertex
716
+ fn main(input: VertexInput) -> VertexOutput {
717
+ var output: VertexOutput;
718
+ let matrix = mat3x3<f32>(uniforms.matrix0.xyz, uniforms.matrix1.xyz, uniforms.matrix2.xyz);
719
+ let transformed = matrix * vec3<f32>(input.position, 1.0);
720
+ let ndc = transformed.xy * 2.0 - 1.0;
721
+ output.position = vec4<f32>(ndc.x, ndc.y * yFlipSign, 0.0, 1.0);
722
+ output.bezier = input.bezier;
723
+ return output;
724
+ }
725
+ \`,Ga=\`
726
+ override yFlipSign: f32 = 1.0;
727
+
728
+ struct VertexInput {
729
+ @location(0) position: vec2<f32>,
730
+ @location(1) bezier: vec2<f32>,
731
+ }
732
+
733
+ struct VertexOutput {
734
+ @builtin(position) position: vec4<f32>,
735
+ @location(0) color: vec4<f32>,
736
+ }
737
+
738
+ struct FillUniforms {
739
+ color: vec4<f32>,
740
+ matrix0: vec4<f32>,
741
+ matrix1: vec4<f32>,
742
+ matrix2: vec4<f32>,
743
+ }
744
+
745
+ @group(0) @binding(0) var<uniform> uniforms: FillUniforms;
746
+
747
+ @vertex
748
+ fn main(input: VertexInput) -> VertexOutput {
749
+ var output: VertexOutput;
750
+ let matrix = mat3x3<f32>(uniforms.matrix0.xyz, uniforms.matrix1.xyz, uniforms.matrix2.xyz);
751
+ let transformed = matrix * vec3<f32>(input.position, 1.0);
752
+ let ndc = transformed.xy * 2.0 - 1.0;
753
+ output.position = vec4<f32>(ndc.x, ndc.y * yFlipSign, 0.0, 1.0);
754
+ output.color = uniforms.color;
755
+ return output;
756
+ }
757
+ \`,ap=\`
758
+ struct VertexInput {
759
+ @location(0) position: vec2<f32>,
760
+ @location(1) bezier: vec2<f32>,
761
+ }
762
+
763
+ struct VertexOutput {
764
+ @builtin(position) position: vec4<f32>,
765
+ @location(0) bezier: vec2<f32>,
766
+ }
767
+
768
+ struct Uniforms {
769
+ viewportSize: vec2<f32>,
770
+ _padding0: vec2<f32>,
771
+ matrixCol0: vec3<f32>,
772
+ _padding1: f32,
773
+ matrixCol1: vec3<f32>,
774
+ _padding2: f32,
775
+ matrixCol2: vec3<f32>,
776
+ _padding3: f32,
777
+ }
778
+
779
+ @group(0) @binding(0) var<uniform> uniforms: Uniforms;
780
+
781
+ @vertex
782
+ fn main(input: VertexInput) -> VertexOutput {
783
+ var output: VertexOutput;
784
+ let matrix = mat3x3<f32>(uniforms.matrixCol0, uniforms.matrixCol1, uniforms.matrixCol2);
785
+ let transformed = matrix * vec3<f32>(input.position, 1.0);
786
+ let pos = transformed.xy;
787
+ let ndc = pos * 2.0 - 1.0;
788
+ output.position = vec4<f32>(ndc.x, -ndc.y, 0.0, 1.0);
789
+ output.bezier = input.bezier;
790
+ return output;
791
+ }
792
+ \`,La=\`
793
+ override yFlipSign: f32 = 1.0;
794
+
795
+ struct VertexInput {
796
+ @location(0) position: vec2<f32>,
797
+ @location(1) texCoord: vec2<f32>,
798
+ }
799
+
800
+ struct VertexOutput {
801
+ @builtin(position) position: vec4<f32>,
802
+ @location(0) texCoord: vec2<f32>,
803
+ @location(1) color: vec4<f32>,
804
+ }
805
+
806
+ struct Uniforms {
807
+ matrix: mat3x3<f32>,
808
+ color: vec4<f32>,
809
+ alpha: f32,
810
+ }
811
+
812
+ @group(0) @binding(0) var<uniform> uniforms: Uniforms;
813
+
814
+ @vertex
815
+ fn main(input: VertexInput) -> VertexOutput {
816
+ var output: VertexOutput;
817
+ let pos = uniforms.matrix * vec3<f32>(input.position, 1.0);
818
+ let ndc = pos.xy * 2.0 - 1.0;
819
+ output.position = vec4<f32>(ndc.x, ndc.y * yFlipSign, 0.0, 1.0);
820
+ output.texCoord = input.texCoord;
821
+ let premultipliedColor = vec4<f32>(
822
+ uniforms.color.rgb * uniforms.color.a * uniforms.alpha,
823
+ uniforms.color.a * uniforms.alpha
824
+ );
825
+ output.color = premultipliedColor;
826
+ return output;
827
+ }
828
+ \`,cp=\`
829
+ struct VertexInput {
830
+ @location(0) position: vec2<f32>,
831
+ @location(1) texCoord: vec2<f32>,
832
+ }
833
+
834
+ struct InstanceInput {
835
+ @location(2) textureRect: vec4<f32>,
836
+ @location(3) textureDim: vec4<f32>,
837
+ @location(4) matrixTx: vec4<f32>,
838
+ @location(5) matrixScale: vec4<f32>,
839
+ @location(6) mulColor: vec4<f32>,
840
+ @location(7) addColor: vec4<f32>,
841
+ }
842
+
843
+ struct VertexOutput {
844
+ @builtin(position) position: vec4<f32>,
845
+ @location(0) texCoord: vec2<f32>,
846
+ @location(1) mulColor: vec4<f32>,
847
+ @location(2) addColor: vec4<f32>,
848
+ }
849
+
850
+ @vertex
851
+ fn main(
852
+ input: VertexInput,
853
+ instance: InstanceInput,
854
+ @builtin(instance_index) instanceIdx: u32
855
+ ) -> VertexOutput {
856
+ var output: VertexOutput;
857
+ let texX = instance.textureRect.x + input.texCoord.x * instance.textureRect.z;
858
+ let texY = instance.textureRect.y + input.texCoord.y * instance.textureRect.w;
859
+ output.texCoord = vec2<f32>(texX, texY);
860
+ var pos = vec2<f32>(input.position.x, 1.0 - input.position.y);
861
+ pos = pos * vec2<f32>(instance.textureDim.x, instance.textureDim.y);
862
+ let scale0 = instance.matrixScale.x;
863
+ let rotate0 = instance.matrixScale.y;
864
+ let scale1 = instance.matrixScale.z;
865
+ let rotate1 = instance.matrixScale.w;
866
+ let transformedX = pos.x * scale0 + pos.y * scale1 + instance.matrixTx.x;
867
+ let transformedY = pos.x * rotate0 + pos.y * rotate1 + instance.matrixTx.y;
868
+ var position = vec2<f32>(transformedX, transformedY) / vec2<f32>(instance.textureDim.z, instance.textureDim.w);
869
+ position = position * 2.0 - 1.0;
870
+ output.position = vec4<f32>(position.x, -position.y, 0.0, 1.0);
871
+ output.mulColor = instance.mulColor;
872
+ output.addColor = instance.addColor;
873
+ return output;
874
+ }
875
+ \`,ka=\`
876
+ override yFlipSign: f32 = 1.0;
877
+
878
+ struct VertexInput {
879
+ @location(0) position: vec2<f32>,
880
+ @location(1) bezier: vec2<f32>,
881
+ }
882
+
883
+ struct VertexOutput {
884
+ @builtin(position) position: vec4<f32>,
885
+ @location(0) v_uv: vec2<f32>,
886
+ @location(1) bezier: vec2<f32>,
887
+ @location(2) color: vec4<f32>,
888
+ }
889
+
890
+ struct GradientUniforms {
891
+ inverseMatrix: mat3x3<f32>,
892
+ gradientType: f32,
893
+ focal: f32,
894
+ spread: f32,
895
+ radius: f32,
896
+ linearPoints: vec4<f32>,
897
+ color: vec4<f32>,
898
+ contextMatrix0: vec4<f32>,
899
+ contextMatrix1: vec4<f32>,
900
+ contextMatrix2: vec4<f32>,
901
+ }
902
+
903
+ @group(0) @binding(0) var<uniform> gradient: GradientUniforms;
904
+
905
+ @vertex
906
+ fn main(input: VertexInput) -> VertexOutput {
907
+ var output: VertexOutput;
908
+ let contextMatrix = mat3x3<f32>(gradient.contextMatrix0.xyz, gradient.contextMatrix1.xyz, gradient.contextMatrix2.xyz);
909
+ let pos = contextMatrix * vec3<f32>(input.position, 1.0);
910
+ let ndc = vec2<f32>(pos.x * 2.0 - 1.0, pos.y * 2.0 - 1.0);
911
+ output.position = vec4<f32>(ndc.x, ndc.y * yFlipSign, 0.0, 1.0);
912
+ let uvPos = gradient.inverseMatrix * vec3<f32>(input.position, 1.0);
913
+ output.v_uv = uvPos.xy;
914
+ output.bezier = input.bezier;
915
+ output.color = gradient.color;
916
+ return output;
917
+ }
918
+ \`,Ia=\`
919
+ override yFlipSign: f32 = 1.0;
920
+
921
+ struct VertexInput {
922
+ @location(0) position: vec2<f32>,
923
+ @location(1) bezier: vec2<f32>,
924
+ }
925
+
926
+ struct VertexOutput {
927
+ @builtin(position) position: vec4<f32>,
928
+ @location(0) bezier: vec2<f32>,
929
+ @location(1) color: vec4<f32>,
930
+ @location(2) worldPos: vec2<f32>,
931
+ }
932
+
933
+ struct BitmapUniforms {
934
+ bitmapMatrix: mat3x3<f32>,
935
+ width: f32,
936
+ height: f32,
937
+ repeat: f32,
938
+ _pad: f32,
939
+ color: vec4<f32>,
940
+ contextMatrix0: vec4<f32>,
941
+ contextMatrix1: vec4<f32>,
942
+ contextMatrix2: vec4<f32>,
943
+ }
944
+
945
+ @group(0) @binding(0) var<uniform> bitmap: BitmapUniforms;
946
+
947
+ @vertex
948
+ fn main(input: VertexInput) -> VertexOutput {
949
+ var output: VertexOutput;
950
+ let matrix = mat3x3<f32>(bitmap.contextMatrix0.xyz, bitmap.contextMatrix1.xyz, bitmap.contextMatrix2.xyz);
951
+ let transformedPos = matrix * vec3<f32>(input.position, 1.0);
952
+ let clipX = transformedPos.x * 2.0 - 1.0;
953
+ let clipY = (transformedPos.y * 2.0 - 1.0) * yFlipSign;
954
+ output.position = vec4<f32>(clipX, clipY, 0.0, 1.0);
955
+ output.bezier = input.bezier;
956
+ output.color = bitmap.color;
957
+ output.worldPos = input.position;
958
+ return output;
959
+ }
960
+ \`,Nt=\`
961
+ fn isInside(uv: vec2<f32>) -> f32 {
962
+ let s = step(vec2<f32>(0.0), uv) * step(uv, vec2<f32>(1.0));
963
+ return s.x * s.y;
964
+ }\`,lp=\`
965
+ const positions = array<vec2<f32>, 6>(
966
+ vec2<f32>(-1.0, -1.0),
967
+ vec2<f32>( 1.0, -1.0),
968
+ vec2<f32>(-1.0, 1.0),
969
+ vec2<f32>(-1.0, 1.0),
970
+ vec2<f32>( 1.0, -1.0),
971
+ vec2<f32>( 1.0, 1.0)
972
+ );\`,es=\`
973
+ const vertices = array<vec2<f32>, 6>(
974
+ vec2<f32>(0.0, 0.0),
975
+ vec2<f32>(1.0, 0.0),
976
+ vec2<f32>(0.0, 1.0),
977
+ vec2<f32>(0.0, 1.0),
978
+ vec2<f32>(1.0, 0.0),
979
+ vec2<f32>(1.0, 1.0)
980
+ );\`,Be=\`
981
+ struct VertexOutput {
982
+ @builtin(position) position: vec4<f32>,
983
+ @location(0) texCoord: vec2<f32>,
984
+ }\`,fo=t=>\`
985
+ \${Be}
986
+
987
+ @vertex
988
+ fn main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {
989
+ var output: VertexOutput;
990
+ \${lp}
991
+ var texCoords = array<vec2<f32>, 6>(
992
+ vec2<f32>(0.0, \${t?"1.0":"0.0"}),
993
+ vec2<f32>(1.0, \${t?"1.0":"0.0"}),
994
+ vec2<f32>(0.0, \${t?"0.0":"1.0"}),
995
+ vec2<f32>(0.0, \${t?"0.0":"1.0"}),
996
+ vec2<f32>(1.0, \${t?"1.0":"0.0"}),
997
+ vec2<f32>(1.0, \${t?"0.0":"1.0"})
998
+ );
999
+ output.position = vec4<f32>(positions[vertexIndex], 0.0, 1.0);
1000
+ output.texCoord = texCoords[vertexIndex];
1001
+ return output;
1002
+ }
1003
+ \`,up=fo(!0),fp=fo(!1),hp=fo(!1),dp=\`
1004
+ struct VertexInput {
1005
+ @location(0) position: vec2<f32>,
1006
+ }
1007
+
1008
+ struct VertexOutput {
1009
+ @builtin(position) position: vec4<f32>,
1010
+ }
1011
+
1012
+ @vertex
1013
+ fn main(input: VertexInput) -> VertexOutput {
1014
+ var output: VertexOutput;
1015
+ let ndc = input.position * 2.0 - 1.0;
1016
+ output.position = vec4<f32>(ndc.x, ndc.y, 0.0, 1.0);
1017
+ return output;
1018
+ }
1019
+ \`,pp=\`
1020
+ struct PositionUniforms {
1021
+ offset: vec2<f32>,
1022
+ size: vec2<f32>,
1023
+ viewport: vec2<f32>,
1024
+ padding: vec2<f32>,
1025
+ }
1026
+
1027
+ struct VertexOutput {
1028
+ @builtin(position) position: vec4<f32>,
1029
+ @location(0) texCoord: vec2<f32>,
1030
+ }
1031
+
1032
+ @group(0) @binding(0) var<uniform> uniforms: PositionUniforms;
1033
+
1034
+ @vertex
1035
+ fn main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {
1036
+ var output: VertexOutput;
1037
+ \${es}
1038
+ let vertex = vertices[vertexIndex];
1039
+ output.texCoord = vec2<f32>(vertex.x, 1.0 - vertex.y);
1040
+ var position = vertex * uniforms.size + uniforms.offset;
1041
+ position = position / uniforms.viewport;
1042
+ position = position * 2.0 - 1.0;
1043
+ output.position = vec4<f32>(position.x, -position.y, 0.0, 1.0);
1044
+ return output;
1045
+ }
1046
+ \`,mp=\`
1047
+ struct BitmapSyncUniforms {
1048
+ nodeRect: vec4<f32>,
1049
+ textureSize: vec2<f32>,
1050
+ padding: vec2<f32>,
1051
+ }
1052
+
1053
+ struct VertexOutput {
1054
+ @builtin(position) position: vec4<f32>,
1055
+ @location(0) texCoord: vec2<f32>,
1056
+ }
1057
+
1058
+ @group(0) @binding(0) var<uniform> uniforms: BitmapSyncUniforms;
1059
+
1060
+ @vertex
1061
+ fn main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {
1062
+ var output: VertexOutput;
1063
+ \${es}
1064
+ let vertex = vertices[vertexIndex];
1065
+ let pixelPos = vec2<f32>(
1066
+ uniforms.nodeRect.x + vertex.x * uniforms.nodeRect.z,
1067
+ uniforms.nodeRect.y + vertex.y * uniforms.nodeRect.w
1068
+ );
1069
+ let ndc = pixelPos / uniforms.textureSize * 2.0 - 1.0;
1070
+ output.position = vec4<f32>(ndc.x, -ndc.y, 0.0, 1.0);
1071
+ output.texCoord = pixelPos / uniforms.textureSize;
1072
+ return output;
1073
+ }
1074
+ \`,gp=\`
1075
+ struct ScaleUniforms {
1076
+ matrix: vec4<f32>,
1077
+ translate: vec2<f32>,
1078
+ srcSize: vec2<f32>,
1079
+ dstSize: vec2<f32>,
1080
+ padding: vec2<f32>,
1081
+ }
1082
+
1083
+ struct VertexOutput {
1084
+ @builtin(position) position: vec4<f32>,
1085
+ @location(0) texCoord: vec2<f32>,
1086
+ }
1087
+
1088
+ @group(0) @binding(0) var<uniform> uniforms: ScaleUniforms;
1089
+ \`,bp=\`
1090
+ var pos = vertex * uniforms.srcSize;
1091
+ let a = uniforms.matrix.x;
1092
+ let b = uniforms.matrix.y;
1093
+ let c = uniforms.matrix.z;
1094
+ let d = uniforms.matrix.w;
1095
+ let tx = uniforms.translate.x;
1096
+ let ty = uniforms.translate.y;
1097
+ let transformedX = pos.x * a + pos.y * c + tx;
1098
+ let transformedY = pos.x * b + pos.y * d + ty;
1099
+ var position = vec2<f32>(transformedX, transformedY) / uniforms.dstSize;
1100
+ position = position * 2.0 - 1.0;
1101
+ output.position = vec4<f32>(position.x, -position.y, 0.0, 1.0);
1102
+ \`,ho=t=>\`
1103
+ \${gp}
1104
+
1105
+ @vertex
1106
+ fn main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {
1107
+ var output: VertexOutput;
1108
+ \${es}
1109
+ let vertex = vertices[vertexIndex];
1110
+ output.texCoord = \${t?"vec2<f32>(vertex.x, 1.0 - vertex.y)":"vertex"};
1111
+ \${bp}
1112
+ return output;
1113
+ }
1114
+ \`,xp=ho(!1),yp=ho(!0),vp=ho(!1),_a=t=>\`
1115
+ struct PositionUniforms {
1116
+ offset: vec2<f32>,
1117
+ size: vec2<f32>,
1118
+ viewport: vec2<f32>,
1119
+ padding: vec2<f32>,
1120
+ }
1121
+
1122
+ struct VertexOutput {
1123
+ @builtin(position) position: vec4<f32>,
1124
+ @location(0) texCoord: vec2<f32>,
1125
+ }
1126
+
1127
+ @group(0) @binding(0) var<uniform> uniforms: PositionUniforms;
1128
+
1129
+ @vertex
1130
+ fn main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {
1131
+ var output: VertexOutput;
1132
+ \${es}
1133
+ let vertex = vertices[vertexIndex];
1134
+ output.texCoord = \${t?"vec2<f32>(vertex.x, 1.0 - vertex.y)":"vertex"};
1135
+ var position = vertex * uniforms.size + uniforms.offset;
1136
+ position = position / uniforms.viewport;
1137
+ position = position * 2.0 - 1.0;
1138
+ output.position = vec4<f32>(position.x, -position.y, 0.0, 1.0);
1139
+ return output;
1140
+ }
1141
+ \`,Mp=_a(!1),Sp=_a(!0),$p=\`
1142
+ struct FragmentInput {
1143
+ @builtin(position) position: vec4<f32>,
1144
+ @location(0) bezier: vec2<f32>,
1145
+ @location(1) color: vec4<f32>,
1146
+ }
1147
+
1148
+ @fragment
1149
+ fn main(input: FragmentInput) -> @location(0) vec4<f32> {
1150
+ let f_val = input.bezier.x * input.bezier.x - input.bezier.y;
1151
+ let dx = dpdx(f_val);
1152
+ let dy = dpdy(f_val);
1153
+
1154
+ if (input.bezier.x == 0.5 && input.bezier.y == 0.5) {
1155
+ return vec4<f32>(input.color.rgb * input.color.a, input.color.a);
1156
+ }
1157
+
1158
+ let dist = f_val * inverseSqrt(dx * dx + dy * dy);
1159
+ let coverage = smoothstep(0.5, -0.5, dist);
1160
+
1161
+ if (coverage <= 0.001) {
1162
+ discard;
1163
+ }
1164
+
1165
+ let finalAlpha = input.color.a * min(coverage, 1.0);
1166
+ return vec4<f32>(input.color.rgb * finalAlpha, finalAlpha);
1167
+ }
1168
+ \`,Tp=\`
1169
+ struct FragmentInput {
1170
+ @builtin(position) position: vec4<f32>,
1171
+ @location(0) bezier: vec2<f32>,
1172
+ }
1173
+
1174
+ @fragment
1175
+ fn main(input: FragmentInput) -> @location(0) vec4<f32> {
1176
+ let f_val = input.bezier.x * input.bezier.x - input.bezier.y;
1177
+ let dx = dpdx(f_val);
1178
+ let dy = dpdy(f_val);
1179
+ let dist = f_val * inverseSqrt(dx * dx + dy * dy);
1180
+ let alpha = smoothstep(0.5, -0.5, dist);
1181
+
1182
+ if (alpha <= 0.001) {
1183
+ discard;
1184
+ }
1185
+
1186
+ return vec4<f32>(0.0, 0.0, 0.0, min(alpha, 1.0));
1187
+ }
1188
+ \`,Bp=\`
1189
+ struct FragmentInput {
1190
+ @builtin(position) position: vec4<f32>,
1191
+ @location(0) color: vec4<f32>,
1192
+ }
1193
+
1194
+ @fragment
1195
+ fn main(input: FragmentInput) -> @location(0) vec4<f32> {
1196
+ let a = input.color.a;
1197
+ return vec4<f32>(input.color.r * a, input.color.g * a, input.color.b * a, a);
1198
+ }
1199
+ \`,Pp=\`
1200
+ struct FragmentInput {
1201
+ @location(0) bezier: vec2<f32>,
1202
+ }
1203
+
1204
+ @fragment
1205
+ fn main(input: FragmentInput) -> @location(0) vec4<f32> {
1206
+ let px = dpdx(input.bezier);
1207
+ let py = dpdy(input.bezier);
1208
+ let f = (2.0 * input.bezier.x) * vec2<f32>(px.x, py.x) - vec2<f32>(px.y, py.y);
1209
+ let alpha = 0.5 - (input.bezier.x * input.bezier.x - input.bezier.y) / length(f);
1210
+ if (alpha <= 0.0) {
1211
+ discard;
1212
+ }
1213
+ return vec4<f32>(min(alpha, 1.0));
1214
+ }
1215
+ \`,Ap=\`
1216
+ struct VertexOutput {
1217
+ @builtin(position) position: vec4<f32>,
1218
+ @location(0) texCoord: vec2<f32>,
1219
+ @location(1) color: vec4<f32>,
1220
+ }
1221
+
1222
+ @fragment
1223
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1224
+ return input.color;
1225
+ }
1226
+ \`,Fp=\`
1227
+ struct VertexOutput {
1228
+ @builtin(position) position: vec4<f32>,
1229
+ @location(0) texCoord: vec2<f32>,
1230
+ @location(1) color: vec4<f32>,
1231
+ }
1232
+
1233
+ @group(0) @binding(1) var textureSampler: sampler;
1234
+ @group(0) @binding(2) var textureData: texture_2d<f32>;
1235
+
1236
+ @fragment
1237
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1238
+ let textureColor = textureSampleLevel(textureData, textureSampler, input.texCoord, 0);
1239
+ return textureColor * input.color;
1240
+ }
1241
+ \`,wp=\`
1242
+ struct VertexOutput {
1243
+ @builtin(position) position: vec4<f32>,
1244
+ @location(0) texCoord: vec2<f32>,
1245
+ @location(1) mulColor: vec4<f32>,
1246
+ @location(2) addColor: vec4<f32>,
1247
+ }
1248
+
1249
+ @group(0) @binding(0) var textureSampler: sampler;
1250
+ @group(0) @binding(1) var textureData: texture_2d<f32>;
1251
+
1252
+ @fragment
1253
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1254
+ var src = textureSample(textureData, textureSampler, input.texCoord);
1255
+ src = vec4<f32>(src.rgb / max(0.0001, src.a), src.a);
1256
+ src = clamp(src * input.mulColor + input.addColor, vec4<f32>(0.0), vec4<f32>(1.0));
1257
+ src = vec4<f32>(src.rgb * src.a, src.a);
1258
+ return src;
1259
+ }
1260
+ \`,po=\`
1261
+ struct GradientUniforms {
1262
+ inverseMatrix: mat3x3<f32>,
1263
+ gradientType: f32,
1264
+ focal: f32,
1265
+ spread: f32,
1266
+ radius: f32,
1267
+ linearPoints: vec4<f32>,
1268
+ }
1269
+
1270
+ @group(0) @binding(0) var<uniform> gradient: GradientUniforms;
1271
+ @group(0) @binding(1) var gradientSampler: sampler;
1272
+ @group(0) @binding(2) var gradientTexture: texture_2d<f32>;
1273
+
1274
+ override GRADIENT_TYPE: u32 = 0u;
1275
+ override SPREAD_MODE: u32 = 2u;
1276
+
1277
+ fn applySpread(t: f32) -> f32 {
1278
+ if (SPREAD_MODE == 0u) {
1279
+ return 1.0 - abs(fract(t * 0.5) * 2.0 - 1.0);
1280
+ } else if (SPREAD_MODE == 1u) {
1281
+ return fract(t);
1282
+ } else {
1283
+ return clamp(t, 0.0, 1.0);
1284
+ }
1285
+ }
1286
+ \`,mo=\`
1287
+ var t: f32;
1288
+ if (GRADIENT_TYPE == 0u) {
1289
+ let a = gradient.linearPoints.xy;
1290
+ let b = gradient.linearPoints.zw;
1291
+ let ab = b - a;
1292
+ let ap = p - a;
1293
+ let dotAB = dot(ab, ab);
1294
+ if (dotAB < 0.0001) {
1295
+ t = 0.0;
1296
+ } else {
1297
+ t = dot(ab, ap) / dotAB;
1298
+ }
1299
+ } else {
1300
+ let r = gradient.radius;
1301
+ let coord = p / r;
1302
+ let focalRatio = gradient.focal;
1303
+
1304
+ if (abs(focalRatio) < 0.001) {
1305
+ t = length(coord);
1306
+ } else {
1307
+ let focal = vec2<f32>(focalRatio, 0.0);
1308
+ let diff = coord - focal;
1309
+ let lenDiff = length(diff);
1310
+
1311
+ if (lenDiff < 0.0001) {
1312
+ t = 0.0;
1313
+ } else {
1314
+ let dir = diff / lenDiff;
1315
+
1316
+ // Solve quadratic equation for unit circle intersection (a=1 since dir is normalized)
1317
+ let b_coef = 2.0 * dot(dir, focal);
1318
+ let c_coef = dot(focal, focal) - 1.0;
1319
+ let discriminant = b_coef * b_coef - 4.0 * c_coef;
1320
+ let x = (-b_coef + sqrt(max(discriminant, 0.0))) * 0.5;
1321
+ t = lenDiff / abs(x);
1322
+ }
1323
+ }
1324
+ }
1325
+ t = applySpread(t);
1326
+ let gradientColor = textureSampleLevel(gradientTexture, gradientSampler, vec2<f32>(t, 0.5), 0);
1327
+ \`,Op=\`
1328
+ struct VertexOutput {
1329
+ @builtin(position) position: vec4<f32>,
1330
+ @location(0) v_uv: vec2<f32>,
1331
+ @location(1) bezier: vec2<f32>,
1332
+ @location(2) color: vec4<f32>,
1333
+ }
1334
+ \${po}
1335
+
1336
+ @fragment
1337
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1338
+ let p = input.v_uv;
1339
+ \${mo}
1340
+ let result = gradientColor * input.color;
1341
+ return vec4<f32>(result.rgb * result.a, result.a);
1342
+ }
1343
+ \`,Ep=\`
1344
+ struct VertexOutput {
1345
+ @builtin(position) position: vec4<f32>,
1346
+ @location(0) v_uv: vec2<f32>,
1347
+ @location(1) bezier: vec2<f32>,
1348
+ @location(2) color: vec4<f32>,
1349
+ }
1350
+ \${po}
1351
+
1352
+ @fragment
1353
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1354
+ let p = input.v_uv;
1355
+ \${mo}
1356
+ return vec4<f32>(gradientColor.rgb * gradientColor.a, gradientColor.a);
1357
+ }
1358
+ \`,Rp=\`
1359
+ struct VertexOutput {
1360
+ @builtin(position) position: vec4<f32>,
1361
+ @location(0) texCoord: vec2<f32>,
1362
+ @location(1) color: vec4<f32>,
1363
+ }
1364
+ \${po}
1365
+
1366
+ @fragment
1367
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1368
+ let p = input.texCoord;
1369
+ \${mo}
1370
+ let result = gradientColor * input.color;
1371
+ return vec4<f32>(result.rgb * result.a, result.a);
1372
+ }
1373
+ \`,Cp=\`
1374
+ struct VertexOutput {
1375
+ @builtin(position) position: vec4<f32>,
1376
+ @location(0) bezier: vec2<f32>,
1377
+ @location(1) color: vec4<f32>,
1378
+ @location(2) worldPos: vec2<f32>,
1379
+ }
1380
+
1381
+ struct BitmapUniforms {
1382
+ bitmapMatrix: mat3x3<f32>,
1383
+ textureWidth: f32,
1384
+ textureHeight: f32,
1385
+ repeat: f32,
1386
+ _pad: f32,
1387
+ }
1388
+
1389
+ @group(0) @binding(0) var<uniform> uniforms: BitmapUniforms;
1390
+ @group(0) @binding(1) var bitmapSampler: sampler;
1391
+ @group(0) @binding(2) var bitmapTexture: texture_2d<f32>;
1392
+
1393
+ @fragment
1394
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1395
+ let u = input.bezier.x;
1396
+ let v = input.bezier.y;
1397
+ if (abs(u - 0.5) > 0.001 || abs(v - 0.5) > 0.001) {
1398
+ let d = u * u - v;
1399
+ if (d > 0.0) {
1400
+ discard;
1401
+ }
1402
+ }
1403
+ let transformedPos = uniforms.bitmapMatrix * vec3<f32>(input.worldPos, 1.0);
1404
+ var uv = vec2<f32>(
1405
+ transformedPos.x / uniforms.textureWidth,
1406
+ transformedPos.y / uniforms.textureHeight
1407
+ );
1408
+ if (uniforms.repeat > 0.5) {
1409
+ uv = fract(uv);
1410
+ }
1411
+ let bitmapColor = textureSampleLevel(bitmapTexture, bitmapSampler, uv, 0);
1412
+ let alpha = bitmapColor.a * input.color.a;
1413
+ return vec4<f32>(bitmapColor.rgb * input.color.a, alpha);
1414
+ }
1415
+ \`,Up=\`
1416
+ \${Be}
1417
+
1418
+ struct CopyUniforms {
1419
+ scale: vec2<f32>,
1420
+ offset: vec2<f32>,
1421
+ }
1422
+
1423
+ @group(0) @binding(0) var<uniform> uniforms: CopyUniforms;
1424
+ @group(0) @binding(1) var textureSampler: sampler;
1425
+ @group(0) @binding(2) var inputTexture: texture_2d<f32>;
1426
+
1427
+ @fragment
1428
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1429
+ let uv = input.texCoord * uniforms.scale + uniforms.offset;
1430
+ return textureSampleLevel(inputTexture, textureSampler, uv, 0);
1431
+ }
1432
+ \`,Gp=\`
1433
+ \${Be}
1434
+
1435
+ struct CopyUniforms {
1436
+ scale: vec2<f32>,
1437
+ offset: vec2<f32>,
1438
+ }
1439
+
1440
+ @group(0) @binding(0) var<uniform> uniforms: CopyUniforms;
1441
+ @group(0) @binding(1) var textureSampler: sampler;
1442
+ @group(0) @binding(2) var inputTexture: texture_2d<f32>;
1443
+
1444
+ @fragment
1445
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1446
+ let uv = (input.texCoord - uniforms.offset) * uniforms.scale;
1447
+ let clampedUv = clamp(uv, vec2<f32>(0.0), vec2<f32>(1.0));
1448
+ let color = textureSampleLevel(inputTexture, textureSampler, clampedUv, 0);
1449
+ let inBounds = uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0;
1450
+ return select(vec4<f32>(0.0, 0.0, 0.0, 0.0), color, inBounds);
1451
+ }
1452
+ \`,Lp=\`
1453
+ \${Be}
1454
+
1455
+ struct CopyUniforms {
1456
+ scale: vec2<f32>,
1457
+ offset: vec2<f32>,
1458
+ }
1459
+
1460
+ @group(0) @binding(0) var<uniform> uniforms: CopyUniforms;
1461
+ @group(0) @binding(1) var textureSampler: sampler;
1462
+ @group(0) @binding(2) var inputTexture: texture_2d<f32>;
1463
+
1464
+ @fragment
1465
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1466
+ let uv = input.texCoord * uniforms.scale + uniforms.offset;
1467
+ let clampedUv = clamp(uv, vec2<f32>(0.0), vec2<f32>(1.0));
1468
+ let color = textureSampleLevel(inputTexture, textureSampler, clampedUv, 0);
1469
+ let inBounds = uv.x >= 0.0 && uv.x <= 1.0 && uv.y >= 0.0 && uv.y <= 1.0;
1470
+ return select(vec4<f32>(0.0, 0.0, 0.0, 0.0), color, inBounds);
1471
+ }
1472
+ \`,kp=\`
1473
+ \${Be}
1474
+
1475
+ struct ColorTransformUniforms {
1476
+ mul: vec4<f32>,
1477
+ add: vec4<f32>,
1478
+ }
1479
+
1480
+ @group(0) @binding(0) var<uniform> ct: ColorTransformUniforms;
1481
+ @group(0) @binding(1) var textureSampler: sampler;
1482
+ @group(0) @binding(2) var inputTexture: texture_2d<f32>;
1483
+
1484
+ @fragment
1485
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1486
+ var color = textureSampleLevel(inputTexture, textureSampler, input.texCoord, 0);
1487
+
1488
+ color = vec4<f32>(color.rgb / max(vec3<f32>(0.0001), vec3<f32>(color.a)), color.a);
1489
+ color = clamp(color * ct.mul + ct.add, vec4<f32>(0.0), vec4<f32>(1.0));
1490
+ color = vec4<f32>(color.rgb * color.a, color.a);
1491
+
1492
+ return color;
1493
+ }
1494
+ \`,Ip=\`
1495
+ \${Be}
1496
+
1497
+ struct YFlipCTUniforms {
1498
+ scale: vec2<f32>,
1499
+ offset: vec2<f32>,
1500
+ mul: vec4<f32>,
1501
+ add: vec4<f32>,
1502
+ }
1503
+
1504
+ @group(0) @binding(0) var<uniform> uniforms: YFlipCTUniforms;
1505
+ @group(0) @binding(1) var textureSampler: sampler;
1506
+ @group(0) @binding(2) var inputTexture: texture_2d<f32>;
1507
+
1508
+ @fragment
1509
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1510
+ let uv = input.texCoord * uniforms.scale + uniforms.offset;
1511
+ var color = textureSampleLevel(inputTexture, textureSampler, uv, 0);
1512
+
1513
+ color = vec4<f32>(color.rgb / max(vec3<f32>(0.0001), vec3<f32>(color.a)), color.a);
1514
+ color = clamp(color * uniforms.mul + uniforms.add, vec4<f32>(0.0), vec4<f32>(1.0));
1515
+ color = vec4<f32>(color.rgb * color.a, color.a);
1516
+
1517
+ return color;
1518
+ }
1519
+ \`,_p=\`
1520
+ \${Be}
1521
+
1522
+ struct ColorMatrixUniforms {
1523
+ matrix: mat4x4<f32>,
1524
+ offset: vec4<f32>,
1525
+ }
1526
+
1527
+ @group(0) @binding(0) var<uniform> uniforms: ColorMatrixUniforms;
1528
+ @group(0) @binding(1) var textureSampler: sampler;
1529
+ @group(0) @binding(2) var inputTexture: texture_2d<f32>;
1530
+
1531
+ @fragment
1532
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1533
+ var color = textureSampleLevel(inputTexture, textureSampler, input.texCoord, 0);
1534
+
1535
+ color = vec4<f32>(color.rgb / max(vec3<f32>(0.0001), vec3<f32>(color.a)), color.a);
1536
+ var result = uniforms.matrix * color + uniforms.offset;
1537
+ result = clamp(result, vec4<f32>(0.0), vec4<f32>(1.0));
1538
+ result = vec4<f32>(result.rgb * result.a, result.a);
1539
+
1540
+ return result;
1541
+ }
1542
+ \`,Vp=\`
1543
+ @fragment
1544
+ fn main() -> @location(0) vec4<f32> {
1545
+ return vec4<f32>(0.0, 0.0, 0.0, 0.0);
1546
+ }
1547
+ \`,Dp=\`
1548
+ \${Be}
1549
+
1550
+ @group(0) @binding(1) var textureSampler: sampler;
1551
+ @group(0) @binding(2) var inputTexture: texture_2d<f32>;
1552
+
1553
+ @fragment
1554
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1555
+ return textureSampleLevel(inputTexture, textureSampler, input.texCoord, 0);
1556
+ }
1557
+ \`,Np=\`
1558
+ \${Be}
1559
+
1560
+ @group(0) @binding(1) var textureSampler: sampler;
1561
+ @group(0) @binding(2) var inputTexture: texture_2d<f32>;
1562
+
1563
+ @fragment
1564
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1565
+ return textureSampleLevel(inputTexture, textureSampler, input.texCoord, 0);
1566
+ }
1567
+ \`,zp=\`
1568
+ struct VertexOutput {
1569
+ @builtin(position) position: vec4<f32>,
1570
+ @location(0) texCoord: vec2<f32>,
1571
+ @location(1) color: vec4<f32>,
1572
+ }
1573
+
1574
+ struct BlendUniforms {
1575
+ blendMode: f32,
1576
+ }
1577
+
1578
+ @group(0) @binding(1) var<uniform> blend: BlendUniforms;
1579
+ @group(0) @binding(2) var srcSampler: sampler;
1580
+ @group(0) @binding(3) var srcTexture: texture_2d<f32>;
1581
+ @group(0) @binding(4) var dstSampler: sampler;
1582
+ @group(0) @binding(5) var dstTexture: texture_2d<f32>;
1583
+
1584
+ fn blendNormal(src: vec4<f32>, dst: vec4<f32>) -> vec4<f32> {
1585
+ return src;
1586
+ }
1587
+
1588
+ fn blendMultiply(src: vec4<f32>, dst: vec4<f32>) -> vec4<f32> {
1589
+ return src * dst;
1590
+ }
1591
+
1592
+ fn blendScreen(src: vec4<f32>, dst: vec4<f32>) -> vec4<f32> {
1593
+ return src + dst - src * dst;
1594
+ }
1595
+
1596
+ fn blendAdd(src: vec4<f32>, dst: vec4<f32>) -> vec4<f32> {
1597
+ return min(src + dst, vec4<f32>(1.0));
1598
+ }
1599
+
1600
+ @fragment
1601
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1602
+ let src = textureSampleLevel(srcTexture, srcSampler, input.texCoord, 0);
1603
+ let dst = textureSampleLevel(dstTexture, dstSampler, input.texCoord, 0);
1604
+ var result: vec4<f32>;
1605
+ if (blend.blendMode < 0.5) {
1606
+ result = blendNormal(src, dst);
1607
+ } else if (blend.blendMode < 1.5) {
1608
+ result = blendMultiply(src, dst);
1609
+ } else if (blend.blendMode < 2.5) {
1610
+ result = blendScreen(src, dst);
1611
+ } else {
1612
+ result = blendAdd(src, dst);
1613
+ }
1614
+ return result * input.color;
1615
+ }
1616
+ \`,Xp=\`
1617
+ \${Be}
1618
+
1619
+ override IS_INNER: u32 = 0u;
1620
+ override IS_KNOCKOUT: u32 = 0u;
1621
+
1622
+ struct GlowUniforms {
1623
+ color: vec4<f32>,
1624
+ baseScale: vec2<f32>,
1625
+ baseOffset: vec2<f32>,
1626
+ blurScale: vec2<f32>,
1627
+ blurOffset: vec2<f32>,
1628
+ strength: f32,
1629
+ _padding1: f32,
1630
+ _padding2: f32,
1631
+ _padding3: f32,
1632
+ }
1633
+
1634
+ @group(0) @binding(0) var<uniform> uniforms: GlowUniforms;
1635
+ @group(0) @binding(1) var textureSampler: sampler;
1636
+ @group(0) @binding(2) var blurTexture: texture_2d<f32>;
1637
+ @group(0) @binding(3) var baseTexture: texture_2d<f32>;
1638
+ \${Nt}
1639
+
1640
+ @fragment
1641
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1642
+ let baseUV = input.texCoord * uniforms.baseScale - uniforms.baseOffset;
1643
+ let baseColor = textureSampleLevel(baseTexture, textureSampler, baseUV, 0) * isInside(baseUV);
1644
+
1645
+ let blurUV = input.texCoord * uniforms.blurScale - uniforms.blurOffset;
1646
+ let blurColor = textureSampleLevel(blurTexture, textureSampler, blurUV, 0) * isInside(blurUV);
1647
+
1648
+ var rawAlpha = blurColor.a;
1649
+ if (IS_INNER == 1u) {
1650
+ rawAlpha = 1.0 - rawAlpha;
1651
+ }
1652
+ let glowAlpha = clamp(rawAlpha * uniforms.strength, 0.0, 1.0);
1653
+ let glowColor = vec4<f32>(uniforms.color.rgb * glowAlpha, uniforms.color.a * glowAlpha);
1654
+ if (IS_INNER == 1u) {
1655
+ let innerGlow = glowColor * baseColor.a;
1656
+ if (IS_KNOCKOUT == 1u) {
1657
+ return innerGlow;
1658
+ } else {
1659
+ return innerGlow + baseColor * (1.0 - glowColor.a);
1660
+ }
1661
+ } else {
1662
+ if (IS_KNOCKOUT == 1u) {
1663
+ return glowColor * (1.0 - baseColor.a);
1664
+ } else {
1665
+ return baseColor + glowColor * (1.0 - baseColor.a);
1666
+ }
1667
+ }
1668
+ }
1669
+ \`,Yp=\`
1670
+ \${Be}
1671
+
1672
+ override IS_INNER: u32 = 0u;
1673
+ override IS_KNOCKOUT: u32 = 0u;
1674
+ override IS_HIDE_OBJECT: u32 = 0u;
1675
+
1676
+ struct DropShadowUniforms {
1677
+ color: vec4<f32>,
1678
+ baseScale: vec2<f32>,
1679
+ baseOffset: vec2<f32>,
1680
+ blurScale: vec2<f32>,
1681
+ blurOffset: vec2<f32>,
1682
+ strength: f32,
1683
+ _padding1: f32,
1684
+ _padding2: f32,
1685
+ _padding3: f32,
1686
+ }
1687
+
1688
+ @group(0) @binding(0) var<uniform> uniforms: DropShadowUniforms;
1689
+ @group(0) @binding(1) var textureSampler: sampler;
1690
+ @group(0) @binding(2) var blurTexture: texture_2d<f32>;
1691
+ @group(0) @binding(3) var baseTexture: texture_2d<f32>;
1692
+ \${Nt}
1693
+
1694
+ @fragment
1695
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1696
+ let baseUV = input.texCoord * uniforms.baseScale - uniforms.baseOffset;
1697
+ let baseColor = textureSampleLevel(baseTexture, textureSampler, baseUV, 0) * isInside(baseUV);
1698
+
1699
+ let blurUV = input.texCoord * uniforms.blurScale - uniforms.blurOffset;
1700
+ let blur = textureSampleLevel(blurTexture, textureSampler, blurUV, 0) * isInside(blurUV);
1701
+
1702
+ var rawAlpha = blur.a;
1703
+ if (IS_INNER == 1u) {
1704
+ rawAlpha = 1.0 - rawAlpha;
1705
+ }
1706
+ let shadowAlpha = clamp(rawAlpha * uniforms.strength, 0.0, 1.0);
1707
+ let shadowColor = vec4<f32>(uniforms.color.rgb * shadowAlpha, uniforms.color.a * shadowAlpha);
1708
+
1709
+ if (IS_INNER == 1u) {
1710
+ let innerShadow = shadowColor * baseColor.a;
1711
+ if (IS_KNOCKOUT == 1u) {
1712
+ return innerShadow;
1713
+ } else {
1714
+ return innerShadow + baseColor * (1.0 - shadowColor.a);
1715
+ }
1716
+ } else {
1717
+ if (IS_HIDE_OBJECT == 1u) {
1718
+ return shadowColor;
1719
+ } else if (IS_KNOCKOUT == 1u) {
1720
+ return shadowColor * (1.0 - baseColor.a);
1721
+ } else {
1722
+ return shadowColor * (1.0 - baseColor.a) + baseColor;
1723
+ }
1724
+ }
1725
+ }
1726
+ \`,Wp=\`
1727
+ \${Be}
1728
+
1729
+ override GLOW_TYPE: u32 = 0u;
1730
+ override IS_KNOCKOUT: u32 = 0u;
1731
+
1732
+ struct GradientGlowUniforms {
1733
+ strength: f32,
1734
+ _padding1: f32,
1735
+ _padding2: f32,
1736
+ _padding3: f32,
1737
+ baseScale: vec2<f32>,
1738
+ baseOffset: vec2<f32>,
1739
+ blurScale: vec2<f32>,
1740
+ blurOffset: vec2<f32>,
1741
+ }
1742
+
1743
+ @group(0) @binding(0) var<uniform> uniforms: GradientGlowUniforms;
1744
+ @group(0) @binding(1) var textureSampler: sampler;
1745
+ @group(0) @binding(2) var blurTexture: texture_2d<f32>;
1746
+ @group(0) @binding(3) var baseTexture: texture_2d<f32>;
1747
+ @group(0) @binding(4) var gradientLUT: texture_2d<f32>;
1748
+ \${Nt}
1749
+
1750
+ @fragment
1751
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1752
+ let baseUV = input.texCoord * uniforms.baseScale - uniforms.baseOffset;
1753
+ let base = textureSampleLevel(baseTexture, textureSampler, baseUV, 0) * isInside(baseUV);
1754
+
1755
+ let blurUV = input.texCoord * uniforms.blurScale - uniforms.blurOffset;
1756
+ var blur = textureSampleLevel(blurTexture, textureSampler, blurUV, 0) * isInside(blurUV);
1757
+
1758
+ blur.a = clamp(blur.a * uniforms.strength, 0.0, 1.0);
1759
+ let glowColor = textureSampleLevel(gradientLUT, textureSampler, vec2<f32>(blur.a, 0.5), 0);
1760
+ var result: vec4<f32>;
1761
+ if (GLOW_TYPE == 0u) {
1762
+ if (IS_KNOCKOUT == 1u) {
1763
+ result = glowColor;
1764
+ } else {
1765
+ result = base - base * glowColor.a + glowColor;
1766
+ }
1767
+ } else if (GLOW_TYPE == 1u) {
1768
+ if (IS_KNOCKOUT == 1u) {
1769
+ result = glowColor * base.a;
1770
+ } else {
1771
+ result = glowColor * base.a + base * (1.0 - glowColor.a);
1772
+ }
1773
+ } else {
1774
+ if (IS_KNOCKOUT == 1u) {
1775
+ result = glowColor - glowColor * base.a;
1776
+ } else {
1777
+ result = base + glowColor - glowColor * base.a;
1778
+ }
1779
+ }
1780
+ return result;
1781
+ }
1782
+ \`,jp=\`
1783
+ \${Be}
1784
+
1785
+ override BEVEL_TYPE: u32 = 0u;
1786
+ override IS_KNOCKOUT: u32 = 0u;
1787
+
1788
+ struct GradientBevelUniforms {
1789
+ strength: f32,
1790
+ _padding1: f32,
1791
+ _padding2: f32,
1792
+ _padding3: f32,
1793
+ baseScale: vec2<f32>,
1794
+ baseOffset: vec2<f32>,
1795
+ blurScale: vec2<f32>,
1796
+ blurOffset: vec2<f32>,
1797
+ }
1798
+
1799
+ @group(0) @binding(0) var<uniform> uniforms: GradientBevelUniforms;
1800
+ @group(0) @binding(1) var textureSampler: sampler;
1801
+ @group(0) @binding(2) var blurTexture: texture_2d<f32>;
1802
+ @group(0) @binding(3) var baseTexture: texture_2d<f32>;
1803
+ @group(0) @binding(4) var gradientLUT: texture_2d<f32>;
1804
+ \${Nt}
1805
+
1806
+ @fragment
1807
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1808
+ let baseUV = input.texCoord * uniforms.baseScale - uniforms.baseOffset;
1809
+ let base = textureSampleLevel(baseTexture, textureSampler, baseUV, 0) * isInside(baseUV);
1810
+
1811
+ let blurUV = input.texCoord * uniforms.blurScale - uniforms.blurOffset;
1812
+ let blur1 = textureSampleLevel(blurTexture, textureSampler, blurUV, 0) * isInside(blurUV);
1813
+
1814
+ let mirrorUV = (1.0 - input.texCoord) * uniforms.blurScale - uniforms.blurOffset;
1815
+ let blur2 = textureSampleLevel(blurTexture, textureSampler, mirrorUV, 0) * isInside(mirrorUV);
1816
+
1817
+ var highlightAlpha = blur1.a - blur2.a;
1818
+ var shadowAlpha = blur2.a - blur1.a;
1819
+ highlightAlpha = clamp(highlightAlpha * uniforms.strength, 0.0, 1.0);
1820
+ shadowAlpha = clamp(shadowAlpha * uniforms.strength, 0.0, 1.0);
1821
+
1822
+ let lutCoord = 0.5019607843137255 - 0.5019607843137255 * shadowAlpha + 0.4980392156862745 * highlightAlpha;
1823
+ let bevelColor = textureSampleLevel(gradientLUT, textureSampler, vec2<f32>(lutCoord, 0.5), 0);
1824
+
1825
+ var result: vec4<f32>;
1826
+ if (BEVEL_TYPE == 0u) {
1827
+ if (IS_KNOCKOUT == 1u) {
1828
+ result = bevelColor;
1829
+ } else {
1830
+ result = base - base * bevelColor.a + bevelColor;
1831
+ }
1832
+ } else if (BEVEL_TYPE == 1u) {
1833
+ if (IS_KNOCKOUT == 1u) {
1834
+ result = bevelColor * base.a;
1835
+ } else {
1836
+ result = bevelColor * base.a + base * (1.0 - bevelColor.a);
1837
+ }
1838
+ } else {
1839
+ if (IS_KNOCKOUT == 1u) {
1840
+ result = bevelColor - bevelColor * base.a;
1841
+ } else {
1842
+ result = base + bevelColor - bevelColor * base.a;
1843
+ }
1844
+ }
1845
+
1846
+ return result;
1847
+ }
1848
+ \`,Hp=\`
1849
+ \${Be}
1850
+
1851
+ override BEVEL_TYPE: u32 = 0u;
1852
+ override IS_KNOCKOUT: u32 = 0u;
1853
+
1854
+ struct BevelUniforms {
1855
+ highlightColor: vec4<f32>,
1856
+ shadowColor: vec4<f32>,
1857
+ strength: f32,
1858
+ _padding1: f32,
1859
+ _padding2: f32,
1860
+ _padding3: f32,
1861
+ baseScale: vec2<f32>,
1862
+ baseOffset: vec2<f32>,
1863
+ blurScale: vec2<f32>,
1864
+ blurOffset: vec2<f32>,
1865
+ }
1866
+
1867
+ @group(0) @binding(0) var<uniform> uniforms: BevelUniforms;
1868
+ @group(0) @binding(1) var textureSampler: sampler;
1869
+ @group(0) @binding(2) var blurTexture: texture_2d<f32>;
1870
+ @group(0) @binding(3) var baseTexture: texture_2d<f32>;
1871
+ \${Nt}
1872
+
1873
+ @fragment
1874
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1875
+ let baseUV = input.texCoord * uniforms.baseScale - uniforms.baseOffset;
1876
+ let base = textureSampleLevel(baseTexture, textureSampler, baseUV, 0) * isInside(baseUV);
1877
+
1878
+ let blurUV = input.texCoord * uniforms.blurScale - uniforms.blurOffset;
1879
+ let blur1 = textureSampleLevel(blurTexture, textureSampler, blurUV, 0) * isInside(blurUV);
1880
+
1881
+ let mirrorUV = (1.0 - input.texCoord) * uniforms.blurScale - uniforms.blurOffset;
1882
+ let blur2 = textureSampleLevel(blurTexture, textureSampler, mirrorUV, 0) * isInside(mirrorUV);
1883
+
1884
+ var highlightAlpha = blur1.a - blur2.a;
1885
+ var shadowAlpha = blur2.a - blur1.a;
1886
+ highlightAlpha = clamp(highlightAlpha * uniforms.strength, 0.0, 1.0);
1887
+ shadowAlpha = clamp(shadowAlpha * uniforms.strength, 0.0, 1.0);
1888
+
1889
+ let bevelColor = uniforms.highlightColor * highlightAlpha + uniforms.shadowColor * shadowAlpha;
1890
+ var result: vec4<f32>;
1891
+ if (BEVEL_TYPE == 0u) {
1892
+ if (IS_KNOCKOUT == 1u) {
1893
+ result = bevelColor;
1894
+ } else {
1895
+ result = base - base * bevelColor.a + bevelColor;
1896
+ }
1897
+ } else if (BEVEL_TYPE == 1u) {
1898
+ if (IS_KNOCKOUT == 1u) {
1899
+ result = bevelColor * base.a;
1900
+ } else {
1901
+ result = bevelColor * base.a + base * (1.0 - bevelColor.a);
1902
+ }
1903
+ } else {
1904
+ if (IS_KNOCKOUT == 1u) {
1905
+ result = bevelColor - bevelColor * base.a;
1906
+ } else {
1907
+ result = base + bevelColor - bevelColor * base.a;
1908
+ }
1909
+ }
1910
+
1911
+ return result;
1912
+ }
1913
+ \`,Kp=\`
1914
+ \${Be}
1915
+
1916
+ struct BevelBaseUniforms {
1917
+ offset: vec2<f32>,
1918
+ _padding: vec2<f32>,
1919
+ }
1920
+
1921
+ @group(0) @binding(0) var<uniform> uniforms: BevelBaseUniforms;
1922
+ @group(0) @binding(1) var textureSampler: sampler;
1923
+ @group(0) @binding(2) var sourceTexture: texture_2d<f32>;
1924
+ \${Nt}
1925
+
1926
+ @fragment
1927
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1928
+ let original = textureSampleLevel(sourceTexture, textureSampler, input.texCoord, 0);
1929
+ let shiftedUV = input.texCoord - uniforms.offset;
1930
+ let shifted = textureSampleLevel(sourceTexture, textureSampler, shiftedUV, 0) * isInside(shiftedUV);
1931
+ return original * (1.0 - shifted.a);
1932
+ }
1933
+ \`;class N{static getFillVertexShader(){return Ca}static getFillMainVertexShader(){return Ca}static getFillFragmentShader(){return $p}static getStencilWriteVertexShader(){return Ua}static getStencilWriteMainVertexShader(){return Ua}static getStencilWriteFragmentShader(){return Tp}static getStencilFillVertexShader(){return Ga}static getStencilFillMainVertexShader(){return Ga}static getStencilFillFragmentShader(){return Bp}static getMaskVertexShader(){return ap}static getMaskFragmentShader(){return Pp}static getBasicVertexShader(){return La}static getBasicMainVertexShader(){return La}static getBasicFragmentShader(){return Ap}static getTextureFragmentShader(){return Fp}static getInstancedVertexShader(){return cp}static getInstancedFragmentShader(){return wp}static getGradientFillVertexShader(){return ka}static getGradientFillMainVertexShader(){return ka}static getGradientFillFragmentShader(){return Op}static getGradientFillStencilFragmentShader(){return Ep}static getGradientFragmentShader(){return Rp}static getBitmapFillVertexShader(){return Ia}static getBitmapFillMainVertexShader(){return Ia}static getBitmapFillFragmentShader(){return Cp}static getBlendFragmentShader(){return zp}static getBlurFilterVertexShader(){return up}static getBitmapSyncVertexShader(){return mp}static getBitmapSyncFragmentShader(){return Np}static getBlurFilterFragmentShader(e){const r=e.toFixed(1);return\`
1934
+ \${Be}
1935
+
1936
+ struct BlurUniforms {
1937
+ offset: vec2<f32>,
1938
+ fraction: f32,
1939
+ samples: f32,
1940
+ }
1941
+
1942
+ @group(0) @binding(0) var<uniform> uniforms: BlurUniforms;
1943
+ @group(0) @binding(1) var textureSampler: sampler;
1944
+ @group(0) @binding(2) var inputTexture: texture_2d<f32>;
1945
+
1946
+ @fragment
1947
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
1948
+ let offset = uniforms.offset;
1949
+ let fraction = uniforms.fraction;
1950
+ let samples = uniforms.samples;
1951
+ var color = textureSample(inputTexture, textureSampler, input.texCoord);
1952
+ for (var i: f32 = 1.0; i < \${r}; i += 1.0) {
1953
+ color += textureSample(inputTexture, textureSampler, input.texCoord + offset * i);
1954
+ color += textureSample(inputTexture, textureSampler, input.texCoord - offset * i);
1955
+ }
1956
+ color += textureSample(inputTexture, textureSampler, input.texCoord + offset * \${r}) * fraction;
1957
+ color += textureSample(inputTexture, textureSampler, input.texCoord - offset * \${r}) * fraction;
1958
+ color /= samples;
1959
+ return color;
1960
+ }
1961
+ \`}static getTextureCopyFragmentShader(){return Up}static getBlurTextureCopyFragmentShader(){return Gp}static getFilterOutputFragmentShader(){return Lp}static getColorTransformFragmentShader(){return kp}static getYFlipColorTransformFragmentShader(){return Ip}static getColorMatrixFilterFragmentShader(){return _p}static getGlowFilterFragmentShader(){return Xp}static getDropShadowFilterFragmentShader(){return Yp}static getGradientGlowFilterFragmentShader(){return Wp}static getGradientBevelFilterFragmentShader(){return jp}static getBevelFilterFragmentShader(){return Hp}static getBevelBaseFragmentShader(){return Kp}static getConvolutionFilterFragmentShader(e,r,n=!0,s=!0){const o=Math.floor(e*.5),i=Math.floor(r*.5),l=e*r;let c="";for(let h=0;h<l;h++)c+=\`
1962
+ result = result + getWeightedColor(\${h}, getMatrixWeight(\${h}));\`;const u=n?"result.a = textureSample(sourceTexture, sourceSampler, input.texCoord).a;":"",a=s?"":\`
1963
+ let substituteColor = uniforms.substituteColor;
1964
+ color = mix(substituteColor, color, isInside(uv));\`;return\`
1965
+ struct ConvolutionUniforms {
1966
+ rcpSize: vec2<f32>,
1967
+ rcpDivisor: f32,
1968
+ bias: f32,
1969
+ substituteColor: vec4<f32>,
1970
+ matrix: array<vec4<f32>, \${Math.ceil(l/4)}>,
1971
+ }
1972
+
1973
+ @group(0) @binding(0) var<uniform> uniforms: ConvolutionUniforms;
1974
+ @group(0) @binding(1) var sourceSampler: sampler;
1975
+ @group(0) @binding(2) var sourceTexture: texture_2d<f32>;
1976
+
1977
+ \${Be}
1978
+
1979
+ \${Nt}
1980
+
1981
+ fn getMatrixWeight(index: i32) -> f32 {
1982
+ let vecIndex = index / 4;
1983
+ let component = index % 4;
1984
+ let vec = uniforms.matrix[vecIndex];
1985
+ if (component == 0) { return vec.x; }
1986
+ else if (component == 1) { return vec.y; }
1987
+ else if (component == 2) { return vec.z; }
1988
+ else { return vec.w; }
1989
+ }
1990
+
1991
+ fn getWeightedColor(i: i32, weight: f32) -> vec4<f32> {
1992
+ let rcpSize = uniforms.rcpSize;
1993
+ let iDivX = i / \${e};
1994
+ let iModX = i - \${e} * iDivX;
1995
+ let offset = vec2<f32>(f32(iModX - \${o}), f32(\${i} - iDivX));
1996
+ var uv = input.texCoord + offset * rcpSize;
1997
+ var color = textureSample(sourceTexture, sourceSampler, uv);
1998
+ color = vec4<f32>(color.rgb / max(0.0001, color.a), color.a);
1999
+ \${a}
2000
+ return color * weight;
2001
+ }
2002
+
2003
+ var<private> input: VertexOutput;
2004
+
2005
+ @vertex
2006
+ fn vs_main(@builtin(vertex_index) vertexIndex: u32) -> VertexOutput {
2007
+ var positions = array<vec2<f32>, 6>(
2008
+ vec2<f32>(-1.0, -1.0),
2009
+ vec2<f32>(1.0, -1.0),
2010
+ vec2<f32>(-1.0, 1.0),
2011
+ vec2<f32>(-1.0, 1.0),
2012
+ vec2<f32>(1.0, -1.0),
2013
+ vec2<f32>(1.0, 1.0)
2014
+ );
2015
+ var texCoords = array<vec2<f32>, 6>(
2016
+ vec2<f32>(0.0, 1.0),
2017
+ vec2<f32>(1.0, 1.0),
2018
+ vec2<f32>(0.0, 0.0),
2019
+ vec2<f32>(0.0, 0.0),
2020
+ vec2<f32>(1.0, 1.0),
2021
+ vec2<f32>(1.0, 0.0)
2022
+ );
2023
+ var output: VertexOutput;
2024
+ output.position = vec4<f32>(positions[vertexIndex], 0.0, 1.0);
2025
+ output.texCoord = texCoords[vertexIndex];
2026
+ return output;
2027
+ }
2028
+
2029
+ @fragment
2030
+ fn fs_main(fragInput: VertexOutput) -> @location(0) vec4<f32> {
2031
+ input = fragInput;
2032
+ let rcpDivisor = uniforms.rcpDivisor;
2033
+ let bias = uniforms.bias;
2034
+ var result = vec4<f32>(0.0);
2035
+ \${c}
2036
+ result = clamp(result * rcpDivisor + bias, vec4<f32>(0.0), vec4<f32>(1.0));
2037
+ \${u}
2038
+ result = vec4<f32>(result.rgb * result.a, result.a);
2039
+ return result;
2040
+ }
2041
+ \`}static getComplexBlendFragmentShader(){return N.getUnifiedComplexBlendFragmentShader()}static getBlendModeIndex(e){switch(e){case"subtract":return 0;case"multiply":return 1;case"lighten":return 2;case"darken":return 3;case"overlay":return 4;case"hardlight":return 5;case"difference":return 6;case"invert":return 7;default:return 1}}static getUnifiedComplexBlendFragmentShader(){return\`
2042
+ \${Be}
2043
+
2044
+ struct BlendUniforms {
2045
+ mulColor: vec4<f32>,
2046
+ addColor: vec4<f32>,
2047
+ blendMode: f32,
2048
+ _pad0: f32,
2049
+ _pad1: f32,
2050
+ _pad2: f32,
2051
+ }
2052
+
2053
+ @group(0) @binding(0) var<uniform> uniforms: BlendUniforms;
2054
+ @group(0) @binding(1) var textureSampler: sampler;
2055
+ @group(0) @binding(2) var dstTexture: texture_2d<f32>;
2056
+ @group(0) @binding(3) var srcTexture: texture_2d<f32>;
2057
+
2058
+ fn blend(src: vec4<f32>, dst: vec4<f32>, mode: i32) -> vec4<f32> {
2059
+ if (src.a == 0.0) { return dst; }
2060
+ if (dst.a == 0.0) { return src; }
2061
+
2062
+ let a = src - src * dst.a;
2063
+ let b = dst - dst * src.a;
2064
+
2065
+ if (mode == 1) {
2066
+ let c = src * dst;
2067
+ return a + b + c;
2068
+ }
2069
+
2070
+ let srcRgb = src.rgb / src.a;
2071
+ let dstRgb = dst.rgb / dst.a;
2072
+
2073
+ var blended: vec3<f32>;
2074
+
2075
+ switch (mode) {
2076
+ case 0: {
2077
+ blended = dstRgb - srcRgb;
2078
+ }
2079
+ case 2: {
2080
+ blended = mix(srcRgb, dstRgb, step(srcRgb, dstRgb));
2081
+ }
2082
+ case 3: {
2083
+ blended = mix(srcRgb, dstRgb, step(dstRgb, srcRgb));
2084
+ }
2085
+ case 4: {
2086
+ let mul = srcRgb * dstRgb;
2087
+ let c1 = 2.0 * mul;
2088
+ let c2 = 2.0 * (srcRgb + dstRgb - mul) - 1.0;
2089
+ blended = mix(c1, c2, step(vec3<f32>(0.5), dstRgb));
2090
+ }
2091
+ case 5: {
2092
+ let mul = srcRgb * dstRgb;
2093
+ let c1 = 2.0 * mul;
2094
+ let c2 = 2.0 * (srcRgb + dstRgb - mul) - 1.0;
2095
+ blended = mix(c1, c2, step(vec3<f32>(0.5), srcRgb));
2096
+ }
2097
+ case 6: {
2098
+ blended = abs(srcRgb - dstRgb);
2099
+ }
2100
+ case 7: {
2101
+ let ib = dst - dst * src.a;
2102
+ let ic = vec4<f32>(src.a - dst.rgb * src.a, src.a);
2103
+ return ib + ic;
2104
+ }
2105
+ default: {
2106
+ blended = srcRgb;
2107
+ }
2108
+ }
2109
+
2110
+ var c = vec4<f32>(blended, src.a * dst.a);
2111
+ c = vec4<f32>(c.rgb * c.a, c.a);
2112
+ return a + b + c;
2113
+ }
2114
+
2115
+ @fragment
2116
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
2117
+ var dst = textureSample(dstTexture, textureSampler, input.texCoord);
2118
+ var src = textureSample(srcTexture, textureSampler, input.texCoord);
2119
+ let mul = uniforms.mulColor;
2120
+ let add = uniforms.addColor;
2121
+ if (mul.x != 1.0 || mul.y != 1.0 || mul.z != 1.0 || mul.w != 1.0
2122
+ || add.x != 0.0 || add.y != 0.0 || add.z != 0.0) {
2123
+ src = vec4<f32>(src.rgb / max(vec3<f32>(0.0001), vec3<f32>(src.a)), src.a);
2124
+ src = clamp(src * mul + add, vec4<f32>(0.0), vec4<f32>(1.0));
2125
+ src = vec4<f32>(src.rgb * src.a, src.a);
2126
+ }
2127
+ return blend(src, dst, i32(uniforms.blendMode));
2128
+ }
2129
+ \`}static getDisplacementMapFilterFragmentShader(e,r,n){let s,o;switch(e){case 1:s="mapColor.r";break;case 2:s="mapColor.g";break;case 4:s="mapColor.b";break;case 8:s="mapColor.a";break;default:s="0.5";break}switch(r){case 1:o="mapColor.r";break;case 2:o="mapColor.g";break;case 4:o="mapColor.b";break;case 8:o="mapColor.a";break;default:o="0.5";break}let i,l=!1;switch(n){case 0:i=\`
2130
+ sourceColor = textureSample(srcTexture, textureSampler, uv);
2131
+ \`;break;case 1:l=!0,i=\`
2132
+ sourceColor = mix(uniforms.substituteColor, textureSample(srcTexture, textureSampler, uv), isInside(uv));
2133
+ \`;break;case 2:i=\`
2134
+ sourceColor = textureSample(srcTexture, textureSampler, fract(uv));
2135
+ \`;break;case 3:i=\`
2136
+ let insideUV = step(abs(uv - vec2<f32>(0.5)), vec2<f32>(0.5));
2137
+ sourceColor = textureSample(srcTexture, textureSampler, mix(input.texCoord, uv, insideUV));
2138
+ \`;break;default:i=\`
2139
+ sourceColor = textureSample(srcTexture, textureSampler, fract(uv));
2140
+ \`;break}return\`
2141
+ \${Be}
2142
+
2143
+ \${l?\`struct DisplacementUniforms {
2144
+ uvToStScale: vec2<f32>,
2145
+ uvToStOffset: vec2<f32>,
2146
+ scale: vec2<f32>,
2147
+ padding: vec2<f32>,
2148
+ substituteColor: vec4<f32>,
2149
+ }\`:\`struct DisplacementUniforms {
2150
+ uvToStScale: vec2<f32>,
2151
+ uvToStOffset: vec2<f32>,
2152
+ scale: vec2<f32>,
2153
+ padding: vec2<f32>,
2154
+ }\`}
2155
+
2156
+ @group(0) @binding(0) var<uniform> uniforms: DisplacementUniforms;
2157
+ @group(0) @binding(1) var textureSampler: sampler;
2158
+ @group(0) @binding(2) var srcTexture: texture_2d<f32>;
2159
+ @group(0) @binding(3) var mapTexture: texture_2d<f32>;
2160
+
2161
+ \${Nt}
2162
+
2163
+ @fragment
2164
+ fn main(input: VertexOutput) -> @location(0) vec4<f32> {
2165
+ let stCoord = vec2<f32>(input.texCoord.x, 1.0 - input.texCoord.y);
2166
+ let st = stCoord * uniforms.uvToStScale - uniforms.uvToStOffset;
2167
+ let mapColor = textureSample(mapTexture, textureSampler, vec2<f32>(st.x, 1.0 - st.y));
2168
+ let offset = vec2<f32>(\${s}, \${o}) - 0.5;
2169
+ let uv = input.texCoord + offset * uniforms.scale;
2170
+ var sourceColor: vec4<f32>;
2171
+ \${i}
2172
+ return mix(textureSample(srcTexture, textureSampler, input.texCoord), sourceColor, isInside(st));
2173
+ }
2174
+ \`}static getNodeClearVertexShader(){return dp}static getNodeClearFragmentShader(){return Vp}static getPositionedTextureVertexShader(){return pp}static getTextureScaleVertexShader(){return xp}static getTextureScaleBlendVertexShader(){return yp}static getComplexBlendScaleVertexShader(){return vp}static getComplexBlendVertexShader(){return fp}static getComplexBlendCopyVertexShader(){return hp}static getComplexBlendOutputVertexShader(){return Mp}static getFilterComplexBlendOutputVertexShader(){return Sp}static getPositionedTextureFragmentShader(){return Dp}}const rr={arrayStride:16,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]},un={color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};class qp{device;format;pipelines;bindGroupLayouts;sampleCount;shaderModuleCache=new Map;filterBindGroupLayouts=new Map;constructor(e,r){this.device=e,this.format=r,this.pipelines=new Map,this.bindGroupLayouts=new Map,this.sampleCount=ao,this.initialize()}getOrCreateShaderModule(e,r){let n=this.shaderModuleCache.get(e);return n||(n=this.device.createShaderModule({code:r}),this.shaderModuleCache.set(e,n)),n}initialize(){this.createFillPipeline(),this.createStencilFillPipelines(),this.createClipPipeline(),this.createMaskUnionPipelines(),this.createMaskPipeline(),this.createBasicPipeline(),this.createTexturePipeline(),this.createInstancedPipeline(),this.createGradientPipeline(),this.createBitmapFillPipeline(),this.createBlendPipeline(),this.createNodeClearPipeline()}lazyInitGroups=new Set;lazyGroupMap=new Map([...Array.from({length:16},(e,r)=>[\`blur_filter_\${r+1}\`,"blur_filter"]),["blur_filter","blur_filter"],["texture_copy","texture_copy"],["texture_copy_rgba8","texture_copy"],["color_transform","texture_copy"],["y_flip_color_transform","texture_copy"],["texture_erase","texture_copy"],["blur_texture_copy","texture_copy"],["filter_blend","texture_copy"],["texture_copy_bgra","texture_copy"],["filter_output","texture_copy"],["filter_output_add","texture_copy"],["filter_output_screen","texture_copy"],["filter_output_alpha","texture_copy"],["filter_output_erase","texture_copy"],["texture_copy_bgra_msaa","texture_copy"],["filter_output_msaa","texture_copy"],["filter_output_add_msaa","texture_copy"],["filter_output_screen_msaa","texture_copy"],["filter_output_alpha_msaa","texture_copy"],["filter_output_erase_msaa","texture_copy"],["positioned_texture","texture_copy"],["positioned_texture_rgba","texture_copy"],["bitmap_render_msaa","texture_copy"],["bitmap_render","texture_copy"],["texture_scale","texture_copy"],["texture_scale_blend","texture_copy"],["bitmap_sync","bitmap_sync"],["color_matrix_filter","filter"],["bevel_base","filter"],["glow_filter","filter"],["drop_shadow_filter","filter"],["bevel_filter","filter"],["gradient_glow_filter","filter"],["gradient_bevel_filter","filter"],["complex_blend","complex_blend"],["complex_blend_copy","complex_blend"],["complex_blend_scale","complex_blend"],["complex_blend_output","complex_blend"],["complex_blend_output_msaa","complex_blend"],["filter_complex_blend_output","complex_blend"],["filter_complex_blend_output_msaa","complex_blend"]]);ensureLazyGroup(e){const r=this.lazyGroupMap.get(e);if(!(!r||this.lazyInitGroups.has(r)))switch(this.lazyInitGroups.add(r),r){case"blur_filter":this.createBlurFilterPipeline();break;case"texture_copy":this.createTextureCopyPipeline();break;case"bitmap_sync":this.createBitmapSyncPipeline();break;case"filter":this.createColorMatrixFilterPipeline();break;case"complex_blend":this.createComplexBlendPipelines();break}}preloadLazyGroups(){const e=["blur_filter","texture_copy","bitmap_sync","filter","complex_blend"];for(const r of e)this.ensureLazyGroup(r)}createFillPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform",hasDynamicOffset:!0}}]});this.bindGroupLayouts.set("fill_dynamic",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("fillVertex",N.getFillVertexShader()),s=this.getOrCreateShaderModule("fillFragment",N.getFillFragmentShader()),o=rr,i=un,l=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[o]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilReadMask:0,stencilWriteMask:0},multisample:{count:this.sampleCount,alphaToCoverageEnabled:!0}}),c=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[o],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:this.sampleCount,alphaToCoverageEnabled:!0}});this.pipelines.set("fill",l),this.pipelines.set("fill_bgra",c);const u=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[o],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilReadMask:255,stencilWriteMask:0},multisample:{count:this.sampleCount,alphaToCoverageEnabled:!0}});this.pipelines.set("fill_bgra_stencil",u)}createStencilFillPipelines(){const e=rr,r=this.bindGroupLayouts.get("fill_dynamic"),n=this.device.createPipelineLayout({bindGroupLayouts:[r]}),s=this.device.createRenderPipeline({layout:n,vertex:{module:this.getOrCreateShaderModule("stencilWriteVertex",N.getStencilWriteVertexShader()),entryPoint:"main",buffers:[e]},fragment:{module:this.getOrCreateShaderModule("stencilWriteFragment",N.getStencilWriteFragmentShader()),entryPoint:"main",targets:[{format:"rgba8unorm",writeMask:0}]},primitive:{topology:"triangle-list",cullMode:"none",frontFace:"ccw"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"increment-wrap"},stencilBack:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"decrement-wrap"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount,alphaToCoverageEnabled:!0}});this.pipelines.set("stencil_write",s);const o=this.device.createRenderPipeline({layout:n,vertex:{module:this.getOrCreateShaderModule("stencilFillVertex",N.getStencilFillVertexShader()),entryPoint:"main",buffers:[e]},fragment:{module:this.getOrCreateShaderModule("stencilFillFragment",N.getStencilFillFragmentShader()),entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount}});this.pipelines.set("stencil_fill",o);const i=this.device.createRenderPipeline({layout:n,vertex:{module:this.getOrCreateShaderModule("stencilWriteVertex",N.getStencilWriteVertexShader()),entryPoint:"main",buffers:[e]},fragment:{module:this.getOrCreateShaderModule("stencilWriteFragment",N.getStencilWriteFragmentShader()),entryPoint:"main",targets:[{format:"rgba8unorm",writeMask:0}]},primitive:{topology:"triangle-list",cullMode:"none",frontFace:"ccw"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"increment-wrap"},stencilBack:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"decrement-wrap"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount,alphaToCoverageEnabled:!0}});this.pipelines.set("stencil_write_atlas",i);const l=this.device.createRenderPipeline({layout:n,vertex:{module:this.getOrCreateShaderModule("stencilWriteVertex",N.getStencilWriteVertexShader()),entryPoint:"main",buffers:[e],constants:{yFlipSign:-1}},fragment:{module:this.getOrCreateShaderModule("stencilWriteFragment",N.getStencilWriteFragmentShader()),entryPoint:"main",targets:[{format:this.format,writeMask:0}]},primitive:{topology:"triangle-list",cullMode:"none",frontFace:"ccw"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"increment-wrap"},stencilBack:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"decrement-wrap"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount,alphaToCoverageEnabled:!0}});this.pipelines.set("stencil_write_main",l);const c=this.device.createRenderPipeline({layout:n,vertex:{module:this.getOrCreateShaderModule("stencilFillVertex",N.getStencilFillVertexShader()),entryPoint:"main",buffers:[e]},fragment:{module:this.getOrCreateShaderModule("stencilFillFragment",N.getStencilFillFragmentShader()),entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one",operation:"max"}}}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount}});this.pipelines.set("stencil_fill_atlas",c);const u=this.device.createRenderPipeline({layout:n,vertex:{module:this.getOrCreateShaderModule("stencilFillVertex",N.getStencilFillVertexShader()),entryPoint:"main",buffers:[e],constants:{yFlipSign:-1}},fragment:{module:this.getOrCreateShaderModule("stencilFillFragment",N.getStencilFillFragmentShader()),entryPoint:"main",targets:[{format:this.format,blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one",operation:"max"}}}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount}});this.pipelines.set("stencil_fill_main",u);const a=this.device.createRenderPipeline({layout:n,vertex:{module:this.getOrCreateShaderModule("stencilFillVertex",N.getStencilFillVertexShader()),entryPoint:"main",buffers:[e]},fragment:{module:this.getOrCreateShaderModule("stencilFillFragment",N.getStencilFillFragmentShader()),entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"greater",failOp:"keep",depthFailOp:"replace",passOp:"replace"},stencilBack:{compare:"greater",failOp:"keep",depthFailOp:"replace",passOp:"replace"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount}});this.pipelines.set("stencil_fill_masked",a)}createClipPipeline(){const e=rr,r=this.bindGroupLayouts.get("fill_dynamic"),n=this.device.createPipelineLayout({bindGroupLayouts:[r]}),s=this.device.createRenderPipeline({layout:n,vertex:{module:this.getOrCreateShaderModule("stencilWriteVertex",N.getStencilWriteVertexShader()),entryPoint:"main",buffers:[e]},fragment:{module:this.getOrCreateShaderModule("stencilWriteFragment",N.getStencilWriteFragmentShader()),entryPoint:"main",targets:[{format:"rgba8unorm",writeMask:0}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"zero",depthFailOp:"invert",passOp:"invert"},stencilBack:{compare:"always",failOp:"zero",depthFailOp:"invert",passOp:"invert"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount}});this.pipelines.set("clip_write",s);const o=this.getOrCreateShaderModule("stencilWriteVertex",N.getStencilWriteVertexShader()),i=this.getOrCreateShaderModule("stencilWriteFragment",N.getStencilWriteFragmentShader());for(let l=1;l<=8;l++){const c=1<<l-1,u=this.device.createRenderPipeline({layout:n,vertex:{module:o,entryPoint:"main",buffers:[e],constants:{yFlipSign:-1}},fragment:{module:i,entryPoint:"main",targets:[{format:this.format,writeMask:0}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"zero",depthFailOp:"invert",passOp:"invert"},stencilBack:{compare:"always",failOp:"zero",depthFailOp:"invert",passOp:"invert"},stencilReadMask:255,stencilWriteMask:c},multisample:{count:this.sampleCount,alphaToCoverageEnabled:!0}});this.pipelines.set(\`clip_write_main_\${l}\`,u)}this.pipelines.set("clip_write_main",this.pipelines.get("clip_write_main_1"));for(let l=1;l<=8;l++){const c=1<<l-1,u=this.device.createRenderPipeline({layout:n,vertex:{module:o,entryPoint:"main",buffers:[e],constants:{yFlipSign:-1}},fragment:{module:i,entryPoint:"main",targets:[{format:this.format,writeMask:0}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"replace",depthFailOp:"replace",passOp:"replace"},stencilBack:{compare:"always",failOp:"replace",depthFailOp:"replace",passOp:"replace"},stencilReadMask:255,stencilWriteMask:c},multisample:{count:this.sampleCount}});this.pipelines.set(\`clip_clear_main_\${l}\`,u)}}createMaskUnionPipelines(){const e=rr,r=this.bindGroupLayouts.get("fill_dynamic"),n=this.device.createPipelineLayout({bindGroupLayouts:[r]}),s=this.getOrCreateShaderModule("stencilWriteVertex",N.getStencilWriteVertexShader()),o=this.getOrCreateShaderModule("stencilWriteFragment",N.getStencilWriteFragmentShader());for(let i=1;i<=8;i++){const c=~(1<<i-1)&255,u=this.device.createRenderPipeline({layout:n,vertex:{module:s,entryPoint:"main",buffers:[e],constants:{yFlipSign:-1}},fragment:{module:o,entryPoint:"main",targets:[{format:this.format,writeMask:0}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"less-equal",failOp:"zero",depthFailOp:"replace",passOp:"replace"},stencilBack:{compare:"less-equal",failOp:"zero",depthFailOp:"replace",passOp:"replace"},stencilReadMask:255,stencilWriteMask:c}});this.pipelines.set(\`mask_union_merge_\${i}\`,u);const a=this.device.createRenderPipeline({layout:n,vertex:{module:s,entryPoint:"main",buffers:[e],constants:{yFlipSign:-1}},fragment:{module:o,entryPoint:"main",targets:[{format:this.format,writeMask:0}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"replace",depthFailOp:"replace",passOp:"replace"},stencilBack:{compare:"always",failOp:"replace",depthFailOp:"replace",passOp:"replace"},stencilReadMask:255,stencilWriteMask:1<<i}});this.pipelines.set(\`mask_union_clear_\${i}\`,a)}}createMaskPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}}]});this.bindGroupLayouts.set("mask",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("maskVertex",N.getMaskVertexShader()),s=this.getOrCreateShaderModule("maskFragment",N.getMaskFragmentShader()),o=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[{arrayStride:16,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]}]},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("mask",o)}createBasicPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}}]});this.bindGroupLayouts.set("basic",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("basicVertex",N.getBasicVertexShader()),s=this.getOrCreateShaderModule("basicFragment",N.getBasicFragmentShader()),o={arrayStride:16,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]},i=un,l=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[o]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:this.sampleCount}}),c=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[o],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("basic",l),this.pipelines.set("basic_bgra",c)}createTexturePipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("texture",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("basicVertex",N.getBasicVertexShader()),s=this.getOrCreateShaderModule("textureFragment",N.getTextureFragmentShader()),o=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[{arrayStride:16,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]}]},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("texture",o)}createInstancedPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:1,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("instanced",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("instancedVertex",N.getInstancedVertexShader()),s=this.getOrCreateShaderModule("instancedFragment",N.getInstancedFragmentShader()),o={arrayStride:96,stepMode:"instance",attributes:[{shaderLocation:2,offset:0,format:"float32x4"},{shaderLocation:3,offset:16,format:"float32x4"},{shaderLocation:4,offset:32,format:"float32x4"},{shaderLocation:5,offset:48,format:"float32x4"},{shaderLocation:6,offset:64,format:"float32x4"},{shaderLocation:7,offset:80,format:"float32x4"}]},i=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[{arrayStride:16,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]},o]},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:this.sampleCount}});this.pipelines.set("instanced",i);const l=[{arrayStride:16,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]},o],c=[["instanced_add",{color:{srcFactor:"one",dstFactor:"one",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}],["instanced_screen",{color:{srcFactor:"one-minus-dst",dstFactor:"one",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}],["instanced_alpha",{color:{srcFactor:"zero",dstFactor:"src-alpha",operation:"add"},alpha:{srcFactor:"zero",dstFactor:"src-alpha",operation:"add"}}],["instanced_erase",{color:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"}}],["instanced_copy",{color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}}]];for(const[a,h]of c){const d=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:l},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:h}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:this.sampleCount}});this.pipelines.set(a,d)}const u=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[{arrayStride:16,stepMode:"vertex",attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]},o]},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilReadMask:255,stencilWriteMask:0},multisample:{count:this.sampleCount}});this.pipelines.set("instanced_masked",u)}createGradientPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("gradient_fill",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]});this.gradientPipelineLayout=r;const n=this.getOrCreateShaderModule("gradientFillVertex",N.getGradientFillVertexShader());this.gradientVertexShaderModule=n;const s=this.getOrCreateShaderModule("gradientFillFragment",N.getGradientFillFragmentShader());this.gradientFragmentShaderModule=s;const o=this.getOrCreateShaderModule("gradientFillStencilFragment",N.getGradientFillStencilFragmentShader());this.gradientStencilFragmentShaderModule=o;const i=rr,l=un,c=this.device.createRenderPipeline({label:"gradient_fill_no_stencil_pipeline",layout:r,vertex:{module:n,entryPoint:"main",buffers:[i]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:l}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:this.sampleCount}}),u=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[i],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:l}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:this.sampleCount}});this.pipelines.set("gradient_fill",c),this.pipelines.set("gradient_fill_no_stencil",c),this.pipelines.set("gradient_fill_bgra",u);const a={format:"stencil8",stencilFront:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilReadMask:0,stencilWriteMask:0},h=this.device.createRenderPipeline({label:"gradient_stroke_atlas_pipeline",layout:r,vertex:{module:n,entryPoint:"main",buffers:[i]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:l}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:a,multisample:{count:this.sampleCount}});this.pipelines.set("gradient_stroke_atlas",h);const d=this.device.createRenderPipeline({label:"gradient_stroke_bgra_pipeline",layout:r,vertex:{module:n,entryPoint:"main",buffers:[i],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:l}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:a,multisample:{count:this.sampleCount}});this.pipelines.set("gradient_stroke_bgra",d);const g=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[i],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:l}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:1}});this.pipelines.set("gradient_fill_bgra_no_msaa",g);const m=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[i]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:l}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount}});this.pipelines.set("gradient_fill_stencil",m);const f=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[i]},fragment:{module:o,entryPoint:"main",targets:[{format:"rgba8unorm",blend:l}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount}});this.pipelines.set("gradient_fill_stencil_atlas",f);const b=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[i],constants:{yFlipSign:-1}},fragment:{module:o,entryPoint:"main",targets:[{format:this.format,blend:l}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:1}});this.pipelines.set("gradient_fill_stencil_main",b);const x=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[i],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:l}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilReadMask:255,stencilWriteMask:0},multisample:{count:this.sampleCount}});this.pipelines.set("gradient_fill_bgra_stencil",x)}createBitmapFillPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("bitmap_fill",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("bitmapFillVertex",N.getBitmapFillVertexShader()),s=this.getOrCreateShaderModule("bitmapFillFragment",N.getBitmapFillFragmentShader()),o=rr,i=un,l=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[o]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:this.sampleCount}}),c=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[o],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("bitmap_fill",l),this.pipelines.set("bitmap_fill_bgra",c);const u={format:"stencil8",stencilFront:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilReadMask:0,stencilWriteMask:0},a=this.device.createRenderPipeline({label:"bitmap_stroke_atlas_pipeline",layout:r,vertex:{module:n,entryPoint:"main",buffers:[o]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:u,multisample:{count:this.sampleCount}});this.pipelines.set("bitmap_stroke_atlas",a);const h=this.device.createRenderPipeline({label:"bitmap_stroke_bgra_pipeline",layout:r,vertex:{module:n,entryPoint:"main",buffers:[o],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:u,multisample:{count:this.sampleCount}});this.pipelines.set("bitmap_stroke_bgra",h);const d=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[o]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount}});this.pipelines.set("bitmap_fill_stencil",d);const g=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[o],constants:{yFlipSign:-1}},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:i}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilReadMask:255,stencilWriteMask:0}});this.pipelines.set("bitmap_fill_bgra_stencil",g)}createBlendPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX|GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{}},{binding:4,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:5,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("blend",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("basicVertex",N.getBasicVertexShader()),s=this.getOrCreateShaderModule("blendFragment",N.getBlendFragmentShader()),o=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[{arrayStride:16,attributes:[{shaderLocation:0,offset:0,format:"float32x2"},{shaderLocation:1,offset:8,format:"float32x2"}]}]},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("blend",o)}createBlurFilterPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("blur_filter",e);const r=this.getOrCreateShaderModule("blurFilterVertex",N.getBlurFilterVertexShader()),n=this.device.createPipelineLayout({bindGroupLayouts:[e]});for(let s=1;s<=16;s++){const o=this.getOrCreateShaderModule(\`blurFilterFragment_\${s}\`,N.getBlurFilterFragmentShader(s)),i=this.device.createRenderPipeline({layout:n,vertex:{module:r,entryPoint:"main",buffers:[]},fragment:{module:o,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set(\`blur_filter_\${s}\`,i)}}createTextureCopyPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("texture_copy",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("blurFilterVertex",N.getBlurFilterVertexShader()),s=this.getOrCreateShaderModule("textureCopyFragment",N.getTextureCopyFragmentShader()),o={color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}},i={color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},l={color:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"}};this.pipelines.set("texture_copy",this.createFullscreenQuadPipeline(r,n,s,this.format,o)),this.pipelines.set("texture_copy_rgba8",this.createFullscreenQuadPipeline(r,n,s,"rgba8unorm",o));const c=this.getOrCreateShaderModule("colorTransformFragment",N.getColorTransformFragmentShader());this.pipelines.set("color_transform",this.createFullscreenQuadPipeline(r,n,c,"rgba8unorm",o));const u=this.getOrCreateShaderModule("yFlipColorTransformFragment",N.getYFlipColorTransformFragmentShader());this.pipelines.set("y_flip_color_transform",this.createFullscreenQuadPipeline(r,n,u,"rgba8unorm",o));const a=this.getOrCreateShaderModule("blurTextureCopyFragment",N.getBlurTextureCopyFragmentShader());this.pipelines.set("texture_erase",this.createFullscreenQuadPipeline(r,n,a,"rgba8unorm",l)),this.pipelines.set("blur_texture_copy",this.createFullscreenQuadPipeline(r,n,a,"rgba8unorm",o)),this.pipelines.set("filter_blend",this.createFullscreenQuadPipeline(r,n,s,this.format,i)),this.pipelines.set("texture_copy_bgra",this.createFullscreenQuadPipeline(r,n,s,this.format,o));const h=this.getOrCreateShaderModule("filterOutputFragment",N.getFilterOutputFragmentShader());this.pipelines.set("filter_output",this.createFullscreenQuadPipeline(r,n,h,this.format,i));const d=[["filter_output_add",{color:{srcFactor:"one",dstFactor:"one",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one",operation:"add"}}],["filter_output_screen",{color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}],["filter_output_alpha",{color:{srcFactor:"zero",dstFactor:"src-alpha",operation:"add"},alpha:{srcFactor:"zero",dstFactor:"src-alpha",operation:"add"}}],["filter_output_erase",{color:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"}}]];for(const[g,m]of d)this.pipelines.set(g,this.createFullscreenQuadPipeline(r,n,h,this.format,m));if(this.sampleCount>1){const g={color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}};this.pipelines.set("texture_copy_bgra_msaa",this.createFullscreenQuadPipeline(r,n,s,this.format,g,this.sampleCount));const m={color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};this.pipelines.set("filter_output_msaa",this.createFullscreenQuadPipeline(r,n,h,this.format,m,this.sampleCount));for(const[f,b]of d)this.pipelines.set(\`\${f}_msaa\`,this.createFullscreenQuadPipeline(r,n,h,this.format,b,this.sampleCount))}this.createPositionedTexturePipeline(),this.createTextureScalePipeline()}createPositionedTexturePipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("positioned_texture",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("positionedTextureVertex",N.getPositionedTextureVertexShader()),s=this.getOrCreateShaderModule("positionedTextureFragment",N.getPositionedTextureFragmentShader()),o=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[]},fragment:{module:s,entryPoint:"main",targets:[{format:this.format,blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("positioned_texture",o);const i=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("positioned_texture_rgba",i);const l=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:4},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"}}});this.pipelines.set("bitmap_render_msaa",l);const c=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"}}});this.pipelines.set("bitmap_render",c)}createTextureScalePipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("texture_scale",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("textureScaleVertex",N.getTextureScaleVertexShader()),s=this.getOrCreateShaderModule("positionedTextureFragment",N.getPositionedTextureFragmentShader()),o=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("texture_scale",o);const i=this.getOrCreateShaderModule("textureScaleBlendVertex",N.getTextureScaleBlendVertexShader()),l=this.device.createRenderPipeline({layout:r,vertex:{module:i,entryPoint:"main",buffers:[]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("texture_scale_blend",l)}createBitmapSyncPipeline(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.VERTEX,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{type:"filtering"}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{sampleType:"float"}}]});this.bindGroupLayouts.set("bitmap_sync",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("bitmapSyncVertex",N.getBitmapSyncVertexShader()),s=this.getOrCreateShaderModule("bitmapSyncFragment",N.getBitmapSyncFragmentShader()),o=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:4}});this.pipelines.set("bitmap_sync",o)}createColorMatrixFilterPipeline(){const e={color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}},r={color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}};this.createFilterPipelineWithLayout("color_matrix_filter",N.getColorMatrixFilterFragmentShader(),1,e),this.createFilterPipelineWithLayout("bevel_base",N.getBevelBaseFragmentShader(),1,e),this.createFilterPipelineWithLayout("glow_filter",N.getGlowFilterFragmentShader(),2,r),this.createFilterPipelineWithLayout("drop_shadow_filter",N.getDropShadowFilterFragmentShader(),2,r),this.createFilterPipelineWithLayout("bevel_filter",N.getBevelFilterFragmentShader(),2,r),this.createFilterPipelineWithLayout("gradient_glow_filter",N.getGradientGlowFilterFragmentShader(),3,r),this.createFilterPipelineWithLayout("gradient_bevel_filter",N.getGradientBevelFilterFragmentShader(),3,r)}createComplexBlendPipelines(){const e=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{}}]});this.bindGroupLayouts.set("complex_blend",e);const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("complexBlendVertex",N.getComplexBlendVertexShader()),s=this.getOrCreateShaderModule("unifiedComplexBlendFragment",N.getUnifiedComplexBlendFragmentShader()),o=this.device.createRenderPipeline({layout:r,vertex:{module:n,entryPoint:"main",buffers:[]},fragment:{module:s,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}});this.pipelines.set("complex_blend",o),this.createComplexBlendCopyPipeline(),this.createComplexBlendOutputPipeline()}createComplexBlendCopyPipeline(){const e={color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}},r=this.bindGroupLayouts.get("texture_copy");if(r){const s=this.device.createPipelineLayout({bindGroupLayouts:[r]}),o=this.getOrCreateShaderModule("complexBlendCopyVertex",N.getComplexBlendCopyVertexShader()),i=this.getOrCreateShaderModule("textureCopyFragment",N.getTextureCopyFragmentShader());this.pipelines.set("complex_blend_copy",this.createFullscreenQuadPipeline(s,o,i,"rgba8unorm",e))}const n=this.bindGroupLayouts.get("texture_scale");if(n){const s=this.device.createPipelineLayout({bindGroupLayouts:[n]}),o=this.getOrCreateShaderModule("complexBlendScaleVertex",N.getComplexBlendScaleVertexShader()),i=this.getOrCreateShaderModule("positionedTextureFragment",N.getPositionedTextureFragmentShader());this.pipelines.set("complex_blend_scale",this.createFullscreenQuadPipeline(s,o,i,"rgba8unorm",e))}}createComplexBlendOutputPipeline(){const e=this.bindGroupLayouts.get("positioned_texture");if(!e)return;const r=this.device.createPipelineLayout({bindGroupLayouts:[e]}),n=this.getOrCreateShaderModule("positionedTextureFragment",N.getPositionedTextureFragmentShader()),s={color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},o=this.getOrCreateShaderModule("complexBlendOutputVertex",N.getComplexBlendOutputVertexShader());this.pipelines.set("complex_blend_output",this.createFullscreenQuadPipeline(r,o,n,this.format,s)),this.sampleCount>1&&this.pipelines.set("complex_blend_output_msaa",this.createFullscreenQuadPipeline(r,o,n,this.format,s,this.sampleCount));const i=this.getOrCreateShaderModule("filterComplexBlendOutputVertex",N.getFilterComplexBlendOutputVertexShader());this.pipelines.set("filter_complex_blend_output",this.createFullscreenQuadPipeline(r,i,n,this.format,s)),this.sampleCount>1&&this.pipelines.set("filter_complex_blend_output_msaa",this.createFullscreenQuadPipeline(r,i,n,this.format,s,this.sampleCount))}createFilterPipelineWithLayout(e,r,n,s){let o=this.filterBindGroupLayouts.get(n);if(!o){const u=[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}}];for(let a=0;a<n;a++)u.push({binding:2+a,visibility:GPUShaderStage.FRAGMENT,texture:{}});o=this.device.createBindGroupLayout({entries:u}),this.filterBindGroupLayouts.set(n,o)}this.bindGroupLayouts.set(e,o);const i=this.device.createPipelineLayout({bindGroupLayouts:[o]}),l=this.getOrCreateShaderModule("blurFilterVertex",N.getBlurFilterVertexShader()),c=this.getOrCreateShaderModule(\`filter_\${e}\`,r);this.pipelines.set(e,this.createFullscreenQuadPipeline(i,l,c,"rgba8unorm",s))}createFullscreenQuadPipeline(e,r,n,s,o,i,l){const c={layout:e,vertex:{module:r,entryPoint:"main",buffers:[]},fragment:{module:n,entryPoint:"main",targets:[{format:s,blend:o}]},primitive:{topology:"triangle-list",cullMode:"none"}};return i&&i>1&&(c.multisample={count:i}),l&&(c.depthStencil=l),this.device.createRenderPipeline(c)}getPipeline(e){let r=this.pipelines.get(e);return r||(this.ensureLazyGroup(e),r=this.pipelines.get(e)),r}getFilterPipeline(e,r){const s=Object.keys(r).sort().map(h=>\`\${h}\${r[h]}\`).join("_"),o=\`\${e}_\${s}\`;let i=this.pipelines.get(o);if(i)return i;this.ensureLazyGroup(e);const l=this.shaderModuleCache.get(\`filter_\${e}\`),c=this.shaderModuleCache.get("blurFilterVertex"),u=this.bindGroupLayouts.get(e);if(!l||!c||!u)return this.pipelines.get(e);const a=this.device.createPipelineLayout({bindGroupLayouts:[u]});return i=this.device.createRenderPipeline({layout:a,vertex:{module:c,entryPoint:"main",buffers:[]},fragment:{module:l,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}],constants:r},primitive:{topology:"triangle-list",cullMode:"none"}}),this.pipelines.set(o,i),i}getGradientPipeline(e,r,n){const s=\`\${e}_t\${r}s\${n}\`;let o=this.pipelines.get(s);return o||(this.gradientPipelineLayout?(o=this.createGradientVariant(e,r,n),o?(this.pipelines.set(s,o),o):this.getPipeline(e)):this.getPipeline(e))}gradientPipelineLayout=null;gradientVertexShaderModule=null;gradientFragmentShaderModule=null;gradientStencilFragmentShaderModule=null;createGradientVariant(e,r,n){if(!this.gradientPipelineLayout)return;const s={GRADIENT_TYPE:r,SPREAD_MODE:n},o=rr,i=un,c=e.includes("stencil_atlas")||e==="gradient_fill_stencil_main"?this.gradientStencilFragmentShaderModule:this.gradientFragmentShaderModule,a=e.includes("bgra")||e==="gradient_fill_stencil_main"?this.format:"rgba8unorm",h=e.includes("bgra")||e==="gradient_fill_stencil_main",d={};h&&(d.yFlipSign=-1);let g,m=this.sampleCount;e.includes("stroke")?g={format:"stencil8",stencilFront:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"always",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilReadMask:0,stencilWriteMask:0}:e==="gradient_fill_stencil"||e==="gradient_fill_stencil_atlas"?g={format:"stencil8",stencilFront:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255}:e==="gradient_fill_stencil_main"?(g={format:"stencil8",stencilFront:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"not-equal",failOp:"keep",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255},m=1):e==="gradient_fill_bgra_stencil"?g={format:"stencil8",stencilFront:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilBack:{compare:"equal",failOp:"keep",depthFailOp:"keep",passOp:"keep"},stencilReadMask:255,stencilWriteMask:0}:e==="gradient_fill_bgra_no_msaa"&&(m=1);const f={layout:this.gradientPipelineLayout,vertex:{module:this.gradientVertexShaderModule,entryPoint:"main",buffers:[o],constants:Object.keys(d).length>0?d:void 0},fragment:{module:c,entryPoint:"main",targets:[{format:a,blend:i}],constants:s},primitive:{topology:"triangle-list",cullMode:"none"},multisample:{count:m}};return g&&(f.depthStencil=g),this.device.createRenderPipeline(f)}getBindGroupLayout(e){let r=this.bindGroupLayouts.get(e);return r||(this.ensureLazyGroup(e),r=this.bindGroupLayouts.get(e)),r}createNodeClearPipeline(){const e={arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},r=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.getOrCreateShaderModule("nodeClearVertex",N.getNodeClearVertexShader()),entryPoint:"main",buffers:[e]},fragment:{module:this.getOrCreateShaderModule("nodeClearFragment",N.getNodeClearFragmentShader()),entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"zero",operation:"add"},alpha:{srcFactor:"one",dstFactor:"zero",operation:"add"}},writeMask:GPUColorWrite.ALL}]},primitive:{topology:"triangle-list",cullMode:"none"},depthStencil:{format:"stencil8",stencilFront:{compare:"always",failOp:"zero",depthFailOp:"zero",passOp:"zero"},stencilBack:{compare:"always",failOp:"zero",depthFailOp:"zero",passOp:"zero"},stencilReadMask:255,stencilWriteMask:255},multisample:{count:this.sampleCount}});this.pipelines.set("node_clear_atlas",r)}dispose(){this.pipelines.clear(),this.bindGroupLayouts.clear(),this.shaderModuleCache.clear(),this.filterBindGroupLayouts.clear()}}class Qp{device;pipelines;bindGroupLayouts;constructor(e){this.device=e,this.pipelines=new Map,this.bindGroupLayouts=new Map,this.initializeBlurPipelines()}initializeBlurPipelines(){const e=this.device.createBindGroupLayout({label:"blur_compute_bind_group_layout",entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,texture:{sampleType:"float"}},{binding:1,visibility:GPUShaderStage.COMPUTE,storageTexture:{access:"write-only",format:"rgba8unorm"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}}]});this.bindGroupLayouts.set("blur_compute",e),this.createBlurComputePipeline("blur_compute_horizontal"),this.createBlurComputePipeline("blur_compute_vertical"),this.createBlurComputePipeline("blur_compute_shared_horizontal",!0),this.createBlurComputePipeline("blur_compute_shared_vertical",!0)}createBlurComputePipeline(e,r=!1){const n=this.device.createShaderModule({label:\`\${e}_shader\`,code:r?this.getSharedBlurComputeShaderCode():this.getBlurComputeShaderCode()}),s=this.device.createPipelineLayout({label:\`\${e}_layout\`,bindGroupLayouts:[this.bindGroupLayouts.get("blur_compute")]}),o=this.device.createComputePipeline({label:e,layout:s,compute:{module:n,entryPoint:"main"}});this.pipelines.set(e,o)}getBlurComputeShaderCode(){return\`
2175
+ struct BlurParams {
2176
+ direction: vec2<f32>, // (1,0) or (0,1)
2177
+ radius: f32, // ブラー半径
2178
+ fraction: f32, // 端ピクセルのブレンド割合
2179
+ texSize: vec2<f32>, // テクスチャサイズ
2180
+ samples: f32, // サンプル数
2181
+ padding: f32, // パディング(16バイトアライメント)
2182
+ }
2183
+
2184
+ @group(0) @binding(0) var inputTexture: texture_2d<f32>;
2185
+ @group(0) @binding(1) var outputTexture: texture_storage_2d<rgba8unorm, write>;
2186
+ @group(0) @binding(2) var<uniform> params: BlurParams;
2187
+
2188
+ const WORKGROUP_SIZE: u32 = 16u;
2189
+
2190
+ @compute @workgroup_size(16, 16, 1)
2191
+ fn main(
2192
+ @builtin(global_invocation_id) globalId: vec3<u32>
2193
+ ) {
2194
+ let texSize = vec2<u32>(u32(params.texSize.x), u32(params.texSize.y));
2195
+ let radius = i32(params.radius);
2196
+
2197
+ let outCoord = globalId.xy;
2198
+
2199
+ if (outCoord.x >= texSize.x || outCoord.y >= texSize.y) {
2200
+ return;
2201
+ }
2202
+
2203
+ let direction = vec2<i32>(i32(params.direction.x), i32(params.direction.y));
2204
+ let samples = params.samples;
2205
+ let fraction = params.fraction;
2206
+
2207
+ var color = vec4<f32>(0.0);
2208
+
2209
+ for (var i = -radius; i <= radius; i = i + 1) {
2210
+ var sampleCoord = vec2<i32>(outCoord) + direction * i;
2211
+
2212
+ sampleCoord.x = clamp(sampleCoord.x, 0, i32(texSize.x) - 1);
2213
+ sampleCoord.y = clamp(sampleCoord.y, 0, i32(texSize.y) - 1);
2214
+
2215
+ let sample = textureLoad(inputTexture, vec2<u32>(sampleCoord), 0);
2216
+
2217
+ // 端ピクセルにfraction重みを適用(Fragment Shaderと同じロジック)
2218
+ if (i == -radius || i == radius) {
2219
+ color = color + sample * fraction;
2220
+ } else {
2221
+ color = color + sample;
2222
+ }
2223
+ }
2224
+
2225
+ color = color / samples;
2226
+
2227
+ textureStore(outputTexture, outCoord, color);
2228
+ }
2229
+ \`}getSharedBlurComputeShaderCode(){return\`
2230
+ struct BlurParams {
2231
+ direction: vec2<f32>,
2232
+ radius: f32,
2233
+ fraction: f32,
2234
+ texSize: vec2<f32>,
2235
+ samples: f32,
2236
+ padding: f32,
2237
+ }
2238
+
2239
+ @group(0) @binding(0) var inputTexture: texture_2d<f32>;
2240
+ @group(0) @binding(1) var outputTexture: texture_storage_2d<rgba8unorm, write>;
2241
+ @group(0) @binding(2) var<uniform> params: BlurParams;
2242
+
2243
+ const TILE: u32 = 16u;
2244
+ const MAX_APRON: u32 = 24u;
2245
+ const SHARED_W: u32 = TILE + 2u * MAX_APRON;
2246
+
2247
+ var<workgroup> tile: array<vec4<f32>, 1024>;
2248
+
2249
+ @compute @workgroup_size(16, 16, 1)
2250
+ fn main(
2251
+ @builtin(global_invocation_id) globalId: vec3<u32>,
2252
+ @builtin(local_invocation_id) localId: vec3<u32>,
2253
+ @builtin(workgroup_id) workgroupId: vec3<u32>
2254
+ ) {
2255
+ let texSize = vec2<u32>(u32(params.texSize.x), u32(params.texSize.y));
2256
+ let radius = u32(params.radius);
2257
+ let apron = min(radius, MAX_APRON);
2258
+ let isHorizontal = params.direction.x > 0.5;
2259
+ let fraction = params.fraction;
2260
+ let samples = params.samples;
2261
+
2262
+ let threadIdx = localId.x + localId.y * TILE;
2263
+ let totalThreads = TILE * TILE;
2264
+
2265
+ if (isHorizontal) {
2266
+ let sharedWidth = TILE + 2u * apron;
2267
+ let baseX = workgroupId.x * TILE;
2268
+ let y = globalId.y;
2269
+ let clampedY = clamp(y, 0u, max(texSize.y, 1u) - 1u);
2270
+
2271
+ // 全スレッドが協調ロード(範囲外スレッドもclampされた座標でロード)
2272
+ var idx = threadIdx;
2273
+ loop {
2274
+ if (idx >= sharedWidth) { break; }
2275
+ let gx = i32(baseX) + i32(idx) - i32(apron);
2276
+ let cx = u32(clamp(gx, 0, i32(max(texSize.x, 1u)) - 1));
2277
+ tile[localId.y * SHARED_W + idx] = textureLoad(inputTexture, vec2<u32>(cx, clampedY), 0);
2278
+ idx += totalThreads;
2279
+ }
2280
+
2281
+ // 全スレッドがバリアに到達(早期returnなし)
2282
+ workgroupBarrier();
2283
+
2284
+ // 範囲内のスレッドのみ出力
2285
+ let outX = globalId.x;
2286
+ if (outX < texSize.x && y < texSize.y) {
2287
+ let iRadius = i32(radius);
2288
+ var color = vec4<f32>(0.0);
2289
+ for (var i = -iRadius; i <= iRadius; i = i + 1) {
2290
+ let tileIdx = i32(localId.x) + i32(apron) + i;
2291
+ let s = tile[localId.y * SHARED_W + u32(clamp(tileIdx, 0, i32(sharedWidth) - 1))];
2292
+ if (i == -iRadius || i == iRadius) {
2293
+ color += s * fraction;
2294
+ } else {
2295
+ color += s;
2296
+ }
2297
+ }
2298
+ textureStore(outputTexture, vec2<u32>(outX, y), color / samples);
2299
+ }
2300
+ } else {
2301
+ let sharedHeight = TILE + 2u * apron;
2302
+ let baseY = workgroupId.y * TILE;
2303
+ let x = globalId.x;
2304
+ let clampedX = clamp(x, 0u, max(texSize.x, 1u) - 1u);
2305
+
2306
+ // 全スレッドが協調ロード(範囲外スレッドもclampされた座標でロード)
2307
+ var idx = threadIdx;
2308
+ loop {
2309
+ if (idx >= sharedHeight) { break; }
2310
+ let gy = i32(baseY) + i32(idx) - i32(apron);
2311
+ let cy = u32(clamp(gy, 0, i32(max(texSize.y, 1u)) - 1));
2312
+ tile[idx * TILE + localId.x] = textureLoad(inputTexture, vec2<u32>(clampedX, cy), 0);
2313
+ idx += totalThreads;
2314
+ }
2315
+
2316
+ // 全スレッドがバリアに到達(早期returnなし)
2317
+ workgroupBarrier();
2318
+
2319
+ // 範囲内のスレッドのみ出力
2320
+ let outY = globalId.y;
2321
+ if (x < texSize.x && outY < texSize.y) {
2322
+ let iRadius = i32(radius);
2323
+ var color = vec4<f32>(0.0);
2324
+ for (var i = -iRadius; i <= iRadius; i = i + 1) {
2325
+ let tileIdx = i32(localId.y) + i32(apron) + i;
2326
+ let s = tile[u32(clamp(tileIdx, 0, i32(sharedHeight) - 1)) * TILE + localId.x];
2327
+ if (i == -iRadius || i == iRadius) {
2328
+ color += s * fraction;
2329
+ } else {
2330
+ color += s;
2331
+ }
2332
+ }
2333
+ textureStore(outputTexture, vec2<u32>(x, outY), color / samples);
2334
+ }
2335
+ }
2336
+ }
2337
+ \`}getPipeline(e){return this.pipelines.get(e)}getBindGroupLayout(e){return this.bindGroupLayouts.get(e)}destroy(){this.pipelines.clear(),this.bindGroupLayouts.clear()}}const Va=Number.MAX_VALUE,Da=-Number.MAX_VALUE;let Fr=0;const wr=t=>{Fr=t},Zp=()=>Fr,zt=[],Jp=t=>{zt[Fr]=t};let go=null;const em=t=>{go=t},Ne=()=>{if(!(Fr in zt))if(go){const t=go(Fr);Jp(t)}else return null;return zt[Fr]},bo=t=>t in zt?zt[t]:null,fn=[],Na=[],za=[],tm=()=>{for(let t=0;t<Na.length;++t){const e=Na[t];e&&(e[0]=e[1]=Va,e[2]=e[3]=Da)}for(let t=0;t<za.length;++t){const e=za[t];e&&(e[0]=e[1]=Va,e[2]=e[3]=Da)}};let Xa=0;const xo=t=>{Xa=t},yo=()=>Xa,rm=()=>{fn.length=0,wr(0);for(let t=0;t<zt.length;t++){const e=zt[t];e&&(e.texture&&e.texture.resource.destroy(),e.stencil&&e.stencil.resource.destroy(),e.msaaTexture&&e.msaaTexture.resource.destroy(),e.msaaStencil&&e.msaaStencil.resource.destroy())}zt.length=0,tm(),xo(0)};class nm{count;constructor(){this.count=0}clear(){this.count=Ve.offset=0}}let ts="normal";const Ya=t=>{ts=t},sm=new Set(["normal","layer","add","screen","alpha","erase","copy"]),hn=[],vo=[],Mo=[],om=()=>hn,So=()=>{for(let t=0;t<hn.length;t++){const e=hn[t];vo.push(e.color_transform),Mo.push(e.matrix)}hn.length=0},$o=new Map,rs=()=>{const t="blend_instanced";return $o.has(t)||$o.set(t,new nm),$o.get(t)},im=(t,e,r,n,s,o,i,l,c,u,a,h)=>{const d=o[0],g=o[1],m=o[2],f=h,b=o[4]/255,x=o[5]/255,y=o[6]/255,P=0;if(sm.has(l)){(ts!==l||yo()!==t.index)&&(st&&(wr(yo()),st.drawArraysInstanced()),Ya(l),xo(t.index),wr(t.index));const S=rs();Ve.pushInstanceBuffer((t.x+.5)/a,(t.y+.5)/a,(t.w-1)/a,(t.h-1)/a,t.w,t.h,c,u,i[6],i[7],0,0,i[0],i[1],i[3],i[4],d,g,m,f,b,x,y,P),S.count++}else{st&&(wr(yo()),st.drawArraysInstanced());const S=vo.length>0?vo.pop():new Float32Array(8);S.set(o);const M=Mo.length>0?Mo.pop():new Float32Array(9);M.set(i),hn.push({node:t,x_min:e,y_min:r,x_max:n,y_max:s,color_transform:S,matrix:M,blend_mode:l,viewport_width:c,viewport_height:u,render_max_size:a,global_alpha:h}),Ya(l),xo(t.index),wr(t.index)}};let To=!1;const Bo=t=>{To=t},nr=()=>To;let Po=!1,Ao=0;const Wa=t=>{Po=t},gt=()=>Po,ja=t=>{Ao=t},Or=()=>Ao,Er=new Map,Rr=new Map,am=()=>{To=!1,Po=!1,Ao=0,Er.clear(),Rr.clear()},cm=()=>{const t=st.currentAttachmentObject;t&&(t.mask=!0,t.clipLevel++,Rr.set(t.clipLevel,t.clipLevel),nr()||Bo(!0))},lm=(t,e,r,n)=>{const s=st.currentAttachmentObject;if(!s)return;const o=s.clipLevel;let i=Er.get(o);i?(i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],r),i[3]=Math.max(i[3],n)):(i=fd(),i[0]=t,i[1]=e,i[2]=r,i[3]=n,Er.set(o,i))},Ha=()=>{const t=st.currentAttachmentObject;if(!t)return;const r=(1<<t.clipLevel)-1;Wa(!0),ja(r&255),Bo(!1)},um=()=>{const t=st.currentAttachmentObject;if(!t)return;const e=t.clipLevel,r=Er.get(e);if(r&&(Er.delete(e),hd(r)),Rr.delete(e),--t.clipLevel,!t.clipLevel){t.mask=!1,Bo(!1),Wa(!1),ja(0),t.needsStencilClear=!0,Rr.clear(),Er.clear();return}t.pendingStencilClearLevel=t.clipLevel,Ha()},fm=(t,e,r)=>{const n=t.length-5;for(let s=3;s<n;s+=3){let o=r*4;t[s+2]?(e[o++]=t[s-3],e[o++]=t[s-2],e[o++]=0,e[o++]=0,e[o++]=t[s],e[o++]=t[s+1],e[o++]=.5,e[o++]=0,e[o++]=t[s+3],e[o++]=t[s+4],e[o++]=1,e[o++]=1):t[s+5]?(e[o++]=t[0],e[o++]=t[1],e[o++]=.5,e[o++]=.5,e[o++]=t[s],e[o++]=t[s+1],e[o++]=.5,e[o++]=.5,e[o++]=t[s+6],e[o++]=t[s+7],e[o++]=.5,e[o++]=.5):(e[o++]=t[0],e[o++]=t[1],e[o++]=.5,e[o++]=.5,e[o++]=t[s],e[o++]=t[s+1],e[o++]=.5,e[o++]=.5,e[o++]=t[s+3],e[o++]=t[s+4],e[o++]=.5,e[o++]=.5),r+=3}return r};let Fo=new Float32Array(32);const hm=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t),dn=t=>{let e=0;for(const o of t){const i=o.length-5;for(let l=3;l<i;l+=3)e+=3}const r=e*4;Fo.length<r&&(Fo=new Float32Array(hm(r)));const n=Fo;let s=0;for(const o of t)s=fm(o,n,s);return{buffer:n.subarray(0,s*4),indexCount:s}},Cr=new OffscreenCanvas(1,1).getContext("2d"),dm={x:0,y:0},pm={x:0,y:0},mm={x:0,y:0},gm={x:0,y:0},bm=(t,e,r)=>{const n=Math.sqrt(t*t+e*e);return n===0?{x:0,y:0}:{x:-(e/n)*r,y:t/n*r}},wo=(t,e,r)=>({x:t.x+(e.x-t.x)*r,y:t.y+(e.y-t.y)*r}),xm=t=>{const e=Math.sqrt(t.x*t.x+t.y*t.y);return e===0?{x:0,y:0}:{x:t.x/e,y:t.y/e}},ym=(t,e,r,n)=>({x:(1-t)**2*e.x+2*(1-t)*t*r.x+t**2*n.x,y:(1-t)**2*e.y+2*(1-t)*t*r.y+t**2*n.y}),vm=(t,e,r,n)=>({x:2*(1-t)*(r.x-e.x)+2*t*(n.x-r.x),y:2*(1-t)*(r.y-e.y)+2*t*(n.y-r.y)}),Mm=(t,e,r,n=.5)=>{const s=wo(t,e,n),o=wo(e,r,n),i=wo(s,o,n);return[[t,s,i],[i,o,r]]},Sm=(t,e,r,n=4)=>{let s=[[t,e,r]];for(let o=0;o<n;o++){const i=[];for(const l of s){const c=Mm(l[0],l[1],l[2],.5);i.push(c[0],c[1])}s=i}return s},Ka=(t,e,r,n)=>{const s=[0,.5,1],o=[];for(const i of s){const l=ym(i,t,e,r),c=vm(i,t,e,r),u=xm({x:-c.y,y:c.x});o.push({x:l.x+u.x*n,y:l.y+u.y*n})}return o},$m=(t,e,r,n)=>{const s=Sm(t,e,r,5),o=[],i=[];for(const h of s)o.push(Ka(h[0],h[1],h[2],+n)),i.push(Ka(h[0],h[1],h[2],-n));for(let h=0;h<o.length-1;++h)o[h+1][0]=o[h][2];for(let h=0;h<i.length-1;++h)i[h+1][0]=i[h][2];const l=o[0][0],c=[l.x,l.y,!1];for(let h=0;h<o.length;++h){const d=o[h];c.push(d[1].x,d[1].y,!0,d[2].x,d[2].y,!1)}const u=[...i].reverse();for(let h=0;h<u.length;++h){const[d,g,m]=u[h];u[h]=[m,g,d]}const a=u[0][0];c.push(a.x,a.y,!1);for(let h=0;h<u.length;++h){const d=u[h];c.push(d[1].x,d[1].y,!0,d[2].x,d[2].y,!1)}return c},Tm=(t,e,r)=>{const n={x:e.x-t.x,y:e.y-t.y},s=bm(n.x,n.y,r),o={x:t.x+s.x,y:t.y+s.y},i={x:e.x+s.x,y:e.y+s.y},l={x:e.x-s.x,y:e.y-s.y},c={x:t.x-s.x,y:t.y-s.y};return[o.x,o.y,!1,i.x,i.y,!1,l.x,l.y,!1,c.x,c.y,!1,o.x,o.y,!1]},Ur=(t,e,r,n)=>{const s=[];for(let i=0;i<n.length;i+=3){if(n[i+2])continue;const l=n[i],c=n[i+1],u=Math.sqrt(Math.pow(l-t,2)+Math.pow(c-e,2));Math.abs(u-r)>1e-4||s.push(l,c)}return s},Gr=(t,e)=>{Cr.beginPath(),Cr.moveTo(e[0],e[1]);for(let r=3;r<e.length;r+=3)e[r+2]?(Cr.quadraticCurveTo(e[r],e[r+1],e[r+3],e[r+4]),r+=3):Cr.lineTo(e[r],e[r+1]);Cr.closePath();for(let r=0;r<t.length;r+=2){const n=t[r],s=t[r+1];if(!Cr.isPointInPath(n,s))return[n,s]}return null},qa=(t,e,r,n,s=!1)=>{const o=s?0:n.length-1,i=s?n.length-1:n.length-2,l=Ur(t,e,r,n[o]),c=Ur(t,e,r,n[i]);if(l[0]===c[0]&&l[1]===c[1]||l[0]===c[2]&&l[1]===c[3])return;const u=Gr(l,n[i]);if(!u)return;const a=Gr(c,n[o]);a&&n.splice(-1,0,[t,e,!1,u[0],u[1],!1,a[0],a[1],!1,t,e,!1])},Qa=(t,e,r,n,s=!1)=>{const o=s?0:n.length-1,i=s?n.length-1:n.length-2,l=Ur(t,e,r,n[o]),c=Ur(t,e,r,n[i]),u=Gr(l,n[i]);if(!u)return;const a=Gr(c,n[o]);if(!a)return;const h=Math.atan2(u[1]-e,u[0]-t);let g=Math.atan2(a[1]-e,a[0]-t)-h;g>Math.PI?g-=2*Math.PI:g<-Math.PI&&(g+=2*Math.PI);const m=8,f=g/m,b=[t,e,!1];for(let x=0;x<=m;x++){const y=h+x*f,P=t+r*Math.cos(y),S=e+r*Math.sin(y);b.push(P,S,!1)}n.splice(-1,0,b)},Za=(t,e,r,n,s,o=!1)=>{const i=o?0:s.length-1,l=o?s.length-1:s.length-2,c=Ur(t.x,t.y,n,s[i]),u=Ur(t.x,t.y,n,s[l]);if(c[0]===u[0]&&c[1]===u[1]||c[0]===u[2]&&c[1]===u[3])return;const a=Gr(c,s[l]);if(!a)return;const h=Gr(u,s[i]);if(!h)return;const d=e.x-t.x,g=e.y-t.y,m=Math.hypot(d,g),f={x:d/m,y:g/m},b=r.x-t.x,x=r.y-t.y,y=Math.hypot(b,x),P={x:b/y,y:x/y},S=f.x,M=f.y,$=P.x,T=P.y,w=S*T-M*$;if(w===0){s.splice(-1,0,[t.x,t.y,!1,a[0],a[1],!1,h[0],h[1],!1]);return}const E=((h[0]-a[0])*T-(h[1]-a[1])*$)/w,F=a[0]+E*S,A=a[1]+E*M;s.splice(-1,0,[t.x,t.y,!1,a[0],a[1],!1,F,A,!1,t.x,t.y,!1,h[0],h[1],!1,F,A,!1])},Bm=(t,e,r)=>{const n=t[0],s=t[1],o=t[3],i=t[4],l=Math.atan2(s-i,n-o),c=[n,s,!1],u=8;for(let b=0;b<=u;b++){const x=l-Math.PI/2+b*Math.PI/u;c.push(n+e*Math.cos(x),s+e*Math.sin(x),!1)}r.unshift(c);const a=t[t.length-3],h=t[t.length-2],d=t[t.length-6],g=t[t.length-5],m=Math.atan2(h-g,a-d),f=[a,h,!1];for(let b=0;b<=u;b++){const x=m-Math.PI/2+b*Math.PI/u;f.push(a+e*Math.cos(x),h+e*Math.sin(x),!1)}r.push(f)},Pm=(t,e,r)=>{const n=t[0],s=t[1],o=t[3],i=t[4],l=n-o,c=s-i,u=Math.hypot(l,c);if(u>0){const x=l/u,y=c/u,P=n+x*e,S=s+y*e,M=[n-y*e,s+x*e,!1,P-y*e,S+x*e,!1,P+y*e,S-x*e,!1,n+y*e,s-x*e,!1,n-y*e,s+x*e,!1];r.unshift(M)}const a=t[t.length-3],h=t[t.length-2],d=t[t.length-6],g=t[t.length-5],m=a-d,f=h-g,b=Math.hypot(m,f);if(b>0){const x=m/b,y=f/b,P=a+x*e,S=h+y*e,M=[a-y*e,h+x*e,!1,P-y*e,S+x*e,!1,P+y*e,S-x*e,!1,a+y*e,h-x*e,!1,a-y*e,h+x*e,!1];r.push(M)}},Oo=(t,e)=>{const r=dm;r.x=t[0],r.y=t[1];const n=pm;n.x=0,n.y=0;const s=mm;s.x=0,s.y=0;const o=gm;o.x=0,o.y=0;const i=[];for(let g=3;g<t.length;g+=3){const m=t[g],f=t[g+1];if(t[g+2]){n.x=m,n.y=f;continue}if(s.x=m,s.y=f,t[g-1]?i.push($m(r,n,s,e)):i.push(Tm(r,s,e)),i.length>1)switch(st.joints){case 0:qa(r.x,r.y,e,i);break;case 1:o.x=t[g-6],o.y=t[g-5],Za(r,s,o,e,i);break;case 2:Qa(r.x,r.y,e,i);break}r.x=s.x,r.y=s.y}const l=t[0],c=t[1],u=t[t.length-3],a=t[t.length-2],h=1e-4;if(Math.abs(l-u)<h&&Math.abs(c-a)<h&&i.length>1)switch(st.joints){case 0:qa(l,c,e,i,!0);break;case 1:r.x=l,r.y=c,s.x=t[3],s.y=t[4],o.x=t[t.length-6],o.y=t[t.length-5],Za(r,s,o,e,i,!0);break;case 2:Qa(l,c,e,i,!0);break}else if(i.length>0)switch(st.caps){case 1:Bm(t,e,i);break;case 2:Pm(t,e,i);break}return i},Am=(t,e)=>{const r=e/2,n=[];for(const s of t){if(s.length<6)continue;const o=Oo(s,r);for(const i of o)n.push(i)}return n},Ja=new Map;let ec=0;const Fm=()=>{Ja.clear(),ec=0},tc=new WeakMap,Eo=t=>{let e=tc.get(t);return e||(e=t.createView(),tc.set(t,e)),e},wm=6,Om=22,pn=new Map,mn=new Map,ns=(t,e,r)=>{const n=\`\${e}_\${r}\`,s=pn.get(n);return s&&s.length>0?s.pop():t.createTexture({size:{width:e,height:r},format:"rgba8unorm",usage:wm})},Ot=t=>{const e=\`\${t.width}_\${t.height}\`;let r=pn.get(e);r||(r=[],pn.set(e,r)),r.push(t)},Ro=(t,e,r)=>{const n=\`\${e}_\${r}\`,s=mn.get(n);return s&&s.length>0?s.pop():t.createTexture({size:{width:e,height:r},format:"rgba8unorm",usage:Om})},Xt=t=>{const e=\`\${t.width}_\${t.height}\`;let r=mn.get(e);r||(r=[],mn.set(e,r)),r.push(t)},Em=()=>{for(const[,t]of pn)for(const e of t)e.destroy();pn.clear();for(const[,t]of mn)for(const e of t)e.destroy();mn.clear()},rc=new Map,Rm=()=>{for(const t of rc.values())t.texture?.resource&&t.texture.resource.destroy();rc.clear()},Lr=new Map;let gn=0;const Cm=60,nc=(t,e,r)=>\`\${e}_\${r}_\${t.join(",")}\`,sc=(t,e,r)=>{const n=nc(t,e,r),s=Lr.get(n);return s?(s.lastUsedFrame=gn,s):null},oc=(t,e,r,n,s)=>{const o=nc(t,e,r);Lr.set(o,{texture:n,view:s,lastUsedFrame:gn})},Um=()=>{gn++;for(const[t,e]of Lr)gn-e.lastUsedFrame>Cm&&(Ot(e.texture),Lr.delete(t))},Gm=()=>{for(const t of Lr.values())Ot(t.texture);Lr.clear(),gn=0};let Co=null;const Lm=()=>{Co?.texture?.resource&&Co.texture.resource.destroy(),Co=null},km=(t,e,r,n,s,o)=>{const i=e.getPipeline("stencil_write_atlas");i&&(t.setPipeline(i),t.setStencilReference(0),t.setVertexBuffer(0,r),t.setBindGroup(0,s,[o]),t.draw(n,1,0,0));const l=e.getPipeline("stencil_fill_atlas");l&&(t.setPipeline(l),t.setStencilReference(0),t.setBindGroup(0,s,[o]),t.draw(n,1,0,0))},Im=(t,e,r,n,s,o)=>{const i=e.getPipeline("stencil_write_main");i&&(t.setPipeline(i),t.setStencilReference(0),t.setVertexBuffer(0,r),t.setBindGroup(0,s,[o]),t.draw(n,1,0,0));const l=e.getPipeline("stencil_fill_main");l&&(t.setPipeline(l),t.setStencilReference(0),t.setBindGroup(0,s,[o]),t.draw(n,1,0,0))},_m=(t,e,r,n,s,o,i,l=!1,c=1)=>{let u;if(i)u="fill";else if(l){if(nr())return;u="fill_bgra_stencil"}else u="fill_bgra";const a=e.getPipeline(u);if(!a){console.error(\`[WebGPU] \${u} pipeline not found\`);return}t.setPipeline(a),t.setVertexBuffer(0,r),t.setBindGroup(0,s,[o]),l&&!i&&!nr()&&t.setStencilReference(Or()),t.draw(n,1,0,0)},Uo=t=>t<=4?256:t<=8?512:1024,ic=(t,e,r)=>{const n=t.length/5,s=Uo(n),o=new Uint8Array(s*4);for(let i=0;i<s;i++){const l=i/(s-1),c=Vm(t,l,r),u=i*4;o[u+0]=Math.round(Math.max(0,Math.min(255,c.r))),o[u+1]=Math.round(Math.max(0,Math.min(255,c.g))),o[u+2]=Math.round(Math.max(0,Math.min(255,c.b))),o[u+3]=Math.round(Math.max(0,Math.min(255,c.a)))}return o},Vm=(t,e,r)=>{const n=t.length/5;let s=0,o=0;for(let x=0;x<n;x++){const y=t[x*5];if(y<=e&&(s=x),y>=e&&o===0){o=x;break}}if(o===0&&(o=n-1),s===o){const x=s*5;return{r:t[x+1],g:t[x+2],b:t[x+3],a:t[x+4]}}const i=t[s*5],l=t[o*5],c=(e-i)/(l-i),u=t[s*5+1],a=t[s*5+2],h=t[s*5+3],d=t[s*5+4],g=t[o*5+1],m=t[o*5+2],f=t[o*5+3],b=t[o*5+4];return r===0?{r:Go(ot(kr(u/255),kr(g/255),c))*255,g:Go(ot(kr(a/255),kr(m/255),c))*255,b:Go(ot(kr(h/255),kr(f/255),c))*255,a:ot(d,b,c)}:{r:ot(u,g,c),g:ot(a,m,c),b:ot(h,f,c),a:ot(d,b,c)}},ot=(t,e,r)=>t+(e-t)*r,kr=t=>Math.pow(t,2.23333333),Go=t=>Math.pow(t,.45454545),ac=(t,e,r)=>{const s=new Uint8Array(1024),o=t.length,i=[];for(let l=0;l<o;l++){const c=e[l];i.push({offset:t[l]/255,r:(c>>16&255)/255,g:(c>>8&255)/255,b:(c&255)/255,a:r[l]})}for(let l=0;l<256;l++){const c=l/255;let u=0,a=o-1;for(let P=0;P<o-1;P++)if(i[P].offset<=c&&i[P+1].offset>=c){u=P,a=P+1;break}const h=i[u],d=i[a];let g=0;d.offset!==h.offset&&(g=(c-h.offset)/(d.offset-h.offset));const m=ot(h.r,d.r,g),f=ot(h.g,d.g,g),b=ot(h.b,d.b,g),x=ot(h.a,d.a,g),y=l*4;s[y+0]=Math.round(m*x*255),s[y+1]=Math.round(f*x*255),s[y+2]=Math.round(b*x*255),s[y+3]=Math.round(x*255)}return s},cc=(t,e,r)=>{const n=t[0],s=t[1],o=t[2],i=t[3],l=t[4],c=t[5];if(r===0){const y=-819.2*n-819.2*o+l,P=819.2*n-819.2*o+l,S=-819.2*n+819.2*o+l,M=-819.2*s-819.2*i+c,$=819.2*s-819.2*i+c,T=-819.2*s+819.2*i+c;let w=S-y,E=T-M;const F=Math.sqrt(w*w+E*E);F?(w=w/F,E=E/F):(w=0,E=0);const A=(P-y)*w+($-M)*E,R=new Float32Array([y+A*w,M+A*E,P,$]);return{inverseMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),linearPoints:R}}const u=n*i-s*o;if(Math.abs(u)<1e-10)return{inverseMatrix:new Float32Array([1,0,0,0,1,0,0,0,1]),linearPoints:null};const a=1/u,h=i*a,d=-s*a,g=-o*a,m=n*a,f=(o*c-i*l)*a,b=(s*l-n*c)*a;return{inverseMatrix:new Float32Array([h,d,0,g,m,0,f,b,1]),linearPoints:null}};let Lo=null;const j=new Float32Array(36),Ue=new Float32Array(16);let ko=null,lc=null;const ss=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],Dm=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b=!1,x=1)=>{const y=dn(s);if(y.indexCount===0)return null;const P=r.acquireVertexBuffer(y.buffer.byteLength,y.buffer);let S,M;const $=sc(c,a,h);if($)S=$.texture,M=$.view;else{const V=ic(c,a,h),X=c.length/5,Y=Uo(X);S=ns(t,Y,1),t.queue.writeTexture({texture:S},V,{bytesPerRow:Y*4,rowsPerImage:1},{width:Y,height:1}),M=S.createView(),oc(c,a,h,S,M)}const T=cc(u,o,l),w=i[3]>0?i[3]:1,E=o[0],F=o[1],A=o[3],R=o[4],v=o[6],U=o[7];j[0]=T.inverseMatrix[0],j[1]=T.inverseMatrix[3],j[2]=0,j[3]=0,j[4]=T.inverseMatrix[1],j[5]=T.inverseMatrix[4],j[6]=0,j[7]=0,j[8]=T.inverseMatrix[6],j[9]=T.inverseMatrix[7],j[10]=1,j[11]=0,j[12]=l,j[13]=Math.max(-.975,Math.min(.975,d)),j[14]=a,j[15]=819.2,T.linearPoints?(j[16]=T.linearPoints[0],j[17]=T.linearPoints[1],j[18]=T.linearPoints[2],j[19]=T.linearPoints[3]):(j[16]=0,j[17]=0,j[18]=0,j[19]=0),j[20]=1,j[21]=1,j[22]=1,j[23]=w,j[24]=E/g,j[25]=F/m,j[26]=0,j[27]=0,j[28]=A/g,j[29]=R/m,j[30]=0,j[31]=0,j[32]=v/g,j[33]=U/m,j[34]=1,j[35]=0;const L=r.acquireAndWriteUniformBuffer(j);Lo||(Lo=t.createSampler({magFilter:"linear",minFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}));const D=Lo,G=n.getBindGroupLayout("gradient_fill");if(!G)return console.error("[WebGPU] gradient_fill bind group layout not found"),null;ss[0].resource.buffer=L,ss[1].resource=D,ss[2].resource=M;const B=t.createBindGroup({layout:G,entries:ss}),z=()=>{const V=n.getBindGroupLayout("fill_dynamic");if(!V)return null;Ue[0]=1,Ue[1]=1,Ue[2]=1,Ue[3]=w,Ue[4]=E/g,Ue[5]=F/m,Ue[6]=0,Ue[7]=0,Ue[8]=A/g,Ue[9]=R/m,Ue[10]=0,Ue[11]=0,Ue[12]=v/g,Ue[13]=U/m,Ue[14]=1,Ue[15]=0;const X=r.dynamicUniform.allocate(Ue),Y=r.dynamicUniform.getBuffer();return(!ko||lc!==Y)&&(ko=t.createBindGroup({layout:V,entries:[{binding:0,resource:{buffer:Y,size:256}}]}),lc=Y),{bindGroup:ko,offset:X}};if(f){const V=n.getPipeline("stencil_write_atlas");if(V){const Y=z();e.setPipeline(V),e.setStencilReference(0),e.setVertexBuffer(0,P),Y&&e.setBindGroup(0,Y.bindGroup,[Y.offset]),e.draw(y.indexCount,1,0,0)}const X=n.getGradientPipeline("gradient_fill_stencil_atlas",l,a);return X&&(e.setPipeline(X),e.setStencilReference(0),e.setBindGroup(0,B),e.draw(y.indexCount,1,0,0)),null}if(b&&nr())return null;const k=n.getPipeline("stencil_write_main");if(k){const V=z();e.setPipeline(k),e.setStencilReference(0),e.setVertexBuffer(0,P),V&&e.setBindGroup(0,V.bindGroup,[V.offset]),e.draw(y.indexCount,1,0,0)}const _=b?"gradient_fill_bgra_stencil_masked":"gradient_fill_stencil_main",I=n.getGradientPipeline(_,l,a);return I&&(e.setPipeline(I),e.setStencilReference(b?Or():0),e.setBindGroup(0,B),e.draw(y.indexCount,1,0,0)),null},uc=(t,e)=>{const r=t[0],n=t[1],s=t[2],o=t[3],i=t[4],l=t[5],c=e[0],u=e[1],a=e[3],h=e[4],d=e[6],g=e[7],m=c*r+a*n,f=c*s+a*o,b=u*r+h*n,x=u*s+h*o,y=c*i+a*l+d,P=u*i+h*l+g,S=m*x-f*b;if(Math.abs(S)<1e-10)return new Float32Array([1,0,0,0,1,0,0,0,1]);const M=1/S,$=x*M,T=-f*M,w=-b*M,E=m*M,F=(f*P-x*y)*M,A=(b*y-m*P)*M,R=$*c+T*u,v=$*a+T*h,U=w*c+E*u,L=w*a+E*h,D=$*d+T*g+F,G=w*d+E*g+A;return new Float32Array([R,U,0,v,L,0,D,G,1])},fc=new Map,Z=new Float32Array(32),Ge=new Float32Array(16);let Io=null,hc=null;const os=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],Nm=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b=!1,x=1)=>{const y=dn(s);if(y.indexCount===0)return null;const P=r.acquireVertexBuffer(y.buffer.byteLength,y.buffer),S=ns(t,u,a);t.queue.writeTexture({texture:S},l.buffer,{bytesPerRow:u*4,rowsPerImage:a,offset:l.byteOffset},{width:u,height:a});const M=uc(c,o),$=i[0],T=i[1],w=i[2],E=i[3],F=o[0],A=o[1],R=o[3],v=o[4],U=o[6],L=o[7];Z[0]=M[0],Z[1]=M[1],Z[2]=M[2],Z[3]=0,Z[4]=M[3],Z[5]=M[4],Z[6]=M[5],Z[7]=0,Z[8]=M[6],Z[9]=M[7],Z[10]=M[8],Z[11]=0,Z[12]=u,Z[13]=a,Z[14]=h?1:0,Z[15]=0,Z[16]=$,Z[17]=T,Z[18]=w,Z[19]=E,Z[20]=F/g,Z[21]=A/m,Z[22]=0,Z[23]=0,Z[24]=R/g,Z[25]=v/m,Z[26]=0,Z[27]=0,Z[28]=U/g,Z[29]=L/m,Z[30]=1,Z[31]=0;const D=r.acquireAndWriteUniformBuffer(Z),G=\`bitmap_\${d?"s":"n"}_\${h?"r":"c"}\`;let B=fc.get(G);B||(B=t.createSampler({magFilter:d?"linear":"nearest",minFilter:d?"linear":"nearest",addressModeU:h?"repeat":"clamp-to-edge",addressModeV:h?"repeat":"clamp-to-edge"}),fc.set(G,B));const z=n.getBindGroupLayout("bitmap_fill");if(!z)return console.error("[WebGPU] bitmap_fill bind group layout not found"),Ot(S),null;os[0].resource.buffer=D,os[1].resource=B,os[2].resource=S.createView();const k=t.createBindGroup({layout:z,entries:os}),_=()=>{const I=n.getBindGroupLayout("fill_dynamic");if(!I)return null;Ge[0]=$,Ge[1]=T,Ge[2]=w,Ge[3]=E,Ge[4]=F/g,Ge[5]=A/m,Ge[6]=0,Ge[7]=0,Ge[8]=R/g,Ge[9]=v/m,Ge[10]=0,Ge[11]=0,Ge[12]=U/g,Ge[13]=L/m,Ge[14]=1,Ge[15]=0;const V=r.dynamicUniform.allocate(Ge),X=r.dynamicUniform.getBuffer();return(!Io||hc!==X)&&(Io=t.createBindGroup({layout:I,entries:[{binding:0,resource:{buffer:X,size:256}}]}),hc=X),{bindGroup:Io,offset:V}};if(f&&b){const I=n.getPipeline("stencil_write");if(I){const X=_();X&&(e.setPipeline(I),e.setStencilReference(0),e.setVertexBuffer(0,P),e.setBindGroup(0,X.bindGroup,[X.offset]),e.draw(y.indexCount,1,0,0))}const V=n.getPipeline("bitmap_fill_stencil");V&&(e.setPipeline(V),e.setStencilReference(0),e.setBindGroup(0,k),e.draw(y.indexCount,1,0,0))}else{let I;if(f)I="bitmap_fill";else if(b){if(nr())return Ot(S),null;I="bitmap_fill_bgra_stencil"}else I="bitmap_fill_bgra";const V=n.getPipeline(I);if(!V)return console.error(\`[WebGPU] \${I} pipeline not found\`),Ot(S),null;e.setPipeline(V),e.setVertexBuffer(0,P),e.setBindGroup(0,k),b&&!f&&!nr()&&e.setStencilReference(Or()),e.draw(y.indexCount,1,0,0)}return S},dc=(t,e,r)=>{const n=t.length-5;for(let s=3;s<n;s+=3){let o=r*4;t[s+2]?(e[o++]=t[s-3],e[o++]=t[s-2],e[o++]=.5,e[o++]=.5,e[o++]=t[s],e[o++]=t[s+1],e[o++]=.5,e[o++]=.5,e[o++]=t[s+3],e[o++]=t[s+4],e[o++]=.5,e[o++]=.5):t[s+5]?(e[o++]=t[0],e[o++]=t[1],e[o++]=.5,e[o++]=.5,e[o++]=t[s],e[o++]=t[s+1],e[o++]=.5,e[o++]=.5,e[o++]=t[s+6],e[o++]=t[s+7],e[o++]=.5,e[o++]=.5):(e[o++]=t[0],e[o++]=t[1],e[o++]=.5,e[o++]=.5,e[o++]=t[s],e[o++]=t[s+1],e[o++]=.5,e[o++]=.5,e[o++]=t[s+3],e[o++]=t[s+4],e[o++]=.5,e[o++]=.5),r+=3}return r};let _o=new Float32Array(32);const zm=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t),Xm=(t,e)=>{const r=e/2,n=[];for(const c of t){const u=Oo(c,r);for(const a of u)n.push(a)}let s=0;for(const c of n){const u=c.length-5;for(let a=3;a<u;a+=3)s+=3}if(s===0)return{buffer:new Float32Array(0),indexCount:0};const o=s*4;_o.length<o&&(_o=new Float32Array(zm(o)));const i=_o;let l=0;for(const c of n)l=dc(c,i,l);return{buffer:i.subarray(0,l*4),indexCount:l}};let Vo=null;const H=new Float32Array(36),is=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],Ym=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b,x)=>{const y=Xm(s,o);if(y.indexCount===0)return null;const P=r.acquireVertexBuffer(y.buffer.byteLength,y.buffer);let S,M;const $=sc(u,h,d);if($)S=$.texture,M=$.view;else{const _=ic(u,h,d),I=u.length/5,V=Uo(I);S=ns(t,V,1),t.queue.writeTexture({texture:S},_,{bytesPerRow:V*4,rowsPerImage:1},{width:V,height:1}),M=S.createView(),oc(u,h,d,S,M)}const T=cc(a,i,c),w=l[3]>0?l[3]:1,E=i[0],F=i[1],A=i[3],R=i[4],v=i[6],U=i[7];H[0]=T.inverseMatrix[0],H[1]=T.inverseMatrix[3],H[2]=0,H[3]=0,H[4]=T.inverseMatrix[1],H[5]=T.inverseMatrix[4],H[6]=0,H[7]=0,H[8]=T.inverseMatrix[6],H[9]=T.inverseMatrix[7],H[10]=1,H[11]=0,H[12]=c,H[13]=Math.max(-.975,Math.min(.975,g)),H[14]=h,H[15]=819.2,T.linearPoints?(H[16]=T.linearPoints[0],H[17]=T.linearPoints[1],H[18]=T.linearPoints[2],H[19]=T.linearPoints[3]):(H[16]=0,H[17]=0,H[18]=0,H[19]=0),H[20]=1,H[21]=1,H[22]=1,H[23]=w,H[24]=E/m,H[25]=F/f,H[26]=0,H[27]=0,H[28]=A/m,H[29]=R/f,H[30]=0,H[31]=0,H[32]=v/m,H[33]=U/f,H[34]=1,H[35]=0;const L=r.acquireAndWriteUniformBuffer(H);Vo||(Vo=t.createSampler({magFilter:"linear",minFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}));const D=Vo,G=n.getBindGroupLayout("gradient_fill");if(!G)return console.error("[WebGPU] gradient_fill bind group layout not found"),null;is[0].resource.buffer=L,is[1].resource=D,is[2].resource=M;const B=t.createBindGroup({layout:G,entries:is}),z=x?b?"gradient_stroke_atlas":"gradient_stroke_bgra":b?"gradient_fill":"gradient_fill_bgra",k=n.getGradientPipeline(z,c,h);return k?(e.setPipeline(k),e.setVertexBuffer(0,P),e.setBindGroup(0,B),e.draw(y.indexCount,1,0,0),null):(console.error(\`[WebGPU] \${z} pipeline not found\`),null)};let Do=new Float32Array(32);const Wm=t=>(t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,t++,t),jm=(t,e)=>{const r=e/2,n=[];for(const c of t){const u=Oo(c,r);for(const a of u)n.push(a)}let s=0;for(const c of n){const u=c.length-5;for(let a=3;a<u;a+=3)s+=3}if(s===0)return{buffer:new Float32Array(0),indexCount:0};const o=s*4;Do.length<o&&(Do=new Float32Array(Wm(o)));const i=Do;let l=0;for(const c of n)l=dc(c,i,l);return{buffer:i.subarray(0,l*4),indexCount:l}},pc=new Map,J=new Float32Array(32),as=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],Hm=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m,f,b,x)=>{const y=jm(s,o);if(y.indexCount===0)return null;const P=r.acquireVertexBuffer(y.buffer.byteLength,y.buffer),S=ns(t,a,h);t.queue.writeTexture({texture:S},c.buffer,{bytesPerRow:a*4,rowsPerImage:h,offset:c.byteOffset},{width:a,height:h});const M=uc(u,i),$=1,T=1,w=1,E=l[3]>0?l[3]:1,F=i[0],A=i[1],R=i[3],v=i[4],U=i[6],L=i[7];J[0]=M[0],J[1]=M[1],J[2]=M[2],J[3]=0,J[4]=M[3],J[5]=M[4],J[6]=M[5],J[7]=0,J[8]=M[6],J[9]=M[7],J[10]=M[8],J[11]=0,J[12]=a,J[13]=h,J[14]=d?1:0,J[15]=0,J[16]=$,J[17]=T,J[18]=w,J[19]=E,J[20]=F/m,J[21]=A/f,J[22]=0,J[23]=0,J[24]=R/m,J[25]=v/f,J[26]=0,J[27]=0,J[28]=U/m,J[29]=L/f,J[30]=1,J[31]=0;const D=r.acquireAndWriteUniformBuffer(J),G=\`bitmap_\${g?"s":"n"}_\${d?"r":"c"}\`;let B=pc.get(G);B||(B=t.createSampler({magFilter:g?"linear":"nearest",minFilter:g?"linear":"nearest",addressModeU:d?"repeat":"clamp-to-edge",addressModeV:d?"repeat":"clamp-to-edge"}),pc.set(G,B));const z=n.getBindGroupLayout("bitmap_fill");if(!z)return console.error("[WebGPU] bitmap_fill bind group layout not found"),Ot(S),null;as[0].resource.buffer=D,as[1].resource=B,as[2].resource=S.createView();const k=t.createBindGroup({layout:z,entries:as}),_=x?b?"bitmap_stroke_atlas":"bitmap_stroke_bgra":b?"bitmap_fill":"bitmap_fill_bgra",I=n.getPipeline(_);return I?(e.setPipeline(I),e.setVertexBuffer(0,P),e.setBindGroup(0,k),e.draw(y.indexCount,1,0,0),S):(console.error(\`[WebGPU] \${_} pipeline not found\`),Ot(S),null)},mc=new Float32Array([-1,-1,.5,.5,1,-1,.5,.5,-1,1,.5,.5,-1,1,.5,.5,1,-1,.5,.5,1,1,.5,.5]),Km=new Float32Array([1,1,1,1,.5,0,0,0,0,.5,0,0,.5,.5,1,0]),qm=(t,e,r,n,s)=>{if(!s)return;const o=s.clipLevel,i=1<<o-1,l=r.acquireVertexBuffer(mc.byteLength,mc),c=r.dynamicUniform.allocate(Km),u=n.getBindGroupLayout("fill_dynamic");if(!u)return;const a=t.createBindGroup({layout:u,entries:[{binding:0,resource:{buffer:r.dynamicUniform.getBuffer(),size:256}}]}),h=n.getPipeline(\`mask_union_merge_\${o}\`);h&&(e.setPipeline(h),e.setStencilReference(i),e.setVertexBuffer(0,l),e.setBindGroup(0,a,[c]),e.draw(6,1,0,0));const d=n.getPipeline(\`mask_union_clear_\${o}\`);d&&(e.setPipeline(d),e.setStencilReference(0),e.setVertexBuffer(0,l),e.setBindGroup(0,a,[c]),e.draw(6,1,0,0))},Le=new Float32Array(16),Qm=(t,e,r,n,s,o,i,l,c,u=!1)=>{const a=s.clipLevel,h=s.width,d=s.height,g=l[0],m=l[1],f=l[2],b=l[3]*c;if(o.length===0)return;const x=dn(o);if(x.indexCount===0)return;const y=r.acquireVertexBuffer(x.buffer.byteLength,x.buffer),P=i[0],S=i[1],M=i[3],$=i[4],T=i[6],w=i[7];Le[0]=g,Le[1]=m,Le[2]=f,Le[3]=b,Le[4]=P/h,Le[5]=S/d,Le[6]=0,Le[7]=0,Le[8]=M/h,Le[9]=$/d,Le[10]=0,Le[11]=0,Le[12]=T/h,Le[13]=w/d,Le[14]=1,Le[15]=0;const E=r.dynamicUniform.allocate(Le);let F=Rr.get(a)??a,A;u?A=\`clip_write_main_\${Math.min(8,Math.max(1,F))}\`:A="clip_write";const R=n.getPipeline(A);if(!R){console.error(\`[WebGPU] \${A} pipeline not found\`);return}const v=n.getBindGroupLayout("fill_dynamic");if(!v)return;const U=t.createBindGroup({layout:v,entries:[{binding:0,resource:{buffer:r.dynamicUniform.getBuffer(),size:256}}]});e.setPipeline(R),e.setStencilReference(0),e.setVertexBuffer(0,y),e.setBindGroup(0,U,[E]),e.draw(x.indexCount,1,0,0),F++,F>8&&(qm(t,e,r,n,s),F=a+1),Rr.set(a,F)};let No=null,gc=null;const Zm=(t,e,r,n,s,o,i,l)=>{const c=rs();if(c.count===0)return r;r&&(r.end(),r=null);const u=gt(),a=Or(),g=(F=>{switch(F){case"add":return"instanced_add";case"screen":return"instanced_screen";case"alpha":return"instanced_alpha";case"erase":return"instanced_erase";case"copy":return"instanced_copy";default:return"instanced"}})(ts),m=l.getPipeline(g),f=l.getPipeline("instanced_masked"),b=u&&f&&(n.msaaStencil?.view||n.stencil?.view),x=b?f:m;if(!x)return console.error("[WebGPU] Instanced pipeline not found"),null;let y;if(b){const F=n.msaa&&n.msaaTexture?.view,A=F?n.msaaTexture.view:n.texture.view,R=F&&n.msaaStencil?.view?n.msaaStencil.view:n.stencil.view,v=F?n.texture.view:null,U=o.createStencilRenderPassDescriptor(A,R,"load","load",v);y=e.beginRenderPass(U)}else{const F=n.msaa&&n.msaaTexture?.view,A=F?n.msaaTexture.view:n.texture.view,R=F?n.texture.view:null,v=o.createRenderPassDescriptor(A,0,0,0,0,"load",R);y=e.beginRenderPass(v)}y.setPipeline(x),b&&y.setStencilReference(a);const P=new Float32Array(Ve.buffer.buffer,Ve.buffer.byteOffset,Ve.offset),S=s.acquireVertexBuffer(P.byteLength,P),M=s.getUnitRectBuffer(),$=Ne()||o.getAttachment("atlas");if(!$)return console.error("[WebGPU] Atlas attachment not found"),y.end(),null;const T=i.createSampler("atlas_instanced_sampler",!1),w=l.getBindGroupLayout("instanced");if(!w)return console.error("[WebGPU] Instanced bind group layout not found"),y.end(),null;const E=$.texture.view;return(!No||gc!==E)&&(No=t.createBindGroup({layout:w,entries:[{binding:0,resource:T},{binding:1,resource:E}]}),gc=E),y.setVertexBuffer(0,M),y.setVertexBuffer(1,S),y.setBindGroup(0,No),y.draw(6,c.count,0,0),y.end(),c.clear(),null};let zo=null,bc=null;const Jm=(t,e,r,n,s,o,i,l,c=!0,u=!0)=>{const a=rs();if(a.count===0)return r;r&&(r.end(),r=null);const h=gt(),d=Or(),f=(R=>{switch(R){case"add":return"instanced_add";case"screen":return"instanced_screen";case"alpha":return"instanced_alpha";case"erase":return"instanced_erase";case"copy":return"instanced_copy";default:return"instanced"}})(ts),b=l.getPipeline(f),x=l.getPipeline("instanced_masked"),y=h&&x&&(n.msaaStencil?.view||n.stencil?.view),P=y?x:b;if(!P)return console.error("[WebGPU] Instanced pipeline not found"),null;let S;if(y){const R=n.msaa&&n.msaaTexture?.view,v=R?n.msaaTexture.view:n.texture.view,U=R&&n.msaaStencil?.view?n.msaaStencil.view:n.stencil.view,L=R?n.texture.view:null,D=o.createStencilRenderPassDescriptor(v,U,"load","load",L);S=e.beginRenderPass(D)}else{const R=n.msaa&&n.msaaTexture?.view,v=R?n.msaaTexture.view:n.texture.view,U=R?n.texture.view:null,L=o.createRenderPassDescriptor(v,0,0,0,0,"load",U);S=e.beginRenderPass(L)}S.setPipeline(P),y&&S.setStencilReference(d);const M=new Float32Array(Ve.buffer.buffer,Ve.buffer.byteOffset,Ve.offset);let $;u?($=s.acquireStorageBuffer(M.byteLength),s.writeStorageBuffer($,M)):$=s.acquireVertexBuffer(M.byteLength,M);const T=s.getUnitRectBuffer(),w=Ne()||o.getAttachment("atlas");if(!w)return console.error("[WebGPU] Atlas attachment not found"),S.end(),null;const E=i.createSampler("atlas_instanced_sampler",!1),F=l.getBindGroupLayout("instanced");if(!F)return console.error("[WebGPU] Instanced bind group layout not found"),S.end(),null;const A=w.texture.view;if((!zo||bc!==A)&&(zo=t.createBindGroup({layout:F,entries:[{binding:0,resource:E},{binding:1,resource:A}]}),bc=A),S.setVertexBuffer(0,T),S.setVertexBuffer(1,$),S.setBindGroup(0,zo),c){const R=s.createIndirectBuffer(6,a.count,0,0);S.drawIndirect(R,0)}else S.draw(6,a.count,0,0);return S.end(),a.clear(),null},je=new Float32Array(12),bn=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null},{binding:3,resource:null}],Xo=(t,e,r,n,s)=>{const{device:o,commandEncoder:i,frameBufferManager:l,pipelineManager:c,textureManager:u}=s,a=Math.max(t.width,e.width),h=Math.max(t.height,e.height),d=l.createTemporaryAttachment(a,h),g=c.getPipeline("complex_blend"),m=c.getBindGroupLayout("complex_blend");if(!g||!m)return console.error(\`[WebGPU ComplexBlend] Pipeline not found for blend mode: \${r}\`),t;const f=u.createSampler("complex_blend_sampler",!0),b=N.getBlendModeIndex(r);je[0]=n[0],je[1]=n[1],je[2]=n[2],je[3]=n[3],je[4]=n[4],je[5]=n[5],je[6]=n[6],je[7]=n[7],je[8]=b,je[9]=0,je[10]=0,je[11]=0;const x=s.bufferManager?s.bufferManager.acquireAndWriteUniformBuffer(je):o.createBuffer({size:48,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});s.bufferManager||o.queue.writeBuffer(x,0,je),bn[0].resource.buffer=x,bn[1].resource=f,bn[2].resource=e.texture.view,bn[3].resource=t.texture.view;const y=o.createBindGroup({layout:m,entries:bn}),P=l.createRenderPassDescriptor(d.texture.view,0,0,0,0,"clear"),S=i.beginRenderPass(P);return S.setPipeline(g),S.setBindGroup(0,y),S.draw(6,1,0,0),S.end(),d},xn=new Float32Array(4),it=new Float32Array(6),Oe=new Float32Array(8),Qe=new Float32Array(12),at=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],e0=(t,e,r,n,s,o,i,l,c,u,a,h,d,g)=>{const m=d.getPipeline("complex_blend_copy"),f=d.getBindGroupLayout("texture_copy");if(!m||!f)return;xn[0]=c/i,xn[1]=u/l,xn[2]=s/i,xn[3]=o/l;const b=g.acquireAndWriteUniformBuffer(xn),x=h.createSampler("complex_blend_copy_sampler",!1);at[0].resource.buffer=b,at[1].resource=x,at[2].resource=r;const y=t.createBindGroup({layout:f,entries:at}),P=a.createRenderPassDescriptor(n.texture.view,0,0,0,0,"clear"),S=e.beginRenderPass(P);S.setPipeline(m),S.setBindGroup(0,y),S.draw(6,1,0,0),S.end()},t0=(t,e,r,n,s,o,i,l,c,u)=>{const a=n.msaa&&n.msaaTexture?.view,h=a?"complex_blend_output_msaa":"complex_blend_output",d=c.getPipeline(h),g=c.getBindGroupLayout("positioned_texture");if(!d||!g)return;Oe[0]=s,Oe[1]=o,Oe[2]=r.width,Oe[3]=r.height,Oe[4]=n.width,Oe[5]=n.height,Oe[6]=0,Oe[7]=0;const m=u.acquireAndWriteUniformBuffer(Oe),f=l.createSampler("complex_blend_output_sampler",!1);at[0].resource.buffer=m,at[1].resource=f,at[2].resource=r.texture.view;const b=t.createBindGroup({layout:g,entries:at}),x=a?n.msaaTexture.view:n.texture.view,y=a?n.texture.view:null,P=i.createRenderPassDescriptor(x,0,0,0,0,"load",y),S=e.beginRenderPass(P);S.setPipeline(d),S.setBindGroup(0,b),S.draw(6,1,0,0),S.end()},r0=(t,e,r,n,s,o,i)=>{const l=om();if(l.length===0)return;if(!r||!r.texture){So();return}const c=Ne()||n.getAttachment("atlas");if(!c||!c.texture){So();return}for(const u of l){const{node:a,x_min:h,y_min:d,x_max:g,y_max:m,color_transform:f,matrix:b,blend_mode:x,global_alpha:y}=u,P=Math.ceil(Math.abs(g-h)),S=Math.ceil(Math.abs(m-d));if(P<=0||S<=0)continue;const M=Math.max(0,Math.floor(b[6])),$=Math.max(0,Math.floor(b[7]));if(M>=r.width||$>=r.height)continue;const T=b[0]!==1||b[1]!==0||b[3]!==0||b[4]!==1,w=T?P:a.w,E=T?S:a.h,F=Math.min(w,r.width-M),A=Math.min(E,r.height-$);if(F<=0||A<=0)continue;let R;if(T){R=n.createTemporaryAttachment(w,E);const L=o.getPipeline("complex_blend_scale"),D=o.getBindGroupLayout("texture_scale");if(L&&D){const G=w/2,B=E/2,z=a.w/2,k=a.h/2;it[0]=b[0],it[1]=b[1],it[2]=b[3],it[3]=b[4],it[4]=-z*b[0]-k*b[3]+G,it[5]=-z*b[1]-k*b[4]+B;const _=n.createTemporaryAttachment(a.w,a.h);e.copyTextureToTexture({texture:c.texture.resource,origin:{x:a.x,y:a.y,z:0}},{texture:_.texture.resource,origin:{x:0,y:0,z:0}},{width:a.w,height:a.h}),Qe[0]=it[0],Qe[1]=it[1],Qe[2]=it[2],Qe[3]=it[3],Qe[4]=it[4],Qe[5]=it[5],Qe[6]=a.w,Qe[7]=a.h,Qe[8]=w,Qe[9]=E,Qe[10]=0,Qe[11]=0;const I=i.acquireAndWriteUniformBuffer(Qe,48),V=s.createSampler("scale_sampler",!0);at[0].resource.buffer=I,at[1].resource=V,at[2].resource=_.texture.view;const X=t.createBindGroup({layout:D,entries:at}),Y=n.createRenderPassDescriptor(R.texture.view,0,0,0,0,"clear"),W=e.beginRenderPass(Y);W.setPipeline(L),W.setBindGroup(0,X),W.draw(6,1,0,0),W.end(),n.releaseTemporaryAttachment(_)}else e.copyTextureToTexture({texture:c.texture.resource,origin:{x:a.x,y:a.y,z:0}},{texture:R.texture.resource,origin:{x:0,y:0,z:0}},{width:Math.min(a.w,w),height:Math.min(a.h,E)})}else R=n.createTemporaryAttachment(w,E),e.copyTextureToTexture({texture:c.texture.resource,origin:{x:a.x,y:a.y,z:0}},{texture:R.texture.resource,origin:{x:0,y:0,z:0}},{width:w,height:E});const v=n.createTemporaryAttachment(w,E);e0(t,e,r.texture.view,v,M,$,r.width,r.height,w,E,n,s,o,i),Oe[0]=f[0],Oe[1]=f[1],Oe[2]=f[2],Oe[3]=y,Oe[4]=f[4],Oe[5]=f[5],Oe[6]=f[6],Oe[7]=0;const U=Xo(R,v,x,Oe,{device:t,commandEncoder:e,bufferManager:i,frameBufferManager:n,pipelineManager:o,textureManager:s});t0(t,e,U,r,M,$,n,s,o,i),n.releaseTemporaryAttachment(R),n.releaseTemporaryAttachment(v),n.releaseTemporaryAttachment(U)}So()},ne={x:0,y:0},xc=[.5,1.05,1.4,1.55,1.75,1.9,2,2.15,2.2,2.3,2.5,3,3,3.5,3.5],n0=(t,e,r,n,s)=>{const o=Math.sqrt(t[0]*t[0]+t[1]*t[1]),i=Math.sqrt(t[2]*t[2]+t[3]*t[3]),l=e*(o/s),c=r*(i/s),u=xc[Math.min(n-1,xc.length-1)],a=Math.round(l*u),h=Math.round(c*u);let d=1,g=1;return l>128?d=.0625:l>64?d=.125:l>32?d=.25:l>16&&(d=.5),c>128?g=.0625:c>64?g=.125:c>32?g=.25:c>16&&(g=.5),{baseBlurX:l,baseBlurY:c,offsetX:a,offsetY:h,bufferScaleX:d,bufferScaleY:g}},s0=(t,e,r,n)=>{const s=Math.ceil(e*.5),o=1-(s-e*.5),i=1+e,l=t?1/r:0,c=t?0:1/n;return{offsetX:l,offsetY:c,fraction:o,samples:i,halfBlur:s}},ht=new Float32Array(8),cs=[{binding:0,resource:null},{binding:1,resource:null},{binding:2,resource:{buffer:null}}],o0={label:"blur_compute_pass_h"},i0={label:"blur_compute_pass_v"},yc=(t,e,r,n,s,o,i,l)=>{const c=Math.ceil(i*.5),a=c>=8&&c<=24?o?"blur_compute_shared_horizontal":"blur_compute_shared_vertical":o?"blur_compute_horizontal":"blur_compute_vertical",h=r.getPipeline(a),d=r.getBindGroupLayout("blur_compute");if(!h||!d)return;const g=1-(c-i*.5),m=1+i;ht[0]=o?1:0,ht[1]=o?0:1,ht[2]=c,ht[3]=g,ht[4]=n.width,ht[5]=n.height,ht[6]=m,ht[7]=0;const f=l?l.acquireAndWriteUniformBuffer(ht):(()=>{const S=t.createBuffer({size:ht.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});return t.queue.writeBuffer(S,0,ht),S})();cs[0].resource=n.texture.view,cs[1].resource=s.texture.view,cs[2].resource.buffer=f;const b=t.createBindGroup({layout:d,entries:cs}),x=e.beginComputePass(o?o0:i0);x.setPipeline(h),x.setBindGroup(0,b);const y=Math.ceil(s.width/16),P=Math.ceil(s.height/16);x.dispatchWorkgroups(y,P,1),x.end()},a0=(t,e,r,n)=>{const i=Math.max(t,e),l=Math.min(r,n);return i>=4&&l>=128},ye=new Float32Array(4),ct=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],sr=(t,e,r,n,s,o,i)=>{const{device:l,commandEncoder:c,frameBufferManager:u,pipelineManager:a,textureManager:h}=i,d=n0(e,r,n,s,o),{baseBlurX:g,baseBlurY:m,offsetX:f,offsetY:b,bufferScaleX:x,bufferScaleY:y}=d;ne.x+=f,ne.y+=b;const P=t.width+f*2,S=t.height+b*2,M=Math.ceil(P*x),$=Math.ceil(S*y),T=u.createTemporaryAttachment(M,$),w=u.createTemporaryAttachment(M,$),E=h.createSampler("blur_sampler",!0);c0(l,c,u,a,t,T,E,x,y,f*x,b*y,i.bufferManager);const F=g*x,A=m*y,R=i.computePipelineManager&&a0(g,m,M,$),v=[T,w];let U=0;for(let D=0;D<s;++D){if(r>0){const G=U;U=(U+1)%2,R?yc(l,c,i.computePipelineManager,v[G],v[U],!0,F,i.bufferManager):vc(l,c,u,a,v[G],v[U],E,!0,F,i.bufferManager)}if(n>0){const G=U;U=(U+1)%2,R?yc(l,c,i.computePipelineManager,v[G],v[U],!1,A,i.bufferManager):vc(l,c,u,a,v[G],v[U],E,!1,A,i.bufferManager)}}let L=v[U];if(x!==1||y!==1){const D=u.createTemporaryAttachment(P,S);l0(l,c,u,a,L,D,E,1/x,1/y,i.bufferManager),u.releaseTemporaryAttachment(T),u.releaseTemporaryAttachment(w),L=D}else{const D=(U+1)%2;u.releaseTemporaryAttachment(v[D])}return L},c0=(t,e,r,n,s,o,i,l,c,u,a,h)=>{const d=n.getPipeline("texture_copy_rgba8"),g=n.getBindGroupLayout("texture_copy");if(!d||!g){console.error("[WebGPU BlurFilter] texture_copy_rgba8 pipeline not found");return}const m=s.width*l,f=s.height*c,b=1,x=1,y=0,P=0;ye[0]=b,ye[1]=x,ye[2]=y,ye[3]=P;const S=h?h.acquireAndWriteUniformBuffer(ye):t.createBuffer({size:ye.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});h||t.queue.writeBuffer(S,0,ye),ct[0].resource.buffer=S,ct[1].resource=i,ct[2].resource=s.texture.view;const M=t.createBindGroup({layout:g,entries:ct}),$=r.createRenderPassDescriptor(o.texture.view,0,0,0,0,"clear"),T=e.beginRenderPass($);T.setPipeline(d),T.setBindGroup(0,M),T.setViewport(u,a,m,f,0,1),T.setScissorRect(Math.floor(u),Math.floor(a),Math.ceil(m),Math.ceil(f)),T.draw(6,1,0,0),T.end()},vc=(t,e,r,n,s,o,i,l,c,u)=>{const a=s0(l,c,s.width,s.height),{offsetX:h,offsetY:d,fraction:g,samples:m,halfBlur:f}=a,b=Math.max(1,Math.min(16,f)),x=n.getPipeline(\`blur_filter_\${b}\`),y=n.getBindGroupLayout("blur_filter");if(!x||!y){console.error(\`[WebGPU BlurFilter] blur_filter_\${b} pipeline not found\`);return}ye[0]=h,ye[1]=d,ye[2]=g,ye[3]=m;const P=u?u.acquireAndWriteUniformBuffer(ye):t.createBuffer({size:ye.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});u||t.queue.writeBuffer(P,0,ye),ct[0].resource.buffer=P,ct[1].resource=i,ct[2].resource=s.texture.view;const S=t.createBindGroup({layout:y,entries:ct}),M=r.createRenderPassDescriptor(o.texture.view,0,0,0,0,"clear"),$=e.beginRenderPass(M);$.setPipeline(x),$.setBindGroup(0,S),$.draw(6,1,0,0),$.end()},l0=(t,e,r,n,s,o,i,l,c,u)=>{const a=n.getPipeline("texture_copy_rgba8"),h=n.getBindGroupLayout("texture_copy");if(!a||!h){console.error("[WebGPU BlurFilter] texture_copy_rgba8 pipeline not found");return}ye[0]=1,ye[1]=1,ye[2]=0,ye[3]=0;const d=u?u.acquireAndWriteUniformBuffer(ye):t.createBuffer({size:ye.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});u||t.queue.writeBuffer(d,0,ye),ct[0].resource.buffer=d,ct[1].resource=i,ct[2].resource=s.texture.view;const g=t.createBindGroup({layout:h,entries:ct}),m=r.createRenderPassDescriptor(o.texture.view,0,0,0,0,"clear"),f=e.beginRenderPass(m);f.setPipeline(a),f.setBindGroup(0,g),f.draw(6,1,0,0),f.end()},de=new Float32Array(20),ls=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],Mc=(t,e,r)=>{const{device:n,commandEncoder:s,frameBufferManager:o,pipelineManager:i,textureManager:l}=r,c=o.createTemporaryAttachment(t.width,t.height),u=i.getPipeline("color_matrix_filter"),a=i.getBindGroupLayout("color_matrix_filter");if(!u||!a)return console.error("[WebGPU ColorMatrixFilter] Pipeline not found"),t;const h=l.createSampler("color_matrix_sampler",!0);de[0]=e[0],de[1]=e[5],de[2]=e[10],de[3]=e[15],de[4]=e[1],de[5]=e[6],de[6]=e[11],de[7]=e[16],de[8]=e[2],de[9]=e[7],de[10]=e[12],de[11]=e[17],de[12]=e[3],de[13]=e[8],de[14]=e[13],de[15]=e[18],de[16]=e[4]/255,de[17]=e[9]/255,de[18]=e[14]/255,de[19]=e[19]/255;const d=r.bufferManager?r.bufferManager.acquireAndWriteUniformBuffer(de):n.createBuffer({size:de.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});r.bufferManager||n.queue.writeBuffer(d,0,de),ls[0].resource.buffer=d,ls[1].resource=h,ls[2].resource=t.texture.view;const g=n.createBindGroup({layout:a,entries:ls}),m=o.createRenderPassDescriptor(c.texture.view,0,0,0,0,"clear"),f=s.beginRenderPass(m);return f.setPipeline(u),f.setBindGroup(0,g),f.draw(6,1,0,0),f.end(),c},Pe=new Float32Array(16),yn=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null},{binding:3,resource:null}],u0=(t,e)=>{const r=(t>>16&255)/255*e,n=(t>>8&255)/255*e,s=(t&255)/255*e;return[r,n,s,e]},Sc=(t,e,r,n,s,o,i,l,c,u,a,h)=>{const{device:d,commandEncoder:g,frameBufferManager:m,pipelineManager:f,textureManager:b}=h,x=ne.x,y=ne.y,P=t.width,S=t.height,M=sr(t,e,s,o,l,a,h),$=M.width,T=M.height,w=ne.x,E=ne.y,F=c?P:$,A=c?S:T,R=w-x,v=E-y,U=c?0:R,L=c?0:v,D=c?-R:0,G=c?-v:0,B=F/P,z=A/S,k=U/P,_=L/S,I=F/$,V=A/T,X=D/$,Y=G/T,W=m.createTemporaryAttachment(F,A),K=f.getFilterPipeline("glow_filter",{IS_INNER:c?1:0,IS_KNOCKOUT:u?1:0}),q=f.getBindGroupLayout("glow_filter");if(!K||!q)return console.error("[WebGPU GlowFilter] Pipeline not found"),m.releaseTemporaryAttachment(M),t;const ce=b.createSampler("glow_sampler",!0),[te,se,ue,Fe]=u0(r,n);Pe[0]=te,Pe[1]=se,Pe[2]=ue,Pe[3]=Fe,Pe[4]=B,Pe[5]=z,Pe[6]=k,Pe[7]=_,Pe[8]=I,Pe[9]=V,Pe[10]=X,Pe[11]=Y,Pe[12]=i,Pe[13]=c?1:0,Pe[14]=u?1:0,Pe[15]=0;const ge=h.bufferManager?h.bufferManager.acquireAndWriteUniformBuffer(Pe):d.createBuffer({size:Pe.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});h.bufferManager||d.queue.writeBuffer(ge,0,Pe),yn[0].resource.buffer=ge,yn[1].resource=ce,yn[2].resource=M.texture.view,yn[3].resource=t.texture.view;const Q=d.createBindGroup({layout:q,entries:yn}),Ct=m.createRenderPassDescriptor(W.texture.view,0,0,0,0,"clear"),Je=g.beginRenderPass(Ct);return Je.setPipeline(K),Je.setBindGroup(0,Q),Je.draw(6,1,0,0),Je.end(),m.releaseTemporaryAttachment(M),W},f0=Math.PI/180,Ae=new Float32Array(16),vn=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null},{binding:3,resource:null}],h0=(t,e)=>{const r=(t>>16&255)/255*e,n=(t>>8&255)/255*e,s=(t&255)/255*e;return[r,n,s,e]},$c=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m)=>{const{device:f,commandEncoder:b,frameBufferManager:x,pipelineManager:y,textureManager:P}=m,S=ne.x,M=ne.y,$=t.width,T=t.height,w=sr(t,e,i,l,u,g,m),E=w.width,F=w.height,A=ne.x,R=ne.y,v=A-S,U=R-M,L=Math.sqrt(e[0]*e[0]+e[1]*e[1]),D=Math.sqrt(e[2]*e[2]+e[3]*e[3]),G=n*f0,B=Math.cos(G)*r*(L/g),z=Math.sin(G)*r*(D/g),k=a?$:E+Math.max(0,Math.abs(B)-v),_=a?T:F+Math.max(0,Math.abs(z)-U),I=Math.ceil(k),V=Math.ceil(_),X=(I-k)/2,Y=(V-_)/2,W=a?0:Math.max(0,v-B)+X,K=a?0:Math.max(0,U-z)+Y,q=a?B-A:(B>0?Math.max(0,B-v):0)+X,ce=a?z-R:(z>0?Math.max(0,z-U):0)+Y,te=x.createTemporaryAttachment(I,V),se=a;let ue=h,Fe=d;a?ue=h||d:!h&&d&&(ue=!0,Fe=!0);const ge=y.getFilterPipeline("drop_shadow_filter",{IS_INNER:se?1:0,IS_KNOCKOUT:ue?1:0,IS_HIDE_OBJECT:Fe?1:0}),Q=y.getBindGroupLayout("drop_shadow_filter");if(!ge||!Q)return console.error("[WebGPU DropShadowFilter] Pipeline not found"),x.releaseTemporaryAttachment(w),t;const Ct=P.createSampler("drop_shadow_sampler",!0),[Je,Ut,lr,ur]=h0(s,o),Yt=I/$,Gt=V/T,Lt=W/$,Wt=K/T,fr=I/E,jt=V/F,hr=q/E,Ht=ce/F;Ae[0]=Je,Ae[1]=Ut,Ae[2]=lr,Ae[3]=ur,Ae[4]=Yt,Ae[5]=Gt,Ae[6]=Lt,Ae[7]=Wt,Ae[8]=fr,Ae[9]=jt,Ae[10]=hr,Ae[11]=Ht,Ae[12]=c,Ae[13]=se?1:0,Ae[14]=ue?1:0,Ae[15]=Fe?1:0;const lt=m.bufferManager?m.bufferManager.acquireAndWriteUniformBuffer(Ae):f.createBuffer({size:Ae.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});m.bufferManager||f.queue.writeBuffer(lt,0,Ae),vn[0].resource.buffer=lt,vn[1].resource=Ct,vn[2].resource=w.texture.view,vn[3].resource=t.texture.view;const zr=f.createBindGroup({layout:Q,entries:vn}),Bn=x.createRenderPassDescriptor(te.texture.view,0,0,0,0,"clear"),kt=b.beginRenderPass(Bn);return kt.setPipeline(ge),kt.setBindGroup(0,zr),kt.draw(6,1,0,0),kt.end(),x.releaseTemporaryAttachment(w),te},d0=Math.PI/180,dt=new Float32Array(8),pe=new Float32Array(20),us=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],Mn=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null},{binding:3,resource:null}],Tc=(t,e)=>{const r=(t>>16&255)/255*e,n=(t>>8&255)/255*e,s=(t&255)/255*e;return[r,n,s,e]},Bc=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m,f)=>{const{device:b,commandEncoder:x,frameBufferManager:y,pipelineManager:P,textureManager:S}=f,M=ne.x,$=ne.y,T=t.width,w=t.height,E=Math.sqrt(e[0]*e[0]+e[1]*e[1]),F=Math.sqrt(e[2]*e[2]+e[3]*e[3]),A=n*d0,R=Math.cos(A)*r*(E/m),v=Math.sin(A)*r*(F/m),U=y.createTemporaryAttachment(T,w);x.copyTextureToTexture({texture:t.texture.resource,origin:{x:0,y:0,z:0}},{texture:U.texture.resource,origin:{x:0,y:0,z:0}},{width:T,height:w});const L=P.getPipeline("texture_erase"),D=P.getBindGroupLayout("texture_copy");if(L&&D){const fg=S.createSampler("erase_sampler",!0),hg=R*2/T,dg=v*2/w;dt[0]=1,dt[1]=1,dt[2]=hg,dt[3]=dg,dt[4]=0,dt[5]=0,dt[6]=0,dt[7]=0;const zc=f.bufferManager?f.bufferManager.acquireAndWriteUniformBuffer(dt):b.createBuffer({size:dt.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});f.bufferManager||b.queue.writeBuffer(zc,0,dt),us[0].resource.buffer=zc,us[1].resource=fg,us[2].resource=t.texture.view;const pg=b.createBindGroup({layout:D,entries:us}),mg=y.createRenderPassDescriptor(U.texture.view,0,0,0,0,"load"),gs=x.beginRenderPass(mg);gs.setPipeline(L),gs.setBindGroup(0,pg),gs.draw(6,1,0,0),gs.end()}const G=sr(U,e,c,u,h,m,f);y.releaseTemporaryAttachment(U);const B=G.width,z=G.height,k=Math.abs(R),_=Math.abs(v),I=d===1,V=Math.ceil(B+k*2),X=Math.ceil(z+_*2),Y=I?T:V,W=I?w:X,K=(B-T)/2,q=(z-w)/2,ce=I?0:Math.floor(k+K),te=I?0:Math.floor(_+q),se=Math.floor(I?-K-R:k-R),ue=Math.floor(I?-q-v:_-v),Fe=Y/T,ge=W/w,Q=ce/T,Ct=te/w,Je=Y/B,Ut=W/z,lr=se/B,ur=ue/z,Yt=y.createTemporaryAttachment(Y,W),Gt=P.getFilterPipeline("bevel_filter",{BEVEL_TYPE:d,IS_KNOCKOUT:g?1:0}),Lt=P.getBindGroupLayout("bevel_filter");if(!Gt||!Lt)return console.error("[WebGPU BevelFilter] Pipeline not found"),y.releaseTemporaryAttachment(G),t;const Wt=S.createSampler("bevel_sampler",!0),[fr,jt,hr,Ht]=Tc(s,o),[lt,zr,Bn,kt]=Tc(i,l);pe[0]=fr,pe[1]=jt,pe[2]=hr,pe[3]=Ht,pe[4]=lt,pe[5]=zr,pe[6]=Bn,pe[7]=kt,pe[8]=a,pe[9]=I?1:0,pe[10]=g?1:0,pe[11]=d,pe[12]=Fe,pe[13]=ge,pe[14]=Q,pe[15]=Ct,pe[16]=Je,pe[17]=Ut,pe[18]=lr,pe[19]=ur;const ps=f.bufferManager?f.bufferManager.acquireAndWriteUniformBuffer(pe):b.createBuffer({size:pe.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});f.bufferManager||b.queue.writeBuffer(ps,0,pe),Mn[0].resource.buffer=ps,Mn[1].resource=Wt,Mn[2].resource=G.texture.view,Mn[3].resource=t.texture.view;const ci=b.createBindGroup({layout:Lt,entries:Mn}),Xr=y.createRenderPassDescriptor(Yt.texture.view,0,0,0,0,"clear"),ms=x.beginRenderPass(Xr);return ms.setPipeline(Gt),ms.setBindGroup(0,ci),ms.draw(6,1,0,0),ms.end(),y.releaseTemporaryAttachment(G),ne.x=M+ce,ne.y=$+te,Yt},fs=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],p0=(t,e)=>{const r=(t>>16&255)/255,n=(t>>8&255)/255,s=(t&255)/255;return[r,n,s,e]},Pc=new Map,Ac=(t,e,r,n,s,o,i,l,c,u,a)=>{const{device:h,commandEncoder:d,frameBufferManager:g,textureManager:m}=a,f=t.width,b=t.height,x=g.createTemporaryAttachment(f,b),y=\`\${e},\${r},\${i},\${l}\`;let P=Pc.get(y);if(!P){const B=N.getConvolutionFilterFragmentShader(e,r,i,l),z=h.createShaderModule({code:B}),k=h.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}}]}),_=h.createPipelineLayout({bindGroupLayouts:[k]});P={pipeline:h.createRenderPipeline({layout:_,vertex:{module:z,entryPoint:"vs_main",buffers:[]},fragment:{module:z,entryPoint:"fs_main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}}),bindGroupLayout:k},Pc.set(y,P)}const S=m.createSampler("convolution_sampler",!0),M=e*r,$=Math.ceil(M/4),[T,w,E,F]=p0(c,u),A=new Float32Array($*4);for(let B=0;B<M;B++)A[B]=n[B];const R=32+$*16,v=new Float32Array(R/4);v[0]=1/f,v[1]=1/b,v[2]=s!==0?1/s:1,v[3]=o/255,v[4]=T,v[5]=w,v[6]=E,v[7]=F;for(let B=0;B<A.length;B++)v[8+B]=A[B];const U=a.bufferManager?a.bufferManager.acquireAndWriteUniformBuffer(v):h.createBuffer({size:v.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});a.bufferManager||h.queue.writeBuffer(U,0,v),fs[0].resource.buffer=U,fs[1].resource=S,fs[2].resource=t.texture.view;const L=h.createBindGroup({layout:P.bindGroupLayout,entries:fs}),D=g.createRenderPassDescriptor(x.texture.view,0,0,0,0,"clear"),G=d.beginRenderPass(D);return G.setPipeline(P.pipeline),G.setBindGroup(0,L),G.draw(6,1,0,0),G.end(),x},m0=Math.PI/180,or=new Float32Array(4),ze=new Float32Array(12),hs=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],Ir=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null},{binding:3,resource:null},{binding:4,resource:null}],Fc=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m)=>{const{device:f,commandEncoder:b,frameBufferManager:x,pipelineManager:y,textureManager:P}=m,S=ne.x,M=ne.y,$=t.width,T=t.height,w=Math.sqrt(e[0]*e[0]+e[1]*e[1]),E=Math.sqrt(e[2]*e[2]+e[3]*e[3]),F=n*m0,A=Math.cos(F)*r*(w/g),R=Math.sin(F)*r*(E/g),v=y.getPipeline("bevel_base"),U=y.getBindGroupLayout("bevel_base");if(!v||!U)return console.error("[WebGPU GradientBevelFilter] bevel_base pipeline not found"),t;const L=x.createTemporaryAttachment($,T),D=P.createSampler("bevel_base_sampler",!0);or[0]=2*A/$,or[1]=2*R/T,or[2]=0,or[3]=0;const G=m.bufferManager?m.bufferManager.acquireAndWriteUniformBuffer(or):f.createBuffer({size:or.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});m.bufferManager||f.queue.writeBuffer(G,0,or),hs[0].resource.buffer=G,hs[1].resource=D,hs[2].resource=t.texture.view;const B=f.createBindGroup({layout:U,entries:hs}),z=x.createRenderPassDescriptor(L.texture.view,0,0,0,0,"clear"),k=b.beginRenderPass(z);k.setPipeline(v),k.setBindGroup(0,B),k.draw(6,1,0,0),k.end();const _=sr(L,e,l,c,a,g,m);x.releaseTemporaryAttachment(L);const I=_.width,V=_.height,X=h===1,Y=Math.abs(A),W=Math.abs(R),K=(I-$)/2,q=(V-T)/2,ce=Math.ceil(I+Y*2),te=Math.ceil(V+W*2),se=X?$:ce,ue=X?T:te,Fe=X?0:Y+K,ge=X?0:W+q,Q=X?-K-A:Y-A,Ct=X?-q-R:W-R,Je=ac(i,s,o),Ut=f.createTexture({size:{width:256,height:1},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST});f.queue.writeTexture({texture:Ut},Je.buffer,{bytesPerRow:256*4,offset:Je.byteOffset},{width:256,height:1});const lr=Ut.createView(),ur=se/$,Yt=ue/T,Gt=Fe/$,Lt=ge/T,Wt=se/I,fr=ue/V,jt=Q/I,hr=Ct/V,Ht=x.createTemporaryAttachment(se,ue),lt=y.getFilterPipeline("gradient_bevel_filter",{BEVEL_TYPE:h,IS_KNOCKOUT:d?1:0}),zr=y.getBindGroupLayout("gradient_bevel_filter");if(!lt||!zr)return console.error("[WebGPU GradientBevelFilter] Pipeline not found"),x.releaseTemporaryAttachment(_),t;const Bn=P.createSampler("gradient_bevel_sampler",!0);ze[0]=u,ze[1]=X?1:0,ze[2]=d?1:0,ze[3]=h,ze[4]=ur,ze[5]=Yt,ze[6]=Gt,ze[7]=Lt,ze[8]=Wt,ze[9]=fr,ze[10]=jt,ze[11]=hr;const kt=m.bufferManager?m.bufferManager.acquireAndWriteUniformBuffer(ze):f.createBuffer({size:ze.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});m.bufferManager||f.queue.writeBuffer(kt,0,ze),Ir[0].resource.buffer=kt,Ir[1].resource=Bn,Ir[2].resource=_.texture.view,Ir[3].resource=t.texture.view,Ir[4].resource=lr;const ps=f.createBindGroup({layout:zr,entries:Ir}),ci=x.createRenderPassDescriptor(Ht.texture.view,0,0,0,0,"clear"),Xr=b.beginRenderPass(ci);return Xr.setPipeline(lt),Xr.setBindGroup(0,ps),Xr.draw(6,1,0,0),Xr.end(),m.frameTextures.push(Ut),x.releaseTemporaryAttachment(_),ne.x=S+Fe,ne.y=M+ge,Ht},g0=Math.PI/180,Xe=new Float32Array(12),_r=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null},{binding:3,resource:null},{binding:4,resource:null}],wc=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m)=>{const{device:f,commandEncoder:b,frameBufferManager:x,pipelineManager:y,textureManager:P}=m,S=ne.x,M=ne.y,$=t.width,T=t.height,w=sr(t,e,l,c,a,g,m),E=w.width,F=w.height,A=ne.x,R=ne.y,v=A-S,U=R-M,L=Math.sqrt(e[0]*e[0]+e[1]*e[1]),D=Math.sqrt(e[2]*e[2]+e[3]*e[3]),G=n*g0,B=Math.cos(G)*r*(L/g),z=Math.sin(G)*r*(D/g),k=h===1,_=k?$:E+Math.max(0,Math.abs(B)-v),I=k?T:F+Math.max(0,Math.abs(z)-U),V=Math.ceil(_),X=Math.ceil(I),Y=(V-_)/2,W=(X-I)/2,K=k?0:Math.max(0,v-B)+Y,q=k?0:Math.max(0,U-z)+W,ce=k?B-A:(B>0?Math.max(0,B-v):0)+Y,te=k?z-R:(z>0?Math.max(0,z-U):0)+W,se=ac(i,s,o),ue=f.createTexture({size:{width:256,height:1},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST});f.queue.writeTexture({texture:ue},se.buffer,{bytesPerRow:256*4,offset:se.byteOffset},{width:256,height:1});const Fe=ue.createView(),ge=V/$,Q=X/T,Ct=K/$,Je=q/T,Ut=V/E,lr=X/F,ur=ce/E,Yt=te/F,Gt=x.createTemporaryAttachment(V,X),Lt=y.getFilterPipeline("gradient_glow_filter",{GLOW_TYPE:h,IS_KNOCKOUT:d?1:0}),Wt=y.getBindGroupLayout("gradient_glow_filter");if(!Lt||!Wt)return console.error("[WebGPU GradientGlowFilter] Pipeline not found"),x.releaseTemporaryAttachment(w),t;const fr=P.createSampler("gradient_glow_sampler",!0);Xe[0]=u,Xe[1]=k?1:0,Xe[2]=d?1:0,Xe[3]=h,Xe[4]=ge,Xe[5]=Q,Xe[6]=Ct,Xe[7]=Je,Xe[8]=Ut,Xe[9]=lr,Xe[10]=ur,Xe[11]=Yt;const jt=m.bufferManager?m.bufferManager.acquireAndWriteUniformBuffer(Xe):f.createBuffer({size:Xe.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});m.bufferManager||f.queue.writeBuffer(jt,0,Xe),_r[0].resource.buffer=jt,_r[1].resource=fr,_r[2].resource=w.texture.view,_r[3].resource=t.texture.view,_r[4].resource=Fe;const hr=f.createBindGroup({layout:Wt,entries:_r}),Ht=x.createRenderPassDescriptor(Gt.texture.view,0,0,0,0,"clear"),lt=b.beginRenderPass(Ht);return lt.setPipeline(Lt),lt.setBindGroup(0,hr),lt.draw(6,1,0,0),lt.end(),m.frameTextures.push(ue),x.releaseTemporaryAttachment(w),ne.x=S+K,ne.y=M+q,Gt},He=new Float32Array(12),Sn=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null},{binding:3,resource:null}],b0=(t,e)=>{const r=(t>>16&255)/255*e,n=(t>>8&255)/255*e,s=(t&255)/255*e;return[r,n,s,e]},Oc=new Map,Ec=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m,f)=>{const{device:b,commandEncoder:x,frameBufferManager:y,textureManager:P}=f,S=t.width,M=t.height,$=n,T=s,w=y.createTemporaryAttachment(S,M),E=b.createTexture({size:{width:n,height:s},format:"rgba8unorm",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST});b.queue.writeTexture({texture:E},r.buffer,{bytesPerRow:n*4,offset:r.byteOffset},{width:n,height:s});const F=\`\${l},\${c},\${h}\`;let A=Oc.get(F);if(!A){const z=N.getDisplacementMapFilterFragmentShader(l,c,h),k=b.createShaderModule({code:N.getBlurFilterVertexShader()}),_=b.createShaderModule({code:z}),I=b.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.FRAGMENT,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.FRAGMENT,sampler:{}},{binding:2,visibility:GPUShaderStage.FRAGMENT,texture:{}},{binding:3,visibility:GPUShaderStage.FRAGMENT,texture:{}}]}),V=b.createPipelineLayout({bindGroupLayouts:[I]});A={pipeline:b.createRenderPipeline({layout:V,vertex:{module:k,entryPoint:"main",buffers:[]},fragment:{module:_,entryPoint:"main",targets:[{format:"rgba8unorm",blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}}}]},primitive:{topology:"triangle-list",cullMode:"none"}}),bindGroupLayout:I},Oc.set(F,A)}const R=P.createSampler("displacement_sampler",!0),v=h===1,U=v?48:32;if(He[0]=$/n,He[1]=T/s,He[2]=o/n,He[3]=(T-s-i)/s,He[4]=u/$,He[5]=a/T,He[6]=0,He[7]=0,v){const[z,k,_,I]=b0(d,g);He[8]=z,He[9]=k,He[10]=_,He[11]=I}const L=f.bufferManager?f.bufferManager.acquireAndWriteUniformBuffer(He,U):b.createBuffer({size:U,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});f.bufferManager||b.queue.writeBuffer(L,0,He,0,U/4),Sn[0].resource.buffer=L,Sn[1].resource=R,Sn[2].resource=t.texture.view,Sn[3].resource=E.createView();const D=b.createBindGroup({layout:A.bindGroupLayout,entries:Sn}),G=y.createRenderPassDescriptor(w.texture.view,0,0,0,0,"clear"),B=x.beginRenderPass(G);return B.setPipeline(A.pipeline),B.setBindGroup(0,D),B.draw(6,1,0,0),B.end(),f.frameTextures.push(E),w},bt=new Float32Array(4),Te=new Float32Array(6),Ee=new Float32Array(6),oe=new Float32Array(8),Ze=new Float32Array(12),ve=new Float32Array(20),fe=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],x0=new Set(["normal","layer","add","screen","alpha","erase","copy"]),y0=new Float32Array([1,-1,0,1]),v0=t=>t[0]===1&&t[1]===1&&t[2]===1&&t[3]===1&&t[4]===0&&t[5]===0&&t[6]===0&&t[7]===0,M0=(t,e,r)=>{const n=t.frameBufferManager.createTemporaryAttachment(e.width,e.height),s=t.pipelineManager.getPipeline("color_transform"),o=t.pipelineManager.getBindGroupLayout("texture_copy");if(!s||!o||!e.texture||!n.texture)return e;oe[0]=r[0],oe[1]=r[1],oe[2]=r[2],oe[3]=r[3],oe[4]=r[4],oe[5]=r[5],oe[6]=r[6],oe[7]=0;const i=t.bufferManager.acquireAndWriteUniformBuffer(oe),l=t.textureManager.createSampler("color_transform_sampler",!1);fe[0].resource.buffer=i,fe[1].resource=l,fe[2].resource=e.texture.view;const c=t.device.createBindGroup({layout:o,entries:fe}),u=t.frameBufferManager.createRenderPassDescriptor(n.texture.view,0,0,0,0,"clear"),a=t.commandEncoder.beginRenderPass(u);return a.setPipeline(s),a.setBindGroup(0,c),a.draw(6,1,0,0),a.end(),n},S0=(t,e,r)=>{const n=r.createTemporaryAttachment(t.w,t.h),s=Ne()||r.getAttachment("atlas");return s&&s.texture&&n.texture?e.copyTextureToTexture({texture:s.texture.resource,origin:{x:t.x,y:t.y,z:0}},{texture:n.texture.resource,origin:{x:0,y:0,z:0}},{width:t.w,height:t.h}):console.error("[WebGPU Filter] getTextureFromNode: FAILED - missing atlas or textures"),n},$0=t=>x0.has(t),T0=(t,e,r,n,s,o)=>{const i=t.frameBufferManager.createTemporaryAttachment(s,o),l=t.pipelineManager.getPipeline("complex_blend_copy"),c=t.pipelineManager.getBindGroupLayout("texture_copy");if(!l||!c||!e.texture||!i.texture)return i;const u=s/e.width,a=o/e.height,h=r/e.width,d=n/e.height;bt[0]=u,bt[1]=a,bt[2]=h,bt[3]=d;const g=t.bufferManager.acquireAndWriteUniformBuffer(bt),m=t.textureManager.createSampler("filter_copy_sampler",!1);fe[0].resource.buffer=g,fe[1].resource=m,fe[2].resource=e.texture.view;const f=t.device.createBindGroup({layout:c,entries:fe}),b=t.frameBufferManager.createRenderPassDescriptor(i.texture.view,0,0,0,0,"clear"),x=t.commandEncoder.beginRenderPass(b);return x.setPipeline(l),x.setBindGroup(0,f),x.draw(6,1,0,0),x.end(),i},B0=(t,e,r,n,s)=>{const o=r.msaa&&r.msaaTexture?.view,i=o?"filter_complex_blend_output_msaa":"filter_complex_blend_output",l=t.pipelineManager.getPipeline(i),c=t.pipelineManager.getBindGroupLayout("positioned_texture");if(!l||!c||!e.texture||!r.texture)return;oe[0]=n,oe[1]=s,oe[2]=e.width,oe[3]=e.height,oe[4]=r.width,oe[5]=r.height,oe[6]=0,oe[7]=0;const u=t.bufferManager.acquireAndWriteUniformBuffer(oe),a=t.textureManager.createSampler("filter_blend_output_sampler",!1);fe[0].resource.buffer=u,fe[1].resource=a,fe[2].resource=e.texture.view;const h=t.device.createBindGroup({layout:c,entries:fe}),d=o?r.msaaTexture.view:r.texture.view,g=o?r.texture.view:null,m=t.frameBufferManager.createRenderPassDescriptor(d,0,0,0,0,"load",g),f=t.commandEncoder.beginRenderPass(m);f.setPipeline(l),f.setBindGroup(0,h),f.draw(6,1,0,0),f.end()},P0=(t,e,r,n,s,o,i,l)=>{const c=t.mainAttachment||t.frameBufferManager.getAttachment("main");if(!c||!c.texture||!e.texture)return;let u=s,a=o,h=e.width,d=e.height,g=0,m=0;if(u<0&&(g=-u/e.width,h+=u,u=0),a<0&&(m=-a/e.height,d+=a,a=0),h<=0||d<=0)return;const f=c.width,b=c.height;if(u+h>f&&(h=f-u),a+d>b&&(d=b-a),$0(n)){const x=c.msaa&&c.msaaTexture?.view;let y;switch(n){case"add":y=x?"filter_output_add_msaa":"filter_output_add";break;case"screen":y=x?"filter_output_screen_msaa":"filter_output_screen";break;case"alpha":y=x?"filter_output_alpha_msaa":"filter_output_alpha";break;case"erase":y=x?"filter_output_erase_msaa":"filter_output_erase";break;case"copy":y=x?"texture_copy_bgra_msaa":"texture_copy_bgra";break;default:y=x?"filter_output_msaa":"filter_output";break}let P=t.pipelineManager.getPipeline(y),S=t.pipelineManager.getBindGroupLayout("texture_copy");if((!P||!S)&&(y=x?"filter_output_msaa":"filter_output",P=t.pipelineManager.getPipeline(y),S=t.pipelineManager.getBindGroupLayout("texture_copy"),!P||!S))return;const M=t.textureManager.createSampler("filter_output_sampler",!0),$=h/e.width,T=d/e.height;bt[0]=$,bt[1]=T,bt[2]=g,bt[3]=m;const w=t.bufferManager.acquireAndWriteUniformBuffer(bt);fe[0].resource.buffer=w,fe[1].resource=M,fe[2].resource=e.texture.view;const E=t.device.createBindGroup({layout:S,entries:fe}),F=x?c.msaaTexture.view:c.texture.view,A=x?c.texture.view:null,R=t.frameBufferManager.createRenderPassDescriptor(F,0,0,0,0,"load",A),v=Math.max(0,u),U=Math.max(0,a),L=Math.max(1,h),D=Math.max(1,d),G=Math.max(0,Math.floor(v)),B=Math.max(0,Math.floor(U)),z=Math.max(1,Math.min(Math.ceil(v+L)-G,f-G)),k=Math.max(1,Math.min(Math.ceil(U+D)-B,b-B));if(z<=0||k<=0||G>=f||B>=b)return;const _=t.commandEncoder.beginRenderPass(R);_.setPipeline(P),_.setBindGroup(0,E),_.setViewport(v,U,L,D,0,1),_.setScissorRect(G,B,z,k),_.draw(6,1,0,0),_.end()}else{const x=T0(t,c,u,a,h,d);oe[0]=r[0],oe[1]=r[1],oe[2]=r[2],oe[3]=r[3],oe[4]=r[4],oe[5]=r[5],oe[6]=r[6],oe[7]=0;const y=Xo(e,x,n,oe,{device:t.device,commandEncoder:t.commandEncoder,bufferManager:t.bufferManager,frameBufferManager:t.frameBufferManager,pipelineManager:t.pipelineManager,textureManager:t.textureManager,frameTextures:t.frameTextures});B0(t,y,c,u,a),t.frameBufferManager.releaseTemporaryAttachment(x),t.frameBufferManager.releaseTemporaryAttachment(y)}},A0=(t,e,r,n,s,o,i,l,c,u,a,h)=>{ne.x=0,ne.y=0;let d=S0(t,u.commandEncoder,u.frameBufferManager);if(d.texture){const B=u.frameBufferManager.createTemporaryAttachment(t.w,t.h),z=u.pipelineManager.getPipeline("texture_copy_rgba8"),k=u.pipelineManager.getBindGroupLayout("texture_copy");if(z&&k&&B.texture){const _=u.textureManager.createSampler("filter_flip_sampler",!1),I=u.bufferManager.acquireAndWriteUniformBuffer(y0);fe[0].resource.buffer=I,fe[1].resource=_,fe[2].resource=d.texture.view;const V=u.device.createBindGroup({layout:k,entries:fe}),X=u.frameBufferManager.createRenderPassDescriptor(B.texture.view,0,0,0,0,"clear"),Y=u.commandEncoder.beginRenderPass(X);Y.setPipeline(z),Y.setBindGroup(0,V),Y.draw(6,1,0,0),Y.end(),u.frameBufferManager.releaseTemporaryAttachment(d),d=B}}const g=le.getDevicePixelRatio(),m=Math.sqrt(s[0]*s[0]+s[1]*s[1]),f=Math.sqrt(s[2]*s[2]+s[3]*s[3]),b=Math.atan2(s[1],s[0]),x=Math.atan2(-s[2],s[3]),y=n?m*Math.cos(b):Math.cos(b),P=n?m*Math.sin(b):Math.sin(b),S=n?-f*Math.sin(x):-Math.sin(x),M=n?f*Math.cos(x):Math.cos(x);Te[0]=y,Te[1]=P,Te[2]=S,Te[3]=M,Te[4]=e/2,Te[5]=r/2,Ee[0]=1,Ee[1]=0,Ee[2]=0,Ee[3]=1,Ee[4]=-t.w/2,Ee[5]=-t.h/2;const $=Te[0]*Ee[0]+Te[2]*Ee[1],T=Te[1]*Ee[0]+Te[3]*Ee[1],w=Te[0]*Ee[2]+Te[2]*Ee[3],E=Te[1]*Ee[2]+Te[3]*Ee[3],F=Te[0]*Ee[4]+Te[2]*Ee[5]+Te[4],A=Te[1]*Ee[4]+Te[3]*Ee[5]+Te[5];let R=0,v=0;if($!==1||T!==0||w!==0||E!==1){const B=u.frameBufferManager.createTemporaryAttachment(e,r),k=u.pipelineManager.getPipeline("texture_scale"),_=u.pipelineManager.getBindGroupLayout("texture_scale");if(k&&_){Ze[0]=$,Ze[1]=T,Ze[2]=w,Ze[3]=E,Ze[4]=F,Ze[5]=A,Ze[6]=t.w,Ze[7]=t.h,Ze[8]=e,Ze[9]=r,Ze[10]=0,Ze[11]=0;const I=u.bufferManager.acquireAndWriteUniformBuffer(Ze,48),V=u.textureManager.createSampler("filter_scale_sampler",!0);fe[0].resource.buffer=I,fe[1].resource=V,fe[2].resource=d.texture.view;const X=u.device.createBindGroup({layout:_,entries:fe}),Y=u.frameBufferManager.createRenderPassDescriptor(B.texture.view,0,0,0,0,"clear"),W=u.commandEncoder.beginRenderPass(Y);W.setPipeline(k),W.setBindGroup(0,X),W.draw(6,1,0,0),W.end(),R=F,v=A,u.frameBufferManager.releaseTemporaryAttachment(d),d=B}}for(let B=0;c.length>B;)switch(c[B++]){case 0:{const k=c[B++],_=c[B++],I=c[B++],V=c[B++],X=c[B++],Y=c[B++],W=c[B++],K=c[B++],q=c[B++],ce=c[B++],te=c[B++],se=!!c[B++],ue=Bc(d,s,k,_,I,V,X,Y,W,K,q,ce,te,se,g,u);d!==ue&&u.frameBufferManager.releaseTemporaryAttachment(d),d=ue}break;case 1:{const k=c[B++],_=c[B++],I=c[B++],V=sr(d,s,k,_,I,g,u);d!==V&&u.frameBufferManager.releaseTemporaryAttachment(d),d=V}break;case 2:{ve[0]=c[B++],ve[1]=c[B++],ve[2]=c[B++],ve[3]=c[B++],ve[4]=c[B++],ve[5]=c[B++],ve[6]=c[B++],ve[7]=c[B++],ve[8]=c[B++],ve[9]=c[B++],ve[10]=c[B++],ve[11]=c[B++],ve[12]=c[B++],ve[13]=c[B++],ve[14]=c[B++],ve[15]=c[B++],ve[16]=c[B++],ve[17]=c[B++],ve[18]=c[B++],ve[19]=c[B++];const k=Mc(d,ve,u);d!==k&&u.frameBufferManager.releaseTemporaryAttachment(d),d=k}break;case 3:{const k=c[B++],_=c[B++],I=k*_,V=new Float32Array(I);for(let se=0;se<I;se++)V[se]=c[B++];const X=c[B++],Y=c[B++],W=!!c[B++],K=!!c[B++],q=c[B++],ce=c[B++],te=Ac(d,k,_,V,X,Y,W,K,q,ce,u);d!==te&&u.frameBufferManager.releaseTemporaryAttachment(d),d=te}break;case 4:{const k=c[B++],_=new Uint8Array(k);for(let ge=0;ge<k;ge++)_[ge]=c[B++];const I=c[B++],V=c[B++],X=c[B++],Y=c[B++],W=c[B++],K=c[B++],q=c[B++],ce=c[B++],te=c[B++],se=c[B++],ue=c[B++],Fe=Ec(d,s,_,I,V,X,Y,W,K,q,ce,te,se,ue,g,u);d!==Fe&&u.frameBufferManager.releaseTemporaryAttachment(d),d=Fe}break;case 5:{const k=c[B++],_=c[B++],I=c[B++],V=c[B++],X=c[B++],Y=c[B++],W=c[B++],K=c[B++],q=!!c[B++],ce=!!c[B++],te=!!c[B++],se=$c(d,s,k,_,I,V,X,Y,W,K,q,ce,te,g,u);d!==se&&u.frameBufferManager.releaseTemporaryAttachment(d),d=se}break;case 6:{const k=c[B++],_=c[B++],I=c[B++],V=c[B++],X=c[B++],Y=c[B++],W=!!c[B++],K=!!c[B++],q=Sc(d,s,k,_,I,V,X,Y,W,K,g,u);d!==q&&u.frameBufferManager.releaseTemporaryAttachment(d),d=q}break;case 7:{const k=c[B++],_=c[B++],I=c[B++],V=new Float32Array(I);for(let Q=0;Q<I;Q++)V[Q]=c[B++];const X=c[B++],Y=new Float32Array(X);for(let Q=0;Q<X;Q++)Y[Q]=c[B++];const W=c[B++],K=new Float32Array(W);for(let Q=0;Q<W;Q++)K[Q]=c[B++];const q=c[B++],ce=c[B++],te=c[B++],se=c[B++],ue=c[B++],Fe=!!c[B++],ge=Fc(d,s,k,_,V,Y,K,q,ce,te,se,ue,Fe,g,u);d!==ge&&u.frameBufferManager.releaseTemporaryAttachment(d),d=ge}break;case 8:{const k=c[B++],_=c[B++],I=c[B++],V=new Float32Array(I);for(let Q=0;Q<I;Q++)V[Q]=c[B++];const X=c[B++],Y=new Float32Array(X);for(let Q=0;Q<X;Q++)Y[Q]=c[B++];const W=c[B++],K=new Float32Array(W);for(let Q=0;Q<W;Q++)K[Q]=c[B++];const q=c[B++],ce=c[B++],te=c[B++],se=c[B++],ue=c[B++],Fe=!!c[B++],ge=wc(d,s,k,_,V,Y,K,q,ce,te,se,ue,Fe,g,u);d!==ge&&u.frameBufferManager.releaseTemporaryAttachment(d),d=ge}break}if(!v0(o)){const B=M0(u,d,o);u.frameBufferManager.releaseTemporaryAttachment(d),d=B}const U=l[0]*(m/g),L=l[1]*(f/g),D=-R+U+s[4],G=-v+L+s[5];P0(u,d,o,i,D,G),u.frameBufferManager.releaseTemporaryAttachment(d)},xt=new Float32Array(4),ie=new Float32Array(8),Me=new Float32Array(20),Ie=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],F0=new Set(["normal","layer","add","screen","alpha","erase","copy"]),ir=new Float32Array([1,1,1,1,0,0,0,0]),Rc=t=>t?t[0]===1&&t[1]===1&&t[2]===1&&t[3]===1&&t[4]===0&&t[5]===0&&t[6]===0&&t[7]===0:!0,Cc=(t,e,r)=>{const n=t.frameBufferManager.createTemporaryAttachment(e.width,e.height),s=t.pipelineManager.getPipeline("color_transform"),o=t.pipelineManager.getBindGroupLayout("texture_copy");if(!s||!o||!e.texture||!n.texture)return e;ie[0]=r[0],ie[1]=r[1],ie[2]=r[2],ie[3]=r[3],ie[4]=r[4],ie[5]=r[5],ie[6]=r[6],ie[7]=0;const i=t.bufferManager.acquireAndWriteUniformBuffer(ie),l=t.textureManager.createSampler("container_ct_sampler",!1);Ie[0].resource.buffer=i,Ie[1].resource=l,Ie[2].resource=e.texture.view;const c=t.device.createBindGroup({layout:o,entries:Ie}),u=t.frameBufferManager.createRenderPassDescriptor(n.texture.view,0,0,0,0,"clear"),a=t.commandEncoder.beginRenderPass(u);return a.setPipeline(s),a.setBindGroup(0,c),a.draw(6,1,0,0),a.end(),n},Yo=(t,e,r,n,s,o)=>{const i=t.frameBufferManager.createTemporaryAttachment(s,o),l=t.pipelineManager.getPipeline("complex_blend_copy"),c=t.pipelineManager.getBindGroupLayout("texture_copy");if(!l||!c||!e.texture||!i.texture)return i;const u=s/e.width,a=r/e.width,h=-(o/e.height),d=(n+o)/e.height;xt[0]=u,xt[1]=h,xt[2]=a,xt[3]=d;const g=t.bufferManager.acquireAndWriteUniformBuffer(xt),m=t.textureManager.createSampler("container_copy_sampler",!1);Ie[0].resource.buffer=g,Ie[1].resource=m,Ie[2].resource=e.texture.view;const f=t.device.createBindGroup({layout:c,entries:Ie}),b=t.frameBufferManager.createRenderPassDescriptor(i.texture.view,0,0,0,0,"clear"),x=t.commandEncoder.beginRenderPass(b);return x.setPipeline(l),x.setBindGroup(0,f),x.draw(6,1,0,0),x.end(),i},Uc=(t,e,r,n,s,o,i)=>{if(!r.texture||!e.texture)return;let l=s,c=o,u=e.width,a=e.height,h=0,d=0;if(l<0&&(h=-l/e.width,u+=l,l=0),c<0&&(d=-c/e.height,a+=c,c=0),u<=0||a<=0)return;const g=r.width,m=r.height;if(l+u>g&&(u=g-l),c+a>m&&(a=m-c),F0.has(n)){const f=r.msaa&&r.msaaTexture?.view;let b;switch(n){case"add":b=f?"filter_output_add_msaa":"filter_output_add";break;case"screen":b=f?"filter_output_screen_msaa":"filter_output_screen";break;case"alpha":b=f?"filter_output_alpha_msaa":"filter_output_alpha";break;case"erase":b=f?"filter_output_erase_msaa":"filter_output_erase";break;case"copy":b=f?"texture_copy_bgra_msaa":"texture_copy_bgra";break;default:b=f?"filter_output_msaa":"filter_output";break}const x=t.pipelineManager.getPipeline(b),y=t.pipelineManager.getBindGroupLayout("texture_copy");if(!x||!y)return;const P=t.textureManager.createSampler("container_output_sampler",!0),S=u/e.width,M=a/e.height;xt[0]=S,xt[1]=M,xt[2]=h,xt[3]=d;const $=i.acquireAndWriteUniformBuffer(xt);Ie[0].resource.buffer=$,Ie[1].resource=P,Ie[2].resource=e.texture.view;const T=t.device.createBindGroup({layout:y,entries:Ie}),w=f?r.msaaTexture.view:r.texture.view,E=f?r.texture.view:null,F=t.frameBufferManager.createRenderPassDescriptor(w,0,0,0,0,"load",E),A=Math.max(0,l),R=Math.max(0,c),v=Math.max(1,u),U=Math.max(1,a),L=Math.max(0,Math.floor(A)),D=Math.max(0,Math.floor(R)),G=Math.max(1,Math.min(Math.ceil(A+v)-L,g-L)),B=Math.max(1,Math.min(Math.ceil(R+U)-D,m-D));if(G<=0||B<=0||L>=g||D>=m)return;const z=t.commandEncoder.beginRenderPass(F);z.setPipeline(x),z.setBindGroup(0,T),z.setViewport(A,R,v,U,0,1),z.setScissorRect(L,D,G,B),z.draw(6,1,0,0),z.end()}else{const f=Yo(t,r,l,c,u,a);ie[0]=ir[0],ie[1]=ir[1],ie[2]=ir[2],ie[3]=ir[3],ie[4]=ir[4]/255,ie[5]=ir[5]/255,ie[6]=ir[6]/255,ie[7]=0;const b=Xo(e,f,n,ie,{device:t.device,commandEncoder:t.commandEncoder,bufferManager:t.bufferManager,frameBufferManager:t.frameBufferManager,pipelineManager:t.pipelineManager,textureManager:t.textureManager,frameTextures:t.frameTextures}),x=r.msaa&&r.msaaTexture?.view,y=x?"filter_complex_blend_output_msaa":"filter_complex_blend_output",P=t.pipelineManager.getPipeline(y),S=t.pipelineManager.getBindGroupLayout("positioned_texture");if(P&&S&&b.texture&&r.texture){ie[0]=l,ie[1]=c,ie[2]=b.width,ie[3]=b.height,ie[4]=r.width,ie[5]=r.height,ie[6]=0,ie[7]=0;const M=i.acquireAndWriteUniformBuffer(ie),$=t.textureManager.createSampler("container_blend_output_sampler",!1);Ie[0].resource.buffer=M,Ie[1].resource=$,Ie[2].resource=b.texture.view;const T=t.device.createBindGroup({layout:S,entries:Ie}),w=x?r.msaaTexture.view:r.texture.view,E=x?r.texture.view:null,F=t.frameBufferManager.createRenderPassDescriptor(w,0,0,0,0,"load",E),A=t.commandEncoder.beginRenderPass(F);A.setPipeline(P),A.setBindGroup(0,T),A.draw(6,1,0,0),A.end()}t.frameBufferManager.releaseTemporaryAttachment(f),t.frameBufferManager.releaseTemporaryAttachment(b)}},w0=(t,e,r,n,s)=>{ne.x=0,ne.y=0;for(let o=0;r.length>o;)switch(r[o++]){case 0:{const l=Bc(t,e,r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],!!r[o++],n,s);t!==l&&s.frameBufferManager.releaseTemporaryAttachment(t),t=l}break;case 1:{const l=sr(t,e,r[o++],r[o++],r[o++],n,s);t!==l&&s.frameBufferManager.releaseTemporaryAttachment(t),t=l}break;case 2:{Me[0]=r[o++],Me[1]=r[o++],Me[2]=r[o++],Me[3]=r[o++],Me[4]=r[o++],Me[5]=r[o++],Me[6]=r[o++],Me[7]=r[o++],Me[8]=r[o++],Me[9]=r[o++],Me[10]=r[o++],Me[11]=r[o++],Me[12]=r[o++],Me[13]=r[o++],Me[14]=r[o++],Me[15]=r[o++],Me[16]=r[o++],Me[17]=r[o++],Me[18]=r[o++],Me[19]=r[o++];const l=Mc(t,Me,s);t!==l&&s.frameBufferManager.releaseTemporaryAttachment(t),t=l}break;case 3:{const l=r[o++],c=r[o++],u=l*c,a=new Float32Array(u);for(let d=0;d<u;d++)a[d]=r[o++];const h=Ac(t,l,c,a,r[o++],r[o++],!!r[o++],!!r[o++],r[o++],r[o++],s);t!==h&&s.frameBufferManager.releaseTemporaryAttachment(t),t=h}break;case 4:{const l=r[o++],c=new Uint8Array(l);for(let a=0;a<l;a++)c[a]=r[o++];const u=Ec(t,e,c,r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],n,s);t!==u&&s.frameBufferManager.releaseTemporaryAttachment(t),t=u}break;case 5:{const l=$c(t,e,r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],!!r[o++],!!r[o++],!!r[o++],n,s);t!==l&&s.frameBufferManager.releaseTemporaryAttachment(t),t=l}break;case 6:{const l=Sc(t,e,r[o++],r[o++],r[o++],r[o++],r[o++],r[o++],!!r[o++],!!r[o++],n,s);t!==l&&s.frameBufferManager.releaseTemporaryAttachment(t),t=l}break;case 7:{const l=r[o++],c=r[o++],u=r[o++],a=new Float32Array(u);for(let b=0;b<u;b++)a[b]=r[o++];const h=r[o++],d=new Float32Array(h);for(let b=0;b<h;b++)d[b]=r[o++];const g=r[o++],m=new Float32Array(g);for(let b=0;b<g;b++)m[b]=r[o++];const f=Fc(t,e,l,c,a,d,m,r[o++],r[o++],r[o++],r[o++],r[o++],!!r[o++],n,s);t!==f&&s.frameBufferManager.releaseTemporaryAttachment(t),t=f}break;case 8:{const l=r[o++],c=r[o++],u=r[o++],a=new Float32Array(u);for(let b=0;b<u;b++)a[b]=r[o++];const h=r[o++],d=new Float32Array(h);for(let b=0;b<h;b++)d[b]=r[o++];const g=r[o++],m=new Float32Array(g);for(let b=0;b<g;b++)m[b]=r[o++];const f=wc(t,e,l,c,a,d,m,r[o++],r[o++],r[o++],r[o++],r[o++],!!r[o++],n,s);t!==f&&s.frameBufferManager.releaseTemporaryAttachment(t),t=f}break}return t},O0=(t,e,r,n,s,o,i,l,c,u,a,h,d,g,m)=>{if(i&&s&&l&&c){let f=Yo(g,t,0,0,t.width,t.height);g.frameBufferManager.releaseTemporaryAttachment(t);const b=le.getDevicePixelRatio();if(f=w0(f,s,c,b,g),u&&(ee.set(u,"fKey",a),ee.set(u,"fTexture",f)),f){let x=f,y=null;Rc(o)||(y=Cc(g,f,o),x=y);const P=Math.sqrt(s[0]*s[0]+s[1]*s[1]),S=Math.sqrt(s[2]*s[2]+s[3]*s[3]),M=l[0]*(P/b),$=l[1]*(S/b),T=M+s[4],w=$+s[5];Uc(g,x,e,n,T,w,m),y&&g.frameBufferManager.releaseTemporaryAttachment(y),u||g.frameBufferManager.releaseTemporaryAttachment(f)}}else{let f=Yo(g,t,0,0,t.width,t.height);if(g.frameBufferManager.releaseTemporaryAttachment(t),!Rc(o)){const b=Cc(g,f,o);g.frameBufferManager.releaseTemporaryAttachment(f),f=b}Uc(g,f,e,n,s[4],s[5],m),g.frameBufferManager.releaseTemporaryAttachment(f)}},$n=new Float32Array([1,1,0,0]),Wo=[],Gc=new Float32Array([0,0,.5,.5,1,1,1,1,1,0,0,0,1,0,0,0,1,1,0,.5,.5,1,1,1,1,1,0,0,0,1,0,0,0,1,0,1,.5,.5,1,1,1,1,1,0,0,0,1,0,0,0,1,1,0,.5,.5,1,1,1,1,1,0,0,0,1,0,0,0,1,1,1,.5,.5,1,1,1,1,1,0,0,0,1,0,0,0,1,0,1,.5,.5,1,1,1,1,1,0,0,0,1,0,0,0,1]),Lc=new Float32Array([0,0,1,0,0,1,1,0,1,1,0,1]),Et=new Float32Array(8),ke=new Float32Array(16);let jo=null,kc=null,ds=null;const Ic={view:null,clearValue:{r:0,g:0,b:0,a:0},loadOp:"clear",storeOp:"store"},E0={colorAttachments:[Ic]},he=[{binding:0,resource:{buffer:null}},{binding:1,resource:null},{binding:2,resource:null}],Tn={r:0,g:0,b:0,a:0},Ho={view:null,clearValue:Tn,loadOp:"clear",storeOp:"store",resolveTarget:void 0},_c={view:null,stencilClearValue:0,stencilLoadOp:"clear",stencilStoreOp:"store"},Ko={colorAttachments:[Ho]},ar={view:null,resolveTarget:void 0,loadOp:"load",storeOp:"store"},Vr={view:null,stencilLoadOp:"load",stencilStoreOp:"store"},Rt={colorAttachments:[ar]};class R0{$stack;$matrix;$clearColorR;$clearColorG;$clearColorB;$clearColorA;$mainAttachmentObject;$stackAttachmentObject;globalAlpha;globalCompositeOperation;imageSmoothingEnabled;$fillStyle;$strokeStyle;maskBounds;thickness;caps;joints;miterLimit;device;canvasContext;preferredFormat;commandEncoder=null;renderPassEncoder=null;mainTexture=null;mainTextureView=null;frameStarted=!1;frameTextures=[];pooledTextures=[];pooledRenderTextures=[];currentRenderTarget=null;viewportWidth=0;viewportHeight=0;pathCommand;bufferManager;textureManager;frameBufferManager;pipelineManager;computePipelineManager;attachmentManager;newDrawState=!1;$containerLayerStack=[];containerLayerContentSizes=[];inMaskMode=!1;nodeAreaCleared=!1;currentNodeScissor=null;nodeRenderPassAtlasIndex=-1;fillDynamicBindGroup=null;fillDynamicBindGroupBuffer=null;nodeClearQuadBuffer=null;useOptimizedInstancing=!0;$uniformData8=new Float32Array(8);$scissorRect={x:0,y:0,w:0,h:0};$filterConfig;constructor(e,r,n,s=1){this.device=e,this.canvasContext=r,this.preferredFormat=n,le.setDevice(e),le.setDevicePixelRatio(s);const o=e.limits.maxTextureDimension2D,i=Math.max(2048,o/2);le.setRenderMaxSize(i),this.$stack=le.createArray(),this.$stackAttachmentObject=le.createArray(),this.$matrix=le.createFloat32Array(9),this.$matrix.set([1,0,0,0,1,0,0,0,1]),this.$clearColorR=0,this.$clearColorG=0,this.$clearColorB=0,this.$clearColorA=0,this.thickness=1,this.caps=0,this.joints=2,this.miterLimit=0,this.$mainAttachmentObject=null,this.globalAlpha=1,this.globalCompositeOperation="normal",this.imageSmoothingEnabled=!1,this.$fillStyle=new Float32Array([1,1,1,1]),this.$strokeStyle=new Float32Array([1,1,1,1]),this.maskBounds={xMin:0,yMin:0,xMax:0,yMax:0},r.configure({device:e,format:n,alphaMode:"premultiplied"}),this.viewportWidth=r.canvas.width,this.viewportHeight=r.canvas.height,this.pathCommand=new xd,this.bufferManager=new Od(e),this.textureManager=new Ud(e),this.frameBufferManager=new Hd(e,n),this.pipelineManager=new qp(e,n),this.pipelineManager.preloadLazyGroups(),this.computePipelineManager=new Qp(e),this.attachmentManager=new ip(e),em(l=>{const c=le.getRenderMaxSize();return this.frameBufferManager.createAttachment(\`atlas_\${l}\`,c,c,!1,!0)}),this.$filterConfig={device:this.device,commandEncoder:null,bufferManager:this.bufferManager,frameBufferManager:this.frameBufferManager,pipelineManager:this.pipelineManager,textureManager:this.textureManager,computePipelineManager:this.computePipelineManager,frameTextures:this.frameTextures},ud(this)}clearTransferBounds(){this.beginFrame()}updateBackgroundColor(e,r,n,s){this.$clearColorR=e,this.$clearColorG=r,this.$clearColorB=n,this.$clearColorA=s}fillBackgroundColor(){if(!this.$mainAttachmentObject||!this.$mainAttachmentObject.texture)return;this.frameStarted||this.beginFrame(),this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.ensureCommandEncoder();const e=this.$mainAttachmentObject.msaa&&this.$mainAttachmentObject.msaaTexture?.view;Ho.view=e?this.$mainAttachmentObject.msaaTexture.view:this.$mainAttachmentObject.texture.view,Ho.resolveTarget=e?this.$mainAttachmentObject.texture.view:void 0,Tn.r=this.$clearColorR,Tn.g=this.$clearColorG,Tn.b=this.$clearColorB,Tn.a=this.$clearColorA;const r=e&&this.$mainAttachmentObject.msaaStencil?.view?this.$mainAttachmentObject.msaaStencil.view:this.$mainAttachmentObject.stencil?.view;r?(_c.view=r,Ko.depthStencilAttachment=_c):Ko.depthStencilAttachment=void 0,this.renderPassEncoder=this.commandEncoder.beginRenderPass(Ko),this.renderPassEncoder.end(),this.renderPassEncoder=null}resize(e,r,n=!0){this.clearArraysInstanced();for(const o of this.frameTextures)o.destroy();this.frameTextures.length=0;for(const o of this.pooledTextures)Ot(o);this.pooledTextures.length=0;for(const o of this.pooledRenderTextures)Xt(o);this.pooledRenderTextures.length=0,Em(),this.frameStarted=!1,this.commandEncoder=null,this.renderPassEncoder=null,this.currentRenderTarget=null,am();const s=this.canvasContext.canvas;if(s&&"width"in s&&"height"in s&&(s.width=e,s.height=r),this.$stackAttachmentObject.length){for(let o=0;o<this.$stackAttachmentObject.length;++o){const i=this.$stackAttachmentObject[o];i&&(i.texture&&i.texture.resource.destroy(),i.stencil&&i.stencil.resource.destroy(),i.msaaTexture&&i.msaaTexture.resource.destroy(),i.msaaStencil&&i.msaaStencil.resource.destroy())}this.$stackAttachmentObject.length=0}this.$mainAttachmentObject&&this.frameBufferManager.destroyAttachment("main"),n&&(Rm(),Gm(),Lm(),rm(),this.frameBufferManager.destroyAttachment("atlas"),this.frameBufferManager.createAttachment("atlas",4096,4096,!1,!0)),this.frameBufferManager.setCurrentAttachment(null),this.canvasContext.configure({device:this.device,format:this.preferredFormat,alphaMode:"premultiplied"}),this.mainTexture=null,this.mainTextureView=null,this.$mainAttachmentObject=this.frameBufferManager.createAttachment("main",e,r,!0,!0),this.bind(this.$mainAttachmentObject)}clearRect(e,r,n,s){}save(){const e=Wo.length>0?Wo.pop():new Float32Array(9);e.set(this.$matrix),this.$stack.push(e)}restore(){const e=this.$stack.pop();e&&(this.$matrix.set(e),Wo.push(e))}setTransform(e,r,n,s,o,i){this.$matrix[0]=e,this.$matrix[1]=r,this.$matrix[3]=n,this.$matrix[4]=s,this.$matrix[6]=o,this.$matrix[7]=i}transform(e,r,n,s,o,i){const l=this.$matrix,c=l[0],u=l[1],a=l[3],h=l[4],d=l[6],g=l[7];l[0]=e*c+r*a,l[1]=e*u+r*h,l[3]=n*c+s*a,l[4]=n*u+s*h,l[6]=o*c+i*a+d,l[7]=o*u+i*h+g}reset(){this.$matrix.set([1,0,0,0,1,0,0,0,1]),this.$stack.length=0,this.$stackAttachmentObject.length=0,this.globalAlpha=1,this.globalCompositeOperation="normal",this.imageSmoothingEnabled=!1}beginPath(){this.pathCommand.beginPath()}moveTo(e,r){this.pathCommand.moveTo(e,r)}lineTo(e,r){this.pathCommand.lineTo(e,r)}quadraticCurveTo(e,r,n,s){this.pathCommand.quadraticCurveTo(e,r,n,s)}fillStyle(e,r,n,s){this.$fillStyle[0]=e,this.$fillStyle[1]=r,this.$fillStyle[2]=n,this.$fillStyle[3]=s}strokeStyle(e,r,n,s){this.$strokeStyle[0]=e,this.$strokeStyle[1]=r,this.$strokeStyle[2]=n,this.$strokeStyle[3]=s}closePath(){this.pathCommand.closePath()}arc(e,r,n){this.pathCommand.arc(e,r,n)}bezierCurveTo(e,r,n,s,o,i){this.pathCommand.bezierCurveTo(e,r,n,s,o,i)}ensureFillRenderPass(){if(this.frameStarted||this.beginFrame(),this.ensureCommandEncoder(),this.renderPassEncoder){this.currentRenderTarget&&this.ensureNodeAreaCleared();return}{const e=this.getCurrentTextureView(),r=Ne(),n=r?.msaa&&r?.msaaTexture?.view,s=n?r.msaaTexture.view:e,o=n?e:null;if(this.currentRenderTarget&&r?.stencil?.view){const i=n&&r?.msaaStencil?.view?r.msaaStencil.view:r.stencil.view,l=this.frameBufferManager.createStencilRenderPassDescriptor(s,i,"load","clear",o);this.renderPassEncoder=this.commandEncoder.beginRenderPass(l)}else if(!this.currentRenderTarget&&(gt()||nr())&&this.$mainAttachmentObject?.stencil?.view){const i=this.$mainAttachmentObject.msaa&&this.$mainAttachmentObject.msaaTexture?.view,l=i?this.$mainAttachmentObject.msaaTexture.view:this.$mainAttachmentObject.texture.view,c=i&&this.$mainAttachmentObject.msaaStencil?.view?this.$mainAttachmentObject.msaaStencil.view:this.$mainAttachmentObject.stencil.view,u=i?this.$mainAttachmentObject.texture.view:null,a=this.frameBufferManager.createStencilRenderPassDescriptor(l,c,"load","load",u);this.renderPassEncoder=this.commandEncoder.beginRenderPass(a),gt()&&this.renderPassEncoder.setStencilReference(Or())}else if(!this.currentRenderTarget&&this.$mainAttachmentObject){const i=this.$mainAttachmentObject.msaa&&this.$mainAttachmentObject.msaaTexture?.view,l=i?this.$mainAttachmentObject.msaaTexture.view:this.$mainAttachmentObject.texture.view,c=i?this.$mainAttachmentObject.texture.view:null;if(this.$mainAttachmentObject.stencil?.view){const u=i&&this.$mainAttachmentObject.msaaStencil?.view?this.$mainAttachmentObject.msaaStencil.view:this.$mainAttachmentObject.stencil.view,a=this.frameBufferManager.createStencilRenderPassDescriptor(l,u,"load","clear",c);this.renderPassEncoder=this.commandEncoder.beginRenderPass(a)}else{const u=this.frameBufferManager.createRenderPassDescriptor(l,0,0,0,0,"load",c);this.renderPassEncoder=this.commandEncoder.beginRenderPass(u)}}else{const i=this.frameBufferManager.createRenderPassDescriptor(s,0,0,0,0,"load",o);this.renderPassEncoder=this.commandEncoder.beginRenderPass(i)}}this.currentRenderTarget&&this.ensureNodeAreaCleared()}fill(){const e=this.pathCommand.$getVertices;if(e.length===0)return;this.ensureFillRenderPass();const r=this.viewportWidth,n=this.viewportHeight,s=dn(e);if(s.indexCount===0)return;const o=this.bufferManager.acquireVertexBuffer(s.buffer.byteLength,s.buffer),i=this.writeFillUniform(this.$fillStyle[0],this.$fillStyle[1],this.$fillStyle[2],this.$fillStyle[3],this.$matrix[0],this.$matrix[1],this.$matrix[3],this.$matrix[4],this.$matrix[6],this.$matrix[7],r,n),l=this.getOrCreateFillDynamicBindGroup(),c=Ne();if(this.currentRenderTarget&&c?.stencil?.view)this.fillWithStencil(o,s.indexCount,l,i);else if(!this.currentRenderTarget&&!this.inMaskMode&&!gt()&&this.$mainAttachmentObject?.stencil?.view)this.fillWithStencilMain(o,s.indexCount,l,i);else{const u=(this.inMaskMode||gt())&&!!this.$mainAttachmentObject?.stencil?.view&&!this.currentRenderTarget;this.fillSimple(o,s.indexCount,u,l,i)}}getOrCreateFillDynamicBindGroup(){const e=this.bufferManager.dynamicUniform.getBuffer();if(!this.fillDynamicBindGroup||this.fillDynamicBindGroupBuffer!==e){const r=this.pipelineManager.getBindGroupLayout("fill_dynamic");if(!r)throw new Error("[WebGPU] fill_dynamic bind group layout not found");this.fillDynamicBindGroup=this.device.createBindGroup({layout:r,entries:[{binding:0,resource:{buffer:e,size:256}}]}),this.fillDynamicBindGroupBuffer=e}return this.fillDynamicBindGroup}writeFillUniform(e,r,n,s,o,i,l,c,u,a,h,d){return ke[0]=e,ke[1]=r,ke[2]=n,ke[3]=s,ke[4]=o/h,ke[5]=i/d,ke[6]=0,ke[7]=0,ke[8]=l/h,ke[9]=c/d,ke[10]=0,ke[11]=0,ke[12]=u/h,ke[13]=a/d,ke[14]=1,ke[15]=0,this.bufferManager.dynamicUniform.allocate(ke)}fillWithStencil(e,r,n,s){km(this.renderPassEncoder,this.pipelineManager,e,r,n,s)}fillWithStencilMain(e,r,n,s){Im(this.renderPassEncoder,this.pipelineManager,e,r,n,s)}fillSimple(e,r,n,s,o){const i=this.$mainAttachmentObject?.clipLevel??1;_m(this.renderPassEncoder,this.pipelineManager,e,r,s,o,!!this.currentRenderTarget,n,i)}bindAttachment(e){this.attachmentManager.bindAttachment(e);const r=e.color?.view??e.texture?.view;r&&(this.currentRenderTarget=r)}unbindAttachment(){this.attachmentManager.unbindAttachment(),this.currentRenderTarget=null}getAttachmentObject(e,r,n=!1){return this.attachmentManager.getAttachmentObject(e,r,n)}releaseAttachment(e){this.attachmentManager.releaseAttachment(e)}stroke(){const e=this.pathCommand.getVerticesForStroke();if(e.length===0)return;this.ensureFillRenderPass();const r=this.viewportWidth,n=this.viewportHeight,s=Am(e,this.thickness);if(s.length===0)return;const o=dn(s);if(o.indexCount===0)return;const i=this.bufferManager.acquireVertexBuffer(o.buffer.byteLength,o.buffer),l=this.writeFillUniform(this.$strokeStyle[0],this.$strokeStyle[1],this.$strokeStyle[2],this.$strokeStyle[3],this.$matrix[0],this.$matrix[1],this.$matrix[3],this.$matrix[4],this.$matrix[6],this.$matrix[7],r,n),c=this.getOrCreateFillDynamicBindGroup(),u=Ne();if(this.currentRenderTarget&&u?.stencil?.view)this.fillWithStencil(i,o.indexCount,c,l);else if(!this.currentRenderTarget&&!this.inMaskMode&&!gt()&&this.$mainAttachmentObject?.stencil?.view)this.fillWithStencilMain(i,o.indexCount,c,l);else{const a=(this.inMaskMode||gt())&&!!this.$mainAttachmentObject?.stencil?.view&&!this.currentRenderTarget;this.fillSimple(i,o.indexCount,a,c,l)}this.pathCommand.reset()}gradientFill(e,r,n,s,o,i){const l=this.pathCommand.$getVertices;if(l.length===0)return;this.ensureFillRenderPass();const c=this.viewportWidth,u=this.viewportHeight,h=!!((this.inMaskMode||gt())&&this.$mainAttachmentObject?.stencil?.view&&!this.currentRenderTarget),d=!!this.currentRenderTarget,g=Dm(this.device,this.renderPassEncoder,this.bufferManager,this.pipelineManager,l,this.$matrix,this.$fillStyle,e,r,n,s,o,i,c,u,d,h,this.$mainAttachmentObject?.clipLevel??1);g&&this.addFrameTexture(g),this.beginPath()}bitmapFill(e,r,n,s,o,i){const l=this.pathCommand.$getVertices;if(l.length===0)return;this.ensureFillRenderPass();const c=Ne(),u=!!(this.currentRenderTarget&&c?.stencil?.view),a=!!((this.inMaskMode||gt())&&this.$mainAttachmentObject?.stencil?.view&&!this.currentRenderTarget),h=u||a,d=this.$mainAttachmentObject?.clipLevel??1,g=Nm(this.device,this.renderPassEncoder,this.bufferManager,this.pipelineManager,l,this.$matrix,this.$fillStyle,e,r,n,s,o,i,this.viewportWidth,this.viewportHeight,!!this.currentRenderTarget,!!h,d);g&&this.addFrameTexture(g),this.beginPath()}gradientStroke(e,r,n,s,o,i){const l=this.pathCommand.getVerticesForStroke();if(l.length===0)return;this.ensureFillRenderPass();const c=Ne(),u=!!(this.currentRenderTarget&&c?.stencil?.view),a=!!(!this.currentRenderTarget&&this.$mainAttachmentObject?.stencil?.view),h=u||a,d=Ym(this.device,this.renderPassEncoder,this.bufferManager,this.pipelineManager,l,this.thickness,this.$matrix,this.$strokeStyle,e,r,n,s,o,i,this.viewportWidth,this.viewportHeight,!!this.currentRenderTarget,h);d&&this.addFrameTexture(d),this.pathCommand.reset()}bitmapStroke(e,r,n,s,o,i){const l=this.pathCommand.getVerticesForStroke();if(l.length===0)return;this.ensureFillRenderPass();const c=Ne(),u=!!(this.currentRenderTarget&&c?.stencil?.view),a=!!(!this.currentRenderTarget&&this.$mainAttachmentObject?.stencil?.view),h=u||a,d=Hm(this.device,this.renderPassEncoder,this.bufferManager,this.pipelineManager,l,this.thickness,this.$matrix,this.$strokeStyle,e,r,n,s,o,i,this.viewportWidth,this.viewportHeight,!!this.currentRenderTarget,h);d&&this.addFrameTexture(d),this.pathCommand.reset()}clip(){let e=this.frameBufferManager.getCurrentAttachment();const r=!e||e===this.$mainAttachmentObject;if(!e&&this.$mainAttachmentObject&&(e=this.$mainAttachmentObject),!e||!e.stencil)return;const n=this.pathCommand.$getVertices;if(n.length!==0){if(!this.renderPassEncoder)if(this.ensureCommandEncoder(),r&&this.$mainAttachmentObject?.stencil?.view){const s=this.$mainAttachmentObject.msaa&&this.$mainAttachmentObject.msaaTexture?.view,o=s?this.$mainAttachmentObject.msaaTexture.view:this.$mainAttachmentObject.texture.view,i=s&&this.$mainAttachmentObject.msaaStencil?.view?this.$mainAttachmentObject.msaaStencil.view:this.$mainAttachmentObject.stencil.view,l=this.frameBufferManager.createStencilRenderPassDescriptor(o,i,"load","load");this.renderPassEncoder=this.commandEncoder.beginRenderPass(l)}else return;Qm(this.device,this.renderPassEncoder,this.bufferManager,this.pipelineManager,e,n,this.$matrix,this.$fillStyle,this.globalAlpha,r)}}bind(e){this.frameBufferManager.setCurrentAttachment(e),this.viewportWidth=e.width,this.viewportHeight=e.height}get currentAttachmentObject(){return this.frameBufferManager.getCurrentAttachment()||this.$mainAttachmentObject}get atlasAttachmentObject(){return Ne()}useGrid(e){Ja.set(ec,e)}beginNodeRendering(e){this.nodeAreaCleared=!1,this.frameStarted||this.beginFrame();const r=bo(e.index)||Ne();if(r&&r.texture){if(this.renderPassEncoder&&this.nodeRenderPassAtlasIndex===e.index)this.currentRenderTarget=r.texture.view,this.viewportWidth=r.width,this.viewportHeight=r.height;else{this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.currentRenderTarget=r.texture.view,this.viewportWidth=r.width,this.viewportHeight=r.height,this.ensureCommandEncoder();const l=r.msaa&&r.msaaTexture?.view,c=l?r.msaaTexture.view:r.texture.view,u=l?r.texture.view:null;if(r.stencil?.view){const a=l&&r.msaaStencil?.view?r.msaaStencil.view:r.stencil.view,h=this.frameBufferManager.createStencilRenderPassDescriptor(c,a,"load","load",u);this.renderPassEncoder=this.commandEncoder.beginRenderPass(h)}else{const a=this.frameBufferManager.createRenderPassDescriptor(c,0,0,0,0,"load",u);this.renderPassEncoder=this.commandEncoder.beginRenderPass(a)}this.nodeRenderPassAtlasIndex=e.index}let n=Math.max(0,e.x),s=Math.max(0,e.y),o=Math.min(e.w,r.width-n),i=Math.min(e.h,r.height-s);if(n=Math.min(n,r.width),s=Math.min(s,r.height),o=Math.max(0,Math.min(o,r.width-n)),i=Math.max(0,Math.min(i,r.height-s)),this.$scissorRect.x=n,this.$scissorRect.y=s,this.$scissorRect.w=o,this.$scissorRect.h=i,this.currentNodeScissor=this.$scissorRect,o>0&&i>0){const l=Math.min(o+1,r.width-n),c=Math.min(i+1,r.height-s);this.renderPassEncoder.setScissorRect(n,s,l,c)}}}ensureNodeAreaCleared(){this.nodeAreaCleared||(this.nodeAreaCleared=!0,this.clearNodeArea())}clearNodeArea(){if(!this.renderPassEncoder)return;const e=this.pipelineManager.getPipeline("node_clear_atlas");if(!e)return;if(!this.nodeClearQuadBuffer){const n=this.device.createBuffer({size:Lc.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST,mappedAtCreation:!0});new Float32Array(n.getMappedRange()).set(Lc),n.unmap(),this.nodeClearQuadBuffer=n}const r=this.nodeClearQuadBuffer;this.renderPassEncoder.setPipeline(e),this.renderPassEncoder.setVertexBuffer(0,r),this.renderPassEncoder.draw(6),this.currentNodeScissor&&this.renderPassEncoder.setScissorRect(this.currentNodeScissor.x,this.currentNodeScissor.y,this.currentNodeScissor.w,this.currentNodeScissor.h)}endNodeRendering(){this.currentRenderTarget=null,this.currentNodeScissor=null,this.viewportWidth=this.canvasContext.canvas.width,this.viewportHeight=this.canvasContext.canvas.height}drawFill(){Fm()}drawDisplayObject(e,r,n,s,o,i){const l=le.getRenderMaxSize();im(e,r,n,s,o,i,this.$matrix,this.globalCompositeOperation,this.viewportWidth,this.viewportHeight,l,this.globalAlpha)}drawArraysInstanced(){this.frameStarted||this.beginFrame(),this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.nodeRenderPassAtlasIndex=-1,this.ensureCommandEncoder(),this.$mainAttachmentObject&&(this.useOptimizedInstancing?this.renderPassEncoder=Jm(this.device,this.commandEncoder,this.renderPassEncoder,this.$mainAttachmentObject,this.bufferManager,this.frameBufferManager,this.textureManager,this.pipelineManager,!0,!0):this.renderPassEncoder=Zm(this.device,this.commandEncoder,this.renderPassEncoder,this.$mainAttachmentObject,this.bufferManager,this.frameBufferManager,this.textureManager,this.pipelineManager),this.processComplexBlendQueue())}setOptimizedInstancing(e){this.useOptimizedInstancing=e}isOptimizedInstancingEnabled(){return this.useOptimizedInstancing}processComplexBlendQueue(){this.ensureCommandEncoder(),r0(this.device,this.commandEncoder,this.$mainAttachmentObject,this.frameBufferManager,this.textureManager,this.pipelineManager,this.bufferManager)}clearArraysInstanced(){rs().clear()}drawPixels(e,r){const n=bo(e.index)||Ne();if(!n||!n.texture)return;const s=e.w,o=e.h;if(this.renderPassEncoder&&(this.ensureNodeAreaCleared(),this.renderPassEncoder.end(),this.renderPassEncoder=null),this.nodeRenderPassAtlasIndex=-1,n.msaa&&n.msaaTexture?.view)this.drawPixelsToMsaa(n,e,r,s,o);else{const i=s*4;this.device.queue.writeTexture({texture:n.texture.resource,origin:{x:e.x,y:e.y,z:0}},r,{bytesPerRow:i,rowsPerImage:o,offset:0},{width:s,height:o,depthOrArrayLayers:1})}}drawPixelsToMsaa(e,r,n,s,o){const i=Ro(this.device,s,o),l=s*4;this.device.queue.writeTexture({texture:i},n,{bytesPerRow:l,rowsPerImage:o},{width:s,height:o});const c=this.pipelineManager.getPipeline("bitmap_render_msaa");if(!c){Xt(i);return}const u=this.pipelineManager.getBindGroupLayout("positioned_texture");if(!u){Xt(i);return}const a=this.$uniformData8;a[0]=r.x,a[1]=r.y,a[2]=s,a[3]=o,a[4]=e.width,a[5]=e.height,a[6]=0,a[7]=0;const h=this.bufferManager.acquireAndWriteUniformBuffer(a),d=this.textureManager.createSampler("linear_sampler",!0),g=Eo(i);he[0].resource.buffer=h,he[1].resource=d,he[2].resource=g;const m=this.device.createBindGroup({layout:u,entries:he});this.ensureCommandEncoder(),ar.view=e.msaaTexture.view,ar.resolveTarget=e.texture.view;const f=e.msaaStencil?.view;f?(Vr.view=f,Rt.depthStencilAttachment=Vr):Rt.depthStencilAttachment=void 0;const b=this.commandEncoder.beginRenderPass(Rt);b.setViewport(0,0,e.width,e.height,0,1),b.setScissorRect(r.x,r.y,s,o),b.setPipeline(c),b.setBindGroup(0,m),b.draw(6),b.end(),this.pooledRenderTextures.push(i)}drawElement(e,r,n=!1){const s=bo(e.index)||Ne();if(!s||!s.texture)return;const o=e.w,i=e.h;this.renderPassEncoder&&(this.ensureNodeAreaCleared(),this.renderPassEncoder.end(),this.renderPassEncoder=null),this.nodeRenderPassAtlasIndex=-1,s.msaa&&s.msaaTexture?.view?this.drawElementToMsaa(s,e,r,o,i,n):this.drawElementToTexture(s,e,r,o,i,n)}drawElementToMsaa(e,r,n,s,o,i){const l=Ro(this.device,s,o);this.device.queue.copyExternalImageToTexture({source:n,flipY:i},{texture:l,premultipliedAlpha:!0},{width:s,height:o});const c=this.pipelineManager.getPipeline("bitmap_render_msaa");if(!c){Xt(l);return}const u=this.pipelineManager.getBindGroupLayout("positioned_texture");if(!u){Xt(l);return}const a=this.$uniformData8;a[0]=r.x,a[1]=r.y,a[2]=s,a[3]=o,a[4]=e.width,a[5]=e.height,a[6]=0,a[7]=0;const h=this.bufferManager.acquireAndWriteUniformBuffer(a),d=this.textureManager.createSampler("linear_sampler",!0),g=Eo(l);he[0].resource.buffer=h,he[1].resource=d,he[2].resource=g;const m=this.device.createBindGroup({layout:u,entries:he});this.ensureCommandEncoder(),ar.view=e.msaaTexture.view,ar.resolveTarget=e.texture.view;const f=e.msaaStencil?.view;f?(Vr.view=f,Rt.depthStencilAttachment=Vr):Rt.depthStencilAttachment=void 0;const b=this.commandEncoder.beginRenderPass(Rt);b.setViewport(0,0,e.width,e.height,0,1),b.setScissorRect(r.x,r.y,s,o),b.setPipeline(c),b.setBindGroup(0,m),b.draw(6),b.end(),this.pooledRenderTextures.push(l)}drawElementToTexture(e,r,n,s,o,i){const l=Ro(this.device,s,o);this.device.queue.copyExternalImageToTexture({source:n,flipY:i},{texture:l,premultipliedAlpha:!0},{width:s,height:o});const c=this.pipelineManager.getPipeline("bitmap_render");if(!c){Xt(l);return}const u=this.pipelineManager.getBindGroupLayout("positioned_texture");if(!u){Xt(l);return}const a=this.$uniformData8;a[0]=r.x,a[1]=r.y,a[2]=s,a[3]=o,a[4]=e.width,a[5]=e.height,a[6]=0,a[7]=0;const h=this.bufferManager.acquireAndWriteUniformBuffer(a),d=this.textureManager.createSampler("linear_sampler",!0),g=Eo(l);he[0].resource.buffer=h,he[1].resource=d,he[2].resource=g;const m=this.device.createBindGroup({layout:u,entries:he});this.ensureCommandEncoder(),ar.view=e.texture.view,ar.resolveTarget=void 0;const f=e.stencil?.view;f?(Vr.view=f,Rt.depthStencilAttachment=Vr):Rt.depthStencilAttachment=void 0;const b=this.commandEncoder.beginRenderPass(Rt);b.setViewport(0,0,e.width,e.height,0,1),b.setScissorRect(r.x,r.y,s,o),b.setPipeline(c),b.setBindGroup(0,m),b.draw(6),b.end(),this.pooledRenderTextures.push(l)}applyFilter(e,r,n,s,o,i,l,c,u,a,h){this.drawArraysInstanced(),this.frameStarted||this.beginFrame(),this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.nodeRenderPassAtlasIndex=-1,this.ensureCommandEncoder(),this.$filterConfig.commandEncoder=this.commandEncoder,this.$filterConfig.mainAttachment=this.$mainAttachmentObject,A0(e,s,o,i,l,c,u,a,h,this.$filterConfig,this.mainTextureView,this.bufferManager)}containerBeginLayer(e,r){this.drawArraysInstanced(),this.frameStarted||this.beginFrame(),this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null);const n=this.$mainAttachmentObject;this.$containerLayerStack.push(n),this.containerLayerContentSizes.push({width:e,height:r});const s=this.frameBufferManager.createAttachment("container_layer",e,r,n.msaa,!0);this.$mainAttachmentObject=s,this.bind(s)}containerEndLayer(e,r,n,s,o,i,l,c){this.drawArraysInstanced(),this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.ensureCommandEncoder();const u=this.$mainAttachmentObject,a=this.containerLayerContentSizes.pop()||{width:u.width,height:u.height};this.$mainAttachmentObject=this.$containerLayerStack.pop(),this.$filterConfig.commandEncoder=this.commandEncoder,this.$filterConfig.mainAttachment=void 0,O0(u,this.$mainAttachmentObject,"container_layer",e,r,n,s,o,i,l,c,a.width,a.height,this.$filterConfig,this.bufferManager),this.bind(this.$mainAttachmentObject)}containerDrawCachedFilter(e,r,n,s,o,i){if(ee.get(o,"fKey")!==i)return;const c=ee.get(o,"fTexture");if(!c||!c.texture)return;this.drawArraysInstanced(),this.frameStarted||this.beginFrame(),this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.ensureCommandEncoder();const u=this.$mainAttachmentObject;if(!u||!u.texture)return;let a=c,h=null;if(!(n[0]===1&&n[1]===1&&n[2]===1&&n[3]===1&&n[4]===0&&n[5]===0&&n[6]===0&&n[7]===0)){h=this.frameBufferManager.createTemporaryAttachment(c.width,c.height);const V=this.pipelineManager.getPipeline("color_transform"),X=this.pipelineManager.getBindGroupLayout("texture_copy");if(V&&X&&h.texture){Et[0]=n[0],Et[1]=n[1],Et[2]=n[2],Et[3]=n[3],Et[4]=n[4],Et[5]=n[5],Et[6]=n[6],Et[7]=0;const Y=Et,W=this.bufferManager.acquireAndWriteUniformBuffer(Y),K=this.textureManager.createSampler("cached_ct_sampler",!1);he[0].resource.buffer=W,he[1].resource=K,he[2].resource=c.texture.view;const q=this.device.createBindGroup({layout:X,entries:he}),ce=this.frameBufferManager.createRenderPassDescriptor(h.texture.view,0,0,0,0,"clear"),te=this.commandEncoder.beginRenderPass(ce);te.setPipeline(V),te.setBindGroup(0,q),te.draw(6,1,0,0),te.end(),a=h}}const g=le.getDevicePixelRatio(),m=Math.sqrt(r[0]*r[0]+r[1]*r[1]),f=Math.sqrt(r[2]*r[2]+r[3]*r[3]),b=s[0]*(m/g),x=s[1]*(f/g),y=Math.floor(b+r[4]),P=Math.floor(x+r[5]),S=u.msaa&&u.msaaTexture?.view;let M;switch(e){case"add":M=S?"filter_output_add_msaa":"filter_output_add";break;case"screen":M=S?"filter_output_screen_msaa":"filter_output_screen";break;case"alpha":M=S?"filter_output_alpha_msaa":"filter_output_alpha";break;case"erase":M=S?"filter_output_erase_msaa":"filter_output_erase";break;default:M=S?"filter_output_msaa":"filter_output";break}const $=this.pipelineManager.getPipeline(M),T=this.pipelineManager.getBindGroupLayout("texture_copy");if(!$||!T)return;const w=this.textureManager.createSampler("cached_filter_sampler",!0),E=this.bufferManager.acquireAndWriteUniformBuffer($n);he[0].resource.buffer=E,he[1].resource=w,he[2].resource=a.texture.view;const F=this.device.createBindGroup({layout:T,entries:he}),A=S?u.msaaTexture.view:u.texture.view,R=S?u.texture.view:null,v=this.frameBufferManager.createRenderPassDescriptor(A,0,0,0,0,"load",R),U=Math.max(0,y),L=Math.max(0,P),D=Math.max(1,a.width),G=Math.max(1,a.height),B=u.width,z=u.height,k=Math.max(1,Math.min(D,B-U)),_=Math.max(1,Math.min(G,z-L));if(k<=0||_<=0||U>=B||L>=z){h&&this.frameBufferManager.releaseTemporaryAttachment(h);return}const I=this.commandEncoder.beginRenderPass(v);I.setPipeline($),I.setBindGroup(0,F),I.setViewport(U,L,D,G,0,1),I.setScissorRect(U,L,k,_),I.draw(6,1,0,0),I.end(),h&&this.frameBufferManager.releaseTemporaryAttachment(h),this.bind(u)}ensureMainTexture(){this.mainTexture||(this.mainTexture=this.canvasContext.getCurrentTexture(),this.mainTextureView=this.mainTexture.createView())}getCurrentTextureView(){return this.currentRenderTarget?this.currentRenderTarget:(this.ensureMainTexture(),this.mainTextureView)}ensureCommandEncoder(){this.commandEncoder||(this.commandEncoder=this.device.createCommandEncoder())}beginFrame(){this.frameStarted||(this.ensureMainTexture(),this.ensureCommandEncoder(),this.frameStarted=!0,this.frameBufferManager.beginFrame())}addFrameTexture(e){this.pooledTextures.push(e)}endFrame(){if(this.frameStarted){if(this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.bufferManager.dynamicUniform.flush(),this.commandEncoder)try{const e=this.commandEncoder.finish();this.device.queue.submit([e])}catch(e){console.error("Failed to submit frame commands:",e)}this.frameBufferManager.flushPendingReleases(),this.bufferManager.clearFrameBuffers();for(const e of this.frameTextures)e.destroy();this.frameTextures.length=0;for(const e of this.pooledTextures)Ot(e);this.pooledTextures.length=0;for(const e of this.pooledRenderTextures)Xt(e);this.pooledRenderTextures.length=0,Um(),this.fillDynamicBindGroup=null,this.fillDynamicBindGroupBuffer=null,this.commandEncoder=null,this.renderPassEncoder=null,this.currentRenderTarget=null,this.nodeRenderPassAtlasIndex=-1,this.mainTexture=null,this.mainTextureView=null,this.frameStarted=!1}}submit(){this.endFrame()}createNode(e,r){const n=Zp();if(!fn[n]){const i=le.getRenderMaxSize();fn[n]=new Ni(n,i,i)}const o=fn[n].insert(e,r);return o||(wr(n+1),this.createNode(e,r))}removeNode(e){const r=e.index,n=fn[r];n&&n.dispose(e.x,e.y,e.w,e.h)}transferMainCanvas(){if(!this.$mainAttachmentObject||!this.$mainAttachmentObject.texture){this.endFrame();return}this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.ensureCommandEncoder(),this.ensureMainTexture();const e=this.pipelineManager.getPipeline("texture_copy_bgra"),r=this.pipelineManager.getBindGroupLayout("texture_copy");if(!e||!r){console.error("[WebGPU] texture_copy_bgra pipeline not found"),this.endFrame();return}const n=this.$mainAttachmentObject.texture.view;if(!jo||kc!==n){ds||(ds=this.device.createBuffer({size:$n.byteLength,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.device.queue.writeBuffer(ds,0,$n.buffer,$n.byteOffset,$n.byteLength));const i=this.textureManager.createSampler("transfer_sampler",!1);he[0].resource={buffer:ds},he[1].resource=i,he[2].resource=n,jo=this.device.createBindGroup({layout:r,entries:he}),kc=n}const s=jo;Ic.view=this.mainTextureView;const o=this.commandEncoder.beginRenderPass(E0);o.setPipeline(e),o.setBindGroup(0,s),o.draw(6,1,0,0),o.end(),this.endFrame()}async createImageBitmap(e,r){const n=Ne();if(!n)throw new Error("[WebGPU] Atlas attachment not found");this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null);const o=Math.ceil(e*4/256)*256,i=o*r,l=this.device.createBuffer({size:i,usage:GPUBufferUsage.COPY_DST|GPUBufferUsage.MAP_READ}),c=this.device.createCommandEncoder();if(!n.texture)throw new Error("Attachment texture is null");c.copyTextureToBuffer({texture:n.texture.resource,mipLevel:0,origin:{x:0,y:0,z:0}},{buffer:l,bytesPerRow:o,rowsPerImage:r},{width:e,height:r,depthOrArrayLayers:1}),this.device.queue.submit([c.finish()]),await l.mapAsync(GPUMapMode.READ);const u=l.getMappedRange(),a=new Uint8Array(u),h=new Uint8Array(e*r*4);for(let m=0;m<r;m++){const f=m*o,b=m*e*4;h.set(a.subarray(f,f+e*4),b)}l.unmap(),l.destroy();const d=new Float32Array(256);for(let m=1;m<256;m++)d[m]=255/m;for(let m=0;m<h.length;m+=4){const f=h[m+3];if(f===0||f===255)continue;const b=d[f];h[m]=Math.min(255,Math.round(h[m]*b)),h[m+1]=Math.min(255,Math.round(h[m+1]*b)),h[m+2]=Math.min(255,Math.round(h[m+2]*b))}const g=new ImageData(new Uint8ClampedArray(h),e,r);if(typeof createImageBitmap<"u")return await createImageBitmap(g,{premultiplyAlpha:"none",colorSpaceConversion:"none"});throw new Error("[WebGPU] createImageBitmap not available in this environment")}beginMask(){if(this.$mainAttachmentObject&&this.bind(this.$mainAttachmentObject),this.currentRenderTarget=null,this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.frameStarted||this.beginFrame(),this.ensureCommandEncoder(),this.$mainAttachmentObject?.texture&&this.$mainAttachmentObject?.stencil?.view){const r=this.$mainAttachmentObject.clipLevel===0?"clear":"load",n=this.$mainAttachmentObject.msaa&&this.$mainAttachmentObject.msaaTexture?.view,s=n?this.$mainAttachmentObject.msaaTexture.view:this.$mainAttachmentObject.texture.view,o=n&&this.$mainAttachmentObject.msaaStencil?.view?this.$mainAttachmentObject.msaaStencil.view:this.$mainAttachmentObject.stencil.view,i=this.frameBufferManager.createStencilRenderPassDescriptor(s,o,"load",r);this.renderPassEncoder=this.commandEncoder.beginRenderPass(i),this.viewportWidth=this.$mainAttachmentObject.width,this.viewportHeight=this.$mainAttachmentObject.height}cm(),this.inMaskMode=!0}setMaskBounds(e,r,n,s){lm(e,r,n,s)}endMask(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),Ha(),this.inMaskMode=!1}leaveMask(){this.drawArraysInstanced();const r=this.frameBufferManager.getCurrentAttachment()?.clipLevel??0,n=r===1;um(),this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null),this.ensureCommandEncoder();const s=this.$mainAttachmentObject?.msaa&&this.$mainAttachmentObject?.msaaTexture?.view,o=s?this.$mainAttachmentObject.msaaTexture.view:this.$mainAttachmentObject?.texture.view,i=s&&this.$mainAttachmentObject?.msaaStencil?.view?this.$mainAttachmentObject.msaaStencil.view:this.$mainAttachmentObject?.stencil?.view;if(n&&i){const l={colorAttachments:[{view:o,loadOp:"load",storeOp:"store"}],depthStencilAttachment:{view:i,stencilLoadOp:"clear",stencilStoreOp:"store",stencilClearValue:0}};this.commandEncoder.beginRenderPass(l).end()}else if(r>1&&i){const u=\`clip_clear_main_\${Math.min(8,Math.max(1,r))}\`,a=this.pipelineManager.getPipeline(u);if(a){const h=this.frameBufferManager.createStencilRenderPassDescriptor(o,i,"load","load"),d=this.commandEncoder.beginRenderPass(h),g=this.bufferManager.acquireVertexBuffer(Gc.byteLength,Gc);d.setPipeline(a),d.setStencilReference(0),d.setVertexBuffer(0,g),d.draw(6,1,0,0),d.end()}}}}const C0=4;let C;const Vc=t=>{C=t};let qo;const U0=t=>{qo=t};let Qo=0;const G0=()=>Qo;let Zo=0;const L0=()=>Zo;let Jo=!1;const k0=(t,e)=>{Jo=!0,Qo=t,Zo=e},I0=()=>Jo,_0=()=>{qo.width=Qo,qo.height=Zo,Jo=!1},V0=[],Dc=(...t)=>{const e=V0.pop()||[];return t.length&&e.push(...t),e},Dr=(t,e=1)=>({R:(t&16711680)>>16,G:(t&65280)>>8,B:t&255,A:e*255}),D0=async(t,e)=>{if(U0(t),"gpu"in navigator){const r=navigator.gpu,n=await r.requestAdapter();if(!n)throw new Error("WebGPU adapter not available");const s=await n.requestDevice();if(!s)throw new Error("WebGPU device not available");const o=t.getContext("webgpu");if(!o)throw new Error("WebGPU context not available");const i=r.getPreferredCanvasFormat();Vc(new R0(s,o,i,e))}else{const r=t.getContext("webgl2",{stencil:!0,premultipliedAlpha:!0,antialias:!1,depth:!1});if(!r)throw new Error("webgl2 is not supported.");Vc(new ld(r,C0,e))}},N0=(t,e,r=!0)=>{G0()===t&&L0()===e||(k0(t,e),C.resize(t,e,r),r&&ee.reset())},z0=0,X0=1,Y0=2,W0=3,j0=4,H0=5,K0=6,q0=7,Q0=8,Z0=9,J0=10,eg=11,tg=12,rg=13,ng=14,ei=(t,e=!1)=>{let r=0;for(;t.length>r;)switch(t[r++]){case Z0:C.beginPath();break;case z0:C.moveTo(t[r++],t[r++]);break;case Y0:C.lineTo(t[r++],t[r++]);break;case X0:C.quadraticCurveTo(t[r++],t[r++],t[r++],t[r++]);break;case H0:if(e){r+=4;break}C.fillStyle(t[r++]/255,t[r++]/255,t[r++]/255,t[r++]/255);break;case q0:C.fill();break;case K0:if(e){r+=8;break}C.thickness=t[r++],C.caps=t[r++],C.joints=t[r++],C.miterLimit=t[r++],C.strokeStyle(t[r++]/255,t[r++]/255,t[r++]/255,t[r++]/255);break;case Q0:if(e)break;C.stroke();break;case tg:C.closePath();break;case j0:C.arc(t[r++],t[r++],t[r++]);break;case W0:C.bezierCurveTo(t[r++],t[r++],t[r++],t[r++],t[r++],t[r++]);break;case J0:{if(e){r+=1;const a=t[r++];r+=a*5,r+=9,C.fill();break}const n=t[r++],s=Dc(),o=t[r++];for(let a=0;a<o;++a)s.push(t[r++],t[r++],t[r++],t[r++],t[r++]);const i=t.subarray(r,r+6);r+=6;const l=t[r++],c=t[r++],u=t[r++];C.gradientFill(n,s,i,l,c,u)}break;case rg:{if(e){r+=2;const c=t[r++];r+=c,r+=8,C.fill();break}const n=t[r++],s=t[r++],o=t[r++],i=new Uint8Array(t.subarray(r,r+o));r+=o;const l=t.subarray(r,r+6);r+=6,C.bitmapFill(i,l,n,s,!!t[r++],!!t[r++])}break;case eg:{if(e){r+=20,C.fill();break}C.thickness=t[r++],C.caps=t[r++],C.joints=t[r++],C.miterLimit=t[r++];const n=t[r++],s=Dc(),o=t[r++];for(let a=0;a<o;++a)s.push(t[r++],t[r++],t[r++],t[r++],t[r++]);const i=t.subarray(r,r+6);r+=6;const l=t[r++],c=t[r++],u=t[r++];C.gradientStroke(n,s,i,l,c,u)}break;case ng:{if(e){r+=6;const c=t[r++];r+=c,r+=8,C.fill();break}C.thickness=t[r++],C.caps=t[r++],C.joints=t[r++],C.miterLimit=t[r++];const n=t[r++],s=t[r++],o=t[r++],i=new Uint8Array(t.subarray(r,r+o));r+=o;const l=t.subarray(r,r+6);r+=6,C.bitmapStroke(i,l,n,s,!!t[r++],!!t[r++])}break}},cr=t=>{switch(t){case 0:return"copy";case 1:return"add";case 2:return"alpha";case 3:return"darken";case 4:return"difference";case 5:return"erase";case 6:return"hardlight";case 7:return"invert";case 8:return"layer";case 9:return"lighten";case 10:return"multiply";case 11:return"normal";case 12:return"overlay";case 13:return"screen";case 14:return"subtract";default:return"normal"}},ti=(t,e)=>{const r=t.subarray(e,e+6);e+=6;const n=t.subarray(e,e+8);e+=8;const s=t.subarray(e,e+4);e+=4;const o=t[e++],i=t[e++],l=t[e++],c=t[e++],u=!!t[e++],a=!!t[e++],h=!!t[e++],d=\`\${t[e++]}\`,g=t[e++],m=t[e++],f=t[e++],b=\`\${t[e++]}\`;let x;if(t[e++]){if(x=ee.get(d,\`\${g}\`),!x)return e}else{const M=u?new Float32Array(28):null;M&&(M.set(t.subarray(e,e+24)),e+=24),C.useGrid(M);const $=t[e++],T=t.subarray(e,e+$);if(h&&!u){const w=Math.ceil(Math.abs(l-o)),E=Math.ceil(Math.abs(c-i));x=C.createNode(w,E),ee.set(d,\`\${g}\`,x);const F=C.currentAttachmentObject,A=C.atlasAttachmentObject;A&&C.bind(A),C.reset(),C.beginNodeRendering(x);const R=A?A.height-x.y-E:0;C.setTransform(1,0,0,1,x.x,R),a?(ei(T),C.drawFill()):C.drawPixels(x,new Uint8Array(T)),C.endNodeRendering(),F&&C.bind(F)}else{const w=Math.ceil(Math.abs(l-o)*m),E=Math.ceil(Math.abs(c-i)*f);x=C.createNode(w,E),ee.set(d,\`\${g}\`,x);const F=C.currentAttachmentObject,A=C.atlasAttachmentObject;A&&C.bind(A),C.reset(),C.beginNodeRendering(x);const R=A?A.height-x.y-E:0;C.setTransform(m,0,0,f,-o*m+x.x,-i*f+R),M&&(M[24]=x.x,M[25]=R),ei(T),C.drawFill(),C.endNodeRendering(),F&&C.bind(F)}e+=$}const P=t[e++];if(!!t[e++]){const M=!!t[e++],$=t.subarray(e,e+4);e+=4;const T=t[e++],w=t.subarray(e,e+T),E=Math.ceil(Math.abs(s[2]-s[0])),F=Math.ceil(Math.abs(s[3]-s[1]));return C.applyFilter(x,b,M,E,F,h,r,n,cr(P),$,w),e+=T,e}if(C.globalAlpha=Math.min(Math.max(0,n[3]+n[7]/255),1),C.imageSmoothingEnabled=!0,C.globalCompositeOperation=cr(P),h&&!u)C.setTransform(r[0],r[1],r[2],r[3],r[4],r[5]),C.drawDisplayObject(x,s[0],s[1],s[2],s[3],n);else{const M=Math.atan2(r[1],r[0]),$=Math.atan2(-r[2],r[3]);if(M||$){const T=o*m,w=i*f,E=Math.cos(M),F=Math.sin(M),A=Math.cos($),R=Math.sin($);C.setTransform(E,F,-R,A,T*E-w*R+r[4],T*F+w*A+r[5])}else C.setTransform(1,0,0,1,s[0],s[1]);C.drawDisplayObject(x,s[0],s[1],s[2],s[3],n)}return e},ri=(t,e)=>{const r=t.subarray(e,e+6);e+=6,C.reset(),C.setTransform(r[0],r[1],r[2],r[3],r[4],r[5]);const s=!!t[e++]?new Float32Array(28):null;C.useGrid(s),s&&(s.set(t.subarray(e,e+24)),e+=24);const o=t[e++],i=t.subarray(e,e+o);return ei(i,!0),e+=o,C.clip(),e},Nc=(t,e,r)=>{const n=t.widthTable[e.line]||0,s=e.textFormat,o=s.leftMargin||0;if(!r.wordWrap&&n>r.rawWidth)return Math.max(0,o);const i=s.rightMargin||0;return s.align==="center"||r.autoSize==="center"?Math.max(0,r.rawWidth/2-o-i-n/2-2):s.align==="right"||r.autoSize==="right"?Math.max(0,r.rawWidth-o-n-i-4):Math.max(0,o)},sg=t=>{let e="";return t.italic&&(e+="italic "),t.bold&&(e+="bold "),\`\${e}\${t.size}px '\${t.font}','sans-serif'\`},og=(t,e,r,n)=>{const s=new OffscreenCanvas(e.width,e.height),o=s.getContext("2d");if(!o)return s;const i=Math.min(1,Math.max(r,n));if(e.background||e.border){if(o.beginPath(),o.moveTo(0,0),o.lineTo(e.width,0),o.lineTo(e.width,e.height),o.lineTo(0,e.height),o.lineTo(0,0),e.background){const M=Dr(e.backgroundColor);o.fillStyle=\`rgba(\${M.R},\${M.G},\${M.B},\${M.A})\`,o.fill()}if(e.border){const M=Dr(e.borderColor);o.lineWidth=i,o.strokeStyle=\`rgba(\${M.R},\${M.G},\${M.B},\${M.A})\`,o.stroke()}}if(!t)return s;o.save(),o.beginPath(),o.moveTo(2,2),o.lineTo(e.width-2,2),o.lineTo(e.width-2,e.height-2),o.lineTo(2,e.height-2),o.lineTo(2,2),o.clip();let l=2;if(e.scrollX>0){const M=(e.textWidth+4-e.rawWidth)/e.rawWidth;l+=-e.scrollX*M}let c=2;if(e.scrollY>0){const M=(e.textHeight+2-e.rawHeight)/e.rawHeight;c+=-e.scrollY*M}if(o.setTransform(r,0,0,n,l*r,c*n),o.beginPath(),e.selectIndex>-1&&e.focusIndex>-1){const M=t.textTable.length-1;let $=0,T=0;e.focusIndex<=e.selectIndex?($=Math.min(e.focusIndex,M),T=Math.min(e.selectIndex,M)):($=Math.min(e.selectIndex,M),T=Math.min(e.focusIndex-1,M));const w=t.textTable[$],E=t.lineTable[w.line],F=Nc(t,E,e);let A=0;if($&&w.mode==="text"){let v=$;for(;v;){const U=t.textTable[--v];if(U.mode!=="text")break;A+=U.w}}o.fillStyle="#b4d7ff";let R=0;for(let v=$;v<=T;++v){const U=t.textTable[v];if(U.mode==="text"&&(R+=U.w,v!==T))continue;let L=0;const D=U.mode==="text"?U.line:U.line-1;for(let G=0;G<D;++G)L+=t.heightTable[G];o.beginPath(),o.rect(A,L,R+F,t.heightTable[D]),o.fill(),A=0,R=0}}const u=e.rawWidth;let a=0;if(e.scrollX>0){const M=(e.textWidth-u)/u;a=e.scrollX*M}const h=u+a,d=e.rawHeight;let g=0;if(e.scrollY>0){const M=(e.textHeight-d)/d;g=e.scrollY*M}const m=d+g;let f=0,b=0,x=0,y=0,P=!1,S=-1;for(let M=0;M<t.textTable.length;++M){const $=t.textTable[M];if(!$)continue;if(($.mode==="text"||$.mode==="break")&&(S++,e.stopIndex>-1&&S>e.stopIndex))break;if(P&&$.mode==="text")continue;const T=$.textFormat;if(e.autoSize==="none"){if(b>m)break;if($.mode==="text"&&(a>f+$.w||f>h)){f+=$.w;continue}}const w=Dr(T.color||0);if(o.fillStyle=\`rgba(\${w.R},\${w.G},\${w.B},\${w.A})\`,e.focusVisible&&e.focusIndex===M){const F=f+x+.1;let A=$.line,R=$.y,v=t.ascentTable[A];$.mode!=="text"&&(R=$.mode==="break"?$.h:t.ascentTable[A-1],A>0?(A=$.line-1,v=t.ascentTable[A]):v=$.h),A>0&&t.ascentTable[A]===0&&A++;for(let U=0;U<A;++U)v+=t.heightTable[U];o.strokeStyle=\`rgba(\${w.R},\${w.G},\${w.B},\${w.A})\`,o.beginPath(),o.moveTo(F,v),o.lineTo(F,v-R),o.stroke()}if(e.thickness){const F=Dr(e.thicknessColor);o.lineWidth=e.thickness,o.strokeStyle=\`rgba(\${F.R},\${F.G},\${F.B},\${F.A})\`}const E=$.line|0;switch($.mode){case"break":case"wrap":if(f=0,E&&(b+=t.heightTable[E-1]),g>b+t.heightTable[E]){P=!0;continue}y=t.ascentTable[E],x=Nc(t,$,e),P=!1;break;case"text":{o.beginPath(),o.font=sg(T);const F=f+x,A=b+y;if(T.underline){const R=Dr(T.color||0);o.lineWidth=i,o.strokeStyle=\`rgba(\${R.R},\${R.G},\${R.B},\${R.A})\`,o.beginPath(),o.moveTo(F,A+2),o.lineTo(F+$.w,A+2),o.stroke()}e.thickness&&o.strokeText($.text,F,A),o.fillText($.text,F,A),f+=$.w}break}}if(e.focusVisible&&e.focusIndex>=t.textTable.length){const M=t.textTable[e.focusIndex-1];if(M){const $=Dr(M.textFormat.color||0);o.strokeStyle=\`rgba(\${$.R},\${$.G},\${$.B},\${$.A})\`;const T=f+x+.1,w=b+y;o.beginPath(),M.mode==="text"?o.moveTo(T,w-M.y):o.moveTo(T,w+M.h),o.lineTo(T,w),o.stroke()}}return o.restore(),s},ig=new TextDecoder,ni=(t,e)=>{const r=t.subarray(e,e+6);e+=6;const n=t.subarray(e,e+8);e+=8;const s=t.subarray(e,e+4);e+=4;const o=t[e++],i=t[e++],l=t[e++],c=t[e++],u=\`\${t[e++]}\`,a=t[e++],h=!!t[e++],d=t[e++],g=t[e++],m=\`\${t[e++]}\`;let f;if(t[e++]){if(f=ee.get(u,\`\${a}\`),!f)return e}else{const M=Math.ceil(Math.abs(l-o)*d),$=Math.ceil(Math.abs(c-i)*g),T=!!t[e++];f=T?ee.get(u,\`\${a}\`):C.createNode(M,$),T||ee.set(u,\`\${a}\`,f);const w=t[e++],E=new Uint8Array(t.subarray(e,e+w));e+=w;let F="none";switch(t[e++]){case 0:F="center";break;case 1:F="left";break;case 2:F="none";break;case 3:F="right";break}const A={width:M,height:$,autoSize:F,stopIndex:t[e++],scrollX:t[e++],scrollY:t[e++],textWidth:t[e++],textHeight:t[e++],rawWidth:t[e++],rawHeight:t[e++],focusIndex:t[e++],selectIndex:t[e++],focusVisible:!!t[e++],thickness:t[e++],thicknessColor:t[e++],wordWrap:!!t[e++],border:!!t[e++],borderColor:t[e++],background:!!t[e++],backgroundColor:t[e++],defaultColor:t[e++],defaultSize:t[e++]},R=og(JSON.parse(ig.decode(E)),A,d,g),v=C.currentAttachmentObject,U=C.atlasAttachmentObject;U&&C.bind(U),C.reset(),C.beginNodeRendering(f);const L=U?U.height-f.y-$:0;C.setTransform(1,0,0,1,f.x,L),C.drawElement(f,R),C.endNodeRendering(),v&&C.bind(v)}const x=t[e++];if(!!t[e++]){const M=!!t[e++],$=t.subarray(e,e+4);e+=4;const T=t[e++],w=t.subarray(e,e+T),E=Math.ceil(Math.abs(s[2]-s[0])),F=Math.ceil(Math.abs(s[3]-s[1]));return C.applyFilter(f,m,!!Math.max(+h,+M),E,F,!1,r,n,cr(x),$,w),e+=T,e}C.globalAlpha=Math.min(Math.max(0,n[3]+n[7]/255),1),C.imageSmoothingEnabled=!0,C.globalCompositeOperation=cr(x);const P=Math.atan2(r[1],r[0]),S=Math.atan2(-r[2],r[3]);if(P||S){const M=o*d,$=i*g,T=Math.cos(P),w=Math.sin(P),E=Math.cos(S),F=Math.sin(S);C.setTransform(T,w,-F,E,M*T-$*F+r[4],M*w+$*E+r[5])}else C.setTransform(1,0,0,1,s[0],s[1]);return C.drawDisplayObject(f,s[0],s[1],s[2],s[3],n),e},si=(t,e,r)=>{const n=t.subarray(e,e+6);e+=6;const s=t.subarray(e,e+8);e+=8;const o=t.subarray(e,e+4);e+=4;const i=t[e++],l=t[e++],c=t[e++],u=t[e++],a=\`\${t[e++]}\`,h="0",d=!!t[e++],g=\`\${t[e++]}\`;let m;if(t[e++]){if(m=ee.get(a,\`\${h}\`),!m)return e}else{const y=Math.abs(c-i),P=Math.abs(u-l),S=!!t[e++];if(m=S?ee.get(a,\`\${h}\`):C.createNode(y,P),S||ee.set(a,\`\${h}\`,m),r&&r.length){const M=C.currentAttachmentObject,$=C.atlasAttachmentObject;$&&C.bind($),C.reset(),C.beginNodeRendering(m);const T=$?$.height-m.y-P:0;C.setTransform(1,0,0,1,m.x,T);const w=r.shift();C.drawElement(m,w,!0),C.endNodeRendering(),M&&C.bind(M)}}const b=t[e++];if(!!t[e++]){const y=!!t[e++],P=t.subarray(e,e+4);e+=4;const S=t[e++],M=t.subarray(e,e+S),$=Math.ceil(Math.abs(o[2]-o[0])),T=Math.ceil(Math.abs(o[3]-o[1]));return C.applyFilter(m,g,!!Math.max(+d,+y),$,T,!0,n,s,cr(b),P,M),e+=S,e}return C.globalAlpha=Math.min(Math.max(0,s[3]+s[7]/255),1),C.imageSmoothingEnabled=!0,C.globalCompositeOperation=cr(b),C.setTransform(n[0],n[1],n[2],n[3],n[4],n[5]),C.drawDisplayObject(m,o[0],o[1],o[2],o[3],s),e},oi=(t,e)=>{const r=t[e++];for(let n=0;n<r;++n)switch(t[e++]){case 0:e=oi(t,e);break;case 1:e=ri(t,e);break}return e},ii=(t,e,r)=>{let n=0,s=!0;const o=cr(t[e++]),i=!!t[e++];let l=0,c=0,u=!1,a="",h="",d=null,g=null,m=null,f=null;if(i)if(l=t[e++],c=t[e++],u=!!t[e++],u){const y=!!t[e++];if(a=\`\${t[e++]}\`,h=\`\${t[e++]}\`,y)return d=t.subarray(e,e+4),e+=4,m=t.subarray(e,e+6),e+=6,f=t.subarray(e,e+8),e+=8,C.containerDrawCachedFilter(o,m,f,d,a,h),e;d=t.subarray(e,e+4),e+=4,m=t.subarray(e,e+6),e+=6,f=t.subarray(e,e+8),e+=8;const P=t[e++];g=t.subarray(e,e+P),e+=P}else m=t.subarray(e,e+6),e+=6,f=t.subarray(e,e+8),e+=8;i&&C.containerBeginLayer(l,c);const b=!!t[e++];if(b){switch(C.drawArraysInstanced(),C.save(),C.beginMask(),C.setMaskBounds(t[e++],t[e++],t[e++],t[e++]),t[e++]){case 0:e=oi(t,e);break;case 1:e=ri(t,e);break}C.endMask()}const x=t[e++];for(let y=0;x>y;y++){const P=t[e++],S=t[e++];if(n&&P>n&&(s&&(C.restore(),C.leaveMask()),n=0,s=!0),!s)continue;if(S){if(n=S,s=!!t[e++],!s)continue;switch(C.drawArraysInstanced(),C.save(),C.beginMask(),C.setMaskBounds(t[e++],t[e++],t[e++],t[e++]),t[e++]){case 0:e=oi(t,e);break;case 1:e=ri(t,e);break}C.endMask();continue}if(!t[e++])continue;switch(t[e++]){case 0:e=ii(t,e,r);break;case 1:e=ti(t,e);break;case 2:e=ni(t,e);break;case 3:e=si(t,e,r);break}}return(n||b)&&(C.restore(),C.leaveMask()),i&&C.containerEndLayer(o,m,f,u,d,g,a,h),e};let Nr=-1;const ag=(t,e)=>{C.clearTransferBounds();let r=0;const n=t[r++];for(Nr!==n&&(Nr=n,Nr===-1?C.updateBackgroundColor(0,0,0,0):C.updateBackgroundColor((Nr>>16&255)/255,(Nr>>8&255)/255,(Nr&255)/255,1)),C.reset(),C.setTransform(1,0,0,1,0,0),C.fillBackgroundColor();t.length>r;){if(!t[r++])continue;const s=t[r++];switch(s){case 0:r=ii(t,r,e);break;case 1:r=ti(t,r);break;case 2:r=ni(t,r);break;case 3:r=si(t,r,e);break;default:console.error("unknown type",s);break}}C.drawArraysInstanced(),I0()&&_0(),C.transferMainCanvas()},cg=t=>{for(let e=0;e<t.length;++e){const r=\`\${t[e]}\`;if(!ee.has(r))continue;const n=ee.getById(r);for(const s of n.values())C.removeNode(s);ee.removeById(r)}},lg=async(t,e,r,n=0,s=0,o)=>{C.clearTransferBounds();let i=1;C.reset(),C.setTransform(1,0,0,1,0,0);const l=C.$clearColorR,c=C.$clearColorG,u=C.$clearColorB,a=C.$clearColorA;for(C.updateBackgroundColor((n>>16&255)/255,(n>>8&255)/255,(n&255)/255,s),C.fillBackgroundColor();t.length>i;){if(!t[i++])continue;const d=t[i++];switch(d){case 0:i=ii(t,i,o);break;case 1:i=ti(t,i);break;case 2:i=ni(t,i);break;case 3:i=si(t,i,o);break;default:console.error("unknown type",d);break}}C.drawArraysInstanced();const h=await C.createImageBitmap(e,r);return C.updateBackgroundColor(l,c,u,a),h};class ug{state;queue;constructor(){this.state="deactivate",this.queue=[]}async execute(){for(this.state="active";this.queue.length;){const e=this.queue.shift();if(e)switch(e.command){case"render":ag(e.buffer.subarray(0,e.length),e.imageBitmaps),globalThis.postMessage({message:"render",buffer:e.buffer},[e.buffer.buffer]);break;case"resize":N0(e.buffer[0],e.buffer[1],!!e.buffer[2]);break;case"initialize":await D0(e.canvas,e.devicePixelRatio);break;case"removeCache":cg(e.buffer);break;case"cacheClear":ee.reset();break;case"capture":{const r=await lg(e.buffer.subarray(0,e.length),e.width,e.height,e.bgColor,e.bgAlpha,e.imageBitmaps);globalThis.postMessage({message:"capture",buffer:e.buffer,imageBitmap:r},[e.buffer.buffer,r])}break}}this.state="deactivate"}}const ai=new ug;self.addEventListener("message",async t=>{ai.queue.push(t.data),ai.state==="deactivate"&&await ai.execute()})})();
2338
+ `,Fn=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",di],{type:"text/javascript;charset=utf-8"});function Ns(e){let t;try{if(t=Fn&&(self.URL||self.webkitURL).createObjectURL(Fn),!t)throw"";const r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(di),{name:e?.name})}}const Ce=new Ns,Ys=e=>{const t=e.transferControlToOffscreen();Ce.postMessage({command:"initialize",canvas:t,devicePixelRatio:window.devicePixelRatio},[t])};class ze{static get AT_TARGET(){return 2}static get BUBBLING_PHASE(){return 3}static get CAPTURING_PHASE(){return 1}}let x=class{type;bubbles;listener;target;currentTarget;eventPhase;_$stopImmediatePropagation;_$stopPropagation;constructor(t,r=!1){this.type=`${t}`,this.bubbles=r,this.target=null,this.currentTarget=null,this.eventPhase=ze.AT_TARGET,this.listener=null,this._$stopImmediatePropagation=!1,this._$stopPropagation=!1}static get ADDED(){return"added"}static get ADDED_TO_STAGE(){return"addedToStage"}static get CHANGE(){return"change"}static get COMPLETE(){return"complete"}static get ENDED(){return"ended"}static get ENTER_FRAME(){return"enterFrame"}static get FRAME_LABEL(){return"frameLabel"}static get INPUT(){return"input"}static get OPEN(){return"open"}static get REMOVED(){return"removed"}static get REMOVED_FROM_STAGE(){return"removedFromStage"}static get RESIZE(){return"resize"}static get SCROLL(){return"scroll"}stopImmediatePropagation(){this._$stopImmediatePropagation=!0}stopPropagation(){this._$stopPropagation=!0}};const q=new Map,Kt=[],Qt=()=>Kt.length?Kt.pop():[],Pe=e=>{10>Kt.length&&(e.length=0,Kt.push(e))};let Ai=null;const We=e=>{Ai=e},jt=()=>Ai;class V extends x{constructor(t,r=!0){return super(t,r),new Proxy(this,{get:(n,i)=>{if(i in n)return n[i];const s=jt();if(s)switch(s.type){case V.KEY_DOWN:case V.KEY_UP:return i in s?$event[i]:void 0;default:return}}})}static get KEY_DOWN(){return"keydown"}static get KEY_UP(){return"keyup"}}const Ws=(e,t,r,n=!1,i=0)=>{let s;switch(t){case x.ENTER_FRAME:case V.KEY_DOWN:case V.KEY_UP:(!q.size||!q.has(t))&&q.set(t,Qt()),s=q.get(t);break;default:e._$events||(e._$events=new Map),(!e._$events.size||!e._$events.has(t))&&e._$events.set(t,Qt()),s=e._$events.get(t);break}const a=s.length;let o=0;for(;o<a;++o){const c=s[o];if(n===c.useCapture&&c.target===e&&c.listener===r)break}if(a===o)s.push({listener:r,priority:i,useCapture:n,target:e});else{const c=s[o];c.listener=r,c.priority=i,c.useCapture=n,c.target=e}s.length>1&&s.sort((c,u)=>{switch(!0){case c.priority>u.priority:return-1;case c.priority<u.priority:return 1;default:return 0}})},Vs=(e,t)=>{switch(t){case x.ENTER_FRAME:case V.KEY_DOWN:case V.KEY_UP:return!!(q.size&&q.has(t));default:return!!(e._$events&&e._$events.size&&e._$events.has(t))}},Ks=(e,t,r,n=!1)=>{let i;switch(t){case x.ENTER_FRAME:case V.KEY_DOWN:case V.KEY_UP:if(!q.size||!q.has(t))return;i=q.get(t);break;default:if(!e._$events||!e._$events.size||!e._$events.has(t))return;i=e._$events.get(t);break}if(i){for(let s=0;s<i.length;++s){const a=i[s];if(n===a.useCapture&&a.listener===r){i.splice(s,1);break}}if(!i.length){q.has(t)&&q.delete(t),e._$events&&e._$events.has(t)&&(e._$events.delete(t),e._$events.size||(e._$events=null)),Pe(i);return}i.length>1&&i.sort((s,a)=>{switch(!0){case s.priority>a.priority:return-1;case s.priority<a.priority:return 1;default:return 0}})}},Qs=(e,t,r=!1)=>{let n;switch(t){case x.ENTER_FRAME:case V.KEY_DOWN:case V.KEY_UP:if(!q.size||!q.has(t))return;n=q.get(t);break;default:if(!e._$events||!e._$events.size||!e._$events.has(t))return;n=e._$events.get(t);break}if(!n)return;const i=Qt();for(let s=0;s<n.length;++s){const a=n[s];r!==a.useCapture&&i.push(a)}if(!i.length){q.has(t)&&q.delete(t),e._$events&&e._$events.has(t)&&(e._$events.delete(t),e._$events.size||(e._$events=null)),Pe(i),Pe(n);return}i.length>1&&i.sort((s,a)=>{switch(!0){case s.priority>a.priority:return-1;case s.priority<a.priority:return 1;default:return 0}}),q.has(t)?q.set(t,i):e._$events?.set(t,i),Pe(n)},Xs=(e,t)=>{if(e.hasEventListener(t))return!0;if("parent"in e){let r=e.parent;for(;r;){if(r.hasEventListener(t))return!0;if(!("parent"in r))break;r=r.parent}}return!1},zs=(e,t)=>{switch(t.type){case x.ENTER_FRAME:case V.KEY_DOWN:case V.KEY_UP:{if(!q.size||!q.has(t.type))return!1;const r=q.get(t.type);if(!r.length)return!1;for(let n=0;n<r.length;++n){const i=r[n];t.eventPhase=ze.AT_TARGET,t.target=t.currentTarget=i.target;try{t.listener=i.listener,i.listener(t)}catch(s){return console.error(s),!1}}}return!0;default:{t.target=e;let r=null;if(e._$events&&e._$events.size&&e._$events.has(t.type)){const i=e._$events.get(t.type);i&&(r=i.slice(0))}const n=Qt();if("parent"in e){let i=e.parent;for(;i;){if(i.hasEventListener(t.type)){const s=i._$events&&i._$events.has(t.type)?i._$events.get(t.type):null;s&&n.push(s)}if(!("parent"in i))break;i=i.parent}}if(!r&&!n.length)return r&&Pe(r),Pe(n),!1;if(n.length)switch(t.eventPhase=ze.CAPTURING_PHASE,!0){case t._$stopImmediatePropagation:case t._$stopPropagation:break;default:for(let i=n.length-1;i>-1;--i){const s=n[i];for(let a=0;a<s.length;++a){const o=s[a];if(o.useCapture){t.currentTarget=o.target;try{t.listener=o.listener,o.listener.call(null,t)}catch(c){return console.error(c),!1}if(t._$stopImmediatePropagation)break}}if(t._$stopImmediatePropagation)break}break}if(r&&!t._$stopImmediatePropagation&&!t._$stopPropagation){t.eventPhase=ze.AT_TARGET;for(let i=0;i<r.length;++i){const s=r[i];if(!s.useCapture){t.currentTarget=s.target;try{t.listener=s.listener,s.listener.call(null,t)}catch(a){return console.error(a),!1}if(t._$stopImmediatePropagation)break}}Pe(r)}if(n.length){switch(t.eventPhase=ze.BUBBLING_PHASE,!0){case t._$stopImmediatePropagation:case t._$stopPropagation:case!t.bubbles:break;default:for(let i=0;i<n.length;++i){const s=n[i];for(let a=0;a<s.length;++a){const o=s[a];if(!o.useCapture){t.currentTarget=o.target;try{t.listener=o.listener,o.listener.call(null,t)}catch(c){return console.error(c),!1}if(t._$stopImmediatePropagation)break}}if(t._$stopImmediatePropagation)break}break}Pe(n)}}return!0}};class nt{_$events;constructor(){this._$events=null}addEventListener(t,r,n=!1,i=0){this._$events||(this._$events=new Map),Ws(this,t,r,n,i)}dispatchEvent(t){return zs(this,t)}hasEventListener(t){return Vs(this,t)}removeEventListener(t,r,n=!1){Ks(this,t,r,n)}removeAllEventListener(t,r=!1){Qs(this,t,r)}willTrigger(t){return Xs(this,t)}}class Ne extends x{constructor(t,r=!0){return super(t,r),new Proxy(this,{get:(n,i)=>{if(i in n)return n[i];const s=jt();if(s)switch(s.type){case Ne.FOCUS_IN:case Ne.FOCUS_OUT:return i in s?$event[i]:void 0;default:return}}})}static get FOCUS_IN(){return"focusin"}static get FOCUS_OUT(){return"focusout"}}class Gt extends x{status;responseHeaders;responseURL;constructor(t,r=!1,n=0,i="",s=[]){super(t,r),this.status=n|0,this.responseHeaders=s,this.responseURL=i}static get HTTP_STATUS(){return"httpStatus"}}class Re extends x{text;constructor(t,r=!1,n=""){super(t,r),this.text=`${n}`}static get IO_ERROR(){return"ioError"}}class S extends x{constructor(t,r=!0){return super(t,r),new Proxy(this,{get:(n,i)=>{if(i in n)return n[i];const s=jt();if(s)switch(s.type){case S.POINTER_DOWN:case S.POINTER_MOVE:case S.POINTER_UP:case S.POINTER_LEAVE:case S.POINTER_OVER:case S.POINTER_OUT:return i in s?$event[i]:void 0;default:return}}})}static get DOUBLE_CLICK(){return"dblclick"}static get POINTER_DOWN(){return"pointerdown"}static get POINTER_LEAVE(){return"pointerleave"}static get POINTER_MOVE(){return"pointermove"}static get POINTER_OUT(){return"pointerout"}static get POINTER_OVER(){return"pointerover"}static get POINTER_UP(){return"pointerup"}static get POINTER_CANCEL(){return"pointercancel"}}class Z extends x{bytesLoaded;bytesTotal;constructor(t,r=!1,n=0,i=0){super(t,r),this.bytesLoaded=n|0,this.bytesTotal=i|0}static get PROGRESS(){return"progress"}}class Ae extends x{static get PLAY(){return"play"}static get PLAYING(){return"playing"}static get PAUSE(){return"pause"}static get SEEK(){return"seek"}}class ye extends x{static get UPDATE(){return"jobupdate"}static get STOP(){return"jobstop"}}class qe extends x{constructor(t,r=!0){return super(t,r),new Proxy(this,{get:(n,i)=>{if(i in n)return n[i];const s=jt();if(s&&s.type===qe.WHEEL)return i in s?$event[i]:void 0}})}static get WHEEL(){return"wheel"}}const pi=[],er=e=>{e.size&&e.clear(),pi.push(e)},Hs=()=>pi.pop()||new Map,Js=(e,t,r)=>{r.clear(),e.$timerId!==null&&clearTimeout(e.$timerId);for(const n of t.values()){for(const i of n.values())i&&e.destroy(i);er(n)}t.clear()},Zs=(e,t)=>{if(!(!t||typeof t!="object")&&"canvas"in t){const r=t.canvas,n=r.width,i=r.height;t.clearRect(0,0,n+1,i+1),r.width=r.height=1,e.push(r)}},qs=(e,t,r)=>{if(!e.has(t))return;const n=e.get(t);n.has(r)&&(n.delete(r),n.size||(er(n),e.delete(t)))},js=(e,t,r)=>{if(!t.has(r))return;const n=t.get(r);for(const i of n.values())e.destroy(i);t.delete(r),er(n)},ea=(e,t,r)=>{const n=e.get(t)||null;return n?(n.delete("trash"),n.get(r)||null):null},ta=(e,t,r,n,i=null)=>{t.has(r)||t.set(r,Hs());const s=t.get(r);if(i===null){if(!s.has(n))return;e.destroy(s.get(n)),s.delete(n),s.size||(t.delete(r),er(s));return}s.set(n,i)},ra=(e,t,r="")=>r?e.has(t)?e.get(t).has(r):!1:e.has(t),na=(e,t,r)=>{let n=2166136261,i=e*100|0;return n^=i&255,n=Math.imul(n,16777619),n^=i>>>8&255,n=Math.imul(n,16777619),n^=i>>>16&255,n=Math.imul(n,16777619),n^=i>>>24,n=Math.imul(n,16777619),i=t*100|0,n^=i&255,n=Math.imul(n,16777619),n^=i>>>8&255,n=Math.imul(n,16777619),n^=i>>>16&255,n=Math.imul(n,16777619),n^=i>>>24,n=Math.imul(n,16777619),r&&(i=r*100|0,n^=i&255,n=Math.imul(n,16777619),n^=i>>>8&255,n=Math.imul(n,16777619),n^=i>>>16&255,n=Math.imul(n,16777619),n^=i>>>24,n=Math.imul(n,16777619)),(n>>>0)%16777216},ia=(e,t,r,n)=>{let i=2166136261,s=e*100|0;return i^=s&255,i=Math.imul(i,16777619),i^=s>>>8&255,i=Math.imul(i,16777619),i^=s>>>16&255,i=Math.imul(i,16777619),i^=s>>>24,i=Math.imul(i,16777619),s=t*100|0,i^=s&255,i=Math.imul(i,16777619),i^=s>>>8&255,i=Math.imul(i,16777619),i^=s>>>16&255,i=Math.imul(i,16777619),i^=s>>>24,i=Math.imul(i,16777619),s=r*100|0,i^=s&255,i=Math.imul(i,16777619),i^=s>>>8&255,i=Math.imul(i,16777619),i^=s>>>16&255,i=Math.imul(i,16777619),i^=s>>>24,i=Math.imul(i,16777619),s=n*100|0,i^=s&255,i=Math.imul(i,16777619),i^=s>>>8&255,i=Math.imul(i,16777619),i^=s>>>16&255,i=Math.imul(i,16777619),i^=s>>>24,i=Math.imul(i,16777619),(i>>>0)%16777216},sa=(e,t,r,n)=>{if(r.has(n))return;const i=t.get(n);i&&(i.set("trash",!0),r.set(n,i),e.$timerId!==null&&clearTimeout(e.$timerId),e.$removeCache=!1,e.$timerId=setTimeout(()=>{e.$removeCache=!0,e.$timerId=null},1e3))},aa=(e,t)=>{if(t.size){for(const[r,n]of t)n.has("trash")&&(e.removeById(r),e.$removeIds.push(+r));t.clear(),e.$removeCache=!1}};class oa{_$pool;_$store;_$trash;$timerId;$removeCache;$removeIds;constructor(){this._$pool=[],this._$store=new Map,this._$trash=new Map,this.$timerId=null,this.$removeIds=[],this.$removeCache=!1}reset(){Js(this,this._$store,this._$trash)}destroy(t=null){Zs(this._$pool,t)}getCanvas(){return this._$pool.pop()||document.createElement("canvas")}remove(t,r){qs(this._$store,t,r)}removeTimer(t){sa(this,this._$store,this._$trash,t)}removeTimerScheduledCache(){aa(this,this._$trash)}removeById(t){js(this,this._$store,t)}getById(t){return this._$store.get(t)}get(t,r){return ea(this._$store,t,r)}set(t,r,n=null){ta(this,this._$store,t,r,n)}has(t,r=""){return ra(this._$store,t,r)}generateKeys(t,r,n){return na(t,r,n)}generateFilterKeys(t,r,n,i){return ia(t,r,n,i)}}const O=new oa,ca=e=>{const t=O.getCanvas();t.width=e.width,t.height=e.height;const r=t.getContext("2d",{willReadFrequently:!0});r.drawImage(e,0,0);const n=r.getImageData(0,0,e.width,e.height),i=new Uint8Array(n.data.buffer);return O.destroy(r),i},la=e=>{const t=O.getCanvas();t.width=e.width,t.height=e.height;const r=t.getContext("2d");r.setTransform(1,0,0,1,0,0),r.drawImage(e,0,0);const n=r.getImageData(0,0,e.width,e.height),i=new Uint8Array(n.data.buffer);return O.destroy(r),i};class _e{width;height;buffer;constructor(t=0,r=0){this.width=t|0,this.height=r|0,this.buffer=null}set image(t){if(!t){this.width=0,this.height=0,this.buffer=null;return}this.buffer=ca(t),this.width=t.width,this.height=t.height}set canvas(t){if(!t){this.width=0,this.height=0,this.buffer=null;return}this.buffer=la(t),this.width=t.width,this.height=t.height}clone(){const t=new _e(this.width,this.height);return this.buffer!==null&&(t.buffer=this.buffer.slice()),t}}class ua{static get ADD(){return"add"}static get ALPHA(){return"alpha"}static get DARKEN(){return"darken"}static get DIFFERENCE(){return"difference"}static get ERASE(){return"erase"}static get HARDLIGHT(){return"hardlight"}static get INVERT(){return"invert"}static get LAYER(){return"layer"}static get LIGHTEN(){return"lighten"}static get MULTIPLY(){return"multiply"}static get NORMAL(){return"normal"}static get OVERLAY(){return"overlay"}static get SCREEN(){return"screen"}static get SUBTRACT(){return"subtract"}}const j=e=>{e.changed=!0;let t=e.parent;for(;t&&!t.changed;)t.changed=!0,t=t.parent},ha=(e,t)=>{const r=U.multiply(e._$colorTransform,t._$colorTransform);e._$colorTransform[0]=r[0],e._$colorTransform[1]=r[1],e._$colorTransform[2]=r[2],e._$colorTransform[3]=r[3],e._$colorTransform[4]=r[4],e._$colorTransform[5]=r[5],e._$colorTransform[6]=r[6],e._$colorTransform[7]=r[7],U.release(r)},mi=[],En=(e=1,t=0,r=0,n=1,i=0,s=0)=>{const a=mi.pop()||new Float32Array(6);return a[0]=e,a[1]=t,a[2]=r,a[3]=n,a[4]=i,a[5]=s,a},fa=e=>{mi.push(e)},gi=[],Pn=(e=1,t=1,r=1,n=1,i=0,s=0,a=0,o=0)=>{const c=gi.pop()||new Float32Array(8);return c[0]=e,c[1]=t,c[2]=r,c[3]=n,c[4]=i,c[5]=s,c[6]=a,c[7]=o,c},da=e=>{gi.push(e)},Ee=(e,t,r,n=null)=>{const i=+e;return isNaN(i)&&n!==null?n:Math.min(Math.max(t,isNaN(i)?0:i),r)};class U{_$colorTransform;constructor(t=1,r=1,n=1,i=1,s=0,a=0,o=0,c=0){this._$colorTransform=Pn(t,r,n,i,s,a,o,c)}get rawData(){return this._$colorTransform}get alphaMultiplier(){return this._$colorTransform[3]}set alphaMultiplier(t){this._$colorTransform[3]=Ee(t,0,1,1)}get alphaOffset(){return this._$colorTransform[7]}set alphaOffset(t){this._$colorTransform[7]=Ee(t,-255,255,0)}get blueMultiplier(){return this._$colorTransform[2]}set blueMultiplier(t){this._$colorTransform[2]=Ee(t,0,1,1)}get blueOffset(){return this._$colorTransform[6]}set blueOffset(t){this._$colorTransform[6]=Ee(t,-255,255,0)}get greenMultiplier(){return this._$colorTransform[1]}set greenMultiplier(t){this._$colorTransform[1]=Ee(t,0,1,1)}get greenOffset(){return this._$colorTransform[5]}set greenOffset(t){this._$colorTransform[5]=Ee(t,-255,255,0)}get redMultiplier(){return this._$colorTransform[0]}set redMultiplier(t){this._$colorTransform[0]=Ee(t,0,1,1)}get redOffset(){return this._$colorTransform[4]}set redOffset(t){this._$colorTransform[4]=Ee(t,-255,255,0)}clone(){return new U(...this._$colorTransform)}concat(t){ha(this,t)}static multiply(t,r){return Pn(t[0]*r[0],t[1]*r[1],t[2]*r[2],t[3]*r[3],t[0]*r[4]+t[4],t[1]*r[5]+t[5],t[2]*r[6]+t[6],t[3]*r[7]+t[7])}static release(t){da(t)}}const Aa=e=>new T(e._$matrix[0],e._$matrix[1],e._$matrix[2],e._$matrix[3],e._$matrix[4],e._$matrix[5]),pa=(e,t)=>{const r=e._$matrix,n=t._$matrix;let i=r[0]*n[0],s=0,a=0,o=r[3]*n[3],c=r[4]*n[0]+n[4],u=r[5]*n[3]+n[5];(r[1]||r[2]||n[1]||n[2])&&(i+=r[1]*n[2],o+=r[2]*n[1],s+=r[0]*n[1]+r[1]*n[3],a+=r[2]*n[0]+r[3]*n[2],c+=r[5]*n[2],u+=r[4]*n[1]),r[0]=i,r[1]=s,r[2]=a,r[3]=o,r[4]=c,r[5]=u},ma=(e,t)=>{e._$matrix[0]=t._$matrix[0],e._$matrix[1]=t._$matrix[1],e._$matrix[2]=t._$matrix[2],e._$matrix[3]=t._$matrix[3],e._$matrix[4]=t._$matrix[4],e._$matrix[5]=t._$matrix[5]},ga=(e,t,r,n=0,i=0,s=0)=>{e.identity(),e.rotate(n),e.scale(t,r),e.translate(i,s)},ba=(e,t,r,n=0,i=0,s=0)=>{const a=e._$matrix;if(a[0]=t/1638.4,a[3]=r/1638.4,n){const o=Math.cos(n),c=Math.sin(n);a[1]=c*a[3],a[2]=-c*a[0],a[0]*=o,a[3]*=o}else a[1]=0,a[2]=0;a[4]=i+t/2,a[5]=s+r/2},xa=(e,t)=>new se(e.x+t.x,e.y+t.y),ya=e=>new se(e.x,e.y),$a=(e,t)=>{e.x=t.x,e.y=t.y},va=(e,t)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)),wa=(e,t)=>e.x===t.x&&e.y===t.y,Ma=(e,t,r)=>new se(e.x+(t.x-e.x)*(1-r),e.y+(t.y-e.y)*(1-r)),Ba=(e,t)=>{const r=t/e.length;e.x*=r,e.y*=r},Ta=(e,t,r)=>{e.x+=t,e.y+=r},Sa=(e,t)=>new se(e*Math.cos(t),e*Math.sin(t)),Ia=(e,t,r)=>{e.x=t,e.y=r},Ca=(e,t)=>new se(e.x-t.x,e.y-t.y);class se{x;y;constructor(t=0,r=0){this.x=t,this.y=r}get length(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))}add(t){return xa(this,t)}clone(){return ya(this)}copyFrom(t){$a(this,t)}static distance(t,r){return va(t,r)}equals(t){return wa(this,t)}static interpolate(t,r,n){return Ma(t,r,n)}normalize(t){Ba(this,t)}offset(t,r){Ta(this,t,r)}static polar(t,r){return Sa(t,r)}setTo(t,r){Ia(this,t,r)}subtract(t){return Ca(this,t)}}const Fa=(e,t)=>new se(t.x*e._$matrix[0]+t.y*e._$matrix[2],t.x*e._$matrix[1]+t.y*e._$matrix[3]),Ea=e=>{e._$matrix[0]=1,e._$matrix[1]=0,e._$matrix[2]=0,e._$matrix[3]=1,e._$matrix[4]=0,e._$matrix[5]=0},Pa=e=>{const t=e._$matrix[0],r=e._$matrix[1],n=e._$matrix[2],i=e._$matrix[3],s=e._$matrix[4],a=e._$matrix[5];if(r===0&&n===0)e._$matrix[0]=1/t,e._$matrix[1]=0,e._$matrix[2]=0,e._$matrix[3]=1/i,e._$matrix[4]=-e._$matrix[0]*s,e._$matrix[5]=-e._$matrix[3]*a;else{const o=t*i-r*n;if(o){const c=1/o;e._$matrix[0]=i*c,e._$matrix[1]=-r*c,e._$matrix[2]=-n*c,e._$matrix[3]=t*c,e._$matrix[4]=-(e._$matrix[0]*s+e._$matrix[2]*a),e._$matrix[5]=-(e._$matrix[1]*s+e._$matrix[3]*a)}}},Ra=(e,t)=>{const r=e._$matrix,n=r[0],i=r[1],s=r[2],a=r[3],o=r[4],c=r[5];r[0]=n*Math.cos(t)-i*Math.sin(t),r[1]=n*Math.sin(t)+i*Math.cos(t),r[2]=s*Math.cos(t)-a*Math.sin(t),r[3]=s*Math.sin(t)+a*Math.cos(t),r[4]=o*Math.cos(t)-c*Math.sin(t),r[5]=o*Math.sin(t)+c*Math.cos(t)},Oa=(e,t,r)=>{const n=e._$matrix;n[0]*=t,n[2]*=t,n[4]*=t,n[1]*=r,n[3]*=r,n[5]*=r},ka=(e,t,r,n,i,s,a)=>{const o=e._$matrix;o[0]=t,o[1]=r,o[2]=n,o[3]=i,o[4]=s,o[5]=a},Ua=(e,t)=>{const r=t.x,n=t.y,i=e._$matrix;return new se(r*i[0]+n*i[2]+i[4],r*i[1]+n*i[3]+i[5])},Ga=(e,t,r)=>{e.tx+=t,e.ty+=r};class T{_$matrix;constructor(t=1,r=0,n=0,i=1,s=0,a=0){this._$matrix=En(t,r,n,i,s,a)}get a(){return this._$matrix[0]}set a(t){this._$matrix[0]=t}get b(){return this._$matrix[1]}set b(t){this._$matrix[1]=t}get c(){return this._$matrix[2]}set c(t){this._$matrix[2]=t}get d(){return this._$matrix[3]}set d(t){this._$matrix[3]=t}get tx(){return this._$matrix[4]}set tx(t){this._$matrix[4]=t}get ty(){return this._$matrix[5]}set ty(t){this._$matrix[5]=t}get rawData(){return this._$matrix}clone(){return Aa(this)}concat(t){pa(this,t)}copyFrom(t){ma(this,t)}createBox(t,r,n=0,i=0,s=0){ga(this,t,r,n,i,s)}createGradientBox(t,r,n=0,i=0,s=0){ba(this,t,r,n,i,s)}deltaTransformPoint(t){return Fa(this,t)}identity(){Ea(this)}invert(){Pa(this)}rotate(t){Ra(this,t)}scale(t,r){Oa(this,t,r)}setTo(t,r,n,i,s,a){ka(this,t,r,n,i,s,a)}transformPoint(t){return Ua(this,t)}translate(t,r){Ga(this,t,r)}static multiply(t,r){const n=t[0],i=t[1],s=t[2],a=t[3],o=t[4],c=t[5],u=r[0],h=r[1],l=r[2],f=r[3],A=r[4],d=r[5];return En(n*u+s*h,i*u+a*h,n*l+s*f,i*l+a*f,n*A+s*d+o,i*A+a*d+c)}static release(t){fa(t)}}const _a=e=>new be(e.x,e.y,e.width,e.height),Da=(e,t,r)=>e.x<=t&&e.y<=r&&e.right>t&&e.bottom>r,La=(e,t)=>e.x<=t.x&&e.y<=t.y&&e.right>t.x&&e.bottom>t.y,Na=(e,t)=>e.x<=t.x&&e.y<=t.y&&e.right>=t.right&&e.bottom>=t.bottom,Ya=(e,t)=>{e.x=t.x,e.y=t.y,e.width=t.width,e.height=t.height},Wa=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Va=(e,t,r)=>{e.x-=t,e.width+=2*t,e.y-=r,e.height+=2*r},Ka=(e,t)=>{e.x-=t.x,e.width+=2*t.x,e.y-=t.y,e.height+=2*t.y},Qa=(e,t)=>{const r=Math.max(e.x,t.x),n=Math.max(e.y,t.y),i=Math.min(e.right,t.right),s=Math.min(e.bottom,t.bottom),a=i-r,o=s-n;return a>0&&o>0?new be(r,n,a,o):new be(0,0,0,0)},Xa=(e,t)=>{const r=Math.max(e.x,t.x),n=Math.max(e.y,t.y),i=Math.min(e.right,t.right),s=Math.min(e.bottom,t.bottom);return i-r>0&&s-n>0},za=e=>e.width<=0||e.height<=0,Ha=(e,t,r)=>{e.x+=t,e.y+=r},Ja=(e,t)=>{e.x+=t.x,e.y+=t.y},Za=e=>{e.x=e.y=e.width=e.height=0},qa=(e,t,r,n,i)=>{e.x=t,e.y=r,e.width=n,e.height=i},ja=(e,t)=>e.isEmpty()?t.clone():t.isEmpty()?e.clone():new be(Math.min(e.x,t.x),Math.min(e.y,t.y),Math.max(e.right-t.left,t.right-e.left),Math.max(e.bottom-t.top,t.bottom-e.top));class be{x;y;width;height;constructor(t=0,r=0,n=0,i=0){this.x=t,this.y=r,this.width=n,this.height=i}get bottom(){return this.y+this.height}set bottom(t){this.height=t-this.y}get bottomRight(){return new se(this.right,this.bottom)}set bottomRight(t){this.right=t.x,this.bottom=t.y}get left(){return this.x}set left(t){this.width=this.right-t,this.x=t}get right(){return this.x+this.width}set right(t){this.width=t-this.x}get size(){return new se(this.width,this.height)}set size(t){this.width=t.x,this.height=t.y}get top(){return this.y}set top(t){this.height=this.bottom-t,this.y=t}get topLeft(){return new se(this.x,this.y)}set topLeft(t){this.left=t.x,this.top=t.y}clone(){return _a(this)}contains(t,r){return Da(this,t,r)}containsPoint(t){return La(this,t)}containsRect(t){return Na(this,t)}copyFrom(t){Ya(this,t)}equals(t){return Wa(this,t)}inflate(t,r){Va(this,t,r)}inflatePoint(t){Ka(this,t)}intersection(t){return Qa(this,t)}intersects(t){return Xa(this,t)}isEmpty(){return za(this)}offset(t,r){Ha(this,t,r)}offsetPoint(t){Ja(this,t)}setEmpty(){Za(this)}setTo(t,r,n,i){qa(this,t,r,n,i)}union(t){return ja(this,t)}}const tr=e=>{if(e.placeObject)return e.placeObject;const t=e.placeId;if(t===-1)return null;const r=e.parent;if(!r)return null;const n=r.loaderInfo;if(!n||!n.data)return null;const i=n.data.characters[r.characterId],s=r.isTimelineEnabled?r.currentFrame:1,a=i.placeMap[s];if(!a||!(t in a))return null;const o=a[t],c=i.placeObjects[o];return c?(e.placeObject=c,c):null},bt=new se,bi=0,xi=1,eo=2,to=3,xt=new Float32Array([1,0,0,1,0,0]);let ro=0;const yi=()=>ro++,$i=[],Pr=[],vi=[],no=[],je=(e=0,t=0,r=0,n=0,i=0,s=0)=>{const a=vi.pop()||new Float32Array(6);return a[0]=e,a[1]=t,a[2]=r,a[3]=n,a[4]=i,a[5]=s,a},Ft=e=>{vi.push(e)},_t=(e=1,t=1,r=1,n=1,i=0,s=0,a=0,o=0)=>{const c=no.pop()||new Float32Array(8);return c[0]=e,c[1]=t,c[2]=r,c[3]=n,c[4]=i,c[5]=s,c[6]=a,c[7]=o,c},wi=[],io=()=>wi.pop()||new Map,so=e=>{e.clear(),wi.push(e)},z=(...e)=>{const t=$i.pop()||[];return e.length&&t.push(...e),t},oe=e=>{e.length&&(e.length=0),$i.push(e)},re=(e,t,r,n)=>{const i=Pr.length?Pr.pop():new Float32Array(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i},k=e=>{Pr.push(e)},ao=e=>{let t=null;switch(e.method.toUpperCase()){case"GET":if(e.data){const n=e.url.split("?");n[1]=n.length===1?e.data.toString():`${n[1]}&${e.data.toString()}`,e.url=n.join("?")}break;case"PUT":case"POST":e.data&&(t=e.data.toString());break}const r=new XMLHttpRequest;if(r.open(e.method,e.url,!0),r.responseType=e.format,r.withCredentials=e.withCredentials,e.event){const n=Object.keys(e.event);for(let i=0;i<n.length;++i){const s=n[i];r.addEventListener(s,e.event[s])}}for(let n=0;n<e.headers.length;++n){const i=e.headers[n];i&&r.setRequestHeader(i.name,i.value)}r.send(t)},oo=e=>{const t=z();if(e){const r=e.trim().split(`
2339
+ `);for(let n=0;n<r.length;++n){const i=r[n].split(":");t.push({name:i[0].trim(),value:i[1].trim()})}}return t},Dt=new WeakMap,we=new WeakMap,ge=new Set,co=new WeakMap,Rr=document.createElement("canvas");Rr.width=Rr.height=1;const Ie=Rr.getContext("2d"),Or=e=>Ie?(Ie.fillStyle=e,+`0x${Ie.fillStyle.slice(1)}`):0,me=(e,t,r,n=null)=>{const i=+e;return isNaN(i)&&n!==null?n:Math.min(Math.max(t,isNaN(i)?0:i),r)},kr=[],Ur=[],Ue=new Map;let Mi=null;const Bi=e=>{Mi=e},lo=()=>Mi,_=e=>{if(e.$matrix)return e.$matrix.rawData;const t=tr(e);if(!t||!t.matrix)return null;if(!t.typedMatrix){const r=t.matrix;t.typedMatrix=je(r[0],r[1],r[2],r[3],r[4],r[5])}return t.typedMatrix},uo=e=>{const t=_(e);let r=t||xt,n=e.parent;for(;n;){const i=_(n);i&&(r=T.multiply(i,r)),n=n.parent}return new T(r[0],r[1],r[2],r[3],r[4],r[5])},Ve=e=>{if(e.$colorTransform)return e.$colorTransform.rawData;const t=tr(e);if(!t||!t.colorTransform)return null;if(!t.typedColorTransform){const r=t.colorTransform;t.typedColorTransform=_t(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7])}return t.typedColorTransform},ho=e=>{if(e.$alpha!==null)return e.$alpha;if(e.$colorTransform){const r=e.$colorTransform.rawData;return r[3]+r[7]/255}const t=Ve(e);return t?t[3]+t[7]/255:1},fo=(e,t)=>{if(t=me(t,0,1),e.$alpha===t)return;e.$alpha=t;let r=e.$colorTransform;if(!r){const n=Ve(e);r=n?new U(...n):new U}r.alphaMultiplier=t,r.alphaOffset=0,e.$colorTransform=r,j(e)};class Fe{$updated;constructor(){this.$updated=!0}canApplyFilter(){return!0}getBounds(t){return t}}const F=(e,t,r,n=null)=>{const i=+e;return isNaN(i)&&n!==null?n:Math.min(Math.max(t,isNaN(i)?0:i),r)},Gr=document.createElement("canvas");Gr.width=Gr.height=1;const Sr=Gr.getContext("2d"),Oe=e=>Sr?(Sr.fillStyle=e,+`0x${Sr.fillStyle.slice(1)}`):0,cn=Math.PI/180,ln=e=>{switch(e){case"full":return 0;case"inner":return 1;case"outer":return 2;default:return 0}},Ti=e=>e.strength>0&&e.distance!==0&&e.blurX>0&&e.blurY>0&&e.quality>0,Si=e=>e.blurX>0&&e.blurY>0&&e.quality>0,Ao=[.5,1.05,1.4,1.55,1.75,1.9,2,2.15,2.2,2.3,2.5,3,3,3.5,3.5],it=(e,t)=>{if(!Si(e))return t;const r=Ao[e.quality-1],n=Math.round(e.blurX*r),i=Math.round(e.blurY*r);return t[0]-=n,t[2]+=n,t[1]-=i,t[3]+=i,t},po=(e,t)=>{if(!Ti(e)||e.type==="inner")return t;it(e,t);const r=e.angle*cn,n=e.distance,i=Math.abs(Math.cos(r)*n),s=Math.abs(Math.sin(r)*n);return t[0]-=i,t[2]+=i,t[1]-=s,t[3]+=s,t},mo=e=>[e.$filterType,e.distance,e.angle,e.highlightColor,e.highlightAlpha,e.shadowColor,e.shadowAlpha,e.blurX,e.blurY,e.strength,e.quality,e.type,e.knockout],go=e=>new Float32Array([e.$filterType,e.distance,e.angle,e.highlightColor,e.highlightAlpha,e.shadowColor,e.shadowAlpha,e.blurX,e.blurY,e.strength,e.quality,ln(e.type),+e.knockout]);class rr extends Fe{$filterType=0;_$blurX;_$blurY;_$quality;_$distance;_$angle;_$highlightColor;_$highlightAlpha;_$shadowColor;_$shadowAlpha;_$strength;_$type;_$knockout;constructor(t=4,r=45,n=16777215,i=1,s=0,a=1,o=4,c=4,u=1,h=1,l="inner",f=!1){super(),this._$distance=4,this._$angle=45,this._$highlightColor=16777215,this._$highlightAlpha=1,this._$blurX=4,this._$blurY=4,this._$quality=1,this._$shadowColor=0,this._$shadowAlpha=1,this._$strength=1,this._$type="inner",this._$knockout=!1,this.blurX=o,this.blurY=c,this.quality=h,this.distance=t,this.angle=r,this.highlightColor=n,this.highlightAlpha=i,this.shadowColor=s,this.shadowAlpha=a,this.strength=u,this.type=l,this.knockout=f}get angle(){return this._$angle}set angle(t){t=F(t%360,-360,360,45),t!==this._$angle&&(this._$angle=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=F(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=F(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get distance(){return this._$distance}set distance(t){t=F(+t,-255,255,4),t!==this._$distance&&(this._$distance=t,this.$updated=!0)}get highlightAlpha(){return this._$highlightAlpha}set highlightAlpha(t){t=F(+t,0,1,0),t!==this._$highlightAlpha&&(this._$highlightAlpha=t,this.$updated=!0)}get highlightColor(){return this._$highlightColor}set highlightColor(t){t=F(typeof t=="string"?Oe(t):t,0,16777215,16777215),t!==this._$highlightColor&&(this._$highlightColor=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=F(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get shadowAlpha(){return this._$shadowAlpha}set shadowAlpha(t){t=F(t,0,1,0),t!==this._$shadowAlpha&&(this._$shadowAlpha=t,this.$updated=!0)}get shadowColor(){return this._$shadowColor}set shadowColor(t){t=F(typeof t=="string"?Oe(t):t,0,16777215,0),t!==this._$shadowColor&&(this._$shadowColor=t,this.$updated=!0)}get strength(){return this._$strength}set strength(t){t=F(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}get type(){return this._$type}set type(t){if(t=`${t}`.toLowerCase(),t!==this._$type){switch(t){case"inner":case"outer":case"full":break;default:return}this._$type=t,this.$updated=!0}}clone(){return new rr(this._$distance,this._$angle,this._$highlightColor,this._$highlightAlpha,this._$shadowColor,this._$shadowAlpha,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$type,this._$knockout)}toArray(){return mo(this)}toNumberArray(){return go(this)}canApplyFilter(){return Ti(this)}getBounds(t){return po(this,t)}}const bo=e=>[e.$filterType,e.blurX,e.blurY,e.quality],xo=e=>new Float32Array([e.$filterType,e.blurX,e.blurY,e.quality]);class nr extends Fe{$filterType=1;_$blurX;_$blurY;_$quality;constructor(t=4,r=4,n=1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this.blurX=t,this.blurY=r,this.quality=n}get blurX(){return this._$blurX}set blurX(t){t=F(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=F(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=F(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}clone(){return new nr(this._$blurX,this._$blurY,this._$quality)}toArray(){return bo(this)}toNumberArray(){return xo(this)}canApplyFilter(){return Si(this)}getBounds(t){return it(this,t)}}const yo=e=>[e.$filterType,e.matrix],$o=e=>new Float32Array([e.$filterType,...e.matrix]);class ir extends Fe{$filterType=2;_$matrix;constructor(t=null){super(),this._$matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],t&&t.length===20&&(this.matrix=t)}get matrix(){return this._$matrix}set matrix(t){if(this._$matrix!==t&&!(!Array.isArray(t)||t.length!==20)){for(let r=0;r<20;r++)if(t[r]!==this._$matrix[r]){this.$updated=!0;break}this.$updated&&(this._$matrix=t)}}clone(){return new ir(this._$matrix)}toArray(){return yo(this)}toNumberArray(){return $o(this)}}const vo=e=>e.matrix!==null&&e.matrixX*e.matrixY===e.matrix.length,wo=e=>[e.$filterType,e.matrixX,e.matrixY,e.matrix,e.divisor,e.bias,e.preserveAlpha,e.clamp,e.color,e.alpha],Mo=e=>{const t=e.matrix||[];return new Float32Array([e.$filterType,e.matrixX,e.matrixY,...t,e.divisor,e.bias,+e.preserveAlpha,+e.clamp,e.color,e.alpha])};class sr extends Fe{$filterType=3;_$matrixX;_$matrixY;_$matrix;_$divisor;_$bias;_$preserveAlpha;_$clamp;_$color;_$alpha;constructor(t=0,r=0,n=null,i=1,s=0,a=!0,o=!0,c=0,u=0){super(),this._$matrixX=0,this._$matrixY=0,this._$matrix=null,this._$divisor=1,this._$bias=0,this._$preserveAlpha=!0,this._$clamp=!0,this._$color=0,this._$alpha=0,this.matrixX=t,this.matrixY=r,this.matrix=n,this.divisor=i,this.bias=s,this.preserveAlpha=a,this.clamp=o,this.color=c,this.alpha=u}get alpha(){return this._$alpha}set alpha(t){t=F(+t,0,1,0),t!==this._$alpha&&(this._$alpha=t,this.$updated=!0)}get bias(){return this._$bias}set bias(t){t|=0,t!==this._$bias&&(this._$bias=t,this.$updated=!0)}get clamp(){return this._$clamp}set clamp(t){t=!!t,t!==this._$clamp&&(this._$clamp=t,this.$updated=!0)}get color(){return this._$color}set color(t){t=F(typeof t=="string"?Oe(t):t,0,16777215,0),t!==this._$color&&(this._$color=t,this.$updated=!0)}get divisor(){return this._$divisor}set divisor(t){t|=0,t!==this._$divisor&&(this._$divisor=t,this.$updated=!0)}get matrix(){return this._$matrix}set matrix(t){this._$matrix!==t&&(this._$matrix=t,this.$updated=!0)}get matrixX(){return this._$matrixX}set matrixX(t){t=F(t|0,0,15,0)|0,t!==this._$matrixX&&(this._$matrixX=t,this.$updated=!0)}get matrixY(){return this._$matrixY}set matrixY(t){t=F(t|0,0,15,0)|0,t!==this._$matrixY&&(this._$matrixY=t,this.$updated=!0)}get preserveAlpha(){return this._$preserveAlpha}set preserveAlpha(t){t=!!t,t!==this._$preserveAlpha&&(this._$preserveAlpha=t,this.$updated=!0)}clone(){return new sr(this._$matrixX,this._$matrixY,this._$matrix?this._$matrix.slice():null,this._$divisor,this._$bias,this._$preserveAlpha,this._$clamp,this._$color,this._$alpha)}toArray(){return wo(this)}toNumberArray(){return Mo(this)}canApplyFilter(){return vo(this)}}const Bo=e=>e.bitmapBuffer!==null&&e.componentX>0&&e.componentY>0&&e.scaleX!==0&&e.scaleY!==0,To=e=>[e.$filterType,e.bitmapBuffer?Array.from(e.bitmapBuffer):null,e.bitmapWidth,e.bitmapHeight,e.mapPointX,e.mapPointY,e.componentX,e.componentY,e.scaleX,e.scaleY,e.mode,e.color,e.alpha],So=e=>{let t=2;switch(e.mode){case"clamp":t=0;break;case"color":t=1;break;case"wrap":t=2;break;case"ignore":t=3;break;default:t=2;break}const r=e.bitmapBuffer||new Uint8Array,n=[e.$filterType,r.length];for(let i=0;i<r.length;i+=4096)n.push(...r.subarray(i,i+4096));return n.push(e.bitmapWidth,e.bitmapHeight,e.mapPointX,e.mapPointY,e.componentX,e.componentY,e.scaleX,e.scaleY,t,e.color,e.alpha),new Float32Array(n)};class ar extends Fe{$filterType=4;_$bitmapBuffer;_$bitmapWidth;_$bitmapHeight;_$mapPointX;_$mapPointY;_$componentX;_$componentY;_$scaleX;_$scaleY;_$mode;_$color;_$alpha;constructor(t=null,r=0,n=0,i=0,s=0,a=0,o=0,c=0,u=0,h="wrap",l=0,f=0){super(),this._$bitmapBuffer=null,this._$bitmapWidth=0,this._$bitmapHeight=0,this._$mapPointX=0,this._$mapPointY=0,this._$componentX=0,this._$componentY=0,this._$scaleX=0,this._$scaleY=0,this._$mode="wrap",this._$color=0,this._$alpha=0,this.bitmapBuffer=t,this.bitmapWidth=r,this.bitmapHeight=n,this.mapPointX=i,this.mapPointY=s,this.componentX=a,this.componentY=o,this.scaleX=c,this.scaleY=u,this.mode=h,this.color=l,this.alpha=f}get alpha(){return this._$alpha}set alpha(t){t=F(+t,0,1,0),t!==this._$alpha&&(this._$alpha=t,this.$updated=!0)}get color(){return this._$color}set color(t){t=F(typeof t=="string"?Oe(t):t,0,16777215,0),t!==this._$color&&(this._$color=t,this.$updated=!0)}get componentX(){return this._$componentX}set componentX(t){t!==this._$componentX&&(this._$componentX=t,this.$updated=!0)}get componentY(){return this._$componentY}set componentY(t){t!==this._$componentY&&(this._$componentY=t,this.$updated=!0)}get bitmapBuffer(){return this._$bitmapBuffer}set bitmapBuffer(t){t!==this._$bitmapBuffer&&(this._$bitmapBuffer=t,this.$updated=!0)}get bitmapWidth(){return this._$bitmapWidth}set bitmapWidth(t){t!==this._$bitmapWidth&&(this._$bitmapWidth=t,this.$updated=!0)}get bitmapHeight(){return this._$bitmapHeight}set bitmapHeight(t){t!==this._$bitmapHeight&&(this._$bitmapHeight=t,this.$updated=!0)}get mapPointX(){return this._$mapPointX}set mapPointX(t){t!==this._$mapPointX&&(this._$mapPointX=t,this.$updated=!0)}get mapPointY(){return this._$mapPointY}set mapPointY(t){t!==this._$mapPointY&&(this._$mapPointY=t,this.$updated=!0)}get mode(){return this._$mode}set mode(t){t!==this._$mode&&(this._$mode=t,this.$updated=!0)}get scaleX(){return this._$scaleX}set scaleX(t){t=F(+t,-65535,65535,0),t!==this._$scaleX&&(this._$scaleX=t,this.$updated=!0)}get scaleY(){return this._$scaleY}set scaleY(t){t=F(+t,-65535,65535,0),t!==this._$scaleY&&(this._$scaleY=t,this.$updated=!0)}clone(){return new ar(this._$bitmapBuffer?this._$bitmapBuffer.slice():null,this._$bitmapWidth,this._$bitmapHeight,this._$mapPointX,this._$mapPointX,this._$componentX,this._$componentY,this._$scaleX,this._$scaleY,this._$mode,this._$color,this._$alpha)}toArray(){return To(this)}toNumberArray(){return So(this)}canApplyFilter(){return Bo(this)}}const Io=e=>[e.$filterType,e.distance,e.angle,e.color,e.alpha,e.blurX,e.blurY,e.strength,e.quality,e.inner,e.knockout,e.hideObject],Co=e=>new Float32Array([e.$filterType,e.distance,e.angle,e.color,e.alpha,e.blurX,e.blurY,e.strength,e.quality,+e.inner,+e.knockout,+e.hideObject]),Ii=e=>e.alpha>0&&e.strength!==0&&e.blurX>0&&e.blurY>0&&e.quality>0,Fo=(e,t)=>{if(!Ii(e)||e.inner)return t;it(e,t);const r=e.angle*cn,n=e.distance,i=Math.cos(r)*n,s=Math.sin(r)*n;return t[0]=Math.min(t[0],i),i>0&&(t[2]+=i),t[1]=Math.min(t[1],s),s>0&&(t[3]+=s),t};class or extends Fe{$filterType=5;_$blurX;_$blurY;_$quality;_$distance;_$angle;_$color;_$alpha;_$strength;_$inner;_$knockout;_$hideObject;constructor(t=4,r=45,n=0,i=1,s=4,a=4,o=1,c=1,u=!1,h=!1,l=!1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this._$distance=4,this._$angle=45,this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this._$hideObject=!1,this.blurX=s,this.blurY=a,this.quality=c,this.distance=t,this.angle=r,this.color=n,this.alpha=i,this.strength=o,this.inner=u,this.knockout=h,this.hideObject=l}get alpha(){return this._$alpha}set alpha(t){t=F(+t,0,1,0),t!==this._$alpha&&(this._$alpha=t,this.$updated=!0)}get angle(){return this._$angle}set angle(t){t=F(t%360,-360,360,45),t!==this._$angle&&(this._$angle=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=F(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=F(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get color(){return this._$color}set color(t){t=F(typeof t=="string"?Oe(t):t,0,16777215,0),t!==this._$color&&(this._$color=t,this.$updated=!0)}get distance(){return this._$distance}set distance(t){t=F(+t,-255,255,4),t!==this._$distance&&(this._$distance=t,this.$updated=!0)}get hideObject(){return this._$hideObject}set hideObject(t){t=!!t,t!==this._$hideObject&&(this._$hideObject=t,this.$updated=!0)}get inner(){return this._$inner}set inner(t){t=!!t,t!==this._$inner&&(this._$inner=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=F(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get strength(){return this._$strength}set strength(t){t=F(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}clone(){return new or(this._$distance,this._$angle,this._$color,this._$alpha,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$inner,this._$knockout,this._$hideObject)}toArray(){return Io(this)}toNumberArray(){return Co(this)}canApplyFilter(){return Ii(this)}getBounds(t){return Fo(this,t)}}const Eo=e=>[e.$filterType,e.color,e.alpha,e.blurX,e.blurY,e.strength,e.quality,e.inner,e.knockout],Po=e=>new Float32Array([e.$filterType,e.color,e.alpha,e.blurX,e.blurY,e.strength,e.quality,+e.inner,+e.knockout]),Ci=e=>e.alpha>0&&e.strength!==0&&e.blurX>0&&e.blurY>0&&e.quality>0,Ro=(e,t)=>!Ci(e)||e.inner?t:it(e,t);class cr extends Fe{$filterType=6;_$blurX;_$blurY;_$quality;_$color;_$alpha;_$strength;_$inner;_$knockout;constructor(t=0,r=1,n=4,i=4,s=1,a=1,o=!1,c=!1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this._$color=0,this._$alpha=1,this._$strength=1,this._$inner=!1,this._$knockout=!1,this.blurX=n,this.blurY=i,this.quality=a,this.color=t,this.alpha=r,this.strength=s,this.inner=o,this.knockout=c}get alpha(){return this._$alpha}set alpha(t){t=F(+t,0,1,0),t!==this._$alpha&&(this._$alpha=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=F(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=F(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get color(){return this._$color}set color(t){t=F(typeof t=="string"?Oe(t):t,0,16777215,4),t!==this._$color&&(this._$color=t,this.$updated=!0)}get inner(){return this._$inner}set inner(t){t=!!t,t!==this._$inner&&(this._$inner=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=F(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get strength(){return this._$strength}set strength(t){t=F(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}clone(){return new cr(this._$color,this._$alpha,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$inner,this._$knockout)}toArray(){return Eo(this)}toNumberArray(){return Po(this)}canApplyFilter(){return Ci(this)}getBounds(t){return Ro(this,t)}}const Fi=e=>e.strength>0&&e.distance>0&&e.alphas!==null&&e.ratios!==null&&e.colors!==null&&e.blurX>0&&e.blurY>0&&e.quality>0,Oo=e=>[e.$filterType,e.distance,e.angle,e.colors,e.alphas,e.ratios,e.blurX,e.blurY,e.strength,e.quality,e.type,e.knockout],ko=e=>{const t=e.colors?e.colors:[],r=e.alphas?e.alphas:[],n=e.ratios?e.ratios:[];return new Float32Array([e.$filterType,e.distance,e.angle,t.length,...t,r.length,...r,n.length,...n,e.blurX,e.blurY,e.strength,e.quality,ln(e.type),+e.knockout])},Uo=(e,t)=>{if(!Fi(e)||e.type==="inner")return t;it(e,t);const r=e.angle*cn,n=e.distance,i=Math.abs(Math.cos(r)*n),s=Math.abs(Math.sin(r)*n);return t[0]-=i,t[2]+=i,t[1]-=s,t[3]+=s,t};class lr extends Fe{$filterType=7;_$blurX;_$blurY;_$quality;_$distance;_$angle;_$colors;_$alphas;_$ratios;_$strength;_$type;_$knockout;constructor(t=4,r=45,n=null,i=null,s=null,a=4,o=4,c=1,u=1,h="inner",l=!1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="inner",this._$knockout=!1,this.blurX=a,this.blurY=o,this.quality=u,this.distance=t,this.angle=r,this.colors=n,this.alphas=i,this.ratios=s,this.strength=c,this.type=h,this.knockout=l}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(Array.isArray(t))for(let r=0;r<t.length;++r){const n=t[r];t[r]=F(+n,0,1,0)}this._$alphas=t,this.$updated=!0}}get angle(){return this._$angle}set angle(t){t=F(t%360,-360,360,45),t!==this._$angle&&(this._$angle=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=F(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=F(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(Array.isArray(t))for(let r=0;r<t.length;++r){const n=t[r];t[r]=F(typeof n=="string"?Oe(n):n,0,16777215,0)}this._$colors=t,this.$updated=!0}}get distance(){return this._$distance}set distance(t){t=F(+t,-255,255,4),t!==this._$distance&&(this._$distance=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=F(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(Array.isArray(t))for(let r=0;r<t.length;++r){const n=t[r];t[r]=F(+n,0,255,0)}this._$ratios=t,this.$updated=!0}}get strength(){return this._$strength}set strength(t){t=F(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this.$updated=!0)}clone(){return new lr(this._$distance,this._$angle,this._$colors?this._$colors.slice():null,this._$alphas?this._$alphas.slice():null,this._$ratios?this._$ratios.slice():null,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$type,this._$knockout)}toArray(){return Oo(this)}toNumberArray(){return ko(this)}canApplyFilter(){return Fi(this)}getBounds(t){return Uo(this,t)}}const Go=e=>[e.$filterType,e.distance,e.angle,e.colors,e.alphas,e.ratios,e.blurX,e.blurY,e.strength,e.quality,e.type,e.knockout],Ei=e=>e.strength>0&&e.distance>0&&e.alphas!==null&&e.ratios!==null&&e.colors!==null&&e.blurX>0&&e.blurY>0&&e.quality>0,_o=e=>{const t=e.colors?e.colors:[],r=e.alphas?e.alphas:[],n=e.ratios?e.ratios:[];return new Float32Array([e.$filterType,e.distance,e.angle,t.length,...t,r.length,...r,n.length,...n,e.blurX,e.blurY,e.strength,e.quality,ln(e.type),+e.knockout])},Do=(e,t)=>!Ei(e)||e.type==="inner"?t:it(e,t);class ur extends Fe{$filterType=8;_$blurX;_$blurY;_$quality;_$distance;_$angle;_$colors;_$alphas;_$ratios;_$strength;_$type;_$knockout;constructor(t=4,r=45,n=null,i=null,s=null,a=4,o=4,c=1,u=1,h="outer",l=!1){super(),this._$blurX=4,this._$blurY=4,this._$quality=1,this._$distance=4,this._$angle=45,this._$colors=null,this._$alphas=null,this._$ratios=null,this._$strength=1,this._$type="outer",this._$knockout=!1,this.blurX=a,this.blurY=o,this.quality=u,this.distance=t,this.angle=r,this.colors=n,this.alphas=i,this.ratios=s,this.strength=c,this.type=h,this.knockout=l}get alphas(){return this._$alphas}set alphas(t){if(t!==this._$alphas){if(Array.isArray(t))for(let r=0;r<t.length;++r){const n=t[r];t[r]=F(+n,0,1,0)}this._$alphas=t,this.$updated=!0}}get angle(){return this._$angle}set angle(t){t=F(t%360,-360,360,45),t!==this._$angle&&(this._$angle=t,this.$updated=!0)}get blurX(){return this._$blurX}set blurX(t){t=F(+t,0,255,0),t!==this._$blurX&&(this._$blurX=t,this.$updated=!0)}get blurY(){return this._$blurY}set blurY(t){t=F(+t,0,255,0),t!==this._$blurY&&(this._$blurY=t,this.$updated=!0)}get colors(){return this._$colors}set colors(t){if(this._$colors!==t){if(Array.isArray(t))for(let r=0;r<t.length;++r){const n=t[r];t[r]=F(typeof n=="string"?Oe(n):n,0,16777215,0)}this._$colors=t,this.$updated=!0}}get distance(){return this._$distance}set distance(t){t=F(+t,-255,255,4),t!==this._$distance&&(this._$distance=t,this.$updated=!0)}get knockout(){return this._$knockout}set knockout(t){t=!!t,t!==this._$knockout&&(this._$knockout=t,this.$updated=!0)}get quality(){return this._$quality}set quality(t){t=F(t|0,0,15,1),t!==this._$quality&&(this._$quality=t,this.$updated=!0)}get ratios(){return this._$ratios}set ratios(t){if(this._$ratios!==t){if(Array.isArray(t))for(let r=0;r<t.length;++r)t[r]=F(+t[r],0,255,0);this._$ratios=t,this.$updated=!0}}get strength(){return this._$strength}set strength(t){t=F(t|0,0,255,0),t!==this._$strength&&(this._$strength=t,this.$updated=!0)}get type(){return this._$type}set type(t){t!==this._$type&&(this._$type=t,this.$updated=!0)}clone(){return new ur(this._$distance,this._$angle,this._$colors,this._$alphas,this._$ratios,this._$blurX,this._$blurY,this._$strength,this._$quality,this._$type,this._$knockout)}toArray(){return Go(this)}toNumberArray(){return _o(this)}canApplyFilter(){return Ei(this)}getBounds(t){return Do(this,t)}}const Lo=e=>{const t=z();for(let r=0;r<e.length;++r){const n=e[r];if(n)switch(n.params[0]===null&&n.params.shift(),n.class){case"BevelFilter":t.push(new rr(...n.params));break;case"BlurFilter":t.push(new nr(...n.params));break;case"ColorMatrixFilter":t.push(new ir(...n.params));break;case"ConvolutionFilter":t.push(new sr(...n.params));break;case"DisplacementMapFilter":t.push(new ar(...n.params));break;case"DropShadowFilter":t.push(new or(...n.params));break;case"GlowFilter":t.push(new cr(...n.params));break;case"GradientBevelFilter":t.push(new lr(...n.params));break;case"GradientGlowFilter":t.push(new ur(...n.params));break}}return t},No=e=>{if(e.$filters)return e.$filters;const t=tr(e);return t&&t.surfaceFilterList?(t.filters||(t.filters=Lo(t.surfaceFilterList)),t.filters):null},Yo=(e,t)=>{e.$filters=t,j(e)},Wo=e=>{if(e.$blendMode)return e.$blendMode;const t=tr(e);return t&&t.blendMode?t.blendMode:"normal"},Vo=(e,t)=>{e.$blendMode!==t&&(e.$blendMode=t,j(e))},Ko=180/Math.PI,Qo=e=>{const t=e.$matrix?e.$matrix.rawData:_(e);return t?Math.atan2(t[1],t[0])*Ko:0},Xo=Math.PI/180,zo=(e,t)=>{if(t=me(t%360,-360,360,0),e.$rotation===t)return;let r=e.$matrix;if(!r){const s=_(e);e.$matrix=r=s?new T(...s):new T}const n=Math.sqrt(r.a*r.a+r.b*r.b),i=Math.sqrt(r.c*r.c+r.d*r.d);if(t===0)r.a=n,r.b=0,r.c=0,r.d=i;else{let s=Math.atan2(r.b,r.a),a=Math.atan2(-r.c,r.d);const o=t*Xo;a=a+o-s,s=o,r.b=n*Math.sin(s),r.b===1||r.b===-1?r.a=0:r.a=n*Math.cos(s),r.c=-i*Math.sin(a),r.c===1||r.c===-1?r.d=0:r.d=i*Math.cos(a)}e.$scaleX=null,e.$scaleY=null,e.$rotation=t,j(e)},Ho=e=>{const t=e.$matrix?e.$matrix.rawData:_(e);if(!t)return 1;const n=(Math.abs(t[0])>=1e-12?Math.sign(t[0]):Math.sign(t[1]))||1,i=Math.hypot(t[0],t[1]);return Math.round(i*n*1e4)/1e4},Pi=(e,t)=>{t=me(t,-Number.MAX_VALUE,Number.MAX_VALUE,1);const r=Math.round(t*1e4)/1e4;if(e.$scaleX===r)return;let n=e.$matrix;if(!n){const i=_(e);e.$matrix=n=i?new T(...i):new T}if(n.b===0||isNaN(n.b))n.a=r;else{const s=Math.atan2(n.b,n.a),a=Math.hypot(n.a,n.b),o=(Math.abs(n.a)>=1e-12?Math.sign(n.a):Math.sign(n.b))||1,h=(a*o>=0?s:s-Math.PI)+(r<0?Math.PI:0),l=Math.abs(r);n.a=l*Math.cos(h),n.b=l*Math.sin(h)}e.$scaleX=r,e.$rotation=null,j(e)},Jo=e=>{const t=e.$matrix?e.$matrix.rawData:_(e);if(!t)return 1;const r=1e-12,n=Math.hypot(t[0],t[1]),i=(Math.abs(t[0])>=r?Math.sign(t[0]):Math.sign(t[1]))||1;return Math.round((t[0]*t[3]-t[1]*t[2])/(n*i)*1e4)/1e4},Ri=(e,t)=>{t=me(t,-Number.MAX_VALUE,Number.MAX_VALUE,1);const r=Math.round(t*1e4)/1e4;if(e.$scaleY===r)return;let n=e.$matrix;if(!n){const i=_(e);e.$matrix=n=i?new T(...i):new T}if(n.c===0||isNaN(n.c))n.d=r;else{const i=Math.max(0,Math.abs(r)),s=1e-12;let a=Math.atan2(n.b,n.a);(n.a<0||Math.abs(n.a)<s&&n.b<0)&&(a-=Math.PI),a<=-Math.PI&&(a+=2*Math.PI),a>Math.PI&&(a-=2*Math.PI);const o=a+(r<0?Math.PI:0);n.c=-i*Math.sin(o),n.d=i*Math.cos(o)}e.$scaleY=r,e.$rotation=null,j(e)},Zo=e=>{const t=e.$matrix?e.$matrix.rawData:_(e);return t?t[4]:0},qo=(e,t)=>{let r=e.$matrix;if(!r){const n=_(e);e.$matrix=r=n?new T(...n):new T}e.$x!==t&&(e.$x=r.tx=t,j(e))},jo=e=>{const t=e.$matrix?e.$matrix.rawData:_(e);return t?t[5]:0},ec=(e,t)=>{let r=e.$matrix;if(!r){const n=_(e);e.$matrix=r=n?new T(...n):new T}e.$y!==t&&(e.$y=r.ty=t,j(e))},he=(e,t,r,n,i)=>{const s=i[0],a=i[1],o=i[2],c=i[3],u=i[4],h=i[5],l=r*s+n*o+u,f=r*s+t*o+u,A=e*s+n*o+u,d=e*s+t*o+u,y=r*a+n*c+h,g=r*a+t*c+h,p=e*a+n*c+h,$=e*a+t*c+h;return re(Math.min(l,f,A,d),Math.min(y,g,p,$),Math.max(l,f,A,d),Math.max(y,g,p,$))},Oi=e=>{const t=e.graphics;return re(t.xMin,t.yMin,t.xMax,t.yMax)},wt=(e,t=null)=>{const r=Oi(e),n=_(e);if(!n){if(t){const s=he(r[0],r[1],r[2],r[3],t);return k(r),s}return r}const i=he(r[0],r[1],r[2],r[3],t?T.multiply(t,n):n);return k(r),i},ki=e=>re(0,0,e.videoWidth,e.videoHeight),Mt=(e,t=null)=>{const r=ki(e),n=_(e);if(!n){if(t){const s=he(r[0],r[1],r[2],r[3],t);return k(r),s}return r}const i=he(r[0],r[1],r[2],r[3],t?T.multiply(t,n):n);return k(r),i},Ui=e=>re(e.xMin,e.yMin,e.xMax,e.yMax),Bt=(e,t=null)=>{const r=Ui(e),n=_(e);if(!n){if(t){const s=he(r[0],r[1],r[2],r[3],t);return k(r),s}return r}const i=he(r[0],r[1],r[2],r[3],t?T.multiply(t,n):n);return k(r),i},yt=(e,t=null)=>{const r=e.children;if(!r.length)return re(0,0,0,0);const n=_(e),i=n?t?T.multiply(t,n):n:t,s=Number.MAX_VALUE;let a=s,o=-s,c=s,u=-s;for(let h=0;h<r.length;h++){const l=r[h];if(!l.visible)continue;let f=null;switch(!0){case l.isContainerEnabled:f=yt(l,i);break;case l.isShape:f=wt(l,i);break;case l.isText:f=Bt(l,i);break;case l.isVideo:f=Mt(l,i);break}f&&(a=Math.min(a,f[0]),c=Math.min(c,f[1]),o=Math.max(o,f[2]),u=Math.max(u,f[3]),k(f))}return re(a,c,o,u)},Gi=e=>{switch(!0){case e.isContainerEnabled:return yt(e);case e.isShape:return wt(e);case e.isText:return Bt(e);case e.isVideo:return Mt(e);default:return re(0,0,0,0)}},tc=e=>{const t=Gi(e),r=Math.abs(t[2]-t[0]);switch(k(t),!0){case r===0:case r===1/0:case r===-1/0:return 0;default:return Math.round(r*100)/100}},_i=(e,t=null)=>{const r=e.children;if(!r.length)return re(0,0,0,0);const n=_(e);let i=t;n&&(i=t?T.multiply(t,n):n);const s=Number.MAX_VALUE;let a=s,o=-s,c=s,u=-s;for(let h=0;h<r.length;h++){const l=r[h];if(!l.visible)continue;let f=null;switch(!0){case l.isContainerEnabled:f=_i(l,i);break;case l.isShape:f=wt(l,i);break;case l.isText:f=Bt(l,i);break;case l.isVideo:f=Mt(l,i);break}f&&(a=Math.min(a,f[0]),c=Math.min(c,f[1]),o=Math.max(o,f[2]),u=Math.max(u,f[3]),k(f))}return re(a,c,o,u)},tt=e=>{switch(!0){case e.isContainerEnabled:return _i(e);case e.isShape:return Oi(e);case e.isText:return Ui(e);case e.isVideo:return ki(e);default:return re(0,0,0,0)}},rc=(e,t)=>{if(t=+t,isNaN(t)||0>t)return;const r=tt(e);let n=Math.abs(r[2]-r[0]);switch(!0){case n===0:case n===1/0:case n===-1/0:return;default:n=Math.round(n*100)/100;break}Pi(e,t/n)},nc=(e,t)=>{const r=e.concatenatedMatrix,n=new se(t.x*r.a+t.y*r.c+r.tx,t.x*r.b+t.y*r.d+r.ty);return T.release(r.rawData),n},ic=(e,t)=>{const r=e.concatenatedMatrix;r.invert();const n=new se(t.x*r.a+t.y*r.c+r.tx,t.x*r.b+t.y*r.d+r.ty);return T.release(r.rawData),n},sc=e=>{const t=Gi(e),r=Math.abs(t[3]-t[1]);switch(k(t),!0){case r===0:case r===1/0:case r===-1/0:return 0;default:return Math.round(r*100)/100}},ac=(e,t)=>{if(t=+t,isNaN(t)||0>t)return;const r=tt(e);let n=Math.abs(r[3]-r[1]);switch(!0){case n===0:case n===1/0:case n===-1/0:return;default:n=Math.round(n*100)/100;break}Ri(e,t/n)},oc=e=>{const t=e.parent;t&&t.removeChild(e)},cc=(e,t=null)=>{const r=e.concatenatedMatrix,n=tt(e),i=he(n[0],n[1],n[2],n[3],r.rawData);if(k(n),T.release(r.rawData),!t){const c=new be(i[0],i[1],Math.abs(i[2]-i[0]),Math.abs(i[3]-i[1]));return k(i),c}const s=t.concatenatedMatrix;s.invert();const a=he(i[0],i[1],i[2],i[3],s.rawData);k(i),T.release(s.rawData);const o=new be(a[0],a[1],Math.abs(a[2]-a[0]),Math.abs(a[3]-a[1]));return k(a),o},lc=(e,t)=>{const r=tt(e),n=e.concatenatedMatrix,i=he(r[0],r[1],r[2],r[3],n.rawData);k(r),T.release(n.rawData);const s=tt(t),a=t.concatenatedMatrix,o=he(s[0],s[1],s[2],s[3],a.rawData);k(s),T.release(a.rawData);const c=Math.max(i[0],o[0]),u=Math.max(i[1],o[1]),h=Math.min(i[2],o[2]),l=Math.min(i[3],o[3]);return k(i),k(o),h-c>=0&&l-u>=0};class Xt{_$bitmapData;_$matrix;_$repeat;_$smooth;constructor(t,r=null,n=!0,i=!1){this._$bitmapData=t,this._$matrix=r,this._$repeat=n,this._$smooth=i}clone(){return new Xt(this._$bitmapData.clone(),this._$matrix?this._$matrix.clone():null,this._$repeat,this._$smooth)}toArray(){return z(this._$bitmapData,this._$matrix,this._$repeat,this._$smooth)}}class zt{_$type;_$colors;_$alphas;_$ratios;_$matrix;_$spreadMethod;_$interpolationMethod;_$focalPointRatio;_$colorStops;constructor(t,r,n,i,s=null,a="pad",o="rgb",c=0){this._$type=t,this._$colors=r,this._$alphas=n,this._$ratios=i,this._$matrix=s,this._$spreadMethod=a,this._$interpolationMethod=o,this._$focalPointRatio=c,this._$colorStops=z()}get colorStops(){if(!this._$colorStops.length){const t=Math.min(Math.min(this._$alphas.length,this._$colors.length),this._$ratios.length);for(let r=0;r<t;++r){const n=this._$colors[r],i=typeof n=="string"?Or(n):n;this._$colorStops[r]={ratio:this._$ratios[r]/255,R:i>>>16&255,G:i>>>8&255,B:i&255,A:this._$alphas[r]*255&255}}}return this._$colorStops}toArray(){return z(this._$type,this.colorStops,this._$matrix?this._$matrix.rawData:xt,this._$spreadMethod,this._$interpolationMethod,this._$focalPointRatio)}clone(){return new zt(this._$type,this._$colors.slice(),this._$alphas.slice(),this._$ratios.slice(),this._$matrix?this._$matrix.clone():null,this._$spreadMethod,this._$interpolationMethod,this._$focalPointRatio)}}const uc=(e,t=0,r=0)=>{e.xMin=Math.min(e.xMin,t),e.xMax=Math.max(e.xMax,t),e.yMin=Math.min(e.yMin,r),e.yMax=Math.max(e.yMax,r)},Rn=(e,t=0,r=0,n=0,i=0,s=0,a="none")=>{e.xMin=Math.min(e.xMin,Math.min(t,n)),e.xMax=Math.max(e.xMax,Math.max(t,n)),e.yMin=Math.min(e.yMin,Math.min(r,i)),e.yMax=Math.max(e.yMax,Math.max(r,i));const o=n-t,c=i-r,u=Math.sqrt(o*o+c*c);if(!u)return;const h=o/u,l=c/u,f=-l,A=h,d=s/2,y=Math.min(t+f*d,t-f*d,n+f*d,n-f*d),g=Math.max(t+f*d,t-f*d,n+f*d,n-f*d),p=Math.min(r+A*d,r-A*d,i+A*d,i-A*d),$=Math.max(r+A*d,r-A*d,i+A*d,i-A*d);if(e.xMin=Math.min(e.xMin,y),e.xMax=Math.max(e.xMax,g),e.yMin=Math.min(e.yMin,p),e.yMax=Math.max(e.yMax,$),a==="round"||a==="square"){const w=t+d*-h,I=r+d*-l,P=Math.min(w+d*h+d*f,w-d*h+d*f,w+d*h-d*f,w-d*h-d*f),W=Math.max(w+d*h+d*f,w-d*h+d*f,w+d*h-d*f,w-d*h-d*f),C=Math.min(I+d*l+d*A,I+d*l-d*A,I-d*l-d*A,I-d*l+d*A),R=Math.max(I+d*l+d*A,I+d*l-d*A,I-d*l-d*A,I-d*l+d*A);e.xMin=Math.min(e.xMin,P),e.xMax=Math.max(e.xMax,W),e.yMin=Math.min(e.yMin,C),e.yMax=Math.max(e.yMax,R)}},ot=(e,t,r=0,n=0,i=0,s="none",...a)=>{for(let o=0;o<a.length;){const c=a[o++],u=a[o++];uc(e,c,u),t&&(Rn(e,c,u,r,n,i,s),Rn(e,r,n,c,u,i,s))}},ct=(e,t,r,n,i,...s)=>{e.isConfirmed=!1,t&&n&&n.push(...s),r&&i&&i.push(...s)},hc=(e,t,r,n,i)=>{t=+t||0,r=+r||0,n=+n||0,i=+i||0,n=Math.round(n),i=Math.round(i);const s=n/2,a=i/2,o=t+s,c=r+a,u=t+n,h=r+i,l=4/3*(Math.SQRT2-1),f=l*s,A=l*a;return e.moveTo(o,r).cubicCurveTo(o+f,r,u,c-A,u,c).cubicCurveTo(u,c+A,o+f,h,o,h).cubicCurveTo(o-f,h,t,c+A,t,c).cubicCurveTo(t,c-A,o-f,r,o,r)},fc=(e,t,r,n,i)=>{t=+t||0,r=+r||0,n=+n||0,i=+i||0;const s=Math.round(t+n),a=Math.round(r+i);return e.moveTo(t,r).lineTo(t,a).lineTo(s,a).lineTo(s,r).lineTo(t,r)},dc=(e,t,r,n,i,s,a=NaN)=>{t=+t||0,r=+r||0,n=+n||0,i=+i||0,s=+s||0,a=+a||s,n=Math.round(n),i=Math.round(i),s=Math.round(s),a=Math.round(a);const o=s/2,c=a/2,u=4/3*(Math.SQRT2-1),h=u*o,l=u*c,f=t+o,A=t+n,d=A-o,y=r+c,g=r+i,p=g-c;return e.moveTo(f,r).lineTo(d,r).cubicCurveTo(d+h,r,A,y-l,A,y).lineTo(A,p).cubicCurveTo(A,p+l,d+h,g,d,g).lineTo(f,g).cubicCurveTo(f-h,g,t,p+l,t,p).lineTo(t,y).cubicCurveTo(t,y-l,f-h,r,f,r)},Lt=e=>{if(!e)return[];const t=z();for(let r=0;r<e.length;){const n=e[r++];switch(t.push(n),n){case M.BEGIN_PATH:case M.END_FILL:case M.END_STROKE:case M.CLOSE_PATH:break;case M.MOVE_TO:case M.LINE_TO:t.push(e[r++],e[r++]);break;case M.CURVE_TO:case M.FILL_STYLE:t.push(e[r++],e[r++],e[r++],e[r++]);break;case M.CUBIC:t.push(e[r++],e[r++],e[r++],e[r++],e[r++],e[r++]);break;case M.STROKE_STYLE:{switch(t.push(e[r++]),e[r++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2);break;default:t.push(0);break}switch(e[r++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2);break;default:t.push(2);break}t.push(e[r++],e[r++],e[r++],e[r++],e[r++])}break;case M.ARC:t.push(e[r++],e[r++],e[r++]);break;case M.GRADIENT_FILL:{const i=e[r++],s=e[r++],a=e[r++],o=e[r++],c=e[r++],u=e[r++];t.push(i==="linear"?0:1),t.push(s.length);const h=s.sort((l,f)=>l.ratio-f.ratio);for(let l=0;l<h.length;++l){const f=h[l];t.push(f.ratio,f.R,f.G,f.B,f.A)}switch(t.push(...a),o){case"reflect":t.push(0);break;case"repeat":t.push(1);break;default:t.push(2);break}t.push(c==="linearRGB"?0:1),t.push(u)}break;case M.GRADIENT_STROKE:{switch(t.push(e[r++]),e[r++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2);break;default:t.push(0);break}switch(e[r++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2);break;default:t.push(2);break}t.push(e[r++]);const a=e[r++],o=e[r++],c=e[r++],u=e[r++],h=e[r++],l=e[r++];t.push(a==="linear"?0:1),t.push(o.length);for(let f=0;f<o.length;++f){const A=o[f];t.push(A.ratio,A.R,A.G,A.B,A.A)}switch(t.push(...c),u){case"reflect":t.push(0);break;case"repeat":t.push(1);break;default:t.push(2);break}t.push(h==="linearRGB"?0:1),t.push(l)}break;case M.BITMAP_FILL:{const i=e[r++],s=i.buffer;if(!s){r+=3;break}t.push(i.width,i.height,s.length);for(let u=0;u<s.length;u+=4096)t.push(...s.subarray(u,u+4096));const a=e[r++];a?t.push(...a.rawData):t.push(1,0,0,1,0,0);const o=e[r++];t.push(o?1:0);const c=e[r++];t.push(c?1:0)}break;case M.BITMAP_STROKE:{switch(t.push(e[r++]),e[r++]){case"none":t.push(0);break;case"round":t.push(1);break;case"square":t.push(2);break;default:t.push(0);break}switch(e[r++]){case"bevel":t.push(0);break;case"miter":t.push(1);break;case"round":t.push(2);break;default:t.push(2);break}t.push(e[r++]);const a=e[r++],o=a.buffer;if(!o){r+=3;break}t.push(a.width,a.height,o.length);for(let l=0;l<o.length;l+=4096)t.push(...o.subarray(l,l+4096));const c=e[r++];c?t.push(...c.rawData):t.push(1,0,0,1,0,0);const u=e[r++];t.push(u?1:0);const h=e[r++];t.push(h?1:0)}break}}return t};class M{isConfirmed;xMin;yMin;xMax;yMax;$recodes;_$buffer;_$maxAlpha;_$isBeginning;_$positionX;_$positionY;_$hasFillEnabled;_$fillType;_$fillColor;_$fillGradient;_$fillBitmap;_$fills;_$hasLineEnabled;_$lineType;_$lineColor;_$lineGradient;_$joints;_$miterLimit;_$caps;_$lineWidth;_$lines;constructor(){this.isConfirmed=!1,this.xMin=Number.MAX_VALUE,this.yMin=Number.MAX_VALUE,this.xMax=-Number.MAX_VALUE,this.yMax=-Number.MAX_VALUE,this.$recodes=null,this._$buffer=null,this._$positionX=0,this._$positionY=0,this._$maxAlpha=0,this._$isBeginning=!1,this._$fills=null,this._$hasFillEnabled=!1,this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillColor=0,this._$caps="none",this._$lineWidth=1,this._$lines=null,this._$hasLineEnabled=!1,this._$lineType=0,this._$lineGradient=null,this._$joints="round",this._$miterLimit=0,this._$lineColor=0}static get MOVE_TO(){return 0}static get CURVE_TO(){return 1}static get LINE_TO(){return 2}static get CUBIC(){return 3}static get ARC(){return 4}static get FILL_STYLE(){return 5}static get STROKE_STYLE(){return 6}static get END_FILL(){return 7}static get END_STROKE(){return 8}static get BEGIN_PATH(){return 9}static get GRADIENT_FILL(){return 10}static get GRADIENT_STROKE(){return 11}static get CLOSE_PATH(){return 12}static get BITMAP_FILL(){return 13}static get BITMAP_STROKE(){return 14}get isDrawable(){if(!this._$isBeginning||!this._$maxAlpha)return!1;const t=Math.abs(this.xMax-this.xMin),r=Math.abs(this.yMax-this.yMin);return t>0&&r>0}beginBitmapFill(t,r=null,n=!0,i=!1){return this._$hasFillEnabled&&this.endFill(),this._$fills||(this._$fills=z()),this._$maxAlpha=1,this._$hasFillEnabled=!0,this._$isBeginning=!0,this._$fills.push(M.BEGIN_PATH),this._$fillType=M.BITMAP_FILL,this._$fillBitmap=new Xt(t,r,n,i),this}beginFill(t=0,r=1){this._$hasFillEnabled&&this.endFill(),this._$fills||(this._$fills=z()),typeof t=="string"&&(t=Or(t)),t=me(t,0,16777215,0),r=me(r,0,1,1),this._$maxAlpha=Math.max(this._$maxAlpha,r),this._$hasFillEnabled=!0,this._$isBeginning=!0,this._$fills.push(M.BEGIN_PATH),this._$fillType=M.FILL_STYLE;const n=t>>>16&255,i=t>>>8&255,s=t&255;return this._$fillColor=n<<24|i<<16|s<<8|r*255,this}beginGradientFill(t,r,n,i,s=null,a="pad",o="rgb",c=0){this._$hasFillEnabled&&this.endFill(),this._$fills||(this._$fills=z());for(let u=0;u<n.length;++u)this._$maxAlpha=Math.max(this._$maxAlpha,n[u]);return this._$hasFillEnabled=!0,this._$isBeginning=!0,this._$fills.push(M.BEGIN_PATH),this._$fillType=M.GRADIENT_FILL,this._$fillGradient=new zt(t,r,n,i,s,a,o,c),this}clear(){return this._$maxAlpha=0,this._$isBeginning=!1,this._$positionX=0,this._$positionY=0,this._$fillType=0,this._$fillGradient=null,this._$fillBitmap=null,this._$fillColor=0,this._$hasFillEnabled=!1,this._$caps="none",this._$lineWidth=1,this._$lineType=0,this._$lineGradient=null,this._$joints="round",this._$miterLimit=0,this._$lineColor=0,this._$hasLineEnabled=!1,this.xMin=Number.MAX_VALUE,this.xMax=-Number.MAX_VALUE,this.yMin=Number.MAX_VALUE,this.yMax=-Number.MAX_VALUE,this.$recodes&&oe(this.$recodes),this._$fills&&oe(this._$fills),this._$lines&&oe(this._$lines),this._$buffer=null,this.$recodes=null,this._$fills=null,this._$lines=null,this}clone(){const t=new M;return t.copyFrom(this),t}copyFrom(t){t._$fillGradient&&(this._$fillGradient=t._$fillGradient.clone()),t._$fillBitmap&&(this._$fillBitmap=t._$fillBitmap.clone()),this._$hasFillEnabled=t._$hasFillEnabled,this._$fillType=t._$fillType,this._$fillColor=t._$fillColor,t._$lineGradient&&(this._$lineGradient=t._$lineGradient.clone()),this._$hasLineEnabled=t._$hasLineEnabled,this._$lineType=t._$lineType,this._$caps=t._$caps,this._$joints=t._$joints,this._$miterLimit=t._$miterLimit,this._$lineWidth=t._$lineWidth,this._$lineColor=t._$lineColor,this.xMin=t.xMin,this.xMax=t.xMax,this.yMin=t.yMin,this.yMax=t.yMax,this._$maxAlpha=t._$maxAlpha,this._$positionX=t._$positionX,this._$positionY=t._$positionY,this._$isBeginning=t._$isBeginning,t._$fills&&(this._$fills=t._$fills.slice(0)),t._$lines&&(this._$lines=t._$lines.slice(0)),t.$recodes&&(this.$recodes=t.$recodes.slice(0)),this._$buffer=null}cubicCurveTo(t,r,n,i,s,a){return s=+s||0,a=+a||0,this._$positionX===s&&this._$positionY===a?this:(t=+t||0,r=+r||0,n=+n||0,i=+i||0,ot(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t,r,n,i,s,a),ct(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,M.CUBIC,t,r,n,i,s,a),this._$positionX=s,this._$positionY=a,this)}curveTo(t,r,n,i){return n=+n||0,i=+i||0,this._$positionX===n&&this._$positionY===i?this:(t=+t||0,r=+r||0,ot(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t,r,n,i),ct(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,M.CURVE_TO,t,r,n,i),this._$positionX=n,this._$positionY=i,this)}drawCircle(t,r,n){return t=+t||0,r=+r||0,n=+n||0,n=Math.round(n),ot(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t-n,r-n,t+n,r+n),ct(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,M.MOVE_TO,t+n,r,M.ARC,t,r,n),this._$positionX=t,this._$positionY=r,this}drawEllipse(t,r,n,i){return hc(this,t,r,n,i)}drawRect(t,r,n,i){return fc(this,t,r,n,i)}drawRoundRect(t,r,n,i,s,a=NaN){return dc(this,t,r,n,i,s,a)}endFill(){if(!this._$hasFillEnabled||!this._$fills||8>this._$fills.length)return this;switch(this.$recodes||(this.$recodes=z()),(this._$fills[2]!==this._$fills[this._$fills.length-2]||this._$fills[3]!==this._$fills[this._$fills.length-1])&&this._$fills.push(M.LINE_TO,this._$fills[2],this._$fills[3]),this.$recodes.push(...this._$fills),oe(this._$fills),this._$fills=null,this._$fillType){case M.FILL_STYLE:this.$recodes.push(this._$fillType,this._$fillColor>>>24&255,this._$fillColor>>>16&255,this._$fillColor>>>8&255,this._$fillColor&255,M.END_FILL);break;case M.GRADIENT_FILL:this._$fillGradient&&this.$recodes.push(this._$fillType,...this._$fillGradient.toArray());break;case M.BITMAP_FILL:this._$fillBitmap&&this.$recodes.push(this._$fillType,...this._$fillBitmap.toArray());break}return this._$fillType=0,this._$fillColor=0,this._$fillGradient=null,this._$fillBitmap=null,this._$hasFillEnabled=!1,this}endLine(){if(!this._$hasLineEnabled||!this._$lines)return this;switch(this.$recodes||(this.$recodes=z()),this.$recodes.push(...this._$lines),oe(this._$lines),this._$lines=null,this._$lineType){case M.STROKE_STYLE:this.$recodes.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,this._$lineColor>>>24&255,this._$lineColor>>>16&255,this._$lineColor>>>8&255,this._$lineColor&255,M.END_STROKE);break;case M.GRADIENT_STROKE:this._$lineGradient&&this.$recodes.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,...this._$lineGradient.toArray());break;case M.BITMAP_STROKE:this._$fillBitmap&&this.$recodes.push(this._$lineType,this._$lineWidth,this._$caps,this._$joints,this._$miterLimit,...this._$fillBitmap.toArray());break}return this._$lineType=0,this._$lineWidth=0,this._$lineGradient=null,this._$lineColor=0,this._$caps="none",this._$joints="round",this._$miterLimit=0,this._$hasLineEnabled=!1,this}lineBitmapStyle(t,r=null,n=!0,i=!1){return this._$hasLineEnabled?(this._$lines||(this._$lines=z()),this._$maxAlpha=1,this._$hasLineEnabled=!0,this._$isBeginning=!0,this._$lines.push(M.BEGIN_PATH),this._$lineType=M.BITMAP_STROKE,this._$fillBitmap=new Xt(t,r,n,i),this):this}lineGradientStyle(t,r,n,i,s=null,a="pad",o="rgb",c=0){if(!this._$hasLineEnabled)return this;this._$lines||(this._$lines=z());for(let u=0;u<n.length;++u)this._$maxAlpha=Math.max(this._$maxAlpha,n[u]);return this._$lines.push(M.BEGIN_PATH),this._$lineType=M.GRADIENT_STROKE,this._$lineGradient=new zt(t,r,n,i,s,a,o,c),this}lineStyle(t=1,r=0,n=1,i="round",s="round",a=3){this._$hasLineEnabled&&this.endLine(),this._$lines||(this._$lines=z()),this._$maxAlpha=Math.max(this._$maxAlpha,n),this._$hasLineEnabled=!0,this._$isBeginning=!0,this._$positionX||this._$positionY?this._$lines.push(M.BEGIN_PATH,M.MOVE_TO,this._$positionX,this._$positionY):this._$lines.push(M.BEGIN_PATH),this._$lineType=M.STROKE_STYLE,typeof r=="string"&&(r=Or(r)),r=me(r,0,16777215,0),n=me(n,0,1,1);const o=r>>>16&255,c=r>>>8&255,u=r&255;return this._$lineColor=o<<24|c<<16|u<<8|n*255,this._$lineWidth=t,this._$caps=`${i}`,this._$joints=`${s}`,this._$joints==="miter"&&(this._$miterLimit=a),this}lineTo(t,r){return t=+t||0,r=+r||0,this._$positionX===t&&this._$positionY===r?this:(ot(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t,r),ct(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,M.LINE_TO,t,r),this._$positionX=t,this._$positionY=r,this)}moveTo(t,r){t=+t||0,r=+r||0,this._$positionX=t,this._$positionY=r,ot(this,this._$hasLineEnabled,this._$positionX,this._$positionY,this._$lineWidth,this._$caps,t,r);let n=!1;return this._$hasFillEnabled&&this._$fills&&this._$fills[this._$fills.length-3]===M.MOVE_TO&&(n=!0,this._$fills[this._$fills.length-2]=t,this._$fills[this._$fills.length-1]=r),this._$hasLineEnabled&&this._$lines&&this._$lines[this._$lines.length-3]===M.MOVE_TO&&(n=!0,this._$lines[this._$lines.length-2]=t,this._$lines[this._$lines.length-1]=r),n||ct(this,this._$hasFillEnabled,this._$hasLineEnabled,this._$fills,this._$lines,M.MOVE_TO,t,r),this}get buffer(){if(this.isConfirmed&&this._$buffer)return this._$buffer;this._$hasLineEnabled&&this.endLine(),this._$hasFillEnabled&&this.endFill();const t=Lt(this.$recodes);return this._$buffer=new Float32Array(t),oe(t),this.isConfirmed=!0,this._$buffer}set buffer(t){this._$buffer=t,this.isConfirmed=!0,this._$isBeginning=!0,this._$maxAlpha=1}}const Ac=(e,t,r)=>{for(let n=0;n<t.length;)switch(t[n++]){case M.BEGIN_PATH:e.beginPath();break;case M.MOVE_TO:e.moveTo(t[n++],t[n++]);break;case M.LINE_TO:e.lineTo(t[n++],t[n++]);break;case M.CURVE_TO:e.quadraticCurveTo(t[n++],t[n++],t[n++],t[n++]);break;case M.FILL_STYLE:n+=4;continue;case M.END_FILL:if(e.isPointInPath(r.x,r.y))return!0;break;case M.STROKE_STYLE:n+=8;continue;case M.END_STROKE:break;case M.CLOSE_PATH:e.closePath();break;case M.CUBIC:e.bezierCurveTo(t[n++],t[n++],t[n++],t[n++],t[n++],t[n++]);break;case M.ARC:e.arc(t[n++],t[n++],t[n++],0,2*Math.PI);break;case M.GRADIENT_FILL:if(e.isPointInPath(r.x,r.y))return!0;n+=6;continue;case M.GRADIENT_STROKE:n+=12;continue;case M.BITMAP_FILL:if(e.isPointInPath(r.x,r.y))return!0;n+=6;continue;case M.BITMAP_STROKE:n+=9;continue}return!1},Nt=(e,t,r,n)=>{const i=e.graphics,s=i.xMax-i.xMin,a=i.yMax-i.yMin;if(s<=0||a<=0)return!1;const o=_(e),c=o?T.multiply(r,o):r;t.beginPath(),t.setTransform(c[0],c[1],c[2],c[3],c[4],c[5]);let u=!1;return i.buffer.length?u=Ac(t,i.buffer,n):(t.moveTo(0,0),t.lineTo(s,0),t.lineTo(s,a),t.lineTo(0,a),t.lineTo(0,0),u=t.isPointInPath(n.x,n.y)),c!==r&&T.release(c),u},Yt=(e,t,r,n)=>{const i=Math.ceil(Math.abs(e.xMax-e.xMin)),s=Math.ceil(Math.abs(e.yMax-e.yMin));if(i<=0||s<=0)return!1;const a=_(e),o=a?T.multiply(r,a):r;return t.setTransform(o[0],o[1],o[2],o[3],o[4],o[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i,s),t.lineTo(0,s),t.lineTo(0,0),o!==r&&T.release(o),t.isPointInPath(n.x,n.y)},Wt=(e,t,r,n)=>{const i=e.videoWidth,s=e.videoHeight;if(i<=0||s<=0)return!1;const a=_(e),o=a?T.multiply(r,a):r;return t.beginPath(),t.setTransform(o[0],o[1],o[2],o[3],o[4],o[5]),t.beginPath(),t.moveTo(0,0),t.lineTo(i,0),t.lineTo(i,s),t.lineTo(0,s),t.lineTo(0,0),o!==r&&T.release(o),t.isPointInPath(n.x,n.y)},He=(e,t,r,n,i=!0)=>{const s=e.children;if(!s.length)return!1;const a=_(e),o=a?T.multiply(r,a):r,c=z(),u=z(),h=io();let l=0,f=0;for(let g=0;g<s.length;++g){const p=s[g];if(p&&!p.isMask){if(p.clipDepth){f=c.length,l=p.clipDepth,c.push(p);continue}p.visible&&(l&&p.placeId>l&&(f=0,l=0),f&&h.set(p.instanceId,f),u.push(p))}}const A=e.mouseChildren&&i;if(e.isSprite&&e.hitArea){const g=He(e.hitArea,t,o,n,A);return g&&A&&e.mouseEnabled&&(e.buttonMode&&e.useHandCursor&&(n.pointer="pointer"),n.hit||(n.hit=e)),g}let d=!1;const y=e.mask;if(y){let g=!1;switch(!0){case y.isContainerEnabled:g=He(y,t,o,n,A);break;case y.isShape:g=Nt(y,t,o,n);break;case y.isText:g=Yt(y,t,o,n);break;case y.isVideo:g=Wt(y,t,o,n);break}if(!g)return!1}for(;u.length;){const g=u.pop();if(!g||g.isMask)continue;if(h.has(g.instanceId)){const $=h.get(g.instanceId);if(!$)continue;const w=c[$];if(!w)continue;let I=!1;switch(!0){case w.isContainerEnabled:I=He(w,t,o,n,A);break;case w.isShape:I=Nt(w,t,o,n);break;case w.isText:I=Yt(w,t,o,n);break;case w.isVideo:I=Wt(w,t,o,n);break}if(!I)continue}let p=!1;switch(!0){case g.isContainerEnabled:p=He(g,t,o,n,A);break;case g.isShape:p=Nt(g,t,o,n);break;case g.isText:p=Yt(g,t,o,n);break;case g.isVideo:p=Wt(g,t,o,n);break}if(p){if(d=!0,!A)break;if(g.isInteractive&&g.mouseEnabled){if(n.pointer==="auto")switch(!0){case g.isText:g.type==="input"&&(n.pointer="text");break;case g.isSprite:g.buttonMode&&g.useHandCursor&&(n.pointer="pointer");break;default:n.pointer="pointer";break}n.hit||(n.hit=g);break}}}return oe(c),oe(u),so(h),o!==r&&T.release(o),d},Ge={x:0,y:0,pointer:"",hit:null},pc=(e,t,r,n=!1)=>{if(n){const h=e.parent,l=h?h.concatenatedMatrix.rawData:xt;switch(Ie.setTransform(1,0,0,1,0,0),Ie.beginPath(),Ge.x=t,Ge.y=r,Ge.hit=null,!0){case e.isContainerEnabled:return He(e,Ie,l,Ge);case e.isShape:return Nt(e,Ie,l,Ge);case e.isText:return Yt(e,Ie,l,Ge);case e.isVideo:return Wt(e,Ie,l,Ge);default:return!1}}const i=tt(e),s=_(e),a=he(i[0],i[1],i[2],i[3],s||xt);k(i);const o=new be(a[0],a[1],Math.abs(a[2]-a[0]),Math.abs(a[3]-a[1]));k(a);const c=e.parent,u=c?c.globalToLocal(new se(t,r)):new se(t,r);return o.containsPoint(u)},mc=e=>{const t=_(e);return t?new T(t[0],t[1],t[2],t[3],t[4],t[5]):new T},gc=e=>{const t=Ve(e);return t?new U(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7]):new U};class hr extends nt{instanceId;dictionaryId;isSprite;isInteractive;isContainerEnabled;isTimelineEnabled;isShape;isVideo;isText;placeId;placeObject;characterId;clipDepth;name;startFrame;endFrame;changed;$added;$addedToStage;uniqueKey;$matrix;$colorTransform;$filters;$blendMode;$scaleX;$scaleY;$rotation;$x;$y;$alpha;$cache;_$scale9Grid;_$visible;_$variables;isMask;parent;constructor(){super(),this.instanceId=yi(),this.dictionaryId=-1,this.uniqueKey="",this.isSprite=!1,this.isContainerEnabled=!1,this.isTimelineEnabled=!1,this.isShape=!1,this.isVideo=!1,this.isText=!1,this.isInteractive=!1,this.placeId=-1,this.placeObject=null,this.characterId=-1,this.clipDepth=0,this.name="",this.startFrame=1,this.endFrame=0,this.parent=null,this.isMask=!1,this.changed=!0,this.$added=!1,this.$addedToStage=!1,this.$matrix=null,this.$colorTransform=null,this.$filters=null,this.$blendMode=null,this._$visible=!0,this._$scale9Grid=null,this._$variables=null,this.$x=null,this.$y=null,this.$alpha=null,this.$scaleX=null,this.$scaleY=null,this.$rotation=null,this.$cache=null}get concatenatedMatrix(){return uo(this)}get alpha(){return ho(this)}set alpha(t){fo(this,t)}get blendMode(){return Wo(this)}set blendMode(t){Vo(this,t)}get filters(){return No(this)}set filters(t){Yo(this,t)}get dropTarget(){return lo()}get height(){return sc(this)}set height(t){ac(this,t)}get loaderInfo(){return Dt.has(this)?Dt.get(this):null}get colorTransform(){return gc(this)}set colorTransform(t){this.$colorTransform=t}get matrix(){return mc(this)}set matrix(t){this.$matrix=t}get mouseX(){return this.globalToLocal(bt).x}get mouseY(){return this.globalToLocal(bt).y}get root(){return we.has(this)?we.get(this):null}get rotation(){return this.$rotation===null?Qo(this):this.$rotation}set rotation(t){zo(this,t)}get scale9Grid(){return this._$scale9Grid}set scale9Grid(t){this._$scale9Grid!==t&&(this._$scale9Grid=t,j(this))}get scaleX(){return this.$scaleX===null?Ho(this):this.$scaleX}set scaleX(t){Pi(this,t)}get scaleY(){return this.$scaleY===null?Jo(this):this.$scaleY}set scaleY(t){Ri(this,t)}get visible(){return this._$visible}set visible(t){t=!!t,this._$visible!==t&&(this._$visible=t,j(this))}get width(){return tc(this)}set width(t){rc(this,t)}get x(){return this.$x===null?Zo(this):this.$x}set x(t){qo(this,t)}get y(){return this.$y===null?jo(this):this.$y}set y(t){ec(this,t)}getBounds(t=null){return cc(this,t)}globalToLocal(t){return ic(this,t)}hitTestObject(t){return lc(this,t)}hitTestPoint(t,r,n=!1){return pc(this,t,r,n)}localToGlobal(t){return nc(this,t)}getLocalVariable(t){if(!this._$variables)return null;if(this._$variables.has(t))return this._$variables.get(t)}setLocalVariable(t,r){this._$variables||(this._$variables=new Map),this._$variables.set(t,r)}hasLocalVariable(t){return this._$variables?this._$variables.has(t):!1}deleteLocalVariable(t){this._$variables&&this._$variables.has(t)&&(this._$variables.delete(t),this._$variables.size||(this._$variables=null))}getGlobalVariable(t){return Ue.has(t)?Ue.get(t):null}setGlobalVariable(t,r){Ue.set(t,r)}hasGlobalVariable(t){return Ue.has(t)}deleteGlobalVariable(t){Ue.has(t)&&Ue.delete(t)}clearGlobalVariable(){return Ue.clear()}remove(){oc(this)}$syncLoaderInfo(t){Dt.set(this,t)}}const Di=e=>{const t=e.children;for(let r=0;r<t.length;++r){const n=t[r];n&&(we.set(n,e.root),ge.add(n.instanceId),n.isContainerEnabled&&Di(n))}},Li=e=>{e.$addedToStage||!ge.has(e.instanceId)||(e.$addedToStage=!0,e.willTrigger(x.ADDED_TO_STAGE)&&e.dispatchEvent(new x(x.ADDED_TO_STAGE)))},Ni=e=>{const t=e.children;for(let r=0;r<t.length;++r){const n=t[r];n&&(Li(n),n.isContainerEnabled&&Ni(n))}},bc=e=>{e.$added||(e.$added=!0,e.willTrigger(x.ADDED)&&e.dispatchEvent(new x(x.ADDED,!0)))},On=(e,t,r=-1)=>{const n=t.parent;n&&n.removeChild(t);const i=e.children;return 0>r?i.push(t):i.splice(r,0,t),e.$container=null,t.parent=e,ge.has(e.instanceId)&&(we.set(t,e.root),ge.add(t.instanceId),t.isContainerEnabled&&Di(t)),bc(t),ge.has(e.instanceId)&&(Li(t),t.isContainerEnabled&&Ni(t)),j(t),t},Yi=e=>{const t=e.children;for(let r=0;r<t.length;++r){const n=t[r];n&&(we.delete(n),ge.delete(n.instanceId),n.isVideo&&n.pause(),n.isContainerEnabled&&Yi(n))}},xc=e=>{e.$added&&(e.$added=!1,e.willTrigger(x.REMOVED)&&e.dispatchEvent(new x(x.REMOVED,!0)))},Wi=e=>{!e.$addedToStage||!ge.has(e.instanceId)||(e.$addedToStage=!1,e.willTrigger(x.REMOVED_FROM_STAGE)&&e.dispatchEvent(new x(x.REMOVED_FROM_STAGE)),e.uniqueKey&&O.has(e.uniqueKey)&&O.removeTimer(e.uniqueKey))},un=e=>{const t=e.children;for(let r=0;r<t.length;++r){const n=t[r];n&&(Wi(n),n.isContainerEnabled&&un(n))}},hn=(e,t)=>{const r=t.parent;if(r&&r.instanceId!==e.instanceId)return;const n=e.children,i=n.indexOf(t);i>-1&&n.splice(i,1),e.$container=null,t.hasEventListener(x.ENTER_FRAME)&&t.removeAllEventListener(x.ENTER_FRAME),t.hasEventListener(V.KEY_DOWN)&&t.removeAllEventListener(V.KEY_DOWN),t.hasEventListener(V.KEY_UP)&&t.removeAllEventListener(V.KEY_UP),xc(t),ge.has(e.instanceId)&&(Wi(t),t.isContainerEnabled&&un(t)),ge.has(e.instanceId)&&(we.delete(t),ge.delete(t.instanceId),t.isVideo&&t.pause(),t.isContainerEnabled&&Yi(t)),t.parent=null,j(e)},Vi=(e,t)=>{const r=e.children;return t in r?r[t]:null},yc=(e,t)=>{const r=Vi(e,t);r&&hn(e,r)},$c=(e,t)=>{if(e.instanceId===t.instanceId)return!0;const r=e.children;for(let n=0;n<r.length;++n){const i=r[n];if(i){if(i.instanceId===t.instanceId)return!0;if(i.isContainerEnabled&&i.contains(t))return!0}}return!1},vc=(e,t)=>{if(!t)return null;const r=e.children;for(let n=0;n<r.length;++n){const i=r[n];if(!(!i.name||i.name!==t))return i}return null},wc=(e,t)=>{const r=e.children.slice();if(r.length)for(let n=0;n<t.length;n++){const i=t[n],s=r[i];s&&hn(e,s)}},Mc=(e,t,r)=>{const n=e.getChildIndex(t);if(n===-1||n===r)return;const i=e.children;i.splice(n,1),i.splice(r,0,t),j(e)},Bc=(e,t,r)=>{const n=e.getChildIndex(t),i=e.getChildIndex(r);if(n===-1||i===-1)return;const s=e.children;s[n]=r,s[i]=t,j(e)},Tc=(e,t,r)=>{const n=e.children,i=n[t],s=n[r];!i||!s||(n[t]=s,n[r]=i,j(e))};class fn extends hr{mouseEnabled;isInteractive;constructor(){super(),this.isInteractive=!0,this.mouseEnabled=!0}}class dn extends fn{_$children;_$mask;mouseChildren;$container;isContainerEnabled;constructor(){super(),this.isContainerEnabled=!0,this.mouseChildren=!0,this._$mask=null,this._$children=z(),this.$container=null}get children(){return this._$children}get numChildren(){return this.children.length}get mask(){return this._$mask}set mask(t){t!==this._$mask&&(this._$mask&&(this._$mask.isMask=!1,this._$mask=null),t&&(t.isMask=!0,this._$mask=t),j(this))}addChild(t){return On(this,t)}addChildAt(t,r){return On(this,t,r)}contains(t){return $c(this,t)}getChildAt(t){return Vi(this,t)}getChildByName(t){return vc(this,t)}getChildIndex(t){return this.children.indexOf(t)}removeChild(t){hn(this,t)}removeChildAt(t){yc(this,t)}removeChildren(...t){wc(this,t)}setChildIndex(t,r){Mc(this,t,r)}swapChildren(t,r){Bc(this,t,r)}swapChildrenAt(t,r){Tc(this,t,r)}}class Ki extends nt{name;frame;constructor(t,r){super(),this.name=`${t}`,this.frame=r|0}}class Sc extends nt{id;content;data;url;format;constructor(){super(),this.id=yi(),this.url="",this.content=null,this.data=null,this.format="json"}}const Ic=(e,t=!1,r=null)=>{const n=e.parent?e.parent.globalToLocal(bt):e.globalToLocal(bt);e.$lockCenter=t,e.$offsetX=e.x-n.x,e.$offsetY=e.y-n.y,e.$boundedRect=r,Bi(e)},Cc=e=>{e.$lockCenter=!1,e.$offsetX=0,e.$offsetY=0,e.$boundedRect=null,Bi(null)};class An extends dn{buttonMode;useHandCursor;isSprite;hitArea;_$soundTransform;$offsetX=0;$offsetY=0;$lockCenter=!1;$boundedRect=null;constructor(){super(),this.isSprite=!0,this.buttonMode=!1,this.useHandCursor=!0,this.hitArea=null,this.$offsetX=0,this.$offsetY=0,this.$lockCenter=!1,this.$boundedRect=null,this._$soundTransform=null}get soundTransform(){return this._$soundTransform}set soundTransform(t){this._$soundTransform=t}startDrag(t=!1,r=null){Ic(this,t,r)}stopDrag(){Cc(this)}}const Qi=e=>{e.isBitmap=!1,e.$bitmapBuffer=null,e.graphics.clear(),e.uniqueKey!==""&&O.has(e.uniqueKey)&&(O.removeById(e.uniqueKey),O.$removeIds.push(+e.uniqueKey)),j(e)},Xi=(e,t,r,n)=>{Qi(e),e.isBitmap=!0,e.$bitmapBuffer=n,e.graphics.xMin=0,e.graphics.yMin=0,e.graphics.xMax=t,e.graphics.yMax=r},Fc=(e,t)=>{const r=new Image;r.crossOrigin="anonymous",r.addEventListener("load",()=>{const n=r.width,i=r.height,s=O.getCanvas();s.width=n,s.height=i;const a=s.getContext("2d",{willReadFrequently:!0});a.drawImage(r,0,0,n,i),Xi(e,n,i,new Uint8Array(a.getImageData(0,0,n,i).data)),O.destroy(a),e.hasEventListener(x.COMPLETE)&&e.dispatchEvent(new x(x.COMPLETE))}),r.src=t},Ec=(e,t)=>{const r=e.graphics,n=Math.ceil(Math.abs(t.bounds.xMax-t.bounds.xMin)),i=Math.ceil(Math.abs(t.bounds.yMax-t.bounds.yMin));switch(!0){case t.bitmapId>0:{const a=e.loaderInfo.data?.characters[t.bitmapId];if(!a)break;e.isBitmap=!0,a.imageBuffer||(a.imageBuffer=new Uint8Array(a.buffer),a.buffer=null);const o=Math.ceil(Math.abs(a.bounds.xMax-a.bounds.xMin)),c=Math.ceil(Math.abs(a.bounds.yMax-a.bounds.yMin));if(t.grid){if(t.recodes){const u=t.recodes.slice(0);u.splice(-6,6);const h=new _e(o,c);h.buffer=a.imageBuffer,u.push(M.BITMAP_FILL,h,null,!0,!1,9);const l=Lt(u);r.buffer=new Float32Array(l),oe(u),oe(l)}}else if(n===o&&i===c)e.setBitmapBuffer(Math.ceil(Math.abs(a.bounds.xMax-a.bounds.xMin)),Math.ceil(Math.abs(a.bounds.yMax-a.bounds.yMin)),a.imageBuffer);else{const u=new _e(o,c);if(u.buffer=a.imageBuffer,t.recodes)if(t.recodes[t.recodes.length-10]===M.BITMAP_STROKE){const l=t.recodes.slice(0);l.splice(-5,5),l.push(u,null,!0,!1);const f=Lt(l);r.buffer=new Float32Array(f),oe(l),oe(f)}else r.beginBitmapFill(u).drawRect(0,0,n,i)}}break;case t.inBitmap:{e.isBitmap=!0;const s=t.recodes,a=s[s.length-4];if(n===a.width&&i===a.height)e.setBitmapBuffer(a.width,a.height,a.buffer);else{const o=new _e(a.width,a.height);o.buffer=a.buffer,r.beginBitmapFill(o).drawRect(0,0,n,i)}}break;case"buffer"in t:t.imageBuffer||(t.imageBuffer=new Uint8Array(t.buffer),t.buffer=null),e.setBitmapBuffer(Math.ceil(Math.abs(r.xMax-r.xMin)),Math.ceil(Math.abs(r.yMax-r.yMin)),t.imageBuffer);break;default:t.recodes&&(t.recodeBuffer=new Float32Array(Lt(t.recodes)),oe(t.recodes),t.recodes=null),t.recodeBuffer&&(r.buffer=t.recodeBuffer);break}r.xMin=t.bounds.xMin,r.xMax=t.bounds.xMax,r.yMin=t.bounds.yMin,r.yMax=t.bounds.yMax,t.grid&&(e.scale9Grid=new be(t.grid.x,t.grid.y,t.grid.w,t.grid.h))},Pc=(e,t)=>new Promise(r=>{const n=()=>{e.removeEventListener(x.COMPLETE,n),r()};e.addEventListener(x.COMPLETE,n),e.src=t});class $t extends hr{_$graphics;_$src;isShape;cacheKey;cacheParams;isBitmap;$bitmapBuffer;constructor(){super(),this.isShape=!0,this.cacheKey=0,this.cacheParams=z(0,0,0),this._$graphics=null,this._$src="",this.$bitmapBuffer=null,this.isBitmap=!1}static get namespace(){return"next2d.display.Shape"}get namespace(){return"next2d.display.Shape"}get graphics(){return this._$graphics||(this._$graphics=new M,co.set(this._$graphics,this)),this._$graphics}get src(){return this._$src}set src(t){this._$src!==t&&(this._$src=t,Fc(this,t))}load(t){return Pc(this,t)}get bitmapData(){const t=new _e(this.width,this.height);return this.$bitmapBuffer&&(t.buffer=this.$bitmapBuffer),t}clearBitmapBuffer(){Qi(this)}setBitmapBuffer(t,r,n){Xi(this,t,r,n)}$sync(t,r=null){r&&super.$syncLoaderInfo(r),Ec(this,t)}}let zi=null;const kn=e=>{zi=e},ke=()=>zi,de=document.createElement("textarea");de.tabIndex=-1;let Me="";Me+="position: fixed;";Me+="top: 0;";Me+="left: 0;";Me+="font-size: 16px;";Me+="border: 0;";Me+="resize: none;";Me+="opacity: 0;";Me+="z-index: -1;";Me+="pointer-events: none;";de.setAttribute("style",Me);const _r=document.createElement("canvas");_r.width=_r.height=1;const De=_r.getContext("2d");let Hi=0;const Et=()=>Hi,dt=e=>{Hi=e},Rc=e=>De?(De.fillStyle=e,+`0x${De.fillStyle.slice(1)}`):0,et=e=>isNaN(+e)?Rc(`${e}`):+e,Oc=(e,t=1)=>({R:(e&16711680)>>16,G:(e&65280)>>8,B:e&255,A:t*255}),pt=(e,t,r,n=null)=>{const i=+e;return isNaN(i)&&n!==null?n:Math.min(Math.max(t,isNaN(i)?0:i),r)};let Ji;const Ht=()=>Ji,Zi=e=>{Ji=e},Je={x:0,y:0};class ue{align;bold;color;font;italic;leading;leftMargin;letterSpacing;rightMargin;size;underline;constructor(t=null,r=null,n=null,i=null,s=null,a=null,o=null,c=null,u=null,h=null,l=null){this.font=t,this.size=r,this.color=n,this.bold=i,this.italic=s,this.underline=a,this.align=o,this.leftMargin=c,this.rightMargin=u,this.leading=h,this.letterSpacing=l}clone(){return new ue(this.font,this.size,this.color,this.bold,this.italic,this.underline,this.align,this.leftMargin,this.rightMargin,this.leading,this.letterSpacing)}toObject(){return{font:this.font,size:this.size,color:et(this.color),bold:this.bold,italic:this.italic,underline:this.underline,align:this.align,leftMargin:this.leftMargin,rightMargin:this.rightMargin,leading:this.leading,letterSpacing:this.letterSpacing}}}const kc=e=>{e.align="left",e.bold=!1,e.color=0,e.font="Times New Roman",e.italic=!1,e.leading=0,e.leftMargin=0,e.letterSpacing=0,e.rightMargin=0,e.size=12,e.underline=!1},Uc=e=>{let t="";if(e.font&&(t+=`font-family: ${e.font};`),e.size&&(t+=`font-size: ${e.size}px;`),e.color){const r=Oc(et(e.color)),n=r.R.toString(16).padStart(2,"0"),i=r.G.toString(16).padStart(2,"0"),s=r.B.toString(16).padStart(2,"0");t+=`color: #${n}${i}${s};`}return e.bold&&(t+="font-weight: bold;"),e.italic&&(t+="font-style: italic;"),e.underline&&(t+="text-decoration: underline;"),e.align&&(t+=`text-align: ${e.align};`),e.leftMargin&&(t+=`margin-left: ${e.leftMargin}px;`),e.rightMargin&&(t+=`margin-right: ${e.rightMargin}px;`),e.leading&&(t+=`margin-bottom: ${e.leading}px;`),e.letterSpacing&&(t+=`letter-spacing: ${e.letterSpacing}px;`),t};class Gc{_$textWidth;_$textHeight;heightTable;ascentTable;widthTable;textTable;lineTable;constructor(){this._$textWidth=-1,this._$textHeight=-1,this.widthTable=[],this.heightTable=[],this.ascentTable=[],this.textTable=[],this.lineTable=[]}get textWidth(){if(this._$textWidth!==-1)return this._$textWidth;this._$textWidth=0;for(let t=0;t<this.widthTable.length;++t)this._$textWidth=Math.max(this._$textWidth,this.widthTable[t]);return this._$textWidth}get textHeight(){if(this._$textHeight!==-1)return this._$textHeight;this._$textHeight=0;for(let t=0;t<this.heightTable.length;++t)this._$textHeight+=this.heightTable[t];return this._$textHeight}getLineWidth(t){return t in this.widthTable?this.widthTable[t]:0}getLineHeight(t){return t in this.heightTable?this.heightTable[t]:0}clear(){this._$textWidth=-1,this._$textHeight=-1,this.widthTable.length=0,this.heightTable.length=0,this.ascentTable.length=0,this.textTable.length=0,this.lineTable.length=0}}var Ir;const _c=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Un=(Ir=String.fromCodePoint)!==null&&Ir!==void 0?Ir:(e=>{let t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t});function Dc(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=_c.get(e))!==null&&t!==void 0?t:e}function qi(e){const t=typeof atob=="function"?atob(e):typeof Buffer.from=="function"?Buffer.from(e,"base64").toString("binary"):new Buffer(e,"base64").toString("binary"),r=t.length&-2,n=new Uint16Array(r/2);for(let i=0,s=0;i<r;i+=2){const a=t.charCodeAt(i),o=t.charCodeAt(i+1);n[s++]=a|o<<8}return n}const Lc=qi("QR08ALkAAgH6AYsDNQR2BO0EPgXZBQEGLAbdBxMISQrvCmQLfQurDKQNLw4fD4YPpA+6D/IPAAAAAAAAAAAAAAAAKhBMEY8TmxUWF2EYLBkxGuAa3RsJHDscWR8YIC8jSCSIJcMl6ie3Ku8rEC0CLjoupS7kLgAIRU1hYmNmZ2xtbm9wcnN0dVQAWgBeAGUAaQBzAHcAfgCBAIQAhwCSAJoAoACsALMAbABpAGcAO4DGAMZAUAA7gCYAJkBjAHUAdABlADuAwQDBQHIiZXZlAAJhAAFpeW0AcgByAGMAO4DCAMJAEGRyAADgNdgE3XIAYQB2AGUAO4DAAMBA8CFoYZFj4SFjcgBhZAAAoFMqAAFncIsAjgBvAG4ABGFmAADgNdg43fAlbHlGdW5jdGlvbgCgYSBpAG4AZwA7gMUAxUAAAWNzpACoAHIAAOA12Jzc6SFnbgCgVCJpAGwAZABlADuAwwDDQG0AbAA7gMQAxEAABGFjZWZvcnN1xQDYANoA7QDxAPYA+QD8AAABY3LJAM8AayNzbGFzaAAAoBYidgHTANUAAKDnKmUAZAAAoAYjeQARZIABY3J0AOAA5QDrAGEidXNlAACgNSLuI291bGxpcwCgLCFhAJJjcgAA4DXYBd1wAGYAAOA12Dnd5SF2ZdhiYwDyAOoAbSJwZXEAAKBOIgAHSE9hY2RlZmhpbG9yc3UXARoBHwE6AVIBVQFiAWQBZgGCAakB6QHtAfIBYwB5ACdkUABZADuAqQCpQIABY3B5ACUBKAE1AfUhdGUGYWmg0iJ0KGFsRGlmZmVyZW50aWFsRAAAoEUhbCJleXMAAKAtIQACYWVpb0EBRAFKAU0B8iFvbgxhZABpAGwAO4DHAMdAcgBjAAhhbiJpbnQAAKAwIm8AdAAKYQABZG5ZAV0BaSJsbGEAuGB0I2VyRG90ALdg8gA5AWkAp2NyImNsZQAAAkRNUFRwAXQBeQF9AW8AdAAAoJkiaSJudXMAAKCWIuwhdXMAoJUiaSJtZXMAAKCXIm8AAAFjc4cBlAFrKndpc2VDb250b3VySW50ZWdyYWwAAKAyImUjQ3VybHkAAAFEUZwBpAFvJXVibGVRdW90ZQAAoB0gdSJvdGUAAKAZIAACbG5wdbABtgHNAdgBbwBuAGWgNyIAoHQqgAFnaXQAvAHBAcUB8iJ1ZW50AKBhIm4AdAAAoC8i7yV1ckludGVncmFsAKAuIgABZnLRAdMBAKACIe8iZHVjdACgECJuLnRlckNsb2Nrd2lzZUNvbnRvdXJJbnRlZ3JhbAAAoDMi7yFzcwCgLypjAHIAAOA12J7ccABDoNMiYQBwAACgTSKABURKU1phY2VmaW9zAAsCEgIVAhgCGwIsAjQCOQI9AnMCfwNvoEUh9CJyYWhkAKARKWMAeQACZGMAeQAFZGMAeQAPZIABZ3JzACECJQIoAuchZXIAoCEgcgAAoKEhaAB2AACg5CoAAWF5MAIzAvIhb24OYRRkbAB0oAciYQCUY3IAAOA12AfdAAFhZkECawIAAWNtRQJnAvIjaXRpY2FsAAJBREdUUAJUAl8CYwJjInV0ZQC0YG8AdAFZAloC2WJiJGxlQWN1dGUA3WJyImF2ZQBgYGkibGRlANxi7yFuZACgxCJmJWVyZW50aWFsRAAAoEYhcAR9AgAAAAAAAIECjgIAABoDZgAA4DXYO91EoagAhQKJAm8AdAAAoNwgcSJ1YWwAAKBQIuIhbGUAA0NETFJVVpkCqAK1Au8C/wIRA28AbgB0AG8AdQByAEkAbgB0AGUAZwByAGEA7ADEAW8AdAKvAgAAAACwAqhgbiNBcnJvdwAAoNMhAAFlb7kC0AJmAHQAgAFBUlQAwQLGAs0CciJyb3cAAKDQIekkZ2h0QXJyb3cAoNQhZQDlACsCbgBnAAABTFLWAugC5SFmdAABQVLcAuECciJyb3cAAKD4J+kkZ2h0QXJyb3cAoPon6SRnaHRBcnJvdwCg+SdpImdodAAAAUFU9gL7AnIicm93AACg0iFlAGUAAKCoInAAQQIGAwAAAAALA3Iicm93AACg0SFvJHduQXJyb3cAAKDVIWUlcnRpY2FsQmFyAACgJSJuAAADQUJMUlRhJAM2AzoDWgNxA3oDciJyb3cAAKGTIUJVLAMwA2EAcgAAoBMpcCNBcnJvdwAAoPUhciJldmUAEWPlIWZ00gJDAwAASwMAAFIDaSVnaHRWZWN0b3IAAKBQKWUkZVZlY3RvcgAAoF4p5SJjdG9yQqC9IWEAcgAAoFYpaSJnaHQA1AFiAwAAaQNlJGVWZWN0b3IAAKBfKeUiY3RvckKgwSFhAHIAAKBXKWUAZQBBoKQiciJyb3cAAKCnIXIAcgBvAPcAtAIAAWN0gwOHA3IAAOA12J/c8iFvaxBhAAhOVGFjZGZnbG1vcHFzdHV4owOlA6kDsAO/A8IDxgPNA9ID8gP9AwEEFAQeBCAEJQRHAEphSAA7gNAA0EBjAHUAdABlADuAyQDJQIABYWl5ALYDuQO+A/Ihb24aYXIAYwA7gMoAykAtZG8AdAAWYXIAAOA12AjdcgBhAHYAZQA7gMgAyEDlIm1lbnQAoAgiAAFhcNYD2QNjAHIAEmF0AHkAUwLhAwAAAADpA20lYWxsU3F1YXJlAACg+yVlJ3J5U21hbGxTcXVhcmUAAKCrJQABZ3D2A/kDbwBuABhhZgAA4DXYPN3zImlsb26VY3UAAAFhaQYEDgRsAFSgdSppImxkZQAAoEIi7CNpYnJpdW0AoMwhAAFjaRgEGwRyAACgMCFtAACgcyphAJdjbQBsADuAywDLQAABaXApBC0E8yF0cwCgAyLvJG5lbnRpYWxFAKBHIYACY2Zpb3MAPQQ/BEMEXQRyBHkAJGRyAADgNdgJ3WwibGVkAFMCTAQAAAAAVARtJWFsbFNxdWFyZQAAoPwlZSdyeVNtYWxsU3F1YXJlAACgqiVwA2UEAABpBAAAAABtBGYAAOA12D3dwSFsbACgACLyI2llcnRyZgCgMSFjAPIAcQQABkpUYWJjZGZnb3JzdIgEiwSOBJMElwSkBKcEqwStBLIE5QTqBGMAeQADZDuAPgA+QO0hbWFkoJMD3GNyImV2ZQAeYYABZWl5AJ0EoASjBOQhaWwiYXIAYwAcYRNkbwB0ACBhcgAA4DXYCt0AoNkicABmAADgNdg+3eUiYXRlcgADRUZHTFNUvwTIBM8E1QTZBOAEcSJ1YWwATKBlIuUhc3MAoNsidSRsbEVxdWFsAACgZyJyI2VhdGVyAACgoirlIXNzAKB3IuwkYW50RXF1YWwAoH4qaSJsZGUAAKBzImMAcgAA4DXYotwAoGsiAARBYWNmaW9zdfkE/QQFBQgFCwUTBSIFKwVSIkRjeQAqZAABY3QBBQQFZQBrAMdiXmDpIXJjJGFyAACgDCFsJWJlcnRTcGFjZQAAoAsh8AEYBQAAGwVmAACgDSHpJXpvbnRhbExpbmUAoAAlAAFjdCYFKAXyABIF8iFvayZhbQBwAEQBMQU5BW8AdwBuAEgAdQBtAPAAAAFxInVhbAAAoE8iAAdFSk9hY2RmZ21ub3N0dVMFVgVZBVwFYwVtBXAFcwV6BZAFtgXFBckFzQVjAHkAFWTsIWlnMmFjAHkAAWRjAHUAdABlADuAzQDNQAABaXlnBWwFcgBjADuAzgDOQBhkbwB0ADBhcgAAoBEhcgBhAHYAZQA7gMwAzEAAoREhYXB/BYsFAAFjZ4MFhQVyACphaSNuYXJ5SQAAoEghbABpAGUA8wD6AvQBlQUAAKUFZaAsIgABZ3KaBZ4F8iFhbACgKyLzI2VjdGlvbgCgwiJpI3NpYmxlAAABQ1SsBbEFbyJtbWEAAKBjIGkibWVzAACgYiCAAWdwdAC8Bb8FwwVvAG4ALmFmAADgNdhA3WEAmWNjAHIAAKAQIWkibGRlAChh6wHSBQAA1QVjAHkABmRsADuAzwDPQIACY2Zvc3UA4QXpBe0F8gX9BQABaXnlBegFcgBjADRhGWRyAADgNdgN3XAAZgAA4DXYQd3jAfcFAAD7BXIAAOA12KXc8iFjeQhk6yFjeQRkgANISmFjZm9zAAwGDwYSBhUGHQYhBiYGYwB5ACVkYwB5AAxk8CFwYZpjAAFleRkGHAbkIWlsNmEaZHIAAOA12A7dcABmAADgNdhC3WMAcgAA4DXYptyABUpUYWNlZmxtb3N0AD0GQAZDBl4GawZkB2gHcAd0B80H2gdjAHkACWQ7gDwAPECAAmNtbnByAEwGTwZSBlUGWwb1IXRlOWHiIWRhm2NnAACg6ifsI2FjZXRyZgCgEiFyAACgniGAAWFleQBkBmcGagbyIW9uPWHkIWlsO2EbZAABZnNvBjQHdAAABUFDREZSVFVWYXKABp4GpAbGBssG3AYDByEHwQIqBwABbnKEBowGZyVsZUJyYWNrZXQAAKDoJ/Ihb3cAoZAhQlKTBpcGYQByAACg5CHpJGdodEFycm93AKDGIWUjaWxpbmcAAKAII28A9QGqBgAAsgZiJWxlQnJhY2tldAAAoOYnbgDUAbcGAAC+BmUkZVZlY3RvcgAAoGEp5SJjdG9yQqDDIWEAcgAAoFkpbCJvb3IAAKAKI2kiZ2h0AAABQVbSBtcGciJyb3cAAKCUIeUiY3RvcgCgTikAAWVy4AbwBmUAAKGjIkFW5gbrBnIicm93AACgpCHlImN0b3IAoFopaSNhbmdsZQBCorIi+wYAAAAA/wZhAHIAAKDPKXEidWFsAACgtCJwAIABRFRWAAoHEQcYB+8kd25WZWN0b3IAoFEpZSRlVmVjdG9yAACgYCnlImN0b3JCoL8hYQByAACgWCnlImN0b3JCoLwhYQByAACgUilpAGcAaAB0AGEAcgByAG8A9wDMAnMAAANFRkdMU1Q/B0cHTgdUB1gHXwfxJXVhbEdyZWF0ZXIAoNoidSRsbEVxdWFsAACgZiJyI2VhdGVyAACgdiLlIXNzAKChKuwkYW50RXF1YWwAoH0qaSJsZGUAAKByInIAAOA12A/dZaDYIuYjdGFycm93AKDaIWkiZG90AD9hgAFucHcAege1B7kHZwAAAkxSbHKCB5QHmwerB+UhZnQAAUFSiAeNB3Iicm93AACg9SfpJGdodEFycm93AKD3J+kkZ2h0QXJyb3cAoPYn5SFmdAABYXLcAqEHaQBnAGgAdABhAHIAcgBvAPcA5wJpAGcAaAB0AGEAcgByAG8A9wDuAmYAAOA12EPdZQByAAABTFK/B8YHZSRmdEFycm93AACgmSHpJGdodEFycm93AKCYIYABY2h0ANMH1QfXB/IAWgYAoLAh8iFva0FhAKBqIgAEYWNlZmlvc3XpB+wH7gf/BwMICQgOCBEIcAAAoAUpeQAcZAABZGzyB/kHaSR1bVNwYWNlAACgXyBsI2ludHJmAACgMyFyAADgNdgQ3e4jdXNQbHVzAKATInAAZgAA4DXYRN1jAPIA/gecY4AESmFjZWZvc3R1ACEIJAgoCDUIgQiFCDsKQApHCmMAeQAKZGMidXRlAENhgAFhZXkALggxCDQI8iFvbkdh5CFpbEVhHWSAAWdzdwA7CGEIfQjhInRpdmWAAU1UVgBECEwIWQhlJWRpdW1TcGFjZQAAoAsgaABpAAABY25SCFMIawBTAHAAYQBjAOUASwhlAHIAeQBUAGgAaQDuAFQI9CFlZAABR0xnCHUIcgBlAGEAdABlAHIARwByAGUAYQB0AGUA8gDrBGUAcwBzAEwAZQBzAPMA2wdMImluZQAKYHIAAOA12BHdAAJCbnB0jAiRCJkInAhyImVhawAAoGAgwiZyZWFraW5nU3BhY2WgYGYAAKAVIUOq7CqzCMIIzQgAAOcIGwkAAAAAAAAtCQAAbwkAAIcJAACdCcAJGQoAADQKAAFvdbYIvAjuI2dydWVudACgYiJwIkNhcAAAoG0ibyh1YmxlVmVydGljYWxCYXIAAKAmIoABbHF4ANII1wjhCOUibWVudACgCSL1IWFsVKBgImkibGRlAADgQiI4A2kic3RzAACgBCJyI2VhdGVyAACjbyJFRkdMU1T1CPoIAgkJCQ0JFQlxInVhbAAAoHEidSRsbEVxdWFsAADgZyI4A3IjZWF0ZXIAAOBrIjgD5SFzcwCgeSLsJGFudEVxdWFsAOB+KjgDaSJsZGUAAKB1IvUhbXBEASAJJwnvI3duSHVtcADgTiI4A3EidWFsAADgTyI4A2UAAAFmczEJRgn0JFRyaWFuZ2xlQqLqIj0JAAAAAEIJYQByAADgzyk4A3EidWFsAACg7CJzAICibiJFR0xTVABRCVYJXAlhCWkJcSJ1YWwAAKBwInIjZWF0ZXIAAKB4IuUhc3MA4GoiOAPsJGFudEVxdWFsAOB9KjgDaSJsZGUAAKB0IuUic3RlZAABR0x1CX8J8iZlYXRlckdyZWF0ZXIA4KIqOAPlI3NzTGVzcwDgoSo4A/IjZWNlZGVzAKGAIkVTjwmVCXEidWFsAADgryo4A+wkYW50RXF1YWwAoOAiAAFlaaAJqQl2JmVyc2VFbGVtZW50AACgDCLnJWh0VHJpYW5nbGVCousitgkAAAAAuwlhAHIAAODQKTgDcSJ1YWwAAKDtIgABcXXDCeAJdSNhcmVTdQAAAWJwywnVCfMhZXRF4I8iOANxInVhbAAAoOIi5SJyc2V0ReCQIjgDcSJ1YWwAAKDjIoABYmNwAOYJ8AkNCvMhZXRF4IIi0iBxInVhbAAAoIgi4yJlZWRzgKGBIkVTVAD6CQAKBwpxInVhbAAA4LAqOAPsJGFudEVxdWFsAKDhImkibGRlAADgfyI4A+UicnNldEXggyLSIHEidWFsAACgiSJpImxkZQCAoUEiRUZUACIKJwouCnEidWFsAACgRCJ1JGxsRXF1YWwAAKBHImkibGRlAACgSSJlJXJ0aWNhbEJhcgAAoCQiYwByAADgNdip3GkAbABkAGUAO4DRANFAnWMAB0VhY2RmZ21vcHJzdHV2XgphCmgKcgp2CnoKgQqRCpYKqwqtCrsKyArNCuwhaWdSYWMAdQB0AGUAO4DTANNAAAFpeWwKcQpyAGMAO4DUANRAHmRiImxhYwBQYXIAAOA12BLdcgBhAHYAZQA7gNIA0kCAAWFlaQCHCooKjQpjAHIATGFnAGEAqWNjInJvbgCfY3AAZgAA4DXYRt3lI25DdXJseQABRFGeCqYKbyV1YmxlUXVvdGUAAKAcIHUib3RlAACgGCAAoFQqAAFjbLEKtQpyAADgNdiq3GEAcwBoADuA2ADYQGkAbAHACsUKZABlADuA1QDVQGUAcwAAoDcqbQBsADuA1gDWQGUAcgAAAUJQ0wrmCgABYXLXCtoKcgAAoD4gYQBjAAABZWvgCuIKAKDeI2UAdAAAoLQjYSVyZW50aGVzaXMAAKDcI4AEYWNmaGlsb3JzAP0KAwsFCwkLCwsMCxELIwtaC3IjdGlhbEQAAKACInkAH2RyAADgNdgT3WkApmOgY/Ujc01pbnVzsWAAAWlwFQsgC24AYwBhAHIAZQBwAGwAYQBuAOUACgVmAACgGSGAobsqZWlvACoLRQtJC+MiZWRlc4CheiJFU1QANAs5C0ALcSJ1YWwAAKCvKuwkYW50RXF1YWwAoHwiaSJsZGUAAKB+Im0AZQAAoDMgAAFkcE0LUQv1IWN0AKAPIm8jcnRpb24AYaA3ImwAAKAdIgABY2leC2ILcgAA4DXYq9yoYwACVWZvc2oLbwtzC3cLTwBUADuAIgAiQHIAAOA12BTdcABmAACgGiFjAHIAAOA12KzcAAZCRWFjZWZoaW9yc3WPC5MLlwupC7YL2AvbC90LhQyTDJoMowzhIXJyAKAQKUcAO4CuAK5AgAFjbnIAnQugC6ML9SF0ZVRhZwAAoOsncgB0oKAhbAAAoBYpgAFhZXkArwuyC7UL8iFvblhh5CFpbFZhIGR2oBwhZSJyc2UAAAFFVb8LzwsAAWxxwwvIC+UibWVudACgCyL1JGlsaWJyaXVtAKDLIXAmRXF1aWxpYnJpdW0AAKBvKXIAAKAcIW8AoWPnIWh0AARBQ0RGVFVWYewLCgwQDDIMNwxeDHwM9gIAAW5y8Av4C2clbGVCcmFja2V0AACg6SfyIW93AKGSIUJM/wsDDGEAcgAAoOUhZSRmdEFycm93AACgxCFlI2lsaW5nAACgCSNvAPUBFgwAAB4MYiVsZUJyYWNrZXQAAKDnJ24A1AEjDAAAKgxlJGVWZWN0b3IAAKBdKeUiY3RvckKgwiFhAHIAAKBVKWwib29yAACgCyMAAWVyOwxLDGUAAKGiIkFWQQxGDHIicm93AACgpiHlImN0b3IAoFspaSNhbmdsZQBCorMiVgwAAAAAWgxhAHIAAKDQKXEidWFsAACgtSJwAIABRFRWAGUMbAxzDO8kd25WZWN0b3IAoE8pZSRlVmVjdG9yAACgXCnlImN0b3JCoL4hYQByAACgVCnlImN0b3JCoMAhYQByAACgUykAAXB1iQyMDGYAAKAdIe4kZEltcGxpZXMAoHAp6SRnaHRhcnJvdwCg2yEAAWNongyhDHIAAKAbIQCgsSHsJGVEZWxheWVkAKD0KYAGSE9hY2ZoaW1vcXN0dQC/DMgMzAzQDOIM5gwKDQ0NFA0ZDU8NVA1YDQABQ2PDDMYMyCFjeSlkeQAoZEYiVGN5ACxkYyJ1dGUAWmEAorwqYWVpedgM2wzeDOEM8iFvbmBh5CFpbF5hcgBjAFxhIWRyAADgNdgW3e8hcnQAAkRMUlXvDPYM/QwEDW8kd25BcnJvdwAAoJMhZSRmdEFycm93AACgkCHpJGdodEFycm93AKCSIXAjQXJyb3cAAKCRIechbWGjY+EkbGxDaXJjbGUAoBgicABmAADgNdhK3XICHw0AAAAAIg10AACgGiLhIXJlgKGhJUlTVQAqDTINSg3uJXRlcnNlY3Rpb24AoJMidQAAAWJwNw1ADfMhZXRFoI8icSJ1YWwAAKCRIuUicnNldEWgkCJxInVhbAAAoJIibiJpb24AAKCUImMAcgAA4DXYrtxhAHIAAKDGIgACYmNtcF8Nag2ODZANc6DQImUAdABFoNAicSJ1YWwAAKCGIgABY2huDYkNZSJlZHMAgKF7IkVTVAB4DX0NhA1xInVhbAAAoLAq7CRhbnRFcXVhbACgfSJpImxkZQAAoH8iVABoAGEA9ADHCwCgESIAodEiZXOVDZ8NciJzZXQARaCDInEidWFsAACghyJlAHQAAKDRIoAFSFJTYWNmaGlvcnMAtQ27Db8NyA3ODdsN3w3+DRgOHQ4jDk8AUgBOADuA3gDeQMEhREUAoCIhAAFIY8MNxg1jAHkAC2R5ACZkAAFidcwNzQ0JYKRjgAFhZXkA1A3XDdoN8iFvbmRh5CFpbGJhImRyAADgNdgX3QABZWnjDe4N8gHoDQAA7Q3lImZvcmUAoDQiYQCYYwABY27yDfkNayNTcGFjZQAA4F8gCiDTInBhY2UAoAkg7CFkZYChPCJFRlQABw4MDhMOcSJ1YWwAAKBDInUkbGxFcXVhbAAAoEUiaSJsZGUAAKBIInAAZgAA4DXYS93pI3BsZURvdACg2yAAAWN0Jw4rDnIAAOA12K/c8iFva2Zh4QpFDlYOYA5qDgAAbg5yDgAAAAAAAAAAAAB5DnwOqA6zDgAADg8RDxYPGg8AAWNySA5ODnUAdABlADuA2gDaQHIAb6CfIeMhaXIAoEkpcgDjAVsOAABdDnkADmR2AGUAbGEAAWl5Yw5oDnIAYwA7gNsA20AjZGIibGFjAHBhcgAA4DXYGN1yAGEAdgBlADuA2QDZQOEhY3JqYQABZGl/Dp8OZQByAAABQlCFDpcOAAFhcokOiw5yAF9gYQBjAAABZWuRDpMOAKDfI2UAdAAAoLUjYSVyZW50aGVzaXMAAKDdI28AbgBQoMMi7CF1cwCgjiIAAWdwqw6uDm8AbgByYWYAAOA12EzdAARBREVUYWRwc78O0g7ZDuEOBQPqDvMOBw9yInJvdwDCoZEhyA4AAMwOYQByAACgEilvJHduQXJyb3cAAKDFIW8kd25BcnJvdwAAoJUhcSV1aWxpYnJpdW0AAKBuKWUAZQBBoKUiciJyb3cAAKClIW8AdwBuAGEAcgByAG8A9wAQA2UAcgAAAUxS+Q4AD2UkZnRBcnJvdwAAoJYh6SRnaHRBcnJvdwCglyFpAGyg0gNvAG4ApWPpIW5nbmFjAHIAAOA12LDcaSJsZGUAaGFtAGwAO4DcANxAgAREYmNkZWZvc3YALQ8xDzUPNw89D3IPdg97D4AP4SFzaACgqyJhAHIAAKDrKnkAEmThIXNobKCpIgCg5ioAAWVyQQ9DDwCgwSKAAWJ0eQBJD00Paw9hAHIAAKAWIGmgFiDjIWFsAAJCTFNUWA9cD18PZg9hAHIAAKAjIukhbmV8YGUkcGFyYXRvcgAAoFgnaSJsZGUAAKBAItQkaGluU3BhY2UAoAogcgAA4DXYGd1wAGYAAOA12E3dYwByAADgNdix3GQiYXNoAACgqiKAAmNlZm9zAI4PkQ+VD5kPng/pIXJjdGHkIWdlAKDAInIAAOA12BrdcABmAADgNdhO3WMAcgAA4DXYstwAAmZpb3OqD64Prw+0D3IAAOA12BvdnmNwAGYAAOA12E/dYwByAADgNdiz3IAEQUlVYWNmb3N1AMgPyw/OD9EP2A/gD+QP6Q/uD2MAeQAvZGMAeQAHZGMAeQAuZGMAdQB0AGUAO4DdAN1AAAFpedwP3w9yAGMAdmErZHIAAOA12BzdcABmAADgNdhQ3WMAcgAA4DXYtNxtAGwAeGEABEhhY2RlZm9z/g8BEAUQDRAQEB0QIBAkEGMAeQAWZGMidXRlAHlhAAFheQkQDBDyIW9ufWEXZG8AdAB7YfIBFRAAABwQbwBXAGkAZAB0AOgAVAhhAJZjcgAAoCghcABmAACgJCFjAHIAAOA12LXc4QtCEEkQTRAAAGcQbRByEAAAAAAAAAAAeRCKEJcQ8hD9EAAAGxEhETIROREAAD4RYwB1AHQAZQA7gOEA4UByImV2ZQADYYCiPiJFZGl1eQBWEFkQWxBgEGUQAOA+IjMDAKA/InIAYwA7gOIA4kB0AGUAO4C0ALRAMGRsAGkAZwA7gOYA5kByoGEgAOA12B7dcgBhAHYAZQA7gOAA4EAAAWVwfBCGEAABZnCAEIQQ8yF5bQCgNSHoAIMQaABhALFjAAFhcI0QWwAAAWNskRCTEHIAAWFnAACgPypkApwQAAAAALEQAKInImFkc3ajEKcQqRCuEG4AZAAAoFUqAKBcKmwib3BlAACgWCoAoFoqAKMgImVsbXJzersQvRDAEN0Q5RDtEACgpCllAACgICJzAGQAYaAhImEEzhDQENIQ1BDWENgQ2hDcEACgqCkAoKkpAKCqKQCgqykAoKwpAKCtKQCgrikAoK8pdAB2oB8iYgBkoL4iAKCdKQABcHTpEOwQaAAAoCIixWDhIXJyAKB8IwABZ3D1EPgQbwBuAAVhZgAA4DXYUt0Ao0giRWFlaW9wBxEJEQ0RDxESERQRAKBwKuMhaXIAoG8qAKBKImQAAKBLInMAJ2DyIW94ZaBIIvEADhFpAG4AZwA7gOUA5UCAAWN0eQAmESoRKxFyAADgNdi23CpgbQBwAGWgSCLxAPgBaQBsAGQAZQA7gOMA40BtAGwAO4DkAORAAAFjaUERRxFvAG4AaQBuAPQA6AFuAHQAAKARKgAITmFiY2RlZmlrbG5vcHJzdWQRaBGXEZ8RpxGrEdIR1hErEjASexKKEn0RThNbE3oTbwB0AACg7SoAAWNybBGJEWsAAAJjZXBzdBF4EX0RghHvIW5nAKBMInAjc2lsb24A9mNyImltZQAAoDUgaQBtAGWgPSJxAACgzSJ2AY0RkRFlAGUAAKC9ImUAZABnoAUjZQAAoAUjcgBrAHSgtSPiIXJrAKC2IwABb3mjEaYRbgDnAHcRMWTxIXVvAKAeIIACY21wcnQAtBG5Eb4RwRHFEeEhdXPloDUi5ABwInR5dgAAoLApcwDpAH0RbgBvAPUA6gCAAWFodwDLEcwRzhGyYwCgNiHlIWVuAKBsInIAAOA12B/dZwCAA2Nvc3R1dncA4xHyEQUSEhIhEiYSKRKAAWFpdQDpEesR7xHwAKMFcgBjAACg7yVwAACgwyKAAWRwdAD4EfwRABJvAHQAAKAAKuwhdXMAoAEqaSJtZXMAAKACKnECCxIAAAAADxLjIXVwAKAGKmEAcgAAoAUm8iNpYW5nbGUAAWR1GhIeEu8hd24AoL0lcAAAoLMlcCJsdXMAAKAEKmUA5QBCD+UAkg9hInJvdwAAoA0pgAFha28ANhJoEncSAAFjbjoSZRJrAIABbHN0AEESRxJNEm8jemVuZ2UAAKDrKXEAdQBhAHIA5QBcBPIjaWFuZ2xlgKG0JWRscgBYElwSYBLvIXduAKC+JeUhZnQAoMIlaSJnaHQAAKC4JWsAAKAjJLEBbRIAAHUSsgFxEgAAcxIAoJIlAKCRJTQAAKCTJWMAawAAoIglAAFlb38ShxJx4D0A5SD1IWl2AOBhIuUgdAAAoBAjAAJwdHd4kRKVEpsSnxJmAADgNdhT3XSgpSJvAG0AAKClIvQhaWUAoMgiAAZESFVWYmRobXB0dXayEsES0RLgEvcS+xIKExoTHxMjEygTNxMAAkxSbHK5ErsSvRK/EgCgVyUAoFQlAKBWJQCgUyUAolAlRFVkdckSyxLNEs8SAKBmJQCgaSUAoGQlAKBnJQACTFJsctgS2hLcEt4SAKBdJQCgWiUAoFwlAKBZJQCjUSVITFJobHLrEu0S7xLxEvMS9RIAoGwlAKBjJQCgYCUAoGslAKBiJQCgXyVvAHgAAKDJKQACTFJscgITBBMGEwgTAKBVJQCgUiUAoBAlAKAMJQCiACVEVWR1EhMUExYTGBMAoGUlAKBoJQCgLCUAoDQlaSJudXMAAKCfIuwhdXMAoJ4iaSJtZXMAAKCgIgACTFJsci8TMRMzEzUTAKBbJQCgWCUAoBglAKAUJQCjAiVITFJobHJCE0QTRhNIE0oTTBMAoGolAKBhJQCgXiUAoDwlAKAkJQCgHCUAAWV2UhNVE3YA5QD5AGIAYQByADuApgCmQAACY2Vpb2ITZhNqE24TcgAA4DXYt9xtAGkAAKBPIG0A5aA9IogRbAAAoVwAYmh0E3YTAKDFKfMhdWIAoMgnbAF+E4QTbABloCIgdAAAoCIgcAAAoU4iRWWJE4sTAKCuKvGgTyI8BeEMqRMAAN8TABQDFB8UAAAjFDQUAAAAAIUUAAAAAI0UAAAAANcU4xT3FPsUAACIFQAAlhWAAWNwcgCuE7ET1RP1IXRlB2GAoikiYWJjZHMAuxO/E8QTzhPSE24AZAAAoEQqciJjdXAAAKBJKgABYXXIE8sTcAAAoEsqcAAAoEcqbwB0AACgQCoA4CkiAP4AAWVv2RPcE3QAAKBBIO4ABAUAAmFlaXXlE+8T9RP4E/AB6hMAAO0TcwAAoE0qbwBuAA1hZABpAGwAO4DnAOdAcgBjAAlhcABzAHOgTCptAACgUCpvAHQAC2GAAWRtbgAIFA0UEhRpAGwAO4C4ALhAcCJ0eXYAAKCyKXQAAIGiADtlGBQZFKJAcgBkAG8A9ABiAXIAAOA12CDdgAFjZWkAKBQqFDIUeQBHZGMAawBtoBMn4SFyawCgEyfHY3IAAKPLJUVjZWZtcz8UQRRHFHcUfBSAFACgwykAocYCZWxGFEkUcQAAoFciZQBhAlAUAAAAAGAUciJyb3cAAAFsclYUWhTlIWZ0AKC6IWkiZ2h0AACguyGAAlJTYWNkAGgUaRRrFG8UcxSuYACgyCRzAHQAAKCbIukhcmMAoJoi4SFzaACgnSJuImludAAAoBAqaQBkAACg7yrjIWlyAKDCKfUhYnN1oGMmaQB0AACgYybsApMUmhS2FAAAwxRvAG4AZaA6APGgVCKrAG0CnxQAAAAAoxRhAHSgLABAYAChASJmbKcUqRTuABMNZQAAAW14rhSyFOUhbnQAoAEiZQDzANIB5wG6FAAAwBRkoEUibwB0AACgbSpuAPQAzAGAAWZyeQDIFMsUzhQA4DXYVN1vAOQA1wEAgakAO3MeAdMUcgAAoBchAAFhb9oU3hRyAHIAAKC1IXMAcwAAoBcnAAFjdeYU6hRyAADgNdi43AABYnDuFPIUZaDPKgCg0SploNAqAKDSKuQhb3QAoO8igANkZWxwcnZ3AAYVEBUbFSEVRBVlFYQV4SFycgABbHIMFQ4VAKA4KQCgNSlwAhYVAAAAABkVcgAAoN4iYwAAoN8i4SFycnCgtiEAoD0pgKIqImJjZG9zACsVMBU6FT4VQRVyImNhcAAAoEgqAAFhdTQVNxVwAACgRipwAACgSipvAHQAAKCNInIAAKBFKgDgKiIA/gACYWxydksVURVuFXMVcgByAG2gtyEAoDwpeQCAAWV2dwBYFWUVaRVxAHACXxUAAAAAYxVyAGUA4wAXFXUA4wAZFWUAZQAAoM4iZSJkZ2UAAKDPImUAbgA7gKQApEBlI2Fycm93AAABbHJ7FX8V5SFmdACgtiFpImdodAAAoLchZQDkAG0VAAFjaYsVkRVvAG4AaQBuAPQAkwFuAHQAAKAxImwiY3R5AACgLSOACUFIYWJjZGVmaGlqbG9yc3R1d3oAuBW7Fb8V1RXgFegV+RUKFhUWHxZUFlcWZRbFFtsW7xb7FgUXChdyAPIAtAJhAHIAAKBlKQACZ2xyc8YVyhXOFdAV5yFlcgCgICDlIXRoAKA4IfIA9QxoAHagECAAoKMiawHZFd4VYSJyb3cAAKAPKWEA4wBfAgABYXnkFecV8iFvbg9hNGQAoUYhYW/tFfQVAAFnciEC8RVyAACgyiF0InNlcQAAoHcqgAFnbG0A/xUCFgUWO4CwALBAdABhALRjcCJ0eXYAAKCxKQABaXIOFhIW8yFodACgfykA4DXYId1hAHIAAAFschsWHRYAoMMhAKDCIYACYWVnc3YAKBauAjYWOhY+Fm0AAKHEIm9zLhY0Fm4AZABzoMQi9SFpdACgZiZhIm1tYQDdY2kAbgAAoPIiAKH3AGlvQxZRFmQAZQAAgfcAO29KFksW90BuI3RpbWVzAACgxyJuAPgAUBZjAHkAUmRjAG8CXhYAAAAAYhZyAG4AAKAeI28AcAAAoA0jgAJscHR1dwBuFnEWdRaSFp4W7CFhciRgZgAA4DXYVd0AotkCZW1wc30WhBaJFo0WcQBkoFAibwB0AACgUSJpIm51cwAAoDgi7CF1cwCgFCLxInVhcmUAoKEiYgBsAGUAYgBhAHIAdwBlAGQAZwDlANcAbgCAAWFkaAClFqoWtBZyAHIAbwD3APUMbwB3AG4AYQByAHIAbwB3APMA8xVhI3Jwb29uAAABbHK8FsAWZQBmAPQAHBZpAGcAaAD0AB4WYgHJFs8WawBhAHIAbwD3AJILbwLUFgAAAADYFnIAbgAAoB8jbwBwAACgDCOAAWNvdADhFukW7BYAAXJ55RboFgDgNdi53FVkbAAAoPYp8iFvaxFhAAFkcvMW9xZvAHQAAKDxImkA5qC/JVsSAAFhaP8WAhdyAPIANQNhAPIA1wvhIm5nbGUAoKYpAAFjaQ4XEBd5AF9k5yJyYXJyAKD/JwAJRGFjZGVmZ2xtbm9wcXJzdHV4MRc4F0YXWxcyBF4XaRd5F40XrBe0F78X2RcVGCEYLRg1GEAYAAFEbzUXgRZvAPQA+BUAAWNzPBdCF3UAdABlADuA6QDpQPQhZXIAoG4qAAJhaW95TRdQF1YXWhfyIW9uG2FyAGOgViI7gOoA6kDsIW9uAKBVIk1kbwB0ABdhAAFEcmIXZhdvAHQAAKBSIgDgNdgi3XKhmipuF3QXYQB2AGUAO4DoAOhAZKCWKm8AdAAAoJgqgKGZKmlscwCAF4UXhxfuInRlcnMAoOcjAKATIWSglSpvAHQAAKCXKoABYXBzAJMXlheiF2MAcgATYXQAeQBzogUinxcAAAAAoRdlAHQAAKAFInAAMaADIDMBqRerFwCgBCAAoAUgAAFnc7AXsRdLYXAAAKACIAABZ3C4F7sXbwBuABlhZgAA4DXYVt2AAWFscwDFF8sXzxdyAHOg1SJsAACg4yl1AHMAAKBxKmkAAKG1A2x21RfYF28AbgC1Y/VjAAJjc3V24BfoF/0XEBgAAWlv5BdWF3IAYwAAoFYiaQLuFwAAAADwF+0ADQThIW50AAFnbPUX+Rd0AHIAAKCWKuUhc3MAoJUqgAFhZWkAAxgGGAoYbABzAD1gcwB0AACgXyJ2AESgYSJEAACgeCrwImFyc2wAoOUpAAFEYRkYHRhvAHQAAKBTInIAcgAAoHEpgAFjZGkAJxgqGO0XcgAAoC8hbwD0AIwCAAFhaDEYMhi3YzuA8ADwQAABbXI5GD0YbAA7gOsA60BvAACgrCCAAWNpcABGGEgYSxhsACFgcwD0ACwEAAFlb08YVxhjAHQAYQB0AGkAbwDuABoEbgBlAG4AdABpAGEAbADlADME4Ql1GAAAgRgAAIMYiBgAAAAAoRilGAAAqhgAALsYvhjRGAAA1xgnGWwAbABpAG4AZwBkAG8AdABzAGUA8QBlF3kARGRtImFsZQAAoEAmgAFpbHIAjRiRGJ0Y7CFpZwCgA/tpApcYAAAAAJoYZwAAoAD7aQBnAACgBPsA4DXYI93sIWlnAKAB++whaWcA4GYAagCAAWFsdACvGLIYthh0AACgbSZpAGcAAKAC+24AcwAAoLElbwBmAJJh8AHCGAAAxhhmAADgNdhX3QABYWvJGMwYbADsAGsEdqDUIgCg2SphI3J0aW50AACgDSoAAWFv2hgiGQABY3PeGB8ZsQPnGP0YBRkSGRUZAAAdGbID7xjyGPQY9xj5GAAA+xg7gL0AvUAAoFMhO4C8ALxAAKBVIQCgWSEAoFshswEBGQAAAxkAoFQhAKBWIbQCCxkOGQAAAAAQGTuAvgC+QACgVyEAoFwhNQAAoFghtgEZGQAAGxkAoFohAKBdITgAAKBeIWwAAKBEIHcAbgAAoCIjYwByAADgNdi73IAIRWFiY2RlZmdpamxub3JzdHYARhlKGVoZXhlmGWkZkhmWGZkZnRmgGa0ZxhnLGc8Z4BkjGmygZyIAoIwqgAFjbXAAUBlTGVgZ9SF0ZfVhbQBhAOSgswM6FgCghipyImV2ZQAfYQABaXliGWUZcgBjAB1hM2RvAHQAIWGAoWUibHFzAMYEcBl6GfGhZSLOBAAAdhlsAGEAbgD0AN8EgKF+KmNkbACBGYQZjBljAACgqSpvAHQAb6CAKmyggioAoIQqZeDbIgD+cwAAoJQqcgAA4DXYJN3noGsirATtIWVsAKA3IWMAeQBTZIChdyJFYWoApxmpGasZAKCSKgCgpSoAoKQqAAJFYWVztBm2Gb0ZwhkAoGkicABwoIoq8iFveACgiipxoIgq8aCIKrUZaQBtAACg5yJwAGYAAOA12FjdYQB2AOUAYwIAAWNp0xnWGXIAAKAKIW0AAKFzImVs3BneGQCgjioAoJAqAIM+ADtjZGxxco0E6xn0GfgZ/BkBGgABY2nvGfEZAKCnKnIAAKB6Km8AdAAAoNci0CFhcgCglSl1ImVzdAAAoHwqgAJhZGVscwAKGvQZFhrVBCAa8AEPGgAAFBpwAHIAbwD4AFkZcgAAoHgpcQAAAWxxxAQbGmwAZQBzAPMASRlpAO0A5AQAAWVuJxouGnIjdG5lcXEAAOBpIgD+xQAsGgAFQWFiY2Vma29zeUAaQxpmGmoabRqDGocalhrCGtMacgDyAMwCAAJpbG1yShpOGlAaVBpyAHMA8ABxD2YAvWBpAGwA9AASBQABZHJYGlsaYwB5AEpkAKGUIWN3YBpkGmkAcgAAoEgpAKCtIWEAcgAAoA8h6SFyYyVhgAFhbHIAcxp7Gn8a8iF0c3WgZSZpAHQAAKBlJuwhaXAAoCYg4yFvbgCguSJyAADgNdgl3XMAAAFld4wakRphInJvdwAAoCUpYSJyb3cAAKAmKYACYW1vcHIAnxqjGqcauhq+GnIAcgAAoP8h9CFodACgOyJrAAABbHKsGrMaZSRmdGFycm93AACgqSHpJGdodGFycm93AKCqIWYAAOA12Fnd4iFhcgCgFSCAAWNsdADIGswa0BpyAADgNdi93GEAcwDoAGka8iFvaydhAAFicNca2xr1IWxsAKBDIOghZW4AoBAg4Qr2GgAA/RoAAAgbExsaGwAAIRs7GwAAAAA+G2IbmRuVG6sbAACyG80b0htjAHUAdABlADuA7QDtQAChYyBpeQEbBhtyAGMAO4DuAO5AOGQAAWN4CxsNG3kANWRjAGwAO4ChAKFAAAFmcssCFhsA4DXYJt1yAGEAdgBlADuA7ADsQIChSCFpbm8AJxsyGzYbAAFpbisbLxtuAHQAAKAMKnQAAKAtIuYhaW4AoNwpdABhAACgKSHsIWlnM2GAAWFvcABDG1sbXhuAAWNndABJG0sbWRtyACthgAFlbHAAcQVRG1UbaQBuAOUAyAVhAHIA9AByBWgAMWFmAACgtyJlAGQAtWEAoggiY2ZvdGkbbRt1G3kb4SFyZQCgBSFpAG4AdKAeImkAZQAAoN0pZABvAPQAWxsAoisiY2VscIEbhRuPG5QbYQBsAACguiIAAWdyiRuNG2UAcgDzACMQ4wCCG2EicmhrAACgFyryIW9kAKA8KgACY2dwdJ8boRukG6gbeQBRZG8AbgAvYWYAAOA12FrdYQC5Y3UAZQBzAHQAO4C/AL9AAAFjabUbuRtyAADgNdi+3G4AAKIIIkVkc3bCG8QbyBvQAwCg+SJvAHQAAKD1Inag9CIAoPMiaaBiIOwhZGUpYesB1hsAANkbYwB5AFZkbAA7gO8A70AAA2NmbW9zdeYb7hvyG/Ub+hsFHAABaXnqG+0bcgBjADVhOWRyAADgNdgn3eEhdGg3YnAAZgAA4DXYW93jAf8bAAADHHIAAOA12L/c8iFjeVhk6yFjeVRkAARhY2ZnaGpvcxUcGhwiHCYcKhwtHDAcNRzwIXBhdqC6A/BjAAFleR4cIRzkIWlsN2E6ZHIAAOA12CjdciJlZW4AOGFjAHkARWRjAHkAXGRwAGYAAOA12FzdYwByAADgNdjA3IALQUJFSGFiY2RlZmdoamxtbm9wcnN0dXYAXhxtHHEcdRx5HN8cBx0dHTwd3B3tHfEdAR4EHh0eLB5FHrwewx7hHgkfPR9LH4ABYXJ0AGQcZxxpHHIA8gBvB/IAxQLhIWlsAKAbKeEhcnIAoA4pZ6BmIgCgiyphAHIAAKBiKWMJjRwAAJAcAACVHAAAAAAAAAAAAACZHJwcAACmHKgcrRwAANIc9SF0ZTph7SJwdHl2AKC0KXIAYQDuAFoG4iFkYbtjZwAAoegnZGyhHKMcAKCRKeUAiwYAoIUqdQBvADuAqwCrQHIAgKOQIWJmaGxwc3QAuhy/HMIcxBzHHMoczhxmoOQhcwAAoB8pcwAAoB0p6wCyGnAAAKCrIWwAAKA5KWkAbQAAoHMpbAAAoKIhAKGrKmFl1hzaHGkAbAAAoBkpc6CtKgDgrSoA/oABYWJyAOUc6RztHHIAcgAAoAwpcgBrAACgcicAAWFr8Rz4HGMAAAFla/Yc9xx7YFtgAAFlc/wc/hwAoIspbAAAAWR1Ax0FHQCgjykAoI0pAAJhZXV5Dh0RHRodHB3yIW9uPmEAAWRpFR0YHWkAbAA8YewAowbiAPccO2QAAmNxcnMkHScdLB05HWEAAKA2KXUAbwDyoBwgqhEAAWR1MB00HeghYXIAoGcpcyJoYXIAAKBLKWgAAKCyIQCiZCJmZ3FzRB1FB5Qdnh10AIACYWhscnQATh1WHWUdbB2NHXIicm93AHSgkCFhAOkAzxxhI3Jwb29uAAABZHVeHWId7yF3bgCgvSFwAACgvCHlJGZ0YXJyb3dzAKDHIWkiZ2h0AIABYWhzAHUdex2DHXIicm93APOglCGdBmEAcgBwAG8AbwBuAPMAzgtxAHUAaQBnAGEAcgByAG8A9wBlGugkcmVldGltZXMAoMsi8aFkIk0HAACaHWwAYQBuAPQAXgcAon0qY2Rnc6YdqR2xHbcdYwAAoKgqbwB0AG+gfypyoIEqAKCDKmXg2iIA/nMAAKCTKoACYWRlZ3MAwB3GHcod1h3ZHXAAcAByAG8A+ACmHG8AdAAAoNYicQAAAWdxzx3SHXQA8gBGB2cAdADyAHQcdADyAFMHaQDtAGMHgAFpbHIA4h3mHeod8yFodACgfClvAG8A8gDKBgDgNdgp3UWgdiIAoJEqYQH1Hf4dcgAAAWR1YB35HWygvCEAoGopbABrAACghCVjAHkAWWQAomoiYWNodAweDx4VHhkecgDyAGsdbwByAG4AZQDyAGAW4SFyZACgaylyAGkAAKD6JQABaW8hHiQe5CFvdEBh9SFzdGGgsCPjIWhlAKCwIwACRWFlczMeNR48HkEeAKBoInAAcKCJKvIhb3gAoIkqcaCHKvGghyo0HmkAbQAAoOYiAARhYm5vcHR3elIeXB5fHoUelh6mHqsetB4AAW5yVh5ZHmcAAKDsJ3IAAKD9IXIA6wCwBmcAgAFsbXIAZh52Hnse5SFmdAABYXKIB2weaQBnAGgAdABhAHIAcgBvAPcAkwfhInBzdG8AoPwnaQBnAGgAdABhAHIAcgBvAPcAmgdwI2Fycm93AAABbHKNHpEeZQBmAPQAxhxpImdodAAAoKwhgAFhZmwAnB6fHqIecgAAoIUpAOA12F3ddQBzAACgLSppIm1lcwAAoDQqYQGvHrMecwB0AACgFyLhAIoOZaHKJbkeRhLuIWdlAKDKJWEAcgBsoCgAdAAAoJMpgAJhY2htdADMHs8e1R7bHt0ecgDyAJ0GbwByAG4AZQDyANYWYQByAGSgyyEAoG0pAKAOIHIAaQAAoL8iAANhY2hpcXTrHu8e1QfzHv0eBh/xIXVvAKA5IHIAAOA12MHcbQDloXIi+h4AAPweAKCNKgCgjyoAAWJ19xwBH28AcqAYIACgGiDyIW9rQmEAhDwAO2NkaGlscXJCBhcfxh0gHyQfKB8sHzEfAAFjaRsfHR8AoKYqcgAAoHkqcgBlAOUAkx3tIWVzAKDJIuEhcnIAoHYpdSJlc3QAAKB7KgABUGk1HzkfYQByAACglillocMlAgdfEnIAAAFkdUIfRx9zImhhcgAAoEop6CFhcgCgZikAAWVuTx9WH3IjdG5lcXEAAOBoIgD+xQBUHwAHRGFjZGVmaGlsbm9wc3VuH3Ifoh+rH68ftx+7H74f5h/uH/MfBwj/HwsgxCFvdACgOiIAAmNscHJ5H30fiR+eH3IAO4CvAK9AAAFldIEfgx8AoEImZaAgJ3MAZQAAoCAnc6CmIXQAbwCAoaYhZGx1AJQfmB+cH28AdwDuAHkDZQBmAPQA6gbwAOkO6yFlcgCgriUAAW95ph+qH+0hbWEAoCkqPGThIXNoAKAUIOElc3VyZWRhbmdsZQCgISJyAADgNdgq3W8AAKAnIYABY2RuAMQfyR/bH3IAbwA7gLUAtUBhoiMi0B8AANMf1x9zAPQAKxFpAHIAAKDwKm8AdAA7gLcAt0B1AHMA4qESIh4TAADjH3WgOCIAoCoqYwHqH+0fcAAAoNsq8gB+GnAAbAB1APMACAgAAWRw9x/7H+UhbHMAoKciZgAA4DXYXt0AAWN0AyAHIHIAAOA12MLc8CFvcwCgPiJsobwDECAVIPQiaW1hcACguCJhAPAAEyAADEdMUlZhYmNkZWZnaGlqbG1vcHJzdHV2dzwgRyBmIG0geSCqILgg2iDeIBEhFSEyIUMhTSFQIZwhnyHSIQAiIyKLIrEivyIUIwABZ3RAIEMgAODZIjgD9uBrItIgBwmAAWVsdABNIF8gYiBmAHQAAAFhclMgWCByInJvdwAAoM0h6SRnaHRhcnJvdwCgziEA4NgiOAP24Goi0iBfCekkZ2h0YXJyb3cAoM8hAAFEZHEgdSDhIXNoAKCvIuEhc2gAoK4igAJiY25wdACCIIYgiSCNIKIgbABhAACgByL1IXRlRGFnAADgICLSIACiSSJFaW9wlSCYIJwgniAA4HAqOANkAADgSyI4A3MASWFyAG8A+AAyCnUAcgBhoG4mbADzoG4mmwjzAa8gAACzIHAAO4CgAKBAbQBwAOXgTiI4AyoJgAJhZW91eQDBIMogzSDWINkg8AHGIAAAyCAAoEMqbwBuAEhh5CFpbEZhbgBnAGSgRyJvAHQAAOBtKjgDcAAAoEIqPWThIXNoAKATIACjYCJBYWRxc3jpIO0g+SD+IAIhDCFyAHIAAKDXIXIAAAFocvIg9SBrAACgJClvoJch9wAGD28AdAAA4FAiOAN1AGkA9gC7CAABZWkGIQohYQByAACgKCntAN8I6SFzdPOgBCLlCHIAAOA12CvdAAJFZXN0/wgcISshLiHxoXEiIiEAABMJ8aFxIgAJAAAnIWwAYQBuAPQAEwlpAO0AGQlyoG8iAKBvIoABQWFwADghOyE/IXIA8gBeIHIAcgAAoK4hYQByAACg8ipzogsiSiEAAAAAxwtkoPwiAKD6ImMAeQBaZIADQUVhZGVzdABcIV8hYiFmIWkhkyGWIXIA8gBXIADgZiI4A3IAcgAAoJohcgAAoCUggKFwImZxcwBwIYQhjiF0AAABYXJ1IXohcgByAG8A9wBlIWkAZwBoAHQAYQByAHIAbwD3AD4h8aFwImAhAACKIWwAYQBuAPQAZwlz4H0qOAMAoG4iaQDtAG0JcqBuImkA5aDqIkUJaQDkADoKAAFwdKMhpyFmAADgNdhf3YCBrAA7aW4AriGvIcchrEBuAIChCSJFZHYAtyG6Ib8hAOD5IjgDbwB0AADg9SI4A+EB1gjEIcYhAKD3IgCg9iJpAHagDCLhAagJzyHRIQCg/iIAoP0igAFhb3IA2CHsIfEhcgCAoSYiYXN0AOAh5SHpIWwAbABlAOwAywhsAADg/SrlIADgAiI4A2wiaW50AACgFCrjoYAi9yEAAPohdQDlAJsJY+CvKjgDZaCAIvEAkwkAAkFhaXQHIgoiFyIeInIA8gBsIHIAcgAAoZshY3cRIhQiAOAzKTgDAOCdITgDZyRodGFycm93AACgmyFyAGkA5aDrIr4JgANjaGltcHF1AC8iPCJHIpwhTSJQIloigKGBImNlcgA2Iv0JOSJ1AOUABgoA4DXYw9zvIXJ0bQKdIQAAAABEImEAcgDhAOEhbQBloEEi8aBEIiYKYQDyAMsIcwB1AAABYnBWIlgi5QDUCeUA3wmAAWJjcABgInMieCKAoYQiRWVzAGci7glqIgDgxSo4A2UAdABl4IIi0iBxAPGgiCJoImMAZaCBIvEA/gmAoYUiRWVzAH8iFgqCIgDgxio4A2UAdABl4IMi0iBxAPGgiSKAIgACZ2lscpIilCKaIpwi7AAMCWwAZABlADuA8QDxQOcAWwlpI2FuZ2xlAAABbHKkIqoi5SFmdGWg6iLxAEUJaSJnaHQAZaDrIvEAvgltoL0DAKEjAGVzuCK8InIAbwAAoBYhcAAAoAcggARESGFkZ2lscnMAziLSItYi2iLeIugi7SICIw8j4SFzaACgrSLhIXJyAKAEKXAAAOBNItIg4SFzaACgrCIAAWV04iLlIgDgZSLSIADgPgDSIG4iZmluAACg3imAAUFldADzIvci+iJyAHIAAKACKQDgZCLSIHLgPADSIGkAZQAA4LQi0iAAAUF0BiMKI3IAcgAAoAMp8iFpZQDgtSLSIGkAbQAA4Dwi0iCAAUFhbgAaIx4jKiNyAHIAAKDWIXIAAAFociMjJiNrAACgIylvoJYh9wD/DuUhYXIAoCcpUxJqFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVCMAAF4jaSN/I4IjjSOeI8AUAAAAAKYjwCMAANoj3yMAAO8jHiQvJD8kRCQAAWNzVyNsFHUAdABlADuA8wDzQAABaXlhI2cjcgBjoJoiO4D0APRAPmSAAmFiaW9zAHEjdCN3I3EBeiNzAOgAdhTsIWFjUWF2AACgOCrvIWxkAKC8KewhaWdTYQABY3KFI4kjaQByAACgvykA4DXYLN1vA5QjAAAAAJYjAACcI24A22JhAHYAZQA7gPIA8kAAoMEpAAFibaEjjAphAHIAAKC1KQACYWNpdKwjryO6I70jcgDyAFkUAAFpcrMjtiNyAACgvinvIXNzAKC7KW4A5QDZCgCgwCmAAWFlaQDFI8gjyyNjAHIATWFnAGEAyWOAAWNkbgDRI9Qj1iPyIW9uv2MAoLYpdQDzAHgBcABmAADgNdhg3YABYWVsAOQj5yPrI3IAAKC3KXIAcAAAoLkpdQDzAHwBAKMoImFkaW9zdvkj/CMPJBMkFiQbJHIA8gBeFIChXSplZm0AAyQJJAwkcgBvoDQhZgAAoDQhO4CqAKpAO4C6ALpA5yFvZgCgtiJyAACgVipsIm9wZQAAoFcqAKBbKoABY2xvACMkJSQrJPIACCRhAHMAaAA7gPgA+EBsAACgmCJpAGwBMyQ4JGQAZQA7gPUA9UBlAHMAYaCXInMAAKA2Km0AbAA7gPYA9kDiIWFyAKA9I+EKXiQAAHokAAB8JJQkAACYJKkkAAAAALUkEQsAAPAkAAAAAAQleiUAAIMlcgCAoSUiYXN0AGUkbyQBCwCBtgA7bGokayS2QGwAZQDsABgDaQJ1JAAAAAB4JG0AAKDzKgCg/Sp5AD9kcgCAAmNpbXB0AIUkiCSLJJkSjyRuAHQAJWBvAGQALmBpAGwAAKAwIOUhbmsAoDEgcgAA4DXYLd2AAWltbwCdJKAkpCR2oMYD1WNtAGEA9AD+B24AZQAAoA4m9KHAA64kAAC0JGMjaGZvcmsAAKDUItZjAAFhdbgkxCRuAAABY2u9JMIkawBooA8hAKAOIfYAaRpzAACkKwBhYmNkZW1zdNMkIRPXJNsk4STjJOck6yTjIWlyAKAjKmkAcgAAoCIqAAFvdYsW3yQAoCUqAKByKm4AO4CxALFAaQBtAACgJip3AG8AAKAnKoABaXB1APUk+iT+JO4idGludACgFSpmAADgNdhh3W4AZAA7gKMAo0CApHoiRWFjZWlub3N1ABMlFSUYJRslTCVRJVklSSV1JQCgsypwAACgtyp1AOUAPwtjoK8qgKJ6ImFjZW5zACclLSU0JTYlSSVwAHAAcgBvAPgAFyV1AHIAbAB5AGUA8QA/C/EAOAuAAWFlcwA8JUElRSXwInByb3gAoLkqcQBxAACgtSppAG0AAKDoImkA7QBEC20AZQDzoDIgIguAAUVhcwBDJVclRSXwAEAlgAFkZnAATwtfJXElgAFhbHMAZSVpJW0l7CFhcgCgLiPpIW5lAKASI/UhcmYAoBMjdKAdIu8AWQvyIWVsAKCwIgABY2l9JYElcgAA4DXYxdzIY24iY3NwAACgCCAAA2Zpb3BzdZElKxuVJZolnyWkJXIAAOA12C7dcABmAADgNdhi3XIiaW1lAACgVyBjAHIAAOA12MbcgAFhZW8AqiW6JcAldAAAAWVpryW2JXIAbgBpAG8AbgDzABkFbgB0AACgFipzAHQAZaA/APEACRj0AG0LgApBQkhhYmNkZWZoaWxtbm9wcnN0dXgA4yXyJfYl+iVpJpAmpia9JtUm5ib4JlonaCdxJ3UnnietJ7EnyCfiJ+cngAFhcnQA6SXsJe4lcgDyAJkM8gD6AuEhaWwAoBwpYQByAPIA3BVhAHIAAKBkKYADY2RlbnFydAAGJhAmEyYYJiYmKyZaJgABZXUKJg0mAOA9IjEDdABlAFVhaQDjACAN7SJwdHl2AKCzKWcAgKHpJ2RlbAAgJiImJCYAoJIpAKClKeUA9wt1AG8AO4C7ALtAcgAApZIhYWJjZmhscHN0dz0mQCZFJkcmSiZMJk4mUSZVJlgmcAAAoHUpZqDlIXMAAKAgKQCgMylzAACgHinrALka8ACVHmwAAKBFKWkAbQAAoHQpbAAAoKMhAKCdIQABYWleJmImaQBsAACgGilvAG6gNiJhAGwA8wB2C4ABYWJyAG8mciZ2JnIA8gAvEnIAawAAoHMnAAFha3omgSZjAAABZWt/JoAmfWBdYAABZXOFJocmAKCMKWwAAAFkdYwmjiYAoI4pAKCQKQACYWV1eZcmmiajJqUm8iFvbllhAAFkaZ4moSZpAGwAV2HsAA8M4gCAJkBkAAJjbHFzrSawJrUmuiZhAACgNylkImhhcgAAoGkpdQBvAPKgHSCjAWgAAKCzIYABYWNnAMMm0iaUC2wAgKEcIWlwcwDLJs4migxuAOUAoAxhAHIA9ADaC3QAAKCtJYABaWxyANsm3ybjJvMhaHQAoH0pbwBvAPIANgwA4DXYL90AAWFv6ib1JnIAAAFkde8m8SYAoMEhbKDAIQCgbCl2oMED8WOAAWducwD+Jk4nUCdoAHQAAANhaGxyc3QKJxInISc1Jz0nRydyInJvdwB0oJIhYQDpAFYmYSNycG9vbgAAAWR1GiceJ28AdwDuAPAmcAAAoMAh5SFmdAABYWgnJy0ncgByAG8AdwDzAAkMYQByAHAAbwBvAG4A8wATBGklZ2h0YXJyb3dzAACgySFxAHUAaQBnAGEAcgByAG8A9wBZJugkcmVldGltZXMAoMwiZwDaYmkAbgBnAGQAbwB0AHMAZQDxABwYgAFhaG0AYCdjJ2YncgDyAAkMYQDyABMEAKAPIG8idXN0AGGgsSPjIWhlAKCxI+0haWQAoO4qAAJhYnB0fCeGJ4knmScAAW5ygCeDJ2cAAKDtJ3IAAKD+IXIA6wAcDIABYWZsAI8nkieVJ3IAAKCGKQDgNdhj3XUAcwAAoC4qaSJtZXMAAKA1KgABYXCiJ6gncgBnoCkAdAAAoJQp7yJsaW50AKASKmEAcgDyADwnAAJhY2hxuCe8J6EMwCfxIXVvAKA6IHIAAOA12MfcAAFidYAmxCdvAPKgGSCoAYABaGlyAM4n0ifWJ3IAZQDlAE0n7SFlcwCgyiJpAIChuSVlZmwAXAxjEt4n9CFyaQCgzinsInVoYXIAoGgpAKAeIWENBSgJKA0oSyhVKIYoAACLKLAoAAAAAOMo5ygAABApJCkxKW0pcSmHKaYpAACYKgAAAACxKmMidXRlAFthcQB1AO8ABR+ApHsiRWFjZWlucHN5ABwoHignKCooLygyKEEoRihJKACgtCrwASMoAAAlKACguCpvAG4AYWF1AOUAgw1koLAqaQBsAF9hcgBjAF1hgAFFYXMAOCg6KD0oAKC2KnAAAKC6KmkAbQAAoOki7yJsaW50AKATKmkA7QCIDUFkbwB0AGKixSKRFgAAAABTKACgZiqAA0FhY21zdHgAYChkKG8ocyh1KHkogihyAHIAAKDYIXIAAAFocmkoayjrAJAab6CYIfcAzAd0ADuApwCnQGkAO2D3IWFyAKApKW0AAAFpbn4ozQBuAHUA8wDOAHQAAKA2J3IA7+A12DDdIxkAAmFjb3mRKJUonSisKHIAcAAAoG8mAAFoeZkonChjAHkASWRIZHIAdABtAqUoAAAAAKgoaQDkAFsPYQByAGEA7ABsJDuArQCtQAABZ22zKLsobQBhAAChwwNmdroouijCY4CjPCJkZWdsbnByAMgozCjPKNMo1yjaKN4obwB0AACgairxoEMiCw5FoJ4qAKCgKkWgnSoAoJ8qZQAAoEYi7CF1cwCgJCrhIXJyAKByKWEAcgDyAPwMAAJhZWl07Sj8KAEpCCkAAWxz8Sj4KGwAcwBlAHQAbQDpAH8oaABwAACgMyrwImFyc2wAoOQpAAFkbFoPBSllAACgIyNloKoqc6CsKgDgrCoA/oABZmxwABUpGCkfKfQhY3lMZGKgLwBhoMQpcgAAoD8jZgAA4DXYZN1hAAABZHIoKRcDZQBzAHWgYCZpAHQAAKBgJoABY3N1ADYpRilhKQABYXU6KUApcABzoJMiAOCTIgD+cABzoJQiAOCUIgD+dQAAAWJwSylWKQChjyJlcz4NUCllAHQAZaCPIvEAPw0AoZAiZXNIDVspZQB0AGWgkCLxAEkNAKGhJWFmZilbBHIAZQFrKVwEAKChJWEAcgDyAAMNAAJjZW10dyl7KX8pgilyAADgNdjI3HQAbQDuAM4AaQDsAAYpYQByAOYAVw0AAWFyiimOKXIA5qAGJhESAAFhbpIpoylpImdodAAAAWVwmSmgKXAAcwBpAGwAbwDuANkXaADpAKAkcwCvYIACYmNtbnAArin8KY4NJSooKgCkgiJFZGVtbnByc7wpvinCKcgpzCnUKdgp3CkAoMUqbwB0AACgvSpkoIYibwB0AACgwyr1IWx0AKDBKgABRWXQKdIpAKDLKgCgiiLsIXVzAKC/KuEhcnIAoHkpgAFlaXUA4inxKfQpdAAAoYIiZW7oKewpcQDxoIYivSllAHEA8aCKItEpbQAAoMcqAAFicPgp+ikAoNUqAKDTKmMAgKJ7ImFjZW5zAAcqDSoUKhYqRihwAHAAcgBvAPgAIyh1AHIAbAB5AGUA8QCDDfEAfA2AAWFlcwAcKiIqPShwAHAAcgBvAPgAPChxAPEAOShnAACgaiYApoMiMTIzRWRlaGxtbnBzPCo/KkIqRSpHKlIqWCpjKmcqaypzKncqO4C5ALlAO4CyALJAO4CzALNAAKDGKgABb3NLKk4qdAAAoL4qdQBiAACg2CpkoIcibwB0AACgxCpzAAABb3VdKmAqbAAAoMknYgAAoNcq4SFycgCgeyn1IWx0AKDCKgABRWVvKnEqAKDMKgCgiyLsIXVzAKDAKoABZWl1AH0qjCqPKnQAAKGDImVugyqHKnEA8aCHIkYqZQBxAPGgiyJwKm0AAKDIKgABYnCTKpUqAKDUKgCg1iqAAUFhbgCdKqEqrCpyAHIAAKDZIXIAAAFocqYqqCrrAJUab6CZIfcAxQf3IWFyAKAqKWwAaQBnADuA3wDfQOELzyrZKtwq6SrsKvEqAAD1KjQrAAAAAAAAAAAAAEwrbCsAAHErvSsAAAAAAADRK3IC1CoAAAAA2CrnIWV0AKAWI8RjcgDrAOUKgAFhZXkA4SrkKucq8iFvbmVh5CFpbGNhQmRvAPQAIg5sInJlYwAAoBUjcgAA4DXYMd0AAmVpa2/7KhIrKCsuK/IBACsAAAkrZQAAATRm6g0EK28AcgDlAOsNYQBzorgDECsAAAAAEit5AG0A0WMAAWNuFislK2sAAAFhcxsrIStwAHAAcgBvAPgAFw5pAG0AAKA8InMA8AD9DQABYXMsKyEr8AAXDnIAbgA7gP4A/kDsATgrOyswG2QA5QBnAmUAcwCAgdcAO2JkAEMrRCtJK9dAYaCgInIAAKAxKgCgMCqAAWVwcwBRK1MraSvhAAkh4qKkIlsrXysAAAAAYytvAHQAAKA2I2kAcgAAoPEqb+A12GXdcgBrAACg2irhAHgociJpbWUAAKA0IIABYWlwAHYreSu3K2QA5QC+DYADYWRlbXBzdACFK6MrmiunK6wrsCuzK24iZ2xlAACitSVkbHFykCuUK5ornCvvIXduAKC/JeUhZnRloMMl8QACBwCgXCJpImdodABloLkl8QBdDG8AdAAAoOwlaSJudXMAAKA6KuwhdXMAoDkqYgAAoM0p6SFtZQCgOyrlInppdW0AoOIjgAFjaHQAwivKK80rAAFyecYrySsA4DXYydxGZGMAeQBbZPIhb2tnYQABaW/UK9creAD0ANERaCJlYWQAAAFsct4r5ytlAGYAdABhAHIAcgBvAPcAXQbpJGdodGFycm93AKCgIQAJQUhhYmNkZmdobG1vcHJzdHV3CiwNLBEsHSwnLDEsQCxLLFIsYix6LIQsjyzLLOgs7Sz/LAotcgDyAAkDYQByAACgYykAAWNyFSwbLHUAdABlADuA+gD6QPIACQ1yAOMBIywAACUseQBeZHYAZQBtYQABaXkrLDAscgBjADuA+wD7QENkgAFhYmgANyw6LD0scgDyANEO7CFhY3FhYQDyAOAOAAFpckQsSCzzIWh0AKB+KQDgNdgy3XIAYQB2AGUAO4D5APlAYQFWLF8scgAAAWxyWixcLACgvyEAoL4hbABrAACggCUAAWN0Zix2LG8CbCwAAAAAcyxyAG4AZaAcI3IAAKAcI28AcAAAoA8jcgBpAACg+CUAAWFsfiyBLGMAcgBrYTuAqACoQAABZ3CILIssbwBuAHNhZgAA4DXYZt0AA2FkaGxzdZksniynLLgsuyzFLHIAcgBvAPcACQ1vAHcAbgBhAHIAcgBvAPcA2A5hI3Jwb29uAAABbHKvLLMsZQBmAPQAWyxpAGcAaAD0AF0sdQDzAKYOaQAAocUDaGzBLMIs0mNvAG4AxWPwI2Fycm93cwCgyCGAAWNpdADRLOEs5CxvAtcsAAAAAN4scgBuAGWgHSNyAACgHSNvAHAAAKAOI24AZwBvYXIAaQAAoPklYwByAADgNdjK3IABZGlyAPMs9yz6LG8AdAAAoPAi7CFkZWlhaQBmoLUlAKC0JQABYW0DLQYtcgDyAMosbAA7gPwA/EDhIm5nbGUAoKcpgAdBQkRhY2RlZmxub3Byc3oAJy0qLTAtNC2bLZ0toS2/LcMtxy3TLdgt3C3gLfwtcgDyABADYQByAHag6CoAoOkqYQBzAOgA/gIAAW5yOC08LechcnQAoJwpgANla25wcnN0AJkpSC1NLVQtXi1iLYItYQBwAHAA4QAaHG8AdABoAGkAbgDnAKEXgAFoaXIAoSmzJFotbwBwAPQAdCVooJUh7wD4JgABaXVmLWotZwBtAOEAuygAAWJwbi14LXMjZXRuZXEAceCKIgD+AODLKgD+cyNldG5lcQBx4IsiAP4A4MwqAP4AAWhyhi2KLWUAdADhABIraSNhbmdsZQAAAWxyki2WLeUhZnQAoLIiaSJnaHQAAKCzInkAMmThIXNoAKCiIoABZWxyAKcttC24LWKiKCKuLQAAAACyLWEAcgAAoLsicQAAoFoi7CFpcACg7iIAAWJ0vC1eD2EA8gBfD3IAAOA12DPddAByAOkAlS1zAHUAAAFicM0t0C0A4IIi0iAA4IMi0iBwAGYAAOA12GfdcgBvAPAAWQt0AHIA6QCaLQABY3XkLegtcgAA4DXYy9wAAWJw7C30LW4AAAFFZXUt8S0A4IoiAP5uAAABRWV/LfktAOCLIgD+6SJnemFnAKCaKYADY2Vmb3BycwANLhAuJS4pLiMuLi40LukhcmN1YQABZGkULiEuAAFiZxguHC5hAHIAAKBfKmUAcaAnIgCgWSLlIXJwAKAYIXIAAOA12DTdcABmAADgNdho3WWgQCJhAHQA6ABqD2MAcgAA4DXYzNzjCuQRUC4AAFQuAABYLmIuAAAAAGMubS5wLnQuAAAAAIguki4AAJouJxIqEnQAcgDpAB0ScgAA4DXYNd0AAUFhWy5eLnIA8gDnAnIA8gCTB75jAAFBYWYuaS5yAPIA4AJyAPIAjAdhAPAAeh5pAHMAAKD7IoABZHB0APgReS6DLgABZmx9LoAuAOA12GnddQDzAP8RaQBtAOUABBIAAUFhiy6OLnIA8gDuAnIA8gCaBwABY3GVLgoScgAA4DXYzdwAAXB0nS6hLmwAdQDzACUScgDpACASAARhY2VmaW9zdbEuvC7ELsguzC7PLtQu2S5jAAABdXm2LrsudABlADuA/QD9QE9kAAFpecAuwy5yAGMAd2FLZG4AO4ClAKVAcgAA4DXYNt1jAHkAV2RwAGYAAOA12GrdYwByAADgNdjO3AABY23dLt8ueQBOZGwAO4D/AP9AAAVhY2RlZmhpb3N38y73Lv8uAi8MLxAvEy8YLx0vIi9jInV0ZQB6YQABYXn7Lv4u8iFvbn5hN2RvAHQAfGEAAWV0Bi8KL3QAcgDmAB8QYQC2Y3IAAOA12DfdYwB5ADZk5yJyYXJyAKDdIXAAZgAA4DXYa91jAHIAAOA12M/cAAFqbiYvKC8AoA0gagAAoAwg"),Nc=qi("AAJhZ2xxBwARABMAFQBtAg0AAAAAAA8AcAAmYG8AcwAnYHQAPmB0ADxg9SFvdCJg");var le;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.FLAG13=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(le||(le={}));var X;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(X||(X={}));const Gn=32;function Dr(e){return e>=X.ZERO&&e<=X.NINE}function Yc(e){return e>=X.UPPER_A&&e<=X.UPPER_F||e>=X.LOWER_A&&e<=X.LOWER_F}function Wc(e){return e>=X.UPPER_A&&e<=X.UPPER_Z||e>=X.LOWER_A&&e<=X.LOWER_Z||Dr(e)}function Vc(e){return e===X.EQUALS||Wc(e)}var ne;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(ne||(ne={}));var $e;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})($e||($e={}));class Kc{constructor(t,r,n){this.decodeTree=t,this.emitCodePoint=r,this.errors=n,this.state=ne.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=$e.Strict,this.runConsumed=0}startEntity(t){this.decodeMode=t,this.state=ne.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1,this.runConsumed=0}write(t,r){switch(this.state){case ne.EntityStart:return t.charCodeAt(r)===X.NUM?(this.state=ne.NumericStart,this.consumed+=1,this.stateNumericStart(t,r+1)):(this.state=ne.NamedEntity,this.stateNamedEntity(t,r));case ne.NumericStart:return this.stateNumericStart(t,r);case ne.NumericDecimal:return this.stateNumericDecimal(t,r);case ne.NumericHex:return this.stateNumericHex(t,r);case ne.NamedEntity:return this.stateNamedEntity(t,r)}}stateNumericStart(t,r){return r>=t.length?-1:(t.charCodeAt(r)|Gn)===X.LOWER_X?(this.state=ne.NumericHex,this.consumed+=1,this.stateNumericHex(t,r+1)):(this.state=ne.NumericDecimal,this.stateNumericDecimal(t,r))}stateNumericHex(t,r){for(;r<t.length;){const n=t.charCodeAt(r);if(Dr(n)||Yc(n)){const i=n<=X.NINE?n-X.ZERO:(n|Gn)-X.LOWER_A+10;this.result=this.result*16+i,this.consumed++,r++}else return this.emitNumericEntity(n,3)}return-1}stateNumericDecimal(t,r){for(;r<t.length;){const n=t.charCodeAt(r);if(Dr(n))this.result=this.result*10+(n-X.ZERO),this.consumed++,r++;else return this.emitNumericEntity(n,2)}return-1}emitNumericEntity(t,r){var n;if(this.consumed<=r)return(n=this.errors)===null||n===void 0||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(t===X.SEMI)this.consumed+=1;else if(this.decodeMode===$e.Strict)return 0;return this.emitCodePoint(Dc(this.result),this.consumed),this.errors&&(t!==X.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(t,r){const{decodeTree:n}=this;let i=n[this.treeIndex],s=(i&le.VALUE_LENGTH)>>14;for(;r<t.length;){if(s===0&&(i&le.FLAG13)!==0){const o=(i&le.BRANCH_LENGTH)>>7;if(this.runConsumed===0){const c=i&le.JUMP_TABLE;if(t.charCodeAt(r)!==c)return this.result===0?0:this.emitNotTerminatedNamedEntity();r++,this.excess++,this.runConsumed++}for(;this.runConsumed<o;){if(r>=t.length)return-1;const c=this.runConsumed-1,u=n[this.treeIndex+1+(c>>1)],h=c%2===0?u&255:u>>8&255;if(t.charCodeAt(r)!==h)return this.runConsumed=0,this.result===0?0:this.emitNotTerminatedNamedEntity();r++,this.excess++,this.runConsumed++}this.runConsumed=0,this.treeIndex+=1+(o>>1),i=n[this.treeIndex],s=(i&le.VALUE_LENGTH)>>14}if(r>=t.length)break;const a=t.charCodeAt(r);if(a===X.SEMI&&s!==0&&(i&le.FLAG13)!==0)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);if(this.treeIndex=Qc(n,i,this.treeIndex+Math.max(1,s),a),this.treeIndex<0)return this.result===0||this.decodeMode===$e.Attribute&&(s===0||Vc(a))?0:this.emitNotTerminatedNamedEntity();if(i=n[this.treeIndex],s=(i&le.VALUE_LENGTH)>>14,s!==0){if(a===X.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==$e.Strict&&(i&le.FLAG13)===0&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}r++,this.excess++}return-1}emitNotTerminatedNamedEntity(){var t;const{result:r,decodeTree:n}=this,i=(n[r]&le.VALUE_LENGTH)>>14;return this.emitNamedEntityData(r,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,r,n){const{decodeTree:i}=this;return this.emitCodePoint(r===1?i[t]&~(le.VALUE_LENGTH|le.FLAG13):i[t+1],n),r===3&&this.emitCodePoint(i[t+2],n),n}end(){var t;switch(this.state){case ne.NamedEntity:return this.result!==0&&(this.decodeMode!==$e.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ne.NumericDecimal:return this.emitNumericEntity(0,2);case ne.NumericHex:return this.emitNumericEntity(0,3);case ne.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ne.EntityStart:return 0}}}function Qc(e,t,r,n){const i=(t&le.BRANCH_LENGTH)>>7,s=t&le.JUMP_TABLE;if(i===0)return s!==0&&n===s?r:-1;if(s){const u=n-s;return u<0||u>=i?-1:e[r+u]-1}const a=i+1>>1;let o=0,c=i-1;for(;o<=c;){const u=o+c>>>1,h=u>>1,f=e[r+h]>>(u&1)*8&255;if(f<n)o=u+1;else if(f>n)c=u-1;else return e[r+a+u]}return-1}var E;(function(e){e[e.Tab=9]="Tab",e[e.NewLine=10]="NewLine",e[e.FormFeed=12]="FormFeed",e[e.CarriageReturn=13]="CarriageReturn",e[e.Space=32]="Space",e[e.ExclamationMark=33]="ExclamationMark",e[e.Number=35]="Number",e[e.Amp=38]="Amp",e[e.SingleQuote=39]="SingleQuote",e[e.DoubleQuote=34]="DoubleQuote",e[e.Dash=45]="Dash",e[e.Slash=47]="Slash",e[e.Zero=48]="Zero",e[e.Nine=57]="Nine",e[e.Semi=59]="Semi",e[e.Lt=60]="Lt",e[e.Eq=61]="Eq",e[e.Gt=62]="Gt",e[e.Questionmark=63]="Questionmark",e[e.UpperA=65]="UpperA",e[e.LowerA=97]="LowerA",e[e.UpperF=70]="UpperF",e[e.LowerF=102]="LowerF",e[e.UpperZ=90]="UpperZ",e[e.LowerZ=122]="LowerZ",e[e.LowerX=120]="LowerX",e[e.OpeningSquareBracket=91]="OpeningSquareBracket"})(E||(E={}));var m;(function(e){e[e.Text=1]="Text",e[e.BeforeTagName=2]="BeforeTagName",e[e.InTagName=3]="InTagName",e[e.InSelfClosingTag=4]="InSelfClosingTag",e[e.BeforeClosingTagName=5]="BeforeClosingTagName",e[e.InClosingTagName=6]="InClosingTagName",e[e.AfterClosingTagName=7]="AfterClosingTagName",e[e.BeforeAttributeName=8]="BeforeAttributeName",e[e.InAttributeName=9]="InAttributeName",e[e.AfterAttributeName=10]="AfterAttributeName",e[e.BeforeAttributeValue=11]="BeforeAttributeValue",e[e.InAttributeValueDq=12]="InAttributeValueDq",e[e.InAttributeValueSq=13]="InAttributeValueSq",e[e.InAttributeValueNq=14]="InAttributeValueNq",e[e.BeforeDeclaration=15]="BeforeDeclaration",e[e.InDeclaration=16]="InDeclaration",e[e.InProcessingInstruction=17]="InProcessingInstruction",e[e.BeforeComment=18]="BeforeComment",e[e.CDATASequence=19]="CDATASequence",e[e.InSpecialComment=20]="InSpecialComment",e[e.InCommentLike=21]="InCommentLike",e[e.BeforeSpecialS=22]="BeforeSpecialS",e[e.BeforeSpecialT=23]="BeforeSpecialT",e[e.SpecialStartSequence=24]="SpecialStartSequence",e[e.InSpecialTag=25]="InSpecialTag",e[e.InEntity=26]="InEntity"})(m||(m={}));function Se(e){return e===E.Space||e===E.NewLine||e===E.Tab||e===E.FormFeed||e===E.CarriageReturn}function Pt(e){return e===E.Slash||e===E.Gt||Se(e)}function Xc(e){return e>=E.LowerA&&e<=E.LowerZ||e>=E.UpperA&&e<=E.UpperZ}var ve;(function(e){e[e.NoValue=0]="NoValue",e[e.Unquoted=1]="Unquoted",e[e.Single=2]="Single",e[e.Double=3]="Double"})(ve||(ve={}));const te={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97]),XmpEnd:new Uint8Array([60,47,120,109,112])};class zc{constructor({xmlMode:t=!1,decodeEntities:r=!0},n){this.cbs=n,this.state=m.Text,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=m.Text,this.isSpecial=!1,this.running=!0,this.offset=0,this.currentSequence=void 0,this.sequenceIndex=0,this.xmlMode=t,this.decodeEntities=r,this.entityDecoder=new Kc(t?Nc:Lc,(i,s)=>this.emitCodePoint(i,s))}reset(){this.state=m.Text,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=m.Text,this.currentSequence=void 0,this.running=!0,this.offset=0}write(t){this.offset+=this.buffer.length,this.buffer=t,this.parse()}end(){this.running&&this.finish()}pause(){this.running=!1}resume(){this.running=!0,this.index<this.buffer.length+this.offset&&this.parse()}stateText(t){t===E.Lt||!this.decodeEntities&&this.fastForwardTo(E.Lt)?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=m.BeforeTagName,this.sectionStart=this.index):this.decodeEntities&&t===E.Amp&&this.startEntity()}stateSpecialStartSequence(t){const r=this.sequenceIndex===this.currentSequence.length;if(!(r?Pt(t):(t|32)===this.currentSequence[this.sequenceIndex]))this.isSpecial=!1;else if(!r){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=m.InTagName,this.stateInTagName(t)}stateInSpecialTag(t){if(this.sequenceIndex===this.currentSequence.length){if(t===E.Gt||Se(t)){const r=this.index-this.currentSequence.length;if(this.sectionStart<r){const n=this.index;this.index=r,this.cbs.ontext(this.sectionStart,r),this.index=n}this.isSpecial=!1,this.sectionStart=r+2,this.stateInClosingTagName(t);return}this.sequenceIndex=0}(t|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===te.TitleEnd?this.decodeEntities&&t===E.Amp&&this.startEntity():this.fastForwardTo(E.Lt)&&(this.sequenceIndex=1):this.sequenceIndex=+(t===E.Lt)}stateCDATASequence(t){t===te.Cdata[this.sequenceIndex]?++this.sequenceIndex===te.Cdata.length&&(this.state=m.InCommentLike,this.currentSequence=te.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=m.InDeclaration,this.stateInDeclaration(t))}fastForwardTo(t){for(;++this.index<this.buffer.length+this.offset;)if(this.buffer.charCodeAt(this.index-this.offset)===t)return!0;return this.index=this.buffer.length+this.offset-1,!1}stateInCommentLike(t){t===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===te.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index,2):this.cbs.oncomment(this.sectionStart,this.index,2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=m.Text):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):t!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}isTagStartChar(t){return this.xmlMode?!Pt(t):Xc(t)}startSpecial(t,r){this.isSpecial=!0,this.currentSequence=t,this.sequenceIndex=r,this.state=m.SpecialStartSequence}stateBeforeTagName(t){if(t===E.ExclamationMark)this.state=m.BeforeDeclaration,this.sectionStart=this.index+1;else if(t===E.Questionmark)this.state=m.InProcessingInstruction,this.sectionStart=this.index+1;else if(this.isTagStartChar(t)){const r=t|32;this.sectionStart=this.index,this.xmlMode?this.state=m.InTagName:r===te.ScriptEnd[2]?this.state=m.BeforeSpecialS:r===te.TitleEnd[2]||r===te.XmpEnd[2]?this.state=m.BeforeSpecialT:this.state=m.InTagName}else t===E.Slash?this.state=m.BeforeClosingTagName:(this.state=m.Text,this.stateText(t))}stateInTagName(t){Pt(t)&&(this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=m.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateBeforeClosingTagName(t){Se(t)||(t===E.Gt?this.state=m.Text:(this.state=this.isTagStartChar(t)?m.InClosingTagName:m.InSpecialComment,this.sectionStart=this.index))}stateInClosingTagName(t){(t===E.Gt||Se(t))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=m.AfterClosingTagName,this.stateAfterClosingTagName(t))}stateAfterClosingTagName(t){(t===E.Gt||this.fastForwardTo(E.Gt))&&(this.state=m.Text,this.sectionStart=this.index+1)}stateBeforeAttributeName(t){t===E.Gt?(this.cbs.onopentagend(this.index),this.isSpecial?(this.state=m.InSpecialTag,this.sequenceIndex=0):this.state=m.Text,this.sectionStart=this.index+1):t===E.Slash?this.state=m.InSelfClosingTag:Se(t)||(this.state=m.InAttributeName,this.sectionStart=this.index)}stateInSelfClosingTag(t){t===E.Gt?(this.cbs.onselfclosingtag(this.index),this.state=m.Text,this.sectionStart=this.index+1,this.isSpecial=!1):Se(t)||(this.state=m.BeforeAttributeName,this.stateBeforeAttributeName(t))}stateInAttributeName(t){(t===E.Eq||Pt(t))&&(this.cbs.onattribname(this.sectionStart,this.index),this.sectionStart=this.index,this.state=m.AfterAttributeName,this.stateAfterAttributeName(t))}stateAfterAttributeName(t){t===E.Eq?this.state=m.BeforeAttributeValue:t===E.Slash||t===E.Gt?(this.cbs.onattribend(ve.NoValue,this.sectionStart),this.sectionStart=-1,this.state=m.BeforeAttributeName,this.stateBeforeAttributeName(t)):Se(t)||(this.cbs.onattribend(ve.NoValue,this.sectionStart),this.state=m.InAttributeName,this.sectionStart=this.index)}stateBeforeAttributeValue(t){t===E.DoubleQuote?(this.state=m.InAttributeValueDq,this.sectionStart=this.index+1):t===E.SingleQuote?(this.state=m.InAttributeValueSq,this.sectionStart=this.index+1):Se(t)||(this.sectionStart=this.index,this.state=m.InAttributeValueNq,this.stateInAttributeValueNoQuotes(t))}handleInAttributeValue(t,r){t===r||!this.decodeEntities&&this.fastForwardTo(r)?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(r===E.DoubleQuote?ve.Double:ve.Single,this.index+1),this.state=m.BeforeAttributeName):this.decodeEntities&&t===E.Amp&&this.startEntity()}stateInAttributeValueDoubleQuotes(t){this.handleInAttributeValue(t,E.DoubleQuote)}stateInAttributeValueSingleQuotes(t){this.handleInAttributeValue(t,E.SingleQuote)}stateInAttributeValueNoQuotes(t){Se(t)||t===E.Gt?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(ve.Unquoted,this.index),this.state=m.BeforeAttributeName,this.stateBeforeAttributeName(t)):this.decodeEntities&&t===E.Amp&&this.startEntity()}stateBeforeDeclaration(t){t===E.OpeningSquareBracket?(this.state=m.CDATASequence,this.sequenceIndex=0):this.state=t===E.Dash?m.BeforeComment:m.InDeclaration}stateInDeclaration(t){(t===E.Gt||this.fastForwardTo(E.Gt))&&(this.cbs.ondeclaration(this.sectionStart,this.index),this.state=m.Text,this.sectionStart=this.index+1)}stateInProcessingInstruction(t){(t===E.Gt||this.fastForwardTo(E.Gt))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=m.Text,this.sectionStart=this.index+1)}stateBeforeComment(t){t===E.Dash?(this.state=m.InCommentLike,this.currentSequence=te.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=m.InDeclaration}stateInSpecialComment(t){(t===E.Gt||this.fastForwardTo(E.Gt))&&(this.cbs.oncomment(this.sectionStart,this.index,0),this.state=m.Text,this.sectionStart=this.index+1)}stateBeforeSpecialS(t){const r=t|32;r===te.ScriptEnd[3]?this.startSpecial(te.ScriptEnd,4):r===te.StyleEnd[3]?this.startSpecial(te.StyleEnd,4):(this.state=m.InTagName,this.stateInTagName(t))}stateBeforeSpecialT(t){switch(t|32){case te.TitleEnd[3]:{this.startSpecial(te.TitleEnd,4);break}case te.TextareaEnd[3]:{this.startSpecial(te.TextareaEnd,4);break}case te.XmpEnd[3]:{this.startSpecial(te.XmpEnd,4);break}default:this.state=m.InTagName,this.stateInTagName(t)}}startEntity(){this.baseState=this.state,this.state=m.InEntity,this.entityStart=this.index,this.entityDecoder.startEntity(this.xmlMode?$e.Strict:this.baseState===m.Text||this.baseState===m.InSpecialTag?$e.Legacy:$e.Attribute)}stateInEntity(){const t=this.index-this.offset,r=this.entityDecoder.write(this.buffer,t);if(r>=0)this.state=this.baseState,r===0&&(this.index-=1);else{if(t<this.buffer.length&&this.buffer.charCodeAt(t)===E.Amp){this.state=this.baseState,this.index-=1;return}this.index=this.offset+this.buffer.length-1}}cleanup(){this.running&&this.sectionStart!==this.index&&(this.state===m.Text||this.state===m.InSpecialTag&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===m.InAttributeValueDq||this.state===m.InAttributeValueSq||this.state===m.InAttributeValueNq)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}shouldContinue(){return this.index<this.buffer.length+this.offset&&this.running}parse(){for(;this.shouldContinue();){const t=this.buffer.charCodeAt(this.index-this.offset);switch(this.state){case m.Text:{this.stateText(t);break}case m.SpecialStartSequence:{this.stateSpecialStartSequence(t);break}case m.InSpecialTag:{this.stateInSpecialTag(t);break}case m.CDATASequence:{this.stateCDATASequence(t);break}case m.InAttributeValueDq:{this.stateInAttributeValueDoubleQuotes(t);break}case m.InAttributeName:{this.stateInAttributeName(t);break}case m.InCommentLike:{this.stateInCommentLike(t);break}case m.InSpecialComment:{this.stateInSpecialComment(t);break}case m.BeforeAttributeName:{this.stateBeforeAttributeName(t);break}case m.InTagName:{this.stateInTagName(t);break}case m.InClosingTagName:{this.stateInClosingTagName(t);break}case m.BeforeTagName:{this.stateBeforeTagName(t);break}case m.AfterAttributeName:{this.stateAfterAttributeName(t);break}case m.InAttributeValueSq:{this.stateInAttributeValueSingleQuotes(t);break}case m.BeforeAttributeValue:{this.stateBeforeAttributeValue(t);break}case m.BeforeClosingTagName:{this.stateBeforeClosingTagName(t);break}case m.AfterClosingTagName:{this.stateAfterClosingTagName(t);break}case m.BeforeSpecialS:{this.stateBeforeSpecialS(t);break}case m.BeforeSpecialT:{this.stateBeforeSpecialT(t);break}case m.InAttributeValueNq:{this.stateInAttributeValueNoQuotes(t);break}case m.InSelfClosingTag:{this.stateInSelfClosingTag(t);break}case m.InDeclaration:{this.stateInDeclaration(t);break}case m.BeforeDeclaration:{this.stateBeforeDeclaration(t);break}case m.BeforeComment:{this.stateBeforeComment(t);break}case m.InProcessingInstruction:{this.stateInProcessingInstruction(t);break}case m.InEntity:{this.stateInEntity();break}}this.index++}this.cleanup()}finish(){this.state===m.InEntity&&(this.entityDecoder.end(),this.state=this.baseState),this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const t=this.buffer.length+this.offset;this.sectionStart>=t||(this.state===m.InCommentLike?this.currentSequence===te.CdataEnd?this.cbs.oncdata(this.sectionStart,t,0):this.cbs.oncomment(this.sectionStart,t,0):this.state===m.InTagName||this.state===m.BeforeAttributeName||this.state===m.BeforeAttributeValue||this.state===m.AfterAttributeName||this.state===m.InAttributeName||this.state===m.InAttributeValueSq||this.state===m.InAttributeValueDq||this.state===m.InAttributeValueNq||this.state===m.InClosingTagName||this.cbs.ontext(this.sectionStart,t))}emitCodePoint(t,r){this.baseState!==m.Text&&this.baseState!==m.InSpecialTag?(this.sectionStart<this.entityStart&&this.cbs.onattribdata(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+r,this.index=this.sectionStart-1,this.cbs.onattribentity(t)):(this.sectionStart<this.entityStart&&this.cbs.ontext(this.sectionStart,this.entityStart),this.sectionStart=this.entityStart+r,this.index=this.sectionStart-1,this.cbs.ontextentity(t,this.sectionStart))}}const Xe=new Set(["input","option","optgroup","select","button","datalist","textarea"]),D=new Set(["p"]),_n=new Set(["thead","tbody"]),Dn=new Set(["dd","dt"]),Ln=new Set(["rt","rp"]),Hc=new Map([["tr",new Set(["tr","th","td"])],["th",new Set(["th"])],["td",new Set(["thead","th","td"])],["body",new Set(["head","link","script"])],["li",new Set(["li"])],["p",D],["h1",D],["h2",D],["h3",D],["h4",D],["h5",D],["h6",D],["select",Xe],["input",Xe],["output",Xe],["button",Xe],["datalist",Xe],["textarea",Xe],["option",new Set(["option"])],["optgroup",new Set(["optgroup","option"])],["dd",Dn],["dt",Dn],["address",D],["article",D],["aside",D],["blockquote",D],["details",D],["div",D],["dl",D],["fieldset",D],["figcaption",D],["figure",D],["footer",D],["form",D],["header",D],["hr",D],["main",D],["nav",D],["ol",D],["pre",D],["section",D],["table",D],["ul",D],["rt",Ln],["rp",Ln],["tbody",_n],["tfoot",_n]]),Jc=new Set(["area","base","basefont","br","col","command","embed","frame","hr","img","input","isindex","keygen","link","meta","param","source","track","wbr"]),Nn=new Set(["math","svg"]),Yn=new Set(["mi","mo","mn","ms","mtext","annotation-xml","foreignobject","desc","title"]),Zc=/\s|\//;class qc{constructor(t,r={}){var n,i,s,a,o,c;this.options=r,this.startIndex=0,this.endIndex=0,this.openTagStart=0,this.tagname="",this.attribname="",this.attribvalue="",this.attribs=null,this.stack=[],this.buffers=[],this.bufferOffset=0,this.writeIndex=0,this.ended=!1,this.cbs=t??{},this.htmlMode=!this.options.xmlMode,this.lowerCaseTagNames=(n=r.lowerCaseTags)!==null&&n!==void 0?n:this.htmlMode,this.lowerCaseAttributeNames=(i=r.lowerCaseAttributeNames)!==null&&i!==void 0?i:this.htmlMode,this.recognizeSelfClosing=(s=r.recognizeSelfClosing)!==null&&s!==void 0?s:!this.htmlMode,this.tokenizer=new((a=r.Tokenizer)!==null&&a!==void 0?a:zc)(this.options,this),this.foreignContext=[!this.htmlMode],(c=(o=this.cbs).onparserinit)===null||c===void 0||c.call(o,this)}ontext(t,r){var n,i;const s=this.getSlice(t,r);this.endIndex=r-1,(i=(n=this.cbs).ontext)===null||i===void 0||i.call(n,s),this.startIndex=r}ontextentity(t,r){var n,i;this.endIndex=r-1,(i=(n=this.cbs).ontext)===null||i===void 0||i.call(n,Un(t)),this.startIndex=r}isVoidElement(t){return this.htmlMode&&Jc.has(t)}onopentagname(t,r){this.endIndex=r;let n=this.getSlice(t,r);this.lowerCaseTagNames&&(n=n.toLowerCase()),this.emitOpenTag(n)}emitOpenTag(t){var r,n,i,s;this.openTagStart=this.startIndex,this.tagname=t;const a=this.htmlMode&&Hc.get(t);if(a)for(;this.stack.length>0&&a.has(this.stack[0]);){const o=this.stack.shift();(n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,o,!0)}this.isVoidElement(t)||(this.stack.unshift(t),this.htmlMode&&(Nn.has(t)?this.foreignContext.unshift(!0):Yn.has(t)&&this.foreignContext.unshift(!1))),(s=(i=this.cbs).onopentagname)===null||s===void 0||s.call(i,t),this.cbs.onopentag&&(this.attribs={})}endOpenTag(t){var r,n;this.startIndex=this.openTagStart,this.attribs&&((n=(r=this.cbs).onopentag)===null||n===void 0||n.call(r,this.tagname,this.attribs,t),this.attribs=null),this.cbs.onclosetag&&this.isVoidElement(this.tagname)&&this.cbs.onclosetag(this.tagname,!0),this.tagname=""}onopentagend(t){this.endIndex=t,this.endOpenTag(!1),this.startIndex=t+1}onclosetag(t,r){var n,i,s,a,o,c,u,h;this.endIndex=r;let l=this.getSlice(t,r);if(this.lowerCaseTagNames&&(l=l.toLowerCase()),this.htmlMode&&(Nn.has(l)||Yn.has(l))&&this.foreignContext.shift(),this.isVoidElement(l))this.htmlMode&&l==="br"&&((a=(s=this.cbs).onopentagname)===null||a===void 0||a.call(s,"br"),(c=(o=this.cbs).onopentag)===null||c===void 0||c.call(o,"br",{},!0),(h=(u=this.cbs).onclosetag)===null||h===void 0||h.call(u,"br",!1));else{const f=this.stack.indexOf(l);if(f!==-1)for(let A=0;A<=f;A++){const d=this.stack.shift();(i=(n=this.cbs).onclosetag)===null||i===void 0||i.call(n,d,A!==f)}else this.htmlMode&&l==="p"&&(this.emitOpenTag("p"),this.closeCurrentTag(!0))}this.startIndex=r+1}onselfclosingtag(t){this.endIndex=t,this.recognizeSelfClosing||this.foreignContext[0]?(this.closeCurrentTag(!1),this.startIndex=t+1):this.onopentagend(t)}closeCurrentTag(t){var r,n;const i=this.tagname;this.endOpenTag(t),this.stack[0]===i&&((n=(r=this.cbs).onclosetag)===null||n===void 0||n.call(r,i,!t),this.stack.shift())}onattribname(t,r){this.startIndex=t;const n=this.getSlice(t,r);this.attribname=this.lowerCaseAttributeNames?n.toLowerCase():n}onattribdata(t,r){this.attribvalue+=this.getSlice(t,r)}onattribentity(t){this.attribvalue+=Un(t)}onattribend(t,r){var n,i;this.endIndex=r,(i=(n=this.cbs).onattribute)===null||i===void 0||i.call(n,this.attribname,this.attribvalue,t===ve.Double?'"':t===ve.Single?"'":t===ve.NoValue?void 0:null),this.attribs&&!Object.prototype.hasOwnProperty.call(this.attribs,this.attribname)&&(this.attribs[this.attribname]=this.attribvalue),this.attribvalue=""}getInstructionName(t){const r=t.search(Zc);let n=r<0?t:t.substr(0,r);return this.lowerCaseTagNames&&(n=n.toLowerCase()),n}ondeclaration(t,r){this.endIndex=r;const n=this.getSlice(t,r);if(this.cbs.onprocessinginstruction){const i=this.getInstructionName(n);this.cbs.onprocessinginstruction(`!${i}`,`!${n}`)}this.startIndex=r+1}onprocessinginstruction(t,r){this.endIndex=r;const n=this.getSlice(t,r);if(this.cbs.onprocessinginstruction){const i=this.getInstructionName(n);this.cbs.onprocessinginstruction(`?${i}`,`?${n}`)}this.startIndex=r+1}oncomment(t,r,n){var i,s,a,o;this.endIndex=r,(s=(i=this.cbs).oncomment)===null||s===void 0||s.call(i,this.getSlice(t,r-n)),(o=(a=this.cbs).oncommentend)===null||o===void 0||o.call(a),this.startIndex=r+1}oncdata(t,r,n){var i,s,a,o,c,u,h,l,f,A;this.endIndex=r;const d=this.getSlice(t,r-n);!this.htmlMode||this.options.recognizeCDATA?((s=(i=this.cbs).oncdatastart)===null||s===void 0||s.call(i),(o=(a=this.cbs).ontext)===null||o===void 0||o.call(a,d),(u=(c=this.cbs).oncdataend)===null||u===void 0||u.call(c)):((l=(h=this.cbs).oncomment)===null||l===void 0||l.call(h,`[CDATA[${d}]]`),(A=(f=this.cbs).oncommentend)===null||A===void 0||A.call(f)),this.startIndex=r+1}onend(){var t,r;if(this.cbs.onclosetag){this.endIndex=this.startIndex;for(let n=0;n<this.stack.length;n++)this.cbs.onclosetag(this.stack[n],!0)}(r=(t=this.cbs).onend)===null||r===void 0||r.call(t)}reset(){var t,r,n,i;(r=(t=this.cbs).onreset)===null||r===void 0||r.call(t),this.tokenizer.reset(),this.tagname="",this.attribname="",this.attribs=null,this.stack.length=0,this.startIndex=0,this.endIndex=0,(i=(n=this.cbs).onparserinit)===null||i===void 0||i.call(n,this),this.buffers.length=0,this.foreignContext.length=0,this.foreignContext.unshift(!this.htmlMode),this.bufferOffset=0,this.writeIndex=0,this.ended=!1}parseComplete(t){this.reset(),this.end(t)}getSlice(t,r){for(;t-this.bufferOffset>=this.buffers[0].length;)this.shiftBuffer();let n=this.buffers[0].slice(t-this.bufferOffset,r-this.bufferOffset);for(;r-this.bufferOffset>this.buffers[0].length;)this.shiftBuffer(),n+=this.buffers[0].slice(0,r-this.bufferOffset);return n}shiftBuffer(){this.bufferOffset+=this.buffers[0].length,this.writeIndex--,this.buffers.shift()}write(t){var r,n;if(this.ended){(n=(r=this.cbs).onerror)===null||n===void 0||n.call(r,new Error(".write() after done!"));return}this.buffers.push(t),this.tokenizer.running&&(this.tokenizer.write(t),this.writeIndex++)}end(t){var r,n;if(this.ended){(n=(r=this.cbs).onerror)===null||n===void 0||n.call(r,new Error(".end() after done!"));return}t&&this.write(t),this.ended=!0,this.tokenizer.end()}pause(){this.tokenizer.pause()}resume(){for(this.tokenizer.resume();this.tokenizer.running&&this.writeIndex<this.buffers.length;)this.tokenizer.write(this.buffers[this.writeIndex++]);this.ended&&this.tokenizer.end()}parseChunk(t){this.write(t)}done(t){this.end(t)}}var G;(function(e){e.Root="root",e.Text="text",e.Directive="directive",e.Comment="comment",e.Script="script",e.Style="style",e.Tag="tag",e.CDATA="cdata",e.Doctype="doctype"})(G||(G={}));function jc(e){return e.type===G.Tag||e.type===G.Script||e.type===G.Style}G.Root;G.Text;G.Directive;G.Comment;G.Script;G.Style;G.Tag;G.CDATA;G.Doctype;class ji{constructor(){this.parent=null,this.prev=null,this.next=null,this.startIndex=null,this.endIndex=null}get parentNode(){return this.parent}set parentNode(t){this.parent=t}get previousSibling(){return this.prev}set previousSibling(t){this.prev=t}get nextSibling(){return this.next}set nextSibling(t){this.next=t}cloneNode(t=!1){return is(this,t)}}class pn extends ji{constructor(t){super(),this.data=t}get nodeValue(){return this.data}set nodeValue(t){this.data=t}}class Lr extends pn{constructor(){super(...arguments),this.type=G.Text}get nodeType(){return 3}}class es extends pn{constructor(){super(...arguments),this.type=G.Comment}get nodeType(){return 8}}class ts extends pn{constructor(t,r){super(r),this.name=t,this.type=G.Directive}get nodeType(){return 1}}class mn extends ji{constructor(t){super(),this.children=t}get firstChild(){var t;return(t=this.children[0])!==null&&t!==void 0?t:null}get lastChild(){return this.children.length>0?this.children[this.children.length-1]:null}get childNodes(){return this.children}set childNodes(t){this.children=t}}class rs extends mn{constructor(){super(...arguments),this.type=G.CDATA}get nodeType(){return 4}}class Nr extends mn{constructor(){super(...arguments),this.type=G.Root}get nodeType(){return 9}}class ns extends mn{constructor(t,r,n=[],i=t==="script"?G.Script:t==="style"?G.Style:G.Tag){super(n),this.name=t,this.attribs=r,this.type=i}get nodeType(){return 1}get tagName(){return this.name}set tagName(t){this.name=t}get attributes(){return Object.keys(this.attribs).map(t=>{var r,n;return{name:t,value:this.attribs[t],namespace:(r=this["x-attribsNamespace"])===null||r===void 0?void 0:r[t],prefix:(n=this["x-attribsPrefix"])===null||n===void 0?void 0:n[t]}})}}function el(e){return jc(e)}function tl(e){return e.type===G.CDATA}function rl(e){return e.type===G.Text}function nl(e){return e.type===G.Comment}function il(e){return e.type===G.Directive}function sl(e){return e.type===G.Root}function is(e,t=!1){let r;if(rl(e))r=new Lr(e.data);else if(nl(e))r=new es(e.data);else if(el(e)){const n=t?Cr(e.children):[],i=new ns(e.name,{...e.attribs},n);n.forEach(s=>s.parent=i),e.namespace!=null&&(i.namespace=e.namespace),e["x-attribsNamespace"]&&(i["x-attribsNamespace"]={...e["x-attribsNamespace"]}),e["x-attribsPrefix"]&&(i["x-attribsPrefix"]={...e["x-attribsPrefix"]}),r=i}else if(tl(e)){const n=t?Cr(e.children):[],i=new rs(n);n.forEach(s=>s.parent=i),r=i}else if(sl(e)){const n=t?Cr(e.children):[],i=new Nr(n);n.forEach(s=>s.parent=i),e["x-mode"]&&(i["x-mode"]=e["x-mode"]),r=i}else if(il(e)){const n=new ts(e.name,e.data);e["x-name"]!=null&&(n["x-name"]=e["x-name"],n["x-publicId"]=e["x-publicId"],n["x-systemId"]=e["x-systemId"]),r=n}else throw new Error(`Not implemented yet: ${e.type}`);return r.startIndex=e.startIndex,r.endIndex=e.endIndex,e.sourceCodeLocation!=null&&(r.sourceCodeLocation=e.sourceCodeLocation),r}function Cr(e){const t=e.map(r=>is(r,!0));for(let r=1;r<t.length;r++)t[r].prev=t[r-1],t[r-1].next=t[r];return t}const Wn={withStartIndices:!1,withEndIndices:!1,xmlMode:!1};class al{constructor(t,r,n){this.dom=[],this.root=new Nr(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null,typeof r=="function"&&(n=r,r=Wn),typeof t=="object"&&(r=t,t=void 0),this.callback=t??null,this.options=r??Wn,this.elementCB=n??null}onparserinit(t){this.parser=t}onreset(){this.dom=[],this.root=new Nr(this.dom),this.done=!1,this.tagStack=[this.root],this.lastNode=null,this.parser=null}onend(){this.done||(this.done=!0,this.parser=null,this.handleCallback(null))}onerror(t){this.handleCallback(t)}onclosetag(){this.lastNode=null;const t=this.tagStack.pop();this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),this.elementCB&&this.elementCB(t)}onopentag(t,r){const n=this.options.xmlMode?G.Tag:void 0,i=new ns(t,r,void 0,n);this.addNode(i),this.tagStack.push(i)}ontext(t){const{lastNode:r}=this;if(r&&r.type===G.Text)r.data+=t,this.options.withEndIndices&&(r.endIndex=this.parser.endIndex);else{const n=new Lr(t);this.addNode(n),this.lastNode=n}}oncomment(t){if(this.lastNode&&this.lastNode.type===G.Comment){this.lastNode.data+=t;return}const r=new es(t);this.addNode(r),this.lastNode=r}oncommentend(){this.lastNode=null}oncdatastart(){const t=new Lr(""),r=new rs([t]);this.addNode(r),t.parent=r,this.lastNode=t}oncdataend(){this.lastNode=null}onprocessinginstruction(t,r){const n=new ts(t,r);this.addNode(n)}handleCallback(t){if(typeof this.callback=="function")this.callback(t,this.dom);else if(t)throw t}addNode(t){const r=this.tagStack[this.tagStack.length-1],n=r.children[r.children.length-1];this.options.withStartIndices&&(t.startIndex=this.parser.startIndex),this.options.withEndIndices&&(t.endIndex=this.parser.endIndex),r.children.push(t),n&&(t.prev=n,n.next=t),t.parent=r,this.lastNode=null}}function ol(e,t){const r=new al(void 0,t);return new qc(r,t).end(e),r.root}const ss=e=>{let t="";return e.italic&&(t="italic "),e.bold&&(t+="bold "),`${t}${e.size}px '${e.font}',sans-serif`},Yr=(e,t)=>{dt(0);const r=e.lineTable.length;De.font=ss(t);const n=De.measureText(""),i={mode:"break",text:"",x:0,y:0,w:0,h:n.fontBoundingBoxAscent+n.fontBoundingBoxDescent,line:r,textFormat:t.toObject()};e.heightTable[r]=0,e.ascentTable[r]=0,e.widthTable[r]=0,e.lineTable.push(i),e.textTable.push(i)},cl=e=>{const t=e.heightTable.length-1;for(let r=1;r<t;++r){if(e.heightTable[r]>0)continue;const i=e.lineTable[r];i&&(e.heightTable[r]=i.h=e.heightTable[r-1])}},as=e=>{let t=0;return e.leftMargin&&(t+=e.leftMargin),e.rightMargin&&(t+=e.rightMargin),t},ll=(e,t,r,n)=>{let i=r.lineTable.length-1;const s=n.width-as(t)-4;for(let a=0;a<e.length;++a){const o=n.textFormats?n.textFormats.shift():t,c=e[a],u={mode:"text",text:c,x:0,y:0,w:0,h:0,line:i,textFormat:o.toObject()};De.font=ss(o);const h=De.measureText(c||""),l=o.letterSpacing?h.width+o.letterSpacing:h.width,f=o.leading?h.fontBoundingBoxAscent+h.fontBoundingBoxDescent+o.leading:h.fontBoundingBoxAscent+h.fontBoundingBoxDescent;if(u.x=0,u.y=h.fontBoundingBoxAscent,u.w=l,u.h=f,dt(Et()+l),n.wordWrap&&Et()>s){dt(l),i++,u.line=i;const A={mode:"wrap",text:"",x:0,y:0,w:0,h:0,line:i,textFormat:o.toObject()};let d=1,y=!0;const g=/[0-9a-zA-Z?!;:.,?!。、;:〜]/g;for(;;){const p=r.textTable.length-d;if(0>=p){y=!1,d=0;break}const $=r.textTable[p];if(!$){y=!1,d=0;break}if($.mode!=="text"){y=!1;break}if($.text===" "){d--;break}if(!$.text.match(g)){d--;break}d++}if(r.widthTable[i]=0,r.heightTable[i]=0,r.ascentTable[i]=0,d>0&&y){const p=r.textTable.length-d;r.textTable.splice(p,0,A),r.lineTable.push(A);const $=i-1;r.widthTable[$]=0,r.heightTable[$]=0,r.ascentTable[$]=0;for(let w=0;w<p;++w){const I=r.textTable[w];I&&I.line===$&&I.mode==="text"&&(r.widthTable[$]+=I.w,r.heightTable[$]=Math.max(r.heightTable[$],I.h),r.ascentTable[$]=Math.max(r.ascentTable[$],I.y))}dt(0);for(let w=p+1;w<r.textTable.length;++w){const I=r.textTable[w];I.line=i,dt(Et()+I.w)}}else r.textTable.push(A),r.lineTable.push(A)}r.widthTable[i]=Et(),r.heightTable[i]=Math.max(r.heightTable[i],f),r.ascentTable[i]=Math.max(r.ascentTable[i],u.y),r.textTable.push(u)}},ul=e=>{const t=e.trim().split(";"),r=[];for(let n=0;n<t.length;++n){const i=t[n];if(!i)continue;const s=i.split(":"),a=s[0].trim(),o=s[1].trim();switch(a){case"font-size":r.push({name:"size",value:parseInt(o)});break;case"font-family":r.push({name:"face",value:o.replace(/'|"/g,"")});break;case"letter-spacing":r.push({name:"letterSpacing",value:parseInt(o)});break;case"margin-bottom":r.push({name:"leading",value:parseInt(o)});break;case"margin-left":r.push({name:"leftMargin",value:parseInt(o)});break;case"margin-right":r.push({name:"rightMargin",value:parseInt(o)});break;case"color":case"align":r.push({name:a,value:o});break;case"text-decoration":case"font-weight":case"font-style":r.push({name:o,value:!0});break}}return r},Wr=(e,t,r)=>{for(let n=0;n<e.length;++n){const i=e[n];switch(i.name){case"style":Wr(ul(i.value),t,r);break;case"align":t.align=i.value;break;case"face":t.font=i.value;break;case"size":t.size=+i.value,r.subFontSize&&(t.size-=r.subFontSize,1>t.size&&(t.size=1));break;case"color":t.color=et(i.value);break;case"letterSpacing":t.letterSpacing=parseInt(i.value);break;case"leading":t.leading=parseInt(i.value);break;case"leftMargin":t.leftMargin=parseInt(i.value);break;case"rightMargin":t.rightMargin=parseInt(i.value);break;case"underline":t.underline=!0;break;case"bold":t.bold=!0;break;case"italic":t.italic=!0;break}}},Vr=(e,t,r,n)=>{for(let i=0;i<e.children.length;++i){const s=e.children[i];if(s.nodeType===3){ll(s.nodeValue||"",t,r,n);continue}const a=t.clone();switch(s.name.toUpperCase()){case"DIV":case"P":Wr(s.attributes,a,n),n.multiline&&Yr(r,a),Vr(s,a,r,n);continue;case"U":a.underline=!0;break;case"B":a.bold=!0;break;case"I":a.italic=!0;break;case"FONT":case"SPAN":Wr(s.attributes,a,n);break;case"BR":if(!n.multiline)continue;Yr(r,a);break}Vr(s,a,r,n)}},hl=(e,t,r)=>{const n=new Gc;if(!e)return n;const i=e.trim().replace(/\r?\n/g,"").replace(/\t/g,""),s=t.clone();return r.subFontSize&&r.subFontSize>0&&s.size&&(s.size-=r.subFontSize,1>s.size&&(s.size=1)),Yr(n,s),Vr(ol(i),s,n,r),cl(n),n},H=(e,t=0)=>(e.$textData||(e.$textData=hl(e.htmlText,e.defaultTextFormat,{width:e.width,multiline:e.multiline,wordWrap:e.wordWrap,subFontSize:t,textFormats:e.$textFormats})),e.$textData),K=e=>{e.changed=!0;const t=e.parent;t&&!t.changed&&K(t)},Kr=e=>{e.$textData=null,K(e),e.uniqueKey!==""&&O.has(e.uniqueKey)&&(O.removeById(e.uniqueKey),O.$removeIds.push(+e.uniqueKey))},fl=e=>{if(K(e),e.autoSize==="none"){e.xMin=e.bounds.xMin,e.yMin=e.bounds.yMin,e.xMax=e.bounds.xMax,e.yMax=e.bounds.yMax;return}const t=e.defaultTextFormat,r=e.textWidth+4+as(t);if(e.wordWrap)e.xMin=e.bounds.xMin,e.xMax=e.bounds.xMax;else switch(e.autoSize){case"left":e.xMax=r+e.xMin;break;case"center":e.xMax=r+e.xMin;break;case"right":e.xMax=e.bounds.xMax-(e.bounds.xMax-e.bounds.xMin-(r-e.bounds.xMin));break}e.yMax=e.textHeight+e.bounds.yMin+4},dl=e=>{let t=0;const r=H(e);for(let i=0;i<r.textTable.length;++i){const s=r.textTable[i];t=Math.max(t,s.textFormat.size||0)}let n=1;if(e.width&&e.textWidth)for(;t>n&&e.textWidth+4>e.width;)Kr(e),H(e,n++);if(e.height&&e.textHeight)for(;t>n&&e.textHeight+4>e.height;)Kr(e),H(e,n++);K(e)},Be=e=>{Kr(e),H(e),e.autoSize==="none"&&e.autoFontSize&&dl(e),fl(e)},Al=(e,t)=>{const r=H(e);if(2>r.textTable.length)return;let n=2,i=0;for(let f=1;f<r.textTable.length;++f){const A=r.textTable[f];if(!A)continue;let d=!1;if(A.mode==="text"&&(d=!0,n+=A.w),i>=t){i=f;break}A.mode==="break"&&(d=!0,n=2),d&&i++}const s=r.textTable[i];if(!s)return;e.$scrollX=e.$scrollY=0;const a=s.line;let o=0;for(let f=0;f<=a;++f)o+=r.heightTable[f];const c=Math.abs(e.yMax-e.yMin);let u=0;for(let f=a;f>-1;--f){const A=r.heightTable[f];if(c<u+A)break;u+=A}if(o>c){const f=(e.textHeight-c)/c;e.$scrollY=Math.max(0,Math.min((o-u)/f,c))}const h=Math.abs(e.xMax-e.xMin);let l=0;for(let f=i;f>0;--f){const A=r.textTable[f];if(A.mode==="text"){if(h<l+A.w)break;l+=A.w}}if(n>h){const f=(e.textWidth-h)/h;e.$scrollX=Math.max(0,Math.min((n-l)/f,h+.5))}K(e)},fe=()=>{const e=Ht();e!==void 0&&clearTimeout(e),Zi(void 0)},pl=window.devicePixelRatio,ml=e=>{const t=e.localToGlobal(new se),r=e.$textData;if(r){const i=r.textTable[e.focusIndex];if(i){for(let a=e.focusIndex-1;a>-1;--a){const o=r.textTable[a];if(!o||o.line!==i.line)break;t.x+=o.w}const s=i.mode==="break"?i.line-1:i.line;for(let a=0;a<s;++a)t.y+=r.heightTable[a]}}const n=v.rendererScale/pl;de.style.left=`${Je.x+t.x*n}px`,de.style.top=`${Je.y+t.y*n}px`},pe=e=>{e.focusVisible=!e.focusVisible,K(e),Zi(setTimeout(()=>pe(e),500)),ml(e)},gl=(e,t)=>{e.willTrigger(t)&&e.dispatchEvent(new Ne(t)),de.value="",e.focus?(setTimeout(()=>{de.focus()},300),Ht()===void 0&&(e.focusIndex===-1&&(e.focusIndex=1,e.selectIndex=-1),pe(e))):(e.focusIndex=-1,e.selectIndex=-1,e.focusVisible=!1,fe(),de.blur()),K(e)},bl=(e,t,r,n)=>e/n*r+t,xl=(e,t,r,n)=>(e/=n)*e*r+t,yl=(e,t,r,n)=>-(e/=n)*(e-2)*r+t,$l=(e,t,r,n)=>(e/=n/2)<1?e*e*r/2+t:-((e-=1)*(e-2)-1)*r/2+t,vl=(e,t,r,n)=>(e/=n)*e*e*r+t,wl=(e,t,r,n)=>(e/=n,(--e*e*e+1)*r+t),Ml=(e,t,r,n)=>(e/=n/2)<1?e*e*e*r/2+t:((e-=2)*e*e+2)*r/2+t,Bl=(e,t,r,n)=>(e/=n)*e*e*e*r+t,Tl=(e,t,r,n)=>(e/=n,(--e*e*e*e-1)*-r+t),Sl=(e,t,r,n)=>(e/=n/2)<1?e*e*e*e*r/2+t:((e-=2)*e*e*e-2)*-r/2+t,Il=(e,t,r,n)=>(e/=n)*e*e*e*e*r+t,Cl=(e,t,r,n)=>(e/=n,(--e*e*e*e*e+1)*r+t),Fl=(e,t,r,n)=>(e/=n/2)<1?e*e*e*e*e*r/2+t:((e-=2)*e*e*e*e+2)*r/2+t,El=(e,t,r,n)=>-r*Math.cos(e/n*(Math.PI/2))+r+t,Pl=(e,t,r,n)=>r*Math.sin(e/n*(Math.PI/2))+t,Rl=(e,t,r,n)=>-r/2*(Math.cos(Math.PI*e/n)-1)+t,Ol=(e,t,r,n)=>r*Math.pow(2,10*(e/n-1))+t,kl=(e,t,r,n)=>r*(-Math.pow(2,-10*e/n)+1)+t,Ul=(e,t,r,n)=>(e/=n/2)<1?r/2*Math.pow(2,10*(e-1))+t:r/2*(-Math.pow(2,-10*(e-1))+2)+t,Gl=(e,t,r,n)=>(1-Math.sqrt(1-(e/=n)*e))*r+t,_l=(e,t,r,n)=>(e/=n,Math.sqrt(1- --e*e)*r+t),Dl=(e,t,r,n)=>(e/=n*2)<1?(Math.sqrt(1-e*e)-1)/-2*r+t:(Math.sqrt(1-(e-=2)*e)+1)/2*r+t,Ll=(e,t,r,n)=>(2.70158*(e/=n)*e*e-1.70158*e*e)*r+t,Nl=(e,t,r,n)=>(1+2.70158*Math.pow((e/=n)-1,3)+1.70158*Math.pow(e-1,2))*r+t,Yl=(e,t,r,n)=>{let i=1.70158;return(e/=n/2)<1?e*e*(((i*=1.525)+1)*e-i)*r/2+t:((e-=2)*e*(((i*=1.525)+1)*e+i)+2)*r/2+t},Wl=(e,t,r,n)=>(e/=n)===0?t:e===1?r+t:-Math.pow(2,(e*=10)-10)*Math.sin((e-10.75)*(2*Math.PI/3))*r+t,Vl=(e,t,r,n)=>(e/=n)===0?t:e===1?r+t:(Math.pow(2,-10*e)*Math.sin((e*10-.75)*(2*Math.PI/3))+1)*r+t,Kl=(e,t,r,n)=>(e/=n)===0?t:e===1?r+t:e<.5?-(Math.pow(2,20*e-10)*Math.sin((20*e-11.125)*(2*Math.PI/4.5)))/2*r+t:(Math.pow(2,-20*e+10)*Math.sin((20*e-11.125)*(2*Math.PI/4.5))/2+1)*r+t,Ql=(e,t,r,n)=>(e/=n)<1/2.75?7.5625*e*e*r+t:e<2/2.75?(7.5625*(e-=1.5/2.75)*e+.75)*r+t:e<2.5/2.75?(7.5625*(e-=2.25/2.75)*e+.9375)*r+t:(7.5625*(e-=2.625/2.75)*e+.984375)*r+t,Xl=(e,t,r,n)=>r-Ye.outBounce(n-e,0,r,n)+t,zl=(e,t,r,n)=>e<n/2?Ye.inBounce(e*2,t,r/2,n):Ye.outBounce(e*2-n,t+r/2,r/2,n);class Ye{static linear(t,r,n,i){return bl(t,r,n,i)}static inQuad(t,r,n,i){return xl(t,r,n,i)}static outQuad(t,r,n,i){return yl(t,r,n,i)}static inOutQuad(t,r,n,i){return $l(t,r,n,i)}static inCubic(t,r,n,i){return vl(t,r,n,i)}static outCubic(t,r,n,i){return wl(t,r,n,i)}static inOutCubic(t,r,n,i){return Ml(t,r,n,i)}static inQuart(t,r,n,i){return Bl(t,r,n,i)}static outQuart(t,r,n,i){return Tl(t,r,n,i)}static inOutQuart(t,r,n,i){return Sl(t,r,n,i)}static inQuint(t,r,n,i){return Il(t,r,n,i)}static outQuint(t,r,n,i){return Cl(t,r,n,i)}static inOutQuint(t,r,n,i){return Fl(t,r,n,i)}static inSine(t,r,n,i){return El(t,r,n,i)}static outSine(t,r,n,i){return Pl(t,r,n,i)}static inOutSine(t,r,n,i){return Rl(t,r,n,i)}static inExpo(t,r,n,i){return Ol(t,r,n,i)}static outExpo(t,r,n,i){return kl(t,r,n,i)}static inOutExpo(t,r,n,i){return Ul(t,r,n,i)}static inCirc(t,r,n,i){return Gl(t,r,n,i)}static outCirc(t,r,n,i){return _l(t,r,n,i)}static inOutCirc(t,r,n,i){return Dl(t,r,n,i)}static inBack(t,r,n,i){return Ll(t,r,n,i)}static outBack(t,r,n,i){return Nl(t,r,n,i)}static inOutBack(t,r,n,i){return Yl(t,r,n,i)}static inElastic(t,r,n,i){return Wl(t,r,n,i)}static outElastic(t,r,n,i){return Vl(t,r,n,i)}static inOutElastic(t,r,n,i){return Kl(t,r,n,i)}static outBounce(t,r,n,i){return Ql(t,r,n,i)}static inBounce(t,r,n,i){return Xl(t,r,n,i)}static inOutBounce(t,r,n,i){return zl(t,r,n,i)}}const Hl=e=>{cancelAnimationFrame(e.$timerId),e.hasEventListener(ye.STOP)&&e.dispatchEvent(new ye(ye.STOP)),e.entries=null,e.stopFlag=!0},os=e=>{const t=[];for(const[r,n]of Object.entries(e))t.push({name:r,value:typeof n=="number"?n:os(n)});return t},cs=(e,t,r,n,i)=>{for(let s=0;s<i.length;++s){const a=i[s];if(!a)continue;const o=a.name;if(!(o in t)||!(o in n))continue;if(typeof a.value!="number"){cs(e,t[o],r[o],n[o],a.value);continue}const c=r[o];e.duration>e.currentTime?t[o]=e.ease(e.currentTime,c,n[o]-c,e.duration):t[o]=n[o]}},ls=(e,t)=>e.stopFlag||!e.entries?-1:(e.currentTime=(t-e.startTime)/1e3,cs(e,e.target,e.from,e.to,e.entries),e.hasEventListener(ye.UPDATE)&&e.dispatchEvent(new ye(ye.UPDATE)),e.currentTime>=e.duration?(e.hasEventListener(ye.COMPLETE)&&e.dispatchEvent(new ye(ye.COMPLETE)),e.nextJob&&e.nextJob.start(),-1):requestAnimationFrame(r=>{ls(e,r)})),Vn=e=>{e.stopFlag||(e.entries=os(e.from),e.entries&&(e.startTime=performance.now(),e.$timerId=ls(e,e.startTime)))},Jl=e=>{cancelAnimationFrame(e.$timerId),e.stopFlag=!1,e.delay?setTimeout(()=>{Vn(e)},e.delay*1e3):Vn(e)};class Zl extends nt{target;entries;startTime;stopFlag;$timerId;delay;duration;ease;from;to;currentTime;nextJob;constructor(t,r,n,i=0,s=1,a=null){super(),this.target=t,this.from=r,this.to=n,this.delay=i,this.duration=s,this.ease=a||Ye.linear,this.currentTime=0,this.nextJob=null,this.entries=null,this.startTime=0,this.stopFlag=!1,this.$timerId=-1}chain(t){return this.nextJob=t,t}start(){Jl(this)}stop(){Hl(this)}}class gn{static add(t,r,n,i=0,s=1,a=null){return new Zl(t,r,n,i,s,a)}}const ql=(e,t)=>{if(!e.scrollEnabled||e.autoSize!=="none"||e.yScrollShape.hasLocalVariable("job"))return;const r=e.width;if(t=pt(t,0,r,0),e.scrollX!==t){if(e.textWidth>r){K(e);const n=e.xScrollShape;n.width=r*r/e.textWidth;const i=e.parent;if(i){n.hasLocalVariable("job")&&n.getLocalVariable("job").stop(),n.alpha=.9,n.x=e.x+1+(r-1-n.width)/(r-1)*(t-1),n.y=e.y+e.height-n.height-.5,i.addChildAt(n,i.getChildIndex(e)+1);const s=gn.add(n,{alpha:.9},{alpha:0},.5,.2,Ye.outQuad);s.addEventListener(x.COMPLETE,a=>{const o=a.target.target;o.deleteLocalVariable("job"),o.parent&&o.parent.removeChild(o)}),s.start(),n.setLocalVariable("job",s)}e.$scrollX=t}e.willTrigger(x.SCROLL)&&e.dispatchEvent(new x(x.SCROLL,!0))}},jl=(e,t)=>{if(!e.scrollEnabled||e.autoSize!=="none"||!e.multiline&&!e.wordWrap||e.xScrollShape.hasLocalVariable("job"))return;const r=e.height;if(t=pt(t,0,r,0),e.scrollY!==t){if(e.textHeight>r){K(e);const n=e.yScrollShape;n.height=r*r/e.textHeight;const i=e.parent;if(i){n.hasLocalVariable("job")&&n.getLocalVariable("job").stop(),n.alpha=.9,n.x=e.x+e.width-n.width-.5,n.y=e.y+.5+(r-1-n.height)/(r-1)*(t-1),i.addChildAt(n,i.getChildIndex(e)+1);const s=gn.add(n,{alpha:.9},{alpha:0},.5,.2,Ye.outQuad);s.addEventListener(x.COMPLETE,a=>{const o=a.target.target;o.deleteLocalVariable("job"),o.parent&&o.parent.removeChild(o)}),s.start(),n.setLocalVariable("job",s),e.$scrollY=t}}e.willTrigger(x.SCROLL)&&e.dispatchEvent(new x(x.SCROLL,!0))}},eu=e=>{let t="";const r=H(e);for(let n=1;n<r.textTable.length;++n){const i=r.textTable[n];if(i)switch(i.mode){case"text":t+=i.text;break;case"break":t+="\r";break;default:continue}}return t},tu=(e,t)=>{let r="";const n=H(e);for(let i=1;i<n.textTable.length;i++){const s=n.textTable[i];if(s){if(s.line>t)break;s.line===t&&s.mode==="text"&&(r+=s.text)}}return r},ru=(e,t,r,n)=>{if(0>r||r>n)return;const i=e.text,s=r?i.slice(0,r):"";e.text=s+t+i.slice(n,i.length)},nu=async e=>{if(e.focusIndex===-1||e.selectIndex===-1)return;let t="";const r=Math.min(e.focusIndex,e.selectIndex),n=Math.max(e.focusIndex,e.selectIndex)+1,i=H(e);for(let s=r;s<n;++s){const a=i.textTable[s];if(a)switch(a.mode){case"text":t+=a.text;break;case"break":t+=`
2340
+ `;break}}await navigator.clipboard.writeText(t)},iu=async e=>{const t=await navigator.clipboard.readText();t===""||e.focusIndex===-1||e.insertText(t)},bn=e=>{if(e.compositionStartIndex>-1)return;let t=0,r=0;if(e.selectIndex>-1)t=Math.min(e.focusIndex,e.selectIndex),r=Math.max(e.focusIndex,e.selectIndex)+1,e.focusIndex=t;else{if(2>e.focusIndex)return;e.focusIndex--}const n=H(e),i=n.textTable[e.focusIndex];i&&i.mode==="wrap"&&e.focusIndex--;const s=[];let a="";for(let o=1;o<n.textTable.length;++o){const c=n.textTable[o];if(c&&!(e.focusIndex===o||t<=o&&r>o))switch(c.mode){case"break":s.push(new ue(...Object.values(c.textFormat))),a+=`
2341
+ `;break;case"text":s.push(new ue(...Object.values(c.textFormat))),a+=c.text;break;default:continue}}if(n.textTable.length===e.focusIndex&&(s.pop(),a=a.slice(0,-1)),e.selectIndex=-1,!a)e.text="",e.focusIndex=1;else{const o=e.textWidth,c=e.textHeight;if(e.$textFormats=s,e.text=a,e.scrollX>0){const u=e.textWidth,h=e.width;switch(!0){case h>u:e.$scrollX=0;break;case o!==u:e.$scrollX-=(o-u)/(u/h);break}}if(e.scrollY>0){const u=e.textHeight,h=e.height;switch(!0){case h>u:e.$scrollY=0;break;case c!==u:e.$scrollY-=(c-u)/(u/h);break}}e.$textFormats=null}},us=(e,t)=>{if(e.focusIndex===-1||e.compositionStartIndex>-1)return;e.selectIndex>-1&&bn(e);const r=H(e);if(2>r.textTable.length){e.focusIndex=2,e.appendText(t);return}const n=[];let i="";for(let s=1;s<r.textTable.length;++s){const a=r.textTable[s];if(a){if(e.focusIndex===s)for(let o=0;o<t.length;++o)n.push(new ue(...Object.values(a.textFormat))),i+=t[o];switch(a.mode){case"break":n.push(new ue(...Object.values(a.textFormat))),i+=`
2342
+ `;break;case"text":n.push(new ue(...Object.values(a.textFormat))),i+=a.text;break;default:continue}}}if(r.textTable.length===e.focusIndex){let s;if(r.textTable.length){const a=r.textTable[r.textTable.length-1];s=new ue(...Object.values(a.textFormat))}else s=e.defaultTextFormat,e.focusIndex++;for(let a=0;a<t.length;++a)n.push(new ue(...Object.values(s.toObject()))),i+=t[a]}e.$textFormats=n,e.text=i,e.$textFormats=null,e.focusIndex+=t.length,e.selectIndex=-1,de.value=""},Kn=e=>{if(e.selectIndex===-1)return;const t=H(e);if(2>t.textTable.length)return;const r=t.textTable[e.selectIndex];if(!r)return;const n=r.mode==="text"?r.line:r.line-1,i=e.height,s=(e.textHeight-i)/i;let a=-e.scrollY*s-2,o=0;for(let d=0;d<t.heightTable.length&&(a+=t.heightTable[d],!(a>i));++d)o++;a=-e.scrollY*s-2;let c=0;for(let d=0;d<t.heightTable.length&&(a+=t.heightTable[d],!(a>0));++d)c++;c>=r.line&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY-=t.heightTable[r.line]/s),r.line>=o&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY+=t.heightTable[r.line]/s);const u=e.width,h=(e.textWidth-u)/u;let l=2,f=e.scrollX*h-2+u;for(let d=1;e.selectIndex>=d;++d){const y=t.textTable[d];if(!y||y.line>n)break;if(y.line===n&&(e.selectIndex!==d&&(l+=y.w),f-=y.w,!(f>0))){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX+=y.w/h;break}}e.scrollX*h-2>l&&(e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((l-2)/e.textWidth))},su=(e,t,r,n=!1)=>{if(e.type!=="input")return;const i=H(e);if(2>i.textTable.length){e.focusIndex=1,e.selectIndex=-1,Ht()===void 0&&pe(e);return}const s=e.width,a=e.height;let o=0;e.scrollX>0&&(o+=e.scrollX*(e.textWidth-s)/s);let c=0;e.scrollY>0&&(c+=e.scrollY*(e.textHeight-a)/a);const u=e.globalToLocal(new se(t,r)),h=u.x+o,l=u.y+c;let f=2,A=2,d=A+i.heightTable[0];for(let y=1;y<i.textTable.length;++y){const g=i.textTable[y];if(g){switch(g.mode){case"break":case"wrap":if(h>f&&l>A&&d>l&&s>h){const p=y;n?e.selectIndex!==p&&(e.selectIndex=p,e.focusVisible&&(e.focusVisible=!1,fe()),Kn(e),K(e)):(e.focusIndex!==p||e.selectIndex>-1)&&(e.focusIndex=p,e.selectIndex=-1,K(e));return}f=2,A+=i.heightTable[g.line-1],d=A+i.heightTable[g.line];break;case"text":if(h>f&&l>A&&d>l&&f+g.w>h){let p=y;if(n)e.focusIndex>p?e.focusIndex===p+1?f+g.w/2<h&&(p=-1):f+g.w/2<h&&(p+=1):e.focusIndex===p?f+g.w/2>h&&(p=-1):f+g.w/2>h&&(p-=1),e.selectIndex!==p&&(e.selectIndex=p,e.selectIndex>-1&&(e.focusVisible=!1,fe()),Kn(e),K(e));else{if(f+g.w/2<h){const $=i.textTable[p+1];(!$||$.mode==="text")&&(p+=1)}(e.focusIndex!==p||e.selectIndex>-1)&&(e.focusIndex=p,e.selectIndex=-1,K(e))}return}if(y===i.textTable.length-1&&h>f&&l>A&&d>l&&s>h){const p=i.textTable.length;n?e.selectIndex!==p&&(e.selectIndex=p,e.focusVisible&&(e.focusVisible=!1,fe()),K(e)):(e.focusIndex!==p||e.selectIndex>-1)&&(e.focusIndex=p,e.selectIndex=-1,K(e));return}f+=g.w;break}if(!n)e.focusIndex=i.textTable.length,e.selectIndex=-1,Ht()===void 0?pe(e):K(e);else{let p=0;for(let $=0;i.heightTable.length>$;++$)p+=i.heightTable[$];(l>p||2>l)&&(e.selectIndex=2>l?1:i.textTable.length,e.focusVisible&&(e.focusVisible=!1,fe()),K(e))}}}},au=(e,t)=>{if(e.focusIndex===-1)return;const r=H(e);if(2>r.textTable.length)return;const n=r.textTable[e.focusIndex];if(!n)return;const i=n.mode==="text"?n.line:n.line-1;if(i===r.lineTable.length-1){t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,e.focusVisible=!1,e.focusIndex=r.textTable.length;const f=e.width,A=(e.textWidth-f)/f;let d=0;for(let y=1;e.focusIndex>=y;++y){const g=r.textTable[y];if(!g||g.line>i)break;g.line===i&&(d+=g.w)}e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=(d-f)/A,fe(),pe(e);return}const s=e.height,a=(e.textHeight-s)/s;let o=-e.scrollY*a-2,c=0;for(let f=0;f<r.heightTable.length&&(o+=r.heightTable[f],!(o>s));++f)c++;let u=2;for(let f=1;f<r.textTable.length;++f){const A=r.textTable[f];if(A){if(e.focusIndex===f){A.mode==="text"&&(u+=A.w/2);break}if(A.line>i)break;A.line!==i||A.mode!=="text"||(u+=A.w)}}let h=2;const l=i+1;for(let f=1;f<r.textTable.length;++f){const A=r.textTable[f];if(A){if(A.line>l){t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,A.line>=c&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY+=r.heightTable[A.line]/a),e.focusVisible=!1,e.focusIndex=A.mode==="text"?f-1:f,e.scrollX&&h<u&&(e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((h-2)/e.textWidth)),fe(),pe(e);return}if(!(A.line!==l||A.mode!=="text")&&(h+=A.w,h>u)){if(t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===f-1&&(e.selectIndex=-1):e.selectIndex=-1,A.line>=c&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY+=r.heightTable[A.line]/a),e.scrollX){const d=e.width,y=(e.textWidth-d)/d;e.scrollX*y-2>h&&(e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((h-2)/e.textWidth))}e.focusVisible=!1,e.focusIndex=f,fe(),pe(e);return}}}t?e.selectIndex===-1&&(e.selectIndex=e.focusIndex):e.selectIndex=-1,e.focusVisible=!1,e.focusIndex=r.textTable.length,fe(),pe(e)},ou=(e,t)=>{if(e.focusIndex===-1)return;const r=H(e);if(2>r.textTable.length)return;const n=r.textTable.length===e.focusIndex?e.focusIndex-1:e.focusIndex,i=r.textTable[n];if(!i||!i.line){t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.focusVisible=!1,e.focusIndex=1,e.scrollX=0,fe(),pe(e);return}const s=i.mode==="text"?i.line:i.line-1,a=e.height,o=(e.textHeight-a)/a;let c=0,u=-e.scrollY*o-2;for(let A=0;A<r.heightTable.length&&(u+=r.heightTable[A],!(u>0));++A)c++;let h=2;for(let A=1;A<r.textTable.length;++A){const d=r.textTable[A];if(d){if(e.focusIndex===A){d.mode==="text"&&(h+=d.w/2);break}if(d.line>s)break;d.line!==s||d.mode!=="text"||(h+=d.w)}}let l=2;const f=s-1;for(let A=1;A<r.textTable.length;++A){const d=r.textTable[A];if(d){if(d.line>f){t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,c>=d.line&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY-=r.heightTable[d.line]/o),e.scrollX&&(e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((l-2)/e.textWidth)),e.focusVisible=!1,e.focusIndex=d.mode==="text"?A-1:A,fe(),pe(e);return}if(!(d.line!==f||d.mode!=="text")&&(l+=d.w,l>h)){t?e.selectIndex===-1?e.selectIndex=e.focusIndex-1:e.selectIndex===A+1&&(e.selectIndex=-1):e.selectIndex=-1,c>d.line&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY-=r.heightTable[d.line]/o),e.focusVisible=!1,e.focusIndex=A,fe(),pe(e);return}}}},cu=(e,t)=>{if(!e.focusIndex)return;const r=H(e);if(r.textTable.length&&e.focusIndex<2){e.focusIndex=1;return}e.focusIndex--,t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1;const n=r.textTable[e.focusIndex];if(n){const i=n.mode==="text"?n.line:n.line-1,s=e.height,a=(e.textHeight-s)/s;let o=-e.scrollY*a-2,c=0;for(let h=0;h<r.heightTable.length&&(o+=r.heightTable[h],!(o>0));++h)c++;c>i&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY-=r.heightTable[n.line]/a);const u=r.textTable[e.focusIndex+1];if(u){const h=u.mode==="text"?u.line:u.line-1;let l=2;for(let y=1;e.focusIndex>y;++y){const g=r.textTable[y];if(!g||g.line>i)break;g.line===i&&(l+=g.w)}const f=e.width,A=(e.textWidth-f)/f,d=e.scrollX*A-2;if(l>f&&u&&i<h){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width;return}if(d>l){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=e.width*((l-2)/e.textWidth);return}}}e.focusVisible=!1,fe(),pe(e)},lu=(e,t)=>{const r=H(e);if(r.textTable.length===e.focusIndex)return;t?e.selectIndex===-1?e.selectIndex=e.focusIndex:e.selectIndex===e.focusIndex&&(e.selectIndex=-1):e.selectIndex=-1,e.focusVisible=!1,e.focusIndex++,fe(),pe(e);const n=r.textTable[e.focusIndex];if(n){const i=n.mode==="text"?n.line:n.line-1,s=e.height,a=(e.textHeight-s)/s;let o=-e.scrollY*a-2,c=0;for(let d=0;d<r.heightTable.length&&(o+=r.heightTable[d],!(o>s));++d)c++;i>=c&&(e.xScrollShape.hasLocalVariable("job")&&e.xScrollShape.deleteLocalVariable("job"),e.scrollY+=r.heightTable[i]/a);const u=r.textTable[e.focusIndex-1],h=u.mode==="text"?u.line:u.line-1;if(u&&i>h){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX=0;return}const l=e.width,f=(e.textWidth-l)/l;let A=e.scrollX*f-2+l;for(let d=1;e.focusIndex>=d;++d){const y=r.textTable[d];if(!y||y.line>i)break;if(y.line===i&&(A-=y.w,!(A>0))){e.yScrollShape.hasLocalVariable("job")&&e.yScrollShape.deleteLocalVariable("job"),e.scrollX+=y.w/f;break}}}},uu=(e,t)=>{if(e.focusIndex!==-1)switch(t.key){case"Backspace":case"Delete":e.deleteText();break;case"Enter":e.insertText(`
2343
+ `);break;case"ArrowLeft":cu(e,t.shiftKey);break;case"ArrowRight":lu(e,t.shiftKey);break;case"ArrowUp":ou(e,t.shiftKey);break;case"ArrowDown":au(e,t.shiftKey);break;case"a":(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e.selectAll());break;case"c":(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e.copy());break;case"v":(t.metaKey||t.ctrlKey)&&(t.preventDefault(),e.paste());break}},hu=e=>{const t=H(e);2>t.textTable.length||(e.selectIndex=1,e.focusIndex=t.textTable.length,K(e))},fu=(e,t)=>{const r=e.defaultTextFormat;switch(r.font=t.font,r.size=t.size,r.align=t.align,r.color=t.color,r.leading=t.leading,r.letterSpacing=t.letterSpacing,r.leftMargin=t.leftMargin,r.rightMargin=t.rightMargin,t.fontType){case 1:r.bold=!0;break;case 2:r.italic=!0;break;case 3:r.bold=!0,r.italic=!0;break}switch(e.defaultTextFormat=r,e.type=t.inputType,e.multiline=t.multiline,e.wordWrap=t.wordWrap,e.border=t.border,e.scrollEnabled=t.scroll,e.thickness=t.thickness,e.thicknessColor=t.thicknessColor,t.autoSize){case 1:e.autoSize=t.align;break;case 2:e.autoFontSize=!0;break}e.xMin=e.bounds.xMin=t.bounds.xMin,e.xMax=e.bounds.xMax=t.bounds.xMax,e.yMin=e.bounds.yMin=t.bounds.yMin,e.yMax=e.bounds.yMax=t.bounds.yMax+4,e.text=t.text};class Qr extends fn{isText;$textData;_$isHTML;xMin;yMin;xMax;yMax;bounds;scrollEnabled;xScrollShape;yScrollShape;focusVisible;focusIndex;selectIndex;maxChars;restrict;type;compositionStartIndex;compositionEndIndex;$textFormats;$scrollX;$scrollY;cacheKey;cacheParams;_$background;_$backgroundColor;_$border;_$borderColor;_$htmlText;_$multiline;_$text;_$wordWrap;_$defaultTextFormat;_$rawHtmlText;_$autoSize;_$autoFontSize;_$focus;_$thickness;_$thicknessColor;_$stopIndex;constructor(){super(),this.isText=!0,this.$textData=null,this._$background=!1,this._$backgroundColor=16777215,this._$border=!1,this._$borderColor=0,this._$htmlText="",this._$multiline=!1,this._$text="",this._$wordWrap=!1,this.$scrollX=0,this.$scrollY=0,this.$textFormats=null,this.maxChars=0,this._$stopIndex=-1,this.compositionStartIndex=-1,this.compositionEndIndex=-1;const t=new ue;kc(t),this._$defaultTextFormat=t,this._$rawHtmlText="",this.xMin=0,this.yMin=0,this.xMax=100,this.yMax=100,this.bounds={xMin:0,xMax:this.xMax,yMin:0,yMax:this.yMax},this.restrict="",this._$isHTML=!1,this._$autoSize="none",this._$autoFontSize=!1,this.focusVisible=!1,this.focusIndex=-1,this.selectIndex=-1,this.scrollEnabled=!0,this.xScrollShape=new $t,this.xScrollShape.graphics.beginFill("#000",.3).drawRoundRect(0,0,3,3,3),this.xScrollShape.scale9Grid=new be(1.5,1.5,.1,.1),this.yScrollShape=new $t,this.yScrollShape.graphics.beginFill("#000",.3).drawRoundRect(0,0,3,3,3),this.yScrollShape.scale9Grid=new be(1.5,1.5,.1,.1),this.type="static",this._$focus=!1,this._$thickness=0,this._$thicknessColor=0,this.cacheKey=0,this.cacheParams=[0,0,0]}static get namespace(){return"next2d.display.TextField"}get namespace(){return"next2d.display.TextField"}get autoFontSize(){return this._$autoFontSize}set autoFontSize(t){t!==this._$autoFontSize&&(this._$autoFontSize=!!t,Be(this))}get autoSize(){return this._$autoSize}set autoSize(t){t!==this._$autoSize&&(this._$autoSize=t,Be(this))}get background(){return this._$background}set background(t){t!==this._$background&&(this._$background=!!t,K(this))}get backgroundColor(){return this._$backgroundColor}set backgroundColor(t){t=pt(et(t),0,16777215,16777215),t!==this._$backgroundColor&&(this._$backgroundColor=t,K(this))}get border(){return this._$border}set border(t){t!==this._$border&&(this._$border=!!t,K(this))}get borderColor(){return this._$borderColor}set borderColor(t){t=pt(et(t),0,16777215,0),t!==this._$borderColor&&(this._$borderColor=t,K(this))}get stopIndex(){return this._$stopIndex}set stopIndex(t){t|=0,this._$stopIndex!==t&&(this._$stopIndex=t,Al(this,t))}get defaultTextFormat(){return this._$defaultTextFormat.clone()}set defaultTextFormat(t){this._$rawHtmlText="",this._$isHTML?this._$text="":this._$htmlText="",this._$defaultTextFormat=t,Be(this)}get focus(){return this._$focus}set focus(t){this._$focus!==t&&this.type==="input"&&(this._$focus=!!t,gl(this,this._$focus?Ne.FOCUS_IN:Ne.FOCUS_OUT))}get htmlText(){if(this._$htmlText)return this._$htmlText;const t=Uc(this.defaultTextFormat);return this._$htmlText=`<span style="${t}">${this._$text.replace(/\n/g,"<br>")}</span>`,this._$htmlText}set htmlText(t){this._$htmlText!==t&&(this._$htmlText=`${t}`,this._$rawHtmlText="",this._$text="",this._$isHTML=!0,Be(this),this.hasEventListener(x.CHANGE)&&this.dispatchEvent(new x(x.CHANGE)))}get length(){return this.text.length}get multiline(){return this._$multiline}set multiline(t){t!==this._$multiline&&(this._$multiline=!!t,Be(this))}get numLines(){return H(this).lineTable.length}get scrollX(){return this.$scrollX}set scrollX(t){ql(this,t)}get scrollY(){return this.$scrollY}set scrollY(t){jl(this,t)}get text(){return this._$isHTML?(this._$rawHtmlText||(this._$rawHtmlText=eu(this)),this._$rawHtmlText):this._$text}set text(t){t=`${t}`,t===""&&(this.scrollX&&(this.scrollX=0),this.scrollY&&(this.scrollY=0)),t!==this._$text&&(this._$htmlText="",this._$rawHtmlText="",this._$isHTML=!1,this._$text=t,Be(this),this.hasEventListener(x.CHANGE)&&this.dispatchEvent(new x(x.CHANGE)))}get textHeight(){return H(this).textHeight}get textWidth(){return H(this).textWidth}get thickness(){return this._$thickness}set thickness(t){t|=0,t!==this._$thickness&&(this._$thickness=t,K(this))}get thicknessColor(){return this._$thicknessColor}set thicknessColor(t){t=pt(et(t),0,16777215,0),t!==this._$thicknessColor&&(this._$thicknessColor=t,K(this))}get wordWrap(){return this._$wordWrap}set wordWrap(t){this._$wordWrap!==t&&(this._$wordWrap=!!t,Be(this))}get width(){return super.width}set width(t){if(t=+t,!isNaN(t)&&0>t)return;const r=t+this.bounds.xMin;r!==this.bounds.xMax&&(this.bounds.xMax=r,Be(this))}get height(){return super.height}set height(t){if(t=+t,!isNaN(t)&&0>t)return;const r=t+this.bounds.yMin;r!==this.bounds.yMax&&(this.bounds.yMax=r,Be(this))}appendText(t){const r=this.text;this.text=r+`${t}`}insertText(t){us(this,t)}deleteText(){bn(this)}getLineText(t){return this._$text||this._$htmlText?tu(this,t|0):""}replaceText(t,r,n){ru(this,t,r|0,n|0)}selectAll(){hu(this)}copy(){nu(this)}paste(){iu(this)}setFocusIndex(t,r,n=!1){su(this,t,r,n)}keyDown(t){uu(this,t)}$sync(t,r=null){r&&super.$syncLoaderInfo(r),fu(this,t)}}const du=e=>{e.compositionStartIndex=e.focusIndex},Au=()=>{const e=ke();e&&du(e)},pu=(e,t)=>{if(e.compositionEndIndex>-1){const o=e.compositionStartIndex;e.focusIndex=e.compositionStartIndex,e.selectIndex=e.compositionEndIndex-1,e.compositionStartIndex=-1,bn(e),e.compositionStartIndex=o,e.selectIndex=-1}let r=H(e);const n=[],i=t.length;let s="";if(2>r.textTable.length)s=t,e.focusIndex=1,e.compositionStartIndex=1;else{for(let o=1;o<r.textTable.length;++o){const c=r.textTable[o];if(c){if(e.compositionStartIndex===o)for(let u=0;u<i;++u)n.push(new ue(...Object.values(c.textFormat))),s+=t[u];switch(c.mode){case"break":n.push(new ue(...Object.values(c.textFormat))),s+=`
2344
+ `;break;case"text":n.push(new ue(...Object.values(c.textFormat))),s+=c.text;break;default:continue}}}if(e.compositionStartIndex===r.textTable.length){const o=r.textTable[e.compositionStartIndex-1];if(!o)return;for(let c=0;c<i;++c)n.push(new ue(...Object.values(o.textFormat))),s+=t[c]}}n.length&&(e.$textFormats=n),e.text=s,e.$textFormats=null,r=H(e);let a=e.compositionStartIndex+i;for(let o=e.compositionStartIndex;o<a;++o){const c=r.textTable[o];if(!c)break;if(c.textFormat.underline=!0,c.mode==="wrap"){if(o===e.compositionStartIndex){let u=1;for(;;){const h=r.textTable[o-u];if(!h)break;if(h.mode==="text"){h.textFormat.underline=!0;break}u++}}o>e.compositionStartIndex&&a++}}e.compositionEndIndex=e.focusIndex=a},mu=e=>{const t=ke();t&&pu(t,e.data)},gu=e=>{if(e.compositionEndIndex>-1){const t=H(e);for(let r=e.compositionStartIndex;r<e.compositionEndIndex;++r){const n=t.textTable[r];n&&(n.textFormat.underline=!1)}e.focusIndex=e.compositionEndIndex}de.blur(),de.value="",e.focus&&de.focus(),e.selectIndex=-1,e.compositionStartIndex=-1,e.compositionEndIndex=-1},bu=()=>{const e=ke();e&&gu(e)},xu=e=>{if(!e.data)return;const t=ke();t&&(us(t,e.data),t.hasEventListener(x.INPUT)&&t.dispatchEvent(new x(x.INPUT)))},yu=e=>{e.addEventListener("compositionstart",Au),e.addEventListener("compositionupdate",mu),e.addEventListener("compositionend",bu),e.addEventListener("input",xu)};yu(de);const hs=[],$u=()=>hs,vu=e=>{hs.push(e)};let Le=null;const wu=()=>!!Le,Mu=()=>{Le||(Le=new AudioContext),Le.resume()},fs=()=>(Le||(Le=new AudioContext),Le),Bu=e=>{let t=null;switch(e.method.toUpperCase()){case"GET":if(e.data){const n=e.url.split("?");n[1]=n.length===1?e.data.toString():`${n[1]}&${e.data.toString()}`,e.url=n.join("?")}break;case"PUT":case"POST":e.data&&(t=e.data.toString());break}const r=new XMLHttpRequest;if(r.open(e.method,e.url,!0),r.responseType=e.format,r.withCredentials=e.withCredentials,e.event){const n=Object.keys(e.event);for(let i=0;i<n.length;++i){const s=n[i];r.addEventListener(s,e.event[s])}}for(let n=0;n<e.headers.length;++n){const i=e.headers[n];i&&r.setRequestHeader(i.name,i.value)}r.send(t)},xn=(e,t,r,n=null)=>{const i=+e;return isNaN(i)&&n!==null?n:Math.min(Math.max(t,isNaN(i)?0:i),r)};let ds=1;const Tu=()=>ds,Su=e=>{ds=xn(e,0,1,1)},Iu=[],Jt=()=>Iu,Cu=[],fr=()=>Cu,Fu=e=>{Su(e);const t=Jt();for(let n=0;n<t.length;++n){const i=t[n];i&&(i.volume=e)}const r=fr();for(let n=0;n<r.length;++n){const i=r[n];i&&(i.volume=e)}},Eu=()=>{const e=Jt();for(let r=0;r<e.length;++r){const n=e[r];n&&n.stop()}const t=fr();for(let r=0;r<t.length;++r){const n=t[r];n&&n.pause()}e.length=0,t.length=0};class rt{static get volume(){return Tu()}static set volume(t){Fu(t)}static stopAll(){Eu()}}const Pu=e=>{e.canLoop?e.play():(e.stop(),e.willTrigger(x.COMPLETE)&&e.dispatchEvent(new x(x.COMPLETE)))},Ru=(e,t)=>{e.willTrigger(x.OPEN)&&e.dispatchEvent(new x(x.OPEN)),e.willTrigger(Z.PROGRESS)&&e.dispatchEvent(new Z(Z.PROGRESS,!1,t.loaded,t.total))},Ou=(e,t)=>{e.willTrigger(Z.PROGRESS)&&e.dispatchEvent(new Z(Z.PROGRESS,!1,t.loaded,t.total))},yn=async e=>{if(e.byteLength)try{return await fs().decodeAudioData(e)}catch{const t=new Uint8Array(e);let r=0;for(;r>t.byteLength&&(r=t.indexOf(255,r),!(r===-1||(t[r+1]&224)===224));)++r;return await yn(t.subarray(r).buffer)}},ku=async(e,t)=>{const r=t.target;if(r)if(e.willTrigger(Z.PROGRESS)&&e.dispatchEvent(new Z(Z.PROGRESS,!1,t.loaded,t.total)),199<r.status&&400>r.status){const n=await yn(r.response);n&&(e.audioBuffer=n,e.willTrigger(x.COMPLETE)&&e.dispatchEvent(new x(x.COMPLETE)))}else e.willTrigger(Re.IO_ERROR)&&e.dispatchEvent(new Re(Re.IO_ERROR,!1,r.statusText))},Uu=async(e,t)=>{await new Promise(r=>{Bu({format:"arraybuffer",url:t.url,method:t.method,data:t.data,headers:t.headers,withCredentials:t.withCredentials,event:{loadstart:n=>{Ru(e,n)},progress:n=>{Ou(e,n)},loadend:async n=>{await ku(e,n),r()}}})})},Gu=async(e,t)=>{if(!t.audioBuffer){const r=new Uint8Array(t.buffer),n=await yn(r.buffer);if(!n)return;t.audioBuffer=n}e.audioBuffer=t.audioBuffer};class dr extends nt{_$source;_$gainNode;_$stopFlag;_$currentCount;_$volume;audioBuffer;loopCount;constructor(){super(),this.loopCount=0,this.audioBuffer=null,this._$volume=1,this._$currentCount=0,this._$stopFlag=!0,this._$source=null,this._$gainNode=null}get volume(){return this._$volume}set volume(t){this._$volume=xn(Math.min(rt.volume,t),0,1,1),this._$gainNode&&(this._$gainNode.gain.value=this._$volume)}get canLoop(){return!this._$stopFlag&&this.loopCount>=this._$currentCount}clone(){const t=new dr;return t.volume=this._$volume,t.loopCount=this.loopCount,t.audioBuffer=this.audioBuffer,t}async load(t){await Uu(this,t)}play(t=0){if(!this._$stopFlag||!this.audioBuffer)return;this.stop();const r=fs();this._$gainNode=r.createGain(),this._$gainNode.connect(r.destination),this._$gainNode.gain.value=Math.min(rt.volume,this._$volume),this._$source=r.createBufferSource(),this._$source.addEventListener("ended",()=>{Pu(this)}),this._$source.buffer=this.audioBuffer,this._$source.connect(this._$gainNode),this._$source.start(t),this._$stopFlag=!1,this._$currentCount++,Jt().push(this)}stop(){if(this._$stopFlag)return;this._$stopFlag=!0,this._$currentCount=0,this._$source&&(this._$source.disconnect(),this._$source=null),this._$gainNode&&(this._$gainNode.gain.value=0,this._$gainNode.disconnect(),this._$gainNode=null);const t=Jt(),r=t.indexOf(this);r>-1&&t.splice(r,1)}async $build(t){await Gu(this,t)}}class _u{volume;loopCount;constructor(t=1,r=0){this.volume=t,this.loopCount=r}}const Du=()=>{const e=document.createElement("video");return e.autoplay=!1,e.crossOrigin="anonymous",e.setAttribute("playsinline",""),e},$n=e=>{e.changed=!0;const t=e.parent;t&&!t.changed&&$n(t)},Lu=async e=>{e.autoPlay&&(wu()||(e.muted=!0,vu(e)),await e.play()),e.loaded=!0,$n(e),e.willTrigger(x.COMPLETE)&&e.dispatchEvent(new x(x.COMPLETE))},Nu=(e,t)=>{t.currentTime=0,t.duration=e.duration,t.videoWidth=e.videoWidth,t.videoHeight=e.videoHeight;const r=new OffscreenCanvas(t.videoWidth,t.videoHeight);t.$context=r.getContext("2d"),t.$offscreenCanvas=r},Yu=(e,t)=>{e.willTrigger(Z.PROGRESS)&&e.dispatchEvent(new Z(Z.PROGRESS,!1,t.loaded,t.total))},Wu=e=>{if(e.willTrigger(Ae.ENDED)&&e.dispatchEvent(new Ae(Ae.ENDED)),e.loop){e.currentTime=0;return}e.ended=!0,e.changed=!1,e.pause()},Vu=(e,t)=>{e.addEventListener("loadedmetadata",()=>{Nu(e,t)},{once:!0}),e.addEventListener("progress",r=>{Yu(t,r)}),e.addEventListener("canplaythrough",async()=>{await Lu(t),e.volume=t.volume},{once:!0}),e.addEventListener("ended",()=>{Wu(t)})},As=e=>{if(e.paused||!e.loaded)return 0;e.willTrigger(Ae.PLAY)&&e.dispatchEvent(new Ae(Ae.PLAY)),$n(e);const t=fr();return t.indexOf(e)===-1&&t.push(e),requestAnimationFrame(()=>{As(e)})},Ku=(e,t)=>{t.videoData||(t.videoData=new Uint8Array(t.buffer),t.buffer=null),e.loop=t.loop,e.autoPlay=t.autoPlay,e.videoWidth=t.bounds.xMax,e.videoHeight=t.bounds.yMax,e.volume=t.volume,e.src=URL.createObjectURL(new Blob([t.videoData.buffer],{type:"video/mp4"}))};class Xr extends hr{duration;smoothing;loop;autoPlay;currentTime;videoWidth;videoHeight;loaded;ended;isVideo;$videoElement;$offscreenCanvas;$context;paused;_$timerId;_$volume;_$src;constructor(t=0,r=0){super(),this.videoWidth=t,this.videoHeight=r,this.isVideo=!0,this.duration=0,this.smoothing=!0,this.loop=!1,this.loaded=!1,this.ended=!1,this.paused=!0,this.autoPlay=!0,this.currentTime=0,this._$src="",this._$timerId=-1,this._$volume=1,this.$videoElement=null,this.$offscreenCanvas=null,this.$context=null}static get namespace(){return"next2d.media.Video"}get namespace(){return"next2d.media.Video"}get src(){return this._$src}set src(t){this._$src!==t&&(this.loaded=!1,this.currentTime=0,this.$videoElement=null,this.$offscreenCanvas=null,this.$context=null,this.$videoElement=Du(),Vu(this.$videoElement,this),this._$src=this.$videoElement.src=t,this.$videoElement.load())}get muted(){return this.$videoElement?this.$videoElement.muted:!1}set muted(t){this.$videoElement&&(this.$videoElement.muted=t)}get volume(){return this._$volume}set volume(t){this._$volume=xn(Math.min(rt.volume,t),0,1,1),this.$videoElement&&(this.$videoElement.volume=this._$volume)}pause(){if(!this.$videoElement||this.paused)return;this.paused=!0,this.$videoElement.pause(),cancelAnimationFrame(this._$timerId),this.willTrigger(Ae.PAUSE)&&this.dispatchEvent(new Ae(Ae.PAUSE));const t=fr(),r=t.indexOf(this);r>-1&&t.splice(r,1)}async play(){!this.$videoElement||!this.paused||(this.paused=!1,this.ended=!1,this.$videoElement.volume=this._$volume,await this.$videoElement.play(),this._$timerId=As(this))}seek(t){this.$videoElement&&(this.currentTime=this.$videoElement.currentTime=Math.min(this.duration,t),this.willTrigger(Ae.SEEK)&&this.dispatchEvent(new Ae(Ae.SEEK)))}$sync(t,r=null){r&&super.$syncLoaderInfo(r),Ku(this,t)}}const At=(e,t,r,n,i=-1)=>{const s=n.loaderInfo;if(!s)throw new Error("the loaderInfo or data is null.");e.parent=n,we.set(e,n.root),Dt.set(e,s),e.dictionaryId=t,e.characterId=r.characterId,e.clipDepth=r.clipDepth,e.startFrame=r.startFrame,e.endFrame=r.endFrame,e.name=r.name||"",e.placeId=i},Qn=(e,t,r,n,i=-1)=>{switch(r.extends){case qt.namespace:{const s=new qt;return At(s,e,t,n,i),s.$sync(r),s}case $t.namespace:{const s=new $t;return At(s,e,t,n,i),s.$sync(r),s}case Qr.namespace:{const s=new Qr;return At(s,e,t,n,i),s.$sync(r),s}case Xr.namespace:{const s=new Xr;return At(s,e,t,n,i),s.$sync(r),s}default:throw new Error(`Character extends not found: ${r.extends}`)}},Rt=new Map,Qu=(e,t)=>{const r=e.loaderInfo;if(!r||!r.data)return t;const n=r.data.characters[e.characterId];if(!n)return t;const i=e.currentFrame,s=n.controller[i];if(!s)return t;const a=[],o=n.dictionary;if(!t.length){for(let c=0;c<s.length;++c){if(!(c in s))continue;const u=s[c];if(typeof u!="number")continue;const h=o[u];if(!h)continue;const l=r.data.characters[h.characterId];if(!l)continue;const f=Qn(u,h,l,e,c);f&&(t.push(f),f.isContainerEnabled&&a.push(f))}return e.$container=a,t}for(let c=0;c<t.length;++c){const u=t[c];if(!u)continue;const h=u.startFrame,l=u.endFrame;if(h===1&&l===0||h<=i&&l>i){Rt.set(u.dictionaryId,u);continue}u.uniqueKey&&O.has(u.uniqueKey)&&O.removeTimer(u.uniqueKey),u.willTrigger(x.REMOVED)&&u.dispatchEvent(new x(x.REMOVED,!0)),u.willTrigger(x.REMOVED_FROM_STAGE)&&u.dispatchEvent(new x(x.REMOVED_FROM_STAGE,!0)),u.isVideo&&u.pause(),u.isContainerEnabled&&un(u)}t.length=0;for(let c=0;c<s.length;++c){if(!(c in s))continue;const u=s[c];if(typeof u!="number")continue;if(Rt.has(u)){const A=Rt.get(u);A.placeId=c,A.placeObject=null,t.push(A);continue}const h=o[u];if(!h)continue;const l=r.data.characters[h.characterId];if(!l)continue;const f=Qn(u,h,l,e,c);f&&(t.push(f),f.isContainerEnabled&&a.push(f))}return e.$container=a,Rt.clear(),t},Xu=(e,t)=>{e.$labels||(e.$labels=new Map),e.$labels.set(t.frame,t)},zu=e=>{if(!e.$labels)return null;const t=e.currentFrame;return e.$labels.has(t)&&e.$labels.get(t)||null},Hu=e=>!e.$labels||!e.$labels.size?null:Array.from(e.$labels.values()),Ju=(e,t)=>{if(!e.$labels||!e.$labels.size)return 0;for(const[r,n]of e.$labels)if(n.name===t)return r;return 0},Zu=(e,t=null)=>{if(!t||!t.size)return;const r=e.currentFrame;if(!t.has(r))return;const n=t.get(r);n.willTrigger(x.FRAME_LABEL)&&n.dispatchEvent(new x(x.FRAME_LABEL))},qu=(e,t=null)=>{if(!t||!t.size)return;const r=e.currentFrame;t.has(r)&&kr.push(e)},Zt=e=>{e.$canAction&&(e.$canAction=!1,Zu(e,e.$labels),qu(e,e.$actions))},Ar=(e,t)=>{if(e.totalFrames===1)return;let r=+t;if(isNaN(r)&&(r=Ju(e,`${t}`)),1>r&&(r=1),e.currentFrame!==r){if(r>e.totalFrames){if(e.currentFrame===e.totalFrames)return;e.$wait=!0,e.$canSound=!0,e.$canAction=!0,e.$hasTimelineHeadMoved=!0,e.currentFrame=e.totalFrames,Zt(e),j(e);return}e.currentFrame=r,e.$wait=!0,e.$canSound=!0,e.$canAction=!0,e.$hasTimelineHeadMoved=!0,j(e),Zt(e)}},ju=(e,t)=>{e.play(),Ar(e,t)},eh=(e,t)=>{e.stop(),Ar(e,t),e.$wait=!1},th=e=>{e.totalFrames<=e.currentFrame||(e.stop(),Ar(e,e.currentFrame+1))},rh=e=>{2>e.currentFrame||(e.stop(),Ar(e,e.currentFrame-1))},nh=(e,t)=>{for(let r=0;r<t.length;++r){const n=t[r];if(!n)continue;n.script||(n.script=Function(n.action));const i=n.frame;e.has(i)||e.set(i,z()),e.get(i)?.push(n.script)}},ih=(e,t)=>{for(let r=0;r<t.length;++r){const n=t[r];n&&e.set(n.frame,new Ki(n.name,n.frame))}},sh=async(e,t,r)=>{const n=e.loaderInfo;if(!n)return;const i=n.data;if(!i)return;const s=i.characters;for(let a=0;a<r.length;++a){const o=r[a];if(!o)continue;const c=z();for(let u=0;u<o.sound.length;++u){const h=o.sound[u];if(!h)continue;const l=s[h.characterId];if(!l)continue;const f=new dr;f.loopCount=h.loopCount|0,f.volume=Math.min(rt.volume,h.volume),await f.$build(l),c.push(f)}t.set(o.frame,c)}},ah=(e,t)=>{t.actions&&(e.$actions||(e.$actions=new Map),nh(e.$actions,t.actions)),t.sounds&&(e.$sounds||(e.$sounds=new Map),sh(e,e.$sounds,t.sounds)),t.labels&&(e.$labels||(e.$labels=new Map),ih(e.$labels,t.labels)),e.totalFrames=t.totalFrame||1};class qt extends An{$labels;$actions;$sounds;$canAction;$wait;totalFrames;currentFrame;_$stopFlag;$canSound;$hasTimelineHeadMoved;isTimelineEnabled;constructor(){super(),this.currentFrame=1,this.totalFrames=1,this.isTimelineEnabled=!0,this.$actions=null,this.$labels=null,this.$sounds=null,this.$canAction=!0,this.$wait=!1,this.$canSound=!0,this.$hasTimelineHeadMoved=!0,this._$stopFlag=!1}static get namespace(){return"next2d.display.MovieClip"}get namespace(){return"next2d.display.MovieClip"}get children(){return!this.$hasTimelineHeadMoved||this.characterId===-1?this._$children:(this.$hasTimelineHeadMoved=!1,Qu(this,this._$children))}get currentFrameLabel(){return zu(this)}get currentLabels(){return Hu(this)}get isPlaying(){return!this._$stopFlag}gotoAndPlay(t){ju(this,t)}gotoAndStop(t){eh(this,t)}nextFrame(){th(this)}play(){this._$stopFlag=!1,j(this)}prevFrame(){rh(this)}stop(){this._$stopFlag=!0}addFrameLabel(t){Xu(this,t)}$sync(t,r=null){r&&super.$syncLoaderInfo(r),ah(this,t)}}const Xn=async(e,t)=>{const r=new Map;if(t.symbols.length)for(let a=0;a<t.symbols.length;++a){const o=t.symbols[a];r.set(o[0],o[1])}const n=e.contentLoaderInfo;n.data={stage:t.stage,characters:t.characters,symbols:r};const i=new qt,s=t.characters[0];At(i,-1,{characterId:0,name:"main",clipDepth:0,endFrame:s.controller.length,startFrame:1},e),i.$sync(s,n),i.parent=null,n.content=i,n.willTrigger(x.COMPLETE)&&n.dispatchEvent(new x(x.COMPLETE))},ps=`(function(){"use strict";var l=Uint8Array,k=Uint16Array,tr=Int32Array,W=new l([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),X=new l([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),ur=new l([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Y=function(r,e){for(var n=new k(31),i=0;i<31;++i)n[i]=e+=1<<r[i-1];for(var f=new tr(n[30]),i=1;i<30;++i)for(var g=n[i];g<n[i+1];++g)f[g]=g-n[i]<<5|i;return{b:n,r:f}},Z=Y(W,2),$=Z.b,cr=Z.r;$[28]=258,cr[258]=28;for(var wr=Y(X,0),gr=wr.b,O=new k(32768),v=0;v<32768;++v){var b=(v&43690)>>1|(v&21845)<<1;b=(b&52428)>>2|(b&13107)<<2,b=(b&61680)>>4|(b&3855)<<4,O[v]=((b&65280)>>8|(b&255)<<8)>>1}for(var m=(function(r,e,n){for(var i=r.length,f=0,g=new k(e);f<i;++f)r[f]&&++g[r[f]-1];var s=new k(e);for(f=1;f<e;++f)s[f]=s[f-1]+g[f-1]<<1;var h;if(n){h=new k(1<<e);var p=15-e;for(f=0;f<i;++f)if(r[f])for(var C=f<<4|r[f],y=e-r[f],a=s[r[f]-1]++<<y,o=a|(1<<y)-1;a<=o;++a)h[O[a]>>p]=C}else for(h=new k(i),f=0;f<i;++f)r[f]&&(h[f]=O[s[r[f]-1]++]>>15-r[f]);return h}),A=new l(288),v=0;v<144;++v)A[v]=8;for(var v=144;v<256;++v)A[v]=9;for(var v=256;v<280;++v)A[v]=7;for(var v=280;v<288;++v)A[v]=8;for(var j=new l(32),v=0;v<32;++v)j[v]=5;var hr=m(A,9,1),br=m(j,5,1),B=function(r){for(var e=r[0],n=1;n<r.length;++n)r[n]>e&&(e=r[n]);return e},c=function(r,e,n){var i=e/8|0;return(r[i]|r[i+1]<<8)>>(e&7)&n},J=function(r,e){var n=e/8|0;return(r[n]|r[n+1]<<8|r[n+2]<<16)>>(e&7)},sr=function(r){return(r+7)/8|0},yr=function(r,e,n){return(n==null||n>r.length)&&(n=r.length),new l(r.subarray(e,n))},zr=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],t=function(r,e,n){var i=new Error(e||zr[r]);if(i.code=r,Error.captureStackTrace&&Error.captureStackTrace(i,t),!n)throw i;return i},N=function(r,e,n,i){var f=r.length,g=0;if(!f||e.f&&!e.l)return n||new l(0);var s=!n,h=s||e.i!=2,p=e.i;s&&(n=new l(f*3));var C=function(vr){var or=n.length;if(vr>or){var lr=new l(Math.max(or*2,vr));lr.set(n),n=lr}},y=e.f||0,a=e.p||0,o=e.b||0,F=e.l,D=e.d,E=e.m,T=e.n,R=f*8;do{if(!F){y=c(r,a,1);var _=c(r,a+1,3);if(a+=3,_)if(_==1)F=hr,D=br,E=9,T=5;else if(_==2){var H=c(r,a,31)+257,L=c(r,a+10,15)+4,d=H+c(r,a+5,31)+1;a+=14;for(var M=new l(d),K=new l(19),u=0;u<L;++u)K[ur[u]]=c(r,a+u*3,7);a+=L*3;for(var rr=B(K),Mr=(1<<rr)-1,Ur=m(K,rr,1),u=0;u<d;){var er=Ur[c(r,a,Mr)];a+=er&15;var w=er>>4;if(w<16)M[u++]=w;else{var x=0,I=0;for(w==16?(I=3+c(r,a,3),a+=2,x=M[u-1]):w==17?(I=3+c(r,a,7),a+=3):w==18&&(I=11+c(r,a,127),a+=7);I--;)M[u++]=x}}var nr=M.subarray(0,H),z=M.subarray(H);E=B(nr),T=B(z),F=m(nr,E,1),D=m(z,T,1)}else t(1);else{var w=sr(a)+4,q=r[w-4]|r[w-3]<<8,G=w+q;if(G>f){p&&t(0);break}h&&C(o+q),n.set(r.subarray(w,G),o),e.b=o+=q,e.p=a=G*8,e.f=y;continue}if(a>R){p&&t(0);break}}h&&C(o+131072);for(var Dr=(1<<E)-1,Ir=(1<<T)-1,P=a;;P=a){var x=F[J(r,a)&Dr],S=x>>4;if(a+=x&15,a>R){p&&t(0);break}if(x||t(2),S<256)n[o++]=S;else if(S==256){P=a,F=null;break}else{var ar=S-254;if(S>264){var u=S-257,U=W[u];ar=c(r,a,(1<<U)-1)+$[u],a+=U}var Q=D[J(r,a)&Ir],V=Q>>4;Q||t(3),a+=Q&15;var z=gr[V];if(V>3){var U=X[V];z+=J(r,a)&(1<<U)-1,a+=U}if(a>R){p&&t(0);break}h&&C(o+131072);var ir=o+ar;if(o<z){var fr=g-z,Or=Math.min(z,ir);for(fr+o<0&&t(3);o<Or;++o)n[o]=i[fr+o]}for(;o<ir;++o)n[o]=n[o-z]}}e.l=F,e.p=P,e.b=o,e.f=y,F&&(y=1,e.m=E,e.d=D,e.n=T)}while(!y);return o!=n.length&&s?yr(n,0,o):n.subarray(0,o)},Fr=new l(0),kr=function(r){(r[0]!=31||r[1]!=139||r[2]!=8)&&t(6,"invalid gzip data");var e=r[3],n=10;e&4&&(n+=(r[10]|r[11]<<8)+2);for(var i=(e>>3&1)+(e>>4&1);i>0;i-=!r[n++]);return n+(e&2)},pr=function(r){var e=r.length;return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0},xr=function(r,e){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&t(6,"invalid zlib data"),(r[1]>>5&1)==1&&t(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function Sr(r,e){return N(r,{i:2},e,e)}function mr(r,e){var n=kr(r);return n+8>r.length&&t(6,"invalid gzip data"),N(r.subarray(n,-8),{i:2},new l(pr(r)),e)}function Ar(r,e){return N(r.subarray(xr(r),-4),{i:2},e,e)}function Cr(r,e){return r[0]==31&&r[1]==139&&r[2]==8?mr(r,e):(r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31?Sr(r,e):Ar(r,e)}var Er=typeof TextDecoder<"u"&&new TextDecoder,Tr=0;try{Er.decode(Fr,{stream:!0}),Tr=1}catch{}self.addEventListener("message",r=>{const e=Cr(r.data);let n="";for(let i=0;i<e.length;i+=4096)n+=String.fromCharCode(...e.subarray(i,i+4096));self.postMessage(JSON.parse(decodeURIComponent(n)))})})();
2345
+ `,zn=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",ps],{type:"text/javascript;charset=utf-8"});function oh(e){let t;try{if(t=zn&&(self.URL||self.webkitURL).createObjectURL(zn),!t)throw"";const r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(ps),{name:e?.name})}}const Hn=new oh,ms=async(e,t)=>{t.type==="zlib"?await new Promise(r=>{Hn.onmessage=i=>{Xn(e,i.data),r()};const n=new Uint8Array(t.buffer);Hn.postMessage(n,[n.buffer])}):Xn(e,t)},ch=(e,t)=>{e.willTrigger(x.OPEN)&&e.dispatchEvent(new x(x.OPEN)),e.willTrigger(Z.PROGRESS)&&e.dispatchEvent(new Z(Z.PROGRESS,!1,t.loaded,t.total))},lh=(e,t)=>{e.willTrigger(Z.PROGRESS)&&e.dispatchEvent(new Z(Z.PROGRESS,!1,t.loaded,t.total))},uh=async(e,t)=>{const r=t.target;if(!r)return;const n=e.contentLoaderInfo;if(n.willTrigger(Z.PROGRESS)&&n.dispatchEvent(new Z(Z.PROGRESS,!1,t.loaded,t.total)),n.willTrigger(Gt.HTTP_STATUS)){const i=oo(r.getAllResponseHeaders());n.dispatchEvent(new Gt(Gt.HTTP_STATUS,!1,r.status,r.responseURL,i))}199<r.status&&400>r.status?(await ms(e,r.response),n.willTrigger(x.COMPLETE)&&n.dispatchEvent(new x(x.COMPLETE))):n.willTrigger(Re.IO_ERROR)&&n.dispatchEvent(new Re(Re.IO_ERROR,!1,r.statusText))},hh=async(e,t)=>{await new Promise(r=>{ao({format:t.responseDataFormat,url:t.url,method:t.method,data:t.data,headers:t.headers,withCredentials:t.withCredentials,event:{loadstart:n=>{ch(e.contentLoaderInfo,n)},progress:n=>{lh(e.contentLoaderInfo,n)},loadend:async n=>{await uh(e,n),r()}}})})};class gs{contentLoaderInfo;root;constructor(){this.root=null,this.contentLoaderInfo=new Sc}get content(){return this.contentLoaderInfo.content}get loaderInfo(){return this.contentLoaderInfo}async load(t){if(t.responseDataFormat!=="json")throw new Error("The only format that can be loaded by this function is `json` format.");this.contentLoaderInfo.url=t.url,this.contentLoaderInfo.format=t.responseDataFormat,await hh(this,t)}async loadJSON(t){await ms(this,t)}}const bs=()=>{for(;kr.length;){const e=kr.pop(),t=e.$actions;if(!t)continue;const r=e.currentFrame;if(!t.has(r))continue;const n=t.get(r);if(n)for(let i=0;i<n.length;i++)try{n[i].apply(e)}catch(s){console.error(s)}}},xs=()=>{for(;Ur.length;){const e=Ur.pop(),t=e.$sounds;if(!t)continue;const r=e.currentFrame;if(!t.has(r))continue;const n=t.get(r),i=e.soundTransform;for(let s=0;s<n.length;s++){const a=n[s];a&&(i&&(a.volume=i.volume,a.loopCount=i.loopCount),a.play())}}},fh=(e,t=null)=>{if(!t||!t.size)return;const r=e.currentFrame;t.has(r)&&Ur.push(e)},ys=e=>{e.$canSound&&(e.$canSound=!1,fh(e,e.$sounds))},$s=e=>{const t=e.children;for(let r=t.length-1;r>-1;--r){const n=t[r];n&&n.isContainerEnabled&&($s(n),n.isTimelineEnabled&&(ys(n),Zt(n)))}},dh=e=>{$s(e),xs(),bs()},Ah=e=>(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e);class ph{buffer;offset;constructor(){this.buffer=new Float32Array(256),this.offset=0}push(...t){this.buffer.length<this.offset+t.length&&this.resize(t.length);for(let r=0;r<t.length;r++)this.buffer[this.offset++]=t[r]}pushDisplayObjectBuffer(t,r,n,i,s,a,o,c,u,h,l,f,A,d,y,g,p,$,w,I,P,W){this.buffer.length<this.offset+22&&this.resize(22),this.buffer[this.offset++]=t,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=i,this.buffer[this.offset++]=s,this.buffer[this.offset++]=a,this.buffer[this.offset++]=o,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=h,this.buffer[this.offset++]=l,this.buffer[this.offset++]=f,this.buffer[this.offset++]=A,this.buffer[this.offset++]=d,this.buffer[this.offset++]=y,this.buffer[this.offset++]=g,this.buffer[this.offset++]=p,this.buffer[this.offset++]=$,this.buffer[this.offset++]=w,this.buffer[this.offset++]=I,this.buffer[this.offset++]=P,this.buffer[this.offset++]=W}pushInstanceBuffer(t,r,n,i,s,a,o,c,u,h,l,f,A,d,y,g,p,$,w,I,P,W,C,R){this.buffer.length<this.offset+24&&this.resize(24),this.buffer[this.offset++]=t,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=i,this.buffer[this.offset++]=s,this.buffer[this.offset++]=a,this.buffer[this.offset++]=o,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=h,this.buffer[this.offset++]=l,this.buffer[this.offset++]=f,this.buffer[this.offset++]=A,this.buffer[this.offset++]=d,this.buffer[this.offset++]=y,this.buffer[this.offset++]=g,this.buffer[this.offset++]=p,this.buffer[this.offset++]=$,this.buffer[this.offset++]=w,this.buffer[this.offset++]=I,this.buffer[this.offset++]=P,this.buffer[this.offset++]=W,this.buffer[this.offset++]=C,this.buffer[this.offset++]=R}pushShapeBuffer(t,r,n,i,s,a,o,c,u,h,l,f,A,d,y,g,p,$,w,I,P,W,C,R,L,N,J,Y,ee,Q,ce,ae){this.buffer.length<this.offset+32&&this.resize(32),this.buffer[this.offset++]=t,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=i,this.buffer[this.offset++]=s,this.buffer[this.offset++]=a,this.buffer[this.offset++]=o,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=h,this.buffer[this.offset++]=l,this.buffer[this.offset++]=f,this.buffer[this.offset++]=A,this.buffer[this.offset++]=d,this.buffer[this.offset++]=y,this.buffer[this.offset++]=g,this.buffer[this.offset++]=p,this.buffer[this.offset++]=$,this.buffer[this.offset++]=w,this.buffer[this.offset++]=I,this.buffer[this.offset++]=P,this.buffer[this.offset++]=W,this.buffer[this.offset++]=C,this.buffer[this.offset++]=R,this.buffer[this.offset++]=L,this.buffer[this.offset++]=N,this.buffer[this.offset++]=J,this.buffer[this.offset++]=Y,this.buffer[this.offset++]=ee,this.buffer[this.offset++]=Q,this.buffer[this.offset++]=ce,this.buffer[this.offset++]=ae}pushTextFieldBuffer(t,r,n,i,s,a,o,c,u,h,l,f,A,d,y,g,p,$,w,I,P,W,C,R,L,N,J,Y,ee,Q){this.buffer.length<this.offset+30&&this.resize(30),this.buffer[this.offset++]=t,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=i,this.buffer[this.offset++]=s,this.buffer[this.offset++]=a,this.buffer[this.offset++]=o,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=h,this.buffer[this.offset++]=l,this.buffer[this.offset++]=f,this.buffer[this.offset++]=A,this.buffer[this.offset++]=d,this.buffer[this.offset++]=y,this.buffer[this.offset++]=g,this.buffer[this.offset++]=p,this.buffer[this.offset++]=$,this.buffer[this.offset++]=w,this.buffer[this.offset++]=I,this.buffer[this.offset++]=P,this.buffer[this.offset++]=W,this.buffer[this.offset++]=C,this.buffer[this.offset++]=R,this.buffer[this.offset++]=L,this.buffer[this.offset++]=N,this.buffer[this.offset++]=J,this.buffer[this.offset++]=Y,this.buffer[this.offset++]=ee,this.buffer[this.offset++]=Q}pushVideoBuffer(t,r,n,i,s,a,o,c,u,h,l,f,A,d,y,g,p,$,w,I,P,W,C,R,L,N,J){this.buffer.length<this.offset+27&&this.resize(27),this.buffer[this.offset++]=t,this.buffer[this.offset++]=r,this.buffer[this.offset++]=n,this.buffer[this.offset++]=i,this.buffer[this.offset++]=s,this.buffer[this.offset++]=a,this.buffer[this.offset++]=o,this.buffer[this.offset++]=c,this.buffer[this.offset++]=u,this.buffer[this.offset++]=h,this.buffer[this.offset++]=l,this.buffer[this.offset++]=f,this.buffer[this.offset++]=A,this.buffer[this.offset++]=d,this.buffer[this.offset++]=y,this.buffer[this.offset++]=g,this.buffer[this.offset++]=p,this.buffer[this.offset++]=$,this.buffer[this.offset++]=w,this.buffer[this.offset++]=I,this.buffer[this.offset++]=P,this.buffer[this.offset++]=W,this.buffer[this.offset++]=C,this.buffer[this.offset++]=R,this.buffer[this.offset++]=L,this.buffer[this.offset++]=N,this.buffer[this.offset++]=J}set(t){this.buffer.length<this.offset+t.length&&this.resize(t.length),this.buffer.set(t,this.offset),this.offset+=t.length}resize(t){const r=new Float32Array(Ah(this.offset+t));this.buffer.length&&r.set(this.buffer),this.buffer=r}}const b=new ph,mt=e=>{const t=new Uint32Array(e.buffer,e.byteOffset,e.length),r=t.length;let n=2166136261,i=0;const s=r&-8;for(;i<s;){let a=t[i++];n=Math.imul(n^a&255,16777619),n=Math.imul(n^a>>8&255,16777619),n=Math.imul(n^a>>16&255,16777619),n=Math.imul(n^a>>>24,16777619),a=t[i++],n=Math.imul(n^a&255,16777619),n=Math.imul(n^a>>8&255,16777619),n=Math.imul(n^a>>16&255,16777619),n=Math.imul(n^a>>>24,16777619),a=t[i++],n=Math.imul(n^a&255,16777619),n=Math.imul(n^a>>8&255,16777619),n=Math.imul(n^a>>16&255,16777619),n=Math.imul(n^a>>>24,16777619),a=t[i++],n=Math.imul(n^a&255,16777619),n=Math.imul(n^a>>8&255,16777619),n=Math.imul(n^a>>16&255,16777619),n=Math.imul(n^a>>>24,16777619),a=t[i++],n=Math.imul(n^a&255,16777619),n=Math.imul(n^a>>8&255,16777619),n=Math.imul(n^a>>16&255,16777619),n=Math.imul(n^a>>>24,16777619),a=t[i++],n=Math.imul(n^a&255,16777619),n=Math.imul(n^a>>8&255,16777619),n=Math.imul(n^a>>16&255,16777619),n=Math.imul(n^a>>>24,16777619),a=t[i++],n=Math.imul(n^a&255,16777619),n=Math.imul(n^a>>8&255,16777619),n=Math.imul(n^a>>16&255,16777619),n=Math.imul(n^a>>>24,16777619),a=t[i++],n=Math.imul(n^a&255,16777619),n=Math.imul(n^a>>8&255,16777619),n=Math.imul(n^a>>16&255,16777619),n=Math.imul(n^a>>>24,16777619)}for(;i<r;){const a=t[i++];n=Math.imul(n^a&255,16777619),n=Math.imul(n^a>>8&255,16777619),n=Math.imul(n^a>>16&255,16777619),n=Math.imul(n^a>>>24,16777619)}return n>>>8^n&255&16777215},pr=e=>{switch(e){case"copy":return 0;case"add":return 1;case"alpha":return 2;case"darken":return 3;case"difference":return 4;case"erase":return 5;case"hardlight":return 6;case"invert":return 7;case"layer":return 8;case"lighten":return 9;case"multiply":return 10;case"normal":return 11;case"overlay":return 12;case"screen":return 13;case"subtract":return 14;default:return 11}},vs=(e,t,r,n,i)=>{if(!e.visible){b.push(0);return}const s=e.graphics,a=s.isDrawable;if(!a&&!e.isBitmap){b.push(0);return}const o=Ve(e),c=o&&(o[0]!==1||o[1]!==1||o[2]!==1||o[3]!==1||o[4]!==0||o[5]!==0||o[6]!==0||o[7]!==0)?U.multiply(r,o):r;if(!me(c[3]+c[7]/255,0,1,0)){c!==r&&U.release(c),b.push(0);return}const h=_(e),l=h&&(h[0]!==1||h[1]!==0||h[2]!==0||h[3]!==1||h[4]!==0||h[5]!==0)?T.multiply(t,h):t,f=he(s.xMin,s.yMin,s.xMax,s.yMax,l),A=f[0],d=f[1],y=f[2],g=f[3];k(f);const p=Math.ceil(Math.abs(y-A)),$=Math.ceil(Math.abs(g-d));switch(!0){case p===0:case $===0:case p===-1/0:case $===-1/0:case p===1/0:case $===1/0:c!==r&&U.release(c),l!==t&&T.release(l),b.push(0);return}if(0>A+p||0>d+$||A>n||d>i){c!==r&&U.release(c),l!==t&&T.release(l),b.push(0);return}const w=h&&e.scale9Grid?Math.abs(h[1])<.001&&Math.abs(h[2])<1e-4:!1;if(!e.uniqueKey)if(e.characterId&&e.loaderInfo){const J=z(e.loaderInfo.id,e.characterId);e.uniqueKey=`${mt(new Float32Array(J))}`,oe(J)}else e.uniqueKey=e.isBitmap?`${mt(new Float32Array(e.$bitmapBuffer.buffer))}`:`${mt(s.buffer)}`;const I=Math.sqrt(l[0]*l[0]+l[1]*l[1]),P=Math.sqrt(l[2]*l[2]+l[3]*l[3]),W=Math.round(I*100)/100,C=Math.round(P*100)/100;(!e.isBitmap&&!e.cacheKey||e.cacheParams[0]!==W||e.cacheParams[1]!==C||e.cacheParams[2]!==c[7])&&(e.cacheKey=O.generateKeys(W,C,c[7]),e.cacheParams[0]=W,e.cacheParams[1]=C,e.cacheParams[2]=c[7]);const R=e.isBitmap?0:e.cacheKey;if(b.pushShapeBuffer(1,xi,l[0],l[1],l[2],l[3],l[4],l[5],c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],A,d,y,g,s.xMin,s.yMin,s.xMax,s.yMax,+w,+a,+e.isBitmap,+e.uniqueKey,R,I,P,e.instanceId),e.$cache&&!e.$cache.has(e.uniqueKey)&&(e.$cache=null),e.$cache?e.$cache.get(`${R}`):O.get(e.uniqueKey,`${R}`))e.$cache||(e.$cache=O.getById(e.uniqueKey),e.$cache.set(e.uniqueKey,!0)),b.push(1);else{if(b.push(0),w){const Y=v.rendererScale,ee=je(Y,0,0,Y,0,0),Q=T.multiply(ee,h||xt);Ft(ee);const ce=e.parent.concatenatedMatrix.rawData,ae=je(ce[0],ce[1],ce[2],ce[3],ce[4]*Y-A,ce[5]*Y-d);T.release(ce);const Ke=T.multiply(ae,Q),Qe=Ke[4]-(l[4]-A),ks=Ke[5]-(l[5]-d);Ft(Ke);const st=he(s.xMin,s.yMin,s.xMax,s.yMax,Q),Bn=st[0],Tn=st[1],Us=st[2],Gs=st[3];k(st);const Tt=Math.ceil(Math.abs(Us-Bn)),St=Math.ceil(Math.abs(Gs-Tn)),xe=e.scale9Grid,br=Math.abs(s.xMax-s.xMin),xr=Math.abs(s.yMax-s.yMin),It=xe.width>0?(xe.x-s.xMin)/br:1e-5,Ct=xe.height>0?(xe.y-s.yMin)/xr:1e-5,yr=xe.width>0?(xe.x+xe.width-s.xMin)/br:.99999,$r=xe.height>0?(xe.y+xe.height-s.yMin)/xr:.99999,Sn=Math.ceil(br*Y),In=Math.ceil(xr*Y);let vr=Sn*It/Tt,wr=In*Ct/St,Mr=(Tt-Sn*(1-yr))/Tt,Br=(St-In*(1-$r))/St;if(vr>=Mr){const at=It/(It+(1-yr));vr=Math.max(at-1e-5,0),Mr=Math.min(at+1e-5,1)}if(wr>=Br){const at=Ct/(Ct+(1-$r));wr=Math.max(at-1e-5,0),Br=Math.min(at+1e-5,1)}b.push(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5],ae[0],ae[1],ae[2],ae[3],ae[4]-Qe,ae[5]-ks,Bn,Tn,Tt,St,It,Ct,vr,wr,yr,$r,Mr,Br),Ft(ae),Ft(Q)}const J=a||w?s.buffer:e.$bitmapBuffer;b.push(J.length),b.set(J),O.set(e.uniqueKey,`${R}`,!0),e.$cache&&(e.$cache=null)}b.push(pr(e.blendMode));const N=e.filters;if(N){let J=!1;const Y=[],ee=re(0,0,0,0);for(let ce=0;ce<N.length;ce++){const ae=N[ce];if(!ae||!ae.canApplyFilter())continue;ae.$updated&&(J=!0),ae.$updated=!1,ae.getBounds(ee);const Ke=ae.toNumberArray();for(let Qe=0;Qe<Ke.length;Qe+=4096)Y.push(...Ke.subarray(Qe,Qe+4096))}const Q=Y.length>0;Q?(b.push(+Q,+J,ee[0],ee[1],ee[2],ee[3],Y.length),b.set(new Float32Array(Y))):b.push(0),k(ee)}else b.push(0);c!==r&&U.release(c),l!==t&&T.release(l)},zr=(e,t)=>{const r=_(e),n=r?T.multiply(t,r):t;n!==t&&T.release(n);const i=r&&e.scale9Grid?Math.abs(r[1])<.001&&Math.abs(r[2])<1e-4:!1,s=e.graphics.buffer;b.push(xi,n[0],n[1],n[2],n[3],n[4],n[5],+i,s.length),b.set(s)},mh=new TextEncoder,ws=(e,t,r,n,i)=>{if(!e.visible){b.push(0);return}const s=Ve(e),a=s&&(s[0]!==1||s[1]!==1||s[2]!==1||s[3]!==1||s[4]!==0||s[5]!==0||s[6]!==0||s[7]!==0)?U.multiply(r,s):r;if(!me(a[3]+a[7]/255,0,1,0)){a!==r&&U.release(a),b.push(0);return}const c=_(e),u=c&&(c[0]!==1||c[1]!==0||c[2]!==0||c[3]!==1||c[4]!==0||c[5]!==0)?T.multiply(t,c):t,h=he(e.xMin,e.yMin,e.xMax,e.yMax,u),l=h[0],f=h[1],A=h[2],d=h[3];k(h);const y=Math.ceil(Math.abs(A-l)),g=Math.ceil(Math.abs(d-f));switch(!0){case y===0:case g===0:case y===-1/0:case g===-1/0:case y===1/0:case g===1/0:a!==r&&U.release(a),u!==t&&T.release(u),b.push(0);return}if(0>l+y||0>f+g||l>n||f>i){a!==r&&U.release(a),u!==t&&T.release(u),b.push(0);return}if(!e.uniqueKey)if(e.characterId&&e.loaderInfo){const C=z(e.loaderInfo.id,e.characterId);e.uniqueKey=`${mt(new Float32Array(C))}`,oe(C)}else e.uniqueKey=`${e.instanceId}`;const p=Math.sqrt(u[0]*u[0]+u[1]*u[1]),$=Math.sqrt(u[2]*u[2]+u[3]*u[3]),w=Math.round(p*100)/100,I=Math.round($*100)/100;(e.changed&&!e.cacheKey||e.cacheParams[0]!==w||e.cacheParams[1]!==I||e.cacheParams[2]!==a[7])&&(e.cacheKey=O.generateKeys(w,I,a[7]),e.cacheParams[0]=w,e.cacheParams[1]=I,e.cacheParams[2]=a[7]);const P=e.cacheKey;b.pushTextFieldBuffer(1,eo,u[0],u[1],u[2],u[3],u[4],u[5],a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],l,f,A,d,e.xMin,e.yMin,e.xMax,e.yMax,+e.uniqueKey,P,+e.changed,p,$,e.instanceId),e.$cache&&!e.$cache.has(e.uniqueKey)&&(e.$cache=null);const W=e.$cache?e.$cache.get(`${P}`):O.get(e.uniqueKey,`${P}`);if(!W||e.changed){b.push(0,+W);const C=mh.encode(JSON.stringify(e.$textData));switch(b.push(C.length),b.set(C),e.autoSize){case"center":b.push(0);break;case"left":b.push(1);break;case"none":b.push(2);break;case"right":b.push(3);break}b.push(e.stopIndex,e.scrollX,e.scrollY,e.textWidth,e.textHeight,Math.abs(e.xMax-e.xMin),Math.abs(e.yMax-e.yMin),e.focusIndex,e.selectIndex,+e.focusVisible,e.thickness,e.thicknessColor,+e.wordWrap,+e.border,e.borderColor,+e.background,e.backgroundColor,e.defaultTextFormat.color||0,e.defaultTextFormat.size||0),W||O.set(e.uniqueKey,`${P}`,!0),e.$cache&&(e.$cache=null)}else e.$cache||(e.$cache=O.getById(e.uniqueKey),e.$cache.set(e.uniqueKey,!0)),b.push(1);if(b.push(pr(e.blendMode)),e.filters?.length){let C=!1;const R=[],L=re(0,0,0,0);for(let J=0;J<e.filters.length;J++){const Y=e.filters[J];if(!Y||!Y.canApplyFilter())continue;Y.$updated&&(C=!0),Y.$updated=!1,Y.getBounds(L);const ee=Y.toNumberArray();for(let Q=0;Q<ee.length;Q+=4096)R.push(...ee.subarray(Q,Q+4096))}const N=R.length>0;N?(b.push(+N,+C,L[0],L[1],L[2],L[3],R.length),b.set(new Float32Array(R))):b.push(0),k(L)}else b.push(0);a!==r&&U.release(a),u!==t&&T.release(u)},Ms=(e,t,r,n,i,s)=>{if(!e.visible||!e.$videoElement||!e.$offscreenCanvas||!e.loaded){b.push(0);return}const a=Ve(e),o=a&&(a[0]!==1||a[1]!==1||a[2]!==1||a[3]!==1||a[4]!==0||a[5]!==0||a[6]!==0||a[7]!==0)?U.multiply(n,a):n;if(!me(o[3]+o[7]/255,0,1,0)){o!==n&&U.release(o),b.push(0);return}const u=_(e),h=u&&(u[0]!==1||u[1]!==0||u[2]!==0||u[3]!==1||u[4]!==0||u[5]!==0)?T.multiply(r,u):r,l=he(0,0,e.videoWidth,e.videoHeight,h),f=l[0],A=l[1],d=l[2],y=l[3];k(l);const g=Math.ceil(Math.abs(d-f)),p=Math.ceil(Math.abs(y-A));switch(!0){case g===0:case p===0:case g===-1/0:case p===-1/0:case g===1/0:case p===1/0:o!==n&&U.release(o),h!==r&&T.release(h),b.push(0);return}if(0>f+g||0>A+p||f>i||A>s){o!==n&&U.release(o),h!==r&&T.release(h),b.push(0);return}if(!e.uniqueKey)if(e.characterId&&e.loaderInfo){const w=z(e.loaderInfo.id,e.characterId);e.uniqueKey=`${mt(new Float32Array(w))}`,oe(w)}else e.uniqueKey=`${e.instanceId}`;b.pushVideoBuffer(1,to,h[0],h[1],h[2],h[3],h[4],h[5],o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],f,A,d,y,0,0,e.videoWidth,e.videoHeight,+e.uniqueKey,+e.changed,e.instanceId),e.$cache&&!e.$cache.has(e.uniqueKey)&&(e.$cache=null);const $=e.$cache?e.$cache.get("0"):O.get(e.uniqueKey,"0");if(!$||e.changed){b.push(0,+$);const w=e.$context;if(w){const I=e.videoWidth/2,P=e.videoHeight/2;w.save(),w.translate(I,P),w.rotate(Math.PI),w.scale(-1,1),w.drawImage(e.$videoElement,-I,-P,e.videoWidth,e.videoHeight),w.restore(),t.push(e.$offscreenCanvas.transferToImageBitmap())}$||O.set(e.uniqueKey,"0",!0),e.$cache&&(e.$cache=null)}else e.$cache||(e.$cache=O.getById(e.uniqueKey),e.$cache.set(e.uniqueKey,!0)),b.push(1);if(b.push(pr(e.blendMode)),e.filters?.length){let w=!1;const I=[],P=re(0,0,0,0);for(let C=0;C<e.filters.length;C++){const R=e.filters[C];if(!R||!R.canApplyFilter())continue;R.$updated&&(w=!0),R.$updated=!1,R.getBounds(P);const L=R.toNumberArray();for(let N=0;N<L.length;N+=4096)I.push(...L.subarray(N,N+4096))}const W=I.length>0;W?(b.push(+W,+w,P[0],P[1],P[2],P[3],I.length),b.set(new Float32Array(I))):b.push(0),k(P)}else b.push(0);o!==n&&U.release(o),h!==r&&T.release(h)},Jn=(e,t,r,n)=>{let i=null;switch(!0){case e.isContainerEnabled:i=yt(e,t);break;case e.isShape:i=wt(e,t);break;case e.isText:i=Bt(e,t);break;case e.isVideo:i=Mt(e,t);break}if(!i)return null;const s=i[0],a=i[2],o=Math.abs(a-s);if(!o)return null;const c=i[1],u=i[3],h=Math.abs(u-c);return!h||0>s+o||0>c+h||s>r||c>n?null:i},Hr=(e,t)=>{const r=_(e),n=r?T.multiply(t,r):t,i=e.children;b.push(bi,i.length);for(let s=0;s<i.length;s++){const a=i[s];if(a&&!a.isMask)switch(!0){case a.isContainerEnabled:Hr(a,n);break;case a.isShape:zr(a,n);break}}n!==t&&T.release(n)},gh=(e,t=null)=>{const r=wt(e,t),n=e.filters;if(n){const i=re(0,0,0,0);for(let s=0;s<n.length;s++){const a=n[s];!a||!a.canApplyFilter()||a.getBounds(i)}r[0]+=i[0],r[1]+=i[1],r[2]+=i[2],r[3]+=i[3],k(i)}return r},bh=(e,t=null)=>{const r=Mt(e,t),n=e.filters;if(n){const i=re(0,0,0,0);for(let s=0;s<n.length;s++){const a=n[s];!a||!a.canApplyFilter()||a.getBounds(i)}r[0]+=i[0],r[1]+=i[1],r[2]+=i[2],r[3]+=i[3],k(i)}return r},xh=(e,t=null)=>{const r=Bt(e,t),n=e.filters;if(n){const i=re(0,0,0,0);for(let s=0;s<n.length;s++){const a=n[s];!a||!a.canApplyFilter()||a.getBounds(i)}r[0]+=i[0],r[1]+=i[1],r[2]+=i[2],r[3]+=i[3],k(i)}return r},Bs=(e,t=null)=>{const r=e.children;if(!r.length)return re(0,0,0,0);const n=_(e),i=n?t?T.multiply(t,n):n:t,s=Number.MAX_VALUE;let a=s,o=-s,c=s,u=-s;for(let h=0;h<r.length;h++){const l=r[h];if(!l||!l.visible)continue;let f=null;switch(!0){case l.isContainerEnabled:f=Bs(l,i);break;case l.isShape:f=gh(l,i);break;case l.isText:f=xh(l,i);break;case l.isVideo:f=bh(l,i);break}f&&(a=Math.min(a,f[0]),c=Math.min(c,f[1]),o=Math.max(o,f[2]),u=Math.max(u,f[3]),k(f))}return re(a,c,o,u)},Ts=(e,t,r,n,i,s)=>{if(!e.visible){b.push(0);return}const a=Ve(e);let o=a&&(a[0]!==1||a[1]!==1||a[2]!==1||a[3]!==1||a[4]!==0||a[5]!==0||a[6]!==0||a[7]!==0)?U.multiply(n,a):n;if(!me(o[3]+o[7]/255,0,1,0)){o!==n&&U.release(o),b.push(0);return}const u=e.children;if(!u.length){o!==n&&U.release(o),b.push(0);return}const h=_(e);let l=h&&(h[0]!==1||h[1]!==0||h[2]!==0||h[3]!==1||h[4]!==0||h[5]!==0)?T.multiply(r,h):r;if(!l[0]&&!l[1]||!l[2]&&!l[3]){o!==n&&U.release(o),l!==r&&T.release(l),b.push(0);return}b.push(1,bi);const f=e.blendMode;b.push(pr(f));const A=e.filters;if(A){const p=O.generateFilterKeys(l[0],l[1],l[2],l[3]),$=O.get(`${e.instanceId}`,`${p}`);let w=!1;const I=[],P=re(0,0,0,0);for(let C=0;C<A.length;C++){const R=A[C];if(!R||!R.canApplyFilter())continue;R.$updated&&(w=!0),R.$updated=!1,R.getBounds(P);const L=R.toNumberArray();for(let N=0;N<L.length;N+=4096)I.push(...L.subarray(N,N+4096))}if(I.length>0){w||(w=e.changed);const C=Bs(e,r);if($){if(!w){b.push(1,Math.ceil(Math.abs(C[2]-C[0])),Math.ceil(Math.abs(C[3]-C[1])),1,1,e.instanceId,p,P[0],P[1],P[2],P[3],l[0],l[1],l[2],l[3],C[0],C[1],o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7]),k(C),k(P),o!==n&&U.release(o),l!==r&&T.release(l);return}O.removeById(`${e.instanceId}`)}b.push(1,Math.ceil(Math.abs(C[2]-C[0])),Math.ceil(Math.abs(C[3]-C[1])),1,0,e.instanceId,p,P[0],P[1],P[2],P[3],l[0],l[1],l[2],l[3],C[0],C[1],o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7],I.length),b.set(new Float32Array(I));const R=l[0],L=l[1],N=l[2],J=l[3],Y=l[4]-C[0],ee=l[5]-C[1];l!==r&&T.release(l),l=je(R,L,N,J,Y,ee),o!==n&&U.release(o),o=_t(1,1,1,1,0,0,0,0),k(C),O.set(`${e.instanceId}`,`${p}`,!0)}else if(f==="normal")b.push(0);else{const C=yt(e,r),R=C[0],L=C[1];b.push(1,Math.ceil(Math.abs(C[2]-R)),Math.ceil(Math.abs(C[3]-L)),0,l[0],l[1],l[2],l[3],R,L,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7]);const N=l[0],J=l[1],Y=l[2],ee=l[3],Q=l[4]-R,ce=l[5]-L;l!==r&&T.release(l),l=je(N,J,Y,ee,Q,ce),k(C),o!==n&&U.release(o),o=_t(1,1,1,1,0,0,0,0)}k(P)}else if(f==="normal")b.push(0);else{const p=yt(e,r),$=p[0],w=p[1];b.push(1,Math.ceil(Math.abs(p[2]-$)),Math.ceil(Math.abs(p[3]-w)),0,l[0],l[1],l[2],l[3],$,w,o[0],o[1],o[2],o[3],o[4],o[5],o[6],o[7]);const I=l[0],P=l[1],W=l[2],C=l[3],R=l[4]-$,L=l[5]-w;l!==r&&T.release(l),l=je(I,P,W,C,R,L),k(p),o!==n&&U.release(o),o=_t(1,1,1,1,0,0,0,0)}const d=e.mask;if(d){const p=Jn(d,l,i,s);if(!p)b.push(0);else switch(b.push(1,p[0],p[1],p[2],p[3]),!0){case d.isContainerEnabled:Hr(d,l);break;case d.isShape:zr(d,l);break}d.changed=!1}else b.push(0);b.push(u.length);let y=0,g=!0;for(let p=0;p<u.length;++p){const $=u[p];if(b.push($.placeId,$.clipDepth),$.isMask){b.push(0),$.changed=!1;continue}if(y&&$.placeId>y&&(y=0,g=!0),!g){b.push(0),$.changed=!1;continue}if($.clipDepth){y=$.clipDepth;const w=Jn($,l,i,s);if(g=!!w,b.push(+g),!w){$.changed=!1;continue}switch(b.push(w[0],w[1],w[2],w[3]),!0){case $.isContainerEnabled:Hr($,l);break;case $.isShape:zr($,l);break}$.changed=!1;continue}switch(!0){case $.isContainerEnabled:Ts($,t,l,o,i,s);break;case $.isShape:vs($,l,o,i,s);break;case $.isText:ws($,l,o,i,s);break;case $.isVideo:Ms($,t,l,o,i,s);break}$.changed=!1}o!==n&&U.release(o),l!==r&&T.release(l)},yh=(e,t,r,n,i,s)=>{switch(b.push(v.backgroundColor),!0){case e.isContainerEnabled:Ts(e,t,r,n,i,s);break;case e.isShape:vs(e,r,n,i,s);break;case e.isText:ws(e,r,n,i,s);break;case e.isVideo:Ms(e,t,r,n,i,s);break}e.changed=!1},Zn=e=>{e.totalFrames===1||!e.isPlaying||(e.$wait||(++e.currentFrame,e.currentFrame>e.totalFrames&&(e.currentFrame=1)),e.$wait=!1,e.$canSound=!0,e.$canAction=!0,e.$hasTimelineHeadMoved=!0,e.$container=null,ys(e),Zt(e),j(e))},Jr=e=>{const t=e.$container;if(t)for(let r=0;t.length>r;++r){const n=t[r];n.isTimelineEnabled&&Zn(n),Jr(n)}else{const r=[],n=e.children;for(let i=0;n.length>i;++i){const s=n[i];s.isContainerEnabled&&(s.isTimelineEnabled&&Zn(s),Jr(s),r.push(s))}e.$container=r}},$h=()=>{Jr(v),xs(),bs()};class vh extends dn{_$ready;stageWidth;stageHeight;frameRate;rendererScale;rendererWidth;rendererHeight;_$backgroundColor;constructor(){super(),this.stageWidth=0,this.stageHeight=0,this.frameRate=1,this.rendererScale=1,this.rendererWidth=0,this.rendererHeight=0,this._$ready=!1,this._$backgroundColor=-1}get backgroundColor(){return this._$backgroundColor}set backgroundColor(t){this._$backgroundColor=t==="transparent"?-1:parseInt(t.replace("#",""),16)}get pointer(){return bt}set ready(t){!t||this._$ready||(this._$ready=t,dh(this))}addChild(t){return ge.add(t.instanceId),we.set(this,t),super.addChild(t),we.delete(this),we.set(t,t),t}$ticker(){$h()}$generateRenderQueue(t,r,n,i){yh(t,r,n,i,this.rendererWidth,this.rendererHeight)}$mouseHit(t,r,n){He(this,t,r,n,!0)}}const v=new vh;ge.add(v.instanceId);const Fr={command:"resize",buffer:null},qn=[],Zr=(e=!0)=>{Fr.buffer=new Float32Array([B.rendererWidth,B.rendererHeight,e?1:0]),qn[0]=Fr.buffer.buffer,Ce.postMessage(Fr,qn)},jn=window.devicePixelRatio||1,vn=()=>{Je.x=0,Je.y=0;const e=vt();if(!e)return;const t=e.children[0];!t||t.localName!=="canvas"||(Je.x=(e.clientWidth-v.rendererWidth/jn)/2,Je.y=(e.clientHeight-v.rendererHeight/jn)/2)},mr=()=>{const e=vt();if(!e)return;const t=e.parentElement;if(!t)return;const r=B.fullScreen||t.tagName==="BODY"?window.innerWidth:t.clientWidth,n=B.fullScreen||t.tagName==="BODY"?window.innerHeight:t.clientHeight,i=e.style;if(i.width=`${r}px`,i.height=`${n}px`,!v.stageWidth||!v.stageHeight)return;const s=Math.min(r/v.stageWidth,n/v.stageHeight)*Ze,a=B.fullScreen?window.innerWidth*Ze:v.stageWidth*s|0,o=B.fullScreen?window.innerHeight*Ze:v.stageHeight*s|0;a===B.screenWidth&&o===B.screenHeight||(B.screenWidth=r,B.screenHeight=n,v.changed=!0,e.children.length>1&&e.children[1].dispatchEvent(new Event(`${on}_blur`)),vn(),!(a===B.rendererWidth&&o===B.rendererHeight)&&(v.rendererScale=B.rendererScale=s,v.rendererWidth=B.rendererWidth=a,v.rendererHeight=B.rendererHeight=o,ft[0]=ft[3]=s,ft[4]=(B.rendererWidth-v.stageWidth*s)/2,ft[5]=(B.rendererHeight-v.stageHeight*s)/2,O.reset(),Zr(),v.hasEventListener(x.RESIZE)&&v.dispatchEvent(new x(x.RESIZE))))},wh=new Float32Array([1,1,1,1,0,0,0,0]),lt=[],ut={command:"render",buffer:null,length:0,imageBitmaps:null},Ot=[];Ce.addEventListener("message",e=>{if(e.data.message!=="render")return;const t=e.data.buffer;b.buffer.length>t.length||(b.buffer=t)});const Ss=()=>{b.offset=0,Ot.length=0,lt.length=0,v.$generateRenderQueue(v,lt,ft,wh),b.offset&&(ut.buffer=b.buffer,ut.length=b.offset,Ot.push(b.buffer.buffer),ut.imageBitmaps=null,lt.length&&(ut.imageBitmaps=lt,Ot.push(...lt)),Ce.postMessage(ut,Ot))},ei={command:"removeCache",buffer:null},ti=[],ri=()=>{const e=new Float32Array(O.$removeIds);O.$removeIds.length=0,ei.buffer=e,ti[0]=e.buffer,Ce.postMessage(ei,ti)},Mh=new x(x.ENTER_FRAME),Is=e=>{if(B.stopFlag)return;O.$removeIds.length&&ri();const t=e-B.startTime;t>B.fps&&(B.startTime=e-t%B.fps,v.$ticker(),v.hasEventListener(x.ENTER_FRAME)&&v.dispatchEvent(Mh),v.changed&&Ss(),O.$removeCache&&(O.removeTimerScheduledCache(),O.$removeIds.length&&ri())),B.timerId=requestAnimationFrame(r=>{Is(r)})},Bh=()=>{B.stopFlag&&(B.stopFlag=!1,v.changed=!0,B.timerId>-1&&cancelAnimationFrame(B.timerId),B.fps=1e3/v.frameRate|0,B.startTime=performance.now(),B.timerId=requestAnimationFrame(e=>{Is(e)}))},Th=()=>{B.timerId>-1&&cancelAnimationFrame(B.timerId),B.stopFlag=!0,B.timerId=-1,rt.stopAll()},Sh=e=>{const t=ke();if(t){t.keyDown(e);return}v.hasEventListener(V.KEY_DOWN)&&(We(e),v.dispatchEvent(new V(V.KEY_DOWN)))},Ih=e=>{ke()||v.hasEventListener(V.KEY_UP)&&(We(e),v.dispatchEvent(new V(V.KEY_UP)))},Ch=()=>{window.addEventListener(V.KEY_DOWN,Sh),window.addEventListener(V.KEY_UP,Ih)};class Fh{rendererWidth;rendererHeight;screenWidth;screenHeight;rendererScale;fixedWidth;fixedHeight;stopFlag;startTime;fps;tagId;_$fullScreen;timerId;mouseState;constructor(){this.rendererWidth=0,this.rendererHeight=0,this.rendererScale=1,this.screenWidth=0,this.screenHeight=0,this.stopFlag=!0,this.startTime=0,this.fps=16,this.timerId=-1,this.mouseState="up",this.fixedWidth=0,this.fixedHeight=0,this.tagId="",this._$fullScreen=!1,Ch()}get fullScreen(){return this._$fullScreen}set fullScreen(t){this._$fullScreen!==t&&(this._$fullScreen=t,mr())}play(){Bh()}stop(){Th()}cacheClear(){O.reset(),Ce.postMessage({command:"cacheClear"})}setOptions(t=null){t&&(this.fixedWidth=t.width||this.fixedWidth,this.fixedHeight=t.height||this.fixedHeight,this.tagId=t.tagId||this.tagId,this._$fullScreen=!!t.fullScreen,t.bgColor&&(v.backgroundColor=t.bgColor))}}const B=new Fh;let ni="auto";const wn=()=>{B.stopFlag||(ie.x=v.pointer.x,ie.y=v.pointer.y,ie.pointer="auto",ie.hit=null,Tr.beginPath(),Tr.setTransform(1,0,0,1,0,0),v.$mouseHit(Tr,gt,ie),B.mouseState==="up"&&ni!==ie.pointer&&(ui().style.cursor=ni=ie.pointer))},Mn=e=>{let t=window.scrollX,r=window.scrollY;const n=vt();if(n){const c=n.getBoundingClientRect();t+=c.left,r+=c.top}const i=e.target;if(i){const c=i.getBoundingClientRect();t+=c.left,r+=c.top}const s=(B.rendererWidth-v.stageWidth*B.rendererScale)/2,a=(B.rendererHeight-v.stageHeight*B.rendererScale)/2,o=B.rendererScale/Ze;v.pointer.x=(e.pageX-t)/o-s/B.rendererScale,v.pointer.y=(e.pageY-r)/o-a/B.rendererScale},Eh=()=>{const e=ie.hit,t=ke();t&&(!e||t.instanceId!==e.instanceId)&&(t.focus=!1,kn(null)),e?(e.isText&&(e.focus?setTimeout(()=>{de.focus()},300):(e.focus=!0,kn(e)),e.setFocusIndex(ie.x-gt[4],ie.y-gt[5])),e.willTrigger(S.POINTER_DOWN)&&e.dispatchEvent(new S(S.POINTER_DOWN))):v.willTrigger(S.POINTER_DOWN)&&v.dispatchEvent(new S(S.POINTER_DOWN))},Ph=()=>{const e=ie.hit;e?e.willTrigger(S.DOUBLE_CLICK)&&e.dispatchEvent(new S(S.DOUBLE_CLICK)):v.willTrigger(S.DOUBLE_CLICK)&&v.dispatchEvent(new S(S.DOUBLE_CLICK))};let ii,kt=!1;const Rh=e=>{const t=e.target;t&&(B.mouseState="down",t.setPointerCapture(e.pointerId),We(e),Mn(e),wn(),ie.hit&&e.preventDefault(),clearTimeout(ii),kt?(kt=!1,Ph()):(kt=!0,ii=setTimeout(()=>{kt=!1},300),Eh()))},Oh=()=>{const e=v.dropTarget,t=ie.hit;t?(t.willTrigger(S.POINTER_UP)&&t.dispatchEvent(new S(S.POINTER_UP)),e&&e.instanceId!==t.instanceId&&e.willTrigger(S.POINTER_UP)&&e.dispatchEvent(new S(S.POINTER_UP))):e&&e.willTrigger(S.POINTER_UP)?e.dispatchEvent(new S(S.POINTER_UP)):v.willTrigger(S.POINTER_UP)&&v.dispatchEvent(new S(S.POINTER_UP))},si=e=>{const t=e.target;t&&(B.mouseState="up",t.releasePointerCapture(e.pointerId),We(e),Mn(e),wn(),Oh())},kh=()=>{const e=v.dropTarget;if(e){const i=e.parent?e.parent.globalToLocal(v.pointer):e.globalToLocal(v.pointer);let s=0,a=0;e.$lockCenter?(s=i.x-e.width/2,a=i.y-e.height/2):(s=i.x+e.$offsetX,a=i.y+e.$offsetY);const o=e.$boundedRect;o&&(s=Vt(s,o.left,o.right),a=Vt(a,o.top,o.bottom)),e.x=s,e.y=a}const t=ke();if(t&&B.mouseState==="down"){t.setFocusIndex(ie.x-gt[4],ie.y-gt[5],!0);return}const r=fi(),n=ie.hit;n?(n.willTrigger(S.POINTER_MOVE)&&n.dispatchEvent(new S(S.POINTER_MOVE)),r?r.instanceId!==n.instanceId&&(r.willTrigger(S.POINTER_OUT)&&r.dispatchEvent(new S(S.POINTER_OUT)),n.willTrigger(S.POINTER_OVER)&&n.dispatchEvent(new S(S.POINTER_OVER))):n.willTrigger(S.POINTER_OVER)&&n.dispatchEvent(new S(S.POINTER_OVER)),Cn(n)):(r&&(r.willTrigger(S.POINTER_OUT)&&r.dispatchEvent(new S(S.POINTER_OUT)),Cn(null)),v.hasEventListener(S.POINTER_MOVE)&&v.dispatchEvent(new S(S.POINTER_MOVE)))},Uh=e=>{e.target&&(We(e),Mn(e),wn(),ie.hit&&e.preventDefault(),kh())},Gh=e=>{We(e);const t=fi();t&&t.willTrigger(S.POINTER_LEAVE)&&(e.preventDefault(),t.dispatchEvent(new S(S.POINTER_LEAVE)))},_h=e=>{We(e);const t=ie.hit;if(t&&t.isText&&t.scrollEnabled){e.preventDefault(),e.deltaX&&(t.scrollX+=e.deltaX/(t.textWidth/t.width)),e.deltaY&&(t.scrollY+=e.deltaY/(t.textHeight/t.height));return}v.willTrigger(qe.WHEEL)&&(e.preventDefault(),v.dispatchEvent(new qe(qe.WHEEL)))},Dh=e=>{const t=()=>{Mu();const r=$u();for(let n=0;n<r.length;++n){const i=r[n];i&&(i.muted=!1)}r.length=0,e.removeEventListener(S.POINTER_UP,t)};e.addEventListener(S.POINTER_UP,t),e.addEventListener(S.POINTER_DOWN,Rh,{passive:!1}),e.addEventListener(S.POINTER_UP,si),e.addEventListener(S.POINTER_CANCEL,si),e.addEventListener(S.POINTER_MOVE,Uh,{passive:!1}),e.addEventListener(S.POINTER_LEAVE,Gh),e.addEventListener(qe.WHEEL,_h)},gr=document.createElement("canvas");Ds(gr);Ls(gr,Ze);Dh(gr);Ys(gr);const qr={Event:x,EventDispatcher:nt,EventPhase:ze,FocusEvent:Ne,HTTPStatusEvent:Gt,IOErrorEvent:Re,PointerEvent:S,JobEvent:ye,ProgressEvent:Z,VideoEvent:Ae};Object.entries(qr).forEach(([e,t])=>{Object.defineProperty(qr,e,{get(){return t}})});const jr={Sprite:An,MovieClip:qt,BitmapData:_e,BlendMode:ua,DisplayObject:hr,DisplayObjectContainer:dn,FrameLabel:Ki,Graphics:M,InteractiveObject:fn,Loader:gs,Shape:$t,stage:v};Object.entries(jr).forEach(([e,t])=>{Object.defineProperty(jr,e,{get(){return t}})});const en={BevelFilter:rr,BlurFilter:nr,ColorMatrixFilter:ir,ConvolutionFilter:sr,DisplacementMapFilter:ar,DropShadowFilter:or,GlowFilter:cr,GradientBevelFilter:lr,GradientGlowFilter:ur};Object.entries(en).forEach(([e,t])=>{Object.defineProperty(en,e,{get(){return t}})});const tn={ColorTransform:U,Matrix:T,Point:se,Rectangle:be};Object.entries(tn).forEach(([e,t])=>{Object.defineProperty(tn,e,{get(){return t}})});const rn={Sound:dr,SoundMixer:rt,SoundTransform:_u,Video:Xr};Object.entries(rn).forEach(([e,t])=>{Object.defineProperty(rn,e,{get(){return t}})});class Cs{requestHeaders;url;contentType;data;method;responseDataFormat;withCredentials;constructor(t=""){this.url=`${t}`,this.contentType="application/json",this.data=null,this.method="GET",this.requestHeaders=[],this.responseDataFormat="json",this.withCredentials=!1}get headers(){const t=[];return t.push({name:"Content-Type",value:this.contentType}),this.requestHeaders.length&&t.push(...this.requestHeaders),t}}const nn={URLRequest:Cs};Object.entries(nn).forEach(([e,t])=>{Object.defineProperty(nn,e,{get(){return t}})});const sn={TextFormat:ue,TextField:Qr};Object.entries(sn).forEach(([e,t])=>{Object.defineProperty(sn,e,{get(){return t}})});const an={Easing:Ye,Tween:gn};Object.entries(an).forEach(([e,t])=>{Object.defineProperty(an,e,{get(){return t}})});const Fs=()=>{const e=vt();if(e)for(;e.firstChild;)e.removeChild(e.firstChild)},Es=()=>{const e=vt();if(!e)return;const t=ui();t&&(e.appendChild(t),e.appendChild(de))},Ps=()=>{v.ready=!0,Ss(),B.play(),v.changed=!1},Lh=()=>{const e=document.createElement("div");if(_s(e),e.id=on,e.tabIndex=-1,!B.tagId)document.body.appendChild(e);else{const t=document.getElementById(B.tagId);if(!t)return alert(`Element not found with tag ID: ${B.tagId}`),e;t.appendChild(e)}return e},Nh=(e,t=0,r=0)=>{let n="";if(n+="display:flex;",n+="align-items:center;",n+="justify-content:center;",n+="background-color:transparent;",n+="overflow:hidden;",n+="padding:0;",n+="margin:0;",n+="user-select:none;",n+="outline:none;",t&&r)n+=`width:${t}px;`,n+=`height:${r}px;`;else{const i=e.parentElement;if(!i)throw new Error("parent element is null.");i.tagName==="BODY"?(n+=`width:${window.innerWidth}px;`,n+=`height:${window.innerHeight}px;`):(n+=`width:${i.clientWidth}px;`,n+=`height:${i.clientHeight}px;`)}e.setAttribute("style",n)},Yh=e=>{const t=`${on}_loading`;e.innerHTML=`<style>
666
2346
  #${t} {
667
2347
  width: 50px;
668
2348
  height: 50px;
@@ -681,4 +2361,4 @@ void main() {
681
2361
  }
682
2362
  }
683
2363
  </style>
684
- <div id="${t}"></div>`};let en=-1;const Cl=()=>{window.addEventListener("resize",()=>{cancelAnimationFrame(en),en=requestAnimationFrame(ou)})},vr=(e=null)=>{w.setOptions(e);const t=kl();Ol(t,w.fixedWidth,w.fixedHeight),Fl(t),!w.fixedWidth&&!w.fixedHeight&&Cl(),ou()},Ll=async(e,t=null)=>{if(e==="develop"){const r=location.search.slice(1).split("&")[0];if(!r)return;e=`${location.origin}/${r}`}if(!e)return;e.charAt(1)==="/"&&(e=e.slice(1)),vr(t);const u=new hr,s=u.contentLoaderInfo;if(s.addEventListener(Re.IO_ERROR,r=>{alert("Error: "+r.text)}),await u.load(new yr(e)),!s.data)return;const n=s.data.stage;T.stageWidth=n.width,T.stageHeight=n.height,T.frameRate=Lt(n.fps,1,60,60),T.backgroundColor=t&&t.bgColor?t.bgColor:n.bgColor,T.addChild(s.content),ou(),Ar(),wr(),Mr(),gs()};let tn=!1;const Nl=(e=240,t=240,u=60,s=null)=>{if(tn)return T.getChildAt(0);tn=!0,T.stageWidth=e|0,T.stageHeight=t|0,T.frameRate=Lt(u,1,60,60),vr(s);const n=T.addChild(new cs);return Ar(),wr(),Mr(),gs(),n},Ee={command:"capture",buffer:null,bgColor:16777215,bgAlpha:0,width:0,height:0,length:0,imageBitmaps:null},It=[],it=[],Pl=async(e,t,u,s,n=0,r=0)=>await new Promise(a=>{if(E.offset=0,It.length=0,it.length=0,T.$generateRenderQueue(e,it,t,u),!E.offset)return a(s);Ee.buffer=E.buffer,Ee.width=s.width,Ee.height=s.height,Ee.bgColor=n,Ee.bgAlpha=r,Ee.length=E.offset,It.push(E.buffer.buffer),Ee.imageBitmaps=null,it.length&&(Ee.imageBitmaps=it,It.push(...it));const i=c=>{if(c.data.message!=="capture")return;const o=c.data.buffer;return E.buffer.length<o.length&&(E.buffer=o),s.getContext("2d").drawImage(c.data.imageBitmap,0,0),Me.removeEventListener("message",i),a(s)};Me.addEventListener("message",i),Me.postMessage(Ee,It)}),Ir=async e=>{switch(!0){case e.isVideo:{const t=e.muted;e.muted=!0,await e.play(),e.pause(),e.muted=t,await new Promise(u=>{const s=async()=>{e.loaded?(e.seek(0),u()):requestAnimationFrame(s)};requestAnimationFrame(s)})}break;case e.isContainerEnabled:{const t=e.children;for(let u=0;u<t.length;++u){const s=t[u];s&&(!s.isVideo&&!s.isContainerEnabled||await Ir(s))}}break}},Bl=new Float32Array([1,0,0,1,0,0]),Dl=new Float32Array([1,1,1,1,0,0,0,0]),_l=async(e,t=null)=>{t&&t.videoSync&&await Ir(e);const u=t&&t.colorTransform?t.colorTransform.rawData:Dl,s=new Float32Array([1,0,0,1,-e.width/2,-e.height/2]),n=t&&t.matrix?A.multiply(t.matrix.rawData,s):A.multiply(Bl,s),r=t&&t.canvas?t.canvas:O.getCanvas(),a=Math.sqrt(n[0]*n[0]+n[1]*n[1]),i=Math.sqrt(n[2]*n[2]+n[3]*n[3]),c=Math.ceil(e.width*a),o=Math.ceil(e.height*i);if(c<=0||o<=0)return r;n[4]+=c/2,n[5]+=o/2,r.width=c,r.height=o;const d=w.stopFlag;d||w.stop();let l=!1;const h=w.rendererWidth,b=w.rendererHeight,f=w.rendererScale;if(c>h||o>b){l=!0;const p=Math.min(c/T.stageWidth,o/T.stageHeight)*Ge;T.rendererScale=w.rendererScale=p,T.rendererWidth=w.rendererWidth=c,T.rendererHeight=w.rendererHeight=o,Wu(!1)}return await Pl(e,n,u,r,t&&t.bgColor?parseInt(t.bgColor.replace("#",""),16):0,t&&t.bgAlpha?t.bgAlpha:0),l&&(T.rendererScale=w.rendererScale=f,T.rendererWidth=w.rendererWidth=h,T.rendererHeight=w.rendererHeight=b,Wu(!1)),d||w.play(),A.release(n),t&&t.colorTransform&&C.release(u),r};class Ul{display;events;filters;geom;media;net;text;ui;_$promise;constructor(){this.display=zu,this.events=Hu,this.filters=Gu,this.geom=Ku,this.media=Qu,this.net=Zu,this.text=Ju,this.ui=ju,this._$promise=new Promise(t=>{document.readyState==="loading"?window.addEventListener("DOMContentLoaded",()=>t(),{once:!0}):t()})}async load(t,u=null){await Promise.all([this._$promise]),await Ll(t,u)}async createRootMovieClip(t=240,u=240,s=60,n=null){return await Promise.all([this._$promise]),Nl(t,u,s,n)}async captureToCanvas(t,u=null){return await _l(t,u)}}"next2d"in window||(console.log("%c Next2D Player %c 2.13.0 %c https://next2d.app","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),window.next2d=new Ul);
2364
+ <div id="${t}"></div>`};let ai=-1;const Wh=()=>{window.addEventListener("resize",()=>{cancelAnimationFrame(ai),ai=requestAnimationFrame(mr)})},Rs=(e=null)=>{B.setOptions(e);const t=Lh();Nh(t,B.fixedWidth,B.fixedHeight),Yh(t),!B.fixedWidth&&!B.fixedHeight&&Wh(),mr()},Vh=async(e,t=null)=>{if(e==="develop"){const s=location.search.slice(1).split("&")[0];if(!s)return;e=`${location.origin}/${s}`}if(!e)return;e.charAt(1)==="/"&&(e=e.slice(1)),Rs(t);const r=new gs,n=r.contentLoaderInfo;if(n.addEventListener(Re.IO_ERROR,s=>{alert("Error: "+s.text)}),await r.load(new Cs(e)),!n.data)return;const i=n.data.stage;v.stageWidth=i.width,v.stageHeight=i.height,v.frameRate=Vt(i.fps,1,60,60),v.backgroundColor=t&&t.bgColor?t.bgColor:i.bgColor,v.addChild(n.content),mr(),Ps(),Fs(),Es(),vn()};let oi=!1;const Kh=(e=240,t=240,r=60,n=null)=>{if(oi)return v.getChildAt(0);oi=!0,v.stageWidth=e|0,v.stageHeight=t|0,v.frameRate=Vt(r,1,60,60),Rs(n);const i=v.addChild(new An);return Ps(),Fs(),Es(),vn(),i},Te={command:"capture",buffer:null,bgColor:16777215,bgAlpha:0,width:0,height:0,length:0,imageBitmaps:null},Ut=[],ht=[],Qh=async(e,t,r,n,i=0,s=0)=>await new Promise(a=>{if(b.offset=0,Ut.length=0,ht.length=0,v.$generateRenderQueue(e,ht,t,r),!b.offset)return a(n);Te.buffer=b.buffer,Te.width=n.width,Te.height=n.height,Te.bgColor=i,Te.bgAlpha=s,Te.length=b.offset,Ut.push(b.buffer.buffer),Te.imageBitmaps=null,ht.length&&(Te.imageBitmaps=ht,Ut.push(...ht));const o=c=>{if(c.data.message!=="capture")return;const u=c.data.buffer;return b.buffer.length<u.length&&(b.buffer=u),n.getContext("2d").drawImage(c.data.imageBitmap,0,0),Ce.removeEventListener("message",o),a(n)};Ce.addEventListener("message",o),Ce.postMessage(Te,Ut)}),Os=async e=>{switch(!0){case e.isVideo:{const t=e.muted;e.muted=!0,await e.play(),e.pause(),e.muted=t,await new Promise(r=>{const n=async()=>{e.loaded?(e.seek(0),r()):requestAnimationFrame(n)};requestAnimationFrame(n)})}break;case e.isContainerEnabled:{const t=e.children;for(let r=0;r<t.length;++r){const n=t[r];n&&(!n.isVideo&&!n.isContainerEnabled||await Os(n))}}break}},Xh=new Float32Array([1,0,0,1,0,0]),zh=new Float32Array([1,1,1,1,0,0,0,0]),Hh=async(e,t=null)=>{t&&t.videoSync&&await Os(e);const r=t&&t.colorTransform?t.colorTransform.rawData:zh,n=new Float32Array([1,0,0,1,-e.width/2,-e.height/2]),i=t&&t.matrix?T.multiply(t.matrix.rawData,n):T.multiply(Xh,n),s=t&&t.canvas?t.canvas:O.getCanvas(),a=Math.sqrt(i[0]*i[0]+i[1]*i[1]),o=Math.sqrt(i[2]*i[2]+i[3]*i[3]),c=Math.ceil(e.width*a),u=Math.ceil(e.height*o);if(c<=0||u<=0)return s;i[4]+=c/2,i[5]+=u/2,s.width=c,s.height=u;const h=B.stopFlag;h||B.stop();let l=!1;const f=B.rendererWidth,A=B.rendererHeight,d=B.rendererScale;if(c>f||u>A){l=!0;const y=Math.min(c/v.stageWidth,u/v.stageHeight)*Ze;v.rendererScale=B.rendererScale=y,v.rendererWidth=B.rendererWidth=c,v.rendererHeight=B.rendererHeight=u,Zr(!1)}return await Qh(e,i,r,s,t&&t.bgColor?parseInt(t.bgColor.replace("#",""),16):0,t&&t.bgAlpha?t.bgAlpha:0),l&&(v.rendererScale=B.rendererScale=d,v.rendererWidth=B.rendererWidth=f,v.rendererHeight=B.rendererHeight=A,Zr(!1)),h||B.play(),T.release(i),t&&t.colorTransform&&U.release(r),s};class Jh{display;events;filters;geom;media;net;text;ui;_$promise;constructor(){this.display=jr,this.events=qr,this.filters=en,this.geom=tn,this.media=rn,this.net=nn,this.text=sn,this.ui=an,this._$promise=new Promise(t=>{document.readyState==="loading"?window.addEventListener("DOMContentLoaded",()=>t(),{once:!0}):t()})}async load(t,r=null){await Promise.all([this._$promise]),await Vh(t,r)}async createRootMovieClip(t=240,r=240,n=60,i=null){return await Promise.all([this._$promise]),Kh(t,r,n,i)}async captureToCanvas(t,r=null){return await Hh(t,r)}}"next2d"in window||(console.log("%c Next2D Player %c 3.0.0 %c https://next2d.app","color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),window.next2d=new Jh);