From 20191c945445b98e9b2d0854a1dedac60c9bf661 Mon Sep 17 00:00:00 2001 From: Apcallover <1503963513@qq.com> Date: Fri, 21 Nov 2025 10:41:34 +0800 Subject: [PATCH] flat: pixjs --- index.html | 4 +- package.json | 5 - pages/index/components/AIMatch.vue | 714 +++++++++--------- static/js/pixi.min.js | 1108 ++++++++++++++++++++++++++++ 4 files changed, 1456 insertions(+), 375 deletions(-) delete mode 100644 package.json create mode 100644 static/js/pixi.min.js diff --git a/index.html b/index.html index f5dd3ee..d92cd04 100644 --- a/index.html +++ b/index.html @@ -26,7 +26,9 @@ - + + +
diff --git a/package.json b/package.json deleted file mode 100644 index 0093139..0000000 --- a/package.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "dependencies": { - "pixi.js": "^7.4.3" - } -} diff --git a/pages/index/components/AIMatch.vue b/pages/index/components/AIMatch.vue index d9d3558..74358e5 100644 --- a/pages/index/components/AIMatch.vue +++ b/pages/index/components/AIMatch.vue @@ -1,389 +1,365 @@ -=55296&&J<=56319&&K65535&&(C-=65536,K+=M(C>>>10&1023|55296),C=56320|C&1023),K+=M(C),K}).join("")}function T(P){return P-48<10?P-22:P-65<26?P-65:P-97<26?P-97:h}function R(P,C){return P+22+75*(P<26)-((C!=0)<<5)}function $(P,C,K){var Q=0;for(P=K?E(P/d):P>>1,P+=E(P/C);P>x*u>>1;Q+=h)P=E(P/x);return E(Q+(x+1)*P/(P+c))}function z(P){var C=[],K=P.length,Q,J=0,_t=p,lt=f,vt,bt,Ct,yt,it,ut,dt,se,ie;for(vt=P.lastIndexOf(m),vt<0&&(vt=0),bt=0;bt=128&&w("not-basic"),C.push(P.charCodeAt(bt));for(Ct=vt>0?vt+1:0;Ct =K&&w("invalid-input"),dt=T(P.charCodeAt(Ct++)),(dt>=h||dt>E((o-J)/it))&&w("overflow"),J+=dt*it,se=ut<=lt?l:ut>=lt+u?u:ut-lt,!(dt E(o/ie)&&w("overflow"),it*=ie;Q=C.length+1,lt=$(J-yt,Q,yt==0),E(J/Q)>o-_t&&w("overflow"),_t+=E(J/Q),J%=Q,C.splice(J++,0,_t)}return N(C)}function X(P){var C,K,Q,J,_t,lt,vt,bt,Ct,yt,it,ut=[],dt,se,ie,zs;for(P=Y(P),dt=P.length,C=p,K=0,_t=f,lt=0;lt =C&&it E((o-K)/se)&&w("overflow"),K+=(vt-C)*se,C=vt,lt=0;lt o&&w("overflow"),it==C){for(bt=K,Ct=h;yt=Ct<=_t?l:Ct>=_t+u?u:Ct-_t,!(bt 0&&o>a&&(o=a);for(var h=0;h =0?(c=l.substr(0,u),d=l.substr(u+1)):(c=l,d=""),f=decodeURIComponent(c),p=decodeURIComponent(d),Bu(r,f)?Array.isArray(r[f])?r[f].push(p):r[f]=[r[f],p]:r[f]=p}return r},sg=He(Ca),ds=function(i){switch(typeof i){case"string":return i;case"boolean":return i?"true":"false";case"number":return isFinite(i)?i:"";default:return""}},Pa=function(i,t,e,s){return t=t||"&",e=e||"=",i===null&&(i=void 0),typeof i=="object"?Object.keys(i).map(function(r){var n=encodeURIComponent(ds(r))+e;return Array.isArray(i[r])?i[r].map(function(a){return n+encodeURIComponent(ds(a))}).join(t):n+encodeURIComponent(ds(i[r]))}).join(t):s?encodeURIComponent(ds(s))+e+encodeURIComponent(ds(i)):""},ig=He(Pa),Fu,Nu,rg=cs.decode=Nu=cs.parse=Ca,ng=cs.encode=Fu=cs.stringify=Pa,Lu=Ra,Yt=Ia,Uu=us.parse=fs,ku=us.resolve=Ku,ag=us.resolveObject=Zu,Gu=us.format=qu,og=us.Url=Mt;function Mt(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var $u=/^([a-z0-9.+-]+:)/i,Hu=/:[0-9]*$/,Xu=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Vu=["<",">",'"',"`"," ","\r",` + `," "],ju=["{","}","|","\\","^","`"].concat(Vu),_r=["'"].concat(ju),Ma=["%","/","?",";","#"].concat(_r),Da=["/","?","#"],Wu=255,Oa=/^[+a-z0-9A-Z_-]{0,63}$/,zu=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Yu={javascript:!0,"javascript:":!0},vr={javascript:!0,"javascript:":!0},je={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},yr=cs;function fs(i,t,e){if(i&&Yt.isObject(i)&&i instanceof Mt)return i;var s=new Mt;return s.parse(i,t,e),s}Mt.prototype.parse=function(i,t,e){if(!Yt.isString(i))throw new TypeError("Parameter 'url' must be a string, not "+typeof i);var s=i.indexOf("?"),r=s!==-1&&s 127?E+="x":E+=x[M];if(!E.match(Oa)){var w=b.slice(0,f),F=b.slice(f+1),G=x.match(zu);G&&(w.push(G[1]),F.unshift(G[2])),F.length&&(o="/"+F.join(".")+o),this.hostname=w.join(".");break}}}this.hostname.length>Wu?this.hostname="":this.hostname=this.hostname.toLowerCase(),y||(this.hostname=Lu.toASCII(this.hostname));var Y=this.port?":"+this.port:"",N=this.hostname||"";this.host=N+Y,this.href+=this.host,y&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),o[0]!=="/"&&(o="/"+o))}if(!Yu[u])for(var f=0,v=_r.length;f 0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.host=e.hostname=E.shift())}return e.search=i.search,e.query=i.query,(!Yt.isNull(e.pathname)||!Yt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.href=e.format(),e}if(!b.length)return e.pathname=null,e.search?e.path="/"+e.search:e.path=null,e.href=e.format(),e;for(var M=b.slice(-1)[0],S=(e.host||i.host||b.length>1)&&(M==="."||M==="..")||M==="",w=0,F=b.length;F>=0;F--)M=b[F],M==="."?b.splice(F,1):M===".."?(b.splice(F,1),w++):w&&(b.splice(F,1),w--);if(!g&&!y)for(;w--;w)b.unshift("..");g&&b[0]!==""&&(!b[0]||b[0].charAt(0)!=="/")&&b.unshift(""),S&&b.join("/").substr(-1)!=="/"&&b.push("");var G=b[0]===""||b[0]&&b[0].charAt(0)==="/";if(x){e.hostname=e.host=G?"":b.length?b.shift():"";var E=e.host&&e.host.indexOf("@")>0?e.host.split("@"):!1;E&&(e.auth=E.shift(),e.host=e.hostname=E.shift())}return g=g||e.host&&b.length,g&&!G&&b.unshift(""),b.length?e.pathname=b.join("/"):(e.pathname=null,e.path=null),(!Yt.isNull(e.pathname)||!Yt.isNull(e.search))&&(e.path=(e.pathname?e.pathname:"")+(e.search?e.search:"")),e.auth=i.auth||e.auth,e.slashes=e.slashes||i.slashes,e.href=e.format(),e},Mt.prototype.parseHost=function(){var i=this.host,t=Hu.exec(i);t&&(t=t[0],t!==":"&&(this.port=t.substr(1)),i=i.substr(0,i.length-t.length)),i&&(this.hostname=i)};const Ba={};function Fa(i,t,e=3){if(Ba[t])return;let s=new Error().stack;typeof s=="undefined"?console.warn("PixiJS Deprecation Warning: ",`${t} + Deprecated since v${i}`):(s=s.split(` + `).splice(e).join(` + `),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t} + Deprecated since v${i}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t} + Deprecated since v${i}`),console.warn(s))),Ba[t]=!0}const Qu={get parse(){return Uu},get format(){return Gu},get resolve(){return ku}};function Ht(i){if(typeof i!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(i)}`)}function ps(i){return i.split("?")[0].split("#")[0]}function Ju(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function tc(i,t,e){return i.replace(new RegExp(Ju(t),"g"),e)}function ec(i,t){let e="",s=0,r=-1,n=0,a=-1;for(let o=0;o<=i.length;++o){if(o 2){const h=e.lastIndexOf("/");if(h!==e.length-1){h===-1?(e="",s=0):(e=e.slice(0,h),s=e.length-1-e.lastIndexOf("/")),r=o,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,r=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${i.slice(r+1,o)}`:e=i.slice(r+1,o),s=o-r-1;r=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const ct={toPosix(i){return tc(i,"\\","/")},isUrl(i){return/^https?:/.test(this.toPosix(i))},isDataUrl(i){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(i)},isBlobUrl(i){return i.startsWith("blob:")},hasProtocol(i){return/^[^/:]+:/.test(this.toPosix(i))},getProtocol(i){Ht(i),i=this.toPosix(i);const t=/^file:\/\/\//.exec(i);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(i);return e?e[0]:""},toAbsolute(i,t,e){if(Ht(i),this.isDataUrl(i)||this.isBlobUrl(i))return i;const s=ps(this.toPosix(t!=null?t:O.ADAPTER.getBaseUrl())),r=ps(this.toPosix(e!=null?e:this.rootname(s)));return i=this.toPosix(i),i.startsWith("/")?ct.join(r,i.slice(1)):this.isAbsolute(i)?i:this.join(s,i)},normalize(i){if(Ht(i),i.length===0)return".";if(this.isDataUrl(i)||this.isBlobUrl(i))return i;i=this.toPosix(i);let t="";const e=i.startsWith("/");this.hasProtocol(i)&&(t=this.rootname(i),i=i.slice(t.length));const s=i.endsWith("/");return i=ec(i,!1),i.length>0&&s&&(i+="/"),e?`/${i}`:t+i},isAbsolute(i){return Ht(i),i=this.toPosix(i),this.hasProtocol(i)?!0:i.startsWith("/")},join(...i){var t;if(i.length===0)return".";let e;for(let s=0;s 0)if(e===void 0)e=r;else{const n=(t=i[s-1])!=null?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${r}`:e+=`/${r}`}}return e===void 0?".":this.normalize(e)},dirname(i){if(Ht(i),i.length===0)return".";i=this.toPosix(i);let t=i.charCodeAt(0);const e=t===47;let s=-1,r=!0;const n=this.getProtocol(i),a=i;i=i.slice(n.length);for(let o=i.length-1;o>=1;--o)if(t=i.charCodeAt(o),t===47){if(!r){s=o;break}}else r=!1;return s===-1?e?"/":this.isUrl(a)?n+i:n:e&&s===1?"//":n+i.slice(0,s)},rootname(i){Ht(i),i=this.toPosix(i);let t="";if(i.startsWith("/")?t="/":t=this.getProtocol(i),this.isUrl(i)){const e=i.indexOf("/",t.length);e!==-1?t=i.slice(0,e):t=i,t.endsWith("/")||(t+="/")}return t},basename(i,t){Ht(i),t&&Ht(t),i=ps(this.toPosix(i));let e=0,s=-1,r=!0,n;if(t!==void 0&&t.length>0&&t.length<=i.length){if(t.length===i.length&&t===i)return"";let a=t.length-1,o=-1;for(n=i.length-1;n>=0;--n){const h=i.charCodeAt(n);if(h===47){if(!r){e=n+1;break}}else o===-1&&(r=!1,o=n+1),a>=0&&(h===t.charCodeAt(a)?--a===-1&&(s=n):(a=-1,s=o))}return e===s?s=o:s===-1&&(s=i.length),i.slice(e,s)}for(n=i.length-1;n>=0;--n)if(i.charCodeAt(n)===47){if(!r){e=n+1;break}}else s===-1&&(r=!1,s=n+1);return s===-1?"":i.slice(e,s)},extname(i){Ht(i),i=ps(this.toPosix(i));let t=-1,e=0,s=-1,r=!0,n=0;for(let a=i.length-1;a>=0;--a){const o=i.charCodeAt(a);if(o===47){if(!r){e=a+1;break}continue}s===-1&&(r=!1,s=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":i.slice(t,s)},parse(i){Ht(i);const t={root:"",dir:"",base:"",ext:"",name:""};if(i.length===0)return t;i=ps(this.toPosix(i));let e=i.charCodeAt(0);const s=this.isAbsolute(i);let r;const n="";t.root=this.rootname(i),s||this.hasProtocol(i)?r=1:r=0;let a=-1,o=0,h=-1,l=!0,u=i.length-1,c=0;for(;u>=r;--u){if(e=i.charCodeAt(u),e===47){if(!l){o=u+1;break}continue}h===-1&&(l=!1,h=u+1),e===46?a===-1?a=u:c!==1&&(c=1):a!==-1&&(c=-1)}return a===-1||h===-1||c===0||c===1&&a===h-1&&a===o+1?h!==-1&&(o===0&&s?t.base=t.name=i.slice(1,h):t.base=t.name=i.slice(o,h)):(o===0&&s?(t.name=i.slice(1,a),t.base=i.slice(1,h)):(t.name=i.slice(o,a),t.base=i.slice(o,h)),t.ext=i.slice(a,h)),t.dir=this.dirname(i),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]};let xr;async function Na(){return xr!=null||(xr=(async()=>{var i;const t=document.createElement("canvas").getContext("webgl");if(!t)return Tt.UNPACK;const e=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return Tt.UNPACK;const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(r),t.deleteTexture(s),(i=t.getExtension("WEBGL_lose_context"))==null||i.loseContext(),n[0]<=n[3]?Tt.PMA:Tt.UNPACK})()),xr}function sc(){}function ic(){}let br;function La(){return typeof br=="undefined"&&(br=function(){var i;const t={stencil:!0,failIfMajorPerformanceCaveat:O.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!O.ADAPTER.getWebGLRenderingContext())return!1;const e=O.ADAPTER.createCanvas();let s=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);const r=!!((i=s==null?void 0:s.getContextAttributes())!=null&&i.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,r}catch(e){return!1}}()),br}var rc={grad:.9,turn:360,rad:360/(2*Math.PI)},ae=function(i){return typeof i=="string"?i.length>0:typeof i=="number"},ft=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*i)/e+0},Dt=function(i,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),i>e?e:i>t?i:t},Ua=function(i){return(i=isFinite(i)?i%360:0)>0?i:i+360},ka=function(i){return{r:Dt(i.r,0,255),g:Dt(i.g,0,255),b:Dt(i.b,0,255),a:Dt(i.a)}},Tr=function(i){return{r:ft(i.r),g:ft(i.g),b:ft(i.b),a:ft(i.a,3)}},nc=/^#([0-9a-f]{3,8})$/i,hi=function(i){var t=i.toString(16);return t.length<2?"0"+t:t},Ga=function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=Math.max(t,e,s),a=n-Math.min(t,e,s),o=a?n===t?(e-s)/a:n===e?2+(s-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:r}},$a=function(i){var t=i.h,e=i.s,s=i.v,r=i.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),a=s*(1-e),o=s*(1-(t-n)*e),h=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,o,a,a,h,s][l],g:255*[h,s,s,o,a,a][l],b:255*[a,a,h,s,s,o][l],a:r}},Ha=function(i){return{h:Ua(i.h),s:Dt(i.s,0,100),l:Dt(i.l,0,100),a:Dt(i.a)}},Xa=function(i){return{h:ft(i.h),s:ft(i.s),l:ft(i.l),a:ft(i.a,3)}},Va=function(i){return $a((e=(t=i).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},ms=function(i){return{h:(t=Ga(i)).h,s:(r=(200-(e=t.s))*(s=t.v)/100)>0&&r<200?e*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,e,s,r},ac=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,oc=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,hc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,lc=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Er={string:[[function(i){var t=nc.exec(i);return t?(i=t[1]).length<=4?{r:parseInt(i[0]+i[0],16),g:parseInt(i[1]+i[1],16),b:parseInt(i[2]+i[2],16),a:i.length===4?ft(parseInt(i[3]+i[3],16)/255,2):1}:i.length===6||i.length===8?{r:parseInt(i.substr(0,2),16),g:parseInt(i.substr(2,2),16),b:parseInt(i.substr(4,2),16),a:i.length===8?ft(parseInt(i.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(i){var t=hc.exec(i)||lc.exec(i);return t?t[2]!==t[4]||t[4]!==t[6]?null:ka({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(i){var t=ac.exec(i)||oc.exec(i);if(!t)return null;var e,s,r=Ha({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(rc[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Va(r)},"hsl"]],object:[[function(i){var t=i.r,e=i.g,s=i.b,r=i.a,n=r===void 0?1:r;return ae(t)&&ae(e)&&ae(s)?ka({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(i){var t=i.h,e=i.s,s=i.l,r=i.a,n=r===void 0?1:r;if(!ae(t)||!ae(e)||!ae(s))return null;var a=Ha({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Va(a)},"hsl"],[function(i){var t=i.h,e=i.s,s=i.v,r=i.a,n=r===void 0?1:r;if(!ae(t)||!ae(e)||!ae(s))return null;var a=function(o){return{h:Ua(o.h),s:Dt(o.s,0,100),v:Dt(o.v,0,100),a:Dt(o.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return $a(a)},"hsv"]]},ja=function(i,t){for(var e=0;e =.5},i.prototype.toHex=function(){return t=Tr(this.rgba),e=t.r,s=t.g,r=t.b,a=(n=t.a)<1?hi(ft(255*n)):"","#"+hi(e)+hi(s)+hi(r)+a;var t,e,s,r,n,a},i.prototype.toRgb=function(){return Tr(this.rgba)},i.prototype.toRgbString=function(){return t=Tr(this.rgba),e=t.r,s=t.g,r=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+r+", "+n+")":"rgb("+e+", "+s+", "+r+")";var t,e,s,r,n},i.prototype.toHsl=function(){return Xa(ms(this.rgba))},i.prototype.toHslString=function(){return t=Xa(ms(this.rgba)),e=t.h,s=t.s,r=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+r+"%, "+n+")":"hsl("+e+", "+s+"%, "+r+"%)";var t,e,s,r,n},i.prototype.toHsv=function(){return t=Ga(this.rgba),{h:ft(t.h),s:ft(t.s),v:ft(t.v),a:ft(t.a,3)};var t},i.prototype.invert=function(){return qt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},i.prototype.saturate=function(t){return t===void 0&&(t=.1),qt(Ar(this.rgba,t))},i.prototype.desaturate=function(t){return t===void 0&&(t=.1),qt(Ar(this.rgba,-t))},i.prototype.grayscale=function(){return qt(Ar(this.rgba,-1))},i.prototype.lighten=function(t){return t===void 0&&(t=.1),qt(za(this.rgba,t))},i.prototype.darken=function(t){return t===void 0&&(t=.1),qt(za(this.rgba,-t))},i.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},i.prototype.alpha=function(t){return typeof t=="number"?qt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ft(this.rgba.a,3);var e},i.prototype.hue=function(t){var e=ms(this.rgba);return typeof t=="number"?qt({h:t,s:e.s,l:e.l,a:e.a}):ft(e.h)},i.prototype.isEqual=function(t){return this.toHex()===qt(t).toHex()},i}(),qt=function(i){return i instanceof li?i:new li(i)},Ya=[],uc=function(i){i.forEach(function(t){Ya.indexOf(t)<0&&(t(li,Er),Ya.push(t))})},lg=function(){return new li({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};function cc(i,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in e)s[e[r]]=r;var n={};i.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,h,l=s[this.toHex()];if(l)return l;if(a!=null&&a.closest){var u=this.toRgb(),c=1/0,d="black";if(!n.length)for(var f in e)n[f]=new i(e[f]).toRgb();for(var p in e){var m=(o=u,h=n[p],Math.pow(o.r-h.r,2)+Math.pow(o.g-h.g,2)+Math.pow(o.b-h.b,2));m t in i?dc(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mc=(i,t)=>{for(var e in t||(t={}))fc.call(t,e)&&Ka(i,e,t[e]);if(qa)for(var e of qa(t))pc.call(t,e)&&Ka(i,e,t[e]);return i};uc([cc]);const We=class rr{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof rr)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set PIXI.Color#value to null");(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?mc({},t):t}isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((r,n)=>r===e[n]);if(t!==null&&e!==null){const r=Object.keys(t),n=Object.keys(e);return r.length!==n.length?!1:r.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,s,r]=this._components;return{r:t,g:e,b:s,a:r}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,r]=this._components;return t=t!=null?t:[],t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(r*255),t}toRgbArray(t){t=t!=null?t:[];const[e,s,r]=this._components;return t[0]=e,t[1]=s,t[2]=r,t}toNumber(){return this._int}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,r,n]=rr.temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=r,this._components[3]*=n,this.refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this.refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,r=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,r=r*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(r<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}round(t){const[e,s,r]=this._components;return this._components[0]=Math.round(e*t)/t,this._components[1]=Math.round(s*t)/t,this._components[2]=Math.round(r*t)/t,this.refreshInt(),this._value=null,this}toArray(t){t=t!=null?t:[];const[e,s,r,n]=this._components;return t[0]=e,t[1]=s,t[2]=r,t[3]=n,t}normalize(t){let e,s,r,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,s=(a>>8&255)/255,r=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,r,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,r,n=255]=t,e/=255,s/=255,r/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=rr.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=qt(t);a.isValid()&&({r:e,g:s,b:r,a:n}=a.rgba,e/=255,s/=255,r/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=r,this._components[3]=n,this.refreshInt();else throw new Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((r,n)=>{t[n]=Math.min(Math.max(r,e),s)}),t)}};We.shared=new We,We.temp=new We,We.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let Z=We;function gc(i,t=[]){return Z.shared.setValue(i).toRgbArray(t)}function Za(i){return Z.shared.setValue(i).toHex()}function _c(i){return Z.shared.setValue(i).toNumber()}function Qa(i){return Z.shared.setValue(i).toNumber()}function vc(){const i=[],t=[];for(let s=0;s<32;s++)i[s]=s,t[s]=s;i[H.NORMAL_NPM]=H.NORMAL,i[H.ADD_NPM]=H.ADD,i[H.SCREEN_NPM]=H.SCREEN,t[H.NORMAL]=H.NORMAL_NPM,t[H.ADD]=H.ADD_NPM,t[H.SCREEN]=H.SCREEN_NPM;const e=[];return e.push(t),e.push(i),e}const Sr=vc();function Rr(i,t){return Sr[t?1:0][i]}function yc(i,t,e,s=!0){return Z.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}function xc(i,t){return Z.shared.setValue(i).toPremultiplied(t)}function bc(i,t,e,s=!0){return Z.shared.setValue(i).premultiply(t,s).toArray(e!=null?e:new Float32Array(4))}const Ja=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function to(i,t=null){const e=i*6;if(t=t||new Uint16Array(e),t.length!==e)throw new Error(`Out buffer length is incorrect, got ${t.length} and expected ${e}`);for(let s=0,r=0;s >>1,i|=i>>>2,i|=i>>>4,i|=i>>>8,i|=i>>>16,i+1}function Ir(i){return!(i&i-1)&&!!i}function Cr(i){let t=(i>65535?1:0)<<4;i>>>=t;let e=(i>255?1:0)<<3;return i>>>=e,t|=e,e=(i>15?1:0)<<2,i>>>=e,t|=e,e=(i>3?1:0)<<1,i>>>=e,t|=e,t|i>>1}function Ce(i,t,e){const s=i.length;let r;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(r=t;r t in i?Cc(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,lo=(i,t)=>{for(var e in t||(t={}))Dc.call(t,e)&&ho(i,e,t[e]);if(oo)for(var e of oo(t))Oc.call(t,e)&&ho(i,e,t[e]);return i},Bc=(i,t)=>Pc(i,Mc(t)),I=(i=>(i.Renderer="renderer",i.Application="application",i.RendererSystem="renderer-webgl-system",i.RendererPlugin="renderer-webgl-plugin",i.CanvasRendererSystem="renderer-canvas-system",i.CanvasRendererPlugin="renderer-canvas-plugin",i.Asset="asset",i.LoadParser="load-parser",i.ResolveParser="resolve-parser",i.CacheParser="cache-parser",i.DetectionParser="detection-parser",i))(I||{});const Or=i=>{if(typeof i=="function"||typeof i=="object"&&i.extension){const t=typeof i.extension!="object"?{type:i.extension}:i.extension;i=Bc(lo({},t),{ref:i})}if(typeof i=="object")i=lo({},i);else throw new Error("Invalid extension type");return typeof i.type=="string"&&(i.type=[i.type]),i},uo=(i,t)=>{var e;return(e=Or(i).priority)!=null?e:t},L={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...i){return i.map(Or).forEach(t=>{t.type.forEach(e=>{var s,r;return(r=(s=this._removeHandlers)[e])==null?void 0:r.call(s,t)})}),this},add(...i){return i.map(Or).forEach(t=>{t.type.forEach(e=>{var s,r;const n=this._addHandlers,a=this._queue;n[e]?(r=n[e])==null||r.call(n,t):(a[e]=a[e]||[],(s=a[e])==null||s.push(t))})}),this},handle(i,t,e){var s;const r=this._addHandlers,n=this._removeHandlers;r[i]=t,n[i]=e;const a=this._queue;return a[i]&&((s=a[i])==null||s.forEach(o=>t(o)),delete a[i]),this},handleByMap(i,t){return this.handle(i,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(i,t,e=-1){return this.handle(i,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((r,n)=>uo(n,e)-uo(r,e)))},s=>{const r=t.indexOf(s.ref);r!==-1&&t.splice(r,1)})}};class ci{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get uint16View(){return this._uint16View||(this._uint16View=new Uint16Array(this.rawBinaryData)),this._uint16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}view(t){return this[`${t}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}const Fc=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` + `);function Nc(i){let t="";for(let e=0;e0&&(t+=` + else `),e =0;--s){const r=di[s];if(r.test&&r.test(i,e))return new r(i,t)}throw new Error("Unrecognized source type to auto-detect Resource")}class St{constructor(t){this.items=[],this._name=t,this._aliasCount=0}emit(t,e,s,r,n,a,o,h){if(arguments.length>8)throw new Error("max arguments reached");const{name:l,items:u}=this;this._aliasCount++;for(let c=0,d=u.length;c 0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this}contains(t){return this.items.includes(t)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=""}get empty(){return this.items.length===0}get name(){return this._name}}Object.defineProperties(St.prototype,{dispatch:{value:St.prototype.emit},run:{value:St.prototype.emit}});class ze{constructor(t=0,e=0){this._width=t,this._height=e,this.destroyed=!1,this.internal=!1,this.onResize=new St("setRealSize"),this.onUpdate=new St("update"),this.onError=new St("onError")}bind(t){this.onResize.add(t),this.onUpdate.add(t),this.onError.add(t),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(t){this.onResize.remove(t),this.onUpdate.remove(t),this.onError.remove(t)}resize(t,e){(t!==this._width||e!==this._height)&&(this._width=t,this._height=e,this.onResize.emit(t,e))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(t,e,s){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(t,e){return!1}}class _s extends ze{constructor(t,e){var s;const{width:r,height:n}=e||{};if(!r||!n)throw new Error("BufferResource width or height invalid");super(r,n),this.data=t,this.unpackAlignment=(s=e.unpackAlignment)!=null?s:4}upload(t,e,s){const r=t.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e.alphaMode===Tt.UNPACK);const n=e.realWidth,a=e.realHeight;return s.width===n&&s.height===a?r.texSubImage2D(e.target,0,0,0,n,a,e.format,s.type,this.data):(s.width=n,s.height=a,r.texImage2D(e.target,0,s.internalFormat,n,a,0,e.format,s.type,this.data)),!0}dispose(){this.data=null}static test(t){return t===null||t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}var Lc=Object.defineProperty,fo=Object.getOwnPropertySymbols,Uc=Object.prototype.hasOwnProperty,kc=Object.prototype.propertyIsEnumerable,po=(i,t,e)=>t in i?Lc(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Gc=(i,t)=>{for(var e in t||(t={}))Uc.call(t,e)&&po(i,e,t[e]);if(fo)for(var e of fo(t))kc.call(t,e)&&po(i,e,t[e]);return i};const $c={scaleMode:Wt.NEAREST,alphaMode:Tt.NPM},$r=class is extends Xe{constructor(t=null,e=null){super(),e=Object.assign({},is.defaultOptions,e);const{alphaMode:s,mipmap:r,anisotropicLevel:n,scaleMode:a,width:o,height:h,wrapMode:l,format:u,type:c,target:d,resolution:f,resourceOptions:p}=e;t&&!(t instanceof ze)&&(t=Gr(t,p),t.internal=!0),this.resolution=f||O.RESOLUTION,this.width=Math.round((o||0)*this.resolution)/this.resolution,this.height=Math.round((h||0)*this.resolution)/this.resolution,this._mipmap=r,this.anisotropicLevel=n,this._wrapMode=l,this._scaleMode=a,this.format=u,this.type=c,this.target=d,this.alphaMode=s,this.uid=ve(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=o>0&&h>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)}setStyle(t,e){let s;return t!==void 0&&t!==this.scaleMode&&(this.scaleMode=t,s=!0),e!==void 0&&e!==this.mipmap&&(this.mipmap=e,s=!0),s&&this.dirtyStyleId++,this}setSize(t,e,s){return s=s||this.resolution,this.setRealSize(t*s,e*s,s)}setRealSize(t,e,s){return this.resolution=s||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=Ir(this.realWidth)&&Ir(this.realHeight)}setResolution(t){const e=this.resolution;return e===t?this:(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT(),this)}setResource(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this}update(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))}onError(t){this.emit("error",this,t)}destroy(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete wt[this.cacheId],delete Et[this.cacheId],this.cacheId=null),this.valid=!1,this.dispose(),is.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}dispose(){this.emit("dispose",this)}castToBaseTexture(){return this}static from(t,e,s=O.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${ve()}`}n=t._pixiId}let a=wt[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in BaseTextureCache.`);return a||(a=new is(t,e),a.cacheId=n,is.addToCache(a,n)),a}static fromBuffer(t,e,s,r){t=t||new Float32Array(e*s*4);const n=new _s(t,Gc({width:e,height:s},r==null?void 0:r.resourceOptions));let a,o;return t instanceof Float32Array?(a=A.RGBA,o=k.FLOAT):t instanceof Int32Array?(a=A.RGBA_INTEGER,o=k.INT):t instanceof Uint32Array?(a=A.RGBA_INTEGER,o=k.UNSIGNED_INT):t instanceof Int16Array?(a=A.RGBA_INTEGER,o=k.SHORT):t instanceof Uint16Array?(a=A.RGBA_INTEGER,o=k.UNSIGNED_SHORT):t instanceof Int8Array?(a=A.RGBA,o=k.BYTE):(a=A.RGBA,o=k.UNSIGNED_BYTE),n.internal=!0,new is(n,Object.assign({},$c,{type:o,format:a},r))}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),wt[e]&&wt[e]!==t&&console.warn(`BaseTexture added to the cache with an id [${e}] that already had an entry`),wt[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=wt[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete wt[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e 1){for(let c=0;c (i[i.POLY=0]="POLY",i[i.RECT=1]="RECT",i[i.CIRC=2]="CIRC",i[i.ELIP=3]="ELIP",i[i.RREC=4]="RREC",i))(pt||{});class q{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new q(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}}const pi=[new q,new q,new q,new q];class j{constructor(t=0,e=0,s=0,r=0){this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(r),this.type=pt.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new j(0,0,0,0)}clone(){return new j(this.x,this.y,this.width,this.height)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t =this.y&&e t.right?t.right:this.right)<=w)return!1;const F=this.y t.bottom?t.bottom:this.bottom)>F}const s=this.left,r=this.right,n=this.top,a=this.bottom;if(r<=s||a<=n)return!1;const o=pi[0].set(t.left,t.top),h=pi[1].set(t.left,t.bottom),l=pi[2].set(t.right,t.top),u=pi[3].set(t.right,t.bottom);if(l.x<=o.x||h.y<=o.y)return!1;const c=Math.sign(e.a*e.d-e.b*e.c);if(c===0||(e.apply(o,o),e.apply(h,h),e.apply(l,l),e.apply(u,u),Math.max(o.x,h.x,l.x,u.x)<=s||Math.min(o.x,h.x,l.x,u.x)>=r||Math.max(o.y,h.y,l.y,u.y)<=n||Math.min(o.y,h.y,l.y,u.y)>=a))return!1;const d=c*(h.y-o.y),f=c*(o.x-h.x),p=d*s+f*n,m=d*r+f*n,g=d*s+f*a,y=d*r+f*a;if(Math.max(p,m,g,y)<=d*o.x+f*o.y||Math.min(p,m,g,y)>=d*u.x+f*u.y)return!1;const b=c*(o.y-l.y),v=c*(l.x-o.x),x=b*s+v*n,E=b*r+v*n,M=b*s+v*a,S=b*r+v*a;return!(Math.max(x,E,M,S)<=b*o.x+v*o.y||Math.min(x,E,M,S)>=b*u.x+v*u.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),r=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=r,this.height=Math.max(n-r,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,r=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=r-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),r=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=r,this.height=n-r,this}}class mi{constructor(t=0,e=0,s=0){this.x=t,this.y=e,this.radius=s,this.type=pt.CIRC}clone(){return new mi(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let r=this.x-t,n=this.y-e;return r*=r,n*=n,r+n<=s}getBounds(){return new j(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}}class gi{constructor(t=0,e=0,s=0,r=0){this.x=t,this.y=e,this.width=s,this.height=r,this.type=pt.ELIP}clone(){return new gi(this.x,this.y,this.width,this.height)}contains(t,e){if(this.width<=0||this.height<=0)return!1;let s=(t-this.x)/this.width,r=(e-this.y)/this.height;return s*=s,r*=r,s+r<=1}getBounds(){return new j(this.x-this.width,this.y-this.height,this.width,this.height)}}class Pe{constructor(...t){let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let r=0,n=e.length;r e!=u>e&&t<(l-o)*((e-h)/(u-h))+o&&(s=!s)}return s}}class _i{constructor(t=0,e=0,s=0,r=0,n=20){this.x=t,this.y=e,this.width=s,this.height=r,this.radius=n,this.type=pt.RREC}clone(){return new _i(this.x,this.y,this.width,this.height,this.radius)}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 s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let r=t-(this.x+s),n=e-(this.y+s);const a=s*s;if(r*r+n*n<=a||(r=t-(this.x+this.width-s),r*r+n*n<=a)||(n=e-(this.y+this.height-s),r*r+n*n<=a)||(r=t-(this.x+s),r*r+n*n<=a))return!0}return!1}}class tt{constructor(t=1,e=0,s=0,r=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,r,n,a){return this.a=t,this.b=e,this.c=s,this.d=r,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new q;const s=t.x,r=t.y;return e.x=this.a*s+this.c*r+this.tx,e.y=this.b*s+this.d*r+this.ty,e}applyInverse(t,e){e=e||new q;const s=1/(this.a*this.d+this.c*-this.b),r=t.x,n=t.y;return e.x=this.d*s*r+-this.c*s*n+(this.ty*this.c-this.tx*this.d)*s,e.y=this.a*s*n+-this.b*s*r+(-this.ty*this.a+this.tx*this.b)*s,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),r=this.a,n=this.c,a=this.tx;return this.a=r*e-this.b*s,this.b=r*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=a*e-this.ty*s,this.ty=a*s+this.ty*e,this}append(t){const e=this.a,s=this.b,r=this.c,n=this.d;return this.a=t.a*e+t.b*r,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*r,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*r+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}setTransform(t,e,s,r,n,a,o,h,l){return this.a=Math.cos(o+l)*n,this.b=Math.sin(o+l)*n,this.c=-Math.sin(o-h)*a,this.d=Math.cos(o-h)*a,this.tx=t-(s*this.a+r*this.c),this.ty=e-(s*this.b+r*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,r=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=r*t.a+this.d*t.c,this.d=r*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,r=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-r,n),h=Math.atan2(s,e),l=Math.abs(o+h);return l<1e-5||Math.abs(ys-l)<1e-5?(t.rotation=h,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=h),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(r*r+n*n),t.position.x=this.tx+(a.x*e+a.y*r),t.position.y=this.ty+(a.x*s+a.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,r=this.d,n=this.tx,a=t*r-e*s;return this.a=r/a,this.b=-e/a,this.c=-s/a,this.d=t/a,this.tx=(s*this.ty-r*n)/a,this.ty=-(t*this.ty-e*n)/a,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new tt;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}static get IDENTITY(){return new tt}static get TEMP_MATRIX(){return new tt}}const Me=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],De=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Oe=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Be=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Xr=[],vo=[],vi=Math.sign;function zc(){for(let i=0;i<16;i++){const t=[];Xr.push(t);for(let e=0;e<16;e++){const s=vi(Me[i]*Me[e]+Oe[i]*De[e]),r=vi(De[i]*Me[e]+Be[i]*De[e]),n=vi(Me[i]*Oe[e]+Oe[i]*Be[e]),a=vi(De[i]*Oe[e]+Be[i]*Be[e]);for(let o=0;o<16;o++)if(Me[o]===s&&De[o]===r&&Oe[o]===n&&Be[o]===a){t.push(o);break}}}for(let i=0;i<16;i++){const t=new tt;t.set(Me[i],De[i],Oe[i],Be[i],0,0),vo.push(t)}}zc();const et={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:i=>Me[i],uY:i=>De[i],vX:i=>Oe[i],vY:i=>Be[i],inv:i=>i&8?i&15:-i&7,add:(i,t)=>Xr[i][t],sub:(i,t)=>Xr[i][et.inv(t)],rotate180:i=>i^4,isVertical:i=>(i&3)===2,byDirection:(i,t)=>Math.abs(i)*2<=Math.abs(t)?t>=0?et.S:et.N:Math.abs(t)*2<=Math.abs(i)?i>0?et.E:et.W:t>0?i>0?et.SE:et.SW:i>0?et.NE:et.NW,matrixAppendRotationInv:(i,t,e=0,s=0)=>{const r=vo[et.inv(t)];r.tx=e,r.ty=s,i.append(r)}};class le{constructor(t,e,s=0,r=0){this._x=s,this._y=r,this.cb=t,this.scope=e}clone(t=this.cb,e=this.scope){return new le(t,e,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this.cb.call(this.scope)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))}}const Vr=class{constructor(){this.worldTransform=new tt,this.localTransform=new tt,this.position=new le(this.onChange,this,0,0),this.scale=new le(this.onChange,this,1,1),this.pivot=new le(this.onChange,this,0,0),this.skew=new le(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}onChange(){this._localID++}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++}updateLocalTransform(){const t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)}updateTransform(t){const e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){const s=t.worldTransform,r=this.worldTransform;r.a=e.a*s.a+e.b*s.c,r.b=e.a*s.b+e.b*s.d,r.c=e.c*s.a+e.d*s.c,r.d=e.c*s.b+e.d*s.d,r.tx=e.tx*s.a+e.ty*s.c+s.tx,r.ty=e.tx*s.b+e.ty*s.d+s.ty,this._parentID=t._worldID,this._worldID++}}setFromMatrix(t){t.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())}};Vr.IDENTITY=new Vr;let yi=Vr;var Yc=`varying vec2 vTextureCoord; + + uniform sampler2D uSampler; + + void main(void){ + gl_FragColor *= texture2D(uSampler, vTextureCoord); + }`,qc=`attribute vec2 aVertexPosition; + attribute vec2 aTextureCoord; + + uniform mat3 projectionMatrix; + + varying vec2 vTextureCoord; + + void main(void){ + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; + } + `;function yo(i,t,e){const s=i.createShader(t);return i.shaderSource(s,e),i.compileShader(s),s}function jr(i){const t=new Array(i);for(let e=0;e i.type==="float"&&i.size===1&&!i.isArray,code:i=>` + if(uv["${i}"] !== ud["${i}"].value) + { + ud["${i}"].value = uv["${i}"] + gl.uniform1f(ud["${i}"].location, uv["${i}"]) + } + `},{test:(i,t)=>(i.type==="sampler2D"||i.type==="samplerCube"||i.type==="sampler2DArray")&&i.size===1&&!i.isArray&&(t==null||t.castToBaseTexture!==void 0),code:i=>`t = syncData.textureCount++; + + renderer.texture.bind(uv["${i}"], t); + + if(ud["${i}"].value !== t) + { + ud["${i}"].value = t; + gl.uniform1i(ud["${i}"].location, t); + ; // eslint-disable-line max-len + }`},{test:(i,t)=>i.type==="mat3"&&i.size===1&&!i.isArray&&t.a!==void 0,code:i=>` + gl.uniformMatrix3fv(ud["${i}"].location, false, uv["${i}"].toArray(true)); + `,codeUbo:i=>` + var ${i}_matrix = uv.${i}.toArray(true); + + data[offset] = ${i}_matrix[0]; + data[offset+1] = ${i}_matrix[1]; + data[offset+2] = ${i}_matrix[2]; + + data[offset + 4] = ${i}_matrix[3]; + data[offset + 5] = ${i}_matrix[4]; + data[offset + 6] = ${i}_matrix[5]; + + data[offset + 8] = ${i}_matrix[6]; + data[offset + 9] = ${i}_matrix[7]; + data[offset + 10] = ${i}_matrix[8]; + `},{test:(i,t)=>i.type==="vec2"&&i.size===1&&!i.isArray&&t.x!==void 0,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v.x || cv[1] !== v.y) + { + cv[0] = v.x; + cv[1] = v.y; + gl.uniform2f(ud["${i}"].location, v.x, v.y); + }`,codeUbo:i=>` + v = uv.${i}; + + data[offset] = v.x; + data[offset+1] = v.y; + `},{test:i=>i.type==="vec2"&&i.size===1&&!i.isArray,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2f(ud["${i}"].location, v[0], v[1]); + } + `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.width!==void 0,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) + { + cv[0] = v.x; + cv[1] = v.y; + cv[2] = v.width; + cv[3] = v.height; + gl.uniform4f(ud["${i}"].location, v.x, v.y, v.width, v.height) + }`,codeUbo:i=>` + v = uv.${i}; + + data[offset] = v.x; + data[offset+1] = v.y; + data[offset+2] = v.width; + data[offset+3] = v.height; + `},{test:(i,t)=>i.type==="vec4"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) + { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + cv[3] = v.alpha; + gl.uniform4f(ud["${i}"].location, v.red, v.green, v.blue, v.alpha) + }`,codeUbo:i=>` + v = uv.${i}; + + data[offset] = v.red; + data[offset+1] = v.green; + data[offset+2] = v.blue; + data[offset+3] = v.alpha; + `},{test:(i,t)=>i.type==="vec3"&&i.size===1&&!i.isArray&&t.red!==void 0,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a) + { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + + gl.uniform3f(ud["${i}"].location, v.red, v.green, v.blue) + }`,codeUbo:i=>` + v = uv.${i}; + + data[offset] = v.red; + data[offset+1] = v.green; + data[offset+2] = v.blue; + `},{test:i=>i.type==="vec4"&&i.size===1&&!i.isArray,code:i=>` + cv = ud["${i}"].value; + v = uv["${i}"]; + + if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4f(ud["${i}"].location, v[0], v[1], v[2], v[3]) + }`}],Kc={float:` + if (cv !== v) + { + cu.value = v; + gl.uniform1f(location, v); + }`,vec2:` + if (cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2f(location, v[0], v[1]) + }`,vec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3f(location, v[0], v[1], v[2]) + }`,vec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4f(location, v[0], v[1], v[2], v[3]); + }`,int:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`,ivec2:` + if (cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2i(location, v[0], v[1]); + }`,ivec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3i(location, v[0], v[1], v[2]); + }`,ivec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,uint:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1ui(location, v); + }`,uvec2:` + if (cv[0] !== v[0] || cv[1] !== v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2ui(location, v[0], v[1]); + }`,uvec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3ui(location, v[0], v[1], v[2]); + }`,uvec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4ui(location, v[0], v[1], v[2], v[3]); + }`,bool:` + if (cv !== v) + { + cu.value = v; + gl.uniform1i(location, v); + }`,bvec2:` + if (cv[0] != v[0] || cv[1] != v[1]) + { + cv[0] = v[0]; + cv[1] = v[1]; + + gl.uniform2i(location, v[0], v[1]); + }`,bvec3:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + + gl.uniform3i(location, v[0], v[1], v[2]); + }`,bvec4:` + if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) + { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,mat2:"gl.uniformMatrix2fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",sampler2D:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`,samplerCube:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`,sampler2DArray:` + if (cv !== v) + { + cu.value = v; + + gl.uniform1i(location, v); + }`},Zc={float:"gl.uniform1fv(location, v)",vec2:"gl.uniform2fv(location, v)",vec3:"gl.uniform3fv(location, v)",vec4:"gl.uniform4fv(location, v)",mat4:"gl.uniformMatrix4fv(location, false, v)",mat3:"gl.uniformMatrix3fv(location, false, v)",mat2:"gl.uniformMatrix2fv(location, false, v)",int:"gl.uniform1iv(location, v)",ivec2:"gl.uniform2iv(location, v)",ivec3:"gl.uniform3iv(location, v)",ivec4:"gl.uniform4iv(location, v)",uint:"gl.uniform1uiv(location, v)",uvec2:"gl.uniform2uiv(location, v)",uvec3:"gl.uniform3uiv(location, v)",uvec4:"gl.uniform4uiv(location, v)",bool:"gl.uniform1iv(location, v)",bvec2:"gl.uniform2iv(location, v)",bvec3:"gl.uniform3iv(location, v)",bvec4:"gl.uniform4iv(location, v)",sampler2D:"gl.uniform1iv(location, v)",samplerCube:"gl.uniform1iv(location, v)",sampler2DArray:"gl.uniform1iv(location, v)"};function Qc(i,t){var e;const s=[` + var v = null; + var cv = null; + var cu = null; + var t = 0; + var gl = renderer.gl; + `];for(const r in i.uniforms){const n=t[r];if(!n){((e=i.uniforms[r])==null?void 0:e.group)===!0&&(i.uniforms[r].ubo?s.push(` + renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}'); + `):s.push(` + renderer.shader.syncUniformGroup(uv.${r}, syncData); + `));continue}const a=i.uniforms[r];let o=!1;for(let h=0;h =_e.WEBGL2&&(t=i.getContext("webgl2",{})),t||(t=i.getContext("webgl",{})||i.getContext("experimental-webgl",{}),t?t.getExtension("WEBGL_draw_buffers"):t=null),xs=t}return xs}let xi;function Jc(){if(!xi){xi=At.MEDIUM;const i=To();if(i&&i.getShaderPrecisionFormat){const t=i.getShaderPrecisionFormat(i.FRAGMENT_SHADER,i.HIGH_FLOAT);t&&(xi=t.precision?At.HIGH:At.MEDIUM)}}return xi}function Eo(i,t){const e=i.getShaderSource(t).split(` + `).map((l,u)=>`${u}: ${l}`),s=i.getShaderInfoLog(t),r=s.split(` + `),n={},a=r.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),o=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const h=e.join(` + `);o[0]=h,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function td(i,t,e,s){i.getProgramParameter(t,i.LINK_STATUS)||(i.getShaderParameter(e,i.COMPILE_STATUS)||Eo(i,e),i.getShaderParameter(s,i.COMPILE_STATUS)||Eo(i,s),console.error("PixiJS Error: Could not initialize shader."),i.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",i.getProgramInfoLog(t)))}const ed={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function Ao(i){return ed[i]}let bi=null;const wo={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function So(i,t){if(!bi){const e=Object.keys(wo);bi={};for(let s=0;s 0&&(e+=` + else `),s this.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)}buildTexturesAndDrawCalls(){const{_bufferedTextures:t,maxTextures:e}=this,s=jt._textureArrayPool,r=this.renderer.batch,n=this._tempBoundTextures,a=this.renderer.textureGC.count;let o=++V._globalBatch,h=0,l=s[0],u=0;r.copyBoundTextures(n,e);for(let c=0;c =e&&(r.boundArray(l,n,o,e),this.buildDrawCalls(l,u,c),u=c,l=s[++h],++o),d._batchEnabled=o,d.touched=a,l.elements[l.count++]=d)}l.count>0&&(r.boundArray(l,n,o,e),this.buildDrawCalls(l,u,this._bufferSize),++h,++o);for(let c=0;c 0);for(let m=0;m =0;--r)t[r]=s[r]||null,t[r]&&(t[r]._batchLocation=r)}boundArray(t,e,s,r){const{elements:n,ids:a,count:o}=t;let h=0;for(let l=0;l =0&&c =_e.WEBGL2&&(s=t.getContext("webgl2",e)),s)this.webGLVersion=2;else if(this.webGLVersion=1,s=t.getContext("webgl",e)||t.getContext("experimental-webgl",e),!s)throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=s,this.getExtensions(),this.gl}getExtensions(){const{gl:t}=this,e={loseContext:t.getExtension("WEBGL_lose_context"),anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc")};this.webGLVersion===1?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):this.webGLVersion===2&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})}handleContextLost(t){t.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){const t=this.renderer.view;this.renderer=null,t.removeEventListener!==void 0&&(t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(t){const e=t.getContextAttributes(),s="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;s&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");const r=s||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=r,r||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")}}ws.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:"default"},ws.extension={type:I.RendererSystem,name:"context"},L.add(ws);class Ai{constructor(t,e){if(this.width=Math.round(t),this.height=Math.round(e),!this.width||!this.height)throw new Error("Framebuffer width or height is zero");this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new St("disposeFramebuffer"),this.multisample=at.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(t=0,e){return this.colorTextures[t]=e||new V(null,{scaleMode:Wt.NEAREST,resolution:1,mipmap:Ut.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(t){return this.depthTexture=t||new V(null,{scaleMode:Wt.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:Ut.OFF,format:A.DEPTH_COMPONENT,type:k.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(t,e){if(t=Math.round(t),e=Math.round(e),!t||!e)throw new Error("Framebuffer width and height must not be zero");if(!(t===this.width&&e===this.height)){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(let s=0;s {const r=this.source;this.url=r.src;const n=()=>{this.destroyed||(r.onload=null,r.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};r.complete&&r.src?n():(r.onload=n,r.onerror=a=>{s(a),this.onError.emit(a)})}),this._load)}process(){const t=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);const e=globalThis.createImageBitmap,s=!t.crossOrigin||t.crossOrigin==="anonymous";return this._process=fetch(t.src,{mode:s?"cors":"no-cors"}).then(r=>r.blob()).then(r=>e(r,0,0,t.width,t.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Tt.UNPACK?"premultiply":"none"})).then(r=>this.destroyed?Promise.reject():(this.bitmap=r,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(t,e,s){if(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(t,e,s);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(t,e,s,this.bitmap),!this.preserveBitmap){let r=!0;const n=e._glTextures;for(const a in n){const o=n[a];if(o!==s&&o.dirtyId!==e.dirtyId){r=!1;break}}r&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&(this.bitmap.close(),this.bitmap=null),this._process=null,this._load=null}static test(t){return typeof HTMLImageElement!="undefined"&&(typeof t=="string"||t instanceof HTMLImageElement)}}class Zr{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const r=e.width,n=e.height;if(s){const a=t.width/2/r,o=t.height/2/n,h=t.x/r+a,l=t.y/n+o;s=et.add(s,et.NW),this.x0=h+a*et.uX(s),this.y0=l+o*et.uY(s),s=et.add(s,2),this.x1=h+a*et.uX(s),this.y1=l+o*et.uY(s),s=et.add(s,2),this.x2=h+a*et.uX(s),this.y2=l+o*et.uY(s),s=et.add(s,2),this.x3=h+a*et.uX(s),this.y3=l+o*et.uY(s)}else this.x0=t.x/r,this.y0=t.y/n,this.x1=(t.x+t.width)/r,this.y1=t.y/n,this.x2=(t.x+t.width)/r,this.y2=(t.y+t.height)/n,this.x3=t.x/r,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}const Mo=new Zr;function wi(i){i.destroy=function(){},i.on=function(){},i.once=function(){},i.emit=function(){}}class B extends Xe{constructor(t,e,s,r,n,a,o){if(super(),this.noFrame=!1,e||(this.noFrame=!0,e=new j(0,0,1,1)),t instanceof B&&(t=t.baseTexture),this.baseTexture=t,this._frame=e,this.trim=r,this.valid=!1,this.destroyed=!1,this._uvs=Mo,this.uvMatrix=null,this.orig=s||e,this._rotate=Number(n||0),n===!0)this._rotate=2;else if(this._rotate%2!==0)throw new Error("attempt to use diamond-shaped UVs. If you are sure, set rotation manually");this.defaultAnchor=a?new q(a.x,a.y):new q(0,0),this.defaultBorders=o,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=e:t.once("loaded",this.onBaseTextureUpdated,this),this.noFrame&&t.on("update",this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(t){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=t.width,this._frame.height=t.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit("update",this)}destroy(t){if(this.baseTexture){if(t){const{resource:e}=this.baseTexture;e!=null&&e.url&&Et[e.url]&&B.removeFromCache(e.url),this.baseTexture.destroy()}this.baseTexture.off("loaded",this.onBaseTextureUpdated,this),this.baseTexture.off("update",this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,B.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit("destroyed",this),this.removeAllListeners()}clone(){var t;const e=this._frame.clone(),s=this._frame===this.orig?e:this.orig.clone(),r=new B(this.baseTexture,!this.noFrame&&e,s,(t=this.trim)==null?void 0:t.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=e),r}updateUvs(){this._uvs===Mo&&(this._uvs=new Zr),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,e={},s=O.STRICT_TEXTURE_CACHE){const r=typeof t=="string";let n=null;if(r)n=t;else if(t instanceof V){if(!t.cacheId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t.cacheId=`${o}-${ve()}`,V.addToCache(t,t.cacheId)}n=t.cacheId}else{if(!t._pixiId){const o=(e==null?void 0:e.pixiIdPrefix)||"pixiid";t._pixiId=`${o}_${ve()}`}n=t._pixiId}let a=Et[n];if(r&&s&&!a)throw new Error(`The cacheId "${n}" does not exist in TextureCache.`);return!a&&!(t instanceof V)?(e.resolution||(e.resolution=Kt(t)),a=new B(new V(t,e)),a.baseTexture.cacheId=n,V.addToCache(a.baseTexture,n),B.addToCache(a,n)):!a&&t instanceof V&&(a=new B(t),B.addToCache(a,n)),a}static fromURL(t,e){const s=Object.assign({autoLoad:!1},e==null?void 0:e.resourceOptions),r=B.from(t,Object.assign({resourceOptions:s},e),!1),n=r.baseTexture.resource;return r.baseTexture.valid?Promise.resolve(r):n.load().then(()=>Promise.resolve(r))}static fromBuffer(t,e,s,r){return new B(V.fromBuffer(t,e,s,r))}static fromLoader(t,e,s,r){const n=new V(t,Object.assign({scaleMode:V.defaultOptions.scaleMode,resolution:Kt(e)},r)),{resource:a}=n;a instanceof Kr&&(a.url=e);const o=new B(n);return s||(s=e),V.addToCache(o.baseTexture,s),B.addToCache(o,s),s!==e&&(V.addToCache(o.baseTexture,e),B.addToCache(o,e)),o.baseTexture.valid?Promise.resolve(o):new Promise(h=>{o.baseTexture.once("loaded",()=>h(o))})}static addToCache(t,e){e&&(t.textureCacheIds.includes(e)||t.textureCacheIds.push(e),Et[e]&&Et[e]!==t&&console.warn(`Texture added to the cache with an id [${e}] that already had an entry`),Et[e]=t)}static removeFromCache(t){if(typeof t=="string"){const e=Et[t];if(e){const s=e.textureCacheIds.indexOf(t);return s>-1&&e.textureCacheIds.splice(s,1),delete Et[t],e}}else if(t!=null&&t.textureCacheIds){for(let e=0;e this.baseTexture.width,o=s+n>this.baseTexture.height;if(a||o){const h=a&&o?"and":"or",l=`X: ${e} + ${r} = ${e+r} > ${this.baseTexture.width}`,u=`Y: ${s} + ${n} = ${s+n} > ${this.baseTexture.height}`;throw new Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${l} ${h} ${u}`)}this.valid=r&&n&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=t),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(t){this._rotate=t,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return B._EMPTY||(B._EMPTY=new B(new V),wi(B._EMPTY),wi(B._EMPTY.baseTexture)),B._EMPTY}static get WHITE(){if(!B._WHITE){const t=O.ADAPTER.createCanvas(16,16),e=t.getContext("2d");t.width=16,t.height=16,e.fillStyle="white",e.fillRect(0,0,16,16),B._WHITE=new B(V.from(t)),wi(B._WHITE),wi(B._WHITE.baseTexture)}return B._WHITE}}class xe extends B{constructor(t,e){super(t,e),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(t){this.framebuffer.multisample=t}resize(t,e,s=!0){const r=this.baseTexture.resolution,n=Math.round(t*r)/r,a=Math.round(e*r)/r;this.valid=n>0&&a>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=a,s&&this.baseTexture.resize(n,a),this.updateUvs()}setResolution(t){const{baseTexture:e}=this;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))}static create(t){return new xe(new qr(t))}}class Qr{constructor(t){this.texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(t,e,s=at.NONE){const r=new qr(Object.assign({width:t,height:e,resolution:1,multisample:s},this.textureOptions));return new xe(r)}getOptimalTexture(t,e,s=1,r=at.NONE){let n;t=Math.max(Math.ceil(t*s-1e-6),1),e=Math.max(Math.ceil(e*s-1e-6),1),!this.enableFullScreen||t!==this._pixelsWidth||e!==this._pixelsHeight?(t=gs(t),e=gs(e),n=((t&65535)<<16|e&65535)>>>0,r>1&&(n+=r*4294967296)):n=r>1?-r:-1,this.texturePool[n]||(this.texturePool[n]=[]);let a=this.texturePool[n].pop();return a||(a=this.createTexture(t,e,r)),a.filterPoolKey=n,a.setResolution(s),a}getFilterTexture(t,e,s){const r=this.getOptimalTexture(t.width,t.height,e||t.resolution,s||at.NONE);return r.filterFrame=t.filterFrame,r}returnTexture(t){const e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)}returnFilterTexture(t){this.returnTexture(t)}clear(t){if(t=t!==!1,t)for(const e in this.texturePool){const s=this.texturePool[e];if(s)for(let r=0;r 0&&t.height>0;for(const e in this.texturePool){if(!(Number(e)<0))continue;const s=this.texturePool[e];if(s)for(let r=0;r 1&&(u=this.getOptimalFilterTexture(l.width,l.height,e.resolution),u.filterFrame=l.filterFrame),s[c].apply(this,l,u,kt.CLEAR,e);const d=l;l=u,u=d}s[c].apply(this,l,h.renderTexture,kt.BLEND,e),c>1&&e.multisample>1&&this.returnFilterTexture(e.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(u)}e.clear(),this.statePool.push(e)}bindAndClear(t,e=kt.CLEAR){const{renderTexture:s,state:r}=this.renderer;if(t===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,t!=null&&t.filterFrame){const a=this.tempRect;a.x=0,a.y=0,a.width=t.filterFrame.width,a.height=t.filterFrame.height,s.bind(t,t.filterFrame,a)}else t!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?s.bind(t):this.renderer.renderTexture.bind(t,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);const n=r.stateId&1||this.forceClear;(e===kt.CLEAR||e===kt.BLIT&&n)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(t,e,s,r){const n=this.renderer;n.state.set(t.state),this.bindAndClear(s,r),t.uniforms.uSampler=e,t.uniforms.filterGlobals=this.globalUniforms,n.shader.bind(t),t.legacy=!!t.program.attributeData.aTextureCoord,t.legacy?(this.quadUv.map(e._frame,e.filterFrame),n.geometry.bind(this.quadUv),n.geometry.draw(Lt.TRIANGLES)):(n.geometry.bind(this.quad),n.geometry.draw(Lt.TRIANGLE_STRIP))}calculateSpriteMatrix(t,e){const{sourceFrame:s,destinationFrame:r}=this.activeState,{orig:n}=e._texture,a=t.set(r.width,0,0,r.height,s.x,s.y),o=e.worldTransform.copyTo(tt.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/n.width,1/n.height),a.translate(e.anchor.x,e.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(t,e,s=1,r=at.NONE){return this.texturePool.getOptimalTexture(t,e,s,r)}getFilterTexture(t,e,s){if(typeof t=="number"){const n=t;t=e,e=n}t=t||this.activeState.renderTexture;const r=this.texturePool.getOptimalTexture(t.width,t.height,e||t.resolution,s||at.NONE);return r.filterFrame=t.filterFrame,r}returnFilterTexture(t){this.texturePool.returnTexture(t)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(t,e){const s=Si[0],r=Si[1],n=Si[2],a=Si[3];s.set(e.left,e.top),r.set(e.left,e.bottom),n.set(e.right,e.top),a.set(e.right,e.bottom),t.apply(s,s),t.apply(r,r),t.apply(n,n),t.apply(a,a);const o=Math.min(s.x,r.x,n.x,a.x),h=Math.min(s.y,r.y,n.y,a.y),l=Math.max(s.x,r.x,n.x,a.x),u=Math.max(s.y,r.y,n.y,a.y);e.x=o,e.y=h,e.width=l-o,e.height=u-h}roundFrame(t,e,s,r,n){if(!(t.width<=0||t.height<=0||s.width<=0||s.height<=0)){if(n){const{a,b:o,c:h,d:l}=n;if((Math.abs(o)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(a)>1e-4||Math.abs(l)>1e-4))return}n=n?tn.copyFrom(n):tn.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}}}en.extension={type:I.RendererSystem,name:"filter"},L.add(en);class Bo{constructor(t){this.framebuffer=t,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=at.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}}const ud=new j;class sn{constructor(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Ai(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);const t=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new j,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let e=this.renderer.context.extensions.drawBuffers,s=this.renderer.context.extensions.depthTexture;O.PREFER_ENV===_e.WEBGL_LEGACY&&(e=null,s=null),e?t.drawBuffers=r=>e.drawBuffersWEBGL(r):(this.hasMRT=!1,t.drawBuffers=()=>{}),s||(this.writeDepthTexture=!1)}else this.msaaSamples=t.getInternalformatParameter(t.RENDERBUFFER,t.RGBA8,t.SAMPLES)}bind(t,e,s=0){const{gl:r}=this;if(t){const n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,r.bindFramebuffer(r.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==s&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=s),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,s)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(let a=0;a >s,o=e.height>>s,h=a/e.width;this.setViewport(e.x*h,e.y*h,a,o)}else{const a=t.width>>s,o=t.height>>s;this.setViewport(0,0,a,o)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(t,e,s,r){const n=this.viewport;t=Math.round(t),e=Math.round(e),s=Math.round(s),r=Math.round(r),(n.width!==s||n.height!==r||n.x!==t||n.y!==e)&&(n.x=t,n.y=e,n.width=s,n.height=r,this.gl.viewport(t,e,s,r))}get size(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}}clear(t,e,s,r,n=Js.COLOR|Js.DEPTH){const{gl:a}=this;a.clearColor(t,e,s,r),a.clear(n)}initFramebuffer(t){const{gl:e}=this,s=new Bo(e.createFramebuffer());return s.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=s,this.managedFramebuffers.push(t),t.disposeRunner.add(this),s}resizeFramebuffer(t){const{gl:e}=this,s=t.glFramebuffers[this.CONTEXT_UID];if(s.stencil){e.bindRenderbuffer(e.RENDERBUFFER,s.stencil);let a;this.renderer.context.webGLVersion===1?a=e.DEPTH_STENCIL:t.depth&&t.stencil?a=e.DEPTH24_STENCIL8:t.depth?a=e.DEPTH_COMPONENT24:a=e.STENCIL_INDEX8,s.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,s.multisample,a,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,a,t.width,t.height)}const r=t.colorTextures;let n=r.length;e.drawBuffers||(n=Math.min(n,1));for(let a=0;a 1&&this.canMultisampleFramebuffer(t)?r.msaaBuffer=r.msaaBuffer||s.createRenderbuffer():r.msaaBuffer&&(s.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&(r.blitFramebuffer.dispose(),r.blitFramebuffer=null));const o=[];for(let h=0;h1&&s.drawBuffers(o),t.depthTexture&&this.writeDepthTexture){const h=t.depthTexture;this.renderer.texture.bind(h,0),s.framebufferTexture2D(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.TEXTURE_2D,h._glTextures[this.CONTEXT_UID].texture,e)}if((t.stencil||t.depth)&&!(t.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||s.createRenderbuffer();let h,l;this.renderer.context.webGLVersion===1?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH_STENCIL):t.depth&&t.stencil?(h=s.DEPTH_STENCIL_ATTACHMENT,l=s.DEPTH24_STENCIL8):t.depth?(h=s.DEPTH_ATTACHMENT,l=s.DEPTH_COMPONENT24):(h=s.STENCIL_ATTACHMENT,l=s.STENCIL_INDEX8),s.bindRenderbuffer(s.RENDERBUFFER,r.stencil),r.msaaBuffer?s.renderbufferStorageMultisample(s.RENDERBUFFER,r.multisample,l,t.width,t.height):s.renderbufferStorage(s.RENDERBUFFER,l,t.width,t.height),s.framebufferRenderbuffer(s.FRAMEBUFFER,h,s.RENDERBUFFER,r.stencil)}else r.stencil&&(s.deleteRenderbuffer(r.stencil),r.stencil=null)}canMultisampleFramebuffer(t){return this.renderer.context.webGLVersion!==1&&t.colorTextures.length<=1&&!t.depthTexture}detectSamples(t){const{msaaSamples:e}=this;let s=at.NONE;if(t<=1||e===null)return s;for(let r=0;r =0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(r.deleteFramebuffer(s.framebuffer),s.msaaBuffer&&r.deleteRenderbuffer(s.msaaBuffer),s.stencil&&r.deleteRenderbuffer(s.stencil)),s.blitFramebuffer&&this.disposeFramebuffer(s.blitFramebuffer,e)}disposeAll(t){const e=this.managedFramebuffers;this.managedFramebuffers=[];for(let s=0;s s.createVertexArrayOES(),t.bindVertexArray=r=>s.bindVertexArrayOES(r),t.deleteVertexArray=r=>s.deleteVertexArrayOES(r)):(this.hasVao=!1,t.createVertexArray=()=>null,t.bindVertexArray=()=>null,t.deleteVertexArray=()=>null)}if(e.webGLVersion!==2){const s=t.getExtension("ANGLE_instanced_arrays");s?(t.vertexAttribDivisor=(r,n)=>s.vertexAttribDivisorANGLE(r,n),t.drawElementsInstanced=(r,n,a,o,h)=>s.drawElementsInstancedANGLE(r,n,a,o,h),t.drawArraysInstanced=(r,n,a,o)=>s.drawArraysInstancedANGLE(r,n,a,o)):this.hasInstance=!1}this.canUseUInt32ElementIndex=e.webGLVersion===2||!!e.extensions.uint32ElementIndex}bind(t,e){e=e||this.renderer.shader.shader;const{gl:s}=this;let r=t.glVertexArrayObjects[this.CONTEXT_UID],n=!1;r||(this.managedGeometries[t.id]=t,t.disposeRunner.add(this),t.glVertexArrayObjects[this.CONTEXT_UID]=r={},n=!0);const a=r[e.program.id]||this.initGeometryVao(t,e,n);this._activeGeometry=t,this._activeVao!==a&&(this._activeVao=a,this.hasVao?s.bindVertexArray(a):this.activateVao(t,e.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this.renderer.buffer;for(let s=0;s 0?this.maskStack[this.maskStack.length-1]._colorMask:15;s!==e&&this.renderer.gl.colorMask((s&1)!==0,(s&2)!==0,(s&4)!==0,(s&8)!==0)}destroy(){this.renderer=null}}an.extension={type:I.RendererSystem,name:"mask"},L.add(an);class Uo{constructor(t){this.renderer=t,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(t){const{gl:e}=this.renderer,s=this.getStackLength();this.maskStack=t;const r=this.getStackLength();r!==s&&(r===0?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}}const ko=new tt,Go=[],$o=class nr extends Uo{constructor(t){super(t),this.glConst=O.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0}calcScissorRect(t){var e;if(t._scissorRectLocal)return;const s=t._scissorRect,{maskObject:r}=t,{renderer:n}=this,a=n.renderTexture,o=r.getBounds(!0,(e=Go.pop())!=null?e:new j);this.roundFrameToPixels(o,a.current?a.current.resolution:n.resolution,a.sourceFrame,a.destinationFrame,n.projection.transform),s&&o.fit(s),t._scissorRectLocal=o}static isMatrixRotated(t){if(!t)return!1;const{a:e,b:s,c:r,d:n}=t;return(Math.abs(s)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)}testScissor(t){const{maskObject:e}=t;if(!e.isFastRect||!e.isFastRect()||nr.isMatrixRotated(e.worldTransform)||nr.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);const s=t._scissorRectLocal;return s.width>0&&s.height>0}roundFrameToPixels(t,e,s,r,n){nr.isMatrixRotated(n)||(n=n?ko.copyFrom(n):ko.identity(),n.translate(-s.x,-s.y).scale(r.width/s.width,r.height/s.height).translate(r.x,r.y),this.renderer.filter.transformAABB(n,t),t.fit(r),t.x=Math.round(t.x*e),t.y=Math.round(t.y*e),t.width=Math.round(t.width*e),t.height=Math.round(t.height*e))}push(t){t._scissorRectLocal||this.calcScissorRect(t);const{gl:e}=this.renderer;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()}pop(t){const{gl:e}=this.renderer;t&&Go.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)}_useCurrent(){const t=this.maskStack[this.maskStack.length-1]._scissorRect;let e;this.renderer.renderTexture.current?e=t.y:e=this.renderer.height-t.height-t.y,this.renderer.gl.scissor(t.x,e,t.width,t.height)}};$o.extension={type:I.RendererSystem,name:"scissor"};let Ho=$o;L.add(Ho);class on extends Uo{constructor(t){super(t),this.glConst=O.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){const t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0}push(t){const e=t.maskObject,{gl:s}=this.renderer,r=t._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),s.clearStencil(0),s.clear(s.STENCIL_BUFFER_BIT),s.enable(s.STENCIL_TEST)),t._stencilCounter++;const n=t._colorMask;n!==0&&(t._colorMask=0,s.colorMask(!1,!1,!1,!1)),s.stencilFunc(s.EQUAL,r,4294967295),s.stencilOp(s.KEEP,s.KEEP,s.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,n!==0&&(t._colorMask=n,s.colorMask((n&1)!==0,(n&2)!==0,(n&4)!==0,(n&8)!==0)),this._useCurrent()}pop(t){const e=this.renderer.gl;if(this.getStackLength()===0)e.disable(e.STENCIL_TEST);else{const s=this.maskStack.length!==0?this.maskStack[this.maskStack.length-1]:null,r=s?s._colorMask:15;r!==0&&(s._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,r!==0&&(s._colorMask=r,e.colorMask((r&1)!==0,(r&2)!==0,(r&4)!==0,(r&8)!==0)),this._useCurrent()}}_useCurrent(){const t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)}}on.extension={type:I.RendererSystem,name:"stencil"},L.add(on);class hn{constructor(t){this.renderer=t,this.plugins={}}init(){const t=this.rendererPlugins;for(const e in t)this.plugins[e]=new t[e](this.renderer)}destroy(){for(const t in this.plugins)this.plugins[t].destroy(),this.plugins[t]=null}}hn.extension={type:[I.RendererSystem,I.CanvasRendererSystem],name:"_plugin"},L.add(hn);class ln{constructor(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new tt,this.transform=null}update(t,e,s,r){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,s,r),this.transform&&this.projectionMatrix.append(this.transform);const n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)}calculateProjection(t,e,s,r){const n=this.projectionMatrix,a=r?-1:1;n.identity(),n.a=1/e.width*2,n.d=a*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-a-e.y*n.d}setTransform(t){}destroy(){this.renderer=null}}ln.extension={type:I.RendererSystem,name:"projection"},L.add(ln);var Xo=Object.getOwnPropertySymbols,fd=Object.prototype.hasOwnProperty,pd=Object.prototype.propertyIsEnumerable,md=(i,t)=>{var e={};for(var s in i)fd.call(i,s)&&t.indexOf(s)<0&&(e[s]=i[s]);if(i!=null&&Xo)for(var s of Xo(i))t.indexOf(s)<0&&pd.call(i,s)&&(e[s]=i[s]);return e};const gd=new yi,Vo=new j;class un{constructor(t){this.renderer=t,this._tempMatrix=new tt}generateTexture(t,e){var s;const r=e||{},{region:n}=r,a=md(r,["region"]),o=(n==null?void 0:n.copyTo(Vo))||t.getLocalBounds(Vo,!0),h=a.resolution||this.renderer.resolution;o.width=Math.max(o.width,1/h),o.height=Math.max(o.height,1/h),a.width=o.width,a.height=o.height,a.resolution=h,(s=a.multisample)!=null||(a.multisample=this.renderer.multisample);const l=xe.create(a);this._tempMatrix.tx=-o.x,this._tempMatrix.ty=-o.y;const u=t.transform;return t.transform=gd,this.renderer.render(t,{renderTexture:l,transform:this._tempMatrix,skipUpdateTransform:!!t.parent,blit:!0}),t.transform=u,l}destroy(){}}un.extension={type:[I.RendererSystem,I.CanvasRendererSystem],name:"textureGenerator"},L.add(un);const Ne=new j,Ss=new j;class cn{constructor(t){this.renderer=t,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new j,this.destinationFrame=new j,this.viewportFrame=new j}contextChange(){var t;const e=(t=this.renderer)==null?void 0:t.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(t=null,e,s){const r=this.renderer;this.current=t;let n,a,o;t?(n=t.baseTexture,o=n.resolution,e||(Ne.width=t.frame.width,Ne.height=t.frame.height,e=Ne),s||(Ss.x=t.frame.x,Ss.y=t.frame.y,Ss.width=e.width,Ss.height=e.height,s=Ss),a=n.framebuffer):(o=r.resolution,e||(Ne.width=r._view.screen.width,Ne.height=r._view.screen.height,e=Ne),s||(s=Ne,s.width=e.width,s.height=e.height));const h=this.viewportFrame;h.x=s.x*o,h.y=s.y*o,h.width=s.width*o,h.height=s.height*o,t||(h.y=r.view.height-(h.y+h.height)),h.ceil(),this.renderer.framebuffer.bind(a,h),this.renderer.projection.update(s,e,o,!a),t?this.renderer.mask.setMaskStack(n.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(s)}clear(t,e){const s=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=Z.shared.setValue(t||s);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);const n=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=n.width!==a.width||n.height!==a.height;if(o){let{x:h,y:l,width:u,height:c}=this.viewportFrame;h=Math.round(h),l=Math.round(l),u=Math.round(u),c=Math.round(c),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(h,l,u,c)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,e),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}}cn.extension={type:I.RendererSystem,name:"renderTexture"},L.add(cn);class _d{}class jo{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}}function vd(i,t){const e={},s=t.getProgramParameter(i,t.ACTIVE_ATTRIBUTES);for(let r=0;r l>u?1:-1);for(let l=0;l({data:n,offset:0,dataLen:0,dirty:0}));let e=0,s=0,r=0;for(let n=0;n 1&&(e=Math.max(e,16)*a.data.size),a.dataLen=e,s%e!==0&&s<16){const o=s%e%16;s+=o,r+=o}s+e>16?(r=Math.ceil(r/16)*16,a.offset=r,r+=e,s=e):(a.offset=r,s+=e,r+=e)}return r=Math.ceil(r/16)*16,{uboElements:t,size:r}}function qo(i,t){const e=[];for(const s in i)t[s]&&e.push(t[s]);return e.sort((s,r)=>s.index-r.index),e}function Ko(i,t){if(!i.autoManage)return{size:0,syncFunc:xd};const e=qo(i.uniforms,t),{uboElements:s,size:r}=Yo(e),n=[` + var v = null; + var v2 = null; + var cv = null; + var t = 0; + var gl = renderer.gl + var index = 0; + var data = buffer.data; + `];for(let a=0;a 1){const c=Ao(o.data.type),d=Math.max(zo[o.data.type]/16,1),f=c/d,p=(4-f%4)%4;n.push(` + cv = ud.${l}.value; + v = uv.${l}; + offset = ${o.offset/4}; + + t = 0; + + for(var i=0; i < ${o.data.size*d}; i++) + { + for(var j = 0; j < ${f}; j++) + { + data[offset++] = v[t++]; + } + offset += ${p}; + } + + `)}else{const c=bd[o.data.type];n.push(` + cv = ud.${l}.value; + v = uv.${l}; + offset = ${o.offset/4}; + ${c}; + `)}}return n.push(` + renderer.buffer.update(buffer); + `),{size:r,syncFunc:new Function("ud","uv","renderer","syncData","buffer",n.join(` + `))}}let Td=0;const Ii={textureCount:0,uboCount:0};class dn{constructor(t){this.destroyed=!1,this.renderer=t,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=Td++}systemCheck(){if(!Io())throw new Error("Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.")}contextChange(t){this.gl=t,this.reset()}bind(t,e){t.disposeRunner.add(this),t.uniforms.globals=this.renderer.globalUniforms;const s=t.program,r=s.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(t);return this.shader=t,this.program!==s&&(this.program=s,this.gl.useProgram(r.program)),e||(Ii.textureCount=0,Ii.uboCount=0,this.syncUniformGroup(t.uniformGroup,Ii)),r}setUniforms(t){const e=this.shader.program,s=e.glPrograms[this.renderer.CONTEXT_UID];e.syncUniforms(s.uniformData,t,this.renderer)}syncUniformGroup(t,e){const s=this.getGlProgram();(!t.static||t.dirtyId!==s.uniformDirtyGroups[t.id])&&(s.uniformDirtyGroups[t.id]=t.dirtyId,this.syncUniforms(t,s,e))}syncUniforms(t,e,s){(t.syncUniforms[this.shader.program.id]||this.createSyncGroups(t))(e.uniformData,t.uniforms,this.renderer,s)}createSyncGroups(t){const e=this.getSignature(t,this.shader.program.uniformData,"u");return this.cache[e]||(this.cache[e]=Qc(t,this.shader.program.uniformData)),t.syncUniforms[this.shader.program.id]=this.cache[e],t.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(t,e){const s=this.getGlProgram();if(!t.static||t.dirtyId!==0||!s.uniformGroups[t.id]){t.dirtyId=0;const r=s.uniformGroups[t.id]||this.createSyncBufferGroup(t,s,e);t.buffer.update(),r(s.uniformData,t.uniforms,this.renderer,Ii,t.buffer)}this.renderer.buffer.bindBufferBase(t.buffer,s.uniformBufferBindings[e])}createSyncBufferGroup(t,e,s){const{gl:r}=this.renderer;this.renderer.buffer.bind(t.buffer);const n=this.gl.getUniformBlockIndex(e.program,s);e.uniformBufferBindings[s]=this.shader.uniformBindCount,r.uniformBlockBinding(e.program,n,this.shader.uniformBindCount),this.shader.uniformBindCount++;const a=this.getSignature(t,this.shader.program.uniformData,"ubo");let o=this._uboCache[a];if(o||(o=this._uboCache[a]=Ko(t,this.shader.program.uniformData)),t.autoManage){const h=new Float32Array(o.size/4);t.buffer.update(h)}return e.uniformGroups[t.id]=o.syncFunc,e.uniformGroups[t.id]}getSignature(t,e,s){const r=t.uniforms,n=[`${s}-`];for(const a in r)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(t){const e=this.gl,s=t.program,r=Wo(e,s);return s.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(t){this.shader===t&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}}dn.extension={type:I.RendererSystem,name:"shader"},L.add(dn);class Rs{constructor(t){this.renderer=t}run(t){const{renderer:e}=this;e.runners.init.emit(e.options),t.hello&&console.log(`PixiJS 7.4.2 - ${e.rendererLogId} - https://pixijs.com`),e.resize(e.screen.width,e.screen.height)}destroy(){}}Rs.defaultOptions={hello:!1},Rs.extension={type:[I.RendererSystem,I.CanvasRendererSystem],name:"startup"},L.add(Rs);function Ed(i,t=[]){return t[H.NORMAL]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.ADD]=[i.ONE,i.ONE],t[H.MULTIPLY]=[i.DST_COLOR,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SCREEN]=[i.ONE,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.OVERLAY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.DARKEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.LIGHTEN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR_DODGE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR_BURN]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.HARD_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SOFT_LIGHT]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.DIFFERENCE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.EXCLUSION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.HUE]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SATURATION]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.COLOR]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.LUMINOSITY]=[i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.NONE]=[0,0],t[H.NORMAL_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_ALPHA,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.ADD_NPM]=[i.SRC_ALPHA,i.ONE,i.ONE,i.ONE],t[H.SCREEN_NPM]=[i.SRC_ALPHA,i.ONE_MINUS_SRC_COLOR,i.ONE,i.ONE_MINUS_SRC_ALPHA],t[H.SRC_IN]=[i.DST_ALPHA,i.ZERO],t[H.SRC_OUT]=[i.ONE_MINUS_DST_ALPHA,i.ZERO],t[H.SRC_ATOP]=[i.DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[H.DST_OVER]=[i.ONE_MINUS_DST_ALPHA,i.ONE],t[H.DST_IN]=[i.ZERO,i.SRC_ALPHA],t[H.DST_OUT]=[i.ZERO,i.ONE_MINUS_SRC_ALPHA],t[H.DST_ATOP]=[i.ONE_MINUS_DST_ALPHA,i.SRC_ALPHA],t[H.XOR]=[i.ONE_MINUS_DST_ALPHA,i.ONE_MINUS_SRC_ALPHA],t[H.SUBTRACT]=[i.ONE,i.ONE,i.ONE,i.ONE,i.FUNC_REVERSE_SUBTRACT,i.FUNC_ADD],t}const Ad=0,wd=1,Sd=2,Rd=3,Id=4,Cd=5,Zo=class ta{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=H.NONE,this._blendEq=!1,this.map=[],this.map[Ad]=this.setBlend,this.map[wd]=this.setOffset,this.map[Sd]=this.setCullFace,this.map[Rd]=this.setDepthTest,this.map[Id]=this.setFrontFace,this.map[Cd]=this.setDepthMask,this.checks=[],this.defaultState=new Zt,this.defaultState.blend=!0}contextChange(t){this.gl=t,this.blendModes=Ed(t),this.set(this.defaultState),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1< >1,s++;this.stateId=t.data}for(let e=0;et.systems[n]),r=[...s,...Object.keys(t.systems).filter(n=>!s.includes(n))];for(const n of r)this.addSystem(t.systems[n],n)}addRunners(...t){t.forEach(e=>{this.runners[e]=new St(e)})}addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const r in this.runners)this.runners[r].add(s);return this}emitWithCustomOptions(t,e){const s=Object.keys(this._systemsHash);t.items.forEach(r=>{const n=s.find(a=>this._systemsHash[a]===r);r[t.name](e[n])})}destroy(){Object.values(this.runners).forEach(t=>{t.destroy()}),this._systemsHash={}}}const Is=class ar{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=ar.defaultMaxIdle,this.checkCountMax=ar.defaultCheckCountMax,this.mode=ar.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==ti.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this.renderer.texture,e=t.managedTextures;let s=!1;for(let r=0;r this.maxIdle&&(t.destroyTexture(n,!0),e[r]=null,s=!0)}if(s){let r=0;for(let n=0;n =0;r--)this.unload(t.children[r])}destroy(){this.renderer=null}};Is.defaultMode=ti.AUTO,Is.defaultMaxIdle=3600,Is.defaultCheckCountMax=600,Is.extension={type:I.RendererSystem,name:"textureGC"};let be=Is;L.add(be);class Ci{constructor(t){this.texture=t,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=k.UNSIGNED_BYTE,this.internalFormat=A.RGBA,this.samplerType=0}}function Pd(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[i.RGB]:D.FLOAT,[i.RGBA]:D.FLOAT,[i.ALPHA]:D.FLOAT,[i.LUMINANCE]:D.FLOAT,[i.LUMINANCE_ALPHA]:D.FLOAT,[i.R8]:D.FLOAT,[i.R8_SNORM]:D.FLOAT,[i.RG8]:D.FLOAT,[i.RG8_SNORM]:D.FLOAT,[i.RGB8]:D.FLOAT,[i.RGB8_SNORM]:D.FLOAT,[i.RGB565]:D.FLOAT,[i.RGBA4]:D.FLOAT,[i.RGB5_A1]:D.FLOAT,[i.RGBA8]:D.FLOAT,[i.RGBA8_SNORM]:D.FLOAT,[i.RGB10_A2]:D.FLOAT,[i.RGB10_A2UI]:D.FLOAT,[i.SRGB8]:D.FLOAT,[i.SRGB8_ALPHA8]:D.FLOAT,[i.R16F]:D.FLOAT,[i.RG16F]:D.FLOAT,[i.RGB16F]:D.FLOAT,[i.RGBA16F]:D.FLOAT,[i.R32F]:D.FLOAT,[i.RG32F]:D.FLOAT,[i.RGB32F]:D.FLOAT,[i.RGBA32F]:D.FLOAT,[i.R11F_G11F_B10F]:D.FLOAT,[i.RGB9_E5]:D.FLOAT,[i.R8I]:D.INT,[i.R8UI]:D.UINT,[i.R16I]:D.INT,[i.R16UI]:D.UINT,[i.R32I]:D.INT,[i.R32UI]:D.UINT,[i.RG8I]:D.INT,[i.RG8UI]:D.UINT,[i.RG16I]:D.INT,[i.RG16UI]:D.UINT,[i.RG32I]:D.INT,[i.RG32UI]:D.UINT,[i.RGB8I]:D.INT,[i.RGB8UI]:D.UINT,[i.RGB16I]:D.INT,[i.RGB16UI]:D.UINT,[i.RGB32I]:D.INT,[i.RGB32UI]:D.UINT,[i.RGBA8I]:D.INT,[i.RGBA8UI]:D.UINT,[i.RGBA16I]:D.INT,[i.RGBA16UI]:D.UINT,[i.RGBA32I]:D.INT,[i.RGBA32UI]:D.UINT,[i.DEPTH_COMPONENT16]:D.FLOAT,[i.DEPTH_COMPONENT24]:D.FLOAT,[i.DEPTH_COMPONENT32F]:D.FLOAT,[i.DEPTH_STENCIL]:D.FLOAT,[i.DEPTH24_STENCIL8]:D.FLOAT,[i.DEPTH32F_STENCIL8]:D.FLOAT}:t={[i.RGB]:D.FLOAT,[i.RGBA]:D.FLOAT,[i.ALPHA]:D.FLOAT,[i.LUMINANCE]:D.FLOAT,[i.LUMINANCE_ALPHA]:D.FLOAT,[i.DEPTH_STENCIL]:D.FLOAT},t}function Md(i){let t;return"WebGL2RenderingContext"in globalThis&&i instanceof globalThis.WebGL2RenderingContext?t={[k.UNSIGNED_BYTE]:{[A.RGBA]:i.RGBA8,[A.RGB]:i.RGB8,[A.RG]:i.RG8,[A.RED]:i.R8,[A.RGBA_INTEGER]:i.RGBA8UI,[A.RGB_INTEGER]:i.RGB8UI,[A.RG_INTEGER]:i.RG8UI,[A.RED_INTEGER]:i.R8UI,[A.ALPHA]:i.ALPHA,[A.LUMINANCE]:i.LUMINANCE,[A.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[k.BYTE]:{[A.RGBA]:i.RGBA8_SNORM,[A.RGB]:i.RGB8_SNORM,[A.RG]:i.RG8_SNORM,[A.RED]:i.R8_SNORM,[A.RGBA_INTEGER]:i.RGBA8I,[A.RGB_INTEGER]:i.RGB8I,[A.RG_INTEGER]:i.RG8I,[A.RED_INTEGER]:i.R8I},[k.UNSIGNED_SHORT]:{[A.RGBA_INTEGER]:i.RGBA16UI,[A.RGB_INTEGER]:i.RGB16UI,[A.RG_INTEGER]:i.RG16UI,[A.RED_INTEGER]:i.R16UI,[A.DEPTH_COMPONENT]:i.DEPTH_COMPONENT16},[k.SHORT]:{[A.RGBA_INTEGER]:i.RGBA16I,[A.RGB_INTEGER]:i.RGB16I,[A.RG_INTEGER]:i.RG16I,[A.RED_INTEGER]:i.R16I},[k.UNSIGNED_INT]:{[A.RGBA_INTEGER]:i.RGBA32UI,[A.RGB_INTEGER]:i.RGB32UI,[A.RG_INTEGER]:i.RG32UI,[A.RED_INTEGER]:i.R32UI,[A.DEPTH_COMPONENT]:i.DEPTH_COMPONENT24},[k.INT]:{[A.RGBA_INTEGER]:i.RGBA32I,[A.RGB_INTEGER]:i.RGB32I,[A.RG_INTEGER]:i.RG32I,[A.RED_INTEGER]:i.R32I},[k.FLOAT]:{[A.RGBA]:i.RGBA32F,[A.RGB]:i.RGB32F,[A.RG]:i.RG32F,[A.RED]:i.R32F,[A.DEPTH_COMPONENT]:i.DEPTH_COMPONENT32F},[k.HALF_FLOAT]:{[A.RGBA]:i.RGBA16F,[A.RGB]:i.RGB16F,[A.RG]:i.RG16F,[A.RED]:i.R16F},[k.UNSIGNED_SHORT_5_6_5]:{[A.RGB]:i.RGB565},[k.UNSIGNED_SHORT_4_4_4_4]:{[A.RGBA]:i.RGBA4},[k.UNSIGNED_SHORT_5_5_5_1]:{[A.RGBA]:i.RGB5_A1},[k.UNSIGNED_INT_2_10_10_10_REV]:{[A.RGBA]:i.RGB10_A2,[A.RGBA_INTEGER]:i.RGB10_A2UI},[k.UNSIGNED_INT_10F_11F_11F_REV]:{[A.RGB]:i.R11F_G11F_B10F},[k.UNSIGNED_INT_5_9_9_9_REV]:{[A.RGB]:i.RGB9_E5},[k.UNSIGNED_INT_24_8]:{[A.DEPTH_STENCIL]:i.DEPTH24_STENCIL8},[k.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[A.DEPTH_STENCIL]:i.DEPTH32F_STENCIL8}}:t={[k.UNSIGNED_BYTE]:{[A.RGBA]:i.RGBA,[A.RGB]:i.RGB,[A.ALPHA]:i.ALPHA,[A.LUMINANCE]:i.LUMINANCE,[A.LUMINANCE_ALPHA]:i.LUMINANCE_ALPHA},[k.UNSIGNED_SHORT_5_6_5]:{[A.RGB]:i.RGB},[k.UNSIGNED_SHORT_4_4_4_4]:{[A.RGBA]:i.RGBA},[k.UNSIGNED_SHORT_5_5_5_1]:{[A.RGBA]:i.RGBA}},t}class fn{constructor(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new V,this.hasIntegerTextures=!1}contextChange(){const t=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=Md(t),this.samplerTypes=Pd(t);const e=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=e;for(let r=0;r =0;--n){const a=e[n];a&&a._glTextures[r].samplerType!==D.FLOAT&&this.renderer.texture.unbind(a)}}initTexture(t){const e=new Ci(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e}initTextureType(t,e){var s,r,n;e.internalFormat=(r=(s=this.internalFormats[t.type])==null?void 0:s[t.format])!=null?r:t.format,e.samplerType=(n=this.samplerTypes[e.internalFormat])!=null?n:D.FLOAT,this.webGLVersion===2&&t.type===k.HALF_FLOAT?e.type=this.gl.HALF_FLOAT:e.type=t.type}updateTexture(t){var e;const s=t._glTextures[this.CONTEXT_UID];if(!s)return;const r=this.renderer;if(this.initTextureType(t,s),(e=t.resource)!=null&&e.upload(r,t,s))s.samplerType!==D.FLOAT&&(this.hasIntegerTextures=!0);else{const n=t.realWidth,a=t.realHeight,o=r.gl;(s.width!==n||s.height!==a||s.dirtyId<0)&&(s.width=n,s.height=a,o.texImage2D(t.target,0,s.internalFormat,n,a,0,t.format,s.type,null))}t.dirtyStyleId!==s.dirtyStyleId&&this.updateTextureStyle(t),s.dirtyId=t.dirtyId}destroyTexture(t,e){const{gl:s}=this;if(t=t.castToBaseTexture(),t._glTextures[this.CONTEXT_UID]&&(this.unbind(t),s.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){const r=this.managedTextures.indexOf(t);r!==-1&&Ce(this.managedTextures,r,1)}}updateTextureStyle(t){var e;const s=t._glTextures[this.CONTEXT_UID];s&&((t.mipmap===Ut.POW2||this.webGLVersion!==2)&&!t.isPowerOfTwo?s.mipmap=!1:s.mipmap=t.mipmap>=1,this.webGLVersion!==2&&!t.isPowerOfTwo?s.wrapMode=zt.CLAMP:s.wrapMode=t.wrapMode,(e=t.resource)!=null&&e.style(this.renderer,t,s)||this.setStyle(t,s),s.dirtyStyleId=t.dirtyStyleId)}setStyle(t,e){const s=this.gl;if(e.mipmap&&t.mipmap!==Ut.ON_MANUAL&&s.generateMipmap(t.target),s.texParameteri(t.target,s.TEXTURE_WRAP_S,e.wrapMode),s.texParameteri(t.target,s.TEXTURE_WRAP_T,e.wrapMode),e.mipmap){s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===Wt.LINEAR?s.LINEAR_MIPMAP_LINEAR:s.NEAREST_MIPMAP_NEAREST);const r=this.renderer.context.extensions.anisotropicFiltering;if(r&&t.anisotropicLevel>0&&t.scaleMode===Wt.LINEAR){const n=Math.min(t.anisotropicLevel,s.getParameter(r.MAX_TEXTURE_MAX_ANISOTROPY_EXT));s.texParameterf(t.target,r.TEXTURE_MAX_ANISOTROPY_EXT,n)}}else s.texParameteri(t.target,s.TEXTURE_MIN_FILTER,t.scaleMode===Wt.LINEAR?s.LINEAR:s.NEAREST);s.texParameteri(t.target,s.TEXTURE_MAG_FILTER,t.scaleMode===Wt.LINEAR?s.LINEAR:s.NEAREST)}destroy(){this.renderer=null}}fn.extension={type:I.RendererSystem,name:"texture"},L.add(fn);class pn{constructor(t){this.renderer=t}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glTransformFeedbacks[s]||this.createGLTransformFeedback(t);e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r)}unbind(){const{gl:t}=this;t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(t,e){const{gl:s,renderer:r}=this;e&&r.shader.bind(e),s.beginTransformFeedback(t)}endTransformFeedback(){const{gl:t}=this;t.endTransformFeedback()}createGLTransformFeedback(t){const{gl:e,renderer:s,CONTEXT_UID:r}=this,n=e.createTransformFeedback();t._glTransformFeedbacks[r]=n,e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,n);for(let a=0;a t in i?Dd(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Pi=(i,t)=>{for(var e in t||(t={}))Od.call(t,e)&&eh(i,e,t[e]);if(th)for(var e of th(t))Bd.call(t,e)&&eh(i,e,t[e]);return i};O.PREFER_ENV=_e.WEBGL2,O.STRICT_TEXTURE_CACHE=!1,O.RENDER_OPTIONS=Pi(Pi(Pi(Pi({},ws.defaultOptions),As.defaultOptions),Cs.defaultOptions),Rs.defaultOptions),Object.defineProperties(O,{WRAP_MODE:{get(){return V.defaultOptions.wrapMode},set(i){V.defaultOptions.wrapMode=i}},SCALE_MODE:{get(){return V.defaultOptions.scaleMode},set(i){V.defaultOptions.scaleMode=i}},MIPMAP_TEXTURES:{get(){return V.defaultOptions.mipmap},set(i){V.defaultOptions.mipmap=i}},ANISOTROPIC_LEVEL:{get(){return V.defaultOptions.anisotropicLevel},set(i){V.defaultOptions.anisotropicLevel=i}},FILTER_RESOLUTION:{get(){return xt.defaultResolution},set(i){xt.defaultResolution=i}},FILTER_MULTISAMPLE:{get(){return xt.defaultMultisample},set(i){xt.defaultMultisample=i}},SPRITE_MAX_TEXTURES:{get(){return ye.defaultMaxTextures},set(i){ye.defaultMaxTextures=i}},SPRITE_BATCH_SIZE:{get(){return ye.defaultBatchSize},set(i){ye.defaultBatchSize=i}},CAN_UPLOAD_SAME_BUFFER:{get(){return ye.canUploadSameBuffer},set(i){ye.canUploadSameBuffer=i}},GC_MODE:{get(){return be.defaultMode},set(i){be.defaultMode=i}},GC_MAX_IDLE:{get(){return be.defaultMaxIdle},set(i){be.defaultMaxIdle=i}},GC_MAX_CHECK_COUNT:{get(){return be.defaultCheckCountMax},set(i){be.defaultCheckCountMax=i}},PRECISION_VERTEX:{get(){return Qt.defaultVertexPrecision},set(i){Qt.defaultVertexPrecision=i}},PRECISION_FRAGMENT:{get(){return Qt.defaultFragmentPrecision},set(i){Qt.defaultFragmentPrecision=i}}});var ue=(i=>(i[i.INTERACTION=50]="INTERACTION",i[i.HIGH=25]="HIGH",i[i.NORMAL=0]="NORMAL",i[i.LOW=-25]="LOW",i[i.UTILITY=-50]="UTILITY",i))(ue||{});class mn{constructor(t,e=null,s=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=s,this.once=r}match(t,e=null){return this.fn===t&&this.context===e}emit(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));const e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const sh=class Pt{constructor(){this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new mn(null,null,1/0),this.deltaMS=1/Pt.targetFPMS,this.elapsedMS=1/Pt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=ue.NORMAL){return this._addListener(new mn(t,e,s))}addOnce(t,e,s=ue.NORMAL){return this._addListener(new mn(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n {this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?mt.shared:new mt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}gn.extension=I.Application,L.add(gn);const ih=[];L.handleByList(I.Renderer,ih);function rh(i){for(const t of ih)if(t.test(i))return new t(i);throw new Error("Unable to auto-detect a suitable renderer.")}var Fd=`attribute vec2 aVertexPosition; + attribute vec2 aTextureCoord; + + uniform mat3 projectionMatrix; + + varying vec2 vTextureCoord; + + void main(void) + { + gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0); + vTextureCoord = aTextureCoord; + }`,Nd=`attribute vec2 aVertexPosition; + + uniform mat3 projectionMatrix; + + varying vec2 vTextureCoord; + + uniform vec4 inputSize; + uniform vec4 outputFrame; + + vec4 filterVertexPosition( void ) + { + vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy; + + return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + } + + vec2 filterTextureCoord( void ) + { + return aVertexPosition * (outputFrame.zw * inputSize.zw); + } + + void main(void) + { + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); + } + `;const nh=Fd,_n=Nd;class vn{constructor(t){this.renderer=t}contextChange(t){let e;if(this.renderer.context.webGLVersion===1){const s=t.getParameter(t.FRAMEBUFFER_BINDING);t.bindFramebuffer(t.FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.FRAMEBUFFER,s)}else{const s=t.getParameter(t.DRAW_FRAMEBUFFER_BINDING);t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),e=t.getParameter(t.SAMPLES),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,s)}e>=at.HIGH?this.multisample=at.HIGH:e>=at.MEDIUM?this.multisample=at.MEDIUM:e>=at.LOW?this.multisample=at.LOW:this.multisample=at.NONE}destroy(){}}vn.extension={type:I.RendererSystem,name:"_multisample"},L.add(vn);class Ld{constructor(t){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}}class yn{constructor(t){this.renderer=t,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);e.bindBuffer(t.type,r.buffer)}unbind(t){const{gl:e}=this;e.bindBuffer(t,null)}bindBufferBase(t,e){const{gl:s,CONTEXT_UID:r}=this;if(this.boundBufferBases[e]!==t){const n=t._glBuffers[r]||this.createGLBuffer(t);this.boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,n.buffer)}}bindBufferRange(t,e,s){const{gl:r,CONTEXT_UID:n}=this;s=s||0;const a=t._glBuffers[n]||this.createGLBuffer(t);r.bindBufferRange(r.UNIFORM_BUFFER,e||0,a.buffer,s*256,256)}update(t){const{gl:e,CONTEXT_UID:s}=this,r=t._glBuffers[s]||this.createGLBuffer(t);if(t._updateID!==r.updateID)if(r.updateID=t._updateID,e.bindBuffer(t.type,r.buffer),r.byteLength>=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{const n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;r.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}}dispose(t,e){if(!this.managedBuffers[t.id])return;delete this.managedBuffers[t.id];const s=t._glBuffers[this.CONTEXT_UID],r=this.gl;t.disposeRunner.remove(this),s&&(e||r.deleteBuffer(s.buffer),delete t._glBuffers[this.CONTEXT_UID])}disposeAll(t){const e=Object.keys(this.managedBuffers);for(let s=0;s e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(t).then(()=>{const{realWidth:e,realHeight:s}=this.items[0];return this.resize(e,s),this.update(),Promise.resolve(this)}),this._load}}class ah extends bn{constructor(t,e){const{width:s,height:r}=e||{};let n,a;Array.isArray(t)?(n=t,a=t.length):a=t,super(a,{width:s,height:r}),n&&this.initFromArray(n,e)}addBaseTextureAt(t,e){if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("ArrayResource does not support RenderTexture");return this}bind(t){super.bind(t),t.target=Re.TEXTURE_2D_ARRAY}upload(t,e,s){const{length:r,itemDirtyIds:n,items:a}=this,{gl:o}=t;s.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,s.internalFormat,this._width,this._height,r,0,e.format,s.type,null);for(let h=0;h 0)if(t.resource)this.addResourceAt(t.resource,e);else throw new Error("CubeResource does not support copying of renderTexture.");else t.target=Re.TEXTURE_CUBE_MAP_POSITIVE_X+e,t.parentTextureArray=this.baseTexture,this.items[e]=t;return t.valid&&!this.valid&&this.resize(t.realWidth,t.realHeight),this.items[e]=t,this}upload(t,e,s){const r=this.itemDirtyIds;for(let n=0;n {if(this.url===null){t(this);return}try{const s=await O.ADAPTER.fetch(this.url,{mode:this.crossOrigin?"cors":"no-cors"});if(this.destroyed)return;const r=await s.blob();if(this.destroyed)return;const n=await createImageBitmap(r,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===Tt.UNPACK?"premultiply":"none"});if(this.destroyed){n.close();return}this.source=n,this.update(),t(this)}catch(s){if(this.destroyed)return;e(s),this.onError.emit(s)}}),this._load)}upload(t,e,s){return this.source instanceof ImageBitmap?(typeof this.alphaMode=="number"&&(e.alphaMode=this.alphaMode),super.upload(t,e,s)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(t){return!!globalThis.createImageBitmap&&typeof ImageBitmap!="undefined"&&(typeof t=="string"||t instanceof ImageBitmap)}static get EMPTY(){var t;return Le._EMPTY=(t=Le._EMPTY)!=null?t:O.ADAPTER.createCanvas(0,0),Le._EMPTY}}const Tn=class or extends Jt{constructor(t,e){e=e||{},super(O.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=t,this.scale=e.scale||1,this._overrideWidth=e.width,this._overrideHeight=e.height,this._resolve=null,this._crossorigin=e.crossorigin,this._load=null,e.autoLoad!==!1&&this.load()}load(){return this._load?this._load:(this._load=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},or.SVG_XML.test(this.svg.trim())){if(!btoa)throw new Error("Your browser doesn't support base64 conversions.");this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load)}_loadSvg(){const t=new Image;Jt.crossOrigin(t,this.svg,this._crossorigin),t.src=this.svg,t.onerror=e=>{this._resolve&&(t.onerror=null,this.onError.emit(e))},t.onload=()=>{if(!this._resolve)return;const e=t.width,s=t.height;if(!e||!s)throw new Error("The SVG image must have width and height defined (in pixels), canvas API needs them.");let r=e*this.scale,n=s*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/s*e,n=this._overrideHeight||this._overrideWidth/e*s),r=Math.round(r),n=Math.round(n);const a=this.source;a.width=r,a.height=n,a._pixiId=`canvas_${ve()}`,a.getContext("2d").drawImage(t,0,0,e,s,0,0,r,n),this._resolve(),this._resolve=null}}static getSize(t){const e=or.SVG_SIZE.exec(t),s={};return e&&(s[e[1]]=Math.round(parseFloat(e[3])),s[e[5]]=Math.round(parseFloat(e[7]))),s}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,e){return e==="svg"||typeof t=="string"&&t.startsWith("data:image/svg+xml")||typeof t=="string"&&or.SVG_XML.test(t)}};Tn.SVG_XML=/^(<\?xml[^?]+\?>)?\s*()]*-->)?\s*\