import{w as It,R as $,I as L,r as nn,M as H,t as U,P as rt,p as At,a7 as sn,C as N,a as J,a8 as fe,D as rn,X as tt,y as it,a9 as Be,aa as on,B as Le,E as an,J as E,V as hn}from"./sprite-view-Br3916N3.js";import{g as cn}from"./getTextureBatchBindGroup-TFzx8Qrc.js";import{G as zt,D as ln,b as un}from"./colorToUniform-DJvpt7jY.js";import{a as qe}from"./Geometry-BsDB1n4r.js";const mt=new Set;let Et=!1;function xe(s,t,e=2){const n=t&&t.length,r=n?t[0]*e:s.length;mt.size&&mt.clear();let i=He(s,0,r,e,!0);const o=[];if(!i||i.next===i.prev)return o;let a=0,h=0,l=0;if(n&&(i=pn(s,t,i,e)),s.length>80*e){a=s[0],h=s[1];let c=a,d=h;for(let f=e;f<r;f+=e){const u=s[f],x=s[f+1];u<a&&(a=u),x<h&&(h=x),u>c&&(c=u),x>d&&(d=x)}l=Math.max(c-a,d-h),l=l!==0?32767/l:0}return Vt(i,o,a,h,l),o}function He(s,t,e,n,r){let i=null;if(r===Gn(s,t,e,n)>0)for(let o=t;o<e;o+=n)i=ge(o/n|0,s[o],s[o+1],i);else for(let o=e-n;o>=t;o-=n)i=ge(o/n|0,s[o],s[o+1],i);return i&&_t(i,i.next)&&(Pt(i),i=i.next),i}function et(s,t=s){const e=t===s;let n=s,r;do r=!1,n!==n.next&&(mt.size===0||!mt.has(n))&&(_t(n,n.next)||B(n.prev,n,n.next)===0)?((e||n===t)&&(t=n.prev),Et=!0,Pt(n),n=n.prev,r=!0):(e||n!==t)&&(n=n.next,r=!e);while(r||n!==t);return t}function Vt(s,t,e,n,r){r&&Sn(s,e,n,r);let i=s,o=!1;for(;s.prev!==s.next;){const a=s.prev,h=s.next;if(B(a,s,h)<0&&(r?fn(s,e,n,r):dn(s))){t.push(a.i,s.i,h.i),Pt(s),s=h,i=h;continue}if(s=h,s===i){if(Et=!1,s=et(s),Et){i=s;continue}if(!o){s=xn(s,t),i=s,o=!0;continue}yn(s,t,e,n,r);break}}}function dn(s){const t=s.prev,e=s,n=s.next,r=t.x,i=e.x,o=n.x,a=t.y,h=e.y,l=n.y,c=Math.min(r,i,o),d=Math.min(a,h,l),f=Math.max(r,i,o),u=Math.max(a,h,l);let x=n.next;for(;x!==t;){if(x.x>=c&&x.x<=f&&x.y>=d&&x.y<=u&&!(r===x.x&&a===x.y)&&Ft(r,a,i,h,o,l,x.x,x.y)&&B(x.prev,x,x.next)>=0)return!1;x=x.next}return!0}function fn(s,t,e,n){const r=s.prev,i=s,o=s.next,a=r.x,h=i.x,l=o.x,c=r.y,d=i.y,f=o.y,u=Math.min(a,h,l),x=Math.min(c,d,f),y=Math.max(a,h,l),g=Math.max(c,d,f),_=$t(u,x,t,e,n),p=$t(y,g,t,e,n);let M=s.prevZ;for(;M&&M.z>=_;){if(M.x>=u&&M.x<=y&&M.y>=x&&M.y<=g&&M!==o&&!(a===M.x&&c===M.y)&&Ft(a,c,h,d,l,f,M.x,M.y)&&B(M.prev,M,M.next)>=0)return!1;M=M.prevZ}let m=s.nextZ;for(;m&&m.z<=p;){if(m.x>=u&&m.x<=y&&m.y>=x&&m.y<=g&&m!==o&&!(a===m.x&&c===m.y)&&Ft(a,c,h,d,l,f,m.x,m.y)&&B(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function xn(s,t){let e=s,n=!1;do{const r=e.prev,i=e.next.next;Ve(r,e,e.next,i,!1)&&bt(r,i)&&bt(i,r)&&(t.push(r.i,e.i,i.i),Pt(e),Pt(e.next),e=s=i,n=!0),e=e.next}while(e!==s);return n?et(e):e}function yn(s,t,e,n,r){let i=s;do{let o=i.next.next;for(;o!==i.prev;){if(i.i!==o.i&&wn(i,o)){let a=We(i,o);i=et(i,i.next),a=et(a,a.next),Vt(i,t,e,n,r),Vt(a,t,e,n,r);return}o=o.next}i=i.next}while(i!==s)}let Wt=!1;function pn(s,t,e,n){const r=[];for(let i=0,o=t.length;i<o;i++){const a=t[i]*n,h=i<o-1?t[i+1]*n:s.length,l=He(s,a,h,n,!1);l===l.next&&mt.add(l),r.push(kn(l))}r.sort(gn),_n(s.length/n,t.length),Ee(e,e),Wt=!0;for(let i=0;i<r.length;i++)e=mn(r[i],e);return Wt=!1,et(e)}function gn(s,t){return s.x-t.x||s.y-t.y||(s.next.y-s.y)/(s.next.x-s.x)-(t.next.y-t.y)/(t.next.x-t.x)}function mn(s,t){const e=Pn(s,t);if(!e)return t;const n=We(e,s),r=n.next;return Ee(e,r.next),et(n,n.next),et(e,e.next)}const Ue=16;let z=new Float64Array(0),Dt=0;const jt=[],Nt=[];function _n(s,t){const e=Math.ceil((s+2*t)/Ue)+t+2;z.length<e*4&&(z=new Float64Array(e*4)),Dt=0}function Ee(s,t){let e=s;do{const n=Dt++;jt[n]=e;let r=1/0,i=1/0,o=-1/0,a=-1/0,h=0;do{const c=e.next;e.z=n,e.x<r&&(r=e.x),e.x>o&&(o=e.x),e.y<i&&(i=e.y),e.y>a&&(a=e.y),c.x<r&&(r=c.x),c.x>o&&(o=c.x),c.y<i&&(i=c.y),c.y>a&&(a=c.y),e=c}while(++h<Ue&&e!==t);Nt[n]=e;const l=n*4;z[l]=r,z[l+1]=i,z[l+2]=o,z[l+3]=a}while(e!==t)}function bn(s,t){const e=s.z*4;t.x<z[e]&&(z[e]=t.x),t.y<z[e+1]&&(z[e+1]=t.y),t.x>z[e+2]&&(z[e+2]=t.x),t.y>z[e+3]&&(z[e+3]=t.y)}function ye(s){let t=Nt[s];for(;t.prev.next!==t;)t=t.next;return Nt[s]=t,t}function pe(s){let t=jt[s];for(;t.prev.next!==t;)t=t.next;return jt[s]=t,t}function Pn(s,t){let e=t;const n=s.x,r=s.y;let i=-1/0,o;if(_t(s,e))return e;for(let f=0,u=0;f<Dt;f++,u+=4){if(r<z[u+1]||r>z[u+3]||z[u]>n||z[u+2]<=i)continue;const x=ye(f);e=pe(f);do{if(e.prev.next===e){if(_t(s,e.next))return e.next;if(r<=e.y&&r>=e.next.y&&e.next.y!==e.y){const y=e.x+(r-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(y<=n&&y>i&&(i=y,o=e.x<e.next.x?e:e.next,y===n))return o}}e=e.next}while(e!==x)}if(!o)return null;const a=o.x,h=o.y,l=Math.min(r,h),c=Math.max(r,h);let d=1/0;for(let f=0,u=0;f<Dt;f++,u+=4){if(z[u+2]<a||z[u]>n||z[u+3]<l||z[u+1]>c)continue;const x=ye(f);e=pe(f);do{if(e.prev.next===e&&n>=e.x&&e.x>=a&&n!==e.x&&Ft(r<h?n:i,r,a,h,r<h?i:n,r,e.x,e.y)){const y=Math.abs(r-e.y)/(n-e.x);(bt(e,s)||e.y===r&&e.next.y===r&&e.next.x>n)&&(y<d||y===d&&(e.x>o.x||e.x===o.x&&Mn(o,e)))&&(o=e,d=y)}e=e.next}while(e!==x)}return o}function Mn(s,t){return B(s.prev,s,t.prev)<0&&B(t.next,s,s.next)<0}const q=[];let ut=[],K=new Uint32Array(0),dt=new Uint32Array(0);const ft=new Uint32Array(256);function Sn(s,t,e,n){let r=s,i=0;do r.z=$t(r.x,r.y,t,e,n),q[i++]=r,r=r.next;while(r!==s);Cn(i);let o=null;for(let a=0;a<i;a++){const h=q[a];h.prevZ=o,o&&(o.nextZ=h),o=h}o.nextZ=null}function Cn(s){if(s<=32){for(let t=1;t<s;t++){const e=q[t],n=e.z;let r=t-1;for(;r>=0&&q[r].z>n;)q[r+1]=q[r],r--;q[r+1]=e}return}K.length<s&&(K=new Uint32Array(s),dt=new Uint32Array(s),ut=new Array(s));for(let t=0;t<s;t++)K[t]=q[t].z;Tt(s,q,K,ut,dt,0),Tt(s,ut,dt,q,K,8),Tt(s,q,K,ut,dt,16),Tt(s,ut,dt,q,K,24)}function Tt(s,t,e,n,r,i){ft.fill(0);for(let a=0;a<s;a++)ft[e[a]>>>i&255]++;let o=0;for(let a=0;a<256;a++){const h=ft[a];ft[a]=o,o+=h}for(let a=0;a<s;a++){const h=e[a],l=ft[h>>>i&255]++;n[l]=t[a],r[l]=h}}function $t(s,t,e,n,r){return s=(s-e)*r|0,t=(t-n)*r|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function kn(s){let t=s,e=s;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==s);return e}function Ft(s,t,e,n,r,i,o,a){return(r-o)*(t-a)>=(s-o)*(i-a)&&(s-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(i-a)>=(r-o)*(n-a)}function wn(s,t){const e=_t(s,t)&&B(s.prev,s,s.next)>0&&B(t.prev,t,t.next)>0;return s.next.i!==t.i&&(e||bt(s,t)&&bt(t,s)&&(B(s.prev,s,t.prev)!==0||B(s,t.prev,t)!==0))&&!Tn(s,t)&&(e||vn(s,t))}function B(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function _t(s,t){return s.x===t.x&&s.y===t.y}function Ve(s,t,e,n,r=!0){const i=B(s,t,e),o=B(s,t,n),a=B(e,n,s),h=B(e,n,t);return(i>0&&o<0||i<0&&o>0)&&(a>0&&h<0||a<0&&h>0)?!0:r?!!(i===0&&vt(s,e,t)||o===0&&vt(s,n,t)||a===0&&vt(e,s,n)||h===0&&vt(e,t,n)):!1}function vt(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function Tn(s,t){const e=Math.min(s.x,t.x),n=Math.max(s.x,t.x),r=Math.min(s.y,t.y),i=Math.max(s.y,t.y);let o=s;do{const a=o.next;if(o.x>n&&a.x>n||o.x<e&&a.x<e||o.y>i&&a.y>i||o.y<r&&a.y<r){o=a;continue}if(o.i!==s.i&&a.i!==s.i&&o.i!==t.i&&a.i!==t.i&&Ve(o,a,s,t))return!0;o=a}while(o!==s);return!1}function bt(s,t){return B(s.prev,s,s.next)<0?B(s,t,s.next)>=0&&B(s,s.prev,t)>=0:B(s,t,s.prev)<0||B(s,s.next,t)<0}function vn(s,t){let e=s,n=!1;const r=(s.x+t.x)/2,i=(s.y+t.y)/2;do{const o=e.next;e.y>i!=o.y>i&&r<(o.x-e.x)*(i-e.y)/(o.y-e.y)+e.x&&(n=!n),e=o}while(e!==s);return n}function We(s,t){const e=Xt(s.i,s.x,s.y),n=Xt(t.i,t.x,t.y),r=s.next,i=t.prev;return s.next=t,t.prev=s,e.next=r,r.prev=e,n.next=e,e.prev=n,i.next=n,n.prev=i,n}function ge(s,t,e,n){const r=Xt(s,t,e);return n?(r.next=n.next,r.prev=n,n.next.prev=r,n.next=r):(r.prev=r,r.next=r),r}function Pt(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ),Wt&&bn(s.prev,s.next)}function Xt(s,t,e){return{i:s,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null}}function Gn(s,t,e,n){let r=0;for(let i=t,o=e-n;i<e;i+=n)r+=(s[o]-s[i])*(s[i+1]+s[o+1]),o=i;return r}const Rn=xe.default||xe,qt={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Dn=/([astvzqmhlc])([^astvzqmhlc]*)/gi,Fn=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;function In(s){const t=[];return s.replace(Dn,(e,n,r)=>{let i=n.toLowerCase(),o=n;const a=An(r);for(i==="m"&&a.length>2&&(t.push([o,...a.splice(0,2)]),i="l",o=o==="m"?"l":"L");;){if(a.length===qt[i])return t.push([o,...a]),"";if(a.length<qt[i])throw new Error("malformed path data");t.push([o,...a.splice(0,qt[i])])}}),t}function An(s){const t=s.match(Fn);return t?t.map(Number):[]}function zn(s,t){const e=In(s),n=[];let r=null,i=0,o=0;for(let a=0;a<e.length;a++){const h=e[a],l=h[0],c=h;switch(l){case"M":i=c[1],o=c[2],t.moveTo(i,o);break;case"m":i+=c[1],o+=c[2],t.moveTo(i,o);break;case"H":i=c[1],t.lineTo(i,o);break;case"h":i+=c[1],t.lineTo(i,o);break;case"V":o=c[1],t.lineTo(i,o);break;case"v":o+=c[1],t.lineTo(i,o);break;case"L":i=c[1],o=c[2],t.lineTo(i,o);break;case"l":i+=c[1],o+=c[2],t.lineTo(i,o);break;case"C":i=c[5],o=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],i,o);break;case"c":t.bezierCurveTo(i+c[1],o+c[2],i+c[3],o+c[4],i+c[5],o+c[6]),i+=c[5],o+=c[6];break;case"S":i=c[3],o=c[4],t.bezierCurveToShort(c[1],c[2],i,o);break;case"s":t.bezierCurveToShort(i+c[1],o+c[2],i+c[3],o+c[4]),i+=c[3],o+=c[4];break;case"Q":i=c[3],o=c[4],t.quadraticCurveTo(c[1],c[2],i,o);break;case"q":t.quadraticCurveTo(i+c[1],o+c[2],i+c[3],o+c[4]),i+=c[3],o+=c[4];break;case"T":i=c[1],o=c[2],t.quadraticCurveToShort(i,o);break;case"t":i+=c[1],o+=c[2],t.quadraticCurveToShort(i,o);break;case"A":i=c[6],o=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],i,o);break;case"a":i+=c[6],o+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],i,o);break;case"Z":case"z":t.closePath(),n.length>0&&(r=n.pop(),r?(i=r.startX,o=r.startY):(i=0,o=0)),r=null;break;default:It(`Unknown SVG path command: ${l}`)}l!=="Z"&&l!=="z"&&r===null&&(r={startX:i,startY:o},n.push(r))}return t}class te{constructor(t=0,e=0,n=0){this.type="circle",this.x=t,this.y=e,this.radius=n}clone(){return new te(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const n=this.radius*this.radius;let r=this.x-t,i=this.y-e;return r*=r,i*=i,r+i<=n}strokeContains(t,e,n,r=.5){if(this.radius===0)return!1;const i=this.x-t,o=this.y-e,a=this.radius,h=(1-r)*n,l=Math.sqrt(i*i+o*o);return l<=a+h&&l>a-(n-h)}getBounds(t){return t||(t=new $),t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class ee{constructor(t=0,e=0,n=0,r=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=n,this.halfHeight=r}clone(){return new ee(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let n=(t-this.x)/this.halfWidth,r=(e-this.y)/this.halfHeight;return n*=n,r*=r,n+r<=1}strokeContains(t,e,n,r=.5){const{halfWidth:i,halfHeight:o}=this;if(i<=0||o<=0)return!1;const a=n*(1-r),h=n-a,l=i-h,c=o-h,d=i+a,f=o+a,u=t-this.x,x=e-this.y,y=u*u/(l*l)+x*x/(c*c),g=u*u/(d*d)+x*x/(f*f);return y>1&&g<=1}getBounds(t){return t||(t=new $),t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function je(s){const t=s.length;if(t<6)return 1;let e=0;for(let n=0,r=s[t-2],i=s[t-1];n<t;n+=2){const o=s[n],a=s[n+1];e+=(o-r)*(a+i),r=o,i=a}return e<0?-1:1}function Bn(s,t,e,n,r,i){const o=s-e,a=t-n,h=r-e,l=i-n,c=o*h+a*l,d=h*h+l*l;let f=-1;d!==0&&(f=c/d);let u,x;f<0?(u=e,x=n):f>1?(u=r,x=i):(u=e+f*h,x=n+f*l);const y=s-u,g=t-x;return y*y+g*g}let Ln,qn;class pt{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const n=[];for(let r=0,i=e.length;r<i;r++)n.push(e[r].x,e[r].y);e=n}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,n=e.length;for(let r=0;r<n;r+=2){const i=e[r],o=e[r+1],a=e[(r+2)%n],h=e[(r+3)%n];t+=(a-i)*(h+o)}return t<0}containsPolygon(t){const e=this.getBounds(Ln),n=t.getBounds(qn);if(!e.containsRect(n))return!1;const r=t.points;for(let i=0;i<r.length;i+=2){const o=r[i],a=r[i+1];if(!this.contains(o,a))return!1}return!0}clone(){const t=this.points.slice(),e=new pt(t);return e.closePath=this.closePath,e}contains(t,e){let n=!1;const r=this.points.length/2;for(let i=0,o=r-1;i<r;o=i++){const a=this.points[i*2],h=this.points[i*2+1],l=this.points[o*2],c=this.points[o*2+1];h>e!=c>e&&t<(l-a)*((e-h)/(c-h))+a&&(n=!n)}return n}strokeContains(t,e,n,r=.5){const{points:i}=this,o=r===.5?r:(r-.5)*je(i)+.5,a=n*o,h=n-a,l=a*a,c=h*h,d=i.length-(this.closePath?0:2);for(let f=0;f<d;f+=2){const u=i[f],x=i[f+1],y=i[(f+2)%i.length],g=i[(f+3)%i.length],_=Bn(t,e,u,x,y,g),p=Math.sign((y-u)*(e-x)-(g-x)*(t-u));if(_<=(p<0?l:c))return!0}return!1}getBounds(t){t||(t=new $);const e=this.points;let n=1/0,r=-1/0,i=1/0,o=-1/0;for(let a=0,h=e.length;a<h;a+=2){const l=e[a],c=e[a+1];n=l<n?l:n,r=l>r?l:r,i=c<i?c:i,o=c>o?c:o}return t.x=n,t.width=r-n,t.y=i,t.height=o-i,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return L("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return L("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const Gt=(s,t,e,n,r,i,o)=>{const a=s-e,h=t-n,l=Math.sqrt(a*a+h*h);return l>=r-i&&l<=r+o};class ne{constructor(t=0,e=0,n=0,r=0,i=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=n,this.height=r,this.radius=i}getBounds(t){return t||(t=new $),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new ne(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const n=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+n&&e<=this.y+this.height-n||t>=this.x+n&&t<=this.x+this.width-n)return!0;let r=t-(this.x+n),i=e-(this.y+n);const o=n*n;if(r*r+i*i<=o||(r=t-(this.x+this.width-n),r*r+i*i<=o)||(i=e-(this.y+this.height-n),r*r+i*i<=o)||(r=t-(this.x+n),r*r+i*i<=o))return!0}return!1}strokeContains(t,e,n,r=.5){const{x:i,y:o,width:a,height:h,radius:l}=this,c=n*(1-r),d=n-c,f=i+l,u=o+l,x=a-l*2,y=h-l*2,g=i+a,_=o+h;return(t>=i-c&&t<=i+d||t>=g-d&&t<=g+c)&&e>=u&&e<=u+y||(e>=o-c&&e<=o+d||e>=_-d&&e<=_+c)&&t>=f&&t<=f+x?!0:t<f&&e<u&&Gt(t,e,f,u,l,d,c)||t>g-l&&e<u&&Gt(t,e,g-l,u,l,d,c)||t>g-l&&e>_-l&&Gt(t,e,g-l,_-l,l,d,c)||t<f&&e>_-l&&Gt(t,e,f,_-l,l,d,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}function Hn(s,t,e,n,r,i,o,a=null){let h=0;e*=t,r*=i;const l=a.a,c=a.b,d=a.c,f=a.d,u=a.tx,x=a.ty;for(;h<o;){const y=s[e],g=s[e+1];n[r]=l*y+d*g+u,n[r+1]=c*y+f*g+x,r+=i,e+=t,h++}}function Un(s,t,e,n){let r=0;for(t*=e;r<n;)s[t]=0,s[t+1]=0,t+=e,r++}function Ne(s,t,e,n,r){const i=t.a,o=t.b,a=t.c,h=t.d,l=t.tx,c=t.ty;e||(e=0),n||(n=2),r||(r=s.length/n-e);let d=e*n;for(let f=0;f<r;f++){const u=s[d],x=s[d+1];s[d]=i*u+a*x+l,s[d+1]=o*u+h*x+c,d+=n}}const En=new H;class se{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,n=this.renderable;return n?nn(e,n.groupColor)+(this.alpha*n.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){return this.renderable?.groupTransform||En}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}const Mt={extension:{type:U.ShapeBuilder,name:"circle"},build(s,t){let e,n,r,i,o,a;if(s.type==="circle"){const m=s;if(o=a=m.radius,o<=0)return!1;e=m.x,n=m.y,r=i=0}else if(s.type==="ellipse"){const m=s;if(o=m.halfWidth,a=m.halfHeight,o<=0||a<=0)return!1;e=m.x,n=m.y,r=i=0}else{const m=s,w=m.width/2,P=m.height/2;e=m.x+w,n=m.y+P,o=a=Math.max(0,Math.min(m.radius,Math.min(w,P))),r=w-o,i=P-a}if(r<0||i<0)return!1;const h=Math.ceil(2.3*Math.sqrt(o+a)),l=h*8+(r?4:0)+(i?4:0);if(l===0)return!1;if(h===0)return t[0]=t[6]=e+r,t[1]=t[3]=n+i,t[2]=t[4]=e-r,t[5]=t[7]=n-i,!0;let c=0,d=h*4+(r?2:0)+2,f=d,u=l,x=r+o,y=i,g=e+x,_=e-x,p=n+y;if(t[c++]=g,t[c++]=p,t[--d]=p,t[--d]=_,i){const m=n-y;t[f++]=_,t[f++]=m,t[--u]=m,t[--u]=g}for(let m=1;m<h;m++){const w=Math.PI/2*(m/h),P=r+Math.cos(w)*o,b=i+Math.sin(w)*a,G=e+P,v=e-P,S=n+b,k=n-b;t[c++]=G,t[c++]=S,t[--d]=S,t[--d]=v,t[f++]=v,t[f++]=k,t[--u]=k,t[--u]=G}x=r,y=i+a,g=e+x,_=e-x,p=n+y;const M=n-y;return t[c++]=g,t[c++]=p,t[--u]=M,t[--u]=g,r&&(t[c++]=_,t[c++]=p,t[--u]=M,t[--u]=_),!0},triangulate(s,t,e,n,r,i){if(s.length===0)return;let o=0,a=0;for(let c=0;c<s.length;c+=2)o+=s[c],a+=s[c+1];o/=s.length/2,a/=s.length/2;let h=n;t[h*e]=o,t[h*e+1]=a;const l=h++;for(let c=0;c<s.length;c+=2)t[h*e]=s[c],t[h*e+1]=s[c+1],c>0&&(r[i++]=h,r[i++]=l,r[i++]=h-1),h++;r[i++]=l+1,r[i++]=l,r[i++]=h-1}},Vn={...Mt,extension:{...Mt.extension,name:"ellipse"}},Wn={...Mt,extension:{...Mt.extension,name:"roundedRectangle"}},$e=1e-4,me=1e-4;function _e(s,t,e,n,r,i,o,a){const h=s-e*r,l=t-n*r,c=s+e*i,d=t+n*i;let f,u;o?(f=n,u=-e):(f=-n,u=e);const x=h+f,y=l+u,g=c+f,_=d+u;return a.push(x,y),a.push(g,_),2}function O(s,t,e,n,r,i,o,a){const h=e-s,l=n-t;let c=Math.atan2(h,l),d=Math.atan2(r-s,i-t);a&&c<d?c+=Math.PI*2:!a&&c>d&&(d+=Math.PI*2);let f=c;const u=d-c,x=Math.abs(u),y=Math.sqrt(h*h+l*l),g=(15*x*Math.sqrt(y)/Math.PI>>0)+1,_=u/g;if(f+=_,a){o.push(s,t),o.push(e,n);for(let p=1,M=f;p<g;p++,M+=_)o.push(s,t),o.push(s+Math.sin(M)*y,t+Math.cos(M)*y);o.push(s,t),o.push(r,i)}else{o.push(e,n),o.push(s,t);for(let p=1,M=f;p<g;p++,M+=_)o.push(s+Math.sin(M)*y,t+Math.cos(M)*y),o.push(s,t);o.push(r,i),o.push(s,t)}return g*2}function jn(s,t,e,n,r,i){const o=$e;if(s.length===0)return;const a=t;let h=a.alignment;if(t.alignment!==.5){let R=je(s);h=(h-.5)*R+.5}const l=new rt(s[0],s[1]),c=new rt(s[s.length-2],s[s.length-1]),d=n,f=Math.abs(l.x-c.x)<o&&Math.abs(l.y-c.y)<o;if(d){s=s.slice(),f&&(s.pop(),s.pop(),c.set(s[s.length-2],s[s.length-1]));const R=(l.x+c.x)*.5,j=(c.y+l.y)*.5;s.unshift(R,j),s.push(R,j)}const u=r,x=s.length/2;let y=s.length;const g=u.length/2,_=a.width/2,p=_*_,M=a.miterLimit*a.miterLimit;let m=s[0],w=s[1],P=s[2],b=s[3],G=0,v=0,S=-(w-b),k=m-P,D=0,F=0,I=Math.sqrt(S*S+k*k);S/=I,k/=I,S*=_,k*=_;const nt=h,C=(1-nt)*2,T=nt*2;d||(a.cap==="round"?y+=O(m-S*(C-T)*.5,w-k*(C-T)*.5,m-S*C,w-k*C,m+S*T,w+k*T,u,!0)+2:a.cap==="square"&&(y+=_e(m,w,S,k,C,T,!0,u))),u.push(m-S*C,w-k*C),u.push(m+S*T,w+k*T);for(let R=1;R<x-1;++R){m=s[(R-1)*2],w=s[(R-1)*2+1],P=s[R*2],b=s[R*2+1],G=s[(R+1)*2],v=s[(R+1)*2+1],S=-(w-b),k=m-P,I=Math.sqrt(S*S+k*k),S/=I,k/=I,S*=_,k*=_,D=-(b-v),F=P-G,I=Math.sqrt(D*D+F*F),D/=I,F/=I,D*=_,F*=_;const j=P-m,at=w-b,ht=P-G,ct=v-b,ce=j*ht+at*ct,Ct=at*ht-ct*j,lt=Ct<0;if(Math.abs(Ct)<.001*Math.abs(ce)){u.push(P-S*C,b-k*C),u.push(P+S*T,b+k*T),ce>=0&&(a.join==="round"?y+=O(P,b,P-S*C,b-k*C,P-D*C,b-F*C,u,!1)+4:y+=2,u.push(P-D*T,b-F*T),u.push(P+D*C,b+F*C));continue}const le=(-S+m)*(-k+b)-(-S+P)*(-k+w),ue=(-D+G)*(-F+b)-(-D+P)*(-F+v),kt=(j*ue-ht*le)/Ct,wt=(ct*le-at*ue)/Ct,Lt=(kt-P)*(kt-P)+(wt-b)*(wt-b),X=P+(kt-P)*C,Y=b+(wt-b)*C,Z=P-(kt-P)*T,Q=b-(wt-b)*T,tn=Math.min(j*j+at*at,ht*ht+ct*ct),de=lt?C:T,en=tn+de*de*p;Lt<=en?a.join==="bevel"||Lt/p>M?(lt?(u.push(X,Y),u.push(P+S*T,b+k*T),u.push(X,Y),u.push(P+D*T,b+F*T)):(u.push(P-S*C,b-k*C),u.push(Z,Q),u.push(P-D*C,b-F*C),u.push(Z,Q)),y+=2):a.join==="round"?lt?(u.push(X,Y),u.push(P+S*T,b+k*T),y+=O(P,b,P+S*T,b+k*T,P+D*T,b+F*T,u,!0)+4,u.push(X,Y),u.push(P+D*T,b+F*T)):(u.push(P-S*C,b-k*C),u.push(Z,Q),y+=O(P,b,P-S*C,b-k*C,P-D*C,b-F*C,u,!1)+4,u.push(P-D*C,b-F*C),u.push(Z,Q)):(u.push(X,Y),u.push(Z,Q)):(u.push(P-S*C,b-k*C),u.push(P+S*T,b+k*T),a.join==="round"?lt?y+=O(P,b,P+S*T,b+k*T,P+D*T,b+F*T,u,!0)+2:y+=O(P,b,P-S*C,b-k*C,P-D*C,b-F*C,u,!1)+2:a.join==="miter"&&Lt/p<=M&&(lt?(u.push(Z,Q),u.push(Z,Q)):(u.push(X,Y),u.push(X,Y)),y+=2),u.push(P-D*C,b-F*C),u.push(P+D*T,b+F*T),y+=2)}m=s[(x-2)*2],w=s[(x-2)*2+1],P=s[(x-1)*2],b=s[(x-1)*2+1],S=-(w-b),k=m-P,I=Math.sqrt(S*S+k*k),S/=I,k/=I,S*=_,k*=_,u.push(P-S*C,b-k*C),u.push(P+S*T,b+k*T),d||(a.cap==="round"?y+=O(P-S*(C-T)*.5,b-k*(C-T)*.5,P-S*C,b-k*C,P+S*T,b+k*T,u,!1)+2:a.cap==="square"&&(y+=_e(P,b,S,k,C,T,!1,u)));const ot=me*me;for(let R=g;R<y+g-2;++R)m=u[R*2],w=u[R*2+1],P=u[(R+1)*2],b=u[(R+1)*2+1],G=u[(R+2)*2],v=u[(R+2)*2+1],!(Math.abs(m*(b-v)+P*(v-w)+G*(w-b))<ot)&&i.push(R,R+1,R+2)}function Nn(s,t,e,n){const r=$e;if(s.length===0)return;const i=s[0],o=s[1],a=s[s.length-2],h=s[s.length-1],l=t||Math.abs(i-a)<r&&Math.abs(o-h)<r,c=e,d=s.length/2,f=c.length/2;for(let u=0;u<d;u++)c.push(s[u*2]),c.push(s[u*2+1]);for(let u=0;u<d-1;u++)n.push(f+u,f+u+1);l&&n.push(f+d-1,f)}function Xe(s,t,e,n,r,i,o){const a=Rn(s,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)i[o++]=a[l]+r,i[o++]=a[l+1]+r,i[o++]=a[l+2]+r;let h=r*n;for(let l=0;l<s.length;l+=2)e[h]=s[l],e[h+1]=s[l+1],h+=n}const $n=[],Xn={extension:{type:U.ShapeBuilder,name:"polygon"},build(s,t){for(let e=0;e<s.points.length;e++)t[e]=s.points[e];return!0},triangulate(s,t,e,n,r,i){Xe(s,$n,t,e,n,r,i)}},Yn={extension:{type:U.ShapeBuilder,name:"rectangle"},build(s,t){const e=s,n=e.x,r=e.y,i=e.width,o=e.height;return i>0&&o>0?(t[0]=n,t[1]=r,t[2]=n+i,t[3]=r,t[4]=n+i,t[5]=r+o,t[6]=n,t[7]=r+o,!0):!1},triangulate(s,t,e,n,r,i){let o=0;n*=e,t[n+o]=s[0],t[n+o+1]=s[1],o+=e,t[n+o]=s[2],t[n+o+1]=s[3],o+=e,t[n+o]=s[6],t[n+o+1]=s[7],o+=e,t[n+o]=s[4],t[n+o+1]=s[5],o+=e;const a=n/e;r[i++]=a,r[i++]=a+1,r[i++]=a+2,r[i++]=a+1,r[i++]=a+3,r[i++]=a+2}},Zn={extension:{type:U.ShapeBuilder,name:"triangle"},build(s,t){return t[0]=s.x,t[1]=s.y,t[2]=s.x2,t[3]=s.y2,t[4]=s.x3,t[5]=s.y3,!0},triangulate(s,t,e,n,r,i){let o=0;n*=e,t[n+o]=s[0],t[n+o+1]=s[1],o+=e,t[n+o]=s[2],t[n+o+1]=s[3],o+=e,t[n+o]=s[4],t[n+o+1]=s[5];const a=n/e;r[i++]=a,r[i++]=a+1,r[i++]=a+2}},be=[{offset:0,color:"white"},{offset:1,color:"black"}],re=class Yt{constructor(...t){this.uid=At("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=Qn(t);e={...e.type==="radial"?Yt.defaultRadialOptions:Yt.defaultLinearOptions,...sn(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(r=>{this.addColorStop(r.offset,r.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:N.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:n,y:r}=this.end,i=n-t,o=r-e;const a=i<0||o<0;if(this._wrapMode==="clamp-to-edge"){if(i<0){const g=t;t=n,n=g,i*=-1}if(o<0){const g=e;e=r,r=g,o*=-1}}const h=this.colorStops.length?this.colorStops:be,l=this._textureSize,{canvas:c,context:d}=Me(l,1),f=a?d.createLinearGradient(this._textureSize,0,0,0):d.createLinearGradient(0,0,this._textureSize,0);Pe(f,h),d.fillStyle=f,d.fillRect(0,0,l,1),this.texture=new J({source:new fe({resource:c,addressMode:this._wrapMode})});const u=Math.sqrt(i*i+o*o),x=Math.atan2(o,i),y=new H;y.scale(u/l,1),y.rotate(x),y.translate(t,e),this.textureSpace==="local"&&y.scale(l,l),this.transform=y}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:be,e=this._textureSize,{canvas:n,context:r}=Me(e,e),{x:i,y:o}=this.center,{x:a,y:h}=this.outerCenter,l=this.innerRadius,c=this.outerRadius,d=a-c,f=h-c,u=e/(c*2),x=(i-d)*u,y=(o-f)*u,g=r.createRadialGradient(x,y,l*u,(a-d)*u,(h-f)*u,c*u);Pe(g,t),r.fillStyle=t[t.length-1].color,r.fillRect(0,0,e,e),r.fillStyle=g,r.translate(x,y),r.rotate(this.rotation),r.scale(1,this.scale),r.translate(-x,-y),r.fillRect(0,0,e,e),this.texture=new J({source:new fe({resource:n,addressMode:this._wrapMode})});const _=new H;this.textureSpace==="local"?_.scale(2*c,2*c):_.scale(1/u,1/u),_.translate(d,f),this.transform=_}destroy(){this.texture?.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};re.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};re.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,rotation:0,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let St=re;function Pe(s,t){for(let e=0;e<t.length;e++){const n=t[e];s.addColorStop(n.offset,n.color)}}function Me(s,t){const e=rn.get().createCanvas(s,t),n=e.getContext("2d");return{canvas:e,context:n}}function Qn(s){let t=s[0]??{};return(typeof t=="number"||s[1])&&(L("8.5.2","use options object instead"),t={type:"linear",start:{x:s[0],y:s[1]},end:{x:s[2],y:s[3]},textureSpace:s[4],textureSize:s[5]??St.defaultLinearOptions.textureSize}),t}const Kn=new H,On=new $,Jn=new H;function ts(s,t,e,n){const r=t.matrix?s.copyFrom(t.matrix).invert():s.identity();if(t.textureSpace==="local"){const o=e.getBounds(On);t.width&&o.pad(t.width);const{x:a,y:h}=o,l=1/o.width,c=1/o.height,d=-a*l,f=-h*c,u=r.a,x=r.b,y=r.c,g=r.d;r.a*=l,r.b*=l,r.c*=c,r.d*=c,r.tx=d*u+f*y+r.tx,r.ty=d*x+f*g+r.ty}else if(t.texture.rotate){const{uvs:o,orig:a}=t.texture;r.scale(1/a.width,1/a.height),r.prepend(Jn.set(o.x1-o.x0,o.y1-o.y0,o.x3-o.x0,o.y3-o.y0,o.x0,o.y0))}else r.translate(t.texture.frame.x,t.texture.frame.y),r.scale(1/t.texture.source.width,1/t.texture.source.height);const i=t.texture.source.style;return!(t.fill instanceof St)&&i.addressMode==="clamp-to-edge"&&(i.addressMode="repeat",i.update()),n&&r.append(Kn.copyFrom(n).invert()),r}const Bt={};it.handleByMap(U.ShapeBuilder,Bt);it.add(Yn,Xn,Zn,Mt,Vn,Wn);const es=new $,ns=new H;function ss(s,t){const{geometryData:e,batches:n}=t;n.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let r=0;r<s.instructions.length;r++){const i=s.instructions[r];if(i.action==="texture")rs(i.data,n,e);else if(i.action==="fill"||i.action==="stroke"){const o=i.action==="stroke",a=i.data.path.shapePath,h=i.data.style,l=i.data.hole;o&&l&&Se(l.shapePath,h,!0,n,e),l&&(a.shapePrimitives[a.shapePrimitives.length-1].holes=l.shapePath.shapePrimitives),Se(a,h,o,n,e)}}}function rs(s,t,e){const n=[],r=Bt.rectangle,i=es;i.x=s.dx,i.y=s.dy,i.width=s.dw,i.height=s.dh;const o=s.transform;if(!r.build(i,n))return;const{vertices:a,uvs:h,indices:l}=e,c=l.length,d=a.length/2;o&&Ne(n,o),r.triangulate(n,a,2,d,l,c);const f=s.image,u=f.uvs;h.push(u.x0,u.y0,u.x1,u.y1,u.x3,u.y3,u.x2,u.y2);const x=tt.get(se);x.indexOffset=c,x.indexSize=l.length-c,x.attributeOffset=d,x.attributeSize=a.length/2-d,x.baseColor=s.style,x.alpha=s.alpha,x.texture=f,x.geometryData=e,t.push(x)}function Se(s,t,e,n,r){const{vertices:i,uvs:o,indices:a}=r;s.shapePrimitives.forEach(({shape:h,transform:l,holes:c})=>{const d=[],f=Bt[h.type];if(!f.build(h,d))return;const u=a.length,x=i.length/2;let y="triangle-list";if(l&&Ne(d,l),e){const M=h.closePath??!0,m=t;m.pixelLine?(Nn(d,M,i,a),y="line-list"):jn(d,m,!1,M,i,a)}else if(c){const M=[],m=d.slice();is(c).forEach(P=>{M.push(m.length/2),m.push(...P)}),Xe(m,M,i,2,x,a,u)}else f.triangulate(d,i,2,x,a,u);const g=o.length/2,_=t.texture;if(_!==J.WHITE){const M=ts(ns,t,h,l);Hn(i,2,x,o,g,2,i.length/2-x,M)}else Un(o,g,2,i.length/2-x);const p=tt.get(se);p.indexOffset=u,p.indexSize=a.length-u,p.attributeOffset=x,p.attributeSize=i.length/2-x,p.baseColor=t.color,p.alpha=t.alpha,p.texture=_,p.geometryData=r,p.topology=y,n.push(p)})}function is(s){const t=[];for(let e=0;e<s.length;e++){const n=s[e].shape,r=[];Bt[n.type].build(n,r)&&t.push(r)}return t}class os{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{tt.return(t)}),this.graphicsData&&tt.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class as{constructor(){this.instructions=new Be}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new ln({maxTextures:e}),this.instructions.reset()}get geometry(){return L(on,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const ie=class Zt{constructor(t){this._renderer=t,this._managedContexts=new zt({renderer:t,type:"resource",name:"graphicsContext"})}init(t){Zt.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Zt.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],n=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&n.reset(),ss(t,n);const r=t.batchMode;t.customShader||r==="no-batch"?n.isBatchable=!1:r==="auto"?n.isBatchable=n.geometryData.vertices.length<400:n.isBatchable=!0,t.dirty=!1}return n}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=tt.get(as,{maxTextures:this._renderer.limits.maxBatchableTextures}),n=t._gpuData[this._renderer.uid],{batches:r,geometryData:i}=n;n.graphicsData=e;const o=i.vertices.length,a=i.indices.length;for(let d=0;d<r.length;d++)r[d].applyTransform=!1;const h=e.batcher;h.ensureAttributeBuffer(o),h.ensureIndexBuffer(a),h.begin();for(let d=0;d<r.length;d++){const f=r[d];h.add(f)}h.finish(e.instructions);const l=h.geometry;l.indexBuffer.setDataWithSize(h.indexBuffer,h.indexSize,!0),l.buffers[0].setDataWithSize(h.attributeBuffer.float32View,h.attributeSize,!0);const c=h.batches;for(let d=0;d<c.length;d++){const f=c[d];f.bindGroup=cn(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new os;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};ie.extension={type:[U.WebGLSystem,U.WebGPUSystem],name:"graphicsContext"};ie.defaultOptions={bezierSmoothness:.5};let oe=ie;const hs=8,Rt=11920929e-14,cs=1;function Ye(s,t,e,n,r,i,o,a,h,l){const d=Math.min(.99,Math.max(0,l??oe.defaultOptions.bezierSmoothness));let f=(cs-d)/1;return f*=f,ls(t,e,n,r,i,o,a,h,s,f),s}function ls(s,t,e,n,r,i,o,a,h,l){Qt(s,t,e,n,r,i,o,a,h,l,0),h.push(o,a)}function Qt(s,t,e,n,r,i,o,a,h,l,c){if(c>hs)return;const d=(s+e)/2,f=(t+n)/2,u=(e+r)/2,x=(n+i)/2,y=(r+o)/2,g=(i+a)/2,_=(d+u)/2,p=(f+x)/2,M=(u+y)/2,m=(x+g)/2,w=(_+M)/2,P=(p+m)/2;if(c>0){let b=o-s,G=a-t;const v=Math.abs((e-o)*G-(n-a)*b),S=Math.abs((r-o)*G-(i-a)*b);if(v>Rt&&S>Rt){if((v+S)*(v+S)<=l*(b*b+G*G)){h.push(w,P);return}}else if(v>Rt){if(v*v<=l*(b*b+G*G)){h.push(w,P);return}}else if(S>Rt){if(S*S<=l*(b*b+G*G)){h.push(w,P);return}}else if(b=w-(s+o)/2,G=P-(t+a)/2,b*b+G*G<=l){h.push(w,P);return}}Qt(s,t,d,f,_,p,w,P,h,l,c+1),Qt(w,P,M,m,y,g,o,a,h,l,c+1)}const us=8,ds=11920929e-14,fs=1;function xs(s,t,e,n,r,i,o,a){const l=Math.min(.99,Math.max(0,a??oe.defaultOptions.bezierSmoothness));let c=(fs-l)/1;return c*=c,ys(t,e,n,r,i,o,s,c),s}function ys(s,t,e,n,r,i,o,a){Kt(o,s,t,e,n,r,i,a,0),o.push(r,i)}function Kt(s,t,e,n,r,i,o,a,h){if(h>us)return;const l=(t+n)/2,c=(e+r)/2,d=(n+i)/2,f=(r+o)/2,u=(l+d)/2,x=(c+f)/2;let y=i-t,g=o-e;const _=Math.abs((n-i)*g-(r-o)*y);if(_>ds){if(_*_<=a*(y*y+g*g)){s.push(u,x);return}}else if(y=u-(t+i)/2,g=x-(e+o)/2,y*y+g*g<=a){s.push(u,x);return}Kt(s,t,e,l,c,u,x,a,h+1),Kt(s,u,x,d,f,i,o,a,h+1)}function Ze(s,t,e,n,r,i,o,a){let h=Math.abs(r-i);(!o&&r>i||o&&i>r)&&(h=2*Math.PI-h),a||(a=Math.max(6,Math.floor(6*Math.pow(n,1/3)*(h/Math.PI)))),a=Math.max(a,3);let l=h/a,c=r;l*=o?-1:1;for(let d=0;d<a+1;d++){const f=Math.cos(c),u=Math.sin(c),x=t+f*n,y=e+u*n;s.push(x,y),c+=l}}function ps(s,t,e,n,r,i){const o=s[s.length-2],h=s[s.length-1]-e,l=o-t,c=r-e,d=n-t,f=Math.abs(h*d-l*c);if(f<1e-8||i===0){(s[s.length-2]!==t||s[s.length-1]!==e)&&s.push(t,e);return}const u=h*h+l*l,x=c*c+d*d,y=h*c+l*d,g=i*Math.sqrt(u)/f,_=i*Math.sqrt(x)/f,p=g*y/u,M=_*y/x,m=g*d+_*l,w=g*c+_*h,P=l*(_+p),b=h*(_+p),G=d*(g+M),v=c*(g+M),S=Math.atan2(b-w,P-m),k=Math.atan2(v-w,G-m);Ze(s,m+t,w+e,i,S,k,l*c>d*h)}const gt=Math.PI*2,Ht={centerX:0,centerY:0,ang1:0,ang2:0},Ut=({x:s,y:t},e,n,r,i,o,a,h)=>{s*=e,t*=n;const l=r*s-i*t,c=i*s+r*t;return h.x=l+o,h.y=c+a,h};function gs(s,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),n=t===1.5707963267948966?.551915024494:e,r=Math.cos(s),i=Math.sin(s),o=Math.cos(s+t),a=Math.sin(s+t);return[{x:r-i*n,y:i+r*n},{x:o+a*n,y:a-o*n},{x:o,y:a}]}const Ce=(s,t,e,n)=>{const r=s*n-t*e<0?-1:1;let i=s*e+t*n;return i>1&&(i=1),i<-1&&(i=-1),r*Math.acos(i)},ms=(s,t,e,n,r,i,o,a,h,l,c,d,f)=>{const u=Math.pow(r,2),x=Math.pow(i,2),y=Math.pow(c,2),g=Math.pow(d,2);let _=u*x-u*g-x*y;_<0&&(_=0),_/=u*g+x*y,_=Math.sqrt(_)*(o===a?-1:1);const p=_*r/i*d,M=_*-i/r*c,m=l*p-h*M+(s+e)/2,w=h*p+l*M+(t+n)/2,P=(c-p)/r,b=(d-M)/i,G=(-c-p)/r,v=(-d-M)/i,S=Ce(1,0,P,b);let k=Ce(P,b,G,v);a===0&&k>0&&(k-=gt),a===1&&k<0&&(k+=gt),f.centerX=m,f.centerY=w,f.ang1=S,f.ang2=k};function _s(s,t,e,n,r,i,o,a=0,h=0,l=0){if(i===0||o===0)return;const c=Math.sin(a*gt/360),d=Math.cos(a*gt/360),f=d*(t-n)/2+c*(e-r)/2,u=-c*(t-n)/2+d*(e-r)/2;if(f===0&&u===0)return;i=Math.abs(i),o=Math.abs(o);const x=Math.pow(f,2)/Math.pow(i,2)+Math.pow(u,2)/Math.pow(o,2);x>1&&(i*=Math.sqrt(x),o*=Math.sqrt(x)),ms(t,e,n,r,i,o,h,l,c,d,f,u,Ht);let{ang1:y,ang2:g}=Ht;const{centerX:_,centerY:p}=Ht;let M=Math.abs(g)/(gt/4);Math.abs(1-M)<1e-7&&(M=1);const m=Math.max(Math.ceil(M),1);g/=m;let w=s[s.length-2],P=s[s.length-1];const b={x:0,y:0};for(let G=0;G<m;G++){const v=gs(y,g),{x:S,y:k}=Ut(v[0],i,o,d,c,_,p,b),{x:D,y:F}=Ut(v[1],i,o,d,c,_,p,b),{x:I,y:nt}=Ut(v[2],i,o,d,c,_,p,b);Ye(s,w,P,S,k,D,F,I,nt),w=I,P=nt,y+=g}}function bs(s,t,e){const n=(o,a)=>{const h=a.x-o.x,l=a.y-o.y,c=Math.sqrt(h*h+l*l),d=h/c,f=l/c;return{len:c,nx:d,ny:f}},r=(o,a)=>{o===0?s.moveTo(a.x,a.y):s.lineTo(a.x,a.y)};let i=t[t.length-1];for(let o=0;o<t.length;o++){const a=t[o%t.length],h=a.radius??e;if(h<=0){r(o,a),i=a;continue}const l=t[(o+1)%t.length],c=n(a,i),d=n(a,l);if(c.len<1e-4||d.len<1e-4){r(o,a),i=a;continue}let f=Math.asin(c.nx*d.ny-c.ny*d.nx),u=1,x=!1;c.nx*d.nx-c.ny*-d.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,u=-1,x=!0):f>0&&(u=-1,x=!0);const y=f/2;let g,_=Math.abs(Math.cos(y)*h/Math.sin(y));_>Math.min(c.len/2,d.len/2)?(_=Math.min(c.len/2,d.len/2),g=Math.abs(_*Math.sin(y)/Math.cos(y))):g=h;const p=a.x+d.nx*_+-d.ny*g*u,M=a.y+d.ny*_+d.nx*g*u,m=Math.atan2(c.ny,c.nx)+Math.PI/2*u,w=Math.atan2(d.ny,d.nx)-Math.PI/2*u;o===0&&s.moveTo(p+Math.cos(m)*g,M+Math.sin(m)*g),s.arc(p,M,g,m,w,x),i=a}}function Ps(s,t,e,n){const r=(a,h)=>Math.sqrt((a.x-h.x)**2+(a.y-h.y)**2),i=(a,h,l)=>({x:a.x+(h.x-a.x)*l,y:a.y+(h.y-a.y)*l}),o=t.length;for(let a=0;a<o;a++){const h=t[(a+1)%o],l=h.radius??e;if(l<=0){a===0?s.moveTo(h.x,h.y):s.lineTo(h.x,h.y);continue}const c=t[a],d=t[(a+2)%o],f=r(c,h);let u;if(f<1e-4)u=h;else{const g=Math.min(f/2,l);u=i(h,c,g/f)}const x=r(d,h);let y;if(x<1e-4)y=h;else{const g=Math.min(x/2,l);y=i(h,d,g/x)}a===0?s.moveTo(u.x,u.y):s.lineTo(u.x,u.y),s.quadraticCurveTo(h.x,h.y,y.x,y.y,n)}}const Ms=new $;class Ss{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Le,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const n=this._currentPoly.points,r=n[n.length-2],i=n[n.length-1];return(r!==t||i!==e)&&n.push(t,e),this}arc(t,e,n,r,i,o){this._ensurePoly(!1);const a=this._currentPoly.points;return Ze(a,t,e,n,r,i,o),this}arcTo(t,e,n,r,i){this._ensurePoly();const o=this._currentPoly.points;return ps(o,t,e,n,r,i),this}arcToSvg(t,e,n,r,i,o,a){const h=this._currentPoly.points;return _s(h,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,n,r,i),this}bezierCurveTo(t,e,n,r,i,o,a){this._ensurePoly();const h=this._currentPoly;return Ye(this._currentPoly.points,h.lastX,h.lastY,t,e,n,r,i,o,a),this}quadraticCurveTo(t,e,n,r,i){this._ensurePoly();const o=this._currentPoly;return xs(this._currentPoly.points,o.lastX,o.lastY,t,e,n,r,i),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));const n=this.shapePrimitives,r=n.length;for(let i=0;i<t.instructions.length;i++){const o=t.instructions[i];this[o.action](...o.data)}if(t.checkForHoles&&n.length-r>1){let i=null;for(let o=r;o<n.length;o++){const a=n[o];if(a.shape.type==="polygon"){const h=a.shape,l=i?.shape;l&&l.containsPolygon(h)?(i.holes||(i.holes=[]),i.holes.push(a),n.copyWithin(o,o+1),n.length--,o--):i=a}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,n,r,i){return this.drawShape(new $(t,e,n,r),i),this}circle(t,e,n,r){return this.drawShape(new te(t,e,n),r),this}poly(t,e,n){const r=new pt(t);return r.closePath=e,this.drawShape(r,n),this}regularPoly(t,e,n,r,i=0,o){r=Math.max(r|0,3);const a=-1*Math.PI/2+i,h=Math.PI*2/r,l=[];for(let c=0;c<r;c++){const d=a-c*h;l.push(t+n*Math.cos(d),e+n*Math.sin(d))}return this.poly(l,!0,o),this}roundPoly(t,e,n,r,i,o=0,a){if(r=Math.max(r|0,3),i<=0)return this.regularPoly(t,e,n,r,o);const h=n*Math.sin(Math.PI/r)-.001;i=Math.min(i,h);const l=-1*Math.PI/2+o,c=Math.PI*2/r,d=(r-2)*Math.PI/r/2;for(let f=0;f<r;f++){const u=f*c+l,x=t+n*Math.cos(u),y=e+n*Math.sin(u),g=u+Math.PI+d,_=u-Math.PI-d,p=x+i*Math.cos(g),M=y+i*Math.sin(g),m=x+i*Math.cos(_),w=y+i*Math.sin(_);f===0?this.moveTo(p,M):this.lineTo(p,M),this.quadraticCurveTo(x,y,m,w,a)}return this.closePath()}roundShape(t,e,n=!1,r){return t.length<3?this:(n?Ps(this,t,e,r):bs(this,t,e),this.closePath())}filletRect(t,e,n,r,i){if(i===0)return this.rect(t,e,n,r);const o=Math.min(n,r)/2,a=Math.min(o,Math.max(-o,i)),h=t+n,l=e+r,c=a<0?-a:0,d=Math.abs(a);return this.moveTo(t,e+d).arcTo(t+c,e+c,t+d,e,d).lineTo(h-d,e).arcTo(h-c,e+c,h,e+d,d).lineTo(h,l-d).arcTo(h-c,l-c,t+n-d,l,d).lineTo(t+d,l).arcTo(t+c,l-c,t,l-d,d).closePath()}chamferRect(t,e,n,r,i,o){if(i<=0)return this.rect(t,e,n,r);const a=Math.min(i,Math.min(n,r)/2),h=t+n,l=e+r,c=[t+a,e,h-a,e,h,e+a,h,l-a,h-a,l,t+a,l,t,l-a,t,e+a];for(let d=c.length-1;d>=2;d-=2)c[d]===c[d-2]&&c[d-1]===c[d-3]&&c.splice(d-1,2);return this.poly(c,!0,o)}ellipse(t,e,n,r,i){return this.drawShape(new ee(t,e,n,r),i),this}roundRect(t,e,n,r,i,o){return this.drawShape(new ne(t,e,n,r,i),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let n=this._currentPoly;return n&&this.endPoly(),n=new pt,n.points.push(t,e),this._currentPoly=n,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new pt,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let n=e.shape.x,r=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const i=e.transform,o=n;n=i.a*n+i.c*r+i.tx,r=i.b*o+i.d*r+i.ty}this._currentPoly.points.push(n,r)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const n=t.instructions[e];this[n.action](...n.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let n=0;n<e.length;n++){const r=e[n],i=r.shape.getBounds(Ms);r.transform?t.addRect(i,r.transform):t.addRect(i)}return t}}class W{constructor(t,e=!1){this.instructions=[],this.uid=At("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?zn(t,this):this.instructions=t?.slice()??[]}get shapePath(){return this._shapePath||(this._shapePath=new Ss(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,n,r,i){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(rt.shared);let h=0,l=0;if(!o||o.action!=="bezierCurveTo")h=a.x,l=a.y;else{h=o.data[2],l=o.data[3];const c=a.x,d=a.y;h=c+(c-h),l=d+(d-l)}return this.instructions.push({action:"bezierCurveTo",data:[h,l,t,e,n,r,i]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,n){const r=this.instructions[this.instructions.length-1],i=this.getLastPoint(rt.shared);let o=0,a=0;if(!r||r.action!=="quadraticCurveTo")o=i.x,a=i.y;else{o=r.data[0],a=r.data[1];const h=i.x,l=i.y;o=h+(h-o),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,n]}),this._dirty=!0,this}rect(t,e,n,r,i){return this.instructions.push({action:"rect",data:[t,e,n,r,i]}),this._dirty=!0,this}circle(t,e,n,r){return this.instructions.push({action:"circle",data:[t,e,n,r]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,n,r,i,o,a){i||(i=r/2);const h=-1*Math.PI/2+o,l=n*2,c=Math.PI*2/l,d=[];for(let f=0;f<l;f++){const u=f%2?i:r,x=f*c+h;d.push(t+u*Math.cos(x),e+u*Math.sin(x))}return this.poly(d,!0,a),this}clone(t=!1){const e=new W;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let n=0;n<this.instructions.length;n++){const r=this.instructions[n];e.instructions.push({action:r.action,data:r.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,n=t.b,r=t.c,i=t.d,o=t.tx,a=t.ty;let h=0,l=0,c=0,d=0,f=0,u=0,x=0,y=0;for(let g=0;g<this.instructions.length;g++){const _=this.instructions[g],p=_.data;switch(_.action){case"moveTo":case"lineTo":h=p[0],l=p[1],p[0]=e*h+r*l+o,p[1]=n*h+i*l+a;break;case"bezierCurveTo":c=p[0],d=p[1],f=p[2],u=p[3],h=p[4],l=p[5],p[0]=e*c+r*d+o,p[1]=n*c+i*d+a,p[2]=e*f+r*u+o,p[3]=n*f+i*u+a,p[4]=e*h+r*l+o,p[5]=n*h+i*l+a;break;case"quadraticCurveTo":c=p[0],d=p[1],h=p[2],l=p[3],p[0]=e*c+r*d+o,p[1]=n*c+i*d+a,p[2]=e*h+r*l+o,p[3]=n*h+i*l+a;break;case"arcToSvg":h=p[5],l=p[6],x=p[0],y=p[1],p[0]=e*x+r*y,p[1]=n*x+i*y,p[5]=e*h+r*l+o,p[6]=n*h+i*l+a;break;case"circle":p[4]=st(p[3],t);break;case"rect":p[4]=st(p[4],t);break;case"ellipse":p[8]=st(p[8],t);break;case"roundRect":p[5]=st(p[5],t);break;case"addPath":p[0].transform(t);break;case"poly":p[2]=st(p[2],t);break;case"regularPoly":case"chamferRect":p[5]=st(p[5],t);break;case"closePath":break;default:It("unknown transform action",_.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,n=this.instructions[e];if(!n)return t.x=0,t.y=0,t;for(;n.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;n=this.instructions[e]}switch(n.action){case"moveTo":case"lineTo":t.x=n.data[0],t.y=n.data[1];break;case"quadraticCurveTo":t.x=n.data[2],t.y=n.data[3];break;case"bezierCurveTo":t.x=n.data[4],t.y=n.data[5];break;case"arc":case"arcToSvg":t.x=n.data[5],t.y=n.data[6];break;case"addPath":n.data[0].getLastPoint(t);break}return t}}function st(s,t){return s?s.prepend(t):t.clone()}function A(s,t,e){const n=s.getAttribute(t);return n?Number(n):e}function Cs(s,t){const e=s.querySelectorAll("defs");for(let n=0;n<e.length;n++){const r=e[n];for(let i=0;i<r.children.length;i++){const o=r.children[i];switch(o.nodeName.toLowerCase()){case"lineargradient":t.defs[o.id]=ks(o);break;case"radialgradient":t.defs[o.id]=ws();break}}}}function ks(s){const t=A(s,"x1",0),e=A(s,"y1",0),n=A(s,"x2",1),r=A(s,"y2",0),i=s.getAttribute("gradientUnits")||"objectBoundingBox",o=new St(t,e,n,r,i==="objectBoundingBox"?"local":"global");for(let a=0;a<s.children.length;a++){const h=s.children[a],l=A(h,"offset",0),c=N.shared.setValue(h.getAttribute("stop-color")).toNumber();o.addColorStop(l,c)}return o}function ws(s){return It("[SVG Parser] Radial gradients are not yet supported"),new St(0,0,1,0)}function ke(s){const t=s.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const we={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function Qe(s,t){const e=s.getAttribute("style"),n={},r={},i={strokeStyle:n,fillStyle:r,useFill:!1,useStroke:!1};for(const o in we){const a=s.getAttribute(o);a&&Te(t,i,o,a.trim())}if(e){const o=e.split(";");for(let a=0;a<o.length;a++){const h=o[a].trim(),[l,c]=h.split(":");we[l]&&Te(t,i,l,c.trim())}}return{strokeStyle:i.useStroke?n:null,fillStyle:i.useFill?r:null,useFill:i.useFill,useStroke:i.useStroke}}function Te(s,t,e,n){switch(e){case"stroke":if(n!=="none"){if(n.startsWith("url(")){const r=ke(n);t.strokeStyle.fill=s.defs[r]}else t.strokeStyle.color=N.shared.setValue(n).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(n);break;case"fill":if(n!=="none"){if(n.startsWith("url(")){const r=ke(n);t.fillStyle.fill=s.defs[r]}else t.fillStyle.color=N.shared.setValue(n).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(n);break;case"stroke-opacity":t.strokeStyle.alpha=Number(n);break;case"opacity":t.fillStyle.alpha=Number(n),t.strokeStyle.alpha=Number(n);break}}function Ts(s){if(s.length<=2)return!0;const t=s.map(a=>a.area).sort((a,h)=>h-a),[e,n]=t,r=t[t.length-1],i=e/n,o=n/r;return!(i>3&&o<2)}function vs(s){return s.split(/(?=[Mm])/).filter(n=>n.trim().length>0)}function Gs(s){const t=s.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const e=t.map(Number),n=[],r=[];for(let c=0;c<e.length;c+=2)c+1<e.length&&(n.push(e[c]),r.push(e[c+1]));if(n.length===0||r.length===0)return 0;const i=Math.min(...n),o=Math.max(...n),a=Math.min(...r),h=Math.max(...r);return(o-i)*(h-a)}function ve(s,t){const e=new W(s,!1);for(const n of e.instructions)t.instructions.push(n)}function Rs(s,t){if(typeof s=="string"){const o=document.createElement("div");o.innerHTML=s.trim(),s=o.querySelector("svg")}const e={context:t,defs:{},path:new W};Cs(s,e);const n=s.children,{fillStyle:r,strokeStyle:i}=Qe(s,e);for(let o=0;o<n.length;o++){const a=n[o];a.nodeName.toLowerCase()!=="defs"&&Ke(a,e,r,i)}return t}function Ke(s,t,e,n){const r=s.children,{fillStyle:i,strokeStyle:o}=Qe(s,t);i&&e?e={...e,...i}:i&&(e=i),o&&n?n={...n,...o}:o&&(n=o);const a=!e&&!n;a&&(e={color:0});let h,l,c,d,f,u,x,y,g,_,p,M,m,w,P,b,G;switch(s.nodeName.toLowerCase()){case"path":{w=s.getAttribute("d");const v=s.getAttribute("fill-rule"),S=vs(w),k=v==="evenodd",D=S.length>1;if(k&&D){const I=S.map(C=>({path:C,area:Gs(C)}));if(I.sort((C,T)=>T.area-C.area),S.length>3||!Ts(I))for(let C=0;C<I.length;C++){const T=I[C],ot=C===0;t.context.beginPath();const R=new W(void 0,!0);ve(T.path,R),t.context.path(R),ot?(e&&t.context.fill(e),n&&t.context.stroke(n)):t.context.cut()}else for(let C=0;C<I.length;C++){const T=I[C],ot=C%2===1;t.context.beginPath();const R=new W(void 0,!0);ve(T.path,R),t.context.path(R),ot?t.context.cut():(e&&t.context.fill(e),n&&t.context.stroke(n))}}else{const I=v?v==="evenodd":!0;P=new W(w,I),t.context.path(P),e&&t.context.fill(e),n&&t.context.stroke(n)}break}case"circle":x=A(s,"cx",0),y=A(s,"cy",0),g=A(s,"r",0),t.context.ellipse(x,y,g,g),e&&t.context.fill(e),n&&t.context.stroke(n);break;case"rect":h=A(s,"x",0),l=A(s,"y",0),b=A(s,"width",0),G=A(s,"height",0),_=A(s,"rx",0),p=A(s,"ry",0),_||p?t.context.roundRect(h,l,b,G,_||p):t.context.rect(h,l,b,G),e&&t.context.fill(e),n&&t.context.stroke(n);break;case"ellipse":x=A(s,"cx",0),y=A(s,"cy",0),_=A(s,"rx",0),p=A(s,"ry",0),t.context.beginPath(),t.context.ellipse(x,y,_,p),e&&t.context.fill(e),n&&t.context.stroke(n);break;case"line":c=A(s,"x1",0),d=A(s,"y1",0),f=A(s,"x2",0),u=A(s,"y2",0),t.context.beginPath(),t.context.moveTo(c,d),t.context.lineTo(f,u),n&&t.context.stroke(n);break;case"polygon":m=s.getAttribute("points"),M=m.match(/-?\d+/g).map(v=>parseInt(v,10)),t.context.poly(M,!0),e&&t.context.fill(e),n&&t.context.stroke(n);break;case"polyline":m=s.getAttribute("points"),M=m.match(/-?\d+/g).map(v=>parseInt(v,10)),t.context.poly(M,!1),n&&t.context.stroke(n);break;case"g":case"svg":break;default:{It(`[SVG parser] <${s.nodeName}> elements unsupported`);break}}a&&(e=null);for(let v=0;v<r.length;v++)Ke(r[v],t,e,n)}function Ds(s){return s.texture!==void 0}const Ge={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class Fs{constructor(t,e){this.uid=At("fillPattern"),this._tick=0,this.transform=new H;const n=Ds(t)?t:{texture:t,repetition:e};this.texture=n.texture,this.textureSpace=n.textureSpace??"global";const r=n.repetition;r&&(this.texture.source.style.addressModeU=Ge[r].addressModeU,this.texture.source.style.addressModeV=Ge[r].addressModeV)}setTransform(t){if(t){if(this.transform.equals(t))return;this.transform.copyFrom(t)}else{if(this.transform.isIdentity())return;this.transform.identity()}this._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function Is(s){return N.isColorLike(s)}function Re(s){return s instanceof Fs}function De(s){return s instanceof St}function As(s){return s instanceof J}function zs(s,t,e){const n=N.shared.setValue(t??0);return s.color=n.toNumber(),s.alpha=n.alpha===1?e.alpha:n.alpha,s.texture=J.WHITE,{...e,...s}}function Bs(s,t,e){return s.texture=t,{...e,...s}}function Fe(s,t,e){return s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,s.textureSpace=t.textureSpace,{...e,...s}}function Ie(s,t,e){return t.buildGradient(),s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,s.textureSpace=t.textureSpace,{...e,...s}}function Ls(s,t){const e={...t,...s},n=N.shared.setValue(e.color);return e.alpha*=n.alpha,e.color=n.toNumber(),e}function yt(s,t){if(s==null)return null;const e={},n=s;return Is(s)?zs(e,s,t):As(s)?Bs(e,s,t):Re(s)?Fe(e,s,t):De(s)?Ie(e,s,t):n.fill&&Re(n.fill)?Fe(n,n.fill,t):n.fill&&De(n.fill)?Ie(n,n.fill,t):Ls(n,t)}function Ae(s,t){const{width:e,alignment:n,miterLimit:r,cap:i,join:o,pixelLine:a,...h}=t,l=yt(s,h);return l?{width:e,alignment:n,miterLimit:r,cap:i,join:o,pixelLine:a,...l}:null}function qs(s,t){let e=1;const n=s.shapePath.shapePrimitives;for(let r=0;r<n.length;r++){const i=n[r].shape;if(i.type!=="polygon")continue;const o=i.points,a=o.length;if(a<6)continue;const h=i.closePath;for(let l=0;l<a;l+=2){if(!h&&(l===0||l===a-2))continue;const c=(l-2+a)%a,d=(l+2)%a,f=o[c],u=o[c+1],x=o[l],y=o[l+1],g=o[d],_=o[d+1],p=f-x,M=u-y,m=g-x,w=_-y,P=p*p+M*M,b=m*m+w*w;if(P<1e-12||b<1e-12)continue;let S=(p*m+M*w)/Math.sqrt(P*b);S<-1?S=-1:S>1&&(S=1);const k=Math.sqrt((1-S)*.5);if(k<1e-6)continue;const D=Math.min(1/k,t);D>e&&(e=D)}}return e}const Hs=new rt,ze=new H,ae=class V extends an{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=At("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new W,this._transform=new H,this._fillStyle={...V.defaultFillStyle},this._strokeStyle={...V.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Le,this._boundsDirty=!0}clone(){const t=new V;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...this._strokeStyle},t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=yt(t,V.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Ae(t,V.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=yt(t,V.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=yt(t,V.defaultStrokeStyle),this}texture(t,e,n,r,i,o){return this.instructions.push({action:"texture",data:{image:t,dx:n||0,dy:r||0,dw:i||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||e===0?N.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new W,this}fill(t,e){let n;const r=this.instructions[this.instructions.length-1];return this._tick===0&&r?.action==="stroke"?n=r.data.path:n=this._activePath.clone(),n?(t!=null&&(e!==void 0&&typeof t=="number"&&(L(E,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=yt(t,V.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:n}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(rt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const n=this.instructions[this.instructions.length-1];return this._tick===0&&n?.action==="fill"?e=n.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Ae(t,V.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],n=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(n);else{e.data.hole=n;break}}return this._initNextPathLocation(),this}arc(t,e,n,r,i,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,n,r,i,o),this}arcTo(t,e,n,r,i){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*n+o.c*r+o.tx,o.b*n+o.d*r+o.ty,i),this}arcToSvg(t,e,n,r,i,o,a){this._tick++;const h=this._transform;return this._activePath.arcToSvg(t,e,n,r,i,h.a*o+h.c*a+h.tx,h.b*o+h.d*a+h.ty),this}bezierCurveTo(t,e,n,r,i,o,a){this._tick++;const h=this._transform;return this._activePath.bezierCurveTo(h.a*t+h.c*e+h.tx,h.b*t+h.d*e+h.ty,h.a*n+h.c*r+h.tx,h.b*n+h.d*r+h.ty,h.a*i+h.c*o+h.tx,h.b*i+h.d*o+h.ty,a),this}closePath(){return this._tick++,this._activePath?.closePath(),this}ellipse(t,e,n,r){return this._tick++,this._activePath.ellipse(t,e,n,r,this._transform.clone()),this}circle(t,e,n){return this._tick++,this._activePath.circle(t,e,n,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const n=this._transform;return this._activePath.lineTo(n.a*t+n.c*e+n.tx,n.b*t+n.d*e+n.ty),this}moveTo(t,e){this._tick++;const n=this._transform,r=this._activePath.instructions,i=n.a*t+n.c*e+n.tx,o=n.b*t+n.d*e+n.ty;return r.length===1&&r[0].action==="moveTo"?(r[0].data[0]=i,r[0].data[1]=o,this):(this._activePath.moveTo(i,o),this)}quadraticCurveTo(t,e,n,r,i){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*n+o.c*r+o.tx,o.b*n+o.d*r+o.ty,i),this}rect(t,e,n,r){return this._tick++,this._activePath.rect(t,e,n,r,this._transform.clone()),this}roundRect(t,e,n,r,i){return this._tick++,this._activePath.roundRect(t,e,n,r,i,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,n,r,i=0,o){return this._tick++,this._activePath.regularPoly(t,e,n,r,i,o),this}roundPoly(t,e,n,r,i,o){return this._tick++,this._activePath.roundPoly(t,e,n,r,i,o),this}roundShape(t,e,n,r){return this._tick++,this._activePath.roundShape(t,e,n,r),this}filletRect(t,e,n,r,i){return this._tick++,this._activePath.filletRect(t,e,n,r,i),this}chamferRect(t,e,n,r,i,o){return this._tick++,this._activePath.chamferRect(t,e,n,r,i,o),this}star(t,e,n,r,i=0,o=0){return this._tick++,this._activePath.star(t,e,n,r,i,o,this._transform.clone()),this}svg(t){return this._tick++,Rs(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:{...this._fillStyle},strokeStyle:{...this._strokeStyle}}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,n,r,i,o){return t instanceof H?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,n,r,i,o),this)}transform(t,e,n,r,i,o){return t instanceof H?(this._transform.append(t),this):(ze.set(t,e,n,r,i,o),this._transform.append(ze),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const n=this.instructions[e],r=n.action;if(r==="fill"){const i=n.data;t.addBounds(i.path.bounds)}else if(r==="texture"){const i=n.data;t.addFrame(i.dx,i.dy,i.dx+i.dw,i.dy+i.dh,i.transform)}if(r==="stroke"){const i=n.data,o=i.style.alignment;let a=i.style.width*(1-o);i.style.join==="miter"&&(a*=qs(i.path,i.style.miterLimit));const h=i.path.bounds;t.addFrame(h.minX-a,h.minY-a,h.maxX+a,h.maxY+a)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let n=!1;for(let r=0;r<e.length;r++){const i=e[r],o=i.data,a=o.path;if(!i.action||!a)continue;const h=o.style,l=a.shapePath.shapePrimitives;for(let c=0;c<l.length;c++){const d=l[c].shape;if(!h||!d)continue;const f=l[c].transform,u=f?f.applyInverse(t,Hs):t;if(i.action==="fill")n=d.contains(u.x,u.y);else{const y=h;n=d.strokeContains(u.x,u.y,y.width,y.alignment)}const x=o.hole;if(x){const y=x.shapePath?.shapePrimitives;if(y)for(let g=0;g<y.length;g++)y[g].shape.contains(u.x,u.y)&&(n=!1)}if(n)return!0}}return n}unload(){this.emit("unload",this);for(const t in this._gpuData)this._gpuData[t]?.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(this.destroyed)return;if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t?.texture){const n=typeof t=="boolean"?t:t?.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(n)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(n))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};ae.defaultFillStyle={color:16777215,alpha:1,texture:J.WHITE,matrix:null,fill:null,textureSpace:"local"};ae.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:J.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let xt=ae;class Us{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class Es{constructor(){this.instructions=new Be}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const he=class Ot{constructor(t){this._renderer=t,this._managedContexts=new zt({renderer:t,type:"resource",name:"graphicsContext"})}init(t){Ot.defaultOptions.bezierSmoothness=t?.bezierSmoothness??Ot.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,n=!!e[this._renderer.uid],r=e[this._renderer.uid]||this._initContext(t);return(t.dirty||!n)&&(n&&r.reset(),r.isBatchable=!1,t.dirty=!1),r}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=new Es,n=this.getGpuContext(t);return n.graphicsData=e,e.init(),e}_initContext(t){const e=new Us;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};he.extension={type:[U.CanvasSystem],name:"graphicsContext"};he.defaultOptions={bezierSmoothness:.5};let Vs=he;class Oe{constructor(t,e){this.state=qe.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new zt({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){return!1}addRenderable(t,e){this._managedGraphics.add(t),this.renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){t.isRenderable&&this._adaptor.execute(this,t)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}Oe.extension={type:[U.CanvasPipes],name:"graphics"};class Ws{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{tt.return(t)}),this.batches.length=0}}class Je{constructor(t,e){this.state=qe.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new zt({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,n=!!t._gpuData,i=this.renderer.graphicsContext.updateGpuContext(e);return!!(i.isBatchable||n!==i.isBatchable)}addRenderable(t,e){const r=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),r.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const n=this._getGpuDataForRenderable(t).batches;for(let r=0;r<n.length;r++){const i=n[r];i._batcher.updateElement(i)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,n=t.context;if(!e.graphicsContext.getGpuContext(n).batches.length)return;const i=n.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const o=i.resources.localUniforms.uniforms;o.uTransformMatrix=t.groupTransform,o.uRound=e._roundPixels|t._roundPixels,un(t.groupColorAlpha,o.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),r=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),r.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const n=this.renderer.renderPipes.batch,r=this._getGpuDataForRenderable(t).batches;for(let i=0;i<r.length;i++){const o=r[i];n.addToBatch(o,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new Ws;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const n=t.context,i=this.renderer.graphicsContext.getGpuContext(n),o=this.renderer._roundPixels|t._roundPixels;e.batches=i.batches.map(a=>{const h=tt.get(se);return a.copyTo(h),h.renderable=t,h.roundPixels=o,h})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}Je.extension={type:[U.WebGLPipes,U.WebGPUPipes],name:"graphics"};it.add(Oe);it.add(Je);it.add(Vs);it.add(oe);class Jt extends hn{constructor(t){t instanceof xt&&(t={context:t});const{context:e,roundPixels:n,...r}=t||{};super({label:"Graphics",...r}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new xt,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=n??!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||t?.context===!0)&&this._context.destroy(t),this._context?.off("update",this.onViewUpdate,this),this._context?.off("unload",this.unload,this),this._ownedContext=null,this._context=null,super.destroy(t)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=t}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new Jt(this._context.clone()):(this._ownedContext=null,new Jt(this._context))}lineStyle(t,e,n){L(E,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const r={};return t&&(r.width=t),e&&(r.color=e),n&&(r.alpha=n),this.context.strokeStyle=r,this}beginFill(t,e){L(E,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const n={};return t!==void 0&&(n.color=t),e!==void 0&&(n.alpha=e),this.context.fillStyle=n,this}endFill(){L(E,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return(t.width!==xt.defaultStrokeStyle.width||t.color!==xt.defaultStrokeStyle.color||t.alpha!==xt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return L(E,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return L(E,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return L(E,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return L(E,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return L(E,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return L(E,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}export{St as F,Jt as G,Fs as a,jn as b,xt as c,Ae as d,ts as g,Bt as s,yt as t};
